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

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

 




On 03/19/2015 05:27 PM, Ján Tomko wrote:
On Thu, Mar 19, 2015 at 11:14:39AM +0800, Luyao Huang wrote:
https://bugzilla.redhat.com/show_bug.cgi?id=1196934

Adding a comment in the bugzilla saying you posted a patch (with a link
to libvir-list archives) can be helpful. Otherwise they might send the
exact same patch - if your was not merged yet, or it was rejected.

got it, I will add a comment next time and thank a lot for your help to add them before.

When start/migrate/restore a vm failed, libvirt will try to catch the log in
Libvirt only uses the error from qemu if qemu exits during the startup.
Start/migrate/restore could fail for other reasons.

/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).
qemuMonitorIO only stores the error in mon->lastError.
It's the functions like qemuMonitorSend and qemuMonitorClose that take
this error and set it via virSetError.

Oh, I see.

Add a check in qemuDomainObjExitMonitor, if there is an error have been
set by other function, we won't overwrite it.
Reworded as:
     When qemu exits during startup, libvirt includes the error from
     /var/log/libvirt/qemu/vm.log in the error message:
$ virsh start test3
     error: Failed to start domain test3
     error: internal error: early end of file from monitor: possible problem:
     2015-02-27T03:03:16.985494Z qemu-kvm: -numa memdev is not supported by
     machine rhel6.5.0
The check for domain liveness added to qemuDomainObjExitMonitor
     in commit dc2fd51f sometimes overwrites this error:
     $ virsh start test3
     error: Failed to start domain test3
     error: operation failed: domain is no longer running
Fix the check to only report an error if there is none set.

Thanks a lot for the reword.

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

ACK and pushed.

Jan

Thanks for your review.

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

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

--
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]