Signed-off-by: Alexandre Derumier <aderum...@odiso.com>
---
 PVE/QemuServer/Memory.pm | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/PVE/QemuServer/Memory.pm b/PVE/QemuServer/Memory.pm
index 99b7a21..014d19d 100644
--- a/PVE/QemuServer/Memory.pm
+++ b/PVE/QemuServer/Memory.pm
@@ -151,17 +151,15 @@ sub get_numa_guest_to_host_map {
 }
 
 sub foreach_dimm{
-    my ($conf, $vmid, $memory, $sockets, $func) = @_;
+    my ($conf, $vmid, $memory, $static_memory, $func) = @_;
 
     my $dimm_id = 0;
-    my $current_size = 0;
+    my $current_size = $static_memory;
     my $dimm_size = 0;
 
     if($conf->{hugepages} && $conf->{hugepages} == 1024) {
-       $current_size = 1024 * $sockets;
        $dimm_size = 1024;
     } else {
-       $current_size = 1024;
        $dimm_size = 512;
     }
 
@@ -206,7 +204,7 @@ sub qemu_memory_hotplug {
 
        my $numa_hostmap;
 
-       foreach_dimm($conf, $vmid, $value, $sockets, sub {
+       foreach_dimm($conf, $vmid, $value, $static_memory, sub {
            my ($conf, $vmid, $name, $dimm_size, $numanode, $current_size, 
$memory) = @_;
 
                return if $current_size <= get_current_memory($conf->{memory});
@@ -393,7 +391,7 @@ sub config {
     }
 
     if ($hotplug) {
-       foreach_dimm($conf, $vmid, $memory, $sockets, sub {
+       foreach_dimm($conf, $vmid, $memory, $static_memory, sub {
            my ($conf, $vmid, $name, $dimm_size, $numanode, $current_size, 
$memory) = @_;
 
            my $mem_object = print_mem_object($conf, "mem-$name", $dimm_size);
@@ -559,7 +557,7 @@ sub hugepages_topology {
     if ($hotplug) {
        my $numa_hostmap = get_numa_guest_to_host_map($conf);
 
-       foreach_dimm($conf, undef, $memory, $sockets, sub {
+       foreach_dimm($conf, undef, $memory, $static_memory, sub {
            my ($conf, undef, $name, $dimm_size, $numanode, $current_size, 
$memory) = @_;
 
            $numanode = $numa_hostmap->{$numanode};
-- 
2.30.2


_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

Reply via email to