* [PATCH-SERIES qemu-server v2 0/2] hotplug pending: use machine type from running instance to avoid mismatch
@ 2026-10-06 8:58 Fiona Ebner
2026-10-06 8:58 ` [PATCH qemu-server v2 1/2] " Fiona Ebner
` (3 more replies)
0 siblings, 4 replies; 6+ messages in thread
From: Fiona Ebner @ 2026-10-06 8:58 UTC (permalink / raw)
To: pve-devel
Changes in v2:
* add second patch with optimization to only query machine type when
actually required.
The machine version from the configuration might be using the 'latest'
version, in which case the currently running machine version might be
different from the version of the installed QEMU binary. This is an
issue, because sub-calls of vmconfig_hotplug_pending() like
print_drivedevice_full() use the binary version as a fallback when
there is an unresolved 'latest' version. Hotplug needs to respect the
current running machine version for migration compatibility.
qemu-server:
Fiona Ebner (2):
hotplug pending: use machine type from running instance to avoid
mismatch
hotplug pending: only query machine type when actually required
src/PVE/QemuServer.pm | 26 ++++++++++++++++----------
1 file changed, 16 insertions(+), 10 deletions(-)
Summary over all repositories:
1 files changed, 16 insertions(+), 10 deletions(-)
--
Generated by git-murpp 0.5.0
^ permalink raw reply [flat|nested] 6+ messages in thread* [PATCH qemu-server v2 1/2] hotplug pending: use machine type from running instance to avoid mismatch 2026-10-06 8:58 [PATCH-SERIES qemu-server v2 0/2] hotplug pending: use machine type from running instance to avoid mismatch Fiona Ebner @ 2026-10-06 8:58 ` Fiona Ebner 2026-10-06 8:58 ` [PATCH qemu-server v2 2/2] hotplug pending: only query machine type when actually required Fiona Ebner ` (2 subsequent siblings) 3 siblings, 0 replies; 6+ messages in thread From: Fiona Ebner @ 2026-10-06 8:58 UTC (permalink / raw) To: pve-devel The machine version from the configuration might be using the 'latest' version, in which case the currently running machine version might be different from the version of the installed QEMU binary. This is an issue, because sub-calls of vmconfig_hotplug_pending() like print_drivedevice_full() use the binary version as a fallback when there is an unresolved 'latest' version. Hotplug needs to respect the current running machine version for migration compatibility. This also allows simplifying the call for the USB hotplug check, because the 'latest' version is now already resolved to the explicit version. Signed-off-by: Fiona Ebner <f.ebner@proxmox.com> --- No changes in v2. src/PVE/QemuServer.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/PVE/QemuServer.pm b/src/PVE/QemuServer.pm index f199371d..758f9d99 100644 --- a/src/PVE/QemuServer.pm +++ b/src/PVE/QemuServer.pm @@ -4569,7 +4569,7 @@ sub vmconfig_hotplug_pending { my $defaults = load_defaults(); my $arch = PVE::QemuServer::Helpers::get_vm_arch($conf); - my $machine_type = PVE::QemuServer::Machine::get_vm_machine($conf); + my $machine_type = PVE::QemuServer::Machine::get_current_qemu_machine($vmid); # 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 +4668,7 @@ sub vmconfig_hotplug_pending { my $is_usb_hotplug_supported = sub { return $usb_hotplug if defined($usb_hotplug); my $ostype = $conf->{ostype}; - my $version = extract_version($machine_type, get_running_qemu_version($vmid)); + my $version = PVE::QemuServer::Machine::extract_version($machine_type); $usb_hotplug = $hotplug_features->{usb} && min_version($version, 7, 1) -- 2.47.3 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH qemu-server v2 2/2] hotplug pending: only query machine type when actually required 2026-10-06 8:58 [PATCH-SERIES qemu-server v2 0/2] hotplug pending: use machine type from running instance to avoid mismatch Fiona Ebner 2026-10-06 8:58 ` [PATCH qemu-server v2 1/2] " Fiona Ebner @ 2026-10-06 8:58 ` Fiona Ebner 2026-10-06 12:15 ` Dominik Csapak 2026-10-06 12:17 ` [PATCH-SERIES qemu-server v2 0/2] hotplug pending: use machine type from running instance to avoid mismatch Dominik Csapak 2026-10-06 12:33 ` applied: " Fiona Ebner 3 siblings, 1 reply; 6+ messages in thread From: Fiona Ebner @ 2026-10-06 8:58 UTC (permalink / raw) To: pve-devel 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 <f.ebner@proxmox.com> --- 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 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH qemu-server v2 2/2] hotplug pending: only query machine type when actually required 2026-10-06 8:58 ` [PATCH qemu-server v2 2/2] hotplug pending: only query machine type when actually required Fiona Ebner @ 2026-10-06 12:15 ` Dominik Csapak 0 siblings, 0 replies; 6+ messages in thread From: Dominik Csapak @ 2026-10-06 12:15 UTC (permalink / raw) To: Fiona Ebner, pve-devel 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 <f.ebner@proxmox.com> > --- > > 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 = $@) { ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH-SERIES qemu-server v2 0/2] hotplug pending: use machine type from running instance to avoid mismatch 2026-10-06 8:58 [PATCH-SERIES qemu-server v2 0/2] hotplug pending: use machine type from running instance to avoid mismatch Fiona Ebner 2026-10-06 8:58 ` [PATCH qemu-server v2 1/2] " Fiona Ebner 2026-10-06 8:58 ` [PATCH qemu-server v2 2/2] hotplug pending: only query machine type when actually required Fiona Ebner @ 2026-10-06 12:17 ` Dominik Csapak 2026-10-06 12:33 ` applied: " Fiona Ebner 3 siblings, 0 replies; 6+ messages in thread From: Dominik Csapak @ 2026-10-06 12:17 UTC (permalink / raw) To: Fiona Ebner, pve-devel aside from one nit on patch 2/2 LGTM tested by hotplugging some random devices (nics/disks) on a machine with no pinned machine version. all seemed to work so consider this: Reviewed-by: Dominik Csapak <d.csapak@proxmox.com> Tested-by: Dominik Csapak <d.csapak@proxmox.com> On 10/6/26 10:59 AM, Fiona Ebner wrote: > Changes in v2: > * add second patch with optimization to only query machine type when > actually required. > > The machine version from the configuration might be using the 'latest' > version, in which case the currently running machine version might be > different from the version of the installed QEMU binary. This is an > issue, because sub-calls of vmconfig_hotplug_pending() like > print_drivedevice_full() use the binary version as a fallback when > there is an unresolved 'latest' version. Hotplug needs to respect the > current running machine version for migration compatibility. > > qemu-server: > > Fiona Ebner (2): > hotplug pending: use machine type from running instance to avoid > mismatch > hotplug pending: only query machine type when actually required > > src/PVE/QemuServer.pm | 26 ++++++++++++++++---------- > 1 file changed, 16 insertions(+), 10 deletions(-) > > > Summary over all repositories: > 1 files changed, 16 insertions(+), 10 deletions(-) > ^ permalink raw reply [flat|nested] 6+ messages in thread
* applied: [PATCH-SERIES qemu-server v2 0/2] hotplug pending: use machine type from running instance to avoid mismatch 2026-10-06 8:58 [PATCH-SERIES qemu-server v2 0/2] hotplug pending: use machine type from running instance to avoid mismatch Fiona Ebner ` (2 preceding siblings ...) 2026-10-06 12:17 ` [PATCH-SERIES qemu-server v2 0/2] hotplug pending: use machine type from running instance to avoid mismatch Dominik Csapak @ 2026-10-06 12:33 ` Fiona Ebner 3 siblings, 0 replies; 6+ messages in thread From: Fiona Ebner @ 2026-10-06 12:33 UTC (permalink / raw) To: pve-devel, Fiona Ebner On Tue, 06 Oct 2026 10:58:31 +0200, Fiona Ebner wrote: > Changes in v2: > * add second patch with optimization to only query machine type when > actually required. > > The machine version from the configuration might be using the 'latest' > version, in which case the currently running machine version might be > different from the version of the installed QEMU binary. This is an > issue, because sub-calls of vmconfig_hotplug_pending() like > print_drivedevice_full() use the binary version as a fallback when > there is an unresolved 'latest' version. Hotplug needs to respect the > current running machine version for migration compatibility. > > [...] Applied with Dominik's nit addressed, thanks to him for reviewing and testing! [1/2] hotplug pending: use machine type from running instance to avoid mismatch commit: db400bbb1e444ca06a6d1c4a7f6aba7501d45e43 [2/2] hotplug pending: only query machine type when actually required commit: 80e0590e144359fd136a2ba1e3f44716bfc535b0 ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2026-10-06 12:35 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2026-10-06 8:58 [PATCH-SERIES qemu-server v2 0/2] hotplug pending: use machine type from running instance to avoid mismatch Fiona Ebner 2026-10-06 8:58 ` [PATCH qemu-server v2 1/2] " Fiona Ebner 2026-10-06 8:58 ` [PATCH qemu-server v2 2/2] hotplug pending: only query machine type when actually required Fiona Ebner 2026-10-06 12:15 ` Dominik Csapak 2026-10-06 12:17 ` [PATCH-SERIES qemu-server v2 0/2] hotplug pending: use machine type from running instance to avoid mismatch Dominik Csapak 2026-10-06 12:33 ` applied: " Fiona Ebner
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox