mirror of
git://sourceware.org/git/lvm2.git
synced 2025-01-02 01:18:26 +03:00
tests: pvmove updates
Switch to plain 'kill' we should no longer need SIGKILL as polling can be interrupted. Resolve problem in aux wait_pvmove_lv_ready() that was using lvm command to check for UUID - but this was interferring with VG lock and it's been delaying confirmation. So reducing slow-down of test - so it can run faster.
This commit is contained in:
parent
b99f7d0df9
commit
79a168d119
@ -215,7 +215,7 @@ prepare_dmeventd() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
prepare_lvmpolld() {
|
prepare_lvmpolld() {
|
||||||
lvmconf "global/use_lvmpolld = 1"
|
test -e LOCAL_LVMPOLLD || lvmconf "global/use_lvmpolld = 1"
|
||||||
|
|
||||||
local run_valgrind=""
|
local run_valgrind=""
|
||||||
test "${LVM_VALGRIND_LVMPOLLD:-0}" -eq 0 || run_valgrind="run_valgrind"
|
test "${LVM_VALGRIND_LVMPOLLD:-0}" -eq 0 || run_valgrind="run_valgrind"
|
||||||
@ -226,11 +226,11 @@ prepare_lvmpolld() {
|
|||||||
$run_valgrind lvmpolld -f "$@" -s "$TESTDIR/lvmpolld.socket" -B "$TESTDIR/lib/lvm" -l all &
|
$run_valgrind lvmpolld -f "$@" -s "$TESTDIR/lvmpolld.socket" -B "$TESTDIR/lib/lvm" -l all &
|
||||||
echo $! > LOCAL_LVMPOLLD
|
echo $! > LOCAL_LVMPOLLD
|
||||||
for i in {200..0} ; do
|
for i in {200..0} ; do
|
||||||
test "$i" -eq 0 && die "Startup of lvmpolld is too slow."
|
|
||||||
test -e "$TESTDIR/lvmpolld.socket" && break
|
test -e "$TESTDIR/lvmpolld.socket" && break
|
||||||
echo -n .;
|
echo -n .;
|
||||||
sleep .1;
|
sleep .1;
|
||||||
done # wait for the socket
|
done # wait for the socket
|
||||||
|
test "$i" -gt 0 || die "Startup of lvmpolld is too slow."
|
||||||
echo ok
|
echo ok
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1126,7 +1126,10 @@ remove_dm_devs() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
done
|
done
|
||||||
test ${#held[@]} -eq 0 && return
|
test ${#held[@]} -eq 0 && {
|
||||||
|
rm -f debug.log*
|
||||||
|
return
|
||||||
|
}
|
||||||
remove=( "${held[@]}" )
|
remove=( "${held[@]}" )
|
||||||
done
|
done
|
||||||
die "Can't remove device(s) ${held[@]}"
|
die "Can't remove device(s) ${held[@]}"
|
||||||
@ -1801,8 +1804,8 @@ check_lvmpolld_init_rq_count() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
wait_pvmove_lv_ready() {
|
wait_pvmove_lv_ready() {
|
||||||
# given sleep .1 this is about 60 secs of waiting
|
# given sleep .1 this is about 20 secs of waiting
|
||||||
local retries=${2-300}
|
local retries=${2-100}
|
||||||
|
|
||||||
if [ -e LOCAL_LVMPOLLD ]; then
|
if [ -e LOCAL_LVMPOLLD ]; then
|
||||||
local lvid=""
|
local lvid=""
|
||||||
@ -1810,10 +1813,8 @@ wait_pvmove_lv_ready() {
|
|||||||
test "$retries" -le 0 && die "Waiting for lvmpolld timed out"
|
test "$retries" -le 0 && die "Waiting for lvmpolld timed out"
|
||||||
test -n "$lvid" || {
|
test -n "$lvid" || {
|
||||||
# wait till wanted LV really appears
|
# wait till wanted LV really appears
|
||||||
lvid=$(get lv_field "${1//-//}" vg_uuid,lv_uuid -a 2>/dev/null) && {
|
lvid=$(dmsetup info --noheadings -c -o uuid "$1" 2>/dev/null || true)
|
||||||
lvid=${lvid//\ /}
|
lvid=${lvid##LVM-}
|
||||||
lvid=${lvid//-/}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
test -z "$lvid" || {
|
test -z "$lvid" || {
|
||||||
lvmpolld_dump > lvmpolld_dump.txt
|
lvmpolld_dump > lvmpolld_dump.txt
|
||||||
|
@ -20,8 +20,6 @@ SKIP_WITH_CLVMD=1
|
|||||||
|
|
||||||
. lib/inittest
|
. lib/inittest
|
||||||
|
|
||||||
test -e LOCAL_LVMPOLLD && aux throttle_dm_mirror 20 || :
|
|
||||||
|
|
||||||
aux prepare_pvs 4 30
|
aux prepare_pvs 4 30
|
||||||
|
|
||||||
vgcreate -s 128k $vg "$dev1"
|
vgcreate -s 128k $vg "$dev1"
|
||||||
@ -36,24 +34,25 @@ test_pvmove_resume() {
|
|||||||
lvcreate -an -Zn -l30 -n $lv1 $vg
|
lvcreate -an -Zn -l30 -n $lv1 $vg
|
||||||
lvcreate -an -Zn -l30 -n $lv1 $vg1
|
lvcreate -an -Zn -l30 -n $lv1 $vg1
|
||||||
|
|
||||||
aux delay_dev "$dev3" 0 200 "$(get first_extent_sector "$dev3"):"
|
aux delay_dev "$dev3" 0 30 "$(get first_extent_sector "$dev3"):"
|
||||||
test -e HAVE_DM_DELAY || { lvremove -f $vg $vg1; return 0; }
|
test -e HAVE_DM_DELAY || { lvremove -f $vg $vg1; return 0; }
|
||||||
aux delay_dev "$dev4" 0 200 "$(get first_extent_sector "$dev4"):"
|
aux delay_dev "$dev4" 0 30 "$(get first_extent_sector "$dev4"):"
|
||||||
|
|
||||||
pvmove -i5 "$dev1" &
|
pvmove -i5 "$dev1" &
|
||||||
PVMOVE=$!
|
PVMOVE=$!
|
||||||
aux wait_pvmove_lv_ready "$vg-pvmove0" 300
|
aux wait_pvmove_lv_ready "$vg-pvmove0"
|
||||||
kill -9 $PVMOVE
|
kill $PVMOVE
|
||||||
|
test -e LOCAL_LVMPOLLD && aux prepare_lvmpolld
|
||||||
|
|
||||||
pvmove -i5 "$dev2" &
|
pvmove -i5 "$dev2" &
|
||||||
PVMOVE=$!
|
PVMOVE=$!
|
||||||
aux wait_pvmove_lv_ready "$vg1-pvmove0" 300
|
aux wait_pvmove_lv_ready "$vg1-pvmove0"
|
||||||
kill -9 $PVMOVE
|
kill $PVMOVE
|
||||||
|
|
||||||
aux remove_dm_devs "$vg-$lv1" "$vg1-$lv1" "$vg-pvmove0" "$vg1-pvmove0"
|
|
||||||
test -e LOCAL_LVMPOLLD && aux prepare_lvmpolld
|
test -e LOCAL_LVMPOLLD && aux prepare_lvmpolld
|
||||||
wait
|
wait
|
||||||
|
|
||||||
|
aux remove_dm_devs "$vg-$lv1" "$vg1-$lv1" "$vg-pvmove0" "$vg1-pvmove0"
|
||||||
|
|
||||||
check lv_attr_bit type $vg/pvmove0 "p"
|
check lv_attr_bit type $vg/pvmove0 "p"
|
||||||
check lv_attr_bit type $vg1/pvmove0 "p"
|
check lv_attr_bit type $vg1/pvmove0 "p"
|
||||||
|
|
||||||
@ -79,22 +78,14 @@ test_pvmove_resume() {
|
|||||||
# bg polling as parameter
|
# bg polling as parameter
|
||||||
$1 2
|
$1 2
|
||||||
|
|
||||||
aux enable_dev "$dev3"
|
aux enable_dev "$dev3" "$dev4"
|
||||||
aux enable_dev "$dev4"
|
|
||||||
|
|
||||||
i=0
|
for i in {100..0} ; do
|
||||||
while get lv_field $vg name -a | grep -E "^\[?pvmove"; do
|
lvs -ao name $vg $vg1 | grep "\[pvmove" || break
|
||||||
# wait for 30 secs at max
|
|
||||||
test $i -ge 300 && die "Pvmove is too slow or does not progress."
|
|
||||||
sleep .1
|
sleep .1
|
||||||
i=$((i + 1))
|
|
||||||
done
|
|
||||||
while get lv_field $vg1 name -a | grep -E "^\[?pvmove"; do
|
|
||||||
# wait for 30 secs at max
|
|
||||||
test $i -ge 300 && die "Pvmove is too slow or does not progress."
|
|
||||||
sleep .1
|
|
||||||
i=$((i + 1))
|
|
||||||
done
|
done
|
||||||
|
# wait for 10 secs at max
|
||||||
|
test $i -eq 0 && die "Pvmove is too slow or does not progress."
|
||||||
|
|
||||||
aux kill_tagged_processes
|
aux kill_tagged_processes
|
||||||
|
|
||||||
|
@ -20,8 +20,6 @@ SKIP_WITH_CLVMD=1
|
|||||||
|
|
||||||
. lib/inittest
|
. lib/inittest
|
||||||
|
|
||||||
test -e LOCAL_LVMPOLLD && aux throttle_dm_mirror 20 || :
|
|
||||||
|
|
||||||
aux prepare_pvs 2 30
|
aux prepare_pvs 2 30
|
||||||
|
|
||||||
vgcreate -s 128k $vg "$dev1"
|
vgcreate -s 128k $vg "$dev1"
|
||||||
@ -33,16 +31,16 @@ test_pvmove_resume() {
|
|||||||
lvcreate -an -Zn -l15 -n $lv1 $vg "$dev1"
|
lvcreate -an -Zn -l15 -n $lv1 $vg "$dev1"
|
||||||
lvcreate -an -Zn -l15 -n $lv2 $vg "$dev1"
|
lvcreate -an -Zn -l15 -n $lv2 $vg "$dev1"
|
||||||
|
|
||||||
aux delay_dev "$dev2" 0 200 "$(get first_extent_sector "$dev2"):"
|
aux delay_dev "$dev2" 0 30 "$(get first_extent_sector "$dev2"):"
|
||||||
|
|
||||||
pvmove -i5 "$dev1" &
|
pvmove -i5 "$dev1" &
|
||||||
PVMOVE=$!
|
PVMOVE=$!
|
||||||
aux wait_pvmove_lv_ready "$vg-pvmove0" 300
|
aux wait_pvmove_lv_ready "$vg-pvmove0"
|
||||||
kill -9 $PVMOVE
|
kill $PVMOVE
|
||||||
|
|
||||||
aux remove_dm_devs "$vg-$lv1" "$vg-$lv2" "$vg-pvmove0"
|
|
||||||
test -e LOCAL_LVMPOLLD && aux prepare_lvmpolld
|
test -e LOCAL_LVMPOLLD && aux prepare_lvmpolld
|
||||||
wait
|
wait
|
||||||
|
aux remove_dm_devs "$vg-$lv1" "$vg-$lv2" "$vg-pvmove0"
|
||||||
|
|
||||||
check lv_attr_bit type $vg/pvmove0 "p"
|
check lv_attr_bit type $vg/pvmove0 "p"
|
||||||
|
|
||||||
@ -70,13 +68,11 @@ test_pvmove_resume() {
|
|||||||
|
|
||||||
aux enable_dev "$dev2"
|
aux enable_dev "$dev2"
|
||||||
|
|
||||||
i=0
|
for i in {100..0} ; do # wait for 10 secs at max
|
||||||
while get lv_field $vg name -a | grep -E "^\[?pvmove"; do
|
get lv_field $vg name -a | grep -E "^\[?pvmove" || break
|
||||||
# wait for 30 secs at max
|
|
||||||
test $i -ge 300 && die "Pvmove is too slow or does not progress."
|
|
||||||
sleep .1
|
sleep .1
|
||||||
i=$((i + 1))
|
|
||||||
done
|
done
|
||||||
|
test $i -gt 0 || die "Pvmove is too slow or does not progress."
|
||||||
|
|
||||||
aux kill_tagged_processes
|
aux kill_tagged_processes
|
||||||
|
|
||||||
|
@ -19,8 +19,6 @@ SKIP_WITH_LVMLOCKD=1
|
|||||||
|
|
||||||
. lib/inittest
|
. lib/inittest
|
||||||
|
|
||||||
test -e LOCAL_LVMPOLLD && aux throttle_dm_mirror 20 || :
|
|
||||||
|
|
||||||
aux prepare_pvs 5 40
|
aux prepare_pvs 5 40
|
||||||
|
|
||||||
vgcreate -s 128k $vg "$dev1" "$dev2" "$dev3"
|
vgcreate -s 128k $vg "$dev1" "$dev2" "$dev3"
|
||||||
@ -35,23 +33,23 @@ test_pvmove_resume() {
|
|||||||
# next LV on same VG and differetnt PV (we want to test 2 pvmoves per VG)
|
# next LV on same VG and differetnt PV (we want to test 2 pvmoves per VG)
|
||||||
lvcreate -an -Zn -l50 -n $lv2 $vg "$dev3"
|
lvcreate -an -Zn -l50 -n $lv2 $vg "$dev3"
|
||||||
|
|
||||||
aux delay_dev "$dev4" 0 200 "$(get first_extent_sector "$dev4"):"
|
aux delay_dev "$dev4" 0 30 "$(get first_extent_sector "$dev4"):"
|
||||||
test -e HAVE_DM_DELAY || { lvremove -f $vg; return 0; }
|
test -e HAVE_DM_DELAY || { lvremove -f $vg; return 0; }
|
||||||
aux delay_dev "$dev5" 0 200 "$(get first_extent_sector "$dev5"):"
|
aux delay_dev "$dev5" 0 30 "$(get first_extent_sector "$dev5"):"
|
||||||
|
|
||||||
pvmove -i5 "$dev1" "$dev4" &
|
pvmove -i5 "$dev1" "$dev4" &
|
||||||
PVMOVE=$!
|
PVMOVE=$!
|
||||||
aux wait_pvmove_lv_ready "$vg-pvmove0" 300
|
aux wait_pvmove_lv_ready "$vg-pvmove0"
|
||||||
kill -9 $PVMOVE
|
kill $PVMOVE
|
||||||
|
|
||||||
pvmove -i5 -n $vg/$lv2 "$dev3" "$dev5" &
|
pvmove -i5 -n $vg/$lv2 "$dev3" "$dev5" &
|
||||||
PVMOVE=$!
|
PVMOVE=$!
|
||||||
aux wait_pvmove_lv_ready "$vg-pvmove1" 300
|
aux wait_pvmove_lv_ready "$vg-pvmove1"
|
||||||
kill -9 $PVMOVE
|
kill $PVMOVE
|
||||||
|
|
||||||
aux remove_dm_devs "$vg-$lv1" "$vg-$lv2" "$vg-pvmove0" "$vg-pvmove1"
|
|
||||||
test -e LOCAL_LVMPOLLD && aux prepare_lvmpolld
|
test -e LOCAL_LVMPOLLD && aux prepare_lvmpolld
|
||||||
wait
|
wait
|
||||||
|
aux remove_dm_devs "$vg-$lv1" "$vg-$lv2" "$vg-pvmove0" "$vg-pvmove1"
|
||||||
|
|
||||||
check lv_attr_bit type $vg/pvmove0 "p"
|
check lv_attr_bit type $vg/pvmove0 "p"
|
||||||
check lv_attr_bit type $vg/pvmove1 "p"
|
check lv_attr_bit type $vg/pvmove1 "p"
|
||||||
@ -73,22 +71,18 @@ test_pvmove_resume() {
|
|||||||
aux prepare_clvmd
|
aux prepare_clvmd
|
||||||
fi
|
fi
|
||||||
|
|
||||||
## rm -f debug.log_DEBUG*
|
|
||||||
# lvs -ao+devices $vg
|
|
||||||
|
|
||||||
# call resume function (see below)
|
# call resume function (see below)
|
||||||
# with expected number of spawned
|
# with expected number of spawned
|
||||||
# bg polling as parameter
|
# bg polling as parameter
|
||||||
$1 2
|
$1 2
|
||||||
|
|
||||||
aux enable_dev "$dev4"
|
aux enable_dev "$dev4" "$dev5"
|
||||||
aux enable_dev "$dev5"
|
|
||||||
|
|
||||||
for i in {0..300} ; do # wait for 30 secs at max
|
for i in {100..0} ; do # wait for 10 secs at max
|
||||||
get lv_field $vg name -a | grep -E "^\[?pvmove" || break
|
get lv_field $vg name -a | grep -E "^\[?pvmove" || break
|
||||||
sleep .1
|
sleep .1
|
||||||
done
|
done
|
||||||
test $i -ge 300 && die "Pvmove is too slow or does not progress."
|
test $i -gt 0 || die "Pvmove is too slow or does not progress."
|
||||||
|
|
||||||
aux kill_tagged_processes
|
aux kill_tagged_processes
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user