From: Kevin Wolf <kwolf@redhat.com>
To: "Daniel P. Berrangé" <berrange@redhat.com>
Cc: Yong Huang <yong.huang@smartx.com>,
	Thomas Huth <thuth@redhat.com>,
	QEMU Developers <qemu-devel@nongnu.org>,
	hreitz@redhat.com, Maxim Levitsky <mlevitsk@redhat.com>,
	armbru@redhat.com
Subject: Re: Some iotests are failing with -luks
Date: Mon, 15 Sep 2025 15:18:00 +0200	[thread overview]
Message-ID: <aMgSCKrnbAcJAwId@redhat.com> (raw)
In-Reply-To: <aMKmvQ1IyBzK93lD@redhat.com>
Am 11.09.2025 um 12:38 hat Daniel P. Berrangé geschrieben:
> On Thu, Sep 11, 2025 at 12:04:24PM +0200, Kevin Wolf wrote:
> > Am 11.09.2025 um 04:33 hat Yong Huang geschrieben:
> > > On Thu, Sep 11, 2025 at 2:38 AM Kevin Wolf <kwolf@redhat.com> wrote:
> > > 
> > > > Am 10.09.2025 um 18:08 hat Kevin Wolf geschrieben:
> > > > > Am 10.09.2025 um 17:16 hat Thomas Huth geschrieben:
> > > > > > luks-detached-header   fail       [17:15:26] [17:15:38]   12.2s
> > > >         failed, exit status 1
> > > > > > ---
> > > > /home/thuth/devel/qemu/tests/qemu-iotests/tests/luks-detached-header.out
> > > > > > +++
> > > > /home/thuth/tmp/qemu-build/tests/qemu-iotests/scratch/luks-file-luks-detached-header/luks-detached-header.out.bad
> > > > > > @@ -1,5 +1,55 @@
> > > > > > -..
> > > > > > +EE
> > > > > > +======================================================================
> > > > > > +ERROR: test_detached_luks_header
> > > > (__main__.TestDetachedLUKSHeader.test_detached_luks_header)
> > > > > > +----------------------------------------------------------------------
> > > > > > +Traceback (most recent call last):
> > > > > > +  File
> > > > "/home/thuth/devel/qemu/tests/qemu-iotests/tests/luks-detached-header",
> > > > line 139, in setUp
> > > > > > +    res = qemu_img_create(
> > > > > > +          ^^^^^^^^^^^^^^^^
> > > > > > +  File "/home/thuth/devel/qemu/tests/qemu-iotests/iotests.py", line
> > > > 278, in qemu_img_create
> > > > > > +    return qemu_img('create', *args)
> > > > > > +           ^^^^^^^^^^^^^^^^^^^^^^^^^
> > > > > > +  File "/home/thuth/devel/qemu/tests/qemu-iotests/iotests.py", line
> > > > 261, in qemu_img
> > > > > > +    return qemu_tool(*full_args, check=check,
> > > > combine_stdio=combine_stdio)
> > > > > > +
> > > >  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> > > > > > +  File "/home/thuth/devel/qemu/tests/qemu-iotests/iotests.py", line
> > > > 241, in qemu_tool
> > > > > > +    raise VerboseProcessError(
> > > > > > +qemu.utils.VerboseProcessError: Command
> > > > '('/home/thuth/tmp/qemu-build/qemu-img', 'create', '-f', 'luks', '-o',
> > > > 'iter-time=10', '-o', 'key-secret=sec0', '-o', 'detached-header=true',
> > > > '--object', 'secret,id=sec0,data=foo',
> > > > '/home/thuth/tmp/qemu-build/tests/qemu-iotests/scratch/luks-file-luks-detached-header/detached_header.img2')'
> > > > returned non-zero exit status 1.
> > > > > > +  ┏━ output
> > > > ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
> > > > > > +  ┃ Formatting
> > > > '/home/thuth/tmp/qemu-build/tests/qemu-iotests/scratch/l
> > > > > > +  ┃ uks-file-luks-detached-header/detached_header.img2', fmt=luks
> > > > > > +  ┃ size=-1 key-secret=sec0 iter-time=10 detached-header=true
> > > > > > +  ┃ qemu-img:
> > > > /home/thuth/tmp/qemu-build/tests/qemu-iotests/scratch/luk
> > > > > > +  ┃ s-file-luks-detached-header/detached_header.img2: Parameter
> > > > > > +  ┃ 'detached-header' is unexpected
> > > > > > +
> > > > ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
> > > > >
> > > > > This one is surprising. I don't think anything relevant in the luks
> > > > > driver has changed since the test was introduced. At the same time, the
> > > > > code clearly has a problem when it tries to convert a QemuOpts
> > > > > containing a "detached-header" option into a QAPI object when the schema
> > > > > doesn't even have this option. Was this broken from the beginning? Would
> > > > > have been for a year and half.
> > > >
> > > > I bisected this one because I was curious how this could happen, and it
> > > > was broken quite explicitly by commit e818c01a:
> > > >
> > > > commit e818c01ae6e7c54c7019baaf307be59d99ce80b9 (HEAD)
> > > > Author: Daniel P. Berrangé <berrange@redhat.com>
> > > > Date:   Mon Feb 19 15:12:59 2024 +0000
> > > >
> > > >     qapi: drop unused QCryptoBlockCreateOptionsLUKS.detached-header
> > > >
> > > >     The 'detached-header' field in QCryptoBlockCreateOptionsLUKS
> > > >     was left over from earlier patch iterations.
> > > >
> > > >     Acked-by: Markus Armbruster <armbru@redhat.com>
> > > >     Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
> > > >
> > > > The test case demonstrates that it actually wasn't unused.
> > > >
> > > > If we don't want to reintroduce the field in QAPI, we need to explicitly
> > > >
> > > 
> > > Keeping the detached-header option is more convenient for users when
> > > creating a detached-header image.
> > > 
> > > My inclination is to bring this optionback.  Any suggestions? cc @Daniel P.
> > > Berrangé <berrange@redhat.com>
> > 
> > Having it available for users in qemu-img is different from having it in
> > QAPI. Arguably there is no use for it in QAPI, as long as you make sure
> > that it's taken out of the QemuOpts before going to QAPI.
> 
> Ah so what we actually need to fix is
> 
> diff --git a/block/crypto.c b/block/crypto.c
> index 4eed3ffa6a..8b60510c61 100644
> --- a/block/crypto.c
> +++ b/block/crypto.c
> @@ -792,7 +792,7 @@ block_crypto_co_create_opts_luks(BlockDriver *drv, const char *filename,
>      char *buf = NULL;
>      int64_t size;
>      bool detached_hdr =
> -        qemu_opt_get_bool(opts, "detached-header", false);
> +        qemu_opt_get_bool_del(opts, "detached-header", false);
>      unsigned int cflags = 0;
>      int ret;
>      Error *local_err = NULL;
That's what I had in mind, but we need to verify that we don't get a
scenario like what you hinted at where converting the options back to
some non-QAPI data structure (QemuOpts or QDict) would still use it
later.
Kevin
next prev parent reply	other threads:[~2025-09-15 13:19 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-10 15:16 Some iotests are failing with -luks Thomas Huth
2025-09-10 16:08 ` Kevin Wolf
2025-09-10 18:38   ` Kevin Wolf
2025-09-11  2:33     ` Yong Huang
2025-09-11 10:04       ` Kevin Wolf
2025-09-11 10:38         ` Daniel P. Berrangé
2025-09-15 13:18           ` Kevin Wolf [this message]
2025-09-11  8:43     ` Daniel P. Berrangé
2025-09-11 11:21   ` Thomas Huth
2025-09-11 12:13     ` Kevin Wolf
2025-09-12 14:23       ` Daniel P. Berrangé
2025-09-12 14:53         ` Kevin Wolf
2025-09-12 18:35           ` Daniel P. Berrangé
2025-09-15 12:45             ` Kevin Wolf
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=aMgSCKrnbAcJAwId@redhat.com \
    --to=kwolf@redhat.com \
    --cc=armbru@redhat.com \
    --cc=berrange@redhat.com \
    --cc=hreitz@redhat.com \
    --cc=mlevitsk@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=thuth@redhat.com \
    --cc=yong.huang@smartx.com \
    /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).