2017-07-02 22:38:32 +03:00
#!/usr/bin/env bash
2015-03-30 17:59:51 +03:00
# 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,
2016-01-21 13:49:46 +03:00
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
2015-03-30 17:59:51 +03:00
# Check pvmove --abort behaviour for all VGs and PVs
2016-02-23 01:13:42 +03:00
SKIP_WITH_LVMLOCKD = 1
2015-07-17 14:56:52 +03:00
# Ignore known failure when clvmd is processing sequences of commands for two VGs in parallel - 2015/07/17 agk
# CLVMD: ioctl/libdm-iface.c:1940 Internal error: Performing unsafe table load while 3 device(s) are known to be suspended: (253:19)
export DM_ABORT_ON_INTERNAL_ERRORS = 0
2015-03-30 17:59:51 +03:00
. lib/inittest
2018-05-07 14:09:46 +03:00
aux lvmconf 'activation/raid_region_size = 16'
2023-10-06 00:17:04 +03:00
aux target_at_least dm-mirror 1 2 0 || skip
2018-05-13 00:36:04 +03:00
2023-09-14 00:39:08 +03:00
aux prepare_pvs 6 90
2015-03-30 17:59:51 +03:00
2023-10-06 00:17:04 +03:00
for i in " $dev3 " " $dev6 " ; do
aux delay_dev " $i " 0 1 " $( get first_extent_sector " $i " ) : "
done
# fallback to mirror throttling
# this does not work too well with fast CPUs
test -f HAVE_DM_DELAY || { aux throttle_dm_mirror || skip ; }
2018-05-07 14:09:46 +03:00
vgcreate -s 512k $vg " $dev1 " " $dev2 "
2015-03-30 17:59:51 +03:00
pvcreate --metadatacopies 0 " $dev3 "
vgextend $vg " $dev3 "
2018-05-07 14:09:46 +03:00
vgcreate -s 512k $vg1 " $dev4 " " $dev5 "
2015-03-30 17:59:51 +03:00
pvcreate --metadatacopies 0 " $dev6 "
vgextend $vg1 " $dev6 "
for mode in "--atomic" "" ;
do
for backgroundarg in "-b" "" ;
do
# Create multisegment LV
2023-09-14 00:39:08 +03:00
lvcreate -an -Zn -l60 -n $lv1 $vg " $dev1 "
lvcreate -an -Zn -l60 -n $lv2 $vg " $dev2 "
lvcreate -an -Zn -l60 -n $lv1 $vg1 " $dev4 "
2015-03-30 17:59:51 +03:00
lvextend -l+30 -n $vg1 /$lv1 " $dev5 "
2015-04-15 16:07:49 +03:00
cmd1 = ( pvmove -i1 $backgroundarg $mode " $dev1 " " $dev3 " )
cmd2 = ( pvmove -i1 $backgroundarg $mode " $dev2 " " $dev3 " )
cmd3 = ( pvmove -i1 $backgroundarg $mode -n $vg1 /$lv1 " $dev4 " " $dev6 " )
2015-04-14 15:15:52 +03:00
2015-11-09 21:06:55 +03:00
2015-04-14 14:29:19 +03:00
if test -z " $backgroundarg " ; then
2015-04-15 16:07:49 +03:00
" ${ cmd1 [@] } " &
2023-04-25 20:51:52 +03:00
aux wait_pvmove_lv_ready " $vg -pvmove0 "
2015-04-15 16:07:49 +03:00
" ${ cmd2 [@] } " &
" ${ cmd3 [@] } " &
2023-04-25 20:51:52 +03:00
aux wait_pvmove_lv_ready " $vg -pvmove1 " " $vg1 -pvmove0 "
2015-04-14 14:29:19 +03:00
else
2015-04-27 11:33:45 +03:00
LVM_TEST_TAG = " kill_me_ $PREFIX " " ${ cmd1 [@] } "
LVM_TEST_TAG = " kill_me_ $PREFIX " " ${ cmd2 [@] } "
LVM_TEST_TAG = " kill_me_ $PREFIX " " ${ cmd3 [@] } "
2015-04-14 14:29:19 +03:00
fi
2015-03-30 17:59:51 +03:00
# test removal of all pvmove LVs
2015-04-14 14:29:19 +03:00
pvmove --abort
2015-03-30 17:59:51 +03:00
# check if proper pvmove was canceled
get lv_field $vg name -a | tee out
not grep "^\[pvmove" out
get lv_field $vg1 name -a | tee out
not grep "^\[pvmove" out
2015-04-03 15:39:05 +03:00
lvremove -ff $vg $vg1
2015-03-30 17:59:51 +03:00
wait
2015-04-30 19:42:31 +03:00
aux kill_tagged_processes
2015-03-30 17:59:51 +03:00
done
done
2018-05-07 14:09:46 +03:00
# Restore throttling
aux restore_dm_mirror
2015-04-03 20:38:28 +03:00
2015-04-03 15:39:05 +03:00
vgremove -ff $vg $vg1