line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package FusionInventory::Agent::Task::Inventory::Linux::Storages::Lsilogic; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
113501445
|
use strict; |
|
1
|
|
|
|
|
13
|
|
|
1
|
|
|
|
|
77
|
|
4
|
1
|
|
|
1
|
|
7
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
68
|
|
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
490
|
use FusionInventory::Agent::Tools; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
150
|
|
7
|
1
|
|
|
1
|
|
550
|
use FusionInventory::Agent::Tools::Linux; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
365
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub isEnabled { |
10
|
0
|
|
|
0
|
0
|
|
return canRun('mpt-status'); |
11
|
|
|
|
|
|
|
} |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub doInventory { |
14
|
0
|
|
|
0
|
0
|
|
my (%params) = @_; |
15
|
|
|
|
|
|
|
|
16
|
0
|
|
|
|
|
|
my $inventory = $params{inventory}; |
17
|
0
|
|
|
|
|
|
my $logger = $params{logger}; |
18
|
|
|
|
|
|
|
|
19
|
0
|
|
|
|
|
|
my @devices = getDevicesFromUdev(logger => $logger); |
20
|
|
|
|
|
|
|
|
21
|
0
|
|
|
|
|
|
foreach my $device (@devices) { |
22
|
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
|
|
|
|
|
|
my $info = getInfoFromSmartctl(device => $disk->{device}); |
29
|
0
|
|
|
|
|
|
foreach my $key (qw/SERIALNUMBER DESCRIPTION TYPE/) { |
30
|
0
|
|
|
|
|
|
$disk->{$key} = $info->{$key}; |
31
|
|
|
|
|
|
|
} |
32
|
0
|
|
|
|
|
|
delete $disk->{device}; |
33
|
0
|
|
|
|
|
|
$inventory->addEntry(section => 'STORAGES', entry => $disk); |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub _getDiskFromMptStatus { |
40
|
0
|
|
|
0
|
|
|
my (%params) = @_; |
41
|
|
|
|
|
|
|
|
42
|
0
|
|
|
|
|
|
my $handle = getFileHandle(%params); |
43
|
0
|
0
|
|
|
|
|
next unless $handle; |
44
|
|
|
|
|
|
|
|
45
|
0
|
|
|
|
|
|
my @disks; |
46
|
0
|
|
|
|
|
|
while (my $line = <$handle>) { |
47
|
0
|
0
|
|
|
|
|
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
|
0
|
|
|
|
|
|
my $disk = { |
57
|
|
|
|
|
|
|
NAME => $params{name}, |
58
|
|
|
|
|
|
|
device => "/dev/sg$1", |
59
|
|
|
|
|
|
|
MODEL => $2, |
60
|
|
|
|
|
|
|
MANUFACTURER => getCanonicalManufacturer($2), |
61
|
|
|
|
|
|
|
FIRMWARE => $3, |
62
|
|
|
|
|
|
|
DISKSIZE => $4 * 1024 |
63
|
|
|
|
|
|
|
}; |
64
|
|
|
|
|
|
|
|
65
|
0
|
|
|
|
|
|
push @disks, $disk; |
66
|
|
|
|
|
|
|
} |
67
|
0
|
|
|
|
|
|
close $handle; |
68
|
|
|
|
|
|
|
|
69
|
0
|
|
|
|
|
|
return @disks; |
70
|
|
|
|
|
|
|
} |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
1; |