]> git.ipfire.org Git - thirdparty/qemu.git/blame - qapi/block.json
qapi: Use explicit bulleted lists
[thirdparty/qemu.git] / qapi / block.json
CommitLineData
5db15096 1# -*- Mode: Python -*-
d3a48372
MAL
2
3##
f5cf31c5 4# = Block devices
d3a48372 5##
5db15096 6
5db15096
BC
7{ 'include': 'block-core.json' }
8
d3a48372 9##
f5cf31c5 10# == Additional block stuff (VM related)
d3a48372
MAL
11##
12
2e95fa17 13##
f169f8fb 14# @BiosAtaTranslation:
2e95fa17
BC
15#
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.
20#
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.
27#
28# @none: The physical disk geometry is equal to the logical geometry.
29#
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.
34#
35# @large: The number of cylinders per head is scaled down to 1024
36# by correspondingly scaling up the number of heads.
37#
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.
41#
42# Since: 2.0
43##
44{ 'enum': 'BiosAtaTranslation',
45 'data': ['auto', 'none', 'lba', 'large', 'rechs']}
46
2da44dd0 47##
5072f7b3 48# @FloppyDriveType:
2da44dd0
JS
49#
50# Type of Floppy drive to be emulated by the Floppy Disk Controller.
51#
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
57#
58# Since: 2.6
59##
60{ 'enum': 'FloppyDriveType',
61 'data': ['144', '288', '120', 'none', 'auto']}
62
2e95fa17 63##
5072f7b3 64# @BlockdevSnapshotInternal:
2e95fa17 65#
75dfd402
KW
66# @device: the device name or node-name of a root node to generate the snapshot
67# from
2e95fa17
BC
68#
69# @name: the name of the internal snapshot to be created
70#
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.
74#
75# Since: 1.7
76##
895a2a80 77{ 'struct': 'BlockdevSnapshotInternal',
2e95fa17
BC
78 'data': { 'device': 'str', 'name': 'str' } }
79
5f640894
PB
80##
81# @PRManagerInfo:
82#
83# Information about a persistent reservation manager
84#
85# @id: the identifier of the persistent reservation manager
86#
87# @connected: true if the persistent reservation manager is connected to
88# the underlying storage or helper
89#
90# Since: 3.0
91##
92{ 'struct': 'PRManagerInfo',
93 'data': {'id': 'str', 'connected': 'bool'} }
94
95##
96# @query-pr-managers:
97#
98# Returns a list of information about each persistent reservation manager.
99#
100# Returns: a list of @PRManagerInfo for each persistent reservation manager
101#
102# Since: 3.0
103##
104{ 'command': 'query-pr-managers', 'returns': ['PRManagerInfo'],
105 'allow-preconfig': true }
106
107
2e95fa17 108##
5072f7b3 109# @blockdev-snapshot-internal-sync:
2e95fa17 110#
bfeafc9c
MAL
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.
2e95fa17
BC
115#
116# For the arguments, see the documentation of BlockdevSnapshotInternal.
117#
e050e426
PM
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
2e95fa17 124#
5072f7b3 125# Since: 1.7
bfeafc9c
MAL
126#
127# Example:
128#
129# -> { "execute": "blockdev-snapshot-internal-sync",
130# "arguments": { "device": "ide-hd0",
131# "name": "snapshot0" }
132# }
133# <- { "return": {} }
134#
2e95fa17
BC
135##
136{ 'command': 'blockdev-snapshot-internal-sync',
137 'data': 'BlockdevSnapshotInternal' }
138
139##
5072f7b3 140# @blockdev-snapshot-delete-internal-sync:
2e95fa17
BC
141#
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.
146#
2dfb4c03
KW
147# @device: the device name or node-name of a root node to delete the snapshot
148# from
2e95fa17
BC
149#
150# @id: optional the snapshot's ID to be deleted
151#
152# @name: optional the snapshot's name to be deleted
153#
e050e426
PM
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
2e95fa17 160#
5072f7b3 161# Since: 1.7
b31177b0
MAL
162#
163# Example:
164#
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# }
179#
2e95fa17
BC
180##
181{ 'command': 'blockdev-snapshot-delete-internal-sync',
182 'data': { 'device': 'str', '*id': 'str', '*name': 'str'},
183 'returns': 'SnapshotInfo' }
184
185##
186# @eject:
187#
188# Ejects a device from a removable drive.
189#
26ec4e53 190# @device: Block device name (deprecated, use @id instead)
fbe2d816 191#
26ec4e53 192# @id: The name or QOM path of the guest device (since: 2.8)
2e95fa17 193#
26ec4e53
PM
194# @force: If true, eject regardless of whether the drive is locked.
195# If not specified, the default value is false.
2e95fa17 196#
e050e426
PM
197# Returns: - Nothing on success
198# - If @device is not a valid block device, DeviceNotFound
5fba0a72 199# Notes: Ejecting a device with no media results in success
2e95fa17
BC
200#
201# Since: 0.14.0
5fba0a72
MAL
202#
203# Example:
204#
244d04db 205# -> { "execute": "eject", "arguments": { "id": "ide1-0-1" } }
5fba0a72 206# <- { "return": {} }
2e95fa17 207##
fbe2d816
KW
208{ 'command': 'eject',
209 'data': { '*device': 'str',
210 '*id': 'str',
211 '*force': 'bool' } }
2e95fa17
BC
212
213##
214# @nbd-server-start:
215#
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".
220#
221# @addr: Address on which to listen.
ab7c5d94 222# @tls-creds: ID of the TLS credentials object (since 2.6).
00019455
DB
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).
2e95fa17
BC
228#
229# Returns: error if the server is already running.
230#
231# Since: 1.3.0
232##
233{ 'command': 'nbd-server-start',
dfd100f2 234 'data': { 'addr': 'SocketAddressLegacy',
00019455
DB
235 '*tls-creds': 'str',
236 '*tls-authz': 'str'} }
2e95fa17
BC
237
238##
239# @nbd-server-add:
240#
094138d0 241# Export a block node to QEMU's embedded NBD server.
2e95fa17 242#
094138d0 243# @device: The device name or node name of the node to be exported
2e95fa17 244#
902a1f94
VSO
245# @name: Export name. If unspecified, the @device parameter is used as the
246# export name. (Since 2.12)
247#
deb6ccb0
EB
248# @description: Free-form description of the export, up to 4096 bytes.
249# (Since 5.0)
250#
2e95fa17 251# @writable: Whether clients should be able to write to the device via the
26ec4e53 252# NBD connection (default false).
deb6ccb0 253#
5fcbeb06
EB
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)
2e95fa17 257#
902a1f94
VSO
258# Returns: error if the server is not running, or export with the same name
259# already exists.
2e95fa17
BC
260#
261# Since: 1.3.0
262##
902a1f94 263{ 'command': 'nbd-server-add',
deb6ccb0
EB
264 'data': {'device': 'str', '*name': 'str', '*description': 'str',
265 '*writable': 'bool', '*bitmap': 'str' } }
2e95fa17 266
a3b0dc75
VSO
267##
268# @NbdServerRemoveMode:
269#
270# Mode for removing an NBD export.
271#
272# @safe: Remove export if there are no existing connections, fail otherwise.
273#
274# @hard: Drop all connections immediately and remove export.
275#
276# Potential additional modes to be added in the future:
277#
278# hide: Just hide export from new clients, leave existing connections as is.
26ec4e53 279# Remove export after all clients are disconnected.
a3b0dc75
VSO
280#
281# soft: Hide export from new clients, answer with ESHUTDOWN for all further
26ec4e53 282# requests from existing clients.
a3b0dc75
VSO
283#
284# Since: 2.12
285##
286{'enum': 'NbdServerRemoveMode', 'data': ['safe', 'hard']}
287
288##
289# @nbd-server-remove:
290#
291# Remove NBD export by name.
292#
293# @name: Export name.
294#
295# @mode: Mode of command operation. See @NbdServerRemoveMode description.
296# Default is 'safe'.
297#
298# Returns: error if
299# - the server is not running
300# - export is not found
301# - mode is 'safe' and there are existing connections
302#
303# Since: 2.12
304##
305{ 'command': 'nbd-server-remove',
306 'data': {'name': 'str', '*mode': 'NbdServerRemoveMode'} }
307
2e95fa17
BC
308##
309# @nbd-server-stop:
310#
311# Stop QEMU's embedded NBD server, and unregister all devices previously
312# added via @nbd-server-add.
313#
314# Since: 1.3.0
315##
316{ 'command': 'nbd-server-stop' }
317
a5ee7bd4 318##
5072f7b3 319# @DEVICE_TRAY_MOVED:
a5ee7bd4
WX
320#
321# Emitted whenever the tray of a removable device is moved by the guest or by
322# HMP/QMP commands
323#
2d76e724
KW
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.
327#
d750c3a9 328# @id: The name or QOM path of the guest device (since 2.8)
a5ee7bd4
WX
329#
330# @tray-open: true if the tray has been opened or false if it has been closed
331#
332# Since: 1.1
01b7d4be
MAL
333#
334# Example:
335#
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 } }
342#
a5ee7bd4
WX
343##
344{ 'event': 'DEVICE_TRAY_MOVED',
2d76e724 345 'data': { 'device': 'str', 'id': 'str', 'tray-open': 'bool' } }
0ae053b7 346
e2c81a45
PB
347##
348# @PR_MANAGER_STATUS_CHANGED:
349#
350# Emitted whenever the connected status of a persistent reservation
351# manager changes.
352#
353# @id: The id of the PR manager object
354#
355# @connected: true if the PR manager is connected to a backend
356#
357# Since: 3.0
358#
359# Example:
360#
361# <- { "event": "PR_MANAGER_STATUS_CHANGED",
362# "data": { "id": "pr-helper0",
363# "connected": true
364# },
365# "timestamp": { "seconds": 1519840375, "microseconds": 450486 } }
366#
367##
368{ 'event': 'PR_MANAGER_STATUS_CHANGED',
369 'data': { 'id': 'str', 'connected': 'bool' } }
370
0ae053b7 371##
5072f7b3 372# @QuorumOpType:
0ae053b7
CX
373#
374# An enumeration of the quorum operation types
375#
376# @read: read operation
377#
378# @write: write operation
379#
380# @flush: flush operation
381#
382# Since: 2.6
383##
384{ 'enum': 'QuorumOpType',
385 'data': [ 'read', 'write', 'flush' ] }
fd87a6bd
MA
386
387##
388# @QUORUM_FAILURE:
389#
390# Emitted by the Quorum block driver if it fails to establish a quorum
391#
392# @reference: device name if defined else node name
393#
394# @sector-num: number of the first sector of the failed read operation
395#
396# @sectors-count: failed read operation sector count
397#
398# Note: This event is rate-limited.
399#
400# Since: 2.0
401#
402# Example:
403#
404# <- { "event": "QUORUM_FAILURE",
405# "data": { "reference": "usr1", "sector-num": 345435, "sectors-count": 5 },
406# "timestamp": { "seconds": 1344522075, "microseconds": 745528 } }
407#
408##
409{ 'event': 'QUORUM_FAILURE',
410 'data': { 'reference': 'str', 'sector-num': 'int', 'sectors-count': 'int' } }
411
412##
413# @QUORUM_REPORT_BAD:
414#
415# Emitted to report a corruption of a Quorum file
416#
417# @type: quorum operation type (Since 2.6)
418#
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.
423#
424# @node-name: the graph node name of the block driver state
425#
426# @sector-num: number of the first sector of the failed read operation
427#
428# @sectors-count: failed read operation sector count
429#
430# Note: This event is rate-limited.
431#
432# Since: 2.0
433#
434# Example:
435#
436# 1. Read operation
437#
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 } }
442#
443# 2. Flush operation
444#
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 } }
449#
450##
451{ 'event': 'QUORUM_REPORT_BAD',
452 'data': { 'type': 'QuorumOpType', '*error': 'str', 'node-name': 'str',
453 'sector-num': 'int', 'sectors-count': 'int' } }