xref: /qemu/qapi/block.json (revision 209e64d9)
15db15096SBenoît Canet# -*- Mode: Python -*-
2f7160f32SAndrea Bolognani# vim: filetype=python
3d3a48372SMarc-André Lureau
4d3a48372SMarc-André Lureau##
5f5cf31c5SMarkus Armbruster# = Block devices
6d3a48372SMarc-André Lureau##
75db15096SBenoît Canet
85db15096SBenoît Canet{ 'include': 'block-core.json' }
95db15096SBenoît Canet
102e95fa17SBenoît Canet##
11f5cf31c5SMarkus Armbruster# == Additional block stuff (VM related)
12d3a48372SMarc-André Lureau##
13d3a48372SMarc-André Lureau
14d3a48372SMarc-André Lureau##
15f169f8fbSMarc-André Lureau# @BiosAtaTranslation:
162e95fa17SBenoît Canet#
172e95fa17SBenoît Canet# Policy that BIOS should use to interpret cylinder/head/sector
182e95fa17SBenoît Canet# addresses.  Note that Bochs BIOS and SeaBIOS will not actually
192e95fa17SBenoît Canet# translate logical CHS to physical; instead, they will use logical
202e95fa17SBenoît Canet# block addressing.
212e95fa17SBenoît Canet#
22a937b6aaSMarkus Armbruster# @auto: If cylinder/heads/sizes are passed, choose between none and
23a937b6aaSMarkus Armbruster#     LBA depending on the size of the disk.  If they are not passed,
242e95fa17SBenoît Canet#     choose none if QEMU can guess that the disk had 16 or fewer
25a937b6aaSMarkus Armbruster#     heads, large if QEMU can guess that the disk had 131072 or fewer
26a937b6aaSMarkus Armbruster#     tracks across all heads (i.e. cylinders*heads<131072), otherwise
27a937b6aaSMarkus Armbruster#     LBA.
282e95fa17SBenoît Canet#
292e95fa17SBenoît Canet# @none: The physical disk geometry is equal to the logical geometry.
302e95fa17SBenoît Canet#
312e95fa17SBenoît Canet# @lba: Assume 63 sectors per track and one of 16, 32, 64, 128 or 255
32a937b6aaSMarkus Armbruster#     heads (if fewer than 255 are enough to cover the whole disk with
33a937b6aaSMarkus Armbruster#     1024 cylinders/head).  The number of cylinders/head is then
34a937b6aaSMarkus Armbruster#     computed based on the number of sectors and heads.
352e95fa17SBenoît Canet#
36a937b6aaSMarkus Armbruster# @large: The number of cylinders per head is scaled down to 1024 by
37a937b6aaSMarkus Armbruster#     correspondingly scaling up the number of heads.
382e95fa17SBenoît Canet#
392e95fa17SBenoît Canet# @rechs: Same as @large, but first convert a 16-head geometry to
402e95fa17SBenoît Canet#     15-head, by proportionally scaling up the number of
412e95fa17SBenoît Canet#     cylinders/head.
422e95fa17SBenoît Canet#
432e95fa17SBenoît Canet# Since: 2.0
442e95fa17SBenoît Canet##
452e95fa17SBenoît Canet{ 'enum': 'BiosAtaTranslation',
462e95fa17SBenoît Canet  'data': ['auto', 'none', 'lba', 'large', 'rechs']}
472e95fa17SBenoît Canet
482e95fa17SBenoît Canet##
495072f7b3SMarc-André Lureau# @FloppyDriveType:
502da44dd0SJohn Snow#
512da44dd0SJohn Snow# Type of Floppy drive to be emulated by the Floppy Disk Controller.
522da44dd0SJohn Snow#
532da44dd0SJohn Snow# @144: 1.44MB 3.5" drive
54a937b6aaSMarkus Armbruster#
552da44dd0SJohn Snow# @288: 2.88MB 3.5" drive
56a937b6aaSMarkus Armbruster#
572da44dd0SJohn Snow# @120: 1.2MB 5.25" drive
58a937b6aaSMarkus Armbruster#
592da44dd0SJohn Snow# @none: No drive connected
60a937b6aaSMarkus Armbruster#
612da44dd0SJohn Snow# @auto: Automatically determined by inserted media at boot
622da44dd0SJohn Snow#
632da44dd0SJohn Snow# Since: 2.6
642da44dd0SJohn Snow##
652da44dd0SJohn Snow{ 'enum': 'FloppyDriveType',
662da44dd0SJohn Snow  'data': ['144', '288', '120', 'none', 'auto']}
672da44dd0SJohn Snow
682da44dd0SJohn Snow##
695f640894SPaolo Bonzini# @PRManagerInfo:
705f640894SPaolo Bonzini#
715f640894SPaolo Bonzini# Information about a persistent reservation manager
725f640894SPaolo Bonzini#
735f640894SPaolo Bonzini# @id: the identifier of the persistent reservation manager
745f640894SPaolo Bonzini#
75a937b6aaSMarkus Armbruster# @connected: true if the persistent reservation manager is connected
76a937b6aaSMarkus Armbruster#     to the underlying storage or helper
775f640894SPaolo Bonzini#
785f640894SPaolo Bonzini# Since: 3.0
795f640894SPaolo Bonzini##
805f640894SPaolo Bonzini{ 'struct': 'PRManagerInfo',
815f640894SPaolo Bonzini  'data': {'id': 'str', 'connected': 'bool'} }
825f640894SPaolo Bonzini
835f640894SPaolo Bonzini##
845f640894SPaolo Bonzini# @query-pr-managers:
855f640894SPaolo Bonzini#
86a937b6aaSMarkus Armbruster# Returns a list of information about each persistent reservation
87a937b6aaSMarkus Armbruster# manager.
885f640894SPaolo Bonzini#
89a937b6aaSMarkus Armbruster# Returns: a list of @PRManagerInfo for each persistent reservation
90a937b6aaSMarkus Armbruster#     manager
915f640894SPaolo Bonzini#
925f640894SPaolo Bonzini# Since: 3.0
935f640894SPaolo Bonzini##
945f640894SPaolo Bonzini{ 'command': 'query-pr-managers', 'returns': ['PRManagerInfo'],
955f640894SPaolo Bonzini  'allow-preconfig': true }
965f640894SPaolo Bonzini
972e95fa17SBenoît Canet##
982e95fa17SBenoît Canet# @eject:
992e95fa17SBenoît Canet#
100df4097aeSMarkus Armbruster# Ejects the medium from a removable drive.
1012e95fa17SBenoît Canet#
102df4097aeSMarkus Armbruster# @device: Block device name
103fbe2d816SKevin Wolf#
1041d8bda12SMarkus Armbruster# @id: The name or QOM path of the guest device (since: 2.8)
1052e95fa17SBenoît Canet#
1061d8bda12SMarkus Armbruster# @force: If true, eject regardless of whether the drive is locked.
1072e95fa17SBenoît Canet#     If not specified, the default value is false.
1082e95fa17SBenoît Canet#
109df4097aeSMarkus Armbruster# Features:
110a937b6aaSMarkus Armbruster#
111df4097aeSMarkus Armbruster# @deprecated: Member @device is deprecated.  Use @id instead.
112df4097aeSMarkus Armbruster#
1132746f060SMarkus Armbruster# Errors:
114e050e426SPeter Maydell#     - If @device is not a valid block device, DeviceNotFound
1154ae65a52SAndrea Bolognani#
1165fba0a72SMarc-André Lureau# Notes: Ejecting a device with no media results in success
1172e95fa17SBenoît Canet#
1189bc6e893SMarkus Armbruster# Since: 0.14
1195fba0a72SMarc-André Lureau#
1205fba0a72SMarc-André Lureau# Example:
1215fba0a72SMarc-André Lureau#
122244d04dbSEric Blake#     -> { "execute": "eject", "arguments": { "id": "ide1-0-1" } }
1235fba0a72SMarc-André Lureau#     <- { "return": {} }
1242e95fa17SBenoît Canet##
125fbe2d816SKevin Wolf{ 'command': 'eject',
126df4097aeSMarkus Armbruster  'data': { '*device': { 'type': 'str', 'features': [ 'deprecated' ] },
127fbe2d816SKevin Wolf            '*id': 'str',
128fbe2d816SKevin Wolf            '*force': 'bool' } }
1292e95fa17SBenoît Canet
1302e95fa17SBenoît Canet##
1315a16818bSKevin Wolf# @blockdev-open-tray:
1325a16818bSKevin Wolf#
133a937b6aaSMarkus Armbruster# Opens a block device's tray.  If there is a block driver state tree
134a937b6aaSMarkus Armbruster# inserted as a medium, it will become inaccessible to the guest (but
135a937b6aaSMarkus Armbruster# it will remain associated to the block device, so closing the tray
136a937b6aaSMarkus Armbruster# will make it accessible again).
1375a16818bSKevin Wolf#
1385a16818bSKevin Wolf# If the tray was already open before, this will be a no-op.
1395a16818bSKevin Wolf#
140a937b6aaSMarkus Armbruster# Once the tray opens, a DEVICE_TRAY_MOVED event is emitted.  There
141a937b6aaSMarkus Armbruster# are cases in which no such event will be generated, these include:
1425a16818bSKevin Wolf#
143a937b6aaSMarkus Armbruster# - if the guest has locked the tray, @force is false and the guest
144a937b6aaSMarkus Armbruster#   does not respond to the eject request
145a937b6aaSMarkus Armbruster# - if the BlockBackend denoted by @device does not have a guest
146a937b6aaSMarkus Armbruster#   device attached to it
1475a16818bSKevin Wolf# - if the guest device does not have an actual tray
1485a16818bSKevin Wolf#
149df4097aeSMarkus Armbruster# @device: Block device name
1505a16818bSKevin Wolf#
1515a16818bSKevin Wolf# @id: The name or QOM path of the guest device (since: 2.8)
1525a16818bSKevin Wolf#
153a937b6aaSMarkus Armbruster# @force: if false (the default), an eject request will be sent to the
154a937b6aaSMarkus Armbruster#     guest if it has locked the tray (and the tray will not be opened
155a937b6aaSMarkus Armbruster#     immediately); if true, the tray will be opened regardless of
156a937b6aaSMarkus Armbruster#     whether it is locked
1575a16818bSKevin Wolf#
158df4097aeSMarkus Armbruster# Features:
159a937b6aaSMarkus Armbruster#
160df4097aeSMarkus Armbruster# @deprecated: Member @device is deprecated.  Use @id instead.
161df4097aeSMarkus Armbruster#
1625a16818bSKevin Wolf# Since: 2.5
1635a16818bSKevin Wolf#
1645a16818bSKevin Wolf# Example:
1655a16818bSKevin Wolf#
1665a16818bSKevin Wolf#     -> { "execute": "blockdev-open-tray",
1675a16818bSKevin Wolf#          "arguments": { "id": "ide0-1-0" } }
1685a16818bSKevin Wolf#
1695a16818bSKevin Wolf#     <- { "timestamp": { "seconds": 1418751016,
1705a16818bSKevin Wolf#                         "microseconds": 716996 },
1715a16818bSKevin Wolf#          "event": "DEVICE_TRAY_MOVED",
1725a16818bSKevin Wolf#          "data": { "device": "ide1-cd0",
1735a16818bSKevin Wolf#                    "id": "ide0-1-0",
1745a16818bSKevin Wolf#                    "tray-open": true } }
1755a16818bSKevin Wolf#
1765a16818bSKevin Wolf#     <- { "return": {} }
1775a16818bSKevin Wolf##
1785a16818bSKevin Wolf{ 'command': 'blockdev-open-tray',
179df4097aeSMarkus Armbruster  'data': { '*device': { 'type': 'str', 'features': [ 'deprecated' ] },
1805a16818bSKevin Wolf            '*id': 'str',
1815a16818bSKevin Wolf            '*force': 'bool' } }
1825a16818bSKevin Wolf
1835a16818bSKevin Wolf##
1845a16818bSKevin Wolf# @blockdev-close-tray:
1855a16818bSKevin Wolf#
186a937b6aaSMarkus Armbruster# Closes a block device's tray.  If there is a block driver state tree
187a937b6aaSMarkus Armbruster# associated with the block device (which is currently ejected), that
188a937b6aaSMarkus Armbruster# tree will be loaded as the medium.
1895a16818bSKevin Wolf#
1905a16818bSKevin Wolf# If the tray was already closed before, this will be a no-op.
1915a16818bSKevin Wolf#
192df4097aeSMarkus Armbruster# @device: Block device name
1935a16818bSKevin Wolf#
1945a16818bSKevin Wolf# @id: The name or QOM path of the guest device (since: 2.8)
1955a16818bSKevin Wolf#
196df4097aeSMarkus Armbruster# Features:
197a937b6aaSMarkus Armbruster#
198df4097aeSMarkus Armbruster# @deprecated: Member @device is deprecated.  Use @id instead.
199df4097aeSMarkus Armbruster#
2005a16818bSKevin Wolf# Since: 2.5
2015a16818bSKevin Wolf#
2025a16818bSKevin Wolf# Example:
2035a16818bSKevin Wolf#
2045a16818bSKevin Wolf#     -> { "execute": "blockdev-close-tray",
2055a16818bSKevin Wolf#          "arguments": { "id": "ide0-1-0" } }
2065a16818bSKevin Wolf#
2075a16818bSKevin Wolf#     <- { "timestamp": { "seconds": 1418751345,
2085a16818bSKevin Wolf#                         "microseconds": 272147 },
2095a16818bSKevin Wolf#          "event": "DEVICE_TRAY_MOVED",
2105a16818bSKevin Wolf#          "data": { "device": "ide1-cd0",
2115a16818bSKevin Wolf#                    "id": "ide0-1-0",
2125a16818bSKevin Wolf#                    "tray-open": false } }
2135a16818bSKevin Wolf#
2145a16818bSKevin Wolf#     <- { "return": {} }
2155a16818bSKevin Wolf##
2165a16818bSKevin Wolf{ 'command': 'blockdev-close-tray',
217df4097aeSMarkus Armbruster  'data': { '*device': { 'type': 'str', 'features': [ 'deprecated' ] },
2185a16818bSKevin Wolf            '*id': 'str' } }
2195a16818bSKevin Wolf
2205a16818bSKevin Wolf##
2215a16818bSKevin Wolf# @blockdev-remove-medium:
2225a16818bSKevin Wolf#
223a937b6aaSMarkus Armbruster# Removes a medium (a block driver state tree) from a block device.
224a937b6aaSMarkus Armbruster# That block device's tray must currently be open (unless there is no
225a937b6aaSMarkus Armbruster# attached guest device).
2265a16818bSKevin Wolf#
227a937b6aaSMarkus Armbruster# If the tray is open and there is no medium inserted, this will be a
228a937b6aaSMarkus Armbruster# no-op.
2295a16818bSKevin Wolf#
2305a16818bSKevin Wolf# @id: The name or QOM path of the guest device
2315a16818bSKevin Wolf#
2325a16818bSKevin Wolf# Since: 2.12
2335a16818bSKevin Wolf#
2345a16818bSKevin Wolf# Example:
2355a16818bSKevin Wolf#
2365a16818bSKevin Wolf#     -> { "execute": "blockdev-remove-medium",
2375a16818bSKevin Wolf#          "arguments": { "id": "ide0-1-0" } }
2385a16818bSKevin Wolf#
2395a16818bSKevin Wolf#     <- { "error": { "class": "GenericError",
2405a16818bSKevin Wolf#                     "desc": "Tray of device 'ide0-1-0' is not open" } }
2415a16818bSKevin Wolf#
2425a16818bSKevin Wolf#     -> { "execute": "blockdev-open-tray",
2435a16818bSKevin Wolf#          "arguments": { "id": "ide0-1-0" } }
2445a16818bSKevin Wolf#
2455a16818bSKevin Wolf#     <- { "timestamp": { "seconds": 1418751627,
2465a16818bSKevin Wolf#                         "microseconds": 549958 },
2475a16818bSKevin Wolf#          "event": "DEVICE_TRAY_MOVED",
2485a16818bSKevin Wolf#          "data": { "device": "ide1-cd0",
2495a16818bSKevin Wolf#                    "id": "ide0-1-0",
2505a16818bSKevin Wolf#                    "tray-open": true } }
2515a16818bSKevin Wolf#
2525a16818bSKevin Wolf#     <- { "return": {} }
2535a16818bSKevin Wolf#
2545a16818bSKevin Wolf#     -> { "execute": "blockdev-remove-medium",
2555a16818bSKevin Wolf#          "arguments": { "id": "ide0-1-0" } }
2565a16818bSKevin Wolf#
2575a16818bSKevin Wolf#     <- { "return": {} }
2585a16818bSKevin Wolf##
2595a16818bSKevin Wolf{ 'command': 'blockdev-remove-medium',
2605a16818bSKevin Wolf  'data': { 'id': 'str' } }
2615a16818bSKevin Wolf
2625a16818bSKevin Wolf##
2635a16818bSKevin Wolf# @blockdev-insert-medium:
2645a16818bSKevin Wolf#
265a937b6aaSMarkus Armbruster# Inserts a medium (a block driver state tree) into a block device.
266a937b6aaSMarkus Armbruster# That block device's tray must currently be open (unless there is no
267a937b6aaSMarkus Armbruster# attached guest device) and there must be no medium inserted already.
2685a16818bSKevin Wolf#
2695a16818bSKevin Wolf# @id: The name or QOM path of the guest device
2705a16818bSKevin Wolf#
2715a16818bSKevin Wolf# @node-name: name of a node in the block driver state graph
2725a16818bSKevin Wolf#
2735a16818bSKevin Wolf# Since: 2.12
2745a16818bSKevin Wolf#
2755a16818bSKevin Wolf# Example:
2765a16818bSKevin Wolf#
2775a16818bSKevin Wolf#     -> { "execute": "blockdev-add",
2785a16818bSKevin Wolf#          "arguments": {
2795a16818bSKevin Wolf#              "node-name": "node0",
2805a16818bSKevin Wolf#              "driver": "raw",
2815a16818bSKevin Wolf#              "file": { "driver": "file",
2825a16818bSKevin Wolf#                        "filename": "fedora.iso" } } }
2835a16818bSKevin Wolf#     <- { "return": {} }
2845a16818bSKevin Wolf#
2855a16818bSKevin Wolf#     -> { "execute": "blockdev-insert-medium",
2865a16818bSKevin Wolf#          "arguments": { "id": "ide0-1-0",
2875a16818bSKevin Wolf#                         "node-name": "node0" } }
2885a16818bSKevin Wolf#
2895a16818bSKevin Wolf#     <- { "return": {} }
2905a16818bSKevin Wolf##
2915a16818bSKevin Wolf{ 'command': 'blockdev-insert-medium',
2925a16818bSKevin Wolf  'data': { 'id': 'str',
2935a16818bSKevin Wolf            'node-name': 'str'} }
2945a16818bSKevin Wolf
2955a16818bSKevin Wolf##
2965a16818bSKevin Wolf# @BlockdevChangeReadOnlyMode:
2975a16818bSKevin Wolf#
2985a16818bSKevin Wolf# Specifies the new read-only mode of a block device subject to the
2995a16818bSKevin Wolf# @blockdev-change-medium command.
3005a16818bSKevin Wolf#
3015a16818bSKevin Wolf# @retain: Retains the current read-only mode
3025a16818bSKevin Wolf#
3035a16818bSKevin Wolf# @read-only: Makes the device read-only
3045a16818bSKevin Wolf#
3055a16818bSKevin Wolf# @read-write: Makes the device writable
3065a16818bSKevin Wolf#
3075a16818bSKevin Wolf# Since: 2.3
3085a16818bSKevin Wolf##
3095a16818bSKevin Wolf{ 'enum': 'BlockdevChangeReadOnlyMode',
3105a16818bSKevin Wolf  'data': ['retain', 'read-only', 'read-write'] }
3115a16818bSKevin Wolf
3125a16818bSKevin Wolf##
3135a16818bSKevin Wolf# @blockdev-change-medium:
3145a16818bSKevin Wolf#
315a937b6aaSMarkus Armbruster# Changes the medium inserted into a block device by ejecting the
316a937b6aaSMarkus Armbruster# current medium and loading a new image file which is inserted as the
317a937b6aaSMarkus Armbruster# new medium (this command combines blockdev-open-tray,
318a937b6aaSMarkus Armbruster# blockdev-remove-medium, blockdev-insert-medium and
319a937b6aaSMarkus Armbruster# blockdev-close-tray).
3205a16818bSKevin Wolf#
321df4097aeSMarkus Armbruster# @device: Block device name
3225a16818bSKevin Wolf#
323a937b6aaSMarkus Armbruster# @id: The name or QOM path of the guest device (since: 2.8)
3245a16818bSKevin Wolf#
3255a16818bSKevin Wolf# @filename: filename of the new image to be loaded
3265a16818bSKevin Wolf#
327a937b6aaSMarkus Armbruster# @format: format to open the new image with (defaults to the probed
328a937b6aaSMarkus Armbruster#     format)
3295a16818bSKevin Wolf#
3305a16818bSKevin Wolf# @read-only-mode: change the read-only mode of the device; defaults
3315a16818bSKevin Wolf#     to 'retain'
3325a16818bSKevin Wolf#
333a937b6aaSMarkus Armbruster# @force: if false (the default), an eject request through
334a937b6aaSMarkus Armbruster#     blockdev-open-tray will be sent to the guest if it has locked
335a937b6aaSMarkus Armbruster#     the tray (and the tray will not be opened immediately); if true,
336a937b6aaSMarkus Armbruster#     the tray will be opened regardless of whether it is locked.
337a937b6aaSMarkus Armbruster#     (since 7.1)
33880dd5affSDenis V. Lunev#
339df4097aeSMarkus Armbruster# Features:
340a937b6aaSMarkus Armbruster#
341df4097aeSMarkus Armbruster# @deprecated: Member @device is deprecated.  Use @id instead.
342df4097aeSMarkus Armbruster#
3435a16818bSKevin Wolf# Since: 2.5
3445a16818bSKevin Wolf#
3455a16818bSKevin Wolf# Examples:
3465a16818bSKevin Wolf#
3475a16818bSKevin Wolf#     1. Change a removable medium
3485a16818bSKevin Wolf#
3495a16818bSKevin Wolf#     -> { "execute": "blockdev-change-medium",
3505a16818bSKevin Wolf#          "arguments": { "id": "ide0-1-0",
3515a16818bSKevin Wolf#                         "filename": "/srv/images/Fedora-12-x86_64-DVD.iso",
3525a16818bSKevin Wolf#                         "format": "raw" } }
3535a16818bSKevin Wolf#     <- { "return": {} }
3545a16818bSKevin Wolf#
3555a16818bSKevin Wolf#     2. Load a read-only medium into a writable drive
3565a16818bSKevin Wolf#
3575a16818bSKevin Wolf#     -> { "execute": "blockdev-change-medium",
3585a16818bSKevin Wolf#          "arguments": { "id": "floppyA",
3595a16818bSKevin Wolf#                         "filename": "/srv/images/ro.img",
3605a16818bSKevin Wolf#                         "format": "raw",
3615a16818bSKevin Wolf#                         "read-only-mode": "retain" } }
3625a16818bSKevin Wolf#
3635a16818bSKevin Wolf#     <- { "error":
3645a16818bSKevin Wolf#          { "class": "GenericError",
3655a16818bSKevin Wolf#            "desc": "Could not open '/srv/images/ro.img': Permission denied" } }
3665a16818bSKevin Wolf#
3675a16818bSKevin Wolf#     -> { "execute": "blockdev-change-medium",
3685a16818bSKevin Wolf#          "arguments": { "id": "floppyA",
3695a16818bSKevin Wolf#                         "filename": "/srv/images/ro.img",
3705a16818bSKevin Wolf#                         "format": "raw",
3715a16818bSKevin Wolf#                         "read-only-mode": "read-only" } }
3725a16818bSKevin Wolf#
3735a16818bSKevin Wolf#     <- { "return": {} }
3745a16818bSKevin Wolf##
3755a16818bSKevin Wolf{ 'command': 'blockdev-change-medium',
376df4097aeSMarkus Armbruster  'data': { '*device': { 'type': 'str', 'features': [ 'deprecated' ] },
3775a16818bSKevin Wolf            '*id': 'str',
3785a16818bSKevin Wolf            'filename': 'str',
3795a16818bSKevin Wolf            '*format': 'str',
38080dd5affSDenis V. Lunev            '*force': 'bool',
3815a16818bSKevin Wolf            '*read-only-mode': 'BlockdevChangeReadOnlyMode' } }
3825a16818bSKevin Wolf
3835a16818bSKevin Wolf##
3845072f7b3SMarc-André Lureau# @DEVICE_TRAY_MOVED:
385a5ee7bd4SWenchao Xia#
386a937b6aaSMarkus Armbruster# Emitted whenever the tray of a removable device is moved by the
387a937b6aaSMarkus Armbruster# guest or by HMP/QMP commands
388a5ee7bd4SWenchao Xia#
389a937b6aaSMarkus Armbruster# @device: Block device name.  This is always present for
390a937b6aaSMarkus Armbruster#     compatibility reasons, but it can be empty ("") if the image
391a937b6aaSMarkus Armbruster#     does not have a device name associated.
3922d76e724SKevin Wolf#
393d750c3a9SEric Blake# @id: The name or QOM path of the guest device (since 2.8)
394a5ee7bd4SWenchao Xia#
395a937b6aaSMarkus Armbruster# @tray-open: true if the tray has been opened or false if it has been
396a937b6aaSMarkus Armbruster#     closed
397a5ee7bd4SWenchao Xia#
398a5ee7bd4SWenchao Xia# Since: 1.1
39901b7d4beSMarc-André Lureau#
40001b7d4beSMarc-André Lureau# Example:
40101b7d4beSMarc-André Lureau#
40201b7d4beSMarc-André Lureau#     <- { "event": "DEVICE_TRAY_MOVED",
40301b7d4beSMarc-André Lureau#          "data": { "device": "ide1-cd0",
40401b7d4beSMarc-André Lureau#                    "id": "/machine/unattached/device[22]",
40501b7d4beSMarc-André Lureau#                    "tray-open": true
40601b7d4beSMarc-André Lureau#          },
40701b7d4beSMarc-André Lureau#          "timestamp": { "seconds": 1265044230, "microseconds": 450486 } }
408a5ee7bd4SWenchao Xia##
409a5ee7bd4SWenchao Xia{ 'event': 'DEVICE_TRAY_MOVED',
4102d76e724SKevin Wolf  'data': { 'device': 'str', 'id': 'str', 'tray-open': 'bool' } }
4110ae053b7SChanglong Xie
4120ae053b7SChanglong Xie##
413e2c81a45SPaolo Bonzini# @PR_MANAGER_STATUS_CHANGED:
414e2c81a45SPaolo Bonzini#
415e2c81a45SPaolo Bonzini# Emitted whenever the connected status of a persistent reservation
416e2c81a45SPaolo Bonzini# manager changes.
417e2c81a45SPaolo Bonzini#
418e2c81a45SPaolo Bonzini# @id: The id of the PR manager object
419e2c81a45SPaolo Bonzini#
420e2c81a45SPaolo Bonzini# @connected: true if the PR manager is connected to a backend
421e2c81a45SPaolo Bonzini#
422e2c81a45SPaolo Bonzini# Since: 3.0
423e2c81a45SPaolo Bonzini#
424e2c81a45SPaolo Bonzini# Example:
425e2c81a45SPaolo Bonzini#
426e2c81a45SPaolo Bonzini#     <- { "event": "PR_MANAGER_STATUS_CHANGED",
427e2c81a45SPaolo Bonzini#          "data": { "id": "pr-helper0",
428e2c81a45SPaolo Bonzini#                    "connected": true
429e2c81a45SPaolo Bonzini#          },
430e2c81a45SPaolo Bonzini#          "timestamp": { "seconds": 1519840375, "microseconds": 450486 } }
431e2c81a45SPaolo Bonzini##
432e2c81a45SPaolo Bonzini{ 'event': 'PR_MANAGER_STATUS_CHANGED',
433e2c81a45SPaolo Bonzini  'data': { 'id': 'str', 'connected': 'bool' } }
4345a16818bSKevin Wolf
4355a16818bSKevin Wolf##
4365a16818bSKevin Wolf# @block_set_io_throttle:
4375a16818bSKevin Wolf#
4385a16818bSKevin Wolf# Change I/O throttle limits for a block drive.
4395a16818bSKevin Wolf#
4405a16818bSKevin Wolf# Since QEMU 2.4, each device with I/O limits is member of a throttle
4415a16818bSKevin Wolf# group.
4425a16818bSKevin Wolf#
4435a16818bSKevin Wolf# If two or more devices are members of the same group, the limits
4445a16818bSKevin Wolf# will apply to the combined I/O of the whole group in a round-robin
4455a16818bSKevin Wolf# fashion.  Therefore, setting new I/O limits to a device will affect
4465a16818bSKevin Wolf# the whole group.
4475a16818bSKevin Wolf#
4485a16818bSKevin Wolf# The name of the group can be specified using the 'group' parameter.
4495a16818bSKevin Wolf# If the parameter is unset, it is assumed to be the current group of
4505a16818bSKevin Wolf# that device.  If it's not in any group yet, the name of the device
4515a16818bSKevin Wolf# will be used as the name for its group.
4525a16818bSKevin Wolf#
4535a16818bSKevin Wolf# The 'group' parameter can also be used to move a device to a
454a937b6aaSMarkus Armbruster# different group.  In this case the limits specified in the
455a937b6aaSMarkus Armbruster# parameters will be applied to the new group only.
4565a16818bSKevin Wolf#
4575a16818bSKevin Wolf# I/O limits can be disabled by setting all of them to 0. In this case
4585a16818bSKevin Wolf# the device will be removed from its group and the rest of its
4595a16818bSKevin Wolf# members will not be affected.  The 'group' parameter is ignored.
4605a16818bSKevin Wolf#
4612746f060SMarkus Armbruster# Errors:
4625a16818bSKevin Wolf#     - If @device is not a valid block device, DeviceNotFound
4635a16818bSKevin Wolf#
4645a16818bSKevin Wolf# Since: 1.1
4655a16818bSKevin Wolf#
46637fa48a4SMarkus Armbruster# Examples:
4675a16818bSKevin Wolf#
4685a16818bSKevin Wolf#     -> { "execute": "block_set_io_throttle",
4695a16818bSKevin Wolf#          "arguments": { "id": "virtio-blk-pci0/virtio-backend",
4705a16818bSKevin Wolf#                         "bps": 0,
4715a16818bSKevin Wolf#                         "bps_rd": 0,
4725a16818bSKevin Wolf#                         "bps_wr": 0,
4735a16818bSKevin Wolf#                         "iops": 512,
4745a16818bSKevin Wolf#                         "iops_rd": 0,
4755a16818bSKevin Wolf#                         "iops_wr": 0,
4765a16818bSKevin Wolf#                         "bps_max": 0,
4775a16818bSKevin Wolf#                         "bps_rd_max": 0,
4785a16818bSKevin Wolf#                         "bps_wr_max": 0,
4795a16818bSKevin Wolf#                         "iops_max": 0,
4805a16818bSKevin Wolf#                         "iops_rd_max": 0,
4815a16818bSKevin Wolf#                         "iops_wr_max": 0,
4825a16818bSKevin Wolf#                         "bps_max_length": 0,
4835a16818bSKevin Wolf#                         "iops_size": 0 } }
4845a16818bSKevin Wolf#     <- { "return": {} }
4855a16818bSKevin Wolf#
4865a16818bSKevin Wolf#     -> { "execute": "block_set_io_throttle",
4875a16818bSKevin Wolf#          "arguments": { "id": "ide0-1-0",
4885a16818bSKevin Wolf#                         "bps": 1000000,
4895a16818bSKevin Wolf#                         "bps_rd": 0,
4905a16818bSKevin Wolf#                         "bps_wr": 0,
4915a16818bSKevin Wolf#                         "iops": 0,
4925a16818bSKevin Wolf#                         "iops_rd": 0,
4935a16818bSKevin Wolf#                         "iops_wr": 0,
4945a16818bSKevin Wolf#                         "bps_max": 8000000,
4955a16818bSKevin Wolf#                         "bps_rd_max": 0,
4965a16818bSKevin Wolf#                         "bps_wr_max": 0,
4975a16818bSKevin Wolf#                         "iops_max": 0,
4985a16818bSKevin Wolf#                         "iops_rd_max": 0,
4995a16818bSKevin Wolf#                         "iops_wr_max": 0,
5005a16818bSKevin Wolf#                         "bps_max_length": 60,
5015a16818bSKevin Wolf#                         "iops_size": 0 } }
5025a16818bSKevin Wolf#     <- { "return": {} }
5035a16818bSKevin Wolf##
5045a16818bSKevin Wolf{ 'command': 'block_set_io_throttle', 'boxed': true,
505f55ba801SPaolo Bonzini  'data': 'BlockIOThrottle',
506f55ba801SPaolo Bonzini  'allow-preconfig': true }
5075a16818bSKevin Wolf
5085a16818bSKevin Wolf##
5095a16818bSKevin Wolf# @block-latency-histogram-set:
5105a16818bSKevin Wolf#
5115a16818bSKevin Wolf# Manage read, write and flush latency histograms for the device.
5125a16818bSKevin Wolf#
513a937b6aaSMarkus Armbruster# If only @id parameter is specified, remove all present latency
514a937b6aaSMarkus Armbruster# histograms for the device.  Otherwise, add/reset some of (or all)
515a937b6aaSMarkus Armbruster# latency histograms.
5165a16818bSKevin Wolf#
5175a16818bSKevin Wolf# @id: The name or QOM path of the guest device.
5185a16818bSKevin Wolf#
5195a16818bSKevin Wolf# @boundaries: list of interval boundary values (see description in
520a937b6aaSMarkus Armbruster#     BlockLatencyHistogramInfo definition). If specified, all latency
521a937b6aaSMarkus Armbruster#     histograms are removed, and empty ones created for all io types
522a937b6aaSMarkus Armbruster#     with intervals corresponding to @boundaries (except for io
523a937b6aaSMarkus Armbruster#     types, for which specific boundaries are set through the
5245a16818bSKevin Wolf#     following parameters).
5255a16818bSKevin Wolf#
5265a16818bSKevin Wolf# @boundaries-read: list of interval boundary values for read latency
527a937b6aaSMarkus Armbruster#     histogram.  If specified, old read latency histogram is removed,
528a937b6aaSMarkus Armbruster#     and empty one created with intervals corresponding to
529a937b6aaSMarkus Armbruster#     @boundaries-read.  The parameter has higher priority then
530a937b6aaSMarkus Armbruster#     @boundaries.
5315a16818bSKevin Wolf#
532a937b6aaSMarkus Armbruster# @boundaries-write: list of interval boundary values for write
533a937b6aaSMarkus Armbruster#     latency histogram.
5345a16818bSKevin Wolf#
5359e272073SMarkus Armbruster# @boundaries-zap: list of interval boundary values for zone append
5369e272073SMarkus Armbruster#     write latency histogram.
53752eb76f4SSam Li#
538a937b6aaSMarkus Armbruster# @boundaries-flush: list of interval boundary values for flush
539a937b6aaSMarkus Armbruster#     latency histogram.
5405a16818bSKevin Wolf#
5412746f060SMarkus Armbruster# Errors:
5422746f060SMarkus Armbruster#     - if device is not found or any boundary arrays are invalid.
5435a16818bSKevin Wolf#
5445a16818bSKevin Wolf# Since: 4.0
5455a16818bSKevin Wolf#
5468b5905aaSPeter Maydell# Example:
547a937b6aaSMarkus Armbruster#
548b5e29402SMarkus Armbruster#     Set new histograms for all io types with intervals
549b5e29402SMarkus Armbruster#     [0, 10), [10, 50), [50, 100), [100, +inf):
5505a16818bSKevin Wolf#
5515a16818bSKevin Wolf#     -> { "execute": "block-latency-histogram-set",
5525a16818bSKevin Wolf#          "arguments": { "id": "drive0",
5535a16818bSKevin Wolf#                         "boundaries": [10, 50, 100] } }
5545a16818bSKevin Wolf#     <- { "return": {} }
5555a16818bSKevin Wolf#
5568b5905aaSPeter Maydell# Example:
557a937b6aaSMarkus Armbruster#
558*209e64d9SMarkus Armbruster#     Set new histogram only for write, other histograms will remain
559*209e64d9SMarkus Armbruster#     not changed (or not created):
5605a16818bSKevin Wolf#
5615a16818bSKevin Wolf#     -> { "execute": "block-latency-histogram-set",
5625a16818bSKevin Wolf#          "arguments": { "id": "drive0",
5635a16818bSKevin Wolf#                         "boundaries-write": [10, 50, 100] } }
5645a16818bSKevin Wolf#     <- { "return": {} }
5655a16818bSKevin Wolf#
5668b5905aaSPeter Maydell# Example:
567a937b6aaSMarkus Armbruster#
568b5e29402SMarkus Armbruster#     Set new histograms with the following intervals:
569b5e29402SMarkus Armbruster#       read, flush: [0, 10), [10, 50), [50, 100), [100, +inf)
570b5e29402SMarkus Armbruster#       write: [0, 1000), [1000, 5000), [5000, +inf)
5715a16818bSKevin Wolf#
5725a16818bSKevin Wolf#     -> { "execute": "block-latency-histogram-set",
5735a16818bSKevin Wolf#          "arguments": { "id": "drive0",
5745a16818bSKevin Wolf#                         "boundaries": [10, 50, 100],
5755a16818bSKevin Wolf#                         "boundaries-write": [1000, 5000] } }
5765a16818bSKevin Wolf#     <- { "return": {} }
5775a16818bSKevin Wolf#
5788b5905aaSPeter Maydell# Example:
579a937b6aaSMarkus Armbruster#
580e893b9e3SMarkus Armbruster#     Remove all latency histograms:
5815a16818bSKevin Wolf#
5825a16818bSKevin Wolf#     -> { "execute": "block-latency-histogram-set",
5835a16818bSKevin Wolf#          "arguments": { "id": "drive0" } }
5845a16818bSKevin Wolf#     <- { "return": {} }
5855a16818bSKevin Wolf##
5865a16818bSKevin Wolf{ 'command': 'block-latency-histogram-set',
5875a16818bSKevin Wolf  'data': {'id': 'str',
5885a16818bSKevin Wolf           '*boundaries': ['uint64'],
5895a16818bSKevin Wolf           '*boundaries-read': ['uint64'],
5905a16818bSKevin Wolf           '*boundaries-write': ['uint64'],
59152eb76f4SSam Li           '*boundaries-zap': ['uint64'],
592f55ba801SPaolo Bonzini           '*boundaries-flush': ['uint64'] },
593f55ba801SPaolo Bonzini  'allow-preconfig': true }
594