rbd-mirror: instance replayer now respects manual stop command

Signed-off-by: Jason Dillaman <dillaman@redhat.com>
This commit is contained in:
Jason Dillaman 2018-05-03 12:03:01 -04:00
parent 53b87b9d22
commit 06e1244ee5
2 changed files with 12 additions and 0 deletions

View File

@ -309,6 +309,8 @@ void InstanceReplayer<I>::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);

View File

@ -550,6 +550,14 @@ void PoolReplayer<I>::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<I>::start()
return;
}
m_manual_stop = false;
m_instance_replayer->start();
}
@ -617,6 +626,7 @@ void PoolReplayer<I>::stop(bool manual)
return;
}
m_manual_stop = true;
m_instance_replayer->stop();
}