From be72197a559e6c63a0ec07fe7e2e0a6d1b8f73a6 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Thu, 22 Dec 2016 08:40:05 -0500 Subject: [PATCH] osd/PG: output recovery_state records for Down and Incomplete states Signed-off-by: Sage Weil --- src/osd/PG.cc | 22 ++++++++++++++++++++++ src/osd/PG.h | 8 +++++++- 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/src/osd/PG.cc b/src/osd/PG.cc index aa6b386c79fa4..2e03e10be0e72 100644 --- a/src/osd/PG.cc +++ b/src/osd/PG.cc @@ -7721,6 +7721,17 @@ void PG::RecoveryState::Down::exit() pg->publish_stats_to_osd(); } +boost::statechart::result PG::RecoveryState::Down::react(const QueryState& q) +{ + q.f->open_object_section("state"); + q.f->dump_string("name", state_name); + q.f->dump_stream("enter_time") << enter_time; + q.f->dump_string("comment", + "not enough up instances of this PG to go active"); + q.f->close_section(); + return forward_event(); +} + /*------Incomplete--------*/ PG::RecoveryState::Incomplete::Incomplete(my_context ctx) : my_base(ctx), @@ -7768,6 +7779,17 @@ boost::statechart::result PG::RecoveryState::Incomplete::react(const MNotifyRec& } } +boost::statechart::result PG::RecoveryState::Incomplete::react( + const QueryState& q) +{ + q.f->open_object_section("state"); + q.f->dump_string("name", state_name); + q.f->dump_stream("enter_time") << enter_time; + q.f->dump_string("comment", "not enough complete instances of this PG"); + q.f->close_section(); + return forward_event(); +} + void PG::RecoveryState::Incomplete::exit() { context< RecoveryMachine >().log_exit(state_name, enter_time); diff --git a/src/osd/PG.h b/src/osd/PG.h index 41c610980fb08..68e0840ab0437 100644 --- a/src/osd/PG.h +++ b/src/osd/PG.h @@ -1996,17 +1996,23 @@ public: struct Down : boost::statechart::state< Down, Peering>, NamedState { explicit Down(my_context ctx); + typedef boost::mpl::list < + boost::statechart::custom_reaction< QueryState > + > reactions; + boost::statechart::result react(const QueryState& infoevt); void exit(); }; struct Incomplete : boost::statechart::state< Incomplete, Peering>, NamedState { typedef boost::mpl::list < boost::statechart::custom_reaction< AdvMap >, - boost::statechart::custom_reaction< MNotifyRec > + boost::statechart::custom_reaction< MNotifyRec >, + boost::statechart::custom_reaction< QueryState > > reactions; explicit Incomplete(my_context ctx); boost::statechart::result react(const AdvMap &advmap); boost::statechart::result react(const MNotifyRec& infoevt); + boost::statechart::result react(const QueryState& infoevt); void exit(); }; -- 2.39.5