From: Mykola Golub Date: Mon, 21 Nov 2016 07:57:40 +0000 (+0200) Subject: rbd-mirror: tweaks to support creating mock test cases X-Git-Tag: v12.0.0~196^2~2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=ce867ce44a4d4ff01be4e9409bca1ee90e79bdaf;p=ceph.git rbd-mirror: tweaks to support creating mock test cases Signed-off-by: Mykola Golub --- diff --git a/src/tools/rbd_mirror/ImageReplayer.cc b/src/tools/rbd_mirror/ImageReplayer.cc index 68a6539f78cf7..71e5a479b0f7d 100644 --- a/src/tools/rbd_mirror/ImageReplayer.cc +++ b/src/tools/rbd_mirror/ImageReplayer.cc @@ -1380,7 +1380,7 @@ void ImageReplayer::shut_down(int r) { m_local_journal->stop_external_replay(); m_local_replay = nullptr; - delete m_event_preprocessor; + EventPreprocessor::destroy(m_event_preprocessor); m_event_preprocessor = nullptr; ctx->complete(0); }); @@ -1449,7 +1449,7 @@ void ImageReplayer::handle_shut_down(int r) { m_local_ioctx.close(); m_remote_ioctx.close(); - delete m_replay_status_formatter; + ReplayStatusFormatter::destroy(m_replay_status_formatter); m_replay_status_formatter = nullptr; Context *on_start = nullptr; diff --git a/src/tools/rbd_mirror/image_replayer/EventPreprocessor.h b/src/tools/rbd_mirror/image_replayer/EventPreprocessor.h index 6cdf0f61bf429..67aeea0b80752 100644 --- a/src/tools/rbd_mirror/image_replayer/EventPreprocessor.h +++ b/src/tools/rbd_mirror/image_replayer/EventPreprocessor.h @@ -36,6 +36,10 @@ public: local_mirror_uuid, client_meta, work_queue); } + static void destroy(EventPreprocessor* processor) { + delete processor; + } + EventPreprocessor(ImageCtxT &local_image_ctx, Journaler &remote_journaler, const std::string &local_mirror_uuid, MirrorPeerClientMeta *client_meta, ContextWQ *work_queue); diff --git a/src/tools/rbd_mirror/image_replayer/ReplayStatusFormatter.h b/src/tools/rbd_mirror/image_replayer/ReplayStatusFormatter.h index 00d7a05a52ec3..59940a651fbca 100644 --- a/src/tools/rbd_mirror/image_replayer/ReplayStatusFormatter.h +++ b/src/tools/rbd_mirror/image_replayer/ReplayStatusFormatter.h @@ -27,6 +27,10 @@ public: return new ReplayStatusFormatter(journaler, mirror_uuid); } + static void destroy(ReplayStatusFormatter* formatter) { + delete formatter; + } + ReplayStatusFormatter(Journaler *journaler, const std::string &mirror_uuid); bool get_or_send_update(std::string *description, Context *on_finish);