qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Max Reitz <mreitz@redhat.com>
To: Kevin Wolf <kwolf@redhat.com>, qemu-block@nongnu.org
Cc: pkrempa@redhat.com, eblake@redhat.com, jcody@redhat.com,
	jdurgin@redhat.com, mitake.hitoshi@lab.ntt.co.jp,
	namei.unix@gmail.com, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 19/27] sheepdog: Support .bdrv_co_create
Date: Mon, 12 Feb 2018 17:43:55 +0100	[thread overview]
Message-ID: <3a3134a8-19c8-0d9a-15d0-3b904998abd7@redhat.com> (raw)
In-Reply-To: <20180208192328.16550-20-kwolf@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 2950 bytes --]

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 <kwolf@redhat.com>
> ---
>  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 <mreitz@redhat.com>

> +# @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 #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 512 bytes --]

  reply	other threads:[~2018-02-12 16:44 UTC|newest]

Thread overview: 69+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-08 19:23 [Qemu-devel] [PATCH 00/27] x-blockdev-create for protocols and qcow2 Kevin Wolf
2018-02-08 19:23 ` [Qemu-devel] [PATCH 01/27] block/qapi: Introduce BlockdevCreateOptions Kevin Wolf
2018-02-08 22:48   ` Eric Blake
2018-02-09 13:19   ` Max Reitz
2018-02-08 19:23 ` [Qemu-devel] [PATCH 02/27] block/qapi: Add qcow2 create options to schema Kevin Wolf
2018-02-08 23:14   ` Eric Blake
2018-02-09 13:36   ` Max Reitz
2018-02-08 19:23 ` [Qemu-devel] [PATCH 03/27] qcow2: Let qcow2_create() handle protocol layer Kevin Wolf
2018-02-09 13:57   ` Max Reitz
2018-02-08 19:23 ` [Qemu-devel] [PATCH 04/27] qcow2: Pass BlockdevCreateOptions to qcow2_create2() Kevin Wolf
2018-02-08 23:29   ` Eric Blake
2018-02-09 14:00     ` Kevin Wolf
2018-02-09 14:12   ` Max Reitz
2018-02-08 19:23 ` [Qemu-devel] [PATCH 05/27] qcow2: Use BlockdevRef in qcow2_create2() Kevin Wolf
2018-02-09 13:57   ` Eric Blake
2018-02-09 14:31   ` Max Reitz
2018-02-08 19:23 ` [Qemu-devel] [PATCH 06/27] qcow2: Use QCryptoBlockCreateOptions " Kevin Wolf
2018-02-09 14:13   ` Eric Blake
2018-02-09 18:01   ` Max Reitz
2018-02-08 19:23 ` [Qemu-devel] [PATCH 07/27] qcow2: Handle full/falloc preallocation " Kevin Wolf
2018-02-09 18:04   ` Max Reitz
2018-02-12 14:19   ` Max Reitz
2018-02-08 19:23 ` [Qemu-devel] [PATCH 08/27] util: Add qemu_opts_to_qdict_filtered() Kevin Wolf
2018-02-09 18:07   ` Max Reitz
2018-02-15 19:33   ` Eric Blake
2018-02-08 19:23 ` [Qemu-devel] [PATCH 09/27] qdict: Introduce qdict_rename_keys() Kevin Wolf
2018-02-09 18:18   ` Max Reitz
2018-02-09 18:19     ` Max Reitz
2018-02-15 19:39   ` Eric Blake
2018-02-08 19:23 ` [Qemu-devel] [PATCH 10/27] qcow2: Use visitor for options in qcow2_create() Kevin Wolf
2018-02-09 18:43   ` Max Reitz
2018-02-15 19:51   ` Eric Blake
2018-02-08 19:23 ` [Qemu-devel] [PATCH 11/27] block: x-blockdev-create QMP command Kevin Wolf
2018-02-12 13:48   ` Max Reitz
2018-02-15 19:58   ` Eric Blake
2018-02-21 10:29     ` Kevin Wolf
2018-02-21 16:21       ` Eric Blake
2018-02-08 19:23 ` [Qemu-devel] [PATCH 12/27] file-posix: Support .bdrv_co_create Kevin Wolf
2018-02-12 13:55   ` Max Reitz
2018-02-08 19:23 ` [Qemu-devel] [PATCH 13/27] file-win32: " Kevin Wolf
2018-02-12 13:57   ` Max Reitz
2018-02-08 19:23 ` [Qemu-devel] [PATCH 14/27] gluster: " Kevin Wolf
2018-02-12 14:28   ` Max Reitz
2018-02-08 19:23 ` [Qemu-devel] [PATCH 15/27] rbd: " Kevin Wolf
2018-02-12 15:16   ` Max Reitz
2018-02-08 19:23 ` [Qemu-devel] [PATCH 16/27] nfs: Use QAPI options in nfs_client_open() Kevin Wolf
2018-02-12 15:36   ` Max Reitz
2018-02-08 19:23 ` [Qemu-devel] [PATCH 17/27] nfs: Support .bdrv_co_create Kevin Wolf
2018-02-12 15:45   ` Max Reitz
2018-02-08 19:23 ` [Qemu-devel] [PATCH 18/27] sheepdog: QAPIfy "redundacy" create option Kevin Wolf
2018-02-12 16:03   ` Max Reitz
2018-02-08 19:23 ` [Qemu-devel] [PATCH 19/27] sheepdog: Support .bdrv_co_create Kevin Wolf
2018-02-12 16:43   ` Max Reitz [this message]
2018-02-08 19:23 ` [Qemu-devel] [PATCH 20/27] ssh: Use QAPI BlockdevOptionsSsh object Kevin Wolf
2018-02-12 17:17   ` Max Reitz
2018-02-08 19:23 ` [Qemu-devel] [PATCH 21/27] ssh: QAPIfy host-key-check option Kevin Wolf
2018-02-12 17:29   ` Max Reitz
2018-02-08 19:23 ` [Qemu-devel] [PATCH 22/27] ssh: Pass BlockdevOptionsSsh to connect_to_ssh() Kevin Wolf
2018-02-12 17:35   ` Max Reitz
2018-02-08 19:23 ` [Qemu-devel] [PATCH 23/27] ssh: Support .bdrv_co_create Kevin Wolf
2018-02-12 17:40   ` Max Reitz
2018-02-08 19:23 ` [Qemu-devel] [PATCH 24/27] file-posix: Fix no-op bdrv_truncate() with falloc preallocation Kevin Wolf
2018-02-12 17:41   ` Max Reitz
2018-02-08 19:23 ` [Qemu-devel] [PATCH 25/27] block: Fail bdrv_truncate() with negative size Kevin Wolf
2018-02-12 17:42   ` Max Reitz
2018-02-08 19:23 ` [Qemu-devel] [PATCH 26/27] qemu-iotests: Test qcow2 over file image creation with QMP Kevin Wolf
2018-02-12 17:50   ` Max Reitz
2018-02-08 19:23 ` [Qemu-devel] [PATCH 27/27] qemu-iotests: Test ssh image creation over QMP Kevin Wolf
2018-02-12 17:56   ` Max Reitz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3a3134a8-19c8-0d9a-15d0-3b904998abd7@redhat.com \
    --to=mreitz@redhat.com \
    --cc=eblake@redhat.com \
    --cc=jcody@redhat.com \
    --cc=jdurgin@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=mitake.hitoshi@lab.ntt.co.jp \
    --cc=namei.unix@gmail.com \
    --cc=pkrempa@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).