Skip to content

Commit 47e9c85

Browse files
authored
Merge pull request ceph#60663 from leonidc/wip-publish-rebalance-ana-group
mon/nvmeofgw*: monitors publish in nvme-gw show ana group responsible
2 parents 87eefcd + c358483 commit 47e9c85

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

src/mon/NVMeofGwMon.cc

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,11 @@ void NVMeofGwMon::on_shutdown()
6666

6767
void 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) {

src/mon/NVMeofGwMon.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,9 @@ class NVMeofGwMon: public PaxosService,
8383
void check_sub(Subscription *sub);
8484

8585
private:
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,

0 commit comments

Comments
 (0)