@@ -247,6 +247,30 @@ void NVMeofGwMap::track_deleting_gws(const NvmeGroupKey& group_key,
247247 }
248248}
249249
250+ int NVMeofGwMap::process_gw_map_gw_no_subsystems (
251+ const NvmeGwId &gw_id, const NvmeGroupKey& group_key, bool &propose_pending)
252+ {
253+ int rc = 0 ;
254+ auto & gws_states = created_gws[group_key];
255+ auto gw_state = gws_states.find (gw_id);
256+ if (gw_state != gws_states.end ()) {
257+ dout (10 ) << " GW- no subsystems configured " << gw_id << dendl;
258+ auto & st = gw_state->second ;
259+ st.availability = gw_availability_t ::GW_CREATED;
260+ for (auto & state_itr: created_gws[group_key][gw_id].sm_state ) {
261+ fsm_handle_gw_no_subsystems (
262+ gw_id, group_key, state_itr.second ,state_itr.first , propose_pending);
263+ }
264+ propose_pending = true ; // map should reflect that gw becames Created
265+ if (propose_pending) validate_gw_map (group_key);
266+ } else {
267+ dout (1 ) << __FUNCTION__ << " ERROR GW-id was not found in the map "
268+ << gw_id << dendl;
269+ rc = -EINVAL;
270+ }
271+ return rc;
272+ }
273+
250274int NVMeofGwMap::process_gw_map_gw_down (
251275 const NvmeGwId &gw_id, const NvmeGroupKey& group_key, bool &propose_pending)
252276{
@@ -263,7 +287,7 @@ int NVMeofGwMap::process_gw_map_gw_down(
263287 state_itr.first , propose_pending);
264288 state_itr.second = gw_states_per_group_t ::GW_STANDBY_STATE;
265289 }
266- propose_pending = true ; // map should reflect that gw becames unavailable
290+ propose_pending = true ; // map should reflect that gw becames Unavailable
267291 if (propose_pending) validate_gw_map (group_key);
268292 } else {
269293 dout (1 ) << __FUNCTION__ << " ERROR GW-id was not found in the map "
@@ -615,6 +639,59 @@ void NVMeofGwMap::fsm_handle_gw_alive(
615639 }
616640}
617641
642+ void NVMeofGwMap::fsm_handle_gw_no_subsystems (
643+ const NvmeGwId &gw_id, const NvmeGroupKey& group_key,
644+ gw_states_per_group_t state, NvmeAnaGrpId grpid, bool &map_modified)
645+ {
646+ switch (state) {
647+ case gw_states_per_group_t ::GW_STANDBY_STATE:
648+ case gw_states_per_group_t ::GW_IDLE_STATE:
649+ // nothing to do
650+ break ;
651+
652+ case gw_states_per_group_t ::GW_WAIT_BLOCKLIST_CMPL:
653+ {
654+ cancel_timer (gw_id, group_key, grpid);
655+ auto & gw_st = created_gws[group_key][gw_id];
656+ gw_st.standby_state (grpid);
657+ map_modified = true ;
658+ }
659+ break ;
660+
661+ case gw_states_per_group_t ::GW_WAIT_FAILBACK_PREPARED:
662+ cancel_timer (gw_id, group_key, grpid);
663+ map_modified = true ;
664+ for (auto & gw_st: created_gws[group_key]) {
665+ auto & st = gw_st.second ;
666+ // found GW that was intended for Failback for this ana grp
667+ if (st.sm_state [grpid] ==
668+ gw_states_per_group_t ::GW_OWNER_WAIT_FAILBACK_PREPARED) {
669+ dout (4 ) << " Warning: Outgoing Failback when GW is without subsystems"
670+ << " - to rollback it" <<" GW " << gw_id << " for ANA Group "
671+ << grpid << dendl;
672+ st.standby_state (grpid);
673+ break ;
674+ }
675+ }
676+ break ;
677+
678+ case gw_states_per_group_t ::GW_OWNER_WAIT_FAILBACK_PREPARED:
679+ case gw_states_per_group_t ::GW_ACTIVE_STATE:
680+ {
681+ dout (4 ) << " Set state to Standby for GW " << gw_id << " group "
682+ << grpid << dendl;
683+ auto & gw_st = created_gws[group_key][gw_id];
684+ gw_st.standby_state (grpid);
685+ }
686+ break ;
687+
688+ default :
689+ {
690+ dout (4 ) << " Error : Invalid state " << state << " for GW " << gw_id << dendl;
691+ }
692+ }
693+ }
694+
618695void NVMeofGwMap::fsm_handle_gw_down (
619696 const NvmeGwId &gw_id, const NvmeGroupKey& group_key,
620697 gw_states_per_group_t state, NvmeAnaGrpId grpid, bool &map_modified)
0 commit comments