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

70 Commits

Author SHA1 Message Date
Andrey Vagin
07fc6cf394 crtools: don't include image.h in crtools.h
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-11-06 15:42:09 +04:00
Pavel Emelyanov
ee9d9bdb16 show: Compact output of zeroes in long repeated fields
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-10-17 14:48:05 +04:00
Pavel Emelyanov
64e7d2435a collect: Reduce amount of args to collect_image call
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-08-21 03:27:06 +04:00
Pavel Emelyanov
0543f49c3e pb: Free image object of collection doesn't need it
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-08-21 00:55:24 +04:00
Cyrill Gorcunov
225716278a protobuf: Move descriptors definitions to own file
Move protobuf object descriptors to own protobuf-desc
file(s). This allow to reuse the code in other tools.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-05-28 22:11:59 +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
abd6184107 pb: Fix EOL detection in pretty parser
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-05-15 15:37:42 +04:00
Pavel Emelyanov
37c361178a show: Make wildcard in pb pretty
The "*:<fmt>" describes format for everyone else in pretty.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-05-14 21:03:13 +04:00
Pavel Emelyanov
c35c037204 pb: Enhance protobuf pretty format parsing
1. clean the code
2. add support for <field-name>:<format> strings in pretty

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-05-14 21:03:13 +04:00
Pavel Emelyanov
b20e7f8db9 pb: Allow for nested messages pretty specification
It's not perfect, only the depth is taken into account,
not the field number, but this is OK for now.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-05-13 13:52:18 +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
cd537beda5 show: Get rid of flags argument from payload handler
We can "guess" one w/o addirional (obfuscating) argument to
the pb showing engine.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-05-08 00:00:24 +04:00
Cyrill Gorcunov
9cdb9102fa util: Make read_fd_link to return the length of the link read
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-05-07 22:42:57 +04:00
Pavel Emelyanov
5cae819d8c img: Get rid of open_image_ro helper
O_RSTR flag should be used instead for regular open_image

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-04-09 19:22:21 +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
03040be51e protobuf: Print the image filename on error
For example

 | Error (protobuf.c:574): Unexpected EOF on /home/crtools/tools/cpt2/test/out/utsns-1.img

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-03-21 00:45:44 +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
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
Cyrill Gorcunov
f385d32da5 image: fanotify -- Add scaffold code for fanotify objects
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-15 18:34:32 +04:00
Cyrill Gorcunov
b724096f0f fsnotify: Rename inotify files to fsnotify
We will be handling both inotify and fanotify
objects here thus to make less confusion rename
the files to fsnotify.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-15 18:34:26 +04:00
Andrey Vagin
20b5ed916f crtools: put kobj-ids into separate image file (v2)
It is read together with pstree items for checking what kind of
resources should be shared. Core is too big for reading it in
this place.

v2: fix check_core

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-12 00:54:39 +04:00
Pavel Emelyanov
748be83181 cr: Support rlimits
Dump the with "new" prlimit syscall that works on arbitrary pid.

Restore is done in restorer _after_ mappings mixup and _before_
caps drop to make it set any max value.

The RLIM_INFINITY is handled explicitly to help future 64<->32
bits migration.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-10 20:08:38 +04:00
Alexander Kartashov
6f61488f21 x86: moved x86-specific files into the directory arch/x86.
* The following files goes into the directory arch/x86/include/asm unmodified:
  - include/atomic.h,
  - include/linkage.h,
  - include/memcpy_64.h,
  - include/types.h,
  - include/bitops.h,
  - pie/parasite-head-x86-64.S,
  - include/processor-flags.h,
  - include/syscall-x86-64.def.

* Changed include directives in the source files that include the headers
  listed above.

* Modified build scripts to reflect the source moves.

