From: Kamoltat Sirivadhna Date: Tue, 11 Mar 2025 19:18:57 +0000 (+0000) Subject: mon: Add leader indicator && stretch mode to ceph -s output X-Git-Tag: v20.3.0~175^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=5f452e2ebb292ab7e692af9885f63fe8e1656a1b;p=ceph.git mon: Add leader indicator && stretch mode to ceph -s output This commit enhances the ceph -s command output to display: The current leader monitor in the quorum status line with [leader: ] format to provide immediate visibility into which monitor is making decisions The stretch mode status in the cluster section, showing stretch_mode: ENABLED when the cluster is operating in stretch mode. Example output: ``` cluster: id: e79711f4-0024-4737-83e0-5020f15cf7e0 stretch_mode: ENABLED health: HEALTH_OK services: mon: 3 daemons, quorum a,b,c (age 4m) [leader: a] ``` Fixes: https://tracker.ceph.com/issues/70406 Signed-off-by: Kamoltat Sirivadhna --- diff --git a/src/mon/Monitor.cc b/src/mon/Monitor.cc index 9a4e11e5aeb..4dbface3439 100644 --- a/src/mon/Monitor.cc +++ b/src/mon/Monitor.cc @@ -3106,7 +3106,9 @@ void Monitor::get_cluster_status(stringstream &ss, Formatter *f, } else { ss << " cluster:\n"; ss << " id: " << monmap->get_fsid() << "\n"; - + if (is_stretch_mode()){ + ss << " stretch_mode: ENABLED\n"; + } string health; healthmon()->get_health_status(false, nullptr, &health, "\n ", "\n "); @@ -3139,7 +3141,8 @@ void Monitor::get_cluster_status(stringstream &ss, Formatter *f, const auto mon_count = monmap->mon_info.size(); auto mnow = ceph::mono_clock::now(); ss << " mon: " << spacing << mon_count << " daemons, quorum " - << quorum_names << " (age " << timespan_str(mnow - quorum_since) << ")"; + << quorum_names << " (age " << timespan_str(mnow - quorum_since) << ")" + << " [leader: " << get_leader_name() << "]"; if (quorum_names.size() != mon_count) { std::list out_of_q; for (size_t i = 0; i < monmap->ranks.size(); ++i) {