3 # QAPI block core definitions (vm unrelated)
5 # QAPI common definitions
6 { 'include': 'common.json' }
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
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 # @refcount-bits: width of a refcount entry in bits (since 2.3)
48 { 'type': 'ImageInfoSpecificQCow2',
51 '*lazy-refcounts': 'bool',
53 'refcount-bits': 'int'
57 # @ImageInfoSpecificVmdk:
59 # @create-type: The create type of VMDK image
61 # @cid: Content id of image
63 # @parent-cid: Parent VMDK image's cid
65 # @extents: List of extent files
69 { 'type': 'ImageInfoSpecificVmdk',
74 'extents': ['ImageInfo']
80 # A discriminated record of image format specific information structures.
85 { 'union': 'ImageInfoSpecific',
87 'qcow2': 'ImageInfoSpecificQCow2',
88 'vmdk': 'ImageInfoSpecificVmdk'
94 # Information about a QEMU image file
96 # @filename: name of the image file
98 # @format: format of the image file
100 # @virtual-size: maximum capacity in bytes of the image
102 # @actual-size: #optional actual size on disk in bytes of the image
104 # @dirty-flag: #optional true if image is not cleanly closed
106 # @cluster-size: #optional size of a cluster in bytes
108 # @encrypted: #optional true if the image is encrypted
110 # @compressed: #optional true if the image is compressed (Since 1.7)
112 # @backing-filename: #optional name of the backing file
114 # @full-backing-filename: #optional full path of the backing file
116 # @backing-filename-format: #optional the format of the backing file
118 # @snapshots: #optional list of VM snapshots
120 # @backing-image: #optional info of the backing image (since 1.6)
122 # @format-specific: #optional structure supplying additional format-specific
123 # information (since 1.7)
129 { 'type': 'ImageInfo',
130 'data': {'filename': 'str', 'format': 'str', '*dirty-flag': 'bool',
131 '*actual-size': 'int', 'virtual-size': 'int',
132 '*cluster-size': 'int', '*encrypted': 'bool', '*compressed': 'bool',
133 '*backing-filename': 'str', '*full-backing-filename': 'str',
134 '*backing-filename-format': 'str', '*snapshots': ['SnapshotInfo'],
135 '*backing-image': 'ImageInfo',
136 '*format-specific': 'ImageInfoSpecific' } }
141 # Information about a QEMU image file check
143 # @filename: name of the image file checked
145 # @format: format of the image file checked
147 # @check-errors: number of unexpected errors occurred during check
149 # @image-end-offset: #optional offset (in bytes) where the image ends, this
150 # field is present if the driver for the image format
153 # @corruptions: #optional number of corruptions found during the check if any
155 # @leaks: #optional number of leaks found during the check if any
157 # @corruptions-fixed: #optional number of corruptions fixed during the check
160 # @leaks-fixed: #optional number of leaks fixed during the check if any
162 # @total-clusters: #optional total number of clusters, this field is present
163 # if the driver for the image format supports it
165 # @allocated-clusters: #optional total number of allocated clusters, this
166 # field is present if the driver for the image format
169 # @fragmented-clusters: #optional total number of fragmented clusters, this
170 # field is present if the driver for the image format
173 # @compressed-clusters: #optional total number of compressed clusters, this
174 # field is present if the driver for the image format
181 { 'type': 'ImageCheck',
182 'data': {'filename': 'str', 'format': 'str', 'check-errors': 'int',
183 '*image-end-offset': 'int', '*corruptions': 'int', '*leaks': 'int',
184 '*corruptions-fixed': 'int', '*leaks-fixed': 'int',
185 '*total-clusters': 'int', '*allocated-clusters': 'int',
186 '*fragmented-clusters': 'int', '*compressed-clusters': 'int' } }
191 # Cache mode information for a block device
193 # @writeback: true if writeback mode is enabled
194 # @direct: true if the host page cache is bypassed (O_DIRECT)
195 # @no-flush: true if flush requests are ignored for the device
199 { 'type': 'BlockdevCacheInfo',
200 'data': { 'writeback': 'bool',
202 'no-flush': 'bool' } }
207 # Information about the backing device for a block device.
209 # @file: the filename of the backing device
211 # @node-name: #optional the name of the block driver node (Since 2.0)
213 # @ro: true if the backing device was open read-only
215 # @drv: the name of the block format used to open the backing device. As of
216 # 0.14.0 this can be: 'blkdebug', 'bochs', 'cloop', 'cow', 'dmg',
217 # 'file', 'file', 'ftp', 'ftps', 'host_cdrom', 'host_device',
218 # 'host_floppy', 'http', 'https', 'nbd', 'parallels', 'qcow',
219 # 'qcow2', 'raw', 'tftp', 'vdi', 'vmdk', 'vpc', 'vvfat'
220 # 2.2: 'archipelago' added, 'cow' dropped
221 # 2.3: 'host_floppy' deprecated
223 # @backing_file: #optional the name of the backing file (for copy-on-write)
225 # @backing_file_depth: number of files in the backing file chain (since: 1.2)
227 # @encrypted: true if the backing device is encrypted
229 # @encryption_key_missing: true if the backing device is encrypted but an
230 # valid encryption key is missing
232 # @detect_zeroes: detect and optimize zero writes (Since 2.1)
234 # @bps: total throughput limit in bytes per second is specified
236 # @bps_rd: read throughput limit in bytes per second is specified
238 # @bps_wr: write throughput limit in bytes per second is specified
240 # @iops: total I/O operations per second is specified
242 # @iops_rd: read I/O operations per second is specified
244 # @iops_wr: write I/O operations per second is specified
246 # @image: the info of image used (since: 1.6)
248 # @bps_max: #optional total max in bytes (Since 1.7)
250 # @bps_rd_max: #optional read max in bytes (Since 1.7)
252 # @bps_wr_max: #optional write max in bytes (Since 1.7)
254 # @iops_max: #optional total I/O operations max (Since 1.7)
256 # @iops_rd_max: #optional read I/O operations max (Since 1.7)
258 # @iops_wr_max: #optional write I/O operations max (Since 1.7)
260 # @iops_size: #optional an I/O size in bytes (Since 1.7)
262 # @cache: the cache mode used for the block device (since: 2.3)
264 # @write_threshold: configured write threshold for the device.
265 # 0 if disabled. (Since 2.3)
270 { 'type': 'BlockDeviceInfo',
271 'data': { 'file': 'str', '*node-name': 'str', 'ro': 'bool', 'drv': 'str',
272 '*backing_file': 'str', 'backing_file_depth': 'int',
273 'encrypted': 'bool', 'encryption_key_missing': 'bool',
274 'detect_zeroes': 'BlockdevDetectZeroesOptions',
275 'bps': 'int', 'bps_rd': 'int', 'bps_wr': 'int',
276 'iops': 'int', 'iops_rd': 'int', 'iops_wr': 'int',
277 'image': 'ImageInfo',
278 '*bps_max': 'int', '*bps_rd_max': 'int',
279 '*bps_wr_max': 'int', '*iops_max': 'int',
280 '*iops_rd_max': 'int', '*iops_wr_max': 'int',
281 '*iops_size': 'int', 'cache': 'BlockdevCacheInfo',
282 'write_threshold': 'int' } }
285 # @BlockDeviceIoStatus:
287 # An enumeration of block device I/O status.
289 # @ok: The last I/O operation has succeeded
291 # @failed: The last I/O operation has failed
293 # @nospace: The last I/O operation has failed due to a no-space condition
297 { 'enum': 'BlockDeviceIoStatus', 'data': [ 'ok', 'failed', 'nospace' ] }
300 # @BlockDeviceMapEntry:
302 # Entry in the metadata map of the device (returned by "qemu-img map")
304 # @start: Offset in the image of the first byte described by this entry
307 # @length: Length of the range described by this entry (in bytes)
309 # @depth: Number of layers (0 = top image, 1 = top image's backing file, etc.)
310 # before reaching one for which the range is allocated. The value is
311 # in the range 0 to the depth of the image chain - 1.
313 # @zero: the sectors in this range read as zeros
315 # @data: reading the image will actually read data from a file (in particular,
316 # if @offset is present this means that the sectors are not simply
317 # preallocated, but contain actual data in raw format)
319 # @offset: if present, the image file stores the data for this range in
320 # raw format at the given offset.
324 { 'type': 'BlockDeviceMapEntry',
325 'data': { 'start': 'int', 'length': 'int', 'depth': 'int', 'zero': 'bool',
326 'data': 'bool', '*offset': 'int' } }
331 # Block dirty bitmap information.
333 # @name: #optional the name of the dirty bitmap (Since 2.4)
335 # @count: number of dirty bytes according to the dirty bitmap
337 # @granularity: granularity of the dirty bitmap in bytes (since 1.4)
341 { 'type': 'BlockDirtyInfo',
342 'data': {'*name': 'str', 'count': 'int', 'granularity': 'uint32'} }
347 # Block device information. This structure describes a virtual device and
348 # the backing device associated with it.
350 # @device: The device name associated with the virtual device.
352 # @type: This field is returned only for compatibility reasons, it should
353 # not be used (always returns 'unknown')
355 # @removable: True if the device supports removable media.
357 # @locked: True if the guest has locked this device from having its media
360 # @tray_open: #optional True if the device has a tray and it is open
361 # (only present if removable is true)
363 # @dirty-bitmaps: #optional dirty bitmaps information (only present if the
364 # driver has one or more dirty bitmaps) (Since 2.0)
366 # @io-status: #optional @BlockDeviceIoStatus. Only present if the device
367 # supports it and the VM is configured to stop on errors
368 # (supported device models: virtio-blk, ide, scsi-disk)
370 # @inserted: #optional @BlockDeviceInfo describing the device if media is
375 { 'type': 'BlockInfo',
376 'data': {'device': 'str', 'type': 'str', 'removable': 'bool',
377 'locked': 'bool', '*inserted': 'BlockDeviceInfo',
378 '*tray_open': 'bool', '*io-status': 'BlockDeviceIoStatus',
379 '*dirty-bitmaps': ['BlockDirtyInfo'] } }
384 # Get a list of BlockInfo for all virtual block devices.
386 # Returns: a list of @BlockInfo describing each virtual block device
390 { 'command': 'query-block', 'returns': ['BlockInfo'] }
395 # Statistics of a virtual block device or a block backing device.
397 # @rd_bytes: The number of bytes read by the device.
399 # @wr_bytes: The number of bytes written by the device.
401 # @rd_operations: The number of read operations performed by the device.
403 # @wr_operations: The number of write operations performed by the device.
405 # @flush_operations: The number of cache flush operations performed by the
406 # device (since 0.15.0)
408 # @flush_total_time_ns: Total time spend on cache flushes in nano-seconds
411 # @wr_total_time_ns: Total time spend on writes in nano-seconds (since 0.15.0).
413 # @rd_total_time_ns: Total_time_spend on reads in nano-seconds (since 0.15.0).
415 # @wr_highest_offset: The offset after the greatest byte written to the
416 # device. The intended use of this information is for
417 # growable sparse files (like qcow2) that are used on top
418 # of a physical device.
420 # @rd_merged: Number of read requests that have been merged into another
421 # request (Since 2.3).
423 # @wr_merged: Number of write requests that have been merged into another
424 # request (Since 2.3).
428 { 'type': 'BlockDeviceStats',
429 'data': {'rd_bytes': 'int', 'wr_bytes': 'int', 'rd_operations': 'int',
430 'wr_operations': 'int', 'flush_operations': 'int',
431 'flush_total_time_ns': 'int', 'wr_total_time_ns': 'int',
432 'rd_total_time_ns': 'int', 'wr_highest_offset': 'int',
433 'rd_merged': 'int', 'wr_merged': 'int' } }
438 # Statistics of a virtual block device or a block backing device.
440 # @device: #optional If the stats are for a virtual block device, the name
441 # corresponding to the virtual block device.
443 # @node-name: #optional The node name of the device. (Since 2.3)
445 # @stats: A @BlockDeviceStats for the device.
447 # @parent: #optional This describes the file block device if it has one.
449 # @backing: #optional This describes the backing block device if it has one.
454 { 'type': 'BlockStats',
455 'data': {'*device': 'str', '*node-name': 'str',
456 'stats': 'BlockDeviceStats',
457 '*parent': 'BlockStats',
458 '*backing': 'BlockStats'} }
463 # Query the @BlockStats for all virtual block devices.
465 # @query-nodes: #optional If true, the command will query all the block nodes
466 # that have a node name, in a list which will include "parent"
467 # information, but not "backing".
468 # If false or omitted, the behavior is as before - query all the
469 # device backends, recursively including their "parent" and
470 # "backing". (Since 2.3)
472 # Returns: A list of @BlockStats for each virtual block devices.
476 { 'command': 'query-blockstats',
477 'data': { '*query-nodes': 'bool' },
478 'returns': ['BlockStats'] }
483 # An enumeration of possible behaviors for errors on I/O operations.
484 # The exact meaning depends on whether the I/O was initiated by a guest
487 # @report: for guest operations, report the error to the guest;
488 # for jobs, cancel the job
490 # @ignore: ignore the error, only report a QMP event (BLOCK_IO_ERROR
491 # or BLOCK_JOB_ERROR)
493 # @enospc: same as @stop on ENOSPC, same as @report otherwise.
495 # @stop: for guest operations, stop the virtual machine;
496 # for jobs, pause the job
500 { 'enum': 'BlockdevOnError',
501 'data': ['report', 'ignore', 'enospc', 'stop'] }
506 # An enumeration of possible behaviors for the initial synchronization
507 # phase of storage mirroring.
509 # @top: copies data in the topmost image to the destination
511 # @full: copies data from all images to the destination
513 # @none: only copy data written from now on
517 { 'enum': 'MirrorSyncMode',
518 'data': ['top', 'full', 'none'] }
523 # Type of a block job.
525 # @commit: block commit job type, see "block-commit"
527 # @stream: block stream job type, see "block-stream"
529 # @mirror: drive mirror job type, see "drive-mirror"
531 # @backup: drive backup job type, see "drive-backup"
535 { 'enum': 'BlockJobType',
536 'data': ['commit', 'stream', 'mirror', 'backup'] }
541 # Information about a long-running block device operation.
543 # @type: the job type ('stream' for image streaming)
545 # @device: the block device name
547 # @len: the maximum progress value
549 # @busy: false if the job is known to be in a quiescent state, with
550 # no pending I/O. Since 1.3.
552 # @paused: whether the job is paused or, if @busy is true, will
553 # pause itself as soon as possible. Since 1.3.
555 # @offset: the current progress value
557 # @speed: the rate limit, bytes per second
559 # @io-status: the status of the job (since 1.3)
561 # @ready: true if the job may be completed (since 2.2)
565 { 'type': 'BlockJobInfo',
566 'data': {'type': 'str', 'device': 'str', 'len': 'int',
567 'offset': 'int', 'busy': 'bool', 'paused': 'bool', 'speed': 'int',
568 'io-status': 'BlockDeviceIoStatus', 'ready': 'bool'} }
573 # Return information about long-running block device operations.
575 # Returns: a list of @BlockJobInfo for each active block job
579 { 'command': 'query-block-jobs', 'returns': ['BlockJobInfo'] }
584 # This command sets the password of a block device that has not been open
585 # with a password and requires one.
587 # The two cases where this can happen are a block device is created through
588 # QEMU's initial command line or a block device is changed through the legacy
591 # In the event that the block device is created through the initial command
592 # line, the VM will start in the stopped state regardless of whether '-S' is
593 # used. The intention is for a management tool to query the block devices to
594 # determine which ones are encrypted, set the passwords with this command, and
595 # then start the guest with the @cont command.
597 # Either @device or @node-name must be set but not both.
599 # @device: #optional the name of the block backend device to set the password on
601 # @node-name: #optional graph node name to set the password on (Since 2.0)
603 # @password: the password to use for the device
605 # Returns: nothing on success
606 # If @device is not a valid block device, DeviceNotFound
607 # If @device is not encrypted, DeviceNotEncrypted
609 # Notes: Not all block formats support encryption and some that do are not
610 # able to validate that a password is correct. Disk corruption may
611 # occur if an invalid password is specified.
615 { 'command': 'block_passwd', 'data': {'*device': 'str',
616 '*node-name': 'str', 'password': 'str'} }
621 # Resize a block image while a guest is running.
623 # Either @device or @node-name must be set but not both.
625 # @device: #optional the name of the device to get the image resized
627 # @node-name: #optional graph node name to get the image resized (Since 2.0)
629 # @size: new image size in bytes
631 # Returns: nothing on success
632 # If @device is not a valid block device, DeviceNotFound
636 { 'command': 'block_resize', 'data': { '*device': 'str',
643 # An enumeration that tells QEMU how to set the backing file path in
646 # @existing: QEMU should look for an existing image file.
648 # @absolute-paths: QEMU should create a new image with absolute paths
649 # for the backing file. If there is no backing file available, the new
650 # image will not be backed either.
654 { 'enum': 'NewImageMode',
655 'data': [ 'existing', 'absolute-paths' ] }
660 # Either @device or @node-name must be set but not both.
662 # @device: #optional the name of the device to generate the snapshot from.
664 # @node-name: #optional graph node name to generate the snapshot from (Since 2.0)
666 # @snapshot-file: the target of the new image. A new file will be created.
668 # @snapshot-node-name: #optional the graph node name of the new image (Since 2.0)
670 # @format: #optional the format of the snapshot image, default is 'qcow2'.
672 # @mode: #optional whether and how QEMU should create a new image, default is
675 { 'type': 'BlockdevSnapshot',
676 'data': { '*device': 'str', '*node-name': 'str',
677 'snapshot-file': 'str', '*snapshot-node-name': 'str',
678 '*format': 'str', '*mode': 'NewImageMode' } }
683 # @device: the name of the device which should be copied.
685 # @target: the target of the new image. If the file exists, or if it
686 # is a device, the existing file/device will be used as the new
687 # destination. If it does not exist, a new file will be created.
689 # @format: #optional the format of the new destination, default is to
690 # probe if @mode is 'existing', else the format of the source
692 # @sync: what parts of the disk image should be copied to the destination
693 # (all the disk, only the sectors allocated in the topmost image, or
696 # @mode: #optional whether and how QEMU should create a new image, default is
699 # @speed: #optional the maximum speed, in bytes per second
701 # @on-source-error: #optional the action to take on an error on the source,
702 # default 'report'. 'stop' and 'enospc' can only be used
703 # if the block device supports io-status (see BlockInfo).
705 # @on-target-error: #optional the action to take on an error on the target,
706 # default 'report' (no limitations, since this applies to
707 # a different block device than @device).
709 # Note that @on-source-error and @on-target-error only affect background I/O.
710 # If an error occurs during a guest write request, the device's rerror/werror
711 # actions will be used.
715 { 'type': 'DriveBackup',
716 'data': { 'device': 'str', 'target': 'str', '*format': 'str',
717 'sync': 'MirrorSyncMode', '*mode': 'NewImageMode',
719 '*on-source-error': 'BlockdevOnError',
720 '*on-target-error': 'BlockdevOnError' } }
725 # @device: the name of the device which should be copied.
727 # @target: the name of the backup target device.
729 # @sync: what parts of the disk image should be copied to the destination
730 # (all the disk, only the sectors allocated in the topmost image, or
733 # @speed: #optional the maximum speed, in bytes per second. The default is 0,
736 # @on-source-error: #optional the action to take on an error on the source,
737 # default 'report'. 'stop' and 'enospc' can only be used
738 # if the block device supports io-status (see BlockInfo).
740 # @on-target-error: #optional the action to take on an error on the target,
741 # default 'report' (no limitations, since this applies to
742 # a different block device than @device).
744 # Note that @on-source-error and @on-target-error only affect background I/O.
745 # If an error occurs during a guest write request, the device's rerror/werror
746 # actions will be used.
750 { 'type': 'BlockdevBackup',
751 'data': { 'device': 'str', 'target': 'str',
752 'sync': 'MirrorSyncMode',
754 '*on-source-error': 'BlockdevOnError',
755 '*on-target-error': 'BlockdevOnError' } }
758 # @blockdev-snapshot-sync
760 # Generates a synchronous snapshot of a block device.
762 # For the arguments, see the documentation of BlockdevSnapshot.
764 # Returns: nothing on success
765 # If @device is not a valid block device, DeviceNotFound
769 { 'command': 'blockdev-snapshot-sync',
770 'data': 'BlockdevSnapshot' }
773 # @change-backing-file
775 # Change the backing file in the image file metadata. This does not
776 # cause QEMU to reopen the image file to reparse the backing filename
777 # (it may, however, perform a reopen to change permissions from
778 # r/o -> r/w -> r/o, if needed). The new backing file string is written
779 # into the image file metadata, and the QEMU internal strings are
782 # @image-node-name: The name of the block driver state node of the
785 # @device: The name of the device that owns image-node-name.
787 # @backing-file: The string to write as the backing file. This
788 # string is not validated, so care should be taken
789 # when specifying the string or the image chain may
790 # not be able to be reopened again.
794 { 'command': 'change-backing-file',
795 'data': { 'device': 'str', 'image-node-name': 'str',
796 'backing-file': 'str' } }
801 # Live commit of data from overlay image nodes into backing nodes - i.e.,
802 # writes data between 'top' and 'base' into 'base'.
804 # @device: the name of the device
806 # @base: #optional The file name of the backing image to write data into.
807 # If not specified, this is the deepest backing image
809 # @top: #optional The file name of the backing image within the image chain,
810 # which contains the topmost data to be committed down. If
811 # not specified, this is the active layer.
813 # @backing-file: #optional The backing file string to write into the overlay
814 # image of 'top'. If 'top' is the active layer,
815 # specifying a backing file string is an error. This
816 # filename is not validated.
818 # If a pathname string is such that it cannot be
819 # resolved by QEMU, that means that subsequent QMP or
820 # HMP commands must use node-names for the image in
821 # question, as filename lookup methods will fail.
823 # If not specified, QEMU will automatically determine
824 # the backing file string to use, or error out if
825 # there is no obvious choice. Care should be taken
826 # when specifying the string, to specify a valid
827 # filename or protocol.
830 # If top == base, that is an error.
831 # If top == active, the job will not be completed by itself,
832 # user needs to complete the job with the block-job-complete
833 # command after getting the ready event. (Since 2.0)
835 # If the base image is smaller than top, then the base image
836 # will be resized to be the same size as top. If top is
837 # smaller than the base image, the base will not be
838 # truncated. If you want the base image size to match the
839 # size of the smaller top, you can safely truncate it
840 # yourself once the commit operation successfully completes.
842 # @speed: #optional the maximum speed, in bytes per second
844 # Returns: Nothing on success
845 # If commit or stream is already active on this device, DeviceInUse
846 # If @device does not exist, DeviceNotFound
847 # If image commit is not supported by this device, NotSupported
848 # If @base or @top is invalid, a generic error is returned
849 # If @speed is invalid, InvalidParameter
854 { 'command': 'block-commit',
855 'data': { 'device': 'str', '*base': 'str', '*top': 'str',
856 '*backing-file': 'str', '*speed': 'int' } }
861 # Start a point-in-time copy of a block device to a new destination. The
862 # status of ongoing drive-backup operations can be checked with
863 # query-block-jobs where the BlockJobInfo.type field has the value 'backup'.
864 # The operation can be stopped before it has completed using the
865 # block-job-cancel command.
867 # For the arguments, see the documentation of DriveBackup.
869 # Returns: nothing on success
870 # If @device is not a valid block device, DeviceNotFound
874 { 'command': 'drive-backup', 'data': 'DriveBackup' }
879 # Start a point-in-time copy of a block device to a new destination. The
880 # status of ongoing blockdev-backup operations can be checked with
881 # query-block-jobs where the BlockJobInfo.type field has the value 'backup'.
882 # The operation can be stopped before it has completed using the
883 # block-job-cancel command.
885 # For the arguments, see the documentation of BlockdevBackup.
889 { 'command': 'blockdev-backup', 'data': 'BlockdevBackup' }
893 # @query-named-block-nodes
895 # Get the named block driver list
897 # Returns: the list of BlockDeviceInfo
901 { 'command': 'query-named-block-nodes', 'returns': [ 'BlockDeviceInfo' ] }
906 # Start mirroring a block device's writes to a new destination.
908 # @device: the name of the device whose writes should be mirrored.
910 # @target: the target of the new image. If the file exists, or if it
911 # is a device, the existing file/device will be used as the new
912 # destination. If it does not exist, a new file will be created.
914 # @format: #optional the format of the new destination, default is to
915 # probe if @mode is 'existing', else the format of the source
917 # @node-name: #optional the new block driver state node name in the graph
920 # @replaces: #optional with sync=full graph node name to be replaced by the new
921 # image when a whole image copy is done. This can be used to repair
922 # broken Quorum files. (Since 2.1)
924 # @mode: #optional whether and how QEMU should create a new image, default is
927 # @speed: #optional the maximum speed, in bytes per second
929 # @sync: what parts of the disk image should be copied to the destination
930 # (all the disk, only the sectors allocated in the topmost image, or
933 # @granularity: #optional granularity of the dirty bitmap, default is 64K
934 # if the image format doesn't have clusters, 4K if the clusters
935 # are smaller than that, else the cluster size. Must be a
936 # power of 2 between 512 and 64M (since 1.4).
938 # @buf-size: #optional maximum amount of data in flight from source to
939 # target (since 1.4).
941 # @on-source-error: #optional the action to take on an error on the source,
942 # default 'report'. 'stop' and 'enospc' can only be used
943 # if the block device supports io-status (see BlockInfo).
945 # @on-target-error: #optional the action to take on an error on the target,
946 # default 'report' (no limitations, since this applies to
947 # a different block device than @device).
949 # Returns: nothing on success
950 # If @device is not a valid block device, DeviceNotFound
954 { 'command': 'drive-mirror',
955 'data': { 'device': 'str', 'target': 'str', '*format': 'str',
956 '*node-name': 'str', '*replaces': 'str',
957 'sync': 'MirrorSyncMode', '*mode': 'NewImageMode',
958 '*speed': 'int', '*granularity': 'uint32',
959 '*buf-size': 'int', '*on-source-error': 'BlockdevOnError',
960 '*on-target-error': 'BlockdevOnError' } }
965 # @node: name of device/node which the bitmap is tracking
967 # @name: name of the dirty bitmap
971 { 'type': 'BlockDirtyBitmap',
972 'data': { 'node': 'str', 'name': 'str' } }
975 # @BlockDirtyBitmapAdd
977 # @node: name of device/node which the bitmap is tracking
979 # @name: name of the dirty bitmap
981 # @granularity: #optional the bitmap granularity, default is 64k for
982 # block-dirty-bitmap-add
986 { 'type': 'BlockDirtyBitmapAdd',
987 'data': { 'node': 'str', 'name': 'str', '*granularity': 'uint32' } }
990 # @block-dirty-bitmap-add
992 # Create a dirty bitmap with a name on the node
994 # Returns: nothing on success
995 # If @node is not a valid block device or node, DeviceNotFound
996 # If @name is already taken, GenericError with an explanation
1000 { 'command': 'block-dirty-bitmap-add',
1001 'data': 'BlockDirtyBitmapAdd' }
1004 # @block-dirty-bitmap-remove
1006 # Remove a dirty bitmap on the node
1008 # Returns: nothing on success
1009 # If @node is not a valid block device or node, DeviceNotFound
1010 # If @name is not found, GenericError with an explanation
1014 { 'command': 'block-dirty-bitmap-remove',
1015 'data': 'BlockDirtyBitmap' }
1018 # @block_set_io_throttle:
1020 # Change I/O throttle limits for a block drive.
1022 # @device: The name of the device
1024 # @bps: total throughput limit in bytes per second
1026 # @bps_rd: read throughput limit in bytes per second
1028 # @bps_wr: write throughput limit in bytes per second
1030 # @iops: total I/O operations per second
1032 # @ops_rd: read I/O operations per second
1034 # @iops_wr: write I/O operations per second
1036 # @bps_max: #optional total max in bytes (Since 1.7)
1038 # @bps_rd_max: #optional read max in bytes (Since 1.7)
1040 # @bps_wr_max: #optional write max in bytes (Since 1.7)
1042 # @iops_max: #optional total I/O operations max (Since 1.7)
1044 # @iops_rd_max: #optional read I/O operations max (Since 1.7)
1046 # @iops_wr_max: #optional write I/O operations max (Since 1.7)
1048 # @iops_size: #optional an I/O size in bytes (Since 1.7)
1050 # Returns: Nothing on success
1051 # If @device is not a valid block device, DeviceNotFound
1055 { 'command': 'block_set_io_throttle',
1056 'data': { 'device': 'str', 'bps': 'int', 'bps_rd': 'int', 'bps_wr': 'int',
1057 'iops': 'int', 'iops_rd': 'int', 'iops_wr': 'int',
1058 '*bps_max': 'int', '*bps_rd_max': 'int',
1059 '*bps_wr_max': 'int', '*iops_max': 'int',
1060 '*iops_rd_max': 'int', '*iops_wr_max': 'int',
1061 '*iops_size': 'int' } }
1066 # Copy data from a backing file into a block device.
1068 # The block streaming operation is performed in the background until the entire
1069 # backing file has been copied. This command returns immediately once streaming
1070 # has started. The status of ongoing block streaming operations can be checked
1071 # with query-block-jobs. The operation can be stopped before it has completed
1072 # using the block-job-cancel command.
1074 # If a base file is specified then sectors are not copied from that base file and
1075 # its backing chain. When streaming completes the image file will have the base
1076 # file as its backing file. This can be used to stream a subset of the backing
1077 # file chain instead of flattening the entire image.
1079 # On successful completion the image file is updated to drop the backing file
1080 # and the BLOCK_JOB_COMPLETED event is emitted.
1082 # @device: the device name
1084 # @base: #optional the common backing file name
1086 # @backing-file: #optional The backing file string to write into the active
1087 # layer. This filename is not validated.
1089 # If a pathname string is such that it cannot be
1090 # resolved by QEMU, that means that subsequent QMP or
1091 # HMP commands must use node-names for the image in
1092 # question, as filename lookup methods will fail.
1094 # If not specified, QEMU will automatically determine
1095 # the backing file string to use, or error out if there
1096 # is no obvious choice. Care should be taken when
1097 # specifying the string, to specify a valid filename or
1101 # @speed: #optional the maximum speed, in bytes per second
1103 # @on-error: #optional the action to take on an error (default report).
1104 # 'stop' and 'enospc' can only be used if the block device
1105 # supports io-status (see BlockInfo). Since 1.3.
1107 # Returns: Nothing on success
1108 # If @device does not exist, DeviceNotFound
1112 { 'command': 'block-stream',
1113 'data': { 'device': 'str', '*base': 'str', '*backing-file': 'str',
1114 '*speed': 'int', '*on-error': 'BlockdevOnError' } }
1117 # @block-job-set-speed:
1119 # Set maximum speed for a background block operation.
1121 # This command can only be issued when there is an active block job.
1123 # Throttling can be disabled by setting the speed to 0.
1125 # @device: the device name
1127 # @speed: the maximum speed, in bytes per second, or 0 for unlimited.
1130 # Returns: Nothing on success
1131 # If no background operation is active on this device, DeviceNotActive
1135 { 'command': 'block-job-set-speed',
1136 'data': { 'device': 'str', 'speed': 'int' } }
1139 # @block-job-cancel:
1141 # Stop an active background block operation.
1143 # This command returns immediately after marking the active background block
1144 # operation for cancellation. It is an error to call this command if no
1145 # operation is in progress.
1147 # The operation will cancel as soon as possible and then emit the
1148 # BLOCK_JOB_CANCELLED event. Before that happens the job is still visible when
1149 # enumerated using query-block-jobs.
1151 # For streaming, the image file retains its backing file unless the streaming
1152 # operation happens to complete just as it is being cancelled. A new streaming
1153 # operation can be started at a later time to finish copying all data from the
1156 # @device: the device name
1158 # @force: #optional whether to allow cancellation of a paused job (default
1159 # false). Since 1.3.
1161 # Returns: Nothing on success
1162 # If no background operation is active on this device, DeviceNotActive
1166 { 'command': 'block-job-cancel', 'data': { 'device': 'str', '*force': 'bool' } }
1171 # Pause an active background block operation.
1173 # This command returns immediately after marking the active background block
1174 # operation for pausing. It is an error to call this command if no
1175 # operation is in progress. Pausing an already paused job has no cumulative
1176 # effect; a single block-job-resume command will resume the job.
1178 # The operation will pause as soon as possible. No event is emitted when
1179 # the operation is actually paused. Cancelling a paused job automatically
1182 # @device: the device name
1184 # Returns: Nothing on success
1185 # If no background operation is active on this device, DeviceNotActive
1189 { 'command': 'block-job-pause', 'data': { 'device': 'str' } }
1192 # @block-job-resume:
1194 # Resume an active background block operation.
1196 # This command returns immediately after resuming a paused background block
1197 # operation. It is an error to call this command if no operation is in
1198 # progress. Resuming an already running job is not an error.
1200 # This command also clears the error status of the job.
1202 # @device: the device name
1204 # Returns: Nothing on success
1205 # If no background operation is active on this device, DeviceNotActive
1209 { 'command': 'block-job-resume', 'data': { 'device': 'str' } }
1212 # @block-job-complete:
1214 # Manually trigger completion of an active background block operation. This
1215 # is supported for drive mirroring, where it also switches the device to
1216 # write to the target path only. The ability to complete is signaled with
1217 # a BLOCK_JOB_READY event.
1219 # This command completes an active background block operation synchronously.
1220 # The ordering of this command's return with the BLOCK_JOB_COMPLETED event
1221 # is not defined. Note that if an I/O error occurs during the processing of
1222 # this command: 1) the command itself will fail; 2) the error will be processed
1223 # according to the rerror/werror arguments that were specified when starting
1226 # A cancelled or paused job cannot be completed.
1228 # @device: the device name
1230 # Returns: Nothing on success
1231 # If no background operation is active on this device, DeviceNotActive
1235 { 'command': 'block-job-complete', 'data': { 'device': 'str' } }
1238 # @BlockdevDiscardOptions
1240 # Determines how to handle discard requests.
1242 # @ignore: Ignore the request
1243 # @unmap: Forward as an unmap request
1247 { 'enum': 'BlockdevDiscardOptions',
1248 'data': [ 'ignore', 'unmap' ] }
1251 # @BlockdevDetectZeroesOptions
1253 # Describes the operation mode for the automatic conversion of plain
1254 # zero writes by the OS to driver specific optimized zero write commands.
1256 # @off: Disabled (default)
1258 # @unmap: Enabled and even try to unmap blocks if possible. This requires
1259 # also that @BlockdevDiscardOptions is set to unmap for this device.
1263 { 'enum': 'BlockdevDetectZeroesOptions',
1264 'data': [ 'off', 'on', 'unmap' ] }
1267 # @BlockdevAioOptions
1269 # Selects the AIO backend to handle I/O requests
1271 # @threads: Use qemu's thread pool
1272 # @native: Use native AIO backend (only Linux and Windows)
1276 { 'enum': 'BlockdevAioOptions',
1277 'data': [ 'threads', 'native' ] }
1280 # @BlockdevCacheOptions
1282 # Includes cache-related options for block devices
1284 # @writeback: #optional enables writeback mode for any caches (default: true)
1285 # @direct: #optional enables use of O_DIRECT (bypass the host page cache;
1287 # @no-flush: #optional ignore any flush requests for the device (default:
1292 { 'type': 'BlockdevCacheOptions',
1293 'data': { '*writeback': 'bool',
1295 '*no-flush': 'bool' } }
1300 # Drivers that are supported in block device operations.
1302 # @host_device, @host_cdrom, @host_floppy: Since 2.1
1303 # @host_floppy: deprecated since 2.3
1307 { 'enum': 'BlockdevDriver',
1308 'data': [ 'archipelago', 'blkdebug', 'blkverify', 'bochs', 'cloop',
1309 'dmg', 'file', 'ftp', 'ftps', 'host_cdrom', 'host_device',
1310 'host_floppy', 'http', 'https', 'null-aio', 'null-co', 'parallels',
1311 'qcow', 'qcow2', 'qed', 'quorum', 'raw', 'tftp', 'vdi', 'vhdx',
1312 'vmdk', 'vpc', 'vvfat' ] }
1315 # @BlockdevOptionsBase
1317 # Options that are available for all block devices, independent of the block
1320 # @driver: block driver name
1321 # @id: #optional id by which the new block device can be referred to.
1322 # This is a required option on the top level of blockdev-add, and
1323 # currently not allowed on any other level.
1324 # @node-name: #optional the name of a block driver state node (Since 2.0)
1325 # @discard: #optional discard-related options (default: ignore)
1326 # @cache: #optional cache-related options
1327 # @aio: #optional AIO backend (default: threads)
1328 # @rerror: #optional how to handle read errors on the device
1330 # @werror: #optional how to handle write errors on the device
1332 # @read-only: #optional whether the block device should be read-only
1334 # @detect-zeroes: #optional detect and optimize zero writes (Since 2.1)
1339 { 'type': 'BlockdevOptionsBase',
1340 'data': { 'driver': 'BlockdevDriver',
1342 '*node-name': 'str',
1343 '*discard': 'BlockdevDiscardOptions',
1344 '*cache': 'BlockdevCacheOptions',
1345 '*aio': 'BlockdevAioOptions',
1346 '*rerror': 'BlockdevOnError',
1347 '*werror': 'BlockdevOnError',
1348 '*read-only': 'bool',
1349 '*detect-zeroes': 'BlockdevDetectZeroesOptions' } }
1352 # @BlockdevOptionsFile
1354 # Driver specific block device options for the file backend and similar
1357 # @filename: path to the image file
1361 { 'type': 'BlockdevOptionsFile',
1362 'data': { 'filename': 'str' } }
1365 # @BlockdevOptionsNull
1367 # Driver specific block device options for the null backend.
1369 # @size: #optional size of the device in bytes.
1370 # @latency-ns: #optional emulated latency (in nanoseconds) in processing
1371 # requests. Default to zero which completes requests immediately.
1376 { 'type': 'BlockdevOptionsNull',
1377 'data': { '*size': 'int', '*latency-ns': 'uint64' } }
1380 # @BlockdevOptionsVVFAT
1382 # Driver specific block device options for the vvfat protocol.
1384 # @dir: directory to be exported as FAT image
1385 # @fat-type: #optional FAT type: 12, 16 or 32
1386 # @floppy: #optional whether to export a floppy image (true) or
1387 # partitioned hard disk (false; default)
1388 # @rw: #optional whether to allow write operations (default: false)
1392 { 'type': 'BlockdevOptionsVVFAT',
1393 'data': { 'dir': 'str', '*fat-type': 'int', '*floppy': 'bool',
1397 # @BlockdevOptionsGenericFormat
1399 # Driver specific block device options for image format that have no option
1400 # besides their data source.
1402 # @file: reference to or definition of the data source block device
1406 { 'type': 'BlockdevOptionsGenericFormat',
1407 'data': { 'file': 'BlockdevRef' } }
1410 # @BlockdevOptionsGenericCOWFormat
1412 # Driver specific block device options for image format that have no option
1413 # besides their data source and an optional backing file.
1415 # @backing: #optional reference to or definition of the backing file block
1416 # device (if missing, taken from the image file content). It is
1417 # allowed to pass an empty string here in order to disable the
1418 # default backing file.
1422 { 'type': 'BlockdevOptionsGenericCOWFormat',
1423 'base': 'BlockdevOptionsGenericFormat',
1424 'data': { '*backing': 'BlockdevRef' } }
1427 # @Qcow2OverlapCheckMode
1429 # General overlap check modes.
1431 # @none: Do not perform any checks
1433 # @constant: Perform only checks which can be done in constant time and
1434 # without reading anything from disk
1436 # @cached: Perform only checks which can be done without reading anything
1439 # @all: Perform all available overlap checks
1443 { 'enum': 'Qcow2OverlapCheckMode',
1444 'data': [ 'none', 'constant', 'cached', 'all' ] }
1447 # @Qcow2OverlapCheckFlags
1449 # Structure of flags for each metadata structure. Setting a field to 'true'
1450 # makes qemu guard that structure against unintended overwriting. The default
1451 # value is chosen according to the template given.
1453 # @template: Specifies a template mode which can be adjusted using the other
1454 # flags, defaults to 'cached'
1458 { 'type': 'Qcow2OverlapCheckFlags',
1459 'data': { '*template': 'Qcow2OverlapCheckMode',
1460 '*main-header': 'bool',
1461 '*active-l1': 'bool',
1462 '*active-l2': 'bool',
1463 '*refcount-table': 'bool',
1464 '*refcount-block': 'bool',
1465 '*snapshot-table': 'bool',
1466 '*inactive-l1': 'bool',
1467 '*inactive-l2': 'bool' } }
1470 # @Qcow2OverlapChecks
1472 # Specifies which metadata structures should be guarded against unintended
1475 # @flags: set of flags for separate specification of each metadata structure
1478 # @mode: named mode which chooses a specific set of flags
1482 { 'union': 'Qcow2OverlapChecks',
1483 'discriminator': {},
1484 'data': { 'flags': 'Qcow2OverlapCheckFlags',
1485 'mode': 'Qcow2OverlapCheckMode' } }
1488 # @BlockdevOptionsQcow2
1490 # Driver specific block device options for qcow2.
1492 # @lazy-refcounts: #optional whether to enable the lazy refcounts
1493 # feature (default is taken from the image file)
1495 # @pass-discard-request: #optional whether discard requests to the qcow2
1496 # device should be forwarded to the data source
1498 # @pass-discard-snapshot: #optional whether discard requests for the data source
1499 # should be issued when a snapshot operation (e.g.
1500 # deleting a snapshot) frees clusters in the qcow2 file
1502 # @pass-discard-other: #optional whether discard requests for the data source
1503 # should be issued on other occasions where a cluster
1506 # @overlap-check: #optional which overlap checks to perform for writes
1507 # to the image, defaults to 'cached' (since 2.2)
1509 # @cache-size: #optional the maximum total size of the L2 table and
1510 # refcount block caches in bytes (since 2.2)
1512 # @l2-cache-size: #optional the maximum size of the L2 table cache in
1515 # @refcount-cache-size: #optional the maximum size of the refcount block cache
1516 # in bytes (since 2.2)
1520 { 'type': 'BlockdevOptionsQcow2',
1521 'base': 'BlockdevOptionsGenericCOWFormat',
1522 'data': { '*lazy-refcounts': 'bool',
1523 '*pass-discard-request': 'bool',
1524 '*pass-discard-snapshot': 'bool',
1525 '*pass-discard-other': 'bool',
1526 '*overlap-check': 'Qcow2OverlapChecks',
1527 '*cache-size': 'int',
1528 '*l2-cache-size': 'int',
1529 '*refcount-cache-size': 'int' } }
1533 # @BlockdevOptionsArchipelago
1535 # Driver specific block device options for Archipelago.
1537 # @volume: Name of the Archipelago volume image
1539 # @mport: #optional The port number on which mapperd is
1540 # listening. This is optional
1541 # and if not specified, QEMU will make Archipelago
1542 # use the default port (1001).
1544 # @vport: #optional The port number on which vlmcd is
1545 # listening. This is optional
1546 # and if not specified, QEMU will make Archipelago
1547 # use the default port (501).
1549 # @segment: #optional The name of the shared memory segment
1550 # Archipelago stack is using. This is optional
1551 # and if not specified, QEMU will make Archipelago
1552 # use the default value, 'archipelago'.
1555 { 'type': 'BlockdevOptionsArchipelago',
1556 'data': { 'volume': 'str',
1559 '*segment': 'str' } }
1565 # Trigger events supported by blkdebug.
1567 { 'enum': 'BlkdebugEvent',
1568 'data': [ 'l1_update', 'l1_grow.alloc_table', 'l1_grow.write_table',
1569 'l1_grow.activate_table', 'l2_load', 'l2_update',
1570 'l2_update_compressed', 'l2_alloc.cow_read', 'l2_alloc.write',
1571 'read_aio', 'read_backing_aio', 'read_compressed', 'write_aio',
1572 'write_compressed', 'vmstate_load', 'vmstate_save', 'cow_read',
1573 'cow_write', 'reftable_load', 'reftable_grow', 'reftable_update',
1574 'refblock_load', 'refblock_update', 'refblock_update_part',
1575 'refblock_alloc', 'refblock_alloc.hookup', 'refblock_alloc.write',
1576 'refblock_alloc.write_blocks', 'refblock_alloc.write_table',
1577 'refblock_alloc.switch_table', 'cluster_alloc',
1578 'cluster_alloc_bytes', 'cluster_free', 'flush_to_os',
1579 'flush_to_disk', 'pwritev_rmw.head', 'pwritev_rmw.after_head',
1580 'pwritev_rmw.tail', 'pwritev_rmw.after_tail', 'pwritev',
1581 'pwritev_zero', 'pwritev_done', 'empty_image_prepare' ] }
1584 # @BlkdebugInjectErrorOptions
1586 # Describes a single error injection for blkdebug.
1588 # @event: trigger event
1590 # @state: #optional the state identifier blkdebug needs to be in to
1591 # actually trigger the event; defaults to "any"
1593 # @errno: #optional error identifier (errno) to be returned; defaults to
1596 # @sector: #optional specifies the sector index which has to be affected
1597 # in order to actually trigger the event; defaults to "any
1600 # @once: #optional disables further events after this one has been
1601 # triggered; defaults to false
1603 # @immediately: #optional fail immediately; defaults to false
1607 { 'type': 'BlkdebugInjectErrorOptions',
1608 'data': { 'event': 'BlkdebugEvent',
1613 '*immediately': 'bool' } }
1616 # @BlkdebugSetStateOptions
1618 # Describes a single state-change event for blkdebug.
1620 # @event: trigger event
1622 # @state: #optional the current state identifier blkdebug needs to be in;
1625 # @new_state: the state identifier blkdebug is supposed to assume if
1626 # this event is triggered
1630 { 'type': 'BlkdebugSetStateOptions',
1631 'data': { 'event': 'BlkdebugEvent',
1633 'new_state': 'int' } }
1636 # @BlockdevOptionsBlkdebug
1638 # Driver specific block device options for blkdebug.
1640 # @image: underlying raw block device (or image file)
1642 # @config: #optional filename of the configuration file
1644 # @align: #optional required alignment for requests in bytes
1646 # @inject-error: #optional array of error injection descriptions
1648 # @set-state: #optional array of state-change descriptions
1652 { 'type': 'BlockdevOptionsBlkdebug',
1653 'data': { 'image': 'BlockdevRef',
1656 '*inject-error': ['BlkdebugInjectErrorOptions'],
1657 '*set-state': ['BlkdebugSetStateOptions'] } }
1660 # @BlockdevOptionsBlkverify
1662 # Driver specific block device options for blkverify.
1664 # @test: block device to be tested
1666 # @raw: raw image used for verification
1670 { 'type': 'BlockdevOptionsBlkverify',
1671 'data': { 'test': 'BlockdevRef',
1672 'raw': 'BlockdevRef' } }
1675 # @QuorumReadPattern
1677 # An enumeration of quorum read patterns.
1679 # @quorum: read all the children and do a quorum vote on reads
1681 # @fifo: read only from the first child that has not failed
1685 { 'enum': 'QuorumReadPattern', 'data': [ 'quorum', 'fifo' ] }
1688 # @BlockdevOptionsQuorum
1690 # Driver specific block device options for Quorum
1692 # @blkverify: #optional true if the driver must print content mismatch
1693 # set to false by default
1695 # @children: the children block devices to use
1697 # @vote-threshold: the vote limit under which a read will fail
1699 # @rewrite-corrupted: #optional rewrite corrupted data when quorum is reached
1702 # @read-pattern: #optional choose read pattern and set to quorum by default
1707 { 'type': 'BlockdevOptionsQuorum',
1708 'data': { '*blkverify': 'bool',
1709 'children': [ 'BlockdevRef' ],
1710 'vote-threshold': 'int',
1711 '*rewrite-corrupted': 'bool',
1712 '*read-pattern': 'QuorumReadPattern' } }
1717 # Options for creating a block device.
1721 { 'union': 'BlockdevOptions',
1722 'base': 'BlockdevOptionsBase',
1723 'discriminator': 'driver',
1725 'archipelago':'BlockdevOptionsArchipelago',
1726 'blkdebug': 'BlockdevOptionsBlkdebug',
1727 'blkverify': 'BlockdevOptionsBlkverify',
1728 'bochs': 'BlockdevOptionsGenericFormat',
1729 'cloop': 'BlockdevOptionsGenericFormat',
1730 'dmg': 'BlockdevOptionsGenericFormat',
1731 'file': 'BlockdevOptionsFile',
1732 'ftp': 'BlockdevOptionsFile',
1733 'ftps': 'BlockdevOptionsFile',
1734 # TODO gluster: Wait for structured options
1735 'host_cdrom': 'BlockdevOptionsFile',
1736 'host_device':'BlockdevOptionsFile',
1737 'host_floppy':'BlockdevOptionsFile',
1738 'http': 'BlockdevOptionsFile',
1739 'https': 'BlockdevOptionsFile',
1740 # TODO iscsi: Wait for structured options
1741 # TODO nbd: Should take InetSocketAddress for 'host'?
1742 # TODO nfs: Wait for structured options
1743 'null-aio': 'BlockdevOptionsNull',
1744 'null-co': 'BlockdevOptionsNull',
1745 'parallels': 'BlockdevOptionsGenericFormat',
1746 'qcow2': 'BlockdevOptionsQcow2',
1747 'qcow': 'BlockdevOptionsGenericCOWFormat',
1748 'qed': 'BlockdevOptionsGenericCOWFormat',
1749 'quorum': 'BlockdevOptionsQuorum',
1750 'raw': 'BlockdevOptionsGenericFormat',
1751 # TODO rbd: Wait for structured options
1752 # TODO sheepdog: Wait for structured options
1753 # TODO ssh: Should take InetSocketAddress for 'host'?
1754 'tftp': 'BlockdevOptionsFile',
1755 'vdi': 'BlockdevOptionsGenericFormat',
1756 'vhdx': 'BlockdevOptionsGenericFormat',
1757 'vmdk': 'BlockdevOptionsGenericCOWFormat',
1758 'vpc': 'BlockdevOptionsGenericFormat',
1759 'vvfat': 'BlockdevOptionsVVFAT'
1765 # Reference to a block device.
1767 # @definition: defines a new block device inline
1768 # @reference: references the ID of an existing block device. An
1769 # empty string means that no block device should be
1774 { 'union': 'BlockdevRef',
1775 'discriminator': {},
1776 'data': { 'definition': 'BlockdevOptions',
1777 'reference': 'str' } }
1782 # Creates a new block device.
1784 # This command is still a work in progress. It doesn't support all
1785 # block drivers, it lacks a matching blockdev-del, and more. Stay
1786 # away from it unless you want to help with its development.
1788 # @options: block device options for the new device
1792 { 'command': 'blockdev-add', 'data': { 'options': 'BlockdevOptions' } }
1798 # An enumeration of action that has been taken when a DISK I/O occurs
1800 # @ignore: error has been ignored
1802 # @report: error has been reported to the device
1804 # @stop: error caused VM to be stopped
1808 { 'enum': 'BlockErrorAction',
1809 'data': [ 'ignore', 'report', 'stop' ] }
1813 # @BLOCK_IMAGE_CORRUPTED
1815 # Emitted when a corruption has been detected in a disk image
1817 # @device: device name. This is always present for compatibility
1818 # reasons, but it can be empty ("") if the image does not
1819 # have a device name associated.
1821 # @node-name: #optional node name (Since: 2.4)
1823 # @msg: informative message for human consumption, such as the kind of
1824 # corruption being detected. It should not be parsed by machine as it is
1825 # not guaranteed to be stable
1827 # @offset: #optional, if the corruption resulted from an image access, this is
1828 # the access offset into the image
1830 # @size: #optional, if the corruption resulted from an image access, this is
1833 # fatal: if set, the image is marked corrupt and therefore unusable after this
1834 # event and must be repaired (Since 2.2; before, every
1835 # BLOCK_IMAGE_CORRUPTED event was fatal)
1839 { 'event': 'BLOCK_IMAGE_CORRUPTED',
1840 'data': { 'device' : 'str',
1841 '*node-name' : 'str',
1845 'fatal' : 'bool' } }
1850 # Emitted when a disk I/O error occurs
1852 # @device: device name
1854 # @operation: I/O operation
1856 # @action: action that has been taken
1858 # @nospace: #optional true if I/O error was caused due to a no-space
1859 # condition. This key is only present if query-block's
1860 # io-status is present, please see query-block documentation
1861 # for more information (since: 2.2)
1863 # @reason: human readable string describing the error cause.
1864 # (This field is a debugging aid for humans, it should not
1865 # be parsed by applications) (since: 2.2)
1867 # Note: If action is "stop", a STOP event will eventually follow the
1868 # BLOCK_IO_ERROR event
1872 { 'event': 'BLOCK_IO_ERROR',
1873 'data': { 'device': 'str', 'operation': 'IoOperationType',
1874 'action': 'BlockErrorAction', '*nospace': 'bool',
1878 # @BLOCK_JOB_COMPLETED
1880 # Emitted when a block job has completed
1884 # @device: device name
1886 # @len: maximum progress value
1888 # @offset: current progress value. On success this is equal to len.
1889 # On failure this is less than len
1891 # @speed: rate limit, bytes per second
1893 # @error: #optional, error message. Only present on failure. This field
1894 # contains a human-readable error message. There are no semantics
1895 # other than that streaming has failed and clients should not try to
1896 # interpret the error string
1900 { 'event': 'BLOCK_JOB_COMPLETED',
1901 'data': { 'type' : 'BlockJobType',
1909 # @BLOCK_JOB_CANCELLED
1911 # Emitted when a block job has been cancelled
1915 # @device: device name
1917 # @len: maximum progress value
1919 # @offset: current progress value. On success this is equal to len.
1920 # On failure this is less than len
1922 # @speed: rate limit, bytes per second
1926 { 'event': 'BLOCK_JOB_CANCELLED',
1927 'data': { 'type' : 'BlockJobType',
1936 # Emitted when a block job encounters an error
1938 # @device: device name
1940 # @operation: I/O operation
1942 # @action: action that has been taken
1946 { 'event': 'BLOCK_JOB_ERROR',
1947 'data': { 'device' : 'str',
1948 'operation': 'IoOperationType',
1949 'action' : 'BlockErrorAction' } }
1954 # Emitted when a block job is ready to complete
1958 # @device: device name
1960 # @len: maximum progress value
1962 # @offset: current progress value. On success this is equal to len.
1963 # On failure this is less than len
1965 # @speed: rate limit, bytes per second
1967 # Note: The "ready to complete" status is always reset by a @BLOCK_JOB_ERROR
1972 { 'event': 'BLOCK_JOB_READY',
1973 'data': { 'type' : 'BlockJobType',
1981 # Preallocation mode of QEMU image file
1983 # @off: no preallocation
1984 # @metadata: preallocate only for metadata
1985 # @falloc: like @full preallocation but allocate disk space by
1986 # posix_fallocate() rather than writing zeros.
1987 # @full: preallocate all data by writing zeros to device to ensure disk
1988 # space is really available. @full preallocation also sets up
1989 # metadata correctly.
1993 { 'enum': 'PreallocMode',
1994 'data': [ 'off', 'metadata', 'falloc', 'full' ] }
1997 # @BLOCK_WRITE_THRESHOLD
1999 # Emitted when writes on block device reaches or exceeds the
2000 # configured write threshold. For thin-provisioned devices, this
2001 # means the device should be extended to avoid pausing for
2003 # The event is one shot. Once triggered, it needs to be
2004 # re-registered with another block-set-threshold command.
2006 # @node-name: graph node name on which the threshold was exceeded.
2008 # @amount-exceeded: amount of data which exceeded the threshold, in bytes.
2010 # @write-threshold: last configured threshold, in bytes.
2014 { 'event': 'BLOCK_WRITE_THRESHOLD',
2015 'data': { 'node-name': 'str',
2016 'amount-exceeded': 'uint64',
2017 'write-threshold': 'uint64' } }
2020 # @block-set-write-threshold
2022 # Change the write threshold for a block drive. An event will be delivered
2023 # if a write to this block drive crosses the configured threshold.
2024 # This is useful to transparently resize thin-provisioned drives without
2025 # the guest OS noticing.
2027 # @node-name: graph node name on which the threshold must be set.
2029 # @write-threshold: configured threshold for the block device, bytes.
2030 # Use 0 to disable the threshold.
2034 { 'command': 'block-set-write-threshold',
2035 'data': { 'node-name': 'str', 'write-threshold': 'uint64' } }