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

207 Commits

Author SHA1 Message Date
Andrey Vagin
d7cf271ed4 crtools: preload libraries (v2)
Libraries (plugins) is going to be used for dumping and restoring
external dependencies (e.g. dbus, systemd journal sockets, charecter
devices, etc)

A plugin can have the cr_plugin_init() and cr_plugin_fini functions for
initialization and deinialization.

criu-plugin.h contains all things, which can be used in plugins.

v2: rename lib to plugin
v3: add a default value for a plugin path.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-12-19 21:48:33 +04:00
Tikhomirov Pavel
4904878258 v3 deduplication: add auto-dedup option
Signed-off-by: Tikhomirov Pavel <snorcht@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-12-18 14:51:47 +04:00
Tikhomirov Pavel
ea403c7a08 v3 deduplication: add dedup comand to criu
Signed-off-by: Tikhomirov Pavel <snorcht@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-12-18 14:51:22 +04:00
Pavel Emelyanov
5535e44dac crtools: Keep cr_dump_task's post-dump ret code
Broken by 09b7b57c.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-12-13 14:32:18 +04:00
Kir Kolyshkin
078465859b criu --help: improve --work-dir description
There should either be a comma before the second line, or it should be
in parenthesis. I chose latter.

Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-12-13 13:37:42 +04:00
Kir Kolyshkin
37e1ed1345 criu --help: add missing colon
Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-12-13 13:37:34 +04:00
Kir Kolyshkin
195d8f81d0 criu --help: rephrase --pidfile description
... to fit in a single line.

Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-12-13 13:37:29 +04:00
Kir Kolyshkin
f2ec7be125 criu --help: limit output to 80 columns
...by rephrasing the --work-dir option description.

Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-12-13 13:37:20 +04:00
Kir Kolyshkin
09b7b57c83 criu: don't return negative values from main() 2/2
We should return 1 not -1, because -1 becomes 255.

This is second part, patching return from functions.
Using 'ret != 0' condition seems like the best and easiest
thing to do, so we expect a function to return 0 in normal
case and any non-zero value in case of error.

Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-12-13 13:36:33 +04:00
Kir Kolyshkin
f59326aba6 criu: don't return negative values from main() 1/2
We should return 1 not -1, because -1 becomes 255.

>From man bash: "the shell may use values above
125 specially". Don't be a black sheep and return 1.

This is first part, patching obvious direct return statements.

Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-12-13 13:36:27 +04:00
Ruslan Kuprieiev
9ccbf1bcc8 v2 crtools: init log after changing directory to work_dir
After set of patches which add --work-dir option we have an issue: logs are created relatively
to current dir and not relatively to images dir(which is work dir, when --work-dir is not given).
To solve this lets init log after chdir(work_dir)

Signed-off-by: Ruslan Kuprieiev <kupruser@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-11-19 22:50:20 +04:00
Pavel Emelyanov
5d4824fff0 crtools: Fix help text according to new -W option
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-11-15 21:51:19 +04:00
Ruslan Kuprieiev
482b30666f crtools: chdir to work directory
Signed-off-by: Ruslan Kuprieiev <kupruser@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-11-15 21:38:42 +04:00
Ruslan Kuprieiev
127637bc49 image: add dir parameter to open_image_dir()
Signed-off-by: Ruslan Kuprieiev <kupruser@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-11-15 21:38:40 +04:00
Ruslan Kuprieiev
555c8acd4d crtools: add --work-dir(-W) option
Signed-off-by: Ruslan Kuprieiev <kupruser@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-11-15 21:38:39 +04:00
Ruslan Kuprieiev
401680e85b crtools: init logfile after processing all command line arguments
I see no need now to init log during processing of command line arguments.