Signed-off-by: Alexander Kartashov <alekskartashov@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-09 17:02:47 +04:00
Cyrill Gorcunov
300d2f2626 protobuf: Drop dangling \Space
No func change.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-11-11 13:28:59 +04:00
Cyrill Gorcunov
058d83b464 protobuf: Return -1 on error in do_pb_read_one
Better to stick with the convention we're trying
to follow in general -- negative codes for error.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-11-11 13:28:25 +04:00
Stanislav Kinsbursky
eee14340e3 protobuf: skip show of zero-size repeated fields
Print "<empty>" message for such filed instead.

#2425

Signed-off-by: Andrew Vagin <avagin@parallels.com>
Signed-off-by: Stanislav Kinsbursky <skinsbursky@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-11-06 16:46:42 +04:00
Pavel Emelyanov
9988c38daa protobuf: Fix show of nested messages in pretty format
Currently the pretty format leaks to the nested messages and
affects the way they are shown. Fix this by assuming the nested
messages to be non-pretty.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-10-12 20:48:32 +04:00
Stanislav Kinsbursky
3583578d7c protobuf: fixed typo in pb_write_one
Signed-off-by: Stanislav Kinsbursky <skinsbursky@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-10-03 16:04:48 +04:00
Cyrill Gorcunov
89a7a45d37 tty: Add checkpoint/restore for unix terminals v6
Usually the PTYs represent a pair of links -- master peer and slave
peer. Master peer must be opened before slave. Internally, when kernel
creates master peer it also generates a slave interface in a form of
/dev/pts/N, where N is that named pty "index". Master/slave connection
unambiguously identified by this index.

Still, one master can carry multiple slaves -- for example a user opens
one master via /dev/ptmx and appropriate /dev/pts/N in sequence.
The result will be the following

master
`- slave 1
`- slave 2

both slave will have same master index but different file descriptors.
Still inside the kernel pty parameters are same for both slaves. Thus
only one slave parameters should be restored, there is no need to carry
all parameters for every slave peer we've found.

Not yet addressed problems:

- At moment of restore the master peer might be already closed for
  any reason so to resolve such problem we need to open a fake master
  peer with proper index and hook a slave on it, then we close
  master peer.

- Need to figure out how to deal with ttys which have some
  data in buffers not yet flushed, at moment this data will
  be simply lost during c/r

- Need to restore control terminals

- Need to fetch tty flags such as exclusive/packet-mode,
  this can't be done without kernel patching

[ avagin@:
   - ideas on contol terminals restore
   - overall code redesign and simplification
]

v4:
 - drop redundant pid from dump_chrdev
 - make sure optional fown is passed on regular ptys
 - add a comments about zeroifying termios
 - get rid of redundant empty line in files.c

v5 (by avagin@):
 - complete rework of tty image format, now we have
   two files -- tty.img and tty-info.img. The idea
   behind to reduce data being stored.

v6 (by xemul@):
 - packet mode should be set to true in image,
   until properly fetched from the kernel
 - verify image data on retrieval

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
CC: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-09-12 20:00:54 +04:00
Andrey Vagin
85b5a9243d protobuf: add ability to collect objects in a shared memory (v2)
v2: s/shcollect_image/collect_image_sh/

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-09-02 17:23:50 +04:00
Stanislav Kinsbursky
6c9396f9bd protobuf: add generic support for "bytes" field
Signed-off-by: Stanislav Kinsbursky <skinsbursky@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-21 16:27:14 +04:00
Stanislav Kinsbursky
768d88f228 protobuf: use pretty output for unix sockets
New custom specificator:

'S': output as string (unprintable characters replaced by dots)

Signed-off-by: Stanislav Kinsbursky <skinsbursky@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-21 16:27:07 +04:00
Pavel Emelyanov
712979a475 pb_show: Don't show all unknown fields as boolean
Broken by 92b6d86c.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-15 20:53:35 +04:00
Pavel Emelyanov
29f6d62a8a pb: Init fsize to make compiler happy
protobuf.c: In function ‘pb_show_msg’:
protobuf.c:384:68: error: ‘fsize’ may be used uninitialized in this function [-Werror=uninitialized]
protobuf.c:247:9: note: ‘fsize’ was declared here

