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