2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-30 05:48:05 +00:00

5765 Commits

Author SHA1 Message Date
Pavel Emelyanov
077b9c959c zdtm.py: Fix argumeps to uns flavor init
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-10-28 17:05:05 +03:00
Pavel Emelyanov
fffbe3740b zdtm: Move netns test into ns/uns flavor
This one got lost in rebase, sorry :)

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Acked-by: Andrew Vagin <avagin@odin.com>
2015-10-28 16:54:02 +03:00
Pavel Emelyanov
4f3474e000 zdtm: Move netns-nf test into ns/uns flavor
After this patch it stops working in zdtm.sh launcher duo to incomplete
root constructed. Do we want to fix it?

Signed-off-by: Pavel Emelyanov <xemul@openvz.org>

Acked-by: Andrew Vagin <avagin@odin.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-10-28 16:52:51 +03:00
Pavel Emelyanov
35237d2a79 zdtm.py: Move more stuff into ns root
Things added are:

1. /usr directories (links to respective / ones)
2. /sbin dir
3. per-test dependencies that are listed in .desc file as 'deps': [<list>]

Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Acked-by: Andrew Vagin <avagin@odin.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-10-28 16:52:38 +03:00
Andrey Vagin
858c30e1c6 jenkins: call fail() in a error case
fail() saves all files in an archive for further investigations.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-10-28 15:20:16 +03:00
Pavel Emelyanov
dc6edd79e6 zdtm.py: Add dirs write perms for low-prio tests and flavors
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-10-28 12:36:40 +04:00
Pavel Emelyanov
225537ea5a zdtm.py: Wait for tasks to die more
On loaded jenkins nodes sometimes it takes much more than 4 seconds.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-10-28 10:42:27 +03:00
Pavel Emelyanov
8cfe833696 net: Only warn on ip rule save missing, do not print error
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-10-28 00:13:28 +04:00
Pavel Emelyanov
e5df07654a net: Do not fail on absent rules image and fail on bad one
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-10-28 00:12:57 +04:00
Kirill Tkhai
c9afd17ad6 net: Add ip rule save/restore
Add support for save and restore of ip rules. It uses new
functionality of iproute which is already in iproute git:

http://git.kernel.org/cgit/linux/kernel/git/shemminger/iproute2.git/commit/?id=2f4e171f7df22107b38fddcffa56c1ecb5e73359

v2: Use xstrdup() instead of strdup().
v3: Use open/close instead of helper.
v4: Return -1 on empty dump.

Signed-off-by: Kirill Tkhai <ktkhai@odin.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-10-27 22:56:33 +03:00
Andrew Vagin
c51cdedcf9 jenkins: use zdtm.py for criu-iter
Signed-off-by: Andrew Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-10-27 22:55:58 +03:00
Andrew Vagin
4ca525556b socket: values of snd and rcv buffer should be divide into two
This values will be doubled in kernel to account for
"struct sk_buff" etc. overhead.

Currently criu restores snd and rcv buffer limits incorrectly,
they become bigger on each iteration.
$ ../crit show dump/zdtm/live/static/socket-tcp/6299/1/inetsk.img | grep buf
                "so_sndbuf": 2626560,
                "so_rcvbuf": 1060720,
                "so_sndbuf": 16384,
                "so_rcvbuf": 87380,
$ ../crit show dump/zdtm/live/static/socket-tcp/6299/2/inetsk.img | grep buf
                "so_sndbuf": 5253120,
                "so_rcvbuf": 2121440,
                "so_sndbuf": 32768,
                "so_rcvbuf": 174760,
$ ../crit show dump/zdtm/live/static/socket-tcp/6299/3/inetsk.img | grep buf
                "so_sndbuf": 10506240,
                "so_rcvbuf": 4242880,
                "so_sndbuf": 65536,
                "so_rcvbuf": 349520,

With-help-of: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Andrew Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-10-27 22:55:36 +03:00
Pavel Emelyanov
d45c5481c0 zdtm.py: Fix iterations
Currently --iter N results in sequential images for every new iteration.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-10-27 22:55:16 +03:00
Cyrill Gorcunov
12cb5bb87c net: Treat venet device as a separate complete device
When restoring venet device we need to restore its
index as well, which actually possible with new iproute2
package but the problem is that the index itself lays
inside image file. We could use crit tool to extract
it but this would slowdon procedure signifantly (need
to run python which would parse the image, or need
to pass the index into environmnet from inside of
the CRIU itself).

