2
0
mirror of git://github.com/lxc/lxc synced 2025-08-31 16:29:29 +00:00

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 <tycho.andersen@canonical.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
This commit is contained in:
Tycho Andersen
2015-08-10 11:12:18 -06:00
committed by Stéphane Graber
parent 65b2022137
commit ec8449f8dc
3 changed files with 0 additions and 56 deletions

View 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;

View 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);

View File

@@ -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;