]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mon: health WARN if monitor quorum is incomplete
authorSage Weil <sage@newdream.net>
Mon, 16 May 2011 20:42:31 +0000 (13:42 -0700)
committerSage Weil <sage@newdream.net>
Mon, 16 May 2011 20:42:31 +0000 (13:42 -0700)
Signed-off-by: Sage Weil <sage@newdream.net>
src/mon/MonmapMonitor.cc
src/mon/MonmapMonitor.h

index 39f9cc84c80205852ae4ffb66d46691be8f13f93..496e6071fde4c33e664861152b33c79b35f5b76f 100644 (file)
@@ -253,3 +253,16 @@ void MonmapMonitor::tick()
   update_from_paxos();
 }
 
+enum health_status_t MonmapMonitor::get_health(std::ostream &ss) const
+{
+  enum health_status_t ret(HEALTH_OK);
+  
+  int max = mon->monmap->size();
+  int actual = mon->get_quorum().size();
+  if (actual < max) {
+    ret = HEALTH_WARN;
+    ss << (max-actual) << " mons down, quorum " << mon->get_quorum();
+  }
+
+  return ret;
+}
index 58f28441ccf1b0572d738b0a77b8161fce93c70a..406dcc96df7f7a92ce8ab8362e17305bd36b8854 100644 (file)
@@ -54,6 +54,7 @@ class MonmapMonitor : public PaxosService {
   bool preprocess_command(MMonCommand *m);
   bool prepare_command(MMonCommand *m);
 
+  enum health_status_t get_health(std::ostream &ss) const;
 
   /*
    * Since monitors are pretty