[pve-devel] [PATCH qemu-server 2/2] fix #1384: fix cpu socket id calculation for hotplug

Fabian Grünbichler f.gruenbichler at proxmox.com
Wed May 17 09:47:28 CEST 2017


the case of multiple single-core vcpus was not handled
properly

Signed-off-by: Fabian Grünbichler <f.gruenbichler at proxmox.com>
---
 PVE/QemuServer.pm | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
index ed6c598..d480d55 100644
--- a/PVE/QemuServer.pm
+++ b/PVE/QemuServer.pm
@@ -1723,9 +1723,14 @@ sub print_cpu_device {
     my $sockets = $conf->{sockets} // 1;
     my $cores = $conf->{cores} // 1;
 
-    my $current_core = ($id - 1) % $cores;
-    my $current_socket = int(($id - $current_core)/$cores);
+    # single core default
+    my $current_core = 0;
+    my $current_socket = $id - 1;
 
+    if ($cores > 1) {
+	$current_core = ($id - 1) % $cores;
+	$current_socket = int(($id - $current_core)/$cores);
+    }
     return "$cpu-x86_64-cpu,id=cpu$id,socket-id=$current_socket,core-id=$current_core,thread-id=0";
 }
 
-- 
2.1.4





More information about the pve-devel mailing list