[lxc-devel] [lxd/master] lxd/cluster: Fix attaching CEPH custom volumes

stgraber on Github lxc-bot at linuxcontainers.org
Tue Jul 10 03:34:35 UTC 2018


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/20180710/554fd0d7/attachment.bin>
-------------- next part --------------
From 53ab47de6670e6140003f4ae8d30bedcda47e887 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
Date: Mon, 9 Jul 2018 23:33:21 -0400
Subject: [PATCH] lxd/cluster: Fix attaching CEPH custom volumes
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Closes #4736

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

diff --git a/lxd/cluster/connect.go b/lxd/cluster/connect.go
index c31b6001a..e95312247 100644
--- a/lxd/cluster/connect.go
+++ b/lxd/cluster/connect.go
@@ -73,6 +73,20 @@ func ConnectIfVolumeIsRemote(cluster *db.Cluster, poolID int64, volumeName strin
 	}
 
 	if len(addresses) > 1 {
+		var driver string
+		err := cluster.Transaction(func(tx *db.ClusterTx) error {
+			var err error
+			driver, err = tx.StoragePoolDriver(poolID)
+			return err
+		})
+		if err != nil {
+			return nil, err
+		}
+
+		if driver == "ceph" {
+			return nil, nil
+		}
+
 		return nil, fmt.Errorf("more than one node has a volume named %s", volumeName)
 	}
 
@@ -80,6 +94,7 @@ func ConnectIfVolumeIsRemote(cluster *db.Cluster, poolID int64, volumeName strin
 	if address == "" {
 		return nil, nil
 	}
+
 	return Connect(address, cert, false)
 }
 


More information about the lxc-devel mailing list