Description: Disable network stats in dump_osd_stats In a large cluster with huge number of OSDs, receiving all network stats from all OSDs make the ceph-mgr unresponsive and make it effectively "hang" as it doesn't respond to any user queries. So disabling it inline with upstream fix. Upstream rejected backports to Luminous and Mimic as they are both EOL'ed. But we backport to both. Author: Ponnuvel Palaniyappan, ponnuvel.palaniyappan@canonical.com Origin: backport, https://github.com/ceph/ceph/pull/32406/files Bug: https://tracker.ceph.com/issues/43364 --- This patch header follows DEP-3: http://dep.debian.net/deps/dep3/ Index: ceph-13.2.9/src/mgr/ActivePyModules.cc =================================================================== --- ceph-13.2.9.orig/src/mgr/ActivePyModules.cc +++ ceph-13.2.9/src/mgr/ActivePyModules.cc @@ -283,7 +283,7 @@ PyObject *ActivePyModules::get_python(co PyFormatter f; cluster_state.with_pgmap( [&f](const PGMap &pg_map) { - pg_map.dump(&f); + pg_map.dump(&f, false); } ); return f.get(); @@ -310,7 +310,7 @@ PyObject *ActivePyModules::get_python(co PyFormatter f; cluster_state.with_pgmap( [&f](const PGMap &pg_map) { - pg_map.dump_osd_stats(&f); + pg_map.dump_osd_stats(&f, false); }); return f.get(); } else if (what == "osd_pool_stats") { Index: ceph-13.2.9/src/mon/PGMap.cc =================================================================== --- ceph-13.2.9.orig/src/mon/PGMap.cc +++ ceph-13.2.9/src/mon/PGMap.cc @@ -1367,12 +1367,12 @@ void PGMap::decode(bufferlist::iterator calc_stats(); } -void PGMap::dump(Formatter *f) const +void PGMap::dump(Formatter *f, bool with_net) const { dump_basic(f); dump_pg_stats(f, false); dump_pool_stats(f); - dump_osd_stats(f); + dump_osd_stats(f, with_net); } void PGMap::dump_basic(Formatter *f) const @@ -1435,7 +1435,7 @@ void PGMap::dump_pool_stats(Formatter *f f->close_section(); } -void PGMap::dump_osd_stats(Formatter *f) const +void PGMap::dump_osd_stats(Formatter *f, bool with_net) const { f->open_array_section("osd_stats"); for (auto q = osd_stat.begin(); @@ -1443,7 +1443,7 @@ void PGMap::dump_osd_stats(Formatter *f) ++q) { f->open_object_section("osd_stat"); f->dump_int("osd", q->first); - q->second.dump(f); + q->second.dump(f, with_net); f->close_section(); } f->close_section(); Index: ceph-13.2.9/src/mon/PGMap.h =================================================================== --- ceph-13.2.9.orig/src/mon/PGMap.h +++ ceph-13.2.9/src/mon/PGMap.h @@ -396,11 +396,11 @@ public: int64_t get_rule_avail(const OSDMap& osdmap, int ruleno) const; void get_rules_avail(const OSDMap& osdmap, std::map *avail_map) const; - void dump(Formatter *f) const; + void dump(Formatter *f, bool with_net = true) const; void dump_basic(Formatter *f) const; void dump_pg_stats(Formatter *f, bool brief) const; void dump_pool_stats(Formatter *f) const; - void dump_osd_stats(Formatter *f) const; + void dump_osd_stats(Formatter *f, bool with_net = true) const; void dump_delta(Formatter *f) const; void dump_filtered_pg_stats(Formatter *f, set& pgs) const; void dump_pool_stats_full(const OSDMap &osd_map, stringstream *ss, Index: ceph-13.2.9/src/osd/osd_types.cc =================================================================== --- ceph-13.2.9.orig/src/osd/osd_types.cc +++ ceph-13.2.9/src/osd/osd_types.cc @@ -336,7 +336,7 @@ void objectstore_perf_stat_t::generate_t } // -- osd_stat_t -- -void osd_stat_t::dump(Formatter *f) const +void osd_stat_t::dump(Formatter *f, bool with_net) const { f->dump_unsigned("up_from", up_from); f->dump_unsigned("seq", seq); @@ -359,6 +359,7 @@ void osd_stat_t::dump(Formatter *f) cons f->open_object_section("perf_stat"); os_perf_stat.dump(f); f->close_section(); + if (with_net) { f->open_array_section("network_ping_times"); for (auto &i : hb_pingtime) { f->open_object_section("entry"); @@ -414,6 +415,7 @@ void osd_stat_t::dump(Formatter *f) cons f->close_section(); // entry } f->close_section(); // network_ping_time + } } void osd_stat_t::encode(bufferlist &bl, uint64_t features) const Index: ceph-13.2.9/src/osd/osd_types.h =================================================================== --- ceph-13.2.9.orig/src/osd/osd_types.h +++ ceph-13.2.9/src/osd/osd_types.h @@ -973,7 +973,7 @@ struct osd_stat_t { num_pgs -= o.num_pgs; } - void dump(Formatter *f) const; + void dump(Formatter *f, bool with_net = true) const; void encode(bufferlist &bl, uint64_t features) const; void decode(bufferlist::iterator &bl); static void generate_test_instances(std::list& o);