From: Maxim Levitsky <mlevitsk@redhat.com>
To: Max Reitz <mreitz@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 05/14] block/amend: refactor qcow2 amend options
Date: Sun, 17 May 2020 20:52:58 +0300 [thread overview]
Message-ID: <fc17897adb9429dd3e8c182cad973904164d11d0.camel@redhat.com> (raw)
In-Reply-To: <0a7e43b3-0404-92f4-feb0-389275791a7e@redhat.com>
On Thu, 2020-05-14 at 15:36 +0200, Max Reitz wrote:
> On 10.05.20 15:40, Maxim Levitsky wrote:
> > Some qcow2 create options can't be used for amend.
> > Remove them from the qcow2 create options and add generic logic to detect
> > such options in qemu-img
> >
> > Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com>
> > Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
> > ---
> > block/qcow2.c | 108 ++++++---------------
> > qemu-img.c | 18 +++-
> > tests/qemu-iotests/049.out | 102 ++++++++++----------
> > tests/qemu-iotests/061.out | 12 ++-
> > tests/qemu-iotests/079.out | 18 ++--
> > tests/qemu-iotests/082.out | 149 ++++------------------------
> > tests/qemu-iotests/085.out | 38 ++++----
> > tests/qemu-iotests/087.out | 6 +-
> > tests/qemu-iotests/115.out | 2 +-
> > tests/qemu-iotests/121.out | 4 +-
> > tests/qemu-iotests/125.out | 192 ++++++++++++++++++-------------------
> > tests/qemu-iotests/134.out | 2 +-
> > tests/qemu-iotests/144.out | 4 +-
> > tests/qemu-iotests/158.out | 4 +-
> > tests/qemu-iotests/182.out | 2 +-
> > tests/qemu-iotests/185.out | 8 +-
> > tests/qemu-iotests/188.out | 2 +-
> > tests/qemu-iotests/189.out | 4 +-
> > tests/qemu-iotests/198.out | 4 +-
> > tests/qemu-iotests/243.out | 16 ++--
> > tests/qemu-iotests/250.out | 2 +-
> > tests/qemu-iotests/255.out | 8 +-
> > tests/qemu-iotests/259.out | 2 +-
> > tests/qemu-iotests/263.out | 4 +-
> > tests/qemu-iotests/280.out | 2 +-
>
> These reference output hunks need some rebasing due to the new
> compression_type option.
Done. I so hope to get it merged so I won't need to rebase it again :-)
>
> > 25 files changed, 284 insertions(+), 429 deletions(-)
> >
> > diff --git a/block/qcow2.c b/block/qcow2.c
> > index fc494c7591..db86500839 100644
> > --- a/block/qcow2.c
> > +++ b/block/qcow2.c
>
> [...]
>
> > @@ -5552,37 +5506,6 @@ void qcow2_signal_corruption(BlockDriverState *bs, bool fatal, int64_t offset,
> > .help = "The external data file must stay valid " \
> > "as a raw image" \
> > }, \
> > - { \
> > - .name = BLOCK_OPT_ENCRYPT, \
> > - .type = QEMU_OPT_BOOL, \
> > - .help = "Encrypt the image with format 'aes'. (Deprecated " \
> > - "in favor of " BLOCK_OPT_ENCRYPT_FORMAT "=aes)", \
> > - }, \
> > - { \
> > - .name = BLOCK_OPT_ENCRYPT_FORMAT, \
> > - .type = QEMU_OPT_STRING, \
> > - .help = "Encrypt the image, format choices: 'aes', 'luks'", \
> > - }, \
> > - BLOCK_CRYPTO_OPT_DEF_KEY_SECRET("encrypt.", \
> > - "ID of secret providing qcow AES key or LUKS passphrase"), \
> > - BLOCK_CRYPTO_OPT_DEF_LUKS_CIPHER_ALG("encrypt."), \
> > - BLOCK_CRYPTO_OPT_DEF_LUKS_CIPHER_MODE("encrypt."), \
> > - BLOCK_CRYPTO_OPT_DEF_LUKS_IVGEN_ALG("encrypt."), \
> > - BLOCK_CRYPTO_OPT_DEF_LUKS_IVGEN_HASH_ALG("encrypt."), \
> > - BLOCK_CRYPTO_OPT_DEF_LUKS_HASH_ALG("encrypt."), \
> > - BLOCK_CRYPTO_OPT_DEF_LUKS_ITER_TIME("encrypt."), \
> > - { \
> > - .name = BLOCK_OPT_CLUSTER_SIZE, \
> > - .type = QEMU_OPT_SIZE, \
> > - .help = "qcow2 cluster size", \
> > - .def_value_str = stringify(DEFAULT_CLUSTER_SIZE) \
> > - }, \
> > - { \
> > - .name = BLOCK_OPT_PREALLOC, \
> > - .type = QEMU_OPT_STRING, \
> > - .help = "Preallocation mode (allowed values: off, " \
> > - "metadata, falloc, full)" \
> > - }, \
> > { \
> > .name = BLOCK_OPT_LAZY_REFCOUNTS, \
> > .type = QEMU_OPT_BOOL, \
> > @@ -5600,6 +5523,37 @@ static QemuOptsList qcow2_create_opts = {
> > .name = "qcow2-create-opts",
> > .head = QTAILQ_HEAD_INITIALIZER(qcow2_create_opts.head),
> > .desc = {
> > + { \
> > + .name = BLOCK_OPT_ENCRYPT, \
> > + .type = QEMU_OPT_BOOL, \
> > + .help = "Encrypt the image with format 'aes'. (Deprecated " \
> > + "in favor of " BLOCK_OPT_ENCRYPT_FORMAT "=aes)", \
> > + }, \
> > + { \
> > + .name = BLOCK_OPT_ENCRYPT_FORMAT, \
> > + .type = QEMU_OPT_STRING, \
> > + .help = "Encrypt the image, format choices: 'aes', 'luks'", \
> > + }, \
> > + BLOCK_CRYPTO_OPT_DEF_KEY_SECRET("encrypt.", \
> > + "ID of secret providing qcow AES key or LUKS passphrase"), \
> > + BLOCK_CRYPTO_OPT_DEF_LUKS_CIPHER_ALG("encrypt."), \
> > + BLOCK_CRYPTO_OPT_DEF_LUKS_CIPHER_MODE("encrypt."), \
> > + BLOCK_CRYPTO_OPT_DEF_LUKS_IVGEN_ALG("encrypt."), \
> > + BLOCK_CRYPTO_OPT_DEF_LUKS_IVGEN_HASH_ALG("encrypt."), \
> > + BLOCK_CRYPTO_OPT_DEF_LUKS_HASH_ALG("encrypt."), \
> > + BLOCK_CRYPTO_OPT_DEF_LUKS_ITER_TIME("encrypt."), \
> > + { \
> > + .name = BLOCK_OPT_CLUSTER_SIZE, \
> > + .type = QEMU_OPT_SIZE, \
> > + .help = "qcow2 cluster size", \
> > + .def_value_str = stringify(DEFAULT_CLUSTER_SIZE) \
> > + }, \
> > + { \
> > + .name = BLOCK_OPT_PREALLOC, \
> > + .type = QEMU_OPT_STRING, \
> > + .help = "Preallocation mode (allowed values: off, " \
> > + "metadata, falloc, full)" \
> > + }, \
>
> compression_type should now be moved as well.
Done
>
> > QCOW_COMMON_OPTIONS,
> > { /* end of list */ }
> > }
> > diff --git a/qemu-img.c b/qemu-img.c
> > index 8f69366f03..b291081249 100644
> > --- a/qemu-img.c
> > +++ b/qemu-img.c
> > @@ -3939,9 +3939,8 @@ static int print_amend_option_help(const char *format)
> > /* Every driver supporting amendment must have amend_opts */
> > assert(drv->amend_opts);
> >
> > - printf("Creation options for '%s':\n", format);
> > + printf("Amend options for '%s':\n", format);
> > qemu_opts_print_help(drv->amend_opts, false);
> > - printf("\nNote that not all of these options may be amendable.\n");
> > return 0;
>
> Hm, this hunk would make more sense in the previous patch, but in
> practice it’s better here, because it’s only in this patch that
> amend_opts is actually limited (compared to create_opts).
Agree. I can move this here, but I also agree that it doesn't matter.
>
> > }
> >
> > @@ -4087,7 +4086,22 @@ static int img_amend(int argc, char **argv)
> > amend_opts = qemu_opts_append(amend_opts, bs->drv->amend_opts);
> > opts = qemu_opts_create(amend_opts, NULL, 0, &error_abort);
> > qemu_opts_do_parse(opts, options, NULL, &err);
> > +
> > if (err) {
> > + /* Try to parse options using the create options*/
>
> Missing a space before the closing asterisk.
Fixed
>
> > + Error *err1 = NULL;
> > + amend_opts = qemu_opts_append(amend_opts, bs->drv->create_opts);
> > + qemu_opts_del(opts);
> > + opts = qemu_opts_create(amend_opts, NULL, 0, &error_abort);
> > + qemu_opts_do_parse(opts, options, NULL, &err1);
> > +
> > + if (!err1) {
> > + error_append_hint(&err,
> > + "This option is only supported for image creation\n");
> > + } else {
> > + error_free(err1);
> > + }
>
> I’m not sure whether this is really that helpful, but, well, why not,
> now that you’ve already written the code for it.
Yep. It still better that nothing.
>
> Max
>
> > +
> > error_report_err(err);
> > ret = -1;
> > goto out
>
>
Best regards,
Maxim Levitsky
next prev parent reply other threads:[~2020-05-17 17:54 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 [this message]
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
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=fc17897adb9429dd3e8c182cad973904164d11d0.camel@redhat.com \
--to=mlevitsk@redhat.com \
--cc=armbru@redhat.com \
--cc=berrange@redhat.com \
--cc=jsnow@redhat.com \
--cc=kwolf@redhat.com \
--cc=mreitz@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).