From: Nick Erdmann Date: Mon, 24 Sep 2018 10:48:57 +0000 (+0200) Subject: rgw: fix max-size-kb REST quota parameter and add max-size X-Git-Tag: v14.0.1~172^2 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=99ce3aaf0b5b78e2c7452ee986d8dbfab08aa2d2;p=ceph.git rgw: fix max-size-kb REST quota parameter and add max-size Signed-off-by: Nick Erdmann --- diff --git a/doc/radosgw/adminops.rst b/doc/radosgw/adminops.rst index cd9e579268e2a..062abb0946ad9 100644 --- a/doc/radosgw/adminops.rst +++ b/doc/radosgw/adminops.rst @@ -1862,7 +1862,8 @@ Valid parameters for quotas include: the maximum number of objects. A negative value disables this setting. - **Maximum Size:** The ``max-size`` option allows you to specify a quota - for the maximum number of bytes. A negative value disables this setting. + for the maximum number of bytes. The ``max-size-kb`` option allows you + to specify it in KiB. A negative value disables this setting. - **Quota Type:** The ``quota-type`` option sets the scope for the quota. The options are ``bucket`` and ``user``. diff --git a/src/rgw/rgw_rest_user.cc b/src/rgw/rgw_rest_user.cc index 5efb6a75760e3..87a3cb7d03d61 100644 --- a/src/rgw/rgw_rest_user.cc +++ b/src/rgw/rgw_rest_user.cc @@ -897,11 +897,14 @@ void RGWOp_Quota_Set::execute() old_quota = &info.bucket_quota; } - int64_t old_max_size_kb = rgw_rounded_kb(old_quota->max_size); - int64_t max_size_kb; 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); + int64_t max_size_kb; + bool has_max_size_kb = false; + RESTArgs::get_int64(s, "max-size-kb", 0, &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); }