target/riscv: Promote svade to a normal extension
[qemu/ar7.git] / qapi / block-export.json
blob3919a2d5b9dc935136fef11e49cad84a808bfd02
1 # -*- Mode: Python -*-
2 # vim: filetype=python
4 ##
5 # == Block device exports
6 ##
8 { 'include': 'sockets.json' }
9 { 'include': 'block-core.json' }
12 # @NbdServerOptions:
14 # Keep this type consistent with the nbd-server-start arguments.  The
15 # only intended difference is using SocketAddress instead of
16 # SocketAddressLegacy.
18 # @addr: Address on which to listen.
20 # @tls-creds: ID of the TLS credentials object (since 2.6).
22 # @tls-authz: ID of the QAuthZ authorization object used to validate
23 #     the client's x509 distinguished name.  This object is is only
24 #     resolved at time of use, so can be deleted and recreated on the
25 #     fly while the NBD server is active.  If missing, it will default
26 #     to denying access (since 4.0).
28 # @max-connections: The maximum number of connections to allow at the
29 #     same time, 0 for unlimited.  Setting this to 1 also stops the
30 #     server from advertising multiple client support (since 5.2;
31 #     default: 0)
33 # Since: 4.2
35 { 'struct': 'NbdServerOptions',
36   'data': { 'addr': 'SocketAddress',
37             '*tls-creds': 'str',
38             '*tls-authz': 'str',
39             '*max-connections': 'uint32' } }
42 # @nbd-server-start:
44 # Start an NBD server listening on the given host and port.  Block
45 # devices can then be exported using @nbd-server-add.  The NBD server
46 # will present them as named exports; for example, another QEMU
47 # instance could refer to them as "nbd:HOST:PORT:exportname=NAME".
49 # Keep this type consistent with the NbdServerOptions type.  The only
50 # intended difference is using SocketAddressLegacy instead of
51 # SocketAddress.
53 # @addr: Address on which to listen.
55 # @tls-creds: ID of the TLS credentials object (since 2.6).
57 # @tls-authz: ID of the QAuthZ authorization object used to validate
58 #     the client's x509 distinguished name.  This object is is only
59 #     resolved at time of use, so can be deleted and recreated on the
60 #     fly while the NBD server is active.  If missing, it will default
61 #     to denying access (since 4.0).
63 # @max-connections: The maximum number of connections to allow at the
64 #     same time, 0 for unlimited.  Setting this to 1 also stops the
65 #     server from advertising multiple client support (since 5.2;
66 #     default: 0).
68 # Errors:
69 #     - if the server is already running
71 # Since: 1.3
73 { 'command': 'nbd-server-start',
74   'data': { 'addr': 'SocketAddressLegacy',
75             '*tls-creds': 'str',
76             '*tls-authz': 'str',
77             '*max-connections': 'uint32' },
78   'allow-preconfig': true }
81 # @BlockExportOptionsNbdBase:
83 # An NBD block export (common options shared between nbd-server-add
84 # and the NBD branch of block-export-add).
86 # @name: Export name.  If unspecified, the @device parameter is used
87 #     as the export name.  (Since 2.12)
89 # @description: Free-form description of the export, up to 4096 bytes.
90 #     (Since 5.0)
92 # Since: 5.0
94 { 'struct': 'BlockExportOptionsNbdBase',
95   'data': { '*name': 'str', '*description': 'str' } }
98 # @BlockExportOptionsNbd:
100 # An NBD block export (distinct options used in the NBD branch of
101 # block-export-add).
103 # @bitmaps: Also export each of the named dirty bitmaps reachable from
104 #     @device, so the NBD client can use NBD_OPT_SET_META_CONTEXT with
105 #     the metadata context name "qemu:dirty-bitmap:BITMAP" to inspect
106 #     each bitmap.  Since 7.1 bitmap may be specified by node/name
107 #     pair.
109 # @allocation-depth: Also export the allocation depth map for @device,
110 #     so the NBD client can use NBD_OPT_SET_META_CONTEXT with the
111 #     metadata context name "qemu:allocation-depth" to inspect
112 #     allocation details.  (since 5.2)
114 # Since: 5.2
116 { 'struct': 'BlockExportOptionsNbd',
117   'base': 'BlockExportOptionsNbdBase',
118   'data': { '*bitmaps': ['BlockDirtyBitmapOrStr'],
119             '*allocation-depth': 'bool' } }
122 # @BlockExportOptionsVhostUserBlk:
124 # A vhost-user-blk block export.
126 # @addr: The vhost-user socket on which to listen.  Both 'unix' and
127 #     'fd' SocketAddress types are supported.  Passed fds must be UNIX
128 #     domain sockets.
130 # @logical-block-size: Logical block size in bytes.  Defaults to 512
131 #     bytes.
133 # @num-queues: Number of request virtqueues.  Must be greater than 0.
134 #     Defaults to 1.
136 # Since: 5.2
138 { 'struct': 'BlockExportOptionsVhostUserBlk',
139   'data': { 'addr': 'SocketAddress',
140             '*logical-block-size': 'size',
141             '*num-queues': 'uint16'} }
144 # @FuseExportAllowOther:
146 # Possible allow_other modes for FUSE exports.
148 # @off: Do not pass allow_other as a mount option.
150 # @on: Pass allow_other as a mount option.
152 # @auto: Try mounting with allow_other first, and if that fails, retry
153 #     without allow_other.
155 # Since: 6.1
157 { 'enum': 'FuseExportAllowOther',
158   'data': ['off', 'on', 'auto'] }
161 # @BlockExportOptionsFuse:
163 # Options for exporting a block graph node on some (file) mountpoint
164 # as a raw image.
166 # @mountpoint: Path on which to export the block device via FUSE. This
167 #     must point to an existing regular file.
169 # @growable: Whether writes beyond the EOF should grow the block node
170 #     accordingly.  (default: false)
172 # @allow-other: If this is off, only qemu's user is allowed access to
173 #     this export.  That cannot be changed even with chmod or chown.
174 #     Enabling this option will allow other users access to the export
175 #     with the FUSE mount option "allow_other". Note that using
176 #     allow_other as a non-root user requires user_allow_other to be
177 #     enabled in the global fuse.conf configuration file.  In auto
178 #     mode (the default), the FUSE export driver will first attempt to
179 #     mount the export with allow_other, and if that fails, try again
180 #     without.  (since 6.1; default: auto)
182 # Since: 6.0
184 { 'struct': 'BlockExportOptionsFuse',
185   'data': { 'mountpoint': 'str',
186             '*growable': 'bool',
187             '*allow-other': 'FuseExportAllowOther' },
188   'if': 'CONFIG_FUSE' }
191 # @BlockExportOptionsVduseBlk:
193 # A vduse-blk block export.
195 # @name: the name of VDUSE device (must be unique across the host).
197 # @num-queues: the number of virtqueues.  Defaults to 1.
199 # @queue-size: the size of virtqueue.  Defaults to 256.
201 # @logical-block-size: Logical block size in bytes.  Range [512,
202 #     PAGE_SIZE] and must be power of 2. Defaults to 512 bytes.
204 # @serial: the serial number of virtio block device.  Defaults to
205 #     empty string.
207 # Since: 7.1
209 { 'struct': 'BlockExportOptionsVduseBlk',
210   'data': { 'name': 'str',
211             '*num-queues': 'uint16',
212             '*queue-size': 'uint16',
213             '*logical-block-size': 'size',
214             '*serial': 'str' } }
217 # @NbdServerAddOptions:
219 # An NBD block export, per legacy nbd-server-add command.
221 # @device: The device name or node name of the node to be exported
223 # @writable: Whether clients should be able to write to the device via
224 #     the NBD connection (default false).
226 # @bitmap: Also export a single dirty bitmap reachable from @device,
227 #     so the NBD client can use NBD_OPT_SET_META_CONTEXT with the
228 #     metadata context name "qemu:dirty-bitmap:BITMAP" to inspect the
229 #     bitmap (since 4.0).
231 # Since: 5.0
233 { 'struct': 'NbdServerAddOptions',
234   'base': 'BlockExportOptionsNbdBase',
235   'data': { 'device': 'str',
236             '*writable': 'bool', '*bitmap': 'str' } }
239 # @nbd-server-add:
241 # Export a block node to QEMU's embedded NBD server.
243 # The export name will be used as the id for the resulting block
244 # export.
246 # Features:
248 # @deprecated: This command is deprecated.  Use @block-export-add
249 #     instead.
251 # Errors:
252 #     - if the server is not running
253 #     - if an export with the same name already exists
255 # Since: 1.3
257 { 'command': 'nbd-server-add',
258   'data': 'NbdServerAddOptions', 'boxed': true, 'features': ['deprecated'],
259   'allow-preconfig': true }
262 # @BlockExportRemoveMode:
264 # Mode for removing a block export.
266 # @safe: Remove export if there are no existing connections, fail
267 #     otherwise.
269 # @hard: Drop all connections immediately and remove export.
271 # TODO: Potential additional modes to be added in the future:
273 #     - hide: Just hide export from new clients, leave existing
274 #       connections as is.  Remove export after all clients are
275 #       disconnected.
277 #     - soft: Hide export from new clients, answer with ESHUTDOWN for
278 #       all further requests from existing clients.
280 # Since: 2.12
282 {'enum': 'BlockExportRemoveMode', 'data': ['safe', 'hard']}
285 # @nbd-server-remove:
287 # Remove NBD export by name.
289 # @name: Block export id.
291 # @mode: Mode of command operation.  See @BlockExportRemoveMode
292 #     description.  Default is 'safe'.
294 # Features:
296 # @deprecated: This command is deprecated.  Use @block-export-del
297 #     instead.
299 # Errors:
300 #     - if the server is not running
301 #     - if export is not found
302 #     - if mode is 'safe' and there are existing connections
304 # Since: 2.12
306 { 'command': 'nbd-server-remove',
307   'data': {'name': 'str', '*mode': 'BlockExportRemoveMode'},
308   'features': ['deprecated'],
309   'allow-preconfig': true }
312 # @nbd-server-stop:
314 # Stop QEMU's embedded NBD server, and unregister all devices
315 # previously added via @nbd-server-add.
317 # Since: 1.3
319 { 'command': 'nbd-server-stop',
320   'allow-preconfig': true }
323 # @BlockExportType:
325 # An enumeration of block export types
327 # @nbd: NBD export
329 # @vhost-user-blk: vhost-user-blk export (since 5.2)
331 # @fuse: FUSE export (since: 6.0)
333 # @vduse-blk: vduse-blk export (since 7.1)
335 # Since: 4.2
337 { 'enum': 'BlockExportType',
338   'data': [ 'nbd',
339             { 'name': 'vhost-user-blk',
340               'if': 'CONFIG_VHOST_USER_BLK_SERVER' },
341             { 'name': 'fuse', 'if': 'CONFIG_FUSE' },
342             { 'name': 'vduse-blk', 'if': 'CONFIG_VDUSE_BLK_EXPORT' } ] }
345 # @BlockExportOptions:
347 # Describes a block export, i.e. how single node should be exported on
348 # an external interface.
350 # @type: Block export type
352 # @id: A unique identifier for the block export (across all export
353 #     types)
355 # @node-name: The node name of the block node to be exported
356 #     (since: 5.2)
358 # @writable: True if clients should be able to write to the export
359 #     (default false)
361 # @writethrough: If true, caches are flushed after every write request
362 #     to the export before completion is signalled.  (since: 5.2;
363 #     default: false)
365 # @iothread: The name of the iothread object where the export will
366 #     run.  The default is to use the thread currently associated with
367 #     the block node.  (since: 5.2)
369 # @fixed-iothread: True prevents the block node from being moved to
370 #     another thread while the export is active.  If true and
371 #     @iothread is given, export creation fails if the block node
372 #     cannot be moved to the iothread.  The default is false.
373 #     (since: 5.2)
375 # Since: 4.2
377 { 'union': 'BlockExportOptions',
378   'base': { 'type': 'BlockExportType',
379             'id': 'str',
380             '*fixed-iothread': 'bool',
381             '*iothread': 'str',
382             'node-name': 'str',
383             '*writable': 'bool',
384             '*writethrough': 'bool' },
385   'discriminator': 'type',
386   'data': {
387       'nbd': 'BlockExportOptionsNbd',
388       'vhost-user-blk': { 'type': 'BlockExportOptionsVhostUserBlk',
389                           'if': 'CONFIG_VHOST_USER_BLK_SERVER' },
390       'fuse': { 'type': 'BlockExportOptionsFuse',
391                 'if': 'CONFIG_FUSE' },
392       'vduse-blk': { 'type': 'BlockExportOptionsVduseBlk',
393                      'if': 'CONFIG_VDUSE_BLK_EXPORT' }
394    } }
397 # @block-export-add:
399 # Creates a new block export.
401 # Since: 5.2
403 { 'command': 'block-export-add',
404   'data': 'BlockExportOptions', 'boxed': true,
405   'allow-preconfig': true }
408 # @block-export-del:
410 # Request to remove a block export.  This drops the user's reference
411 # to the export, but the export may still stay around after this
412 # command returns until the shutdown of the export has completed.
414 # @id: Block export id.
416 # @mode: Mode of command operation.  See @BlockExportRemoveMode
417 #     description.  Default is 'safe'.
419 # Errors:
420 #     - if the export is not found
421 #     - if @mode is 'safe' and the export is still in use (e.g. by
422 #       existing client connections)
424 # Since: 5.2
426 { 'command': 'block-export-del',
427   'data': { 'id': 'str', '*mode': 'BlockExportRemoveMode' },
428   'allow-preconfig': true }
431 # @BLOCK_EXPORT_DELETED:
433 # Emitted when a block export is removed and its id can be reused.
435 # @id: Block export id.
437 # Since: 5.2
439 { 'event': 'BLOCK_EXPORT_DELETED',
440   'data': { 'id': 'str' } }
443 # @BlockExportInfo:
445 # Information about a single block export.
447 # @id: The unique identifier for the block export
449 # @type: The block export type
451 # @node-name: The node name of the block node that is exported
453 # @shutting-down: True if the export is shutting down (e.g. after a
454 #     block-export-del command, but before the shutdown has completed)
456 # Since: 5.2
458 { 'struct': 'BlockExportInfo',
459   'data': { 'id': 'str',
460             'type': 'BlockExportType',
461             'node-name': 'str',
462             'shutting-down': 'bool' } }
465 # @query-block-exports:
467 # Returns: A list of BlockExportInfo describing all block exports
469 # Since: 5.2
471 { 'command': 'query-block-exports', 'returns': ['BlockExportInfo'],
472   'allow-preconfig': true }