1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-02-24 17:57:48 +03:00

tests: split raid test

Use separate files for raid1, raid456, raid10.
They need different target versions to work, so support
more precise test selection.

Optimize duplicate tests of target avalability and skip
unsupported test cases sooner.
This commit is contained in:
Zdenek Kabelac 2014-03-03 11:20:40 +01:00
parent a92fae079b
commit 52007a9191
3 changed files with 62 additions and 39 deletions

View File

@ -11,8 +11,6 @@
. lib/test
THIN_POSTFIX=""
# Writemostly has been in every version since the begining
# Device refresh in 1.5.1 upstream and 1.3.4 < x < 1.4.0 in RHEL6
# Sync action in 1.5.0 upstream and 1.3.3 < x < 1.4.0 in RHEL6
@ -252,7 +250,7 @@ run_recovery_rate_check() {
local vg=$1
local lv=${2}${THIN_POSTFIX}
printf "#\n#\n#\n# %s/%s %s: run_recovery_rate_check\n#\n#\n#\n" \
printf "#\n#\n#\n# %s/%s (%s): run_recovery_rate_check\n#\n#\n#\n" \
$vg $lv $(get lv_field $vg/$lv segtype -a)
lvchange --minrecoveryrate 50 $vg/$lv
lvchange --maxrecoveryrate 100 $vg/$lv
@ -276,13 +274,6 @@ run_checks() {
run_refresh_check $1 $2
run_recovery_rate_check $1 $2
elif [ 'thinpool_data' == $3 ]; then
aux have_thin 1 8 0 || return 0
# RAID works EX in cluster
# thinpool works EX in cluster
# but they don't work together in a cluster yet
# (nor does thinpool+mirror work in a cluster yet)
test -e LOCAL_CLVMD && return 0
printf "#\n#\n# run_checks: RAID as thinpool data\n#\n#\n"
# Hey, specifying devices for thin allocation doesn't work
@ -297,8 +288,6 @@ run_checks() {
run_refresh_check $1 $2
run_recovery_rate_check $1 $2
elif [ 'thinpool_meta' == $3 ]; then
aux have_thin 1 8 0 || return 0
test -e LOCAL_CLVMD && return 0
printf "#\n#\n# run_checks: RAID as thinpool metadata\n#\n#\n"
lvrename $1/$2 ${2}_meta
@ -327,35 +316,27 @@ run_checks() {
fi
}
run_types() {
for i in $TEST_TYPES ; do
lvcreate -n $lv1 $vg -L2M --type "$@"
run_checks $vg $lv1 $i
lvremove -ff $vg
done
}
########################################################
# MAIN
########################################################
for i in "-" "snapshot" "thinpool_data" "thinpool_meta"; do
lvcreate --type raid1 -m 1 -L 2M -n $lv1 $vg \
"$dev1" "$dev2"
run_checks $vg $lv1 $i
lvremove -ff $vg
TEST_TYPES="- snapshot"
# RAID works EX in cluster
# thinpool works EX in cluster
# but they don't work together in a cluster yet
# (nor does thinpool+mirror work in a cluster yet)
test ! -e LOCAL_CLVMD -a aux have_thin 1 8 0 && TEST_TYPE="$TEST_TYPES thinpool_data thinpool_meta"
lvcreate --type raid4 -i 2 -L 2M -n $lv1 $vg \
"$dev1" "$dev2" "$dev3" "$dev4"
run_checks $vg $lv1 $i
lvremove -ff $vg
lvcreate --type raid5 -i 2 -L 2M -n $lv1 $vg \
"$dev1" "$dev2" "$dev3" "$dev4"
run_checks $vg $lv1 $i
lvremove -ff $vg
lvcreate --type raid6 -i 3 -L 2M -n $lv1 $vg \
"$dev1" "$dev2" "$dev3" "$dev4" "$dev5"
run_checks $vg $lv1 $i
lvremove -ff $vg
lvcreate --type raid10 -m 1 -i 2 -L 2M -n $lv1 $vg \
"$dev1" "$dev2" "$dev3" "$dev4"
run_checks $vg $lv1 $i
lvremove -ff $vg
done
vgremove -ff $vg
# Implicit test for 'raid1' only
if test "${TEST_RAID:-raid1}" = raid1 ; then
run_types raid1 -m 1 "$dev1" "$dev2"
vgremove -ff $vg
fi

View File

@ -0,0 +1,20 @@
#!/bin/sh
# Copyright (C) 2014 Red Hat, Inc. All rights reserved.
#
# This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions
# of the GNU General Public License v.2.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
TEST_RAID=raid10
. shell/lvchange-raid.sh
aux target_at_least dm-raid 1 5 2 || skip
run_types raid10 -m 1 -i 2 "$dev1" "$dev2" "$dev3" "$dev4"
vgremove -ff $vg

View File

@ -0,0 +1,22 @@
#!/bin/sh
# Copyright (C) 2014 Red Hat, Inc. All rights reserved.
#
# This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions
# of the GNU General Public License v.2.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
TEST_RAID=raid456
. shell/lvchange-raid.sh
aux target_at_least dm-raid 1 5 2 || skip
run_types raid4 -i 2 "$dev1" "$dev2" "$dev3" "$dev4"
run_types raid5 -i 2 "$dev1" "$dev2" "$dev3" "$dev4"
run_types raid6 -i 3 "$dev1" "$dev2" "$dev3" "$dev4" "$dev5"
vgremove -ff $vg