[lxc-devel] [lxd/master] ceph: apply template on container-only copy too

brauner on Github lxc-bot at linuxcontainers.org
Wed Sep 6 21:25:24 UTC 2017


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 364 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20170906/23171351/attachment.bin>
-------------- next part --------------
From ab0cf986e9aedcd91c6bcb20a2dd9a7e6b661523 Mon Sep 17 00:00:00 2001
From: Christian Brauner <christian.brauner at ubuntu.com>
Date: Wed, 6 Sep 2017 23:16:40 +0200
Subject: [PATCH 1/2] ceph: apply template on container-only copy too

Signed-off-by: Christian Brauner <christian.brauner at ubuntu.com>
---
 lxd/storage_ceph.go | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/lxd/storage_ceph.go b/lxd/storage_ceph.go
index fb9a5de81..6e7ef6fba 100644
--- a/lxd/storage_ceph.go
+++ b/lxd/storage_ceph.go
@@ -1138,7 +1138,7 @@ func (s *storageCeph) ContainerCopy(target container, source container,
 
 		logger.Debugf(`Copied RBD container storage %s -> %s`,
 			sourceContainerName, target.Name())
-		return nil
+		goto apply_template
 	} else {
 		logger.Debugf(`Creating non-sparse copy of RBD storage volume `+
 			`for container "%s" -> "%s" including snapshots`,
@@ -1366,6 +1366,8 @@ func (s *storageCeph) ContainerCopy(target container, source container,
 			sourceContainerName, targetContainerName)
 	}
 
+apply_template:
+
 	ourMount, err := s.ContainerMount(target)
 	if err != nil {
 		return err

From d47ff8e6d59503744ea815941a01a496d4ffe646 Mon Sep 17 00:00:00 2001
From: Christian Brauner <christian.brauner at ubuntu.com>
Date: Wed, 6 Sep 2017 23:23:18 +0200
Subject: [PATCH 2/2] ceph: set ACL on container copy

Signed-off-by: Christian Brauner <christian.brauner at ubuntu.com>
---
 lxd/storage_ceph.go | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/lxd/storage_ceph.go b/lxd/storage_ceph.go
index 6e7ef6fba..cbee2ced8 100644
--- a/lxd/storage_ceph.go
+++ b/lxd/storage_ceph.go
@@ -1376,6 +1376,11 @@ apply_template:
 		defer s.ContainerUmount(target.Name(), targetContainerMountPoint)
 	}
 
+	err = s.setUnprivUserACL(source, targetContainerMountPoint)
+	if err != nil {
+		return err
+	}
+
 	err = target.TemplateApply("copy")
 	if err != nil {
 		logger.Errorf(`Failed to apply copy template for container `+


More information about the lxc-devel mailing list