1# -*- Mode: Python -*- 2# 3# QAPI block core definitions (vm unrelated) 4 5# QAPI common definitions 6{ 'include': 'common.json' } 7 8## 9# @SnapshotInfo 10# 11# @id: unique snapshot id 12# 13# @name: user chosen name 14# 15# @vm-state-size: size of the VM state 16# 17# @date-sec: UTC date of the snapshot in seconds 18# 19# @date-nsec: fractional part in nano seconds to be used with date-sec 20# 21# @vm-clock-sec: VM clock relative to boot in seconds 22# 23# @vm-clock-nsec: fractional part in nano seconds to be used with vm-clock-sec 24# 25# Since: 1.3 26# 27## 28 29{ 'type': 'SnapshotInfo', 30 'data': { 'id': 'str', 'name': 'str', 'vm-state-size': 'int', 31 'date-sec': 'int', 'date-nsec': 'int', 32 'vm-clock-sec': 'int', 'vm-clock-nsec': 'int' } } 33 34## 35# @ImageInfoSpecificQCow2: 36# 37# @compat: compatibility level 38# 39# @lazy-refcounts: #optional on or off; only valid for compat >= 1.1 40# 41# @corrupt: #optional true if the image has been marked corrupt; only valid for 42# compat >= 1.1 (since 2.2) 43# 44# @refcount-bits: width of a refcount entry in bits (since 2.3) 45# 46# Since: 1.7 47## 48{ 'type': 'ImageInfoSpecificQCow2', 49 'data': { 50 'compat': 'str', 51 '*lazy-refcounts': 'bool', 52 '*corrupt': 'bool', 53 'refcount-bits': 'int' 54 } } 55 56## 57# @ImageInfoSpecificVmdk: 58# 59# @create-type: The create type of VMDK image 60# 61# @cid: Content id of image 62# 63# @parent-cid: Parent VMDK image's cid 64# 65# @extents: List of extent files 66# 67# Since: 1.7 68## 69{ 'type': 'ImageInfoSpecificVmdk', 70 'data': { 71 'create-type': 'str', 72 'cid': 'int', 73 'parent-cid': 'int', 74 'extents': ['ImageInfo'] 75 } } 76 77## 78# @ImageInfoSpecific: 79# 80# A discriminated record of image format specific information structures. 81# 82# Since: 1.7 83## 84 85{ 'union': 'ImageInfoSpecific', 86 'data': { 87 'qcow2': 'ImageInfoSpecificQCow2', 88 'vmdk': 'ImageInfoSpecificVmdk' 89 } } 90 91## 92# @ImageInfo: 93# 94# Information about a QEMU image file 95# 96# @filename: name of the image file 97# 98# @format: format of the image file 99# 100# @virtual-size: maximum capacity in bytes of the image 101# 102# @actual-size: #optional actual size on disk in bytes of the image 103# 104# @dirty-flag: #optional true if image is not cleanly closed 105# 106# @cluster-size: #optional size of a cluster in bytes 107# 108# @encrypted: #optional true if the image is encrypted 109# 110# @compressed: #optional true if the image is compressed (Since 1.7) 111# 112# @backing-filename: #optional name of the backing file 113# 114# @full-backing-filename: #optional full path of the backing file 115# 116# @backing-filename-format: #optional the format of the backing file 117# 118# @snapshots: #optional list of VM snapshots 119# 120# @backing-image: #optional info of the backing image (since 1.6) 121# 122# @format-specific: #optional structure supplying additional format-specific 123# information (since 1.7) 124# 125# Since: 1.3 126# 127## 128 129{ 'type': 'ImageInfo', 130 'data': {'filename': 'str', 'format': 'str', '*dirty-flag': 'bool', 131 '*actual-size': 'int', 'virtual-size': 'int', 132 '*cluster-size': 'int', '*encrypted': 'bool', '*compressed': 'bool', 133 '*backing-filename': 'str', '*full-backing-filename': 'str', 134 '*backing-filename-format': 'str', '*snapshots': ['SnapshotInfo'], 135 '*backing-image': 'ImageInfo', 136 '*format-specific': 'ImageInfoSpecific' } } 137 138## 139# @ImageCheck: 140# 141# Information about a QEMU image file check 142# 143# @filename: name of the image file checked 144# 145# @format: format of the image file checked 146# 147# @check-errors: number of unexpected errors occurred during check 148# 149# @image-end-offset: #optional offset (in bytes) where the image ends, this 150# field is present if the driver for the image format 151# supports it 152# 153# @corruptions: #optional number of corruptions found during the check if any 154# 155# @leaks: #optional number of leaks found during the check if any 156# 157# @corruptions-fixed: #optional number of corruptions fixed during the check 158# if any 159# 160# @leaks-fixed: #optional number of leaks fixed during the check if any 161# 162# @total-clusters: #optional total number of clusters, this field is present 163# if the driver for the image format supports it 164# 165# @allocated-clusters: #optional total number of allocated clusters, this 166# field is present if the driver for the image format 167# supports it 168# 169# @fragmented-clusters: #optional total number of fragmented clusters, this 170# field is present if the driver for the image format 171# supports it 172# 173# @compressed-clusters: #optional total number of compressed clusters, this 174# field is present if the driver for the image format 175# supports it 176# 177# Since: 1.4 178# 179## 180 181{ 'type': 'ImageCheck', 182 'data': {'filename': 'str', 'format': 'str', 'check-errors': 'int', 183 '*image-end-offset': 'int', '*corruptions': 'int', '*leaks': 'int', 184 '*corruptions-fixed': 'int', '*leaks-fixed': 'int', 185 '*total-clusters': 'int', '*allocated-clusters': 'int', 186 '*fragmented-clusters': 'int', '*compressed-clusters': 'int' } } 187 188## 189# @BlockdevCacheInfo 190# 191# Cache mode information for a block device 192# 193# @writeback: true if writeback mode is enabled 194# @direct: true if the host page cache is bypassed (O_DIRECT) 195# @no-flush: true if flush requests are ignored for the device 196# 197# Since: 2.3 198## 199{ 'type': 'BlockdevCacheInfo', 200 'data': { 'writeback': 'bool', 201 'direct': 'bool', 202 'no-flush': 'bool' } } 203 204## 205# @BlockDeviceInfo: 206# 207# Information about the backing device for a block device. 208# 209# @file: the filename of the backing device 210# 211# @node-name: #optional the name of the block driver node (Since 2.0) 212# 213# @ro: true if the backing device was open read-only 214# 215# @drv: the name of the block format used to open the backing device. As of 216# 0.14.0 this can be: 'blkdebug', 'bochs', 'cloop', 'cow', 'dmg', 217# 'file', 'file', 'ftp', 'ftps', 'host_cdrom', 'host_device', 218# 'host_floppy', 'http', 'https', 'nbd', 'parallels', 'qcow', 219# 'qcow2', 'raw', 'tftp', 'vdi', 'vmdk', 'vpc', 'vvfat' 220# 2.2: 'archipelago' added, 'cow' dropped 221# 2.3: 'host_floppy' deprecated 222# 223# @backing_file: #optional the name of the backing file (for copy-on-write) 224# 225# @backing_file_depth: number of files in the backing file chain (since: 1.2) 226# 227# @encrypted: true if the backing device is encrypted 228# 229# @encryption_key_missing: true if the backing device is encrypted but an 230# valid encryption key is missing 231# 232# @detect_zeroes: detect and optimize zero writes (Since 2.1) 233# 234# @bps: total throughput limit in bytes per second is specified 235# 236# @bps_rd: read throughput limit in bytes per second is specified 237# 238# @bps_wr: write throughput limit in bytes per second is specified 239# 240# @iops: total I/O operations per second is specified 241# 242# @iops_rd: read I/O operations per second is specified 243# 244# @iops_wr: write I/O operations per second is specified 245# 246# @image: the info of image used (since: 1.6) 247# 248# @bps_max: #optional total max in bytes (Since 1.7) 249# 250# @bps_rd_max: #optional read max in bytes (Since 1.7) 251# 252# @bps_wr_max: #optional write max in bytes (Since 1.7) 253# 254# @iops_max: #optional total I/O operations max (Since 1.7) 255# 256# @iops_rd_max: #optional read I/O operations max (Since 1.7) 257# 258# @iops_wr_max: #optional write I/O operations max (Since 1.7) 259# 260# @iops_size: #optional an I/O size in bytes (Since 1.7) 261# 262# @cache: the cache mode used for the block device (since: 2.3) 263# 264# @write_threshold: configured write threshold for the device. 265# 0 if disabled. (Since 2.3) 266# 267# Since: 0.14.0 268# 269## 270{ 'type': 'BlockDeviceInfo', 271 'data': { 'file': 'str', '*node-name': 'str', 'ro': 'bool', 'drv': 'str', 272 '*backing_file': 'str', 'backing_file_depth': 'int', 273 'encrypted': 'bool', 'encryption_key_missing': 'bool', 274 'detect_zeroes': 'BlockdevDetectZeroesOptions', 275 'bps': 'int', 'bps_rd': 'int', 'bps_wr': 'int', 276 'iops': 'int', 'iops_rd': 'int', 'iops_wr': 'int', 277 'image': 'ImageInfo', 278 '*bps_max': 'int', '*bps_rd_max': 'int', 279 '*bps_wr_max': 'int', '*iops_max': 'int', 280 '*iops_rd_max': 'int', '*iops_wr_max': 'int', 281 '*iops_size': 'int', 'cache': 'BlockdevCacheInfo', 282 'write_threshold': 'int' } } 283 284## 285# @BlockDeviceIoStatus: 286# 287# An enumeration of block device I/O status. 288# 289# @ok: The last I/O operation has succeeded 290# 291# @failed: The last I/O operation has failed 292# 293# @nospace: The last I/O operation has failed due to a no-space condition 294# 295# Since: 1.0 296## 297{ 'enum': 'BlockDeviceIoStatus', 'data': [ 'ok', 'failed', 'nospace' ] } 298 299## 300# @BlockDeviceMapEntry: 301# 302# Entry in the metadata map of the device (returned by "qemu-img map") 303# 304# @start: Offset in the image of the first byte described by this entry 305# (in bytes) 306# 307# @length: Length of the range described by this entry (in bytes) 308# 309# @depth: Number of layers (0 = top image, 1 = top image's backing file, etc.) 310# before reaching one for which the range is allocated. The value is 311# in the range 0 to the depth of the image chain - 1. 312# 313# @zero: the sectors in this range read as zeros 314# 315# @data: reading the image will actually read data from a file (in particular, 316# if @offset is present this means that the sectors are not simply 317# preallocated, but contain actual data in raw format) 318# 319# @offset: if present, the image file stores the data for this range in 320# raw format at the given offset. 321# 322# Since 1.7 323## 324{ 'type': 'BlockDeviceMapEntry', 325 'data': { 'start': 'int', 'length': 'int', 'depth': 'int', 'zero': 'bool', 326 'data': 'bool', '*offset': 'int' } } 327 328## 329# @BlockDirtyInfo: 330# 331# Block dirty bitmap information. 332# 333# @name: #optional the name of the dirty bitmap (Since 2.4) 334# 335# @count: number of dirty bytes according to the dirty bitmap 336# 337# @granularity: granularity of the dirty bitmap in bytes (since 1.4) 338# 339# Since: 1.3 340## 341{ 'type': 'BlockDirtyInfo', 342 'data': {'*name': 'str', 'count': 'int', 'granularity': 'uint32'} } 343 344## 345# @BlockInfo: 346# 347# Block device information. This structure describes a virtual device and 348# the backing device associated with it. 349# 350# @device: The device name associated with the virtual device. 351# 352# @type: This field is returned only for compatibility reasons, it should 353# not be used (always returns 'unknown') 354# 355# @removable: True if the device supports removable media. 356# 357# @locked: True if the guest has locked this device from having its media 358# removed 359# 360# @tray_open: #optional True if the device has a tray and it is open 361# (only present if removable is true) 362# 363# @dirty-bitmaps: #optional dirty bitmaps information (only present if the 364# driver has one or more dirty bitmaps) (Since 2.0) 365# 366# @io-status: #optional @BlockDeviceIoStatus. Only present if the device 367# supports it and the VM is configured to stop on errors 368# (supported device models: virtio-blk, ide, scsi-disk) 369# 370# @inserted: #optional @BlockDeviceInfo describing the device if media is 371# present 372# 373# Since: 0.14.0 374## 375{ 'type': 'BlockInfo', 376 'data': {'device': 'str', 'type': 'str', 'removable': 'bool', 377 'locked': 'bool', '*inserted': 'BlockDeviceInfo', 378 '*tray_open': 'bool', '*io-status': 'BlockDeviceIoStatus', 379 '*dirty-bitmaps': ['BlockDirtyInfo'] } } 380 381## 382# @query-block: 383# 384# Get a list of BlockInfo for all virtual block devices. 385# 386# Returns: a list of @BlockInfo describing each virtual block device 387# 388# Since: 0.14.0 389## 390{ 'command': 'query-block', 'returns': ['BlockInfo'] } 391 392## 393# @BlockDeviceStats: 394# 395# Statistics of a virtual block device or a block backing device. 396# 397# @rd_bytes: The number of bytes read by the device. 398# 399# @wr_bytes: The number of bytes written by the device. 400# 401# @rd_operations: The number of read operations performed by the device. 402# 403# @wr_operations: The number of write operations performed by the device. 404# 405# @flush_operations: The number of cache flush operations performed by the 406# device (since 0.15.0) 407# 408# @flush_total_time_ns: Total time spend on cache flushes in nano-seconds 409# (since 0.15.0). 410# 411# @wr_total_time_ns: Total time spend on writes in nano-seconds (since 0.15.0). 412# 413# @rd_total_time_ns: Total_time_spend on reads in nano-seconds (since 0.15.0). 414# 415# @wr_highest_offset: The offset after the greatest byte written to the 416# device. The intended use of this information is for 417# growable sparse files (like qcow2) that are used on top 418# of a physical device. 419# 420# @rd_merged: Number of read requests that have been merged into another 421# request (Since 2.3). 422# 423# @wr_merged: Number of write requests that have been merged into another 424# request (Since 2.3). 425# 426# Since: 0.14.0 427## 428{ 'type': 'BlockDeviceStats', 429 'data': {'rd_bytes': 'int', 'wr_bytes': 'int', 'rd_operations': 'int', 430 'wr_operations': 'int', 'flush_operations': 'int', 431 'flush_total_time_ns': 'int', 'wr_total_time_ns': 'int', 432 'rd_total_time_ns': 'int', 'wr_highest_offset': 'int', 433 'rd_merged': 'int', 'wr_merged': 'int' } } 434 435## 436# @BlockStats: 437# 438# Statistics of a virtual block device or a block backing device. 439# 440# @device: #optional If the stats are for a virtual block device, the name 441# corresponding to the virtual block device. 442# 443# @node-name: #optional The node name of the device. (Since 2.3) 444# 445# @stats: A @BlockDeviceStats for the device. 446# 447# @parent: #optional This describes the file block device if it has one. 448# 449# @backing: #optional This describes the backing block device if it has one. 450# (Since 2.0) 451# 452# Since: 0.14.0 453## 454{ 'type': 'BlockStats', 455 'data': {'*device': 'str', '*node-name': 'str', 456 'stats': 'BlockDeviceStats', 457 '*parent': 'BlockStats', 458 '*backing': 'BlockStats'} } 459 460## 461# @query-blockstats: 462# 463# Query the @BlockStats for all virtual block devices. 464# 465# @query-nodes: #optional If true, the command will query all the block nodes 466# that have a node name, in a list which will include "parent" 467# information, but not "backing". 468# If false or omitted, the behavior is as before - query all the 469# device backends, recursively including their "parent" and 470# "backing". (Since 2.3) 471# 472# Returns: A list of @BlockStats for each virtual block devices. 473# 474# Since: 0.14.0 475## 476{ 'command': 'query-blockstats', 477 'data': { '*query-nodes': 'bool' }, 478 'returns': ['BlockStats'] } 479 480## 481# @BlockdevOnError: 482# 483# An enumeration of possible behaviors for errors on I/O operations. 484# The exact meaning depends on whether the I/O was initiated by a guest 485# or by a block job 486# 487# @report: for guest operations, report the error to the guest; 488# for jobs, cancel the job 489# 490# @ignore: ignore the error, only report a QMP event (BLOCK_IO_ERROR 491# or BLOCK_JOB_ERROR) 492# 493# @enospc: same as @stop on ENOSPC, same as @report otherwise. 494# 495# @stop: for guest operations, stop the virtual machine; 496# for jobs, pause the job 497# 498# Since: 1.3 499## 500{ 'enum': 'BlockdevOnError', 501 'data': ['report', 'ignore', 'enospc', 'stop'] } 502 503## 504# @MirrorSyncMode: 505# 506# An enumeration of possible behaviors for the initial synchronization 507# phase of storage mirroring. 508# 509# @top: copies data in the topmost image to the destination 510# 511# @full: copies data from all images to the destination 512# 513# @none: only copy data written from now on 514# 515# @dirty-bitmap: only copy data described by the dirty bitmap. Since: 2.4 516# 517# Since: 1.3 518## 519{ 'enum': 'MirrorSyncMode', 520 'data': ['top', 'full', 'none', 'dirty-bitmap'] } 521 522## 523# @BlockJobType: 524# 525# Type of a block job. 526# 527# @commit: block commit job type, see "block-commit" 528# 529# @stream: block stream job type, see "block-stream" 530# 531# @mirror: drive mirror job type, see "drive-mirror" 532# 533# @backup: drive backup job type, see "drive-backup" 534# 535# Since: 1.7 536## 537{ 'enum': 'BlockJobType', 538 'data': ['commit', 'stream', 'mirror', 'backup'] } 539 540## 541# @BlockJobInfo: 542# 543# Information about a long-running block device operation. 544# 545# @type: the job type ('stream' for image streaming) 546# 547# @device: the block device name 548# 549# @len: the maximum progress value 550# 551# @busy: false if the job is known to be in a quiescent state, with 552# no pending I/O. Since 1.3. 553# 554# @paused: whether the job is paused or, if @busy is true, will 555# pause itself as soon as possible. Since 1.3. 556# 557# @offset: the current progress value 558# 559# @speed: the rate limit, bytes per second 560# 561# @io-status: the status of the job (since 1.3) 562# 563# @ready: true if the job may be completed (since 2.2) 564# 565# Since: 1.1 566## 567{ 'type': 'BlockJobInfo', 568 'data': {'type': 'str', 'device': 'str', 'len': 'int', 569 'offset': 'int', 'busy': 'bool', 'paused': 'bool', 'speed': 'int', 570 'io-status': 'BlockDeviceIoStatus', 'ready': 'bool'} } 571 572## 573# @query-block-jobs: 574# 575# Return information about long-running block device operations. 576# 577# Returns: a list of @BlockJobInfo for each active block job 578# 579# Since: 1.1 580## 581{ 'command': 'query-block-jobs', 'returns': ['BlockJobInfo'] } 582 583## 584# @block_passwd: 585# 586# This command sets the password of a block device that has not been open 587# with a password and requires one. 588# 589# The two cases where this can happen are a block device is created through 590# QEMU's initial command line or a block device is changed through the legacy 591# @change interface. 592# 593# In the event that the block device is created through the initial command 594# line, the VM will start in the stopped state regardless of whether '-S' is 595# used. The intention is for a management tool to query the block devices to 596# determine which ones are encrypted, set the passwords with this command, and 597# then start the guest with the @cont command. 598# 599# Either @device or @node-name must be set but not both. 600# 601# @device: #optional the name of the block backend device to set the password on 602# 603# @node-name: #optional graph node name to set the password on (Since 2.0) 604# 605# @password: the password to use for the device 606# 607# Returns: nothing on success 608# If @device is not a valid block device, DeviceNotFound 609# If @device is not encrypted, DeviceNotEncrypted 610# 611# Notes: Not all block formats support encryption and some that do are not 612# able to validate that a password is correct. Disk corruption may 613# occur if an invalid password is specified. 614# 615# Since: 0.14.0 616## 617{ 'command': 'block_passwd', 'data': {'*device': 'str', 618 '*node-name': 'str', 'password': 'str'} } 619 620## 621# @block_resize 622# 623# Resize a block image while a guest is running. 624# 625# Either @device or @node-name must be set but not both. 626# 627# @device: #optional the name of the device to get the image resized 628# 629# @node-name: #optional graph node name to get the image resized (Since 2.0) 630# 631# @size: new image size in bytes 632# 633# Returns: nothing on success 634# If @device is not a valid block device, DeviceNotFound 635# 636# Since: 0.14.0 637## 638{ 'command': 'block_resize', 'data': { '*device': 'str', 639 '*node-name': 'str', 640 'size': 'int' }} 641 642## 643# @NewImageMode 644# 645# An enumeration that tells QEMU how to set the backing file path in 646# a new image file. 647# 648# @existing: QEMU should look for an existing image file. 649# 650# @absolute-paths: QEMU should create a new image with absolute paths 651# for the backing file. If there is no backing file available, the new 652# image will not be backed either. 653# 654# Since: 1.1 655## 656{ 'enum': 'NewImageMode', 657 'data': [ 'existing', 'absolute-paths' ] } 658 659## 660# @BlockdevSnapshot 661# 662# Either @device or @node-name must be set but not both. 663# 664# @device: #optional the name of the device to generate the snapshot from. 665# 666# @node-name: #optional graph node name to generate the snapshot from (Since 2.0) 667# 668# @snapshot-file: the target of the new image. A new file will be created. 669# 670# @snapshot-node-name: #optional the graph node name of the new image (Since 2.0) 671# 672# @format: #optional the format of the snapshot image, default is 'qcow2'. 673# 674# @mode: #optional whether and how QEMU should create a new image, default is 675# 'absolute-paths'. 676## 677{ 'type': 'BlockdevSnapshot', 678 'data': { '*device': 'str', '*node-name': 'str', 679 'snapshot-file': 'str', '*snapshot-node-name': 'str', 680 '*format': 'str', '*mode': 'NewImageMode' } } 681 682## 683# @DriveBackup 684# 685# @device: the name of the device which should be copied. 686# 687# @target: the target of the new image. If the file exists, or if it 688# is a device, the existing file/device will be used as the new 689# destination. If it does not exist, a new file will be created. 690# 691# @format: #optional the format of the new destination, default is to 692# probe if @mode is 'existing', else the format of the source 693# 694# @sync: what parts of the disk image should be copied to the destination 695# (all the disk, only the sectors allocated in the topmost image, from a 696# dirty bitmap, or only new I/O). 697# 698# @mode: #optional whether and how QEMU should create a new image, default is 699# 'absolute-paths'. 700# 701# @speed: #optional the maximum speed, in bytes per second 702# 703# @bitmap: #optional the name of dirty bitmap if sync is "dirty-bitmap". 704# Must be present if sync is "dirty-bitmap", must NOT be present 705# otherwise. (Since 2.4) 706# 707# @on-source-error: #optional the action to take on an error on the source, 708# default 'report'. 'stop' and 'enospc' can only be used 709# if the block device supports io-status (see BlockInfo). 710# 711# @on-target-error: #optional the action to take on an error on the target, 712# default 'report' (no limitations, since this applies to 713# a different block device than @device). 714# 715# Note that @on-source-error and @on-target-error only affect background I/O. 716# If an error occurs during a guest write request, the device's rerror/werror 717# actions will be used. 718# 719# Since: 1.6 720## 721{ 'type': 'DriveBackup', 722 'data': { 'device': 'str', 'target': 'str', '*format': 'str', 723 'sync': 'MirrorSyncMode', '*mode': 'NewImageMode', 724 '*speed': 'int', '*bitmap': 'str', 725 '*on-source-error': 'BlockdevOnError', 726 '*on-target-error': 'BlockdevOnError' } } 727 728## 729# @BlockdevBackup 730# 731# @device: the name of the device which should be copied. 732# 733# @target: the name of the backup target device. 734# 735# @sync: what parts of the disk image should be copied to the destination 736# (all the disk, only the sectors allocated in the topmost image, or 737# only new I/O). 738# 739# @speed: #optional the maximum speed, in bytes per second. The default is 0, 740# for unlimited. 741# 742# @on-source-error: #optional the action to take on an error on the source, 743# default 'report'. 'stop' and 'enospc' can only be used 744# if the block device supports io-status (see BlockInfo). 745# 746# @on-target-error: #optional the action to take on an error on the target, 747# default 'report' (no limitations, since this applies to 748# a different block device than @device). 749# 750# Note that @on-source-error and @on-target-error only affect background I/O. 751# If an error occurs during a guest write request, the device's rerror/werror 752# actions will be used. 753# 754# Since: 2.3 755## 756{ 'type': 'BlockdevBackup', 757 'data': { 'device': 'str', 'target': 'str', 758 'sync': 'MirrorSyncMode', 759 '*speed': 'int', 760 '*on-source-error': 'BlockdevOnError', 761 '*on-target-error': 'BlockdevOnError' } } 762 763## 764# @blockdev-snapshot-sync 765# 766# Generates a synchronous snapshot of a block device. 767# 768# For the arguments, see the documentation of BlockdevSnapshot. 769# 770# Returns: nothing on success 771# If @device is not a valid block device, DeviceNotFound 772# 773# Since 0.14.0 774## 775{ 'command': 'blockdev-snapshot-sync', 776 'data': 'BlockdevSnapshot' } 777 778## 779# @change-backing-file 780# 781# Change the backing file in the image file metadata. This does not 782# cause QEMU to reopen the image file to reparse the backing filename 783# (it may, however, perform a reopen to change permissions from 784# r/o -> r/w -> r/o, if needed). The new backing file string is written 785# into the image file metadata, and the QEMU internal strings are 786# updated. 787# 788# @image-node-name: The name of the block driver state node of the 789# image to modify. 790# 791# @device: The name of the device that owns image-node-name. 792# 793# @backing-file: The string to write as the backing file. This 794# string is not validated, so care should be taken 795# when specifying the string or the image chain may 796# not be able to be reopened again. 797# 798# Since: 2.1 799## 800{ 'command': 'change-backing-file', 801 'data': { 'device': 'str', 'image-node-name': 'str', 802 'backing-file': 'str' } } 803 804## 805# @block-commit 806# 807# Live commit of data from overlay image nodes into backing nodes - i.e., 808# writes data between 'top' and 'base' into 'base'. 809# 810# @device: the name of the device 811# 812# @base: #optional The file name of the backing image to write data into. 813# If not specified, this is the deepest backing image 814# 815# @top: #optional The file name of the backing image within the image chain, 816# which contains the topmost data to be committed down. If 817# not specified, this is the active layer. 818# 819# @backing-file: #optional The backing file string to write into the overlay 820# image of 'top'. If 'top' is the active layer, 821# specifying a backing file string is an error. This 822# filename is not validated. 823# 824# If a pathname string is such that it cannot be 825# resolved by QEMU, that means that subsequent QMP or 826# HMP commands must use node-names for the image in 827# question, as filename lookup methods will fail. 828# 829# If not specified, QEMU will automatically determine 830# the backing file string to use, or error out if 831# there is no obvious choice. Care should be taken 832# when specifying the string, to specify a valid 833# filename or protocol. 834# (Since 2.1) 835# 836# If top == base, that is an error. 837# If top == active, the job will not be completed by itself, 838# user needs to complete the job with the block-job-complete 839# command after getting the ready event. (Since 2.0) 840# 841# If the base image is smaller than top, then the base image 842# will be resized to be the same size as top. If top is 843# smaller than the base image, the base will not be 844# truncated. If you want the base image size to match the 845# size of the smaller top, you can safely truncate it 846# yourself once the commit operation successfully completes. 847# 848# @speed: #optional the maximum speed, in bytes per second 849# 850# Returns: Nothing on success 851# If commit or stream is already active on this device, DeviceInUse 852# If @device does not exist, DeviceNotFound 853# If image commit is not supported by this device, NotSupported 854# If @base or @top is invalid, a generic error is returned 855# If @speed is invalid, InvalidParameter 856# 857# Since: 1.3 858# 859## 860{ 'command': 'block-commit', 861 'data': { 'device': 'str', '*base': 'str', '*top': 'str', 862 '*backing-file': 'str', '*speed': 'int' } } 863 864## 865# @drive-backup 866# 867# Start a point-in-time copy of a block device to a new destination. The 868# status of ongoing drive-backup operations can be checked with 869# query-block-jobs where the BlockJobInfo.type field has the value 'backup'. 870# The operation can be stopped before it has completed using the 871# block-job-cancel command. 872# 873# For the arguments, see the documentation of DriveBackup. 874# 875# Returns: nothing on success 876# If @device is not a valid block device, DeviceNotFound 877# 878# Since 1.6 879## 880{ 'command': 'drive-backup', 'data': 'DriveBackup' } 881 882## 883# @blockdev-backup 884# 885# Start a point-in-time copy of a block device to a new destination. The 886# status of ongoing blockdev-backup operations can be checked with 887# query-block-jobs where the BlockJobInfo.type field has the value 'backup'. 888# The operation can be stopped before it has completed using the 889# block-job-cancel command. 890# 891# For the arguments, see the documentation of BlockdevBackup. 892# 893# Since 2.3 894## 895{ 'command': 'blockdev-backup', 'data': 'BlockdevBackup' } 896 897 898## 899# @query-named-block-nodes 900# 901# Get the named block driver list 902# 903# Returns: the list of BlockDeviceInfo 904# 905# Since 2.0 906## 907{ 'command': 'query-named-block-nodes', 'returns': [ 'BlockDeviceInfo' ] } 908 909## 910# @drive-mirror 911# 912# Start mirroring a block device's writes to a new destination. 913# 914# @device: the name of the device whose writes should be mirrored. 915# 916# @target: the target of the new image. If the file exists, or if it 917# is a device, the existing file/device will be used as the new 918# destination. If it does not exist, a new file will be created. 919# 920# @format: #optional the format of the new destination, default is to 921# probe if @mode is 'existing', else the format of the source 922# 923# @node-name: #optional the new block driver state node name in the graph 924# (Since 2.1) 925# 926# @replaces: #optional with sync=full graph node name to be replaced by the new 927# image when a whole image copy is done. This can be used to repair 928# broken Quorum files. (Since 2.1) 929# 930# @mode: #optional whether and how QEMU should create a new image, default is 931# 'absolute-paths'. 932# 933# @speed: #optional the maximum speed, in bytes per second 934# 935# @sync: what parts of the disk image should be copied to the destination 936# (all the disk, only the sectors allocated in the topmost image, or 937# only new I/O). 938# 939# @granularity: #optional granularity of the dirty bitmap, default is 64K 940# if the image format doesn't have clusters, 4K if the clusters 941# are smaller than that, else the cluster size. Must be a 942# power of 2 between 512 and 64M (since 1.4). 943# 944# @buf-size: #optional maximum amount of data in flight from source to 945# target (since 1.4). 946# 947# @on-source-error: #optional the action to take on an error on the source, 948# default 'report'. 'stop' and 'enospc' can only be used 949# if the block device supports io-status (see BlockInfo). 950# 951# @on-target-error: #optional the action to take on an error on the target, 952# default 'report' (no limitations, since this applies to 953# a different block device than @device). 954# 955# Returns: nothing on success 956# If @device is not a valid block device, DeviceNotFound 957# 958# Since 1.3 959## 960{ 'command': 'drive-mirror', 961 'data': { 'device': 'str', 'target': 'str', '*format': 'str', 962 '*node-name': 'str', '*replaces': 'str', 963 'sync': 'MirrorSyncMode', '*mode': 'NewImageMode', 964 '*speed': 'int', '*granularity': 'uint32', 965 '*buf-size': 'int', '*on-source-error': 'BlockdevOnError', 966 '*on-target-error': 'BlockdevOnError' } } 967 968## 969# @BlockDirtyBitmap 970# 971# @node: name of device/node which the bitmap is tracking 972# 973# @name: name of the dirty bitmap 974# 975# Since 2.4 976## 977{ 'type': 'BlockDirtyBitmap', 978 'data': { 'node': 'str', 'name': 'str' } } 979 980## 981# @BlockDirtyBitmapAdd 982# 983# @node: name of device/node which the bitmap is tracking 984# 985# @name: name of the dirty bitmap 986# 987# @granularity: #optional the bitmap granularity, default is 64k for 988# block-dirty-bitmap-add 989# 990# Since 2.4 991## 992{ 'type': 'BlockDirtyBitmapAdd', 993 'data': { 'node': 'str', 'name': 'str', '*granularity': 'uint32' } } 994 995## 996# @block-dirty-bitmap-add 997# 998# Create a dirty bitmap with a name on the node 999# 1000# Returns: nothing on success 1001# If @node is not a valid block device or node, DeviceNotFound 1002# If @name is already taken, GenericError with an explanation 1003# 1004# Since 2.4 1005## 1006{ 'command': 'block-dirty-bitmap-add', 1007 'data': 'BlockDirtyBitmapAdd' } 1008 1009## 1010# @block-dirty-bitmap-remove 1011# 1012# Remove a dirty bitmap on the node 1013# 1014# Returns: nothing on success 1015# If @node is not a valid block device or node, DeviceNotFound 1016# If @name is not found, GenericError with an explanation 1017# if @name is frozen by an operation, GenericError 1018# 1019# Since 2.4 1020## 1021{ 'command': 'block-dirty-bitmap-remove', 1022 'data': 'BlockDirtyBitmap' } 1023 1024## 1025# @block-dirty-bitmap-clear 1026# 1027# Clear (reset) a dirty bitmap on the device 1028# 1029# Returns: nothing on success 1030# If @node is not a valid block device, DeviceNotFound 1031# If @name is not found, GenericError with an explanation 1032# 1033# Since 2.4 1034## 1035{ 'command': 'block-dirty-bitmap-clear', 1036 'data': 'BlockDirtyBitmap' } 1037 1038## 1039# @block_set_io_throttle: 1040# 1041# Change I/O throttle limits for a block drive. 1042# 1043# @device: The name of the device 1044# 1045# @bps: total throughput limit in bytes per second 1046# 1047# @bps_rd: read throughput limit in bytes per second 1048# 1049# @bps_wr: write throughput limit in bytes per second 1050# 1051# @iops: total I/O operations per second 1052# 1053# @ops_rd: read I/O operations per second 1054# 1055# @iops_wr: write I/O operations per second 1056# 1057# @bps_max: #optional total max in bytes (Since 1.7) 1058# 1059# @bps_rd_max: #optional read max in bytes (Since 1.7) 1060# 1061# @bps_wr_max: #optional write max in bytes (Since 1.7) 1062# 1063# @iops_max: #optional total I/O operations max (Since 1.7) 1064# 1065# @iops_rd_max: #optional read I/O operations max (Since 1.7) 1066# 1067# @iops_wr_max: #optional write I/O operations max (Since 1.7) 1068# 1069# @iops_size: #optional an I/O size in bytes (Since 1.7) 1070# 1071# Returns: Nothing on success 1072# If @device is not a valid block device, DeviceNotFound 1073# 1074# Since: 1.1 1075## 1076{ 'command': 'block_set_io_throttle', 1077 'data': { 'device': 'str', 'bps': 'int', 'bps_rd': 'int', 'bps_wr': 'int', 1078 'iops': 'int', 'iops_rd': 'int', 'iops_wr': 'int', 1079 '*bps_max': 'int', '*bps_rd_max': 'int', 1080 '*bps_wr_max': 'int', '*iops_max': 'int', 1081 '*iops_rd_max': 'int', '*iops_wr_max': 'int', 1082 '*iops_size': 'int' } } 1083 1084## 1085# @block-stream: 1086# 1087# Copy data from a backing file into a block device. 1088# 1089# The block streaming operation is performed in the background until the entire 1090# backing file has been copied. This command returns immediately once streaming 1091# has started. The status of ongoing block streaming operations can be checked 1092# with query-block-jobs. The operation can be stopped before it has completed 1093# using the block-job-cancel command. 1094# 1095# If a base file is specified then sectors are not copied from that base file and 1096# its backing chain. When streaming completes the image file will have the base 1097# file as its backing file. This can be used to stream a subset of the backing 1098# file chain instead of flattening the entire image. 1099# 1100# On successful completion the image file is updated to drop the backing file 1101# and the BLOCK_JOB_COMPLETED event is emitted. 1102# 1103# @device: the device name 1104# 1105# @base: #optional the common backing file name 1106# 1107# @backing-file: #optional The backing file string to write into the active 1108# layer. This filename is not validated. 1109# 1110# If a pathname string is such that it cannot be 1111# resolved by QEMU, that means that subsequent QMP or 1112# HMP commands must use node-names for the image in 1113# question, as filename lookup methods will fail. 1114# 1115# If not specified, QEMU will automatically determine 1116# the backing file string to use, or error out if there 1117# is no obvious choice. Care should be taken when 1118# specifying the string, to specify a valid filename or 1119# protocol. 1120# (Since 2.1) 1121# 1122# @speed: #optional the maximum speed, in bytes per second 1123# 1124# @on-error: #optional the action to take on an error (default report). 1125# 'stop' and 'enospc' can only be used if the block device 1126# supports io-status (see BlockInfo). Since 1.3. 1127# 1128# Returns: Nothing on success 1129# If @device does not exist, DeviceNotFound 1130# 1131# Since: 1.1 1132## 1133{ 'command': 'block-stream', 1134 'data': { 'device': 'str', '*base': 'str', '*backing-file': 'str', 1135 '*speed': 'int', '*on-error': 'BlockdevOnError' } } 1136 1137## 1138# @block-job-set-speed: 1139# 1140# Set maximum speed for a background block operation. 1141# 1142# This command can only be issued when there is an active block job. 1143# 1144# Throttling can be disabled by setting the speed to 0. 1145# 1146# @device: the device name 1147# 1148# @speed: the maximum speed, in bytes per second, or 0 for unlimited. 1149# Defaults to 0. 1150# 1151# Returns: Nothing on success 1152# If no background operation is active on this device, DeviceNotActive 1153# 1154# Since: 1.1 1155## 1156{ 'command': 'block-job-set-speed', 1157 'data': { 'device': 'str', 'speed': 'int' } } 1158 1159## 1160# @block-job-cancel: 1161# 1162# Stop an active background block operation. 1163# 1164# This command returns immediately after marking the active background block 1165# operation for cancellation. It is an error to call this command if no 1166# operation is in progress. 1167# 1168# The operation will cancel as soon as possible and then emit the 1169# BLOCK_JOB_CANCELLED event. Before that happens the job is still visible when 1170# enumerated using query-block-jobs. 1171# 1172# For streaming, the image file retains its backing file unless the streaming 1173# operation happens to complete just as it is being cancelled. A new streaming 1174# operation can be started at a later time to finish copying all data from the 1175# backing file. 1176# 1177# @device: the device name 1178# 1179# @force: #optional whether to allow cancellation of a paused job (default 1180# false). Since 1.3. 1181# 1182# Returns: Nothing on success 1183# If no background operation is active on this device, DeviceNotActive 1184# 1185# Since: 1.1 1186## 1187{ 'command': 'block-job-cancel', 'data': { 'device': 'str', '*force': 'bool' } } 1188 1189## 1190# @block-job-pause: 1191# 1192# Pause an active background block operation. 1193# 1194# This command returns immediately after marking the active background block 1195# operation for pausing. It is an error to call this command if no 1196# operation is in progress. Pausing an already paused job has no cumulative 1197# effect; a single block-job-resume command will resume the job. 1198# 1199# The operation will pause as soon as possible. No event is emitted when 1200# the operation is actually paused. Cancelling a paused job automatically 1201# resumes it. 1202# 1203# @device: the device name 1204# 1205# Returns: Nothing on success 1206# If no background operation is active on this device, DeviceNotActive 1207# 1208# Since: 1.3 1209## 1210{ 'command': 'block-job-pause', 'data': { 'device': 'str' } } 1211 1212## 1213# @block-job-resume: 1214# 1215# Resume an active background block operation. 1216# 1217# This command returns immediately after resuming a paused background block 1218# operation. It is an error to call this command if no operation is in 1219# progress. Resuming an already running job is not an error. 1220# 1221# This command also clears the error status of the job. 1222# 1223# @device: the device name 1224# 1225# Returns: Nothing on success 1226# If no background operation is active on this device, DeviceNotActive 1227# 1228# Since: 1.3 1229## 1230{ 'command': 'block-job-resume', 'data': { 'device': 'str' } } 1231 1232## 1233# @block-job-complete: 1234# 1235# Manually trigger completion of an active background block operation. This 1236# is supported for drive mirroring, where it also switches the device to 1237# write to the target path only. The ability to complete is signaled with 1238# a BLOCK_JOB_READY event. 1239# 1240# This command completes an active background block operation synchronously. 1241# The ordering of this command's return with the BLOCK_JOB_COMPLETED event 1242# is not defined. Note that if an I/O error occurs during the processing of 1243# this command: 1) the command itself will fail; 2) the error will be processed 1244# according to the rerror/werror arguments that were specified when starting 1245# the operation. 1246# 1247# A cancelled or paused job cannot be completed. 1248# 1249# @device: the device name 1250# 1251# Returns: Nothing on success 1252# If no background operation is active on this device, DeviceNotActive 1253# 1254# Since: 1.3 1255## 1256{ 'command': 'block-job-complete', 'data': { 'device': 'str' } } 1257 1258## 1259# @BlockdevDiscardOptions 1260# 1261# Determines how to handle discard requests. 1262# 1263# @ignore: Ignore the request 1264# @unmap: Forward as an unmap request 1265# 1266# Since: 1.7 1267## 1268{ 'enum': 'BlockdevDiscardOptions', 1269 'data': [ 'ignore', 'unmap' ] } 1270 1271## 1272# @BlockdevDetectZeroesOptions 1273# 1274# Describes the operation mode for the automatic conversion of plain 1275# zero writes by the OS to driver specific optimized zero write commands. 1276# 1277# @off: Disabled (default) 1278# @on: Enabled 1279# @unmap: Enabled and even try to unmap blocks if possible. This requires 1280# also that @BlockdevDiscardOptions is set to unmap for this device. 1281# 1282# Since: 2.1 1283## 1284{ 'enum': 'BlockdevDetectZeroesOptions', 1285 'data': [ 'off', 'on', 'unmap' ] } 1286 1287## 1288# @BlockdevAioOptions 1289# 1290# Selects the AIO backend to handle I/O requests 1291# 1292# @threads: Use qemu's thread pool 1293# @native: Use native AIO backend (only Linux and Windows) 1294# 1295# Since: 1.7 1296## 1297{ 'enum': 'BlockdevAioOptions', 1298 'data': [ 'threads', 'native' ] } 1299 1300## 1301# @BlockdevCacheOptions 1302# 1303# Includes cache-related options for block devices 1304# 1305# @writeback: #optional enables writeback mode for any caches (default: true) 1306# @direct: #optional enables use of O_DIRECT (bypass the host page cache; 1307# default: false) 1308# @no-flush: #optional ignore any flush requests for the device (default: 1309# false) 1310# 1311# Since: 1.7 1312## 1313{ 'type': 'BlockdevCacheOptions', 1314 'data': { '*writeback': 'bool', 1315 '*direct': 'bool', 1316 '*no-flush': 'bool' } } 1317 1318## 1319# @BlockdevDriver 1320# 1321# Drivers that are supported in block device operations. 1322# 1323# @host_device, @host_cdrom, @host_floppy: Since 2.1 1324# @host_floppy: deprecated since 2.3 1325# 1326# Since: 2.0 1327## 1328{ 'enum': 'BlockdevDriver', 1329 'data': [ 'archipelago', 'blkdebug', 'blkverify', 'bochs', 'cloop', 1330 'dmg', 'file', 'ftp', 'ftps', 'host_cdrom', 'host_device', 1331 'host_floppy', 'http', 'https', 'null-aio', 'null-co', 'parallels', 1332 'qcow', 'qcow2', 'qed', 'quorum', 'raw', 'tftp', 'vdi', 'vhdx', 1333 'vmdk', 'vpc', 'vvfat' ] } 1334 1335## 1336# @BlockdevOptionsBase 1337# 1338# Options that are available for all block devices, independent of the block 1339# driver. 1340# 1341# @driver: block driver name 1342# @id: #optional id by which the new block device can be referred to. 1343# This is a required option on the top level of blockdev-add, and 1344# currently not allowed on any other level. 1345# @node-name: #optional the name of a block driver state node (Since 2.0) 1346# @discard: #optional discard-related options (default: ignore) 1347# @cache: #optional cache-related options 1348# @aio: #optional AIO backend (default: threads) 1349# @rerror: #optional how to handle read errors on the device 1350# (default: report) 1351# @werror: #optional how to handle write errors on the device 1352# (default: enospc) 1353# @read-only: #optional whether the block device should be read-only 1354# (default: false) 1355# @detect-zeroes: #optional detect and optimize zero writes (Since 2.1) 1356# (default: off) 1357# 1358# Since: 1.7 1359## 1360{ 'type': 'BlockdevOptionsBase', 1361 'data': { 'driver': 'BlockdevDriver', 1362 '*id': 'str', 1363 '*node-name': 'str', 1364 '*discard': 'BlockdevDiscardOptions', 1365 '*cache': 'BlockdevCacheOptions', 1366 '*aio': 'BlockdevAioOptions', 1367 '*rerror': 'BlockdevOnError', 1368 '*werror': 'BlockdevOnError', 1369 '*read-only': 'bool', 1370 '*detect-zeroes': 'BlockdevDetectZeroesOptions' } } 1371 1372## 1373# @BlockdevOptionsFile 1374# 1375# Driver specific block device options for the file backend and similar 1376# protocols. 1377# 1378# @filename: path to the image file 1379# 1380# Since: 1.7 1381## 1382{ 'type': 'BlockdevOptionsFile', 1383 'data': { 'filename': 'str' } } 1384 1385## 1386# @BlockdevOptionsNull 1387# 1388# Driver specific block device options for the null backend. 1389# 1390# @size: #optional size of the device in bytes. 1391# @latency-ns: #optional emulated latency (in nanoseconds) in processing 1392# requests. Default to zero which completes requests immediately. 1393# (Since 2.4) 1394# 1395# Since: 2.2 1396## 1397{ 'type': 'BlockdevOptionsNull', 1398 'data': { '*size': 'int', '*latency-ns': 'uint64' } } 1399 1400## 1401# @BlockdevOptionsVVFAT 1402# 1403# Driver specific block device options for the vvfat protocol. 1404# 1405# @dir: directory to be exported as FAT image 1406# @fat-type: #optional FAT type: 12, 16 or 32 1407# @floppy: #optional whether to export a floppy image (true) or 1408# partitioned hard disk (false; default) 1409# @rw: #optional whether to allow write operations (default: false) 1410# 1411# Since: 1.7 1412## 1413{ 'type': 'BlockdevOptionsVVFAT', 1414 'data': { 'dir': 'str', '*fat-type': 'int', '*floppy': 'bool', 1415 '*rw': 'bool' } } 1416 1417## 1418# @BlockdevOptionsGenericFormat 1419# 1420# Driver specific block device options for image format that have no option 1421# besides their data source. 1422# 1423# @file: reference to or definition of the data source block device 1424# 1425# Since: 1.7 1426## 1427{ 'type': 'BlockdevOptionsGenericFormat', 1428 'data': { 'file': 'BlockdevRef' } } 1429 1430## 1431# @BlockdevOptionsGenericCOWFormat 1432# 1433# Driver specific block device options for image format that have no option 1434# besides their data source and an optional backing file. 1435# 1436# @backing: #optional reference to or definition of the backing file block 1437# device (if missing, taken from the image file content). It is 1438# allowed to pass an empty string here in order to disable the 1439# default backing file. 1440# 1441# Since: 1.7 1442## 1443{ 'type': 'BlockdevOptionsGenericCOWFormat', 1444 'base': 'BlockdevOptionsGenericFormat', 1445 'data': { '*backing': 'BlockdevRef' } } 1446 1447## 1448# @Qcow2OverlapCheckMode 1449# 1450# General overlap check modes. 1451# 1452# @none: Do not perform any checks 1453# 1454# @constant: Perform only checks which can be done in constant time and 1455# without reading anything from disk 1456# 1457# @cached: Perform only checks which can be done without reading anything 1458# from disk 1459# 1460# @all: Perform all available overlap checks 1461# 1462# Since: 2.2 1463## 1464{ 'enum': 'Qcow2OverlapCheckMode', 1465 'data': [ 'none', 'constant', 'cached', 'all' ] } 1466 1467## 1468# @Qcow2OverlapCheckFlags 1469# 1470# Structure of flags for each metadata structure. Setting a field to 'true' 1471# makes qemu guard that structure against unintended overwriting. The default 1472# value is chosen according to the template given. 1473# 1474# @template: Specifies a template mode which can be adjusted using the other 1475# flags, defaults to 'cached' 1476# 1477# Since: 2.2 1478## 1479{ 'type': 'Qcow2OverlapCheckFlags', 1480 'data': { '*template': 'Qcow2OverlapCheckMode', 1481 '*main-header': 'bool', 1482 '*active-l1': 'bool', 1483 '*active-l2': 'bool', 1484 '*refcount-table': 'bool', 1485 '*refcount-block': 'bool', 1486 '*snapshot-table': 'bool', 1487 '*inactive-l1': 'bool', 1488 '*inactive-l2': 'bool' } } 1489 1490## 1491# @Qcow2OverlapChecks 1492# 1493# Specifies which metadata structures should be guarded against unintended 1494# overwriting. 1495# 1496# @flags: set of flags for separate specification of each metadata structure 1497# type 1498# 1499# @mode: named mode which chooses a specific set of flags 1500# 1501# Since: 2.2 1502## 1503{ 'union': 'Qcow2OverlapChecks', 1504 'discriminator': {}, 1505 'data': { 'flags': 'Qcow2OverlapCheckFlags', 1506 'mode': 'Qcow2OverlapCheckMode' } } 1507 1508## 1509# @BlockdevOptionsQcow2 1510# 1511# Driver specific block device options for qcow2. 1512# 1513# @lazy-refcounts: #optional whether to enable the lazy refcounts 1514# feature (default is taken from the image file) 1515# 1516# @pass-discard-request: #optional whether discard requests to the qcow2 1517# device should be forwarded to the data source 1518# 1519# @pass-discard-snapshot: #optional whether discard requests for the data source 1520# should be issued when a snapshot operation (e.g. 1521# deleting a snapshot) frees clusters in the qcow2 file 1522# 1523# @pass-discard-other: #optional whether discard requests for the data source 1524# should be issued on other occasions where a cluster 1525# gets freed 1526# 1527# @overlap-check: #optional which overlap checks to perform for writes 1528# to the image, defaults to 'cached' (since 2.2) 1529# 1530# @cache-size: #optional the maximum total size of the L2 table and 1531# refcount block caches in bytes (since 2.2) 1532# 1533# @l2-cache-size: #optional the maximum size of the L2 table cache in 1534# bytes (since 2.2) 1535# 1536# @refcount-cache-size: #optional the maximum size of the refcount block cache 1537# in bytes (since 2.2) 1538# 1539# Since: 1.7 1540## 1541{ 'type': 'BlockdevOptionsQcow2', 1542 'base': 'BlockdevOptionsGenericCOWFormat', 1543 'data': { '*lazy-refcounts': 'bool', 1544 '*pass-discard-request': 'bool', 1545 '*pass-discard-snapshot': 'bool', 1546 '*pass-discard-other': 'bool', 1547 '*overlap-check': 'Qcow2OverlapChecks', 1548 '*cache-size': 'int', 1549 '*l2-cache-size': 'int', 1550 '*refcount-cache-size': 'int' } } 1551 1552 1553## 1554# @BlockdevOptionsArchipelago 1555# 1556# Driver specific block device options for Archipelago. 1557# 1558# @volume: Name of the Archipelago volume image 1559# 1560# @mport: #optional The port number on which mapperd is 1561# listening. This is optional 1562# and if not specified, QEMU will make Archipelago 1563# use the default port (1001). 1564# 1565# @vport: #optional The port number on which vlmcd is 1566# listening. This is optional 1567# and if not specified, QEMU will make Archipelago 1568# use the default port (501). 1569# 1570# @segment: #optional The name of the shared memory segment 1571# Archipelago stack is using. This is optional 1572# and if not specified, QEMU will make Archipelago 1573# use the default value, 'archipelago'. 1574# Since: 2.2 1575## 1576{ 'type': 'BlockdevOptionsArchipelago', 1577 'data': { 'volume': 'str', 1578 '*mport': 'int', 1579 '*vport': 'int', 1580 '*segment': 'str' } } 1581 1582 1583## 1584# @BlkdebugEvent 1585# 1586# Trigger events supported by blkdebug. 1587## 1588{ 'enum': 'BlkdebugEvent', 1589 'data': [ 'l1_update', 'l1_grow.alloc_table', 'l1_grow.write_table', 1590 'l1_grow.activate_table', 'l2_load', 'l2_update', 1591 'l2_update_compressed', 'l2_alloc.cow_read', 'l2_alloc.write', 1592 'read_aio', 'read_backing_aio', 'read_compressed', 'write_aio', 1593 'write_compressed', 'vmstate_load', 'vmstate_save', 'cow_read', 1594 'cow_write', 'reftable_load', 'reftable_grow', 'reftable_update', 1595 'refblock_load', 'refblock_update', 'refblock_update_part', 1596 'refblock_alloc', 'refblock_alloc.hookup', 'refblock_alloc.write', 1597 'refblock_alloc.write_blocks', 'refblock_alloc.write_table', 1598 'refblock_alloc.switch_table', 'cluster_alloc', 1599 'cluster_alloc_bytes', 'cluster_free', 'flush_to_os', 1600 'flush_to_disk', 'pwritev_rmw.head', 'pwritev_rmw.after_head', 1601 'pwritev_rmw.tail', 'pwritev_rmw.after_tail', 'pwritev', 1602 'pwritev_zero', 'pwritev_done', 'empty_image_prepare' ] } 1603 1604## 1605# @BlkdebugInjectErrorOptions 1606# 1607# Describes a single error injection for blkdebug. 1608# 1609# @event: trigger event 1610# 1611# @state: #optional the state identifier blkdebug needs to be in to 1612# actually trigger the event; defaults to "any" 1613# 1614# @errno: #optional error identifier (errno) to be returned; defaults to 1615# EIO 1616# 1617# @sector: #optional specifies the sector index which has to be affected 1618# in order to actually trigger the event; defaults to "any 1619# sector" 1620# 1621# @once: #optional disables further events after this one has been 1622# triggered; defaults to false 1623# 1624# @immediately: #optional fail immediately; defaults to false 1625# 1626# Since: 2.0 1627## 1628{ 'type': 'BlkdebugInjectErrorOptions', 1629 'data': { 'event': 'BlkdebugEvent', 1630 '*state': 'int', 1631 '*errno': 'int', 1632 '*sector': 'int', 1633 '*once': 'bool', 1634 '*immediately': 'bool' } } 1635 1636## 1637# @BlkdebugSetStateOptions 1638# 1639# Describes a single state-change event for blkdebug. 1640# 1641# @event: trigger event 1642# 1643# @state: #optional the current state identifier blkdebug needs to be in; 1644# defaults to "any" 1645# 1646# @new_state: the state identifier blkdebug is supposed to assume if 1647# this event is triggered 1648# 1649# Since: 2.0 1650## 1651{ 'type': 'BlkdebugSetStateOptions', 1652 'data': { 'event': 'BlkdebugEvent', 1653 '*state': 'int', 1654 'new_state': 'int' } } 1655 1656## 1657# @BlockdevOptionsBlkdebug 1658# 1659# Driver specific block device options for blkdebug. 1660# 1661# @image: underlying raw block device (or image file) 1662# 1663# @config: #optional filename of the configuration file 1664# 1665# @align: #optional required alignment for requests in bytes 1666# 1667# @inject-error: #optional array of error injection descriptions 1668# 1669# @set-state: #optional array of state-change descriptions 1670# 1671# Since: 2.0 1672## 1673{ 'type': 'BlockdevOptionsBlkdebug', 1674 'data': { 'image': 'BlockdevRef', 1675 '*config': 'str', 1676 '*align': 'int', 1677 '*inject-error': ['BlkdebugInjectErrorOptions'], 1678 '*set-state': ['BlkdebugSetStateOptions'] } } 1679 1680## 1681# @BlockdevOptionsBlkverify 1682# 1683# Driver specific block device options for blkverify. 1684# 1685# @test: block device to be tested 1686# 1687# @raw: raw image used for verification 1688# 1689# Since: 2.0 1690## 1691{ 'type': 'BlockdevOptionsBlkverify', 1692 'data': { 'test': 'BlockdevRef', 1693 'raw': 'BlockdevRef' } } 1694 1695## 1696# @QuorumReadPattern 1697# 1698# An enumeration of quorum read patterns. 1699# 1700# @quorum: read all the children and do a quorum vote on reads 1701# 1702# @fifo: read only from the first child that has not failed 1703# 1704# Since: 2.2 1705## 1706{ 'enum': 'QuorumReadPattern', 'data': [ 'quorum', 'fifo' ] } 1707 1708## 1709# @BlockdevOptionsQuorum 1710# 1711# Driver specific block device options for Quorum 1712# 1713# @blkverify: #optional true if the driver must print content mismatch 1714# set to false by default 1715# 1716# @children: the children block devices to use 1717# 1718# @vote-threshold: the vote limit under which a read will fail 1719# 1720# @rewrite-corrupted: #optional rewrite corrupted data when quorum is reached 1721# (Since 2.1) 1722# 1723# @read-pattern: #optional choose read pattern and set to quorum by default 1724# (Since 2.2) 1725# 1726# Since: 2.0 1727## 1728{ 'type': 'BlockdevOptionsQuorum', 1729 'data': { '*blkverify': 'bool', 1730 'children': [ 'BlockdevRef' ], 1731 'vote-threshold': 'int', 1732 '*rewrite-corrupted': 'bool', 1733 '*read-pattern': 'QuorumReadPattern' } } 1734 1735## 1736# @BlockdevOptions 1737# 1738# Options for creating a block device. 1739# 1740# Since: 1.7 1741## 1742{ 'union': 'BlockdevOptions', 1743 'base': 'BlockdevOptionsBase', 1744 'discriminator': 'driver', 1745 'data': { 1746 'archipelago':'BlockdevOptionsArchipelago', 1747 'blkdebug': 'BlockdevOptionsBlkdebug', 1748 'blkverify': 'BlockdevOptionsBlkverify', 1749 'bochs': 'BlockdevOptionsGenericFormat', 1750 'cloop': 'BlockdevOptionsGenericFormat', 1751 'dmg': 'BlockdevOptionsGenericFormat', 1752 'file': 'BlockdevOptionsFile', 1753 'ftp': 'BlockdevOptionsFile', 1754 'ftps': 'BlockdevOptionsFile', 1755# TODO gluster: Wait for structured options 1756 'host_cdrom': 'BlockdevOptionsFile', 1757 'host_device':'BlockdevOptionsFile', 1758 'host_floppy':'BlockdevOptionsFile', 1759 'http': 'BlockdevOptionsFile', 1760 'https': 'BlockdevOptionsFile', 1761# TODO iscsi: Wait for structured options 1762# TODO nbd: Should take InetSocketAddress for 'host'? 1763# TODO nfs: Wait for structured options 1764 'null-aio': 'BlockdevOptionsNull', 1765 'null-co': 'BlockdevOptionsNull', 1766 'parallels': 'BlockdevOptionsGenericFormat', 1767 'qcow2': 'BlockdevOptionsQcow2', 1768 'qcow': 'BlockdevOptionsGenericCOWFormat', 1769 'qed': 'BlockdevOptionsGenericCOWFormat', 1770 'quorum': 'BlockdevOptionsQuorum', 1771 'raw': 'BlockdevOptionsGenericFormat', 1772# TODO rbd: Wait for structured options 1773# TODO sheepdog: Wait for structured options 1774# TODO ssh: Should take InetSocketAddress for 'host'? 1775 'tftp': 'BlockdevOptionsFile', 1776 'vdi': 'BlockdevOptionsGenericFormat', 1777 'vhdx': 'BlockdevOptionsGenericFormat', 1778 'vmdk': 'BlockdevOptionsGenericCOWFormat', 1779 'vpc': 'BlockdevOptionsGenericFormat', 1780 'vvfat': 'BlockdevOptionsVVFAT' 1781 } } 1782 1783## 1784# @BlockdevRef 1785# 1786# Reference to a block device. 1787# 1788# @definition: defines a new block device inline 1789# @reference: references the ID of an existing block device. An 1790# empty string means that no block device should be 1791# referenced. 1792# 1793# Since: 1.7 1794## 1795{ 'union': 'BlockdevRef', 1796 'discriminator': {}, 1797 'data': { 'definition': 'BlockdevOptions', 1798 'reference': 'str' } } 1799 1800## 1801# @blockdev-add: 1802# 1803# Creates a new block device. 1804# 1805# This command is still a work in progress. It doesn't support all 1806# block drivers, it lacks a matching blockdev-del, and more. Stay 1807# away from it unless you want to help with its development. 1808# 1809# @options: block device options for the new device 1810# 1811# Since: 1.7 1812## 1813{ 'command': 'blockdev-add', 'data': { 'options': 'BlockdevOptions' } } 1814 1815 1816## 1817# @BlockErrorAction 1818# 1819# An enumeration of action that has been taken when a DISK I/O occurs 1820# 1821# @ignore: error has been ignored 1822# 1823# @report: error has been reported to the device 1824# 1825# @stop: error caused VM to be stopped 1826# 1827# Since: 2.1 1828## 1829{ 'enum': 'BlockErrorAction', 1830 'data': [ 'ignore', 'report', 'stop' ] } 1831 1832 1833## 1834# @BLOCK_IMAGE_CORRUPTED 1835# 1836# Emitted when a corruption has been detected in a disk image 1837# 1838# @device: device name. This is always present for compatibility 1839# reasons, but it can be empty ("") if the image does not 1840# have a device name associated. 1841# 1842# @node-name: #optional node name (Since: 2.4) 1843# 1844# @msg: informative message for human consumption, such as the kind of 1845# corruption being detected. It should not be parsed by machine as it is 1846# not guaranteed to be stable 1847# 1848# @offset: #optional, if the corruption resulted from an image access, this is 1849# the access offset into the image 1850# 1851# @size: #optional, if the corruption resulted from an image access, this is 1852# the access size 1853# 1854# fatal: if set, the image is marked corrupt and therefore unusable after this 1855# event and must be repaired (Since 2.2; before, every 1856# BLOCK_IMAGE_CORRUPTED event was fatal) 1857# 1858# Since: 1.7 1859## 1860{ 'event': 'BLOCK_IMAGE_CORRUPTED', 1861 'data': { 'device' : 'str', 1862 '*node-name' : 'str', 1863 'msg' : 'str', 1864 '*offset' : 'int', 1865 '*size' : 'int', 1866 'fatal' : 'bool' } } 1867 1868## 1869# @BLOCK_IO_ERROR 1870# 1871# Emitted when a disk I/O error occurs 1872# 1873# @device: device name 1874# 1875# @operation: I/O operation 1876# 1877# @action: action that has been taken 1878# 1879# @nospace: #optional true if I/O error was caused due to a no-space 1880# condition. This key is only present if query-block's 1881# io-status is present, please see query-block documentation 1882# for more information (since: 2.2) 1883# 1884# @reason: human readable string describing the error cause. 1885# (This field is a debugging aid for humans, it should not 1886# be parsed by applications) (since: 2.2) 1887# 1888# Note: If action is "stop", a STOP event will eventually follow the 1889# BLOCK_IO_ERROR event 1890# 1891# Since: 0.13.0 1892## 1893{ 'event': 'BLOCK_IO_ERROR', 1894 'data': { 'device': 'str', 'operation': 'IoOperationType', 1895 'action': 'BlockErrorAction', '*nospace': 'bool', 1896 'reason': 'str' } } 1897 1898## 1899# @BLOCK_JOB_COMPLETED 1900# 1901# Emitted when a block job has completed 1902# 1903# @type: job type 1904# 1905# @device: device name 1906# 1907# @len: maximum progress value 1908# 1909# @offset: current progress value. On success this is equal to len. 1910# On failure this is less than len 1911# 1912# @speed: rate limit, bytes per second 1913# 1914# @error: #optional, error message. Only present on failure. This field 1915# contains a human-readable error message. There are no semantics 1916# other than that streaming has failed and clients should not try to 1917# interpret the error string 1918# 1919# Since: 1.1 1920## 1921{ 'event': 'BLOCK_JOB_COMPLETED', 1922 'data': { 'type' : 'BlockJobType', 1923 'device': 'str', 1924 'len' : 'int', 1925 'offset': 'int', 1926 'speed' : 'int', 1927 '*error': 'str' } } 1928 1929## 1930# @BLOCK_JOB_CANCELLED 1931# 1932# Emitted when a block job has been cancelled 1933# 1934# @type: job type 1935# 1936# @device: device name 1937# 1938# @len: maximum progress value 1939# 1940# @offset: current progress value. On success this is equal to len. 1941# On failure this is less than len 1942# 1943# @speed: rate limit, bytes per second 1944# 1945# Since: 1.1 1946## 1947{ 'event': 'BLOCK_JOB_CANCELLED', 1948 'data': { 'type' : 'BlockJobType', 1949 'device': 'str', 1950 'len' : 'int', 1951 'offset': 'int', 1952 'speed' : 'int' } } 1953 1954## 1955# @BLOCK_JOB_ERROR 1956# 1957# Emitted when a block job encounters an error 1958# 1959# @device: device name 1960# 1961# @operation: I/O operation 1962# 1963# @action: action that has been taken 1964# 1965# Since: 1.3 1966## 1967{ 'event': 'BLOCK_JOB_ERROR', 1968 'data': { 'device' : 'str', 1969 'operation': 'IoOperationType', 1970 'action' : 'BlockErrorAction' } } 1971 1972## 1973# @BLOCK_JOB_READY 1974# 1975# Emitted when a block job is ready to complete 1976# 1977# @type: job type 1978# 1979# @device: device name 1980# 1981# @len: maximum progress value 1982# 1983# @offset: current progress value. On success this is equal to len. 1984# On failure this is less than len 1985# 1986# @speed: rate limit, bytes per second 1987# 1988# Note: The "ready to complete" status is always reset by a @BLOCK_JOB_ERROR 1989# event 1990# 1991# Since: 1.3 1992## 1993{ 'event': 'BLOCK_JOB_READY', 1994 'data': { 'type' : 'BlockJobType', 1995 'device': 'str', 1996 'len' : 'int', 1997 'offset': 'int', 1998 'speed' : 'int' } } 1999 2000# @PreallocMode 2001# 2002# Preallocation mode of QEMU image file 2003# 2004# @off: no preallocation 2005# @metadata: preallocate only for metadata 2006# @falloc: like @full preallocation but allocate disk space by 2007# posix_fallocate() rather than writing zeros. 2008# @full: preallocate all data by writing zeros to device to ensure disk 2009# space is really available. @full preallocation also sets up 2010# metadata correctly. 2011# 2012# Since 2.2 2013## 2014{ 'enum': 'PreallocMode', 2015 'data': [ 'off', 'metadata', 'falloc', 'full' ] } 2016 2017## 2018# @BLOCK_WRITE_THRESHOLD 2019# 2020# Emitted when writes on block device reaches or exceeds the 2021# configured write threshold. For thin-provisioned devices, this 2022# means the device should be extended to avoid pausing for 2023# disk exhaustion. 2024# The event is one shot. Once triggered, it needs to be 2025# re-registered with another block-set-threshold command. 2026# 2027# @node-name: graph node name on which the threshold was exceeded. 2028# 2029# @amount-exceeded: amount of data which exceeded the threshold, in bytes. 2030# 2031# @write-threshold: last configured threshold, in bytes. 2032# 2033# Since: 2.3 2034## 2035{ 'event': 'BLOCK_WRITE_THRESHOLD', 2036 'data': { 'node-name': 'str', 2037 'amount-exceeded': 'uint64', 2038 'write-threshold': 'uint64' } } 2039 2040## 2041# @block-set-write-threshold 2042# 2043# Change the write threshold for a block drive. An event will be delivered 2044# if a write to this block drive crosses the configured threshold. 2045# This is useful to transparently resize thin-provisioned drives without 2046# the guest OS noticing. 2047# 2048# @node-name: graph node name on which the threshold must be set. 2049# 2050# @write-threshold: configured threshold for the block device, bytes. 2051# Use 0 to disable the threshold. 2052# 2053# Since: 2.3 2054## 2055{ 'command': 'block-set-write-threshold', 2056 'data': { 'node-name': 'str', 'write-threshold': 'uint64' } } 2057