[libvirt] [PATCH v2 07/31] qemu: Use saner defaults for domain capabilities
Pavel Hrdina
phrdina at redhat.com
Thu Nov 24 14:49:40 UTC 2016
On Mon, Nov 21, 2016 at 12:21:03AM +0100, Jiri Denemark wrote:
> 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 at redhat.com>
> ---
> src/qemu/qemu_driver.c | 17 ++++++++++-------
> 1 file changed, 10 insertions(+), 7 deletions(-)
>
> diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
> index d039255..925631b 100644
> --- a/src/qemu/qemu_driver.c
> +++ b/src/qemu/qemu_driver.c
> @@ -18723,7 +18723,8 @@ qemuConnectGetDomainCapabilities(virConnectPtr conn,
> char *ret = NULL;
> virQEMUDriverPtr driver = conn->privateData;
> virQEMUCapsPtr qemuCaps = NULL;
> - int virttype; /* virDomainVirtType */
> + int virttype = VIR_DOMAIN_VIRT_NONE;
> + virDomainVirtType capsType;
> virDomainCapsPtr domCaps = NULL;
> int arch = virArchFromHost(); /* virArch */
> virQEMUDriverConfigPtr cfg = NULL;
> @@ -18739,12 +18740,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,
> @@ -18808,6 +18803,14 @@ qemuConnectGetDomainCapabilities(virConnectPtr conn,
> machine = virQEMUCapsGetDefaultMachine(qemuCaps);
> }
>
> + 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;
There is no need for the *capsType* variable, just move the
"if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_KVM)) ..." here and virttype can be set
directly.
ACK with that fixed.
Pavel
> +
> if (!(domCaps = virDomainCapsNew(emulatorbin, machine, arch, virttype)))
> goto cleanup;
>
> --
> 2.10.2
>
> --
> libvir-list mailing list
> libvir-list at redhat.com
> https://www.redhat.com/mailman/listinfo/libvir-list
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: Digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20161124/f3d1fca5/attachment-0001.sig>
More information about the libvir-list
mailing list