finfo.state = MDSMap::STATE_STANDBY_REPLAY;
return true;
}
-
-
-void MDSMonitor::do_stop()
-{
- // hrm...
- if (!mon->is_leader() ||
- !is_active()) {
- dout(0) << "do_stop can't stop right now, mdsmap not writeable" << dendl;
- return;
- }
-
- dout(7) << "do_stop stopping active mds nodes" << dendl;
- print_map(mdsmap);
-
- bool propose_osdmap = false;
-
- map<uint64_t,MDSMap::mds_info_t>::iterator p = pending_mdsmap.mds_info.begin();
- while (p != pending_mdsmap.mds_info.end()) {
- uint64_t gid = p->first;
- MDSMap::mds_info_t& info = p->second;
- ++p;
- switch (info.state) {
- case MDSMap::STATE_ACTIVE:
- case MDSMap::STATE_STOPPING:
- info.state = MDSMap::STATE_STOPPING;
- break;
- case MDSMap::STATE_STARTING:
- pending_mdsmap.stopped.insert(info.rank);
- case MDSMap::STATE_CREATING:
- pending_mdsmap.up.erase(info.rank);
- pending_mdsmap.mds_info.erase(gid);
- pending_mdsmap.in.erase(info.rank);
- break;
- case MDSMap::STATE_REPLAY:
- case MDSMap::STATE_RESOLVE:
- case MDSMap::STATE_RECONNECT:
- case MDSMap::STATE_REJOIN:
- case MDSMap::STATE_CLIENTREPLAY:
- // BUG: hrm, if this is the case, the STOPPING guys won't be able to stop, will they?
- {
- utime_t until = ceph_clock_now(g_ceph_context);
- until += g_conf->mds_blacklist_interval;
- pending_mdsmap.last_failure_osd_epoch = mon->osdmon()->blacklist(info.addr, until);
- propose_osdmap = true;
- }
- pending_mdsmap.failed.insert(info.rank);
- pending_mdsmap.up.erase(info.rank);
- pending_mdsmap.mds_info.erase(gid);
- pending_mdsmap.in.erase(info.rank);
- break;
- }
- }
-
- propose_pending();
- if (propose_osdmap)
- mon->osdmon()->propose_pending();
-}
reply_command(m, 0, rs, rdata, 0);
return;
}
- if (m->cmd[0] == "stop_cluster") {
- if (!access_all) {
- r = -EACCES;
- rs = "access denied";
- goto out;
- }
- stop_cluster();
- reply_command(m, 0, "initiating cluster shutdown", 0);
- return;
- }
if (m->cmd[0] == "injectargs") {
if (!access_all) {
try_send_message(c, inst);
}
-
-void Monitor::stop_cluster()
-{
- dout(0) << "stop_cluster -- initiating shutdown" << dendl;
- mdsmon()->do_stop();
-}
-
-
bool Monitor::_ms_dispatch(Message *m)
{
bool ret = true;