Skip to content

Commit 3f1b0fe

Browse files
authored
Merge pull request ceph#60559 from leonidc/wip-leonidc-no-listeners-fix
fix no-listeners FSM , detect no-listeners
2 parents 9eaff51 + 66ca80e commit 3f1b0fe

File tree

2 files changed

+23
-7
lines changed

2 files changed

+23
-7
lines changed

src/mon/NVMeofGwMap.cc

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -665,6 +665,8 @@ void NVMeofGwMap::fsm_handle_gw_no_subsystems(
665665
break;
666666

667667
case gw_states_per_group_t::GW_WAIT_FAILBACK_PREPARED:
668+
{
669+
auto& gw_id_st = created_gws[group_key][gw_id];
668670
cancel_timer(gw_id, group_key, grpid);
669671
map_modified = true;
670672
for (auto& gw_st: created_gws[group_key]) {
@@ -673,13 +675,18 @@ void NVMeofGwMap::fsm_handle_gw_no_subsystems(
673675
if (st.sm_state[grpid] ==
674676
gw_states_per_group_t::GW_OWNER_WAIT_FAILBACK_PREPARED) {
675677
dout(4) << "Warning: Outgoing Failback when GW is without subsystems"
676-
<< " - to rollback it" <<" GW " << gw_id << "for ANA Group "
678+
<<" Owner GW set to standby state " << gw_st.first << "for ANA Group "
677679
<< grpid << dendl;
678680
st.standby_state(grpid);
679681
break;
680682
}
681683
}
682-
break;
684+
dout(4) << "Warning: Outgoing Failback when GW is without subsystems"
685+
<<" Failback GW set to standby state " << gw_id << "for ANA Group "
686+
<< grpid << dendl;
687+
gw_id_st.standby_state(grpid);
688+
}
689+
break;
683690

684691
case gw_states_per_group_t::GW_OWNER_WAIT_FAILBACK_PREPARED:
685692
case gw_states_per_group_t::GW_ACTIVE_STATE:
@@ -716,6 +723,8 @@ void NVMeofGwMap::fsm_handle_gw_down(
716723
break;
717724

718725
case gw_states_per_group_t::GW_WAIT_FAILBACK_PREPARED:
726+
{
727+
auto& gw_id_st = created_gws[group_key][gw_id];
719728
cancel_timer(gw_id, group_key, grpid);
720729
map_modified = true;
721730
for (auto& gw_st: created_gws[group_key]) {
@@ -724,13 +733,18 @@ void NVMeofGwMap::fsm_handle_gw_down(
724733
if (st.sm_state[grpid] ==
725734
gw_states_per_group_t::GW_OWNER_WAIT_FAILBACK_PREPARED) {
726735
dout(4) << "Warning: Outgoing Failback when GW is down back"
727-
<< " - to rollback it" <<" GW " << gw_id << "for ANA Group "
736+
<<"Owner GW set to standby state " << gw_id << "for ANA Group "
728737
<< grpid << dendl;
729738
st.standby_state(grpid);
730739
break;
731740
}
732741
}
733-
break;
742+
dout(4) << "Warning: Outgoing Failback when GW is down back"
743+
<<" Failback GW set to standby state " << gw_id << "for ANA Group "
744+
<< grpid << dendl;
745+
gw_id_st.standby_state(grpid);
746+
}
747+
break;
734748

735749
case gw_states_per_group_t::GW_OWNER_WAIT_FAILBACK_PREPARED:
736750
// nothing to do - let failback timer expire

src/mon/NVMeofGwMon.cc

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -607,11 +607,13 @@ bool NVMeofGwMon::prepare_beacon(MonOpRequestRef op)
607607

608608
if (sub.size() == 0) {
609609
avail = gw_availability_t::GW_CREATED;
610+
dout(20) << "No-subsystems condition detected for GW " << gw_id <<dendl;
610611
} else {
611-
bool listener_found = false;
612+
bool listener_found = true;
612613
for (auto &subs: sub) {
613-
if (subs.listeners.size()) {
614-
listener_found = true;
614+
if (subs.listeners.size() == 0) {
615+
listener_found = false;
616+
dout(10) << "No-listeners condition detected for GW " << gw_id << " for nqn " << subs.nqn << dendl;
615617
break;
616618
}
617619
}

0 commit comments

Comments
 (0)