[Libguestfs] [PATCH 9/9] filters: Move rdelay/wdelay from file plugin to new delay filter.

Eric Blake eblake at redhat.com
Wed Jan 17 22:38:04 UTC 2018


On 01/17/2018 02:53 PM, Richard W.M. Jones wrote:
> Previously the file plugin supported ‘rdelay’ and ‘wdelay’ parameters
> for injecting delays (for testing) into read and write requests.  This
> moves the functionality to a new delay filter so that it can be used
> with any plugin.
> ---

> +/* Write data. */
> +static int
> +delay_pwrite (struct nbdkit_next *next, void *nxdata,
> +              void *handle,
> +              const void *buf, uint32_t count, uint64_t offset)
> +{
> +  write_delay ();
> +  return next->pwrite (nxdata, buf, count, offset);
> +}
> +
> +/* Zero data. */
> +static int
> +delay_zero (struct nbdkit_next *next, void *nxdata,
> +            void *handle, uint32_t count, uint64_t offset, int may_trim)
> +{
> +  write_delay ();
> +  return next->zero (nxdata, count, offset, may_trim);

If next->zero() fails with EOPNOTSUPP, that means we will delay once in
trying the underlying command, and again for each iteration of the
fallback loop as it calls delay_pwrite().  Is that okay, or do we want
to reproduce some fallback logic here and directly call next->pwrite on
EOPNOTSUPP so as to only have a single write delay in that case?


> +++ b/plugins/file/nbdkit-file-plugin.pod
> @@ -31,21 +31,13 @@ This parameter is required.
>  
>  =item B<rdelay=E<lt>NNE<gt>ms>
>  
> -Delay reads for C<SECS> seconds or C<NN> milliseconds.
> -This is used to simulate a slow or remote server, or to
> -test certain kinds of race conditions in Linux.
> -
> -The default is no delay.
> -
>  =item B<wdelay=SECS>
>  
>  =item B<wdelay=E<lt>NNE<gt>ms>
>  
> -Delay writes for C<SECS> seconds or C<NN> milliseconds.
> -This is used to simulate a slow or remote server, or to
> -test certain kinds of race conditions in Linux.
> -
> -The default is no delay.
> +These plugin parameters have been moved to the
> +L<nbdkit-delay-filter(1)> filter.  Modify the command line to add
> +I<--filter=delay> in order to use these parameters.

I guess we don't promise back-comptibility on plugin parameters, but at
least you've documented how to fix things (and the testsuite had to
follow that advice).

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 619 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libguestfs/attachments/20180117/06362c7f/attachment.sig>


More information about the Libguestfs mailing list