[pve-devel] [PATCH v4 qemu-server 03/16] memory: refactor sockets

Alexandre Derumier aderumier at odiso.com
Mon Feb 13 13:00:08 CET 2023


Signed-off-by: Alexandre Derumier <aderumier at odiso.com>
---
 PVE/QemuServer/Memory.pm | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/PVE/QemuServer/Memory.pm b/PVE/QemuServer/Memory.pm
index e10c0b7..3899917 100644
--- a/PVE/QemuServer/Memory.pm
+++ b/PVE/QemuServer/Memory.pm
@@ -165,8 +165,7 @@ sub qemu_memory_hotplug {
 
     return $value if !PVE::QemuServer::check_running($vmid);
 
-    my $sockets = 1;
-    $sockets = $conf->{sockets} if $conf->{sockets};
+    my $sockets = $conf->{sockets} || 1;
 
     my $memory = $conf->{memory} || $defaults->{memory};
     $value = $defaults->{memory} if !$value;
@@ -289,8 +288,7 @@ sub config {
 		if $conf->{"numa$i"};
 	}
 
-	my $sockets = 1;
-	$sockets = $conf->{sockets} if $conf->{sockets};
+	my $sockets = $conf->{sockets} || 1;
 
 	$static_memory = $STATICMEM;
 	$static_memory = $static_memory * $sockets if ($conf->{hugepages} && $conf->{hugepages} == 1024);
@@ -499,9 +497,7 @@ sub hugepages_topology {
     my $defaults = PVE::QemuServer::load_defaults();
     my $memory = $conf->{memory} || $defaults->{memory};
     my $static_memory = 0;
-    my $sockets = 1;
-    $sockets = $conf->{smp} if $conf->{smp}; # old style - no longer iused
-    $sockets = $conf->{sockets} if $conf->{sockets};
+    my $sockets = $conf->{sockets} || 1;
     my $numa_custom_topology = undef;
     my $hotplug_features = PVE::QemuServer::parse_hotplug_features(defined($conf->{hotplug}) ? $conf->{hotplug} : '1');
 
-- 
2.30.2





More information about the pve-devel mailing list