[libvirt] [PATCH] qemu_process: print generic error if qemu exit without printing any error

Peter Krempa pkrempa at redhat.com
Wed Jun 8 08:40:30 UTC 2016


On Mon, May 30, 2016 at 09:38:29 +0200, Pavel Hrdina wrote:
> In this case we would print only the libvirt part of error message without any
> explanation what happened:
> 
> "error: internal error: process exited while connecting to monitor:"
> 
> Let's print a generic error if this happens.
> 
> Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1335617
> 
> Signed-off-by: Pavel Hrdina <phrdina at redhat.com>
> ---
>  src/qemu/qemu_process.c | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
> index e847cd1..86701da 100644
> --- a/src/qemu/qemu_process.c
> +++ b/src/qemu/qemu_process.c
> @@ -1808,6 +1808,13 @@ qemuProcessReportLogError(qemuDomainLogContextPtr logCtxt,
>      if (qemuProcessReadLog(logCtxt, &logmsg) < 0)
>          return -1;
>  
> +    if (virStringIsEmpty(logmsg)) {
> +        VIR_FREE(logmsg);
> +        if (VIR_STRDUP(logmsg, _("qemu process exited without any "
> +                                 "error printed out")) < 0)

As this is used also at points where we aren't executing a qemu process
yet (before exec) thus the message will be invalid.

> +            return -1;
> +    }

I'd rather see us not print the colon and the empty string if the log is
empty. In addition this will require to modify the message in
qemu_monitor.c that states "early end of file from monitor, possible
problem" which doesn't make sense without the message.

If we state "qemu unexpectedly closed the monitor" or something similar
that should be good enough to be used with or without the colon.

> +
>      virResetLastError();
>      virReportError(VIR_ERR_INTERNAL_ERROR,
>                     _("%s: %s"), msgprefix, logmsg);

Peter




More information about the libvir-list mailing list