mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-08-28 03:21:19 +00:00
qemuxml2argvtest: Properly setup CPU models in qemuCaps
Adding x86 CPU models into a list of supported CPUs for non-x86 architectures is not a very good idea. Each architecture we test needs to maintain its own list of supported CPU models. Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
This commit is contained in:
parent
e9634933ea
commit
b89fa6d1b6
@ -8,7 +8,7 @@ QEMU_AUDIO_DRV=none \
|
|||||||
-name QEMUGuest1 \
|
-name QEMUGuest1 \
|
||||||
-S \
|
-S \
|
||||||
-M pseries \
|
-M pseries \
|
||||||
-cpu POWER7_v2.3 \
|
-cpu POWER7 \
|
||||||
-m 512 \
|
-m 512 \
|
||||||
-smp 1,sockets=1,cores=1,threads=1 \
|
-smp 1,sockets=1,cores=1,threads=1 \
|
||||||
-uuid 1ccfd97d-5eb4-478a-bbe6-88d254c16db7 \
|
-uuid 1ccfd97d-5eb4-478a-bbe6-88d254c16db7 \
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
<type arch='ppc64' machine='pseries'>hvm</type>
|
<type arch='ppc64' machine='pseries'>hvm</type>
|
||||||
</os>
|
</os>
|
||||||
<cpu match='exact'>
|
<cpu match='exact'>
|
||||||
<model>POWER7_v2.3</model>
|
<model>POWER7</model>
|
||||||
<vendor>IBM</vendor>
|
<vendor>IBM</vendor>
|
||||||
</cpu>
|
</cpu>
|
||||||
<clock offset='utc'/>
|
<clock offset='utc'/>
|
||||||
|
@ -283,27 +283,42 @@ struct testInfo {
|
|||||||
static int
|
static int
|
||||||
testAddCPUModels(virQEMUCapsPtr caps, bool skipLegacy)
|
testAddCPUModels(virQEMUCapsPtr caps, bool skipLegacy)
|
||||||
{
|
{
|
||||||
const char *newModels[] = {
|
virArch arch = virQEMUCapsGetArch(caps);
|
||||||
|
const char *x86Models[] = {
|
||||||
"Opteron_G3", "Opteron_G2", "Opteron_G1",
|
"Opteron_G3", "Opteron_G2", "Opteron_G1",
|
||||||
"Nehalem", "Penryn", "Conroe",
|
"Nehalem", "Penryn", "Conroe",
|
||||||
"Haswell-noTSX", "Haswell",
|
"Haswell-noTSX", "Haswell",
|
||||||
};
|
};
|
||||||
const char *legacyModels[] = {
|
const char *x86LegacyModels[] = {
|
||||||
"n270", "athlon", "pentium3", "pentium2", "pentium",
|
"n270", "athlon", "pentium3", "pentium2", "pentium",
|
||||||
"486", "coreduo", "kvm32", "qemu32", "kvm64",
|
"486", "coreduo", "kvm32", "qemu32", "kvm64",
|
||||||
"core2duo", "phenom", "qemu64",
|
"core2duo", "phenom", "qemu64",
|
||||||
};
|
};
|
||||||
|
const char *armModels[] = {
|
||||||
|
"cortex-a9", "cortex-a8", "cortex-a57", "cortex-a53",
|
||||||
|
};
|
||||||
|
const char *ppc64Models[] = {
|
||||||
|
"POWER8", "POWER7",
|
||||||
|
};
|
||||||
|
|
||||||
if (virQEMUCapsAddCPUDefinitions(caps, newModels,
|
if (ARCH_IS_X86(arch)) {
|
||||||
ARRAY_CARDINALITY(newModels)) < 0)
|
if (virQEMUCapsAddCPUDefinitions(caps, x86Models,
|
||||||
return -1;
|
ARRAY_CARDINALITY(x86Models)) < 0)
|
||||||
|
return -1;
|
||||||
|
|
||||||
if (skipLegacy)
|
if (!skipLegacy &&
|
||||||
return 0;
|
virQEMUCapsAddCPUDefinitions(caps, x86LegacyModels,
|
||||||
|
ARRAY_CARDINALITY(x86LegacyModels)) < 0)
|
||||||
if (virQEMUCapsAddCPUDefinitions(caps, legacyModels,
|
return -1;
|
||||||
ARRAY_CARDINALITY(legacyModels)) < 0)
|
} else if (ARCH_IS_ARM(arch)) {
|
||||||
return -1;
|
if (virQEMUCapsAddCPUDefinitions(caps, armModels,
|
||||||
|
ARRAY_CARDINALITY(armModels)) < 0)
|
||||||
|
return -1;
|
||||||
|
} else if (ARCH_IS_PPC64(arch)) {
|
||||||
|
if (virQEMUCapsAddCPUDefinitions(caps, ppc64Models,
|
||||||
|
ARRAY_CARDINALITY(ppc64Models)) < 0)
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user