The first four patches are fairly routine clean up and can be
reviewed/applied on their own. The fifth patch is problematic as
described below.
At the moment if you want to proxy through to qemu-nbd (eg. for
handling qcow2 files) it's rather complicated and you end up having to
manage the sockets and clean up yourself. However the library we use
for the proxying supports a perfectly good way to run qemu-nbd as a
subprocess:
http://libguestfs.org/nbd_connect_systemd_socket_activation.3.html#EXAMPLE
Why not use that instead? Then you'd be able to write:
nbdkit nbd command=' qemu-nbd -f qcow2 disk.qcow2 '
and place filters in front. nbdkit would deal with clean up of the
qemu-nbd process.
However I've been staring at this most of the day and for reasons I
don't understand the nbd plugin deadlocks. Specifically it waits
forever on the semaphore in nbdplug_reply.
A second problem with this patch (maybe related to the first??) is
that the command is specified as a string, but the libnbd API wants an
argv[]. There's no really good way to specify an argv as parameters
of an nbdkit plugin. You'd end up having to write something pretty
clunky such as one of these:
nbdkit nbd command='qemu-nbd,-f,qcow2,disk.qcow2'
nbdkit nbd command=qemu-nbd command=-f command=qcow2 command=disk.qcow2
Rich.