]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mon,mgr: pass new-style health checks from mgr's PGMap
authorSage Weil <sage@redhat.com>
Tue, 13 Jun 2017 19:08:19 +0000 (15:08 -0400)
committerSage Weil <sage@redhat.com>
Wed, 12 Jul 2017 16:52:01 +0000 (12:52 -0400)
Signed-off-by: Sage Weil <sage@redhat.com>
src/messages/MMonMgrReport.h
src/mgr/DaemonServer.cc
src/mon/MgrStatMonitor.cc
src/mon/MgrStatMonitor.h

index dc5e965156d011dd515f89dbee78d4b24d5e185e..e8d722221be805dcb3bcddbdb90158909ef916f3 100644 (file)
@@ -18,6 +18,7 @@
 #include "messages/PaxosServiceMessage.h"
 #include "include/types.h"
 #include "include/health.h"
+#include "mon/health_check.h"
 
 class MMonMgrReport : public PaxosServiceMessage {
 
@@ -26,7 +27,7 @@ class MMonMgrReport : public PaxosServiceMessage {
 
 public:
   // PGMapDigest is in data payload
-  list<pair<health_status_t,std::string>> health_summary, health_detail;
+  health_check_map_t health_checks;
   bufferlist service_map_bl;  // encoded ServiceMap
 
   MMonMgrReport()
@@ -44,15 +45,13 @@ public:
 
   void encode_payload(uint64_t features) override {
     paxos_encode();
-    ::encode(health_summary, payload);
-    ::encode(health_detail, payload);
+    ::encode(health_checks, payload);
     ::encode(service_map_bl, payload);
   }
   void decode_payload() override {
     bufferlist::iterator p = payload.begin();
     paxos_decode(p);
-    ::decode(health_summary, p);
-    ::decode(health_detail, p);
+    ::decode(health_checks, p);
     ::decode(service_map_bl, p);
   }
 };
index 7b9086c4800dd4ad474ed538dcbb097e4d97245c..096ab5bcb520787a8a7ad4a53e6f758fceeea196 100644 (file)
@@ -992,15 +992,14 @@ void DaemonServer::send_report()
        }
       }
 
-      // FIXME: reporting health detail here might be a bad idea?
       cluster_state.with_osdmap([&](const OSDMap& osdmap) {
          // FIXME: no easy way to get mon features here.  this will do for
          // now, though, as long as we don't make a backward-incompat change.
          pg_map.encode_digest(osdmap, m->get_data(), CEPH_FEATURES_ALL);
          dout(10) << pg_map << dendl;
-         pg_map.get_health(g_ceph_context, osdmap,
-                           m->health_summary,
-                           &m->health_detail);
+
+         pg_map.get_health_checks(g_ceph_context, osdmap,
+                                  &m->health_checks);
        });
     });
   // TODO? We currently do not notify the PyModules
index 5c37433458d08832afdb60a57a12b9dbbf6939c0..c96163e7f3ba5b9934f1380facf009066f6e5e64 100644 (file)
@@ -81,6 +81,7 @@ void MgrStatMonitor::update_from_paxos(bool *need_bootstrap)
 {
   version = get_last_committed();
   dout(10) << " " << version << dendl;
+  load_health();
   bufferlist bl;
   get_version(version, bl);
   if (version) {
@@ -88,8 +89,6 @@ void MgrStatMonitor::update_from_paxos(bool *need_bootstrap)
     try {
       auto p = bl.begin();
       ::decode(digest, p);
-      ::decode(health_summary, p);
-      ::decode(health_detail, p);
       ::decode(service_map, p);
       dout(10) << __func__ << " v" << version
               << " service_map e" << service_map.epoch << dendl;
@@ -151,8 +150,7 @@ void MgrStatMonitor::create_pending()
 {
   dout(10) << " " << version << dendl;
   pending_digest = digest;
-  pending_health_summary = health_summary;
-  pending_health_detail = health_detail;
+  pending_health_checks = get_health_checks();
   pending_service_map_bl.clear();
   ::encode(service_map, pending_service_map_bl, mon->get_quorum_con_features());
 }
@@ -168,12 +166,12 @@ void MgrStatMonitor::encode_pending(MonitorDBStore::TransactionRef t)
   dout(10) << " " << version << dendl;
   bufferlist bl;
   ::encode(pending_digest, bl, mon->get_quorum_con_features());
-  ::encode(pending_health_summary, bl);
-  ::encode(pending_health_detail, bl);
   assert(pending_service_map_bl.length());
   bl.append(pending_service_map_bl);
   put_version(t, version, bl);
   put_last_committed(t, version);
+
+  encode_health(pending_health_checks, t);
 }
 
 version_t MgrStatMonitor::get_trim_to()
@@ -194,14 +192,6 @@ void MgrStatMonitor::get_health(list<pair<health_status_t,string> >& summary,
                                list<pair<health_status_t,string> > *detail,
                                CephContext *cct) const
 {
-  if (mon->osdmon()->osdmap.require_osd_release < CEPH_RELEASE_LUMINOUS) {
-    return;
-  }
-
-  summary.insert(summary.end(), health_summary.begin(), health_summary.end());
-  if (detail) {
-    detail->insert(detail->end(), health_detail.begin(), health_detail.end());
-  }
 }
 
 void MgrStatMonitor::tick()
@@ -255,8 +245,7 @@ bool MgrStatMonitor::prepare_report(MonOpRequestRef op)
   auto p = bl.begin();
   ::decode(pending_digest, p);
   dout(10) << __func__ << " " << pending_digest << dendl;
-  pending_health_summary.swap(m->health_summary);
-  pending_health_detail.swap(m->health_detail);
+  pending_health_checks.swap(m->health_checks);
   if (m->service_map_bl.length()) {
     pending_service_map_bl.swap(m->service_map_bl);
   }
index ee58e293012f5b0e2e5430f44c969d4237004340..c1846a5447798e8fc2a3258581dd4b6da8f86270 100644 (file)
@@ -15,14 +15,11 @@ class MgrStatMonitor : public PaxosService {
   // live version
   version_t version = 0;
   PGMapDigest digest;
-  list<pair<health_status_t,string>> health_summary;
-  list<pair<health_status_t,string>> health_detail;
   ServiceMap service_map;
 
   // pending commit
   PGMapDigest pending_digest;
-  list<pair<health_status_t,string>> pending_health_summary;
-  list<pair<health_status_t,string>> pending_health_detail;
+  health_check_map_t pending_health_checks;
   bufferlist pending_service_map_bl;
 
   std::unique_ptr<MgrPGStatService> pgservice;