[PATCH] Fix pool_member_of() for Net devices of type network

# HG changeset patch # User Dan Smith <danms@us.ibm.com> # Date 1211984997 25200 # Node ID edf43e3ad962d666500b682a19aea71267be7e4b # 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@us.ibm.com> diff -r e987c6ce0994 -r edf43e3ad962 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 07:29:57 2008 -0700 @@ -378,13 +378,20 @@ } 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 @@ 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 @@ 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; } }

Dan Smith wrote:
# HG changeset patch # User Dan Smith <danms@us.ibm.com> # Date 1211984997 25200 # Node ID edf43e3ad962d666500b682a19aea71267be7e4b # 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@us.ibm.com>
+1 -- Kaitlin Rupert IBM Linux Technology Center kaitlin@linux.vnet.ibm.com

+1 for me. Dan Smith wrote:
# HG changeset patch # User Dan Smith <danms@us.ibm.com> # Date 1211984997 25200 # Node ID edf43e3ad962d666500b682a19aea71267be7e4b # 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@us.ibm.com>
diff -r e987c6ce0994 -r edf43e3ad962 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 07:29:57 2008 -0700 @@ -378,13 +378,20 @@ }
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 @@ 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 @@ 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; } }
_______________________________________________ Libvirt-cim mailing list Libvirt-cim@redhat.com https://www.redhat.com/mailman/listinfo/libvirt-cim
participants (3)
-
Dan Smith
-
Deepti B Kalakeri
-
Kaitlin Rupert