2012-03-16 17:00:05 +04:00
#!/bin/sh
2012-04-11 16:53:46 +04:00
# Copyright (C) 2007-2012 Red Hat, Inc. All rights reserved.
2011-09-15 22:51:11 +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
2011-09-15 22:51:11 +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
2011-09-15 22:51:11 +04:00
2015-10-27 17:10:06 +03:00
. lib/inittest
2015-05-09 02:59:18 +03:00
2012-04-11 16:53:46 +04:00
aux prepare_pvs 3 22
2011-09-15 22:51:11 +04:00
2015-03-26 17:05:24 +03:00
vgcreate -s 32K $vg $( cat DEVICES)
2011-09-15 22:51:11 +04:00
2013-06-15 13:21:03 +04:00
lvcreate -an -Zn -l4 -i3 -I64 $vg
2011-09-15 22:51:11 +04:00
2013-06-15 13:21:03 +04:00
lvcreate -an -Zn -l8 -i2 -I64 $vg
2012-04-11 16:53:46 +04:00
2013-06-15 13:21:03 +04:00
lvcreate -an -Zn -l16 $vg
2012-04-11 16:53:46 +04:00
2013-06-15 13:21:03 +04:00
lvcreate -an -Zn -l32 -i3 -I64 -n $lv1 $vg
2012-04-11 16:53:46 +04:00
lvresize -l+64 -i3 -I64 $vg /$lv1
lvresize -l+64 -i3 -I128 $vg /$lv1
#lvcreate -l100%FREE -i3 -I64 --alloc anywhere $vg
vgremove -f $vg
# 15 extents
2015-03-26 17:05:24 +03:00
LVM_TEST_AUX_TRACE = yes
2012-04-11 16:53:46 +04:00
aux prepare_vg 3 22
2015-03-26 17:05:24 +03:00
unset LVM_TEST_AUX_TRACE
2012-04-11 16:53:46 +04:00
# Block some extents
2013-06-15 13:21:03 +04:00
lvcreate -an -Zn -l4 -i3 $vg
lvcreate -an -Zn -l1 $vg
2012-04-11 16:53:46 +04:00
2013-06-15 13:21:03 +04:00
lvcreate -an -Zn -l100%FREE -n $lv1 -i3 $vg
2012-04-11 16:53:46 +04:00
check vg_field $vg vg_free_count 2
lvremove -f $vg /$lv1
2013-06-15 13:21:03 +04:00
lvcreate -an -Zn -l1 -n $lv1 -i3 $vg
2012-04-11 16:53:46 +04:00
lvextend -l+100%FREE -i3 $vg /$lv1
check vg_field $vg vg_free_count 2
lvreduce -f -l50%LV $vg /$lv1
vgremove -f $vg
vgcreate -s 4M $vg " $dev1 " " $dev2 " " $dev3 "
# Expect to play with 15 extents
check vg_field $vg vg_free_count 15
# Should be rounded to 12 extents
2013-06-15 13:21:03 +04:00
lvcreate -an -Zn -l10 -n lv -i3 $vg
2012-04-11 16:53:46 +04:00
check vg_field $vg vg_free_count 3
# Should want 16 extents
not lvextend -l+4 $vg /lv
# Round up to whole free space
lvextend -l+100%FREE $vg /lv
check vg_field $vg vg_free_count 0
# Rounds up and should reduce just by 3 extents
lvreduce -f -l-4 $vg /lv
check vg_field $vg vg_free_count 3
# Should round up to 15 extents
lvextend -f -l+1 $vg /lv
check vg_field $vg vg_free_count 0
lvreduce -f -l-4 $vg /lv
check vg_field $vg vg_free_count 3
lvextend -l90%VG $vg /lv
check vg_field $vg vg_free_count 0
2012-04-24 16:17:49 +04:00
not lvreduce -f -l-10%LV $vg /lv
2012-04-11 16:53:46 +04:00
check vg_field $vg vg_free_count 0
lvreduce -f -l-20%LV $vg /lv
check vg_field $vg vg_free_count 3