]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: rgw-admin --skip-zero-entries
authorYehuda Sadeh <yehuda@hq.newdream.net>
Wed, 26 Oct 2011 23:07:04 +0000 (16:07 -0700)
committerYehuda Sadeh <yehuda@hq.newdream.net>
Wed, 26 Oct 2011 23:07:30 +0000 (16:07 -0700)
src/rgw/rgw_admin.cc
src/test/cli/radosgw-admin/help.t

index f4aa7acc0b7562a2028a2a4309b85b2cacb32893..cd88c4d18dab7337cd6ffc707f75e92369b5cf6f 100644 (file)
@@ -79,6 +79,8 @@ void _usage()
   cerr << "                             user data\n";
   cerr << "   --show-log-entries=<flag> enable/disable dump of log entries on log show\n";
   cerr << "   --show-log-sum=<flag>     enable/disable dump of log summation on log show\n";
+  cerr << "   --skip-zero-entries       log show only dumps entries that don't have zero value\n";
+  cerr << "                             in one of the numeric field\n";
   generic_client_usage();
 }
 
@@ -498,6 +500,7 @@ int main(int argc, char **argv)
   int pretty_format = false;
   int show_log_entries = true;
   int show_log_sum = true;
+  int skip_zero_entries = false;  // log show
 
   std::string val;
   std::ostringstream errs;
@@ -544,6 +547,8 @@ int main(int argc, char **argv)
       // do nothing
     } else if (ceph_argparse_binary_flag(args, i, &show_log_sum, NULL, "--show_log_sum", (char*)NULL)) {
       // do nothing
+    } else if (ceph_argparse_binary_flag(args, i, &skip_zero_entries, NULL, "--skip_zero_entries", (char*)NULL)) {
+      // do nothing
     } else if (ceph_argparse_withlonglong(args, i, &tmp, &errs, "-a", "--auth-uid", (char*)NULL)) {
       if (!errs.str().empty()) {
        cerr << errs.str() << std::endl;
@@ -1082,6 +1087,10 @@ int main(int argc, char **argv)
         agg_bytes_received += entry.bytes_received;
         total_entries++;
 
+        if (skip_zero_entries && entry.bytes_sent == 0 &&
+            entry.bytes_received == 0)
+          goto next;
+
         if (show_log_entries) {
          formatter->open_object_section("log_entry");
          formatter->dump_string("bucket", entry.bucket.c_str());
@@ -1104,7 +1113,7 @@ int main(int argc, char **argv)
          formatter->close_section();
          formatter->flush(cout);
         }
-
+next:
        r = store->log_show_next(h, &entry);
       } while (r > 0);
 
index 7822f6dea5673d11c45251a4b657244505de9796..590d21e44306072a29228ceb428b6585e62fef3a 100644 (file)
@@ -51,6 +51,8 @@
                                user data
      --show-log-entries=<flag> enable/disable dump of log entries on log show
      --show-log-sum=<flag>     enable/disable dump of log summation on log show
+     --skip-zero-entries       log show only dumps entries that don't have zero value
+                               in one of the numeric field
   --conf/-c        Read configuration from the given configuration file
   -d               Run in foreground, log to stderr.
   -f               Run in foreground, log to usual location.