[pve-devel] [PATCH qemu-server v2 12/18] machine: get vm machine: fallback to creation QEMU version for windows starting with 9.1
Fiona Ebner
f.ebner at proxmox.com
Thu Jan 16 12:50:48 CET 2025
Starting from QEMU 9.1, pin to the creation version instead. Support
for machine version 5.1 is expected to drop with QEMU 11.1 and it
would still be good to handle Windows VMs that do not have explicit
machine version for whatever reason. For example, explicitly setting
the machine without a version on the CLI/API after creation is one way
to end up with such a machine.
Signed-off-by: Fiona Ebner <f.ebner at proxmox.com>
---
PVE/QemuServer/Machine.pm | 19 ++++++++++++++++---
1 file changed, 16 insertions(+), 3 deletions(-)
diff --git a/PVE/QemuServer/Machine.pm b/PVE/QemuServer/Machine.pm
index 915913c0..679d69c7 100644
--- a/PVE/QemuServer/Machine.pm
+++ b/PVE/QemuServer/Machine.pm
@@ -4,6 +4,7 @@ use strict;
use warnings;
use PVE::QemuServer::Helpers;
+use PVE::QemuServer::MetaInfo;
use PVE::QemuServer::Monitor;
use PVE::JSONSchema qw(get_standard_option parse_property_string print_property_string);
@@ -221,11 +222,23 @@ sub get_vm_machine {
if (!$machine || $machine =~ m/^(?:pc|q35|virt)$/) {
my $kvmversion //= PVE::QemuServer::Helpers::kvm_user_version();
- # we must pin Windows VMs without a specific version to 5.1, as 5.2 fixed a bug in ACPI
- # layout which confuses windows quite a bit and may result in various regressions..
+ # we must pin Windows VMs without a specific version and no meta info about creation QEMU to
+ # 5.1, as 5.2 fixed a bug in ACPI layout which confuses windows quite a bit and may result
+ # in various regressions..
# see: https://lists.gnu.org/archive/html/qemu-devel/2021-02/msg08484.html
+ # Starting from QEMU 9.1, pin to the creation version instead. Support for 5.1 is expected
+ # to drop with QEMU 11.1 and it would still be good to handle Windows VMs that do not have
+ # an explicit machine version for whatever reason.
if (PVE::QemuServer::Helpers::windows_version($conf->{ostype})) {
- $machine = windows_get_pinned_machine_version($machine, '5.1', $kvmversion);
+ my $base_version = '5.1';
+ # TODO PVE 10 - die early if there is a Windows VM both without explicit machine version
+ # and without meta info.
+ if (my $meta = PVE::QemuServer::MetaInfo::parse_meta_info($conf->{meta})) {
+ $base_version = $meta->{'creation-qemu'}
+ if PVE::QemuServer::Helpers::min_version($meta->{'creation-qemu'}, 9, 1);
+ ($base_version) = ($base_version =~ m/^(\d+.\d+)/); # need only major.minor
+ }
+ $machine = windows_get_pinned_machine_version($machine, $base_version, $kvmversion);
}
$arch //= 'x86_64';
$machine ||= default_machine_for_arch($arch);
--
2.39.5
More information about the pve-devel
mailing list