1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00
lvm2/test/shell/lvextend-thin-full.sh

69 lines
1.8 KiB
Bash
Raw Normal View History

2017-07-02 22:38:32 +03:00
#!/usr/bin/env bash
2015-09-14 21:09:21 +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,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
2015-09-14 21:09:21 +03:00
#
# play with thin-pool resize in corner cases
#
SKIP_WITH_LVMPOLLD=1
2015-09-14 21:09:21 +03:00
export LVM_TEST_THIN_REPAIR_CMD=${LVM_TEST_THIN_REPAIR_CMD-/bin/false}
. lib/inittest
aux have_thin 1 0 0 || skip
test -n "$LVM_TEST_THIN_RESTORE_CMD" || LVM_TEST_THIN_RESTORE_CMD=$(which thin_restore) || skip
"$LVM_TEST_THIN_RESTORE_CMD" -V || skip
aux have_thin 1 10 0 || skip
aux prepare_vg 3 4096
2015-09-14 21:09:21 +03:00
aux lvmconf 'activation/thin_pool_autoextend_percent = 30' \
'activation/thin_pool_autoextend_threshold = 70'
2016-06-13 15:35:09 +03:00
aux prepare_thin_metadata 400 0 | tee data
lvcreate -L200 -V10 -n $lv2 -T $vg/pool
2015-09-14 21:09:21 +03:00
lvchange -an $vg
# Prepare full metadata volume
2015-09-14 21:09:21 +03:00
lvcreate -L2M -n $lv1 $vg
"$LVM_TEST_THIN_RESTORE_CMD" -i data -o "$DM_DEV_DIR/mapper/$vg-$lv1"
lvconvert -y --thinpool $vg/pool --poolmetadata $vg/$lv1
2015-09-14 21:09:21 +03:00
# active thin pool is needed to use policy
2015-09-14 21:09:21 +03:00
not lvextend --use-policies $vg/pool 2>&1 | tee err
lvchange -ay $vg/$lv2
2015-09-14 21:09:21 +03:00
# Cannot resize if set to 0%
not lvextend --use-policies --config 'activation{thin_pool_autoextend_percent = 0}' $vg/pool 2>&1 | tee err
grep "0%" err
2015-09-14 21:09:21 +03:00
# Creation of new LV is not allowed when thinpool is over threshold
not lvcreate -V10 $vg/pool
lvextend --use-policies $vg/pool "$dev2" "$dev3"
#should lvextend -l+100%FREE $vg/pool2
check lv_field $vg/pool_tmeta size "3.00m"
lvextend -L+3G $vg/pool
check lv_field $vg/pool_tmeta size "3.50m"
2015-09-14 21:09:21 +03:00
lvs -a $vg
vgremove -ff $vg