rpms/libvirt-cim/F-9 poolmember.patch,NONE,1.1

Dan Smith (danms) fedora-extras-commits at redhat.com
Thu May 29 19:57:57 UTC 2008


Author: danms

Update of /cvs/pkgs/rpms/libvirt-cim/F-9
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv2013

Added Files:
	poolmember.patch 
Log Message:
Forgot to add this file


poolmember.patch:

--- NEW FILE poolmember.patch ---
# HG changeset patch
# User Dan Smith <danms at us.ibm.com>
# Date 1211989279 25200
# Node ID 19692a8250f94d00cb27ca96158acf0727587110
# Parent  e987c6ce099434eddec21ca021eba5cd37c4e946
Fix pool_member_of() for Net devices of type network

Some assumptions were made in this code about what the source field contained
which were no longer correct when we added network (instead of bridge)
support.  This patch checks the type and interprets the field correctly.

This fixes RAFP for domains with 'network' interfaces for me.

Signed-off-by: Dan Smith <danms at us.ibm.com>

diff -r e987c6ce0994 -r 19692a8250f9 src/Virt_DevicePool.c
--- a/src/Virt_DevicePool.c	Tue May 20 10:33:56 2008 -0700
+++ b/src/Virt_DevicePool.c	Wed May 28 08:41:19 2008 -0700
@@ -378,13 +378,20 @@ static virNetworkPtr bridge_to_network(v
 }
 
 static char *_netpool_member_of(virConnectPtr conn,
-                                const char *bridge)
+                                const struct net_device *ndev)
 {
         virNetworkPtr net = NULL;
         const char *netname;
         char *pool = NULL;
 
-        net = bridge_to_network(conn, bridge);
+        if (STREQ(ndev->type, "bridge"))
+                net = bridge_to_network(conn, ndev->source);
+        else if (STREQ(ndev->type, "network"))
+                net = virNetworkLookupByName(conn, ndev->source);
+        else {
+                CU_DEBUG("Unhandled network type `%s'", ndev->type);
+        }
+
         if (net == NULL)
                 goto out;
 
@@ -395,7 +402,7 @@ static char *_netpool_member_of(virConne
         if (asprintf(&pool, "NetworkPool/%s", netname) == -1)
                 pool = NULL;
 
-        CU_DEBUG("Determined pool: %s (%s, %s)", pool, bridge, netname);
+        CU_DEBUG("Determined pool: %s (%s, %s)", pool, ndev->source, netname);
 
  out:
         virNetworkFree(net);
@@ -435,7 +442,7 @@ static char *netpool_member_of(const CMP
         for (i = 0; i < count; i++) {
                 if (STREQ((devs[i].id), dev)) {
                         result = _netpool_member_of(conn,
-                                                    devs[i].dev.net.source);
+                                                    &devs[i].dev.net);
                         break;
                 }
         }




More information about the scm-commits mailing list