[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 06/12] vmdk: Add trivial backing_fmt support
From: |
Kevin Wolf |
Subject: |
[PULL 06/12] vmdk: Add trivial backing_fmt support |
Date: |
Tue, 7 Jul 2020 18:34:58 +0200 |
From: Eric Blake <eblake@redhat.com>
vmdk already requires that if backing_file is present, that it be
another vmdk image (see vmdk_co_do_create). Meanwhile, we want to
move towards always being explicit about the backing format for other
drivers where it matters. So for convenience, make qemu-img create -F
vmdk work, while rejecting all other explicit formats (note that this
is only for QemuOpts usage; there is no change to the QAPI to allow a
format through -blockdev).
Signed-off-by: Eric Blake <eblake@redhat.com>
Message-Id: <20200706203954.341758-5-eblake@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
block/vmdk.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/block/vmdk.c b/block/vmdk.c
index 62da465126..6c58e5ec2e 100644
--- a/block/vmdk.c
+++ b/block/vmdk.c
@@ -2638,6 +2638,14 @@ static int coroutine_fn vmdk_co_create_opts(BlockDriver
*drv,
bool zeroed_grain;
bool compat6;
VMDKCreateOptsData data;
+ char *backing_fmt = NULL;
+
+ backing_fmt = qemu_opt_get_del(opts, BLOCK_OPT_BACKING_FMT);
+ if (backing_fmt && strcmp(backing_fmt, "vmdk") != 0) {
+ error_setg(errp, "backing_file must be a vmdk image");
+ ret = -EINVAL;
+ goto exit;
+ }
if (filename_decompose(filename, path, prefix, postfix, PATH_MAX, errp)) {
ret = -EINVAL;
@@ -2696,6 +2704,7 @@ static int coroutine_fn vmdk_co_create_opts(BlockDriver
*drv,
vmdk_co_create_opts_cb, &data, errp);
exit:
+ g_free(backing_fmt);
g_free(adapter_type);
g_free(backing_file);
g_free(hw_version);
@@ -3031,6 +3040,11 @@ static QemuOptsList vmdk_create_opts = {
.type = QEMU_OPT_STRING,
.help = "File name of a base image"
},
+ {
+ .name = BLOCK_OPT_BACKING_FMT,
+ .type = QEMU_OPT_STRING,
+ .help = "Must be 'vmdk' if present",
+ },
{
.name = BLOCK_OPT_COMPAT6,
.type = QEMU_OPT_BOOL,
--
2.25.4
- [PULL 00/12] Block layer patches, Kevin Wolf, 2020/07/07
- [PULL 01/12] qemu-img map: Don't limit block status request size, Kevin Wolf, 2020/07/07
- [PULL 02/12] file-posix: Mitigate file fragmentation with extent size hints, Kevin Wolf, 2020/07/07
- [PULL 04/12] block: Finish deprecation of 'qemu-img convert -n -o', Kevin Wolf, 2020/07/07
- [PULL 05/12] sheepdog: Add trivial backing_fmt support, Kevin Wolf, 2020/07/07
- [PULL 06/12] vmdk: Add trivial backing_fmt support,
Kevin Wolf <=
- [PULL 07/12] qcow: Tolerate backing_fmt=, Kevin Wolf, 2020/07/07
- [PULL 08/12] block: Error if backing file fails during creation without -u, Kevin Wolf, 2020/07/07
- [PULL 03/12] qemu-img: Flush stdout before before potential stderr messages, Kevin Wolf, 2020/07/07
- [PULL 10/12] iotests: Specify explicit backing format where sensible, Kevin Wolf, 2020/07/07
- [PULL 09/12] qcow2: Deprecate use of qemu-img amend to change backing file, Kevin Wolf, 2020/07/07
- [PULL 12/12] qemu-img: Deprecate use of -b without -F, Kevin Wolf, 2020/07/07
- [PULL 11/12] block: Add support to warn on backing file change without format, Kevin Wolf, 2020/07/07
- Re: [PULL 00/12] Block layer patches, Kevin Wolf, 2020/07/09