Skip to content

Commit

Permalink
c/r: use criu option instead of lxc-restore-net
Browse files Browse the repository at this point in the history
As of criu 1.5, the --veth-pair argument supports an additional parameter that
is the bridge name to attach to. This enables us to get rid of the goofy
action-script hack that passed bridge names as environment variables.

This patch is on top of the systemd/lxcfs mount rework patch, as we probably
want to wait to use 1.5 options until it has been out for a while and is in
distros.

Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
  • Loading branch information
Tycho Andersen authored and stgraber committed Jul 1, 2015
1 parent b55f3a4 commit 51f231f
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 66 deletions.
4 changes: 0 additions & 4 deletions src/lxc/Makefile.am
Expand Up @@ -164,7 +164,6 @@ bin_SCRIPTS = lxc-checkconfig

EXTRA_DIST = \
lxc-ls \
lxc-restore-net \
lxc-top.lua

if ENABLE_PYTHON
Expand Down Expand Up @@ -261,8 +260,5 @@ install-exec-local: install-soPROGRAMS
install-exec-hook:
chmod u+s $(DESTDIR)$(libexecdir)/lxc/lxc-user-nic

install-data-local:
install -c -m 755 lxc-restore-net $(DESTDIR)$(datadir)/lxc

uninstall-local:
$(RM) $(DESTDIR)$(libdir)/liblxc.so*
26 changes: 0 additions & 26 deletions src/lxc/lxc-restore-net

This file was deleted.

37 changes: 1 addition & 36 deletions src/lxc/lxccontainer.c
Expand Up @@ -3588,8 +3588,6 @@ static void exec_criu(struct criu_opts *opts)
DECLARE_ARG("auto");
DECLARE_ARG("--enable-external-sharing");
DECLARE_ARG("--enable-external-masters");
DECLARE_ARG("--action-script");
DECLARE_ARG(DATADIR "/lxc/lxc-restore-net");
DECLARE_ARG("-D");
DECLARE_ARG(opts->directory);
DECLARE_ARG("-o");
Expand Down Expand Up @@ -3641,7 +3639,7 @@ static void exec_criu(struct criu_opts *opts)

veth = n->priv.veth_attr.pair;

ret = snprintf(buf, sizeof(buf), "%s=%s", eth, veth);
ret = snprintf(buf, sizeof(buf), "%s=%s@%s", eth, veth, n->link);
if (ret < 0 || ret >= sizeof(buf))
goto err;

Expand All @@ -3653,39 +3651,6 @@ static void exec_criu(struct criu_opts *opts)

argv[argc] = NULL;

netnr = 0;
lxc_list_for_each(it, &opts->c->lxc_conf->network) {
struct lxc_netdev *n = it->elem;
char veth[128];

/*
* Here, we set some parameters that lxc-restore-net
* will examine to figure out the right network to
* restore.
*/
snprintf(buf, sizeof(buf), "LXC_CRIU_BRIDGE%d", netnr);
if (setenv(buf, n->link, 1))
goto err;

if (strcmp("restore", opts->action) == 0)
strncpy(veth, n->priv.veth_attr.pair, sizeof(veth));
else {
char *tmp;
ret = snprintf(buf, sizeof(buf), "lxc.network.%d.veth.pair", netnr);
if (ret < 0 || ret >= sizeof(buf))
goto err;
tmp = lxcapi_get_running_config_item(opts->c, buf);
strncpy(veth, tmp, sizeof(veth));
free(tmp);
}

snprintf(buf, sizeof(buf), "LXC_CRIU_VETH%d", netnr);
if (setenv(buf, veth, 1))
goto err;

netnr++;
}

#undef DECLARE_ARG
execv(argv[0], argv);
err:
Expand Down

0 comments on commit 51f231f

Please sign in to comment.