[libvirt] [PATCH v5 34/36] qemu_driver: Support feature expansion via QEMU when baselining cpu

Chris Venteicher cventeic at redhat.com
Mon Dec 3 05:10:28 UTC 2018


Support using QEMU to do feature expansion when also using QEMU to
compute hypervisor baseline.

A QEMU process is already created to send the QMP messages to baseline
using QEMU.
The same QEMU process is used for the CPU feature expansion.

QEMU only returns migratable features when expanding CPU model in
architectures where QEMU is used for baseline so no attempt is made to
ask for non-migratable features in expansions when using QEMU for
baseline.

Signed-off-by: Chris Venteicher <cventeic at redhat.com>
---
 src/qemu/qemu_driver.c | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 8c6838f584..4149e4794a 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -13843,6 +13843,27 @@ qemuConnectBaselineHypervisorCPU(virConnectPtr conn,
     if (flags & VIR_CONNECT_BASELINE_CPU_EXPAND_FEATURES) {
         if (useLibvirt && virCPUExpandFeatures(arch, cpu) < 0) {
             goto cleanup;
+        } else if (useQemu &&
+                   virQEMUCapsGet(qemuCaps, QEMU_CAPS_QUERY_CPU_MODEL_EXPANSION)) {
+
+            if (!(modelInfo = virQEMUCapsCPUModelInfoFromCPUDef(cpu)))
+                goto cleanup;
+
+            virCPUDefFree(cpu);
+            cpu = NULL;
+
+            /* QEMU can only include migratable features
+               for all archs that use QEMU for baseline calculation */
+            migratable = true;
+
+            if (qemuMonitorGetCPUModelExpansion(proc->mon,
+                                                QEMU_MONITOR_CPU_MODEL_EXPANSION_FULL,
+                                                migratable, modelInfo, &expansion) < 0)
+                goto cleanup;
+
+            if (!(cpu = virQEMUCapsCPUModelInfoToCPUDef(migratable, expansion)))
+                goto cleanup;
+
         } else {
             virReportError(VIR_ERR_OPERATION_UNSUPPORTED,
                            _("expand features while "
-- 
2.17.1




More information about the libvir-list mailing list