docs: rstfy vfio-ap documentation
[qemu/ar7.git] / qapi / block.json
blobda19834db415758477d5ac7b07d429d194d148a6
1 # -*- Mode: Python -*-
3 ##
4 # = Block devices
5 ##
7 { 'include': 'block-core.json' }
9 ##
10 # == Additional block stuff (VM related)
14 # @BiosAtaTranslation:
16 # Policy that BIOS should use to interpret cylinder/head/sector
17 # addresses.  Note that Bochs BIOS and SeaBIOS will not actually
18 # translate logical CHS to physical; instead, they will use logical
19 # block addressing.
21 # @auto: If cylinder/heads/sizes are passed, choose between none and LBA
22 #        depending on the size of the disk.  If they are not passed,
23 #        choose none if QEMU can guess that the disk had 16 or fewer
24 #        heads, large if QEMU can guess that the disk had 131072 or
25 #        fewer tracks across all heads (i.e. cylinders*heads<131072),
26 #        otherwise LBA.
28 # @none: The physical disk geometry is equal to the logical geometry.
30 # @lba: Assume 63 sectors per track and one of 16, 32, 64, 128 or 255
31 #       heads (if fewer than 255 are enough to cover the whole disk
32 #       with 1024 cylinders/head).  The number of cylinders/head is
33 #       then computed based on the number of sectors and heads.
35 # @large: The number of cylinders per head is scaled down to 1024
36 #         by correspondingly scaling up the number of heads.
38 # @rechs: Same as @large, but first convert a 16-head geometry to
39 #         15-head, by proportionally scaling up the number of
40 #         cylinders/head.
42 # Since: 2.0
44 { 'enum': 'BiosAtaTranslation',
45   'data': ['auto', 'none', 'lba', 'large', 'rechs']}
48 # @FloppyDriveType:
50 # Type of Floppy drive to be emulated by the Floppy Disk Controller.
52 # @144:  1.44MB 3.5" drive
53 # @288:  2.88MB 3.5" drive
54 # @120:  1.2MB 5.25" drive
55 # @none: No drive connected
56 # @auto: Automatically determined by inserted media at boot
58 # Since: 2.6
60 { 'enum': 'FloppyDriveType',
61   'data': ['144', '288', '120', 'none', 'auto']}
64 # @BlockdevSnapshotInternal:
66 # @device: the device name or node-name of a root node to generate the snapshot
67 #          from
69 # @name: the name of the internal snapshot to be created
71 # Notes: In transaction, if @name is empty, or any snapshot matching @name
72 #        exists, the operation will fail. Only some image formats support it,
73 #        for example, qcow2, rbd, and sheepdog.
75 # Since: 1.7
77 { 'struct': 'BlockdevSnapshotInternal',
78   'data': { 'device': 'str', 'name': 'str' } }
81 # @PRManagerInfo:
83 # Information about a persistent reservation manager
85 # @id: the identifier of the persistent reservation manager
87 # @connected: true if the persistent reservation manager is connected to
88 #             the underlying storage or helper
90 # Since: 3.0
92 { 'struct': 'PRManagerInfo',
93   'data': {'id': 'str', 'connected': 'bool'} }
96 # @query-pr-managers:
98 # Returns a list of information about each persistent reservation manager.
100 # Returns: a list of @PRManagerInfo for each persistent reservation manager
102 # Since: 3.0
104 { 'command': 'query-pr-managers', 'returns': ['PRManagerInfo'],
105   'allow-preconfig': true }
109 # @blockdev-snapshot-internal-sync:
111 # Synchronously take an internal snapshot of a block device, when the
112 # format of the image used supports it. If the name is an empty
113 # string, or a snapshot with name already exists, the operation will
114 # fail.
116 # For the arguments, see the documentation of BlockdevSnapshotInternal.
118 # Returns: - nothing on success
119 #          - If @device is not a valid block device, GenericError
120 #          - If any snapshot matching @name exists, or @name is empty,
121 #            GenericError
122 #          - If the format of the image used does not support it,
123 #            BlockFormatFeatureNotSupported
125 # Since: 1.7
127 # Example:
129 # -> { "execute": "blockdev-snapshot-internal-sync",
130 #      "arguments": { "device": "ide-hd0",
131 #                     "name": "snapshot0" }
132 #    }
133 # <- { "return": {} }
136 { 'command': 'blockdev-snapshot-internal-sync',
137   'data': 'BlockdevSnapshotInternal' }
140 # @blockdev-snapshot-delete-internal-sync:
142 # Synchronously delete an internal snapshot of a block device, when the format
143 # of the image used support it. The snapshot is identified by name or id or
144 # both. One of the name or id is required. Return SnapshotInfo for the
145 # successfully deleted snapshot.
147 # @device: the device name or node-name of a root node to delete the snapshot
148 #          from
150 # @id: optional the snapshot's ID to be deleted
152 # @name: optional the snapshot's name to be deleted
154 # Returns: - SnapshotInfo on success
155 #          - If @device is not a valid block device, GenericError
156 #          - If snapshot not found, GenericError
157 #          - If the format of the image used does not support it,
158 #            BlockFormatFeatureNotSupported
159 #          - If @id and @name are both not specified, GenericError
161 # Since: 1.7
163 # Example:
165 # -> { "execute": "blockdev-snapshot-delete-internal-sync",
166 #      "arguments": { "device": "ide-hd0",
167 #                     "name": "snapshot0" }
168 #    }
169 # <- { "return": {
170 #                    "id": "1",
171 #                    "name": "snapshot0",
172 #                    "vm-state-size": 0,
173 #                    "date-sec": 1000012,
174 #                    "date-nsec": 10,
175 #                    "vm-clock-sec": 100,
176 #                    "vm-clock-nsec": 20
177 #      }
178 #    }
181 { 'command': 'blockdev-snapshot-delete-internal-sync',
182   'data': { 'device': 'str', '*id': 'str', '*name': 'str'},
183   'returns': 'SnapshotInfo' }
186 # @eject:
188 # Ejects a device from a removable drive.
190 # @device: Block device name (deprecated, use @id instead)
192 # @id: The name or QOM path of the guest device (since: 2.8)
194 # @force: If true, eject regardless of whether the drive is locked.
195 #         If not specified, the default value is false.
197 # Returns: - Nothing on success
198 #          - If @device is not a valid block device, DeviceNotFound
199 # Notes:    Ejecting a device with no media results in success
201 # Since: 0.14.0
203 # Example:
205 # -> { "execute": "eject", "arguments": { "id": "ide1-0-1" } }
206 # <- { "return": {} }
208 { 'command': 'eject',
209   'data': { '*device': 'str',
210             '*id': 'str',
211             '*force': 'bool' } }
214 # @nbd-server-start:
216 # Start an NBD server listening on the given host and port.  Block
217 # devices can then be exported using @nbd-server-add.  The NBD
218 # server will present them as named exports; for example, another
219 # QEMU instance could refer to them as "nbd:HOST:PORT:exportname=NAME".
221 # @addr: Address on which to listen.
222 # @tls-creds: ID of the TLS credentials object (since 2.6).
223 # @tls-authz: ID of the QAuthZ authorization object used to validate
224 #             the client's x509 distinguished name. This object is
225 #             is only resolved at time of use, so can be deleted and
226 #             recreated on the fly while the NBD server is active.
227 #             If missing, it will default to denying access (since 4.0).
229 # Returns: error if the server is already running.
231 # Since: 1.3.0
233 { 'command': 'nbd-server-start',
234   'data': { 'addr': 'SocketAddressLegacy',
235             '*tls-creds': 'str',
236             '*tls-authz': 'str'} }
239 # @nbd-server-add:
241 # Export a block node to QEMU's embedded NBD server.
243 # @device: The device name or node name of the node to be exported
245 # @name: Export name. If unspecified, the @device parameter is used as the
246 #        export name. (Since 2.12)
248 # @description: Free-form description of the export, up to 4096 bytes.
249 #               (Since 5.0)
251 # @writable: Whether clients should be able to write to the device via the
252 #            NBD connection (default false).
254 # @bitmap: Also export the dirty bitmap reachable from @device, so the
255 #          NBD client can use NBD_OPT_SET_META_CONTEXT with
256 #          "qemu:dirty-bitmap:NAME" to inspect the bitmap. (since 4.0)
258 # Returns: error if the server is not running, or export with the same name
259 #          already exists.
261 # Since: 1.3.0
263 { 'command': 'nbd-server-add',
264   'data': {'device': 'str', '*name': 'str', '*description': 'str',
265            '*writable': 'bool', '*bitmap': 'str' } }
268 # @NbdServerRemoveMode:
270 # Mode for removing an NBD export.
272 # @safe: Remove export if there are no existing connections, fail otherwise.
274 # @hard: Drop all connections immediately and remove export.
276 # Potential additional modes to be added in the future:
278 # hide: Just hide export from new clients, leave existing connections as is.
279 # Remove export after all clients are disconnected.
281 # soft: Hide export from new clients, answer with ESHUTDOWN for all further
282 # requests from existing clients.
284 # Since: 2.12
286 {'enum': 'NbdServerRemoveMode', 'data': ['safe', 'hard']}
289 # @nbd-server-remove:
291 # Remove NBD export by name.
293 # @name: Export name.
295 # @mode: Mode of command operation. See @NbdServerRemoveMode description.
296 #        Default is 'safe'.
298 # Returns: error if
299 #            - the server is not running
300 #            - export is not found
301 #            - mode is 'safe' and there are existing connections
303 # Since: 2.12
305 { 'command': 'nbd-server-remove',
306   'data': {'name': 'str', '*mode': 'NbdServerRemoveMode'} }
309 # @nbd-server-stop:
311 # Stop QEMU's embedded NBD server, and unregister all devices previously
312 # added via @nbd-server-add.
314 # Since: 1.3.0
316 { 'command': 'nbd-server-stop' }
319 # @DEVICE_TRAY_MOVED:
321 # Emitted whenever the tray of a removable device is moved by the guest or by
322 # HMP/QMP commands
324 # @device: Block device name. This is always present for compatibility
325 #          reasons, but it can be empty ("") if the image does not
326 #          have a device name associated.
328 # @id: The name or QOM path of the guest device (since 2.8)
330 # @tray-open: true if the tray has been opened or false if it has been closed
332 # Since: 1.1
334 # Example:
336 # <- { "event": "DEVICE_TRAY_MOVED",
337 #      "data": { "device": "ide1-cd0",
338 #                "id": "/machine/unattached/device[22]",
339 #                "tray-open": true
340 #      },
341 #      "timestamp": { "seconds": 1265044230, "microseconds": 450486 } }
344 { 'event': 'DEVICE_TRAY_MOVED',
345   'data': { 'device': 'str', 'id': 'str', 'tray-open': 'bool' } }
348 # @PR_MANAGER_STATUS_CHANGED:
350 # Emitted whenever the connected status of a persistent reservation
351 # manager changes.
353 # @id: The id of the PR manager object
355 # @connected: true if the PR manager is connected to a backend
357 # Since: 3.0
359 # Example:
361 # <- { "event": "PR_MANAGER_STATUS_CHANGED",
362 #      "data": { "id": "pr-helper0",
363 #                "connected": true
364 #      },
365 #      "timestamp": { "seconds": 1519840375, "microseconds": 450486 } }
368 { 'event': 'PR_MANAGER_STATUS_CHANGED',
369   'data': { 'id': 'str', 'connected': 'bool' } }
372 # @QuorumOpType:
374 # An enumeration of the quorum operation types
376 # @read: read operation
378 # @write: write operation
380 # @flush: flush operation
382 # Since: 2.6
384 { 'enum': 'QuorumOpType',
385   'data': [ 'read', 'write', 'flush' ] }
388 # @QUORUM_FAILURE:
390 # Emitted by the Quorum block driver if it fails to establish a quorum
392 # @reference: device name if defined else node name
394 # @sector-num: number of the first sector of the failed read operation
396 # @sectors-count: failed read operation sector count
398 # Note: This event is rate-limited.
400 # Since: 2.0
402 # Example:
404 # <- { "event": "QUORUM_FAILURE",
405 #      "data": { "reference": "usr1", "sector-num": 345435, "sectors-count": 5 },
406 #      "timestamp": { "seconds": 1344522075, "microseconds": 745528 } }
409 { 'event': 'QUORUM_FAILURE',
410   'data': { 'reference': 'str', 'sector-num': 'int', 'sectors-count': 'int' } }
413 # @QUORUM_REPORT_BAD:
415 # Emitted to report a corruption of a Quorum file
417 # @type: quorum operation type (Since 2.6)
419 # @error: error message. Only present on failure. This field
420 #         contains a human-readable error message. There are no semantics other
421 #         than that the block layer reported an error and clients should not
422 #         try to interpret the error string.
424 # @node-name: the graph node name of the block driver state
426 # @sector-num: number of the first sector of the failed read operation
428 # @sectors-count: failed read operation sector count
430 # Note: This event is rate-limited.
432 # Since: 2.0
434 # Example:
436 # 1. Read operation
438 # { "event": "QUORUM_REPORT_BAD",
439 #      "data": { "node-name": "node0", "sector-num": 345435, "sectors-count": 5,
440 #                "type": "read" },
441 #      "timestamp": { "seconds": 1344522075, "microseconds": 745528 } }
443 # 2. Flush operation
445 # { "event": "QUORUM_REPORT_BAD",
446 #      "data": { "node-name": "node0", "sector-num": 0, "sectors-count": 2097120,
447 #                "type": "flush", "error": "Broken pipe" },
448 #      "timestamp": { "seconds": 1456406829, "microseconds": 291763 } }
451 { 'event': 'QUORUM_REPORT_BAD',
452   'data': { 'type': 'QuorumOpType', '*error': 'str', 'node-name': 'str',
453             'sector-num': 'int', 'sectors-count': 'int' } }