mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 13:45:38 +00:00
qemu: capabilities: Fix testing of 'TCG' capabilities probing
The logic in 'virQEMUCapsInitQMP' invokes a second probe of qemu in case when acceleration is used and TCG is supported to specifically probe the CPU and features of non-accelerated guests. The same logic must then be used in 'qemucapabilitiestest' when replaying the data for testing otherwise the test would fail. Export 'virQEMUCapsHaveAccel' for test usage and use the same logic in 'testQemuCaps'. Fix the comment in 'virQEMUCapsInitQMP' to outline what's happening. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Martin Kletzander <mkletzan@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
738c5bae88
commit
111cfc5532
@ -883,7 +883,7 @@ virQEMUCapsTypeIsAccelerated(virDomainVirtType type)
|
||||
}
|
||||
|
||||
|
||||
static bool
|
||||
bool
|
||||
virQEMUCapsHaveAccel(virQEMUCaps *qemuCaps)
|
||||
{
|
||||
return virQEMUCapsGet(qemuCaps, QEMU_CAPS_KVM) ||
|
||||
@ -5748,8 +5748,8 @@ virQEMUCapsInitQMP(virQEMUCaps *qemuCaps,
|
||||
return -1;
|
||||
|
||||
/*
|
||||
* If KVM was enabled during the first probe, we need to explicitly probe
|
||||
* for TCG capabilities by asking the same binary again and turning KVM
|
||||
* If acceleration was enabled during the first probe, we need to explicitly
|
||||
* probe for TCG capabilities by asking the same binary again and turning KVM
|
||||
* off.
|
||||
*/
|
||||
if (virQEMUCapsHaveAccel(qemuCaps) &&
|
||||
|
@ -116,3 +116,6 @@ virQEMUCapsAddMachine(virQEMUCaps *qemuCaps,
|
||||
const char *defaultRAMid,
|
||||
bool deprecated,
|
||||
virTristateBool acpi);
|
||||
|
||||
bool
|
||||
virQEMUCapsHaveAccel(virQEMUCaps *qemuCaps);
|
||||
|
@ -101,7 +101,8 @@ testQemuCaps(const void *opaque)
|
||||
if (virQEMUCapsInitQMPMonitor(capsActual, qemuMonitorTestGetMonitor(mon)) < 0)
|
||||
return -1;
|
||||
|
||||
if (virQEMUCapsGet(capsActual, QEMU_CAPS_KVM)) {
|
||||
if (virQEMUCapsHaveAccel(capsActual) &&
|
||||
virQEMUCapsGet(capsActual, QEMU_CAPS_TCG)) {
|
||||
qemuMonitorResetCommandID(qemuMonitorTestGetMonitor(mon));
|
||||
|
||||
if (qemuProcessQMPInitMonitor(qemuMonitorTestGetMonitor(mon)) < 0)
|
||||
|
Loading…
Reference in New Issue
Block a user