]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rbd-mirror: don't pass journal settings to prepare remote image state machine
authorJason Dillaman <dillaman@redhat.com>
Tue, 7 Jan 2020 17:44:27 +0000 (12:44 -0500)
committerJason Dillaman <dillaman@redhat.com>
Thu, 9 Jan 2020 15:48:52 +0000 (10:48 -0500)
Instead, pass the local IoCtx so that it can be locally constructed.

Signed-off-by: Jason Dillaman <dillaman@redhat.com>
src/test/rbd_mirror/image_replayer/test_mock_BootstrapRequest.cc
src/test/rbd_mirror/image_replayer/test_mock_PrepareRemoteImageRequest.cc
src/tools/rbd_mirror/image_replayer/BootstrapRequest.cc
src/tools/rbd_mirror/image_replayer/PrepareRemoteImageRequest.cc
src/tools/rbd_mirror/image_replayer/PrepareRemoteImageRequest.h

index 1fd4192c2f37a9eab006b885dbe03b7d87e8fb57..5b3bbb4f9011d1bae52837343565bf767fc09475 100644 (file)
@@ -263,11 +263,11 @@ struct PrepareRemoteImageRequest<librbd::MockTestImageCtx> {
   Context *on_finish = nullptr;
 
   static PrepareRemoteImageRequest* create(Threads<librbd::MockTestImageCtx> *threads,
+                                           librados::IoCtx &,
                                            librados::IoCtx &,
                                            const std::string &global_image_id,
                                            const std::string &local_mirror_uuid,
                                            const std::string &local_image_id,
-                                           const ::journal::Settings &settings,
                                            ::journal::CacheManagerHandler *cache_manager_handler,
                                            std::string *remote_mirror_uuid,
                                            std::string *remote_image_id,
index ceeab552302bd9abd8ca11619155c47e457165b8..6755e6f05b2fc148e6a0c7108f7f96ad73c5d844 100644 (file)
@@ -196,10 +196,11 @@ TEST_F(TestMockImageReplayerPrepareRemoteImageRequest, Success) {
   librbd::journal::MirrorPeerClientMeta client_meta;
   C_SaferCond ctx;
   auto req = MockPrepareRemoteImageRequest::create(&mock_threads,
+                                                   m_local_io_ctx,
                                                    m_remote_io_ctx,
                                                    "global image id",
                                                    "local mirror uuid",
-                                                   "local image id", {},
+                                                   "local image id",
                                                    nullptr, &remote_mirror_uuid,
                                                    &remote_image_id,
                                                    &remote_journaler,
@@ -247,10 +248,11 @@ TEST_F(TestMockImageReplayerPrepareRemoteImageRequest, SuccessNotRegistered) {
   librbd::journal::MirrorPeerClientMeta client_meta;
   C_SaferCond ctx;
   auto req = MockPrepareRemoteImageRequest::create(&mock_threads,
+                                                   m_local_io_ctx,
                                                    m_remote_io_ctx,
                                                    "global image id",
                                                    "local mirror uuid",
-                                                   "local image id", {},
+                                                   "local image id",
                                                    nullptr, &remote_mirror_uuid,
                                                    &remote_image_id,
                                                    &remote_journaler,
@@ -280,10 +282,11 @@ TEST_F(TestMockImageReplayerPrepareRemoteImageRequest, MirrorUuidError) {
   librbd::journal::MirrorPeerClientMeta client_meta;
   C_SaferCond ctx;
   auto req = MockPrepareRemoteImageRequest::create(&mock_threads,
+                                                   m_local_io_ctx,
                                                    m_remote_io_ctx,
                                                    "global image id",
                                                    "local mirror uuid",
-                                                   "", {}, nullptr,
+                                                   "", nullptr,
                                                    &remote_mirror_uuid,
                                                    &remote_image_id,
                                                    &remote_journaler,
@@ -312,10 +315,11 @@ TEST_F(TestMockImageReplayerPrepareRemoteImageRequest, MirrorImageIdError) {
   librbd::journal::MirrorPeerClientMeta client_meta;
   C_SaferCond ctx;
   auto req = MockPrepareRemoteImageRequest::create(&mock_threads,
+                                                   m_local_io_ctx,
                                                    m_remote_io_ctx,
                                                    "global image id",
                                                    "local mirror uuid",
-                                                   "", {}, nullptr,
+                                                   "", nullptr,
                                                    &remote_mirror_uuid,
                                                    &remote_image_id,
                                                    &remote_journaler,
@@ -348,10 +352,11 @@ TEST_F(TestMockImageReplayerPrepareRemoteImageRequest, MirrorModeError) {
   librbd::journal::MirrorPeerClientMeta client_meta;
   C_SaferCond ctx;
   auto req = MockPrepareRemoteImageRequest::create(&mock_threads,
+                                                   m_local_io_ctx,
                                                    m_remote_io_ctx,
                                                    "global image id",
                                                    "local mirror uuid",
-                                                   "", {}, nullptr,
+                                                   "", nullptr,
                                                    &remote_mirror_uuid,
                                                    &remote_image_id,
                                                    &remote_journaler,
@@ -389,10 +394,11 @@ TEST_F(TestMockImageReplayerPrepareRemoteImageRequest, GetClientError) {
   librbd::journal::MirrorPeerClientMeta client_meta;
   C_SaferCond ctx;
   auto req = MockPrepareRemoteImageRequest::create(&mock_threads,
+                                                   m_local_io_ctx,
                                                    m_remote_io_ctx,
                                                    "global image id",
                                                    "local mirror uuid",
-                                                   "local image id", {},
+                                                   "local image id",
                                                    nullptr, &remote_mirror_uuid,
                                                    &remote_image_id,
                                                    &remote_journaler,
@@ -438,10 +444,11 @@ TEST_F(TestMockImageReplayerPrepareRemoteImageRequest, RegisterClientError) {
   librbd::journal::MirrorPeerClientMeta client_meta;
   C_SaferCond ctx;
   auto req = MockPrepareRemoteImageRequest::create(&mock_threads,
+                                                   m_local_io_ctx,
                                                    m_remote_io_ctx,
                                                    "global image id",
                                                    "local mirror uuid",
-                                                   "local image id", {},
+                                                   "local image id",
                                                    nullptr, &remote_mirror_uuid,
                                                    &remote_image_id,
                                                    &remote_journaler,
index 379cb666c51670a553b7e543947f587514b783f1..9b93da5c88edcfb68b89021ff82c5f318397c5a4 100644 (file)
@@ -161,18 +161,13 @@ void BootstrapRequest<I>::prepare_remote_image() {
   dout(10) << dendl;
   update_progress("PREPARE_REMOTE_IMAGE");
 
-  auto cct = static_cast<CephContext *>(m_local_io_ctx.cct());
-  ::journal::Settings journal_settings;
-  journal_settings.commit_interval = cct->_conf.get_val<double>(
-    "rbd_mirror_journal_commit_age");
-
   ceph_assert(*m_remote_journaler == nullptr);
 
   Context *ctx = create_context_callback<
     BootstrapRequest, &BootstrapRequest<I>::handle_prepare_remote_image>(this);
   auto req = image_replayer::PrepareRemoteImageRequest<I>::create(
-    m_threads, m_remote_io_ctx, m_global_image_id, m_local_mirror_uuid,
-    *m_local_image_id, journal_settings, m_cache_manager_handler,
+    m_threads, m_local_io_ctx, m_remote_io_ctx, m_global_image_id,
+    m_local_mirror_uuid, *m_local_image_id, m_cache_manager_handler,
     m_remote_mirror_uuid, m_remote_image_id, m_remote_journaler,
     &m_client_state, &m_client_meta, ctx);
   req->send();
index aab1c3c13dc81f8a0172f0164f9528a61da3f64e..9190d09282555206a22f30386e4b0e8c7062a756 100644 (file)
@@ -155,11 +155,16 @@ template <typename I>
 void PrepareRemoteImageRequest<I>::get_client() {
   dout(10) << dendl;
 
+  auto cct = static_cast<CephContext *>(m_local_io_ctx.cct());
+  ::journal::Settings journal_settings;
+  journal_settings.commit_interval = cct->_conf.get_val<double>(
+    "rbd_mirror_journal_commit_age");
+
   ceph_assert(*m_remote_journaler == nullptr);
   *m_remote_journaler = new Journaler(m_threads->work_queue, m_threads->timer,
                                       &m_threads->timer_lock, m_remote_io_ctx,
                                       *m_remote_image_id, m_local_mirror_uuid,
-                                      m_journal_settings,
+                                      journal_settings,
                                       m_cache_manager_handler);
 
   Context *ctx = create_async_context_callback(
index 413b26c2e6ec28021cf06c4e5333899d0a6b4113..21dc5ecac8053463e00561e0e08f1cbcd6d76e34 100644 (file)
@@ -12,7 +12,6 @@
 #include <string>
 
 namespace journal { class Journaler; }
-namespace journal { class Settings; }
 namespace journal { struct CacheManagerHandler; }
 namespace librbd { struct ImageCtx; }
 namespace librbd { namespace journal { struct MirrorPeerClientMeta; } }
@@ -35,11 +34,11 @@ public:
   typedef librbd::journal::MirrorPeerClientMeta MirrorPeerClientMeta;
 
   static PrepareRemoteImageRequest *create(Threads<ImageCtxT> *threads,
+                                           librados::IoCtx &local_io_ctx,
                                            librados::IoCtx &remote_io_ctx,
                                            const std::string &global_image_id,
                                            const std::string &local_mirror_uuid,
                                            const std::string &local_image_id,
-                                           const ::journal::Settings &settings,
                                            ::journal::CacheManagerHandler *cache_manager_handler,
                                            std::string *remote_mirror_uuid,
                                            std::string *remote_image_id,
@@ -47,21 +46,20 @@ public:
                                            cls::journal::ClientState *client_state,
                                            MirrorPeerClientMeta *client_meta,
                                            Context *on_finish) {
-    return new PrepareRemoteImageRequest(threads, remote_io_ctx,
+    return new PrepareRemoteImageRequest(threads, local_io_ctx, remote_io_ctx,
                                          global_image_id, local_mirror_uuid,
-                                         local_image_id, settings,
-                                         cache_manager_handler,
-                                         remote_mirror_uuid,
-                                         remote_image_id, remote_journaler,
-                                         client_state, client_meta, on_finish);
+                                         local_image_id, cache_manager_handler,
+                                         remote_mirror_uuid, remote_image_id,
+                                         remote_journaler, client_state,
+                                         client_meta, on_finish);
   }
 
   PrepareRemoteImageRequest(Threads<ImageCtxT> *threads,
+                            librados::IoCtx &local_io_ctx,
                             librados::IoCtx &remote_io_ctx,
                             const std::string &global_image_id,
                             const std::string &local_mirror_uuid,
                             const std::string &local_image_id,
-                            const ::journal::Settings &journal_settings,
                             ::journal::CacheManagerHandler *cache_manager_handler,
                             std::string *remote_mirror_uuid,
                             std::string *remote_image_id,
@@ -69,10 +67,11 @@ public:
                             cls::journal::ClientState *client_state,
                             MirrorPeerClientMeta *client_meta,
                             Context *on_finish)
-    : m_threads(threads), m_remote_io_ctx(remote_io_ctx),
+    : m_threads(threads),
+      m_local_io_ctx(local_io_ctx),
+      m_remote_io_ctx(remote_io_ctx),
       m_global_image_id(global_image_id),
       m_local_mirror_uuid(local_mirror_uuid), m_local_image_id(local_image_id),
-      m_journal_settings(journal_settings),
       m_cache_manager_handler(cache_manager_handler),
       m_remote_mirror_uuid(remote_mirror_uuid),
       m_remote_image_id(remote_image_id),
@@ -110,11 +109,11 @@ private:
    */
 
   Threads<ImageCtxT> *m_threads;
+  librados::IoCtx &m_local_io_ctx;
   librados::IoCtx &m_remote_io_ctx;
   std::string m_global_image_id;
   std::string m_local_mirror_uuid;
   std::string m_local_image_id;
-  ::journal::Settings m_journal_settings;
   ::journal::CacheManagerHandler *m_cache_manager_handler;
   std::string *m_remote_mirror_uuid;
   std::string *m_remote_image_id;