]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
c/r: allow empty networks to be checkpointed/restored
authorTycho Andersen <tycho.andersen@canonical.com>
Mon, 10 Aug 2015 17:12:19 +0000 (11:12 -0600)
committerStéphane Graber <stgraber@ubuntu.com>
Thu, 13 Aug 2015 20:33:40 +0000 (16:33 -0400)
Empty networks don't have anything (besides lo) for us to dump and restore,
so we should allow these as well.

Reported-by: Dietmar Maurer <dietmar@proxmox.com>
Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
src/lxc/criu.c

index e939b37b593afb63b92ff0624ed3faaa0cc96f31..4ffa4e091a71d2b2b221589ed411b926c9735c64 100644 (file)
@@ -164,6 +164,9 @@ 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;
@@ -304,7 +307,12 @@ bool criu_ok(struct lxc_container *c)
        /* We only know how to restore containers with veth networks. */
        lxc_list_for_each(it, &c->lxc_conf->network) {
                struct lxc_netdev *n = it->elem;
-               if (n->type != LXC_NET_VETH && n->type != LXC_NET_NONE) {
+               switch(n->type) {
+               case LXC_NET_VETH:
+               case LXC_NET_NONE:
+               case LXC_NET_EMPTY:
+                       break;
+               default:
                        ERROR("Found network that is not VETH or NONE\n");
                        return false;
                }
@@ -402,6 +410,10 @@ static bool restore_net_info(struct lxc_container *c)
        lxc_list_for_each(it, &c->lxc_conf->network) {
                struct lxc_netdev *netdev = it->elem;
                char template[IFNAMSIZ];
+
+               if (netdev->type != LXC_NET_VETH)
+                       continue;
+
                snprintf(template, sizeof(template), "vethXXXXXX");
 
                if (!netdev->priv.veth_attr.pair)