[CRIU] [PATCH] zdtm: don't mix images from dump with and without check_only
Andrei Vagin
avagin at virtuozzo.com
Sat Sep 23 01:16:00 MSK 2017
Pls, ignore this patch.
On Fri, Sep 22, 2017 at 08:51:55PM +0300, Andrei Vagin wrote:
> 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>
> ---
> criu/cr-restore.c | 2 +-
> test/zdtm.py | 20 ++++++++++++++------
> 2 files changed, 15 insertions(+), 7 deletions(-)
>
> diff --git a/criu/cr-restore.c b/criu/cr-restore.c
> index 2eb398706..0ca00a9d9 100644
> --- a/criu/cr-restore.c
> +++ b/criu/cr-restore.c
> @@ -2135,7 +2135,7 @@ static int write_restored_pid(void)
> {
> int pid;
>
> - if (!opts.check_only)
> + if (opts.check_only)
> return 0;
>
> if (!opts.pidfile)
> diff --git a/test/zdtm.py b/test/zdtm.py
> index 12fa51ffb..7a9eac54d 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:
> @@ -928,6 +932,7 @@ class criu:
>
> ns_last_pid = open("/proc/sys/kernel/ns_last_pid").read()
>
> + print "%s %s" % (action, " ".join(s_args))
> ret = self.__criu.run(action, s_args, self.__fault, strace, preexec, nowait)
>
> if nowait:
> @@ -971,6 +976,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