]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
rbd-mirror: ImageReplayer doesn't need image deleted callback
authorJason Dillaman <dillaman@redhat.com>
Mon, 27 Jun 2016 13:45:25 +0000 (09:45 -0400)
committerJason Dillaman <dillaman@redhat.com>
Tue, 28 Jun 2016 13:08:47 +0000 (09:08 -0400)
The Replayer will detect that the ImageReplayer is stopped and will
schedule the "wait for deleted" callback before attempting to
restart the ImageReplayer.

Signed-off-by: Jason Dillaman <dillaman@redhat.com>
src/test/rbd_mirror/test_ImageReplayer.cc
src/tools/rbd_mirror/ImageReplayer.cc

index 1877ded6809218a39d575960fd59623b6f6f44b4..dd8e367c3f73da0ac3db1605d9efb5b4e12dc432 100644 (file)
@@ -576,6 +576,11 @@ TEST_F(TestImageReplayer, Resync)
   m_replayer->resync_image(&ctx);
   ASSERT_EQ(0, ctx.wait());
 
+  C_SaferCond delete_ctx;
+  m_image_deleter->wait_for_scheduled_deletion(
+    m_replayer->get_local_image_name(), &delete_ctx);
+  EXPECT_EQ(0, delete_ctx.wait());
+
   C_SaferCond cond;
   m_replayer->start(&cond);
   ASSERT_EQ(0, cond.wait());
@@ -636,6 +641,11 @@ TEST_F(TestImageReplayer, Resync_While_Stop)
 
   ASSERT_TRUE(m_replayer->is_stopped());
 
+  C_SaferCond delete_ctx;
+  m_image_deleter->wait_for_scheduled_deletion(
+    m_replayer->get_local_image_name(), &delete_ctx);
+  EXPECT_EQ(0, delete_ctx.wait());
+
   C_SaferCond cond3;
   m_replayer->start(&cond3);
   ASSERT_EQ(0, cond3.wait());
@@ -672,6 +682,11 @@ TEST_F(TestImageReplayer, Resync_StartInterrupted)
 
   ASSERT_TRUE(m_replayer->is_stopped());
 
+  C_SaferCond delete_ctx;
+  m_image_deleter->wait_for_scheduled_deletion(
+    m_replayer->get_local_image_name(), &delete_ctx);
+  EXPECT_EQ(0, delete_ctx.wait());
+
   C_SaferCond cond2;
   m_replayer->start(&cond2);
   ASSERT_EQ(0, cond2.wait());
index eee697f46631628c39a1407d74b7b2f3176baba8..a6143085b9aeb73fec63b55cef0063ac6fd2abb9 100644 (file)
@@ -1348,15 +1348,6 @@ void ImageReplayer<I>::handle_shut_down(int r, Context *on_start) {
                                              m_local_image_name,
                                              m_global_image_id);
       m_stopping_for_resync = false;
-
-      FunctionContext *ctx = new FunctionContext(
-          [this, r, on_start] (int r) {
-            handle_shut_down(r, on_start);
-          }
-      );
-      m_image_deleter->wait_for_scheduled_deletion(m_local_image_name,
-                                                   ctx, false);
-      return;
     }
   }