From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate001.proxmox.com (gate001.proxmox.com [IPv6:2a0f:8001:1:32::40]) by lore.proxmox.com (Postfix) with ESMTPS id A56871FF145 for ; Mon, 30 Nov 2026 11:47:32 +0100 (CET) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id D9A4B21666; Mon, 30 Nov 2026 11:47:30 +0100 (CET) From: Arthur Bied-Charreton To: pdm-devel@lists.proxmox.com Subject: [PATCH datacenter-manager 2/3] api: pve: add VM-specific CPU flags endpoint Date: Mon, 30 Nov 2026 11:47:15 +0100 Message-ID: <20261130104716.329802-3-a.bied-charreton@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20261130104716.329802-1-a.bied-charreton@proxmox.com> References: <20261130104716.329802-1-a.bied-charreton@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1796035645286 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.536 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) 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: UYFVOT4WZ4E5KLNRMIEB3G2RLKG75OTR X-Message-ID-Hash: UYFVOT4WZ4E5KLNRMIEB3G2RLKG75OTR X-MailFrom: a.bied-charreton@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 Datacenter Manager development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Fetch VM-specific CPU flags from the node so the CPU editor can stay in sync with qemu-server instead of hardcoding the list that misses newer ones like nested-virt. Needs Resource.Audit on the node like the CPU model list. Signed-off-by: Arthur Bied-Charreton --- server/src/api/pve/node.rs | 46 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 44 insertions(+), 2 deletions(-) diff --git a/server/src/api/pve/node.rs b/server/src/api/pve/node.rs index 5c7683bc..d0c4cd34 100644 --- a/server/src/api/pve/node.rs +++ b/server/src/api/pve/node.rs @@ -313,8 +313,10 @@ const QEMU_CAPABILITIES_ROUTER: Router = Router::new() .get(&list_subdirs_api_method!(QEMU_CAPABILITIES_SUBDIRS)) .subdirs(QEMU_CAPABILITIES_SUBDIRS); -const QEMU_CAPABILITIES_SUBDIRS: SubdirMap = - &[("cpu", &Router::new().get(&API_METHOD_QEMU_CPU_CAPABILITIES))]; +const QEMU_CAPABILITIES_SUBDIRS: SubdirMap = &[ + ("cpu", &Router::new().get(&API_METHOD_QEMU_CPU_CAPABILITIES)), + ("cpu-flags", &Router::new().get(&API_METHOD_QEMU_CPU_FLAGS)), +]; #[api( input: { @@ -350,3 +352,43 @@ async fn qemu_cpu_capabilities( .await .map_err(Into::into) } + +#[api( + input: { + properties: { + remote: { schema: REMOTE_ID_SCHEMA }, + node: { schema: NODE_SCHEMA }, + accel: { + type: pve_api_types::QemuCpuFlagsAccel, + optional: true, + }, + arch: { + type: pve_api_types::ClusterResourceHostArch, + optional: true, + }, + }, + }, + access: { + permission: &Permission::Privilege(&["resource", "{remote}", "node", "{node}"], PRIV_RESOURCE_AUDIT, false), + }, + returns: { + type: Array, + description: "A list of VM-specific CPU flags available on the remote.", + items: { + type: pve_api_types::QemuCpuFlag, + } + } +)] +/// List the VM-specific CPU flags available on a remote. +async fn qemu_cpu_flags( + remote: String, + node: String, + accel: Option, + arch: Option, +) -> Result, Error> { + let client = super::connect_to_remote_for_node(&remote, &node)?; + client + .qemu_cpu_flags(&node, accel, arch) + .await + .map_err(Into::into) +} -- 2.47.3