1nbdkit-streaming-plugin(1)          NBDKIT          nbdkit-streaming-plugin(1)
2
3
4

NAME

6       nbdkit-streaming-plugin - nbdkit streaming plugin
7

SYNOPSIS

9        nbdkit streaming write=PIPE [size=SIZE]
10
11        nbdkit streaming read=PIPE [size=SIZE]
12

DESCRIPTION

14       "nbdkit-streaming-plugin" is a plugin for nbdkit(1) that can stream in
15       or out of a local pipe or socket.  An alternate tool which can do
16       something similar to this is nbdcopy(1).  To turn an NBD export into a
17       local file use nbdfuse(1).
18
19       If the NBD client opens the NBD port and writes from the start to the
20       end of the disk without seeking backwards, then you can turn that into
21       a stream of data on a local pipe or socket using:
22
23        nbdkit streaming write=./pipe
24
25       This can be visualised as:
26
27                      ┌───────────┐
28        NBD           │ nbdkit    │        plugin streams
29        client ──────▶│ streaming │──────▶ data to ./pipe
30        writes        │ plugin    │
31                      └───────────┘
32
33       If the NBD client opens the NBD port and reads from the start to the
34       end of the disk without seeking backwards, then you can turn a local
35       pipe or socket into a stream of data for that client:
36
37        nbdkit streaming read=./pipe
38
39       This can be visualised as:
40
41                         ┌───────────┐
42        plugin streams   │ nbdkit    │        NBD
43        data from ──────▶│ streaming │──────▶ client
44        ./pipe           │ plugin    │        reads
45                         └───────────┘
46
47       Note that ./pipe (or the local socket) sees raw data, it is not using
48       the NBD protocol.  If you want to forward NBD to a local socket
49       connected to another NBD server, use nbdkit-nbd-plugin(1).
50
51   Combining this plugin with qemu tools
52       Typical usage is with qemu tools.  The following command does not work
53       because the output is a pipe or socket:
54
55        $ mkfifo pipe
56        $ qemu-img convert -n input -O raw ./pipe
57        qemu-img: Could not open './pipe': A regular file was expected by
58        the 'file' driver, but something else was given
59
60       However this will work:
61
62        nbdkit -U - streaming write=./pipe \
63               --run ' qemu-img convert -n input -O raw $nbd '
64
65                     ┌───────────┐       ┌───────────┐
66        reads        │ qemu-img  │       │ nbdkit    │        plugin streams
67        input ──────▶│ convert   │──────▶│ streaming │──────▶ data to ./pipe
68        file         │ command   │       │ plugin    │
69                     └───────────┘      ↑└───────────┘
70                                     Unix domain socket (-U -)
71
72       This only works because the output format is raw and qemu-img can write
73       that linearly (without seeking backwards or writing blocks out of
74       order).  This approach cannot work for other formats such as qcow2
75       since those contain metadata that must be updated by seeking back to
76       the start of the file which is not possible if the output is a pipe.
77
78       The reverse is to get qemu-img to read from a pipe:
79
80        nbdkit -U - streaming read=./pipe \
81               --run ' qemu-img convert -f raw $nbd -O qcow2 output.qcow2 '
82
83       For use of the --run and -U - options, see nbdkit-captive(1).
84

PARAMETERS

86       Either "read" or "write" is required, but not both.
87
88       read=FILENAME
89           (nbdkit ≥ 1.22)
90
91           Read data stream from the named pipe or socket.  If the pipe or
92           socket does not exist, then it is created (as a named FIFO),
93           otherwise the existing pipe or socket is opened and used.
94
95       write=FILENAME
96           Write data stream to the named pipe or socket.  If the pipe or
97           socket does not exist, then it is created (as a named FIFO),
98           otherwise the existing pipe or socket is opened and used.
99
100       pipe=FILENAME
101           For backwards compatibility with nbdkit ≤ 1.20 this is a synonym
102           for "write=FILENAME".
103
104       size=SIZE
105           Specify the virtual size of the stream.
106
107           This parameter is optional.  If not specified, then the virtual
108           disk appears to the client to be very large (effectively infinite).
109           Whether you need to specify this parameter depends on the client.
110           Some clients don't check the size and just write/stream, others do
111           checks or calculations based on the apparent size.  It is not
112           possible for the plugin to work out the size itself since it
113           doesn't see the whole stream until it has all been streamed.
114

FILES

116       $plugindir/nbdkit-streaming-plugin.so
117           The plugin.
118
119           Use "nbdkit --dump-config" to find the location of $plugindir.
120

VERSION

122       "nbdkit-streaming-plugin" first appeared in nbdkit 1.2.
123

SEE ALSO

125       nbdkit(1), nbdkit-file-plugin(1), nbdkit-nbd-plugin(1),
126       nbdkit-plugin(3), nbdkit-captive(1), nbdcopy(1), nbdfuse(1),
127       qemu-img(1).
128

AUTHORS

130       Richard W.M. Jones
131
133       Copyright (C) 2014-2020 Red Hat Inc.
134

LICENSE

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