[lxc-devel] [PATCH 1/2] c/r: use --restore-sibling option in CRIU

Tycho Andersen tycho.andersen at canonical.com
Sat Sep 13 01:05:54 UTC 2014


On Fri, Sep 12, 2014 at 11:07:14PM +0000, Serge Hallyn wrote:
> Quoting Tycho Andersen (tycho.andersen at canonical.com):
> > In order for LXC to be the parent of the restored process, CRIU needs to
> > restore init as its sibling, not as its child. This was previously accomplished
> > essentially via luck :). CRIU now has a --restore-sibling option which forces
> > this behavior that LXC expects. See more discussion in this thread:
> > http://lists.openvz.org/pipermail/criu/2014-September/thread.html#16330
> > 
> > Signed-off-by: Tycho Andersen <tycho.andersen at canonical.com>
> 
> Acked-by: Serge E. Hallyn <serge.hallyn at ubuntu.com>

After looking through some logs, it is a little cleaner to do it as
below, instead of what I originally posted.

Tycho



In order for LXC to be the parent of the restored process, CRIU needs to
restore init as its sibling, not as its child. This was previously accomplished
essentially via luck :). CRIU now has a --restore-sibling option which forces
this behavior that LXC expects. See more discussion in this thread:
http://lists.openvz.org/pipermail/criu/2014-September/thread.html#16330

v2: don't pass --restore-sibling to dump. This is mostly cosmetic, but will
    look less confusing in the logs if people ever look at them.

Signed-off-by: Tycho Andersen <tycho.andersen at canonical.com>
Acked-by: Serge E. Hallyn <serge.hallyn at ubuntu.com>
---
 src/lxc/lxccontainer.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/lxc/lxccontainer.c b/src/lxc/lxccontainer.c
index ff5167a..880055e 100644
--- a/src/lxc/lxccontainer.c
+++ b/src/lxc/lxccontainer.c
@@ -3562,8 +3562,8 @@ static void exec_criu(struct criu_opts *opts)
 		if (!opts->stop)
 			static_args++;
 	} else if (strcmp(opts->action, "restore") == 0) {
-		/* --root $(lxc_mount_point) --restore-detached --pidfile $foo */
-		static_args += 5;
+		/* --root $(lxc_mount_point) --restore-detached --restore-sibling --pidfile $foo */
+		static_args += 6;
 	} else {
 		return;
 	}
@@ -3629,6 +3629,7 @@ static void exec_criu(struct criu_opts *opts)
 		DECLARE_ARG("--root");
 		DECLARE_ARG(opts->c->lxc_conf->rootfs.mount);
 		DECLARE_ARG("--restore-detached");
+		DECLARE_ARG("--restore-sibling");
 		DECLARE_ARG("--pidfile");
 		DECLARE_ARG(opts->pidfile);
 
-- 
1.9.1



More information about the lxc-devel mailing list