So lets do a trick and simply created venet device
inside container by criu itself (thanks we support
creating venet via netlink interface now).

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Acked-by: Andrew Vagin <avagin@odin.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-10-27 22:54:07 +03:00
Pavel Emelyanov
f49e54f2b0 zdtm.py: Make print_sep shorter and print aligned lines
Current implementation of print_sep has off-by-one-like issue -- it
can print one character more :) Fix this and make the code shorter.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-10-27 22:53:28 +03:00
Andrew Vagin
be0f234fab proc: read all data from /proc/pid/task/tid/children (v2)
Currently we read only 4096 bytes (the size of buf).

v2: use the bfd engine
Signed-off-by: Andrew Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-10-27 22:53:00 +03:00
Andrew Vagin
1d8fcb6b94 bfd: add breadchr
Reading stops after an EOF or a specified charecter.

Signed-off-by: Andrew Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-10-27 22:51:09 +03:00
Andrew Vagin
64b00b3b09 zdtm: don't execute ipc_namespace in userns (v2)
There is no permissions to set sysctl-s

v2: add the suid flag
Signed-off-by: Andrew Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-10-26 22:15:12 +03:00
Andrew Vagin
907a444c2c zdtm: use syscalls to set hostname and domaninname
We don't have enough permissions to set sysctl-s from userns, while
system calls are ns_capable()-protected in the kernel and thus work
in user-namespaces.

Signed-off-by: Andrew Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-10-26 22:15:04 +03:00
Pavel Emelyanov
3ec9e128de zdtm: Mark utsname as suid
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-10-26 15:26:47 +03:00
Andrew Vagin
7a2afe33fb zdtm: allow to execute shm and msgque in userns
Signed-off-by: Andrew Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-10-26 12:20:14 +03:00
Andrew Vagin
fe44213e84 zdtm: allow to execute ipc_namespace and utsname tests in userns
Signed-off-by: Andrew Vagin <avagin@openvz.org>
Acked-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-10-26 12:20:13 +03:00
Andrew Vagin
5dc505c0ca ipc: save local user and group id-s for ipc objects
5468  semctl(0, 1, IPC_SET, 0x7ffd25bcb590) = -1 EINVAL (Invalid argument)

Reported-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Andrew Vagin <avagin@openvz.org>
Acked-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-10-26 12:20:12 +03:00
Cyrill Gorcunov
fbbd1f566f sk-unix: Fix typo in name length estimation
Name with up to UNIX_PATH_MAX in length is
allowed value.

Reported-by: Nikita Spiridonov <nspiridonov@odin.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-10-26 12:18:56 +03:00
Cyrill Gorcunov
67fe0607a0 ipc: Don't inject timestamps into informative message
Every print_on_level() injects timestamp, better to
print it in one pass for readability.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-10-26 12:18:29 +03:00
Kir Kolyshkin
e1e0f2ce56 zdtm: introduce and use pr_err()
Sometimes pr_perror() is used in places that don't have errno set.
In such places, pr_perror() should not be used as it will print
some nonsense.

Introduce and use pr_err() for such cases.

Now, I see sometimes fail() is used in such cases but I think
it is reserved for places where test fails (rather than there is
something that prevents the test from working).

Also, sometimes test_msg() is used but it doesn't print source
file name and line number.

If there will be a need, we can unify pr_err() with say fail(),
it will be easier to do after this patch.

Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Acked-by: Andrew Vagin <avagin@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-10-26 12:16:48 +03:00
Kir Kolyshkin
036d405312 zdtm unix_sock: don't use errno
In this place, errno is not being set and can be 0 or some random value,
so we should not use it. In case errno happens to be 0, we end up returning
a success status from a function while we should have returned a failure.

Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Acked-by: Andrew Vagin <avagin@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-10-26 12:13:36 +03:00
Kir Kolyshkin
40978ef32c zdtm/live/static/socket-tcpbuf: fix error message
Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Acked-by: Andrew Vagin <avagin@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-10-26 12:13:27 +03:00
Kir Kolyshkin
f42bc58311 zdtm: sanitize pr_perror() usage
Log function pr_perror() automatically adds
 - numeric errno value
 - string errno value (aka strerror(errno), aka %m)
 - a newline

So, its callers don't have to do all these things.

