[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 19/27] sheepdog: Support .bdrv_co_create
From: |
Max Reitz |
Subject: |
Re: [Qemu-devel] [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;
> + }
> + }
signature.asc
Description: OpenPGP digital signature
- Re: [Qemu-devel] [PATCH 14/27] gluster: Support .bdrv_co_create, (continued)
- [Qemu-devel] [PATCH 15/27] rbd: Support .bdrv_co_create, Kevin Wolf, 2018/02/08
- [Qemu-devel] [PATCH 16/27] nfs: Use QAPI options in nfs_client_open(), Kevin Wolf, 2018/02/08
- [Qemu-devel] [PATCH 17/27] nfs: Support .bdrv_co_create, Kevin Wolf, 2018/02/08
- [Qemu-devel] [PATCH 18/27] sheepdog: QAPIfy "redundacy" create option, Kevin Wolf, 2018/02/08
- [Qemu-devel] [PATCH 19/27] sheepdog: Support .bdrv_co_create, Kevin Wolf, 2018/02/08
- Re: [Qemu-devel] [PATCH 19/27] sheepdog: Support .bdrv_co_create,
Max Reitz <=
- [Qemu-devel] [PATCH 20/27] ssh: Use QAPI BlockdevOptionsSsh object, Kevin Wolf, 2018/02/08
- [Qemu-devel] [PATCH 21/27] ssh: QAPIfy host-key-check option, Kevin Wolf, 2018/02/08
- [Qemu-devel] [PATCH 22/27] ssh: Pass BlockdevOptionsSsh to connect_to_ssh(), Kevin Wolf, 2018/02/08
- [Qemu-devel] [PATCH 24/27] file-posix: Fix no-op bdrv_truncate() with falloc preallocation, Kevin Wolf, 2018/02/08
- [Qemu-devel] [PATCH 23/27] ssh: Support .bdrv_co_create, Kevin Wolf, 2018/02/08