#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 {
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 {}
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);
}
};
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);
}
}
{
++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);
}
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()
{
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;
}
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);