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

129 Commits

Author SHA1 Message Date
Andrey Vagin
6bbdec26f3 files: add ability to set callbacks for files (v7)
Here is nothing interecting. If a file can't be dumped by criu,
plugins are called. If one of plugins knows how to dump the file,
the file entry is marked as need_callback. On restore if we see
this mark, we execute plugins for restoring the file.

v2: Callbacks are called for all files, which are not supported by CRIU.
v3: Call plugins for a file instead of file descriptor. A few file
descriptors can be associated with one file.
v4: A file descriptor is opened in a callback. It's required for
    restoring anon vmas.
v5: Add a separate type for unsupported files
v6: define FD_TYPES__UNSUPP
v7: s/unsupp/ext (external)

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-12-20 16:07:38 +04:00
Cyrill Gorcunov
0ce8c366dc make: protobuf -- Explicitly clean generated files
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-12-13 15:58:32 +04:00
Kir Kolyshkin
26fda7a319 space-before-tab whitespace cleanup
Remove space before tab characters.

Found by git grep ' 	' (Space, Ctrl-V, Tab in shell).

Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-12-12 10:00:53 +04:00
Ruslan Kuprieiev
0b5b2f9906 service: Add support for check request
Signed-off-by: Ruslan Kuprieiev <kupruser@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-11-20 14:16:44 +04:00
Andrey Vagin
d917ff15bb tcp: save the amount of unsent data in the socket send queue
TCP send queue contains two types of data:
* unacknowledged data, which have been sent out
* data, which have not been sent

Currently only the size of all data is save, but it's not enough for
proper restoring of TCP connections.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-11-14 17:14:31 +04:00
Cyrill Gorcunov
cf6d5d02a6 make: protobuf -- Escape slashes to future needs
At moment we generate protobuf dependencies having in
mind that protobuf/ directory is _always_ in the source
code root. This may change one day in future so better to
be on safe side and escape slashes immediately.

I meet this problem when been needed to build protobuf
builtin in $(root)/src/protobuf directory.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-11-11 16:05:23 +04:00
Cyrill Gorcunov
96fdc01798 protobuf: Add EXTLINK netdevice type
This kind of netdevice will serve for external
links such as venet, macvlan/vlan and etc.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-10-10 15:12:06 +04:00
Ruslan Kuprieiev
cdba0c87bf rpc: add restore to rpc.proto
Add restore to rpc.proto.
Signed-off-by: Ruslan Kuprieiev <kupruser@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-10-02 20:16:29 +04:00
Ruslan Kuprieiev
398705d4cb rpc: rename criu_dump_req to criu_opts
Lets rename CriuDumpReq to CriuOpts, for the sake of readability and to
avoid coping code for restore mechanism, as CriuDumpReq and
CriuRestoreResp would have almost the same fields. Also, it would be
easier to introduce other types of requests.

Signed-off-by: Ruslan Kuprieiev <kurpuser@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-10-02 16:04:11 +04:00
Ruslan Kuprieiev
4d80f502e8 v2 rpc: add log_file field to opts, add defaults toi log.h and use them where needed
[xemul: Simplified !log_file case and renumbered .proto fields]

Signed-off-by: Ruslan Kuprieiev <kupruser@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-10-02 16:01:44 +04:00
Andrey Vagin
07930a8df4 ns: replace pid on id in per-namespace files
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-10-01 12:17:04 +04:00
Pavel Emelyanov
fe3fb8851e tcp: Support CORK and NODELAY options
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-09-25 11:43:02 +04:00
Pavel Emelyanov
e866b7c043 rpc: Split rpc req-s from rpc-resps
Now we don't have generic criu_msg thing -- instead, we have
explicit request (with per-type args) and explicit responce
(yet again -- with per-type args).

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-09-16 15:36:12 +04:00
Pavel Emelyanov
d285be5ed7 rpc: Renumber dump-req fields
Put important things first, secondary last.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-09-16 15:23:00 +04:00
Ruslan Kuprieiev
98b5541492 v2 rpc: change some "required" fields to "optional"
The most of fields are to be changed to "optional", because they are
optional in fact.

Signed-off-by: Ruslan Kuprieiev <kupruser@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-09-16 15:21:13 +04:00
Ruslan Kuprieiev
2b14723511 protobuf: Add rpc.proto file with messages description
Signed-off-by: Ruslan Kuprieiev <kupruser@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-09-13 15:52:51 +04:00
Andrey Vagin
2b4a8d29d6 mount: save group and master in image file (v2)
They are required for restoring shared and slave mounts

