1nbdkit-error-filter(1)              NBDKIT              nbdkit-error-filter(1)
2
3
4

NAME

6       nbdkit-error-filter - inject errors for testing clients
7

SYNOPSIS

9        nbdkit --filter=error PLUGIN
10            [error=EPERM|EIO|ENOMEM|EINVAL|ENOSPC|ESHUTDOWN]
11            [error-rate=10%|0.1]
12            [error-file=/tmp/inject]
13            [error-pread=...] [error-pread-rate=...] [error-pread-file=...]
14            [error-pwrite=...] [error-pwrite-rate=...] [error-pwrite-file=...]
15            [error-trim=...] [error-trim-rate=...] [error-trim-file=...]
16            [error-zero=...] [error-zero-rate=...] [error-zero-file=...]
17            [error-extents=...] [error-extents-rate=...] [error-extents-file=...]
18

DESCRIPTION

20       "nbdkit-error-filter" is an nbdkit filter that injects random errors
21       into replies from the server.  This is used for testing that NBD
22       clients can handle errors.
23
24       All parameters are optional, but you should usually specify one of the
25       "error-rate" or "error-*-rate" parameters, otherwise this filter will
26       do nothing.
27

EXAMPLES

29       Inject a low rate of errors randomly into the connection:
30
31        nbdkit --filter=error file disk.img error-rate=1%
32
33       Reading, trimming and extents (block status) requests will be
34       successful, but all writes and zeroing will return "No space left on
35       device":
36
37        nbdkit --filter=error file disk.img \
38                                   error=ENOSPC \
39                                   error-pwrite-rate=100% \
40                                   error-zero-rate=100%
41
42       To make all connections fail hard 60 seconds after the server is
43       started, use:
44
45        rm -f /tmp/inject
46        nbdkit --filter=error file disk.img \
47                                   error-rate=100% \
48                                   error-file=/tmp/inject
49        sleep 60; touch /tmp/inject
50

PARAMETERS

52       error=EPERM|EIO|ENOMEM|EINVAL|ENOSPC|ESHUTDOWN
53           When a random error is injected, you can select which one from the
54           range of possible NBD errors (the NBD protocol only supports a
55           limited range of error codes).
56
57           This parameter is optional and the default is "EIO" ("Input/output
58           error").
59
60       error-rate=N%
61       error-rate=0..1
62           The rate of injected errors per NBD request.  This can be expressed
63           as either a percentage between "0%" and "100%" or as a probability
64           between 0 and 1.  If "0%" or 0 is used then no errors are ever
65           injected, and if "100%" or 1 is used then all requests return
66           errors.
67
68           This parameter is optional and the default is "0%".  Unless you set
69           this, the filter will do nothing.
70
71       error-file=FILENAME
72           Errors will only be injected when FILENAME exists.  (Note you must
73           also specify the "error-rate").
74
75           You can use this for fine-grained control over when to inject
76           errors, for example if you want to trigger an error at an exact
77           moment during a test, arrange for this file to be created at the
78           appropriate time.  Or conversely to test error recovery in a
79           client, create the file initially, and then delete it to check the
80           client can recover.
81
82           This parameter is optional.
83
84       error-pread, error-pread-rate, error-pread-file.
85           Same as "error", "error-rate" and "error-file" but only apply the
86           settings to NBD pread requests.
87
88       error-pwrite, error-pwrite-rate, error-pwrite-file.
89           Same as "error", "error-rate" and "error-file" but only apply the
90           settings to NBD pwrite requests.
91
92       error-trim, error-trim-rate, error-trim-file.
93           Same as "error", "error-rate" and "error-file" but only apply the
94           settings to NBD trim requests.
95
96       error-zero, error-zero-rate, error-zero-file.
97           Same as "error", "error-rate" and "error-file" but only apply the
98           settings to NBD zero requests.
99
100       error-extents, error-extents-rate, error-extents-file.
101           Same as "error", "error-rate" and "error-file" but only apply the
102           settings to NBD block status requests to read extents.
103

NOTES

105   Peculiar debug output
106       If you are looking at the debugging output (using "nbdkit -f -v") then
107       you may see peculiar "errors" appearing when using this filter, for
108       example:
109
110        nbdkit: file.9: debug: error: pread count=1024 offset=0 flags=0x0
111
112       In fact these are not errors, nbdkit core is simply printing the name
113       of the filter which happens to be "error".  When this filter injects an
114       error you will see something like:
115
116        nbdkit: file.4: error: injecting ENOSPC error into pwrite
117

SEE ALSO

119       nbdkit(1), nbdkit-file-plugin(1), nbdkit-full-plugin(1),
120       nbdkit-filter(3).
121

AUTHORS

123       Richard W.M. Jones
124
126       Copyright (C) 2018 Red Hat Inc.
127

LICENSE

129       Redistribution and use in source and binary forms, with or without
130       modification, are permitted provided that the following conditions are
131       met:
132
133       ·   Redistributions of source code must retain the above copyright
134           notice, this list of conditions and the following disclaimer.
135
136       ·   Redistributions in binary form must reproduce the above copyright
137           notice, this list of conditions and the following disclaimer in the
138           documentation and/or other materials provided with the
139           distribution.
140
141       ·   Neither the name of Red Hat nor the names of its contributors may
142           be used to endorse or promote products derived from this software
143           without specific prior written permission.
144
145       THIS SOFTWARE IS PROVIDED BY RED HAT AND CONTRIBUTORS ''AS IS'' AND ANY
146       EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
147       IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
148       PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL RED HAT OR CONTRIBUTORS BE
149       LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
150       CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
151       SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
152       BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
153       WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
154       OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
155       ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
156
157
158
159nbdkit-1.12.3                     2019-05-21            nbdkit-error-filter(1)
Impressum