Initial import of binutils 2.22 on the new vendor branch
[dragonfly.git] / contrib / lvm2 / dist / test / t-pvchange-usage.sh
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 # 'Test pvchange option values'
13
14 . ./test-utils.sh
15
16 aux prepare_devs 4
17
18 for mda in 0 1 2 
19 do
20 # "setup pv with metadatacopies = $mda" 
21         pvcreate $dev4 
22         pvcreate --metadatacopies $mda $dev1 
23         vgcreate $vg1 $dev1 $dev4 
24
25 # "pvchange adds/dels tag to pvs with metadatacopies = $mda " 
26         pvchange $dev1 --addtag test$mda 
27         check_pv_field_ $dev1 pv_tags test$mda 
28         pvchange $dev1 --deltag test$mda 
29         check_pv_field_ $dev1 pv_tags " "
30
31 # "vgchange disable/enable allocation for pvs with metadatacopies = $mda (bz452982)"
32         pvchange $dev1 -x n 
33         check_pv_field_ $dev1 pv_attr  --  
34         pvchange $dev1 -x y 
35         check_pv_field_ $dev1 pv_attr  a- 
36
37 # 'remove pv'
38         vgremove $vg1 
39         pvremove $dev1 $dev4
40 done
41
42 # "pvchange uuid"
43 pvcreate --metadatacopies 0 $dev1 
44 pvcreate --metadatacopies 2 $dev2 
45 vgcreate $vg1 $dev1 $dev2 
46 pvchange -u $dev1 
47 pvchange -u $dev2 
48 vg_validate_pvlv_counts_ $vg1 2 0 0
49
50 # "pvchange rejects uuid change under an active lv" 
51 lvcreate -l 16 -i 2 -n $lv --alloc anywhere $vg1 
52 vg_validate_pvlv_counts_ $vg1 2 1 0 
53 not pvchange -u $dev1
54 lvchange -an "$vg1"/"$lv" 
55 pvchange -u $dev1
56
57 # "cleanup" 
58 lvremove -f "$vg1"/"$lv"
59 vgremove $vg1
60
61 # "pvchange reject --addtag to lvm1 pv"
62 pvcreate -M1 $dev1 
63 not pvchange $dev1 --addtag test
64