qemu-block
[Top][All Lists]
Advanced

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

Re: [Qemu-block] [PATCH 11/27] block: x-blockdev-create QMP command


From: Max Reitz
Subject: Re: [Qemu-block] [PATCH 11/27] block: x-blockdev-create QMP command
Date: Mon, 12 Feb 2018 14:48:41 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2

On 2018-02-08 20:23, Kevin Wolf wrote:
> This adds a synchronous x-blockdev-create QMP command that can create
> qcow2 images on a given node name.
> 
> We don't want to block while creating an image, so this is not the final
> interface in all aspects, but BlockdevCreateOptionsQcow2 and
> .bdrv_co_create() are what they actually might look like in the end. In
> any case, this should be good enough to test whether we interpret
> BlockdevCreateOptions as we should.
> 
> Signed-off-by: Kevin Wolf <address@hidden>
> ---
>  qapi/block-core.json      | 12 ++++++++
>  include/block/block.h     |  1 +
>  include/block/block_int.h |  2 ++
>  block.c                   |  2 +-
>  block/create.c            | 75 
> +++++++++++++++++++++++++++++++++++++++++++++++
>  block/qcow2.c             |  3 +-
>  block/Makefile.objs       |  2 +-
>  7 files changed, 94 insertions(+), 3 deletions(-)
>  create mode 100644 block/create.c

[...]

> diff --git a/block/create.c b/block/create.c
> new file mode 100644
> index 0000000000..e95446a0f3
> --- /dev/null
> +++ b/block/create.c
> @@ -0,0 +1,75 @@

[...]

> +void qmp_x_blockdev_create(BlockdevCreateOptions *options, Error **errp)
> +{
> +    const char *fmt = BlockdevDriver_str(options->driver);
> +    BlockDriver *drv = bdrv_find_format(fmt);
> +    Coroutine *co;
> +    BlockdevCreateCo cco;
> +
> +    /* If the driver is in the schema, we know that it exists. But it may not
> +     * be whitelisted. */
> +    assert(drv);
> +    if (bdrv_uses_whitelist() && !bdrv_is_whitelisted(drv, true)) {

Isn't this more of an R/W case than RO?

Max

> +        error_setg(errp, "Driver is not whitelisted");
> +        return;
> +    }

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]