I'm pleased to announce a new high performance Network Block Device
(NBD) client library called libnbd. It's written in C and there are
also bindings available for Python, OCaml and (soon) Rust.
0.9.8 is the third pre-release before the stable 1.0 version where we
freeze the API, so feedback on API-related issues is very welcome now.
Download:
http://download.libguestfs.org/libnbd/
Documentation:
https://github.com/libguestfs/libnbd/blob/master/docs/libnbd.pod
Fedora package:
https://koji.fedoraproject.org/koji/packageinfo?packageID=28807
Debian package:
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=933223
Git repo:
https://github.com/libguestfs/libnbd
Mailing list: libguestfs(a)redhat.com (no subscription required)
Here are some of the things you can do with this library ...
Connect to an NBD server and grab the first sector of the disk:
https://github.com/libguestfs/libnbd/blob/a5f8fd2f0f48e9cf2487e23750b55f6...
High performance multi-threaded reads and writes, with multiple
connections and multiple commands in flight on each connection:
https://github.com/libguestfs/libnbd/blob/master/examples/threaded-reads-...
Integrate with glib main loop:
https://github.com/libguestfs/libnbd/blob/master/examples/glib-main-loop.c
Connect to an NBD server from an interactive shell:
$ nbdkit -f linuxdisk . &
$ nbdsh --connect nbd://localhost
Welcome to nbdsh, the shell for interacting with
Network Block Device (NBD) servers.
nbd> h.get_size()
716266496
nbd> buf = h.pread (512, 0)
nbd> print ("%r" % buf)
[prints the first sector]
Use ‘fio’ to benchmark an NBD server:
$ nbdkit -U - memory size=256M \
--run 'export unixsocket ; fio examples/nbd.fio '
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