The host CPU definitions reported in the capabilities XML may contain CPU features unknown to QEMU, but the result of virConnectBaselineCPU is supposed to be directly usable as a guest CPU definition and thus it should only contain features QEMU knows about. https://bugzilla.redhat.com/show_bug.cgi?id=1450317 Signed-off-by: Jiri Denemark <jdenemar@xxxxxxxxxx> --- src/qemu/qemu_driver.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index e92c114f3e..e1a0dd553e 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -12990,6 +12990,7 @@ qemuConnectBaselineCPU(virConnectPtr conn ATTRIBUTE_UNUSED, unsigned int flags) { virCPUDefPtr *cpus = NULL; + virCPUDefPtr baseline = NULL; virCPUDefPtr cpu = NULL; char *cpustr = NULL; @@ -13002,8 +13003,16 @@ qemuConnectBaselineCPU(virConnectPtr conn ATTRIBUTE_UNUSED, if (!(cpus = virCPUDefListParse(xmlCPUs, ncpus, VIR_CPU_TYPE_HOST))) goto cleanup; - if (!(cpu = cpuBaseline(cpus, ncpus, NULL, 0, - !!(flags & VIR_CONNECT_BASELINE_CPU_MIGRATABLE)))) + if (!(baseline = cpuBaseline(cpus, ncpus, NULL, 0, + !!(flags & VIR_CONNECT_BASELINE_CPU_MIGRATABLE)))) + goto cleanup; + + if (!(cpu = virCPUDefCopyWithoutModel(baseline))) + goto cleanup; + + if (virCPUDefCopyModelFilter(cpu, baseline, false, + virQEMUCapsCPUFilterFeatures, + &cpus[0]->arch) < 0) goto cleanup; if ((flags & VIR_CONNECT_BASELINE_CPU_EXPAND_FEATURES) && @@ -13014,6 +13023,7 @@ qemuConnectBaselineCPU(virConnectPtr conn ATTRIBUTE_UNUSED, cleanup: virCPUDefListFree(cpus); + virCPUDefFree(baseline); virCPUDefFree(cpu); return cpustr; -- 2.14.1 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list