From bfe3cd408bb65dafa3c0a580b8265d5395e382da Mon Sep 17 00:00:00 2001 From: Igor Fedotov Date: Wed, 7 Mar 2018 16:26:54 +0300 Subject: [PATCH] librados: fix a way rados approximate per-pool net amount. In fact that's just a workaround for now as we need proper raw_used_rate present at librados. Signed-off-by: Igor Fedotov --- src/librados/librados_c.cc | 8 ++++---- src/librados/librados_cxx.cc | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/librados/librados_c.cc b/src/librados/librados_c.cc index 495f95ca25f07..963dc4436028c 100644 --- a/src/librados/librados_c.cc +++ b/src/librados/librados_c.cc @@ -963,10 +963,10 @@ extern "C" int rados_ioctx_pool_stat(rados_ioctx_t io, struct rados_pool_stat_t ::pool_stat_t& r = rawresult[pool_name]; uint64_t allocated_bytes = r.get_allocated_bytes(); - // again, raw_used_rate is unknown hence using num_store_stats that - // will produce results similar to get_allocated_bytes(1.0) for legacy mode - // and stored / num_store_stats for the new collection mode - uint64_t user_bytes = r.get_user_bytes(r.num_store_stats); + // 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 = r.get_user_bytes(1.0); stats->num_kb = shift_round_up(allocated_bytes, 10); stats->num_bytes = allocated_bytes; diff --git a/src/librados/librados_cxx.cc b/src/librados/librados_cxx.cc index 43fdac13515a5..601141670871f 100644 --- a/src/librados/librados_cxx.cc +++ b/src/librados/librados_cxx.cc @@ -2483,10 +2483,10 @@ int librados::Rados::get_pool_stats(std::list& v, auto& pstat = p->second; store_statfs_t &statfs = pstat.store_stats; uint64_t allocated_bytes = pstat.get_allocated_bytes(); - // again, raw_used_rate is unknown hence using num_store_stats that - // will produce results similar to get_allocated_bytes() for legacy mode - // and stored / num_store_stats for the new collection mode - uint64_t user_bytes = pstat.get_user_bytes(pstat.num_store_stats); + // 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); object_stat_sum_t *sum = &p->second.stats.sum; pv.num_kb = shift_round_up(allocated_bytes, 10); -- 2.39.5