2012-06-26 18:44:54 +04:00
#!/bin/sh
2017-02-10 23:19:03 +03:00
# Copyright (C) 2012,2017 Red Hat, Inc. All rights reserved.
2012-06-26 18:44:54 +04:00
#
# 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
2012-06-26 18:44:54 +04:00
2016-02-23 01:13:42 +03:00
SKIP_WITH_LVMLOCKD = 1
2015-10-27 17:10:06 +03:00
SKIP_WITH_LVMPOLLD = 1
2012-06-26 18:44:54 +04:00
2015-10-27 17:10:06 +03:00
. lib/inittest
2015-05-09 02:59:18 +03:00
2014-05-24 00:35:05 +04:00
aux have_raid 1 3 0 || skip
2012-07-17 19:50:21 +04:00
2017-02-10 00:41:28 +03:00
levels = "5 6 10"
2017-02-10 23:19:03 +03:00
aux have_raid4 && levels = " 4 $levels "
aux have_raid 1 7 0 && levels = " 0 0_meta $levels "
2016-10-28 22:54:10 +03:00
2017-02-10 21:10:05 +03:00
aux prepare_pvs 6
2014-03-18 13:26:42 +04:00
vgcreate -s 256K $vg $( cat DEVICES)
2012-06-26 18:44:54 +04:00
for deactivate in true false; do
2013-06-15 13:21:03 +04:00
# Extend and reduce a 2-way RAID1
2012-06-26 18:44:54 +04:00
lvcreate --type raid1 -m 1 -l 2 -n $lv1 $vg
2015-09-11 21:54:43 +03:00
test $deactivate && {
aux wait_for_sync $vg $lv1
lvchange -an $vg /$lv1
}
2012-06-26 18:44:54 +04:00
lvresize -l +2 $vg /$lv1
2012-08-25 01:20:53 +04:00
should lvresize -y -l -2 $vg /$lv1
2012-06-26 18:44:54 +04:00
#check raid_images_contiguous $vg $lv1
2017-02-10 00:41:28 +03:00
# Extend and reduce 3-striped RAID 4/5/6/10
2016-10-28 22:54:10 +03:00
for i in $levels ; do
2013-06-15 13:21:03 +04:00
lvcreate --type raid$i -i 3 -l 3 -n $lv2 $vg
2017-02-10 00:41:28 +03:00
check lv_field $vg /$lv2 "seg_size" "768.00k"
2012-06-26 18:44:54 +04:00
2015-09-11 21:54:43 +03:00
test $deactivate && {
aux wait_for_sync $vg $lv2
lvchange -an $vg /$lv2
}
2012-06-26 18:44:54 +04:00
2013-06-15 13:21:03 +04:00
lvresize -l +3 $vg /$lv2
2017-02-10 00:41:28 +03:00
check lv_field $vg /$lv2 "seg_size" "1.50m"
2012-06-26 18:44:54 +04:00
#check raid_images_contiguous $vg $lv1
2013-06-15 13:21:03 +04:00
should lvresize -y -l -3 $vg /$lv2
2017-02-10 00:41:28 +03:00
should check lv_field $vg /$lv2 "seg_size" "768.00k"
2012-06-26 18:44:54 +04:00
#check raid_images_contiguous $vg $lv1
lvremove -ff $vg
done
done
2013-09-25 06:32:53 +04:00
# Bug 1005434
# Ensure extend is contiguous
2016-10-28 22:54:10 +03:00
lvcreate --type raid5 -l 2 -i 2 -n $lv1 $vg " $dev4 " " $dev5 " " $dev6 "
2013-09-25 06:32:53 +04:00
lvextend -l +2 --alloc contiguous $vg /$lv1
2014-03-18 13:26:42 +04:00
check lv_tree_on $vg $lv1 " $dev4 " " $dev5 " " $dev6 "
2013-09-25 06:32:53 +04:00
2014-03-18 13:26:42 +04:00
vgremove -f $vg