[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v2 28/36] sheepdog: Support .bdrv_co_create
From: |
Max Reitz |
Subject: |
Re: [Qemu-devel] [PATCH v2 28/36] sheepdog: Support .bdrv_co_create |
Date: |
Fri, 23 Feb 2018 00:51:57 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 |
On 2018-02-21 14:53, 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 | 240
> +++++++++++++++++++++++++++++++++++----------------
> 2 files changed, 189 insertions(+), 75 deletions(-)
[...]
> diff --git a/block/sheepdog.c b/block/sheepdog.c
> index 22df2ba9d0..d45cf68ff2 100644
> --- a/block/sheepdog.c
> +++ b/block/sheepdog.c
[...]
> @@ -1882,6 +1866,42 @@ out_with_err_set:
> return ret;
> }
>
> +static int sd_create_prealloc(BlockdevOptionsSheepdog *location, int64_t
> size,
> + Error **errp)
> +{
> + BlockDriverState *bs;
> + Visitor *v;
> + QObject *obj = NULL;
> + QDict *qdict;
> + Error *local_err = NULL;
> + int ret;
> +
> + v = qobject_output_visitor_new(&obj);
> + visit_type_BlockdevOptionsSheepdog(v, NULL, &location, &local_err);
> + visit_free(v);
> +
> + if (local_err) {
> + error_propagate(errp, local_err);
> + qobject_decref(obj);
> + return -EINVAL;
> + }
> +
> + qdict = qobject_to_qdict(obj);
> + qdict_flatten(qdict);
> +
> + bs = bdrv_open(NULL, NULL, qdict, BDRV_O_PROTOCOL | BDRV_O_RDWR, errp);
Hu, nice, we can even get rid of the filename again.
But I am wondering where "driver": "sheepdog" comes into qdict...
Max
> + if (bs == NULL) {
> + ret = -EIO;
> + goto fail;
> + }
> +
> + ret = sd_prealloc(bs, 0, size, errp);
> +fail:
> + bdrv_unref(bs);
> + QDECREF(qdict);
> + return ret;
> +}
> +
> static int parse_redundancy(BDRVSheepdogState *s, SheepdogRedundancy *opt)
> {
> struct SheepdogInode *inode = &s->inode;
signature.asc
Description: OpenPGP digital signature
- Re: [Qemu-devel] [PATCH v2 21/36] rbd: Pass BlockdevOptionsRbd to qemu_rbd_connect(), (continued)
[Qemu-devel] [PATCH v2 25/36] nfs: Use QAPI options in nfs_client_open(), Kevin Wolf, 2018/02/21
[Qemu-devel] [PATCH v2 22/36] rbd: Support .bdrv_co_create, Kevin Wolf, 2018/02/21
[Qemu-devel] [PATCH v2 26/36] nfs: Support .bdrv_co_create, Kevin Wolf, 2018/02/21
[Qemu-devel] [PATCH v2 27/36] sheepdog: QAPIfy "redundacy" create option, Kevin Wolf, 2018/02/21
[Qemu-devel] [PATCH v2 28/36] sheepdog: Support .bdrv_co_create, Kevin Wolf, 2018/02/21
- Re: [Qemu-devel] [PATCH v2 28/36] sheepdog: Support .bdrv_co_create,
Max Reitz <=
[Qemu-devel] [PATCH v2 30/36] ssh: QAPIfy host-key-check option, Kevin Wolf, 2018/02/21
[Qemu-devel] [PATCH v2 29/36] ssh: Use QAPI BlockdevOptionsSsh object, Kevin Wolf, 2018/02/21
[Qemu-devel] [PATCH v2 32/36] ssh: Support .bdrv_co_create, Kevin Wolf, 2018/02/21
[Qemu-devel] [PATCH v2 33/36] file-posix: Fix no-op bdrv_truncate() with falloc preallocation, Kevin Wolf, 2018/02/21
[Qemu-devel] [PATCH v2 34/36] block: Fail bdrv_truncate() with negative size, Kevin Wolf, 2018/02/21
[Qemu-devel] [PATCH v2 31/36] ssh: Pass BlockdevOptionsSsh to connect_to_ssh(), Kevin Wolf, 2018/02/21