From: Kevin Wolf <kwolf@redhat.com>
To: Alberto Garcia <berto@igalia.com>
Cc: Max Reitz <mreitz@redhat.com>,
qemu-devel@nongnu.org, qemu-block@nongnu.org,
Eric Blake <eblake@redhat.com>,
Stefan Hajnoczi <stefanha@redhat.com>
Subject: Re: [Qemu-devel] [RFC] Intermediate block mirroring
Date: Mon, 11 Jun 2018 14:20:06 +0200 [thread overview]
Message-ID: <20180611122006.GE15038@localhost.localdomain> (raw)
In-Reply-To: <w51zi0e6apc.fsf@maestria.local.igalia.com>
Am 01.06.2018 um 12:51 hat Alberto Garcia geschrieben:
> On Thu 03 May 2018 02:22:41 PM CEST, Kevin Wolf wrote:
> >> > Were the (more or less) exact requirements of QMP blockdev-reopen
> >> > discussed? How is it different from qemu-io's "reopen" command?
> >> > What are the options that you can and can not change?
> >>
> >> I can't quite remember, I'm afraid. I think it was supposed to be
> >> pretty much qemu-io's reopen (so just bdrv_reopen()). I suppose you
> >> cannot change the driver (obviously) or probably the node name, because
> >> either would result in the node being replaced by a completely new one.
> >>
> >> Other than that, it probably depends on what the block driver supports,
> >> but ideally you should be able to change everything.
> >
> > Honestly the design of bdrv_reopen() is quite broken because of the
> > way it tries to maintain old options if they aren't specified, and
> > guesses what you might mean when you add flags to the mix. The exact
> > semantics are quite complicated and I'd rather avoid them in a stable
> > API.
> >
> > A clean QMP command would probably apply the same defaults as
> > blockdev-add, so you just get to specify the full options again.
>
> I have a prototype of this working and almost ready to be published, but
> there's a tricky thing with this part:
>
> If we want blockdev-reopen to apply the defaults for all options except
> from the ones expliclity specified by the user, then it means that we
> need to check not just the options that are present, but also the ones
> that are omitted.
>
> For example:
>
> { "execute": "blockdev-add",
> "arguments": { "driver": "null-aio",
> "node-name": "root",
> "size": 1024 }
>
> This adds a null-aio block device with the "size" option set to 1024
> (the default is 1 << 30).
>
> null_reopen_prepare() allows reopening that block device, but it does
> not allow changing any of its options. Attempting to change the value of
> "size" is detected by the loop that checks unhandled options at the end
> of bdrv_reopen_prepare() and returns "Cannot change the option 'size'".
>
> So far, so good. We have this generic check for all options that works
> with all drivers, so as long as we only specify options that we know
> that can be changed, everything is fine.
>
> However if we want blockdev-reopen to apply the default values for all
> omitted options, then omitting "size" would be equivalent to setting it
> to its default value (1 << 30). And if "size" cannot be changed then
> QEMU should complain unless we explicitly set "size" to 1024 again on
> reopen.
>
> This complicates things a bit, because we would go from "the options
> that can't be changed are the ones that are not handled by each driver's
> _prepare() function" to "options that are absent can also produce an
> error".
To be honest, I think this is fine. If the user can specify the size
once (in blockdev-add), they can do it again (in blockdev-reopen).
We just need to make sure that we don't break existing bdrv_reopen*()
calls that come from places other than the monitor.
Kevin
next prev parent reply other threads:[~2018-06-11 12:20 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-12 17:07 [Qemu-devel] [RFC] Intermediate block mirroring Alberto Garcia
2018-04-13 14:23 ` Max Reitz
2018-04-16 14:59 ` Alberto Garcia
2018-04-16 15:15 ` Max Reitz
2018-04-18 15:34 ` Alberto Garcia
2018-04-20 13:13 ` Max Reitz
2018-04-25 12:58 ` Alberto Garcia
2018-04-25 13:06 ` Max Reitz
2018-04-25 13:42 ` Alberto Garcia
2018-04-25 14:03 ` Max Reitz
2018-05-02 13:07 ` Alberto Garcia
2018-05-02 14:12 ` Max Reitz
2018-05-03 10:32 ` Alberto Garcia
2018-05-03 12:22 ` Kevin Wolf
2018-05-03 12:33 ` Alberto Garcia
2018-05-09 14:22 ` Alberto Garcia
2018-06-01 10:51 ` Alberto Garcia
2018-06-11 12:20 ` Kevin Wolf [this message]
2018-06-11 12:23 ` Alberto Garcia
-- strict thread matches above, loose matches on Subject: below --
2015-04-02 13:28 Alberto Garcia
2015-04-02 16:56 ` Eric Blake
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=20180611122006.GE15038@localhost.localdomain \
--to=kwolf@redhat.com \
--cc=berto@igalia.com \
--cc=eblake@redhat.com \
--cc=mreitz@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.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).