From: Kevin Wolf <kwolf@redhat.com>
To: Alberto Garcia <berto@igalia.com>
Cc: qemu-block@nongnu.org, qemu-devel@nongnu.org,
Stefan Hajnoczi <stefanha@redhat.com>,
Max Reitz <mreitz@redhat.com>
Subject: Re: [Qemu-devel] [PATCH 1/1] block: Allow passing BlockdevOptions to blockdev-snapshot-sync
Date: Tue, 1 Sep 2015 16:40:02 +0200 [thread overview]
Message-ID: <20150901144002.GF4304@noname.redhat.com> (raw)
In-Reply-To: <w51egiip6cf.fsf@maestria.local.igalia.com>
Am 01.09.2015 um 16:22 hat Alberto Garcia geschrieben:
> On Tue 01 Sep 2015 01:31:11 PM CEST, Kevin Wolf <kwolf@redhat.com> wrote:
>
> >> > Design question: Would it make sense to instead add a "reference"
> >> > mode to blockdev-snapshot-sync where you can specify a BDS's
> >> > node-name instead of snapshot-file to use an existing BDS as the
> >> > new top layer, ideally an empty one?
> >>
> >> Indeed - then blockdev-add can be used to create an unattached BDS
> >> (with all appropriate options), and blockdev-snapshot-sync would then
> >> attach that BDS as the snapshot-file that wraps an existing BDS
> >> (without needing to worry about options).
> >
> > Yes, this is what we should do.
>
> Sounds like a good idea, thanks for the feedback !
>
> >> >> +# @options: #optional options for the new device, with the following
> >> >> +# restrictions for the fields: 'driver' must match the value
> >> >> +# of @format,
> >> >
> >> > As said above, I'd rather make specifying both @options and @format
> >> > exclusive.
> >> >
> >> > Maybe there is even some QAPI magic to enforce that (and for
> >> > 'node-name', too), I don't know...
> >>
> >> Not that I know of at the moment, but not to say we can't add some. The
> >> closest we can get is with a flat union, but that requires a
> >> non-optional discriminator field. Maybe we can tweak qapi to make the
> >> discriminator optional (with a default value). Thankfully, it sounds
> >> like Markus' work on introspection would at least let management apps
> >> learn about a new 'options' argument.
>
> This is not necessary if we go for the "reference" mode proposed by
> Markus, since the "options" parameter would disappear.
>
> > Let's avoid such magic and instead add a new, clean blockdev-* style
> > command. Maybe call it simply blockdev-snapshot; the -sync part was
> > added because we knew it wouldn't be the final version of the command.
> > Now we don't have any bdrv_open() in it any more that could by
> > synchronous or asynchronous.
>
> Would you then prefer me to create a new command instead of extending
> the existing one? What would be the benefit (other than a better name)?
A clean interface. There is really little overlap with what we have:
{ 'struct': 'BlockdevSnapshot',
'data': { '*device': 'str', '*node-name': 'str',
'snapshot-file': 'str', '*snapshot-node-name': 'str',
'*format': 'str', '*mode': 'NewImageMode' } }
When you add an existing node which has been created with blockdev-add
as a snapshot, you won't use snapshot-file, snapshot-node-name, format
and mode. We would either have to make all of them optional and actually
forbid them when a reference is given, or to ensure that they are
consistent with the already existing node. That we have both device and
node-name (and both marked as optional, while one of them is required) is
also not in line with our current practise.
If we went further that way, the schema wouldn't really be expressive
any more because there would be too many hidden rules of which
combinations are allowed and which aren't.
What you really need for the version with a reference is just:
{ 'struct': 'BlockdevSnapshot',
'data': { 'device': 'str', 'snapshot': 'str' } }
Where both arguments refer to a node by node-name or backend name.
Kevin
next prev parent reply other threads:[~2015-09-01 14:40 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-31 10:00 [Qemu-devel] [PATCH 0/1] Allow passing BlockdevOptions to blockdev-snapshot-sync Alberto Garcia
2015-08-31 10:00 ` [Qemu-devel] [PATCH 1/1] block: " Alberto Garcia
2015-08-31 19:53 ` Max Reitz
2015-08-31 20:05 ` Eric Blake
2015-08-31 20:12 ` Max Reitz
2015-09-01 11:33 ` Kevin Wolf
2015-09-01 11:31 ` Kevin Wolf
2015-09-01 14:22 ` Alberto Garcia
2015-09-01 14:40 ` Kevin Wolf [this message]
2015-09-02 7:04 ` Markus Armbruster
2015-09-02 14:23 ` Alberto Garcia
2015-09-02 15:43 ` 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=20150901144002.GF4304@noname.redhat.com \
--to=kwolf@redhat.com \
--cc=berto@igalia.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).