all lists on lists.proxmox.com
 help / color / mirror / Atom feed
* [PATCH-SERIES qemu-server 0/2] machine: use correct default for aarch64
@ 2026-01-29 11:05 Fiona Ebner
  2026-01-29 11:05 ` [PATCH qemu-server 1/2] machine: get vm machine: fix default for arch on non-x86 hosts Fiona Ebner
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Fiona Ebner @ 2026-01-29 11:05 UTC (permalink / raw)
  To: pve-devel

Some code paths unconditionally defaulted to x86_64 or i440fx.

qemu-server:

Fiona Ebner (2):
  machine: get vm machine: fix default for arch on non-x86 hosts
  machine: fix Windows machine version pinning on aarch64

 src/PVE/API2/Qemu.pm          |  6 +++---
 src/PVE/QemuServer.pm         |  8 ++++----
 src/PVE/QemuServer/Cfg2Cmd.pm |  3 +--
 src/PVE/QemuServer/Machine.pm | 14 +++++++++-----
 4 files changed, 17 insertions(+), 14 deletions(-)


Summary over all repositories:
  4 files changed, 17 insertions(+), 14 deletions(-)

-- 
Generated by git-murpp 0.5.0




^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH qemu-server 1/2] machine: get vm machine: fix default for arch on non-x86 hosts
  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
  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
  2 siblings, 0 replies; 5+ messages in thread
From: Fiona Ebner @ 2026-01-29 11:05 UTC (permalink / raw)
  To: pve-devel

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





^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH qemu-server 2/2] machine: fix Windows machine version pinning on aarch64
  2026-01-29 11:05 [PATCH-SERIES qemu-server 0/2] machine: use correct default for aarch64 Fiona Ebner
  2026-01-29 11:05 ` [PATCH qemu-server 1/2] machine: get vm machine: fix default for arch on non-x86 hosts Fiona Ebner
@ 2026-01-29 11:05 ` Fiona Ebner
  2026-01-29 12:41 ` applied: [PATCH-SERIES qemu-server 0/2] machine: use correct default for aarch64 Thomas Lamprecht
  2 siblings, 0 replies; 5+ messages in thread
From: Fiona Ebner @ 2026-01-29 11:05 UTC (permalink / raw)
  To: pve-devel

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 <f.ebner@proxmox.com>
---
 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





^ permalink raw reply	[flat|nested] 5+ messages in thread

* applied: [PATCH-SERIES qemu-server 0/2] machine: use correct default for aarch64
  2026-01-29 11:05 [PATCH-SERIES qemu-server 0/2] machine: use correct default for aarch64 Fiona Ebner
  2026-01-29 11:05 ` [PATCH qemu-server 1/2] machine: get vm machine: fix default for arch on non-x86 hosts Fiona Ebner
  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 ` Thomas Lamprecht
  2026-01-29 13:28   ` Fiona Ebner
  2 siblings, 1 reply; 5+ messages in thread
From: Thomas Lamprecht @ 2026-01-29 12:41 UTC (permalink / raw)
  To: pve-devel, Fiona Ebner

On Thu, 29 Jan 2026 12:05:55 +0100, Fiona Ebner wrote:
> Some code paths unconditionally defaulted to x86_64 or i440fx.
> 
> qemu-server:
> 
> Fiona Ebner (2):
>   machine: get vm machine: fix default for arch on non-x86 hosts
>   machine: fix Windows machine version pinning on aarch64
> 
> [...]

Applied, thanks!

btw. pve8to9 uses get_vm_machine, this change doesn't break anything, but would
be still good to get updated there to drop passing the now useless $arch param.

[1/2] machine: get vm machine: fix default for arch on non-x86 hosts
      commit: f1bf4c1fa7a6821fef02019b50242a45cdbf171f
[2/2] machine: fix Windows machine version pinning on aarch64
      commit: a65751eb4f3bd0807cead1788ed3594a9505865c




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: applied: [PATCH-SERIES qemu-server 0/2] machine: use correct default for aarch64
  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
  0 siblings, 0 replies; 5+ messages in thread
From: Fiona Ebner @ 2026-01-29 13:28 UTC (permalink / raw)
  To: Thomas Lamprecht, pve-devel

Am 29.01.26 um 1:41 PM schrieb Thomas Lamprecht:
> On Thu, 29 Jan 2026 12:05:55 +0100, Fiona Ebner wrote:
>> Some code paths unconditionally defaulted to x86_64 or i440fx.
>>
>> qemu-server:
>>
>> Fiona Ebner (2):
>>   machine: get vm machine: fix default for arch on non-x86 hosts
>>   machine: fix Windows machine version pinning on aarch64
>>
>> [...]
> 
> Applied, thanks!
> 
> btw. pve8to9 uses get_vm_machine, this change doesn't break anything, but would
> be still good to get updated there to drop passing the now useless $arch param.

Nice catch! I need to be more careful to check for users outside the
package. Patch submitted here:
https://lore.proxmox.com/pve-devel/20260129132623.127384-1-f.ebner@proxmox.com/T/




^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-01-29 13:28 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-01-29 11:05 [PATCH-SERIES qemu-server 0/2] machine: use correct default for aarch64 Fiona Ebner
2026-01-29 11:05 ` [PATCH qemu-server 1/2] machine: get vm machine: fix default for arch on non-x86 hosts Fiona Ebner
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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal