[lxc-devel] [lxd/master] lxd/device/utils: Do not add the Ceph mon port if already present in /etc/ceph config file

leopaul36 on Github lxc-bot at linuxcontainers.org
Thu Apr 23 14:53:17 UTC 2020


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 1134 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20200423/ba0c0ba5/attachment.bin>
-------------- next part --------------
From 067cce78cd3eeab97a4926a6ead2eed58a5af7c6 Mon Sep 17 00:00:00 2001
From: Leo Schoukroun <leopaul36 at yahoo.fr>
Date: Thu, 23 Apr 2020 14:25:18 +0200
Subject: [PATCH 1/2] lxd/device/utils: Fix Ceph typo

---
 lxd/device/device_utils_disk.go | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lxd/device/device_utils_disk.go b/lxd/device/device_utils_disk.go
index 9047d62446..c5aeb05dd1 100644
--- a/lxd/device/device_utils_disk.go
+++ b/lxd/device/device_utils_disk.go
@@ -207,7 +207,7 @@ func cephFsConfig(clusterName string, userName string) ([]string, string, error)
 	}
 
 	if len(cephMon) == 0 {
-		return nil, "", fmt.Errorf("Couldn't find a CPEH mon")
+		return nil, "", fmt.Errorf("Couldn't find a CEPH mon")
 	}
 
 	// Parse the CEPH keyring

From 53e7efc68b6b7e9df2c42d4b864b1a8b0f1cd527 Mon Sep 17 00:00:00 2001
From: Leo Schoukroun <leopaul36 at yahoo.fr>
Date: Thu, 23 Apr 2020 16:45:44 +0200
Subject: [PATCH 2/2] lxd/device/utils: Do not add the Ceph mon port if already
 present in /etc/ceph config file

---
 lxd/device/device_utils_disk.go | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/lxd/device/device_utils_disk.go b/lxd/device/device_utils_disk.go
index c5aeb05dd1..b79912873e 100644
--- a/lxd/device/device_utils_disk.go
+++ b/lxd/device/device_utils_disk.go
@@ -256,7 +256,12 @@ func diskCephfsOptions(clusterName string, userName string, fsName string, fsPat
 	fsOptions := fmt.Sprintf("name=%v,secret=%v,mds_namespace=%v", userName, secret, fsName)
 	srcpath := ""
 	for _, monAddress := range monAddresses {
-		srcpath += fmt.Sprintf("%s:6789,", monAddress)
+		// Add the default port to the mon hosts if not already provided
+		if strings.Contains(monAddress, ":6789") {
+        srcpath += fmt.Sprintf("%s,", monAddress)
+    } else {
+        srcpath += fmt.Sprintf("%s:6789,", monAddress)
+    }
 	}
 	srcpath = srcpath[:len(srcpath)-1]
 	srcpath += fmt.Sprintf(":/%s", fsPath)


More information about the lxc-devel mailing list