mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-09 22:45:21 +00:00
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:
parent
bd66c243b3
commit
ed769e1854
@ -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,
|
size_t qemuCapsGetCPUDefinitions(qemuCapsPtr caps,
|
||||||
char ***names)
|
char ***names)
|
||||||
{
|
{
|
||||||
|
@ -180,6 +180,8 @@ const char *qemuCapsGetBinary(qemuCapsPtr caps);
|
|||||||
const char *qemuCapsGetArch(qemuCapsPtr caps);
|
const char *qemuCapsGetArch(qemuCapsPtr caps);
|
||||||
unsigned int qemuCapsGetVersion(qemuCapsPtr caps);
|
unsigned int qemuCapsGetVersion(qemuCapsPtr caps);
|
||||||
unsigned int qemuCapsGetKVMVersion(qemuCapsPtr caps);
|
unsigned int qemuCapsGetKVMVersion(qemuCapsPtr caps);
|
||||||
|
int qemuCapsAddCPUDefinition(qemuCapsPtr caps,
|
||||||
|
const char *name);
|
||||||
size_t qemuCapsGetCPUDefinitions(qemuCapsPtr caps,
|
size_t qemuCapsGetCPUDefinitions(qemuCapsPtr caps,
|
||||||
char ***names);
|
char ***names);
|
||||||
size_t qemuCapsGetMachineTypes(qemuCapsPtr caps,
|
size_t qemuCapsGetMachineTypes(qemuCapsPtr caps,
|
||||||
|
@ -4067,7 +4067,7 @@ qemuBuildCpuArgStr(const struct qemud_driver *driver,
|
|||||||
virCPUDefPtr guest = NULL;
|
virCPUDefPtr guest = NULL;
|
||||||
virCPUDefPtr cpu = NULL;
|
virCPUDefPtr cpu = NULL;
|
||||||
size_t ncpus = 0;
|
size_t ncpus = 0;
|
||||||
const char **cpus = NULL;
|
char **cpus = NULL;
|
||||||
const char *default_model;
|
const char *default_model;
|
||||||
union cpuData *data = NULL;
|
union cpuData *data = NULL;
|
||||||
bool have_cpu = false;
|
bool have_cpu = false;
|
||||||
@ -4089,12 +4089,8 @@ qemuBuildCpuArgStr(const struct qemud_driver *driver,
|
|||||||
const char *preferred;
|
const char *preferred;
|
||||||
int hasSVM;
|
int hasSVM;
|
||||||
|
|
||||||
if (host &&
|
if (!host ||
|
||||||
qemuCapsProbeCPUModels(emulator, caps, host->arch,
|
(ncpus = qemuCapsGetCPUDefinitions(caps, &cpus)) == 0) {
|
||||||
&ncpus, &cpus) < 0)
|
|
||||||
goto cleanup;
|
|
||||||
|
|
||||||
if (!ncpus || !host) {
|
|
||||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||||
_("CPU specification not supported by hypervisor"));
|
_("CPU specification not supported by hypervisor"));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
@ -4163,7 +4159,7 @@ qemuBuildCpuArgStr(const struct qemud_driver *driver,
|
|||||||
|
|
||||||
guest->type = VIR_CPU_TYPE_GUEST;
|
guest->type = VIR_CPU_TYPE_GUEST;
|
||||||
guest->fallback = cpu->fallback;
|
guest->fallback = cpu->fallback;
|
||||||
if (cpuDecode(guest, data, cpus, ncpus, preferred) < 0)
|
if (cpuDecode(guest, data, (const char **)cpus, ncpus, preferred) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
virBufferAdd(&buf, guest->model, -1);
|
virBufferAdd(&buf, guest->model, -1);
|
||||||
@ -4244,12 +4240,6 @@ cleanup:
|
|||||||
virCPUDefFree(guest);
|
virCPUDefFree(guest);
|
||||||
virCPUDefFree(cpu);
|
virCPUDefFree(cpu);
|
||||||
|
|
||||||
if (cpus) {
|
|
||||||
for (i = 0; i < ncpus; i++)
|
|
||||||
VIR_FREE(cpus[i]);
|
|
||||||
VIR_FREE(cpus);
|
|
||||||
}
|
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
no_memory:
|
no_memory:
|
||||||
|
@ -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
|
|
||||||
}
|
|
@ -1,15 +0,0 @@
|
|||||||
#! /bin/sh
|
|
||||||
|
|
||||||
. ${0%/*}/qemu-lib.sh
|
|
||||||
|
|
||||||
case $* in
|
|
||||||
"-M ?")
|
|
||||||
faked_machine
|
|
||||||
;;
|
|
||||||
"-cpu ?")
|
|
||||||
faked_cpu | grep -Fv '['
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
real_qemu "$@"
|
|
||||||
;;
|
|
||||||
esac
|
|
@ -1,15 +0,0 @@
|
|||||||
#! /bin/sh
|
|
||||||
|
|
||||||
. ${0%/*}/qemu-lib.sh
|
|
||||||
|
|
||||||
case $* in
|
|
||||||
"-M ?")
|
|
||||||
faked_machine
|
|
||||||
;;
|
|
||||||
"-cpu ?")
|
|
||||||
faked_cpu
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
real_qemu "$@"
|
|
||||||
;;
|
|
||||||
esac
|
|
@ -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 \
|
-cpu qemu32,-kvm_pv_eoi -m 214 -smp 6 -nographic -monitor \
|
||||||
unix:/tmp/test-monitor,server,nowait -boot n -net none -serial none \
|
unix:/tmp/test-monitor,server,nowait -boot n -net none -serial none \
|
||||||
-parallel none -usb
|
-parallel none -usb
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
<on_reboot>restart</on_reboot>
|
<on_reboot>restart</on_reboot>
|
||||||
<on_crash>destroy</on_crash>
|
<on_crash>destroy</on_crash>
|
||||||
<devices>
|
<devices>
|
||||||
<emulator>/./qemu.sh</emulator>
|
<emulator>/usr/bin/qemu</emulator>
|
||||||
<controller type='usb' index='0'/>
|
<controller type='usb' index='0'/>
|
||||||
<memballoon model='virtio'/>
|
<memballoon model='virtio'/>
|
||||||
</devices>
|
</devices>
|
||||||
|
@ -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 \
|
-cpu qemu32,+kvm_pv_eoi -m 214 -smp 6 -nographic -monitor \
|
||||||
unix:/tmp/test-monitor,server,nowait -boot n -net none -serial none \
|
unix:/tmp/test-monitor,server,nowait -boot n -net none -serial none \
|
||||||
-parallel none -usb
|
-parallel none -usb
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
<on_reboot>restart</on_reboot>
|
<on_reboot>restart</on_reboot>
|
||||||
<on_crash>destroy</on_crash>
|
<on_crash>destroy</on_crash>
|
||||||
<devices>
|
<devices>
|
||||||
<emulator>/./qemu.sh</emulator>
|
<emulator>/usr/bin/qemu</emulator>
|
||||||
<controller type='usb' index='0'/>
|
<controller type='usb' index='0'/>
|
||||||
<memballoon model='virtio'/>
|
<memballoon model='virtio'/>
|
||||||
</devices>
|
</devices>
|
||||||
|
@ -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 \
|
-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 \
|
-nographic -monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot n -net \
|
||||||
none -serial none -parallel none -usb
|
none -serial none -parallel none -usb
|
||||||
|
@ -23,6 +23,6 @@
|
|||||||
<on_reboot>restart</on_reboot>
|
<on_reboot>restart</on_reboot>
|
||||||
<on_crash>destroy</on_crash>
|
<on_crash>destroy</on_crash>
|
||||||
<devices>
|
<devices>
|
||||||
<emulator>/./qemu.sh</emulator>
|
<emulator>/usr/bin/qemu</emulator>
|
||||||
</devices>
|
</devices>
|
||||||
</domain>
|
</domain>
|
||||||
|
@ -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 \
|
-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 \
|
-nographic -monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot n -net \
|
||||||
none -serial none -parallel none -usb
|
none -serial none -parallel none -usb
|
||||||
|
@ -30,6 +30,6 @@
|
|||||||
<on_reboot>restart</on_reboot>
|
<on_reboot>restart</on_reboot>
|
||||||
<on_crash>destroy</on_crash>
|
<on_crash>destroy</on_crash>
|
||||||
<devices>
|
<devices>
|
||||||
<emulator>/./qemu.sh</emulator>
|
<emulator>/usr/bin/qemu</emulator>
|
||||||
</devices>
|
</devices>
|
||||||
</domain>
|
</domain>
|
||||||
|
@ -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 \
|
-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 \
|
-nographic -monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot n -net \
|
||||||
none -serial none -parallel none -usb
|
none -serial none -parallel none -usb
|
||||||
|
@ -30,6 +30,6 @@
|
|||||||
<on_reboot>restart</on_reboot>
|
<on_reboot>restart</on_reboot>
|
||||||
<on_crash>destroy</on_crash>
|
<on_crash>destroy</on_crash>
|
||||||
<devices>
|
<devices>
|
||||||
<emulator>/./qemu.sh</emulator>
|
<emulator>/usr/bin/qemu</emulator>
|
||||||
</devices>
|
</devices>
|
||||||
</domain>
|
</domain>
|
||||||
|
@ -3,7 +3,7 @@ PATH=/bin \
|
|||||||
HOME=/home/test \
|
HOME=/home/test \
|
||||||
USER=test \
|
USER=test \
|
||||||
LOGNAME=test \
|
LOGNAME=test \
|
||||||
./qemu.sh \
|
/usr/bin/qemu \
|
||||||
-S \
|
-S \
|
||||||
-M pc \
|
-M pc \
|
||||||
-cpu Penryn,-sse4.1 \
|
-cpu Penryn,-sse4.1 \
|
||||||
|
@ -20,6 +20,6 @@
|
|||||||
<on_reboot>restart</on_reboot>
|
<on_reboot>restart</on_reboot>
|
||||||
<on_crash>destroy</on_crash>
|
<on_crash>destroy</on_crash>
|
||||||
<devices>
|
<devices>
|
||||||
<emulator>/./qemu.sh</emulator>
|
<emulator>/usr/bin/qemu</emulator>
|
||||||
</devices>
|
</devices>
|
||||||
</domain>
|
</domain>
|
||||||
|
@ -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 \
|
-cpu host,-kvmclock -enable-kvm -m 214 -smp 6 \
|
||||||
-nographic -monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot n -net \
|
-nographic -monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot n -net \
|
||||||
none -serial none -parallel none -usb
|
none -serial none -parallel none -usb
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
<on_reboot>restart</on_reboot>
|
<on_reboot>restart</on_reboot>
|
||||||
<on_crash>destroy</on_crash>
|
<on_crash>destroy</on_crash>
|
||||||
<devices>
|
<devices>
|
||||||
<emulator>/./qemu.sh</emulator>
|
<emulator>/usr/bin/qemu</emulator>
|
||||||
<controller type='usb' index='0'/>
|
<controller type='usb' index='0'/>
|
||||||
<memballoon model='virtio'/>
|
<memballoon model='virtio'/>
|
||||||
</devices>
|
</devices>
|
||||||
|
@ -3,7 +3,7 @@ PATH=/bin \
|
|||||||
HOME=/home/test \
|
HOME=/home/test \
|
||||||
USER=test \
|
USER=test \
|
||||||
LOGNAME=test \
|
LOGNAME=test \
|
||||||
./qemu-supported-cpus.sh \
|
/usr/bin/qemu \
|
||||||
-S \
|
-S \
|
||||||
-M pc \
|
-M pc \
|
||||||
-cpu Penryn,+xtpr,+tm2,+est,+vmx,+ds_cpl,+monitor,+pbe,+tm,+ht,+ss,+acpi,+ds,+vme,-sse4.1 \
|
-cpu Penryn,+xtpr,+tm2,+est,+vmx,+ds_cpl,+monitor,+pbe,+tm,+ht,+ss,+acpi,+ds,+vme,-sse4.1 \
|
||||||
|
@ -14,6 +14,6 @@
|
|||||||
<on_reboot>restart</on_reboot>
|
<on_reboot>restart</on_reboot>
|
||||||
<on_crash>destroy</on_crash>
|
<on_crash>destroy</on_crash>
|
||||||
<devices>
|
<devices>
|
||||||
<emulator>/./qemu-supported-cpus.sh</emulator>
|
<emulator>/usr/bin/qemu</emulator>
|
||||||
</devices>
|
</devices>
|
||||||
</domain>
|
</domain>
|
||||||
|
@ -16,6 +16,6 @@
|
|||||||
<on_reboot>restart</on_reboot>
|
<on_reboot>restart</on_reboot>
|
||||||
<on_crash>destroy</on_crash>
|
<on_crash>destroy</on_crash>
|
||||||
<devices>
|
<devices>
|
||||||
<emulator>/./qemu-supported-cpus.sh</emulator>
|
<emulator>/usr/bin/qemu</emulator>
|
||||||
</devices>
|
</devices>
|
||||||
</domain>
|
</domain>
|
||||||
|
@ -3,7 +3,7 @@ PATH=/bin \
|
|||||||
HOME=/home/test \
|
HOME=/home/test \
|
||||||
USER=test \
|
USER=test \
|
||||||
LOGNAME=test \
|
LOGNAME=test \
|
||||||
./qemu.sh \
|
/usr/bin/qemu \
|
||||||
-S \
|
-S \
|
||||||
-M pc \
|
-M pc \
|
||||||
-cpu core2duo,+lahf_lm,+xtpr,+cx16,+tm2,+est,+vmx,+ds_cpl,+pbe,+tm,+ht,+ss,+acpi,+ds \
|
-cpu core2duo,+lahf_lm,+xtpr,+cx16,+tm2,+est,+vmx,+ds_cpl,+pbe,+tm,+ht,+ss,+acpi,+ds \
|
||||||
|
@ -14,6 +14,6 @@
|
|||||||
<on_reboot>restart</on_reboot>
|
<on_reboot>restart</on_reboot>
|
||||||
<on_crash>destroy</on_crash>
|
<on_crash>destroy</on_crash>
|
||||||
<devices>
|
<devices>
|
||||||
<emulator>/./qemu.sh</emulator>
|
<emulator>/usr/bin/qemu</emulator>
|
||||||
</devices>
|
</devices>
|
||||||
</domain>
|
</domain>
|
||||||
|
@ -3,7 +3,7 @@ PATH=/bin \
|
|||||||
HOME=/home/test \
|
HOME=/home/test \
|
||||||
USER=test \
|
USER=test \
|
||||||
LOGNAME=test \
|
LOGNAME=test \
|
||||||
./qemu.sh \
|
/usr/bin/qemu \
|
||||||
-S \
|
-S \
|
||||||
-M pc \
|
-M pc \
|
||||||
-cpu host \
|
-cpu host \
|
||||||
|
@ -14,6 +14,6 @@
|
|||||||
<on_reboot>restart</on_reboot>
|
<on_reboot>restart</on_reboot>
|
||||||
<on_crash>destroy</on_crash>
|
<on_crash>destroy</on_crash>
|
||||||
<devices>
|
<devices>
|
||||||
<emulator>/./qemu.sh</emulator>
|
<emulator>/usr/bin/qemu</emulator>
|
||||||
</devices>
|
</devices>
|
||||||
</domain>
|
</domain>
|
||||||
|
@ -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 \
|
-cpu core2duo,-kvmclock -enable-kvm -m 214 -smp 6 \
|
||||||
-nographic -monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot n -net \
|
-nographic -monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot n -net \
|
||||||
none -serial none -parallel none -usb
|
none -serial none -parallel none -usb
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
<on_reboot>restart</on_reboot>
|
<on_reboot>restart</on_reboot>
|
||||||
<on_crash>destroy</on_crash>
|
<on_crash>destroy</on_crash>
|
||||||
<devices>
|
<devices>
|
||||||
<emulator>/./qemu.sh</emulator>
|
<emulator>/usr/bin/qemu</emulator>
|
||||||
<controller type='usb' index='0'/>
|
<controller type='usb' index='0'/>
|
||||||
<memballoon model='virtio'/>
|
<memballoon model='virtio'/>
|
||||||
</devices>
|
</devices>
|
||||||
|
@ -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,\
|
-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,\
|
+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
|
nowait -no-acpi -boot n -net none -serial none -parallel none -usb
|
||||||
|
@ -16,6 +16,6 @@
|
|||||||
<on_reboot>restart</on_reboot>
|
<on_reboot>restart</on_reboot>
|
||||||
<on_crash>destroy</on_crash>
|
<on_crash>destroy</on_crash>
|
||||||
<devices>
|
<devices>
|
||||||
<emulator>/./qemu.sh</emulator>
|
<emulator>/usr/bin/qemu</emulator>
|
||||||
</devices>
|
</devices>
|
||||||
</domain>
|
</domain>
|
||||||
|
@ -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,\
|
-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 \
|
+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 \
|
unix:/tmp/test-monitor,server,nowait -no-acpi -boot n -net none -serial none \
|
||||||
|
@ -20,6 +20,6 @@
|
|||||||
<on_reboot>restart</on_reboot>
|
<on_reboot>restart</on_reboot>
|
||||||
<on_crash>destroy</on_crash>
|
<on_crash>destroy</on_crash>
|
||||||
<devices>
|
<devices>
|
||||||
<emulator>/./qemu.sh</emulator>
|
<emulator>/usr/bin/qemu</emulator>
|
||||||
</devices>
|
</devices>
|
||||||
</domain>
|
</domain>
|
||||||
|
@ -20,6 +20,6 @@
|
|||||||
<on_reboot>restart</on_reboot>
|
<on_reboot>restart</on_reboot>
|
||||||
<on_crash>destroy</on_crash>
|
<on_crash>destroy</on_crash>
|
||||||
<devices>
|
<devices>
|
||||||
<emulator>/./qemu.sh</emulator>
|
<emulator>/usr/bin/qemu</emulator>
|
||||||
</devices>
|
</devices>
|
||||||
</domain>
|
</domain>
|
||||||
|
@ -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 \
|
-m 214 -smp 16 -numa node,nodeid=0,cpus=0-7,mem=107 \
|
||||||
-numa node,nodeid=1,cpus=8-15,mem=107 -nographic -monitor \
|
-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 \
|
unix:/tmp/test-monitor,server,nowait -no-acpi -boot n -net none -serial none \
|
||||||
|
@ -20,6 +20,6 @@
|
|||||||
<on_reboot>restart</on_reboot>
|
<on_reboot>restart</on_reboot>
|
||||||
<on_crash>destroy</on_crash>
|
<on_crash>destroy</on_crash>
|
||||||
<devices>
|
<devices>
|
||||||
<emulator>/./qemu.sh</emulator>
|
<emulator>/usr/bin/qemu</emulator>
|
||||||
</devices>
|
</devices>
|
||||||
</domain>
|
</domain>
|
||||||
|
@ -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 \
|
-m 214 -smp 16,sockets=2,cores=4,threads=2 \
|
||||||
-numa node,nodeid=0,cpus=0-7,mem=107 \
|
-numa node,nodeid=0,cpus=0-7,mem=107 \
|
||||||
-numa node,nodeid=1,cpus=8-15,mem=107 -nographic -monitor \
|
-numa node,nodeid=1,cpus=8-15,mem=107 -nographic -monitor \
|
||||||
|
@ -20,6 +20,6 @@
|
|||||||
<on_reboot>restart</on_reboot>
|
<on_reboot>restart</on_reboot>
|
||||||
<on_crash>destroy</on_crash>
|
<on_crash>destroy</on_crash>
|
||||||
<devices>
|
<devices>
|
||||||
<emulator>/./qemu.sh</emulator>
|
<emulator>/usr/bin/qemu</emulator>
|
||||||
</devices>
|
</devices>
|
||||||
</domain>
|
</domain>
|
||||||
|
@ -14,6 +14,6 @@
|
|||||||
<on_reboot>restart</on_reboot>
|
<on_reboot>restart</on_reboot>
|
||||||
<on_crash>destroy</on_crash>
|
<on_crash>destroy</on_crash>
|
||||||
<devices>
|
<devices>
|
||||||
<emulator>/./qemu.sh</emulator>
|
<emulator>/usr/bin/qemu</emulator>
|
||||||
</devices>
|
</devices>
|
||||||
</domain>
|
</domain>
|
||||||
|
@ -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 \
|
-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 \
|
-m 214 -smp 6 -nographic -monitor unix:/tmp/test-monitor,server,nowait \
|
||||||
-no-acpi -boot n -net none -serial none -parallel none -usb
|
-no-acpi -boot n -net none -serial none -parallel none -usb
|
||||||
|
@ -33,6 +33,6 @@
|
|||||||
<on_reboot>restart</on_reboot>
|
<on_reboot>restart</on_reboot>
|
||||||
<on_crash>destroy</on_crash>
|
<on_crash>destroy</on_crash>
|
||||||
<devices>
|
<devices>
|
||||||
<emulator>/./qemu.sh</emulator>
|
<emulator>/usr/bin/qemu</emulator>
|
||||||
</devices>
|
</devices>
|
||||||
</domain>
|
</domain>
|
||||||
|
@ -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 \
|
-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 \
|
unix:/tmp/test-monitor,server,nowait -no-acpi -boot n -net none -serial none \
|
||||||
-parallel none -usb
|
-parallel none -usb
|
||||||
|
@ -16,6 +16,6 @@
|
|||||||
<on_reboot>restart</on_reboot>
|
<on_reboot>restart</on_reboot>
|
||||||
<on_crash>destroy</on_crash>
|
<on_crash>destroy</on_crash>
|
||||||
<devices>
|
<devices>
|
||||||
<emulator>/./qemu.sh</emulator>
|
<emulator>/usr/bin/qemu</emulator>
|
||||||
</devices>
|
</devices>
|
||||||
</domain>
|
</domain>
|
||||||
|
@ -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 \
|
-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 \
|
unix:/tmp/test-monitor,server,nowait -no-acpi -boot n -net none -serial none \
|
||||||
-parallel none -usb
|
-parallel none -usb
|
||||||
|
@ -17,6 +17,6 @@
|
|||||||
<on_reboot>restart</on_reboot>
|
<on_reboot>restart</on_reboot>
|
||||||
<on_crash>destroy</on_crash>
|
<on_crash>destroy</on_crash>
|
||||||
<devices>
|
<devices>
|
||||||
<emulator>/./qemu.sh</emulator>
|
<emulator>/usr/bin/qemu</emulator>
|
||||||
</devices>
|
</devices>
|
||||||
</domain>
|
</domain>
|
||||||
|
@ -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 \
|
-m 214 -smp 6 -nographic -monitor unix:/tmp/test-monitor,server,nowait \
|
||||||
-no-acpi -boot n -net none -serial none -parallel none -usb
|
-no-acpi -boot n -net none -serial none -parallel none -usb
|
||||||
|
@ -16,6 +16,6 @@
|
|||||||
<on_reboot>restart</on_reboot>
|
<on_reboot>restart</on_reboot>
|
||||||
<on_crash>destroy</on_crash>
|
<on_crash>destroy</on_crash>
|
||||||
<devices>
|
<devices>
|
||||||
<emulator>/./qemu.sh</emulator>
|
<emulator>/usr/bin/qemu</emulator>
|
||||||
</devices>
|
</devices>
|
||||||
</domain>
|
</domain>
|
||||||
|
@ -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 \
|
-cpu qemu32,-kvm_pv_eoi -m 214 -smp 6 -nographic -monitor \
|
||||||
unix:/tmp/test-monitor,server,nowait -boot n -net none -serial \
|
unix:/tmp/test-monitor,server,nowait -boot n -net none -serial \
|
||||||
none -parallel none -usb
|
none -parallel none -usb
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
<on_reboot>restart</on_reboot>
|
<on_reboot>restart</on_reboot>
|
||||||
<on_crash>destroy</on_crash>
|
<on_crash>destroy</on_crash>
|
||||||
<devices>
|
<devices>
|
||||||
<emulator>/./qemu.sh</emulator>
|
<emulator>/usr/bin/qemu</emulator>
|
||||||
<controller type='usb' index='0'/>
|
<controller type='usb' index='0'/>
|
||||||
<memballoon model='virtio'/>
|
<memballoon model='virtio'/>
|
||||||
</devices>
|
</devices>
|
||||||
|
@ -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 \
|
-cpu qemu32,+kvm_pv_eoi -m 214 -smp 6 -nographic -monitor \
|
||||||
unix:/tmp/test-monitor,server,nowait -boot n -net none -serial \
|
unix:/tmp/test-monitor,server,nowait -boot n -net none -serial \
|
||||||
none -parallel none -usb
|
none -parallel none -usb
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
<on_reboot>restart</on_reboot>
|
<on_reboot>restart</on_reboot>
|
||||||
<on_crash>destroy</on_crash>
|
<on_crash>destroy</on_crash>
|
||||||
<devices>
|
<devices>
|
||||||
<emulator>/./qemu.sh</emulator>
|
<emulator>/usr/bin/qemu</emulator>
|
||||||
<controller type='usb' index='0'/>
|
<controller type='usb' index='0'/>
|
||||||
<memballoon model='virtio'/>
|
<memballoon model='virtio'/>
|
||||||
</devices>
|
</devices>
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=spice \
|
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 \
|
+est,+vmx,+ds_cpl,+pbe,+tm,+ht,+ss,+acpi,+ds \
|
||||||
-m 1024 -smp 2 -nodefaults -monitor unix:/tmp/test-monitor,server,nowait \
|
-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 \
|
-boot dc -device virtio-serial-pci,id=virtio-serial0,bus=pci.0,addr=0x6 \
|
||||||
|
@ -38,7 +38,7 @@
|
|||||||
<on_reboot>restart</on_reboot>
|
<on_reboot>restart</on_reboot>
|
||||||
<on_crash>restart</on_crash>
|
<on_crash>restart</on_crash>
|
||||||
<devices>
|
<devices>
|
||||||
<emulator>/./qemu.sh</emulator>
|
<emulator>/usr/bin/qemu</emulator>
|
||||||
<disk type='file' device='disk'>
|
<disk type='file' device='disk'>
|
||||||
<driver name='qemu' type='qcow2'/>
|
<driver name='qemu' type='qcow2'/>
|
||||||
<source file='/var/lib/libvirt/images/f14.img'/>
|
<source file='/var/lib/libvirt/images/f14.img'/>
|
||||||
|
@ -106,26 +106,6 @@ static int testCompareXMLToArgvFiles(const char *xml,
|
|||||||
goto out;
|
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))
|
if (qemuCapsGet(extraFlags, QEMU_CAPS_DOMID))
|
||||||
vmdef->id = 6;
|
vmdef->id = 6;
|
||||||
else
|
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
|
static int
|
||||||
mymain(void)
|
mymain(void)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
char *map = NULL;
|
char *map = NULL;
|
||||||
|
bool skipLegacyCPUs = false;
|
||||||
|
|
||||||
abs_top_srcdir = getenv("abs_top_srcdir");
|
abs_top_srcdir = getenv("abs_top_srcdir");
|
||||||
if (!abs_top_srcdir)
|
if (!abs_top_srcdir)
|
||||||
@ -307,6 +315,8 @@ mymain(void)
|
|||||||
}; \
|
}; \
|
||||||
if (!(info.extraFlags = qemuCapsNew())) \
|
if (!(info.extraFlags = qemuCapsNew())) \
|
||||||
return EXIT_FAILURE; \
|
return EXIT_FAILURE; \
|
||||||
|
if (testAddCPUModels(info.extraFlags, skipLegacyCPUs) < 0) \
|
||||||
|
return EXIT_FAILURE; \
|
||||||
qemuCapsSetList(info.extraFlags, __VA_ARGS__, QEMU_CAPS_LAST); \
|
qemuCapsSetList(info.extraFlags, __VA_ARGS__, QEMU_CAPS_LAST); \
|
||||||
if (virtTestRun("QEMU XML-2-ARGV " name, \
|
if (virtTestRun("QEMU XML-2-ARGV " name, \
|
||||||
1, testCompareXMLToArgvHelper, &info) < 0) \
|
1, testCompareXMLToArgvHelper, &info) < 0) \
|
||||||
@ -766,8 +776,10 @@ mymain(void)
|
|||||||
DO_TEST("cpu-numa1", NONE);
|
DO_TEST("cpu-numa1", NONE);
|
||||||
DO_TEST("cpu-numa2", QEMU_CAPS_SMP_TOPOLOGY);
|
DO_TEST("cpu-numa2", QEMU_CAPS_SMP_TOPOLOGY);
|
||||||
DO_TEST("cpu-host-model", NONE);
|
DO_TEST("cpu-host-model", NONE);
|
||||||
|
skipLegacyCPUs = true;
|
||||||
DO_TEST("cpu-host-model-fallback", NONE);
|
DO_TEST("cpu-host-model-fallback", NONE);
|
||||||
DO_TEST_FAILURE("cpu-host-model-nofallback", 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("cpu-host-passthrough", QEMU_CAPS_KVM, QEMU_CAPS_CPU_HOST);
|
||||||
DO_TEST_FAILURE("cpu-host-passthrough", NONE);
|
DO_TEST_FAILURE("cpu-host-passthrough", NONE);
|
||||||
DO_TEST_FAILURE("cpu-qemu-host-passthrough",
|
DO_TEST_FAILURE("cpu-qemu-host-passthrough",
|
||||||
|
@ -38,7 +38,7 @@
|
|||||||
<on_reboot>restart</on_reboot>
|
<on_reboot>restart</on_reboot>
|
||||||
<on_crash>restart</on_crash>
|
<on_crash>restart</on_crash>
|
||||||
<devices>
|
<devices>
|
||||||
<emulator>/./qemu.sh</emulator>
|
<emulator>/usr/bin/qemu</emulator>
|
||||||
<disk type='file' device='disk'>
|
<disk type='file' device='disk'>
|
||||||
<driver name='qemu' type='qcow2'/>
|
<driver name='qemu' type='qcow2'/>
|
||||||
<source file='/var/lib/libvirt/images/f14.img'/>
|
<source file='/var/lib/libvirt/images/f14.img'/>
|
||||||
|
Loading…
Reference in New Issue
Block a user