xref: /openbmc/qemu/qapi/block-export.json (revision 0f397dcfecc9211d12c2c720c01eb32f0eaa7d23)
15daa6bfdSKevin Wolf# -*- Mode: Python -*-
25daa6bfdSKevin Wolf# vim: filetype=python
35daa6bfdSKevin Wolf
45daa6bfdSKevin Wolf##
55daa6bfdSKevin Wolf# == Block device exports
65daa6bfdSKevin Wolf##
75daa6bfdSKevin Wolf
85daa6bfdSKevin Wolf{ 'include': 'sockets.json' }
9e5fb29d5SVladimir Sementsov-Ogievskiy{ 'include': 'block-core.json' }
105daa6bfdSKevin Wolf
115daa6bfdSKevin Wolf##
125daa6bfdSKevin Wolf# @NbdServerOptions:
135daa6bfdSKevin Wolf#
14a937b6aaSMarkus Armbruster# Keep this type consistent with the nbd-server-start arguments.  The
15a937b6aaSMarkus Armbruster# only intended difference is using SocketAddress instead of
16a937b6aaSMarkus Armbruster# SocketAddressLegacy.
175daa6bfdSKevin Wolf#
185daa6bfdSKevin Wolf# @addr: Address on which to listen.
19a937b6aaSMarkus Armbruster#
205daa6bfdSKevin Wolf# @tls-creds: ID of the TLS credentials object (since 2.6).
21a937b6aaSMarkus Armbruster#
225daa6bfdSKevin Wolf# @tls-authz: ID of the QAuthZ authorization object used to validate
23a937b6aaSMarkus Armbruster#     the client's x509 distinguished name.  This object is is only
24a937b6aaSMarkus Armbruster#     resolved at time of use, so can be deleted and recreated on the
25a937b6aaSMarkus Armbruster#     fly while the NBD server is active.  If missing, it will default
26a937b6aaSMarkus Armbruster#     to denying access (since 4.0).
27a937b6aaSMarkus Armbruster#
28a937b6aaSMarkus Armbruster# @max-connections: The maximum number of connections to allow at the
29a937b6aaSMarkus Armbruster#     same time, 0 for unlimited.  Setting this to 1 also stops the
30a937b6aaSMarkus Armbruster#     server from advertising multiple client support (since 5.2;
31*c8a76dbdSEric Blake#     default: 100)
325daa6bfdSKevin Wolf#
335daa6bfdSKevin Wolf# Since: 4.2
345daa6bfdSKevin Wolf##
355daa6bfdSKevin Wolf{ 'struct': 'NbdServerOptions',
365daa6bfdSKevin Wolf  'data': { 'addr': 'SocketAddress',
375daa6bfdSKevin Wolf            '*tls-creds': 'str',
381c8222b0SKevin Wolf            '*tls-authz': 'str',
391c8222b0SKevin Wolf            '*max-connections': 'uint32' } }
405daa6bfdSKevin Wolf
415daa6bfdSKevin Wolf##
425daa6bfdSKevin Wolf# @nbd-server-start:
435daa6bfdSKevin Wolf#
445daa6bfdSKevin Wolf# Start an NBD server listening on the given host and port.  Block
45a937b6aaSMarkus Armbruster# devices can then be exported using @nbd-server-add.  The NBD server
46a937b6aaSMarkus Armbruster# will present them as named exports; for example, another QEMU
47a937b6aaSMarkus Armbruster# instance could refer to them as "nbd:HOST:PORT:exportname=NAME".
485daa6bfdSKevin Wolf#
49a937b6aaSMarkus Armbruster# Keep this type consistent with the NbdServerOptions type.  The only
50a937b6aaSMarkus Armbruster# intended difference is using SocketAddressLegacy instead of
51a937b6aaSMarkus Armbruster# SocketAddress.
525daa6bfdSKevin Wolf#
535daa6bfdSKevin Wolf# @addr: Address on which to listen.
54a937b6aaSMarkus Armbruster#
555daa6bfdSKevin Wolf# @tls-creds: ID of the TLS credentials object (since 2.6).
56a937b6aaSMarkus Armbruster#
575daa6bfdSKevin Wolf# @tls-authz: ID of the QAuthZ authorization object used to validate
58a937b6aaSMarkus Armbruster#     the client's x509 distinguished name.  This object is is only
59a937b6aaSMarkus Armbruster#     resolved at time of use, so can be deleted and recreated on the
60a937b6aaSMarkus Armbruster#     fly while the NBD server is active.  If missing, it will default
61a937b6aaSMarkus Armbruster#     to denying access (since 4.0).
62a937b6aaSMarkus Armbruster#
63a937b6aaSMarkus Armbruster# @max-connections: The maximum number of connections to allow at the
64a937b6aaSMarkus Armbruster#     same time, 0 for unlimited.  Setting this to 1 also stops the
65a937b6aaSMarkus Armbruster#     server from advertising multiple client support (since 5.2;
66*c8a76dbdSEric Blake#     default: 100).
675daa6bfdSKevin Wolf#
682746f060SMarkus Armbruster# Errors:
692746f060SMarkus Armbruster#     - if the server is already running
705daa6bfdSKevin Wolf#
719bc6e893SMarkus Armbruster# Since: 1.3
725daa6bfdSKevin Wolf##
735daa6bfdSKevin Wolf{ 'command': 'nbd-server-start',
745daa6bfdSKevin Wolf  'data': { 'addr': 'SocketAddressLegacy',
755daa6bfdSKevin Wolf            '*tls-creds': 'str',
761c8222b0SKevin Wolf            '*tls-authz': 'str',
77f55ba801SPaolo Bonzini            '*max-connections': 'uint32' },
78f55ba801SPaolo Bonzini  'allow-preconfig': true }
795daa6bfdSKevin Wolf
805daa6bfdSKevin Wolf##
81cbad81ceSEric Blake# @BlockExportOptionsNbdBase:
825daa6bfdSKevin Wolf#
83a937b6aaSMarkus Armbruster# An NBD block export (common options shared between nbd-server-add
84a937b6aaSMarkus Armbruster# and the NBD branch of block-export-add).
855daa6bfdSKevin Wolf#
86a937b6aaSMarkus Armbruster# @name: Export name.  If unspecified, the @device parameter is used
87a937b6aaSMarkus Armbruster#     as the export name.  (Since 2.12)
885daa6bfdSKevin Wolf#
895daa6bfdSKevin Wolf# @description: Free-form description of the export, up to 4096 bytes.
905daa6bfdSKevin Wolf#     (Since 5.0)
915daa6bfdSKevin Wolf#
925daa6bfdSKevin Wolf# Since: 5.0
935daa6bfdSKevin Wolf##
94cbad81ceSEric Blake{ 'struct': 'BlockExportOptionsNbdBase',
95cbad81ceSEric Blake  'data': { '*name': 'str', '*description': 'str' } }
96cbad81ceSEric Blake
97cbad81ceSEric Blake##
98cbad81ceSEric Blake# @BlockExportOptionsNbd:
99cbad81ceSEric Blake#
100cbad81ceSEric Blake# An NBD block export (distinct options used in the NBD branch of
101cbad81ceSEric Blake# block-export-add).
102cbad81ceSEric Blake#
103cbad81ceSEric Blake# @bitmaps: Also export each of the named dirty bitmaps reachable from
104cbad81ceSEric Blake#     @device, so the NBD client can use NBD_OPT_SET_META_CONTEXT with
105cbad81ceSEric Blake#     the metadata context name "qemu:dirty-bitmap:BITMAP" to inspect
106a937b6aaSMarkus Armbruster#     each bitmap.  Since 7.1 bitmap may be specified by node/name
107a937b6aaSMarkus Armbruster#     pair.
108cbad81ceSEric Blake#
109a937b6aaSMarkus Armbruster# @allocation-depth: Also export the allocation depth map for @device,
110a937b6aaSMarkus Armbruster#     so the NBD client can use NBD_OPT_SET_META_CONTEXT with the
111a937b6aaSMarkus Armbruster#     metadata context name "qemu:allocation-depth" to inspect
112a937b6aaSMarkus Armbruster#     allocation details.  (since 5.2)
113dbc7b014SEric Blake#
114cbad81ceSEric Blake# Since: 5.2
115cbad81ceSEric Blake##
116143ea767SKevin Wolf{ 'struct': 'BlockExportOptionsNbd',
117cbad81ceSEric Blake  'base': 'BlockExportOptionsNbdBase',
118e5fb29d5SVladimir Sementsov-Ogievskiy  'data': { '*bitmaps': ['BlockDirtyBitmapOrStr'],
119e5fb29d5SVladimir Sementsov-Ogievskiy            '*allocation-depth': 'bool' } }
1205daa6bfdSKevin Wolf
1215daa6bfdSKevin Wolf##
12290fc91d5SStefan Hajnoczi# @BlockExportOptionsVhostUserBlk:
12390fc91d5SStefan Hajnoczi#
12490fc91d5SStefan Hajnoczi# A vhost-user-blk block export.
12590fc91d5SStefan Hajnoczi#
126a937b6aaSMarkus Armbruster# @addr: The vhost-user socket on which to listen.  Both 'unix' and
127a937b6aaSMarkus Armbruster#     'fd' SocketAddress types are supported.  Passed fds must be UNIX
128a937b6aaSMarkus Armbruster#     domain sockets.
129a937b6aaSMarkus Armbruster#
130a937b6aaSMarkus Armbruster# @logical-block-size: Logical block size in bytes.  Defaults to 512
131a937b6aaSMarkus Armbruster#     bytes.
132a937b6aaSMarkus Armbruster#
133a937b6aaSMarkus Armbruster# @num-queues: Number of request virtqueues.  Must be greater than 0.
134a937b6aaSMarkus Armbruster#     Defaults to 1.
13590fc91d5SStefan Hajnoczi#
13690fc91d5SStefan Hajnoczi# Since: 5.2
13790fc91d5SStefan Hajnoczi##
13890fc91d5SStefan Hajnoczi{ 'struct': 'BlockExportOptionsVhostUserBlk',
139d9b495f9SStefan Hajnoczi  'data': { 'addr': 'SocketAddress',
140d9b495f9SStefan Hajnoczi	    '*logical-block-size': 'size',
141d9b495f9SStefan Hajnoczi            '*num-queues': 'uint16'} }
14290fc91d5SStefan Hajnoczi
14390fc91d5SStefan Hajnoczi##
1448fc54f94SMax Reitz# @FuseExportAllowOther:
1458fc54f94SMax Reitz#
1468fc54f94SMax Reitz# Possible allow_other modes for FUSE exports.
1478fc54f94SMax Reitz#
1488fc54f94SMax Reitz# @off: Do not pass allow_other as a mount option.
1498fc54f94SMax Reitz#
1508fc54f94SMax Reitz# @on: Pass allow_other as a mount option.
1518fc54f94SMax Reitz#
1528fc54f94SMax Reitz# @auto: Try mounting with allow_other first, and if that fails, retry
1538fc54f94SMax Reitz#     without allow_other.
1548fc54f94SMax Reitz#
1558fc54f94SMax Reitz# Since: 6.1
1568fc54f94SMax Reitz##
1578fc54f94SMax Reitz{ 'enum': 'FuseExportAllowOther',
1588fc54f94SMax Reitz  'data': ['off', 'on', 'auto'] }
1598fc54f94SMax Reitz
1608fc54f94SMax Reitz##
1610c9b70d5SMax Reitz# @BlockExportOptionsFuse:
1620c9b70d5SMax Reitz#
1630c9b70d5SMax Reitz# Options for exporting a block graph node on some (file) mountpoint
1640c9b70d5SMax Reitz# as a raw image.
1650c9b70d5SMax Reitz#
16601bed0ffSMarkus Armbruster# @mountpoint: Path on which to export the block device via FUSE.
16701bed0ffSMarkus Armbruster#     This must point to an existing regular file.
1680c9b70d5SMax Reitz#
1694fba06d5SMax Reitz# @growable: Whether writes beyond the EOF should grow the block node
1704fba06d5SMax Reitz#     accordingly.  (default: false)
1714fba06d5SMax Reitz#
1728fc54f94SMax Reitz# @allow-other: If this is off, only qemu's user is allowed access to
173a937b6aaSMarkus Armbruster#     this export.  That cannot be changed even with chmod or chown.
174a937b6aaSMarkus Armbruster#     Enabling this option will allow other users access to the export
175a937b6aaSMarkus Armbruster#     with the FUSE mount option "allow_other".  Note that using
176a937b6aaSMarkus Armbruster#     allow_other as a non-root user requires user_allow_other to be
177a937b6aaSMarkus Armbruster#     enabled in the global fuse.conf configuration file.  In auto
178a937b6aaSMarkus Armbruster#     mode (the default), the FUSE export driver will first attempt to
179a937b6aaSMarkus Armbruster#     mount the export with allow_other, and if that fails, try again
180a937b6aaSMarkus Armbruster#     without.  (since 6.1; default: auto)
1818fc54f94SMax Reitz#
1820c9b70d5SMax Reitz# Since: 6.0
1830c9b70d5SMax Reitz##
1840c9b70d5SMax Reitz{ 'struct': 'BlockExportOptionsFuse',
1854fba06d5SMax Reitz  'data': { 'mountpoint': 'str',
1868fc54f94SMax Reitz            '*growable': 'bool',
1878fc54f94SMax Reitz            '*allow-other': 'FuseExportAllowOther' },
1888a9f1e1dSMarc-André Lureau  'if': 'CONFIG_FUSE' }
1890c9b70d5SMax Reitz
1900c9b70d5SMax Reitz##
1912a2359b8SXie Yongji# @BlockExportOptionsVduseBlk:
1922a2359b8SXie Yongji#
1932a2359b8SXie Yongji# A vduse-blk block export.
1942a2359b8SXie Yongji#
195779d82e1SXie Yongji# @name: the name of VDUSE device (must be unique across the host).
196a937b6aaSMarkus Armbruster#
1972a2359b8SXie Yongji# @num-queues: the number of virtqueues.  Defaults to 1.
198a937b6aaSMarkus Armbruster#
1992a2359b8SXie Yongji# @queue-size: the size of virtqueue.  Defaults to 256.
200a937b6aaSMarkus Armbruster#
201a937b6aaSMarkus Armbruster# @logical-block-size: Logical block size in bytes.  Range [512,
202a937b6aaSMarkus Armbruster#     PAGE_SIZE] and must be power of 2.  Defaults to 512 bytes.
203a937b6aaSMarkus Armbruster#
204a937b6aaSMarkus Armbruster# @serial: the serial number of virtio block device.  Defaults to
205a937b6aaSMarkus Armbruster#     empty string.
2062a2359b8SXie Yongji#
2072a2359b8SXie Yongji# Since: 7.1
2082a2359b8SXie Yongji##
2092a2359b8SXie Yongji{ 'struct': 'BlockExportOptionsVduseBlk',
210779d82e1SXie Yongji  'data': { 'name': 'str',
211779d82e1SXie Yongji            '*num-queues': 'uint16',
2122a2359b8SXie Yongji            '*queue-size': 'uint16',
2130862a087SXie Yongji            '*logical-block-size': 'size',
2140862a087SXie Yongji            '*serial': 'str' } }
2152a2359b8SXie Yongji
2162a2359b8SXie Yongji##
217b6076afcSKevin Wolf# @NbdServerAddOptions:
218b6076afcSKevin Wolf#
219cbad81ceSEric Blake# An NBD block export, per legacy nbd-server-add command.
220b6076afcSKevin Wolf#
221b6076afcSKevin Wolf# @device: The device name or node name of the node to be exported
222b6076afcSKevin Wolf#
223a937b6aaSMarkus Armbruster# @writable: Whether clients should be able to write to the device via
224a937b6aaSMarkus Armbruster#     the NBD connection (default false).
22530dbc81dSKevin Wolf#
226a937b6aaSMarkus Armbruster# @bitmap: Also export a single dirty bitmap reachable from @device,
227a937b6aaSMarkus Armbruster#     so the NBD client can use NBD_OPT_SET_META_CONTEXT with the
228a937b6aaSMarkus Armbruster#     metadata context name "qemu:dirty-bitmap:BITMAP" to inspect the
229a937b6aaSMarkus Armbruster#     bitmap (since 4.0).
230cbad81ceSEric Blake#
231b6076afcSKevin Wolf# Since: 5.0
232b6076afcSKevin Wolf##
233b6076afcSKevin Wolf{ 'struct': 'NbdServerAddOptions',
234cbad81ceSEric Blake  'base': 'BlockExportOptionsNbdBase',
23530dbc81dSKevin Wolf  'data': { 'device': 'str',
236cbad81ceSEric Blake            '*writable': 'bool', '*bitmap': 'str' } }
237b6076afcSKevin Wolf
238b6076afcSKevin Wolf##
2395daa6bfdSKevin Wolf# @nbd-server-add:
2405daa6bfdSKevin Wolf#
2415daa6bfdSKevin Wolf# Export a block node to QEMU's embedded NBD server.
2425daa6bfdSKevin Wolf#
243a937b6aaSMarkus Armbruster# The export name will be used as the id for the resulting block
244a937b6aaSMarkus Armbruster# export.
245d53be9ceSKevin Wolf#
246443127e8SKevin Wolf# Features:
247443127e8SKevin Wolf#
248a937b6aaSMarkus Armbruster# @deprecated: This command is deprecated.  Use @block-export-add
249a937b6aaSMarkus Armbruster#     instead.
250a937b6aaSMarkus Armbruster#
2512746f060SMarkus Armbruster# Errors:
2522746f060SMarkus Armbruster#     - if the server is not running
2532746f060SMarkus Armbruster#     - if an export with the same name already exists
2545daa6bfdSKevin Wolf#
2559bc6e893SMarkus Armbruster# Since: 1.3
2565daa6bfdSKevin Wolf##
2575daa6bfdSKevin Wolf{ 'command': 'nbd-server-add',
258f55ba801SPaolo Bonzini  'data': 'NbdServerAddOptions', 'boxed': true, 'features': ['deprecated'],
259f55ba801SPaolo Bonzini  'allow-preconfig': true }
2605daa6bfdSKevin Wolf
2615daa6bfdSKevin Wolf##
2623c3bc462SKevin Wolf# @BlockExportRemoveMode:
2635daa6bfdSKevin Wolf#
2643c3bc462SKevin Wolf# Mode for removing a block export.
2655daa6bfdSKevin Wolf#
266a937b6aaSMarkus Armbruster# @safe: Remove export if there are no existing connections, fail
267a937b6aaSMarkus Armbruster#     otherwise.
2685daa6bfdSKevin Wolf#
2695daa6bfdSKevin Wolf# @hard: Drop all connections immediately and remove export.
2705daa6bfdSKevin Wolf#
271e3240ac5SMarkus Armbruster# TODO: Potential additional modes to be added in the future:
2725daa6bfdSKevin Wolf#
273e3240ac5SMarkus Armbruster#     - hide: Just hide export from new clients, leave existing
274e3240ac5SMarkus Armbruster#       connections as is.  Remove export after all clients are
275e3240ac5SMarkus Armbruster#       disconnected.
2765daa6bfdSKevin Wolf#
277e3240ac5SMarkus Armbruster#     - soft: Hide export from new clients, answer with ESHUTDOWN for
278e3240ac5SMarkus Armbruster#       all further requests from existing clients.
2795daa6bfdSKevin Wolf#
2805daa6bfdSKevin Wolf# Since: 2.12
2815daa6bfdSKevin Wolf##
2823c3bc462SKevin Wolf{'enum': 'BlockExportRemoveMode', 'data': ['safe', 'hard']}
2835daa6bfdSKevin Wolf
2845daa6bfdSKevin Wolf##
2855daa6bfdSKevin Wolf# @nbd-server-remove:
2865daa6bfdSKevin Wolf#
2875daa6bfdSKevin Wolf# Remove NBD export by name.
2885daa6bfdSKevin Wolf#
2893c3bc462SKevin Wolf# @name: Block export id.
2905daa6bfdSKevin Wolf#
291a937b6aaSMarkus Armbruster# @mode: Mode of command operation.  See @BlockExportRemoveMode
292a937b6aaSMarkus Armbruster#     description.  Default is 'safe'.
2935daa6bfdSKevin Wolf#
294443127e8SKevin Wolf# Features:
295a937b6aaSMarkus Armbruster#
296a937b6aaSMarkus Armbruster# @deprecated: This command is deprecated.  Use @block-export-del
297a937b6aaSMarkus Armbruster#     instead.
298443127e8SKevin Wolf#
2992746f060SMarkus Armbruster# Errors:
3002746f060SMarkus Armbruster#     - if the server is not running
3012746f060SMarkus Armbruster#     - if export is not found
3022746f060SMarkus Armbruster#     - if mode is 'safe' and there are existing connections
3035daa6bfdSKevin Wolf#
3045daa6bfdSKevin Wolf# Since: 2.12
3055daa6bfdSKevin Wolf##
3065daa6bfdSKevin Wolf{ 'command': 'nbd-server-remove',
307443127e8SKevin Wolf  'data': {'name': 'str', '*mode': 'BlockExportRemoveMode'},
308f55ba801SPaolo Bonzini  'features': ['deprecated'],
309f55ba801SPaolo Bonzini  'allow-preconfig': true }
3105daa6bfdSKevin Wolf
3115daa6bfdSKevin Wolf##
3125daa6bfdSKevin Wolf# @nbd-server-stop:
3135daa6bfdSKevin Wolf#
314a937b6aaSMarkus Armbruster# Stop QEMU's embedded NBD server, and unregister all devices
315a937b6aaSMarkus Armbruster# previously added via @nbd-server-add.
3165daa6bfdSKevin Wolf#
3179bc6e893SMarkus Armbruster# Since: 1.3
3185daa6bfdSKevin Wolf##
319f55ba801SPaolo Bonzini{ 'command': 'nbd-server-stop',
320f55ba801SPaolo Bonzini  'allow-preconfig': true }
3215daa6bfdSKevin Wolf
3225daa6bfdSKevin Wolf##
3235daa6bfdSKevin Wolf# @BlockExportType:
3245daa6bfdSKevin Wolf#
3255daa6bfdSKevin Wolf# An enumeration of block export types
3265daa6bfdSKevin Wolf#
3275daa6bfdSKevin Wolf# @nbd: NBD export
328a937b6aaSMarkus Armbruster#
32990fc91d5SStefan Hajnoczi# @vhost-user-blk: vhost-user-blk export (since 5.2)
330a937b6aaSMarkus Armbruster#
3310c9b70d5SMax Reitz# @fuse: FUSE export (since: 6.0)
332a937b6aaSMarkus Armbruster#
3332a2359b8SXie Yongji# @vduse-blk: vduse-blk export (since 7.1)
3345daa6bfdSKevin Wolf#
3355daa6bfdSKevin Wolf# Since: 4.2
3365daa6bfdSKevin Wolf##
3375daa6bfdSKevin Wolf{ 'enum': 'BlockExportType',
338bb01ea73SPhilippe Mathieu-Daudé  'data': [ 'nbd',
3393a8fa0edSPhilippe Mathieu-Daude            { 'name': 'vhost-user-blk',
3403a8fa0edSPhilippe Mathieu-Daude              'if': 'CONFIG_VHOST_USER_BLK_SERVER' },
3412a2359b8SXie Yongji            { 'name': 'fuse', 'if': 'CONFIG_FUSE' },
3422a2359b8SXie Yongji            { 'name': 'vduse-blk', 'if': 'CONFIG_VDUSE_BLK_EXPORT' } ] }
3435daa6bfdSKevin Wolf
3445daa6bfdSKevin Wolf##
345143ea767SKevin Wolf# @BlockExportOptions:
3465daa6bfdSKevin Wolf#
347a937b6aaSMarkus Armbruster# Describes a block export, i.e. how single node should be exported on
348a937b6aaSMarkus Armbruster# an external interface.
3495daa6bfdSKevin Wolf#
35089a2273bSMarkus Armbruster# @type: Block export type
35189a2273bSMarkus Armbruster#
352a937b6aaSMarkus Armbruster# @id: A unique identifier for the block export (across all export
353a937b6aaSMarkus Armbruster#     types)
354d53be9ceSKevin Wolf#
355a937b6aaSMarkus Armbruster# @node-name: The node name of the block node to be exported
356a937b6aaSMarkus Armbruster#     (since: 5.2)
357b6076afcSKevin Wolf#
35830dbc81dSKevin Wolf# @writable: True if clients should be able to write to the export
35930dbc81dSKevin Wolf#     (default false)
36030dbc81dSKevin Wolf#
361a937b6aaSMarkus Armbruster# @writethrough: If true, caches are flushed after every write request
362a937b6aaSMarkus Armbruster#     to the export before completion is signalled.  (since: 5.2;
363fefee85dSKevin Wolf#     default: false)
364fefee85dSKevin Wolf#
365a937b6aaSMarkus Armbruster# @iothread: The name of the iothread object where the export will
366a937b6aaSMarkus Armbruster#     run.  The default is to use the thread currently associated with
367a937b6aaSMarkus Armbruster#     the block node.  (since: 5.2)
368f51d23c8SStefan Hajnoczi#
369a937b6aaSMarkus Armbruster# @fixed-iothread: True prevents the block node from being moved to
370a937b6aaSMarkus Armbruster#     another thread while the export is active.  If true and
371a937b6aaSMarkus Armbruster#     @iothread is given, export creation fails if the block node
372a937b6aaSMarkus Armbruster#     cannot be moved to the iothread.  The default is false.
373a937b6aaSMarkus Armbruster#     (since: 5.2)
374f51d23c8SStefan Hajnoczi#
3755daa6bfdSKevin Wolf# Since: 4.2
3765daa6bfdSKevin Wolf##
377143ea767SKevin Wolf{ 'union': 'BlockExportOptions',
378fefee85dSKevin Wolf  'base': { 'type': 'BlockExportType',
379d53be9ceSKevin Wolf            'id': 'str',
380f51d23c8SStefan Hajnoczi            '*fixed-iothread': 'bool',
381f51d23c8SStefan Hajnoczi            '*iothread': 'str',
382b6076afcSKevin Wolf            'node-name': 'str',
38330dbc81dSKevin Wolf            '*writable': 'bool',
384fefee85dSKevin Wolf            '*writethrough': 'bool' },
3855daa6bfdSKevin Wolf  'discriminator': 'type',
3865daa6bfdSKevin Wolf  'data': {
38790fc91d5SStefan Hajnoczi      'nbd': 'BlockExportOptionsNbd',
388bb01ea73SPhilippe Mathieu-Daudé      'vhost-user-blk': { 'type': 'BlockExportOptionsVhostUserBlk',
389bb01ea73SPhilippe Mathieu-Daudé                          'if': 'CONFIG_VHOST_USER_BLK_SERVER' },
3900c9b70d5SMax Reitz      'fuse': { 'type': 'BlockExportOptionsFuse',
3912a2359b8SXie Yongji                'if': 'CONFIG_FUSE' },
3922a2359b8SXie Yongji      'vduse-blk': { 'type': 'BlockExportOptionsVduseBlk',
3932a2359b8SXie Yongji                     'if': 'CONFIG_VDUSE_BLK_EXPORT' }
3945daa6bfdSKevin Wolf   } }
39556ee8626SKevin Wolf
39656ee8626SKevin Wolf##
39756ee8626SKevin Wolf# @block-export-add:
39856ee8626SKevin Wolf#
39956ee8626SKevin Wolf# Creates a new block export.
40056ee8626SKevin Wolf#
40156ee8626SKevin Wolf# Since: 5.2
40256ee8626SKevin Wolf##
40356ee8626SKevin Wolf{ 'command': 'block-export-add',
404f55ba801SPaolo Bonzini  'data': 'BlockExportOptions', 'boxed': true,
405f55ba801SPaolo Bonzini  'allow-preconfig': true }
4063c3bc462SKevin Wolf
4073c3bc462SKevin Wolf##
4083c3bc462SKevin Wolf# @block-export-del:
4093c3bc462SKevin Wolf#
410a937b6aaSMarkus Armbruster# Request to remove a block export.  This drops the user's reference
411a937b6aaSMarkus Armbruster# to the export, but the export may still stay around after this
412a937b6aaSMarkus Armbruster# command returns until the shutdown of the export has completed.
4133c3bc462SKevin Wolf#
4143c3bc462SKevin Wolf# @id: Block export id.
4153c3bc462SKevin Wolf#
416a937b6aaSMarkus Armbruster# @mode: Mode of command operation.  See @BlockExportRemoveMode
417a937b6aaSMarkus Armbruster#     description.  Default is 'safe'.
4183c3bc462SKevin Wolf#
4192746f060SMarkus Armbruster# Errors:
4202746f060SMarkus Armbruster#     - if the export is not found
4212746f060SMarkus Armbruster#     - if @mode is 'safe' and the export is still in use (e.g. by
4222746f060SMarkus Armbruster#       existing client connections)
4233c3bc462SKevin Wolf#
4243c3bc462SKevin Wolf# Since: 5.2
4253c3bc462SKevin Wolf##
4263c3bc462SKevin Wolf{ 'command': 'block-export-del',
427f55ba801SPaolo Bonzini  'data': { 'id': 'str', '*mode': 'BlockExportRemoveMode' },
428f55ba801SPaolo Bonzini  'allow-preconfig': true }
4291a9f7a80SKevin Wolf
4301a9f7a80SKevin Wolf##
4311a9f7a80SKevin Wolf# @BLOCK_EXPORT_DELETED:
4321a9f7a80SKevin Wolf#
4331a9f7a80SKevin Wolf# Emitted when a block export is removed and its id can be reused.
4341a9f7a80SKevin Wolf#
4351a9f7a80SKevin Wolf# @id: Block export id.
4361a9f7a80SKevin Wolf#
4371a9f7a80SKevin Wolf# Since: 5.2
4381a9f7a80SKevin Wolf##
4391a9f7a80SKevin Wolf{ 'event': 'BLOCK_EXPORT_DELETED',
4401a9f7a80SKevin Wolf  'data': { 'id': 'str' } }
4418cade320SKevin Wolf
4428cade320SKevin Wolf##
4438cade320SKevin Wolf# @BlockExportInfo:
4448cade320SKevin Wolf#
4458cade320SKevin Wolf# Information about a single block export.
4468cade320SKevin Wolf#
4478cade320SKevin Wolf# @id: The unique identifier for the block export
4488cade320SKevin Wolf#
4498cade320SKevin Wolf# @type: The block export type
4508cade320SKevin Wolf#
4518cade320SKevin Wolf# @node-name: The node name of the block node that is exported
4528cade320SKevin Wolf#
4538cade320SKevin Wolf# @shutting-down: True if the export is shutting down (e.g. after a
454a937b6aaSMarkus Armbruster#     block-export-del command, but before the shutdown has completed)
4558cade320SKevin Wolf#
4568cade320SKevin Wolf# Since: 5.2
4578cade320SKevin Wolf##
4588cade320SKevin Wolf{ 'struct': 'BlockExportInfo',
4598cade320SKevin Wolf  'data': { 'id': 'str',
4608cade320SKevin Wolf            'type': 'BlockExportType',
4618cade320SKevin Wolf            'node-name': 'str',
4628cade320SKevin Wolf            'shutting-down': 'bool' } }
4638cade320SKevin Wolf
4648cade320SKevin Wolf##
4658cade320SKevin Wolf# @query-block-exports:
4668cade320SKevin Wolf#
4678cade320SKevin Wolf# Returns: A list of BlockExportInfo describing all block exports
4688cade320SKevin Wolf#
4698cade320SKevin Wolf# Since: 5.2
4708cade320SKevin Wolf##
471f55ba801SPaolo Bonzini{ 'command': 'query-block-exports', 'returns': ['BlockExportInfo'],
472f55ba801SPaolo Bonzini  'allow-preconfig': true }
473