The NBD driver needs: filename, path or (host, port, exportname). It checks which key exists and decides use unix or inet socket. It doesn't recognize the key type, so we can't use union, and can't reuse InetSocketAddress.
Signed-off-by: Wen Congyang <we...@cn.fujitsu.com> Signed-off-by: zhanghailiang <zhang.zhanghaili...@huawei.com> Signed-off-by: Gonglei <arei.gong...@huawei.com> --- qapi/block-core.json | 42 ++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 40 insertions(+), 2 deletions(-) diff --git a/qapi/block-core.json b/qapi/block-core.json index 11134a8..e68a59f 100644 --- a/qapi/block-core.json +++ b/qapi/block-core.json @@ -1376,12 +1376,14 @@ # # @host_device, @host_cdrom: Since 2.1 # +# @nbd: Since 2.5 +# # Since: 2.0 ## { 'enum': 'BlockdevDriver', 'data': [ 'archipelago', 'blkdebug', 'blkverify', 'bochs', 'cloop', 'dmg', 'file', 'ftp', 'ftps', 'host_cdrom', 'host_device', - 'http', 'https', 'null-aio', 'null-co', 'parallels', + 'http', 'https', 'nbd', 'null-aio', 'null-co', 'parallels', 'qcow', 'qcow2', 'qed', 'quorum', 'raw', 'tftp', 'vdi', 'vhdx', 'vmdk', 'vpc', 'vvfat' ] } @@ -1797,6 +1799,42 @@ '*read-pattern': 'QuorumReadPattern' } } ## +# @BlockdevOptionsNBD +# +# Driver specific block device options for NBD +# +# @filename: #optional unix or inet path. The format is: +# unix: nbd+unix:///export?socket=path or +# nbd:unix:path:exportname=export +# inet: nbd[+tcp]://host[:port]/export or +# nbd:host[:port]:exportname=export +# +# @path: #optional filesystem path to use +# +# @host: #optional host part of the address +# +# @port: #optional port part of the address +# +# @ipv4: #optional whether to accept IPv4 addresses, default try both IPv4 +# and IPv6 +# +# @ipv6: #optional whether to accept IPv6 addresses, default try both IPv4 +# and IPv6 +# +# @export: #optional the NBD export name +# +# Since: 2.5 +## +{ 'struct': 'BlockdevOptionsNBD', + 'data': { '*filename': 'str', + '*path': 'str', + '*host': 'str', + '*port': 'str', + '*ipv4': 'bool', + '*ipv6': 'bool', + '*export': 'str' } } + +## # @BlockdevOptions # # Options for creating a block device. @@ -1822,7 +1860,7 @@ 'http': 'BlockdevOptionsFile', 'https': 'BlockdevOptionsFile', # TODO iscsi: Wait for structured options -# TODO nbd: Should take InetSocketAddress for 'host'? + 'nbd': 'BlockdevOptionsNBD', # TODO nfs: Wait for structured options 'null-aio': 'BlockdevOptionsNull', 'null-co': 'BlockdevOptionsNull', -- 2.4.3