mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-11 07:17:44 +00:00
qemu: Don't return unusable virttype in domain capabilities
If a user asked for a KVM domain capabilities when KVM is not available, we would happily return data we got when probing through TCG and pretended they were relevant for KVM. Let's just report KVM is not supported to avoid confusion. Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
This commit is contained in:
parent
8f55eef246
commit
cd51b90fbf
@ -18719,6 +18719,7 @@ qemuConnectGetDomainCapabilities(virConnectPtr conn,
|
||||
virQEMUDriverPtr driver = conn->privateData;
|
||||
virQEMUCapsPtr qemuCaps = NULL;
|
||||
int virttype = VIR_DOMAIN_VIRT_NONE;
|
||||
virDomainVirtType capsType;
|
||||
virDomainCapsPtr domCaps = NULL;
|
||||
int arch = virArchFromHost(); /* virArch */
|
||||
virQEMUDriverConfigPtr cfg = NULL;
|
||||
@ -18797,11 +18798,19 @@ qemuConnectGetDomainCapabilities(virConnectPtr conn,
|
||||
machine = virQEMUCapsGetDefaultMachine(qemuCaps);
|
||||
}
|
||||
|
||||
if (virttype == VIR_DOMAIN_VIRT_NONE) {
|
||||
if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_KVM))
|
||||
virttype = VIR_DOMAIN_VIRT_KVM;
|
||||
else
|
||||
virttype = VIR_DOMAIN_VIRT_QEMU;
|
||||
if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_KVM))
|
||||
capsType = VIR_DOMAIN_VIRT_KVM;
|
||||
else
|
||||
capsType = VIR_DOMAIN_VIRT_QEMU;
|
||||
|
||||
if (virttype == VIR_DOMAIN_VIRT_NONE)
|
||||
virttype = capsType;
|
||||
|
||||
if (virttype == VIR_DOMAIN_VIRT_KVM && capsType == VIR_DOMAIN_VIRT_QEMU) {
|
||||
virReportError(VIR_ERR_INVALID_ARG,
|
||||
_("KVM is not supported by '%s' on this host"),
|
||||
emulatorbin);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (!(domCaps = virDomainCapsNew(emulatorbin, machine, arch, virttype)))
|
||||
|
Loading…
Reference in New Issue
Block a user