]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
librados: fix a way rados approximate per-pool net amount.
authorIgor Fedotov <ifedotov@suse.com>
Wed, 7 Mar 2018 13:26:54 +0000 (16:26 +0300)
committerIgor Fedotov <ifedotov@suse.com>
Thu, 6 Dec 2018 15:54:21 +0000 (18:54 +0300)
In fact that's just a workaround for now as we need proper raw_used_rate
present at librados.

Signed-off-by: Igor Fedotov <ifedotov@suse.com>
src/librados/librados_c.cc
src/librados/librados_cxx.cc

index 495f95ca25f077c90a393e90b6d1d90dc7203e8c..963dc4436028ca564a9fbeec55d1fed115aa2f78 100644 (file)
@@ -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;
index 43fdac13515a5aff24e615adf3c9145ee8f55122..601141670871f3eb317175e91695bdd8bea37200 100644 (file)
@@ -2483,10 +2483,10 @@ int librados::Rados::get_pool_stats(std::list<string>& 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);