]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
mdadm/test: Add one test case for raid5 reshape
authorXiao Ni <xni@redhat.com>
Tue, 10 Oct 2017 11:32:52 +0000 (19:32 +0800)
committerJes Sorensen <jsorensen@fb.com>
Tue, 10 Oct 2017 20:23:14 +0000 (16:23 -0400)
This case tries to allow raid5 reshape to use backwards direction.
It changes chunksize after reshape and stops the raid. Then starts
the raid again.

Signed-off-by: Xiao Ni <xni@redhat.com>
Suggested-by: Jes Sorensen <jes.sorensen@gmail.com>
Suggested-by: Zhilong Liu <zlliu@suse.com>
Suggested-by: Paul Menzel <pmenzel@molgen.mpg.de>
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
test
tests/02r5grow

diff --git a/test b/test
index 25268a0f76b38a6554df244f13e5ac665ae96362..e74bbe5756fa2687755eb4934ca1fd980524ce8d 100755 (executable)
--- a/test
+++ b/test
@@ -320,6 +320,13 @@ check() {
                grep -sq "inactive" /proc/mdstat ||
                        die "array is not inactive!"
                ;;
+       # It only can be used when there is only one raid
+       chunk )
+               chunk_size=`awk -F',' '/chunk/{print $2}' /proc/mdstat | awk -F'[a-z]' '{print $1}'`
+               if [ "$chunk_size" -ne "$2" ] ; then
+                       die "chunksize should be $2, but it's $chunk_size"
+               fi
+               ;;
        * )
                die "unknown check $1"
                ;;
index 386e82ee9b9e3f8cf0465f5466fd34578cfc2dd3..bb9bd6da3702ffa425a9ccba583c552509e52a63 100644 (file)
@@ -34,3 +34,20 @@ check nosync
 sh tests/testdev $md0 3 $[size/2] 128
 
 mdadm -S $md0
+
+# create a raid5 array and change the chunk
+mdadm -CR $md0 --level raid5 --metadata=1.1 --chunk=32 --raid-disks 3 --size $[size/2] $dev1 $dev2 $dev3
+check wait
+check state UUU
+check chunk 32
+
+mdadm $md0 --grow --chunk=64
+check reshape
+check wait
+check chunk 64
+
+mdadm -S $md0
+mdadm -A $md0 $dev1 $dev2 $dev3
+check state UUU
+check chunk 64
+mdadm -S $md0