]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rbd-mirror: drop m_remote_promotion_state from PrepareReplayRequest
authorIlya Dryomov <idryomov@gmail.com>
Mon, 20 Jun 2022 15:21:08 +0000 (17:21 +0200)
committerIlya Dryomov <idryomov@gmail.com>
Wed, 22 Jun 2022 12:37:02 +0000 (14:37 +0200)
Now unused (and if it was used, the entire StateBuilder is passed in
anyway).

Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
(cherry picked from commit adf7f1ee2ef70ca3e728f2c5619668dc38216edf)

src/test/rbd_mirror/image_replayer/journal/test_mock_PrepareReplayRequest.cc
src/tools/rbd_mirror/image_replayer/journal/PrepareReplayRequest.h
src/tools/rbd_mirror/image_replayer/journal/StateBuilder.cc
src/tools/rbd_mirror/image_replayer/snapshot/PrepareReplayRequest.h
src/tools/rbd_mirror/image_replayer/snapshot/StateBuilder.cc

index c570f69ebf520c1c47dfe0ae407598b43a54f859..4aa9516294d0635d4a25f55a3c1f1f7ccb8b785a 100644 (file)
@@ -154,12 +154,11 @@ public:
 
   MockPrepareReplayRequest* create_request(
       MockStateBuilder& mock_state_builder,
-      librbd::mirror::PromotionState remote_promotion_state,
       const std::string& local_mirror_uuid,
       bool* resync_requested, bool* syncing, Context* on_finish) {
     return new MockPrepareReplayRequest(
-      local_mirror_uuid, remote_promotion_state, nullptr, &mock_state_builder,
-      resync_requested, syncing, on_finish);
+      local_mirror_uuid, nullptr, &mock_state_builder, resync_requested,
+      syncing, on_finish);
   }
 
   librbd::ImageCtx *m_local_image_ctx = nullptr;
@@ -204,9 +203,8 @@ TEST_F(TestMockImageReplayerJournalPrepareReplayRequest, Success) {
                                       mirror_peer_client_meta);
   bool resync_requested;
   bool syncing;
-  auto request = create_request(
-    mock_state_builder, librbd::mirror::PROMOTION_STATE_PRIMARY,
-    "local mirror uuid", &resync_requested, &syncing, &ctx);
+  auto request = create_request(mock_state_builder, "local mirror uuid",
+                                &resync_requested, &syncing, &ctx);
   request->send();
   ASSERT_EQ(0, ctx.wait());
   ASSERT_FALSE(resync_requested);
@@ -228,9 +226,8 @@ TEST_F(TestMockImageReplayerJournalPrepareReplayRequest, NoLocalJournal) {
                                       mirror_peer_client_meta);
   bool resync_requested;
   bool syncing;
-  auto request = create_request(
-    mock_state_builder, librbd::mirror::PROMOTION_STATE_PRIMARY,
-    "local mirror uuid", &resync_requested, &syncing, &ctx);
+  auto request = create_request(mock_state_builder, "local mirror uuid",
+                                &resync_requested, &syncing, &ctx);
   request->send();
   ASSERT_EQ(-EINVAL, ctx.wait());
 }
@@ -257,9 +254,8 @@ TEST_F(TestMockImageReplayerJournalPrepareReplayRequest, ResyncRequested) {
                                       mirror_peer_client_meta);
   bool resync_requested;
   bool syncing;
-  auto request = create_request(
-    mock_state_builder, librbd::mirror::PROMOTION_STATE_PRIMARY,
-    "local mirror uuid", &resync_requested, &syncing, &ctx);
+  auto request = create_request(mock_state_builder, "local mirror uuid",
+                                &resync_requested, &syncing, &ctx);
   request->send();
   ASSERT_EQ(0, ctx.wait());
   ASSERT_TRUE(resync_requested);
@@ -286,9 +282,8 @@ TEST_F(TestMockImageReplayerJournalPrepareReplayRequest, ResyncRequestedError) {
                                       mirror_peer_client_meta);
   bool resync_requested;
   bool syncing;
-  auto request = create_request(
-    mock_state_builder, librbd::mirror::PROMOTION_STATE_PRIMARY,
-    "local mirror uuid", &resync_requested, &syncing, &ctx);
+  auto request = create_request(mock_state_builder, "local mirror uuid",
+                                &resync_requested, &syncing, &ctx);
   request->send();
   ASSERT_EQ(-EINVAL, ctx.wait());
 }
@@ -315,9 +310,8 @@ TEST_F(TestMockImageReplayerJournalPrepareReplayRequest, Syncing) {
                                       mirror_peer_client_meta);
   bool resync_requested;
   bool syncing;
-  auto request = create_request(
-    mock_state_builder, librbd::mirror::PROMOTION_STATE_PRIMARY,
-    "local mirror uuid", &resync_requested, &syncing, &ctx);
+  auto request = create_request(mock_state_builder, "local mirror uuid",
+                                &resync_requested, &syncing, &ctx);
   request->send();
   ASSERT_EQ(0, ctx.wait());
   ASSERT_FALSE(resync_requested);
