]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: fix s3 list buckets 4435/head
authorYehuda Sadeh <yehuda@redhat.com>
Wed, 22 Apr 2015 17:35:32 +0000 (10:35 -0700)
committerYehuda Sadeh <yehuda@redhat.com>
Wed, 22 Apr 2015 20:09:45 +0000 (13:09 -0700)
Fixes: #11451
Backport: hammer
Got broken in commit:7dd54fa3621c04c8ea5723fb1bc06b91d81a0c6c.
Resurrect the option to list unlimited number of buckets using the S3
api.

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

index d6c916e19a396fd1ffb60d51cf4772804c9e359f..2319bbf132599727c46e8ca78f92d3a627584883 100644 (file)
@@ -999,7 +999,11 @@ void RGWListBuckets::execute()
   do {
     RGWUserBuckets buckets;
     uint64_t read_count;
-    read_count = min(limit - total_count, (uint64_t)max_buckets);
+    if (limit >= 0) {
+      read_count = min(limit - total_count, (uint64_t)max_buckets);
+    } else {
+      read_count = max_buckets;
+    }
 
     ret = rgw_read_user_buckets(store, s->user.user_id, buckets,
                                 marker, read_count, should_get_stats(), 0);
@@ -1029,7 +1033,7 @@ void RGWListBuckets::execute()
 
     total_count += m.size();
 
-    done = (m.size() < read_count || total_count >= limit);
+    done = (m.size() < read_count || (limit >= 0 && total_count >= (uint64_t)limit));
 
     if (!m.empty()) {
       send_response_data(buckets);
index 8838cf0f2c1969d7669d56720050b3a9ec4df248..7124825fefdc69995288c75f1c0178548943ab55 100644 (file)
@@ -185,7 +185,7 @@ protected:
   int ret;
   bool sent_data;
   string marker;
-  uint64_t limit;
+  int64_t limit;
   uint64_t limit_max;
   uint32_t buckets_count;
   uint64_t buckets_objcount;
index d32ba5dd94ef969b1240e77a5c2509ed673859e3..1a92a8c2257f75aedc2ebf98917dbe8e99f26495 100644 (file)
@@ -30,7 +30,7 @@ public:
   ~RGWListBuckets_ObjStore_S3() {}
 
   int get_params() {
-    limit = 0; /* no limit */
+    limit = -1; /* no limit */
     return 0;
   }
   virtual void send_response_begin(bool has_buckets);