criu/protobuf
Pavel Emelyanov 0b2c951358 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:35:57 +04:00
..
cgroup.proto cg: Use relative paths in cgroup dirs image 2014-08-14 12:27:19 +04:00
core-aarch64.proto protobuf: added description of messages to store the AArch64 CPU state 2014-04-11 15:18:51 +04:00
core-arm.proto protobuf: Move arch core resources to core-$(ARCH).proto 2013-01-23 18:22:47 +04:00
core-x86.proto space-before-tab whitespace cleanup 2013-12-12 10:00:53 +04:00
core.proto protobuf: add signal_queue_entry and use it in thread_core_entry and task_core_entry 2014-08-19 13:09:43 +04:00
creds.proto proto: Align members and numbers 2014-02-07 15:40:52 +04:00
eventfd.proto protobuf: Convert eventfd data to protobuf engine 2012-07-17 07:24:54 +04:00
eventpoll.proto protobuf: Convert eventpoll data to protobuf engine 2012-07-17 07:25:40 +04:00
ext-file.proto files: add ability to set callbacks for files (v7) 2013-12-20 16:07:38 +04:00
fdinfo.proto timerfd: Add protobuf entries into the image 2014-08-06 19:18:34 +04:00
fh.proto proto: Align members and numbers 2014-02-07 15:40:52 +04:00
fifo.proto protobuf: Use FifoEntry instead of struct fifo_entry 2012-07-17 07:18:40 +04:00
file-lock.proto protobuf: add a new description for saving file-lock 2013-01-17 14:38:11 +04:00
fown.proto protobuf: Use RegFileEntry instead of reg_file_entry structure v3 2012-07-17 07:17:02 +04:00
fs.proto fs: Support umask dump/restore 2013-01-10 12:48:31 +03:00
fsnotify.proto fsnotify: fanotify -- Group objects in image 2013-01-15 23:17:57 +04:00
ghost-file.proto files: Support ghost devices 2014-07-03 13:28:56 +04:00
inventory.proto image: Add bits and pieces for cgroups image 2014-05-27 23:48:06 +04:00
ipc-desc.proto protobuf: Convert IPC entries to PB format v2 2012-07-19 11:31:39 +04:00
ipc-msg.proto protobuf: Convert IPC entries to PB format v2 2012-07-19 11:31:39 +04:00
ipc-sem.proto protobuf: Convert IPC entries to PB format v2 2012-07-19 11:31:39 +04:00
ipc-shm.proto protobuf: Convert IPC entries to PB format v2 2012-07-19 11:31:39 +04:00
ipc-var.proto protobuf: Convert IPC entries to PB format v2 2012-07-19 11:31:39 +04:00
Makefile timerfd: protobuf -- Add timerfd_entry 2014-08-06 19:18:25 +04:00
mm.proto dump: preserve the dumpable flag on criu dump/restore 2014-05-14 01:02:37 +04:00
mnt.proto Added AUFS support. 2014-08-21 18:35:22 +04:00
netdev.proto protobuf: Add EXTLINK netdevice type 2013-10-10 15:12:06 +04:00
ns.proto protobuf: Prepare scaffolds for procfs NS entries 2013-05-18 03:37:00 +04:00
packet-sock.proto proto: Align members and numbers 2014-02-07 15:40:52 +04:00
pagemap.proto proto: Align members and numbers 2014-02-07 15:40:52 +04:00
pipe-data.proto pipe: Dump and restore pipe size 2013-01-11 17:45:54 +04:00
pipe.proto protobuf: Convert pipe_entry to PB engine 2012-07-17 07:29:57 +04:00
pstree.proto protobuf: Convert pstree_entry to PB engine 2012-07-17 07:29:36 +04:00
regfile.proto files: Sanity check for reg file on restore is not corrupted 2014-06-24 23:38:48 +04:00
remap-file-path.proto protobuf: Use RemapFilePathEntry instead of struct remap_file_path_entry 2012-07-17 07:18:58 +04:00
rlimit.proto cr: Support rlimits 2013-01-10 20:08:38 +04:00
rpc.proto restore: Introduce the --restore-sibling option 2014-09-10 18:35:57 +04:00
sa.proto protobuf: Convert sa_entry to PB format 2012-07-18 16:25:06 +04:00
siginfo.proto protobuf: add signal_queue_entry and use it in thread_core_entry and task_core_entry 2014-08-19 13:09:43 +04:00
signalfd.proto signalfd: Add protobuf descriptions 2012-08-02 12:24:27 +04:00
sk-inet.proto proto: Add comments describing why we need two IDs for unix and inet sockets 2012-08-15 17:45:40 +04:00
sk-netlink.proto protobuf: add image for netlink sockets 2013-03-26 00:22:46 +04:00
sk-opts.proto sk: Rework bound-dev dump/restore according to new API 2012-11-28 20:24:42 +03:00
sk-packet.proto protobuf: Convert sk_packet_entry to PB engine 2012-07-17 08:03:43 +04:00
sk-unix.proto sk-unix: dump/restore a file permissions 2013-01-30 03:28:01 +04:00
stats.proto proto: Align members and numbers 2014-02-07 15:40:52 +04:00
tcp-stream.proto tcp: save the amount of unsent data in the socket send queue 2013-11-14 17:14:31 +04:00
timer.proto core: Move posix timers on core entry 2014-04-17 12:00:54 +04:00
timerfd.proto timerfd: protobuf -- Add timerfd_entry 2014-08-06 19:18:25 +04:00
tty.proto tty: Make termios and winsize being optional params 2012-09-14 17:50:41 +04:00
tun.proto proto: Align members and numbers 2014-02-07 15:40:52 +04:00
utsns.proto proto: Align members and numbers 2014-02-07 15:40:52 +04:00
vma.proto criu: fix filemap open permissions 2014-04-04 20:35:48 +04:00