@@ -355,9 +349,8 @@ TEST_F(TestMockImageReplayerJournalPrepareReplayRequest, GetRemoteTagClassError)
                                       mirror_peer_client_meta);
   bool resync_requested;
   bool syncing;
-  auto request = create_request(
-    mock_state_builder, librbd::mirror::PROMOTION_STATE_PRIMARY,
-    "local mirror uuid", &resync_requested, &syncing, &ctx);
+  auto request = create_request(mock_state_builder, "local mirror uuid",
+                                &resync_requested, &syncing, &ctx);
   request->send();
   ASSERT_EQ(-EINVAL, ctx.wait());
 }
@@ -401,9 +394,8 @@ TEST_F(TestMockImageReplayerJournalPrepareReplayRequest, GetRemoteTagsError) {
                                       mirror_peer_client_meta);
   bool resync_requested;
   bool syncing;
-  auto request = create_request(
-    mock_state_builder, librbd::mirror::PROMOTION_STATE_PRIMARY,
-    "local mirror uuid", &resync_requested, &syncing, &ctx);
+  auto request = create_request(mock_state_builder, "local mirror uuid",
+                                &resync_requested, &syncing, &ctx);
   request->send();
   ASSERT_EQ(-EINVAL, ctx.wait());
 }
@@ -472,9 +464,8 @@ TEST_F(TestMockImageReplayerJournalPrepareReplayRequest, LocalDemotedRemoteSynci
                                       mirror_peer_client_meta);
   bool resync_requested;
   bool syncing;
-  auto request = create_request(
-    mock_state_builder, librbd::mirror::PROMOTION_STATE_PRIMARY,
-    "local mirror uuid", &resync_requested, &syncing, &ctx);
+  auto request = create_request(mock_state_builder, "local mirror uuid",
+                                &resync_requested, &syncing, &ctx);
   request->send();
   ASSERT_EQ(0, ctx.wait());
   ASSERT_FALSE(resync_requested);
@@ -520,9 +511,8 @@ TEST_F(TestMockImageReplayerJournalPrepareReplayRequest, UpdateClientError) {
                                       mirror_peer_client_meta);
   bool resync_requested;
   bool syncing;
-  auto request = create_request(
-    mock_state_builder, librbd::mirror::PROMOTION_STATE_PRIMARY,
-    "local mirror uuid", &resync_requested, &syncing, &ctx);
+  auto request = create_request(mock_state_builder, "local mirror uuid",
+                                &resync_requested, &syncing, &ctx);
   request->send();
   ASSERT_EQ(0, ctx.wait());
   ASSERT_FALSE(resync_requested);
@@ -577,9 +567,8 @@ TEST_F(TestMockImageReplayerJournalPrepareReplayRequest, RemoteDemotePromote) {
                                       mirror_peer_client_meta);
   bool resync_requested;
   bool syncing;
-  auto request = create_request(
-    mock_state_builder, librbd::mirror::PROMOTION_STATE_PRIMARY,
-    "local mirror uuid", &resync_requested, &syncing, &ctx);
+  auto request = create_request(mock_state_builder, "local mirror uuid",
+                                &resync_requested, &syncing, &ctx);
   request->send();
   ASSERT_EQ(0, ctx.wait());
   ASSERT_FALSE(resync_requested);
@@ -644,9 +633,8 @@ TEST_F(TestMockImageReplayerJournalPrepareReplayRequest, MultipleRemoteDemotePro
                                       mirror_peer_client_meta);
   bool resync_requested;
   bool syncing;
-  auto request = create_request(
-    mock_state_builder, librbd::mirror::PROMOTION_STATE_PRIMARY,
-    "local mirror uuid", &resync_requested, &syncing, &ctx);
+  auto request = create_request(mock_state_builder, "local mirror uuid",
+                                &resync_requested, &syncing, &ctx);
   request->send();
   ASSERT_EQ(0, ctx.wait());
   ASSERT_FALSE(resync_requested);
@@ -699,9 +687,8 @@ TEST_F(TestMockImageReplayerJournalPrepareReplayRequest, LocalDemoteRemotePromot
                                       mirror_peer_client_meta);
   bool resync_requested;
   bool syncing;
-  auto request = create_request(
-    mock_state_builder, librbd::mirror::PROMOTION_STATE_PRIMARY,
-    "local mirror uuid", &resync_requested, &syncing, &ctx);
+  auto request = create_request(mock_state_builder, "local mirror uuid",
+                                &resync_requested, &syncing, &ctx);
   request->send();
   ASSERT_EQ(0, ctx.wait());
   ASSERT_FALSE(resync_requested);
@@ -752,9 +739,8 @@ TEST_F(TestMockImageReplayerJournalPrepareReplayRequest, SplitBrainForcePromote)
                                       mirror_peer_client_meta);
   bool resync_requested;
   bool syncing;
-  auto request = create_request(
-    mock_state_builder, librbd::mirror::PROMOTION_STATE_PRIMARY,
-    "local mirror uuid", &resync_requested, &syncing, &ctx);
+  auto request = create_request(mock_state_builder, "local mirror uuid",
+                                &resync_requested, &syncing, &ctx);
   request->send();
   ASSERT_EQ(-EEXIST, ctx.wait());
 }
