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