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

Re: Requirements for an NBD client library in userspace



On 4/30/19 7:46 AM, Richard W.M. Jones 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
> 
> 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.

Looks like a decent start at thinking about the issue.

> 
> 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]

Or even arbitrary pair of file descriptors (input and output might be
the same fd as for socketpair(), or might be distinct fds as for a pair
of pipe()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
> 
> 3 O+   NBD block status querying

via the NBD standard "base:allocation"

4 O-  alternative NBD block status querying (basically, passthrough of
any other NBD_OPT_SET_META_CONTEXT context beyond "base:allocation")

> 
> ? ?    NBD resize extension

3 O   NBD_INFO_BLOCK_SIZE support (honoring any constraints advertised
by the server)

4 O   User-space handshake, handing off to kernel nbd module for
transmission phase on /dev/nbdN

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


Reply to: