| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Linux::LVM; |
|
2
|
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
22971
|
use 5.006; |
|
|
1
|
|
|
|
|
4
|
|
|
|
1
|
|
|
|
|
44
|
|
|
4
|
1
|
|
|
1
|
|
5
|
use strict; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
32
|
|
|
5
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
|
1
|
|
|
|
|
6
|
|
|
|
1
|
|
|
|
|
51
|
|
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
require Exporter; |
|
8
|
1
|
|
|
1
|
|
925
|
use AutoLoader qw(AUTOLOAD); |
|
|
1
|
|
|
|
|
1514
|
|
|
|
1
|
|
|
|
|
6
|
|
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
our @ISA = qw(Exporter); |
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
# Items to export into callers namespace by default. Note: do not export |
|
13
|
|
|
|
|
|
|
# names by default without a very good reason. Use EXPORT_OK instead. |
|
14
|
|
|
|
|
|
|
# Do not simply export all your public functions/methods/constants. |
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
# This allows declaration use Linux::LVM ':all'; |
|
17
|
|
|
|
|
|
|
# If you do not need this, moving things directly into @EXPORT or @EXPORT_OK |
|
18
|
|
|
|
|
|
|
# will save memory. |
|
19
|
|
|
|
|
|
|
our %EXPORT_TAGS = ( 'all' => [ qw( get_volume_group_list |
|
20
|
|
|
|
|
|
|
get_volume_group_information |
|
21
|
|
|
|
|
|
|
get_logical_volume_information |
|
22
|
|
|
|
|
|
|
get_physical_volume_information |
|
23
|
|
|
|
|
|
|
get_vg_information |
|
24
|
|
|
|
|
|
|
get_pv_info |
|
25
|
|
|
|
|
|
|
get_lv_info |
|
26
|
|
|
|
|
|
|
) ] ); |
|
27
|
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } ); |
|
29
|
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
our @EXPORT = qw( get_volume_group_list |
|
31
|
|
|
|
|
|
|
get_volume_group_information |
|
32
|
|
|
|
|
|
|
get_logical_volume_information |
|
33
|
|
|
|
|
|
|
get_physical_volume_information |
|
34
|
|
|
|
|
|
|
get_vg_information |
|
35
|
|
|
|
|
|
|
get_pv_info |
|
36
|
|
|
|
|
|
|
get_lv_info |
|
37
|
|
|
|
|
|
|
); |
|
38
|
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
our $VERSION = '0.17'; |
|
40
|
|
|
|
|
|
|
our $units; |
|
41
|
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
# Preloaded methods go here. |
|
43
|
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
# Autoload methods go after =cut, and are processed by the autosplit program. |
|
45
|
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
#-----------------------------------------------------------------------# |
|
47
|
|
|
|
|
|
|
# Subroutine: units # |
|
48
|
|
|
|
|
|
|
#-----------------------------------------------------------------------# |
|
49
|
|
|
|
|
|
|
# Description: Set units to be used for pe_size, lv_size, etc. # |
|
50
|
|
|
|
|
|
|
# legal values are same as lvm --units: # |
|
51
|
|
|
|
|
|
|
# hbskmgtpeHBSKMGTPE # |
|
52
|
|
|
|
|
|
|
# (h)uman-readable, (b)ytes, (s)ectors, (k)ilobytes, # |
|
53
|
|
|
|
|
|
|
# (m)egabytes, (g)igabytes, (t)erabytes, (p)etabytes, # |
|
54
|
|
|
|
|
|
|
# (e)xabytes. Capitalise to use multiples of 1000 (S.I.) # |
|
55
|
|
|
|
|
|
|
# instead of 1024. # |
|
56
|
|
|
|
|
|
|
# Can also specify custom units e.g. --units 3M # |
|
57
|
|
|
|
|
|
|
#-----------------------------------------------------------------------# |
|
58
|
|
|
|
|
|
|
# Parameters: None # |
|
59
|
|
|
|
|
|
|
#-----------------------------------------------------------------------# |
|
60
|
|
|
|
|
|
|
# Return Values: On success, a array with the volume group names. # |
|
61
|
|
|
|
|
|
|
#-----------------------------------------------------------------------# |
|
62
|
|
|
|
|
|
|
sub units { |
|
63
|
0
|
|
|
0
|
0
|
|
shift; |
|
64
|
0
|
0
|
|
|
|
|
$units = shift() if @_; |
|
65
|
0
|
|
|
|
|
|
return $units; |
|
66
|
|
|
|
|
|
|
} |
|
67
|
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
#-----------------------------------------------------------------------# |
|
69
|
|
|
|
|
|
|
# Subroutine: get_volume_group_list # |
|
70
|
|
|
|
|
|
|
#-----------------------------------------------------------------------# |
|
71
|
|
|
|
|
|
|
# Description: This function will return a sorted list of all of the # |
|
72
|
|
|
|
|
|
|
# active volume groups on the system. # |
|
73
|
|
|
|
|
|
|
#-----------------------------------------------------------------------# |
|
74
|
|
|
|
|
|
|
# Parameters: None # |
|
75
|
|
|
|
|
|
|
#-----------------------------------------------------------------------# |
|
76
|
|
|
|
|
|
|
# Return Values: On success, a array with the volume group names. # |
|
77
|
|
|
|
|
|
|
#-----------------------------------------------------------------------# |
|
78
|
|
|
|
|
|
|
sub get_volume_group_list() { |
|
79
|
0
|
|
|
0
|
0
|
|
my %vg = get_vg_information(); |
|
80
|
0
|
|
|
|
|
|
return (sort keys(%vg)); |
|
81
|
|
|
|
|
|
|
} # End of the get_volume_group_list routine. |
|
82
|
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
#-----------------------------------------------------------------------# |
|
85
|
|
|
|
|
|
|
# Subroutine: get_volume_group_information # |
|
86
|
|
|
|
|
|
|
#-----------------------------------------------------------------------# |
|
87
|
|
|
|
|
|
|
# Description: This function will return a hash containing all of the # |
|
88
|
|
|
|
|
|
|
# data about the specified volume group. # |
|
89
|
|
|
|
|
|
|
#-----------------------------------------------------------------------# |
|
90
|
|
|
|
|
|
|
# Parameters: A string containing a volume group name. # |
|
91
|
|
|
|
|
|
|
#-----------------------------------------------------------------------# |
|
92
|
|
|
|
|
|
|
# Return Values: On success, a hash with the volume group data. # |
|
93
|
|
|
|
|
|
|
#-----------------------------------------------------------------------# |
|
94
|
|
|
|
|
|
|
sub get_volume_group_information($) { |
|
95
|
0
|
|
|
0
|
0
|
|
my $volume_group = $_[0]; |
|
96
|
0
|
|
|
|
|
|
my %vg_info; |
|
97
|
0
|
|
|
|
|
|
my %vg = get_vg_information(); |
|
98
|
|
|
|
|
|
|
|
|
99
|
0
|
|
|
|
|
|
foreach(sort keys %{$vg{$volume_group}}) { |
|
|
0
|
|
|
|
|
|
|
|
100
|
0
|
0
|
|
|
|
|
if ( $_ eq "pvols" ) { next; } |
|
|
0
|
0
|
|
|
|
|
|
|
101
|
0
|
|
|
|
|
|
elsif( $_ eq "lvols" ) { next; } |
|
102
|
|
|
|
|
|
|
else { |
|
103
|
0
|
|
|
|
|
|
$vg_info{$_} = $vg{$volume_group}->{$_}; |
|
104
|
|
|
|
|
|
|
} |
|
105
|
|
|
|
|
|
|
} |
|
106
|
0
|
|
|
|
|
|
return %vg_info; |
|
107
|
|
|
|
|
|
|
} # End of the get_volume_group_information routine. |
|
108
|
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
#-----------------------------------------------------------------------# |
|
111
|
|
|
|
|
|
|
# Subroutine: get_volume_group_information # |
|
112
|
|
|
|
|
|
|
#-----------------------------------------------------------------------# |
|
113
|
|
|
|
|
|
|
# Description: This function will return a hash containing all of the # |
|
114
|
|
|
|
|
|
|
# data about the specified volume group. # |
|
115
|
|
|
|
|
|
|
#-----------------------------------------------------------------------# |
|
116
|
|
|
|
|
|
|
# Parameters: A string containing a volume group name. # |
|
117
|
|
|
|
|
|
|
#-----------------------------------------------------------------------# |
|
118
|
|
|
|
|
|
|
# Return Values: On success, a hash with the volume group data. # |
|
119
|
|
|
|
|
|
|
#-----------------------------------------------------------------------# |
|
120
|
|
|
|
|
|
|
sub get_logical_volume_information($) { |
|
121
|
0
|
|
|
0
|
0
|
|
my $volume_group = $_[0]; |
|
122
|
0
|
|
|
|
|
|
my %lv_info; |
|
123
|
|
|
|
|
|
|
my $lvname; |
|
124
|
0
|
|
|
|
|
|
my %vg = get_vg_information(); |
|
125
|
|
|
|
|
|
|
|
|
126
|
0
|
|
|
|
|
|
foreach $lvname (sort keys %{$vg{$volume_group}->{lvols}}) { |
|
|
0
|
|
|
|
|
|
|
|
127
|
0
|
|
|
|
|
|
foreach(sort keys %{$vg{$volume_group}->{lvols}->{$lvname}}) { |
|
|
0
|
|
|
|
|
|
|
|
128
|
0
|
|
|
|
|
|
$lv_info{$lvname}->{$_} = $vg{$volume_group}->{lvols}->{$lvname}->{$_}; |
|
129
|
|
|
|
|
|
|
} |
|
130
|
|
|
|
|
|
|
} |
|
131
|
0
|
|
|
|
|
|
return %lv_info; |
|
132
|
|
|
|
|
|
|
} # End of the get_logical_volume_information routine. |
|
133
|
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
#-----------------------------------------------------------------------# |
|
136
|
|
|
|
|
|
|
# Subroutine: get_volume_group_information # |
|
137
|
|
|
|
|
|
|
#-----------------------------------------------------------------------# |
|
138
|
|
|
|
|
|
|
# Description: This function will return a hash containing all of the # |
|
139
|
|
|
|
|
|
|
# data about the specified volume group. # |
|
140
|
|
|
|
|
|
|
#-----------------------------------------------------------------------# |
|
141
|
|
|
|
|
|
|
# Parameters: A string containing a volume group name. # |
|
142
|
|
|
|
|
|
|
#-----------------------------------------------------------------------# |
|
143
|
|
|
|
|
|
|
# Return Values: On success, a hash with the volume group data. # |
|
144
|
|
|
|
|
|
|
#-----------------------------------------------------------------------# |
|
145
|
|
|
|
|
|
|
sub get_physical_volume_information($) { |
|
146
|
0
|
|
|
0
|
0
|
|
my $volume_group = $_[0]; |
|
147
|
0
|
|
|
|
|
|
my %pv_info; |
|
148
|
|
|
|
|
|
|
my $pvname; |
|
149
|
0
|
|
|
|
|
|
my %vg = get_vg_information(); |
|
150
|
|
|
|
|
|
|
|
|
151
|
0
|
|
|
|
|
|
foreach $pvname (sort keys %{$vg{$volume_group}->{pvols}}) { |
|
|
0
|
|
|
|
|
|
|
|
152
|
0
|
|
|
|
|
|
foreach(sort keys %{$vg{$volume_group}->{pvols}->{$pvname}}) { |
|
|
0
|
|
|
|
|
|
|
|
153
|
0
|
|
|
|
|
|
$pv_info{$pvname}->{$_} = $vg{$volume_group}->{pvols}->{$pvname}->{$_}; |
|
154
|
|
|
|
|
|
|
} |
|
155
|
|
|
|
|
|
|
} |
|
156
|
0
|
|
|
|
|
|
return %pv_info; |
|
157
|
|
|
|
|
|
|
} # End of the get_physical_volume_information routine. |
|
158
|
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
#-----------------------------------------------------------------------# |
|
161
|
|
|
|
|
|
|
# Subroutine: get_vg_information # |
|
162
|
|
|
|
|
|
|
#-----------------------------------------------------------------------# |
|
163
|
|
|
|
|
|
|
# Description: This function will return a hash containing all of the # |
|
164
|
|
|
|
|
|
|
# volume group information for the system. # |
|
165
|
|
|
|
|
|
|
#-----------------------------------------------------------------------# |
|
166
|
|
|
|
|
|
|
# Parameters: None # |
|
167
|
|
|
|
|
|
|
#-----------------------------------------------------------------------# |
|
168
|
|
|
|
|
|
|
# Return Values: On success, a hash with all of the vg information. # |
|
169
|
|
|
|
|
|
|
#-----------------------------------------------------------------------# |
|
170
|
|
|
|
|
|
|
sub get_vg_information() { |
|
171
|
0
|
|
|
0
|
0
|
|
my %vghash; |
|
172
|
|
|
|
|
|
|
my $vgn; |
|
173
|
0
|
|
|
|
|
|
my $lvn; |
|
174
|
0
|
|
|
|
|
|
my $pvn; |
|
175
|
|
|
|
|
|
|
|
|
176
|
0
|
|
|
|
|
|
my @vginfo; |
|
177
|
|
|
|
|
|
|
|
|
178
|
0
|
|
|
|
|
|
my $units_arg = ''; |
|
179
|
0
|
0
|
|
|
|
|
$units_arg = " --units $units " if ($units); |
|
180
|
0
|
0
|
|
|
|
|
if ( -e "/usr/sbin/vgdisplay" ) { |
|
181
|
0
|
|
|
|
|
|
@vginfo = `/usr/sbin/vgdisplay -v $units_arg`; |
|
182
|
|
|
|
|
|
|
} else { |
|
183
|
0
|
0
|
|
|
|
|
if( ! -e "/sbin/vgdisplay" ) { die("LVM utilities not installed in /sbin or /usr/sbin"); } |
|
|
0
|
|
|
|
|
|
|
|
184
|
0
|
|
|
|
|
|
@vginfo = `/sbin/vgdisplay -v $units_arg`; |
|
185
|
|
|
|
|
|
|
} |
|
186
|
|
|
|
|
|
|
|
|
187
|
0
|
|
|
|
|
|
VGINF: foreach(@vginfo) { |
|
188
|
0
|
|
|
|
|
|
chomp; |
|
189
|
0
|
|
|
|
|
|
s/^\s+//g; |
|
190
|
0
|
|
|
|
|
|
s/\s+$//g; |
|
191
|
0
|
0
|
|
|
|
|
next VGINF if m/^$/; |
|
192
|
|
|
|
|
|
|
|
|
193
|
|
|
|
|
|
|
# Parse the volume group name. |
|
194
|
0
|
0
|
|
|
|
|
if( m/VG Name\s+(\S+)/ ) { |
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
195
|
0
|
|
|
|
|
|
$vgn = $1; $vghash{$vgn}->{vgname} = $1; |
|
|
0
|
|
|
|
|
|
|
|
196
|
0
|
|
|
|
|
|
next VGINF; } |
|
197
|
|
|
|
|
|
|
|
|
198
|
|
|
|
|
|
|
# Parse the volume group access. |
|
199
|
|
|
|
|
|
|
elsif( m/VG Access\s+(\S+)/ ) { |
|
200
|
0
|
|
|
|
|
|
$vghash{$vgn}->{access} = $1; |
|
201
|
0
|
|
|
|
|
|
next VGINF; } |
|
202
|
|
|
|
|
|
|
|
|
203
|
|
|
|
|
|
|
# Parse the volume group status. |
|
204
|
|
|
|
|
|
|
elsif( m/VG Status\s+(.+)/ ) { |
|
205
|
0
|
|
|
|
|
|
$vghash{$vgn}->{status} = $1; |
|
206
|
0
|
|
|
|
|
|
next VGINF; } |
|
207
|
|
|
|
|
|
|
|
|
208
|
|
|
|
|
|
|
# Parse the volume group number. |
|
209
|
|
|
|
|
|
|
elsif( m/VG #\s+(\S+)/ ) { |
|
210
|
0
|
|
|
|
|
|
$vghash{$vgn}->{vg_number} = $1; |
|
211
|
0
|
|
|
|
|
|
next VGINF; } |
|
212
|
|
|
|
|
|
|
|
|
213
|
|
|
|
|
|
|
# Parse the maximum logical volume size and size unit for the volume group. |
|
214
|
|
|
|
|
|
|
elsif( m/MAX LV Size\s+(\S+) (\S+)/ ) { |
|
215
|
0
|
|
|
|
|
|
$vghash{$vgn}->{max_lv_size} = $1; |
|
216
|
0
|
|
|
|
|
|
$vghash{$vgn}->{max_lv_size_unit} = $2; |
|
217
|
0
|
|
|
|
|
|
next VGINF; } |
|
218
|
|
|
|
|
|
|
|
|
219
|
|
|
|
|
|
|
# Parse the maximum number of logical volumes for the volume group. |
|
220
|
|
|
|
|
|
|
elsif( m/MAX LV\s+(\S+)/ ) { |
|
221
|
0
|
|
|
|
|
|
$vghash{$vgn}->{max_lv} = $1; |
|
222
|
0
|
|
|
|
|
|
next VGINF; } |
|
223
|
|
|
|
|
|
|
|
|
224
|
|
|
|
|
|
|
# Parse the current number of logical volumes for the volume group. |
|
225
|
|
|
|
|
|
|
elsif( m/Cur LV\s+(\S+)/ ) { |
|
226
|
0
|
|
|
|
|
|
$vghash{$vgn}->{cur_lv} = $1; |
|
227
|
0
|
|
|
|
|
|
next VGINF; } |
|
228
|
|
|
|
|
|
|
|
|
229
|
|
|
|
|
|
|
# Parse the number of open logical volumes for the volume group. |
|
230
|
|
|
|
|
|
|
elsif( m/Open LV\s+(\S+)/ ) { |
|
231
|
0
|
|
|
|
|
|
$vghash{$vgn}->{open_lv} = $1; |
|
232
|
0
|
|
|
|
|
|
next VGINF; } |
|
233
|
|
|
|
|
|
|
|
|
234
|
|
|
|
|
|
|
# Parse the number of physical volumes accessible to the volume group. |
|
235
|
|
|
|
|
|
|
elsif( m/Max PV\s+(\S+)/ ) { |
|
236
|
0
|
|
|
|
|
|
$vghash{$vgn}->{max_pv} = $1; |
|
237
|
0
|
|
|
|
|
|
next VGINF; } |
|
238
|
|
|
|
|
|
|
|
|
239
|
|
|
|
|
|
|
# Parse the current number of physical volumes in the volume group. |
|
240
|
|
|
|
|
|
|
elsif( m/Cur PV\s+(\S+)/ ) { |
|
241
|
0
|
|
|
|
|
|
$vghash{$vgn}->{cur_pv} = $1; |
|
242
|
0
|
|
|
|
|
|
next VGINF; } |
|
243
|
|
|
|
|
|
|
|
|
244
|
|
|
|
|
|
|
# Parse the number of active physical volumes in the volume group. |
|
245
|
|
|
|
|
|
|
elsif( m/Act PV\s+(\S+)/ ) { |
|
246
|
0
|
|
|
|
|
|
$vghash{$vgn}->{act_pv} = $1; |
|
247
|
0
|
|
|
|
|
|
next VGINF; } |
|
248
|
|
|
|
|
|
|
|
|
249
|
|
|
|
|
|
|
# Parse the size of the volume group. |
|
250
|
|
|
|
|
|
|
elsif( m/VG Size\s+(\S+) (\S+)/ ) { |
|
251
|
0
|
|
|
|
|
|
$vghash{$vgn}->{vg_size} = $1; |
|
252
|
0
|
|
|
|
|
|
$vghash{$vgn}->{vg_size_unit} = $2; |
|
253
|
0
|
|
|
|
|
|
next VGINF; } |
|
254
|
|
|
|
|
|
|
|
|
255
|
|
|
|
|
|
|
# Parse the physical extent size and unit for one extent of volume group. |
|
256
|
|
|
|
|
|
|
elsif( m/PE Size\s+(\S+) (\S+)/ ) { |
|
257
|
0
|
|
|
|
|
|
$vghash{$vgn}->{pe_size} = $1; |
|
258
|
0
|
|
|
|
|
|
$vghash{$vgn}->{pe_size_unit} = $2; |
|
259
|
0
|
|
|
|
|
|
next VGINF; } |
|
260
|
|
|
|
|
|
|
|
|
261
|
|
|
|
|
|
|
# Parse the total number and number of free physical extents from the physical disk. |
|
262
|
|
|
|
|
|
|
elsif( m/Total PE \/ Free PE\s+(\S+) \/ (\S+)/m ) { |
|
263
|
0
|
|
|
|
|
|
$vghash{$vgn}->{pvols}->{$pvn}->{total_pe} = $1; |
|
264
|
0
|
|
|
|
|
|
$vghash{$vgn}->{pvols}->{$pvn}->{free_pe} = $2; |
|
265
|
0
|
|
|
|
|
|
next VGINF; } |
|
266
|
|
|
|
|
|
|
|
|
267
|
|
|
|
|
|
|
# Parse the total number of physical extents from the volume group. |
|
268
|
|
|
|
|
|
|
elsif( m/Total PE\s+(\S+)/ ) { |
|
269
|
0
|
|
|
|
|
|
$vghash{$vgn}->{total_pe} = $1; |
|
270
|
0
|
|
|
|
|
|
next VGINF; } |
|
271
|
|
|
|
|
|
|
|
|
272
|
|
|
|
|
|
|
# Parse the number of allocated physical extents from the volume group. |
|
273
|
|
|
|
|
|
|
elsif( m/Alloc PE \/ Size\s+(\S+) \/ (\S+) (\S+)/ ) { |
|
274
|
0
|
|
|
|
|
|
$vghash{$vgn}->{alloc_pe} = $1; |
|
275
|
0
|
|
|
|
|
|
$vghash{$vgn}->{alloc_pe_size} = $2; |
|
276
|
0
|
|
|
|
|
|
$vghash{$vgn}->{alloc_pe_size_unit} = $3; |
|
277
|
0
|
|
|
|
|
|
next VGINF; } |
|
278
|
|
|
|
|
|
|
|
|
279
|
|
|
|
|
|
|
# Parse the volume group name. |
|
280
|
|
|
|
|
|
|
elsif( m/Free PE \/ Size\s+(\S+) \/ (\S+) (\S+)/ ) { |
|
281
|
0
|
|
|
|
|
|
$vghash{$vgn}->{free_pe} = $1; |
|
282
|
0
|
|
|
|
|
|
$vghash{$vgn}->{free_pe_size} = $2; |
|
283
|
0
|
|
|
|
|
|
$vghash{$vgn}->{free_pe_size_unit} = $3; |
|
284
|
0
|
|
|
|
|
|
next VGINF; } |
|
285
|
|
|
|
|
|
|
|
|
286
|
|
|
|
|
|
|
# Parse the volume group uuid. |
|
287
|
|
|
|
|
|
|
elsif( m/VG UUID\s+(\S+)/ ) { |
|
288
|
0
|
|
|
|
|
|
$vghash{$vgn}->{uuid} = $1; |
|
289
|
0
|
|
|
|
|
|
next VGINF; } |
|
290
|
|
|
|
|
|
|
|
|
291
|
|
|
|
|
|
|
# Parse the logical volume name. |
|
292
|
|
|
|
|
|
|
elsif( m/LV Name\s+(\S+)/ ) { |
|
293
|
0
|
|
|
|
|
|
$lvn = $1; |
|
294
|
0
|
|
|
|
|
|
$vghash{$vgn}->{lvols}->{$lvn}->{name} = $1; |
|
295
|
0
|
|
|
|
|
|
next VGINF; } |
|
296
|
|
|
|
|
|
|
|
|
297
|
|
|
|
|
|
|
# since version 2.02.89 'LV Name' is no longer the full path, 'LV Path' is. |
|
298
|
|
|
|
|
|
|
# LV Path may be bogus or missing in some cases, such as thin pools. |
|
299
|
0
|
0
|
|
|
|
|
if( m/LV Path\s+(\S+)/ ) { |
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
300
|
0
|
|
|
|
|
|
$vghash{$vgn}->{lvols}->{$lvn}->{name} = $1; |
|
301
|
0
|
|
|
|
|
|
next LVINF; } |
|
302
|
|
|
|
|
|
|
|
|
303
|
|
|
|
|
|
|
# Parse the logical volume UUID. |
|
304
|
|
|
|
|
|
|
elsif( m/LV UUID\s+(\S+)/ ) { |
|
305
|
0
|
|
|
|
|
|
$vghash{$vgn}->{lvols}->{$lvn}->{uuid} = $1; |
|
306
|
0
|
|
|
|
|
|
next VGINF; } |
|
307
|
|
|
|
|
|
|
|
|
308
|
|
|
|
|
|
|
# Parse the logical volume UUID. |
|
309
|
|
|
|
|
|
|
elsif( m/Segments\s+(\S+)/ ) { |
|
310
|
0
|
|
|
|
|
|
$vghash{$vgn}->{lvols}->{$lvn}->{segments} = $1; |
|
311
|
0
|
|
|
|
|
|
next VGINF; } |
|
312
|
|
|
|
|
|
|
|
|
313
|
|
|
|
|
|
|
# Parse the logical volume size and unit. |
|
314
|
|
|
|
|
|
|
elsif( m/LV Size\s+(\S+) (\S+)/ ) { |
|
315
|
0
|
|
|
|
|
|
$vghash{$vgn}->{lvols}->{$lvn}->{lv_size} = $1; |
|
316
|
0
|
|
|
|
|
|
$vghash{$vgn}->{lvols}->{$lvn}->{lv_size_unit} = $2; |
|
317
|
0
|
|
|
|
|
|
next VGINF; } |
|
318
|
|
|
|
|
|
|
|
|
319
|
|
|
|
|
|
|
# Parse the logical volume write access. |
|
320
|
|
|
|
|
|
|
elsif( m/LV Write Access\s+(\S+)/ ) { |
|
321
|
0
|
|
|
|
|
|
$vghash{$vgn}->{lvols}->{$lvn}->{write_access} = $1; |
|
322
|
0
|
|
|
|
|
|
next VGINF; } |
|
323
|
|
|
|
|
|
|
|
|
324
|
|
|
|
|
|
|
# Parse the logical volume status. |
|
325
|
|
|
|
|
|
|
elsif( m/LV Status\s+(.+)/ ) { |
|
326
|
0
|
|
|
|
|
|
$vghash{$vgn}->{lvols}->{$lvn}->{status} = $1; |
|
327
|
0
|
|
|
|
|
|
next VGINF; } |
|
328
|
|
|
|
|
|
|
|
|
329
|
|
|
|
|
|
|
# Parse the number of logical extents in the logical volume. |
|
330
|
|
|
|
|
|
|
elsif( m/Current LE\s+(\S+)/ ) { |
|
331
|
0
|
|
|
|
|
|
$vghash{$vgn}->{lvols}->{$lvn}->{cur_le} = $1; |
|
332
|
0
|
|
|
|
|
|
next VGINF; } |
|
333
|
|
|
|
|
|
|
|
|
334
|
|
|
|
|
|
|
# Parse the number of allocated logical extents in the logical volume. |
|
335
|
|
|
|
|
|
|
elsif( m/Allocated LE\s+(\S+)/ ) { |
|
336
|
0
|
|
|
|
|
|
$vghash{$vgn}->{lvols}->{$lvn}->{alloc_le} = $1; |
|
337
|
0
|
|
|
|
|
|
next VGINF; } |
|
338
|
|
|
|
|
|
|
|
|
339
|
|
|
|
|
|
|
# Parse the allocation type for the logical volume. |
|
340
|
|
|
|
|
|
|
elsif( m/Allocation\s+(.+)/ ) { |
|
341
|
0
|
|
|
|
|
|
$vghash{$vgn}->{lvols}->{$lvn}->{allocation} = $1; |
|
342
|
0
|
|
|
|
|
|
next VGINF; } |
|
343
|
|
|
|
|
|
|
|
|
344
|
|
|
|
|
|
|
# Parse the volume number. |
|
345
|
|
|
|
|
|
|
elsif( m/LV #\s+(\S+)/ ) { |
|
346
|
0
|
|
|
|
|
|
$vghash{$vgn}->{lvols}->{$lvn}->{lv_number} = $1; |
|
347
|
0
|
|
|
|
|
|
next VGINF; } |
|
348
|
|
|
|
|
|
|
|
|
349
|
|
|
|
|
|
|
# Parse the number of times the logical volume is open. |
|
350
|
|
|
|
|
|
|
elsif( m/# open\s+(\S+)/ ) { |
|
351
|
0
|
|
|
|
|
|
$vghash{$vgn}->{lvols}->{$lvn}->{open_lv} = $1; |
|
352
|
0
|
|
|
|
|
|
next VGINF; } |
|
353
|
|
|
|
|
|
|
|
|
354
|
|
|
|
|
|
|
# Parse the block device of the logical volume. |
|
355
|
|
|
|
|
|
|
elsif( m/Block device\s+(\S+)/ ) { |
|
356
|
0
|
|
|
|
|
|
$vghash{$vgn}->{lvols}->{$lvn}->{device} = $1; |
|
357
|
0
|
|
|
|
|
|
next VGINF; } |
|
358
|
|
|
|
|
|
|
|
|
359
|
|
|
|
|
|
|
# Parse the value for the read ahead sectors of the logical volume. |
|
360
|
|
|
|
|
|
|
elsif( m/Read ahead sectors\s+(\S+)/ ) { |
|
361
|
0
|
|
|
|
|
|
$vghash{$vgn}->{lvols}->{$lvn}->{read_ahead} = $1; |
|
362
|
0
|
|
|
|
|
|
next VGINF; } |
|
363
|
|
|
|
|
|
|
|
|
364
|
|
|
|
|
|
|
|
|
365
|
|
|
|
|
|
|
elsif( m/Allocated to snapshot\s+(\S+)%/ ) { |
|
366
|
0
|
|
|
|
|
|
$vghash{$vgn}->{lvols}->{$lvn}->{'allocated_to_snapshot'} = $1; |
|
367
|
0
|
|
|
|
|
|
next VGINF; } |
|
368
|
|
|
|
|
|
|
|
|
369
|
|
|
|
|
|
|
elsif( m/COW-table size\s+([0-9\.]+)\s+(\S+)/ ) { |
|
370
|
0
|
|
|
|
|
|
$vghash{$vgn}->{lvols}->{$lvn}->{'cow_table_size'} = $1; |
|
371
|
0
|
|
|
|
|
|
$vghash{$vgn}->{lvols}->{$lvn}->{'cow_table_unit'} = $2; |
|
372
|
0
|
|
|
|
|
|
next VGINF; } |
|
373
|
|
|
|
|
|
|
|
|
374
|
|
|
|
|
|
|
elsif( m/Mirrored volumes\s+(.+)/ ) { |
|
375
|
0
|
|
|
|
|
|
$vghash{$vgn}->{lvols}->{$lvn}->{'mirrored_volumes'} = $1; |
|
376
|
0
|
|
|
|
|
|
next VGINF; } |
|
377
|
|
|
|
|
|
|
|
|
378
|
|
|
|
|
|
|
# Parse the physical disk name. |
|
379
|
|
|
|
|
|
|
elsif( m/PV Name\s+(\S+)/ ) { |
|
380
|
0
|
|
|
|
|
|
$pvn = $1; |
|
381
|
0
|
|
|
|
|
|
$vghash{$vgn}->{pvols}->{$pvn}->{device} = $1; |
|
382
|
0
|
|
|
|
|
|
next VGINF; } |
|
383
|
|
|
|
|
|
|
|
|
384
|
|
|
|
|
|
|
# Parse the status of the physical disk. |
|
385
|
|
|
|
|
|
|
elsif( m/PV Status\s+(.+)/ ) { |
|
386
|
0
|
|
|
|
|
|
$vghash{$vgn}->{pvols}->{$pvn}->{status} = $1; |
|
387
|
0
|
|
|
|
|
|
next VGINF; } |
|
388
|
|
|
|
|
|
|
|
|
389
|
|
|
|
|
|
|
# Parse the status of the physical disk. |
|
390
|
|
|
|
|
|
|
elsif( m/PV UUID\s+(.+)/ ) { |
|
391
|
0
|
|
|
|
|
|
$vghash{$vgn}->{pvols}->{$pvn}->{uuid} = $1; |
|
392
|
0
|
|
|
|
|
|
next VGINF; } |
|
393
|
|
|
|
|
|
|
|
|
394
|
|
|
|
|
|
|
} |
|
395
|
0
|
|
|
|
|
|
return %vghash; |
|
396
|
|
|
|
|
|
|
} # End of the get_vg_information routine. |
|
397
|
|
|
|
|
|
|
|
|
398
|
|
|
|
|
|
|
|
|
399
|
|
|
|
|
|
|
#-----------------------------------------------------------------------# |
|
400
|
|
|
|
|
|
|
# Subroutine: get_pv_info # |
|
401
|
|
|
|
|
|
|
#-----------------------------------------------------------------------# |
|
402
|
|
|
|
|
|
|
# Description: This function will return a hash containing all of the # |
|
403
|
|
|
|
|
|
|
# information about the specified physical volume. # |
|
404
|
|
|
|
|
|
|
#-----------------------------------------------------------------------# |
|
405
|
|
|
|
|
|
|
# Parameters: None # |
|
406
|
|
|
|
|
|
|
#-----------------------------------------------------------------------# |
|
407
|
|
|
|
|
|
|
# Return Values: On success, a hash with all of the pv information. # |
|
408
|
|
|
|
|
|
|
#-----------------------------------------------------------------------# |
|
409
|
|
|
|
|
|
|
sub get_pv_info($) { |
|
410
|
0
|
|
|
0
|
0
|
|
my $pvname = $_[0]; |
|
411
|
0
|
|
|
|
|
|
my %pvhash; |
|
412
|
|
|
|
|
|
|
my @pvinfo; |
|
413
|
|
|
|
|
|
|
|
|
414
|
0
|
0
|
|
|
|
|
if( ! -e "$pvname" ) { die("Physical Disk: $pvname does not exist."); } |
|
|
0
|
|
|
|
|
|
|
|
415
|
|
|
|
|
|
|
|
|
416
|
0
|
|
|
|
|
|
my $units_arg = ''; |
|
417
|
0
|
0
|
|
|
|
|
$units_arg = " --units $units " if ($units); |
|
418
|
|
|
|
|
|
|
|
|
419
|
0
|
0
|
|
|
|
|
if ( -e "/usr/sbin/pvdisplay" ) { |
|
420
|
0
|
|
|
|
|
|
@pvinfo = `/usr/sbin/pvdisplay $units_arg $pvname`; |
|
421
|
|
|
|
|
|
|
} else { |
|
422
|
0
|
0
|
|
|
|
|
if( ! -e "/sbin/pvdisplay" ) { die("LVM utilities not installed in /sbin or /usr/sbin"); } |
|
|
0
|
|
|
|
|
|
|
|
423
|
0
|
|
|
|
|
|
@pvinfo = `/sbin/pvdisplay $units_arg $pvname`; |
|
424
|
|
|
|
|
|
|
} |
|
425
|
|
|
|
|
|
|
|
|
426
|
|
|
|
|
|
|
|
|
427
|
0
|
|
|
|
|
|
PVINF: foreach(@pvinfo) { |
|
428
|
|
|
|
|
|
|
# Get the name of the physical volume. |
|
429
|
0
|
0
|
|
|
|
|
if( m/PV Name\s+(\S+)/ ) { |
|
430
|
0
|
|
|
|
|
|
$pvhash{pv_name} = $1; |
|
431
|
0
|
|
|
|
|
|
next PVINF; } |
|
432
|
|
|
|
|
|
|
|
|
433
|
|
|
|
|
|
|
# Get the name of the volume group the physical volume belongs to. |
|
434
|
0
|
0
|
|
|
|
|
if( m/VG Name\s+(\S+)/ ) { |
|
435
|
0
|
|
|
|
|
|
$pvhash{vg_name} = $1; |
|
436
|
0
|
|
|
|
|
|
next PVINF; } |
|
437
|
|
|
|
|
|
|
|
|
438
|
|
|
|
|
|
|
# Get the size information of the physical volume. |
|
439
|
0
|
0
|
|
|
|
|
if( m/PV Size\s+(\S+) (\S+)/ ) { |
|
440
|
0
|
|
|
|
|
|
$pvhash{size} = $1; |
|
441
|
0
|
|
|
|
|
|
$pvhash{size_unit} = $2; |
|
442
|
0
|
|
|
|
|
|
next PVINF; } |
|
443
|
|
|
|
|
|
|
|
|
444
|
|
|
|
|
|
|
# Get the physical volume number. |
|
445
|
0
|
0
|
|
|
|
|
if( m/PV\#\s+(\S+)/ ) { |
|
446
|
0
|
|
|
|
|
|
$pvhash{pv_number} = $1; |
|
447
|
0
|
|
|
|
|
|
next PVINF; } |
|
448
|
|
|
|
|
|
|
|
|
449
|
|
|
|
|
|
|
# Get the status of the physical volume. |
|
450
|
0
|
0
|
|
|
|
|
if( m/PV Status\s+(.+)/ ) { |
|
451
|
0
|
|
|
|
|
|
$pvhash{status} = $1; |
|
452
|
0
|
|
|
|
|
|
next PVINF; } |
|
453
|
|
|
|
|
|
|
|
|
454
|
|
|
|
|
|
|
# Get the allocation status of the physical volume. |
|
455
|
0
|
0
|
|
|
|
|
if( m/Allocatable\s+(.+)/ ) { |
|
456
|
0
|
|
|
|
|
|
$pvhash{allocatable} = $1; |
|
457
|
0
|
|
|
|
|
|
next PVINF; } |
|
458
|
|
|
|
|
|
|
|
|
459
|
|
|
|
|
|
|
# Get the number of logical volumes on the physical volume. |
|
460
|
0
|
0
|
|
|
|
|
if( m/Cur LV\s+(\S+)/ ) { |
|
461
|
0
|
|
|
|
|
|
$pvhash{num_lvols} = $1; |
|
462
|
0
|
|
|
|
|
|
next PVINF; } |
|
463
|
|
|
|
|
|
|
|
|
464
|
|
|
|
|
|
|
# Get the physical extent size and unit of the physical volume. |
|
465
|
0
|
0
|
|
|
|
|
if( m/PE Size \((\S+)\)\s+(\S+)/ ) { |
|
466
|
0
|
|
|
|
|
|
$pvhash{pe_size} = $2; |
|
467
|
0
|
|
|
|
|
|
$pvhash{pe_size_unit} = $1; |
|
468
|
0
|
|
|
|
|
|
next PVINF; } |
|
469
|
|
|
|
|
|
|
|
|
470
|
|
|
|
|
|
|
# Get the total numver of physical extents on the physical volume. |
|
471
|
0
|
0
|
|
|
|
|
if( m/Total PE\s+(\S+)/ ) { |
|
472
|
0
|
|
|
|
|
|
$pvhash{total_pe} = $1; |
|
473
|
0
|
|
|
|
|
|
next PVINF; } |
|
474
|
|
|
|
|
|
|
|
|
475
|
|
|
|
|
|
|
# Get the number of free extents on the physical volume. |
|
476
|
0
|
0
|
|
|
|
|
if( m/Free PE\s+(\S+)/ ) { |
|
477
|
0
|
|
|
|
|
|
$pvhash{free_pe} = $1; |
|
478
|
0
|
|
|
|
|
|
next PVINF; } |
|
479
|
|
|
|
|
|
|
|
|
480
|
|
|
|
|
|
|
# Get the number of allocated physical extents on the physical volume. |
|
481
|
0
|
0
|
|
|
|
|
if( m/Allocated PE\s+(\S+)/ ) { |
|
482
|
0
|
|
|
|
|
|
$pvhash{alloc_pe} = $1; |
|
483
|
0
|
|
|
|
|
|
next PVINF; } |
|
484
|
|
|
|
|
|
|
|
|
485
|
|
|
|
|
|
|
# Get the UUID of the physical volume. |
|
486
|
0
|
0
|
|
|
|
|
if( m/PV UUID\s+(\S+)/ ) { |
|
487
|
0
|
|
|
|
|
|
$pvhash{uuid} = $1; |
|
488
|
0
|
|
|
|
|
|
next PVINF; } |
|
489
|
|
|
|
|
|
|
} |
|
490
|
0
|
|
|
|
|
|
return %pvhash; |
|
491
|
|
|
|
|
|
|
} # End of the get_pv_info routine. |
|
492
|
|
|
|
|
|
|
|
|
493
|
|
|
|
|
|
|
|
|
494
|
|
|
|
|
|
|
#-----------------------------------------------------------------------# |
|
495
|
|
|
|
|
|
|
# Subroutine: get_lv_info # |
|
496
|
|
|
|
|
|
|
#-----------------------------------------------------------------------# |
|
497
|
|
|
|
|
|
|
# Description: This function will return a hash containing all of the # |
|
498
|
|
|
|
|
|
|
# information about the specified logical volume. # |
|
499
|
|
|
|
|
|
|
#-----------------------------------------------------------------------# |
|
500
|
|
|
|
|
|
|
# Parameters: None # |
|
501
|
|
|
|
|
|
|
#-----------------------------------------------------------------------# |
|
502
|
|
|
|
|
|
|
# Return Values: On success, a hash with all of the lv information. # |
|
503
|
|
|
|
|
|
|
#-----------------------------------------------------------------------# |
|
504
|
|
|
|
|
|
|
sub get_lv_info($) { |
|
505
|
0
|
|
|
0
|
0
|
|
my $lvname = $_[0]; |
|
506
|
0
|
|
|
|
|
|
my %lvhash; |
|
507
|
|
|
|
|
|
|
my @lvinfo; |
|
508
|
|
|
|
|
|
|
|
|
509
|
0
|
0
|
|
|
|
|
if( ! -e "$lvname" ) { die("Logical Disk: $lvname does not exist."); } |
|
|
0
|
|
|
|
|
|
|
|
510
|
|
|
|
|
|
|
|
|
511
|
0
|
|
|
|
|
|
my $units_arg = ''; |
|
512
|
0
|
0
|
|
|
|
|
$units_arg = " --units $units " if ($units); |
|
513
|
0
|
0
|
|
|
|
|
if ( -e "/usr/sbin/vgdisplay" ) { |
|
514
|
0
|
|
|
|
|
|
@lvinfo = `/usr/sbin/lvdisplay $units_arg $lvname`; |
|
515
|
|
|
|
|
|
|
} else { |
|
516
|
0
|
0
|
|
|
|
|
if( ! -e "/sbin/vgdisplay" ) { die("LVM utilities not installed in /sbin or /usr/sbin"); } |
|
|
0
|
|
|
|
|
|
|
|
517
|
0
|
|
|
|
|
|
@lvinfo = `/sbin/lvdisplay $units_arg $lvname`; |
|
518
|
|
|
|
|
|
|
} |
|
519
|
|
|
|
|
|
|
|
|
520
|
0
|
|
|
|
|
|
LVINF: foreach(@lvinfo) { |
|
521
|
|
|
|
|
|
|
|
|
522
|
|
|
|
|
|
|
# Get the logical volume name. |
|
523
|
0
|
0
|
|
|
|
|
if( m/LV Name\s+(\S+)/ ) { |
|
524
|
0
|
|
|
|
|
|
$lvhash{lv_name} = $1; |
|
525
|
0
|
|
|
|
|
|
next LVINF; } |
|
526
|
|
|
|
|
|
|
|
|
527
|
|
|
|
|
|
|
|
|
528
|
|
|
|
|
|
|
# since version 2.02.89 'LV Name' is no longer the full path, 'LV Path' is. |
|
529
|
|
|
|
|
|
|
# LV Path may be bogus or missing in some cases, such as thin pools. |
|
530
|
0
|
0
|
|
|
|
|
if( m/LV Path\s+(\S+)/ ) { |
|
531
|
0
|
|
|
|
|
|
$lvhash{lv_name} = $1; |
|
532
|
0
|
|
|
|
|
|
next LVINF; } |
|
533
|
|
|
|
|
|
|
|
|
534
|
|
|
|
|
|
|
# Get the volume group name. |
|
535
|
0
|
0
|
|
|
|
|
if( m/VG Name\s+(\S+)/ ) { |
|
536
|
0
|
|
|
|
|
|
$lvhash{vg_name} = $1; |
|
537
|
0
|
|
|
|
|
|
next LVINF; } |
|
538
|
|
|
|
|
|
|
|
|
539
|
|
|
|
|
|
|
# Get the volume group name. |
|
540
|
0
|
0
|
|
|
|
|
if( m/LV UUID\s+(\S+)/ ) { |
|
541
|
0
|
|
|
|
|
|
$lvhash{uuid} = $1; |
|
542
|
0
|
|
|
|
|
|
next LVINF; } |
|
543
|
|
|
|
|
|
|
|
|
544
|
|
|
|
|
|
|
# Get the logical volume write status. |
|
545
|
0
|
0
|
|
|
|
|
if( m/LV Write Access\s+(.+)/ ) { |
|
546
|
0
|
|
|
|
|
|
$lvhash{access} = $1; |
|
547
|
0
|
|
|
|
|
|
next LVINF; } |
|
548
|
|
|
|
|
|
|
|
|
549
|
|
|
|
|
|
|
# Get the logical volume status. |
|
550
|
0
|
0
|
|
|
|
|
if( m/LV Status\s+(.+)/ ) { |
|
551
|
0
|
|
|
|
|
|
$lvhash{status} = $1; |
|
552
|
0
|
|
|
|
|
|
next LVINF; } |
|
553
|
|
|
|
|
|
|
|
|
554
|
|
|
|
|
|
|
# Get the logical volume number. |
|
555
|
0
|
0
|
|
|
|
|
if( m/LV \#\s+(\S+)/ ) { |
|
556
|
0
|
|
|
|
|
|
$lvhash{lv_number} = $1; |
|
557
|
0
|
|
|
|
|
|
next LVINF; } |
|
558
|
|
|
|
|
|
|
|
|
559
|
|
|
|
|
|
|
# Get the number of opens for the logical volume. |
|
560
|
0
|
0
|
|
|
|
|
if( m/\# open\s+(\S+)/ ) { |
|
561
|
0
|
|
|
|
|
|
$lvhash{lv_open} = $1; |
|
562
|
0
|
|
|
|
|
|
next LVINF; } |
|
563
|
|
|
|
|
|
|
|
|
564
|
|
|
|
|
|
|
# Get the logical volume size and size unit. |
|
565
|
0
|
0
|
|
|
|
|
if( m/LV Size\s+(\S+) (\S+)/ ) { |
|
566
|
0
|
|
|
|
|
|
$lvhash{size} = $1; |
|
567
|
0
|
|
|
|
|
|
$lvhash{size_unit} = $2; |
|
568
|
0
|
|
|
|
|
|
next LVINF; } |
|
569
|
|
|
|
|
|
|
|
|
570
|
|
|
|
|
|
|
# Get the number of extents assigned to the logical volume. |
|
571
|
0
|
0
|
|
|
|
|
if( m/Current LE\s+(\S+)/ ) { |
|
572
|
0
|
|
|
|
|
|
$lvhash{current_le} = $1; |
|
573
|
0
|
|
|
|
|
|
next LVINF; } |
|
574
|
|
|
|
|
|
|
|
|
575
|
|
|
|
|
|
|
# Get the number of extents allocated to the logical volume. |
|
576
|
0
|
0
|
|
|
|
|
if( m/Allocated LE\s+(\S+)/ ) { |
|
577
|
0
|
|
|
|
|
|
$lvhash{alloc_le} = $1; |
|
578
|
0
|
|
|
|
|
|
next LVINF; } |
|
579
|
|
|
|
|
|
|
|
|
580
|
|
|
|
|
|
|
# Get the extent allocation type of the logical volume. |
|
581
|
0
|
0
|
|
|
|
|
if( m/Allocation\s+(.+)/ ) { |
|
582
|
0
|
|
|
|
|
|
$lvhash{allocation} = $1; |
|
583
|
0
|
|
|
|
|
|
next LVINF; } |
|
584
|
|
|
|
|
|
|
|
|
585
|
|
|
|
|
|
|
# Get the number of read ahead sectors for the logical volume. |
|
586
|
0
|
0
|
|
|
|
|
if( m/Read ahead sectors\s+(\S+)/ ) { |
|
587
|
0
|
|
|
|
|
|
$lvhash{read_ahead} = $1; |
|
588
|
0
|
|
|
|
|
|
next LVINF; } |
|
589
|
|
|
|
|
|
|
|
|
590
|
|
|
|
|
|
|
# Get the block device of the logical volume. |
|
591
|
0
|
0
|
|
|
|
|
if( m/Block device\s+(\S+)/ ) { |
|
592
|
0
|
|
|
|
|
|
$lvhash{block_device} = $1; |
|
593
|
0
|
|
|
|
|
|
next LVINF; } |
|
594
|
|
|
|
|
|
|
|
|
595
|
0
|
0
|
|
|
|
|
if( m/Allocated to snapshot\s+(\S+)%/ ) { |
|
|
|
0
|
|
|
|
|
|
|
596
|
0
|
|
|
|
|
|
$lvhash{allocated_to_snapshot} = $1; |
|
597
|
0
|
|
|
|
|
|
next LVINF; } |
|
598
|
|
|
|
|
|
|
|
|
599
|
|
|
|
|
|
|
elsif( m/COW-table size\s+([0-9\.]+)\s+(\S+)/ ) { |
|
600
|
0
|
|
|
|
|
|
$lvhash{'cow_table_size'} = $1; |
|
601
|
0
|
|
|
|
|
|
$lvhash{'cow_table_unit'} = $2; |
|
602
|
0
|
|
|
|
|
|
next LVINF; } |
|
603
|
|
|
|
|
|
|
} |
|
604
|
0
|
|
|
|
|
|
return %lvhash; |
|
605
|
|
|
|
|
|
|
} # End of the get_lv_info routine. |
|
606
|
|
|
|
|
|
|
|
|
607
|
|
|
|
|
|
|
|
|
608
|
|
|
|
|
|
|
1; |
|
609
|
|
|
|
|
|
|
__END__ |