From a4aa5b49cf868af5a75a3f06f8847f6639aae98c Mon Sep 17 00:00:00 2001 From: Tycho Andersen Date: Mon, 10 Aug 2015 11:12:18 -0600 Subject: [PATCH] c/r: get rid of dump_net_info() 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 Acked-by: Serge E. Hallyn --- src/lxc/criu.c | 51 ------------------------------------------ src/lxc/criu.h | 2 -- src/lxc/lxccontainer.c | 3 --- 3 files changed, 56 deletions(-) diff --git a/src/lxc/criu.c b/src/lxc/criu.c index 4ffa4e091..88dc8cd21 100644 --- a/src/lxc/criu.c +++ b/src/lxc/criu.c @@ -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; diff --git a/src/lxc/criu.h b/src/lxc/criu.h index 1f65e4793..df6362577 100644 --- a/src/lxc/criu.h +++ b/src/lxc/criu.h @@ -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); diff --git a/src/lxc/lxccontainer.c b/src/lxc/lxccontainer.c index 7ad1344f0..1f0bc5d92 100644 --- a/src/lxc/lxccontainer.c +++ b/src/lxc/lxccontainer.c @@ -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; -- 2.47.2