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