From 5c7a38b4190399819ff91b4ab7d3b0fdf41af7d8 Mon Sep 17 00:00:00 2001 From: Jeet Jain Date: Mon, 22 Aug 2022 04:49:26 -0600 Subject: [PATCH] rgw: [CORTX-32693] Improve output of GC list Added is_multipart flag in GC list output updated deletion time to human readable time format. Signed-off-by: Jeet Jain --- src/rgw/motr/gc/gc.cc | 11 ++++++++++- src/rgw/rgw_admin.cc | 1 + 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/rgw/motr/gc/gc.cc b/src/rgw/motr/gc/gc.cc index 20f4251e268e9..a2f2d1eb50e75 100644 --- a/src/rgw/motr/gc/gc.cc +++ b/src/rgw/motr/gc/gc.cc @@ -427,11 +427,20 @@ int MotrGC::list(std::vector> &gc_e motr_gc_obj_info ginfo; ginfo.decode(blitr); std::unordered_map mp; + char t_str[100]; + std::string deletion_time; + if (std::strftime(t_str, sizeof(t_str), "%Y-%m-%dT%H:%M:%S%z%Z", std::localtime(&ginfo.deletion_time))) { + deletion_time = t_str; + } + else { + deletion_time = std::to_string(ginfo.deletion_time); + } mp["tag"] = ginfo.tag; mp["name"] = ginfo.name; - mp["deletion_time"] = std::to_string(ginfo.deletion_time); + mp["deletion_time"] = deletion_time; mp["size"] = std::to_string(ginfo.size); mp["size_actual"] = std::to_string(ginfo.size_actual); + mp["is_multipart"] = ginfo.is_multipart ? "true" : "false"; gc_entries.push_back(mp); ldout(cct, 70) << ginfo.tag << ", " << ginfo.name << ", " diff --git a/src/rgw/rgw_admin.cc b/src/rgw/rgw_admin.cc index 0a938699fe771..93207b6aa4484 100644 --- a/src/rgw/rgw_admin.cc +++ b/src/rgw/rgw_admin.cc @@ -7829,6 +7829,7 @@ int main(int argc, const char **argv) formatter->dump_string("deletion_time", ginfo["deletion_time"]); formatter->dump_string("size", ginfo["size"]); formatter->dump_string("size_actual", ginfo["size_actual"]); + formatter->dump_string("is_multipart", ginfo["is_multipart"]); formatter->close_section(); } formatter->close_section();