]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
src/crimson: Add support for the OSD to receive config changes 54813/head
authorAishwarya Mathuria <amathuri@redhat.com>
Wed, 6 Dec 2023 16:58:29 +0000 (22:28 +0530)
committerAishwarya Mathuria <amathuri@redhat.com>
Thu, 4 Jan 2024 15:39:34 +0000 (15:39 +0000)
1. Adds MMgrReport message in manager client
2. MonClient subscribes to config

Fixes: https://tracker.ceph.com/issues/59241
Signed-off-by: Aishwarya Mathuria <amathuri@redhat.com>
src/crimson/mgr/client.cc
src/crimson/mgr/client.h
src/crimson/mon/MonClient.cc

index 169915c9eb3b2777b26610075bada9bdec2f8b00..d2a1ea5136a008c5a88900cfe9a5d0facc2885a9 100644 (file)
@@ -11,6 +11,7 @@
 #include "messages/MMgrConfigure.h"
 #include "messages/MMgrMap.h"
 #include "messages/MMgrOpen.h"
+#include "messages/MMgrReport.h"
 
 namespace {
   seastar::logger& logger()
@@ -156,9 +157,10 @@ seastar::future<> Client::handle_mgr_conf(crimson::net::ConnectionRef,
 
 void Client::report()
 {
+  _send_report();
   gate.dispatch_in_background(__func__, *this, [this] {
     if (!conn) {
-      logger().warn("report: no conn available; raport skipped");
+      logger().warn("report: no conn available; report skipped");
       return seastar::now();
     }
     return with_stats.get_stats(
@@ -168,6 +170,34 @@ void Client::report()
   });
 }
 
+void Client::_send_report()
+{
+  // TODO: implement daemon_health_metrics support
+  // https://tracker.ceph.com/issues/63766
+  gate.dispatch_in_background(__func__, *this, [this] {
+    if (!conn) {
+      logger().warn("cannot send report; no conn available");
+      return seastar::now();
+    }
+    auto report = make_message<MMgrReport>();
+    // Adding empty information since we don't support perfcounters yet
+    report->undeclare_types.emplace_back();
+    ENCODE_START(1, 1, report->packed);
+    report->declare_types.emplace_back();
+    ENCODE_FINISH(report->packed);
+
+    if (daemon_name.size()) {
+      report->daemon_name = daemon_name;
+    } else {
+      report->daemon_name = local_conf()->name.get_id();
+    }
+    report->service_name = service_name;
+    local_conf().get_config_bl(last_config_bl_version, &report->config_bl,
+                             &last_config_bl_version);
+    return conn->send(std::move(report));
+  });
+}
+
 void Client::print(std::ostream& out) const
 {
   out << "mgrc ";
index b88c60c5e4a47aa156d559f40e83e810694785bc..7f4e62fd7d2d3630594b8b6a3facd845d4edd1c6 100644 (file)
@@ -57,6 +57,9 @@ private:
   seastar::timer<seastar::lowres_clock> report_timer;
   crimson::common::Gated gate;
   uint64_t last_config_bl_version = 0;
+  std::string service_name, daemon_name;
+
+  void _send_report();
 };
 
 inline std::ostream& operator<<(std::ostream& out, const Client& client) {
index 7be09915a94618fe3b3cc02daa38ebdec9edd480..761c6b1a5c85746b901f70ca42590fb1a93fe8f3 100644 (file)
@@ -432,6 +432,7 @@ Client::~Client() = default;
 seastar::future<> Client::start() {
   entity_name = crimson::common::local_conf()->name;
   auth_registry.refresh_config();
+  sub.want("config", 0, 0);
   return load_keyring().then([this] {
     return monmap.build_initial(crimson::common::local_conf(), false);
   }).then([this] {