]> xenbits.xensource.com Git - libvirt.git/commitdiff
Fix check for errors in device_add command in QEMU text monitor
authorDaniel P. Berrange <berrange@redhat.com>
Fri, 28 May 2010 11:18:09 +0000 (12:18 +0100)
committerDaniel P. Berrange <berrange@redhat.com>
Tue, 8 Jun 2010 14:20:59 +0000 (15:20 +0100)
Any output at all from device_add indicates an error in the
command execution. Thus it needs to check for reply != ""

* src/qemu/qemu_monitor_text.c: Fix reply check for errors
  to treat any output as an error

src/qemu/qemu_monitor_text.c

index 4b1e2ecd8dcf606209308e965c62038172ef6255..c0ebe5f369ccd8c11b30c8bc962934b1760970ac 100644 (file)
@@ -2319,11 +2319,11 @@ int qemuMonitorTextAddDevice(qemuMonitorPtr mon,
         goto cleanup;
     }
 
-    /* If the command failed qemu prints:
-     * Could not add ... */
-    if (strstr(reply, "Could not add ")) {
+    /* If the command succeeds, no output is sent. So
+     * any non-empty string shows an error */
+    if (STRNEQ(reply, "")) {
         qemuReportError(VIR_ERR_OPERATION_FAILED,
-                        _("adding %s device failed"), devicestr);
+                        _("adding %s device failed: %s"), devicestr, reply);
         goto cleanup;
     }