]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mon: add 'mds set_state <gid> <stateid>'
authorSage Weil <sage@newdream.net>
Mon, 23 Nov 2009 23:42:03 +0000 (15:42 -0800)
committerSage Weil <sage@newdream.net>
Wed, 25 Nov 2009 03:02:05 +0000 (19:02 -0800)
For mdsmon disaster recovery :)

src/mon/MDSMonitor.cc

index acc2151217acd0336d1e6d502d139667179ae21b..43763a5a6e8d9615e61a27412ce0b1f56795ebc9 100644 (file)
@@ -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";