]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemu: report an error if usb keyboards are unsupported
authorJán Tomko <jtomko@redhat.com>
Fri, 9 Jun 2017 06:27:07 +0000 (08:27 +0200)
committerJán Tomko <jtomko@redhat.com>
Fri, 9 Jun 2017 06:29:12 +0000 (08:29 +0200)
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

index 20af16b154955cafc34eeb969f560224d891b01c..0f878091779b38dd0a4a332091698df2e8579650 100644 (file)
@@ -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;
     }