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 C513B1FF0AA for ; Tue, 06 Oct 2026 14:16:05 +0200 (CEST) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id 54643213BC; Tue, 06 Oct 2026 14:16:01 +0200 (CEST) Message-ID: Date: Tue, 6 Oct 2026 14:15:54 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Beta Subject: Re: [PATCH qemu-server v2 2/2] hotplug pending: only query machine type when actually required To: Fiona Ebner , pve-devel@lists.proxmox.com References: <20261006085936.30542-1-f.ebner@proxmox.com> <20261006085936.30542-3-f.ebner@proxmox.com> Content-Language: en-US From: Dominik Csapak In-Reply-To: <20261006085936.30542-3-f.ebner@proxmox.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1791288955053 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.388 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: V4MK76G2BD24J4WAJPAC2ESZIQP2SXJ4 X-Message-ID-Hash: V4MK76G2BD24J4WAJPAC2ESZIQP2SXJ4 X-MailFrom: d.csapak@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: On 10/6/26 10:59 AM, Fiona Ebner wrote: > 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. nit: AFAICS it actually uses the 'query-machines' qmp call > > 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 = $@) {