From 7752b9019d4444a499051669539cfd67b83e0d44 Mon Sep 17 00:00:00 2001 From: Cory Snyder Date: Wed, 4 Oct 2023 05:42:30 -0400 Subject: [PATCH] rgw: add versioning info to radosgw-admin bucket stats output This allows admins to more easily identify whether a bucket has versioning / object lock/ mfa enabled. Fixes: https://tracker.ceph.com/issues/63092 Signed-off-by: Cory Snyder --- src/rgw/driver/rados/rgw_bucket.cc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/rgw/driver/rados/rgw_bucket.cc b/src/rgw/driver/rados/rgw_bucket.cc index c4b89d6cd4c..e58b554f790 100644 --- a/src/rgw/driver/rados/rgw_bucket.cc +++ b/src/rgw/driver/rados/rgw_bucket.cc @@ -1290,6 +1290,8 @@ static int bucket_stats(rgw::sal::Driver* driver, return ret; } + const RGWBucketInfo& bucket_info = bucket->get_info(); + const auto& index = bucket->get_info().get_current_index(); if (is_layout_indexless(index)) { cerr << "error, indexless buckets do not maintain stats; bucket=" << @@ -1320,6 +1322,10 @@ static int bucket_stats(rgw::sal::Driver* driver, formatter->dump_string("id", bucket->get_bucket_id()); formatter->dump_string("marker", bucket->get_marker()); formatter->dump_stream("index_type") << bucket->get_info().layout.current_index.layout.type; + formatter->dump_bool("versioned", bucket_info.versioned()); + formatter->dump_bool("versioning_enabled", bucket_info.versioning_enabled()); + formatter->dump_bool("object_lock_enabled", bucket_info.obj_lock_enabled()); + formatter->dump_bool("mfa_enabled", bucket_info.mfa_enabled()); ::encode_json("owner", bucket->get_info().owner, formatter); formatter->dump_string("ver", bucket_ver); formatter->dump_string("master_ver", master_ver);