To enable an account quota::
- radosgw-admin quota set --account-id={accountid} --max-size=10G
- radosgw-admin quota enable --account-id={accountid}
+ radosgw-admin quota set --quota-scope=account --account-id={accountid} --max-size=10G
+ radosgw-admin quota enable --quota-scope=account --account-id={accountid}
+
+To enable a bucket quota for the account::
+
+ radosgw-admin quota set --quota-scope=bucket --account-id={accountid} --max-objects=1000000
+ radosgw-admin quota enable --quota-scope=bucket --account-id={accountid}
Migrate an existing User into an Account
----------------------------------------
info.max_buckets = *op_state.max_buckets;
}
- if (op_state.quota_max_size) {
- info.quota.max_size = *op_state.quota_max_size;
- }
- if (op_state.quota_max_objects) {
- info.quota.max_objects = *op_state.quota_max_objects;
- }
- if (op_state.quota_enabled) {
- info.quota.enabled = *op_state.quota_enabled;
+ RGWQuotaInfo* pquota = nullptr;
+ if (op_state.quota_scope == "account") {
+ pquota = &info.quota;
+ } else if (op_state.quota_scope == "bucket") {
+ pquota = &info.bucket_quota;
+ }
+ if (pquota) {
+ if (op_state.quota_max_size) {
+ pquota->max_size = *op_state.quota_max_size;
+ }
+ if (op_state.quota_max_objects) {
+ pquota->max_objects = *op_state.quota_max_objects;
+ }
+ if (op_state.quota_enabled) {
+ pquota->enabled = *op_state.quota_enabled;
+ }
}
constexpr bool exclusive = false;
std::optional<int32_t> max_groups;
std::optional<int32_t> max_access_keys;
std::optional<int32_t> max_buckets;
+ std::string quota_scope;
std::optional<int64_t> quota_max_size;
std::optional<int64_t> quota_max_objects;
std::optional<bool> quota_enabled;
cout << "\nQuota options:\n";
cout << " --max-objects specify max objects (negative value to disable)\n";
cout << " --max-size specify max size (in B/K/M/G/T, negative value to disable)\n";
- cout << " --quota-scope scope of quota (bucket, user)\n";
+ cout << " --quota-scope scope of quota (bucket, user, account)\n";
cout << "\nRate limiting options:\n";
cout << " --max-read-ops specify max requests per minute for READ ops per RGW (GET and HEAD request methods), 0 means unlimited\n";
cout << " --max-read-bytes specify max bytes per minute for READ ops per RGW (GET and HEAD request methods), 0 means unlimited\n";
op_state.tenant = tenant;
op_state.account_name = account_name;
+ if (quota_scope != "bucket" && quota_scope != "account") {
+ cerr << "ERROR: invalid quota scope specification. Please specify "
+ "either --quota-scope=bucket or --quota-scope=account" << std::endl;
+ return EINVAL;
+ }
+ op_state.quota_scope = quota_scope;
+
if (opt_cmd == OPT::QUOTA_ENABLE) {
op_state.quota_enabled = true;
} else if (opt_cmd == OPT::QUOTA_DISABLE) {
encode_json("name", name, f);
encode_json("email", email, f);
encode_json("quota", quota, f);
+ encode_json("bucket_quota", bucket_quota, f);
encode_json("max_users", max_users, f);
encode_json("max_roles", max_roles, f);
encode_json("max_groups", max_groups, f);
JSONDecoder::decode_json("name", name, obj);
JSONDecoder::decode_json("email", email, obj);
JSONDecoder::decode_json("quota", quota, obj);
+ JSONDecoder::decode_json("bucket_quota", bucket_quota, obj);
JSONDecoder::decode_json("max_users", max_users, obj);
JSONDecoder::decode_json("max_roles", max_roles, obj);
JSONDecoder::decode_json("max_groups", max_groups, obj);
std::string name;
std::string email;
RGWQuotaInfo quota;
+ RGWQuotaInfo bucket_quota;
static constexpr int32_t DEFAULT_USER_LIMIT = 1000;
int32_t max_users = DEFAULT_USER_LIMIT;
int32_t max_access_keys = DEFAULT_ACCESS_KEY_LIMIT;
void encode(bufferlist& bl) const {
- ENCODE_START(1, 1, bl);
+ ENCODE_START(2, 1, bl);
encode(id, bl);
encode(tenant, bl);
encode(name, bl);
encode(max_groups, bl);
encode(max_buckets, bl);
encode(max_access_keys, bl);
+ encode(bucket_quota, bl);
ENCODE_FINISH(bl);
}
void decode(bufferlist::const_iterator& bl) {
- DECODE_START(1, bl);
+ DECODE_START(2, bl);
decode(id, bl);
decode(tenant, bl);
decode(name, bl);
decode(max_groups, bl);
decode(max_buckets, bl);
decode(max_access_keys, bl);
+ if (struct_v >= 2) {
+ decode(bucket_quota, bl);
+ }
DECODE_FINISH(bl);
}
RGWObjVersionTracker objv; // ignored
int r = driver->load_account_by_id(dpp, y, account_id, info, attrs, objv);
if (r >= 0) {
- // no bucket quota
quotas.user_quota = info.quota;
+ quotas.bucket_quota = info.bucket_quota;
}
return r;
}), owner);
Quota options:
--max-objects specify max objects (negative value to disable)
--max-size specify max size (in B/K/M/G/T, negative value to disable)
- --quota-scope scope of quota (bucket, user)
+ --quota-scope scope of quota (bucket, user, account)
Rate limiting options:
--max-read-ops specify max requests per minute for READ ops per RGW (GET and HEAD request methods), 0 means unlimited