2015-03-30 17:59:06 +03:00
#!/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 "
2015-04-03 20:38:28 +03:00
# Slowdown read/writes
2015-04-22 10:01:03 +03:00
aux delay_dev " $dev3 " 0 800 $( get first_extent_sector " $dev3 " ) :
2015-04-03 20:38:28 +03:00
2015-03-30 17:59:06 +03:00
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 "
2015-04-15 16:07:49 +03:00
cmd1 = ( pvmove -i1 $backgroundarg $mode " $dev1 " " $dev3 " )
cmd2 = ( pvmove -i1 $backgroundarg $mode " $dev2 " " $dev3 " )
2015-04-14 15:15:52 +03:00
2015-04-14 14:29:19 +03:00
if test -z " $backgroundarg " ; then
2015-04-15 16:07:49 +03:00
" ${ cmd1 [@] } " &
2015-04-14 14:29:19 +03:00
aux wait_pvmove_lv_ready " $vg -pvmove0 "
2015-04-15 16:07:49 +03:00
" ${ cmd2 [@] } " &
2015-04-14 14:29:19 +03:00
aux wait_pvmove_lv_ready " $vg -pvmove1 "
else
2015-04-15 16:07:49 +03:00
" ${ cmd1 [@] } "
aux add_to_kill_list ${ cmd1 [*] } -P 1
" ${ cmd2 [@] } "
aux add_to_kill_list ${ cmd2 [*] } -P 1
2015-04-14 14:29:19 +03:00
fi
2015-04-02 17:02:06 +03:00
2015-03-30 17:59:06 +03:00
# 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
2015-04-14 14:29:19 +03:00
aux kill_listed_processes
2015-03-30 17:59:06 +03:00
done
done
2015-04-03 20:38:28 +03:00
# Restore delayed device back
aux enable_dev " $dev3 "
2015-03-30 17:59:06 +03:00
vgremove -ff $vg