2017-07-02 22:38:32 +03:00
#!/usr/bin/env bash
2014-03-28 03:37:39 +04:00
# Copyright (C) 2008-2014 Red Hat, Inc. All rights reserved.
2008-08-13 17:49:07 +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
2008-08-13 17:49:07 +04:00
#
2014-03-28 03:37:39 +04:00
# tests functionality we don't have in other special test files yet
# to improve code coverage
2008-08-13 17:49:07 +04:00
#
2018-05-24 17:49:48 +03:00
2015-10-27 17:10:06 +03:00
SKIP_WITH_LVMPOLLD = 1
2008-08-13 17:49:07 +04:00
2015-10-27 17:10:06 +03:00
. lib/inittest
2015-05-09 02:59:18 +03:00
2014-03-28 03:37:39 +04:00
aux prepare_pvs 5
2014-06-05 15:01:43 +04:00
get_devs
2008-09-29 20:02:50 +04:00
2012-03-16 17:00:05 +04:00
pvcreate --metadatacopies 0 " $dev2 "
pvcreate --metadatacopies 0 " $dev3 "
2014-03-28 03:37:39 +04:00
# FIXME takes very long time
#pvck "$dev1"
2018-05-24 17:49:48 +03:00
vgcreate $SHARED " $vg " " ${ DEVICES [@] } "
2008-08-13 17:49:07 +04:00
2024-05-24 21:46:08 +03:00
# discovers whether lvm2 is compiled with lvm shell support
echo "nonexisting" | lvm & >out && {
# shell is built-in, command should report this error
grep "No such command" out
# check whether lvm shell autocomplete works on \tab
printf " lvcr\t --si\t 10 -\tn $lv3 $vg " | lvm
}
2014-03-28 03:37:39 +04:00
lvcreate -l 5 -i5 -I256 -n $lv $vg
2014-03-26 03:22:23 +04:00
lvcreate -aey -l 5 -n $lv1 $vg
2014-03-26 02:55:45 +04:00
lvcreate -s -l 5 -n $lv2 $vg /$lv1
2014-03-28 03:37:39 +04:00
pvck " $dev1 "
2014-03-26 02:55:45 +04:00
2008-08-13 17:49:07 +04:00
# "-persistent y --major 254 --minor 20"
2008-08-20 17:34:33 +04:00
# "-persistent n"
2014-03-31 13:44:55 +04:00
for i in pr "p rw" "-monitor y" "-monitor n" -refresh; do
2012-10-15 15:18:32 +04:00
lvchange -$i $vg /$lv
done
2008-08-13 17:49:07 +04:00
2012-03-16 17:00:05 +04:00
lvrename $vg $lv $lv -rename
2014-03-31 13:44:55 +04:00
invalid lvrename $vg
invalid lvrename $vg $vg /$lv -rename $vg1 /$lv
invalid lvrename $vg /$lv -rename $vg1 /$lv $vg
invalid lvrename $vg /$lv -rename $vg /012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
invalid lvrename $vg /$lv -rename $vg /""
invalid lvrename $vg /$lv -rename " $vg /!@# $% "
invalid lvrename $vg /$lv -rename $vg /$lv -rename
fail lvrename $vg1 /$lv -rename $vg1 /$lv
2014-03-28 03:37:39 +04:00
2012-03-16 17:00:05 +04:00
vgremove -f $vg
2014-03-24 13:00:39 +04:00
2014-03-28 03:37:39 +04:00
2014-03-24 13:00:39 +04:00
# test pvresize functionality
2014-03-26 02:55:45 +04:00
# missing params
2014-03-24 13:00:39 +04:00
not pvresize
2014-03-26 02:55:45 +04:00
# negative size
2017-04-27 04:57:59 +03:00
not pvresize --setphysicalvolumesize -10M -y " $dev1 "
2014-03-26 02:55:45 +04:00
# not existing device
2017-04-27 04:57:59 +03:00
not pvresize --setphysicalvolumesize 10M -y " $dev7 "
pvresize --setphysicalvolumesize 10M -y " $dev1 "
2014-03-24 13:00:39 +04:00
pvresize " $dev1 "
2008-08-13 17:49:07 +04:00
2013-12-03 17:41:25 +04:00
2014-03-28 03:37:39 +04:00
# test various lvm utils
lvm dumpconfig
lvm devtypes
lvm formats
lvm segtypes
lvm tags
# test obsoleted tools
not lvm lvmchange
not lvm lvmsadc
not lvm lvmsar
not lvm pvdata
2024-05-24 21:46:08 +03:00
if lvm nonexistingcommand ; then
die "lvm must fail"
elif [ " $? " != "2" ] ; then
die "lvm sould return code 2"
fi