From 570df82b1da042333597db727a0823d619fc33fe Mon Sep 17 00:00:00 2001 From: Tof <32029396+ChristopheLacaze@users.noreply.github.com> Date: Wed, 27 Dec 2023 14:50:28 +0100 Subject: [PATCH] Bugfix: Memory size value for Vmware Virtual Machine Dmidecode slot memory size value overrided by /proc/meminfo value when there is only one memory slot for a Vmware virtual machine. It should not. --- lib/GLPI/Agent/Task/Inventory/Generic/Dmidecode/Memory.pm | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/GLPI/Agent/Task/Inventory/Generic/Dmidecode/Memory.pm b/lib/GLPI/Agent/Task/Inventory/Generic/Dmidecode/Memory.pm index c4dc832e8..77337eadd 100644 --- a/lib/GLPI/Agent/Task/Inventory/Generic/Dmidecode/Memory.pm +++ b/lib/GLPI/Agent/Task/Inventory/Generic/Dmidecode/Memory.pm @@ -26,8 +26,9 @@ sub isEnabled { sub doInventory { my (%params) = @_; - my $inventory = $params{inventory}; - my $logger = $params{logger}; + my $inventory = $params{inventory}; + my $logger = $params{logger}; + my @physmemsystems = ('Physical', 'VMware'); my $memories = _getMemories(logger => $logger); @@ -36,7 +37,7 @@ sub doInventory { # If only one component is defined and we are under a vmsystem, we can update # component capacity to real found size. This permits to support memory size updates. my $vmsystem = $inventory->getHardware('VMSYSTEM'); - if ($vmsystem && $vmsystem ne 'Physical') { + if ($vmsystem && ! grep ( /^$vmsystem$/, @physmemsystems)) { my @components = grep { exists $_->{CAPACITY} } @$memories; if ( @components == 1) { my $real_memory = $inventory->getHardware('MEMORY');