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 { 'struct': '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 { 'struct': '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 { 'struct': 'ImageInfoSpecificVmdk',
74 'extents': ['ImageInfo']
80 # 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)
133 { 'struct': 'ImageInfo',
134 'data': {'filename': 'str', 'format': 'str', '*dirty-flag': 'bool',
135 '*actual-size': 'int', 'virtual-size': 'int',
136 '*cluster-size': 'int', '*encrypted': 'bool', '*compressed': 'bool',
137 '*backing-filename': 'str', '*full-backing-filename': 'str',
138 '*backing-filename-format': 'str', '*snapshots': ['SnapshotInfo'],
139 '*backing-image': 'ImageInfo',
140 '*format-specific': 'ImageInfoSpecific' } }
145 # Information about a QEMU image file check
147 # @filename: name of the image file checked
149 # @format: format of the image file checked
151 # @check-errors: number of unexpected errors occurred during check
153 # @image-end-offset: #optional offset (in bytes) where the image ends, this
154 # field is present if the driver for the image format
157 # @corruptions: #optional number of corruptions found during the check if any
159 # @leaks: #optional number of leaks found during the check if any
161 # @corruptions-fixed: #optional number of corruptions fixed during the check
164 # @leaks-fixed: #optional number of leaks fixed during the check if any
166 # @total-clusters: #optional total number of clusters, this field is present
167 # if the driver for the image format supports it
169 # @allocated-clusters: #optional total number of allocated clusters, this
170 # field is present if the driver for the image format
173 # @fragmented-clusters: #optional total number of fragmented clusters, this
174 # field is present if the driver for the image format
177 # @compressed-clusters: #optional total number of compressed clusters, this
178 # field is present if the driver for the image format
185 { 'struct': 'ImageCheck',
186 'data': {'filename': 'str', 'format': 'str', 'check-errors': 'int',
187 '*image-end-offset': 'int', '*corruptions': 'int', '*leaks': 'int',
188 '*corruptions-fixed': 'int', '*leaks-fixed': 'int',
189 '*total-clusters': 'int', '*allocated-clusters': 'int',
190 '*fragmented-clusters': 'int', '*compressed-clusters': 'int' } }
195 # Mapping information from a virtual block range to a host file range
197 # @start: the start byte of the mapped virtual range
199 # @length: the number of bytes of the mapped virtual range
201 # @data: whether the mapped range has data
203 # @zero: whether the virtual blocks are zeroed
205 # @depth: the depth of the mapping
207 # @offset: #optional the offset in file that the virtual sectors are mapped to
209 # @filename: #optional filename that is referred to by @offset
214 { 'struct': 'MapEntry',
215 'data': {'start': 'int', 'length': 'int', 'data': 'bool',
216 'zero': 'bool', 'depth': 'int', '*offset': 'int',
217 '*filename': 'str' } }
222 # Cache mode information for a block device
224 # @writeback: true if writeback mode is enabled
225 # @direct: true if the host page cache is bypassed (O_DIRECT)
226 # @no-flush: true if flush requests are ignored for the device
230 { 'struct': 'BlockdevCacheInfo',
231 'data': { 'writeback': 'bool',
233 'no-flush': 'bool' } }
238 # Information about the backing device for a block device.
240 # @file: the filename of the backing device
242 # @node-name: #optional the name of the block driver node (Since 2.0)
244 # @ro: true if the backing device was open read-only
246 # @drv: the name of the block format used to open the backing device. As of
247 # 0.14.0 this can be: 'blkdebug', 'bochs', 'cloop', 'cow', 'dmg',
248 # 'file', 'file', 'ftp', 'ftps', 'host_cdrom', 'host_device',
249 # 'http', 'https', 'luks', 'nbd', 'parallels', 'qcow',
250 # 'qcow2', 'raw', 'tftp', 'vdi', 'vmdk', 'vpc', 'vvfat'
251 # 2.2: 'archipelago' added, 'cow' dropped
252 # 2.3: 'host_floppy' deprecated
253 # 2.5: 'host_floppy' dropped
256 # @backing_file: #optional the name of the backing file (for copy-on-write)
258 # @backing_file_depth: number of files in the backing file chain (since: 1.2)
260 # @encrypted: true if the backing device is encrypted
262 # @encryption_key_missing: true if the backing device is encrypted but an
263 # valid encryption key is missing
265 # @detect_zeroes: detect and optimize zero writes (Since 2.1)
267 # @bps: total throughput limit in bytes per second is specified
269 # @bps_rd: read throughput limit in bytes per second is specified
271 # @bps_wr: write throughput limit in bytes per second is specified
273 # @iops: total I/O operations per second is specified
275 # @iops_rd: read I/O operations per second is specified
277 # @iops_wr: write I/O operations per second is specified
279 # @image: the info of image used (since: 1.6)
281 # @bps_max: #optional total throughput limit during bursts,
282 # in bytes (Since 1.7)
284 # @bps_rd_max: #optional read throughput limit during bursts,
285 # in bytes (Since 1.7)
287 # @bps_wr_max: #optional write throughput limit during bursts,
288 # in bytes (Since 1.7)
290 # @iops_max: #optional total I/O operations per second during bursts,
291 # in bytes (Since 1.7)
293 # @iops_rd_max: #optional read I/O operations per second during bursts,
294 # in bytes (Since 1.7)
296 # @iops_wr_max: #optional write I/O operations per second during bursts,
297 # in bytes (Since 1.7)
299 # @bps_max_length: #optional maximum length of the @bps_max burst
300 # period, in seconds. (Since 2.6)
302 # @bps_rd_max_length: #optional maximum length of the @bps_rd_max
303 # burst period, in seconds. (Since 2.6)
305 # @bps_wr_max_length: #optional maximum length of the @bps_wr_max
306 # burst period, in seconds. (Since 2.6)
308 # @iops_max_length: #optional maximum length of the @iops burst
309 # period, in seconds. (Since 2.6)
311 # @iops_rd_max_length: #optional maximum length of the @iops_rd_max
312 # burst period, in seconds. (Since 2.6)
314 # @iops_wr_max_length: #optional maximum length of the @iops_wr_max
315 # burst period, in seconds. (Since 2.6)
317 # @iops_size: #optional an I/O size in bytes (Since 1.7)
319 # @group: #optional throttle group name (Since 2.4)
321 # @cache: the cache mode used for the block device (since: 2.3)
323 # @write_threshold: configured write threshold for the device.
324 # 0 if disabled. (Since 2.3)
329 { 'struct': 'BlockDeviceInfo',
330 'data': { 'file': 'str', '*node-name': 'str', 'ro': 'bool', 'drv': 'str',
331 '*backing_file': 'str', 'backing_file_depth': 'int',
332 'encrypted': 'bool', 'encryption_key_missing': 'bool',
333 'detect_zeroes': 'BlockdevDetectZeroesOptions',
334 'bps': 'int', 'bps_rd': 'int', 'bps_wr': 'int',
335 'iops': 'int', 'iops_rd': 'int', 'iops_wr': 'int',
336 'image': 'ImageInfo',
337 '*bps_max': 'int', '*bps_rd_max': 'int',
338 '*bps_wr_max': 'int', '*iops_max': 'int',
339 '*iops_rd_max': 'int', '*iops_wr_max': 'int',
340 '*bps_max_length': 'int', '*bps_rd_max_length': 'int',
341 '*bps_wr_max_length': 'int', '*iops_max_length': 'int',
342 '*iops_rd_max_length': 'int', '*iops_wr_max_length': 'int',
343 '*iops_size': 'int', '*group': 'str', 'cache': 'BlockdevCacheInfo',
344 'write_threshold': 'int' } }
347 # @BlockDeviceIoStatus:
349 # An enumeration of block device I/O status.
351 # @ok: The last I/O operation has succeeded
353 # @failed: The last I/O operation has failed
355 # @nospace: The last I/O operation has failed due to a no-space condition
359 { 'enum': 'BlockDeviceIoStatus', 'data': [ 'ok', 'failed', 'nospace' ] }
362 # @BlockDeviceMapEntry:
364 # Entry in the metadata map of the device (returned by "qemu-img map")
366 # @start: Offset in the image of the first byte described by this entry
369 # @length: Length of the range described by this entry (in bytes)
371 # @depth: Number of layers (0 = top image, 1 = top image's backing file, etc.)
372 # before reaching one for which the range is allocated. The value is
373 # in the range 0 to the depth of the image chain - 1.
375 # @zero: the sectors in this range read as zeros
377 # @data: reading the image will actually read data from a file (in particular,
378 # if @offset is present this means that the sectors are not simply
379 # preallocated, but contain actual data in raw format)
381 # @offset: if present, the image file stores the data for this range in
382 # raw format at the given offset.
386 { 'struct': 'BlockDeviceMapEntry',
387 'data': { 'start': 'int', 'length': 'int', 'depth': 'int', 'zero': 'bool',
388 'data': 'bool', '*offset': 'int' } }
391 # @DirtyBitmapStatus:
393 # An enumeration of possible states that a dirty bitmap can report to the user.
395 # @frozen: The bitmap is currently in-use by a backup operation or block job,
398 # @disabled: The bitmap is currently in-use by an internal operation and is
399 # read-only. It can still be deleted.
401 # @active: The bitmap is actively monitoring for new writes, and can be cleared,
402 # deleted, or used for backup operations.
406 { 'enum': 'DirtyBitmapStatus',
407 'data': ['active', 'disabled', 'frozen'] }
412 # Block dirty bitmap information.
414 # @name: #optional the name of the dirty bitmap (Since 2.4)
416 # @count: number of dirty bytes according to the dirty bitmap
418 # @granularity: granularity of the dirty bitmap in bytes (since 1.4)
420 # @status: current status of the dirty bitmap (since 2.4)
424 { 'struct': 'BlockDirtyInfo',
425 'data': {'*name': 'str', 'count': 'int', 'granularity': 'uint32',
426 'status': 'DirtyBitmapStatus'} }
431 # Block device information. This structure describes a virtual device and
432 # the backing device associated with it.
434 # @device: The device name associated with the virtual device.
436 # @type: This field is returned only for compatibility reasons, it should
437 # not be used (always returns 'unknown')
439 # @removable: True if the device supports removable media.
441 # @locked: True if the guest has locked this device from having its media
444 # @tray_open: #optional True if the device's tray is open
445 # (only present if it has a tray)
447 # @dirty-bitmaps: #optional dirty bitmaps information (only present if the
448 # driver has one or more dirty bitmaps) (Since 2.0)
450 # @io-status: #optional @BlockDeviceIoStatus. Only present if the device
451 # supports it and the VM is configured to stop on errors
452 # (supported device models: virtio-blk, ide, scsi-disk)
454 # @inserted: #optional @BlockDeviceInfo describing the device if media is
459 { 'struct': 'BlockInfo',
460 'data': {'device': 'str', 'type': 'str', 'removable': 'bool',
461 'locked': 'bool', '*inserted': 'BlockDeviceInfo',
462 '*tray_open': 'bool', '*io-status': 'BlockDeviceIoStatus',
463 '*dirty-bitmaps': ['BlockDirtyInfo'] } }
468 # Get a list of BlockInfo for all virtual block devices.
470 # Returns: a list of @BlockInfo describing each virtual block device
474 { 'command': 'query-block', 'returns': ['BlockInfo'] }
478 # @BlockDeviceTimedStats:
480 # Statistics of a block device during a given interval of time.
482 # @interval_length: Interval used for calculating the statistics,
485 # @min_rd_latency_ns: Minimum latency of read operations in the
486 # defined interval, in nanoseconds.
488 # @min_wr_latency_ns: Minimum latency of write operations in the
489 # defined interval, in nanoseconds.
491 # @min_flush_latency_ns: Minimum latency of flush operations in the
492 # defined interval, in nanoseconds.
494 # @max_rd_latency_ns: Maximum latency of read operations in the
495 # defined interval, in nanoseconds.
497 # @max_wr_latency_ns: Maximum latency of write operations in the
498 # defined interval, in nanoseconds.
500 # @max_flush_latency_ns: Maximum latency of flush operations in the
501 # defined interval, in nanoseconds.
503 # @avg_rd_latency_ns: Average latency of read operations in the
504 # defined interval, in nanoseconds.
506 # @avg_wr_latency_ns: Average latency of write operations in the
507 # defined interval, in nanoseconds.
509 # @avg_flush_latency_ns: Average latency of flush operations in the
510 # defined interval, in nanoseconds.
512 # @avg_rd_queue_depth: Average number of pending read operations
513 # in the defined interval.
515 # @avg_wr_queue_depth: Average number of pending write operations
516 # in the defined interval.
521 { 'struct': 'BlockDeviceTimedStats',
522 'data': { 'interval_length': 'int', 'min_rd_latency_ns': 'int',
523 'max_rd_latency_ns': 'int', 'avg_rd_latency_ns': 'int',
524 'min_wr_latency_ns': 'int', 'max_wr_latency_ns': 'int',
525 'avg_wr_latency_ns': 'int', 'min_flush_latency_ns': 'int',
526 'max_flush_latency_ns': 'int', 'avg_flush_latency_ns': 'int',
527 'avg_rd_queue_depth': 'number', 'avg_wr_queue_depth': 'number' } }
532 # Statistics of a virtual block device or a block backing device.
534 # @rd_bytes: The number of bytes read by the device.
536 # @wr_bytes: The number of bytes written by the device.
538 # @rd_operations: The number of read operations performed by the device.
540 # @wr_operations: The number of write operations performed by the device.
542 # @flush_operations: The number of cache flush operations performed by the
543 # device (since 0.15.0)
545 # @flush_total_time_ns: Total time spend on cache flushes in nano-seconds
548 # @wr_total_time_ns: Total time spend on writes in nano-seconds (since 0.15.0).
550 # @rd_total_time_ns: Total_time_spend on reads in nano-seconds (since 0.15.0).
552 # @wr_highest_offset: The offset after the greatest byte written to the
553 # device. The intended use of this information is for
554 # growable sparse files (like qcow2) that are used on top
555 # of a physical device.
557 # @rd_merged: Number of read requests that have been merged into another
558 # request (Since 2.3).
560 # @wr_merged: Number of write requests that have been merged into another
561 # request (Since 2.3).
563 # @idle_time_ns: #optional Time since the last I/O operation, in
564 # nanoseconds. If the field is absent it means that
565 # there haven't been any operations yet (Since 2.5).
567 # @failed_rd_operations: The number of failed read operations
568 # performed by the device (Since 2.5)
570 # @failed_wr_operations: The number of failed write operations
571 # performed by the device (Since 2.5)
573 # @failed_flush_operations: The number of failed flush operations
574 # performed by the device (Since 2.5)
576 # @invalid_rd_operations: The number of invalid read operations
577 # performed by the device (Since 2.5)
579 # @invalid_wr_operations: The number of invalid write operations
580 # performed by the device (Since 2.5)
582 # @invalid_flush_operations: The number of invalid flush operations
583 # performed by the device (Since 2.5)
585 # @account_invalid: Whether invalid operations are included in the
586 # last access statistics (Since 2.5)
588 # @account_failed: Whether failed operations are included in the
589 # latency and last access statistics (Since 2.5)
591 # @timed_stats: Statistics specific to the set of previously defined
592 # intervals of time (Since 2.5)
596 { 'struct': 'BlockDeviceStats',
597 'data': {'rd_bytes': 'int', 'wr_bytes': 'int', 'rd_operations': 'int',
598 'wr_operations': 'int', 'flush_operations': 'int',
599 'flush_total_time_ns': 'int', 'wr_total_time_ns': 'int',
600 'rd_total_time_ns': 'int', 'wr_highest_offset': 'int',
601 'rd_merged': 'int', 'wr_merged': 'int', '*idle_time_ns': 'int',
602 'failed_rd_operations': 'int', 'failed_wr_operations': 'int',
603 'failed_flush_operations': 'int', 'invalid_rd_operations': 'int',
604 'invalid_wr_operations': 'int', 'invalid_flush_operations': 'int',
605 'account_invalid': 'bool', 'account_failed': 'bool',
606 'timed_stats': ['BlockDeviceTimedStats'] } }
611 # Statistics of a virtual block device or a block backing device.
613 # @device: #optional If the stats are for a virtual block device, the name
614 # corresponding to the virtual block device.
616 # @node-name: #optional The node name of the device. (Since 2.3)
618 # @stats: A @BlockDeviceStats for the device.
620 # @parent: #optional This describes the file block device if it has one.
622 # @backing: #optional This describes the backing block device if it has one.
627 { 'struct': 'BlockStats',
628 'data': {'*device': 'str', '*node-name': 'str',
629 'stats': 'BlockDeviceStats',
630 '*parent': 'BlockStats',
631 '*backing': 'BlockStats'} }
636 # Query the @BlockStats for all virtual block devices.
638 # @query-nodes: #optional If true, the command will query all the block nodes
639 # that have a node name, in a list which will include "parent"
640 # information, but not "backing".
641 # If false or omitted, the behavior is as before - query all the
642 # device backends, recursively including their "parent" and
643 # "backing". (Since 2.3)
645 # Returns: A list of @BlockStats for each virtual block devices.
649 { 'command': 'query-blockstats',
650 'data': { '*query-nodes': 'bool' },
651 'returns': ['BlockStats'] }
656 # An enumeration of possible behaviors for errors on I/O operations.
657 # The exact meaning depends on whether the I/O was initiated by a guest
660 # @report: for guest operations, report the error to the guest;
661 # for jobs, cancel the job
663 # @ignore: ignore the error, only report a QMP event (BLOCK_IO_ERROR
664 # or BLOCK_JOB_ERROR)
666 # @enospc: same as @stop on ENOSPC, same as @report otherwise.
668 # @stop: for guest operations, stop the virtual machine;
669 # for jobs, pause the job
671 # @auto: inherit the error handling policy of the backend (since: 2.7)
675 { 'enum': 'BlockdevOnError',
676 'data': ['report', 'ignore', 'enospc', 'stop', 'auto'] }
681 # An enumeration of possible behaviors for the initial synchronization
682 # phase of storage mirroring.
684 # @top: copies data in the topmost image to the destination
686 # @full: copies data from all images to the destination
688 # @none: only copy data written from now on
690 # @incremental: only copy data described by the dirty bitmap. Since: 2.4
694 { 'enum': 'MirrorSyncMode',
695 'data': ['top', 'full', 'none', 'incremental'] }
700 # Type of a block job.
702 # @commit: block commit job type, see "block-commit"
704 # @stream: block stream job type, see "block-stream"
706 # @mirror: drive mirror job type, see "drive-mirror"
708 # @backup: drive backup job type, see "drive-backup"
712 { 'enum': 'BlockJobType',
713 'data': ['commit', 'stream', 'mirror', 'backup'] }
718 # Information about a long-running block device operation.
720 # @type: the job type ('stream' for image streaming)
722 # @device: The job identifier. Originally the device name but other
723 # values are allowed since QEMU 2.7
725 # @len: the maximum progress value
727 # @busy: false if the job is known to be in a quiescent state, with
728 # no pending I/O. Since 1.3.
730 # @paused: whether the job is paused or, if @busy is true, will
731 # pause itself as soon as possible. Since 1.3.
733 # @offset: the current progress value
735 # @speed: the rate limit, bytes per second
737 # @io-status: the status of the job (since 1.3)
739 # @ready: true if the job may be completed (since 2.2)
743 { 'struct': 'BlockJobInfo',
744 'data': {'type': 'str', 'device': 'str', 'len': 'int',
745 'offset': 'int', 'busy': 'bool', 'paused': 'bool', 'speed': 'int',
746 'io-status': 'BlockDeviceIoStatus', 'ready': 'bool'} }
751 # Return information about long-running block device operations.
753 # Returns: a list of @BlockJobInfo for each active block job
757 { 'command': 'query-block-jobs', 'returns': ['BlockJobInfo'] }
762 # This command sets the password of a block device that has not been open
763 # with a password and requires one.
765 # The two cases where this can happen are a block device is created through
766 # QEMU's initial command line or a block device is changed through the legacy
769 # In the event that the block device is created through the initial command
770 # line, the VM will start in the stopped state regardless of whether '-S' is
771 # used. The intention is for a management tool to query the block devices to
772 # determine which ones are encrypted, set the passwords with this command, and
773 # then start the guest with the @cont command.
775 # Either @device or @node-name must be set but not both.
777 # @device: #optional the name of the block backend device to set the password on
779 # @node-name: #optional graph node name to set the password on (Since 2.0)
781 # @password: the password to use for the device
783 # Returns: nothing on success
784 # If @device is not a valid block device, DeviceNotFound
785 # If @device is not encrypted, DeviceNotEncrypted
787 # Notes: Not all block formats support encryption and some that do are not
788 # able to validate that a password is correct. Disk corruption may
789 # occur if an invalid password is specified.
793 { 'command': 'block_passwd', 'data': {'*device': 'str',
794 '*node-name': 'str', 'password': 'str'} }
799 # Resize a block image while a guest is running.
801 # Either @device or @node-name must be set but not both.
803 # @device: #optional the name of the device to get the image resized
805 # @node-name: #optional graph node name to get the image resized (Since 2.0)
807 # @size: new image size in bytes
809 # Returns: nothing on success
810 # If @device is not a valid block device, DeviceNotFound
814 { 'command': 'block_resize', 'data': { '*device': 'str',
821 # An enumeration that tells QEMU how to set the backing file path in
824 # @existing: QEMU should look for an existing image file.
826 # @absolute-paths: QEMU should create a new image with absolute paths
827 # for the backing file. If there is no backing file available, the new
828 # image will not be backed either.
832 { 'enum': 'NewImageMode',
833 'data': [ 'existing', 'absolute-paths' ] }
836 # @BlockdevSnapshotSync
838 # Either @device or @node-name must be set but not both.
840 # @device: #optional the name of the device to generate the snapshot from.
842 # @node-name: #optional graph node name to generate the snapshot from (Since 2.0)
844 # @snapshot-file: the target of the new image. A new file will be created.
846 # @snapshot-node-name: #optional the graph node name of the new image (Since 2.0)
848 # @format: #optional the format of the snapshot image, default is 'qcow2'.
850 # @mode: #optional whether and how QEMU should create a new image, default is
853 { 'struct': 'BlockdevSnapshotSync',
854 'data': { '*device': 'str', '*node-name': 'str',
855 'snapshot-file': 'str', '*snapshot-node-name': 'str',
856 '*format': 'str', '*mode': 'NewImageMode' } }
861 # @node: device or node name that will have a snapshot created.
863 # @overlay: reference to the existing block device that will become
864 # the overlay of @node, as part of creating the snapshot.
865 # It must not have a current backing file (this can be
866 # achieved by passing "backing": "" to blockdev-add).
870 { 'struct': 'BlockdevSnapshot',
871 'data': { 'node': 'str', 'overlay': 'str' } }
876 # @job-id: #optional identifier for the newly-created block job. If
877 # omitted, the device name will be used. (Since 2.7)
879 # @device: the name of the device which should be copied.
881 # @target: the target of the new image. If the file exists, or if it
882 # is a device, the existing file/device will be used as the new
883 # destination. If it does not exist, a new file will be created.
885 # @format: #optional the format of the new destination, default is to
886 # probe if @mode is 'existing', else the format of the source
888 # @sync: what parts of the disk image should be copied to the destination
889 # (all the disk, only the sectors allocated in the topmost image, from a
890 # dirty bitmap, or only new I/O).
892 # @mode: #optional whether and how QEMU should create a new image, default is
895 # @speed: #optional the maximum speed, in bytes per second
897 # @bitmap: #optional the name of dirty bitmap if sync is "incremental".
898 # Must be present if sync is "incremental", must NOT be present
899 # otherwise. (Since 2.4)
901 # @on-source-error: #optional the action to take on an error on the source,
902 # default 'report'. 'stop' and 'enospc' can only be used
903 # if the block device supports io-status (see BlockInfo).
905 # @on-target-error: #optional the action to take on an error on the target,
906 # default 'report' (no limitations, since this applies to
907 # a different block device than @device).
909 # Note that @on-source-error and @on-target-error only affect background I/O.
910 # If an error occurs during a guest write request, the device's rerror/werror
911 # actions will be used.
915 { 'struct': 'DriveBackup',
916 'data': { '*job-id': 'str', 'device': 'str', 'target': 'str',
917 '*format': 'str', 'sync': 'MirrorSyncMode', '*mode': 'NewImageMode',
918 '*speed': 'int', '*bitmap': 'str',
919 '*on-source-error': 'BlockdevOnError',
920 '*on-target-error': 'BlockdevOnError' } }
925 # @job-id: #optional identifier for the newly-created block job. If
926 # omitted, the device name will be used. (Since 2.7)
928 # @device: the device name or node-name of a root node which should be copied.
930 # @target: the device name or node-name of the backup target node.
932 # @sync: what parts of the disk image should be copied to the destination
933 # (all the disk, only the sectors allocated in the topmost image, or
936 # @speed: #optional the maximum speed, in bytes per second. The default is 0,
939 # @on-source-error: #optional the action to take on an error on the source,
940 # default 'report'. 'stop' and 'enospc' can only be used
941 # if the block device supports io-status (see BlockInfo).
943 # @on-target-error: #optional the action to take on an error on the target,
944 # default 'report' (no limitations, since this applies to
945 # a different block device than @device).
947 # Note that @on-source-error and @on-target-error only affect background I/O.
948 # If an error occurs during a guest write request, the device's rerror/werror
949 # actions will be used.
953 { 'struct': 'BlockdevBackup',
954 'data': { '*job-id': 'str', 'device': 'str', 'target': 'str',
955 'sync': 'MirrorSyncMode',
957 '*on-source-error': 'BlockdevOnError',
958 '*on-target-error': 'BlockdevOnError' } }
961 # @blockdev-snapshot-sync
963 # Generates a synchronous snapshot of a block device.
965 # For the arguments, see the documentation of BlockdevSnapshotSync.
967 # Returns: nothing on success
968 # If @device is not a valid block device, DeviceNotFound
972 { 'command': 'blockdev-snapshot-sync',
973 'data': 'BlockdevSnapshotSync' }
979 # Generates a snapshot of a block device.
981 # For the arguments, see the documentation of BlockdevSnapshot.
985 { 'command': 'blockdev-snapshot',
986 'data': 'BlockdevSnapshot' }
989 # @change-backing-file
991 # Change the backing file in the image file metadata. This does not
992 # cause QEMU to reopen the image file to reparse the backing filename
993 # (it may, however, perform a reopen to change permissions from
994 # r/o -> r/w -> r/o, if needed). The new backing file string is written
995 # into the image file metadata, and the QEMU internal strings are
998 # @image-node-name: The name of the block driver state node of the
1001 # @device: The name of the device that owns image-node-name.
1003 # @backing-file: The string to write as the backing file. This
1004 # string is not validated, so care should be taken
1005 # when specifying the string or the image chain may
1006 # not be able to be reopened again.
1010 { 'command': 'change-backing-file',
1011 'data': { 'device': 'str', 'image-node-name': 'str',
1012 'backing-file': 'str' } }
1017 # Live commit of data from overlay image nodes into backing nodes - i.e.,
1018 # writes data between 'top' and 'base' into 'base'.
1020 # @job-id: #optional identifier for the newly-created block job. If
1021 # omitted, the device name will be used. (Since 2.7)
1023 # @device: the device name or node-name of a root node
1025 # @base: #optional The file name of the backing image to write data into.
1026 # If not specified, this is the deepest backing image
1028 # @top: #optional The file name of the backing image within the image chain,
1029 # which contains the topmost data to be committed down. If
1030 # not specified, this is the active layer.
1032 # @backing-file: #optional The backing file string to write into the overlay
1033 # image of 'top'. If 'top' is the active layer,
1034 # specifying a backing file string is an error. This
1035 # filename is not validated.
1037 # If a pathname string is such that it cannot be
1038 # resolved by QEMU, that means that subsequent QMP or
1039 # HMP commands must use node-names for the image in
1040 # question, as filename lookup methods will fail.
1042 # If not specified, QEMU will automatically determine
1043 # the backing file string to use, or error out if
1044 # there is no obvious choice. Care should be taken
1045 # when specifying the string, to specify a valid
1046 # filename or protocol.
1049 # If top == base, that is an error.
1050 # If top == active, the job will not be completed by itself,
1051 # user needs to complete the job with the block-job-complete
1052 # command after getting the ready event. (Since 2.0)
1054 # If the base image is smaller than top, then the base image
1055 # will be resized to be the same size as top. If top is
1056 # smaller than the base image, the base will not be
1057 # truncated. If you want the base image size to match the
1058 # size of the smaller top, you can safely truncate it
1059 # yourself once the commit operation successfully completes.
1061 # @speed: #optional the maximum speed, in bytes per second
1063 # Returns: Nothing on success
1064 # If commit or stream is already active on this device, DeviceInUse
1065 # If @device does not exist, DeviceNotFound
1066 # If image commit is not supported by this device, NotSupported
1067 # If @base or @top is invalid, a generic error is returned
1068 # If @speed is invalid, InvalidParameter
1073 { 'command': 'block-commit',
1074 'data': { '*job-id': 'str', 'device': 'str', '*base': 'str', '*top': 'str',
1075 '*backing-file': 'str', '*speed': 'int' } }
1080 # Start a point-in-time copy of a block device to a new destination. The
1081 # status of ongoing drive-backup operations can be checked with
1082 # query-block-jobs where the BlockJobInfo.type field has the value 'backup'.
1083 # The operation can be stopped before it has completed using the
1084 # block-job-cancel command.
1086 # For the arguments, see the documentation of DriveBackup.
1088 # Returns: nothing on success
1089 # If @device is not a valid block device, DeviceNotFound
1093 { 'command': 'drive-backup', 'data': 'DriveBackup' }
1098 # Start a point-in-time copy of a block device to a new destination. The
1099 # status of ongoing blockdev-backup operations can be checked with
1100 # query-block-jobs where the BlockJobInfo.type field has the value 'backup'.
1101 # The operation can be stopped before it has completed using the
1102 # block-job-cancel command.
1104 # For the arguments, see the documentation of BlockdevBackup.
1108 { 'command': 'blockdev-backup', 'data': 'BlockdevBackup' }
1112 # @query-named-block-nodes
1114 # Get the named block driver list
1116 # Returns: the list of BlockDeviceInfo
1120 { 'command': 'query-named-block-nodes', 'returns': [ 'BlockDeviceInfo' ] }
1125 # Start mirroring a block device's writes to a new destination.
1127 # See DriveMirror for parameter descriptions
1129 # Returns: nothing on success
1130 # If @device is not a valid block device, DeviceNotFound
1134 { 'command': 'drive-mirror', 'boxed': true,
1135 'data': 'DriveMirror' }
1140 # A set of parameters describing drive mirror setup.
1142 # @job-id: #optional identifier for the newly-created block job. If
1143 # omitted, the device name will be used. (Since 2.7)
1145 # @device: the name of the device whose writes should be mirrored.
1147 # @target: the target of the new image. If the file exists, or if it
1148 # is a device, the existing file/device will be used as the new
1149 # destination. If it does not exist, a new file will be created.
1151 # @format: #optional the format of the new destination, default is to
1152 # probe if @mode is 'existing', else the format of the source
1154 # @node-name: #optional the new block driver state node name in the graph
1157 # @replaces: #optional with sync=full graph node name to be replaced by the new
1158 # image when a whole image copy is done. This can be used to repair
1159 # broken Quorum files. (Since 2.1)
1161 # @mode: #optional whether and how QEMU should create a new image, default is
1164 # @speed: #optional the maximum speed, in bytes per second
1166 # @sync: what parts of the disk image should be copied to the destination
1167 # (all the disk, only the sectors allocated in the topmost image, or
1170 # @granularity: #optional granularity of the dirty bitmap, default is 64K
1171 # if the image format doesn't have clusters, 4K if the clusters
1172 # are smaller than that, else the cluster size. Must be a
1173 # power of 2 between 512 and 64M (since 1.4).
1175 # @buf-size: #optional maximum amount of data in flight from source to
1176 # target (since 1.4).
1178 # @on-source-error: #optional the action to take on an error on the source,
1179 # default 'report'. 'stop' and 'enospc' can only be used
1180 # if the block device supports io-status (see BlockInfo).
1182 # @on-target-error: #optional the action to take on an error on the target,
1183 # default 'report' (no limitations, since this applies to
1184 # a different block device than @device).
1185 # @unmap: #optional Whether to try to unmap target sectors where source has
1186 # only zero. If true, and target unallocated sectors will read as zero,
1187 # target image sectors will be unmapped; otherwise, zeroes will be
1188 # written. Both will result in identical contents.
1189 # Default is true. (Since 2.4)
1193 { 'struct': 'DriveMirror',
1194 'data': { '*job-id': 'str', 'device': 'str', 'target': 'str',
1195 '*format': 'str', '*node-name': 'str', '*replaces': 'str',
1196 'sync': 'MirrorSyncMode', '*mode': 'NewImageMode',
1197 '*speed': 'int', '*granularity': 'uint32',
1198 '*buf-size': 'int', '*on-source-error': 'BlockdevOnError',
1199 '*on-target-error': 'BlockdevOnError',
1200 '*unmap': 'bool' } }
1205 # @node: name of device/node which the bitmap is tracking
1207 # @name: name of the dirty bitmap
1211 { 'struct': 'BlockDirtyBitmap',
1212 'data': { 'node': 'str', 'name': 'str' } }
1215 # @BlockDirtyBitmapAdd
1217 # @node: name of device/node which the bitmap is tracking
1219 # @name: name of the dirty bitmap
1221 # @granularity: #optional the bitmap granularity, default is 64k for
1222 # block-dirty-bitmap-add
1226 { 'struct': 'BlockDirtyBitmapAdd',
1227 'data': { 'node': 'str', 'name': 'str', '*granularity': 'uint32' } }
1230 # @block-dirty-bitmap-add
1232 # Create a dirty bitmap with a name on the node
1234 # Returns: nothing on success
1235 # If @node is not a valid block device or node, DeviceNotFound
1236 # If @name is already taken, GenericError with an explanation
1240 { 'command': 'block-dirty-bitmap-add',
1241 'data': 'BlockDirtyBitmapAdd' }
1244 # @block-dirty-bitmap-remove
1246 # Remove a dirty bitmap on the node
1248 # Returns: nothing on success
1249 # If @node is not a valid block device or node, DeviceNotFound
1250 # If @name is not found, GenericError with an explanation
1251 # if @name is frozen by an operation, GenericError
1255 { 'command': 'block-dirty-bitmap-remove',
1256 'data': 'BlockDirtyBitmap' }
1259 # @block-dirty-bitmap-clear
1261 # Clear (reset) a dirty bitmap on the device
1263 # Returns: nothing on success
1264 # If @node is not a valid block device, DeviceNotFound
1265 # If @name is not found, GenericError with an explanation
1269 { 'command': 'block-dirty-bitmap-clear',
1270 'data': 'BlockDirtyBitmap' }
1275 # Start mirroring a block device's writes to a new destination.
1277 # @job-id: #optional identifier for the newly-created block job. If
1278 # omitted, the device name will be used. (Since 2.7)
1280 # @device: The device name or node-name of a root node whose writes should be
1283 # @target: the id or node-name of the block device to mirror to. This mustn't be
1284 # attached to guest.
1286 # @replaces: #optional with sync=full graph node name to be replaced by the new
1287 # image when a whole image copy is done. This can be used to repair
1288 # broken Quorum files.
1290 # @speed: #optional the maximum speed, in bytes per second
1292 # @sync: what parts of the disk image should be copied to the destination
1293 # (all the disk, only the sectors allocated in the topmost image, or
1296 # @granularity: #optional granularity of the dirty bitmap, default is 64K
1297 # if the image format doesn't have clusters, 4K if the clusters
1298 # are smaller than that, else the cluster size. Must be a
1299 # power of 2 between 512 and 64M
1301 # @buf-size: #optional maximum amount of data in flight from source to
1304 # @on-source-error: #optional the action to take on an error on the source,
1305 # default 'report'. 'stop' and 'enospc' can only be used
1306 # if the block device supports io-status (see BlockInfo).
1308 # @on-target-error: #optional the action to take on an error on the target,
1309 # default 'report' (no limitations, since this applies to
1310 # a different block device than @device).
1312 # Returns: nothing on success.
1316 { 'command': 'blockdev-mirror',
1317 'data': { '*job-id': 'str', 'device': 'str', 'target': 'str',
1319 'sync': 'MirrorSyncMode',
1320 '*speed': 'int', '*granularity': 'uint32',
1321 '*buf-size': 'int', '*on-source-error': 'BlockdevOnError',
1322 '*on-target-error': 'BlockdevOnError' } }
1325 # @block_set_io_throttle:
1327 # Change I/O throttle limits for a block drive.
1329 # Since QEMU 2.4, each device with I/O limits is member of a throttle
1332 # If two or more devices are members of the same group, the limits
1333 # will apply to the combined I/O of the whole group in a round-robin
1334 # fashion. Therefore, setting new I/O limits to a device will affect
1337 # The name of the group can be specified using the 'group' parameter.
1338 # If the parameter is unset, it is assumed to be the current group of
1339 # that device. If it's not in any group yet, the name of the device
1340 # will be used as the name for its group.
1342 # The 'group' parameter can also be used to move a device to a
1343 # different group. In this case the limits specified in the parameters
1344 # will be applied to the new group only.
1346 # I/O limits can be disabled by setting all of them to 0. In this case
1347 # the device will be removed from its group and the rest of its
1348 # members will not be affected. The 'group' parameter is ignored.
1350 # See BlockIOThrottle for parameter descriptions.
1352 # Returns: Nothing on success
1353 # If @device is not a valid block device, DeviceNotFound
1357 { 'command': 'block_set_io_throttle', 'boxed': true,
1358 'data': 'BlockIOThrottle' }
1363 # A set of parameters describing block throttling.
1365 # @device: The name of the device
1367 # @bps: total throughput limit in bytes per second
1369 # @bps_rd: read throughput limit in bytes per second
1371 # @bps_wr: write throughput limit in bytes per second
1373 # @iops: total I/O operations per second
1375 # @iops_rd: read I/O operations per second
1377 # @iops_wr: write I/O operations per second
1379 # @bps_max: #optional total throughput limit during bursts,
1380 # in bytes (Since 1.7)
1382 # @bps_rd_max: #optional read throughput limit during bursts,
1383 # in bytes (Since 1.7)
1385 # @bps_wr_max: #optional write throughput limit during bursts,
1386 # in bytes (Since 1.7)
1388 # @iops_max: #optional total I/O operations per second during bursts,
1389 # in bytes (Since 1.7)
1391 # @iops_rd_max: #optional read I/O operations per second during bursts,
1392 # in bytes (Since 1.7)
1394 # @iops_wr_max: #optional write I/O operations per second during bursts,
1395 # in bytes (Since 1.7)
1397 # @bps_max_length: #optional maximum length of the @bps_max burst
1398 # period, in seconds. It must only
1399 # be set if @bps_max is set as well.
1400 # Defaults to 1. (Since 2.6)
1402 # @bps_rd_max_length: #optional maximum length of the @bps_rd_max
1403 # burst period, in seconds. It must only
1404 # be set if @bps_rd_max is set as well.
1405 # Defaults to 1. (Since 2.6)
1407 # @bps_wr_max_length: #optional maximum length of the @bps_wr_max
1408 # burst period, in seconds. It must only
1409 # be set if @bps_wr_max is set as well.
1410 # Defaults to 1. (Since 2.6)
1412 # @iops_max_length: #optional maximum length of the @iops burst
1413 # period, in seconds. It must only
1414 # be set if @iops_max is set as well.
1415 # Defaults to 1. (Since 2.6)
1417 # @iops_rd_max_length: #optional maximum length of the @iops_rd_max
1418 # burst period, in seconds. It must only
1419 # be set if @iops_rd_max is set as well.
1420 # Defaults to 1. (Since 2.6)
1422 # @iops_wr_max_length: #optional maximum length of the @iops_wr_max
1423 # burst period, in seconds. It must only
1424 # be set if @iops_wr_max is set as well.
1425 # Defaults to 1. (Since 2.6)
1427 # @iops_size: #optional an I/O size in bytes (Since 1.7)
1429 # @group: #optional throttle group name (Since 2.4)
1433 { 'struct': 'BlockIOThrottle',
1434 'data': { 'device': 'str', 'bps': 'int', 'bps_rd': 'int', 'bps_wr': 'int',
1435 'iops': 'int', 'iops_rd': 'int', 'iops_wr': 'int',
1436 '*bps_max': 'int', '*bps_rd_max': 'int',
1437 '*bps_wr_max': 'int', '*iops_max': 'int',
1438 '*iops_rd_max': 'int', '*iops_wr_max': 'int',
1439 '*bps_max_length': 'int', '*bps_rd_max_length': 'int',
1440 '*bps_wr_max_length': 'int', '*iops_max_length': 'int',
1441 '*iops_rd_max_length': 'int', '*iops_wr_max_length': 'int',
1442 '*iops_size': 'int', '*group': 'str' } }
1447 # Copy data from a backing file into a block device.
1449 # The block streaming operation is performed in the background until the entire
1450 # backing file has been copied. This command returns immediately once streaming
1451 # has started. The status of ongoing block streaming operations can be checked
1452 # with query-block-jobs. The operation can be stopped before it has completed
1453 # using the block-job-cancel command.
1455 # If a base file is specified then sectors are not copied from that base file and
1456 # its backing chain. When streaming completes the image file will have the base
1457 # file as its backing file. This can be used to stream a subset of the backing
1458 # file chain instead of flattening the entire image.
1460 # On successful completion the image file is updated to drop the backing file
1461 # and the BLOCK_JOB_COMPLETED event is emitted.
1463 # @job-id: #optional identifier for the newly-created block job. If
1464 # omitted, the device name will be used. (Since 2.7)
1466 # @device: the device name or node-name of a root node
1468 # @base: #optional the common backing file name
1470 # @backing-file: #optional The backing file string to write into the active
1471 # layer. This filename is not validated.
1473 # If a pathname string is such that it cannot be
1474 # resolved by QEMU, that means that subsequent QMP or
1475 # HMP commands must use node-names for the image in
1476 # question, as filename lookup methods will fail.
1478 # If not specified, QEMU will automatically determine
1479 # the backing file string to use, or error out if there
1480 # is no obvious choice. Care should be taken when
1481 # specifying the string, to specify a valid filename or
1485 # @speed: #optional the maximum speed, in bytes per second
1487 # @on-error: #optional the action to take on an error (default report).
1488 # 'stop' and 'enospc' can only be used if the block device
1489 # supports io-status (see BlockInfo). Since 1.3.
1493 { 'command': 'block-stream',
1494 'data': { '*job-id': 'str', 'device': 'str', '*base': 'str',
1495 '*backing-file': 'str', '*speed': 'int',
1496 '*on-error': 'BlockdevOnError' } }
1499 # @block-job-set-speed:
1501 # Set maximum speed for a background block operation.
1503 # This command can only be issued when there is an active block job.
1505 # Throttling can be disabled by setting the speed to 0.
1507 # @device: The job identifier. This used to be a device name (hence
1508 # the name of the parameter), but since QEMU 2.7 it can have
1511 # @speed: the maximum speed, in bytes per second, or 0 for unlimited.
1514 # Returns: Nothing on success
1515 # If no background operation is active on this device, DeviceNotActive
1519 { 'command': 'block-job-set-speed',
1520 'data': { 'device': 'str', 'speed': 'int' } }
1523 # @block-job-cancel:
1525 # Stop an active background block operation.
1527 # This command returns immediately after marking the active background block
1528 # operation for cancellation. It is an error to call this command if no
1529 # operation is in progress.
1531 # The operation will cancel as soon as possible and then emit the
1532 # BLOCK_JOB_CANCELLED event. Before that happens the job is still visible when
1533 # enumerated using query-block-jobs.
1535 # For streaming, the image file retains its backing file unless the streaming
1536 # operation happens to complete just as it is being cancelled. A new streaming
1537 # operation can be started at a later time to finish copying all data from the
1540 # @device: The job identifier. This used to be a device name (hence
1541 # the name of the parameter), but since QEMU 2.7 it can have
1544 # @force: #optional whether to allow cancellation of a paused job (default
1545 # false). Since 1.3.
1547 # Returns: Nothing on success
1548 # If no background operation is active on this device, DeviceNotActive
1552 { 'command': 'block-job-cancel', 'data': { 'device': 'str', '*force': 'bool' } }
1557 # Pause an active background block operation.
1559 # This command returns immediately after marking the active background block
1560 # operation for pausing. It is an error to call this command if no
1561 # operation is in progress. Pausing an already paused job has no cumulative
1562 # effect; a single block-job-resume command will resume the job.
1564 # The operation will pause as soon as possible. No event is emitted when
1565 # the operation is actually paused. Cancelling a paused job automatically
1568 # @device: The job identifier. This used to be a device name (hence
1569 # the name of the parameter), but since QEMU 2.7 it can have
1572 # Returns: Nothing on success
1573 # If no background operation is active on this device, DeviceNotActive
1577 { 'command': 'block-job-pause', 'data': { 'device': 'str' } }
1580 # @block-job-resume:
1582 # Resume an active background block operation.
1584 # This command returns immediately after resuming a paused background block
1585 # operation. It is an error to call this command if no operation is in
1586 # progress. Resuming an already running job is not an error.
1588 # This command also clears the error status of the job.
1590 # @device: The job identifier. This used to be a device name (hence
1591 # the name of the parameter), but since QEMU 2.7 it can have
1594 # Returns: Nothing on success
1595 # If no background operation is active on this device, DeviceNotActive
1599 { 'command': 'block-job-resume', 'data': { 'device': 'str' } }
1602 # @block-job-complete:
1604 # Manually trigger completion of an active background block operation. This
1605 # is supported for drive mirroring, where it also switches the device to
1606 # write to the target path only. The ability to complete is signaled with
1607 # a BLOCK_JOB_READY event.
1609 # This command completes an active background block operation synchronously.
1610 # The ordering of this command's return with the BLOCK_JOB_COMPLETED event
1611 # is not defined. Note that if an I/O error occurs during the processing of
1612 # this command: 1) the command itself will fail; 2) the error will be processed
1613 # according to the rerror/werror arguments that were specified when starting
1616 # A cancelled or paused job cannot be completed.
1618 # @device: The job identifier. This used to be a device name (hence
1619 # the name of the parameter), but since QEMU 2.7 it can have
1622 # Returns: Nothing on success
1623 # If no background operation is active on this device, DeviceNotActive
1627 { 'command': 'block-job-complete', 'data': { 'device': 'str' } }
1630 # @BlockdevDiscardOptions
1632 # Determines how to handle discard requests.
1634 # @ignore: Ignore the request
1635 # @unmap: Forward as an unmap request
1639 { 'enum': 'BlockdevDiscardOptions',
1640 'data': [ 'ignore', 'unmap' ] }
1643 # @BlockdevDetectZeroesOptions
1645 # Describes the operation mode for the automatic conversion of plain
1646 # zero writes by the OS to driver specific optimized zero write commands.
1648 # @off: Disabled (default)
1650 # @unmap: Enabled and even try to unmap blocks if possible. This requires
1651 # also that @BlockdevDiscardOptions is set to unmap for this device.
1655 { 'enum': 'BlockdevDetectZeroesOptions',
1656 'data': [ 'off', 'on', 'unmap' ] }
1659 # @BlockdevAioOptions
1661 # Selects the AIO backend to handle I/O requests
1663 # @threads: Use qemu's thread pool
1664 # @native: Use native AIO backend (only Linux and Windows)
1668 { 'enum': 'BlockdevAioOptions',
1669 'data': [ 'threads', 'native' ] }
1672 # @BlockdevCacheOptions
1674 # Includes cache-related options for block devices
1676 # @direct: #optional enables use of O_DIRECT (bypass the host page cache;
1678 # @no-flush: #optional ignore any flush requests for the device (default:
1683 { 'struct': 'BlockdevCacheOptions',
1684 'data': { '*direct': 'bool',
1685 '*no-flush': 'bool' } }
1690 # Drivers that are supported in block device operations.
1692 # @host_device, @host_cdrom: Since 2.1
1693 # @gluster: Since 2.7
1697 { 'enum': 'BlockdevDriver',
1698 'data': [ 'archipelago', 'blkdebug', 'blkverify', 'bochs', 'cloop',
1699 'dmg', 'file', 'ftp', 'ftps', 'gluster', 'host_cdrom',
1700 'host_device', 'http', 'https', 'luks', 'null-aio', 'null-co',
1701 'parallels', 'qcow', 'qcow2', 'qed', 'quorum', 'raw', 'tftp',
1702 'vdi', 'vhdx', 'vmdk', 'vpc', 'vvfat' ] }
1705 # @BlockdevOptionsFile
1707 # Driver specific block device options for the file backend and similar
1710 # @filename: path to the image file
1714 { 'struct': 'BlockdevOptionsFile',
1715 'data': { 'filename': 'str' } }
1718 # @BlockdevOptionsNull
1720 # Driver specific block device options for the null backend.
1722 # @size: #optional size of the device in bytes.
1723 # @latency-ns: #optional emulated latency (in nanoseconds) in processing
1724 # requests. Default to zero which completes requests immediately.
1729 { 'struct': 'BlockdevOptionsNull',
1730 'data': { '*size': 'int', '*latency-ns': 'uint64' } }
1733 # @BlockdevOptionsVVFAT
1735 # Driver specific block device options for the vvfat protocol.
1737 # @dir: directory to be exported as FAT image
1738 # @fat-type: #optional FAT type: 12, 16 or 32
1739 # @floppy: #optional whether to export a floppy image (true) or
1740 # partitioned hard disk (false; default)
1741 # @label: #optional set the volume label, limited to 11 bytes. FAT16 and
1742 # FAT32 traditionally have some restrictions on labels, which are
1743 # ignored by most operating systems. Defaults to "QEMU VVFAT".
1745 # @rw: #optional whether to allow write operations (default: false)
1749 { 'struct': 'BlockdevOptionsVVFAT',
1750 'data': { 'dir': 'str', '*fat-type': 'int', '*floppy': 'bool',
1751 '*label': 'str', '*rw': 'bool' } }
1754 # @BlockdevOptionsGenericFormat
1756 # Driver specific block device options for image format that have no option
1757 # besides their data source.
1759 # @file: reference to or definition of the data source block device
1763 { 'struct': 'BlockdevOptionsGenericFormat',
1764 'data': { 'file': 'BlockdevRef' } }
1767 # @BlockdevOptionsLUKS
1769 # Driver specific block device options for LUKS.
1771 # @key-secret: #optional the ID of a QCryptoSecret object providing
1772 # the decryption key (since 2.6). Mandatory except when
1773 # doing a metadata-only probe of the image.
1777 { 'struct': 'BlockdevOptionsLUKS',
1778 'base': 'BlockdevOptionsGenericFormat',
1779 'data': { '*key-secret': 'str' } }
1783 # @BlockdevOptionsGenericCOWFormat
1785 # Driver specific block device options for image format that have no option
1786 # besides their data source and an optional backing file.
1788 # @backing: #optional reference to or definition of the backing file block
1789 # device (if missing, taken from the image file content). It is
1790 # allowed to pass an empty string here in order to disable the
1791 # default backing file.
1795 { 'struct': 'BlockdevOptionsGenericCOWFormat',
1796 'base': 'BlockdevOptionsGenericFormat',
1797 'data': { '*backing': 'BlockdevRef' } }
1800 # @Qcow2OverlapCheckMode
1802 # General overlap check modes.
1804 # @none: Do not perform any checks
1806 # @constant: Perform only checks which can be done in constant time and
1807 # without reading anything from disk
1809 # @cached: Perform only checks which can be done without reading anything
1812 # @all: Perform all available overlap checks
1816 { 'enum': 'Qcow2OverlapCheckMode',
1817 'data': [ 'none', 'constant', 'cached', 'all' ] }
1820 # @Qcow2OverlapCheckFlags
1822 # Structure of flags for each metadata structure. Setting a field to 'true'
1823 # makes qemu guard that structure against unintended overwriting. The default
1824 # value is chosen according to the template given.
1826 # @template: Specifies a template mode which can be adjusted using the other
1827 # flags, defaults to 'cached'
1831 { 'struct': 'Qcow2OverlapCheckFlags',
1832 'data': { '*template': 'Qcow2OverlapCheckMode',
1833 '*main-header': 'bool',
1834 '*active-l1': 'bool',
1835 '*active-l2': 'bool',
1836 '*refcount-table': 'bool',
1837 '*refcount-block': 'bool',
1838 '*snapshot-table': 'bool',
1839 '*inactive-l1': 'bool',
1840 '*inactive-l2': 'bool' } }
1843 # @Qcow2OverlapChecks
1845 # Specifies which metadata structures should be guarded against unintended
1848 # @flags: set of flags for separate specification of each metadata structure
1851 # @mode: named mode which chooses a specific set of flags
1855 { 'alternate': 'Qcow2OverlapChecks',
1856 'data': { 'flags': 'Qcow2OverlapCheckFlags',
1857 'mode': 'Qcow2OverlapCheckMode' } }
1860 # @BlockdevOptionsQcow2
1862 # Driver specific block device options for qcow2.
1864 # @lazy-refcounts: #optional whether to enable the lazy refcounts
1865 # feature (default is taken from the image file)
1867 # @pass-discard-request: #optional whether discard requests to the qcow2
1868 # device should be forwarded to the data source
1870 # @pass-discard-snapshot: #optional whether discard requests for the data source
1871 # should be issued when a snapshot operation (e.g.
1872 # deleting a snapshot) frees clusters in the qcow2 file
1874 # @pass-discard-other: #optional whether discard requests for the data source
1875 # should be issued on other occasions where a cluster
1878 # @overlap-check: #optional which overlap checks to perform for writes
1879 # to the image, defaults to 'cached' (since 2.2)
1881 # @cache-size: #optional the maximum total size of the L2 table and
1882 # refcount block caches in bytes (since 2.2)
1884 # @l2-cache-size: #optional the maximum size of the L2 table cache in
1887 # @refcount-cache-size: #optional the maximum size of the refcount block cache
1888 # in bytes (since 2.2)
1890 # @cache-clean-interval: #optional clean unused entries in the L2 and refcount
1891 # caches. The interval is in seconds. The default value
1892 # is 0 and it disables this feature (since 2.5)
1896 { 'struct': 'BlockdevOptionsQcow2',
1897 'base': 'BlockdevOptionsGenericCOWFormat',
1898 'data': { '*lazy-refcounts': 'bool',
1899 '*pass-discard-request': 'bool',
1900 '*pass-discard-snapshot': 'bool',
1901 '*pass-discard-other': 'bool',
1902 '*overlap-check': 'Qcow2OverlapChecks',
1903 '*cache-size': 'int',
1904 '*l2-cache-size': 'int',
1905 '*refcount-cache-size': 'int',
1906 '*cache-clean-interval': 'int' } }
1910 # @BlockdevOptionsArchipelago
1912 # Driver specific block device options for Archipelago.
1914 # @volume: Name of the Archipelago volume image
1916 # @mport: #optional The port number on which mapperd is
1917 # listening. This is optional
1918 # and if not specified, QEMU will make Archipelago
1919 # use the default port (1001).
1921 # @vport: #optional The port number on which vlmcd is
1922 # listening. This is optional
1923 # and if not specified, QEMU will make Archipelago
1924 # use the default port (501).
1926 # @segment: #optional The name of the shared memory segment
1927 # Archipelago stack is using. This is optional
1928 # and if not specified, QEMU will make Archipelago
1929 # use the default value, 'archipelago'.
1932 { 'struct': 'BlockdevOptionsArchipelago',
1933 'data': { 'volume': 'str',
1936 '*segment': 'str' } }
1942 # Trigger events supported by blkdebug.
1946 { 'enum': 'BlkdebugEvent', 'prefix': 'BLKDBG',
1947 'data': [ 'l1_update', 'l1_grow_alloc_table', 'l1_grow_write_table',
1948 'l1_grow_activate_table', 'l2_load', 'l2_update',
1949 'l2_update_compressed', 'l2_alloc_cow_read', 'l2_alloc_write',
1950 'read_aio', 'read_backing_aio', 'read_compressed', 'write_aio',
1951 'write_compressed', 'vmstate_load', 'vmstate_save', 'cow_read',
1952 'cow_write', 'reftable_load', 'reftable_grow', 'reftable_update',
1953 'refblock_load', 'refblock_update', 'refblock_update_part',
1954 'refblock_alloc', 'refblock_alloc_hookup', 'refblock_alloc_write',
1955 'refblock_alloc_write_blocks', 'refblock_alloc_write_table',
1956 'refblock_alloc_switch_table', 'cluster_alloc',
1957 'cluster_alloc_bytes', 'cluster_free', 'flush_to_os',
1958 'flush_to_disk', 'pwritev_rmw_head', 'pwritev_rmw_after_head',
1959 'pwritev_rmw_tail', 'pwritev_rmw_after_tail', 'pwritev',
1960 'pwritev_zero', 'pwritev_done', 'empty_image_prepare' ] }
1963 # @BlkdebugInjectErrorOptions
1965 # Describes a single error injection for blkdebug.
1967 # @event: trigger event
1969 # @state: #optional the state identifier blkdebug needs to be in to
1970 # actually trigger the event; defaults to "any"
1972 # @errno: #optional error identifier (errno) to be returned; defaults to
1975 # @sector: #optional specifies the sector index which has to be affected
1976 # in order to actually trigger the event; defaults to "any
1979 # @once: #optional disables further events after this one has been
1980 # triggered; defaults to false
1982 # @immediately: #optional fail immediately; defaults to false
1986 { 'struct': 'BlkdebugInjectErrorOptions',
1987 'data': { 'event': 'BlkdebugEvent',
1992 '*immediately': 'bool' } }
1995 # @BlkdebugSetStateOptions
1997 # Describes a single state-change event for blkdebug.
1999 # @event: trigger event
2001 # @state: #optional the current state identifier blkdebug needs to be in;
2004 # @new_state: the state identifier blkdebug is supposed to assume if
2005 # this event is triggered
2009 { 'struct': 'BlkdebugSetStateOptions',
2010 'data': { 'event': 'BlkdebugEvent',
2012 'new_state': 'int' } }
2015 # @BlockdevOptionsBlkdebug
2017 # Driver specific block device options for blkdebug.
2019 # @image: underlying raw block device (or image file)
2021 # @config: #optional filename of the configuration file
2023 # @align: #optional required alignment for requests in bytes,
2024 # must be power of 2, or 0 for default
2026 # @inject-error: #optional array of error injection descriptions
2028 # @set-state: #optional array of state-change descriptions
2032 { 'struct': 'BlockdevOptionsBlkdebug',
2033 'data': { 'image': 'BlockdevRef',
2036 '*inject-error': ['BlkdebugInjectErrorOptions'],
2037 '*set-state': ['BlkdebugSetStateOptions'] } }
2040 # @BlockdevOptionsBlkverify
2042 # Driver specific block device options for blkverify.
2044 # @test: block device to be tested
2046 # @raw: raw image used for verification
2050 { 'struct': 'BlockdevOptionsBlkverify',
2051 'data': { 'test': 'BlockdevRef',
2052 'raw': 'BlockdevRef' } }
2055 # @QuorumReadPattern
2057 # An enumeration of quorum read patterns.
2059 # @quorum: read all the children and do a quorum vote on reads
2061 # @fifo: read only from the first child that has not failed
2065 { 'enum': 'QuorumReadPattern', 'data': [ 'quorum', 'fifo' ] }
2068 # @BlockdevOptionsQuorum
2070 # Driver specific block device options for Quorum
2072 # @blkverify: #optional true if the driver must print content mismatch
2073 # set to false by default
2075 # @children: the children block devices to use
2077 # @vote-threshold: the vote limit under which a read will fail
2079 # @rewrite-corrupted: #optional rewrite corrupted data when quorum is reached
2082 # @read-pattern: #optional choose read pattern and set to quorum by default
2087 { 'struct': 'BlockdevOptionsQuorum',
2088 'data': { '*blkverify': 'bool',
2089 'children': [ 'BlockdevRef' ],
2090 'vote-threshold': 'int',
2091 '*rewrite-corrupted': 'bool',
2092 '*read-pattern': 'QuorumReadPattern' } }
2097 # An enumeration of Gluster transport types
2099 # @tcp: TCP - Transmission Control Protocol
2101 # @unix: UNIX - Unix domain socket
2105 { 'enum': 'GlusterTransport',
2106 'data': [ 'unix', 'tcp' ] }
2112 # Captures the address of a socket
2114 # Details for connecting to a gluster server
2116 # @type: Transport type used for gluster connection
2118 # @unix: socket file
2120 # @tcp: host address and port number
2124 { 'union': 'GlusterServer',
2125 'base': { 'type': 'GlusterTransport' },
2126 'discriminator': 'type',
2127 'data': { 'unix': 'UnixSocketAddress',
2128 'tcp': 'InetSocketAddress' } }
2131 # @BlockdevOptionsGluster
2133 # Driver specific block device options for Gluster
2135 # @volume: name of gluster volume where VM image resides
2137 # @path: absolute path to image file in gluster volume
2139 # @server: gluster servers description
2141 # @debug-level: #optional libgfapi log level (default '4' which is Error)
2145 { 'struct': 'BlockdevOptionsGluster',
2146 'data': { 'volume': 'str',
2148 'server': ['GlusterServer'],
2149 '*debug-level': 'int' } }
2154 # Options for creating a block device. Many options are available for all
2155 # block devices, independent of the block driver:
2157 # @driver: block driver name
2158 # @id: #optional id by which the new block device can be referred to.
2159 # This option is only allowed on the top level of blockdev-add.
2160 # A BlockBackend will be created by blockdev-add if and only if
2161 # this option is given.
2162 # @node-name: #optional the name of a block driver state node (Since 2.0).
2163 # This option is required on the top level of blockdev-add if
2164 # the @id option is not given there.
2165 # @discard: #optional discard-related options (default: ignore)
2166 # @cache: #optional cache-related options
2167 # @aio: #optional AIO backend (default: threads)
2168 # @read-only: #optional whether the block device should be read-only
2170 # @detect-zeroes: #optional detect and optimize zero writes (Since 2.1)
2173 # Remaining options are determined by the block driver.
2177 { 'union': 'BlockdevOptions',
2178 'base': { 'driver': 'BlockdevDriver',
2179 # TODO 'id' is a BB-level option, remove it
2181 '*node-name': 'str',
2182 '*discard': 'BlockdevDiscardOptions',
2183 '*cache': 'BlockdevCacheOptions',
2184 '*aio': 'BlockdevAioOptions',
2185 '*read-only': 'bool',
2186 '*detect-zeroes': 'BlockdevDetectZeroesOptions' },
2187 'discriminator': 'driver',
2189 'archipelago':'BlockdevOptionsArchipelago',
2190 'blkdebug': 'BlockdevOptionsBlkdebug',
2191 'blkverify': 'BlockdevOptionsBlkverify',
2192 'bochs': 'BlockdevOptionsGenericFormat',
2193 'cloop': 'BlockdevOptionsGenericFormat',
2194 'dmg': 'BlockdevOptionsGenericFormat',
2195 'file': 'BlockdevOptionsFile',
2196 'ftp': 'BlockdevOptionsFile',
2197 'ftps': 'BlockdevOptionsFile',
2198 'gluster': 'BlockdevOptionsGluster',
2199 'host_cdrom': 'BlockdevOptionsFile',
2200 'host_device':'BlockdevOptionsFile',
2201 'http': 'BlockdevOptionsFile',
2202 'https': 'BlockdevOptionsFile',
2203 # TODO iscsi: Wait for structured options
2204 'luks': 'BlockdevOptionsLUKS',
2205 # TODO nbd: Should take InetSocketAddress for 'host'?
2206 # TODO nfs: Wait for structured options
2207 'null-aio': 'BlockdevOptionsNull',
2208 'null-co': 'BlockdevOptionsNull',
2209 'parallels': 'BlockdevOptionsGenericFormat',
2210 'qcow2': 'BlockdevOptionsQcow2',
2211 'qcow': 'BlockdevOptionsGenericCOWFormat',
2212 'qed': 'BlockdevOptionsGenericCOWFormat',
2213 'quorum': 'BlockdevOptionsQuorum',
2214 'raw': 'BlockdevOptionsGenericFormat',
2215 # TODO rbd: Wait for structured options
2216 # TODO sheepdog: Wait for structured options
2217 # TODO ssh: Should take InetSocketAddress for 'host'?
2218 'tftp': 'BlockdevOptionsFile',
2219 'vdi': 'BlockdevOptionsGenericFormat',
2220 'vhdx': 'BlockdevOptionsGenericFormat',
2221 'vmdk': 'BlockdevOptionsGenericCOWFormat',
2222 'vpc': 'BlockdevOptionsGenericFormat',
2223 'vvfat': 'BlockdevOptionsVVFAT'
2229 # Reference to a block device.
2231 # @definition: defines a new block device inline
2232 # @reference: references the ID of an existing block device. An
2233 # empty string means that no block device should be
2238 { 'alternate': 'BlockdevRef',
2239 'data': { 'definition': 'BlockdevOptions',
2240 'reference': 'str' } }
2245 # Creates a new block device. If the @id option is given at the top level, a
2246 # BlockBackend will be created; otherwise, @node-name is mandatory at the top
2247 # level and no BlockBackend will be created.
2249 # This command is still a work in progress. It doesn't support all
2250 # block drivers among other things. Stay away from it unless you want
2251 # to help with its development.
2253 # @options: block device options for the new device
2257 { 'command': 'blockdev-add', 'data': { 'options': 'BlockdevOptions' } }
2262 # Deletes a block device that has been added using blockdev-add.
2263 # The selected device can be either a block backend or a graph node.
2265 # In the former case the backend will be destroyed, along with its
2266 # inserted medium if there's any. The command will fail if the backend
2267 # or its medium are in use.
2269 # In the latter case the node will be destroyed. The command will fail
2270 # if the node is attached to a block backend or is otherwise being
2273 # One of @id or @node-name must be specified, but not both.
2275 # This command is still a work in progress and is considered
2276 # experimental. Stay away from it unless you want to help with its
2279 # @id: #optional Name of the block backend device to delete.
2281 # @node-name: #optional Name of the graph node to delete.
2285 { 'command': 'x-blockdev-del', 'data': { '*id': 'str', '*node-name': 'str' } }
2288 # @blockdev-open-tray:
2290 # Opens a block device's tray. If there is a block driver state tree inserted as
2291 # a medium, it will become inaccessible to the guest (but it will remain
2292 # associated to the block device, so closing the tray will make it accessible
2295 # If the tray was already open before, this will be a no-op.
2297 # Once the tray opens, a DEVICE_TRAY_MOVED event is emitted. There are cases in
2298 # which no such event will be generated, these include:
2299 # - if the guest has locked the tray, @force is false and the guest does not
2300 # respond to the eject request
2301 # - if the BlockBackend denoted by @device does not have a guest device attached
2303 # - if the guest device does not have an actual tray
2305 # @device: block device name
2307 # @force: #optional if false (the default), an eject request will be sent to
2308 # the guest if it has locked the tray (and the tray will not be opened
2309 # immediately); if true, the tray will be opened regardless of whether
2314 { 'command': 'blockdev-open-tray',
2315 'data': { 'device': 'str',
2316 '*force': 'bool' } }
2319 # @blockdev-close-tray:
2321 # Closes a block device's tray. If there is a block driver state tree associated
2322 # with the block device (which is currently ejected), that tree will be loaded
2325 # If the tray was already closed before, this will be a no-op.
2327 # @device: block device name
2331 { 'command': 'blockdev-close-tray',
2332 'data': { 'device': 'str' } }
2335 # @x-blockdev-remove-medium:
2337 # Removes a medium (a block driver state tree) from a block device. That block
2338 # device's tray must currently be open (unless there is no attached guest
2341 # If the tray is open and there is no medium inserted, this will be a no-op.
2343 # This command is still a work in progress and is considered experimental.
2344 # Stay away from it unless you want to help with its development.
2346 # @device: block device name
2350 { 'command': 'x-blockdev-remove-medium',
2351 'data': { 'device': 'str' } }
2354 # @x-blockdev-insert-medium:
2356 # Inserts a medium (a block driver state tree) into a block device. That block
2357 # device's tray must currently be open (unless there is no attached guest
2358 # device) and there must be no medium inserted already.
2360 # This command is still a work in progress and is considered experimental.
2361 # Stay away from it unless you want to help with its development.
2363 # @device: block device name
2365 # @node-name: name of a node in the block driver state graph
2369 { 'command': 'x-blockdev-insert-medium',
2370 'data': { 'device': 'str',
2371 'node-name': 'str'} }
2375 # @BlockdevChangeReadOnlyMode:
2377 # Specifies the new read-only mode of a block device subject to the
2378 # @blockdev-change-medium command.
2380 # @retain: Retains the current read-only mode
2382 # @read-only: Makes the device read-only
2384 # @read-write: Makes the device writable
2388 { 'enum': 'BlockdevChangeReadOnlyMode',
2389 'data': ['retain', 'read-only', 'read-write'] }
2393 # @blockdev-change-medium:
2395 # Changes the medium inserted into a block device by ejecting the current medium
2396 # and loading a new image file which is inserted as the new medium (this command
2397 # combines blockdev-open-tray, x-blockdev-remove-medium,
2398 # x-blockdev-insert-medium and blockdev-close-tray).
2400 # @device: block device name
2402 # @filename: filename of the new image to be loaded
2404 # @format: #optional, format to open the new image with (defaults to
2405 # the probed format)
2407 # @read-only-mode: #optional, change the read-only mode of the device; defaults
2412 { 'command': 'blockdev-change-medium',
2413 'data': { 'device': 'str',
2416 '*read-only-mode': 'BlockdevChangeReadOnlyMode' } }
2422 # An enumeration of action that has been taken when a DISK I/O occurs
2424 # @ignore: error has been ignored
2426 # @report: error has been reported to the device
2428 # @stop: error caused VM to be stopped
2432 { 'enum': 'BlockErrorAction',
2433 'data': [ 'ignore', 'report', 'stop' ] }
2437 # @BLOCK_IMAGE_CORRUPTED
2439 # Emitted when a corruption has been detected in a disk image
2441 # @device: device name. This is always present for compatibility
2442 # reasons, but it can be empty ("") if the image does not
2443 # have a device name associated.
2445 # @node-name: #optional node name (Since: 2.4)
2447 # @msg: informative message for human consumption, such as the kind of
2448 # corruption being detected. It should not be parsed by machine as it is
2449 # not guaranteed to be stable
2451 # @offset: #optional, if the corruption resulted from an image access, this is
2452 # the host's access offset into the image
2454 # @size: #optional, if the corruption resulted from an image access, this is
2457 # fatal: if set, the image is marked corrupt and therefore unusable after this
2458 # event and must be repaired (Since 2.2; before, every
2459 # BLOCK_IMAGE_CORRUPTED event was fatal)
2463 { 'event': 'BLOCK_IMAGE_CORRUPTED',
2464 'data': { 'device' : 'str',
2465 '*node-name' : 'str',
2469 'fatal' : 'bool' } }
2474 # Emitted when a disk I/O error occurs
2476 # @device: device name
2478 # @operation: I/O operation
2480 # @action: action that has been taken
2482 # @nospace: #optional true if I/O error was caused due to a no-space
2483 # condition. This key is only present if query-block's
2484 # io-status is present, please see query-block documentation
2485 # for more information (since: 2.2)
2487 # @reason: human readable string describing the error cause.
2488 # (This field is a debugging aid for humans, it should not
2489 # be parsed by applications) (since: 2.2)
2491 # Note: If action is "stop", a STOP event will eventually follow the
2492 # BLOCK_IO_ERROR event
2496 { 'event': 'BLOCK_IO_ERROR',
2497 'data': { 'device': 'str', 'operation': 'IoOperationType',
2498 'action': 'BlockErrorAction', '*nospace': 'bool',
2502 # @BLOCK_JOB_COMPLETED
2504 # Emitted when a block job has completed
2508 # @device: The job identifier. Originally the device name but other
2509 # values are allowed since QEMU 2.7
2511 # @len: maximum progress value
2513 # @offset: current progress value. On success this is equal to len.
2514 # On failure this is less than len
2516 # @speed: rate limit, bytes per second
2518 # @error: #optional, error message. Only present on failure. This field
2519 # contains a human-readable error message. There are no semantics
2520 # other than that streaming has failed and clients should not try to
2521 # interpret the error string
2525 { 'event': 'BLOCK_JOB_COMPLETED',
2526 'data': { 'type' : 'BlockJobType',
2534 # @BLOCK_JOB_CANCELLED
2536 # Emitted when a block job has been cancelled
2540 # @device: The job identifier. Originally the device name but other
2541 # values are allowed since QEMU 2.7
2543 # @len: maximum progress value
2545 # @offset: current progress value. On success this is equal to len.
2546 # On failure this is less than len
2548 # @speed: rate limit, bytes per second
2552 { 'event': 'BLOCK_JOB_CANCELLED',
2553 'data': { 'type' : 'BlockJobType',
2562 # Emitted when a block job encounters an error
2564 # @device: The job identifier. Originally the device name but other
2565 # values are allowed since QEMU 2.7
2567 # @operation: I/O operation
2569 # @action: action that has been taken
2573 { 'event': 'BLOCK_JOB_ERROR',
2574 'data': { 'device' : 'str',
2575 'operation': 'IoOperationType',
2576 'action' : 'BlockErrorAction' } }
2581 # Emitted when a block job is ready to complete
2585 # @device: The job identifier. Originally the device name but other
2586 # values are allowed since QEMU 2.7
2588 # @len: maximum progress value
2590 # @offset: current progress value. On success this is equal to len.
2591 # On failure this is less than len
2593 # @speed: rate limit, bytes per second
2595 # Note: The "ready to complete" status is always reset by a @BLOCK_JOB_ERROR
2600 { 'event': 'BLOCK_JOB_READY',
2601 'data': { 'type' : 'BlockJobType',
2609 # Preallocation mode of QEMU image file
2611 # @off: no preallocation
2612 # @metadata: preallocate only for metadata
2613 # @falloc: like @full preallocation but allocate disk space by
2614 # posix_fallocate() rather than writing zeros.
2615 # @full: preallocate all data by writing zeros to device to ensure disk
2616 # space is really available. @full preallocation also sets up
2617 # metadata correctly.
2621 { 'enum': 'PreallocMode',
2622 'data': [ 'off', 'metadata', 'falloc', 'full' ] }
2625 # @BLOCK_WRITE_THRESHOLD
2627 # Emitted when writes on block device reaches or exceeds the
2628 # configured write threshold. For thin-provisioned devices, this
2629 # means the device should be extended to avoid pausing for
2631 # The event is one shot. Once triggered, it needs to be
2632 # re-registered with another block-set-threshold command.
2634 # @node-name: graph node name on which the threshold was exceeded.
2636 # @amount-exceeded: amount of data which exceeded the threshold, in bytes.
2638 # @write-threshold: last configured threshold, in bytes.
2642 { 'event': 'BLOCK_WRITE_THRESHOLD',
2643 'data': { 'node-name': 'str',
2644 'amount-exceeded': 'uint64',
2645 'write-threshold': 'uint64' } }
2648 # @block-set-write-threshold
2650 # Change the write threshold for a block drive. An event will be delivered
2651 # if a write to this block drive crosses the configured threshold.
2652 # This is useful to transparently resize thin-provisioned drives without
2653 # the guest OS noticing.
2655 # @node-name: graph node name on which the threshold must be set.
2657 # @write-threshold: configured threshold for the block device, bytes.
2658 # Use 0 to disable the threshold.
2662 { 'command': 'block-set-write-threshold',
2663 'data': { 'node-name': 'str', 'write-threshold': 'uint64' } }
2666 # @x-blockdev-change
2668 # Dynamically reconfigure the block driver state graph. It can be used
2669 # to add, remove, insert or replace a graph node. Currently only the
2670 # Quorum driver implements this feature to add or remove its child. This
2671 # is useful to fix a broken quorum child.
2673 # If @node is specified, it will be inserted under @parent. @child
2674 # may not be specified in this case. If both @parent and @child are
2675 # specified but @node is not, @child will be detached from @parent.
2677 # @parent: the id or name of the parent node.
2679 # @child: #optional the name of a child under the given parent node.
2681 # @node: #optional the name of the node that will be added.
2683 # Note: this command is experimental, and its API is not stable. It
2684 # does not support all kinds of operations, all kinds of children, nor
2685 # all block drivers.
2687 # Warning: The data in a new quorum child MUST be consistent with that of
2688 # the rest of the array.
2692 { 'command': 'x-blockdev-change',
2693 'data' : { 'parent': 'str',