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