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