提交 db873ab3 编写于 作者: J Jiri Denemark

qemu: Adapt to changed ppc64 CPU model names

QEMU 2.11 for ppc64 changed all CPU model names to lower case. Since
libvirt can't change the model names for compatibility reasons, we need
to translate the matching lower case models to the names known by
libvirt.
Signed-off-by: NJiri Denemark <jdenemar@redhat.com>
Reviewed-by: NJán Tomko <jtomko@redhat.com>
上级 b979ec35
......@@ -2437,7 +2437,8 @@ virQEMUCapsProbeQMPMachineProps(virQEMUCapsPtr qemuCaps,
virDomainCapsCPUModelsPtr
virQEMUCapsFetchCPUDefinitions(qemuMonitorPtr mon)
virQEMUCapsFetchCPUDefinitions(qemuMonitorPtr mon,
virArch arch)
{
virDomainCapsCPUModelsPtr models = NULL;
qemuMonitorCPUDefInfoPtr *cpus = NULL;
......@@ -2447,6 +2448,27 @@ virQEMUCapsFetchCPUDefinitions(qemuMonitorPtr mon)
if ((ncpus = qemuMonitorGetCPUDefinitions(mon, &cpus)) < 0)
return NULL;
/* QEMU 2.11 for Power renamed all CPU models to lower case, we need to
* translate them back to libvirt's upper case model names. */
if (ARCH_IS_PPC(arch)) {
VIR_AUTOSTRINGLIST libvirtModels = NULL;
char **name;
if (virCPUGetModels(arch, &libvirtModels) < 0)
goto error;
for (name = libvirtModels; name && *name; name++) {
for (i = 0; i < ncpus; i++) {
if (STRCASENEQ(cpus[i]->name, *name))
continue;
VIR_FREE(cpus[i]->name);
if (VIR_STRDUP(cpus[i]->name, *name) < 0)
goto error;
}
}
}
if (!(models = virDomainCapsCPUModelsNew(ncpus)))
goto error;
......@@ -2486,7 +2508,7 @@ virQEMUCapsProbeQMPCPUDefinitions(virQEMUCapsPtr qemuCaps,
if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_QUERY_CPU_DEFINITIONS))
return 0;
if (!(models = virQEMUCapsFetchCPUDefinitions(mon)))
if (!(models = virQEMUCapsFetchCPUDefinitions(mon, qemuCaps->arch)))
return -1;
if (tcg || !virQEMUCapsGet(qemuCaps, QEMU_CAPS_KVM))
......
......@@ -567,7 +567,8 @@ int virQEMUCapsAddCPUDefinitions(virQEMUCapsPtr qemuCaps,
virDomainCapsCPUUsable usable);
virDomainCapsCPUModelsPtr virQEMUCapsGetCPUDefinitions(virQEMUCapsPtr qemuCaps,
virDomainVirtType type);
virDomainCapsCPUModelsPtr virQEMUCapsFetchCPUDefinitions(qemuMonitorPtr mon);
virDomainCapsCPUModelsPtr virQEMUCapsFetchCPUDefinitions(qemuMonitorPtr mon,
virArch arch);
typedef enum {
/* Host CPU definition reported in domain capabilities. */
......
......@@ -4379,7 +4379,7 @@ qemuProcessFetchCPUDefinitions(virQEMUDriverPtr driver,
if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0)
goto error;
models = virQEMUCapsFetchCPUDefinitions(priv->mon);
models = virQEMUCapsFetchCPUDefinitions(priv->mon, vm->def->os.arch);
if (qemuDomainObjExitMonitor(driver, vm) < 0)
goto error;
......
......@@ -29,7 +29,11 @@
<mode name='host-model' supported='yes'>
<model fallback='allow'>POWER8</model>
</mode>
<mode name='custom' supported='no'/>
<mode name='custom' supported='yes'>
<model usable='unknown'>POWER9</model>
<model usable='unknown'>POWER8</model>
<model usable='unknown'>POWER7</model>
</mode>
</cpu>
<devices>
<disk supported='yes'>
......
......@@ -163,12 +163,12 @@
<cpu type='kvm' name='970mp'/>
<cpu type='kvm' name='970fx'/>
<cpu type='kvm' name='970'/>
<cpu type='kvm' name='power9'/>
<cpu type='kvm' name='POWER9'/>
<cpu type='kvm' name='power8nvl'/>
<cpu type='kvm' name='power8'/>
<cpu type='kvm' name='POWER8'/>
<cpu type='kvm' name='power8e'/>
<cpu type='kvm' name='power7+'/>
<cpu type='kvm' name='power7'/>
<cpu type='kvm' name='POWER7'/>
<cpu type='kvm' name='power5gs'/>
<cpu type='kvm' name='power5+'/>
<cpu type='kvm' name='apollo7pm'/>
......@@ -601,12 +601,12 @@
<cpu type='tcg' name='970mp'/>
<cpu type='tcg' name='970fx'/>
<cpu type='tcg' name='970'/>
<cpu type='tcg' name='power9'/>
<cpu type='tcg' name='POWER9'/>
<cpu type='tcg' name='power8nvl'/>
<cpu type='tcg' name='power8'/>
<cpu type='tcg' name='POWER8'/>
<cpu type='tcg' name='power8e'/>
<cpu type='tcg' name='power7+'/>
<cpu type='tcg' name='power7'/>
<cpu type='tcg' name='POWER7'/>
<cpu type='tcg' name='power5gs'/>
<cpu type='tcg' name='power5+'/>
<cpu type='tcg' name='apollo7pm'/>
......
......@@ -164,12 +164,12 @@
<cpu type='kvm' name='970mp'/>
<cpu type='kvm' name='970fx'/>
<cpu type='kvm' name='970'/>
<cpu type='kvm' name='power9'/>
<cpu type='kvm' name='POWER9'/>
<cpu type='kvm' name='power8nvl'/>
<cpu type='kvm' name='power8'/>
<cpu type='kvm' name='POWER8'/>
<cpu type='kvm' name='power8e'/>
<cpu type='kvm' name='power7+'/>
<cpu type='kvm' name='power7'/>
<cpu type='kvm' name='POWER7'/>
<cpu type='kvm' name='power5gs'/>
<cpu type='kvm' name='power5+'/>
<cpu type='kvm' name='apollo7pm'/>
......@@ -602,12 +602,12 @@
<cpu type='tcg' name='970mp'/>
<cpu type='tcg' name='970fx'/>
<cpu type='tcg' name='970'/>
<cpu type='tcg' name='power9'/>
<cpu type='tcg' name='POWER9'/>
<cpu type='tcg' name='power8nvl'/>
<cpu type='tcg' name='power8'/>
<cpu type='tcg' name='POWER8'/>
<cpu type='tcg' name='power8e'/>
<cpu type='tcg' name='power7+'/>
<cpu type='tcg' name='power7'/>
<cpu type='tcg' name='POWER7'/>
<cpu type='tcg' name='power5gs'/>
<cpu type='tcg' name='power5+'/>
<cpu type='tcg' name='apollo7pm'/>
......
......@@ -166,12 +166,12 @@
<cpu type='kvm' name='ppc'/>
<cpu type='kvm' name='ppc32'/>
<cpu type='kvm' name='ppc64'/>
<cpu type='kvm' name='power9'/>
<cpu type='kvm' name='POWER9'/>
<cpu type='kvm' name='power8nvl'/>
<cpu type='kvm' name='power8'/>
<cpu type='kvm' name='POWER8'/>
<cpu type='kvm' name='power8e'/>
<cpu type='kvm' name='power7+'/>
<cpu type='kvm' name='power7'/>
<cpu type='kvm' name='POWER7'/>
<cpu type='kvm' name='power5gs'/>
<cpu type='kvm' name='power5+'/>
<cpu type='kvm' name='970mp'/>
......@@ -604,12 +604,12 @@
<cpu type='tcg' name='ppc'/>
<cpu type='tcg' name='ppc32'/>
<cpu type='tcg' name='ppc64'/>
<cpu type='tcg' name='power9'/>
<cpu type='tcg' name='POWER9'/>
<cpu type='tcg' name='power8nvl'/>
<cpu type='tcg' name='power8'/>
<cpu type='tcg' name='POWER8'/>
<cpu type='tcg' name='power8e'/>
<cpu type='tcg' name='power7+'/>
<cpu type='tcg' name='power7'/>
<cpu type='tcg' name='POWER7'/>
<cpu type='tcg' name='power5gs'/>
<cpu type='tcg' name='power5+'/>
<cpu type='tcg' name='970mp'/>
......
......@@ -179,12 +179,12 @@
<cpu type='kvm' name='ppc'/>
<cpu type='kvm' name='ppc32'/>
<cpu type='kvm' name='ppc64'/>
<cpu type='kvm' name='power9'/>
<cpu type='kvm' name='POWER9'/>
<cpu type='kvm' name='power8nvl'/>
<cpu type='kvm' name='power8'/>
<cpu type='kvm' name='POWER8'/>
<cpu type='kvm' name='power8e'/>
<cpu type='kvm' name='power7+'/>
<cpu type='kvm' name='power7'/>
<cpu type='kvm' name='POWER7'/>
<cpu type='kvm' name='power5gs'/>
<cpu type='kvm' name='power5+'/>
<cpu type='kvm' name='970mp'/>
......@@ -617,12 +617,12 @@
<cpu type='tcg' name='ppc'/>
<cpu type='tcg' name='ppc32'/>
<cpu type='tcg' name='ppc64'/>
<cpu type='tcg' name='power9'/>
<cpu type='tcg' name='POWER9'/>
<cpu type='tcg' name='power8nvl'/>
<cpu type='tcg' name='power8'/>
<cpu type='tcg' name='POWER8'/>
<cpu type='tcg' name='power8e'/>
<cpu type='tcg' name='power7+'/>
<cpu type='tcg' name='power7'/>
<cpu type='tcg' name='POWER7'/>
<cpu type='tcg' name='power5gs'/>
<cpu type='tcg' name='power5+'/>
<cpu type='tcg' name='970mp'/>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册