mon: by default, warn if some members of the quorum are "classic"

Signed-off-by: Greg Farnum <greg@inktank.com>
This commit is contained in:
Greg Farnum 2013-12-10 10:56:33 -08:00
parent ec609cacde
commit 2bfd34ac95
5 changed files with 30 additions and 4 deletions

View 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)

View 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);
}

View 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)

View 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();

View 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)