From 547ebccaf9cbc27aeee68877cd46da7d132c078f Mon Sep 17 00:00:00 2001 From: Jason Dillaman Date: Thu, 3 Oct 2019 10:03:44 -0400 Subject: [PATCH] librbd: v1 clones are restricted to the same namespace Therefore the v1 parent spec should not attempt to populate the namespace. Fixes: https://tracker.ceph.com/issues/41938 Signed-off-by: Jason Dillaman --- qa/workunits/rbd/cli_generic.sh | 10 ++++++++++ src/librbd/image/AttachChildRequest.cc | 3 +-- src/librbd/image/DetachChildRequest.cc | 2 ++ 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/qa/workunits/rbd/cli_generic.sh b/qa/workunits/rbd/cli_generic.sh index b4b8f4774c8..4c3a64df981 100755 --- a/qa/workunits/rbd/cli_generic.sh +++ b/qa/workunits/rbd/cli_generic.sh @@ -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 diff --git a/src/librbd/image/AttachChildRequest.cc b/src/librbd/image/AttachChildRequest.cc index d3920608d00..2f74191ed32 100644 --- a/src/librbd/image/AttachChildRequest.cc +++ b/src/librbd/image/AttachChildRequest.cc @@ -46,8 +46,7 @@ void AttachChildRequest::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); diff --git a/src/librbd/image/DetachChildRequest.cc b/src/librbd/image/DetachChildRequest.cc index 584a359017c..8e4efdf7b7a 100644 --- a/src/librbd/image/DetachChildRequest.cc +++ b/src/librbd/image/DetachChildRequest.cc @@ -326,6 +326,8 @@ void DetachChildRequest::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); -- 2.39.5