[lxc-devel] [lxd/master] stateful start: start storage when necessary

tych0 on Github lxc-bot at linuxcontainers.org
Thu Oct 27 15:05:04 UTC 2016


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 631 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20161027/48fb508f/attachment.bin>
-------------- next part --------------
From 1725b044150637b8d2daffee87a4f17e57b212e5 Mon Sep 17 00:00:00 2001
From: Tycho Andersen <tycho.andersen at canonical.com>
Date: Thu, 27 Oct 2016 15:03:29 +0000
Subject: [PATCH] stateful start: start storage when necessary

Similar to 38d794806a8ca781a0ed69798c8a6e9ea8ea7a70, we need to start the
storage at the right time for stateful start and stop. In particular, the
onstart hook will start the storage for us, but we need to be sure and
start it so that we can uidshift the images.

Signed-off-by: Tycho Andersen <tycho.andersen at canonical.com>
---
 lxd/container_lxc.go | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/lxd/container_lxc.go b/lxd/container_lxc.go
index 0e453d3..c595126 100644
--- a/lxd/container_lxc.go
+++ b/lxd/container_lxc.go
@@ -3406,9 +3406,20 @@ func (c *containerLXC) Migrate(cmd uint, stateDir string, function string, stop
 		 * namespace.
 		 */
 		if !c.IsPrivileged() {
-			if err := c.IdmapSet().ShiftRootfs(stateDir); err != nil {
+			err = c.StorageStart()
+			if err != nil {
 				return err
 			}
+
+			err = c.IdmapSet().ShiftRootfs(stateDir)
+			err2 := c.StorageStop()
+			if err != nil {
+				return err
+			}
+
+			if err2 != nil {
+				return err2
+			}
 		}
 
 		configPath := filepath.Join(c.LogPath(), "lxc.conf")


More information about the lxc-devel mailing list