Enable clustered raid testing in mdadm
cover Enable clustered raid testing in mdadm
Hi Jes,
Since cluster-md feature has delivered and also served for SUSE distributions in a long time, this patch-set mainly supports to test the clustered-raid1/10, and provide simple example cases, the rest cases would be a new patch-set once the cluster-raid frame ideas got accepted.
By now, mdadm has two suites to cover testing traditional soft-raid and cluster raid, the new option '--testdir' would support to switch choosing which suite to test, leave core functions in 'test' file and move other functions to its source file under tests/ and clustermd_tests/ folder.
Thanks,
Zhilong
Zhilong Liu (8):
mdadm/test: correct the logic operation in save_log mdadm/test: move some functions to new source file mdadm/test: enable clustermd testing under clustermd_tests/ mdadm/test: add '--testdir=' to switch choosing test suite mdadm/clustermd_tests: add test case to test creating cluster-raid1 mdadm/clustermd_tests: add test case to test grow_resize cluster-raid1 mdadm/clustermd_tests: add test case to test creating cluster-raid10 mdadm/clustermd_tests: add test case to test grow_resize
cluster-raid10
clustermd_tests/00r10_Create | 50 +++++ clustermd_tests/00r1_Create | 50 +++++ clustermd_tests/01r10_Grow_resize | 38 ++++ clustermd_tests/01r1_Grow_resize | 23 +++ clustermd_tests/cluster_conf | 43 +++++ clustermd_tests/func.sh | 320 ++++++++++++++++++++++++++++++++ test | 380 +++----------------------------------- tests/func.sh | 348 ++++++++++++++++++++++++++++++++++ 8 files changed, 901 insertions(+), 351 deletions(-) create mode 100644 clustermd_tests/00r10_Create create mode 100644 clustermd_tests/00r1_Create create mode 100644 clustermd_tests/01r10_Grow_resize create mode 100644 clustermd_tests/01r1_Grow_resize create mode 100644 clustermd_tests/cluster_conf create mode 100644 clustermd_tests/func.sh create mode 100644 tests/func.sh
Signature · 1 line
2.6.6
PATCH 1/8 mdadm/test: correct the logic operation in save_log
1. delete the mdadm -As, keep the original testing scene intact.
2. move some actions into 'array' test, 'mdadm -D $array' would complain errors if $array is null.
--- test | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)
test +4 -5
@@ -59,16 +59,11 @@ save_log() { cp $targetdir/log $logdir/$_basename.log echo "## $HOSTNAME: saving dmesg." >> $logdir/$logfile dmesg -c >> $logdir/$logfile - $mdadm -As 2> /dev/null echo "## $HOSTNAME: saving proc mdstat." >> $logdir/$logfile cat /proc/mdstat >> $logdir/$logfile array=($(mdadm -Ds | cut -d' ' -f2)) - echo "## $HOSTNAME: mdadm -D ${array[@]}" >> $logdir/$logfile - $mdadm -D ${array[@]} >> $logdir/$logfile [ "$1" == "fail" ] && echo "FAILED - see $logdir/$_basename.log and $logdir/$logfile for details" - # ignore saving external(external file, imsm...) bitmap - cat /proc/mdstat | grep -q "linear\|external" && return 0 if [ $DEVTYPE == 'lvm' ] then # not supported lvm type yet
@@ -77,6 +72,10 @@ save_log() { then if [ ! -z "$array" -a ${#array[@]} -ge 1 ] then + echo "## $HOSTNAME: mdadm -D ${array[@]}" >> $logdir/$logfile + $mdadm -D ${array[@]} >> $logdir/$logfile + # ignore saving external(external file, imsm...) bitmap + cat /proc/mdstat | grep -q "linear\|external" && return 0 md_disks=($($mdadm -D -Y ${array[@]} | grep "/dev/" | cut -d'=' -f2)) cat /proc/mdstat | grep -q "bitmap" if [ $? -eq 0 ]
Signature · 1 line
2.6.6
PATCH 2/8 mdadm/test: move some functions to new source file
In reply to Zhilong LiuTo make 'test' file concise, move some functions to new file tests/func.sh, and leave core functions in 'test' file.
--- test | 353 +--------------------------------------------------------- tests/func.sh | 348 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 352 insertions(+), 349 deletions(-) create mode 100644 tests/func.sh
test +4 -349
@@ -1,8 +1,10 @@ #!/bin/bash # # run test suite for mdadm -dir=$(pwd) -mdadm=$dir/mdadm + +. tests/func.sh + +mdadm=$PWD/mdadm testdir="tests" targetdir="/var/tmp" logdir="$targetdir"
@@ -27,184 +29,16 @@ md2=/dev/md2 mdp0=/dev/md_d0 mdp1=/dev/md_d1 -# We test mdadm on loop-back block devices. -# dir for storing files should be settable by command line maybe -size=20000 -# super0, round down to multiple of 64 and substract 64 -mdsize0=19904 -# super00 is nested, subtract 128 -mdsize00=19840 -# super1.0 round down to multiple of 2, subtract 8 -mdsize1=19992 -mdsize1a=19988 -mdsize12=19988 -# super1.2 for linear: round to multiple of 2, subtract 4 -mdsize1_l=19996 -mdsize2_l=19996 -# subtract another 4 for bitmaps -mdsize1b=19988 -mdsize11=19992 -mdsize11a=19456 -mdsize12=19988 - -# ddf needs bigger devices as 32Meg is reserved! -ddfsize=65536 - -# $1 is optional parameter, it shows why to save log -save_log() { - status=$1 - logfile="$status""$_basename".log - - cat $targetdir/stderr >> $targetdir/log - cp $targetdir/log $logdir/$_basename.log - echo "## $HOSTNAME: saving dmesg." >> $logdir/$logfile - dmesg -c >> $logdir/$logfile - echo "## $HOSTNAME: saving proc mdstat." >> $logdir/$logfile - cat /proc/mdstat >> $logdir/$logfile - array=($(mdadm -Ds | cut -d' ' -f2)) - [ "$1" == "fail" ] && - echo "FAILED - see $logdir/$_basename.log and $logdir/$logfile for details" - if [ $DEVTYPE == 'lvm' ] - then - # not supported lvm type yet - echo - elif [ "$DEVTYPE" == 'loop' -o "$DEVTYPE" == 'disk' ] - then - if [ ! -z "$array" -a ${#array[@]} -ge 1 ] - then - echo "## $HOSTNAME: mdadm -D ${array[@]}" >> $logdir/$logfile - $mdadm -D ${array[@]} >> $logdir/$logfile - # ignore saving external(external file, imsm...) bitmap - cat /proc/mdstat | grep -q "linear\|external" && return 0 - md_disks=($($mdadm -D -Y ${array[@]} | grep "/dev/" | cut -d'=' -f2)) - cat /proc/mdstat | grep -q "bitmap" - if [ $? -eq 0 ] - then - echo "## $HOSTNAME: mdadm -X ${md_disks[@]}" >> $logdir/$logfile - $mdadm -X ${md_disks[@]} >> $logdir/$logfile - fi - else - echo "## $HOSTNAME: no array assembled!" >> $logdir/$logfile - fi - fi -} - die() { echo -e "\n\tERROR: $* \n" save_log fail exit 2 } -cleanup() { - udevadm settle - $mdadm -Ssq 2> /dev/null - case $DEVTYPE in - loop ) - for d in 0 1 2 3 4 5 6 7 8 9 10 11 12 13 - do - losetup -d /dev/loop$d - rm -f /dev/disk/by-path/loop* - rm -f /var/tmp/mdtest$d - done - ;; - lvm ) - for d in 0 1 2 3 4 5 6 7 8 9 10 11 12 13 - do - eval "lvremove --quiet -f \$dev$d" - done - ;; - disk ) - $mdadm --zero ${disks[@]} &> /dev/null - ;; - esac -} - ctrl_c() { exitonerror=1 } -do_setup() { - trap cleanup 0 1 3 15 - trap ctrl_c 2 - - [ -d $logdir ] || mkdir -p $logdir - dmesg -c > /dev/null - - devlist= - if [ "$DEVTYPE" == "loop" ] - then - # make sure there are no loop devices remaining. - # udev started things can sometimes prevent them being stopped - # immediately - while grep loop /proc/partitions > /dev/null 2>&1 - do - $mdadm -Ssq - losetup -d /dev/loop[0-9]* 2> /dev/null - sleep 0.2 - done - elif [ "$DEVTYPE" == "disk" ] - then - if [ ! -z "$disks" ] - then - for d in $(seq 0 ${#disks[@]}) - do - eval "dev$d=${disks[$d]}" - eval devlist=\"\$devlist \$dev$d\" - eval devlist$d=\"\$devlist\" - done - $mdadm --zero ${disks[@]} &> /dev/null - else - echo "Forget to provide physical devices for disk mode." - exit 1 - fi - fi - for d in 0 1 2 3 4 5 6 7 8 9 10 11 12 13 - do - sz=$size - [ $d -gt 7 ] && sz=$ddfsize - case $DEVTYPE in - loop) - [ -f $targetdir/mdtest$d ] || - dd if=/dev/zero of=$targetdir/mdtest$d count=$sz bs=1K > /dev/null 2>&1 - # make sure udev doesn't touch - mdadm --zero $targetdir/mdtest$d 2> /dev/null - [ -b /dev/loop$d ] || mknod /dev/loop$d b 7 $d - if [ $d -eq 7 ] - then - losetup /dev/loop$d $targetdir/mdtest6 # for multipath use - else - losetup /dev/loop$d $targetdir/mdtest$d - fi - eval dev$d=/dev/loop$d - eval file$d=$targetdir/mdtest$d - ;; - lvm) - unset MULTIPATH - eval dev$d=/dev/mapper/${LVM_VOLGROUP}-mdtest$d - if ! lvcreate --quiet -L ${sz}K -n mdtest$d $LVM_VOLGROUP - then - trap '' 0 # make sure lvremove is not called - eval echo error creating \$dev$d - exit 129 - fi - ;; - ram) - unset MULTIPATH - eval dev$d=/dev/ram$d - ;; - esac - eval devlist=\"\$devlist \$dev$d\" - eval devlist$d=\"\$devlist\" - #" <-- add this quote to un-confuse vim syntax highlighting - done - path0=$dev6 - path1=$dev7 - ulimit -c unlimited - [ -f /proc/mdstat ] || modprobe md_mod - echo 2000 > /proc/sys/dev/raid/speed_limit_max - echo 0 > /sys/module/md_mod/parameters/start_ro -} - # mdadm always adds --quiet, and we want to see any unexpected messages mdadm() { rm -f $targetdir/stderr
@@ -244,137 +78,6 @@ mdadm() { return $rv } -# check various things -check() { - case $1 in - spares ) - spares=$(tr '] ' '\012\012' < /proc/mdstat | grep -c '(S)' || exit 0) - [ $spares -ne $2 ] && - die "expected $2 spares, found $spares" - ;; - raid* | linear ) - grep -sq "active $1 " /proc/mdstat || - die "active $1 not found" - ;; - algorithm ) - grep -sq " algorithm $2 " /proc/mdstat || - die "algorithm $2 not found" - ;; - resync | recovery | reshape ) - cnt=5 - while ! grep -sq $1 /proc/mdstat - do - if [ $cnt -gt 0 ] && grep -v idle /sys/block/md*/md/sync_action > /dev/null - then # Something isn't idle - wait a bit - sleep 0.5 - cnt=$[cnt-1] - else - die "no $1 happening" - fi - done - ;; - nosync ) - sleep 0.5 - # Since 4.2 we delay the close of recovery until there has been a chance for - # spares to be activated. That means that a recovery that finds nothing - # to do can still take a little longer than expected. - # add an extra check: is sync_completed shows the end is reached, assume - # there is no recovery. - if grep -sq -E '(resync|recovery|reshape) *=' /proc/mdstat - then - incomplete=`grep / /sys/block/md*/md/sync_completed 2> /dev/null | sed '/^ *\([0-9]*\) \/ \1/d'` - [ -n "$incomplete" ] && - die "resync or recovery is happening!" - fi - ;; - wait ) - p=`cat /proc/sys/dev/raid/speed_limit_max` - echo 2000000 > /proc/sys/dev/raid/speed_limit_max - sleep 0.1 - while grep -Eq '(resync|recovery|reshape|check|repair) *=' /proc/mdstat || - grep -v idle > /dev/null /sys/block/md*/md/sync_action - do - sleep 0.5 - done - echo $p > /proc/sys/dev/raid/speed_limit_max - ;; - state ) - grep -sq "blocks.*\[$2\]\$" /proc/mdstat || - die "state $2 not found!" - sleep 0.5 - ;; - bitmap ) - grep -sq bitmap /proc/mdstat || - die "no bitmap" - ;; - nobitmap ) - grep -sq "bitmap" /proc/mdstat && - die "bitmap present" - ;; - readonly ) - grep -sq "read-only" /proc/mdstat || - die "array is not read-only!" - ;; - inactive ) - 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" - ;; - esac -} - -no_errors() { - if [ -s $targetdir/stderr ] - then - echo Bad errors from mdadm: - cat $targetdir/stderr - exit 2 - fi -} - -# basic device test -testdev() { - [ -b $1 ] || die "$1 isn't a block device." - [ "$DEVTYPE" == "disk" ] && return 0 - udevadm settle - dev=$1 - cnt=$2 - dvsize=$3 - chunk=$4 - if [ -z "$5" ] - then - mkfs.ext3 -F -j $dev > /dev/null 2>&1 && fsck -fn $dev >&2 - fi - dsize=$[dvsize/chunk] - dsize=$[dsize*chunk] - rasize=$[dsize*2*cnt] - # rasize is in sectors - if [ -n "$DEV_ROUND_K" ] - then - rasize=$[rasize/DEV_ROUND_K/2] - rasize=$[rasize*DEV_ROUND_K*2] - fi - [ `/sbin/blockdev --getsize $dev` -eq 0 ] && sleep 2 - _sz=`/sbin/blockdev --getsize $dev` - [ $rasize -lt $_sz -o $[rasize*4/5] -gt $_sz ] && - die "size is wrong for $dev: $cnt * $dvsize (chunk=$chunk) = $rasize, not $_sz" - return 0 -} - -rotest() { - dev=$1 - fsck -fn $dev >&2 -} - do_test() { _script=$1 _basename=`basename $_script`
@@ -532,55 +235,7 @@ parse_args() { done } -check_env() { - user=$(id -un) - [ "X$user" != "Xroot" ] && { - echo "test: testing can only be done as 'root'." - exit 1 - } - [ -x "raid6check" -a -x $mdadm ] || { - echo "test: please run 'make everything' before perform testing." - exit 1 - } - cmds=(mdadm lsblk df udevadm losetup mkfs.ext3 fsck seq) - for cmd in ${cmds[@]} - do - which $cmd > /dev/null || { - echo "$cmd command not found!" - exit 1 - } - done - mdadm_src_ver="$($mdadm -V 2>&1)" - mdadm_sbin_ver="$($(which mdadm) -V 2>&1)" - if [ "$mdadm_src_ver" != "$mdadm_sbin_ver" ] - then - # it's nessesary to 'make install' mdadm to /SBIN/DIR, - # such as systemd/[email protected], would - # run as an instance by systemd when reshape happens, - # thus ensure that the correct mdadm is in testing. - echo "test: please run 'make install' before testing." - exit 1 - fi - if ! $(df -T . | grep -iq ext) - then - # 'external file' bitmap only supports with ext[2-4] file system - echo "test: please run test suite with ext[2-4] file system." - exit 1 - fi - if $(lsblk -a | grep -iq raid) - then - # donot run mdadm -Ss directly if there are RAIDs working. - echo "test: please run test suite without running RAIDs environment." - exit 1 - fi - # Check whether to run multipath tests - modprobe multipath 2> /dev/null - grep -sq 'Personalities : .*multipath' /proc/mdstat && - MULTIPATH="yes" -} - main() { - check_env do_setup echo "Testing on linux-$(uname -r) kernel"
tests/func.sh new file +348 -0
348 lines not on this page · raw message
Signature · 1 line
2.6.6
PATCH 3/8 mdadm/test: enable clustermd testing under clustermd_tests/
In reply to Zhilong LiuFor clustermd testing, it needs user deploys the basic cluster manually, test scripts don't cover auto-deploy cluster due to different linux distributions have lots of difference. Then complete the configuration in cluster_conf, please refer to the detail comments in 'cluster_conf'.
1. 'func.sh' source file, it achieves feature functions for clustermd testing.
2. 'cluster_conf' configure file, it contains two parts as the input of testing.
--- clustermd_tests/cluster_conf | 43 ++++++ clustermd_tests/func.sh | 322 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 365 insertions(+) create mode 100644 clustermd_tests/cluster_conf create mode 100644 clustermd_tests/func.sh
clustermd_tests/cluster_conf new file +43 -0
@@ -0,0 +1,43 @@ +# Prerequisite: +# 1. The clustermd_tests/ cases only support to test 2-node-cluster, cluster +# requires packages: 'pacemaker+corosync+sbd+crmsh', all packages link at +# "https://github.com/ClusterLabs/", and also requires dlm resource running +# on each node of cluster. +# For quick start HA-cluster with SUSE distributions, refer to the chapter 6-8: +# https://www.suse.com/documentation/sle-ha-12/install-quick/data/install-quick.html +# For Redhat distributions, please refer to: +# https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html-single/high_availability_add-on_administration/index +# 2. Setup ssh-access with no-authorized mode, it should be: +# # 'ssh $node1 -l root ls' and 'ssh $node2 -l root ls' success on any node. +# 3. Fill-up node-ip part and disks part as following. + +# Set node1 as the master node, the cluster-md cases should run on this node, +# and node2 is the slave node. +# For example: +# NODE1=192.168.1.100 (testing run here) +# NODE2=192.168.1.101 +NODE1= +NODE2= + +# Provide the devlist for clustermd-testing, alternative: if set the step 1, +# don't set step 2, and vice versa. +# 1. Use ISCSI service to provide shared storage, then login ISCSI target via +# to ISCSI_TARGET_ID and ISCSI_TARGET_IP on iscsi clients, commands like: +# Execute on iscsi clients: +# 1) discover the iscsi server. +# # iscsiadm -m discovery -t st -p $ISCSI_TARGET_IP +# 2) login and establish connection. +# # iscsiadm -m node -T $ISCSI_TARGET_ID -p $ISCSI_TARGET_IP -l +# Note: +# On ISCSI server, must create all iscsi-luns in one target_id, recommend more +# than 6 luns/disks for testing, and each disk should be: 100M < disk < 800M. +# 2. If all cluster-nodes mounted the same disks directly, and the devname are +# the same on all nodes, then put them to 'devlist'. + +# For example: (Only set $ISCSI_TARGET_ID is enough if iscsi has already connected) +# ISCSI_TARGET_ID=iqn.2018-01.example.com:clustermd-testing +# ISCSI_TARGET_IP=192.168.1.102 +ISCSI_TARGET_ID= + +#devlist=/dev/sda /dev/sdb /dev/sdc /dev/sdd +devlist=
clustermd_tests/func.sh new file +322 -0
322 lines not on this page · raw message
Signature · 1 line
2.6.6
PATCH 4/8 mdadm/test: add '--testdir=' to switch choosing test suite
In reply to Zhilong LiuBy now, mdadm has two test suites to cover traditional sofr-raid testing and clustermd testing, the '--testdir=' option supports to switch which suite to test, tests/ or clustermd_tests/.
--- clustermd_tests/func.sh | 2 -- test | 32 ++++++++++++++++++++++++++++---- 2 files changed, 28 insertions(+), 6 deletions(-)
clustermd_tests/func.sh +0 -2
@@ -1,7 +1,5 @@ #!/bin/bash -CLUSTER_CONF=$PWD/cluster_conf - check_ssh() { NODE1="$(grep '^NODE1' $CLUSTER_CONF | cut -d'=' -f2)"
test +28 -4
@@ -1,14 +1,12 @@ #!/bin/bash # # run test suite for mdadm - -. tests/func.sh - mdadm=$PWD/mdadm -testdir="tests" targetdir="/var/tmp" logdir="$targetdir" config=/tmp/mdadm.conf +testdir= +devlist= savelogs=0 exitonerror=1
@@ -114,6 +112,7 @@ do_help() { Example for disk mode: ./test --dev=disk --disks=/dev/sda{2..15} Options: --tests=test1,test2,... Comma separated list of tests to run + --testdir= Specify testdir as tests|clustermd_tests --raidtype= raid0|linear|raid1|raid456|raid10|ddf|imsm --disable-multipath Disable any tests involving multipath --disable-integrity Disable slow tests of RAID[56] consistency
@@ -134,6 +133,29 @@ parse_args() { for i in $* do case $i in + --testdir=* ) + case ${i##*=} in + tests ) + testdir=tests + ;; + clustermd_tests ) + testdir=clustermd_tests + CLUSTER_CONF="$PWD/$testdir/cluster_conf" + ;; + * ) + echo "Unknown argument: $i" + do_help + exit 1 + ;; + esac + ;; + esac + done + [ -z "$testdir" ] && testdir=tests + . $testdir/func.sh + for i in $* + do + case $i in [0-9][0-9] ) prefix=$i ;;
@@ -147,6 +169,8 @@ parse_args() { cleanup exit 0 ;; + --testdir=* ) + ;; --tests=* ) TESTLIST=($(echo ${i##*=} | sed -e 's/,/ /g')) ;;
Signature · 1 line
2.6.6
PATCH 5/8 mdadm/clustermd_tests: add test case to test creating cluster-raid1
In reply to Zhilong Liu00r1_Create: It contains 4 scenarios of creating clustered raid1.
1. General creating, master node does resync and slave node does Pending.
2. Creating clustered raid1 with --assume-clean parameter.
3. Creating clustered raid1 with spare disk.
4. Creating clustered raid1 with --name.
--- clustermd_tests/00r1_Create | 50 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 clustermd_tests/00r1_Create
clustermd_tests/00r1_Create new file +50 -0
@@ -0,0 +1,50 @@ +#!/bin/bash + +mdadm -CR $md0 -l1 -b clustered -n2 $dev0 $dev1 +ssh $NODE2 mdadm -A $md0 $dev0 $dev1 +check $NODE1 resync +check $NODE2 PENDING +check all wait +check all raid1 +check all bitmap +check all nosync +check all state UU +check all dmesg +stop_md all $md0 + +mdadm -CR $md0 -l1 -b clustered -n2 $dev0 $dev1 --assume-clean +ssh $NODE2 mdadm -A $md0 $dev0 $dev1 +check all nosync +check all raid1 +check all bitmap +check all state UU +check all dmesg +stop_md all $md0 + +mdadm -CR $md0 -l1 -b clustered -n2 -x1 $dev0 $dev1 $dev2 --assume-clean +ssh $NODE2 mdadm -A $md0 $dev0 $dev1 $dev2 +check all nosync +check all raid1 +check all bitmap +check all spares 1 +check all state UU +check all dmesg +stop_md all $md0 + +name=tstmd +mdadm -CR $md0 -l1 -b clustered -n2 $dev0 $dev1 --name=$name --assume-clean +ssh $NODE2 mdadm -A $md0 $dev0 $dev1 +check all nosync +check all raid1 +check all bitmap +check all state UU +for ip in $NODE1 $NODE2 +do + ssh $ip "mdadm -D $md0 | grep 'Name' | grep -q $name" + [ $? -ne '0' ] && + die "$ip: check --name=$name failed." +done +check all dmesg +stop_md all $md0 + +exit 0
Signature · 1 line
2.6.6
PATCH 6/8 mdadm/clustermd_tests: add test case to test grow_resize cluster-raid1
In reply to Zhilong Liu01r1_Grow_resize: Create clustered raid1 with smaller size, then resize the mddev to max size, finally change back to smaller size.
--- clustermd_tests/01r1_Grow_resize | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 clustermd_tests/01r1_Grow_resize
clustermd_tests/01r1_Grow_resize new file +23 -0
@@ -0,0 +1,23 @@ +#!/bin/bash + +size=10000 + +mdadm -CR $md0 -l1 -b clustered --size $size -n2 $dev0 $dev1 --assume-clean +ssh $NODE2 mdadm -A $md0 $dev0 $dev1 +check all nosync +check all raid1 +check all bitmap +check all state UU + +mdadm --grow $md0 --size max +check $NODE1 resync +check $NODE1 wait +check all state UU + +mdadm --grow $md0 --size $size +check all nosync +check all state UU +check all dmesg +stop_md all $md0 + +exit 0
Signature · 1 line
2.6.6
PATCH 7/8 mdadm/clustermd_tests: add test case to test creating cluster-raid10
In reply to Zhilong Liu00r10_Create: It contains 4 scenarios of creating clustered raid10.
1. General creating, master node does resync and slave node does Pending.
2. Creating clustered raid10 with --assume-clean.
3. Creating clustered raid10 with spare disk.
4. Creating clustered raid10 with --name.
--- clustermd_tests/00r10_Create | 50 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 clustermd_tests/00r10_Create
clustermd_tests/00r10_Create new file +50 -0
@@ -0,0 +1,50 @@ +#!/bin/bash + +mdadm -CR $md0 -l10 -b clustered --layout n2 -n2 $dev0 $dev1 +ssh $NODE2 mdadm -A $md0 $dev0 $dev1 +check $NODE1 resync +check $NODE2 PENDING +check all wait +check all raid10 +check all bitmap +check all nosync +check all state UU +check all dmesg +stop_md all $md0 + +mdadm -CR $md0 -l10 -b clustered -n3 --layout n3 $dev0 $dev1 $dev2 --assume-clean +ssh $NODE2 mdadm -A $md0 $dev0 $dev1 $dev2 +check all nosync +check all raid10 +check all bitmap +check all state UUU +check all dmesg +stop_md all $md0 + +mdadm -CR $md0 -l10 -b clustered -n2 -x1 --layout n2 $dev0 $dev1 $dev2 --assume-clean +ssh $NODE2 mdadm -A $md0 $dev0 $dev1 $dev2 +check all nosync +check all raid10 +check all bitmap +check all spares 1 +check all state UU +check all dmesg +stop_md all $md0 + +name=tstmd +mdadm -CR $md0 -l10 -b clustered -n2 $dev0 $dev1 --layout n2 --name=$name --assume-clean +ssh $NODE2 mdadm -A $md0 $dev0 $dev1 +check all nosync +check all raid10 +check all bitmap +check all state UU +for ip in $NODE1 $NODE2 +do + ssh $ip "mdadm -D $md0 | grep 'Name' | grep -q $name" + [ $? -ne '0' ] && + die "$ip: check --name=$name failed." +done +check all dmesg +stop_md all $md0 + +exit 0
Signature · 1 line
2.6.6
PATCH 8/8 mdadm/clustermd_tests: add test case to test grow_resize cluster-raid10
In reply to Zhilong Liu01r10_Grow_resize:
1. Create clustered raid10 with smaller size, then resize the mddev to max size, finally change back to smaller size.
2. Create clustered raid10 with smaller chunk-size, then resize it to larger, and trigger reshape.
--- clustermd_tests/01r10_Grow_resize | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 clustermd_tests/01r10_Grow_resize
clustermd_tests/01r10_Grow_resize new file +38 -0
@@ -0,0 +1,38 @@ +#!/bin/bash + +size=20000 + +mdadm -CR $md0 -l10 -b clustered --layout n2 --size $size --chunk=64 -n2 $dev0 $dev1 --assume-clean +ssh $NODE2 mdadm -A $md0 $dev0 $dev1 +check all nosync +check all raid10 +check all bitmap +check all state UU + +mdadm --grow $md0 --size max +check $NODE1 resync +check $NODE1 wait +check all state UU + +mdadm --grow $md0 --size $size +check all nosync +check all state UU +check all dmesg +stop_md all $md0 + +mdadm -CR $md0 -l10 -b clustered --layout n2 --chunk=64 -n2 $dev0 $dev1 --assume-clean +ssh $NODE2 mdadm -A $md0 $dev0 $dev1 +check all nosync +check all raid10 +check all bitmap +check all state UU + +mdadm --grow $md0 --chunk=128 +check $NODE1 reshape +check $NODE1 wait +check all chunk 128 +check all state UU +check all dmesg +stop_md all $md0 + +exit 0
Signature · 1 line
2.6.6
Jes Sorensen
AppliedQuoted 11 lines · Zhilong Liu
Hi Jes,
Since cluster-md feature has delivered and also served for SUSE distributions in a long time, this patch-set mainly supports to test the clustered-raid1/10, and provide simple example cases, the rest cases would be a new patch-set once the cluster-raid frame ideas got accepted.
By now, mdadm has two suites to cover testing traditional soft-raid and cluster raid, the new option '--testdir' would support to switch choosing which suite to test, leave core functions in 'test' file and move other functions to its source file under tests/ and clustermd_tests/ folder.
Applied!
Thanks,
Jes