From: Dominik Csapak <d.csapak@proxmox.com>
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 [thread overview]
Message-ID: <20261023130324.451252-4-d.csapak@proxmox.com> (raw)
In-Reply-To: <20261023130324.451252-1-d.csapak@proxmox.com>
So we can reuse the pc -> pc-i440fx (etc.) logic.
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
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
next prev parent reply other threads:[~2026-10-23 13:03 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-23 13:01 [PATCH qemu-server v4 0/9] add hotplug tests and fix uncovered bugs Dominik Csapak
2026-10-23 13:01 ` [PATCH qemu-server v4 1/9] tests: factor out useful commandline mocks for reuse Dominik Csapak
2026-10-23 13:01 ` [PATCH qemu-server v4 2/9] tests: factor out the diff generation Dominik Csapak
2026-10-23 13:01 ` Dominik Csapak [this message]
2026-10-23 13:01 ` [PATCH qemu-server v4 4/9] tests: hotplug: add initial hotplug test harness Dominik Csapak
2026-10-23 13:01 ` [PATCH qemu-server v4 5/9] tests: hotplug: add some test cases Dominik Csapak
2026-10-23 13:01 ` [PATCH qemu-server v4 6/9] tests: hotplug: add test case for adding scsi14 on qemu 11.1 Dominik Csapak
2026-10-23 13:01 ` [PATCH qemu-server v4 7/9] tests: hotplug: add cases for known defects Dominik Csapak
2026-10-23 13:01 ` [PATCH qemu-server v4 8/9] hotplug: fix hot unplugging tablet on aarch64 Dominik Csapak
2026-10-23 13:01 ` [PATCH qemu-server v4 9/9] hotplug: remove iothread if adding drive device failed Dominik Csapak
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261023130324.451252-4-d.csapak@proxmox.com \
--to=d.csapak@proxmox.com \
--cc=pve-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox