[Libguestfs] [PATCH nbdkit 0/6] UNFINISHED Advertise block size constraints

Richard W.M. Jones rjones at redhat.com
Wed Feb 16 16:20:35 UTC 2022


Hi Eric,

This is is the sort of thing I'm thinking about.  The last patch is
not complete.

The idea is that we add the simplest possible thing to the server:

Plugins get a new .block_size callback allowing them to advertise
minimum/preferred/maximum block size.  This will cause an
NBD_INFO_BLOCK_SIZE message to be sent back to the client.

However nothing in the server enforces this.  Badly sized/aligned
client requests will be passed through to the plugin.

To mitigate this, I added a new filter
(nbdkit-block-size-constraint-filter, please think of a better name!)
which can be used both as an easier way to set the constraints without
having to modify plugins, and also as a way to enforce various error
policies.

(The error policies are not implemented yet, but I've documented them).

Initially there would only be two policies:

 - allow: Same as nbdkit server, allow anything.

 - error: Send an error back to the client for malformed requests.

You could imagine other error policies here, such as enforcing only
the lower or upper bound.

For plugins that cannot handle unconstrained requests, but still want
to serve badly behaved clients, this is where the existing
nbdkit-blocksize-filter fits in nicely.  We would probably need some
documentation on best practice ways to combine them which is not there
at the moment.

Of course clients (according to the spec) are not supposed to ignore
block size constraints, but, ummm, we know some that do :-(

Rich.





More information about the Libguestfs mailing list