|
|
26e710 |
test/shell/exported.sh | 207 +++++++++++++++++++++++++++++++++++++++++++++++++
|
|
|
26e710 |
1 file changed, 207 insertions(+)
|
|
|
26e710 |
create mode 100644 test/shell/exported.sh
|
|
|
26e710 |
|
|
|
26e710 |
diff --git a/test/shell/exported.sh b/test/shell/exported.sh
|
|
|
26e710 |
new file mode 100644
|
|
|
26e710 |
index 0000000..b6d17ce
|
|
|
26e710 |
--- /dev/null
|
|
|
26e710 |
+++ b/test/shell/exported.sh
|
|
|
26e710 |
@@ -0,0 +1,207 @@
|
|
|
26e710 |
+#!/usr/bin/env bash
|
|
|
26e710 |
+
|
|
|
26e710 |
+# Copyright (C) 2008-2013,2018 Red Hat, Inc. All rights reserved.
|
|
|
26e710 |
+#
|
|
|
26e710 |
+# This copyrighted material is made available to anyone wishing to use,
|
|
|
26e710 |
+# modify, copy, or redistribute it subject to the terms and conditions
|
|
|
26e710 |
+# of the GNU General Public License v.2.
|
|
|
26e710 |
+#
|
|
|
26e710 |
+# You should have received a copy of the GNU General Public License
|
|
|
26e710 |
+# along with this program; if not, write to the Free Software Foundation,
|
|
|
26e710 |
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
|
26e710 |
+
|
|
|
26e710 |
+. lib/inittest
|
|
|
26e710 |
+
|
|
|
26e710 |
+# Check what is and is not permitted on an exported VG/PV
|
|
|
26e710 |
+
|
|
|
26e710 |
+aux prepare_devs 3
|
|
|
26e710 |
+get_devs
|
|
|
26e710 |
+
|
|
|
26e710 |
+vgcreate $vg1 "$dev1"
|
|
|
26e710 |
+vgcreate $vg2 "$dev2"
|
|
|
26e710 |
+
|
|
|
26e710 |
+lvcreate -l1 -n $lv1 -an $vg1
|
|
|
26e710 |
+lvcreate -l1 -n $lv2 -an $vg2
|
|
|
26e710 |
+
|
|
|
26e710 |
+vgchange --addtag aa $vg1
|
|
|
26e710 |
+lvchange --addtag bb $vg1/$lv1
|
|
|
26e710 |
+
|
|
|
26e710 |
+# vgexport only when no lvs are active
|
|
|
26e710 |
+lvchange -ay $vg1/$lv1
|
|
|
26e710 |
+not vgexport $vg1
|
|
|
26e710 |
+lvchange -an $vg1/$lv1
|
|
|
26e710 |
+
|
|
|
26e710 |
+vgexport $vg1
|
|
|
26e710 |
+
|
|
|
26e710 |
+lvm fullreport |tee out
|
|
|
26e710 |
+grep $vg1 out
|
|
|
26e710 |
+
|
|
|
26e710 |
+lvm fullreport $vg1 |tee out
|
|
|
26e710 |
+grep $vg1 out
|
|
|
26e710 |
+
|
|
|
26e710 |
+not lvchange -ay $vg1
|
|
|
26e710 |
+not lvchange -ay $vg1/$lv1
|
|
|
26e710 |
+not lvchange --addtag bar $vg1/$lv1
|
|
|
26e710 |
+not lvchange --monitor y $vg1/$lv1
|
|
|
26e710 |
+
|
|
|
26e710 |
+not lvconvert --type mirror $vg1/$lv1
|
|
|
26e710 |
+
|
|
|
26e710 |
+not lvcreate -l1 $vg1
|
|
|
26e710 |
+
|
|
|
26e710 |
+not lvdisplay $vg1
|
|
|
26e710 |
+
|
|
|
26e710 |
+lvdisplay 2>&1|tee out
|
|
|
26e710 |
+not grep $vg1 out
|
|
|
26e710 |
+
|
|
|
26e710 |
+not lvextend -l+1 $vg1/$lv1
|
|
|
26e710 |
+
|
|
|
26e710 |
+lvmdiskscan 2>&1|tee foo
|
|
|
26e710 |
+grep "$dev1" foo
|
|
|
26e710 |
+
|
|
|
26e710 |
+not lvreduce -l-1 $vg1/$lv1
|
|
|
26e710 |
+
|
|
|
26e710 |
+not lvremove $vg1
|
|
|
26e710 |
+not lvremove $vg1/$lv1
|
|
|
26e710 |
+
|
|
|
26e710 |
+not lvrename $vg1 $lv1 $lv2
|
|
|
26e710 |
+
|
|
|
26e710 |
+not lvresize --size 1M $vg1/$lv1
|
|
|
26e710 |
+
|
|
|
26e710 |
+not lvs $vg1
|
|
|
26e710 |
+
|
|
|
26e710 |
+lvs 2>&1|tee out
|
|
|
26e710 |
+not grep $vg1 out
|
|
|
26e710 |
+
|
|
|
26e710 |
+lvscan 2>&1|tee out
|
|
|
26e710 |
+not grep $vg1 out
|
|
|
26e710 |
+
|
|
|
26e710 |
+not pvchange --addtag cc "$dev1"
|
|
|
26e710 |
+pvs -o+tags "$dev1" 2>&1|tee out
|
|
|
26e710 |
+grep "$dev1" out
|
|
|
26e710 |
+not grep cc out
|
|
|
26e710 |
+
|
|
|
26e710 |
+pvs -osize "$dev1" > before
|
|
|
26e710 |
+not pvresize --setphysicalvolumesize 100M "$dev1"
|
|
|
26e710 |
+pvs -osize "$dev1" > after
|
|
|
26e710 |
+diff before after
|
|
|
26e710 |
+
|
|
|
26e710 |
+pvck "$dev1"
|
|
|
26e710 |
+pvck --dump headers "$dev1" > out
|
|
|
26e710 |
+grep "label_header at 512" out
|
|
|
26e710 |
+
|
|
|
26e710 |
+not pvcreate "$dev1"
|
|
|
26e710 |
+
|
|
|
26e710 |
+pvdisplay "$dev1" 2>&1|tee out
|
|
|
26e710 |
+grep "$dev1" out
|
|
|
26e710 |
+
|
|
|
26e710 |
+not pvmove "$dev1"
|
|
|
26e710 |
+
|
|
|
26e710 |
+not pvremove "$dev1"
|
|
|
26e710 |
+
|
|
|
26e710 |
+pvs "$dev1" 2>&1|tee out
|
|
|
26e710 |
+grep "$dev1" out
|
|
|
26e710 |
+
|
|
|
26e710 |
+pvscan 2>&1|tee out
|
|
|
26e710 |
+grep "$dev1" out
|
|
|
26e710 |
+
|
|
|
26e710 |
+pvscan --cache 2>&1|tee out
|
|
|
26e710 |
+grep "$dev1" out
|
|
|
26e710 |
+
|
|
|
26e710 |
+vgcfgbackup $vg1
|
|
|
26e710 |
+
|
|
|
26e710 |
+vgcfgrestore $vg1
|
|
|
26e710 |
+
|
|
|
26e710 |
+not vgchange -ay $vg1
|
|
|
26e710 |
+not vgchange --addtag asdf $vg1
|
|
|
26e710 |
+not vgchange --monitor y $vg1
|
|
|
26e710 |
+
|
|
|
26e710 |
+not vgck $vg1
|
|
|
26e710 |
+
|
|
|
26e710 |
+not vgcreate $vg1 "$dev3"
|
|
|
26e710 |
+
|
|
|
26e710 |
+vgdisplay $vg1 2>&1|tee out
|
|
|
26e710 |
+grep $vg1 out
|
|
|
26e710 |
+
|
|
|
26e710 |
+not vgexport $vg1
|
|
|
26e710 |
+
|
|
|
26e710 |
+vgexport $vg2
|
|
|
26e710 |
+not lvcreate -l1 -n $lv3 -an $vg2
|
|
|
26e710 |
+vgimport $vg2
|
|
|
26e710 |
+lvcreate -l1 -n $lv3 -an $vg2
|
|
|
26e710 |
+lvremove $vg2/$lv3
|
|
|
26e710 |
+
|
|
|
26e710 |
+not vgextend $vg1 "$dev3"
|
|
|
26e710 |
+
|
|
|
26e710 |
+not vgmerge $vg1 $vg2
|
|
|
26e710 |
+
|
|
|
26e710 |
+not vgmknodes $vg1
|
|
|
26e710 |
+
|
|
|
26e710 |
+not vgreduce --removemissing $vg1
|
|
|
26e710 |
+
|
|
|
26e710 |
+not vgremove $vg1
|
|
|
26e710 |
+
|
|
|
26e710 |
+vgrename $vg1 $vg3
|
|
|
26e710 |
+vgrename $vg3 $vg1
|
|
|
26e710 |
+
|
|
|
26e710 |
+vgs $vg1 2>&1|tee out
|
|
|
26e710 |
+grep $vg1 out
|
|
|
26e710 |
+
|
|
|
26e710 |
+vgscan 2>&1|tee out
|
|
|
26e710 |
+grep $vg1 out
|
|
|
26e710 |
+
|
|
|
26e710 |
+# pvscan --cache tracks online state of exported PVs,
|
|
|
26e710 |
+# but autoactivation should not activate LVs.
|
|
|
26e710 |
+pvscan --cache -aay "$dev1"
|
|
|
26e710 |
+vgimport $vg1
|
|
|
26e710 |
+check inactive $vg1 $lv1
|
|
|
26e710 |
+vgexport $vg1
|
|
|
26e710 |
+
|
|
|
26e710 |
+# using a tag does not give access to exported vg
|
|
|
26e710 |
+lvchange -ay @foo
|
|
|
26e710 |
+vgimport $vg1
|
|
|
26e710 |
+check inactive $vg1 $lv1
|
|
|
26e710 |
+vgexport $vg1
|
|
|
26e710 |
+
|
|
|
26e710 |
+# using select does not give access to exported vg
|
|
|
26e710 |
+lvchange -ay --select lvname=$lv1
|
|
|
26e710 |
+vgimport $vg1
|
|
|
26e710 |
+check inactive $vg1 $lv1
|
|
|
26e710 |
+vgexport $vg1
|
|
|
26e710 |
+
|
|
|
26e710 |
+# tag or select do not work with vgremove on exported vg
|
|
|
26e710 |
+vgremove @foo
|
|
|
26e710 |
+vgs $vg1
|
|
|
26e710 |
+vgremove --select vgname=$vg1
|
|
|
26e710 |
+vgs $vg1
|
|
|
26e710 |
+
|
|
|
26e710 |
+# exported vg is skipped without error when not named
|
|
|
26e710 |
+vgchange -ay
|
|
|
26e710 |
+vgimport $vg1
|
|
|
26e710 |
+check inactive $vg1 $lv1
|
|
|
26e710 |
+vgexport $vg1
|
|
|
26e710 |
+
|
|
|
26e710 |
+# exported vg is skipped without error when not named
|
|
|
26e710 |
+vgchange --addtag newtag
|
|
|
26e710 |
+vgs -o tags $vg1 > out
|
|
|
26e710 |
+not grep newtag out
|
|
|
26e710 |
+vgchange --deltag aa
|
|
|
26e710 |
+vgs -o tags $vg1 > out
|
|
|
26e710 |
+grep aa out
|
|
|
26e710 |
+
|
|
|
26e710 |
+# exported vg is skipped without error when not named
|
|
|
26e710 |
+vgchange --monitor y
|
|
|
26e710 |
+vgchange --monitor n
|
|
|
26e710 |
+
|
|
|
26e710 |
+vgimport $vg1
|
|
|
26e710 |
+vgextend $vg1 "$dev3"
|
|
|
26e710 |
+vgexport $vg1
|
|
|
26e710 |
+
|
|
|
26e710 |
+not vgreduce $vg1 "$dev3"
|
|
|
26e710 |
+
|
|
|
26e710 |
+not vgsplit $vg1 "$vg3" "$dev3"
|
|
|
26e710 |
+
|
|
|
26e710 |
+# For vgimportclone see vgimportclone.sh
|
|
|
26e710 |
+
|
|
|
26e710 |
+vgimport $vg1
|
|
|
26e710 |
+vgremove -ff $vg1
|
|
|
26e710 |
+vgremove -ff $vg2
|