From: Yehuda Sadeh Date: Sat, 27 Feb 2016 00:07:29 +0000 (-0800) Subject: rgw: fixes and adjustments following rebase X-Git-Tag: v10.1.0~165^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=ea2e24fde7e5faf573a043df91e73c7f634c3b0d;p=ceph.git rgw: fixes and adjustments following rebase Also, use ldout instead of cerr in rgw_op.cc Signed-off-by: Yehuda Sadeh --- diff --git a/src/rgw/rgw_op.cc b/src/rgw/rgw_op.cc index 1e0072d7abf6..d19d7a85da40 100644 --- a/src/rgw/rgw_op.cc +++ b/src/rgw/rgw_op.cc @@ -1279,7 +1279,7 @@ int RGWListBuckets::verify_permission() int RGWGetUsage::verify_permission() { - if (!rgw_user_is_authenticated(s->user)) + if (!rgw_user_is_authenticated(*s->user)) return -EACCES; return 0; } @@ -1362,22 +1362,22 @@ void RGWGetUsage::execute() { uint64_t start_epoch = 0; uint64_t end_epoch = (uint64_t)-1; - ret = get_params(); - if (ret < 0) + op_ret = get_params(); + if (op_ret < 0) return; if (!start_date.empty()) { - ret = utime_t::parse_date(start_date, &start_epoch, NULL); - if (ret < 0) { - cerr << "ERROR: failed to parse start date" << std::endl; + op_ret = utime_t::parse_date(start_date, &start_epoch, NULL); + if (op_ret < 0) { + ldout(store->ctx(), 0) << "ERROR: failed to parse start date" << dendl; return; } } if (!end_date.empty()) { - ret = utime_t::parse_date(end_date, &end_epoch, NULL); - if (ret < 0) { - cerr << "ERROR: failed to parse end date" << std::endl; + op_ret = utime_t::parse_date(end_date, &end_epoch, NULL); + if (op_ret < 0) { + ldout(store->ctx(), 0) << "ERROR: failed to parse end date" << dendl; return; } } @@ -1389,28 +1389,29 @@ void RGWGetUsage::execute() RGWUsageIter usage_iter; while (is_truncated) { - int ret = store->read_usage(s->user.user_id, start_epoch, end_epoch, max_entries, + op_ret = store->read_usage(s->user->user_id, start_epoch, end_epoch, max_entries, &is_truncated, usage_iter, usage); - if (ret == -ENOENT) { - ret = 0; + if (op_ret == -ENOENT) { + op_ret = 0; is_truncated = false; } - if (ret < 0) { + if (op_ret < 0) { return; } } - ret = rgw_user_sync_all_stats(store, s->user.user_id); - if (ret < 0) { - cerr << "ERROR: failed to sync user stats: " << std::endl; + op_ret = rgw_user_sync_all_stats(store, s->user->user_id); + if (op_ret < 0) { + ldout(store->ctx(), 0) << "ERROR: failed to sync user stats: " << dendl; return ; } - ret = store->cls_user_get_header(s->user.user_id, &header); - if (ret < 0) { - cerr << "ERROR: can't read user header: " << std::endl; + string user_str = s->user->user_id.to_str(); + op_ret = store->cls_user_get_header(user_str, &header); + if (op_ret < 0) { + ldout(store->ctx(), 0) << "ERROR: can't read user header: " << dendl; return ; } diff --git a/src/rgw/rgw_op.h b/src/rgw/rgw_op.h index a4c36f97a6e8..a2f222f0308b 100644 --- a/src/rgw/rgw_op.h +++ b/src/rgw/rgw_op.h @@ -314,7 +314,6 @@ public: class RGWGetUsage : public RGWOp { protected: - int ret; bool sent_data; string start_date; string end_date; @@ -325,7 +324,7 @@ protected: map summary_map; cls_user_header header; public: - RGWGetUsage() : ret(0), sent_data(false), show_log_entries(true), show_log_sum(true){ + RGWGetUsage() : sent_data(false), show_log_entries(true), show_log_sum(true){ } int verify_permission(); diff --git a/src/rgw/rgw_rest_s3.cc b/src/rgw/rgw_rest_s3.cc index 8d8231555705..91bff36a5c79 100644 --- a/src/rgw/rgw_rest_s3.cc +++ b/src/rgw/rgw_rest_s3.cc @@ -329,13 +329,13 @@ static void dump_usage_categories_info(Formatter *formatter, const rgw_usage_log void RGWGetUsage_ObjStore_S3::send_response() { - if (ret < 0) - set_req_state_err(s, ret); + if (op_ret < 0) + set_req_state_err(s, op_ret); dump_errno(s); end_header(s, this, "application/xml"); dump_start(s); - if (ret < 0) + if (op_ret < 0) return; Formatter *formatter = s->formatter;