2017-07-02 22:38:32 +03:00
#!/usr/bin/env bash
2016-08-09 18:45:37 +03:00
# Copyright (C) 2012,2016 Red Hat, Inc. All rights reserved.
2012-10-08 16:46:44 +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-10-08 16:46:44 +04:00
# 'Exercise some lvcreate diagnostics'
2018-06-01 00:18:53 +03:00
2015-10-27 17:10:06 +03:00
SKIP_WITH_LVMPOLLD = 1
2012-10-08 16:46:44 +04:00
2015-10-27 17:10:06 +03:00
. lib/inittest
2015-05-09 02:59:18 +03:00
2013-11-16 02:47:14 +04:00
# FIXME update test to make something useful on <16T
aux can_use_16T || skip
2014-05-24 00:35:05 +04:00
aux have_raid 1 3 0 || skip
2017-11-14 16:17:54 +03:00
v1_9_0 = 0
aux have_raid 1 9 0 && v1_9_0 = 1
2012-10-08 16:46:44 +04:00
2016-10-28 22:54:10 +03:00
segtypes = "raid5"
aux have_raid4 && segtypes = "raid4 raid5"
2016-09-09 18:12:10 +03:00
# Prepare 5x ~1P sized devices
aux prepare_pvs 5 1000000000
2017-07-06 20:41:25 +03:00
get_devs
2012-10-08 16:46:44 +04:00
2018-06-01 00:18:53 +03:00
vgcreate $SHARED " $vg1 " " ${ DEVICES [@] } "
2012-10-08 16:46:44 +04:00
2016-09-09 18:12:10 +03:00
aux lvmconf 'devices/issue_discards = 1'
2016-08-09 18:45:37 +03:00
2016-09-09 18:12:10 +03:00
# Delay PVs so that resynchronization doesn't fill too much space
2017-07-06 20:41:25 +03:00
for device in " ${ DEVICES [@] } "
2016-08-09 18:45:37 +03:00
do
2017-07-10 11:40:09 +03:00
aux delay_dev " $device " 0 10 " $( get first_extent_sector " $device " ) "
2016-08-09 18:45:37 +03:00
done
2012-10-08 16:46:44 +04:00
# bz837927 START
#
# Create large RAID LVs
#
2016-08-09 18:45:37 +03:00
# 200 TiB raid1
2012-10-08 16:46:44 +04:00
lvcreate --type raid1 -m 1 -L 200T -n $lv1 $vg1 --nosync
check lv_field $vg1 /$lv1 size "200.00t"
2016-09-13 12:27:36 +03:00
check raid_leg_status $vg1 $lv1 "AA"
2016-08-09 18:45:37 +03:00
lvremove -ff $vg1
# 1 PiB raid1
lvcreate --type raid1 -m 1 -L 1P -n $lv1 $vg1 --nosync
check lv_field $vg1 /$lv1 size "1.00p"
2016-09-13 12:27:36 +03:00
check raid_leg_status $vg1 $lv1 "AA"
2012-10-08 16:46:44 +04:00
lvremove -ff $vg1
2016-08-09 18:45:37 +03:00
# 750 TiB raid4/5
2016-10-28 22:54:10 +03:00
for segtype in $segtypes ; do
2012-10-08 16:46:44 +04:00
lvcreate --type $segtype -i 3 -L 750T -n $lv1 $vg1 --nosync
check lv_field $vg1 /$lv1 size "750.00t"
2016-09-13 12:27:36 +03:00
check raid_leg_status $vg1 $lv1 "AAAA"
2012-10-08 16:46:44 +04:00
lvremove -ff $vg1
done
2016-09-09 18:12:10 +03:00
#
# Extending large 200 TiB RAID LV to 400 TiB (belong in different script?)
#
lvcreate --type raid1 -m 1 -L 200T -n $lv1 $vg1 --nosync
check lv_field $vg1 /$lv1 size "200.00t"
2016-09-13 12:27:36 +03:00
check raid_leg_status $vg1 $lv1 "AA"
2016-09-09 18:12:10 +03:00
lvextend -L +200T $vg1 /$lv1
check lv_field $vg1 /$lv1 size "400.00t"
2016-09-13 12:27:36 +03:00
check raid_leg_status $vg1 $lv1 "AA"
2016-09-09 18:12:10 +03:00
lvremove -ff $vg1
# Check --nosync is rejected for raid6
2017-11-14 16:17:54 +03:00
if [ $v1_9_0 -eq 1 ] ; then
2016-09-09 18:12:10 +03:00
not lvcreate --type raid6 -i 3 -L 750T -n $lv1 $vg1 --nosync
fi
# 750 TiB raid6
2016-08-09 18:45:37 +03:00
lvcreate --type raid6 -i 3 -L 750T -n $lv1 $vg1
check lv_field $vg1 /$lv1 size "750.00t"
2016-09-13 12:27:36 +03:00
check raid_leg_status $vg1 $lv1 "aaaaa"
2016-08-09 18:45:37 +03:00
lvremove -ff $vg1
2016-09-09 18:12:10 +03:00
# 1 PiB raid6, then extend up to 2 PiB
2016-08-09 18:45:37 +03:00
lvcreate --type raid6 -i 3 -L 1P -n $lv1 $vg1
check lv_field $vg1 /$lv1 size "1.00p"
2016-09-13 12:27:36 +03:00
check raid_leg_status $vg1 $lv1 "aaaaa"
2016-08-09 18:45:37 +03:00
lvextend -L +1P $vg1 /$lv1
check lv_field $vg1 /$lv1 size "2.00p"
2016-09-13 12:27:36 +03:00
check raid_leg_status $vg1 $lv1 "aaaaa"
2016-08-09 18:45:37 +03:00
lvremove -ff $vg1
2012-10-08 16:46:44 +04:00
#
2016-08-09 18:45:37 +03:00
# Convert large 200 TiB linear to RAID1 (belong in different test script?)
2012-10-08 16:46:44 +04:00
#
2013-09-11 01:33:22 +04:00
lvcreate -aey -L 200T -n $lv1 $vg1
2017-04-06 19:47:41 +03:00
lvconvert -y --type raid1 -m 1 $vg1 /$lv1
2012-10-08 16:46:44 +04:00
check lv_field $vg1 /$lv1 size "200.00t"
2017-11-14 16:17:54 +03:00
if [ $v1_9_0 -eq 1 ] ; then
2017-06-14 16:33:42 +03:00
# The 1.9.0 version of dm-raid is capable of performing
# linear -> RAID1 upconverts as "recover" not "resync"
# The LVM code now checks the dm-raid version when
# upconverting and if 1.9.0+ is found, it uses "recover"
check raid_leg_status $vg1 $lv1 "Aa"
else
check raid_leg_status $vg1 $lv1 "aa"
fi
2012-10-08 16:46:44 +04:00
lvremove -ff $vg1
# bz837927 END
2016-08-09 19:16:01 +03:00
vgremove -ff $vg1