1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-10-28 20:25:52 +03:00
lvm2/test/shell/thin-overprovisioning.sh
Zdenek Kabelac 458918b319 thin: fix link validation for unused thin-pool
This patch fixes link validation for used thin-pool.
Udev rules correctly creates symlinks only for unused new thin-pool.
Such thin-pool can be used by foreing apps (like Docker) thus
has  /dev/vg/lv link.
However when thin-pool becomes used by thinLV - this link is no
longer exposed to user - but internal verfication missed this
and caused messages like this to be printed upon 'vgchange -ay':

The link /dev/vg/pool should have been created by udev but it was not
found. Falling back to direct link creation.

And same with 'vgchange -an':
The link /dev/vg/pool should have been removed by udev but it is still
present. Falling back to direct link removal.

This patch ensures only unused thin-pool has this link.
2016-07-01 00:44:46 +02:00

79 lines
2.0 KiB
Bash

#!/bin/sh
# 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
# Test warns when thin pool is overprovisiong
SKIP_WITH_LVMLOCKD=1
SKIP_WITH_LVMPOLLD=1
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
# check there is link node for UNUSED thin-pool
test -e "$DM_DEV_DIR/$vg/pool"
# 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
# check again link node is now gone for a USED thin-pool
test ! -e "$DM_DEV_DIR/$vg/pool"
# 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