[CRIU] [PATCH] zdtm: check the mem_dirty_track if --pre or --snap is set

Andrey Vagin avagin at openvz.org
Tue Apr 12 11:14:16 PDT 2016


From: Andrei Vagin <avagin+ppc at gmail.com>

Signed-off-by: Andrew Vagin <avagin at virtuozzo.com>
---
 criu/cr-check.c | 5 ++++-
 test/zdtm.py    | 5 +++++
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/criu/cr-check.c b/criu/cr-check.c
index 17cce4e..e4f34c7 100644
--- a/criu/cr-check.c
+++ b/criu/cr-check.c
@@ -693,8 +693,10 @@ static int check_mem_dirty_track(void)
 	if (kerndat_get_dirty_track() < 0)
 		return -1;
 
-	if (!kdat.has_dirty_track)
+	if (!kdat.has_dirty_track) {
 		pr_warn("Dirty tracking is OFF. Memory snapshot will not work.\n");
+		return -1;
+	}
 	return 0;
 }
 
@@ -1080,6 +1082,7 @@ struct feature_list {
 
 static struct feature_list feature_list[] = {
 	{ "mnt_id", check_mnt_id },
+	{ "mem_dirty_track", check_mem_dirty_track },
 	{ "aio_remap", check_aio_remap },
 	{ "timerfd", check_timerfd },
 	{ "tun", check_tun },
diff --git a/test/zdtm.py b/test/zdtm.py
index 5374979..6619395 100755
--- a/test/zdtm.py
+++ b/test/zdtm.py
@@ -1197,6 +1197,11 @@ def run_tests(opts):
 	excl = None
 	features = {}
 
+	if opts['pre'] or opts['snaps']:
+		if not criu_cli.check("mem_dirty_track"):
+			print "Tracking memory is not available"
+			return;
+
 	if opts['keep_going'] and (not opts['all']):
 		print "[WARNING] Option --keep-going is more useful with option --all."
 
-- 
2.5.0



More information about the CRIU mailing list