qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] Question nbd_refresh_filename()
@ 2017-03-23 16:48 Markus Armbruster
  2017-03-24 15:47 ` Stefan Hajnoczi
  0 siblings, 1 reply; 4+ messages in thread
From: Markus Armbruster @ 2017-03-23 16:48 UTC (permalink / raw)
  To: qemu-devel; +Cc: Max Reitz, Kevin Wolf

BlockdevOptionsNbd has a member SocketAddress, and nbd_config() doesn't
restrict variants.  Thus, all four SOCKET_ADDRESS_KIND_ can occur.

Now have a look at nbd_refresh_filename().  s->saddr->type is If
SOCKET_ADDRESS_KIND_VSOCK or SOCKET_ADDRESS_KIND_FD, then @host, @port
and @path all remain null, and bs->exact_filename[] is not touched.

Does this work as intended?

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] Question nbd_refresh_filename()
  2017-03-23 16:48 [Qemu-devel] Question nbd_refresh_filename() Markus Armbruster
@ 2017-03-24 15:47 ` Stefan Hajnoczi
  2017-03-24 17:48   ` Kevin Wolf
  0 siblings, 1 reply; 4+ messages in thread
From: Stefan Hajnoczi @ 2017-03-24 15:47 UTC (permalink / raw)
  To: Markus Armbruster; +Cc: qemu-devel, Kevin Wolf, Max Reitz

[-- Attachment #1: Type: text/plain, Size: 871 bytes --]

On Thu, Mar 23, 2017 at 05:48:48PM +0100, Markus Armbruster wrote:
> BlockdevOptionsNbd has a member SocketAddress, and nbd_config() doesn't
> restrict variants.  Thus, all four SOCKET_ADDRESS_KIND_ can occur.
> 
> Now have a look at nbd_refresh_filename().  s->saddr->type is If
> SOCKET_ADDRESS_KIND_VSOCK or SOCKET_ADDRESS_KIND_FD, then @host, @port
> and @path all remain null, and bs->exact_filename[] is not touched.
> 
> Does this work as intended?

NDB over AF_VSOCK has not been tested.  I would expect it to fail
earlier than nbd_refresh_filename().  It's certainly possible to come up
with the host=,port= for AF_VSOCK.

Not sure about file descriptor passing.  Either we could getsockaddr()
and print out the host=,port= or path= (depending on the address
family), or we could use some syntax for referring to the file
descriptor.

Stefan

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 455 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] Question nbd_refresh_filename()
  2017-03-24 15:47 ` Stefan Hajnoczi
@ 2017-03-24 17:48   ` Kevin Wolf
  2017-03-27 12:35     ` Stefan Hajnoczi
  0 siblings, 1 reply; 4+ messages in thread
From: Kevin Wolf @ 2017-03-24 17:48 UTC (permalink / raw)
  To: Stefan Hajnoczi; +Cc: Markus Armbruster, qemu-devel, Max Reitz

Am 24.03.2017 um 16:47 hat Stefan Hajnoczi geschrieben:
> On Thu, Mar 23, 2017 at 05:48:48PM +0100, Markus Armbruster wrote:
> > BlockdevOptionsNbd has a member SocketAddress, and nbd_config() doesn't
> > restrict variants.  Thus, all four SOCKET_ADDRESS_KIND_ can occur.
> > 
> > Now have a look at nbd_refresh_filename().  s->saddr->type is If
> > SOCKET_ADDRESS_KIND_VSOCK or SOCKET_ADDRESS_KIND_FD, then @host, @port
> > and @path all remain null, and bs->exact_filename[] is not touched.
> > 
> > Does this work as intended?
> 
> NDB over AF_VSOCK has not been tested.  I would expect it to fail
> earlier than nbd_refresh_filename().

Why would that be? Do the socket creation helper functions not support
vsock yet?

> It's certainly possible to come up with the host=,port= for AF_VSOCK.
> 
> Not sure about file descriptor passing.  Either we could getsockaddr()
> and print out the host=,port= or path= (depending on the address
> family), or we could use some syntax for referring to the file
> descriptor.

The point of .bdrv_refresh_filename is to provide a "nicer" filename for
humans, but it still needs to be a valid input. We do accept URLs as a
convenience feature for NBD connections over TCP and Unix domain
sockets, so we create a filename for those. For everything else, we
require individual options rather than a URL and should therefore not
create a filename. The block layer creates a json: description then.

Kevin

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] Question nbd_refresh_filename()
  2017-03-24 17:48   ` Kevin Wolf
@ 2017-03-27 12:35     ` Stefan Hajnoczi
  0 siblings, 0 replies; 4+ messages in thread
From: Stefan Hajnoczi @ 2017-03-27 12:35 UTC (permalink / raw)
  To: Kevin Wolf; +Cc: Markus Armbruster, qemu-devel, Max Reitz

[-- Attachment #1: Type: text/plain, Size: 1400 bytes --]

On Fri, Mar 24, 2017 at 06:48:44PM +0100, Kevin Wolf wrote:
> Am 24.03.2017 um 16:47 hat Stefan Hajnoczi geschrieben:
> > On Thu, Mar 23, 2017 at 05:48:48PM +0100, Markus Armbruster wrote:
> > > BlockdevOptionsNbd has a member SocketAddress, and nbd_config() doesn't
> > > restrict variants.  Thus, all four SOCKET_ADDRESS_KIND_ can occur.
> > > 
> > > Now have a look at nbd_refresh_filename().  s->saddr->type is If
> > > SOCKET_ADDRESS_KIND_VSOCK or SOCKET_ADDRESS_KIND_FD, then @host, @port
> > > and @path all remain null, and bs->exact_filename[] is not touched.
> > > 
> > > Does this work as intended?
> > 
> > NDB over AF_VSOCK has not been tested.  I would expect it to fail
> > earlier than nbd_refresh_filename().
> 
> Why would that be? Do the socket creation helper functions not support
> vsock yet?

You are right.  The following creates an AF_VSOCK connection:

  -drive if=virtio,file.driver=nbd,file.server.type=vsock,file.server.data.cid=3,file.server.data.port=1234

There is no pretty filename or URL representation that block/nbd.c
parses today.  The user must specify the full file.server
VsockSocketAddress options.

I think nbd_refresh_filename() is fine from a vsock point of view.  If
we'd like to encourage NBD-over-vsock in the future we could add code to
for nbd+vsock:// but in the meantime we don't need to fill in
bs->exact_filename[].

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 455 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-03-27 12:36 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-03-23 16:48 [Qemu-devel] Question nbd_refresh_filename() Markus Armbruster
2017-03-24 15:47 ` Stefan Hajnoczi
2017-03-24 17:48   ` Kevin Wolf
2017-03-27 12:35     ` Stefan Hajnoczi

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).