xref: /dflybsd-src/contrib/lvm2/dist/test/t-covercmd.sh (revision 86d7f5d305c6adaa56ff4582ece9859d73106103)
186d7f5d3SJohn Marino# Copyright (C) 2008 Red Hat, Inc. All rights reserved.
286d7f5d3SJohn Marino#
386d7f5d3SJohn Marino# This copyrighted material is made available to anyone wishing to use,
486d7f5d3SJohn Marino# modify, copy, or redistribute it subject to the terms and conditions
586d7f5d3SJohn Marino# of the GNU General Public License v.2.
686d7f5d3SJohn Marino#
786d7f5d3SJohn Marino# You should have received a copy of the GNU General Public License
886d7f5d3SJohn Marino# along with this program; if not, write to the Free Software Foundation,
986d7f5d3SJohn Marino# Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
1086d7f5d3SJohn Marino
1186d7f5d3SJohn Marino#
1286d7f5d3SJohn Marino# tests basic functionality of read-ahead and ra regressions
1386d7f5d3SJohn Marino#
1486d7f5d3SJohn Marino
1586d7f5d3SJohn Marino. ./test-utils.sh
1686d7f5d3SJohn Marino
1786d7f5d3SJohn MarinoTEST_UUID="aaaaaa-aaaa-aaaa-aaaa-aaaa-aaaa-aaaaaa"
1886d7f5d3SJohn Marino
1986d7f5d3SJohn Marinoget_lvs_()
2086d7f5d3SJohn Marino{
2186d7f5d3SJohn Marino  case $(lvs --units s --nosuffix --noheadings -o $1_read_ahead "$vg"/"$lv") in
2286d7f5d3SJohn Marino    *$2) true ;;
2386d7f5d3SJohn Marino    *) false ;;
2486d7f5d3SJohn Marino  esac
2586d7f5d3SJohn Marino}
2686d7f5d3SJohn Marino
2786d7f5d3SJohn Marinoaux prepare_devs 5
2886d7f5d3SJohn Marino
2986d7f5d3SJohn Marinopvcreate $dev1
3086d7f5d3SJohn Marinopvcreate --metadatacopies 0 $dev2
3186d7f5d3SJohn Marinopvcreate --metadatacopies 0 $dev3
3286d7f5d3SJohn Marinopvcreate $dev4
3386d7f5d3SJohn Marinopvcreate -u $TEST_UUID --metadatacopies 0 $dev5
3486d7f5d3SJohn Marinovgcreate -c n $vg $devs
3586d7f5d3SJohn Marinolvcreate -n $lv -l 5 -i5 -I256 $vg
3686d7f5d3SJohn Marino
3786d7f5d3SJohn Marino# test *scan and *display tools
3886d7f5d3SJohn Marinopvscan
3986d7f5d3SJohn Marinovgscan
4086d7f5d3SJohn Marinolvscan
4186d7f5d3SJohn Marinolvmdiskscan
4286d7f5d3SJohn Marinovgdisplay --units k
4386d7f5d3SJohn Marinolvdisplay --units g
4486d7f5d3SJohn Marinofor i in h b s k m g t p e H B S K M G T P E ; do
4586d7f5d3SJohn Marino    pvdisplay --units "$i" "$dev1"
4686d7f5d3SJohn Marinodone
4786d7f5d3SJohn Marino
4886d7f5d3SJohn Marino# test vgexport vgimport tools
4986d7f5d3SJohn Marinovgchange -an $vg
5086d7f5d3SJohn Marinovgexport $vg
5186d7f5d3SJohn Marinovgimport $vg
5286d7f5d3SJohn Marinovgchange -ay $vg
5386d7f5d3SJohn Marino
5486d7f5d3SJohn Marino# "-persistent y --major 254 --minor 20"
5586d7f5d3SJohn Marino# "-persistent n"
5686d7f5d3SJohn Marino# test various lvm utils
5786d7f5d3SJohn Marinofor i in dumpconfig formats segtypes; do
5886d7f5d3SJohn Marino    lvm "$i"
5986d7f5d3SJohn Marinodone
6086d7f5d3SJohn Marino
6186d7f5d3SJohn Marinofor i in pr "p rw" an ay "-monitor y" "-monitor n" \
6286d7f5d3SJohn Marino        -resync -refresh "-addtag MYTAG" "-deltag MYETAG"; do
6386d7f5d3SJohn Marino    lvchange -$i "$vg"/"$lv"
6486d7f5d3SJohn Marinodone
6586d7f5d3SJohn Marino
6686d7f5d3SJohn Marinopvck "$d1"
6786d7f5d3SJohn Marinovgck "$vg"
6886d7f5d3SJohn Marinolvrename "$vg" "$lv" "$lv-rename"
6986d7f5d3SJohn Marinovgcfgbackup -f "$(pwd)/backup.$$" "$vg"
7086d7f5d3SJohn Marinovgchange -an "$vg"
7186d7f5d3SJohn Marinovgcfgrestore  -f "$(pwd)/backup.$$" "$vg"
7286d7f5d3SJohn Marinopvremove -y -ff $dev5
7386d7f5d3SJohn Marinonot vgcfgrestore  -f "$(pwd)/backup.$$" "$vg"
7486d7f5d3SJohn Marinopvcreate -u $TEST_UUID --restorefile  "$(pwd)/backup.$$" $dev5
7586d7f5d3SJohn Marinovgremove -f "$vg"
7686d7f5d3SJohn Marinopvresize --setphysicalvolumesize 10M "$dev1"
7786d7f5d3SJohn Marino
7886d7f5d3SJohn Marino# test various errors and obsoleted tools
7986d7f5d3SJohn Marinonot lvmchange
8086d7f5d3SJohn Marinonot lvrename "$vg"
8186d7f5d3SJohn Marinonot lvrename "$vg-xxx"
8286d7f5d3SJohn Marinonot lvrename "$vg"  "$vg"/"$lv-rename" "$vg"/"$lv"
83