From 4397c029ee8944a42348cf91c2f69fe7ea78cbda Mon Sep 17 00:00:00 2001 From: Leonid Chernin Date: Tue, 21 Jan 2025 13:05:09 +0000 Subject: [PATCH] nvmeofgw*: 2 fixes - for duplicated optimized pathes and fix for GW startup 1. fix duplicated optimized host's pathes - trigger process_gw_down upon fast-gw reboot, removed old fast-reboot handlers 2. fix GW startup - trigger process_gw_down when expired WAIT_BLOCKLIST timer Signed-off-by: Leonid Chernin --- src/mon/NVMeofGwMap.cc | 61 +++--------------------------------------- src/mon/NVMeofGwMap.h | 3 --- src/mon/NVMeofGwMon.cc | 2 +- 3 files changed, 4 insertions(+), 62 deletions(-) diff --git a/src/mon/NVMeofGwMap.cc b/src/mon/NVMeofGwMap.cc index 2d2735f1e7c2e..26c16740ecbad 100755 --- a/src/mon/NVMeofGwMap.cc +++ b/src/mon/NVMeofGwMap.cc @@ -557,61 +557,6 @@ void NVMeofGwMap::find_failover_candidate( } } -void NVMeofGwMap::handle_gw_performing_fast_reboot(const NvmeGwId &gw_id, - const NvmeGroupKey& group_key, bool &map_modified) -{ - for (auto& state_itr: created_gws[group_key][gw_id].sm_state ) { - fsm_handle_gw_fast_reboot(gw_id,group_key, state_itr.first, map_modified); - } -} - -void NVMeofGwMap::fsm_handle_gw_fast_reboot(const NvmeGwId &gw_id, - const NvmeGroupKey& group_key, NvmeAnaGrpId grpid, bool &map_modified) -{ - // GW that appears in the internal map as Available, performed reboot, - // need to re-apply this GW: to load proper states for all active ANA groups - auto& gw_state = created_gws[group_key][gw_id]; - map_modified = true; - gw_states_per_group_t state = gw_state.sm_state[grpid]; - dout(10) << "GW " << gw_id << " ANA groupId: " << grpid << " state " - << state << dendl; - switch (state){ - case gw_states_per_group_t::GW_IDLE_STATE: - case gw_states_per_group_t::GW_STANDBY_STATE: - case gw_states_per_group_t::GW_ACTIVE_STATE: - break; - - case gw_states_per_group_t::GW_WAIT_FAILBACK_PREPARED: - { - //restart timeout - start_timer(gw_id, group_key, grpid, 3); - } - break; - - case gw_states_per_group_t::GW_OWNER_WAIT_FAILBACK_PREPARED: - { - // since owner was reseted for this group, wait for the background process - // to choose it again - gw_state.standby_state(grpid); - } - break; - - case gw_states_per_group_t::GW_WAIT_BLOCKLIST_CMPL: - { - //restart timer - // The blocklist was started, need to wait for the epoch in the GW - start_timer(gw_id, group_key, grpid, 30); - } - break; - - default: - { - dout(4) << "Warning: GW " << gw_id << " Invalid state " << state << dendl; - } - } - validate_gw_map(group_key); -} - void NVMeofGwMap::fsm_handle_gw_alive( const NvmeGwId &gw_id, const NvmeGroupKey& group_key, NvmeGwMonState & gw_state, gw_states_per_group_t state, @@ -866,11 +811,11 @@ void NVMeofGwMap::fsm_handle_to_expired( } } else if (fbp_gw_state.sm_state[grpid] == gw_states_per_group_t::GW_WAIT_BLOCKLIST_CMPL) { - dout(4) << "Warning: Expired GW_WAIT_FAILOVER_PREPARED timer " + dout(4) << "Warning: Expired GW_WAIT_BLOCKLIST_CMPL timer " << "from GW, Force exit the GW " << gw_id << " ANA groupId: "<< grpid << dendl; - fbp_gw_state.set_unavailable_state(); - map_modified = true; + //another Trigger for GW down (failover) + process_gw_map_gw_down(gw_id, group_key, map_modified); } if (map_modified) validate_gw_map(group_key); } diff --git a/src/mon/NVMeofGwMap.h b/src/mon/NVMeofGwMap.h index 85fd62b3a07d8..2fd3834686989 100755 --- a/src/mon/NVMeofGwMap.h +++ b/src/mon/NVMeofGwMap.h @@ -96,9 +96,6 @@ private: void fsm_handle_to_expired( const NvmeGwId &gw_id, const NvmeGroupKey& group_key, NvmeAnaGrpId grpid, bool &map_modified); - void fsm_handle_gw_fast_reboot(const NvmeGwId &gw_id, - const NvmeGroupKey& group_key, NvmeAnaGrpId grpid, - bool &map_modified); void find_failover_candidate( const NvmeGwId &gw_id, const NvmeGroupKey& group_key, NvmeAnaGrpId grpid, bool &propose_pending); diff --git a/src/mon/NVMeofGwMon.cc b/src/mon/NVMeofGwMon.cc index c9a6b789b8940..0d735a5145ca3 100644 --- a/src/mon/NVMeofGwMon.cc +++ b/src/mon/NVMeofGwMon.cc @@ -553,7 +553,7 @@ bool NVMeofGwMon::prepare_beacon(MonOpRequestRef op) dout(4) << " Warning :GW marked as Available in the NVmeofGwMon " << "database, performed full startup - Apply GW!" << gw_id << dendl; - pending_map.handle_gw_performing_fast_reboot(gw_id, group_key, propose); + process_gw_down(gw_id, group_key, propose, avail); LastBeacon lb = {gw_id, group_key}; last_beacon[lb] = now; //Update last beacon } else if ( -- 2.39.5