Expand PMF_FN_* macros.
[netbsd-mini2440.git] / external / gpl2 / lvm2 / dist / test / t-pvremove-usage.sh
blob73ea176bcdd70d2f9101425470f32e9fca18a6d3
1 #!/bin/sh
2 # Copyright (C) 2008 Red Hat, Inc. All rights reserved.
4 # This copyrighted material is made available to anyone wishing to use,
5 # modify, copy, or redistribute it subject to the terms and conditions
6 # of the GNU General Public License v.2.
8 # You should have received a copy of the GNU General Public License
9 # along with this program; if not, write to the Free Software Foundation,
10 # Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
12 . ./test-utils.sh
14 aux prepare_devs 3
15 pvcreate $dev1
16 pvcreate --metadatacopies 0 $dev2
17 pvcreate --metadatacopies 2 $dev3
18 pvremove $dev2
20 # failing, but still removing everything what can be removed
21 # is somewhat odd as default, what do we have -f for?
22 pvs | not grep $dev2
23 pvcreate --metadatacopies 0 $dev2
25 # check pvremove refuses to remove pv in a vg
26 vgcreate -c n $vg $dev1 $dev2
27 not pvremove $dev2 $dev3
29 for mdacp in 0 1 2; do
30 # check pvremove truly wipes the label (pvscan wont find) (---metadatacopies $mdacp)
31 pvcreate --metadatacopies $mdacp $dev3
32 pvremove $dev3
33 # try to remove agail - should fail cleanly
34 not pvremove $dev3
35 pvscan | not grep $dev3
37 # bz179473 refuse to wipe non-PV device without -f
38 not pvremove $dev3
39 pvremove -f $dev3
41 # reset setup
42 vgremove -ff $vg
43 pvcreate --metadatacopies $mdacp $dev1
44 pvcreate $dev2
45 vgcreate $vg $dev1 $dev2
47 # pvremove -f fails when pv in a vg (---metadatacopies $mdacp)
48 not pvremove -f $dev1
49 pvs $dev1
51 # pvremove -ff fails without confirmation when pv in a vg (---metadatacopies $mdacp)
52 echo n | not pvremove -ff $dev1
54 # pvremove -ff succeds with confirmation when pv in a vg (---metadatacopies $mdacp)
55 yes | pvremove -ff $dev1
56 not pvs $dev1
58 vgreduce --removemissing $vg
59 pvcreate --metadatacopies $mdacp $dev1
60 vgextend $vg $dev1
62 # pvremove -ff -y is sufficient when pv in a vg (---metadatacopies $mdacp)" '
63 echo n | pvremove -ff -y $dev1
65 vgreduce --removemissing $vg
66 pvcreate --metadatacopies $mdacp $dev1
67 vgextend $vg $dev1
68 done