update_stats();
}},
asok{seastar::make_lw_shared<crimson::admin::AdminSocket>()},
- osdmap_gate("OSD::osdmap_gate", std::make_optional(std::ref(shard_services))),
- wait_for_active(std::in_place_t{})
+ osdmap_gate("OSD::osdmap_gate", std::make_optional(std::ref(shard_services)))
{
osdmaps[0] = boost::make_local_shared<OSDMap>();
for (auto msgr : {std::ref(cluster_msgr), std::ref(public_msgr),
if (state.is_booting()) {
logger().info("osd.{}: activating...", whoami);
state.set_active();
- assert(wait_for_active);
- wait_for_active->set_value();
- wait_for_active = std::nullopt;
beacon_timer.arm_periodic(
std::chrono::seconds(local_conf()->osd_beacon_report_interval));
tick_timer.arm_periodic(
friend class PGAdvanceMap;
RemotePeeringEvent::OSDPipeline peering_request_osd_pipeline;
- std::optional<seastar::shared_promise<>> wait_for_active;
friend class RemotePeeringEvent;
public:
return with_blocking_future(
handle.enter(op().await_active)
).then([this] {
- if (osd.wait_for_active) {
- return osd.wait_for_active->get_shared_future();
- } else {
- return seastar::now();
- }
+ return osd.state.when_active();
}).then([this] {
return with_blocking_future(handle.enter(cp().await_map));
}).then([this] {
#include <string_view>
#include <ostream>
+#include <seastar/core/shared_future.hh>
+
class OSDMap;
class OSDState {
};
State state = State::INITIALIZING;
+ mutable seastar::shared_promise<> wait_for_active;
public:
bool is_initializing() const {
bool is_active() const {
return state == State::ACTIVE;
}
+ seastar::future<> when_active() const {
+ return is_active() ? seastar::now()
+ : wait_for_active.get_shared_future();
+ };
bool is_prestop() const {
return state == State::PRESTOP;
}
}
void set_active() {
state = State::ACTIVE;
+ wait_for_active.set_value();
+ wait_for_active = {};
}
void set_prestop() {
state = State::PRESTOP;
}
void set_stopping() {
state = State::STOPPING;
+ wait_for_active.set_exception(crimson::common::system_shutdown_exception{});
+ wait_for_active = {};
}
std::string_view to_string() const {
switch (state) {