From: Dan Mick Date: Tue, 6 Nov 2012 23:28:10 +0000 (-0800) Subject: cls_rbd: send proper format of key to "last_read" for dir_list X-Git-Tag: v0.54~15 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=0baa9275ea1ec68e902c15342921477ae9db0aa4;p=ceph.git cls_rbd: send proper format of key to "last_read" for dir_list 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 Reviewed-by: Josh Durgin --- diff --git a/qa/workunits/rbd/copy.sh b/qa/workunits/rbd/copy.sh index 86a365cbf71..7571f50471d 100755 --- a/qa/workunits/rbd/copy.sh +++ b/qa/workunits/rbd/copy.sh @@ -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() { diff --git a/src/cls_rbd.cc b/src/cls_rbd.cc index c4584f9075b..85a9e1fe8d7 100644 --- a/src/cls_rbd.cc +++ b/src/cls_rbd.cc @@ -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); } }