]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rbd: Use user snapshot namespace in rbd_mirror for now
authorVictor Denisov <denisovenator@gmail.com>
Wed, 21 Sep 2016 04:36:26 +0000 (21:36 -0700)
committerVictor Denisov <denisovenator@gmail.com>
Sat, 22 Oct 2016 03:53:24 +0000 (20:53 -0700)
Signed-off-by: Victor Denisov <denisovenator@gmail.com>
14 files changed:
src/test/rbd_mirror/image_replayer/test_mock_CreateImageRequest.cc
src/test/rbd_mirror/image_replayer/test_mock_EventPreprocessor.cc
src/test/rbd_mirror/image_sync/test_mock_SnapshotCopyRequest.cc
src/test/rbd_mirror/image_sync/test_mock_SnapshotCreateRequest.cc
src/test/rbd_mirror/image_sync/test_mock_SyncPointCreateRequest.cc
src/test/rbd_mirror/test_ImageDeleter.cc
src/test/rbd_mirror/test_ImageReplayer.cc
src/test/rbd_mirror/test_PoolWatcher.cc
src/test/rbd_mirror/test_fixture.cc
src/tools/rbd_mirror/image_sync/SnapshotCopyRequest.cc
src/tools/rbd_mirror/image_sync/SnapshotCopyRequest.h
src/tools/rbd_mirror/image_sync/SnapshotCreateRequest.cc
src/tools/rbd_mirror/image_sync/SnapshotCreateRequest.h
src/tools/rbd_mirror/image_sync/SyncPointCreateRequest.cc

index e4bee3cec7851c128ec271d6fb324d92b1be61e2..f00c113aa7952f2f4aedb057fad516a7a0f4d458 100644 (file)
@@ -216,7 +216,8 @@ public:
                                                    "", "", m_remote_io_ctx,
                                                     false);
       ictx->state->open();
-      EXPECT_EQ(0, ictx->operations->snap_create(snap_name.c_str()));
+      EXPECT_EQ(0, ictx->operations->snap_create(snap_name.c_str(),
+                                                cls::rbd::UserSnapshotNamespace()));
       EXPECT_EQ(0, ictx->operations->snap_protect(snap_name.c_str()));
       ictx->state->close();
     }