Signed-off-by: Ruslan Kuprieiev <kupruser@gmail.com>
Acked-by: Andrew Vagin <avagin@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-11-11 16:03:38 +04:00
Andrey Vagin
4850fd94a8 crtools: move cr_options in a separate header
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-11-06 18:17:52 +04:00
Ruslan Kuprieiev
fdbedf5a88 crtools: add init_opts()
Signed-off-by: Ruslan Kuprieiev <kupruser@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-10-31 20:00:04 +04:00
Cyrill Gorcunov
fa73b3e799 crtools: Use -o argument directly
There is no much point to strdup this value
obtained from command line. It sits in environment
and we don't modify it at all.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-10-10 11:11:05 +04:00
Cyrill Gorcunov
249ee5f797 crtools: Print error message with capital letter
We usually print error messages starting with capital letter.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-10-09 17:18:23 +04:00
Pavel Emelyanov
b4c8c5ae32 security: Also save gid of user requesting for C/R
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-09-28 15:51:09 +04:00
Ruslan Kuprieiev
547d9bf959 v2 security: set suid flag on crtools and check real uid on dump/restore
v2: remove redundant functions and variables.

Signed-off-by: Ruslan Kuprieiev <kupruser@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-10-02 17:11:17 +04:00
Pavel Emelyanov
8708c2d2db help: Add info about --pidfile works for service and page-server
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-09-24 11:33:36 +04:00
Cyrill Gorcunov
551cd03290 version: Print git id if present
If criu is built from git repo print git commit id, convenient for debug.

For example

 | $ ./criu -V
 | Version: 0.7
 | GitID: 7985251

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-09-14 15:01:32 +04:00
Cyrill Gorcunov
5006ed5f7c version: Define version as a macro
Defining it as static char is a bad idea especially
if it get included and never used -- we will get
"unused" variable error.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-09-14 15:00:17 +04:00
Andrey Vagin
5aa409afcf crtools: handle -vv..vv propertly
-vv...v must increase logging level on a number of the 'v' symbols.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-09-14 14:58:23 +04:00
Ruslan Kuprieiev
8fddfd2ff4 crtools: Add cr_service meat
The need in service is described at http://criu.org/Self_dump

Signed-off-by: Ruslan Kuprieiev <kupruser@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-09-13 15:53:06 +04:00
Ruslan Kuprieiev
eb79300dfd crtools: initial skeleton for cr_service
The criu service is a daemon, that opens a unix socket and listens for
incoming requests. The requests will be declared in protobuf/rpc.proto
and for now will only contain the 'dump' request.

Signed-off-by: Ruslan Kuprieiev <kupruser@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-09-13 15:50:39 +04:00
Pavel Emelyanov
7f9302505c page-server: Convert opts.addr into char *
We'll have --address argument reused for library, so make this
abstract address, not ipv4 one.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-08-11 12:01:14 +04:00
Pavel Emelyanov
1480708900 crtools: Fix -v option to conform to common sense
The -v option is declared as "optional argument" and thus
only -v=N or -vN are valid. Currently used -v N syntax no
longer works as expected, this will be treated as LOG_ERR
level (single -v) with dangling (unparsed) argument.

