[Libguestfs] [nbdkit] A short note about filters in nbdkit

Richard W.M. Jones rjones at redhat.com
Sat Jan 20 11:59:15 UTC 2018


I've added support for filters to the nbdkit upstream repository
(version >= 1.1.27).  Filters allow you to modify plugins.  A simple
example would be selecting a partition from a plugin:

  nbdkit --filter=partition file file=disk.img partition=2
         ^^^^^^^^^^^^^^^^^^                    ^^^^^^^^^^^

which would serve the second partition only from disk.img.  For more
information see the nbdkit(1) and nbdkit-filter(3) man pages.

For nbdkit plugins written in C we offer a long term stable ABI, where
you can write a plugin (in C) now and have it work on all future
versions of nbdkit.  This means plugins can be distributed separately
from nbdkit.

However for nbdkit filters we haven't decided what, if any, ABI
guarantees we will offer.  The reason for this is simple: filters work
by filtering plugin methods, but if we add new plugin methods then
existing filters won't "see" the new methods.  In some common cases
this could even cause data corruption, for example if a filter is
modifying file offsets like the partition filter above, then the new
methods would write to the wrong part of the file.

So the TL;DR is, for now, if you write a filter it is far better to
submit it upstream so that we can keep it up to date.

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-df lists disk usage of guests without needing to install any
software inside the virtual machine.  Supports Linux and Windows.
http://people.redhat.com/~rjones/virt-df/




More information about the Libguestfs mailing list