nbdkit-pause-filter - Man Page

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 "$uri" /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

License

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

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.

Referenced By

nbdkit(1), nbdkit-delay-filter(1), nbdkit-filter(3), nbdkit-rate-filter(1), nbdkit-release-notes-1.22(1).

2024-10-14 nbdkit-1.41.8