xref: /qemu/docs/interop/nbd.txt (revision ec150c7e)
1Qemu supports the NBD protocol, and has an internal NBD client (see
2block/nbd.c), an internal NBD server (see blockdev-nbd.c), and an
3external NBD server tool (see qemu-nbd.c). The common code is placed
4in nbd/*.
5
6The NBD protocol is specified here:
7https://github.com/NetworkBlockDevice/nbd/blob/master/doc/proto.md
8
9The following paragraphs describe some specific properties of NBD
10protocol realization in Qemu.
11
12= Metadata namespaces =
13
14Qemu supports the "base:allocation" metadata context as defined in the
15NBD protocol specification, and also defines an additional metadata
16namespace "qemu".
17
18== "qemu" namespace ==
19
20The "qemu" namespace currently contains only one type of context,
21related to exposing the contents of a dirty bitmap alongside the
22associated disk contents.  That context has the following form:
23
24    qemu:dirty-bitmap:<dirty-bitmap-export-name>
25
26Each dirty-bitmap metadata context defines only one flag for extents
27in reply for NBD_CMD_BLOCK_STATUS:
28
29    bit 0: NBD_STATE_DIRTY, means that the extent is "dirty"
30
31For NBD_OPT_LIST_META_CONTEXT the following queries are supported
32in addition to "qemu:dirty-bitmap:<dirty-bitmap-export-name>":
33
34* "qemu:" - returns list of all available metadata contexts in the
35            namespace.
36* "qemu:dirty-bitmap:" - returns list of all available dirty-bitmap
37                         metadata contexts.
38
39= Features by version =
40
41The following list documents which qemu version first implemented
42various features (both as a server exposing the feature, and as a
43client taking advantage of the feature when present), to make it
44easier to plan for cross-version interoperability.  Note that in
45several cases, the initial release containing a feature may require
46additional patches from the corresponding stable branch to fix bugs in
47the operation of that feature.
48
49* 2.6: NBD_OPT_STARTTLS with TLS X.509 Certificates
50* 2.8: NBD_CMD_WRITE_ZEROES
51* 2.10: NBD_OPT_GO, NBD_INFO_BLOCK
52* 2.11: NBD_OPT_STRUCTURED_REPLY
53* 2.12: NBD_CMD_BLOCK_STATUS for "base:allocation"
54* 3.0: NBD_OPT_STARTTLS with TLS Pre-Shared Keys (PSK),
55NBD_CMD_BLOCK_STATUS for "qemu:dirty-bitmap:", NBD_CMD_CACHE
56