From: Anthony Liguori <anthony@codemonkey.ws>
To: Markus Armbruster <armbru@redhat.com>
Cc: Kevin Wolf <kwolf@redhat.com>,
Christoph Hellwig <chellwig@redhat.com>,
qemu-devel@nongnu.org, Luiz Capitulino <lcapitulino@redhat.com>,
Avi Kivity <avi@redhat.com>, Gerd Hoffmann <kraxel@redhat.com>
Subject: Re: [Qemu-devel] Re: RFC v2: blockdev_add & friends, brief rationale, QMP docs
Date: Wed, 16 Jun 2010 08:41:23 -0500 [thread overview]
Message-ID: <4C18D483.4080200@codemonkey.ws> (raw)
In-Reply-To: <m3hbl3w3n6.fsf@blackfin.pond.sub.org>
On 06/16/2010 07:41 AM, Markus Armbruster wrote:
> Kevin Wolf<kwolf@redhat.com> writes:
>
>
>> Am 15.06.2010 15:44, schrieb Avi Kivity:
>>
>>> On 06/10/2010 08:45 PM, Markus Armbruster wrote:
>>>
>>>>
>>>> * Our config file format is in INI syntax. QemuOpts correspond to
>>>> INI sections. Sections can't be nested, so recursive QemuOpts
>>>> don't translate.
>>>>
>>>>
>>> git (and probably others) use
>>>
>>> [a "b"]
>>> c = d
>>>
>>> for
>>>
>>> a.b.c=d
>>>
>>>
>>>> Examples:
>>>>
>>>> * Single protocol:
>>>>
>>>> -blockdev id=blk1,format=raw,protocol=[file,file=fedora.img]
>>>>
>>>> Requires suitable syntactic sugar to get the simple form (*).
>>>>
>>>> * blkdebug
>>>>
>>>> -blockdev id=blk2,format=qcow2,\
>>>> protocol=[blkdebug,config=test.blkdebug,\
>>>> protocol=[file,file=test.qcow2]]
>>>>
>>>> * Avi's mirror:
>>>>
>>>> -blockdev id=blk3,format=raw,\
>>>> protocol=[mirror,\
>>>> [file,file=local.img],\
>>>> [nbd,domain=unix,sockert=nbd-sock]]
>>>>
>>>> 2. We already have a syntax to specify trees, namely JSON, so use it
>>>>
>>>> If -blockdev's argument starts with '{', it's a JSON object suitable
>>>> as argument of blockdev_add in QMP.
>>>>
>>>> We still provide ordinary QemuOpts syntax for the cases that can be
>>>> expressed with it, i.e. single protocol.
>>>>
>>>> I figure we'd want syntactic sugar for blkdebug, to permit its use
>>>> from the command line without having to resort to JSON.
>>>>
>>>>
>>> Might be nice as a general extension to QemuOpts.
>>>
>> I agree.
>>
>>
>>>
>>>> 3. Stack protocols through named references
>>>>
>>>> The first protocol is "inlined" into -blockdev. Any further
>>>> protocols need to be referenced by name.
>>>>
>>>> Best explained by example:
>>>>
>>>> * Single protocol:
>>>>
>>>> -blockdev id=blk1,format=raw,protocol=file,file=fedora.img
>>>>
>>>> To get the simple form (*), make protocol optional with a suitable
>>>> default.
>>>>
>>>> * blkdebug
>>>>
>>>> -blockdev id=blk2,format=qcow2,protocol=blkdebug,config=test.blkdebug,\
>>>> base=blk2-base
>>>> -blockproto id=blk2-base,protocol=file,file=test.qcow2
>>>>
>>>> * Avi's mirror:
>>>>
>>>> -blockdev id=blk3,format=raw,protocol=mirror,\
>>>> base=blk3-base1,base=blk3=base2
>>>> -blockproto id=blk3-base1,protocol=file,file=local.img
>>>> -blockproto id=blk3-base2,protocol=nbd,domain=unix,sockert=nbd-sock
>>>>
>>>> Anything but a single protocol becomes pretty verbose. Syntactic
>>>> sugar for the blkdebug case would be possible; not sure it's worth
>>>> it.
>>>>
>>>> No QemuOpts syntax changes. INI can handle this just fine.
>>>>
>>>>
>>>>
>>> Looks like the least painful option as no new infrastructure is needed.
>>> I'd go with this.
>>>
>> But it's painful to type for the user. After all -blockdev on the
>> command line is for the user, as tools should use QMP. Also note that
>> this syntax mixes format and protocol options on one line which I
>> consider confusing at best.
>>
>> As I told Markus already in private before he posted this, I prefer the
>> bracket solution for its clarity and simplicity, even though it comes at
>> the cost of having additional characters that need to be escaped.
>>
> I dont't think 1. is less painful than 3. Let's compare the two:
>
> * Single protocol: identical with suitable syntactical sugar, namely
>
> -blockdev id=blk1,file=fedora.img
>
First, let me say that -blockdev is not something that I believe is
targeted at users. It's incredible unfair for us to expect a user to type:
-blockdev id=blk1,file=fedora.img -device ide-drive,drive=blk1,bus=0,unit=0
Instead of:
-hda fedora.img
I had to look up the device syntax just to write that. There's no way
users are going to do this. We should drop any notion of syntactical
sugar IMHO. -blockdev is for management tools, scripts, and as an
infrastructure for config files.
> Unsugared it's
>
> -blockdev id=blk1,format=raw,protocol=[file,file=fedora.img]
> vs.
>
> -blockdev id=blk1,format=raw,protocol=file,file=fedora.img
>
Specifying nesting in a single option is a bad idea. It should be:
-blockdev id=blk1,format=raw,protocol=blk2 \
-blockdev id=blk2,file=fedora.img
But honestly, I'm thoroughly confused about the distinction between
protocol and format. I had thought that protocols were a type of format
and I'm not sure why we're making a distinction.
> I sure prefer the latter. The brackets look like noise. You need to
> understand protocol stacking for them to make any sense.
>
> Regarding confusion caused by mixing format and protocol options: yes,
> the brackets force you to distinguish between protocol options and
> other options. But I doubt that'll reduce confusion here. Either you
> understand protocols. Then I doubt you need brackets to unconfuse
> you. Or you don't understand protocols. Then whether to put an
> option inside or outside the brackets is voodoo.
>
If the above is necessary just to create a raw image, then we're doing
something wrong in the block layer. If should be possible to just say:
-blockdev id=blk1,format=raw,file=fedora.img
Regards,
Anthony Liguori
next prev parent reply other threads:[~2010-06-16 13:41 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-06-10 17:45 [Qemu-devel] RFC v2: blockdev_add & friends, brief rationale, QMP docs Markus Armbruster
2010-06-15 9:04 ` Avi Kivity
2010-06-15 12:23 ` Markus Armbruster
2010-06-15 12:43 ` Avi Kivity
2010-06-15 13:27 ` Markus Armbruster
2010-06-15 13:40 ` Avi Kivity
2010-06-15 14:54 ` Markus Armbruster
2010-06-16 9:50 ` Avi Kivity
2010-06-16 11:02 ` Markus Armbruster
2010-06-16 11:06 ` Avi Kivity
2010-06-15 13:44 ` [Qemu-devel] " Avi Kivity
2010-06-15 14:39 ` Gerd Hoffmann
2010-06-16 11:20 ` Kevin Wolf
2010-06-16 12:41 ` Markus Armbruster
2010-06-16 13:41 ` Anthony Liguori [this message]
2010-06-16 13:57 ` Kevin Wolf
2010-06-16 14:24 ` Christoph Hellwig
2010-06-16 14:47 ` Markus Armbruster
2010-06-16 18:07 ` Anthony Liguori
2010-06-17 8:20 ` Kevin Wolf
2010-06-17 13:01 ` Anthony Liguori
2010-06-17 14:15 ` Kevin Wolf
2010-06-18 8:20 ` Markus Armbruster
2010-06-18 9:36 ` Kevin Wolf
2010-06-18 7:06 ` Markus Armbruster
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=4C18D483.4080200@codemonkey.ws \
--to=anthony@codemonkey.ws \
--cc=armbru@redhat.com \
--cc=avi@redhat.com \
--cc=chellwig@redhat.com \
--cc=kraxel@redhat.com \
--cc=kwolf@redhat.com \
--cc=lcapitulino@redhat.com \
--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).