]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mon: Add leader indicator && stretch mode to ceph -s output
authorKamoltat Sirivadhna <ksirivad@redhat.com>
Tue, 11 Mar 2025 19:18:57 +0000 (19:18 +0000)
committerKamoltat Sirivadhna <ksirivad@redhat.com>
Thu, 13 Mar 2025 21:37:52 +0000 (21:37 +0000)
This commit enhances the ceph -s command output to display:

The current leader monitor in the quorum status line with [leader: <mon-id>] 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 <ksirivad@redhat.com>
src/mon/Monitor.cc

index 9a4e11e5aeb6317f2c2886af508b636a43d3e1d2..4dbface34397efafe24873b2d614d4421d414534 100644 (file)
@@ -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<std::string> out_of_q;
        for (size_t i = 0; i < monmap->ranks.size(); ++i) {