Merge remote-tracking branch 'remotes/agraf/tags/signed-ppc-for-upstream' into staging
[qemu.git] / qapi / block-core.json
blob6e8db15861dae24c4df7f98c709b389e7c69e128
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 # @device: #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 # @blockdev-snapshot-sync
708 # Generates a synchronous snapshot of a block device.
710 # For the arguments, see the documentation of BlockdevSnapshot.
712 # Returns: nothing on success
713 #          If @device is not a valid block device, DeviceNotFound
715 # Since 0.14.0
717 { 'command': 'blockdev-snapshot-sync',
718   'data': 'BlockdevSnapshot' }
721 # @change-backing-file
723 # Change the backing file in the image file metadata.  This does not
724 # cause QEMU to reopen the image file to reparse the backing filename
725 # (it may, however, perform a reopen to change permissions from
726 # r/o -> r/w -> r/o, if needed). The new backing file string is written
727 # into the image file metadata, and the QEMU internal strings are
728 # updated.
730 # @image-node-name: The name of the block driver state node of the
731 #                   image to modify.
733 # @device:          The name of the device that owns image-node-name.
735 # @backing-file:    The string to write as the backing file.  This
736 #                   string is not validated, so care should be taken
737 #                   when specifying the string or the image chain may
738 #                   not be able to be reopened again.
740 # Since: 2.1
742 { 'command': 'change-backing-file',
743   'data': { 'device': 'str', 'image-node-name': 'str',
744             'backing-file': 'str' } }
747 # @block-commit
749 # Live commit of data from overlay image nodes into backing nodes - i.e.,
750 # writes data between 'top' and 'base' into 'base'.
752 # @device:  the name of the device
754 # @base:   #optional The file name of the backing image to write data into.
755 #                    If not specified, this is the deepest backing image
757 # @top:    #optional The file name of the backing image within the image chain,
758 #                    which contains the topmost data to be committed down. If
759 #                    not specified, this is the active layer.
761 # @backing-file:  #optional The backing file string to write into the overlay
762 #                           image of 'top'.  If 'top' is the active layer,
763 #                           specifying a backing file string is an error. This
764 #                           filename is not validated.
766 #                           If a pathname string is such that it cannot be
767 #                           resolved by QEMU, that means that subsequent QMP or
768 #                           HMP commands must use node-names for the image in
769 #                           question, as filename lookup methods will fail.
771 #                           If not specified, QEMU will automatically determine
772 #                           the backing file string to use, or error out if
773 #                           there is no obvious choice. Care should be taken
774 #                           when specifying the string, to specify a valid
775 #                           filename or protocol.
776 #                           (Since 2.1)
778 #                    If top == base, that is an error.
779 #                    If top == active, the job will not be completed by itself,
780 #                    user needs to complete the job with the block-job-complete
781 #                    command after getting the ready event. (Since 2.0)
783 #                    If the base image is smaller than top, then the base image
784 #                    will be resized to be the same size as top.  If top is
785 #                    smaller than the base image, the base will not be
786 #                    truncated.  If you want the base image size to match the
787 #                    size of the smaller top, you can safely truncate it
788 #                    yourself once the commit operation successfully completes.
790 # @speed:  #optional the maximum speed, in bytes per second
792 # Returns: Nothing on success
793 #          If commit or stream is already active on this device, DeviceInUse
794 #          If @device does not exist, DeviceNotFound
795 #          If image commit is not supported by this device, NotSupported
796 #          If @base or @top is invalid, a generic error is returned
797 #          If @speed is invalid, InvalidParameter
799 # Since: 1.3
802 { 'command': 'block-commit',
803   'data': { 'device': 'str', '*base': 'str', '*top': 'str',
804             '*backing-file': 'str', '*speed': 'int' } }
807 # @drive-backup
809 # Start a point-in-time copy of a block device to a new destination.  The
810 # status of ongoing drive-backup operations can be checked with
811 # query-block-jobs where the BlockJobInfo.type field has the value 'backup'.
812 # The operation can be stopped before it has completed using the
813 # block-job-cancel command.
815 # For the arguments, see the documentation of DriveBackup.
817 # Returns: nothing on success
818 #          If @device is not a valid block device, DeviceNotFound
820 # Since 1.6
822 { 'command': 'drive-backup', 'data': 'DriveBackup' }
825 # @query-named-block-nodes
827 # Get the named block driver list
829 # Returns: the list of BlockDeviceInfo
831 # Since 2.0
833 { 'command': 'query-named-block-nodes', 'returns': [ 'BlockDeviceInfo' ] }
836 # @drive-mirror
838 # Start mirroring a block device's writes to a new destination.
840 # @device:  the name of the device whose writes should be mirrored.
842 # @target: the target of the new image. If the file exists, or if it
843 #          is a device, the existing file/device will be used as the new
844 #          destination.  If it does not exist, a new file will be created.
846 # @format: #optional the format of the new destination, default is to
847 #          probe if @mode is 'existing', else the format of the source
849 # @node-name: #optional the new block driver state node name in the graph
850 #             (Since 2.1)
852 # @replaces: #optional with sync=full graph node name to be replaced by the new
853 #            image when a whole image copy is done. This can be used to repair
854 #            broken Quorum files. (Since 2.1)
856 # @mode: #optional whether and how QEMU should create a new image, default is
857 #        'absolute-paths'.
859 # @speed:  #optional the maximum speed, in bytes per second
861 # @sync: what parts of the disk image should be copied to the destination
862 #        (all the disk, only the sectors allocated in the topmost image, or
863 #        only new I/O).
865 # @granularity: #optional granularity of the dirty bitmap, default is 64K
866 #               if the image format doesn't have clusters, 4K if the clusters
867 #               are smaller than that, else the cluster size.  Must be a
868 #               power of 2 between 512 and 64M (since 1.4).
870 # @buf-size: #optional maximum amount of data in flight from source to
871 #            target (since 1.4).
873 # @on-source-error: #optional the action to take on an error on the source,
874 #                   default 'report'.  'stop' and 'enospc' can only be used
875 #                   if the block device supports io-status (see BlockInfo).
877 # @on-target-error: #optional the action to take on an error on the target,
878 #                   default 'report' (no limitations, since this applies to
879 #                   a different block device than @device).
881 # Returns: nothing on success
882 #          If @device is not a valid block device, DeviceNotFound
884 # Since 1.3
886 { 'command': 'drive-mirror',
887   'data': { 'device': 'str', 'target': 'str', '*format': 'str',
888             '*node-name': 'str', '*replaces': 'str',
889             'sync': 'MirrorSyncMode', '*mode': 'NewImageMode',
890             '*speed': 'int', '*granularity': 'uint32',
891             '*buf-size': 'int', '*on-source-error': 'BlockdevOnError',
892             '*on-target-error': 'BlockdevOnError' } }
895 # @block_set_io_throttle:
897 # Change I/O throttle limits for a block drive.
899 # @device: The name of the device
901 # @bps: total throughput limit in bytes per second
903 # @bps_rd: read throughput limit in bytes per second
905 # @bps_wr: write throughput limit in bytes per second
907 # @iops: total I/O operations per second
909 # @ops_rd: read I/O operations per second
911 # @iops_wr: write I/O operations per second
913 # @bps_max: #optional total max in bytes (Since 1.7)
915 # @bps_rd_max: #optional read max in bytes (Since 1.7)
917 # @bps_wr_max: #optional write max in bytes (Since 1.7)
919 # @iops_max: #optional total I/O operations max (Since 1.7)
921 # @iops_rd_max: #optional read I/O operations max (Since 1.7)
923 # @iops_wr_max: #optional write I/O operations max (Since 1.7)
925 # @iops_size: #optional an I/O size in bytes (Since 1.7)
927 # Returns: Nothing on success
928 #          If @device is not a valid block device, DeviceNotFound
930 # Since: 1.1
932 { 'command': 'block_set_io_throttle',
933   'data': { 'device': 'str', 'bps': 'int', 'bps_rd': 'int', 'bps_wr': 'int',
934             'iops': 'int', 'iops_rd': 'int', 'iops_wr': 'int',
935             '*bps_max': 'int', '*bps_rd_max': 'int',
936             '*bps_wr_max': 'int', '*iops_max': 'int',
937             '*iops_rd_max': 'int', '*iops_wr_max': 'int',
938             '*iops_size': 'int' } }
941 # @block-stream:
943 # Copy data from a backing file into a block device.
945 # The block streaming operation is performed in the background until the entire
946 # backing file has been copied.  This command returns immediately once streaming
947 # has started.  The status of ongoing block streaming operations can be checked
948 # with query-block-jobs.  The operation can be stopped before it has completed
949 # using the block-job-cancel command.
951 # If a base file is specified then sectors are not copied from that base file and
952 # its backing chain.  When streaming completes the image file will have the base
953 # file as its backing file.  This can be used to stream a subset of the backing
954 # file chain instead of flattening the entire image.
956 # On successful completion the image file is updated to drop the backing file
957 # and the BLOCK_JOB_COMPLETED event is emitted.
959 # @device: the device name
961 # @base:   #optional the common backing file name
963 # @backing-file: #optional The backing file string to write into the active
964 #                          layer. This filename is not validated.
966 #                          If a pathname string is such that it cannot be
967 #                          resolved by QEMU, that means that subsequent QMP or
968 #                          HMP commands must use node-names for the image in
969 #                          question, as filename lookup methods will fail.
971 #                          If not specified, QEMU will automatically determine
972 #                          the backing file string to use, or error out if there
973 #                          is no obvious choice.  Care should be taken when
974 #                          specifying the string, to specify a valid filename or
975 #                          protocol.
976 #                          (Since 2.1)
978 # @speed:  #optional the maximum speed, in bytes per second
980 # @on-error: #optional the action to take on an error (default report).
981 #            'stop' and 'enospc' can only be used if the block device
982 #            supports io-status (see BlockInfo).  Since 1.3.
984 # Returns: Nothing on success
985 #          If @device does not exist, DeviceNotFound
987 # Since: 1.1
989 { 'command': 'block-stream',
990   'data': { 'device': 'str', '*base': 'str', '*backing-file': 'str',
991             '*speed': 'int', '*on-error': 'BlockdevOnError' } }
994 # @block-job-set-speed:
996 # Set maximum speed for a background block operation.
998 # This command can only be issued when there is an active block job.
1000 # Throttling can be disabled by setting the speed to 0.
1002 # @device: the device name
1004 # @speed:  the maximum speed, in bytes per second, or 0 for unlimited.
1005 #          Defaults to 0.
1007 # Returns: Nothing on success
1008 #          If no background operation is active on this device, DeviceNotActive
1010 # Since: 1.1
1012 { 'command': 'block-job-set-speed',
1013   'data': { 'device': 'str', 'speed': 'int' } }
1016 # @block-job-cancel:
1018 # Stop an active background block operation.
1020 # This command returns immediately after marking the active background block
1021 # operation for cancellation.  It is an error to call this command if no
1022 # operation is in progress.
1024 # The operation will cancel as soon as possible and then emit the
1025 # BLOCK_JOB_CANCELLED event.  Before that happens the job is still visible when
1026 # enumerated using query-block-jobs.
1028 # For streaming, the image file retains its backing file unless the streaming
1029 # operation happens to complete just as it is being cancelled.  A new streaming
1030 # operation can be started at a later time to finish copying all data from the
1031 # backing file.
1033 # @device: the device name
1035 # @force: #optional whether to allow cancellation of a paused job (default
1036 #         false).  Since 1.3.
1038 # Returns: Nothing on success
1039 #          If no background operation is active on this device, DeviceNotActive
1041 # Since: 1.1
1043 { 'command': 'block-job-cancel', 'data': { 'device': 'str', '*force': 'bool' } }
1046 # @block-job-pause:
1048 # Pause an active background block operation.
1050 # This command returns immediately after marking the active background block
1051 # operation for pausing.  It is an error to call this command if no
1052 # operation is in progress.  Pausing an already paused job has no cumulative
1053 # effect; a single block-job-resume command will resume the job.
1055 # The operation will pause as soon as possible.  No event is emitted when
1056 # the operation is actually paused.  Cancelling a paused job automatically
1057 # resumes it.
1059 # @device: the device name
1061 # Returns: Nothing on success
1062 #          If no background operation is active on this device, DeviceNotActive
1064 # Since: 1.3
1066 { 'command': 'block-job-pause', 'data': { 'device': 'str' } }
1069 # @block-job-resume:
1071 # Resume an active background block operation.
1073 # This command returns immediately after resuming a paused background block
1074 # operation.  It is an error to call this command if no operation is in
1075 # progress.  Resuming an already running job is not an error.
1077 # This command also clears the error status of the job.
1079 # @device: the device name
1081 # Returns: Nothing on success
1082 #          If no background operation is active on this device, DeviceNotActive
1084 # Since: 1.3
1086 { 'command': 'block-job-resume', 'data': { 'device': 'str' } }
1089 # @block-job-complete:
1091 # Manually trigger completion of an active background block operation.  This
1092 # is supported for drive mirroring, where it also switches the device to
1093 # write to the target path only.  The ability to complete is signaled with
1094 # a BLOCK_JOB_READY event.
1096 # This command completes an active background block operation synchronously.
1097 # The ordering of this command's return with the BLOCK_JOB_COMPLETED event
1098 # is not defined.  Note that if an I/O error occurs during the processing of
1099 # this command: 1) the command itself will fail; 2) the error will be processed
1100 # according to the rerror/werror arguments that were specified when starting
1101 # the operation.
1103 # A cancelled or paused job cannot be completed.
1105 # @device: the device name
1107 # Returns: Nothing on success
1108 #          If no background operation is active on this device, DeviceNotActive
1110 # Since: 1.3
1112 { 'command': 'block-job-complete', 'data': { 'device': 'str' } }
1115 # @BlockdevDiscardOptions
1117 # Determines how to handle discard requests.
1119 # @ignore:      Ignore the request
1120 # @unmap:       Forward as an unmap request
1122 # Since: 1.7
1124 { 'enum': 'BlockdevDiscardOptions',
1125   'data': [ 'ignore', 'unmap' ] }
1128 # @BlockdevDetectZeroesOptions
1130 # Describes the operation mode for the automatic conversion of plain
1131 # zero writes by the OS to driver specific optimized zero write commands.
1133 # @off:      Disabled (default)
1134 # @on:       Enabled
1135 # @unmap:    Enabled and even try to unmap blocks if possible. This requires
1136 #            also that @BlockdevDiscardOptions is set to unmap for this device.
1138 # Since: 2.1
1140 { 'enum': 'BlockdevDetectZeroesOptions',
1141   'data': [ 'off', 'on', 'unmap' ] }
1144 # @BlockdevAioOptions
1146 # Selects the AIO backend to handle I/O requests
1148 # @threads:     Use qemu's thread pool
1149 # @native:      Use native AIO backend (only Linux and Windows)
1151 # Since: 1.7
1153 { 'enum': 'BlockdevAioOptions',
1154   'data': [ 'threads', 'native' ] }
1157 # @BlockdevCacheOptions
1159 # Includes cache-related options for block devices
1161 # @writeback:   #optional enables writeback mode for any caches (default: true)
1162 # @direct:      #optional enables use of O_DIRECT (bypass the host page cache;
1163 #               default: false)
1164 # @no-flush:    #optional ignore any flush requests for the device (default:
1165 #               false)
1167 # Since: 1.7
1169 { 'type': 'BlockdevCacheOptions',
1170   'data': { '*writeback': 'bool',
1171             '*direct': 'bool',
1172             '*no-flush': 'bool' } }
1175 # @BlockdevDriver
1177 # Drivers that are supported in block device operations.
1179 # @host_device, @host_cdrom, @host_floppy: Since 2.1
1181 # Since: 2.0
1183 { 'enum': 'BlockdevDriver',
1184   'data': [ 'archipelago', 'blkdebug', 'blkverify', 'bochs', 'cloop',
1185             'dmg', 'file', 'ftp', 'ftps', 'host_cdrom', 'host_device',
1186             'host_floppy', 'http', 'https', 'null-aio', 'null-co', 'parallels',
1187             'qcow', 'qcow2', 'qed', 'quorum', 'raw', 'tftp', 'vdi', 'vhdx',
1188             'vmdk', 'vpc', 'vvfat' ] }
1191 # @BlockdevOptionsBase
1193 # Options that are available for all block devices, independent of the block
1194 # driver.
1196 # @driver:        block driver name
1197 # @id:            #optional id by which the new block device can be referred to.
1198 #                 This is a required option on the top level of blockdev-add, and
1199 #                 currently not allowed on any other level.
1200 # @node-name:     #optional the name of a block driver state node (Since 2.0)
1201 # @discard:       #optional discard-related options (default: ignore)
1202 # @cache:         #optional cache-related options
1203 # @aio:           #optional AIO backend (default: threads)
1204 # @rerror:        #optional how to handle read errors on the device
1205 #                 (default: report)
1206 # @werror:        #optional how to handle write errors on the device
1207 #                 (default: enospc)
1208 # @read-only:     #optional whether the block device should be read-only
1209 #                 (default: false)
1210 # @detect-zeroes: #optional detect and optimize zero writes (Since 2.1)
1211 #                 (default: off)
1213 # Since: 1.7
1215 { 'type': 'BlockdevOptionsBase',
1216   'data': { 'driver': 'BlockdevDriver',
1217             '*id': 'str',
1218             '*node-name': 'str',
1219             '*discard': 'BlockdevDiscardOptions',
1220             '*cache': 'BlockdevCacheOptions',
1221             '*aio': 'BlockdevAioOptions',
1222             '*rerror': 'BlockdevOnError',
1223             '*werror': 'BlockdevOnError',
1224             '*read-only': 'bool',
1225             '*detect-zeroes': 'BlockdevDetectZeroesOptions' } }
1228 # @BlockdevOptionsFile
1230 # Driver specific block device options for the file backend and similar
1231 # protocols.
1233 # @filename:    path to the image file
1235 # Since: 1.7
1237 { 'type': 'BlockdevOptionsFile',
1238   'data': { 'filename': 'str' } }
1241 # @BlockdevOptionsNull
1243 # Driver specific block device options for the null backend.
1245 # @size:    #optional size of the device in bytes.
1247 # Since: 2.2
1249 { 'type': 'BlockdevOptionsNull',
1250   'data': { '*size': 'int' } }
1253 # @BlockdevOptionsVVFAT
1255 # Driver specific block device options for the vvfat protocol.
1257 # @dir:         directory to be exported as FAT image
1258 # @fat-type:    #optional FAT type: 12, 16 or 32
1259 # @floppy:      #optional whether to export a floppy image (true) or
1260 #               partitioned hard disk (false; default)
1261 # @rw:          #optional whether to allow write operations (default: false)
1263 # Since: 1.7
1265 { 'type': 'BlockdevOptionsVVFAT',
1266   'data': { 'dir': 'str', '*fat-type': 'int', '*floppy': 'bool',
1267             '*rw': 'bool' } }
1270 # @BlockdevOptionsGenericFormat
1272 # Driver specific block device options for image format that have no option
1273 # besides their data source.
1275 # @file:        reference to or definition of the data source block device
1277 # Since: 1.7
1279 { 'type': 'BlockdevOptionsGenericFormat',
1280   'data': { 'file': 'BlockdevRef' } }
1283 # @BlockdevOptionsGenericCOWFormat
1285 # Driver specific block device options for image format that have no option
1286 # besides their data source and an optional backing file.
1288 # @backing:     #optional reference to or definition of the backing file block
1289 #               device (if missing, taken from the image file content). It is
1290 #               allowed to pass an empty string here in order to disable the
1291 #               default backing file.
1293 # Since: 1.7
1295 { 'type': 'BlockdevOptionsGenericCOWFormat',
1296   'base': 'BlockdevOptionsGenericFormat',
1297   'data': { '*backing': 'BlockdevRef' } }
1300 # @Qcow2OverlapCheckMode
1302 # General overlap check modes.
1304 # @none:        Do not perform any checks
1306 # @constant:    Perform only checks which can be done in constant time and
1307 #               without reading anything from disk
1309 # @cached:      Perform only checks which can be done without reading anything
1310 #               from disk
1312 # @all:         Perform all available overlap checks
1314 # Since: 2.2
1316 { 'enum': 'Qcow2OverlapCheckMode',
1317   'data': [ 'none', 'constant', 'cached', 'all' ] }
1320 # @Qcow2OverlapCheckFlags
1322 # Structure of flags for each metadata structure. Setting a field to 'true'
1323 # makes qemu guard that structure against unintended overwriting. The default
1324 # value is chosen according to the template given.
1326 # @template: Specifies a template mode which can be adjusted using the other
1327 #            flags, defaults to 'cached'
1329 # Since: 2.2
1331 { 'type': 'Qcow2OverlapCheckFlags',
1332   'data': { '*template':       'Qcow2OverlapCheckMode',
1333             '*main-header':    'bool',
1334             '*active-l1':      'bool',
1335             '*active-l2':      'bool',
1336             '*refcount-table': 'bool',
1337             '*refcount-block': 'bool',
1338             '*snapshot-table': 'bool',
1339             '*inactive-l1':    'bool',
1340             '*inactive-l2':    'bool' } }
1343 # @Qcow2OverlapChecks
1345 # Specifies which metadata structures should be guarded against unintended
1346 # overwriting.
1348 # @flags:   set of flags for separate specification of each metadata structure
1349 #           type
1351 # @mode:    named mode which chooses a specific set of flags
1353 # Since: 2.2
1355 { 'union': 'Qcow2OverlapChecks',
1356   'discriminator': {},
1357   'data': { 'flags': 'Qcow2OverlapCheckFlags',
1358             'mode':  'Qcow2OverlapCheckMode' } }
1361 # @BlockdevOptionsQcow2
1363 # Driver specific block device options for qcow2.
1365 # @lazy-refcounts:        #optional whether to enable the lazy refcounts
1366 #                         feature (default is taken from the image file)
1368 # @pass-discard-request:  #optional whether discard requests to the qcow2
1369 #                         device should be forwarded to the data source
1371 # @pass-discard-snapshot: #optional whether discard requests for the data source
1372 #                         should be issued when a snapshot operation (e.g.
1373 #                         deleting a snapshot) frees clusters in the qcow2 file
1375 # @pass-discard-other:    #optional whether discard requests for the data source
1376 #                         should be issued on other occasions where a cluster
1377 #                         gets freed
1379 # @overlap-check:         #optional which overlap checks to perform for writes
1380 #                         to the image, defaults to 'cached' (since 2.2)
1382 # @cache-size:            #optional the maximum total size of the L2 table and
1383 #                         refcount block caches in bytes (since 2.2)
1385 # @l2-cache-size:         #optional the maximum size of the L2 table cache in
1386 #                         bytes (since 2.2)
1388 # @refcount-cache-size:   #optional the maximum size of the refcount block cache
1389 #                         in bytes (since 2.2)
1391 # Since: 1.7
1393 { 'type': 'BlockdevOptionsQcow2',
1394   'base': 'BlockdevOptionsGenericCOWFormat',
1395   'data': { '*lazy-refcounts': 'bool',
1396             '*pass-discard-request': 'bool',
1397             '*pass-discard-snapshot': 'bool',
1398             '*pass-discard-other': 'bool',
1399             '*overlap-check': 'Qcow2OverlapChecks',
1400             '*cache-size': 'int',
1401             '*l2-cache-size': 'int',
1402             '*refcount-cache-size': 'int' } }
1406 # @BlockdevOptionsArchipelago
1408 # Driver specific block device options for Archipelago.
1410 # @volume:              Name of the Archipelago volume image
1412 # @mport:               #optional The port number on which mapperd is
1413 #                       listening. This is optional
1414 #                       and if not specified, QEMU will make Archipelago
1415 #                       use the default port (1001).
1417 # @vport:               #optional The port number on which vlmcd is
1418 #                       listening. This is optional
1419 #                       and if not specified, QEMU will make Archipelago
1420 #                       use the default port (501).
1422 # @segment:             #optional The name of the shared memory segment
1423 #                       Archipelago stack is using. This is optional
1424 #                       and if not specified, QEMU will make Archipelago
1425 #                       use the default value, 'archipelago'.
1426 # Since: 2.2
1428 { 'type': 'BlockdevOptionsArchipelago',
1429   'data': { 'volume': 'str',
1430             '*mport': 'int',
1431             '*vport': 'int',
1432             '*segment': 'str' } }
1436 # @BlkdebugEvent
1438 # Trigger events supported by blkdebug.
1440 { 'enum': 'BlkdebugEvent',
1441   'data': [ 'l1_update', 'l1_grow.alloc_table', 'l1_grow.write_table',
1442             'l1_grow.activate_table', 'l2_load', 'l2_update',
1443             'l2_update_compressed', 'l2_alloc.cow_read', 'l2_alloc.write',
1444             'read_aio', 'read_backing_aio', 'read_compressed', 'write_aio',
1445             'write_compressed', 'vmstate_load', 'vmstate_save', 'cow_read',
1446             'cow_write', 'reftable_load', 'reftable_grow', 'reftable_update',
1447             'refblock_load', 'refblock_update', 'refblock_update_part',
1448             'refblock_alloc', 'refblock_alloc.hookup', 'refblock_alloc.write',
1449             'refblock_alloc.write_blocks', 'refblock_alloc.write_table',
1450             'refblock_alloc.switch_table', 'cluster_alloc',
1451             'cluster_alloc_bytes', 'cluster_free', 'flush_to_os',
1452             'flush_to_disk', 'pwritev_rmw.head', 'pwritev_rmw.after_head',
1453             'pwritev_rmw.tail', 'pwritev_rmw.after_tail', 'pwritev',
1454             'pwritev_zero', 'pwritev_done', 'empty_image_prepare' ] }
1457 # @BlkdebugInjectErrorOptions
1459 # Describes a single error injection for blkdebug.
1461 # @event:       trigger event
1463 # @state:       #optional the state identifier blkdebug needs to be in to
1464 #               actually trigger the event; defaults to "any"
1466 # @errno:       #optional error identifier (errno) to be returned; defaults to
1467 #               EIO
1469 # @sector:      #optional specifies the sector index which has to be affected
1470 #               in order to actually trigger the event; defaults to "any
1471 #               sector"
1473 # @once:        #optional disables further events after this one has been
1474 #               triggered; defaults to false
1476 # @immediately: #optional fail immediately; defaults to false
1478 # Since: 2.0
1480 { 'type': 'BlkdebugInjectErrorOptions',
1481   'data': { 'event': 'BlkdebugEvent',
1482             '*state': 'int',
1483             '*errno': 'int',
1484             '*sector': 'int',
1485             '*once': 'bool',
1486             '*immediately': 'bool' } }
1489 # @BlkdebugSetStateOptions
1491 # Describes a single state-change event for blkdebug.
1493 # @event:       trigger event
1495 # @state:       #optional the current state identifier blkdebug needs to be in;
1496 #               defaults to "any"
1498 # @new_state:   the state identifier blkdebug is supposed to assume if
1499 #               this event is triggered
1501 # Since: 2.0
1503 { 'type': 'BlkdebugSetStateOptions',
1504   'data': { 'event': 'BlkdebugEvent',
1505             '*state': 'int',
1506             'new_state': 'int' } }
1509 # @BlockdevOptionsBlkdebug
1511 # Driver specific block device options for blkdebug.
1513 # @image:           underlying raw block device (or image file)
1515 # @config:          #optional filename of the configuration file
1517 # @align:           #optional required alignment for requests in bytes
1519 # @inject-error:    #optional array of error injection descriptions
1521 # @set-state:       #optional array of state-change descriptions
1523 # Since: 2.0
1525 { 'type': 'BlockdevOptionsBlkdebug',
1526   'data': { 'image': 'BlockdevRef',
1527             '*config': 'str',
1528             '*align': 'int',
1529             '*inject-error': ['BlkdebugInjectErrorOptions'],
1530             '*set-state': ['BlkdebugSetStateOptions'] } }
1533 # @BlockdevOptionsBlkverify
1535 # Driver specific block device options for blkverify.
1537 # @test:    block device to be tested
1539 # @raw:     raw image used for verification
1541 # Since: 2.0
1543 { 'type': 'BlockdevOptionsBlkverify',
1544   'data': { 'test': 'BlockdevRef',
1545             'raw': 'BlockdevRef' } }
1548 # @QuorumReadPattern
1550 # An enumeration of quorum read patterns.
1552 # @quorum: read all the children and do a quorum vote on reads
1554 # @fifo: read only from the first child that has not failed
1556 # Since: 2.2
1558 { 'enum': 'QuorumReadPattern', 'data': [ 'quorum', 'fifo' ] }
1561 # @BlockdevOptionsQuorum
1563 # Driver specific block device options for Quorum
1565 # @blkverify:      #optional true if the driver must print content mismatch
1566 #                  set to false by default
1568 # @children:       the children block devices to use
1570 # @vote-threshold: the vote limit under which a read will fail
1572 # @rewrite-corrupted: #optional rewrite corrupted data when quorum is reached
1573 #                     (Since 2.1)
1575 # @read-pattern: #optional choose read pattern and set to quorum by default
1576 #                (Since 2.2)
1578 # Since: 2.0
1580 { 'type': 'BlockdevOptionsQuorum',
1581   'data': { '*blkverify': 'bool',
1582             'children': [ 'BlockdevRef' ],
1583             'vote-threshold': 'int',
1584             '*rewrite-corrupted': 'bool',
1585             '*read-pattern': 'QuorumReadPattern' } }
1588 # @BlockdevOptions
1590 # Options for creating a block device.
1592 # Since: 1.7
1594 { 'union': 'BlockdevOptions',
1595   'base': 'BlockdevOptionsBase',
1596   'discriminator': 'driver',
1597   'data': {
1598       'archipelago':'BlockdevOptionsArchipelago',
1599       'blkdebug':   'BlockdevOptionsBlkdebug',
1600       'blkverify':  'BlockdevOptionsBlkverify',
1601       'bochs':      'BlockdevOptionsGenericFormat',
1602       'cloop':      'BlockdevOptionsGenericFormat',
1603       'dmg':        'BlockdevOptionsGenericFormat',
1604       'file':       'BlockdevOptionsFile',
1605       'ftp':        'BlockdevOptionsFile',
1606       'ftps':       'BlockdevOptionsFile',
1607 # TODO gluster: Wait for structured options
1608       'host_cdrom': 'BlockdevOptionsFile',
1609       'host_device':'BlockdevOptionsFile',
1610       'host_floppy':'BlockdevOptionsFile',
1611       'http':       'BlockdevOptionsFile',
1612       'https':      'BlockdevOptionsFile',
1613 # TODO iscsi: Wait for structured options
1614 # TODO nbd: Should take InetSocketAddress for 'host'?
1615 # TODO nfs: Wait for structured options
1616       'null-aio':   'BlockdevOptionsNull',
1617       'null-co':    'BlockdevOptionsNull',
1618       'parallels':  'BlockdevOptionsGenericFormat',
1619       'qcow2':      'BlockdevOptionsQcow2',
1620       'qcow':       'BlockdevOptionsGenericCOWFormat',
1621       'qed':        'BlockdevOptionsGenericCOWFormat',
1622       'quorum':     'BlockdevOptionsQuorum',
1623       'raw':        'BlockdevOptionsGenericFormat',
1624 # TODO rbd: Wait for structured options
1625 # TODO sheepdog: Wait for structured options
1626 # TODO ssh: Should take InetSocketAddress for 'host'?
1627       'tftp':       'BlockdevOptionsFile',
1628       'vdi':        'BlockdevOptionsGenericFormat',
1629       'vhdx':       'BlockdevOptionsGenericFormat',
1630       'vmdk':       'BlockdevOptionsGenericCOWFormat',
1631       'vpc':        'BlockdevOptionsGenericFormat',
1632       'vvfat':      'BlockdevOptionsVVFAT'
1633   } }
1636 # @BlockdevRef
1638 # Reference to a block device.
1640 # @definition:      defines a new block device inline
1641 # @reference:       references the ID of an existing block device. An
1642 #                   empty string means that no block device should be
1643 #                   referenced.
1645 # Since: 1.7
1647 { 'union': 'BlockdevRef',
1648   'discriminator': {},
1649   'data': { 'definition': 'BlockdevOptions',
1650             'reference': 'str' } }
1653 # @blockdev-add:
1655 # Creates a new block device.
1657 # @options: block device options for the new device
1659 # Since: 1.7
1661 { 'command': 'blockdev-add', 'data': { 'options': 'BlockdevOptions' } }
1665 # @BlockErrorAction
1667 # An enumeration of action that has been taken when a DISK I/O occurs
1669 # @ignore: error has been ignored
1671 # @report: error has been reported to the device
1673 # @stop: error caused VM to be stopped
1675 # Since: 2.1
1677 { 'enum': 'BlockErrorAction',
1678   'data': [ 'ignore', 'report', 'stop' ] }
1682 # @BLOCK_IMAGE_CORRUPTED
1684 # Emitted when a corruption has been detected in a disk image
1686 # @device: device name
1688 # @msg: informative message for human consumption, such as the kind of
1689 #       corruption being detected. It should not be parsed by machine as it is
1690 #       not guaranteed to be stable
1692 # @offset: #optional, if the corruption resulted from an image access, this is
1693 #          the access offset into the image
1695 # @size: #optional, if the corruption resulted from an image access, this is
1696 #        the access size
1698 # fatal: if set, the image is marked corrupt and therefore unusable after this
1699 #        event and must be repaired (Since 2.2; before, every
1700 #        BLOCK_IMAGE_CORRUPTED event was fatal)
1702 # Since: 1.7
1704 { 'event': 'BLOCK_IMAGE_CORRUPTED',
1705   'data': { 'device' : 'str',
1706             'msg'    : 'str',
1707             '*offset': 'int',
1708             '*size'  : 'int',
1709             'fatal'  : 'bool' } }
1712 # @BLOCK_IO_ERROR
1714 # Emitted when a disk I/O error occurs
1716 # @device: device name
1718 # @operation: I/O operation
1720 # @action: action that has been taken
1722 # @nospace: #optional true if I/O error was caused due to a no-space
1723 #           condition. This key is only present if query-block's
1724 #           io-status is present, please see query-block documentation
1725 #           for more information (since: 2.2)
1727 # @reason: human readable string describing the error cause.
1728 #          (This field is a debugging aid for humans, it should not
1729 #           be parsed by applications) (since: 2.2)
1731 # Note: If action is "stop", a STOP event will eventually follow the
1732 # BLOCK_IO_ERROR event
1734 # Since: 0.13.0
1736 { 'event': 'BLOCK_IO_ERROR',
1737   'data': { 'device': 'str', 'operation': 'IoOperationType',
1738             'action': 'BlockErrorAction', '*nospace': 'bool',
1739             'reason': 'str' } }
1742 # @BLOCK_JOB_COMPLETED
1744 # Emitted when a block job has completed
1746 # @type: job type
1748 # @device: device name
1750 # @len: maximum progress value
1752 # @offset: current progress value. On success this is equal to len.
1753 #          On failure this is less than len
1755 # @speed: rate limit, bytes per second
1757 # @error: #optional, error message. Only present on failure. This field
1758 #         contains a human-readable error message. There are no semantics
1759 #         other than that streaming has failed and clients should not try to
1760 #         interpret the error string
1762 # Since: 1.1
1764 { 'event': 'BLOCK_JOB_COMPLETED',
1765   'data': { 'type'  : 'BlockJobType',
1766             'device': 'str',
1767             'len'   : 'int',
1768             'offset': 'int',
1769             'speed' : 'int',
1770             '*error': 'str' } }
1773 # @BLOCK_JOB_CANCELLED
1775 # Emitted when a block job has been cancelled
1777 # @type: job type
1779 # @device: device name
1781 # @len: maximum progress value
1783 # @offset: current progress value. On success this is equal to len.
1784 #          On failure this is less than len
1786 # @speed: rate limit, bytes per second
1788 # Since: 1.1
1790 { 'event': 'BLOCK_JOB_CANCELLED',
1791   'data': { 'type'  : 'BlockJobType',
1792             'device': 'str',
1793             'len'   : 'int',
1794             'offset': 'int',
1795             'speed' : 'int' } }
1798 # @BLOCK_JOB_ERROR
1800 # Emitted when a block job encounters an error
1802 # @device: device name
1804 # @operation: I/O operation
1806 # @action: action that has been taken
1808 # Since: 1.3
1810 { 'event': 'BLOCK_JOB_ERROR',
1811   'data': { 'device'   : 'str',
1812             'operation': 'IoOperationType',
1813             'action'   : 'BlockErrorAction' } }
1816 # @BLOCK_JOB_READY
1818 # Emitted when a block job is ready to complete
1820 # @type: job type
1822 # @device: device name
1824 # @len: maximum progress value
1826 # @offset: current progress value. On success this is equal to len.
1827 #          On failure this is less than len
1829 # @speed: rate limit, bytes per second
1831 # Note: The "ready to complete" status is always reset by a @BLOCK_JOB_ERROR
1832 # event
1834 # Since: 1.3
1836 { 'event': 'BLOCK_JOB_READY',
1837   'data': { 'type'  : 'BlockJobType',
1838             'device': 'str',
1839             'len'   : 'int',
1840             'offset': 'int',
1841             'speed' : 'int' } }
1843 # @PreallocMode
1845 # Preallocation mode of QEMU image file
1847 # @off: no preallocation
1848 # @metadata: preallocate only for metadata
1849 # @falloc: like @full preallocation but allocate disk space by
1850 #          posix_fallocate() rather than writing zeros.
1851 # @full: preallocate all data by writing zeros to device to ensure disk
1852 #        space is really available. @full preallocation also sets up
1853 #        metadata correctly.
1855 # Since 2.2
1857 { 'enum': 'PreallocMode',
1858   'data': [ 'off', 'metadata', 'falloc', 'full' ] }