v2: use the same names of variables in image and in code
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-08-30 15:01:27 +04:00
Pavel Emelyanov
022cfc30ae net: Dump and restore netdev address
Tap-s and Veth-s can change one, need to keep it.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-08-24 01:07:33 +04:00
Pavel Emelyanov
9615c3b96b tun: Initial skeleton for tun support
There will be two entities handled:

1. tun file -- an opened char device with misc major and tun minor
   that can be attached to item #2

2. tun netdevice -- another type of links

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-08-23 18:57:40 +04:00
Pavel Emelyanov
9b45833b81 stats: Account total time to restore
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-08-11 21:25:42 +04:00
Pavel Emelyanov
2df39a4b47 stats: Account for time to fork tasks on restore
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-08-11 21:22:40 +04:00
Pavel Emelyanov
e99576f655 rst: Collect stats about checked-vs-cowed pages
On restore we compare pages' contents with memcmp to check which
of them can remain shared. Report this info in restore stats.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-08-11 13:36:24 +04:00
Pavel Emelyanov
729ea690ed stats: Introduce protobuf message for restore stats
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-08-11 13:27:58 +04:00
Cyrill Gorcunov
766d56fb21 protobuf: Add thread_sas_entry
Will need it to store thread alternative signal stack.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-07-10 17:31:08 +04:00
Pavel Tikhomirov
2f98253c26 posix-timer: Add protobuf message and rename to protobuf/timer.proto
Signed-off-by: Pavel Tikhomirov <snorcht@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-07-01 16:19:23 +04:00
Cyrill Gorcunov
a49325b524 protobuf: Prepare scaffolds for procfs NS entries
[ xemul: rename pb.cflag -> pb.ns_cflag ]

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-05-18 03:37:00 +04:00
Pavel Emelyanov
37c137092b mem/stats: Add stats about memory dumping
pages_scanned -- the amount of pages criu looked at for decision
pages_skipped_parent -- the amount of pages that were skipped, due to
                        they are present in parent image
pages_writted -- the amount of pages criu transfered into image

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-05-15 15:46:07 +04:00
Pavel Emelyanov
094330c33b stats: Add writing-memory-image timing
Dumping memory is draining it from parasite, for pre-dump
this time would be reasonably small. _Writing_ the memory
would occur _after_ tasks unseize and resume.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-05-14 11:52:45 +04:00
Pavel Emelyanov
1e18128423 stats: Dump-time statistics
Basic timings for dump (freeze, frozen, mem dump).

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-05-13 13:53:31 +04:00
Pavel Emelyanov
d770f4ef23 stats: Protobuf file introduction introduction
We'll have one more "image" file generated by dump and (surprisingly)
restore commands -- the stats one. It will contain in a single pb
object all the statistics collected by dump/restore.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-05-13 13:50:15 +04:00
Pavel Emelyanov
60fc6abfd7 cr: Preparations for snapshot
1. Directory with images may have a "parent" symlink pointing to the
   place where the previous snapshot is
2. Each pagemap will have "in_parent" bit, which means, that the
   pages for this pagemap entry are not in the respective page.img
   but in parent
3. New --leave-running option to use with --snapshot not to kill
   tasks after snapshot

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-04-12 19:45:15 +04:00
Cyrill Gorcunov
9c3a88c7b1 mnt: Add simfs entry to a list of supported fs
simfs is used in OpenVZ containers, so lets understand it
and don't fail on its meeting.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-04-04 14:08:33 +04:00
Andrey Vagin
b9e6a27c3d sockets: dump netlink sockets
All info about bound sockets are got via socket diag interface.
All connected sockets are automatically bound.
For other sockets only protocol must be dumped, which is got
with help getsockopt.

A netlink sockets with pending data are not supported yet and
probably will not be supported in a near future.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-03-26 00:23:59 +04:00
Andrey Vagin
149a5a5e5a protobuf: add image for netlink sockets
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-03-26 00:22:46 +04:00
Andrey Vagin
187e1617a8 protobuf: add a new description for saving siginfo-s
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-03-25 23:43:33 +04:00
Cyrill Gorcunov
62d532a97f mount: Add PB entries for FS types
mnt_entry::fstype is a part of image ABI, thus we need
to provide some "common" encoding outside tools would
know about this field encoding.

Thus we instorduce fstype enum in .proto file and use it
in source code as well.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-03-18 22:32:57 +04:00
Pavel Emelyanov
8801f59615 mem: Protobuf format for page dumps
Since now we drain pages out of parasite, we can invent any format for
page dumps. Let is be ... prorobuf one! :)

