[lxc-devel] [PATCH 2/3] c/r: get rid of dump_net_info()

Tycho Andersen tycho.andersen at canonical.com
Mon Aug 10 17:12:18 UTC 2015


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 at canonical.com>
---
 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 e939b37..e1282e4 100644
--- a/src/lxc/criu.c
+++ b/src/lxc/criu.c
@@ -340,57 +340,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 1f65e47..df63625 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 1c103e8..14ae796 100644
--- a/src/lxc/lxccontainer.c
+++ b/src/lxc/lxccontainer.c
@@ -3733,9 +3733,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.1.4



More information about the lxc-devel mailing list