]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemu: monitor: do not report error on shutdown
authorChristian Ehrhardt <christian.ehrhardt@canonical.com>
Thu, 9 Mar 2017 09:54:32 +0000 (10:54 +0100)
committerMartin Kletzander <mkletzan@redhat.com>
Mon, 15 May 2017 10:34:19 +0000 (12:34 +0200)
If a shutdown is expected because it was triggered via libvirt we can
also expect the monitor to close. In those cases do not report an
internal error like:
  "internal error: End of file from qemu monitor"

Signed-off-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
src/qemu/qemu_monitor.c

index 1d40d521a9b3c6ddd1d7476ded56eea0d5f71f5c..2148d483ed6a2a2fca585eaf77eb5339484f2a97 100644 (file)
@@ -63,6 +63,7 @@ struct _qemuMonitor {
     int fd;
     int watch;
     int hasSendFD;
+    int willhangup;
 
     virDomainObjPtr vm;
 
@@ -693,8 +694,10 @@ qemuMonitorIO(int watch, int fd, int events, void *opaque)
         if (events & VIR_EVENT_HANDLE_HANGUP) {
             hangup = true;
             if (!error) {
-                virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
-                               _("End of file from qemu monitor"));
+                if (!mon->willhangup) {
+                    virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                                   _("End of file from qemu monitor"));
+                }
                 eof = true;
                 events &= ~VIR_EVENT_HANDLE_HANGUP;
             }
@@ -733,7 +736,7 @@ qemuMonitorIO(int watch, int fd, int events, void *opaque)
         if (mon->lastError.code != VIR_ERR_OK) {
             /* Already have an error, so clear any new error */
             virResetLastError();
-        } else {
+        } else if (!mon->willhangup) {
             virErrorPtr err = virGetLastError();
             if (!err)
                 virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
@@ -1327,6 +1330,7 @@ qemuMonitorEmitShutdown(qemuMonitorPtr mon)
 {
     int ret = -1;
     VIR_DEBUG("mon=%p", mon);
+    mon->willhangup = 1;
 
     QEMU_MONITOR_CALLBACK(mon, ret, domainShutdown, mon->vm);
     return ret;