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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>