[CRIU] [RFC v2 3/5] zdtm: add reset_pid() function
Andrei Vagin
avagin at virtuozzo.com
Thu Mar 23 17:10:12 PDT 2017
On Thu, Mar 23, 2017 at 07:59:16PM +0000, Adrian Reber wrote:
> From: Adrian Reber <areber at redhat.com>
>
> In preparation for the zdtm option '--check-only' a new helper function
> reset_pid() is added which writes to ns_last_pid to avoid PID collisions
> during check-only restore and the real restore.
>
> Signed-off-by: Adrian Reber <areber at redhat.com>
> ---
> test/zdtm.py | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/test/zdtm.py b/test/zdtm.py
> index 57e2ab0..8d38e05 100755
> --- a/test/zdtm.py
> +++ b/test/zdtm.py
> @@ -329,6 +329,13 @@ def wait_pid_die(pid, who, tmo = 30):
> def test_flag(tdesc, flag):
> return flag in tdesc.get('flags', '').split()
>
> +
> +def reset_pid(pid = 1):
I don't understand how pid = 1 helps to avoid collisions. We create a
new pid namespace for each test (test/zdtm_ct) and we know that pids are
allocated sequentialy, so test process uses
"small" pids. In this case setting 1 into ns_last_pid has to increate
probability of collisions...
> + 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
> --
> 1.8.3.1
>
> _______________________________________________
> CRIU mailing list
> CRIU at openvz.org
> https://lists.openvz.org/mailman/listinfo/criu
More information about the CRIU
mailing list