index ca1be6f3e9d51fdbfc5c221ca8fe18f135d04182..7dd96f95871f7ce888780ad7343d4fc5d8285399 100644 (file)
@@ -120,7 +120,7 @@ TEST_F(TestMockImageReplayerEventPreprocessor, PreprocessSnapMapPrune) {
   expect_update_client(mock_remote_journaler, 0);
 
   mock_local_image_ctx.snap_info = {
-    {6, librbd::SnapInfo{"snap", 0U, {}, 0U, 0U}}};
+    {6, librbd::SnapInfo{"snap", cls::rbd::UserSnapshotNamespace(), 0U, {}, 0U, 0U}}};
   m_client_meta.snap_seqs = {{1, 2}, {3, 4}, {5, 6}};
   MockEventPreprocessor event_preprocessor(mock_local_image_ctx,
                                            mock_remote_journaler,
@@ -146,7 +146,7 @@ TEST_F(TestMockImageReplayerEventPreprocessor, PreprocessSnapRename) {
 
   mock_local_image_ctx.snap_ids = {{"snap", 6}};
   mock_local_image_ctx.snap_info = {
-    {6, librbd::SnapInfo{"snap", 0U, {}, 0U, 0U}}};
+    {6, librbd::SnapInfo{"snap", cls::rbd::UserSnapshotNamespace(), 0U, {}, 0U, 0U}}};
   MockEventPreprocessor event_preprocessor(mock_local_image_ctx,
                                            mock_remote_journaler,
                                            "local mirror uuid",
@@ -197,7 +197,7 @@ TEST_F(TestMockImageReplayerEventPreprocessor, PreprocessSnapRenameKnown) {
   expect_image_refresh(mock_local_image_ctx, 0);
 
   mock_local_image_ctx.snap_info = {
-    {6, librbd::SnapInfo{"snap", 0U, {}, 0U, 0U}}};
+    {6, librbd::SnapInfo{"snap", cls::rbd::UserSnapshotNamespace(), 0U, {}, 0U, 0U}}};
   m_client_meta.snap_seqs = {{5, 6}};
   MockEventPreprocessor event_preprocessor(mock_local_image_ctx,
                                            mock_remote_journaler,
@@ -246,7 +246,7 @@ TEST_F(TestMockImageReplayerEventPreprocessor, PreprocessClientUpdateError) {
 
   mock_local_image_ctx.snap_ids = {{"snap", 6}};
   mock_local_image_ctx.snap_info = {
-    {6, librbd::SnapInfo{"snap", 0U, {}, 0U, 0U}}};
+    {6, librbd::SnapInfo{"snap", cls::rbd::UserSnapshotNamespace(), 0U, {}, 0U, 0U}}};
   MockEventPreprocessor event_preprocessor(mock_local_image_ctx,
                                            mock_remote_journaler,
                                            "local mirror uuid",
index 2fd026a7c5f663307db5c212d5442cb3d0892721..a962f5a8e80a409ba38b99b96b930c6a71fd920d 100644 (file)
@@ -45,6 +45,7 @@ struct SnapshotCreateRequest<librbd::MockTestImageCtx> {
   static SnapshotCreateRequest* s_instance;
   static SnapshotCreateRequest* create(librbd::MockTestImageCtx* image_ctx,
                                        const std::string &snap_name,
+                                       const cls::rbd::SnapshotNamespace &snap_namespace,
                                        uint64_t size,
                                        const librbd::parent_spec &parent_spec,
                                        uint64_t parent_overlap,
@@ -176,7 +177,8 @@ public:
 
   int create_snap(librbd::ImageCtx *image_ctx, const std::string &snap_name,
                   bool protect = false) {
-    int r = image_ctx->operations->snap_create(snap_name.c_str());
+    int r = image_ctx->operations->snap_create(snap_name.c_str(),
+                                              cls::rbd::UserSnapshotNamespace());
     if (r < 0) {
       return r;
     }
index c0105aeaa210b22af0f579a8d40c179173d484d2..8d8d4dfde0581da1f79bfafd93d7d529f7c2f0ee 100644 (file)
@@ -80,11 +80,11 @@ public:
 
   void expect_snap_create(librbd::MockTestImageCtx &mock_image_ctx,
                           const std::string &snap_name, uint64_t snap_id, int r) {
-    EXPECT_CALL(*mock_image_ctx.operations, execute_snap_create(StrEq(snap_name), _, 0, true))
+    EXPECT_CALL(*mock_image_ctx.operations, execute_snap_create(StrEq(snap_name), _, _, 0, true))
                   .WillOnce(DoAll(InvokeWithoutArgs([&mock_image_ctx, snap_id, snap_name]() {
                                     inject_snap(mock_image_ctx, snap_id, snap_name);
                                   }),
-                                  WithArg<1>(Invoke([this, r](Context *ctx) {
+                                  WithArg<2>(Invoke([this, r](Context *ctx) {
                                     m_threads->work_queue->queue(ctx, r);
                                   }))));
   }
@@ -105,11 +105,12 @@ public:
 
   MockSnapshotCreateRequest *create_request(librbd::MockTestImageCtx &mock_local_image_ctx,
                                             const std::string &snap_name,
+                                           const cls::rbd::SnapshotNamespace &snap_namespace,
                                             uint64_t size,
                                             const librbd::parent_spec &spec,
                                             uint64_t parent_overlap,
                                             Context *on_finish) {
-    return new MockSnapshotCreateRequest(&mock_local_image_ctx, snap_name, size,
+    return new MockSnapshotCreateRequest(&mock_local_image_ctx, snap_name, snap_namespace, size,
                                          spec, parent_overlap, on_finish);
   }
 
@@ -126,7 +127,9 @@ TEST_F(TestMockImageSyncSnapshotCreateRequest, Resize) {
 
   C_SaferCond ctx;
   MockSnapshotCreateRequest *request = create_request(mock_local_image_ctx,
-                                                      "snap1", 123, {}, 0,
+                                                      "snap1",
+                                                     cls::rbd::UserSnapshotNamespace(),
+                                                     123, {}, 0,
                                                       &ctx);
   request->send();
   ASSERT_EQ(0, ctx.wait());
@@ -140,7 +143,9 @@ TEST_F(TestMockImageSyncSnapshotCreateRequest, ResizeError) {
 
   C_SaferCond ctx;
   MockSnapshotCreateRequest *request = create_request(mock_local_image_ctx,
-                                                      "snap1", 123, {}, 0,
+                                                      "snap1",
+                                                     cls::rbd::UserSnapshotNamespace(),
+                                                     123, {}, 0,
                                                       &ctx);
   request->send();
   ASSERT_EQ(-EINVAL, ctx.wait());
@@ -158,6 +163,7 @@ TEST_F(TestMockImageSyncSnapshotCreateRequest, RemoveParent) {
   C_SaferCond ctx;
   MockSnapshotCreateRequest *request = create_request(mock_local_image_ctx,
                                                       "snap1",
+                                                     cls::rbd::UserSnapshotNamespace(),
                                                       m_local_image_ctx->size,
                                                       {}, 0, &ctx);
   request->send();
@@ -174,6 +180,7 @@ TEST_F(TestMockImageSyncSnapshotCreateRequest, RemoveParentError) {
   C_SaferCond ctx;
   MockSnapshotCreateRequest *request = create_request(mock_local_image_ctx,
                                                       "snap1",
+                                                     cls::rbd::UserSnapshotNamespace(),
                                                       m_local_image_ctx->size,
                                                       {}, 0, &ctx);
   request->send();
@@ -193,6 +200,7 @@ TEST_F(TestMockImageSyncSnapshotCreateRequest, RemoveSetParent) {
   C_SaferCond ctx;
   MockSnapshotCreateRequest *request = create_request(mock_local_image_ctx,
                                                       "snap1",
+                                                     cls::rbd::UserSnapshotNamespace(),
                                                       m_local_image_ctx->size,
                                                       {123, "test", 0}, 0,
                                                       &ctx);
@@ -211,6 +219,7 @@ TEST_F(TestMockImageSyncSnapshotCreateRequest, SetParentSpec) {
   C_SaferCond ctx;
   MockSnapshotCreateRequest *request = create_request(mock_local_image_ctx,
                                                       "snap1",
+                                                     cls::rbd::UserSnapshotNamespace(),
                                                       m_local_image_ctx->size,
                                                       {123, "test", 0}, 0,
                                                       &ctx);
@@ -230,6 +239,7 @@ TEST_F(TestMockImageSyncSnapshotCreateRequest, SetParentOverlap) {
   C_SaferCond ctx;
   MockSnapshotCreateRequest *request = create_request(mock_local_image_ctx,
                                                       "snap1",
+                                                     cls::rbd::UserSnapshotNamespace(),
                                                       m_local_image_ctx->size,
                                                       mock_local_image_ctx.parent_md.spec,
                                                       123, &ctx);
@@ -246,6 +256,7 @@ TEST_F(TestMockImageSyncSnapshotCreateRequest, SetParentError) {
   C_SaferCond ctx;
   MockSnapshotCreateRequest *request = create_request(mock_local_image_ctx,
                                                       "snap1",
+                                                     cls::rbd::UserSnapshotNamespace(),
                                                       m_local_image_ctx->size,
                                                       {123, "test", 0}, 0,
                                                       &ctx);
@@ -263,6 +274,7 @@ TEST_F(TestMockImageSyncSnapshotCreateRequest, SnapCreate) {
   C_SaferCond ctx;
   MockSnapshotCreateRequest *request = create_request(mock_local_image_ctx,
                                                       "snap1",
+                                                     cls::rbd::UserSnapshotNamespace(),
                                                       m_local_image_ctx->size,
                                                       {}, 0, &ctx);
   request->send();
@@ -278,6 +290,7 @@ TEST_F(TestMockImageSyncSnapshotCreateRequest, SnapCreateError) {
   C_SaferCond ctx;
   MockSnapshotCreateRequest *request = create_request(mock_local_image_ctx,
                                                       "snap1",
+                                                     cls::rbd::UserSnapshotNamespace(),
                                                       m_local_image_ctx->size,
                                                       {}, 0, &ctx);
   request->send();
@@ -295,6 +308,7 @@ TEST_F(TestMockImageSyncSnapshotCreateRequest, ResizeObjectMap) {
   C_SaferCond ctx;
   MockSnapshotCreateRequest *request = create_request(mock_local_image_ctx,
                                                       "snap1",
+                                                     cls::rbd::UserSnapshotNamespace(),
                                                       m_local_image_ctx->size,
                                                       {}, 0, &ctx);
   request->send();
@@ -312,6 +326,7 @@ TEST_F(TestMockImageSyncSnapshotCreateRequest, ResizeObjectMapError) {
   C_SaferCond ctx;
   MockSnapshotCreateRequest *request = create_request(mock_local_image_ctx,
                                                       "snap1",
+                                                     cls::rbd::UserSnapshotNamespace(),
                                                       m_local_image_ctx->size,
                                                       {}, 0, &ctx);
   request->send();
index 7fd32d4efe4061a2a76246767b7247e67bc96620..0dfe10e4b02e044709446c8ff9e25200c77e0d92 100644 (file)
@@ -67,8 +67,8 @@ public:
   }
 
   void expect_snap_create(librbd::MockTestImageCtx &mock_remote_image_ctx, int r) {
-    EXPECT_CALL(*mock_remote_image_ctx.operations, snap_create(_, _))
-      .WillOnce(WithArg<1>(CompleteContext(r)));
+    EXPECT_CALL(*mock_remote_image_ctx.operations, snap_create(_, _, _))
+      .WillOnce(WithArg<2>(CompleteContext(r)));
   }
 
   MockSyncPointCreateRequest *create_request(librbd::MockTestImageCtx &mock_remote_image_ctx,
index 5480316e338f4b6531637c467062ca004f6f4a29..405f5cf1ebfecb4352a78460a3533b719fe27db0 100644 (file)
@@ -14,6 +14,7 @@
 #include "include/rados/librados.hpp"
 #include "include/rbd/librbd.hpp"
 #include "include/stringify.h"
+#include "cls/rbd/cls_rbd_types.h"
 #include "cls/rbd/cls_rbd_client.h"
 #include "tools/rbd_mirror/ImageDeleter.h"
 #include "tools/rbd_mirror/ImageReplayer.h"
@@ -150,7 +151,8 @@ public:
     EXPECT_EQ(0, ictx->state->open());
     promote_image(ictx);
 
-    EXPECT_EQ(0, ictx->operations->snap_create(snap_name.c_str()));
+    EXPECT_EQ(0, ictx->operations->snap_create(snap_name.c_str(),
+                                              cls::rbd::UserSnapshotNamespace()));
 
     if (protect) {
       EXPECT_EQ(0, ictx->operations->snap_protect(snap_name.c_str()));
@@ -166,7 +168,8 @@ public:
     EXPECT_EQ(0, ictx->state->open());
     promote_image(ictx);
 
-    EXPECT_EQ(0, ictx->operations->snap_create("snap1"));
+    EXPECT_EQ(0, ictx->operations->snap_create("snap1",
+                                              cls::rbd::UserSnapshotNamespace()));
     EXPECT_EQ(0, ictx->operations->snap_protect("snap1"));
     int order = 20;
     EXPECT_EQ(0, librbd::clone(m_local_io_ctx, ictx->name.c_str(), "snap1",
index cce9556460268e257efddd261b35a65557e95e3c..5584c89e02e7598a9bc17acce5090e46dbf69436 100644 (file)
@@ -19,6 +19,7 @@
 #include "include/stringify.h"
 #include "cls/journal/cls_journal_types.h"
 #include "cls/journal/cls_journal_client.h"
+#include "cls/rbd/cls_rbd_types.h"
 #include "cls/rbd/cls_rbd_client.h"
 #include "journal/Journaler.h"
 #include "librbd/AioCompletion.h"
@@ -737,7 +738,8 @@ TEST_F(TestImageReplayer, MultipleReplayFailures_SingleEpoch) {
   librbd::ImageCtx *ictx;
   open_image(m_local_ioctx, m_image_name, false, &ictx);
   ictx->features &= ~RBD_FEATURE_JOURNALING;
-  ASSERT_EQ(0, ictx->operations->snap_create("foo"));
+  ASSERT_EQ(0, ictx->operations->snap_create("foo",
+                                            cls::rbd::UserSnapshotNamespace()));
   ASSERT_EQ(0, ictx->operations->snap_protect("foo"));
   ASSERT_EQ(0, librbd::cls_client::add_child(&ictx->md_ctx, RBD_CHILDREN,
                                              {ictx->md_ctx.get_id(),
@@ -784,7 +786,8 @@ TEST_F(TestImageReplayer, MultipleReplayFailures_MultiEpoch) {
   librbd::ImageCtx *ictx;
   open_image(m_local_ioctx, m_image_name, false, &ictx);
   ictx->features &= ~RBD_FEATURE_JOURNALING;
-  ASSERT_EQ(0, ictx->operations->snap_create("foo"));
+  ASSERT_EQ(0, ictx->operations->snap_create("foo",
+                                            cls::rbd::UserSnapshotNamespace()));
   ASSERT_EQ(0, ictx->operations->snap_protect("foo"));
   ASSERT_EQ(0, librbd::cls_client::add_child(&ictx->md_ctx, RBD_CHILDREN,
                                              {ictx->md_ctx.get_id(),
index 76d0385b476771d8a06a1ed581522759fc3630e5..b73cdbfe0e2bc57e20f1eff72a7e1970e1a0f026 100644 (file)
@@ -3,6 +3,7 @@
 #include "include/rados/librados.hpp"
 #include "include/rbd/librbd.hpp"
 #include "include/stringify.h"
+#include "cls/rbd/cls_rbd_types.h"
 #include "cls/rbd/cls_rbd_client.h"
 #include "include/rbd_types.h"
 #include "librbd/internal.h"
@@ -127,7 +128,8 @@ TestPoolWatcher() : m_lock("TestPoolWatcherLock"),
       librbd::ImageCtx *ictx = new librbd::ImageCtx(parent_image_name.c_str(),
                                                    "", "", pioctx, false);
       ictx->state->open();
-      EXPECT_EQ(0, ictx->operations->snap_create(snap_name.c_str()));
+      EXPECT_EQ(0, ictx->operations->snap_create(snap_name.c_str(),
+                                                cls::rbd::UserSnapshotNamespace()));
       EXPECT_EQ(0, ictx->operations->snap_protect(snap_name.c_str()));
       ictx->state->close();
     }
index b1eb489d97aab04db73658d53604e606d7311895..9a13bda85a58dfc1b0cdec016da7f664bc817871 100644 (file)
@@ -1,6 +1,7 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
 // vim: ts=8 sw=2 smarttab
 
+#include "cls/rbd/cls_rbd_types.h"
 #include "test/rbd_mirror/test_fixture.h"
 #include "include/stringify.h"
 #include "include/rbd/librbd.hpp"
@@ -84,7 +85,8 @@ int TestFixture::open_image(librados::IoCtx &io_ctx,
 
 int TestFixture::create_snap(librbd::ImageCtx *image_ctx, const char* snap_name,
                              librados::snap_t *snap_id) {
-  int r = image_ctx->operations->snap_create(snap_name);
+  int r = image_ctx->operations->snap_create(snap_name,
+                                            cls::rbd::UserSnapshotNamespace());
   if (r < 0) {
     return r;
   }
index 2f0946cf4dedc63616849df98297eb69851e0c0f..974dfb720b7c7e10194be448acf2e9c322291643 100644 (file)
@@ -101,6 +101,7 @@ void SnapshotCopyRequest<I>::send_snap_unprotect() {
     librados::snap_t local_snap_id = *snap_id_it;
 
     m_local_image_ctx->snap_lock.get_read();
+
     bool local_unprotected;
     int r = m_local_image_ctx->is_snap_unprotected(local_snap_id,
                                                    &local_unprotected);
@@ -200,6 +201,21 @@ void SnapshotCopyRequest<I>::send_snap_remove() {
   for (; snap_id_it != m_local_snap_ids.end(); ++snap_id_it) {
     librados::snap_t local_snap_id = *snap_id_it;
 
+    cls::rbd::SnapshotNamespace snap_namespace;
+    m_local_image_ctx->snap_lock.get_read();
+    int r = m_local_image_ctx->get_snap_namespace(local_snap_id, &snap_namespace);
+    m_local_image_ctx->snap_lock.put_read();
+    if (r < 0) {
+      derr << ": failed to retrieve local snap namespace: " << m_snap_name
+          << dendl;
+      finish(r);
+      return;
+    }
+
+    if (boost::get<cls::rbd::UserSnapshotNamespace>(&snap_namespace) == nullptr) {
+      continue;
+    }
+
     // if the local snapshot isn't in our mapping table, remove it
     auto snap_seq_it = std::find_if(
       m_snap_seqs.begin(), m_snap_seqs.end(),
@@ -261,8 +277,20 @@ void SnapshotCopyRequest<I>::send_snap_create() {
   for (; snap_id_it != m_remote_snap_ids.end(); ++snap_id_it) {
     librados::snap_t remote_snap_id = *snap_id_it;
 
+    cls::rbd::SnapshotNamespace snap_namespace;
+    m_remote_image_ctx->snap_lock.get_read();
+    int r = m_remote_image_ctx->get_snap_namespace(remote_snap_id, &snap_namespace);
+    m_remote_image_ctx->snap_lock.put_read();
+    if (r < 0) {
+      derr << ": failed to retrieve remote snap namespace: " << m_snap_name
+          << dendl;
+      finish(r);
+      return;
+    }
+
     // if the remote snapshot isn't in our mapping table, create it
-    if (m_snap_seqs.find(remote_snap_id) == m_snap_seqs.end()) {
+    if (m_snap_seqs.find(remote_snap_id) == m_snap_seqs.end() &&
+       boost::get<cls::rbd::UserSnapshotNamespace>(&snap_namespace) != nullptr) {
       break;
     }
   }
@@ -288,6 +316,7 @@ void SnapshotCopyRequest<I>::send_snap_create() {
   }
 
   uint64_t size = snap_info_it->second.size;
+  m_snap_namespace = snap_info_it->second.snap_namespace;
   librbd::parent_spec parent_spec;
   uint64_t parent_overlap = 0;
   if (snap_info_it->second.parent.spec.pool_id != -1) {
@@ -311,7 +340,7 @@ void SnapshotCopyRequest<I>::send_snap_create() {
     SnapshotCopyRequest<I>, &SnapshotCopyRequest<I>::handle_snap_create>(
       this);
   SnapshotCreateRequest<I> *req = SnapshotCreateRequest<I>::create(
-    m_local_image_ctx, m_snap_name, size, parent_spec, parent_overlap, ctx);
+    m_local_image_ctx, m_snap_name, m_snap_namespace, size, parent_spec, parent_overlap, ctx);
   req->send();
 }
 
@@ -354,6 +383,7 @@ void SnapshotCopyRequest<I>::send_snap_protect() {
     librados::snap_t remote_snap_id = *snap_id_it;
 
     m_remote_image_ctx->snap_lock.get_read();
+
     bool remote_protected;
     int r = m_remote_image_ctx->is_snap_protected(remote_snap_id,
                                                   &remote_protected);
index 2be105e9d0651dcd45c1fb11eb30d15320bfd1dd..77f77722877c14f63039bd9546e5beb8e201afcb 100644 (file)
@@ -104,6 +104,7 @@ private:
   librados::snap_t m_prev_snap_id = CEPH_NOSNAP;
 
   std::string m_snap_name;
+  cls::rbd::SnapshotNamespace m_snap_namespace;
 
   librbd::parent_spec m_local_parent_spec;
 
index ac0461877185014a5c1ad5054fcb9725804182d8..ea7e029c2e550b7b3835b6cacc48acbf573ff53d 100644 (file)
@@ -4,6 +4,7 @@
 #include "SnapshotCreateRequest.h"
 #include "common/errno.h"
 #include "cls/rbd/cls_rbd_client.h"
+#include "cls/rbd/cls_rbd_types.h"
 #include "librbd/ObjectMap.h"
 #include "librbd/Operations.h"
 #include "librbd/Utils.h"
@@ -24,11 +25,13 @@ using librbd::util::create_rados_safe_callback;
 template <typename I>
 SnapshotCreateRequest<I>::SnapshotCreateRequest(I *local_image_ctx,
                                                 const std::string &snap_name,
+                                               const cls::rbd::SnapshotNamespace &snap_namespace,
                                                 uint64_t size,
                                                 const librbd::parent_spec &spec,
                                                 uint64_t parent_overlap,
                                                 Context *on_finish)
-  : m_local_image_ctx(local_image_ctx), m_snap_name(snap_name), m_size(size),
+  : m_local_image_ctx(local_image_ctx), m_snap_name(snap_name),
+    m_snap_namespace(snap_namespace), m_size(size),
     m_parent_spec(spec), m_parent_overlap(parent_overlap),
     m_on_finish(on_finish) {
 }
@@ -186,7 +189,9 @@ void SnapshotCreateRequest<I>::send_snap_create() {
     SnapshotCreateRequest<I>, &SnapshotCreateRequest<I>::handle_snap_create>(
       this);
   RWLock::RLocker owner_locker(m_local_image_ctx->owner_lock);
-  m_local_image_ctx->operations->execute_snap_create(m_snap_name.c_str(), ctx,
+  m_local_image_ctx->operations->execute_snap_create(m_snap_name.c_str(),
+                                                    m_snap_namespace,
+                                                    ctx,
                                                      0U, true);
 }
 
index c8c772f4acaf173a4f6bff917aa8d09ce713526e..370b0368deca3764297ce3f7791be209b7321637 100644 (file)
@@ -26,16 +26,19 @@ class SnapshotCreateRequest {
 public:
   static SnapshotCreateRequest* create(ImageCtxT *local_image_ctx,
                                        const std::string &snap_name,
+                                       const cls::rbd::SnapshotNamespace &snap_namespace,
                                        uint64_t size,
                                        const librbd::parent_spec &parent_spec,
                                        uint64_t parent_overlap,
                                        Context *on_finish) {
-    return new SnapshotCreateRequest(local_image_ctx, snap_name, size,
+    return new SnapshotCreateRequest(local_image_ctx, snap_name, snap_namespace, size,
                                      parent_spec, parent_overlap, on_finish);
   }
 
   SnapshotCreateRequest(ImageCtxT *local_image_ctx,
-                        const std::string &snap_name, uint64_t size,
+                        const std::string &snap_name,
+                       const cls::rbd::SnapshotNamespace &snap_namespace,
+                       uint64_t size,
                         const librbd::parent_spec &parent_spec,
                         uint64_t parent_overlap, Context *on_finish);
 
@@ -70,6 +73,7 @@ private:
 
   ImageCtxT *m_local_image_ctx;
   std::string m_snap_name;
+  cls::rbd::SnapshotNamespace m_snap_namespace;
   uint64_t m_size;
   librbd::parent_spec m_parent_spec;
   uint64_t m_parent_overlap;
index 2c344bad1ad5b7f40f745d7a5cf93a0ebdc0b347..52cf040b1d0c0956b82ee07b2cbb52a1e24910cd 100644 (file)
@@ -122,7 +122,7 @@ void SyncPointCreateRequest<I>::send_create_snap() {
     SyncPointCreateRequest<I>, &SyncPointCreateRequest<I>::handle_create_snap>(
       this);
   m_remote_image_ctx->operations->snap_create(
-    sync_point.snap_name.c_str(), ctx);
+    sync_point.snap_name.c_str(), cls::rbd::UserSnapshotNamespace(), ctx);
 }
 
 template <typename I>