From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate001.proxmox.com (gate001.proxmox.com [45.144.208.40]) by lore.proxmox.com (Postfix) with ESMTPS id C6CD71FF0AF for ; Fri, 23 Oct 2026 15:03:29 +0200 (CEST) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id 2DF6E2163F; Fri, 23 Oct 2026 15:03:29 +0200 (CEST) From: Dominik Csapak To: pve-devel@lists.proxmox.com Subject: [PATCH qemu-server v4 3/9] machine: factor out machine expanding Date: Fri, 23 Oct 2026 15:01:06 +0200 Message-ID: <20261023130324.451252-4-d.csapak@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20261023130324.451252-1-d.csapak@proxmox.com> References: <20261023130324.451252-1-d.csapak@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL 0.302 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) PROLO_LEO1 0.1 Meta Catches all Leo drug variations so far 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: CA2JJF3PHRGDBWLINQCZBOZZFN4R26PJ X-Message-ID-Hash: CA2JJF3PHRGDBWLINQCZBOZZFN4R26PJ 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: So we can reuse the pc -> pc-i440fx (etc.) logic. Signed-off-by: Dominik Csapak --- src/PVE/QemuServer/Machine.pm | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/src/PVE/QemuServer/Machine.pm b/src/PVE/QemuServer/Machine.pm index 35161d1f..cf466db9 100644 --- a/src/PVE/QemuServer/Machine.pm +++ b/src/PVE/QemuServer/Machine.pm @@ -383,15 +383,11 @@ sub latest_installed_machine_version { return $version; } -sub windows_get_pinned_machine_version { - my ($machine, $base_version, $kvmversion) = @_; - - die "internal error - no machine provided" if !$machine; +# expands a machine version like 'pc' or 'q35' to the full string with the +# given pinned version, such as `pc-i440fx-10.0` +sub expand_machine_version { + my ($machine, $pin_version) = @_; - 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 eq 'pc') { $machine = "pc-i440fx-$pin_version"; } elsif ($machine eq 'q35') { @@ -405,6 +401,21 @@ sub windows_get_pinned_machine_version { return $machine; } +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); + } + + $machine = expand_machine_version($machine, $pin_version); + + return $machine; +} + sub get_vm_machine { my ($conf, $forcemachine) = @_; -- 2.47.3