]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
nvmeofgw: fix issue of delete all gws from the pool/group 65236/head
authorLeonid Chernin <leonidc@il.ibm.com>
Tue, 26 Aug 2025 12:34:32 +0000 (15:34 +0300)
committerLeonid Chernin <leonidc@il.ibm.com>
Sun, 31 Aug 2025 14:26:26 +0000 (17:26 +0300)
          when gws not removed from the map

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

index 4b3fb2c676bb8fa8e13c938e1c9468282a4323ee..a2ed42f04c832e5e2585793f926cba2082f194c1 100755 (executable)
@@ -190,6 +190,26 @@ int NVMeofGwMap::cfg_delete_gw(
   return -EINVAL;
 }
 
+void NVMeofGwMap::check_all_gws_in_deleting_state(const NvmeGwId &gw_id,
+    const NvmeGroupKey& group_key) {
+  for (auto& gws_states: created_gws[group_key]) {
+    auto& state = gws_states.second;
+    if (state.availability != gw_availability_t::GW_DELETING) {
+      return;
+    }
+  }
+  dout(5) << "all gws in DELETING state, remove them from the map: pool/group "
+                 << group_key << dendl;
+  /* Monitor have to force remove GWs because otherwise all GW will stay forever
+   * in  DELETING state - no beacons from the group and monitor cannot update
+   * number namespaces in each group so delete condition newer turns true.
+  */
+  for (auto& gws_states: created_gws[group_key]) {
+    do_delete_gw(gws_states.first, group_key);
+  }
+  return;
+}
+
 int  NVMeofGwMap::do_erase_gw_id(const NvmeGwId &gw_id,
       const NvmeGroupKey& group_key) {
 
index 015577f248ad7bf97ecdbe4fe818ea2d0266f050..36e29817ea9462252a812f09dfb46d81e0dba404 100755 (executable)
@@ -66,6 +66,8 @@ public:
     const BeaconSubsystems&  subs, bool &propose_pending);
   int cfg_add_gw(const NvmeGwId &gw_id, const NvmeGroupKey& group_key);
   int cfg_delete_gw(const NvmeGwId &gw_id, const NvmeGroupKey& group_key);
+  void check_all_gws_in_deleting_state(const NvmeGwId &gw_id,
+    const NvmeGroupKey& group_key);
   void process_gw_map_ka(
     const NvmeGwId &gw_id, const NvmeGroupKey& group_key,
     epoch_t& last_osd_epoch,  bool &propose_pending);
index 3a18c4195c0b8c13637423784d053b320364e020..eea35271dd4c76f08ba9dfb36228cf7302626664 100644 (file)
@@ -560,6 +560,7 @@ bool NVMeofGwMon::prepare_command(MonOpRequestRef op)
         // Simulate  immediate Failover of this GW
         process_gw_down(id, group_key, propose,
            gw_availability_t::GW_UNAVAILABLE);
+        pending_map.check_all_gws_in_deleting_state(id, group_key);
       } else if (rc == -EINVAL) {
        dout (4) << "Error: GW not found in the database " << id << " "
                 << pool << " " << group << "  rc " << rc << dendl;