| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package HPUX::LVM; |
|
2
|
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
827
|
use 5.006; |
|
|
1
|
|
|
|
|
4
|
|
|
|
1
|
|
|
|
|
36
|
|
|
4
|
1
|
|
|
1
|
|
5
|
use strict; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
35
|
|
|
5
|
|
|
|
|
|
|
#use warnings; |
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
require Exporter; |
|
8
|
1
|
|
|
1
|
|
963
|
use AutoLoader qw(AUTOLOAD); |
|
|
1
|
|
|
|
|
1418
|
|
|
|
1
|
|
|
|
|
5
|
|
|
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 HPUX::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( |
|
20
|
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
) ] ); |
|
22
|
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } ); |
|
24
|
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
our @EXPORT = qw( |
|
26
|
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
); |
|
28
|
|
|
|
|
|
|
our $VERSION = '1.06'; |
|
29
|
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
# Preloaded methods go here. |
|
31
|
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
# Autoload methods go after =cut, and are processed by the autosplit program. |
|
33
|
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
### Start |
|
35
|
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
|
|
37
|
1
|
|
|
1
|
|
101
|
use vars '$AUTOLOAD'; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
43
|
|
|
38
|
1
|
|
|
1
|
|
4
|
use Carp ; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
104
|
|
|
39
|
1
|
|
|
1
|
|
1093
|
use Storable; |
|
|
1
|
|
|
|
|
3694
|
|
|
|
1
|
|
|
|
|
7744
|
|
|
40
|
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
sub new |
|
42
|
|
|
|
|
|
|
{ |
|
43
|
1
|
|
|
1
|
1
|
58
|
my $debug=0; |
|
44
|
1
|
|
|
|
|
3
|
my $debug1=0; |
|
45
|
1
|
|
|
|
|
2
|
my $debug2=0; |
|
46
|
1
|
|
|
|
|
2
|
my $debug5=0; |
|
47
|
|
|
|
|
|
|
|
|
48
|
1
|
|
|
|
|
5
|
my ($class, @subargs) = @_ ; |
|
49
|
|
|
|
|
|
|
|
|
50
|
1
|
|
|
|
|
14
|
my %arglist = ( |
|
51
|
|
|
|
|
|
|
target_type => "local" , |
|
52
|
|
|
|
|
|
|
persistance => "new" , |
|
53
|
|
|
|
|
|
|
datafile => "/tmp/lvminfo.dat", |
|
54
|
|
|
|
|
|
|
access_prog => "ssh" , |
|
55
|
|
|
|
|
|
|
access_system => "localhost" , |
|
56
|
|
|
|
|
|
|
access_user => "root" , |
|
57
|
|
|
|
|
|
|
remote_command1 => '/usr/sbin/vgdisplay -v', |
|
58
|
|
|
|
|
|
|
remote_command2 => '/usr/sbin/lvdisplay -v', |
|
59
|
|
|
|
|
|
|
@subargs, |
|
60
|
|
|
|
|
|
|
); |
|
61
|
|
|
|
|
|
|
|
|
62
|
1
|
50
|
|
|
|
4
|
if ($debug) { |
|
63
|
0
|
|
|
|
|
0
|
print "target_type : $arglist{target_type}\n"; |
|
64
|
0
|
|
|
|
|
0
|
print "persistance : $arglist{persistance}\n"; |
|
65
|
0
|
|
|
|
|
0
|
print "datafile : $arglist{datafile}\n"; |
|
66
|
0
|
|
|
|
|
0
|
print "access_prog : $arglist{access_prog}\n"; |
|
67
|
0
|
|
|
|
|
0
|
print "access_system: $arglist{access_system}\n"; |
|
68
|
0
|
|
|
|
|
0
|
print "access_user : $arglist{access_user}\n"; |
|
69
|
0
|
|
|
|
|
0
|
print "remote_command1: $arglist{remote_command1}\n"; |
|
70
|
0
|
|
|
|
|
0
|
print "remote_command2: $arglist{remote_command2}\n"; |
|
71
|
|
|
|
|
|
|
} |
|
72
|
|
|
|
|
|
|
|
|
73
|
1
|
|
|
|
|
4
|
my $source_access =$arglist{target_type}; |
|
74
|
1
|
|
|
|
|
2
|
my $new_or_saved =$arglist{persistance}; |
|
75
|
1
|
|
|
|
|
1
|
my $datafile =$arglist{datafile}; |
|
76
|
1
|
|
|
|
|
2
|
my $remote_access =$arglist{access_prog}; |
|
77
|
1
|
|
|
|
|
2
|
my $remote_system =$arglist{access_system}; |
|
78
|
1
|
|
|
|
|
3
|
my $remote_user =$arglist{access_user}; |
|
79
|
1
|
|
|
|
|
2
|
my $remote_command1 =$arglist{remote_command1}; |
|
80
|
1
|
|
|
|
|
2
|
my $remote_command2 =$arglist{remote_command2}; |
|
81
|
|
|
|
|
|
|
|
|
82
|
1
|
|
|
|
|
2
|
my $templine; #line by line of vgdisplay output |
|
83
|
|
|
|
|
|
|
my @tempdataline; #space split templine when gathering vg |
|
84
|
|
|
|
|
|
|
#and lv attributes |
|
85
|
0
|
|
|
|
|
0
|
my @tempdataline1; #slash sub split of tempdataline value so lvname |
|
86
|
|
|
|
|
|
|
#can be lvol1 and not /dev/vg02/lvol1 |
|
87
|
1
|
|
|
|
|
2
|
my $alternate_link="no"; #yes or no to indicate an alternate |
|
88
|
|
|
|
|
|
|
#link was found |
|
89
|
1
|
|
|
|
|
2
|
my @vgdisplay; #results of vgdisplay command |
|
90
|
|
|
|
|
|
|
my @lvdisplay; #results of lvdisplay command |
|
91
|
0
|
|
|
|
|
0
|
my $lvname_confirm; #holds lvname extracted from output |
|
92
|
|
|
|
|
|
|
#(templvname) and compares to current |
|
93
|
|
|
|
|
|
|
#lvnamefrom vgdisplay (yet another sanity check) |
|
94
|
0
|
|
|
|
|
0
|
my @templvname; #split line on match of LV Name in |
|
95
|
|
|
|
|
|
|
#lvdisplay output |
|
96
|
|
|
|
|
|
|
|
|
97
|
0
|
|
|
|
|
0
|
my @currentline_savetemp; #space split current_line (templine) |
|
98
|
0
|
|
|
|
|
0
|
my @lastline_savetemp; #had to save previous lines data for alt-links |
|
99
|
0
|
|
|
|
|
0
|
my $lastline_save; #Space split lastline_savetemp |
|
100
|
0
|
|
|
|
|
0
|
my $pvname_previous; #extracted from lastline_savetemp |
|
101
|
0
|
|
|
|
|
0
|
my $alternate_pvname; |
|
102
|
0
|
|
|
|
|
0
|
my $alternate_line; |
|
103
|
0
|
|
|
|
|
0
|
my %alternate_link_list; #May be getting rid of this one |
|
104
|
0
|
|
|
|
|
0
|
my $current_VG; #volume group that its currently working |
|
105
|
|
|
|
|
|
|
#on in the loop |
|
106
|
|
|
|
|
|
|
|
|
107
|
0
|
|
|
|
|
0
|
my @tempvgname; #space split templine that vgname was found on |
|
108
|
0
|
|
|
|
|
0
|
my $vgname; #extracted from tempvgname |
|
109
|
0
|
|
|
|
|
0
|
my $vgname_save; #saved copy of above |
|
110
|
|
|
|
|
|
|
|
|
111
|
0
|
|
|
|
|
0
|
my $volgrpdatacnt; #number of attributes for a volume group |
|
112
|
|
|
|
|
|
|
#(sanity check) |
|
113
|
0
|
|
|
|
|
0
|
my $lvdatacnt; #number of attributes that each logical |
|
114
|
|
|
|
|
|
|
#volume has (sanity check) in vgdisplay |
|
115
|
|
|
|
|
|
|
#command 5? |
|
116
|
0
|
|
|
|
|
0
|
my $lvdataline; # each line in lvdisplay command |
|
117
|
0
|
|
|
|
|
0
|
my %vg_info; #MAIN hash that it returns! |
|
118
|
1
|
|
|
|
|
3
|
my $vginfo_ref = \%vg_info; |
|
119
|
|
|
|
|
|
|
|
|
120
|
1
|
|
|
|
|
6
|
my $lvcnt; #number of logical volumes in vg's |
|
121
|
|
|
|
|
|
|
my $lvname; #name of current logical volume in command |
|
122
|
0
|
|
|
|
|
0
|
my $started_lvdatacollect; #0 or 1 depending on if it has |
|
123
|
|
|
|
|
|
|
#started to parse the lvdisplay attributes yet |
|
124
|
0
|
|
|
|
|
0
|
my $lvdatacnt2; #number of attributes gathered for |
|
125
|
|
|
|
|
|
|
#logical volume in lvdisplay command 15? |
|
126
|
|
|
|
|
|
|
#should be the same number for all. this is just |
|
127
|
|
|
|
|
|
|
#a sanity check for the paranoid parser people |
|
128
|
0
|
|
|
|
|
0
|
my $parse_logical_vols; #set to yes when it gets to the |
|
129
|
|
|
|
|
|
|
#logical volume output of the vgdisplay command |
|
130
|
|
|
|
|
|
|
# so it can skip some if checks |
|
131
|
0
|
|
|
|
|
0
|
my $lvpvcnt; #number of physical volumes in logical |
|
132
|
|
|
|
|
|
|
#volume per lvdisplay output. later |
|
133
|
|
|
|
|
|
|
#compared to vgdisplays PV count. |
|
134
|
0
|
|
|
|
|
0
|
my @final_pvnamedatatemp; # array that contains LE on PV and |
|
135
|
|
|
|
|
|
|
#PE on PV per the lvdisplay command |
|
136
|
|
|
|
|
|
|
#later to be turned into hash value |
|
137
|
0
|
|
|
|
|
0
|
my $pvtempname; #just a definition for debugging purposes. |
|
138
|
|
|
|
|
|
|
#Its the pv name from lvdisplay distribution |
|
139
|
|
|
|
|
|
|
#of physical volumes part |
|
140
|
0
|
|
|
|
|
0
|
my $pvcnt; #number of physical volumes in volume |
|
141
|
|
|
|
|
|
|
#group from ---physical volumes--- part. |
|
142
|
0
|
|
|
|
|
0
|
my $pvdatacnt; #number of attributs associated to the |
|
143
|
|
|
|
|
|
|
#phyical volumes part of vgdisplay output (sanity check) |
|
144
|
0
|
|
|
|
|
0
|
my $pvname; #physical volume name from physical volumes |
|
145
|
|
|
|
|
|
|
#section of vgdisplay output |
|
146
|
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
# Check for persistance request |
|
148
|
|
|
|
|
|
|
|
|
149
|
1
|
50
|
|
|
|
6
|
if ($arglist{persistance} eq "old") { |
|
150
|
1
|
50
|
|
|
|
4
|
print "retrieving a copy from prosperity...\n" if $debug; |
|
151
|
1
|
50
|
|
|
|
7
|
$vginfo_ref = Storable::retrieve $datafile |
|
152
|
|
|
|
|
|
|
or die "unable to retrieve hash data in /tmp\n"; |
|
153
|
1
|
|
|
|
|
437
|
return bless($vginfo_ref,$class); |
|
154
|
|
|
|
|
|
|
} |
|
155
|
|
|
|
|
|
|
|
|
156
|
0
|
0
|
|
|
|
0
|
@vgdisplay=`$remote_access $remote_system -l $remote_user -n $remote_command1` |
|
157
|
|
|
|
|
|
|
or die "Unable to execute $remote_command1: $@\n"; |
|
158
|
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
# For debuggin on win95 |
|
160
|
|
|
|
|
|
|
# @vgdisplay=`type vgdisplay.vgtest` or die "unable to exec command vgdisplay: $@\n"; |
|
161
|
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
|
|
166
|
0
|
|
|
|
|
0
|
LINEB: foreach $templine (@vgdisplay) { |
|
167
|
0
|
0
|
0
|
|
|
0
|
if ( $templine eq "" || $templine =~ /^\s+$/ ) { |
|
168
|
0
|
|
|
|
|
0
|
next LINEB; |
|
169
|
|
|
|
|
|
|
} |
|
170
|
|
|
|
|
|
|
# |
|
171
|
|
|
|
|
|
|
# Added this code to support Alternate link indentification. |
|
172
|
|
|
|
|
|
|
# This required that I save the previous lines data |
|
173
|
|
|
|
|
|
|
# Not yet merged into new format yet. |
|
174
|
|
|
|
|
|
|
# |
|
175
|
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
# First check to see if the alternate link flag has been tripped |
|
177
|
|
|
|
|
|
|
|
|
178
|
0
|
0
|
|
|
|
0
|
if ($alternate_link eq "yes" ) { |
|
179
|
0
|
|
|
|
|
0
|
@currentline_savetemp = split /\s+/,$alternate_line; |
|
180
|
0
|
|
|
|
|
0
|
@lastline_savetemp = split /\s+/,$lastline_save; |
|
181
|
0
|
|
|
|
|
0
|
$pvname_previous = $lastline_savetemp[3]; |
|
182
|
|
|
|
|
|
|
#print "pvname_previous is $pvname_previous\n"; |
|
183
|
0
|
|
|
|
|
0
|
$alternate_pvname = $currentline_savetemp[3]; |
|
184
|
|
|
|
|
|
|
# |
|
185
|
|
|
|
|
|
|
# I give up. Create an alternate link hash with the key as the main link |
|
186
|
|
|
|
|
|
|
#and the alternate as the value and refrence it later |
|
187
|
|
|
|
|
|
|
# |
|
188
|
0
|
0
|
|
|
|
0
|
print "Adding Alternate link/s to object\n" if $debug5; |
|
189
|
0
|
|
|
|
|
0
|
push @{ $alternate_link_list{$pvname_previous} },$alternate_pvname; |
|
|
0
|
|
|
|
|
0
|
|
|
190
|
0
|
|
|
|
|
0
|
$vg_info{$vgname}->{Physical_Vols}->{$pvname_previous}->{Alternate_Links}=\@{ $alternate_link_list{$pvname_previous} }; |
|
|
0
|
|
|
|
|
0
|
|
|
191
|
|
|
|
|
|
|
#print "alternate_pvname is $alternate_pvname\n"; |
|
192
|
0
|
|
|
|
|
0
|
$alternate_link="no"; |
|
193
|
|
|
|
|
|
|
#next LINEB; |
|
194
|
|
|
|
|
|
|
} |
|
195
|
|
|
|
|
|
|
# End of Alternate link code that I have yet to use in new format |
|
196
|
|
|
|
|
|
|
|
|
197
|
0
|
0
|
|
|
|
0
|
if ($templine =~ /^VG Name/) { |
|
198
|
|
|
|
|
|
|
#get the vgname |
|
199
|
0
|
|
|
|
|
0
|
@tempvgname = split /\s+/, $templine; |
|
200
|
0
|
|
|
|
|
0
|
$vgname = $tempvgname[2]; |
|
201
|
0
|
|
|
|
|
0
|
$vgname_save = $vgname; |
|
202
|
|
|
|
|
|
|
# print "Initializing $vgname...\n"; |
|
203
|
0
|
|
|
|
|
0
|
$volgrpdatacnt=0; |
|
204
|
0
|
|
|
|
|
0
|
$current_VG = $vgname; |
|
205
|
0
|
|
|
|
|
0
|
next LINEB; |
|
206
|
|
|
|
|
|
|
} |
|
207
|
0
|
0
|
|
|
|
0
|
next LINEB unless defined($current_VG); |
|
208
|
|
|
|
|
|
|
# Now get all the volumegroup data |
|
209
|
0
|
0
|
|
|
|
0
|
if ($templine =~ /^VG Write Access/) { |
|
210
|
0
|
|
|
|
|
0
|
@tempdataline=split /\s+/, $templine; |
|
211
|
0
|
|
|
|
|
0
|
$vg_info{$vgname}->{VG_Write_Access}=$tempdataline[3]; |
|
212
|
0
|
|
|
|
|
0
|
$volgrpdatacnt++; |
|
213
|
0
|
|
|
|
|
0
|
next LINEB; |
|
214
|
|
|
|
|
|
|
} |
|
215
|
0
|
0
|
|
|
|
0
|
if ($templine =~ /^VG Status/) { |
|
216
|
0
|
|
|
|
|
0
|
@tempdataline=split /\s+/, $templine; |
|
217
|
0
|
|
|
|
|
0
|
$vg_info{$vgname}->{VG_Status}=$tempdataline[2]; |
|
218
|
0
|
|
|
|
|
0
|
$volgrpdatacnt++; |
|
219
|
0
|
|
|
|
|
0
|
next LINEB; |
|
220
|
|
|
|
|
|
|
} |
|
221
|
0
|
0
|
|
|
|
0
|
if ($templine =~ /^Max LV/) { |
|
222
|
0
|
|
|
|
|
0
|
@tempdataline=split /\s+/, $templine; |
|
223
|
0
|
|
|
|
|
0
|
$vg_info{$vgname}->{Max_LV}=$tempdataline[2]; |
|
224
|
0
|
|
|
|
|
0
|
$volgrpdatacnt++; |
|
225
|
0
|
|
|
|
|
0
|
next LINEB; |
|
226
|
|
|
|
|
|
|
} |
|
227
|
0
|
0
|
|
|
|
0
|
if ($templine =~ /^Cur LV/) { |
|
228
|
0
|
|
|
|
|
0
|
@tempdataline=split /\s+/, $templine; |
|
229
|
0
|
|
|
|
|
0
|
$vg_info{$vgname}->{Cur_LV}=$tempdataline[2]; |
|
230
|
0
|
|
|
|
|
0
|
$volgrpdatacnt++; |
|
231
|
0
|
|
|
|
|
0
|
next LINEB; |
|
232
|
|
|
|
|
|
|
} |
|
233
|
0
|
0
|
|
|
|
0
|
if ($templine =~ /^Open LV/) { |
|
234
|
0
|
|
|
|
|
0
|
@tempdataline=split /\s+/, $templine; |
|
235
|
0
|
|
|
|
|
0
|
$vg_info{$vgname}->{Open_LV}=$tempdataline[2]; |
|
236
|
0
|
|
|
|
|
0
|
$volgrpdatacnt++; |
|
237
|
0
|
|
|
|
|
0
|
next LINEB; |
|
238
|
|
|
|
|
|
|
} |
|
239
|
0
|
0
|
|
|
|
0
|
if ($templine =~ /^Max PV/) { |
|
240
|
0
|
|
|
|
|
0
|
@tempdataline=split /\s+/, $templine; |
|
241
|
0
|
|
|
|
|
0
|
$vg_info{$vgname}->{Max_PV}=$tempdataline[2]; |
|
242
|
0
|
|
|
|
|
0
|
$volgrpdatacnt++; |
|
243
|
0
|
|
|
|
|
0
|
next LINEB; |
|
244
|
|
|
|
|
|
|
} |
|
245
|
0
|
0
|
|
|
|
0
|
if ($templine =~ /^Cur PV/) { |
|
246
|
0
|
|
|
|
|
0
|
@tempdataline=split /\s+/, $templine; |
|
247
|
0
|
|
|
|
|
0
|
$vg_info{$vgname}->{Cur_PV}=$tempdataline[2]; |
|
248
|
0
|
|
|
|
|
0
|
$volgrpdatacnt++; |
|
249
|
0
|
|
|
|
|
0
|
next LINEB; |
|
250
|
|
|
|
|
|
|
} |
|
251
|
0
|
0
|
|
|
|
0
|
if ($templine =~ /^Act PV/) { |
|
252
|
0
|
|
|
|
|
0
|
@tempdataline=split /\s+/, $templine; |
|
253
|
0
|
|
|
|
|
0
|
$vg_info{$vgname}->{Act_PV}=$tempdataline[2]; |
|
254
|
0
|
|
|
|
|
0
|
$volgrpdatacnt++; |
|
255
|
0
|
|
|
|
|
0
|
next LINEB; |
|
256
|
|
|
|
|
|
|
} |
|
257
|
0
|
0
|
|
|
|
0
|
if ($templine =~ /^Max PE per PV/) { |
|
258
|
0
|
|
|
|
|
0
|
@tempdataline=split /\s+/, $templine; |
|
259
|
0
|
|
|
|
|
0
|
$vg_info{$vgname}->{Max_PE_per_PV}=$tempdataline[4]; |
|
260
|
0
|
|
|
|
|
0
|
$volgrpdatacnt++; |
|
261
|
0
|
|
|
|
|
0
|
next LINEB; |
|
262
|
|
|
|
|
|
|
} |
|
263
|
0
|
0
|
|
|
|
0
|
if ($templine =~ /^VGDA/) { |
|
264
|
0
|
|
|
|
|
0
|
@tempdataline=split /\s+/, $templine; |
|
265
|
0
|
|
|
|
|
0
|
$vg_info{$vgname}->{VGDA}=$tempdataline[1]; |
|
266
|
0
|
|
|
|
|
0
|
$volgrpdatacnt++; |
|
267
|
0
|
|
|
|
|
0
|
next LINEB; |
|
268
|
|
|
|
|
|
|
} |
|
269
|
0
|
0
|
|
|
|
0
|
if ($templine =~ /^PE Size \(Mbytes\)/) { |
|
270
|
0
|
|
|
|
|
0
|
@tempdataline=split /\s+/, $templine; |
|
271
|
0
|
|
|
|
|
0
|
$vg_info{$vgname}->{PE_Size_Mbytes}=$tempdataline[3]; |
|
272
|
0
|
|
|
|
|
0
|
$volgrpdatacnt++; |
|
273
|
0
|
|
|
|
|
0
|
next LINEB; |
|
274
|
|
|
|
|
|
|
} |
|
275
|
0
|
0
|
|
|
|
0
|
if ($templine =~ /^Total PE/) { |
|
276
|
0
|
|
|
|
|
0
|
@tempdataline=split /\s+/, $templine; |
|
277
|
0
|
|
|
|
|
0
|
$vg_info{$vgname}->{Total_PE}=$tempdataline[2]; |
|
278
|
0
|
|
|
|
|
0
|
$volgrpdatacnt++; |
|
279
|
0
|
|
|
|
|
0
|
next LINEB; |
|
280
|
|
|
|
|
|
|
} |
|
281
|
0
|
0
|
|
|
|
0
|
if ($templine =~ /^Alloc PE/) { |
|
282
|
0
|
|
|
|
|
0
|
@tempdataline=split /\s+/, $templine; |
|
283
|
0
|
|
|
|
|
0
|
$vg_info{$vgname}->{Alloc_PE}=$tempdataline[2]; |
|
284
|
0
|
|
|
|
|
0
|
$volgrpdatacnt++; |
|
285
|
0
|
|
|
|
|
0
|
next LINEB; |
|
286
|
|
|
|
|
|
|
} |
|
287
|
0
|
0
|
|
|
|
0
|
if ($templine =~ /^Free PE/) { |
|
288
|
0
|
|
|
|
|
0
|
@tempdataline=split /\s+/, $templine; |
|
289
|
0
|
|
|
|
|
0
|
$vg_info{$vgname}->{Free_PE}=$tempdataline[2]; |
|
290
|
0
|
|
|
|
|
0
|
$volgrpdatacnt++; |
|
291
|
0
|
|
|
|
|
0
|
next LINEB; |
|
292
|
|
|
|
|
|
|
} |
|
293
|
0
|
0
|
|
|
|
0
|
if ($templine =~ /^Total PVG/) { |
|
294
|
0
|
|
|
|
|
0
|
@tempdataline=split /\s+/, $templine; |
|
295
|
0
|
|
|
|
|
0
|
$vg_info{$vgname}->{Total_PVG}=$tempdataline[2]; |
|
296
|
0
|
|
|
|
|
0
|
$volgrpdatacnt++; |
|
297
|
0
|
|
|
|
|
0
|
next LINEB; |
|
298
|
|
|
|
|
|
|
} |
|
299
|
0
|
0
|
|
|
|
0
|
if ( $volgrpdatacnt == 15 ) { |
|
300
|
0
|
0
|
|
|
|
0
|
print "Got all volume group data for $current_VG, $volgrpdatacnt of 15\n" if $debug; |
|
301
|
0
|
|
|
|
|
0
|
$volgrpdatacnt=0; |
|
302
|
|
|
|
|
|
|
} |
|
303
|
|
|
|
|
|
|
# |
|
304
|
|
|
|
|
|
|
# Now get and store logical volume data for current VG |
|
305
|
|
|
|
|
|
|
# |
|
306
|
0
|
0
|
|
|
|
0
|
if ($templine =~ /^ --- Logical volumes ---/) { |
|
307
|
|
|
|
|
|
|
#print "Start of Logical Volume data\n"; |
|
308
|
0
|
|
|
|
|
0
|
$lvcnt = 0; |
|
309
|
0
|
|
|
|
|
0
|
$parse_logical_vols="yes"; |
|
310
|
0
|
|
|
|
|
0
|
next LINEB; |
|
311
|
|
|
|
|
|
|
} |
|
312
|
0
|
0
|
|
|
|
0
|
if ($templine =~ /^ LV Name/) { |
|
313
|
0
|
|
|
|
|
0
|
@tempdataline=split /\s+/, $templine; |
|
314
|
0
|
0
|
|
|
|
0
|
print "Logical volume parse: $tempdataline[3]\n" if $debug; |
|
315
|
0
|
|
|
|
|
0
|
@tempdataline1 = split /\//, $tempdataline[3]; |
|
316
|
0
|
0
|
|
|
|
0
|
print "Just Logical Volume : $tempdataline1[3]\n" if $debug1; |
|
317
|
0
|
|
|
|
|
0
|
$lvname = $tempdataline1[3]; |
|
318
|
0
|
0
|
|
|
|
0
|
print "Starting logical volume $lvname\n" if $debug1; |
|
319
|
0
|
|
|
|
|
0
|
$lvdatacnt=0; |
|
320
|
0
|
|
|
|
|
0
|
next LINEB; |
|
321
|
|
|
|
|
|
|
} |
|
322
|
0
|
0
|
|
|
|
0
|
print "$templine" if $debug1; |
|
323
|
|
|
|
|
|
|
|
|
324
|
0
|
0
|
|
|
|
0
|
if ($templine =~ /^ LV Status/) { |
|
325
|
0
|
|
|
|
|
0
|
@tempdataline=split /\s+/, $templine; |
|
326
|
0
|
|
|
|
|
0
|
$vg_info{$vgname}->{lvols}->{$lvname}->{LV_Status} |
|
327
|
|
|
|
|
|
|
=$tempdataline[3]; |
|
328
|
0
|
|
|
|
|
0
|
$lvdatacnt++; |
|
329
|
0
|
|
|
|
|
0
|
next LINEB; |
|
330
|
|
|
|
|
|
|
} |
|
331
|
0
|
0
|
|
|
|
0
|
if ($templine =~ /^ LV Size \(Mbytes\)/) { |
|
332
|
0
|
|
|
|
|
0
|
@tempdataline=split /\s+/, $templine; |
|
333
|
0
|
|
|
|
|
0
|
$vg_info{$vgname}->{lvols}->{$lvname}->{LV_Size} |
|
334
|
|
|
|
|
|
|
=$tempdataline[4]; |
|
335
|
0
|
|
|
|
|
0
|
$lvdatacnt++; |
|
336
|
0
|
|
|
|
|
0
|
next LINEB; |
|
337
|
|
|
|
|
|
|
} |
|
338
|
0
|
0
|
|
|
|
0
|
if ($templine =~ /^ Current LE/) { |
|
339
|
0
|
|
|
|
|
0
|
@tempdataline=split /\s+/, $templine; |
|
340
|
0
|
|
|
|
|
0
|
$vg_info{$vgname}->{lvols}->{$lvname}->{Current_LE} |
|
341
|
|
|
|
|
|
|
=$tempdataline[3]; |
|
342
|
0
|
|
|
|
|
0
|
$lvdatacnt++; |
|
343
|
0
|
|
|
|
|
0
|
next LINEB; |
|
344
|
|
|
|
|
|
|
} |
|
345
|
0
|
0
|
|
|
|
0
|
if ($templine =~ /^ Allocated PE/) { |
|
346
|
0
|
|
|
|
|
0
|
@tempdataline=split /\s+/, $templine; |
|
347
|
0
|
|
|
|
|
0
|
$vg_info{$vgname}->{lvols}->{$lvname}->{Allocated_PE} |
|
348
|
|
|
|
|
|
|
=$tempdataline[3]; |
|
349
|
0
|
|
|
|
|
0
|
$lvdatacnt++; |
|
350
|
0
|
|
|
|
|
0
|
next LINEB; |
|
351
|
|
|
|
|
|
|
} |
|
352
|
0
|
0
|
|
|
|
0
|
if ($templine =~ /^ Used PV/) { |
|
353
|
0
|
|
|
|
|
0
|
@tempdataline=split /\s+/, $templine; |
|
354
|
0
|
|
|
|
|
0
|
$vg_info{$vgname}->{lvols}->{$lvname}->{Used_PV} |
|
355
|
|
|
|
|
|
|
=$tempdataline[3]; |
|
356
|
0
|
|
|
|
|
0
|
$lvdatacnt++; |
|
357
|
|
|
|
|
|
|
# |
|
358
|
|
|
|
|
|
|
# We should have all the logical volume data now |
|
359
|
|
|
|
|
|
|
# if not them something went horriby wrong and the next |
|
360
|
|
|
|
|
|
|
# statement will catch it and exit |
|
361
|
|
|
|
|
|
|
# |
|
362
|
0
|
0
|
|
|
|
0
|
if ($lvdatacnt != 5) { |
|
363
|
0
|
|
|
|
|
0
|
print "Did not get all the logical volume data from vgdisplay\n"; |
|
364
|
0
|
|
|
|
|
0
|
print "Only got $lvdatacnt of 5\n"; |
|
365
|
0
|
|
|
|
|
0
|
print "Problems...\n"; |
|
366
|
0
|
|
|
|
|
0
|
exit; |
|
367
|
|
|
|
|
|
|
} |
|
368
|
|
|
|
|
|
|
else { |
|
369
|
0
|
0
|
|
|
|
0
|
print "Got all $lvdatacnt of 5 logical volume data for $lvname\n\n" if $debug; |
|
370
|
0
|
0
|
|
|
|
0
|
print "vgname: $vgname\n" if $debug; |
|
371
|
0
|
0
|
|
|
|
0
|
print "lvname: $lvname\n" if $debug; |
|
372
|
|
|
|
|
|
|
|
|
373
|
0
|
0
|
|
|
|
0
|
@lvdisplay = |
|
374
|
|
|
|
|
|
|
`$remote_access $remote_system -l $remote_user -n $remote_command2 $vgname/$lvname` |
|
375
|
|
|
|
|
|
|
or die "remote command $remote_command2 failed: $@\n"; |
|
376
|
|
|
|
|
|
|
|
|
377
|
|
|
|
|
|
|
#for win95 debugging purposes |
|
378
|
|
|
|
|
|
|
# @lvdisplay = `type $lvname.vgtest`; |
|
379
|
|
|
|
|
|
|
|
|
380
|
0
|
|
|
|
|
0
|
LVDATALINE: foreach $lvdataline (@lvdisplay) { |
|
381
|
|
|
|
|
|
|
#attempt at keepalive timeout prevention below |
|
382
|
|
|
|
|
|
|
#attempt at stoping browser timeout print ""; |
|
383
|
|
|
|
|
|
|
|
|
384
|
0
|
0
|
|
|
|
0
|
if ($lvdataline =~ /^ --- Logical extents ---/) { |
|
385
|
|
|
|
|
|
|
# |
|
386
|
|
|
|
|
|
|
# Were done summ it up |
|
387
|
|
|
|
|
|
|
# |
|
388
|
0
|
0
|
|
|
|
0
|
print "Done getting physical volume data.\n" if $debug; |
|
389
|
0
|
0
|
|
|
|
0
|
print "Now comparing lvdisplay physical volumes to vgdisplays used PV for each lv. Yet another sanity check\n" if $debug; |
|
390
|
0
|
0
|
|
|
|
0
|
if ($lvpvcnt == $vg_info{$vgname}->{lvols}->{$lvname}->{Used_PV} ) { |
|
391
|
0
|
|
|
|
|
0
|
@final_pvnamedatatemp=(); |
|
392
|
|
|
|
|
|
|
} |
|
393
|
|
|
|
|
|
|
|
|
394
|
|
|
|
|
|
|
else { |
|
395
|
|
|
|
|
|
|
} |
|
396
|
0
|
|
|
|
|
0
|
$lvpvcnt=0; |
|
397
|
0
|
|
|
|
|
0
|
last LVDATALINE; |
|
398
|
|
|
|
|
|
|
} |
|
399
|
0
|
0
|
|
|
|
0
|
if ($lvdataline =~ /^--- Logical volumes ---/) { |
|
400
|
0
|
|
|
|
|
0
|
$started_lvdatacollect=1; |
|
401
|
0
|
|
|
|
|
0
|
next LVDATALINE; |
|
402
|
|
|
|
|
|
|
} |
|
403
|
|
|
|
|
|
|
|
|
404
|
0
|
0
|
|
|
|
0
|
if ($lvdataline =~ /^LV Name/) { |
|
405
|
|
|
|
|
|
|
#get the lvname just like getting the vgname part above |
|
406
|
0
|
|
|
|
|
0
|
@templvname = split /\s+/, $lvdataline; |
|
407
|
0
|
|
|
|
|
0
|
$lvname_confirm = $templvname[2]; |
|
408
|
0
|
0
|
|
|
|
0
|
print "Starting to process $lvname which should be the same as $lvname_confirm!...\n" if $debug; |
|
409
|
0
|
|
|
|
|
0
|
$lvdatacnt2=0; |
|
410
|
0
|
|
|
|
|
0
|
next LVDATALINE; |
|
411
|
|
|
|
|
|
|
} |
|
412
|
0
|
0
|
|
|
|
0
|
if ($lvdataline =~ /^VG Name/) { |
|
413
|
0
|
|
|
|
|
0
|
@templvname=split /\s+/, $lvdataline; |
|
414
|
0
|
|
|
|
|
0
|
$vg_info{$vgname}->{lvols}->{$lvname}->{lvdata}->{VG_Name}=$templvname[2]; |
|
415
|
0
|
|
|
|
|
0
|
$lvdatacnt2++; |
|
416
|
0
|
|
|
|
|
0
|
next LVDATALINE; |
|
417
|
|
|
|
|
|
|
} |
|
418
|
0
|
0
|
|
|
|
0
|
if ($lvdataline =~ /^LV Permission/) { |
|
419
|
0
|
|
|
|
|
0
|
@templvname=split /\s+/, $lvdataline; |
|
420
|
0
|
|
|
|
|
0
|
$vg_info{$vgname}->{lvols}->{$lvname}->{lvdata}->{LV_Permission}=$templvname[2]; |
|
421
|
0
|
|
|
|
|
0
|
$lvdatacnt2++; |
|
422
|
0
|
|
|
|
|
0
|
next LVDATALINE; |
|
423
|
|
|
|
|
|
|
} |
|
424
|
0
|
0
|
|
|
|
0
|
if ($lvdataline =~ /^LV Status/) { |
|
425
|
0
|
|
|
|
|
0
|
@templvname=split /\s+/, $lvdataline; |
|
426
|
0
|
|
|
|
|
0
|
$vg_info{$vgname}->{lvols}->{$lvname}->{lvdata}->{LV_Status}=$templvname[2]; |
|
427
|
0
|
|
|
|
|
0
|
$lvdatacnt2++; |
|
428
|
0
|
|
|
|
|
0
|
next LVDATALINE; |
|
429
|
|
|
|
|
|
|
} |
|
430
|
0
|
0
|
|
|
|
0
|
if ($lvdataline =~ /^Mirror copies/) { |
|
431
|
0
|
|
|
|
|
0
|
@templvname=split /\s+/, $lvdataline; |
|
432
|
0
|
|
|
|
|
0
|
$vg_info{$vgname}->{lvols}->{$lvname}->{lvdata}->{Mirror_copies}=$templvname[2]; |
|
433
|
0
|
|
|
|
|
0
|
$lvdatacnt2++; |
|
434
|
0
|
|
|
|
|
0
|
next LVDATALINE; |
|
435
|
|
|
|
|
|
|
} |
|
436
|
0
|
0
|
|
|
|
0
|
if ($lvdataline =~ /^Consistency Recovery/) { |
|
437
|
0
|
|
|
|
|
0
|
@templvname=split /\s+/, $lvdataline; |
|
438
|
0
|
|
|
|
|
0
|
$vg_info{$vgname}->{lvols}->{$lvname}->{lvdata}->{Consistency_Recovery}=$templvname[2]; |
|
439
|
0
|
|
|
|
|
0
|
$lvdatacnt2++; |
|
440
|
0
|
|
|
|
|
0
|
next LVDATALINE; |
|
441
|
|
|
|
|
|
|
} |
|
442
|
0
|
0
|
|
|
|
0
|
if ($lvdataline =~ /^Schedule/) { |
|
443
|
0
|
|
|
|
|
0
|
@templvname=split /\s+/, $lvdataline; |
|
444
|
0
|
|
|
|
|
0
|
$vg_info{$vgname}->{lvols}->{$lvname}->{lvdata}->{Schedule}=$templvname[1]; |
|
445
|
0
|
|
|
|
|
0
|
$lvdatacnt2++; |
|
446
|
0
|
|
|
|
|
0
|
next LVDATALINE; |
|
447
|
|
|
|
|
|
|
} |
|
448
|
0
|
0
|
|
|
|
0
|
if ($lvdataline =~ /^LV Size \(Mbytes\)/) { |
|
449
|
0
|
|
|
|
|
0
|
@templvname=split /\s+/, $lvdataline; |
|
450
|
0
|
|
|
|
|
0
|
$vg_info{$vgname}->{lvols}->{$lvname}->{lvdata}->{LV_Size_Mbytes}=$templvname[3]; |
|
451
|
0
|
|
|
|
|
0
|
$lvdatacnt2++; |
|
452
|
0
|
|
|
|
|
0
|
next LVDATALINE; |
|
453
|
|
|
|
|
|
|
} |
|
454
|
0
|
0
|
|
|
|
0
|
if ($lvdataline =~ /^Current LE/) { |
|
455
|
0
|
|
|
|
|
0
|
@templvname=split /\s+/, $lvdataline; |
|
456
|
0
|
|
|
|
|
0
|
$vg_info{$vgname}->{lvols}->{$lvname}->{lvdata}->{Current_LE}=$templvname[2]; |
|
457
|
0
|
|
|
|
|
0
|
$lvdatacnt2++; |
|
458
|
0
|
|
|
|
|
0
|
next LVDATALINE; |
|
459
|
|
|
|
|
|
|
} |
|
460
|
0
|
0
|
|
|
|
0
|
if ($lvdataline =~ /^Allocated PE/) { |
|
461
|
0
|
|
|
|
|
0
|
@templvname=split /\s+/, $lvdataline; |
|
462
|
0
|
|
|
|
|
0
|
$vg_info{$vgname}->{lvols}->{$lvname}->{lvdata}->{Allocated_PE}=$templvname[2]; |
|
463
|
0
|
|
|
|
|
0
|
$lvdatacnt2++; |
|
464
|
0
|
|
|
|
|
0
|
next LVDATALINE; |
|
465
|
|
|
|
|
|
|
} |
|
466
|
0
|
0
|
|
|
|
0
|
if ($lvdataline =~ /^Stripes/) { |
|
467
|
0
|
|
|
|
|
0
|
@templvname=split /\s+/, $lvdataline; |
|
468
|
0
|
|
|
|
|
0
|
$vg_info{$vgname}->{lvols}->{$lvname}->{lvdata}->{Stripes}=$templvname[1]; |
|
469
|
0
|
|
|
|
|
0
|
$lvdatacnt2++; |
|
470
|
0
|
|
|
|
|
0
|
next LVDATALINE; |
|
471
|
|
|
|
|
|
|
} |
|
472
|
0
|
0
|
|
|
|
0
|
if ($lvdataline =~ /^Stripe Size \(Kbytes\)/) { |
|
473
|
0
|
|
|
|
|
0
|
@templvname=split /\s+/, $lvdataline; |
|
474
|
0
|
|
|
|
|
0
|
$vg_info{$vgname}->{lvols}->{$lvname}->{lvdata}->{Stripe_Size_Kbytes}=$templvname[3]; |
|
475
|
0
|
|
|
|
|
0
|
$lvdatacnt2++; |
|
476
|
0
|
|
|
|
|
0
|
next LVDATALINE; |
|
477
|
|
|
|
|
|
|
} |
|
478
|
0
|
0
|
|
|
|
0
|
if ($lvdataline =~ /^Bad block/) { |
|
479
|
0
|
|
|
|
|
0
|
@templvname=split /\s+/, $lvdataline; |
|
480
|
0
|
|
|
|
|
0
|
$vg_info{$vgname}->{lvols}->{$lvname}->{lvdata}->{Bad_block}=$templvname[2]; |
|
481
|
0
|
|
|
|
|
0
|
$lvdatacnt2++; |
|
482
|
0
|
|
|
|
|
0
|
next LVDATALINE; |
|
483
|
|
|
|
|
|
|
} |
|
484
|
0
|
0
|
|
|
|
0
|
if ($lvdataline =~ /^Allocation/) { |
|
485
|
0
|
|
|
|
|
0
|
@templvname=split /\s+/, $lvdataline; |
|
486
|
0
|
|
|
|
|
0
|
$vg_info{$vgname}->{lvols}->{$lvname}->{lvdata}->{Allocation}=$templvname[1]; |
|
487
|
0
|
|
|
|
|
0
|
$lvdatacnt2++; |
|
488
|
0
|
|
|
|
|
0
|
next LVDATALINE; |
|
489
|
|
|
|
|
|
|
} |
|
490
|
0
|
0
|
|
|
|
0
|
if ($lvdataline =~ /^IO Timeout \(Seconds\)/) { |
|
491
|
0
|
|
|
|
|
0
|
@templvname=split /\s+/, $lvdataline; |
|
492
|
0
|
|
|
|
|
0
|
$vg_info{$vgname}->{lvols}->{$lvname}->{lvdata}->{IO_Timeout_Seconds}=$templvname[3]; |
|
493
|
0
|
|
|
|
|
0
|
$lvdatacnt2++; |
|
494
|
0
|
|
|
|
|
0
|
next LVDATALINE; |
|
495
|
|
|
|
|
|
|
} |
|
496
|
|
|
|
|
|
|
# End of extracting logical volume attributes |
|
497
|
|
|
|
|
|
|
#now count em up and compare to a static number that its supposed to be |
|
498
|
0
|
0
|
|
|
|
0
|
if ($lvdatacnt2 != 14) { |
|
499
|
0
|
|
|
|
|
0
|
print "Did not get all the logical volume data in lvdisplay command\n"; |
|
500
|
0
|
|
|
|
|
0
|
print "Only got $lvdatacnt2 of 14\n"; |
|
501
|
0
|
|
|
|
|
0
|
print "Problems...\n"; |
|
502
|
0
|
|
|
|
|
0
|
exit; |
|
503
|
|
|
|
|
|
|
} |
|
504
|
|
|
|
|
|
|
else { |
|
505
|
0
|
0
|
|
|
|
0
|
print "Got all $lvdatacnt2 of 14 logical volume data for $lvname\n\n" if $debug; |
|
506
|
|
|
|
|
|
|
} |
|
507
|
|
|
|
|
|
|
|
|
508
|
0
|
0
|
|
|
|
0
|
if ($lvdataline =~ /^ --- Distribution of logical volume ---/) { |
|
509
|
0
|
0
|
|
|
|
0
|
print "Start of Physical Volume data for $lvname\n" if $debug; |
|
510
|
0
|
|
|
|
|
0
|
$lvpvcnt = 0; |
|
511
|
0
|
|
|
|
|
0
|
next LVDATALINE; |
|
512
|
|
|
|
|
|
|
} |
|
513
|
|
|
|
|
|
|
|
|
514
|
0
|
0
|
|
|
|
0
|
if ($lvdataline =~ /^ \/dev/) { |
|
515
|
0
|
|
|
|
|
0
|
@tempdataline=split /\s+/, $lvdataline; |
|
516
|
|
|
|
|
|
|
# |
|
517
|
|
|
|
|
|
|
# Ouch, my head hurts now... Now I add a third hash with an annonymouns array as the value that |
|
518
|
|
|
|
|
|
|
# contains the pv info |
|
519
|
|
|
|
|
|
|
# |
|
520
|
0
|
|
|
|
|
0
|
$pvtempname=$tempdataline[1]; |
|
521
|
0
|
0
|
|
|
|
0
|
print "PVname should be : $pvtempname\n" if $debug; |
|
522
|
0
|
0
|
|
|
|
0
|
print "tempdataline2 is : $tempdataline[2]\n" if $debug; |
|
523
|
0
|
0
|
|
|
|
0
|
print "tempdataline3 is : $tempdataline[3]\n" if $debug; |
|
524
|
|
|
|
|
|
|
#add it here directly! |
|
525
|
0
|
|
|
|
|
0
|
$vg_info{$vgname}->{lvols}->{$lvname}->{Ordered_PV}->{$lvpvcnt}=$tempdataline[1]; |
|
526
|
0
|
|
|
|
|
0
|
$vg_info{$vgname}->{lvols}->{$lvname}->{PV_Data}->{$tempdataline[1]}->{le_on_pv}=$tempdataline[2]; |
|
527
|
0
|
|
|
|
|
0
|
$vg_info{$vgname}->{lvols}->{$lvname}->{PV_Data}->{$tempdataline[1]}->{pe_on_pv}=$tempdataline[3]; |
|
528
|
|
|
|
|
|
|
#$logical_volume_hash_data{$vgname}{$lvname}{LVPVDATA}=$lvdataline[2]; |
|
529
|
0
|
|
|
|
|
0
|
$lvpvcnt++; |
|
530
|
0
|
|
|
|
|
0
|
next LVDATALINE; |
|
531
|
|
|
|
|
|
|
} |
|
532
|
|
|
|
|
|
|
#NEXT LINE ENDS lvdisplay foreach |
|
533
|
|
|
|
|
|
|
} |
|
534
|
|
|
|
|
|
|
|
|
535
|
0
|
|
|
|
|
0
|
next LINEB; |
|
536
|
|
|
|
|
|
|
#next line ends else statement way up there |
|
537
|
|
|
|
|
|
|
} |
|
538
|
|
|
|
|
|
|
} #end of "Used PV last volume group extract if statement |
|
539
|
|
|
|
|
|
|
# |
|
540
|
|
|
|
|
|
|
# Here we start the physical volume data gathering thats in the vgdisplay output just for yucks... |
|
541
|
|
|
|
|
|
|
# |
|
542
|
0
|
0
|
|
|
|
0
|
if ($templine =~ /^ --- Physical volumes ---/) { |
|
543
|
|
|
|
|
|
|
# print "Start of Physical Volume data for volume group $current_VG\n"; |
|
544
|
0
|
|
|
|
|
0
|
$pvcnt = 0; |
|
545
|
0
|
|
|
|
|
0
|
next LINEB; |
|
546
|
|
|
|
|
|
|
} |
|
547
|
0
|
0
|
0
|
|
|
0
|
if ($templine =~ /^ PV Name/ && $templine !~ /Alternate Link/ ) { |
|
548
|
0
|
|
|
|
|
0
|
$lastline_save = $templine; |
|
549
|
0
|
|
|
|
|
0
|
@tempdataline=split /\s+/, $templine; |
|
550
|
0
|
|
|
|
|
0
|
$pvname = $tempdataline[3]; |
|
551
|
|
|
|
|
|
|
#print "Starting Physical volume $pvname in group $current_VG\n"; |
|
552
|
|
|
|
|
|
|
#push @{ $physical_volume_hash_data{$vgname}{$pvname}}, $tempdataline[3]; |
|
553
|
0
|
|
|
|
|
0
|
$pvdatacnt=0; |
|
554
|
0
|
|
|
|
|
0
|
next LINEB; |
|
555
|
|
|
|
|
|
|
} |
|
556
|
|
|
|
|
|
|
# |
|
557
|
|
|
|
|
|
|
#Added this one to support PV links |
|
558
|
|
|
|
|
|
|
# |
|
559
|
0
|
0
|
0
|
|
|
0
|
if ($templine =~ /^ PV Name/ && $templine =~ /Alternate Link/ ) { |
|
560
|
|
|
|
|
|
|
#set the flag for processing at the beginning of the next LINEB foreach |
|
561
|
0
|
0
|
|
|
|
0
|
print "Caught an alternate link\n" if $debug5; |
|
562
|
0
|
|
|
|
|
0
|
$alternate_line=$templine; |
|
563
|
0
|
|
|
|
|
0
|
$alternate_link="yes"; |
|
564
|
0
|
|
|
|
|
0
|
next LINEB; |
|
565
|
|
|
|
|
|
|
} |
|
566
|
|
|
|
|
|
|
|
|
567
|
0
|
0
|
|
|
|
0
|
if ($templine =~ /^ PV Status/) { |
|
568
|
|
|
|
|
|
|
# Made it past alternate links, set default value if its not there. |
|
569
|
0
|
0
|
|
|
|
0
|
unless ( exists( $vg_info{$vgname}->{Physical_Vols}->{$pvname}->{Alternate_Links}) ) { |
|
570
|
0
|
0
|
|
|
|
0
|
print "No Alternate links found! setting default\n" if $debug5; |
|
571
|
0
|
|
|
|
|
0
|
$vg_info{$vgname}->{Physical_Vols}->{$pvname}->{Alternate_Links}=[ "None" ]; |
|
572
|
|
|
|
|
|
|
} |
|
573
|
0
|
|
|
|
|
0
|
@tempdataline=split /\s+/, $templine; |
|
574
|
0
|
|
|
|
|
0
|
$vg_info{$vgname}->{Physical_Vols}->{$pvname}->{PV_Status}=$tempdataline[3]; |
|
575
|
0
|
|
|
|
|
0
|
$pvdatacnt++; |
|
576
|
0
|
|
|
|
|
0
|
next LINEB; |
|
577
|
|
|
|
|
|
|
} |
|
578
|
0
|
0
|
|
|
|
0
|
if ($templine =~ /^ Total PE/) { |
|
579
|
0
|
|
|
|
|
0
|
@tempdataline=split /\s+/, $templine; |
|
580
|
0
|
|
|
|
|
0
|
$vg_info{$vgname}->{Physical_Vols}->{$pvname}->{Total_PE}=$tempdataline[3]; |
|
581
|
0
|
|
|
|
|
0
|
$pvdatacnt++; |
|
582
|
0
|
|
|
|
|
0
|
next LINEB; |
|
583
|
|
|
|
|
|
|
} |
|
584
|
0
|
0
|
|
|
|
0
|
if ($templine =~ /^ Free PE/) { |
|
585
|
0
|
|
|
|
|
0
|
@tempdataline=split /\s+/, $templine; |
|
586
|
0
|
|
|
|
|
0
|
$vg_info{$vgname}->{Physical_Vols}->{$pvname}->{Free_PE}=$tempdataline[3]; |
|
587
|
0
|
|
|
|
|
0
|
$pvdatacnt++; |
|
588
|
|
|
|
|
|
|
# |
|
589
|
|
|
|
|
|
|
# We should have all the physical volume data now |
|
590
|
|
|
|
|
|
|
# |
|
591
|
0
|
0
|
|
|
|
0
|
if ($pvdatacnt != 3) { |
|
592
|
0
|
|
|
|
|
0
|
print "Did not get all the physical volume data\n"; |
|
593
|
0
|
|
|
|
|
0
|
print "Only got $pvdatacnt of 3\n"; |
|
594
|
0
|
|
|
|
|
0
|
print "Problems...\n"; |
|
595
|
0
|
|
|
|
|
0
|
exit; |
|
596
|
|
|
|
|
|
|
} |
|
597
|
|
|
|
|
|
|
else { |
|
598
|
|
|
|
|
|
|
# print "Got all $pvdatacnt of 3 physical volume data for $lvname\n"; |
|
599
|
|
|
|
|
|
|
} |
|
600
|
0
|
|
|
|
|
0
|
next LINEB; |
|
601
|
|
|
|
|
|
|
} |
|
602
|
|
|
|
|
|
|
|
|
603
|
|
|
|
|
|
|
#Should not see the next line print out!!! All lines should be accounted for |
|
604
|
|
|
|
|
|
|
#print "Unaccounted for line:\n"; |
|
605
|
|
|
|
|
|
|
#print "$templine"; |
|
606
|
|
|
|
|
|
|
} #end of vgdisplay extraction routine foreach |
|
607
|
|
|
|
|
|
|
|
|
608
|
0
|
0
|
|
|
|
0
|
if ( $arglist{persistance} eq "new" ) { |
|
609
|
0
|
0
|
|
|
|
0
|
print "saving a copy for prosperity...\n" if $debug; |
|
610
|
0
|
0
|
|
|
|
0
|
Storable::nstore \%vg_info, $datafile |
|
611
|
|
|
|
|
|
|
or die "unable to store hash data in /tmp\n"; |
|
612
|
|
|
|
|
|
|
} |
|
613
|
|
|
|
|
|
|
|
|
614
|
|
|
|
|
|
|
|
|
615
|
|
|
|
|
|
|
|
|
616
|
|
|
|
|
|
|
|
|
617
|
0
|
|
|
|
|
0
|
return bless($vginfo_ref, $class); |
|
618
|
|
|
|
|
|
|
} |
|
619
|
|
|
|
|
|
|
|
|
620
|
|
|
|
|
|
|
|
|
621
|
|
|
|
|
|
|
sub AUTOLOAD { |
|
622
|
|
|
|
|
|
|
# |
|
623
|
|
|
|
|
|
|
# Some ugly hacketry to be able to autoload sub hashes. |
|
624
|
|
|
|
|
|
|
# There must be a better way. |
|
625
|
|
|
|
|
|
|
# |
|
626
|
0
|
|
|
0
|
|
0
|
my $debug = 0; |
|
627
|
|
|
|
|
|
|
|
|
628
|
0
|
|
|
|
|
0
|
my ($class, @subargs) = @_ ; |
|
629
|
|
|
|
|
|
|
|
|
630
|
0
|
0
|
|
|
|
0
|
return if $AUTOLOAD =~ /::DESTROY$/; |
|
631
|
|
|
|
|
|
|
|
|
632
|
0
|
|
|
|
|
0
|
my %arglist = ( |
|
633
|
|
|
|
|
|
|
volume_group => undef, |
|
634
|
|
|
|
|
|
|
vg_sub_cat => undef, |
|
635
|
|
|
|
|
|
|
vg_sub_cat_lv => undef, |
|
636
|
|
|
|
|
|
|
vg_sub_cat_lv_data => undef, |
|
637
|
|
|
|
|
|
|
vg_sub_cat_pv => undef, |
|
638
|
|
|
|
|
|
|
vg_sub_cat_pv_data => undef, |
|
639
|
|
|
|
|
|
|
vg_sub_cat_pv_data_pv => undef, |
|
640
|
|
|
|
|
|
|
@subargs, |
|
641
|
|
|
|
|
|
|
); |
|
642
|
|
|
|
|
|
|
|
|
643
|
0
|
0
|
|
|
|
0
|
print "Passed: @_<--\n" if $debug; |
|
644
|
0
|
0
|
|
|
|
0
|
print "Yoyoyoyo got called here\n" if $debug; |
|
645
|
0
|
|
|
|
|
0
|
my $self = $class; |
|
646
|
0
|
|
0
|
|
|
0
|
my $VOLGRP = $arglist{volume_group} || "0"; #required to get anything useful |
|
647
|
0
|
0
|
|
|
|
0
|
print "VOLGRP is $VOLGRP\n" if $debug; |
|
648
|
0
|
|
0
|
|
|
0
|
my $THIRDARG = $arglist{vg_sub_cat} || "0"; # should be one of Volgrp attrs if not defined else: |
|
649
|
|
|
|
|
|
|
# "Physical_Vols" |
|
650
|
|
|
|
|
|
|
# "lvols" |
|
651
|
0
|
0
|
|
|
|
0
|
print "THIRDARG is $THIRDARG\n" if $debug; |
|
652
|
|
|
|
|
|
|
|
|
653
|
0
|
|
0
|
|
|
0
|
my $FOURTHARG = $arglist{vg_sub_cat_lv} || $arglist{vg_sub_cat_pv} || "0"; # can be each of the following: |
|
654
|
|
|
|
|
|
|
# actual phyical vol "/dev/dsk/..." |
|
655
|
|
|
|
|
|
|
# actual logical volume "lvol#" |
|
656
|
0
|
0
|
|
|
|
0
|
print "FOURTHARG is $FOURTHARG\n" if $debug; |
|
657
|
|
|
|
|
|
|
|
|
658
|
0
|
|
0
|
|
|
0
|
my $FIFTHARG = $arglist{vg_sub_cat_lv_data} || $arglist{vg_sub_cat_pv_data} || "0"; # Can be any of the following: |
|
659
|
|
|
|
|
|
|
# physical volume attribute if not defined |
|
660
|
|
|
|
|
|
|
# logical volume attribute if not defined |
|
661
|
|
|
|
|
|
|
# OR link on to: |
|
662
|
|
|
|
|
|
|
# "PV_Data" |
|
663
|
|
|
|
|
|
|
# "lvdata" |
|
664
|
0
|
0
|
|
|
|
0
|
print "FIFTHARG is $FIFTHARG\n" if $debug; |
|
665
|
|
|
|
|
|
|
|
|
666
|
0
|
|
0
|
|
|
0
|
my $SIXTHARG = $arglist{vg_sub_cat_pv_data_pv} || "0"; # can be "lvdata" attribute if not defined else |
|
667
|
|
|
|
|
|
|
# actual phyical volume "/dev/dsk..." |
|
668
|
0
|
0
|
|
|
|
0
|
print "SIXTHARG is $SIXTHARG\n" if $debug; |
|
669
|
|
|
|
|
|
|
|
|
670
|
0
|
0
|
|
|
|
0
|
print "VOLGRP: $VOLGRP\n" if $debug; |
|
671
|
0
|
0
|
|
|
|
0
|
print "AUTOLOAD: $AUTOLOAD\n" if $debug; |
|
672
|
0
|
0
|
|
|
|
0
|
$AUTOLOAD =~ /.*::get_(\w+)/ or croak "No Such method: $AUTOLOAD\n"; |
|
673
|
0
|
0
|
|
|
|
0
|
print "AUTOLOAD is now: $AUTOLOAD\n" if $debug; |
|
674
|
0
|
0
|
|
|
|
0
|
croak "$self not an object" unless ref($self); |
|
675
|
|
|
|
|
|
|
# return if $AUTOLOAD =~ /::DESTROY$/; |
|
676
|
|
|
|
|
|
|
# start checking arguments here from 6th down to 3rd |
|
677
|
0
|
0
|
|
|
|
0
|
print "\$1 is set to: $1\n" if $debug; |
|
678
|
|
|
|
|
|
|
|
|
679
|
|
|
|
|
|
|
|
|
680
|
0
|
0
|
|
|
|
0
|
if ($SIXTHARG) { |
|
681
|
0
|
0
|
|
|
|
0
|
print "Found sixtharg.\n" if $debug; |
|
682
|
0
|
0
|
|
|
|
0
|
unless (exists $self->{$VOLGRP}->{$THIRDARG}->{$FOURTHARG}->{$FIFTHARG}->{$SIXTHARG}->{$1}) { |
|
683
|
0
|
|
|
|
|
0
|
croak "Cannot access $1 field in $self->{$VOLGRP}->{$THIRDARG}->{$FOURTHARG}->{$FIFTHARG}->{$SIXTHARG}\n"; |
|
684
|
|
|
|
|
|
|
} |
|
685
|
0
|
|
|
|
|
0
|
return $self->{$VOLGRP}->{$THIRDARG}->{$FOURTHARG}->{$FIFTHARG}->{$SIXTHARG}->{$1}; |
|
686
|
|
|
|
|
|
|
} |
|
687
|
|
|
|
|
|
|
|
|
688
|
0
|
0
|
|
|
|
0
|
if ($FIFTHARG) { |
|
689
|
0
|
0
|
|
|
|
0
|
print "Found fiftharg.\n" if $debug; |
|
690
|
0
|
0
|
|
|
|
0
|
unless (exists $self->{$VOLGRP}->{$THIRDARG}->{$FOURTHARG}->{$FIFTHARG}->{$1}) { |
|
691
|
0
|
|
|
|
|
0
|
croak "Cannot access $1 field in $self->{$VOLGRP}->{$THIRDARG}->{$FOURTHARG}->{$FIFTHARG}\n"; |
|
692
|
|
|
|
|
|
|
} |
|
693
|
0
|
|
|
|
|
0
|
return $self->{$VOLGRP}->{$THIRDARG}->{$FOURTHARG}->{$FIFTHARG}->{$1}; |
|
694
|
|
|
|
|
|
|
} |
|
695
|
|
|
|
|
|
|
|
|
696
|
|
|
|
|
|
|
|
|
697
|
0
|
0
|
|
|
|
0
|
if ($FOURTHARG) { |
|
698
|
0
|
0
|
|
|
|
0
|
print "Found fourtharg.\n" if $debug; |
|
699
|
0
|
0
|
|
|
|
0
|
unless (exists $self->{$VOLGRP}->{$THIRDARG}->{$FOURTHARG}->{$1}) { |
|
700
|
0
|
|
|
|
|
0
|
croak "Cannot access $1 field in $self->{$VOLGRP}->{$THIRDARG}->{$FOURTHARG}\n"; |
|
701
|
|
|
|
|
|
|
} |
|
702
|
0
|
|
|
|
|
0
|
return $self->{$VOLGRP}->{$THIRDARG}->{$FOURTHARG}->{$1}; |
|
703
|
|
|
|
|
|
|
} |
|
704
|
|
|
|
|
|
|
|
|
705
|
0
|
0
|
|
|
|
0
|
if ($THIRDARG) { |
|
706
|
0
|
0
|
|
|
|
0
|
print "Found thirdarg.\n" if $debug; |
|
707
|
0
|
0
|
|
|
|
0
|
unless (exists $self->{$VOLGRP}->{$THIRDARG}->{$1}) { |
|
708
|
0
|
|
|
|
|
0
|
croak "Cannot access $1 field in $self->{$VOLGRP}->{$THIRDARG}"; |
|
709
|
|
|
|
|
|
|
} |
|
710
|
0
|
|
|
|
|
0
|
return $self->{$VOLGRP}->{$THIRDARG}->{$FOURTHARG}->{$1}; |
|
711
|
|
|
|
|
|
|
} |
|
712
|
|
|
|
|
|
|
|
|
713
|
|
|
|
|
|
|
# Just check the main volgrp attr |
|
714
|
0
|
0
|
|
|
|
0
|
print "No extra args. continur to check default level\n" if $debug; |
|
715
|
|
|
|
|
|
|
|
|
716
|
0
|
0
|
|
|
|
0
|
unless (exists $self->{$VOLGRP}->{$1}) { |
|
717
|
0
|
|
|
|
|
0
|
croak "Cannot access $1 field in $self->{$VOLGRP}\n"; |
|
718
|
|
|
|
|
|
|
} |
|
719
|
0
|
0
|
|
|
|
0
|
print "self says its: $self->{$1}\n" if $debug; |
|
720
|
0
|
0
|
|
|
|
0
|
if (@_) { return $self->{$VOLGRP}->{$1} = shift } |
|
|
0
|
|
|
|
|
0
|
|
|
721
|
0
|
|
|
|
|
0
|
else { return $self->{$VOLGRP}->{$1} } |
|
722
|
|
|
|
|
|
|
|
|
723
|
|
|
|
|
|
|
|
|
724
|
|
|
|
|
|
|
} |
|
725
|
|
|
|
|
|
|
|
|
726
|
|
|
|
|
|
|
sub traverse { |
|
727
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
|
728
|
0
|
|
|
|
|
0
|
my $debug=0; |
|
729
|
0
|
|
|
|
|
0
|
my $debug2=0; |
|
730
|
0
|
0
|
|
|
|
0
|
print "I am self: $self\n" if $debug; |
|
731
|
0
|
|
|
|
|
0
|
my $mainkey; |
|
732
|
|
|
|
|
|
|
my $subkey; |
|
733
|
0
|
|
|
|
|
0
|
my $subsubkey; |
|
734
|
0
|
|
|
|
|
0
|
my $subsubsubkey; |
|
735
|
0
|
|
|
|
|
0
|
my $subsubsubsubkey; |
|
736
|
0
|
|
|
|
|
0
|
my $subsubsubsubsubkey; |
|
737
|
0
|
|
|
|
|
0
|
my $dev_file; |
|
738
|
|
|
|
|
|
|
|
|
739
|
0
|
|
|
|
|
0
|
foreach $mainkey ( sort keys %{ $self } ) { |
|
|
0
|
|
|
|
|
0
|
|
|
740
|
0
|
|
|
|
|
0
|
print "Main Key: $mainkey\n"; |
|
741
|
0
|
|
|
|
|
0
|
print "Values:\n"; |
|
742
|
0
|
|
|
|
|
0
|
foreach $subkey ( sort keys %{ $self->{$mainkey} } ) { |
|
|
0
|
|
|
|
|
0
|
|
|
743
|
0
|
|
|
|
|
0
|
print " SubKey: $subkey, Value: $self->{$mainkey}->{$subkey}\n"; |
|
744
|
0
|
0
|
|
|
|
0
|
print "ref:",ref( $self->{$mainkey}->{$subkey} ),"\n" if $debug2; |
|
745
|
0
|
0
|
|
|
|
0
|
if (ref($self->{$mainkey}->{$subkey}) eq "HASH") { |
|
746
|
0
|
0
|
|
|
|
0
|
print "Got here identified sub hash!\n" if $debug2; |
|
747
|
0
|
|
|
|
|
0
|
foreach $subsubkey ( sort keys %{ $self->{$mainkey}->{$subkey} } ) { |
|
|
0
|
|
|
|
|
0
|
|
|
748
|
0
|
|
|
|
|
0
|
print " SubSubKey: $subsubkey Value: $self->{$mainkey}->{$subkey}->{$subsubkey}\n"; |
|
749
|
0
|
0
|
|
|
|
0
|
if (ref($self->{$mainkey}->{$subkey}->{$subsubkey}) eq "HASH") { |
|
750
|
0
|
0
|
|
|
|
0
|
print "Got here identified sub sub hash!\n" if $debug2; |
|
751
|
0
|
|
|
|
|
0
|
foreach $subsubsubkey ( sort keys %{ $self->{$mainkey}->{$subkey}->{$subsubkey} } ) { |
|
|
0
|
|
|
|
|
0
|
|
|
752
|
0
|
|
|
|
|
0
|
print " SubSubSubKey: $subsubsubkey Value: $self->{$mainkey}->{$subkey}->{$subsubkey}->{$subsubsubkey}\n"; |
|
753
|
0
|
0
|
|
|
|
0
|
if (ref($self->{$mainkey}->{$subkey}->{$subsubkey}->{$subsubsubkey}) eq "HASH") { |
|
754
|
0
|
0
|
|
|
|
0
|
print "Got here identified sub sub sub hash!\n" if $debug2; |
|
755
|
0
|
|
|
|
|
0
|
foreach $subsubsubsubkey ( sort keys %{ $self->{$mainkey}->{$subkey}->{$subsubkey}->{$subsubsubkey} } ) { |
|
|
0
|
|
|
|
|
0
|
|
|
756
|
0
|
|
|
|
|
0
|
print " SubSubSubSubKey: $subsubsubsubkey Value: $self->{$mainkey}->{$subkey}->{$subsubkey}->{$subsubsubkey}->{$subsubsubsubkey}\n"; |
|
757
|
0
|
0
|
|
|
|
0
|
if (ref($self->{$mainkey}->{$subkey}->{$subsubkey}->{$subsubsubkey}->{$subsubsubsubkey}) eq "HASH") { |
|
758
|
0
|
0
|
|
|
|
0
|
print "Got here identified sub sub sub sub hash!\n" if $debug2; |
|
759
|
0
|
|
|
|
|
0
|
foreach $subsubsubsubsubkey ( sort keys %{ $self->{$mainkey}->{$subkey}->{$subsubkey}->{$subsubsubkey}->{$subsubsubsubkey} } ) { |
|
|
0
|
|
|
|
|
0
|
|
|
760
|
0
|
|
|
|
|
0
|
print " SubSubSubSubSubKey: $subsubsubsubsubkey Value: $self->{$mainkey}->{$subkey}->{$subsubkey}->{$subsubsubkey}->{$subsubsubsubkey}->{$subsubsubsubsubkey}\n"; |
|
761
|
|
|
|
|
|
|
|
|
762
|
|
|
|
|
|
|
|
|
763
|
|
|
|
|
|
|
} |
|
764
|
|
|
|
|
|
|
} |
|
765
|
|
|
|
|
|
|
} |
|
766
|
|
|
|
|
|
|
} |
|
767
|
|
|
|
|
|
|
} |
|
768
|
|
|
|
|
|
|
} |
|
769
|
|
|
|
|
|
|
} |
|
770
|
|
|
|
|
|
|
} |
|
771
|
|
|
|
|
|
|
} |
|
772
|
|
|
|
|
|
|
} |
|
773
|
|
|
|
|
|
|
} |
|
774
|
|
|
|
|
|
|
|
|
775
|
|
|
|
|
|
|
|
|
776
|
0
|
|
|
0
|
1
|
0
|
sub get_all_lvols_on_disk { |
|
777
|
|
|
|
|
|
|
} |
|
778
|
|
|
|
|
|
|
|
|
779
|
|
|
|
|
|
|
sub get_disk_lvol_data { |
|
780
|
|
|
|
|
|
|
# disk device /dev/dsk/c4t3d0 passed or equivilent |
|
781
|
|
|
|
|
|
|
# returns pointer to hash of hashes |
|
782
|
|
|
|
|
|
|
# hash key: /dev/dsk/c#t#d# is a pointer to another hash |
|
783
|
|
|
|
|
|
|
# key:lvol is a pointer to yet another hash |
|
784
|
|
|
|
|
|
|
# key: le_on_pv value: "###" |
|
785
|
|
|
|
|
|
|
# key: pe_on_pv value: "###" |
|
786
|
|
|
|
|
|
|
# |
|
787
|
0
|
|
|
0
|
0
|
0
|
my ($self, @subargs) = @_; |
|
788
|
|
|
|
|
|
|
|
|
789
|
0
|
|
|
|
|
0
|
my %arglist = ( |
|
790
|
|
|
|
|
|
|
device_name => "" , |
|
791
|
|
|
|
|
|
|
@subargs, |
|
792
|
|
|
|
|
|
|
); |
|
793
|
0
|
|
|
|
|
0
|
my $dev_file = $arglist{device_name}; |
|
794
|
0
|
|
|
|
|
0
|
my $debug =0; |
|
795
|
0
|
|
|
|
|
0
|
my $debug2=0; |
|
796
|
0
|
0
|
|
|
|
0
|
print "I am self: $self\n" if $debug; |
|
797
|
0
|
|
|
|
|
0
|
my $mainkey; |
|
798
|
|
|
|
|
|
|
my $vg_phys_vols; |
|
799
|
0
|
|
|
|
|
0
|
my $vg_vol; |
|
800
|
0
|
|
|
|
|
0
|
my %lv_vols; |
|
801
|
0
|
|
|
|
|
0
|
my $lv_vols=\%lv_vols; |
|
802
|
0
|
|
|
|
|
0
|
my $lv_in_vg; |
|
803
|
|
|
|
|
|
|
my $pv_in_lv; |
|
804
|
0
|
|
|
|
|
0
|
my $pv_in_vg; |
|
805
|
0
|
|
|
|
|
0
|
my $logical_vol; #used in traversal at bottom for debugging |
|
806
|
0
|
|
|
|
|
0
|
foreach $mainkey ( sort keys %{ $self } ) { |
|
|
0
|
|
|
|
|
0
|
|
|
807
|
0
|
0
|
|
|
|
0
|
print "Main Key: $mainkey\n" if $debug; |
|
808
|
0
|
|
|
|
|
0
|
foreach $vg_phys_vols ( sort keys %{ $self->{$mainkey}->{Physical_Vols} } ) { |
|
|
0
|
|
|
|
|
0
|
|
|
809
|
0
|
0
|
|
|
|
0
|
print "Checking: $vg_phys_vols against $dev_file\n" if $debug; |
|
810
|
|
|
|
|
|
|
#First look for it on the vgdisplay output part. |
|
811
|
0
|
0
|
|
|
|
0
|
if ( $vg_phys_vols eq $dev_file ) { |
|
812
|
|
|
|
|
|
|
#if found there, then save it and continue to dig for per lv info |
|
813
|
0
|
0
|
|
|
|
0
|
print "Got one $vg_phys_vols equals $dev_file\n" if $debug; |
|
814
|
0
|
0
|
|
|
|
0
|
print "Checking further now that I've made a match\n" if $debug; |
|
815
|
0
|
0
|
|
|
|
0
|
print "Found device $dev_file in $mainkey!\n" if $debug2; |
|
816
|
0
|
|
|
|
|
0
|
$vg_vol=$mainkey; |
|
817
|
0
|
0
|
|
|
|
0
|
print "Volume Group is $vg_vol now\n" if $debug; |
|
818
|
0
|
|
|
|
|
0
|
foreach $lv_in_vg ( sort keys %{ $self->{$mainkey}->{lvols} } ) { |
|
|
0
|
|
|
|
|
0
|
|
|
819
|
0
|
0
|
|
|
|
0
|
print "Checking lvol $lv_in_vg for phys_dev\n"if $debug; |
|
820
|
0
|
|
|
|
|
0
|
foreach $pv_in_lv ( sort keys %{ $self->{$mainkey}->{lvols}->{$lv_in_vg}->{PV_Data} } ) { |
|
|
0
|
|
|
|
|
0
|
|
|
821
|
0
|
0
|
|
|
|
0
|
print "Checking $pv_in_vg to match $dev_file\n" if $debug; |
|
822
|
0
|
0
|
|
|
|
0
|
if ( $pv_in_lv eq $dev_file ) { |
|
823
|
0
|
0
|
|
|
|
0
|
print "Matched lvol specific physical vol $lv_in_vg: $vg_phys_vols equals $dev_file\n" if $debug; |
|
824
|
0
|
|
|
|
|
0
|
$lv_vols->{$lv_in_vg}= { |
|
825
|
|
|
|
|
|
|
vg_on_pv => $vg_vol, |
|
826
|
|
|
|
|
|
|
le_on_pv => $self->{$mainkey}->{lvols}->{$lv_in_vg}->{PV_Data}->{$dev_file}->{le_on_pv}, |
|
827
|
|
|
|
|
|
|
pe_on_pv => $self->{$mainkey}->{lvols}->{$lv_in_vg}->{PV_Data}->{$dev_file}->{pe_on_pv}, |
|
828
|
|
|
|
|
|
|
}; |
|
829
|
|
|
|
|
|
|
} |
|
830
|
|
|
|
|
|
|
|
|
831
|
|
|
|
|
|
|
} |
|
832
|
|
|
|
|
|
|
} |
|
833
|
|
|
|
|
|
|
|
|
834
|
|
|
|
|
|
|
|
|
835
|
|
|
|
|
|
|
|
|
836
|
|
|
|
|
|
|
|
|
837
|
|
|
|
|
|
|
|
|
838
|
|
|
|
|
|
|
|
|
839
|
|
|
|
|
|
|
|
|
840
|
|
|
|
|
|
|
|
|
841
|
|
|
|
|
|
|
} |
|
842
|
|
|
|
|
|
|
} |
|
843
|
|
|
|
|
|
|
|
|
844
|
|
|
|
|
|
|
} |
|
845
|
0
|
0
|
|
|
|
0
|
print "$dev_file:\n" if $debug2; |
|
846
|
0
|
|
|
|
|
0
|
foreach $logical_vol ( sort keys %{ $lv_vols } ) { |
|
|
0
|
|
|
|
|
0
|
|
|
847
|
0
|
0
|
|
|
|
0
|
print " logical_vol: $logical_vol\n" if $debug2; |
|
848
|
0
|
0
|
|
|
|
0
|
print " le_on_pv: $lv_vols{$logical_vol}->{le_on_pv}\n" if $debug2; |
|
849
|
0
|
0
|
|
|
|
0
|
print " pe_on_pv: $lv_vols{$logical_vol}->{pe_on_pv}\n" if $debug2; |
|
850
|
|
|
|
|
|
|
} |
|
851
|
0
|
|
|
|
|
0
|
return \%lv_vols; |
|
852
|
|
|
|
|
|
|
|
|
853
|
|
|
|
|
|
|
} |
|
854
|
|
|
|
|
|
|
|
|
855
|
|
|
|
|
|
|
sub get_all_volumegroups { |
|
856
|
|
|
|
|
|
|
# Returns an array of all the Volume groups (primary keys) |
|
857
|
|
|
|
|
|
|
# No args needed |
|
858
|
1
|
|
|
1
|
0
|
38
|
my ($self, @subargs) = @_; |
|
859
|
|
|
|
|
|
|
|
|
860
|
1
|
|
|
|
|
4
|
my %arglist = ( |
|
861
|
|
|
|
|
|
|
@subargs, |
|
862
|
|
|
|
|
|
|
); |
|
863
|
1
|
|
|
|
|
2
|
my $debug =0; |
|
864
|
1
|
|
|
|
|
2
|
my $debug2=0; |
|
865
|
1
|
|
|
|
|
3
|
my $mainkey; |
|
866
|
|
|
|
|
|
|
my @volumegroups; |
|
867
|
1
|
|
|
|
|
2
|
foreach $mainkey (sort keys %{ $self } ) { |
|
|
1
|
|
|
|
|
13
|
|
|
868
|
1
|
|
|
|
|
4
|
push @volumegroups, $mainkey; |
|
869
|
|
|
|
|
|
|
} |
|
870
|
1
|
|
|
|
|
5
|
return \@volumegroups; |
|
871
|
|
|
|
|
|
|
} |
|
872
|
|
|
|
|
|
|
sub get_all_pvlinks { |
|
873
|
|
|
|
|
|
|
# |
|
874
|
|
|
|
|
|
|
# |
|
875
|
|
|
|
|
|
|
# |
|
876
|
|
|
|
|
|
|
# Returns a hash of array/s with pimary links as keys and second |
|
877
|
|
|
|
|
|
|
# and thrid etc links as an ordered array. |
|
878
|
|
|
|
|
|
|
# ie. /dev/dsk/c1t2d0 :Key |
|
879
|
|
|
|
|
|
|
# /dev/dsk/c2t2d0 1st alternate :$array[0] |
|
880
|
|
|
|
|
|
|
# /dev/dsk/c3t2d0 2nd alternate :$array[1] |
|
881
|
|
|
|
|
|
|
# /dev/dsk/c4t2d0 3rd alternate :$array[2] |
|
882
|
|
|
|
|
|
|
# No args needed |
|
883
|
0
|
|
|
0
|
0
|
0
|
my ($self, @subargs) = @_; |
|
884
|
|
|
|
|
|
|
|
|
885
|
0
|
|
|
|
|
0
|
my %arglist = ( |
|
886
|
|
|
|
|
|
|
@subargs, |
|
887
|
|
|
|
|
|
|
); |
|
888
|
0
|
|
|
|
|
0
|
my $debug =0; |
|
889
|
0
|
|
|
|
|
0
|
my $debug2=0; |
|
890
|
0
|
|
|
|
|
0
|
my $debug5=0; |
|
891
|
0
|
|
|
|
|
0
|
my $mainkey; |
|
892
|
|
|
|
|
|
|
my $vg; |
|
893
|
0
|
|
|
|
|
0
|
my $pvinvg; |
|
894
|
0
|
|
|
|
|
0
|
my @volumegroups; |
|
895
|
0
|
|
|
|
|
0
|
my @lvol_attra; |
|
896
|
0
|
|
|
|
|
0
|
my %returnhash=""; |
|
897
|
0
|
|
|
|
|
0
|
foreach $mainkey (sort keys %{ $self } ) { |
|
|
0
|
|
|
|
|
0
|
|
|
898
|
0
|
0
|
|
|
|
0
|
print "Volume Groups in self: $mainkey\n" if $debug5; |
|
899
|
0
|
|
|
|
|
0
|
push @volumegroups, $mainkey; |
|
900
|
|
|
|
|
|
|
} |
|
901
|
0
|
|
|
|
|
0
|
foreach $vg ( @volumegroups ) { |
|
902
|
0
|
0
|
|
|
|
0
|
print "VG: $vg\n" if $debug5; |
|
903
|
0
|
|
|
|
|
0
|
PVLOOP: foreach $pvinvg (sort keys %{ $self->{$vg}->{Physical_Vols} } ) { |
|
|
0
|
|
|
|
|
0
|
|
|
904
|
|
|
|
|
|
|
# |
|
905
|
|
|
|
|
|
|
# Check each physical volume, check for pvlinks and add them as appropriate |
|
906
|
|
|
|
|
|
|
# |
|
907
|
0
|
0
|
|
|
|
0
|
print "PVinVG: $pvinvg\n" if $debug5; |
|
908
|
0
|
0
|
|
|
|
0
|
if ( $self->{$vg}->{Physical_Vols}->{$pvinvg}->{Alternate_Links}->[0] eq "None" ) { |
|
909
|
0
|
0
|
|
|
|
0
|
print "It was NOT defined, continuing\n" if $debug5; |
|
910
|
0
|
|
|
|
|
0
|
@lvol_attra = ""; |
|
911
|
0
|
|
|
|
|
0
|
next PVLOOP; |
|
912
|
|
|
|
|
|
|
} |
|
913
|
|
|
|
|
|
|
else { |
|
914
|
0
|
0
|
|
|
|
0
|
print "It was defined, continuing\n" if $debug5; |
|
915
|
0
|
|
|
|
|
0
|
@lvol_attra = @{ $self->{$vg}->{Physical_Vols}->{$pvinvg}->{Alternate_Links} }; |
|
|
0
|
|
|
|
|
0
|
|
|
916
|
0
|
0
|
|
|
|
0
|
print "lvol_attra: @lvol_attra\n " if $debug5; |
|
917
|
0
|
|
|
|
|
0
|
$returnhash{$pvinvg} = [ @lvol_attra ]; |
|
918
|
|
|
|
|
|
|
} |
|
919
|
|
|
|
|
|
|
|
|
920
|
|
|
|
|
|
|
} |
|
921
|
|
|
|
|
|
|
} |
|
922
|
0
|
|
|
|
|
0
|
return \%returnhash; |
|
923
|
|
|
|
|
|
|
} |
|
924
|
|
|
|
|
|
|
sub get_vg_physicalvols { |
|
925
|
|
|
|
|
|
|
#return an array |
|
926
|
|
|
|
|
|
|
#pass vg |
|
927
|
|
|
|
|
|
|
|
|
928
|
1
|
|
|
1
|
1
|
12
|
my ($self, @subargs) = @_; |
|
929
|
|
|
|
|
|
|
|
|
930
|
1
|
|
|
|
|
5
|
my %arglist = ( |
|
931
|
|
|
|
|
|
|
volume_group => "" , |
|
932
|
|
|
|
|
|
|
@subargs, |
|
933
|
|
|
|
|
|
|
); |
|
934
|
1
|
|
|
|
|
3
|
my $vol_group = $arglist{volume_group}; |
|
935
|
1
|
|
|
|
|
2
|
my $debug =0; |
|
936
|
1
|
|
|
|
|
3
|
my $debug2=0; |
|
937
|
1
|
|
|
|
|
2
|
my $mainkey; |
|
938
|
|
|
|
|
|
|
my @physicalvols; |
|
939
|
1
|
|
|
|
|
2
|
foreach $mainkey (sort keys %{ $self->{$vol_group}->{Physical_Vols} } ) { |
|
|
1
|
|
|
|
|
5
|
|
|
940
|
1
|
|
|
|
|
3
|
push @physicalvols, $mainkey; |
|
941
|
|
|
|
|
|
|
} |
|
942
|
1
|
|
|
|
|
6
|
return \@physicalvols; |
|
943
|
|
|
|
|
|
|
|
|
944
|
|
|
|
|
|
|
} |
|
945
|
|
|
|
|
|
|
sub get_vg_physicalvol_attr { |
|
946
|
|
|
|
|
|
|
#return an scalar |
|
947
|
|
|
|
|
|
|
#pass vg,phyvol,attr |
|
948
|
|
|
|
|
|
|
|
|
949
|
0
|
|
|
0
|
1
|
0
|
my ($self, @subargs) = @_; |
|
950
|
0
|
|
|
|
|
0
|
my $debug=0; |
|
951
|
0
|
|
|
|
|
0
|
my $debug2=0; |
|
952
|
0
|
0
|
|
|
|
0
|
print "I am: $self\n" if $debug; |
|
953
|
0
|
0
|
|
|
|
0
|
print "Args: @subargs\n" if $debug; |
|
954
|
|
|
|
|
|
|
|
|
955
|
0
|
|
|
|
|
0
|
my %arglist = ( |
|
956
|
|
|
|
|
|
|
volume_group => "" , |
|
957
|
|
|
|
|
|
|
device_name => "" , |
|
958
|
|
|
|
|
|
|
attribute => "" , |
|
959
|
|
|
|
|
|
|
@subargs, |
|
960
|
|
|
|
|
|
|
); |
|
961
|
0
|
|
|
|
|
0
|
my $vol_group = $arglist{volume_group}; |
|
962
|
0
|
|
|
|
|
0
|
my $dev_file = $arglist{device_name}; |
|
963
|
0
|
0
|
|
|
|
0
|
print "Vol_group is : $vol_group\n" if $debug; |
|
964
|
0
|
|
|
|
|
0
|
my $attr = $arglist{attribute}; |
|
965
|
0
|
|
|
|
|
0
|
my $mainkey; |
|
966
|
|
|
|
|
|
|
my $physical_attr; |
|
967
|
0
|
0
|
|
|
|
0
|
print "Vol_group is : $vol_group\n" if $debug; |
|
968
|
0
|
|
|
|
|
0
|
$physical_attr = $self->{$vol_group}->{Physical_Vols}->{$dev_file}->{$attr}; |
|
969
|
0
|
|
|
|
|
0
|
return $physical_attr; |
|
970
|
|
|
|
|
|
|
|
|
971
|
|
|
|
|
|
|
} |
|
972
|
|
|
|
|
|
|
sub get_vg_lvols { |
|
973
|
|
|
|
|
|
|
#return an array |
|
974
|
|
|
|
|
|
|
#pass vg |
|
975
|
|
|
|
|
|
|
|
|
976
|
1
|
|
|
1
|
1
|
37
|
my ($self, @subargs) = @_; |
|
977
|
|
|
|
|
|
|
|
|
978
|
1
|
|
|
|
|
5
|
my %arglist = ( |
|
979
|
|
|
|
|
|
|
volume_group => "" , |
|
980
|
|
|
|
|
|
|
@subargs, |
|
981
|
|
|
|
|
|
|
); |
|
982
|
1
|
|
|
|
|
2
|
my $vol_group = $arglist{volume_group}; |
|
983
|
1
|
|
|
|
|
3
|
my $debug =0; |
|
984
|
1
|
|
|
|
|
1
|
my $debug2=0; |
|
985
|
1
|
|
|
|
|
2
|
my $mainkey; |
|
986
|
|
|
|
|
|
|
my @logicalvols; |
|
987
|
1
|
|
|
|
|
2
|
foreach $mainkey ( sort keys %{ $self->{$vol_group}->{lvols} } ) { |
|
|
1
|
|
|
|
|
10
|
|
|
988
|
9
|
|
|
|
|
16
|
push @logicalvols, $mainkey; |
|
989
|
|
|
|
|
|
|
} |
|
990
|
1
|
|
|
|
|
6
|
return \@logicalvols; |
|
991
|
|
|
|
|
|
|
|
|
992
|
|
|
|
|
|
|
} |
|
993
|
|
|
|
|
|
|
sub get_vg_lvol_attr_vgdisplay { |
|
994
|
|
|
|
|
|
|
#return an scalar |
|
995
|
|
|
|
|
|
|
#pass vg,lvol,attr |
|
996
|
|
|
|
|
|
|
|
|
997
|
5
|
|
|
5
|
1
|
55
|
my ($self, @subargs) = @_; |
|
998
|
|
|
|
|
|
|
|
|
999
|
5
|
|
|
|
|
20
|
my %arglist = ( |
|
1000
|
|
|
|
|
|
|
volume_group => "" , |
|
1001
|
|
|
|
|
|
|
logical_vol => "" , |
|
1002
|
|
|
|
|
|
|
attribute => "" , |
|
1003
|
|
|
|
|
|
|
@subargs, |
|
1004
|
|
|
|
|
|
|
); |
|
1005
|
5
|
|
|
|
|
8
|
my $vol_group = $arglist{volume_group}; |
|
1006
|
5
|
|
|
|
|
9
|
my $logical_vol = $arglist{logical_vol}; |
|
1007
|
5
|
|
|
|
|
7
|
my $attr = $arglist{attribute}; |
|
1008
|
5
|
|
|
|
|
7
|
my $debug =0; |
|
1009
|
5
|
|
|
|
|
6
|
my $debug2=0; |
|
1010
|
5
|
50
|
|
|
|
10
|
print "vol_group: $vol_group\n" if $debug; |
|
1011
|
5
|
50
|
|
|
|
12
|
print "logical_vol: $logical_vol\n" if $debug; |
|
1012
|
5
|
50
|
|
|
|
8
|
print "attribute: $attr\n" if $debug; |
|
1013
|
5
|
|
|
|
|
5
|
my $lvol_attr; |
|
1014
|
|
|
|
|
|
|
my $mainkey; |
|
1015
|
5
|
|
|
|
|
13
|
$lvol_attr = $self->{$vol_group}->{lvols}->{$logical_vol}->{$attr}; |
|
1016
|
5
|
50
|
|
|
|
11
|
print "attribute is: $lvol_attr\n" if $debug; |
|
1017
|
5
|
|
|
|
|
25
|
return $lvol_attr; |
|
1018
|
|
|
|
|
|
|
} |
|
1019
|
|
|
|
|
|
|
sub get_vg_alternate_links { |
|
1020
|
|
|
|
|
|
|
#return an array |
|
1021
|
|
|
|
|
|
|
#pass vg,pv |
|
1022
|
|
|
|
|
|
|
|
|
1023
|
0
|
|
|
0
|
1
|
0
|
my ($self, @subargs) = @_; |
|
1024
|
|
|
|
|
|
|
|
|
1025
|
0
|
|
|
|
|
0
|
my %arglist = ( |
|
1026
|
|
|
|
|
|
|
volume_group => "" , |
|
1027
|
|
|
|
|
|
|
device_name => "" , |
|
1028
|
|
|
|
|
|
|
attribute => "Alternate_Links" , |
|
1029
|
|
|
|
|
|
|
@subargs, |
|
1030
|
|
|
|
|
|
|
); |
|
1031
|
0
|
|
|
|
|
0
|
my $vol_group = $arglist{volume_group}; |
|
1032
|
0
|
|
|
|
|
0
|
my $device_name = $arglist{device_name}; |
|
1033
|
0
|
|
|
|
|
0
|
my $attr = $arglist{attribute}; |
|
1034
|
0
|
|
|
|
|
0
|
my $debug =0; |
|
1035
|
0
|
|
|
|
|
0
|
my $debug2=0; |
|
1036
|
0
|
|
|
|
|
0
|
my $debug5=0; |
|
1037
|
0
|
0
|
|
|
|
0
|
print "vol_group: $vol_group\n" if $debug5; |
|
1038
|
0
|
0
|
|
|
|
0
|
print "attribute: $attr\n" if $debug5; |
|
1039
|
0
|
0
|
|
|
|
0
|
print "device_name: $device_name\n" if $debug5; |
|
1040
|
0
|
|
|
|
|
0
|
my @lvol_attr; |
|
1041
|
0
|
0
|
|
|
|
0
|
if ( defined( $self->{$vol_group}->{Physical_Vols}->{$device_name}->{$attr} ) ) { |
|
1042
|
0
|
0
|
|
|
|
0
|
print "It was defined, continuing\n" if $debug5; |
|
1043
|
0
|
|
|
|
|
0
|
@lvol_attr = @{ $self->{$vol_group}->{Physical_Vols}->{$device_name}->{$attr} }; |
|
|
0
|
|
|
|
|
0
|
|
|
1044
|
|
|
|
|
|
|
} |
|
1045
|
|
|
|
|
|
|
else { |
|
1046
|
0
|
0
|
|
|
|
0
|
print "It was NOT defined, continuing\n" if $debug5; |
|
1047
|
0
|
|
|
|
|
0
|
@lvol_attr = ( "NotDefined" ); |
|
1048
|
|
|
|
|
|
|
} |
|
1049
|
0
|
|
|
|
|
0
|
return \@lvol_attr; |
|
1050
|
|
|
|
|
|
|
} |
|
1051
|
|
|
|
|
|
|
|
|
1052
|
|
|
|
|
|
|
sub get_vg_lvol_attr_lvdisplay { |
|
1053
|
|
|
|
|
|
|
#return an scalar |
|
1054
|
|
|
|
|
|
|
#pass vg,lvol,attr |
|
1055
|
|
|
|
|
|
|
|
|
1056
|
5
|
|
|
5
|
1
|
40
|
my ($self, @subargs) = @_; |
|
1057
|
|
|
|
|
|
|
|
|
1058
|
5
|
|
|
|
|
21
|
my %arglist = ( |
|
1059
|
|
|
|
|
|
|
volume_group => "" , |
|
1060
|
|
|
|
|
|
|
logical_vol => "" , |
|
1061
|
|
|
|
|
|
|
attribute => "" , |
|
1062
|
|
|
|
|
|
|
@subargs, |
|
1063
|
|
|
|
|
|
|
); |
|
1064
|
5
|
|
|
|
|
9
|
my $vol_group = $arglist{volume_group}; |
|
1065
|
5
|
|
|
|
|
15
|
my $logical_vol = $arglist{logical_vol}; |
|
1066
|
5
|
|
|
|
|
9
|
my $attr = $arglist{attribute}; |
|
1067
|
5
|
|
|
|
|
18
|
my $debug =0; |
|
1068
|
5
|
|
|
|
|
6
|
my $debug2=0; |
|
1069
|
5
|
|
|
|
|
11
|
my $mainkey; |
|
1070
|
|
|
|
|
|
|
my $lvol_attr; |
|
1071
|
5
|
|
|
|
|
16
|
$lvol_attr = $self->{$vol_group}->{lvols}->{$logical_vol}->{lvdata}->{$attr}; |
|
1072
|
5
|
|
|
|
|
22
|
return $lvol_attr; |
|
1073
|
|
|
|
|
|
|
} |
|
1074
|
|
|
|
|
|
|
|
|
1075
|
|
|
|
|
|
|
sub get_vg_lvol_stripeorder { |
|
1076
|
|
|
|
|
|
|
#return an array |
|
1077
|
|
|
|
|
|
|
#pass vg,lvol,phyvol |
|
1078
|
|
|
|
|
|
|
|
|
1079
|
0
|
|
|
0
|
0
|
|
my ($self, @subargs) = @_; |
|
1080
|
|
|
|
|
|
|
|
|
1081
|
0
|
|
|
|
|
|
my %arglist = ( |
|
1082
|
|
|
|
|
|
|
volume_group => "" , |
|
1083
|
|
|
|
|
|
|
logical_vol => "" , |
|
1084
|
|
|
|
|
|
|
@subargs, |
|
1085
|
|
|
|
|
|
|
); |
|
1086
|
0
|
|
|
|
|
|
my $vol_group = $arglist{volume_group}; |
|
1087
|
0
|
|
|
|
|
|
my $logical_vol = $arglist{logical_vol}; |
|
1088
|
0
|
|
|
|
|
|
my $debug =0; |
|
1089
|
0
|
|
|
|
|
|
my $debug2=0; |
|
1090
|
0
|
|
|
|
|
|
my $mainkey; |
|
1091
|
|
|
|
|
|
|
my @lvol_stripeorder; |
|
1092
|
0
|
|
|
|
|
|
foreach $mainkey ( sort keys %{ $self->{$vol_group}->{lvols}->{$logical_vol}->{'Ordered_PV'} } ) { |
|
|
0
|
|
|
|
|
|
|
|
1093
|
0
|
|
|
|
|
|
push @lvol_stripeorder, $self->{$vol_group}->{lvols}->{$logical_vol}->{'Ordered_PV'}->{ $mainkey }; |
|
1094
|
|
|
|
|
|
|
} |
|
1095
|
0
|
|
|
|
|
|
return \@lvol_stripeorder; |
|
1096
|
|
|
|
|
|
|
} |
|
1097
|
|
|
|
|
|
|
|
|
1098
|
|
|
|
|
|
|
sub get_vg_lvol_physicalvols { |
|
1099
|
|
|
|
|
|
|
#return an array |
|
1100
|
|
|
|
|
|
|
#pass vg,lvol,phyvol |
|
1101
|
|
|
|
|
|
|
|
|
1102
|
0
|
|
|
0
|
1
|
|
my ($self, @subargs) = @_; |
|
1103
|
|
|
|
|
|
|
|
|
1104
|
0
|
|
|
|
|
|
my %arglist = ( |
|
1105
|
|
|
|
|
|
|
volume_group => "" , |
|
1106
|
|
|
|
|
|
|
logical_vol => "" , |
|
1107
|
|
|
|
|
|
|
device_name => "" , |
|
1108
|
|
|
|
|
|
|
@subargs, |
|
1109
|
|
|
|
|
|
|
); |
|
1110
|
0
|
|
|
|
|
|
my $vol_group = $arglist{volume_group}; |
|
1111
|
0
|
|
|
|
|
|
my $logical_vol = $arglist{logical_vol}; |
|
1112
|
0
|
|
|
|
|
|
my $device_name = $arglist{device_name}; |
|
1113
|
0
|
|
|
|
|
|
my $debug =0; |
|
1114
|
0
|
|
|
|
|
|
my $debug2=0; |
|
1115
|
0
|
|
|
|
|
|
my $mainkey; |
|
1116
|
|
|
|
|
|
|
my @lvol_physvols; |
|
1117
|
0
|
|
|
|
|
|
foreach $mainkey ( sort keys %{ $self->{$vol_group}->{lvols}->{$logical_vol}->{'PV_Data'} } ) { |
|
|
0
|
|
|
|
|
|
|
|
1118
|
0
|
|
|
|
|
|
push @lvol_physvols, $mainkey; |
|
1119
|
|
|
|
|
|
|
} |
|
1120
|
0
|
|
|
|
|
|
return \@lvol_physvols; |
|
1121
|
|
|
|
|
|
|
} |
|
1122
|
|
|
|
|
|
|
sub get_vg_lvol_physicalvol_attr{ |
|
1123
|
|
|
|
|
|
|
#return an scalar |
|
1124
|
|
|
|
|
|
|
#pass vg,lvol,phyvol,attr |
|
1125
|
|
|
|
|
|
|
|
|
1126
|
0
|
|
|
0
|
1
|
|
my ($self, @subargs) = @_; |
|
1127
|
|
|
|
|
|
|
|
|
1128
|
0
|
|
|
|
|
|
my %arglist = ( |
|
1129
|
|
|
|
|
|
|
volume_group => "" , |
|
1130
|
|
|
|
|
|
|
logical_vol => "" , |
|
1131
|
|
|
|
|
|
|
device_name => "" , |
|
1132
|
|
|
|
|
|
|
attribute => "" , |
|
1133
|
|
|
|
|
|
|
@subargs, |
|
1134
|
|
|
|
|
|
|
); |
|
1135
|
0
|
|
|
|
|
|
my $vol_group = $arglist{volume_group}; |
|
1136
|
0
|
|
|
|
|
|
my $logical_vol = $arglist{logical_vol}; |
|
1137
|
0
|
|
|
|
|
|
my $device_name = $arglist{device_name}; |
|
1138
|
0
|
|
|
|
|
|
my $attr = $arglist{attribute}; |
|
1139
|
0
|
|
|
|
|
|
my $debug =0; |
|
1140
|
0
|
|
|
|
|
|
my $debug2=0; |
|
1141
|
0
|
|
|
|
|
|
my $mainkey; |
|
1142
|
|
|
|
|
|
|
my $lvol_physvol_attr; |
|
1143
|
0
|
|
|
|
|
|
$lvol_physvol_attr = $self->{$vol_group}->{lvols}->{$logical_vol}->{PV_Data}->{$device_name}->{$attr}; |
|
1144
|
0
|
|
|
|
|
|
return $lvol_physvol_attr; |
|
1145
|
|
|
|
|
|
|
} |
|
1146
|
|
|
|
|
|
|
|
|
1147
|
|
|
|
|
|
|
### End |
|
1148
|
|
|
|
|
|
|
1; |
|
1149
|
|
|
|
|
|
|
__END__ |