Re: [Libguestfs] [PATCH] fish: drop leading '/' in nbd paths (RHBZ#1379585)

Pino Toscano
Tue, 27 Sep 2016 10:54:17 -0000

On Tuesday, 27 September 2016 11:08:34 CEST Richard W.M. Jones
wrote:
> On Tue, Sep 27, 2016 at 11:20:07AM +0200, Pino Toscano wrote:
> > When parsing the URI, drop the leading '/' from the path also
when the
> > protocol is 'nbd': in this case, the path represents the
export name,
> > which does not need the '/' coming from the URI format.
> >
> > Improve the coverage for nbd in test-add-uri.sh, adding a couple of
> > tests, and adjusting the result of an existing one.
>
> The trouble with this is that exportnames generally do start
> with a '/'.

This seems what nbd-server requires, although the protocol documentation
does not put any limitation to that.  Indeed, neither qemu-nbd nor
nbdkit seem to do any validation on it (thus accepting even names not
starting with '/'.

> Can one specify an exportname if it begins with '/'?

When using the API directly, 'add-drive "/name" ..' will still
work,
while nbd://host[:port]//name (with two slashes) as URI will do the job.
It's a bit ugly, I agree, but I don't see a way to make both work with
the URI syntax.

--
Pino Toscano