]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/MgrClient: send health_checks using MMgrReport
authorKefu Chai <kchai@redhat.com>
Tue, 24 Oct 2017 14:41:30 +0000 (22:41 +0800)
committerKefu Chai <kchai@redhat.com>
Tue, 21 Nov 2017 08:38:59 +0000 (16:38 +0800)
Signed-off-by: Kefu Chai <kchai@redhat.com>
src/messages/MMgrReport.h
src/mgr/MgrClient.cc
src/mgr/MgrClient.h

index 26268927b1a5c99d44e6d02b3170039978dea5f7..f6af6dfb86aa06a0da4b0e1744fba0e1916ab6c1 100644 (file)
@@ -20,6 +20,7 @@
 #include "msg/Message.h"
 
 #include "common/perf_counters.h"
+#include "osd/OSDHealthMetric.h"
 
 class PerfCounterType
 {
@@ -66,7 +67,7 @@ WRITE_CLASS_ENCODER(PerfCounterType)
 
 class MMgrReport : public Message
 {
-  static const int HEAD_VERSION = 4;
+  static const int HEAD_VERSION = 5;
   static const int COMPAT_VERSION = 1;
 
 public:
@@ -92,6 +93,8 @@ public:
   // for service registration
   boost::optional<std::map<std::string,std::string>> daemon_status;
 
+  std::vector<OSDHealthMetric> osd_health_metrics;
+
   void decode_payload() override
   {
     bufferlist::iterator p = payload.begin();
@@ -104,6 +107,9 @@ public:
       ::decode(service_name, p);
       ::decode(daemon_status, p);
     }
+    if (header.version >= 5) {
+      ::decode(osd_health_metrics, p);
+    }
   }
 
   void encode_payload(uint64_t features) override {
@@ -113,6 +119,7 @@ public:
     ::encode(undeclare_types, payload);
     ::encode(service_name, payload);
     ::encode(daemon_status, payload);
+    ::encode(osd_health_metrics, payload);
   }
 
   const char *get_type_name() const override { return "mgrreport"; }
@@ -130,6 +137,9 @@ public:
     if (daemon_status) {
       out << " status=" << daemon_status->size();
     }
+    if (!osd_health_metrics.empty()) {
+      out << " osd_metrics=" << osd_health_metrics.size();
+    }
     out << ")";
   }
 
index 910d747f88ae0e356365196fb537f6ea7a389fdd..33d467303eb0a80fa3ed9a10bac4fdd64857f3d1 100644 (file)
@@ -326,6 +326,7 @@ void MgrClient::send_report()
     daemon_dirty_status = false;
   }
 
+  report->osd_health_metrics = std::move(osd_health_metrics);
   session->con->send_message(report);
 }
 
@@ -467,3 +468,8 @@ int MgrClient::service_daemon_update_status(
   daemon_dirty_status = true;
   return 0;
 }
+
+void MgrClient::update_osd_health(std::vector<OSDHealthMetric>&& metrics)
+{
+  osd_health_metrics = std::move(metrics);
+}
index 5fcbe6383845acfadbfb2591d3d3cab350bb4b0e..a3493f5c6642bd254dfca95075e5968d0e5e8dac 100644 (file)
 #ifndef MGR_CLIENT_H_
 #define MGR_CLIENT_H_
 
+#include "msg/Connection.h"
 #include "msg/Dispatcher.h"
 #include "mon/MgrMap.h"
-
-#include "msg/Connection.h"
+#include "osd/OSDHealthMetric.h"
 
 #include "common/perf_counters.h"
 #include "common/Timer.h"
@@ -79,6 +79,7 @@ protected:
   std::string service_name, daemon_name;
   std::map<std::string,std::string> daemon_metadata;
   std::map<std::string,std::string> daemon_status;
+  std::vector<OSDHealthMetric> osd_health_metrics;
 
   void reconnect();
   void _send_open();
@@ -117,6 +118,7 @@ public:
     const std::map<std::string,std::string>& metadata);
   int service_daemon_update_status(
     std::map<std::string,std::string>&& status);
+  void update_osd_health(std::vector<OSDHealthMetric>&& metrics);
 
 private:
   void send_stats();