[PATCH v2 2/5] qemu_passt: Report passt's error on failed start

Laine Stump laine at redhat.com
Thu Feb 16 16:38:45 UTC 2023


On 2/16/23 8:32 AM, Michal Privoznik wrote:
> When starting passt, it may write something onto its stderr
> (convincing it to print even more is addressed later). Pass this
> string we read to user.
> 
> Since we're not daemonizing passt anymore (see previous commit),
> we can let virCommand module do all the heavy lifting and switch
> to virCommandSetErrorBuffer() instead of reading error from an
> FD.
> 
> Signed-off-by: Michal Privoznik <mprivozn at redhat.com>

Reviewed-by: Laine Stump <laine at redhat.com>

(also a part of the reverted patch)

> ---
>   src/qemu/qemu_passt.c | 6 +++---
>   1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/src/qemu/qemu_passt.c b/src/qemu/qemu_passt.c
> index adc69fc052..c082c149cd 100644
> --- a/src/qemu/qemu_passt.c
> +++ b/src/qemu/qemu_passt.c
> @@ -144,18 +144,18 @@ qemuPasstStart(virDomainObj *vm,
>       g_autofree char *passtSocketName = qemuPasstCreateSocketPath(vm, net);
>       g_autoptr(virCommand) cmd = NULL;
>       g_autofree char *pidfile = qemuPasstCreatePidFilename(vm, net);
> +    g_autofree char *errbuf = NULL;
>       char macaddr[VIR_MAC_STRING_BUFLEN];
>       size_t i;
>       pid_t pid = (pid_t) -1;
>       int exitstatus = 0;
>       int cmdret = 0;
> -    VIR_AUTOCLOSE errfd = -1;
>   
>       cmd = virCommandNew(PASST);
>   
>       virCommandClearCaps(cmd);
>       virCommandSetPidFile(cmd, pidfile);
> -    virCommandSetErrorFD(cmd, &errfd);
> +    virCommandSetErrorBuffer(cmd, &errbuf);
>   
>       virCommandAddArgList(cmd,
>                            "--one-off",
> @@ -266,7 +266,7 @@ qemuPasstStart(virDomainObj *vm,
>   
>       if (cmdret < 0 || exitstatus != 0) {
>           virReportError(VIR_ERR_INTERNAL_ERROR,
> -                       _("Could not start 'passt'. exitstatus: %d"), exitstatus);
> +                       _("Could not start 'passt': %s"), NULLSTR(errbuf));
>           goto error;
>       }
>   



More information about the libvir-list mailing list