* [PATCH docs/manager/qemu-server v2 00/17] Add API and UI for custom CPU models
@ 2026-04-01 8:00 Arthur Bied-Charreton
2026-04-01 8:00 ` [PATCH pve-docs v2 01/17] qm: Add anchor to "CPU Type" section Arthur Bied-Charreton
` (16 more replies)
0 siblings, 17 replies; 18+ messages in thread
From: Arthur Bied-Charreton @ 2026-04-01 8:00 UTC (permalink / raw)
To: pve-devel
This picks up and extends an old series [0] by Stefan Reiter.
This series adds a full CRUD API and a UI editor for custom CPU models
which allows users to manage them in the Datacenter interface rather
than editing /etc/pve/virtual-guest/cpu-models.conf manually.
It also improves on the existing VM CPU flags selector by providing a list
of nodes supporting each flag to help gauge cluster compatibility.
The changes touch three repositories:
- pve-docs adds an anchor so the UI can link directly to the "CPU Type"
documentation
- qemu-server gets a new CPUFlags module grouping cpu-flags-related
helpers, and introduces query_available_cpu_flags, which derives the
set of flags accepted by QEMU as -cpu arguments and annotates each with
the cluster nodes that report supporting it. The existing node-level
cpu-flags endpoint is extended with an accel parameter (kvm/tcg, default
kvm). Its default behavior is preserved modulo the added 'supported-on'
field per flag.
- pve-manager gets two new cluster-level endpoints:
1. /cluster/qemu/cpu-flags queries flags available across the cluster,
and reports which node supports each flag
2. /cluster/qemu/custom-cpu-models provides full CRUD for custom CPU
model definitions
The UI adds a "Custom CPU models" view in the Datacenter panel with an
editor for model properties. The acceleration type can be chosen by the
user to filter flags when creating a new VM/custom model, and it is pre-
selected based on the VM's KVM config key when editing a VM's processor.
The VM CPU flags selector is improved with an option to filter out flags
that are not usable anywhere on the cluster.
Dependencies:
pve-manager requires bumped pve-docs
pve-manager requires bumped qemu-server
Changes since v1:
- Reorder patches according to dependency directions
qemu-server:
- Rebase
- Add preparatory commit renaming $default_filename to
$cpu_models_filename
- Squash helpers into commits with their first users
- Drop unrelated formatting change
- Move cluster-wide cpu-flags to pve-manager, related changes in
pve-manager changelog, keep vm-specific cpu-flags endpoint
- Return all flags from cpu-flags endpoint, not only the ones with at least one
node supporting them - allow filtering for that in the UI
- Return only VM-specific cpu-flags by default in node-specific endpoint
- Add acceleration type filter to cpu-flags endpoint, defaulting to kvm
- Document why no flags are currently returned for aarch64
- Only add nested-virt to flags for hosts that support one of svm/vmx
- Rename extract_flags to query_available_cpu_flags
- Remove web references from doc comments
- Refactor query_available_cpu_flags to a more imperative style
- Move custom CPU models CRUD endpoints to pve-manager, related changes
in pve-manager changelog
- Introduce QemuServer::CPUFlags module grouping flags-related helpers
- Add flag_is_aliased helper to identify flags covered by nested-virt
pve-manager:
- Rebase
- Drop unneeded dirty state fix from original series
- Update unknown flags behavior to
1. Show unknown flags at the top of the list in the UI
2. Add a description to unknown flags signaling that the flag is not
recognized in the cluster/for the currently selected acceleration type
- Rename allowCustom CPU model selector config field to showCustomModels
- Change "Reported Model" to "Base Model" in the UI
- Link directly to "CPU Type" section in onlineHelp refs
- Improve message in remove confirm dialog for custom CPU models
- Move "Custom CPU Models" further down in Datacenter menu, and group it
with "{Directory,Resource} Mappings" under "Guest Resources/Hardware"
- Pre-select acceleration type in VM-specific CPU flags edit/creation
window based on the currently configured acceleration of the VM
- Remove hardcoded list of VM-specific flags in frontend
- Change 'Set' to 'Value' in VMCpuFlagSelector
- Use "" instead of `` for user-facing strings
- Add search bar for long lists of CPU flags
- Return all flags from the backend, not only the ones with at least one
node supporting them - allow filtering for that in the UI
- Show svm/vmx in cpu-flags list regardless of overlap with nested-virt
- Add endpoint for querying CPU flags cluster-wide
(`/cluster/qemu/cpu-flags`)
- Document missing supported flags for `aarch64`
- Add CRUD endpoint for custom CPU models
(`/cluster/qemu/custom-cpu-models`)
pve-docs:
- Add qm_cpu_type anchor to CPU Type section in qm.adoc
[0] https://lore.proxmox.com/pve-devel/20211028114150.3245864-1-s.reiter@proxmox.com/
pve-docs:
Arthur Bied-Charreton (1):
qm: Add anchor to "CPU Type" section
qm.adoc | 1 +
1 file changed, 1 insertion(+)
qemu-server:
Arthur Bied-Charreton (7):
cpu config: Rename CPU models config path variable
cpu flags: Create CPUFlags module
cpu flags: Add query_available_cpu_flags helper
cpu config: Add helpers to lock and write config
cpu: Register standard option for CPU format
cpu config: Set 'type' field before writing
cpu flags: Improve flags list returned by endpoint
src/PVE/API2/Qemu/CPUFlags.pm | 27 +++-
src/PVE/QemuServer.pm | 24 +---
src/PVE/QemuServer/CPUConfig.pm | 110 +++------------
src/PVE/QemuServer/CPUFlags.pm | 230 ++++++++++++++++++++++++++++++++
src/PVE/QemuServer/Makefile | 1 +
5 files changed, 280 insertions(+), 112 deletions(-)
create mode 100644 src/PVE/QemuServer/CPUFlags.pm
pve-manager:
Arthur Bied-Charreton (9):
api: Add endpoint querying available CPU flags cluster-wide
api: Add CRUD handlers for custom CPU models
ui: CPUModelSelector: Allow filtering out custom models
ui: Add basic custom CPU model editor
ui: VMCPUFlagSelector: Add CPU flag editor for custom models
ui: VMCPUFlagSelector: Fix buffered rendering error
ui: VMCPUFlagSelector: Allow filtering out flags supported on 0 nodes
ui: VMCPUFlagSelector: Add search bar for large lists of flags
RFC: ui: Group custom CPU with resource mappings
PVE/API2/Cluster.pm | 7 +
PVE/API2/Cluster/Makefile | 4 +-
PVE/API2/Cluster/Qemu.pm | 47 ++++
PVE/API2/Cluster/Qemu/CPUFlags.pm | 68 ++++++
PVE/API2/Cluster/Qemu/CustomCPUModels.pm | 211 ++++++++++++++++
PVE/API2/Cluster/Qemu/Makefile | 18 ++
www/css/ext6-pve.css | 4 +
www/manager6/Makefile | 3 +
www/manager6/dc/CPUTypeEdit.js | 103 ++++++++
www/manager6/dc/CPUTypeView.js | 149 ++++++++++++
www/manager6/dc/Config.js | 27 +++
www/manager6/form/CPUModelSelector.js | 12 +-
www/manager6/form/PhysBitsSelector.js | 153 ++++++++++++
www/manager6/form/VMCPUFlagSelector.js | 297 ++++++++++++++++++++---
www/manager6/qemu/ProcessorEdit.js | 6 +
15 files changed, 1080 insertions(+), 29 deletions(-)
create mode 100644 PVE/API2/Cluster/Qemu.pm
create mode 100644 PVE/API2/Cluster/Qemu/CPUFlags.pm
create mode 100644 PVE/API2/Cluster/Qemu/CustomCPUModels.pm
create mode 100644 PVE/API2/Cluster/Qemu/Makefile
create mode 100644 www/manager6/dc/CPUTypeEdit.js
create mode 100644 www/manager6/dc/CPUTypeView.js
create mode 100644 www/manager6/form/PhysBitsSelector.js
Summary over all repositories:
21 files changed, 1361 insertions(+), 141 deletions(-)
--
Generated by murpp 0.10.0
^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH pve-docs v2 01/17] qm: Add anchor to "CPU Type" section
2026-04-01 8:00 [PATCH docs/manager/qemu-server v2 00/17] Add API and UI for custom CPU models Arthur Bied-Charreton
@ 2026-04-01 8:00 ` Arthur Bied-Charreton
2026-04-01 8:00 ` [PATCH qemu-server v2 02/17] cpu config: Rename CPU models config path variable Arthur Bied-Charreton
` (15 subsequent siblings)
16 siblings, 0 replies; 18+ messages in thread
From: Arthur Bied-Charreton @ 2026-04-01 8:00 UTC (permalink / raw)
To: pve-devel
Allows frontend components to link directly to the "CPU Type" section,
instead of "CPU", which may be too broad for some usecases.
Signed-off-by: Arthur Bied-Charreton <a.bied-charreton@proxmox.com>
---
qm.adoc | 1 +
1 file changed, 1 insertion(+)
diff --git a/qm.adoc b/qm.adoc
index e6b7918..7d7f61b 100644
--- a/qm.adoc
+++ b/qm.adoc
@@ -441,6 +441,7 @@ list can contain numbers but also number ranges. For example, the *affinity*
`0-1,8-11` (expanded `0, 1, 8, 9, 10, 11`) would allow the VM to run on only
these six specific host cores.
+[[qm_cpu_type]]
CPU Type
^^^^^^^^
--
2.47.3
^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH qemu-server v2 02/17] cpu config: Rename CPU models config path variable
2026-04-01 8:00 [PATCH docs/manager/qemu-server v2 00/17] Add API and UI for custom CPU models Arthur Bied-Charreton
2026-04-01 8:00 ` [PATCH pve-docs v2 01/17] qm: Add anchor to "CPU Type" section Arthur Bied-Charreton
@ 2026-04-01 8:00 ` Arthur Bied-Charreton
2026-04-01 8:00 ` [PATCH qemu-server v2 03/17] cpu flags: Create CPUFlags module Arthur Bied-Charreton
` (14 subsequent siblings)
16 siblings, 0 replies; 18+ messages in thread
From: Arthur Bied-Charreton @ 2026-04-01 8:00 UTC (permalink / raw)
To: pve-devel
Change $default_filename to $cpu_models_filename to be more
descriptive of the contents of the file.
Signed-off-by: Arthur Bied-Charreton <a.bied-charreton@proxmox.com>
---
src/PVE/QemuServer/CPUConfig.pm | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/PVE/QemuServer/CPUConfig.pm b/src/PVE/QemuServer/CPUConfig.pm
index fb9af277..7adfdf45 100644
--- a/src/PVE/QemuServer/CPUConfig.pm
+++ b/src/PVE/QemuServer/CPUConfig.pm
@@ -38,15 +38,15 @@ if (PVE::Cluster::check_cfs_is_mounted(1)) {
mkdir "/etc/pve/virtual-guest";
}
-my $default_filename = "virtual-guest/cpu-models.conf";
+my $cpu_models_filename = "virtual-guest/cpu-models.conf";
cfs_register_file(
- $default_filename,
+ $cpu_models_filename,
sub { PVE::QemuServer::CPUConfig->parse_config(@_); },
sub { PVE::QemuServer::CPUConfig->write_config(@_); },
);
sub load_custom_model_conf {
- return cfs_read_file($default_filename);
+ return cfs_read_file($cpu_models_filename);
}
#builtin models : reported-model is mandatory
--
2.47.3
^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH qemu-server v2 03/17] cpu flags: Create CPUFlags module
2026-04-01 8:00 [PATCH docs/manager/qemu-server v2 00/17] Add API and UI for custom CPU models Arthur Bied-Charreton
2026-04-01 8:00 ` [PATCH pve-docs v2 01/17] qm: Add anchor to "CPU Type" section Arthur Bied-Charreton
2026-04-01 8:00 ` [PATCH qemu-server v2 02/17] cpu config: Rename CPU models config path variable Arthur Bied-Charreton
@ 2026-04-01 8:00 ` Arthur Bied-Charreton
2026-04-01 8:00 ` [PATCH qemu-server v2 04/17] cpu flags: Add query_available_cpu_flags helper Arthur Bied-Charreton
` (13 subsequent siblings)
16 siblings, 0 replies; 18+ messages in thread
From: Arthur Bied-Charreton @ 2026-04-01 8:00 UTC (permalink / raw)
To: pve-devel
Introduce PVE::QemuServer::CPUFlags module as the new home for cpu
flags-related helpers, and move various utilities from QemuServer
and CPUConfig into it.
`query_supported_cpu_flags` is not yet moved to the new module, as it is
trickier to migrate without creating circular dependencies.
Signed-off-by: Arthur Bied-Charreton <a.bied-charreton@proxmox.com>
---
src/PVE/QemuServer.pm | 24 +-----
src/PVE/QemuServer/CPUConfig.pm | 89 ++--------------------
src/PVE/QemuServer/CPUFlags.pm | 126 ++++++++++++++++++++++++++++++++
src/PVE/QemuServer/Makefile | 1 +
4 files changed, 136 insertions(+), 104 deletions(-)
create mode 100644 src/PVE/QemuServer/CPUFlags.pm
diff --git a/src/PVE/QemuServer.pm b/src/PVE/QemuServer.pm
index 856dc737..9cea859f 100644
--- a/src/PVE/QemuServer.pm
+++ b/src/PVE/QemuServer.pm
@@ -2917,9 +2917,10 @@ sub vga_conf_has_spice {
return $1 || 1;
}
-# To use query_supported_cpu_flags and query_understood_cpu_flags to get flags
-# to use in a QEMU command line (-cpu element), first array_intersect the result
-# of query_supported_ with query_understood_. This is necessary because:
+# To use query_supported_cpu_flags and query_understood_cpu_flags (moved to the
+# PVE::QemuServer::CPUFlags module) to get flags to use in a QEMU command line
+# (-cpu element), first array_intersect the result of query_supported_ with
+# query_understood_. This is necessary because:
#
# a) query_understood_ returns flags the host cannot use and
# b) query_supported_ (rather the QMP call) doesn't actually return CPU
@@ -3026,23 +3027,6 @@ sub query_supported_cpu_flags {
return $flags;
}
-# Understood CPU flags are written to a file at 'pve-qemu' compile time
-my $understood_cpu_flag_dir = "/usr/share/kvm";
-
-sub query_understood_cpu_flags {
- my $arch = get_host_arch();
- my $filepath = "$understood_cpu_flag_dir/recognized-CPUID-flags-$arch";
-
- die "Cannot query understood QEMU CPU flags for architecture: $arch (file not found)\n"
- if !-e $filepath;
-
- my $raw = file_get_contents($filepath);
- $raw =~ s/^\s+|\s+$//g;
- my @flags = split(/\s+/, $raw);
-
- return \@flags;
-}
-
# Since commit 277d33454f77ec1d1e0bc04e37621e4dd2424b67 in pve-qemu, smm is not off by default
# anymore. But smm=off seems to be required when using SeaBIOS and serial display.
my sub should_disable_smm {
diff --git a/src/PVE/QemuServer/CPUConfig.pm b/src/PVE/QemuServer/CPUConfig.pm
index 7adfdf45..0ee9b991 100644
--- a/src/PVE/QemuServer/CPUConfig.pm
+++ b/src/PVE/QemuServer/CPUConfig.pm
@@ -12,6 +12,7 @@ use PVE::RESTEnvironment qw(log_warn);
use PVE::Tools qw(run_command);
use PVE::QemuServer::Helpers qw(min_version get_host_arch);
+use PVE::QemuServer::CPUFlags qw(cpu_flag_supported_re cpu_flag_any_re supported_cpu_flags_names);
use base qw(PVE::SectionConfig Exporter);
@@ -261,89 +262,9 @@ sub get_all_cpu_models {
return $all_cpu_models;
}
-my $supported_cpu_flags_by_arch = {
- x86_64 => [
- {
- name => 'nested-virt',
- description =>
- "Controls nested virtualization, namely 'svm' for AMD CPUs and 'vmx' for"
- . " Intel CPUs. Live migration still only works if it's the same flag on both sides."
- . " Use a CPU model similar to the host, with the same vendor, not x86-64-vX!",
- },
- {
- name => 'md-clear',
- description => "Required to let the guest OS know if MDS is mitigated correctly.",
- },
- {
- name => 'pcid',
- description =>
- "Meltdown fix cost reduction on Westmere, Sandy-, and IvyBridge Intel CPUs.",
- },
- {
- name => 'spec-ctrl',
- description => "Allows improved Spectre mitigation with Intel CPUs.",
- },
- {
- name => 'ssbd',
- description => "Protection for 'Speculative Store Bypass' for Intel models.",
- },
- {
- name => 'ibpb',
- description => "Allows improved Spectre mitigation with AMD CPUs.",
- },
- {
- name => 'virt-ssbd',
- description => "Basis for 'Speculative Store Bypass' protection for AMD models.",
- },
- {
- name => 'amd-ssbd',
- description =>
- "Improves Spectre mitigation performance with AMD CPUs, best used with"
- . " 'virt-ssbd'.",
- },
- {
- name => 'amd-no-ssb',
- description =>
- "Notifies guest OS that host is not vulnerable for Spectre on AMD CPUs.",
- },
- {
- name => 'pdpe1gb',
- description => "Allow guest OS to use 1GB size pages, if host HW supports it.",
- },
- {
- name => 'hv-tlbflush',
- description =>
- "Improve performance in overcommitted Windows guests. May lead to guest"
- . " bluescreens on old CPUs.",
- },
- {
- name => 'hv-evmcs',
- description =>
- "Improve performance for nested virtualization. Only supported on Intel" . " CPUs.",
- },
- {
- name => 'aes',
- description => "Activate AES instruction set for HW acceleration.",
- },
- ],
- aarch64 => [],
-};
-
-sub get_supported_cpu_flags {
- my ($arch) = @_;
- $arch = get_host_arch() if !defined($arch);
- return $supported_cpu_flags_by_arch->{$arch};
-}
-
-my $all_supported_cpu_flags = {};
-for my $arch ($supported_cpu_flags_by_arch->%*) {
- for my $flag ($supported_cpu_flags_by_arch->{$arch}->@*) {
- $all_supported_cpu_flags->{ $flag->{name} } = 1;
- }
-}
-my @supported_cpu_flags_names = sort keys $all_supported_cpu_flags->%*;
-my $cpu_flag_supported_re = qr/([+-])(@{[join('|', @supported_cpu_flags_names)]})/;
-my $cpu_flag_any_re = qr/([+-])([a-zA-Z0-9\-_\.]+)/;
+my $cpu_flag_supported_re = cpu_flag_supported_re();
+my $cpu_flag_any_re = cpu_flag_any_re();
+my @supported_cpu_flags_names = (supported_cpu_flags_names());
our $qemu_cmdline_cpu_re = qr/^((?>[+-]?[\w\-\._=]+,?)+)$/;
@@ -388,7 +309,7 @@ my $cpu_fmt = {
. " controls nested virtualization for the current CPU ('svm' for AMD and 'vmx' for"
. " Intel). Custom CPU models can specify any flag supported by QEMU/KVM, VM-specific"
. " flags must be from the following set for security reasons: "
- . join(', ', @supported_cpu_flags_names),
+ . join(', ', PVE::QemuServer::CPUFlags::supported_cpu_flags_names()),
format_description => '+FLAG[;-FLAG...]',
type => 'string',
pattern => qr/$cpu_flag_any_re(;$cpu_flag_any_re)*/,
diff --git a/src/PVE/QemuServer/CPUFlags.pm b/src/PVE/QemuServer/CPUFlags.pm
new file mode 100644
index 00000000..51d7753e
--- /dev/null
+++ b/src/PVE/QemuServer/CPUFlags.pm
@@ -0,0 +1,126 @@
+package PVE::QemuServer::CPUFlags;
+
+use v5.36;
+
+use Exporter qw(import);
+
+use PVE::Cluster;
+use PVE::Tools;
+use PVE::QemuServer::Helpers qw(get_host_arch);
+
+our @EXPORT_OK = qw(
+ cpu_flag_supported_re
+ cpu_flag_any_re
+ supported_cpu_flags_names
+ get_supported_cpu_flags
+ query_understood_cpu_flags
+);
+
+my $supported_vm_specific_cpu_flags_by_arch = {
+ x86_64 => [
+ {
+ name => 'nested-virt',
+ description =>
+ "Controls nested virtualization, namely 'svm' for AMD CPUs and 'vmx' for"
+ . " Intel CPUs. Live migration still only works if it's the same flag on both sides."
+ . " Use a CPU model similar to the host, with the same vendor, not x86-64-vX!",
+ },
+ {
+ name => 'md-clear',
+ description => "Required to let the guest OS know if MDS is mitigated correctly.",
+ },
+ {
+ name => 'pcid',
+ description =>
+ "Meltdown fix cost reduction on Westmere, Sandy-, and IvyBridge Intel CPUs.",
+ },
+ {
+ name => 'spec-ctrl',
+ description => "Allows improved Spectre mitigation with Intel CPUs.",
+ },
+ {
+ name => 'ssbd',
+ description => "Protection for 'Speculative Store Bypass' for Intel models.",
+ },
+ {
+ name => 'ibpb',
+ description => "Allows improved Spectre mitigation with AMD CPUs.",
+ },
+ {
+ name => 'virt-ssbd',
+ description => "Basis for 'Speculative Store Bypass' protection for AMD models.",
+ },
+ {
+ name => 'amd-ssbd',
+ description =>
+ "Improves Spectre mitigation performance with AMD CPUs, best used with"
+ . " 'virt-ssbd'.",
+ },
+ {
+ name => 'amd-no-ssb',
+ description =>
+ "Notifies guest OS that host is not vulnerable for Spectre on AMD CPUs.",
+ },
+ {
+ name => 'pdpe1gb',
+ description => "Allow guest OS to use 1GB size pages, if host HW supports it.",
+ },
+ {
+ name => 'hv-tlbflush',
+ description =>
+ "Improve performance in overcommitted Windows guests. May lead to guest"
+ . " bluescreens on old CPUs.",
+ },
+ {
+ name => 'hv-evmcs',
+ description =>
+ "Improve performance for nested virtualization. Only supported on Intel" . " CPUs.",
+ },
+ {
+ name => 'aes',
+ description => "Activate AES instruction set for HW acceleration.",
+ },
+ ],
+ aarch64 => [],
+};
+
+my $all_supported_vm_specific_cpu_flags = {};
+for my $arch ($supported_vm_specific_cpu_flags_by_arch->%*) {
+ for my $flag ($supported_vm_specific_cpu_flags_by_arch->{$arch}->@*) {
+ $all_supported_vm_specific_cpu_flags->{ $flag->{name} } = 1;
+ }
+}
+
+# Understood CPU flags are written to a file at 'pve-qemu' compile time
+my $understood_cpu_flag_dir = "/usr/share/kvm";
+
+sub supported_cpu_flags_names() {
+ return sort keys $all_supported_vm_specific_cpu_flags->%*;
+}
+
+sub cpu_flag_supported_re() {
+ return qr/([+-])(@{[join('|', supported_cpu_flags_names())]})/;
+}
+
+sub cpu_flag_any_re() {
+ return qr/([+-])([a-zA-Z0-9\-_\.]+)/;
+}
+
+# Return supported VM-specific CPU flags.
+sub get_supported_cpu_flags($arch) {
+ return $supported_vm_specific_cpu_flags_by_arch->{$arch};
+}
+
+sub query_understood_cpu_flags($arch) {
+ my $filepath = "$understood_cpu_flag_dir/recognized-CPUID-flags-$arch";
+
+ die "Cannot query understood QEMU CPU flags for architecture: $arch (file not found)\n"
+ if !-e $filepath;
+
+ my $raw = PVE::Tools::file_get_contents($filepath);
+ $raw =~ s/^\s+|\s+$//g;
+ my @flags = split(/\s+/, $raw);
+
+ return \@flags;
+}
+1;
diff --git a/src/PVE/QemuServer/Makefile b/src/PVE/QemuServer/Makefile
index 7e48c388..c26bdec4 100644
--- a/src/PVE/QemuServer/Makefile
+++ b/src/PVE/QemuServer/Makefile
@@ -9,6 +9,7 @@ SOURCES=Agent.pm \
CGroup.pm \
Cloudinit.pm \
CPUConfig.pm \
+ CPUFlags.pm \
DBusVMState.pm \
Drive.pm \
DriveDevice.pm \
--
2.47.3
^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH qemu-server v2 04/17] cpu flags: Add query_available_cpu_flags helper
2026-04-01 8:00 [PATCH docs/manager/qemu-server v2 00/17] Add API and UI for custom CPU models Arthur Bied-Charreton
` (2 preceding siblings ...)
2026-04-01 8:00 ` [PATCH qemu-server v2 03/17] cpu flags: Create CPUFlags module Arthur Bied-Charreton
@ 2026-04-01 8:00 ` Arthur Bied-Charreton
2026-04-01 8:00 ` [PATCH qemu-server v2 05/17] cpu config: Add helpers to lock and write config Arthur Bied-Charreton
` (12 subsequent siblings)
16 siblings, 0 replies; 18+ messages in thread
From: Arthur Bied-Charreton @ 2026-04-01 8:00 UTC (permalink / raw)
To: pve-devel
The get_supported_cpu_flags helper returns a hardcoded list of
VM-specific flags, without any information on which nodes actually
support them.
Add query_available_cpu_flags, which annotates the flags QEMU recognizes
as `-cpu` arguments with the nodes that actually support them to give an
accurate picture of which flags will be accepted when starting a VM. Flags
can be filtered by scope (vm-specific or all) and queried for the
specific accleration type (kvm/tcg), which determines which nodes report
supporting which flag.
This currently returns early when $arch is set to `aarch64`. This is
intended for vm-specific flags, since there are none that are currently
meant to be settable for VMs. For the general flags list, this is a
limitation due to the fact that it is a lot harder to get a list of
understood flags at QEMU build time for `aarch64`, as opposed to
`86_64`, where `-cpu help` will just list all of them. It is left for a
future TODO.
Signed-off-by: Arthur Bied-Charreton <a.bied-charreton@proxmox.com>
---
src/PVE/QemuServer/CPUFlags.pm | 104 +++++++++++++++++++++++++++++++++
1 file changed, 104 insertions(+)
diff --git a/src/PVE/QemuServer/CPUFlags.pm b/src/PVE/QemuServer/CPUFlags.pm
index 51d7753e..0bf560b4 100644
--- a/src/PVE/QemuServer/CPUFlags.pm
+++ b/src/PVE/QemuServer/CPUFlags.pm
@@ -14,6 +14,7 @@ our @EXPORT_OK = qw(
supported_cpu_flags_names
get_supported_cpu_flags
query_understood_cpu_flags
+ query_available_cpu_flags
);
my $supported_vm_specific_cpu_flags_by_arch = {
@@ -98,6 +99,10 @@ sub supported_cpu_flags_names() {
return sort keys $all_supported_vm_specific_cpu_flags->%*;
}
+sub supported_cpu_flags_names_by_arch($arch) {
+ return sort map { $_->{name} } $supported_vm_specific_cpu_flags_by_arch->{$arch}->@*;
+}
+
sub cpu_flag_supported_re() {
return qr/([+-])(@{[join('|', supported_cpu_flags_names())]})/;
}
@@ -123,4 +128,103 @@ sub query_understood_cpu_flags($arch) {
return \@flags;
}
+
+# Return true if `$flag` may be set for a single VM.
+sub flag_is_vm_specific($flag) {
+ return defined($all_supported_vm_specific_cpu_flags->{$flag});
+}
+
+# Flag is represented by the `nested-virt` alias
+sub flag_is_aliased($flag) {
+ return $flag eq 'vmx' || $flag eq 'svm';
+}
+
+sub description_by_flag($arch) {
+ return { map { $_->{name} => $_->{description} }
+ $supported_vm_specific_cpu_flags_by_arch->{$arch}->@* };
+}
+
+# Retrieve a list of available flags, i.e., flags that will be accepted as `-cpu` arguments by QEMU
+# when attempting to spawn a VM. Each flag is returned along with a list of nodes that support it.
+# Flags that are not supported on any node are also returned, filtering them out is up to the consumer
+# of this API.
+#
+# The $accel parameter (`kvm`|`tcg`) selects which acceleration type flag <> node compatibility should
+# be evaluated.
+#
+# The $vm_specific boolean parameter allows filtering by flag scope. When set to 1, return only
+# vm-specific flags, otherwise return all flags.
+#
+# The $arch parameter (`x86_64`|`aarch64`) specifies which architecture to query flags for. Note that
+# in both scopes (`vm-specific`,`all`), `aarch64` returns empty lists: this is wanted for `vm-specific`,
+# as no `aarch64` flags are currently intended to be settable for a specific VM, however this is a
+# known limitation for `all`. PVE does not currently ship a list of understood flags for `aarch64`,
+# it is not as trivial to get as for `x86_64`, whose flags are easy to parse out of QEMU's `-cpu help`
+# output.
+#
+# In order to get an accurate picture of which flags can actually be used, we combine two sources (see
+# PVE::QemuServer::query_supported_cpu_flags for details):
+#
+# 1. The understood CPU flags, i.e., all flags QEMU accepts as `-cpu` arguments in principle, regardless
+# whether the host CPU actually supports them.
+# 2. The supported CPU flags: the flags the host CPU actually supports, cached in the node KV store by
+# `pvestatd`. This is node-specific.
+#
+# Each flag from 1. is annotated with the subset of nodes from 2. that report supporting it.
+sub query_available_cpu_flags($accel, $vm_specific, $arch) {
+ # TODO: Find out a way to get supported flags for aarch64. This is not done because PVE
+ # does not currently ship a list of understood flags for aarch64, as it's more difficult
+ # to obtain during QEMU build - for x86_64, qemu -cpu help will just list the flags.
+ return [] if $arch eq 'aarch64';
+
+ my $descriptions = description_by_flag($arch);
+ my $base =
+ !$vm_specific
+ ? query_understood_cpu_flags($arch)
+ : [supported_cpu_flags_names_by_arch($arch)];
+ my $available_flags = {
+ map {
+ $_ => { name => $_, 'supported-on' => {}, description => $descriptions->{$_} }
+ } @$base
+ };
+
+ my $kv_store = $accel eq 'kvm' ? 'cpuflags-kvm' : 'cpuflags-tcg';
+ my $flags = PVE::Cluster::get_node_kv($kv_store);
+
+ $available_flags->{'nested-virt'} = {
+ name => 'nested-virt',
+ 'supported-on' => {},
+ description => $descriptions->{'nested-virt'},
+ };
+
+ my $add_flag = sub($node, $name) {
+ return if !defined($available_flags->{$name});
+ $available_flags->{$name}->{'supported-on'}->{$node} = 1;
+ };
+
+ for my $node (keys %$flags) {
+ # This depends on `pvestatd` storing the flags in space-separated format, which is the case
+ # at the time of this commit.
+ for (split(' ', $flags->{$node})) {
+ my $aliased = flag_is_aliased($_);
+ next if $vm_specific && !flag_is_vm_specific($_) && !$aliased;
+ $add_flag->($node, $_) if !($vm_specific && $aliased);
+ $add_flag->($node, 'nested-virt') if $aliased;
+ }
+ }
+
+ for my $flag (values %$available_flags) {
+ $flag->{'supported-on'} = [sort keys %{ $flag->{'supported-on'} }];
+ }
+
+ # Make sure 'nested-virt' is always shown first.
+ my $nested_virt = delete $available_flags->{'nested-virt'};
+ my @sorted = sort {
+ (scalar(@{ $a->{'supported-on'} }) == 0) <=> (scalar(@{ $b->{'supported-on'} }) == 0)
+ || $a->{name} cmp $b->{name}
+ } values %$available_flags;
+
+ return [defined($nested_virt) ? ($nested_virt, @sorted) : @sorted];
+}
+
1;
--
2.47.3
^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH qemu-server v2 05/17] cpu config: Add helpers to lock and write config
2026-04-01 8:00 [PATCH docs/manager/qemu-server v2 00/17] Add API and UI for custom CPU models Arthur Bied-Charreton
` (3 preceding siblings ...)
2026-04-01 8:00 ` [PATCH qemu-server v2 04/17] cpu flags: Add query_available_cpu_flags helper Arthur Bied-Charreton
@ 2026-04-01 8:00 ` Arthur Bied-Charreton
2026-04-01 8:00 ` [PATCH qemu-server v2 06/17] cpu: Register standard option for CPU format Arthur Bied-Charreton
` (11 subsequent siblings)
16 siblings, 0 replies; 18+ messages in thread
From: Arthur Bied-Charreton @ 2026-04-01 8:00 UTC (permalink / raw)
To: pve-devel
Add lock/write primitives to allow programmatic access to
/etc/pve/virtual-guest/cpu-models.conf as a preparatory step for adding a
custom CPU models CRUD API to pve-manager.
Signed-off-by: Arthur Bied-Charreton <a.bied-charreton@proxmox.com>
---
src/PVE/QemuServer/CPUConfig.pm | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/src/PVE/QemuServer/CPUConfig.pm b/src/PVE/QemuServer/CPUConfig.pm
index 0ee9b991..65ced94f 100644
--- a/src/PVE/QemuServer/CPUConfig.pm
+++ b/src/PVE/QemuServer/CPUConfig.pm
@@ -6,7 +6,7 @@ use warnings;
use JSON;
use PVE::JSONSchema qw(json_bool);
-use PVE::Cluster qw(cfs_register_file cfs_read_file);
+use PVE::Cluster qw(cfs_register_file cfs_read_file cfs_lock_file cfs_write_file);
use PVE::ProcFSTools;
use PVE::RESTEnvironment qw(log_warn);
use PVE::Tools qw(run_command);
@@ -50,6 +50,17 @@ sub load_custom_model_conf {
return cfs_read_file($cpu_models_filename);
}
+sub write_custom_model_conf {
+ my ($conf) = @_;
+ cfs_write_file($cpu_models_filename, $conf);
+}
+
+sub lock_cpu_config {
+ my ($code) = @_;
+ cfs_lock_file($cpu_models_filename, undef, $code);
+ die $@ if $@;
+}
+
#builtin models : reported-model is mandatory
my $builtin_models_by_arch = {
x86_64 => {
--
2.47.3
^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH qemu-server v2 06/17] cpu: Register standard option for CPU format
2026-04-01 8:00 [PATCH docs/manager/qemu-server v2 00/17] Add API and UI for custom CPU models Arthur Bied-Charreton
` (4 preceding siblings ...)
2026-04-01 8:00 ` [PATCH qemu-server v2 05/17] cpu config: Add helpers to lock and write config Arthur Bied-Charreton
@ 2026-04-01 8:00 ` Arthur Bied-Charreton
2026-04-01 8:00 ` [PATCH qemu-server v2 07/17] cpu config: Set 'type' field before writing Arthur Bied-Charreton
` (10 subsequent siblings)
16 siblings, 0 replies; 18+ messages in thread
From: Arthur Bied-Charreton @ 2026-04-01 8:00 UTC (permalink / raw)
To: pve-devel
Expose $cpu_fmt as a standard option to allow using it in endpoint
definitions.
Signed-off-by: Arthur Bied-Charreton <a.bied-charreton@proxmox.com>
---
src/PVE/QemuServer/CPUConfig.pm | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/PVE/QemuServer/CPUConfig.pm b/src/PVE/QemuServer/CPUConfig.pm
index 65ced94f..78603acc 100644
--- a/src/PVE/QemuServer/CPUConfig.pm
+++ b/src/PVE/QemuServer/CPUConfig.pm
@@ -344,6 +344,7 @@ my $cpu_fmt = {
optional => 1,
},
};
+PVE::JSONSchema::register_standard_option('pve-qemu-cpu', $cpu_fmt);
my $sev_fmt = {
type => {
--
2.47.3
^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH qemu-server v2 07/17] cpu config: Set 'type' field before writing
2026-04-01 8:00 [PATCH docs/manager/qemu-server v2 00/17] Add API and UI for custom CPU models Arthur Bied-Charreton
` (5 preceding siblings ...)
2026-04-01 8:00 ` [PATCH qemu-server v2 06/17] cpu: Register standard option for CPU format Arthur Bied-Charreton
@ 2026-04-01 8:00 ` Arthur Bied-Charreton
2026-04-01 8:00 ` [PATCH qemu-server v2 08/17] cpu flags: Improve flags list returned by endpoint Arthur Bied-Charreton
` (9 subsequent siblings)
16 siblings, 0 replies; 18+ messages in thread
From: Arthur Bied-Charreton @ 2026-04-01 8:00 UTC (permalink / raw)
To: pve-devel
Fix write_config by adding 'type' to every section, otherwise SectionConfig
fails, because it requires each entry in $cfg->{ids} to have a 'type'
key.
Signed-off-by: Arthur Bied-Charreton <a.bied-charreton@proxmox.com>
---
src/PVE/QemuServer/CPUConfig.pm | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/PVE/QemuServer/CPUConfig.pm b/src/PVE/QemuServer/CPUConfig.pm
index 78603acc..b606aaa5 100644
--- a/src/PVE/QemuServer/CPUConfig.pm
+++ b/src/PVE/QemuServer/CPUConfig.pm
@@ -537,6 +537,7 @@ sub write_config {
# saved in section header
delete $model_conf->{cputype};
+ $model_conf->{type} = $class->type();
}
$class->SUPER::write_config($filename, $cfg);
--
2.47.3
^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH qemu-server v2 08/17] cpu flags: Improve flags list returned by endpoint
2026-04-01 8:00 [PATCH docs/manager/qemu-server v2 00/17] Add API and UI for custom CPU models Arthur Bied-Charreton
` (6 preceding siblings ...)
2026-04-01 8:00 ` [PATCH qemu-server v2 07/17] cpu config: Set 'type' field before writing Arthur Bied-Charreton
@ 2026-04-01 8:00 ` Arthur Bied-Charreton
2026-04-01 8:00 ` [PATCH pve-manager v2 09/17] api: Add endpoint querying available CPU flags cluster-wide Arthur Bied-Charreton
` (8 subsequent siblings)
16 siblings, 0 replies; 18+ messages in thread
From: Arthur Bied-Charreton @ 2026-04-01 8:00 UTC (permalink / raw)
To: pve-devel
Enhance the cpu-flags endpoint's list of flags by using the new
query_available_cpu_flags utility, which for each flag, additionally
returns a list of nodes supporting it, e.g.:
```
name: 'aes',
'supported-on': ['node1', 'node2'],
description: '...',
```
An `accel` parameter selects the acceleration type, `kvm` (default) or
`tcg` for which flag to node compatibility is evaluated.
Signed-off-by: Arthur Bied-Charreton <a.bied-charreton@proxmox.com>
---
src/PVE/API2/Qemu/CPUFlags.pm | 27 +++++++++++++++++++++++----
1 file changed, 23 insertions(+), 4 deletions(-)
diff --git a/src/PVE/API2/Qemu/CPUFlags.pm b/src/PVE/API2/Qemu/CPUFlags.pm
index 672bd2d2..122f0ed9 100644
--- a/src/PVE/API2/Qemu/CPUFlags.pm
+++ b/src/PVE/API2/Qemu/CPUFlags.pm
@@ -6,7 +6,8 @@ use PVE::JSONSchema qw(get_standard_option);
use PVE::RESTHandler;
use PVE::Tools qw(extract_param);
-use PVE::QemuServer::CPUConfig;
+use PVE::QemuServer::Helpers;
+use PVE::QemuServer::CPUFlags;
use base qw(PVE::RESTHandler);
@@ -14,13 +15,22 @@ __PACKAGE__->register_method({
name => 'index',
path => '',
method => 'GET',
- description => 'List of available VM-specific CPU flags.',
+ description =>
+ "List of available VM-specific CPU flags. Returns an empty list for 'aarch64' "
+ . "as no VM-specific flags are defined for it yet.",
permissions => { user => 'all' },
parameters => {
additionalProperties => 0,
properties => {
node => get_standard_option('pve-node'),
arch => get_standard_option('pve-qm-cpu-arch', { optional => 1 }),
+ accel => {
+ description => 'Acceleration type to check node compatibility for.',
+ type => 'string',
+ enum => [qw(kvm tcg)],
+ optional => 1,
+ default => 'kvm',
+ },
},
},
returns => {
@@ -35,6 +45,14 @@ __PACKAGE__->register_method({
description => {
type => 'string',
description => "Description of the CPU flag.",
+ optional => 1,
+ },
+ 'supported-on' => {
+ description =>
+ 'List of nodes supporting the CPU flag with the selected acceleration type ("accel").',
+ type => 'array',
+ items => get_standard_option('pve-node'),
+ optional => 1,
},
},
},
@@ -42,9 +60,10 @@ __PACKAGE__->register_method({
code => sub {
my ($param) = @_;
- my $arch = extract_param($param, 'arch');
+ my $arch = extract_param($param, 'arch') // PVE::QemuServer::Helpers::get_host_arch();
+ my $accel = extract_param($param, 'accel') // 'kvm';
- return PVE::QemuServer::CPUConfig::get_supported_cpu_flags($arch);
+ return PVE::QemuServer::CPUFlags::query_available_cpu_flags($accel, 1, $arch);
},
});
--
2.47.3
^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH pve-manager v2 09/17] api: Add endpoint querying available CPU flags cluster-wide
2026-04-01 8:00 [PATCH docs/manager/qemu-server v2 00/17] Add API and UI for custom CPU models Arthur Bied-Charreton
` (7 preceding siblings ...)
2026-04-01 8:00 ` [PATCH qemu-server v2 08/17] cpu flags: Improve flags list returned by endpoint Arthur Bied-Charreton
@ 2026-04-01 8:00 ` Arthur Bied-Charreton
2026-04-01 8:00 ` [PATCH pve-manager v2 10/17] api: Add CRUD handlers for custom CPU models Arthur Bied-Charreton
` (7 subsequent siblings)
16 siblings, 0 replies; 18+ messages in thread
From: Arthur Bied-Charreton @ 2026-04-01 8:00 UTC (permalink / raw)
To: pve-devel
Add endpoint at `/cluster/qemu/cpu-flags` allowing to query the CPU
flags available on the whole cluster, filtered by acceleration type
(kvm/tcg).
For each flag, a list of nodes supporting it is returned. This gives an
accurate picture of which flags will actually be accepted by QEMU when
starting a VM.
Currently only return available flags for x86_64, see documentation of
query_available_cpu_flags.
Signed-off-by: Arthur Bied-Charreton <a.bied-charreton@proxmox.com>
---
PVE/API2/Cluster.pm | 7 ++++
PVE/API2/Cluster/Makefile | 4 +-
PVE/API2/Cluster/Qemu.pm | 41 +++++++++++++++++++
PVE/API2/Cluster/Qemu/CPUFlags.pm | 68 +++++++++++++++++++++++++++++++
PVE/API2/Cluster/Qemu/Makefile | 17 ++++++++
5 files changed, 136 insertions(+), 1 deletion(-)
create mode 100644 PVE/API2/Cluster/Qemu.pm
create mode 100644 PVE/API2/Cluster/Qemu/CPUFlags.pm
create mode 100644 PVE/API2/Cluster/Qemu/Makefile
diff --git a/PVE/API2/Cluster.pm b/PVE/API2/Cluster.pm
index cc8279ca..4e641a2d 100644
--- a/PVE/API2/Cluster.pm
+++ b/PVE/API2/Cluster.pm
@@ -27,6 +27,7 @@ use PVE::API2::Backup;
use PVE::API2::Cluster::BackupInfo;
use PVE::API2::Cluster::BulkAction;
use PVE::API2::Cluster::Ceph;
+use PVE::API2::Cluster::Qemu;
use PVE::API2::Cluster::Mapping;
use PVE::API2::Cluster::Jobs;
use PVE::API2::Cluster::MetricServer;
@@ -59,6 +60,11 @@ __PACKAGE__->register_method({
path => 'notifications',
});
+__PACKAGE__->register_method({
+ subclass => "PVE::API2::Cluster::Qemu",
+ path => 'qemu',
+});
+
__PACKAGE__->register_method({
subclass => "PVE::API2::ClusterConfig",
path => 'config',
@@ -157,6 +163,7 @@ __PACKAGE__->register_method({
{ name => 'bulk-action' },
{ name => 'ceph' },
{ name => 'config' },
+ { name => 'qemu' },
{ name => 'firewall' },
{ name => 'ha' },
{ name => 'jobs' },
diff --git a/PVE/API2/Cluster/Makefile b/PVE/API2/Cluster/Makefile
index 6cffe4c9..fd33e31d 100644
--- a/PVE/API2/Cluster/Makefile
+++ b/PVE/API2/Cluster/Makefile
@@ -1,13 +1,15 @@
include ../../../defines.mk
SUBDIRS=Mapping \
- BulkAction
+ BulkAction \
+ Qemu
# for node independent, cluster-wide applicable, API endpoints
# ensure we do not conflict with files shipped by pve-cluster!!
PERLSOURCE= \
BackupInfo.pm \
BulkAction.pm \
+ Qemu.pm \
MetricServer.pm \
Mapping.pm \
Notifications.pm \
diff --git a/PVE/API2/Cluster/Qemu.pm b/PVE/API2/Cluster/Qemu.pm
new file mode 100644
index 00000000..ed37fd20
--- /dev/null
+++ b/PVE/API2/Cluster/Qemu.pm
@@ -0,0 +1,41 @@
+package PVE::API2::Cluster::Qemu;
+
+use v5.36;
+
+use PVE::API2::Cluster::Qemu::CPUFlags;
+
+use base qw(PVE::RESTHandler);
+
+__PACKAGE__->register_method({
+ subclass => "PVE::API2::Cluster::Qemu::CPUFlags",
+ path => "cpu-flags",
+});
+
+__PACKAGE__->register_method({
+ name => 'index',
+ path => '',
+ method => 'GET',
+ description => "Cluster index.",
+ permissions => { user => 'all' },
+ parameters => {
+ additionalProperties => 0,
+ properties => {},
+ },
+ returns => {
+ type => 'array',
+ items => {
+ type => "object",
+ properties => {},
+ },
+ links => [{ rel => 'child', href => "{name}" }],
+ },
+ code => sub {
+ my ($param) = @_;
+
+ return [
+ { name => 'cpu-flags' },
+ ];
+ },
+});
+
+1;
diff --git a/PVE/API2/Cluster/Qemu/CPUFlags.pm b/PVE/API2/Cluster/Qemu/CPUFlags.pm
new file mode 100644
index 00000000..a3328e85
--- /dev/null
+++ b/PVE/API2/Cluster/Qemu/CPUFlags.pm
@@ -0,0 +1,68 @@
+package PVE::API2::Cluster::Qemu::CPUFlags;
+
+use v5.36;
+
+use PVE::JSONSchema qw(get_standard_option);
+use PVE::RESTHandler;
+use PVE::Tools qw(extract_param);
+
+use PVE::QemuServer::Helpers;
+use PVE::QemuServer::CPUFlags;
+
+use base qw(PVE::RESTHandler);
+
+__PACKAGE__->register_method({
+ name => 'index',
+ path => '',
+ method => 'GET',
+ description => "List of available CPU flags. Returns an empty list for 'aarch64', "
+ . "PVE does not currently ship a flags list for it.",
+ permissions => { user => 'all' },
+ parameters => {
+ additionalProperties => 0,
+ properties => {
+ arch => get_standard_option('pve-qm-cpu-arch', { optional => 1 }),
+ accel => {
+ description => 'Acceleration type to check node compatibility for.',
+ type => 'string',
+ enum => [qw(kvm tcg)],
+ optional => 1,
+ default => 'kvm',
+ },
+ },
+ },
+ returns => {
+ type => 'array',
+ items => {
+ type => 'object',
+ properties => {
+ name => {
+ type => 'string',
+ description => "Name of the CPU flag.",
+ },
+ description => {
+ type => 'string',
+ description => "Description of the CPU flag.",
+ optional => 1,
+ },
+ 'supported-on' => {
+ description =>
+ 'List of nodes supporting the flag with the selected acceleration type ("accel").',
+ type => 'array',
+ items => get_standard_option('pve-node'),
+ optional => 1,
+ },
+ },
+ },
+ },
+ code => sub {
+ my ($param) = @_;
+
+ my $arch = extract_param($param, 'arch') // PVE::QemuServer::Helpers::get_host_arch();
+ my $accel = extract_param($param, 'accel') // 'kvm';
+
+ return PVE::QemuServer::CPUFlags::query_available_cpu_flags($accel, 0, $arch);
+ },
+});
+
+1;
diff --git a/PVE/API2/Cluster/Qemu/Makefile b/PVE/API2/Cluster/Qemu/Makefile
new file mode 100644
index 00000000..2ab3e0b1
--- /dev/null
+++ b/PVE/API2/Cluster/Qemu/Makefile
@@ -0,0 +1,17 @@
+include ../../../../defines.mk
+
+# for node independent, cluster-wide applicable, API endpoints
+# ensure we do not conflict with files shipped by pve-cluster!!
+PERLSOURCE= \
+ CPUFlags.pm
+
+all:
+
+.PHONY: clean
+clean:
+ rm -rf *~
+
+.PHONY: install
+install: ${PERLSOURCE}
+ install -d ${PERLLIBDIR}/PVE/API2/Cluster/Qemu
+ install -m 0644 ${PERLSOURCE} ${PERLLIBDIR}/PVE/API2/Cluster/Qemu
--
2.47.3
^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH pve-manager v2 10/17] api: Add CRUD handlers for custom CPU models
2026-04-01 8:00 [PATCH docs/manager/qemu-server v2 00/17] Add API and UI for custom CPU models Arthur Bied-Charreton
` (8 preceding siblings ...)
2026-04-01 8:00 ` [PATCH pve-manager v2 09/17] api: Add endpoint querying available CPU flags cluster-wide Arthur Bied-Charreton
@ 2026-04-01 8:00 ` Arthur Bied-Charreton
2026-04-01 8:00 ` [PATCH pve-manager v2 11/17] ui: CPUModelSelector: Allow filtering out custom models Arthur Bied-Charreton
` (6 subsequent siblings)
16 siblings, 0 replies; 18+ messages in thread
From: Arthur Bied-Charreton @ 2026-04-01 8:00 UTC (permalink / raw)
To: pve-devel
Add CRUD endpoints for custom CPU models, allowing to interact with
/etc/pve/virtual-guest/cpu-models.conf [0] programmatically.
The `custom-` prefix is not required from the consumers for the
`cputype` parameter, rather the handlers normalize it such that `foo`
evaluates to the same custom model as `custom-foo`.
[0] https://pve.proxmox.com/wiki/Manual:_cpu-models.conf
Based on & adapted from the following patches by Stefan Reiter:
https://lore.proxmox.com/pve-devel/20211028114150.3245864-4-s.reiter@proxmox.com/
https://lore.proxmox.com/pve-devel/20211028114150.3245864-5-s.reiter@proxmox.com/
Signed-off-by: Arthur Bied-Charreton <a.bied-charreton@proxmox.com>
---
PVE/API2/Cluster/Qemu.pm | 8 +-
PVE/API2/Cluster/Qemu/CustomCPUModels.pm | 211 +++++++++++++++++++++++
PVE/API2/Cluster/Qemu/Makefile | 5 +-
3 files changed, 221 insertions(+), 3 deletions(-)
create mode 100644 PVE/API2/Cluster/Qemu/CustomCPUModels.pm
diff --git a/PVE/API2/Cluster/Qemu.pm b/PVE/API2/Cluster/Qemu.pm
index ed37fd20..5acef731 100644
--- a/PVE/API2/Cluster/Qemu.pm
+++ b/PVE/API2/Cluster/Qemu.pm
@@ -3,6 +3,7 @@ package PVE::API2::Cluster::Qemu;
use v5.36;
use PVE::API2::Cluster::Qemu::CPUFlags;
+use PVE::API2::Cluster::Qemu::CustomCPUModels;
use base qw(PVE::RESTHandler);
@@ -11,6 +12,11 @@ __PACKAGE__->register_method({
path => "cpu-flags",
});
+__PACKAGE__->register_method({
+ subclass => "PVE::API2::Cluster::Qemu::CustomCPUModels",
+ path => "custom-cpu-models",
+});
+
__PACKAGE__->register_method({
name => 'index',
path => '',
@@ -33,7 +39,7 @@ __PACKAGE__->register_method({
my ($param) = @_;
return [
- { name => 'cpu-flags' },
+ { name => 'cpu-flags' }, { name => 'custom-cpu-models' },
];
},
});
diff --git a/PVE/API2/Cluster/Qemu/CustomCPUModels.pm b/PVE/API2/Cluster/Qemu/CustomCPUModels.pm
new file mode 100644
index 00000000..8c2bd724
--- /dev/null
+++ b/PVE/API2/Cluster/Qemu/CustomCPUModels.pm
@@ -0,0 +1,211 @@
+package PVE::API2::Cluster::Qemu::CustomCPUModels;
+
+use v5.36;
+
+use PVE::JSONSchema qw(get_standard_option);
+use PVE::RPCEnvironment;
+use PVE::RESTHandler;
+use PVE::Tools qw(extract_param);
+
+use PVE::QemuServer::CPUConfig;
+
+use base qw(PVE::RESTHandler);
+
+__PACKAGE__->register_method({
+ name => 'config',
+ path => '',
+ method => 'GET',
+ description => 'Read all custom CPU models definitions',
+ permissions => {
+ check => ['perm', '/nodes', ['Sys.Audit']],
+ },
+ parameters => {
+ additionalProperties => 0,
+ },
+ returns => {
+ type => 'array',
+ items => {
+ type => 'object',
+ properties => get_standard_option('pve-qemu-cpu'),
+ },
+ },
+ code => sub {
+ my $conf = PVE::QemuServer::CPUConfig::load_custom_model_conf();
+ delete $conf->{order};
+ my $ids = [];
+ foreach my $id (keys %{ $conf->{ids} }) {
+ delete $conf->{ids}->{$id}->{type};
+ push @$ids, $conf->{ids}->{$id};
+ }
+ return $ids;
+ },
+});
+
+__PACKAGE__->register_method({
+ name => 'create',
+ path => '',
+ method => 'POST',
+ protected => 1,
+ description => 'Add a custom CPU model definition',
+ permissions => {
+ check => ['perm', '/nodes', ['Sys.Console']],
+ },
+ parameters => {
+ additionalProperties => 0,
+ properties => PVE::QemuServer::CPUConfig::add_cpu_json_properties({
+ digest => get_standard_option('pve-config-digest'),
+ }),
+ },
+ returns => { type => 'null' },
+ code => sub {
+ my ($param) = @_;
+
+ my $digest = extract_param($param, 'digest');
+
+ (my $name = $param->{cputype}) =~ s/^custom-//;
+ $param->{cputype} = "custom-$name";
+
+ PVE::QemuServer::CPUConfig::lock_cpu_config(sub {
+ my $conf = PVE::QemuServer::CPUConfig::load_custom_model_conf();
+ PVE::SectionConfig::assert_if_modified($conf, $digest);
+
+ die "custom CPU model '$name' already exists\n"
+ if defined($conf->{ids}->{$name});
+ $conf->{ids}->{$name} = $param;
+
+ PVE::QemuServer::CPUConfig::write_custom_model_conf($conf);
+ });
+ },
+});
+
+__PACKAGE__->register_method({
+ name => 'delete',
+ path => '{cputype}',
+ method => 'DELETE',
+ protected => 1,
+ description => 'Delete a custom CPU model definition',
+ permissions => {
+ check => ['perm', '/nodes', ['Sys.Console']],
+ },
+ parameters => {
+ additionalProperties => 0,
+ properties => {
+ digest => get_standard_option('pve-config-digest'),
+ cputype => {
+ type => 'string',
+ description => "The custom model to delete.",
+ },
+ },
+ },
+ returns => { type => 'null' },
+ code => sub {
+ my ($param) = @_;
+
+ my $digest = extract_param($param, 'digest');
+
+ (my $name = $param->{cputype}) =~ s/^custom-//;
+
+ PVE::QemuServer::CPUConfig::lock_cpu_config(sub {
+ my $conf = PVE::QemuServer::CPUConfig::load_custom_model_conf();
+ PVE::SectionConfig::assert_if_modified($conf, $digest);
+
+ die "custom CPU model '$name' does not exist\n"
+ if !defined($conf->{ids}->{$name});
+ delete $conf->{ids}->{$name};
+
+ PVE::QemuServer::CPUConfig::write_custom_model_conf($conf);
+ });
+ },
+});
+
+__PACKAGE__->register_method({
+ name => 'update',
+ path => '{cputype}',
+ method => 'PUT',
+ protected => 1,
+ description => "Update a custom CPU model definition.",
+ permissions => {
+ check => ['perm', '/nodes', ['Sys.Console']],
+ },
+ parameters => {
+ additionalProperties => 0,
+ properties => PVE::QemuServer::CPUConfig::add_cpu_json_properties({
+ digest => get_standard_option('pve-config-digest'),
+ delete => {
+ type => 'string',
+ format => 'pve-configid-list',
+ description => "A list of properties to delete.",
+ optional => 1,
+ },
+ }),
+ },
+ returns => { type => 'null' },
+ code => sub {
+ my ($param) = @_;
+
+ my $digest = extract_param($param, 'digest');
+ my $delete = extract_param($param, 'delete') // '';
+ my %delete_hash = map { $_ => 1 } PVE::Tools::split_list($delete);
+
+ (my $name = $param->{cputype}) =~ s/^custom-//;
+ $param->{cputype} = "custom-$name";
+
+ PVE::QemuServer::CPUConfig::lock_cpu_config(sub {
+ my $conf = PVE::QemuServer::CPUConfig::load_custom_model_conf();
+
+ PVE::SectionConfig::assert_if_modified($conf, $digest);
+
+ my $model = $conf->{ids}->{$name};
+ die "custom CPU model '$name' does not exist\n" if !defined($model);
+
+ my $props = PVE::QemuServer::CPUConfig::add_cpu_json_properties({});
+ for my $p (keys %$props) {
+ if ($delete_hash{$p}) {
+ die "cannot delete 'cputype' property\n" if $p eq 'cputype';
+ die "cannot set and delete property '$p' at once\n" if $param->{$p};
+ delete $model->{$p};
+ } elsif (defined($param->{$p})) {
+ $model->{$p} = $param->{$p};
+ }
+ }
+
+ PVE::QemuServer::CPUConfig::write_custom_model_conf($conf);
+ });
+ },
+});
+
+__PACKAGE__->register_method({
+ name => 'info',
+ path => '{cputype}',
+ method => 'GET',
+ description => 'Retrieve details about a specific custom CPU model',
+ permissions => {
+ check => ['perm', '/nodes', ['Sys.Audit']],
+ },
+ parameters => {
+ additionalProperties => 0,
+ properties => {
+ cputype => {
+ type => 'string',
+ description => "Name of the CPU model to query.",
+ },
+ },
+ },
+ returns => {
+ type => 'object',
+ properties => PVE::QemuServer::CPUConfig::add_cpu_json_properties({
+ digest => get_standard_option('pve-config-digest'),
+ }),
+ },
+ code => sub {
+ my ($param) = @_;
+ (my $name = $param->{cputype}) =~ s/^custom-//;
+ my $conf = PVE::QemuServer::CPUConfig::load_custom_model_conf();
+ my $digest = $conf->{digest};
+ my $retval = PVE::QemuServer::CPUConfig::get_custom_model($name);
+ $retval->{digest} = $digest;
+ return $retval;
+ },
+});
+
+1;
diff --git a/PVE/API2/Cluster/Qemu/Makefile b/PVE/API2/Cluster/Qemu/Makefile
index 2ab3e0b1..76b661db 100644
--- a/PVE/API2/Cluster/Qemu/Makefile
+++ b/PVE/API2/Cluster/Qemu/Makefile
@@ -2,8 +2,9 @@ include ../../../../defines.mk
# for node independent, cluster-wide applicable, API endpoints
# ensure we do not conflict with files shipped by pve-cluster!!
-PERLSOURCE= \
- CPUFlags.pm
+PERLSOURCE= \
+ CPUFlags.pm \
+ CustomCPUModels.pm
all:
--
2.47.3
^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH pve-manager v2 11/17] ui: CPUModelSelector: Allow filtering out custom models
2026-04-01 8:00 [PATCH docs/manager/qemu-server v2 00/17] Add API and UI for custom CPU models Arthur Bied-Charreton
` (9 preceding siblings ...)
2026-04-01 8:00 ` [PATCH pve-manager v2 10/17] api: Add CRUD handlers for custom CPU models Arthur Bied-Charreton
@ 2026-04-01 8:00 ` Arthur Bied-Charreton
2026-04-01 8:00 ` [PATCH pve-manager v2 12/17] ui: Add basic custom CPU model editor Arthur Bied-Charreton
` (5 subsequent siblings)
16 siblings, 0 replies; 18+ messages in thread
From: Arthur Bied-Charreton @ 2026-04-01 8:00 UTC (permalink / raw)
To: pve-devel
Add 'showCustomModels' configuration parameter. When set to false, only
default CPU models will be shown.
This is needed when using the CPUModelSelector in the context of
creating a new custom CPU model, where we do not want to allow the
reported-model being another custom CPU model.
Based on patch by Stefan Reiter, with allowCustom renamed to
showCustomModels:
https://lore.proxmox.com/pve-devel/20211028114150.3245864-8-s.reiter@proxmox.com/
Signed-off-by: Arthur Bied-Charreton <a.bied-charreton@proxmox.com>
---
www/manager6/form/CPUModelSelector.js | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/www/manager6/form/CPUModelSelector.js b/www/manager6/form/CPUModelSelector.js
index 2ebd08eb..890a7cb1 100644
--- a/www/manager6/form/CPUModelSelector.js
+++ b/www/manager6/form/CPUModelSelector.js
@@ -19,7 +19,9 @@ Ext.define('PVE.form.CPUModelSelector', {
autoSelect: false,
deleteEmpty: true,
-
+ config: {
+ showCustomModels: true,
+ },
listConfig: {
columns: [
{
@@ -96,4 +98,11 @@ Ext.define('PVE.form.CPUModelSelector', {
},
},
},
+ initComponent: function () {
+ let me = this;
+ me.callParent();
+ if (!me.showCustomModels) {
+ me.getStore().addFilter({ filterFn: (rec) => !rec.data.custom });
+ }
+ },
});
--
2.47.3
^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH pve-manager v2 12/17] ui: Add basic custom CPU model editor
2026-04-01 8:00 [PATCH docs/manager/qemu-server v2 00/17] Add API and UI for custom CPU models Arthur Bied-Charreton
` (10 preceding siblings ...)
2026-04-01 8:00 ` [PATCH pve-manager v2 11/17] ui: CPUModelSelector: Allow filtering out custom models Arthur Bied-Charreton
@ 2026-04-01 8:00 ` Arthur Bied-Charreton
2026-04-01 8:00 ` [PATCH pve-manager v2 13/17] ui: VMCPUFlagSelector: Add CPU flag editor for custom models Arthur Bied-Charreton
` (4 subsequent siblings)
16 siblings, 0 replies; 18+ messages in thread
From: Arthur Bied-Charreton @ 2026-04-01 8:00 UTC (permalink / raw)
To: pve-devel
Add basic structure for viewing (CPUTypeView), creating and editing
(CPUTypeEdit, PhysBitsSelector) custom CPU models, allowing to interact
with the new custom-cpu-models API in the UI.
Based on & adapted from patch by Stefan Reiter:
https://lore.proxmox.com/pve-devel/20211028114150.3245864-9-s.reiter@proxmox.com/
Signed-off-by: Arthur Bied-Charreton <a.bied-charreton@proxmox.com>
---
www/manager6/Makefile | 3 +
www/manager6/dc/CPUTypeEdit.js | 93 ++++++++++++++++
www/manager6/dc/CPUTypeView.js | 149 +++++++++++++++++++++++++
www/manager6/dc/Config.js | 9 ++
www/manager6/form/PhysBitsSelector.js | 153 ++++++++++++++++++++++++++
5 files changed, 407 insertions(+)
create mode 100644 www/manager6/dc/CPUTypeEdit.js
create mode 100644 www/manager6/dc/CPUTypeView.js
create mode 100644 www/manager6/form/PhysBitsSelector.js
diff --git a/www/manager6/Makefile b/www/manager6/Makefile
index 4558d53e..fbde2327 100644
--- a/www/manager6/Makefile
+++ b/www/manager6/Makefile
@@ -58,6 +58,7 @@ JSSRC= \
form/PCISelector.js \
form/PCIMapSelector.js \
form/PermPathSelector.js \
+ form/PhysBitsSelector.js \
form/PoolSelector.js \
form/PreallocationSelector.js \
form/PrivilegesSelector.js \
@@ -170,6 +171,8 @@ JSSRC= \
dc/CmdMenu.js \
dc/Config.js \
dc/CorosyncLinkEdit.js \
+ dc/CPUTypeEdit.js \
+ dc/CPUTypeView.js \
dc/GroupEdit.js \
dc/GroupView.js \
dc/Guests.js \
diff --git a/www/manager6/dc/CPUTypeEdit.js b/www/manager6/dc/CPUTypeEdit.js
new file mode 100644
index 00000000..1b250462
--- /dev/null
+++ b/www/manager6/dc/CPUTypeEdit.js
@@ -0,0 +1,93 @@
+Ext.define('PVE.dc.CPUTypeEdit', {
+ extend: 'Proxmox.window.Edit',
+ alias: ['widget.pveCpuTypeEdit'],
+ mixins: ['Proxmox.Mixin.CBind'],
+
+ subject: gettext('CPU Type'),
+
+ // Avoid default-focusing the reported model dropdown while still
+ // focusing the name textfield if it is editable
+ defaultFocus: 'textfield',
+
+ onlineHelp: 'qm_cpu_type',
+
+ height: 600,
+ width: 800,
+
+ cbindData: {
+ cputype: '',
+ isCreate: (cfg) => !cfg.cputype,
+ },
+
+ cbind: {
+ autoLoad: (get) => !get('isCreate'),
+ url: (get) => `/api2/extjs/cluster/qemu/custom-cpu-models/${get('cputype')}`,
+ method: (get) => (get('isCreate') ? 'POST' : 'PUT'),
+ isCreate: (get) => get('isCreate'),
+ },
+
+ getValues: function () {
+ let me = this;
+ let values = me.callParent();
+
+ PVE.Utils.delete_if_default(values, 'reported-model', '', me.isCreate);
+ PVE.Utils.delete_if_default(values, 'hv-vendor-id', '', me.isCreate);
+ PVE.Utils.delete_if_default(values, 'phys-bits', '', me.isCreate);
+ PVE.Utils.delete_if_default(values, 'flags', '', me.isCreate);
+
+ return values;
+ },
+
+ items: [
+ {
+ xtype: 'inputpanel',
+ column1: [
+ {
+ xtype: 'pmxDisplayEditField',
+ fieldLabel: gettext('Name'),
+ cbind: {
+ editable: '{isCreate}',
+ value: '{cputype}',
+ },
+ name: 'cputype',
+ renderer: (val) => val.replace(/^custom-/, ''),
+ allowBlank: false,
+ },
+ {
+ xtype: 'CPUModelSelector',
+ fieldLabel: gettext('Base Model'),
+ showCustomModels: false,
+ name: 'reported-model',
+ autoEl: {
+ tag: 'div',
+ 'data-qtip': gettext(
+ 'CPU model the rest of the configuration will be based on.',
+ ),
+ },
+ },
+ {
+ xtype: 'textfield',
+ fieldLabel: gettext('Hyper-V Vendor'),
+ name: 'hv-vendor-id',
+ allowBlank: true,
+ emptyText: gettext('None'),
+ maxLength: 12,
+ },
+ ],
+ column2: [
+ {
+ xtype: 'checkbox',
+ fieldLabel: gettext('Hidden'),
+ name: 'hidden',
+ inputValue: 1,
+ uncheckedValue: 0,
+ },
+ {
+ xtype: 'PhysBitsSelector',
+ fieldLabel: gettext('Phys-Bits'),
+ name: 'phys-bits',
+ },
+ ],
+ },
+ ],
+});
diff --git a/www/manager6/dc/CPUTypeView.js b/www/manager6/dc/CPUTypeView.js
new file mode 100644
index 00000000..207673a7
--- /dev/null
+++ b/www/manager6/dc/CPUTypeView.js
@@ -0,0 +1,149 @@
+Ext.define('pve-custom-cpu-type', {
+ extend: 'Ext.data.Model',
+ fields: [
+ 'cputype',
+ 'reported-model',
+ 'hv-vendor-id',
+ 'flags',
+ 'phys-bits',
+ { name: 'hidden', type: 'boolean' },
+ ],
+});
+
+Ext.define('PVE.dc.CPUTypeView', {
+ extend: 'Ext.grid.GridPanel',
+ alias: ['widget.pveCPUTypeView'],
+
+ onlineHelp: 'qm_cpu_type',
+
+ store: {
+ model: 'pve-custom-cpu-type',
+ proxy: {
+ type: 'proxmox',
+ url: '/api2/json/cluster/qemu/custom-cpu-models',
+ },
+ autoLoad: true,
+ sorters: ['cputype'],
+ },
+
+ controller: {
+ xclass: 'Ext.app.ViewController',
+
+ getSelection: function () {
+ let me = this;
+ let grid = me.getView();
+ let selection = grid.getSelection();
+ if (selection.length === 1) {
+ return selection[0].data;
+ }
+ return null;
+ },
+
+ showEditor: function (cputype) {
+ let me = this;
+ let param = cputype ? { cputype } : {};
+ let win = Ext.create('PVE.dc.CPUTypeEdit', param);
+ win.on('destroy', () => me.reload());
+ win.show();
+ },
+
+ onAdd: function () {
+ let me = this;
+ me.showEditor();
+ },
+
+ onEdit: function () {
+ let me = this;
+ let selection = me.getSelection();
+ me.showEditor(selection.cputype);
+ },
+
+ reload: function () {
+ let me = this;
+ me.getView().getStore().reload();
+ },
+ },
+
+ columns: [
+ {
+ header: gettext('Name'),
+ flex: 1,
+ dataIndex: 'cputype',
+ renderer: (val) => val.replace(/^custom-/, ''),
+ },
+ {
+ header: gettext('Base Model'),
+ flex: 1,
+ dataIndex: 'reported-model',
+ autoEl: {
+ tag: 'div',
+ 'data-qtip': gettext('CPU model the rest of the configuration will be based on.'),
+ },
+ },
+ {
+ header: gettext('Phys-Bits'),
+ flex: 1,
+ dataIndex: 'phys-bits',
+ },
+ {
+ header: gettext('Hidden'),
+ flex: 1,
+ dataIndex: 'hidden',
+ },
+ {
+ header: gettext('HyperV-Vendor'),
+ flex: 1,
+ dataIndex: 'hv-vendor-id',
+ },
+ {
+ header: gettext('Flags'),
+ flex: 2,
+ dataIndex: 'flags',
+ },
+ ],
+
+ tbar: [
+ {
+ text: gettext('Add'),
+ handler: 'onAdd',
+ },
+ '-',
+ {
+ xtype: 'proxmoxStdRemoveButton',
+ baseurl: '/api2/extjs/cluster/qemu/custom-cpu-models/',
+ getRecordName: (rec) => rec.data.cputype,
+ getUrl: function (rec) {
+ let me = this;
+ return me.baseurl + rec.data.cputype;
+ },
+ confirmMsg: function (rec) {
+ return Ext.String.format(
+ gettext('Are you sure you want to remove the custom CPU model {0}'),
+ `"${rec.data.cputype.replace(/^custom-/, '')}"?`,
+ );
+ },
+ callback: 'reload',
+ },
+ {
+ text: gettext('Edit'),
+ handler: 'onEdit',
+ },
+ ],
+
+ selModel: {
+ xtype: 'rowmodel',
+ },
+
+ listeners: {
+ itemdblclick: function (_, rec) {
+ let me = this;
+ me.getController().showEditor(rec.data.cputype);
+ },
+ },
+
+ initComponent: function () {
+ let me = this;
+ me.callParent();
+ Proxmox.Utils.monStoreErrors(me, me.store);
+ },
+});
diff --git a/www/manager6/dc/Config.js b/www/manager6/dc/Config.js
index b5e27a21..ad830ba8 100644
--- a/www/manager6/dc/Config.js
+++ b/www/manager6/dc/Config.js
@@ -427,6 +427,15 @@ Ext.define('PVE.dc.Config', {
);
}
+ if (caps.dc['Sys.Audit']) {
+ me.items.push({
+ xtype: 'pveCPUTypeView',
+ iconCls: 'fa fa-microchip',
+ title: gettext('Custom CPU models'),
+ itemId: 'cputypes',
+ });
+ }
+
if (
caps.mapping['Mapping.Audit'] ||
caps.mapping['Mapping.Use'] ||
diff --git a/www/manager6/form/PhysBitsSelector.js b/www/manager6/form/PhysBitsSelector.js
new file mode 100644
index 00000000..78f932a6
--- /dev/null
+++ b/www/manager6/form/PhysBitsSelector.js
@@ -0,0 +1,153 @@
+Ext.define('PVE.form.PhysBitsSelector', {
+ extend: 'Ext.form.FieldContainer',
+ alias: 'widget.PhysBitsSelector',
+ mixins: ['Ext.form.field.Field'],
+
+ layout: 'vbox',
+ originalValue: '',
+
+ controller: {
+ xclass: 'Ext.app.ViewController',
+
+ onRadioChange: function (radio, value) {
+ let me = this;
+ if (value === undefined) {
+ return;
+ }
+
+ ['modeDefault', 'modeHost', 'modeCustom'].forEach(function (ref) {
+ let r = me.lookupReference(ref);
+ if (r !== radio) {
+ r.suspendEvents();
+ r.setValue(false);
+ r.resumeEvents();
+ }
+ });
+
+ me.updateNumberField();
+ },
+
+ updateNumberField: function () {
+ let me = this;
+ let modeCustom = me.lookupReference('modeCustom');
+ let customNum = me.lookupReference('customNum');
+
+ customNum.setDisabled(!modeCustom.getValue());
+ me.getView().validate();
+ },
+
+ listen: {
+ component: {
+ '*': {
+ change: function () {
+ let me = this;
+ me.getView().checkChange();
+ },
+ },
+ },
+ },
+ },
+
+ getValue: function () {
+ let me = this;
+ let ctrl = me.getController();
+ if (ctrl.lookupReference('modeDefault').getValue()) {
+ return '';
+ } else if (ctrl.lookupReference('modeHost').getValue()) {
+ return 'host';
+ } else if (ctrl.lookupReference('modeCustom').getValue()) {
+ return ctrl.lookupReference('customNum').getValue();
+ }
+ return ''; // shouldn't happen
+ },
+
+ setValue: function (value) {
+ let me = this;
+ let ctrl = me.getController();
+ let modeField;
+
+ if (!value) {
+ modeField = ctrl.lookupReference('modeDefault');
+ } else if (value === 'host') {
+ modeField = ctrl.lookupReference('modeHost');
+ } else {
+ let customNum = ctrl.lookupReference('customNum');
+ customNum.setValue(value);
+ modeField = ctrl.lookupReference('modeCustom');
+ }
+
+ modeField.setValue(true);
+ me.checkChange();
+
+ return value;
+ },
+
+ getErrors: function () {
+ let me = this;
+ let ctrl = me.getController();
+ if (ctrl.lookupReference('modeCustom').getValue()) {
+ return ctrl.lookupReference('customNum').getErrors();
+ }
+ return [];
+ },
+
+ isValid: function () {
+ let me = this;
+ let ctrl = me.getController();
+ if (ctrl.lookupReference('modeCustom').getValue()) {
+ return ctrl.lookupReference('customNum').isValid();
+ }
+ return true;
+ },
+
+ items: [
+ {
+ xtype: 'radiofield',
+ boxLabel: gettext('Default'),
+ inputValue: 'default',
+ checked: true,
+ reference: 'modeDefault',
+ listeners: {
+ change: 'onRadioChange',
+ },
+ isFormField: false,
+ },
+ {
+ xtype: 'radiofield',
+ boxLabel: gettext('Host'),
+ inputValue: 'host',
+ reference: 'modeHost',
+ listeners: {
+ change: 'onRadioChange',
+ },
+ isFormField: false,
+ },
+ {
+ xtype: 'fieldcontainer',
+ layout: 'hbox',
+ items: [
+ {
+ xtype: 'radiofield',
+ boxLabel: gettext('Custom'),
+ inputValue: 'custom',
+ listeners: {
+ change: 'onRadioChange',
+ },
+ reference: 'modeCustom',
+ isFormField: false,
+ },
+ {
+ xtype: 'numberfield',
+ width: 60,
+ margin: '0 0 0 10px',
+ minValue: 8,
+ maxValue: 64,
+ reference: 'customNum',
+ allowBlank: false,
+ isFormField: false,
+ disabled: true,
+ },
+ ],
+ },
+ ],
+});
--
2.47.3
^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH pve-manager v2 13/17] ui: VMCPUFlagSelector: Add CPU flag editor for custom models
2026-04-01 8:00 [PATCH docs/manager/qemu-server v2 00/17] Add API and UI for custom CPU models Arthur Bied-Charreton
` (11 preceding siblings ...)
2026-04-01 8:00 ` [PATCH pve-manager v2 12/17] ui: Add basic custom CPU model editor Arthur Bied-Charreton
@ 2026-04-01 8:00 ` Arthur Bied-Charreton
2026-04-01 8:00 ` [PATCH pve-manager v2 14/17] ui: VMCPUFlagSelector: Fix buffered rendering error Arthur Bied-Charreton
` (3 subsequent siblings)
16 siblings, 0 replies; 18+ messages in thread
From: Arthur Bied-Charreton @ 2026-04-01 8:00 UTC (permalink / raw)
To: pve-devel
Add CPU flag editor to the CPUTypeEdit component by extending the
VMCPUFlagSelector also used in the VM creation flow. This adds config
fields allowing to differentiate whether the component is being used in
the VM creation wizard, processor edit window, or for a custom CPU
model.
For each flag in the selector, also display which node(s) it is available
on, and add a radio group allowing to select which acceleration type
flag availability should be checked for.
In the VM processor edit window, pre-select the acceleration type based
on the value of `kvm` in the VM's config (`kvm` for `kvm: 1`, otherwise
`tcg`).
In the VM creation wizard, show VM-specific flags, allowing the user to
filter by acceleration type themselves.
In the custom CPU model creation/edit window, show all flags available
cluster-wide, allowing the user to filter by acceleration type.
Show unknown flags, i.e. flags that either the currently selected
acceleration type does not support or that do not exist, at the top
of the list to encourage users to reconsider whether they should be set
at all.
Based on & adapted from patch by Stefan Reiter:
https://lore.proxmox.com/pve-devel/20211028114150.3245864-10-s.reiter@proxmox.com
Signed-off-by: Arthur Bied-Charreton <a.bied-charreton@proxmox.com>
---
www/css/ext6-pve.css | 4 +
www/manager6/dc/CPUTypeEdit.js | 10 ++
www/manager6/form/CPUModelSelector.js | 1 +
www/manager6/form/VMCPUFlagSelector.js | 211 ++++++++++++++++++++++---
www/manager6/qemu/ProcessorEdit.js | 6 +
5 files changed, 206 insertions(+), 26 deletions(-)
diff --git a/www/css/ext6-pve.css b/www/css/ext6-pve.css
index 27742a74..98f5e6ed 100644
--- a/www/css/ext6-pve.css
+++ b/www/css/ext6-pve.css
@@ -655,6 +655,10 @@ table.osds td:first-of-type {
opacity: 0.3;
}
+.x-toolbar .x-form-item-default.x-item-disabled {
+ opacity: 0.8;
+}
+
.pmx-action-hidden:before {
opacity: 0;
cursor: default;
diff --git a/www/manager6/dc/CPUTypeEdit.js b/www/manager6/dc/CPUTypeEdit.js
index 1b250462..b2a81811 100644
--- a/www/manager6/dc/CPUTypeEdit.js
+++ b/www/manager6/dc/CPUTypeEdit.js
@@ -88,6 +88,16 @@ Ext.define('PVE.dc.CPUTypeEdit', {
name: 'phys-bits',
},
],
+ columnB: [
+ {
+ xtype: 'vmcpuflagselector',
+ fieldLabel: gettext('Extra CPU flags'),
+ name: 'flags',
+ restrictToVMFlags: false,
+ height: 380,
+ hideHeaders: false,
+ },
+ ],
},
],
});
diff --git a/www/manager6/form/CPUModelSelector.js b/www/manager6/form/CPUModelSelector.js
index 890a7cb1..c091a82d 100644
--- a/www/manager6/form/CPUModelSelector.js
+++ b/www/manager6/form/CPUModelSelector.js
@@ -17,6 +17,7 @@ Ext.define('PVE.form.CPUModelSelector', {
anyMatch: true,
forceSelection: true,
autoSelect: false,
+ triggerAction: 'query',
deleteEmpty: true,
config: {
diff --git a/www/manager6/form/VMCPUFlagSelector.js b/www/manager6/form/VMCPUFlagSelector.js
index 922fcfa6..b857c134 100644
--- a/www/manager6/form/VMCPUFlagSelector.js
+++ b/www/manager6/form/VMCPUFlagSelector.js
@@ -6,6 +6,14 @@ Ext.define('PVE.form.VMCPUFlagSelector', {
field: 'Ext.form.field.Field',
},
+ config: {
+ // Show only the flags that may be set for a specific VM.
+ restrictToVMFlags: true,
+ // Acceleration type of the VM, 'kvm' or 'tcg', only used if
+ // restrictToVMFlags === true.
+ accel: null,
+ },
+
disableSelection: true,
columnLines: false,
selectable: false,
@@ -14,12 +22,15 @@ Ext.define('PVE.form.VMCPUFlagSelector', {
scrollable: 'y',
height: 200,
- unkownFlags: [],
-
store: {
- type: 'store',
- fields: ['name', { name: 'state', defaultValue: '=' }, 'description'],
- autoLoad: true,
+ fields: [
+ 'name',
+ { name: 'state', defaultValue: '=' },
+ 'description',
+ 'supported-on',
+ 'unknown',
+ ],
+ autoLoad: false,
proxy: {
type: 'proxmox',
url: '/api2/json/nodes/localhost/capabilities/qemu/cpu-flags',
@@ -28,16 +39,23 @@ Ext.define('PVE.form.VMCPUFlagSelector', {
update: function () {
this.commitChanges();
},
- refresh: function (store, eOpts) {
- let me = this;
- let view = me.view;
-
- if (store.adjustedForValue !== view.value) {
- view.adjustStoreForValue();
- }
- },
},
- adjustedForValue: undefined,
+ filters: [
+ {
+ id: 'supported-filter',
+ filterFn: (rec) => {
+ let state = rec.get('state');
+ if (state && state !== '=') {
+ return true;
+ }
+ if (rec.get('unknown')) {
+ return true;
+ }
+ let s = rec.get('supported-on');
+ return Array.isArray(s) && s.length > 0;
+ },
+ },
+ ],
},
getValue: function () {
@@ -62,21 +80,39 @@ Ext.define('PVE.form.VMCPUFlagSelector', {
}
});
- flags += me.unkownFlags.join(';');
-
return flags;
},
- // Adjusts the store for the current value and determines the unkown flags based on what the
- // store does not know.
+ // Adjusts the store for the current value. Flags not known to the API are added to the store
+ // as 'unknown' records so they stay visible and can be edited.
adjustStoreForValue: function () {
let me = this;
let store = me.getStore();
let value = me.value;
- me.unkownFlags = [];
+ // Clear any previously added unknown records.
+ let unknownRecords = [];
+ store.getData().each((rec) => {
+ if (rec.get('unknown')) {
+ unknownRecords.push(rec);
+ } else {
+ rec.set('state', '=');
+ }
+ });
+ store.remove(unknownRecords);
- store.getData().each((rec) => rec.set('state', '='));
+ let newUnknownFlags = [];
+ let addUnknownFlag = function (flag, sign) {
+ newUnknownFlags.push({
+ name: flag,
+ state: sign,
+ // A TCG-only flag will be flagged as unknown when `accel` is set to `kvm` and vice-versa, hence the very general wording.
+ description: gettext(
+ 'This flag is not available for the selected acceleration type and/or not supported by any node in the cluster. It is very likely to lead to VM startup failure. You can remove it by setting it to "Default".',
+ ),
+ unknown: true,
+ });
+ };
let flags = value ? value.split(';') : [];
flags.forEach(function (flag) {
@@ -85,15 +121,32 @@ Ext.define('PVE.form.VMCPUFlagSelector', {
let rec = store.findRecord('name', flag, 0, false, true, true);
if (rec !== null) {
- rec.set('state', sign);
+ let supported = rec.get('supported-on');
+ // Treat flags that are set in the config but not supported anywhere as unknown
+ if (Array.isArray(supported) && supported.length === 0 && sign !== '=') {
+ store.remove(rec);
+ addUnknownFlag(flag, sign);
+ } else {
+ rec.set('state', sign);
+ rec.commit();
+ }
} else {
- me.unkownFlags.push(flag);
+ addUnknownFlag(flag, sign);
}
});
- store.adjustedForValue = value;
- },
+ // Make sure unknown flags are displayed at the top of the list
+ // so users reconsider them.
+ if (newUnknownFlags.length > 0) {
+ store.insert(0, newUnknownFlags);
+ }
+ me.getView().refresh();
+ },
+ isDirty: function () {
+ let me = this;
+ return me.originalValue !== me.getValue();
+ },
setValue: function (value) {
let me = this;
@@ -109,6 +162,7 @@ Ext.define('PVE.form.VMCPUFlagSelector', {
},
columns: [
{
+ text: gettext('State'),
dataIndex: 'state',
renderer: function (v) {
switch (v) {
@@ -125,6 +179,7 @@ Ext.define('PVE.form.VMCPUFlagSelector', {
width: 65,
},
{
+ text: gettext('Value'),
xtype: 'widgetcolumn',
dataIndex: 'state',
width: 95,
@@ -171,22 +226,126 @@ Ext.define('PVE.form.VMCPUFlagSelector', {
},
},
{
+ text: gettext('Flag'),
dataIndex: 'name',
width: 100,
},
{
+ text: gettext('Description'),
dataIndex: 'description',
+ sortable: false,
+ cellWrap: true,
+ flex: 3,
+ },
+ {
+ text: gettext('Supported On'),
+ dataIndex: 'supported-on',
cellWrap: true,
flex: 1,
+ renderer: (v) => (Array.isArray(v) ? v.join(', ') : ''),
},
],
-
+ updateAccel: function (accel) {
+ let me = this;
+ if (!me.initialized) {
+ return;
+ }
+ me.getStore().getProxy().setExtraParam('accel', accel);
+ me.getStore().load();
+ },
+ lockAccel: function (accel) {
+ let me = this;
+ let toolbar = me.down('toolbar[dock=top]');
+ let radiogroup = toolbar.down('radiogroup');
+ radiogroup.setValue({ accel });
+ radiogroup.setDisabled(true);
+ toolbar
+ .down('tbtext')
+ .getEl()
+ .set({
+ 'data-qtip': gettext(
+ "The acceleration type is determined by the VM's KVM setting and cannot be changed here.",
+ ),
+ });
+ },
initComponent: function () {
let me = this;
me.value = me.originalValue = '';
- me.store.view = me;
+
+ me.dockedItems = [
+ {
+ xtype: 'toolbar',
+ dock: 'top',
+ hidden: false,
+ items: [
+ {
+ xtype: 'tbtext',
+ text: gettext('Acceleration:'),
+ autoEl: {
+ tag: 'span',
+ 'data-qtip': gettext(
+ 'A custom CPU model using acceleration-specific flags can only be assigned to VMs configured with the matching acceleration type, i.e., "kvm: 1" for KVM, or "kvm: 0" for TCG.',
+ ),
+ },
+ },
+ {
+ xtype: 'radiogroup',
+ layout: 'hbox',
+ validateOnChange: false,
+ items: [
+ {
+ boxLabel: 'KVM',
+ inputValue: 'kvm',
+ name: 'accel',
+ checked: true,
+ isFormField: false,
+ },
+ {
+ boxLabel: 'TCG',
+ inputValue: 'tcg',
+ name: 'accel',
+ margin: '0 0 0 10',
+ isFormField: false,
+ },
+ ],
+ listeners: {
+ change: function (_, value) {
+ let view = this.up('grid');
+ let proxy = view.getStore().getProxy();
+ let accel = value.accel;
+ if (accel) {
+ proxy.setExtraParam('accel', accel);
+ } else {
+ delete proxy.extraParams.accel;
+ }
+ view.getStore().load();
+ },
+ },
+ },
+ ],
+ },
+ ];
me.callParent(arguments);
+
+ me.initialized = true;
+
+ me.getStore().on('load', function (store, _, success) {
+ if (success) {
+ me.adjustStoreForValue();
+ me.checkDirty();
+ }
+ });
+
+ if (!me.restrictToVMFlags) {
+ me.getStore().getProxy().setUrl('/api2/json/cluster/qemu/cpu-flags');
+ me.getStore().load();
+ } else {
+ me.getStore()
+ .getProxy()
+ .setExtraParam('accel', me.accel ?? 'kvm');
+ me.getStore().load();
+ }
},
});
diff --git a/www/manager6/qemu/ProcessorEdit.js b/www/manager6/qemu/ProcessorEdit.js
index ffaf014e..3235f567 100644
--- a/www/manager6/qemu/ProcessorEdit.js
+++ b/www/manager6/qemu/ProcessorEdit.js
@@ -18,6 +18,7 @@ Ext.define('PVE.qemu.ProcessorInputPanel', {
cpuunitsDefault: (get) => (get('cgroupMode') === 1 ? 1024 : 100),
cpuunitsMin: (get) => (get('cgroupMode') === 1 ? 2 : 1),
cpuunitsMax: (get) => (get('cgroupMode') === 1 ? 262144 : 10000),
+ accel: (get) => (get('kvm') ? 'kvm' : 'tcg'),
},
},
@@ -241,6 +242,9 @@ Ext.define('PVE.qemu.ProcessorInputPanel', {
{
xtype: 'vmcpuflagselector',
name: 'flags',
+ bind: {
+ accel: '{accel}',
+ },
},
],
});
@@ -288,6 +292,8 @@ Ext.define('PVE.qemu.ProcessorEdit', {
vm.set('showCustomModelPermWarning', true);
}
}
+ let accel = data.kvm === 0 ? 'tcg' : 'kvm';
+ ipanel.down('vmcpuflagselector').lockAccel(accel);
me.setValues(data);
},
});
--
2.47.3
^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH pve-manager v2 14/17] ui: VMCPUFlagSelector: Fix buffered rendering error
2026-04-01 8:00 [PATCH docs/manager/qemu-server v2 00/17] Add API and UI for custom CPU models Arthur Bied-Charreton
` (12 preceding siblings ...)
2026-04-01 8:00 ` [PATCH pve-manager v2 13/17] ui: VMCPUFlagSelector: Add CPU flag editor for custom models Arthur Bied-Charreton
@ 2026-04-01 8:00 ` Arthur Bied-Charreton
2026-04-01 8:00 ` [PATCH pve-manager v2 15/17] ui: VMCPUFlagSelector: Allow filtering out flags supported on 0 nodes Arthur Bied-Charreton
` (2 subsequent siblings)
16 siblings, 0 replies; 18+ messages in thread
From: Arthur Bied-Charreton @ 2026-04-01 8:00 UTC (permalink / raw)
To: pve-devel
When the flags are queried from /cluster/qemu/cpu-flags, Ext.js uses
buffered rendering, and we have to use a different helper to refresh the
view [0][1].
Not doing so creates random-looking rendering errors, in this case the
radio group was missing from random flags, changing every time the
buffer would be re-rendered.
[0] https://docs.sencha.com/extjs/6.2.0/classic/Ext.view.AbstractView.html#method-refresh
[1] https://docs.sencha.com/extjs/6.2.0/classic/Ext.grid.plugin.BufferedRenderer.html#method-refreshView
Signed-off-by: Arthur Bied-Charreton <a.bied-charreton@proxmox.com>
---
www/manager6/form/VMCPUFlagSelector.js | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
diff --git a/www/manager6/form/VMCPUFlagSelector.js b/www/manager6/form/VMCPUFlagSelector.js
index b857c134..cbd6e2c7 100644
--- a/www/manager6/form/VMCPUFlagSelector.js
+++ b/www/manager6/form/VMCPUFlagSelector.js
@@ -141,7 +141,20 @@ Ext.define('PVE.form.VMCPUFlagSelector', {
store.insert(0, newUnknownFlags);
}
- me.getView().refresh();
+ // Ext.js uses buffered renderers for larger lists, i.e. in this case, the flags
+ // queried from /cluster/qemu/cpu-flags, which returns all possible QEMU flags. In
+ // this case, we cannot use AbstractView.refresh [0] and have to fall back to
+ // BufferedRendrer.refreshView [1], otherwise we get interesting rendering errors, in
+ // this case radio groups missing from random flags.
+ //
+ // [0] https://docs.sencha.com/extjs/6.2.0/classic/Ext.view.AbstractView.html#method-refresh
+ // [1] https://docs.sencha.com/extjs/6.2.0/classic/Ext.grid.plugin.BufferedRenderer.html#method-refreshView
+ let plugin = me.findPlugin('bufferedrenderer');
+ if (plugin === undefined) {
+ me.getView().refresh();
+ } else {
+ plugin.refreshView();
+ }
},
isDirty: function () {
let me = this;
--
2.47.3
^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH pve-manager v2 15/17] ui: VMCPUFlagSelector: Allow filtering out flags supported on 0 nodes
2026-04-01 8:00 [PATCH docs/manager/qemu-server v2 00/17] Add API and UI for custom CPU models Arthur Bied-Charreton
` (13 preceding siblings ...)
2026-04-01 8:00 ` [PATCH pve-manager v2 14/17] ui: VMCPUFlagSelector: Fix buffered rendering error Arthur Bied-Charreton
@ 2026-04-01 8:00 ` Arthur Bied-Charreton
2026-04-01 8:00 ` [PATCH pve-manager v2 16/17] ui: VMCPUFlagSelector: Add search bar for large lists of flags Arthur Bied-Charreton
2026-04-01 8:00 ` [PATCH pve-manager v2 17/17] RFC: ui: Group custom CPU with resource mappings Arthur Bied-Charreton
16 siblings, 0 replies; 18+ messages in thread
From: Arthur Bied-Charreton @ 2026-04-01 8:00 UTC (permalink / raw)
To: pve-devel
The cpu-flags endpoints may return some CPU flags that are not supported
on any node in the cluster. Filter those out by default in the UI,
giving the option to display them via a checkbox.
Unknown flags are still shown at the top of the list.
Signed-off-by: Arthur Bied-Charreton <a.bied-charreton@proxmox.com>
---
www/manager6/form/VMCPUFlagSelector.js | 33 ++++++++++++++++++++++++++
1 file changed, 33 insertions(+)
diff --git a/www/manager6/form/VMCPUFlagSelector.js b/www/manager6/form/VMCPUFlagSelector.js
index cbd6e2c7..765d325d 100644
--- a/www/manager6/form/VMCPUFlagSelector.js
+++ b/www/manager6/form/VMCPUFlagSelector.js
@@ -340,6 +340,39 @@ Ext.define('PVE.form.VMCPUFlagSelector', {
},
];
+ me.dockedItems.push({
+ xtype: 'toolbar',
+ dock: 'bottom',
+ items: [
+ {
+ xtype: 'checkbox',
+ checked: true,
+ submitValue: false,
+ isFormField: false,
+ boxLabel: gettext('Only show flags supported by at least one node'),
+ listeners: {
+ change: function (cb, checked) {
+ let store = cb.up('grid').getStore();
+ if (checked) {
+ store.addFilter({
+ id: 'supported-filter',
+ filterFn: (rec) => {
+ if (rec.get('unknown')) {
+ return true;
+ }
+ let s = rec.get('supported-on');
+ return Array.isArray(s) && s.length > 0;
+ },
+ });
+ } else {
+ store.removeFilter('supported-filter');
+ }
+ },
+ },
+ },
+ ],
+ });
+
me.callParent(arguments);
me.initialized = true;
--
2.47.3
^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH pve-manager v2 16/17] ui: VMCPUFlagSelector: Add search bar for large lists of flags
2026-04-01 8:00 [PATCH docs/manager/qemu-server v2 00/17] Add API and UI for custom CPU models Arthur Bied-Charreton
` (14 preceding siblings ...)
2026-04-01 8:00 ` [PATCH pve-manager v2 15/17] ui: VMCPUFlagSelector: Allow filtering out flags supported on 0 nodes Arthur Bied-Charreton
@ 2026-04-01 8:00 ` Arthur Bied-Charreton
2026-04-01 8:00 ` [PATCH pve-manager v2 17/17] RFC: ui: Group custom CPU with resource mappings Arthur Bied-Charreton
16 siblings, 0 replies; 18+ messages in thread
From: Arthur Bied-Charreton @ 2026-04-01 8:00 UTC (permalink / raw)
To: pve-devel
Add a search bar for the CPU flags list queried from
/cluster/qemu/cpu-flags, which is very long.
Do not display it for VM-specific flags (~15 flags), as they are
easier to scan through, and it would overload the ProcessorEdit window.
Signed-off-by: Arthur Bied-Charreton <a.bied-charreton@proxmox.com>
---
www/manager6/form/VMCPUFlagSelector.js | 128 ++++++++++++++++---------
1 file changed, 83 insertions(+), 45 deletions(-)
diff --git a/www/manager6/form/VMCPUFlagSelector.js b/www/manager6/form/VMCPUFlagSelector.js
index 765d325d..4c6e1510 100644
--- a/www/manager6/form/VMCPUFlagSelector.js
+++ b/www/manager6/form/VMCPUFlagSelector.js
@@ -68,7 +68,11 @@ Ext.define('PVE.form.VMCPUFlagSelector', {
let flags = '';
- store.getData().each(function (rec) {
+ // Get the values directly from the data source. Using store.getData() here
+ // would iterate over the filtered values, potentially overwriting flags that
+ // are set but currently filtered out by the search bar.
+ let source = store.getDataSource();
+ source.each(function (rec) {
let s = rec.get('state');
if (s && s !== '=') {
let f = rec.get('name');
@@ -286,57 +290,91 @@ Ext.define('PVE.form.VMCPUFlagSelector', {
me.value = me.originalValue = '';
- me.dockedItems = [
+ let topToolbarItems = [
{
- xtype: 'toolbar',
- dock: 'top',
- hidden: false,
+ xtype: 'tbtext',
+ text: gettext('Acceleration:'),
+ autoEl: {
+ tag: 'span',
+ 'data-qtip': gettext(
+ "A custom CPU model using acceleration-specific flags can only be assigned to VMs configured with the matching acceleration type, i.e., 'kvm: 1' for KVM, or 'kvm: 0' for TCG.",
+ ),
+ },
+ },
+ {
+ xtype: 'radiogroup',
+ layout: 'hbox',
+ validateOnChange: false,
items: [
{
- xtype: 'tbtext',
- text: gettext('Acceleration:'),
- autoEl: {
- tag: 'span',
- 'data-qtip': gettext(
- 'A custom CPU model using acceleration-specific flags can only be assigned to VMs configured with the matching acceleration type, i.e., "kvm: 1" for KVM, or "kvm: 0" for TCG.',
- ),
- },
+ boxLabel: 'KVM',
+ inputValue: 'kvm',
+ name: 'accel',
+ checked: true,
+ isFormField: false,
},
{
- xtype: 'radiogroup',
- layout: 'hbox',
- validateOnChange: false,
- items: [
- {
- boxLabel: 'KVM',
- inputValue: 'kvm',
- name: 'accel',
- checked: true,
- isFormField: false,
- },
- {
- boxLabel: 'TCG',
- inputValue: 'tcg',
- name: 'accel',
- margin: '0 0 0 10',
- isFormField: false,
- },
- ],
- listeners: {
- change: function (_, value) {
- let view = this.up('grid');
- let proxy = view.getStore().getProxy();
- let accel = value.accel;
- if (accel) {
- proxy.setExtraParam('accel', accel);
- } else {
- delete proxy.extraParams.accel;
- }
- view.getStore().load();
- },
- },
+ boxLabel: 'TCG',
+ inputValue: 'tcg',
+ name: 'accel',
+ margin: '0 0 0 10',
+ isFormField: false,
},
],
+ listeners: {
+ change: function (_, value) {
+ let view = this.up('grid');
+ let proxy = view.getStore().getProxy();
+ let accel = value.accel;
+ if (accel) {
+ proxy.setExtraParam('accel', accel);
+ } else {
+ delete proxy.extraParams.accel;
+ }
+ view.getStore().load();
+ },
+ },
+ },
+ ];
+
+ if (!me.restrictToVMFlags) {
+ topToolbarItems.push('-', {
+ xtype: 'textfield',
+ emptyText: gettext('Search...'),
+ submitValue: false,
+ listeners: {
+ change: {
+ buffer: 100,
+ fn: function (field, value) {
+ let store = field.up('grid').getStore();
+ if (value) {
+ let lv = value.toLowerCase();
+ store.addFilter({
+ id: 'search-filter',
+ filterFn: (rec) => {
+ let name = rec.get('name') || '';
+ let desc = rec.get('description') || '';
+ return (
+ name.toLowerCase().includes(lv) ||
+ desc.toLowerCase().includes(lv)
+ );
+ },
+ });
+ } else {
+ store.removeFilter('search-filter');
+ }
+ },
+ },
+ },
+ });
+ }
+
+ me.dockedItems = [
+ {
+ xtype: 'toolbar',
+ dock: 'top',
+ hidden: false,
+ items: topToolbarItems,
},
];
--
2.47.3
^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH pve-manager v2 17/17] RFC: ui: Group custom CPU with resource mappings
2026-04-01 8:00 [PATCH docs/manager/qemu-server v2 00/17] Add API and UI for custom CPU models Arthur Bied-Charreton
` (15 preceding siblings ...)
2026-04-01 8:00 ` [PATCH pve-manager v2 16/17] ui: VMCPUFlagSelector: Add search bar for large lists of flags Arthur Bied-Charreton
@ 2026-04-01 8:00 ` Arthur Bied-Charreton
16 siblings, 0 replies; 18+ messages in thread
From: Arthur Bied-Charreton @ 2026-04-01 8:00 UTC (permalink / raw)
To: pve-devel
As suggested by Fiona on the list [0], create a
"Guest Resources/Hardware" group with "Custom CPU models", "Directory
Mappings", and "Resource Mappings" in the Datacenter menu.
[0]
https://lore.proxmox.com/pve-devel/b9274cb9-0ae1-46aa-a4b5-e10251c1a948@proxmox.com/T/#u
Suggested-by: Fiona Ebner <f.ebner@proxmox.com>
Signed-off-by: Arthur Bied-Charreton <a.bied-charreton@proxmox.com>
---
www/manager6/dc/Config.js | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/www/manager6/dc/Config.js b/www/manager6/dc/Config.js
index ad830ba8..119aba18 100644
--- a/www/manager6/dc/Config.js
+++ b/www/manager6/dc/Config.js
@@ -379,6 +379,21 @@ Ext.define('PVE.dc.Config', {
);
}
+ if (
+ caps.mapping['Mapping.Audit'] ||
+ caps.mapping['Mapping.Use'] ||
+ caps.mapping['Mapping.Modify'] ||
+ caps.dc['Sys.Audit']
+ ) {
+ me.items.push({
+ xtype: 'pveGuestResourcesAndHardwareView',
+ title: gettext('Guest Resources/Hardware'),
+ iconCls: 'fa fa-sitemap',
+ itemId: 'guestresourcesandhardware',
+ expandedOnInit: true,
+ });
+ }
+
if (
caps.mapping['Mapping.Audit'] ||
caps.mapping['Mapping.Use'] ||
@@ -387,6 +402,7 @@ Ext.define('PVE.dc.Config', {
me.items.push(
{
xtype: 'container',
+ groups: ['guestresourcesandhardware'],
onlineHelp: 'resource_mapping',
title: gettext('Resource Mappings'),
itemId: 'resources',
@@ -420,6 +436,7 @@ Ext.define('PVE.dc.Config', {
},
{
xtype: 'pveDcDirMapView',
+ groups: ['guestresourcesandhardware'],
itemId: 'directories',
title: gettext('Directory Mappings'),
iconCls: 'fa fa-folder',
@@ -430,6 +447,7 @@ Ext.define('PVE.dc.Config', {
if (caps.dc['Sys.Audit']) {
me.items.push({
xtype: 'pveCPUTypeView',
+ groups: ['guestresourcesandhardware'],
iconCls: 'fa fa-microchip',
title: gettext('Custom CPU models'),
itemId: 'cputypes',
--
2.47.3
^ permalink raw reply [flat|nested] 18+ messages in thread
end of thread, other threads:[~2026-04-01 8:03 UTC | newest]
Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-04-01 8:00 [PATCH docs/manager/qemu-server v2 00/17] Add API and UI for custom CPU models Arthur Bied-Charreton
2026-04-01 8:00 ` [PATCH pve-docs v2 01/17] qm: Add anchor to "CPU Type" section Arthur Bied-Charreton
2026-04-01 8:00 ` [PATCH qemu-server v2 02/17] cpu config: Rename CPU models config path variable Arthur Bied-Charreton
2026-04-01 8:00 ` [PATCH qemu-server v2 03/17] cpu flags: Create CPUFlags module Arthur Bied-Charreton
2026-04-01 8:00 ` [PATCH qemu-server v2 04/17] cpu flags: Add query_available_cpu_flags helper Arthur Bied-Charreton
2026-04-01 8:00 ` [PATCH qemu-server v2 05/17] cpu config: Add helpers to lock and write config Arthur Bied-Charreton
2026-04-01 8:00 ` [PATCH qemu-server v2 06/17] cpu: Register standard option for CPU format Arthur Bied-Charreton
2026-04-01 8:00 ` [PATCH qemu-server v2 07/17] cpu config: Set 'type' field before writing Arthur Bied-Charreton
2026-04-01 8:00 ` [PATCH qemu-server v2 08/17] cpu flags: Improve flags list returned by endpoint Arthur Bied-Charreton
2026-04-01 8:00 ` [PATCH pve-manager v2 09/17] api: Add endpoint querying available CPU flags cluster-wide Arthur Bied-Charreton
2026-04-01 8:00 ` [PATCH pve-manager v2 10/17] api: Add CRUD handlers for custom CPU models Arthur Bied-Charreton
2026-04-01 8:00 ` [PATCH pve-manager v2 11/17] ui: CPUModelSelector: Allow filtering out custom models Arthur Bied-Charreton
2026-04-01 8:00 ` [PATCH pve-manager v2 12/17] ui: Add basic custom CPU model editor Arthur Bied-Charreton
2026-04-01 8:00 ` [PATCH pve-manager v2 13/17] ui: VMCPUFlagSelector: Add CPU flag editor for custom models Arthur Bied-Charreton
2026-04-01 8:00 ` [PATCH pve-manager v2 14/17] ui: VMCPUFlagSelector: Fix buffered rendering error Arthur Bied-Charreton
2026-04-01 8:00 ` [PATCH pve-manager v2 15/17] ui: VMCPUFlagSelector: Allow filtering out flags supported on 0 nodes Arthur Bied-Charreton
2026-04-01 8:00 ` [PATCH pve-manager v2 16/17] ui: VMCPUFlagSelector: Add search bar for large lists of flags Arthur Bied-Charreton
2026-04-01 8:00 ` [PATCH pve-manager v2 17/17] RFC: ui: Group custom CPU with resource mappings Arthur Bied-Charreton
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox