qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v3 1/5] support nbd driver in blockdev-add


From: Kevin Wolf
Subject: Re: [Qemu-devel] [PATCH v3 1/5] support nbd driver in blockdev-add
Date: Tue, 15 Sep 2015 15:26:29 +0200
User-agent: Mutt/1.5.21 (2010-09-15)

Am 15.09.2015 um 15:03 hat Eric Blake geschrieben:
> On 09/15/2015 01:37 AM, Markus Armbruster wrote:
> 
> >>>>> +# @filename: #optional unix or inet path. The format is:
> >>>>> +#            unix: nbd+unix:///export?socket=path or
> >>>>> +#                  nbd:unix:path:exportname=export
> >>>>> +#            inet: nbd[+tcp]://host[:port]/export or
> >>>>> +#                  nbd:host[:port]:exportname=export
> >>>
> 
> > Since there's an either/or, the complex QAPI type should be a union.
> > 
> >>> { 'enum': 'NBDTransport', 'data': ['unix', 'tcp', 'udp'] }
> >>
> >> NBD only uses tcp, it doesn't support udp.
> 
> Fair enough.
> 
> >>
> >>> { 'union': 'BlockdevOptionsNBD',
> >>>   'base': { 'transport': 'NBDTransport', 'export': 'str' },
> >>>   'discriminator': 'transport',
> >>>   'data': { 'unix': 'NBDUnix', 'tcp': 'NBDInet', 'udp': 'NBDInet' } }
> >>> { 'struct': 'NBDUnix', 'data': { 'socket': 'str' } }
> >>
> >> unix socket needs a path, and I think we can use UnixSocketAddress here.
> 
> Sure, if that works, you could do 'unix':'UnixSocketAddress' instead of
> inventing 'NBDUnix'.
> 
> > 
> > Yes, we should try to reuse common types like SocketAddress,
> > InetSocketAddress, UnixSocketAddress.
> 
> Well, we've already questioned whether 'InetSocketAddress' needs to be
> fixed to be separate from a socket range, but it can be a separate fix.
> 
> > 
> > Perhaps it could be as simple as
> > 
> >     { 'struct': 'BlockdevOptionsNBD',
> >       'data': { 'addr: 'SocketAddress', 'export': 'str' } }
> > 
> > Eric, what do you think?
> 
> It has more nesting on the wire, but should work.  That is, to express
> "nbd+unix:///export?socket=path", the QMP would be:
> 
> { "export":"export", "addr":{ "type":"unix", "data":{ "path": "str"}}}
> 
> instead of a nicer:
> 
> { "export":"export", "type":"unix", "path":"str" }
> 
> but the advantage of working now rather than waiting on qapi fixes in
> the pipeline has its benefit.

Both patches are for 2.5 anyway. Is the benefit of getting this in
before the QAPI series really that big that we should go with an ugly
syntax?

> There's also the question of how to handle 'fd', if NBD can't reuse an
> existing fd but must be given a unix socket filename or tcp host/port
> destination.  Documenting that we reject a combination may be okay,
> except that it is harder to introspect later if the combination is no
> longer rejected because we later add support.

How about implementing fd suppor instead?

Kevin

Attachment: pgpy1DOHEBgMo.pgp
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]