]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mon: accept health summary and detail messages from mgr
authorSage Weil <sage@redhat.com>
Tue, 16 May 2017 17:17:17 +0000 (13:17 -0400)
committerSage Weil <sage@redhat.com>
Fri, 2 Jun 2017 17:02:10 +0000 (13:02 -0400)
Signed-off-by: Sage Weil <sage@redhat.com>
src/messages/MMonMgrReport.h
src/mon/MgrStatMonitor.cc
src/mon/MgrStatMonitor.h

index 8ddc81de107973de1e7122e71e83509836470f87..593bfc0e87341a9e806ebb537a8a047b0a569675 100644 (file)
 #include "include/types.h"
 #include "mon/PGMap.h"
 
+// health_status_t
+static inline void encode(health_status_t hs, bufferlist& bl) {
+  uint8_t v = hs;
+  ::encode(v, bl);
+}
+static inline void decode(health_status_t& hs, bufferlist::iterator& p) {
+  uint8_t v;
+  ::decode(v, p);
+  hs = health_status_t(v);
+}
 
 class MMonMgrReport : public PaxosServiceMessage {
 
@@ -26,10 +36,12 @@ class MMonMgrReport : public PaxosServiceMessage {
   static const int COMPAT_VERSION = 1;
 
 public:
+  // PGMapDigest is in data payload
+  list<pair<health_status_t,std::string>> health_summary, health_detail;
+
   MMonMgrReport()
     : PaxosServiceMessage(MSG_MON_MGR_REPORT, 0, HEAD_VERSION, COMPAT_VERSION)
   {}
-
 private:
   ~MMonMgrReport() override {}
 
@@ -43,10 +55,14 @@ public:
 
   void encode_payload(uint64_t features) override {
     paxos_encode();
+    ::encode(health_summary, payload);
+    ::encode(health_detail, payload);
   }
   void decode_payload() override {
     bufferlist::iterator p = payload.begin();
     paxos_decode(p);
+    ::decode(health_summary, p);
+    ::decode(health_detail, p);
   }
 };
 
index 54fdae178768d5fa1ca7c0a20b034307e5505b88..4b09907871d9879ca0a8258e25cbb5ac2b83b7cd 100644 (file)
@@ -86,7 +86,12 @@ void MgrStatMonitor::update_from_paxos(bool *need_bootstrap)
   get_version(version, bl);
   if (version) {
     assert(bl.length());
-    pgservice->decode_digest(bl);
+    bufferlist digestbl;
+    auto p = bl.begin();
+    ::decode(digestbl, p);
+    ::decode(health_summary, p);
+    ::decode(health_detail, p);
+    pgservice->decode_digest(digestbl);
   }
 }
 
@@ -94,8 +99,12 @@ void MgrStatMonitor::encode_pending(MonitorDBStore::TransactionRef t)
 {
   ++version;
   dout(10) << __func__ << " " << version << dendl;
+  bufferlist digestbl;
+  pgservice->encode_digest(digestbl, mon->get_quorum_con_features());
   bufferlist bl;
-  pgservice->encode_digest(bl, mon->get_quorum_con_features());
+  ::encode(digestbl, bl);
+  ::encode(health_summary, bl);
+  ::encode(health_detail, bl);
   put_version(t, version, bl);
   put_last_committed(t, version);
 }
@@ -108,6 +117,10 @@ void MgrStatMonitor::get_health(list<pair<health_status_t,string> >& summary,
                                list<pair<health_status_t,string> > *detail,
                                CephContext *cct) const
 {
+  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()
@@ -153,5 +166,7 @@ bool MgrStatMonitor::prepare_report(MonOpRequestRef op)
 {
   auto m = static_cast<MMonMgrReport*>(op->get_req());
   pgservice->decode_digest(m->get_data());
+  health_summary.swap(m->health_summary);
+  health_detail.swap(m->health_detail);
   return true;
 }
index 5e79cd4247d9c7ecadaa91e28c23bc3d5295784b..660c18fde27183bacfa562698654070f6651bbca 100644 (file)
@@ -12,6 +12,7 @@ class MgrPGStatService;
 class MgrStatMonitor : public PaxosService {
   version_t version = 0;
   std::unique_ptr<MgrPGStatService> pgservice;
+  list<pair<health_status_t,string>> health_summary, health_detail;
 
 public:
   MgrStatMonitor(Monitor *mn, Paxos *p, const string& service_name);