]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/libvirt.git/commitdiff
qemu: Return meaningful error when qemu dies early
authorJiri Denemark <jdenemar@redhat.com>
Mon, 17 Mar 2014 10:04:07 +0000 (11:04 +0100)
committerJiri Denemark <jdenemar@redhat.com>
Thu, 20 Mar 2014 21:25:56 +0000 (22:25 +0100)
https://bugzilla.redhat.com/show_bug.cgi?id=844378

When qemu dies early after connecting to its monitor but before we
actually try to read something from the monitor, we would just fail
domain start with useless message:

    "An error occurred, but the cause is unknown"

This is because the real error gets reported in a monitor EOF handler
executing within libvirt's event loop.

The fix is to take any error set in qemuMonitor structure and propagate
it into the thread-local error when qemuMonitorClose is called and no
thread-local error is set.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
src/qemu/qemu_monitor.c

index 5f8a5f4cbbb5433d5a473b070090123d72d1cc79..48fc51cf87e722694ffb6ce9e0ef7122da1eb1d5 100644 (file)
@@ -928,6 +928,12 @@ void qemuMonitorClose(qemuMonitorPtr mon)
         virCondSignal(&mon->notify);
     }
 
+    /* Propagate existing monitor error in case the current thread has no
+     * error set.
+     */
+    if (mon->lastError.code != VIR_ERR_OK && !virGetLastError())
+        virSetError(&mon->lastError);
+
     virObjectUnlock(mon);
     virObjectUnref(mon);
 }