In this case we can wait it and get an exit code.
For example, it will be useful for p.haul where one connection
is used several times, so we need a way how to understand that
page-server exited unexpectedly.
v2: don't write ps_info if a start descriptor isn't set
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
To use lazy-pages from runc '--lazy-pages' functionality needs to be
accessible via RPC. This enables lazy-pages via RPC.
The information on which port to listen is taken from the
criu_page_server_info protobuf structure. If the user has enabled
lazy-pages via RPC only criu_page_server_info.port is evaluated
to get the listen port.
With additional patches in runc is it possible to use lazy-restore
with 'runc checkpoint' and 'runc restore'.
travis-ci: success for lazy-pages: enable lazy-pages via RPC
Signed-off-by: Adrian Reber <areber@redhat.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
Extend the RPC feature check functionality to also test for lazy-pages
support. This does not check for certain UFFD features (yet). Right now
it only checks if kerndat_uffd() returns non-zero.
The RPC response is now transmitted from the forked process instead of
encoding all the results into the return code. The parent RPC process
now only sends an RPC message in the case of a failure.
Signed-off-by: Adrian Reber <areber@redhat.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
Instead of parsing the output of 'criu -V' this offers a RPC interface
to get CRIU's version. In a follow up patch a test script is included
to use the new interface:
./version.py
Connecting to CRIU in swrk mode to check the version:
RPC: Success
CRIU major 2
CRIU minor 12
CRIU gitid v2.12-635-g6d3ae4d
This change exports the following version fields:
* major
* minor
* gitid (optional)
* sublevel (optional)
* extra (optional)
* name (optional)
The optional gitid field is not set when CRIU is not built from git.
Signed-off-by: Adrian Reber <areber@redhat.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
Now Docker creates a pty pair from a container devpts to use is as console.
A slave tty is set as a control tty for the init process and bind-mounted
into /dev/console. The master tty is handled externelly.
Now CRIU can handle external resources, but here we have internal resources
which are used externaly.
https://github.com/opencontainers/runc/issues/1202
travis-ci: success for A few fixes to c/r a docker container with a console (rev3)
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
As runc uses the RPC interface to run criu it is necessary to expose
the newly added status-fd feature via RPC. Using the status-fd interface
makes it possible to use lazy migration with runc.
travis-ci: success for RPC: make status-fd option available via RPC (rev3)
Signed-off-by: Adrian Reber <areber@redhat.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
with newer versions of protobuf, I get:
./crit
Traceback (most recent call last):
File "./crit", line 7, in <module>
import pycriu
File "/home/ubuntu/criu/crit/pycriu/__init__.py", line 2, in <module>
import images
File "/home/ubuntu/criu/crit/pycriu/images/__init__.py", line 2, in <module>
from images import *
File "/home/ubuntu/criu/crit/pycriu/images/images.py", line 52, in <module>
from pb import *
File "/home/ubuntu/criu/crit/pycriu/images/pb.py", line 35, in <module>
from packet_sock_pb2 import *
File "/home/ubuntu/criu/crit/pycriu/images/packet_sock_pb2.py", line 18, in <module>
import sk_opts_pb2 as sk__opts__pb2
File "/home/ubuntu/criu/crit/pycriu/images/sk_opts_pb2.py", line 23, in <module>
serialized_pb=_b('\n\rsk-opts.proto\"\xe2\x02\n\rsk_opts_entry\x12\x11\n\tso_sndbuf\x18\x01 \x02(\r\x12\x11\n\tso_rcvbuf\x18\x02 \x02(\r\x12\x16\n\x0eso_snd_tmo_sec\x18\x03 \x02(\x04\x12\x17\n\x0fso_snd_tmo_usec\x18\x04 \x02(\x04\x12\x16\n\x0eso_rcv_tmo_sec\x18\x05 \x02(\x04\x12\x17\n\x0fso_rcv_tmo_usec\x18\x06 \x02(\x04\x12\x11\n\treuseaddr\x18\x07 \x01(\x08\x12\x13\n\x0bso_priority\x18\x08 \x01(\r\x12\x13\n\x0bso_rcvlowat\x18\t \x01(\r\x12\x0f\n\x07so_mark\x18\n \x01(\r\x12\x13\n\x0bso_passcred\x18\x0b \x01(\x08\x12\x12\n\nso_passsec\x18\x0c \x01(\x08\x12\x14\n\x0cso_dontroute\x18\r \x01(\x08\x12\x13\n\x0bso_no_check\x18\x0e \x01(\x08\x12\x14\n\x0cso_bound_dev\x18\x0f \x01(\t\x12\x11\n\tso_filter\x18\x10 \x03(\x06*6\n\x0bsk_shutdown\x12\x08\n\x04NONE\x10\x00\x12\x08\n\x04READ\x10\x01\x12\t\n\x05WRITE\x10\x02\x12\x08\n\x04\x42OTH\x10\x03')
File "/usr/lib/python2.7/dist-packages/google/protobuf/descriptor.py", line 827, in __new__
return _message.default_pool.AddSerializedFile(serialized_pb)
TypeError: Couldn't build proto file into descriptor pool!
Invalid proto descriptor for file "sk-opts.proto":
NONE: "NONE" is already defined in file "rpc.proto".
NONE: Note that enum values use C++ scoping rules, meaning that enum values are siblings of their type, not children of it. Therefore, "NONE" must be unique within the global scope, not just within "sk_shutdown".
this fixes that.
Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
CC: Laurent Dufour <ldufour@linux.vnet.ibm.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
When running criu in swrk mode the client typically wants to know
the reason of failure. Right now criu reports back NOTHING but the
fact that dump/restore/etc fails. We've tried to address this by
introducing the cr-errno engine, but it doesn't seem to be informative
enough and is hard to maintain -- adding new errno-s is boring :(
I propose to report back the first message with ERROR level upon
failrure as __typically__ the very first error message indicates
that proceeding is impossible and criu rolls back (generating more
error messages, so it's crucial to know the very first one).
If we ever meet the situation that the first pr_err/pr_perror doesn't
cause criu to exit, this printing should be fixed to be pr_warn.
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
Acked-by: Andrei Vagin <avagin@virtuozzo.com>
For the previously added option to skip in-flight connections this adds
that option to the RPC interface. The skip in-flight connections is also
described in criu.txt.
Signed-off-by: Adrian Reber <areber@redhat.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
Needed for container migration, where arguments are
set via p.haul as rpc request.
Signed-off-by: Nikita Spiridonov <nspiridonov@virtuozzo.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
For handling --cgroup-props, --cgroup-props-file and
--cgroup-dump-controller from RPC interface.
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
this patch add join-ns option to criu CLI and RPC.
This opt can be used in this fomat:
--join-ns NS:PID|NS_FILE
for example --join-ns net:12345 or --join-ns net:/foo/bar.
pid namespaces is not supported yet. As fork() is needed to make
new pid-namespace work. That makes it hard for criu to track the
child-process through pid because another child process has been
created after fork().
Signed-off-by: Deng Guangxing <dengguangxing@huawei.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
This reverts commit a98014f306be4b4fefdf01af31e1efa5d83e5e4f.
As per Saied Kazemi, actually dump works without seccomp support
from the kernel on non-seccomped tasks. The only problem was with
criu check, but this would be addressed separately.
Reverting the commit not to burden the API with (yet) unneeded stuff.
Conflicts:
lib/c/criu.h
Sometimes we may want to use CRIU on older kernels which don't support
dumping seccomp state where we don't actually care about the seccomp state.
Of course this is unsafe, but it does allow for c/r of things using
seccomp on these older kernels in some cases. When the task is in
SECCOMP_MODE_STRICT or SECCOMP_MODE_FILTER with filters that block the
syscalls criu's parasite code needs, the dump will still fail.
Note that we disable seccomp by simply feigning that we are in mode 0. This
is a little hacky, but avoids distributing ifs throughout the code and
keeps them in this one place.
Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
CC: Saied Kazemi <saied@google.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
Docker requested an option, when network devices and routes are not
dumped and not restored. Instead of this Docker will call libnetwork
hook to tune netns from the setup-namespaces action.
Cc: Saied Kazemi <saied@google.com>
Tested-by: Ross Boucher <boucher@gmail.com>
Signed-off-by: Andrew Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
But keep @protobuf as a symlink: we have
this path encoded in sources. Gonna be
removed with time.
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>