criu/include/cr_options.h
Pavel Emelyanov 53957fadc3 restore: Introduce the --restore-sibling option
We have a slight mess with how criu restores root task.
Right now we have the following options.

1) CLI
	a) Usually
	task calling criu
	 `- criu
	     `- root restored task

	b) when --restore-detached AND root has pdeath_sig

	task calling criu
	 `- criu
	 `- root restored task

2) Library/SWRK
	task using lib/swrk
	 `- criu
	 `- root restored task

3) Standalone service
	a) Usually
	service
	 `- service sub task
	     `- root restored task

	b) when root has pdeath_sig
	criu service
	 `- criu sub task
	 `- root restored task

It would be better is CRIU always restored the root task as sibling,
but we have 3 constraints:

First, the case 1.a is kept for zdtm to run tests in pid namespaces
on 3.11, which in turn doesn't allow CLONE_PARENT | CLONE_NEWPID.

Second, CLI w/o --restore-detach waits for the restored task to die and
this behavior can be "expected" already.

Third, in case of standalone service tasks shouldn't become service's
children.

And I have one "plan". The p.haul project while live migrating tasks
on destination node starts a service, which uses library/swrk mode. In
this case the restored processes become p.haul service's kids which is
also not great.

That said, here's the option called --restore-child that pairs the
--restore-detach like this:

* detached AND child:

task
 `- criu restore (exits at the end)
 `- root task

The root task will become task's child.
This will be default to library/swrk.
This is what LXC needs.

* detach AND !child

task
 `- criu restore (exits at the end)
     `- root task

The root task will get re-parented to init.
This will be compatible with 1.3.
This will be default to standalone service and
to my wish with the p.haul case.

* !detach AND child

task
 `- criu restore (waits for root task to die)
 `- root task

This should be deprecated, so that criu restore doesn't mess
 with task <-> root task signalling.

* !detach AND !child

task
 `- criu restore (waits for root task to die)
     `- root task

This is how plain criu restore works now.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Acked-by: Tycho Andersen <tycho.andersen@canonical.com>
Acked-by: Andrew Vagin <avagin@openvz.org>
2014-09-10 18:30:30 +04:00

64 lines
1.2 KiB
C

#ifndef __CR_OPTIONS_H__
#define __CR_OPTIONS_H__
#include <stdbool.h>
#include "list.h"
/*
* CPU capability options.
*/
#define CPU_CAP_FPU (1u)
#define CPU_CAP_ALL (-1u)
struct cg_root_opt {
struct list_head node;
char *controller;
char *newroot;
};
struct cr_options {
int final_state;
char *show_dump_file;
char *show_fmt;
bool check_ms_kernel;
bool show_pages_content;
bool restore_detach;
bool restore_sibling;
bool ext_unix_sk;
bool shell_job;
bool handle_file_locks;
bool tcp_established_ok;
bool evasive_devices;
bool link_remap_ok;
unsigned int rst_namespaces_flags;
bool log_file_per_pid;
bool swrk_restore;
char *output;
char *root;
char *pidfile;
struct list_head veth_pairs;
struct list_head scripts;
struct list_head ext_mounts;
char *libdir;
bool use_page_server;
unsigned short ps_port;
char *addr;
int ps_socket;
bool track_mem;
char *img_parent;
bool auto_dedup;
unsigned int cpu_cap;
bool force_irmap;
char **exec_cmd;
bool manage_cgroups;
char *new_global_cg_root;
struct list_head new_cgroup_roots;
bool aufs; /* auto-deteced, not via cli */
};
extern struct cr_options opts;
extern void init_opts(void);
#endif /* __CR_OPTIONS_H__ */