Re: [PATCH v2 07/31] qemu: Use saner defaults for domain capabilities

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
> ---
>  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@xxxxxxxxxx
> https://www.redhat.com/mailman/listinfo/libvir-list

Attachment: signature.asc
Description: Digital signature

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]
  Powered by Linux