From: xie xingguo Date: Mon, 16 Dec 2019 11:07:46 +0000 (+0800) Subject: mon/PGMap: include per-pool num_pg_by_state in summary X-Git-Tag: v15.1.0~395^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=7edfae2b11e4c32120bda7d65f563ad2ed27096c;p=ceph.git mon/PGMap: include per-pool num_pg_by_state in summary 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 --- diff --git a/src/mon/PGMap.cc b/src/mon/PGMap.cc index 722e61f5d74b..3bedf754f215 100644 --- a/src/mon/PGMap.cc +++ b/src/mon/PGMap.cc @@ -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, diff --git a/src/mon/PGMap.h b/src/mon/PGMap.h index 20c1cac2777a..3771194dbbf9 100644 --- a/src/mon/PGMap.h +++ b/src/mon/PGMap.h @@ -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& o); };