qemu-block
[Top][All Lists]
Advanced

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

Re: [Qemu-block] [PATCH 19/27] sheepdog: Support .bdrv_co_create


From: Max Reitz
Subject: Re: [Qemu-block] [PATCH 19/27] sheepdog: Support .bdrv_co_create
Date: Mon, 12 Feb 2018 17:43:55 +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 the .bdrv_co_create driver callback to sheepdog, which enables
> image creation over QMP.
> 
> Signed-off-by: Kevin Wolf <address@hidden>
> ---
>  qapi/block-core.json |  24 +++++-
>  block/sheepdog.c     | 209 
> ++++++++++++++++++++++++++++++++++++---------------
>  2 files changed, 170 insertions(+), 63 deletions(-)
> 
> diff --git a/qapi/block-core.json b/qapi/block-core.json
> index 7d004dddf9..08217e3e38 100644
> --- a/qapi/block-core.json
> +++ b/qapi/block-core.json
> @@ -3492,6 +3492,28 @@
>              'erasure-coded': 'SheepdogRedundancyErasureCoded' } }
>  
>  ##
> +# @BlockdevCreateOptionsSheepdog:
> +#
> +# Driver specific image creation options for Sheepdog.
> +#
> +# @location         Where to store the new image file
> +# @size             Size of the virtual disk in bytes
> +# @backing_file     File name of a base image

s/_/-/

With that fixed:

Reviewed-by: Max Reitz <address@hidden>

> +# @preallocation    Preallocation mode (allowed values: off, full)
> +# @redundancy       Redundancy of the image
> +# @object-size      Object size of the image
> +#
> +# Since: 2.12
> +##
> +{ 'struct': 'BlockdevCreateOptionsSheepdog',
> +  'data': { 'location':         'BlockdevOptionsSheepdog',
> +            'size':             'size',
> +            '*backing-file':    'str',
> +            '*preallocation':   'PreallocMode',
> +            '*redundancy':      'SheepdogRedundancy',
> +            '*object-size':     'size' } }
> +
> +##
>  # @BlockdevCreateNotSupported:
>  #
>  # This is used for all drivers that don't support creating images.

[...]

> index dc0348f120..05129dc809 100644
> --- a/block/sheepdog.c
> +++ b/block/sheepdog.c

[...]

> @@ -2142,15 +2144,95 @@ static int sd_create(const char *filename, QemuOpts 
> *opts,

[...]

> +static int sd_create(const char *filename, QemuOpts *opts,
> +                     Error **errp)
> +{

[...]

> +    v = qobject_input_visitor_new_keyval(crumpled);
> +    visit_type_BlockdevCreateOptions(v, NULL, &create_options, &local_err);
> +    visit_free(v);
> +    qobject_decref(crumpled);
> +
> +    if (local_err) {
> +        error_propagate(errp, local_err);
> +        ret = -EINVAL;
> +        goto fail;
> +    }
> +
> +    create_options->u.sheepdog.size =
> +        ROUND_UP(create_options->u.sheepdog.size, BDRV_SECTOR_SIZE);

I think I'd prefer an assertion that the type is indeed sheepdog before
this.

> +
> +    if (redundancy) {
> +        create_options->u.sheepdog.has_redundancy = true;
> +        create_options->u.sheepdog.redundancy =
> +            parse_redundancy_str(redundancy);
> +        if (create_options->u.sheepdog.redundancy == NULL) {
> +            error_setg(errp, "Invalid redundancy mode");
> +            ret = -EINVAL;
> +            goto fail;
> +        }
> +    }

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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