Manpages

NAME

nbdkit-pause-filter - pause NBD requests

SYNOPSIS

nbdkit --filter=pause PLUGIN [PLUGIN-ARGS...] pause-control=SOCKET

DESCRIPTION

"nbdkit-pause-filter" is a filter for nbdkit(1) which can temporarily stop NBD requests from being handled by nbdkit, and later resume them. This filter can be used if you need to take a snapshot of the underlying storage.

Control socket
The "pause-control" parameter is the name of a Unix domain socket which the filter listens for commands on.

To pause NBD request processing you send character 'p' to the socket. Any NBD requests received afterwards will hang until you resume processing.

To resume processing you send character 'r' to the socket.

So you can know when pausing/resuming has taken effect, the filter echos back the character over the socket in uppercase (ie. either 'P' or 'R'). When pausing, the 'P' response is not sent until all outstanding NBD requests (received before the pause) have been completed. This usually means the plugin is idle, although be aware that it is possible for plugins to create background threads and do work that the filter cannot "see".

Any unknown commands are ignored. The filter responds with 'X'.

EXAMPLE

Pick a large file, disk image or ISO, serve it over NBD, and start copying it:

nbdkit --filter=pause --filter=rate \
file BIG_FILE.ISO rate=10M pause-control=sock \
--run 'qemu-img convert -p $nbd /var/tmp/out'

To cause the copy to appear to hang, do:

echo p | nc -U sock

To resume activity:

echo r | nc -U sock

PARAMETERS

pause-control=SOCKET

The Unix domain socket for controlling the filter. See "Control socket" above.

NOTES

If you are connecting a kernel client, virtual machine or similar to nbdkit then only short pauses are tolerated, and you will soon get timeout errors. The timeouts are not generated by nbdkit, but by the client itself.

The pause filter does not flush requests to disk, although this is a possible future enhancement.

A virtual machine with multiple disks connected through multiple nbdkit instances cannot get a consistent snapshot using this filter, since even if you send the pause commands to all instances at the same time they will be processed at slightly different times (and this can matter if a virtual machine is doing something like RAID across the disks). This is not something that can be solved at the level of individual devices, the only way to solve this is at the hypervisor level.

FILES

$filterdir/nbdkit-pause-filter.so

The filter.

Use "nbdkit --dump-config" to find the location of $filterdir.

VERSION

"nbdkit-pause-filter" first appeared in nbdkit 1.22.

SEE ALSO

nbdkit(1), nbdkit-filter(3), nbdkit-delay-filter(1), nbdkit-rate-filter(1), nc(1).

AUTHORS

Richard W.M. Jones

COPYRIGHT

Copyright Red Hat

LICENSE

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

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.

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.

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.