~ubuntu-branches/ubuntu/vivid/lvm2/vivid

« back to all changes in this revision

Viewing changes to test/t-pvremove-usage.sh

  • Committer: Package Import Robot
  • Author(s): Bastian Blank
  • Date: 2012-05-01 20:27:50 UTC
  • mto: (3.1.23 sid)
  • mto: This revision was merged to the branch mainline in revision 72.
  • Revision ID: package-import@ubuntu.com-20120501202750-gljjjtblowwq9mw8
Tags: upstream-2.02.95
ImportĀ upstreamĀ versionĀ 2.02.95

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#!/bin/sh
2
 
# Copyright (C) 2008 Red Hat, Inc. All rights reserved.
3
 
#
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.
7
 
#
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
11
 
 
12
 
. lib/test
13
 
 
14
 
aux prepare_devs 3
15
 
pvcreate $dev1
16
 
pvcreate --metadatacopies 0 $dev2
17
 
pvcreate --metadatacopies 2 $dev3
18
 
pvremove $dev2
19
 
 
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
24
 
 
25
 
# check pvremove refuses to remove pv in a vg
26
 
vgcreate -c n $vg $dev1 $dev2
27
 
not pvremove $dev2 $dev3
28
 
 
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
36
 
 
37
 
        # bz179473 refuse to wipe non-PV device without -f
38
 
    not pvremove $dev3
39
 
    pvremove -f $dev3
40
 
 
41
 
    # reset setup
42
 
    vgremove -ff $vg
43
 
    pvcreate --metadatacopies $mdacp $dev1
44
 
    pvcreate $dev2
45
 
    vgcreate $vg $dev1 $dev2 
46
 
 
47
 
    # pvremove -f fails when pv in a vg (---metadatacopies $mdacp)
48
 
    not pvremove -f $dev1
49
 
    pvs $dev1
50
 
 
51
 
    # pvremove -ff fails without confirmation when pv in a vg (---metadatacopies $mdacp)
52
 
    echo n | not pvremove -ff $dev1
53
 
 
54
 
    # pvremove -ff succeds with confirmation when pv in a vg (---metadatacopies $mdacp)
55
 
    pvremove -ffy $dev1
56
 
    not pvs $dev1
57
 
 
58
 
    vgreduce --removemissing $vg
59
 
    pvcreate --metadatacopies $mdacp $dev1
60
 
    vgextend $vg $dev1
61
 
 
62
 
    # pvremove -ff -y is sufficient when pv in a vg (---metadatacopies $mdacp)" '
63
 
    pvremove -ff -y $dev1
64
 
 
65
 
    vgreduce --removemissing $vg
66
 
    pvcreate --metadatacopies $mdacp $dev1
67
 
    vgextend $vg $dev1
68
 
done