[libvirt] [PATCH] qemu: report an error if usb keyboards are unsupported

Jiri Denemark jdenemar at redhat.com
Fri Jun 9 07:04:23 UTC 2017


On Fri, Jun 09, 2017 at 08:37:35 +0200, Ján Tomko wrote:
> Be nicer to the user and report a proper error instead of:
> An error occurred, but the cause is unknown
> 
> https://bugzilla.redhat.com/show_bug.cgi?id=1460086
> ---
>  src/qemu/qemu_command.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
> index 20af16b..0f87809 100644
> --- a/src/qemu/qemu_command.c
> +++ b/src/qemu/qemu_command.c
> @@ -4261,8 +4261,12 @@ qemuBuildUSBInputDevStr(const virDomainDef *def,
>          virBufferAsprintf(&buf, "usb-tablet,id=%s", dev->info.alias);
>          break;
>      case VIR_DOMAIN_INPUT_TYPE_KBD:
> -        if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_USB_KBD))
> +        if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_USB_KBD)) {
> +            virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
> +                           _("usb keyboard is not supported by this "
> +                             "QEMU binary"));
>              goto error;
> +        }
>          virBufferAsprintf(&buf, "usb-kbd,id=%s", dev->info.alias);
>          break;
>      }

ACK

Jirka




More information about the libvir-list mailing list