From ee55a8ca059c69ce66785bd690db9d98ed2ba628 Mon Sep 17 00:00:00 2001 From: Arthur Outhenin-Chalandre Date: Wed, 28 Jul 2021 14:14:47 +0200 Subject: [PATCH] rbd-mirror: fix bootstrap sequence while the image is removed If the image is being removed the PrepareRemoteImageRequest was returning the same error if the image was disabled or non primary which doesn't allow the BootstrapRequest to have the correct error handling. This commit fix this behavior by considering that the remote image is already deleted if the image is in disabling state. Signed-off-by: Arthur Outhenin-Chalandre (cherry picked from commit ff60aec2d9efa1842383ba0a5c3bd6b5a29389c6) --- src/test/rbd_mirror/test_ImageReplayer.cc | 2 +- .../rbd_mirror/image_replayer/PrepareRemoteImageRequest.cc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/test/rbd_mirror/test_ImageReplayer.cc b/src/test/rbd_mirror/test_ImageReplayer.cc index cb21fc723961..76a6919d5adb 100644 --- a/src/test/rbd_mirror/test_ImageReplayer.cc +++ b/src/test/rbd_mirror/test_ImageReplayer.cc @@ -664,7 +664,7 @@ TYPED_TEST(TestImageReplayer, BootstrapMirrorDisabling) this->create_replayer(); C_SaferCond cond; this->m_replayer->start(&cond); - ASSERT_EQ(-EREMOTEIO, cond.wait()); + ASSERT_EQ(-ENOENT, cond.wait()); ASSERT_TRUE(this->m_replayer->is_stopped()); } diff --git a/src/tools/rbd_mirror/image_replayer/PrepareRemoteImageRequest.cc b/src/tools/rbd_mirror/image_replayer/PrepareRemoteImageRequest.cc index 54a9dbf1650d..08d3dd7806fc 100644 --- a/src/tools/rbd_mirror/image_replayer/PrepareRemoteImageRequest.cc +++ b/src/tools/rbd_mirror/image_replayer/PrepareRemoteImageRequest.cc @@ -112,7 +112,7 @@ void PrepareRemoteImageRequest::handle_get_mirror_info(int r) { return; } else if (m_mirror_image.state == cls::rbd::MIRROR_IMAGE_STATE_DISABLING) { dout(5) << "remote image mirroring is being disabled" << dendl; - finish(-EREMOTEIO); + finish(-ENOENT); return; } else if (m_promotion_state != librbd::mirror::PROMOTION_STATE_PRIMARY && (state_builder == nullptr || -- 2.47.3