From 9e7ae7b988fe7d990a3e1d01a3490f6095e4f399 Mon Sep 17 00:00:00 2001 From: Guillaume Bougard Date: Fri, 28 Sep 2018 10:38:24 +0200 Subject: [PATCH] fix: cpu core computation fix wrong computation when only one package is available as totalCore was divided by the reference value, not just 1 --- Changes | 1 + lib/FusionInventory/Agent/SOAP/VMware/Host.pm | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/Changes b/Changes index 7d71e4c3e1..8265520193 100644 --- a/Changes +++ b/Changes @@ -36,6 +36,7 @@ deploy: esx: * Support 2 ServiceTags case to cover chassis & lame board S/N inventory * Updated AssetTag support +* fix wrong cpu core computation when only one package is available netdiscovery/netinventory: * Thanks to @QuickNerd357, Brocade devices will now show serial number and diff --git a/lib/FusionInventory/Agent/SOAP/VMware/Host.pm b/lib/FusionInventory/Agent/SOAP/VMware/Host.pm index e54fccee94..ecbd8993c0 100644 --- a/lib/FusionInventory/Agent/SOAP/VMware/Host.pm +++ b/lib/FusionInventory/Agent/SOAP/VMware/Host.pm @@ -112,12 +112,14 @@ sub getCPUs { my $totalCore = $hardware->{cpuInfo}{numCpuCores}; my $totalThread = $hardware->{cpuInfo}{numCpuThreads}; my $cpuEntries = $hardware->{cpuPkg}; + my $cpuPackages = $hardware->{cpuInfo}{numCpuPackages} || + scalar(_asArray($cpuEntries)); my @cpus; foreach (_asArray($cpuEntries)) { push @cpus, { - CORE => $totalCore / _asArray($cpuEntries), + CORE => eval { $totalCore / $cpuPackages }, MANUFACTURER => $cpuManufacturor{ $_->{vendor} } || $_->{vendor}, NAME => $_->{description}, SPEED => int( $_->{hz} / ( 1000 * 1000 ) ),