The warning about 'may be uninitialized' is false -- the BUG() is a never-returning function.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-14 14:52:21 +04:00
Stanislav Kinsbursky
96b62808ff protobuf: use pretty output for inet sockets
v4:
1) Only address specificator ('A') left

New custom specificators:

'A': output as socket address

Signed-off-by: Stanislav Kinsbursky <skinsbursky@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-14 14:50:48 +04:00
Stanislav Kinsbursky
3904b402bb protobuf: "pretty" engine
v2:
1) parser updated to properly parse strings like this: "11:%x 1:%d"

Protobuf generic show function now accept a string with pretty specificators.
The string have to look like below (an example):

"0:%d 3:%u"

where numbers with colon specifies field number (the same number as in
proto-file) and "%[a-zA-Z]" specifies output format.
If pretty specificator for specified for a field, then it will be used for
output instead of generic hexidecimal view.

Signed-off-by: Stanislav Kinsbursky <skinsbursky@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-14 14:49:21 +04:00
Stanislav Kinsbursky
50ff74ffa9 protobuf: show field cleanup
Let's pass field structure to show functions. Hope, it makes the mess less
anoying...

Signed-off-by: Stanislav Kinsbursky <skinsbursky@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-14 14:47:40 +04:00
Stanislav Kinsbursky
ed9cbaf412 protobuf: field showing routine split
Will be usefull later with "pretty" show support.

Signed-off-by: Stanislav Kinsbursky <skinsbursky@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-14 14:47:03 +04:00
Stanislav Kinsbursky
92b6d86c7e protobuf: helper for show function selection introduced
Signed-off-by: Stanislav Kinsbursky <skinsbursky@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-14 14:46:49 +04:00
Stanislav Kinsbursky
f64633bd7d protobuf: service helper for show routine introduced
Signed-off-by: Stanislav Kinsbursky <skinsbursky@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-14 14:46:47 +04:00
Stanislav Kinsbursky
3f1b07f5a7 protobuf: move data pointer to field structure
Signed-off-by: Stanislav Kinsbursky <skinsbursky@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-14 14:45:47 +04:00
Stanislav Kinsbursky
ea5f645463 protobuf: structure for currently showing field introduced
"depth" variable was moved to field structure.

Signed-off-by: Stanislav Kinsbursky <skinsbursky@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-14 14:45:29 +04:00
Stanislav Kinsbursky
248a97c160 protobuf: rename type for show functions
Signed-off-by: Stanislav Kinsbursky <skinsbursky@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-14 14:45:10 +04:00
Stanislav Kinsbursky
d84dc289a7 protobuf: remove carriage return from unknown object print
Signed-off-by: Stanislav Kinsbursky <skinsbursky@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-14 14:44:55 +04:00
Stanislav Kinsbursky
691bbdad4b protobuf: change pb_pr_field_t to pointer
Signed-off-by: Stanislav Kinsbursky <skinsbursky@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-14 14:44:43 +04:00
Pavel Emelyanov
64e161f307 show: Tune protobus showers for .int(32|64)
Use # for both and don't use fixed field width for 32bit one (as they are
most likely just some values, while the 64bit is some address which is better
to be printed with full width).

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-10 07:36:20 +04:00
Pavel Emelyanov
6a9e5bbdcc show: Fix optional submessage showing
Wrong pointer was checked against NULL and default value. This resulted
in lost tc part of the core message in show output.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-09 22:40:18 +04:00
Pavel Emelyanov
242fd55a57 protobuf: Support showing bool datatype
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-09 18:12:22 +04:00
Pavel Emelyanov
fc7071d05e net: Packet sockets basic support
Support only basic packet socket functionality -- create and bind.
This should be enough to start testing dhclient inside container.
Other stuff (filter, mmaps, fanouts, etc.) will come later.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-09 16:17:41 +04:00