[CRIU] [PATCH 1/2] zdtm: don't mix images from dump with and without check_only
Andrei Vagin
avagin at openvz.org
Sat Sep 23 00:14:32 MSK 2017
From: Andrei Vagin <avagin at virtuozzo.com>
The idea of the check-only option is that criu dump and criu
restore is executed with this option to check whether c/r is
possible for a set of processes. This has to work faster than
without the check-only option.
Now we run criu restore --check-only for images which have
been generated by criu dump without --check-only, it is obviously wrong.
Cc: Adrian Reber <areber at redhat.com>
Signed-off-by: Andrei Vagin <avagin at virtuozzo.com>
---
test/zdtm.py | 19 +++++++++++++------
1 file changed, 13 insertions(+), 6 deletions(-)
diff --git a/test/zdtm.py b/test/zdtm.py
index 12fa51ffb..77925ec04 100755
--- a/test/zdtm.py
+++ b/test/zdtm.py
@@ -878,8 +878,11 @@ class criu:
print "Removing %s" % self.__dump_path
shutil.rmtree(self.__dump_path)
- def __ddir(self):
- return os.path.join(self.__dump_path, "%d" % self.__iter)
+ def __ddir(self, check_only = False):
+ check_only_str = ""
+ if check_only:
+ check_only_str = ".check"
+ return os.path.join(self.__dump_path, "%d%s" % (self.__iter, check_only_str))
def set_user_id(self):
# Numbers should match those in zdtm_test
@@ -887,17 +890,18 @@ class criu:
os.setresuid(18943, 18943, 18943)
def __criu_act(self, action, opts = [], log = None, nowait = False):
+ check_only = '--check-only' in opts
if not log:
log = action
- if "--check-only" in opts:
+ if check_only:
log += ".chk"
log += ".log"
- s_args = ["-o", log, "-D", self.__ddir(), "-v4"] + opts
+ s_args = ["-o", log, "-D", self.__ddir(check_only), "-v4"] + opts
with open(os.path.join(self.__ddir(), action + '.cropt'), 'w') as f:
f.write(' '.join(s_args) + '\n')
- if '--check-only' in opts:
+ if check_only:
print "Run criu " + action + " in check-only mode"
else:
print "Run criu " + action
@@ -919,7 +923,7 @@ class criu:
else:
preexec = self.__user and self.set_user_id or None
- __ddir = self.__ddir()
+ __ddir = self.__ddir(check_only)
status_fds = None
if nowait:
@@ -971,6 +975,9 @@ class criu:
self.__iter += 1
os.mkdir(self.__ddir())
os.chmod(self.__ddir(), 0777)
+ if self.__check_only:
+ os.mkdir(self.__ddir(True))
+ os.chmod(self.__ddir(True), 0777)
a_opts = ["-t", self.__test.getpid()]
if self.__prev_dump_iter:
--
2.13.3
More information about the CRIU
mailing list