summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSage Weil <sage@newdream.net>2009-11-23 15:42:03 -0800
committerSage Weil <sage@newdream.net>2009-11-24 19:02:05 -0800
commitfd21693fa6b8bf33fc214248730610a8b9730c97 (patch)
treec4396bce914386cbb6ccd2c95de2f5f06ea8f2fd
parent1ac56b7d7a533714dba62d36e7f0897d0d068afe (diff)
downloadceph-fd21693fa6b8bf33fc214248730610a8b9730c97.tar.gz
mon: add 'mds set_state <gid> <stateid>'
For mdsmon disaster recovery :)
-rw-r--r--src/mon/MDSMonitor.cc14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/mon/MDSMonitor.cc b/src/mon/MDSMonitor.cc
index acc2151217a..43763a5a6e8 100644
--- a/src/mon/MDSMonitor.cc
+++ b/src/mon/MDSMonitor.cc
@@ -501,6 +501,20 @@ bool MDSMonitor::prepare_command(MMonCommand *m)
//} else
//ss << "mdsmap fsid " << map.fsid << " does not match monitor fsid " << mon->monmap->fsid;
}
+ else if (m->cmd[1] == "set_state" && m->cmd.size() == 4) {
+ __u64 gid = atoi(m->cmd[2].c_str());
+ int state = atoi(m->cmd[3].c_str());
+ if (!pending_mdsmap.is_dne_gid(gid)) {
+ MDSMap::mds_info_t& info = pending_mdsmap.get_info_gid(gid);
+ info.state = state;
+ stringstream ss;
+ ss << "set mds gid " << gid << " to state " << state << " " << ceph_mds_state_name(state);
+ string rs;
+ getline(ss, rs);
+ paxos->wait_for_commit(new Monitor::C_Command(mon, m, 0, rs, paxos->get_version()));
+ return true;
+ }
+ }
}
if (r == -EINVAL)
ss << "unrecognized command";