diff options
author | Yehuda Sadeh <yehuda@hq.newdream.net> | 2010-10-29 00:40:27 +0200 |
---|---|---|
committer | Yehuda Sadeh <yehuda@hq.newdream.net> | 2010-10-29 00:49:21 +0200 |
commit | 10466c526348aafacbd4213fade5774dbabb6ea6 (patch) | |
tree | 8f14253165528e57a4c0d571513caf82f168dcca /qa | |
parent | SubmittingPatches: initial version (diff) | |
download | ceph-10466c526348aafacbd4213fade5774dbabb6ea6.tar.xz ceph-10466c526348aafacbd4213fade5774dbabb6ea6.zip |
qa: add rbd test
Diffstat (limited to 'qa')
-rw-r--r-- | qa/rbd/common.sh | 16 | ||||
-rwxr-xr-x | qa/rbd/rbd.sh | 51 |
2 files changed, 51 insertions, 16 deletions
diff --git a/qa/rbd/common.sh b/qa/rbd/common.sh index 6c767e4f822..e716ed3b77e 100644 --- a/qa/rbd/common.sh +++ b/qa/rbd/common.sh @@ -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 +} diff --git a/qa/rbd/rbd.sh b/qa/rbd/rbd.sh index 9b2a3bdc7f5..b90f0c2cfbb 100755 --- a/qa/rbd/rbd.sh +++ b/qa/rbd/rbd.sh @@ -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 |