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