]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
nvmeofgw* : fix publishing rebalance index 61091/head
authorLeonid Chernin <leonidc@il.ibm.com>
Sun, 15 Dec 2024 11:45:59 +0000 (11:45 +0000)
committerLeonid Chernin <leonidc@il.ibm.com>
Tue, 17 Dec 2024 08:25:47 +0000 (08:25 +0000)
Signed-off-by: Leonid Chernin <leonidc@il.ibm.com>
src/mon/NVMeofGwMon.cc
src/mon/NVMeofGwMon.h

index 0fe5c3e655f7d2b208db51ebc06eeda23710598c..c9f6dee10f095f1c124c171233a0c87062bbe0da 100644 (file)
@@ -66,11 +66,6 @@ void NVMeofGwMon::on_shutdown()
 
 void NVMeofGwMon::tick()
 {
-  if (++tick_ratio == 10) {
-    global_rebalance_index++;
-    dout(20) <<  "rebalance index " << global_rebalance_index << dendl;
-    tick_ratio = 0;
-  }
   if (!is_active() || !mon.is_leader()) {
     dout(10) << "NVMeofGwMon leader : " << mon.is_leader()
             << "active : " << is_active()  << dendl;
@@ -329,8 +324,9 @@ bool NVMeofGwMon::preprocess_command(MonOpRequestRef op)
     if (HAVE_FEATURE(mon.get_quorum_con_features(), NVMEOFHA)) {
       f->dump_string("features", "LB");
       if (map.created_gws[group_key].size()) {
-        uint32_t index = (global_rebalance_index %
-              map.created_gws[group_key].size()) + 1;
+        time_t seconds_since_1970 = time(NULL);
+        uint32_t index = ((seconds_since_1970/60) %
+             map.created_gws[group_key].size()) + 1;
         f->dump_unsigned("rebalance_ana_group", index);
       }
     }
index 2d13e153bd20ad83833aef88f9ae95a0a3e805d4..7fae8b766a5e7fe46d0bd6f4b73eb2f80bf0ff59 100644 (file)
@@ -83,9 +83,6 @@ public:
   void check_sub(Subscription *sub);
 
 private:
-  // used for calculate pool & group GW responsible for rebalance
-  uint32_t global_rebalance_index = 1;
-  uint8_t  tick_ratio = 0;
   void synchronize_last_beacon();
   void process_gw_down(const NvmeGwId &gw_id,
      const NvmeGroupKey& group_key, bool &propose_pending,