Compare commits
2 Commits
57bcba2406
...
d007a374f2
Author | SHA1 | Date |
---|---|---|
Vitaliy Filippov | d007a374f2 | |
Vitaliy Filippov | 45c0694853 |
14
mon/mon.js
14
mon/mon.js
|
@ -1608,7 +1608,7 @@ class Mon
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return inode_stats;
|
return { inode_stats, seen_pools };
|
||||||
}
|
}
|
||||||
|
|
||||||
serialize_bigints(obj)
|
serialize_bigints(obj)
|
||||||
|
@ -1634,7 +1634,7 @@ class Mon
|
||||||
const timestamp = Date.now();
|
const timestamp = Date.now();
|
||||||
const { object_counts, object_bytes } = this.sum_object_counts();
|
const { object_counts, object_bytes } = this.sum_object_counts();
|
||||||
let stats = this.sum_op_stats(timestamp, this.prev_stats);
|
let stats = this.sum_op_stats(timestamp, this.prev_stats);
|
||||||
let inode_stats = this.sum_inode_stats(
|
let { inode_stats, seen_pools } = this.sum_inode_stats(
|
||||||
this.prev_stats ? this.prev_stats.inode_stats : null,
|
this.prev_stats ? this.prev_stats.inode_stats : null,
|
||||||
timestamp, this.prev_stats ? this.prev_stats.timestamp : null
|
timestamp, this.prev_stats ? this.prev_stats.timestamp : null
|
||||||
);
|
);
|
||||||
|
@ -1668,6 +1668,15 @@ class Mon
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (const pool_id in this.state.pool.stats)
|
for (const pool_id in this.state.pool.stats)
|
||||||
|
{
|
||||||
|
if (!seen_pools[pool_id])
|
||||||
|
{
|
||||||
|
txn.push({ requestDeleteRange: {
|
||||||
|
key: b64(this.etcd_prefix+'/pool/stats/'+pool_id),
|
||||||
|
} });
|
||||||
|
delete this.state.pool.stats[pool_id];
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
const pool_stats = { ...this.state.pool.stats[pool_id] };
|
const pool_stats = { ...this.state.pool.stats[pool_id] };
|
||||||
this.serialize_bigints(pool_stats);
|
this.serialize_bigints(pool_stats);
|
||||||
|
@ -1676,6 +1685,7 @@ class Mon
|
||||||
value: b64(JSON.stringify(pool_stats)),
|
value: b64(JSON.stringify(pool_stats)),
|
||||||
} });
|
} });
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (txn.length)
|
if (txn.length)
|
||||||
{
|
{
|
||||||
await this.etcd_call('/kv/txn', { success: txn }, this.config.etcd_mon_timeout, 0);
|
await this.etcd_call('/kv/txn', { success: txn }, this.config.etcd_mon_timeout, 0);
|
||||||
|
|
|
@ -187,22 +187,30 @@ void etcd_state_client_t::add_etcd_url(std::string addr)
|
||||||
check_addr = addr;
|
check_addr = addr;
|
||||||
if (pos == std::string::npos)
|
if (pos == std::string::npos)
|
||||||
addr += "/v3";
|
addr += "/v3";
|
||||||
|
bool local = false;
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i < local_ips.size(); i++)
|
for (i = 0; i < local_ips.size(); i++)
|
||||||
{
|
{
|
||||||
if (local_ips[i] == check_addr)
|
if (local_ips[i] == check_addr)
|
||||||
{
|
{
|
||||||
this->etcd_local.push_back(addr);
|
local = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (i >= local_ips.size())
|
auto & to = local ? this->etcd_local : this->etcd_addresses;
|
||||||
this->etcd_addresses.push_back(addr);
|
for (i = 0; i < to.size(); i++)
|
||||||
|
{
|
||||||
|
if (to[i] == addr)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (i >= to.size())
|
||||||
|
to.push_back(addr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void etcd_state_client_t::parse_config(const json11::Json & config)
|
void etcd_state_client_t::parse_config(const json11::Json & config)
|
||||||
{
|
{
|
||||||
|
this->etcd_local.clear();
|
||||||
this->etcd_addresses.clear();
|
this->etcd_addresses.clear();
|
||||||
if (config["etcd_address"].is_string())
|
if (config["etcd_address"].is_string())
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue