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;
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);
}
}
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,