]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
mgr: add pg_state_ready for pgs show in unknown state
authorhuanwen ren <ren.huanwen@zte.com.cn>
Wed, 22 Aug 2018 07:07:57 +0000 (15:07 +0800)
committerhuanwen ren <ren.huanwen@zte.com.cn>
Thu, 27 Sep 2018 15:22:40 +0000 (23:22 +0800)
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>
src/mgr/DaemonServer.cc

index ebdacaf69011a675e04421302e04e9ee9d63b352..4a3c88360bf0ccdf7d9379d9785e59cfc97b058d 100644 (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;