qemu: monitor: Improve error message when QEMU reply is too large

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>
This commit is contained in:
Peter Krempa 2020-01-20 16:06:42 +01:00
parent f4e7c792d5
commit 29d43bf96a

View File

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