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 090821FF0B7 for ; Mon, 30 Nov 2026 15:11:08 +0100 (CET) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id 842DD21704; Mon, 30 Nov 2026 15:11:07 +0100 (CET) From: Arthur Bied-Charreton To: pdm-devel@lists.proxmox.com Subject: [PATCH proxmox v2 2/4] pve-api-types: add VM-specific CPU flags endpoint Date: Mon, 30 Nov 2026 15:10:52 +0100 Message-ID: <20261130141054.556314-3-a.bied-charreton@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20261130141054.556314-1-a.bied-charreton@proxmox.com> References: <20261130141054.556314-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: 1796047861345 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.378 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) POISEN_SPAM_PILL 0.1 Meta: its spam POISEN_SPAM_PILL_1 0.1 random spam to be learned in bayes POISEN_SPAM_PILL_3 0.1 random spam to be learned in bayes 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: XP7B4ZWBKRBWQQKIHGX2ONUZNYKYLPJE X-Message-ID-Hash: XP7B4ZWBKRBWQQKIHGX2ONUZNYKYLPJE 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: PDM hardcodes VM-specific flags in the CPU editor, so the list fell behind qemu-server (e.g. it does not offer nested-virt). Add declaration for /nodes/{node}/capabilities/qemu/cpu-flags to allow PDM to offer the up-to-date list. Signed-off-by: Arthur Bied-Charreton --- pve-api-types/generate.pl | 1 + pve-api-types/src/generated/code.rs | 30 +++++- pve-api-types/src/generated/types.rs | 140 ++++++++++++++++++++------- 3 files changed, 133 insertions(+), 38 deletions(-) diff --git a/pve-api-types/generate.pl b/pve-api-types/generate.pl index c9cdb272..7b31ec5e 100755 --- a/pve-api-types/generate.pl +++ b/pve-api-types/generate.pl @@ -489,6 +489,7 @@ Schema2Rust::derive('BulkShutdownGuests' => 'Default'); Schema2Rust::derive('BulkSuspendGuests' => 'Default'); api(GET => '/nodes/{node}/capabilities/qemu/cpu', 'qemu_cpu_capabilities', 'output-type' => 'Vec'); +api(GET => '/nodes/{node}/capabilities/qemu/cpu-flags', 'qemu_cpu_flags', 'return-name' => 'QemuCpuFlag'); Schema2Rust::register_api_override('ClusterMetrics', '/properties/data/items', { type => "ClusterMetricsData"}); diff --git a/pve-api-types/src/generated/code.rs b/pve-api-types/src/generated/code.rs index 22eba954..ab874777 100644 --- a/pve-api-types/src/generated/code.rs +++ b/pve-api-types/src/generated/code.rs @@ -138,7 +138,6 @@ /// - /nodes/{node}/apt /// - /nodes/{node}/capabilities /// - /nodes/{node}/capabilities/qemu -/// - /nodes/{node}/capabilities/qemu/cpu-flags /// - /nodes/{node}/capabilities/qemu/machines /// - /nodes/{node}/capabilities/qemu/migration /// - /nodes/{node}/ceph @@ -1467,6 +1466,17 @@ pub trait PveClient { Err(Error::Other("qemu_cpu_capabilities not implemented")) } + /// List of available VM-specific CPU flags. Returns an empty list for + /// 'aarch64' as no VM-specific flags are defined for it yet. + async fn qemu_cpu_flags( + &self, + node: &str, + accel: Option, + arch: Option, + ) -> Result, Error> { + Err(Error::Other("qemu_cpu_flags not implemented")) + } + /// List aliases async fn qemu_firewall_aliases( &self, @@ -4073,6 +4083,24 @@ where Ok(self.0.get(url).await?.expect_json()?.data) } + /// List of available VM-specific CPU flags. Returns an empty list for + /// 'aarch64' as no VM-specific flags are defined for it yet. + async fn qemu_cpu_flags( + &self, + node: &str, + accel: Option, + arch: Option, + ) -> Result, Error> { + let url = &ApiPathBuilder::new(format!( + "/api2/extjs/nodes/{}/capabilities/qemu/cpu-flags", + percent_encode(node.as_bytes(), percent_encoding::NON_ALPHANUMERIC) + )) + .maybe_arg("accel", &accel) + .maybe_arg("arch", &arch) + .build(); + Ok(self.0.get(url).await?.expect_json()?.data) + } + /// List aliases async fn qemu_firewall_aliases( &self, diff --git a/pve-api-types/src/generated/types.rs b/pve-api-types/src/generated/types.rs index 295be47b..5e3cfb43 100644 --- a/pve-api-types/src/generated/types.rs +++ b/pve-api-types/src/generated/types.rs @@ -18645,6 +18645,72 @@ pub enum QemuConfigVirtiofsCache { serde_plain::derive_display_from_serialize!(QemuConfigVirtiofsCache); serde_plain::derive_fromstr_from_deserialize!(QemuConfigVirtiofsCache); +const_regex! { + +QEMU_CPU_FLAG_SUPPORTED_ON_RE = r##"^(?i:[a-z0-9](?i:[a-z0-9\-]*[a-z0-9])?)$"##; + +} + +#[test] +fn test_regex_compilation_39() { + use regex::Regex; + let _: &Regex = &QEMU_CPU_FLAG_SUPPORTED_ON_RE; +} +#[api( + properties: { + description: { + optional: true, + type: String, + }, + name: { + type: String, + }, + "supported-on": { + items: { + description: "The cluster node name.", + format: &ApiStringFormat::Pattern(&QEMU_CPU_FLAG_SUPPORTED_ON_RE), + type: String, + }, + optional: true, + type: Array, + }, + }, +)] +/// Object. +#[derive(Debug, serde::Deserialize, serde::Serialize)] +pub struct QemuCpuFlag { + /// Description of the CPU flag. + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, + + /// Name of the CPU flag. + pub name: String, + + /// List of nodes supporting the CPU flag with the selected acceleration + /// type ("accel"). + #[serde(default, skip_serializing_if = "Option::is_none")] + #[serde(rename = "supported-on")] + pub supported_on: Option>, +} + +#[api] +/// Acceleration type to check node compatibility for. +#[derive(Clone, Copy, Debug, Default, Eq, PartialEq, serde::Deserialize, serde::Serialize)] +pub enum QemuCpuFlagsAccel { + #[serde(rename = "kvm")] + #[default] + /// kvm. + Kvm, + #[serde(rename = "tcg")] + /// tcg. + Tcg, + /// Unknown variants for forward compatibility. + #[serde(untagged)] + UnknownEnumValue(FixedString), +} +serde_plain::derive_display_from_serialize!(QemuCpuFlagsAccel); +serde_plain::derive_fromstr_from_deserialize!(QemuCpuFlagsAccel); + #[api( properties: { allowed_nodes: { @@ -18861,7 +18927,7 @@ QEMU_MOVE_DISK_STORAGE_RE = r##"^(?i:[a-z][a-z0-9\-_.]*[a-z0-9])$"##; } #[test] -fn test_regex_compilation_39() { +fn test_regex_compilation_40() { use regex::Regex; let _: &Regex = &QEMU_MOVE_DISK_STORAGE_RE; } @@ -20702,7 +20768,7 @@ REMOTE_MIGRATE_LXC_TARGET_STORAGE_RE = r##"^(?i:[a-z][a-z0-9\-_.]*[a-z0-9]):(?i: } #[test] -fn test_regex_compilation_40() { +fn test_regex_compilation_41() { use regex::Regex; let _: &Regex = &REMOTE_MIGRATE_LXC_TARGET_BRIDGE_RE; let _: &Regex = &REMOTE_MIGRATE_LXC_TARGET_STORAGE_RE; @@ -20830,7 +20896,7 @@ REMOTE_MIGRATE_QEMU_TARGET_STORAGE_RE = r##"^(?i:[a-z][a-z0-9\-_.]*[a-z0-9]):(?i } #[test] -fn test_regex_compilation_41() { +fn test_regex_compilation_42() { use regex::Regex; let _: &Regex = &REMOTE_MIGRATE_QEMU_TARGET_BRIDGE_RE; let _: &Regex = &REMOTE_MIGRATE_QEMU_TARGET_STORAGE_RE; @@ -20941,7 +21007,7 @@ REPLICATION_JOB_TARGET_RE = r##"^(?i:[a-z0-9](?i:[a-z0-9\-]*[a-z0-9])?)$"##; } #[test] -fn test_regex_compilation_42() { +fn test_regex_compilation_43() { use regex::Regex; let _: &Regex = &REPLICATION_JOB_ID_RE; let _: &Regex = &REPLICATION_JOB_SOURCE_RE; @@ -21053,7 +21119,7 @@ REPLICATION_JOB_CONFIG_TARGET_RE = r##"^(?i:[a-z0-9](?i:[a-z0-9\-]*[a-z0-9])?)$" } #[test] -fn test_regex_compilation_43() { +fn test_regex_compilation_44() { use regex::Regex; let _: &Regex = &REPLICATION_JOB_CONFIG_ID_RE; let _: &Regex = &REPLICATION_JOB_CONFIG_SOURCE_RE; @@ -21195,7 +21261,7 @@ REPLICATION_JOB_STATUS_TARGET_RE = r##"^(?i:[a-z0-9](?i:[a-z0-9\-]*[a-z0-9])?)$" } #[test] -fn test_regex_compilation_44() { +fn test_regex_compilation_45() { use regex::Regex; let _: &Regex = &REPLICATION_JOB_STATUS_ID_RE; let _: &Regex = &REPLICATION_JOB_STATUS_SOURCE_RE; @@ -21412,7 +21478,7 @@ RESTORE_LXC_STORAGE_RE = r##"^(?i:[a-z][a-z0-9\-_.]*[a-z0-9])$"##; } #[test] -fn test_regex_compilation_45() { +fn test_regex_compilation_46() { use regex::Regex; let _: &Regex = &RESTORE_LXC_STORAGE_RE; } @@ -21504,7 +21570,7 @@ RESTORE_QEMU_STORAGE_RE = r##"^(?i:[a-z][a-z0-9\-_.]*[a-z0-9])$"##; } #[test] -fn test_regex_compilation_46() { +fn test_regex_compilation_47() { use regex::Regex; let _: &Regex = &RESTORE_QEMU_STORAGE_RE; } @@ -21980,7 +22046,7 @@ SDN_CONTROLLER_NODES_RE = r##"^(?i:[a-z0-9](?i:[a-z0-9\-]*[a-z0-9])?)$"##; } #[test] -fn test_regex_compilation_47() { +fn test_regex_compilation_48() { use regex::Regex; let _: &Regex = &SDN_CONTROLLER_ISIS_IFACES_RE; let _: &Regex = &SDN_CONTROLLER_ISIS_NET_RE; @@ -22183,7 +22249,7 @@ SDN_CONTROLLER_PENDING_NODES_RE = r##"^(?i:[a-z0-9](?i:[a-z0-9\-]*[a-z0-9])?)$"# } #[test] -fn test_regex_compilation_48() { +fn test_regex_compilation_49() { use regex::Regex; let _: &Regex = &SDN_CONTROLLER_PENDING_ISIS_IFACES_RE; let _: &Regex = &SDN_CONTROLLER_PENDING_ISIS_NET_RE; @@ -22439,7 +22505,7 @@ SDN_VNET_MAC_VRF_MAC_RE = r##"^(?i)[a-f0-9][02468ace](?::[a-f0-9]{2}){5}$"##; } #[test] -fn test_regex_compilation_49() { +fn test_regex_compilation_50() { use regex::Regex; let _: &Regex = &SDN_VNET_MAC_VRF_MAC_RE; } @@ -22551,7 +22617,7 @@ SDN_ZONE_EXITNODES_PRIMARY_RE = r##"^(?i:[a-z0-9](?i:[a-z0-9\-]*[a-z0-9])?)$"##; } #[test] -fn test_regex_compilation_50() { +fn test_regex_compilation_51() { use regex::Regex; let _: &Regex = &SDN_ZONE_EXITNODES_RE; let _: &Regex = &SDN_ZONE_EXITNODES_PRIMARY_RE; @@ -22881,7 +22947,7 @@ SDN_ZONE_PENDING_EXITNODES_PRIMARY_RE = r##"^(?i:[a-z0-9](?i:[a-z0-9\-]*[a-z0-9] } #[test] -fn test_regex_compilation_51() { +fn test_regex_compilation_52() { use regex::Regex; let _: &Regex = &SDN_ZONE_PENDING_EXITNODES_RE; let _: &Regex = &SDN_ZONE_PENDING_EXITNODES_PRIMARY_RE; @@ -23419,7 +23485,7 @@ START_ALL_GUESTS_VMS_RE = r##"^[1-9][0-9]{2,8}$"##; } #[test] -fn test_regex_compilation_52() { +fn test_regex_compilation_53() { use regex::Regex; let _: &Regex = &START_ALL_GUESTS_VMS_RE; } @@ -23519,7 +23585,7 @@ START_QEMU_TARGETSTORAGE_RE = r##"^(?i:[a-z][a-z0-9\-_.]*[a-z0-9]):(?i:[a-z][a-z } #[test] -fn test_regex_compilation_53() { +fn test_regex_compilation_54() { use regex::Regex; let _: &Regex = &START_QEMU_MIGRATEDFROM_RE; let _: &Regex = &START_QEMU_TARGETSTORAGE_RE; @@ -23679,7 +23745,7 @@ STOP_ALL_GUESTS_VMS_RE = r##"^[1-9][0-9]{2,8}$"##; } #[test] -fn test_regex_compilation_54() { +fn test_regex_compilation_55() { use regex::Regex; let _: &Regex = &STOP_ALL_GUESTS_VMS_RE; } @@ -23792,7 +23858,7 @@ STOP_QEMU_MIGRATEDFROM_RE = r##"^(?i:[a-z0-9](?i:[a-z0-9\-]*[a-z0-9])?)$"##; } #[test] -fn test_regex_compilation_55() { +fn test_regex_compilation_56() { use regex::Regex; let _: &Regex = &STOP_QEMU_MIGRATEDFROM_RE; } @@ -23861,7 +23927,7 @@ STORAGE_CONFIG_STORAGE_RE = r##"^(?i:[a-z][a-z0-9\-_.]*[a-z0-9])$"##; } #[test] -fn test_regex_compilation_56() { +fn test_regex_compilation_57() { use regex::Regex; let _: &Regex = &STORAGE_CONFIG_FS_NAME_RE; let _: &Regex = &STORAGE_CONFIG_NODES_RE; @@ -24120,7 +24186,7 @@ STORAGE_INFO_STORAGE_RE = r##"^(?i:[a-z][a-z0-9\-_.]*[a-z0-9])$"##; } #[test] -fn test_regex_compilation_57() { +fn test_regex_compilation_58() { use regex::Regex; let _: &Regex = &STORAGE_INFO_STORAGE_RE; } @@ -24558,7 +24624,7 @@ SUSPEND_ALL_GUESTS_VMS_RE = r##"^[1-9][0-9]{2,8}$"##; } #[test] -fn test_regex_compilation_58() { +fn test_regex_compilation_59() { use regex::Regex; let _: &Regex = &SUSPEND_ALL_GUESTS_VMS_RE; } @@ -24604,7 +24670,7 @@ SUSPEND_QEMU_STATESTORAGE_RE = r##"^(?i:[a-z][a-z0-9\-_.]*[a-z0-9])$"##; } #[test] -fn test_regex_compilation_59() { +fn test_regex_compilation_60() { use regex::Regex; let _: &Regex = &SUSPEND_QEMU_STATESTORAGE_RE; } @@ -24848,7 +24914,7 @@ UPDATE_ACL_TOKENS_RE = r##"^[^\s:/]+@[A-Za-z][A-Za-z0-9\.\-_]+![A-Za-z][A-Za-z0- } #[test] -fn test_regex_compilation_60() { +fn test_regex_compilation_61() { use regex::Regex; let _: &Regex = &UPDATE_ACL_GROUPS_RE; let _: &Regex = &UPDATE_ACL_ROLES_RE; @@ -24958,7 +25024,7 @@ UPDATE_CLUSTER_FIREWALL_OPTIONS_DELETE_RE = r##"^(?i:[a-z][a-z0-9_-]+)$"##; } #[test] -fn test_regex_compilation_61() { +fn test_regex_compilation_62() { use regex::Regex; let _: &Regex = &UPDATE_CLUSTER_FIREWALL_OPTIONS_DELETE_RE; } @@ -25052,7 +25118,7 @@ UPDATE_CLUSTER_OPTIONS_MAC_PREFIX_RE = r##"^(?i)[a-f0-9][02468ace](?::[a-f0-9]{2 } #[test] -fn test_regex_compilation_62() { +fn test_regex_compilation_63() { use regex::Regex; let _: &Regex = &UPDATE_CLUSTER_OPTIONS_DELETE_RE; let _: &Regex = &UPDATE_CLUSTER_OPTIONS_EMAIL_FROM_RE; @@ -25402,7 +25468,7 @@ UPDATE_GUEST_FIREWALL_OPTIONS_DELETE_RE = r##"^(?i:[a-z][a-z0-9_-]+)$"##; } #[test] -fn test_regex_compilation_63() { +fn test_regex_compilation_64() { use regex::Regex; let _: &Regex = &UPDATE_GUEST_FIREWALL_OPTIONS_DELETE_RE; } @@ -25533,7 +25599,7 @@ UPDATE_LXC_CONFIG_TIMEZONE_RE = r##"^.*/.*$"##; } #[test] -fn test_regex_compilation_64() { +fn test_regex_compilation_65() { use regex::Regex; let _: &Regex = &UPDATE_LXC_CONFIG_DELETE_RE; let _: &Regex = &UPDATE_LXC_CONFIG_REVERT_RE; @@ -25928,7 +25994,7 @@ UPDATE_NODE_CONFIG_DELETE_RE = r##"^(?i:[a-z][a-z0-9_-]+)$"##; } #[test] -fn test_regex_compilation_65() { +fn test_regex_compilation_66() { use regex::Regex; let _: &Regex = &UPDATE_NODE_CONFIG_DELETE_RE; } @@ -26042,7 +26108,7 @@ UPDATE_NODE_FIREWALL_OPTIONS_DELETE_RE = r##"^(?i:[a-z][a-z0-9_-]+)$"##; } #[test] -fn test_regex_compilation_66() { +fn test_regex_compilation_67() { use regex::Regex; let _: &Regex = &UPDATE_NODE_FIREWALL_OPTIONS_DELETE_RE; } @@ -26263,7 +26329,7 @@ UPDATE_QEMU_CONFIG_VMSTATESTORAGE_RE = r##"^(?i:[a-z][a-z0-9\-_.]*[a-z0-9])$"##; } #[test] -fn test_regex_compilation_67() { +fn test_regex_compilation_68() { use regex::Regex; let _: &Regex = &UPDATE_QEMU_CONFIG_AFFINITY_RE; let _: &Regex = &UPDATE_QEMU_CONFIG_BOOTDISK_RE; @@ -27176,7 +27242,7 @@ UPDATE_QEMU_CONFIG_ASYNC_VMSTATESTORAGE_RE = r##"^(?i:[a-z][a-z0-9\-_.]*[a-z0-9] } #[test] -fn test_regex_compilation_68() { +fn test_regex_compilation_69() { use regex::Regex; let _: &Regex = &UPDATE_QEMU_CONFIG_ASYNC_AFFINITY_RE; let _: &Regex = &UPDATE_QEMU_CONFIG_ASYNC_BOOTDISK_RE; @@ -28067,7 +28133,7 @@ UPDATE_QEMU_CONFIG_EFIDISK0_SIZE_RE = r##"^(\d+(\.\d+)?)([KMGT])?$"##; } #[test] -fn test_regex_compilation_69() { +fn test_regex_compilation_70() { use regex::Regex; let _: &Regex = &UPDATE_QEMU_CONFIG_EFIDISK0_SIZE_RE; } @@ -28152,7 +28218,7 @@ UPDATE_QEMU_CONFIG_IDE_SIZE_RE = r##"^(\d+(\.\d+)?)([KMGT])?$"##; } #[test] -fn test_regex_compilation_70() { +fn test_regex_compilation_71() { use regex::Regex; let _: &Regex = &UPDATE_QEMU_CONFIG_IDE_MODEL_RE; let _: &Regex = &UPDATE_QEMU_CONFIG_IDE_SERIAL_RE; @@ -28508,7 +28574,7 @@ UPDATE_QEMU_CONFIG_SATA_SIZE_RE = r##"^(\d+(\.\d+)?)([KMGT])?$"##; } #[test] -fn test_regex_compilation_71() { +fn test_regex_compilation_72() { use regex::Regex; let _: &Regex = &UPDATE_QEMU_CONFIG_SATA_SERIAL_RE; let _: &Regex = &UPDATE_QEMU_CONFIG_SATA_SIZE_RE; @@ -28853,7 +28919,7 @@ UPDATE_QEMU_CONFIG_SCSI_SIZE_RE = r##"^(\d+(\.\d+)?)([KMGT])?$"##; } #[test] -fn test_regex_compilation_72() { +fn test_regex_compilation_73() { use regex::Regex; let _: &Regex = &UPDATE_QEMU_CONFIG_SCSI_SERIAL_RE; let _: &Regex = &UPDATE_QEMU_CONFIG_SCSI_SIZE_RE; @@ -29253,7 +29319,7 @@ UPDATE_QEMU_CONFIG_TPMSTATE0_SIZE_RE = r##"^(\d+(\.\d+)?)([KMGT])?$"##; } #[test] -fn test_regex_compilation_73() { +fn test_regex_compilation_74() { use regex::Regex; let _: &Regex = &UPDATE_QEMU_CONFIG_TPMSTATE0_SIZE_RE; } @@ -29316,7 +29382,7 @@ UPDATE_QEMU_CONFIG_VIRTIO_SIZE_RE = r##"^(\d+(\.\d+)?)([KMGT])?$"##; } #[test] -fn test_regex_compilation_74() { +fn test_regex_compilation_75() { use regex::Regex; let _: &Regex = &UPDATE_QEMU_CONFIG_VIRTIO_SERIAL_RE; let _: &Regex = &UPDATE_QEMU_CONFIG_VIRTIO_SIZE_RE; @@ -29676,7 +29742,7 @@ UPDATE_REPLICATION_JOB_SOURCE_RE = r##"^(?i:[a-z0-9](?i:[a-z0-9\-]*[a-z0-9])?)$" } #[test] -fn test_regex_compilation_75() { +fn test_regex_compilation_76() { use regex::Regex; let _: &Regex = &UPDATE_REPLICATION_JOB_DELETE_RE; let _: &Regex = &UPDATE_REPLICATION_JOB_SOURCE_RE; -- 2.47.3