While at it, also
 - fix or improve some message texts
 - replace fnprintf() with pr_perror()

Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Acked-by: Andrew Vagin <avagin@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-10-26 12:13:16 +03:00
Kir Kolyshkin
d033577954 test_msg(): avoid recursion
In (highly unlikely) case localtime() failed, test_msg() calls
pr_perror() which is a wrapper around test_msg() so we're
calling ourselves, which can lead to infinite recursion if
localtime() keeps failing. Use fprintf() here to avoid this.

Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Acked-by: Andrew Vagin <avagin@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-10-26 12:12:54 +03:00
Andrew Vagin
ae6294f4d2 zdtm: return non-zero code in a error case
Signed-off-by: Andrew Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-10-26 12:11:59 +03:00
Cyrill Gorcunov
4e5e106778 make: Don't forget to clean up obj-x
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-10-26 12:11:10 +03:00
Kir Kolyshkin
628a488531 test: fix error messages
Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-10-21 16:00:28 +03:00
Cyrill Gorcunov
013b8494b2 crit: Add userns handler
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-10-21 15:41:19 +03:00
Cyrill Gorcunov
7a99e699ce mnt: Export __open_mountpoint
We gonna need it for inotify handle testing.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-10-21 15:08:03 +03:00
Andrew Vagin
b504dac6bf userns: print uid-s as unsigned values
Reported-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Andrew Vagin <avagin@virtuozzo.com>
Acked-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-10-21 14:59:42 +03:00
Kir Kolyshkin
5940e3d14c xfree(): simplify
Contrary to a popular opinion, there is no need to check
an argument for being non-NULL before calling free().

>From free(3) man page:

> > If ptr is NULL, no operation is performed.

Let's change xfree macro to be a synonym for free().

Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Acked-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-10-21 14:58:39 +03:00
Cyrill Gorcunov
52ab139c2e fsnotify: Always provide the path for inotify watchees
In debian-8 container we faced the problem -- systemd creates nested
mount namespaces and inotify watchee are resolved into a path which
is inaccessbile on restore, the same happens when pathes where
watchees are living are bind-overmounted. Thus when we try to
restore such watchees we can't open the paths.

Lets do a trick here (thanks a huge to Andrew Vagin for idea and
overall help) -- walk over all mount points which device match
the handle's device and open handle first and test if the path
provided is openable as well for tmpfs and devtmps which do not
save inodes between remounts. After all the inotify objects are
bound to inode so it's irrelevean via which path it's assigned.

https://jira.sw.ru/browse/PSBM-39957

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Acked-by: Andrew Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-10-21 14:55:59 +03:00
Andrew Vagin
7235e9b50d zdtm: replace err() on pr_perror()
There is an another err() in glibc

Signed-off-by: Andrew Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-10-21 14:54:53 +03:00
Andrew Vagin
f54e316eb0 zdtm: don't supply \n for err()
err() adds %m and \n at the end

Signed-off-by: Andrew Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-10-21 14:54:43 +03:00
Andrew Vagin
087b5cd5d9 test/zdtm: print a file name as string
Signed-off-by: Andrew Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-10-21 14:54:02 +03:00
Pavel Emelyanov
35603e51cc zdtm: Handle crfail tests (expected dump failure)
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-10-20 17:10:22 +04:00
Pavel Emelyanov
896837cea8 zdtm: Do not compare maps and fds for non-static tests
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-10-20 15:52:59 +04:00
Pavel Emelyanov
43d78feb3e zdtm: Fix exit code propagation from failed tests
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-10-20 15:40:10 +04:00
Pavel Emelyanov
50ad633a9c zdtm: Fix mnt_id feature name in desc files
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-10-20 15:28:55 +04:00
Andrew Vagin
be16f4f09b jenkins: use zdtm.py to run criu-sibling
Signed-off-by: Andrew Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-10-20 13:30:40 +03:00
Pavel Emelyanov
951a1e04f2 zdtm.py: Pass keep_img and fault option to sub-tasks
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-10-20 13:18:45 +03:00
Andrew Vagin
d150d6f20d freezer: don't catch kernel threads
OpenVZ creates per-container kernel threads and they live in
container's cgroups. CRIU should skip these threads, it's impossiable to
get any state of them.

Signed-off-by: Andrew Vagin <avagin@virtuozzo.org>
Signed-off-by: Andrew Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-10-19 12:50:09 +03:00
Pavel Emelyanov
8ce58ec963 zdtm.py: Ability to run tests with faults injected
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-10-19 12:45:40 +03:00
Pavel Emelyanov
68baf8e77d criu: Fault injection core
This patch(set) is inspired by similar from Andrey Vagin sent
sime time earlier.

The major idea is to artificially fail criu dump or restore at
specific places and let zdtm tests check whether failed dump
or restore resulted in anything bad.

This particular patch introduces the ability to tell criu "fail
at X point". Each point is specified with a integer constant
and with the next patches there will appear places over the
code checking for specific fail code being set and failing.

Two points are introduced -- early on dump, right after loading
the parasite and right after creation of the root task.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-10-19 12:42:29 +03:00