[PATCH] qemu: Return meaningful error when qemu dies early

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
---
 src/qemu/qemu_monitor.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c
index b2af0ae..bca2612 100644
--- a/src/qemu/qemu_monitor.c
+++ b/src/qemu/qemu_monitor.c
@@ -924,6 +924,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);
 }
-- 
1.9.0

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]