Re: Standard NBD URL syntax (again)
Hi,
On Mon, May 20, 2019 at 10:20:56AM +0100, Richard W.M. Jones wrote:
>
> Previous discussion:
> https://lists.debian.org/nbd/2018/07/msg00002.html
>
> Again I'm stuck because we need a URL syntax for NBD.
>
> Various URLs have been proposed before:
>
> * Library Hostname+port over TCP/IP
> Unix domain socket
> Export name
> - Link for further information
> - Notes
>
> * libguestfs nbd://example.com:port (:port is optional)
> nbd://?socket=/socket
> nbd://example.com:port/exportname
> nbd:///exportname?socket=/socket
> - http://libguestfs.org/guestfish.1.html#a-nbd:-example.com-:port
> - Cannot specify an export name without a leading '/' character
>
> * QEMU nbd:example.com:port
> nbd:unix:/socket
> nbd:example.com:port:exportname=/export
> - https://qemu.weilnetz.de/doc/qemu-doc.html#Device-URL-Syntax
> - Not a real URL!
>
> * Curl nbd://example.com/
> nbd://example.com/exportname
> - https://github.com/rwmjones/curl/commit/2aba3dd7d8f9b8e03a8c3435e7555ab9e195675a#diff-77ab3188c0ad08b7b9d8d9787c8e9d75
> - Cannot specify an export name without a leading '/' character
> - No Unix domain socket syntax was ever defined.
> - Did not go upstream.
There's also dracut:
kernel /vmlinuz-2.6.29.4-167.fc11.i686.PAE rw root=UUID=123456 netroot=nbd:192.168.0.4:2345:ext3 ip=eth0:dhcp
(from https://fedoraproject.org/wiki/QA:Testcase_Dracut_root%3Dnbd)
and the Debian initramfs-tools hooks:
nbdroot=<server>,<exportname>,<device>
nbdroot=<server>,<exportname> root=/dev/nbd0
(/usr/share/doc/nbd-client/README.Debian in the Debian nbd-client
package contains a few more examples)
these obviously aren't URLs currently, but the dracut syntax gets rather
close; and it might make sense to have a URL format that would allow
(eventually) to replace these.
> The leading problem with the "obvious" NBD URL format seems to be that
> it's impossible to specify empty export names or export names which
> don't start with a '/' character.
Not sure? We can just define the / as a separator character, rather than
as part of the name. That would then result in:
nbd://nbd-server.example.com:12345/foo
for "the export called 'foo' at nbd-server.example.com on port 12345"
nbd://nbd-server.example.com//foo
for "the export called '/foo' at nbd-server.example.com on the default
port"
Alternatively, we could URL-encode things, since the NBD spec allows way
more characters than do URLs:
nbds://nbd-server.example.com/%2Ffoo
for "the export called '/foo' at nbd-server.example.com, using STARTTLS"
That also allows to create a
> This is why I'd be inclined to use an extra URL parameter instead,
> like:
>
> nbd://example.com[:port]/?export=exportname
>
> and for Unix domain sockets:
>
> nbd:///?export=exportname&socket=/socket
I think I prefer the "nbd+unix" format here, that Eric suggested.
> The export would be optional, defaulting to empty string. IPv6
> addresses would work in the obvious way for URLs, using "[...]"
> around the address part (ie as in RFC 2732). All escaping issues
> would work as for standard URLs.
Right.
> I think we should standardize this once and for all in a document in
> the NBD repository.
+1. I have been planning to implement URL parsing in nbd-client, too;
having a standard URL format for that would definitely help.
--
To the thief who stole my anti-depressants: I hope you're happy
-- seen somewhere on the Internet on a photo of a billboard
Reply to: