|
22 | 22 | #include "common/utf8.h" |
23 | 23 |
|
24 | 24 | #include "rgw_oidc_provider.h" |
| 25 | +#include "rgw_quota.h" |
25 | 26 | #include "rgw_role.h" |
26 | 27 | #include "rgw_sal.h" |
27 | 28 |
|
@@ -136,6 +137,10 @@ int create(const DoutPrefixProvider* dpp, |
136 | 137 | info.max_buckets = *op_state.max_buckets; |
137 | 138 | } |
138 | 139 |
|
| 140 | + const ConfigProxy& conf = dpp->get_cct()->_conf; |
| 141 | + rgw_apply_default_account_quota(info.quota, conf); |
| 142 | + rgw_apply_default_bucket_quota(info.bucket_quota, conf); |
| 143 | + |
139 | 144 | // account id is optional, but must be valid |
140 | 145 | if (op_state.account_id.empty()) { |
141 | 146 | info.id = generate_id(dpp->get_cct()); |
@@ -227,14 +232,22 @@ int modify(const DoutPrefixProvider* dpp, |
227 | 232 | info.max_buckets = *op_state.max_buckets; |
228 | 233 | } |
229 | 234 |
|
230 | | - if (op_state.quota_max_size) { |
231 | | - info.quota.max_size = *op_state.quota_max_size; |
232 | | - } |
233 | | - if (op_state.quota_max_objects) { |
234 | | - info.quota.max_objects = *op_state.quota_max_objects; |
| 235 | + RGWQuotaInfo* pquota = nullptr; |
| 236 | + if (op_state.quota_scope == "account") { |
| 237 | + pquota = &info.quota; |
| 238 | + } else if (op_state.quota_scope == "bucket") { |
| 239 | + pquota = &info.bucket_quota; |
235 | 240 | } |
236 | | - if (op_state.quota_enabled) { |
237 | | - info.quota.enabled = *op_state.quota_enabled; |
| 241 | + if (pquota) { |
| 242 | + if (op_state.quota_max_size) { |
| 243 | + pquota->max_size = *op_state.quota_max_size; |
| 244 | + } |
| 245 | + if (op_state.quota_max_objects) { |
| 246 | + pquota->max_objects = *op_state.quota_max_objects; |
| 247 | + } |
| 248 | + if (op_state.quota_enabled) { |
| 249 | + pquota->enabled = *op_state.quota_enabled; |
| 250 | + } |
238 | 251 | } |
239 | 252 |
|
240 | 253 | constexpr bool exclusive = false; |
|
0 commit comments