]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mon: by default, warn if some members of the quorum are "classic"
authorGreg Farnum <greg@inktank.com>
Tue, 10 Dec 2013 18:56:33 +0000 (10:56 -0800)
committerGreg Farnum <greg@inktank.com>
Wed, 11 Dec 2013 18:12:56 +0000 (10:12 -0800)
Signed-off-by: Greg Farnum <greg@inktank.com>
src/common/config_opts.h
src/mon/Elector.cc
src/mon/Monitor.cc
src/mon/Monitor.h
src/mon/MonmapMonitor.cc

index 19bccb2e28e807b777d055a639d0493ca76e48aa..2efa65db7227f530926934dcb8f71ccd086ecc95 100644 (file)
@@ -167,6 +167,7 @@ OPTION(mon_osd_nearfull_ratio, OPT_FLOAT, .85) // what % full makes an OSD near
 OPTION(mon_globalid_prealloc, OPT_INT, 100)   // how many globalids to prealloc
 OPTION(mon_osd_report_timeout, OPT_INT, 900)    // grace period before declaring unresponsive OSDs dead
 OPTION(mon_force_standby_active, OPT_BOOL, true) // should mons force standby-replay mds to be active
+OPTION(mon_warn_on_old_mons, OPT_BOOL, true) // should mons set health to WARN if part of quorum is old?
 OPTION(mon_min_osdmap_epochs, OPT_INT, 500)
 OPTION(mon_max_pgmap_epochs, OPT_INT, 500)
 OPTION(mon_max_log_epochs, OPT_INT, 500)
index 25976f25ddffb3922a0f25353c3408228e5e798b..f31ef54c499b32ee03bf77d93a86b7167ffb75ee 100644 (file)
@@ -167,6 +167,8 @@ void Elector::victory()
 
   // decide what command set we're supporting
   bool use_classic_commands = !classic_mons.empty();
+  // keep a copy to share with the monitor; we clear classic_mons in bump_epoch
+  set<int> copy_classic_mons = classic_mons;
   
   cancel_timer();
   
@@ -198,7 +200,7 @@ void Elector::victory()
   }
     
   // tell monitor
-  mon->win_election(epoch, quorum, features, cmds, cmdsize);
+  mon->win_election(epoch, quorum, features, cmds, cmdsize, &copy_classic_mons);
 }
 
 
index 754fc7ceb2707b14d4086af9ebe1d9599b95a8b1..0afb8895aa3913ee58c49e3254d4bec2f40fb53c 100644 (file)
@@ -1501,7 +1501,7 @@ void Monitor::win_standalone_election()
   const MonCommand *my_cmds;
   int cmdsize;
   get_locally_supported_monitor_commands(&my_cmds, &cmdsize);
-  win_election(1, q, CEPH_FEATURES_ALL, my_cmds, cmdsize);
+  win_election(1, q, CEPH_FEATURES_ALL, my_cmds, cmdsize, NULL);
 }
 
 const utime_t& Monitor::get_leader_since() const
@@ -1516,7 +1516,8 @@ epoch_t Monitor::get_epoch()
 }
 
 void Monitor::win_election(epoch_t epoch, set<int>& active, uint64_t features,
-                           const MonCommand *cmdset, int cmdsize)
+                           const MonCommand *cmdset, int cmdsize,
+                           const set<int> *classic_monitors)
 {
   dout(10) << __func__ << " epoch " << epoch << " quorum " << active
           << " features " << features << dendl;
@@ -1532,6 +1533,8 @@ void Monitor::win_election(epoch_t epoch, set<int>& active, uint64_t features,
                << " won leader election with quorum " << quorum << "\n";
 
   set_leader_supported_commands(cmdset, cmdsize);
+  if (classic_monitors)
+    classic_mons = *classic_monitors;
 
   paxos->leader_init();
   for (vector<PaxosService*>::iterator p = paxos_service.begin(); p != paxos_service.end(); ++p)
index bde6a2e00bdc5c9a7196e93be0ea5b61115567f5..4f142b37525c52f5cb934303ba20a55f00117c1d 100644 (file)
@@ -200,6 +200,7 @@ private:
   uint64_t quorum_features;  ///< intersection of quorum member feature bits
   bufferlist supported_commands_bl; // encoded MonCommands we support
   bufferlist classic_commands_bl; // encoded MonCommands supported by Dumpling
+  set<int> classic_mons; // set of "classic" monitors; only valid on leader
 
   set<string> outside_quorum;
 
@@ -532,7 +533,8 @@ public:
   // end election (called by Elector)
   void win_election(epoch_t epoch, set<int>& q,
                    uint64_t features,
-                   const MonCommand *cmdset, int cmdsize);
+                   const MonCommand *cmdset, int cmdsize,
+                   const set<int> *classic_monitors);
   void lose_election(epoch_t epoch, set<int>& q, int l,
                     uint64_t features); // end election (called by Elector)
   void finish_election();
@@ -543,6 +545,9 @@ public:
   const bufferlist& get_classic_commands_bl() {
     return classic_commands_bl;
   }
+  const set<int>& get_classic_mons() {
+    return classic_mons;
+  }
 
   void update_logger();
 
index 2443c7e28721bd808b07f5effea43c2730098bdf..7ecf27152831e57445cac5c817f328fb88bed382 100644 (file)
@@ -450,6 +450,21 @@ void MonmapMonitor::get_health(list<pair<health_status_t, string> >& summary,
       }
     }
   }
+  if (g_conf->mon_warn_on_old_mons && !mon->get_classic_mons().empty()) {
+    ostringstream ss;
+    ss << "some monitors are running older code";
+    summary.push_back(make_pair(HEALTH_WARN, ss.str()));
+    if (detail) {
+      for (set<int>::const_iterator i = mon->get_classic_mons().begin();
+         i != mon->get_classic_mons().end();
+         ++i) {
+       ostringstream ss;
+       ss << "mon." << mon->monmap->get_name(*i)
+            << " only supports the \"classic\" command set";
+       detail->push_back(make_pair(HEALTH_WARN, ss.str()));
+      }
+    }
+  }
 }
 
 int MonmapMonitor::get_monmap(bufferlist &bl)