Remove probing of CPU models when launching QEMU guests

When launching a QEMU guest the binary is probed to discover
the list of supported CPU names. Remove this probing with a
simple lookup of CPU models in the qemuCapsPtr object. This
avoids another invocation of the QEMU binary during the
startup path.

As a nice benefit we can now remove all the nasty hacks from
the test suite which were done to avoid having to exec QEMU
on the test system. The building of the -cpu command line
can just rely on data we pre-populate in qemuCapsPtr.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
This commit is contained in:
Daniel P. Berrange 2012-08-22 16:28:55 +01:00
parent bd66c243b3
commit ed769e1854
55 changed files with 104 additions and 162 deletions

View File

@ -1683,6 +1683,24 @@ unsigned int qemuCapsGetKVMVersion(qemuCapsPtr caps)
}
int qemuCapsAddCPUDefinition(qemuCapsPtr caps,
const char *name)
{
char *tmp = strdup(name);
if (!tmp) {
virReportOOMError();
return -1;
}
if (VIR_EXPAND_N(caps->cpuDefinitions, caps->ncpuDefinitions, 1) < 0) {
VIR_FREE(tmp);
virReportOOMError();
return -1;
}
caps->cpuDefinitions[caps->ncpuDefinitions-1] = tmp;
return 0;
}
size_t qemuCapsGetCPUDefinitions(qemuCapsPtr caps,
char ***names)
{

View File

@ -180,6 +180,8 @@ const char *qemuCapsGetBinary(qemuCapsPtr caps);
const char *qemuCapsGetArch(qemuCapsPtr caps);
unsigned int qemuCapsGetVersion(qemuCapsPtr caps);
unsigned int qemuCapsGetKVMVersion(qemuCapsPtr caps);
int qemuCapsAddCPUDefinition(qemuCapsPtr caps,
const char *name);
size_t qemuCapsGetCPUDefinitions(qemuCapsPtr caps,
char ***names);
size_t qemuCapsGetMachineTypes(qemuCapsPtr caps,

View File

@ -4067,7 +4067,7 @@ qemuBuildCpuArgStr(const struct qemud_driver *driver,
virCPUDefPtr guest = NULL;
virCPUDefPtr cpu = NULL;
size_t ncpus = 0;
const char **cpus = NULL;
char **cpus = NULL;
const char *default_model;
union cpuData *data = NULL;
bool have_cpu = false;
@ -4089,12 +4089,8 @@ qemuBuildCpuArgStr(const struct qemud_driver *driver,
const char *preferred;
int hasSVM;
if (host &&
qemuCapsProbeCPUModels(emulator, caps, host->arch,
&ncpus, &cpus) < 0)
goto cleanup;
if (!ncpus || !host) {
if (!host ||
(ncpus = qemuCapsGetCPUDefinitions(caps, &cpus)) == 0) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("CPU specification not supported by hypervisor"));
goto cleanup;
@ -4163,7 +4159,7 @@ qemuBuildCpuArgStr(const struct qemud_driver *driver,
guest->type = VIR_CPU_TYPE_GUEST;
guest->fallback = cpu->fallback;
if (cpuDecode(guest, data, cpus, ncpus, preferred) < 0)
if (cpuDecode(guest, data, (const char **)cpus, ncpus, preferred) < 0)
goto cleanup;
virBufferAdd(&buf, guest->model, -1);
@ -4244,12 +4240,6 @@ cleanup:
virCPUDefFree(guest);
virCPUDefFree(cpu);
if (cpus) {
for (i = 0; i < ncpus; i++)
VIR_FREE(cpus[i]);
VIR_FREE(cpus);
}
return ret;
no_memory:

View File

@ -1,50 +0,0 @@
candidates="/usr/bin/qemu-kvm
/usr/libexec/qemu-kvm
/usr/bin/qemu-system-x86_64
/usr/bin/qemu"
qemu=
for candidate in $candidates; do
if test -x $candidate; then
qemu=$candidate
break
fi
done
real_qemu()
{
if test x$qemu != x; then
exec $qemu "$@"
else
return 1
fi
}
faked_machine()
{
echo "pc"
}
faked_cpu()
{
cat <<EOF
x86 Opteron_G3
x86 Opteron_G2
x86 Opteron_G1
x86 Nehalem
x86 Penryn
x86 Conroe
x86 [n270]
x86 [athlon]
x86 [pentium3]
x86 [pentium2]
x86 [pentium]
x86 [486]
x86 [coreduo]
x86 [qemu32]
x86 [kvm64]
x86 [core2duo]
x86 [phenom]
x86 [qemu64]
x86 [host]
EOF
}

View File

@ -1,15 +0,0 @@
#! /bin/sh
. ${0%/*}/qemu-lib.sh
case $* in
"-M ?")
faked_machine
;;
"-cpu ?")
faked_cpu | grep -Fv '['
;;
*)
real_qemu "$@"
;;
esac

View File

@ -1,15 +0,0 @@
#! /bin/sh
. ${0%/*}/qemu-lib.sh
case $* in
"-M ?")
faked_machine
;;
"-cpu ?")
faked_cpu
;;
*)
real_qemu "$@"
;;
esac

View File

@ -1,4 +1,4 @@
LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test ./qemu.sh -S -M pc \
LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu -S -M pc \
-cpu qemu32,-kvm_pv_eoi -m 214 -smp 6 -nographic -monitor \
unix:/tmp/test-monitor,server,nowait -boot n -net none -serial none \
-parallel none -usb

View File

@ -21,7 +21,7 @@
<on_reboot>restart</on_reboot>
<on_crash>destroy</on_crash>
<devices>
<emulator>/./qemu.sh</emulator>
<emulator>/usr/bin/qemu</emulator>
<controller type='usb' index='0'/>
<memballoon model='virtio'/>
</devices>

View File

@ -1,4 +1,4 @@
LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test ./qemu.sh -S -M pc \
LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu -S -M pc \
-cpu qemu32,+kvm_pv_eoi -m 214 -smp 6 -nographic -monitor \
unix:/tmp/test-monitor,server,nowait -boot n -net none -serial none \
-parallel none -usb

View File

@ -21,7 +21,7 @@
<on_reboot>restart</on_reboot>
<on_crash>destroy</on_crash>
<devices>
<emulator>/./qemu.sh</emulator>
<emulator>/usr/bin/qemu</emulator>
<controller type='usb' index='0'/>
<memballoon model='virtio'/>
</devices>

View File

@ -1,4 +1,4 @@
LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test ./qemu.sh -S -M pc \
LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu -S -M pc \
-cpu qemu64,-svm,-lm,-nx,-syscall,-clflush,-pse36,-mca -m 214 -smp 6 \
-nographic -monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot n -net \
none -serial none -parallel none -usb

View File

@ -23,6 +23,6 @@
<on_reboot>restart</on_reboot>
<on_crash>destroy</on_crash>
<devices>
<emulator>/./qemu.sh</emulator>
<emulator>/usr/bin/qemu</emulator>
</devices>
</domain>

View File

@ -1,4 +1,4 @@
LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test ./qemu.sh -S -M pc \
LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu -S -M pc \
-cpu core2duo,+lahf_lm,+3dnowext,+xtpr,+ds_cpl,+tm,+ht,+ds,-nx -m 214 -smp 6 \
-nographic -monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot n -net \
none -serial none -parallel none -usb

View File

@ -30,6 +30,6 @@
<on_reboot>restart</on_reboot>
<on_crash>destroy</on_crash>
<devices>
<emulator>/./qemu.sh</emulator>
<emulator>/usr/bin/qemu</emulator>
</devices>
</domain>

View File

@ -1,4 +1,4 @@
LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test ./qemu.sh -S -M pc \
LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu -S -M pc \
-cpu core2duo,+lahf_lm,+3dnowext,+xtpr,+ds_cpl,+tm,+ht,+ds,-nx -m 214 -smp 6 \
-nographic -monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot n -net \
none -serial none -parallel none -usb

View File

@ -30,6 +30,6 @@
<on_reboot>restart</on_reboot>
<on_crash>destroy</on_crash>
<devices>
<emulator>/./qemu.sh</emulator>
<emulator>/usr/bin/qemu</emulator>
</devices>
</domain>

View File

@ -3,7 +3,7 @@ PATH=/bin \
HOME=/home/test \
USER=test \
LOGNAME=test \
./qemu.sh \
/usr/bin/qemu \
-S \
-M pc \
-cpu Penryn,-sse4.1 \

View File

@ -20,6 +20,6 @@
<on_reboot>restart</on_reboot>
<on_crash>destroy</on_crash>
<devices>
<emulator>/./qemu.sh</emulator>
<emulator>/usr/bin/qemu</emulator>
</devices>
</domain>

View File

@ -1,4 +1,4 @@
LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test ./qemu.sh -S -M pc \
LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu -S -M pc \
-cpu host,-kvmclock -enable-kvm -m 214 -smp 6 \
-nographic -monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot n -net \
none -serial none -parallel none -usb

View File

@ -17,7 +17,7 @@
<on_reboot>restart</on_reboot>
<on_crash>destroy</on_crash>
<devices>
<emulator>/./qemu.sh</emulator>
<emulator>/usr/bin/qemu</emulator>
<controller type='usb' index='0'/>
<memballoon model='virtio'/>
</devices>

View File

@ -3,7 +3,7 @@ PATH=/bin \
HOME=/home/test \
USER=test \
LOGNAME=test \
./qemu-supported-cpus.sh \
/usr/bin/qemu \
-S \
-M pc \
-cpu Penryn,+xtpr,+tm2,+est,+vmx,+ds_cpl,+monitor,+pbe,+tm,+ht,+ss,+acpi,+ds,+vme,-sse4.1 \

View File

@ -14,6 +14,6 @@
<on_reboot>restart</on_reboot>
<on_crash>destroy</on_crash>
<devices>
<emulator>/./qemu-supported-cpus.sh</emulator>
<emulator>/usr/bin/qemu</emulator>
</devices>
</domain>

View File

@ -16,6 +16,6 @@
<on_reboot>restart</on_reboot>
<on_crash>destroy</on_crash>
<devices>
<emulator>/./qemu-supported-cpus.sh</emulator>
<emulator>/usr/bin/qemu</emulator>
</devices>
</domain>

View File

@ -3,7 +3,7 @@ PATH=/bin \
HOME=/home/test \
USER=test \
LOGNAME=test \
./qemu.sh \
/usr/bin/qemu \
-S \
-M pc \
-cpu core2duo,+lahf_lm,+xtpr,+cx16,+tm2,+est,+vmx,+ds_cpl,+pbe,+tm,+ht,+ss,+acpi,+ds \

View File

@ -14,6 +14,6 @@
<on_reboot>restart</on_reboot>
<on_crash>destroy</on_crash>
<devices>
<emulator>/./qemu.sh</emulator>
<emulator>/usr/bin/qemu</emulator>
</devices>
</domain>

View File

@ -3,7 +3,7 @@ PATH=/bin \
HOME=/home/test \
USER=test \
LOGNAME=test \
./qemu.sh \
/usr/bin/qemu \
-S \
-M pc \
-cpu host \

View File

@ -14,6 +14,6 @@
<on_reboot>restart</on_reboot>
<on_crash>destroy</on_crash>
<devices>
<emulator>/./qemu.sh</emulator>
<emulator>/usr/bin/qemu</emulator>
</devices>
</domain>

View File

@ -1,4 +1,4 @@
LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test ./qemu.sh -S -M pc \
LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu -S -M pc \
-cpu core2duo,-kvmclock -enable-kvm -m 214 -smp 6 \
-nographic -monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot n -net \
none -serial none -parallel none -usb

View File

@ -18,7 +18,7 @@
<on_reboot>restart</on_reboot>
<on_crash>destroy</on_crash>
<devices>
<emulator>/./qemu.sh</emulator>
<emulator>/usr/bin/qemu</emulator>
<controller type='usb' index='0'/>
<memballoon model='virtio'/>
</devices>

View File

@ -1,4 +1,4 @@
LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test ./qemu.sh -S -M pc \
LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu -S -M pc \
-cpu core2duo,+lahf_lm,+xtpr,+cx16,+tm2,+est,+vmx,+ds_cpl,+pbe,+tm,+ht,+ss,\
+acpi,+ds -m 214 -smp 6 -nographic -monitor unix:/tmp/test-monitor,server,\
nowait -no-acpi -boot n -net none -serial none -parallel none -usb

View File

@ -16,6 +16,6 @@
<on_reboot>restart</on_reboot>
<on_crash>destroy</on_crash>
<devices>
<emulator>/./qemu.sh</emulator>
<emulator>/usr/bin/qemu</emulator>
</devices>
</domain>

View File

@ -1,4 +1,4 @@
LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test ./qemu.sh -S -M pc \
LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu -S -M pc \
-cpu core2duo,+lahf_lm,+xtpr,+cx16,+tm2,+est,+vmx,+ds_cpl,+pbe,+tm,+ht,+ss,\
+acpi,+ds,-lm,-nx,-syscall -m 214 -smp 6 -nographic -monitor \
unix:/tmp/test-monitor,server,nowait -no-acpi -boot n -net none -serial none \

View File

@ -20,6 +20,6 @@
<on_reboot>restart</on_reboot>
<on_crash>destroy</on_crash>
<devices>
<emulator>/./qemu.sh</emulator>
<emulator>/usr/bin/qemu</emulator>
</devices>
</domain>

View File

@ -20,6 +20,6 @@
<on_reboot>restart</on_reboot>
<on_crash>destroy</on_crash>
<devices>
<emulator>/./qemu.sh</emulator>
<emulator>/usr/bin/qemu</emulator>
</devices>
</domain>

View File

@ -1,4 +1,4 @@
LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test ./qemu.sh -S -M pc \
LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu -S -M pc \
-m 214 -smp 16 -numa node,nodeid=0,cpus=0-7,mem=107 \
-numa node,nodeid=1,cpus=8-15,mem=107 -nographic -monitor \
unix:/tmp/test-monitor,server,nowait -no-acpi -boot n -net none -serial none \

View File

@ -20,6 +20,6 @@
<on_reboot>restart</on_reboot>
<on_crash>destroy</on_crash>
<devices>
<emulator>/./qemu.sh</emulator>
<emulator>/usr/bin/qemu</emulator>
</devices>
</domain>

View File

@ -1,4 +1,4 @@
LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test ./qemu.sh -S -M pc \
LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu -S -M pc \
-m 214 -smp 16,sockets=2,cores=4,threads=2 \
-numa node,nodeid=0,cpus=0-7,mem=107 \
-numa node,nodeid=1,cpus=8-15,mem=107 -nographic -monitor \

View File

@ -20,6 +20,6 @@
<on_reboot>restart</on_reboot>
<on_crash>destroy</on_crash>
<devices>
<emulator>/./qemu.sh</emulator>
<emulator>/usr/bin/qemu</emulator>
</devices>
</domain>

View File

@ -14,6 +14,6 @@
<on_reboot>restart</on_reboot>
<on_crash>destroy</on_crash>
<devices>
<emulator>/./qemu.sh</emulator>
<emulator>/usr/bin/qemu</emulator>
</devices>
</domain>

View File

@ -1,4 +1,4 @@
LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test ./qemu.sh -S -M pc \
LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu -S -M pc \
-cpu core2duo,+lahf_lm,+3dnowext,+xtpr,+est,+vmx,+ds_cpl,+tm,+ht,+acpi,+ds,-nx \
-m 214 -smp 6 -nographic -monitor unix:/tmp/test-monitor,server,nowait \
-no-acpi -boot n -net none -serial none -parallel none -usb

View File

@ -33,6 +33,6 @@
<on_reboot>restart</on_reboot>
<on_crash>destroy</on_crash>
<devices>
<emulator>/./qemu.sh</emulator>
<emulator>/usr/bin/qemu</emulator>
</devices>
</domain>

View File

@ -1,4 +1,4 @@
LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test ./qemu.sh -S -M pc \
LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu -S -M pc \
-m 214 -smp 6,sockets=3,cores=2,threads=1 -nographic -monitor \
unix:/tmp/test-monitor,server,nowait -no-acpi -boot n -net none -serial none \
-parallel none -usb

View File

@ -16,6 +16,6 @@
<on_reboot>restart</on_reboot>
<on_crash>destroy</on_crash>
<devices>
<emulator>/./qemu.sh</emulator>
<emulator>/usr/bin/qemu</emulator>
</devices>
</domain>

View File

@ -1,4 +1,4 @@
LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test ./qemu.sh -S -M pc \
LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu -S -M pc \
-cpu core2duo -m 214 -smp 6,sockets=1,cores=2,threads=3 -nographic -monitor \
unix:/tmp/test-monitor,server,nowait -no-acpi -boot n -net none -serial none \
-parallel none -usb

View File

@ -17,6 +17,6 @@
<on_reboot>restart</on_reboot>
<on_crash>destroy</on_crash>
<devices>
<emulator>/./qemu.sh</emulator>
<emulator>/usr/bin/qemu</emulator>
</devices>
</domain>

View File

@ -1,3 +1,3 @@
LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test ./qemu.sh -S -M pc \
LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu -S -M pc \
-m 214 -smp 6 -nographic -monitor unix:/tmp/test-monitor,server,nowait \
-no-acpi -boot n -net none -serial none -parallel none -usb

View File

@ -16,6 +16,6 @@
<on_reboot>restart</on_reboot>
<on_crash>destroy</on_crash>
<devices>
<emulator>/./qemu.sh</emulator>
<emulator>/usr/bin/qemu</emulator>
</devices>
</domain>

View File

@ -1,4 +1,4 @@
LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test ./qemu.sh -S -M pc \
LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu -S -M pc \
-cpu qemu32,-kvm_pv_eoi -m 214 -smp 6 -nographic -monitor \
unix:/tmp/test-monitor,server,nowait -boot n -net none -serial \
none -parallel none -usb

View File

@ -18,7 +18,7 @@
<on_reboot>restart</on_reboot>
<on_crash>destroy</on_crash>
<devices>
<emulator>/./qemu.sh</emulator>
<emulator>/usr/bin/qemu</emulator>
<controller type='usb' index='0'/>
<memballoon model='virtio'/>
</devices>

View File

@ -1,4 +1,4 @@
LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test ./qemu.sh -S -M pc \
LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu -S -M pc \
-cpu qemu32,+kvm_pv_eoi -m 214 -smp 6 -nographic -monitor \
unix:/tmp/test-monitor,server,nowait -boot n -net none -serial \
none -parallel none -usb

View File

@ -18,7 +18,7 @@
<on_reboot>restart</on_reboot>
<on_crash>destroy</on_crash>
<devices>
<emulator>/./qemu.sh</emulator>
<emulator>/usr/bin/qemu</emulator>
<controller type='usb' index='0'/>
<memballoon model='virtio'/>
</devices>

View File

@ -1,5 +1,5 @@
LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=spice \
./qemu.sh -S -M pc -cpu core2duo,+lahf_lm,+xtpr,+cx16,+tm2,\
/usr/bin/qemu -S -M pc -cpu core2duo,+lahf_lm,+xtpr,+cx16,+tm2,\
+est,+vmx,+ds_cpl,+pbe,+tm,+ht,+ss,+acpi,+ds \
-m 1024 -smp 2 -nodefaults -monitor unix:/tmp/test-monitor,server,nowait \
-boot dc -device virtio-serial-pci,id=virtio-serial0,bus=pci.0,addr=0x6 \

View File

@ -38,7 +38,7 @@
<on_reboot>restart</on_reboot>
<on_crash>restart</on_crash>
<devices>
<emulator>/./qemu.sh</emulator>
<emulator>/usr/bin/qemu</emulator>
<disk type='file' device='disk'>
<driver name='qemu' type='qcow2'/>
<source file='/var/lib/libvirt/images/f14.img'/>

View File

@ -106,26 +106,6 @@ static int testCompareXMLToArgvFiles(const char *xml,
goto out;
}
/*
* For test purposes, we may want to fake emulator's output by providing
* our own script instead of a real emulator. For this to work we need to
* specify a relative path in <emulator/> element, which, however, is not
* allowed by RelaxNG schema for domain XML. To work around it we add an
* extra '/' at the beginning of relative emulator path so that it looks
* like, e.g., "/./qemu.sh" or "/../emulator/qemu.sh" instead of
* "./qemu.sh" or "../emulator/qemu.sh" respectively. The following code
* detects such paths, strips the extra '/' and makes the path absolute.
*/
if (vmdef->emulator && STRPREFIX(vmdef->emulator, "/.")) {
if (!(emulator = strdup(vmdef->emulator + 1)))
goto out;
VIR_FREE(vmdef->emulator);
vmdef->emulator = NULL;
if (virAsprintf(&vmdef->emulator, "%s/qemuxml2argvdata/%s",
abs_srcdir, emulator) < 0)
goto out;
}
if (qemuCapsGet(extraFlags, QEMU_CAPS_DOMID))
vmdef->id = 6;
else
@ -270,12 +250,40 @@ cleanup:
}
static int
testAddCPUModels(qemuCapsPtr caps, bool skipLegacy)
{
const char *newModels[] = {
"Opteron_G3", "Opteron_G2", "Opteron_G1",
"Nehalem", "Penryn", "Conroe",
};
const char *legacyModels[] = {
"n270", "athlon", "pentium3", "pentium2", "pentium",
"486", "coreduo", "kvm32", "qemu32", "kvm64",
"core2duo", "phenom", "qemu64",
};
size_t i;
for (i = 0 ; i < ARRAY_CARDINALITY(newModels) ; i++) {
if (qemuCapsAddCPUDefinition(caps, newModels[i]) < 0)
return -1;
}
if (skipLegacy)
return 0;
for (i = 0 ; i < ARRAY_CARDINALITY(legacyModels) ; i++) {
if (qemuCapsAddCPUDefinition(caps, legacyModels[i]) < 0)
return -1;
}
return 0;
}
static int
mymain(void)
{
int ret = 0;
char *map = NULL;
bool skipLegacyCPUs = false;
abs_top_srcdir = getenv("abs_top_srcdir");
if (!abs_top_srcdir)
@ -307,6 +315,8 @@ mymain(void)
}; \
if (!(info.extraFlags = qemuCapsNew())) \
return EXIT_FAILURE; \
if (testAddCPUModels(info.extraFlags, skipLegacyCPUs) < 0) \
return EXIT_FAILURE; \
qemuCapsSetList(info.extraFlags, __VA_ARGS__, QEMU_CAPS_LAST); \
if (virtTestRun("QEMU XML-2-ARGV " name, \
1, testCompareXMLToArgvHelper, &info) < 0) \
@ -766,8 +776,10 @@ mymain(void)
DO_TEST("cpu-numa1", NONE);
DO_TEST("cpu-numa2", QEMU_CAPS_SMP_TOPOLOGY);
DO_TEST("cpu-host-model", NONE);
skipLegacyCPUs = true;
DO_TEST("cpu-host-model-fallback", NONE);
DO_TEST_FAILURE("cpu-host-model-nofallback", NONE);
skipLegacyCPUs = false;
DO_TEST("cpu-host-passthrough", QEMU_CAPS_KVM, QEMU_CAPS_CPU_HOST);
DO_TEST_FAILURE("cpu-host-passthrough", NONE);
DO_TEST_FAILURE("cpu-qemu-host-passthrough",

View File

@ -38,7 +38,7 @@
<on_reboot>restart</on_reboot>
<on_crash>restart</on_crash>
<devices>
<emulator>/./qemu.sh</emulator>
<emulator>/usr/bin/qemu</emulator>
<disk type='file' device='disk'>
<driver name='qemu' type='qcow2'/>
<source file='/var/lib/libvirt/images/f14.img'/>