From d1113c77f97c3ca4245ce2431f842be7a2860b83 Mon Sep 17 00:00:00 2001 From: "Sumedh A. Kulkarni" Date: Wed, 4 May 2022 05:16:25 -0600 Subject: [PATCH] rgw_rest_bucket: Support max-size attr for SetBucketQuota REST API `max-size` attr is not supported for SetBucketQuota as that of SetUserQuota. Adding support for the attribute, keeping the `max-size-kb` as dominating in case both are mentioned. Signed-off-by: Sumedh A. Kulkarni --- src/rgw/rgw_rest_bucket.cc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/rgw/rgw_rest_bucket.cc b/src/rgw/rgw_rest_bucket.cc index 8a1cf3f754d..748b983cd2e 100644 --- a/src/rgw/rgw_rest_bucket.cc +++ b/src/rgw/rgw_rest_bucket.cc @@ -296,9 +296,12 @@ void RGWOp_Set_Bucket_Quota::execute(optional_yield y) RGWQuotaInfo *old_quota = &bucket->get_info().quota; int64_t old_max_size_kb = rgw_rounded_kb(old_quota->max_size); int64_t max_size_kb; + bool has_max_size_kb = false; RESTArgs::get_int64(s, "max-objects", old_quota->max_objects, "a.max_objects); - RESTArgs::get_int64(s, "max-size-kb", old_max_size_kb, &max_size_kb); - quota.max_size = max_size_kb * 1024; + RESTArgs::get_int64(s, "max-size", old_quota->max_size, "a.max_size); + RESTArgs::get_int64(s, "max-size-kb", old_max_size_kb, &max_size_kb, &has_max_size_kb); + if (has_max_size_kb) + quota.max_size = max_size_kb * 1024; RESTArgs::get_bool(s, "enabled", old_quota->enabled, "a.enabled); } -- 2.39.5