]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
librbd: v1 clones are restricted to the same namespace 30711/head
authorJason Dillaman <dillaman@redhat.com>
Thu, 3 Oct 2019 14:03:44 +0000 (10:03 -0400)
committerJason Dillaman <dillaman@redhat.com>
Fri, 4 Oct 2019 17:27:50 +0000 (13:27 -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>
qa/workunits/rbd/cli_generic.sh
src/librbd/image/AttachChildRequest.cc
src/librbd/image/DetachChildRequest.cc

index b4b8f4774c85073fafcf6d17b53aa312548de6d4..4c3a64df98198f8f7d5a7a0d42a516e087415268 100755 (executable)
@@ -680,6 +680,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 d3920608d00c646a090750a364dd0d32b92c7cde..2f74191ed328ddf35157f94932105a48140cc8ef 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 584a359017c738efc3b79b8fe72128da6c22920b..8e4efdf7b7ac0658c05c2d97310d8e9c41b6e551 100644 (file)
@@ -326,6 +326,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);