[libvirt] [RFC] qemu: monitor: do not report error on shutdown

Christian Ehrhardt posted 1 patch 123 weeks ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/1489053272-13524-1-git-send-email-christian.ehrhardt@canonical.com
src/qemu/qemu_monitor.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)

[libvirt] [RFC] qemu: monitor: do not report error on shutdown

Posted by Christian Ehrhardt 123 weeks ago
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 | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c
index d71f84c..352cc8a 100644
--- a/src/qemu/qemu_monitor.c
+++ b/src/qemu/qemu_monitor.c
@@ -63,6 +63,7 @@ struct _qemuMonitor {
     int fd;
     int watch;
     int hasSendFD;
+    int willhangup;
 
     virDomainObjPtr vm;
 
@@ -691,8 +692,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;
             }
@@ -731,7 +734,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",
@@ -1282,6 +1285,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;
-- 
2.7.4

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

Re: [libvirt] [RFC] qemu: monitor: do not report error on shutdown

Posted by Christian Ehrhardt 123 weeks ago
On Thu, Mar 9, 2017 at 10:54 AM, Christian Ehrhardt <
christian.ehrhardt@canonical.com> wrote:

> In those cases do not report an
> internal error like:
>   "internal error: End of file from qemu monitor"
>

There is some extra background on the issue that shall be fixed at [1].
According to my experiments this seems to happen in general (various
distros, upstream), but since my gut feeling isn't sure if I might have
followed a red-herring I explicitly marked the patch as RFC for now.

Note: I also have seen similar EOF messages of virtlogd on guest start that
I have not looked at yet

[1]: https://bugs.launchpad.net/ubuntu/+source/libvirt/+bug/1582990


-- 
Christian Ehrhardt
Software Engineer, Ubuntu Server
Canonical Ltd
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [RFC] qemu: monitor: do not report error on shutdown

Posted by Martin Kletzander 114 weeks ago
On Thu, Mar 09, 2017 at 10:59:45AM +0100, Christian Ehrhardt wrote:
>On Thu, Mar 9, 2017 at 10:54 AM, Christian Ehrhardt <
>christian.ehrhardt@canonical.com> wrote:
>
>> In those cases do not report an
>> internal error like:
>>   "internal error: End of file from qemu monitor"
>>
>
>There is some extra background on the issue that shall be fixed at [1].
>According to my experiments this seems to happen in general (various
>distros, upstream), but since my gut feeling isn't sure if I might have
>followed a red-herring I explicitly marked the patch as RFC for now.
>
>Note: I also have seen similar EOF messages of virtlogd on guest start that
>I have not looked at yet
>
>[1]: https://bugs.launchpad.net/ubuntu/+source/libvirt/+bug/1582990
>

Either I forgot to reply or the reply got lost (it wouldn't be the first
time).  I found the patch usable as-is, not only as an RFC.  Even though
I have yet to encounter such error message, I think the handling you
suggested makes perfect sense.  ACK && Pushed now.

>
>--
>Christian Ehrhardt
>Software Engineer, Ubuntu Server
>Canonical Ltd

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