From: Jason Dillaman Date: Tue, 7 Jan 2020 17:44:27 +0000 (-0500) Subject: rbd-mirror: don't pass journal settings to prepare remote image state machine X-Git-Tag: v15.1.0~250^2~7 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=2fba5128a607fa4071a65f8b3de315d5227346f5;p=ceph.git rbd-mirror: don't pass journal settings to prepare remote image state machine Instead, pass the local IoCtx so that it can be locally constructed. Signed-off-by: Jason Dillaman --- diff --git a/src/test/rbd_mirror/image_replayer/test_mock_BootstrapRequest.cc b/src/test/rbd_mirror/image_replayer/test_mock_BootstrapRequest.cc index 1fd4192c2f3..5b3bbb4f901 100644 --- a/src/test/rbd_mirror/image_replayer/test_mock_BootstrapRequest.cc +++ b/src/test/rbd_mirror/image_replayer/test_mock_BootstrapRequest.cc @@ -263,11 +263,11 @@ struct PrepareRemoteImageRequest { Context *on_finish = nullptr; static PrepareRemoteImageRequest* create(Threads *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, diff --git a/src/test/rbd_mirror/image_replayer/test_mock_PrepareRemoteImageRequest.cc b/src/test/rbd_mirror/image_replayer/test_mock_PrepareRemoteImageRequest.cc index ceeab552302..6755e6f05b2 100644 --- a/src/test/rbd_mirror/image_replayer/test_mock_PrepareRemoteImageRequest.cc +++ b/src/test/rbd_mirror/image_replayer/test_mock_PrepareRemoteImageRequest.cc @@ -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, diff --git a/src/tools/rbd_mirror/image_replayer/BootstrapRequest.cc b/src/tools/rbd_mirror/image_replayer/BootstrapRequest.cc index 379cb666c51..9b93da5c88e 100644 --- a/src/tools/rbd_mirror/image_replayer/BootstrapRequest.cc +++ b/src/tools/rbd_mirror/image_replayer/BootstrapRequest.cc @@ -161,18 +161,13 @@ void BootstrapRequest::prepare_remote_image() { dout(10) << dendl; update_progress("PREPARE_REMOTE_IMAGE"); - auto cct = static_cast(m_local_io_ctx.cct()); - ::journal::Settings journal_settings; - journal_settings.commit_interval = cct->_conf.get_val( - "rbd_mirror_journal_commit_age"); - ceph_assert(*m_remote_journaler == nullptr); Context *ctx = create_context_callback< BootstrapRequest, &BootstrapRequest::handle_prepare_remote_image>(this); auto req = image_replayer::PrepareRemoteImageRequest::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(); diff --git a/src/tools/rbd_mirror/image_replayer/PrepareRemoteImageRequest.cc b/src/tools/rbd_mirror/image_replayer/PrepareRemoteImageRequest.cc index aab1c3c13dc..9190d092825 100644 --- a/src/tools/rbd_mirror/image_replayer/PrepareRemoteImageRequest.cc +++ b/src/tools/rbd_mirror/image_replayer/PrepareRemoteImageRequest.cc @@ -155,11 +155,16 @@ template void PrepareRemoteImageRequest::get_client() { dout(10) << dendl; + auto cct = static_cast(m_local_io_ctx.cct()); + ::journal::Settings journal_settings; + journal_settings.commit_interval = cct->_conf.get_val( + "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( diff --git a/src/tools/rbd_mirror/image_replayer/PrepareRemoteImageRequest.h b/src/tools/rbd_mirror/image_replayer/PrepareRemoteImageRequest.h index 413b26c2e6e..21dc5ecac80 100644 --- a/src/tools/rbd_mirror/image_replayer/PrepareRemoteImageRequest.h +++ b/src/tools/rbd_mirror/image_replayer/PrepareRemoteImageRequest.h @@ -12,7 +12,6 @@ #include 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 *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 *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 *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;