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