cirrus: fix blit region check
[qemu.git] / qapi / block-core.json
bloba14e6ab1fd0068b1529d0b59b91a8653cf733b17
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 # @BlockDeviceInfo:
188 # Information about the backing device for a block device.
190 # @file: the filename of the backing device
192 # @node-name: #optional the name of the block driver node (Since 2.0)
194 # @ro: true if the backing device was open read-only
196 # @drv: the name of the block format used to open the backing device. As of
197 #       0.14.0 this can be: 'blkdebug', 'bochs', 'cloop', 'cow', 'dmg',
198 #       'file', 'file', 'ftp', 'ftps', 'host_cdrom', 'host_device',
199 #       'host_floppy', 'http', 'https', 'nbd', 'parallels', 'qcow',
200 #       'qcow2', 'raw', 'tftp', 'vdi', 'vmdk', 'vpc', 'vvfat'
201 #       2.2: 'archipelago' added, 'cow' dropped
203 # @backing_file: #optional the name of the backing file (for copy-on-write)
205 # @backing_file_depth: number of files in the backing file chain (since: 1.2)
207 # @encrypted: true if the backing device is encrypted
209 # @encryption_key_missing: true if the backing device is encrypted but an
210 #                          valid encryption key is missing
212 # @detect_zeroes: detect and optimize zero writes (Since 2.1)
214 # @bps: total throughput limit in bytes per second is specified
216 # @bps_rd: read throughput limit in bytes per second is specified
218 # @bps_wr: write throughput limit in bytes per second is specified
220 # @iops: total I/O operations per second is specified
222 # @iops_rd: read I/O operations per second is specified
224 # @iops_wr: write I/O operations per second is specified
226 # @image: the info of image used (since: 1.6)
228 # @bps_max: #optional total max in bytes (Since 1.7)
230 # @bps_rd_max: #optional read max in bytes (Since 1.7)
232 # @bps_wr_max: #optional write max in bytes (Since 1.7)
234 # @iops_max: #optional total I/O operations max (Since 1.7)
236 # @iops_rd_max: #optional read I/O operations max (Since 1.7)
238 # @iops_wr_max: #optional write I/O operations max (Since 1.7)
240 # @iops_size: #optional an I/O size in bytes (Since 1.7)
242 # Since: 0.14.0
245 { 'type': 'BlockDeviceInfo',
246   'data': { 'file': 'str', '*node-name': 'str', 'ro': 'bool', 'drv': 'str',
247             '*backing_file': 'str', 'backing_file_depth': 'int',
248             'encrypted': 'bool', 'encryption_key_missing': 'bool',
249             'detect_zeroes': 'BlockdevDetectZeroesOptions',
250             'bps': 'int', 'bps_rd': 'int', 'bps_wr': 'int',
251             'iops': 'int', 'iops_rd': 'int', 'iops_wr': 'int',
252             'image': 'ImageInfo',
253             '*bps_max': 'int', '*bps_rd_max': 'int',
254             '*bps_wr_max': 'int', '*iops_max': 'int',
255             '*iops_rd_max': 'int', '*iops_wr_max': 'int',
256             '*iops_size': 'int' } }
259 # @BlockDeviceIoStatus:
261 # An enumeration of block device I/O status.
263 # @ok: The last I/O operation has succeeded
265 # @failed: The last I/O operation has failed
267 # @nospace: The last I/O operation has failed due to a no-space condition
269 # Since: 1.0
271 { 'enum': 'BlockDeviceIoStatus', 'data': [ 'ok', 'failed', 'nospace' ] }
274 # @BlockDeviceMapEntry:
276 # Entry in the metadata map of the device (returned by "qemu-img map")
278 # @start: Offset in the image of the first byte described by this entry
279 #         (in bytes)
281 # @length: Length of the range described by this entry (in bytes)
283 # @depth: Number of layers (0 = top image, 1 = top image's backing file, etc.)
284 #         before reaching one for which the range is allocated.  The value is
285 #         in the range 0 to the depth of the image chain - 1.
287 # @zero: the sectors in this range read as zeros
289 # @data: reading the image will actually read data from a file (in particular,
290 #        if @offset is present this means that the sectors are not simply
291 #        preallocated, but contain actual data in raw format)
293 # @offset: if present, the image file stores the data for this range in
294 #          raw format at the given offset.
296 # Since 1.7
298 { 'type': 'BlockDeviceMapEntry',
299   'data': { 'start': 'int', 'length': 'int', 'depth': 'int', 'zero': 'bool',
300             'data': 'bool', '*offset': 'int' } }
303 # @BlockDirtyInfo:
305 # Block dirty bitmap information.
307 # @count: number of dirty bytes according to the dirty bitmap
309 # @granularity: granularity of the dirty bitmap in bytes (since 1.4)
311 # Since: 1.3
313 { 'type': 'BlockDirtyInfo',
314   'data': {'count': 'int', 'granularity': 'int'} }
317 # @BlockInfo:
319 # Block device information.  This structure describes a virtual device and
320 # the backing device associated with it.
322 # @device: The device name associated with the virtual device.
324 # @type: This field is returned only for compatibility reasons, it should
325 #        not be used (always returns 'unknown')
327 # @removable: True if the device supports removable media.
329 # @locked: True if the guest has locked this device from having its media
330 #          removed
332 # @tray_open: #optional True if the device has a tray and it is open
333 #             (only present if removable is true)
335 # @dirty-bitmaps: #optional dirty bitmaps information (only present if the
336 #                 driver has one or more dirty bitmaps) (Since 2.0)
338 # @io-status: #optional @BlockDeviceIoStatus. Only present if the device
339 #             supports it and the VM is configured to stop on errors
340 #             (supported device models: virtio-blk, ide, scsi-disk)
342 # @inserted: #optional @BlockDeviceInfo describing the device if media is
343 #            present
345 # Since:  0.14.0
347 { 'type': 'BlockInfo',
348   'data': {'device': 'str', 'type': 'str', 'removable': 'bool',
349            'locked': 'bool', '*inserted': 'BlockDeviceInfo',
350            '*tray_open': 'bool', '*io-status': 'BlockDeviceIoStatus',
351            '*dirty-bitmaps': ['BlockDirtyInfo'] } }
354 # @query-block:
356 # Get a list of BlockInfo for all virtual block devices.
358 # Returns: a list of @BlockInfo describing each virtual block device
360 # Since: 0.14.0
362 { 'command': 'query-block', 'returns': ['BlockInfo'] }
365 # @BlockDeviceStats:
367 # Statistics of a virtual block device or a block backing device.
369 # @rd_bytes:      The number of bytes read by the device.
371 # @wr_bytes:      The number of bytes written by the device.
373 # @rd_operations: The number of read operations performed by the device.
375 # @wr_operations: The number of write operations performed by the device.
377 # @flush_operations: The number of cache flush operations performed by the
378 #                    device (since 0.15.0)
380 # @flush_total_time_ns: Total time spend on cache flushes in nano-seconds
381 #                       (since 0.15.0).
383 # @wr_total_time_ns: Total time spend on writes in nano-seconds (since 0.15.0).
385 # @rd_total_time_ns: Total_time_spend on reads in nano-seconds (since 0.15.0).
387 # @wr_highest_offset: The offset after the greatest byte written to the
388 #                     device.  The intended use of this information is for
389 #                     growable sparse files (like qcow2) that are used on top
390 #                     of a physical device.
392 # Since: 0.14.0
394 { 'type': 'BlockDeviceStats',
395   'data': {'rd_bytes': 'int', 'wr_bytes': 'int', 'rd_operations': 'int',
396            'wr_operations': 'int', 'flush_operations': 'int',
397            'flush_total_time_ns': 'int', 'wr_total_time_ns': 'int',
398            'rd_total_time_ns': 'int', 'wr_highest_offset': 'int' } }
401 # @BlockStats:
403 # Statistics of a virtual block device or a block backing device.
405 # @device: #optional If the stats are for a virtual block device, the name
406 #          corresponding to the virtual block device.
408 # @stats:  A @BlockDeviceStats for the device.
410 # @parent: #optional This describes the file block device if it has one.
412 # @backing: #optional This describes the backing block device if it has one.
413 #           (Since 2.0)
415 # Since: 0.14.0
417 { 'type': 'BlockStats',
418   'data': {'*device': 'str', 'stats': 'BlockDeviceStats',
419            '*parent': 'BlockStats',
420            '*backing': 'BlockStats'} }
423 # @query-blockstats:
425 # Query the @BlockStats for all virtual block devices.
427 # Returns: A list of @BlockStats for each virtual block devices.
429 # Since: 0.14.0
431 { 'command': 'query-blockstats', 'returns': ['BlockStats'] }
434 # @BlockdevOnError:
436 # An enumeration of possible behaviors for errors on I/O operations.
437 # The exact meaning depends on whether the I/O was initiated by a guest
438 # or by a block job
440 # @report: for guest operations, report the error to the guest;
441 #          for jobs, cancel the job
443 # @ignore: ignore the error, only report a QMP event (BLOCK_IO_ERROR
444 #          or BLOCK_JOB_ERROR)
446 # @enospc: same as @stop on ENOSPC, same as @report otherwise.
448 # @stop: for guest operations, stop the virtual machine;
449 #        for jobs, pause the job
451 # Since: 1.3
453 { 'enum': 'BlockdevOnError',
454   'data': ['report', 'ignore', 'enospc', 'stop'] }
457 # @MirrorSyncMode:
459 # An enumeration of possible behaviors for the initial synchronization
460 # phase of storage mirroring.
462 # @top: copies data in the topmost image to the destination
464 # @full: copies data from all images to the destination
466 # @none: only copy data written from now on
468 # Since: 1.3
470 { 'enum': 'MirrorSyncMode',
471   'data': ['top', 'full', 'none'] }
474 # @BlockJobType:
476 # Type of a block job.
478 # @commit: block commit job type, see "block-commit"
480 # @stream: block stream job type, see "block-stream"
482 # @mirror: drive mirror job type, see "drive-mirror"
484 # @backup: drive backup job type, see "drive-backup"
486 # Since: 1.7
488 { 'enum': 'BlockJobType',
489   'data': ['commit', 'stream', 'mirror', 'backup'] }
492 # @BlockJobInfo:
494 # Information about a long-running block device operation.
496 # @type: the job type ('stream' for image streaming)
498 # @device: the block device name
500 # @len: the maximum progress value
502 # @busy: false if the job is known to be in a quiescent state, with
503 #        no pending I/O.  Since 1.3.
505 # @paused: whether the job is paused or, if @busy is true, will
506 #          pause itself as soon as possible.  Since 1.3.
508 # @offset: the current progress value
510 # @speed: the rate limit, bytes per second
512 # @io-status: the status of the job (since 1.3)
514 # @ready: true if the job may be completed (since 2.2)
516 # Since: 1.1
518 { 'type': 'BlockJobInfo',
519   'data': {'type': 'str', 'device': 'str', 'len': 'int',
520            'offset': 'int', 'busy': 'bool', 'paused': 'bool', 'speed': 'int',
521            'io-status': 'BlockDeviceIoStatus', 'ready': 'bool'} }
524 # @query-block-jobs:
526 # Return information about long-running block device operations.
528 # Returns: a list of @BlockJobInfo for each active block job
530 # Since: 1.1
532 { 'command': 'query-block-jobs', 'returns': ['BlockJobInfo'] }
535 # @block_passwd:
537 # This command sets the password of a block device that has not been open
538 # with a password and requires one.
540 # The two cases where this can happen are a block device is created through
541 # QEMU's initial command line or a block device is changed through the legacy
542 # @change interface.
544 # In the event that the block device is created through the initial command
545 # line, the VM will start in the stopped state regardless of whether '-S' is
546 # used.  The intention is for a management tool to query the block devices to
547 # determine which ones are encrypted, set the passwords with this command, and
548 # then start the guest with the @cont command.
550 # Either @device or @node-name must be set but not both.
552 # @device: #optional the name of the block backend device to set the password on
554 # @node-name: #optional graph node name to set the password on (Since 2.0)
556 # @password: the password to use for the device
558 # Returns: nothing on success
559 #          If @device is not a valid block device, DeviceNotFound
560 #          If @device is not encrypted, DeviceNotEncrypted
562 # Notes:  Not all block formats support encryption and some that do are not
563 #         able to validate that a password is correct.  Disk corruption may
564 #         occur if an invalid password is specified.
566 # Since: 0.14.0
568 { 'command': 'block_passwd', 'data': {'*device': 'str',
569                                       '*node-name': 'str', 'password': 'str'} }
572 # @block_resize
574 # Resize a block image while a guest is running.
576 # Either @device or @node-name must be set but not both.
578 # @device: #optional the name of the device to get the image resized
580 # @node-name: #optional graph node name to get the image resized (Since 2.0)
582 # @size:  new image size in bytes
584 # Returns: nothing on success
585 #          If @device is not a valid block device, DeviceNotFound
587 # Since: 0.14.0
589 { 'command': 'block_resize', 'data': { '*device': 'str',
590                                        '*node-name': 'str',
591                                        'size': 'int' }}
594 # @NewImageMode
596 # An enumeration that tells QEMU how to set the backing file path in
597 # a new image file.
599 # @existing: QEMU should look for an existing image file.
601 # @absolute-paths: QEMU should create a new image with absolute paths
602 # for the backing file. If there is no backing file available, the new
603 # image will not be backed either.
605 # Since: 1.1
607 { 'enum': 'NewImageMode',
608   'data': [ 'existing', 'absolute-paths' ] }
611 # @BlockdevSnapshot
613 # Either @device or @node-name must be set but not both.
615 # @device: #optional the name of the device to generate the snapshot from.
617 # @node-name: #optional graph node name to generate the snapshot from (Since 2.0)
619 # @snapshot-file: the target of the new image. A new file will be created.
621 # @snapshot-node-name: #optional the graph node name of the new image (Since 2.0)
623 # @format: #optional the format of the snapshot image, default is 'qcow2'.
625 # @mode: #optional whether and how QEMU should create a new image, default is
626 #        'absolute-paths'.
628 { 'type': 'BlockdevSnapshot',
629   'data': { '*device': 'str', '*node-name': 'str',
630             'snapshot-file': 'str', '*snapshot-node-name': 'str',
631             '*format': 'str', '*mode': 'NewImageMode' } }
634 # @DriveBackup
636 # @device: the name of the device which should be copied.
638 # @target: the target of the new image. If the file exists, or if it
639 #          is a device, the existing file/device will be used as the new
640 #          destination.  If it does not exist, a new file will be created.
642 # @format: #optional the format of the new destination, default is to
643 #          probe if @mode is 'existing', else the format of the source
645 # @sync: what parts of the disk image should be copied to the destination
646 #        (all the disk, only the sectors allocated in the topmost image, or
647 #        only new I/O).
649 # @mode: #optional whether and how QEMU should create a new image, default is
650 #        'absolute-paths'.
652 # @speed: #optional the maximum speed, in bytes per second
654 # @on-source-error: #optional the action to take on an error on the source,
655 #                   default 'report'.  'stop' and 'enospc' can only be used
656 #                   if the block device supports io-status (see BlockInfo).
658 # @on-target-error: #optional the action to take on an error on the target,
659 #                   default 'report' (no limitations, since this applies to
660 #                   a different block device than @device).
662 # Note that @on-source-error and @on-target-error only affect background I/O.
663 # If an error occurs during a guest write request, the device's rerror/werror
664 # actions will be used.
666 # Since: 1.6
668 { 'type': 'DriveBackup',
669   'data': { 'device': 'str', 'target': 'str', '*format': 'str',
670             'sync': 'MirrorSyncMode', '*mode': 'NewImageMode',
671             '*speed': 'int',
672             '*on-source-error': 'BlockdevOnError',
673             '*on-target-error': 'BlockdevOnError' } }
676 # @blockdev-snapshot-sync
678 # Generates a synchronous snapshot of a block device.
680 # For the arguments, see the documentation of BlockdevSnapshot.
682 # Returns: nothing on success
683 #          If @device is not a valid block device, DeviceNotFound
685 # Since 0.14.0
687 { 'command': 'blockdev-snapshot-sync',
688   'data': 'BlockdevSnapshot' }
691 # @change-backing-file
693 # Change the backing file in the image file metadata.  This does not
694 # cause QEMU to reopen the image file to reparse the backing filename
695 # (it may, however, perform a reopen to change permissions from
696 # r/o -> r/w -> r/o, if needed). The new backing file string is written
697 # into the image file metadata, and the QEMU internal strings are
698 # updated.
700 # @image-node-name: The name of the block driver state node of the
701 #                   image to modify.
703 # @device:          The name of the device that owns image-node-name.
705 # @backing-file:    The string to write as the backing file.  This
706 #                   string is not validated, so care should be taken
707 #                   when specifying the string or the image chain may
708 #                   not be able to be reopened again.
710 # Since: 2.1
712 { 'command': 'change-backing-file',
713   'data': { 'device': 'str', 'image-node-name': 'str',
714             'backing-file': 'str' } }
717 # @block-commit
719 # Live commit of data from overlay image nodes into backing nodes - i.e.,
720 # writes data between 'top' and 'base' into 'base'.
722 # @device:  the name of the device
724 # @base:   #optional The file name of the backing image to write data into.
725 #                    If not specified, this is the deepest backing image
727 # @top:    #optional The file name of the backing image within the image chain,
728 #                    which contains the topmost data to be committed down. If
729 #                    not specified, this is the active layer.
731 # @backing-file:  #optional The backing file string to write into the overlay
732 #                           image of 'top'.  If 'top' is the active layer,
733 #                           specifying a backing file string is an error. This
734 #                           filename is not validated.
736 #                           If a pathname string is such that it cannot be
737 #                           resolved by QEMU, that means that subsequent QMP or
738 #                           HMP commands must use node-names for the image in
739 #                           question, as filename lookup methods will fail.
741 #                           If not specified, QEMU will automatically determine
742 #                           the backing file string to use, or error out if
743 #                           there is no obvious choice. Care should be taken
744 #                           when specifying the string, to specify a valid
745 #                           filename or protocol.
746 #                           (Since 2.1)
748 #                    If top == base, that is an error.
749 #                    If top == active, the job will not be completed by itself,
750 #                    user needs to complete the job with the block-job-complete
751 #                    command after getting the ready event. (Since 2.0)
753 #                    If the base image is smaller than top, then the base image
754 #                    will be resized to be the same size as top.  If top is
755 #                    smaller than the base image, the base will not be
756 #                    truncated.  If you want the base image size to match the
757 #                    size of the smaller top, you can safely truncate it
758 #                    yourself once the commit operation successfully completes.
760 # @speed:  #optional the maximum speed, in bytes per second
762 # Returns: Nothing on success
763 #          If commit or stream is already active on this device, DeviceInUse
764 #          If @device does not exist, DeviceNotFound
765 #          If image commit is not supported by this device, NotSupported
766 #          If @base or @top is invalid, a generic error is returned
767 #          If @speed is invalid, InvalidParameter
769 # Since: 1.3
772 { 'command': 'block-commit',
773   'data': { 'device': 'str', '*base': 'str', '*top': 'str',
774             '*backing-file': 'str', '*speed': 'int' } }
777 # @drive-backup
779 # Start a point-in-time copy of a block device to a new destination.  The
780 # status of ongoing drive-backup operations can be checked with
781 # query-block-jobs where the BlockJobInfo.type field has the value 'backup'.
782 # The operation can be stopped before it has completed using the
783 # block-job-cancel command.
785 # For the arguments, see the documentation of DriveBackup.
787 # Returns: nothing on success
788 #          If @device is not a valid block device, DeviceNotFound
790 # Since 1.6
792 { 'command': 'drive-backup', 'data': 'DriveBackup' }
795 # @query-named-block-nodes
797 # Get the named block driver list
799 # Returns: the list of BlockDeviceInfo
801 # Since 2.0
803 { 'command': 'query-named-block-nodes', 'returns': [ 'BlockDeviceInfo' ] }
806 # @drive-mirror
808 # Start mirroring a block device's writes to a new destination.
810 # @device:  the name of the device whose writes should be mirrored.
812 # @target: the target of the new image. If the file exists, or if it
813 #          is a device, the existing file/device will be used as the new
814 #          destination.  If it does not exist, a new file will be created.
816 # @format: #optional the format of the new destination, default is to
817 #          probe if @mode is 'existing', else the format of the source
819 # @node-name: #optional the new block driver state node name in the graph
820 #             (Since 2.1)
822 # @replaces: #optional with sync=full graph node name to be replaced by the new
823 #            image when a whole image copy is done. This can be used to repair
824 #            broken Quorum files. (Since 2.1)
826 # @mode: #optional whether and how QEMU should create a new image, default is
827 #        'absolute-paths'.
829 # @speed:  #optional the maximum speed, in bytes per second
831 # @sync: what parts of the disk image should be copied to the destination
832 #        (all the disk, only the sectors allocated in the topmost image, or
833 #        only new I/O).
835 # @granularity: #optional granularity of the dirty bitmap, default is 64K
836 #               if the image format doesn't have clusters, 4K if the clusters
837 #               are smaller than that, else the cluster size.  Must be a
838 #               power of 2 between 512 and 64M (since 1.4).
840 # @buf-size: #optional maximum amount of data in flight from source to
841 #            target (since 1.4).
843 # @on-source-error: #optional the action to take on an error on the source,
844 #                   default 'report'.  'stop' and 'enospc' can only be used
845 #                   if the block device supports io-status (see BlockInfo).
847 # @on-target-error: #optional the action to take on an error on the target,
848 #                   default 'report' (no limitations, since this applies to
849 #                   a different block device than @device).
851 # Returns: nothing on success
852 #          If @device is not a valid block device, DeviceNotFound
854 # Since 1.3
856 { 'command': 'drive-mirror',
857   'data': { 'device': 'str', 'target': 'str', '*format': 'str',
858             '*node-name': 'str', '*replaces': 'str',
859             'sync': 'MirrorSyncMode', '*mode': 'NewImageMode',
860             '*speed': 'int', '*granularity': 'uint32',
861             '*buf-size': 'int', '*on-source-error': 'BlockdevOnError',
862             '*on-target-error': 'BlockdevOnError' } }
865 # @block_set_io_throttle:
867 # Change I/O throttle limits for a block drive.
869 # @device: The name of the device
871 # @bps: total throughput limit in bytes per second
873 # @bps_rd: read throughput limit in bytes per second
875 # @bps_wr: write throughput limit in bytes per second
877 # @iops: total I/O operations per second
879 # @ops_rd: read I/O operations per second
881 # @iops_wr: write I/O operations per second
883 # @bps_max: #optional total max in bytes (Since 1.7)
885 # @bps_rd_max: #optional read max in bytes (Since 1.7)
887 # @bps_wr_max: #optional write max in bytes (Since 1.7)
889 # @iops_max: #optional total I/O operations max (Since 1.7)
891 # @iops_rd_max: #optional read I/O operations max (Since 1.7)
893 # @iops_wr_max: #optional write I/O operations max (Since 1.7)
895 # @iops_size: #optional an I/O size in bytes (Since 1.7)
897 # Returns: Nothing on success
898 #          If @device is not a valid block device, DeviceNotFound
900 # Since: 1.1
902 { 'command': 'block_set_io_throttle',
903   'data': { 'device': 'str', 'bps': 'int', 'bps_rd': 'int', 'bps_wr': 'int',
904             'iops': 'int', 'iops_rd': 'int', 'iops_wr': 'int',
905             '*bps_max': 'int', '*bps_rd_max': 'int',
906             '*bps_wr_max': 'int', '*iops_max': 'int',
907             '*iops_rd_max': 'int', '*iops_wr_max': 'int',
908             '*iops_size': 'int' } }
911 # @block-stream:
913 # Copy data from a backing file into a block device.
915 # The block streaming operation is performed in the background until the entire
916 # backing file has been copied.  This command returns immediately once streaming
917 # has started.  The status of ongoing block streaming operations can be checked
918 # with query-block-jobs.  The operation can be stopped before it has completed
919 # using the block-job-cancel command.
921 # If a base file is specified then sectors are not copied from that base file and
922 # its backing chain.  When streaming completes the image file will have the base
923 # file as its backing file.  This can be used to stream a subset of the backing
924 # file chain instead of flattening the entire image.
926 # On successful completion the image file is updated to drop the backing file
927 # and the BLOCK_JOB_COMPLETED event is emitted.
929 # @device: the device name
931 # @base:   #optional the common backing file name
933 # @backing-file: #optional The backing file string to write into the active
934 #                          layer. This filename is not validated.
936 #                          If a pathname string is such that it cannot be
937 #                          resolved by QEMU, that means that subsequent QMP or
938 #                          HMP commands must use node-names for the image in
939 #                          question, as filename lookup methods will fail.
941 #                          If not specified, QEMU will automatically determine
942 #                          the backing file string to use, or error out if there
943 #                          is no obvious choice.  Care should be taken when
944 #                          specifying the string, to specify a valid filename or
945 #                          protocol.
946 #                          (Since 2.1)
948 # @speed:  #optional the maximum speed, in bytes per second
950 # @on-error: #optional the action to take on an error (default report).
951 #            'stop' and 'enospc' can only be used if the block device
952 #            supports io-status (see BlockInfo).  Since 1.3.
954 # Returns: Nothing on success
955 #          If @device does not exist, DeviceNotFound
957 # Since: 1.1
959 { 'command': 'block-stream',
960   'data': { 'device': 'str', '*base': 'str', '*backing-file': 'str',
961             '*speed': 'int', '*on-error': 'BlockdevOnError' } }
964 # @block-job-set-speed:
966 # Set maximum speed for a background block operation.
968 # This command can only be issued when there is an active block job.
970 # Throttling can be disabled by setting the speed to 0.
972 # @device: the device name
974 # @speed:  the maximum speed, in bytes per second, or 0 for unlimited.
975 #          Defaults to 0.
977 # Returns: Nothing on success
978 #          If no background operation is active on this device, DeviceNotActive
980 # Since: 1.1
982 { 'command': 'block-job-set-speed',
983   'data': { 'device': 'str', 'speed': 'int' } }
986 # @block-job-cancel:
988 # Stop an active background block operation.
990 # This command returns immediately after marking the active background block
991 # operation for cancellation.  It is an error to call this command if no
992 # operation is in progress.
994 # The operation will cancel as soon as possible and then emit the
995 # BLOCK_JOB_CANCELLED event.  Before that happens the job is still visible when
996 # enumerated using query-block-jobs.
998 # For streaming, the image file retains its backing file unless the streaming
999 # operation happens to complete just as it is being cancelled.  A new streaming
1000 # operation can be started at a later time to finish copying all data from the
1001 # backing file.
1003 # @device: the device name
1005 # @force: #optional whether to allow cancellation of a paused job (default
1006 #         false).  Since 1.3.
1008 # Returns: Nothing on success
1009 #          If no background operation is active on this device, DeviceNotActive
1011 # Since: 1.1
1013 { 'command': 'block-job-cancel', 'data': { 'device': 'str', '*force': 'bool' } }
1016 # @block-job-pause:
1018 # Pause an active background block operation.
1020 # This command returns immediately after marking the active background block
1021 # operation for pausing.  It is an error to call this command if no
1022 # operation is in progress.  Pausing an already paused job has no cumulative
1023 # effect; a single block-job-resume command will resume the job.
1025 # The operation will pause as soon as possible.  No event is emitted when
1026 # the operation is actually paused.  Cancelling a paused job automatically
1027 # resumes it.
1029 # @device: the device name
1031 # Returns: Nothing on success
1032 #          If no background operation is active on this device, DeviceNotActive
1034 # Since: 1.3
1036 { 'command': 'block-job-pause', 'data': { 'device': 'str' } }
1039 # @block-job-resume:
1041 # Resume an active background block operation.
1043 # This command returns immediately after resuming a paused background block
1044 # operation.  It is an error to call this command if no operation is in
1045 # progress.  Resuming an already running job is not an error.
1047 # This command also clears the error status of the job.
1049 # @device: the device name
1051 # Returns: Nothing on success
1052 #          If no background operation is active on this device, DeviceNotActive
1054 # Since: 1.3
1056 { 'command': 'block-job-resume', 'data': { 'device': 'str' } }
1059 # @block-job-complete:
1061 # Manually trigger completion of an active background block operation.  This
1062 # is supported for drive mirroring, where it also switches the device to
1063 # write to the target path only.  The ability to complete is signaled with
1064 # a BLOCK_JOB_READY event.
1066 # This command completes an active background block operation synchronously.
1067 # The ordering of this command's return with the BLOCK_JOB_COMPLETED event
1068 # is not defined.  Note that if an I/O error occurs during the processing of
1069 # this command: 1) the command itself will fail; 2) the error will be processed
1070 # according to the rerror/werror arguments that were specified when starting
1071 # the operation.
1073 # A cancelled or paused job cannot be completed.
1075 # @device: the device name
1077 # Returns: Nothing on success
1078 #          If no background operation is active on this device, DeviceNotActive
1080 # Since: 1.3
1082 { 'command': 'block-job-complete', 'data': { 'device': 'str' } }
1085 # @BlockdevDiscardOptions
1087 # Determines how to handle discard requests.
1089 # @ignore:      Ignore the request
1090 # @unmap:       Forward as an unmap request
1092 # Since: 1.7
1094 { 'enum': 'BlockdevDiscardOptions',
1095   'data': [ 'ignore', 'unmap' ] }
1098 # @BlockdevDetectZeroesOptions
1100 # Describes the operation mode for the automatic conversion of plain
1101 # zero writes by the OS to driver specific optimized zero write commands.
1103 # @off:      Disabled (default)
1104 # @on:       Enabled
1105 # @unmap:    Enabled and even try to unmap blocks if possible. This requires
1106 #            also that @BlockdevDiscardOptions is set to unmap for this device.
1108 # Since: 2.1
1110 { 'enum': 'BlockdevDetectZeroesOptions',
1111   'data': [ 'off', 'on', 'unmap' ] }
1114 # @BlockdevAioOptions
1116 # Selects the AIO backend to handle I/O requests
1118 # @threads:     Use qemu's thread pool
1119 # @native:      Use native AIO backend (only Linux and Windows)
1121 # Since: 1.7
1123 { 'enum': 'BlockdevAioOptions',
1124   'data': [ 'threads', 'native' ] }
1127 # @BlockdevCacheOptions
1129 # Includes cache-related options for block devices
1131 # @writeback:   #optional enables writeback mode for any caches (default: true)
1132 # @direct:      #optional enables use of O_DIRECT (bypass the host page cache;
1133 #               default: false)
1134 # @no-flush:    #optional ignore any flush requests for the device (default:
1135 #               false)
1137 # Since: 1.7
1139 { 'type': 'BlockdevCacheOptions',
1140   'data': { '*writeback': 'bool',
1141             '*direct': 'bool',
1142             '*no-flush': 'bool' } }
1145 # @BlockdevDriver
1147 # Drivers that are supported in block device operations.
1149 # @host_device, @host_cdrom, @host_floppy: Since 2.1
1151 # Since: 2.0
1153 { 'enum': 'BlockdevDriver',
1154   'data': [ 'archipelago', 'blkdebug', 'blkverify', 'bochs', 'cloop',
1155             'dmg', 'file', 'ftp', 'ftps', 'host_cdrom', 'host_device',
1156             'host_floppy', 'http', 'https', 'null-aio', 'null-co', 'parallels',
1157             'qcow', 'qcow2', 'qed', 'quorum', 'raw', 'tftp', 'vdi', 'vhdx',
1158             'vmdk', 'vpc', 'vvfat' ] }
1161 # @BlockdevOptionsBase
1163 # Options that are available for all block devices, independent of the block
1164 # driver.
1166 # @driver:        block driver name
1167 # @id:            #optional id by which the new block device can be referred to.
1168 #                 This is a required option on the top level of blockdev-add, and
1169 #                 currently not allowed on any other level.
1170 # @node-name:     #optional the name of a block driver state node (Since 2.0)
1171 # @discard:       #optional discard-related options (default: ignore)
1172 # @cache:         #optional cache-related options
1173 # @aio:           #optional AIO backend (default: threads)
1174 # @rerror:        #optional how to handle read errors on the device
1175 #                 (default: report)
1176 # @werror:        #optional how to handle write errors on the device
1177 #                 (default: enospc)
1178 # @read-only:     #optional whether the block device should be read-only
1179 #                 (default: false)
1180 # @detect-zeroes: #optional detect and optimize zero writes (Since 2.1)
1181 #                 (default: off)
1183 # Since: 1.7
1185 { 'type': 'BlockdevOptionsBase',
1186   'data': { 'driver': 'BlockdevDriver',
1187             '*id': 'str',
1188             '*node-name': 'str',
1189             '*discard': 'BlockdevDiscardOptions',
1190             '*cache': 'BlockdevCacheOptions',
1191             '*aio': 'BlockdevAioOptions',
1192             '*rerror': 'BlockdevOnError',
1193             '*werror': 'BlockdevOnError',
1194             '*read-only': 'bool',
1195             '*detect-zeroes': 'BlockdevDetectZeroesOptions' } }
1198 # @BlockdevOptionsFile
1200 # Driver specific block device options for the file backend and similar
1201 # protocols.
1203 # @filename:    path to the image file
1205 # Since: 1.7
1207 { 'type': 'BlockdevOptionsFile',
1208   'data': { 'filename': 'str' } }
1211 # @BlockdevOptionsNull
1213 # Driver specific block device options for the null backend.
1215 # @size:    #optional size of the device in bytes.
1217 # Since: 2.2
1219 { 'type': 'BlockdevOptionsNull',
1220   'data': { '*size': 'int' } }
1223 # @BlockdevOptionsVVFAT
1225 # Driver specific block device options for the vvfat protocol.
1227 # @dir:         directory to be exported as FAT image
1228 # @fat-type:    #optional FAT type: 12, 16 or 32
1229 # @floppy:      #optional whether to export a floppy image (true) or
1230 #               partitioned hard disk (false; default)
1231 # @rw:          #optional whether to allow write operations (default: false)
1233 # Since: 1.7
1235 { 'type': 'BlockdevOptionsVVFAT',
1236   'data': { 'dir': 'str', '*fat-type': 'int', '*floppy': 'bool',
1237             '*rw': 'bool' } }
1240 # @BlockdevOptionsGenericFormat
1242 # Driver specific block device options for image format that have no option
1243 # besides their data source.
1245 # @file:        reference to or definition of the data source block device
1247 # Since: 1.7
1249 { 'type': 'BlockdevOptionsGenericFormat',
1250   'data': { 'file': 'BlockdevRef' } }
1253 # @BlockdevOptionsGenericCOWFormat
1255 # Driver specific block device options for image format that have no option
1256 # besides their data source and an optional backing file.
1258 # @backing:     #optional reference to or definition of the backing file block
1259 #               device (if missing, taken from the image file content). It is
1260 #               allowed to pass an empty string here in order to disable the
1261 #               default backing file.
1263 # Since: 1.7
1265 { 'type': 'BlockdevOptionsGenericCOWFormat',
1266   'base': 'BlockdevOptionsGenericFormat',
1267   'data': { '*backing': 'BlockdevRef' } }
1270 # @Qcow2OverlapCheckMode
1272 # General overlap check modes.
1274 # @none:        Do not perform any checks
1276 # @constant:    Perform only checks which can be done in constant time and
1277 #               without reading anything from disk
1279 # @cached:      Perform only checks which can be done without reading anything
1280 #               from disk
1282 # @all:         Perform all available overlap checks
1284 # Since: 2.2
1286 { 'enum': 'Qcow2OverlapCheckMode',
1287   'data': [ 'none', 'constant', 'cached', 'all' ] }
1290 # @Qcow2OverlapCheckFlags
1292 # Structure of flags for each metadata structure. Setting a field to 'true'
1293 # makes qemu guard that structure against unintended overwriting. The default
1294 # value is chosen according to the template given.
1296 # @template: Specifies a template mode which can be adjusted using the other
1297 #            flags, defaults to 'cached'
1299 # Since: 2.2
1301 { 'type': 'Qcow2OverlapCheckFlags',
1302   'data': { '*template':       'Qcow2OverlapCheckMode',
1303             '*main-header':    'bool',
1304             '*active-l1':      'bool',
1305             '*active-l2':      'bool',
1306             '*refcount-table': 'bool',
1307             '*refcount-block': 'bool',
1308             '*snapshot-table': 'bool',
1309             '*inactive-l1':    'bool',
1310             '*inactive-l2':    'bool' } }
1313 # @Qcow2OverlapChecks
1315 # Specifies which metadata structures should be guarded against unintended
1316 # overwriting.
1318 # @flags:   set of flags for separate specification of each metadata structure
1319 #           type
1321 # @mode:    named mode which chooses a specific set of flags
1323 # Since: 2.2
1325 { 'union': 'Qcow2OverlapChecks',
1326   'discriminator': {},
1327   'data': { 'flags': 'Qcow2OverlapCheckFlags',
1328             'mode':  'Qcow2OverlapCheckMode' } }
1331 # @BlockdevOptionsQcow2
1333 # Driver specific block device options for qcow2.
1335 # @lazy-refcounts:        #optional whether to enable the lazy refcounts
1336 #                         feature (default is taken from the image file)
1338 # @pass-discard-request:  #optional whether discard requests to the qcow2
1339 #                         device should be forwarded to the data source
1341 # @pass-discard-snapshot: #optional whether discard requests for the data source
1342 #                         should be issued when a snapshot operation (e.g.
1343 #                         deleting a snapshot) frees clusters in the qcow2 file
1345 # @pass-discard-other:    #optional whether discard requests for the data source
1346 #                         should be issued on other occasions where a cluster
1347 #                         gets freed
1349 # @overlap-check:         #optional which overlap checks to perform for writes
1350 #                         to the image, defaults to 'cached' (since 2.2)
1352 # @cache-size:            #optional the maximum total size of the L2 table and
1353 #                         refcount block caches in bytes (since 2.2)
1355 # @l2-cache-size:         #optional the maximum size of the L2 table cache in
1356 #                         bytes (since 2.2)
1358 # @refcount-cache-size:   #optional the maximum size of the refcount block cache
1359 #                         in bytes (since 2.2)
1361 # Since: 1.7
1363 { 'type': 'BlockdevOptionsQcow2',
1364   'base': 'BlockdevOptionsGenericCOWFormat',
1365   'data': { '*lazy-refcounts': 'bool',
1366             '*pass-discard-request': 'bool',
1367             '*pass-discard-snapshot': 'bool',
1368             '*pass-discard-other': 'bool',
1369             '*overlap-check': 'Qcow2OverlapChecks',
1370             '*cache-size': 'int',
1371             '*l2-cache-size': 'int',
1372             '*refcount-cache-size': 'int' } }
1376 # @BlockdevOptionsArchipelago
1378 # Driver specific block device options for Archipelago.
1380 # @volume:              Name of the Archipelago volume image
1382 # @mport:               #optional The port number on which mapperd is
1383 #                       listening. This is optional
1384 #                       and if not specified, QEMU will make Archipelago
1385 #                       use the default port (1001).
1387 # @vport:               #optional The port number on which vlmcd is
1388 #                       listening. This is optional
1389 #                       and if not specified, QEMU will make Archipelago
1390 #                       use the default port (501).
1392 # @segment:             #optional The name of the shared memory segment
1393 #                       Archipelago stack is using. This is optional
1394 #                       and if not specified, QEMU will make Archipelago
1395 #                       use the default value, 'archipelago'.
1396 # Since: 2.2
1398 { 'type': 'BlockdevOptionsArchipelago',
1399   'data': { 'volume': 'str',
1400             '*mport': 'int',
1401             '*vport': 'int',
1402             '*segment': 'str' } }
1406 # @BlkdebugEvent
1408 # Trigger events supported by blkdebug.
1410 { 'enum': 'BlkdebugEvent',
1411   'data': [ 'l1_update', 'l1_grow.alloc_table', 'l1_grow.write_table',
1412             'l1_grow.activate_table', 'l2_load', 'l2_update',
1413             'l2_update_compressed', 'l2_alloc.cow_read', 'l2_alloc.write',
1414             'read_aio', 'read_backing_aio', 'read_compressed', 'write_aio',
1415             'write_compressed', 'vmstate_load', 'vmstate_save', 'cow_read',
1416             'cow_write', 'reftable_load', 'reftable_grow', 'reftable_update',
1417             'refblock_load', 'refblock_update', 'refblock_update_part',
1418             'refblock_alloc', 'refblock_alloc.hookup', 'refblock_alloc.write',
1419             'refblock_alloc.write_blocks', 'refblock_alloc.write_table',
1420             'refblock_alloc.switch_table', 'cluster_alloc',
1421             'cluster_alloc_bytes', 'cluster_free', 'flush_to_os',
1422             'flush_to_disk', 'pwritev_rmw.head', 'pwritev_rmw.after_head',
1423             'pwritev_rmw.tail', 'pwritev_rmw.after_tail', 'pwritev',
1424             'pwritev_zero', 'pwritev_done', 'empty_image_prepare' ] }
1427 # @BlkdebugInjectErrorOptions
1429 # Describes a single error injection for blkdebug.
1431 # @event:       trigger event
1433 # @state:       #optional the state identifier blkdebug needs to be in to
1434 #               actually trigger the event; defaults to "any"
1436 # @errno:       #optional error identifier (errno) to be returned; defaults to
1437 #               EIO
1439 # @sector:      #optional specifies the sector index which has to be affected
1440 #               in order to actually trigger the event; defaults to "any
1441 #               sector"
1443 # @once:        #optional disables further events after this one has been
1444 #               triggered; defaults to false
1446 # @immediately: #optional fail immediately; defaults to false
1448 # Since: 2.0
1450 { 'type': 'BlkdebugInjectErrorOptions',
1451   'data': { 'event': 'BlkdebugEvent',
1452             '*state': 'int',
1453             '*errno': 'int',
1454             '*sector': 'int',
1455             '*once': 'bool',
1456             '*immediately': 'bool' } }
1459 # @BlkdebugSetStateOptions
1461 # Describes a single state-change event for blkdebug.
1463 # @event:       trigger event
1465 # @state:       #optional the current state identifier blkdebug needs to be in;
1466 #               defaults to "any"
1468 # @new_state:   the state identifier blkdebug is supposed to assume if
1469 #               this event is triggered
1471 # Since: 2.0
1473 { 'type': 'BlkdebugSetStateOptions',
1474   'data': { 'event': 'BlkdebugEvent',
1475             '*state': 'int',
1476             'new_state': 'int' } }
1479 # @BlockdevOptionsBlkdebug
1481 # Driver specific block device options for blkdebug.
1483 # @image:           underlying raw block device (or image file)
1485 # @config:          #optional filename of the configuration file
1487 # @align:           #optional required alignment for requests in bytes
1489 # @inject-error:    #optional array of error injection descriptions
1491 # @set-state:       #optional array of state-change descriptions
1493 # Since: 2.0
1495 { 'type': 'BlockdevOptionsBlkdebug',
1496   'data': { 'image': 'BlockdevRef',
1497             '*config': 'str',
1498             '*align': 'int',
1499             '*inject-error': ['BlkdebugInjectErrorOptions'],
1500             '*set-state': ['BlkdebugSetStateOptions'] } }
1503 # @BlockdevOptionsBlkverify
1505 # Driver specific block device options for blkverify.
1507 # @test:    block device to be tested
1509 # @raw:     raw image used for verification
1511 # Since: 2.0
1513 { 'type': 'BlockdevOptionsBlkverify',
1514   'data': { 'test': 'BlockdevRef',
1515             'raw': 'BlockdevRef' } }
1518 # @QuorumReadPattern
1520 # An enumeration of quorum read patterns.
1522 # @quorum: read all the children and do a quorum vote on reads
1524 # @fifo: read only from the first child that has not failed
1526 # Since: 2.2
1528 { 'enum': 'QuorumReadPattern', 'data': [ 'quorum', 'fifo' ] }
1531 # @BlockdevOptionsQuorum
1533 # Driver specific block device options for Quorum
1535 # @blkverify:      #optional true if the driver must print content mismatch
1536 #                  set to false by default
1538 # @children:       the children block devices to use
1540 # @vote-threshold: the vote limit under which a read will fail
1542 # @rewrite-corrupted: #optional rewrite corrupted data when quorum is reached
1543 #                     (Since 2.1)
1545 # @read-pattern: #optional choose read pattern and set to quorum by default
1546 #                (Since 2.2)
1548 # Since: 2.0
1550 { 'type': 'BlockdevOptionsQuorum',
1551   'data': { '*blkverify': 'bool',
1552             'children': [ 'BlockdevRef' ],
1553             'vote-threshold': 'int',
1554             '*rewrite-corrupted': 'bool',
1555             '*read-pattern': 'QuorumReadPattern' } }
1558 # @BlockdevOptions
1560 # Options for creating a block device.
1562 # Since: 1.7
1564 { 'union': 'BlockdevOptions',
1565   'base': 'BlockdevOptionsBase',
1566   'discriminator': 'driver',
1567   'data': {
1568       'archipelago':'BlockdevOptionsArchipelago',
1569       'blkdebug':   'BlockdevOptionsBlkdebug',
1570       'blkverify':  'BlockdevOptionsBlkverify',
1571       'bochs':      'BlockdevOptionsGenericFormat',
1572       'cloop':      'BlockdevOptionsGenericFormat',
1573       'dmg':        'BlockdevOptionsGenericFormat',
1574       'file':       'BlockdevOptionsFile',
1575       'ftp':        'BlockdevOptionsFile',
1576       'ftps':       'BlockdevOptionsFile',
1577 # TODO gluster: Wait for structured options
1578       'host_cdrom': 'BlockdevOptionsFile',
1579       'host_device':'BlockdevOptionsFile',
1580       'host_floppy':'BlockdevOptionsFile',
1581       'http':       'BlockdevOptionsFile',
1582       'https':      'BlockdevOptionsFile',
1583 # TODO iscsi: Wait for structured options
1584 # TODO nbd: Should take InetSocketAddress for 'host'?
1585 # TODO nfs: Wait for structured options
1586       'null-aio':   'BlockdevOptionsNull',
1587       'null-co':    'BlockdevOptionsNull',
1588       'parallels':  'BlockdevOptionsGenericFormat',
1589       'qcow2':      'BlockdevOptionsQcow2',
1590       'qcow':       'BlockdevOptionsGenericCOWFormat',
1591       'qed':        'BlockdevOptionsGenericCOWFormat',
1592       'quorum':     'BlockdevOptionsQuorum',
1593       'raw':        'BlockdevOptionsGenericFormat',
1594 # TODO rbd: Wait for structured options
1595 # TODO sheepdog: Wait for structured options
1596 # TODO ssh: Should take InetSocketAddress for 'host'?
1597       'tftp':       'BlockdevOptionsFile',
1598       'vdi':        'BlockdevOptionsGenericFormat',
1599       'vhdx':       'BlockdevOptionsGenericFormat',
1600       'vmdk':       'BlockdevOptionsGenericCOWFormat',
1601       'vpc':        'BlockdevOptionsGenericFormat',
1602       'vvfat':      'BlockdevOptionsVVFAT'
1603   } }
1606 # @BlockdevRef
1608 # Reference to a block device.
1610 # @definition:      defines a new block device inline
1611 # @reference:       references the ID of an existing block device. An
1612 #                   empty string means that no block device should be
1613 #                   referenced.
1615 # Since: 1.7
1617 { 'union': 'BlockdevRef',
1618   'discriminator': {},
1619   'data': { 'definition': 'BlockdevOptions',
1620             'reference': 'str' } }
1623 # @blockdev-add:
1625 # Creates a new block device.
1627 # @options: block device options for the new device
1629 # Since: 1.7
1631 { 'command': 'blockdev-add', 'data': { 'options': 'BlockdevOptions' } }
1635 # @BlockErrorAction
1637 # An enumeration of action that has been taken when a DISK I/O occurs
1639 # @ignore: error has been ignored
1641 # @report: error has been reported to the device
1643 # @stop: error caused VM to be stopped
1645 # Since: 2.1
1647 { 'enum': 'BlockErrorAction',
1648   'data': [ 'ignore', 'report', 'stop' ] }
1652 # @BLOCK_IMAGE_CORRUPTED
1654 # Emitted when a corruption has been detected in a disk image
1656 # @device: device name
1658 # @msg: informative message for human consumption, such as the kind of
1659 #       corruption being detected. It should not be parsed by machine as it is
1660 #       not guaranteed to be stable
1662 # @offset: #optional, if the corruption resulted from an image access, this is
1663 #          the access offset into the image
1665 # @size: #optional, if the corruption resulted from an image access, this is
1666 #        the access size
1668 # fatal: if set, the image is marked corrupt and therefore unusable after this
1669 #        event and must be repaired (Since 2.2; before, every
1670 #        BLOCK_IMAGE_CORRUPTED event was fatal)
1672 # Since: 1.7
1674 { 'event': 'BLOCK_IMAGE_CORRUPTED',
1675   'data': { 'device' : 'str',
1676             'msg'    : 'str',
1677             '*offset': 'int',
1678             '*size'  : 'int',
1679             'fatal'  : 'bool' } }
1682 # @BLOCK_IO_ERROR
1684 # Emitted when a disk I/O error occurs
1686 # @device: device name
1688 # @operation: I/O operation
1690 # @action: action that has been taken
1692 # @nospace: #optional true if I/O error was caused due to a no-space
1693 #           condition. This key is only present if query-block's
1694 #           io-status is present, please see query-block documentation
1695 #           for more information (since: 2.2)
1697 # @reason: human readable string describing the error cause.
1698 #          (This field is a debugging aid for humans, it should not
1699 #           be parsed by applications) (since: 2.2)
1701 # Note: If action is "stop", a STOP event will eventually follow the
1702 # BLOCK_IO_ERROR event
1704 # Since: 0.13.0
1706 { 'event': 'BLOCK_IO_ERROR',
1707   'data': { 'device': 'str', 'operation': 'IoOperationType',
1708             'action': 'BlockErrorAction', '*nospace': 'bool',
1709             'reason': 'str' } }
1712 # @BLOCK_JOB_COMPLETED
1714 # Emitted when a block job has completed
1716 # @type: job type
1718 # @device: device name
1720 # @len: maximum progress value
1722 # @offset: current progress value. On success this is equal to len.
1723 #          On failure this is less than len
1725 # @speed: rate limit, bytes per second
1727 # @error: #optional, error message. Only present on failure. This field
1728 #         contains a human-readable error message. There are no semantics
1729 #         other than that streaming has failed and clients should not try to
1730 #         interpret the error string
1732 # Since: 1.1
1734 { 'event': 'BLOCK_JOB_COMPLETED',
1735   'data': { 'type'  : 'BlockJobType',
1736             'device': 'str',
1737             'len'   : 'int',
1738             'offset': 'int',
1739             'speed' : 'int',
1740             '*error': 'str' } }
1743 # @BLOCK_JOB_CANCELLED
1745 # Emitted when a block job has been cancelled
1747 # @type: job type
1749 # @device: device name
1751 # @len: maximum progress value
1753 # @offset: current progress value. On success this is equal to len.
1754 #          On failure this is less than len
1756 # @speed: rate limit, bytes per second
1758 # Since: 1.1
1760 { 'event': 'BLOCK_JOB_CANCELLED',
1761   'data': { 'type'  : 'BlockJobType',
1762             'device': 'str',
1763             'len'   : 'int',
1764             'offset': 'int',
1765             'speed' : 'int' } }
1768 # @BLOCK_JOB_ERROR
1770 # Emitted when a block job encounters an error
1772 # @device: device name
1774 # @operation: I/O operation
1776 # @action: action that has been taken
1778 # Since: 1.3
1780 { 'event': 'BLOCK_JOB_ERROR',
1781   'data': { 'device'   : 'str',
1782             'operation': 'IoOperationType',
1783             'action'   : 'BlockErrorAction' } }
1786 # @BLOCK_JOB_READY
1788 # Emitted when a block job is ready to complete
1790 # @type: job type
1792 # @device: device name
1794 # @len: maximum progress value
1796 # @offset: current progress value. On success this is equal to len.
1797 #          On failure this is less than len
1799 # @speed: rate limit, bytes per second
1801 # Note: The "ready to complete" status is always reset by a @BLOCK_JOB_ERROR
1802 # event
1804 # Since: 1.3
1806 { 'event': 'BLOCK_JOB_READY',
1807   'data': { 'type'  : 'BlockJobType',
1808             'device': 'str',
1809             'len'   : 'int',
1810             'offset': 'int',
1811             'speed' : 'int' } }
1813 # @PreallocMode
1815 # Preallocation mode of QEMU image file
1817 # @off: no preallocation
1818 # @metadata: preallocate only for metadata
1819 # @falloc: like @full preallocation but allocate disk space by
1820 #          posix_fallocate() rather than writing zeros.
1821 # @full: preallocate all data by writing zeros to device to ensure disk
1822 #        space is really available. @full preallocation also sets up
1823 #        metadata correctly.
1825 # Since 2.2
1827 { 'enum': 'PreallocMode',
1828   'data': [ 'off', 'metadata', 'falloc', 'full' ] }