Hypervisor baseline cpu can be computed locally using libvirt utility
functions or remotely using QEMU QMP commands.
Likewise, cpu feature expansion can be computed locally using libvirt
utility functions or remotely using QEMU QMP commands.
This patch identifies using libvirt as a distinct case in the hypervisor
baseline logic and triggers that case when the X86 architecture is being
baselined.
There is one functionality change introduced by this patch.
Local libvirt functions are only used for feature expansion when the
local utility functions are used for CPU baseline and an error is
generated when no method is available to expand cpu featues.
The useQEMU option will be introduced in a future patch for using QEMU
to compute baseline rather than using libvirt.
Signed-off-by: Chris Venteicher <cventeic(a)redhat.com>
---
src/qemu/qemu_driver.c | 19 +++++++++++++++----
1 file changed, 15 insertions(+), 4 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 86fc5aa249..4e8a3902d3 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -13709,6 +13709,7 @@ qemuConnectBaselineHypervisorCPU(virConnectPtr conn,
bool migratable;
virCPUDefPtr cpu = NULL;
char *cpustr = NULL;
+ bool useLibvirt = false;
virCheckFlags(VIR_CONNECT_BASELINE_CPU_EXPAND_FEATURES |
VIR_CONNECT_BASELINE_CPU_MIGRATABLE, NULL);
@@ -13728,7 +13729,9 @@ qemuConnectBaselineHypervisorCPU(virConnectPtr conn,
if (!qemuCaps)
goto cleanup;
- if (ARCH_IS_X86(arch)) {
+ useLibvirt = ARCH_IS_X86(arch);
+
+ if (useLibvirt) {
migratable = !!(flags & VIR_CONNECT_BASELINE_CPU_MIGRATABLE);
if (qemuConnectBaselineHypervisorCPUViaLibvirt(qemuCaps, migratable,
@@ -13744,9 +13747,17 @@ qemuConnectBaselineHypervisorCPU(virConnectPtr conn,
cpu->fallback = VIR_CPU_FALLBACK_FORBID;
- if ((flags & VIR_CONNECT_BASELINE_CPU_EXPAND_FEATURES) &&
- virCPUExpandFeatures(arch, cpu) < 0)
- goto cleanup;
+ if (flags & VIR_CONNECT_BASELINE_CPU_EXPAND_FEATURES) {
+ if (useLibvirt && virCPUExpandFeatures(arch, cpu) < 0) {
+ goto cleanup;
+ } else {
+ virReportError(VIR_ERR_OPERATION_UNSUPPORTED,
+ _("expand features while "
+ "computing baseline hypervisor CPU is not supported
"
+ "for arch %s"), virArchToString(arch));
+ goto cleanup;
+ }
+ }
cpustr = virCPUDefFormat(cpu, NULL);
--
2.17.1