Commit 2ab59939 authored by Stanislav Kinsburskiy's avatar Stanislav Kinsburskiy Committed by Pavel Emelyanov

cr-restore: "post-resume" hook introduced

This hook is called at the very end, when everything is restored and processes
were resumed.
Can be used for some actions, which require operation container, like
restarting of systemd autofs services.

v3:
Call "post-resume" scripts before detach option check (to make sure, that
restored process(es) are still alive

v2:
Remove code chunk, escaped from debugging
Signed-off-by: 's avatarStanislav Kinsburskiy <skinsbursky@virtuozzo.com>
Signed-off-by: 's avatarPavel Emelyanov <xemul@virtuozzo.com>
parent 9f7f0e02
......@@ -20,6 +20,7 @@ static const char *action_names[ACT_MAX] = {
[ ACT_NET_UNLOCK ] = "network-unlock",
[ ACT_SETUP_NS ] = "setup-namespaces",
[ ACT_POST_SETUP_NS ] = "post-setup-namespaces",
[ ACT_POST_RESUME ] = "post-resume",
};
int run_scripts(enum script_actions act)
......
......@@ -2175,6 +2175,10 @@ static int restore_root_task(struct pstree_item *init)
write_stats(RESTORE_STATS);
ret = run_scripts(ACT_POST_RESUME);
if (ret != 0)
pr_err("Post-resume script ret code %d\n", ret);
if (!opts.restore_detach && !opts.exec_cmd)
wait(NULL);
......
......@@ -18,6 +18,7 @@ enum script_actions {
ACT_NET_UNLOCK = 5,
ACT_SETUP_NS = 6,
ACT_POST_SETUP_NS = 7,
ACT_POST_RESUME = 8,
ACT_MAX
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment