diff options
author | Maxim Levitsky | 2020-03-26 02:12:18 +0100 |
---|---|---|
committer | Max Reitz | 2020-03-26 14:44:33 +0100 |
commit | 5a5e7f8cd86b7ced0732b1b6e28c82baa65b09c9 (patch) | |
tree | 8b31bc0a2fc9cd2b25032ef51546035d8b38e78f /include/block | |
parent | block: pass BlockDriver reference to the .bdrv_co_create (diff) | |
download | qemu-5a5e7f8cd86b7ced0732b1b6e28c82baa65b09c9.tar.gz qemu-5a5e7f8cd86b7ced0732b1b6e28c82baa65b09c9.tar.xz qemu-5a5e7f8cd86b7ced0732b1b6e28c82baa65b09c9.zip |
block: trickle down the fallback image creation function use to the block drivers
Instead of checking the .bdrv_co_create_opts to see if we need the
fallback, just implement the .bdrv_co_create_opts in the drivers that
need it.
This way we don't break various places that need to know if the
underlying protocol/format really supports image creation, and this way
we still allow some drivers to not support image creation.
Fixes: fd17146cd93d1704cd96d7c2757b325fc7aac6fd
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1816007
Note that technically this driver reverts the image creation fallback
for the vxhs driver since I don't have a means to test it, and IMHO it
is better to leave it not supported as it was prior to generic image
creation patches.
Also drop iscsi_create_opts which was left accidentally.
Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com>
Message-Id: <20200326011218.29230-3-mlevitsk@redhat.com>
Reviewed-by: Denis V. Lunev <den@openvz.org>
[mreitz: Fixed alignment, and moved bdrv_co_create_opts_simple() and
bdrv_create_opts_simple from block.h into block_int.h]
Signed-off-by: Max Reitz <mreitz@redhat.com>
Diffstat (limited to 'include/block')
-rw-r--r-- | include/block/block.h | 1 | ||||
-rw-r--r-- | include/block/block_int.h | 11 |
2 files changed, 12 insertions, 0 deletions
diff --git a/include/block/block.h b/include/block/block.h index e569a4d747..b05995fe9c 100644 --- a/include/block/block.h +++ b/include/block/block.h @@ -283,6 +283,7 @@ BlockDriver *bdrv_find_format(const char *format_name); int bdrv_create(BlockDriver *drv, const char* filename, QemuOpts *opts, Error **errp); int bdrv_create_file(const char *filename, QemuOpts *opts, Error **errp); + BlockDriverState *bdrv_new(void); void bdrv_append(BlockDriverState *bs_new, BlockDriverState *bs_top, Error **errp); diff --git a/include/block/block_int.h b/include/block/block_int.h index 57c8ea24b2..4c3587ea19 100644 --- a/include/block/block_int.h +++ b/include/block/block_int.h @@ -1331,4 +1331,15 @@ int refresh_total_sectors(BlockDriverState *bs, int64_t hint); void bdrv_set_monitor_owned(BlockDriverState *bs); BlockDriverState *bds_tree_init(QDict *bs_opts, Error **errp); +/** + * Simple implementation of bdrv_co_create_opts for protocol drivers + * which only support creation via opening a file + * (usually existing raw storage device) + */ +int coroutine_fn bdrv_co_create_opts_simple(BlockDriver *drv, + const char *filename, + QemuOpts *opts, + Error **errp); +extern QemuOptsList bdrv_create_opts_simple; + #endif /* BLOCK_INT_H */ |