2012-03-16 17:00:05 +04:00
#!/bin/sh
# Copyright (C) 2008-2012 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,
# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# tests basic functionality of read-ahead and ra regressions
#
2011-01-05 03:16:18 +03:00
. lib/test
2008-08-13 17:49:07 +04:00
2008-10-06 20:47:07 +04:00
aux prepare_devs 5
2008-09-29 20:02:50 +04:00
2012-03-16 17:00:05 +04:00
TEST_UUID = "aaaaaa-aaaa-aaaa-aaaa-aaaa-aaaa-aaaaaa"
pvcreate " $dev1 "
pvcreate --metadatacopies 0 " $dev2 "
pvcreate --metadatacopies 0 " $dev3 "
pvcreate " $dev4 "
pvcreate --norestorefile -u $TEST_UUID --metadatacopies 0 " $dev5 "
2013-05-31 23:11:51 +04:00
vgcreate $vg $( cat DEVICES)
2012-03-16 17:00:05 +04:00
lvcreate -l 5 -i5 -I256 -n $lv $vg
2008-08-13 17:49:07 +04:00
2012-10-15 15:18:32 +04:00
if aux have_readline; then
2008-09-29 20:02:50 +04:00
# test *scan and *display tools
2012-10-13 23:57:33 +04:00
cat <<EOF | lvm
2008-09-29 20:02:50 +04:00
pvscan
vgscan
lvscan
lvmdiskscan
2012-10-13 23:57:33 +04:00
vgdisplay --units k $vg
lvdisplay --units g $vg
pvdisplay -c " $dev1 "
pvdisplay -s " $dev1 "
vgdisplay -c $vg
vgdisplay -s $vg
lvdisplay -c $vg
EOF
2012-03-16 17:00:05 +04:00
for i in h b s k m g t p e H B S K M G T P E; do
2012-10-13 23:57:33 +04:00
echo pvdisplay --units $i " $dev1 "
done | lvm
2012-10-15 15:18:32 +04:00
else
pvscan
vgscan
lvscan
lvmdiskscan
vgdisplay --units k $vg
lvdisplay --units g $vg
pvdisplay -c " $dev1 "
pvdisplay -s " $dev1 "
vgdisplay -c $vg
vgdisplay -s $vg
lvdisplay -c $vg
for i in h b s k m g t p e H B S K M G T P E; do
pvdisplay --units $i " $dev1 "
done
fi
2008-08-13 17:49:07 +04:00
2008-09-29 20:02:50 +04:00
# test vgexport vgimport tools
vgchange -an $vg
vgexport $vg
vgimport $vg
vgchange -ay $vg
2008-08-13 17:49:07 +04:00
# "-persistent y --major 254 --minor 20"
2008-08-20 17:34:33 +04:00
# "-persistent n"
2008-09-29 20:02:50 +04:00
# test various lvm utils
for i in dumpconfig formats segtypes; do
2012-03-16 17:00:05 +04:00
lvm $i
2008-09-29 20:02:50 +04:00
done
2008-08-13 17:49:07 +04:00
2008-09-29 20:02:50 +04:00
for i in pr "p rw" an ay "-monitor y" "-monitor n" \
2012-10-15 16:31:41 +04:00
-refresh "-addtag MYTAG" "-deltag MYETAG" ; do
2012-10-15 15:18:32 +04:00
lvchange -$i $vg /$lv
done
2008-08-13 17:49:07 +04:00
2010-06-29 01:49:31 +04:00
pvck " $dev1 "
2012-03-16 17:00:05 +04:00
vgck $vg
lvrename $vg $lv $lv -rename
vgcfgbackup -f backup.$$ $vg
vgchange -an $vg
vgcfgrestore -f backup.$$ $vg
pvremove -y -ff " $dev5 "
not vgcfgrestore -f backup.$$ $vg
pvcreate -u $TEST_UUID --restorefile backup.$$ " $dev5 "
vgremove -f $vg
2008-09-29 20:02:50 +04:00
pvresize --setphysicalvolumesize 10M " $dev1 "
2008-08-13 17:49:07 +04:00
2008-09-29 20:02:50 +04:00
# test various errors and obsoleted tools
not lvmchange
2012-03-16 17:00:05 +04:00
not lvrename $vg
not lvrename $vg -xxx
not lvrename $vg $vg /$lv -rename $vg /$lv
2013-12-03 17:41:25 +04:00
#test vgdisplay -A to select only active VGs
# all LVs active - VG considered active
pvcreate -f $dev1 $dev2 $dev3
vgcreate $vg1 $dev1
lvcreate -l1 $vg1
lvcreate -l1 $vg1
# at least one LV active - VG considered active
vgcreate $vg2 $dev2
lvcreate -l1 $vg2
2013-12-04 12:37:32 +04:00
lvcreate -l1 -an -Zn $vg2
2013-12-03 17:41:25 +04:00
# no LVs active - VG considered inactive
vgcreate $vg3 $dev3
lvcreate -l1 -an -Zn $vg3
lvcreate -l1 -an -Zn $vg3
vgdisplay -s -A | grep $vg1
vgdisplay -s -A | grep $vg2
vgdisplay -s -A | not grep $vg3
2014-02-27 02:25:30 +04:00
vgremove -ff $vg1 $vg2 $vg3