summaryrefslogtreecommitdiff
path: root/test/shell/pvremove-usage.sh
diff options
context:
space:
mode:
Diffstat (limited to 'test/shell/pvremove-usage.sh')
-rw-r--r--test/shell/pvremove-usage.sh32
1 files changed, 24 insertions, 8 deletions
diff --git a/test/shell/pvremove-usage.sh b/test/shell/pvremove-usage.sh
index c6d724b..17d90e6 100644
--- a/test/shell/pvremove-usage.sh
+++ b/test/shell/pvremove-usage.sh
@@ -1,4 +1,5 @@
-#!/bin/sh
+#!/usr/bin/env bash
+
# Copyright (C) 2008 Red Hat, Inc. All rights reserved.
#
# This copyrighted material is made available to anyone wishing to use,
@@ -7,23 +8,33 @@
#
# 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
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+
+
+SKIP_WITH_LVMPOLLD=1
-. lib/test
+. lib/inittest
aux prepare_devs 3
pvcreate "$dev1"
pvcreate --metadatacopies 0 "$dev2"
pvcreate --metadatacopies 2 "$dev3"
+
+# Fails without give argument
+not pvremove
pvremove "$dev2"
# failing, but still removing everything what can be removed
# is somewhat odd as default, what do we have -f for?
pvs | not grep "$dev2"
+pvs -a | grep "$dev2"
+# bz1108394 no crash on nonPV label listing
+pvs -a -o+devices
+
pvcreate --metadatacopies 0 "$dev2"
# check pvremove refuses to remove pv in a vg
-vgcreate -c n $vg "$dev1" "$dev2"
+vgcreate $SHARED $vg "$dev1" "$dev2"
not pvremove "$dev2" "$dev3"
for mdacp in 0 1 2; do
@@ -42,17 +53,20 @@ for mdacp in 0 1 2; do
vgremove -ff $vg
pvcreate --metadatacopies $mdacp "$dev1"
pvcreate "$dev2"
- vgcreate $vg "$dev1" "$dev2"
+ vgcreate $SHARED $vg "$dev1" "$dev2"
# pvremove -f fails when pv in a vg (---metadatacopies $mdacp)
- not pvremove -f "$dev1"
+ not pvremove -f "$dev1" 2>&1 | tee out
+ grep "is used" out
pvs "$dev1"
# pvremove -ff fails without confirmation when pv in a vg (---metadatacopies $mdacp)
- echo n | not pvremove -ff "$dev1"
+ not pvremove -ff "$dev1" 2>&1 | tee out
+ grep "is used" out
# pvremove -ff succeds with confirmation when pv in a vg (---metadatacopies $mdacp)
- pvremove -ffy "$dev1"
+ pvremove -ffy "$dev1" 2>&1 | tee out
+ grep "is used" out
not pvs "$dev1"
vgreduce --removemissing $vg
@@ -66,3 +80,5 @@ for mdacp in 0 1 2; do
pvcreate --metadatacopies $mdacp "$dev1"
vgextend $vg "$dev1"
done
+
+vgremove -ff $vg