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