]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemu: monitor: Improve error message when QEMU reply is too large
authorPeter Krempa <pkrempa@redhat.com>
Mon, 20 Jan 2020 15:06:42 +0000 (16:06 +0100)
committerPeter Krempa <pkrempa@redhat.com>
Fri, 24 Jan 2020 12:47:45 +0000 (13:47 +0100)
Don't use ERANGE as it doesn't make much sense in the error message.
Also point out that the reply from qemu was too large which is not
obvious from the original error:

 error: No complete monitor response found in 10485760 bytes: Numerical result out of range

The new message will read:

 error: internal error: QEMU monitor reply exceeds buffer size (10485760 bytes)

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
src/qemu/qemu_monitor.c

index ccd20b3740f3d1bb0cee740f2f904f3816ef9ca2..e3bd000ccb16467cb662816b79381033c4706905 100644 (file)
@@ -484,9 +484,9 @@ qemuMonitorIORead(qemuMonitorPtr mon)
 
     if (avail < 1024) {
         if (mon->bufferLength >= QEMU_MONITOR_MAX_RESPONSE) {
-            virReportSystemError(ERANGE,
-                                 _("No complete monitor response found in %d bytes"),
-                                 QEMU_MONITOR_MAX_RESPONSE);
+            virReportError(VIR_ERR_INTERNAL_ERROR,
+                           _("QEMU monitor reply exceeds buffer size (%d bytes)"),
+                           QEMU_MONITOR_MAX_RESPONSE);
             return -1;
         }
         if (VIR_REALLOC_N(mon->buffer,