Re: [PATCH v2 01/15] block: Add 'active' field to BlockDeviceInfo

2025-02-03 Thread Stefan Hajnoczi
On Thu, Jan 30, 2025 at 06:12:32PM +0100, Kevin Wolf wrote:
> This allows querying from QMP (and also HMP) whether an image is
> currently active or inactive (in the sense of BDRV_O_INACTIVE).
> 
> Signed-off-by: Kevin Wolf 
> ---
>  qapi/block-core.json   |  6 +-
>  block/monitor/block-hmp-cmds.c |  5 +++--
>  block/qapi.c   |  1 +
>  tests/qemu-iotests/184.out |  2 ++
>  tests/qemu-iotests/191.out | 16 
>  tests/qemu-iotests/273.out |  5 +
>  6 files changed, 32 insertions(+), 3 deletions(-)

Reviewed-by: Stefan Hajnoczi 


signature.asc
Description: PGP signature


Re: [PATCH v2 01/15] block: Add 'active' field to BlockDeviceInfo

2025-01-30 Thread Eric Blake
On Thu, Jan 30, 2025 at 06:12:32PM +0100, Kevin Wolf wrote:
> This allows querying from QMP (and also HMP) whether an image is
> currently active or inactive (in the sense of BDRV_O_INACTIVE).
> 
> Signed-off-by: Kevin Wolf 
> ---

> +++ b/block/qapi.c
> @@ -63,6 +63,7 @@ BlockDeviceInfo *bdrv_block_device_info(BlockBackend *blk,
>  info->file   = g_strdup(bs->filename);
>  info->ro = bdrv_is_read_only(bs);
>  info->drv= g_strdup(bs->drv->format_name);
> +info->active = !bdrv_is_inactive(bs);

Lots of double-negatives - annoying, but I don't see a way around it,
and I agree with your decision to make the public interface use the
positive (active) rather than the negative (inactive), even though the
negative is the unusual case.

Reviewed-by: Eric Blake 

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.
Virtualization:  qemu.org | libguestfs.org