virtio-balloon: fix virtio-balloon child refcount in transports
[qemu-kvm.git] / qapi / block-core.json
blobfa2d1b75285a169afa48d13bc524dd6e765c6f46
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 # Since: 1.7
43 { 'type': 'ImageInfoSpecificQCow2',
44   'data': {
45       'compat': 'str',
46       '*lazy-refcounts': 'bool'
47   } }
50 # @ImageInfoSpecificVmdk:
52 # @create-type: The create type of VMDK image
54 # @cid: Content id of image
56 # @parent-cid: Parent VMDK image's cid
58 # @extents: List of extent files
60 # Since: 1.7
62 { 'type': 'ImageInfoSpecificVmdk',
63   'data': {
64       'create-type': 'str',
65       'cid': 'int',
66       'parent-cid': 'int',
67       'extents': ['ImageInfo']
68   } }
71 # @ImageInfoSpecific:
73 # A discriminated record of image format specific information structures.
75 # Since: 1.7
78 { 'union': 'ImageInfoSpecific',
79   'data': {
80       'qcow2': 'ImageInfoSpecificQCow2',
81       'vmdk': 'ImageInfoSpecificVmdk'
82   } }
85 # @ImageInfo:
87 # Information about a QEMU image file
89 # @filename: name of the image file
91 # @format: format of the image file
93 # @virtual-size: maximum capacity in bytes of the image
95 # @actual-size: #optional actual size on disk in bytes of the image
97 # @dirty-flag: #optional true if image is not cleanly closed
99 # @cluster-size: #optional size of a cluster in bytes
101 # @encrypted: #optional true if the image is encrypted
103 # @compressed: #optional true if the image is compressed (Since 1.7)
105 # @backing-filename: #optional name of the backing file
107 # @full-backing-filename: #optional full path of the backing file
109 # @backing-filename-format: #optional the format of the backing file
111 # @snapshots: #optional list of VM snapshots
113 # @backing-image: #optional info of the backing image (since 1.6)
115 # @format-specific: #optional structure supplying additional format-specific
116 # information (since 1.7)
118 # @nocow: #optional info of whether NOCOW flag is set or not. (since 2.2)
120 # Since: 1.3
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' } }
135 # @ImageCheck:
137 # Information about a QEMU image file check
139 # @filename: name of the image file checked
141 # @format: format of the image file checked
143 # @check-errors: number of unexpected errors occurred during check
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
149 # @corruptions: #optional number of corruptions found during the check if any
151 # @leaks: #optional number of leaks found during the check if any
153 # @corruptions-fixed: #optional number of corruptions fixed during the check
154 #                     if any
156 # @leaks-fixed: #optional number of leaks fixed during the check if any
158 # @total-clusters: #optional total number of clusters, this field is present
159 #                  if the driver for the image format supports it
161 # @allocated-clusters: #optional total number of allocated clusters, this
162 #                      field is present if the driver for the image format
163 #                      supports it
165 # @fragmented-clusters: #optional total number of fragmented clusters, this
166 #                       field is present if the driver for the image format
167 #                       supports it
169 # @compressed-clusters: #optional total number of compressed clusters, this
170 #                       field is present if the driver for the image format
171 #                       supports it
173 # Since: 1.4
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' } }
185 # @BlockDeviceInfo:
187 # Information about the backing device for a block device.
189 # @file: the filename of the backing device
191 # @node-name: #optional the name of the block driver node (Since 2.0)
193 # @ro: true if the backing device was open read-only
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
202 # @backing_file: #optional the name of the backing file (for copy-on-write)
204 # @backing_file_depth: number of files in the backing file chain (since: 1.2)
206 # @encrypted: true if the backing device is encrypted
208 # @encryption_key_missing: true if the backing device is encrypted but an
209 #                          valid encryption key is missing
211 # @detect_zeroes: detect and optimize zero writes (Since 2.1)
213 # @bps: total throughput limit in bytes per second is specified
215 # @bps_rd: read throughput limit in bytes per second is specified
217 # @bps_wr: write throughput limit in bytes per second is specified
219 # @iops: total I/O operations per second is specified
221 # @iops_rd: read I/O operations per second is specified
223 # @iops_wr: write I/O operations per second is specified
225 # @image: the info of image used (since: 1.6)
227 # @bps_max: #optional total max in bytes (Since 1.7)
229 # @bps_rd_max: #optional read max in bytes (Since 1.7)
231 # @bps_wr_max: #optional write max in bytes (Since 1.7)
233 # @iops_max: #optional total I/O operations max (Since 1.7)
235 # @iops_rd_max: #optional read I/O operations max (Since 1.7)
237 # @iops_wr_max: #optional write I/O operations max (Since 1.7)
239 # @iops_size: #optional an I/O size in bytes (Since 1.7)
241 # Since: 0.14.0
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' } }
258 # @BlockDeviceIoStatus:
260 # An enumeration of block device I/O status.
262 # @ok: The last I/O operation has succeeded
264 # @failed: The last I/O operation has failed
266 # @nospace: The last I/O operation has failed due to a no-space condition
268 # Since: 1.0
270 { 'enum': 'BlockDeviceIoStatus', 'data': [ 'ok', 'failed', 'nospace' ] }
273 # @BlockDeviceMapEntry:
275 # Entry in the metadata map of the device (returned by "qemu-img map")
277 # @start: Offset in the image of the first byte described by this entry
278 #         (in bytes)
280 # @length: Length of the range described by this entry (in bytes)
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.
286 # @zero: the sectors in this range read as zeros
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)
292 # @offset: if present, the image file stores the data for this range in
293 #          raw format at the given offset.
295 # Since 1.7
297 { 'type': 'BlockDeviceMapEntry',
298   'data': { 'start': 'int', 'length': 'int', 'depth': 'int', 'zero': 'bool',
299             'data': 'bool', '*offset': 'int' } }
302 # @BlockDirtyInfo:
304 # Block dirty bitmap information.
306 # @count: number of dirty bytes according to the dirty bitmap
308 # @granularity: granularity of the dirty bitmap in bytes (since 1.4)
310 # Since: 1.3
312 { 'type': 'BlockDirtyInfo',
313   'data': {'count': 'int', 'granularity': 'int'} }
316 # @BlockInfo:
318 # Block device information.  This structure describes a virtual device and
319 # the backing device associated with it.
321 # @device: The device name associated with the virtual device.
323 # @type: This field is returned only for compatibility reasons, it should
324 #        not be used (always returns 'unknown')
326 # @removable: True if the device supports removable media.
328 # @locked: True if the guest has locked this device from having its media
329 #          removed
331 # @tray_open: #optional True if the device has a tray and it is open
332 #             (only present if removable is true)
334 # @dirty-bitmaps: #optional dirty bitmaps information (only present if the
335 #                 driver has one or more dirty bitmaps) (Since 2.0)
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)
341 # @inserted: #optional @BlockDeviceInfo describing the device if media is
342 #            present
344 # Since:  0.14.0
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'] } }
353 # @query-block:
355 # Get a list of BlockInfo for all virtual block devices.
357 # Returns: a list of @BlockInfo describing each virtual block device
359 # Since: 0.14.0
361 { 'command': 'query-block', 'returns': ['BlockInfo'] }
364 # @BlockDeviceStats:
366 # Statistics of a virtual block device or a block backing device.
368 # @rd_bytes:      The number of bytes read by the device.
370 # @wr_bytes:      The number of bytes written by the device.
372 # @rd_operations: The number of read operations performed by the device.
374 # @wr_operations: The number of write operations performed by the device.
376 # @flush_operations: The number of cache flush operations performed by the
377 #                    device (since 0.15.0)
379 # @flush_total_time_ns: Total time spend on cache flushes in nano-seconds
380 #                       (since 0.15.0).
382 # @wr_total_time_ns: Total time spend on writes in nano-seconds (since 0.15.0).
384 # @rd_total_time_ns: Total_time_spend on reads in nano-seconds (since 0.15.0).
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.
391 # Since: 0.14.0
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' } }
400 # @BlockStats:
402 # Statistics of a virtual block device or a block backing device.
404 # @device: #optional If the stats are for a virtual block device, the name
405 #          corresponding to the virtual block device.
407 # @stats:  A @BlockDeviceStats for the device.
409 # @parent: #optional This describes the file block device if it has one.
411 # @backing: #optional This describes the backing block device if it has one.
412 #           (Since 2.0)
414 # Since: 0.14.0
416 { 'type': 'BlockStats',
417   'data': {'*device': 'str', 'stats': 'BlockDeviceStats',
418            '*parent': 'BlockStats',
419            '*backing': 'BlockStats'} }
422 # @query-blockstats:
424 # Query the @BlockStats for all virtual block devices.
426 # Returns: A list of @BlockStats for each virtual block devices.
428 # Since: 0.14.0
430 { 'command': 'query-blockstats', 'returns': ['BlockStats'] }
433 # @BlockdevOnError:
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
439 # @report: for guest operations, report the error to the guest;
440 #          for jobs, cancel the job
442 # @ignore: ignore the error, only report a QMP event (BLOCK_IO_ERROR
443 #          or BLOCK_JOB_ERROR)
445 # @enospc: same as @stop on ENOSPC, same as @report otherwise.
447 # @stop: for guest operations, stop the virtual machine;
448 #        for jobs, pause the job
450 # Since: 1.3
452 { 'enum': 'BlockdevOnError',
453   'data': ['report', 'ignore', 'enospc', 'stop'] }
456 # @MirrorSyncMode:
458 # An enumeration of possible behaviors for the initial synchronization
459 # phase of storage mirroring.
461 # @top: copies data in the topmost image to the destination
463 # @full: copies data from all images to the destination
465 # @none: only copy data written from now on
467 # Since: 1.3
469 { 'enum': 'MirrorSyncMode',
470   'data': ['top', 'full', 'none'] }
473 # @BlockJobType:
475 # Type of a block job.
477 # @commit: block commit job type, see "block-commit"
479 # @stream: block stream job type, see "block-stream"
481 # @mirror: drive mirror job type, see "drive-mirror"
483 # @backup: drive backup job type, see "drive-backup"
485 # Since: 1.7
487 { 'enum': 'BlockJobType',
488   'data': ['commit', 'stream', 'mirror', 'backup'] }
491 # @BlockJobInfo:
493 # Information about a long-running block device operation.
495 # @type: the job type ('stream' for image streaming)
497 # @device: the block device name
499 # @len: the maximum progress value
501 # @busy: false if the job is known to be in a quiescent state, with
502 #        no pending I/O.  Since 1.3.
504 # @paused: whether the job is paused or, if @busy is true, will
505 #          pause itself as soon as possible.  Since 1.3.
507 # @offset: the current progress value
509 # @speed: the rate limit, bytes per second
511 # @io-status: the status of the job (since 1.3)
513 # Since: 1.1
515 { 'type': 'BlockJobInfo',
516   'data': {'type': 'str', 'device': 'str', 'len': 'int',
517            'offset': 'int', 'busy': 'bool', 'paused': 'bool', 'speed': 'int',
518            'io-status': 'BlockDeviceIoStatus'} }
521 # @query-block-jobs:
523 # Return information about long-running block device operations.
525 # Returns: a list of @BlockJobInfo for each active block job
527 # Since: 1.1
529 { 'command': 'query-block-jobs', 'returns': ['BlockJobInfo'] }
532 # @block_passwd:
534 # This command sets the password of a block device that has not been open
535 # with a password and requires one.
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.
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.
547 # Either @device or @node-name must be set but not both.
549 # @device: #optional the name of the block backend device to set the password on
551 # @node-name: #optional graph node name to set the password on (Since 2.0)
553 # @password: the password to use for the device
555 # Returns: nothing on success
556 #          If @device is not a valid block device, DeviceNotFound
557 #          If @device is not encrypted, DeviceNotEncrypted
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.
563 # Since: 0.14.0
565 { 'command': 'block_passwd', 'data': {'*device': 'str',
566                                       '*node-name': 'str', 'password': 'str'} }
569 # @block_resize
571 # Resize a block image while a guest is running.
573 # Either @device or @node-name must be set but not both.
575 # @device: #optional the name of the device to get the image resized
577 # @node-name: #optional graph node name to get the image resized (Since 2.0)
579 # @size:  new image size in bytes
581 # Returns: nothing on success
582 #          If @device is not a valid block device, DeviceNotFound
584 # Since: 0.14.0
586 { 'command': 'block_resize', 'data': { '*device': 'str',
587                                        '*node-name': 'str',
588                                        'size': 'int' }}
591 # @NewImageMode
593 # An enumeration that tells QEMU how to set the backing file path in
594 # a new image file.
596 # @existing: QEMU should look for an existing image file.
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.
602 # Since: 1.1
604 { 'enum': 'NewImageMode',
605   'data': [ 'existing', 'absolute-paths' ] }
608 # @BlockdevSnapshot
610 # Either @device or @node-name must be set but not both.
612 # @device: #optional the name of the device to generate the snapshot from.
614 # @node-name: #optional graph node name to generate the snapshot from (Since 2.0)
616 # @snapshot-file: the target of the new image. A new file will be created.
618 # @snapshot-node-name: #optional the graph node name of the new image (Since 2.0)
620 # @format: #optional the format of the snapshot image, default is 'qcow2'.
622 # @mode: #optional whether and how QEMU should create a new image, default is
623 #        'absolute-paths'.
625 { 'type': 'BlockdevSnapshot',
626   'data': { '*device': 'str', '*node-name': 'str',
627             'snapshot-file': 'str', '*snapshot-node-name': 'str',
628             '*format': 'str', '*mode': 'NewImageMode' } }
631 # @DriveBackup
633 # @device: the name of the device which should be copied.
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.
639 # @format: #optional the format of the new destination, default is to
640 #          probe if @mode is 'existing', else the format of the source
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).
646 # @mode: #optional whether and how QEMU should create a new image, default is
647 #        'absolute-paths'.
649 # @speed: #optional the maximum speed, in bytes per second
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).
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).
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.
663 # Since: 1.6
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' } }
673 # @blockdev-snapshot-sync
675 # Generates a synchronous snapshot of a block device.
677 # For the arguments, see the documentation of BlockdevSnapshot.
679 # Returns: nothing on success
680 #          If @device is not a valid block device, DeviceNotFound
682 # Since 0.14.0
684 { 'command': 'blockdev-snapshot-sync',
685   'data': 'BlockdevSnapshot' }
688 # @change-backing-file
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.
697 # @image-node-name: The name of the block driver state node of the
698 #                   image to modify.
700 # @device:          The name of the device that owns image-node-name.
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.
707 # Since: 2.1
709 { 'command': 'change-backing-file',
710   'data': { 'device': 'str', 'image-node-name': 'str',
711             'backing-file': 'str' } }
714 # @block-commit
716 # Live commit of data from overlay image nodes into backing nodes - i.e.,
717 # writes data between 'top' and 'base' into 'base'.
719 # @device:  the name of the device
721 # @base:   #optional The file name of the backing image to write data into.
722 #                    If not specified, this is the deepest backing image
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.
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.
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.
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)
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)
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.
757 # @speed:  #optional the maximum speed, in bytes per second
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
766 # Since: 1.3
769 { 'command': 'block-commit',
770   'data': { 'device': 'str', '*base': 'str', '*top': 'str',
771             '*backing-file': 'str', '*speed': 'int' } }
774 # @drive-backup
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.
782 # For the arguments, see the documentation of DriveBackup.
784 # Returns: nothing on success
785 #          If @device is not a valid block device, DeviceNotFound
787 # Since 1.6
789 { 'command': 'drive-backup', 'data': 'DriveBackup' }
792 # @query-named-block-nodes
794 # Get the named block driver list
796 # Returns: the list of BlockDeviceInfo
798 # Since 2.0
800 { 'command': 'query-named-block-nodes', 'returns': [ 'BlockDeviceInfo' ] }
803 # @drive-mirror
805 # Start mirroring a block device's writes to a new destination.
807 # @device:  the name of the device whose writes should be mirrored.
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.
813 # @format: #optional the format of the new destination, default is to
814 #          probe if @mode is 'existing', else the format of the source
816 # @node-name: #optional the new block driver state node name in the graph
817 #             (Since 2.1)
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)
823 # @mode: #optional whether and how QEMU should create a new image, default is
824 #        'absolute-paths'.
826 # @speed:  #optional the maximum speed, in bytes per second
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).
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).
837 # @buf-size: #optional maximum amount of data in flight from source to
838 #            target (since 1.4).
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).
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).
848 # Returns: nothing on success
849 #          If @device is not a valid block device, DeviceNotFound
851 # Since 1.3
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' } }
862 # @block_set_io_throttle:
864 # Change I/O throttle limits for a block drive.
866 # @device: The name of the device
868 # @bps: total throughput limit in bytes per second
870 # @bps_rd: read throughput limit in bytes per second
872 # @bps_wr: write throughput limit in bytes per second
874 # @iops: total I/O operations per second
876 # @ops_rd: read I/O operations per second
878 # @iops_wr: write I/O operations per second
880 # @bps_max: #optional total max in bytes (Since 1.7)
882 # @bps_rd_max: #optional read max in bytes (Since 1.7)
884 # @bps_wr_max: #optional write max in bytes (Since 1.7)
886 # @iops_max: #optional total I/O operations max (Since 1.7)
888 # @iops_rd_max: #optional read I/O operations max (Since 1.7)
890 # @iops_wr_max: #optional write I/O operations max (Since 1.7)
892 # @iops_size: #optional an I/O size in bytes (Since 1.7)
894 # Returns: Nothing on success
895 #          If @device is not a valid block device, DeviceNotFound
897 # Since: 1.1
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' } }
908 # @block-stream:
910 # Copy data from a backing file into a block device.
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.
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.
923 # On successful completion the image file is updated to drop the backing file
924 # and the BLOCK_JOB_COMPLETED event is emitted.
926 # @device: the device name
928 # @base:   #optional the common backing file name
930 # @backing-file: #optional The backing file string to write into the active
931 #                          layer. This filename is not validated.
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.
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)
945 # @speed:  #optional the maximum speed, in bytes per second
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.
951 # Returns: Nothing on success
952 #          If @device does not exist, DeviceNotFound
954 # Since: 1.1
956 { 'command': 'block-stream',
957   'data': { 'device': 'str', '*base': 'str', '*backing-file': 'str',
958             '*speed': 'int', '*on-error': 'BlockdevOnError' } }
961 # @block-job-set-speed:
963 # Set maximum speed for a background block operation.
965 # This command can only be issued when there is an active block job.
967 # Throttling can be disabled by setting the speed to 0.
969 # @device: the device name
971 # @speed:  the maximum speed, in bytes per second, or 0 for unlimited.
972 #          Defaults to 0.
974 # Returns: Nothing on success
975 #          If no background operation is active on this device, DeviceNotActive
977 # Since: 1.1
979 { 'command': 'block-job-set-speed',
980   'data': { 'device': 'str', 'speed': 'int' } }
983 # @block-job-cancel:
985 # Stop an active background block operation.
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.
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.
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.
1000 # @device: the device name
1002 # @force: #optional whether to allow cancellation of a paused job (default
1003 #         false).  Since 1.3.
1005 # Returns: Nothing on success
1006 #          If no background operation is active on this device, DeviceNotActive
1008 # Since: 1.1
1010 { 'command': 'block-job-cancel', 'data': { 'device': 'str', '*force': 'bool' } }
1013 # @block-job-pause:
1015 # Pause an active background block operation.
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.
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.
1026 # @device: the device name
1028 # Returns: Nothing on success
1029 #          If no background operation is active on this device, DeviceNotActive
1031 # Since: 1.3
1033 { 'command': 'block-job-pause', 'data': { 'device': 'str' } }
1036 # @block-job-resume:
1038 # Resume an active background block operation.
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.
1044 # This command also clears the error status of the job.
1046 # @device: the device name
1048 # Returns: Nothing on success
1049 #          If no background operation is active on this device, DeviceNotActive
1051 # Since: 1.3
1053 { 'command': 'block-job-resume', 'data': { 'device': 'str' } }
1056 # @block-job-complete:
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.
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.
1070 # A cancelled or paused job cannot be completed.
1072 # @device: the device name
1074 # Returns: Nothing on success
1075 #          If no background operation is active on this device, DeviceNotActive
1077 # Since: 1.3
1079 { 'command': 'block-job-complete', 'data': { 'device': 'str' } }
1082 # @BlockdevDiscardOptions
1084 # Determines how to handle discard requests.
1086 # @ignore:      Ignore the request
1087 # @unmap:       Forward as an unmap request
1089 # Since: 1.7
1091 { 'enum': 'BlockdevDiscardOptions',
1092   'data': [ 'ignore', 'unmap' ] }
1095 # @BlockdevDetectZeroesOptions
1097 # Describes the operation mode for the automatic conversion of plain
1098 # zero writes by the OS to driver specific optimized zero write commands.
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.
1105 # Since: 2.1
1107 { 'enum': 'BlockdevDetectZeroesOptions',
1108   'data': [ 'off', 'on', 'unmap' ] }
1111 # @BlockdevAioOptions
1113 # Selects the AIO backend to handle I/O requests
1115 # @threads:     Use qemu's thread pool
1116 # @native:      Use native AIO backend (only Linux and Windows)
1118 # Since: 1.7
1120 { 'enum': 'BlockdevAioOptions',
1121   'data': [ 'threads', 'native' ] }
1124 # @BlockdevCacheOptions
1126 # Includes cache-related options for block devices
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)
1134 # Since: 1.7
1136 { 'type': 'BlockdevCacheOptions',
1137   'data': { '*writeback': 'bool',
1138             '*direct': 'bool',
1139             '*no-flush': 'bool' } }
1142 # @BlockdevDriver
1144 # Drivers that are supported in block device operations.
1146 # @host_device, @host_cdrom, @host_floppy: Since 2.1
1148 # Since: 2.0
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' ] }
1158 # @BlockdevOptionsBase
1160 # Options that are available for all block devices, independent of the block
1161 # driver.
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)
1180 # Since: 1.7
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' } }
1195 # @BlockdevOptionsFile
1197 # Driver specific block device options for the file backend and similar
1198 # protocols.
1200 # @filename:    path to the image file
1202 # Since: 1.7
1204 { 'type': 'BlockdevOptionsFile',
1205   'data': { 'filename': 'str' } }
1208 # @BlockdevOptionsNull
1210 # Driver specific block device options for the null backend.
1212 # @size:    #optional size of the device in bytes.
1214 # Since: 2.2
1216 { 'type': 'BlockdevOptionsNull',
1217   'data': { '*size': 'int' } }
1220 # @BlockdevOptionsVVFAT
1222 # Driver specific block device options for the vvfat protocol.
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)
1230 # Since: 1.7
1232 { 'type': 'BlockdevOptionsVVFAT',
1233   'data': { 'dir': 'str', '*fat-type': 'int', '*floppy': 'bool',
1234             '*rw': 'bool' } }
1237 # @BlockdevOptionsGenericFormat
1239 # Driver specific block device options for image format that have no option
1240 # besides their data source.
1242 # @file:        reference to or definition of the data source block device
1244 # Since: 1.7
1246 { 'type': 'BlockdevOptionsGenericFormat',
1247   'data': { 'file': 'BlockdevRef' } }
1250 # @BlockdevOptionsGenericCOWFormat
1252 # Driver specific block device options for image format that have no option
1253 # besides their data source and an optional backing file.
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.
1260 # Since: 1.7
1262 { 'type': 'BlockdevOptionsGenericCOWFormat',
1263   'base': 'BlockdevOptionsGenericFormat',
1264   'data': { '*backing': 'BlockdevRef' } }
1267 # @Qcow2OverlapCheckMode
1269 # General overlap check modes.
1271 # @none:        Do not perform any checks
1273 # @constant:    Perform only checks which can be done in constant time and
1274 #               without reading anything from disk
1276 # @cached:      Perform only checks which can be done without reading anything
1277 #               from disk
1279 # @all:         Perform all available overlap checks
1281 # Since: 2.2
1283 { 'enum': 'Qcow2OverlapCheckMode',
1284   'data': [ 'none', 'constant', 'cached', 'all' ] }
1287 # @Qcow2OverlapCheckFlags
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.
1293 # @template: Specifies a template mode which can be adjusted using the other
1294 #            flags, defaults to 'cached'
1296 # Since: 2.2
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' } }
1310 # @Qcow2OverlapChecks
1312 # Specifies which metadata structures should be guarded against unintended
1313 # overwriting.
1315 # @flags:   set of flags for separate specification of each metadata structure
1316 #           type
1318 # @mode:    named mode which chooses a specific set of flags
1320 # Since: 2.2
1322 { 'union': 'Qcow2OverlapChecks',
1323   'discriminator': {},
1324   'data': { 'flags': 'Qcow2OverlapCheckFlags',
1325             'mode':  'Qcow2OverlapCheckMode' } }
1328 # @BlockdevOptionsQcow2
1330 # Driver specific block device options for qcow2.
1332 # @lazy-refcounts:        #optional whether to enable the lazy refcounts
1333 #                         feature (default is taken from the image file)
1335 # @pass-discard-request:  #optional whether discard requests to the qcow2
1336 #                         device should be forwarded to the data source
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
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
1346 # @overlap-check:         #optional which overlap checks to perform for writes
1347 #                         to the image, defaults to 'cached' (since 2.2)
1349 # @cache-size:            #optional the maximum total size of the L2 table and
1350 #                         refcount block caches in bytes (since 2.2)
1352 # @l2-cache-size:         #optional the maximum size of the L2 table cache in
1353 #                         bytes (since 2.2)
1355 # @refcount-cache-size:   #optional the maximum size of the refcount block cache
1356 #                         in bytes (since 2.2)
1358 # Since: 1.7
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' } }
1373 # @BlockdevOptionsArchipelago
1375 # Driver specific block device options for Archipelago.
1377 # @volume:              Name of the Archipelago volume image
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).
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).
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
1395 { 'type': 'BlockdevOptionsArchipelago',
1396   'data': { 'volume': 'str',
1397             '*mport': 'int',
1398             '*vport': 'int',
1399             '*segment': 'str' } }
1403 # @BlkdebugEvent
1405 # Trigger events supported by blkdebug.
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' ] }
1422 # @BlkdebugInjectErrorOptions
1424 # Describes a single error injection for blkdebug.
1426 # @event:       trigger event
1428 # @state:       #optional the state identifier blkdebug needs to be in to
1429 #               actually trigger the event; defaults to "any"
1431 # @errno:       #optional error identifier (errno) to be returned; defaults to
1432 #               EIO
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"
1438 # @once:        #optional disables further events after this one has been
1439 #               triggered; defaults to false
1441 # @immediately: #optional fail immediately; defaults to false
1443 # Since: 2.0
1445 { 'type': 'BlkdebugInjectErrorOptions',
1446   'data': { 'event': 'BlkdebugEvent',
1447             '*state': 'int',
1448             '*errno': 'int',
1449             '*sector': 'int',
1450             '*once': 'bool',
1451             '*immediately': 'bool' } }
1454 # @BlkdebugSetStateOptions
1456 # Describes a single state-change event for blkdebug.
1458 # @event:       trigger event
1460 # @state:       #optional the current state identifier blkdebug needs to be in;
1461 #               defaults to "any"
1463 # @new_state:   the state identifier blkdebug is supposed to assume if
1464 #               this event is triggered
1466 # Since: 2.0
1468 { 'type': 'BlkdebugSetStateOptions',
1469   'data': { 'event': 'BlkdebugEvent',
1470             '*state': 'int',
1471             'new_state': 'int' } }
1474 # @BlockdevOptionsBlkdebug
1476 # Driver specific block device options for blkdebug.
1478 # @image:           underlying raw block device (or image file)
1480 # @config:          #optional filename of the configuration file
1482 # @align:           #optional required alignment for requests in bytes
1484 # @inject-error:    #optional array of error injection descriptions
1486 # @set-state:       #optional array of state-change descriptions
1488 # Since: 2.0
1490 { 'type': 'BlockdevOptionsBlkdebug',
1491   'data': { 'image': 'BlockdevRef',
1492             '*config': 'str',
1493             '*align': 'int',
1494             '*inject-error': ['BlkdebugInjectErrorOptions'],
1495             '*set-state': ['BlkdebugSetStateOptions'] } }
1498 # @BlockdevOptionsBlkverify
1500 # Driver specific block device options for blkverify.
1502 # @test:    block device to be tested
1504 # @raw:     raw image used for verification
1506 # Since: 2.0
1508 { 'type': 'BlockdevOptionsBlkverify',
1509   'data': { 'test': 'BlockdevRef',
1510             'raw': 'BlockdevRef' } }
1513 # @QuorumReadPattern
1515 # An enumeration of quorum read patterns.
1517 # @quorum: read all the children and do a quorum vote on reads
1519 # @fifo: read only from the first child that has not failed
1521 # Since: 2.2
1523 { 'enum': 'QuorumReadPattern', 'data': [ 'quorum', 'fifo' ] }
1526 # @BlockdevOptionsQuorum
1528 # Driver specific block device options for Quorum
1530 # @blkverify:      #optional true if the driver must print content mismatch
1531 #                  set to false by default
1533 # @children:       the children block devices to use
1535 # @vote-threshold: the vote limit under which a read will fail
1537 # @rewrite-corrupted: #optional rewrite corrupted data when quorum is reached
1538 #                     (Since 2.1)
1540 # @read-pattern: #optional choose read pattern and set to quorum by default
1541 #                (Since 2.2)
1543 # Since: 2.0
1545 { 'type': 'BlockdevOptionsQuorum',
1546   'data': { '*blkverify': 'bool',
1547             'children': [ 'BlockdevRef' ],
1548             'vote-threshold': 'int',
1549             '*rewrite-corrupted': 'bool',
1550             '*read-pattern': 'QuorumReadPattern' } }
1553 # @BlockdevOptions
1555 # Options for creating a block device.
1557 # Since: 1.7
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   } }
1601 # @BlockdevRef
1603 # Reference to a block device.
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.
1610 # Since: 1.7
1612 { 'union': 'BlockdevRef',
1613   'discriminator': {},
1614   'data': { 'definition': 'BlockdevOptions',
1615             'reference': 'str' } }
1618 # @blockdev-add:
1620 # Creates a new block device.
1622 # @options: block device options for the new device
1624 # Since: 1.7
1626 { 'command': 'blockdev-add', 'data': { 'options': 'BlockdevOptions' } }
1630 # @BlockErrorAction
1632 # An enumeration of action that has been taken when a DISK I/O occurs
1634 # @ignore: error has been ignored
1636 # @report: error has been reported to the device
1638 # @stop: error caused VM to be stopped
1640 # Since: 2.1
1642 { 'enum': 'BlockErrorAction',
1643   'data': [ 'ignore', 'report', 'stop' ] }
1647 # @BLOCK_IMAGE_CORRUPTED
1649 # Emitted when a corruption has been detected in a disk image
1651 # @device: device name
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
1657 # @offset: #optional, if the corruption resulted from an image access, this is
1658 #          the access offset into the image
1660 # @size: #optional, if the corruption resulted from an image access, this is
1661 #        the access size
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)
1667 # Since: 1.7
1669 { 'event': 'BLOCK_IMAGE_CORRUPTED',
1670   'data': { 'device' : 'str',
1671             'msg'    : 'str',
1672             '*offset': 'int',
1673             '*size'  : 'int',
1674             'fatal'  : 'bool' } }
1677 # @BLOCK_IO_ERROR
1679 # Emitted when a disk I/O error occurs
1681 # @device: device name
1683 # @operation: I/O operation
1685 # @action: action that has been taken
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)
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)
1696 # Note: If action is "stop", a STOP event will eventually follow the
1697 # BLOCK_IO_ERROR event
1699 # Since: 0.13.0
1701 { 'event': 'BLOCK_IO_ERROR',
1702   'data': { 'device': 'str', 'operation': 'IoOperationType',
1703             'action': 'BlockErrorAction', '*nospace': 'bool',
1704             'reason': 'str' } }
1707 # @BLOCK_JOB_COMPLETED
1709 # Emitted when a block job has completed
1711 # @type: job type
1713 # @device: device name
1715 # @len: maximum progress value
1717 # @offset: current progress value. On success this is equal to len.
1718 #          On failure this is less than len
1720 # @speed: rate limit, bytes per second
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
1727 # Since: 1.1
1729 { 'event': 'BLOCK_JOB_COMPLETED',
1730   'data': { 'type'  : 'BlockJobType',
1731             'device': 'str',
1732             'len'   : 'int',
1733             'offset': 'int',
1734             'speed' : 'int',
1735             '*error': 'str' } }
1738 # @BLOCK_JOB_CANCELLED
1740 # Emitted when a block job has been cancelled
1742 # @type: job type
1744 # @device: device name
1746 # @len: maximum progress value
1748 # @offset: current progress value. On success this is equal to len.
1749 #          On failure this is less than len
1751 # @speed: rate limit, bytes per second
1753 # Since: 1.1
1755 { 'event': 'BLOCK_JOB_CANCELLED',
1756   'data': { 'type'  : 'BlockJobType',
1757             'device': 'str',
1758             'len'   : 'int',
1759             'offset': 'int',
1760             'speed' : 'int' } }
1763 # @BLOCK_JOB_ERROR
1765 # Emitted when a block job encounters an error
1767 # @device: device name
1769 # @operation: I/O operation
1771 # @action: action that has been taken
1773 # Since: 1.3
1775 { 'event': 'BLOCK_JOB_ERROR',
1776   'data': { 'device'   : 'str',
1777             'operation': 'IoOperationType',
1778             'action'   : 'BlockErrorAction' } }
1781 # @BLOCK_JOB_READY
1783 # Emitted when a block job is ready to complete
1785 # @type: job type
1787 # @device: device name
1789 # @len: maximum progress value
1791 # @offset: current progress value. On success this is equal to len.
1792 #          On failure this is less than len
1794 # @speed: rate limit, bytes per second
1796 # Note: The "ready to complete" status is always reset by a @BLOCK_JOB_ERROR
1797 # event
1799 # Since: 1.3
1801 { 'event': 'BLOCK_JOB_READY',
1802   'data': { 'type'  : 'BlockJobType',
1803             'device': 'str',
1804             'len'   : 'int',
1805             'offset': 'int',
1806             'speed' : 'int' } }
1808 # @PreallocMode
1810 # Preallocation mode of QEMU image file
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.
1820 # Since 2.2
1822 { 'enum': 'PreallocMode',
1823   'data': [ 'off', 'metadata', 'falloc', 'full' ] }