From: Markus Armbruster <armbru@redhat.com>
To: Max Reitz <mreitz@redhat.com>
Cc: qemu-devel@nongnu.org, kwolf@redhat.com, qemu-block@nongnu.org,
mitake.hitoshi@lab.ntt.co.jp, jcody@redhat.com,
pbonzini@redhat.com, namei.unix@gmail.com
Subject: Re: [Qemu-devel] [for-2.9 7/8] nbd: Tidy up blockdev-add interface
Date: Thu, 30 Mar 2017 09:27:09 +0200 [thread overview]
Message-ID: <87shlvdy2a.fsf@dusky.pond.sub.org> (raw)
In-Reply-To: <b4d833b8-c6fd-567c-f500-354acf8c5cc7@redhat.com> (Max Reitz's message of "Wed, 29 Mar 2017 21:46:51 +0200")
Max Reitz <mreitz@redhat.com> writes:
> On 29.03.2017 18:45, Markus Armbruster wrote:
>> SocketAddress is a simple union, and simple unions are awkward: they
>> have their variant members wrapped in a "data" object on the wire, and
>> require additional indirections in C. I intend to limit its use to
>> existing external interfaces, and convert all internal interfaces to
>> SocketAddressFlat.
>>
>> BlockdevOptionsNbd is an external interface using SocketAddress, but
>> it's new in 2.9. Replace it by SocketAddressFlat while we can. This
>> simplifies
>>
>> { "execute": "blockdev-add",
>> "arguments": { "node-name": "foo", "driver": "nbd",
>> "server": { "type": "inet",
>> "data": { "host": "localhost",
>> "port": "12345" } } } }
>>
>> to
>>
>> { "execute": "blockdev-add",
>> "arguments": { "node-name": "foo", "driver": "nbd",
>> "server": { "type": "inet",
>> "host": "localhost", "port": "12345" } } }
>>
>> Since the internal interfaces still take SocketAddress, this requires
>> conversion function socket_address_crumple(). It'll go away when I
>> update the interfaces.
>>
>> Unfortunately, SocketAddress is also visible in -drive since 2.8. Add
>> still more gunk to nbd_process_legacy_socket_options(). You can now
>> shorten
>>
>> -drive if=none,driver=nbd,server.type=inet,server.data.host=127.0.0.1,server.data.port=12345
>>
>> to
>>
>> -drive if=none,driver=nbd,server.type=inet,server.host=127.0.0.1,server.port=12345
>>
>> Signed-off-by: Markus Armbruster <armbru@redhat.com>
>> ---
>> block/nbd.c | 131 ++++++++++++++++++++++++++++++++++++++++-----------
>> qapi/block-core.json | 2 +-
>> 2 files changed, 104 insertions(+), 29 deletions(-)
>
> To be completely frank: If there is any drawback to using
> SocketAddressFlat instead of SocketAdress, I would be against using it.
> Less indirections in C is an argument, but less {} on the wire is not,
> in my opinion. QMP is a machine interface and machines don't care about
> that additional level.
>
> Therefore, if you think this somehow affects compatibility, I would not
> want to do this change.
PRO:
1. Less nesting on the wire
You think this isn't a valid argument. I think it is, just a weak
one.
2. Less indirection in C
Makes dealing with the data type annoying. In other words, the C
interface is poor. Poor C interfaces hiding in generated code is one
thing, but SocketAddress is used in C interfaces between handwritten
code. Needs to go.
Once its gone, all uses of SocketAddress we can't change for
compatibility reasons need to go through a conversion function. No
biggie, but still, the fewer we have, the better.
3. Consistency within blockdev-add
Nowhere else in blockdev-add do we wrap parts of socket addresses in
"data". I guess I should mention this in the commit message.
CON:
1. Renames -drive server.data.* to server.*. These are new in 2.8.
Libvirt doesn't use them. I doubt anyone does. My patch adds
compatibility gunk anyway.
> I personally agree with Paolo that we can just break what we have, and
> in addition I think that we *should* break what we have or we should not
> do this change at all.
I'm totally fine with ripping out the compatibility gunk.
I put it in v1 so reviewers can like it or shoot it down. Better than
not having it in v1, and have reviewers demand it for v2 just so they
can decide whether they want it.
next prev parent reply other threads:[~2017-03-30 7:27 UTC|newest]
Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-29 16:45 [Qemu-devel] [for-2.9 0/8] Fixes and cleanups around SocketAddress Markus Armbruster
2017-03-29 16:45 ` [Qemu-devel] [for-2.9 1/8] nbd sockets vnc: Mark problematic address family tests TODO Markus Armbruster
2017-03-29 18:55 ` Max Reitz
2017-03-29 19:51 ` Eric Blake
2017-03-29 16:45 ` [Qemu-devel] [for-2.9 2/8] char: Fix socket with "type": "vsock" address Markus Armbruster
2017-03-29 16:48 ` Marc-André Lureau
2017-03-29 16:49 ` Marc-André Lureau
2017-03-30 6:32 ` Markus Armbruster
2017-03-29 18:42 ` Stefan Hajnoczi
2017-03-29 18:59 ` Max Reitz
2017-03-29 16:45 ` [Qemu-devel] [for-2.9 3/8] io vnc sockets: Clean up SocketAddressKind switches Markus Armbruster
2017-03-29 19:13 ` Max Reitz
2017-03-30 6:38 ` Markus Armbruster
2017-04-03 11:47 ` Daniel P. Berrange
2017-03-29 16:45 ` [Qemu-devel] [for-2.9 4/8] block: Document -drive problematic code and bugs Markus Armbruster
2017-03-29 19:33 ` Max Reitz
2017-03-30 6:52 ` Markus Armbruster
2017-03-30 13:09 ` Eric Blake
2017-03-30 14:42 ` Markus Armbruster
2017-03-30 16:10 ` Max Reitz
2017-03-29 16:45 ` [Qemu-devel] [for-2.9 5/8] gluster: Prepare for SocketAddressFlat extension Markus Armbruster
2017-03-29 19:35 ` Max Reitz
2017-03-29 20:07 ` Jeff Cody
2017-03-29 16:45 ` [Qemu-devel] [for-2.9 6/8] qapi-schema: SocketAddressFlat variants 'vsock' and 'fd' Markus Armbruster
2017-03-29 19:42 ` Max Reitz
2017-03-30 6:53 ` Markus Armbruster
2017-03-29 20:02 ` Eric Blake
2017-03-30 6:55 ` Markus Armbruster
2017-03-30 13:14 ` Eric Blake
2017-03-29 16:45 ` [Qemu-devel] [for-2.9 7/8] nbd: Tidy up blockdev-add interface Markus Armbruster
2017-03-29 17:02 ` Paolo Bonzini
2017-03-29 19:46 ` Max Reitz
2017-03-30 7:27 ` Markus Armbruster [this message]
2017-03-29 20:19 ` Eric Blake
2017-03-30 7:06 ` Markus Armbruster
2017-03-29 16:45 ` [Qemu-devel] [for-2.9 8/8] sheepdog: Fix blockdev-add Markus Armbruster
2017-03-29 19:59 ` Max Reitz
2017-03-29 20:32 ` Eric Blake
2017-03-29 20:35 ` Max Reitz
2017-03-30 7:47 ` 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=87shlvdy2a.fsf@dusky.pond.sub.org \
--to=armbru@redhat.com \
--cc=jcody@redhat.com \
--cc=kwolf@redhat.com \
--cc=mitake.hitoshi@lab.ntt.co.jp \
--cc=mreitz@redhat.com \
--cc=namei.unix@gmail.com \
--cc=pbonzini@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.