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# @BlockdevSnapshotInternal: 65# 66# @device: the device name or node-name of a root node to generate the snapshot 67# from 68# 69# @name: the name of the internal snapshot to be created 70# 71# Notes: In transaction, if @name is empty, or any snapshot matching @name 72# exists, the operation will fail. Only some image formats support it, 73# for example, qcow2, rbd, and sheepdog. 74# 75# Since: 1.7 76## 77{ 'struct': 'BlockdevSnapshotInternal', 78 'data': { 'device': 'str', 'name': 'str' } } 79 80## 81# @blockdev-snapshot-internal-sync: 82# 83# Synchronously take an internal snapshot of a block device, when the 84# format of the image used supports it. If the name is an empty 85# string, or a snapshot with name already exists, the operation will 86# fail. 87# 88# For the arguments, see the documentation of BlockdevSnapshotInternal. 89# 90# Returns: nothing on success 91# 92# If @device is not a valid block device, GenericError 93# 94# If any snapshot matching @name exists, or @name is empty, 95# GenericError 96# 97# If the format of the image used does not support it, 98# BlockFormatFeatureNotSupported 99# 100# Since: 1.7 101# 102# Example: 103# 104# -> { "execute": "blockdev-snapshot-internal-sync", 105# "arguments": { "device": "ide-hd0", 106# "name": "snapshot0" } 107# } 108# <- { "return": {} } 109# 110## 111{ 'command': 'blockdev-snapshot-internal-sync', 112 'data': 'BlockdevSnapshotInternal' } 113 114## 115# @blockdev-snapshot-delete-internal-sync: 116# 117# Synchronously delete an internal snapshot of a block device, when the format 118# of the image used support it. The snapshot is identified by name or id or 119# both. One of the name or id is required. Return SnapshotInfo for the 120# successfully deleted snapshot. 121# 122# @device: the device name or node-name of a root node to delete the snapshot 123# from 124# 125# @id: optional the snapshot's ID to be deleted 126# 127# @name: optional the snapshot's name to be deleted 128# 129# Returns: SnapshotInfo on success 130# If @device is not a valid block device, GenericError 131# If snapshot not found, GenericError 132# If the format of the image used does not support it, 133# BlockFormatFeatureNotSupported 134# If @id and @name are both not specified, GenericError 135# 136# Since: 1.7 137# 138# Example: 139# 140# -> { "execute": "blockdev-snapshot-delete-internal-sync", 141# "arguments": { "device": "ide-hd0", 142# "name": "snapshot0" } 143# } 144# <- { "return": { 145# "id": "1", 146# "name": "snapshot0", 147# "vm-state-size": 0, 148# "date-sec": 1000012, 149# "date-nsec": 10, 150# "vm-clock-sec": 100, 151# "vm-clock-nsec": 20 152# } 153# } 154# 155## 156{ 'command': 'blockdev-snapshot-delete-internal-sync', 157 'data': { 'device': 'str', '*id': 'str', '*name': 'str'}, 158 'returns': 'SnapshotInfo' } 159 160## 161# @eject: 162# 163# Ejects a device from a removable drive. 164# 165# @device: Block device name (deprecated, use @id instead) 166# 167# @id: The name or QOM path of the guest device (since: 2.8) 168# 169# @force: If true, eject regardless of whether the drive is locked. 170# If not specified, the default value is false. 171# 172# Returns: Nothing on success 173# 174# If @device is not a valid block device, DeviceNotFound 175# 176# Notes: Ejecting a device with no media results in success 177# 178# Since: 0.14.0 179# 180# Example: 181# 182# -> { "execute": "eject", "arguments": { "id": "ide1-0-1" } } 183# <- { "return": {} } 184## 185{ 'command': 'eject', 186 'data': { '*device': 'str', 187 '*id': 'str', 188 '*force': 'bool' } } 189 190## 191# @nbd-server-start: 192# 193# Start an NBD server listening on the given host and port. Block 194# devices can then be exported using @nbd-server-add. The NBD 195# server will present them as named exports; for example, another 196# QEMU instance could refer to them as "nbd:HOST:PORT:exportname=NAME". 197# 198# @addr: Address on which to listen. 199# @tls-creds: (optional) ID of the TLS credentials object. Since 2.6 200# 201# Returns: error if the server is already running. 202# 203# Since: 1.3.0 204## 205{ 'command': 'nbd-server-start', 206 'data': { 'addr': 'SocketAddressLegacy', 207 '*tls-creds': 'str'} } 208 209## 210# @nbd-server-add: 211# 212# Export a block node to QEMU's embedded NBD server. 213# 214# @device: The device name or node name of the node to be exported 215# 216# @name: Export name. If unspecified, the @device parameter is used as the 217# export name. (Since 2.12) 218# 219# @writable: Whether clients should be able to write to the device via the 220# NBD connection (default false). 221# 222# Returns: error if the server is not running, or export with the same name 223# already exists. 224# 225# Since: 1.3.0 226## 227{ 'command': 'nbd-server-add', 228 'data': {'device': 'str', '*name': 'str', '*writable': 'bool'} } 229 230## 231# @NbdServerRemoveMode: 232# 233# Mode for removing an NBD export. 234# 235# @safe: Remove export if there are no existing connections, fail otherwise. 236# 237# @hard: Drop all connections immediately and remove export. 238# 239# Potential additional modes to be added in the future: 240# 241# hide: Just hide export from new clients, leave existing connections as is. 242# Remove export after all clients are disconnected. 243# 244# soft: Hide export from new clients, answer with ESHUTDOWN for all further 245# requests from existing clients. 246# 247# Since: 2.12 248## 249{'enum': 'NbdServerRemoveMode', 'data': ['safe', 'hard']} 250 251## 252# @nbd-server-remove: 253# 254# Remove NBD export by name. 255# 256# @name: Export name. 257# 258# @mode: Mode of command operation. See @NbdServerRemoveMode description. 259# Default is 'safe'. 260# 261# Returns: error if 262# - the server is not running 263# - export is not found 264# - mode is 'safe' and there are existing connections 265# 266# Since: 2.12 267## 268{ 'command': 'nbd-server-remove', 269 'data': {'name': 'str', '*mode': 'NbdServerRemoveMode'} } 270 271## 272# @x-nbd-server-add-bitmap: 273# 274# Expose a dirty bitmap associated with the selected export. The bitmap search 275# starts at the device attached to the export, and includes all backing files. 276# The exported bitmap is then locked until the NBD export is removed. 277# 278# @name: Export name. 279# 280# @bitmap: Bitmap name to search for. 281# 282# @bitmap-export-name: How the bitmap will be seen by nbd clients 283# (default @bitmap) 284# 285# Note: the client must use NBD_OPT_SET_META_CONTEXT with a query of 286# "qemu:dirty-bitmap:NAME" (where NAME matches @bitmap-export-name) to access 287# the exposed bitmap. 288# 289# Since: 3.0 290## 291 { 'command': 'x-nbd-server-add-bitmap', 292 'data': {'name': 'str', 'bitmap': 'str', '*bitmap-export-name': 'str'} } 293 294## 295# @nbd-server-stop: 296# 297# Stop QEMU's embedded NBD server, and unregister all devices previously 298# added via @nbd-server-add. 299# 300# Since: 1.3.0 301## 302{ 'command': 'nbd-server-stop' } 303 304## 305# @DEVICE_TRAY_MOVED: 306# 307# Emitted whenever the tray of a removable device is moved by the guest or by 308# HMP/QMP commands 309# 310# @device: Block device name. This is always present for compatibility 311# reasons, but it can be empty ("") if the image does not 312# have a device name associated. 313# 314# @id: The name or QOM path of the guest device (since 2.8) 315# 316# @tray-open: true if the tray has been opened or false if it has been closed 317# 318# Since: 1.1 319# 320# Example: 321# 322# <- { "event": "DEVICE_TRAY_MOVED", 323# "data": { "device": "ide1-cd0", 324# "id": "/machine/unattached/device[22]", 325# "tray-open": true 326# }, 327# "timestamp": { "seconds": 1265044230, "microseconds": 450486 } } 328# 329## 330{ 'event': 'DEVICE_TRAY_MOVED', 331 'data': { 'device': 'str', 'id': 'str', 'tray-open': 'bool' } } 332 333## 334# @QuorumOpType: 335# 336# An enumeration of the quorum operation types 337# 338# @read: read operation 339# 340# @write: write operation 341# 342# @flush: flush operation 343# 344# Since: 2.6 345## 346{ 'enum': 'QuorumOpType', 347 'data': [ 'read', 'write', 'flush' ] } 348 349## 350# @QUORUM_FAILURE: 351# 352# Emitted by the Quorum block driver if it fails to establish a quorum 353# 354# @reference: device name if defined else node name 355# 356# @sector-num: number of the first sector of the failed read operation 357# 358# @sectors-count: failed read operation sector count 359# 360# Note: This event is rate-limited. 361# 362# Since: 2.0 363# 364# Example: 365# 366# <- { "event": "QUORUM_FAILURE", 367# "data": { "reference": "usr1", "sector-num": 345435, "sectors-count": 5 }, 368# "timestamp": { "seconds": 1344522075, "microseconds": 745528 } } 369# 370## 371{ 'event': 'QUORUM_FAILURE', 372 'data': { 'reference': 'str', 'sector-num': 'int', 'sectors-count': 'int' } } 373 374## 375# @QUORUM_REPORT_BAD: 376# 377# Emitted to report a corruption of a Quorum file 378# 379# @type: quorum operation type (Since 2.6) 380# 381# @error: error message. Only present on failure. This field 382# contains a human-readable error message. There are no semantics other 383# than that the block layer reported an error and clients should not 384# try to interpret the error string. 385# 386# @node-name: the graph node name of the block driver state 387# 388# @sector-num: number of the first sector of the failed read operation 389# 390# @sectors-count: failed read operation sector count 391# 392# Note: This event is rate-limited. 393# 394# Since: 2.0 395# 396# Example: 397# 398# 1. Read operation 399# 400# { "event": "QUORUM_REPORT_BAD", 401# "data": { "node-name": "node0", "sector-num": 345435, "sectors-count": 5, 402# "type": "read" }, 403# "timestamp": { "seconds": 1344522075, "microseconds": 745528 } } 404# 405# 2. Flush operation 406# 407# { "event": "QUORUM_REPORT_BAD", 408# "data": { "node-name": "node0", "sector-num": 0, "sectors-count": 2097120, 409# "type": "flush", "error": "Broken pipe" }, 410# "timestamp": { "seconds": 1456406829, "microseconds": 291763 } } 411# 412## 413{ 'event': 'QUORUM_REPORT_BAD', 414 'data': { 'type': 'QuorumOpType', '*error': 'str', 'node-name': 'str', 415 'sector-num': 'int', 'sectors-count': 'int' } } 416