Skip to content

block: Let drivers reconstruct the filename

Max Reitz qemu-devel 1 version Applied

Status from this message: Thanks, applied all to the block branch.

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest6 patches 7 repliesApplied

Patches in v1 Applied

#Subject and filesSizeRepliesApplied
1/6block: Add bdrv_refresh_filename()block.c include/block/block.h include/block/block_int.h+142 -03 replies
2/6blkdebug: Implement bdrv_refresh_filename()block/blkdebug.c+97 -02 replies
3/6blkverify: Implement bdrv_refresh_filename()block/blkverify.c+29 -00 replies
4/6nbd: Implement bdrv_refresh_filename()block/nbd.c+36 -00 replies
5/6quorum: Implement bdrv_refresh_filename()block/quorum.c+39 -00 replies
6/6iotests: Add test for image filename constructiontests/qemu-iotests/099 tests/qemu-iotests/099.out tests/qemu-iotests/group+137 -00 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [Qemu-devel] [PATCH 0/6] block: Let drivers reconstruct the filename

We may sometimes want a filename for BDSs which do not have one because they weren't opened using a simple filename (but rather just through options, for example).

Some block drivers are always capable of reconstructing a valid filename (e.g. NBD), even if the BDS has been opened using the options QDict only. For others (e.g. Quorum) this is impossible. To accommodate this case, the function which reconstructs ("refreshes") the filename for a BDS also generates an options QDict (which should always work). If some layer cannot generate a plain filename (e.g. a Quorum instance), we can still generate a QDict which contains all options necessary for opening the block device in (basically) the same state.

If a filename can be generated, the one stored in the BDS is overwritten. Otherwise, the QDict is converted to JSON, prefixed with "json:" and then used as the filename (making use of the JSON pseudo-protocol).

Block drivers which probably need to implement bdrv_refresh_filename() besides blkdebug, blkverify, NBD and Quorum but which this series does not cover, are the following: curl, ssh and vvfat.

This series supersedes my previous 'block: Fix unset "filename" for certain drivers'.

Max Reitz (6):
block: Add bdrv_refresh_filename()
blkdebug: Implement bdrv_refresh_filename()
blkverify: Implement bdrv_refresh_filename()
nbd: Implement bdrv_refresh_filename()
quorum: Implement bdrv_refresh_filename()
iotests: Add test for image filename construction

 block.c                    | 135 +++++++++++++++++++++++++++++++++++++++++++++
 block/blkdebug.c           |  97 ++++++++++++++++++++++++++++++++
 block/blkverify.c          |  29 ++++++++++
 block/nbd.c                |  36 ++++++++++++
 block/quorum.c             |  39 +++++++++++++
 include/block/block.h      |   1 +
 include/block/block_int.h  |   6 ++
 tests/qemu-iotests/099     | 116 ++++++++++++++++++++++++++++++++++++++
 tests/qemu-iotests/099.out |  20 +++++++
 tests/qemu-iotests/group   |   1 +
 10 files changed, 480 insertions(+)
 create mode 100755 tests/qemu-iotests/099
 create mode 100644 tests/qemu-iotests/099.out
Signature · 1 line
2.0.1