mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-22 12:35:17 +00:00
qemu: Use saner defaults for domain capabilities
When domain capabilities were introduced we did not have enough data to decide whether KVM works on the host or not and thus working legacy/VFIO device assignment was used as a witness. Now that we know whether KVM was enabled when probing QEMU capabilities (and thus we know it's working), we can use this knowledge to provide better default value for virttype. Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
This commit is contained in:
parent
d87df9bd39
commit
8f55eef246
@ -18718,7 +18718,7 @@ qemuConnectGetDomainCapabilities(virConnectPtr conn,
|
||||
char *ret = NULL;
|
||||
virQEMUDriverPtr driver = conn->privateData;
|
||||
virQEMUCapsPtr qemuCaps = NULL;
|
||||
int virttype; /* virDomainVirtType */
|
||||
int virttype = VIR_DOMAIN_VIRT_NONE;
|
||||
virDomainCapsPtr domCaps = NULL;
|
||||
int arch = virArchFromHost(); /* virArch */
|
||||
virQEMUDriverConfigPtr cfg = NULL;
|
||||
@ -18734,12 +18734,6 @@ qemuConnectGetDomainCapabilities(virConnectPtr conn,
|
||||
if (!(caps = virQEMUDriverGetCapabilities(driver, false)))
|
||||
goto cleanup;
|
||||
|
||||
if (qemuHostdevHostSupportsPassthroughLegacy() ||
|
||||
qemuHostdevHostSupportsPassthroughVFIO())
|
||||
virttype = VIR_DOMAIN_VIRT_KVM;
|
||||
else
|
||||
virttype = VIR_DOMAIN_VIRT_QEMU;
|
||||
|
||||
if (virttype_str &&
|
||||
(virttype = virDomainVirtTypeFromString(virttype_str)) < 0) {
|
||||
virReportError(VIR_ERR_INVALID_ARG,
|
||||
@ -18803,6 +18797,13 @@ 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 (!(domCaps = virDomainCapsNew(emulatorbin, machine, arch, virttype)))
|
||||
goto cleanup;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user