From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate001.proxmox.com (gate001.proxmox.com [IPv6:2a0f:8001:1:32::40]) by lore.proxmox.com (Postfix) with ESMTPS id B9A801FF0AA for ; Tue, 06 Oct 2026 10:59:58 +0200 (CEST) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id 4DA4721667; Tue, 06 Oct 2026 10:59:43 +0200 (CEST) From: Fiona Ebner To: pve-devel@lists.proxmox.com Subject: [PATCH qemu-server v2 2/2] hotplug pending: only query machine type when actually required Date: Tue, 6 Oct 2026 10:58:33 +0200 Message-ID: <20261006085936.30542-3-f.ebner@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20261006085936.30542-1-f.ebner@proxmox.com> References: <20261006085936.30542-1-f.ebner@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1791277179565 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.463 Adjusted score from AWL reputation of From: address DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment (newer systems) RCVD_IN_DNSWL_MED -2.3 Sender listed at https://www.dnswl.org/, medium trust SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Message-ID-Hash: QSQLF6GMSWJZCWXLOBG2YJ4NO4NPBLXT X-Message-ID-Hash: QSQLF6GMSWJZCWXLOBG2YJ4NO4NPBLXT X-MailFrom: f.ebner@proxmox.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox VE development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Similar to commit ebe5f14c ("hotplug pending: only check for USB hoptplug support when actually needed"), only issue the 'query-version' QMP command when actually needed. Signed-off-by: Fiona Ebner --- New in v2. src/PVE/QemuServer.pm | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/src/PVE/QemuServer.pm b/src/PVE/QemuServer.pm index 758f9d99..74772fdd 100644 --- a/src/PVE/QemuServer.pm +++ b/src/PVE/QemuServer.pm @@ -4569,7 +4569,13 @@ sub vmconfig_hotplug_pending { my $defaults = load_defaults(); my $arch = PVE::QemuServer::Helpers::get_vm_arch($conf); - my $machine_type = PVE::QemuServer::Machine::get_current_qemu_machine($vmid); + + my $_machine_type; + my $machine_type = sub { + return $_machine_type if defined($_machine_type); + $_machine_type = PVE::QemuServer::Machine::get_current_qemu_machine($vmid); + return $_machine_type; + }; # commit values which do not have any impact on running VM first # Note: those option cannot raise errors, we we do not care about @@ -4668,7 +4674,7 @@ sub vmconfig_hotplug_pending { my $is_usb_hotplug_supported = sub { return $usb_hotplug if defined($usb_hotplug); my $ostype = $conf->{ostype}; - my $version = PVE::QemuServer::Machine::extract_version($machine_type); + my $version = PVE::QemuServer::Machine::extract_version($machine_type->()); $usb_hotplug = $hotplug_features->{usb} && min_version($version, 7, 1) @@ -4689,8 +4695,8 @@ sub vmconfig_hotplug_pending { } elsif ($opt eq 'tablet') { die "skip\n" if !$hotplug_features->{usb}; if ($defaults->{tablet}) { - vm_deviceplug($storecfg, $conf, $vmid, 'tablet', $arch, $machine_type); - vm_deviceplug($storecfg, $conf, $vmid, 'keyboard', $arch, $machine_type) + vm_deviceplug($storecfg, $conf, $vmid, 'tablet', $arch, $machine_type->()); + vm_deviceplug($storecfg, $conf, $vmid, 'keyboard', $arch, $machine_type->()) if $arch eq 'aarch64'; } else { vm_deviceunplug($vmid, $conf, 'tablet'); @@ -4760,8 +4766,8 @@ sub vmconfig_hotplug_pending { } elsif ($opt eq 'tablet') { die "skip\n" if !$hotplug_features->{usb}; if ($value == 1) { - vm_deviceplug($storecfg, $conf, $vmid, 'tablet', $arch, $machine_type); - vm_deviceplug($storecfg, $conf, $vmid, 'keyboard', $arch, $machine_type) + vm_deviceplug($storecfg, $conf, $vmid, 'tablet', $arch, $machine_type->()); + vm_deviceplug($storecfg, $conf, $vmid, 'keyboard', $arch, $machine_type->()) if $arch eq 'aarch64'; } elsif ($value == 0) { vm_deviceunplug($vmid, $conf, 'tablet'); @@ -4775,7 +4781,7 @@ sub vmconfig_hotplug_pending { if ($d->{host} =~ m/^spice$/i) { $id = "usbredirdev$index"; } - qemu_usb_hotplug($storecfg, $conf, $vmid, $id, $d, $arch, $machine_type); + qemu_usb_hotplug($storecfg, $conf, $vmid, $id, $d, $arch, $machine_type->()); } elsif ($opt eq 'vcpus') { die "skip\n" if !$hotplug_features->{cpu}; qemu_cpu_hotplug($vmid, $conf, $value); @@ -4802,7 +4808,7 @@ sub vmconfig_hotplug_pending { $opt, $value, $arch, - $machine_type, + $machine_type->(), ); } elsif (is_valid_drivename($opt)) { die "skip\n" if $opt eq 'efidisk0' || $opt eq 'tpmstate0'; @@ -4821,7 +4827,7 @@ sub vmconfig_hotplug_pending { $opt, $value, $arch, - $machine_type, + $machine_type->(), ); } elsif ($opt =~ m/^memory$/) { #dimms die "skip\n" if !$hotplug_features->{memory}; @@ -4862,7 +4868,7 @@ sub vmconfig_hotplug_pending { $opt, $value, $arch, - $machine_type, + $machine_type->(), ); }; if (my $err = $@) { -- 2.47.3