]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
RadosGW API: incorrect bucket quota in response to HEAD /{bucket}/?usage 53439/head
authorshreyanshjain7174 <ssanchet@redhat.com>
Mon, 11 Sep 2023 10:40:33 +0000 (06:40 -0400)
committerKonstantin Shalygin <k0ste@k0ste.ru>
Sat, 14 Oct 2023 07:59:18 +0000 (14:59 +0700)
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 <ssanchet@redhat.com>
(cherry picked from commit 78cd82b6e9f36a91f47d44ad2cfae89add335d4c)

Conflicts:
  - path: src/rgw/rgw_rest_s3.cc
    comment: resolve minor conflict

src/rgw/rgw_rest_s3.cc

index fe45f6c71d7777d5a1dc80ff52e182680802a871..31499a729eeff02fefa9cf110ccd5e3c59e43231 100644 (file)
@@ -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<long long>(user_info.user_quota.max_size));
     dump_header(s, "X-RGW-Quota-User-Objects", static_cast<long long>(user_info.user_quota.max_objects));
     dump_header(s, "X-RGW-Quota-Max-Buckets", static_cast<long long>(user_info.max_buckets));
-    dump_header(s, "X-RGW-Quota-Bucket-Size", static_cast<long long>(user_info.bucket_quota.max_size));
-    dump_header(s, "X-RGW-Quota-Bucket-Objects", static_cast<long long>(user_info.bucket_quota.max_objects));
+    dump_header(s, "X-RGW-Quota-Bucket-Size", static_cast<long long>(bucket_quota.max_size));
+    dump_header(s, "X-RGW-Quota-Bucket-Objects", static_cast<long long>(bucket_quota.max_objects));
   }
 }