]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: need to 'open_object_section' before dump stats in 'RGWGetUsage_ObjStore_S3... 11325/head
authorweiqiaomiao <wei.qiaomiao@zte.com.cn>
Sat, 4 Jun 2016 09:21:33 +0000 (17:21 +0800)
committerYehuda Sadeh <yehuda@redhat.com>
Wed, 5 Oct 2016 00:06:36 +0000 (17:06 -0700)
Fixes: http://tracker.ceph.com/issues/17499
Signed-off-by: weiqiaomiao <wei.qiaomiao@zte.com.cn>
PendingReleaseNotes
src/common/config_opts.h
src/rgw/rgw_rest_s3.cc

index dd19f2a7342b382da836afeff0363f0e2586f9d7..f842558f2670c6cda642b2eafe324a25a2319fcf 100644 (file)
   listed in 'osd class default list' requires a capability naming the class
   (e.g. 'allow class foo').
 
+* The 'rgw rest getusage op compat' config option allows you to dump the description of user stats
+  or not in s3 GetUsage API. This config option is of bool type and defaults to false.
+  If the value is true, the reponse data of s3 GetUsage like below:
+
+    "stats": {
+                "TotalBytes": 516,
+                "TotalBytesRounded": 1024,
+                "TotalEntries": 1
+             }
+
+  Or if the value is false, the  reponse of s3 GetUsage like below and as it does before we add this config option:
+
+    {
+         516,
+         1024,
+         1
+    }.
+
 11.0.0
 ------
 
index b9cc870a8e1fcc2ae844ec9c9b05e6477b5f5291..312b8edf36bab5de5c1fa3ede97fa36141ca2ea2 100644 (file)
@@ -1515,6 +1515,8 @@ OPTION(mon_mgr_beacon_grace, OPT_INT, 30)  // How long to wait to failover
 
 OPTION(rgw_list_bucket_min_readahead, OPT_INT, 1000) // minimum number of entries to read from rados for bucket listing
 
+OPTION(rgw_rest_getusage_op_compat, OPT_BOOL, false) // dump description of total stats for s3 GetUsage API
+
 OPTION(mutex_perf_counter, OPT_BOOL, false) // enable/disable mutex perf counter
 OPTION(throttler_perf_counter, OPT_BOOL, true) // enable/disable throttler perf counter
 
index 629e619f88271a4c21a3de97121508cd5247a03b..df16f7db6f87006b87c02982e7ee326a0275e19f 100644 (file)
@@ -430,10 +430,20 @@ void RGWGetUsage_ObjStore_S3::send_response()
        formatter->dump_int("SuccessfulOps", total_usage.successful_ops);
        formatter->close_section(); // total 
        formatter->close_section(); // user
-     } 
+     }
+
+     if (s->cct->_conf->rgw_rest_getusage_op_compat) {
+       formatter->open_object_section("Stats"); 
+     } 
+       
      formatter->dump_int("TotalBytes", header.stats.total_bytes);
      formatter->dump_int("TotalBytesRounded", header.stats.total_bytes_rounded);
      formatter->dump_int("TotalEntries", header.stats.total_entries);
+     
+     if (s->cct->_conf->rgw_rest_getusage_op_compat) { 
+       formatter->close_section(); //Stats
+     }
+
      formatter->close_section(); // summary
    }
    formatter->close_section(); // usage