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