seastar::future<> OSD::start_boot()
{
- state.set_preboot();
+ pg_shard_manager.set_preboot();
return monc->get_version("osdmap").then([this](auto&& ret) {
auto [newest, oldest] = ret;
return _preboot(oldest, newest);
seastar::future<> OSD::_send_boot()
{
- state.set_booting();
+ pg_shard_manager.set_booting();
entity_addrvec_t public_addrs = public_msgr->get_myaddrs();
entity_addrvec_t cluster_addrs = cluster_msgr->get_myaddrs();
tick_timer.cancel();
// see also OSD::shutdown()
return prepare_to_stop().then([this] {
- state.set_stopping();
+ pg_shard_manager.set_stopping();
logger().debug("prepared to stop");
public_msgr->stop();
cluster_msgr->stop();
f->dump_stream("cluster_fsid") << superblock.cluster_fsid;
f->dump_stream("osd_fsid") << superblock.osd_fsid;
f->dump_unsigned("whoami", superblock.whoami);
- f->dump_string("state", state.to_string());
+ f->dump_string("state", pg_shard_manager.get_osd_state_string());
f->dump_unsigned("oldest_map", superblock.oldest_map);
f->dump_unsigned("newest_map", superblock.newest_map);
f->dump_unsigned("num_pgs", pg_map.get_pgs().size());
std::optional<seastar::future<>>
OSD::ms_dispatch(crimson::net::ConnectionRef conn, MessageRef m)
{
- if (state.is_stopping()) {
+ if (pg_shard_manager.is_stopping()) {
return {};
}
bool dispatched = true;
logger().warn("fsid mismatched");
return seastar::now();
}
- if (state.is_initializing()) {
+ if (pg_shard_manager.is_initializing()) {
logger().warn("i am still initializing");
return seastar::now();
}
if (osdmap->is_up(whoami)) {
const auto up_from = osdmap->get_up_from(whoami);
logger().info("osd.{}: map e {} marked me up: up_from {}, bind_epoch {}, state {}",
- whoami, osdmap->get_epoch(), up_from, bind_epoch, state);
+ whoami, osdmap->get_epoch(), up_from, bind_epoch,
+ pg_shard_manager.get_osd_state_string());
if (bind_epoch < up_from &&
osdmap->get_addrs(whoami) == public_msgr->get_myaddrs() &&
- state.is_booting()) {
+ pg_shard_manager.is_booting()) {
logger().info("osd.{}: activating...", whoami);
- state.set_active();
+ pg_shard_manager.set_active();
beacon_timer.arm_periodic(
std::chrono::seconds(local_conf()->osd_beacon_report_interval));
tick_timer.arm_periodic(
std::chrono::seconds(TICK_INTERVAL));
}
} else {
- if (state.is_prestop()) {
+ if (pg_shard_manager.is_prestop()) {
got_stop_ack();
return seastar::now();
}
return consume_map(osdmap->get_epoch());
});
}).then([m, this] {
- if (state.is_active()) {
+ if (pg_shard_manager.is_active()) {
logger().info("osd.{}: now active", whoami);
if (!osdmap->exists(whoami) ||
osdmap->is_stop(whoami)) {
} else {
return seastar::now();
}
- } else if (state.is_preboot()) {
+ } else if (pg_shard_manager.is_preboot()) {
logger().info("osd.{}: now preboot", whoami);
if (m->get_source().is_mon()) {
return start_boot();
}
} else {
- logger().info("osd.{}: now {}", whoami, state);
+ logger().info("osd.{}: now {}", whoami,
+ pg_shard_manager.get_osd_state_string());
// XXX
return seastar::now();
}
seastar::future<> OSD::handle_mark_me_down(crimson::net::ConnectionRef conn,
Ref<MOSDMarkMeDown> m)
{
- if (state.is_prestop()) {
+ if (pg_shard_manager.is_prestop()) {
got_stop_ack();
}
return seastar::now();
seastar::future<> OSD::send_beacon()
{
- if (!state.is_active()) {
+ if (!pg_shard_manager.is_active()) {
return seastar::now();
}
// FIXME: min lec should be calculated from pg_stat
void OSD::update_heartbeat_peers()
{
- if (!state.is_active()) {
+ if (!pg_shard_manager.is_active()) {
return;
}
for (auto& pg : pg_map.get_pgs()) {
seastar::future<> OSD::prepare_to_stop()
{
if (osdmap && osdmap->is_up(whoami)) {
- state.set_prestop();
+ pg_shard_manager.set_prestop();
const auto timeout =
std::chrono::duration_cast<std::chrono::milliseconds>(
std::chrono::duration<double>(
}
FORWARD_TO_CORE(send_pg_created)
+
+ // osd state forwards
+ FORWARD(is_active, is_active, core_state.osd_state)
+ FORWARD(is_preboot, is_preboot, core_state.osd_state)
+ FORWARD(is_booting, is_booting, core_state.osd_state)
+ FORWARD(is_stopping, is_stopping, core_state.osd_state)
+ FORWARD(is_prestop, is_prestop, core_state.osd_state)
+ FORWARD(is_initializing, is_initializing, core_state.osd_state)
+ FORWARD(set_prestop, set_prestop, core_state.osd_state)
+ FORWARD(set_preboot, set_preboot, core_state.osd_state)
+ FORWARD(set_booting, set_booting, core_state.osd_state)
+ FORWARD(set_stopping, set_stopping, core_state.osd_state)
+ FORWARD(set_active, set_active, core_state.osd_state)
+ FORWARD(when_active, when_active, core_state.osd_state)
+ FORWARD_CONST(get_osd_state_string, to_string, core_state.osd_state)
+
FORWARD(got_map, got_map, core_state.osdmap_gate)
FORWARD(wait_for_map, wait_for_map, core_state.osdmap_gate)
-}
+};
}