]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
Display nicer error message for unsupported chardev hotplug
authorJán Tomko <jtomko@redhat.com>
Mon, 10 Nov 2014 15:52:49 +0000 (16:52 +0100)
committerJán Tomko <jtomko@redhat.com>
Tue, 11 Nov 2014 13:21:08 +0000 (14:21 +0100)
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

index aceb14db08bf291ff3954c68cf58786d85d9ed0f..91a7aba1db13debb2bf63278a333d3bbc8ab0785 100644 (file)
@@ -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;
     }