]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
crimson/osd: connect OSD to mgr
authorKefu Chai <kchai@redhat.com>
Wed, 6 Mar 2019 04:29:10 +0000 (12:29 +0800)
committerKefu Chai <kchai@redhat.com>
Wed, 20 Mar 2019 09:35:26 +0000 (17:35 +0800)
so OSD is able to report to mgr periodically using mgr::Client

Signed-off-by: Kefu Chai <kchai@redhat.com>
src/crimson/osd/osd.cc
src/crimson/osd/osd.h

index b1cab157a60ba20ce3b2518cd43bb044fe647883..f307ffc13a932a291dffcbd7c7b68ba28be2989d 100644 (file)
@@ -49,6 +49,7 @@ OSD::OSD(int id, uint32_t nonce,
     cluster_msgr{cluster_msgr},
     public_msgr{public_msgr},
     monc{new ceph::mon::Client{public_msgr}},
+    mgrc{new ceph::mgr::Client{public_msgr, *this}},
     heartbeat{new Heartbeat{whoami, nonce, *this, *monc,
                             hb_front_msgr, hb_back_msgr}},
     heartbeat_timer{[this] { update_heartbeat_peers(); }},
@@ -184,6 +185,7 @@ seastar::future<> OSD::start()
     }
     dispatchers.push_front(this);
     dispatchers.push_front(monc.get());
+    dispatchers.push_front(mgrc.get());
     return seastar::when_all_succeed(
       cluster_msgr.try_bind(pick_addresses(CEPH_PICK_ADDRESS_CLUSTER),
                             local_conf()->ms_bind_port_min,
@@ -194,7 +196,8 @@ seastar::future<> OSD::start()
                            local_conf()->ms_bind_port_max)
         .then([this] { return public_msgr.start(&dispatchers); }));
   }).then([this] {
-    return monc->start();
+    return seastar::when_all_succeed(monc->start(),
+                                     mgrc->start());
   }).then([this] {
     monc->sub_want("osd_pg_creates", last_pg_create_epoch, 0);
     monc->sub_want("mgrmap", 0, 0);
@@ -381,7 +384,7 @@ seastar::future<> OSD::ms_handle_remote_reset(ceph::net::ConnectionRef conn)
   return seastar::now();
 }
 
-MessageRef OSD::get_stats() const
+MessageRef OSD::get_stats()
 {
   // todo: m-to-n: collect stats using map-reduce
   // MPGStats::had_map_for is not used since PGMonitor was removed
index d8db07d84311d9ecb96883b39c93d09f0bd87d60..1bf351b9880779de0ad93406c0bd08f1c1c4d058 100644 (file)
@@ -54,6 +54,7 @@ class OSD : public ceph::net::Dispatcher,
   ceph::net::Messenger& public_msgr;
   ChainedDispatchers dispatchers;
   std::unique_ptr<ceph::mon::Client> monc;
+  std::unique_ptr<ceph::mgr::Client> mgrc;
 
   std::unique_ptr<Heartbeat> heartbeat;
   seastar::timer<seastar::lowres_clock> heartbeat_timer;
@@ -85,7 +86,7 @@ class OSD : public ceph::net::Dispatcher,
   seastar::future<> ms_handle_reset(ceph::net::ConnectionRef conn) override;
   seastar::future<> ms_handle_remote_reset(ceph::net::ConnectionRef conn) override;
   // mgr::WithStats methods
-  MessageRef get_stats() const override;
+  MessageRef get_stats() override;
 
 public:
   OSD(int id, uint32_t nonce,