tests: acpi: add pvpanic-isa: testcase
[qemu.git] / qapi / block-export.json
blob0685cb8b9ac2513aa1c6345a606f69735222369f
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 only
15 # intended difference is using SocketAddress instead of SocketAddressLegacy.
17 # @addr: Address on which to listen.
18 # @tls-creds: ID of the TLS credentials object (since 2.6).
19 # @tls-authz: ID of the QAuthZ authorization object used to validate
20 #             the client's x509 distinguished name. This object is
21 #             is only resolved at time of use, so can be deleted and
22 #             recreated on the fly while the NBD server is active.
23 #             If missing, it will default to denying access (since 4.0).
24 # @max-connections: The maximum number of connections to allow at the same
25 #                   time, 0 for unlimited. Setting this to 1 also stops
26 #                   the server from advertising multiple client support
27 #                   (since 5.2; default: 0)
29 # Since: 4.2
31 { 'struct': 'NbdServerOptions',
32   'data': { 'addr': 'SocketAddress',
33             '*tls-creds': 'str',
34             '*tls-authz': 'str',
35             '*max-connections': 'uint32' } }
38 # @nbd-server-start:
40 # Start an NBD server listening on the given host and port.  Block
41 # devices can then be exported using @nbd-server-add.  The NBD
42 # server will present them as named exports; for example, another
43 # QEMU instance could refer to them as "nbd:HOST:PORT:exportname=NAME".
45 # Keep this type consistent with the NbdServerOptions type. The only intended
46 # difference is using SocketAddressLegacy instead of SocketAddress.
48 # @addr: Address on which to listen.
49 # @tls-creds: ID of the TLS credentials object (since 2.6).
50 # @tls-authz: ID of the QAuthZ authorization object used to validate
51 #             the client's x509 distinguished name. This object is
52 #             is only resolved at time of use, so can be deleted and
53 #             recreated on the fly while the NBD server is active.
54 #             If missing, it will default to denying access (since 4.0).
55 # @max-connections: The maximum number of connections to allow at the same
56 #                   time, 0 for unlimited. Setting this to 1 also stops
57 #                   the server from advertising multiple client support
58 #                   (since 5.2; default: 0).
60 # Returns: error if the server is already running.
62 # Since: 1.3
64 { 'command': 'nbd-server-start',
65   'data': { 'addr': 'SocketAddressLegacy',
66             '*tls-creds': 'str',
67             '*tls-authz': 'str',
68             '*max-connections': 'uint32' } }
71 # @BlockExportOptionsNbdBase:
73 # An NBD block export (common options shared between nbd-server-add and
74 # the NBD branch of block-export-add).
76 # @name: Export name. If unspecified, the @device parameter is used as the
77 #        export name. (Since 2.12)
79 # @description: Free-form description of the export, up to 4096 bytes.
80 #               (Since 5.0)
82 # Since: 5.0
84 { 'struct': 'BlockExportOptionsNbdBase',
85   'data': { '*name': 'str', '*description': 'str' } }
88 # @BlockExportOptionsNbd:
90 # An NBD block export (distinct options used in the NBD branch of
91 # block-export-add).
93 # @bitmaps: Also export each of the named dirty bitmaps reachable from
94 #           @device, so the NBD client can use NBD_OPT_SET_META_CONTEXT with
95 #           the metadata context name "qemu:dirty-bitmap:BITMAP" to inspect
96 #           each bitmap.
97 #           Since 7.1 bitmap may be specified by node/name pair.
99 # @allocation-depth: Also export the allocation depth map for @device, so
100 #                    the NBD client can use NBD_OPT_SET_META_CONTEXT with
101 #                    the metadata context name "qemu:allocation-depth" to
102 #                    inspect allocation details. (since 5.2)
104 # Since: 5.2
106 { 'struct': 'BlockExportOptionsNbd',
107   'base': 'BlockExportOptionsNbdBase',
108   'data': { '*bitmaps': ['BlockDirtyBitmapOrStr'],
109             '*allocation-depth': 'bool' } }
112 # @BlockExportOptionsVhostUserBlk:
114 # A vhost-user-blk block export.
116 # @addr: The vhost-user socket on which to listen. Both 'unix' and 'fd'
117 #        SocketAddress types are supported. Passed fds must be UNIX domain
118 #        sockets.
119 # @logical-block-size: Logical block size in bytes. Defaults to 512 bytes.
120 # @num-queues: Number of request virtqueues. Must be greater than 0. Defaults
121 #              to 1.
123 # Since: 5.2
125 { 'struct': 'BlockExportOptionsVhostUserBlk',
126   'data': { 'addr': 'SocketAddress',
127             '*logical-block-size': 'size',
128             '*num-queues': 'uint16'} }
131 # @FuseExportAllowOther:
133 # Possible allow_other modes for FUSE exports.
135 # @off: Do not pass allow_other as a mount option.
137 # @on: Pass allow_other as a mount option.
139 # @auto: Try mounting with allow_other first, and if that fails, retry
140 #        without allow_other.
142 # Since: 6.1
144 { 'enum': 'FuseExportAllowOther',
145   'data': ['off', 'on', 'auto'] }
148 # @BlockExportOptionsFuse:
150 # Options for exporting a block graph node on some (file) mountpoint
151 # as a raw image.
153 # @mountpoint: Path on which to export the block device via FUSE.
154 #              This must point to an existing regular file.
156 # @growable: Whether writes beyond the EOF should grow the block node
157 #            accordingly. (default: false)
159 # @allow-other: If this is off, only qemu's user is allowed access to
160 #               this export.  That cannot be changed even with chmod or
161 #               chown.
162 #               Enabling this option will allow other users access to
163 #               the export with the FUSE mount option "allow_other".
164 #               Note that using allow_other as a non-root user requires
165 #               user_allow_other to be enabled in the global fuse.conf
166 #               configuration file.
167 #               In auto mode (the default), the FUSE export driver will
168 #               first attempt to mount the export with allow_other, and
169 #               if that fails, try again without.
170 #               (since 6.1; default: auto)
172 # Since: 6.0
174 { 'struct': 'BlockExportOptionsFuse',
175   'data': { 'mountpoint': 'str',
176             '*growable': 'bool',
177             '*allow-other': 'FuseExportAllowOther' },
178   'if': 'CONFIG_FUSE' }
181 # @NbdServerAddOptions:
183 # An NBD block export, per legacy nbd-server-add command.
185 # @device: The device name or node name of the node to be exported
187 # @writable: Whether clients should be able to write to the device via the
188 #            NBD connection (default false).
190 # @bitmap: Also export a single dirty bitmap reachable from @device, so the
191 #          NBD client can use NBD_OPT_SET_META_CONTEXT with the metadata
192 #          context name "qemu:dirty-bitmap:BITMAP" to inspect the bitmap
193 #          (since 4.0).
195 # Since: 5.0
197 { 'struct': 'NbdServerAddOptions',
198   'base': 'BlockExportOptionsNbdBase',
199   'data': { 'device': 'str',
200             '*writable': 'bool', '*bitmap': 'str' } }
203 # @nbd-server-add:
205 # Export a block node to QEMU's embedded NBD server.
207 # The export name will be used as the id for the resulting block export.
209 # Features:
210 # @deprecated: This command is deprecated. Use @block-export-add instead.
212 # Returns: error if the server is not running, or export with the same name
213 #          already exists.
215 # Since: 1.3
217 { 'command': 'nbd-server-add',
218   'data': 'NbdServerAddOptions', 'boxed': true, 'features': ['deprecated'] }
221 # @BlockExportRemoveMode:
223 # Mode for removing a block export.
225 # @safe: Remove export if there are no existing connections, fail otherwise.
227 # @hard: Drop all connections immediately and remove export.
229 # TODO: Potential additional modes to be added in the future:
231 #       hide: Just hide export from new clients, leave existing connections as is.
232 #       Remove export after all clients are disconnected.
234 #       soft: Hide export from new clients, answer with ESHUTDOWN for all further
235 #       requests from existing clients.
237 # Since: 2.12
239 {'enum': 'BlockExportRemoveMode', 'data': ['safe', 'hard']}
242 # @nbd-server-remove:
244 # Remove NBD export by name.
246 # @name: Block export id.
248 # @mode: Mode of command operation. See @BlockExportRemoveMode description.
249 #        Default is 'safe'.
251 # Features:
252 # @deprecated: This command is deprecated. Use @block-export-del instead.
254 # Returns: error if
255 #            - the server is not running
256 #            - export is not found
257 #            - mode is 'safe' and there are existing connections
259 # Since: 2.12
261 { 'command': 'nbd-server-remove',
262   'data': {'name': 'str', '*mode': 'BlockExportRemoveMode'},
263   'features': ['deprecated'] }
266 # @nbd-server-stop:
268 # Stop QEMU's embedded NBD server, and unregister all devices previously
269 # added via @nbd-server-add.
271 # Since: 1.3
273 { 'command': 'nbd-server-stop' }
276 # @BlockExportType:
278 # An enumeration of block export types
280 # @nbd: NBD export
281 # @vhost-user-blk: vhost-user-blk export (since 5.2)
282 # @fuse: FUSE export (since: 6.0)
284 # Since: 4.2
286 { 'enum': 'BlockExportType',
287   'data': [ 'nbd',
288             { 'name': 'vhost-user-blk',
289               'if': 'CONFIG_VHOST_USER_BLK_SERVER' },
290             { 'name': 'fuse', 'if': 'CONFIG_FUSE' } ] }
293 # @BlockExportOptions:
295 # Describes a block export, i.e. how single node should be exported on an
296 # external interface.
298 # @id: A unique identifier for the block export (across all export types)
300 # @node-name: The node name of the block node to be exported (since: 5.2)
302 # @writable: True if clients should be able to write to the export
303 #            (default false)
305 # @writethrough: If true, caches are flushed after every write request to the
306 #                export before completion is signalled. (since: 5.2;
307 #                default: false)
309 # @iothread: The name of the iothread object where the export will run. The
310 #            default is to use the thread currently associated with the
311 #            block node. (since: 5.2)
313 # @fixed-iothread: True prevents the block node from being moved to another
314 #                  thread while the export is active. If true and @iothread is
315 #                  given, export creation fails if the block node cannot be
316 #                  moved to the iothread. The default is false. (since: 5.2)
318 # Since: 4.2
320 { 'union': 'BlockExportOptions',
321   'base': { 'type': 'BlockExportType',
322             'id': 'str',
323             '*fixed-iothread': 'bool',
324             '*iothread': 'str',
325             'node-name': 'str',
326             '*writable': 'bool',
327             '*writethrough': 'bool' },
328   'discriminator': 'type',
329   'data': {
330       'nbd': 'BlockExportOptionsNbd',
331       'vhost-user-blk': { 'type': 'BlockExportOptionsVhostUserBlk',
332                           'if': 'CONFIG_VHOST_USER_BLK_SERVER' },
333       'fuse': { 'type': 'BlockExportOptionsFuse',
334                 'if': 'CONFIG_FUSE' }
335    } }
338 # @block-export-add:
340 # Creates a new block export.
342 # Since: 5.2
344 { 'command': 'block-export-add',
345   'data': 'BlockExportOptions', 'boxed': true }
348 # @block-export-del:
350 # Request to remove a block export. This drops the user's reference to the
351 # export, but the export may still stay around after this command returns until
352 # the shutdown of the export has completed.
354 # @id: Block export id.
356 # @mode: Mode of command operation. See @BlockExportRemoveMode description.
357 #        Default is 'safe'.
359 # Returns: Error if the export is not found or @mode is 'safe' and the export
360 #          is still in use (e.g. by existing client connections)
362 # Since: 5.2
364 { 'command': 'block-export-del',
365   'data': { 'id': 'str', '*mode': 'BlockExportRemoveMode' } }
368 # @BLOCK_EXPORT_DELETED:
370 # Emitted when a block export is removed and its id can be reused.
372 # @id: Block export id.
374 # Since: 5.2
376 { 'event': 'BLOCK_EXPORT_DELETED',
377   'data': { 'id': 'str' } }
380 # @BlockExportInfo:
382 # Information about a single block export.
384 # @id: The unique identifier for the block export
386 # @type: The block export type
388 # @node-name: The node name of the block node that is exported
390 # @shutting-down: True if the export is shutting down (e.g. after a
391 #                 block-export-del command, but before the shutdown has
392 #                 completed)
394 # Since: 5.2
396 { 'struct': 'BlockExportInfo',
397   'data': { 'id': 'str',
398             'type': 'BlockExportType',
399             'node-name': 'str',
400             'shutting-down': 'bool' } }
403 # @query-block-exports:
405 # Returns: A list of BlockExportInfo describing all block exports
407 # Since: 5.2
409 { 'command': 'query-block-exports', 'returns': ['BlockExportInfo'] }