* [PATCH proxmox 1/3] pve-api-types: add VM-specific CPU flags endpoint
2026-11-30 10:47 [PATCH datacenter-manager/proxmox{,-yew-comp} 0/3] load VM-specific CPU flags from the remote Arthur Bied-Charreton
@ 2026-11-30 10:47 ` Arthur Bied-Charreton
2026-11-30 10:47 ` [PATCH datacenter-manager 2/3] api: pve: " Arthur Bied-Charreton
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Arthur Bied-Charreton @ 2026-11-30 10:47 UTC (permalink / raw)
To: pdm-devel
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 <a.bied-charreton@proxmox.com>
---
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<QemuCpuModel>');
+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<QemuCpuFlagsAccel>,
+ arch: Option<ClusterResourceHostArch>,
+ ) -> Result<Vec<QemuCpuFlag>, 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<QemuCpuFlagsAccel>,
+ arch: Option<ClusterResourceHostArch>,
+ ) -> Result<Vec<QemuCpuFlag>, 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<String>,
+
+ /// 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<Vec<String>>,
+}
+
+#[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
^ permalink raw reply related [flat|nested] 6+ messages in thread* [PATCH datacenter-manager 2/3] api: pve: add VM-specific CPU flags endpoint
2026-11-30 10:47 [PATCH datacenter-manager/proxmox{,-yew-comp} 0/3] load VM-specific CPU flags from the remote Arthur Bied-Charreton
2026-11-30 10:47 ` [PATCH proxmox 1/3] pve-api-types: add VM-specific CPU flags endpoint Arthur Bied-Charreton
@ 2026-11-30 10:47 ` Arthur Bied-Charreton
2026-11-30 10:47 ` [PATCH proxmox-yew-comp 3/3] qemu: cpu flags: load the CPU flags from the node Arthur Bied-Charreton
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Arthur Bied-Charreton @ 2026-11-30 10:47 UTC (permalink / raw)
To: pdm-devel
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 <a.bied-charreton@proxmox.com>
---
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<pve_api_types::QemuCpuFlagsAccel>,
+ arch: Option<pve_api_types::ClusterResourceHostArch>,
+) -> Result<Vec<pve_api_types::QemuCpuFlag>, 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
^ permalink raw reply related [flat|nested] 6+ messages in thread* [PATCH proxmox-yew-comp 3/3] qemu: cpu flags: load the CPU flags from the node
2026-11-30 10:47 [PATCH datacenter-manager/proxmox{,-yew-comp} 0/3] load VM-specific CPU flags from the remote Arthur Bied-Charreton
2026-11-30 10:47 ` [PATCH proxmox 1/3] pve-api-types: add VM-specific CPU flags endpoint Arthur Bied-Charreton
2026-11-30 10:47 ` [PATCH datacenter-manager 2/3] api: pve: " Arthur Bied-Charreton
@ 2026-11-30 10:47 ` Arthur Bied-Charreton
2026-11-30 14:12 ` superseded: [PATCH datacenter-manager/proxmox{,-yew-comp} 0/3] load VM-specific CPU flags from the remote Arthur Bied-Charreton
2026-12-01 13:56 ` Thomas Lamprecht
4 siblings, 0 replies; 6+ messages in thread
From: Arthur Bied-Charreton @ 2026-11-30 10:47 UTC (permalink / raw)
To: pdm-devel
The CPU flags editor used a hardcoded list that fell behind
qemu-server, e.g. it misses the nested-virt alias.
Load the flags from the guest's node instead.
Nodes before qemu-server 9.0.26 and PDM witohut the proxied call do not
have that endpoint. Fall back to the hardcoded list for them. Show other
errors so an unreachable node or a missing privilege is visible.
Signed-off-by: Arthur Bied-Charreton <a.bied-charreton@proxmox.com>
---
.../pve/qemu_hardware_panel/mobile.rs | 6 +-
src/form/pve/qemu_cpu_flags_list.rs | 135 +++++++++++++-----
.../qemu_property/qemu_processor_property.rs | 25 +++-
3 files changed, 126 insertions(+), 40 deletions(-)
diff --git a/src/configuration/pve/qemu_hardware_panel/mobile.rs b/src/configuration/pve/qemu_hardware_panel/mobile.rs
index bc958b9..c9ccff0 100644
--- a/src/configuration/pve/qemu_hardware_panel/mobile.rs
+++ b/src/configuration/pve/qemu_hardware_panel/mobile.rs
@@ -768,7 +768,11 @@ impl PendingPropertyView for PveQemuHardwarePanel {
mobile,
),
kernel_scheduler_property: qemu_kernel_scheduler_property(user_is_root, mobile),
- cpu_flags_property: qemu_cpu_flags_property(mobile),
+ cpu_flags_property: qemu_cpu_flags_property(
+ props.node.clone(),
+ props.remote.clone(),
+ mobile,
+ ),
display_property: qemu_display_property(mobile),
machine_property: qemu_machine_property(mobile),
scsihw_property: qemu_scsihw_property(mobile),
diff --git a/src/form/pve/qemu_cpu_flags_list.rs b/src/form/pve/qemu_cpu_flags_list.rs
index bfcac50..e688bc7 100644
--- a/src/form/pve/qemu_cpu_flags_list.rs
+++ b/src/form/pve/qemu_cpu_flags_list.rs
@@ -4,21 +4,38 @@ use serde::{Deserialize, Serialize};
use serde_json::Value;
use std::collections::HashMap;
+use yew::html::IntoPropValue;
+
use pwt::prelude::*;
use pwt::widget::form::{
ManagedField, ManagedFieldContext, ManagedFieldMaster, ManagedFieldScopeExt, ManagedFieldState,
RadioButton,
};
-use pwt::widget::{Column, List, ListTile, Row};
+use pwt::widget::{error_message, Column, List, ListTile, Row};
use pwt_macros::{builder, widget};
+use pve_api_types::QemuCpuFlag;
+
+use crate::http_get;
+use crate::percent_encoding::percent_encode_component;
+
pub type QemuCpuFlagsComp = ManagedFieldMaster<QemuCpuFlagsField>;
#[widget(comp=QemuCpuFlagsComp, @input)]
#[derive(Clone, PartialEq, Properties)]
#[builder]
-pub struct QemuCpuFlags {}
+pub struct QemuCpuFlags {
+ /// The node to query for available flags.
+ #[builder(IntoPropValue, into_prop_value)]
+ #[prop_or_default]
+ pub node: Option<AttrValue>,
+
+ /// Use Proxmox Datacenter Manager API endpoints
+ #[builder(IntoPropValue, into_prop_value)]
+ #[prop_or_default]
+ pub remote: Option<AttrValue>,
+}
impl Default for QemuCpuFlags {
fn default() -> Self {
@@ -34,6 +51,7 @@ impl QemuCpuFlags {
pub enum Msg {
Set(String, Option<bool>),
+ Loaded(Result<Vec<QemuCpuFlag>, Error>),
}
#[derive(Clone, Debug, Serialize, Deserialize)]
@@ -46,7 +64,58 @@ struct FlagEntry {
#[doc(hidden)]
pub struct QemuCpuFlagsField {
state: ManagedFieldState,
- flag_list: IndexMap<&'static str, FlagEntry>,
+ flag_list: IndexMap<String, FlagEntry>,
+ error: Option<String>,
+}
+
+async fn load_flags(props: QemuCpuFlags) -> Msg {
+ let node = props.node.as_deref().unwrap_or("localhost");
+ let url = match &props.remote {
+ Some(remote) => format!(
+ "/pve/remotes/{}/nodes/{}/capabilities/qemu/cpu-flags",
+ percent_encode_component(remote),
+ percent_encode_component(node),
+ ),
+ None => format!(
+ "/nodes/{}/capabilities/qemu/cpu-flags",
+ percent_encode_component(node),
+ ),
+ };
+ Msg::Loaded(http_get(url, None).await)
+}
+
+/// The VM-specific flags of nodes that predate the cpu-flags API endpoint (qemu-server 9.0.26).
+fn fallback_flags() -> Vec<FlagEntry> {
+ [
+ ("md-clear", tr!("Required to let the guest OS know if MDS is mitigated correctly")),
+ ("pcid", tr!("Meltdown fix cost reduction on Westmere, Sandy-, and IvyBridge Intel CPUs")),
+ ("spec-ctrl", tr!("Allows improved Spectre mitigation with Intel CPUs")),
+ ("ssbd", tr!("Protection for \"Speculative Store Bypass\" for Intel models")),
+ ("ibpb", tr!("Allows improved Spectre mitigation with AMD CPUs")),
+ ("virt-ssbd", tr!("Basis for \"Speculative Store Bypass\" protection for AMD models")),
+ ("amd-ssbd", tr!("Improves Spectre mitigation performance with AMD CPUs, best used with \"virt-ssbd\"")),
+ ("amd-no-ssb", tr!("Notifies guest OS that host is not vulnerable for Spectre on AMD CPUs")),
+ ("pdpe1gb", tr!("Allow guest OS to use 1GB size pages, if host HW supports it")),
+ ("hv-tlbflush", tr!("Improve performance in overcommitted Windows guests. May lead to guest bluescreens on old CPUs.")),
+ ("hv-evmcs", tr!("Improve performance for nested virtualization. Only supported on Intel CPUs.")),
+ ("aes", tr!("Activate AES instruction set for HW acceleration.")),
+ ]
+ .into_iter()
+ .map(|(name, descr)| FlagEntry {
+ enabled: None,
+ name: name.to_string(),
+ descr,
+ })
+ .collect()
+}
+
+/// Nodes before qemu-server 9.0.26 answer 501, PDM servers without the proxied call answer 404.
+fn is_endpoint_missing(err: &Error) -> bool {
+ matches!(
+ err.downcast_ref::<proxmox_client::Error>(),
+ Some(proxmox_client::Error::Api(status, _))
+ if *status == http::StatusCode::NOT_IMPLEMENTED || *status == http::StatusCode::NOT_FOUND
+ )
}
fn parse_flags(flags: &str) -> HashMap<String, bool> {
@@ -73,7 +142,7 @@ impl QemuCpuFlagsField {
pub fn update_flag_list(&mut self, value: Value) {
let current_flags = parse_flags(value.as_str().unwrap_or(""));
for (name, item) in self.flag_list.iter_mut() {
- if let Some(value) = current_flags.get(*name) {
+ if let Some(value) = current_flags.get(name) {
item.enabled = Some(*value);
} else {
item.enabled = None;
@@ -93,38 +162,12 @@ impl ManagedField for QemuCpuFlagsField {
Ok(value.clone())
}
- fn create(_ctx: &ManagedFieldContext<Self>) -> Self {
- // TODO: let qemu-server host this and autogenerate or get from API call??
- let all_flags = [
- ("md-clear", tr!("Required to let the guest OS know if MDS is mitigated correctly")),
- ("pcid", tr!("Meltdown fix cost reduction on Westmere, Sandy-, and IvyBridge Intel CPUs")),
- ("spec-ctrl", tr!("Allows improved Spectre mitigation with Intel CPUs")),
- ("ssbd", tr!("Protection for \"Speculative Store Bypass\" for Intel models")),
- ("ibpb", tr!("Allows improved Spectre mitigation with AMD CPUs")),
- ("virt-ssbd", tr!("Basis for \"Speculative Store Bypass\" protection for AMD models")),
- ("amd-ssbd", tr!("Improves Spectre mitigation performance with AMD CPUs, best used with \"virt-ssbd\"")),
- ("amd-no-ssb", tr!("Notifies guest OS that host is not vulnerable for Spectre on AMD CPUs")),
- ("pdpe1gb", tr!("Allow guest OS to use 1GB size pages, if host HW supports it")),
- ("hv-tlbflush", tr!("Improve performance in overcommitted Windows guests. May lead to guest bluescreens on old CPUs.")),
- ("hv-evmcs", tr!("Improve performance for nested virtualization. Only supported on Intel CPUs.")),
- ("aes", tr!("Activate AES instruction set for HW acceleration.")),
- ];
-
- let mut flag_list = IndexMap::new();
- flag_list.extend(all_flags.into_iter().map(|(flag, descr)| {
- (
- flag,
- FlagEntry {
- name: flag.to_string(),
- descr,
- enabled: None,
- },
- )
- }));
-
+ fn create(ctx: &ManagedFieldContext<Self>) -> Self {
+ ctx.link().send_future(load_flags(ctx.props().clone()));
Self {
state: ManagedFieldState::new(Value::Null, Value::Null),
- flag_list,
+ flag_list: IndexMap::new(),
+ error: None,
}
}
@@ -137,6 +180,26 @@ impl ManagedField for QemuCpuFlagsField {
Msg::Set(flag, enabled) => {
self.flag_list[flag.as_str()].enabled = enabled;
}
+ Msg::Loaded(result) => {
+ let flags = match result {
+ Ok(flags) => flags
+ .into_iter()
+ .map(|flag| FlagEntry {
+ enabled: None,
+ name: flag.name,
+ descr: flag.description.unwrap_or_default(),
+ })
+ .collect(),
+ Err(err) if is_endpoint_missing(&err) => fallback_flags(),
+ Err(err) => {
+ self.error = Some(err.to_string());
+ Vec::new()
+ }
+ };
+ self.flag_list = flags.into_iter().map(|f| (f.name.clone(), f)).collect();
+ self.update_flag_list(self.state.value.clone());
+ return true;
+ }
}
let mut new_flags: Vec<String> = self
@@ -166,6 +229,10 @@ impl ManagedField for QemuCpuFlagsField {
}
fn view(&self, ctx: &ManagedFieldContext<Self>) -> Html {
+ if let Some(err) = &self.error {
+ return error_message(err).padding(2).into();
+ }
+
let tiles: Vec<ListTile> = self
.flag_list
.iter()
diff --git a/src/form/pve/qemu_property/qemu_processor_property.rs b/src/form/pve/qemu_property/qemu_processor_property.rs
index 0ba24a0..3f606ba 100644
--- a/src/form/pve/qemu_property/qemu_processor_property.rs
+++ b/src/form/pve/qemu_property/qemu_processor_property.rs
@@ -133,7 +133,8 @@ fn processor_input_panel(
let main_view =
socket_cores_input_panel(node.clone(), remote.clone(), false).apply(state.clone());
- let flags_view = cpu_flags_input_panel(false).apply(state.clone());
+ let flags_view =
+ cpu_flags_input_panel(node.clone(), remote.clone(), false).apply(state.clone());
let scheduler_view = kernel_scheduler_input_panel(user_is_root, false).apply(state.clone());
Column::new()
@@ -229,15 +230,29 @@ pub fn qemu_sockets_cores_property(
})
}
-fn cpu_flags_input_panel(_mobile: bool) -> RenderPropertyInputPanelFn {
- RenderPropertyInputPanelFn::new(move |_| QemuCpuFlags::new().name("_flags").into())
+fn cpu_flags_input_panel(
+ node: AttrValue,
+ remote: Option<AttrValue>,
+ _mobile: bool,
+) -> RenderPropertyInputPanelFn {
+ RenderPropertyInputPanelFn::new(move |_| {
+ QemuCpuFlags::new()
+ .node(node.clone())
+ .remote(remote.clone())
+ .name("_flags")
+ .into()
+ })
}
-pub fn qemu_cpu_flags_property(mobile: bool) -> EditableProperty {
+pub fn qemu_cpu_flags_property(
+ node: AttrValue,
+ remote: Option<AttrValue>,
+ mobile: bool,
+) -> EditableProperty {
EditableProperty::new("cpu", tr!("CPU flags"))
.required(true)
.renderer(renderer)
- .render_input_panel(cpu_flags_input_panel(mobile))
+ .render_input_panel(cpu_flags_input_panel(node, remote, mobile))
.load_hook(move |mut record: Value| {
flatten_property_string::<PveVmCpuConf>(&mut record, "cpu")?;
Ok(record)
--
2.47.3
^ permalink raw reply related [flat|nested] 6+ messages in thread* superseded: [PATCH datacenter-manager/proxmox{,-yew-comp} 0/3] load VM-specific CPU flags from the remote
2026-11-30 10:47 [PATCH datacenter-manager/proxmox{,-yew-comp} 0/3] load VM-specific CPU flags from the remote Arthur Bied-Charreton
` (2 preceding siblings ...)
2026-11-30 10:47 ` [PATCH proxmox-yew-comp 3/3] qemu: cpu flags: load the CPU flags from the node Arthur Bied-Charreton
@ 2026-11-30 14:12 ` Arthur Bied-Charreton
2026-12-01 13:56 ` Thomas Lamprecht
4 siblings, 0 replies; 6+ messages in thread
From: Arthur Bied-Charreton @ 2026-11-30 14:12 UTC (permalink / raw)
To: pdm-devel
superseded by:
https://lore.proxmox.com/pdm-devel/20261130141054.556314-1-a.bied-charreton@proxmox.com/T/#t
--
Arthur Bied-Charreton
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH datacenter-manager/proxmox{,-yew-comp} 0/3] load VM-specific CPU flags from the remote
2026-11-30 10:47 [PATCH datacenter-manager/proxmox{,-yew-comp} 0/3] load VM-specific CPU flags from the remote Arthur Bied-Charreton
` (3 preceding siblings ...)
2026-11-30 14:12 ` superseded: [PATCH datacenter-manager/proxmox{,-yew-comp} 0/3] load VM-specific CPU flags from the remote Arthur Bied-Charreton
@ 2026-12-01 13:56 ` Thomas Lamprecht
4 siblings, 0 replies; 6+ messages in thread
From: Thomas Lamprecht @ 2026-12-01 13:56 UTC (permalink / raw)
To: Arthur Bied-Charreton, pdm-devel
Am 30.11.26 um 11:47 schrieb Arthur Bied-Charreton:
> Note that currently the only symptom this fixes is the missing
> nested-virt flag, if preferred we could also just add that to the
> hardcoded list as a stopgap to limit churn.
for the record, I went that less involved route for now [0], we can
recheck this later (and ideally roll out the qemu-server patch first).
https://git.proxmox.com/?p=ui/proxmox-yew-comp.git;a=commitdiff;h=3e714f596afede7ad045de10c27a3e3c8efd6ccd
^ permalink raw reply [flat|nested] 6+ messages in thread