emplace_attr(RGW_ATTR_CORS, std::move(corsbl));
}
+ RGWQuotaInfo quota_info;
+ const RGWQuotaInfo * pquota_info = nullptr;
if (need_metadata_upload()) {
/* It's supposed that following functions WILL NOT change any special
* attributes (like RGW_ATTR_ACL) if they are already present in attrs. */
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, quota_info);
+ if (op_ret < 0) {
+ return;
+ }
+
+ pquota_info = "a_info;
}
s->bucket.tenant = s->bucket_tenant; /* ignored if bucket exists */
s->bucket.name = s->bucket_name;
op_ret = store->create_bucket(*(s->user), s->bucket, zonegroup_id,
- placement_rule, swift_ver_location, attrs,
+ placement_rule, swift_ver_location,
+ pquota_info, attrs,
info, pobjv, &ep_objv, creation_time,
pmaster_bucket, true);
/* continue if EEXIST and create_bucket will fail below. this way we can
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);
+ if (op_ret < 0) {
+ return;
+ }
+ /* This will also set the quota on the bucket. */
op_ret = rgw_bucket_set_attrs(store, s->bucket_info, attrs,
&s->bucket_info.objv_tracker);
} while (op_ret == -ECANCELED && tries++ < 20);
const string& zonegroup_id,
const string& placement_rule,
const string& swift_ver_location,
+ const RGWQuotaInfo * pquota_info,
map<std::string, bufferlist>& attrs,
RGWBucketInfo& info,
obj_version *pobjv,
info.num_shards = bucket_index_max_shards;
info.bucket_index_shard_hash_type = RGWBucketInfo::MOD;
info.requester_pays = false;
- if (real_clock::is_zero(creation_time))
+ if (real_clock::is_zero(creation_time)) {
creation_time = ceph::real_clock::now(cct);
- else
+ } else {
info.creation_time = creation_time;
+ }
+ if (pquota_info) {
+ info.quota = *pquota_info;
+ }
ret = put_linked_bucket_info(info, exclusive, ceph::real_time(), pep_objv, &attrs, true);
if (ret == -EEXIST) {
/* we need to reread the info and return it, caller will have a use for it */
const string& zonegroup_id,
const string& placement_rule,
const string& swift_ver_location,
+ const RGWQuotaInfo * pquota_info,
map<std::string,bufferlist>& attrs,
RGWBucketInfo& bucket_info,
obj_version *pobjv,