diff options
author | NeilBrown <neilb@suse.de> | 2009-10-16 08:50:07 +0200 |
---|---|---|
committer | NeilBrown <neilb@suse.de> | 2009-10-16 08:50:07 +0200 |
commit | ba6241244b010bcd1c47940357ee3a369b0dcac4 (patch) | |
tree | 88da23047abc211093c3d52665ca5d5c81004d0c /tests | |
parent | restripe: fix assignment of raid6 blocks for syndrome calculation. (diff) | |
download | mdadm-ba6241244b010bcd1c47940357ee3a369b0dcac4.tar.xz mdadm-ba6241244b010bcd1c47940357ee3a369b0dcac4.zip |
Test different r5/r6 layouts.
Make sure kernel and restripe agree on all different layouts.
Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/01raid6integ | 4 | ||||
-rw-r--r-- | tests/07changelevelintr | 60 | ||||
-rw-r--r-- | tests/07layouts | 91 | ||||
-rw-r--r-- | tests/07reshape5intr | 2 |
4 files changed, 154 insertions, 3 deletions
diff --git a/tests/01raid6integ b/tests/01raid6integ index ed7cec57..245b0da9 100644 --- a/tests/01raid6integ +++ b/tests/01raid6integ @@ -7,10 +7,10 @@ layouts='ls rs la ra' lv=`uname -r` if expr $lv '>=' 2.6.30 > /dev/null then - layouts="$layouts parity-first dd-zero-restart ddf-N-restart ddf-N-continue \ + layouts="$layouts parity-first ddf-zero-restart ddf-N-restart ddf-N-continue \ left-asymmetric-6 right-asymmetric-6 left-symmetric-6 right-symmetric-6 parity-first-6" fi -echo $layouts + for layout in $layouts do mdadm -CR $md0 -l6 --layout $layout -n5 $dev0 $dev1 $dev2 $dev3 $dev4 diff --git a/tests/07changelevelintr b/tests/07changelevelintr new file mode 100644 index 00000000..d3faf2eb --- /dev/null +++ b/tests/07changelevelintr @@ -0,0 +1,60 @@ + +# +# test that we can stop and restart a level change. +# just test a few in-place changes, and a few +# size-reducing changes. + + +checkgeo() { + # check the geometry of an array + # level raid_disks chunk_size layout + dev=$1 + shift + sleep 0.5 + check wait + for attr in level raid_disks chunk_size layout + do + if [ $# -gt 0 ] ; then + val=$1 + shift + if [ " `cat /sys/block/$dev/md/$attr`" != " $val" ] + then echo "$attr doesn't match for $dev" + exit 1 + fi + fi + done +} + +restart() { + sleep 0.5 + check reshape + mdadm -S $md0 + mdadm -A $md0 $devs --backup-file=$bu + sleep 0.5 + check reshape +} + +bu=/tmp/md-backup +rm -f $bu +devs="$dev0 $dev1 $dev2 $dev3 $dev4" +mdadm -CR $md0 -l5 -n5 -c 256 $devs +checkgeo md0 raid5 5 $[256*1024] 2 + +mdadm -G $md0 -c 128 --backup-file=$bu +restart +checkgeo md0 raid5 5 $[128*1024] 2 + +mdadm -G $md0 --layout rs --backup-file=$bu +restart +checkgeo md0 raid5 5 $[128*1024] 3 + +mdadm -G $md0 --array-size 59136 +mdadm -G $md0 --raid-disks 4 -c 64 --backup-file=$bu +restart +checkgeo md0 raid5 4 $[64*1024] 3 + +devs="$dev0 $dev1 $dev2 $dev3" +mdadm -G $md0 --array-size 19712 +mdadm -G $md0 -n 2 -c 256 --backup-file=$bu +restart +checkgeo md0 raid5 2 $[256*1024] 3 diff --git a/tests/07layouts b/tests/07layouts new file mode 100644 index 00000000..c0c9ea01 --- /dev/null +++ b/tests/07layouts @@ -0,0 +1,91 @@ + +# check that kernel an restripe interpret all the different layouts +# the same +# This involves changing the layout to each different possibility +# while MDADM_GROW_VERIFY is set. + +testK=$[64*3*6] +dd if=/dev/urandom of=/tmp/RandFile bs=1024 count=$testK +export MDADM_GROW_VERITY=1 + + +dotest() { + sleep 0.5 + check wait + testdev $md0 $1 $mdsize0 64 nd + blockdev --flushbufs $md0 + cmp -s -n $[textK*1024] $md0 /tmp/RandFile || { echo cmp failed; exit 2; } + # write something new - shift chars 4 space + tr ' -~' '$-~ -#' < /tmp/RandFile > /tmp/RandFile2 + mv /tmp/RandFile2 /tmp/RandFile + dd if=/tmp/RandFile of=$md0 +} + +checkgeo() { + # check the geometry of an array + # level raid_disks chunk_size layout + dev=$1 + shift + sleep 0.5 + check wait + for attr in level raid_disks chunk_size layout + do + if [ $# -gt 0 ] ; then + val=$1 + shift + if [ " `cat /sys/block/$dev/md/$attr`" != " $val" ] + then echo "$attr doesn't match for $dev" + exit 1 + fi + fi + done +} + + +bu=/tmp/md-test-backup +rm -f $bu + +# first a degraded 5 device raid5 +mdadm -CR $md0 -l5 -n5 $dev0 $dev1 missing $dev2 $dev3 +dd if=/tmp/RandFile of=$md0 +dotest 4 + +l5[0]=la +l5[1]=ra +l5[2]=ls +l5[3]=rs +l5[4]=parity-first +l5[5]=parity-last +for layout in 0 1 2 3 4 5 0 +do + mdadm -G $md0 --layout=${l5[$layout]} --backup-file $bu + checkgeo md0 raid5 5 $[64*1024] $layout + dotest 4 +done + +mdadm -S $md0 +# now a doubly degraded raid6 +mdadm -CR $md0 -l6 -n5 $dev0 missing $dev2 missing $dev4 +dd if=/tmp/RandFile of=$md0 +dotest 3 + +l6[0]=la +l6[1]=ra +l6[2]=ls +l6[3]=rs +l6[4]=parity-first +l6[5]=parity-last +l6[8]=ddf-zero-restart +l6[9]=ddf-N-restart +l6[10]=ddf-N-continue +l6[16]=left-asymmetric-6 +l6[17]=right-asymmetric-6 +l6[18]=left-symmetric-6 +l6[19]=right-symmetric-6 +l6[20]=parity-first-6 +for layout in 0 1 2 3 4 5 8 9 10 16 17 18 19 20 0 +do + mdadm -G $md0 --layout=${l6[$layout]} --backup-file $bu + checkgeo md0 raid6 5 $[64*1024] $layout + dotest 3 +done diff --git a/tests/07reshape5intr b/tests/07reshape5intr index 96c8e02e..b79d5489 100644 --- a/tests/07reshape5intr +++ b/tests/07reshape5intr @@ -1,6 +1,6 @@ # -# test interrupting and restartign raid5 reshape. +# test interrupting and restarting raid5 reshape. set -x devs="$dev1" st=UU |