]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
cls_rbd: send proper format of key to "last_read" for dir_list
authorDan Mick <dan.mick@inktank.com>
Tue, 6 Nov 2012 23:28:10 +0000 (15:28 -0800)
committerDan Mick <dan.mick@inktank.com>
Tue, 6 Nov 2012 23:51:44 +0000 (15:51 -0800)
rbd ls of format-2 images was looping on the first 64 (when more than 64
were present).  The key name passed to the omap layer needs to always
contain the prefix, and the "inside-the-loop next-chunk" statement
was missing the "add the prefix" call.

Also, add a test for listing 100 images, format 1 and 2.

Signed-off-by: Dan Mick <dan.mick@inktank.com>
Reviewed-by: Josh Durgin <josh.durgin@inktank.com>
qa/workunits/rbd/copy.sh
src/cls_rbd.cc

index 86a365cbf71ff5ee62af8fe190eab2ff9aaf180e..7571f50471dfecb2e3232480cea8f53456995b93 100755 (executable)
@@ -113,8 +113,26 @@ test_ls() {
     rbd ls | wc -l | grep 2
     rbd ls -l | grep 'test1.*1024K.*2'
     rbd ls -l | grep 'test2.*1024K.*1'
-
     remove_images
+       
+    # test that many images can be shown by ls
+    for i in $(seq -w 00 99); do
+       rbd create image.$i -s 1
+    done
+    rbd ls | wc -l | grep 100
+    rbd ls -l | grep image | wc -l | grep 100
+    for i in $(seq -w 00 99); do
+       rbd rm image.$i 
+    done
+
+    for i in $(seq -w 00 99); do
+       rbd create image.$i --format 2 -s 1
+    done
+    rbd ls | wc -l | grep 100
+    rbd ls -l | grep image |  wc -l | grep 100
+    for i in $(seq -w 00 99); do
+       rbd rm image.$i 
+    done
 }
 
 test_remove() {
index c4584f9075b4cdd04ccb2a4e4cc9f318648d116d..85a9e1fe8d7ec09fc1fb8aedfb20a9f018821bc1 100644 (file)
@@ -1573,7 +1573,7 @@ int dir_list(cls_method_context_t hctx, bufferlist *in, bufferlist *out)
        break;
     }
     if (vals.size() > 0) {
-      last_read = images.rbegin()->first;
+      last_read = dir_key_for_name(images.rbegin()->first);
     }
   }