[pve-devel] [PATCH qemu-server] Fix: cpu hotplug feature can't be changed online

Alexandre Derumier aderumier at odiso.com
Tue Oct 10 17:37:17 CEST 2023


The cpus are passed as devices with specific id only when cpu hotplug is enable
at start.
We can't enable/disable it online or vcpu hotplug api will thrown errors
not finding core id.

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

diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
index 2895675..22d1c71 100644
--- a/PVE/QemuServer.pm
+++ b/PVE/QemuServer.pm
@@ -4961,7 +4961,7 @@ sub vmconfig_hotplug_pending {
 	my $force = $pending_delete_hash->{$opt}->{force};
 	eval {
 	    if ($opt eq 'hotplug') {
-		die "skip\n" if ($conf->{hotplug} =~ /memory/);
+		die "skip\n" if ($conf->{hotplug} =~ /(cpu|memory)/);
 	    } elsif ($opt eq 'tablet') {
 		die "skip\n" if !$hotplug_features->{usb};
 		if ($defaults->{tablet}) {
@@ -5022,6 +5022,7 @@ sub vmconfig_hotplug_pending {
 	eval {
 	    if ($opt eq 'hotplug') {
 		die "skip\n" if ($value =~ /memory/) || ($value !~ /memory/ && $conf->{hotplug} =~ /memory/);
+		die "skip\n" if ($value =~ /cpu/) || ($value !~ /cpu/ && $conf->{hotplug} =~ /cpu/);
 	    } elsif ($opt eq 'tablet') {
 		die "skip\n" if !$hotplug_features->{usb};
 		if ($value == 1) {
-- 
2.39.2





More information about the pve-devel mailing list