line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package FusionInventory::Agent::Task::Inventory::Linux::Storages::Lsilogic; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
143380198
|
use strict; |
|
2
|
|
|
|
|
8
|
|
|
2
|
|
|
|
|
148
|
|
4
|
2
|
|
|
2
|
|
18
|
use warnings; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
163
|
|
5
|
|
|
|
|
|
|
|
6
|
2
|
|
|
2
|
|
1136
|
use FusionInventory::Agent::Tools; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
421
|
|
7
|
2
|
|
|
2
|
|
1347
|
use FusionInventory::Agent::Tools::Linux; |
|
2
|
|
|
|
|
8
|
|
|
2
|
|
|
|
|
881
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub isEnabled { |
10
|
0
|
|
|
0
|
0
|
0
|
return canRun('mpt-status'); |
11
|
|
|
|
|
|
|
} |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub doInventory { |
14
|
0
|
|
|
0
|
0
|
0
|
my (%params) = @_; |
15
|
|
|
|
|
|
|
|
16
|
0
|
|
|
|
|
0
|
my $inventory = $params{inventory}; |
17
|
0
|
|
|
|
|
0
|
my $logger = $params{logger}; |
18
|
|
|
|
|
|
|
|
19
|
0
|
|
|
|
|
0
|
my @devices = getDevicesFromUdev(logger => $logger); |
20
|
|
|
|
|
|
|
|
21
|
0
|
|
|
|
|
0
|
foreach my $device (@devices) { |
22
|
0
|
|
|
|
|
0
|
foreach my $disk (_getDiskFromMptStatus( |
23
|
|
|
|
|
|
|
name => $device->{NAME}, |
24
|
|
|
|
|
|
|
logger => $logger, |
25
|
|
|
|
|
|
|
command => "mpt-status -n -i $device->{SCSI_UNID}" |
26
|
|
|
|
|
|
|
)) { |
27
|
|
|
|
|
|
|
# merge with smartctl info |
28
|
0
|
|
|
|
|
0
|
my $info = getInfoFromSmartctl(device => $disk->{device}); |
29
|
0
|
|
|
|
|
0
|
foreach my $key (qw/SERIALNUMBER DESCRIPTION TYPE/) { |
30
|
0
|
|
|
|
|
0
|
$disk->{$key} = $info->{$key}; |
31
|
|
|
|
|
|
|
} |
32
|
0
|
|
|
|
|
0
|
delete $disk->{device}; |
33
|
0
|
|
|
|
|
0
|
$inventory->addEntry(section => 'STORAGES', entry => $disk); |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub _getDiskFromMptStatus { |
40
|
2
|
|
|
2
|
|
333
|
my (%params) = @_; |
41
|
|
|
|
|
|
|
|
42
|
2
|
|
|
|
|
12
|
my $handle = getFileHandle(%params); |
43
|
2
|
50
|
|
|
|
10
|
next unless $handle; |
44
|
|
|
|
|
|
|
|
45
|
2
|
|
|
|
|
4
|
my @disks; |
46
|
2
|
|
|
|
|
42
|
while (my $line = <$handle>) { |
47
|
18
|
100
|
|
|
|
173
|
next unless $line =~ / |
48
|
|
|
|
|
|
|
phys_id:(\d+) \s |
49
|
|
|
|
|
|
|
scsi_id:\d+ \s |
50
|
|
|
|
|
|
|
vendor:\S+ \s+ |
51
|
|
|
|
|
|
|
product_id:(\S.+\S) \s+ |
52
|
|
|
|
|
|
|
revision:(\S+) \s+ |
53
|
|
|
|
|
|
|
size\(GB\):(\d+) |
54
|
|
|
|
|
|
|
/x; |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
my $disk = { |
57
|
|
|
|
|
|
|
NAME => $params{name}, |
58
|
8
|
|
|
|
|
41
|
device => "/dev/sg$1", |
59
|
|
|
|
|
|
|
MODEL => $2, |
60
|
|
|
|
|
|
|
MANUFACTURER => getCanonicalManufacturer($2), |
61
|
|
|
|
|
|
|
FIRMWARE => $3, |
62
|
|
|
|
|
|
|
DISKSIZE => $4 * 1024 |
63
|
|
|
|
|
|
|
}; |
64
|
|
|
|
|
|
|
|
65
|
8
|
|
|
|
|
38
|
push @disks, $disk; |
66
|
|
|
|
|
|
|
} |
67
|
2
|
|
|
|
|
17
|
close $handle; |
68
|
|
|
|
|
|
|
|
69
|
2
|
|
|
|
|
13
|
return @disks; |
70
|
|
|
|
|
|
|
} |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
1; |