]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson/osd: signal should_stop in OSD::shutdown()
authorKefu Chai <tchaikov@gmail.com>
Sat, 1 Oct 2022 10:34:33 +0000 (18:34 +0800)
committerKefu Chai <tchaikov@gmail.com>
Sat, 1 Oct 2022 15:57:39 +0000 (23:57 +0800)
so osd is able to shut itself down per monitor's request.

Signed-off-by: Kefu Chai <tchaikov@gmail.com>
src/crimson/osd/main.cc
src/crimson/osd/osd.cc
src/crimson/osd/osd.h

index 1eead7b924c0e9e67064447af3aa1ff99f4d5379..73ff2447244bd72b3e3c6f089585ae4810c0ffd9 100644 (file)
@@ -307,7 +307,8 @@ int main(int argc, const char* argv[])
             local_conf().get_config_values()).get();
 
           crimson::osd::OSD osd(
-           whoami, nonce, std::ref(*store), cluster_msgr, client_msgr,
+            whoami, nonce, std::ref(should_stop.abort_source()),
+            std::ref(*store), cluster_msgr, client_msgr,
            hb_front_msgr, hb_back_msgr);
 
           if (config.count("mkkey")) {
index 9af4699dbf47d9e515eb380e1e04669f71fda1e7..344086e43397216de0872e9b1046a67acde3098a 100644 (file)
@@ -75,6 +75,7 @@ using crimson::os::FuturizedStore;
 namespace crimson::osd {
 
 OSD::OSD(int id, uint32_t nonce,
+        seastar::abort_source& abort_source,
          crimson::os::FuturizedStore& store,
          crimson::net::MessengerRef cluster_msgr,
          crimson::net::MessengerRef public_msgr,
@@ -82,6 +83,7 @@ OSD::OSD(int id, uint32_t nonce,
          crimson::net::MessengerRef hb_back_msgr)
   : whoami{id},
     nonce{nonce},
+    abort_source{abort_source},
     // do this in background
     beacon_timer{[this] { (void)send_beacon(); }},
     cluster_msgr{cluster_msgr},
@@ -1178,7 +1180,8 @@ seastar::future<> OSD::restart()
 
 seastar::future<> OSD::shutdown()
 {
-  // TODO
+  logger().info("shutting down per osdmap");
+  abort_source.request_abort();
   return seastar::now();
 }
 
index 02aa2d3e25ff07823f345b581d3e8a4525b0154b..fbdf10192576f890de161df0fd95d2c32f12a456 100644 (file)
@@ -3,6 +3,7 @@
 
 #pragma once
 
+#include <seastar/core/abort_source.hh>
 #include <seastar/core/future.hh>
 #include <seastar/core/shared_future.hh>
 #include <seastar/core/gate.hh>
@@ -62,6 +63,7 @@ class OSD final : public crimson::net::Dispatcher,
                  private crimson::mgr::WithStats {
   const int whoami;
   const uint32_t nonce;
+  seastar::abort_source& abort_source;
   seastar::timer<seastar::lowres_clock> beacon_timer;
   // talk with osd
   crimson::net::MessengerRef cluster_msgr;
@@ -116,6 +118,7 @@ class OSD final : public crimson::net::Dispatcher,
 
 public:
   OSD(int id, uint32_t nonce,
+      seastar::abort_source& abort_source,
       crimson::os::FuturizedStore& store,
       crimson::net::MessengerRef cluster_msgr,
       crimson::net::MessengerRef client_msgr,