.\" Automatically generated by Podwrapper::Man 1.10.3 (Pod::Simple 3.35) .\" .\" 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 .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . 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 "2019-01-26" "nbdkit-1.10.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 8 \& nbdkit \-\-filter=error PLUGIN \& [error=EPERM|EIO|ENOMEM|EINVAL|ENOSPC|ESHUTDOWN] \& [error\-rate=10%|0.1] \& [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=...] .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 \s-1NBD\s0 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. .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 and trimming requests will be successful, but all writes and zeroing will return \*(L"No space left on device\*(R": .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 \s-1NBD\s0 errors (the \s-1NBD\s0 protocol only supports a limited range of error codes). .Sp This parameter is optional and the default is \f(CW\*(C`EIO\*(C'\fR (\*(L"Input/output error\*(R"). .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" .PD The rate of injected errors per \s-1NBD\s0 request. This can be expressed as either 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. 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=\fR\s-1FILENAME\s0" 4 .IX Item "error-file=FILENAME" Errors will only be injected when \fI\s-1FILENAME\s0\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 \s-1NBD\s0 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 \s-1NBD\s0 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 \s-1NBD\s0 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 \s-1NBD\s0 zero 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) then you may see peculiar \*(L"errors\*(R" appearing when using this filter, for example: .PP .Vb 1 \& nbdkit: file.9: debug: error: pread count=1024 offset=0 flags=0x0 .Ve .PP In fact these are not errors, nbdkit core is simply printing the name of the filter which happens to be \f(CW"error"\fR. When this filter injects an error you will see something like: .PP .Vb 1 \& nbdkit: file.4: error: injecting ENOSPC error into pwrite .Ve .SH "SEE ALSO" .IX Header "SEE ALSO" \&\fBnbdkit\fR\|(1), \&\fBnbdkit\-file\-plugin\fR\|(1), \&\fBnbdkit\-full\-plugin\fR\|(1), \&\fBnbdkit\-filter\fR\|(3). .SH "AUTHORS" .IX Header "AUTHORS" Richard W.M. Jones .SH "COPYRIGHT" .IX Header "COPYRIGHT" Copyright (C) 2018 Red Hat Inc. .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 \&\s-1THIS SOFTWARE IS PROVIDED BY RED HAT AND CONTRIBUTORS\s0 ''\s-1AS IS\s0'' \s-1AND 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\s0 (\s-1INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES\s0; \s-1LOSS OF USE, DATA, OR PROFITS\s0; \s-1OR BUSINESS INTERRUPTION\s0) \s-1HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\s0 (\s-1INCLUDING NEGLIGENCE OR OTHERWISE\s0) \s-1ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\s0