Update version for v2.2.0-rc0 release
[qemu-kvm.git] / qapi / block-core.json
blob77a0cfbd82b44cb79021e6c1ff2a10320051c256
1 # -*- Mode: Python -*-
3 # QAPI block core definitions (vm unrelated)
5 # QAPI common definitions
6 { 'include': 'common.json' }
8 ##
9 # @SnapshotInfo
11 # @id: unique snapshot id
13 # @name: user chosen name
15 # @vm-state-size: size of the VM state
17 # @date-sec: UTC date of the snapshot in seconds
19 # @date-nsec: fractional part in nano seconds to be used with date-sec
21 # @vm-clock-sec: VM clock relative to boot in seconds
23 # @vm-clock-nsec: fractional part in nano seconds to be used with vm-clock-sec
25 # Since: 1.3
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' } }
35 # @ImageInfoSpecificQCow2:
37 # @compat: compatibility level
39 # @lazy-refcounts: #optional on or off; only valid for compat >= 1.1
41 # @corrupt: #optional true if the image has been marked corrupt; only valid for
42 #           compat >= 1.1 (since 2.2)
44 # Since: 1.7
46 { 'type': 'ImageInfoSpecificQCow2',
47   'data': {
48       'compat': 'str',
49       '*lazy-refcounts': 'bool',
50       '*corrupt': 'bool'
51   } }
54 # @ImageInfoSpecificVmdk:
56 # @create-type: The create type of VMDK image
58 # @cid: Content id of image
60 # @parent-cid: Parent VMDK image's cid
62 # @extents: List of extent files
64 # Since: 1.7
66 { 'type': 'ImageInfoSpecificVmdk',
67   'data': {
68       'create-type': 'str',
69       'cid': 'int',
70       'parent-cid': 'int',
71       'extents': ['ImageInfo']
72   } }
75 # @ImageInfoSpecific:
77 # A discriminated record of image format specific information structures.
79 # Since: 1.7
82 { 'union': 'ImageInfoSpecific',
83   'data': {
84       'qcow2': 'ImageInfoSpecificQCow2',
85       'vmdk': 'ImageInfoSpecificVmdk'
86   } }
89 # @ImageInfo:
91 # Information about a QEMU image file
93 # @filename: name of the image file
95 # @format: format of the image file
97 # @virtual-size: maximum capacity in bytes of the image
99 # @actual-size: #optional actual size on disk in bytes of the image
101 # @dirty-flag: #optional true if image is not cleanly closed
103 # @cluster-size: #optional size of a cluster in bytes
105 # @encrypted: #optional true if the image is encrypted
107 # @compressed: #optional true if the image is compressed (Since 1.7)
109 # @backing-filename: #optional name of the backing file
111 # @full-backing-filename: #optional full path of the backing file
113 # @backing-filename-format: #optional the format of the backing file
115 # @snapshots: #optional list of VM snapshots
117 # @backing-image: #optional info of the backing image (since 1.6)
119 # @format-specific: #optional structure supplying additional format-specific
120 # information (since 1.7)
122 # @nocow: #optional info of whether NOCOW flag is set or not. (since 2.2)
124 # Since: 1.3
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' } }
139 # @ImageCheck:
141 # Information about a QEMU image file check
143 # @filename: name of the image file checked
145 # @format: format of the image file checked
147 # @check-errors: number of unexpected errors occurred during check
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
153 # @corruptions: #optional number of corruptions found during the check if any
155 # @leaks: #optional number of leaks found during the check if any
157 # @corruptions-fixed: #optional number of corruptions fixed during the check
158 #                     if any
160 # @leaks-fixed: #optional number of leaks fixed during the check if any
162 # @total-clusters: #optional total number of clusters, this field is present
163 #                  if the driver for the image format supports it
165 # @allocated-clusters: #optional total number of allocated clusters, this
166 #                      field is present if the driver for the image format
167 #                      supports it
169 # @fragmented-clusters: #optional total number of fragmented clusters, this
170 #                       field is present if the driver for the image format
171 #                       supports it
173 # @compressed-clusters: #optional total number of compressed clusters, this
174 #                       field is present if the driver for the image format
175 #                       supports it
177 # Since: 1.4
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' } }
189 # @BlockDeviceInfo:
191 # Information about the backing device for a block device.
193 # @file: the filename of the backing device
195 # @node-name: #optional the name of the block driver node (Since 2.0)
197 # @ro: true if the backing device was open read-only
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
206 # @backing_file: #optional the name of the backing file (for copy-on-write)
208 # @backing_file_depth: number of files in the backing file chain (since: 1.2)
210 # @encrypted: true if the backing device is encrypted
212 # @encryption_key_missing: true if the backing device is encrypted but an
213 #                          valid encryption key is missing
215 # @detect_zeroes: detect and optimize zero writes (Since 2.1)
217 # @bps: total throughput limit in bytes per second is specified
219 # @bps_rd: read throughput limit in bytes per second is specified
221 # @bps_wr: write throughput limit in bytes per second is specified
223 # @iops: total I/O operations per second is specified
225 # @iops_rd: read I/O operations per second is specified
227 # @iops_wr: write I/O operations per second is specified
229 # @image: the info of image used (since: 1.6)
231 # @bps_max: #optional total max in bytes (Since 1.7)
233 # @bps_rd_max: #optional read max in bytes (Since 1.7)
235 # @bps_wr_max: #optional write max in bytes (Since 1.7)
237 # @iops_max: #optional total I/O operations max (Since 1.7)
239 # @iops_rd_max: #optional read I/O operations max (Since 1.7)
241 # @iops_wr_max: #optional write I/O operations max (Since 1.7)
243 # @iops_size: #optional an I/O size in bytes (Since 1.7)
245 # Since: 0.14.0
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' } }
262 # @BlockDeviceIoStatus:
264 # An enumeration of block device I/O status.
266 # @ok: The last I/O operation has succeeded
268 # @failed: The last I/O operation has failed
270 # @nospace: The last I/O operation has failed due to a no-space condition
272 # Since: 1.0
274 { 'enum': 'BlockDeviceIoStatus', 'data': [ 'ok', 'failed', 'nospace' ] }
277 # @BlockDeviceMapEntry:
279 # Entry in the metadata map of the device (returned by "qemu-img map")
281 # @start: Offset in the image of the first byte described by this entry
282 #         (in bytes)
284 # @length: Length of the range described by this entry (in bytes)
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.
290 # @zero: the sectors in this range read as zeros
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)
296 # @offset: if present, the image file stores the data for this range in
297 #          raw format at the given offset.
299 # Since 1.7
301 { 'type': 'BlockDeviceMapEntry',
302   'data': { 'start': 'int', 'length': 'int', 'depth': 'int', 'zero': 'bool',
303             'data': 'bool', '*offset': 'int' } }
306 # @BlockDirtyInfo:
308 # Block dirty bitmap information.
310 # @count: number of dirty bytes according to the dirty bitmap
312 # @granularity: granularity of the dirty bitmap in bytes (since 1.4)
314 # Since: 1.3
316 { 'type': 'BlockDirtyInfo',
317   'data': {'count': 'int', 'granularity': 'int'} }
320 # @BlockInfo:
322 # Block device information.  This structure describes a virtual device and
323 # the backing device associated with it.
325 # @device: The device name associated with the virtual device.
327 # @type: This field is returned only for compatibility reasons, it should
328 #        not be used (always returns 'unknown')
330 # @removable: True if the device supports removable media.
332 # @locked: True if the guest has locked this device from having its media
333 #          removed
335 # @tray_open: #optional True if the device has a tray and it is open
336 #             (only present if removable is true)
338 # @dirty-bitmaps: #optional dirty bitmaps information (only present if the
339 #                 driver has one or more dirty bitmaps) (Since 2.0)
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)
345 # @inserted: #optional @BlockDeviceInfo describing the device if media is
346 #            present
348 # Since:  0.14.0
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'] } }
357 # @query-block:
359 # Get a list of BlockInfo for all virtual block devices.
361 # Returns: a list of @BlockInfo describing each virtual block device
363 # Since: 0.14.0
365 { 'command': 'query-block', 'returns': ['BlockInfo'] }
368 # @BlockDeviceStats:
370 # Statistics of a virtual block device or a block backing device.
372 # @rd_bytes:      The number of bytes read by the device.
374 # @wr_bytes:      The number of bytes written by the device.
376 # @rd_operations: The number of read operations performed by the device.
378 # @wr_operations: The number of write operations performed by the device.
380 # @flush_operations: The number of cache flush operations performed by the
381 #                    device (since 0.15.0)
383 # @flush_total_time_ns: Total time spend on cache flushes in nano-seconds
384 #                       (since 0.15.0).
386 # @wr_total_time_ns: Total time spend on writes in nano-seconds (since 0.15.0).
388 # @rd_total_time_ns: Total_time_spend on reads in nano-seconds (since 0.15.0).
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.
395 # Since: 0.14.0
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' } }
404 # @BlockStats:
406 # Statistics of a virtual block device or a block backing device.
408 # @device: #optional If the stats are for a virtual block device, the name
409 #          corresponding to the virtual block device.
411 # @stats:  A @BlockDeviceStats for the device.
413 # @parent: #optional This describes the file block device if it has one.
415 # @backing: #optional This describes the backing block device if it has one.
416 #           (Since 2.0)
418 # Since: 0.14.0
420 { 'type': 'BlockStats',
421   'data': {'*device': 'str', 'stats': 'BlockDeviceStats',
422            '*parent': 'BlockStats',
423            '*backing': 'BlockStats'} }
426 # @query-blockstats:
428 # Query the @BlockStats for all virtual block devices.
430 # Returns: A list of @BlockStats for each virtual block devices.
432 # Since: 0.14.0
434 { 'command': 'query-blockstats', 'returns': ['BlockStats'] }
437 # @BlockdevOnError:
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
443 # @report: for guest operations, report the error to the guest;
444 #          for jobs, cancel the job
446 # @ignore: ignore the error, only report a QMP event (BLOCK_IO_ERROR
447 #          or BLOCK_JOB_ERROR)
449 # @enospc: same as @stop on ENOSPC, same as @report otherwise.
451 # @stop: for guest operations, stop the virtual machine;
452 #        for jobs, pause the job
454 # Since: 1.3
456 { 'enum': 'BlockdevOnError',
457   'data': ['report', 'ignore', 'enospc', 'stop'] }
460 # @MirrorSyncMode:
462 # An enumeration of possible behaviors for the initial synchronization
463 # phase of storage mirroring.
465 # @top: copies data in the topmost image to the destination
467 # @full: copies data from all images to the destination
469 # @none: only copy data written from now on
471 # Since: 1.3
473 { 'enum': 'MirrorSyncMode',
474   'data': ['top', 'full', 'none'] }
477 # @BlockJobType:
479 # Type of a block job.
481 # @commit: block commit job type, see "block-commit"
483 # @stream: block stream job type, see "block-stream"
485 # @mirror: drive mirror job type, see "drive-mirror"
487 # @backup: drive backup job type, see "drive-backup"
489 # Since: 1.7
491 { 'enum': 'BlockJobType',
492   'data': ['commit', 'stream', 'mirror', 'backup'] }
495 # @BlockJobInfo:
497 # Information about a long-running block device operation.
499 # @type: the job type ('stream' for image streaming)
501 # @device: the block device name
503 # @len: the maximum progress value
505 # @busy: false if the job is known to be in a quiescent state, with
506 #        no pending I/O.  Since 1.3.
508 # @paused: whether the job is paused or, if @busy is true, will
509 #          pause itself as soon as possible.  Since 1.3.
511 # @offset: the current progress value
513 # @speed: the rate limit, bytes per second
515 # @io-status: the status of the job (since 1.3)
517 # @ready: true if the job may be completed (since 2.2)
519 # Since: 1.1
521 { 'type': 'BlockJobInfo',
522   'data': {'type': 'str', 'device': 'str', 'len': 'int',
523            'offset': 'int', 'busy': 'bool', 'paused': 'bool', 'speed': 'int',
524            'io-status': 'BlockDeviceIoStatus', 'ready': 'bool'} }
527 # @query-block-jobs:
529 # Return information about long-running block device operations.
531 # Returns: a list of @BlockJobInfo for each active block job
533 # Since: 1.1
535 { 'command': 'query-block-jobs', 'returns': ['BlockJobInfo'] }
538 # @block_passwd:
540 # This command sets the password of a block device that has not been open
541 # with a password and requires one.
543 # The two cases where this can happen are a block device is created through
544 # QEMU's initial command line or a block device is changed through the legacy
545 # @change interface.
547 # In the event that the block device is created through the initial command
548 # line, the VM will start in the stopped state regardless of whether '-S' is
549 # used.  The intention is for a management tool to query the block devices to
550 # determine which ones are encrypted, set the passwords with this command, and
551 # then start the guest with the @cont command.
553 # Either @device or @node-name must be set but not both.
555 # @device: #optional the name of the block backend device to set the password on
557 # @node-name: #optional graph node name to set the password on (Since 2.0)
559 # @password: the password to use for the device
561 # Returns: nothing on success
562 #          If @device is not a valid block device, DeviceNotFound
563 #          If @device is not encrypted, DeviceNotEncrypted
565 # Notes:  Not all block formats support encryption and some that do are not
566 #         able to validate that a password is correct.  Disk corruption may
567 #         occur if an invalid password is specified.
569 # Since: 0.14.0
571 { 'command': 'block_passwd', 'data': {'*device': 'str',
572                                       '*node-name': 'str', 'password': 'str'} }
575 # @block_resize
577 # Resize a block image while a guest is running.
579 # Either @device or @node-name must be set but not both.
581 # @device: #optional the name of the device to get the image resized
583 # @node-name: #optional graph node name to get the image resized (Since 2.0)
585 # @size:  new image size in bytes
587 # Returns: nothing on success
588 #          If @device is not a valid block device, DeviceNotFound
590 # Since: 0.14.0
592 { 'command': 'block_resize', 'data': { '*device': 'str',
593                                        '*node-name': 'str',
594                                        'size': 'int' }}
597 # @NewImageMode
599 # An enumeration that tells QEMU how to set the backing file path in
600 # a new image file.
602 # @existing: QEMU should look for an existing image file.
604 # @absolute-paths: QEMU should create a new image with absolute paths
605 # for the backing file. If there is no backing file available, the new
606 # image will not be backed either.
608 # Since: 1.1
610 { 'enum': 'NewImageMode',
611   'data': [ 'existing', 'absolute-paths' ] }
614 # @BlockdevSnapshot
616 # Either @device or @node-name must be set but not both.
618 # @device: #optional the name of the device to generate the snapshot from.
620 # @node-name: #optional graph node name to generate the snapshot from (Since 2.0)
622 # @snapshot-file: the target of the new image. A new file will be created.
624 # @snapshot-node-name: #optional the graph node name of the new image (Since 2.0)
626 # @format: #optional the format of the snapshot image, default is 'qcow2'.
628 # @mode: #optional whether and how QEMU should create a new image, default is
629 #        'absolute-paths'.
631 { 'type': 'BlockdevSnapshot',
632   'data': { '*device': 'str', '*node-name': 'str',
633             'snapshot-file': 'str', '*snapshot-node-name': 'str',
634             '*format': 'str', '*mode': 'NewImageMode' } }
637 # @DriveBackup
639 # @device: the name of the device which should be copied.
641 # @target: the target of the new image. If the file exists, or if it
642 #          is a device, the existing file/device will be used as the new
643 #          destination.  If it does not exist, a new file will be created.
645 # @format: #optional the format of the new destination, default is to
646 #          probe if @mode is 'existing', else the format of the source
648 # @sync: what parts of the disk image should be copied to the destination
649 #        (all the disk, only the sectors allocated in the topmost image, or
650 #        only new I/O).
652 # @mode: #optional whether and how QEMU should create a new image, default is
653 #        'absolute-paths'.
655 # @speed: #optional the maximum speed, in bytes per second
657 # @on-source-error: #optional the action to take on an error on the source,
658 #                   default 'report'.  'stop' and 'enospc' can only be used
659 #                   if the block device supports io-status (see BlockInfo).
661 # @on-target-error: #optional the action to take on an error on the target,
662 #                   default 'report' (no limitations, since this applies to
663 #                   a different block device than @device).
665 # Note that @on-source-error and @on-target-error only affect background I/O.
666 # If an error occurs during a guest write request, the device's rerror/werror
667 # actions will be used.
669 # Since: 1.6
671 { 'type': 'DriveBackup',
672   'data': { 'device': 'str', 'target': 'str', '*format': 'str',
673             'sync': 'MirrorSyncMode', '*mode': 'NewImageMode',
674             '*speed': 'int',
675             '*on-source-error': 'BlockdevOnError',
676             '*on-target-error': 'BlockdevOnError' } }
679 # @blockdev-snapshot-sync
681 # Generates a synchronous snapshot of a block device.
683 # For the arguments, see the documentation of BlockdevSnapshot.
685 # Returns: nothing on success
686 #          If @device is not a valid block device, DeviceNotFound
688 # Since 0.14.0
690 { 'command': 'blockdev-snapshot-sync',
691   'data': 'BlockdevSnapshot' }
694 # @change-backing-file
696 # Change the backing file in the image file metadata.  This does not
697 # cause QEMU to reopen the image file to reparse the backing filename
698 # (it may, however, perform a reopen to change permissions from
699 # r/o -> r/w -> r/o, if needed). The new backing file string is written
700 # into the image file metadata, and the QEMU internal strings are
701 # updated.
703 # @image-node-name: The name of the block driver state node of the
704 #                   image to modify.
706 # @device:          The name of the device that owns image-node-name.
708 # @backing-file:    The string to write as the backing file.  This
709 #                   string is not validated, so care should be taken
710 #                   when specifying the string or the image chain may
711 #                   not be able to be reopened again.
713 # Since: 2.1
715 { 'command': 'change-backing-file',
716   'data': { 'device': 'str', 'image-node-name': 'str',
717             'backing-file': 'str' } }
720 # @block-commit
722 # Live commit of data from overlay image nodes into backing nodes - i.e.,
723 # writes data between 'top' and 'base' into 'base'.
725 # @device:  the name of the device
727 # @base:   #optional The file name of the backing image to write data into.
728 #                    If not specified, this is the deepest backing image
730 # @top:    #optional The file name of the backing image within the image chain,
731 #                    which contains the topmost data to be committed down. If
732 #                    not specified, this is the active layer.
734 # @backing-file:  #optional The backing file string to write into the overlay
735 #                           image of 'top'.  If 'top' is the active layer,
736 #                           specifying a backing file string is an error. This
737 #                           filename is not validated.
739 #                           If a pathname string is such that it cannot be
740 #                           resolved by QEMU, that means that subsequent QMP or
741 #                           HMP commands must use node-names for the image in
742 #                           question, as filename lookup methods will fail.
744 #                           If not specified, QEMU will automatically determine
745 #                           the backing file string to use, or error out if
746 #                           there is no obvious choice. Care should be taken
747 #                           when specifying the string, to specify a valid
748 #                           filename or protocol.
749 #                           (Since 2.1)
751 #                    If top == base, that is an error.
752 #                    If top == active, the job will not be completed by itself,
753 #                    user needs to complete the job with the block-job-complete
754 #                    command after getting the ready event. (Since 2.0)
756 #                    If the base image is smaller than top, then the base image
757 #                    will be resized to be the same size as top.  If top is
758 #                    smaller than the base image, the base will not be
759 #                    truncated.  If you want the base image size to match the
760 #                    size of the smaller top, you can safely truncate it
761 #                    yourself once the commit operation successfully completes.
763 # @speed:  #optional the maximum speed, in bytes per second
765 # Returns: Nothing on success
766 #          If commit or stream is already active on this device, DeviceInUse
767 #          If @device does not exist, DeviceNotFound
768 #          If image commit is not supported by this device, NotSupported
769 #          If @base or @top is invalid, a generic error is returned
770 #          If @speed is invalid, InvalidParameter
772 # Since: 1.3
775 { 'command': 'block-commit',
776   'data': { 'device': 'str', '*base': 'str', '*top': 'str',
777             '*backing-file': 'str', '*speed': 'int' } }
780 # @drive-backup
782 # Start a point-in-time copy of a block device to a new destination.  The
783 # status of ongoing drive-backup operations can be checked with
784 # query-block-jobs where the BlockJobInfo.type field has the value 'backup'.
785 # The operation can be stopped before it has completed using the
786 # block-job-cancel command.
788 # For the arguments, see the documentation of DriveBackup.
790 # Returns: nothing on success
791 #          If @device is not a valid block device, DeviceNotFound
793 # Since 1.6
795 { 'command': 'drive-backup', 'data': 'DriveBackup' }
798 # @query-named-block-nodes
800 # Get the named block driver list
802 # Returns: the list of BlockDeviceInfo
804 # Since 2.0
806 { 'command': 'query-named-block-nodes', 'returns': [ 'BlockDeviceInfo' ] }
809 # @drive-mirror
811 # Start mirroring a block device's writes to a new destination.
813 # @device:  the name of the device whose writes should be mirrored.
815 # @target: the target of the new image. If the file exists, or if it
816 #          is a device, the existing file/device will be used as the new
817 #          destination.  If it does not exist, a new file will be created.
819 # @format: #optional the format of the new destination, default is to
820 #          probe if @mode is 'existing', else the format of the source
822 # @node-name: #optional the new block driver state node name in the graph
823 #             (Since 2.1)
825 # @replaces: #optional with sync=full graph node name to be replaced by the new
826 #            image when a whole image copy is done. This can be used to repair
827 #            broken Quorum files. (Since 2.1)
829 # @mode: #optional whether and how QEMU should create a new image, default is
830 #        'absolute-paths'.
832 # @speed:  #optional the maximum speed, in bytes per second
834 # @sync: what parts of the disk image should be copied to the destination
835 #        (all the disk, only the sectors allocated in the topmost image, or
836 #        only new I/O).
838 # @granularity: #optional granularity of the dirty bitmap, default is 64K
839 #               if the image format doesn't have clusters, 4K if the clusters
840 #               are smaller than that, else the cluster size.  Must be a
841 #               power of 2 between 512 and 64M (since 1.4).
843 # @buf-size: #optional maximum amount of data in flight from source to
844 #            target (since 1.4).
846 # @on-source-error: #optional the action to take on an error on the source,
847 #                   default 'report'.  'stop' and 'enospc' can only be used
848 #                   if the block device supports io-status (see BlockInfo).
850 # @on-target-error: #optional the action to take on an error on the target,
851 #                   default 'report' (no limitations, since this applies to
852 #                   a different block device than @device).
854 # Returns: nothing on success
855 #          If @device is not a valid block device, DeviceNotFound
857 # Since 1.3
859 { 'command': 'drive-mirror',
860   'data': { 'device': 'str', 'target': 'str', '*format': 'str',
861             '*node-name': 'str', '*replaces': 'str',
862             'sync': 'MirrorSyncMode', '*mode': 'NewImageMode',
863             '*speed': 'int', '*granularity': 'uint32',
864             '*buf-size': 'int', '*on-source-error': 'BlockdevOnError',
865             '*on-target-error': 'BlockdevOnError' } }
868 # @block_set_io_throttle:
870 # Change I/O throttle limits for a block drive.
872 # @device: The name of the device
874 # @bps: total throughput limit in bytes per second
876 # @bps_rd: read throughput limit in bytes per second
878 # @bps_wr: write throughput limit in bytes per second
880 # @iops: total I/O operations per second
882 # @ops_rd: read I/O operations per second
884 # @iops_wr: write I/O operations per second
886 # @bps_max: #optional total max in bytes (Since 1.7)
888 # @bps_rd_max: #optional read max in bytes (Since 1.7)
890 # @bps_wr_max: #optional write max in bytes (Since 1.7)
892 # @iops_max: #optional total I/O operations max (Since 1.7)
894 # @iops_rd_max: #optional read I/O operations max (Since 1.7)
896 # @iops_wr_max: #optional write I/O operations max (Since 1.7)
898 # @iops_size: #optional an I/O size in bytes (Since 1.7)
900 # Returns: Nothing on success
901 #          If @device is not a valid block device, DeviceNotFound
903 # Since: 1.1
905 { 'command': 'block_set_io_throttle',
906   'data': { 'device': 'str', 'bps': 'int', 'bps_rd': 'int', 'bps_wr': 'int',
907             'iops': 'int', 'iops_rd': 'int', 'iops_wr': 'int',
908             '*bps_max': 'int', '*bps_rd_max': 'int',
909             '*bps_wr_max': 'int', '*iops_max': 'int',
910             '*iops_rd_max': 'int', '*iops_wr_max': 'int',
911             '*iops_size': 'int' } }
914 # @block-stream:
916 # Copy data from a backing file into a block device.
918 # The block streaming operation is performed in the background until the entire
919 # backing file has been copied.  This command returns immediately once streaming
920 # has started.  The status of ongoing block streaming operations can be checked
921 # with query-block-jobs.  The operation can be stopped before it has completed
922 # using the block-job-cancel command.
924 # If a base file is specified then sectors are not copied from that base file and
925 # its backing chain.  When streaming completes the image file will have the base
926 # file as its backing file.  This can be used to stream a subset of the backing
927 # file chain instead of flattening the entire image.
929 # On successful completion the image file is updated to drop the backing file
930 # and the BLOCK_JOB_COMPLETED event is emitted.
932 # @device: the device name
934 # @base:   #optional the common backing file name
936 # @backing-file: #optional The backing file string to write into the active
937 #                          layer. This filename is not validated.
939 #                          If a pathname string is such that it cannot be
940 #                          resolved by QEMU, that means that subsequent QMP or
941 #                          HMP commands must use node-names for the image in
942 #                          question, as filename lookup methods will fail.
944 #                          If not specified, QEMU will automatically determine
945 #                          the backing file string to use, or error out if there
946 #                          is no obvious choice.  Care should be taken when
947 #                          specifying the string, to specify a valid filename or
948 #                          protocol.
949 #                          (Since 2.1)
951 # @speed:  #optional the maximum speed, in bytes per second
953 # @on-error: #optional the action to take on an error (default report).
954 #            'stop' and 'enospc' can only be used if the block device
955 #            supports io-status (see BlockInfo).  Since 1.3.
957 # Returns: Nothing on success
958 #          If @device does not exist, DeviceNotFound
960 # Since: 1.1
962 { 'command': 'block-stream',
963   'data': { 'device': 'str', '*base': 'str', '*backing-file': 'str',
964             '*speed': 'int', '*on-error': 'BlockdevOnError' } }
967 # @block-job-set-speed:
969 # Set maximum speed for a background block operation.
971 # This command can only be issued when there is an active block job.
973 # Throttling can be disabled by setting the speed to 0.
975 # @device: the device name
977 # @speed:  the maximum speed, in bytes per second, or 0 for unlimited.
978 #          Defaults to 0.
980 # Returns: Nothing on success
981 #          If no background operation is active on this device, DeviceNotActive
983 # Since: 1.1
985 { 'command': 'block-job-set-speed',
986   'data': { 'device': 'str', 'speed': 'int' } }
989 # @block-job-cancel:
991 # Stop an active background block operation.
993 # This command returns immediately after marking the active background block
994 # operation for cancellation.  It is an error to call this command if no
995 # operation is in progress.
997 # The operation will cancel as soon as possible and then emit the
998 # BLOCK_JOB_CANCELLED event.  Before that happens the job is still visible when
999 # enumerated using query-block-jobs.
1001 # For streaming, the image file retains its backing file unless the streaming
1002 # operation happens to complete just as it is being cancelled.  A new streaming
1003 # operation can be started at a later time to finish copying all data from the
1004 # backing file.
1006 # @device: the device name
1008 # @force: #optional whether to allow cancellation of a paused job (default
1009 #         false).  Since 1.3.
1011 # Returns: Nothing on success
1012 #          If no background operation is active on this device, DeviceNotActive
1014 # Since: 1.1
1016 { 'command': 'block-job-cancel', 'data': { 'device': 'str', '*force': 'bool' } }
1019 # @block-job-pause:
1021 # Pause an active background block operation.
1023 # This command returns immediately after marking the active background block
1024 # operation for pausing.  It is an error to call this command if no
1025 # operation is in progress.  Pausing an already paused job has no cumulative
1026 # effect; a single block-job-resume command will resume the job.
1028 # The operation will pause as soon as possible.  No event is emitted when
1029 # the operation is actually paused.  Cancelling a paused job automatically
1030 # resumes it.
1032 # @device: the device name
1034 # Returns: Nothing on success
1035 #          If no background operation is active on this device, DeviceNotActive
1037 # Since: 1.3
1039 { 'command': 'block-job-pause', 'data': { 'device': 'str' } }
1042 # @block-job-resume:
1044 # Resume an active background block operation.
1046 # This command returns immediately after resuming a paused background block
1047 # operation.  It is an error to call this command if no operation is in
1048 # progress.  Resuming an already running job is not an error.
1050 # This command also clears the error status of the job.
1052 # @device: the device name
1054 # Returns: Nothing on success
1055 #          If no background operation is active on this device, DeviceNotActive
1057 # Since: 1.3
1059 { 'command': 'block-job-resume', 'data': { 'device': 'str' } }
1062 # @block-job-complete:
1064 # Manually trigger completion of an active background block operation.  This
1065 # is supported for drive mirroring, where it also switches the device to
1066 # write to the target path only.  The ability to complete is signaled with
1067 # a BLOCK_JOB_READY event.
1069 # This command completes an active background block operation synchronously.
1070 # The ordering of this command's return with the BLOCK_JOB_COMPLETED event
1071 # is not defined.  Note that if an I/O error occurs during the processing of
1072 # this command: 1) the command itself will fail; 2) the error will be processed
1073 # according to the rerror/werror arguments that were specified when starting
1074 # the operation.
1076 # A cancelled or paused job cannot be completed.
1078 # @device: the device name
1080 # Returns: Nothing on success
1081 #          If no background operation is active on this device, DeviceNotActive
1083 # Since: 1.3
1085 { 'command': 'block-job-complete', 'data': { 'device': 'str' } }
1088 # @BlockdevDiscardOptions
1090 # Determines how to handle discard requests.
1092 # @ignore:      Ignore the request
1093 # @unmap:       Forward as an unmap request
1095 # Since: 1.7
1097 { 'enum': 'BlockdevDiscardOptions',
1098   'data': [ 'ignore', 'unmap' ] }
1101 # @BlockdevDetectZeroesOptions
1103 # Describes the operation mode for the automatic conversion of plain
1104 # zero writes by the OS to driver specific optimized zero write commands.
1106 # @off:      Disabled (default)
1107 # @on:       Enabled
1108 # @unmap:    Enabled and even try to unmap blocks if possible. This requires
1109 #            also that @BlockdevDiscardOptions is set to unmap for this device.
1111 # Since: 2.1
1113 { 'enum': 'BlockdevDetectZeroesOptions',
1114   'data': [ 'off', 'on', 'unmap' ] }
1117 # @BlockdevAioOptions
1119 # Selects the AIO backend to handle I/O requests
1121 # @threads:     Use qemu's thread pool
1122 # @native:      Use native AIO backend (only Linux and Windows)
1124 # Since: 1.7
1126 { 'enum': 'BlockdevAioOptions',
1127   'data': [ 'threads', 'native' ] }
1130 # @BlockdevCacheOptions
1132 # Includes cache-related options for block devices
1134 # @writeback:   #optional enables writeback mode for any caches (default: true)
1135 # @direct:      #optional enables use of O_DIRECT (bypass the host page cache;
1136 #               default: false)
1137 # @no-flush:    #optional ignore any flush requests for the device (default:
1138 #               false)
1140 # Since: 1.7
1142 { 'type': 'BlockdevCacheOptions',
1143   'data': { '*writeback': 'bool',
1144             '*direct': 'bool',
1145             '*no-flush': 'bool' } }
1148 # @BlockdevDriver
1150 # Drivers that are supported in block device operations.
1152 # @host_device, @host_cdrom, @host_floppy: Since 2.1
1154 # Since: 2.0
1156 { 'enum': 'BlockdevDriver',
1157   'data': [ 'archipelago', 'blkdebug', 'blkverify', 'bochs', 'cloop',
1158             'dmg', 'file', 'ftp', 'ftps', 'host_cdrom', 'host_device',
1159             'host_floppy', 'http', 'https', 'null-aio', 'null-co', 'parallels',
1160             'qcow', 'qcow2', 'qed', 'quorum', 'raw', 'tftp', 'vdi', 'vhdx',
1161             'vmdk', 'vpc', 'vvfat' ] }
1164 # @BlockdevOptionsBase
1166 # Options that are available for all block devices, independent of the block
1167 # driver.
1169 # @driver:        block driver name
1170 # @id:            #optional id by which the new block device can be referred to.
1171 #                 This is a required option on the top level of blockdev-add, and
1172 #                 currently not allowed on any other level.
1173 # @node-name:     #optional the name of a block driver state node (Since 2.0)
1174 # @discard:       #optional discard-related options (default: ignore)
1175 # @cache:         #optional cache-related options
1176 # @aio:           #optional AIO backend (default: threads)
1177 # @rerror:        #optional how to handle read errors on the device
1178 #                 (default: report)
1179 # @werror:        #optional how to handle write errors on the device
1180 #                 (default: enospc)
1181 # @read-only:     #optional whether the block device should be read-only
1182 #                 (default: false)
1183 # @detect-zeroes: #optional detect and optimize zero writes (Since 2.1)
1184 #                 (default: off)
1186 # Since: 1.7
1188 { 'type': 'BlockdevOptionsBase',
1189   'data': { 'driver': 'BlockdevDriver',
1190             '*id': 'str',
1191             '*node-name': 'str',
1192             '*discard': 'BlockdevDiscardOptions',
1193             '*cache': 'BlockdevCacheOptions',
1194             '*aio': 'BlockdevAioOptions',
1195             '*rerror': 'BlockdevOnError',
1196             '*werror': 'BlockdevOnError',
1197             '*read-only': 'bool',
1198             '*detect-zeroes': 'BlockdevDetectZeroesOptions' } }
1201 # @BlockdevOptionsFile
1203 # Driver specific block device options for the file backend and similar
1204 # protocols.
1206 # @filename:    path to the image file
1208 # Since: 1.7
1210 { 'type': 'BlockdevOptionsFile',
1211   'data': { 'filename': 'str' } }
1214 # @BlockdevOptionsNull
1216 # Driver specific block device options for the null backend.
1218 # @size:    #optional size of the device in bytes.
1220 # Since: 2.2
1222 { 'type': 'BlockdevOptionsNull',
1223   'data': { '*size': 'int' } }
1226 # @BlockdevOptionsVVFAT
1228 # Driver specific block device options for the vvfat protocol.
1230 # @dir:         directory to be exported as FAT image
1231 # @fat-type:    #optional FAT type: 12, 16 or 32
1232 # @floppy:      #optional whether to export a floppy image (true) or
1233 #               partitioned hard disk (false; default)
1234 # @rw:          #optional whether to allow write operations (default: false)
1236 # Since: 1.7
1238 { 'type': 'BlockdevOptionsVVFAT',
1239   'data': { 'dir': 'str', '*fat-type': 'int', '*floppy': 'bool',
1240             '*rw': 'bool' } }
1243 # @BlockdevOptionsGenericFormat
1245 # Driver specific block device options for image format that have no option
1246 # besides their data source.
1248 # @file:        reference to or definition of the data source block device
1250 # Since: 1.7
1252 { 'type': 'BlockdevOptionsGenericFormat',
1253   'data': { 'file': 'BlockdevRef' } }
1256 # @BlockdevOptionsGenericCOWFormat
1258 # Driver specific block device options for image format that have no option
1259 # besides their data source and an optional backing file.
1261 # @backing:     #optional reference to or definition of the backing file block
1262 #               device (if missing, taken from the image file content). It is
1263 #               allowed to pass an empty string here in order to disable the
1264 #               default backing file.
1266 # Since: 1.7
1268 { 'type': 'BlockdevOptionsGenericCOWFormat',
1269   'base': 'BlockdevOptionsGenericFormat',
1270   'data': { '*backing': 'BlockdevRef' } }
1273 # @Qcow2OverlapCheckMode
1275 # General overlap check modes.
1277 # @none:        Do not perform any checks
1279 # @constant:    Perform only checks which can be done in constant time and
1280 #               without reading anything from disk
1282 # @cached:      Perform only checks which can be done without reading anything
1283 #               from disk
1285 # @all:         Perform all available overlap checks
1287 # Since: 2.2
1289 { 'enum': 'Qcow2OverlapCheckMode',
1290   'data': [ 'none', 'constant', 'cached', 'all' ] }
1293 # @Qcow2OverlapCheckFlags
1295 # Structure of flags for each metadata structure. Setting a field to 'true'
1296 # makes qemu guard that structure against unintended overwriting. The default
1297 # value is chosen according to the template given.
1299 # @template: Specifies a template mode which can be adjusted using the other
1300 #            flags, defaults to 'cached'
1302 # Since: 2.2
1304 { 'type': 'Qcow2OverlapCheckFlags',
1305   'data': { '*template':       'Qcow2OverlapCheckMode',
1306             '*main-header':    'bool',
1307             '*active-l1':      'bool',
1308             '*active-l2':      'bool',
1309             '*refcount-table': 'bool',
1310             '*refcount-block': 'bool',
1311             '*snapshot-table': 'bool',
1312             '*inactive-l1':    'bool',
1313             '*inactive-l2':    'bool' } }
1316 # @Qcow2OverlapChecks
1318 # Specifies which metadata structures should be guarded against unintended
1319 # overwriting.
1321 # @flags:   set of flags for separate specification of each metadata structure
1322 #           type
1324 # @mode:    named mode which chooses a specific set of flags
1326 # Since: 2.2
1328 { 'union': 'Qcow2OverlapChecks',
1329   'discriminator': {},
1330   'data': { 'flags': 'Qcow2OverlapCheckFlags',
1331             'mode':  'Qcow2OverlapCheckMode' } }
1334 # @BlockdevOptionsQcow2
1336 # Driver specific block device options for qcow2.
1338 # @lazy-refcounts:        #optional whether to enable the lazy refcounts
1339 #                         feature (default is taken from the image file)
1341 # @pass-discard-request:  #optional whether discard requests to the qcow2
1342 #                         device should be forwarded to the data source
1344 # @pass-discard-snapshot: #optional whether discard requests for the data source
1345 #                         should be issued when a snapshot operation (e.g.
1346 #                         deleting a snapshot) frees clusters in the qcow2 file
1348 # @pass-discard-other:    #optional whether discard requests for the data source
1349 #                         should be issued on other occasions where a cluster
1350 #                         gets freed
1352 # @overlap-check:         #optional which overlap checks to perform for writes
1353 #                         to the image, defaults to 'cached' (since 2.2)
1355 # @cache-size:            #optional the maximum total size of the L2 table and
1356 #                         refcount block caches in bytes (since 2.2)
1358 # @l2-cache-size:         #optional the maximum size of the L2 table cache in
1359 #                         bytes (since 2.2)
1361 # @refcount-cache-size:   #optional the maximum size of the refcount block cache
1362 #                         in bytes (since 2.2)
1364 # Since: 1.7
1366 { 'type': 'BlockdevOptionsQcow2',
1367   'base': 'BlockdevOptionsGenericCOWFormat',
1368   'data': { '*lazy-refcounts': 'bool',
1369             '*pass-discard-request': 'bool',
1370             '*pass-discard-snapshot': 'bool',
1371             '*pass-discard-other': 'bool',
1372             '*overlap-check': 'Qcow2OverlapChecks',
1373             '*cache-size': 'int',
1374             '*l2-cache-size': 'int',
1375             '*refcount-cache-size': 'int' } }
1379 # @BlockdevOptionsArchipelago
1381 # Driver specific block device options for Archipelago.
1383 # @volume:              Name of the Archipelago volume image
1385 # @mport:               #optional The port number on which mapperd is
1386 #                       listening. This is optional
1387 #                       and if not specified, QEMU will make Archipelago
1388 #                       use the default port (1001).
1390 # @vport:               #optional The port number on which vlmcd is
1391 #                       listening. This is optional
1392 #                       and if not specified, QEMU will make Archipelago
1393 #                       use the default port (501).
1395 # @segment:             #optional The name of the shared memory segment
1396 #                       Archipelago stack is using. This is optional
1397 #                       and if not specified, QEMU will make Archipelago
1398 #                       use the default value, 'archipelago'.
1399 # Since: 2.2
1401 { 'type': 'BlockdevOptionsArchipelago',
1402   'data': { 'volume': 'str',
1403             '*mport': 'int',
1404             '*vport': 'int',
1405             '*segment': 'str' } }
1409 # @BlkdebugEvent
1411 # Trigger events supported by blkdebug.
1413 { 'enum': 'BlkdebugEvent',
1414   'data': [ 'l1_update', 'l1_grow.alloc_table', 'l1_grow.write_table',
1415             'l1_grow.activate_table', 'l2_load', 'l2_update',
1416             'l2_update_compressed', 'l2_alloc.cow_read', 'l2_alloc.write',
1417             'read_aio', 'read_backing_aio', 'read_compressed', 'write_aio',
1418             'write_compressed', 'vmstate_load', 'vmstate_save', 'cow_read',
1419             'cow_write', 'reftable_load', 'reftable_grow', 'reftable_update',
1420             'refblock_load', 'refblock_update', 'refblock_update_part',
1421             'refblock_alloc', 'refblock_alloc.hookup', 'refblock_alloc.write',
1422             'refblock_alloc.write_blocks', 'refblock_alloc.write_table',
1423             'refblock_alloc.switch_table', 'cluster_alloc',
1424             'cluster_alloc_bytes', 'cluster_free', 'flush_to_os',
1425             'flush_to_disk' ] }
1428 # @BlkdebugInjectErrorOptions
1430 # Describes a single error injection for blkdebug.
1432 # @event:       trigger event
1434 # @state:       #optional the state identifier blkdebug needs to be in to
1435 #               actually trigger the event; defaults to "any"
1437 # @errno:       #optional error identifier (errno) to be returned; defaults to
1438 #               EIO
1440 # @sector:      #optional specifies the sector index which has to be affected
1441 #               in order to actually trigger the event; defaults to "any
1442 #               sector"
1444 # @once:        #optional disables further events after this one has been
1445 #               triggered; defaults to false
1447 # @immediately: #optional fail immediately; defaults to false
1449 # Since: 2.0
1451 { 'type': 'BlkdebugInjectErrorOptions',
1452   'data': { 'event': 'BlkdebugEvent',
1453             '*state': 'int',
1454             '*errno': 'int',
1455             '*sector': 'int',
1456             '*once': 'bool',
1457             '*immediately': 'bool' } }
1460 # @BlkdebugSetStateOptions
1462 # Describes a single state-change event for blkdebug.
1464 # @event:       trigger event
1466 # @state:       #optional the current state identifier blkdebug needs to be in;
1467 #               defaults to "any"
1469 # @new_state:   the state identifier blkdebug is supposed to assume if
1470 #               this event is triggered
1472 # Since: 2.0
1474 { 'type': 'BlkdebugSetStateOptions',
1475   'data': { 'event': 'BlkdebugEvent',
1476             '*state': 'int',
1477             'new_state': 'int' } }
1480 # @BlockdevOptionsBlkdebug
1482 # Driver specific block device options for blkdebug.
1484 # @image:           underlying raw block device (or image file)
1486 # @config:          #optional filename of the configuration file
1488 # @align:           #optional required alignment for requests in bytes
1490 # @inject-error:    #optional array of error injection descriptions
1492 # @set-state:       #optional array of state-change descriptions
1494 # Since: 2.0
1496 { 'type': 'BlockdevOptionsBlkdebug',
1497   'data': { 'image': 'BlockdevRef',
1498             '*config': 'str',
1499             '*align': 'int',
1500             '*inject-error': ['BlkdebugInjectErrorOptions'],
1501             '*set-state': ['BlkdebugSetStateOptions'] } }
1504 # @BlockdevOptionsBlkverify
1506 # Driver specific block device options for blkverify.
1508 # @test:    block device to be tested
1510 # @raw:     raw image used for verification
1512 # Since: 2.0
1514 { 'type': 'BlockdevOptionsBlkverify',
1515   'data': { 'test': 'BlockdevRef',
1516             'raw': 'BlockdevRef' } }
1519 # @QuorumReadPattern
1521 # An enumeration of quorum read patterns.
1523 # @quorum: read all the children and do a quorum vote on reads
1525 # @fifo: read only from the first child that has not failed
1527 # Since: 2.2
1529 { 'enum': 'QuorumReadPattern', 'data': [ 'quorum', 'fifo' ] }
1532 # @BlockdevOptionsQuorum
1534 # Driver specific block device options for Quorum
1536 # @blkverify:      #optional true if the driver must print content mismatch
1537 #                  set to false by default
1539 # @children:       the children block devices to use
1541 # @vote-threshold: the vote limit under which a read will fail
1543 # @rewrite-corrupted: #optional rewrite corrupted data when quorum is reached
1544 #                     (Since 2.1)
1546 # @read-pattern: #optional choose read pattern and set to quorum by default
1547 #                (Since 2.2)
1549 # Since: 2.0
1551 { 'type': 'BlockdevOptionsQuorum',
1552   'data': { '*blkverify': 'bool',
1553             'children': [ 'BlockdevRef' ],
1554             'vote-threshold': 'int',
1555             '*rewrite-corrupted': 'bool',
1556             '*read-pattern': 'QuorumReadPattern' } }
1559 # @BlockdevOptions
1561 # Options for creating a block device.
1563 # Since: 1.7
1565 { 'union': 'BlockdevOptions',
1566   'base': 'BlockdevOptionsBase',
1567   'discriminator': 'driver',
1568   'data': {
1569       'archipelago':'BlockdevOptionsArchipelago',
1570       'blkdebug':   'BlockdevOptionsBlkdebug',
1571       'blkverify':  'BlockdevOptionsBlkverify',
1572       'bochs':      'BlockdevOptionsGenericFormat',
1573       'cloop':      'BlockdevOptionsGenericFormat',
1574       'dmg':        'BlockdevOptionsGenericFormat',
1575       'file':       'BlockdevOptionsFile',
1576       'ftp':        'BlockdevOptionsFile',
1577       'ftps':       'BlockdevOptionsFile',
1578 # TODO gluster: Wait for structured options
1579       'host_cdrom': 'BlockdevOptionsFile',
1580       'host_device':'BlockdevOptionsFile',
1581       'host_floppy':'BlockdevOptionsFile',
1582       'http':       'BlockdevOptionsFile',
1583       'https':      'BlockdevOptionsFile',
1584 # TODO iscsi: Wait for structured options
1585 # TODO nbd: Should take InetSocketAddress for 'host'?
1586 # TODO nfs: Wait for structured options
1587       'null-aio':   'BlockdevOptionsNull',
1588       'null-co':    'BlockdevOptionsNull',
1589       'parallels':  'BlockdevOptionsGenericFormat',
1590       'qcow2':      'BlockdevOptionsQcow2',
1591       'qcow':       'BlockdevOptionsGenericCOWFormat',
1592       'qed':        'BlockdevOptionsGenericCOWFormat',
1593       'quorum':     'BlockdevOptionsQuorum',
1594       'raw':        'BlockdevOptionsGenericFormat',
1595 # TODO rbd: Wait for structured options
1596 # TODO sheepdog: Wait for structured options
1597 # TODO ssh: Should take InetSocketAddress for 'host'?
1598       'tftp':       'BlockdevOptionsFile',
1599       'vdi':        'BlockdevOptionsGenericFormat',
1600       'vhdx':       'BlockdevOptionsGenericFormat',
1601       'vmdk':       'BlockdevOptionsGenericCOWFormat',
1602       'vpc':        'BlockdevOptionsGenericFormat',
1603       'vvfat':      'BlockdevOptionsVVFAT'
1604   } }
1607 # @BlockdevRef
1609 # Reference to a block device.
1611 # @definition:      defines a new block device inline
1612 # @reference:       references the ID of an existing block device. An
1613 #                   empty string means that no block device should be
1614 #                   referenced.
1616 # Since: 1.7
1618 { 'union': 'BlockdevRef',
1619   'discriminator': {},
1620   'data': { 'definition': 'BlockdevOptions',
1621             'reference': 'str' } }
1624 # @blockdev-add:
1626 # Creates a new block device.
1628 # @options: block device options for the new device
1630 # Since: 1.7
1632 { 'command': 'blockdev-add', 'data': { 'options': 'BlockdevOptions' } }
1636 # @BlockErrorAction
1638 # An enumeration of action that has been taken when a DISK I/O occurs
1640 # @ignore: error has been ignored
1642 # @report: error has been reported to the device
1644 # @stop: error caused VM to be stopped
1646 # Since: 2.1
1648 { 'enum': 'BlockErrorAction',
1649   'data': [ 'ignore', 'report', 'stop' ] }
1653 # @BLOCK_IMAGE_CORRUPTED
1655 # Emitted when a corruption has been detected in a disk image
1657 # @device: device name
1659 # @msg: informative message for human consumption, such as the kind of
1660 #       corruption being detected. It should not be parsed by machine as it is
1661 #       not guaranteed to be stable
1663 # @offset: #optional, if the corruption resulted from an image access, this is
1664 #          the access offset into the image
1666 # @size: #optional, if the corruption resulted from an image access, this is
1667 #        the access size
1669 # fatal: if set, the image is marked corrupt and therefore unusable after this
1670 #        event and must be repaired (Since 2.2; before, every
1671 #        BLOCK_IMAGE_CORRUPTED event was fatal)
1673 # Since: 1.7
1675 { 'event': 'BLOCK_IMAGE_CORRUPTED',
1676   'data': { 'device' : 'str',
1677             'msg'    : 'str',
1678             '*offset': 'int',
1679             '*size'  : 'int',
1680             'fatal'  : 'bool' } }
1683 # @BLOCK_IO_ERROR
1685 # Emitted when a disk I/O error occurs
1687 # @device: device name
1689 # @operation: I/O operation
1691 # @action: action that has been taken
1693 # @nospace: #optional true if I/O error was caused due to a no-space
1694 #           condition. This key is only present if query-block's
1695 #           io-status is present, please see query-block documentation
1696 #           for more information (since: 2.2)
1698 # @reason: human readable string describing the error cause.
1699 #          (This field is a debugging aid for humans, it should not
1700 #           be parsed by applications) (since: 2.2)
1702 # Note: If action is "stop", a STOP event will eventually follow the
1703 # BLOCK_IO_ERROR event
1705 # Since: 0.13.0
1707 { 'event': 'BLOCK_IO_ERROR',
1708   'data': { 'device': 'str', 'operation': 'IoOperationType',
1709             'action': 'BlockErrorAction', '*nospace': 'bool',
1710             'reason': 'str' } }
1713 # @BLOCK_JOB_COMPLETED
1715 # Emitted when a block job has completed
1717 # @type: job type
1719 # @device: device name
1721 # @len: maximum progress value
1723 # @offset: current progress value. On success this is equal to len.
1724 #          On failure this is less than len
1726 # @speed: rate limit, bytes per second
1728 # @error: #optional, error message. Only present on failure. This field
1729 #         contains a human-readable error message. There are no semantics
1730 #         other than that streaming has failed and clients should not try to
1731 #         interpret the error string
1733 # Since: 1.1
1735 { 'event': 'BLOCK_JOB_COMPLETED',
1736   'data': { 'type'  : 'BlockJobType',
1737             'device': 'str',
1738             'len'   : 'int',
1739             'offset': 'int',
1740             'speed' : 'int',
1741             '*error': 'str' } }
1744 # @BLOCK_JOB_CANCELLED
1746 # Emitted when a block job has been cancelled
1748 # @type: job type
1750 # @device: device name
1752 # @len: maximum progress value
1754 # @offset: current progress value. On success this is equal to len.
1755 #          On failure this is less than len
1757 # @speed: rate limit, bytes per second
1759 # Since: 1.1
1761 { 'event': 'BLOCK_JOB_CANCELLED',
1762   'data': { 'type'  : 'BlockJobType',
1763             'device': 'str',
1764             'len'   : 'int',
1765             'offset': 'int',
1766             'speed' : 'int' } }
1769 # @BLOCK_JOB_ERROR
1771 # Emitted when a block job encounters an error
1773 # @device: device name
1775 # @operation: I/O operation
1777 # @action: action that has been taken
1779 # Since: 1.3
1781 { 'event': 'BLOCK_JOB_ERROR',
1782   'data': { 'device'   : 'str',
1783             'operation': 'IoOperationType',
1784             'action'   : 'BlockErrorAction' } }
1787 # @BLOCK_JOB_READY
1789 # Emitted when a block job is ready to complete
1791 # @type: job type
1793 # @device: device name
1795 # @len: maximum progress value
1797 # @offset: current progress value. On success this is equal to len.
1798 #          On failure this is less than len
1800 # @speed: rate limit, bytes per second
1802 # Note: The "ready to complete" status is always reset by a @BLOCK_JOB_ERROR
1803 # event
1805 # Since: 1.3
1807 { 'event': 'BLOCK_JOB_READY',
1808   'data': { 'type'  : 'BlockJobType',
1809             'device': 'str',
1810             'len'   : 'int',
1811             'offset': 'int',
1812             'speed' : 'int' } }
1814 # @PreallocMode
1816 # Preallocation mode of QEMU image file
1818 # @off: no preallocation
1819 # @metadata: preallocate only for metadata
1820 # @falloc: like @full preallocation but allocate disk space by
1821 #          posix_fallocate() rather than writing zeros.
1822 # @full: preallocate all data by writing zeros to device to ensure disk
1823 #        space is really available. @full preallocation also sets up
1824 #        metadata correctly.
1826 # Since 2.2
1828 { 'enum': 'PreallocMode',
1829   'data': [ 'off', 'metadata', 'falloc', 'full' ] }