]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mon: add 'features' command to show connected client features
authorSage Weil <sage@redhat.com>
Tue, 30 May 2017 20:37:22 +0000 (16:37 -0400)
committerSage Weil <sage@redhat.com>
Wed, 7 Jun 2017 03:11:30 +0000 (23:11 -0400)
for whole mon cluster

Signed-off-by: Sage Weil <sage@redhat.com>
src/mon/MonCommands.h
src/mon/Monitor.cc
src/mon/Monitor.h

index 610564ff11de5fabeb13225665a92ad3d1a6a7d1..d42b59d7e95907160a4ac0eadce707553f7b54fc 100644 (file)
@@ -206,6 +206,8 @@ COMMAND("df name=detail,type=CephChoices,strings=detail,req=false", \
 COMMAND("report name=tags,type=CephString,n=N,req=false", \
        "report full status of cluster, optional title tag strings", \
        "mon", "r", "cli,rest")
+COMMAND("features", "report of connected features", \
+        "mon", "r", "cli,rest")
 COMMAND("quorum_status", "report status of monitor quorum", \
        "mon", "r", "cli,rest")
 
index 061f0d69b2d6e80dbd18a5df0c656c532a397d08..03346133a7f949fae83e2ccf0e76b34cbd8836b9 100644 (file)
@@ -2112,6 +2112,16 @@ void Monitor::calc_quorum_requirements()
   dout(10) << __func__ << " required_features " << required_features << dendl;
 }
 
+void Monitor::get_combined_feature_map(FeatureMap *fm)
+{
+  *fm += session_map.feature_map;
+  for (auto id : quorum) {
+    if (id != rank) {
+      *fm += quorum_feature_map[id];
+    }
+  }
+}
+
 void Monitor::sync_force(Formatter *f, ostream& ss)
 {
   bool free_formatter = false;
@@ -3145,6 +3155,24 @@ void Monitor::handle_command(MonOpRequestRef op)
     rdata.append(ds);
     rs = "";
     r = 0;
+  } else if (prefix == "features") {
+    if (!is_leader() && !is_peon()) {
+      dout(10) << " waiting for quorum" << dendl;
+      waitfor_quorum.push_back(new C_RetryMessage(this, op));
+      return;
+    }
+    if (!is_leader()) {
+      forward_request_leader(op);
+      return;
+    }
+    if (!f)
+      f.reset(Formatter::create("json-pretty"));
+    FeatureMap fm;
+    get_combined_feature_map(&fm);
+    f->dump_object("features", fm);
+    f->flush(rdata);
+    rs = "";
+    r = 0;
   } else if (prefix == "mon metadata") {
     if (!f)
       f.reset(Formatter::create("json-pretty"));
index 39b23517a1fabd25f5f354626b73542fabd84f91..e0e93140d3e42c8cb4a49847230f4b1f34839614 100644 (file)
@@ -576,6 +576,8 @@ public:
   void apply_monmap_to_compatset_features();
   void calc_quorum_requirements();
 
+  void get_combined_feature_map(FeatureMap *fm);
+
 private:
   void _reset();   ///< called from bootstrap, start_, or join_election
   void wait_for_paxos_write();