Merge pull request #60559 from leonidc/wip-leonidc-no-listeners-fix

fix no-listeners FSM , detect no-listeners
This commit is contained in:
leonidc 2024-11-05 14:20:11 +02:00 committed by GitHub
commit 3f1b0feb0f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 23 additions and 7 deletions

View File

@ -665,6 +665,8 @@ void NVMeofGwMap::fsm_handle_gw_no_subsystems(
break;
case gw_states_per_group_t::GW_WAIT_FAILBACK_PREPARED:
{
auto& gw_id_st = created_gws[group_key][gw_id];
cancel_timer(gw_id, group_key, grpid);
map_modified = true;
for (auto& gw_st: created_gws[group_key]) {
@ -673,13 +675,18 @@ void NVMeofGwMap::fsm_handle_gw_no_subsystems(
if (st.sm_state[grpid] ==
gw_states_per_group_t::GW_OWNER_WAIT_FAILBACK_PREPARED) {
dout(4) << "Warning: Outgoing Failback when GW is without subsystems"
<< " - to rollback it" <<" GW " << gw_id << "for ANA Group "
<<" Owner GW set to standby state " << gw_st.first << "for ANA Group "
<< grpid << dendl;
st.standby_state(grpid);
break;
}
}
break;
dout(4) << "Warning: Outgoing Failback when GW is without subsystems"
<<" Failback GW set to standby state " << gw_id << "for ANA Group "
<< grpid << dendl;
gw_id_st.standby_state(grpid);
}
break;
case gw_states_per_group_t::GW_OWNER_WAIT_FAILBACK_PREPARED:
case gw_states_per_group_t::GW_ACTIVE_STATE:
@ -716,6 +723,8 @@ void NVMeofGwMap::fsm_handle_gw_down(
break;
case gw_states_per_group_t::GW_WAIT_FAILBACK_PREPARED:
{
auto& gw_id_st = created_gws[group_key][gw_id];
cancel_timer(gw_id, group_key, grpid);
map_modified = true;
for (auto& gw_st: created_gws[group_key]) {
@ -724,13 +733,18 @@ void NVMeofGwMap::fsm_handle_gw_down(
if (st.sm_state[grpid] ==
gw_states_per_group_t::GW_OWNER_WAIT_FAILBACK_PREPARED) {
dout(4) << "Warning: Outgoing Failback when GW is down back"
<< " - to rollback it" <<" GW " << gw_id << "for ANA Group "
<<"Owner GW set to standby state " << gw_id << "for ANA Group "
<< grpid << dendl;
st.standby_state(grpid);
break;
}
}
break;
dout(4) << "Warning: Outgoing Failback when GW is down back"
<<" Failback GW set to standby state " << gw_id << "for ANA Group "
<< grpid << dendl;
gw_id_st.standby_state(grpid);
}
break;
case gw_states_per_group_t::GW_OWNER_WAIT_FAILBACK_PREPARED:
// nothing to do - let failback timer expire

View File

@ -607,11 +607,13 @@ bool NVMeofGwMon::prepare_beacon(MonOpRequestRef op)
if (sub.size() == 0) {
avail = gw_availability_t::GW_CREATED;
dout(20) << "No-subsystems condition detected for GW " << gw_id <<dendl;
} else {
bool listener_found = false;
bool listener_found = true;
for (auto &subs: sub) {
if (subs.listeners.size()) {
listener_found = true;
if (subs.listeners.size() == 0) {
listener_found = false;
dout(10) << "No-listeners condition detected for GW " << gw_id << " for nqn " << subs.nqn << dendl;
break;
}
}