[PATCH v3 5/7] qemu_capabilities: filter deprecated features if requested

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxx>
---
 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 04017ceda7..eda3e6a4df 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -3330,6 +3330,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 8347fd7fbb..6bfe99fce4 100644
--- a/src/qemu/qemu_capabilities.h
+++ b/src/qemu/qemu_capabilities.h
@@ -764,6 +764,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 f1a633fdd3..672b42b44e 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -16530,7 +16530,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;
@@ -16549,6 +16550,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.47.1



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux