summaryrefslogtreecommitdiffstats
path: root/src/librados/librados_cxx.cc
diff options
context:
space:
mode:
authorSage Weil <sage@redhat.com>2019-07-11 00:12:16 +0200
committerSage Weil <sage@redhat.com>2019-07-11 16:04:18 +0200
commit5dcb6d81bbc2a4c4d0da4a33d9f6bbba5065a1ad (patch)
tree04a065b2c279c3cf439b1c909a818d6c0acee7dc /src/librados/librados_cxx.cc
parentosd: report whether we have per-pool stats (diff)
downloadceph-5dcb6d81bbc2a4c4d0da4a33d9f6bbba5065a1ad.tar.xz
ceph-5dcb6d81bbc2a4c4d0da4a33d9f6bbba5065a1ad.zip
mon: use per-pool stats only when all OSDs are reporting
Previously, we would start using the per-pool stat sums as soon as *any* OSDs were reporting. For a legacy cluster, that meant that as soon as one bluestore instance is updated or one new bluestore OSD is created, the usage stats per pool would become useless. Instead, only use the per-pool stats once *all* OSDs are reporting the new values. This mostly aligns with the health warning when one more bluestore OSDs are not reporting; once they are update the warning goes away. (That does not factor in fielstore OSDs, though; all OSDs need to be new *and* bluestore.) Signed-off-by: Sage Weil <sage@redhat.com>
Diffstat (limited to 'src/librados/librados_cxx.cc')
-rw-r--r--src/librados/librados_cxx.cc7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/librados/librados_cxx.cc b/src/librados/librados_cxx.cc
index 4dc75a8900b..7a5094f1ad7 100644
--- a/src/librados/librados_cxx.cc
+++ b/src/librados/librados_cxx.cc
@@ -2563,18 +2563,19 @@ int librados::Rados::get_pool_stats(std::list<string>& v,
stats_map& result)
{
map<string,::pool_stat_t> rawresult;
- int r = client->get_pool_stats(v, rawresult);
+ bool per_pool = false;
+ int r = client->get_pool_stats(v, &rawresult, &per_pool);
for (map<string,::pool_stat_t>::iterator p = rawresult.begin();
p != rawresult.end();
++p) {
pool_stat_t& pv = result[p->first];
auto& pstat = p->second;
store_statfs_t &statfs = pstat.store_stats;
- uint64_t allocated_bytes = pstat.get_allocated_bytes();
+ uint64_t allocated_bytes = pstat.get_allocated_bytes(per_pool);
// FIXME: raw_used_rate is unknown hence use 1.0 here
// meaning we keep net amount aggregated over all replicas
// Not a big deal so far since this field isn't exposed
- uint64_t user_bytes = pstat.get_user_bytes(1.0);
+ uint64_t user_bytes = pstat.get_user_bytes(1.0, per_pool);
object_stat_sum_t *sum = &p->second.stats.sum;
pv.num_kb = shift_round_up(allocated_bytes, 10);