2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-29 13:28:27 +00:00

1830 Commits

Author SHA1 Message Date
Pavel Emelyanov
4943eb43fd netns: Basic link dump, restore and show
Only support the lo device. This is not final yet (much more
stuff is to be handled for a link) but is rather a skeleton
showing how to do it and letting us check the LXC container
early.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-02 08:17:27 +04:00
Pavel Emelyanov
f006545a0a parasite: Switch netns before creating transport socket
If the target task sits in another netns the sockets will
not be able to interconnect unless we create the host-side
one in the same netns. Thus do it and then roll back the
namespace.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-02 08:10:22 +04:00
Pavel Emelyanov
0a827aa96c net: Basic netns dump/restore skeleton
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-02 08:06:29 +04:00
Pavel Emelyanov
2d56d1b056 ns: Add ability to save original ns and restoring it back while switcing
This will be required for parasite transport socket creation -- it will
have to be created in a net ns we're putting parasite in and then we'll
have to restore it back to original to go on dumping.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-02 07:55:05 +04:00
Pavel Emelyanov
9eda83b74a parasite: Pull cr_options down (or up) to transport sock creation
We'll need to check whether the socket is to be created in a net
namespace (since we can't detect this automatically yet). Thus the
namespaces flags are required there.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-02 07:53:02 +04:00
Pavel Emelyanov
38431fb161 img: Introduce the notion of a raw image
Raw images are supposed to be files with non-crtools contents.
E.g. tarballs with tmpfs contents or iptables-save output. Another
example is -- ip tool addr and route dumps we're about to merge
soon.

Having these type of images allows to use the open_image and the
cr_fdset engine easily.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-02 07:42:41 +04:00
Pavel Emelyanov
7b7e4826dc netlink: Fix NLMSG_ERROR handling
This type of message is also reported for NLM_F_ACK is requested
and no necessarilly indicates an error. The error code is in the
message body.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-02 07:36:12 +04:00
Pavel Emelyanov
b0cf603b18 netlink: Pass argument through do_rtnl_req engine
Will need it int netns dumping callbacks later.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-02 07:36:12 +04:00
Pavel Emelyanov
cffe1ea172 netlink: Remove handmade rtnl macros/definitions
All we need is (should be) in rtnetlink.h

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-02 07:36:12 +04:00
Pavel Emelyanov
b7b5bfdd28 libnetlink: Move the rtnl req routine into libnetlink.c
The function that does socket collecting is actually a rtnl
request sending one. It will be usefull for netns dump/restore,
so move it to generic place.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-02 07:36:12 +04:00
Andrey Vagin
2e9ddccdb9 restore: rework logic about temporary proc
We need proc for restoring processes. The existent /proc may be not suitable.
E.g. If processes are in pidns.

crtools mounts procfs in a temporary directory, but it should be
umounted at the end. Before this patch crtools did that, but
it doesn't work if processes in a mount namespace.

Actually this logic can be simplified and this patch does that.
* create a tmp dir
* mount procfs
* open this directory and save a file descriptor.
* detach procfs
* remove the tmp dir
* access to proc via openat, statat and so on.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-01 15:01:13 +04:00
Pavel Emelyanov
2f272fa187 parasite: Don't recreate host-side transport socket
When dumping a net namespace we'll have to create the transport
socket in the target namespace. In order to do this we'll have
to call setns swice -- before and after socket() call.

I don't want to do it for every single task to dump, let's cache
the socket instead.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-01 10:17:14 +04:00
Pavel Emelyanov
6cf65d0fe0 parasite: Remove the connect-tsock command
Do init and transport sockets interconnections in one
switch to parasite.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-01 09:48:02 +04:00
Pavel Emelyanov
bc21b29ba6 fdinfo: Report miss of required entries on parse
Otherwise dump succeeds but is inconsistent.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-01 07:41:19 +04:00
Andrey Vagin
1fef842025 zdtm.sh: dump mount namespace for test_init
* s/pidns/ns/
* Add option --namespace mnt to "crtools dump"

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-01 07:01:36 +04:00
Andrey Vagin
9c1fa58c9d test_init: add support of mount namespaces
A part of code has been copied from mountpoints.c

This code umounts all points except /proc and /

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-01 07:01:29 +04:00
Andrey Vagin
c69be631e1 mntns: crtools: stat pathes relatively of a mntns root
If we dump tasks with mntns, we should look at pathes from point of a mntns root.

Now we support a situation when a root of an init task has the same root as the
mntns root, because we have not another way to get a root of mntns.

A path to an unix socket is copied, because the origin copy will be gone
out from the function, where it was created.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-01 07:00:48 +04:00
Andrey Vagin
3a60163b71 zdtm: open a file in mountpoints.c
We need to check that opened files can be restored in mntns
[xemul: s/slabinfo/meminfo as in 9dc050fd]

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-01 06:57:20 +04:00
Andrey Vagin
368d7ac0e6 zdtm: test_init exits, if all children died
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-07-31 15:48:16 +04:00
Andrey Vagin
a954120154 zdtm: close a write end of a status pipe in a parent process
Otherwise a parent hangs if a child died, because
it reads from a status pipe.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-07-31 15:47:15 +04:00
Andrey Vagin
44c2ac9310 zdtm: test_init creates a pid file
Before this patch we use pidof to get a pid of a test process.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-07-31 15:47:07 +04:00
Konstantin Khlebnikov
9dc050fde0 zdtm: /proc/slabinfo not present in container
PCLIN-31078

Signed-off-by: Konstantin Khlebnikov <khlebnikov@openvz.org>
Acked-by: Andrey Vagin <avagin@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-07-31 15:45:57 +04:00
Victor Konyashkin
2fe7ed666b zdtm: It's need define CLONE_NEWIPC for redhat-el5
The patch allows define CLONE_NEWIPC for redhat-el5.

Signed-off-by: Victor Konyashkin  <vkonyashkin@parallels.com>
Acked-by: Andrey Wagin <avagin@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-07-31 15:08:25 +04:00
Victor Konyashkin
fc3a5ebd3d zdtm: It's need define CLONE_NEWPID for redhat-el5
The patch allows define CLONE_NEWPID for redhat-el5 to avoid error:
test_init.c:114: error: 'CLONE_NEWPID' undeclared (first use in this function)

Signed-off-by: Victor Konyashkin  <vkonyashkin@parallels.com>
Acked-by: Andrey Wagin <avagin@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-07-31 15:07:07 +04:00
Cyrill Gorcunov
9d0875a813 files-reg: Use close_safe for fd variable
This makes compiler happy.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-07-31 14:09:49 +04:00
Cyrill Gorcunov
ba85bf30bd sk-inet: Init addr_size variable
Since we've BUG_ON(1) here so this is
not a problem, but lets make compiler happy.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-07-31 14:09:39 +04:00
Cyrill Gorcunov
bcb625b8af parasite: Init ret variable
Compiler doesn't like the ret unitialized
here (it's not a problem since SIGMAX is
never less than 1).

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-07-31 14:09:32 +04:00
Cyrill Gorcunov
8a3e7f31f4 log: Introduce LOG_PREFIX
Useful if one need a prefix over module messages.
I use it in tty c/r, thus having something like

 | TTY: master 0x31 index 2 fd 6 pid 5079 (create 1)
 | TTY:     `- slave 0x5c index 2 fd 255 pid 5080 (create 0 send 0)
 | TTY: standalone slave 0x2e index 1 fd 3 pid 5079 (create 1)

in log. Which helps filtering messages.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-07-31 14:07:09 +04:00
vkonyashkin
d1a36cc98a zdtm: It's need turn off FORTIFY_SOURCE instead of use -Wno-unused-result option
The -Wno-unused-result option looks to have been introduced in GCC 4.5.0.
So it's need turn off FORTIFY_SOURCE (compiler warn about unused results
in fortification mode) instead of use -Wno-unused-result to avoid error
in versions prior to 4.5.0.

Signed-off-by: Victor Konyashkin  <vkonyashkin@parallels.com>
Acked-by: Andrey Wagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-07-31 14:06:04 +04:00
vkonyashkin
47d200c637 zdtm: It's need to sleep between clock_gettime() in uptime_grow
Kernel can't suspend container by design if calls clock_gettime()
in a loop, so we need to sleep between clock_gettime().

Signed-off-by: Victor Konyashkin  <vkonyashkin@parallels.com>
Acked-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-07-31 14:05:43 +04:00
Pavel Emelyanov
4ee52f3403 tcp: Use sk ino number for opening tcp stream image on restore
It was accidentally broken by 424a4adb6. It's better to use sk ino
instead of sk id, since tcp connection may be unbound from any fds
(not supported now) and thus there may be no ID for those.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-07-31 13:57:44 +04:00
Pavel Emelyanov
56a7073e83 Add the CREDITS file
This is a file with ... credits, yes :) While implementing the C/R stuff
we've receive a LOT of help from various people and would like to mention
them. If we've undeservedly forgotten someone (or something) -- please
help us to make amends and send a patch to this file.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-07-30 13:52:37 +04:00
Cyrill Gorcunov
26aa295135 files: Enhance error message
While being debugging problem I found plain BUG_ON is not enough.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-07-28 09:11:12 +04:00
Kinsbursky Stanislav
33293222ba protobuf: set field size to proper value fro "ENUM" type
Signed-off-by: Stanislav Kinsbursky <skinsbursky@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-07-28 09:10:17 +04:00
Kinsbursky Stanislav
6243e9c0cb crtools: remove references to absent '-p' option
Signed-off-by: Stanislav Kinsbursky <skinsbursky@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-07-28 09:09:52 +04:00
Kinsbursky Stanislav
2249fb3c91 crtools: check optind is valid before parsing command argument
Signed-off-by: Stanislav Kinsbursky <skinsbursky@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-07-28 09:08:46 +04:00
Kinsbursky Stanislav
797f9cc019 makefile: remove all references to "test-legacy"
Signed-off-by: Stanislav Kinsbursky <skinsbursky@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-07-28 09:08:16 +04:00
Kinsbursky Stanislav
d88a52f1a1 protobuf: use generic show function for processes tree
Signed-off-by: Stanislav Kinsbursky <skinsbursky@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-07-28 09:07:27 +04:00
Kinsbursky Stanislav
8c72187be1 protobuf: use generic show function for ipc namespace variables
v2:
1) Debug garbage removed

Signed-off-by: Stanislav Kinsbursky <skinsbursky@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-07-28 09:05:07 +04:00
Kinsbursky Stanislav
ba4366d3da protobuf: use generic show function for ipc shared memory
Signed-off-by: Stanislav Kinsbursky <skinsbursky@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-07-28 09:04:58 +04:00
Kinsbursky Stanislav
49ea3128db protobuf: use generic show function for ipc messages
Signed-off-by: Stanislav Kinsbursky <skinsbursky@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-07-28 09:04:51 +04:00
Kinsbursky Stanislav
26eb254f96 protobuf: use generic show function for ipc semaphores
Signed-off-by: Stanislav Kinsbursky <skinsbursky@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-07-28 09:04:41 +04:00
Kinsbursky Stanislav
290003e964 protobuf: add payload print support in generic show function
This patch also updates pipe data and sockets queues payload handlers to
output data in "-c" option was passed to crtools.

Signed-off-by: Stanislav Kinsbursky <skinsbursky@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-07-28 09:02:38 +04:00
Cyrill Gorcunov
737045fe57 test: Drop legacy directory
All things are already in zdtm, not need to carry it.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-07-25 18:59:05 +04:00
Cyrill Gorcunov
e77c21f725 crtools: Drop tools directory
I've been using it to send notifications about
commits but there is no need anymore.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-07-25 18:58:24 +04:00
Kinsbursky Stanislav
bdb58423ca protobuf: use generic show function for pipe data
Signed-off-by: Stanislav Kinsbursky <skinsbursky@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-07-25 18:33:29 +04:00
Kinsbursky Stanislav
9ac6d09149 protobuf: use generic show function for socket queues
Signed-off-by: Stanislav Kinsbursky <skinsbursky@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-07-25 18:33:20 +04:00
Kinsbursky Stanislav
63ad6e6d30 show: add helper for reading and printing of images binary data
Signed-off-by: Stanislav Kinsbursky <skinsbursky@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-07-25 18:33:04 +04:00
Kinsbursky Stanislav
d0a5f0aea9 protobuf: add show support for images payload
Payload handler can be passed into generic protobuf show function.

Signed-off-by: Stanislav Kinsbursky <skinsbursky@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-07-25 18:32:41 +04:00
Kinsbursky Stanislav
ae150da091 protobuf: use pb-vertical show function for core
Signed-off-by: Stanislav Kinsbursky <skinsbursky@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-07-25 18:30:50 +04:00