[PATCH] qemu: Report domain name in unexpectedly closed monitor message

Michal Privoznik posted 1 patch 4 months, 3 weeks ago
Failed in applying to current master (apply log)
src/qemu/qemu_monitor.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
[PATCH] qemu: Report domain name in unexpectedly closed monitor message
Posted by Michal Privoznik 4 months, 3 weeks ago
When QEMU closes the monitor suddenly, the following error
message is reported:

  internal error: qemu unexpectedly closed the monitor: ...

And this works. But other error messages produced in the same
function include domain name too. Do that for the unexpectedly
closed monitor message too.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
---
 src/qemu/qemu_monitor.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c
index 71ebd356ad..dacf161971 100644
--- a/src/qemu/qemu_monitor.c
+++ b/src/qemu/qemu_monitor.c
@@ -513,15 +513,18 @@ qemuMonitorIO(GSocket *socket G_GNUC_UNUSED,
 
     if (error || mon->goteof) {
         if (hangup && mon->logFunc != NULL) {
+            g_autofree char *errmsg = NULL;
+
             /* Check if an error message from qemu is available and if so, use
              * it to overwrite the actual message. It's done only in early
              * startup phases or during incoming migration when the message
              * from qemu is certainly more interesting than a
              * "connection reset by peer" message.
              */
-            mon->logFunc(mon,
-                         _("qemu unexpectedly closed the monitor"),
-                         mon->logOpaque);
+
+            errmsg = g_strdup_printf(_("QEMU unexpectedly closed the monitor (vm='%1$s')"),
+                                     mon->domainName);
+            mon->logFunc(mon, errmsg, mon->logOpaque);
             virCopyLastError(&mon->lastError);
             virResetLastError();
         }
-- 
2.39.3
Re: [PATCH] qemu: Report domain name in unexpectedly closed monitor message
Posted by Peter Krempa 4 months, 3 weeks ago
On Tue, May 09, 2023 at 14:51:08 +0300, Michal Privoznik wrote:
> When QEMU closes the monitor suddenly, the following error
> message is reported:
> 
>   internal error: qemu unexpectedly closed the monitor: ...
> 
> And this works. But other error messages produced in the same
> function include domain name too. Do that for the unexpectedly
> closed monitor message too.
> 
> Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
> ---
>  src/qemu/qemu_monitor.c | 9 ++++++---
>  1 file changed, 6 insertions(+), 3 deletions(-)

Reviewed-by: Peter Krempa <pkrempa@redhat.com>