index 4538c94a4ad94077365f177d2d70631c676983cb..2b6fb659be3434ae48c1f792e09ea61213d5d833 100644 (file)
@@ -30,20 +30,18 @@ class PrepareReplayRequest : public BaseRequest {
 public:
   static PrepareReplayRequest* create(
       const std::string& local_mirror_uuid,
-      librbd::mirror::PromotionState remote_promotion_state,
       ProgressContext* progress_ctx,
       StateBuilder<ImageCtxT>* state_builder,
       bool* resync_requested,
       bool* syncing,
       Context* on_finish) {
     return new PrepareReplayRequest(
-      local_mirror_uuid, remote_promotion_state, progress_ctx, state_builder,
-      resync_requested, syncing, on_finish);
+      local_mirror_uuid, progress_ctx, state_builder, resync_requested,
+      syncing, on_finish);
   }
 
   PrepareReplayRequest(
       const std::string& local_mirror_uuid,
-      librbd::mirror::PromotionState remote_promotion_state,
       ProgressContext* progress_ctx,
       StateBuilder<ImageCtxT>* state_builder,
       bool* resync_requested,
@@ -51,7 +49,6 @@ public:
       Context* on_finish)
     : BaseRequest(on_finish),
       m_local_mirror_uuid(local_mirror_uuid),
-      m_remote_promotion_state(remote_promotion_state),
       m_progress_ctx(progress_ctx),
       m_state_builder(state_builder),
       m_resync_requested(resync_requested),
@@ -83,7 +80,6 @@ private:
   typedef std::list<cls::journal::Tag> Tags;
 
   std::string m_local_mirror_uuid;
-  librbd::mirror::PromotionState m_remote_promotion_state;
   ProgressContext* m_progress_ctx;
   StateBuilder<ImageCtxT>* m_state_builder;
   bool* m_resync_requested;
index 2c95211d41e12e38501239a3608086e006563ff1..5f1fb0e2f09fc073fbe7567ac06275d1387cd00e 100644 (file)
@@ -97,8 +97,8 @@ BaseRequest* StateBuilder<I>::create_prepare_replay_request(
     bool* syncing,
     Context* on_finish) {
   return PrepareReplayRequest<I>::create(
-    local_mirror_uuid, this->remote_promotion_state, progress_ctx, this,
-    resync_requested, syncing, on_finish);
+    local_mirror_uuid, progress_ctx, this, resync_requested, syncing,
+    on_finish);
 }
 
 template <typename I>
index 315080238f7dcabce9000da3e8a59800695c1ab0..4e9246acd6a99aa2302c0c410fdfe7f0485b4314 100644 (file)
@@ -28,20 +28,18 @@ class PrepareReplayRequest : public BaseRequest {
 public:
   static PrepareReplayRequest* create(
       const std::string& local_mirror_uuid,
-      librbd::mirror::PromotionState remote_promotion_state,
       ProgressContext* progress_ctx,
       StateBuilder<ImageCtxT>* state_builder,
       bool* resync_requested,
       bool* syncing,
       Context* on_finish) {
     return new PrepareReplayRequest(
-      local_mirror_uuid, remote_promotion_state, progress_ctx, state_builder,
-      resync_requested, syncing, on_finish);
+      local_mirror_uuid, progress_ctx, state_builder, resync_requested,
+      syncing, on_finish);
   }
 
   PrepareReplayRequest(
       const std::string& local_mirror_uuid,
-      librbd::mirror::PromotionState remote_promotion_state,
       ProgressContext* progress_ctx,
       StateBuilder<ImageCtxT>* state_builder,
       bool* resync_requested,
@@ -49,7 +47,6 @@ public:
       Context* on_finish)
     : BaseRequest(on_finish),
       m_local_mirror_uuid(local_mirror_uuid),
-      m_remote_promotion_state(remote_promotion_state),
       m_progress_ctx(progress_ctx),
       m_state_builder(state_builder),
       m_resync_requested(resync_requested),
@@ -75,7 +72,6 @@ private:
    */
 
   std::string m_local_mirror_uuid;
-  librbd::mirror::PromotionState m_remote_promotion_state;
   ProgressContext* m_progress_ctx;
   StateBuilder<ImageCtxT>* m_state_builder;
   bool* m_resync_requested;
index 52e64e762f5f1e6b1deb145dbe43747804783ebf..ca3e6918babc8cf0f89e852ff4c598584402f9fe 100644 (file)
@@ -96,8 +96,8 @@ BaseRequest* StateBuilder<I>::create_prepare_replay_request(
     bool* syncing,
     Context* on_finish) {
   return PrepareReplayRequest<I>::create(
-    local_mirror_uuid, this->remote_promotion_state, progress_ctx, this,
-    resync_requested, syncing, on_finish);
+    local_mirror_uuid, progress_ctx, this, resync_requested, syncing,
+    on_finish);
 }
 
 template <typename I>