[libvirt] [PATCH v2 08/31] qemu: Don't return unusable virttype in domain capabilities

Pavel Hrdina phrdina at redhat.com
Thu Nov 24 15:00:08 UTC 2016


On Mon, Nov 21, 2016 at 12:21:04AM +0100, Jiri Denemark wrote:
> 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 at redhat.com>
> ---
>  src/qemu/qemu_driver.c | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
> index 925631b..09a8d06 100644
> --- a/src/qemu/qemu_driver.c
> +++ b/src/qemu/qemu_driver.c
> @@ -18811,6 +18811,13 @@ qemuConnectGetDomainCapabilities(virConnectPtr conn,
>      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;
> +    }

So this uses the *capsType* from the previous patch.

ACK to this and previous patch, but for the sake of patch isolation the
*capsType* should be introduced by this patch.  I'll leave it up to you to
decide if you want to make the patches looks better or not :).

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/eb381f69/attachment-0001.sig>


More information about the libvir-list mailing list