The following pull request was submitted through Github.
It can be accessed and reviewed at: https://github.com/lxc/lxd/pull/8101

This e-mail was sent by the LXC bot, direct replies will not reach the author
unless they happen to be subscribed to this list.

=== Description (from pull-request) ===
Signed-off-by: Thomas Parrott <thomas.parr...@canonical.com>
From 92bee7be07b765539ef3db22ca9b870c405ec23f Mon Sep 17 00:00:00 2001
From: Thomas Parrott <thomas.parr...@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.parr...@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 {
_______________________________________________
lxc-devel mailing list
lxc-devel@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-devel

Reply via email to