mirror of
https://github.com/ceph/ceph
synced 2025-01-01 08:32:24 +00:00
crimson/osd: send beacon to mon periodically
so monitor won't mark crimson-osd down and out Signed-off-by: Kefu Chai <kchai@redhat.com>
This commit is contained in:
parent
cd668c29e4
commit
33928e0a38
@ -1,5 +1,6 @@
|
||||
#include "osd.h"
|
||||
|
||||
#include "messages/MOSDBeacon.h"
|
||||
#include "messages/MOSDBoot.h"
|
||||
#include "messages/MOSDMap.h"
|
||||
#include "crimson/net/Connection.h"
|
||||
@ -38,6 +39,9 @@ OSD::OSD(int id, uint32_t nonce)
|
||||
dispatchers.push_front(this);
|
||||
dispatchers.push_front(&monc);
|
||||
osdmaps[0] = seastar::make_lw_shared<OSDMap>();
|
||||
beacon_timer.set_callback([this] {
|
||||
send_beacon();
|
||||
});
|
||||
}
|
||||
|
||||
OSD::~OSD() = default;
|
||||
@ -300,6 +304,8 @@ seastar::future<> OSD::committed_osd_maps(version_t first,
|
||||
if (state.is_booting()) {
|
||||
logger().info("osd.{}: activating...", whoami);
|
||||
state.set_active();
|
||||
beacon_timer.arm_periodic(
|
||||
std::chrono::seconds(local_conf()->osd_beacon_report_interval));
|
||||
}
|
||||
}
|
||||
|
||||
@ -369,3 +375,13 @@ seastar::future<> OSD::shutdown()
|
||||
superblock.clean_thru = osdmap->get_epoch();
|
||||
return seastar::now();
|
||||
}
|
||||
|
||||
seastar::future<> OSD::send_beacon()
|
||||
{
|
||||
// FIXME: min lec should be calculated from pg_stat
|
||||
// and should set m->pgs
|
||||
epoch_t min_last_epoch_clean = osdmap->get_epoch();
|
||||
auto m = make_message<MOSDBeacon>(osdmap->get_epoch(),
|
||||
min_last_epoch_clean);
|
||||
return monc.send_message(m);
|
||||
}
|
||||
|
@ -4,6 +4,7 @@
|
||||
#include <seastar/core/future.hh>
|
||||
#include <seastar/core/gate.hh>
|
||||
#include <seastar/core/shared_ptr.hh>
|
||||
#include <seastar/core/timer.hh>
|
||||
|
||||
#include "crimson/mon/MonClient.h"
|
||||
#include "crimson/net/Dispatcher.h"
|
||||
@ -22,6 +23,7 @@ namespace ceph::net {
|
||||
|
||||
class OSD : public ceph::net::Dispatcher {
|
||||
seastar::gate gate;
|
||||
seastar::timer<seastar::lowres_clock> beacon_timer;
|
||||
const int whoami;
|
||||
// talk with osd
|
||||
std::unique_ptr<ceph::net::Messenger> cluster_msgr;
|
||||
@ -82,4 +84,6 @@ private:
|
||||
bool should_restart() const;
|
||||
seastar::future<> restart();
|
||||
seastar::future<> shutdown();
|
||||
|
||||
seastar::future<> send_beacon();
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user