mgr: add pg_state_ready for pgs show in unknown state

Pgs show the unknown state, when the mgr has just started, use the command ceph pg dump pgs_brief\pgs\...,
because the pgs state has not been reported from the Osd to the Mgr service,
we need to add this state for pgs show. in this way,our management system can judge whether to filter
the unknown pg state based on this flag.

Fixes: http://tracker.ceph.com/issues/25103
Signed-off-by: huanwen ren <ren.huanwen@zte.com.cn>
This commit is contained in:
huanwen ren 2018-08-22 15:07:57 +08:00
parent c25ef2a7ee
commit 95b7d2340c

View File

@ -1998,6 +1998,14 @@ bool DaemonServer::handle_command(MCommand *m)
}
return true;
} else {
if (!pgmap_ready) {
ss << "Warning: due to ceph-mgr restart, some PG states may not be up to date\n";
}
if (f) {
f->open_object_section("pg_info");
f->dump_bool("pg_ready", pgmap_ready);
}
// fall back to feeding command to PGMap
r = cluster_state.with_pgmap([&](const PGMap& pg_map) {
return cluster_state.with_osdmap([&](const OSDMap& osdmap) {
@ -2006,6 +2014,10 @@ bool DaemonServer::handle_command(MCommand *m)
});
});
if (f) {
f->close_section();
f->flush(cmdctx->odata);
}
if (r != -EOPNOTSUPP) {
cmdctx->reply(r, ss);
return true;