[libvirt] [PATCH] qemu: fix sometimes error overwrite when we fail to start/migrate/restore

Luyao Huang lhuang at redhat.com
Thu Mar 19 03:14:39 UTC 2015


https://bugzilla.redhat.com/show_bug.cgi?id=1196934

When start/migrate/restore a vm failed, libvirt will try to catch the log in
/var/log/libvirt/qemu/vm.log and output them before. However we add a check in
qemuDomainObjExitMonitor after commit dc2fd51f, this will overwrite
the error set in priv->mon which has set by qemuMonitorIO (a qemu monitor
I/O event callback function).

Add a check in qemuDomainObjExitMonitor, if there is an error have been
set by other function, we won't overwrite it.

Signed-off-by: Luyao Huang <lhuang at redhat.com>
---
 src/qemu/qemu_domain.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 2eacef2..41d1263 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -1609,8 +1609,9 @@ int qemuDomainObjExitMonitor(virQEMUDriverPtr driver,
 {
     qemuDomainObjExitMonitorInternal(driver, obj);
     if (!virDomainObjIsActive(obj)) {
-        virReportError(VIR_ERR_OPERATION_FAILED, "%s",
-                       _("domain is no longer running"));
+        if (!virGetLastError())
+            virReportError(VIR_ERR_OPERATION_FAILED, "%s",
+                           _("domain is no longer running"));
         return -1;
     }
     return 0;
-- 
1.8.3.1




More information about the libvir-list mailing list