Re: [libvirt] [PATCH 2/2] Display nicer error message for unsupported chardev hotplug

2014-11-10 Thread Pavel Hrdina

On 11/10/2014 04:57 PM, Ján Tomko wrote:

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 7870664..2d082bc 100644
--- a/src/qemu/qemu_monitor_json.c
+++ b/src/qemu/qemu_monitor_json.c
@@ -5915,9 +5915,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 char device type '%s'"),
+   virDomainChrTypeToString(chr->type));
+} else {
+virReportError(VIR_ERR_OPERATION_FAILED,
+   _("Unsupported char device type '%d'"),
+   chr->type);
+}
  goto error;
  }




Both error messages could be the same as they are reporting the same
issue. ACK with that change.

Pavel

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [PATCH 2/2] Display nicer error message for unsupported chardev hotplug

2014-11-10 Thread Ján Tomko
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 7870664..2d082bc 100644
--- a/src/qemu/qemu_monitor_json.c
+++ b/src/qemu/qemu_monitor_json.c
@@ -5915,9 +5915,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 char device type '%s'"),
+   virDomainChrTypeToString(chr->type));
+} else {
+virReportError(VIR_ERR_OPERATION_FAILED,
+   _("Unsupported char device type '%d'"),
+   chr->type);
+}
 goto error;
 }
 
-- 
2.0.4

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list