4 # == Block core (VM unrelated)
7 { 'include': 'common.json' }
8 { 'include': 'crypto.json' }
9 { 'include': 'job.json' }
10 { 'include': 'sockets.json' }
15 # @id: unique snapshot id
17 # @name: user chosen name
19 # @vm-state-size: size of the VM state
21 # @date-sec: UTC date of the snapshot in seconds
23 # @date-nsec: fractional part in nano seconds to be used with date-sec
25 # @vm-clock-sec: VM clock relative to boot in seconds
27 # @vm-clock-nsec: fractional part in nano seconds to be used with vm-clock-sec
32 { 'struct': 'SnapshotInfo',
33 'data': { 'id': 'str', 'name': 'str', 'vm-state-size': 'int',
34 'date-sec': 'int', 'date-nsec': 'int',
35 'vm-clock-sec': 'int', 'vm-clock-nsec': 'int' } }
38 # @ImageInfoSpecificQCow2EncryptionBase:
40 # @format: The encryption format
44 { 'struct': 'ImageInfoSpecificQCow2EncryptionBase',
45 'data': { 'format': 'BlockdevQcow2EncryptionFormat'}}
48 # @ImageInfoSpecificQCow2Encryption:
52 { 'union': 'ImageInfoSpecificQCow2Encryption',
53 'base': 'ImageInfoSpecificQCow2EncryptionBase',
54 'discriminator': 'format',
55 'data': { 'luks': 'QCryptoBlockInfoLUKS' } }
58 # @ImageInfoSpecificQCow2:
60 # @compat: compatibility level
62 # @data-file: the filename of the external data file that is stored in the
63 # image and used as a default for opening the image (since: 4.0)
65 # @data-file-raw: True if the external data file must stay valid as a
66 # standalone (read-only) raw image without looking at qcow2
67 # metadata (since: 4.0)
69 # @lazy-refcounts: on or off; only valid for compat >= 1.1
71 # @corrupt: true if the image has been marked corrupt; only valid for
72 # compat >= 1.1 (since 2.2)
74 # @refcount-bits: width of a refcount entry in bits (since 2.3)
76 # @encrypt: details about encryption parameters; only set if image
77 # is encrypted (since 2.10)
79 # @bitmaps: A list of qcow2 bitmap details (since 4.0)
81 # @compression-type: the image cluster compression method (since 5.1)
85 { 'struct': 'ImageInfoSpecificQCow2',
89 '*data-file-raw': 'bool',
90 '*lazy-refcounts': 'bool',
92 'refcount-bits': 'int',
93 '*encrypt': 'ImageInfoSpecificQCow2Encryption',
94 '*bitmaps': ['Qcow2BitmapInfo'],
95 'compression-type': 'Qcow2CompressionType'
99 # @ImageInfoSpecificVmdk:
101 # @create-type: The create type of VMDK image
103 # @cid: Content id of image
105 # @parent-cid: Parent VMDK image's cid
107 # @extents: List of extent files
111 { 'struct': 'ImageInfoSpecificVmdk',
113 'create-type': 'str',
116 'extents': ['ImageInfo']
120 # @ImageInfoSpecific:
122 # A discriminated record of image format specific information structures.
126 { 'union': 'ImageInfoSpecific',
128 'qcow2': 'ImageInfoSpecificQCow2',
129 'vmdk': 'ImageInfoSpecificVmdk',
130 # If we need to add block driver specific parameters for
131 # LUKS in future, then we'll subclass QCryptoBlockInfoLUKS
132 # to define a ImageInfoSpecificLUKS
133 'luks': 'QCryptoBlockInfoLUKS'
139 # Information about a QEMU image file
141 # @filename: name of the image file
143 # @format: format of the image file
145 # @virtual-size: maximum capacity in bytes of the image
147 # @actual-size: actual size on disk in bytes of the image
149 # @dirty-flag: true if image is not cleanly closed
151 # @cluster-size: size of a cluster in bytes
153 # @encrypted: true if the image is encrypted
155 # @compressed: true if the image is compressed (Since 1.7)
157 # @backing-filename: name of the backing file
159 # @full-backing-filename: full path of the backing file
161 # @backing-filename-format: the format of the backing file
163 # @snapshots: list of VM snapshots
165 # @backing-image: info of the backing image (since 1.6)
167 # @format-specific: structure supplying additional format-specific
168 # information (since 1.7)
173 { 'struct': 'ImageInfo',
174 'data': {'filename': 'str', 'format': 'str', '*dirty-flag': 'bool',
175 '*actual-size': 'int', 'virtual-size': 'int',
176 '*cluster-size': 'int', '*encrypted': 'bool', '*compressed': 'bool',
177 '*backing-filename': 'str', '*full-backing-filename': 'str',
178 '*backing-filename-format': 'str', '*snapshots': ['SnapshotInfo'],
179 '*backing-image': 'ImageInfo',
180 '*format-specific': 'ImageInfoSpecific' } }
185 # Information about a QEMU image file check
187 # @filename: name of the image file checked
189 # @format: format of the image file checked
191 # @check-errors: number of unexpected errors occurred during check
193 # @image-end-offset: offset (in bytes) where the image ends, this
194 # field is present if the driver for the image format
197 # @corruptions: number of corruptions found during the check if any
199 # @leaks: number of leaks found during the check if any
201 # @corruptions-fixed: number of corruptions fixed during the check
204 # @leaks-fixed: number of leaks fixed during the check if any
206 # @total-clusters: total number of clusters, this field is present
207 # if the driver for the image format supports it
209 # @allocated-clusters: total number of allocated clusters, this
210 # field is present if the driver for the image format
213 # @fragmented-clusters: total number of fragmented clusters, this
214 # field is present if the driver for the image format
217 # @compressed-clusters: total number of compressed clusters, this
218 # field is present if the driver for the image format
224 { 'struct': 'ImageCheck',
225 'data': {'filename': 'str', 'format': 'str', 'check-errors': 'int',
226 '*image-end-offset': 'int', '*corruptions': 'int', '*leaks': 'int',
227 '*corruptions-fixed': 'int', '*leaks-fixed': 'int',
228 '*total-clusters': 'int', '*allocated-clusters': 'int',
229 '*fragmented-clusters': 'int', '*compressed-clusters': 'int' } }
234 # Mapping information from a virtual block range to a host file range
236 # @start: the start byte of the mapped virtual range
238 # @length: the number of bytes of the mapped virtual range
240 # @data: whether the mapped range has data
242 # @zero: whether the virtual blocks are zeroed
244 # @depth: the depth of the mapping
246 # @offset: the offset in file that the virtual sectors are mapped to
248 # @filename: filename that is referred to by @offset
253 { 'struct': 'MapEntry',
254 'data': {'start': 'int', 'length': 'int', 'data': 'bool',
255 'zero': 'bool', 'depth': 'int', '*offset': 'int',
256 '*filename': 'str' } }
259 # @BlockdevCacheInfo:
261 # Cache mode information for a block device
263 # @writeback: true if writeback mode is enabled
264 # @direct: true if the host page cache is bypassed (O_DIRECT)
265 # @no-flush: true if flush requests are ignored for the device
269 { 'struct': 'BlockdevCacheInfo',
270 'data': { 'writeback': 'bool',
272 'no-flush': 'bool' } }
277 # Information about the backing device for a block device.
279 # @file: the filename of the backing device
281 # @node-name: the name of the block driver node (Since 2.0)
283 # @ro: true if the backing device was open read-only
285 # @drv: the name of the block format used to open the backing device. As of
286 # 0.14.0 this can be: 'blkdebug', 'bochs', 'cloop', 'cow', 'dmg',
287 # 'file', 'file', 'ftp', 'ftps', 'host_cdrom', 'host_device',
288 # 'http', 'https', 'luks', 'nbd', 'parallels', 'qcow',
289 # 'qcow2', 'raw', 'vdi', 'vmdk', 'vpc', 'vvfat'
290 # 2.2: 'archipelago' added, 'cow' dropped
291 # 2.3: 'host_floppy' deprecated
292 # 2.5: 'host_floppy' dropped
294 # 2.8: 'replication' added, 'tftp' dropped
295 # 2.9: 'archipelago' dropped
297 # @backing_file: the name of the backing file (for copy-on-write)
299 # @backing_file_depth: number of files in the backing file chain (since: 1.2)
301 # @encrypted: true if the backing device is encrypted
303 # @encryption_key_missing: always false
305 # @detect_zeroes: detect and optimize zero writes (Since 2.1)
307 # @bps: total throughput limit in bytes per second is specified
309 # @bps_rd: read throughput limit in bytes per second is specified
311 # @bps_wr: write throughput limit in bytes per second is specified
313 # @iops: total I/O operations per second is specified
315 # @iops_rd: read I/O operations per second is specified
317 # @iops_wr: write I/O operations per second is specified
319 # @image: the info of image used (since: 1.6)
321 # @bps_max: total throughput limit during bursts,
322 # in bytes (Since 1.7)
324 # @bps_rd_max: read throughput limit during bursts,
325 # in bytes (Since 1.7)
327 # @bps_wr_max: write throughput limit during bursts,
328 # in bytes (Since 1.7)
330 # @iops_max: total I/O operations per second during bursts,
331 # in bytes (Since 1.7)
333 # @iops_rd_max: read I/O operations per second during bursts,
334 # in bytes (Since 1.7)
336 # @iops_wr_max: write I/O operations per second during bursts,
337 # in bytes (Since 1.7)
339 # @bps_max_length: maximum length of the @bps_max burst
340 # period, in seconds. (Since 2.6)
342 # @bps_rd_max_length: maximum length of the @bps_rd_max
343 # burst period, in seconds. (Since 2.6)
345 # @bps_wr_max_length: maximum length of the @bps_wr_max
346 # burst period, in seconds. (Since 2.6)
348 # @iops_max_length: maximum length of the @iops burst
349 # period, in seconds. (Since 2.6)
351 # @iops_rd_max_length: maximum length of the @iops_rd_max
352 # burst period, in seconds. (Since 2.6)
354 # @iops_wr_max_length: maximum length of the @iops_wr_max
355 # burst period, in seconds. (Since 2.6)
357 # @iops_size: an I/O size in bytes (Since 1.7)
359 # @group: throttle group name (Since 2.4)
361 # @cache: the cache mode used for the block device (since: 2.3)
363 # @write_threshold: configured write threshold for the device.
364 # 0 if disabled. (Since 2.3)
366 # @dirty-bitmaps: dirty bitmaps information (only present if node
367 # has one or more dirty bitmaps) (Since 4.2)
370 # @deprecated: Member @encryption_key_missing is deprecated. It is
376 { 'struct': 'BlockDeviceInfo',
377 'data': { 'file': 'str', '*node-name': 'str', 'ro': 'bool', 'drv': 'str',
378 '*backing_file': 'str', 'backing_file_depth': 'int',
380 'encryption_key_missing': { 'type': 'bool',
381 'features': [ 'deprecated' ] },
382 'detect_zeroes': 'BlockdevDetectZeroesOptions',
383 'bps': 'int', 'bps_rd': 'int', 'bps_wr': 'int',
384 'iops': 'int', 'iops_rd': 'int', 'iops_wr': 'int',
385 'image': 'ImageInfo',
386 '*bps_max': 'int', '*bps_rd_max': 'int',
387 '*bps_wr_max': 'int', '*iops_max': 'int',
388 '*iops_rd_max': 'int', '*iops_wr_max': 'int',
389 '*bps_max_length': 'int', '*bps_rd_max_length': 'int',
390 '*bps_wr_max_length': 'int', '*iops_max_length': 'int',
391 '*iops_rd_max_length': 'int', '*iops_wr_max_length': 'int',
392 '*iops_size': 'int', '*group': 'str', 'cache': 'BlockdevCacheInfo',
393 'write_threshold': 'int', '*dirty-bitmaps': ['BlockDirtyInfo'] } }
396 # @BlockDeviceIoStatus:
398 # An enumeration of block device I/O status.
400 # @ok: The last I/O operation has succeeded
402 # @failed: The last I/O operation has failed
404 # @nospace: The last I/O operation has failed due to a no-space condition
408 { 'enum': 'BlockDeviceIoStatus', 'data': [ 'ok', 'failed', 'nospace' ] }
411 # @BlockDeviceMapEntry:
413 # Entry in the metadata map of the device (returned by "qemu-img map")
415 # @start: Offset in the image of the first byte described by this entry
418 # @length: Length of the range described by this entry (in bytes)
420 # @depth: Number of layers (0 = top image, 1 = top image's backing file, etc.)
421 # before reaching one for which the range is allocated. The value is
422 # in the range 0 to the depth of the image chain - 1.
424 # @zero: the sectors in this range read as zeros
426 # @data: reading the image will actually read data from a file (in particular,
427 # if @offset is present this means that the sectors are not simply
428 # preallocated, but contain actual data in raw format)
430 # @offset: if present, the image file stores the data for this range in
431 # raw format at the given offset.
435 { 'struct': 'BlockDeviceMapEntry',
436 'data': { 'start': 'int', 'length': 'int', 'depth': 'int', 'zero': 'bool',
437 'data': 'bool', '*offset': 'int' } }
440 # @DirtyBitmapStatus:
442 # An enumeration of possible states that a dirty bitmap can report to the user.
444 # @frozen: The bitmap is currently in-use by some operation and is immutable.
445 # If the bitmap was @active prior to the operation, new writes by the
446 # guest are being recorded in a temporary buffer, and will not be lost.
447 # Generally, bitmaps are cleared on successful use in an operation and
448 # the temporary buffer is committed into the bitmap. On failure, the
449 # temporary buffer is merged back into the bitmap without first
451 # Please refer to the documentation for each bitmap-using operation,
452 # See also @blockdev-backup, @drive-backup.
454 # @disabled: The bitmap is not currently recording new writes by the guest.
455 # This is requested explicitly via @block-dirty-bitmap-disable.
456 # It can still be cleared, deleted, or used for backup operations.
458 # @active: The bitmap is actively monitoring for new writes, and can be cleared,
459 # deleted, or used for backup operations.
461 # @locked: The bitmap is currently in-use by some operation and is immutable.
462 # If the bitmap was @active prior to the operation, it is still
463 # recording new writes. If the bitmap was @disabled, it is not
464 # recording new writes. (Since 2.12)
466 # @inconsistent: This is a persistent dirty bitmap that was marked in-use on
467 # disk, and is unusable by QEMU. It can only be deleted.
468 # Please rely on the inconsistent field in @BlockDirtyInfo
469 # instead, as the status field is deprecated. (Since 4.0)
473 { 'enum': 'DirtyBitmapStatus',
474 'data': ['active', 'disabled', 'frozen', 'locked', 'inconsistent'] }
479 # Block dirty bitmap information.
481 # @name: the name of the dirty bitmap (Since 2.4)
483 # @count: number of dirty bytes according to the dirty bitmap
485 # @granularity: granularity of the dirty bitmap in bytes (since 1.4)
487 # @status: current status of the dirty bitmap (since 2.4)
489 # @recording: true if the bitmap is recording new writes from the guest.
490 # Replaces `active` and `disabled` statuses. (since 4.0)
492 # @busy: true if the bitmap is in-use by some operation (NBD or jobs)
493 # and cannot be modified via QMP or used by another operation.
494 # Replaces `locked` and `frozen` statuses. (since 4.0)
496 # @persistent: true if the bitmap was stored on disk, is scheduled to be stored
497 # on disk, or both. (since 4.0)
499 # @inconsistent: true if this is a persistent bitmap that was improperly
500 # stored. Implies @persistent to be true; @recording and
501 # @busy to be false. This bitmap cannot be used. To remove
502 # it, use @block-dirty-bitmap-remove. (Since 4.0)
505 # @deprecated: Member @status is deprecated. Use @recording and
510 { 'struct': 'BlockDirtyInfo',
511 'data': {'*name': 'str', 'count': 'int', 'granularity': 'uint32',
512 'recording': 'bool', 'busy': 'bool',
513 'status': { 'type': 'DirtyBitmapStatus',
514 'features': [ 'deprecated' ] },
515 'persistent': 'bool', '*inconsistent': 'bool' } }
518 # @Qcow2BitmapInfoFlags:
520 # An enumeration of flags that a bitmap can report to the user.
522 # @in-use: This flag is set by any process actively modifying the qcow2 file,
523 # and cleared when the updated bitmap is flushed to the qcow2 image.
524 # The presence of this flag in an offline image means that the bitmap
525 # was not saved correctly after its last usage, and may contain
528 # @auto: The bitmap must reflect all changes of the virtual disk by any
529 # application that would write to this qcow2 file.
533 { 'enum': 'Qcow2BitmapInfoFlags',
534 'data': ['in-use', 'auto'] }
539 # Qcow2 bitmap information.
541 # @name: the name of the bitmap
543 # @granularity: granularity of the bitmap in bytes
545 # @flags: flags of the bitmap
549 { 'struct': 'Qcow2BitmapInfo',
550 'data': {'name': 'str', 'granularity': 'uint32',
551 'flags': ['Qcow2BitmapInfoFlags'] } }
554 # @BlockLatencyHistogramInfo:
556 # Block latency histogram.
558 # @boundaries: list of interval boundary values in nanoseconds, all greater
559 # than zero and in ascending order.
560 # For example, the list [10, 50, 100] produces the following
561 # histogram intervals: [0, 10), [10, 50), [50, 100), [100, +inf).
563 # @bins: list of io request counts corresponding to histogram intervals.
564 # len(@bins) = len(@boundaries) + 1
565 # For the example above, @bins may be something like [3, 1, 5, 2],
566 # and corresponding histogram looks like:
573 # | +------------------
578 { 'struct': 'BlockLatencyHistogramInfo',
579 'data': {'boundaries': ['uint64'], 'bins': ['uint64'] } }
584 # Block device information. This structure describes a virtual device and
585 # the backing device associated with it.
587 # @device: The device name associated with the virtual device.
589 # @qdev: The qdev ID, or if no ID is assigned, the QOM path of the block
590 # device. (since 2.10)
592 # @type: This field is returned only for compatibility reasons, it should
593 # not be used (always returns 'unknown')
595 # @removable: True if the device supports removable media.
597 # @locked: True if the guest has locked this device from having its media
600 # @tray_open: True if the device's tray is open
601 # (only present if it has a tray)
603 # @dirty-bitmaps: dirty bitmaps information (only present if the
604 # driver has one or more dirty bitmaps) (Since 2.0)
606 # @io-status: @BlockDeviceIoStatus. Only present if the device
607 # supports it and the VM is configured to stop on errors
608 # (supported device models: virtio-blk, IDE, SCSI except
611 # @inserted: @BlockDeviceInfo describing the device if media is
615 # @deprecated: Member @dirty-bitmaps is deprecated. Use @inserted
616 # member @dirty-bitmaps instead.
620 { 'struct': 'BlockInfo',
621 'data': {'device': 'str', '*qdev': 'str', 'type': 'str', 'removable': 'bool',
622 'locked': 'bool', '*inserted': 'BlockDeviceInfo',
623 '*tray_open': 'bool', '*io-status': 'BlockDeviceIoStatus',
624 '*dirty-bitmaps': { 'type': ['BlockDirtyInfo'],
625 'features': [ 'deprecated' ] } } }
630 # Image file size calculation information. This structure describes the size
631 # requirements for creating a new image file.
633 # The size requirements depend on the new image file format. File size always
634 # equals virtual disk size for the 'raw' format, even for sparse POSIX files.
635 # Compact formats such as 'qcow2' represent unallocated and zero regions
636 # efficiently so file size may be smaller than virtual disk size.
638 # The values are upper bounds that are guaranteed to fit the new image file.
639 # Subsequent modification, such as internal snapshot or bitmap creation, may
640 # require additional space and is not covered here.
642 # @required: Size required for a new image file, in bytes.
644 # @fully-allocated: Image file size, in bytes, once data has been written
649 { 'struct': 'BlockMeasureInfo',
650 'data': {'required': 'int', 'fully-allocated': 'int'} }
655 # Get a list of BlockInfo for all virtual block devices.
657 # Returns: a list of @BlockInfo describing each virtual block device. Filter
658 # nodes that were created implicitly are skipped over.
664 # -> { "execute": "query-block" }
669 # "device":"ide0-hd0",
676 # "file":"disks/test.qcow2",
677 # "backing_file_depth":1,
684 # "bps_max": 8000000,
691 # "detect_zeroes": "on",
692 # "write_threshold": 0,
694 # "filename":"disks/test.qcow2",
696 # "virtual-size":2048000,
697 # "backing_file":"base.qcow2",
698 # "full-backing-filename":"disks/base.qcow2",
699 # "backing-filename-format":"qcow2",
703 # "name": "snapshot1",
704 # "vm-state-size": 0,
705 # "date-sec": 10000200,
707 # "vm-clock-sec": 206,
708 # "vm-clock-nsec": 30
712 # "filename":"disks/base.qcow2",
714 # "virtual-size":2048000
718 # "qdev": "ide_disk",
723 # "device":"ide1-cd0",
726 # "qdev": "/machine/unattached/device[23]",
727 # "tray_open": false,
731 # "device":"floppy0",
734 # "qdev": "/machine/unattached/device[20]",
747 { 'command': 'query-block', 'returns': ['BlockInfo'] }
751 # @BlockDeviceTimedStats:
753 # Statistics of a block device during a given interval of time.
755 # @interval_length: Interval used for calculating the statistics,
758 # @min_rd_latency_ns: Minimum latency of read operations in the
759 # defined interval, in nanoseconds.
761 # @min_wr_latency_ns: Minimum latency of write operations in the
762 # defined interval, in nanoseconds.
764 # @min_flush_latency_ns: Minimum latency of flush operations in the
765 # defined interval, in nanoseconds.
767 # @max_rd_latency_ns: Maximum latency of read operations in the
768 # defined interval, in nanoseconds.
770 # @max_wr_latency_ns: Maximum latency of write operations in the
771 # defined interval, in nanoseconds.
773 # @max_flush_latency_ns: Maximum latency of flush operations in the
774 # defined interval, in nanoseconds.
776 # @avg_rd_latency_ns: Average latency of read operations in the
777 # defined interval, in nanoseconds.
779 # @avg_wr_latency_ns: Average latency of write operations in the
780 # defined interval, in nanoseconds.
782 # @avg_flush_latency_ns: Average latency of flush operations in the
783 # defined interval, in nanoseconds.
785 # @avg_rd_queue_depth: Average number of pending read operations
786 # in the defined interval.
788 # @avg_wr_queue_depth: Average number of pending write operations
789 # in the defined interval.
793 { 'struct': 'BlockDeviceTimedStats',
794 'data': { 'interval_length': 'int', 'min_rd_latency_ns': 'int',
795 'max_rd_latency_ns': 'int', 'avg_rd_latency_ns': 'int',
796 'min_wr_latency_ns': 'int', 'max_wr_latency_ns': 'int',
797 'avg_wr_latency_ns': 'int', 'min_flush_latency_ns': 'int',
798 'max_flush_latency_ns': 'int', 'avg_flush_latency_ns': 'int',
799 'avg_rd_queue_depth': 'number', 'avg_wr_queue_depth': 'number' } }
804 # Statistics of a virtual block device or a block backing device.
806 # @rd_bytes: The number of bytes read by the device.
808 # @wr_bytes: The number of bytes written by the device.
810 # @unmap_bytes: The number of bytes unmapped by the device (Since 4.2)
812 # @rd_operations: The number of read operations performed by the device.
814 # @wr_operations: The number of write operations performed by the device.
816 # @flush_operations: The number of cache flush operations performed by the
817 # device (since 0.15.0)
819 # @unmap_operations: The number of unmap operations performed by the device
822 # @rd_total_time_ns: Total time spent on reads in nanoseconds (since 0.15.0).
824 # @wr_total_time_ns: Total time spent on writes in nanoseconds (since 0.15.0).
826 # @flush_total_time_ns: Total time spent on cache flushes in nanoseconds
829 # @unmap_total_time_ns: Total time spent on unmap operations in nanoseconds
832 # @wr_highest_offset: The offset after the greatest byte written to the
833 # device. The intended use of this information is for
834 # growable sparse files (like qcow2) that are used on top
835 # of a physical device.
837 # @rd_merged: Number of read requests that have been merged into another
838 # request (Since 2.3).
840 # @wr_merged: Number of write requests that have been merged into another
841 # request (Since 2.3).
843 # @unmap_merged: Number of unmap requests that have been merged into another
844 # request (Since 4.2)
846 # @idle_time_ns: Time since the last I/O operation, in
847 # nanoseconds. If the field is absent it means that
848 # there haven't been any operations yet (Since 2.5).
850 # @failed_rd_operations: The number of failed read operations
851 # performed by the device (Since 2.5)
853 # @failed_wr_operations: The number of failed write operations
854 # performed by the device (Since 2.5)
856 # @failed_flush_operations: The number of failed flush operations
857 # performed by the device (Since 2.5)
859 # @failed_unmap_operations: The number of failed unmap operations performed
860 # by the device (Since 4.2)
862 # @invalid_rd_operations: The number of invalid read operations
863 # performed by the device (Since 2.5)
865 # @invalid_wr_operations: The number of invalid write operations
866 # performed by the device (Since 2.5)
868 # @invalid_flush_operations: The number of invalid flush operations
869 # performed by the device (Since 2.5)
871 # @invalid_unmap_operations: The number of invalid unmap operations performed
872 # by the device (Since 4.2)
874 # @account_invalid: Whether invalid operations are included in the
875 # last access statistics (Since 2.5)
877 # @account_failed: Whether failed operations are included in the
878 # latency and last access statistics (Since 2.5)
880 # @timed_stats: Statistics specific to the set of previously defined
881 # intervals of time (Since 2.5)
883 # @rd_latency_histogram: @BlockLatencyHistogramInfo. (Since 4.0)
885 # @wr_latency_histogram: @BlockLatencyHistogramInfo. (Since 4.0)
887 # @flush_latency_histogram: @BlockLatencyHistogramInfo. (Since 4.0)
891 { 'struct': 'BlockDeviceStats',
892 'data': {'rd_bytes': 'int', 'wr_bytes': 'int', 'unmap_bytes' : 'int',
893 'rd_operations': 'int', 'wr_operations': 'int',
894 'flush_operations': 'int', 'unmap_operations': 'int',
895 'rd_total_time_ns': 'int', 'wr_total_time_ns': 'int',
896 'flush_total_time_ns': 'int', 'unmap_total_time_ns': 'int',
897 'wr_highest_offset': 'int',
898 'rd_merged': 'int', 'wr_merged': 'int', 'unmap_merged': 'int',
899 '*idle_time_ns': 'int',
900 'failed_rd_operations': 'int', 'failed_wr_operations': 'int',
901 'failed_flush_operations': 'int', 'failed_unmap_operations': 'int',
902 'invalid_rd_operations': 'int', 'invalid_wr_operations': 'int',
903 'invalid_flush_operations': 'int', 'invalid_unmap_operations': 'int',
904 'account_invalid': 'bool', 'account_failed': 'bool',
905 'timed_stats': ['BlockDeviceTimedStats'],
906 '*rd_latency_histogram': 'BlockLatencyHistogramInfo',
907 '*wr_latency_histogram': 'BlockLatencyHistogramInfo',
908 '*flush_latency_histogram': 'BlockLatencyHistogramInfo' } }
911 # @BlockStatsSpecificFile:
913 # File driver statistics
915 # @discard-nb-ok: The number of successful discard operations performed by
918 # @discard-nb-failed: The number of failed discard operations performed by
921 # @discard-bytes-ok: The number of bytes discarded by the driver.
925 { 'struct': 'BlockStatsSpecificFile',
927 'discard-nb-ok': 'uint64',
928 'discard-nb-failed': 'uint64',
929 'discard-bytes-ok': 'uint64' } }
932 # @BlockStatsSpecific:
934 # Block driver specific statistics
938 { 'union': 'BlockStatsSpecific',
939 'base': { 'driver': 'BlockdevDriver' },
940 'discriminator': 'driver',
942 'file': 'BlockStatsSpecificFile',
943 'host_device': 'BlockStatsSpecificFile' } }
948 # Statistics of a virtual block device or a block backing device.
950 # @device: If the stats are for a virtual block device, the name
951 # corresponding to the virtual block device.
953 # @node-name: The node name of the device. (Since 2.3)
955 # @qdev: The qdev ID, or if no ID is assigned, the QOM path of the block
956 # device. (since 3.0)
958 # @stats: A @BlockDeviceStats for the device.
960 # @driver-specific: Optional driver-specific stats. (Since 4.2)
962 # @parent: This describes the file block device if it has one.
963 # Contains recursively the statistics of the underlying
964 # protocol (e.g. the host file for a qcow2 image). If there is
965 # no underlying protocol, this field is omitted
967 # @backing: This describes the backing block device if it has one.
972 { 'struct': 'BlockStats',
973 'data': {'*device': 'str', '*qdev': 'str', '*node-name': 'str',
974 'stats': 'BlockDeviceStats',
975 '*driver-specific': 'BlockStatsSpecific',
976 '*parent': 'BlockStats',
977 '*backing': 'BlockStats'} }
982 # Query the @BlockStats for all virtual block devices.
984 # @query-nodes: If true, the command will query all the block nodes
985 # that have a node name, in a list which will include "parent"
986 # information, but not "backing".
987 # If false or omitted, the behavior is as before - query all the
988 # device backends, recursively including their "parent" and
989 # "backing". Filter nodes that were created implicitly are
990 # skipped over in this mode. (Since 2.3)
992 # Returns: A list of @BlockStats for each virtual block devices.
998 # -> { "execute": "query-blockstats" }
1002 # "device":"ide0-hd0",
1005 # "wr_highest_offset":3686448128,
1006 # "wr_bytes":9786368,
1007 # "wr_operations":751,
1008 # "rd_bytes":122567168,
1009 # "rd_operations":36772
1010 # "wr_total_times_ns":313253456
1011 # "rd_total_times_ns":3465673657
1012 # "flush_total_times_ns":49653
1013 # "flush_operations":61,
1016 # "idle_time_ns":2953431879,
1017 # "account_invalid":true,
1018 # "account_failed":false
1022 # "wr_highest_offset":2821110784,
1023 # "wr_bytes":9786368,
1024 # "wr_operations":692,
1025 # "rd_bytes":122739200,
1026 # "rd_operations":36604
1027 # "flush_operations":51,
1028 # "wr_total_times_ns":313253456
1029 # "rd_total_times_ns":3465673657
1030 # "flush_total_times_ns":49653,
1033 # "idle_time_ns":2953431879,
1034 # "account_invalid":true,
1035 # "account_failed":false
1037 # "qdev": "/machine/unattached/device[23]"
1040 # "device":"ide1-cd0",
1042 # "wr_highest_offset":0,
1044 # "wr_operations":0,
1047 # "flush_operations":0,
1048 # "wr_total_times_ns":0
1049 # "rd_total_times_ns":0
1050 # "flush_total_times_ns":0,
1053 # "account_invalid":false,
1054 # "account_failed":false
1056 # "qdev": "/machine/unattached/device[24]"
1059 # "device":"floppy0",
1061 # "wr_highest_offset":0,
1063 # "wr_operations":0,
1066 # "flush_operations":0,
1067 # "wr_total_times_ns":0
1068 # "rd_total_times_ns":0
1069 # "flush_total_times_ns":0,
1072 # "account_invalid":false,
1073 # "account_failed":false
1075 # "qdev": "/machine/unattached/device[16]"
1080 # "wr_highest_offset":0,
1082 # "wr_operations":0,
1085 # "flush_operations":0,
1086 # "wr_total_times_ns":0
1087 # "rd_total_times_ns":0
1088 # "flush_total_times_ns":0,
1091 # "account_invalid":false,
1092 # "account_failed":false
1099 { 'command': 'query-blockstats',
1100 'data': { '*query-nodes': 'bool' },
1101 'returns': ['BlockStats'] }
1106 # An enumeration of possible behaviors for errors on I/O operations.
1107 # The exact meaning depends on whether the I/O was initiated by a guest
1110 # @report: for guest operations, report the error to the guest;
1111 # for jobs, cancel the job
1113 # @ignore: ignore the error, only report a QMP event (BLOCK_IO_ERROR
1114 # or BLOCK_JOB_ERROR). The backup, mirror and commit block jobs retry
1115 # the failing request later and may still complete successfully. The
1116 # stream block job continues to stream and will complete with an
1119 # @enospc: same as @stop on ENOSPC, same as @report otherwise.
1121 # @stop: for guest operations, stop the virtual machine;
1122 # for jobs, pause the job
1124 # @auto: inherit the error handling policy of the backend (since: 2.7)
1128 { 'enum': 'BlockdevOnError',
1129 'data': ['report', 'ignore', 'enospc', 'stop', 'auto'] }
1134 # An enumeration of possible behaviors for the initial synchronization
1135 # phase of storage mirroring.
1137 # @top: copies data in the topmost image to the destination
1139 # @full: copies data from all images to the destination
1141 # @none: only copy data written from now on
1143 # @incremental: only copy data described by the dirty bitmap. (since: 2.4)
1145 # @bitmap: only copy data described by the dirty bitmap. (since: 4.2)
1146 # Behavior on completion is determined by the BitmapSyncMode.
1150 { 'enum': 'MirrorSyncMode',
1151 'data': ['top', 'full', 'none', 'incremental', 'bitmap'] }
1156 # An enumeration of possible behaviors for the synchronization of a bitmap
1157 # when used for data copy operations.
1159 # @on-success: The bitmap is only synced when the operation is successful.
1160 # This is the behavior always used for 'INCREMENTAL' backups.
1162 # @never: The bitmap is never synchronized with the operation, and is
1163 # treated solely as a read-only manifest of blocks to copy.
1165 # @always: The bitmap is always synchronized with the operation,
1166 # regardless of whether or not the operation was successful.
1170 { 'enum': 'BitmapSyncMode',
1171 'data': ['on-success', 'never', 'always'] }
1176 # An enumeration whose values tell the mirror block job when to
1177 # trigger writes to the target.
1179 # @background: copy data in background only.
1181 # @write-blocking: when data is written to the source, write it
1182 # (synchronously) to the target as well. In
1183 # addition, data is copied in background just like in
1188 { 'enum': 'MirrorCopyMode',
1189 'data': ['background', 'write-blocking'] }
1194 # Information about a long-running block device operation.
1196 # @type: the job type ('stream' for image streaming)
1198 # @device: The job identifier. Originally the device name but other
1199 # values are allowed since QEMU 2.7
1201 # @len: Estimated @offset value at the completion of the job. This value can
1202 # arbitrarily change while the job is running, in both directions.
1204 # @offset: Progress made until now. The unit is arbitrary and the value can
1205 # only meaningfully be used for the ratio of @offset to @len. The
1206 # value is monotonically increasing.
1208 # @busy: false if the job is known to be in a quiescent state, with
1209 # no pending I/O. Since 1.3.
1211 # @paused: whether the job is paused or, if @busy is true, will
1212 # pause itself as soon as possible. Since 1.3.
1214 # @speed: the rate limit, bytes per second
1216 # @io-status: the status of the job (since 1.3)
1218 # @ready: true if the job may be completed (since 2.2)
1220 # @status: Current job state/status (since 2.12)
1222 # @auto-finalize: Job will finalize itself when PENDING, moving to
1223 # the CONCLUDED state. (since 2.12)
1225 # @auto-dismiss: Job will dismiss itself when CONCLUDED, moving to the NULL
1226 # state and disappearing from the query list. (since 2.12)
1228 # @error: Error information if the job did not complete successfully.
1229 # Not set if the job completed successfully. (since 2.12.1)
1233 { 'struct': 'BlockJobInfo',
1234 'data': {'type': 'str', 'device': 'str', 'len': 'int',
1235 'offset': 'int', 'busy': 'bool', 'paused': 'bool', 'speed': 'int',
1236 'io-status': 'BlockDeviceIoStatus', 'ready': 'bool',
1237 'status': 'JobStatus',
1238 'auto-finalize': 'bool', 'auto-dismiss': 'bool',
1242 # @query-block-jobs:
1244 # Return information about long-running block device operations.
1246 # Returns: a list of @BlockJobInfo for each active block job
1250 { 'command': 'query-block-jobs', 'returns': ['BlockJobInfo'] }
1255 # This command sets the password of a block device that has not been open
1256 # with a password and requires one.
1258 # This command is now obsolete and will always return an error since 2.10
1261 { 'command': 'block_passwd',
1262 'data': { '*device': 'str',
1263 '*node-name': 'str',
1264 'password': 'str' } }
1269 # Resize a block image while a guest is running.
1271 # Either @device or @node-name must be set but not both.
1273 # @device: the name of the device to get the image resized
1275 # @node-name: graph node name to get the image resized (Since 2.0)
1277 # @size: new image size in bytes
1279 # Returns: - nothing on success
1280 # - If @device is not a valid block device, DeviceNotFound
1286 # -> { "execute": "block_resize",
1287 # "arguments": { "device": "scratch", "size": 1073741824 } }
1288 # <- { "return": {} }
1291 { 'command': 'block_resize',
1292 'data': { '*device': 'str',
1293 '*node-name': 'str',
1299 # An enumeration that tells QEMU how to set the backing file path in
1302 # @existing: QEMU should look for an existing image file.
1304 # @absolute-paths: QEMU should create a new image with absolute paths
1305 # for the backing file. If there is no backing file available, the new
1306 # image will not be backed either.
1310 { 'enum': 'NewImageMode',
1311 'data': [ 'existing', 'absolute-paths' ] }
1314 # @BlockdevSnapshotSync:
1316 # Either @device or @node-name must be set but not both.
1318 # @device: the name of the device to take a snapshot of.
1320 # @node-name: graph node name to generate the snapshot from (Since 2.0)
1322 # @snapshot-file: the target of the new overlay image. If the file
1323 # exists, or if it is a device, the overlay will be created in the
1324 # existing file/device. Otherwise, a new file will be created.
1326 # @snapshot-node-name: the graph node name of the new image (Since 2.0)
1328 # @format: the format of the overlay image, default is 'qcow2'.
1330 # @mode: whether and how QEMU should create a new image, default is
1333 { 'struct': 'BlockdevSnapshotSync',
1334 'data': { '*device': 'str', '*node-name': 'str',
1335 'snapshot-file': 'str', '*snapshot-node-name': 'str',
1336 '*format': 'str', '*mode': 'NewImageMode' } }
1339 # @BlockdevSnapshot:
1341 # @node: device or node name that will have a snapshot taken.
1343 # @overlay: reference to the existing block device that will become
1344 # the overlay of @node, as part of taking the snapshot.
1345 # It must not have a current backing file (this can be
1346 # achieved by passing "backing": null to blockdev-add).
1350 { 'struct': 'BlockdevSnapshot',
1351 'data': { 'node': 'str', 'overlay': 'str' } }
1356 # @job-id: identifier for the newly-created block job. If
1357 # omitted, the device name will be used. (Since 2.7)
1359 # @device: the device name or node-name of a root node which should be copied.
1361 # @sync: what parts of the disk image should be copied to the destination
1362 # (all the disk, only the sectors allocated in the topmost image, from a
1363 # dirty bitmap, or only new I/O).
1365 # @speed: the maximum speed, in bytes per second. The default is 0,
1368 # @bitmap: The name of a dirty bitmap to use.
1369 # Must be present if sync is "bitmap" or "incremental".
1370 # Can be present if sync is "full" or "top".
1371 # Must not be present otherwise.
1372 # (Since 2.4 (drive-backup), 3.1 (blockdev-backup))
1374 # @bitmap-mode: Specifies the type of data the bitmap should contain after
1375 # the operation concludes.
1376 # Must be present if a bitmap was provided,
1377 # Must NOT be present otherwise. (Since 4.2)
1379 # @compress: true to compress data, if the target format supports it.
1380 # (default: false) (since 2.8)
1382 # @on-source-error: the action to take on an error on the source,
1383 # default 'report'. 'stop' and 'enospc' can only be used
1384 # if the block device supports io-status (see BlockInfo).
1386 # @on-target-error: the action to take on an error on the target,
1387 # default 'report' (no limitations, since this applies to
1388 # a different block device than @device).
1390 # @auto-finalize: When false, this job will wait in a PENDING state after it has
1391 # finished its work, waiting for @block-job-finalize before
1392 # making any block graph changes.
1393 # When true, this job will automatically
1394 # perform its abort or commit actions.
1395 # Defaults to true. (Since 2.12)
1397 # @auto-dismiss: When false, this job will wait in a CONCLUDED state after it
1398 # has completely ceased all work, and awaits @block-job-dismiss.
1399 # When true, this job will automatically disappear from the query
1400 # list without user intervention.
1401 # Defaults to true. (Since 2.12)
1403 # @filter-node-name: the node name that should be assigned to the
1404 # filter driver that the backup job inserts into the graph
1405 # above node specified by @drive. If this option is not given,
1406 # a node name is autogenerated. (Since: 4.2)
1408 # Note: @on-source-error and @on-target-error only affect background
1409 # I/O. If an error occurs during a guest write request, the device's
1410 # rerror/werror actions will be used.
1414 { 'struct': 'BackupCommon',
1415 'data': { '*job-id': 'str', 'device': 'str',
1416 'sync': 'MirrorSyncMode', '*speed': 'int',
1417 '*bitmap': 'str', '*bitmap-mode': 'BitmapSyncMode',
1418 '*compress': 'bool',
1419 '*on-source-error': 'BlockdevOnError',
1420 '*on-target-error': 'BlockdevOnError',
1421 '*auto-finalize': 'bool', '*auto-dismiss': 'bool',
1422 '*filter-node-name': 'str' } }
1427 # @target: the target of the new image. If the file exists, or if it
1428 # is a device, the existing file/device will be used as the new
1429 # destination. If it does not exist, a new file will be created.
1431 # @format: the format of the new destination, default is to
1432 # probe if @mode is 'existing', else the format of the source
1434 # @mode: whether and how QEMU should create a new image, default is
1439 { 'struct': 'DriveBackup',
1440 'base': 'BackupCommon',
1441 'data': { 'target': 'str',
1443 '*mode': 'NewImageMode' } }
1448 # @target: the device name or node-name of the backup target node.
1452 { 'struct': 'BlockdevBackup',
1453 'base': 'BackupCommon',
1454 'data': { 'target': 'str' } }
1457 # @blockdev-snapshot-sync:
1459 # Takes a synchronous snapshot of a block device.
1461 # For the arguments, see the documentation of BlockdevSnapshotSync.
1463 # Returns: - nothing on success
1464 # - If @device is not a valid block device, DeviceNotFound
1470 # -> { "execute": "blockdev-snapshot-sync",
1471 # "arguments": { "device": "ide-hd0",
1473 # "/some/place/my-image",
1474 # "format": "qcow2" } }
1475 # <- { "return": {} }
1478 { 'command': 'blockdev-snapshot-sync',
1479 'data': 'BlockdevSnapshotSync' }
1483 # @blockdev-snapshot:
1485 # Takes a snapshot of a block device.
1487 # Take a snapshot, by installing 'node' as the backing image of
1488 # 'overlay'. Additionally, if 'node' is associated with a block
1489 # device, the block device changes to using 'overlay' as its new active
1492 # For the arguments, see the documentation of BlockdevSnapshot.
1495 # @allow-write-only-overlay: If present, the check whether this operation is safe
1496 # was relaxed so that it can be used to change
1497 # backing file of a destination of a blockdev-mirror.
1504 # -> { "execute": "blockdev-add",
1505 # "arguments": { "driver": "qcow2",
1506 # "node-name": "node1534",
1507 # "file": { "driver": "file",
1508 # "filename": "hd1.qcow2" },
1509 # "backing": null } }
1511 # <- { "return": {} }
1513 # -> { "execute": "blockdev-snapshot",
1514 # "arguments": { "node": "ide-hd0",
1515 # "overlay": "node1534" } }
1516 # <- { "return": {} }
1519 { 'command': 'blockdev-snapshot',
1520 'data': 'BlockdevSnapshot',
1521 'features': [ 'allow-write-only-overlay' ] }
1524 # @change-backing-file:
1526 # Change the backing file in the image file metadata. This does not
1527 # cause QEMU to reopen the image file to reparse the backing filename
1528 # (it may, however, perform a reopen to change permissions from
1529 # r/o -> r/w -> r/o, if needed). The new backing file string is written
1530 # into the image file metadata, and the QEMU internal strings are
1533 # @image-node-name: The name of the block driver state node of the
1534 # image to modify. The "device" argument is used
1535 # to verify "image-node-name" is in the chain
1536 # described by "device".
1538 # @device: The device name or node-name of the root node that owns
1541 # @backing-file: The string to write as the backing file. This
1542 # string is not validated, so care should be taken
1543 # when specifying the string or the image chain may
1544 # not be able to be reopened again.
1546 # Returns: - Nothing on success
1547 # - If "device" does not exist or cannot be determined, DeviceNotFound
1551 { 'command': 'change-backing-file',
1552 'data': { 'device': 'str', 'image-node-name': 'str',
1553 'backing-file': 'str' } }
1558 # Live commit of data from overlay image nodes into backing nodes - i.e.,
1559 # writes data between 'top' and 'base' into 'base'.
1561 # @job-id: identifier for the newly-created block job. If
1562 # omitted, the device name will be used. (Since 2.7)
1564 # @device: the device name or node-name of a root node
1566 # @base-node: The node name of the backing image to write data into.
1567 # If not specified, this is the deepest backing image.
1570 # @base: Same as @base-node, except that it is a file name rather than a node
1571 # name. This must be the exact filename string that was used to open the
1572 # node; other strings, even if addressing the same file, are not
1575 # @top-node: The node name of the backing image within the image chain
1576 # which contains the topmost data to be committed down. If
1577 # not specified, this is the active layer. (since: 3.1)
1579 # @top: Same as @top-node, except that it is a file name rather than a node
1580 # name. This must be the exact filename string that was used to open the
1581 # node; other strings, even if addressing the same file, are not
1584 # @backing-file: The backing file string to write into the overlay
1585 # image of 'top'. If 'top' is the active layer,
1586 # specifying a backing file string is an error. This
1587 # filename is not validated.
1589 # If a pathname string is such that it cannot be
1590 # resolved by QEMU, that means that subsequent QMP or
1591 # HMP commands must use node-names for the image in
1592 # question, as filename lookup methods will fail.
1594 # If not specified, QEMU will automatically determine
1595 # the backing file string to use, or error out if
1596 # there is no obvious choice. Care should be taken
1597 # when specifying the string, to specify a valid
1598 # filename or protocol.
1601 # If top == base, that is an error.
1602 # If top == active, the job will not be completed by itself,
1603 # user needs to complete the job with the block-job-complete
1604 # command after getting the ready event. (Since 2.0)
1606 # If the base image is smaller than top, then the base image
1607 # will be resized to be the same size as top. If top is
1608 # smaller than the base image, the base will not be
1609 # truncated. If you want the base image size to match the
1610 # size of the smaller top, you can safely truncate it
1611 # yourself once the commit operation successfully completes.
1613 # @speed: the maximum speed, in bytes per second
1615 # @on-error: the action to take on an error. 'ignore' means that the request
1616 # should be retried. (default: report; Since: 5.0)
1618 # @filter-node-name: the node name that should be assigned to the
1619 # filter driver that the commit job inserts into the graph
1620 # above @top. If this option is not given, a node name is
1621 # autogenerated. (Since: 2.9)
1623 # @auto-finalize: When false, this job will wait in a PENDING state after it has
1624 # finished its work, waiting for @block-job-finalize before
1625 # making any block graph changes.
1626 # When true, this job will automatically
1627 # perform its abort or commit actions.
1628 # Defaults to true. (Since 3.1)
1630 # @auto-dismiss: When false, this job will wait in a CONCLUDED state after it
1631 # has completely ceased all work, and awaits @block-job-dismiss.
1632 # When true, this job will automatically disappear from the query
1633 # list without user intervention.
1634 # Defaults to true. (Since 3.1)
1637 # @deprecated: Members @base and @top are deprecated. Use @base-node
1638 # and @top-node instead.
1640 # Returns: - Nothing on success
1641 # - If @device does not exist, DeviceNotFound
1642 # - Any other error returns a GenericError.
1648 # -> { "execute": "block-commit",
1649 # "arguments": { "device": "virtio0",
1650 # "top": "/tmp/snap1.qcow2" } }
1651 # <- { "return": {} }
1654 { 'command': 'block-commit',
1655 'data': { '*job-id': 'str', 'device': 'str', '*base-node': 'str',
1656 '*base': { 'type': 'str', 'features': [ 'deprecated' ] },
1658 '*top': { 'type': 'str', 'features': [ 'deprecated' ] },
1659 '*backing-file': 'str', '*speed': 'int',
1660 '*on-error': 'BlockdevOnError',
1661 '*filter-node-name': 'str',
1662 '*auto-finalize': 'bool', '*auto-dismiss': 'bool' } }
1667 # Start a point-in-time copy of a block device to a new destination. The
1668 # status of ongoing drive-backup operations can be checked with
1669 # query-block-jobs where the BlockJobInfo.type field has the value 'backup'.
1670 # The operation can be stopped before it has completed using the
1671 # block-job-cancel command.
1673 # Returns: - nothing on success
1674 # - If @device is not a valid block device, GenericError
1680 # -> { "execute": "drive-backup",
1681 # "arguments": { "device": "drive0",
1683 # "target": "backup.img" } }
1684 # <- { "return": {} }
1687 { 'command': 'drive-backup', 'boxed': true,
1688 'data': 'DriveBackup' }
1693 # Start a point-in-time copy of a block device to a new destination. The
1694 # status of ongoing blockdev-backup operations can be checked with
1695 # query-block-jobs where the BlockJobInfo.type field has the value 'backup'.
1696 # The operation can be stopped before it has completed using the
1697 # block-job-cancel command.
1699 # Returns: - nothing on success
1700 # - If @device is not a valid block device, DeviceNotFound
1705 # -> { "execute": "blockdev-backup",
1706 # "arguments": { "device": "src-id",
1708 # "target": "tgt-id" } }
1709 # <- { "return": {} }
1712 { 'command': 'blockdev-backup', 'boxed': true,
1713 'data': 'BlockdevBackup' }
1717 # @query-named-block-nodes:
1719 # Get the named block driver list
1721 # @flat: Omit the nested data about backing image ("backing-image" key) if true.
1722 # Default is false (Since 5.0)
1724 # Returns: the list of BlockDeviceInfo
1730 # -> { "execute": "query-named-block-nodes" }
1731 # <- { "return": [ { "ro":false,
1733 # "encrypted":false,
1734 # "file":"disks/test.qcow2",
1735 # "node-name": "my-node",
1736 # "backing_file_depth":1,
1743 # "bps_max": 8000000,
1750 # "write_threshold": 0,
1752 # "filename":"disks/test.qcow2",
1754 # "virtual-size":2048000,
1755 # "backing_file":"base.qcow2",
1756 # "full-backing-filename":"disks/base.qcow2",
1757 # "backing-filename-format":"qcow2",
1761 # "name": "snapshot1",
1762 # "vm-state-size": 0,
1763 # "date-sec": 10000200,
1765 # "vm-clock-sec": 206,
1766 # "vm-clock-nsec": 30
1770 # "filename":"disks/base.qcow2",
1772 # "virtual-size":2048000
1777 { 'command': 'query-named-block-nodes',
1778 'returns': [ 'BlockDeviceInfo' ],
1779 'data': { '*flat': 'bool' } }
1782 # @XDbgBlockGraphNodeType:
1784 # @block-backend: corresponds to BlockBackend
1786 # @block-job: corresonds to BlockJob
1788 # @block-driver: corresponds to BlockDriverState
1792 { 'enum': 'XDbgBlockGraphNodeType',
1793 'data': [ 'block-backend', 'block-job', 'block-driver' ] }
1796 # @XDbgBlockGraphNode:
1798 # @id: Block graph node identifier. This @id is generated only for
1799 # x-debug-query-block-graph and does not relate to any other identifiers in
1802 # @type: Type of graph node. Can be one of block-backend, block-job or
1803 # block-driver-state.
1805 # @name: Human readable name of the node. Corresponds to node-name for
1806 # block-driver-state nodes; is not guaranteed to be unique in the whole
1807 # graph (with block-jobs and block-backends).
1811 { 'struct': 'XDbgBlockGraphNode',
1812 'data': { 'id': 'uint64', 'type': 'XDbgBlockGraphNodeType', 'name': 'str' } }
1817 # Enum of base block permissions.
1819 # @consistent-read: A user that has the "permission" of consistent reads is
1820 # guaranteed that their view of the contents of the block
1821 # device is complete and self-consistent, representing the
1822 # contents of a disk at a specific point.
1823 # For most block devices (including their backing files) this
1824 # is true, but the property cannot be maintained in a few
1825 # situations like for intermediate nodes of a commit block
1828 # @write: This permission is required to change the visible disk contents.
1830 # @write-unchanged: This permission (which is weaker than BLK_PERM_WRITE) is
1831 # both enough and required for writes to the block node when
1832 # the caller promises that the visible disk content doesn't
1834 # As the BLK_PERM_WRITE permission is strictly stronger,
1835 # either is sufficient to perform an unchanging write.
1837 # @resize: This permission is required to change the size of a block node.
1839 # @graph-mod: This permission is required to change the node that this
1840 # BdrvChild points to.
1844 { 'enum': 'BlockPermission',
1845 'data': [ 'consistent-read', 'write', 'write-unchanged', 'resize',
1848 # @XDbgBlockGraphEdge:
1850 # Block Graph edge description for x-debug-query-block-graph.
1852 # @parent: parent id
1856 # @name: name of the relation (examples are 'file' and 'backing')
1858 # @perm: granted permissions for the parent operating on the child
1860 # @shared-perm: permissions that can still be granted to other users of the
1861 # child while it is still attached to this parent
1865 { 'struct': 'XDbgBlockGraphEdge',
1866 'data': { 'parent': 'uint64', 'child': 'uint64',
1867 'name': 'str', 'perm': [ 'BlockPermission' ],
1868 'shared-perm': [ 'BlockPermission' ] } }
1873 # Block Graph - list of nodes and list of edges.
1877 { 'struct': 'XDbgBlockGraph',
1878 'data': { 'nodes': ['XDbgBlockGraphNode'], 'edges': ['XDbgBlockGraphEdge'] } }
1881 # @x-debug-query-block-graph:
1883 # Get the block graph.
1887 { 'command': 'x-debug-query-block-graph', 'returns': 'XDbgBlockGraph' }
1892 # Start mirroring a block device's writes to a new destination. target
1893 # specifies the target of the new image. If the file exists, or if it
1894 # is a device, it will be used as the new destination for writes. If
1895 # it does not exist, a new file will be created. format specifies the
1896 # format of the mirror image, default is to probe if mode='existing',
1897 # else the format of the source.
1899 # Returns: - nothing on success
1900 # - If @device is not a valid block device, GenericError
1906 # -> { "execute": "drive-mirror",
1907 # "arguments": { "device": "ide-hd0",
1908 # "target": "/some/place/my-image",
1910 # "format": "qcow2" } }
1911 # <- { "return": {} }
1914 { 'command': 'drive-mirror', 'boxed': true,
1915 'data': 'DriveMirror' }
1920 # A set of parameters describing drive mirror setup.
1922 # @job-id: identifier for the newly-created block job. If
1923 # omitted, the device name will be used. (Since 2.7)
1925 # @device: the device name or node-name of a root node whose writes should be
1928 # @target: the target of the new image. If the file exists, or if it
1929 # is a device, the existing file/device will be used as the new
1930 # destination. If it does not exist, a new file will be created.
1932 # @format: the format of the new destination, default is to
1933 # probe if @mode is 'existing', else the format of the source
1935 # @node-name: the new block driver state node name in the graph
1938 # @replaces: with sync=full graph node name to be replaced by the new
1939 # image when a whole image copy is done. This can be used to repair
1940 # broken Quorum files. (Since 2.1)
1942 # @mode: whether and how QEMU should create a new image, default is
1945 # @speed: the maximum speed, in bytes per second
1947 # @sync: what parts of the disk image should be copied to the destination
1948 # (all the disk, only the sectors allocated in the topmost image, or
1951 # @granularity: granularity of the dirty bitmap, default is 64K
1952 # if the image format doesn't have clusters, 4K if the clusters
1953 # are smaller than that, else the cluster size. Must be a
1954 # power of 2 between 512 and 64M (since 1.4).
1956 # @buf-size: maximum amount of data in flight from source to
1957 # target (since 1.4).
1959 # @on-source-error: the action to take on an error on the source,
1960 # default 'report'. 'stop' and 'enospc' can only be used
1961 # if the block device supports io-status (see BlockInfo).
1963 # @on-target-error: the action to take on an error on the target,
1964 # default 'report' (no limitations, since this applies to
1965 # a different block device than @device).
1966 # @unmap: Whether to try to unmap target sectors where source has
1967 # only zero. If true, and target unallocated sectors will read as zero,
1968 # target image sectors will be unmapped; otherwise, zeroes will be
1969 # written. Both will result in identical contents.
1970 # Default is true. (Since 2.4)
1972 # @copy-mode: when to copy data to the destination; defaults to 'background'
1975 # @auto-finalize: When false, this job will wait in a PENDING state after it has
1976 # finished its work, waiting for @block-job-finalize before
1977 # making any block graph changes.
1978 # When true, this job will automatically
1979 # perform its abort or commit actions.
1980 # Defaults to true. (Since 3.1)
1982 # @auto-dismiss: When false, this job will wait in a CONCLUDED state after it
1983 # has completely ceased all work, and awaits @block-job-dismiss.
1984 # When true, this job will automatically disappear from the query
1985 # list without user intervention.
1986 # Defaults to true. (Since 3.1)
1989 { 'struct': 'DriveMirror',
1990 'data': { '*job-id': 'str', 'device': 'str', 'target': 'str',
1991 '*format': 'str', '*node-name': 'str', '*replaces': 'str',
1992 'sync': 'MirrorSyncMode', '*mode': 'NewImageMode',
1993 '*speed': 'int', '*granularity': 'uint32',
1994 '*buf-size': 'int', '*on-source-error': 'BlockdevOnError',
1995 '*on-target-error': 'BlockdevOnError',
1996 '*unmap': 'bool', '*copy-mode': 'MirrorCopyMode',
1997 '*auto-finalize': 'bool', '*auto-dismiss': 'bool' } }
2000 # @BlockDirtyBitmap:
2002 # @node: name of device/node which the bitmap is tracking
2004 # @name: name of the dirty bitmap
2008 { 'struct': 'BlockDirtyBitmap',
2009 'data': { 'node': 'str', 'name': 'str' } }
2012 # @BlockDirtyBitmapAdd:
2014 # @node: name of device/node which the bitmap is tracking
2016 # @name: name of the dirty bitmap (must be less than 1024 bytes)
2018 # @granularity: the bitmap granularity, default is 64k for
2019 # block-dirty-bitmap-add
2021 # @persistent: the bitmap is persistent, i.e. it will be saved to the
2022 # corresponding block device image file on its close. For now only
2023 # Qcow2 disks support persistent bitmaps. Default is false for
2024 # block-dirty-bitmap-add. (Since: 2.10)
2026 # @disabled: the bitmap is created in the disabled state, which means that
2027 # it will not track drive changes. The bitmap may be enabled with
2028 # block-dirty-bitmap-enable. Default is false. (Since: 4.0)
2032 { 'struct': 'BlockDirtyBitmapAdd',
2033 'data': { 'node': 'str', 'name': 'str', '*granularity': 'uint32',
2034 '*persistent': 'bool', '*disabled': 'bool' } }
2037 # @BlockDirtyBitmapMergeSource:
2039 # @local: name of the bitmap, attached to the same node as target bitmap.
2041 # @external: bitmap with specified node
2045 { 'alternate': 'BlockDirtyBitmapMergeSource',
2046 'data': { 'local': 'str',
2047 'external': 'BlockDirtyBitmap' } }
2050 # @BlockDirtyBitmapMerge:
2052 # @node: name of device/node which the @target bitmap is tracking
2054 # @target: name of the destination dirty bitmap
2056 # @bitmaps: name(s) of the source dirty bitmap(s) at @node and/or fully
2057 # specifed BlockDirtyBitmap elements. The latter are supported
2062 { 'struct': 'BlockDirtyBitmapMerge',
2063 'data': { 'node': 'str', 'target': 'str',
2064 'bitmaps': ['BlockDirtyBitmapMergeSource'] } }
2067 # @block-dirty-bitmap-add:
2069 # Create a dirty bitmap with a name on the node, and start tracking the writes.
2071 # Returns: - nothing on success
2072 # - If @node is not a valid block device or node, DeviceNotFound
2073 # - If @name is already taken, GenericError with an explanation
2079 # -> { "execute": "block-dirty-bitmap-add",
2080 # "arguments": { "node": "drive0", "name": "bitmap0" } }
2081 # <- { "return": {} }
2084 { 'command': 'block-dirty-bitmap-add',
2085 'data': 'BlockDirtyBitmapAdd' }
2088 # @block-dirty-bitmap-remove:
2090 # Stop write tracking and remove the dirty bitmap that was created
2091 # with block-dirty-bitmap-add. If the bitmap is persistent, remove it from its
2094 # Returns: - nothing on success
2095 # - If @node is not a valid block device or node, DeviceNotFound
2096 # - If @name is not found, GenericError with an explanation
2097 # - if @name is frozen by an operation, GenericError
2103 # -> { "execute": "block-dirty-bitmap-remove",
2104 # "arguments": { "node": "drive0", "name": "bitmap0" } }
2105 # <- { "return": {} }
2108 { 'command': 'block-dirty-bitmap-remove',
2109 'data': 'BlockDirtyBitmap' }
2112 # @block-dirty-bitmap-clear:
2114 # Clear (reset) a dirty bitmap on the device, so that an incremental
2115 # backup from this point in time forward will only backup clusters
2116 # modified after this clear operation.
2118 # Returns: - nothing on success
2119 # - If @node is not a valid block device, DeviceNotFound
2120 # - If @name is not found, GenericError with an explanation
2126 # -> { "execute": "block-dirty-bitmap-clear",
2127 # "arguments": { "node": "drive0", "name": "bitmap0" } }
2128 # <- { "return": {} }
2131 { 'command': 'block-dirty-bitmap-clear',
2132 'data': 'BlockDirtyBitmap' }
2135 # @block-dirty-bitmap-enable:
2137 # Enables a dirty bitmap so that it will begin tracking disk changes.
2139 # Returns: - nothing on success
2140 # - If @node is not a valid block device, DeviceNotFound
2141 # - If @name is not found, GenericError with an explanation
2147 # -> { "execute": "block-dirty-bitmap-enable",
2148 # "arguments": { "node": "drive0", "name": "bitmap0" } }
2149 # <- { "return": {} }
2152 { 'command': 'block-dirty-bitmap-enable',
2153 'data': 'BlockDirtyBitmap' }
2156 # @block-dirty-bitmap-disable:
2158 # Disables a dirty bitmap so that it will stop tracking disk changes.
2160 # Returns: - nothing on success
2161 # - If @node is not a valid block device, DeviceNotFound
2162 # - If @name is not found, GenericError with an explanation
2168 # -> { "execute": "block-dirty-bitmap-disable",
2169 # "arguments": { "node": "drive0", "name": "bitmap0" } }
2170 # <- { "return": {} }
2173 { 'command': 'block-dirty-bitmap-disable',
2174 'data': 'BlockDirtyBitmap' }
2177 # @block-dirty-bitmap-merge:
2179 # Merge dirty bitmaps listed in @bitmaps to the @target dirty bitmap.
2180 # Dirty bitmaps in @bitmaps will be unchanged, except if it also appears
2181 # as the @target bitmap. Any bits already set in @target will still be
2182 # set after the merge, i.e., this operation does not clear the target.
2183 # On error, @target is unchanged.
2185 # The resulting bitmap will count as dirty any clusters that were dirty in any
2186 # of the source bitmaps. This can be used to achieve backup checkpoints, or in
2187 # simpler usages, to copy bitmaps.
2189 # Returns: - nothing on success
2190 # - If @node is not a valid block device, DeviceNotFound
2191 # - If any bitmap in @bitmaps or @target is not found, GenericError
2192 # - If any of the bitmaps have different sizes or granularities,
2199 # -> { "execute": "block-dirty-bitmap-merge",
2200 # "arguments": { "node": "drive0", "target": "bitmap0",
2201 # "bitmaps": ["bitmap1"] } }
2202 # <- { "return": {} }
2205 { 'command': 'block-dirty-bitmap-merge',
2206 'data': 'BlockDirtyBitmapMerge' }
2209 # @BlockDirtyBitmapSha256:
2211 # SHA256 hash of dirty bitmap data
2213 # @sha256: ASCII representation of SHA256 bitmap hash
2217 { 'struct': 'BlockDirtyBitmapSha256',
2218 'data': {'sha256': 'str'} }
2221 # @x-debug-block-dirty-bitmap-sha256:
2223 # Get bitmap SHA256.
2225 # Returns: - BlockDirtyBitmapSha256 on success
2226 # - If @node is not a valid block device, DeviceNotFound
2227 # - If @name is not found or if hashing has failed, GenericError with an
2232 { 'command': 'x-debug-block-dirty-bitmap-sha256',
2233 'data': 'BlockDirtyBitmap', 'returns': 'BlockDirtyBitmapSha256' }
2238 # Start mirroring a block device's writes to a new destination.
2240 # @job-id: identifier for the newly-created block job. If
2241 # omitted, the device name will be used. (Since 2.7)
2243 # @device: The device name or node-name of a root node whose writes should be
2246 # @target: the id or node-name of the block device to mirror to. This mustn't be
2247 # attached to guest.
2249 # @replaces: with sync=full graph node name to be replaced by the new
2250 # image when a whole image copy is done. This can be used to repair
2251 # broken Quorum files.
2253 # @speed: the maximum speed, in bytes per second
2255 # @sync: what parts of the disk image should be copied to the destination
2256 # (all the disk, only the sectors allocated in the topmost image, or
2259 # @granularity: granularity of the dirty bitmap, default is 64K
2260 # if the image format doesn't have clusters, 4K if the clusters
2261 # are smaller than that, else the cluster size. Must be a
2262 # power of 2 between 512 and 64M
2264 # @buf-size: maximum amount of data in flight from source to
2267 # @on-source-error: the action to take on an error on the source,
2268 # default 'report'. 'stop' and 'enospc' can only be used
2269 # if the block device supports io-status (see BlockInfo).
2271 # @on-target-error: the action to take on an error on the target,
2272 # default 'report' (no limitations, since this applies to
2273 # a different block device than @device).
2275 # @filter-node-name: the node name that should be assigned to the
2276 # filter driver that the mirror job inserts into the graph
2277 # above @device. If this option is not given, a node name is
2278 # autogenerated. (Since: 2.9)
2280 # @copy-mode: when to copy data to the destination; defaults to 'background'
2283 # @auto-finalize: When false, this job will wait in a PENDING state after it has
2284 # finished its work, waiting for @block-job-finalize before
2285 # making any block graph changes.
2286 # When true, this job will automatically
2287 # perform its abort or commit actions.
2288 # Defaults to true. (Since 3.1)
2290 # @auto-dismiss: When false, this job will wait in a CONCLUDED state after it
2291 # has completely ceased all work, and awaits @block-job-dismiss.
2292 # When true, this job will automatically disappear from the query
2293 # list without user intervention.
2294 # Defaults to true. (Since 3.1)
2295 # Returns: nothing on success.
2301 # -> { "execute": "blockdev-mirror",
2302 # "arguments": { "device": "ide-hd0",
2303 # "target": "target0",
2304 # "sync": "full" } }
2305 # <- { "return": {} }
2308 { 'command': 'blockdev-mirror',
2309 'data': { '*job-id': 'str', 'device': 'str', 'target': 'str',
2311 'sync': 'MirrorSyncMode',
2312 '*speed': 'int', '*granularity': 'uint32',
2313 '*buf-size': 'int', '*on-source-error': 'BlockdevOnError',
2314 '*on-target-error': 'BlockdevOnError',
2315 '*filter-node-name': 'str',
2316 '*copy-mode': 'MirrorCopyMode',
2317 '*auto-finalize': 'bool', '*auto-dismiss': 'bool' } }
2322 # A set of parameters describing block throttling.
2324 # @device: Block device name
2326 # @id: The name or QOM path of the guest device (since: 2.8)
2328 # @bps: total throughput limit in bytes per second
2330 # @bps_rd: read throughput limit in bytes per second
2332 # @bps_wr: write throughput limit in bytes per second
2334 # @iops: total I/O operations per second
2336 # @iops_rd: read I/O operations per second
2338 # @iops_wr: write I/O operations per second
2340 # @bps_max: total throughput limit during bursts,
2341 # in bytes (Since 1.7)
2343 # @bps_rd_max: read throughput limit during bursts,
2344 # in bytes (Since 1.7)
2346 # @bps_wr_max: write throughput limit during bursts,
2347 # in bytes (Since 1.7)
2349 # @iops_max: total I/O operations per second during bursts,
2350 # in bytes (Since 1.7)
2352 # @iops_rd_max: read I/O operations per second during bursts,
2353 # in bytes (Since 1.7)
2355 # @iops_wr_max: write I/O operations per second during bursts,
2356 # in bytes (Since 1.7)
2358 # @bps_max_length: maximum length of the @bps_max burst
2359 # period, in seconds. It must only
2360 # be set if @bps_max is set as well.
2361 # Defaults to 1. (Since 2.6)
2363 # @bps_rd_max_length: maximum length of the @bps_rd_max
2364 # burst period, in seconds. It must only
2365 # be set if @bps_rd_max is set as well.
2366 # Defaults to 1. (Since 2.6)
2368 # @bps_wr_max_length: maximum length of the @bps_wr_max
2369 # burst period, in seconds. It must only
2370 # be set if @bps_wr_max is set as well.
2371 # Defaults to 1. (Since 2.6)
2373 # @iops_max_length: maximum length of the @iops burst
2374 # period, in seconds. It must only
2375 # be set if @iops_max is set as well.
2376 # Defaults to 1. (Since 2.6)
2378 # @iops_rd_max_length: maximum length of the @iops_rd_max
2379 # burst period, in seconds. It must only
2380 # be set if @iops_rd_max is set as well.
2381 # Defaults to 1. (Since 2.6)
2383 # @iops_wr_max_length: maximum length of the @iops_wr_max
2384 # burst period, in seconds. It must only
2385 # be set if @iops_wr_max is set as well.
2386 # Defaults to 1. (Since 2.6)
2388 # @iops_size: an I/O size in bytes (Since 1.7)
2390 # @group: throttle group name (Since 2.4)
2393 # @deprecated: Member @device is deprecated. Use @id instead.
2397 { 'struct': 'BlockIOThrottle',
2398 'data': { '*device': { 'type': 'str', 'features': [ 'deprecated' ] },
2399 '*id': 'str', 'bps': 'int', 'bps_rd': 'int',
2400 'bps_wr': 'int', 'iops': 'int', 'iops_rd': 'int', 'iops_wr': 'int',
2401 '*bps_max': 'int', '*bps_rd_max': 'int',
2402 '*bps_wr_max': 'int', '*iops_max': 'int',
2403 '*iops_rd_max': 'int', '*iops_wr_max': 'int',
2404 '*bps_max_length': 'int', '*bps_rd_max_length': 'int',
2405 '*bps_wr_max_length': 'int', '*iops_max_length': 'int',
2406 '*iops_rd_max_length': 'int', '*iops_wr_max_length': 'int',
2407 '*iops_size': 'int', '*group': 'str' } }
2412 # Limit parameters for throttling.
2413 # Since some limit combinations are illegal, limits should always be set in one
2414 # transaction. All fields are optional. When setting limits, if a field is
2415 # missing the current value is not changed.
2417 # @iops-total: limit total I/O operations per second
2418 # @iops-total-max: I/O operations burst
2419 # @iops-total-max-length: length of the iops-total-max burst period, in seconds
2420 # It must only be set if @iops-total-max is set as well.
2421 # @iops-read: limit read operations per second
2422 # @iops-read-max: I/O operations read burst
2423 # @iops-read-max-length: length of the iops-read-max burst period, in seconds
2424 # It must only be set if @iops-read-max is set as well.
2425 # @iops-write: limit write operations per second
2426 # @iops-write-max: I/O operations write burst
2427 # @iops-write-max-length: length of the iops-write-max burst period, in seconds
2428 # It must only be set if @iops-write-max is set as well.
2429 # @bps-total: limit total bytes per second
2430 # @bps-total-max: total bytes burst
2431 # @bps-total-max-length: length of the bps-total-max burst period, in seconds.
2432 # It must only be set if @bps-total-max is set as well.
2433 # @bps-read: limit read bytes per second
2434 # @bps-read-max: total bytes read burst
2435 # @bps-read-max-length: length of the bps-read-max burst period, in seconds
2436 # It must only be set if @bps-read-max is set as well.
2437 # @bps-write: limit write bytes per second
2438 # @bps-write-max: total bytes write burst
2439 # @bps-write-max-length: length of the bps-write-max burst period, in seconds
2440 # It must only be set if @bps-write-max is set as well.
2441 # @iops-size: when limiting by iops max size of an I/O in bytes
2445 { 'struct': 'ThrottleLimits',
2446 'data': { '*iops-total' : 'int', '*iops-total-max' : 'int',
2447 '*iops-total-max-length' : 'int', '*iops-read' : 'int',
2448 '*iops-read-max' : 'int', '*iops-read-max-length' : 'int',
2449 '*iops-write' : 'int', '*iops-write-max' : 'int',
2450 '*iops-write-max-length' : 'int', '*bps-total' : 'int',
2451 '*bps-total-max' : 'int', '*bps-total-max-length' : 'int',
2452 '*bps-read' : 'int', '*bps-read-max' : 'int',
2453 '*bps-read-max-length' : 'int', '*bps-write' : 'int',
2454 '*bps-write-max' : 'int', '*bps-write-max-length' : 'int',
2455 '*iops-size' : 'int' } }
2460 # Copy data from a backing file into a block device.
2462 # The block streaming operation is performed in the background until the entire
2463 # backing file has been copied. This command returns immediately once streaming
2464 # has started. The status of ongoing block streaming operations can be checked
2465 # with query-block-jobs. The operation can be stopped before it has completed
2466 # using the block-job-cancel command.
2468 # The node that receives the data is called the top image, can be located in
2469 # any part of the chain (but always above the base image; see below) and can be
2470 # specified using its device or node name. Earlier qemu versions only allowed
2471 # 'device' to name the top level node; presence of the 'base-node' parameter
2472 # during introspection can be used as a witness of the enhanced semantics
2475 # If a base file is specified then sectors are not copied from that base file and
2476 # its backing chain. When streaming completes the image file will have the base
2477 # file as its backing file. This can be used to stream a subset of the backing
2478 # file chain instead of flattening the entire image.
2480 # On successful completion the image file is updated to drop the backing file
2481 # and the BLOCK_JOB_COMPLETED event is emitted.
2483 # @job-id: identifier for the newly-created block job. If
2484 # omitted, the device name will be used. (Since 2.7)
2486 # @device: the device or node name of the top image
2488 # @base: the common backing file name.
2489 # It cannot be set if @base-node is also set.
2491 # @base-node: the node name of the backing file.
2492 # It cannot be set if @base is also set. (Since 2.8)
2494 # @backing-file: The backing file string to write into the top
2495 # image. This filename is not validated.
2497 # If a pathname string is such that it cannot be
2498 # resolved by QEMU, that means that subsequent QMP or
2499 # HMP commands must use node-names for the image in
2500 # question, as filename lookup methods will fail.
2502 # If not specified, QEMU will automatically determine
2503 # the backing file string to use, or error out if there
2504 # is no obvious choice. Care should be taken when
2505 # specifying the string, to specify a valid filename or
2509 # @speed: the maximum speed, in bytes per second
2511 # @on-error: the action to take on an error (default report).
2512 # 'stop' and 'enospc' can only be used if the block device
2513 # supports io-status (see BlockInfo). Since 1.3.
2515 # @auto-finalize: When false, this job will wait in a PENDING state after it has
2516 # finished its work, waiting for @block-job-finalize before
2517 # making any block graph changes.
2518 # When true, this job will automatically
2519 # perform its abort or commit actions.
2520 # Defaults to true. (Since 3.1)
2522 # @auto-dismiss: When false, this job will wait in a CONCLUDED state after it
2523 # has completely ceased all work, and awaits @block-job-dismiss.
2524 # When true, this job will automatically disappear from the query
2525 # list without user intervention.
2526 # Defaults to true. (Since 3.1)
2528 # Returns: - Nothing on success.
2529 # - If @device does not exist, DeviceNotFound.
2535 # -> { "execute": "block-stream",
2536 # "arguments": { "device": "virtio0",
2537 # "base": "/tmp/master.qcow2" } }
2538 # <- { "return": {} }
2541 { 'command': 'block-stream',
2542 'data': { '*job-id': 'str', 'device': 'str', '*base': 'str',
2543 '*base-node': 'str', '*backing-file': 'str', '*speed': 'int',
2544 '*on-error': 'BlockdevOnError',
2545 '*auto-finalize': 'bool', '*auto-dismiss': 'bool' } }
2548 # @block-job-set-speed:
2550 # Set maximum speed for a background block operation.
2552 # This command can only be issued when there is an active block job.
2554 # Throttling can be disabled by setting the speed to 0.
2556 # @device: The job identifier. This used to be a device name (hence
2557 # the name of the parameter), but since QEMU 2.7 it can have
2560 # @speed: the maximum speed, in bytes per second, or 0 for unlimited.
2563 # Returns: - Nothing on success
2564 # - If no background operation is active on this device, DeviceNotActive
2568 { 'command': 'block-job-set-speed',
2569 'data': { 'device': 'str', 'speed': 'int' } }
2572 # @block-job-cancel:
2574 # Stop an active background block operation.
2576 # This command returns immediately after marking the active background block
2577 # operation for cancellation. It is an error to call this command if no
2578 # operation is in progress.
2580 # The operation will cancel as soon as possible and then emit the
2581 # BLOCK_JOB_CANCELLED event. Before that happens the job is still visible when
2582 # enumerated using query-block-jobs.
2584 # Note that if you issue 'block-job-cancel' after 'drive-mirror' has indicated
2585 # (via the event BLOCK_JOB_READY) that the source and destination are
2586 # synchronized, then the event triggered by this command changes to
2587 # BLOCK_JOB_COMPLETED, to indicate that the mirroring has ended and the
2588 # destination now has a point-in-time copy tied to the time of the cancellation.
2590 # For streaming, the image file retains its backing file unless the streaming
2591 # operation happens to complete just as it is being cancelled. A new streaming
2592 # operation can be started at a later time to finish copying all data from the
2595 # @device: The job identifier. This used to be a device name (hence
2596 # the name of the parameter), but since QEMU 2.7 it can have
2599 # @force: If true, and the job has already emitted the event BLOCK_JOB_READY,
2600 # abandon the job immediately (even if it is paused) instead of waiting
2601 # for the destination to complete its final synchronization (since 1.3)
2603 # Returns: - Nothing on success
2604 # - If no background operation is active on this device, DeviceNotActive
2608 { 'command': 'block-job-cancel', 'data': { 'device': 'str', '*force': 'bool' } }
2613 # Pause an active background block operation.
2615 # This command returns immediately after marking the active background block
2616 # operation for pausing. It is an error to call this command if no
2617 # operation is in progress or if the job is already paused.
2619 # The operation will pause as soon as possible. No event is emitted when
2620 # the operation is actually paused. Cancelling a paused job automatically
2623 # @device: The job identifier. This used to be a device name (hence
2624 # the name of the parameter), but since QEMU 2.7 it can have
2627 # Returns: - Nothing on success
2628 # - If no background operation is active on this device, DeviceNotActive
2632 { 'command': 'block-job-pause', 'data': { 'device': 'str' } }
2635 # @block-job-resume:
2637 # Resume an active background block operation.
2639 # This command returns immediately after resuming a paused background block
2640 # operation. It is an error to call this command if no operation is in
2641 # progress or if the job is not paused.
2643 # This command also clears the error status of the job.
2645 # @device: The job identifier. This used to be a device name (hence
2646 # the name of the parameter), but since QEMU 2.7 it can have
2649 # Returns: - Nothing on success
2650 # - If no background operation is active on this device, DeviceNotActive
2654 { 'command': 'block-job-resume', 'data': { 'device': 'str' } }
2657 # @block-job-complete:
2659 # Manually trigger completion of an active background block operation. This
2660 # is supported for drive mirroring, where it also switches the device to
2661 # write to the target path only. The ability to complete is signaled with
2662 # a BLOCK_JOB_READY event.
2664 # This command completes an active background block operation synchronously.
2665 # The ordering of this command's return with the BLOCK_JOB_COMPLETED event
2666 # is not defined. Note that if an I/O error occurs during the processing of
2667 # this command: 1) the command itself will fail; 2) the error will be processed
2668 # according to the rerror/werror arguments that were specified when starting
2671 # A cancelled or paused job cannot be completed.
2673 # @device: The job identifier. This used to be a device name (hence
2674 # the name of the parameter), but since QEMU 2.7 it can have
2677 # Returns: - Nothing on success
2678 # - If no background operation is active on this device, DeviceNotActive
2682 { 'command': 'block-job-complete', 'data': { 'device': 'str' } }
2685 # @block-job-dismiss:
2687 # For jobs that have already concluded, remove them from the block-job-query
2688 # list. This command only needs to be run for jobs which were started with
2689 # QEMU 2.12+ job lifetime management semantics.
2691 # This command will refuse to operate on any job that has not yet reached
2692 # its terminal state, JOB_STATUS_CONCLUDED. For jobs that make use of the
2693 # BLOCK_JOB_READY event, block-job-cancel or block-job-complete will still need
2694 # to be used as appropriate.
2696 # @id: The job identifier.
2698 # Returns: Nothing on success
2702 { 'command': 'block-job-dismiss', 'data': { 'id': 'str' } }
2705 # @block-job-finalize:
2707 # Once a job that has manual=true reaches the pending state, it can be
2708 # instructed to finalize any graph changes and do any necessary cleanup
2710 # For jobs in a transaction, instructing one job to finalize will force
2711 # ALL jobs in the transaction to finalize, so it is only necessary to instruct
2712 # a single member job to finalize.
2714 # @id: The job identifier.
2716 # Returns: Nothing on success
2720 { 'command': 'block-job-finalize', 'data': { 'id': 'str' } }
2723 # @BlockdevDiscardOptions:
2725 # Determines how to handle discard requests.
2727 # @ignore: Ignore the request
2728 # @unmap: Forward as an unmap request
2732 { 'enum': 'BlockdevDiscardOptions',
2733 'data': [ 'ignore', 'unmap' ] }
2736 # @BlockdevDetectZeroesOptions:
2738 # Describes the operation mode for the automatic conversion of plain
2739 # zero writes by the OS to driver specific optimized zero write commands.
2741 # @off: Disabled (default)
2743 # @unmap: Enabled and even try to unmap blocks if possible. This requires
2744 # also that @BlockdevDiscardOptions is set to unmap for this device.
2748 { 'enum': 'BlockdevDetectZeroesOptions',
2749 'data': [ 'off', 'on', 'unmap' ] }
2752 # @BlockdevAioOptions:
2754 # Selects the AIO backend to handle I/O requests
2756 # @threads: Use qemu's thread pool
2757 # @native: Use native AIO backend (only Linux and Windows)
2758 # @io_uring: Use linux io_uring (since 5.0)
2762 { 'enum': 'BlockdevAioOptions',
2763 'data': [ 'threads', 'native',
2764 { 'name': 'io_uring', 'if': 'defined(CONFIG_LINUX_IO_URING)' } ] }
2767 # @BlockdevCacheOptions:
2769 # Includes cache-related options for block devices
2771 # @direct: enables use of O_DIRECT (bypass the host page cache;
2773 # @no-flush: ignore any flush requests for the device (default:
2778 { 'struct': 'BlockdevCacheOptions',
2779 'data': { '*direct': 'bool',
2780 '*no-flush': 'bool' } }
2785 # Drivers that are supported in block device operations.
2788 # @throttle: Since 2.11
2790 # @copy-on-read: Since 3.0
2791 # @blklogwrites: Since 3.0
2792 # @blkreplay: Since 4.2
2793 # @compress: Since 5.0
2797 { 'enum': 'BlockdevDriver',
2798 'data': [ 'blkdebug', 'blklogwrites', 'blkreplay', 'blkverify', 'bochs',
2799 'cloop', 'compress', 'copy-on-read', 'dmg', 'file', 'ftp', 'ftps',
2800 'gluster', 'host_cdrom', 'host_device', 'http', 'https', 'iscsi',
2801 'luks', 'nbd', 'nfs', 'null-aio', 'null-co', 'nvme', 'parallels',
2802 'qcow', 'qcow2', 'qed', 'quorum', 'raw', 'rbd',
2803 { 'name': 'replication', 'if': 'defined(CONFIG_REPLICATION)' },
2805 'ssh', 'throttle', 'vdi', 'vhdx', 'vmdk', 'vpc', 'vvfat', 'vxhs' ] }
2808 # @BlockdevOptionsFile:
2810 # Driver specific block device options for the file backend.
2812 # @filename: path to the image file
2813 # @pr-manager: the id for the object that will handle persistent reservations
2814 # for this device (default: none, forward the commands via SG_IO;
2816 # @aio: AIO backend (default: threads) (since: 2.8)
2817 # @locking: whether to enable file locking. If set to 'auto', only enable
2818 # when Open File Descriptor (OFD) locking API is available
2819 # (default: auto, since 2.10)
2820 # @drop-cache: invalidate page cache during live migration. This prevents
2821 # stale data on the migration destination with cache.direct=off.
2822 # Currently only supported on Linux hosts.
2823 # (default: on, since: 4.0)
2824 # @x-check-cache-dropped: whether to check that page cache was dropped on live
2825 # migration. May cause noticeable delays if the image
2826 # file is large, do not use in production.
2827 # (default: off) (since: 3.0)
2830 # @dynamic-auto-read-only: If present, enabled auto-read-only means that the
2831 # driver will open the image read-only at first,
2832 # dynamically reopen the image file read-write when
2833 # the first writer is attached to the node and reopen
2834 # read-only when the last writer is detached. This
2835 # allows giving QEMU write permissions only on demand
2836 # when an operation actually needs write access.
2840 { 'struct': 'BlockdevOptionsFile',
2841 'data': { 'filename': 'str',
2842 '*pr-manager': 'str',
2843 '*locking': 'OnOffAuto',
2844 '*aio': 'BlockdevAioOptions',
2845 '*drop-cache': {'type': 'bool',
2846 'if': 'defined(CONFIG_LINUX)'},
2847 '*x-check-cache-dropped': 'bool' },
2848 'features': [ { 'name': 'dynamic-auto-read-only',
2849 'if': 'defined(CONFIG_POSIX)' } ] }
2852 # @BlockdevOptionsNull:
2854 # Driver specific block device options for the null backend.
2856 # @size: size of the device in bytes.
2857 # @latency-ns: emulated latency (in nanoseconds) in processing
2858 # requests. Default to zero which completes requests immediately.
2860 # @read-zeroes: if true, reads from the device produce zeroes; if false, the
2861 # buffer is left unchanged. (default: false; since: 4.1)
2865 { 'struct': 'BlockdevOptionsNull',
2866 'data': { '*size': 'int', '*latency-ns': 'uint64', '*read-zeroes': 'bool' } }
2869 # @BlockdevOptionsNVMe:
2871 # Driver specific block device options for the NVMe backend.
2873 # @device: PCI controller address of the NVMe device in
2874 # format hhhh:bb:ss.f (host:bus:slot.function)
2875 # @namespace: namespace number of the device, starting from 1.
2877 # Note that the PCI @device must have been unbound from any host
2878 # kernel driver before instructing QEMU to add the blockdev.
2882 { 'struct': 'BlockdevOptionsNVMe',
2883 'data': { 'device': 'str', 'namespace': 'int' } }
2886 # @BlockdevOptionsVVFAT:
2888 # Driver specific block device options for the vvfat protocol.
2890 # @dir: directory to be exported as FAT image
2891 # @fat-type: FAT type: 12, 16 or 32
2892 # @floppy: whether to export a floppy image (true) or
2893 # partitioned hard disk (false; default)
2894 # @label: set the volume label, limited to 11 bytes. FAT16 and
2895 # FAT32 traditionally have some restrictions on labels, which are
2896 # ignored by most operating systems. Defaults to "QEMU VVFAT".
2898 # @rw: whether to allow write operations (default: false)
2902 { 'struct': 'BlockdevOptionsVVFAT',
2903 'data': { 'dir': 'str', '*fat-type': 'int', '*floppy': 'bool',
2904 '*label': 'str', '*rw': 'bool' } }
2907 # @BlockdevOptionsGenericFormat:
2909 # Driver specific block device options for image format that have no option
2910 # besides their data source.
2912 # @file: reference to or definition of the data source block device
2916 { 'struct': 'BlockdevOptionsGenericFormat',
2917 'data': { 'file': 'BlockdevRef' } }
2920 # @BlockdevOptionsLUKS:
2922 # Driver specific block device options for LUKS.
2924 # @key-secret: the ID of a QCryptoSecret object providing
2925 # the decryption key (since 2.6). Mandatory except when
2926 # doing a metadata-only probe of the image.
2930 { 'struct': 'BlockdevOptionsLUKS',
2931 'base': 'BlockdevOptionsGenericFormat',
2932 'data': { '*key-secret': 'str' } }
2936 # @BlockdevOptionsGenericCOWFormat:
2938 # Driver specific block device options for image format that have no option
2939 # besides their data source and an optional backing file.
2941 # @backing: reference to or definition of the backing file block
2942 # device, null disables the backing file entirely.
2943 # Defaults to the backing file stored the image file.
2947 { 'struct': 'BlockdevOptionsGenericCOWFormat',
2948 'base': 'BlockdevOptionsGenericFormat',
2949 'data': { '*backing': 'BlockdevRefOrNull' } }
2952 # @Qcow2OverlapCheckMode:
2954 # General overlap check modes.
2956 # @none: Do not perform any checks
2958 # @constant: Perform only checks which can be done in constant time and
2959 # without reading anything from disk
2961 # @cached: Perform only checks which can be done without reading anything
2964 # @all: Perform all available overlap checks
2968 { 'enum': 'Qcow2OverlapCheckMode',
2969 'data': [ 'none', 'constant', 'cached', 'all' ] }
2972 # @Qcow2OverlapCheckFlags:
2974 # Structure of flags for each metadata structure. Setting a field to 'true'
2975 # makes qemu guard that structure against unintended overwriting. The default
2976 # value is chosen according to the template given.
2978 # @template: Specifies a template mode which can be adjusted using the other
2979 # flags, defaults to 'cached'
2981 # @bitmap-directory: since 3.0
2985 { 'struct': 'Qcow2OverlapCheckFlags',
2986 'data': { '*template': 'Qcow2OverlapCheckMode',
2987 '*main-header': 'bool',
2988 '*active-l1': 'bool',
2989 '*active-l2': 'bool',
2990 '*refcount-table': 'bool',
2991 '*refcount-block': 'bool',
2992 '*snapshot-table': 'bool',
2993 '*inactive-l1': 'bool',
2994 '*inactive-l2': 'bool',
2995 '*bitmap-directory': 'bool' } }
2998 # @Qcow2OverlapChecks:
3000 # Specifies which metadata structures should be guarded against unintended
3003 # @flags: set of flags for separate specification of each metadata structure
3006 # @mode: named mode which chooses a specific set of flags
3010 { 'alternate': 'Qcow2OverlapChecks',
3011 'data': { 'flags': 'Qcow2OverlapCheckFlags',
3012 'mode': 'Qcow2OverlapCheckMode' } }
3015 # @BlockdevQcowEncryptionFormat:
3017 # @aes: AES-CBC with plain64 initialization vectors
3021 { 'enum': 'BlockdevQcowEncryptionFormat',
3025 # @BlockdevQcowEncryption:
3029 { 'union': 'BlockdevQcowEncryption',
3030 'base': { 'format': 'BlockdevQcowEncryptionFormat' },
3031 'discriminator': 'format',
3032 'data': { 'aes': 'QCryptoBlockOptionsQCow' } }
3035 # @BlockdevOptionsQcow:
3037 # Driver specific block device options for qcow.
3039 # @encrypt: Image decryption options. Mandatory for
3040 # encrypted images, except when doing a metadata-only
3041 # probe of the image.
3045 { 'struct': 'BlockdevOptionsQcow',
3046 'base': 'BlockdevOptionsGenericCOWFormat',
3047 'data': { '*encrypt': 'BlockdevQcowEncryption' } }
3052 # @BlockdevQcow2EncryptionFormat:
3053 # @aes: AES-CBC with plain64 initialization vectors
3057 { 'enum': 'BlockdevQcow2EncryptionFormat',
3058 'data': [ 'aes', 'luks' ] }
3061 # @BlockdevQcow2Encryption:
3065 { 'union': 'BlockdevQcow2Encryption',
3066 'base': { 'format': 'BlockdevQcow2EncryptionFormat' },
3067 'discriminator': 'format',
3068 'data': { 'aes': 'QCryptoBlockOptionsQCow',
3069 'luks': 'QCryptoBlockOptionsLUKS'} }
3072 # @BlockdevOptionsQcow2:
3074 # Driver specific block device options for qcow2.
3076 # @lazy-refcounts: whether to enable the lazy refcounts
3077 # feature (default is taken from the image file)
3079 # @pass-discard-request: whether discard requests to the qcow2
3080 # device should be forwarded to the data source
3082 # @pass-discard-snapshot: whether discard requests for the data source
3083 # should be issued when a snapshot operation (e.g.
3084 # deleting a snapshot) frees clusters in the qcow2 file
3086 # @pass-discard-other: whether discard requests for the data source
3087 # should be issued on other occasions where a cluster
3090 # @overlap-check: which overlap checks to perform for writes
3091 # to the image, defaults to 'cached' (since 2.2)
3093 # @cache-size: the maximum total size of the L2 table and
3094 # refcount block caches in bytes (since 2.2)
3096 # @l2-cache-size: the maximum size of the L2 table cache in
3099 # @l2-cache-entry-size: the size of each entry in the L2 cache in
3100 # bytes. It must be a power of two between 512
3101 # and the cluster size. The default value is
3102 # the cluster size (since 2.12)
3104 # @refcount-cache-size: the maximum size of the refcount block cache
3105 # in bytes (since 2.2)
3107 # @cache-clean-interval: clean unused entries in the L2 and refcount
3108 # caches. The interval is in seconds. The default value
3109 # is 600 on supporting platforms, and 0 on other
3110 # platforms. 0 disables this feature. (since 2.5)
3112 # @encrypt: Image decryption options. Mandatory for
3113 # encrypted images, except when doing a metadata-only
3114 # probe of the image. (since 2.10)
3116 # @data-file: reference to or definition of the external data file.
3117 # This may only be specified for images that require an
3118 # external data file. If it is not specified for such
3119 # an image, the data file name is loaded from the image
3124 { 'struct': 'BlockdevOptionsQcow2',
3125 'base': 'BlockdevOptionsGenericCOWFormat',
3126 'data': { '*lazy-refcounts': 'bool',
3127 '*pass-discard-request': 'bool',
3128 '*pass-discard-snapshot': 'bool',
3129 '*pass-discard-other': 'bool',
3130 '*overlap-check': 'Qcow2OverlapChecks',
3131 '*cache-size': 'int',
3132 '*l2-cache-size': 'int',
3133 '*l2-cache-entry-size': 'int',
3134 '*refcount-cache-size': 'int',
3135 '*cache-clean-interval': 'int',
3136 '*encrypt': 'BlockdevQcow2Encryption',
3137 '*data-file': 'BlockdevRef' } }
3140 # @SshHostKeyCheckMode:
3142 # @none: Don't check the host key at all
3143 # @hash: Compare the host key with a given hash
3144 # @known_hosts: Check the host key against the known_hosts file
3148 { 'enum': 'SshHostKeyCheckMode',
3149 'data': [ 'none', 'hash', 'known_hosts' ] }
3152 # @SshHostKeyCheckHashType:
3154 # @md5: The given hash is an md5 hash
3155 # @sha1: The given hash is an sha1 hash
3159 { 'enum': 'SshHostKeyCheckHashType',
3160 'data': [ 'md5', 'sha1' ] }
3165 # @type: The hash algorithm used for the hash
3166 # @hash: The expected hash value
3170 { 'struct': 'SshHostKeyHash',
3171 'data': { 'type': 'SshHostKeyCheckHashType',
3179 { 'union': 'SshHostKeyCheck',
3180 'base': { 'mode': 'SshHostKeyCheckMode' },
3181 'discriminator': 'mode',
3182 'data': { 'hash': 'SshHostKeyHash' } }
3185 # @BlockdevOptionsSsh:
3187 # @server: host address
3189 # @path: path to the image on the host
3191 # @user: user as which to connect, defaults to current
3194 # @host-key-check: Defines how and what to check the host key against
3195 # (default: known_hosts)
3199 { 'struct': 'BlockdevOptionsSsh',
3200 'data': { 'server': 'InetSocketAddress',
3203 '*host-key-check': 'SshHostKeyCheck' } }
3209 # Trigger events supported by blkdebug.
3211 # @l1_shrink_write_table: write zeros to the l1 table to shrink image.
3214 # @l1_shrink_free_l2_clusters: discard the l2 tables. (since 2.11)
3216 # @cor_write: a write due to copy-on-read (since 2.11)
3218 # @cluster_alloc_space: an allocation of file space for a cluster (since 4.1)
3220 # @none: triggers once at creation of the blkdebug node (since 4.1)
3224 { 'enum': 'BlkdebugEvent', 'prefix': 'BLKDBG',
3225 'data': [ 'l1_update', 'l1_grow_alloc_table', 'l1_grow_write_table',
3226 'l1_grow_activate_table', 'l2_load', 'l2_update',
3227 'l2_update_compressed', 'l2_alloc_cow_read', 'l2_alloc_write',
3228 'read_aio', 'read_backing_aio', 'read_compressed', 'write_aio',
3229 'write_compressed', 'vmstate_load', 'vmstate_save', 'cow_read',
3230 'cow_write', 'reftable_load', 'reftable_grow', 'reftable_update',
3231 'refblock_load', 'refblock_update', 'refblock_update_part',
3232 'refblock_alloc', 'refblock_alloc_hookup', 'refblock_alloc_write',
3233 'refblock_alloc_write_blocks', 'refblock_alloc_write_table',
3234 'refblock_alloc_switch_table', 'cluster_alloc',
3235 'cluster_alloc_bytes', 'cluster_free', 'flush_to_os',
3236 'flush_to_disk', 'pwritev_rmw_head', 'pwritev_rmw_after_head',
3237 'pwritev_rmw_tail', 'pwritev_rmw_after_tail', 'pwritev',
3238 'pwritev_zero', 'pwritev_done', 'empty_image_prepare',
3239 'l1_shrink_write_table', 'l1_shrink_free_l2_clusters',
3240 'cor_write', 'cluster_alloc_space', 'none'] }
3245 # Kinds of I/O that blkdebug can inject errors in.
3247 # @read: .bdrv_co_preadv()
3249 # @write: .bdrv_co_pwritev()
3251 # @write-zeroes: .bdrv_co_pwrite_zeroes()
3253 # @discard: .bdrv_co_pdiscard()
3255 # @flush: .bdrv_co_flush_to_disk()
3257 # @block-status: .bdrv_co_block_status()
3261 { 'enum': 'BlkdebugIOType', 'prefix': 'BLKDEBUG_IO_TYPE',
3262 'data': [ 'read', 'write', 'write-zeroes', 'discard', 'flush',
3266 # @BlkdebugInjectErrorOptions:
3268 # Describes a single error injection for blkdebug.
3270 # @event: trigger event
3272 # @state: the state identifier blkdebug needs to be in to
3273 # actually trigger the event; defaults to "any"
3275 # @iotype: the type of I/O operations on which this error should
3276 # be injected; defaults to "all read, write,
3277 # write-zeroes, discard, and flush operations"
3280 # @errno: error identifier (errno) to be returned; defaults to
3283 # @sector: specifies the sector index which has to be affected
3284 # in order to actually trigger the event; defaults to "any
3287 # @once: disables further events after this one has been
3288 # triggered; defaults to false
3290 # @immediately: fail immediately; defaults to false
3294 { 'struct': 'BlkdebugInjectErrorOptions',
3295 'data': { 'event': 'BlkdebugEvent',
3297 '*iotype': 'BlkdebugIOType',
3301 '*immediately': 'bool' } }
3304 # @BlkdebugSetStateOptions:
3306 # Describes a single state-change event for blkdebug.
3308 # @event: trigger event
3310 # @state: the current state identifier blkdebug needs to be in;
3313 # @new_state: the state identifier blkdebug is supposed to assume if
3314 # this event is triggered
3318 { 'struct': 'BlkdebugSetStateOptions',
3319 'data': { 'event': 'BlkdebugEvent',
3321 'new_state': 'int' } }
3324 # @BlockdevOptionsBlkdebug:
3326 # Driver specific block device options for blkdebug.
3328 # @image: underlying raw block device (or image file)
3330 # @config: filename of the configuration file
3332 # @align: required alignment for requests in bytes, must be
3333 # positive power of 2, or 0 for default
3335 # @max-transfer: maximum size for I/O transfers in bytes, must be
3336 # positive multiple of @align and of the underlying
3337 # file's request alignment (but need not be a power of
3338 # 2), or 0 for default (since 2.10)
3340 # @opt-write-zero: preferred alignment for write zero requests in bytes,
3341 # must be positive multiple of @align and of the
3342 # underlying file's request alignment (but need not be a
3343 # power of 2), or 0 for default (since 2.10)
3345 # @max-write-zero: maximum size for write zero requests in bytes, must be
3346 # positive multiple of @align, of @opt-write-zero, and of
3347 # the underlying file's request alignment (but need not
3348 # be a power of 2), or 0 for default (since 2.10)
3350 # @opt-discard: preferred alignment for discard requests in bytes, must
3351 # be positive multiple of @align and of the underlying
3352 # file's request alignment (but need not be a power of
3353 # 2), or 0 for default (since 2.10)
3355 # @max-discard: maximum size for discard requests in bytes, must be
3356 # positive multiple of @align, of @opt-discard, and of
3357 # the underlying file's request alignment (but need not
3358 # be a power of 2), or 0 for default (since 2.10)
3360 # @inject-error: array of error injection descriptions
3362 # @set-state: array of state-change descriptions
3364 # @take-child-perms: Permissions to take on @image in addition to what
3365 # is necessary anyway (which depends on how the
3366 # blkdebug node is used). Defaults to none.
3369 # @unshare-child-perms: Permissions not to share on @image in addition
3370 # to what cannot be shared anyway (which depends
3371 # on how the blkdebug node is used). Defaults
3372 # to none. (since 5.0)
3376 { 'struct': 'BlockdevOptionsBlkdebug',
3377 'data': { 'image': 'BlockdevRef',
3379 '*align': 'int', '*max-transfer': 'int32',
3380 '*opt-write-zero': 'int32', '*max-write-zero': 'int32',
3381 '*opt-discard': 'int32', '*max-discard': 'int32',
3382 '*inject-error': ['BlkdebugInjectErrorOptions'],
3383 '*set-state': ['BlkdebugSetStateOptions'],
3384 '*take-child-perms': ['BlockPermission'],
3385 '*unshare-child-perms': ['BlockPermission'] } }
3388 # @BlockdevOptionsBlklogwrites:
3390 # Driver specific block device options for blklogwrites.
3392 # @file: block device
3394 # @log: block device used to log writes to @file
3396 # @log-sector-size: sector size used in logging writes to @file, determines
3397 # granularity of offsets and sizes of writes (default: 512)
3399 # @log-append: append to an existing log (default: false)
3401 # @log-super-update-interval: interval of write requests after which the log
3402 # super block is updated to disk (default: 4096)
3406 { 'struct': 'BlockdevOptionsBlklogwrites',
3407 'data': { 'file': 'BlockdevRef',
3408 'log': 'BlockdevRef',
3409 '*log-sector-size': 'uint32',
3410 '*log-append': 'bool',
3411 '*log-super-update-interval': 'uint64' } }
3414 # @BlockdevOptionsBlkverify:
3416 # Driver specific block device options for blkverify.
3418 # @test: block device to be tested
3420 # @raw: raw image used for verification
3424 { 'struct': 'BlockdevOptionsBlkverify',
3425 'data': { 'test': 'BlockdevRef',
3426 'raw': 'BlockdevRef' } }
3429 # @BlockdevOptionsBlkreplay:
3431 # Driver specific block device options for blkreplay.
3433 # @image: disk image which should be controlled with blkreplay
3437 { 'struct': 'BlockdevOptionsBlkreplay',
3438 'data': { 'image': 'BlockdevRef' } }
3441 # @QuorumReadPattern:
3443 # An enumeration of quorum read patterns.
3445 # @quorum: read all the children and do a quorum vote on reads
3447 # @fifo: read only from the first child that has not failed
3451 { 'enum': 'QuorumReadPattern', 'data': [ 'quorum', 'fifo' ] }
3454 # @BlockdevOptionsQuorum:
3456 # Driver specific block device options for Quorum
3458 # @blkverify: true if the driver must print content mismatch
3459 # set to false by default
3461 # @children: the children block devices to use
3463 # @vote-threshold: the vote limit under which a read will fail
3465 # @rewrite-corrupted: rewrite corrupted data when quorum is reached
3468 # @read-pattern: choose read pattern and set to quorum by default
3473 { 'struct': 'BlockdevOptionsQuorum',
3474 'data': { '*blkverify': 'bool',
3475 'children': [ 'BlockdevRef' ],
3476 'vote-threshold': 'int',
3477 '*rewrite-corrupted': 'bool',
3478 '*read-pattern': 'QuorumReadPattern' } }
3481 # @BlockdevOptionsGluster:
3483 # Driver specific block device options for Gluster
3485 # @volume: name of gluster volume where VM image resides
3487 # @path: absolute path to image file in gluster volume
3489 # @server: gluster servers description
3491 # @debug: libgfapi log level (default '4' which is Error)
3494 # @logfile: libgfapi log file (default /dev/stderr) (Since 2.8)
3498 { 'struct': 'BlockdevOptionsGluster',
3499 'data': { 'volume': 'str',
3501 'server': ['SocketAddress'],
3503 '*logfile': 'str' } }
3508 # An enumeration of libiscsi transport types
3512 { 'enum': 'IscsiTransport',
3513 'data': [ 'tcp', 'iser' ] }
3516 # @IscsiHeaderDigest:
3518 # An enumeration of header digests supported by libiscsi
3522 { 'enum': 'IscsiHeaderDigest',
3523 'prefix': 'QAPI_ISCSI_HEADER_DIGEST',
3524 'data': [ 'crc32c', 'none', 'crc32c-none', 'none-crc32c' ] }
3527 # @BlockdevOptionsIscsi:
3529 # @transport: The iscsi transport type
3531 # @portal: The address of the iscsi portal
3533 # @target: The target iqn name
3535 # @lun: LUN to connect to. Defaults to 0.
3537 # @user: User name to log in with. If omitted, no CHAP
3538 # authentication is performed.
3540 # @password-secret: The ID of a QCryptoSecret object providing
3541 # the password for the login. This option is required if
3542 # @user is specified.
3544 # @initiator-name: The iqn name we want to identify to the target
3545 # as. If this option is not specified, an initiator name is
3546 # generated automatically.
3548 # @header-digest: The desired header digest. Defaults to
3551 # @timeout: Timeout in seconds after which a request will
3552 # timeout. 0 means no timeout and is the default.
3554 # Driver specific block device options for iscsi
3558 { 'struct': 'BlockdevOptionsIscsi',
3559 'data': { 'transport': 'IscsiTransport',
3564 '*password-secret': 'str',
3565 '*initiator-name': 'str',
3566 '*header-digest': 'IscsiHeaderDigest',
3567 '*timeout': 'int' } }
3575 { 'enum': 'RbdAuthMode',
3576 'data': [ 'cephx', 'none' ] }
3579 # @BlockdevOptionsRbd:
3581 # @pool: Ceph pool name.
3583 # @namespace: Rados namespace name in the Ceph pool. (Since 5.0)
3585 # @image: Image name in the Ceph pool.
3587 # @conf: path to Ceph configuration file. Values
3588 # in the configuration file will be overridden by
3589 # options specified via QAPI.
3591 # @snapshot: Ceph snapshot name.
3593 # @user: Ceph id name.
3595 # @auth-client-required: Acceptable authentication modes.
3596 # This maps to Ceph configuration option
3597 # "auth_client_required". (Since 3.0)
3599 # @key-secret: ID of a QCryptoSecret object providing a key
3600 # for cephx authentication.
3601 # This maps to Ceph configuration option
3602 # "key". (Since 3.0)
3604 # @server: Monitor host address and port. This maps
3605 # to the "mon_host" Ceph option.
3609 { 'struct': 'BlockdevOptionsRbd',
3610 'data': { 'pool': 'str',
3611 '*namespace': 'str',
3616 '*auth-client-required': ['RbdAuthMode'],
3617 '*key-secret': 'str',
3618 '*server': ['InetSocketAddressBase'] } }
3621 # @BlockdevOptionsSheepdog:
3623 # Driver specific block device options for sheepdog
3625 # @vdi: Virtual disk image name
3626 # @server: The Sheepdog server to connect to
3627 # @snap-id: Snapshot ID
3628 # @tag: Snapshot tag name
3630 # Only one of @snap-id and @tag may be present.
3634 { 'struct': 'BlockdevOptionsSheepdog',
3635 'data': { 'server': 'SocketAddress',
3637 '*snap-id': 'uint32',
3643 # An enumeration of replication modes.
3645 # @primary: Primary mode, the vm's state will be sent to secondary QEMU.
3647 # @secondary: Secondary mode, receive the vm's state from primary QEMU.
3651 { 'enum' : 'ReplicationMode', 'data' : [ 'primary', 'secondary' ],
3652 'if': 'defined(CONFIG_REPLICATION)' }
3655 # @BlockdevOptionsReplication:
3657 # Driver specific block device options for replication
3659 # @mode: the replication mode
3661 # @top-id: In secondary mode, node name or device ID of the root
3662 # node who owns the replication node chain. Must not be given in
3667 { 'struct': 'BlockdevOptionsReplication',
3668 'base': 'BlockdevOptionsGenericFormat',
3669 'data': { 'mode': 'ReplicationMode',
3671 'if': 'defined(CONFIG_REPLICATION)' }
3676 # An enumeration of NFS transport types
3678 # @inet: TCP transport
3682 { 'enum': 'NFSTransport',
3683 'data': [ 'inet' ] }
3688 # Captures the address of the socket
3690 # @type: transport type used for NFS (only TCP supported)
3692 # @host: host address for NFS server
3696 { 'struct': 'NFSServer',
3697 'data': { 'type': 'NFSTransport',
3701 # @BlockdevOptionsNfs:
3703 # Driver specific block device option for NFS
3705 # @server: host address
3707 # @path: path of the image on the host
3709 # @user: UID value to use when talking to the
3710 # server (defaults to 65534 on Windows and getuid()
3713 # @group: GID value to use when talking to the
3714 # server (defaults to 65534 on Windows and getgid()
3717 # @tcp-syn-count: number of SYNs during the session
3718 # establishment (defaults to libnfs default)
3720 # @readahead-size: set the readahead size in bytes (defaults
3721 # to libnfs default)
3723 # @page-cache-size: set the pagecache size in bytes (defaults
3724 # to libnfs default)
3726 # @debug: set the NFS debug level (max 2) (defaults
3727 # to libnfs default)
3731 { 'struct': 'BlockdevOptionsNfs',
3732 'data': { 'server': 'NFSServer',
3736 '*tcp-syn-count': 'int',
3737 '*readahead-size': 'int',
3738 '*page-cache-size': 'int',
3742 # @BlockdevOptionsCurlBase:
3744 # Driver specific block device options shared by all protocols supported by the
3747 # @url: URL of the image file
3749 # @readahead: Size of the read-ahead cache; must be a multiple of
3750 # 512 (defaults to 256 kB)
3752 # @timeout: Timeout for connections, in seconds (defaults to 5)
3754 # @username: Username for authentication (defaults to none)
3756 # @password-secret: ID of a QCryptoSecret object providing a password
3757 # for authentication (defaults to no password)
3759 # @proxy-username: Username for proxy authentication (defaults to none)
3761 # @proxy-password-secret: ID of a QCryptoSecret object providing a password
3762 # for proxy authentication (defaults to no password)
3766 { 'struct': 'BlockdevOptionsCurlBase',
3767 'data': { 'url': 'str',
3768 '*readahead': 'int',
3771 '*password-secret': 'str',
3772 '*proxy-username': 'str',
3773 '*proxy-password-secret': 'str' } }
3776 # @BlockdevOptionsCurlHttp:
3778 # Driver specific block device options for HTTP connections over the curl
3779 # backend. URLs must start with "http://".
3781 # @cookie: List of cookies to set; format is
3782 # "name1=content1; name2=content2;" as explained by
3783 # CURLOPT_COOKIE(3). Defaults to no cookies.
3785 # @cookie-secret: ID of a QCryptoSecret object providing the cookie data in a
3786 # secure way. See @cookie for the format. (since 2.10)
3790 { 'struct': 'BlockdevOptionsCurlHttp',
3791 'base': 'BlockdevOptionsCurlBase',
3792 'data': { '*cookie': 'str',
3793 '*cookie-secret': 'str'} }
3796 # @BlockdevOptionsCurlHttps:
3798 # Driver specific block device options for HTTPS connections over the curl
3799 # backend. URLs must start with "https://".
3801 # @cookie: List of cookies to set; format is
3802 # "name1=content1; name2=content2;" as explained by
3803 # CURLOPT_COOKIE(3). Defaults to no cookies.
3805 # @sslverify: Whether to verify the SSL certificate's validity (defaults to
3808 # @cookie-secret: ID of a QCryptoSecret object providing the cookie data in a
3809 # secure way. See @cookie for the format. (since 2.10)
3813 { 'struct': 'BlockdevOptionsCurlHttps',
3814 'base': 'BlockdevOptionsCurlBase',
3815 'data': { '*cookie': 'str',
3816 '*sslverify': 'bool',
3817 '*cookie-secret': 'str'} }
3820 # @BlockdevOptionsCurlFtp:
3822 # Driver specific block device options for FTP connections over the curl
3823 # backend. URLs must start with "ftp://".
3827 { 'struct': 'BlockdevOptionsCurlFtp',
3828 'base': 'BlockdevOptionsCurlBase',
3832 # @BlockdevOptionsCurlFtps:
3834 # Driver specific block device options for FTPS connections over the curl
3835 # backend. URLs must start with "ftps://".
3837 # @sslverify: Whether to verify the SSL certificate's validity (defaults to
3842 { 'struct': 'BlockdevOptionsCurlFtps',
3843 'base': 'BlockdevOptionsCurlBase',
3844 'data': { '*sslverify': 'bool' } }
3847 # @BlockdevOptionsNbd:
3849 # Driver specific block device options for NBD.
3851 # @server: NBD server address
3853 # @export: export name
3855 # @tls-creds: TLS credentials ID
3857 # @x-dirty-bitmap: A "qemu:dirty-bitmap:NAME" string to query in place of
3858 # traditional "base:allocation" block status (see
3859 # NBD_OPT_LIST_META_CONTEXT in the NBD protocol) (since 3.0)
3861 # @reconnect-delay: On an unexpected disconnect, the nbd client tries to
3862 # connect again until succeeding or encountering a serious
3863 # error. During the first @reconnect-delay seconds, all
3864 # requests are paused and will be rerun on a successful
3865 # reconnect. After that time, any delayed requests and all
3866 # future requests before a successful reconnect will
3867 # immediately fail. Default 0 (Since 4.2)
3871 { 'struct': 'BlockdevOptionsNbd',
3872 'data': { 'server': 'SocketAddress',
3874 '*tls-creds': 'str',
3875 '*x-dirty-bitmap': 'str',
3876 '*reconnect-delay': 'uint32' } }
3879 # @BlockdevOptionsRaw:
3881 # Driver specific block device options for the raw driver.
3883 # @offset: position where the block device starts
3884 # @size: the assumed size of the device
3888 { 'struct': 'BlockdevOptionsRaw',
3889 'base': 'BlockdevOptionsGenericFormat',
3890 'data': { '*offset': 'int', '*size': 'int' } }
3893 # @BlockdevOptionsVxHS:
3895 # Driver specific block device options for VxHS
3897 # @vdisk-id: UUID of VxHS volume
3898 # @server: vxhs server IP, port
3899 # @tls-creds: TLS credentials ID
3903 { 'struct': 'BlockdevOptionsVxHS',
3904 'data': { 'vdisk-id': 'str',
3905 'server': 'InetSocketAddressBase',
3906 '*tls-creds': 'str' } }
3909 # @BlockdevOptionsThrottle:
3911 # Driver specific block device options for the throttle driver
3913 # @throttle-group: the name of the throttle-group object to use. It
3914 # must already exist.
3915 # @file: reference to or definition of the data source block device
3918 { 'struct': 'BlockdevOptionsThrottle',
3919 'data': { 'throttle-group': 'str',
3920 'file' : 'BlockdevRef'
3925 # Options for creating a block device. Many options are available for all
3926 # block devices, independent of the block driver:
3928 # @driver: block driver name
3929 # @node-name: the node name of the new node (Since 2.0).
3930 # This option is required on the top level of blockdev-add.
3931 # Valid node names start with an alphabetic character and may
3932 # contain only alphanumeric characters, '-', '.' and '_'. Their
3933 # maximum length is 31 characters.
3934 # @discard: discard-related options (default: ignore)
3935 # @cache: cache-related options
3936 # @read-only: whether the block device should be read-only (default: false).
3937 # Note that some block drivers support only read-only access,
3938 # either generally or in certain configurations. In this case,
3939 # the default value does not work and the option must be
3940 # specified explicitly.
3941 # @auto-read-only: if true and @read-only is false, QEMU may automatically
3942 # decide not to open the image read-write as requested, but
3943 # fall back to read-only instead (and switch between the modes
3944 # later), e.g. depending on whether the image file is writable
3945 # or whether a writing user is attached to the node
3946 # (default: false, since 3.1)
3947 # @detect-zeroes: detect and optimize zero writes (Since 2.1)
3949 # @force-share: force share all permission on added nodes.
3950 # Requires read-only=true. (Since 2.10)
3952 # Remaining options are determined by the block driver.
3956 { 'union': 'BlockdevOptions',
3957 'base': { 'driver': 'BlockdevDriver',
3958 '*node-name': 'str',
3959 '*discard': 'BlockdevDiscardOptions',
3960 '*cache': 'BlockdevCacheOptions',
3961 '*read-only': 'bool',
3962 '*auto-read-only': 'bool',
3963 '*force-share': 'bool',
3964 '*detect-zeroes': 'BlockdevDetectZeroesOptions' },
3965 'discriminator': 'driver',
3967 'blkdebug': 'BlockdevOptionsBlkdebug',
3968 'blklogwrites':'BlockdevOptionsBlklogwrites',
3969 'blkverify': 'BlockdevOptionsBlkverify',
3970 'blkreplay': 'BlockdevOptionsBlkreplay',
3971 'bochs': 'BlockdevOptionsGenericFormat',
3972 'cloop': 'BlockdevOptionsGenericFormat',
3973 'compress': 'BlockdevOptionsGenericFormat',
3974 'copy-on-read':'BlockdevOptionsGenericFormat',
3975 'dmg': 'BlockdevOptionsGenericFormat',
3976 'file': 'BlockdevOptionsFile',
3977 'ftp': 'BlockdevOptionsCurlFtp',
3978 'ftps': 'BlockdevOptionsCurlFtps',
3979 'gluster': 'BlockdevOptionsGluster',
3980 'host_cdrom': 'BlockdevOptionsFile',
3981 'host_device':'BlockdevOptionsFile',
3982 'http': 'BlockdevOptionsCurlHttp',
3983 'https': 'BlockdevOptionsCurlHttps',
3984 'iscsi': 'BlockdevOptionsIscsi',
3985 'luks': 'BlockdevOptionsLUKS',
3986 'nbd': 'BlockdevOptionsNbd',
3987 'nfs': 'BlockdevOptionsNfs',
3988 'null-aio': 'BlockdevOptionsNull',
3989 'null-co': 'BlockdevOptionsNull',
3990 'nvme': 'BlockdevOptionsNVMe',
3991 'parallels': 'BlockdevOptionsGenericFormat',
3992 'qcow2': 'BlockdevOptionsQcow2',
3993 'qcow': 'BlockdevOptionsQcow',
3994 'qed': 'BlockdevOptionsGenericCOWFormat',
3995 'quorum': 'BlockdevOptionsQuorum',
3996 'raw': 'BlockdevOptionsRaw',
3997 'rbd': 'BlockdevOptionsRbd',
3998 'replication': { 'type': 'BlockdevOptionsReplication',
3999 'if': 'defined(CONFIG_REPLICATION)' },
4000 'sheepdog': 'BlockdevOptionsSheepdog',
4001 'ssh': 'BlockdevOptionsSsh',
4002 'throttle': 'BlockdevOptionsThrottle',
4003 'vdi': 'BlockdevOptionsGenericFormat',
4004 'vhdx': 'BlockdevOptionsGenericFormat',
4005 'vmdk': 'BlockdevOptionsGenericCOWFormat',
4006 'vpc': 'BlockdevOptionsGenericFormat',
4007 'vvfat': 'BlockdevOptionsVVFAT',
4008 'vxhs': 'BlockdevOptionsVxHS'
4014 # Reference to a block device.
4016 # @definition: defines a new block device inline
4017 # @reference: references the ID of an existing block device
4021 { 'alternate': 'BlockdevRef',
4022 'data': { 'definition': 'BlockdevOptions',
4023 'reference': 'str' } }
4026 # @BlockdevRefOrNull:
4028 # Reference to a block device.
4030 # @definition: defines a new block device inline
4031 # @reference: references the ID of an existing block device.
4032 # An empty string means that no block device should
4033 # be referenced. Deprecated; use null instead.
4034 # @null: No block device should be referenced (since 2.10)
4038 { 'alternate': 'BlockdevRefOrNull',
4039 'data': { 'definition': 'BlockdevOptions',
4046 # Creates a new block device. If the @id option is given at the top level, a
4047 # BlockBackend will be created; otherwise, @node-name is mandatory at the top
4048 # level and no BlockBackend will be created.
4055 # -> { "execute": "blockdev-add",
4057 # "driver": "qcow2",
4058 # "node-name": "test1",
4061 # "filename": "test.qcow2"
4065 # <- { "return": {} }
4068 # -> { "execute": "blockdev-add",
4070 # "driver": "qcow2",
4071 # "node-name": "node0",
4072 # "discard": "unmap",
4078 # "filename": "/tmp/test.qcow2"
4084 # "filename": "/dev/fdset/4"
4090 # <- { "return": {} }
4093 { 'command': 'blockdev-add', 'data': 'BlockdevOptions', 'boxed': true }
4096 # @x-blockdev-reopen:
4098 # Reopens a block device using the given set of options. Any option
4099 # not specified will be reset to its default value regardless of its
4100 # previous status. If an option cannot be changed or a particular
4101 # driver does not support reopening then the command will return an
4104 # The top-level @node-name option (from BlockdevOptions) must be
4105 # specified and is used to select the block device to be reopened.
4106 # Other @node-name options must be either omitted or set to the
4107 # current name of the appropriate node. This command won't change any
4108 # node name and any attempt to do it will result in an error.
4110 # In the case of options that refer to child nodes, the behavior of
4111 # this command depends on the value:
4113 # 1) A set of options (BlockdevOptions): the child is reopened with
4114 # the specified set of options.
4116 # 2) A reference to the current child: the child is reopened using
4117 # its existing set of options.
4119 # 3) A reference to a different node: the current child is replaced
4120 # with the specified one.
4122 # 4) NULL: the current child (if any) is detached.
4124 # Options (1) and (2) are supported in all cases, but at the moment
4125 # only @backing allows replacing or detaching an existing child.
4127 # Unlike with blockdev-add, the @backing option must always be present
4128 # unless the node being reopened does not have a backing file and its
4129 # image does not have a default backing file name as part of its
4134 { 'command': 'x-blockdev-reopen',
4135 'data': 'BlockdevOptions', 'boxed': true }
4140 # Deletes a block device that has been added using blockdev-add.
4141 # The command will fail if the node is attached to a device or is
4142 # otherwise being used.
4144 # @node-name: Name of the graph node to delete.
4150 # -> { "execute": "blockdev-add",
4152 # "driver": "qcow2",
4153 # "node-name": "node0",
4156 # "filename": "test.qcow2"
4160 # <- { "return": {} }
4162 # -> { "execute": "blockdev-del",
4163 # "arguments": { "node-name": "node0" }
4165 # <- { "return": {} }
4168 { 'command': 'blockdev-del', 'data': { 'node-name': 'str' } }
4171 # @BlockdevCreateOptionsFile:
4173 # Driver specific image creation options for file.
4175 # @filename: Filename for the new image file
4176 # @size: Size of the virtual disk in bytes
4177 # @preallocation: Preallocation mode for the new image (default: off;
4178 # allowed values: off,
4179 # falloc (if defined CONFIG_POSIX_FALLOCATE),
4180 # full (if defined CONFIG_POSIX))
4181 # @nocow: Turn off copy-on-write (valid only on btrfs; default: off)
4185 { 'struct': 'BlockdevCreateOptionsFile',
4186 'data': { 'filename': 'str',
4188 '*preallocation': 'PreallocMode',
4189 '*nocow': 'bool' } }
4192 # @BlockdevCreateOptionsGluster:
4194 # Driver specific image creation options for gluster.
4196 # @location: Where to store the new image file
4197 # @size: Size of the virtual disk in bytes
4198 # @preallocation: Preallocation mode for the new image (default: off;
4199 # allowed values: off,
4200 # falloc (if defined CONFIG_GLUSTERFS_FALLOCATE),
4201 # full (if defined CONFIG_GLUSTERFS_ZEROFILL))
4205 { 'struct': 'BlockdevCreateOptionsGluster',
4206 'data': { 'location': 'BlockdevOptionsGluster',
4208 '*preallocation': 'PreallocMode' } }
4211 # @BlockdevCreateOptionsLUKS:
4213 # Driver specific image creation options for LUKS.
4215 # @file: Node to create the image format on
4216 # @size: Size of the virtual disk in bytes
4217 # @preallocation: Preallocation mode for the new image
4219 # (default: off; allowed values: off, metadata, falloc, full)
4223 { 'struct': 'BlockdevCreateOptionsLUKS',
4224 'base': 'QCryptoBlockCreateOptionsLUKS',
4225 'data': { 'file': 'BlockdevRef',
4227 '*preallocation': 'PreallocMode' } }
4230 # @BlockdevCreateOptionsNfs:
4232 # Driver specific image creation options for NFS.
4234 # @location: Where to store the new image file
4235 # @size: Size of the virtual disk in bytes
4239 { 'struct': 'BlockdevCreateOptionsNfs',
4240 'data': { 'location': 'BlockdevOptionsNfs',
4244 # @BlockdevCreateOptionsParallels:
4246 # Driver specific image creation options for parallels.
4248 # @file: Node to create the image format on
4249 # @size: Size of the virtual disk in bytes
4250 # @cluster-size: Cluster size in bytes (default: 1 MB)
4254 { 'struct': 'BlockdevCreateOptionsParallels',
4255 'data': { 'file': 'BlockdevRef',
4257 '*cluster-size': 'size' } }
4260 # @BlockdevCreateOptionsQcow:
4262 # Driver specific image creation options for qcow.
4264 # @file: Node to create the image format on
4265 # @size: Size of the virtual disk in bytes
4266 # @backing-file: File name of the backing file if a backing file
4268 # @encrypt: Encryption options if the image should be encrypted
4272 { 'struct': 'BlockdevCreateOptionsQcow',
4273 'data': { 'file': 'BlockdevRef',
4275 '*backing-file': 'str',
4276 '*encrypt': 'QCryptoBlockCreateOptions' } }
4279 # @BlockdevQcow2Version:
4281 # @v2: The original QCOW2 format as introduced in qemu 0.10 (version 2)
4282 # @v3: The extended QCOW2 format as introduced in qemu 1.1 (version 3)
4286 { 'enum': 'BlockdevQcow2Version',
4287 'data': [ 'v2', 'v3' ] }
4291 # @Qcow2CompressionType:
4293 # Compression type used in qcow2 image file
4295 # @zlib: zlib compression, see <http://zlib.net/>
4296 # @zstd: zstd compression, see <http://github.com/facebook/zstd>
4300 { 'enum': 'Qcow2CompressionType',
4301 'data': [ 'zlib', { 'name': 'zstd', 'if': 'defined(CONFIG_ZSTD)' } ] }
4304 # @BlockdevCreateOptionsQcow2:
4306 # Driver specific image creation options for qcow2.
4308 # @file: Node to create the image format on
4309 # @data-file: Node to use as an external data file in which all guest
4310 # data is stored so that only metadata remains in the qcow2
4312 # @data-file-raw: True if the external data file must stay valid as a
4313 # standalone (read-only) raw image without looking at qcow2
4314 # metadata (default: false; since: 4.0)
4315 # @size: Size of the virtual disk in bytes
4316 # @version: Compatibility level (default: v3)
4317 # @backing-file: File name of the backing file if a backing file
4319 # @backing-fmt: Name of the block driver to use for the backing file
4320 # @encrypt: Encryption options if the image should be encrypted
4321 # @cluster-size: qcow2 cluster size in bytes (default: 65536)
4322 # @preallocation: Preallocation mode for the new image (default: off;
4323 # allowed values: off, falloc, full, metadata)
4324 # @lazy-refcounts: True if refcounts may be updated lazily (default: off)
4325 # @refcount-bits: Width of reference counts in bits (default: 16)
4326 # @compression-type: The image cluster compression method
4327 # (default: zlib, since 5.1)
4331 { 'struct': 'BlockdevCreateOptionsQcow2',
4332 'data': { 'file': 'BlockdevRef',
4333 '*data-file': 'BlockdevRef',
4334 '*data-file-raw': 'bool',
4336 '*version': 'BlockdevQcow2Version',
4337 '*backing-file': 'str',
4338 '*backing-fmt': 'BlockdevDriver',
4339 '*encrypt': 'QCryptoBlockCreateOptions',
4340 '*cluster-size': 'size',
4341 '*preallocation': 'PreallocMode',
4342 '*lazy-refcounts': 'bool',
4343 '*refcount-bits': 'int',
4344 '*compression-type':'Qcow2CompressionType' } }
4347 # @BlockdevCreateOptionsQed:
4349 # Driver specific image creation options for qed.
4351 # @file: Node to create the image format on
4352 # @size: Size of the virtual disk in bytes
4353 # @backing-file: File name of the backing file if a backing file
4355 # @backing-fmt: Name of the block driver to use for the backing file
4356 # @cluster-size: Cluster size in bytes (default: 65536)
4357 # @table-size: L1/L2 table size (in clusters)
4361 { 'struct': 'BlockdevCreateOptionsQed',
4362 'data': { 'file': 'BlockdevRef',
4364 '*backing-file': 'str',
4365 '*backing-fmt': 'BlockdevDriver',
4366 '*cluster-size': 'size',
4367 '*table-size': 'int' } }
4370 # @BlockdevCreateOptionsRbd:
4372 # Driver specific image creation options for rbd/Ceph.
4374 # @location: Where to store the new image file. This location cannot
4375 # point to a snapshot.
4376 # @size: Size of the virtual disk in bytes
4377 # @cluster-size: RBD object size
4381 { 'struct': 'BlockdevCreateOptionsRbd',
4382 'data': { 'location': 'BlockdevOptionsRbd',
4384 '*cluster-size' : 'size' } }
4387 # @BlockdevVmdkSubformat:
4389 # Subformat options for VMDK images
4391 # @monolithicSparse: Single file image with sparse cluster allocation
4393 # @monolithicFlat: Single flat data image and a descriptor file
4395 # @twoGbMaxExtentSparse: Data is split into 2GB (per virtual LBA) sparse extent
4396 # files, in addition to a descriptor file
4398 # @twoGbMaxExtentFlat: Data is split into 2GB (per virtual LBA) flat extent
4399 # files, in addition to a descriptor file
4401 # @streamOptimized: Single file image sparse cluster allocation, optimized
4402 # for streaming over network.
4406 { 'enum': 'BlockdevVmdkSubformat',
4407 'data': [ 'monolithicSparse', 'monolithicFlat', 'twoGbMaxExtentSparse',
4408 'twoGbMaxExtentFlat', 'streamOptimized'] }
4411 # @BlockdevVmdkAdapterType:
4413 # Adapter type info for VMDK images
4417 { 'enum': 'BlockdevVmdkAdapterType',
4418 'data': [ 'ide', 'buslogic', 'lsilogic', 'legacyESX'] }
4421 # @BlockdevCreateOptionsVmdk:
4423 # Driver specific image creation options for VMDK.
4425 # @file: Where to store the new image file. This refers to the image
4426 # file for monolithcSparse and streamOptimized format, or the
4427 # descriptor file for other formats.
4428 # @size: Size of the virtual disk in bytes
4429 # @extents: Where to store the data extents. Required for monolithcFlat,
4430 # twoGbMaxExtentSparse and twoGbMaxExtentFlat formats. For
4431 # monolithicFlat, only one entry is required; for
4432 # twoGbMaxExtent* formats, the number of entries required is
4433 # calculated as extent_number = virtual_size / 2GB. Providing
4434 # more extents than will be used is an error.
4435 # @subformat: The subformat of the VMDK image. Default: "monolithicSparse".
4436 # @backing-file: The path of backing file. Default: no backing file is used.
4437 # @adapter-type: The adapter type used to fill in the descriptor. Default: ide.
4438 # @hwversion: Hardware version. The meaningful options are "4" or "6".
4440 # @zeroed-grain: Whether to enable zeroed-grain feature for sparse subformats.
4445 { 'struct': 'BlockdevCreateOptionsVmdk',
4446 'data': { 'file': 'BlockdevRef',
4448 '*extents': ['BlockdevRef'],
4449 '*subformat': 'BlockdevVmdkSubformat',
4450 '*backing-file': 'str',
4451 '*adapter-type': 'BlockdevVmdkAdapterType',
4452 '*hwversion': 'str',
4453 '*zeroed-grain': 'bool' } }
4457 # @SheepdogRedundancyType:
4459 # @full: Create a fully replicated vdi with x copies
4460 # @erasure-coded: Create an erasure coded vdi with x data strips and
4465 { 'enum': 'SheepdogRedundancyType',
4466 'data': [ 'full', 'erasure-coded' ] }
4469 # @SheepdogRedundancyFull:
4471 # @copies: Number of copies to use (between 1 and 31)
4475 { 'struct': 'SheepdogRedundancyFull',
4476 'data': { 'copies': 'int' }}
4479 # @SheepdogRedundancyErasureCoded:
4481 # @data-strips: Number of data strips to use (one of {2,4,8,16})
4482 # @parity-strips: Number of parity strips to use (between 1 and 15)
4486 { 'struct': 'SheepdogRedundancyErasureCoded',
4487 'data': { 'data-strips': 'int',
4488 'parity-strips': 'int' }}
4491 # @SheepdogRedundancy:
4495 { 'union': 'SheepdogRedundancy',
4496 'base': { 'type': 'SheepdogRedundancyType' },
4497 'discriminator': 'type',
4498 'data': { 'full': 'SheepdogRedundancyFull',
4499 'erasure-coded': 'SheepdogRedundancyErasureCoded' } }
4502 # @BlockdevCreateOptionsSheepdog:
4504 # Driver specific image creation options for Sheepdog.
4506 # @location: Where to store the new image file
4507 # @size: Size of the virtual disk in bytes
4508 # @backing-file: File name of a base image
4509 # @preallocation: Preallocation mode for the new image (default: off;
4510 # allowed values: off, full)
4511 # @redundancy: Redundancy of the image
4512 # @object-size: Object size of the image
4516 { 'struct': 'BlockdevCreateOptionsSheepdog',
4517 'data': { 'location': 'BlockdevOptionsSheepdog',
4519 '*backing-file': 'str',
4520 '*preallocation': 'PreallocMode',
4521 '*redundancy': 'SheepdogRedundancy',
4522 '*object-size': 'size' } }
4525 # @BlockdevCreateOptionsSsh:
4527 # Driver specific image creation options for SSH.
4529 # @location: Where to store the new image file
4530 # @size: Size of the virtual disk in bytes
4534 { 'struct': 'BlockdevCreateOptionsSsh',
4535 'data': { 'location': 'BlockdevOptionsSsh',
4539 # @BlockdevCreateOptionsVdi:
4541 # Driver specific image creation options for VDI.
4543 # @file: Node to create the image format on
4544 # @size: Size of the virtual disk in bytes
4545 # @preallocation: Preallocation mode for the new image (default: off;
4546 # allowed values: off, metadata)
4550 { 'struct': 'BlockdevCreateOptionsVdi',
4551 'data': { 'file': 'BlockdevRef',
4553 '*preallocation': 'PreallocMode' } }
4556 # @BlockdevVhdxSubformat:
4558 # @dynamic: Growing image file
4559 # @fixed: Preallocated fixed-size image file
4563 { 'enum': 'BlockdevVhdxSubformat',
4564 'data': [ 'dynamic', 'fixed' ] }
4567 # @BlockdevCreateOptionsVhdx:
4569 # Driver specific image creation options for vhdx.
4571 # @file: Node to create the image format on
4572 # @size: Size of the virtual disk in bytes
4573 # @log-size: Log size in bytes, must be a multiple of 1 MB
4575 # @block-size: Block size in bytes, must be a multiple of 1 MB and not
4576 # larger than 256 MB (default: automatically choose a block
4577 # size depending on the image size)
4578 # @subformat: vhdx subformat (default: dynamic)
4579 # @block-state-zero: Force use of payload blocks of type 'ZERO'. Non-standard,
4580 # but default. Do not set to 'off' when using 'qemu-img
4581 # convert' with subformat=dynamic.
4585 { 'struct': 'BlockdevCreateOptionsVhdx',
4586 'data': { 'file': 'BlockdevRef',
4588 '*log-size': 'size',
4589 '*block-size': 'size',
4590 '*subformat': 'BlockdevVhdxSubformat',
4591 '*block-state-zero': 'bool' } }
4594 # @BlockdevVpcSubformat:
4596 # @dynamic: Growing image file
4597 # @fixed: Preallocated fixed-size image file
4601 { 'enum': 'BlockdevVpcSubformat',
4602 'data': [ 'dynamic', 'fixed' ] }
4605 # @BlockdevCreateOptionsVpc:
4607 # Driver specific image creation options for vpc (VHD).
4609 # @file: Node to create the image format on
4610 # @size: Size of the virtual disk in bytes
4611 # @subformat: vhdx subformat (default: dynamic)
4612 # @force-size: Force use of the exact byte size instead of rounding to the
4613 # next size that can be represented in CHS geometry
4618 { 'struct': 'BlockdevCreateOptionsVpc',
4619 'data': { 'file': 'BlockdevRef',
4621 '*subformat': 'BlockdevVpcSubformat',
4622 '*force-size': 'bool' } }
4625 # @BlockdevCreateOptions:
4627 # Options for creating an image format on a given node.
4629 # @driver: block driver to create the image format
4633 { 'union': 'BlockdevCreateOptions',
4635 'driver': 'BlockdevDriver' },
4636 'discriminator': 'driver',
4638 'file': 'BlockdevCreateOptionsFile',
4639 'gluster': 'BlockdevCreateOptionsGluster',
4640 'luks': 'BlockdevCreateOptionsLUKS',
4641 'nfs': 'BlockdevCreateOptionsNfs',
4642 'parallels': 'BlockdevCreateOptionsParallels',
4643 'qcow': 'BlockdevCreateOptionsQcow',
4644 'qcow2': 'BlockdevCreateOptionsQcow2',
4645 'qed': 'BlockdevCreateOptionsQed',
4646 'rbd': 'BlockdevCreateOptionsRbd',
4647 'sheepdog': 'BlockdevCreateOptionsSheepdog',
4648 'ssh': 'BlockdevCreateOptionsSsh',
4649 'vdi': 'BlockdevCreateOptionsVdi',
4650 'vhdx': 'BlockdevCreateOptionsVhdx',
4651 'vmdk': 'BlockdevCreateOptionsVmdk',
4652 'vpc': 'BlockdevCreateOptionsVpc'
4658 # Starts a job to create an image format on a given node. The job is
4659 # automatically finalized, but a manual job-dismiss is required.
4661 # @job-id: Identifier for the newly created job.
4663 # @options: Options for the image creation.
4667 { 'command': 'blockdev-create',
4668 'data': { 'job-id': 'str',
4669 'options': 'BlockdevCreateOptions' } }
4672 # @BlockErrorAction:
4674 # An enumeration of action that has been taken when a DISK I/O occurs
4676 # @ignore: error has been ignored
4678 # @report: error has been reported to the device
4680 # @stop: error caused VM to be stopped
4684 { 'enum': 'BlockErrorAction',
4685 'data': [ 'ignore', 'report', 'stop' ] }
4689 # @BLOCK_IMAGE_CORRUPTED:
4691 # Emitted when a disk image is being marked corrupt. The image can be
4692 # identified by its device or node name. The 'device' field is always
4693 # present for compatibility reasons, but it can be empty ("") if the
4694 # image does not have a device name associated.
4696 # @device: device name. This is always present for compatibility
4697 # reasons, but it can be empty ("") if the image does not
4698 # have a device name associated.
4700 # @node-name: node name (Since: 2.4)
4702 # @msg: informative message for human consumption, such as the kind of
4703 # corruption being detected. It should not be parsed by machine as it is
4704 # not guaranteed to be stable
4706 # @offset: if the corruption resulted from an image access, this is
4707 # the host's access offset into the image
4709 # @size: if the corruption resulted from an image access, this is
4712 # @fatal: if set, the image is marked corrupt and therefore unusable after this
4713 # event and must be repaired (Since 2.2; before, every
4714 # BLOCK_IMAGE_CORRUPTED event was fatal)
4716 # Note: If action is "stop", a STOP event will eventually follow the
4717 # BLOCK_IO_ERROR event.
4721 # <- { "event": "BLOCK_IMAGE_CORRUPTED",
4722 # "data": { "device": "ide0-hd0", "node-name": "node0",
4723 # "msg": "Prevented active L1 table overwrite", "offset": 196608,
4725 # "timestamp": { "seconds": 1378126126, "microseconds": 966463 } }
4729 { 'event': 'BLOCK_IMAGE_CORRUPTED',
4730 'data': { 'device' : 'str',
4731 '*node-name' : 'str',
4735 'fatal' : 'bool' } }
4740 # Emitted when a disk I/O error occurs
4742 # @device: device name. This is always present for compatibility
4743 # reasons, but it can be empty ("") if the image does not
4744 # have a device name associated.
4746 # @node-name: node name. Note that errors may be reported for the root node
4747 # that is directly attached to a guest device rather than for the
4748 # node where the error occurred. The node name is not present if
4749 # the drive is empty. (Since: 2.8)
4751 # @operation: I/O operation
4753 # @action: action that has been taken
4755 # @nospace: true if I/O error was caused due to a no-space
4756 # condition. This key is only present if query-block's
4757 # io-status is present, please see query-block documentation
4758 # for more information (since: 2.2)
4760 # @reason: human readable string describing the error cause.
4761 # (This field is a debugging aid for humans, it should not
4762 # be parsed by applications) (since: 2.2)
4764 # Note: If action is "stop", a STOP event will eventually follow the
4765 # BLOCK_IO_ERROR event
4771 # <- { "event": "BLOCK_IO_ERROR",
4772 # "data": { "device": "ide0-hd1",
4773 # "node-name": "#block212",
4774 # "operation": "write",
4775 # "action": "stop" },
4776 # "timestamp": { "seconds": 1265044230, "microseconds": 450486 } }
4779 { 'event': 'BLOCK_IO_ERROR',
4780 'data': { 'device': 'str', '*node-name': 'str',
4781 'operation': 'IoOperationType',
4782 'action': 'BlockErrorAction', '*nospace': 'bool',
4786 # @BLOCK_JOB_COMPLETED:
4788 # Emitted when a block job has completed
4792 # @device: The job identifier. Originally the device name but other
4793 # values are allowed since QEMU 2.7
4795 # @len: maximum progress value
4797 # @offset: current progress value. On success this is equal to len.
4798 # On failure this is less than len
4800 # @speed: rate limit, bytes per second
4802 # @error: error message. Only present on failure. This field
4803 # contains a human-readable error message. There are no semantics
4804 # other than that streaming has failed and clients should not try to
4805 # interpret the error string
4811 # <- { "event": "BLOCK_JOB_COMPLETED",
4812 # "data": { "type": "stream", "device": "virtio-disk0",
4813 # "len": 10737418240, "offset": 10737418240,
4815 # "timestamp": { "seconds": 1267061043, "microseconds": 959568 } }
4818 { 'event': 'BLOCK_JOB_COMPLETED',
4819 'data': { 'type' : 'JobType',
4827 # @BLOCK_JOB_CANCELLED:
4829 # Emitted when a block job has been cancelled
4833 # @device: The job identifier. Originally the device name but other
4834 # values are allowed since QEMU 2.7
4836 # @len: maximum progress value
4838 # @offset: current progress value. On success this is equal to len.
4839 # On failure this is less than len
4841 # @speed: rate limit, bytes per second
4847 # <- { "event": "BLOCK_JOB_CANCELLED",
4848 # "data": { "type": "stream", "device": "virtio-disk0",
4849 # "len": 10737418240, "offset": 134217728,
4851 # "timestamp": { "seconds": 1267061043, "microseconds": 959568 } }
4854 { 'event': 'BLOCK_JOB_CANCELLED',
4855 'data': { 'type' : 'JobType',
4864 # Emitted when a block job encounters an error
4866 # @device: The job identifier. Originally the device name but other
4867 # values are allowed since QEMU 2.7
4869 # @operation: I/O operation
4871 # @action: action that has been taken
4877 # <- { "event": "BLOCK_JOB_ERROR",
4878 # "data": { "device": "ide0-hd1",
4879 # "operation": "write",
4880 # "action": "stop" },
4881 # "timestamp": { "seconds": 1265044230, "microseconds": 450486 } }
4884 { 'event': 'BLOCK_JOB_ERROR',
4885 'data': { 'device' : 'str',
4886 'operation': 'IoOperationType',
4887 'action' : 'BlockErrorAction' } }
4892 # Emitted when a block job is ready to complete
4896 # @device: The job identifier. Originally the device name but other
4897 # values are allowed since QEMU 2.7
4899 # @len: maximum progress value
4901 # @offset: current progress value. On success this is equal to len.
4902 # On failure this is less than len
4904 # @speed: rate limit, bytes per second
4906 # Note: The "ready to complete" status is always reset by a @BLOCK_JOB_ERROR
4913 # <- { "event": "BLOCK_JOB_READY",
4914 # "data": { "device": "drive0", "type": "mirror", "speed": 0,
4915 # "len": 2097152, "offset": 2097152 }
4916 # "timestamp": { "seconds": 1265044230, "microseconds": 450486 } }
4919 { 'event': 'BLOCK_JOB_READY',
4920 'data': { 'type' : 'JobType',
4927 # @BLOCK_JOB_PENDING:
4929 # Emitted when a block job is awaiting explicit authorization to finalize graph
4930 # changes via @block-job-finalize. If this job is part of a transaction, it will
4931 # not emit this event until the transaction has converged first.
4935 # @id: The job identifier.
4941 # <- { "event": "BLOCK_JOB_WAITING",
4942 # "data": { "device": "drive0", "type": "mirror" },
4943 # "timestamp": { "seconds": 1265044230, "microseconds": 450486 } }
4946 { 'event': 'BLOCK_JOB_PENDING',
4947 'data': { 'type' : 'JobType',
4953 # Preallocation mode of QEMU image file
4955 # @off: no preallocation
4956 # @metadata: preallocate only for metadata
4957 # @falloc: like @full preallocation but allocate disk space by
4958 # posix_fallocate() rather than writing data.
4959 # @full: preallocate all data by writing it to the device to ensure
4960 # disk space is really available. This data may or may not be
4961 # zero, depending on the image format and storage.
4962 # @full preallocation also sets up metadata correctly.
4966 { 'enum': 'PreallocMode',
4967 'data': [ 'off', 'metadata', 'falloc', 'full' ] }
4970 # @BLOCK_WRITE_THRESHOLD:
4972 # Emitted when writes on block device reaches or exceeds the
4973 # configured write threshold. For thin-provisioned devices, this
4974 # means the device should be extended to avoid pausing for
4976 # The event is one shot. Once triggered, it needs to be
4977 # re-registered with another block-set-write-threshold command.
4979 # @node-name: graph node name on which the threshold was exceeded.
4981 # @amount-exceeded: amount of data which exceeded the threshold, in bytes.
4983 # @write-threshold: last configured threshold, in bytes.
4987 { 'event': 'BLOCK_WRITE_THRESHOLD',
4988 'data': { 'node-name': 'str',
4989 'amount-exceeded': 'uint64',
4990 'write-threshold': 'uint64' } }
4993 # @block-set-write-threshold:
4995 # Change the write threshold for a block drive. An event will be
4996 # delivered if a write to this block drive crosses the configured
4997 # threshold. The threshold is an offset, thus must be
4998 # non-negative. Default is no write threshold. Setting the threshold
4999 # to zero disables it.
5001 # This is useful to transparently resize thin-provisioned drives without
5002 # the guest OS noticing.
5004 # @node-name: graph node name on which the threshold must be set.
5006 # @write-threshold: configured threshold for the block device, bytes.
5007 # Use 0 to disable the threshold.
5013 # -> { "execute": "block-set-write-threshold",
5014 # "arguments": { "node-name": "mydev",
5015 # "write-threshold": 17179869184 } }
5016 # <- { "return": {} }
5019 { 'command': 'block-set-write-threshold',
5020 'data': { 'node-name': 'str', 'write-threshold': 'uint64' } }
5023 # @x-blockdev-change:
5025 # Dynamically reconfigure the block driver state graph. It can be used
5026 # to add, remove, insert or replace a graph node. Currently only the
5027 # Quorum driver implements this feature to add or remove its child. This
5028 # is useful to fix a broken quorum child.
5030 # If @node is specified, it will be inserted under @parent. @child
5031 # may not be specified in this case. If both @parent and @child are
5032 # specified but @node is not, @child will be detached from @parent.
5034 # @parent: the id or name of the parent node.
5036 # @child: the name of a child under the given parent node.
5038 # @node: the name of the node that will be added.
5040 # Note: this command is experimental, and its API is not stable. It
5041 # does not support all kinds of operations, all kinds of children, nor
5042 # all block drivers.
5044 # FIXME Removing children from a quorum node means introducing gaps in the
5045 # child indices. This cannot be represented in the 'children' list of
5046 # BlockdevOptionsQuorum, as returned by .bdrv_refresh_filename().
5048 # Warning: The data in a new quorum child MUST be consistent with that of
5049 # the rest of the array.
5055 # 1. Add a new node to a quorum
5056 # -> { "execute": "blockdev-add",
5059 # "node-name": "new_node",
5060 # "file": { "driver": "file",
5061 # "filename": "test.raw" } } }
5062 # <- { "return": {} }
5063 # -> { "execute": "x-blockdev-change",
5064 # "arguments": { "parent": "disk1",
5065 # "node": "new_node" } }
5066 # <- { "return": {} }
5068 # 2. Delete a quorum's node
5069 # -> { "execute": "x-blockdev-change",
5070 # "arguments": { "parent": "disk1",
5071 # "child": "children.1" } }
5072 # <- { "return": {} }
5075 { 'command': 'x-blockdev-change',
5076 'data' : { 'parent': 'str',
5081 # @x-blockdev-set-iothread:
5083 # Move @node and its children into the @iothread. If @iothread is null then
5084 # move @node and its children into the main loop.
5086 # The node must not be attached to a BlockBackend.
5088 # @node-name: the name of the block driver node
5090 # @iothread: the name of the IOThread object or null for the main loop
5092 # @force: true if the node and its children should be moved when a BlockBackend
5093 # is already attached
5095 # Note: this command is experimental and intended for test cases that need
5096 # control over IOThreads only.
5102 # 1. Move a node into an IOThread
5103 # -> { "execute": "x-blockdev-set-iothread",
5104 # "arguments": { "node-name": "disk1",
5105 # "iothread": "iothread0" } }
5106 # <- { "return": {} }
5108 # 2. Move a node into the main loop
5109 # -> { "execute": "x-blockdev-set-iothread",
5110 # "arguments": { "node-name": "disk1",
5111 # "iothread": null } }
5112 # <- { "return": {} }
5115 { 'command': 'x-blockdev-set-iothread',
5116 'data' : { 'node-name': 'str',
5117 'iothread': 'StrOrNull',
5118 '*force': 'bool' } }
5121 # @NbdServerOptions:
5123 # @addr: Address on which to listen.
5124 # @tls-creds: ID of the TLS credentials object (since 2.6).
5125 # @tls-authz: ID of the QAuthZ authorization object used to validate
5126 # the client's x509 distinguished name. This object is
5127 # is only resolved at time of use, so can be deleted and
5128 # recreated on the fly while the NBD server is active.
5129 # If missing, it will default to denying access (since 4.0).
5131 # Keep this type consistent with the nbd-server-start arguments. The only
5132 # intended difference is using SocketAddress instead of SocketAddressLegacy.
5136 { 'struct': 'NbdServerOptions',
5137 'data': { 'addr': 'SocketAddress',
5138 '*tls-creds': 'str',
5139 '*tls-authz': 'str'} }
5142 # @nbd-server-start:
5144 # Start an NBD server listening on the given host and port. Block
5145 # devices can then be exported using @nbd-server-add. The NBD
5146 # server will present them as named exports; for example, another
5147 # QEMU instance could refer to them as "nbd:HOST:PORT:exportname=NAME".
5149 # @addr: Address on which to listen.
5150 # @tls-creds: ID of the TLS credentials object (since 2.6).
5151 # @tls-authz: ID of the QAuthZ authorization object used to validate
5152 # the client's x509 distinguished name. This object is
5153 # is only resolved at time of use, so can be deleted and
5154 # recreated on the fly while the NBD server is active.
5155 # If missing, it will default to denying access (since 4.0).
5157 # Returns: error if the server is already running.
5159 # Keep this type consistent with the NbdServerOptions type. The only intended
5160 # difference is using SocketAddressLegacy instead of SocketAddress.
5164 { 'command': 'nbd-server-start',
5165 'data': { 'addr': 'SocketAddressLegacy',
5166 '*tls-creds': 'str',
5167 '*tls-authz': 'str'} }
5172 # An NBD block export.
5174 # @device: The device name or node name of the node to be exported
5176 # @name: Export name. If unspecified, the @device parameter is used as the
5177 # export name. (Since 2.12)
5179 # @description: Free-form description of the export, up to 4096 bytes.
5182 # @writable: Whether clients should be able to write to the device via the
5183 # NBD connection (default false).
5185 # @bitmap: Also export the dirty bitmap reachable from @device, so the
5186 # NBD client can use NBD_OPT_SET_META_CONTEXT with
5187 # "qemu:dirty-bitmap:NAME" to inspect the bitmap. (since 4.0)
5191 { 'struct': 'BlockExportNbd',
5192 'data': {'device': 'str', '*name': 'str', '*description': 'str',
5193 '*writable': 'bool', '*bitmap': 'str' } }
5198 # Export a block node to QEMU's embedded NBD server.
5200 # Returns: error if the server is not running, or export with the same name
5205 { 'command': 'nbd-server-add',
5206 'data': 'BlockExportNbd', 'boxed': true }
5209 # @NbdServerRemoveMode:
5211 # Mode for removing an NBD export.
5213 # @safe: Remove export if there are no existing connections, fail otherwise.
5215 # @hard: Drop all connections immediately and remove export.
5217 # Potential additional modes to be added in the future:
5219 # hide: Just hide export from new clients, leave existing connections as is.
5220 # Remove export after all clients are disconnected.
5222 # soft: Hide export from new clients, answer with ESHUTDOWN for all further
5223 # requests from existing clients.
5227 {'enum': 'NbdServerRemoveMode', 'data': ['safe', 'hard']}
5230 # @nbd-server-remove:
5232 # Remove NBD export by name.
5234 # @name: Export name.
5236 # @mode: Mode of command operation. See @NbdServerRemoveMode description.
5237 # Default is 'safe'.
5240 # - the server is not running
5241 # - export is not found
5242 # - mode is 'safe' and there are existing connections
5246 { 'command': 'nbd-server-remove',
5247 'data': {'name': 'str', '*mode': 'NbdServerRemoveMode'} }
5252 # Stop QEMU's embedded NBD server, and unregister all devices previously
5253 # added via @nbd-server-add.
5257 { 'command': 'nbd-server-stop' }
5262 # An enumeration of block export types
5268 { 'enum': 'BlockExportType',
5274 # Describes a block export, i.e. how single node should be exported on an
5275 # external interface.
5279 { 'union': 'BlockExport',
5280 'base': { 'type': 'BlockExportType' },
5281 'discriminator': 'type',
5283 'nbd': 'BlockExportNbd'
5289 # An enumeration of the quorum operation types
5291 # @read: read operation
5293 # @write: write operation
5295 # @flush: flush operation
5299 { 'enum': 'QuorumOpType',
5300 'data': [ 'read', 'write', 'flush' ] }
5305 # Emitted by the Quorum block driver if it fails to establish a quorum
5307 # @reference: device name if defined else node name
5309 # @sector-num: number of the first sector of the failed read operation
5311 # @sectors-count: failed read operation sector count
5313 # Note: This event is rate-limited.
5319 # <- { "event": "QUORUM_FAILURE",
5320 # "data": { "reference": "usr1", "sector-num": 345435, "sectors-count": 5 },
5321 # "timestamp": { "seconds": 1344522075, "microseconds": 745528 } }
5324 { 'event': 'QUORUM_FAILURE',
5325 'data': { 'reference': 'str', 'sector-num': 'int', 'sectors-count': 'int' } }
5328 # @QUORUM_REPORT_BAD:
5330 # Emitted to report a corruption of a Quorum file
5332 # @type: quorum operation type (Since 2.6)
5334 # @error: error message. Only present on failure. This field
5335 # contains a human-readable error message. There are no semantics other
5336 # than that the block layer reported an error and clients should not
5337 # try to interpret the error string.
5339 # @node-name: the graph node name of the block driver state
5341 # @sector-num: number of the first sector of the failed read operation
5343 # @sectors-count: failed read operation sector count
5345 # Note: This event is rate-limited.
5353 # { "event": "QUORUM_REPORT_BAD",
5354 # "data": { "node-name": "node0", "sector-num": 345435, "sectors-count": 5,
5356 # "timestamp": { "seconds": 1344522075, "microseconds": 745528 } }
5358 # 2. Flush operation
5360 # { "event": "QUORUM_REPORT_BAD",
5361 # "data": { "node-name": "node0", "sector-num": 0, "sectors-count": 2097120,
5362 # "type": "flush", "error": "Broken pipe" },
5363 # "timestamp": { "seconds": 1456406829, "microseconds": 291763 } }
5366 { 'event': 'QUORUM_REPORT_BAD',
5367 'data': { 'type': 'QuorumOpType', '*error': 'str', 'node-name': 'str',
5368 'sector-num': 'int', 'sectors-count': 'int' } }
5371 # @BlockdevSnapshotInternal:
5373 # @device: the device name or node-name of a root node to generate the snapshot
5376 # @name: the name of the internal snapshot to be created
5378 # Notes: In transaction, if @name is empty, or any snapshot matching @name
5379 # exists, the operation will fail. Only some image formats support it,
5380 # for example, qcow2, rbd, and sheepdog.
5384 { 'struct': 'BlockdevSnapshotInternal',
5385 'data': { 'device': 'str', 'name': 'str' } }
5388 # @blockdev-snapshot-internal-sync:
5390 # Synchronously take an internal snapshot of a block device, when the
5391 # format of the image used supports it. If the name is an empty
5392 # string, or a snapshot with name already exists, the operation will
5395 # For the arguments, see the documentation of BlockdevSnapshotInternal.
5397 # Returns: - nothing on success
5398 # - If @device is not a valid block device, GenericError
5399 # - If any snapshot matching @name exists, or @name is empty,
5401 # - If the format of the image used does not support it,
5402 # BlockFormatFeatureNotSupported
5408 # -> { "execute": "blockdev-snapshot-internal-sync",
5409 # "arguments": { "device": "ide-hd0",
5410 # "name": "snapshot0" }
5412 # <- { "return": {} }
5415 { 'command': 'blockdev-snapshot-internal-sync',
5416 'data': 'BlockdevSnapshotInternal' }
5419 # @blockdev-snapshot-delete-internal-sync:
5421 # Synchronously delete an internal snapshot of a block device, when the format
5422 # of the image used support it. The snapshot is identified by name or id or
5423 # both. One of the name or id is required. Return SnapshotInfo for the
5424 # successfully deleted snapshot.
5426 # @device: the device name or node-name of a root node to delete the snapshot
5429 # @id: optional the snapshot's ID to be deleted
5431 # @name: optional the snapshot's name to be deleted
5433 # Returns: - SnapshotInfo on success
5434 # - If @device is not a valid block device, GenericError
5435 # - If snapshot not found, GenericError
5436 # - If the format of the image used does not support it,
5437 # BlockFormatFeatureNotSupported
5438 # - If @id and @name are both not specified, GenericError
5444 # -> { "execute": "blockdev-snapshot-delete-internal-sync",
5445 # "arguments": { "device": "ide-hd0",
5446 # "name": "snapshot0" }
5450 # "name": "snapshot0",
5451 # "vm-state-size": 0,
5452 # "date-sec": 1000012,
5454 # "vm-clock-sec": 100,
5455 # "vm-clock-nsec": 20
5460 { 'command': 'blockdev-snapshot-delete-internal-sync',
5461 'data': { 'device': 'str', '*id': 'str', '*name': 'str'},
5462 'returns': 'SnapshotInfo' }