Cole Robinson wrote:
> If a 'change' or 'eject' qemu monitor command fails,
> an error message is printed to the monitor of the
> form "device {not found, is locked, is not 
> removable"}. This is really the only indication we
> have that the command errored out, so scrape the
> monitor reply for "\ndevice " and fail if it is
> found.
> 

There is an obvious syntax error in the patch (that's
what I get for changing things last minute and not
testing)

Updated version attached.

Thanks,
Cole

commit 8caba367b62b4fb961722cd641d8172bb441b84e
Author: Cole Robinson <[EMAIL PROTECTED]>
Date:   Fri Aug 22 16:35:24 2008 -0400

    Scrape cdrom attach/eject monitor output to try and determine failure.

diff --git a/src/qemu_driver.c b/src/qemu_driver.c
index 9a26375..05e7402 100644
--- a/src/qemu_driver.c
+++ b/src/qemu_driver.c
@@ -2994,6 +2994,19 @@ static int qemudDomainChangeCDROM(virDomainPtr dom,
         VIR_FREE(newsrc);
         return -1;
     }
+
+    /* If the command failed qemu prints:
+     * device not found, device is locked ...
+     * No message is printed on success it seems */
+    DEBUG ("cdrom change reply: %s", reply);
+    if (strstr(reply, "\ndevice ")) {
+        qemudReportError (dom->conn, dom, NULL, VIR_ERR_OPERATION_FAILED,
+                          "%s", _("changing cdrom media failed"));
+        VIR_FREE(reply);
+        VIR_FREE(cmd);
+        return -1;
+    }
+
     VIR_FREE(reply);
     VIR_FREE(cmd);
 
--
Libvir-list mailing list
Libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Reply via email to