block: Add 'active' field to BlockDeviceInfo

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 <kwolf@redhat.com>
Acked-by: Fabiano Rosas <farosas@suse.de>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-ID: <20250204211407.381505-2-kwolf@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
This commit is contained in:
Kevin Wolf 2025-02-04 22:13:52 +01:00
parent 107c551de0
commit aec81049c2
8 changed files with 39 additions and 3 deletions

View file

@ -6824,6 +6824,10 @@ void bdrv_init_with_whitelist(void)
bdrv_init();
}
bool bdrv_is_inactive(BlockDriverState *bs) {
return bs->open_flags & BDRV_O_INACTIVE;
}
int bdrv_activate(BlockDriverState *bs, Error **errp)
{
BdrvChild *child, *parent;