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);
}
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);
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 {
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 {
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 {
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 {
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 {
}
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 {
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);
std::string bucket;
RESTArgs::get_string(s, "bucket", bucket, &bucket, &bucket_arg_existed);
if (! bucket_arg_existed) {
- http_ret = -EINVAL;
+ op_ret = -EINVAL;
return;
}
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 */
if (use_http_params) {
RGWBucketInfo bucket_info;
map<string, bufferlist> 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;
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 {
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 {
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);
}
#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) {
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);
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;
}
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) {
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;
}
}
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");
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);
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;
}
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);
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")) {
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;
}
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");
locker_id.empty() ||
zone_id.empty()) {
dout(5) << "Error invalid parameter list" << dendl;
- http_ret = -EINVAL;
+ op_ret = -EINVAL;
return;
}
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;
}
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");
locker_id.empty() ||
zone_id.empty()) {
dout(5) << "Error invalid parameter list" << dendl;
- http_ret = -EINVAL;
+ op_ret = -EINVAL;
return;
}
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() {
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;
}
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;
}
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;
}
store->getRados()->wakeup_meta_sync_shards(updated_shards);
- http_ret = 0;
+ op_ret = 0;
}
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;
}
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");
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;
}
map<RGWObjCategory, RGWStorageStats> 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");
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;
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);
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;
}
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) {
// 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");
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);
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);
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;
}
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;
}
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;
}
store->getRados()->wakeup_data_sync_shards(source_zone, updated_shards);
- http_ret = 0;
+ op_ret = 0;
}
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")) {
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
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();
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
} 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;
}
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();
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();
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() {
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;
}
}
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;
}
do {
list<string> 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;
}
}
meta_mgr->list_keys_complete(handle);
- http_ret = 0;
+ op_ret = 0;
}
int RGWOp_Metadata_Put::get_data(bufferlist& bl) {
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;
}
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
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() {
// 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);
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;
}
// 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;
}
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;
}
// 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;
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;
}
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()) {
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;
}
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()
// 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;
}
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;
}
}
}
- 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 {
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()
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 {
// 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;
}
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 {
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;
}
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);
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);
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 {
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;
}
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);
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);
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);
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 {
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 {
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 {
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 {
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 {
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 {
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 {
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 {
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 {
RESTArgs::get_string(s, "quota-type", quota_type, "a_type);
if (uid_str.empty()) {
- http_ret = -EINVAL;
+ op_ret = -EINVAL;
return;
}
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);
RESTArgs::get_string(s, "quota-type", quota_type, "a_type);
if (uid_str.empty()) {
- http_ret = -EINVAL;
+ op_ret = -EINVAL;
return;
}
if (!(set_all || set_bucket || set_user)) {
ldout(store->ctx(), 20) << "invalid quota type" << dendl;
- http_ret = -EINVAL;
+ op_ret = -EINVAL;
return;
}
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;
}
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;
}
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;
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;
}
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;
}
}