]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mon: blacklist and update last_failure_osd_epoch in all failure paths
authorSage Weil <sage@newdream.net>
Thu, 4 Nov 2010 05:20:25 +0000 (22:20 -0700)
committerSage Weil <sage@newdream.net>
Thu, 4 Nov 2010 05:28:56 +0000 (22:28 -0700)
This includes the pure failure in do_stop(), and the explicit admin
fail command.

Signed-off-by: Sage Weil <sage@newdream.net>
src/mon/MDSMonitor.cc

index 213fe215183dd5e7f7322eebeee6326dcacc665a..cb3777d0d88b3f3c566a6031bce34e80efa1ea30 100644 (file)
@@ -599,6 +599,15 @@ bool MDSMonitor::prepare_command(MMonCommand *m)
     }
     else if (m->cmd[1] == "fail" && m->cmd.size() == 3) {
       int w = atoi(m->cmd[2].c_str());
+
+      if (pending_mdsmap.up.count(w) &&
+         pending_mdsmap.mds_info.count(pending_mdsmap.up[w])) {
+       utime_t until = g_clock.now();
+       until += g_conf.mds_blacklist_interval;
+       MDSMap::mds_info_t& info = pending_mdsmap.mds_info[pending_mdsmap.up[w]];
+       pending_mdsmap.last_failure_osd_epoch = mon->osdmon()->blacklist(info.addr, until);
+       mon->osdmon()->propose_pending();
+      }
       pending_mdsmap.failed.insert(w);
       pending_mdsmap.up.erase(w);
       stringstream ss;
@@ -936,6 +945,8 @@ void MDSMonitor::do_stop()
   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;
@@ -959,6 +970,12 @@ void MDSMonitor::do_stop()
     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 = g_clock.now();
+       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);
@@ -968,4 +985,6 @@ void MDSMonitor::do_stop()
   }
 
   propose_pending();
+  if (propose_osdmap)
+    mon->osdmon()->propose_pending();
 }