line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package FusionInventory::Agent::Task::Inventory::Generic::Dmidecode::Bios; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
121887255
|
use strict; |
|
1
|
|
|
|
|
20
|
|
|
1
|
|
|
|
|
221
|
|
4
|
1
|
|
|
1
|
|
18
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
99
|
|
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
642
|
use FusionInventory::Agent::Tools; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
299
|
|
7
|
1
|
|
|
1
|
|
1051
|
use FusionInventory::Agent::Tools::Generic; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
970
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub isEnabled { |
10
|
0
|
|
|
0
|
0
|
|
return 1; |
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 ($bios, $hardware) = _getBiosHardware(logger => $logger); |
20
|
|
|
|
|
|
|
|
21
|
0
|
0
|
|
|
|
|
$inventory->setBios($bios) if $bios; |
22
|
0
|
0
|
|
|
|
|
$inventory->setHardware($hardware) if $hardware; |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub _getBiosHardware { |
26
|
0
|
|
|
0
|
|
|
my $infos = getDmidecodeInfos(@_); |
27
|
|
|
|
|
|
|
|
28
|
0
|
|
|
|
|
|
my $bios_info = $infos->{0}->[0]; |
29
|
0
|
|
|
|
|
|
my $system_info = $infos->{1}->[0]; |
30
|
0
|
|
|
|
|
|
my $base_info = $infos->{2}->[0]; |
31
|
0
|
|
|
|
|
|
my $chassis_info = $infos->{3}->[0]; |
32
|
|
|
|
|
|
|
|
33
|
0
|
|
|
|
|
|
my $bios = { |
34
|
|
|
|
|
|
|
BMANUFACTURER => $bios_info->{'Vendor'}, |
35
|
|
|
|
|
|
|
BDATE => $bios_info->{'Release Date'}, |
36
|
|
|
|
|
|
|
BVERSION => $bios_info->{'Version'}, |
37
|
|
|
|
|
|
|
ASSETTAG => $chassis_info->{'Asset Tag'} |
38
|
|
|
|
|
|
|
}; |
39
|
|
|
|
|
|
|
|
40
|
0
|
|
0
|
|
|
|
$bios->{SMODEL} = |
41
|
|
|
|
|
|
|
$system_info->{'Product'} || |
42
|
|
|
|
|
|
|
$system_info->{'Product Name'}; |
43
|
0
|
|
|
|
|
|
$bios->{MMODEL} = $base_info->{'Product Name'}; |
44
|
0
|
|
|
|
|
|
$bios->{SKUNUMBER} = $system_info->{'SKU Number'}; |
45
|
|
|
|
|
|
|
|
46
|
0
|
|
0
|
|
|
|
$bios->{SMANUFACTURER} = |
47
|
|
|
|
|
|
|
$system_info->{'Manufacturer'} || |
48
|
|
|
|
|
|
|
$system_info->{'Vendor'}; |
49
|
0
|
|
|
|
|
|
$bios->{MMANUFACTURER} = $base_info->{'Manufacturer'}; |
50
|
|
|
|
|
|
|
|
51
|
0
|
|
|
|
|
|
$bios->{SSN} = $system_info->{'Serial Number'}; |
52
|
0
|
|
|
|
|
|
$bios->{MSN} = $base_info->{'Serial Number'}; |
53
|
|
|
|
|
|
|
|
54
|
0
|
|
|
|
|
|
my $hardware = { |
55
|
|
|
|
|
|
|
UUID => $system_info->{'UUID'}, |
56
|
|
|
|
|
|
|
CHASSIS_TYPE => $chassis_info->{'Type'} |
57
|
|
|
|
|
|
|
}; |
58
|
|
|
|
|
|
|
|
59
|
0
|
|
|
|
|
|
my $vmsystem; |
60
|
0
|
0
|
0
|
|
|
|
if ($bios->{SMANUFACTURER} && |
|
|
0
|
0
|
|
|
|
|
|
|
0
|
0
|
|
|
|
|
|
|
0
|
|
|
|
|
|
61
|
|
|
|
|
|
|
$bios->{SMANUFACTURER} =~ /^Microsoft Corporation$/ && |
62
|
|
|
|
|
|
|
$bios->{SMODEL} && |
63
|
|
|
|
|
|
|
$bios->{SMODEL} =~ /Virtual Machine/) { |
64
|
0
|
|
|
|
|
|
$vmsystem = 'Hyper-V'; |
65
|
0
|
|
|
|
|
|
$bios->{SMODEL} = 'Hyper-V'; |
66
|
0
|
|
|
|
|
|
$bios->{MMODEL} = 'Hyper-V'; |
67
|
|
|
|
|
|
|
} elsif ($bios->{BMANUFACTURER}) { |
68
|
0
|
0
|
|
|
|
|
$vmsystem = |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
69
|
|
|
|
|
|
|
$bios->{BMANUFACTURER} =~ /(QEMU|Bochs)/ ? 'QEMU' : |
70
|
|
|
|
|
|
|
$bios->{BMANUFACTURER} =~ /(VirtualBox|innotek)/ ? 'VirtualBox' : |
71
|
|
|
|
|
|
|
$bios->{BMANUFACTURER} =~ /^Xen/ ? 'Xen' : |
72
|
|
|
|
|
|
|
undef ; |
73
|
|
|
|
|
|
|
} elsif ($bios->{SMODEL}) { |
74
|
0
|
0
|
|
|
|
|
$vmsystem = |
|
|
0
|
|
|
|
|
|
75
|
|
|
|
|
|
|
$bios->{SMODEL} =~ /VMware/ ? 'VMWare' : |
76
|
|
|
|
|
|
|
$bios->{SMODEL} =~ /Virtual Machine/ ? 'Virtual Machine' : |
77
|
|
|
|
|
|
|
undef ; |
78
|
|
|
|
|
|
|
} elsif ($bios->{BVERSION}) { |
79
|
0
|
0
|
|
|
|
|
$vmsystem = |
80
|
|
|
|
|
|
|
$bios->{BVERSION} =~ /VirtualBox/ ? 'VirtualBox' : undef; |
81
|
|
|
|
|
|
|
} |
82
|
0
|
0
|
|
|
|
|
$hardware->{VMSYSTEM} = $vmsystem if $vmsystem; |
83
|
|
|
|
|
|
|
|
84
|
0
|
|
|
|
|
|
return $bios, $hardware; |
85
|
|
|
|
|
|
|
} |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
1; |