File: vgchange-usage.sh

package info (click to toggle)
lvm2 2.02.111-2.2
  • links: PTS, VCS
  • area: main
  • in suites: jessie-kfreebsd
  • size: 8,856 kB
  • sloc: ansic: 101,481; sh: 15,369; makefile: 1,843; python: 777; ruby: 332; awk: 20
file content (113 lines) | stat: -rw-r--r-- 3,208 bytes parent folder | download | duplicates (2)
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
#!/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_description='Exercise some vgchange diagnostics'

. lib/inittest

aux prepare_pvs 4

pvcreate --metadatacopies 0 "$dev1"
vgcreate -s 4M $vg "$dev1" "$dev2" "$dev3"

# cannot change anything in exported vg
vgexport $vg
fail vgchange -ay $vg
fail vgchange -p 8 $vg
fail vgchange -x n $vg
fail vgchange --addtag tag $vg
fail vgchange --deltag tag $vg
fail vgchange -s 4k $vg
fail vgchange --uuid $vg
fail vgchange --alloc anywhere $vg
fail vgchange -c y $vg
vgimport $vg

# unsupported combinations of options...
invalid vgchange --ignorelockingfailure --uuid $vg
invalid vgchange --sysinit --alloc normal $vg
invalid vgchange --sysinit --poll y $vg
invalid vgchange -an --poll y $vg
invalid vgchange -an --monitor y $vg
invalid vgchange -ay --refresh $vg

vgdisplay $vg

# vgchange -p MaxPhysicalVolumes (bz202232)
check vg_field $vg max_pv 0
vgchange -p 128 $vg
check vg_field $vg max_pv 128

pv_count=$(get vg_field $vg pv_count)
not vgchange -p 2 $vg 2>err
grep "MaxPhysicalVolumes is less than the current number $pv_count of PVs for" err
check vg_field $vg max_pv 128

# vgchange -l MaxLogicalVolumes
check vg_field $vg max_lv 0
invalid vgchange -l -128 $vg
vgchange -l 128 $vg
check vg_field $vg max_lv 128

# vgchange -s
lvcreate -l4 -n $lv1 $vg
lvcreate -l4 -n $lv2 $vg
SIZELV2=$(get lv_field $vg/$lv2 size)
check lv_field $vg/$lv2 seg_size_pe "4"
vgchange -s 4K $vg
check vg_field $vg vg_extent_size "4.00k"
check lv_field $vg/$lv2 size "$SIZELV2"
check lv_field $vg/$lv2 seg_size_pe "4096"


lv_count=$(get vg_field $vg lv_count)
not vgchange -l 1 $vg 2>err
grep "MaxLogicalVolume is less than the current number $lv_count of LVs for"  err
check vg_field $vg max_lv 128

# check non-resizebility
fail vgchange -x y $vg
check vg_attr_bit resizeable $vg "z"
vgchange -x n $vg
check vg_attr_bit resizeable $vg "-"
fail vgchange -x n $vg
fail vgextend $vg "$dev4"
vgremove -ff $vg

# set cluster bit
vgcreate -cn $vg "$dev1" "$dev2" "$dev3"
# check prompt to change cluster bit without giving explicit vg name
fail vgchange -cy |& tee out
grep "y/n" out
check vg_attr_bit cluster $vg "-"

# check on cluster
# either skipped as clustered (non-cluster), or already clustered (on cluster)
if test -e LOCAL_CLVMD ; then
	vgchange -cy $vg
	fail vgchange -cy $vg
	check vg_attr_bit cluster $vg "c"
	vgchange -cn $vg
else
	# no clvmd is running
	fail vgchange -cy $vg
	vgchange --yes -cy $vg
	fail vgchange --yes -cy $vg
	fail vgs $vg |& tee out
	grep "Skipping clustered volume group" out
	vgs --ignoreskippedcluster $vg |& tee out
	not grep "Skipping clustered volume group" out
	# reset back to non-clustered VG with disabled locking
	vgchange -cn --config 'global{locking_type=0}' $vg
fi
check vg_attr_bit cluster $vg "-"

vgremove -ff $vg