target-tricore: fix msub32_suov return wrong results
[qemu/ar7.git] / qapi / block-core.json
bloba3fdaf02ba133ede998f22cff8cc3a0bbf06eb99
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 # @write_threshold: configured write threshold for the device.
261 #                   0 if disabled. (Since 2.3)
263 # Since: 0.14.0
266 { 'type': 'BlockDeviceInfo',
267   'data': { 'file': 'str', '*node-name': 'str', 'ro': 'bool', 'drv': 'str',
268             '*backing_file': 'str', 'backing_file_depth': 'int',
269             'encrypted': 'bool', 'encryption_key_missing': 'bool',
270             'detect_zeroes': 'BlockdevDetectZeroesOptions',
271             'bps': 'int', 'bps_rd': 'int', 'bps_wr': 'int',
272             'iops': 'int', 'iops_rd': 'int', 'iops_wr': 'int',
273             'image': 'ImageInfo',
274             '*bps_max': 'int', '*bps_rd_max': 'int',
275             '*bps_wr_max': 'int', '*iops_max': 'int',
276             '*iops_rd_max': 'int', '*iops_wr_max': 'int',
277             '*iops_size': 'int', 'cache': 'BlockdevCacheInfo',
278             'write_threshold': 'int' } }
281 # @BlockDeviceIoStatus:
283 # An enumeration of block device I/O status.
285 # @ok: The last I/O operation has succeeded
287 # @failed: The last I/O operation has failed
289 # @nospace: The last I/O operation has failed due to a no-space condition
291 # Since: 1.0
293 { 'enum': 'BlockDeviceIoStatus', 'data': [ 'ok', 'failed', 'nospace' ] }
296 # @BlockDeviceMapEntry:
298 # Entry in the metadata map of the device (returned by "qemu-img map")
300 # @start: Offset in the image of the first byte described by this entry
301 #         (in bytes)
303 # @length: Length of the range described by this entry (in bytes)
305 # @depth: Number of layers (0 = top image, 1 = top image's backing file, etc.)
306 #         before reaching one for which the range is allocated.  The value is
307 #         in the range 0 to the depth of the image chain - 1.
309 # @zero: the sectors in this range read as zeros
311 # @data: reading the image will actually read data from a file (in particular,
312 #        if @offset is present this means that the sectors are not simply
313 #        preallocated, but contain actual data in raw format)
315 # @offset: if present, the image file stores the data for this range in
316 #          raw format at the given offset.
318 # Since 1.7
320 { 'type': 'BlockDeviceMapEntry',
321   'data': { 'start': 'int', 'length': 'int', 'depth': 'int', 'zero': 'bool',
322             'data': 'bool', '*offset': 'int' } }
325 # @BlockDirtyInfo:
327 # Block dirty bitmap information.
329 # @count: number of dirty bytes according to the dirty bitmap
331 # @granularity: granularity of the dirty bitmap in bytes (since 1.4)
333 # Since: 1.3
335 { 'type': 'BlockDirtyInfo',
336   'data': {'count': 'int', 'granularity': 'int'} }
339 # @BlockInfo:
341 # Block device information.  This structure describes a virtual device and
342 # the backing device associated with it.
344 # @device: The device name associated with the virtual device.
346 # @type: This field is returned only for compatibility reasons, it should
347 #        not be used (always returns 'unknown')
349 # @removable: True if the device supports removable media.
351 # @locked: True if the guest has locked this device from having its media
352 #          removed
354 # @tray_open: #optional True if the device has a tray and it is open
355 #             (only present if removable is true)
357 # @dirty-bitmaps: #optional dirty bitmaps information (only present if the
358 #                 driver has one or more dirty bitmaps) (Since 2.0)
360 # @io-status: #optional @BlockDeviceIoStatus. Only present if the device
361 #             supports it and the VM is configured to stop on errors
362 #             (supported device models: virtio-blk, ide, scsi-disk)
364 # @inserted: #optional @BlockDeviceInfo describing the device if media is
365 #            present
367 # Since:  0.14.0
369 { 'type': 'BlockInfo',
370   'data': {'device': 'str', 'type': 'str', 'removable': 'bool',
371            'locked': 'bool', '*inserted': 'BlockDeviceInfo',
372            '*tray_open': 'bool', '*io-status': 'BlockDeviceIoStatus',
373            '*dirty-bitmaps': ['BlockDirtyInfo'] } }
376 # @query-block:
378 # Get a list of BlockInfo for all virtual block devices.
380 # Returns: a list of @BlockInfo describing each virtual block device
382 # Since: 0.14.0
384 { 'command': 'query-block', 'returns': ['BlockInfo'] }
387 # @BlockDeviceStats:
389 # Statistics of a virtual block device or a block backing device.
391 # @rd_bytes:      The number of bytes read by the device.
393 # @wr_bytes:      The number of bytes written by the device.
395 # @rd_operations: The number of read operations performed by the device.
397 # @wr_operations: The number of write operations performed by the device.
399 # @flush_operations: The number of cache flush operations performed by the
400 #                    device (since 0.15.0)
402 # @flush_total_time_ns: Total time spend on cache flushes in nano-seconds
403 #                       (since 0.15.0).
405 # @wr_total_time_ns: Total time spend on writes in nano-seconds (since 0.15.0).
407 # @rd_total_time_ns: Total_time_spend on reads in nano-seconds (since 0.15.0).
409 # @wr_highest_offset: The offset after the greatest byte written to the
410 #                     device.  The intended use of this information is for
411 #                     growable sparse files (like qcow2) that are used on top
412 #                     of a physical device.
414 # @rd_merged: Number of read requests that have been merged into another
415 #             request (Since 2.3).
417 # @wr_merged: Number of write requests that have been merged into another
418 #             request (Since 2.3).
420 # Since: 0.14.0
422 { 'type': 'BlockDeviceStats',
423   'data': {'rd_bytes': 'int', 'wr_bytes': 'int', 'rd_operations': 'int',
424            'wr_operations': 'int', 'flush_operations': 'int',
425            'flush_total_time_ns': 'int', 'wr_total_time_ns': 'int',
426            'rd_total_time_ns': 'int', 'wr_highest_offset': 'int',
427            'rd_merged': 'int', 'wr_merged': 'int' } }
430 # @BlockStats:
432 # Statistics of a virtual block device or a block backing device.
434 # @device: #optional If the stats are for a virtual block device, the name
435 #          corresponding to the virtual block device.
437 # @node-name: #optional The node name of the device. (Since 2.3)
439 # @stats:  A @BlockDeviceStats for the device.
441 # @parent: #optional This describes the file block device if it has one.
443 # @backing: #optional This describes the backing block device if it has one.
444 #           (Since 2.0)
446 # Since: 0.14.0
448 { 'type': 'BlockStats',
449   'data': {'*device': 'str', '*node-name': 'str',
450            'stats': 'BlockDeviceStats',
451            '*parent': 'BlockStats',
452            '*backing': 'BlockStats'} }
455 # @query-blockstats:
457 # Query the @BlockStats for all virtual block devices.
459 # @query-nodes: #optional If true, the command will query all the block nodes
460 #               that have a node name, in a list which will include "parent"
461 #               information, but not "backing".
462 #               If false or omitted, the behavior is as before - query all the
463 #               device backends, recursively including their "parent" and
464 #               "backing". (Since 2.3)
466 # Returns: A list of @BlockStats for each virtual block devices.
468 # Since: 0.14.0
470 { 'command': 'query-blockstats',
471   'data': { '*query-nodes': 'bool' },
472   'returns': ['BlockStats'] }
475 # @BlockdevOnError:
477 # An enumeration of possible behaviors for errors on I/O operations.
478 # The exact meaning depends on whether the I/O was initiated by a guest
479 # or by a block job
481 # @report: for guest operations, report the error to the guest;
482 #          for jobs, cancel the job
484 # @ignore: ignore the error, only report a QMP event (BLOCK_IO_ERROR
485 #          or BLOCK_JOB_ERROR)
487 # @enospc: same as @stop on ENOSPC, same as @report otherwise.
489 # @stop: for guest operations, stop the virtual machine;
490 #        for jobs, pause the job
492 # Since: 1.3
494 { 'enum': 'BlockdevOnError',
495   'data': ['report', 'ignore', 'enospc', 'stop'] }
498 # @MirrorSyncMode:
500 # An enumeration of possible behaviors for the initial synchronization
501 # phase of storage mirroring.
503 # @top: copies data in the topmost image to the destination
505 # @full: copies data from all images to the destination
507 # @none: only copy data written from now on
509 # Since: 1.3
511 { 'enum': 'MirrorSyncMode',
512   'data': ['top', 'full', 'none'] }
515 # @BlockJobType:
517 # Type of a block job.
519 # @commit: block commit job type, see "block-commit"
521 # @stream: block stream job type, see "block-stream"
523 # @mirror: drive mirror job type, see "drive-mirror"
525 # @backup: drive backup job type, see "drive-backup"
527 # Since: 1.7
529 { 'enum': 'BlockJobType',
530   'data': ['commit', 'stream', 'mirror', 'backup'] }
533 # @BlockJobInfo:
535 # Information about a long-running block device operation.
537 # @type: the job type ('stream' for image streaming)
539 # @device: the block device name
541 # @len: the maximum progress value
543 # @busy: false if the job is known to be in a quiescent state, with
544 #        no pending I/O.  Since 1.3.
546 # @paused: whether the job is paused or, if @busy is true, will
547 #          pause itself as soon as possible.  Since 1.3.
549 # @offset: the current progress value
551 # @speed: the rate limit, bytes per second
553 # @io-status: the status of the job (since 1.3)
555 # @ready: true if the job may be completed (since 2.2)
557 # Since: 1.1
559 { 'type': 'BlockJobInfo',
560   'data': {'type': 'str', 'device': 'str', 'len': 'int',
561            'offset': 'int', 'busy': 'bool', 'paused': 'bool', 'speed': 'int',
562            'io-status': 'BlockDeviceIoStatus', 'ready': 'bool'} }
565 # @query-block-jobs:
567 # Return information about long-running block device operations.
569 # Returns: a list of @BlockJobInfo for each active block job
571 # Since: 1.1
573 { 'command': 'query-block-jobs', 'returns': ['BlockJobInfo'] }
576 # @block_passwd:
578 # This command sets the password of a block device that has not been open
579 # with a password and requires one.
581 # The two cases where this can happen are a block device is created through
582 # QEMU's initial command line or a block device is changed through the legacy
583 # @change interface.
585 # In the event that the block device is created through the initial command
586 # line, the VM will start in the stopped state regardless of whether '-S' is
587 # used.  The intention is for a management tool to query the block devices to
588 # determine which ones are encrypted, set the passwords with this command, and
589 # then start the guest with the @cont command.
591 # Either @device or @node-name must be set but not both.
593 # @device: #optional the name of the block backend device to set the password on
595 # @node-name: #optional graph node name to set the password on (Since 2.0)
597 # @password: the password to use for the device
599 # Returns: nothing on success
600 #          If @device is not a valid block device, DeviceNotFound
601 #          If @device is not encrypted, DeviceNotEncrypted
603 # Notes:  Not all block formats support encryption and some that do are not
604 #         able to validate that a password is correct.  Disk corruption may
605 #         occur if an invalid password is specified.
607 # Since: 0.14.0
609 { 'command': 'block_passwd', 'data': {'*device': 'str',
610                                       '*node-name': 'str', 'password': 'str'} }
613 # @block_resize
615 # Resize a block image while a guest is running.
617 # Either @device or @node-name must be set but not both.
619 # @device: #optional the name of the device to get the image resized
621 # @node-name: #optional graph node name to get the image resized (Since 2.0)
623 # @size:  new image size in bytes
625 # Returns: nothing on success
626 #          If @device is not a valid block device, DeviceNotFound
628 # Since: 0.14.0
630 { 'command': 'block_resize', 'data': { '*device': 'str',
631                                        '*node-name': 'str',
632                                        'size': 'int' }}
635 # @NewImageMode
637 # An enumeration that tells QEMU how to set the backing file path in
638 # a new image file.
640 # @existing: QEMU should look for an existing image file.
642 # @absolute-paths: QEMU should create a new image with absolute paths
643 # for the backing file. If there is no backing file available, the new
644 # image will not be backed either.
646 # Since: 1.1
648 { 'enum': 'NewImageMode',
649   'data': [ 'existing', 'absolute-paths' ] }
652 # @BlockdevSnapshot
654 # Either @device or @node-name must be set but not both.
656 # @device: #optional the name of the device to generate the snapshot from.
658 # @node-name: #optional graph node name to generate the snapshot from (Since 2.0)
660 # @snapshot-file: the target of the new image. A new file will be created.
662 # @snapshot-node-name: #optional the graph node name of the new image (Since 2.0)
664 # @format: #optional the format of the snapshot image, default is 'qcow2'.
666 # @mode: #optional whether and how QEMU should create a new image, default is
667 #        'absolute-paths'.
669 { 'type': 'BlockdevSnapshot',
670   'data': { '*device': 'str', '*node-name': 'str',
671             'snapshot-file': 'str', '*snapshot-node-name': 'str',
672             '*format': 'str', '*mode': 'NewImageMode' } }
675 # @DriveBackup
677 # @device: the name of the device which should be copied.
679 # @target: the target of the new image. If the file exists, or if it
680 #          is a device, the existing file/device will be used as the new
681 #          destination.  If it does not exist, a new file will be created.
683 # @format: #optional the format of the new destination, default is to
684 #          probe if @mode is 'existing', else the format of the source
686 # @sync: what parts of the disk image should be copied to the destination
687 #        (all the disk, only the sectors allocated in the topmost image, or
688 #        only new I/O).
690 # @mode: #optional whether and how QEMU should create a new image, default is
691 #        'absolute-paths'.
693 # @speed: #optional the maximum speed, in bytes per second
695 # @on-source-error: #optional the action to take on an error on the source,
696 #                   default 'report'.  'stop' and 'enospc' can only be used
697 #                   if the block device supports io-status (see BlockInfo).
699 # @on-target-error: #optional the action to take on an error on the target,
700 #                   default 'report' (no limitations, since this applies to
701 #                   a different block device than @device).
703 # Note that @on-source-error and @on-target-error only affect background I/O.
704 # If an error occurs during a guest write request, the device's rerror/werror
705 # actions will be used.
707 # Since: 1.6
709 { 'type': 'DriveBackup',
710   'data': { 'device': 'str', 'target': 'str', '*format': 'str',
711             'sync': 'MirrorSyncMode', '*mode': 'NewImageMode',
712             '*speed': 'int',
713             '*on-source-error': 'BlockdevOnError',
714             '*on-target-error': 'BlockdevOnError' } }
717 # @BlockdevBackup
719 # @device: the name of the device which should be copied.
721 # @target: the name of the backup target device.
723 # @sync: what parts of the disk image should be copied to the destination
724 #        (all the disk, only the sectors allocated in the topmost image, or
725 #        only new I/O).
727 # @speed: #optional the maximum speed, in bytes per second. The default is 0,
728 #         for unlimited.
730 # @on-source-error: #optional the action to take on an error on the source,
731 #                   default 'report'.  'stop' and 'enospc' can only be used
732 #                   if the block device supports io-status (see BlockInfo).
734 # @on-target-error: #optional the action to take on an error on the target,
735 #                   default 'report' (no limitations, since this applies to
736 #                   a different block device than @device).
738 # Note that @on-source-error and @on-target-error only affect background I/O.
739 # If an error occurs during a guest write request, the device's rerror/werror
740 # actions will be used.
742 # Since: 2.3
744 { 'type': 'BlockdevBackup',
745   'data': { 'device': 'str', 'target': 'str',
746             'sync': 'MirrorSyncMode',
747             '*speed': 'int',
748             '*on-source-error': 'BlockdevOnError',
749             '*on-target-error': 'BlockdevOnError' } }
752 # @blockdev-snapshot-sync
754 # Generates a synchronous snapshot of a block device.
756 # For the arguments, see the documentation of BlockdevSnapshot.
758 # Returns: nothing on success
759 #          If @device is not a valid block device, DeviceNotFound
761 # Since 0.14.0
763 { 'command': 'blockdev-snapshot-sync',
764   'data': 'BlockdevSnapshot' }
767 # @change-backing-file
769 # Change the backing file in the image file metadata.  This does not
770 # cause QEMU to reopen the image file to reparse the backing filename
771 # (it may, however, perform a reopen to change permissions from
772 # r/o -> r/w -> r/o, if needed). The new backing file string is written
773 # into the image file metadata, and the QEMU internal strings are
774 # updated.
776 # @image-node-name: The name of the block driver state node of the
777 #                   image to modify.
779 # @device:          The name of the device that owns image-node-name.
781 # @backing-file:    The string to write as the backing file.  This
782 #                   string is not validated, so care should be taken
783 #                   when specifying the string or the image chain may
784 #                   not be able to be reopened again.
786 # Since: 2.1
788 { 'command': 'change-backing-file',
789   'data': { 'device': 'str', 'image-node-name': 'str',
790             'backing-file': 'str' } }
793 # @block-commit
795 # Live commit of data from overlay image nodes into backing nodes - i.e.,
796 # writes data between 'top' and 'base' into 'base'.
798 # @device:  the name of the device
800 # @base:   #optional The file name of the backing image to write data into.
801 #                    If not specified, this is the deepest backing image
803 # @top:    #optional The file name of the backing image within the image chain,
804 #                    which contains the topmost data to be committed down. If
805 #                    not specified, this is the active layer.
807 # @backing-file:  #optional The backing file string to write into the overlay
808 #                           image of 'top'.  If 'top' is the active layer,
809 #                           specifying a backing file string is an error. This
810 #                           filename is not validated.
812 #                           If a pathname string is such that it cannot be
813 #                           resolved by QEMU, that means that subsequent QMP or
814 #                           HMP commands must use node-names for the image in
815 #                           question, as filename lookup methods will fail.
817 #                           If not specified, QEMU will automatically determine
818 #                           the backing file string to use, or error out if
819 #                           there is no obvious choice. Care should be taken
820 #                           when specifying the string, to specify a valid
821 #                           filename or protocol.
822 #                           (Since 2.1)
824 #                    If top == base, that is an error.
825 #                    If top == active, the job will not be completed by itself,
826 #                    user needs to complete the job with the block-job-complete
827 #                    command after getting the ready event. (Since 2.0)
829 #                    If the base image is smaller than top, then the base image
830 #                    will be resized to be the same size as top.  If top is
831 #                    smaller than the base image, the base will not be
832 #                    truncated.  If you want the base image size to match the
833 #                    size of the smaller top, you can safely truncate it
834 #                    yourself once the commit operation successfully completes.
836 # @speed:  #optional the maximum speed, in bytes per second
838 # Returns: Nothing on success
839 #          If commit or stream is already active on this device, DeviceInUse
840 #          If @device does not exist, DeviceNotFound
841 #          If image commit is not supported by this device, NotSupported
842 #          If @base or @top is invalid, a generic error is returned
843 #          If @speed is invalid, InvalidParameter
845 # Since: 1.3
848 { 'command': 'block-commit',
849   'data': { 'device': 'str', '*base': 'str', '*top': 'str',
850             '*backing-file': 'str', '*speed': 'int' } }
853 # @drive-backup
855 # Start a point-in-time copy of a block device to a new destination.  The
856 # status of ongoing drive-backup operations can be checked with
857 # query-block-jobs where the BlockJobInfo.type field has the value 'backup'.
858 # The operation can be stopped before it has completed using the
859 # block-job-cancel command.
861 # For the arguments, see the documentation of DriveBackup.
863 # Returns: nothing on success
864 #          If @device is not a valid block device, DeviceNotFound
866 # Since 1.6
868 { 'command': 'drive-backup', 'data': 'DriveBackup' }
871 # @blockdev-backup
873 # Start a point-in-time copy of a block device to a new destination.  The
874 # status of ongoing blockdev-backup operations can be checked with
875 # query-block-jobs where the BlockJobInfo.type field has the value 'backup'.
876 # The operation can be stopped before it has completed using the
877 # block-job-cancel command.
879 # For the arguments, see the documentation of BlockdevBackup.
881 # Returns: Nothing on success.
882 #          If @device or @target is not a valid block device, DeviceNotFound.
884 # Since 2.3
886 { 'command': 'blockdev-backup', 'data': 'BlockdevBackup' }
890 # @query-named-block-nodes
892 # Get the named block driver list
894 # Returns: the list of BlockDeviceInfo
896 # Since 2.0
898 { 'command': 'query-named-block-nodes', 'returns': [ 'BlockDeviceInfo' ] }
901 # @drive-mirror
903 # Start mirroring a block device's writes to a new destination.
905 # @device:  the name of the device whose writes should be mirrored.
907 # @target: the target of the new image. If the file exists, or if it
908 #          is a device, the existing file/device will be used as the new
909 #          destination.  If it does not exist, a new file will be created.
911 # @format: #optional the format of the new destination, default is to
912 #          probe if @mode is 'existing', else the format of the source
914 # @node-name: #optional the new block driver state node name in the graph
915 #             (Since 2.1)
917 # @replaces: #optional with sync=full graph node name to be replaced by the new
918 #            image when a whole image copy is done. This can be used to repair
919 #            broken Quorum files. (Since 2.1)
921 # @mode: #optional whether and how QEMU should create a new image, default is
922 #        'absolute-paths'.
924 # @speed:  #optional the maximum speed, in bytes per second
926 # @sync: what parts of the disk image should be copied to the destination
927 #        (all the disk, only the sectors allocated in the topmost image, or
928 #        only new I/O).
930 # @granularity: #optional granularity of the dirty bitmap, default is 64K
931 #               if the image format doesn't have clusters, 4K if the clusters
932 #               are smaller than that, else the cluster size.  Must be a
933 #               power of 2 between 512 and 64M (since 1.4).
935 # @buf-size: #optional maximum amount of data in flight from source to
936 #            target (since 1.4).
938 # @on-source-error: #optional the action to take on an error on the source,
939 #                   default 'report'.  'stop' and 'enospc' can only be used
940 #                   if the block device supports io-status (see BlockInfo).
942 # @on-target-error: #optional the action to take on an error on the target,
943 #                   default 'report' (no limitations, since this applies to
944 #                   a different block device than @device).
946 # Returns: nothing on success
947 #          If @device is not a valid block device, DeviceNotFound
949 # Since 1.3
951 { 'command': 'drive-mirror',
952   'data': { 'device': 'str', 'target': 'str', '*format': 'str',
953             '*node-name': 'str', '*replaces': 'str',
954             'sync': 'MirrorSyncMode', '*mode': 'NewImageMode',
955             '*speed': 'int', '*granularity': 'uint32',
956             '*buf-size': 'int', '*on-source-error': 'BlockdevOnError',
957             '*on-target-error': 'BlockdevOnError' } }
960 # @block_set_io_throttle:
962 # Change I/O throttle limits for a block drive.
964 # @device: The name of the device
966 # @bps: total throughput limit in bytes per second
968 # @bps_rd: read throughput limit in bytes per second
970 # @bps_wr: write throughput limit in bytes per second
972 # @iops: total I/O operations per second
974 # @ops_rd: read I/O operations per second
976 # @iops_wr: write I/O operations per second
978 # @bps_max: #optional total max in bytes (Since 1.7)
980 # @bps_rd_max: #optional read max in bytes (Since 1.7)
982 # @bps_wr_max: #optional write max in bytes (Since 1.7)
984 # @iops_max: #optional total I/O operations max (Since 1.7)
986 # @iops_rd_max: #optional read I/O operations max (Since 1.7)
988 # @iops_wr_max: #optional write I/O operations max (Since 1.7)
990 # @iops_size: #optional an I/O size in bytes (Since 1.7)
992 # Returns: Nothing on success
993 #          If @device is not a valid block device, DeviceNotFound
995 # Since: 1.1
997 { 'command': 'block_set_io_throttle',
998   'data': { 'device': 'str', 'bps': 'int', 'bps_rd': 'int', 'bps_wr': 'int',
999             'iops': 'int', 'iops_rd': 'int', 'iops_wr': 'int',
1000             '*bps_max': 'int', '*bps_rd_max': 'int',
1001             '*bps_wr_max': 'int', '*iops_max': 'int',
1002             '*iops_rd_max': 'int', '*iops_wr_max': 'int',
1003             '*iops_size': 'int' } }
1006 # @block-stream:
1008 # Copy data from a backing file into a block device.
1010 # The block streaming operation is performed in the background until the entire
1011 # backing file has been copied.  This command returns immediately once streaming
1012 # has started.  The status of ongoing block streaming operations can be checked
1013 # with query-block-jobs.  The operation can be stopped before it has completed
1014 # using the block-job-cancel command.
1016 # If a base file is specified then sectors are not copied from that base file and
1017 # its backing chain.  When streaming completes the image file will have the base
1018 # file as its backing file.  This can be used to stream a subset of the backing
1019 # file chain instead of flattening the entire image.
1021 # On successful completion the image file is updated to drop the backing file
1022 # and the BLOCK_JOB_COMPLETED event is emitted.
1024 # @device: the device name
1026 # @base:   #optional the common backing file name
1028 # @backing-file: #optional The backing file string to write into the active
1029 #                          layer. This filename is not validated.
1031 #                          If a pathname string is such that it cannot be
1032 #                          resolved by QEMU, that means that subsequent QMP or
1033 #                          HMP commands must use node-names for the image in
1034 #                          question, as filename lookup methods will fail.
1036 #                          If not specified, QEMU will automatically determine
1037 #                          the backing file string to use, or error out if there
1038 #                          is no obvious choice.  Care should be taken when
1039 #                          specifying the string, to specify a valid filename or
1040 #                          protocol.
1041 #                          (Since 2.1)
1043 # @speed:  #optional the maximum speed, in bytes per second
1045 # @on-error: #optional the action to take on an error (default report).
1046 #            'stop' and 'enospc' can only be used if the block device
1047 #            supports io-status (see BlockInfo).  Since 1.3.
1049 # Returns: Nothing on success
1050 #          If @device does not exist, DeviceNotFound
1052 # Since: 1.1
1054 { 'command': 'block-stream',
1055   'data': { 'device': 'str', '*base': 'str', '*backing-file': 'str',
1056             '*speed': 'int', '*on-error': 'BlockdevOnError' } }
1059 # @block-job-set-speed:
1061 # Set maximum speed for a background block operation.
1063 # This command can only be issued when there is an active block job.
1065 # Throttling can be disabled by setting the speed to 0.
1067 # @device: the device name
1069 # @speed:  the maximum speed, in bytes per second, or 0 for unlimited.
1070 #          Defaults to 0.
1072 # Returns: Nothing on success
1073 #          If no background operation is active on this device, DeviceNotActive
1075 # Since: 1.1
1077 { 'command': 'block-job-set-speed',
1078   'data': { 'device': 'str', 'speed': 'int' } }
1081 # @block-job-cancel:
1083 # Stop an active background block operation.
1085 # This command returns immediately after marking the active background block
1086 # operation for cancellation.  It is an error to call this command if no
1087 # operation is in progress.
1089 # The operation will cancel as soon as possible and then emit the
1090 # BLOCK_JOB_CANCELLED event.  Before that happens the job is still visible when
1091 # enumerated using query-block-jobs.
1093 # For streaming, the image file retains its backing file unless the streaming
1094 # operation happens to complete just as it is being cancelled.  A new streaming
1095 # operation can be started at a later time to finish copying all data from the
1096 # backing file.
1098 # @device: the device name
1100 # @force: #optional whether to allow cancellation of a paused job (default
1101 #         false).  Since 1.3.
1103 # Returns: Nothing on success
1104 #          If no background operation is active on this device, DeviceNotActive
1106 # Since: 1.1
1108 { 'command': 'block-job-cancel', 'data': { 'device': 'str', '*force': 'bool' } }
1111 # @block-job-pause:
1113 # Pause an active background block operation.
1115 # This command returns immediately after marking the active background block
1116 # operation for pausing.  It is an error to call this command if no
1117 # operation is in progress.  Pausing an already paused job has no cumulative
1118 # effect; a single block-job-resume command will resume the job.
1120 # The operation will pause as soon as possible.  No event is emitted when
1121 # the operation is actually paused.  Cancelling a paused job automatically
1122 # resumes it.
1124 # @device: the device name
1126 # Returns: Nothing on success
1127 #          If no background operation is active on this device, DeviceNotActive
1129 # Since: 1.3
1131 { 'command': 'block-job-pause', 'data': { 'device': 'str' } }
1134 # @block-job-resume:
1136 # Resume an active background block operation.
1138 # This command returns immediately after resuming a paused background block
1139 # operation.  It is an error to call this command if no operation is in
1140 # progress.  Resuming an already running job is not an error.
1142 # This command also clears the error status of the job.
1144 # @device: the device name
1146 # Returns: Nothing on success
1147 #          If no background operation is active on this device, DeviceNotActive
1149 # Since: 1.3
1151 { 'command': 'block-job-resume', 'data': { 'device': 'str' } }
1154 # @block-job-complete:
1156 # Manually trigger completion of an active background block operation.  This
1157 # is supported for drive mirroring, where it also switches the device to
1158 # write to the target path only.  The ability to complete is signaled with
1159 # a BLOCK_JOB_READY event.
1161 # This command completes an active background block operation synchronously.
1162 # The ordering of this command's return with the BLOCK_JOB_COMPLETED event
1163 # is not defined.  Note that if an I/O error occurs during the processing of
1164 # this command: 1) the command itself will fail; 2) the error will be processed
1165 # according to the rerror/werror arguments that were specified when starting
1166 # the operation.
1168 # A cancelled or paused job cannot be completed.
1170 # @device: the device name
1172 # Returns: Nothing on success
1173 #          If no background operation is active on this device, DeviceNotActive
1175 # Since: 1.3
1177 { 'command': 'block-job-complete', 'data': { 'device': 'str' } }
1180 # @BlockdevDiscardOptions
1182 # Determines how to handle discard requests.
1184 # @ignore:      Ignore the request
1185 # @unmap:       Forward as an unmap request
1187 # Since: 1.7
1189 { 'enum': 'BlockdevDiscardOptions',
1190   'data': [ 'ignore', 'unmap' ] }
1193 # @BlockdevDetectZeroesOptions
1195 # Describes the operation mode for the automatic conversion of plain
1196 # zero writes by the OS to driver specific optimized zero write commands.
1198 # @off:      Disabled (default)
1199 # @on:       Enabled
1200 # @unmap:    Enabled and even try to unmap blocks if possible. This requires
1201 #            also that @BlockdevDiscardOptions is set to unmap for this device.
1203 # Since: 2.1
1205 { 'enum': 'BlockdevDetectZeroesOptions',
1206   'data': [ 'off', 'on', 'unmap' ] }
1209 # @BlockdevAioOptions
1211 # Selects the AIO backend to handle I/O requests
1213 # @threads:     Use qemu's thread pool
1214 # @native:      Use native AIO backend (only Linux and Windows)
1216 # Since: 1.7
1218 { 'enum': 'BlockdevAioOptions',
1219   'data': [ 'threads', 'native' ] }
1222 # @BlockdevCacheOptions
1224 # Includes cache-related options for block devices
1226 # @writeback:   #optional enables writeback mode for any caches (default: true)
1227 # @direct:      #optional enables use of O_DIRECT (bypass the host page cache;
1228 #               default: false)
1229 # @no-flush:    #optional ignore any flush requests for the device (default:
1230 #               false)
1232 # Since: 1.7
1234 { 'type': 'BlockdevCacheOptions',
1235   'data': { '*writeback': 'bool',
1236             '*direct': 'bool',
1237             '*no-flush': 'bool' } }
1240 # @BlockdevDriver
1242 # Drivers that are supported in block device operations.
1244 # @host_device, @host_cdrom, @host_floppy: Since 2.1
1246 # Since: 2.0
1248 { 'enum': 'BlockdevDriver',
1249   'data': [ 'archipelago', 'blkdebug', 'blkverify', 'bochs', 'cloop',
1250             'dmg', 'file', 'ftp', 'ftps', 'host_cdrom', 'host_device',
1251             'host_floppy', 'http', 'https', 'null-aio', 'null-co', 'parallels',
1252             'qcow', 'qcow2', 'qed', 'quorum', 'raw', 'tftp', 'vdi', 'vhdx',
1253             'vmdk', 'vpc', 'vvfat' ] }
1256 # @BlockdevOptionsBase
1258 # Options that are available for all block devices, independent of the block
1259 # driver.
1261 # @driver:        block driver name
1262 # @id:            #optional id by which the new block device can be referred to.
1263 #                 This is a required option on the top level of blockdev-add, and
1264 #                 currently not allowed on any other level.
1265 # @node-name:     #optional the name of a block driver state node (Since 2.0)
1266 # @discard:       #optional discard-related options (default: ignore)
1267 # @cache:         #optional cache-related options
1268 # @aio:           #optional AIO backend (default: threads)
1269 # @rerror:        #optional how to handle read errors on the device
1270 #                 (default: report)
1271 # @werror:        #optional how to handle write errors on the device
1272 #                 (default: enospc)
1273 # @read-only:     #optional whether the block device should be read-only
1274 #                 (default: false)
1275 # @detect-zeroes: #optional detect and optimize zero writes (Since 2.1)
1276 #                 (default: off)
1278 # Since: 1.7
1280 { 'type': 'BlockdevOptionsBase',
1281   'data': { 'driver': 'BlockdevDriver',
1282             '*id': 'str',
1283             '*node-name': 'str',
1284             '*discard': 'BlockdevDiscardOptions',
1285             '*cache': 'BlockdevCacheOptions',
1286             '*aio': 'BlockdevAioOptions',
1287             '*rerror': 'BlockdevOnError',
1288             '*werror': 'BlockdevOnError',
1289             '*read-only': 'bool',
1290             '*detect-zeroes': 'BlockdevDetectZeroesOptions' } }
1293 # @BlockdevOptionsFile
1295 # Driver specific block device options for the file backend and similar
1296 # protocols.
1298 # @filename:    path to the image file
1300 # Since: 1.7
1302 { 'type': 'BlockdevOptionsFile',
1303   'data': { 'filename': 'str' } }
1306 # @BlockdevOptionsNull
1308 # Driver specific block device options for the null backend.
1310 # @size:    #optional size of the device in bytes.
1312 # Since: 2.2
1314 { 'type': 'BlockdevOptionsNull',
1315   'data': { '*size': 'int' } }
1318 # @BlockdevOptionsVVFAT
1320 # Driver specific block device options for the vvfat protocol.
1322 # @dir:         directory to be exported as FAT image
1323 # @fat-type:    #optional FAT type: 12, 16 or 32
1324 # @floppy:      #optional whether to export a floppy image (true) or
1325 #               partitioned hard disk (false; default)
1326 # @rw:          #optional whether to allow write operations (default: false)
1328 # Since: 1.7
1330 { 'type': 'BlockdevOptionsVVFAT',
1331   'data': { 'dir': 'str', '*fat-type': 'int', '*floppy': 'bool',
1332             '*rw': 'bool' } }
1335 # @BlockdevOptionsGenericFormat
1337 # Driver specific block device options for image format that have no option
1338 # besides their data source.
1340 # @file:        reference to or definition of the data source block device
1342 # Since: 1.7
1344 { 'type': 'BlockdevOptionsGenericFormat',
1345   'data': { 'file': 'BlockdevRef' } }
1348 # @BlockdevOptionsGenericCOWFormat
1350 # Driver specific block device options for image format that have no option
1351 # besides their data source and an optional backing file.
1353 # @backing:     #optional reference to or definition of the backing file block
1354 #               device (if missing, taken from the image file content). It is
1355 #               allowed to pass an empty string here in order to disable the
1356 #               default backing file.
1358 # Since: 1.7
1360 { 'type': 'BlockdevOptionsGenericCOWFormat',
1361   'base': 'BlockdevOptionsGenericFormat',
1362   'data': { '*backing': 'BlockdevRef' } }
1365 # @Qcow2OverlapCheckMode
1367 # General overlap check modes.
1369 # @none:        Do not perform any checks
1371 # @constant:    Perform only checks which can be done in constant time and
1372 #               without reading anything from disk
1374 # @cached:      Perform only checks which can be done without reading anything
1375 #               from disk
1377 # @all:         Perform all available overlap checks
1379 # Since: 2.2
1381 { 'enum': 'Qcow2OverlapCheckMode',
1382   'data': [ 'none', 'constant', 'cached', 'all' ] }
1385 # @Qcow2OverlapCheckFlags
1387 # Structure of flags for each metadata structure. Setting a field to 'true'
1388 # makes qemu guard that structure against unintended overwriting. The default
1389 # value is chosen according to the template given.
1391 # @template: Specifies a template mode which can be adjusted using the other
1392 #            flags, defaults to 'cached'
1394 # Since: 2.2
1396 { 'type': 'Qcow2OverlapCheckFlags',
1397   'data': { '*template':       'Qcow2OverlapCheckMode',
1398             '*main-header':    'bool',
1399             '*active-l1':      'bool',
1400             '*active-l2':      'bool',
1401             '*refcount-table': 'bool',
1402             '*refcount-block': 'bool',
1403             '*snapshot-table': 'bool',
1404             '*inactive-l1':    'bool',
1405             '*inactive-l2':    'bool' } }
1408 # @Qcow2OverlapChecks
1410 # Specifies which metadata structures should be guarded against unintended
1411 # overwriting.
1413 # @flags:   set of flags for separate specification of each metadata structure
1414 #           type
1416 # @mode:    named mode which chooses a specific set of flags
1418 # Since: 2.2
1420 { 'union': 'Qcow2OverlapChecks',
1421   'discriminator': {},
1422   'data': { 'flags': 'Qcow2OverlapCheckFlags',
1423             'mode':  'Qcow2OverlapCheckMode' } }
1426 # @BlockdevOptionsQcow2
1428 # Driver specific block device options for qcow2.
1430 # @lazy-refcounts:        #optional whether to enable the lazy refcounts
1431 #                         feature (default is taken from the image file)
1433 # @pass-discard-request:  #optional whether discard requests to the qcow2
1434 #                         device should be forwarded to the data source
1436 # @pass-discard-snapshot: #optional whether discard requests for the data source
1437 #                         should be issued when a snapshot operation (e.g.
1438 #                         deleting a snapshot) frees clusters in the qcow2 file
1440 # @pass-discard-other:    #optional whether discard requests for the data source
1441 #                         should be issued on other occasions where a cluster
1442 #                         gets freed
1444 # @overlap-check:         #optional which overlap checks to perform for writes
1445 #                         to the image, defaults to 'cached' (since 2.2)
1447 # @cache-size:            #optional the maximum total size of the L2 table and
1448 #                         refcount block caches in bytes (since 2.2)
1450 # @l2-cache-size:         #optional the maximum size of the L2 table cache in
1451 #                         bytes (since 2.2)
1453 # @refcount-cache-size:   #optional the maximum size of the refcount block cache
1454 #                         in bytes (since 2.2)
1456 # Since: 1.7
1458 { 'type': 'BlockdevOptionsQcow2',
1459   'base': 'BlockdevOptionsGenericCOWFormat',
1460   'data': { '*lazy-refcounts': 'bool',
1461             '*pass-discard-request': 'bool',
1462             '*pass-discard-snapshot': 'bool',
1463             '*pass-discard-other': 'bool',
1464             '*overlap-check': 'Qcow2OverlapChecks',
1465             '*cache-size': 'int',
1466             '*l2-cache-size': 'int',
1467             '*refcount-cache-size': 'int' } }
1471 # @BlockdevOptionsArchipelago
1473 # Driver specific block device options for Archipelago.
1475 # @volume:              Name of the Archipelago volume image
1477 # @mport:               #optional The port number on which mapperd is
1478 #                       listening. This is optional
1479 #                       and if not specified, QEMU will make Archipelago
1480 #                       use the default port (1001).
1482 # @vport:               #optional The port number on which vlmcd is
1483 #                       listening. This is optional
1484 #                       and if not specified, QEMU will make Archipelago
1485 #                       use the default port (501).
1487 # @segment:             #optional The name of the shared memory segment
1488 #                       Archipelago stack is using. This is optional
1489 #                       and if not specified, QEMU will make Archipelago
1490 #                       use the default value, 'archipelago'.
1491 # Since: 2.2
1493 { 'type': 'BlockdevOptionsArchipelago',
1494   'data': { 'volume': 'str',
1495             '*mport': 'int',
1496             '*vport': 'int',
1497             '*segment': 'str' } }
1501 # @BlkdebugEvent
1503 # Trigger events supported by blkdebug.
1505 { 'enum': 'BlkdebugEvent',
1506   'data': [ 'l1_update', 'l1_grow.alloc_table', 'l1_grow.write_table',
1507             'l1_grow.activate_table', 'l2_load', 'l2_update',
1508             'l2_update_compressed', 'l2_alloc.cow_read', 'l2_alloc.write',
1509             'read_aio', 'read_backing_aio', 'read_compressed', 'write_aio',
1510             'write_compressed', 'vmstate_load', 'vmstate_save', 'cow_read',
1511             'cow_write', 'reftable_load', 'reftable_grow', 'reftable_update',
1512             'refblock_load', 'refblock_update', 'refblock_update_part',
1513             'refblock_alloc', 'refblock_alloc.hookup', 'refblock_alloc.write',
1514             'refblock_alloc.write_blocks', 'refblock_alloc.write_table',
1515             'refblock_alloc.switch_table', 'cluster_alloc',
1516             'cluster_alloc_bytes', 'cluster_free', 'flush_to_os',
1517             'flush_to_disk', 'pwritev_rmw.head', 'pwritev_rmw.after_head',
1518             'pwritev_rmw.tail', 'pwritev_rmw.after_tail', 'pwritev',
1519             'pwritev_zero', 'pwritev_done', 'empty_image_prepare' ] }
1522 # @BlkdebugInjectErrorOptions
1524 # Describes a single error injection for blkdebug.
1526 # @event:       trigger event
1528 # @state:       #optional the state identifier blkdebug needs to be in to
1529 #               actually trigger the event; defaults to "any"
1531 # @errno:       #optional error identifier (errno) to be returned; defaults to
1532 #               EIO
1534 # @sector:      #optional specifies the sector index which has to be affected
1535 #               in order to actually trigger the event; defaults to "any
1536 #               sector"
1538 # @once:        #optional disables further events after this one has been
1539 #               triggered; defaults to false
1541 # @immediately: #optional fail immediately; defaults to false
1543 # Since: 2.0
1545 { 'type': 'BlkdebugInjectErrorOptions',
1546   'data': { 'event': 'BlkdebugEvent',
1547             '*state': 'int',
1548             '*errno': 'int',
1549             '*sector': 'int',
1550             '*once': 'bool',
1551             '*immediately': 'bool' } }
1554 # @BlkdebugSetStateOptions
1556 # Describes a single state-change event for blkdebug.
1558 # @event:       trigger event
1560 # @state:       #optional the current state identifier blkdebug needs to be in;
1561 #               defaults to "any"
1563 # @new_state:   the state identifier blkdebug is supposed to assume if
1564 #               this event is triggered
1566 # Since: 2.0
1568 { 'type': 'BlkdebugSetStateOptions',
1569   'data': { 'event': 'BlkdebugEvent',
1570             '*state': 'int',
1571             'new_state': 'int' } }
1574 # @BlockdevOptionsBlkdebug
1576 # Driver specific block device options for blkdebug.
1578 # @image:           underlying raw block device (or image file)
1580 # @config:          #optional filename of the configuration file
1582 # @align:           #optional required alignment for requests in bytes
1584 # @inject-error:    #optional array of error injection descriptions
1586 # @set-state:       #optional array of state-change descriptions
1588 # Since: 2.0
1590 { 'type': 'BlockdevOptionsBlkdebug',
1591   'data': { 'image': 'BlockdevRef',
1592             '*config': 'str',
1593             '*align': 'int',
1594             '*inject-error': ['BlkdebugInjectErrorOptions'],
1595             '*set-state': ['BlkdebugSetStateOptions'] } }
1598 # @BlockdevOptionsBlkverify
1600 # Driver specific block device options for blkverify.
1602 # @test:    block device to be tested
1604 # @raw:     raw image used for verification
1606 # Since: 2.0
1608 { 'type': 'BlockdevOptionsBlkverify',
1609   'data': { 'test': 'BlockdevRef',
1610             'raw': 'BlockdevRef' } }
1613 # @QuorumReadPattern
1615 # An enumeration of quorum read patterns.
1617 # @quorum: read all the children and do a quorum vote on reads
1619 # @fifo: read only from the first child that has not failed
1621 # Since: 2.2
1623 { 'enum': 'QuorumReadPattern', 'data': [ 'quorum', 'fifo' ] }
1626 # @BlockdevOptionsQuorum
1628 # Driver specific block device options for Quorum
1630 # @blkverify:      #optional true if the driver must print content mismatch
1631 #                  set to false by default
1633 # @children:       the children block devices to use
1635 # @vote-threshold: the vote limit under which a read will fail
1637 # @rewrite-corrupted: #optional rewrite corrupted data when quorum is reached
1638 #                     (Since 2.1)
1640 # @read-pattern: #optional choose read pattern and set to quorum by default
1641 #                (Since 2.2)
1643 # Since: 2.0
1645 { 'type': 'BlockdevOptionsQuorum',
1646   'data': { '*blkverify': 'bool',
1647             'children': [ 'BlockdevRef' ],
1648             'vote-threshold': 'int',
1649             '*rewrite-corrupted': 'bool',
1650             '*read-pattern': 'QuorumReadPattern' } }
1653 # @BlockdevOptions
1655 # Options for creating a block device.
1657 # Since: 1.7
1659 { 'union': 'BlockdevOptions',
1660   'base': 'BlockdevOptionsBase',
1661   'discriminator': 'driver',
1662   'data': {
1663       'archipelago':'BlockdevOptionsArchipelago',
1664       'blkdebug':   'BlockdevOptionsBlkdebug',
1665       'blkverify':  'BlockdevOptionsBlkverify',
1666       'bochs':      'BlockdevOptionsGenericFormat',
1667       'cloop':      'BlockdevOptionsGenericFormat',
1668       'dmg':        'BlockdevOptionsGenericFormat',
1669       'file':       'BlockdevOptionsFile',
1670       'ftp':        'BlockdevOptionsFile',
1671       'ftps':       'BlockdevOptionsFile',
1672 # TODO gluster: Wait for structured options
1673       'host_cdrom': 'BlockdevOptionsFile',
1674       'host_device':'BlockdevOptionsFile',
1675       'host_floppy':'BlockdevOptionsFile',
1676       'http':       'BlockdevOptionsFile',
1677       'https':      'BlockdevOptionsFile',
1678 # TODO iscsi: Wait for structured options
1679 # TODO nbd: Should take InetSocketAddress for 'host'?
1680 # TODO nfs: Wait for structured options
1681       'null-aio':   'BlockdevOptionsNull',
1682       'null-co':    'BlockdevOptionsNull',
1683       'parallels':  'BlockdevOptionsGenericFormat',
1684       'qcow2':      'BlockdevOptionsQcow2',
1685       'qcow':       'BlockdevOptionsGenericCOWFormat',
1686       'qed':        'BlockdevOptionsGenericCOWFormat',
1687       'quorum':     'BlockdevOptionsQuorum',
1688       'raw':        'BlockdevOptionsGenericFormat',
1689 # TODO rbd: Wait for structured options
1690 # TODO sheepdog: Wait for structured options
1691 # TODO ssh: Should take InetSocketAddress for 'host'?
1692       'tftp':       'BlockdevOptionsFile',
1693       'vdi':        'BlockdevOptionsGenericFormat',
1694       'vhdx':       'BlockdevOptionsGenericFormat',
1695       'vmdk':       'BlockdevOptionsGenericCOWFormat',
1696       'vpc':        'BlockdevOptionsGenericFormat',
1697       'vvfat':      'BlockdevOptionsVVFAT'
1698   } }
1701 # @BlockdevRef
1703 # Reference to a block device.
1705 # @definition:      defines a new block device inline
1706 # @reference:       references the ID of an existing block device. An
1707 #                   empty string means that no block device should be
1708 #                   referenced.
1710 # Since: 1.7
1712 { 'union': 'BlockdevRef',
1713   'discriminator': {},
1714   'data': { 'definition': 'BlockdevOptions',
1715             'reference': 'str' } }
1718 # @blockdev-add:
1720 # Creates a new block device.
1722 # @options: block device options for the new device
1724 # Since: 1.7
1726 { 'command': 'blockdev-add', 'data': { 'options': 'BlockdevOptions' } }
1730 # @BlockErrorAction
1732 # An enumeration of action that has been taken when a DISK I/O occurs
1734 # @ignore: error has been ignored
1736 # @report: error has been reported to the device
1738 # @stop: error caused VM to be stopped
1740 # Since: 2.1
1742 { 'enum': 'BlockErrorAction',
1743   'data': [ 'ignore', 'report', 'stop' ] }
1747 # @BLOCK_IMAGE_CORRUPTED
1749 # Emitted when a corruption has been detected in a disk image
1751 # @device: device name
1753 # @msg: informative message for human consumption, such as the kind of
1754 #       corruption being detected. It should not be parsed by machine as it is
1755 #       not guaranteed to be stable
1757 # @offset: #optional, if the corruption resulted from an image access, this is
1758 #          the access offset into the image
1760 # @size: #optional, if the corruption resulted from an image access, this is
1761 #        the access size
1763 # fatal: if set, the image is marked corrupt and therefore unusable after this
1764 #        event and must be repaired (Since 2.2; before, every
1765 #        BLOCK_IMAGE_CORRUPTED event was fatal)
1767 # Since: 1.7
1769 { 'event': 'BLOCK_IMAGE_CORRUPTED',
1770   'data': { 'device' : 'str',
1771             'msg'    : 'str',
1772             '*offset': 'int',
1773             '*size'  : 'int',
1774             'fatal'  : 'bool' } }
1777 # @BLOCK_IO_ERROR
1779 # Emitted when a disk I/O error occurs
1781 # @device: device name
1783 # @operation: I/O operation
1785 # @action: action that has been taken
1787 # @nospace: #optional true if I/O error was caused due to a no-space
1788 #           condition. This key is only present if query-block's
1789 #           io-status is present, please see query-block documentation
1790 #           for more information (since: 2.2)
1792 # @reason: human readable string describing the error cause.
1793 #          (This field is a debugging aid for humans, it should not
1794 #           be parsed by applications) (since: 2.2)
1796 # Note: If action is "stop", a STOP event will eventually follow the
1797 # BLOCK_IO_ERROR event
1799 # Since: 0.13.0
1801 { 'event': 'BLOCK_IO_ERROR',
1802   'data': { 'device': 'str', 'operation': 'IoOperationType',
1803             'action': 'BlockErrorAction', '*nospace': 'bool',
1804             'reason': 'str' } }
1807 # @BLOCK_JOB_COMPLETED
1809 # Emitted when a block job has completed
1811 # @type: job type
1813 # @device: device name
1815 # @len: maximum progress value
1817 # @offset: current progress value. On success this is equal to len.
1818 #          On failure this is less than len
1820 # @speed: rate limit, bytes per second
1822 # @error: #optional, error message. Only present on failure. This field
1823 #         contains a human-readable error message. There are no semantics
1824 #         other than that streaming has failed and clients should not try to
1825 #         interpret the error string
1827 # Since: 1.1
1829 { 'event': 'BLOCK_JOB_COMPLETED',
1830   'data': { 'type'  : 'BlockJobType',
1831             'device': 'str',
1832             'len'   : 'int',
1833             'offset': 'int',
1834             'speed' : 'int',
1835             '*error': 'str' } }
1838 # @BLOCK_JOB_CANCELLED
1840 # Emitted when a block job has been cancelled
1842 # @type: job type
1844 # @device: device name
1846 # @len: maximum progress value
1848 # @offset: current progress value. On success this is equal to len.
1849 #          On failure this is less than len
1851 # @speed: rate limit, bytes per second
1853 # Since: 1.1
1855 { 'event': 'BLOCK_JOB_CANCELLED',
1856   'data': { 'type'  : 'BlockJobType',
1857             'device': 'str',
1858             'len'   : 'int',
1859             'offset': 'int',
1860             'speed' : 'int' } }
1863 # @BLOCK_JOB_ERROR
1865 # Emitted when a block job encounters an error
1867 # @device: device name
1869 # @operation: I/O operation
1871 # @action: action that has been taken
1873 # Since: 1.3
1875 { 'event': 'BLOCK_JOB_ERROR',
1876   'data': { 'device'   : 'str',
1877             'operation': 'IoOperationType',
1878             'action'   : 'BlockErrorAction' } }
1881 # @BLOCK_JOB_READY
1883 # Emitted when a block job is ready to complete
1885 # @type: job type
1887 # @device: device name
1889 # @len: maximum progress value
1891 # @offset: current progress value. On success this is equal to len.
1892 #          On failure this is less than len
1894 # @speed: rate limit, bytes per second
1896 # Note: The "ready to complete" status is always reset by a @BLOCK_JOB_ERROR
1897 # event
1899 # Since: 1.3
1901 { 'event': 'BLOCK_JOB_READY',
1902   'data': { 'type'  : 'BlockJobType',
1903             'device': 'str',
1904             'len'   : 'int',
1905             'offset': 'int',
1906             'speed' : 'int' } }
1908 # @PreallocMode
1910 # Preallocation mode of QEMU image file
1912 # @off: no preallocation
1913 # @metadata: preallocate only for metadata
1914 # @falloc: like @full preallocation but allocate disk space by
1915 #          posix_fallocate() rather than writing zeros.
1916 # @full: preallocate all data by writing zeros to device to ensure disk
1917 #        space is really available. @full preallocation also sets up
1918 #        metadata correctly.
1920 # Since 2.2
1922 { 'enum': 'PreallocMode',
1923   'data': [ 'off', 'metadata', 'falloc', 'full' ] }
1926 # @BLOCK_WRITE_THRESHOLD
1928 # Emitted when writes on block device reaches or exceeds the
1929 # configured write threshold. For thin-provisioned devices, this
1930 # means the device should be extended to avoid pausing for
1931 # disk exhaustion.
1932 # The event is one shot. Once triggered, it needs to be
1933 # re-registered with another block-set-threshold command.
1935 # @node-name: graph node name on which the threshold was exceeded.
1937 # @amount-exceeded: amount of data which exceeded the threshold, in bytes.
1939 # @write-threshold: last configured threshold, in bytes.
1941 # Since: 2.3
1943 { 'event': 'BLOCK_WRITE_THRESHOLD',
1944   'data': { 'node-name': 'str',
1945             'amount-exceeded': 'uint64',
1946             'write-threshold': 'uint64' } }
1949 # @block-set-write-threshold
1951 # Change the write threshold for a block drive. An event will be delivered
1952 # if a write to this block drive crosses the configured threshold.
1953 # This is useful to transparently resize thin-provisioned drives without
1954 # the guest OS noticing.
1956 # @node-name: graph node name on which the threshold must be set.
1958 # @write-threshold: configured threshold for the block device, bytes.
1959 #                   Use 0 to disable the threshold.
1961 # Returns: Nothing on success
1962 #          If @node name is not found on the block device graph,
1963 #          DeviceNotFound
1965 # Since: 2.3
1967 { 'command': 'block-set-write-threshold',
1968   'data': { 'node-name': 'str', 'write-threshold': 'uint64' } }