2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-22 01:51:51 +00:00

147 Commits

Author SHA1 Message Date
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
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
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
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
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
Kinsbursky Stanislav
cb6ae5b6c9 protobuf: use pb-vertical show function for mm
Signed-off-by: Stanislav Kinsbursky <skinsbursky@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-07-25 18:30:35 +04:00
Kinsbursky Stanislav
bc04724a2c protobuf: use pb-vertical show function for creds
Signed-off-by: Stanislav Kinsbursky <skinsbursky@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-07-25 18:30:09 +04:00
Kinsbursky Stanislav
da4d808af8 protobuf: use pb-vertical show function for fs
Signed-off-by: Stanislav Kinsbursky <skinsbursky@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-07-25 18:29:55 +04:00
Kinsbursky Stanislav
caea044a8b protobuf: use pb-vertical show function for ghost file
Signed-off-by: Stanislav Kinsbursky <skinsbursky@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-07-25 18:29:40 +04:00
Pavel Emelyanov
5421e44b72 show: Don't crash if thread_info is absent in core
This is how zombies live.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-07-20 14:13:14 +04:00
Cyrill Gorcunov
9d918c5964 protobuf: Convert core_entry to PB format v5
This requires some exlanations

 - Since we use protobuf data in restorer
   code we need to carry a copy of appropriate
   PB entities in resident memory. For this
   sake task_restore_core_args and thread_restore_args
   were significantly reworked. In short -- the caller
   code fills PB structures into task arguments space.

v3:
 - Combine everything arch related to thread_info field,
   and make it optional
 - Drop "version" field from message, we check version in
   another specific message
 - Don't forget to call core_entry__free_unpacked where needed
 - We continue dumping FPU state, still it's not yet restored

v4:
 - Don't carry task_core_entry and task_kobs_ids_entry for
   threads, and yield error if present in image.

v5:
 - Allocate core_entry depending on type of task being dumped

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-07-20 14:06:42 +04:00
Pavel Emelyanov
64967eef21 crtools: Kill the ability to work on individual process
We haven't tested it for several monthes and there's no evidence
it is required at all. For dumping a single task -t option works
just fine.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-07-19 17:55:34 +04:00
Stanislav Kinsbursky
af3b2869b3 show: cleanup
remap_id_type() is not used.

Signed-off-by: Stanislav Kinsbursky <skinsbursky@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-07-19 14:56:01 +04:00
Cyrill Gorcunov
4806e1395f protobuf: Convert vma_entry to PB format v3
v2:
 - Use regular uint types in message proto
 - Use PB engine for "show"
v3:
 - drop usage of temp. variable in prepare_shmem_pid

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-07-19 12:43:36 +04:00
Pavel Emelyanov
ffd40996ea pb: Switch creds to protobuf format
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-07-19 12:35:25 +04:00
Cyrill Gorcunov
0468355c12 protobuf: Drop fown_t type
We are ready to use FownEntry everywhere,
so drop fown_t type and clean up source code.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-07-19 09:39:00 +04:00
Pavel Emelyanov
2383c398c4 pb: Switch sigactions showing to use pb_show_plain
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-07-18 19:22:06 +04:00
Pavel Emelyanov
d6514dae45 pb: Introduce show_plain routine
This one walks the 'plain' image file, i.e. the one with straignt <magi>[<size><entry>]*
format, and prints each message. Saves lots of lines of code.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-07-18 19:09:51 +04:00
Stanislav Kinsbursky
656a463769 show: Convert simple array showing fns to use pb_show_msg
[merges some Stas' patches]

Signed-off-by: Stanislav Kinsbursky <skinsbursky@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-07-19 08:26:25 +04:00
Cyrill Gorcunov
808b8f2f06 protobuf: Convert mm_entry to PB format
Because the MmEntry has a "repeated" field, we
copy aux vector explicitly and reserve space for
it in task args.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-07-19 07:25:05 +04:00
Cyrill Gorcunov
a7691bcbe2 protobuf: Convert itimer_entry to PB format
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-07-18 16:27:01 +04:00
Cyrill Gorcunov
6b9d3affc9 protobuf: Convert sa_entry to PB format
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-07-18 16:25:06 +04:00
Cyrill Gorcunov
7861d32de0 protobuf: Convert struct pipe_data_entry to PB engine
Note, at moment we don't use "data" from proto declaration,
it's reserved to implement later (simply because it's easier
to use current code for a while).

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-07-17 14:50:23 +04:00
Cyrill Gorcunov
baa30914b5 protobuf: Convert pipe_entry to PB engine
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-07-17 07:29:57 +04:00
Cyrill Gorcunov
ccb254c1f0 protobuf: Convert pstree_entry to PB engine
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-07-17 07:29:36 +04:00
Cyrill Gorcunov
b02158c14c protobuf: Convert struct fs_entry to PB engine
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-07-17 07:28:38 +04:00
Cyrill Gorcunov
1abf969d8c show: Add pb_show_fown_cont helper
Need for PB transition.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-07-17 07:24:52 +04:00
Cyrill Gorcunov
98acfbec28 protobuf: Use RemapFilePathEntry instead of struct remap_file_path_entry
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-07-17 07:18:58 +04:00
Cyrill Gorcunov
dbf29ef92a protobuf: Use FifoEntry instead of struct fifo_entry
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-07-17 07:18:40 +04:00
Cyrill Gorcunov
5364592157 protobuf: Use GhostFileEntry instead of struct ghost_file_entry
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-07-17 07:17:51 +04:00
Cyrill Gorcunov
8041eac0e5 protobuf: Use RegFileEntry instead of reg_file_entry structure v3
This patch switches reg_file_entry structure with RegFileEntry
protobuf entry. Note that there a few nits remains

 - old fown_t structure doesn't scale well with FownEntry from
   RegFileEntry, so to not mess with rest of crtools code
   I've added a couple of opencoded copy operands, will clean
   this aspect up once rest of code is converted

 - the "show" procedure doesn't print fown for same reason

