From: Greg Farnum Date: Tue, 10 Dec 2013 18:56:33 +0000 (-0800) Subject: mon: by default, warn if some members of the quorum are "classic" X-Git-Tag: v0.75~125^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=2bfd34ac9504cfbeff5b632a6adab9755054af7f;p=ceph.git mon: by default, warn if some members of the quorum are "classic" Signed-off-by: Greg Farnum --- diff --git a/src/common/config_opts.h b/src/common/config_opts.h index 19bccb2e28e8..2efa65db7227 100644 --- a/src/common/config_opts.h +++ b/src/common/config_opts.h @@ -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) diff --git a/src/mon/Elector.cc b/src/mon/Elector.cc index 25976f25ddff..f31ef54c499b 100644 --- a/src/mon/Elector.cc +++ b/src/mon/Elector.cc @@ -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 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, ©_classic_mons); } diff --git a/src/mon/Monitor.cc b/src/mon/Monitor.cc index 754fc7ceb270..0afb8895aa39 100644 --- a/src/mon/Monitor.cc +++ b/src/mon/Monitor.cc @@ -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& active, uint64_t features, - const MonCommand *cmdset, int cmdsize) + const MonCommand *cmdset, int cmdsize, + const set *classic_monitors) { dout(10) << __func__ << " epoch " << epoch << " quorum " << active << " features " << features << dendl; @@ -1532,6 +1533,8 @@ void Monitor::win_election(epoch_t epoch, set& 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::iterator p = paxos_service.begin(); p != paxos_service.end(); ++p) diff --git a/src/mon/Monitor.h b/src/mon/Monitor.h index bde6a2e00bdc..4f142b37525c 100644 --- a/src/mon/Monitor.h +++ b/src/mon/Monitor.h @@ -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 classic_mons; // set of "classic" monitors; only valid on leader set outside_quorum; @@ -532,7 +533,8 @@ public: // end election (called by Elector) void win_election(epoch_t epoch, set& q, uint64_t features, - const MonCommand *cmdset, int cmdsize); + const MonCommand *cmdset, int cmdsize, + const set *classic_monitors); void lose_election(epoch_t epoch, set& 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& get_classic_mons() { + return classic_mons; + } void update_logger(); diff --git a/src/mon/MonmapMonitor.cc b/src/mon/MonmapMonitor.cc index 2443c7e28721..7ecf27152831 100644 --- a/src/mon/MonmapMonitor.cc +++ b/src/mon/MonmapMonitor.cc @@ -450,6 +450,21 @@ void MonmapMonitor::get_health(list >& 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::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)