[PATCH 1/4] Introduce EXPAND_CPU_FEATURES flag for domain capabilities

Jiri Denemark via Devel posted 4 patches 1 week, 5 days ago
[PATCH 1/4] Introduce EXPAND_CPU_FEATURES flag for domain capabilities
Posted by Jiri Denemark via Devel 1 week, 5 days ago
From: Jiri Denemark <jdenemar@redhat.com>

The new VIR_CONNECT_GET_DOMAIN_CAPABILITIES_EXPAND_CPU_FEATURES flag for
virConnectGetDomainCapabilities can be used to request the host-model
CPU definition to include all supported features (normally only extra
features relative to the selected CPU model are listed).

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
---
 include/libvirt/libvirt-domain.h | 2 ++
 src/libvirt-domain.c             | 5 +++++
 2 files changed, 7 insertions(+)

diff --git a/include/libvirt/libvirt-domain.h b/include/libvirt/libvirt-domain.h
index d82406fe05..ccc2c87ea8 100644
--- a/include/libvirt/libvirt-domain.h
+++ b/include/libvirt/libvirt-domain.h
@@ -1517,6 +1517,8 @@ int virDomainMigrateStartPostCopy(virDomainPtr domain,
 typedef enum {
     /* Report host model with deprecated features disabled. (Since: 11.0.0) */
     VIR_CONNECT_GET_DOMAIN_CAPABILITIES_DISABLE_DEPRECATED_FEATURES = (1 << 0),
+    /* Report all host model CPU features. (Since: 12.2.0) */
+    VIR_CONNECT_GET_DOMAIN_CAPABILITIES_EXPAND_CPU_FEATURES = (1 << 1),
 } virConnectGetDomainCapabilitiesFlags;
 
 char * virConnectGetDomainCapabilities(virConnectPtr conn,
diff --git a/src/libvirt-domain.c b/src/libvirt-domain.c
index a1f6efde20..6b8783d57f 100644
--- a/src/libvirt-domain.c
+++ b/src/libvirt-domain.c
@@ -12330,6 +12330,11 @@ virDomainSetUserPassword(virDomainPtr dom,
  * instance, if host, libvirt and qemu is capable of VFIO
  * passthrough and so on.
  *
+ * If @flags includes VIR_CONNECT_GET_DOMAIN_CAPABILITIES_EXPAND_CPU_FEATURES,
+ * libvirt will explicitly list all CPU features (in host-model CPU definition)
+ * that are supported on the host. Without this flag features that are part of
+ * the CPU model itself will not be listed.
+ *
  * Returns NULL in case of error or an XML string
  * defining the capabilities.
  *
-- 
2.53.0