]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
lxc: don't up the veth interfaces unless explicitly asked to
authorLubomir Rintel <lkundrak@v3.sk>
Fri, 24 Apr 2015 13:52:56 +0000 (15:52 +0200)
committerCole Robinson <crobinso@redhat.com>
Wed, 27 May 2015 18:32:03 +0000 (14:32 -0400)
Upping an interface for no reason and not configuring it is a cardinal sin.

With the default addrgenmode if eui64 it sticks a link-local address to the
interface. That is not good, as NetworkManager would see an address configured,
assume the interface is already configured and won't touch it iself and the
interface might stay unconfigured until the end of the days.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1124721

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
(cherry picked from commit c3cf3c43a0bb2e0e4909c32821e20f607635ec85)

src/lxc/lxc_container.c
src/lxc/lxc_native.c

index cc20b6d84fa1e613ecf731c9012e5fd01cdaae1e..9a9ae5c2aaf0f90ff472f24fda43c077b44998c7 100644 (file)
@@ -541,7 +541,8 @@ static int lxcContainerRenameAndEnableInterfaces(virDomainDefPtr vmDef,
             VIR_FREE(ipStr);
         }
 
-        if (netDef->linkstate != VIR_DOMAIN_NET_INTERFACE_LINK_STATE_DOWN) {
+        if (netDef->nips ||
+            netDef->linkstate == VIR_DOMAIN_NET_INTERFACE_LINK_STATE_UP) {
             VIR_DEBUG("Enabling %s", newname);
             rc = virNetDevSetOnline(newname, true);
             if (rc < 0)
index abf07ce68be6529e27425f9c0b80b712cef82b9e..434523ad736300c783b9ab1846868d040e68f80a 100644 (file)
@@ -348,12 +348,10 @@ lxcCreateNetDef(const char *type,
     if (VIR_ALLOC(net) < 0)
         goto error;
 
-    if (flag) {
-        if (STREQ(flag, "up"))
-            net->linkstate = VIR_DOMAIN_NET_INTERFACE_LINK_STATE_UP;
-        else
-            net->linkstate = VIR_DOMAIN_NET_INTERFACE_LINK_STATE_DOWN;
-    }
+    if (STREQ_NULLABLE(flag, "up"))
+        net->linkstate = VIR_DOMAIN_NET_INTERFACE_LINK_STATE_UP;
+    else
+        net->linkstate = VIR_DOMAIN_NET_INTERFACE_LINK_STATE_DOWN;
 
     if (VIR_STRDUP(net->ifname_guest, name) < 0)
         goto error;