6d3351
From 40cd16ee0d35948d1e713f0af629a65ce2e22114 Mon Sep 17 00:00:00 2001
6d3351
Message-Id: <40cd16ee0d35948d1e713f0af629a65ce2e22114@dist-git>
6d3351
From: =?UTF-8?q?J=C3=A1n=20Tomko?= <jtomko@redhat.com>
6d3351
Date: Tue, 4 Jul 2017 14:17:18 +0200
6d3351
Subject: [PATCH] qemu: report an error if usb keyboards are unsupported
6d3351
MIME-Version: 1.0
6d3351
Content-Type: text/plain; charset=UTF-8
6d3351
Content-Transfer-Encoding: 8bit
6d3351
6d3351
Be nicer to the user and report a proper error instead of:
6d3351
An error occurred, but the cause is unknown
6d3351
6d3351
https://bugzilla.redhat.com/show_bug.cgi?id=1460086
6d3351
(cherry picked from commit 3596b1ddf912418f70c9eaa07d460aacf574bbfd)
6d3351
Signed-off-by: Ján Tomko <jtomko@redhat.com>
6d3351
6d3351
Note: the above bug link is completely irrelevant
6d3351
https://bugzilla.redhat.com/show_bug.cgi?id=1460008
6d3351
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
6d3351
---
6d3351
 src/qemu/qemu_command.c | 6 +++++-
6d3351
 1 file changed, 5 insertions(+), 1 deletion(-)
6d3351
6d3351
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
6d3351
index a4184b7378..e3be487d20 100644
6d3351
--- a/src/qemu/qemu_command.c
6d3351
+++ b/src/qemu/qemu_command.c
6d3351
@@ -4250,8 +4250,12 @@ qemuBuildUSBInputDevStr(const virDomainDef *def,
6d3351
         virBufferAsprintf(&buf, "usb-tablet,id=%s", dev->info.alias);
6d3351
         break;
6d3351
     case VIR_DOMAIN_INPUT_TYPE_KBD:
6d3351
-        if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_USB_KBD))
6d3351
+        if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_USB_KBD)) {
6d3351
+            virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
6d3351
+                           _("usb keyboard is not supported by this "
6d3351
+                             "QEMU binary"));
6d3351
             goto error;
6d3351
+        }
6d3351
         virBufferAsprintf(&buf, "usb-kbd,id=%s", dev->info.alias);
6d3351
         break;
6d3351
     }
6d3351
-- 
6d3351
2.13.3
6d3351