blob: e5695b6a02c9a5103268b54f1330cff53787e0c7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
|
#!/bin/sh
# Copyright (C) 2008 Red Hat, Inc. All rights reserved.
#
# This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions
# of the GNU General Public License v.2.
#
# 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
# 'Test pvchange option values'
. lib/inittest
check_changed_uuid_() {
test "$1" != "$(get pv_field "$2" uuid)" || die "UUID has not changed!"
}
aux prepare_pvs 4
# check 'allocatable' pv attribute
pvcreate "$dev1"
check pv_field "$dev1" pv_attr ---
vgcreate $vg1 "$dev1"
check pv_field "$dev1" pv_attr a--
pvchange --allocatable n "$dev1"
check pv_field "$dev1" pv_attr ---
vgremove -ff $vg1
not pvchange --allocatable y "$dev1"
pvremove -ff "$dev1"
for mda in 0 1 2
do
# "setup pv with metadatacopies = $mda"
pvcreate --metadatacopies $mda "$dev1"
# cannot change allocatability for orphan PVs
fail pvchange "$dev1" -x y
fail pvchange "$dev1" -x n
vgcreate $vg1 "$dev4" "$dev1"
# "pvchange adds/dels tag to pvs with metadatacopies = $mda "
pvchange "$dev1" --addtag test$mda
check pv_field "$dev1" pv_tags test$mda
pvchange "$dev1" --deltag test$mda
check pv_field "$dev1" pv_tags ""
# "vgchange disable/enable allocation for pvs with metadatacopies = $mda (bz452982)"
pvchange "$dev1" -x n
pvchange "$dev1" -x n # already disabled
check pv_field "$dev1" pv_attr ---
pvchange "$dev1" -x y
pvchange "$dev1" -x y # already enabled
check pv_field "$dev1" pv_attr a--
# check we are able to change number of managed metadata areas
if test $mda -gt 0 ; then
pvchange --force --metadataignore y "$dev1"
else
# already ignored
fail pvchange --metadataignore y "$dev1"
fi
# 'remove pv'
vgremove $vg1
pvremove "$dev1"
done
# "pvchange uuid"
pvcreate --metadatacopies 0 "$dev1"
pvcreate --metadatacopies 2 "$dev2"
vgcreate $vg1 "$dev1" "$dev2"
# Checking for different UUID after pvchange
UUID1=$(get pv_field "$dev1" uuid)
pvchange -u "$dev1"
check_changed_uuid_ "$UUID1" "$dev1"
UUID2=$(get pv_field "$dev2" uuid)
pvchange -u "$dev2"
check_changed_uuid_ "$UUID2" "$dev2"
UUID1=$(get pv_field "$dev1" uuid)
UUID2=$(get pv_field "$dev2" uuid)
pvchange -u --all
check_changed_uuid_ "$UUID1" "$dev1"
check_changed_uuid_ "$UUID2" "$dev2"
check pvlv_counts $vg1 2 0 0
# some args are needed
invalid pvchange
# some PV needed
invalid pvchange --addtag tag
invalid pvchange --deltag tag
# some --all & PV can go together
invalid pvchange -a "$dev1" --addtag tag
# '-a' needs more params
invalid pvchange -a
# '-a' is searching for devs, so specifying device is invalid
invalid pvchange -a "$dev1"
fail pvchange -u "$dev1-notfound"
# pvchange rejects uuid change under an active lv
lvcreate -l 16 -i 2 -n $lv --alloc anywhere $vg1
check pvlv_counts $vg1 2 1 0
not pvchange -u "$dev1"
vgremove -f $vg1
# cannot change PV tag to PV that is not in VG"
fail pvchange "$dev1" --addtag test
fail pvchange "$dev1" --deltag test
# cannot add PV tag to lvm1 format
pvcreate -M1 "$dev1"
vgcreate -M1 $vg1 "$dev1"
fail pvchange "$dev1" --addtag test
|