]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mon/PGMap: include per-pool num_pg_by_state in summary
authorxie xingguo <xie.xingguo@zte.com.cn>
Mon, 16 Dec 2019 11:07:46 +0000 (19:07 +0800)
committerxie xingguo <xie.xingguo@zte.com.cn>
Tue, 17 Dec 2019 09:17:33 +0000 (17:17 +0800)
We had this globally, but it's useful to have the per-pool breakdowns,
especially when we don't want to pull the detail pg-map down to figure
it out..

Signed-off-by: xie xingguo <xie.xingguo@zte.com.cn>
src/mon/PGMap.cc
src/mon/PGMap.h

index 722e61f5d74b91075777dba8171f98958db444bb..3bedf754f21534bb9e37e3a4c850792725f44853 100644 (file)
@@ -3381,6 +3381,28 @@ void PGMap::get_health_checks(
   }
 }
 
+void PGMap::print_summary(ceph::Formatter *f, ostream *out) const
+{
+  if (f) {
+    f->open_array_section("pgs_by_pool_state");
+    for (auto& i: num_pg_by_pool_state) {
+      f->open_object_section("per_pool_pgs_by_state");
+      f->dump_int("pool_id", i.first);
+      f->open_array_section("pg_state_counts");
+      for (auto& j : i.second) {
+        f->open_object_section("pg_state_count");
+        f->dump_string("state_name", pg_state_string(j.first));
+        f->dump_int("count", j.second);
+        f->close_section();
+      }
+      f->close_section();
+      f->close_section();
+    }
+    f->close_section();
+  }
+  PGMapDigest::print_summary(f, out);
+}
+
 int process_pg_map_command(
   const string& orig_prefix,
   const cmdmap_t& orig_cmdmap,
index 20c1cac2777a40726a823c9879fbc396d6dc3e58..3771194dbbf9be8eed7d33d1eac05a623b432cd1 100644 (file)
@@ -495,6 +495,7 @@ public:
     CephContext *cct,
     const OSDMap& osdmap,
     health_check_map_t *checks) const;
+  void print_summary(ceph::Formatter *f, ostream *out) const;
 
   static void generate_test_instances(std::list<PGMap*>& o);
 };