qemu-block
[Top][All Lists]
Advanced

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

Re: [Qemu-block] Python NBD client library


From: Richard W.M. Jones
Subject: Re: [Qemu-block] Python NBD client library
Date: Sat, 4 Aug 2018 07:52:13 +0100
User-agent: Mutt/1.5.21 (2010-09-15)

On Fri, Aug 03, 2018 at 11:12:38PM +0300, Nir Soffer wrote:
> On Tue, Jul 31, 2018 at 6:17 PM Richard W.M. Jones <address@hidden>
> wrote:
> ...
> 
> > > If you like to check the prototype, see:
> > > https://gerrit.ovirt.org/c/93384/
> > >
> > > qemu's nbd/client.c was very helpful so far, since NBD doc
> > > https://github.com/NetworkBlockDevice/nbd/blob/master/doc/proto.md
> > > is not very clear.
> >
> > I agree the protocol spec has evolved by accretion so that it no
> > longer has a coherent narrative.  Anyway some general comments on your
> > client in no particular order:
> >
> > - Be nice if it was a separate Python library.
> >
> > - It should support TCP sockets too.  In fact those are probably more
> >   important than Unix sockets in the bigger picture.  Is there not a
> >   Python "socket client" class you can subclass from which does all
> >   the socket machinery?
> >
> 
> This should be easy to support. We probably need to separate the transport
> from the client. Will also make it easy to inject errors.
> 
> I'm not sure yet about the high level interface, maybe somehting
> like:
> 
>     nbd.open("nbd://host:port/export")

I'd avoid these phony URLs if at all possible.  Firstly there is no
defined URL syntax for NBD so everyone has made one up, and they're
not compatible.  Secondly the URL syntax doesn't allow you to express
an export name which doesn't begin with '/'.

> And for unix:
> 
>     nbd.open("nbd+unix:///export?socket=tmp/nbd.sock")
> 
> We need a better url systax.

Indeed, but that doesn't affect your library which AFAIK does not need
to use URLs at all.  eg this sort of thing would work:

  nbd.open([host="host"] [,port=port] [,export=export] [,socket=socket])

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
libguestfs lets you edit virtual machines.  Supports shell scripting,
bindings from many languages.  http://libguestfs.org



reply via email to

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