[CRIU] [PATCH] dump: Introduce "post-dump" script action

Cyrill Gorcunov gorcunov at openvz.org
Fri Jul 12 15:21:16 EDT 2013


This is usefull if one needs to do some final
action before checkpoint is complete. For example
in case of online migration one may provide a script
which would check that restore procedure on remote
note proceeded without errors, thus the script returns
zero code and criu simply kills running instance of
application. In turn, if migration failed, the script
returns nonzero code and criu won't kill the application
but continue its execution instead.

https://bugzilla.openvz.org/show_bug.cgi?id=2583

Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
---
 cr-dump.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/cr-dump.c b/cr-dump.c
index 863bffd..b968f0a 100644
--- a/cr-dump.c
+++ b/cr-dump.c
@@ -1717,6 +1717,22 @@ int cr_dump_tasks(pid_t pid)
 err:
 	close_cr_fdset(&glob_fdset);
 
+	if (!ret) {
+		/*
+		 * It might be a migration case, where we're asked
+		 * to dump everything, then some script transfer
+		 * image on a new node and we're supposed to kill
+		 * dumpee because it continue running somewhere
+		 * else.
+		 *
+		 * Thus ask user via script if we're to break checkpoint.
+		 */
+		if (run_scripts("post-dump")) {
+			pr_err("Checkpoint been force stopped\n");
+			ret = -1;
+		}
+	}
+
 	/*
 	 * If we've failed to do anything -- unlock all TCP sockets
 	 * so that the connections can go on. But if we succeeded --
-- 
1.8.1.4



More information about the CRIU mailing list