]> xenbits.xensource.com Git - libvirt.git/commitdiff
Fix detection of errors in QEMU device_add command
authorDaniel P. Berrange <berrange@redhat.com>
Tue, 2 Mar 2010 17:16:30 +0000 (17:16 +0000)
committerDaniel P. Berrange <berrange@redhat.com>
Wed, 3 Mar 2010 14:56:15 +0000 (14:56 +0000)
The code assumed that 'device_add' returned an empty string upon
success. This is not true, it sometimes prints random debug info.
THus we need to check for an explicit fail string

* src/qemu/qemu_monitor_text.c: Fix error checking of the device_add
  monitor command

src/qemu/qemu_monitor_text.c

index 69df40760ae2a482c8a1ea8fbb8c1de271aced6c..82f7a9b9cb9422e18a0048b659754b9a945abcbd 100644 (file)
@@ -2123,9 +2123,11 @@ int qemuMonitorTextAddDevice(qemuMonitorPtr mon,
         goto cleanup;
     }
 
-    if (STRNEQ(reply, "")) {
+    /* If the command failed qemu prints:
+     * Could not add ... */
+    if (strstr(reply, "Could not add ")) {
         qemuReportError(VIR_ERR_OPERATION_FAILED,
-                        _("adding %s device failed: %s"), devicestr, reply);
+                        _("adding %s device failed"), devicestr);
         goto cleanup;
     }