Skip to content

Commit 1272408

Browse files
authored
Merge pull request ceph#57985 from thotz/add-storage-adminops-api
rgw/adminops: add option to provide storageclass adminops user apis Reviewed-by: Matt Benjamin <[email protected]>
2 parents 262ed46 + a3273c8 commit 1272408

File tree

2 files changed

+38
-2
lines changed

2 files changed

+38
-2
lines changed

doc/radosgw/adminops.rst

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -486,6 +486,19 @@ A tenant name may also specified as a part of ``uid``, by following the syntax
486486
:Example: tenant1
487487
:Required: No
488488

489+
``default-placement``
490+
491+
:Description: default placement for the user.
492+
:Type: string
493+
:Example: default-placement
494+
:Required: No
495+
496+
``default-storage-class``
497+
:Description: default storage class for the user, default-placement must be defined when setting this option.
498+
:Type: string
499+
:Example: STANDARD-1A
500+
:Required: No
501+
489502
Response Entities
490503
~~~~~~~~~~~~~~~~~
491504

@@ -683,6 +696,19 @@ Request Parameters
683696
:Example: ``read, write, delete, *``
684697
:Required: No
685698

699+
``default-placement``
700+
701+
:Description: default placement for the user.
702+
:Type: string
703+
:Example: default-placement
704+
:Required: No
705+
706+
``default-storage-class``
707+
:Description: default storage class for the user, default-placement must be defined when setting this option.
708+
:Type: string
709+
:Example: STANDARD-1A
710+
:Required: No
711+
686712
Response Entities
687713
~~~~~~~~~~~~~~~~~
688714

src/rgw/driver/rados/rgw_rest_user.cc

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,7 @@ void RGWOp_User_Create::execute(optional_yield y)
157157
std::string op_mask_str;
158158
std::string default_placement_str;
159159
std::string placement_tags_str;
160+
std::string default_storage_class_str;
160161

161162
bool gen_key;
162163
bool suspended;
@@ -188,6 +189,7 @@ void RGWOp_User_Create::execute(optional_yield y)
188189
RESTArgs::get_bool(s, "exclusive", false, &exclusive);
189190
RESTArgs::get_string(s, "op-mask", op_mask_str, &op_mask_str);
190191
RESTArgs::get_string(s, "default-placement", default_placement_str, &default_placement_str);
192+
RESTArgs::get_string(s, "default-storage-class", default_storage_class_str, &default_storage_class_str);
191193
RESTArgs::get_string(s, "placement-tags", placement_tags_str, &placement_tags_str);
192194
RESTArgs::get_string(s, "account-id", "", &op_state.account_id);
193195
RESTArgs::get_string(s, "path", "", &op_state.path);
@@ -251,7 +253,10 @@ void RGWOp_User_Create::execute(optional_yield y)
251253

252254
if (!default_placement_str.empty()) {
253255
rgw_placement_rule target_rule;
254-
target_rule.from_str(default_placement_str);
256+
target_rule.name = default_placement_str;
257+
if (!default_storage_class_str.empty()){
258+
target_rule.storage_class = default_storage_class_str;
259+
}
255260
if (!driver->valid_placement(target_rule)) {
256261
ldpp_dout(this, 0) << "NOTICE: invalid dest placement: " << target_rule.to_str() << dendl;
257262
op_ret = -EINVAL;
@@ -309,6 +314,7 @@ void RGWOp_User_Modify::execute(optional_yield y)
309314
std::string op_mask_str;
310315
std::string default_placement_str;
311316
std::string placement_tags_str;
317+
std::string default_storage_class_str;
312318

313319
bool gen_key;
314320
bool suspended;
@@ -336,6 +342,7 @@ void RGWOp_User_Modify::execute(optional_yield y)
336342
RESTArgs::get_bool(s, "account-root", false, &account_root);
337343
RESTArgs::get_string(s, "op-mask", op_mask_str, &op_mask_str);
338344
RESTArgs::get_string(s, "default-placement", default_placement_str, &default_placement_str);
345+
RESTArgs::get_string(s, "default-storage-class", default_storage_class_str, &default_storage_class_str);
339346
RESTArgs::get_string(s, "placement-tags", placement_tags_str, &placement_tags_str);
340347
RESTArgs::get_string(s, "account-id", "", &op_state.account_id);
341348
RESTArgs::get_string(s, "path", "", &op_state.path);
@@ -404,7 +411,10 @@ void RGWOp_User_Modify::execute(optional_yield y)
404411

405412
if (!default_placement_str.empty()) {
406413
rgw_placement_rule target_rule;
407-
target_rule.from_str(default_placement_str);
414+
target_rule.name = default_placement_str;
415+
if (!default_storage_class_str.empty()){
416+
target_rule.storage_class = default_storage_class_str;
417+
}
408418
if (!driver->valid_placement(target_rule)) {
409419
ldpp_dout(this, 0) << "NOTICE: invalid dest placement: " << target_rule.to_str() << dendl;
410420
op_ret = -EINVAL;

0 commit comments

Comments
 (0)