mirror of
git://sourceware.org/git/lvm2.git
synced 2025-01-18 10:04:20 +03:00
8c9ab2a4dd
some tests left dangling bg processes originating in lvm2 commands being able to spawn any bg polling process (lvchange, vgchange, pvmove, lvconvert...) Initial fn 'add_to_kill_list' should collect processes with specific parameters (proc's command line and parent processes ID). After testing finishes the fn kill_listed_processes should remove these listed by 'add_to_kill_list'. Unfortunately it proved to be prone to an error especially in scenarios where cmd line of initiating command contained characters required to be espaced before passing to shell script to make it work correctly. (Or if cmd spawned more than one bg process with same cmd line. i.e.: vgchange or lvchange). The new implementation is much simpler. It uses env. variable (LVM_TEST_TAG) for marking a process desired to be killed later or during test env. teardown. (i.e.: LVM_TEST_TAG=kill_me_$PREFIX to kill only processes related to current test environment)
69 lines
1.6 KiB
Bash
69 lines
1.6 KiB
Bash
#!/bin/sh
|
|
# Copyright (C) 2015 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
|
|
|
|
# Check pvmove --abort behaviour when specific device is requested
|
|
|
|
. lib/inittest
|
|
|
|
aux prepare_pvs 3 60
|
|
|
|
vgcreate -s 128k $vg "$dev1" "$dev2"
|
|
pvcreate --metadatacopies 0 "$dev3"
|
|
vgextend $vg "$dev3"
|
|
|
|
# Slowdown read/writes
|
|
aux delay_dev "$dev3" 0 800 $(get first_extent_sector "$dev3"):
|
|
|
|
for mode in "--atomic" "" ;
|
|
do
|
|
for backgroundarg in "-b" "" ;
|
|
do
|
|
|
|
# Create multisegment LV
|
|
lvcreate -an -Zn -l30 -n $lv1 $vg "$dev1"
|
|
lvcreate -an -Zn -l30 -n $lv2 $vg "$dev2"
|
|
|
|
cmd1=(pvmove -i1 $backgroundarg $mode "$dev1" "$dev3")
|
|
cmd2=(pvmove -i1 $backgroundarg $mode "$dev2" "$dev3")
|
|
|
|
if test -z "$backgroundarg" ; then
|
|
"${cmd1[@]}" &
|
|
aux wait_pvmove_lv_ready "$vg-pvmove0"
|
|
"${cmd2[@]}" &
|
|
aux wait_pvmove_lv_ready "$vg-pvmove1"
|
|
else
|
|
LVM_TEST_TAG="kill_me_$PREFIX" "${cmd1[@]}"
|
|
LVM_TEST_TAG="kill_me_$PREFIX" "${cmd2[@]}"
|
|
fi
|
|
|
|
# remove specific device
|
|
pvmove --abort "$dev1"
|
|
|
|
# check if proper pvmove was canceled
|
|
get lv_field $vg name -a | tee out
|
|
not grep "^\[pvmove0\]" out
|
|
grep "^\[pvmove1\]" out
|
|
|
|
# remove any remaining pvmoves in progress
|
|
pvmove --abort
|
|
|
|
lvremove -ff $vg
|
|
|
|
wait
|
|
aux kill_listed_processes
|
|
done
|
|
done
|
|
|
|
# Restore delayed device back
|
|
aux enable_dev "$dev3"
|
|
|
|
vgremove -ff $vg
|