From: Radoslaw Zarzynski Date: Mon, 9 May 2016 16:37:57 +0000 (+0200) Subject: rgw: modify bucket quota procedures to accomodate account quota as well. X-Git-Tag: v11.0.0~349^2~5 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=e61a0914ba66796e57358bb7e24b0e736f30999a;p=ceph.git rgw: modify bucket quota procedures to accomodate account quota as well. Signed-off-by: Radoslaw Zarzynski --- diff --git a/src/rgw/rgw_common.h b/src/rgw/rgw_common.h index 677f83cc5ffc..b3a5057df6a0 100644 --- a/src/rgw/rgw_common.h +++ b/src/rgw/rgw_common.h @@ -88,9 +88,9 @@ using ceph::crypto::MD5; #define RGW_ATTR_TEMPURL_KEY1 RGW_ATTR_META_PREFIX "temp-url-key" #define RGW_ATTR_TEMPURL_KEY2 RGW_ATTR_META_PREFIX "temp-url-key-2" -/* Container quota of the Swift API. */ -#define RGW_ATTR_CQUOTA_NOBJS RGW_ATTR_META_PREFIX "quota-count" -#define RGW_ATTR_CQUOTA_MSIZE RGW_ATTR_META_PREFIX "quota-bytes" +/* Account/container quota of the Swift API. */ +#define RGW_ATTR_QUOTA_NOBJS RGW_ATTR_META_PREFIX "quota-count" +#define RGW_ATTR_QUOTA_MSIZE RGW_ATTR_META_PREFIX "quota-bytes" #define RGW_ATTR_OLH_PREFIX RGW_ATTR_PREFIX "olh." diff --git a/src/rgw/rgw_op.cc b/src/rgw/rgw_op.cc index 690d8f240b00..99297c9038b5 100644 --- a/src/rgw/rgw_op.cc +++ b/src/rgw/rgw_op.cc @@ -1912,12 +1912,12 @@ static void populate_with_generic_attrs(const req_state * const s, } -static int filter_out_bucket_quota(std::map& add_attrs, - const std::set& rmattr_names, - RGWQuotaInfo& quota) +static int filter_out_quota_info(std::map& add_attrs, + const std::set& rmattr_names, + RGWQuotaInfo& quota) { /* Put new limit on max objects. */ - auto iter = add_attrs.find(RGW_ATTR_CQUOTA_NOBJS); + auto iter = add_attrs.find(RGW_ATTR_QUOTA_NOBJS); std::string err; if (std::end(add_attrs) != iter) { quota.max_objects = @@ -1929,7 +1929,7 @@ static int filter_out_bucket_quota(std::map& add_attrs, } /* Put new limit on bucket (container) size. */ - iter = add_attrs.find(RGW_ATTR_CQUOTA_MSIZE); + iter = add_attrs.find(RGW_ATTR_QUOTA_MSIZE); if (iter != add_attrs.end()) { quota.max_size = static_cast(strict_strtoll(iter->second.c_str(), 10, &err)); @@ -1941,12 +1941,12 @@ static int filter_out_bucket_quota(std::map& add_attrs, for (const auto& name : rmattr_names) { /* Remove limit on max objects. */ - if (name.compare(RGW_ATTR_CQUOTA_NOBJS) == 0) { + if (name.compare(RGW_ATTR_QUOTA_NOBJS) == 0) { quota.max_objects = -1; } /* Remove limit on max bucket size. */ - if (name.compare(RGW_ATTR_CQUOTA_MSIZE) == 0) { + if (name.compare(RGW_ATTR_QUOTA_MSIZE) == 0) { quota.max_size = -1; } } @@ -2069,7 +2069,7 @@ void RGWCreateBucket::execute() prepare_add_del_attrs(s->bucket_attrs, rmattr_names, attrs); populate_with_generic_attrs(s, attrs); - op_ret = filter_out_bucket_quota(attrs, rmattr_names, quota_info); + op_ret = filter_out_quota_info(attrs, rmattr_names, quota_info); if (op_ret < 0) { return; } @@ -2150,7 +2150,7 @@ void RGWCreateBucket::execute() rgw_get_request_metadata(s->cct, s->info, attrs, false); prepare_add_del_attrs(s->bucket_attrs, rmattr_names, attrs); populate_with_generic_attrs(s, attrs); - op_ret = filter_out_bucket_quota(attrs, rmattr_names, s->bucket_info.quota); + op_ret = filter_out_quota_info(attrs, rmattr_names, s->bucket_info.quota); if (op_ret < 0) { return; } @@ -2972,7 +2972,7 @@ void RGWPutMetadataBucket::execute() * implementation: anyone with write permissions is able to set the bucket * quota. This stays in contrast to account quotas that can be set only by * clients holding reseller admin privileges. */ - op_ret = filter_out_bucket_quota(attrs, rmattr_names, s->bucket_info.quota); + op_ret = filter_out_quota_info(attrs, rmattr_names, s->bucket_info.quota); if (op_ret < 0) { return; }