public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Fiona Ebner <f.ebner@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [PATCH qemu-server 1/2] machine: get vm machine: fix default for arch on non-x86 hosts
Date: Thu, 29 Jan 2026 12:05:56 +0100	[thread overview]
Message-ID: <20260129110607.65416-2-f.ebner@proxmox.com> (raw)
In-Reply-To: <20260129110607.65416-1-f.ebner@proxmox.com>

Some callers already used the correct get_vm_arch() helper to get the
arch, but many passed in $conf->{arch}. Since the whole config is
already passed in, remove the argument and call the helper internally.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
---
 src/PVE/API2/Qemu.pm          | 2 +-
 src/PVE/QemuServer.pm         | 8 ++++----
 src/PVE/QemuServer/Cfg2Cmd.pm | 3 +--
 src/PVE/QemuServer/Machine.pm | 4 ++--
 4 files changed, 8 insertions(+), 9 deletions(-)

diff --git a/src/PVE/API2/Qemu.pm b/src/PVE/API2/Qemu.pm
index 3ab0afcf..d6046a25 100644
--- a/src/PVE/API2/Qemu.pm
+++ b/src/PVE/API2/Qemu.pm
@@ -1012,7 +1012,7 @@ sub assert_scsi_feature_compatibility {
 
     my $drive = PVE::QemuServer::Drive::parse_drive($opt, $drive_attributes, 1);
 
-    my $machine_type = PVE::QemuServer::Machine::get_vm_machine($conf, undef, $conf->{arch});
+    my $machine_type = PVE::QemuServer::Machine::get_vm_machine($conf);
     my $machine_version = PVE::QemuServer::Machine::extract_version(
         $machine_type,
         PVE::QemuServer::Helpers::kvm_user_version(),
diff --git a/src/PVE/QemuServer.pm b/src/PVE/QemuServer.pm
index 7a0a2606..341b4321 100644
--- a/src/PVE/QemuServer.pm
+++ b/src/PVE/QemuServer.pm
@@ -3130,7 +3130,7 @@ sub config_to_command {
         die "Detected old QEMU binary ('$kvmver', at least 6.0 is required)\n";
     }
 
-    my $machine_type = PVE::QemuServer::Machine::get_vm_machine($conf, $forcemachine, $arch);
+    my $machine_type = PVE::QemuServer::Machine::get_vm_machine($conf, $forcemachine);
     my $machine_version = extract_version($machine_type, $kvmver);
     $kvm //= 1 if is_native_arch($arch);
 
@@ -4561,7 +4561,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, undef, $arch);
+    my $machine_type = PVE::QemuServer::Machine::get_vm_machine($conf);
 
     # commit values which do not have any impact on running VM first
     # Note: those option cannot raise errors, we we do not care about
@@ -7248,7 +7248,7 @@ sub pbs_live_restore {
         $live_restore_backing->{$confname} = { name => $pbs_name };
 
         # add blockdev information
-        my $machine_type = PVE::QemuServer::Machine::get_vm_machine($conf, undef, $conf->{arch});
+        my $machine_type = PVE::QemuServer::Machine::get_vm_machine($conf);
         my $machine_version = PVE::QemuServer::Machine::extract_version(
             $machine_type,
             PVE::QemuServer::Helpers::kvm_user_version(),
@@ -7357,7 +7357,7 @@ sub live_import_from_files {
 
         $live_restore_backing->{$dev} = { name => "drive-$dev-restore" };
 
-        my $machine_type = PVE::QemuServer::Machine::get_vm_machine($conf, undef, $conf->{arch});
+        my $machine_type = PVE::QemuServer::Machine::get_vm_machine($conf);
         my $machine_version = PVE::QemuServer::Machine::extract_version(
             $machine_type,
             PVE::QemuServer::Helpers::kvm_user_version(),
diff --git a/src/PVE/QemuServer/Cfg2Cmd.pm b/src/PVE/QemuServer/Cfg2Cmd.pm
index 36149aba..433d5050 100644
--- a/src/PVE/QemuServer/Cfg2Cmd.pm
+++ b/src/PVE/QemuServer/Cfg2Cmd.pm
@@ -19,9 +19,8 @@ sub new {
     $self->{ostype} = $self->get_prop('ostype');
     $self->{'windows-version'} = PVE::QemuServer::Helpers::windows_version($self->{ostype});
 
-    my $arch = PVE::QemuServer::Helpers::get_vm_arch($conf);
     $self->{'machine-type'} =
-        PVE::QemuServer::Machine::get_vm_machine($conf, $opts->{forcemachine}, $arch);
+        PVE::QemuServer::Machine::get_vm_machine($conf, $opts->{forcemachine});
 
     return $self;
 }
diff --git a/src/PVE/QemuServer/Machine.pm b/src/PVE/QemuServer/Machine.pm
index 7b928678..21c62a8f 100644
--- a/src/PVE/QemuServer/Machine.pm
+++ b/src/PVE/QemuServer/Machine.pm
@@ -397,7 +397,7 @@ sub windows_get_pinned_machine_version {
 }
 
 sub get_vm_machine {
-    my ($conf, $forcemachine, $arch) = @_;
+    my ($conf, $forcemachine) = @_;
 
     my $machine_conf = parse_machine($conf->{machine});
     my $machine = $forcemachine || $machine_conf->{type};
@@ -423,7 +423,7 @@ sub get_vm_machine {
             }
             $machine = windows_get_pinned_machine_version($machine, $base_version, $kvmversion);
         } else {
-            $arch //= 'x86_64';
+            my $arch = PVE::QemuServer::Helpers::get_vm_arch($conf);
             $machine ||= default_machine_for_arch($arch);
             my $pvever = get_pve_version($kvmversion);
             $machine .= "+pve$pvever";
-- 
2.47.3





  reply	other threads:[~2026-01-29 11:06 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-29 11:05 [PATCH-SERIES qemu-server 0/2] machine: use correct default for aarch64 Fiona Ebner
2026-01-29 11:05 ` Fiona Ebner [this message]
2026-01-29 11:05 ` [PATCH qemu-server 2/2] machine: fix Windows machine version pinning on aarch64 Fiona Ebner
2026-01-29 12:41 ` applied: [PATCH-SERIES qemu-server 0/2] machine: use correct default for aarch64 Thomas Lamprecht
2026-01-29 13:28   ` Fiona Ebner

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=20260129110607.65416-2-f.ebner@proxmox.com \
    --to=f.ebner@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
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal