kvm_stat: Add kvm_exit reasons for aarch64
[qemu/ar7.git] / qapi / block-core.json
blob80984d1660af56d46b41d53c6b01c35116945cb6
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 # Since: 1.3
126 { 'type': 'ImageInfo',
127   'data': {'filename': 'str', 'format': 'str', '*dirty-flag': 'bool',
128            '*actual-size': 'int', 'virtual-size': 'int',
129            '*cluster-size': 'int', '*encrypted': 'bool', '*compressed': 'bool',
130            '*backing-filename': 'str', '*full-backing-filename': 'str',
131            '*backing-filename-format': 'str', '*snapshots': ['SnapshotInfo'],
132            '*backing-image': 'ImageInfo',
133            '*format-specific': 'ImageInfoSpecific' } }
136 # @ImageCheck:
138 # Information about a QEMU image file check
140 # @filename: name of the image file checked
142 # @format: format of the image file checked
144 # @check-errors: number of unexpected errors occurred during check
146 # @image-end-offset: #optional offset (in bytes) where the image ends, this
147 #                    field is present if the driver for the image format
148 #                    supports it
150 # @corruptions: #optional number of corruptions found during the check if any
152 # @leaks: #optional number of leaks found during the check if any
154 # @corruptions-fixed: #optional number of corruptions fixed during the check
155 #                     if any
157 # @leaks-fixed: #optional number of leaks fixed during the check if any
159 # @total-clusters: #optional total number of clusters, this field is present
160 #                  if the driver for the image format supports it
162 # @allocated-clusters: #optional total number of allocated clusters, this
163 #                      field is present if the driver for the image format
164 #                      supports it
166 # @fragmented-clusters: #optional total number of fragmented clusters, this
167 #                       field is present if the driver for the image format
168 #                       supports it
170 # @compressed-clusters: #optional total number of compressed clusters, this
171 #                       field is present if the driver for the image format
172 #                       supports it
174 # Since: 1.4
178 { 'type': 'ImageCheck',
179   'data': {'filename': 'str', 'format': 'str', 'check-errors': 'int',
180            '*image-end-offset': 'int', '*corruptions': 'int', '*leaks': 'int',
181            '*corruptions-fixed': 'int', '*leaks-fixed': 'int',
182            '*total-clusters': 'int', '*allocated-clusters': 'int',
183            '*fragmented-clusters': 'int', '*compressed-clusters': 'int' } }
186 # @BlockdevCacheInfo
188 # Cache mode information for a block device
190 # @writeback:   true if writeback mode is enabled
191 # @direct:      true if the host page cache is bypassed (O_DIRECT)
192 # @no-flush:    true if flush requests are ignored for the device
194 # Since: 2.3
196 { 'type': 'BlockdevCacheInfo',
197   'data': { 'writeback': 'bool',
198             'direct': 'bool',
199             'no-flush': 'bool' } }
202 # @BlockDeviceInfo:
204 # Information about the backing device for a block device.
206 # @file: the filename of the backing device
208 # @node-name: #optional the name of the block driver node (Since 2.0)
210 # @ro: true if the backing device was open read-only
212 # @drv: the name of the block format used to open the backing device. As of
213 #       0.14.0 this can be: 'blkdebug', 'bochs', 'cloop', 'cow', 'dmg',
214 #       'file', 'file', 'ftp', 'ftps', 'host_cdrom', 'host_device',
215 #       'host_floppy', 'http', 'https', 'nbd', 'parallels', 'qcow',
216 #       'qcow2', 'raw', 'tftp', 'vdi', 'vmdk', 'vpc', 'vvfat'
217 #       2.2: 'archipelago' added, 'cow' dropped
219 # @backing_file: #optional the name of the backing file (for copy-on-write)
221 # @backing_file_depth: number of files in the backing file chain (since: 1.2)
223 # @encrypted: true if the backing device is encrypted
225 # @encryption_key_missing: true if the backing device is encrypted but an
226 #                          valid encryption key is missing
228 # @detect_zeroes: detect and optimize zero writes (Since 2.1)
230 # @bps: total throughput limit in bytes per second is specified
232 # @bps_rd: read throughput limit in bytes per second is specified
234 # @bps_wr: write throughput limit in bytes per second is specified
236 # @iops: total I/O operations per second is specified
238 # @iops_rd: read I/O operations per second is specified
240 # @iops_wr: write I/O operations per second is specified
242 # @image: the info of image used (since: 1.6)
244 # @bps_max: #optional total max in bytes (Since 1.7)
246 # @bps_rd_max: #optional read max in bytes (Since 1.7)
248 # @bps_wr_max: #optional write max in bytes (Since 1.7)
250 # @iops_max: #optional total I/O operations max (Since 1.7)
252 # @iops_rd_max: #optional read I/O operations max (Since 1.7)
254 # @iops_wr_max: #optional write I/O operations max (Since 1.7)
256 # @iops_size: #optional an I/O size in bytes (Since 1.7)
258 # @cache: the cache mode used for the block device (since: 2.3)
260 # Since: 0.14.0
263 { 'type': 'BlockDeviceInfo',
264   'data': { 'file': 'str', '*node-name': 'str', 'ro': 'bool', 'drv': 'str',
265             '*backing_file': 'str', 'backing_file_depth': 'int',
266             'encrypted': 'bool', 'encryption_key_missing': 'bool',
267             'detect_zeroes': 'BlockdevDetectZeroesOptions',
268             'bps': 'int', 'bps_rd': 'int', 'bps_wr': 'int',
269             'iops': 'int', 'iops_rd': 'int', 'iops_wr': 'int',
270             'image': 'ImageInfo',
271             '*bps_max': 'int', '*bps_rd_max': 'int',
272             '*bps_wr_max': 'int', '*iops_max': 'int',
273             '*iops_rd_max': 'int', '*iops_wr_max': 'int',
274             '*iops_size': 'int', 'cache': 'BlockdevCacheInfo' } }
277 # @BlockDeviceIoStatus:
279 # An enumeration of block device I/O status.
281 # @ok: The last I/O operation has succeeded
283 # @failed: The last I/O operation has failed
285 # @nospace: The last I/O operation has failed due to a no-space condition
287 # Since: 1.0
289 { 'enum': 'BlockDeviceIoStatus', 'data': [ 'ok', 'failed', 'nospace' ] }
292 # @BlockDeviceMapEntry:
294 # Entry in the metadata map of the device (returned by "qemu-img map")
296 # @start: Offset in the image of the first byte described by this entry
297 #         (in bytes)
299 # @length: Length of the range described by this entry (in bytes)
301 # @depth: Number of layers (0 = top image, 1 = top image's backing file, etc.)
302 #         before reaching one for which the range is allocated.  The value is
303 #         in the range 0 to the depth of the image chain - 1.
305 # @zero: the sectors in this range read as zeros
307 # @data: reading the image will actually read data from a file (in particular,
308 #        if @offset is present this means that the sectors are not simply
309 #        preallocated, but contain actual data in raw format)
311 # @offset: if present, the image file stores the data for this range in
312 #          raw format at the given offset.
314 # Since 1.7
316 { 'type': 'BlockDeviceMapEntry',
317   'data': { 'start': 'int', 'length': 'int', 'depth': 'int', 'zero': 'bool',
318             'data': 'bool', '*offset': 'int' } }
321 # @BlockDirtyInfo:
323 # Block dirty bitmap information.
325 # @count: number of dirty bytes according to the dirty bitmap
327 # @granularity: granularity of the dirty bitmap in bytes (since 1.4)
329 # Since: 1.3
331 { 'type': 'BlockDirtyInfo',
332   'data': {'count': 'int', 'granularity': 'int'} }
335 # @BlockInfo:
337 # Block device information.  This structure describes a virtual device and
338 # the backing device associated with it.
340 # @device: The device name associated with the virtual device.
342 # @type: This field is returned only for compatibility reasons, it should
343 #        not be used (always returns 'unknown')
345 # @removable: True if the device supports removable media.
347 # @locked: True if the guest has locked this device from having its media
348 #          removed
350 # @tray_open: #optional True if the device has a tray and it is open
351 #             (only present if removable is true)
353 # @dirty-bitmaps: #optional dirty bitmaps information (only present if the
354 #                 driver has one or more dirty bitmaps) (Since 2.0)
356 # @io-status: #optional @BlockDeviceIoStatus. Only present if the device
357 #             supports it and the VM is configured to stop on errors
358 #             (supported device models: virtio-blk, ide, scsi-disk)
360 # @inserted: #optional @BlockDeviceInfo describing the device if media is
361 #            present
363 # Since:  0.14.0
365 { 'type': 'BlockInfo',
366   'data': {'device': 'str', 'type': 'str', 'removable': 'bool',
367            'locked': 'bool', '*inserted': 'BlockDeviceInfo',
368            '*tray_open': 'bool', '*io-status': 'BlockDeviceIoStatus',
369            '*dirty-bitmaps': ['BlockDirtyInfo'] } }
372 # @query-block:
374 # Get a list of BlockInfo for all virtual block devices.
376 # Returns: a list of @BlockInfo describing each virtual block device
378 # Since: 0.14.0
380 { 'command': 'query-block', 'returns': ['BlockInfo'] }
383 # @BlockDeviceStats:
385 # Statistics of a virtual block device or a block backing device.
387 # @rd_bytes:      The number of bytes read by the device.
389 # @wr_bytes:      The number of bytes written by the device.
391 # @rd_operations: The number of read operations performed by the device.
393 # @wr_operations: The number of write operations performed by the device.
395 # @flush_operations: The number of cache flush operations performed by the
396 #                    device (since 0.15.0)
398 # @flush_total_time_ns: Total time spend on cache flushes in nano-seconds
399 #                       (since 0.15.0).
401 # @wr_total_time_ns: Total time spend on writes in nano-seconds (since 0.15.0).
403 # @rd_total_time_ns: Total_time_spend on reads in nano-seconds (since 0.15.0).
405 # @wr_highest_offset: The offset after the greatest byte written to the
406 #                     device.  The intended use of this information is for
407 #                     growable sparse files (like qcow2) that are used on top
408 #                     of a physical device.
410 # Since: 0.14.0
412 { 'type': 'BlockDeviceStats',
413   'data': {'rd_bytes': 'int', 'wr_bytes': 'int', 'rd_operations': 'int',
414            'wr_operations': 'int', 'flush_operations': 'int',
415            'flush_total_time_ns': 'int', 'wr_total_time_ns': 'int',
416            'rd_total_time_ns': 'int', 'wr_highest_offset': 'int' } }
419 # @BlockStats:
421 # Statistics of a virtual block device or a block backing device.
423 # @device: #optional If the stats are for a virtual block device, the name
424 #          corresponding to the virtual block device.
426 # @node-name: #optional The node name of the device. (Since 2.3)
428 # @stats:  A @BlockDeviceStats for the device.
430 # @parent: #optional This describes the file block device if it has one.
432 # @backing: #optional This describes the backing block device if it has one.
433 #           (Since 2.0)
435 # Since: 0.14.0
437 { 'type': 'BlockStats',
438   'data': {'*device': 'str', '*node-name': 'str',
439            'stats': 'BlockDeviceStats',
440            '*parent': 'BlockStats',
441            '*backing': 'BlockStats'} }
444 # @query-blockstats:
446 # Query the @BlockStats for all virtual block devices.
448 # @query-nodes: #optional If true, the command will query all the block nodes
449 #               that have a node name, in a list which will include "parent"
450 #               information, but not "backing".
451 #               If false or omitted, the behavior is as before - query all the
452 #               device backends, recursively including their "parent" and
453 #               "backing". (Since 2.3)
455 # Returns: A list of @BlockStats for each virtual block devices.
457 # Since: 0.14.0
459 { 'command': 'query-blockstats',
460   'data': { '*query-nodes': 'bool' },
461   'returns': ['BlockStats'] }
464 # @BlockdevOnError:
466 # An enumeration of possible behaviors for errors on I/O operations.
467 # The exact meaning depends on whether the I/O was initiated by a guest
468 # or by a block job
470 # @report: for guest operations, report the error to the guest;
471 #          for jobs, cancel the job
473 # @ignore: ignore the error, only report a QMP event (BLOCK_IO_ERROR
474 #          or BLOCK_JOB_ERROR)
476 # @enospc: same as @stop on ENOSPC, same as @report otherwise.
478 # @stop: for guest operations, stop the virtual machine;
479 #        for jobs, pause the job
481 # Since: 1.3
483 { 'enum': 'BlockdevOnError',
484   'data': ['report', 'ignore', 'enospc', 'stop'] }
487 # @MirrorSyncMode:
489 # An enumeration of possible behaviors for the initial synchronization
490 # phase of storage mirroring.
492 # @top: copies data in the topmost image to the destination
494 # @full: copies data from all images to the destination
496 # @none: only copy data written from now on
498 # Since: 1.3
500 { 'enum': 'MirrorSyncMode',
501   'data': ['top', 'full', 'none'] }
504 # @BlockJobType:
506 # Type of a block job.
508 # @commit: block commit job type, see "block-commit"
510 # @stream: block stream job type, see "block-stream"
512 # @mirror: drive mirror job type, see "drive-mirror"
514 # @backup: drive backup job type, see "drive-backup"
516 # Since: 1.7
518 { 'enum': 'BlockJobType',
519   'data': ['commit', 'stream', 'mirror', 'backup'] }
522 # @BlockJobInfo:
524 # Information about a long-running block device operation.
526 # @type: the job type ('stream' for image streaming)
528 # @device: the block device name
530 # @len: the maximum progress value
532 # @busy: false if the job is known to be in a quiescent state, with
533 #        no pending I/O.  Since 1.3.
535 # @paused: whether the job is paused or, if @busy is true, will
536 #          pause itself as soon as possible.  Since 1.3.
538 # @offset: the current progress value
540 # @speed: the rate limit, bytes per second
542 # @io-status: the status of the job (since 1.3)
544 # @ready: true if the job may be completed (since 2.2)
546 # Since: 1.1
548 { 'type': 'BlockJobInfo',
549   'data': {'type': 'str', 'device': 'str', 'len': 'int',
550            'offset': 'int', 'busy': 'bool', 'paused': 'bool', 'speed': 'int',
551            'io-status': 'BlockDeviceIoStatus', 'ready': 'bool'} }
554 # @query-block-jobs:
556 # Return information about long-running block device operations.
558 # Returns: a list of @BlockJobInfo for each active block job
560 # Since: 1.1
562 { 'command': 'query-block-jobs', 'returns': ['BlockJobInfo'] }
565 # @block_passwd:
567 # This command sets the password of a block device that has not been open
568 # with a password and requires one.
570 # The two cases where this can happen are a block device is created through
571 # QEMU's initial command line or a block device is changed through the legacy
572 # @change interface.
574 # In the event that the block device is created through the initial command
575 # line, the VM will start in the stopped state regardless of whether '-S' is
576 # used.  The intention is for a management tool to query the block devices to
577 # determine which ones are encrypted, set the passwords with this command, and
578 # then start the guest with the @cont command.
580 # Either @device or @node-name must be set but not both.
582 # @device: #optional the name of the block backend device to set the password on
584 # @node-name: #optional graph node name to set the password on (Since 2.0)
586 # @password: the password to use for the device
588 # Returns: nothing on success
589 #          If @device is not a valid block device, DeviceNotFound
590 #          If @device is not encrypted, DeviceNotEncrypted
592 # Notes:  Not all block formats support encryption and some that do are not
593 #         able to validate that a password is correct.  Disk corruption may
594 #         occur if an invalid password is specified.
596 # Since: 0.14.0
598 { 'command': 'block_passwd', 'data': {'*device': 'str',
599                                       '*node-name': 'str', 'password': 'str'} }
602 # @block_resize
604 # Resize a block image while a guest is running.
606 # Either @device or @node-name must be set but not both.
608 # @device: #optional the name of the device to get the image resized
610 # @node-name: #optional graph node name to get the image resized (Since 2.0)
612 # @size:  new image size in bytes
614 # Returns: nothing on success
615 #          If @device is not a valid block device, DeviceNotFound
617 # Since: 0.14.0
619 { 'command': 'block_resize', 'data': { '*device': 'str',
620                                        '*node-name': 'str',
621                                        'size': 'int' }}
624 # @NewImageMode
626 # An enumeration that tells QEMU how to set the backing file path in
627 # a new image file.
629 # @existing: QEMU should look for an existing image file.
631 # @absolute-paths: QEMU should create a new image with absolute paths
632 # for the backing file. If there is no backing file available, the new
633 # image will not be backed either.
635 # Since: 1.1
637 { 'enum': 'NewImageMode',
638   'data': [ 'existing', 'absolute-paths' ] }
641 # @BlockdevSnapshot
643 # Either @device or @node-name must be set but not both.
645 # @device: #optional the name of the device to generate the snapshot from.
647 # @node-name: #optional graph node name to generate the snapshot from (Since 2.0)
649 # @snapshot-file: the target of the new image. A new file will be created.
651 # @snapshot-node-name: #optional the graph node name of the new image (Since 2.0)
653 # @format: #optional the format of the snapshot image, default is 'qcow2'.
655 # @mode: #optional whether and how QEMU should create a new image, default is
656 #        'absolute-paths'.
658 { 'type': 'BlockdevSnapshot',
659   'data': { '*device': 'str', '*node-name': 'str',
660             'snapshot-file': 'str', '*snapshot-node-name': 'str',
661             '*format': 'str', '*mode': 'NewImageMode' } }
664 # @DriveBackup
666 # @device: the name of the device which should be copied.
668 # @target: the target of the new image. If the file exists, or if it
669 #          is a device, the existing file/device will be used as the new
670 #          destination.  If it does not exist, a new file will be created.
672 # @format: #optional the format of the new destination, default is to
673 #          probe if @mode is 'existing', else the format of the source
675 # @sync: what parts of the disk image should be copied to the destination
676 #        (all the disk, only the sectors allocated in the topmost image, or
677 #        only new I/O).
679 # @mode: #optional whether and how QEMU should create a new image, default is
680 #        'absolute-paths'.
682 # @speed: #optional the maximum speed, in bytes per second
684 # @on-source-error: #optional the action to take on an error on the source,
685 #                   default 'report'.  'stop' and 'enospc' can only be used
686 #                   if the block device supports io-status (see BlockInfo).
688 # @on-target-error: #optional the action to take on an error on the target,
689 #                   default 'report' (no limitations, since this applies to
690 #                   a different block device than @device).
692 # Note that @on-source-error and @on-target-error only affect background I/O.
693 # If an error occurs during a guest write request, the device's rerror/werror
694 # actions will be used.
696 # Since: 1.6
698 { 'type': 'DriveBackup',
699   'data': { 'device': 'str', 'target': 'str', '*format': 'str',
700             'sync': 'MirrorSyncMode', '*mode': 'NewImageMode',
701             '*speed': 'int',
702             '*on-source-error': 'BlockdevOnError',
703             '*on-target-error': 'BlockdevOnError' } }
706 # @BlockdevBackup
708 # @device: the name of the device which should be copied.
710 # @target: the name of the backup target device.
712 # @sync: what parts of the disk image should be copied to the destination
713 #        (all the disk, only the sectors allocated in the topmost image, or
714 #        only new I/O).
716 # @speed: #optional the maximum speed, in bytes per second. The default is 0,
717 #         for unlimited.
719 # @on-source-error: #optional the action to take on an error on the source,
720 #                   default 'report'.  'stop' and 'enospc' can only be used
721 #                   if the block device supports io-status (see BlockInfo).
723 # @on-target-error: #optional the action to take on an error on the target,
724 #                   default 'report' (no limitations, since this applies to
725 #                   a different block device than @device).
727 # Note that @on-source-error and @on-target-error only affect background I/O.
728 # If an error occurs during a guest write request, the device's rerror/werror
729 # actions will be used.
731 # Since: 2.3
733 { 'type': 'BlockdevBackup',
734   'data': { 'device': 'str', 'target': 'str',
735             'sync': 'MirrorSyncMode',
736             '*speed': 'int',
737             '*on-source-error': 'BlockdevOnError',
738             '*on-target-error': 'BlockdevOnError' } }
741 # @blockdev-snapshot-sync
743 # Generates a synchronous snapshot of a block device.
745 # For the arguments, see the documentation of BlockdevSnapshot.
747 # Returns: nothing on success
748 #          If @device is not a valid block device, DeviceNotFound
750 # Since 0.14.0
752 { 'command': 'blockdev-snapshot-sync',
753   'data': 'BlockdevSnapshot' }
756 # @change-backing-file
758 # Change the backing file in the image file metadata.  This does not
759 # cause QEMU to reopen the image file to reparse the backing filename
760 # (it may, however, perform a reopen to change permissions from
761 # r/o -> r/w -> r/o, if needed). The new backing file string is written
762 # into the image file metadata, and the QEMU internal strings are
763 # updated.
765 # @image-node-name: The name of the block driver state node of the
766 #                   image to modify.
768 # @device:          The name of the device that owns image-node-name.
770 # @backing-file:    The string to write as the backing file.  This
771 #                   string is not validated, so care should be taken
772 #                   when specifying the string or the image chain may
773 #                   not be able to be reopened again.
775 # Since: 2.1
777 { 'command': 'change-backing-file',
778   'data': { 'device': 'str', 'image-node-name': 'str',
779             'backing-file': 'str' } }
782 # @block-commit
784 # Live commit of data from overlay image nodes into backing nodes - i.e.,
785 # writes data between 'top' and 'base' into 'base'.
787 # @device:  the name of the device
789 # @base:   #optional The file name of the backing image to write data into.
790 #                    If not specified, this is the deepest backing image
792 # @top:    #optional The file name of the backing image within the image chain,
793 #                    which contains the topmost data to be committed down. If
794 #                    not specified, this is the active layer.
796 # @backing-file:  #optional The backing file string to write into the overlay
797 #                           image of 'top'.  If 'top' is the active layer,
798 #                           specifying a backing file string is an error. This
799 #                           filename is not validated.
801 #                           If a pathname string is such that it cannot be
802 #                           resolved by QEMU, that means that subsequent QMP or
803 #                           HMP commands must use node-names for the image in
804 #                           question, as filename lookup methods will fail.
806 #                           If not specified, QEMU will automatically determine
807 #                           the backing file string to use, or error out if
808 #                           there is no obvious choice. Care should be taken
809 #                           when specifying the string, to specify a valid
810 #                           filename or protocol.
811 #                           (Since 2.1)
813 #                    If top == base, that is an error.
814 #                    If top == active, the job will not be completed by itself,
815 #                    user needs to complete the job with the block-job-complete
816 #                    command after getting the ready event. (Since 2.0)
818 #                    If the base image is smaller than top, then the base image
819 #                    will be resized to be the same size as top.  If top is
820 #                    smaller than the base image, the base will not be
821 #                    truncated.  If you want the base image size to match the
822 #                    size of the smaller top, you can safely truncate it
823 #                    yourself once the commit operation successfully completes.
825 # @speed:  #optional the maximum speed, in bytes per second
827 # Returns: Nothing on success
828 #          If commit or stream is already active on this device, DeviceInUse
829 #          If @device does not exist, DeviceNotFound
830 #          If image commit is not supported by this device, NotSupported
831 #          If @base or @top is invalid, a generic error is returned
832 #          If @speed is invalid, InvalidParameter
834 # Since: 1.3
837 { 'command': 'block-commit',
838   'data': { 'device': 'str', '*base': 'str', '*top': 'str',
839             '*backing-file': 'str', '*speed': 'int' } }
842 # @drive-backup
844 # Start a point-in-time copy of a block device to a new destination.  The
845 # status of ongoing drive-backup operations can be checked with
846 # query-block-jobs where the BlockJobInfo.type field has the value 'backup'.
847 # The operation can be stopped before it has completed using the
848 # block-job-cancel command.
850 # For the arguments, see the documentation of DriveBackup.
852 # Returns: nothing on success
853 #          If @device is not a valid block device, DeviceNotFound
855 # Since 1.6
857 { 'command': 'drive-backup', 'data': 'DriveBackup' }
860 # @blockdev-backup
862 # Start a point-in-time copy of a block device to a new destination.  The
863 # status of ongoing blockdev-backup operations can be checked with
864 # query-block-jobs where the BlockJobInfo.type field has the value 'backup'.
865 # The operation can be stopped before it has completed using the
866 # block-job-cancel command.
868 # For the arguments, see the documentation of BlockdevBackup.
870 # Returns: Nothing on success.
871 #          If @device or @target is not a valid block device, DeviceNotFound.
873 # Since 2.3
875 { 'command': 'blockdev-backup', 'data': 'BlockdevBackup' }
879 # @query-named-block-nodes
881 # Get the named block driver list
883 # Returns: the list of BlockDeviceInfo
885 # Since 2.0
887 { 'command': 'query-named-block-nodes', 'returns': [ 'BlockDeviceInfo' ] }
890 # @drive-mirror
892 # Start mirroring a block device's writes to a new destination.
894 # @device:  the name of the device whose writes should be mirrored.
896 # @target: the target of the new image. If the file exists, or if it
897 #          is a device, the existing file/device will be used as the new
898 #          destination.  If it does not exist, a new file will be created.
900 # @format: #optional the format of the new destination, default is to
901 #          probe if @mode is 'existing', else the format of the source
903 # @node-name: #optional the new block driver state node name in the graph
904 #             (Since 2.1)
906 # @replaces: #optional with sync=full graph node name to be replaced by the new
907 #            image when a whole image copy is done. This can be used to repair
908 #            broken Quorum files. (Since 2.1)
910 # @mode: #optional whether and how QEMU should create a new image, default is
911 #        'absolute-paths'.
913 # @speed:  #optional the maximum speed, in bytes per second
915 # @sync: what parts of the disk image should be copied to the destination
916 #        (all the disk, only the sectors allocated in the topmost image, or
917 #        only new I/O).
919 # @granularity: #optional granularity of the dirty bitmap, default is 64K
920 #               if the image format doesn't have clusters, 4K if the clusters
921 #               are smaller than that, else the cluster size.  Must be a
922 #               power of 2 between 512 and 64M (since 1.4).
924 # @buf-size: #optional maximum amount of data in flight from source to
925 #            target (since 1.4).
927 # @on-source-error: #optional the action to take on an error on the source,
928 #                   default 'report'.  'stop' and 'enospc' can only be used
929 #                   if the block device supports io-status (see BlockInfo).
931 # @on-target-error: #optional the action to take on an error on the target,
932 #                   default 'report' (no limitations, since this applies to
933 #                   a different block device than @device).
935 # Returns: nothing on success
936 #          If @device is not a valid block device, DeviceNotFound
938 # Since 1.3
940 { 'command': 'drive-mirror',
941   'data': { 'device': 'str', 'target': 'str', '*format': 'str',
942             '*node-name': 'str', '*replaces': 'str',
943             'sync': 'MirrorSyncMode', '*mode': 'NewImageMode',
944             '*speed': 'int', '*granularity': 'uint32',
945             '*buf-size': 'int', '*on-source-error': 'BlockdevOnError',
946             '*on-target-error': 'BlockdevOnError' } }
949 # @block_set_io_throttle:
951 # Change I/O throttle limits for a block drive.
953 # @device: The name of the device
955 # @bps: total throughput limit in bytes per second
957 # @bps_rd: read throughput limit in bytes per second
959 # @bps_wr: write throughput limit in bytes per second
961 # @iops: total I/O operations per second
963 # @ops_rd: read I/O operations per second
965 # @iops_wr: write I/O operations per second
967 # @bps_max: #optional total max in bytes (Since 1.7)
969 # @bps_rd_max: #optional read max in bytes (Since 1.7)
971 # @bps_wr_max: #optional write max in bytes (Since 1.7)
973 # @iops_max: #optional total I/O operations max (Since 1.7)
975 # @iops_rd_max: #optional read I/O operations max (Since 1.7)
977 # @iops_wr_max: #optional write I/O operations max (Since 1.7)
979 # @iops_size: #optional an I/O size in bytes (Since 1.7)
981 # Returns: Nothing on success
982 #          If @device is not a valid block device, DeviceNotFound
984 # Since: 1.1
986 { 'command': 'block_set_io_throttle',
987   'data': { 'device': 'str', 'bps': 'int', 'bps_rd': 'int', 'bps_wr': 'int',
988             'iops': 'int', 'iops_rd': 'int', 'iops_wr': 'int',
989             '*bps_max': 'int', '*bps_rd_max': 'int',
990             '*bps_wr_max': 'int', '*iops_max': 'int',
991             '*iops_rd_max': 'int', '*iops_wr_max': 'int',
992             '*iops_size': 'int' } }
995 # @block-stream:
997 # Copy data from a backing file into a block device.
999 # The block streaming operation is performed in the background until the entire
1000 # backing file has been copied.  This command returns immediately once streaming
1001 # has started.  The status of ongoing block streaming operations can be checked
1002 # with query-block-jobs.  The operation can be stopped before it has completed
1003 # using the block-job-cancel command.
1005 # If a base file is specified then sectors are not copied from that base file and
1006 # its backing chain.  When streaming completes the image file will have the base
1007 # file as its backing file.  This can be used to stream a subset of the backing
1008 # file chain instead of flattening the entire image.
1010 # On successful completion the image file is updated to drop the backing file
1011 # and the BLOCK_JOB_COMPLETED event is emitted.
1013 # @device: the device name
1015 # @base:   #optional the common backing file name
1017 # @backing-file: #optional The backing file string to write into the active
1018 #                          layer. This filename is not validated.
1020 #                          If a pathname string is such that it cannot be
1021 #                          resolved by QEMU, that means that subsequent QMP or
1022 #                          HMP commands must use node-names for the image in
1023 #                          question, as filename lookup methods will fail.
1025 #                          If not specified, QEMU will automatically determine
1026 #                          the backing file string to use, or error out if there
1027 #                          is no obvious choice.  Care should be taken when
1028 #                          specifying the string, to specify a valid filename or
1029 #                          protocol.
1030 #                          (Since 2.1)
1032 # @speed:  #optional the maximum speed, in bytes per second
1034 # @on-error: #optional the action to take on an error (default report).
1035 #            'stop' and 'enospc' can only be used if the block device
1036 #            supports io-status (see BlockInfo).  Since 1.3.
1038 # Returns: Nothing on success
1039 #          If @device does not exist, DeviceNotFound
1041 # Since: 1.1
1043 { 'command': 'block-stream',
1044   'data': { 'device': 'str', '*base': 'str', '*backing-file': 'str',
1045             '*speed': 'int', '*on-error': 'BlockdevOnError' } }
1048 # @block-job-set-speed:
1050 # Set maximum speed for a background block operation.
1052 # This command can only be issued when there is an active block job.
1054 # Throttling can be disabled by setting the speed to 0.
1056 # @device: the device name
1058 # @speed:  the maximum speed, in bytes per second, or 0 for unlimited.
1059 #          Defaults to 0.
1061 # Returns: Nothing on success
1062 #          If no background operation is active on this device, DeviceNotActive
1064 # Since: 1.1
1066 { 'command': 'block-job-set-speed',
1067   'data': { 'device': 'str', 'speed': 'int' } }
1070 # @block-job-cancel:
1072 # Stop an active background block operation.
1074 # This command returns immediately after marking the active background block
1075 # operation for cancellation.  It is an error to call this command if no
1076 # operation is in progress.
1078 # The operation will cancel as soon as possible and then emit the
1079 # BLOCK_JOB_CANCELLED event.  Before that happens the job is still visible when
1080 # enumerated using query-block-jobs.
1082 # For streaming, the image file retains its backing file unless the streaming
1083 # operation happens to complete just as it is being cancelled.  A new streaming
1084 # operation can be started at a later time to finish copying all data from the
1085 # backing file.
1087 # @device: the device name
1089 # @force: #optional whether to allow cancellation of a paused job (default
1090 #         false).  Since 1.3.
1092 # Returns: Nothing on success
1093 #          If no background operation is active on this device, DeviceNotActive
1095 # Since: 1.1
1097 { 'command': 'block-job-cancel', 'data': { 'device': 'str', '*force': 'bool' } }
1100 # @block-job-pause:
1102 # Pause an active background block operation.
1104 # This command returns immediately after marking the active background block
1105 # operation for pausing.  It is an error to call this command if no
1106 # operation is in progress.  Pausing an already paused job has no cumulative
1107 # effect; a single block-job-resume command will resume the job.
1109 # The operation will pause as soon as possible.  No event is emitted when
1110 # the operation is actually paused.  Cancelling a paused job automatically
1111 # resumes it.
1113 # @device: the device name
1115 # Returns: Nothing on success
1116 #          If no background operation is active on this device, DeviceNotActive
1118 # Since: 1.3
1120 { 'command': 'block-job-pause', 'data': { 'device': 'str' } }
1123 # @block-job-resume:
1125 # Resume an active background block operation.
1127 # This command returns immediately after resuming a paused background block
1128 # operation.  It is an error to call this command if no operation is in
1129 # progress.  Resuming an already running job is not an error.
1131 # This command also clears the error status of the job.
1133 # @device: the device name
1135 # Returns: Nothing on success
1136 #          If no background operation is active on this device, DeviceNotActive
1138 # Since: 1.3
1140 { 'command': 'block-job-resume', 'data': { 'device': 'str' } }
1143 # @block-job-complete:
1145 # Manually trigger completion of an active background block operation.  This
1146 # is supported for drive mirroring, where it also switches the device to
1147 # write to the target path only.  The ability to complete is signaled with
1148 # a BLOCK_JOB_READY event.
1150 # This command completes an active background block operation synchronously.
1151 # The ordering of this command's return with the BLOCK_JOB_COMPLETED event
1152 # is not defined.  Note that if an I/O error occurs during the processing of
1153 # this command: 1) the command itself will fail; 2) the error will be processed
1154 # according to the rerror/werror arguments that were specified when starting
1155 # the operation.
1157 # A cancelled or paused job cannot be completed.
1159 # @device: the device name
1161 # Returns: Nothing on success
1162 #          If no background operation is active on this device, DeviceNotActive
1164 # Since: 1.3
1166 { 'command': 'block-job-complete', 'data': { 'device': 'str' } }
1169 # @BlockdevDiscardOptions
1171 # Determines how to handle discard requests.
1173 # @ignore:      Ignore the request
1174 # @unmap:       Forward as an unmap request
1176 # Since: 1.7
1178 { 'enum': 'BlockdevDiscardOptions',
1179   'data': [ 'ignore', 'unmap' ] }
1182 # @BlockdevDetectZeroesOptions
1184 # Describes the operation mode for the automatic conversion of plain
1185 # zero writes by the OS to driver specific optimized zero write commands.
1187 # @off:      Disabled (default)
1188 # @on:       Enabled
1189 # @unmap:    Enabled and even try to unmap blocks if possible. This requires
1190 #            also that @BlockdevDiscardOptions is set to unmap for this device.
1192 # Since: 2.1
1194 { 'enum': 'BlockdevDetectZeroesOptions',
1195   'data': [ 'off', 'on', 'unmap' ] }
1198 # @BlockdevAioOptions
1200 # Selects the AIO backend to handle I/O requests
1202 # @threads:     Use qemu's thread pool
1203 # @native:      Use native AIO backend (only Linux and Windows)
1205 # Since: 1.7
1207 { 'enum': 'BlockdevAioOptions',
1208   'data': [ 'threads', 'native' ] }
1211 # @BlockdevCacheOptions
1213 # Includes cache-related options for block devices
1215 # @writeback:   #optional enables writeback mode for any caches (default: true)
1216 # @direct:      #optional enables use of O_DIRECT (bypass the host page cache;
1217 #               default: false)
1218 # @no-flush:    #optional ignore any flush requests for the device (default:
1219 #               false)
1221 # Since: 1.7
1223 { 'type': 'BlockdevCacheOptions',
1224   'data': { '*writeback': 'bool',
1225             '*direct': 'bool',
1226             '*no-flush': 'bool' } }
1229 # @BlockdevDriver
1231 # Drivers that are supported in block device operations.
1233 # @host_device, @host_cdrom, @host_floppy: Since 2.1
1235 # Since: 2.0
1237 { 'enum': 'BlockdevDriver',
1238   'data': [ 'archipelago', 'blkdebug', 'blkverify', 'bochs', 'cloop',
1239             'dmg', 'file', 'ftp', 'ftps', 'host_cdrom', 'host_device',
1240             'host_floppy', 'http', 'https', 'null-aio', 'null-co', 'parallels',
1241             'qcow', 'qcow2', 'qed', 'quorum', 'raw', 'tftp', 'vdi', 'vhdx',
1242             'vmdk', 'vpc', 'vvfat' ] }
1245 # @BlockdevOptionsBase
1247 # Options that are available for all block devices, independent of the block
1248 # driver.
1250 # @driver:        block driver name
1251 # @id:            #optional id by which the new block device can be referred to.
1252 #                 This is a required option on the top level of blockdev-add, and
1253 #                 currently not allowed on any other level.
1254 # @node-name:     #optional the name of a block driver state node (Since 2.0)
1255 # @discard:       #optional discard-related options (default: ignore)
1256 # @cache:         #optional cache-related options
1257 # @aio:           #optional AIO backend (default: threads)
1258 # @rerror:        #optional how to handle read errors on the device
1259 #                 (default: report)
1260 # @werror:        #optional how to handle write errors on the device
1261 #                 (default: enospc)
1262 # @read-only:     #optional whether the block device should be read-only
1263 #                 (default: false)
1264 # @detect-zeroes: #optional detect and optimize zero writes (Since 2.1)
1265 #                 (default: off)
1267 # Since: 1.7
1269 { 'type': 'BlockdevOptionsBase',
1270   'data': { 'driver': 'BlockdevDriver',
1271             '*id': 'str',
1272             '*node-name': 'str',
1273             '*discard': 'BlockdevDiscardOptions',
1274             '*cache': 'BlockdevCacheOptions',
1275             '*aio': 'BlockdevAioOptions',
1276             '*rerror': 'BlockdevOnError',
1277             '*werror': 'BlockdevOnError',
1278             '*read-only': 'bool',
1279             '*detect-zeroes': 'BlockdevDetectZeroesOptions' } }
1282 # @BlockdevOptionsFile
1284 # Driver specific block device options for the file backend and similar
1285 # protocols.
1287 # @filename:    path to the image file
1289 # Since: 1.7
1291 { 'type': 'BlockdevOptionsFile',
1292   'data': { 'filename': 'str' } }
1295 # @BlockdevOptionsNull
1297 # Driver specific block device options for the null backend.
1299 # @size:    #optional size of the device in bytes.
1301 # Since: 2.2
1303 { 'type': 'BlockdevOptionsNull',
1304   'data': { '*size': 'int' } }
1307 # @BlockdevOptionsVVFAT
1309 # Driver specific block device options for the vvfat protocol.
1311 # @dir:         directory to be exported as FAT image
1312 # @fat-type:    #optional FAT type: 12, 16 or 32
1313 # @floppy:      #optional whether to export a floppy image (true) or
1314 #               partitioned hard disk (false; default)
1315 # @rw:          #optional whether to allow write operations (default: false)
1317 # Since: 1.7
1319 { 'type': 'BlockdevOptionsVVFAT',
1320   'data': { 'dir': 'str', '*fat-type': 'int', '*floppy': 'bool',
1321             '*rw': 'bool' } }
1324 # @BlockdevOptionsGenericFormat
1326 # Driver specific block device options for image format that have no option
1327 # besides their data source.
1329 # @file:        reference to or definition of the data source block device
1331 # Since: 1.7
1333 { 'type': 'BlockdevOptionsGenericFormat',
1334   'data': { 'file': 'BlockdevRef' } }
1337 # @BlockdevOptionsGenericCOWFormat
1339 # Driver specific block device options for image format that have no option
1340 # besides their data source and an optional backing file.
1342 # @backing:     #optional reference to or definition of the backing file block
1343 #               device (if missing, taken from the image file content). It is
1344 #               allowed to pass an empty string here in order to disable the
1345 #               default backing file.
1347 # Since: 1.7
1349 { 'type': 'BlockdevOptionsGenericCOWFormat',
1350   'base': 'BlockdevOptionsGenericFormat',
1351   'data': { '*backing': 'BlockdevRef' } }
1354 # @Qcow2OverlapCheckMode
1356 # General overlap check modes.
1358 # @none:        Do not perform any checks
1360 # @constant:    Perform only checks which can be done in constant time and
1361 #               without reading anything from disk
1363 # @cached:      Perform only checks which can be done without reading anything
1364 #               from disk
1366 # @all:         Perform all available overlap checks
1368 # Since: 2.2
1370 { 'enum': 'Qcow2OverlapCheckMode',
1371   'data': [ 'none', 'constant', 'cached', 'all' ] }
1374 # @Qcow2OverlapCheckFlags
1376 # Structure of flags for each metadata structure. Setting a field to 'true'
1377 # makes qemu guard that structure against unintended overwriting. The default
1378 # value is chosen according to the template given.
1380 # @template: Specifies a template mode which can be adjusted using the other
1381 #            flags, defaults to 'cached'
1383 # Since: 2.2
1385 { 'type': 'Qcow2OverlapCheckFlags',
1386   'data': { '*template':       'Qcow2OverlapCheckMode',
1387             '*main-header':    'bool',
1388             '*active-l1':      'bool',
1389             '*active-l2':      'bool',
1390             '*refcount-table': 'bool',
1391             '*refcount-block': 'bool',
1392             '*snapshot-table': 'bool',
1393             '*inactive-l1':    'bool',
1394             '*inactive-l2':    'bool' } }
1397 # @Qcow2OverlapChecks
1399 # Specifies which metadata structures should be guarded against unintended
1400 # overwriting.
1402 # @flags:   set of flags for separate specification of each metadata structure
1403 #           type
1405 # @mode:    named mode which chooses a specific set of flags
1407 # Since: 2.2
1409 { 'union': 'Qcow2OverlapChecks',
1410   'discriminator': {},
1411   'data': { 'flags': 'Qcow2OverlapCheckFlags',
1412             'mode':  'Qcow2OverlapCheckMode' } }
1415 # @BlockdevOptionsQcow2
1417 # Driver specific block device options for qcow2.
1419 # @lazy-refcounts:        #optional whether to enable the lazy refcounts
1420 #                         feature (default is taken from the image file)
1422 # @pass-discard-request:  #optional whether discard requests to the qcow2
1423 #                         device should be forwarded to the data source
1425 # @pass-discard-snapshot: #optional whether discard requests for the data source
1426 #                         should be issued when a snapshot operation (e.g.
1427 #                         deleting a snapshot) frees clusters in the qcow2 file
1429 # @pass-discard-other:    #optional whether discard requests for the data source
1430 #                         should be issued on other occasions where a cluster
1431 #                         gets freed
1433 # @overlap-check:         #optional which overlap checks to perform for writes
1434 #                         to the image, defaults to 'cached' (since 2.2)
1436 # @cache-size:            #optional the maximum total size of the L2 table and
1437 #                         refcount block caches in bytes (since 2.2)
1439 # @l2-cache-size:         #optional the maximum size of the L2 table cache in
1440 #                         bytes (since 2.2)
1442 # @refcount-cache-size:   #optional the maximum size of the refcount block cache
1443 #                         in bytes (since 2.2)
1445 # Since: 1.7
1447 { 'type': 'BlockdevOptionsQcow2',
1448   'base': 'BlockdevOptionsGenericCOWFormat',
1449   'data': { '*lazy-refcounts': 'bool',
1450             '*pass-discard-request': 'bool',
1451             '*pass-discard-snapshot': 'bool',
1452             '*pass-discard-other': 'bool',
1453             '*overlap-check': 'Qcow2OverlapChecks',
1454             '*cache-size': 'int',
1455             '*l2-cache-size': 'int',
1456             '*refcount-cache-size': 'int' } }
1460 # @BlockdevOptionsArchipelago
1462 # Driver specific block device options for Archipelago.
1464 # @volume:              Name of the Archipelago volume image
1466 # @mport:               #optional The port number on which mapperd is
1467 #                       listening. This is optional
1468 #                       and if not specified, QEMU will make Archipelago
1469 #                       use the default port (1001).
1471 # @vport:               #optional The port number on which vlmcd is
1472 #                       listening. This is optional
1473 #                       and if not specified, QEMU will make Archipelago
1474 #                       use the default port (501).
1476 # @segment:             #optional The name of the shared memory segment
1477 #                       Archipelago stack is using. This is optional
1478 #                       and if not specified, QEMU will make Archipelago
1479 #                       use the default value, 'archipelago'.
1480 # Since: 2.2
1482 { 'type': 'BlockdevOptionsArchipelago',
1483   'data': { 'volume': 'str',
1484             '*mport': 'int',
1485             '*vport': 'int',
1486             '*segment': 'str' } }
1490 # @BlkdebugEvent
1492 # Trigger events supported by blkdebug.
1494 { 'enum': 'BlkdebugEvent',
1495   'data': [ 'l1_update', 'l1_grow.alloc_table', 'l1_grow.write_table',
1496             'l1_grow.activate_table', 'l2_load', 'l2_update',
1497             'l2_update_compressed', 'l2_alloc.cow_read', 'l2_alloc.write',
1498             'read_aio', 'read_backing_aio', 'read_compressed', 'write_aio',
1499             'write_compressed', 'vmstate_load', 'vmstate_save', 'cow_read',
1500             'cow_write', 'reftable_load', 'reftable_grow', 'reftable_update',
1501             'refblock_load', 'refblock_update', 'refblock_update_part',
1502             'refblock_alloc', 'refblock_alloc.hookup', 'refblock_alloc.write',
1503             'refblock_alloc.write_blocks', 'refblock_alloc.write_table',
1504             'refblock_alloc.switch_table', 'cluster_alloc',
1505             'cluster_alloc_bytes', 'cluster_free', 'flush_to_os',
1506             'flush_to_disk', 'pwritev_rmw.head', 'pwritev_rmw.after_head',
1507             'pwritev_rmw.tail', 'pwritev_rmw.after_tail', 'pwritev',
1508             'pwritev_zero', 'pwritev_done', 'empty_image_prepare' ] }
1511 # @BlkdebugInjectErrorOptions
1513 # Describes a single error injection for blkdebug.
1515 # @event:       trigger event
1517 # @state:       #optional the state identifier blkdebug needs to be in to
1518 #               actually trigger the event; defaults to "any"
1520 # @errno:       #optional error identifier (errno) to be returned; defaults to
1521 #               EIO
1523 # @sector:      #optional specifies the sector index which has to be affected
1524 #               in order to actually trigger the event; defaults to "any
1525 #               sector"
1527 # @once:        #optional disables further events after this one has been
1528 #               triggered; defaults to false
1530 # @immediately: #optional fail immediately; defaults to false
1532 # Since: 2.0
1534 { 'type': 'BlkdebugInjectErrorOptions',
1535   'data': { 'event': 'BlkdebugEvent',
1536             '*state': 'int',
1537             '*errno': 'int',
1538             '*sector': 'int',
1539             '*once': 'bool',
1540             '*immediately': 'bool' } }
1543 # @BlkdebugSetStateOptions
1545 # Describes a single state-change event for blkdebug.
1547 # @event:       trigger event
1549 # @state:       #optional the current state identifier blkdebug needs to be in;
1550 #               defaults to "any"
1552 # @new_state:   the state identifier blkdebug is supposed to assume if
1553 #               this event is triggered
1555 # Since: 2.0
1557 { 'type': 'BlkdebugSetStateOptions',
1558   'data': { 'event': 'BlkdebugEvent',
1559             '*state': 'int',
1560             'new_state': 'int' } }
1563 # @BlockdevOptionsBlkdebug
1565 # Driver specific block device options for blkdebug.
1567 # @image:           underlying raw block device (or image file)
1569 # @config:          #optional filename of the configuration file
1571 # @align:           #optional required alignment for requests in bytes
1573 # @inject-error:    #optional array of error injection descriptions
1575 # @set-state:       #optional array of state-change descriptions
1577 # Since: 2.0
1579 { 'type': 'BlockdevOptionsBlkdebug',
1580   'data': { 'image': 'BlockdevRef',
1581             '*config': 'str',
1582             '*align': 'int',
1583             '*inject-error': ['BlkdebugInjectErrorOptions'],
1584             '*set-state': ['BlkdebugSetStateOptions'] } }
1587 # @BlockdevOptionsBlkverify
1589 # Driver specific block device options for blkverify.
1591 # @test:    block device to be tested
1593 # @raw:     raw image used for verification
1595 # Since: 2.0
1597 { 'type': 'BlockdevOptionsBlkverify',
1598   'data': { 'test': 'BlockdevRef',
1599             'raw': 'BlockdevRef' } }
1602 # @QuorumReadPattern
1604 # An enumeration of quorum read patterns.
1606 # @quorum: read all the children and do a quorum vote on reads
1608 # @fifo: read only from the first child that has not failed
1610 # Since: 2.2
1612 { 'enum': 'QuorumReadPattern', 'data': [ 'quorum', 'fifo' ] }
1615 # @BlockdevOptionsQuorum
1617 # Driver specific block device options for Quorum
1619 # @blkverify:      #optional true if the driver must print content mismatch
1620 #                  set to false by default
1622 # @children:       the children block devices to use
1624 # @vote-threshold: the vote limit under which a read will fail
1626 # @rewrite-corrupted: #optional rewrite corrupted data when quorum is reached
1627 #                     (Since 2.1)
1629 # @read-pattern: #optional choose read pattern and set to quorum by default
1630 #                (Since 2.2)
1632 # Since: 2.0
1634 { 'type': 'BlockdevOptionsQuorum',
1635   'data': { '*blkverify': 'bool',
1636             'children': [ 'BlockdevRef' ],
1637             'vote-threshold': 'int',
1638             '*rewrite-corrupted': 'bool',
1639             '*read-pattern': 'QuorumReadPattern' } }
1642 # @BlockdevOptions
1644 # Options for creating a block device.
1646 # Since: 1.7
1648 { 'union': 'BlockdevOptions',
1649   'base': 'BlockdevOptionsBase',
1650   'discriminator': 'driver',
1651   'data': {
1652       'archipelago':'BlockdevOptionsArchipelago',
1653       'blkdebug':   'BlockdevOptionsBlkdebug',
1654       'blkverify':  'BlockdevOptionsBlkverify',
1655       'bochs':      'BlockdevOptionsGenericFormat',
1656       'cloop':      'BlockdevOptionsGenericFormat',
1657       'dmg':        'BlockdevOptionsGenericFormat',
1658       'file':       'BlockdevOptionsFile',
1659       'ftp':        'BlockdevOptionsFile',
1660       'ftps':       'BlockdevOptionsFile',
1661 # TODO gluster: Wait for structured options
1662       'host_cdrom': 'BlockdevOptionsFile',
1663       'host_device':'BlockdevOptionsFile',
1664       'host_floppy':'BlockdevOptionsFile',
1665       'http':       'BlockdevOptionsFile',
1666       'https':      'BlockdevOptionsFile',
1667 # TODO iscsi: Wait for structured options
1668 # TODO nbd: Should take InetSocketAddress for 'host'?
1669 # TODO nfs: Wait for structured options
1670       'null-aio':   'BlockdevOptionsNull',
1671       'null-co':    'BlockdevOptionsNull',
1672       'parallels':  'BlockdevOptionsGenericFormat',
1673       'qcow2':      'BlockdevOptionsQcow2',
1674       'qcow':       'BlockdevOptionsGenericCOWFormat',
1675       'qed':        'BlockdevOptionsGenericCOWFormat',
1676       'quorum':     'BlockdevOptionsQuorum',
1677       'raw':        'BlockdevOptionsGenericFormat',
1678 # TODO rbd: Wait for structured options
1679 # TODO sheepdog: Wait for structured options
1680 # TODO ssh: Should take InetSocketAddress for 'host'?
1681       'tftp':       'BlockdevOptionsFile',
1682       'vdi':        'BlockdevOptionsGenericFormat',
1683       'vhdx':       'BlockdevOptionsGenericFormat',
1684       'vmdk':       'BlockdevOptionsGenericCOWFormat',
1685       'vpc':        'BlockdevOptionsGenericFormat',
1686       'vvfat':      'BlockdevOptionsVVFAT'
1687   } }
1690 # @BlockdevRef
1692 # Reference to a block device.
1694 # @definition:      defines a new block device inline
1695 # @reference:       references the ID of an existing block device. An
1696 #                   empty string means that no block device should be
1697 #                   referenced.
1699 # Since: 1.7
1701 { 'union': 'BlockdevRef',
1702   'discriminator': {},
1703   'data': { 'definition': 'BlockdevOptions',
1704             'reference': 'str' } }
1707 # @blockdev-add:
1709 # Creates a new block device.
1711 # @options: block device options for the new device
1713 # Since: 1.7
1715 { 'command': 'blockdev-add', 'data': { 'options': 'BlockdevOptions' } }
1719 # @BlockErrorAction
1721 # An enumeration of action that has been taken when a DISK I/O occurs
1723 # @ignore: error has been ignored
1725 # @report: error has been reported to the device
1727 # @stop: error caused VM to be stopped
1729 # Since: 2.1
1731 { 'enum': 'BlockErrorAction',
1732   'data': [ 'ignore', 'report', 'stop' ] }
1736 # @BLOCK_IMAGE_CORRUPTED
1738 # Emitted when a corruption has been detected in a disk image
1740 # @device: device name
1742 # @msg: informative message for human consumption, such as the kind of
1743 #       corruption being detected. It should not be parsed by machine as it is
1744 #       not guaranteed to be stable
1746 # @offset: #optional, if the corruption resulted from an image access, this is
1747 #          the access offset into the image
1749 # @size: #optional, if the corruption resulted from an image access, this is
1750 #        the access size
1752 # fatal: if set, the image is marked corrupt and therefore unusable after this
1753 #        event and must be repaired (Since 2.2; before, every
1754 #        BLOCK_IMAGE_CORRUPTED event was fatal)
1756 # Since: 1.7
1758 { 'event': 'BLOCK_IMAGE_CORRUPTED',
1759   'data': { 'device' : 'str',
1760             'msg'    : 'str',
1761             '*offset': 'int',
1762             '*size'  : 'int',
1763             'fatal'  : 'bool' } }
1766 # @BLOCK_IO_ERROR
1768 # Emitted when a disk I/O error occurs
1770 # @device: device name
1772 # @operation: I/O operation
1774 # @action: action that has been taken
1776 # @nospace: #optional true if I/O error was caused due to a no-space
1777 #           condition. This key is only present if query-block's
1778 #           io-status is present, please see query-block documentation
1779 #           for more information (since: 2.2)
1781 # @reason: human readable string describing the error cause.
1782 #          (This field is a debugging aid for humans, it should not
1783 #           be parsed by applications) (since: 2.2)
1785 # Note: If action is "stop", a STOP event will eventually follow the
1786 # BLOCK_IO_ERROR event
1788 # Since: 0.13.0
1790 { 'event': 'BLOCK_IO_ERROR',
1791   'data': { 'device': 'str', 'operation': 'IoOperationType',
1792             'action': 'BlockErrorAction', '*nospace': 'bool',
1793             'reason': 'str' } }
1796 # @BLOCK_JOB_COMPLETED
1798 # Emitted when a block job has completed
1800 # @type: job type
1802 # @device: device name
1804 # @len: maximum progress value
1806 # @offset: current progress value. On success this is equal to len.
1807 #          On failure this is less than len
1809 # @speed: rate limit, bytes per second
1811 # @error: #optional, error message. Only present on failure. This field
1812 #         contains a human-readable error message. There are no semantics
1813 #         other than that streaming has failed and clients should not try to
1814 #         interpret the error string
1816 # Since: 1.1
1818 { 'event': 'BLOCK_JOB_COMPLETED',
1819   'data': { 'type'  : 'BlockJobType',
1820             'device': 'str',
1821             'len'   : 'int',
1822             'offset': 'int',
1823             'speed' : 'int',
1824             '*error': 'str' } }
1827 # @BLOCK_JOB_CANCELLED
1829 # Emitted when a block job has been cancelled
1831 # @type: job type
1833 # @device: device name
1835 # @len: maximum progress value
1837 # @offset: current progress value. On success this is equal to len.
1838 #          On failure this is less than len
1840 # @speed: rate limit, bytes per second
1842 # Since: 1.1
1844 { 'event': 'BLOCK_JOB_CANCELLED',
1845   'data': { 'type'  : 'BlockJobType',
1846             'device': 'str',
1847             'len'   : 'int',
1848             'offset': 'int',
1849             'speed' : 'int' } }
1852 # @BLOCK_JOB_ERROR
1854 # Emitted when a block job encounters an error
1856 # @device: device name
1858 # @operation: I/O operation
1860 # @action: action that has been taken
1862 # Since: 1.3
1864 { 'event': 'BLOCK_JOB_ERROR',
1865   'data': { 'device'   : 'str',
1866             'operation': 'IoOperationType',
1867             'action'   : 'BlockErrorAction' } }
1870 # @BLOCK_JOB_READY
1872 # Emitted when a block job is ready to complete
1874 # @type: job type
1876 # @device: device name
1878 # @len: maximum progress value
1880 # @offset: current progress value. On success this is equal to len.
1881 #          On failure this is less than len
1883 # @speed: rate limit, bytes per second
1885 # Note: The "ready to complete" status is always reset by a @BLOCK_JOB_ERROR
1886 # event
1888 # Since: 1.3
1890 { 'event': 'BLOCK_JOB_READY',
1891   'data': { 'type'  : 'BlockJobType',
1892             'device': 'str',
1893             'len'   : 'int',
1894             'offset': 'int',
1895             'speed' : 'int' } }
1897 # @PreallocMode
1899 # Preallocation mode of QEMU image file
1901 # @off: no preallocation
1902 # @metadata: preallocate only for metadata
1903 # @falloc: like @full preallocation but allocate disk space by
1904 #          posix_fallocate() rather than writing zeros.
1905 # @full: preallocate all data by writing zeros to device to ensure disk
1906 #        space is really available. @full preallocation also sets up
1907 #        metadata correctly.
1909 # Since 2.2
1911 { 'enum': 'PreallocMode',
1912   'data': [ 'off', 'metadata', 'falloc', 'full' ] }