hw/gpio/omap_gpio: Use CamelCase for TYPE_OMAP1_GPIO type name
[qemu.git] / qapi / block-export.json
blob4627bbc4e603853fe753c09a8125998081f79515
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' },
69   'allow-preconfig': true }
72 # @BlockExportOptionsNbdBase:
74 # An NBD block export (common options shared between nbd-server-add and
75 # the NBD branch of block-export-add).
77 # @name: Export name. If unspecified, the @device parameter is used as the
78 #        export name. (Since 2.12)
80 # @description: Free-form description of the export, up to 4096 bytes.
81 #               (Since 5.0)
83 # Since: 5.0
85 { 'struct': 'BlockExportOptionsNbdBase',
86   'data': { '*name': 'str', '*description': 'str' } }
89 # @BlockExportOptionsNbd:
91 # An NBD block export (distinct options used in the NBD branch of
92 # block-export-add).
94 # @bitmaps: Also export each of the named dirty bitmaps reachable from
95 #           @device, so the NBD client can use NBD_OPT_SET_META_CONTEXT with
96 #           the metadata context name "qemu:dirty-bitmap:BITMAP" to inspect
97 #           each bitmap.
98 #           Since 7.1 bitmap may be specified by node/name pair.
100 # @allocation-depth: Also export the allocation depth map for @device, so
101 #                    the NBD client can use NBD_OPT_SET_META_CONTEXT with
102 #                    the metadata context name "qemu:allocation-depth" to
103 #                    inspect allocation details. (since 5.2)
105 # Since: 5.2
107 { 'struct': 'BlockExportOptionsNbd',
108   'base': 'BlockExportOptionsNbdBase',
109   'data': { '*bitmaps': ['BlockDirtyBitmapOrStr'],
110             '*allocation-depth': 'bool' } }
113 # @BlockExportOptionsVhostUserBlk:
115 # A vhost-user-blk block export.
117 # @addr: The vhost-user socket on which to listen. Both 'unix' and 'fd'
118 #        SocketAddress types are supported. Passed fds must be UNIX domain
119 #        sockets.
120 # @logical-block-size: Logical block size in bytes. Defaults to 512 bytes.
121 # @num-queues: Number of request virtqueues. Must be greater than 0. Defaults
122 #              to 1.
124 # Since: 5.2
126 { 'struct': 'BlockExportOptionsVhostUserBlk',
127   'data': { 'addr': 'SocketAddress',
128             '*logical-block-size': 'size',
129             '*num-queues': 'uint16'} }
132 # @FuseExportAllowOther:
134 # Possible allow_other modes for FUSE exports.
136 # @off: Do not pass allow_other as a mount option.
138 # @on: Pass allow_other as a mount option.
140 # @auto: Try mounting with allow_other first, and if that fails, retry
141 #        without allow_other.
143 # Since: 6.1
145 { 'enum': 'FuseExportAllowOther',
146   'data': ['off', 'on', 'auto'] }
149 # @BlockExportOptionsFuse:
151 # Options for exporting a block graph node on some (file) mountpoint
152 # as a raw image.
154 # @mountpoint: Path on which to export the block device via FUSE.
155 #              This must point to an existing regular file.
157 # @growable: Whether writes beyond the EOF should grow the block node
158 #            accordingly. (default: false)
160 # @allow-other: If this is off, only qemu's user is allowed access to
161 #               this export.  That cannot be changed even with chmod or
162 #               chown.
163 #               Enabling this option will allow other users access to
164 #               the export with the FUSE mount option "allow_other".
165 #               Note that using allow_other as a non-root user requires
166 #               user_allow_other to be enabled in the global fuse.conf
167 #               configuration file.
168 #               In auto mode (the default), the FUSE export driver will
169 #               first attempt to mount the export with allow_other, and
170 #               if that fails, try again without.
171 #               (since 6.1; default: auto)
173 # Since: 6.0
175 { 'struct': 'BlockExportOptionsFuse',
176   'data': { 'mountpoint': 'str',
177             '*growable': 'bool',
178             '*allow-other': 'FuseExportAllowOther' },
179   'if': 'CONFIG_FUSE' }
182 # @BlockExportOptionsVduseBlk:
184 # A vduse-blk block export.
186 # @name: the name of VDUSE device (must be unique across the host).
187 # @num-queues: the number of virtqueues. Defaults to 1.
188 # @queue-size: the size of virtqueue. Defaults to 256.
189 # @logical-block-size: Logical block size in bytes. Range [512, PAGE_SIZE]
190 #                      and must be power of 2. Defaults to 512 bytes.
191 # @serial: the serial number of virtio block device. Defaults to empty string.
193 # Since: 7.1
195 { 'struct': 'BlockExportOptionsVduseBlk',
196   'data': { 'name': 'str',
197             '*num-queues': 'uint16',
198             '*queue-size': 'uint16',
199             '*logical-block-size': 'size',
200             '*serial': 'str' } }
203 # @NbdServerAddOptions:
205 # An NBD block export, per legacy nbd-server-add command.
207 # @device: The device name or node name of the node to be exported
209 # @writable: Whether clients should be able to write to the device via the
210 #            NBD connection (default false).
212 # @bitmap: Also export a single dirty bitmap reachable from @device, so the
213 #          NBD client can use NBD_OPT_SET_META_CONTEXT with the metadata
214 #          context name "qemu:dirty-bitmap:BITMAP" to inspect the bitmap
215 #          (since 4.0).
217 # Since: 5.0
219 { 'struct': 'NbdServerAddOptions',
220   'base': 'BlockExportOptionsNbdBase',
221   'data': { 'device': 'str',
222             '*writable': 'bool', '*bitmap': 'str' } }
225 # @nbd-server-add:
227 # Export a block node to QEMU's embedded NBD server.
229 # The export name will be used as the id for the resulting block export.
231 # Features:
232 # @deprecated: This command is deprecated. Use @block-export-add instead.
234 # Returns: error if the server is not running, or export with the same name
235 #          already exists.
237 # Since: 1.3
239 { 'command': 'nbd-server-add',
240   'data': 'NbdServerAddOptions', 'boxed': true, 'features': ['deprecated'],
241   'allow-preconfig': true }
244 # @BlockExportRemoveMode:
246 # Mode for removing a block export.
248 # @safe: Remove export if there are no existing connections, fail otherwise.
250 # @hard: Drop all connections immediately and remove export.
252 # TODO: Potential additional modes to be added in the future:
254 #       hide: Just hide export from new clients, leave existing connections as is.
255 #       Remove export after all clients are disconnected.
257 #       soft: Hide export from new clients, answer with ESHUTDOWN for all further
258 #       requests from existing clients.
260 # Since: 2.12
262 {'enum': 'BlockExportRemoveMode', 'data': ['safe', 'hard']}
265 # @nbd-server-remove:
267 # Remove NBD export by name.
269 # @name: Block export id.
271 # @mode: Mode of command operation. See @BlockExportRemoveMode description.
272 #        Default is 'safe'.
274 # Features:
275 # @deprecated: This command is deprecated. Use @block-export-del instead.
277 # Returns: error if
278 #            - the server is not running
279 #            - export is not found
280 #            - mode is 'safe' and there are existing connections
282 # Since: 2.12
284 { 'command': 'nbd-server-remove',
285   'data': {'name': 'str', '*mode': 'BlockExportRemoveMode'},
286   'features': ['deprecated'],
287   'allow-preconfig': true }
290 # @nbd-server-stop:
292 # Stop QEMU's embedded NBD server, and unregister all devices previously
293 # added via @nbd-server-add.
295 # Since: 1.3
297 { 'command': 'nbd-server-stop',
298   'allow-preconfig': true }
301 # @BlockExportType:
303 # An enumeration of block export types
305 # @nbd: NBD export
306 # @vhost-user-blk: vhost-user-blk export (since 5.2)
307 # @fuse: FUSE export (since: 6.0)
308 # @vduse-blk: vduse-blk export (since 7.1)
310 # Since: 4.2
312 { 'enum': 'BlockExportType',
313   'data': [ 'nbd',
314             { 'name': 'vhost-user-blk',
315               'if': 'CONFIG_VHOST_USER_BLK_SERVER' },
316             { 'name': 'fuse', 'if': 'CONFIG_FUSE' },
317             { 'name': 'vduse-blk', 'if': 'CONFIG_VDUSE_BLK_EXPORT' } ] }
320 # @BlockExportOptions:
322 # Describes a block export, i.e. how single node should be exported on an
323 # external interface.
325 # @id: A unique identifier for the block export (across all export types)
327 # @node-name: The node name of the block node to be exported (since: 5.2)
329 # @writable: True if clients should be able to write to the export
330 #            (default false)
332 # @writethrough: If true, caches are flushed after every write request to the
333 #                export before completion is signalled. (since: 5.2;
334 #                default: false)
336 # @iothread: The name of the iothread object where the export will run. The
337 #            default is to use the thread currently associated with the
338 #            block node. (since: 5.2)
340 # @fixed-iothread: True prevents the block node from being moved to another
341 #                  thread while the export is active. If true and @iothread is
342 #                  given, export creation fails if the block node cannot be
343 #                  moved to the iothread. The default is false. (since: 5.2)
345 # Since: 4.2
347 { 'union': 'BlockExportOptions',
348   'base': { 'type': 'BlockExportType',
349             'id': 'str',
350             '*fixed-iothread': 'bool',
351             '*iothread': 'str',
352             'node-name': 'str',
353             '*writable': 'bool',
354             '*writethrough': 'bool' },
355   'discriminator': 'type',
356   'data': {
357       'nbd': 'BlockExportOptionsNbd',
358       'vhost-user-blk': { 'type': 'BlockExportOptionsVhostUserBlk',
359                           'if': 'CONFIG_VHOST_USER_BLK_SERVER' },
360       'fuse': { 'type': 'BlockExportOptionsFuse',
361                 'if': 'CONFIG_FUSE' },
362       'vduse-blk': { 'type': 'BlockExportOptionsVduseBlk',
363                      'if': 'CONFIG_VDUSE_BLK_EXPORT' }
364    } }
367 # @block-export-add:
369 # Creates a new block export.
371 # Since: 5.2
373 { 'command': 'block-export-add',
374   'data': 'BlockExportOptions', 'boxed': true,
375   'allow-preconfig': true }
378 # @block-export-del:
380 # Request to remove a block export. This drops the user's reference to the
381 # export, but the export may still stay around after this command returns until
382 # the shutdown of the export has completed.
384 # @id: Block export id.
386 # @mode: Mode of command operation. See @BlockExportRemoveMode description.
387 #        Default is 'safe'.
389 # Returns: Error if the export is not found or @mode is 'safe' and the export
390 #          is still in use (e.g. by existing client connections)
392 # Since: 5.2
394 { 'command': 'block-export-del',
395   'data': { 'id': 'str', '*mode': 'BlockExportRemoveMode' },
396   'allow-preconfig': true }
399 # @BLOCK_EXPORT_DELETED:
401 # Emitted when a block export is removed and its id can be reused.
403 # @id: Block export id.
405 # Since: 5.2
407 { 'event': 'BLOCK_EXPORT_DELETED',
408   'data': { 'id': 'str' } }
411 # @BlockExportInfo:
413 # Information about a single block export.
415 # @id: The unique identifier for the block export
417 # @type: The block export type
419 # @node-name: The node name of the block node that is exported
421 # @shutting-down: True if the export is shutting down (e.g. after a
422 #                 block-export-del command, but before the shutdown has
423 #                 completed)
425 # Since: 5.2
427 { 'struct': 'BlockExportInfo',
428   'data': { 'id': 'str',
429             'type': 'BlockExportType',
430             'node-name': 'str',
431             'shutting-down': 'bool' } }
434 # @query-block-exports:
436 # Returns: A list of BlockExportInfo describing all block exports
438 # Since: 5.2
440 { 'command': 'query-block-exports', 'returns': ['BlockExportInfo'],
441   'allow-preconfig': true }