From 0e2ce7ba5bbdc93e909cd372d667c876e0785c55 Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Wed, 6 Mar 2019 12:29:10 +0800 Subject: [PATCH] crimson/osd: connect OSD to mgr so OSD is able to report to mgr periodically using mgr::Client Signed-off-by: Kefu Chai --- src/crimson/osd/osd.cc | 7 +++++-- src/crimson/osd/osd.h | 3 ++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/crimson/osd/osd.cc b/src/crimson/osd/osd.cc index b1cab157a60..f307ffc13a9 100644 --- a/src/crimson/osd/osd.cc +++ b/src/crimson/osd/osd.cc @@ -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 diff --git a/src/crimson/osd/osd.h b/src/crimson/osd/osd.h index d8db07d8431..1bf351b9880 100644 --- a/src/crimson/osd/osd.h +++ b/src/crimson/osd/osd.h @@ -54,6 +54,7 @@ class OSD : public ceph::net::Dispatcher, ceph::net::Messenger& public_msgr; ChainedDispatchers dispatchers; std::unique_ptr monc; + std::unique_ptr mgrc; std::unique_ptr heartbeat; seastar::timer 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, -- 2.39.5