From 69b764a8d30587c4f800d0ec5942a1978f702ba7 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Sun, 17 Oct 2010 20:04:32 -0700 Subject: [PATCH] mon: add 'mds rm ' and 'mds rmfailed ' commands For cleaning up the mds map when things get weird. Signed-off-by: Sage Weil --- src/mon/MDSMonitor.cc | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/mon/MDSMonitor.cc b/src/mon/MDSMonitor.cc index 642d9f17076..ca47b855356 100644 --- a/src/mon/MDSMonitor.cc +++ b/src/mon/MDSMonitor.cc @@ -608,6 +608,26 @@ bool MDSMonitor::prepare_command(MMonCommand *m) paxos->wait_for_commit(new Monitor::C_Command(mon, m, 0, rs, paxos->get_version())); return true; } + else if (m->cmd[1] == "rm" && m->cmd.size() == 3) { + uint64_t gid = atoll(m->cmd[2].c_str()); + pending_mdsmap.mds_info.erase(gid); + stringstream ss; + ss << "removed mds gid " << gid; + string rs; + getline(ss, rs); + paxos->wait_for_commit(new Monitor::C_Command(mon, m, 0, rs, paxos->get_version())); + return true; + } + else if (m->cmd[1] == "rmfailed" && m->cmd.size() == 3) { + int w = atoi(m->cmd[2].c_str()); + pending_mdsmap.failed.erase(w); + stringstream ss; + ss << "removed failed mds" << w; + string rs; + getline(ss, rs); + paxos->wait_for_commit(new Monitor::C_Command(mon, m, 0, rs, paxos->get_version())); + return true; + } else if (m->cmd[1] == "compat" && m->cmd.size() == 4) { uint64_t f = atoll(m->cmd[3].c_str()); if (m->cmd[2] == "rm_compat") {