[lxc-devel] [lxd/stable-4.0] lxd/cluster/connect: Adds workaround for remote storage pool volumes using old schema in ConnectIfVolumeIsRemote
tomponline on Github
lxc-bot at linuxcontainers.org
Fri Oct 30 11:53:07 UTC 2020
A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 361 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20201030/c3d3ec46/attachment.bin>
-------------- next part --------------
From 92bee7be07b765539ef3db22ca9b870c405ec23f Mon Sep 17 00:00:00 2001
From: Thomas Parrott <thomas.parrott at canonical.com>
Date: Fri, 30 Oct 2020 11:51:40 +0000
Subject: [PATCH] lxd/cluster/connect: Adds workaround for remote storage pool
volumes using old schema in ConnectIfVolumeIsRemote
Signed-off-by: Thomas Parrott <thomas.parrott at canonical.com>
---
lxd/cluster/connect.go | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/lxd/cluster/connect.go b/lxd/cluster/connect.go
index 335341b022..8d81a11011 100644
--- a/lxd/cluster/connect.go
+++ b/lxd/cluster/connect.go
@@ -137,6 +137,23 @@ func ConnectIfVolumeIsRemote(s *state.State, poolName string, projectName string
return err
}
+ addressesCount := len(addresses)
+ if addressesCount > 1 {
+ clusterMemberCount, err := tx.GetNodesCount()
+ if err != nil {
+ return err
+ }
+
+ // Earlier schema versions created a volume DB record associated to each node in the
+ // cluster for remote storage pools, so if the address count equals the cluster member
+ // count then we take this to mean that the volume doesn't have an explicit cluster member
+ // and is therefore equivalent to db.ErrNoClusterMember that is used in newer schemas where
+ // a single remote volume DB record is created that is not associated to any single member.
+ if addressesCount == clusterMemberCount {
+ return db.ErrNoClusterMember
+ }
+ }
+
return nil
})
if err != nil && err != db.ErrNoClusterMember {
More information about the lxc-devel
mailing list