From: Jiri Denemark Date: Mon, 17 Mar 2014 10:04:07 +0000 (+0100) Subject: qemu: Return meaningful error when qemu dies early X-Git-Tag: v1.2.3-rc1~96 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cfa7ceab7735410c0427136236bf8bad10670816;p=thirdparty%2Flibvirt.git qemu: Return meaningful error when qemu dies early 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 --- diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c index 5f8a5f4cbb..48fc51cf87 100644 --- a/src/qemu/qemu_monitor.c +++ b/src/qemu/qemu_monitor.c @@ -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); }