[libvirt] [PATCH] Fix error reporting for getfd + host_net_add in QEMU

If either of the getfd or host_net_add monitor commands return any text, this indicates an error condition. Don't ignore this! * src/qemu/qemu_monitor_text.c: Report errors for getfd and host_net_add --- src/qemu/qemu_monitor_text.c | 16 ++++++++++++++-- 1 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/qemu/qemu_monitor_text.c b/src/qemu/qemu_monitor_text.c index 48c9a54..6ad07b1 100644 --- a/src/qemu/qemu_monitor_text.c +++ b/src/qemu/qemu_monitor_text.c @@ -1666,6 +1666,13 @@ int qemuMonitorTextSendFileHandle(qemuMonitorPtr mon, goto cleanup; } + if (STRNEQ(reply, "")) { + qemuReportError(VIR_ERR_INTERNAL_ERROR, + _("unable to send TAP file handle: %s"), + reply); + goto cleanup; + } + ret = 0; cleanup: @@ -1725,11 +1732,16 @@ int qemuMonitorTextAddHostNetwork(qemuMonitorPtr mon, if (qemuMonitorCommand(mon, cmd, &reply) < 0) { qemuReportError(VIR_ERR_OPERATION_FAILED, - _("failed to close fd in qemu with '%s'"), cmd); + _("failed to add host net with '%s'"), cmd); goto cleanup; } - /* XXX error messages here ? */ + if (STRNEQ(reply, "")) { + qemuReportError(VIR_ERR_INTERNAL_ERROR, + _("unable to add host net: %s"), + reply); + goto cleanup; + } ret = 0; -- 1.6.6.1

On Fri, Apr 16, 2010 at 11:53:28AM +0100, Daniel P. Berrange wrote:
If either of the getfd or host_net_add monitor commands return any text, this indicates an error condition. Don't ignore this!
* src/qemu/qemu_monitor_text.c: Report errors for getfd and host_net_add --- src/qemu/qemu_monitor_text.c | 16 ++++++++++++++-- 1 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/src/qemu/qemu_monitor_text.c b/src/qemu/qemu_monitor_text.c index 48c9a54..6ad07b1 100644 --- a/src/qemu/qemu_monitor_text.c +++ b/src/qemu/qemu_monitor_text.c @@ -1666,6 +1666,13 @@ int qemuMonitorTextSendFileHandle(qemuMonitorPtr mon, goto cleanup; }
+ if (STRNEQ(reply, "")) { + qemuReportError(VIR_ERR_INTERNAL_ERROR, + _("unable to send TAP file handle: %s"), + reply); + goto cleanup; + } + ret = 0;
cleanup: @@ -1725,11 +1732,16 @@ int qemuMonitorTextAddHostNetwork(qemuMonitorPtr mon,
if (qemuMonitorCommand(mon, cmd, &reply) < 0) { qemuReportError(VIR_ERR_OPERATION_FAILED, - _("failed to close fd in qemu with '%s'"), cmd); + _("failed to add host net with '%s'"), cmd); goto cleanup; }
- /* XXX error messages here ? */ + if (STRNEQ(reply, "")) { + qemuReportError(VIR_ERR_INTERNAL_ERROR, + _("unable to add host net: %s"), + reply); + goto cleanup; + }
ret = 0;
Plus an error logging fix, ACK, Daniel -- Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ daniel@veillard.com | Rpmfind RPM search engine http://rpmfind.net/ http://veillard.com/ | virtualization library http://libvirt.org/
participants (2)
-
Daniel P. Berrange
-
Daniel Veillard