From ad7a4c803fb072ac76ef49a74876bf72df04f391 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Tue, 13 Jun 2017 15:08:19 -0400 Subject: [PATCH] mon,mgr: pass new-style health checks from mgr's PGMap Signed-off-by: Sage Weil --- src/messages/MMonMgrReport.h | 9 ++++----- src/mgr/DaemonServer.cc | 7 +++---- src/mon/MgrStatMonitor.cc | 21 +++++---------------- src/mon/MgrStatMonitor.h | 5 +---- 4 files changed, 13 insertions(+), 29 deletions(-) diff --git a/src/messages/MMonMgrReport.h b/src/messages/MMonMgrReport.h index dc5e965156d..e8d722221be 100644 --- a/src/messages/MMonMgrReport.h +++ b/src/messages/MMonMgrReport.h @@ -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> 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); } }; diff --git a/src/mgr/DaemonServer.cc b/src/mgr/DaemonServer.cc index 7b9086c4800..096ab5bcb52 100644 --- a/src/mgr/DaemonServer.cc +++ b/src/mgr/DaemonServer.cc @@ -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 diff --git a/src/mon/MgrStatMonitor.cc b/src/mon/MgrStatMonitor.cc index 5c37433458d..c96163e7f3b 100644 --- a/src/mon/MgrStatMonitor.cc +++ b/src/mon/MgrStatMonitor.cc @@ -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 >& summary, list > *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); } diff --git a/src/mon/MgrStatMonitor.h b/src/mon/MgrStatMonitor.h index ee58e293012..c1846a54477 100644 --- a/src/mon/MgrStatMonitor.h +++ b/src/mon/MgrStatMonitor.h @@ -15,14 +15,11 @@ class MgrStatMonitor : public PaxosService { // live version version_t version = 0; PGMapDigest digest; - list> health_summary; - list> health_detail; ServiceMap service_map; // pending commit PGMapDigest pending_digest; - list> pending_health_summary; - list> pending_health_detail; + health_check_map_t pending_health_checks; bufferlist pending_service_map_bl; std::unique_ptr pgservice; -- 2.39.5