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

tests: try harder to kill all dangling procs

also simplify and make less prone to an error checks
for running bg processes inside a pvmove-resume tests
This commit is contained in:
Ondrej Kozina 2015-04-28 15:31:47 +02:00
parent 8c9ab2a4dd
commit 90cbc5576f
6 changed files with 117 additions and 160 deletions

View File

@ -99,7 +99,7 @@ lvremove -ff $vg
lvcreate -aey -l5 --type mirror -m1 -n $lv1 $vg "$dev1" "$dev2" "$dev3:0"
check mirror $vg $lv1
check mirror_legs $vg $lv1 2
lvconvert -m+1 -b $vg/$lv1 "$dev4"
LVM_TEST_TAG="kill_me_$PREFIX" lvconvert -m+1 -b $vg/$lv1 "$dev4"
# Next convert should fail b/c we can't have 2 at once
should not lvconvert -m+1 $vg/$lv1 "$dev5"
@ -156,7 +156,7 @@ lvremove -ff $vg
# "remove newly added mirror"
lvcreate -aey -l2 --type mirror -m1 -n $lv1 $vg "$dev1" "$dev2" "$dev3:$DEVRANGE"
lvconvert -m+1 -b $vg/$lv1 "$dev4"
LVM_TEST_TAG="kill_me_$PREFIX" lvconvert -m+1 -b $vg/$lv1 "$dev4"
lvconvert -m-1 $vg/$lv1 "$dev4"
lvconvert $vg/$lv1 # wait
@ -167,7 +167,7 @@ lvremove -ff $vg
# "remove one of newly added mirrors"
lvcreate -aey -l2 --type mirror -m1 -n $lv1 $vg "$dev1" "$dev2" "$dev3:$DEVRANGE"
lvconvert -m+2 -b $vg/$lv1 "$dev4" "$dev5"
LVM_TEST_TAG="kill_me_$PREFIX" lvconvert -m+2 -b $vg/$lv1 "$dev4" "$dev5"
lvconvert -m-1 $vg/$lv1 "$dev4"
lvconvert $vg/$lv1 # wait
@ -178,7 +178,7 @@ lvremove -ff $vg
# "remove from original mirror (the original is still mirror)"
lvcreate -aey -l2 --type mirror -m2 -n $lv1 $vg "$dev1" "$dev2" "$dev5" "$dev3:$DEVRANGE"
lvconvert -m+1 -b $vg/$lv1 "$dev4"
LVM_TEST_TAG="kill_me_$PREFIX" lvconvert -m+1 -b $vg/$lv1 "$dev4"
# FIXME: Extra wait here for mirror upconvert synchronization
# otherwise we may fail her on parallel upconvert and downconvert
# lvconvert-mirror-updown.sh tests this errornous case separately
@ -193,7 +193,7 @@ lvremove -ff $vg
# "remove from original mirror (the original becomes linear)"
lvcreate -aey -l2 --type mirror -m1 -n $lv1 $vg "$dev1" "$dev2" "$dev3:$DEVRANGE"
lvconvert -m+1 -b $vg/$lv1 "$dev4"
LVM_TEST_TAG="kill_me_$PREFIX" lvconvert -m+1 -b $vg/$lv1 "$dev4"
# FIXME: Extra wait here for mirror upconvert synchronization
# otherwise we may fail her on parallel upconvert and downconvert
# lvconvert-mirror-updown.sh tests this errornous case separately

View File

@ -101,7 +101,7 @@ check_and_cleanup_lvs_
#COMM "converting mirror names is ${lv1}_mimagetmp_2"
lvcreate -aey -l2 --type mirror -m1 -n $lv1 $vg
lvconvert -m+1 -i+40 -b $vg/$lv1
LVM_TEST_TAG="kill_me_$PREFIX" lvconvert -m+1 -i+40 -b $vg/$lv1
convlv=$(lv_convert_lv_ $vg/$lv1)
test $convlv = ${lv1}_mimagetmp_2
lv_devices_ $vg/$lv1 $convlv ${lv1}_mimage_2

View File

@ -20,10 +20,10 @@ do
lvcreate -aey -l1 -n $lv1 $vg "$dev1"
lvs -o +devices | grep "$dev1"
pvmove $mode -i 1 -b "$dev1" "$dev2"
LVM_TEST_TAG="kill_me_$PREFIX" pvmove $mode -i 1 -b "$dev1" "$dev2"
sleep 5 # arbitrary...
lvs -o +devices | not grep "pvmove"
lvs -o +devices | grep "$dev2"
lvremove -ff $vg
done
done

