From 3e7c185bd4b2312f9801b8664fb175801c904871 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Mon, 5 Aug 2019 09:38:28 -0500 Subject: [PATCH] mon: make mon summary more concise in 'ceph -s' Signed-off-by: Sage Weil --- PendingReleaseNotes | 5 +++-- src/mon/MonMap.cc | 8 ++++++++ src/mon/MonMap.h | 1 + src/mon/Monitor.cc | 2 +- 4 files changed, 13 insertions(+), 3 deletions(-) diff --git a/PendingReleaseNotes b/PendingReleaseNotes index 8d8a39cd1a746..093e28825d7e0 100644 --- a/PendingReleaseNotes +++ b/PendingReleaseNotes @@ -101,5 +101,6 @@ on all osds, or provided osds, thus simplifying the process of having to parse `osd dump` for the same information. -* The `mgrmap` metadata included in the structured ``ceph status`` (``ceph -s``) - output is now more concise. \ No newline at end of file +* The structured output of ``ceph status`` or ``ceph -s`` is now more + concise, particularly the `mgrmap` and `monmap` sections, and the + structure of the `osdmap` section has been cleaned up. diff --git a/src/mon/MonMap.cc b/src/mon/MonMap.cc index 849349968a7a6..90d1ca54daf43 100644 --- a/src/mon/MonMap.cc +++ b/src/mon/MonMap.cc @@ -356,6 +356,14 @@ void MonMap::dump(Formatter *f) const f->close_section(); } +void MonMap::dump_summary(Formatter *f) const +{ + f->dump_unsigned("epoch", epoch); + f->dump_string("min_mon_release_name", ceph::to_string(min_mon_release)); + f->dump_unsigned("num_mons", ranks.size()); +} + + // an ambiguous mon addr may be legacy or may be msgr2--we aren' sure. // when that happens we need to try them both (unless we can // reasonably infer from the port number which it is). diff --git a/src/mon/MonMap.h b/src/mon/MonMap.h index ab7fd12ab7b60..0432b4e83d5ac 100644 --- a/src/mon/MonMap.h +++ b/src/mon/MonMap.h @@ -452,6 +452,7 @@ public: void print(std::ostream& out) const; void print_summary(std::ostream& out) const; void dump(ceph::Formatter *f) const; + void dump_summary(ceph::Formatter *f) const; static void generate_test_instances(std::list& o); protected: diff --git a/src/mon/Monitor.cc b/src/mon/Monitor.cc index 6bf7d08172446..713dbe0407521 100644 --- a/src/mon/Monitor.cc +++ b/src/mon/Monitor.cc @@ -2950,7 +2950,7 @@ void Monitor::get_cluster_status(stringstream &ss, Formatter *f) mono_clock::now() - quorum_since).count()); } f->open_object_section("monmap"); - monmap->dump(f); + monmap->dump_summary(f); f->close_section(); f->open_object_section("osdmap"); osdmon()->osdmap.print_summary(f, cout, string(12, ' ')); -- 2.39.5