]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
mon/nvmeofgw*: monitors publish in nvme-gw show ana group responsible
authorLeonid Chernin <leonidc@il.ibm.com>
Wed, 6 Nov 2024 11:04:16 +0000 (11:04 +0000)
committerLeonid Chernin <leonidc@il.ibm.com>
Fri, 8 Nov 2024 07:02:36 +0000 (07:02 +0000)
 for  namespace rebalance

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

index 4d2b5074b4d50fafde432a3fa86d14fbc50a88ca..9d80c23a4c1070017388f12c653270f18dcaeaa1 100644 (file)
@@ -66,6 +66,11 @@ 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;
@@ -317,6 +322,11 @@ bool NVMeofGwMon::preprocess_command(MonOpRequestRef op)
     f->dump_string("group", group);
     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;
+        f->dump_unsigned("rebalance_ana_group", index);
+      }
     }
     f->dump_unsigned("num gws", map.created_gws[group_key].size());
     if (map.created_gws[group_key].size() == 0) {
index 7fae8b766a5e7fe46d0bd6f4b73eb2f80bf0ff59..2d13e153bd20ad83833aef88f9ae95a0a3e805d4 100644 (file)
@@ -83,6 +83,9 @@ 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,