If a daemon is removed from daemon_state it is still present in the
service map. So when 'service status' iterates daemons from service map,
it may not find it in daemon_state. Use pending_service_map instead
when building daemons lists, which is up ot date with daemon_state.
Fixes: http://tracker.ceph.com/issues/36656
Signed-off-by: Mykola Golub <mgolub@suse.com>
f.reset(Formatter::create("json-pretty"));
// only include state from services that are in the persisted service map
f->open_object_section("service_status");
- ServiceMap s;
- cluster_state.with_servicemap([&](const ServiceMap& service_map) {
- s = service_map;
- });
- for (auto& p : s.services) {
+ for (auto& p : pending_service_map.services) {
f->open_object_section(p.first.c_str());
for (auto& q : p.second.daemons) {
f->open_object_section(q.first.c_str());