render / rpms / libvirt

Forked from rpms/libvirt 9 months ago
Clone
d76c62
From a3bea49c6960a468ee28b6d8dd0664c1ebcbcd02 Mon Sep 17 00:00:00 2001
d76c62
Message-Id: <a3bea49c6960a468ee28b6d8dd0664c1ebcbcd02@dist-git>
d76c62
From: Peter Krempa <pkrempa@redhat.com>
d76c62
Date: Tue, 4 Feb 2020 15:07:46 +0100
d76c62
Subject: [PATCH] qemu: monitor: Improve error message when QEMU reply is too
d76c62
 large
d76c62
MIME-Version: 1.0
d76c62
Content-Type: text/plain; charset=UTF-8
d76c62
Content-Transfer-Encoding: 8bit
d76c62
d76c62
Don't use ERANGE as it doesn't make much sense in the error message.
d76c62
Also point out that the reply from qemu was too large which is not
d76c62
obvious from the original error:
d76c62
d76c62
 error: No complete monitor response found in 10485760 bytes: Numerical result out of range
d76c62
d76c62
The new message will read:
d76c62
d76c62
 error: internal error: QEMU monitor reply exceeds buffer size (10485760 bytes)
d76c62
d76c62
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
d76c62
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
d76c62
(cherry picked from commit 29d43bf96a3e5886f1b32c78bbb16d1507bd0d9e)
d76c62
d76c62
https://bugzilla.redhat.com/show_bug.cgi?id=1524278
d76c62
Message-Id: <0e03a38f096e556cb82eecdb72e7dd5f86eec752.1580824112.git.pkrempa@redhat.com>
d76c62
Reviewed-by: Ján Tomko <jtomko@redhat.com>
d76c62
---
d76c62
 src/qemu/qemu_monitor.c | 6 +++---
d76c62
 1 file changed, 3 insertions(+), 3 deletions(-)
d76c62
d76c62
diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c
d76c62
index 4f547bf5ec..0e67851690 100644
d76c62
--- a/src/qemu/qemu_monitor.c
d76c62
+++ b/src/qemu/qemu_monitor.c
d76c62
@@ -485,9 +485,9 @@ qemuMonitorIORead(qemuMonitorPtr mon)
d76c62
 
d76c62
     if (avail < 1024) {
d76c62
         if (mon->bufferLength >= QEMU_MONITOR_MAX_RESPONSE) {
d76c62
-            virReportSystemError(ERANGE,
d76c62
-                                 _("No complete monitor response found in %d bytes"),
d76c62
-                                 QEMU_MONITOR_MAX_RESPONSE);
d76c62
+            virReportError(VIR_ERR_INTERNAL_ERROR,
d76c62
+                           _("QEMU monitor reply exceeds buffer size (%d bytes)"),
d76c62
+                           QEMU_MONITOR_MAX_RESPONSE);
d76c62
             return -1;
d76c62
         }
d76c62
         if (VIR_REALLOC_N(mon->buffer,
d76c62
-- 
d76c62
2.25.0
d76c62