line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package FusionInventory::Agent::Task::Inventory::Linux::Storages::Lsilogic; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
118311937
|
use strict; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
61
|
|
4
|
2
|
|
|
2
|
|
7
|
use warnings; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
69
|
|
5
|
|
|
|
|
|
|
|
6
|
2
|
|
|
2
|
|
375
|
use FusionInventory::Agent::Tools; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
243
|
|
7
|
2
|
|
|
2
|
|
735
|
use FusionInventory::Agent::Tools::Linux; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
577
|
|
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
|
|
305
|
my (%params) = @_; |
41
|
|
|
|
|
|
|
|
42
|
2
|
|
|
|
|
7
|
my $handle = getFileHandle(%params); |
43
|
2
|
50
|
|
|
|
5
|
next unless $handle; |
44
|
|
|
|
|
|
|
|
45
|
2
|
|
|
|
|
3
|
my @disks; |
46
|
2
|
|
|
|
|
22
|
while (my $line = <$handle>) { |
47
|
18
|
100
|
|
|
|
109
|
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
|
|
|
|
|
25
|
device => "/dev/sg$1", |
59
|
|
|
|
|
|
|
MODEL => $2, |
60
|
|
|
|
|
|
|
MANUFACTURER => getCanonicalManufacturer($2), |
61
|
|
|
|
|
|
|
FIRMWARE => $3, |
62
|
|
|
|
|
|
|
DISKSIZE => $4 * 1024 |
63
|
|
|
|
|
|
|
}; |
64
|
|
|
|
|
|
|
|
65
|
8
|
|
|
|
|
21
|
push @disks, $disk; |
66
|
|
|
|
|
|
|
} |
67
|
2
|
|
|
|
|
10
|
close $handle; |
68
|
|
|
|
|
|
|
|
69
|
2
|
|
|
|
|
10
|
return @disks; |
70
|
|
|
|
|
|
|
} |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
1; |