xref: /openbmc/qemu/qapi/block-export.json (revision a937b6aa739f65f2cae2ad9a7eb65a309ad2a359)
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#
14*a937b6aaSMarkus Armbruster# Keep this type consistent with the nbd-server-start arguments.  The
15*a937b6aaSMarkus Armbruster# only intended difference is using SocketAddress instead of
16*a937b6aaSMarkus Armbruster# SocketAddressLegacy.
175daa6bfdSKevin Wolf#
185daa6bfdSKevin Wolf# @addr: Address on which to listen.
19*a937b6aaSMarkus Armbruster#
205daa6bfdSKevin Wolf# @tls-creds: ID of the TLS credentials object (since 2.6).
21*a937b6aaSMarkus Armbruster#
225daa6bfdSKevin Wolf# @tls-authz: ID of the QAuthZ authorization object used to validate
23*a937b6aaSMarkus Armbruster#     the client's x509 distinguished name.  This object is is only
24*a937b6aaSMarkus Armbruster#     resolved at time of use, so can be deleted and recreated on the
25*a937b6aaSMarkus Armbruster#     fly while the NBD server is active.  If missing, it will default
26*a937b6aaSMarkus Armbruster#     to denying access (since 4.0).
27*a937b6aaSMarkus Armbruster#
28*a937b6aaSMarkus Armbruster# @max-connections: The maximum number of connections to allow at the
29*a937b6aaSMarkus Armbruster#     same time, 0 for unlimited.  Setting this to 1 also stops the
30*a937b6aaSMarkus Armbruster#     server from advertising multiple client support (since 5.2;
31*a937b6aaSMarkus Armbruster#     default: 0)
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
45*a937b6aaSMarkus Armbruster# devices can then be exported using @nbd-server-add.  The NBD server
46*a937b6aaSMarkus Armbruster# will present them as named exports; for example, another QEMU
47*a937b6aaSMarkus Armbruster# instance could refer to them as "nbd:HOST:PORT:exportname=NAME".
485daa6bfdSKevin Wolf#
49*a937b6aaSMarkus Armbruster# Keep this type consistent with the NbdServerOptions type.  The only
50*a937b6aaSMarkus Armbruster# intended difference is using SocketAddressLegacy instead of
51*a937b6aaSMarkus Armbruster# SocketAddress.
525daa6bfdSKevin Wolf#
535daa6bfdSKevin Wolf# @addr: Address on which to listen.
54*a937b6aaSMarkus Armbruster#
555daa6bfdSKevin Wolf# @tls-creds: ID of the TLS credentials object (since 2.6).
56*a937b6aaSMarkus Armbruster#
575daa6bfdSKevin Wolf# @tls-authz: ID of the QAuthZ authorization object used to validate
58*a937b6aaSMarkus Armbruster#     the client's x509 distinguished name.  This object is is only
59*a937b6aaSMarkus Armbruster#     resolved at time of use, so can be deleted and recreated on the
60*a937b6aaSMarkus Armbruster#     fly while the NBD server is active.  If missing, it will default
61*a937b6aaSMarkus Armbruster#     to denying access (since 4.0).
62*a937b6aaSMarkus Armbruster#
63*a937b6aaSMarkus Armbruster# @max-connections: The maximum number of connections to allow at the
64*a937b6aaSMarkus Armbruster#     same time, 0 for unlimited.  Setting this to 1 also stops the
65*a937b6aaSMarkus Armbruster#     server from advertising multiple client support (since 5.2;
66*a937b6aaSMarkus Armbruster#     default: 0).
675daa6bfdSKevin Wolf#
685daa6bfdSKevin Wolf# Returns: error if the server is already running.
695daa6bfdSKevin Wolf#
709bc6e893SMarkus Armbruster# Since: 1.3
715daa6bfdSKevin Wolf##
725daa6bfdSKevin Wolf{ 'command': 'nbd-server-start',
735daa6bfdSKevin Wolf  'data': { 'addr': 'SocketAddressLegacy',
745daa6bfdSKevin Wolf            '*tls-creds': 'str',
751c8222b0SKevin Wolf            '*tls-authz': 'str',
76f55ba801SPaolo Bonzini            '*max-connections': 'uint32' },
77f55ba801SPaolo Bonzini  'allow-preconfig': true }
785daa6bfdSKevin Wolf
795daa6bfdSKevin Wolf##
80cbad81ceSEric Blake# @BlockExportOptionsNbdBase:
815daa6bfdSKevin Wolf#
82*a937b6aaSMarkus Armbruster# An NBD block export (common options shared between nbd-server-add
83*a937b6aaSMarkus Armbruster# and the NBD branch of block-export-add).
845daa6bfdSKevin Wolf#
85*a937b6aaSMarkus Armbruster# @name: Export name.  If unspecified, the @device parameter is used
86*a937b6aaSMarkus Armbruster#     as the export name.  (Since 2.12)
875daa6bfdSKevin Wolf#
885daa6bfdSKevin Wolf# @description: Free-form description of the export, up to 4096 bytes.
895daa6bfdSKevin Wolf#     (Since 5.0)
905daa6bfdSKevin Wolf#
915daa6bfdSKevin Wolf# Since: 5.0
925daa6bfdSKevin Wolf##
93cbad81ceSEric Blake{ 'struct': 'BlockExportOptionsNbdBase',
94cbad81ceSEric Blake  'data': { '*name': 'str', '*description': 'str' } }
95cbad81ceSEric Blake
96cbad81ceSEric Blake##
97cbad81ceSEric Blake# @BlockExportOptionsNbd:
98cbad81ceSEric Blake#
99cbad81ceSEric Blake# An NBD block export (distinct options used in the NBD branch of
100cbad81ceSEric Blake# block-export-add).
101cbad81ceSEric Blake#
102cbad81ceSEric Blake# @bitmaps: Also export each of the named dirty bitmaps reachable from
103cbad81ceSEric Blake#     @device, so the NBD client can use NBD_OPT_SET_META_CONTEXT with
104cbad81ceSEric Blake#     the metadata context name "qemu:dirty-bitmap:BITMAP" to inspect
105*a937b6aaSMarkus Armbruster#     each bitmap.  Since 7.1 bitmap may be specified by node/name
106*a937b6aaSMarkus Armbruster#     pair.
107cbad81ceSEric Blake#
108*a937b6aaSMarkus Armbruster# @allocation-depth: Also export the allocation depth map for @device,
109*a937b6aaSMarkus Armbruster#     so the NBD client can use NBD_OPT_SET_META_CONTEXT with the
110*a937b6aaSMarkus Armbruster#     metadata context name "qemu:allocation-depth" to inspect
111*a937b6aaSMarkus Armbruster#     allocation details.  (since 5.2)
112dbc7b014SEric Blake#
113cbad81ceSEric Blake# Since: 5.2
114cbad81ceSEric Blake##
115143ea767SKevin Wolf{ 'struct': 'BlockExportOptionsNbd',
116cbad81ceSEric Blake  'base': 'BlockExportOptionsNbdBase',
117e5fb29d5SVladimir Sementsov-Ogievskiy  'data': { '*bitmaps': ['BlockDirtyBitmapOrStr'],
118e5fb29d5SVladimir Sementsov-Ogievskiy            '*allocation-depth': 'bool' } }
1195daa6bfdSKevin Wolf
1205daa6bfdSKevin Wolf##
12190fc91d5SStefan Hajnoczi# @BlockExportOptionsVhostUserBlk:
12290fc91d5SStefan Hajnoczi#
12390fc91d5SStefan Hajnoczi# A vhost-user-blk block export.
12490fc91d5SStefan Hajnoczi#
125*a937b6aaSMarkus Armbruster# @addr: The vhost-user socket on which to listen.  Both 'unix' and
126*a937b6aaSMarkus Armbruster#     'fd' SocketAddress types are supported.  Passed fds must be UNIX
127*a937b6aaSMarkus Armbruster#     domain sockets.
128*a937b6aaSMarkus Armbruster#
129*a937b6aaSMarkus Armbruster# @logical-block-size: Logical block size in bytes.  Defaults to 512
130*a937b6aaSMarkus Armbruster#     bytes.
131*a937b6aaSMarkus Armbruster#
132*a937b6aaSMarkus Armbruster# @num-queues: Number of request virtqueues.  Must be greater than 0.
133*a937b6aaSMarkus Armbruster#     Defaults to 1.
13490fc91d5SStefan Hajnoczi#
13590fc91d5SStefan Hajnoczi# Since: 5.2
13690fc91d5SStefan Hajnoczi##
13790fc91d5SStefan Hajnoczi{ 'struct': 'BlockExportOptionsVhostUserBlk',
138d9b495f9SStefan Hajnoczi  'data': { 'addr': 'SocketAddress',
139d9b495f9SStefan Hajnoczi	    '*logical-block-size': 'size',
140d9b495f9SStefan Hajnoczi            '*num-queues': 'uint16'} }
14190fc91d5SStefan Hajnoczi
14290fc91d5SStefan Hajnoczi##
1438fc54f94SMax Reitz# @FuseExportAllowOther:
1448fc54f94SMax Reitz#
1458fc54f94SMax Reitz# Possible allow_other modes for FUSE exports.
1468fc54f94SMax Reitz#
1478fc54f94SMax Reitz# @off: Do not pass allow_other as a mount option.
1488fc54f94SMax Reitz#
1498fc54f94SMax Reitz# @on: Pass allow_other as a mount option.
1508fc54f94SMax Reitz#
1518fc54f94SMax Reitz# @auto: Try mounting with allow_other first, and if that fails, retry
1528fc54f94SMax Reitz#     without allow_other.
1538fc54f94SMax Reitz#
1548fc54f94SMax Reitz# Since: 6.1
1558fc54f94SMax Reitz##
1568fc54f94SMax Reitz{ 'enum': 'FuseExportAllowOther',
1578fc54f94SMax Reitz  'data': ['off', 'on', 'auto'] }
1588fc54f94SMax Reitz
1598fc54f94SMax Reitz##
1600c9b70d5SMax Reitz# @BlockExportOptionsFuse:
1610c9b70d5SMax Reitz#
1620c9b70d5SMax Reitz# Options for exporting a block graph node on some (file) mountpoint
1630c9b70d5SMax Reitz# as a raw image.
1640c9b70d5SMax Reitz#
165*a937b6aaSMarkus Armbruster# @mountpoint: Path on which to export the block device via FUSE. This
166*a937b6aaSMarkus Armbruster#     must point to an existing regular file.
1670c9b70d5SMax Reitz#
1684fba06d5SMax Reitz# @growable: Whether writes beyond the EOF should grow the block node
1694fba06d5SMax Reitz#     accordingly.  (default: false)
1704fba06d5SMax Reitz#
1718fc54f94SMax Reitz# @allow-other: If this is off, only qemu's user is allowed access to
172*a937b6aaSMarkus Armbruster#     this export.  That cannot be changed even with chmod or chown.
173*a937b6aaSMarkus Armbruster#     Enabling this option will allow other users access to the export
174*a937b6aaSMarkus Armbruster#     with the FUSE mount option "allow_other". Note that using
175*a937b6aaSMarkus Armbruster#     allow_other as a non-root user requires user_allow_other to be
176*a937b6aaSMarkus Armbruster#     enabled in the global fuse.conf configuration file.  In auto
177*a937b6aaSMarkus Armbruster#     mode (the default), the FUSE export driver will first attempt to
178*a937b6aaSMarkus Armbruster#     mount the export with allow_other, and if that fails, try again
179*a937b6aaSMarkus Armbruster#     without.  (since 6.1; default: auto)
1808fc54f94SMax Reitz#
1810c9b70d5SMax Reitz# Since: 6.0
1820c9b70d5SMax Reitz##
1830c9b70d5SMax Reitz{ 'struct': 'BlockExportOptionsFuse',
1844fba06d5SMax Reitz  'data': { 'mountpoint': 'str',
1858fc54f94SMax Reitz            '*growable': 'bool',
1868fc54f94SMax Reitz            '*allow-other': 'FuseExportAllowOther' },
1878a9f1e1dSMarc-André Lureau  'if': 'CONFIG_FUSE' }
1880c9b70d5SMax Reitz
1890c9b70d5SMax Reitz##
1902a2359b8SXie Yongji# @BlockExportOptionsVduseBlk:
1912a2359b8SXie Yongji#
1922a2359b8SXie Yongji# A vduse-blk block export.
1932a2359b8SXie Yongji#
194779d82e1SXie Yongji# @name: the name of VDUSE device (must be unique across the host).
195*a937b6aaSMarkus Armbruster#
1962a2359b8SXie Yongji# @num-queues: the number of virtqueues.  Defaults to 1.
197*a937b6aaSMarkus Armbruster#
1982a2359b8SXie Yongji# @queue-size: the size of virtqueue.  Defaults to 256.
199*a937b6aaSMarkus Armbruster#
200*a937b6aaSMarkus Armbruster# @logical-block-size: Logical block size in bytes.  Range [512,
201*a937b6aaSMarkus Armbruster#     PAGE_SIZE] and must be power of 2. Defaults to 512 bytes.
202*a937b6aaSMarkus Armbruster#
203*a937b6aaSMarkus Armbruster# @serial: the serial number of virtio block device.  Defaults to
204*a937b6aaSMarkus Armbruster#     empty string.
2052a2359b8SXie Yongji#
2062a2359b8SXie Yongji# Since: 7.1
2072a2359b8SXie Yongji##
2082a2359b8SXie Yongji{ 'struct': 'BlockExportOptionsVduseBlk',
209779d82e1SXie Yongji  'data': { 'name': 'str',
210779d82e1SXie Yongji            '*num-queues': 'uint16',
2112a2359b8SXie Yongji            '*queue-size': 'uint16',
2120862a087SXie Yongji            '*logical-block-size': 'size',
2130862a087SXie Yongji            '*serial': 'str' } }
2142a2359b8SXie Yongji
2152a2359b8SXie Yongji##
216b6076afcSKevin Wolf# @NbdServerAddOptions:
217b6076afcSKevin Wolf#
218cbad81ceSEric Blake# An NBD block export, per legacy nbd-server-add command.
219b6076afcSKevin Wolf#
220b6076afcSKevin Wolf# @device: The device name or node name of the node to be exported
221b6076afcSKevin Wolf#
222*a937b6aaSMarkus Armbruster# @writable: Whether clients should be able to write to the device via
223*a937b6aaSMarkus Armbruster#     the NBD connection (default false).
22430dbc81dSKevin Wolf#
225*a937b6aaSMarkus Armbruster# @bitmap: Also export a single dirty bitmap reachable from @device,
226*a937b6aaSMarkus Armbruster#     so the NBD client can use NBD_OPT_SET_META_CONTEXT with the
227*a937b6aaSMarkus Armbruster#     metadata context name "qemu:dirty-bitmap:BITMAP" to inspect the
228*a937b6aaSMarkus Armbruster#     bitmap (since 4.0).
229cbad81ceSEric Blake#
230b6076afcSKevin Wolf# Since: 5.0
231b6076afcSKevin Wolf##
232b6076afcSKevin Wolf{ 'struct': 'NbdServerAddOptions',
233cbad81ceSEric Blake  'base': 'BlockExportOptionsNbdBase',
23430dbc81dSKevin Wolf  'data': { 'device': 'str',
235cbad81ceSEric Blake            '*writable': 'bool', '*bitmap': 'str' } }
236b6076afcSKevin Wolf
237b6076afcSKevin Wolf##
2385daa6bfdSKevin Wolf# @nbd-server-add:
2395daa6bfdSKevin Wolf#
2405daa6bfdSKevin Wolf# Export a block node to QEMU's embedded NBD server.
2415daa6bfdSKevin Wolf#
242*a937b6aaSMarkus Armbruster# The export name will be used as the id for the resulting block
243*a937b6aaSMarkus Armbruster# export.
244d53be9ceSKevin Wolf#
245443127e8SKevin Wolf# Features:
246443127e8SKevin Wolf#
247*a937b6aaSMarkus Armbruster# @deprecated: This command is deprecated.  Use @block-export-add
248*a937b6aaSMarkus Armbruster#     instead.
249*a937b6aaSMarkus Armbruster#
250*a937b6aaSMarkus Armbruster# Returns: error if the server is not running, or export with the same
251*a937b6aaSMarkus Armbruster#     name already exists.
2525daa6bfdSKevin Wolf#
2539bc6e893SMarkus Armbruster# Since: 1.3
2545daa6bfdSKevin Wolf##
2555daa6bfdSKevin Wolf{ 'command': 'nbd-server-add',
256f55ba801SPaolo Bonzini  'data': 'NbdServerAddOptions', 'boxed': true, 'features': ['deprecated'],
257f55ba801SPaolo Bonzini  'allow-preconfig': true }
2585daa6bfdSKevin Wolf
2595daa6bfdSKevin Wolf##
2603c3bc462SKevin Wolf# @BlockExportRemoveMode:
2615daa6bfdSKevin Wolf#
2623c3bc462SKevin Wolf# Mode for removing a block export.
2635daa6bfdSKevin Wolf#
264*a937b6aaSMarkus Armbruster# @safe: Remove export if there are no existing connections, fail
265*a937b6aaSMarkus Armbruster#     otherwise.
2665daa6bfdSKevin Wolf#
2675daa6bfdSKevin Wolf# @hard: Drop all connections immediately and remove export.
2685daa6bfdSKevin Wolf#
269b71fd73cSMarkus Armbruster# Potential additional modes to be added in the future:
2705daa6bfdSKevin Wolf#
271*a937b6aaSMarkus Armbruster# hide: Just hide export from new clients, leave existing connections
272*a937b6aaSMarkus Armbruster# as is.  Remove export after all clients are disconnected.
2735daa6bfdSKevin Wolf#
274*a937b6aaSMarkus Armbruster# soft: Hide export from new clients, answer with ESHUTDOWN for all
275*a937b6aaSMarkus Armbruster# further requests from existing clients.
2765daa6bfdSKevin Wolf#
2775daa6bfdSKevin Wolf# Since: 2.12
2785daa6bfdSKevin Wolf##
2793c3bc462SKevin Wolf{'enum': 'BlockExportRemoveMode', 'data': ['safe', 'hard']}
2805daa6bfdSKevin Wolf
2815daa6bfdSKevin Wolf##
2825daa6bfdSKevin Wolf# @nbd-server-remove:
2835daa6bfdSKevin Wolf#
2845daa6bfdSKevin Wolf# Remove NBD export by name.
2855daa6bfdSKevin Wolf#
2863c3bc462SKevin Wolf# @name: Block export id.
2875daa6bfdSKevin Wolf#
288*a937b6aaSMarkus Armbruster# @mode: Mode of command operation.  See @BlockExportRemoveMode
289*a937b6aaSMarkus Armbruster#     description.  Default is 'safe'.
2905daa6bfdSKevin Wolf#
291443127e8SKevin Wolf# Features:
292*a937b6aaSMarkus Armbruster#
293*a937b6aaSMarkus Armbruster# @deprecated: This command is deprecated.  Use @block-export-del
294*a937b6aaSMarkus Armbruster#     instead.
295443127e8SKevin Wolf#
2965daa6bfdSKevin Wolf# Returns: error if
297c1101028SMarkus Armbruster#
2985daa6bfdSKevin Wolf#     - the server is not running
2995daa6bfdSKevin Wolf#     - export is not found
3005daa6bfdSKevin Wolf#     - mode is 'safe' and there are existing connections
3015daa6bfdSKevin Wolf#
3025daa6bfdSKevin Wolf# Since: 2.12
3035daa6bfdSKevin Wolf##
3045daa6bfdSKevin Wolf{ 'command': 'nbd-server-remove',
305443127e8SKevin Wolf  'data': {'name': 'str', '*mode': 'BlockExportRemoveMode'},
306f55ba801SPaolo Bonzini  'features': ['deprecated'],
307f55ba801SPaolo Bonzini  'allow-preconfig': true }
3085daa6bfdSKevin Wolf
3095daa6bfdSKevin Wolf##
3105daa6bfdSKevin Wolf# @nbd-server-stop:
3115daa6bfdSKevin Wolf#
312*a937b6aaSMarkus Armbruster# Stop QEMU's embedded NBD server, and unregister all devices
313*a937b6aaSMarkus Armbruster# previously added via @nbd-server-add.
3145daa6bfdSKevin Wolf#
3159bc6e893SMarkus Armbruster# Since: 1.3
3165daa6bfdSKevin Wolf##
317f55ba801SPaolo Bonzini{ 'command': 'nbd-server-stop',
318f55ba801SPaolo Bonzini  'allow-preconfig': true }
3195daa6bfdSKevin Wolf
3205daa6bfdSKevin Wolf##
3215daa6bfdSKevin Wolf# @BlockExportType:
3225daa6bfdSKevin Wolf#
3235daa6bfdSKevin Wolf# An enumeration of block export types
3245daa6bfdSKevin Wolf#
3255daa6bfdSKevin Wolf# @nbd: NBD export
326*a937b6aaSMarkus Armbruster#
32790fc91d5SStefan Hajnoczi# @vhost-user-blk: vhost-user-blk export (since 5.2)
328*a937b6aaSMarkus Armbruster#
3290c9b70d5SMax Reitz# @fuse: FUSE export (since: 6.0)
330*a937b6aaSMarkus Armbruster#
3312a2359b8SXie Yongji# @vduse-blk: vduse-blk export (since 7.1)
3325daa6bfdSKevin Wolf#
3335daa6bfdSKevin Wolf# Since: 4.2
3345daa6bfdSKevin Wolf##
3355daa6bfdSKevin Wolf{ 'enum': 'BlockExportType',
336bb01ea73SPhilippe Mathieu-Daudé  'data': [ 'nbd',
3373a8fa0edSPhilippe Mathieu-Daude            { 'name': 'vhost-user-blk',
3383a8fa0edSPhilippe Mathieu-Daude              'if': 'CONFIG_VHOST_USER_BLK_SERVER' },
3392a2359b8SXie Yongji            { 'name': 'fuse', 'if': 'CONFIG_FUSE' },
3402a2359b8SXie Yongji            { 'name': 'vduse-blk', 'if': 'CONFIG_VDUSE_BLK_EXPORT' } ] }
3415daa6bfdSKevin Wolf
3425daa6bfdSKevin Wolf##
343143ea767SKevin Wolf# @BlockExportOptions:
3445daa6bfdSKevin Wolf#
345*a937b6aaSMarkus Armbruster# Describes a block export, i.e. how single node should be exported on
346*a937b6aaSMarkus Armbruster# an external interface.
3475daa6bfdSKevin Wolf#
348*a937b6aaSMarkus Armbruster# @id: A unique identifier for the block export (across all export
349*a937b6aaSMarkus Armbruster#     types)
350d53be9ceSKevin Wolf#
351*a937b6aaSMarkus Armbruster# @node-name: The node name of the block node to be exported
352*a937b6aaSMarkus Armbruster#     (since: 5.2)
353b6076afcSKevin Wolf#
35430dbc81dSKevin Wolf# @writable: True if clients should be able to write to the export
35530dbc81dSKevin Wolf#     (default false)
35630dbc81dSKevin Wolf#
357*a937b6aaSMarkus Armbruster# @writethrough: If true, caches are flushed after every write request
358*a937b6aaSMarkus Armbruster#     to the export before completion is signalled.  (since: 5.2;
359fefee85dSKevin Wolf#     default: false)
360fefee85dSKevin Wolf#
361*a937b6aaSMarkus Armbruster# @iothread: The name of the iothread object where the export will
362*a937b6aaSMarkus Armbruster#     run.  The default is to use the thread currently associated with
363*a937b6aaSMarkus Armbruster#     the block node.  (since: 5.2)
364f51d23c8SStefan Hajnoczi#
365*a937b6aaSMarkus Armbruster# @fixed-iothread: True prevents the block node from being moved to
366*a937b6aaSMarkus Armbruster#     another thread while the export is active.  If true and
367*a937b6aaSMarkus Armbruster#     @iothread is given, export creation fails if the block node
368*a937b6aaSMarkus Armbruster#     cannot be moved to the iothread.  The default is false.
369*a937b6aaSMarkus Armbruster#     (since: 5.2)
370f51d23c8SStefan Hajnoczi#
3715daa6bfdSKevin Wolf# Since: 4.2
3725daa6bfdSKevin Wolf##
373143ea767SKevin Wolf{ 'union': 'BlockExportOptions',
374fefee85dSKevin Wolf  'base': { 'type': 'BlockExportType',
375d53be9ceSKevin Wolf            'id': 'str',
376f51d23c8SStefan Hajnoczi            '*fixed-iothread': 'bool',
377f51d23c8SStefan Hajnoczi            '*iothread': 'str',
378b6076afcSKevin Wolf            'node-name': 'str',
37930dbc81dSKevin Wolf            '*writable': 'bool',
380fefee85dSKevin Wolf            '*writethrough': 'bool' },
3815daa6bfdSKevin Wolf  'discriminator': 'type',
3825daa6bfdSKevin Wolf  'data': {
38390fc91d5SStefan Hajnoczi      'nbd': 'BlockExportOptionsNbd',
384bb01ea73SPhilippe Mathieu-Daudé      'vhost-user-blk': { 'type': 'BlockExportOptionsVhostUserBlk',
385bb01ea73SPhilippe Mathieu-Daudé                          'if': 'CONFIG_VHOST_USER_BLK_SERVER' },
3860c9b70d5SMax Reitz      'fuse': { 'type': 'BlockExportOptionsFuse',
3872a2359b8SXie Yongji                'if': 'CONFIG_FUSE' },
3882a2359b8SXie Yongji      'vduse-blk': { 'type': 'BlockExportOptionsVduseBlk',
3892a2359b8SXie Yongji                     'if': 'CONFIG_VDUSE_BLK_EXPORT' }
3905daa6bfdSKevin Wolf   } }
39156ee8626SKevin Wolf
39256ee8626SKevin Wolf##
39356ee8626SKevin Wolf# @block-export-add:
39456ee8626SKevin Wolf#
39556ee8626SKevin Wolf# Creates a new block export.
39656ee8626SKevin Wolf#
39756ee8626SKevin Wolf# Since: 5.2
39856ee8626SKevin Wolf##
39956ee8626SKevin Wolf{ 'command': 'block-export-add',
400f55ba801SPaolo Bonzini  'data': 'BlockExportOptions', 'boxed': true,
401f55ba801SPaolo Bonzini  'allow-preconfig': true }
4023c3bc462SKevin Wolf
4033c3bc462SKevin Wolf##
4043c3bc462SKevin Wolf# @block-export-del:
4053c3bc462SKevin Wolf#
406*a937b6aaSMarkus Armbruster# Request to remove a block export.  This drops the user's reference
407*a937b6aaSMarkus Armbruster# to the export, but the export may still stay around after this
408*a937b6aaSMarkus Armbruster# command returns until the shutdown of the export has completed.
4093c3bc462SKevin Wolf#
4103c3bc462SKevin Wolf# @id: Block export id.
4113c3bc462SKevin Wolf#
412*a937b6aaSMarkus Armbruster# @mode: Mode of command operation.  See @BlockExportRemoveMode
413*a937b6aaSMarkus Armbruster#     description.  Default is 'safe'.
4143c3bc462SKevin Wolf#
415*a937b6aaSMarkus Armbruster# Returns: Error if the export is not found or @mode is 'safe' and the
416*a937b6aaSMarkus Armbruster#     export is still in use (e.g. by existing client connections)
4173c3bc462SKevin Wolf#
4183c3bc462SKevin Wolf# Since: 5.2
4193c3bc462SKevin Wolf##
4203c3bc462SKevin Wolf{ 'command': 'block-export-del',
421f55ba801SPaolo Bonzini  'data': { 'id': 'str', '*mode': 'BlockExportRemoveMode' },
422f55ba801SPaolo Bonzini  'allow-preconfig': true }
4231a9f7a80SKevin Wolf
4241a9f7a80SKevin Wolf##
4251a9f7a80SKevin Wolf# @BLOCK_EXPORT_DELETED:
4261a9f7a80SKevin Wolf#
4271a9f7a80SKevin Wolf# Emitted when a block export is removed and its id can be reused.
4281a9f7a80SKevin Wolf#
4291a9f7a80SKevin Wolf# @id: Block export id.
4301a9f7a80SKevin Wolf#
4311a9f7a80SKevin Wolf# Since: 5.2
4321a9f7a80SKevin Wolf##
4331a9f7a80SKevin Wolf{ 'event': 'BLOCK_EXPORT_DELETED',
4341a9f7a80SKevin Wolf  'data': { 'id': 'str' } }
4358cade320SKevin Wolf
4368cade320SKevin Wolf##
4378cade320SKevin Wolf# @BlockExportInfo:
4388cade320SKevin Wolf#
4398cade320SKevin Wolf# Information about a single block export.
4408cade320SKevin Wolf#
4418cade320SKevin Wolf# @id: The unique identifier for the block export
4428cade320SKevin Wolf#
4438cade320SKevin Wolf# @type: The block export type
4448cade320SKevin Wolf#
4458cade320SKevin Wolf# @node-name: The node name of the block node that is exported
4468cade320SKevin Wolf#
4478cade320SKevin Wolf# @shutting-down: True if the export is shutting down (e.g. after a
448*a937b6aaSMarkus Armbruster#     block-export-del command, but before the shutdown has completed)
4498cade320SKevin Wolf#
4508cade320SKevin Wolf# Since: 5.2
4518cade320SKevin Wolf##
4528cade320SKevin Wolf{ 'struct': 'BlockExportInfo',
4538cade320SKevin Wolf  'data': { 'id': 'str',
4548cade320SKevin Wolf            'type': 'BlockExportType',
4558cade320SKevin Wolf            'node-name': 'str',
4568cade320SKevin Wolf            'shutting-down': 'bool' } }
4578cade320SKevin Wolf
4588cade320SKevin Wolf##
4598cade320SKevin Wolf# @query-block-exports:
4608cade320SKevin Wolf#
4618cade320SKevin Wolf# Returns: A list of BlockExportInfo describing all block exports
4628cade320SKevin Wolf#
4638cade320SKevin Wolf# Since: 5.2
4648cade320SKevin Wolf##
465f55ba801SPaolo Bonzini{ 'command': 'query-block-exports', 'returns': ['BlockExportInfo'],
466f55ba801SPaolo Bonzini  'allow-preconfig': true }
467