Signed-off-by: Fiona Ebner <f.eb...@proxmox.com> --- block/zeroinit.c | 12 +++++++++--- qapi/block-core.json | 5 +++-- 2 files changed, 12 insertions(+), 5 deletions(-)
diff --git a/block/zeroinit.c b/block/zeroinit.c index f9d513db15..036edb17f5 100644 --- a/block/zeroinit.c +++ b/block/zeroinit.c @@ -66,6 +66,7 @@ static int zeroinit_open(BlockDriverState *bs, QDict *options, int flags, QemuOpts *opts; Error *local_err = NULL; int ret; + const char *next = NULL; s->extents = 0; @@ -77,9 +78,14 @@ static int zeroinit_open(BlockDriverState *bs, QDict *options, int flags, goto fail; } - /* Open the raw file */ - ret = bdrv_open_file_child(qemu_opt_get(opts, "x-next"), options, "next", - bs, &local_err); + + next = qemu_opt_get(opts, "x-next"); + + if (next) { + ret = bdrv_open_file_child(next, options, "next", bs, &local_err); + } else { /* when opened as a blockdev, there is no 'next' option */ + ret = bdrv_open_file_child(NULL, options, "file", bs, &local_err); + } if (ret < 0) { error_propagate(errp, local_err); goto fail; diff --git a/qapi/block-core.json b/qapi/block-core.json index 2fb51215f2..f8ed564cf0 100644 --- a/qapi/block-core.json +++ b/qapi/block-core.json @@ -3586,7 +3586,7 @@ { 'name': 'virtio-blk-vfio-pci', 'if': 'CONFIG_BLKIO' }, { 'name': 'virtio-blk-vhost-user', 'if': 'CONFIG_BLKIO' }, { 'name': 'virtio-blk-vhost-vdpa', 'if': 'CONFIG_BLKIO' }, - 'vmdk', 'vpc', 'vvfat' ] } + 'vmdk', 'vpc', 'vvfat', 'zeroinit' ] } ## # @BlockdevOptionsFile: @@ -5172,7 +5172,8 @@ 'if': 'CONFIG_BLKIO' }, 'vmdk': 'BlockdevOptionsGenericCOWFormat', 'vpc': 'BlockdevOptionsGenericFormat', - 'vvfat': 'BlockdevOptionsVVFAT' + 'vvfat': 'BlockdevOptionsVVFAT', + 'zeroinit': 'BlockdevOptionsGenericFormat' } } ## -- 2.47.2 _______________________________________________ pve-devel mailing list pve-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel