The following pull request was submitted through Github. It can be accessed and reviewed at: https://github.com/lxc/lxd/pull/2006
This e-mail was sent by the LXC bot, direct replies will not reach the author unless they happen to be subscribed to this list. === Description (from pull-request) === In particular, stateful stop/snapshot didn't have a check. Signed-off-by: Tycho Andersen <tycho.ander...@canonical.com>
From d73d0bb26c76fe31fb33332da5593cbd76704cf2 Mon Sep 17 00:00:00 2001 From: Tycho Andersen <tycho.ander...@canonical.com> Date: Mon, 9 May 2016 08:09:45 -0600 Subject: [PATCH] add more checks for the criu binary In particular, stateful stop/snapshot didn't have a check. Signed-off-by: Tycho Andersen <tycho.ander...@canonical.com> --- lxd/container.go | 4 ++++ lxd/container_lxc.go | 17 +++++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/lxd/container.go b/lxd/container.go index 51524ab..9c196ca 100644 --- a/lxd/container.go +++ b/lxd/container.go @@ -507,6 +507,10 @@ func containerCreateAsSnapshot(d *Daemon, args containerArgs, sourceContainer co return nil, fmt.Errorf("Container not running, cannot do stateful snapshot") } + if err := findCriu("snapshot"); err != nil { + return nil, err + } + stateDir := sourceContainer.StatePath() err := os.MkdirAll(stateDir, 0700) if err != nil { diff --git a/lxd/container_lxc.go b/lxd/container_lxc.go index 8672394..6aa3510 100644 --- a/lxd/container_lxc.go +++ b/lxd/container_lxc.go @@ -1134,6 +1134,10 @@ func (c *containerLXC) Start(stateful bool) error { return fmt.Errorf("Container has no existing state to restore.") } + if err := findCriu("snapshot"); err != nil { + return err + } + if !c.IsPrivileged() { if err := c.IdmapSet().ShiftRootfs(c.StatePath()); err != nil { return err @@ -1344,6 +1348,10 @@ func (c *containerLXC) setupStopping() *sync.WaitGroup { func (c *containerLXC) Stop(stateful bool) error { // Handle stateful stop if stateful { + if err := findCriu("snapshot"); err != nil { + return err + } + // Cleanup any existing state stateDir := c.StatePath() os.RemoveAll(stateDir) @@ -1676,6 +1684,15 @@ func (c *containerLXC) Restore(sourceContainer container) error { return err } + /* let's also check for CRIU if necessary, before doing a bunch of + * filesystem manipulations + */ + if shared.PathExists(c.StatePath()) { + if err := findCriu("snapshot"); err != nil { + return err + } + } + // Stop the container wasRunning := false if c.IsRunning() {
_______________________________________________ lxc-devel mailing list lxc-devel@lists.linuxcontainers.org http://lists.linuxcontainers.org/listinfo/lxc-devel