]> git.proxmox.com Git - mirror_qemu.git/blame - qapi/block.json
Clean up ill-advised or unusual header guards
[mirror_qemu.git] / qapi / block.json
CommitLineData
5db15096 1# -*- Mode: Python -*-
f7160f32 2# vim: filetype=python
d3a48372
MAL
3
4##
f5cf31c5 5# = Block devices
d3a48372 6##
5db15096 7
5db15096
BC
8{ 'include': 'block-core.json' }
9
d3a48372 10##
f5cf31c5 11# == Additional block stuff (VM related)
d3a48372
MAL
12##
13
2e95fa17 14##
f169f8fb 15# @BiosAtaTranslation:
2e95fa17
BC
16#
17# Policy that BIOS should use to interpret cylinder/head/sector
18# addresses. Note that Bochs BIOS and SeaBIOS will not actually
19# translate logical CHS to physical; instead, they will use logical
20# block addressing.
21#
22# @auto: If cylinder/heads/sizes are passed, choose between none and LBA
23# depending on the size of the disk. If they are not passed,
24# choose none if QEMU can guess that the disk had 16 or fewer
25# heads, large if QEMU can guess that the disk had 131072 or
26# fewer tracks across all heads (i.e. cylinders*heads<131072),
27# otherwise LBA.
28#
29# @none: The physical disk geometry is equal to the logical geometry.
30#
31# @lba: Assume 63 sectors per track and one of 16, 32, 64, 128 or 255
32# heads (if fewer than 255 are enough to cover the whole disk
33# with 1024 cylinders/head). The number of cylinders/head is
34# then computed based on the number of sectors and heads.
35#
36# @large: The number of cylinders per head is scaled down to 1024
37# by correspondingly scaling up the number of heads.
38#
39# @rechs: Same as @large, but first convert a 16-head geometry to
40# 15-head, by proportionally scaling up the number of
41# cylinders/head.
42#
43# Since: 2.0
44##
45{ 'enum': 'BiosAtaTranslation',
46 'data': ['auto', 'none', 'lba', 'large', 'rechs']}
47
2da44dd0 48##
5072f7b3 49# @FloppyDriveType:
2da44dd0
JS
50#
51# Type of Floppy drive to be emulated by the Floppy Disk Controller.
52#
53# @144: 1.44MB 3.5" drive
54# @288: 2.88MB 3.5" drive
55# @120: 1.2MB 5.25" drive
56# @none: No drive connected
57# @auto: Automatically determined by inserted media at boot
58#
59# Since: 2.6
60##
61{ 'enum': 'FloppyDriveType',
62 'data': ['144', '288', '120', 'none', 'auto']}
63
5f640894
PB
64##
65# @PRManagerInfo:
66#
67# Information about a persistent reservation manager
68#
69# @id: the identifier of the persistent reservation manager
70#
71# @connected: true if the persistent reservation manager is connected to
72# the underlying storage or helper
73#
74# Since: 3.0
75##
76{ 'struct': 'PRManagerInfo',
77 'data': {'id': 'str', 'connected': 'bool'} }
78
79##
80# @query-pr-managers:
81#
82# Returns a list of information about each persistent reservation manager.
83#
84# Returns: a list of @PRManagerInfo for each persistent reservation manager
85#
86# Since: 3.0
87##
88{ 'command': 'query-pr-managers', 'returns': ['PRManagerInfo'],
89 'allow-preconfig': true }
90
2e95fa17
BC
91##
92# @eject:
93#
df4097ae 94# Ejects the medium from a removable drive.
2e95fa17 95#
df4097ae 96# @device: Block device name
fbe2d816 97#
26ec4e53 98# @id: The name or QOM path of the guest device (since: 2.8)
2e95fa17 99#
26ec4e53
PM
100# @force: If true, eject regardless of whether the drive is locked.
101# If not specified, the default value is false.
2e95fa17 102#
df4097ae
MA
103# Features:
104# @deprecated: Member @device is deprecated. Use @id instead.
105#
e050e426
PM
106# Returns: - Nothing on success
107# - If @device is not a valid block device, DeviceNotFound
5fba0a72 108# Notes: Ejecting a device with no media results in success
2e95fa17 109#
9bc6e893 110# Since: 0.14
5fba0a72
MAL
111#
112# Example:
113#
244d04db 114# -> { "execute": "eject", "arguments": { "id": "ide1-0-1" } }
5fba0a72 115# <- { "return": {} }
2e95fa17 116##
fbe2d816 117{ 'command': 'eject',
df4097ae 118 'data': { '*device': { 'type': 'str', 'features': [ 'deprecated' ] },
fbe2d816
KW
119 '*id': 'str',
120 '*force': 'bool' } }
2e95fa17 121
5a16818b
KW
122##
123# @blockdev-open-tray:
124#
125# Opens a block device's tray. If there is a block driver state tree inserted as
126# a medium, it will become inaccessible to the guest (but it will remain
127# associated to the block device, so closing the tray will make it accessible
128# again).
129#
130# If the tray was already open before, this will be a no-op.
131#
132# Once the tray opens, a DEVICE_TRAY_MOVED event is emitted. There are cases in
133# which no such event will be generated, these include:
134#
135# - if the guest has locked the tray, @force is false and the guest does not
136# respond to the eject request
137# - if the BlockBackend denoted by @device does not have a guest device attached
138# to it
139# - if the guest device does not have an actual tray
140#
df4097ae 141# @device: Block device name
5a16818b
KW
142#
143# @id: The name or QOM path of the guest device (since: 2.8)
144#
145# @force: if false (the default), an eject request will be sent to
146# the guest if it has locked the tray (and the tray will not be opened
147# immediately); if true, the tray will be opened regardless of whether
148# it is locked
149#
df4097ae
MA
150# Features:
151# @deprecated: Member @device is deprecated. Use @id instead.
152#
5a16818b
KW
153# Since: 2.5
154#
155# Example:
156#
157# -> { "execute": "blockdev-open-tray",
158# "arguments": { "id": "ide0-1-0" } }
159#
160# <- { "timestamp": { "seconds": 1418751016,
161# "microseconds": 716996 },
162# "event": "DEVICE_TRAY_MOVED",
163# "data": { "device": "ide1-cd0",
164# "id": "ide0-1-0",
165# "tray-open": true } }
166#
167# <- { "return": {} }
168#
169##
170{ 'command': 'blockdev-open-tray',
df4097ae 171 'data': { '*device': { 'type': 'str', 'features': [ 'deprecated' ] },
5a16818b
KW
172 '*id': 'str',
173 '*force': 'bool' } }
174
175##
176# @blockdev-close-tray:
177#
178# Closes a block device's tray. If there is a block driver state tree associated
179# with the block device (which is currently ejected), that tree will be loaded
180# as the medium.
181#
182# If the tray was already closed before, this will be a no-op.
183#
df4097ae 184# @device: Block device name
5a16818b
KW
185#
186# @id: The name or QOM path of the guest device (since: 2.8)
187#
df4097ae
MA
188# Features:
189# @deprecated: Member @device is deprecated. Use @id instead.
190#
5a16818b
KW
191# Since: 2.5
192#
193# Example:
194#
195# -> { "execute": "blockdev-close-tray",
196# "arguments": { "id": "ide0-1-0" } }
197#
198# <- { "timestamp": { "seconds": 1418751345,
199# "microseconds": 272147 },
200# "event": "DEVICE_TRAY_MOVED",
201# "data": { "device": "ide1-cd0",
202# "id": "ide0-1-0",
203# "tray-open": false } }
204#
205# <- { "return": {} }
206#
207##
208{ 'command': 'blockdev-close-tray',
df4097ae 209 'data': { '*device': { 'type': 'str', 'features': [ 'deprecated' ] },
5a16818b
KW
210 '*id': 'str' } }
211
212##
213# @blockdev-remove-medium:
214#
215# Removes a medium (a block driver state tree) from a block device. That block
216# device's tray must currently be open (unless there is no attached guest
217# device).
218#
219# If the tray is open and there is no medium inserted, this will be a no-op.
220#
221# @id: The name or QOM path of the guest device
222#
223# Since: 2.12
224#
225# Example:
226#
227# -> { "execute": "blockdev-remove-medium",
228# "arguments": { "id": "ide0-1-0" } }
229#
230# <- { "error": { "class": "GenericError",
231# "desc": "Tray of device 'ide0-1-0' is not open" } }
232#
233# -> { "execute": "blockdev-open-tray",
234# "arguments": { "id": "ide0-1-0" } }
235#
236# <- { "timestamp": { "seconds": 1418751627,
237# "microseconds": 549958 },
238# "event": "DEVICE_TRAY_MOVED",
239# "data": { "device": "ide1-cd0",
240# "id": "ide0-1-0",
241# "tray-open": true } }
242#
243# <- { "return": {} }
244#
245# -> { "execute": "blockdev-remove-medium",
246# "arguments": { "id": "ide0-1-0" } }
247#
248# <- { "return": {} }
249#
250##
251{ 'command': 'blockdev-remove-medium',
252 'data': { 'id': 'str' } }
253
254##
255# @blockdev-insert-medium:
256#
257# Inserts a medium (a block driver state tree) into a block device. That block
258# device's tray must currently be open (unless there is no attached guest
259# device) and there must be no medium inserted already.
260#
261# @id: The name or QOM path of the guest device
262#
263# @node-name: name of a node in the block driver state graph
264#
265# Since: 2.12
266#
267# Example:
268#
269# -> { "execute": "blockdev-add",
270# "arguments": {
271# "node-name": "node0",
272# "driver": "raw",
273# "file": { "driver": "file",
274# "filename": "fedora.iso" } } }
275# <- { "return": {} }
276#
277# -> { "execute": "blockdev-insert-medium",
278# "arguments": { "id": "ide0-1-0",
279# "node-name": "node0" } }
280#
281# <- { "return": {} }
282#
283##
284{ 'command': 'blockdev-insert-medium',
285 'data': { 'id': 'str',
286 'node-name': 'str'} }
287
288
289##
290# @BlockdevChangeReadOnlyMode:
291#
292# Specifies the new read-only mode of a block device subject to the
293# @blockdev-change-medium command.
294#
295# @retain: Retains the current read-only mode
296#
297# @read-only: Makes the device read-only
298#
299# @read-write: Makes the device writable
300#
301# Since: 2.3
302#
303##
304{ 'enum': 'BlockdevChangeReadOnlyMode',
305 'data': ['retain', 'read-only', 'read-write'] }
306
307
308##
309# @blockdev-change-medium:
310#
311# Changes the medium inserted into a block device by ejecting the current medium
312# and loading a new image file which is inserted as the new medium (this command
313# combines blockdev-open-tray, blockdev-remove-medium, blockdev-insert-medium
314# and blockdev-close-tray).
315#
df4097ae 316# @device: Block device name
5a16818b
KW
317#
318# @id: The name or QOM path of the guest device
319# (since: 2.8)
320#
321# @filename: filename of the new image to be loaded
322#
323# @format: format to open the new image with (defaults to
324# the probed format)
325#
326# @read-only-mode: change the read-only mode of the device; defaults
327# to 'retain'
328#
80dd5aff
DL
329# @force: if false (the default), an eject request through blockdev-open-tray
330# will be sent to the guest if it has locked the tray (and the tray
331# will not be opened immediately); if true, the tray will be opened
332# regardless of whether it is locked. (since 7.1)
333#
df4097ae
MA
334# Features:
335# @deprecated: Member @device is deprecated. Use @id instead.
336#
5a16818b
KW
337# Since: 2.5
338#
339# Examples:
340#
341# 1. Change a removable medium
342#
343# -> { "execute": "blockdev-change-medium",
344# "arguments": { "id": "ide0-1-0",
345# "filename": "/srv/images/Fedora-12-x86_64-DVD.iso",
346# "format": "raw" } }
347# <- { "return": {} }
348#
349# 2. Load a read-only medium into a writable drive
350#
351# -> { "execute": "blockdev-change-medium",
352# "arguments": { "id": "floppyA",
353# "filename": "/srv/images/ro.img",
354# "format": "raw",
355# "read-only-mode": "retain" } }
356#
357# <- { "error":
358# { "class": "GenericError",
359# "desc": "Could not open '/srv/images/ro.img': Permission denied" } }
360#
361# -> { "execute": "blockdev-change-medium",
362# "arguments": { "id": "floppyA",
363# "filename": "/srv/images/ro.img",
364# "format": "raw",
365# "read-only-mode": "read-only" } }
366#
367# <- { "return": {} }
368#
369##
370{ 'command': 'blockdev-change-medium',
df4097ae 371 'data': { '*device': { 'type': 'str', 'features': [ 'deprecated' ] },
5a16818b
KW
372 '*id': 'str',
373 'filename': 'str',
374 '*format': 'str',
80dd5aff 375 '*force': 'bool',
5a16818b
KW
376 '*read-only-mode': 'BlockdevChangeReadOnlyMode' } }
377
378
a5ee7bd4 379##
5072f7b3 380# @DEVICE_TRAY_MOVED:
a5ee7bd4
WX
381#
382# Emitted whenever the tray of a removable device is moved by the guest or by
383# HMP/QMP commands
384#
2d76e724
KW
385# @device: Block device name. This is always present for compatibility
386# reasons, but it can be empty ("") if the image does not
387# have a device name associated.
388#
d750c3a9 389# @id: The name or QOM path of the guest device (since 2.8)
a5ee7bd4
WX
390#
391# @tray-open: true if the tray has been opened or false if it has been closed
392#
393# Since: 1.1
01b7d4be
MAL
394#
395# Example:
396#
397# <- { "event": "DEVICE_TRAY_MOVED",
398# "data": { "device": "ide1-cd0",
399# "id": "/machine/unattached/device[22]",
400# "tray-open": true
401# },
402# "timestamp": { "seconds": 1265044230, "microseconds": 450486 } }
403#
a5ee7bd4
WX
404##
405{ 'event': 'DEVICE_TRAY_MOVED',
2d76e724 406 'data': { 'device': 'str', 'id': 'str', 'tray-open': 'bool' } }
0ae053b7 407
e2c81a45
PB
408##
409# @PR_MANAGER_STATUS_CHANGED:
410#
411# Emitted whenever the connected status of a persistent reservation
412# manager changes.
413#
414# @id: The id of the PR manager object
415#
416# @connected: true if the PR manager is connected to a backend
417#
418# Since: 3.0
419#
420# Example:
421#
422# <- { "event": "PR_MANAGER_STATUS_CHANGED",
423# "data": { "id": "pr-helper0",
424# "connected": true
425# },
426# "timestamp": { "seconds": 1519840375, "microseconds": 450486 } }
427#
428##
429{ 'event': 'PR_MANAGER_STATUS_CHANGED',
430 'data': { 'id': 'str', 'connected': 'bool' } }
5a16818b
KW
431
432##
433# @block_set_io_throttle:
434#
435# Change I/O throttle limits for a block drive.
436#
437# Since QEMU 2.4, each device with I/O limits is member of a throttle
438# group.
439#
440# If two or more devices are members of the same group, the limits
441# will apply to the combined I/O of the whole group in a round-robin
442# fashion. Therefore, setting new I/O limits to a device will affect
443# the whole group.
444#
445# The name of the group can be specified using the 'group' parameter.
446# If the parameter is unset, it is assumed to be the current group of
447# that device. If it's not in any group yet, the name of the device
448# will be used as the name for its group.
449#
450# The 'group' parameter can also be used to move a device to a
451# different group. In this case the limits specified in the parameters
452# will be applied to the new group only.
453#
454# I/O limits can be disabled by setting all of them to 0. In this case
455# the device will be removed from its group and the rest of its
456# members will not be affected. The 'group' parameter is ignored.
457#
458# Returns: - Nothing on success
459# - If @device is not a valid block device, DeviceNotFound
460#
461# Since: 1.1
462#
463# Example:
464#
465# -> { "execute": "block_set_io_throttle",
466# "arguments": { "id": "virtio-blk-pci0/virtio-backend",
467# "bps": 0,
468# "bps_rd": 0,
469# "bps_wr": 0,
470# "iops": 512,
471# "iops_rd": 0,
472# "iops_wr": 0,
473# "bps_max": 0,
474# "bps_rd_max": 0,
475# "bps_wr_max": 0,
476# "iops_max": 0,
477# "iops_rd_max": 0,
478# "iops_wr_max": 0,
479# "bps_max_length": 0,
480# "iops_size": 0 } }
481# <- { "return": {} }
482#
483# -> { "execute": "block_set_io_throttle",
484# "arguments": { "id": "ide0-1-0",
485# "bps": 1000000,
486# "bps_rd": 0,
487# "bps_wr": 0,
488# "iops": 0,
489# "iops_rd": 0,
490# "iops_wr": 0,
491# "bps_max": 8000000,
492# "bps_rd_max": 0,
493# "bps_wr_max": 0,
494# "iops_max": 0,
495# "iops_rd_max": 0,
496# "iops_wr_max": 0,
497# "bps_max_length": 60,
498# "iops_size": 0 } }
499# <- { "return": {} }
500##
501{ 'command': 'block_set_io_throttle', 'boxed': true,
502 'data': 'BlockIOThrottle' }
503
504##
505# @block-latency-histogram-set:
506#
507# Manage read, write and flush latency histograms for the device.
508#
509# If only @id parameter is specified, remove all present latency histograms
510# for the device. Otherwise, add/reset some of (or all) latency histograms.
511#
512# @id: The name or QOM path of the guest device.
513#
514# @boundaries: list of interval boundary values (see description in
515# BlockLatencyHistogramInfo definition). If specified, all
516# latency histograms are removed, and empty ones created for all
517# io types with intervals corresponding to @boundaries (except for
518# io types, for which specific boundaries are set through the
519# following parameters).
520#
521# @boundaries-read: list of interval boundary values for read latency
522# histogram. If specified, old read latency histogram is
523# removed, and empty one created with intervals
524# corresponding to @boundaries-read. The parameter has higher
525# priority then @boundaries.
526#
527# @boundaries-write: list of interval boundary values for write latency
528# histogram.
529#
530# @boundaries-flush: list of interval boundary values for flush latency
531# histogram.
532#
533# Returns: error if device is not found or any boundary arrays are invalid.
534#
535# Since: 4.0
536#
8b5905aa
PM
537# Example:
538# set new histograms for all io types with intervals
5a16818b
KW
539# [0, 10), [10, 50), [50, 100), [100, +inf):
540#
541# -> { "execute": "block-latency-histogram-set",
542# "arguments": { "id": "drive0",
543# "boundaries": [10, 50, 100] } }
544# <- { "return": {} }
545#
8b5905aa
PM
546# Example:
547# set new histogram only for write, other histograms will remain
5a16818b
KW
548# not changed (or not created):
549#
550# -> { "execute": "block-latency-histogram-set",
551# "arguments": { "id": "drive0",
552# "boundaries-write": [10, 50, 100] } }
553# <- { "return": {} }
554#
8b5905aa
PM
555# Example:
556# set new histograms with the following intervals:
5a16818b
KW
557# read, flush: [0, 10), [10, 50), [50, 100), [100, +inf)
558# write: [0, 1000), [1000, 5000), [5000, +inf)
559#
560# -> { "execute": "block-latency-histogram-set",
561# "arguments": { "id": "drive0",
562# "boundaries": [10, 50, 100],
563# "boundaries-write": [1000, 5000] } }
564# <- { "return": {} }
565#
8b5905aa
PM
566# Example:
567# remove all latency histograms:
5a16818b
KW
568#
569# -> { "execute": "block-latency-histogram-set",
570# "arguments": { "id": "drive0" } }
571# <- { "return": {} }
572##
573{ 'command': 'block-latency-histogram-set',
574 'data': {'id': 'str',
575 '*boundaries': ['uint64'],
576 '*boundaries-read': ['uint64'],
577 '*boundaries-write': ['uint64'],
578 '*boundaries-flush': ['uint64'] } }