From 06e1244ee53640edbbab0168d3050152d048d681 Mon Sep 17 00:00:00 2001 From: Jason Dillaman Date: Thu, 3 May 2018 12:03:01 -0400 Subject: [PATCH] rbd-mirror: instance replayer now respects manual stop command Signed-off-by: Jason Dillaman --- src/tools/rbd_mirror/InstanceReplayer.cc | 2 ++ src/tools/rbd_mirror/PoolReplayer.cc | 10 ++++++++++ 2 files changed, 12 insertions(+) diff --git a/src/tools/rbd_mirror/InstanceReplayer.cc b/src/tools/rbd_mirror/InstanceReplayer.cc index 95307b8291b..b4e12aa6fea 100644 --- a/src/tools/rbd_mirror/InstanceReplayer.cc +++ b/src/tools/rbd_mirror/InstanceReplayer.cc @@ -309,6 +309,8 @@ void InstanceReplayer::start_image_replayer( m_image_replayers.erase(image_replayer->get_global_image_id()); image_replayer->destroy(); return; + } else if (m_manual_stop) { + return; } image_replayer->start(nullptr, false); diff --git a/src/tools/rbd_mirror/PoolReplayer.cc b/src/tools/rbd_mirror/PoolReplayer.cc index ba0cad4669d..df66778393c 100644 --- a/src/tools/rbd_mirror/PoolReplayer.cc +++ b/src/tools/rbd_mirror/PoolReplayer.cc @@ -550,6 +550,14 @@ void PoolReplayer::print_status(Formatter *f, stringstream *ss) f->dump_stream("peer") << m_peer; f->dump_string("instance_id", m_instance_watcher->get_instance_id()); + std::string state("running"); + if (m_manual_stop) { + state = "stopped (manual)"; + } else if (m_stopping) { + state = "stopped"; + } + f->dump_string("state", state); + std::string leader_instance_id; m_leader_watcher->get_leader_instance_id(&leader_instance_id); f->dump_string("leader_instance_id", leader_instance_id); @@ -600,6 +608,7 @@ void PoolReplayer::start() return; } + m_manual_stop = false; m_instance_replayer->start(); } @@ -617,6 +626,7 @@ void PoolReplayer::stop(bool manual) return; } + m_manual_stop = true; m_instance_replayer->stop(); }