From: Sage Weil Date: Tue, 16 May 2017 17:17:17 +0000 (-0400) Subject: mon: accept health summary and detail messages from mgr X-Git-Tag: ses5-milestone6~8^2~19^2~88 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=71cbc2b793fa1d75fd6119fe617ad014d6e3732a;p=ceph.git mon: accept health summary and detail messages from mgr Signed-off-by: Sage Weil --- diff --git a/src/messages/MMonMgrReport.h b/src/messages/MMonMgrReport.h index 8ddc81de1079..593bfc0e8734 100644 --- a/src/messages/MMonMgrReport.h +++ b/src/messages/MMonMgrReport.h @@ -19,6 +19,16 @@ #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> 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); } }; diff --git a/src/mon/MgrStatMonitor.cc b/src/mon/MgrStatMonitor.cc index 54fdae178768..4b09907871d9 100644 --- a/src/mon/MgrStatMonitor.cc +++ b/src/mon/MgrStatMonitor.cc @@ -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 >& summary, list > *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(op->get_req()); pgservice->decode_digest(m->get_data()); + health_summary.swap(m->health_summary); + health_detail.swap(m->health_detail); return true; } diff --git a/src/mon/MgrStatMonitor.h b/src/mon/MgrStatMonitor.h index 5e79cd4247d9..660c18fde271 100644 --- a/src/mon/MgrStatMonitor.h +++ b/src/mon/MgrStatMonitor.h @@ -12,6 +12,7 @@ class MgrPGStatService; class MgrStatMonitor : public PaxosService { version_t version = 0; std::unique_ptr pgservice; + list> health_summary, health_detail; public: MgrStatMonitor(Monitor *mn, Paxos *p, const string& service_name);