]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
qa/workunits/rbd: image resize test for rbd-nbd
authorMykola Golub <mgolub@mirantis.com>
Fri, 3 Jun 2016 18:11:21 +0000 (21:11 +0300)
committerMykola Golub <mgolub@mirantis.com>
Wed, 13 Jul 2016 12:40:03 +0000 (15:40 +0300)
Signed-off-by: Mykola Golub <mgolub@mirantis.com>
qa/workunits/rbd/rbd-nbd.sh

index 46e8f3858d0189a8c4b034ecf6cc53101e47ccd8..1e08adee81fa964f936f5c9707d1b0adf6069c26 100755 (executable)
@@ -76,15 +76,15 @@ DEV=`${SUDO} rbd-nbd --device ${dev1} map ${POOL}/${IMAGE}`
 [ "${DEV}" = "${dev1}" ]
 ${SUDO} rbd-nbd list-mapped | grep "^${DEV}$"
 
-#read test
+# read test
 [ "`dd if=${DATA} bs=1M | md5sum`" = "`${SUDO} dd if=${DEV} bs=1M | md5sum`" ]
 
-#write test
+# write test
 dd if=/dev/urandom of=${DATA} bs=1M count=${SIZE}
 ${SUDO} dd if=${DATA} of=${DEV} bs=1M oflag=direct
 [ "`dd if=${DATA} bs=1M | md5sum`" = "`rbd -p ${POOL} --no-progress export ${IMAGE} - | md5sum`" ]
 
-#trim test
+# trim test
 provisioned=`rbd -p ${POOL} --format xml du ${IMAGE} |
   $XMLSTARLET sel -t -m "//stats/images/image/provisioned_size" -v .`
 used=`rbd -p ${POOL} --format xml du ${IMAGE} |
@@ -98,4 +98,18 @@ used=`rbd -p ${POOL} --format xml du ${IMAGE} |
   $XMLSTARLET sel -t -m "//stats/images/image/used_size" -v .`
 [ "${used}" -lt "${provisioned}" ]
 
+# resize test
+devname=$(basename ${DEV})
+blocks=$(awk -v dev=${devname} '$4 == dev {print $3}' /proc/partitions)
+test -n "${blocks}"
+rbd resize ${POOL}/${IMAGE} --size $((SIZE * 2))M
+rbd info ${POOL}/${IMAGE}
+blocks2=$(awk -v dev=${devname} '$4 == dev {print $3}' /proc/partitions)
+test -n "${blocks2}"
+test ${blocks2} -eq $((blocks * 2))
+rbd resize ${POOL}/${IMAGE} --allow-shrink --size ${SIZE}M
+blocks2=$(awk -v dev=${devname} '$4 == dev {print $3}' /proc/partitions)
+test -n "${blocks2}"
+test ${blocks2} -eq ${blocks}
+
 echo OK