From: Igor Fedotov Date: Wed, 7 Mar 2018 13:26:54 +0000 (+0300) Subject: librados: fix a way rados approximate per-pool net amount. X-Git-Tag: v14.1.0~692^2~11 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=bfe3cd408bb65dafa3c0a580b8265d5395e382da;p=ceph.git 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 --- diff --git a/src/librados/librados_c.cc b/src/librados/librados_c.cc index 495f95ca25f..963dc443602 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 43fdac13515..60114167087 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);