From 1f73875c114f23f84d11230aaeebb7a434d94384 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 (cherry picked from commit 3e7c185bd4b2312f9801b8664fb175801c904871) Conflicts: PendingReleaseNotes - drop already published release notes src/mon/MonMap.cc - change ceph::to_string to std::to_string --- PendingReleaseNotes | 9 +++------ src/mon/MonMap.cc | 8 ++++++++ src/mon/MonMap.h | 1 + src/mon/Monitor.cc | 2 +- 4 files changed, 13 insertions(+), 7 deletions(-) diff --git a/PendingReleaseNotes b/PendingReleaseNotes index b626ee5fd19..1722a43bfaf 100644 --- a/PendingReleaseNotes +++ b/PendingReleaseNotes @@ -4,9 +4,6 @@ * MGR: progress module can now be turned on/off, using the commands: ``ceph progress on`` and ``ceph progress off``. -14.2.13 -------- - -* This release fixes a regression introduced in 14.2.12 which broke deployments - that referred to MON hosts using DNS names instead of IP addresses in the - ``mon_host`` parameter in ``/etc/ceph/ceph.conf``. +* 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 64179a53cb9..9458ad1cc90 100644 --- a/src/mon/MonMap.cc +++ b/src/mon/MonMap.cc @@ -360,6 +360,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", std::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 25403923e21..522f4edaf62 100644 --- a/src/mon/MonMap.h +++ b/src/mon/MonMap.h @@ -433,6 +433,7 @@ public: void print(ostream& out) const; void print_summary(ostream& out) const; void dump(ceph::Formatter *f) const; + void dump_summary(ceph::Formatter *f) const; static void generate_test_instances(list& o); protected: diff --git a/src/mon/Monitor.cc b/src/mon/Monitor.cc index a01cd522702..793031d21c6 100644 --- a/src/mon/Monitor.cc +++ b/src/mon/Monitor.cc @@ -2955,7 +2955,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.47.3