Thanks everyone for the good input on http://lists.nongnu.org/archive/html/qemu-block/2018-07/msg00168.html
I'm convinced that the best direction for oVirt is having NBD client instead of using the kernel nbd client. I think a C library would be best, but a python version is faster to implement and may be good enough for oVirt, so I'm starting in this direction. 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. Not sure that imageio is the best place for this. Do you have a better idea about a better home for this library? Here is what we can do now: $ qemu-img create -f qcow2 test.qcow2 1g Formatting 'test.qcow2', fmt=qcow2 size=1073741824 cluster_size=65536 lazy_refcounts=off refcount_bits=16 $ qemu-nbd --fork -k /tmp/nbd.sock -t -f qcow2 test.qcow2 -x export -n $ python3 ... >>> from ovirt_imageio_common import nbd >>> c = nbd.Client("/tmp/nbd.sock", "export") >>> c.export_size 1073741824 >>> c.minimum_block_size 1 >>> c.preferred_bloc_ksize 4096 >>> c.maximum_bloc_ksize 33554432 Nir