diff options
author | Krzysztof Wojcik <krzysztof.wojcik@intel.com> | 2010-12-26 11:59:14 +0100 |
---|---|---|
committer | NeilBrown <neilb@suse.de> | 2010-12-26 11:59:14 +0100 |
commit | 4f8a3e5baf77a3951b42d9522d75f0e7915912ec (patch) | |
tree | 9a3fe057807fc40cd25dc6d6cd0d30b3683064a7 /tests/imsm-grow-template | |
parent | FIX: Bad block verification during assembling array (diff) | |
download | mdadm-4f8a3e5baf77a3951b42d9522d75f0e7915912ec.tar.xz mdadm-4f8a3e5baf77a3951b42d9522d75f0e7915912ec.zip |
Enable tests for OLCE, takeover, migrations for imsm metadata
Patch provides set of tests for On-line Capacity Expansion,
takeover, migrations operations for imsm metadata type.
Tests are grouped by operation type:
12 - On-line Capacity Expansion on one volume
13 - On-line Capacity Expansion on two volumes
14 - Negative tests for takeover, migrations
15 - Chunk size migrations
16 - raid0 -> raid5, raid5 -> raid0 migrations
18 - takeover operations
To run particular test group, following command should be executed:
(from mdadm's source code root directory)
./test <group number>
Example:
To run On-line Capacity Expansion on one volume tests:
./test 12
Tests execution results:
- In case of test pass, "succeeded" word is printed on console
- If test is failed, "FAILED" word is printed on console
and logs are stored in <mdadm-root-dir>/tests/log/ directory
Signed-off-by: Artur Wojcik <artur.wojcik@intel.com>
Signed-off-by: Krzysztof Wojcik <krzysztof.wojcik@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'tests/imsm-grow-template')
-rw-r--r-- | tests/imsm-grow-template | 104 |
1 files changed, 104 insertions, 0 deletions
diff --git a/tests/imsm-grow-template b/tests/imsm-grow-template new file mode 100644 index 00000000..0944d091 --- /dev/null +++ b/tests/imsm-grow-template @@ -0,0 +1,104 @@ + +# 0 - POSITIVE test, otherwise NEGATIVE test +negative_test=$1 + +# 0 - On-line Capacity Expansion test, otherwise LEVEL migration or CHUNK size migration test +migration_test=$2 + +# 1 - raid0 -> raid10 takeover verification +takeover10_test=$3 + +function grow_member() { + local member=$1 + local disks=$2 + local comps=$3 + local level=$4 + local size=$5 + local offset=$6 + local chunk=$7 + local array_size=$((comps * size)) + + ( set -ex; mdadm --grow $member --chunk=$chunk --level=$level --backup-file=/tmp/backup_imsm ) + local status=$? + if [ $negative_test -ne 0 ]; then + if [ $status -eq 0 ]; then + echo >&2 "**Error**: $member: --grow should failed, but it completed successfuly" + exit 1 + fi + return + fi + check wait + sleep 5 + imsm_check member $member $disks $level $size $array_size $offset $chunk $takeover10_test + testdev $member $comps $size $chunk $takeover10_test +} + +# Create container +mdadm --create --run $container --auto=md --metadata=imsm --raid-disks=$num_disks $device_list +wait +imsm_check container $num_disks + +# Create first volume inside the container +mdadm --create --run $member0 --auto=md --level=$vol0_level --size=$vol0_comp_size --chunk=$vol0_chunk --raid-disks=$num_disks $device_list +wait + +# Create second volume inside the container (if defined) +if [ ! -z $vol1_chunk ]; then + mdadm --create --run $member1 --auto=md --level=$vol1_level --size=$vol1_comp_size --chunk=$vol1_chunk --raid-disks=$num_disks $device_list + wait +fi + +# Wait for any RESYNC to complete +check wait + +# Test first volume +imsm_check member $member0 $num_disks $vol0_level $vol0_comp_size $((vol0_comp_size * vol0_num_comps)) $vol0_offset $vol0_chunk +testdev $member0 $vol0_num_comps $vol0_comp_size $vol0_chunk + +# Test second volume (if defined) +if [ ! -z $vol1_chunk ]; then + imsm_check member $member1 $num_disks $vol1_level $vol1_comp_size $((vol1_comp_size * vol1_num_comps)) $vol1_offset $vol1_chunk + testdev $member1 $vol1_num_comps $vol1_comp_size $vol1_chunk +fi + +# Add extra disks to container if operation requires spares in container. +for i in $spare_list +do + mdadm --add $container $i + wait + num_disks=$((num_disks + 1)) +done + +imsm_check container $num_disks +num_disks=$((num_disks + add_to_num_disks)) + +# Grow each member or a container depending on the type of an operation +if [ $migration_test -ne 0 ]; then + if [ -z $new_num_disks ]; then + new_num_disks=$num_disks + fi + grow_member $member0 $new_num_disks $vol0_new_num_comps $vol0_new_level $vol0_comp_size $vol0_offset $vol0_new_chunk + if [ $vol1_new_chunk -ne 0 ]; then + grow_member $member1 $new_num_disks $vol1_new_num_comps $vol1_new_level $vol1_comp_size $vol1_offset $vol1_new_chunk + fi +else + ( set -x; mdadm --grow $container --raid-disks=$num_disks --backup-file=/tmp/backup_imsm ) + grow_status=$? + if [ $negative_test -ne 0 ]; then + if [ $grow_status -eq 0 ]; then + echo >&2 "**Error**: $container: --grow should failed, but it completed successfuly" + exit 1 + fi + else + check wait + sleep 5 + imsm_check member $member0 $num_disks $vol0_level $vol0_comp_size $((vol0_comp_size * vol0_new_num_comps)) $vol0_offset $vol0_chunk + testdev $member0 $vol0_new_num_comps $vol0_comp_size $vol0_chunk + if [ $vol1_new_num_comps -ne 0 ]; then + imsm_check member $member1 $num_disks $vol1_level $vol1_comp_size $((vol1_comp_size * vol1_new_num_comps)) $vol1_offset $vol1_chunk + testdev $member1 $vol1_new_num_comps $vol1_comp_size $vol1_chunk + fi + fi +fi + +exit 0 |