[lxc-devel] [lxd/master] lxd/storage/zfs: Fix pool import

stgraber on Github lxc-bot at linuxcontainers.org
Thu Nov 28 17:45:03 UTC 2019


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/20191128/c5e8b8ce/attachment.bin>
-------------- next part --------------
From 6a94f9138562102626680363fcc000c4b702e2d0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
Date: Thu, 28 Nov 2019 12:43:57 -0500
Subject: [PATCH] lxd/storage/zfs: Fix pool import
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Closes #6523

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

diff --git a/lxd/storage_zfs.go b/lxd/storage_zfs.go
index 1692a3be23..05f5ebadce 100644
--- a/lxd/storage_zfs.go
+++ b/lxd/storage_zfs.go
@@ -118,16 +118,15 @@ func (s *storageZfs) StoragePoolCheck() error {
 	logger.Debugf("ZFS storage pool \"%s\" does not exist, trying to import it", poolName)
 
 	var err error
-	var msg string
 	if filepath.IsAbs(source) {
 		disksPath := shared.VarPath("disks")
-		msg, err = shared.RunCommand("zpool", "import", "-d", disksPath, poolName)
+		_, err = shared.RunCommand("zpool", "import", "-f", "-d", disksPath, poolName)
 	} else {
-		msg, err = shared.RunCommand("zpool", "import", purePoolName)
+		_, err = shared.RunCommand("zpool", "import", purePoolName)
 	}
 
 	if err != nil {
-		return fmt.Errorf("ZFS storage pool \"%s\" could not be imported: %s", poolName, msg)
+		return fmt.Errorf("ZFS storage pool \"%s\" could not be imported: %s", poolName, err)
 	}
 
 	logger.Debugf("ZFS storage pool \"%s\" successfully imported", poolName)


More information about the lxc-devel mailing list