From 701f019a763bf6f3f12d1cc1aa90583441f79d0c Mon Sep 17 00:00:00 2001 From: Casey Bodley Date: Tue, 8 Sep 2020 13:53:36 -0400 Subject: [PATCH] rgw: RGWRESTOp no longer tracks separate error code RGWOp_Bucket_Remove::execute() was storing failures from bucket->remove_bucket() in op_ret, but left http_ret=0 so we responded to the client with '200 OK' to avoid bugs like this, remove the extra http_ret variable and only use the op_ret from RGWOp Signed-off-by: Casey Bodley --- src/rgw/rgw_rest.cc | 2 +- src/rgw/rgw_rest.h | 2 - src/rgw/rgw_rest_bucket.cc | 33 ++--- src/rgw/rgw_rest_config.cc | 12 +- src/rgw/rgw_rest_log.cc | 243 ++++++++++++++++++----------------- src/rgw/rgw_rest_metadata.cc | 60 ++++----- src/rgw/rgw_rest_realm.cc | 78 +++++------ src/rgw/rgw_rest_usage.cc | 6 +- src/rgw/rgw_rest_user.cc | 86 ++++++------- 9 files changed, 258 insertions(+), 264 deletions(-) diff --git a/src/rgw/rgw_rest.cc b/src/rgw/rgw_rest.cc index bd1fcf69fde89..76b56daf453e1 100644 --- a/src/rgw/rgw_rest.cc +++ b/src/rgw/rgw_rest.cc @@ -1638,7 +1638,7 @@ int RGWDeleteMultiObj_ObjStore::get_params() void RGWRESTOp::send_response() { if (!flusher.did_start()) { - set_req_state_err(s, http_ret); + set_req_state_err(s, get_ret()); dump_errno(s); end_header(s, this); } diff --git a/src/rgw/rgw_rest.h b/src/rgw/rgw_rest.h index 754d3ca7dc46a..383cd35a2185c 100644 --- a/src/rgw/rgw_rest.h +++ b/src/rgw/rgw_rest.h @@ -542,10 +542,8 @@ public: class RGWRESTOp : public RGWOp { protected: - int http_ret; RGWRESTFlusher flusher; public: - RGWRESTOp() : http_ret(0) {} void init(rgw::sal::RGWRadosStore *store, struct req_state *s, RGWHandler *dialect_handler) override { RGWOp::init(store, s, dialect_handler); diff --git a/src/rgw/rgw_rest_bucket.cc b/src/rgw/rgw_rest_bucket.cc index 9db34154563ff..80f4d20363bde 100644 --- a/src/rgw/rgw_rest_bucket.cc +++ b/src/rgw/rgw_rest_bucket.cc @@ -48,7 +48,7 @@ void RGWOp_Bucket_Info::execute() op_state.set_bucket_name(bucket); op_state.set_fetch_stats(fetch_stats); - http_ret = RGWBucketAdminOp::info(store, op_state, flusher); + op_ret = RGWBucketAdminOp::info(store, op_state, flusher); } class RGWOp_Get_Policy : public RGWRESTOp { @@ -78,7 +78,7 @@ void RGWOp_Get_Policy::execute() op_state.set_bucket_name(bucket); op_state.set_object(object); - http_ret = RGWBucketAdminOp::get_policy(store, op_state, flusher); + op_ret = RGWBucketAdminOp::get_policy(store, op_state, flusher); } class RGWOp_Check_Bucket_Index : public RGWRESTOp { @@ -112,7 +112,7 @@ void RGWOp_Check_Bucket_Index::execute() op_state.set_fix_index(fix_index); op_state.set_check_objects(check_objects); - http_ret = RGWBucketAdminOp::check_index(store, op_state, flusher, s->yield); + op_ret = RGWBucketAdminOp::check_index(store, op_state, flusher, s->yield); } class RGWOp_Bucket_Link : public RGWRESTOp { @@ -155,7 +155,7 @@ void RGWOp_Bucket_Link::execute() ldpp_dout(this, 0) << "forward_request_to_master returned ret=" << op_ret << dendl; return; } - http_ret = RGWBucketAdminOp::link(store, op_state); + op_ret = RGWBucketAdminOp::link(store, op_state); } class RGWOp_Bucket_Unlink : public RGWRESTOp { @@ -193,7 +193,7 @@ void RGWOp_Bucket_Unlink::execute() ldpp_dout(this, 0) << "forward_request_to_master returned ret=" << op_ret << dendl; return; } - http_ret = RGWBucketAdminOp::unlink(store, op_state); + op_ret = RGWBucketAdminOp::unlink(store, op_state); } class RGWOp_Bucket_Remove : public RGWRESTOp { @@ -226,11 +226,6 @@ void RGWOp_Bucket_Remove::execute() } op_ret = bucket->remove_bucket(delete_children, string(), string(), true, &s->info, s->yield); - if (op_ret < 0) { - ldpp_dout(this, 0) << "remove_bucket returned ret=" << op_ret << dendl; - return; - } - http_ret = op_ret; } class RGWOp_Set_Bucket_Quota : public RGWRESTOp { @@ -255,7 +250,7 @@ void RGWOp_Set_Bucket_Quota::execute() std::string uid_str; RESTArgs::get_string(s, "uid", uid_str, &uid_str, &uid_arg_existed); if (! uid_arg_existed) { - http_ret = -EINVAL; + op_ret = -EINVAL; return; } rgw_user uid(uid_str); @@ -263,7 +258,7 @@ void RGWOp_Set_Bucket_Quota::execute() std::string bucket; RESTArgs::get_string(s, "bucket", bucket, &bucket, &bucket_arg_existed); if (! bucket_arg_existed) { - http_ret = -EINVAL; + op_ret = -EINVAL; return; } @@ -278,8 +273,8 @@ void RGWOp_Set_Bucket_Quota::execute() RGWQuotaInfo quota; if (!use_http_params) { bool empty; - http_ret = rgw_rest_get_json_input(store->ctx(), s, quota, QUOTA_INPUT_MAX_LEN, &empty); - if (http_ret < 0) { + op_ret = rgw_rest_get_json_input(store->ctx(), s, quota, QUOTA_INPUT_MAX_LEN, &empty); + if (op_ret < 0) { if (!empty) return; /* was probably chunked input, but no content provided, configure via http params */ @@ -289,8 +284,8 @@ void RGWOp_Set_Bucket_Quota::execute() if (use_http_params) { RGWBucketInfo bucket_info; map attrs; - http_ret = store->getRados()->get_bucket_info(store->svc(), uid.tenant, bucket, bucket_info, NULL, s->yield, &attrs); - if (http_ret < 0) { + op_ret = store->getRados()->get_bucket_info(store->svc(), uid.tenant, bucket, bucket_info, NULL, s->yield, &attrs); + if (op_ret < 0) { return; } RGWQuotaInfo *old_quota = &bucket_info.quota; @@ -307,7 +302,7 @@ void RGWOp_Set_Bucket_Quota::execute() op_state.set_bucket_name(bucket); op_state.set_quota(quota); - http_ret = RGWBucketAdminOp::set_quota(store, op_state); + op_ret = RGWBucketAdminOp::set_quota(store, op_state); } class RGWOp_Sync_Bucket : public RGWRESTOp { @@ -339,7 +334,7 @@ void RGWOp_Sync_Bucket::execute() op_state.set_tenant(tenant); op_state.set_sync_bucket(sync_bucket); - http_ret = RGWBucketAdminOp::sync_bucket(store, op_state); + op_ret = RGWBucketAdminOp::sync_bucket(store, op_state); } class RGWOp_Object_Remove: public RGWRESTOp { @@ -369,7 +364,7 @@ void RGWOp_Object_Remove::execute() op_state.set_bucket_name(bucket); op_state.set_object(object); - http_ret = RGWBucketAdminOp::remove_object(store, op_state); + op_ret = RGWBucketAdminOp::remove_object(store, op_state); } diff --git a/src/rgw/rgw_rest_config.cc b/src/rgw/rgw_rest_config.cc index bdc64823384cb..bb5b0c4dfcd32 100644 --- a/src/rgw/rgw_rest_config.cc +++ b/src/rgw/rgw_rest_config.cc @@ -31,18 +31,18 @@ #define dout_subsys ceph_subsys_rgw void RGWOp_ZoneGroupMap_Get::execute() { - http_ret = zonegroup_map.read(g_ceph_context, store->svc()->sysobj); - if (http_ret < 0) { + op_ret = zonegroup_map.read(g_ceph_context, store->svc()->sysobj); + if (op_ret < 0) { dout(5) << "failed to read zone_group map" << dendl; } } void RGWOp_ZoneGroupMap_Get::send_response() { - set_req_state_err(s, http_ret); + set_req_state_err(s, op_ret); dump_errno(s); end_header(s); - if (http_ret < 0) + if (op_ret < 0) return; if (old_format) { @@ -61,11 +61,11 @@ void RGWOp_ZoneGroupMap_Get::send_response() { void RGWOp_ZoneConfig_Get::send_response() { const RGWZoneParams& zone_params = store->svc()->zone->get_zone_params(); - set_req_state_err(s, http_ret); + set_req_state_err(s, op_ret); dump_errno(s); end_header(s); - if (http_ret < 0) + if (op_ret < 0) return; encode_json("zone_params", zone_params, s->formatter); diff --git a/src/rgw/rgw_rest_log.cc b/src/rgw/rgw_rest_log.cc index f67b2c032b2e3..9eb36c8412375 100644 --- a/src/rgw/rgw_rest_log.cc +++ b/src/rgw/rgw_rest_log.cc @@ -49,13 +49,14 @@ void RGWOp_MDLog_List::execute() { if (s->info.args.exists("start-time") || s->info.args.exists("end-time")) { dout(5) << "start-time and end-time are no longer accepted" << dendl; - http_ret = -EINVAL; + op_ret = -EINVAL; + return; } shard_id = (unsigned)strict_strtol(shard.c_str(), 10, &err); if (!err.empty()) { dout(5) << "Error parsing shard_id " << shard << dendl; - http_ret = -EINVAL; + op_ret = -EINVAL; return; } @@ -63,7 +64,7 @@ void RGWOp_MDLog_List::execute() { max_entries = (unsigned)strict_strtol(max_entries_str.c_str(), 10, &err); if (!err.empty()) { dout(5) << "Error parsing max-entries " << max_entries_str << dendl; - http_ret = -EINVAL; + op_ret = -EINVAL; return; } if (max_entries > LOG_CLASS_LIST_MAX_ENTRIES) { @@ -76,7 +77,7 @@ void RGWOp_MDLog_List::execute() { period = store->svc()->zone->get_current_period_id(); if (period.empty()) { ldout(s->cct, 5) << "Missing period id" << dendl; - http_ret = -EINVAL; + op_ret = -EINVAL; return; } } @@ -85,18 +86,18 @@ void RGWOp_MDLog_List::execute() { meta_log.init_list_entries(shard_id, {}, {}, marker, &handle); - http_ret = meta_log.list_entries(handle, max_entries, entries, + op_ret = meta_log.list_entries(handle, max_entries, entries, &last_marker, &truncated); meta_log.complete_list_entries(handle); } void RGWOp_MDLog_List::send_response() { - set_req_state_err(s, http_ret); + set_req_state_err(s, op_ret); dump_errno(s); end_header(s); - if (http_ret < 0) + if (op_ret < 0) return; s->formatter->open_object_section("log_entries"); @@ -119,11 +120,11 @@ void RGWOp_MDLog_List::send_response() { void RGWOp_MDLog_Info::execute() { num_objects = s->cct->_conf->rgw_md_log_max_shards; period = store->svc()->mdlog->read_oldest_log_period(); - http_ret = period.get_error(); + op_ret = period.get_error(); } void RGWOp_MDLog_Info::send_response() { - set_req_state_err(s, http_ret); + set_req_state_err(s, op_ret); dump_errno(s); end_header(s); @@ -145,7 +146,7 @@ void RGWOp_MDLog_ShardInfo::execute() { unsigned shard_id = (unsigned)strict_strtol(shard.c_str(), 10, &err); if (!err.empty()) { dout(5) << "Error parsing shard_id " << shard << dendl; - http_ret = -EINVAL; + op_ret = -EINVAL; return; } @@ -155,17 +156,17 @@ void RGWOp_MDLog_ShardInfo::execute() { if (period.empty()) { ldout(s->cct, 5) << "Missing period id" << dendl; - http_ret = -EINVAL; + op_ret = -EINVAL; return; } } RGWMetadataLog meta_log{s->cct, store->svc()->zone, store->svc()->cls, period}; - http_ret = meta_log.get_info(shard_id, &info); + op_ret = meta_log.get_info(shard_id, &info); } void RGWOp_MDLog_ShardInfo::send_response() { - set_req_state_err(s, http_ret); + set_req_state_err(s, op_ret); dump_errno(s); end_header(s); @@ -184,12 +185,12 @@ void RGWOp_MDLog_Delete::execute() { if (s->info.args.exists("start-time") || s->info.args.exists("end-time")) { dout(5) << "start-time and end-time are no longer accepted" << dendl; - http_ret = -EINVAL; + op_ret = -EINVAL; } if (s->info.args.exists("start-marker")) { dout(5) << "start-marker is no longer accepted" << dendl; - http_ret = -EINVAL; + op_ret = -EINVAL; } if (s->info.args.exists("end-marker")) { @@ -197,21 +198,21 @@ void RGWOp_MDLog_Delete::execute() { marker = s->info.args.get("end-marker"); } else { dout(5) << "end-marker and marker cannot both be provided" << dendl; - http_ret = -EINVAL; + op_ret = -EINVAL; } } - http_ret = 0; + op_ret = 0; shard_id = (unsigned)strict_strtol(shard.c_str(), 10, &err); if (!err.empty()) { dout(5) << "Error parsing shard_id " << shard << dendl; - http_ret = -EINVAL; + op_ret = -EINVAL; return; } if (marker.empty()) { /* bounding end */ - http_ret = -EINVAL; + op_ret = -EINVAL; return; } @@ -221,20 +222,20 @@ void RGWOp_MDLog_Delete::execute() { if (period.empty()) { ldout(s->cct, 5) << "Missing period id" << dendl; - http_ret = -EINVAL; + op_ret = -EINVAL; return; } } RGWMetadataLog meta_log{s->cct, store->svc()->zone, store->svc()->cls, period}; - http_ret = meta_log.trim(shard_id, {}, {}, {}, marker); + op_ret = meta_log.trim(shard_id, {}, {}, {}, marker); } void RGWOp_MDLog_Lock::execute() { string period, shard_id_str, duration_str, locker_id, zone_id; unsigned shard_id; - http_ret = 0; + op_ret = 0; period = s->info.args.get("period"); shard_id_str = s->info.args.get("id"); @@ -253,7 +254,7 @@ void RGWOp_MDLog_Lock::execute() { locker_id.empty() || zone_id.empty()) { dout(5) << "Error invalid parameter list" << dendl; - http_ret = -EINVAL; + op_ret = -EINVAL; return; } @@ -261,7 +262,7 @@ void RGWOp_MDLog_Lock::execute() { shard_id = (unsigned)strict_strtol(shard_id_str.c_str(), 10, &err); if (!err.empty()) { dout(5) << "Error parsing shard_id param " << shard_id_str << dendl; - http_ret = -EINVAL; + op_ret = -EINVAL; return; } @@ -270,20 +271,20 @@ void RGWOp_MDLog_Lock::execute() { dur = (unsigned)strict_strtol(duration_str.c_str(), 10, &err); if (!err.empty() || dur <= 0) { dout(5) << "invalid length param " << duration_str << dendl; - http_ret = -EINVAL; + op_ret = -EINVAL; return; } - http_ret = meta_log.lock_exclusive(shard_id, make_timespan(dur), zone_id, + op_ret = meta_log.lock_exclusive(shard_id, make_timespan(dur), zone_id, locker_id); - if (http_ret == -EBUSY) - http_ret = -ERR_LOCKED; + if (op_ret == -EBUSY) + op_ret = -ERR_LOCKED; } void RGWOp_MDLog_Unlock::execute() { string period, shard_id_str, locker_id, zone_id; unsigned shard_id; - http_ret = 0; + op_ret = 0; period = s->info.args.get("period"); shard_id_str = s->info.args.get("id"); @@ -300,7 +301,7 @@ void RGWOp_MDLog_Unlock::execute() { locker_id.empty() || zone_id.empty()) { dout(5) << "Error invalid parameter list" << dendl; - http_ret = -EINVAL; + op_ret = -EINVAL; return; } @@ -308,12 +309,12 @@ void RGWOp_MDLog_Unlock::execute() { shard_id = (unsigned)strict_strtol(shard_id_str.c_str(), 10, &err); if (!err.empty()) { dout(5) << "Error parsing shard_id param " << shard_id_str << dendl; - http_ret = -EINVAL; + op_ret = -EINVAL; return; } RGWMetadataLog meta_log{s->cct, store->svc()->zone, store->svc()->cls, period}; - http_ret = meta_log.unlock(shard_id, zone_id, locker_id); + op_ret = meta_log.unlock(shard_id, zone_id, locker_id); } void RGWOp_MDLog_Notify::execute() { @@ -323,7 +324,7 @@ void RGWOp_MDLog_Notify::execute() { bufferlist data; std::tie(r, data) = rgw_rest_read_all_input(s, LARGE_ENOUGH_BUF); if (r < 0) { - http_ret = r; + op_ret = r; return; } @@ -334,7 +335,7 @@ void RGWOp_MDLog_Notify::execute() { r = p.parse(buf, data.length()); if (r < 0) { ldout(s->cct, 0) << "ERROR: failed to parse JSON" << dendl; - http_ret = r; + op_ret = r; return; } @@ -343,7 +344,7 @@ void RGWOp_MDLog_Notify::execute() { decode_json_obj(updated_shards, &p); } catch (JSONDecoder::err& err) { ldout(s->cct, 0) << "ERROR: failed to decode JSON" << dendl; - http_ret = -EINVAL; + op_ret = -EINVAL; return; } @@ -355,7 +356,7 @@ void RGWOp_MDLog_Notify::execute() { store->getRados()->wakeup_meta_sync_shards(updated_shards); - http_ret = 0; + op_ret = 0; } void RGWOp_BILog_List::execute() { @@ -369,27 +370,27 @@ void RGWOp_BILog_List::execute() { if (bucket_name.empty() && bucket_instance.empty()) { dout(5) << "ERROR: neither bucket nor bucket instance specified" << dendl; - http_ret = -EINVAL; + op_ret = -EINVAL; return; } int shard_id; string bn; - http_ret = rgw_bucket_parse_bucket_instance(bucket_instance, &bn, &bucket_instance, &shard_id); - if (http_ret < 0) { + op_ret = rgw_bucket_parse_bucket_instance(bucket_instance, &bn, &bucket_instance, &shard_id); + if (op_ret < 0) { return; } if (!bucket_instance.empty()) { rgw_bucket b(rgw_bucket_key(tenant_name, bn, bucket_instance)); - http_ret = store->getRados()->get_bucket_instance_info(*s->sysobj_ctx, b, bucket_info, NULL, NULL, s->yield); - if (http_ret < 0) { + op_ret = store->getRados()->get_bucket_instance_info(*s->sysobj_ctx, b, bucket_info, NULL, NULL, s->yield); + if (op_ret < 0) { ldpp_dout(s, 5) << "could not get bucket instance info for bucket instance id=" << bucket_instance << dendl; return; } } else { /* !bucket_name.empty() */ - http_ret = store->getRados()->get_bucket_info(store->svc(), tenant_name, bucket_name, bucket_info, NULL, s->yield, NULL); - if (http_ret < 0) { + op_ret = store->getRados()->get_bucket_info(store->svc(), tenant_name, bucket_name, bucket_info, NULL, s->yield, NULL); + if (op_ret < 0) { ldpp_dout(s, 5) << "could not get bucket info for bucket=" << bucket_name << dendl; return; } @@ -426,13 +427,13 @@ void RGWOp_BILog_List::send_response() { if (sent_header) return; - set_req_state_err(s, http_ret); + set_req_state_err(s, op_ret); dump_errno(s); end_header(s); sent_header = true; - if (http_ret < 0) + if (op_ret < 0) return; s->formatter->open_array_section("entries"); @@ -462,27 +463,27 @@ void RGWOp_BILog_Info::execute() { if (bucket_name.empty() && bucket_instance.empty()) { ldpp_dout(s, 5) << "ERROR: neither bucket nor bucket instance specified" << dendl; - http_ret = -EINVAL; + op_ret = -EINVAL; return; } int shard_id; string bn; - http_ret = rgw_bucket_parse_bucket_instance(bucket_instance, &bn, &bucket_instance, &shard_id); - if (http_ret < 0) { + op_ret = rgw_bucket_parse_bucket_instance(bucket_instance, &bn, &bucket_instance, &shard_id); + if (op_ret < 0) { return; } if (!bucket_instance.empty()) { rgw_bucket b(rgw_bucket_key(tenant_name, bn, bucket_instance)); - http_ret = store->getRados()->get_bucket_instance_info(*s->sysobj_ctx, b, bucket_info, NULL, NULL, s->yield); - if (http_ret < 0) { + op_ret = store->getRados()->get_bucket_instance_info(*s->sysobj_ctx, b, bucket_info, NULL, NULL, s->yield); + if (op_ret < 0) { ldpp_dout(s, 5) << "could not get bucket instance info for bucket instance id=" << bucket_instance << dendl; return; } } else { /* !bucket_name.empty() */ - http_ret = store->getRados()->get_bucket_info(store->svc(), tenant_name, bucket_name, bucket_info, NULL, s->yield, NULL); - if (http_ret < 0) { + op_ret = store->getRados()->get_bucket_info(store->svc(), tenant_name, bucket_name, bucket_info, NULL, s->yield, NULL); + if (op_ret < 0) { ldpp_dout(s, 5) << "could not get bucket info for bucket=" << bucket_name << dendl; return; } @@ -490,17 +491,17 @@ void RGWOp_BILog_Info::execute() { map stats; int ret = store->getRados()->get_bucket_stats(bucket_info, shard_id, &bucket_ver, &master_ver, stats, &max_marker, &syncstopped); if (ret < 0 && ret != -ENOENT) { - http_ret = ret; + op_ret = ret; return; } } void RGWOp_BILog_Info::send_response() { - set_req_state_err(s, http_ret); + set_req_state_err(s, op_ret); dump_errno(s); end_header(s); - if (http_ret < 0) + if (op_ret < 0) return; s->formatter->open_object_section("info"); @@ -522,37 +523,37 @@ void RGWOp_BILog_Delete::execute() { RGWBucketInfo bucket_info; - http_ret = 0; + op_ret = 0; if ((bucket_name.empty() && bucket_instance.empty()) || end_marker.empty()) { ldpp_dout(s, 5) << "ERROR: one of bucket and bucket instance, and also end-marker is mandatory" << dendl; - http_ret = -EINVAL; + op_ret = -EINVAL; return; } int shard_id; string bn; - http_ret = rgw_bucket_parse_bucket_instance(bucket_instance, &bn, &bucket_instance, &shard_id); - if (http_ret < 0) { + op_ret = rgw_bucket_parse_bucket_instance(bucket_instance, &bn, &bucket_instance, &shard_id); + if (op_ret < 0) { return; } if (!bucket_instance.empty()) { rgw_bucket b(rgw_bucket_key(tenant_name, bn, bucket_instance)); - http_ret = store->getRados()->get_bucket_instance_info(*s->sysobj_ctx, b, bucket_info, NULL, NULL, s->yield); - if (http_ret < 0) { + op_ret = store->getRados()->get_bucket_instance_info(*s->sysobj_ctx, b, bucket_info, NULL, NULL, s->yield); + if (op_ret < 0) { ldpp_dout(s, 5) << "could not get bucket instance info for bucket instance id=" << bucket_instance << dendl; return; } } else { /* !bucket_name.empty() */ - http_ret = store->getRados()->get_bucket_info(store->svc(), tenant_name, bucket_name, bucket_info, NULL, s->yield, NULL); - if (http_ret < 0) { + op_ret = store->getRados()->get_bucket_info(store->svc(), tenant_name, bucket_name, bucket_info, NULL, s->yield, NULL); + if (op_ret < 0) { ldpp_dout(s, 5) << "could not get bucket info for bucket=" << bucket_name << dendl; return; } } - http_ret = store->svc()->bilog_rados->log_trim(bucket_info, shard_id, start_marker, end_marker); - if (http_ret < 0) { + op_ret = store->svc()->bilog_rados->log_trim(bucket_info, shard_id, start_marker, end_marker); + if (op_ret < 0) { ldpp_dout(s, 5) << "ERROR: trim_bi_log_entries() " << dendl; } return; @@ -569,7 +570,7 @@ void RGWOp_DATALog_List::execute() { if (s->info.args.exists("start-time") || s->info.args.exists("end-time")) { dout(5) << "start-time and end-time are no longer accepted" << dendl; - http_ret = -EINVAL; + op_ret = -EINVAL; } s->info.args.get_bool("extra-info", &extra_info, false); @@ -577,7 +578,7 @@ void RGWOp_DATALog_List::execute() { shard_id = (unsigned)strict_strtol(shard.c_str(), 10, &err); if (!err.empty()) { dout(5) << "Error parsing shard_id " << shard << dendl; - http_ret = -EINVAL; + op_ret = -EINVAL; return; } @@ -585,7 +586,7 @@ void RGWOp_DATALog_List::execute() { max_entries = (unsigned)strict_strtol(max_entries_str.c_str(), 10, &err); if (!err.empty()) { dout(5) << "Error parsing max-entries " << max_entries_str << dendl; - http_ret = -EINVAL; + op_ret = -EINVAL; return; } if (max_entries > LOG_CLASS_LIST_MAX_ENTRIES) { @@ -595,18 +596,18 @@ void RGWOp_DATALog_List::execute() { // Note that last_marker is updated to be the marker of the last // entry listed - http_ret = store->svc()->datalog_rados->list_entries(shard_id, - max_entries, entries, - marker, &last_marker, - &truncated); + op_ret = store->svc()->datalog_rados->list_entries(shard_id, + max_entries, entries, + marker, &last_marker, + &truncated); } void RGWOp_DATALog_List::send_response() { - set_req_state_err(s, http_ret); + set_req_state_err(s, op_ret); dump_errno(s); end_header(s); - if (http_ret < 0) + if (op_ret < 0) return; s->formatter->open_object_section("log_entries"); @@ -631,11 +632,11 @@ void RGWOp_DATALog_List::send_response() { void RGWOp_DATALog_Info::execute() { num_objects = s->cct->_conf->rgw_data_log_num_shards; - http_ret = 0; + op_ret = 0; } void RGWOp_DATALog_Info::send_response() { - set_req_state_err(s, http_ret); + set_req_state_err(s, op_ret); dump_errno(s); end_header(s); @@ -652,15 +653,15 @@ void RGWOp_DATALog_ShardInfo::execute() { unsigned shard_id = (unsigned)strict_strtol(shard.c_str(), 10, &err); if (!err.empty()) { dout(5) << "Error parsing shard_id " << shard << dendl; - http_ret = -EINVAL; + op_ret = -EINVAL; return; } - http_ret = store->svc()->datalog_rados->get_info(shard_id, &info); + op_ret = store->svc()->datalog_rados->get_info(shard_id, &info); } void RGWOp_DATALog_ShardInfo::send_response() { - set_req_state_err(s, http_ret); + set_req_state_err(s, op_ret); dump_errno(s); end_header(s); @@ -676,7 +677,7 @@ void RGWOp_DATALog_Notify::execute() { bufferlist data; std::tie(r, data) = rgw_rest_read_all_input(s, LARGE_ENOUGH_BUF); if (r < 0) { - http_ret = r; + op_ret = r; return; } @@ -687,7 +688,7 @@ void RGWOp_DATALog_Notify::execute() { r = p.parse(buf, data.length()); if (r < 0) { ldout(s->cct, 0) << "ERROR: failed to parse JSON" << dendl; - http_ret = r; + op_ret = r; return; } @@ -696,7 +697,7 @@ void RGWOp_DATALog_Notify::execute() { decode_json_obj(updated_shards, &p); } catch (JSONDecoder::err& err) { ldout(s->cct, 0) << "ERROR: failed to decode JSON" << dendl; - http_ret = -EINVAL; + op_ret = -EINVAL; return; } @@ -712,7 +713,7 @@ void RGWOp_DATALog_Notify::execute() { store->getRados()->wakeup_data_sync_shards(source_zone, updated_shards); - http_ret = 0; + op_ret = 0; } void RGWOp_DATALog_Delete::execute() { @@ -721,17 +722,17 @@ void RGWOp_DATALog_Delete::execute() { err; unsigned shard_id; - http_ret = 0; + op_ret = 0; if (s->info.args.exists("start-time") || s->info.args.exists("end-time")) { dout(5) << "start-time and end-time are no longer accepted" << dendl; - http_ret = -EINVAL; + op_ret = -EINVAL; } if (s->info.args.exists("start-marker")) { dout(5) << "start-marker is no longer accepted" << dendl; - http_ret = -EINVAL; + op_ret = -EINVAL; } if (s->info.args.exists("end-marker")) { @@ -739,22 +740,22 @@ void RGWOp_DATALog_Delete::execute() { marker = s->info.args.get("end-marker"); } else { dout(5) << "end-marker and marker cannot both be provided" << dendl; - http_ret = -EINVAL; + op_ret = -EINVAL; } } shard_id = (unsigned)strict_strtol(shard.c_str(), 10, &err); if (!err.empty()) { dout(5) << "Error parsing shard_id " << shard << dendl; - http_ret = -EINVAL; + op_ret = -EINVAL; return; } if (marker.empty()) { /* bounding end */ - http_ret = -EINVAL; + op_ret = -EINVAL; return; } - http_ret = store->svc()->datalog_rados->trim_entries(shard_id, marker); + op_ret = store->svc()->datalog_rados->trim_entries(shard_id, marker); } // not in header to avoid pulling in rgw_sync.h @@ -777,19 +778,19 @@ void RGWOp_MDLog_Status::execute() auto sync = store->getRados()->get_meta_sync_manager(); if (sync == nullptr) { ldout(s->cct, 1) << "no sync manager" << dendl; - http_ret = -ENOENT; + op_ret = -ENOENT; return; } - http_ret = sync->read_sync_status(&status); + op_ret = sync->read_sync_status(&status); } void RGWOp_MDLog_Status::send_response() { - set_req_state_err(s, http_ret); + set_req_state_err(s, op_ret); dump_errno(s); end_header(s); - if (http_ret >= 0) { + if (op_ret >= 0) { encode_json("status", status, s->formatter); } flusher.flush(); @@ -822,25 +823,25 @@ void RGWOp_BILog_Status::execute() } if (key.empty()) { ldpp_dout(s, 4) << "no 'bucket' provided" << dendl; - http_ret = -EINVAL; + op_ret = -EINVAL; return; } rgw_bucket bucket; int shard_id{-1}; // unused - http_ret = rgw_bucket_parse_bucket_key(s->cct, key, &bucket, &shard_id); - if (http_ret < 0) { + op_ret = rgw_bucket_parse_bucket_key(s->cct, key, &bucket, &shard_id); + if (op_ret < 0) { ldpp_dout(s, 4) << "invalid 'bucket' provided" << dendl; - http_ret = -EINVAL; + op_ret = -EINVAL; return; } // read the bucket instance info for num_shards auto ctx = store->svc()->sysobj->init_obj_ctx(); RGWBucketInfo info; - http_ret = store->getRados()->get_bucket_instance_info(ctx, bucket, info, nullptr, nullptr, s->yield); - if (http_ret < 0) { - ldpp_dout(s, 4) << "failed to read bucket info: " << cpp_strerror(http_ret) << dendl; + op_ret = store->getRados()->get_bucket_instance_info(ctx, bucket, info, nullptr, nullptr, s->yield); + if (op_ret < 0) { + ldpp_dout(s, 4) << "failed to read bucket info: " << cpp_strerror(op_ret) << dendl; return; } @@ -850,8 +851,8 @@ void RGWOp_BILog_Status::execute() source_key == key) { source_bucket = info.bucket; } else { - http_ret = rgw_bucket_parse_bucket_key(s->cct, source_key, &source_bucket, nullptr); - if (http_ret < 0) { + op_ret = rgw_bucket_parse_bucket_key(s->cct, source_key, &source_bucket, nullptr); + if (op_ret < 0) { ldpp_dout(s, 4) << "invalid 'source-bucket' provided (key=" << source_key << ")" << dendl; return; } @@ -868,10 +869,10 @@ void RGWOp_BILog_Status::execute() ldout(s->cct, 20) << "RGWOp_BILog_Status::execute(): getting sync status for pipe=" << pipe << dendl; - http_ret = rgw_bucket_sync_status(this, store, pipe, info, nullptr, &status); + op_ret = rgw_bucket_sync_status(this, store, pipe, info, nullptr, &status); - if (http_ret < 0) { - lderr(s->cct) << "ERROR: rgw_bucket_sync_status() on pipe=" << pipe << " returned ret=" << http_ret << dendl; + if (op_ret < 0) { + lderr(s->cct) << "ERROR: rgw_bucket_sync_status() on pipe=" << pipe << " returned ret=" << op_ret << dendl; } return; } @@ -879,9 +880,9 @@ void RGWOp_BILog_Status::execute() rgw_zone_id source_zone_id(source_zone); RGWBucketSyncPolicyHandlerRef source_handler; - http_ret = store->ctl()->bucket->get_sync_policy_handler(source_zone_id, source_bucket, &source_handler, null_yield); - if (http_ret < 0) { - lderr(s->cct) << "could not get bucket sync policy handler (r=" << http_ret << ")" << dendl; + op_ret = store->ctl()->bucket->get_sync_policy_handler(source_zone_id, source_bucket, &source_handler, null_yield); + if (op_ret < 0) { + lderr(s->cct) << "could not get bucket sync policy handler (r=" << op_ret << ")" << dendl; return; } @@ -899,7 +900,7 @@ void RGWOp_BILog_Status::execute() if (!pipe.dest.bucket) { /* Uh oh, something went wrong */ ldout(s->cct, 20) << "ERROR: RGWOp_BILog_Status::execute(): BUG: pipe.dest.bucket was not initialized" << pipe << dendl; - http_ret = -EIO; + op_ret = -EIO; return; } @@ -908,13 +909,13 @@ void RGWOp_BILog_Status::execute() pinfo = &(*opt_dest_info); /* dest bucket might not have a bucket id */ - http_ret = store->ctl()->bucket->read_bucket_info(*pipe.dest.bucket, + op_ret = store->ctl()->bucket->read_bucket_info(*pipe.dest.bucket, pinfo, s->yield, RGWBucketCtl::BucketInstance::GetParams(), nullptr); - if (http_ret < 0) { - ldpp_dout(s, 4) << "failed to read target bucket info (bucket=: " << cpp_strerror(http_ret) << dendl; + if (op_ret < 0) { + ldpp_dout(s, 4) << "failed to read target bucket info (bucket=: " << cpp_strerror(op_ret) << dendl; return; } @@ -924,7 +925,7 @@ void RGWOp_BILog_Status::execute() int r = rgw_bucket_sync_status(this, store, pipe, *pinfo, &info, ¤t_status); if (r < 0) { lderr(s->cct) << "ERROR: rgw_bucket_sync_status() on pipe=" << pipe << " returned ret=" << r << dendl; - http_ret = r; + op_ret = r; return; } @@ -933,7 +934,7 @@ void RGWOp_BILog_Status::execute() } else { if (current_status.size() != status.size()) { - http_ret = -EINVAL; + op_ret = -EINVAL; lderr(s->cct) << "ERROR: different number of shards for sync status of buckets syncing from the same source: status.size()= " << status.size() << " current_status.size()=" << current_status.size() << dendl; return; } @@ -951,11 +952,11 @@ void RGWOp_BILog_Status::execute() void RGWOp_BILog_Status::send_response() { - set_req_state_err(s, http_ret); + set_req_state_err(s, op_ret); dump_errno(s); end_header(s); - if (http_ret >= 0) { + if (op_ret >= 0) { encode_json("status", status, s->formatter); } flusher.flush(); @@ -982,19 +983,19 @@ void RGWOp_DATALog_Status::execute() auto sync = store->getRados()->get_data_sync_manager(source_zone); if (sync == nullptr) { ldout(s->cct, 1) << "no sync manager for source-zone " << source_zone << dendl; - http_ret = -ENOENT; + op_ret = -ENOENT; return; } - http_ret = sync->read_sync_status(&status); + op_ret = sync->read_sync_status(&status); } void RGWOp_DATALog_Status::send_response() { - set_req_state_err(s, http_ret); + set_req_state_err(s, op_ret); dump_errno(s); end_header(s); - if (http_ret >= 0) { + if (op_ret >= 0) { encode_json("status", status, s->formatter); } flusher.flush(); diff --git a/src/rgw/rgw_rest_metadata.cc b/src/rgw/rgw_rest_metadata.cc index 64daa046e5200..95cb0204494ff 100644 --- a/src/rgw/rgw_rest_metadata.cc +++ b/src/rgw/rgw_rest_metadata.cc @@ -57,13 +57,13 @@ void RGWOp_Metadata_Get::execute() { auto meta_mgr = store->ctl()->meta.mgr; /* Get keys */ - http_ret = meta_mgr->get(metadata_key, s->formatter, s->yield); - if (http_ret < 0) { - dout(5) << "ERROR: can't get key: " << cpp_strerror(http_ret) << dendl; + op_ret = meta_mgr->get(metadata_key, s->formatter, s->yield); + if (op_ret < 0) { + dout(5) << "ERROR: can't get key: " << cpp_strerror(op_ret) << dendl; return; } - http_ret = 0; + op_ret = 0; } void RGWOp_Metadata_Get_Myself::execute() { @@ -105,7 +105,7 @@ void RGWOp_Metadata_List::execute() { max_entries = (unsigned)strict_strtol(max_entries_str.c_str(), 10, &err); if (!err.empty()) { dout(5) << "Error parsing max-entries " << max_entries_str << dendl; - http_ret = -EINVAL; + op_ret = -EINVAL; return; } } @@ -123,9 +123,9 @@ void RGWOp_Metadata_List::execute() { marker = "3:bf885d8f:root::sorry_janefonda_665:head"; */ - http_ret = store->ctl()->meta.mgr->list_keys_init(metadata_key, marker, &handle); - if (http_ret < 0) { - dout(5) << "ERROR: can't get key: " << cpp_strerror(http_ret) << dendl; + op_ret = store->ctl()->meta.mgr->list_keys_init(metadata_key, marker, &handle); + if (op_ret < 0) { + dout(5) << "ERROR: can't get key: " << cpp_strerror(op_ret) << dendl; return; } @@ -144,9 +144,9 @@ void RGWOp_Metadata_List::execute() { do { list keys; left = (max_entries_specified ? max_entries - count : max); - http_ret = meta_mgr->list_keys_next(handle, left, keys, &truncated); - if (http_ret < 0) { - dout(5) << "ERROR: lists_keys_next(): " << cpp_strerror(http_ret) + op_ret = meta_mgr->list_keys_next(handle, left, keys, &truncated); + if (op_ret < 0) { + dout(5) << "ERROR: lists_keys_next(): " << cpp_strerror(op_ret) << dendl; return; } @@ -173,7 +173,7 @@ void RGWOp_Metadata_List::execute() { } meta_mgr->list_keys_complete(handle); - http_ret = 0; + op_ret = 0; } int RGWOp_Metadata_Put::get_data(bufferlist& bl) { @@ -238,13 +238,13 @@ void RGWOp_Metadata_Put::execute() { bufferlist bl; string metadata_key; - http_ret = get_data(bl); - if (http_ret < 0) { + op_ret = get_data(bl); + if (op_ret < 0) { return; } - http_ret = do_aws4_auth_completion(); - if (http_ret < 0) { + op_ret = do_aws4_auth_completion(); + if (op_ret < 0) { return; } @@ -258,29 +258,29 @@ void RGWOp_Metadata_Put::execute() { bool parsed = string_to_sync_type(mode_string, sync_type); if (!parsed) { - http_ret = -EINVAL; + op_ret = -EINVAL; return; } } - http_ret = store->ctl()->meta.mgr->put(metadata_key, bl, s->yield, sync_type, + op_ret = store->ctl()->meta.mgr->put(metadata_key, bl, s->yield, sync_type, &ondisk_version); - if (http_ret < 0) { - dout(5) << "ERROR: can't put key: " << cpp_strerror(http_ret) << dendl; + if (op_ret < 0) { + dout(5) << "ERROR: can't put key: " << cpp_strerror(op_ret) << dendl; return; } // translate internal codes into return header - if (http_ret == STATUS_NO_APPLY) + if (op_ret == STATUS_NO_APPLY) update_status = "skipped"; - else if (http_ret == STATUS_APPLIED) + else if (op_ret == STATUS_APPLIED) update_status = "applied"; } void RGWOp_Metadata_Put::send_response() { - int http_return_code = http_ret; - if ((http_ret == STATUS_NO_APPLY) || (http_ret == STATUS_APPLIED)) - http_return_code = STATUS_NO_CONTENT; - set_req_state_err(s, http_return_code); + int op_return_code = op_ret; + if ((op_ret == STATUS_NO_APPLY) || (op_ret == STATUS_APPLIED)) + op_return_code = STATUS_NO_CONTENT; + set_req_state_err(s, op_return_code); dump_errno(s); stringstream ver_stream; ver_stream << "ver:" << ondisk_version.ver @@ -294,12 +294,12 @@ void RGWOp_Metadata_Delete::execute() { string metadata_key; frame_metadata_key(s, metadata_key); - http_ret = store->ctl()->meta.mgr->remove(metadata_key, s->yield); - if (http_ret < 0) { - dout(5) << "ERROR: can't remove key: " << cpp_strerror(http_ret) << dendl; + op_ret = store->ctl()->meta.mgr->remove(metadata_key, s->yield); + if (op_ret < 0) { + dout(5) << "ERROR: can't remove key: " << cpp_strerror(op_ret) << dendl; return; } - http_ret = 0; + op_ret = 0; } RGWOp *RGWHandler_Metadata::op_get() { diff --git a/src/rgw/rgw_rest_realm.cc b/src/rgw/rgw_rest_realm.cc index 558e23db4731f..215663f5937f6 100644 --- a/src/rgw/rgw_rest_realm.cc +++ b/src/rgw/rgw_rest_realm.cc @@ -31,12 +31,12 @@ class RGWOp_Period_Base : public RGWRESTOp { // reply with the period object on success void RGWOp_Period_Base::send_response() { - set_req_state_err(s, http_ret, error_stream.str()); + set_req_state_err(s, op_ret, error_stream.str()); dump_errno(s); - if (http_ret < 0) { + if (op_ret < 0) { if (!s->err.message.empty()) { - ldout(s->cct, 4) << "Request failed with " << http_ret + ldout(s->cct, 4) << "Request failed with " << op_ret << ": " << s->err.message << dendl; } end_header(s); @@ -73,8 +73,8 @@ void RGWOp_Period_Get::execute() period.set_id(period_id); period.set_epoch(epoch); - http_ret = period.init(store->ctx(), store->svc()->sysobj, realm_id, realm_name); - if (http_ret < 0) + op_ret = period.init(store->ctx(), store->svc()->sysobj, realm_id, realm_name); + if (op_ret < 0) ldout(store->ctx(), 5) << "failed to read period" << dendl; } @@ -101,8 +101,8 @@ void RGWOp_Period_Post::execute() // decode the period from input const auto max_size = cct->_conf->rgw_max_put_param_size; bool empty; - http_ret = rgw_rest_get_json_input(cct, s, period, max_size, &empty); - if (http_ret < 0) { + op_ret = rgw_rest_get_json_input(cct, s, period, max_size, &empty); + if (op_ret < 0) { lderr(cct) << "failed to decode period" << dendl; return; } @@ -111,7 +111,7 @@ void RGWOp_Period_Post::execute() if (period.get_realm() != store->svc()->zone->get_realm().get_id()) { error_stream << "period with realm id " << period.get_realm() << " doesn't match current realm " << store->svc()->zone->get_realm().get_id() << std::endl; - http_ret = -EINVAL; + op_ret = -EINVAL; return; } @@ -119,25 +119,25 @@ void RGWOp_Period_Post::execute() // period that we haven't restarted with yet. we also don't want to modify // the objects in use by RGWRados RGWRealm realm(period.get_realm()); - http_ret = realm.init(cct, store->svc()->sysobj); - if (http_ret < 0) { + op_ret = realm.init(cct, store->svc()->sysobj); + if (op_ret < 0) { lderr(cct) << "failed to read current realm: " - << cpp_strerror(-http_ret) << dendl; + << cpp_strerror(-op_ret) << dendl; return; } RGWPeriod current_period; - http_ret = current_period.init(cct, store->svc()->sysobj, realm.get_id()); - if (http_ret < 0) { + op_ret = current_period.init(cct, store->svc()->sysobj, realm.get_id()); + if (op_ret < 0) { lderr(cct) << "failed to read current period: " - << cpp_strerror(-http_ret) << dendl; + << cpp_strerror(-op_ret) << dendl; return; } // if period id is empty, handle as 'period commit' if (period.get_id().empty()) { - http_ret = period.commit(store, realm, current_period, error_stream); - if (http_ret < 0) { + op_ret = period.commit(store, realm, current_period, error_stream); + if (op_ret < 0) { lderr(cct) << "master zone failed to commit period" << dendl; } return; @@ -147,26 +147,26 @@ void RGWOp_Period_Post::execute() if (period.get_master_zone() == store->svc()->zone->get_zone_params().get_id()) { ldout(cct, 10) << "master zone rejecting period id=" << period.get_id() << " epoch=" << period.get_epoch() << dendl; - http_ret = -EINVAL; // XXX: error code + op_ret = -EINVAL; // XXX: error code return; } // write the period to rados - http_ret = period.store_info(false); - if (http_ret < 0) { + op_ret = period.store_info(false); + if (op_ret < 0) { lderr(cct) << "failed to store period " << period.get_id() << dendl; return; } // set as latest epoch - http_ret = period.update_latest_epoch(period.get_epoch()); - if (http_ret == -EEXIST) { + op_ret = period.update_latest_epoch(period.get_epoch()); + if (op_ret == -EEXIST) { // already have this epoch (or a more recent one) ldout(cct, 4) << "already have epoch >= " << period.get_epoch() << " for period " << period.get_id() << dendl; - http_ret = 0; + op_ret = 0; return; } - if (http_ret < 0) { + if (op_ret < 0) { lderr(cct) << "failed to set latest epoch" << dendl; return; } @@ -189,19 +189,19 @@ void RGWOp_Period_Post::execute() lderr(cct) << "discarding period " << period.get_id() << " with realm epoch " << period.get_realm_epoch() << " too far in " "the future from current epoch " << current_epoch << dendl; - http_ret = -ENOENT; // XXX: error code + op_ret = -ENOENT; // XXX: error code return; } // attach a copy of the period into the period history auto cursor = period_history->attach(RGWPeriod{period}); if (!cursor) { // we're missing some history between the new period and current_period - http_ret = cursor.get_error(); + op_ret = cursor.get_error(); lderr(cct) << "failed to collect the periods between current period " << current_period.get_id() << " (realm epoch " << current_epoch << ") and the new period " << period.get_id() << " (realm epoch " << period.get_realm_epoch() - << "): " << cpp_strerror(-http_ret) << dendl; + << "): " << cpp_strerror(-op_ret) << dendl; return; } if (cursor.has_next()) { @@ -211,8 +211,8 @@ void RGWOp_Period_Post::execute() return; } // set as current period - http_ret = realm.set_current_period(period); - if (http_ret < 0) { + op_ret = realm.set_current_period(period); + if (op_ret < 0) { lderr(cct) << "failed to update realm's current period" << dendl; return; } @@ -223,10 +223,10 @@ void RGWOp_Period_Post::execute() return; } // reflect the period into our local objects - http_ret = period.reflect(); - if (http_ret < 0) { + op_ret = period.reflect(); + if (op_ret < 0) { lderr(cct) << "failed to update local objects: " - << cpp_strerror(-http_ret) << dendl; + << cpp_strerror(-op_ret) << dendl; return; } ldout(cct, 4) << "period epoch " << period.get_epoch() @@ -280,18 +280,18 @@ void RGWOp_Realm_Get::execute() // read realm realm.reset(new RGWRealm(id, name)); - http_ret = realm->init(g_ceph_context, store->svc()->sysobj); - if (http_ret < 0) + op_ret = realm->init(g_ceph_context, store->svc()->sysobj); + if (op_ret < 0) lderr(store->ctx()) << "failed to read realm id=" << id << " name=" << name << dendl; } void RGWOp_Realm_Get::send_response() { - set_req_state_err(s, http_ret); + set_req_state_err(s, op_ret); dump_errno(s); - if (http_ret < 0) { + if (op_ret < 0) { end_header(s); return; } @@ -324,17 +324,17 @@ void RGWOp_Realm_List::execute() RGWRealm realm(store->ctx(), store->svc()->sysobj); [[maybe_unused]] int ret = realm.read_default_id(default_id); } - http_ret = store->svc()->zone->list_realms(realms); - if (http_ret < 0) + op_ret = store->svc()->zone->list_realms(realms); + if (op_ret < 0) lderr(store->ctx()) << "failed to list realms" << dendl; } void RGWOp_Realm_List::send_response() { - set_req_state_err(s, http_ret); + set_req_state_err(s, op_ret); dump_errno(s); - if (http_ret < 0) { + if (op_ret < 0) { end_header(s); return; } diff --git a/src/rgw/rgw_rest_usage.cc b/src/rgw/rgw_rest_usage.cc index 51e028813bc48..7444e80a28c99 100644 --- a/src/rgw/rgw_rest_usage.cc +++ b/src/rgw/rgw_rest_usage.cc @@ -53,7 +53,7 @@ void RGWOp_Usage_Get::execute() { } } - http_ret = RGWUsage::show(store->getRados(), uid, bucket_name, start, end, show_entries, show_summary, &categories, flusher); + op_ret = RGWUsage::show(store->getRados(), uid, bucket_name, start, end, show_entries, show_summary, &categories, flusher); } class RGWOp_Usage_Delete : public RGWRESTOp { @@ -88,12 +88,12 @@ void RGWOp_Usage_Delete::execute() { bool remove_all; RESTArgs::get_bool(s, "remove-all", false, &remove_all); if (!remove_all) { - http_ret = -EINVAL; + op_ret = -EINVAL; return; } } - http_ret = RGWUsage::trim(store->getRados(), uid, bucket_name, start, end); + op_ret = RGWUsage::trim(store->getRados(), uid, bucket_name, start, end); } RGWOp *RGWHandler_Usage::op_get() diff --git a/src/rgw/rgw_rest_user.cc b/src/rgw/rgw_rest_user.cc index d6d490bc3b1db..6419535480044 100644 --- a/src/rgw/rgw_rest_user.cc +++ b/src/rgw/rgw_rest_user.cc @@ -42,7 +42,7 @@ void RGWOp_User_List::execute() op_state.max_entries = max_entries; op_state.marker = marker; - http_ret = RGWUserAdminOp_User::list(store, op_state, flusher); + op_ret = RGWUserAdminOp_User::list(store, op_state, flusher); } class RGWOp_User_Info : public RGWRESTOp { @@ -74,7 +74,7 @@ void RGWOp_User_Info::execute() // end up initializing anonymous user, for which keys.init will eventually // return -EACESS if (uid_str.empty() && access_key_str.empty()){ - http_ret=-EINVAL; + op_ret=-EINVAL; return; } @@ -89,7 +89,7 @@ void RGWOp_User_Info::execute() op_state.set_fetch_stats(fetch_stats); op_state.set_sync_stats(sync_stats); - http_ret = RGWUserAdminOp_User::info(store, op_state, flusher); + op_ret = RGWUserAdminOp_User::info(store, op_state, flusher); } class RGWOp_User_Create : public RGWRESTOp { @@ -152,7 +152,7 @@ void RGWOp_User_Create::execute() if (!s->user->get_info().system && system) { ldout(s->cct, 0) << "cannot set system flag by non-system user" << dendl; - http_ret = -EINVAL; + op_ret = -EINVAL; return; } @@ -173,7 +173,7 @@ void RGWOp_User_Create::execute() int ret = rgw_parse_op_type_list(op_mask_str, &op_mask); if (ret < 0) { ldout(s->cct, 0) << "failed to parse op_mask: " << ret << dendl; - http_ret = -EINVAL; + op_ret = -EINVAL; return; } op_state.set_op_mask(op_mask); @@ -212,7 +212,7 @@ void RGWOp_User_Create::execute() target_rule.from_str(default_placement_str); if (!store->svc()->zone->get_zone_params().valid_placement(target_rule)) { ldout(s->cct, 0) << "NOTICE: invalid dest placement: " << target_rule.to_str() << dendl; - http_ret = -EINVAL; + op_ret = -EINVAL; return; } op_state.set_default_placement(target_rule); @@ -230,7 +230,7 @@ void RGWOp_User_Create::execute() ldpp_dout(this, 0) << "forward_request_to_master returned ret=" << op_ret << dendl; return; } - http_ret = RGWUserAdminOp_User::create(store, op_state, flusher); + op_ret = RGWUserAdminOp_User::create(store, op_state, flusher); } class RGWOp_User_Modify : public RGWRESTOp { @@ -289,7 +289,7 @@ void RGWOp_User_Modify::execute() if (!s->user->get_info().system && system) { ldout(s->cct, 0) << "cannot set system flag by non-system user" << dendl; - http_ret = -EINVAL; + op_ret = -EINVAL; return; } @@ -326,7 +326,7 @@ void RGWOp_User_Modify::execute() uint32_t op_mask; if (rgw_parse_op_type_list(op_mask_str, &op_mask) < 0) { ldout(s->cct, 0) << "failed to parse op_mask" << dendl; - http_ret = -EINVAL; + op_ret = -EINVAL; return; } op_state.set_op_mask(op_mask); @@ -343,7 +343,7 @@ void RGWOp_User_Modify::execute() int ret = rgw_parse_op_type_list(op_mask_str, &op_mask); if (ret < 0) { ldout(s->cct, 0) << "failed to parse op_mask: " << ret << dendl; - http_ret = -EINVAL; + op_ret = -EINVAL; return; } op_state.set_op_mask(op_mask); @@ -354,7 +354,7 @@ void RGWOp_User_Modify::execute() target_rule.from_str(default_placement_str); if (!store->svc()->zone->get_zone_params().valid_placement(target_rule)) { ldout(s->cct, 0) << "NOTICE: invalid dest placement: " << target_rule.to_str() << dendl; - http_ret = -EINVAL; + op_ret = -EINVAL; return; } op_state.set_default_placement(target_rule); @@ -372,7 +372,7 @@ void RGWOp_User_Modify::execute() ldpp_dout(this, 0) << "forward_request_to_master returned ret=" << op_ret << dendl; return; } - http_ret = RGWUserAdminOp_User::modify(store, op_state, flusher); + op_ret = RGWUserAdminOp_User::modify(store, op_state, flusher); } class RGWOp_User_Remove : public RGWRESTOp { @@ -413,7 +413,7 @@ void RGWOp_User_Remove::execute() ldpp_dout(this, 0) << "forward_request_to_master returned ret=" << op_ret << dendl; return; } - http_ret = RGWUserAdminOp_User::remove(store, op_state, flusher, s->yield); + op_ret = RGWUserAdminOp_User::remove(store, op_state, flusher, s->yield); } class RGWOp_Subuser_Create : public RGWRESTOp { @@ -489,7 +489,7 @@ void RGWOp_Subuser_Create::execute() ldpp_dout(this, 0) << "forward_request_to_master returned ret=" << op_ret << dendl; return; } - http_ret = RGWUserAdminOp_Subuser::create(store, op_state, flusher); + op_ret = RGWUserAdminOp_Subuser::create(store, op_state, flusher); } class RGWOp_Subuser_Modify : public RGWRESTOp { @@ -556,7 +556,7 @@ void RGWOp_Subuser_Modify::execute() ldpp_dout(this, 0) << "forward_request_to_master returned ret=" << op_ret << dendl; return; } - http_ret = RGWUserAdminOp_Subuser::modify(store, op_state, flusher); + op_ret = RGWUserAdminOp_Subuser::modify(store, op_state, flusher); } class RGWOp_Subuser_Remove : public RGWRESTOp { @@ -599,7 +599,7 @@ void RGWOp_Subuser_Remove::execute() ldpp_dout(this, 0) << "forward_request_to_master returned ret=" << op_ret << dendl; return; } - http_ret = RGWUserAdminOp_Subuser::remove(store, op_state, flusher); + op_ret = RGWUserAdminOp_Subuser::remove(store, op_state, flusher); } class RGWOp_Key_Create : public RGWRESTOp { @@ -655,7 +655,7 @@ void RGWOp_Key_Create::execute() op_state.set_key_type(key_type); } - http_ret = RGWUserAdminOp_Key::create(store, op_state, flusher); + op_ret = RGWUserAdminOp_Key::create(store, op_state, flusher); } class RGWOp_Key_Remove : public RGWRESTOp { @@ -702,7 +702,7 @@ void RGWOp_Key_Remove::execute() op_state.set_key_type(key_type); } - http_ret = RGWUserAdminOp_Key::remove(store, op_state, flusher); + op_ret = RGWUserAdminOp_Key::remove(store, op_state, flusher); } class RGWOp_Caps_Add : public RGWRESTOp { @@ -740,7 +740,7 @@ void RGWOp_Caps_Add::execute() ldpp_dout(this, 0) << "forward_request_to_master returned ret=" << op_ret << dendl; return; } - http_ret = RGWUserAdminOp_Caps::add(store, op_state, flusher); + op_ret = RGWUserAdminOp_Caps::add(store, op_state, flusher); } class RGWOp_Caps_Remove : public RGWRESTOp { @@ -778,7 +778,7 @@ void RGWOp_Caps_Remove::execute() ldpp_dout(this, 0) << "forward_request_to_master returned ret=" << op_ret << dendl; return; } - http_ret = RGWUserAdminOp_Caps::remove(store, op_state, flusher); + op_ret = RGWUserAdminOp_Caps::remove(store, op_state, flusher); } struct UserQuotas { @@ -826,7 +826,7 @@ void RGWOp_Quota_Info::execute() RESTArgs::get_string(s, "quota-type", quota_type, "a_type); if (uid_str.empty()) { - http_ret = -EINVAL; + op_ret = -EINVAL; return; } @@ -837,26 +837,26 @@ void RGWOp_Quota_Info::execute() bool show_user = show_all || (quota_type == "user"); if (!(show_all || show_bucket || show_user)) { - http_ret = -EINVAL; + op_ret = -EINVAL; return; } op_state.set_user_id(uid); RGWUser user; - http_ret = user.init(store, op_state); - if (http_ret < 0) + op_ret = user.init(store, op_state); + if (op_ret < 0) return; if (!op_state.has_existing_user()) { - http_ret = -ERR_NO_SUCH_USER; + op_ret = -ERR_NO_SUCH_USER; return; } RGWUserInfo info; string err_msg; - http_ret = user.info(info, &err_msg); - if (http_ret < 0) + op_ret = user.info(info, &err_msg); + if (op_ret < 0) return; flusher.start(0); @@ -945,7 +945,7 @@ void RGWOp_Quota_Set::execute() RESTArgs::get_string(s, "quota-type", quota_type, "a_type); if (uid_str.empty()) { - http_ret = -EINVAL; + op_ret = -EINVAL; return; } @@ -957,7 +957,7 @@ void RGWOp_Quota_Set::execute() if (!(set_all || set_bucket || set_user)) { ldout(store->ctx(), 20) << "invalid quota type" << dendl; - http_ret = -EINVAL; + op_ret = -EINVAL; return; } @@ -972,21 +972,21 @@ void RGWOp_Quota_Set::execute() if (use_http_params && set_all) { ldout(store->ctx(), 20) << "quota type was not specified, can't set all quotas via http headers" << dendl; - http_ret = -EINVAL; + op_ret = -EINVAL; return; } op_state.set_user_id(uid); RGWUser user; - http_ret = user.init(store, op_state); - if (http_ret < 0) { - ldout(store->ctx(), 20) << "failed initializing user info: " << http_ret << dendl; + op_ret = user.init(store, op_state); + if (op_ret < 0) { + ldout(store->ctx(), 20) << "failed initializing user info: " << op_ret << dendl; return; } if (!op_state.has_existing_user()) { - http_ret = -ERR_NO_SUCH_USER; + op_ret = -ERR_NO_SUCH_USER; return; } @@ -994,7 +994,7 @@ void RGWOp_Quota_Set::execute() if (set_all) { UserQuotas quotas; - if ((http_ret = rgw_rest_get_json_input(store->ctx(), s, quotas, QUOTA_INPUT_MAX_LEN, NULL)) < 0) { + if ((op_ret = rgw_rest_get_json_input(store->ctx(), s, quotas, QUOTA_INPUT_MAX_LEN, NULL)) < 0) { ldout(store->ctx(), 20) << "failed to retrieve input" << dendl; return; } @@ -1006,8 +1006,8 @@ void RGWOp_Quota_Set::execute() if (!use_http_params) { bool empty; - http_ret = rgw_rest_get_json_input(store->ctx(), s, quota, QUOTA_INPUT_MAX_LEN, &empty); - if (http_ret < 0) { + op_ret = rgw_rest_get_json_input(store->ctx(), s, quota, QUOTA_INPUT_MAX_LEN, &empty); + if (op_ret < 0) { ldout(store->ctx(), 20) << "failed to retrieve input" << dendl; if (!empty) return; @@ -1020,9 +1020,9 @@ void RGWOp_Quota_Set::execute() if (use_http_params) { RGWUserInfo info; string err_msg; - http_ret = user.info(info, &err_msg); - if (http_ret < 0) { - ldout(store->ctx(), 20) << "failed to get user info: " << http_ret << dendl; + op_ret = user.info(info, &err_msg); + if (op_ret < 0) { + ldout(store->ctx(), 20) << "failed to get user info: " << op_ret << dendl; return; } RGWQuotaInfo *old_quota; @@ -1051,9 +1051,9 @@ void RGWOp_Quota_Set::execute() } string err; - http_ret = user.modify(op_state, &err); - if (http_ret < 0) { - ldout(store->ctx(), 20) << "failed updating user info: " << http_ret << ": " << err << dendl; + op_ret = user.modify(op_state, &err); + if (op_ret < 0) { + ldout(store->ctx(), 20) << "failed updating user info: " << op_ret << ": " << err << dendl; return; } } -- 2.47.3