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

220 Commits

Author SHA1 Message Date
Tikhomirov Pavel
acf62d7b95 deduplication: add --auto-dedup option description
Signed-off-by: Tikhomirov Pavel <snorcht@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-02-21 23:39:31 +04:00
Pavel Emelyanov
01e88d1c87 rpc: Add ability to specify veth pairs (--veth-pair option)
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-02-12 00:33:02 +04:00
Pavel Emelyanov
49b427b721 log: Don't override -v0 with -v2
If we specify log level to none (0) the result is LOG_INFO (2).

Acked-by: Andrew Vagin <avagin@parallels.com>
Acked-by: Kir Kolyshkin <kir@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-02-04 20:54:25 +04:00
Pavel Emelyanov
f200b7a990 page-server: Start using new cr_daemon routine
After this the called of cr_page_server gets controll
back with the server's pid.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-01-30 15:58:43 +04:00
Pavel Emelyanov
040fe7712f pre-dump: Enforce track-mem and leave-running in cr_pre_dump_tasks
Service will call the pre-dump routine, so this is factoring out
enforcin options for CLI and RPC.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-01-30 15:58:39 +04:00
Kir Kolyshkin
5f9b8794e0 log: only print timestamps when verbosity increased
While timestamps can be handy, they clutter output for normal users.
Let's print them only when verbosity (-v) is increased from default.
Currently, default is 2 (-vv) so for timestamps one should use -vvv
or -v3.

Alternatively, we could introduce a separate --timestamps option.
Personally, I find it more handy for timestamps to be tied to log level.

Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-01-11 09:18:03 +04:00
Kir Kolyshkin
81ee51f0e8 criu --help, Doc/criu.txt: fix -v option description
Current description of -v[vvv] was taken from criu-log.h comments
and describes specific log levels used by pr_* functions. The problem
is -vX includes all previous X-1, X-2... levels. Say, -vvvv description
says "debug only", while in fact it is not "only". Fix accordingly.

Also, removed -v0 description as it is useless. What -v0 in fact does is
it sets the log level to default -- same as if -vXXX is not used.

In addition, change a delimiter between option alternatives from comma
to a vertical bar in criu --help output, to be in line with the rest
of usage output.

Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-01-11 09:17:34 +04:00
Kir Kolyshkin
7e3b9079d5 criu: don't show long usage in case of error
* Don't show long usage in case of usage error, otherwise an actual
  error message will be lost in long output.

* Print error if command is not specified.

* Return 0 if criu --help is used.

Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-01-11 09:15:43 +04:00
Kir Kolyshkin
5d12a116f1 criu: unify invalid usage error messages
* Make "invalid usage" type messages uniform
* Use pr_msg() not pr_err(), as we don't want to clutter output
  with useless information like (crtools.c:123).

Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-01-11 09:15:32 +04:00
Kir Kolyshkin
946a585273 criu: unify/improve bad argument messages
* Introduce a generic way to report that option argument is invalid
* Switch to using it from existing places
  (options --veth-pair, --port, -n)
* Check for invalid argument of -p and -t and report it.

Notes:

1) In order to correctly print long option name in case it was used
   instead of a short one, I had to move "struct option long_opts"
   to main() context, this is why the patch is so long.

2) pr_msg() (rather than pr_err()) is used to print errors, otherwise
   it is prefixed with that (crtools.c:123) prefix which makes it
   look weird.

3) Usage is not shown in case of error, otherwise an error message
   is lost in output.

Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-01-11 09:15:25 +04:00
Kir Kolyshkin
8c0feee253 main(): don't dupe open_image_dir() error message
In case open_image_dir() fails, it prints an error why,
so there is no need to print it one more time.

Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-01-11 09:15:04 +04:00
Pavel Emelyanov
7ab8a3261b show: Implement simple images filtering
The -F|--fields option specifies which fields (by name, comma
separated) should be printed.

For nested fields all names in path should be specified.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-12-27 15:58:27 +04:00
Pavel Emelyanov
a5559cbd70 plugins: Don't strdup libdir arg
It's not freed anywhere. Makes code look simpler.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-12-26 11:08:54 +04:00
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