2012-10-09 18:32:11 +04:00
#!/bin/sh
# Copyright (C) 2012 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
. lib/test
2012-11-19 15:31:11 +04:00
prepare_lvs( )
{
lvremove -f $vg
lvcreate -L10M -n $lv1 $vg
lvcreate -L8M -n $lv2 $vg
}
2012-10-09 18:32:11 +04:00
#
# Main
#
2012-10-10 02:20:22 +04:00
aux have_thin 1 0 0 || skip
2012-10-09 18:32:11 +04:00
2012-11-27 04:01:38 +04:00
aux prepare_pvs 4 64
2012-10-09 18:32:11 +04:00
2012-11-27 04:01:38 +04:00
# build one large PV
vgcreate $vg1 $( cut -d ' ' -f -3 DEVICES)
lvcreate -s -l 100%FREE -n $lv $vg1 --virtualsize 64T
2013-05-27 04:03:00 +04:00
aux extend_filter_LVMTEST
2012-11-27 04:01:38 +04:00
pvcreate " $DM_DEV_DIR / $vg1 / $lv "
vgcreate $vg -s 64K $( cut -d ' ' -f 4 DEVICES) " $DM_DEV_DIR / $vg1 / $lv "
2012-10-09 18:32:11 +04:00
# create mirrored LVs for data and metadata volumes
2013-08-08 00:48:31 +04:00
lvcreate -aey -L10M --type mirror -m1 --mirrorlog core -n $lv1 $vg
lvcreate -aey -L8M --type mirror -m1 --mirrorlog core -n $lv2 $vg
2012-11-19 15:31:11 +04:00
lvchange -an $vg /$lv1
# conversion fails for internal volumes
not lvconvert --thinpool $vg /${ lv1 } _mimage_0
not lvconvert --thinpool $vg /$lv1 --poolmetadata $vg /${ lv2 } _mimage_0
# can't use --readahead with --poolmetadata
not lvconvert --thinpool $vg /$lv1 --poolmetadata $vg /$lv2 --readahead 512
lvconvert --thinpool $vg /$lv1 --poolmetadata $vg /$lv2
prepare_lvs
lvconvert -c 64 --stripes 2 --thinpool $vg /$lv1 --readahead 48
lvremove -f $vg
lvcreate -L1T -n $lv1 $vg
lvconvert -c 8M --thinpool $vg /$lv1
lvremove -f $vg
# test with bigger sizes
lvcreate -L1T -n $lv1 $vg
lvcreate -L8M -n $lv2 $vg
lvcreate -L1M -n $lv3 $vg
2012-10-09 18:32:11 +04:00
2012-11-19 15:31:11 +04:00
# chunk size is bigger then size of thin pool data
not lvconvert -c 1G --thinpool $vg /$lv3
# stripes can't be used with poolmetadata
not lvconvert --stripes 2 --thinpool $vg /$lv1 --poolmetadata $vg /$lv2
# too small metadata (<2M)
not lvconvert -c 64 --thinpool $vg /$lv1 --poolmetadata $vg /$lv3
# too small chunk size fails
not lvconvert -c 4 --thinpool $vg /$lv1 --poolmetadata $vg /$lv2
# too big chunk size fails
not lvconvert -c 2G --thinpool $vg /$lv1 --poolmetadata $vg /$lv2
# negative chunk size fails
not lvconvert -c -256 --thinpool $vg /$lv1 --poolmetadata $vg /$lv2
# non power of 2 fails
not lvconvert -c 88 --thinpool $vg /$lv1 --poolmetadata $vg /$lv2
2012-10-09 18:32:11 +04:00
2012-11-19 15:31:11 +04:00
# Warning about smaller then suggested
lvconvert -c 256 --thinpool $vg /$lv1 --poolmetadata $vg /$lv2 | & tee err
grep "WARNING: Chunk size is smaller" err
2012-10-09 18:32:11 +04:00
2012-11-19 15:31:11 +04:00
lvremove -f $vg
lvcreate -L1T -n $lv1 $vg
lvcreate -L32G -n $lv2 $vg
# Warning about bigger then needed
lvconvert --thinpool $vg /$lv1 --poolmetadata $vg /$lv2 | & tee err
grep "WARNING: Maximum size" err
2012-10-09 18:32:11 +04:00
2012-11-19 15:31:11 +04:00
lvremove -f $vg
lvcreate -L24T -n $lv1 $vg
# Warning about bigger then needed (24T data and 16G -> 128K chunk)
lvconvert -c 64 --thinpool $vg /$lv1 | & tee err
grep "WARNING: Chunk size is too small" err
2012-10-09 18:32:11 +04:00
2012-11-19 15:31:11 +04:00
#lvs -a -o+chunk_size,stripe_size,seg_pe_ranges
2012-10-09 18:32:11 +04:00
2013-07-24 17:25:22 +04:00
# Convertions of pool to mirror is unsupported
not lvconvert -m1 $vg /$lv1
2012-10-09 18:32:11 +04:00
vgremove -ff $vg