Changeset
.mailmap                |  1 +
src/lxc/lxc_container.c |  7 +------
src/lxc/lxc_native.c    | 10 ++++++----
3 files changed, 8 insertions(+), 10 deletions(-)
Git apply log
Switched to a new branch '20180111170858.26462-1-b.cama@kerlink.fr'
Applying: lxc: Up back the veth interfaces by default
To https://github.com/patchew-project/libvirt
 * [new tag]             patchew/20180111170858.26462-1-b.cama@kerlink.fr -> patchew/20180111170858.26462-1-b.cama@kerlink.fr
[libvirt] [RFC PATCH] lxc: Up back the veth interfaces by default
Posted by Benjamin Cama, 1 week ago
Upping an interface without configuring it is not a “cardinal sin” but a
sensible way to achieve auto-configuration, e.g. with IPv6 SLAAC (RFC
4862). If NetworkManager has troube with interfaces having only a
link-local address, this is a bug in NetworkManager, not in libvirt; it
should listen for router advertisements to decide if some interface has
global connectivity or not.

With network interfaces up by default, stateless containers can be
easily auto-configured through the network with SLAAC, without any
specific configuration from the host system.

This reverts commit c3cf3c43a0bb2e0e4909c32821e20f607635ec85.

Signed-off-by: Benjamin Cama <b.cama@kerlink.fr>
---
Hi,

The patch that I propose to revert basically broke my workflow for light
stateless containers, where they could be auto-configured on IPv6-only network
through SLAAC. Of course, fully-fledged containers can bring up the interface
themselves, but this behavior had previously been the default for quite some
time, and is even indicated as default in src/conf/domain_conf.h ("Default link
state (up)").

I cannot find any real justification for the patch I am reverting, and the
bugzilla looks private so I can not comment on the NetworkManager behavior,
which looks very buggy to me.

Please tell me if you think this is wrong. Also, please Cc me, I am not
subscribed.

Regards.

 .mailmap                |  1 +
 src/lxc/lxc_container.c |  7 +------
 src/lxc/lxc_native.c    | 10 ++++++----
 3 files changed, 8 insertions(+), 10 deletions(-)

diff --git a/.mailmap b/.mailmap
index 2f0fc901e..9dc3bff85 100644
--- a/.mailmap
+++ b/.mailmap
@@ -36,6 +36,7 @@
 <gerd@egidy.de> <lists@egidy.de>
 <gerd@egidy.de> <gerd.von.egidy@intra2net.com>
 <benoar@dolka.fr> <benjamin.cama@telecom-bretagne.eu>
+<benoar@dolka.fr> <b.cama@kerlink.fr>
 <zhlcindy@linux.vnet.ibm.com> <zhlcindy@gmail.com>
 <serge.hallyn@canonical.com> <serue@us.ibm.com>
 <pritesh.kothari@sun.com> <Pritesh.Kothari@Sun.COM>
diff --git a/src/lxc/lxc_container.c b/src/lxc/lxc_container.c
index 96fceaf1b..e546f0aaf 100644
--- a/src/lxc/lxc_container.c
+++ b/src/lxc/lxc_container.c
@@ -517,12 +517,7 @@ lxcContainerRenameAndEnableInterfaces(virDomainDefPtr vmDef,
         if (virNetDevSetName(veths[i], newname) < 0)
             goto cleanup;
 
-        /* Only enable this device if there is a reason to do so (either
-         * at least one IP was specified, or link state was set to up in
-         * the config)
-         */
-        if (netDef->guestIP.nips ||
-            netDef->linkstate == VIR_DOMAIN_NET_INTERFACE_LINK_STATE_UP) {
+        if (netDef->linkstate != VIR_DOMAIN_NET_INTERFACE_LINK_STATE_DOWN) {
             VIR_DEBUG("Enabling %s", newname);
             if (virNetDevSetOnline(newname, true) < 0)
                 goto cleanup;
diff --git a/src/lxc/lxc_native.c b/src/lxc/lxc_native.c
index fdc03a57e..f77a2a910 100644
--- a/src/lxc/lxc_native.c
+++ b/src/lxc/lxc_native.c
@@ -349,10 +349,12 @@ lxcCreateNetDef(const char *type,
     if (VIR_ALLOC(net) < 0)
         goto error;
 
-    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 (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 (VIR_STRDUP(net->ifname_guest, name) < 0)
         goto error;
-- 
2.11.0

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [RFC PATCH] lxc: Up back the veth interfaces by default
Posted by Benjamin Cama, 6 days ago
Hi again,

Le jeudi 11 janvier 2018 à 18:08 +0100, Benjamin Cama a écrit :
> Upping an interface without configuring it is not a “cardinal sin” but a
> sensible way to achieve auto-configuration, e.g. with IPv6 SLAAC (RFC
> 4862). If NetworkManager has troube with interfaces having only a
> link-local address, this is a bug in NetworkManager, not in libvirt; it
> should listen for router advertisements to decide if some interface has
> global connectivity or not.

To better understand my rant, a bit of context with the original patch
proposal (whose message is also contained in the commit I pointed to):

  https://www.redhat.com/archives/libvir-list/2015-April/msg01062.html

If you wonder why I react so late, this is because libvirt 3.0.0 landed
in Debian Stretch (Jessie had 1.2.9!), and I just recently upgraded to
it.

> With network interfaces up by default, stateless containers can be
> easily auto-configured through the network with SLAAC, without any
> specific configuration from the host system.

Of course, as a workaround I can use "<link state='up'/>", but I think
it ought to be the default, hence my request.

-- 
Benjamin Cama - Tél : 258

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list