1# -*- Mode: Python -*- 2# vim: filetype=python 3 4## 5# = Block devices 6## 7 8{ 'include': 'block-core.json' } 9 10## 11# == Additional block stuff (VM related) 12## 13 14## 15# @BiosAtaTranslation: 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 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. 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 with 33# 1024 cylinders/head). The number of cylinders/head is then 34# computed based on the number of sectors and heads. 35# 36# @large: The number of cylinders per head is scaled down to 1024 by 37# 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 48## 49# @FloppyDriveType: 50# 51# Type of Floppy drive to be emulated by the Floppy Disk Controller. 52# 53# @144: 1.44MB 3.5" drive 54# 55# @288: 2.88MB 3.5" drive 56# 57# @120: 1.2MB 5.25" drive 58# 59# @none: No drive connected 60# 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 68## 69# @PRManagerInfo: 70# 71# Information about a persistent reservation manager 72# 73# @id: the identifier of the persistent reservation manager 74# 75# @connected: true if the persistent reservation manager is connected 76# to the underlying storage or helper 77# 78# Since: 3.0 79## 80{ 'struct': 'PRManagerInfo', 81 'data': {'id': 'str', 'connected': 'bool'} } 82 83## 84# @query-pr-managers: 85# 86# Returns a list of information about each persistent reservation 87# manager. 88# 89# Returns: a list of @PRManagerInfo for each persistent reservation 90# manager 91# 92# Since: 3.0 93## 94{ 'command': 'query-pr-managers', 'returns': ['PRManagerInfo'], 95 'allow-preconfig': true } 96 97## 98# @eject: 99# 100# Ejects the medium from a removable drive. 101# 102# @device: Block device name 103# 104# @id: The name or QOM path of the guest device (since: 2.8) 105# 106# @force: If true, eject regardless of whether the drive is locked. 107# If not specified, the default value is false. 108# 109# Features: 110# 111# @deprecated: Member @device is deprecated. Use @id instead. 112# 113# Returns: 114# - Nothing on success 115# 116# Errors: 117# - If @device is not a valid block device, DeviceNotFound 118# 119# Notes: Ejecting a device with no media results in success 120# 121# Since: 0.14 122# 123# 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# 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# 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# 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# 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# Examples: 349# 350# 1. Change a removable medium 351# 352# -> { "execute": "blockdev-change-medium", 353# "arguments": { "id": "ide0-1-0", 354# "filename": "/srv/images/Fedora-12-x86_64-DVD.iso", 355# "format": "raw" } } 356# <- { "return": {} } 357# 358# 2. 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# 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# 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 case 461# 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# Returns: 465# - Nothing on success 466# 467# Errors: 468# - If @device is not a valid block device, DeviceNotFound 469# 470# Since: 1.1 471# 472# Examples: 473# 474# -> { "execute": "block_set_io_throttle", 475# "arguments": { "id": "virtio-blk-pci0/virtio-backend", 476# "bps": 0, 477# "bps_rd": 0, 478# "bps_wr": 0, 479# "iops": 512, 480# "iops_rd": 0, 481# "iops_wr": 0, 482# "bps_max": 0, 483# "bps_rd_max": 0, 484# "bps_wr_max": 0, 485# "iops_max": 0, 486# "iops_rd_max": 0, 487# "iops_wr_max": 0, 488# "bps_max_length": 0, 489# "iops_size": 0 } } 490# <- { "return": {} } 491# 492# -> { "execute": "block_set_io_throttle", 493# "arguments": { "id": "ide0-1-0", 494# "bps": 1000000, 495# "bps_rd": 0, 496# "bps_wr": 0, 497# "iops": 0, 498# "iops_rd": 0, 499# "iops_wr": 0, 500# "bps_max": 8000000, 501# "bps_rd_max": 0, 502# "bps_wr_max": 0, 503# "iops_max": 0, 504# "iops_rd_max": 0, 505# "iops_wr_max": 0, 506# "bps_max_length": 60, 507# "iops_size": 0 } } 508# <- { "return": {} } 509## 510{ 'command': 'block_set_io_throttle', 'boxed': true, 511 'data': 'BlockIOThrottle', 512 'allow-preconfig': true } 513 514## 515# @block-latency-histogram-set: 516# 517# Manage read, write and flush latency histograms for the device. 518# 519# If only @id parameter is specified, remove all present latency 520# histograms for the device. Otherwise, add/reset some of (or all) 521# latency histograms. 522# 523# @id: The name or QOM path of the guest device. 524# 525# @boundaries: list of interval boundary values (see description in 526# BlockLatencyHistogramInfo definition). If specified, all latency 527# histograms are removed, and empty ones created for all io types 528# with intervals corresponding to @boundaries (except for io 529# types, for which specific boundaries are set through the 530# following parameters). 531# 532# @boundaries-read: list of interval boundary values for read latency 533# histogram. If specified, old read latency histogram is removed, 534# and empty one created with intervals corresponding to 535# @boundaries-read. The parameter has higher priority then 536# @boundaries. 537# 538# @boundaries-write: list of interval boundary values for write 539# latency histogram. 540# 541# @boundaries-zap: list of interval boundary values for zone append 542# write latency histogram. 543# 544# @boundaries-flush: list of interval boundary values for flush 545# latency histogram. 546# 547# Errors: 548# - if device is not found or any boundary arrays are invalid. 549# 550# Since: 4.0 551# 552# Example: 553# 554# Set new histograms for all io types with intervals [0, 10), [10, 555# 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# Example: 563# 564# Set new histogram only for write, other histograms will remain not 565# changed (or not created): 566# 567# -> { "execute": "block-latency-histogram-set", 568# "arguments": { "id": "drive0", 569# "boundaries-write": [10, 50, 100] } } 570# <- { "return": {} } 571# 572# Example: 573# 574# Set new histograms with the following intervals: read, flush: [0, 575# 10), [10, 50), [50, 100), [100, +inf) write: [0, 1000), [1000, 576# 5000), [5000, +inf) 577# 578# -> { "execute": "block-latency-histogram-set", 579# "arguments": { "id": "drive0", 580# "boundaries": [10, 50, 100], 581# "boundaries-write": [1000, 5000] } } 582# <- { "return": {} } 583# 584# Example: 585# 586# Remove all latency histograms: 587# 588# -> { "execute": "block-latency-histogram-set", 589# "arguments": { "id": "drive0" } } 590# <- { "return": {} } 591## 592{ 'command': 'block-latency-histogram-set', 593 'data': {'id': 'str', 594 '*boundaries': ['uint64'], 595 '*boundaries-read': ['uint64'], 596 '*boundaries-write': ['uint64'], 597 '*boundaries-zap': ['uint64'], 598 '*boundaries-flush': ['uint64'] }, 599 'allow-preconfig': true } 600