[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 05/43] block: Check create_opts before image creatio
From: |
Michael Roth |
Subject: |
[Qemu-devel] [PATCH 05/43] block: Check create_opts before image creation |
Date: |
Tue, 24 Feb 2015 15:47:40 -0600 |
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 in bdrv_img_create(), which is important so that
the create_opts pointer in that function 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>
(cherry picked from commit c6149724080af7b3d5d61eac8942655e6d212783)
Signed-off-by: Michael Roth <address@hidden>
---
block.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/block.c b/block.c
index a6197da..07f58fc 100644
--- a/block.c
+++ b/block.c
@@ -5534,6 +5534,18 @@ void bdrv_img_create(const char *filename, const char
*fmt,
return;
}
+ if (!drv->create_opts) {
+ error_setg(errp, "Format driver '%s' does not support image creation",
+ drv->format_name);
+ return;
+ }
+
+ if (!proto_drv->create_opts) {
+ error_setg(errp, "Protocol driver '%s' does not support image
creation",
+ proto_drv->format_name);
+ return;
+ }
+
create_opts = qemu_opts_append(create_opts, drv->create_opts);
create_opts = qemu_opts_append(create_opts, proto_drv->create_opts);
--
1.9.1
- [Qemu-devel] [PATCH 37/43] vfio-pci: Fix missing unparent of dynamically allocated MemoryRegion, (continued)
- [Qemu-devel] [PATCH 37/43] vfio-pci: Fix missing unparent of dynamically allocated MemoryRegion, Michael Roth, 2015/02/24
- [Qemu-devel] [PATCH 38/43] qemu-thread: fix qemu_event without futexes, Michael Roth, 2015/02/24
- [Qemu-devel] [PATCH 40/43] fix mc146818rtc wrong subsection name to avoid vmstate_subsection_load() fail, Michael Roth, 2015/02/24
- [Qemu-devel] [PATCH 03/43] block/vvfat: qcow driver may not be found, Michael Roth, 2015/02/24
- [Qemu-devel] [PATCH 43/43] exec: change default exception_index value for migration to -1, Michael Roth, 2015/02/24
- [Qemu-devel] [PATCH 41/43] block/iscsi: fix uninitialized variable, Michael Roth, 2015/02/24
- [Qemu-devel] [PATCH 42/43] qtest: Fix deadloop by running main loop AIO context's timers, Michael Roth, 2015/02/24
- [Qemu-devel] [PATCH 06/43] qemu-img: Check create_opts before image creation, Michael Roth, 2015/02/24
- [Qemu-devel] [PATCH 04/43] block/nfs: Add create_opts, Michael Roth, 2015/02/24
- [Qemu-devel] [PATCH 08/43] iotests: Only kill NBD server if it runs, Michael Roth, 2015/02/24
- [Qemu-devel] [PATCH 05/43] block: Check create_opts before image creation,
Michael Roth <=
- [Qemu-devel] [PATCH 07/43] qemu-img: Check create_opts before image amendment, Michael Roth, 2015/02/24
- Re: [Qemu-devel] [Qemu-stable] Patch Round-up for stable 2.2.1, freeze on 2015-03-05, Gonglei (Arei), 2015/02/24
- Re: [Qemu-devel] Patch Round-up for stable 2.2.1, freeze on 2015-03-05, Leon Alrae, 2015/02/25