rgw: use RGWStorageStats::dump() to format 'bucket stats'

Signed-off-by: Casey Bodley <cbodley@redhat.com>
This commit is contained in:
Casey Bodley 2016-09-29 17:04:30 -04:00 committed by Adam Kupczyk
parent df64c45803
commit b6e6fc107e
2 changed files with 4 additions and 8 deletions

View File

@ -976,11 +976,7 @@ static void dump_bucket_usage(map<RGWObjCategory, RGWStorageStats>& stats, Forma
RGWStorageStats& s = iter->second;
const char *cat_name = rgw_obj_category_name(iter->first);
formatter->open_object_section(cat_name);
formatter->dump_int("size", s.size);
formatter->dump_int("size_actual", s.size_rounded);
formatter->dump_int("size_kb", rgw_rounded_kb(s.size));
formatter->dump_int("size_kb_actual", rgw_rounded_kb(s.size_rounded));
formatter->dump_int("num_objects", s.num_objects);
s.dump(formatter);
formatter->close_section();
}
formatter->close_section();

View File

@ -594,9 +594,9 @@ void RGWBucketEntryPoint::decode_json(JSONObj *obj) {
void RGWStorageStats::dump(Formatter *f) const
{
encode_json("size", size, f);
encode_json("size_rounded", size_rounded, f);
encode_json("num_kb", rgw_rounded_kb(size), f);
encode_json("num_kb_rounded", rgw_rounded_kb(size_rounded), f);
encode_json("size_actual", size_rounded, f);
encode_json("size_kb", rgw_rounded_kb(size), f);
encode_json("size_kb_actual", rgw_rounded_kb(size_rounded), f);
encode_json("num_objects", num_objects, f);
}