[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 56/73] qemu-img: Check create_opts before image creat
From: |
Kevin Wolf |
Subject: |
[Qemu-devel] [PULL 56/73] qemu-img: Check create_opts before image creation |
Date: |
Wed, 10 Dec 2014 11:34:22 +0100 |
From: Max Reitz <address@hidden>
If a driver supports image creation, it needs to set the .create_opts
field. We can use that to make sure .create_opts for both drivers
involved is not NULL for the target image in qemu-img convert, which is
important so that the create_opts pointer in img_convert() is not NULL
after the qemu_opts_append() calls and when going into
qemu_opts_create().
Cc: address@hidden
Signed-off-by: Max Reitz <address@hidden>
Reviewed-by: Kevin Wolf <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>
---
qemu-img.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/qemu-img.c b/qemu-img.c
index a42335c..8c4edf3 100644
--- a/qemu-img.c
+++ b/qemu-img.c
@@ -1531,6 +1531,20 @@ static int img_convert(int argc, char **argv)
goto out;
}
+ if (!drv->create_opts) {
+ error_report("Format driver '%s' does not support image creation",
+ drv->format_name);
+ ret = -1;
+ goto out;
+ }
+
+ if (!proto_drv->create_opts) {
+ error_report("Protocol driver '%s' does not support image creation",
+ proto_drv->format_name);
+ ret = -1;
+ goto out;
+ }
+
create_opts = qemu_opts_append(create_opts, drv->create_opts);
create_opts = qemu_opts_append(create_opts, proto_drv->create_opts);
--
1.8.3.1
- [Qemu-devel] [PULL 46/73] qemu-iotests: 060: Filter the real disk size, (continued)
- [Qemu-devel] [PULL 46/73] qemu-iotests: 060: Filter the real disk size, Kevin Wolf, 2014/12/10
- [Qemu-devel] [PULL 45/73] block: do not use get_clock(), Kevin Wolf, 2014/12/10
- [Qemu-devel] [PULL 48/73] nvme: 64kB page size fixes, Kevin Wolf, 2014/12/10
- [Qemu-devel] [PULL 47/73] qemu-iotests: 082: Filter the real disk size, Kevin Wolf, 2014/12/10
- [Qemu-devel] [PULL 49/73] ide: Check validity of logical block size, Kevin Wolf, 2014/12/10
- [Qemu-devel] [PULL 52/73] block: Omit bdrv_find_format for essential drivers, Kevin Wolf, 2014/12/10
- [Qemu-devel] [PULL 50/73] iotests: Specify qcow2 format for qemu-io in 059, Kevin Wolf, 2014/12/10
- [Qemu-devel] [PULL 51/73] block: Make essential BlockDriver objects public, Kevin Wolf, 2014/12/10
- [Qemu-devel] [PULL 53/73] block/vvfat: qcow driver may not be found, Kevin Wolf, 2014/12/10
- [Qemu-devel] [PULL 54/73] block/nfs: Add create_opts, Kevin Wolf, 2014/12/10
- [Qemu-devel] [PULL 56/73] qemu-img: Check create_opts before image creation,
Kevin Wolf <=
- [Qemu-devel] [PULL 57/73] qemu-img: Check create_opts before image amendment, Kevin Wolf, 2014/12/10
- [Qemu-devel] [PULL 55/73] block: Check create_opts before image creation, Kevin Wolf, 2014/12/10
- [Qemu-devel] [PULL 58/73] iotests: Only kill NBD server if it runs, Kevin Wolf, 2014/12/10
- [Qemu-devel] [PULL 60/73] qcow2: Prevent numerical overflow, Kevin Wolf, 2014/12/10
- [Qemu-devel] [PULL 62/73] qcow2: Respect bdrv_truncate() error, Kevin Wolf, 2014/12/10
- [Qemu-devel] [PULL 61/73] qcow2: Flushing the caches in qcow2_close may fail, Kevin Wolf, 2014/12/10
- [Qemu-devel] [PULL 65/73] block: remove BLOCK_OPT_NOCOW from vdi_create_opts, Kevin Wolf, 2014/12/10
- [Qemu-devel] [PULL 63/73] block/raw-posix: Fix ret in raw_open_common(), Kevin Wolf, 2014/12/10
- [Qemu-devel] [PULL 66/73] block: remove BLOCK_OPT_NOCOW from vpc_create_opts, Kevin Wolf, 2014/12/10
- [Qemu-devel] [PULL 68/73] vmdk: Use g_random_int to generate CID, Kevin Wolf, 2014/12/10