2017-07-02 22:38:32 +03:00
#!/usr/bin/env bash
2015-07-03 16:31:31 +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-07-03 16:31:31 +03:00
# Test warns when thin pool is overprovisiong
2018-05-24 17:49:48 +03:00
2016-03-09 14:32:10 +03:00
SKIP_WITH_LVMPOLLD = 1
2016-02-23 01:13:42 +03:00
2015-07-03 16:31:31 +03:00
export LVM_TEST_THIN_REPAIR_CMD = ${ LVM_TEST_THIN_REPAIR_CMD -/bin/false }
. lib/inittest
aux have_thin 1 3 0 || skip
# 2PVs by 32M
aux prepare_vg 2 33
lvcreate -L32 -T $vg /pool
2016-06-30 16:54:27 +03:00
# check there is link node for UNUSED thin-pool
test -e " $DM_DEV_DIR / $vg /pool "
2015-07-03 16:31:31 +03:00
# leave 12M free space
lvcreate -an -n $lv1 -L16 $vg 2>& 1 | tee out
vgs $vg
lvcreate -n thin1 -V30 $vg /pool 2>& 1 | tee out
not grep "WARNING: Sum" out
2016-06-30 16:54:27 +03:00
# check again link node is now gone for a USED thin-pool
test ! -e " $DM_DEV_DIR / $vg /pool "
2015-07-03 16:31:31 +03:00
# Pool gets overprovisioned
lvcreate -an -n thin2 -V4 $vg /pool 2>& 1 | tee out
grep "WARNING: Sum" out
grep "amount of free space in volume group (12.00 MiB)" out
# Eat all space in VG
lvcreate -an -n $lv2 -L12 $vg 2>& 1 | tee out
grep "WARNING: Sum" out
grep "no free space in volume group" out
lvcreate -an -n thin3 -V1G $vg /pool 2>& 1 | tee out
grep "WARNING: Sum" out
grep "the size of whole volume group" out
lvremove -ff $vg /thin2 $vg /thin3 $vg /$lv2
# Create 2nd thin pool in a VG
lvcreate -L4 -T $vg /pool2
lvcreate -V4 -n thin2 $vg /pool2 2>& 1 | tee out
not grep "WARNING: Sum" out
lvcreate -an -V4 -n thin3 $vg /pool2 2>& 1 | tee out
grep "WARNING: Sum of all thin volume sizes (38.00 MiB)" out
grep "free space in volume group (6.00 MiB)" out
lvcreate -an -L6 -n $lv3 $vg 2>& 1 | tee out
grep "no free space in volume group" out
lvremove -ff $vg /thin2 $vg /thin3
lvcreate -an -V4 -n thin2 $vg /pool2 2>& 1 | tee out
not grep "WARNING: Sum" out
# Check if resize notices problem
lvextend -L+8 $vg /thin2
vgs $vg
vgremove -ff $vg