mirror of
https://github.com/checkpoint-restore/criu
synced 2025-08-31 14:25:49 +00:00
zdtm: restore ns_last_pid before executing restore in a second time
Otherwise a criu process can get a pid of one of restored processes. Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
This commit is contained in:
11
test/zdtm.py
11
test/zdtm.py
@@ -337,12 +337,6 @@ def test_flag(tdesc, flag):
|
||||
return flag in tdesc.get('flags', '').split()
|
||||
|
||||
|
||||
def reset_pid(pid = 1):
|
||||
fd = open('/proc/sys/kernel/ns_last_pid', 'w')
|
||||
fd.write('%s' % pid)
|
||||
fd.close()
|
||||
|
||||
|
||||
#
|
||||
# Exception thrown when something inside the test goes wrong,
|
||||
# e.g. test doesn't start, criu returns with non zero code or
|
||||
@@ -943,6 +937,9 @@ class criu:
|
||||
os.close(status_fds[0])
|
||||
return ret
|
||||
|
||||
if '--check-only' in opts and action == "restore":
|
||||
open("/proc/sys/kernel/ns_last_pid", "w+").write(ns_last_pid)
|
||||
|
||||
grep_errors(os.path.join(__ddir, log))
|
||||
if ret != 0:
|
||||
if self.__fault and int(self.__fault) < 128:
|
||||
@@ -1092,8 +1089,6 @@ class criu:
|
||||
|
||||
if self.__check_only:
|
||||
self.__criu_act("restore", opts = r_opts + ["--restore-detached"] + ['--check-only'])
|
||||
# sometimes the real restore fails with PID conflicts without this
|
||||
reset_pid()
|
||||
|
||||
self.__criu_act("restore", opts = r_opts + ["--restore-detached"])
|
||||
self.show_stats("restore")
|
||||
|
Reference in New Issue
Block a user