]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
c/r: get rid of dump_net_info()
authorTycho Andersen <tycho.andersen@canonical.com>
Mon, 10 Aug 2015 17:12:18 +0000 (11:12 -0600)
committerStéphane Graber <stgraber@ubuntu.com>
Thu, 13 Aug 2015 20:33:44 +0000 (16:33 -0400)
This was originally used to propagate the bridge and veth names across
hosts, but now we extract both from the container's config file, and
nothing reads the files that dump_net_info() writes, so let's just get rid
of them.

Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
src/lxc/criu.c
src/lxc/criu.h
src/lxc/lxccontainer.c

index 4ffa4e091a71d2b2b221589ed411b926c9735c64..88dc8cd21f38edc3e7e90ce04bd1b021feb80a4c 100644 (file)
@@ -348,57 +348,6 @@ bool criu_ok(struct lxc_container *c)
        return true;
 }
 
-bool dump_net_info(struct lxc_container *c, char *directory)
-{
-       int netnr;
-       struct lxc_list *it;
-
-       netnr = 0;
-       lxc_list_for_each(it, &c->lxc_conf->network) {
-               char *veth = NULL, *bridge = NULL, veth_path[PATH_MAX], eth[128];
-               struct lxc_netdev *n = it->elem;
-               bool has_error = true;
-               int pret;
-
-               pret = snprintf(veth_path, PATH_MAX, "lxc.network.%d.veth.pair", netnr);
-               if (pret < 0 || pret >= PATH_MAX)
-                       goto out;
-
-               veth = c->get_running_config_item(c, veth_path);
-               if (!veth) {
-                       /* criu_ok() checks that all interfaces are
-                        * LXC_NET{VETH,NONE}, and VETHs should have this
-                        * config */
-                       assert(n->type == LXC_NET_NONE);
-                       break;
-               }
-
-               bridge = c->get_running_config_item(c, veth_path);
-               if (!bridge)
-                       goto out;
-
-               pret = snprintf(veth_path, PATH_MAX, "%s/veth%d", directory, netnr);
-               if (pret < 0 || pret >= PATH_MAX || print_to_file(veth_path, veth) < 0)
-                       goto out;
-
-               if (n->name) {
-                       if (strlen(n->name) >= 128)
-                               goto out;
-                       strncpy(eth, n->name, 128);
-               } else
-                       sprintf(eth, "eth%d", netnr);
-
-               has_error = false;
-out:
-               free(veth);
-               free(bridge);
-               if (has_error)
-                       return false;
-       }
-
-       return true;
-}
-
 static bool restore_net_info(struct lxc_container *c)
 {
        struct lxc_list *it;
index 1f65e4793989449c91f93a867e96189c9e6b2224..df6362577b125315b018ce7aeace62246dc2e927 100644 (file)
@@ -61,8 +61,6 @@ void exec_criu(struct criu_opts *opts);
  * dump. */
 bool criu_ok(struct lxc_container *c);
 
-bool dump_net_info(struct lxc_container *c, char *directory);
-
 // do_restore never returns, the calling process is used as the
 // monitor process. do_restore calls exit() if it fails.
 void do_restore(struct lxc_container *c, int pipe, char *directory, bool verbose);
index 7ad1344f05ce47ad242fdd2e5d4a79fb1c47d054..1f0bc5d9274d7d3aaa4b14ef3368f47315598ab4 100644 (file)
@@ -3700,9 +3700,6 @@ static bool do_lxcapi_checkpoint(struct lxc_container *c, char *directory, bool
                return false;
        }
 
-       if (!dump_net_info(c, directory))
-               return false;
-
        pid = fork();
        if (pid < 0)
                return false;