| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package IBM::StorageSystem::Enclosure; |
|
2
|
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
5
|
use strict; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
33
|
|
|
4
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
24
|
|
|
5
|
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
623
|
use IBM::StorageSystem::Enclosure::Canister; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
30
|
|
|
7
|
1
|
|
|
1
|
|
660
|
use IBM::StorageSystem::Enclosure::Battery; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
29
|
|
|
8
|
1
|
|
|
1
|
|
1008
|
use IBM::StorageSystem::Enclosure::Slot; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
32
|
|
|
9
|
1
|
|
|
1
|
|
859
|
use IBM::StorageSystem::Enclosure::PSU; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
73
|
|
|
10
|
1
|
|
|
1
|
|
6
|
use Scalar::Util qw(weaken); |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
66
|
|
|
11
|
1
|
|
|
1
|
|
6
|
use Carp qw(croak); |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
178
|
|
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
our $VERSION = '0.01'; |
|
14
|
|
|
|
|
|
|
our @ATTR = qw(FRU_identity FRU_part_number IO_group_id IO_group_name drive_slots |
|
15
|
|
|
|
|
|
|
error_sequence_number fault_LED firmware_level_1 firmware_level_2 id identify_LED |
|
16
|
|
|
|
|
|
|
machine_part_number managed online_PSUs online_canisters product_MTM serial_number |
|
17
|
|
|
|
|
|
|
status total_PSUs total_canisters type); |
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
our $OBJ = { |
|
20
|
|
|
|
|
|
|
psu => { |
|
21
|
|
|
|
|
|
|
bcmd => 'lsenclosurepsu -nohdr -delim :', |
|
22
|
|
|
|
|
|
|
cmd => 'lsenclosurepsu -psu', |
|
23
|
|
|
|
|
|
|
id => 'PSU_id', |
|
24
|
|
|
|
|
|
|
class => 'IBM::StorageSystem::Enclosure::PSU', |
|
25
|
|
|
|
|
|
|
type => 'psu', |
|
26
|
|
|
|
|
|
|
}, |
|
27
|
|
|
|
|
|
|
battery => { |
|
28
|
|
|
|
|
|
|
bcmd => 'lsenclosurebattery -nohdr -delim :', |
|
29
|
|
|
|
|
|
|
cmd => 'lsenclosurebattery -battery', |
|
30
|
|
|
|
|
|
|
id => 'battery_id', |
|
31
|
|
|
|
|
|
|
class => 'IBM::StorageSystem::Enclosure::Battery', |
|
32
|
|
|
|
|
|
|
type => 'battery' |
|
33
|
|
|
|
|
|
|
}, |
|
34
|
|
|
|
|
|
|
slot => { |
|
35
|
|
|
|
|
|
|
bcmd => 'lsenclosureslot -nohdr -delim :', |
|
36
|
|
|
|
|
|
|
cmd => 'lsenclosureslot -slot', |
|
37
|
|
|
|
|
|
|
id => 'slot_id', |
|
38
|
|
|
|
|
|
|
class => 'IBM::StorageSystem::Enclosure::Slot', |
|
39
|
|
|
|
|
|
|
type => 'slot' |
|
40
|
|
|
|
|
|
|
}, |
|
41
|
|
|
|
|
|
|
canister => { |
|
42
|
|
|
|
|
|
|
bcmd => 'lsenclosurecanister -nohdr -delim :', |
|
43
|
|
|
|
|
|
|
cmd => 'lsenclosurecanister -canister', |
|
44
|
|
|
|
|
|
|
id => 'canister_id', |
|
45
|
|
|
|
|
|
|
class => 'IBM::StorageSystem::Enclosure::Canister', |
|
46
|
|
|
|
|
|
|
type => 'slot' |
|
47
|
|
|
|
|
|
|
}, |
|
48
|
|
|
|
|
|
|
}; |
|
49
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
foreach my $attr ( @ATTR ) { |
|
51
|
|
|
|
|
|
|
{ |
|
52
|
1
|
|
|
1
|
|
6
|
no strict 'refs'; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
454
|
|
|
53
|
|
|
|
|
|
|
*{ __PACKAGE__ .'::'. $attr } = sub { |
|
54
|
0
|
|
|
0
|
|
|
my( $self, $val ) = @_; |
|
|
|
|
|
0
|
|
|
|
|
55
|
0
|
0
|
|
|
|
|
$self->{$attr} = $val if $val; |
|
56
|
0
|
|
|
|
|
|
return $self->{$attr} |
|
57
|
|
|
|
|
|
|
} |
|
58
|
|
|
|
|
|
|
} |
|
59
|
|
|
|
|
|
|
} |
|
60
|
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
sub new { |
|
62
|
0
|
|
|
0
|
1
|
|
my( $class, $ibm, %args ) = @_; |
|
63
|
0
|
|
|
|
|
|
my $self = bless {}, $class; |
|
64
|
0
|
0
|
|
|
|
|
$args{id} or croak 'Constructor failed: mandatory id argument not supplied'; |
|
65
|
0
|
|
|
|
|
|
weaken( $self->{__ibm} = $ibm ); |
|
66
|
|
|
|
|
|
|
|
|
67
|
0
|
|
|
|
|
|
foreach my $attr ( @ATTR ) { $self->{$attr} = $args{$attr} } |
|
|
0
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
|
|
69
|
0
|
|
|
|
|
|
return $self |
|
70
|
|
|
|
|
|
|
} |
|
71
|
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
foreach my $obj ( keys %{ $OBJ } ) { |
|
73
|
|
|
|
|
|
|
{ |
|
74
|
1
|
|
|
1
|
|
7
|
no strict 'refs'; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
459
|
|
|
75
|
|
|
|
|
|
|
my $m = 'get_'.$obj.'s'; |
|
76
|
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
*{ __PACKAGE__ ."::$obj" } = sub { |
|
78
|
0
|
|
|
0
|
|
|
my( $self, $id ) = @_; |
|
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
79
|
0
|
0
|
|
|
|
|
defined $id or return; |
|
80
|
0
|
0
|
|
|
|
|
return ( $self->{$obj}->{$id} ? $self->{$obj}->{$id} : $self->$m( $id ) ) |
|
81
|
|
|
|
|
|
|
}; |
|
82
|
|
|
|
|
|
|
|
|
83
|
0
|
|
|
0
|
|
|
*{ __PACKAGE__ .'::get_'. $obj } = sub { return $_[0]->$m( $_[1] ) }; |
|
84
|
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
*{ __PACKAGE__ ."::$m" } = sub { |
|
86
|
0
|
|
|
0
|
|
|
my( $self, $id ) = @_; |
|
87
|
|
|
|
|
|
|
|
|
88
|
0
|
|
|
|
|
|
my @objects = map { ( split /:/, $_ )[1] . " $self->{id}" } |
|
|
0
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
split /\n/, $self->{__ibm}->__cmd( $OBJ->{$obj}->{bcmd} ." $self->{id}" ); |
|
90
|
|
|
|
|
|
|
|
|
91
|
0
|
|
|
|
|
|
my %a = ( objects => [@objects], cmd => $OBJ->{$obj}->{cmd}, class => $OBJ->{$obj}->{class}, nocache => 1 ); |
|
92
|
|
|
|
|
|
|
|
|
93
|
0
|
|
|
|
|
|
@objects = $self->{__ibm}->__get_ml_objects( %a ); |
|
94
|
|
|
|
|
|
|
|
|
95
|
0
|
|
|
|
|
|
foreach my $object ( @objects ) { $self->{ $OBJ->{$obj}->{type} }->{ $object->{ $OBJ->{$obj}->{id} } } = $object } |
|
|
0
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
|
|
97
|
0
|
0
|
|
|
|
|
return ( defined $id ? $self->{ $OBJ->{$obj}->{type} }->{$id} : @objects ) |
|
98
|
|
|
|
|
|
|
} |
|
99
|
|
|
|
|
|
|
} |
|
100
|
|
|
|
|
|
|
} |
|
101
|
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
1; |
|
103
|
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
__END__ |