[libvirt] [PATCH v5 09/36] qemu_process: Persist stderr in qemuProcessQmp struct

Jiri Denemark jdenemar at redhat.com
Thu Jan 3 14:15:51 UTC 2019


On Sun, Dec 02, 2018 at 23:10:03 -0600, Chris Venteicher wrote:
> A qemuProcessQmp struct tracks the entire lifespan of a single QEMU Process
> including storing error output when the process terminates or activation
> fails.
> 
> Error output remains available until qemuProcessQmpFree is called.
> 
> The qmperr variable is renamed stderr (captures stderr from process.)
> 
> The stderr buffer no longer needs to be maintained outside of the
> qemuProcessQmp structure because the structure is used for a single QEMU
> process and the structures can be maintained as long as required
> to retrieve the process error info.
> 
> Signed-off-by: Chris Venteicher <cventeic at redhat.com>
> ---
>  src/qemu/qemu_capabilities.c | 8 +++-----
>  src/qemu/qemu_process.c      | 9 +++------
>  src/qemu/qemu_process.h      | 3 +--
>  3 files changed, 7 insertions(+), 13 deletions(-)
> 
> diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
> index 1efec85b57..997f8c19d5 100644
> --- a/src/qemu/qemu_capabilities.c
> +++ b/src/qemu/qemu_capabilities.c
> @@ -4259,18 +4259,17 @@ virQEMUCapsInitQMP(virQEMUCapsPtr qemuCaps,
>  {
>      qemuProcessQmpPtr proc = NULL;
>      qemuProcessQmpPtr procTCG = NULL;
> -    char *qmperr = NULL;
>      int ret = -1;
>  
>      if (!(proc = qemuProcessQmpNew(qemuCaps->binary, libDir,
> -                                   runUid, runGid, &qmperr, false)))
> +                                   runUid, runGid, false)))
>          goto cleanup;
>  
>      if (qemuProcessQmpRun(proc) < 0) {
>          if (proc->status != 0)
>              virReportError(VIR_ERR_INTERNAL_ERROR,
>                             _("Failed to probe QEMU binary with QMP: %s"),
> -                           qmperr ? qmperr : _("uknown error"));
> +                           proc->stderr ? proc->stderr : _("uknown error"));
>  
>          goto cleanup;
>      }

This patch will obviously change a bit according to the comments to
previous patches.

Jirka




More information about the libvir-list mailing list