The thread_bomb test was rewrited and
ZDTM_THREAD_BOMB should be equal 5 now.
Signed-off-by: Andrew Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
It works for tests which are executed in a separate pidns
Signed-off-by: Andrew Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
It's an external one and it's already created and we don't have proper
shared mount.
Signed-off-by: Andrew Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
We don't need to remount a mount as private, when a source mount and
a new mount has the same master_id and shared_id
Signed-off-by: Andrew Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
The value of loginuid cannot be changed inside container, with the
exception if it was not set yet. This value is inherited on fork() from
parent.
So, to restore original loginuid values for all tasks:
- unset the container parent loginuid
- all children will have this value unsetted
- on child restore set value from dump
See http://lxr.free-electrons.com/source/kernel/audit.c#L635https://jira.sw.ru/browse/PSBM-41993
Signed-off-by: Dmitry Safonov <dsafonov@odin.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Standalone criu target should not be used here
because it doesn't carry all prerequisites needed.
Instead simply use @all.
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Acked-by: Tycho Andersen <tycho.andersen@canonical.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
When running test in ns/uns flavor zdtm.py builds a temp root in test/ directory.
The new action allows to remove all this stuff automatically.
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This will be required for page-cache and page-proxy set.
Signed-off-by: Rodrigo Bruno <rbruno at gsd.inesc-id.pt>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
A freezer cgroup can contain tasks which will be not dumped,
criu unfreezes the group, so we need to freeze all extra
task with ptrace like we do for target tasks.
Currently we attache and send an interrupt signals to these tasks,
but we don't call waitpid() for them, so then waitpid(-1, ...)
returns these tasks where we don't expect to see them.
v2: execute freezer_detach() only if opts.freeze_cgroup is set
calculate extra tasks in a freezer cgroup correctly
v3: s/frozen_processes/processes_to_wait/
Signed-off-by: Andrew Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
It will be used to mount AutoFS, because context creation is required in
addition to actual mount operation.
Signed-off-by: Stanislav Kinsburskiy <skinsbursky@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This patch introduces three helpers:
1) pstree_item_by_real() - search for pstree item by real pid.
2) pstree_item_by_virt() - search for pstree item by virtual pid.
3) pid_to_virt() - return virtual pis by real one.
Note: pstree_item_by_virt() and pid_to_virt() will be used to migrate AutoFS.
Signed-off-by: Stanislav Kinsburskiy <skinsbursky@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
tty_find_restoring_task will prepare control terminal (by tcsetpgrp)
only if tty is master.
By a chance it's possible to pick slave terminal as a control, which
will refrain restoring control terminal.
https://jira.sw.ru/browse/PSBM-42093
Signed-off-by: Dmitry Safonov <dsafonov@odin.com>
Reviewed-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Running crit tool 4 times per test (decode, encode, decode --pretty
and encode back again) is way too slow. The majority of time, as
it turned out, goes on python load and arguments parsing. The en-
and de-coding works pretty fast.
So doing re-code logic in one python script for ALL images is way
way faster -- ~1 hour vs ~1 minute on my box.
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
There are loads and dumps method in pycriu.images that work with
strings, instead of open()-ed files. For simplicity strings are
turned into streams with io.BytesIO and the files are then pushed
into regular load/dump methods.
The problem is that array.array object doesn't work with io object
in .fromfile/.tofile methods, so we have to read/write the data
from them explicitly and use .fromstring/.tostring for arrays.
With this the crit test finally passes :D
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Acked-by: Cyrill Gorcunov <gorcunov@openvz.org>
- need to add encoding method
- also need to do the same for ipc queues and shmem
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
When debugging it's useful to stop zdtm.py at certain points and
check what's going on out there. For this the --sbs (step-by-step)
option is introduced. It will make zdtm.py stop and wait for user
keypress before dump, before restore and after restore.
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Acked-by: Andrew Vagin <avagin@virtuozzo.com>
Generated files are often analyzed after test, so it's handy to have
their full names on the screen at once.
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Acked-by: Andrew Vagin <avagin@virtuozzo.com>
Right now zdtm spawns test into a pseudo-container and redirects its
output in a temp file. This is done not to mix outputs of tests, running
in parallel, with each other.
But if we run tests one by one or there's only one test in the list
we can safely print the output right on the screen.
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Acked-by: Andrew Vagin <avagin@virtuozzo.com>
Currently we wait when a namespace will be restored to get its root.
We need to open a namespace root to open a file to restore a memory mapping.
A process restores mappings and only then forks children. So we can have
a situation, when we need to open a file from a namespace, which will be
"restored" by one of our children.
The root task restores all mount namespaces and opens a file descriptor
for each of them. In this patch we open root for each mntns in the root
task.
If we neeed to get root of a namespace which isn't populated, we can get
it from the root task. After the CR_STATE_FORKING stage, the root task
closes all namespace descriptors ane we know that all namespaces are
populated at this moment.
v2: don't close root_fd for root ns, because it was not opened
Signed-off-by: Andrew Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
The native pb engine doesn't accept types other than int or long:
...
File "/root/src/criu/pycriu/images/pb2dict.py", line 264, in dict2pb
pb_val.append(_dict2pb_cast(field, v))
File "/usr/lib/python2.7/site-packages/google/protobuf/internal/containers.py", line 111, in append
self._type_checker.CheckValue(value)
File "/usr/lib/python2.7/site-packages/google/protobuf/internal/type_checkers.py", line 104, in CheckValue
raise TypeError(message)
TypeError: 1.1258999068426252e+16 has type <type 'float'>, but expected one of: (<type 'int'>, <type 'long'>)
In particular, this is seen when encoding back so_filter field from
inetsk image.
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Acked-by: Ruslan Kuprieiev <kupruser@gmail.com>
For historical reason we allocate the complete PATH_MAX
here just to fetch a word of freezer state. Lets relax
the stack pressue and rename @path to @state. Same time
make states @frozen, @freezing, @thawed being static,
we don't export them.
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Acked-by: Andrew Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
It isn't required and it doesn't work in a case when
we want to bind-mount a file.
Signed-off-by: Andrew Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
To better understand the content of mm-<ID>.img and pagemap-<ID>.img
additional constant names have been added to better resolve the hex
value to symbolical names.
Signed-off-by: Adrian Reber <areber@redhat.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
If a temporary mount is a shared one, a new mount can be
propagated into it.
Fixes: 0e9736ab68e0 ("mount: fix restoring a bind-mount when its root is overmounted)")
Reported-by: Mr Jenkins
Signed-off-by: Andrew Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>