transmit pair of veth names to criu via the option --veth-pair v2: unset IFS and delete eval from vps-rst v3: fix comments from Kir
Signed-off-by: Andrey Vagin <ava...@openvz.org> --- scripts/vps-rst.in | 12 ++++++++++-- src/lib/hooks_ct.c | 16 +++++++++++++--- 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/scripts/vps-rst.in b/scripts/vps-rst.in index b6c2f84..437d1ea 100755 --- a/scripts/vps-rst.in +++ b/scripts/vps-rst.in @@ -25,15 +25,21 @@ # VE_ROOT - container root directory # VE_DUMP_DIR - directory for saving dump files # VE_STATE_FILE - file to write CT init PID to +# VE_VETH_DEVS - pair of veth names (CT=HW\n) exec 1>&2 . @SCRIPTDIR@/vps-functions +veth_args="" +for dev in $VE_VETH_DEVS; do + veth_args="$veth_args --veth-pair $dev" +done + vzcheckvar VE_ROOT vzcheckvar VE_STATE_FILE vzcheckvar VE_DUMP_DIR -criu restore --file-locks \ +criu restore --file-locks \ --tcp-established \ --evasive-devices \ --link-remap \ @@ -42,7 +48,9 @@ criu restore --file-locks \ -D $VE_DUMP_DIR \ -o restore.log \ -vvvv \ - --pidfile $VE_STATE_FILE + --pidfile $VE_STATE_FILE \ + $veth_args + if [ $? -eq 0 ]; then rm -rf $VE_DUMP_DIR else diff --git a/src/lib/hooks_ct.c b/src/lib/hooks_ct.c index 4011142..18650e0 100644 --- a/src/lib/hooks_ct.c +++ b/src/lib/hooks_ct.c @@ -924,11 +924,12 @@ static int ct_chkpnt(vps_handler *h, envid_t veid, static int ct_restore_fn(vps_handler *h, envid_t veid, const vps_res *res, int wait_p, int old_wait_p, int err_p, void *data) { - char *argv[2], *env[4]; + char *argv[2], *env[5]; const char *dumpfile = NULL; const char *statefile = NULL; cpt_param *param = data; - char buf[STR_SIZE]; + veth_dev *veth; + char buf[STR_SIZE], *pbuf; pid_t pid = -1; int ret; FILE *sfile; @@ -948,7 +949,16 @@ static int ct_restore_fn(vps_handler *h, envid_t veid, const vps_res *res, env[1] = strdup(buf); snprintf(buf, sizeof(buf), "VE_STATE_FILE=%s", statefile); env[2] = strdup(buf); - env[3] = NULL; + + pbuf = buf; + pbuf += snprintf(buf, sizeof(buf), "VE_VETH_DEVS="); + list_for_each(veth, &res->veth.dev, list) { + pbuf += snprintf(pbuf, sizeof(buf) - (pbuf - buf), + "%s=%s\n", veth->dev_name_ve, veth->dev_name); + } + env[3] = strdup(buf); + + env[4] = NULL; ret = run_script(argv[0], argv, env, 0); free_arg(env); -- 1.8.2 _______________________________________________ Devel mailing list Devel@openvz.org https://lists.openvz.org/mailman/listinfo/devel