2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-29 13:28:27 +00:00

action-scripts: Add "pre-resume" stage

The main idea is to be able to operate with container
at the moment where its processess and resources are
already restored but the processes are not yet in
running state, ie just before we kick them.

Beside the need of tuning up beancounters (which is vz7
specific feature) this might be useful to make some
additional debug tests from the script.

We can't reuse ACT_POST_RESTORE action or move it because
we can kill the restored processes here and resume them
on a source side as avagin@ explained.

[ xemul: In between POST_RESTORE and PRE_RESUME ghost files
  are cleaned up (an a little bit more), so two separate
  stages are required and the latter one cannot fail. ]

travis-ci: success for Add "pre-resume" stage
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
This commit is contained in:
Cyrill Gorcunov 2017-01-18 12:02:04 +03:00 committed by Pavel Emelyanov
parent d02fe846aa
commit 1a16b60075
3 changed files with 6 additions and 0 deletions

View File

@ -23,6 +23,7 @@ static const char *action_names[ACT_MAX] = {
[ ACT_NET_UNLOCK ] = "network-unlock", [ ACT_NET_UNLOCK ] = "network-unlock",
[ ACT_SETUP_NS ] = "setup-namespaces", [ ACT_SETUP_NS ] = "setup-namespaces",
[ ACT_POST_SETUP_NS ] = "post-setup-namespaces", [ ACT_POST_SETUP_NS ] = "post-setup-namespaces",
[ ACT_PRE_RESUME ] = "pre-resume",
[ ACT_POST_RESUME ] = "post-resume", [ ACT_POST_RESUME ] = "post-resume",
}; };

View File

@ -1843,6 +1843,10 @@ static int restore_root_task(struct pstree_item *init)
if (ret == 0) if (ret == 0)
finalize_restore(); finalize_restore();
ret = run_scripts(ACT_PRE_RESUME);
if (ret)
pr_err("Pre-resume script ret code %d\n", ret);
if (restore_freezer_state()) if (restore_freezer_state())
pr_err("Unable to restore freezer state\n"); pr_err("Unable to restore freezer state\n");

View File

@ -11,6 +11,7 @@ enum script_actions {
ACT_SETUP_NS, ACT_SETUP_NS,
ACT_POST_SETUP_NS, ACT_POST_SETUP_NS,
ACT_POST_RESUME, ACT_POST_RESUME,
ACT_PRE_RESUME,
ACT_MAX ACT_MAX
}; };