Blob Blame History Raw
From 40cd16ee0d35948d1e713f0af629a65ce2e22114 Mon Sep 17 00:00:00 2001
Message-Id: <40cd16ee0d35948d1e713f0af629a65ce2e22114@dist-git>
From: =?UTF-8?q?J=C3=A1n=20Tomko?= <jtomko@redhat.com>
Date: Tue, 4 Jul 2017 14:17:18 +0200
Subject: [PATCH] qemu: report an error if usb keyboards are unsupported
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

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
(cherry picked from commit 3596b1ddf912418f70c9eaa07d460aacf574bbfd)
Signed-off-by: Ján Tomko <jtomko@redhat.com>

Note: the above bug link is completely irrelevant
https://bugzilla.redhat.com/show_bug.cgi?id=1460008
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
---
 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 a4184b7378..e3be487d20 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -4250,8 +4250,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;
     }
-- 
2.13.3