The following pull request was submitted through Github.
It can be accessed and reviewed at: https://github.com/lxc/lxc/pull/1248

This e-mail was sent by the LXC bot, direct replies will not reach the author
unless they happen to be subscribed to this list.

=== Description (from pull-request) ===
FWIW, the --external flag is new as of 2.6, so I don't think any of this should be SRU'd into xenial until CRIU 2.6 is.
From 0f90d613ab0d473731e6207a651685467f30c817 Mon Sep 17 00:00:00 2001
From: Tycho Andersen <tycho.ander...@canonical.com>
Date: Wed, 12 Oct 2016 22:46:09 +0000
Subject: [PATCH 1/3] c/r: use --external instead of --veth-pair

--veth-pair has been deprecated as of 2.6, let's use the new --external
instead.

Signed-off-by: Tycho Andersen <tycho.ander...@canonical.com>
---
 src/lxc/criu.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/lxc/criu.c b/src/lxc/criu.c
index f228736..0b5fc09 100644
--- a/src/lxc/criu.c
+++ b/src/lxc/criu.c
@@ -452,13 +452,13 @@ static void exec_criu(struct criu_opts *opts)
                        veth = n->priv.veth_attr.pair;
 
                        if (n->link)
-                               ret = snprintf(buf, sizeof(buf), "%s=%s@%s", 
eth, veth, n->link);
+                               ret = snprintf(buf, sizeof(buf), 
"veth[%s]:%s@%s", eth, veth, n->link);
                        else
-                               ret = snprintf(buf, sizeof(buf), "%s=%s", eth, 
veth);
+                               ret = snprintf(buf, sizeof(buf), "veth[%s]:%s", 
eth, veth);
                        if (ret < 0 || ret >= sizeof(buf))
                                goto err;
 
-                       DECLARE_ARG("--veth-pair");
+                       DECLARE_ARG("--external");
                        DECLARE_ARG(buf);
                }
 

From 2f3fbc6bf3c41942ea8fe13ba29cc040096981a8 Mon Sep 17 00:00:00 2001
From: Tycho Andersen <tycho.ander...@canonical.com>
Date: Wed, 12 Oct 2016 23:18:02 +0000
Subject: [PATCH 2/3] c/r: remember to increment netnr

We need this for calculating the name of unnamed interfaces in the config.
But we also need to remember to increment it :)

Signed-off-by: Tycho Andersen <tycho.ander...@canonical.com>
---
 src/lxc/criu.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/lxc/criu.c b/src/lxc/criu.c
index 0b5fc09..84d4209 100644
--- a/src/lxc/criu.c
+++ b/src/lxc/criu.c
@@ -460,6 +460,7 @@ static void exec_criu(struct criu_opts *opts)
 
                        DECLARE_ARG("--external");
                        DECLARE_ARG(buf);
+                       netnr++;
                }
 
        }

From e269733002642e2f5faa6aab59d3181558a74898 Mon Sep 17 00:00:00 2001
From: Tycho Andersen <tycho.ander...@canonical.com>
Date: Thu, 22 Sep 2016 23:13:42 +0000
Subject: [PATCH 3/3] c/r: add checkpoint/restore support for macvlan
 interfaces

Signed-off-by: Tycho Andersen <tycho.ander...@canonical.com>
---
 src/lxc/criu.c | 46 ++++++++++++++++++++++++++++++++++++----------
 1 file changed, 36 insertions(+), 10 deletions(-)

diff --git a/src/lxc/criu.c b/src/lxc/criu.c
index 84d4209..c998fe4 100644
--- a/src/lxc/criu.c
+++ b/src/lxc/criu.c
@@ -439,9 +439,6 @@ static void exec_criu(struct criu_opts *opts)
                        char eth[128], *veth;
                        struct lxc_netdev *n = it->elem;
 
-                       if (n->type != LXC_NET_VETH)
-                               continue;
-
                        if (n->name) {
                                if (strlen(n->name) >= sizeof(eth))
                                        goto err;
@@ -449,14 +446,42 @@ static void exec_criu(struct criu_opts *opts)
                        } else
                                sprintf(eth, "eth%d", netnr);
 
-                       veth = n->priv.veth_attr.pair;
+                       switch (n->type) {
+                       case LXC_NET_VETH:
+                               veth = n->priv.veth_attr.pair;
 
-                       if (n->link)
-                               ret = snprintf(buf, sizeof(buf), 
"veth[%s]:%s@%s", eth, veth, n->link);
-                       else
-                               ret = snprintf(buf, sizeof(buf), "veth[%s]:%s", 
eth, veth);
-                       if (ret < 0 || ret >= sizeof(buf))
+                               if (n->link)
+                                       ret = snprintf(buf, sizeof(buf), 
"veth[%s]:%s@%s", eth, veth, n->link);
+                               else
+                                       ret = snprintf(buf, sizeof(buf), 
"veth[%s]:%s", eth, veth);
+                               if (ret < 0 || ret >= sizeof(buf))
+                                       goto err;
+                               break;
+                       case LXC_NET_MACVLAN:
+                               if (n->name) {
+                                       if (strlen(n->name) >= sizeof(eth))
+                                               goto err;
+                                       strncpy(eth, n->name, sizeof(eth));
+                               } else
+                                       sprintf(eth, "eth%d", netnr);
+
+                               if (!n->link) {
+                                       ERROR("no host interface for macvlan 
%s\n", n->name);
+                                       goto err;
+                               }
+
+                               ret = snprintf(buf, sizeof(buf), 
"macvlan[%s]:%s", eth, n->link);
+                               if (ret < 0 || ret >= sizeof(buf))
+                                       goto err;
+                               break;
+                       case LXC_NET_NONE:
+                       case LXC_NET_EMPTY:
+                               break;
+                       default:
+                               /* we have screened for this earlier... */
+                               ERROR("unexpected network type %d\n", n->type);
                                goto err;
+                       }
 
                        DECLARE_ARG("--external");
                        DECLARE_ARG(buf);
@@ -616,9 +641,10 @@ static bool criu_ok(struct lxc_container *c, char 
**criu_version)
                case LXC_NET_VETH:
                case LXC_NET_NONE:
                case LXC_NET_EMPTY:
+               case LXC_NET_MACVLAN:
                        break;
                default:
-                       ERROR("Found network that is not VETH or NONE\n");
+                       ERROR("Found un-dumpable network: %s (%s)\n", 
lxc_net_type_to_str(n->type), n->name);
                        return false;
                }
        }
_______________________________________________
lxc-devel mailing list
lxc-devel@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-devel

Reply via email to