View File

@ -44,13 +44,6 @@ test_pvmove_resume() {
kill -9 $PVMOVE
if test -e LOCAL_LVMPOLLD ; then
# inforestart lvmpolld
kill $(< LOCAL_LVMPOLLD)
for i in $(seq 1 100) ; do
test $i -eq 100 && die "Shutdown of lvmpolld is too slow."
test -e "$LVM_LVMPOLLD_PIDFILE" || break
sleep .1
done # wait for the pid removal
aux prepare_lvmpolld
fi
@ -81,14 +74,7 @@ test_pvmove_resume() {
aux prepare_clvmd
fi
if test -e LOCAL_LVMETAD ; then
# Restart lvmetad
kill $(< LOCAL_LVMETAD)
aux prepare_lvmetad
fi
ps h -C lvm | tee out || true
test $(wc -l < out) -eq 0
aux notify_lvmetad "$dev1" "$dev2" "$dev3" "$dev4"
# call resume function (see below)
# with expected number of spawned
@ -112,47 +98,45 @@ test_pvmove_resume() {
i=$((i + 1))
done
aux kill_listed_processes
lvremove -ff $vg $vg1
}
lvchange_single() {
lvchange -aey $vg/$lv1
lvchange -aey $vg1/$lv1
LVM_TEST_TAG="kill_me_$PREFIX" lvchange -aey $vg/$lv1
LVM_TEST_TAG="kill_me_$PREFIX" lvchange -aey $vg1/$lv1
ps h -C lvm | tee out || true
test $(wc -l < out) -eq $1
test $(aux count_processes_with_tag) -eq $1
}
lvchange_all() {
lvchange -aey $vg/$lv1 $vg1/$lv1
LVM_TEST_TAG="kill_me_$PREFIX" lvchange -aey $vg/$lv1 $vg1/$lv1
ps h -C lvm | tee out || true
test $(wc -l < out) -eq $1
test $(aux count_processes_with_tag) -eq $1
}
vgchange_single() {
vgchange -aey $vg
vgchange -aey $vg1
LVM_TEST_TAG="kill_me_$PREFIX" vgchange -aey $vg
LVM_TEST_TAG="kill_me_$PREFIX" vgchange -aey $vg1
ps h -C lvm | tee out || true
test $(wc -l < out) -eq $1
test $(aux count_processes_with_tag) -eq $1
}
vgchange_all() {
vgchange -aey $vg $vg1
LVM_TEST_TAG="kill_me_$PREFIX" vgchange -aey $vg $vg1
ps h -C lvm | tee out || true
test $(wc -l < out) -eq $1
test $(aux count_processes_with_tag) -eq $1
}
pvmove_fg() {
# pvmove resume requires LVs active
vgchange -aey --poll n $vg $vg1
# pvmove resume requires LVs active...
LVM_TEST_TAG="kill_me_$PREFIX" vgchange --config 'activation{polling_interval=10}' -aey --poll n $vg $vg1
ps h -C lvm | tee out || true
test $(wc -l < out) -eq 0
# ...also vgchange --poll n must not spawn any bg processes...
test $(aux count_processes_with_tag) -eq 0
# vgchange must not spawn (thus finish) background polling
# ...thus finish polling
get lv_field $vg name -a | grep "^\[pvmove0\]"
get lv_field $vg1 name -a | grep "^\[pvmove0\]"
@ -161,31 +145,31 @@ pvmove_fg() {
aux enable_dev "$dev3"
aux enable_dev "$dev4"
pvmove -i0
pvmove
}
pvmove_bg() {
# pvmove resume requires LVs active
vgchange -aey --poll n $vg $vg1
# pvmove resume requires LVs active...
LVM_TEST_TAG="kill_me_$PREFIX" vgchange --config 'activation{polling_interval=10}' -aey --poll n $vg $vg1
ps h -C lvm | tee out || true
test $(wc -l < out) -eq 0
# ...also vgchange --poll n must not spawn any bg processes...
test $(aux count_processes_with_tag) -eq 0
# vgchange must not spawn (thus finish) background polling
# ...thus finish polling
get lv_field $vg name -a | grep "^\[pvmove0\]"
get lv_field $vg1 name -a | grep "^\[pvmove0\]"
pvmove -b -i0
LVM_TEST_TAG="kill_me_$PREFIX" pvmove -b -i0
}
pvmove_fg_single() {
# pvmove resume requires LVs active
vgchange -aey --poll n $vg
# pvmove resume requires LVs active...
LVM_TEST_TAG="kill_me_$PREFIX" vgchange --config 'activation{polling_interval=10}' -aey --poll n $vg
ps h -C lvm | tee out || true
test $(wc -l < out) -eq 0
# ...also vgchange --poll n must not spawn any bg processes...
test $(aux count_processes_with_tag) -eq 0
# vgchange must not spawn (thus finish) background polling
# ...thus finish polling
get lv_field $vg name -a | grep "^\[pvmove0\]"
get lv_field $vg1 name -a | grep "^\[pvmove0\]"
@ -194,23 +178,23 @@ pvmove_fg_single() {
aux enable_dev "$dev3"
aux enable_dev "$dev4"
pvmove -i0 "$dev1"
pvmove -i0 "$dev2"
pvmove "$dev1"
pvmove "$dev2"
}
pvmove_bg_single() {
# pvmove resume requires LVs active
vgchange -aey --poll n $vg
# pvmove resume requires LVs active...
LVM_TEST_TAG="kill_me_$PREFIX" vgchange --config 'activation{polling_interval=10}' -aey --poll n $vg
ps h -C lvm | tee out || true
test $(wc -l < out) -eq 0
# ...also vgchange --poll n must not spawn any bg processes...
test $(aux count_processes_with_tag) -eq 0
# vgchange must not spawn (thus finish) background polling
# ...thus finish polling
get lv_field $vg name -a | grep "^\[pvmove0\]"
get lv_field $vg1 name -a | grep "^\[pvmove0\]"
pvmove -i0 -b "$dev1"
pvmove -i0 -b "$dev2"
LVM_TEST_TAG="kill_me_$PREFIX" pvmove -b "$dev1"
LVM_TEST_TAG="kill_me_$PREFIX" pvmove -b "$dev2"
}
test -e LOCAL_CLVMD && skip

View File

@ -16,7 +16,7 @@
. lib/inittest
aux prepare_pvs 9 30
aux prepare_pvs 2 30
vgcreate -s 128k $vg "$dev1"
pvcreate --metadatacopies 0 "$dev2"
@ -35,13 +35,6 @@ test_pvmove_resume() {
kill -9 $PVMOVE
if test -e LOCAL_LVMPOLLD ; then
# inforestart lvmpolld
kill $(< LOCAL_LVMPOLLD)
for i in $(seq 1 100) ; do
test $i -eq 100 && die "Shutdown of lvmpolld is too slow."
test -e "$LVM_LVMPOLLD_PIDFILE" || break
sleep .1
done # wait for the pid removal
aux prepare_lvmpolld
fi
@ -70,14 +63,7 @@ test_pvmove_resume() {
aux prepare_clvmd
fi
if test -e LOCAL_LVMETAD ; then
# Restart lvmetad
kill $(< LOCAL_LVMETAD)
aux prepare_lvmetad
fi
ps h -C lvm | tee out || true
test $(wc -l < out) -eq 0
aux notify_lvmetad "$dev1" "$dev2"
# call resume function (see below)
# with expected number of spawned
@ -94,83 +80,84 @@ test_pvmove_resume() {
i=$((i + 1))
done
aux kill_listed_processes
lvremove -ff $vg
}
lvchange_single() {
lvchange -aey $vg/$lv1
lvchange -aey $vg/$lv2
LVM_TEST_TAG="kill_me_$PREFIX" lvchange -aey $vg/$lv1
LVM_TEST_TAG="kill_me_$PREFIX" lvchange -aey $vg/$lv2
}
lvchange_all() {
lvchange -aey $vg/$lv1 $vg/$lv2
# remove -vvvv
LVM_TEST_TAG="kill_me_$PREFIX" lvchange -vvvv -aey $vg/$lv1 $vg/$lv2
# we don't want to spawn more than $1 background pollings
ps h -C lvm | tee out || true
test $(wc -l < out) -eq $1 || should false
test $(aux count_processes_with_tag) -eq $1 || should false
}
vgchange_single() {
vgchange -aey $vg
LVM_TEST_TAG="kill_me_$PREFIX" vgchange -aey $vg
ps h -C lvm | tee out || true
test $(wc -l < out) -eq $1
test $(aux count_processes_with_tag) -eq $1
}
pvmove_fg() {
# pvmove resume requires LVs active
vgchange -aey --poll n $vg
# pvmove resume requires LVs active...
LVM_TEST_TAG="kill_me_$PREFIX" vgchange --config 'activation{polling_interval=10}' -aey --poll n $vg
ps h -C lvm | tee out || true
test $(wc -l < out) -eq 0
# ...also vgchange --poll n must not spawn any bg processes
test $(aux count_processes_with_tag) -eq 0
# vgchange must not spawn (thus finish) background polling
# ...thus finish polling
get lv_field $vg name -a | grep "^\[pvmove0\]"
aux enable_dev "$dev2"
pvmove -i0
pvmove
}
pvmove_bg() {
# pvmove resume requires LVs active
vgchange -aey --poll n $vg
# pvmove resume requires LVs active...
LVM_TEST_TAG="kill_me_$PREFIX" vgchange --config 'activation{polling_interval=10}' -aey --poll n $vg
ps h -C lvm | tee out || true
test $(wc -l < out) -eq 0
# ...also vgchange --poll n must not spawn any bg processes
test $(aux count_processes_with_tag) -eq 0
# vgchange must not spawn (thus finish) background polling
# ...thus finish polling
get lv_field $vg name -a | grep "^\[pvmove0\]"
pvmove -b -i0
LVM_TEST_TAG="kill_me_$PREFIX" pvmove -b
}
pvmove_fg_single() {
# pvmove resume requires LVs active
vgchange -aey --poll n $vg
# pvmove resume requires LVs active...
LVM_TEST_TAG="kill_me_$PREFIX" vgchange --config 'activation{polling_interval=10}' -aey --poll n $vg
ps h -C lvm | tee out || true
test $(wc -l < out) -eq 0
# ...also vgchange --poll n must not spawn any bg processes
test $(aux count_processes_with_tag) -eq 0
# vgchange must not spawn (thus finish) background polling
# ...thus finish polling
get lv_field $vg name -a | grep "^\[pvmove0\]"
aux enable_dev "$dev2"
pvmove -i0 "$dev1"
pvmove "$dev1"
}
pvmove_bg_single() {
# pvmove resume requires LVs active
vgchange -aey --poll n $vg
# pvmove resume requires LVs active...
LVM_TEST_TAG="kill_me_$PREFIX" vgchange --config 'activation{polling_interval=10}' -aey --poll n $vg
ps h -C lvm | tee out || true
test $(wc -l < out) -eq 0
# ...also vgchange --poll n must not spawn any bg processes...
test $(aux count_processes_with_tag) -eq 0
# vgchange must not spawn (thus finish) background polling
# ...thus finish polling
get lv_field $vg name -a | grep "^\[pvmove0\]"
pvmove -i0 -b "$dev1"
LVM_TEST_TAG="kill_me_$PREFIX" pvmove -b "$dev1"
}
test -e LOCAL_CLVMD && skip

View File

@ -44,13 +44,6 @@ test_pvmove_resume() {
kill -9 $PVMOVE
if test -e LOCAL_LVMPOLLD ; then
# inforestart lvmpolld
kill $(< LOCAL_LVMPOLLD)
for i in $(seq 1 100) ; do
test $i -eq 100 && die "Shutdown of lvmpolld is too slow."
test -e "$LVM_LVMPOLLD_PIDFILE" || break
sleep .1
done # wait for the pid removal
aux prepare_lvmpolld
fi
@ -81,14 +74,7 @@ test_pvmove_resume() {
aux prepare_clvmd
fi
if test -e LOCAL_LVMETAD ; then
# Restart lvmetad
kill $(< LOCAL_LVMETAD)
aux prepare_lvmetad
fi
ps h -C lvm | tee out || true
test $(wc -l < out) -eq 0
aux notify_lvmetad "$dev1" "$dev2" "$dev3" "$dev4" "$dev5"
# call resume function (see below)
# with expected number of spawned
@ -106,37 +92,37 @@ test_pvmove_resume() {
i=$((i + 1))
done
aux kill_listed_processes
lvremove -ff $vg
}
lvchange_single() {
lvchange -aey $vg/$lv1
lvchange -aey $vg/$lv2
LVM_TEST_TAG="kill_me_$PREFIX" lvchange -aey $vg/$lv1
LVM_TEST_TAG="kill_me_$PREFIX" lvchange -aey $vg/$lv2
}
lvchange_all() {
lvchange -aey $vg/$lv1 $vg/$lv2
LVM_TEST_TAG="kill_me_$PREFIX" lvchange -aey $vg/$lv1 $vg/$lv2
# we don't want to spawn more than $1 background pollings
ps h -C lvm | tee out || true
test $(wc -l < out) -eq $1 || should false
test $(aux count_processes_with_tag) -eq $1
}
vgchange_single() {
vgchange -aey -vvvv $vg
LVM_TEST_TAG="kill_me_$PREFIX" vgchange -aey $vg
ps h -C lvm | tee out || true
test $(wc -l < out) -eq $1
test $(aux count_processes_with_tag) -eq $1
}
pvmove_fg() {
# pvmove resume requires LVs active
vgchange -aey --poll n $vg
# pvmove resume requires LVs active...
LVM_TEST_TAG="kill_me_$PREFIX" vgchange --config 'activation{polling_interval=10}' -aey --poll n $vg
ps h -C lvm | tee out || true
test $(wc -l < out) -eq 0
# ...also vgchange --poll n must not spawn any bg processes...
test $(aux count_processes_with_tag) -eq 0
# vgchange must not spawn (thus finish) background polling
# ...thus finish polling
get lv_field $vg name -a | grep "^\[pvmove0\]"
get lv_field $vg name -a | grep "^\[pvmove1\]"
@ -145,31 +131,31 @@ pvmove_fg() {
aux enable_dev "$dev4"
aux enable_dev "$dev5"
pvmove -i0
pvmove
}
pvmove_bg() {
# pvmove resume requires LVs active
vgchange -aey --poll n $vg
# pvmove resume requires LVs active...
LVM_TEST_TAG="kill_me_$PREFIX" vgchange --config 'activation{polling_interval=10}' -aey --poll n $vg
ps h -C lvm | tee out || true
test $(wc -l < out) -eq 0
# ...also vgchange --poll n must not spawn any bg processes...
test $(aux count_processes_with_tag) -eq 0
# vgchange must not spawn (thus finish) background polling
# ...thus finish polling
get lv_field $vg name -a | grep "^\[pvmove0\]"
get lv_field $vg name -a | grep "^\[pvmove1\]"
pvmove -b -i0
LVM_TEST_TAG="kill_me_$PREFIX" pvmove -b
}
pvmove_fg_single() {
# pvmove resume requires LVs active
vgchange -aey --poll n $vg
# pvmove resume requires LVs active...
LVM_TEST_TAG="kill_me_$PREFIX" vgchange --config 'activation{polling_interval=10}' -aey --poll n $vg
ps h -C lvm | tee out || true
test $(wc -l < out) -eq 0
# ...also vgchange --poll n must not spawn any bg processes...
test $(aux count_processes_with_tag) -eq 0
# vgchange must not spawn (thus finish) background polling
# ...thus finish polling
get lv_field $vg name -a | grep "^\[pvmove0\]"
get lv_field $vg name -a | grep "^\[pvmove1\]"
@ -178,23 +164,23 @@ pvmove_fg_single() {
aux enable_dev "$dev4"
aux enable_dev "$dev5"
pvmove -i0 "$dev1"
pvmove -i0 "$dev3"
pvmove "$dev1"
pvmove "$dev3"
}
pvmove_bg_single() {
# pvmove resume requires LVs active
vgchange -aey --poll n $vg
# pvmove resume requires LVs active...
LVM_TEST_TAG="kill_me_$PREFIX" vgchange --config 'activation{polling_interval=10}' -aey --poll n $vg
ps h -C lvm | tee out || true
test $(wc -l < out) -eq 0
# ...also vgchange --poll n must not spawn any bg processes...
test $(aux count_processes_with_tag) -eq 0
# vgchange must not spawn (thus finish) background polling
# ...thus finish polling
get lv_field $vg name -a | grep "^\[pvmove0\]"
get lv_field $vg name -a | grep "^\[pvmove1\]"
pvmove -i0 -b "$dev1"
pvmove -i0 -b "$dev3"
LVM_TEST_TAG="kill_me_$PREFIX" pvmove -b "$dev1"
LVM_TEST_TAG="kill_me_$PREFIX" pvmove -b "$dev3"
}
test -e LOCAL_CLVMD && skip