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

tests: shell-fu

Preserve quotes for devs and use  shell arrays to pass things around.
This commit is contained in:
Zdenek Kabelac 2015-04-15 15:07:49 +02:00
parent 43a6f9e726
commit 191f3cf52a
2 changed files with 21 additions and 20 deletions

View File

@ -37,24 +37,25 @@ lvcreate -an -Zn -l30 -n $lv2 $vg "$dev2"
lvcreate -an -Zn -l30 -n $lv1 $vg1 "$dev4"
lvextend -l+30 -n $vg1/$lv1 "$dev5"
cmd1="pvmove -i1 $backgroundarg \"$dev1\" \"$dev3\" $mode"
cmd2="pvmove -i1 $backgroundarg \"$dev2\" \"$dev3\" $mode"
cmd3="pvmove -i1 $backgroundarg -n $vg1/$lv1 \"$dev4\" \"$dev6\" $mode"
cmd1=(pvmove -i1 $backgroundarg $mode "$dev1" "$dev3")
cmd2=(pvmove -i1 $backgroundarg $mode "$dev2" "$dev3")
cmd3=(pvmove -i1 $backgroundarg $mode -n $vg1/$lv1 "$dev4" "$dev6")
if test -z "$backgroundarg" ; then
$cmd1 &
"${cmd1[@]}" &
aux wait_pvmove_lv_ready "$vg-pvmove0"
$cmd2 &
"${cmd2[@]}" &
aux wait_pvmove_lv_ready "$vg-pvmove1"
$cmd3 &
"${cmd3[@]}" &
aux wait_pvmove_lv_ready "$vg1-pvmove0"
lvs -a $vg $vg1
else
$cmd1
aux add_to_kill_list "$cmd1" -P 1
$cmd2
aux add_to_kill_list "$cmd2" -P 1
$cmd3
aux add_to_kill_list "$cmd3" -P 1
"${cmd1[@]}"
aux add_to_kill_list ${cmd1[*]} -P 1
"${cmd2[@]}"
aux add_to_kill_list ${cmd2[*]} -P 1
"${cmd3[@]}"
aux add_to_kill_list ${cmd3[*]} -P 1
fi
# test removal of all pvmove LVs

View File

@ -31,19 +31,19 @@ do
lvcreate -an -Zn -l30 -n $lv1 $vg "$dev1"
lvcreate -an -Zn -l30 -n $lv2 $vg "$dev2"
cmd1="pvmove -i1 $backgroundarg \"$dev1\" \"$dev3\" $mode"
cmd2="pvmove -i1 $backgroundarg \"$dev2\" \"$dev3\" $mode"
cmd1=(pvmove -i1 $backgroundarg $mode "$dev1" "$dev3")
cmd2=(pvmove -i1 $backgroundarg $mode "$dev2" "$dev3")
if test -z "$backgroundarg" ; then
$cmd1 &
"${cmd1[@]}" &
aux wait_pvmove_lv_ready "$vg-pvmove0"
$cmd2 &
"${cmd2[@]}" &
aux wait_pvmove_lv_ready "$vg-pvmove1"
else
$cmd1
aux add_to_kill_list "$cmd1" -P 1
$cmd2
aux add_to_kill_list "$cmd2" -P 1
"${cmd1[@]}"
aux add_to_kill_list ${cmd1[*]} -P 1
"${cmd2[@]}"
aux add_to_kill_list ${cmd2[*]} -P 1
fi
# remove specific device