rbd: qa code for thick provision support

Add the qa code for thick provision option, if applied.

The qa code creates and checks 64 MB thick-provision image
for small image test, and it also creates and checks 4 GB
thick-provision image for large image test.

Signed-off-by: Hitoshi Kamei <hitoshi.kamei.xm@hitachi.com>
Cc: Mitsuo Hayasaka <mitsuo.hayasaka.hu@hitachi.com>
This commit is contained in:
Hitoshi Kamei 2018-03-13 17:25:24 +09:00
parent 91ea43c3f6
commit b517532d53

View File

@ -540,6 +540,58 @@ test_clone_v2() {
rbd rm test2
}
test_thick_provision() {
echo "testing thick provision..."
remove_images
# Try to create small and large thick-pro image and
# check actual size. (64M and 4G)
# Small thick-pro image test
rbd create $RBD_CREATE_ARGS --thick-provision -s 64M test1
count=0
ret=""
while [ $count -lt 10 ]
do
rbd du|grep test1|tr -s " "|cut -d " " -f 3|grep '^64M' && ret=$?
if [ "$ret" = "0" ]
then
break;
fi
count=`expr $count + 1`
sleep 2
done
rbd du
if [ "$ret" != "0" ]
then
exit 1
fi
rbd rm test1
rbd ls | grep test1 | wc -l | grep '^0$'
# Large thick-pro image test
rbd create $RBD_CREATE_ARGS --thick-provision -s 4G test1
count=0
ret=""
while [ $count -lt 10 ]
do
rbd du|grep test1|tr -s " "|cut -d " " -f 3|grep '^4G' && ret=$?
if [ "$ret" = "0" ]
then
break;
fi
count=`expr $count + 1`
sleep 2
done
rbd du
if [ "$ret" != "0" ]
then
exit 1
fi
rbd rm test1
rbd ls | grep test1 | wc -l | grep '^0$'
}
test_pool_image_args
test_rename
test_ls
@ -547,6 +599,7 @@ test_remove
RBD_CREATE_ARGS=""
test_others
test_locking
test_thick_provision
RBD_CREATE_ARGS="--image-format 2"
test_others
test_locking
@ -555,5 +608,6 @@ test_trash
test_purge
test_deep_copy_clone
test_clone_v2
test_thick_provision
echo OK