From 7058d0229e424decf32f5f7ad1bd5af66f768ee0 Mon Sep 17 00:00:00 2001 From: "J. Eric Ivancich" Date: Fri, 20 Jan 2023 19:19:31 -0500 Subject: [PATCH] rgw: minor clean-ups to user policy and config options Signed-off-by: J. Eric Ivancich --- src/common/options/rgw.yaml.in | 28 ++++++++++++++-------------- src/rgw/rgw_rest_user_policy.cc | 16 +++++++--------- 2 files changed, 21 insertions(+), 23 deletions(-) diff --git a/src/common/options/rgw.yaml.in b/src/common/options/rgw.yaml.in index 03a9c7a8407a..df784fc279f8 100644 --- a/src/common/options/rgw.yaml.in +++ b/src/common/options/rgw.yaml.in @@ -3,41 +3,41 @@ options: # According to AWS S3(http://docs.aws.amazon.com/AmazonS3/latest/dev/acl-overview.html), -# An ACL can have up to 100 grants. +# An ACL may have up to 100 grants. - name: rgw_acl_grants_max_num type: int level: advanced - desc: Max number of ACL grants in a single request + desc: The maximum number of ACL grants in a single request. default: 100 services: - rgw with_legacy: true -# An user can have up to 100 IAM user policies. +# A user may have up to 100 IAM user policies. - name: rgw_user_policies_max_num type: int level: advanced - desc: Max number of IAM user policies on a single user + desc: The maximum number of IAM user policies for a single user. default: 100 services: - rgw with_legacy: true -# According to AWS S3(http://docs.aws.amazon.com/AmazonS3/latest/dev/cors.html), -# An cors can have up to 100 rules. +# According to AWS S3 (http://docs.aws.amazon.com/AmazonS3/latest/dev/cors.html), +# A CORS request may have up to 100 rules. - name: rgw_cors_rules_max_num type: int level: advanced - desc: Max number of cors rules in a single request + desc: The maximum number of CORS rules in a single request. default: 100 services: - rgw with_legacy: true -# According to AWS S3(https://docs.aws.amazon.com/AmazonS3/latest/dev/DeletingObjects.html), +# According to AWS S3 (https://docs.aws.amazon.com/AmazonS3/latest/dev/DeletingObjects.html), # Amazon S3 also provides the Multi-Object Delete API that you can use to delete up to 1000 # objects in a single HTTP request. - name: rgw_delete_multi_obj_max_num type: int level: advanced - desc: Max number of objects in a single multi-object delete request + desc: The maximum number of objects in a single multi-object delete request. default: 1000 services: - rgw @@ -46,7 +46,7 @@ options: - name: rgw_website_routing_rules_max_num type: int level: advanced - desc: Max number of website routing rules in a single request + desc: The maximum number of website routing rules in a single request. default: 50 services: - rgw @@ -54,21 +54,21 @@ options: - name: rgw_rados_tracing type: bool level: advanced - desc: true if LTTng-UST tracepoints should be enabled + desc: Enables LTTng-UST tracepoints. default: false services: - rgw - name: rgw_op_tracing type: bool level: advanced - desc: true if LTTng-UST tracepoints should be enabled + desc: Enables LTTng-UST operator tracepoints. default: false services: - rgw - name: rgw_max_chunk_size type: size level: advanced - desc: Set RGW max chunk size + desc: The maximum RGW chunk size. long_desc: The chunk size is the size of RADOS I/O requests that RGW sends when accessing data objects. RGW read and write operations will never request more than this amount in a single request. This also defines the RGW head object size, as @@ -111,7 +111,7 @@ options: - name: rgw_max_put_size type: size level: advanced - desc: Max size (in bytes) of regular (non multi-part) object upload. + desc: The maximum size (in bytes) of regular (non multi-part) object upload. long_desc: Plain object upload is capped at this amount of data. In order to upload larger objects, a special upload mechanism is required. The S3 API provides the multi-part upload, and Swift provides DLO and SLO. diff --git a/src/rgw/rgw_rest_user_policy.cc b/src/rgw/rgw_rest_user_policy.cc index 25b1f708d97a..2e300468b95c 100644 --- a/src/rgw/rgw_rest_user_policy.cc +++ b/src/rgw/rgw_rest_user_policy.cc @@ -20,8 +20,6 @@ #define dout_subsys ceph_subsys_rgw -using namespace std; -using rgw::IAM::Policy; void RGWRestUserPolicy::dump(Formatter *f) const { @@ -50,7 +48,7 @@ int RGWRestUserPolicy::verify_permission(optional_yield y) } uint64_t op = get_op(); - string user_name = s->info.args.get("UserName"); + std::string user_name = s->info.args.get("UserName"); rgw_user user_id(user_name); if (! verify_user_permission(this, s, rgw::ARN(rgw::ARN(user_id.id, "user", @@ -141,10 +139,10 @@ void RGWPutUserPolicy::execute(optional_yield y) } try { - const Policy p( + const rgw::IAM::Policy p( s->cct, s->user->get_tenant(), bl, s->cct->_conf.get_val("rgw_policy_reject_invalid_principals")); - map policies; + std::map policies; if (auto it = user->get_attrs().find(RGW_ATTR_USER_POLICY); it != user->get_attrs().end()) { bufferlist out_bl = it->second; decode(policies, out_bl); @@ -152,7 +150,7 @@ void RGWPutUserPolicy::execute(optional_yield y) bufferlist in_bl; policies[policy_name] = policy; constexpr unsigned int USER_POLICIES_MAX_NUM = 100; - const unsigned int max_num = s->cct->_conf->rgw_user_policies_max_num < 0 ? + const unsigned int max_num = s->cct->_conf->rgw_user_policies_max_num < 0 ? USER_POLICIES_MAX_NUM : s->cct->_conf->rgw_user_policies_max_num; if (policies.size() > max_num) { ldpp_dout(this, 4) << "IAM user policies has reached the num config: " @@ -229,7 +227,7 @@ void RGWGetUserPolicy::execute(optional_yield y) s->formatter->dump_string("RequestId", s->trans_id); s->formatter->close_section(); s->formatter->open_object_section("GetUserPolicyResult"); - map policies; + std::map policies; if (auto it = user->get_attrs().find(RGW_ATTR_USER_POLICY); it != user->get_attrs().end()) { bufferlist bl = it->second; try { @@ -293,7 +291,7 @@ void RGWListUserPolicies::execute(optional_yield y) } if (op_ret == 0) { - map policies; + std::map policies; if (auto it = user->get_attrs().find(RGW_ATTR_USER_POLICY); it != user->get_attrs().end()) { s->formatter->open_object_section("ListUserPoliciesResponse"); s->formatter->open_object_section("ResponseMetadata"); @@ -376,7 +374,7 @@ void RGWDeleteUserPolicy::execute(optional_yield y) ldpp_dout(this, 0) << "ERROR: forward_request_to_master returned ret=" << op_ret << dendl; } - map policies; + std::map policies; if (auto it = user->get_attrs().find(RGW_ATTR_USER_POLICY); it != user->get_attrs().end()) { bufferlist out_bl = it->second; try { -- 2.47.3