From: shreyanshjain7174 Date: Mon, 11 Sep 2023 10:40:33 +0000 (-0400) Subject: RadosGW API: incorrect bucket quota in response to HEAD /{bucket}/?usage X-Git-Tag: v16.2.15~128^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F53439%2Fhead;p=ceph.git RadosGW API: incorrect bucket quota in response to HEAD /{bucket}/?usage When we try to get the bucket usage via various methods, through curl or while accessing rgw api endpoint at HEAD /{bucket}/?usage doesn't return the updated information. The endpoint was always returning the user quota and not the actual bucket quota which we see after querying the endpoint. Fixes: https://tracker.ceph.com/issues/62737 Signed-off-by: shreyanshjain7174 (cherry picked from commit 78cd82b6e9f36a91f47d44ad2cfae89add335d4c) Conflicts: - path: src/rgw/rgw_rest_s3.cc comment: resolve minor conflict --- diff --git a/src/rgw/rgw_rest_s3.cc b/src/rgw/rgw_rest_s3.cc index fe45f6c71d77..31499a729eef 100644 --- a/src/rgw/rgw_rest_s3.cc +++ b/src/rgw/rgw_rest_s3.cc @@ -2156,11 +2156,12 @@ static void dump_bucket_metadata(struct req_state *s, rgw::sal::RGWBucket* bucke // only bucket's owner is allowed to get the quota settings of the account if (bucket->is_owner(s->user.get())) { auto user_info = s->user->get_info(); + auto bucket_quota = s->bucket->get_info().quota; // bucket quota dump_header(s, "X-RGW-Quota-User-Size", static_cast(user_info.user_quota.max_size)); dump_header(s, "X-RGW-Quota-User-Objects", static_cast(user_info.user_quota.max_objects)); dump_header(s, "X-RGW-Quota-Max-Buckets", static_cast(user_info.max_buckets)); - dump_header(s, "X-RGW-Quota-Bucket-Size", static_cast(user_info.bucket_quota.max_size)); - dump_header(s, "X-RGW-Quota-Bucket-Objects", static_cast(user_info.bucket_quota.max_objects)); + dump_header(s, "X-RGW-Quota-Bucket-Size", static_cast(bucket_quota.max_size)); + dump_header(s, "X-RGW-Quota-Bucket-Objects", static_cast(bucket_quota.max_objects)); } }