From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) by lore.proxmox.com (Postfix) with ESMTPS id AD3E61FF13F for ; Thu, 29 Jan 2026 12:06:30 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 8ECF726D1E; Thu, 29 Jan 2026 12:06:56 +0100 (CET) From: Fiona Ebner To: pve-devel@lists.proxmox.com Subject: [PATCH qemu-server 2/2] machine: fix Windows machine version pinning on aarch64 Date: Thu, 29 Jan 2026 12:05:57 +0100 Message-ID: <20260129110607.65416-3-f.ebner@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260129110607.65416-1-f.ebner@proxmox.com> References: <20260129110607.65416-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: 1769684703191 X-SPAM-LEVEL: Spam detection results: 0 AWL -0.017 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment RCVD_IN_VALIDITY_CERTIFIED_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. RCVD_IN_VALIDITY_RPBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. RCVD_IN_VALIDITY_SAFE_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. 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: APIFNR3NSFIHIMJX6D6USZO72SAFLJNI X-Message-ID-Hash: APIFNR3NSFIHIMJX6D6USZO72SAFLJNI 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: Have windows_get_pinned_machine_version() require passing an explicitly set $machine and adapt the callers. Note that the callers of check_and_pin_machine_string() use the get_vm_arch() helper too, so the $arch variable is not undef there. Signed-off-by: Fiona Ebner --- src/PVE/API2/Qemu.pm | 4 ++-- src/PVE/QemuServer/Machine.pm | 12 ++++++++---- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/PVE/API2/Qemu.pm b/src/PVE/API2/Qemu.pm index d6046a25..c2e185a6 100644 --- a/src/PVE/API2/Qemu.pm +++ b/src/PVE/API2/Qemu.pm @@ -1483,7 +1483,7 @@ __PACKAGE__->register_method({ # always pin Windows' machine version on create, they get confused too easily my $machine_string = PVE::QemuServer::Machine::check_and_pin_machine_string( - $conf->{machine}, $conf->{ostype}, + $conf->{machine}, $conf->{ostype}, $arch, ); $conf->{machine} = $machine_string if $machine_string; @@ -2464,7 +2464,7 @@ my $update_vm_api = sub { eval { my $machine_string = PVE::QemuServer::Machine::check_and_pin_machine_string( - $conf->{machine}, $param->{ostype}, + $conf->{machine}, $param->{ostype}, $arch, ); $conf->{pending}->{machine} = $machine_string if $machine_string; }; diff --git a/src/PVE/QemuServer/Machine.pm b/src/PVE/QemuServer/Machine.pm index 21c62a8f..0d4b77af 100644 --- a/src/PVE/QemuServer/Machine.pm +++ b/src/PVE/QemuServer/Machine.pm @@ -379,11 +379,13 @@ sub latest_installed_machine_version { sub windows_get_pinned_machine_version { my ($machine, $base_version, $kvmversion) = @_; + die "internal error - no machine provided" if !$machine; + my $pin_version = $base_version; if (!defined($base_version) || !can_run_pve_machine_version($base_version, $kvmversion)) { $pin_version = latest_installed_machine_version($kvmversion); } - if (!$machine || $machine eq 'pc') { + if ($machine eq 'pc') { $machine = "pc-i440fx-$pin_version"; } elsif ($machine eq 'q35') { $machine = "pc-q35-$pin_version"; @@ -404,6 +406,9 @@ sub get_vm_machine { if (!$machine || $machine =~ m/^(?:pc|q35|virt)$/) { my $kvmversion = PVE::QemuServer::Helpers::kvm_user_version(); + my $arch = PVE::QemuServer::Helpers::get_vm_arch($conf); + $machine ||= default_machine_for_arch($arch); + # 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.. @@ -423,8 +428,6 @@ sub get_vm_machine { } $machine = windows_get_pinned_machine_version($machine, $base_version, $kvmversion); } else { - my $arch = PVE::QemuServer::Helpers::get_vm_arch($conf); - $machine ||= default_machine_for_arch($arch); my $pvever = get_pve_version($kvmversion); $machine .= "+pve$pvever"; } @@ -445,13 +448,14 @@ sub get_vm_machine { } sub check_and_pin_machine_string { - my ($machine_string, $ostype) = @_; + my ($machine_string, $ostype, $arch) = @_; my $machine_conf = parse_machine($machine_string); my $machine = $machine_conf->{type}; if (!$machine || $machine =~ m/^(?:pc|q35|virt)$/) { # always pin Windows' machine version on create, they get confused too easily if (PVE::QemuServer::Helpers::windows_version($ostype)) { + $machine = default_machine_for_arch($arch) if !$machine; $machine_conf->{type} = windows_get_pinned_machine_version($machine); print "pinning machine type to '$machine_conf->{type}' for Windows guest OS\n"; } -- 2.47.3