xref: /openbmc/qemu/qapi/block-export.json (revision 779d82e1d305f2a9cbd7f48cf6555ad58145e04a)
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#
145daa6bfdSKevin Wolf# Keep this type consistent with the nbd-server-start arguments. The only
155daa6bfdSKevin Wolf# intended difference is using SocketAddress instead of SocketAddressLegacy.
165daa6bfdSKevin Wolf#
175daa6bfdSKevin Wolf# @addr: Address on which to listen.
185daa6bfdSKevin Wolf# @tls-creds: ID of the TLS credentials object (since 2.6).
195daa6bfdSKevin Wolf# @tls-authz: ID of the QAuthZ authorization object used to validate
205daa6bfdSKevin Wolf#             the client's x509 distinguished name. This object is
215daa6bfdSKevin Wolf#             is only resolved at time of use, so can be deleted and
225daa6bfdSKevin Wolf#             recreated on the fly while the NBD server is active.
235daa6bfdSKevin Wolf#             If missing, it will default to denying access (since 4.0).
241c8222b0SKevin Wolf# @max-connections: The maximum number of connections to allow at the same
2558a6fdccSEric Blake#                   time, 0 for unlimited. Setting this to 1 also stops
2658a6fdccSEric Blake#                   the server from advertising multiple client support
2758a6fdccSEric Blake#                   (since 5.2; default: 0)
285daa6bfdSKevin Wolf#
295daa6bfdSKevin Wolf# Since: 4.2
305daa6bfdSKevin Wolf##
315daa6bfdSKevin Wolf{ 'struct': 'NbdServerOptions',
325daa6bfdSKevin Wolf  'data': { 'addr': 'SocketAddress',
335daa6bfdSKevin Wolf            '*tls-creds': 'str',
341c8222b0SKevin Wolf            '*tls-authz': 'str',
351c8222b0SKevin Wolf            '*max-connections': 'uint32' } }
365daa6bfdSKevin Wolf
375daa6bfdSKevin Wolf##
385daa6bfdSKevin Wolf# @nbd-server-start:
395daa6bfdSKevin Wolf#
405daa6bfdSKevin Wolf# Start an NBD server listening on the given host and port.  Block
415daa6bfdSKevin Wolf# devices can then be exported using @nbd-server-add.  The NBD
425daa6bfdSKevin Wolf# server will present them as named exports; for example, another
435daa6bfdSKevin Wolf# QEMU instance could refer to them as "nbd:HOST:PORT:exportname=NAME".
445daa6bfdSKevin Wolf#
455daa6bfdSKevin Wolf# Keep this type consistent with the NbdServerOptions type. The only intended
465daa6bfdSKevin Wolf# difference is using SocketAddressLegacy instead of SocketAddress.
475daa6bfdSKevin Wolf#
485daa6bfdSKevin Wolf# @addr: Address on which to listen.
495daa6bfdSKevin Wolf# @tls-creds: ID of the TLS credentials object (since 2.6).
505daa6bfdSKevin Wolf# @tls-authz: ID of the QAuthZ authorization object used to validate
515daa6bfdSKevin Wolf#             the client's x509 distinguished name. This object is
525daa6bfdSKevin Wolf#             is only resolved at time of use, so can be deleted and
535daa6bfdSKevin Wolf#             recreated on the fly while the NBD server is active.
545daa6bfdSKevin Wolf#             If missing, it will default to denying access (since 4.0).
551c8222b0SKevin Wolf# @max-connections: The maximum number of connections to allow at the same
5658a6fdccSEric Blake#                   time, 0 for unlimited. Setting this to 1 also stops
5758a6fdccSEric Blake#                   the server from advertising multiple client support
5858a6fdccSEric Blake#                   (since 5.2; default: 0).
595daa6bfdSKevin Wolf#
605daa6bfdSKevin Wolf# Returns: error if the server is already running.
615daa6bfdSKevin Wolf#
629bc6e893SMarkus Armbruster# Since: 1.3
635daa6bfdSKevin Wolf##
645daa6bfdSKevin Wolf{ 'command': 'nbd-server-start',
655daa6bfdSKevin Wolf  'data': { 'addr': 'SocketAddressLegacy',
665daa6bfdSKevin Wolf            '*tls-creds': 'str',
671c8222b0SKevin Wolf            '*tls-authz': 'str',
68f55ba801SPaolo Bonzini            '*max-connections': 'uint32' },
69f55ba801SPaolo Bonzini  'allow-preconfig': true }
705daa6bfdSKevin Wolf
715daa6bfdSKevin Wolf##
72cbad81ceSEric Blake# @BlockExportOptionsNbdBase:
735daa6bfdSKevin Wolf#
74cbad81ceSEric Blake# An NBD block export (common options shared between nbd-server-add and
75cbad81ceSEric Blake# the NBD branch of block-export-add).
765daa6bfdSKevin Wolf#
775daa6bfdSKevin Wolf# @name: Export name. If unspecified, the @device parameter is used as the
785daa6bfdSKevin Wolf#        export name. (Since 2.12)
795daa6bfdSKevin Wolf#
805daa6bfdSKevin Wolf# @description: Free-form description of the export, up to 4096 bytes.
815daa6bfdSKevin Wolf#               (Since 5.0)
825daa6bfdSKevin Wolf#
835daa6bfdSKevin Wolf# Since: 5.0
845daa6bfdSKevin Wolf##
85cbad81ceSEric Blake{ 'struct': 'BlockExportOptionsNbdBase',
86cbad81ceSEric Blake  'data': { '*name': 'str', '*description': 'str' } }
87cbad81ceSEric Blake
88cbad81ceSEric Blake##
89cbad81ceSEric Blake# @BlockExportOptionsNbd:
90cbad81ceSEric Blake#
91cbad81ceSEric Blake# An NBD block export (distinct options used in the NBD branch of
92cbad81ceSEric Blake# block-export-add).
93cbad81ceSEric Blake#
94cbad81ceSEric Blake# @bitmaps: Also export each of the named dirty bitmaps reachable from
95cbad81ceSEric Blake#           @device, so the NBD client can use NBD_OPT_SET_META_CONTEXT with
96cbad81ceSEric Blake#           the metadata context name "qemu:dirty-bitmap:BITMAP" to inspect
97cbad81ceSEric Blake#           each bitmap.
98e5fb29d5SVladimir Sementsov-Ogievskiy#           Since 7.1 bitmap may be specified by node/name pair.
99cbad81ceSEric Blake#
100dbc7b014SEric Blake# @allocation-depth: Also export the allocation depth map for @device, so
101dbc7b014SEric Blake#                    the NBD client can use NBD_OPT_SET_META_CONTEXT with
102dbc7b014SEric Blake#                    the metadata context name "qemu:allocation-depth" to
103dbc7b014SEric Blake#                    inspect allocation details. (since 5.2)
104dbc7b014SEric Blake#
105cbad81ceSEric Blake# Since: 5.2
106cbad81ceSEric Blake##
107143ea767SKevin Wolf{ 'struct': 'BlockExportOptionsNbd',
108cbad81ceSEric Blake  'base': 'BlockExportOptionsNbdBase',
109e5fb29d5SVladimir Sementsov-Ogievskiy  'data': { '*bitmaps': ['BlockDirtyBitmapOrStr'],
110e5fb29d5SVladimir Sementsov-Ogievskiy            '*allocation-depth': 'bool' } }
1115daa6bfdSKevin Wolf
1125daa6bfdSKevin Wolf##
11390fc91d5SStefan Hajnoczi# @BlockExportOptionsVhostUserBlk:
11490fc91d5SStefan Hajnoczi#
11590fc91d5SStefan Hajnoczi# A vhost-user-blk block export.
11690fc91d5SStefan Hajnoczi#
11790fc91d5SStefan Hajnoczi# @addr: The vhost-user socket on which to listen. Both 'unix' and 'fd'
11890fc91d5SStefan Hajnoczi#        SocketAddress types are supported. Passed fds must be UNIX domain
11990fc91d5SStefan Hajnoczi#        sockets.
12090fc91d5SStefan Hajnoczi# @logical-block-size: Logical block size in bytes. Defaults to 512 bytes.
121d9b495f9SStefan Hajnoczi# @num-queues: Number of request virtqueues. Must be greater than 0. Defaults
122d9b495f9SStefan Hajnoczi#              to 1.
12390fc91d5SStefan Hajnoczi#
12490fc91d5SStefan Hajnoczi# Since: 5.2
12590fc91d5SStefan Hajnoczi##
12690fc91d5SStefan Hajnoczi{ 'struct': 'BlockExportOptionsVhostUserBlk',
127d9b495f9SStefan Hajnoczi  'data': { 'addr': 'SocketAddress',
128d9b495f9SStefan Hajnoczi	    '*logical-block-size': 'size',
129d9b495f9SStefan Hajnoczi            '*num-queues': 'uint16'} }
13090fc91d5SStefan Hajnoczi
13190fc91d5SStefan Hajnoczi##
1328fc54f94SMax Reitz# @FuseExportAllowOther:
1338fc54f94SMax Reitz#
1348fc54f94SMax Reitz# Possible allow_other modes for FUSE exports.
1358fc54f94SMax Reitz#
1368fc54f94SMax Reitz# @off: Do not pass allow_other as a mount option.
1378fc54f94SMax Reitz#
1388fc54f94SMax Reitz# @on: Pass allow_other as a mount option.
1398fc54f94SMax Reitz#
1408fc54f94SMax Reitz# @auto: Try mounting with allow_other first, and if that fails, retry
1418fc54f94SMax Reitz#        without allow_other.
1428fc54f94SMax Reitz#
1438fc54f94SMax Reitz# Since: 6.1
1448fc54f94SMax Reitz##
1458fc54f94SMax Reitz{ 'enum': 'FuseExportAllowOther',
1468fc54f94SMax Reitz  'data': ['off', 'on', 'auto'] }
1478fc54f94SMax Reitz
1488fc54f94SMax Reitz##
1490c9b70d5SMax Reitz# @BlockExportOptionsFuse:
1500c9b70d5SMax Reitz#
1510c9b70d5SMax Reitz# Options for exporting a block graph node on some (file) mountpoint
1520c9b70d5SMax Reitz# as a raw image.
1530c9b70d5SMax Reitz#
1540c9b70d5SMax Reitz# @mountpoint: Path on which to export the block device via FUSE.
1550c9b70d5SMax Reitz#              This must point to an existing regular file.
1560c9b70d5SMax Reitz#
1574fba06d5SMax Reitz# @growable: Whether writes beyond the EOF should grow the block node
1584fba06d5SMax Reitz#            accordingly. (default: false)
1594fba06d5SMax Reitz#
1608fc54f94SMax Reitz# @allow-other: If this is off, only qemu's user is allowed access to
1618fc54f94SMax Reitz#               this export.  That cannot be changed even with chmod or
1628fc54f94SMax Reitz#               chown.
1638fc54f94SMax Reitz#               Enabling this option will allow other users access to
1648fc54f94SMax Reitz#               the export with the FUSE mount option "allow_other".
1658fc54f94SMax Reitz#               Note that using allow_other as a non-root user requires
1668fc54f94SMax Reitz#               user_allow_other to be enabled in the global fuse.conf
1678fc54f94SMax Reitz#               configuration file.
1688fc54f94SMax Reitz#               In auto mode (the default), the FUSE export driver will
1698fc54f94SMax Reitz#               first attempt to mount the export with allow_other, and
1708fc54f94SMax Reitz#               if that fails, try again without.
1718fc54f94SMax Reitz#               (since 6.1; default: auto)
1728fc54f94SMax Reitz#
1730c9b70d5SMax Reitz# Since: 6.0
1740c9b70d5SMax Reitz##
1750c9b70d5SMax Reitz{ 'struct': 'BlockExportOptionsFuse',
1764fba06d5SMax Reitz  'data': { 'mountpoint': 'str',
1778fc54f94SMax Reitz            '*growable': 'bool',
1788fc54f94SMax Reitz            '*allow-other': 'FuseExportAllowOther' },
1798a9f1e1dSMarc-André Lureau  'if': 'CONFIG_FUSE' }
1800c9b70d5SMax Reitz
1810c9b70d5SMax Reitz##
1822a2359b8SXie Yongji# @BlockExportOptionsVduseBlk:
1832a2359b8SXie Yongji#
1842a2359b8SXie Yongji# A vduse-blk block export.
1852a2359b8SXie Yongji#
186*779d82e1SXie Yongji# @name: the name of VDUSE device (must be unique across the host).
1872a2359b8SXie Yongji# @num-queues: the number of virtqueues. Defaults to 1.
1882a2359b8SXie Yongji# @queue-size: the size of virtqueue. Defaults to 256.
1892a2359b8SXie Yongji# @logical-block-size: Logical block size in bytes. Range [512, PAGE_SIZE]
1902a2359b8SXie Yongji#                      and must be power of 2. Defaults to 512 bytes.
1910862a087SXie Yongji# @serial: the serial number of virtio block device. Defaults to empty string.
1922a2359b8SXie Yongji#
1932a2359b8SXie Yongji# Since: 7.1
1942a2359b8SXie Yongji##
1952a2359b8SXie Yongji{ 'struct': 'BlockExportOptionsVduseBlk',
196*779d82e1SXie Yongji  'data': { 'name': 'str',
197*779d82e1SXie Yongji            '*num-queues': 'uint16',
1982a2359b8SXie Yongji            '*queue-size': 'uint16',
1990862a087SXie Yongji            '*logical-block-size': 'size',
2000862a087SXie Yongji            '*serial': 'str' } }
2012a2359b8SXie Yongji
2022a2359b8SXie Yongji##
203b6076afcSKevin Wolf# @NbdServerAddOptions:
204b6076afcSKevin Wolf#
205cbad81ceSEric Blake# An NBD block export, per legacy nbd-server-add command.
206b6076afcSKevin Wolf#
207b6076afcSKevin Wolf# @device: The device name or node name of the node to be exported
208b6076afcSKevin Wolf#
20930dbc81dSKevin Wolf# @writable: Whether clients should be able to write to the device via the
21030dbc81dSKevin Wolf#            NBD connection (default false).
21130dbc81dSKevin Wolf#
212cbad81ceSEric Blake# @bitmap: Also export a single dirty bitmap reachable from @device, so the
213cbad81ceSEric Blake#          NBD client can use NBD_OPT_SET_META_CONTEXT with the metadata
214cbad81ceSEric Blake#          context name "qemu:dirty-bitmap:BITMAP" to inspect the bitmap
215cbad81ceSEric Blake#          (since 4.0).
216cbad81ceSEric Blake#
217b6076afcSKevin Wolf# Since: 5.0
218b6076afcSKevin Wolf##
219b6076afcSKevin Wolf{ 'struct': 'NbdServerAddOptions',
220cbad81ceSEric Blake  'base': 'BlockExportOptionsNbdBase',
22130dbc81dSKevin Wolf  'data': { 'device': 'str',
222cbad81ceSEric Blake            '*writable': 'bool', '*bitmap': 'str' } }
223b6076afcSKevin Wolf
224b6076afcSKevin Wolf##
2255daa6bfdSKevin Wolf# @nbd-server-add:
2265daa6bfdSKevin Wolf#
2275daa6bfdSKevin Wolf# Export a block node to QEMU's embedded NBD server.
2285daa6bfdSKevin Wolf#
229d53be9ceSKevin Wolf# The export name will be used as the id for the resulting block export.
230d53be9ceSKevin Wolf#
231443127e8SKevin Wolf# Features:
232443127e8SKevin Wolf# @deprecated: This command is deprecated. Use @block-export-add instead.
233443127e8SKevin Wolf#
2345daa6bfdSKevin Wolf# Returns: error if the server is not running, or export with the same name
2355daa6bfdSKevin Wolf#          already exists.
2365daa6bfdSKevin Wolf#
2379bc6e893SMarkus Armbruster# Since: 1.3
2385daa6bfdSKevin Wolf##
2395daa6bfdSKevin Wolf{ 'command': 'nbd-server-add',
240f55ba801SPaolo Bonzini  'data': 'NbdServerAddOptions', 'boxed': true, 'features': ['deprecated'],
241f55ba801SPaolo Bonzini  'allow-preconfig': true }
2425daa6bfdSKevin Wolf
2435daa6bfdSKevin Wolf##
2443c3bc462SKevin Wolf# @BlockExportRemoveMode:
2455daa6bfdSKevin Wolf#
2463c3bc462SKevin Wolf# Mode for removing a block export.
2475daa6bfdSKevin Wolf#
2485daa6bfdSKevin Wolf# @safe: Remove export if there are no existing connections, fail otherwise.
2495daa6bfdSKevin Wolf#
2505daa6bfdSKevin Wolf# @hard: Drop all connections immediately and remove export.
2515daa6bfdSKevin Wolf#
25297cd74f7SVictor Toso# TODO: Potential additional modes to be added in the future:
2535daa6bfdSKevin Wolf#
2545daa6bfdSKevin Wolf#       hide: Just hide export from new clients, leave existing connections as is.
2555daa6bfdSKevin Wolf#       Remove export after all clients are disconnected.
2565daa6bfdSKevin Wolf#
2575daa6bfdSKevin Wolf#       soft: Hide export from new clients, answer with ESHUTDOWN for all further
2585daa6bfdSKevin Wolf#       requests from existing clients.
2595daa6bfdSKevin Wolf#
2605daa6bfdSKevin Wolf# Since: 2.12
2615daa6bfdSKevin Wolf##
2623c3bc462SKevin Wolf{'enum': 'BlockExportRemoveMode', 'data': ['safe', 'hard']}
2635daa6bfdSKevin Wolf
2645daa6bfdSKevin Wolf##
2655daa6bfdSKevin Wolf# @nbd-server-remove:
2665daa6bfdSKevin Wolf#
2675daa6bfdSKevin Wolf# Remove NBD export by name.
2685daa6bfdSKevin Wolf#
2693c3bc462SKevin Wolf# @name: Block export id.
2705daa6bfdSKevin Wolf#
2713c3bc462SKevin Wolf# @mode: Mode of command operation. See @BlockExportRemoveMode description.
2725daa6bfdSKevin Wolf#        Default is 'safe'.
2735daa6bfdSKevin Wolf#
274443127e8SKevin Wolf# Features:
275443127e8SKevin Wolf# @deprecated: This command is deprecated. Use @block-export-del instead.
276443127e8SKevin Wolf#
2775daa6bfdSKevin Wolf# Returns: error if
2785daa6bfdSKevin Wolf#            - the server is not running
2795daa6bfdSKevin Wolf#            - export is not found
2805daa6bfdSKevin Wolf#            - mode is 'safe' and there are existing connections
2815daa6bfdSKevin Wolf#
2825daa6bfdSKevin Wolf# Since: 2.12
2835daa6bfdSKevin Wolf##
2845daa6bfdSKevin Wolf{ 'command': 'nbd-server-remove',
285443127e8SKevin Wolf  'data': {'name': 'str', '*mode': 'BlockExportRemoveMode'},
286f55ba801SPaolo Bonzini  'features': ['deprecated'],
287f55ba801SPaolo Bonzini  'allow-preconfig': true }
2885daa6bfdSKevin Wolf
2895daa6bfdSKevin Wolf##
2905daa6bfdSKevin Wolf# @nbd-server-stop:
2915daa6bfdSKevin Wolf#
2925daa6bfdSKevin Wolf# Stop QEMU's embedded NBD server, and unregister all devices previously
2935daa6bfdSKevin Wolf# added via @nbd-server-add.
2945daa6bfdSKevin Wolf#
2959bc6e893SMarkus Armbruster# Since: 1.3
2965daa6bfdSKevin Wolf##
297f55ba801SPaolo Bonzini{ 'command': 'nbd-server-stop',
298f55ba801SPaolo Bonzini  'allow-preconfig': true }
2995daa6bfdSKevin Wolf
3005daa6bfdSKevin Wolf##
3015daa6bfdSKevin Wolf# @BlockExportType:
3025daa6bfdSKevin Wolf#
3035daa6bfdSKevin Wolf# An enumeration of block export types
3045daa6bfdSKevin Wolf#
3055daa6bfdSKevin Wolf# @nbd: NBD export
30690fc91d5SStefan Hajnoczi# @vhost-user-blk: vhost-user-blk export (since 5.2)
3070c9b70d5SMax Reitz# @fuse: FUSE export (since: 6.0)
3082a2359b8SXie Yongji# @vduse-blk: vduse-blk export (since 7.1)
3095daa6bfdSKevin Wolf#
3105daa6bfdSKevin Wolf# Since: 4.2
3115daa6bfdSKevin Wolf##
3125daa6bfdSKevin Wolf{ 'enum': 'BlockExportType',
313bb01ea73SPhilippe Mathieu-Daudé  'data': [ 'nbd',
3143a8fa0edSPhilippe Mathieu-Daude            { 'name': 'vhost-user-blk',
3153a8fa0edSPhilippe Mathieu-Daude              'if': 'CONFIG_VHOST_USER_BLK_SERVER' },
3162a2359b8SXie Yongji            { 'name': 'fuse', 'if': 'CONFIG_FUSE' },
3172a2359b8SXie Yongji            { 'name': 'vduse-blk', 'if': 'CONFIG_VDUSE_BLK_EXPORT' } ] }
3185daa6bfdSKevin Wolf
3195daa6bfdSKevin Wolf##
320143ea767SKevin Wolf# @BlockExportOptions:
3215daa6bfdSKevin Wolf#
3225daa6bfdSKevin Wolf# Describes a block export, i.e. how single node should be exported on an
3235daa6bfdSKevin Wolf# external interface.
3245daa6bfdSKevin Wolf#
325*779d82e1SXie Yongji# @id: A unique identifier for the block export (across all export types)
326d53be9ceSKevin Wolf#
327b6076afcSKevin Wolf# @node-name: The node name of the block node to be exported (since: 5.2)
328b6076afcSKevin Wolf#
32930dbc81dSKevin Wolf# @writable: True if clients should be able to write to the export
33030dbc81dSKevin Wolf#            (default false)
33130dbc81dSKevin Wolf#
332fefee85dSKevin Wolf# @writethrough: If true, caches are flushed after every write request to the
333fefee85dSKevin Wolf#                export before completion is signalled. (since: 5.2;
334fefee85dSKevin Wolf#                default: false)
335fefee85dSKevin Wolf#
336f51d23c8SStefan Hajnoczi# @iothread: The name of the iothread object where the export will run. The
337f51d23c8SStefan Hajnoczi#            default is to use the thread currently associated with the
338f51d23c8SStefan Hajnoczi#            block node. (since: 5.2)
339f51d23c8SStefan Hajnoczi#
340f51d23c8SStefan Hajnoczi# @fixed-iothread: True prevents the block node from being moved to another
341f51d23c8SStefan Hajnoczi#                  thread while the export is active. If true and @iothread is
342f51d23c8SStefan Hajnoczi#                  given, export creation fails if the block node cannot be
343f51d23c8SStefan Hajnoczi#                  moved to the iothread. The default is false. (since: 5.2)
344f51d23c8SStefan Hajnoczi#
3455daa6bfdSKevin Wolf# Since: 4.2
3465daa6bfdSKevin Wolf##
347143ea767SKevin Wolf{ 'union': 'BlockExportOptions',
348fefee85dSKevin Wolf  'base': { 'type': 'BlockExportType',
349d53be9ceSKevin Wolf            'id': 'str',
350f51d23c8SStefan Hajnoczi            '*fixed-iothread': 'bool',
351f51d23c8SStefan Hajnoczi            '*iothread': 'str',
352b6076afcSKevin Wolf            'node-name': 'str',
35330dbc81dSKevin Wolf            '*writable': 'bool',
354fefee85dSKevin Wolf            '*writethrough': 'bool' },
3555daa6bfdSKevin Wolf  'discriminator': 'type',
3565daa6bfdSKevin Wolf  'data': {
35790fc91d5SStefan Hajnoczi      'nbd': 'BlockExportOptionsNbd',
358bb01ea73SPhilippe Mathieu-Daudé      'vhost-user-blk': { 'type': 'BlockExportOptionsVhostUserBlk',
359bb01ea73SPhilippe Mathieu-Daudé                          'if': 'CONFIG_VHOST_USER_BLK_SERVER' },
3600c9b70d5SMax Reitz      'fuse': { 'type': 'BlockExportOptionsFuse',
3612a2359b8SXie Yongji                'if': 'CONFIG_FUSE' },
3622a2359b8SXie Yongji      'vduse-blk': { 'type': 'BlockExportOptionsVduseBlk',
3632a2359b8SXie Yongji                     'if': 'CONFIG_VDUSE_BLK_EXPORT' }
3645daa6bfdSKevin Wolf   } }
36556ee8626SKevin Wolf
36656ee8626SKevin Wolf##
36756ee8626SKevin Wolf# @block-export-add:
36856ee8626SKevin Wolf#
36956ee8626SKevin Wolf# Creates a new block export.
37056ee8626SKevin Wolf#
37156ee8626SKevin Wolf# Since: 5.2
37256ee8626SKevin Wolf##
37356ee8626SKevin Wolf{ 'command': 'block-export-add',
374f55ba801SPaolo Bonzini  'data': 'BlockExportOptions', 'boxed': true,
375f55ba801SPaolo Bonzini  'allow-preconfig': true }
3763c3bc462SKevin Wolf
3773c3bc462SKevin Wolf##
3783c3bc462SKevin Wolf# @block-export-del:
3793c3bc462SKevin Wolf#
3803c3bc462SKevin Wolf# Request to remove a block export. This drops the user's reference to the
3813c3bc462SKevin Wolf# export, but the export may still stay around after this command returns until
3823c3bc462SKevin Wolf# the shutdown of the export has completed.
3833c3bc462SKevin Wolf#
3843c3bc462SKevin Wolf# @id: Block export id.
3853c3bc462SKevin Wolf#
3863c3bc462SKevin Wolf# @mode: Mode of command operation. See @BlockExportRemoveMode description.
3873c3bc462SKevin Wolf#        Default is 'safe'.
3883c3bc462SKevin Wolf#
3893c3bc462SKevin Wolf# Returns: Error if the export is not found or @mode is 'safe' and the export
3903c3bc462SKevin Wolf#          is still in use (e.g. by existing client connections)
3913c3bc462SKevin Wolf#
3923c3bc462SKevin Wolf# Since: 5.2
3933c3bc462SKevin Wolf##
3943c3bc462SKevin Wolf{ 'command': 'block-export-del',
395f55ba801SPaolo Bonzini  'data': { 'id': 'str', '*mode': 'BlockExportRemoveMode' },
396f55ba801SPaolo Bonzini  'allow-preconfig': true }
3971a9f7a80SKevin Wolf
3981a9f7a80SKevin Wolf##
3991a9f7a80SKevin Wolf# @BLOCK_EXPORT_DELETED:
4001a9f7a80SKevin Wolf#
4011a9f7a80SKevin Wolf# Emitted when a block export is removed and its id can be reused.
4021a9f7a80SKevin Wolf#
4031a9f7a80SKevin Wolf# @id: Block export id.
4041a9f7a80SKevin Wolf#
4051a9f7a80SKevin Wolf# Since: 5.2
4061a9f7a80SKevin Wolf##
4071a9f7a80SKevin Wolf{ 'event': 'BLOCK_EXPORT_DELETED',
4081a9f7a80SKevin Wolf  'data': { 'id': 'str' } }
4098cade320SKevin Wolf
4108cade320SKevin Wolf##
4118cade320SKevin Wolf# @BlockExportInfo:
4128cade320SKevin Wolf#
4138cade320SKevin Wolf# Information about a single block export.
4148cade320SKevin Wolf#
4158cade320SKevin Wolf# @id: The unique identifier for the block export
4168cade320SKevin Wolf#
4178cade320SKevin Wolf# @type: The block export type
4188cade320SKevin Wolf#
4198cade320SKevin Wolf# @node-name: The node name of the block node that is exported
4208cade320SKevin Wolf#
4218cade320SKevin Wolf# @shutting-down: True if the export is shutting down (e.g. after a
4228cade320SKevin Wolf#                 block-export-del command, but before the shutdown has
4238cade320SKevin Wolf#                 completed)
4248cade320SKevin Wolf#
4258cade320SKevin Wolf# Since: 5.2
4268cade320SKevin Wolf##
4278cade320SKevin Wolf{ 'struct': 'BlockExportInfo',
4288cade320SKevin Wolf  'data': { 'id': 'str',
4298cade320SKevin Wolf            'type': 'BlockExportType',
4308cade320SKevin Wolf            'node-name': 'str',
4318cade320SKevin Wolf            'shutting-down': 'bool' } }
4328cade320SKevin Wolf
4338cade320SKevin Wolf##
4348cade320SKevin Wolf# @query-block-exports:
4358cade320SKevin Wolf#
4368cade320SKevin Wolf# Returns: A list of BlockExportInfo describing all block exports
4378cade320SKevin Wolf#
4388cade320SKevin Wolf# Since: 5.2
4398cade320SKevin Wolf##
440f55ba801SPaolo Bonzini{ 'command': 'query-block-exports', 'returns': ['BlockExportInfo'],
441f55ba801SPaolo Bonzini  'allow-preconfig': true }
442