v2:
 - rename fown_t to fown_entry in .proto
v3:
 - don't print nil symbol on show

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-07-17 07:17:02 +04:00
Cyrill Gorcunov
a1fe3caf04 protobuf: Start switching our image entries to Google's protobuf
A short story -- there were a long conversation on which format should
be used to keep checkpointed data on disk image. We ended up in using
Google's Protocol Buffers (see https://developers.google.com/protocol-buffers/
for detailed description). Thus image entries should be convered to PB.

This patch converts fdinfo_entry to PB "message fdinfo_entry".

Build note: one should have protobuf and protobuf-c installed to be able
to build crtools.

 - http://code.google.com/p/protobuf/
 - http://code.google.com/p/protobuf-c/

Inspired-by: Pavel Emelianov <xemul@parallels.com>
Inspired-by: Kinsbursky Stanislav <skinsbursky@openvz.org>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-07-17 07:10:41 +04:00
Pavel Emelyanov
237ef3c809 pipe: Rework pipe data restore to use vmsplice
This serves two things -- kills annoying data offset management
which makes protobuf switch too ugly. And removes the need to
seek the pipe data image, which in turn is the prerequisity for
streaming migration.

Memory usage is still optimal, since we still use splice on dump
path and on restore stage we F_GIFT pipe buffers to the kernel.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-07-12 06:57:20 +04:00
Cyrill Gorcunov
ea1ce8e472 fifo: Add checkpoint restore for fifos v4
Checkpoint and restore of fifo is similar to
pipes c/r except the pipe end-points are named
file.

Because the fifo has a name we use regular files
facility for fifo path c/r.

Still there is a trick used to "open" fifo:
the opening procedure migh sleep if a fifo's peer
is not yet opened, so before doing a real open
we yield a fake open procedure (with O_RDWR flag)
which prevents us from sleeping even if peer
is not yet ready. Also we need writable fifo
end to restore data queued.

v2:
 - add open/priv members to reg_file_info
 - make open_fifo_fd to use open_fe_fd
 - comment on pipe_id
 - make sure the fifo data is not restored twice

v3:
 - drop useless fixme comment and add sane one
v4:
 - Use restore_data flag to escape data restore duplication
 - Use S_ISREG for file contents copying

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-07-01 17:15:48 +04:00
Andrey Vagin
49c1d43645 pstree: move all code about pstree in a separate file
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Looks-cool-to: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-06-27 21:07:30 +04:00
Cyrill Gorcunov
3f6f291668 pipes, show: Fix tail message in show_pipes_data
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Acked-by: Andrew Vagin <avagin@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-06-25 18:25:53 +04:00
Andrey Vagin
8075dc60a5 pstree: rename fields in struct pid
s/pid/virt/
s/real_pid/real/

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-06-22 12:09:44 +04:00
Andrey Vagin
4b48849c32 ctrools: prepare to dump pid namespace
Add struct pid and use it everywhere. This struct contains
two fields: pid and real_pid.

