2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-31 06:15:24 +00:00

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>
This commit is contained in:
Pavel Emelyanov
2013-04-11 17:50:42 +04:00
parent 757f9c570f
commit 60fc6abfd7
4 changed files with 43 additions and 1 deletions

View File

@@ -68,7 +68,7 @@ int main(int argc, char *argv[])
int log_inited = 0;
int log_level = 0;
static const char short_opts[] = "dsf:t:p:hcD:o:n:vxVr:jl";
static const char short_opts[] = "dsRf:t:p:hcD:o:n:vxVr:jl";
BUILD_BUG_ON(PAGE_SIZE != PAGE_IMAGE_SIZE);
@@ -90,6 +90,7 @@ int main(int argc, char *argv[])
{ "tree", required_argument, 0, 't' },
{ "pid", required_argument, 0, 'p' },
{ "leave-stopped", no_argument, 0, 's' },
{ "leave-running", no_argument, 0, 'R' },
{ "restore-detached", no_argument, 0, 'd' },
{ "contents", no_argument, 0, 'c' },
{ "file", required_argument, 0, 'f' },
@@ -113,6 +114,7 @@ int main(int argc, char *argv[])
{ "page-server", no_argument, 0, 50},
{ "address", required_argument, 0, 51},
{ "port", required_argument, 0, 52},
{ "snapshot", optional_argument, 0, 53},
{ },
};
@@ -124,6 +126,9 @@ int main(int argc, char *argv[])
case 's':
opts.final_state = TASK_STOPPED;
break;
case 'R':
opts.final_state = TASK_ALIVE;
break;
case 'x':
opts.ext_unix_sk = true;
break;
@@ -256,6 +261,10 @@ int main(int argc, char *argv[])
case 'l':
opts.handle_file_locks = true;
break;
case 53:
opts.mem_snapshot = true;
opts.snap_parent = optarg;
break;
case 'V':
pr_msg("Version: %s\n", version);
return 0;
@@ -275,6 +284,9 @@ int main(int argc, char *argv[])
return ret;
}
if (opts.mem_snapshot)
pr_info("Will do snapshot from %s\n", opts.snap_parent);
ret = open_image_dir();
if (ret < 0) {
pr_perror("can't open currect directory");
@@ -355,8 +367,10 @@ usage:
pr_msg(" -t|--tree checkpoint/restore the whole process tree identified by pid\n");
pr_msg(" -d|--restore-detached detach after restore\n");
pr_msg(" -s|--leave-stopped leave tasks in stopped state after checkpoint instead of killing them\n");
pr_msg(" -R|--leave-running leave tasks in running state after checkpoint\n");
pr_msg(" -D|--images-dir directory where to put images to\n");
pr_msg(" --pidfile [FILE] write a pid of a root task in this file\n");
pr_msg(" --snapshot <[DIR]> create snapshot (relative to DIR images if given)\n");
pr_msg("\n* Special resources support:\n");
pr_msg(" -x|--%s allow external unix connections\n", USK_EXT_PARAM);