[lxc-devel] [lxd/master] Resources API tweaks

stgraber on Github lxc-bot at linuxcontainers.org
Wed Sep 30 21:30:02 UTC 2020


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 301 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20200930/16f3eff2/attachment.bin>
-------------- next part --------------
From 7d4c992dcb0dc5a20268bf57c13c88dc8e9e4df0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
Date: Wed, 30 Sep 2020 14:42:24 -0400
Subject: [PATCH 1/2] shared/api: Not all disks have a device path
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>
---
 shared/api/resource.go | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/shared/api/resource.go b/shared/api/resource.go
index 730537bdfd..edb590b7aa 100644
--- a/shared/api/resource.go
+++ b/shared/api/resource.go
@@ -253,7 +253,7 @@ type ResourcesStorageDisk struct {
 	NUMANode  uint64 `json:"numa_node" yaml:"numa_node"`
 
 	// API extension: resources_disk_sata
-	DevicePath      string `json:"device_path" yaml:"device_path"`
+	DevicePath      string `json:"device_path,omitempty" yaml:"device_path,omitempty"`
 	BlockSize       uint64 `json:"block_size" yaml:"block_size"`
 	FirmwareVersion string `json:"firmware_version,omitempty" yaml:"firmware_version,omitempty"`
 	RPM             uint64 `json:"rpm" yaml:"rpm"`

From b8e81ae1080fed777f8c64bc3a0de740da1dd70e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
Date: Wed, 30 Sep 2020 17:29:41 -0400
Subject: [PATCH 2/2] lxd/resources: Ignore rbd devices
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/resources/storage.go | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/lxd/resources/storage.go b/lxd/resources/storage.go
index c5ce8914b2..b051957f76 100644
--- a/lxd/resources/storage.go
+++ b/lxd/resources/storage.go
@@ -190,6 +190,11 @@ func GetStorage() (*api.ResourcesStorage, error) {
 				}
 
 				disk.Type = filepath.Base(diskSubsystem)
+
+				if disk.Type == "rbd" {
+					// Ignore rbd devices as they aren't local block devices.
+					continue
+				}
 			}
 
 			// Read-only


More information about the lxc-devel mailing list