[lxc-devel] [lxd/master] lxc-to-lxd: Fix lxc.rootfs parsing

stgraber on Github lxc-bot at linuxcontainers.org
Wed Aug 8 14:33:45 UTC 2018


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 370 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20180808/20e6edcd/attachment.bin>
-------------- next part --------------
From abd349546c227818eb11d012778a364b169576af Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
Date: Wed, 8 Aug 2018 10:32:04 -0400
Subject: [PATCH] lxc-to-lxd: Fix lxc.rootfs parsing
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Closes #4869

Signed-off-by: Stéphane Graber <stgraber at ubuntu.com>
---
 lxc-to-lxd/main_migrate.go | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/lxc-to-lxd/main_migrate.go b/lxc-to-lxd/main_migrate.go
index 104f191655..42fadbcdbd 100644
--- a/lxc-to-lxd/main_migrate.go
+++ b/lxc-to-lxd/main_migrate.go
@@ -591,12 +591,8 @@ func getRootfs(conf []string) (string, error) {
 		}
 	}
 
-	// XXX: ignore the first part (storage) for now
-	parts := strings.Split(value[0], ":")
+	// Get the rootfs path
+	parts := strings.SplitN(value[0], ":", 2)
 
-	if len(parts) != 2 {
-		return "", fmt.Errorf("Invalid container, invalid lxc.rootfs key")
-	}
-
-	return parts[1], nil
+	return parts[len(parts)-1], nil
 }


More information about the lxc-devel mailing list