]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
RadosGW API: incorrect bucket quota in response to HEAD /{bucket}/?usage 53391/head
authorshreyanshjain7174 <ssanchet@redhat.com>
Mon, 11 Sep 2023 10:40:33 +0000 (06:40 -0400)
committershreyanshjain7174 <ssanchet@redhat.com>
Mon, 11 Sep 2023 15:06:19 +0000 (11:06 -0400)
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>
src/rgw/rgw_rest_s3.cc

index 472b479994c633eb3680ca5cb77fbc21df6eedfc..578ab46ed40d7376b780a9723b5514e77b2115bd 100644 (file)
@@ -2345,11 +2345,12 @@ static void dump_bucket_metadata(req_state *s, rgw::sal::Bucket* bucket)
   // 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.quota.user_quota.max_size));
     dump_header(s, "X-RGW-Quota-User-Objects", static_cast<long long>(user_info.quota.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.quota.bucket_quota.max_size));
-    dump_header(s, "X-RGW-Quota-Bucket-Objects", static_cast<long long>(user_info.quota.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));
   }
 }