]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mon/Monitor: periodically log new-style health warnings to log
authorSage Weil <sage@redhat.com>
Tue, 27 Jun 2017 18:33:00 +0000 (14:33 -0400)
committerSage Weil <sage@redhat.com>
Wed, 12 Jul 2017 16:52:02 +0000 (12:52 -0400)
Signed-off-by: Sage Weil <sage@redhat.com>
src/mon/Monitor.cc

index 0330236a840800e34fdf4aa8a4cd006259df4720..2d9f44ac682947746d50f85da14cc963949fa258 100644 (file)
@@ -2424,27 +2424,46 @@ void Monitor::do_health_to_clog(bool force)
 
   dout(10) << __func__ << (force ? " (force)" : "") << dendl;
 
-  list<string> status;
-  health_status_t overall = get_health(status, NULL, NULL);
-
-  dout(25) << __func__
-           << (force ? " (force)" : "")
-           << dendl;
+  if (osdmon()->osdmap.require_osd_release >= CEPH_RELEASE_LUMINOUS) {
+    string summary;
+    health_status_t level = get_health_status(false, nullptr, &summary);
+    if (!force &&
+       summary == health_status_cache.summary &&
+       level == health_status_cache.overall)
+      return;
+    if (level == HEALTH_OK)
+      clog->info() << summary;
+    else if (level == HEALTH_WARN)
+      clog->warn() << summary;
+    else if (level == HEALTH_ERR)
+      clog->error() << summary;
+    else
+      ceph_abort();
+    health_status_cache.summary = summary;
+    health_status_cache.overall = level;
+  } else {
+    // for jewel only
+    list<string> status;
+    health_status_t overall = get_health(status, NULL, NULL);
+    dout(25) << __func__
+            << (force ? " (force)" : "")
+            << dendl;
 
-  string summary = joinify(status.begin(), status.end(), string("; "));
+    string summary = joinify(status.begin(), status.end(), string("; "));
 
-  if (!force &&
-      overall == health_status_cache.overall &&
-      !health_status_cache.summary.empty() &&
-      health_status_cache.summary == summary) {
-    // we got a dup!
-    return;
-  }
+    if (!force &&
+       overall == health_status_cache.overall &&
+       !health_status_cache.summary.empty() &&
+       health_status_cache.summary == summary) {
+      // we got a dup!
+      return;
+    }
 
-  clog->info() << summary;
+    clog->info() << summary;
 
-  health_status_cache.overall = overall;
-  health_status_cache.summary = summary;
+    health_status_cache.overall = overall;
+    health_status_cache.summary = summary;
+  }
 }
 
 health_status_t Monitor::get_health_status(