]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: fix radosgw-admin buckets list
authorYehuda Sadeh <yehuda@inktank.com>
Wed, 26 Jun 2013 18:28:57 +0000 (11:28 -0700)
committerSage Weil <sage@inktank.com>
Thu, 27 Jun 2013 04:30:49 +0000 (21:30 -0700)
Fixes: #5455
Backport: cuttlefish
This commit fixes a regression, where radosgw-admin buckets list
operation wasn't returning any data.

Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
Reviewed-by: Sage Weil <sage@inktank.com>
src/rgw/rgw_bucket.cc
src/rgw/rgw_rados.cc

index 23881d18ebfb13dbd4bde9d747efcedbf31838a9..6a6b576235281779c7358bd702c69cd45f06af43 100644 (file)
@@ -863,11 +863,16 @@ int RGWBucketAdminOp::info(RGWRados *store, RGWBucketAdminOpState& op_state,
                   RGWFormatterFlusher& flusher)
 {
   RGWBucket bucket;
-  int ret = bucket.init(store, op_state);
-  if (ret < 0)
-    return ret;
+  int ret;
+
   string bucket_name = op_state.get_bucket_name();
 
+  if (!bucket_name.empty()) {
+    ret = bucket.init(store, op_state);
+    if (ret < 0)
+      return ret;
+  }
+
   Formatter *formatter = flusher.get_formatter();
   flusher.start(0);
 
@@ -911,7 +916,8 @@ int RGWBucketAdminOp::info(RGWRados *store, RGWBucketAdminOpState& op_state,
   } else {
     RGWAccessHandle handle;
 
-    if (store->list_buckets_init(&handle) > 0) {
+    formatter->open_array_section("buckets");
+    if (store->list_buckets_init(&handle) >= 0) {
       RGWObjEnt obj;
       while (store->list_buckets_next(obj, &handle) >= 0) {
        formatter->dump_string("bucket", obj.name);
@@ -919,6 +925,8 @@ int RGWBucketAdminOp::info(RGWRados *store, RGWBucketAdminOpState& op_state,
           bucket_stats(store, obj.name, formatter);
       }
     }
+
+    formatter->close_section();
   }
 
   flusher.flush();
index 7a2f2d04d3b08dc4621ffe09243b6e11fc992cfe..5c0bb6e8bbd5de74ff520a3e76d5ab1e5a969152 100644 (file)
@@ -428,9 +428,7 @@ int RGWRados::list_buckets_next(RGWObjEnt& obj, RGWAccessHandle *handle)
 
     obj.name = (*state)->first;
     (*state)++;
-  } while (obj.name[0] == '.');
-
-  /* FIXME: should read mtime/size vals for bucket */
+  } while (obj.name[0] == '.'); /* skip all entries starting with '.' */
 
   return 0;
 }