xref: /openbmc/qemu/qapi/block-export.json (revision 2a2359b84407b35fe978e98b7396f2ab8c5dd8b7)
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##
182*2a2359b8SXie Yongji# @BlockExportOptionsVduseBlk:
183*2a2359b8SXie Yongji#
184*2a2359b8SXie Yongji# A vduse-blk block export.
185*2a2359b8SXie Yongji#
186*2a2359b8SXie Yongji# @num-queues: the number of virtqueues. Defaults to 1.
187*2a2359b8SXie Yongji# @queue-size: the size of virtqueue. Defaults to 256.
188*2a2359b8SXie Yongji# @logical-block-size: Logical block size in bytes. Range [512, PAGE_SIZE]
189*2a2359b8SXie Yongji#                      and must be power of 2. Defaults to 512 bytes.
190*2a2359b8SXie Yongji#
191*2a2359b8SXie Yongji# Since: 7.1
192*2a2359b8SXie Yongji##
193*2a2359b8SXie Yongji{ 'struct': 'BlockExportOptionsVduseBlk',
194*2a2359b8SXie Yongji  'data': { '*num-queues': 'uint16',
195*2a2359b8SXie Yongji            '*queue-size': 'uint16',
196*2a2359b8SXie Yongji            '*logical-block-size': 'size'} }
197*2a2359b8SXie Yongji
198*2a2359b8SXie Yongji##
199b6076afcSKevin Wolf# @NbdServerAddOptions:
200b6076afcSKevin Wolf#
201cbad81ceSEric Blake# An NBD block export, per legacy nbd-server-add command.
202b6076afcSKevin Wolf#
203b6076afcSKevin Wolf# @device: The device name or node name of the node to be exported
204b6076afcSKevin Wolf#
20530dbc81dSKevin Wolf# @writable: Whether clients should be able to write to the device via the
20630dbc81dSKevin Wolf#            NBD connection (default false).
20730dbc81dSKevin Wolf#
208cbad81ceSEric Blake# @bitmap: Also export a single dirty bitmap reachable from @device, so the
209cbad81ceSEric Blake#          NBD client can use NBD_OPT_SET_META_CONTEXT with the metadata
210cbad81ceSEric Blake#          context name "qemu:dirty-bitmap:BITMAP" to inspect the bitmap
211cbad81ceSEric Blake#          (since 4.0).
212cbad81ceSEric Blake#
213b6076afcSKevin Wolf# Since: 5.0
214b6076afcSKevin Wolf##
215b6076afcSKevin Wolf{ 'struct': 'NbdServerAddOptions',
216cbad81ceSEric Blake  'base': 'BlockExportOptionsNbdBase',
21730dbc81dSKevin Wolf  'data': { 'device': 'str',
218cbad81ceSEric Blake            '*writable': 'bool', '*bitmap': 'str' } }
219b6076afcSKevin Wolf
220b6076afcSKevin Wolf##
2215daa6bfdSKevin Wolf# @nbd-server-add:
2225daa6bfdSKevin Wolf#
2235daa6bfdSKevin Wolf# Export a block node to QEMU's embedded NBD server.
2245daa6bfdSKevin Wolf#
225d53be9ceSKevin Wolf# The export name will be used as the id for the resulting block export.
226d53be9ceSKevin Wolf#
227443127e8SKevin Wolf# Features:
228443127e8SKevin Wolf# @deprecated: This command is deprecated. Use @block-export-add instead.
229443127e8SKevin Wolf#
2305daa6bfdSKevin Wolf# Returns: error if the server is not running, or export with the same name
2315daa6bfdSKevin Wolf#          already exists.
2325daa6bfdSKevin Wolf#
2339bc6e893SMarkus Armbruster# Since: 1.3
2345daa6bfdSKevin Wolf##
2355daa6bfdSKevin Wolf{ 'command': 'nbd-server-add',
236f55ba801SPaolo Bonzini  'data': 'NbdServerAddOptions', 'boxed': true, 'features': ['deprecated'],
237f55ba801SPaolo Bonzini  'allow-preconfig': true }
2385daa6bfdSKevin Wolf
2395daa6bfdSKevin Wolf##
2403c3bc462SKevin Wolf# @BlockExportRemoveMode:
2415daa6bfdSKevin Wolf#
2423c3bc462SKevin Wolf# Mode for removing a block export.
2435daa6bfdSKevin Wolf#
2445daa6bfdSKevin Wolf# @safe: Remove export if there are no existing connections, fail otherwise.
2455daa6bfdSKevin Wolf#
2465daa6bfdSKevin Wolf# @hard: Drop all connections immediately and remove export.
2475daa6bfdSKevin Wolf#
24897cd74f7SVictor Toso# TODO: Potential additional modes to be added in the future:
2495daa6bfdSKevin Wolf#
2505daa6bfdSKevin Wolf#       hide: Just hide export from new clients, leave existing connections as is.
2515daa6bfdSKevin Wolf#       Remove export after all clients are disconnected.
2525daa6bfdSKevin Wolf#
2535daa6bfdSKevin Wolf#       soft: Hide export from new clients, answer with ESHUTDOWN for all further
2545daa6bfdSKevin Wolf#       requests from existing clients.
2555daa6bfdSKevin Wolf#
2565daa6bfdSKevin Wolf# Since: 2.12
2575daa6bfdSKevin Wolf##
2583c3bc462SKevin Wolf{'enum': 'BlockExportRemoveMode', 'data': ['safe', 'hard']}
2595daa6bfdSKevin Wolf
2605daa6bfdSKevin Wolf##
2615daa6bfdSKevin Wolf# @nbd-server-remove:
2625daa6bfdSKevin Wolf#
2635daa6bfdSKevin Wolf# Remove NBD export by name.
2645daa6bfdSKevin Wolf#
2653c3bc462SKevin Wolf# @name: Block export id.
2665daa6bfdSKevin Wolf#
2673c3bc462SKevin Wolf# @mode: Mode of command operation. See @BlockExportRemoveMode description.
2685daa6bfdSKevin Wolf#        Default is 'safe'.
2695daa6bfdSKevin Wolf#
270443127e8SKevin Wolf# Features:
271443127e8SKevin Wolf# @deprecated: This command is deprecated. Use @block-export-del instead.
272443127e8SKevin Wolf#
2735daa6bfdSKevin Wolf# Returns: error if
2745daa6bfdSKevin Wolf#            - the server is not running
2755daa6bfdSKevin Wolf#            - export is not found
2765daa6bfdSKevin Wolf#            - mode is 'safe' and there are existing connections
2775daa6bfdSKevin Wolf#
2785daa6bfdSKevin Wolf# Since: 2.12
2795daa6bfdSKevin Wolf##
2805daa6bfdSKevin Wolf{ 'command': 'nbd-server-remove',
281443127e8SKevin Wolf  'data': {'name': 'str', '*mode': 'BlockExportRemoveMode'},
282f55ba801SPaolo Bonzini  'features': ['deprecated'],
283f55ba801SPaolo Bonzini  'allow-preconfig': true }
2845daa6bfdSKevin Wolf
2855daa6bfdSKevin Wolf##
2865daa6bfdSKevin Wolf# @nbd-server-stop:
2875daa6bfdSKevin Wolf#
2885daa6bfdSKevin Wolf# Stop QEMU's embedded NBD server, and unregister all devices previously
2895daa6bfdSKevin Wolf# added via @nbd-server-add.
2905daa6bfdSKevin Wolf#
2919bc6e893SMarkus Armbruster# Since: 1.3
2925daa6bfdSKevin Wolf##
293f55ba801SPaolo Bonzini{ 'command': 'nbd-server-stop',
294f55ba801SPaolo Bonzini  'allow-preconfig': true }
2955daa6bfdSKevin Wolf
2965daa6bfdSKevin Wolf##
2975daa6bfdSKevin Wolf# @BlockExportType:
2985daa6bfdSKevin Wolf#
2995daa6bfdSKevin Wolf# An enumeration of block export types
3005daa6bfdSKevin Wolf#
3015daa6bfdSKevin Wolf# @nbd: NBD export
30290fc91d5SStefan Hajnoczi# @vhost-user-blk: vhost-user-blk export (since 5.2)
3030c9b70d5SMax Reitz# @fuse: FUSE export (since: 6.0)
304*2a2359b8SXie Yongji# @vduse-blk: vduse-blk export (since 7.1)
3055daa6bfdSKevin Wolf#
3065daa6bfdSKevin Wolf# Since: 4.2
3075daa6bfdSKevin Wolf##
3085daa6bfdSKevin Wolf{ 'enum': 'BlockExportType',
309bb01ea73SPhilippe Mathieu-Daudé  'data': [ 'nbd',
3103a8fa0edSPhilippe Mathieu-Daude            { 'name': 'vhost-user-blk',
3113a8fa0edSPhilippe Mathieu-Daude              'if': 'CONFIG_VHOST_USER_BLK_SERVER' },
312*2a2359b8SXie Yongji            { 'name': 'fuse', 'if': 'CONFIG_FUSE' },
313*2a2359b8SXie Yongji            { 'name': 'vduse-blk', 'if': 'CONFIG_VDUSE_BLK_EXPORT' } ] }
3145daa6bfdSKevin Wolf
3155daa6bfdSKevin Wolf##
316143ea767SKevin Wolf# @BlockExportOptions:
3175daa6bfdSKevin Wolf#
3185daa6bfdSKevin Wolf# Describes a block export, i.e. how single node should be exported on an
3195daa6bfdSKevin Wolf# external interface.
3205daa6bfdSKevin Wolf#
321*2a2359b8SXie Yongji# @id: A unique identifier for the block export (across the host for vduse-blk
322*2a2359b8SXie Yongji#      export type or across all export types for other types)
323d53be9ceSKevin Wolf#
324b6076afcSKevin Wolf# @node-name: The node name of the block node to be exported (since: 5.2)
325b6076afcSKevin Wolf#
32630dbc81dSKevin Wolf# @writable: True if clients should be able to write to the export
32730dbc81dSKevin Wolf#            (default false)
32830dbc81dSKevin Wolf#
329fefee85dSKevin Wolf# @writethrough: If true, caches are flushed after every write request to the
330fefee85dSKevin Wolf#                export before completion is signalled. (since: 5.2;
331fefee85dSKevin Wolf#                default: false)
332fefee85dSKevin Wolf#
333f51d23c8SStefan Hajnoczi# @iothread: The name of the iothread object where the export will run. The
334f51d23c8SStefan Hajnoczi#            default is to use the thread currently associated with the
335f51d23c8SStefan Hajnoczi#            block node. (since: 5.2)
336f51d23c8SStefan Hajnoczi#
337f51d23c8SStefan Hajnoczi# @fixed-iothread: True prevents the block node from being moved to another
338f51d23c8SStefan Hajnoczi#                  thread while the export is active. If true and @iothread is
339f51d23c8SStefan Hajnoczi#                  given, export creation fails if the block node cannot be
340f51d23c8SStefan Hajnoczi#                  moved to the iothread. The default is false. (since: 5.2)
341f51d23c8SStefan Hajnoczi#
3425daa6bfdSKevin Wolf# Since: 4.2
3435daa6bfdSKevin Wolf##
344143ea767SKevin Wolf{ 'union': 'BlockExportOptions',
345fefee85dSKevin Wolf  'base': { 'type': 'BlockExportType',
346d53be9ceSKevin Wolf            'id': 'str',
347f51d23c8SStefan Hajnoczi            '*fixed-iothread': 'bool',
348f51d23c8SStefan Hajnoczi            '*iothread': 'str',
349b6076afcSKevin Wolf            'node-name': 'str',
35030dbc81dSKevin Wolf            '*writable': 'bool',
351fefee85dSKevin Wolf            '*writethrough': 'bool' },
3525daa6bfdSKevin Wolf  'discriminator': 'type',
3535daa6bfdSKevin Wolf  'data': {
35490fc91d5SStefan Hajnoczi      'nbd': 'BlockExportOptionsNbd',
355bb01ea73SPhilippe Mathieu-Daudé      'vhost-user-blk': { 'type': 'BlockExportOptionsVhostUserBlk',
356bb01ea73SPhilippe Mathieu-Daudé                          'if': 'CONFIG_VHOST_USER_BLK_SERVER' },
3570c9b70d5SMax Reitz      'fuse': { 'type': 'BlockExportOptionsFuse',
358*2a2359b8SXie Yongji                'if': 'CONFIG_FUSE' },
359*2a2359b8SXie Yongji      'vduse-blk': { 'type': 'BlockExportOptionsVduseBlk',
360*2a2359b8SXie Yongji                     'if': 'CONFIG_VDUSE_BLK_EXPORT' }
3615daa6bfdSKevin Wolf   } }
36256ee8626SKevin Wolf
36356ee8626SKevin Wolf##
36456ee8626SKevin Wolf# @block-export-add:
36556ee8626SKevin Wolf#
36656ee8626SKevin Wolf# Creates a new block export.
36756ee8626SKevin Wolf#
36856ee8626SKevin Wolf# Since: 5.2
36956ee8626SKevin Wolf##
37056ee8626SKevin Wolf{ 'command': 'block-export-add',
371f55ba801SPaolo Bonzini  'data': 'BlockExportOptions', 'boxed': true,
372f55ba801SPaolo Bonzini  'allow-preconfig': true }
3733c3bc462SKevin Wolf
3743c3bc462SKevin Wolf##
3753c3bc462SKevin Wolf# @block-export-del:
3763c3bc462SKevin Wolf#
3773c3bc462SKevin Wolf# Request to remove a block export. This drops the user's reference to the
3783c3bc462SKevin Wolf# export, but the export may still stay around after this command returns until
3793c3bc462SKevin Wolf# the shutdown of the export has completed.
3803c3bc462SKevin Wolf#
3813c3bc462SKevin Wolf# @id: Block export id.
3823c3bc462SKevin Wolf#
3833c3bc462SKevin Wolf# @mode: Mode of command operation. See @BlockExportRemoveMode description.
3843c3bc462SKevin Wolf#        Default is 'safe'.
3853c3bc462SKevin Wolf#
3863c3bc462SKevin Wolf# Returns: Error if the export is not found or @mode is 'safe' and the export
3873c3bc462SKevin Wolf#          is still in use (e.g. by existing client connections)
3883c3bc462SKevin Wolf#
3893c3bc462SKevin Wolf# Since: 5.2
3903c3bc462SKevin Wolf##
3913c3bc462SKevin Wolf{ 'command': 'block-export-del',
392f55ba801SPaolo Bonzini  'data': { 'id': 'str', '*mode': 'BlockExportRemoveMode' },
393f55ba801SPaolo Bonzini  'allow-preconfig': true }
3941a9f7a80SKevin Wolf
3951a9f7a80SKevin Wolf##
3961a9f7a80SKevin Wolf# @BLOCK_EXPORT_DELETED:
3971a9f7a80SKevin Wolf#
3981a9f7a80SKevin Wolf# Emitted when a block export is removed and its id can be reused.
3991a9f7a80SKevin Wolf#
4001a9f7a80SKevin Wolf# @id: Block export id.
4011a9f7a80SKevin Wolf#
4021a9f7a80SKevin Wolf# Since: 5.2
4031a9f7a80SKevin Wolf##
4041a9f7a80SKevin Wolf{ 'event': 'BLOCK_EXPORT_DELETED',
4051a9f7a80SKevin Wolf  'data': { 'id': 'str' } }
4068cade320SKevin Wolf
4078cade320SKevin Wolf##
4088cade320SKevin Wolf# @BlockExportInfo:
4098cade320SKevin Wolf#
4108cade320SKevin Wolf# Information about a single block export.
4118cade320SKevin Wolf#
4128cade320SKevin Wolf# @id: The unique identifier for the block export
4138cade320SKevin Wolf#
4148cade320SKevin Wolf# @type: The block export type
4158cade320SKevin Wolf#
4168cade320SKevin Wolf# @node-name: The node name of the block node that is exported
4178cade320SKevin Wolf#
4188cade320SKevin Wolf# @shutting-down: True if the export is shutting down (e.g. after a
4198cade320SKevin Wolf#                 block-export-del command, but before the shutdown has
4208cade320SKevin Wolf#                 completed)
4218cade320SKevin Wolf#
4228cade320SKevin Wolf# Since: 5.2
4238cade320SKevin Wolf##
4248cade320SKevin Wolf{ 'struct': 'BlockExportInfo',
4258cade320SKevin Wolf  'data': { 'id': 'str',
4268cade320SKevin Wolf            'type': 'BlockExportType',
4278cade320SKevin Wolf            'node-name': 'str',
4288cade320SKevin Wolf            'shutting-down': 'bool' } }
4298cade320SKevin Wolf
4308cade320SKevin Wolf##
4318cade320SKevin Wolf# @query-block-exports:
4328cade320SKevin Wolf#
4338cade320SKevin Wolf# Returns: A list of BlockExportInfo describing all block exports
4348cade320SKevin Wolf#
4358cade320SKevin Wolf# Since: 5.2
4368cade320SKevin Wolf##
437f55ba801SPaolo Bonzini{ 'command': 'query-block-exports', 'returns': ['BlockExportInfo'],
438f55ba801SPaolo Bonzini  'allow-preconfig': true }
439