Sorry for that :( but it's better to this earlier.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-06-11 20:12:03 +04:00
Pavel Emelyanov
6bf22f8c75 crtools: Get rid of on-stack cr_options
We have global instance of them, that's enough.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-05-28 21:11:13 +04:00
Andrey Vagin
b2846be8c3 page-server: introduce the --daemon long option
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-05-20 19:11:19 +04:00
Andrey Vagin
4f1d2a1005 page-server: allow to execute page-server in the background (v2)
page-server creates a listen socket and only then goes into the
background, so we can be sure, that page-server is ready for work after
detaching.

v2: call daemon() in a proper place and reuse the option -d

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-05-20 15:00:40 +04:00
Pavel Emelyanov
94722c2e35 help: Add message about "unknown command"
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-05-15 14:42:51 +04:00
Pavel Emelyanov
b7639611f7 help: Add \n after page-server line in synopsis
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-05-15 14:42:08 +04:00
Pavel Emelyanov
605f31d704 help: Move --page-server option in help text
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-05-15 14:41:43 +04:00
Kir Kolyshkin
ef5ef1078c criu --help: add pre-dump to synopsys
Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-05-15 00:53:50 +04:00
Kir Kolyshkin
321de44986 criu --help: fix -D description
-D is used for dump and restore, i.e. to read and write image files,
depending on the command, so let's put a read/write-neutral description.

Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-05-15 00:53:17 +04:00
Kir Kolyshkin
f0cbd3e193 criu --help: PID is not used for restore command
A couple of fixes related to the fact.

This is an addition to commit 43ce038

Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-05-15 00:53:07 +04:00
Kir Kolyshkin
2785c8bbd2 criu --help: add page-server command to synopsys
Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-05-15 00:52:50 +04:00
Kir Kolyshkin
b13494b9fc criu --help: don't use argv[0], print help in one call
This patch

1. Replaces using argv[0] with criu literal. Using argv[0] is bad
because it can be a relative path, and it can be not "criu" but
say a symlink pointing to criu.

2. Reformats the source to print basic help test in justone call to
pr_msg(), same as commit 6ea0e00 did for extended help, for same
reasons: having it this way is easier to do further edits.

Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-05-15 00:52:40 +04:00
Pavel Emelyanov
d71d17c983 help: Document memory snapshotting options
Now they seem to look OK.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-05-14 12:11:51 +04:00
Pavel Emelyanov
a533820b7e dump: Introduce the pre-dump action
With this action criu will seize tasks, grab all its memory into
page-pipes, rest dirty tracker and will then release them. Writing
the memory from page-pipes would occur after tasks are unfreezed
and thus the frozen time should become reasonably small.

When pre-dump is in action, the dirty tracking is forcedly turned
off as well as tasks are resumed afterwards, not killed, by default.

This is a prerequisite for iterative migration.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-05-14 12:00:40 +04:00
Pavel Emelyanov
d416e6a135 mem-snap: Redefine CLI options for mem snapshot
They are not documented, thus OK for now. Two options --
* one to specify where the parent images are
* one to reset dirty memory tracking

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-05-14 11:04:57 +04:00
Pavel Emelyanov
d7e547dfb7 cr: Remove opts argument from cr_dump_tasks
Options are collected in global variable, no need to have them on stack.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-05-13 14:08:55 +04:00
Pavel Emelyanov
55c8f3cc7f crtools: Sanitize "action" (argv[1]) parsing
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-05-08 14:23:22 +04:00
Kir Kolyshkin
43ce038e6e criu dump: don't require -t
and warn if it is used.

v2: fix help text as well

Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-05-08 13:41:42 +04:00
Kir Kolyshkin
8f6d82288c criu --help: reformat -v description
Let's save 4 lines of output and put -vvv at the same line as -v 3.

Also, -v argument is in fact option, so mark it as such: [NUM]

Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-05-02 22:48:15 +04:00
Kir Kolyshkin
02bcb974a1 criu --help: fit to 80 columns
From where I stand, any help output that exceeds 80 columns is hardly
readable, so let's try to fit into that.

Apparently in many cases we can do that by removing some extra info
which, I guess, belongs to documentation or wiki but not to --help
output which should be just a short reference.

For this reason, this patch also removes information about environmental
variable set for external scripts -- such documentation does not belong
here.

Please review carefully to make sure I haven't thrown the baby out
with the bathwater.

Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-05-02 22:48:14 +04:00
Kir Kolyshkin
dd49705b4e criu --help: minor cleanups
1. "written in file" -> "written to file"

2. "relative path is relative" -> "path is relative"

3. "each restored processes is written to the FILE.pid file\n" ->
   "log of each restored process is written to a separate FILE.pid file"

Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-05-02 22:48:13 +04:00