.\" -*- mode: troff; coding: utf-8 -*- .\" Automatically generated by Podwrapper::Man 1.36.3 (Pod::Simple 3.43) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>. .ie n \{\ . ds C` "" . ds C' "" 'br\} .el\{\ . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "nbdkit-error-filter 1" .TH nbdkit-error-filter 1 2024-01-17 nbdkit-1.36.3 NBDKIT .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH NAME nbdkit\-error\-filter \- inject errors for testing clients .SH SYNOPSIS .IX Header "SYNOPSIS" .Vb 10 \& nbdkit \-\-filter=error PLUGIN \& [error=EPERM|EIO|ENOMEM|EINVAL|ENOSPC|ESHUTDOWN] \& [error\-rate=10%|0.1|1:10] \& [error\-file=/tmp/inject] \& [error\-pread=...] [error\-pread\-rate=...] [error\-pread\-file=...] \& [error\-pwrite=...] [error\-pwrite\-rate=...] [error\-pwrite\-file=...] \& [error\-trim=...] [error\-trim\-rate=...] [error\-trim\-file=...] \& [error\-zero=...] [error\-zero\-rate=...] [error\-zero\-file=...] \& [error\-extents=...] [error\-extents\-rate=...] [error\-extents\-file=...] \& [error\-cache=...] [error\-cache\-rate=...] [error\-cache\-file=...] .Ve .SH DESCRIPTION .IX Header "DESCRIPTION" \&\f(CW\*(C`nbdkit\-error\-filter\*(C'\fR is an nbdkit filter that injects random errors into replies from the server. This is used for testing that NBD clients can handle errors. .PP All parameters are optional, but you should usually specify one of the \&\f(CW\*(C`error\-rate\*(C'\fR or \f(CW\*(C`error\-*\-rate\*(C'\fR parameters, \&\fBotherwise this filter will do nothing\fR. .PP \&\fBnbdkit\-evil\-filter\fR\|(1) is a related filter that injects data corruption instead of errors. .SH EXAMPLES .IX Header "EXAMPLES" Inject a low rate of errors randomly into the connection: .PP .Vb 1 \& nbdkit \-\-filter=error file disk.img error\-rate=1% .Ve .PP Reading, trimming, cache and extents (block status) requests will be successful, but all writes and zeroing will return "No space left on device": .PP .Vb 4 \& nbdkit \-\-filter=error file disk.img \e \& error=ENOSPC \e \& error\-pwrite\-rate=100% \e \& error\-zero\-rate=100% .Ve .PP To make all connections fail hard 60 seconds after the server is started, use: .PP .Vb 5 \& rm \-f /tmp/inject \& nbdkit \-\-filter=error file disk.img \e \& error\-rate=100% \e \& error\-file=/tmp/inject \& sleep 60; touch /tmp/inject .Ve .SH PARAMETERS .IX Header "PARAMETERS" .IP \fBerror=EPERM|EIO|ENOMEM|EINVAL|ENOSPC|ESHUTDOWN\fR 4 .IX Item "error=EPERM|EIO|ENOMEM|EINVAL|ENOSPC|ESHUTDOWN" When a random error is injected, you can select which one from the range of possible NBD errors (the NBD protocol only supports a limited range of error codes). .Sp This parameter is optional and the default is \f(CW\*(C`EIO\*(C'\fR ("Input/output error"). .IP \fBerror\-rate=\fRN\fB%\fR 4 .IX Item "error-rate=N%" .PD 0 .IP \fBerror\-rate=\fR0..1 4 .IX Item "error-rate=0..1" .IP \fBerror\-rate=\fRN\fB:\fRM 4 .IX Item "error-rate=N:M" .PD The rate of injected errors per NBD request. This can be expressed as a percentage between \f(CW\*(C`0%\*(C'\fR and \f(CW\*(C`100%\*(C'\fR, or as a probability between \&\f(CW0\fR and \f(CW1\fR, or as a ratio like \f(CW\*(C`1:10\*(C'\fR. If \f(CW\*(C`0%\*(C'\fR or \f(CW0\fR is used then no errors are ever injected, and if \f(CW\*(C`100%\*(C'\fR or \f(CW1\fR is used then all requests return errors. .Sp This parameter is optional and the default is \f(CW\*(C`0%\*(C'\fR. \&\fBUnless you set this, the filter will do nothing.\fR .IP \fBerror\-file=\fRFILENAME 4 .IX Item "error-file=FILENAME" Errors will only be injected when \fIFILENAME\fR exists. (Note you must also specify the \f(CW\*(C`error\-rate\*(C'\fR). .Sp You can use this for fine-grained control over when to inject errors, for example if you want to trigger an error at an exact moment during a test, arrange for this file to be created at the appropriate time. Or conversely to test error recovery in a client, create the file initially, and then delete it to check the client can recover. .Sp This parameter is optional. .IP "\fBerror-pread\fR, \fBerror-pread-rate\fR, \fBerror-pread-file\fR." 4 .IX Item "error-pread, error-pread-rate, error-pread-file." Same as \f(CW\*(C`error\*(C'\fR, \f(CW\*(C`error\-rate\*(C'\fR and \f(CW\*(C`error\-file\*(C'\fR but only apply the settings to NBD pread requests. .IP "\fBerror-pwrite\fR, \fBerror-pwrite-rate\fR, \fBerror-pwrite-file\fR." 4 .IX Item "error-pwrite, error-pwrite-rate, error-pwrite-file." Same as \f(CW\*(C`error\*(C'\fR, \f(CW\*(C`error\-rate\*(C'\fR and \f(CW\*(C`error\-file\*(C'\fR but only apply the settings to NBD pwrite requests. .IP "\fBerror-trim\fR, \fBerror-trim-rate\fR, \fBerror-trim-file\fR." 4 .IX Item "error-trim, error-trim-rate, error-trim-file." Same as \f(CW\*(C`error\*(C'\fR, \f(CW\*(C`error\-rate\*(C'\fR and \f(CW\*(C`error\-file\*(C'\fR but only apply the settings to NBD trim requests. .IP "\fBerror-zero\fR, \fBerror-zero-rate\fR, \fBerror-zero-file\fR." 4 .IX Item "error-zero, error-zero-rate, error-zero-file." Same as \f(CW\*(C`error\*(C'\fR, \f(CW\*(C`error\-rate\*(C'\fR and \f(CW\*(C`error\-file\*(C'\fR but only apply the settings to NBD zero requests. .IP "\fBerror-extents\fR, \fBerror-extents-rate\fR, \fBerror-extents-file\fR." 4 .IX Item "error-extents, error-extents-rate, error-extents-file." (nbdkit ≥ 1.12) .Sp Same as \f(CW\*(C`error\*(C'\fR, \f(CW\*(C`error\-rate\*(C'\fR and \f(CW\*(C`error\-file\*(C'\fR but only apply the settings to NBD block status requests to read extents. .IP "\fBerror-cache\fR, \fBerror-cache-rate\fR, \fBerror-cache-file\fR." 4 .IX Item "error-cache, error-cache-rate, error-cache-file." (nbdkit ≥ 1.14) .Sp Same as \f(CW\*(C`error\*(C'\fR, \f(CW\*(C`error\-rate\*(C'\fR and \f(CW\*(C`error\-file\*(C'\fR but only apply the settings to NBD cache requests. .SH NOTES .IX Header "NOTES" .SS "Peculiar debug output" .IX Subsection "Peculiar debug output" If you are looking at the debugging output (using \f(CW\*(C`nbdkit \-f \-v\*(C'\fR) references to the name of this filter show up as \f(CW"error\-inject:"\fR, and such lines indicate that the filter is not altering output, for example: .PP .Vb 1 \& nbdkit: file.9: debug: error\-inject: pread count=1024 offset=0 flags=0x0 .Ve .PP Conversely, references to the string \f(CW"error:"\fR occur when the \&\fBnbdkit_error\fR\|(3) API was used, including when this filter injects an error, as in: .PP .Vb 1 \& nbdkit: file.4: error: injecting ENOSPC error into pwrite .Ve .SH FILES .IX Header "FILES" .ie n .IP \fR\fI$filterdir\fR\fI/nbdkit\-error\-filter.so\fR 4 .el .IP \fR\f(CI$filterdir\fR\fI/nbdkit\-error\-filter.so\fR 4 .IX Item "$filterdir/nbdkit-error-filter.so" The filter. .Sp Use \f(CW\*(C`nbdkit \-\-dump\-config\*(C'\fR to find the location of \f(CW$filterdir\fR. .SH VERSION .IX Header "VERSION" \&\f(CW\*(C`nbdkit\-error\-filter\*(C'\fR first appeared in nbdkit 1.6. .SH "SEE ALSO" .IX Header "SEE ALSO" \&\fBnbdkit\fR\|(1), \&\fBnbdkit\-evil\-filter\fR\|(1), \&\fBnbdkit\-file\-plugin\fR\|(1), \&\fBnbdkit\-full\-plugin\fR\|(1), \&\fBnbdkit\-retry\-filter\fR\|(1), \&\fBnbdkit\-retry\-request\-filter\fR\|(1), \&\fBnbdkit\-filter\fR\|(3). .SH AUTHORS .IX Header "AUTHORS" Richard W.M. Jones .SH COPYRIGHT .IX Header "COPYRIGHT" Copyright Red Hat .SH LICENSE .IX Header "LICENSE" Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: .IP \(bu 4 Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. .IP \(bu 4 Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. .IP \(bu 4 Neither the name of Red Hat nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. .PP THIS SOFTWARE IS PROVIDED BY RED HAT AND CONTRIBUTORS ''AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL RED HAT OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.