From cce8e5f7395fef5fa782910bc4a6fc8a786f8bc2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A1n=20Tomko?= Date: Mon, 10 Nov 2014 16:52:49 +0100 Subject: [PATCH] Display nicer error message for unsupported chardev hotplug Use the device type name if we know it instead of its number, even if we can't hotplug it: qemuMonitorJSONAttachCharDevCommand:6094 : operation failed: Unsupported char device type '10' --- src/qemu/qemu_monitor_json.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index aceb14db08..91a7aba1db 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -5955,9 +5955,15 @@ qemuMonitorJSONAttachCharDevCommand(const char *chrID, case VIR_DOMAIN_CHR_TYPE_STDIO: case VIR_DOMAIN_CHR_TYPE_NMDM: case VIR_DOMAIN_CHR_TYPE_LAST: - virReportError(VIR_ERR_OPERATION_FAILED, - _("Unsupported char device type '%d'"), - chr->type); + if (virDomainChrTypeToString(chr->type)) { + virReportError(VIR_ERR_OPERATION_FAILED, + _("Hotplug unsupported for char device type '%s'"), + virDomainChrTypeToString(chr->type)); + } else { + virReportError(VIR_ERR_OPERATION_FAILED, + _("Hotplug unsupported for char device type '%d'"), + chr->type); + } goto error; }