提交 73411a7f 编写于 作者: J Jiri Denemark

qemu: Avoid reporting "host" as a supported CPU model

"host" CPU model is supported by a special host-passthrough CPU mode and
users is not allowed to specify this model directly with custom mode.
Thus we should not advertise "host" CPU model in domain capabilities.
This worked well on architectures for which libvirt provides a list of
supported CPU models in cpu_map.xml (since "host" is not in the list).
But we need to explicitly filter "host" model out for all other
architectures.
Signed-off-by: NJiri Denemark <jdenemar@redhat.com>
上级 451dc193
......@@ -176,7 +176,8 @@ virDomainCapsCPUModelsCopy(virDomainCapsCPUModelsPtr old)
virDomainCapsCPUModelsPtr
virDomainCapsCPUModelsFilter(virDomainCapsCPUModelsPtr old,
const char **models)
const char **models,
const char **blacklist)
{
virDomainCapsCPUModelsPtr cpuModels;
size_t i;
......@@ -188,6 +189,9 @@ virDomainCapsCPUModelsFilter(virDomainCapsCPUModelsPtr old,
if (models && !virStringListHasString(models, old->models[i].name))
continue;
if (blacklist && virStringListHasString(blacklist, old->models[i].name))
continue;
if (virDomainCapsCPUModelsAdd(cpuModels,
old->models[i].name, -1,
old->models[i].usable) < 0)
......
......@@ -167,7 +167,8 @@ virDomainCapsPtr virDomainCapsNew(const char *path,
virDomainCapsCPUModelsPtr virDomainCapsCPUModelsNew(size_t nmodels);
virDomainCapsCPUModelsPtr virDomainCapsCPUModelsCopy(virDomainCapsCPUModelsPtr old);
virDomainCapsCPUModelsPtr virDomainCapsCPUModelsFilter(virDomainCapsCPUModelsPtr old,
const char **models);
const char **models,
const char **blacklist);
int virDomainCapsCPUModelsAddSteal(virDomainCapsCPUModelsPtr cpuModels,
char **name,
virDomainCapsCPUUsable usable);
......
......@@ -4955,6 +4955,7 @@ virQEMUCapsFillDomainCPUCaps(virCapsPtr caps,
VIR_CPU_MODE_CUSTOM)) {
virDomainCapsCPUModelsPtr filtered = NULL;
char **models = NULL;
const char *blacklist[] = { "host", NULL };
if (virCPUGetModels(domCaps->arch, &models) >= 0) {
virDomainCapsCPUModelsPtr cpus;
......@@ -4965,7 +4966,8 @@ virQEMUCapsFillDomainCPUCaps(virCapsPtr caps,
cpus = qemuCaps->tcgCPUModels;
filtered = virDomainCapsCPUModelsFilter(cpus,
(const char **) models);
(const char **) models,
blacklist);
virStringListFree(models);
}
domCaps->cpu.custom = filtered;
......
......@@ -38,7 +38,6 @@
<model usable='unknown'>sa1110</model>
<model usable='unknown'>arm1176</model>
<model usable='unknown'>cortex-a53</model>
<model usable='unknown'>host</model>
<model usable='unknown'>sa1100</model>
<model usable='unknown'>pxa270-c5</model>
<model usable='unknown'>cortex-a9</model>
......
......@@ -38,7 +38,6 @@
<model usable='unknown'>sa1110</model>
<model usable='unknown'>arm1176</model>
<model usable='unknown'>cortex-a53</model>
<model usable='unknown'>host</model>
<model usable='unknown'>sa1100</model>
<model usable='unknown'>pxa270-c5</model>
<model usable='unknown'>cortex-a9</model>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册