]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: fixes and adjustments following rebase 8031/head
authorYehuda Sadeh <yehuda@redhat.com>
Sat, 27 Feb 2016 00:07:29 +0000 (16:07 -0800)
committerYehuda Sadeh <yehuda@redhat.com>
Sat, 27 Feb 2016 00:07:29 +0000 (16:07 -0800)
Also, use ldout instead of cerr in rgw_op.cc

Signed-off-by: Yehuda Sadeh <yehuda@redhat.com>
src/rgw/rgw_op.cc
src/rgw/rgw_op.h
src/rgw/rgw_rest_s3.cc

index 1e0072d7abf670289d6568fb553696235024d384..d19d7a85da40af2d27c41bbe84c2d6de0abd3dae 100644 (file)
@@ -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 ;
   }
   
index a4c36f97a6e88a4ba704ae0f51f018f2b844b183..a2f222f0308b6467f44a7cd9541da579117206db 100644 (file)
@@ -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<string, rgw_usage_log_entry> 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();
index 8d8231555705b18fc0884441c0192542f6fd2f0e..91bff36a5c7923665065a17f4303eec786232132 100644 (file)
@@ -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;