The following pull request was submitted through Github. It can be accessed and reviewed at: https://github.com/lxc/lxd/pull/6301
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: Stéphane Graber <stgra...@ubuntu.com>
From a7944c145dd6fcb449b6d20d95d1265e07aaea0c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgra...@ubuntu.com> Date: Wed, 9 Oct 2019 22:34:53 -0400 Subject: [PATCH] lxd/storage/ceph: Fix to work on older releases MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Stéphane Graber <stgra...@ubuntu.com> --- lxd/storage_ceph_utils.go | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/lxd/storage_ceph_utils.go b/lxd/storage_ceph_utils.go index b3c4c04f8e..ec8c7dc076 100644 --- a/lxd/storage_ceph_utils.go +++ b/lxd/storage_ceph_utils.go @@ -74,16 +74,23 @@ func cephOSDPoolDestroy(clusterName string, poolName string, userName string) er // occur. func cephRBDVolumeCreate(clusterName string, poolName string, volumeName string, volumeType string, size string, userName string, dataPoolName string) error { - _, err := shared.RunCommand( - "rbd", + cmd := []string{ "--id", userName, "--image-feature", "layering,", "--cluster", clusterName, "--pool", poolName, - "--data-pool", dataPoolName, + } + + if dataPoolName != "" { + cmd = append(cmd, "--data-pool", dataPoolName) + } + + cmd = append(cmd, "--size", size, "create", fmt.Sprintf("%s_%s", volumeType, volumeName)) + + _, err := shared.RunCommand("rbd", cmd...) return err } @@ -367,17 +374,24 @@ func cephRBDCloneCreate(sourceClusterName string, sourcePoolName string, sourceSnapshotName string, targetPoolName string, targetVolumeName string, targetVolumeType string, userName string, targetDataPoolName string) error { - _, err := shared.RunCommand( - "rbd", + cmd := []string{ "--id", userName, "--cluster", sourceClusterName, "--image-feature", "layering", - "--data-pool", targetDataPoolName, + } + + if targetDataPoolName != "" { + cmd = append(cmd, "--data-pool", targetDataPoolName) + } + + cmd = append(cmd, "clone", fmt.Sprintf("%s/%s_%s@%s", sourcePoolName, sourceVolumeType, sourceVolumeName, sourceSnapshotName), fmt.Sprintf("%s/%s_%s", targetPoolName, targetVolumeType, targetVolumeName)) + + _, err := shared.RunCommand("rbd", cmd...) if err != nil { return err }
_______________________________________________ lxc-devel mailing list lxc-devel@lists.linuxcontainers.org http://lists.linuxcontainers.org/listinfo/lxc-devel