Another thing to keep in mind, is that we're about to use splices and
implement iterative migration, so it's better to have actual pages be
page-aligned in the image.

And -- backward compatibility. That said the new format is:

1. pagemap-... file which contains a header (currently with a ID of
   the image with pages, see below) and an array of <nr_pages:vaddr>
   pairs. The first value means "how many pages to take from the
   file with pages (see below)" and the second -- where in the task
   address space to put them. Simple.

2. pages-... file which containes only pages one by one (thus aligned
   as we want).

This patch breaks backward compatibility (old images with pages wil
be restored and then crash). Need to do it before v0.5 release.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-03-14 18:16:41 +04:00
Alexander Kartashov
888bdda5d4 protobuf: fixed compilation on ARM
The constant 4294967295 isn't replaced with 0xFFFFFFFF
in a generated source.

Signed-off-by: Alexander Kartashov <alekskartashov@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-02-20 14:54:35 +04:00
Cyrill Gorcunov
a210b5a1c5 make: protobuf -- Switch to a new scheme
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-02-18 18:10:44 +04:00
Andrey Vagin
04c48fefbc tcp: dump and restore tcp_timestamp for each socket (v2)
If a TCP socket will get live-migrated from one box to another the
timestamps (which are typically ON) will get screwed up -- the new
kernel will generate TS values that has nothing to do with what they
were on dump. The solution is to yet again fix the kernel and put a
"timestamp offset" on a socket.

v2: don't fail if TCP_TIMESTAMP is unsupported

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-02-14 20:27:39 +04:00
Andrey Vagin
f3cd454cd4 sk-unix: dump/restore a file permissions
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-30 03:28:01 +04:00
Cyrill Gorcunov
e28960c348 make: protobuf -- Simplify sed'ing
No need for multiple sed calls, better pass
all options in once.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-25 14:57:52 +04:00
Cyrill Gorcunov
008457e1e2 make: protobuf -- Order .c files generation
This patch introduce dependencies on .c files
generation parsing import keywords in .proto
files.

In particular, the core.proto file refers to
core-x86.proto which means we need to generate
.[c|h] files from core-x86.proto earlier than
handlig of core.proto.

A positive side effect of this patch is that
the compilation is independent now of order the
proto files are declated in the make file.

Instead of currently present manual order

PROTO_FILES	+= core-x86.proto
PROTO_FILES	+= core-arm.proto
PROTO_FILES	+= core.proto

one can write it in any arrangement, say

PROTO_FILES     += core.proto
PROTO_FILES     += core-arm.proto
PROTO_FILES     += core-x86.proto

and it still be resolved correctly.

BUT beware of circular import directives,
we can't handle them now.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-24 13:22:05 +04:00
Cyrill Gorcunov
d701221e54 make: protobuf -- Generate protofiles deps
Some protobuf files do import another files so
we should generate dependencies and rebuild
the program when needed.

For example core.proto imports core-x86.proto
and core-arm.proto, thus if any of them are
changed the final core.pb-c.c should be regenerated.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-24 13:21:52 +04:00
Cyrill Gorcunov
2e7982ce3f make: protobuf -- Mangle integer constant on ARM only
It's known to work on x86-64 so make the build procedure
a bit faster here.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-24 13:21:35 +04:00
Cyrill Gorcunov
629e045466 protobuf: Move arch core resources to core-$(ARCH).proto
To unweave arch dependent part from general core.proto file.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-23 18:22:47 +04:00
Alexander Kartashov
a0c86a25ab core.proto: added ARM-specific parts to a Core message
Signed-off-by: Alexander Kartashov <alekskartashov@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-22 22:52:39 +04:00
Pavel Emelyanov
1a60975622 img: Save crtools process IDs in inventory
On restore we'll need to know whether the root task should be
cloned in new set of namespaces. It's natural to do it by
comparing root ids with some "other-world" IDs.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-18 13:25:02 +04:00
Pavel Emelyanov
2105e18eee core: Save tasks' namespaces IDs in the ids image
The recent kernels allow to get namespaces IDs by reading proc-ns links.
Use this to generate IDs for tasks' namespaces (I do generate them, since
IDs provided by kernel look ugly :( ).

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-18 13:18:33 +04:00
Qiang Huang
c9797cfa27 protobuf: add a new description for saving file-lock
We need a new protobuf description for file-lock.

Originally-signed-off-by: Zheng Gu <cengku.gu@huawei.com>
Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-17 14:38:11 +04:00