File: exported.sh

package info (click to toggle)
lvm2 2.03.31-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 15,920 kB
  • sloc: ansic: 180,675; sh: 42,231; python: 6,554; makefile: 2,079; cpp: 1,258; ruby: 66; awk: 20
file content (209 lines) | stat: -rw-r--r-- 3,812 bytes parent folder | download
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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
#!/usr/bin/env bash

# Copyright (C) 2008-2013,2018 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA

SKIP_WITH_LVMPOLLD=1

. lib/inittest

# Check what is and is not permitted on an exported VG/PV

aux prepare_devs 3
get_devs

vgcreate $vg1 "$dev1"
vgcreate $vg2 "$dev2"

lvcreate -l1 -n $lv1 -an $vg1
lvcreate -l1 -n $lv2 -an $vg2

vgchange --addtag aa $vg1
lvchange --addtag bb $vg1/$lv1

# vgexport only when no lvs are active
lvchange -ay $vg1/$lv1
not vgexport $vg1
lvchange -an $vg1/$lv1

vgexport $vg1

lvm fullreport |tee out
grep $vg1 out

lvm fullreport $vg1 |tee out
grep $vg1 out

not lvchange -ay $vg1
not lvchange -ay $vg1/$lv1
not lvchange --addtag bar $vg1/$lv1
not lvchange --monitor y $vg1/$lv1

not lvconvert --type mirror $vg1/$lv1

not lvcreate -l1 $vg1

not lvdisplay $vg1

lvdisplay 2>&1|tee out
not grep $vg1 out

not lvextend -l+1 $vg1/$lv1

lvmdiskscan 2>&1|tee foo
grep "$dev1" foo

not lvreduce -l-1 $vg1/$lv1

not lvremove $vg1
not lvremove $vg1/$lv1

not lvrename $vg1 $lv1 $lv2

not lvresize --size 1M $vg1/$lv1

not lvs $vg1

lvs 2>&1|tee out
not grep $vg1 out

lvscan 2>&1|tee out
not grep $vg1 out

not pvchange --addtag cc12345678 "$dev1"
pvs -o+tags "$dev1" 2>&1|tee out
grep "$dev1" out
not grep cc12345678 out

pvs -osize "$dev1" > before
not pvresize --setphysicalvolumesize 100M "$dev1"
pvs -osize "$dev1" > after
diff before after

pvck "$dev1"
pvck --dump headers "$dev1" > out
grep "label_header at 512" out

not pvcreate "$dev1"

pvdisplay "$dev1" 2>&1|tee out
grep "$dev1" out

not pvmove "$dev1"

not pvremove "$dev1"

pvs "$dev1" 2>&1|tee out
grep "$dev1" out

pvscan 2>&1|tee out
grep "$dev1" out

pvscan --cache 2>&1|tee out
grep "$dev1" out

vgcfgbackup $vg1

vgcfgrestore $vg1

not vgchange -ay $vg1
not vgchange --addtag asdf $vg1
not vgchange --monitor y $vg1

not vgck $vg1

not vgcreate $vg1 "$dev3"

vgdisplay $vg1 2>&1|tee out
grep $vg1 out

not vgexport $vg1

vgexport $vg2
not lvcreate -l1 -n $lv3 -an $vg2
vgimport $vg2
lvcreate -l1 -n $lv3 -an $vg2
lvremove $vg2/$lv3

not vgextend $vg1 "$dev3"

not vgmerge $vg1 $vg2

not vgmknodes $vg1

not vgreduce --removemissing $vg1

not vgremove $vg1

vgrename $vg1 $vg3
vgrename $vg3 $vg1

vgs $vg1 2>&1|tee out
grep $vg1 out

vgscan 2>&1|tee out
grep $vg1 out

# pvscan --cache tracks online state of exported PVs,
# but autoactivation should not activate LVs.
pvscan --cache -aay "$dev1"
vgimport $vg1
check inactive $vg1 $lv1
vgexport $vg1

# using a tag does not give access to exported vg
lvchange -ay @foo
vgimport $vg1
check inactive $vg1 $lv1
vgexport $vg1

# using select does not give access to exported vg
lvchange -ay --select lvname=$lv1
vgimport $vg1
check inactive $vg1 $lv1
vgexport $vg1

# tag or select do not work with vgremove on exported vg
vgremove @foo
vgs $vg1
vgremove --select vgname=$vg1
vgs $vg1

# exported vg is skipped without error when not named
vgchange -ay
vgimport $vg1
check inactive $vg1 $lv1
vgexport $vg1

# exported vg is skipped without error when not named
vgchange --addtag newtag
vgs -o tags $vg1 > out
not grep newtag out
vgchange --deltag aa
vgs -o tags $vg1 > out
grep aa out

# exported vg is skipped without error when not named
vgchange --monitor y
vgchange --monitor n

vgimport $vg1
vgextend $vg1 "$dev3"
vgexport $vg1

not vgreduce $vg1 "$dev3"

not vgsplit $vg1 "$vg3" "$dev3"

# For vgimportclone see vgimportclone.sh

vgimport $vg1
vgremove -ff $vg1
vgremove -ff $vg2