[Libguestfs] nbdkit: how to require use of filter

Richard W.M. Jones rjones at redhat.com
Tue May 3 08:15:10 UTC 2022


On Mon, May 02, 2022 at 10:25:44AM +0100, Nikolaus Rath wrote:
> Hi,
> 
> Is there a way for a nbdkit plugin to *require* use of a nbdkit filter
> (specifically the nbdkit-blocksize-filter) programmatically?

No it's not possible in general, you just have to document it.

However as it's *blocksize* filter that you're talking about, I assume
you mean that your filter has blocksize constraints, eg. that it
cannot handle sub-sector requests.  In this case it is possible to
tell clients that they must not issue requests smaller than a certain
size (and also hint about optimal and maximum sizes).  You can do this
by writing a .block_size callback.  For example:

https://gitlab.com/nbdkit/nbdkit/-/blob/1f5dc0679e570ca2fa149ceaa52922d70462b62c/plugins/vddk/vddk.c#L851

Not all clients obey these (although these clients are buggy!)  In
particular nbdcopy does not obey the minimum constraint, which
actually causes a bug for us in virt-v2v.  There's a long thread about
it on qemu-devel of which the most important message is:

https://www.mail-archive.com/qemu-devel@nongnu.org/msg865252.html

I would advertise a block size constraint in your plugin, and if you
find a client that doesn't request & then obey this constraint, get
the author of the client to fix it :-)

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-top is 'top' for virtual machines.  Tiny program with many
powerful monitoring features, net stats, disk stats, logging, etc.
http://people.redhat.com/~rjones/virt-top


More information about the Libguestfs mailing list