Skip to content

Commit

Permalink
qa: add rbd test
Browse files Browse the repository at this point in the history
  • Loading branch information
Yehuda Sadeh committed Oct 28, 2010
1 parent b44901c commit 10466c5
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 16 deletions.
16 changes: 11 additions & 5 deletions qa/rbd/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,22 +41,28 @@ rbd_load() {
}

rbd_create_image() {
rbd create $img_name --size=$imgsize
id=$1
rbd create $img_name.$id --size=$imgsize
}

rbd_add() {
id=$1
echo "$monip:$monport name=$user,secret=$secret rbd $img_name" > /sys/class/rbd/add
sleep 1
export rbd$id="`tail -1 /sys/class/rbd/list | cut -f1`"
echo "$monip:$monport name=$user,secret=$secret rbd $img_name.$id" > /sys/class/rbd/add
devid="`cat /sys/class/rbd/list | grep $img_name.$ext | tail -1 | cut -f1`"
export rbd$id=$devid
while [ ! -e /dev/rbd$devid ]; do sleep 0; done
}

rbd_test_init() {
rbd_load
rbd_create_image
}


rbd_remove() {
echo $1 > /sys/class/rbd/remove
}

rbd_rm_image() {
id=$1
rbd rm $imgname.$id
}
51 changes: 40 additions & 11 deletions qa/rbd/rbd.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,45 @@ basedir=`echo $0 | sed 's/[^/]*$//g'`.

rbd_test_init

rbd_add 0

devname=/dev/rbd$rbd0

mkfs -t ext3 $devname
mount -t ext3 $devname /mnt

dbench -D /mnt -t 30 5
sync

umount /mnt
rbd_remove $rbd0
create_multiple() {
for i in `seq 1 10`; do
rbd_create_image $i
done

for i in `seq 1 10`; do
rbd_add $i
done
for i in `seq 1 10`; do
devname=/dev/rbd`eval echo \\$rbd$i`
echo $devname
done
for i in `seq 1 10`; do
devid=`eval echo \\$rbd$i`
rbd_remove $devid
done
for i in `seq 1 10`; do
rbd_rm_image $i
done
}

test_dbench() {
rbd_create_image 0
rbd_add 0

devname=/dev/rbd$rbd0

mkfs -t ext3 $devname
mount -t ext3 $devname /mnt

dbench -D /mnt -t 30 5
sync

umount /mnt
rbd_remove $rbd0
rbd_rm_image 0
}

create_multiple
test_dbench

0 comments on commit 10466c5

Please sign in to comment.