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

Re: Requirements for an NBD client library in userspace





On Sat, May 11, 2019, 14:03 Richard W.M. Jones <rjones@redhat.com> wrote:
On Tue, Apr 30, 2019 at 04:43:03PM +0300, Nir Soffer wrote:
> On Tue, Apr 30, 2019, 15:46 Richard W.M. Jones <rjones@redhat.com> wrote:
>
> > I believe there is no simple NBD client library.  Am I wrong about
> > this?  Let's assume I'm not for the sake of the rest of this email ...
> >
> > We do however have at least 4 places this could be consumed if it existed:
> >
> >  - fio's proposed NBD engine
> >    https://www.spinics.net/lists/fio/msg07831.html
> >
> >  - nbdkit-nbd-plugin
> >    https://github.com/libguestfs/nbdkit/tree/master/plugins/nbd
> >
> >  - Martin K's forthcoming VMware liberation tool
> >
> >  - qemu, maybe?
> >    https://github.com/qemu/qemu/blob/master/block/nbd-client.c
>
>
> oVirt imageio, replacing pure python client, used to implement nbd-http
> proxy
> https://github.com/oVirt/ovirt-imageio/blob/master/common/ovirt_imageio_common/nbd.py

It looks like imageio is Python 2.  I'm trying to write libnbd
bindings for Python now, but TBH supporting Python 2 is turning out to
be painful, because there are plenty of Python 3 features it would be
nice to use ("b" boolean conversions, proper bytes handling and
PyUnicode_FSConverter are three particular features).  Do you really
need Python 2?  What is the roadmap for using Python 3 with imageio?

We plan to drop python 2 for 4.4. I don't that anyone care about python 2 now.


Rich.

>
> > In this email I'm trying to assemble some requirements for such a
> > library, and I've also attempted to categorize them according to how
> > difficult they might be to implement.  I guess everyone will have
> > their own opinions on which features are most "required" and which are
> > optional, but I've added mine below too.
> >
> > Did I miss out anything?
> >
> > 1 = easy to implement  ...  5 = hard to implement
> > |
> > | R* = required, library could not be used without it
> > | R  = required
> > | O+ = optional, but very useful for many users
> > | O  = optional
> > | O- = optional, not likely to be useful for many users
> > | |
> > v v
> >
> > 1 R*   Library which runs in userspace, callable from C programs
> >
> > 3 O+   Callable from other programming languages, eg Python etc.
> >
> > 1 R*   Connect to Unix domain socket
> >
> > 1 R*   Connect to TCP port
> >
> > 1 R    Connect to TCP port over IPv6
> >
> > 1 O-   Connect to arbitrary file descriptor [eg. for nbdkit -s]
> >
> > 2 R    Synchronous support for easy initial use
> >
> > 5 O+   Non-blocking/asynch support, use with select/poll
> >
> > 4 O+   Integrates with external main loops, glib2, APR pollset, etc.
> >
> > 4 O    TLS support using X.509 certs
> >
> > 4 O    TLS-PSK support
> >
> > 5 O    NBD MULTI_CONN
> >
> > 5 O    NBD out of order requests on single socket
> >
> > 2 O-   Old-style protocol
> >
> > 3 R    NBD_OPT_INFO mode [required for qemu]
> >
> > 5 O    NBD structured replies
> >
>
> Should be O+, this gives huge performance improvment when reading mostly
> empty range, even without block status.
>
> This is also not so hard to implement, maybe 3?
>
>
> > 3 O+   NBD block status querying
> >
>
> Should be able to query qemu meta context
>
>
> > ? ?    NBD resize extension
> >
>
> Nir

--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
Fedora Windows cross-compiler. Compile Windows programs, test, and
build Windows installers. Over 100 libraries supported.
http://fedoraproject.org/wiki/MinGW

Reply to: