c1c534
From be2ee0f5055cff0fd449ce972935f1af8ebfee84 Mon Sep 17 00:00:00 2001
c1c534
Message-Id: <be2ee0f5055cff0fd449ce972935f1af8ebfee84@dist-git>
c1c534
From: Michal Privoznik <mprivozn@redhat.com>
c1c534
Date: Fri, 19 Jan 2018 14:35:17 +0100
c1c534
Subject: [PATCH] Revert "qemu: monitor: do not report error on shutdown"
c1c534
c1c534
https://bugzilla.redhat.com/show_bug.cgi?id=1536461
c1c534
c1c534
This reverts commit aeda1b8c56dc58b0a413acc61bbea938b40499e1.
c1c534
c1c534
Problem is that we need mon->lastError to be set because it's
c1c534
used all over the place. Also, there's nothing wrong with
c1c534
reporting error if one occurred. I mean, if there's a thread
c1c534
executing an API and which currently is talking on monitor it
c1c534
definitely wants the error reported.
c1c534
c1c534
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
c1c534
(cherry picked from commit 72adaf2f10509c3682f2c65ffad4176e00e5a2fb)
c1c534
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
c1c534
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
c1c534
---
c1c534
 src/qemu/qemu_monitor.c | 10 +++-------
c1c534
 1 file changed, 3 insertions(+), 7 deletions(-)
c1c534
c1c534
diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c
c1c534
index 12ad45d340..b6af209a83 100644
c1c534
--- a/src/qemu/qemu_monitor.c
c1c534
+++ b/src/qemu/qemu_monitor.c
c1c534
@@ -69,7 +69,6 @@ struct _qemuMonitor {
c1c534
      * < 0: an error occurred during the registration of @fd */
c1c534
     int watch;
c1c534
     int hasSendFD;
c1c534
-    int willhangup;
c1c534
 
c1c534
     virDomainObjPtr vm;
c1c534
 
c1c534
@@ -701,10 +700,8 @@ qemuMonitorIO(int watch, int fd, int events, void *opaque)
c1c534
         if (events & VIR_EVENT_HANDLE_HANGUP) {
c1c534
             hangup = true;
c1c534
             if (!error) {
c1c534
-                if (!mon->willhangup) {
c1c534
-                    virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
c1c534
-                                   _("End of file from qemu monitor"));
c1c534
-                }
c1c534
+                virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
c1c534
+                               _("End of file from qemu monitor"));
c1c534
                 eof = true;
c1c534
                 events &= ~VIR_EVENT_HANDLE_HANGUP;
c1c534
             }
c1c534
@@ -743,7 +740,7 @@ qemuMonitorIO(int watch, int fd, int events, void *opaque)
c1c534
         if (mon->lastError.code != VIR_ERR_OK) {
c1c534
             /* Already have an error, so clear any new error */
c1c534
             virResetLastError();
c1c534
-        } else if (!mon->willhangup) {
c1c534
+        } else {
c1c534
             virErrorPtr err = virGetLastError();
c1c534
             if (!err)
c1c534
                 virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
c1c534
@@ -1337,7 +1334,6 @@ qemuMonitorEmitShutdown(qemuMonitorPtr mon, virTristateBool guest)
c1c534
 {
c1c534
     int ret = -1;
c1c534
     VIR_DEBUG("mon=%p guest=%u", mon, guest);
c1c534
-    mon->willhangup = 1;
c1c534
 
c1c534
     QEMU_MONITOR_CALLBACK(mon, ret, domainShutdown, mon->vm, guest);
c1c534
     return ret;
c1c534
-- 
c1c534
2.16.1
c1c534