提交 2ba32a86 编写于 作者: J Jiri Denemark

qemu: Filter CPU features returned by qemuConnectBaselineCPU

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=1450317Signed-off-by: NJiri Denemark <jdenemar@redhat.com>
上级 399f9169
......@@ -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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册