]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: move health checks into a single helper
authorSage Weil <sage@inktank.com>
Mon, 27 May 2013 22:27:59 +0000 (15:27 -0700)
committerSage Weil <sage@inktank.com>
Wed, 29 May 2013 20:41:44 +0000 (13:41 -0700)
For now we still only look at the internal heartbeats.

Signed-off-by: Sage Weil <sage@inktank.com>
src/osd/OSD.cc
src/osd/OSD.h

index 5aad94c272ed97a658f16ad85025df3e23050d3e..4bbcd06243e9d9114483a7316e364bd674a3fe6f 100644 (file)
@@ -2679,7 +2679,7 @@ void OSD::tick()
   logger->set(l_osd_buf, buffer::get_total_alloc());
 
   if (is_waiting_for_healthy()) {
-    if (g_ceph_context->get_heartbeat_map()->is_healthy()) {
+    if (_is_healthy()) {
       dout(1) << "healthy again, booting" << dendl;
       state = STATE_BOOTING;
       start_boot();
@@ -3062,9 +3062,9 @@ void OSD::_maybe_boot(epoch_t oldest, epoch_t newest)
   // if our map within recent history, try to add ourselves to the osdmap.
   if (osdmap->test_flag(CEPH_OSDMAP_NOUP)) {
     dout(5) << "osdmap NOUP flag is set, waiting for it to clear" << dendl;
-  } else if (!g_ceph_context->get_heartbeat_map()->is_healthy()) {
+  } else if (!_is_healthy()) {
     // if we are not healthy, do not mark ourselves up (yet)
-    dout(1) << "internal heartbeats indicate we are not healthy; waiting to boot" << dendl;
+    dout(1) << "not healthy; waiting to boot" << dendl;
     state = STATE_WAITING_FOR_HEALTHY;
   } else if (osdmap->get_epoch() >= oldest - 1 &&
             osdmap->get_epoch() + g_conf->osd_map_message_max > newest) {
@@ -3080,6 +3080,16 @@ void OSD::_maybe_boot(epoch_t oldest, epoch_t newest)
   monc->renew_subs();
 }
 
+bool OSD::_is_healthy()
+{
+  if (!g_ceph_context->get_heartbeat_map()->is_healthy()) {
+    dout(1) << "is_healthy false -- internal heartbeat failed" << dendl;
+    return false;
+  }
+
+  return true;
+}
+
 void OSD::_send_boot()
 {
   dout(10) << "_send_boot" << dendl;
index 99d75dc40ad680b6c9dc6d6c8aa58cd7516a281e..978749d1a7e4fe830abba20d096d6d48d607feba 100644 (file)
@@ -1116,6 +1116,7 @@ protected:
   void start_boot();
   void _maybe_boot(epoch_t oldest, epoch_t newest);
   void _send_boot();
+  bool _is_healthy();
   
   friend class C_OSD_GetVersion;