Use 'virReportEnumRangeError' for the invalid cases and keep the
original error for known but unsupported chardevs.
Signed-off-by: Peter Krempa <pkrempa(a)redhat.com>
---
src/qemu/qemu_monitor_json.c | 16 +++++++---------
1 file changed, 7 insertions(+), 9 deletions(-)
diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
index b036cc4112..1ced942161 100644
--- a/src/qemu/qemu_monitor_json.c
+++ b/src/qemu/qemu_monitor_json.c
@@ -6737,16 +6737,14 @@ qemuMonitorJSONAttachCharDevGetProps(const char *chrID,
case VIR_DOMAIN_CHR_TYPE_PIPE:
case VIR_DOMAIN_CHR_TYPE_STDIO:
case VIR_DOMAIN_CHR_TYPE_NMDM:
+ virReportError(VIR_ERR_OPERATION_FAILED,
+ _("Hotplug unsupported for char device type
'%s'"),
+ virDomainChrTypeToString(chr->type));
+ return NULL;
+
case VIR_DOMAIN_CHR_TYPE_LAST:
- 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);
- }
+ default:
+ virReportEnumRangeError(virDomainChrType, chr->type);
return NULL;
}
--
2.31.1