[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [qemu-upstream-unstable] block: Check create_opts before image creation



commit 6065d5484a092d55b274876d1fafb8223041842a
Author:     Max Reitz <mreitz@xxxxxxxxxx>
AuthorDate: Tue Dec 2 18:32:45 2014 +0100
Commit:     Michael Roth <mdroth@xxxxxxxxxxxxxxxxxx>
CommitDate: Sun Feb 22 12:03:44 2015 -0600

    block: Check create_opts before image creation
    
    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: qemu-stable@xxxxxxxxxx
    Signed-off-by: Max Reitz <mreitz@xxxxxxxxxx>
    Reviewed-by: Kevin Wolf <kwolf@xxxxxxxxxx>
    Signed-off-by: Kevin Wolf <kwolf@xxxxxxxxxx>
    (cherry picked from commit c6149724080af7b3d5d61eac8942655e6d212783)
    Signed-off-by: Michael Roth <mdroth@xxxxxxxxxxxxxxxxxx>
---
 block.c |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)

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);
 
--
generated by git-patchbot for /home/xen/git/qemu-upstream-unstable.git

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.