[lxc-devel] [lxd/master] zfs: Simplify device tracking logic

stgraber on Github lxc-bot at linuxcontainers.org
Wed Jan 25 18:07:04 UTC 2017


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 354 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20170125/a4fa8257/attachment.bin>
-------------- next part --------------
From 20073b196c2291dd38176a14e7397c21d8ba8c3f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
Date: Wed, 25 Jan 2017 13:06:27 -0500
Subject: [PATCH] zfs: Simplify device tracking logic
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

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

diff --git a/lxd/devices.go b/lxd/devices.go
index a21808d..238863f 100644
--- a/lxd/devices.go
+++ b/lxd/devices.go
@@ -1071,7 +1071,7 @@ func deviceGetParentBlocks(path string) ([]string, error) {
 		// Accessible zfs filesystems
 		poolName := strings.Split(device[1], "/")[0]
 
-		output, err := exec.Command("zpool", "status", poolName).CombinedOutput()
+		output, err := exec.Command("zpool", "status", "-P", "-L", poolName).CombinedOutput()
 		if err != nil {
 			return nil, fmt.Errorf("Failed to query zfs filesystem information for %s: %s", device[1], output)
 		}
@@ -1106,12 +1106,6 @@ func deviceGetParentBlocks(path string) ([]string, error) {
 						devices = append(devices, dev)
 					}
 				}
-			} else if deviceIsBlockdev(fmt.Sprintf("/dev/%s", fields[0])) {
-				path = fmt.Sprintf("/dev/%s", fields[0])
-			} else if deviceIsBlockdev(fmt.Sprintf("/dev/disk/by-id/%s", fields[0])) {
-				path = fmt.Sprintf("/dev/disk/by-id/%s", fields[0])
-			} else if deviceIsBlockdev(fmt.Sprintf("/dev/mapper/%s", fields[0])) {
-				path = fmt.Sprintf("/dev/mapper/%s", fields[0])
 			} else {
 				continue
 			}


More information about the lxc-devel mailing list