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 3/3] api: machines: allow querying machines for a given architecture
Date: Thu, 29 Jan 2026 15:09:55 +0100	[thread overview]
Message-ID: <20260129141132.163858-4-f.ebner@proxmox.com> (raw)
In-Reply-To: <20260129141132.163858-1-f.ebner@proxmox.com>

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
---
 src/PVE/API2/Qemu/Machine.pm | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/src/PVE/API2/Qemu/Machine.pm b/src/PVE/API2/Qemu/Machine.pm
index 0fc1ea6c..26195eae 100644
--- a/src/PVE/API2/Qemu/Machine.pm
+++ b/src/PVE/API2/Qemu/Machine.pm
@@ -6,9 +6,10 @@ use warnings;
 use JSON;
 
 use PVE::JSONSchema qw(get_standard_option);
-use PVE::QemuServer::Machine;
 use PVE::RESTHandler;
-use PVE::Tools qw(file_get_contents);
+use PVE::Tools qw(extract_param file_get_contents get_host_arch);
+
+use PVE::QemuServer::Machine;
 
 use base qw(PVE::RESTHandler);
 
@@ -25,6 +26,7 @@ __PACKAGE__->register_method({
         additionalProperties => 0,
         properties => {
             node => get_standard_option('pve-node'),
+            arch => get_standard_option('pve-qm-cpu-arch', { optional => 1 }),
         },
     },
     returns => {
@@ -56,8 +58,12 @@ __PACKAGE__->register_method({
         },
     },
     code => sub {
+        my ($param) = @_;
+
+        my $arch = extract_param($param, 'arch') // get_host_arch();
+
         my $supported_machine_list = eval {
-            my $raw = file_get_contents('/usr/share/kvm/machine-versions-x86_64.json');
+            my $raw = file_get_contents("/usr/share/kvm/machine-versions-$arch.json");
             my $machines = from_json($raw, { utf8 => 1 });
 
             my $pve_machines = [];
-- 
2.47.3





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

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-29 14:09 [PATCH-SERIES qemu/qemu-server 0/3] " Fiona Ebner
2026-01-29 14:09 ` [PATCH qemu 1/3] buildsys: generate list of supported aarch64 machines during package build Fiona Ebner
2026-01-29 14:09 ` [PATCH qemu-server 2/3] cpu config: introduce pve-qm-cpu-arch standard option for virtual CPU architecture Fiona Ebner
2026-01-29 14:09 ` Fiona Ebner [this message]

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=20260129141132.163858-4-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