]> xenbits.xensource.com Git - libvirt.git/commitdiff
lxc: always use virDomainNetGetActualBridgeName to get interface's bridge
authorLaine Stump <laine@laine.org>
Fri, 21 Nov 2014 20:08:50 +0000 (15:08 -0500)
committerLaine Stump <laine@laine.org>
Mon, 8 Dec 2014 19:52:17 +0000 (14:52 -0500)
lxcProcessSetupInterfaces() used to have a special case for
actualType='network' (a network with forward mode of route, nat, or
isolated) to call the libvirt public API to retrieve the bridge being
used by a network. That is no longer necessary - since all network
types that use a bridge and tap device now get the bridge name stored
in the ActualNetDef, we can just always use
virDomainNetGetActualBridgeName() instead.

src/lxc/lxc_driver.c
src/lxc/lxc_process.c

index 97caee35b5cc7879dfe0ff0c9724c32525d5f6df..51c664f6d15591a32a424261f07819bfaec2a388 100644 (file)
@@ -4161,7 +4161,8 @@ lxcDomainAttachDeviceNetLive(virConnectPtr conn,
     actualType = virDomainNetGetActualType(net);
 
     switch (actualType) {
-    case VIR_DOMAIN_NET_TYPE_BRIDGE: {
+    case VIR_DOMAIN_NET_TYPE_BRIDGE:
+    case VIR_DOMAIN_NET_TYPE_NETWORK: {
         const char *brname = virDomainNetGetActualBridgeName(net);
         if (!brname) {
             virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
@@ -4174,29 +4175,6 @@ lxcDomainAttachDeviceNetLive(virConnectPtr conn,
                                                         brname)))
             goto cleanup;
     }   break;
-    case VIR_DOMAIN_NET_TYPE_NETWORK: {
-        virNetworkPtr network;
-        char *brname = NULL;
-        bool fail = false;
-
-        if (!(network = virNetworkLookupByName(conn, net->data.network.name)))
-            goto cleanup;
-        if (!(brname = virNetworkGetBridgeName(network)))
-           fail = true;
-
-        virObjectUnref(network);
-        if (fail)
-            goto cleanup;
-
-        if (!(veth = virLXCProcessSetupInterfaceBridged(conn,
-                                                        vm->def,
-                                                        net,
-                                                        brname))) {
-            VIR_FREE(brname);
-            goto cleanup;
-        }
-        VIR_FREE(brname);
-    }   break;
     case VIR_DOMAIN_NET_TYPE_DIRECT: {
         if (!(veth = virLXCProcessSetupInterfaceDirect(conn,
                                                        vm->def,
index de574a9b689c2e2da74b0c7125ccd889587aa14a..632fc17ac64c395a15557103e19632225beeca3d 100644 (file)
@@ -382,31 +382,7 @@ static int virLXCProcessSetupInterfaces(virConnectPtr conn,
 
         type = virDomainNetGetActualType(net);
         switch (type) {
-        case VIR_DOMAIN_NET_TYPE_NETWORK: {
-            virNetworkPtr network;
-            char *brname = NULL;
-            bool fail = false;
-
-            if (!(network = virNetworkLookupByName(conn,
-                                                   net->data.network.name)))
-                goto cleanup;
-            if (!(brname = virNetworkGetBridgeName(network)))
-               fail = true;
-
-            virObjectUnref(network);
-            if (fail)
-                goto cleanup;
-
-            if (!(veth = virLXCProcessSetupInterfaceBridged(conn,
-                                                            def,
-                                                            net,
-                                                            brname))) {
-                VIR_FREE(brname);
-                goto cleanup;
-            }
-            VIR_FREE(brname);
-            break;
-        }
+        case VIR_DOMAIN_NET_TYPE_NETWORK:
         case VIR_DOMAIN_NET_TYPE_BRIDGE: {
             const char *brname = virDomainNetGetActualBridgeName(net);
             if (!brname) {