From: Sage Weil Date: Tue, 30 Jul 2019 16:28:55 +0000 (-0500) Subject: mon/HealthMonitor: maintain list of mutes X-Git-Tag: v15.1.0~1877^2~24 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=e2c320dc2bb8fae057b11f0c264a0ff71ba7961d;p=ceph.git mon/HealthMonitor: maintain list of mutes Signed-off-by: Sage Weil --- diff --git a/src/mon/HealthMonitor.cc b/src/mon/HealthMonitor.cc index 692bfdf4e7a6..c10670f56de0 100644 --- a/src/mon/HealthMonitor.cc +++ b/src/mon/HealthMonitor.cc @@ -74,6 +74,17 @@ void HealthMonitor::update_from_paxos(bool *need_bootstrap) leader_checks.clear(); } + { + bufferlist bl; + mon->store->get(service_name, "mutes", bl); + if (bl.length()) { + auto p = bl.cbegin(); + decode(mutes, p); + } else { + mutes.clear(); + } + } + dout(20) << "dump:"; JSONFormatter jf(true); jf.open_object_section("health"); @@ -92,6 +103,7 @@ void HealthMonitor::update_from_paxos(bool *need_bootstrap) void HealthMonitor::create_pending() { dout(10) << " " << version << dendl; + pending_mutes = mutes; } void HealthMonitor::encode_pending(MonitorDBStore::TransactionRef t) @@ -106,6 +118,11 @@ void HealthMonitor::encode_pending(MonitorDBStore::TransactionRef t) bufferlist lbl; encode(leader_checks, lbl); t->put(service_name, "leader", lbl); + { + bufferlist bl; + encode(pending_mutes, bl); + t->put(service_name, "mutes", bl); + } health_check_map_t pending_health; diff --git a/src/mon/HealthMonitor.h b/src/mon/HealthMonitor.h index 05f3bba977a9..e4b4ee484f2e 100644 --- a/src/mon/HealthMonitor.h +++ b/src/mon/HealthMonitor.h @@ -22,6 +22,11 @@ class HealthMonitor : public PaxosService map quorum_checks; // for each quorum member health_check_map_t leader_checks; // leader only + map pending_mutes; + +public: + map mutes; + public: HealthMonitor(Monitor *m, Paxos *p, const string& service_name); diff --git a/src/mon/health_check.h b/src/mon/health_check.h index 54dc93b92a3c..0b08435043ee 100644 --- a/src/mon/health_check.h +++ b/src/mon/health_check.h @@ -7,6 +7,7 @@ #include #include "include/health.h" +#include "include/utime.h" #include "common/Formatter.h" struct health_check_t { @@ -60,6 +61,33 @@ struct health_check_t { WRITE_CLASS_DENC(health_check_t) +struct health_mute_t { + std::string code; + utime_t ttl; + + DENC(health_mute_t, v, p) { + DENC_START(1, 1, p); + denc(v.code, p); + denc(v.ttl, p); + DENC_FINISH(p); + } + + void dump(ceph::Formatter *f) const { + f->dump_string("code", code); + if (ttl != utime_t()) { + f->dump_stream("ttl") << ttl; + } + } + + static void generate_test_instances(std::list& ls) { + ls.push_back(new health_mute_t); + ls.push_back(new health_mute_t); + ls.back()->code = "OSD_DOWN"; + ls.back()->ttl = utime_t(1, 2); + } +}; +WRITE_CLASS_DENC(health_mute_t) + struct health_check_map_t { std::map checks;