2007-09-18 18:01:46 +04:00
#!/bin/sh
2008-09-30 21:47:34 +04:00
# Copyright (C) 2008 Red Hat, Inc. All rights reserved.
2007-09-18 18:02:22 +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,
# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
2007-09-18 18:01:46 +04:00
2008-09-30 21:47:34 +04:00
# 'Exercise some lvcreate diagnostics'
2007-09-18 18:01:46 +04:00
2008-09-30 21:47:34 +04:00
. ./test-utils.sh
2007-09-18 18:01:46 +04:00
2008-11-10 15:37:03 +03:00
aux prepare_pvs 2
aux pvcreate --metadatacopies 0 $dev1
vgcreate -cn $vg $devs
2007-09-18 18:01:46 +04:00
2008-11-10 15:37:03 +03:00
# "lvcreate rejects repeated invocation (run 2 times) (bz178216)"
2008-09-30 21:47:34 +04:00
lvcreate -n $lv -l 4 $vg
not lvcreate -n $lv -l 4 $vg
lvremove -ff $vg /$lv
2007-09-18 18:01:46 +04:00
2008-09-30 21:47:34 +04:00
# "lvcreate rejects a negative stripe_size"
not lvcreate -L 64M -n $lv -i2 --stripesize -4 $vg 2>err;
grep "^ Negative stripesize is invalid\$" err
2007-09-18 18:01:46 +04:00
2008-09-30 21:47:34 +04:00
# 'lvcreate rejects a too-large stripesize'
not lvcreate -L 64M -n $lv -i2 --stripesize 4294967291 $vg 2>err
grep "^ Stripe size cannot be larger than 512.00 GB\$" err
2008-08-28 14:07:34 +04:00
2008-09-30 21:47:34 +04:00
# 'lvcreate w/single stripe succeeds with diagnostics to stdout'
lvcreate -L 64M -n $lv -i1 --stripesize 4 $vg >out 2>err
grep "^ Redundant stripes argument: default is 1\$" out
grep "^ Ignoring stripesize argument with single stripe\$" out
lvdisplay $vg
lvremove -ff $vg
2007-09-18 18:01:46 +04:00
2008-09-30 21:47:34 +04:00
# 'lvcreate w/default (64KB) stripe size succeeds with diagnostics to stdout'
lvcreate -L 64M -n $lv -i2 $vg > out
grep "^ Using default stripesize" out
lvdisplay $vg
check_lv_field_ $vg /$lv stripesize "64.00K"
lvremove -ff $vg
2007-09-18 18:01:46 +04:00
2008-09-30 21:47:34 +04:00
# 'lvcreate rejects an invalid number of stripes'
not lvcreate -L 64M -n $lv -i129 $vg 2>err
grep "^ Number of stripes (129) must be between 1 and 128\$" err
2007-09-18 18:01:46 +04:00
2008-11-10 15:37:03 +03:00
# 'lvcreate rejects an invalid regionsize (bz186013)'
not lvcreate -L 64M -n $lv -R0 $vg 2>err
grep "Non-zero region size must be supplied." err
2007-09-18 18:01:46 +04:00
# The case on lvdisplay output is to verify that the LV was not created.
2008-09-30 21:47:34 +04:00
# 'lvcreate rejects an invalid stripe size'
not lvcreate -L 64M -n $lv -i2 --stripesize 3 $vg 2>err
grep "^ Invalid stripe size 3\.00 KB\$" err
2008-09-30 21:50:56 +04:00
case $( lvdisplay $vg ) in "" ) true ; ; *) false ; ; esac
2007-09-18 18:01:46 +04:00