qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 2/5] iotests.py: Add qemu_nbd_early_pipe()


From: Eric Blake
Subject: Re: [Qemu-devel] [PATCH 2/5] iotests.py: Add qemu_nbd_early_pipe()
Date: Tue, 7 May 2019 14:34:47 -0500
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1

On 5/7/19 1:36 PM, Max Reitz wrote:
> qemu_nbd_pipe() currently unconditionally reads qemu-nbd's output.  That
> is not ideal because qemu-nbd may keep stderr open after the parent
> process has exited.
> 
> Currently, the only user of qemu_nbd_pipe() is 147, which discards the
> whole output if the parent process returned success and only evaluates
> it on error.  Therefore, we can replace qemu_nbd_pipe() by
> qemu_nbd_early_pipe() that does the same: Discard the output on success,
> and return it on error.
> 
> Signed-off-by: Max Reitz <address@hidden>
> ---
>  tests/qemu-iotests/147        | 4 ++--
>  tests/qemu-iotests/iotests.py | 9 ++++++---
>  2 files changed, 8 insertions(+), 5 deletions(-)
> 

> @@ -216,7 +216,10 @@ def qemu_nbd_pipe(*args):
>          sys.stderr.write('qemu-nbd received signal %i: %s\n' %
>                           (-exitcode,
>                            ' '.join(qemu_nbd_args + ['--fork'] + list(args))))
> -    return exitcode, subp.communicate()[0]
> +    if exitcode == 0:
> +        return exitcode, ''
> +    else:
> +        return exitcode, subp.communicate()[0]
>  

Reviewed-by: Eric Blake <address@hidden>

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]