[lxc-devel] [lxd/master] lxd/resources: Skip NVME multipath entries

stgraber on Github lxc-bot at linuxcontainers.org
Wed May 6 13:42:01 UTC 2020


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/20200506/33e6ff8f/attachment.bin>
-------------- next part --------------
From ef15f96b492df5c078264cb781f4592f2c9b60a8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
Date: Wed, 6 May 2020 09:41:21 -0400
Subject: [PATCH] lxd/resources: Skip NVME multipath entries
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Closes #7313

Signed-off-by: Stéphane Graber <stgraber at ubuntu.com>
---
 lxd/resources/storage.go | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/lxd/resources/storage.go b/lxd/resources/storage.go
index 5bd4dc36ed..d693441528 100644
--- a/lxd/resources/storage.go
+++ b/lxd/resources/storage.go
@@ -138,6 +138,11 @@ func GetStorage() (*api.ResourcesStorage, error) {
 			// Device node
 			diskDev, err := ioutil.ReadFile(filepath.Join(entryPath, "dev"))
 			if err != nil {
+				if os.IsNotExist(err) {
+					// This happens on multipath devices, just skip as we only care about the main node.
+					continue
+				}
+
 				return nil, errors.Wrapf(err, "Failed to read \"%s\"", filepath.Join(entryPath, "dev"))
 			}
 			disk.Device = strings.TrimSpace(string(diskDev))


More information about the lxc-devel mailing list