96 lines
3.5 KiB
Diff
96 lines
3.5 KiB
Diff
From 59ec9c201e8849f7231557c6019e1fabd0893240 Mon Sep 17 00:00:00 2001
|
|
Message-ID: <59ec9c201e8849f7231557c6019e1fabd0893240.1749113303.git.jdenemar@redhat.com>
|
|
From: Collin Walling <walling@linux.ibm.com>
|
|
Date: Mon, 16 Dec 2024 18:03:56 -0500
|
|
Subject: [PATCH] qemu_capabilities: filter deprecated features if requested
|
|
|
|
If flag VIR_CONNECT_GET_DOMAIN_CAPABILITIES_DISABLE_DEPRECATED_FEATURES
|
|
is passed to qemuConnectGetDomainCapabilities, then the domain's CPU
|
|
model features will be updated to set any deprecated features to the
|
|
'disabled' policy.
|
|
|
|
Signed-off-by: Collin Walling <walling@linux.ibm.com>
|
|
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
|
|
(cherry picked from commit cd1e837c22182dcadfe17b469c931f9fc9745a46)
|
|
JIRA: https://issues.redhat.com/browse/RHEL-88716
|
|
Signed-off-by: Thomas Huth <thuth@redhat.com>
|
|
---
|
|
src/qemu/qemu_capabilities.c | 20 ++++++++++++++++++++
|
|
src/qemu/qemu_capabilities.h | 3 +++
|
|
src/qemu/qemu_driver.c | 8 +++++++-
|
|
3 files changed, 30 insertions(+), 1 deletion(-)
|
|
|
|
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
|
|
index 98773d2a0a..389b43ab3d 100644
|
|
--- a/src/qemu/qemu_capabilities.c
|
|
+++ b/src/qemu/qemu_capabilities.c
|
|
@@ -3152,6 +3152,26 @@ virQEMUCapsGetCPUFeatures(virQEMUCaps *qemuCaps,
|
|
}
|
|
|
|
|
|
+void
|
|
+virQEMUCapsUpdateCPUDeprecatedFeatures(virQEMUCaps *qemuCaps,
|
|
+ virDomainVirtType virtType,
|
|
+ virCPUDef *cpu)
|
|
+{
|
|
+ qemuMonitorCPUModelInfo *modelInfo;
|
|
+ size_t i;
|
|
+
|
|
+ modelInfo = virQEMUCapsGetCPUModelInfo(qemuCaps, virtType);
|
|
+
|
|
+ if (!modelInfo || !modelInfo->deprecated_props)
|
|
+ return;
|
|
+
|
|
+ for (i = 0; i < g_strv_length(modelInfo->deprecated_props); i++) {
|
|
+ virCPUDefUpdateFeature(cpu, modelInfo->deprecated_props[i],
|
|
+ VIR_CPU_FEATURE_DISABLE);
|
|
+ }
|
|
+}
|
|
+
|
|
+
|
|
struct tpmTypeToCaps {
|
|
int type;
|
|
virQEMUCapsFlags caps;
|
|
diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h
|
|
index 4a7fb2c726..249adf66fa 100644
|
|
--- a/src/qemu/qemu_capabilities.h
|
|
+++ b/src/qemu/qemu_capabilities.h
|
|
@@ -702,6 +702,9 @@ int virQEMUCapsGetCPUFeatures(virQEMUCaps *qemuCaps,
|
|
virDomainVirtType virtType,
|
|
bool migratable,
|
|
char ***features);
|
|
+void virQEMUCapsUpdateCPUDeprecatedFeatures(virQEMUCaps *qemuCaps,
|
|
+ virDomainVirtType virtType,
|
|
+ virCPUDef *cpu);
|
|
|
|
virDomainVirtType virQEMUCapsGetVirtType(virQEMUCaps *qemuCaps);
|
|
|
|
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
|
|
index d3d76c003f..315abe57b0 100644
|
|
--- a/src/qemu/qemu_driver.c
|
|
+++ b/src/qemu/qemu_driver.c
|
|
@@ -17383,7 +17383,8 @@ qemuConnectGetDomainCapabilities(virConnectPtr conn,
|
|
virDomainVirtType virttype;
|
|
g_autoptr(virDomainCaps) domCaps = NULL;
|
|
|
|
- virCheckFlags(0, NULL);
|
|
+ virCheckFlags(VIR_CONNECT_GET_DOMAIN_CAPABILITIES_DISABLE_DEPRECATED_FEATURES,
|
|
+ NULL);
|
|
|
|
if (virConnectGetDomainCapabilitiesEnsureACL(conn) < 0)
|
|
return NULL;
|
|
@@ -17402,6 +17403,11 @@ qemuConnectGetDomainCapabilities(virConnectPtr conn,
|
|
arch, virttype)))
|
|
return NULL;
|
|
|
|
+ if (flags & VIR_CONNECT_GET_DOMAIN_CAPABILITIES_DISABLE_DEPRECATED_FEATURES) {
|
|
+ virQEMUCapsUpdateCPUDeprecatedFeatures(qemuCaps, virttype,
|
|
+ domCaps->cpu.hostModel);
|
|
+ }
|
|
+
|
|
return virDomainCapsFormat(domCaps);
|
|
}
|
|
|
|
--
|
|
2.49.0
|