From: Max Reitz <mreitz@redhat.com>
To: Maxim Levitsky <mlevitsk@redhat.com>, qemu-devel@nongnu.org
Cc: "Kevin Wolf" <kwolf@redhat.com>,
"Daniel P. Berrangé" <berrange@redhat.com>,
qemu-block@nongnu.org, "John Snow" <jsnow@redhat.com>,
"Markus Armbruster" <armbru@redhat.com>
Subject: Re: [PATCH v6 11/14] block/core: add generic infrastructure for x-blockdev-amend qmp command
Date: Thu, 14 May 2020 17:47:44 +0200 [thread overview]
Message-ID: <97dcdce3-bbbf-ab11-2b54-56e7d6ecaeba@redhat.com> (raw)
In-Reply-To: <20200510134037.18487-12-mlevitsk@redhat.com>
[-- Attachment #1.1: Type: text/plain, Size: 4807 bytes --]
On 10.05.20 15:40, Maxim Levitsky wrote:
> blockdev-amend will be used similiar to blockdev-create
> to allow on the fly changes of the structure of the format based block devices.
>
> Current plan is to first support encryption keyslot management for luks
> based formats (raw and embedded in qcow2)
>
> Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com>
> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
> ---
> block/Makefile.objs | 2 +-
> block/amend.c | 108 ++++++++++++++++++++++++++++++++++++++
> include/block/block_int.h | 21 +++++---
> qapi/block-core.json | 42 +++++++++++++++
> qapi/job.json | 4 +-
> 5 files changed, 169 insertions(+), 8 deletions(-)
> create mode 100644 block/amend.c
[...]
> diff --git a/block/amend.c b/block/amend.c
> new file mode 100644
> index 0000000000..4840c0ffef
> --- /dev/null
> +++ b/block/amend.c
[...]
> +void qmp_x_blockdev_amend(const char *job_id,
> + const char *node_name,
> + BlockdevAmendOptions *options,
> + bool has_force,
> + bool force,
> + Error **errp)
> +{
> + BlockdevAmendJob *s;
> + const char *fmt = BlockdevDriver_str(options->driver);
> + BlockDriver *drv = bdrv_find_format(fmt);
> + BlockDriverState *bs = bdrv_find_node(node_name);
> +
> + /*
> + * If the driver is in the schema, we know that it exists.
I wonder why create.c then still checks whether drv == NULL.
I wouldn’t count on the schema. For example, with modularized block
driver I could imagine that a driver appears in the schema, but loading
the module fails, so that drv still ends up NULL.
> But it may not
> + * be whitelisted.
> + */
> + assert(drv);
> + if (bdrv_uses_whitelist() && !bdrv_is_whitelisted(drv, false)) {
> + error_setg(errp, "Driver is not whitelisted");
> + return;
> + }
[...]
> diff --git a/include/block/block_int.h b/include/block/block_int.h
> index 0a71357b50..fdb0cdbcdd 100644
> --- a/include/block/block_int.h
> +++ b/include/block/block_int.h
> @@ -133,12 +133,27 @@ struct BlockDriver {
> int (*bdrv_file_open)(BlockDriverState *bs, QDict *options, int flags,
> Error **errp);
> void (*bdrv_close)(BlockDriverState *bs);
> +
> +
> int coroutine_fn (*bdrv_co_create)(BlockdevCreateOptions *opts,
> Error **errp);
> int coroutine_fn (*bdrv_co_create_opts)(BlockDriver *drv,
> const char *filename,
> QemuOpts *opts,
> Error **errp);
> +
> + int coroutine_fn (*bdrv_co_amend)(BlockDriverState *bs,
> + BlockdevAmendOptions *opts,
> + bool force,
> + Error **errp);
> +
> + int (*bdrv_amend_options)(BlockDriverState *bs,
> + QemuOpts *opts,
> + BlockDriverAmendStatusCB *status_cb,
> + void *cb_opaque,
> + bool force,
> + Error **errp);
> +
> int (*bdrv_make_empty)(BlockDriverState *bs);
>
> /*
> @@ -433,12 +448,6 @@ struct BlockDriver {
> BdrvCheckResult *result,
> BdrvCheckMode fix);
>
> - int (*bdrv_amend_options)(BlockDriverState *bs, QemuOpts *opts,
> - BlockDriverAmendStatusCB *status_cb,
> - void *cb_opaque,
> - bool force,
> - Error **errp);
> -
No harm done, but why not just leave it where it was?
> void (*bdrv_debug_event)(BlockDriverState *bs, BlkdebugEvent event);
>
> /* TODO Better pass a option string/QDict/QemuOpts to add any rule? */
> diff --git a/qapi/block-core.json b/qapi/block-core.json
> index 943df1926a..74db515414 100644
> --- a/qapi/block-core.json
> +++ b/qapi/block-core.json
> @@ -4649,6 +4649,48 @@
> 'data': { 'job-id': 'str',
> 'options': 'BlockdevCreateOptions' } }
>
> +##
> +# @BlockdevAmendOptions:
> +#
> +# Options for amending an image format
> +#
> +# @driver block driver that is suitable for the image
Missing colon after @driver. Also, what does “suitable” mean?
Shouldn’t it be exactly the node’s driver? (i.e. “Block driver of the
node to amend”)
Max
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
next prev parent reply other threads:[~2020-05-14 15:48 UTC|newest]
Thread overview: 41+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-10 13:40 [PATCH v6 00/14] LUKS: encryption slot management using amend interface Maxim Levitsky
2020-05-10 13:40 ` [PATCH v6 01/14] qcrypto/core: add generic infrastructure for crypto options amendment Maxim Levitsky
2020-05-10 13:40 ` [PATCH v6 02/14] qcrypto/luks: implement encryption key management Maxim Levitsky
2020-05-14 11:56 ` Max Reitz
2020-05-17 8:13 ` Maxim Levitsky
2020-05-10 13:40 ` [PATCH v6 03/14] block/amend: add 'force' option Maxim Levitsky
2020-05-14 12:18 ` Max Reitz
2020-05-17 8:15 ` Maxim Levitsky
2020-05-10 13:40 ` [PATCH v6 04/14] block/amend: separate amend and create options for qemu-img Maxim Levitsky
2020-05-14 12:28 ` Max Reitz
2020-05-14 16:10 ` Eric Blake
2020-05-15 6:22 ` Max Reitz
2020-05-15 17:24 ` Eric Blake
2020-05-17 8:47 ` Maxim Levitsky
2020-05-17 8:54 ` Maxim Levitsky
2020-05-10 13:40 ` [PATCH v6 05/14] block/amend: refactor qcow2 amend options Maxim Levitsky
2020-05-14 13:36 ` Max Reitz
2020-05-17 17:52 ` Maxim Levitsky
2020-05-10 13:40 ` [PATCH v6 06/14] block/crypto: rename two functions Maxim Levitsky
2020-05-10 13:40 ` [PATCH v6 07/14] block/crypto: implement the encryption key management Maxim Levitsky
2020-05-14 14:09 ` Max Reitz
2020-05-14 14:14 ` Daniel P. Berrangé
2020-05-14 14:32 ` Max Reitz
2020-05-17 17:56 ` Maxim Levitsky
2020-05-10 13:40 ` [PATCH v6 08/14] block/qcow2: extend qemu-img amend interface with crypto options Maxim Levitsky
2020-05-14 14:30 ` Max Reitz
2020-05-17 18:03 ` Maxim Levitsky
2020-05-10 13:40 ` [PATCH v6 09/14] iotests: filter few more luks specific create options Maxim Levitsky
2020-05-14 14:49 ` Max Reitz
2020-05-17 18:50 ` Maxim Levitsky
2020-05-10 13:40 ` [PATCH v6 10/14] iotests: qemu-img tests for luks key management Maxim Levitsky
2020-05-10 13:40 ` [PATCH v6 11/14] block/core: add generic infrastructure for x-blockdev-amend qmp command Maxim Levitsky
2020-05-14 15:47 ` Max Reitz [this message]
2020-05-18 10:48 ` Maxim Levitsky
2020-05-10 13:40 ` [PATCH v6 12/14] block/crypto: implement blockdev-amend Maxim Levitsky
2020-05-14 16:05 ` Max Reitz
2020-05-10 13:40 ` [PATCH v6 13/14] block/qcow2: " Maxim Levitsky
2020-05-14 16:05 ` Max Reitz
2020-05-10 13:40 ` [PATCH v6 14/14] iotests: add tests for blockdev-amend Maxim Levitsky
2020-05-10 14:37 ` [PATCH v6 00/14] LUKS: encryption slot management using amend interface no-reply
2020-05-10 15:14 ` no-reply
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=97dcdce3-bbbf-ab11-2b54-56e7d6ecaeba@redhat.com \
--to=mreitz@redhat.com \
--cc=armbru@redhat.com \
--cc=berrange@redhat.com \
--cc=jsnow@redhat.com \
--cc=kwolf@redhat.com \
--cc=mlevitsk@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).