File tree Expand file tree Collapse file tree 2 files changed +13
-0
lines changed
Expand file tree Collapse file tree 2 files changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -66,6 +66,11 @@ void NVMeofGwMon::on_shutdown()
6666
6767void NVMeofGwMon::tick ()
6868{
69+ if (++tick_ratio == 10 ) {
70+ global_rebalance_index++;
71+ dout (20 ) << " rebalance index " << global_rebalance_index << dendl;
72+ tick_ratio = 0 ;
73+ }
6974 if (!is_active () || !mon.is_leader ()) {
7075 dout (10 ) << " NVMeofGwMon leader : " << mon.is_leader ()
7176 << " active : " << is_active () << dendl;
@@ -317,6 +322,11 @@ bool NVMeofGwMon::preprocess_command(MonOpRequestRef op)
317322 f->dump_string (" group" , group);
318323 if (HAVE_FEATURE (mon.get_quorum_con_features (), NVMEOFHA)) {
319324 f->dump_string (" features" , " LB" );
325+ if (map.created_gws [group_key].size ()) {
326+ uint32_t index = (global_rebalance_index %
327+ map.created_gws [group_key].size ()) + 1 ;
328+ f->dump_unsigned (" rebalance_ana_group" , index);
329+ }
320330 }
321331 f->dump_unsigned (" num gws" , map.created_gws [group_key].size ());
322332 if (map.created_gws [group_key].size () == 0 ) {
Original file line number Diff line number Diff line change @@ -83,6 +83,9 @@ class NVMeofGwMon: public PaxosService,
8383 void check_sub (Subscription *sub);
8484
8585private:
86+ // used for calculate pool & group GW responsible for rebalance
87+ uint32_t global_rebalance_index = 1 ;
88+ uint8_t tick_ratio = 0 ;
8689 void synchronize_last_beacon ();
8790 void process_gw_down (const NvmeGwId &gw_id,
8891 const NvmeGroupKey& group_key, bool &propose_pending,
You can’t perform that action at this time.
0 commit comments