]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mon/nvmeofgw*: fix no-listeners FSM, fix detection of no-listeners 60559/head
authorLeonid Chernin <leonidc@il.ibm.com>
Tue, 29 Oct 2024 11:30:15 +0000 (11:30 +0000)
committerLeonid Chernin <leonidc@il.ibm.com>
Sun, 3 Nov 2024 07:47:17 +0000 (07:47 +0000)
condition

Signed-off-by: Leonid Chernin <leonidc@il.ibm.com>
src/mon/NVMeofGwMap.cc
src/mon/NVMeofGwMon.cc

index c01ea9e71032163bcfb8b648e324352e0a825cbd..9fda03b49054e025fca568e027edecf9ba6f6bd4 100755 (executable)
@@ -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
index d9e936e27df34a8f292b7c711062b2fa1b19beb8..4d2b5074b4d50fafde432a3fa86d14fbc50a88ca 100644 (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;
       }
     }