1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

tests: updates

Pass more args with some 'aux' commands:
wipefs_a, enable_dev, disable_dev
(so it's a bit more efficient using single udev_wait call).
Use prepare_vg instead of prepare_pvs.
This commit is contained in:
Zdenek Kabelac 2023-07-15 10:39:56 +02:00
parent 55b498b6b5
commit f6104adcb6
17 changed files with 47 additions and 135 deletions

View File

@ -33,13 +33,7 @@ _clear_online_files() {
}
wipe_all() {
aux wipefs_a "$dev1"
aux wipefs_a "$dev2"
aux wipefs_a "$dev3"
aux wipefs_a "$dev4"
aux wipefs_a "$dev5"
aux wipefs_a "$dev6"
aux wipefs_a "$dev7"
aux wipefs_a "$dev1" "$dev2" "$dev3" "$dev4" "$dev5" "$dev6" "$dev7"
}
# The tests run with system dir of "/etc" but lvm when running

View File

@ -583,10 +583,7 @@ wait_md_create() {
echo "$md" > WAIT_MD_DEV
}
aux wipefs_a "$dev1"
aux wipefs_a "$dev2"
aux wipefs_a "$dev3"
aux wipefs_a "$dev4"
aux wipefs_a "$dev1" "$dev2" "$dev3" "$dev4"
rm "$DF"
touch "$DF"

View File

@ -178,9 +178,7 @@ test ! -f "$RUNDIR/lvm/vgs_online/$vg"
#lvs -o active $vg |tee out || true
#not grep "active" out
aux wipefs_a "$dev1"
aux wipefs_a "$dev2"
aux udev_wait
aux wipefs_a "$dev1" "$dev2"
##########################################
# PV on an md raidX device
@ -242,9 +240,7 @@ aux enable_dev "$dev2"
lvmdevices --deldev $mddev || true
aux cleanup_md_dev
aux wipefs_a "$dev1"
aux wipefs_a "$dev2"
aux udev_wait
aux wipefs_a "$dev1" "$dev2"
if [ "$MD_LEVEL" = "1" ] ; then
##########################################
@ -303,10 +299,7 @@ pvscan --cache -aay "$dev4"
test ! -f "$RUNDIR/lvm/pvs_online/$PVIDMD"
test ! -f "$RUNDIR/lvm/vgs_online/$vg"
aux wipefs_a "$dev1"
aux wipefs_a "$dev2"
aux wipefs_a "$dev4"
aux udev_wait
aux wipefs_a "$dev1" "$dev2" "$dev4"
fi # MD_LEVEL == 1
# next loop with 'start'

View File

@ -116,8 +116,7 @@ vgremove -y -S vg_uuid=$UUID1
vgs --foreign -o+uuid |tee out
grep $UUID1 out
aux wipefs_a "$dev1"
aux wipefs_a "$dev2"
aux wipefs_a "$dev1" "$dev2"
# b. 0 local, 2 foreign
# setup
@ -163,9 +162,7 @@ not vgremove $vg1
vgs --foreign -o+uuid |tee out
grep $UUID1 out
aux wipefs_a "$dev1"
aux wipefs_a "$dev2"
aux wipefs_a "$dev3"
aux wipefs_a "$dev1" "$dev2" "$dev3"
# c. 1 local, 1 foreign
# setup
@ -221,9 +218,7 @@ not grep $UUID1 out
vgs --foreign -o+uuid |tee out
grep $UUID2 out
aux wipefs_a "$dev1"
aux wipefs_a "$dev2"
aux wipefs_a "$dev3"
aux wipefs_a "$dev1" "$dev2" "$dev3"
# d. 1 local, 2 foreign
# setup
@ -240,8 +235,7 @@ vgcreate $vg1 "$dev3"
lvcreate -n $lv1 -l1 -an $vg1
UUID3=$(vgs --noheading -o vg_uuid $vg1 | xargs)
vgchange -y --systemid "other2" $vg1
aux enable_dev "$dev1"
aux enable_dev "$dev2"
aux enable_dev "$dev1" "$dev2"
vgs -o+uuid |tee out
grep $vg1 out
@ -292,10 +286,7 @@ vgs --foreign -o+uuid |tee out
grep $UUID2 out
grep $UUID3 out
aux wipefs_a "$dev1"
aux wipefs_a "$dev2"
aux wipefs_a "$dev3"
aux wipefs_a "$dev4"
aux wipefs_a "$dev1" "$dev2" "$dev3" "$dev4"
# e. 2 local, 0 foreign
# setup
@ -354,9 +345,7 @@ vgs -o+uuid |tee out
not grep $UUID1 out
not grep $UUID2 out
aux wipefs_a "$dev1"
aux wipefs_a "$dev2"
aux wipefs_a "$dev3"
aux wipefs_a "$dev1" "$dev2" "$dev3"
# f. 2 local, 1 foreign
# setup
@ -373,8 +362,7 @@ vgcreate $vg1 "$dev3"
lvcreate -n $lv1 -l1 -an $vg1
UUID3=$(vgs --noheading -o vg_uuid $vg1 | xargs)
vgchange -y --systemid "other" $vg1
aux enable_dev "$dev1"
aux enable_dev "$dev2"
aux enable_dev "$dev1" "$dev2"
vgs -o+uuid |tee out
grep $vg1 out
@ -399,7 +387,7 @@ grep $UUID2 out | grep active
grep $UUID3 out | not grep active
vgchange -an
not vgchange -ay -vvvv $vg1
not vgchange -ay $vg1
lvs --foreign -o vguuid,active |tee out
grep $UUID1 out | not grep active
grep $UUID2 out | not grep active
@ -429,10 +417,7 @@ not grep $UUID1 out
not grep $UUID2 out
grep $UUID3 out
aux wipefs_a "$dev1"
aux wipefs_a "$dev2"
aux wipefs_a "$dev3"
aux wipefs_a "$dev4"
aux wipefs_a "$dev1" "$dev2" "$dev3" "$dev4"
# g. 2 local, 2 foreign
# setup
@ -454,9 +439,7 @@ vgcreate $vg1 "$dev4"
lvcreate -n $lv1 -l1 -an $vg1
UUID4=$(vgs --noheading -o vg_uuid $vg1 | xargs)
vgchange -y --systemid "other2" $vg1
aux enable_dev "$dev1"
aux enable_dev "$dev2"
aux enable_dev "$dev3"
aux enable_dev "$dev1" "$dev2" "$dev3"
vgs -o+uuid |tee out
grep $vg1 out
@ -507,11 +490,7 @@ grep $UUID2 out
grep $UUID3 out
grep $UUID4 out
aux wipefs_a "$dev1"
aux wipefs_a "$dev2"
aux wipefs_a "$dev3"
aux wipefs_a "$dev4"
aux wipefs_a "$dev5"
aux wipefs_a "$dev1" "$dev2" "$dev3" "$dev4" "$dev5"
# h. 3 local, 3 foreign
# setup
@ -543,11 +522,7 @@ vgcreate $vg1 "$dev6"
lvcreate -n $lv1 -l1 -an $vg1
UUID6=$(vgs --noheading -o vg_uuid $vg1 | xargs)
vgchange -y --systemid "other3" $vg1
aux enable_dev "$dev1"
aux enable_dev "$dev2"
aux enable_dev "$dev3"
aux enable_dev "$dev4"
aux enable_dev "$dev5"
aux enable_dev "$dev1" "$dev2" "$dev3" "$dev4" "$dev5"
vgs -o+uuid |tee out
grep $vg1 out
@ -610,12 +585,7 @@ grep $UUID4 out
grep $UUID5 out
grep $UUID6 out
aux wipefs_a "$dev1"
aux wipefs_a "$dev2"
aux wipefs_a "$dev3"
aux wipefs_a "$dev4"
aux wipefs_a "$dev5"
aux wipefs_a "$dev6"
aux wipefs_a "$dev1" "$dev2" "$dev3" "$dev4" "$dev5" "$dev6"
# vgreduce test with 1 local and 1 foreign vg.
# setup
@ -624,15 +594,13 @@ lvcreate -n $lv1 -l1 -an $vg1 "$dev1"
UUID1=$(vgs --noheading -o vg_uuid $vg1 | xargs)
PV1UUID=$(pvs --noheading -o uuid "$dev1")
PV7UUID=$(pvs --noheading -o uuid "$dev7")
aux disable_dev "$dev1"
aux disable_dev "$dev7"
aux disable_dev "$dev1" "$dev7"
vgcreate $vg1 "$dev2"
PV2UUID=$(pvs --noheading -o uuid "$dev2")
lvcreate -n $lv1 -l1 -an $vg1
UUID2=$(vgs --noheading -o vg_uuid $vg1 | xargs)
vgchange -y --systemid "other" $vg1
aux enable_dev "$dev1"
aux enable_dev "$dev7"
aux enable_dev "$dev1" "$dev7"
vgs --foreign -o+uuid |tee out
grep $vg1 out
@ -654,7 +622,3 @@ grep $PV7UUID out >out2
not grep $vg1 out2
vgremove -ff $vg1
aux wipefs_a "$dev1"
aux wipefs_a "$dev2"
aux wipefs_a "$dev7"

View File

@ -61,8 +61,7 @@ grep $UUID2 out
lvs --foreign
aux wipefs_a "$dev1"
aux wipefs_a "$dev2"
aux wipefs_a "$dev1" "$dev2"
# c. 1 local, 1 foreign
# setup
@ -93,8 +92,7 @@ grep $UUID2 out
lvs --foreign
aux wipefs_a "$dev1"
aux wipefs_a "$dev2"
aux wipefs_a "$dev1" "$dev2"
# d. 1 local, 2 foreign
# setup
@ -111,8 +109,7 @@ vgcreate $vg1 "$dev3"
lvcreate -n $lv1 -l1 -ky -an $vg1
UUID3=$(vgs --noheading -o vg_uuid $vg1 | xargs)
vgchange -y --systemid "other2" $vg1
aux enable_dev "$dev1"
aux enable_dev "$dev2"
aux enable_dev "$dev1" "$dev2"
vgrename $vg1 $vg2
vgs --foreign -o+uuid |tee out
@ -133,9 +130,7 @@ grep $UUID3 out
lvs --foreign
aux wipefs_a "$dev1"
aux wipefs_a "$dev2"
aux wipefs_a "$dev3"
aux wipefs_a "$dev1" "$dev2" "$dev3"
# e. 2 local, 0 foreign
# setup
@ -172,8 +167,7 @@ grep $UUID2 out
lvs --foreign
aux wipefs_a "$dev1"
aux wipefs_a "$dev2"
aux wipefs_a "$dev1" "$dev2"
# f. 2 local, 1 foreign
# setup
@ -189,8 +183,7 @@ vgcreate $vg1 "$dev3"
lvcreate -n $lv1 -l1 -ky -an $vg1
UUID3=$(vgs --noheading -o vg_uuid $vg1 | xargs)
vgchange -y --systemid "other" $vg1
aux enable_dev "$dev1"
aux enable_dev "$dev2"
aux enable_dev "$dev1" "$dev2"
lvs --foreign
not vgrename $vg1 $vg2
@ -239,9 +232,7 @@ grep $UUID3 out
lvs --foreign
aux wipefs_a "$dev1"
aux wipefs_a "$dev2"
aux wipefs_a "$dev3"
aux wipefs_a "$dev1" "$dev2" "$dev3"
# g. 3 local, 0 foreign
# setup
@ -256,8 +247,7 @@ aux disable_dev "$dev2"
vgcreate $vg1 "$dev3"
lvcreate -n ${lv1}_c -l1 -ky -an $vg1
UUID3=$(vgs --noheading -o vg_uuid $vg1 | xargs)
aux enable_dev "$dev1"
aux enable_dev "$dev2"
aux enable_dev "$dev1" "$dev2"
not vgrename $vg1 $vg2
vgs -o+uuid |tee out
@ -312,8 +302,3 @@ grep $UUID2 out
grep $UUID3 out
lvs --foreign
aux wipefs_a "$dev1"
aux wipefs_a "$dev2"
aux wipefs_a "$dev3"

View File

@ -89,9 +89,7 @@ grep "$dev1" $HINTS
grep "$dev2" $HINTS
grep "$dev3" $HINTS
aux wipefs_a "$dev1"
aux wipefs_a "$dev2"
aux wipefs_a "$dev3"
aux wipefs_a "$dev1" "$dev2" "$dev3"
#
# vg1 uses dev1,dev2

View File

@ -151,8 +151,7 @@ aux wait_recalc $vg/${lv1}_rimage_2
aux wait_for_sync $vg $lv1
_add_new_data_to_mnt
aux disable_dev "$dev2"
aux disable_dev "$dev1"
aux disable_dev "$dev1" "$dev2"
# wait for dmeventd to call lvconvert --repair which should
# replace dev1 and dev2 with dev4 and dev5
@ -169,8 +168,7 @@ grep "$dev3" out
_add_more_data_to_mnt
_verify_data_on_mnt
aux enable_dev "$dev1"
aux enable_dev "$dev2"
aux enable_dev "$dev1" "$dev2"
lvs -a -o+devices $vg | tee out
not grep "$dev1" out

View File

@ -20,11 +20,9 @@ SKIP_WITH_LVMPOLLD=1
aux have_raid 1 12 0 || skip
# 8 PVs needed for RAID10 testing (4-stripes/2-mirror)
aux prepare_pvs 8 64
get_devs
vgcreate $SHARED -s 256k "$vg" "${DEVICES[@]}"
aux prepare_vg 8 64
lvcreate -y --ty raid0 -R32.00k -i 4 -n $lv1 -L 64M $vg
lvcreate -y --type raid0 -R32k -i 4 -n $lv1 -L 64M $vg
lvcreate -y -i4 -l4 -n $lv2 $vg
lvextend -y -l +4 $vg/$lv1
lvconvert -y -R512K --ty raid10 $vg/$lv1

View File

@ -20,9 +20,7 @@ SKIP_WITH_LVMPOLLD=1
aux have_raid 1 3 0 || skip
# 8 PVs needed for RAID10 testing (4-stripes/2-mirror)
aux prepare_pvs 4 2
get_devs
vgcreate $SHARED -s 512k "$vg" "${DEVICES[@]}"
aux prepare_vg 4 2
lvcreate -y --ty raid1 -m 2 -n $lv1 -l 1 $vg
lvconvert -y --splitmirrors 1 --trackchanges $vg/$lv1

View File

@ -31,10 +31,7 @@ get_image_pvs() {
aux have_raid 1 3 1 || skip
# 9 PVs needed for RAID10 testing (3-stripes/2-mirror - replacing 3 devs)
aux prepare_pvs 9 80
get_devs
vgcreate $SHARED -s 256k "$vg" "${DEVICES[@]}"
aux prepare_vg 9 80
lvcreate --type raid10 -m 1 -i 3 -l 3 -n $lv1 $vg
aux wait_for_sync $vg $lv1

View File

@ -14,10 +14,10 @@
. lib/inittest
aux lvmconf "global/support_mirrored_mirror_log=1"
aux prepare_vg 6
aux lvmconf 'allocation/maximise_cling = 0' \
aux lvmconf 'global/support_mirrored_mirror_log = 1' \
'allocation/maximise_cling = 0' \
'allocation/mirror_logs_require_separate_pvs = 1'
# 3-way, disk log

View File

@ -46,8 +46,7 @@ check lv_field $vg/vpool_vdata segtype raid1 -a
lvremove -f $vg
aux enable_dev "$dev1"
aux enable_dev "$dev2"
aux enable_dev "$dev1" "$dev2"
lvcreate --type raid1 -L4G --nosync -n vpool1 $vg

View File

@ -80,8 +80,7 @@ else
check lv_field $vg/$lv1 sync_percent "100.00"
fi
aux enable_dev "$dev1"
aux enable_dev "$dev2"
aux enable_dev "$dev1" "$dev2"
aux wait_for_sync $vg $lv1
check lv_field $vg/$lv1 sync_percent "100.00"

View File

@ -160,9 +160,7 @@ vgchange -an $vg
vgremove -f $vg
aux cleanup_md_dev
aux wipefs_a "$dev1"
aux wipefs_a "$dev2"
aux udev_wait
aux wipefs_a "$dev1" "$dev2"
done

View File

@ -107,8 +107,7 @@ EOF
fi
aux cleanup_md_dev
aux wipefs_a "$dev1"
aux wipefs_a "$dev2"
aux wipefs_a "$dev1" "$dev2"
# Test newer topology-aware alignment detection w/ --dataalignment override
if aux kernel_at_least 2 6 33 ; then
@ -133,6 +132,5 @@ if aux kernel_at_least 2 6 33 ; then
check pv_field "$pvdev" pe_start "192.00k"
aux cleanup_md_dev
aux wipefs_a "$dev1"
aux wipefs_a "$dev2"
aux wipefs_a "$dev1" "$dev2"
fi

View File

@ -161,8 +161,7 @@ pvmove_fg() {
# disable delay device
# fg pvmove would take ages to complete otherwise
aux enable_dev "$dev3"
aux enable_dev "$dev4"
aux enable_dev "$dev3" "$dev4"
pvmove
}
@ -206,8 +205,7 @@ pvmove_fg_single() {
# disable delay device
# fg pvmove would take ages to complete otherwise
aux enable_dev "$dev3"
aux enable_dev "$dev4"
aux enable_dev "$dev3" "$dev4"
pvmove "$dev1"
pvmove "$dev2"

View File

@ -140,8 +140,7 @@ pvmove_fg() {
# disable delay device
# fg pvmove would take ages to complete otherwise
aux enable_dev "$dev4"
aux enable_dev "$dev5"
aux enable_dev "$dev4" "$dev5"
LVM_TEST_TAG="kill_me_$PREFIX" pvmove
}
@ -185,8 +184,7 @@ pvmove_fg_single() {
# disable delay device
# fg pvmove would take ages to complete otherwise
aux enable_dev "$dev4"
aux enable_dev "$dev5"
aux enable_dev "$dev4" "$dev5"
LVM_TEST_TAG="kill_me_$PREFIX" pvmove "$dev1"
LVM_TEST_TAG="kill_me_$PREFIX" pvmove "$dev3"