[lxc-devel] [lxd/master] Fix container restore with projects in Ceph
monstermunchkin on Github
lxc-bot at linuxcontainers.org
Wed Oct 9 06:33:41 UTC 2019
A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 301 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20191008/7194b897/attachment.bin>
-------------- next part --------------
From 00d060491c9745d52afb31b7a86427106d7e4ae8 Mon Sep 17 00:00:00 2001
From: Thomas Hipp <thomas.hipp at canonical.com>
Date: Wed, 9 Oct 2019 08:22:16 +0200
Subject: [PATCH 1/2] lxd: Fix container restore with projects in Ceph
This fixes container restore on Ceph when using projects.
Signed-off-by: Thomas Hipp <thomas.hipp at canonical.com>
---
lxd/storage_ceph.go | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lxd/storage_ceph.go b/lxd/storage_ceph.go
index 708b73d3c6..9f25ba1f30 100644
--- a/lxd/storage_ceph.go
+++ b/lxd/storage_ceph.go
@@ -1566,7 +1566,7 @@ func (s *storageCeph) ContainerRestore(target Instance, source Instance) error {
sourceContainerOnlyName, sourceSnapshotOnlyName, _ := shared.ContainerGetParentAndSnapshotName(sourceName)
prefixedSourceSnapOnlyName := fmt.Sprintf("snapshot_%s", sourceSnapshotOnlyName)
err = cephRBDVolumeRestore(s.ClusterName, s.OSDPoolName,
- sourceContainerOnlyName, storagePoolVolumeTypeNameContainer,
+ project.Prefix(source.Project(), sourceContainerOnlyName), storagePoolVolumeTypeNameContainer,
prefixedSourceSnapOnlyName, s.UserName)
if err != nil {
logger.Errorf(`Failed to restore RBD storage volume for container "%s" from "%s": %s`, targetName, sourceName, err)
From 07a2ab7215d62459be98180a4561b077a0023506 Mon Sep 17 00:00:00 2001
From: Thomas Hipp <thomas.hipp at canonical.com>
Date: Wed, 9 Oct 2019 08:27:49 +0200
Subject: [PATCH 2/2] test: Add container restore with projects
This adds a test for restoring a container in a project.
Signed-off-by: Thomas Hipp <thomas.hipp at canonical.com>
---
test/suites/projects.sh | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/test/suites/projects.sh b/test/suites/projects.sh
index 8a0ffcd2fe..ddccb26e35 100644
--- a/test/suites/projects.sh
+++ b/test/suites/projects.sh
@@ -180,11 +180,12 @@ test_projects_snapshots() {
# Create a container in the project
lxc init testimage c1
- # Create, rename and delete a snapshot
+ # Create, rename, restore and delete a snapshot
lxc snapshot c1
lxc info c1 | grep -q snap0
lxc config show c1/snap0 | grep -q Busybox
lxc rename c1/snap0 c1/foo
+ lxc restore c1 foo
lxc delete c1/foo
# Test copies
More information about the lxc-devel
mailing list