real_pid is a pid outside of the target pid namespace.
pid is in the target pid namespace

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-06-19 22:13:52 +04:00
Andrey Vagin
cf63c1d9e8 crtools: link pstree_item-s in a tree (v3)
because they describes a process TREE.

It's usefull, when we dump tasks from another pid namespace,
because a real pid is got from parasite. In previous version
we need to update pid in two places one is in a pstree_item and
one is in a children array.

A process tree will be necessery to restore sid and pgid,
because we should add fake tasks in a tree. For example if
a sesion leader is absent.

v2: fix rollback actions
v3: fix comments from Pavel Emelyanov
    * add macros for_each_pstree_item
    * and a few bugs

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-05-31 15:41:02 +04:00
Pavel Emelyanov
eeabd33219 show: Beautify fdinfos showing
Shifd fd and type left and print ID with %#x

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-05-17 10:57:06 +04:00
Andrey Vagin
066ec066a0 crtools: remove unused variables (v3)
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-05-18 19:01:21 +04:00
Cyrill Gorcunov
bff52ba952 inotify: Add checkpoint/restore v2
v2:
 - open_mount is cleaned up
 - byte-stream hex conversion remains untouched since
   strtol is flipping numbers to LE manner

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-05-04 14:00:45 +04:00
Cyrill Gorcunov
b38777dff4 eventpoll: Add checkpoint/restore v2
v2:
 - Move everything into eventpoll.[ch]
 - Use rst_file_params

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-05-04 14:00:05 +04:00
Cyrill Gorcunov
889795da5d eventfd: Add checkpoint/restore support v2
v2:
 - Pass initial counter value to eventfd call
   (can't pass flags here since they are obtained
    with fcntl and must be restored same way or
    restore will fail)
 - Use rst_file_params for flags and owner restore
 - Use eventfd.[ch] instead of eventfs.[ch]
 - Move show funcs to eventfd.c

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-05-04 13:59:51 +04:00
Pavel Emelyanov
ef2bd77ebd show: Beautify output of the -c data dump
Calculate the best width for address and print them all with it.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-04-29 09:05:21 +04:00
Konstantin Khlebnikov
bef7092834 Replace printf format "0x%x" with "%#x"
printf() has standard flag for adding "0x" prefix before hexadecimal integer.

MOD='[-+]\?[0-9]*.\?[0-9]*[lL]*'
git grep -l "0x%${MOD}x" | xargs -n1 sed -e "s/0x%\(${MOD}\)x/%#\1x/g" -i

Signed-off-by:    Konstantin Khlebnikov <khlebnikov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-04-24 15:20:24 +04:00
Kinsbursky Stanislav
231db3f80d output: add "0x" to hex prints manually
Signed-off-by: Stanislav Kinsbursky <skinsbursky@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-04-16 12:34:01 +04:00
Kinsbursky Stanislav
35eedb5f1f output: add "0x" to hex prints using sed
Command below was executed several times:

sed 's/\(pr_.*[^%,x,X]\)\(\%[0-9,l,L]*x\)/\10x\2/g' -i *.c

Signed-off-by: Stanislav Kinsbursky <skinsbursky@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-04-16 12:33:35 +04:00
Pavel Emelyanov
a1ccfb9297 files: Support dumping/restoring of completely unlinked files
Completely unlinked file is the one with n_link count being zero.
Such files only allow to read their contents and carry with us.

In order to dump this thing I introduce the "path remap" technology.
For reg file a remapping entry is dumped which describes, that at
restore stage before opening a regfile->path this path should be
linked to some other name and then (after open) unlinked.

For completely unlinked files the remap path would be a path to
a "ghost" file, i.e. a file which is created only at the time of
restore and which is removed completely at the end of it.

Partially unlinked files (i.e. those having n_link != 0, but a
path by which we see them in someone's fd is not accessible) should
be handled in another way.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-04-13 17:54:36 +04:00
Cyrill Gorcunov
a8840ba721 fowners: Add checkpoint/restore for sockets
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-04-12 12:31:33 +04:00