Skip to content

Commit

Permalink
Bugfix: Memory size value for Vmware Virtual Machine
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
ChristopheLacaze authored Dec 27, 2023
1 parent 8fadb63 commit 570df82
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions lib/GLPI/Agent/Task/Inventory/Generic/Dmidecode/Memory.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -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');
Expand Down

0 comments on commit 570df82

Please sign in to comment.