[lxc-devel] [lxd/master] lxd/db: Fix premature failure when listing cluster volumes
monstermunchkin on Github
lxc-bot at linuxcontainers.org
Mon Aug 10 11:58:36 UTC 2020
A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 464 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20200810/6e6c5bac/attachment.bin>
-------------- next part --------------
From 852c622d8b69fa7dd1880376eba39509f0cd54b1 Mon Sep 17 00:00:00 2001
From: Thomas Hipp <thomas.hipp at canonical.com>
Date: Mon, 10 Aug 2020 13:56:55 +0200
Subject: [PATCH] lxd/db: Fix premature failure when listing cluster volumes
This fixes a bug in which volumes wouldn't be listed at all if one of
the nodes didn't have any volumes.
Signed-off-by: Thomas Hipp <thomas.hipp at canonical.com>
---
lxd/db/storage_volumes.go | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/lxd/db/storage_volumes.go b/lxd/db/storage_volumes.go
index 85a045c249..0111600631 100644
--- a/lxd/db/storage_volumes.go
+++ b/lxd/db/storage_volumes.go
@@ -106,6 +106,10 @@ SELECT DISTINCT node_id
for _, nodeID := range nodeIDs {
nodeVolumes, err := c.storagePoolVolumesGet(project, poolID, int64(nodeID), volumeTypes)
if err != nil {
+ if err == ErrNoSuchObject {
+ continue
+ }
+
return nil, err
}
volumes = append(volumes, nodeVolumes...)
More information about the lxc-devel
mailing list