xref: /openbmc/qemu/docs/interop/nbd.rst (revision 8dac93a8)
1*8dac93a8SPeter MaydellQEMU NBD protocol support
2*8dac93a8SPeter Maydell=========================
3*8dac93a8SPeter Maydell
4*8dac93a8SPeter MaydellQEMU supports the NBD protocol, and has an internal NBD client (see
5*8dac93a8SPeter Maydell``block/nbd.c``), an internal NBD server (see ``blockdev-nbd.c``), and an
6*8dac93a8SPeter Maydellexternal NBD server tool (see ``qemu-nbd.c``). The common code is placed
7*8dac93a8SPeter Maydellin ``nbd/*``.
8*8dac93a8SPeter Maydell
9*8dac93a8SPeter MaydellThe NBD protocol is specified here:
10*8dac93a8SPeter Maydellhttps://github.com/NetworkBlockDevice/nbd/blob/master/doc/proto.md
11*8dac93a8SPeter Maydell
12*8dac93a8SPeter MaydellThe following paragraphs describe some specific properties of NBD
13*8dac93a8SPeter Maydellprotocol realization in QEMU.
14*8dac93a8SPeter Maydell
15*8dac93a8SPeter MaydellMetadata namespaces
16*8dac93a8SPeter Maydell-------------------
17*8dac93a8SPeter Maydell
18*8dac93a8SPeter MaydellQEMU supports the ``base:allocation`` metadata context as defined in the
19*8dac93a8SPeter MaydellNBD protocol specification, and also defines an additional metadata
20*8dac93a8SPeter Maydellnamespace ``qemu``.
21*8dac93a8SPeter Maydell
22*8dac93a8SPeter Maydell``qemu`` namespace
23*8dac93a8SPeter Maydell------------------
24*8dac93a8SPeter Maydell
25*8dac93a8SPeter MaydellThe ``qemu`` namespace currently contains two available metadata context
26*8dac93a8SPeter Maydelltypes.  The first is related to exposing the contents of a dirty
27*8dac93a8SPeter Maydellbitmap alongside the associated disk contents.  That metadata context
28*8dac93a8SPeter Maydellis named with the following form::
29*8dac93a8SPeter Maydell
30*8dac93a8SPeter Maydell    qemu:dirty-bitmap:<dirty-bitmap-export-name>
31*8dac93a8SPeter Maydell
32*8dac93a8SPeter MaydellEach dirty-bitmap metadata context defines only one flag for extents
33*8dac93a8SPeter Maydellin reply for ``NBD_CMD_BLOCK_STATUS``:
34*8dac93a8SPeter Maydell
35*8dac93a8SPeter Maydellbit 0:
36*8dac93a8SPeter Maydell  ``NBD_STATE_DIRTY``, set when the extent is "dirty"
37*8dac93a8SPeter Maydell
38*8dac93a8SPeter MaydellThe second is related to exposing the source of various extents within
39*8dac93a8SPeter Maydellthe image, with a single metadata context named::
40*8dac93a8SPeter Maydell
41*8dac93a8SPeter Maydell    qemu:allocation-depth
42*8dac93a8SPeter Maydell
43*8dac93a8SPeter MaydellIn the allocation depth context, the entire 32-bit value represents a
44*8dac93a8SPeter Maydelldepth of which layer in a thin-provisioned backing chain provided the
45*8dac93a8SPeter Maydelldata (0 for unallocated, 1 for the active layer, 2 for the first
46*8dac93a8SPeter Maydellbacking layer, and so forth).
47*8dac93a8SPeter Maydell
48*8dac93a8SPeter MaydellFor ``NBD_OPT_LIST_META_CONTEXT`` the following queries are supported
49*8dac93a8SPeter Maydellin addition to the specific ``qemu:allocation-depth`` and
50*8dac93a8SPeter Maydell``qemu:dirty-bitmap:<dirty-bitmap-export-name>``:
51*8dac93a8SPeter Maydell
52*8dac93a8SPeter Maydell``qemu:``
53*8dac93a8SPeter Maydell  returns list of all available metadata contexts in the namespace
54*8dac93a8SPeter Maydell``qemu:dirty-bitmap:``
55*8dac93a8SPeter Maydell  returns list of all available dirty-bitmap metadata contexts
56*8dac93a8SPeter Maydell
57*8dac93a8SPeter MaydellFeatures by version
58*8dac93a8SPeter Maydell-------------------
59*8dac93a8SPeter Maydell
60*8dac93a8SPeter MaydellThe following list documents which qemu version first implemented
61*8dac93a8SPeter Maydellvarious features (both as a server exposing the feature, and as a
62*8dac93a8SPeter Maydellclient taking advantage of the feature when present), to make it
63*8dac93a8SPeter Maydelleasier to plan for cross-version interoperability.  Note that in
64*8dac93a8SPeter Maydellseveral cases, the initial release containing a feature may require
65*8dac93a8SPeter Maydelladditional patches from the corresponding stable branch to fix bugs in
66*8dac93a8SPeter Maydellthe operation of that feature.
67*8dac93a8SPeter Maydell
68*8dac93a8SPeter Maydell2.6
69*8dac93a8SPeter Maydell  ``NBD_OPT_STARTTLS`` with TLS X.509 Certificates
70*8dac93a8SPeter Maydell2.8
71*8dac93a8SPeter Maydell  ``NBD_CMD_WRITE_ZEROES``
72*8dac93a8SPeter Maydell2.10
73*8dac93a8SPeter Maydell  ``NBD_OPT_GO``, ``NBD_INFO_BLOCK``
74*8dac93a8SPeter Maydell2.11
75*8dac93a8SPeter Maydell  ``NBD_OPT_STRUCTURED_REPLY``
76*8dac93a8SPeter Maydell2.12
77*8dac93a8SPeter Maydell  ``NBD_CMD_BLOCK_STATUS`` for ``base:allocation``
78*8dac93a8SPeter Maydell3.0
79*8dac93a8SPeter Maydell  ``NBD_OPT_STARTTLS`` with TLS Pre-Shared Keys (PSK),
80*8dac93a8SPeter Maydell  ``NBD_CMD_BLOCK_STATUS`` for ``qemu:dirty-bitmap:``, ``NBD_CMD_CACHE``
81*8dac93a8SPeter Maydell4.2
82*8dac93a8SPeter Maydell  ``NBD_FLAG_CAN_MULTI_CONN`` for shareable read-only exports,
83*8dac93a8SPeter Maydell  ``NBD_CMD_FLAG_FAST_ZERO``
84*8dac93a8SPeter Maydell5.2
85*8dac93a8SPeter Maydell  ``NBD_CMD_BLOCK_STATUS`` for ``qemu:allocation-depth``
86*8dac93a8SPeter Maydell7.1
87*8dac93a8SPeter Maydell  ``NBD_FLAG_CAN_MULTI_CONN`` for shareable writable exports
88*8dac93a8SPeter Maydell8.2
89*8dac93a8SPeter Maydell  ``NBD_OPT_EXTENDED_HEADERS``, ``NBD_FLAG_BLOCK_STATUS_PAYLOAD``
90