]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
librbd: v1 clones are restricted to the same namespace 30823/head
authorJason Dillaman <dillaman@redhat.com>
Thu, 3 Oct 2019 14:03:44 +0000 (10:03 -0400)
committerJason Dillaman <dillaman@redhat.com>
Wed, 9 Oct 2019 19:51:04 +0000 (15:51 -0400)
Therefore the v1 parent spec should not attempt to populate the
namespace.

Fixes: https://tracker.ceph.com/issues/41938
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
(cherry picked from commit 547ebccaf9cbc27aeee68877cd46da7d132c078f)

qa/workunits/rbd/cli_generic.sh
src/librbd/image/AttachChildRequest.cc
src/librbd/image/DetachChildRequest.cc

index 1a46df10c5103874250c607a709eada7e5675a1e..7f44d932d9534a78bc2cc37780eb6d0ea21471d2 100755 (executable)
@@ -665,6 +665,16 @@ test_namespace() {
     rbd rm rbd/test2/image2
     rbd rm rbd/image2
 
+    # v1 clones are supported within the same namespace
+    rbd create $RBD_CREATE_ARGS --size 1G rbd/test1/image3
+    rbd snap create rbd/test1/image3@1
+    rbd snap protect rbd/test1/image3@1
+    rbd clone --rbd-default-clone-format 1 rbd/test1/image3@1 rbd/test1/image4
+    rbd rm rbd/test1/image4
+    rbd snap unprotect rbd/test1/image3@1
+    rbd snap rm rbd/test1/image3@1
+    rbd rm rbd/test1/image3
+
     rbd create $RBD_CREATE_ARGS --size 1G --namespace test1 image2
     expect_fail rbd namespace remove rbd/test1
 
index bedeeca01563720c010b60234b4f83f53b93a5d8..f3631bf37b680025eec642c98cfc7e6c05372659 100644 (file)
@@ -46,8 +46,7 @@ void AttachChildRequest<I>::v1_add_child() {
   ldout(m_cct, 15) << dendl;
 
   librados::ObjectWriteOperation op;
-  cls_client::add_child(&op, {m_parent_image_ctx->md_ctx.get_id(),
-                              m_parent_image_ctx->md_ctx.get_namespace(),
+  cls_client::add_child(&op, {m_parent_image_ctx->md_ctx.get_id(), "",
                               m_parent_image_ctx->id,
                               m_parent_snap_id}, m_image_ctx->id);
 
index 89f5c949a90534b3d6eeedd7b146894d21e5a264..5103f49d6fa5ccba203545d4088616c0e9daab0c 100644 (file)
@@ -241,6 +241,8 @@ void DetachChildRequest<I>::clone_v1_remove_child() {
   auto cct = m_image_ctx.cct;
   ldout(cct, 5) << dendl;
 
+  m_parent_spec.pool_namespace = "";
+
   librados::ObjectWriteOperation op;
   librbd::cls_client::remove_child(&op, m_parent_spec, m_image_ctx.id);