4 # == QAPI block core definitions (vm unrelated)
7 # QAPI common definitions
8 { 'include': 'common.json' }
13 # @id: unique snapshot id
15 # @name: user chosen name
17 # @vm-state-size: size of the VM state
19 # @date-sec: UTC date of the snapshot in seconds
21 # @date-nsec: fractional part in nano seconds to be used with date-sec
23 # @vm-clock-sec: VM clock relative to boot in seconds
25 # @vm-clock-nsec: fractional part in nano seconds to be used with vm-clock-sec
30 { 'struct': 'SnapshotInfo',
31 'data': { 'id': 'str', 'name': 'str', 'vm-state-size': 'int',
32 'date-sec': 'int', 'date-nsec': 'int',
33 'vm-clock-sec': 'int', 'vm-clock-nsec': 'int' } }
36 # @ImageInfoSpecificQCow2:
38 # @compat: compatibility level
40 # @lazy-refcounts: #optional on or off; only valid for compat >= 1.1
42 # @corrupt: #optional true if the image has been marked corrupt; only valid for
43 # compat >= 1.1 (since 2.2)
45 # @refcount-bits: width of a refcount entry in bits (since 2.3)
49 { 'struct': 'ImageInfoSpecificQCow2',
52 '*lazy-refcounts': 'bool',
54 'refcount-bits': 'int'
58 # @ImageInfoSpecificVmdk:
60 # @create-type: The create type of VMDK image
62 # @cid: Content id of image
64 # @parent-cid: Parent VMDK image's cid
66 # @extents: List of extent files
70 { 'struct': 'ImageInfoSpecificVmdk',
75 'extents': ['ImageInfo']
81 # A discriminated record of image format specific information structures.
85 { 'union': 'ImageInfoSpecific',
87 'qcow2': 'ImageInfoSpecificQCow2',
88 'vmdk': 'ImageInfoSpecificVmdk',
89 # If we need to add block driver specific parameters for
90 # LUKS in future, then we'll subclass QCryptoBlockInfoLUKS
91 # to define a ImageInfoSpecificLUKS
92 'luks': 'QCryptoBlockInfoLUKS'
98 # Information about a QEMU image file
100 # @filename: name of the image file
102 # @format: format of the image file
104 # @virtual-size: maximum capacity in bytes of the image
106 # @actual-size: #optional actual size on disk in bytes of the image
108 # @dirty-flag: #optional true if image is not cleanly closed
110 # @cluster-size: #optional size of a cluster in bytes
112 # @encrypted: #optional true if the image is encrypted
114 # @compressed: #optional true if the image is compressed (Since 1.7)
116 # @backing-filename: #optional name of the backing file
118 # @full-backing-filename: #optional full path of the backing file
120 # @backing-filename-format: #optional the format of the backing file
122 # @snapshots: #optional list of VM snapshots
124 # @backing-image: #optional info of the backing image (since 1.6)
126 # @format-specific: #optional structure supplying additional format-specific
127 # information (since 1.7)
132 { 'struct': 'ImageInfo',
133 'data': {'filename': 'str', 'format': 'str', '*dirty-flag': 'bool',
134 '*actual-size': 'int', 'virtual-size': 'int',
135 '*cluster-size': 'int', '*encrypted': 'bool', '*compressed': 'bool',
136 '*backing-filename': 'str', '*full-backing-filename': 'str',
137 '*backing-filename-format': 'str', '*snapshots': ['SnapshotInfo'],
138 '*backing-image': 'ImageInfo',
139 '*format-specific': 'ImageInfoSpecific' } }
144 # Information about a QEMU image file check
146 # @filename: name of the image file checked
148 # @format: format of the image file checked
150 # @check-errors: number of unexpected errors occurred during check
152 # @image-end-offset: #optional offset (in bytes) where the image ends, this
153 # field is present if the driver for the image format
156 # @corruptions: #optional number of corruptions found during the check if any
158 # @leaks: #optional number of leaks found during the check if any
160 # @corruptions-fixed: #optional number of corruptions fixed during the check
163 # @leaks-fixed: #optional number of leaks fixed during the check if any
165 # @total-clusters: #optional total number of clusters, this field is present
166 # if the driver for the image format supports it
168 # @allocated-clusters: #optional total number of allocated clusters, this
169 # field is present if the driver for the image format
172 # @fragmented-clusters: #optional total number of fragmented clusters, this
173 # field is present if the driver for the image format
176 # @compressed-clusters: #optional total number of compressed clusters, this
177 # field is present if the driver for the image format
183 { 'struct': 'ImageCheck',
184 'data': {'filename': 'str', 'format': 'str', 'check-errors': 'int',
185 '*image-end-offset': 'int', '*corruptions': 'int', '*leaks': 'int',
186 '*corruptions-fixed': 'int', '*leaks-fixed': 'int',
187 '*total-clusters': 'int', '*allocated-clusters': 'int',
188 '*fragmented-clusters': 'int', '*compressed-clusters': 'int' } }
193 # Mapping information from a virtual block range to a host file range
195 # @start: the start byte of the mapped virtual range
197 # @length: the number of bytes of the mapped virtual range
199 # @data: whether the mapped range has data
201 # @zero: whether the virtual blocks are zeroed
203 # @depth: the depth of the mapping
205 # @offset: #optional the offset in file that the virtual sectors are mapped to
207 # @filename: #optional filename that is referred to by @offset
212 { 'struct': 'MapEntry',
213 'data': {'start': 'int', 'length': 'int', 'data': 'bool',
214 'zero': 'bool', 'depth': 'int', '*offset': 'int',
215 '*filename': 'str' } }
218 # @BlockdevCacheInfo:
220 # Cache mode information for a block device
222 # @writeback: true if writeback mode is enabled
223 # @direct: true if the host page cache is bypassed (O_DIRECT)
224 # @no-flush: true if flush requests are ignored for the device
228 { 'struct': 'BlockdevCacheInfo',
229 'data': { 'writeback': 'bool',
231 'no-flush': 'bool' } }
236 # Information about the backing device for a block device.
238 # @file: the filename of the backing device
240 # @node-name: #optional the name of the block driver node (Since 2.0)
242 # @ro: true if the backing device was open read-only
244 # @drv: the name of the block format used to open the backing device. As of
245 # 0.14.0 this can be: 'blkdebug', 'bochs', 'cloop', 'cow', 'dmg',
246 # 'file', 'file', 'ftp', 'ftps', 'host_cdrom', 'host_device',
247 # 'http', 'https', 'luks', 'nbd', 'parallels', 'qcow',
248 # 'qcow2', 'raw', 'vdi', 'vmdk', 'vpc', 'vvfat'
249 # 2.2: 'archipelago' added, 'cow' dropped
250 # 2.3: 'host_floppy' deprecated
251 # 2.5: 'host_floppy' dropped
253 # 2.8: 'replication' added, 'tftp' dropped
255 # @backing_file: #optional the name of the backing file (for copy-on-write)
257 # @backing_file_depth: number of files in the backing file chain (since: 1.2)
259 # @encrypted: true if the backing device is encrypted
261 # @encryption_key_missing: true if the backing device is encrypted but an
262 # valid encryption key is missing
264 # @detect_zeroes: detect and optimize zero writes (Since 2.1)
266 # @bps: total throughput limit in bytes per second is specified
268 # @bps_rd: read throughput limit in bytes per second is specified
270 # @bps_wr: write throughput limit in bytes per second is specified
272 # @iops: total I/O operations per second is specified
274 # @iops_rd: read I/O operations per second is specified
276 # @iops_wr: write I/O operations per second is specified
278 # @image: the info of image used (since: 1.6)
280 # @bps_max: #optional total throughput limit during bursts,
281 # in bytes (Since 1.7)
283 # @bps_rd_max: #optional read throughput limit during bursts,
284 # in bytes (Since 1.7)
286 # @bps_wr_max: #optional write throughput limit during bursts,
287 # in bytes (Since 1.7)
289 # @iops_max: #optional total I/O operations per second during bursts,
290 # in bytes (Since 1.7)
292 # @iops_rd_max: #optional read I/O operations per second during bursts,
293 # in bytes (Since 1.7)
295 # @iops_wr_max: #optional write I/O operations per second during bursts,
296 # in bytes (Since 1.7)
298 # @bps_max_length: #optional maximum length of the @bps_max burst
299 # period, in seconds. (Since 2.6)
301 # @bps_rd_max_length: #optional maximum length of the @bps_rd_max
302 # burst period, in seconds. (Since 2.6)
304 # @bps_wr_max_length: #optional maximum length of the @bps_wr_max
305 # burst period, in seconds. (Since 2.6)
307 # @iops_max_length: #optional maximum length of the @iops burst
308 # period, in seconds. (Since 2.6)
310 # @iops_rd_max_length: #optional maximum length of the @iops_rd_max
311 # burst period, in seconds. (Since 2.6)
313 # @iops_wr_max_length: #optional maximum length of the @iops_wr_max
314 # burst period, in seconds. (Since 2.6)
316 # @iops_size: #optional an I/O size in bytes (Since 1.7)
318 # @group: #optional throttle group name (Since 2.4)
320 # @cache: the cache mode used for the block device (since: 2.3)
322 # @write_threshold: configured write threshold for the device.
323 # 0 if disabled. (Since 2.3)
328 { 'struct': 'BlockDeviceInfo',
329 'data': { 'file': 'str', '*node-name': 'str', 'ro': 'bool', 'drv': 'str',
330 '*backing_file': 'str', 'backing_file_depth': 'int',
331 'encrypted': 'bool', 'encryption_key_missing': 'bool',
332 'detect_zeroes': 'BlockdevDetectZeroesOptions',
333 'bps': 'int', 'bps_rd': 'int', 'bps_wr': 'int',
334 'iops': 'int', 'iops_rd': 'int', 'iops_wr': 'int',
335 'image': 'ImageInfo',
336 '*bps_max': 'int', '*bps_rd_max': 'int',
337 '*bps_wr_max': 'int', '*iops_max': 'int',
338 '*iops_rd_max': 'int', '*iops_wr_max': 'int',
339 '*bps_max_length': 'int', '*bps_rd_max_length': 'int',
340 '*bps_wr_max_length': 'int', '*iops_max_length': 'int',
341 '*iops_rd_max_length': 'int', '*iops_wr_max_length': 'int',
342 '*iops_size': 'int', '*group': 'str', 'cache': 'BlockdevCacheInfo',
343 'write_threshold': 'int' } }
346 # @BlockDeviceIoStatus:
348 # An enumeration of block device I/O status.
350 # @ok: The last I/O operation has succeeded
352 # @failed: The last I/O operation has failed
354 # @nospace: The last I/O operation has failed due to a no-space condition
358 { 'enum': 'BlockDeviceIoStatus', 'data': [ 'ok', 'failed', 'nospace' ] }
361 # @BlockDeviceMapEntry:
363 # Entry in the metadata map of the device (returned by "qemu-img map")
365 # @start: Offset in the image of the first byte described by this entry
368 # @length: Length of the range described by this entry (in bytes)
370 # @depth: Number of layers (0 = top image, 1 = top image's backing file, etc.)
371 # before reaching one for which the range is allocated. The value is
372 # in the range 0 to the depth of the image chain - 1.
374 # @zero: the sectors in this range read as zeros
376 # @data: reading the image will actually read data from a file (in particular,
377 # if @offset is present this means that the sectors are not simply
378 # preallocated, but contain actual data in raw format)
380 # @offset: if present, the image file stores the data for this range in
381 # raw format at the given offset.
385 { 'struct': 'BlockDeviceMapEntry',
386 'data': { 'start': 'int', 'length': 'int', 'depth': 'int', 'zero': 'bool',
387 'data': 'bool', '*offset': 'int' } }
390 # @DirtyBitmapStatus:
392 # An enumeration of possible states that a dirty bitmap can report to the user.
394 # @frozen: The bitmap is currently in-use by a backup operation or block job,
397 # @disabled: The bitmap is currently in-use by an internal operation and is
398 # read-only. It can still be deleted.
400 # @active: The bitmap is actively monitoring for new writes, and can be cleared,
401 # deleted, or used for backup operations.
405 { 'enum': 'DirtyBitmapStatus',
406 'data': ['active', 'disabled', 'frozen'] }
411 # Block dirty bitmap information.
413 # @name: #optional the name of the dirty bitmap (Since 2.4)
415 # @count: number of dirty bytes according to the dirty bitmap
417 # @granularity: granularity of the dirty bitmap in bytes (since 1.4)
419 # @status: current status of the dirty bitmap (since 2.4)
423 { 'struct': 'BlockDirtyInfo',
424 'data': {'*name': 'str', 'count': 'int', 'granularity': 'uint32',
425 'status': 'DirtyBitmapStatus'} }
430 # Block device information. This structure describes a virtual device and
431 # the backing device associated with it.
433 # @device: The device name associated with the virtual device.
435 # @type: This field is returned only for compatibility reasons, it should
436 # not be used (always returns 'unknown')
438 # @removable: True if the device supports removable media.
440 # @locked: True if the guest has locked this device from having its media
443 # @tray_open: #optional True if the device's tray is open
444 # (only present if it has a tray)
446 # @dirty-bitmaps: #optional dirty bitmaps information (only present if the
447 # driver has one or more dirty bitmaps) (Since 2.0)
449 # @io-status: #optional @BlockDeviceIoStatus. Only present if the device
450 # supports it and the VM is configured to stop on errors
451 # (supported device models: virtio-blk, ide, scsi-disk)
453 # @inserted: #optional @BlockDeviceInfo describing the device if media is
458 { 'struct': 'BlockInfo',
459 'data': {'device': 'str', 'type': 'str', 'removable': 'bool',
460 'locked': 'bool', '*inserted': 'BlockDeviceInfo',
461 '*tray_open': 'bool', '*io-status': 'BlockDeviceIoStatus',
462 '*dirty-bitmaps': ['BlockDirtyInfo'] } }
467 # Get a list of BlockInfo for all virtual block devices.
469 # Returns: a list of @BlockInfo describing each virtual block device
475 # -> { "execute": "query-block" }
480 # "device":"ide0-hd0",
487 # "file":"disks/test.qcow2",
488 # "backing_file_depth":1,
495 # "bps_max": 8000000,
502 # "detect_zeroes": "on",
503 # "write_threshold": 0,
505 # "filename":"disks/test.qcow2",
507 # "virtual-size":2048000,
508 # "backing_file":"base.qcow2",
509 # "full-backing-filename":"disks/base.qcow2",
510 # "backing-filename-format":"qcow2",
514 # "name": "snapshot1",
515 # "vm-state-size": 0,
516 # "date-sec": 10000200,
518 # "vm-clock-sec": 206,
519 # "vm-clock-nsec": 30
523 # "filename":"disks/base.qcow2",
525 # "virtual-size":2048000
533 # "device":"ide1-cd0",
539 # "device":"floppy0",
554 { 'command': 'query-block', 'returns': ['BlockInfo'] }
558 # @BlockDeviceTimedStats:
560 # Statistics of a block device during a given interval of time.
562 # @interval_length: Interval used for calculating the statistics,
565 # @min_rd_latency_ns: Minimum latency of read operations in the
566 # defined interval, in nanoseconds.
568 # @min_wr_latency_ns: Minimum latency of write operations in the
569 # defined interval, in nanoseconds.
571 # @min_flush_latency_ns: Minimum latency of flush operations in the
572 # defined interval, in nanoseconds.
574 # @max_rd_latency_ns: Maximum latency of read operations in the
575 # defined interval, in nanoseconds.
577 # @max_wr_latency_ns: Maximum latency of write operations in the
578 # defined interval, in nanoseconds.
580 # @max_flush_latency_ns: Maximum latency of flush operations in the
581 # defined interval, in nanoseconds.
583 # @avg_rd_latency_ns: Average latency of read operations in the
584 # defined interval, in nanoseconds.
586 # @avg_wr_latency_ns: Average latency of write operations in the
587 # defined interval, in nanoseconds.
589 # @avg_flush_latency_ns: Average latency of flush operations in the
590 # defined interval, in nanoseconds.
592 # @avg_rd_queue_depth: Average number of pending read operations
593 # in the defined interval.
595 # @avg_wr_queue_depth: Average number of pending write operations
596 # in the defined interval.
600 { 'struct': 'BlockDeviceTimedStats',
601 'data': { 'interval_length': 'int', 'min_rd_latency_ns': 'int',
602 'max_rd_latency_ns': 'int', 'avg_rd_latency_ns': 'int',
603 'min_wr_latency_ns': 'int', 'max_wr_latency_ns': 'int',
604 'avg_wr_latency_ns': 'int', 'min_flush_latency_ns': 'int',
605 'max_flush_latency_ns': 'int', 'avg_flush_latency_ns': 'int',
606 'avg_rd_queue_depth': 'number', 'avg_wr_queue_depth': 'number' } }
611 # Statistics of a virtual block device or a block backing device.
613 # @rd_bytes: The number of bytes read by the device.
615 # @wr_bytes: The number of bytes written by the device.
617 # @rd_operations: The number of read operations performed by the device.
619 # @wr_operations: The number of write operations performed by the device.
621 # @flush_operations: The number of cache flush operations performed by the
622 # device (since 0.15.0)
624 # @flush_total_time_ns: Total time spend on cache flushes in nano-seconds
627 # @wr_total_time_ns: Total time spend on writes in nano-seconds (since 0.15.0).
629 # @rd_total_time_ns: Total_time_spend on reads in nano-seconds (since 0.15.0).
631 # @wr_highest_offset: The offset after the greatest byte written to the
632 # device. The intended use of this information is for
633 # growable sparse files (like qcow2) that are used on top
634 # of a physical device.
636 # @rd_merged: Number of read requests that have been merged into another
637 # request (Since 2.3).
639 # @wr_merged: Number of write requests that have been merged into another
640 # request (Since 2.3).
642 # @idle_time_ns: #optional Time since the last I/O operation, in
643 # nanoseconds. If the field is absent it means that
644 # there haven't been any operations yet (Since 2.5).
646 # @failed_rd_operations: The number of failed read operations
647 # performed by the device (Since 2.5)
649 # @failed_wr_operations: The number of failed write operations
650 # performed by the device (Since 2.5)
652 # @failed_flush_operations: The number of failed flush operations
653 # performed by the device (Since 2.5)
655 # @invalid_rd_operations: The number of invalid read operations
656 # performed by the device (Since 2.5)
658 # @invalid_wr_operations: The number of invalid write operations
659 # performed by the device (Since 2.5)
661 # @invalid_flush_operations: The number of invalid flush operations
662 # performed by the device (Since 2.5)
664 # @account_invalid: Whether invalid operations are included in the
665 # last access statistics (Since 2.5)
667 # @account_failed: Whether failed operations are included in the
668 # latency and last access statistics (Since 2.5)
670 # @timed_stats: Statistics specific to the set of previously defined
671 # intervals of time (Since 2.5)
675 { 'struct': 'BlockDeviceStats',
676 'data': {'rd_bytes': 'int', 'wr_bytes': 'int', 'rd_operations': 'int',
677 'wr_operations': 'int', 'flush_operations': 'int',
678 'flush_total_time_ns': 'int', 'wr_total_time_ns': 'int',
679 'rd_total_time_ns': 'int', 'wr_highest_offset': 'int',
680 'rd_merged': 'int', 'wr_merged': 'int', '*idle_time_ns': 'int',
681 'failed_rd_operations': 'int', 'failed_wr_operations': 'int',
682 'failed_flush_operations': 'int', 'invalid_rd_operations': 'int',
683 'invalid_wr_operations': 'int', 'invalid_flush_operations': 'int',
684 'account_invalid': 'bool', 'account_failed': 'bool',
685 'timed_stats': ['BlockDeviceTimedStats'] } }
690 # Statistics of a virtual block device or a block backing device.
692 # @device: #optional If the stats are for a virtual block device, the name
693 # corresponding to the virtual block device.
695 # @node-name: #optional The node name of the device. (Since 2.3)
697 # @stats: A @BlockDeviceStats for the device.
699 # @parent: #optional This describes the file block device if it has one.
700 # Contains recursively the statistics of the underlying
701 # protocol (e.g. the host file for a qcow2 image). If there is
702 # no underlying protocol, this field is omitted
704 # @backing: #optional This describes the backing block device if it has one.
709 { 'struct': 'BlockStats',
710 'data': {'*device': 'str', '*node-name': 'str',
711 'stats': 'BlockDeviceStats',
712 '*parent': 'BlockStats',
713 '*backing': 'BlockStats'} }
718 # Query the @BlockStats for all virtual block devices.
720 # @query-nodes: #optional If true, the command will query all the block nodes
721 # that have a node name, in a list which will include "parent"
722 # information, but not "backing".
723 # If false or omitted, the behavior is as before - query all the
724 # device backends, recursively including their "parent" and
725 # "backing". (Since 2.3)
727 # Returns: A list of @BlockStats for each virtual block devices.
733 # -> { "execute": "query-blockstats" }
737 # "device":"ide0-hd0",
740 # "wr_highest_offset":3686448128,
741 # "wr_bytes":9786368,
742 # "wr_operations":751,
743 # "rd_bytes":122567168,
744 # "rd_operations":36772
745 # "wr_total_times_ns":313253456
746 # "rd_total_times_ns":3465673657
747 # "flush_total_times_ns":49653
748 # "flush_operations":61,
751 # "idle_time_ns":2953431879,
752 # "account_invalid":true,
753 # "account_failed":false
757 # "wr_highest_offset":2821110784,
758 # "wr_bytes":9786368,
759 # "wr_operations":692,
760 # "rd_bytes":122739200,
761 # "rd_operations":36604
762 # "flush_operations":51,
763 # "wr_total_times_ns":313253456
764 # "rd_total_times_ns":3465673657
765 # "flush_total_times_ns":49653,
768 # "idle_time_ns":2953431879,
769 # "account_invalid":true,
770 # "account_failed":false
774 # "device":"ide1-cd0",
776 # "wr_highest_offset":0,
781 # "flush_operations":0,
782 # "wr_total_times_ns":0
783 # "rd_total_times_ns":0
784 # "flush_total_times_ns":0,
787 # "account_invalid":false,
788 # "account_failed":false
792 # "device":"floppy0",
794 # "wr_highest_offset":0,
799 # "flush_operations":0,
800 # "wr_total_times_ns":0
801 # "rd_total_times_ns":0
802 # "flush_total_times_ns":0,
805 # "account_invalid":false,
806 # "account_failed":false
812 # "wr_highest_offset":0,
817 # "flush_operations":0,
818 # "wr_total_times_ns":0
819 # "rd_total_times_ns":0
820 # "flush_total_times_ns":0,
823 # "account_invalid":false,
824 # "account_failed":false
831 { 'command': 'query-blockstats',
832 'data': { '*query-nodes': 'bool' },
833 'returns': ['BlockStats'] }
838 # An enumeration of possible behaviors for errors on I/O operations.
839 # The exact meaning depends on whether the I/O was initiated by a guest
842 # @report: for guest operations, report the error to the guest;
843 # for jobs, cancel the job
845 # @ignore: ignore the error, only report a QMP event (BLOCK_IO_ERROR
846 # or BLOCK_JOB_ERROR)
848 # @enospc: same as @stop on ENOSPC, same as @report otherwise.
850 # @stop: for guest operations, stop the virtual machine;
851 # for jobs, pause the job
853 # @auto: inherit the error handling policy of the backend (since: 2.7)
857 { 'enum': 'BlockdevOnError',
858 'data': ['report', 'ignore', 'enospc', 'stop', 'auto'] }
863 # An enumeration of possible behaviors for the initial synchronization
864 # phase of storage mirroring.
866 # @top: copies data in the topmost image to the destination
868 # @full: copies data from all images to the destination
870 # @none: only copy data written from now on
872 # @incremental: only copy data described by the dirty bitmap. Since: 2.4
876 { 'enum': 'MirrorSyncMode',
877 'data': ['top', 'full', 'none', 'incremental'] }
882 # Type of a block job.
884 # @commit: block commit job type, see "block-commit"
886 # @stream: block stream job type, see "block-stream"
888 # @mirror: drive mirror job type, see "drive-mirror"
890 # @backup: drive backup job type, see "drive-backup"
894 { 'enum': 'BlockJobType',
895 'data': ['commit', 'stream', 'mirror', 'backup'] }
900 # Information about a long-running block device operation.
902 # @type: the job type ('stream' for image streaming)
904 # @device: The job identifier. Originally the device name but other
905 # values are allowed since QEMU 2.7
907 # @len: the maximum progress value
909 # @busy: false if the job is known to be in a quiescent state, with
910 # no pending I/O. Since 1.3.
912 # @paused: whether the job is paused or, if @busy is true, will
913 # pause itself as soon as possible. Since 1.3.
915 # @offset: the current progress value
917 # @speed: the rate limit, bytes per second
919 # @io-status: the status of the job (since 1.3)
921 # @ready: true if the job may be completed (since 2.2)
925 { 'struct': 'BlockJobInfo',
926 'data': {'type': 'str', 'device': 'str', 'len': 'int',
927 'offset': 'int', 'busy': 'bool', 'paused': 'bool', 'speed': 'int',
928 'io-status': 'BlockDeviceIoStatus', 'ready': 'bool'} }
933 # Return information about long-running block device operations.
935 # Returns: a list of @BlockJobInfo for each active block job
939 { 'command': 'query-block-jobs', 'returns': ['BlockJobInfo'] }
944 # This command sets the password of a block device that has not been open
945 # with a password and requires one.
947 # The two cases where this can happen are a block device is created through
948 # QEMU's initial command line or a block device is changed through the legacy
951 # In the event that the block device is created through the initial command
952 # line, the VM will start in the stopped state regardless of whether '-S' is
953 # used. The intention is for a management tool to query the block devices to
954 # determine which ones are encrypted, set the passwords with this command, and
955 # then start the guest with the @cont command.
957 # Either @device or @node-name must be set but not both.
959 # @device: #optional the name of the block backend device to set the password on
961 # @node-name: #optional graph node name to set the password on (Since 2.0)
963 # @password: the password to use for the device
965 # Returns: nothing on success
966 # If @device is not a valid block device, DeviceNotFound
967 # If @device is not encrypted, DeviceNotEncrypted
969 # Notes: Not all block formats support encryption and some that do are not
970 # able to validate that a password is correct. Disk corruption may
971 # occur if an invalid password is specified.
975 { 'command': 'block_passwd', 'data': {'*device': 'str',
976 '*node-name': 'str', 'password': 'str'} }
981 # Resize a block image while a guest is running.
983 # Either @device or @node-name must be set but not both.
985 # @device: #optional the name of the device to get the image resized
987 # @node-name: #optional graph node name to get the image resized (Since 2.0)
989 # @size: new image size in bytes
991 # Returns: nothing on success
992 # If @device is not a valid block device, DeviceNotFound
996 { 'command': 'block_resize', 'data': { '*device': 'str',
1003 # An enumeration that tells QEMU how to set the backing file path in
1006 # @existing: QEMU should look for an existing image file.
1008 # @absolute-paths: QEMU should create a new image with absolute paths
1009 # for the backing file. If there is no backing file available, the new
1010 # image will not be backed either.
1014 { 'enum': 'NewImageMode',
1015 'data': [ 'existing', 'absolute-paths' ] }
1018 # @BlockdevSnapshotSync:
1020 # Either @device or @node-name must be set but not both.
1022 # @device: #optional the name of the device to generate the snapshot from.
1024 # @node-name: #optional graph node name to generate the snapshot from (Since 2.0)
1026 # @snapshot-file: the target of the new image. A new file will be created.
1028 # @snapshot-node-name: #optional the graph node name of the new image (Since 2.0)
1030 # @format: #optional the format of the snapshot image, default is 'qcow2'.
1032 # @mode: #optional whether and how QEMU should create a new image, default is
1035 { 'struct': 'BlockdevSnapshotSync',
1036 'data': { '*device': 'str', '*node-name': 'str',
1037 'snapshot-file': 'str', '*snapshot-node-name': 'str',
1038 '*format': 'str', '*mode': 'NewImageMode' } }
1041 # @BlockdevSnapshot:
1043 # @node: device or node name that will have a snapshot created.
1045 # @overlay: reference to the existing block device that will become
1046 # the overlay of @node, as part of creating the snapshot.
1047 # It must not have a current backing file (this can be
1048 # achieved by passing "backing": "" to blockdev-add).
1052 { 'struct': 'BlockdevSnapshot',
1053 'data': { 'node': 'str', 'overlay': 'str' } }
1058 # @job-id: #optional identifier for the newly-created block job. If
1059 # omitted, the device name will be used. (Since 2.7)
1061 # @device: the device name or node-name of a root node which should be copied.
1063 # @target: the target of the new image. If the file exists, or if it
1064 # is a device, the existing file/device will be used as the new
1065 # destination. If it does not exist, a new file will be created.
1067 # @format: #optional the format of the new destination, default is to
1068 # probe if @mode is 'existing', else the format of the source
1070 # @sync: what parts of the disk image should be copied to the destination
1071 # (all the disk, only the sectors allocated in the topmost image, from a
1072 # dirty bitmap, or only new I/O).
1074 # @mode: #optional whether and how QEMU should create a new image, default is
1077 # @speed: #optional the maximum speed, in bytes per second
1079 # @bitmap: #optional the name of dirty bitmap if sync is "incremental".
1080 # Must be present if sync is "incremental", must NOT be present
1081 # otherwise. (Since 2.4)
1083 # @compress: #optional true to compress data, if the target format supports it.
1084 # (default: false) (since 2.8)
1086 # @on-source-error: #optional the action to take on an error on the source,
1087 # default 'report'. 'stop' and 'enospc' can only be used
1088 # if the block device supports io-status (see BlockInfo).
1090 # @on-target-error: #optional the action to take on an error on the target,
1091 # default 'report' (no limitations, since this applies to
1092 # a different block device than @device).
1094 # Note: @on-source-error and @on-target-error only affect background
1095 # I/O. If an error occurs during a guest write request, the device's
1096 # rerror/werror actions will be used.
1100 { 'struct': 'DriveBackup',
1101 'data': { '*job-id': 'str', 'device': 'str', 'target': 'str',
1102 '*format': 'str', 'sync': 'MirrorSyncMode', '*mode': 'NewImageMode',
1103 '*speed': 'int', '*bitmap': 'str', '*compress': 'bool',
1104 '*on-source-error': 'BlockdevOnError',
1105 '*on-target-error': 'BlockdevOnError' } }
1110 # @job-id: #optional identifier for the newly-created block job. If
1111 # omitted, the device name will be used. (Since 2.7)
1113 # @device: the device name or node-name of a root node which should be copied.
1115 # @target: the device name or node-name of the backup target node.
1117 # @sync: what parts of the disk image should be copied to the destination
1118 # (all the disk, only the sectors allocated in the topmost image, or
1121 # @speed: #optional the maximum speed, in bytes per second. The default is 0,
1124 # @compress: #optional true to compress data, if the target format supports it.
1125 # (default: false) (since 2.8)
1127 # @on-source-error: #optional the action to take on an error on the source,
1128 # default 'report'. 'stop' and 'enospc' can only be used
1129 # if the block device supports io-status (see BlockInfo).
1131 # @on-target-error: #optional the action to take on an error on the target,
1132 # default 'report' (no limitations, since this applies to
1133 # a different block device than @device).
1135 # Note: @on-source-error and @on-target-error only affect background
1136 # I/O. If an error occurs during a guest write request, the device's
1137 # rerror/werror actions will be used.
1141 { 'struct': 'BlockdevBackup',
1142 'data': { '*job-id': 'str', 'device': 'str', 'target': 'str',
1143 'sync': 'MirrorSyncMode',
1145 '*compress': 'bool',
1146 '*on-source-error': 'BlockdevOnError',
1147 '*on-target-error': 'BlockdevOnError' } }
1150 # @blockdev-snapshot-sync:
1152 # Generates a synchronous snapshot of a block device.
1154 # For the arguments, see the documentation of BlockdevSnapshotSync.
1156 # Returns: nothing on success
1157 # If @device is not a valid block device, DeviceNotFound
1161 { 'command': 'blockdev-snapshot-sync',
1162 'data': 'BlockdevSnapshotSync' }
1166 # @blockdev-snapshot:
1168 # Generates a snapshot of a block device.
1170 # For the arguments, see the documentation of BlockdevSnapshot.
1174 { 'command': 'blockdev-snapshot',
1175 'data': 'BlockdevSnapshot' }
1178 # @change-backing-file:
1180 # Change the backing file in the image file metadata. This does not
1181 # cause QEMU to reopen the image file to reparse the backing filename
1182 # (it may, however, perform a reopen to change permissions from
1183 # r/o -> r/w -> r/o, if needed). The new backing file string is written
1184 # into the image file metadata, and the QEMU internal strings are
1187 # @image-node-name: The name of the block driver state node of the
1190 # @device: The device name or node-name of the root node that owns
1193 # @backing-file: The string to write as the backing file. This
1194 # string is not validated, so care should be taken
1195 # when specifying the string or the image chain may
1196 # not be able to be reopened again.
1200 { 'command': 'change-backing-file',
1201 'data': { 'device': 'str', 'image-node-name': 'str',
1202 'backing-file': 'str' } }
1207 # Live commit of data from overlay image nodes into backing nodes - i.e.,
1208 # writes data between 'top' and 'base' into 'base'.
1210 # @job-id: #optional identifier for the newly-created block job. If
1211 # omitted, the device name will be used. (Since 2.7)
1213 # @device: the device name or node-name of a root node
1215 # @base: #optional The file name of the backing image to write data into.
1216 # If not specified, this is the deepest backing image
1218 # @top: #optional The file name of the backing image within the image chain,
1219 # which contains the topmost data to be committed down. If
1220 # not specified, this is the active layer.
1222 # @backing-file: #optional The backing file string to write into the overlay
1223 # image of 'top'. If 'top' is the active layer,
1224 # specifying a backing file string is an error. This
1225 # filename is not validated.
1227 # If a pathname string is such that it cannot be
1228 # resolved by QEMU, that means that subsequent QMP or
1229 # HMP commands must use node-names for the image in
1230 # question, as filename lookup methods will fail.
1232 # If not specified, QEMU will automatically determine
1233 # the backing file string to use, or error out if
1234 # there is no obvious choice. Care should be taken
1235 # when specifying the string, to specify a valid
1236 # filename or protocol.
1239 # If top == base, that is an error.
1240 # If top == active, the job will not be completed by itself,
1241 # user needs to complete the job with the block-job-complete
1242 # command after getting the ready event. (Since 2.0)
1244 # If the base image is smaller than top, then the base image
1245 # will be resized to be the same size as top. If top is
1246 # smaller than the base image, the base will not be
1247 # truncated. If you want the base image size to match the
1248 # size of the smaller top, you can safely truncate it
1249 # yourself once the commit operation successfully completes.
1251 # @speed: #optional the maximum speed, in bytes per second
1253 # Returns: Nothing on success
1254 # If commit or stream is already active on this device, DeviceInUse
1255 # If @device does not exist, DeviceNotFound
1256 # If image commit is not supported by this device, NotSupported
1257 # If @base or @top is invalid, a generic error is returned
1258 # If @speed is invalid, InvalidParameter
1263 { 'command': 'block-commit',
1264 'data': { '*job-id': 'str', 'device': 'str', '*base': 'str', '*top': 'str',
1265 '*backing-file': 'str', '*speed': 'int' } }
1270 # Start a point-in-time copy of a block device to a new destination. The
1271 # status of ongoing drive-backup operations can be checked with
1272 # query-block-jobs where the BlockJobInfo.type field has the value 'backup'.
1273 # The operation can be stopped before it has completed using the
1274 # block-job-cancel command.
1276 # For the arguments, see the documentation of DriveBackup.
1278 # Returns: nothing on success
1279 # If @device is not a valid block device, GenericError
1283 { 'command': 'drive-backup', 'boxed': true,
1284 'data': 'DriveBackup' }
1289 # Start a point-in-time copy of a block device to a new destination. The
1290 # status of ongoing blockdev-backup operations can be checked with
1291 # query-block-jobs where the BlockJobInfo.type field has the value 'backup'.
1292 # The operation can be stopped before it has completed using the
1293 # block-job-cancel command.
1295 # For the arguments, see the documentation of BlockdevBackup.
1297 # Returns: nothing on success
1298 # If @device is not a valid block device, DeviceNotFound
1302 { 'command': 'blockdev-backup', 'boxed': true,
1303 'data': 'BlockdevBackup' }
1307 # @query-named-block-nodes:
1309 # Get the named block driver list
1311 # Returns: the list of BlockDeviceInfo
1315 { 'command': 'query-named-block-nodes', 'returns': [ 'BlockDeviceInfo' ] }
1320 # Start mirroring a block device's writes to a new destination.
1322 # See DriveMirror for parameter descriptions
1324 # Returns: nothing on success
1325 # If @device is not a valid block device, GenericError
1329 { 'command': 'drive-mirror', 'boxed': true,
1330 'data': 'DriveMirror' }
1335 # A set of parameters describing drive mirror setup.
1337 # @job-id: #optional identifier for the newly-created block job. If
1338 # omitted, the device name will be used. (Since 2.7)
1340 # @device: the device name or node-name of a root node whose writes should be
1343 # @target: the target of the new image. If the file exists, or if it
1344 # is a device, the existing file/device will be used as the new
1345 # destination. If it does not exist, a new file will be created.
1347 # @format: #optional the format of the new destination, default is to
1348 # probe if @mode is 'existing', else the format of the source
1350 # @node-name: #optional the new block driver state node name in the graph
1353 # @replaces: #optional with sync=full graph node name to be replaced by the new
1354 # image when a whole image copy is done. This can be used to repair
1355 # broken Quorum files. (Since 2.1)
1357 # @mode: #optional whether and how QEMU should create a new image, default is
1360 # @speed: #optional the maximum speed, in bytes per second
1362 # @sync: what parts of the disk image should be copied to the destination
1363 # (all the disk, only the sectors allocated in the topmost image, or
1366 # @granularity: #optional granularity of the dirty bitmap, default is 64K
1367 # if the image format doesn't have clusters, 4K if the clusters
1368 # are smaller than that, else the cluster size. Must be a
1369 # power of 2 between 512 and 64M (since 1.4).
1371 # @buf-size: #optional maximum amount of data in flight from source to
1372 # target (since 1.4).
1374 # @on-source-error: #optional the action to take on an error on the source,
1375 # default 'report'. 'stop' and 'enospc' can only be used
1376 # if the block device supports io-status (see BlockInfo).
1378 # @on-target-error: #optional the action to take on an error on the target,
1379 # default 'report' (no limitations, since this applies to
1380 # a different block device than @device).
1381 # @unmap: #optional Whether to try to unmap target sectors where source has
1382 # only zero. If true, and target unallocated sectors will read as zero,
1383 # target image sectors will be unmapped; otherwise, zeroes will be
1384 # written. Both will result in identical contents.
1385 # Default is true. (Since 2.4)
1389 { 'struct': 'DriveMirror',
1390 'data': { '*job-id': 'str', 'device': 'str', 'target': 'str',
1391 '*format': 'str', '*node-name': 'str', '*replaces': 'str',
1392 'sync': 'MirrorSyncMode', '*mode': 'NewImageMode',
1393 '*speed': 'int', '*granularity': 'uint32',
1394 '*buf-size': 'int', '*on-source-error': 'BlockdevOnError',
1395 '*on-target-error': 'BlockdevOnError',
1396 '*unmap': 'bool' } }
1399 # @BlockDirtyBitmap:
1401 # @node: name of device/node which the bitmap is tracking
1403 # @name: name of the dirty bitmap
1407 { 'struct': 'BlockDirtyBitmap',
1408 'data': { 'node': 'str', 'name': 'str' } }
1411 # @BlockDirtyBitmapAdd:
1413 # @node: name of device/node which the bitmap is tracking
1415 # @name: name of the dirty bitmap
1417 # @granularity: #optional the bitmap granularity, default is 64k for
1418 # block-dirty-bitmap-add
1422 { 'struct': 'BlockDirtyBitmapAdd',
1423 'data': { 'node': 'str', 'name': 'str', '*granularity': 'uint32' } }
1426 # @block-dirty-bitmap-add:
1428 # Create a dirty bitmap with a name on the node
1430 # Returns: nothing on success
1431 # If @node is not a valid block device or node, DeviceNotFound
1432 # If @name is already taken, GenericError with an explanation
1436 { 'command': 'block-dirty-bitmap-add',
1437 'data': 'BlockDirtyBitmapAdd' }
1440 # @block-dirty-bitmap-remove:
1442 # Remove a dirty bitmap on the node
1444 # Returns: nothing on success
1445 # If @node is not a valid block device or node, DeviceNotFound
1446 # If @name is not found, GenericError with an explanation
1447 # if @name is frozen by an operation, GenericError
1451 { 'command': 'block-dirty-bitmap-remove',
1452 'data': 'BlockDirtyBitmap' }
1455 # @block-dirty-bitmap-clear:
1457 # Clear (reset) a dirty bitmap on the device
1459 # Returns: nothing on success
1460 # If @node is not a valid block device, DeviceNotFound
1461 # If @name is not found, GenericError with an explanation
1465 { 'command': 'block-dirty-bitmap-clear',
1466 'data': 'BlockDirtyBitmap' }
1471 # Start mirroring a block device's writes to a new destination.
1473 # @job-id: #optional identifier for the newly-created block job. If
1474 # omitted, the device name will be used. (Since 2.7)
1476 # @device: The device name or node-name of a root node whose writes should be
1479 # @target: the id or node-name of the block device to mirror to. This mustn't be
1480 # attached to guest.
1482 # @replaces: #optional with sync=full graph node name to be replaced by the new
1483 # image when a whole image copy is done. This can be used to repair
1484 # broken Quorum files.
1486 # @speed: #optional the maximum speed, in bytes per second
1488 # @sync: what parts of the disk image should be copied to the destination
1489 # (all the disk, only the sectors allocated in the topmost image, or
1492 # @granularity: #optional granularity of the dirty bitmap, default is 64K
1493 # if the image format doesn't have clusters, 4K if the clusters
1494 # are smaller than that, else the cluster size. Must be a
1495 # power of 2 between 512 and 64M
1497 # @buf-size: #optional maximum amount of data in flight from source to
1500 # @on-source-error: #optional the action to take on an error on the source,
1501 # default 'report'. 'stop' and 'enospc' can only be used
1502 # if the block device supports io-status (see BlockInfo).
1504 # @on-target-error: #optional the action to take on an error on the target,
1505 # default 'report' (no limitations, since this applies to
1506 # a different block device than @device).
1508 # Returns: nothing on success.
1512 { 'command': 'blockdev-mirror',
1513 'data': { '*job-id': 'str', 'device': 'str', 'target': 'str',
1515 'sync': 'MirrorSyncMode',
1516 '*speed': 'int', '*granularity': 'uint32',
1517 '*buf-size': 'int', '*on-source-error': 'BlockdevOnError',
1518 '*on-target-error': 'BlockdevOnError' } }
1521 # @block_set_io_throttle:
1523 # Change I/O throttle limits for a block drive.
1525 # Since QEMU 2.4, each device with I/O limits is member of a throttle
1528 # If two or more devices are members of the same group, the limits
1529 # will apply to the combined I/O of the whole group in a round-robin
1530 # fashion. Therefore, setting new I/O limits to a device will affect
1533 # The name of the group can be specified using the 'group' parameter.
1534 # If the parameter is unset, it is assumed to be the current group of
1535 # that device. If it's not in any group yet, the name of the device
1536 # will be used as the name for its group.
1538 # The 'group' parameter can also be used to move a device to a
1539 # different group. In this case the limits specified in the parameters
1540 # will be applied to the new group only.
1542 # I/O limits can be disabled by setting all of them to 0. In this case
1543 # the device will be removed from its group and the rest of its
1544 # members will not be affected. The 'group' parameter is ignored.
1546 # See BlockIOThrottle for parameter descriptions.
1548 # Returns: Nothing on success
1549 # If @device is not a valid block device, DeviceNotFound
1553 { 'command': 'block_set_io_throttle', 'boxed': true,
1554 'data': 'BlockIOThrottle' }
1559 # A set of parameters describing block throttling.
1561 # @device: #optional Block device name (deprecated, use @id instead)
1563 # @id: #optional The name or QOM path of the guest device (since: 2.8)
1565 # @bps: total throughput limit in bytes per second
1567 # @bps_rd: read throughput limit in bytes per second
1569 # @bps_wr: write throughput limit in bytes per second
1571 # @iops: total I/O operations per second
1573 # @iops_rd: read I/O operations per second
1575 # @iops_wr: write I/O operations per second
1577 # @bps_max: #optional total throughput limit during bursts,
1578 # in bytes (Since 1.7)
1580 # @bps_rd_max: #optional read throughput limit during bursts,
1581 # in bytes (Since 1.7)
1583 # @bps_wr_max: #optional write throughput limit during bursts,
1584 # in bytes (Since 1.7)
1586 # @iops_max: #optional total I/O operations per second during bursts,
1587 # in bytes (Since 1.7)
1589 # @iops_rd_max: #optional read I/O operations per second during bursts,
1590 # in bytes (Since 1.7)
1592 # @iops_wr_max: #optional write I/O operations per second during bursts,
1593 # in bytes (Since 1.7)
1595 # @bps_max_length: #optional maximum length of the @bps_max burst
1596 # period, in seconds. It must only
1597 # be set if @bps_max is set as well.
1598 # Defaults to 1. (Since 2.6)
1600 # @bps_rd_max_length: #optional maximum length of the @bps_rd_max
1601 # burst period, in seconds. It must only
1602 # be set if @bps_rd_max is set as well.
1603 # Defaults to 1. (Since 2.6)
1605 # @bps_wr_max_length: #optional maximum length of the @bps_wr_max
1606 # burst period, in seconds. It must only
1607 # be set if @bps_wr_max is set as well.
1608 # Defaults to 1. (Since 2.6)
1610 # @iops_max_length: #optional maximum length of the @iops burst
1611 # period, in seconds. It must only
1612 # be set if @iops_max is set as well.
1613 # Defaults to 1. (Since 2.6)
1615 # @iops_rd_max_length: #optional maximum length of the @iops_rd_max
1616 # burst period, in seconds. It must only
1617 # be set if @iops_rd_max is set as well.
1618 # Defaults to 1. (Since 2.6)
1620 # @iops_wr_max_length: #optional maximum length of the @iops_wr_max
1621 # burst period, in seconds. It must only
1622 # be set if @iops_wr_max is set as well.
1623 # Defaults to 1. (Since 2.6)
1625 # @iops_size: #optional an I/O size in bytes (Since 1.7)
1627 # @group: #optional throttle group name (Since 2.4)
1631 { 'struct': 'BlockIOThrottle',
1632 'data': { '*device': 'str', '*id': 'str', 'bps': 'int', 'bps_rd': 'int',
1633 'bps_wr': 'int', 'iops': 'int', 'iops_rd': 'int', 'iops_wr': 'int',
1634 '*bps_max': 'int', '*bps_rd_max': 'int',
1635 '*bps_wr_max': 'int', '*iops_max': 'int',
1636 '*iops_rd_max': 'int', '*iops_wr_max': 'int',
1637 '*bps_max_length': 'int', '*bps_rd_max_length': 'int',
1638 '*bps_wr_max_length': 'int', '*iops_max_length': 'int',
1639 '*iops_rd_max_length': 'int', '*iops_wr_max_length': 'int',
1640 '*iops_size': 'int', '*group': 'str' } }
1645 # Copy data from a backing file into a block device.
1647 # The block streaming operation is performed in the background until the entire
1648 # backing file has been copied. This command returns immediately once streaming
1649 # has started. The status of ongoing block streaming operations can be checked
1650 # with query-block-jobs. The operation can be stopped before it has completed
1651 # using the block-job-cancel command.
1653 # The node that receives the data is called the top image, can be located in
1654 # any part of the chain (but always above the base image; see below) and can be
1655 # specified using its device or node name. Earlier qemu versions only allowed
1656 # 'device' to name the top level node; presence of the 'base-node' parameter
1657 # during introspection can be used as a witness of the enhanced semantics
1660 # If a base file is specified then sectors are not copied from that base file and
1661 # its backing chain. When streaming completes the image file will have the base
1662 # file as its backing file. This can be used to stream a subset of the backing
1663 # file chain instead of flattening the entire image.
1665 # On successful completion the image file is updated to drop the backing file
1666 # and the BLOCK_JOB_COMPLETED event is emitted.
1668 # @job-id: #optional identifier for the newly-created block job. If
1669 # omitted, the device name will be used. (Since 2.7)
1671 # @device: the device or node name of the top image
1673 # @base: #optional the common backing file name.
1674 # It cannot be set if @base-node is also set.
1676 # @base-node: #optional the node name of the backing file.
1677 # It cannot be set if @base is also set. (Since 2.8)
1679 # @backing-file: #optional The backing file string to write into the top
1680 # image. This filename is not validated.
1682 # If a pathname string is such that it cannot be
1683 # resolved by QEMU, that means that subsequent QMP or
1684 # HMP commands must use node-names for the image in
1685 # question, as filename lookup methods will fail.
1687 # If not specified, QEMU will automatically determine
1688 # the backing file string to use, or error out if there
1689 # is no obvious choice. Care should be taken when
1690 # specifying the string, to specify a valid filename or
1694 # @speed: #optional the maximum speed, in bytes per second
1696 # @on-error: #optional the action to take on an error (default report).
1697 # 'stop' and 'enospc' can only be used if the block device
1698 # supports io-status (see BlockInfo). Since 1.3.
1702 { 'command': 'block-stream',
1703 'data': { '*job-id': 'str', 'device': 'str', '*base': 'str',
1704 '*base-node': 'str', '*backing-file': 'str', '*speed': 'int',
1705 '*on-error': 'BlockdevOnError' } }
1708 # @block-job-set-speed:
1710 # Set maximum speed for a background block operation.
1712 # This command can only be issued when there is an active block job.
1714 # Throttling can be disabled by setting the speed to 0.
1716 # @device: The job identifier. This used to be a device name (hence
1717 # the name of the parameter), but since QEMU 2.7 it can have
1720 # @speed: the maximum speed, in bytes per second, or 0 for unlimited.
1723 # Returns: Nothing on success
1724 # If no background operation is active on this device, DeviceNotActive
1728 { 'command': 'block-job-set-speed',
1729 'data': { 'device': 'str', 'speed': 'int' } }
1732 # @block-job-cancel:
1734 # Stop an active background block operation.
1736 # This command returns immediately after marking the active background block
1737 # operation for cancellation. It is an error to call this command if no
1738 # operation is in progress.
1740 # The operation will cancel as soon as possible and then emit the
1741 # BLOCK_JOB_CANCELLED event. Before that happens the job is still visible when
1742 # enumerated using query-block-jobs.
1744 # For streaming, the image file retains its backing file unless the streaming
1745 # operation happens to complete just as it is being cancelled. A new streaming
1746 # operation can be started at a later time to finish copying all data from the
1749 # @device: The job identifier. This used to be a device name (hence
1750 # the name of the parameter), but since QEMU 2.7 it can have
1753 # @force: #optional whether to allow cancellation of a paused job (default
1754 # false). Since 1.3.
1756 # Returns: Nothing on success
1757 # If no background operation is active on this device, DeviceNotActive
1761 { 'command': 'block-job-cancel', 'data': { 'device': 'str', '*force': 'bool' } }
1766 # Pause an active background block operation.
1768 # This command returns immediately after marking the active background block
1769 # operation for pausing. It is an error to call this command if no
1770 # operation is in progress. Pausing an already paused job has no cumulative
1771 # effect; a single block-job-resume command will resume the job.
1773 # The operation will pause as soon as possible. No event is emitted when
1774 # the operation is actually paused. Cancelling a paused job automatically
1777 # @device: The job identifier. This used to be a device name (hence
1778 # the name of the parameter), but since QEMU 2.7 it can have
1781 # Returns: Nothing on success
1782 # If no background operation is active on this device, DeviceNotActive
1786 { 'command': 'block-job-pause', 'data': { 'device': 'str' } }
1789 # @block-job-resume:
1791 # Resume an active background block operation.
1793 # This command returns immediately after resuming a paused background block
1794 # operation. It is an error to call this command if no operation is in
1795 # progress. Resuming an already running job is not an error.
1797 # This command also clears the error status of the job.
1799 # @device: The job identifier. This used to be a device name (hence
1800 # the name of the parameter), but since QEMU 2.7 it can have
1803 # Returns: Nothing on success
1804 # If no background operation is active on this device, DeviceNotActive
1808 { 'command': 'block-job-resume', 'data': { 'device': 'str' } }
1811 # @block-job-complete:
1813 # Manually trigger completion of an active background block operation. This
1814 # is supported for drive mirroring, where it also switches the device to
1815 # write to the target path only. The ability to complete is signaled with
1816 # a BLOCK_JOB_READY event.
1818 # This command completes an active background block operation synchronously.
1819 # The ordering of this command's return with the BLOCK_JOB_COMPLETED event
1820 # is not defined. Note that if an I/O error occurs during the processing of
1821 # this command: 1) the command itself will fail; 2) the error will be processed
1822 # according to the rerror/werror arguments that were specified when starting
1825 # A cancelled or paused job cannot be completed.
1827 # @device: The job identifier. This used to be a device name (hence
1828 # the name of the parameter), but since QEMU 2.7 it can have
1831 # Returns: Nothing on success
1832 # If no background operation is active on this device, DeviceNotActive
1836 { 'command': 'block-job-complete', 'data': { 'device': 'str' } }
1839 # @BlockdevDiscardOptions:
1841 # Determines how to handle discard requests.
1843 # @ignore: Ignore the request
1844 # @unmap: Forward as an unmap request
1848 { 'enum': 'BlockdevDiscardOptions',
1849 'data': [ 'ignore', 'unmap' ] }
1852 # @BlockdevDetectZeroesOptions:
1854 # Describes the operation mode for the automatic conversion of plain
1855 # zero writes by the OS to driver specific optimized zero write commands.
1857 # @off: Disabled (default)
1859 # @unmap: Enabled and even try to unmap blocks if possible. This requires
1860 # also that @BlockdevDiscardOptions is set to unmap for this device.
1864 { 'enum': 'BlockdevDetectZeroesOptions',
1865 'data': [ 'off', 'on', 'unmap' ] }
1868 # @BlockdevAioOptions:
1870 # Selects the AIO backend to handle I/O requests
1872 # @threads: Use qemu's thread pool
1873 # @native: Use native AIO backend (only Linux and Windows)
1877 { 'enum': 'BlockdevAioOptions',
1878 'data': [ 'threads', 'native' ] }
1881 # @BlockdevCacheOptions:
1883 # Includes cache-related options for block devices
1885 # @direct: #optional enables use of O_DIRECT (bypass the host page cache;
1887 # @no-flush: #optional ignore any flush requests for the device (default:
1892 { 'struct': 'BlockdevCacheOptions',
1893 'data': { '*direct': 'bool',
1894 '*no-flush': 'bool' } }
1899 # Drivers that are supported in block device operations.
1901 # @host_device: Since 2.1
1902 # @host_cdrom: Since 2.1
1903 # @gluster: Since 2.7
1906 # @replication: Since 2.8
1911 { 'enum': 'BlockdevDriver',
1912 'data': [ 'archipelago', 'blkdebug', 'blkverify', 'bochs', 'cloop',
1913 'dmg', 'file', 'ftp', 'ftps', 'gluster', 'host_cdrom',
1914 'host_device', 'http', 'https', 'luks', 'nbd', 'nfs', 'null-aio',
1915 'null-co', 'parallels', 'qcow', 'qcow2', 'qed', 'quorum', 'raw',
1916 'replication', 'ssh', 'vdi', 'vhdx', 'vmdk', 'vpc',
1920 # @BlockdevOptionsFile:
1922 # Driver specific block device options for the file backend.
1924 # @filename: path to the image file
1925 # @aio: #optional AIO backend (default: threads) (since: 2.8)
1929 { 'struct': 'BlockdevOptionsFile',
1930 'data': { 'filename': 'str',
1931 '*aio': 'BlockdevAioOptions' } }
1934 # @BlockdevOptionsNull:
1936 # Driver specific block device options for the null backend.
1938 # @size: #optional size of the device in bytes.
1939 # @latency-ns: #optional emulated latency (in nanoseconds) in processing
1940 # requests. Default to zero which completes requests immediately.
1945 { 'struct': 'BlockdevOptionsNull',
1946 'data': { '*size': 'int', '*latency-ns': 'uint64' } }
1949 # @BlockdevOptionsVVFAT:
1951 # Driver specific block device options for the vvfat protocol.
1953 # @dir: directory to be exported as FAT image
1954 # @fat-type: #optional FAT type: 12, 16 or 32
1955 # @floppy: #optional whether to export a floppy image (true) or
1956 # partitioned hard disk (false; default)
1957 # @label: #optional set the volume label, limited to 11 bytes. FAT16 and
1958 # FAT32 traditionally have some restrictions on labels, which are
1959 # ignored by most operating systems. Defaults to "QEMU VVFAT".
1961 # @rw: #optional whether to allow write operations (default: false)
1965 { 'struct': 'BlockdevOptionsVVFAT',
1966 'data': { 'dir': 'str', '*fat-type': 'int', '*floppy': 'bool',
1967 '*label': 'str', '*rw': 'bool' } }
1970 # @BlockdevOptionsGenericFormat:
1972 # Driver specific block device options for image format that have no option
1973 # besides their data source.
1975 # @file: reference to or definition of the data source block device
1979 { 'struct': 'BlockdevOptionsGenericFormat',
1980 'data': { 'file': 'BlockdevRef' } }
1983 # @BlockdevOptionsLUKS:
1985 # Driver specific block device options for LUKS.
1987 # @key-secret: #optional the ID of a QCryptoSecret object providing
1988 # the decryption key (since 2.6). Mandatory except when
1989 # doing a metadata-only probe of the image.
1993 { 'struct': 'BlockdevOptionsLUKS',
1994 'base': 'BlockdevOptionsGenericFormat',
1995 'data': { '*key-secret': 'str' } }
1999 # @BlockdevOptionsGenericCOWFormat:
2001 # Driver specific block device options for image format that have no option
2002 # besides their data source and an optional backing file.
2004 # @backing: #optional reference to or definition of the backing file block
2005 # device (if missing, taken from the image file content). It is
2006 # allowed to pass an empty string here in order to disable the
2007 # default backing file.
2011 { 'struct': 'BlockdevOptionsGenericCOWFormat',
2012 'base': 'BlockdevOptionsGenericFormat',
2013 'data': { '*backing': 'BlockdevRef' } }
2016 # @Qcow2OverlapCheckMode:
2018 # General overlap check modes.
2020 # @none: Do not perform any checks
2022 # @constant: Perform only checks which can be done in constant time and
2023 # without reading anything from disk
2025 # @cached: Perform only checks which can be done without reading anything
2028 # @all: Perform all available overlap checks
2032 { 'enum': 'Qcow2OverlapCheckMode',
2033 'data': [ 'none', 'constant', 'cached', 'all' ] }
2036 # @Qcow2OverlapCheckFlags:
2038 # Structure of flags for each metadata structure. Setting a field to 'true'
2039 # makes qemu guard that structure against unintended overwriting. The default
2040 # value is chosen according to the template given.
2042 # @template: Specifies a template mode which can be adjusted using the other
2043 # flags, defaults to 'cached'
2047 { 'struct': 'Qcow2OverlapCheckFlags',
2048 'data': { '*template': 'Qcow2OverlapCheckMode',
2049 '*main-header': 'bool',
2050 '*active-l1': 'bool',
2051 '*active-l2': 'bool',
2052 '*refcount-table': 'bool',
2053 '*refcount-block': 'bool',
2054 '*snapshot-table': 'bool',
2055 '*inactive-l1': 'bool',
2056 '*inactive-l2': 'bool' } }
2059 # @Qcow2OverlapChecks:
2061 # Specifies which metadata structures should be guarded against unintended
2064 # @flags: set of flags for separate specification of each metadata structure
2067 # @mode: named mode which chooses a specific set of flags
2071 { 'alternate': 'Qcow2OverlapChecks',
2072 'data': { 'flags': 'Qcow2OverlapCheckFlags',
2073 'mode': 'Qcow2OverlapCheckMode' } }
2076 # @BlockdevOptionsQcow2:
2078 # Driver specific block device options for qcow2.
2080 # @lazy-refcounts: #optional whether to enable the lazy refcounts
2081 # feature (default is taken from the image file)
2083 # @pass-discard-request: #optional whether discard requests to the qcow2
2084 # device should be forwarded to the data source
2086 # @pass-discard-snapshot: #optional whether discard requests for the data source
2087 # should be issued when a snapshot operation (e.g.
2088 # deleting a snapshot) frees clusters in the qcow2 file
2090 # @pass-discard-other: #optional whether discard requests for the data source
2091 # should be issued on other occasions where a cluster
2094 # @overlap-check: #optional which overlap checks to perform for writes
2095 # to the image, defaults to 'cached' (since 2.2)
2097 # @cache-size: #optional the maximum total size of the L2 table and
2098 # refcount block caches in bytes (since 2.2)
2100 # @l2-cache-size: #optional the maximum size of the L2 table cache in
2103 # @refcount-cache-size: #optional the maximum size of the refcount block cache
2104 # in bytes (since 2.2)
2106 # @cache-clean-interval: #optional clean unused entries in the L2 and refcount
2107 # caches. The interval is in seconds. The default value
2108 # is 0 and it disables this feature (since 2.5)
2112 { 'struct': 'BlockdevOptionsQcow2',
2113 'base': 'BlockdevOptionsGenericCOWFormat',
2114 'data': { '*lazy-refcounts': 'bool',
2115 '*pass-discard-request': 'bool',
2116 '*pass-discard-snapshot': 'bool',
2117 '*pass-discard-other': 'bool',
2118 '*overlap-check': 'Qcow2OverlapChecks',
2119 '*cache-size': 'int',
2120 '*l2-cache-size': 'int',
2121 '*refcount-cache-size': 'int',
2122 '*cache-clean-interval': 'int' } }
2126 # @BlockdevOptionsArchipelago:
2128 # Driver specific block device options for Archipelago.
2130 # @volume: Name of the Archipelago volume image
2132 # @mport: #optional The port number on which mapperd is
2133 # listening. This is optional
2134 # and if not specified, QEMU will make Archipelago
2135 # use the default port (1001).
2137 # @vport: #optional The port number on which vlmcd is
2138 # listening. This is optional
2139 # and if not specified, QEMU will make Archipelago
2140 # use the default port (501).
2142 # @segment: #optional The name of the shared memory segment
2143 # Archipelago stack is using. This is optional
2144 # and if not specified, QEMU will make Archipelago
2145 # use the default value, 'archipelago'.
2148 { 'struct': 'BlockdevOptionsArchipelago',
2149 'data': { 'volume': 'str',
2152 '*segment': 'str' } }
2155 # @BlockdevOptionsSsh:
2157 # @server: host address
2159 # @path: path to the image on the host
2161 # @user: #optional user as which to connect, defaults to current
2164 # TODO: Expose the host_key_check option in QMP
2168 { 'struct': 'BlockdevOptionsSsh',
2169 'data': { 'server': 'InetSocketAddress',
2177 # Trigger events supported by blkdebug.
2181 { 'enum': 'BlkdebugEvent', 'prefix': 'BLKDBG',
2182 'data': [ 'l1_update', 'l1_grow_alloc_table', 'l1_grow_write_table',
2183 'l1_grow_activate_table', 'l2_load', 'l2_update',
2184 'l2_update_compressed', 'l2_alloc_cow_read', 'l2_alloc_write',
2185 'read_aio', 'read_backing_aio', 'read_compressed', 'write_aio',
2186 'write_compressed', 'vmstate_load', 'vmstate_save', 'cow_read',
2187 'cow_write', 'reftable_load', 'reftable_grow', 'reftable_update',
2188 'refblock_load', 'refblock_update', 'refblock_update_part',
2189 'refblock_alloc', 'refblock_alloc_hookup', 'refblock_alloc_write',
2190 'refblock_alloc_write_blocks', 'refblock_alloc_write_table',
2191 'refblock_alloc_switch_table', 'cluster_alloc',
2192 'cluster_alloc_bytes', 'cluster_free', 'flush_to_os',
2193 'flush_to_disk', 'pwritev_rmw_head', 'pwritev_rmw_after_head',
2194 'pwritev_rmw_tail', 'pwritev_rmw_after_tail', 'pwritev',
2195 'pwritev_zero', 'pwritev_done', 'empty_image_prepare' ] }
2198 # @BlkdebugInjectErrorOptions:
2200 # Describes a single error injection for blkdebug.
2202 # @event: trigger event
2204 # @state: #optional the state identifier blkdebug needs to be in to
2205 # actually trigger the event; defaults to "any"
2207 # @errno: #optional error identifier (errno) to be returned; defaults to
2210 # @sector: #optional specifies the sector index which has to be affected
2211 # in order to actually trigger the event; defaults to "any
2214 # @once: #optional disables further events after this one has been
2215 # triggered; defaults to false
2217 # @immediately: #optional fail immediately; defaults to false
2221 { 'struct': 'BlkdebugInjectErrorOptions',
2222 'data': { 'event': 'BlkdebugEvent',
2227 '*immediately': 'bool' } }
2230 # @BlkdebugSetStateOptions:
2232 # Describes a single state-change event for blkdebug.
2234 # @event: trigger event
2236 # @state: #optional the current state identifier blkdebug needs to be in;
2239 # @new_state: the state identifier blkdebug is supposed to assume if
2240 # this event is triggered
2244 { 'struct': 'BlkdebugSetStateOptions',
2245 'data': { 'event': 'BlkdebugEvent',
2247 'new_state': 'int' } }
2250 # @BlockdevOptionsBlkdebug:
2252 # Driver specific block device options for blkdebug.
2254 # @image: underlying raw block device (or image file)
2256 # @config: #optional filename of the configuration file
2258 # @align: #optional required alignment for requests in bytes,
2259 # must be power of 2, or 0 for default
2261 # @inject-error: #optional array of error injection descriptions
2263 # @set-state: #optional array of state-change descriptions
2267 { 'struct': 'BlockdevOptionsBlkdebug',
2268 'data': { 'image': 'BlockdevRef',
2271 '*inject-error': ['BlkdebugInjectErrorOptions'],
2272 '*set-state': ['BlkdebugSetStateOptions'] } }
2275 # @BlockdevOptionsBlkverify:
2277 # Driver specific block device options for blkverify.
2279 # @test: block device to be tested
2281 # @raw: raw image used for verification
2285 { 'struct': 'BlockdevOptionsBlkverify',
2286 'data': { 'test': 'BlockdevRef',
2287 'raw': 'BlockdevRef' } }
2290 # @QuorumReadPattern:
2292 # An enumeration of quorum read patterns.
2294 # @quorum: read all the children and do a quorum vote on reads
2296 # @fifo: read only from the first child that has not failed
2300 { 'enum': 'QuorumReadPattern', 'data': [ 'quorum', 'fifo' ] }
2303 # @BlockdevOptionsQuorum:
2305 # Driver specific block device options for Quorum
2307 # @blkverify: #optional true if the driver must print content mismatch
2308 # set to false by default
2310 # @children: the children block devices to use
2312 # @vote-threshold: the vote limit under which a read will fail
2314 # @rewrite-corrupted: #optional rewrite corrupted data when quorum is reached
2317 # @read-pattern: #optional choose read pattern and set to quorum by default
2322 { 'struct': 'BlockdevOptionsQuorum',
2323 'data': { '*blkverify': 'bool',
2324 'children': [ 'BlockdevRef' ],
2325 'vote-threshold': 'int',
2326 '*rewrite-corrupted': 'bool',
2327 '*read-pattern': 'QuorumReadPattern' } }
2330 # @GlusterTransport:
2332 # An enumeration of Gluster transport types
2334 # @tcp: TCP - Transmission Control Protocol
2336 # @unix: UNIX - Unix domain socket
2340 { 'enum': 'GlusterTransport',
2341 'data': [ 'unix', 'tcp' ] }
2347 # Captures the address of a socket
2349 # Details for connecting to a gluster server
2351 # @type: Transport type used for gluster connection
2353 # This is similar to SocketAddress, only distinction:
2355 # 1. GlusterServer is a flat union, SocketAddress is a simple union.
2356 # A flat union is nicer than simple because it avoids nesting
2357 # (i.e. more {}) on the wire.
2359 # 2. GlusterServer lacks case 'fd', since gluster doesn't let you
2360 # pass in a file descriptor.
2362 # GlusterServer is actually not Gluster-specific, its a
2363 # compatibility evolved into an alternate for SocketAddress.
2367 { 'union': 'GlusterServer',
2368 'base': { 'type': 'GlusterTransport' },
2369 'discriminator': 'type',
2370 'data': { 'unix': 'UnixSocketAddress',
2371 'tcp': 'InetSocketAddress' } }
2374 # @BlockdevOptionsGluster:
2376 # Driver specific block device options for Gluster
2378 # @volume: name of gluster volume where VM image resides
2380 # @path: absolute path to image file in gluster volume
2382 # @server: gluster servers description
2384 # @debug: #optional libgfapi log level (default '4' which is Error)
2387 # @logfile: #optional libgfapi log file (default /dev/stderr) (Since 2.8)
2391 { 'struct': 'BlockdevOptionsGluster',
2392 'data': { 'volume': 'str',
2394 'server': ['GlusterServer'],
2396 '*logfile': 'str' } }
2401 # An enumeration of replication modes.
2403 # @primary: Primary mode, the vm's state will be sent to secondary QEMU.
2405 # @secondary: Secondary mode, receive the vm's state from primary QEMU.
2409 { 'enum' : 'ReplicationMode', 'data' : [ 'primary', 'secondary' ] }
2412 # @BlockdevOptionsReplication:
2414 # Driver specific block device options for replication
2416 # @mode: the replication mode
2418 # @top-id: #optional In secondary mode, node name or device ID of the root
2419 # node who owns the replication node chain. Must not be given in
2424 { 'struct': 'BlockdevOptionsReplication',
2425 'base': 'BlockdevOptionsGenericFormat',
2426 'data': { 'mode': 'ReplicationMode',
2427 '*top-id': 'str' } }
2432 # An enumeration of NFS transport types
2434 # @inet: TCP transport
2438 { 'enum': 'NFSTransport',
2439 'data': [ 'inet' ] }
2444 # Captures the address of the socket
2446 # @type: transport type used for NFS (only TCP supported)
2448 # @host: host address for NFS server
2452 { 'struct': 'NFSServer',
2453 'data': { 'type': 'NFSTransport',
2457 # @BlockdevOptionsNfs:
2459 # Driver specific block device option for NFS
2461 # @server: host address
2463 # @path: path of the image on the host
2465 # @user: #optional UID value to use when talking to the
2466 # server (defaults to 65534 on Windows and getuid()
2469 # @group: #optional GID value to use when talking to the
2470 # server (defaults to 65534 on Windows and getgid()
2473 # @tcp-syn-count: #optional number of SYNs during the session
2474 # establishment (defaults to libnfs default)
2476 # @readahead-size: #optional set the readahead size in bytes (defaults
2477 # to libnfs default)
2479 # @page-cache-size: #optional set the pagecache size in bytes (defaults
2480 # to libnfs default)
2482 # @debug: #optional set the NFS debug level (max 2) (defaults
2483 # to libnfs default)
2487 { 'struct': 'BlockdevOptionsNfs',
2488 'data': { 'server': 'NFSServer',
2492 '*tcp-syn-count': 'int',
2493 '*readahead-size': 'int',
2494 '*page-cache-size': 'int',
2498 # @BlockdevOptionsCurl:
2500 # Driver specific block device options for the curl backend.
2502 # @filename: path to the image file
2506 { 'struct': 'BlockdevOptionsCurl',
2507 'data': { 'filename': 'str' } }
2510 # @BlockdevOptionsNbd:
2512 # Driver specific block device options for NBD.
2514 # @server: NBD server address
2516 # @export: #optional export name
2518 # @tls-creds: #optional TLS credentials ID
2522 { 'struct': 'BlockdevOptionsNbd',
2523 'data': { 'server': 'SocketAddress',
2525 '*tls-creds': 'str' } }
2528 # @BlockdevOptionsRaw:
2530 # Driver specific block device options for the raw driver.
2532 # @offset: #optional position where the block device starts
2533 # @size: #optional the assumed size of the device
2537 { 'struct': 'BlockdevOptionsRaw',
2538 'base': 'BlockdevOptionsGenericFormat',
2539 'data': { '*offset': 'int', '*size': 'int' } }
2544 # Options for creating a block device. Many options are available for all
2545 # block devices, independent of the block driver:
2547 # @driver: block driver name
2548 # @node-name: #optional the node name of the new node (Since 2.0).
2549 # This option is required on the top level of blockdev-add.
2550 # @discard: #optional discard-related options (default: ignore)
2551 # @cache: #optional cache-related options
2552 # @read-only: #optional whether the block device should be read-only
2554 # @detect-zeroes: #optional detect and optimize zero writes (Since 2.1)
2557 # Remaining options are determined by the block driver.
2561 { 'union': 'BlockdevOptions',
2562 'base': { 'driver': 'BlockdevDriver',
2563 '*node-name': 'str',
2564 '*discard': 'BlockdevDiscardOptions',
2565 '*cache': 'BlockdevCacheOptions',
2566 '*read-only': 'bool',
2567 '*detect-zeroes': 'BlockdevDetectZeroesOptions' },
2568 'discriminator': 'driver',
2570 'archipelago':'BlockdevOptionsArchipelago',
2571 'blkdebug': 'BlockdevOptionsBlkdebug',
2572 'blkverify': 'BlockdevOptionsBlkverify',
2573 'bochs': 'BlockdevOptionsGenericFormat',
2574 'cloop': 'BlockdevOptionsGenericFormat',
2575 'dmg': 'BlockdevOptionsGenericFormat',
2576 'file': 'BlockdevOptionsFile',
2577 'ftp': 'BlockdevOptionsCurl',
2578 'ftps': 'BlockdevOptionsCurl',
2579 'gluster': 'BlockdevOptionsGluster',
2580 'host_cdrom': 'BlockdevOptionsFile',
2581 'host_device':'BlockdevOptionsFile',
2582 'http': 'BlockdevOptionsCurl',
2583 'https': 'BlockdevOptionsCurl',
2584 # TODO iscsi: Wait for structured options
2585 'luks': 'BlockdevOptionsLUKS',
2586 'nbd': 'BlockdevOptionsNbd',
2587 'nfs': 'BlockdevOptionsNfs',
2588 'null-aio': 'BlockdevOptionsNull',
2589 'null-co': 'BlockdevOptionsNull',
2590 'parallels': 'BlockdevOptionsGenericFormat',
2591 'qcow2': 'BlockdevOptionsQcow2',
2592 'qcow': 'BlockdevOptionsGenericCOWFormat',
2593 'qed': 'BlockdevOptionsGenericCOWFormat',
2594 'quorum': 'BlockdevOptionsQuorum',
2595 'raw': 'BlockdevOptionsRaw',
2596 # TODO rbd: Wait for structured options
2597 'replication':'BlockdevOptionsReplication',
2598 # TODO sheepdog: Wait for structured options
2599 'ssh': 'BlockdevOptionsSsh',
2600 'vdi': 'BlockdevOptionsGenericFormat',
2601 'vhdx': 'BlockdevOptionsGenericFormat',
2602 'vmdk': 'BlockdevOptionsGenericCOWFormat',
2603 'vpc': 'BlockdevOptionsGenericFormat',
2604 'vvfat': 'BlockdevOptionsVVFAT'
2610 # Reference to a block device.
2612 # @definition: defines a new block device inline
2613 # @reference: references the ID of an existing block device. An
2614 # empty string means that no block device should be
2619 { 'alternate': 'BlockdevRef',
2620 'data': { 'definition': 'BlockdevOptions',
2621 'reference': 'str' } }
2626 # Creates a new block device. If the @id option is given at the top level, a
2627 # BlockBackend will be created; otherwise, @node-name is mandatory at the top
2628 # level and no BlockBackend will be created.
2630 # For the arguments, see the documentation of BlockdevOptions.
2632 # Note: This command is still a work in progress. It doesn't support all
2633 # block drivers among other things. Stay away from it unless you want
2634 # to help with its development.
2638 { 'command': 'blockdev-add', 'data': 'BlockdevOptions', 'boxed': true }
2643 # Deletes a block device that has been added using blockdev-add.
2644 # The command will fail if the node is attached to a device or is
2645 # otherwise being used.
2647 # @node-name: Name of the graph node to delete.
2649 # Note: This command is still a work in progress and is considered
2650 # experimental. Stay away from it unless you want to help with its
2655 { 'command': 'x-blockdev-del', 'data': { 'node-name': 'str' } }
2658 # @blockdev-open-tray:
2660 # Opens a block device's tray. If there is a block driver state tree inserted as
2661 # a medium, it will become inaccessible to the guest (but it will remain
2662 # associated to the block device, so closing the tray will make it accessible
2665 # If the tray was already open before, this will be a no-op.
2667 # Once the tray opens, a DEVICE_TRAY_MOVED event is emitted. There are cases in
2668 # which no such event will be generated, these include:
2669 # - if the guest has locked the tray, @force is false and the guest does not
2670 # respond to the eject request
2671 # - if the BlockBackend denoted by @device does not have a guest device attached
2673 # - if the guest device does not have an actual tray
2675 # @device: #optional Block device name (deprecated, use @id instead)
2677 # @id: #optional The name or QOM path of the guest device (since: 2.8)
2679 # @force: #optional if false (the default), an eject request will be sent to
2680 # the guest if it has locked the tray (and the tray will not be opened
2681 # immediately); if true, the tray will be opened regardless of whether
2686 { 'command': 'blockdev-open-tray',
2687 'data': { '*device': 'str',
2689 '*force': 'bool' } }
2692 # @blockdev-close-tray:
2694 # Closes a block device's tray. If there is a block driver state tree associated
2695 # with the block device (which is currently ejected), that tree will be loaded
2698 # If the tray was already closed before, this will be a no-op.
2700 # @device: #optional Block device name (deprecated, use @id instead)
2702 # @id: #optional The name or QOM path of the guest device (since: 2.8)
2706 { 'command': 'blockdev-close-tray',
2707 'data': { '*device': 'str',
2711 # @x-blockdev-remove-medium:
2713 # Removes a medium (a block driver state tree) from a block device. That block
2714 # device's tray must currently be open (unless there is no attached guest
2717 # If the tray is open and there is no medium inserted, this will be a no-op.
2719 # @device: #optional Block device name (deprecated, use @id instead)
2721 # @id: #optional The name or QOM path of the guest device (since: 2.8)
2723 # Note: This command is still a work in progress and is considered experimental.
2724 # Stay away from it unless you want to help with its development.
2728 { 'command': 'x-blockdev-remove-medium',
2729 'data': { '*device': 'str',
2733 # @x-blockdev-insert-medium:
2735 # Inserts a medium (a block driver state tree) into a block device. That block
2736 # device's tray must currently be open (unless there is no attached guest
2737 # device) and there must be no medium inserted already.
2739 # @device: #optional Block device name (deprecated, use @id instead)
2741 # @id: #optional The name or QOM path of the guest device (since: 2.8)
2743 # @node-name: name of a node in the block driver state graph
2745 # Note: This command is still a work in progress and is considered experimental.
2746 # Stay away from it unless you want to help with its development.
2750 { 'command': 'x-blockdev-insert-medium',
2751 'data': { '*device': 'str',
2753 'node-name': 'str'} }
2757 # @BlockdevChangeReadOnlyMode:
2759 # Specifies the new read-only mode of a block device subject to the
2760 # @blockdev-change-medium command.
2762 # @retain: Retains the current read-only mode
2764 # @read-only: Makes the device read-only
2766 # @read-write: Makes the device writable
2770 { 'enum': 'BlockdevChangeReadOnlyMode',
2771 'data': ['retain', 'read-only', 'read-write'] }
2775 # @blockdev-change-medium:
2777 # Changes the medium inserted into a block device by ejecting the current medium
2778 # and loading a new image file which is inserted as the new medium (this command
2779 # combines blockdev-open-tray, x-blockdev-remove-medium,
2780 # x-blockdev-insert-medium and blockdev-close-tray).
2782 # @device: #optional Block device name (deprecated, use @id instead)
2784 # @id: #optional The name or QOM path of the guest device
2787 # @filename: filename of the new image to be loaded
2789 # @format: #optional, format to open the new image with (defaults to
2790 # the probed format)
2792 # @read-only-mode: #optional, change the read-only mode of the device; defaults
2797 { 'command': 'blockdev-change-medium',
2798 'data': { '*device': 'str',
2802 '*read-only-mode': 'BlockdevChangeReadOnlyMode' } }
2806 # @BlockErrorAction:
2808 # An enumeration of action that has been taken when a DISK I/O occurs
2810 # @ignore: error has been ignored
2812 # @report: error has been reported to the device
2814 # @stop: error caused VM to be stopped
2818 { 'enum': 'BlockErrorAction',
2819 'data': [ 'ignore', 'report', 'stop' ] }
2823 # @BLOCK_IMAGE_CORRUPTED:
2825 # Emitted when a corruption has been detected in a disk image
2827 # @device: device name. This is always present for compatibility
2828 # reasons, but it can be empty ("") if the image does not
2829 # have a device name associated.
2831 # @node-name: #optional node name (Since: 2.4)
2833 # @msg: informative message for human consumption, such as the kind of
2834 # corruption being detected. It should not be parsed by machine as it is
2835 # not guaranteed to be stable
2837 # @offset: #optional, if the corruption resulted from an image access, this is
2838 # the host's access offset into the image
2840 # @size: #optional, if the corruption resulted from an image access, this is
2843 # fatal: if set, the image is marked corrupt and therefore unusable after this
2844 # event and must be repaired (Since 2.2; before, every
2845 # BLOCK_IMAGE_CORRUPTED event was fatal)
2849 { 'event': 'BLOCK_IMAGE_CORRUPTED',
2850 'data': { 'device' : 'str',
2851 '*node-name' : 'str',
2855 'fatal' : 'bool' } }
2860 # Emitted when a disk I/O error occurs
2862 # @device: device name. This is always present for compatibility
2863 # reasons, but it can be empty ("") if the image does not
2864 # have a device name associated.
2866 # @node-name: node name. Note that errors may be reported for the root node
2867 # that is directly attached to a guest device rather than for the
2868 # node where the error occurred. (Since: 2.8)
2870 # @operation: I/O operation
2872 # @action: action that has been taken
2874 # @nospace: #optional true if I/O error was caused due to a no-space
2875 # condition. This key is only present if query-block's
2876 # io-status is present, please see query-block documentation
2877 # for more information (since: 2.2)
2879 # @reason: human readable string describing the error cause.
2880 # (This field is a debugging aid for humans, it should not
2881 # be parsed by applications) (since: 2.2)
2883 # Note: If action is "stop", a STOP event will eventually follow the
2884 # BLOCK_IO_ERROR event
2888 { 'event': 'BLOCK_IO_ERROR',
2889 'data': { 'device': 'str', 'node-name': 'str', 'operation': 'IoOperationType',
2890 'action': 'BlockErrorAction', '*nospace': 'bool',
2894 # @BLOCK_JOB_COMPLETED:
2896 # Emitted when a block job has completed
2900 # @device: The job identifier. Originally the device name but other
2901 # values are allowed since QEMU 2.7
2903 # @len: maximum progress value
2905 # @offset: current progress value. On success this is equal to len.
2906 # On failure this is less than len
2908 # @speed: rate limit, bytes per second
2910 # @error: #optional, error message. Only present on failure. This field
2911 # contains a human-readable error message. There are no semantics
2912 # other than that streaming has failed and clients should not try to
2913 # interpret the error string
2917 { 'event': 'BLOCK_JOB_COMPLETED',
2918 'data': { 'type' : 'BlockJobType',
2926 # @BLOCK_JOB_CANCELLED:
2928 # Emitted when a block job has been cancelled
2932 # @device: The job identifier. Originally the device name but other
2933 # values are allowed since QEMU 2.7
2935 # @len: maximum progress value
2937 # @offset: current progress value. On success this is equal to len.
2938 # On failure this is less than len
2940 # @speed: rate limit, bytes per second
2944 { 'event': 'BLOCK_JOB_CANCELLED',
2945 'data': { 'type' : 'BlockJobType',
2954 # Emitted when a block job encounters an error
2956 # @device: The job identifier. Originally the device name but other
2957 # values are allowed since QEMU 2.7
2959 # @operation: I/O operation
2961 # @action: action that has been taken
2965 { 'event': 'BLOCK_JOB_ERROR',
2966 'data': { 'device' : 'str',
2967 'operation': 'IoOperationType',
2968 'action' : 'BlockErrorAction' } }
2973 # Emitted when a block job is ready to complete
2977 # @device: The job identifier. Originally the device name but other
2978 # values are allowed since QEMU 2.7
2980 # @len: maximum progress value
2982 # @offset: current progress value. On success this is equal to len.
2983 # On failure this is less than len
2985 # @speed: rate limit, bytes per second
2987 # Note: The "ready to complete" status is always reset by a @BLOCK_JOB_ERROR
2992 { 'event': 'BLOCK_JOB_READY',
2993 'data': { 'type' : 'BlockJobType',
3002 # Preallocation mode of QEMU image file
3004 # @off: no preallocation
3005 # @metadata: preallocate only for metadata
3006 # @falloc: like @full preallocation but allocate disk space by
3007 # posix_fallocate() rather than writing zeros.
3008 # @full: preallocate all data by writing zeros to device to ensure disk
3009 # space is really available. @full preallocation also sets up
3010 # metadata correctly.
3014 { 'enum': 'PreallocMode',
3015 'data': [ 'off', 'metadata', 'falloc', 'full' ] }
3018 # @BLOCK_WRITE_THRESHOLD:
3020 # Emitted when writes on block device reaches or exceeds the
3021 # configured write threshold. For thin-provisioned devices, this
3022 # means the device should be extended to avoid pausing for
3024 # The event is one shot. Once triggered, it needs to be
3025 # re-registered with another block-set-threshold command.
3027 # @node-name: graph node name on which the threshold was exceeded.
3029 # @amount-exceeded: amount of data which exceeded the threshold, in bytes.
3031 # @write-threshold: last configured threshold, in bytes.
3035 { 'event': 'BLOCK_WRITE_THRESHOLD',
3036 'data': { 'node-name': 'str',
3037 'amount-exceeded': 'uint64',
3038 'write-threshold': 'uint64' } }
3041 # @block-set-write-threshold:
3043 # Change the write threshold for a block drive. An event will be delivered
3044 # if a write to this block drive crosses the configured threshold.
3045 # This is useful to transparently resize thin-provisioned drives without
3046 # the guest OS noticing.
3048 # @node-name: graph node name on which the threshold must be set.
3050 # @write-threshold: configured threshold for the block device, bytes.
3051 # Use 0 to disable the threshold.
3055 { 'command': 'block-set-write-threshold',
3056 'data': { 'node-name': 'str', 'write-threshold': 'uint64' } }
3059 # @x-blockdev-change:
3061 # Dynamically reconfigure the block driver state graph. It can be used
3062 # to add, remove, insert or replace a graph node. Currently only the
3063 # Quorum driver implements this feature to add or remove its child. This
3064 # is useful to fix a broken quorum child.
3066 # If @node is specified, it will be inserted under @parent. @child
3067 # may not be specified in this case. If both @parent and @child are
3068 # specified but @node is not, @child will be detached from @parent.
3070 # @parent: the id or name of the parent node.
3072 # @child: #optional the name of a child under the given parent node.
3074 # @node: #optional the name of the node that will be added.
3076 # Note: this command is experimental, and its API is not stable. It
3077 # does not support all kinds of operations, all kinds of children, nor
3078 # all block drivers.
3080 # Warning: The data in a new quorum child MUST be consistent with that of
3081 # the rest of the array.
3085 { 'command': 'x-blockdev-change',
3086 'data' : { 'parent': 'str',