qapi/block-core: Fix BlockLatencyHistogramInfo doc markup
[qemu/armbru.git] / qapi / block-core.json
blob80ed4122f29d885edb1dd81d104724b50057b404
1 # -*- Mode: Python -*-
2 # vim: filetype=python
4 ##
5 # == Block core (VM unrelated)
6 ##
8 { 'include': 'common.json' }
9 { 'include': 'crypto.json' }
10 { 'include': 'job.json' }
11 { 'include': 'sockets.json' }
14 # @SnapshotInfo:
16 # @id: unique snapshot id
18 # @name: user chosen name
20 # @vm-state-size: size of the VM state
22 # @date-sec: UTC date of the snapshot in seconds
24 # @date-nsec: fractional part in nano seconds to be used with date-sec
26 # @vm-clock-sec: VM clock relative to boot in seconds
28 # @vm-clock-nsec: fractional part in nano seconds to be used with
29 #     vm-clock-sec
31 # @icount: Current instruction count.  Appears when execution
32 #     record/replay is enabled.  Used for "time-traveling" to match
33 #     the moment in the recorded execution with the snapshots.  This
34 #     counter may be obtained through @query-replay command (since
35 #     5.2)
37 # Since: 1.3
39 { 'struct': 'SnapshotInfo',
40   'data': { 'id': 'str', 'name': 'str', 'vm-state-size': 'int',
41             'date-sec': 'int', 'date-nsec': 'int',
42             'vm-clock-sec': 'int', 'vm-clock-nsec': 'int',
43             '*icount': 'int' } }
46 # @ImageInfoSpecificQCow2EncryptionBase:
48 # @format: The encryption format
50 # Since: 2.10
52 { 'struct': 'ImageInfoSpecificQCow2EncryptionBase',
53   'data': { 'format': 'BlockdevQcow2EncryptionFormat'}}
56 # @ImageInfoSpecificQCow2Encryption:
58 # Since: 2.10
60 { 'union': 'ImageInfoSpecificQCow2Encryption',
61   'base': 'ImageInfoSpecificQCow2EncryptionBase',
62   'discriminator': 'format',
63   'data': { 'luks': 'QCryptoBlockInfoLUKS' } }
66 # @ImageInfoSpecificQCow2:
68 # @compat: compatibility level
70 # @data-file: the filename of the external data file that is stored in
71 #     the image and used as a default for opening the image
72 #     (since: 4.0)
74 # @data-file-raw: True if the external data file must stay valid as a
75 #     standalone (read-only) raw image without looking at qcow2
76 #     metadata (since: 4.0)
78 # @extended-l2: true if the image has extended L2 entries; only valid
79 #     for compat >= 1.1 (since 5.2)
81 # @lazy-refcounts: on or off; only valid for compat >= 1.1
83 # @corrupt: true if the image has been marked corrupt; only valid for
84 #     compat >= 1.1 (since 2.2)
86 # @refcount-bits: width of a refcount entry in bits (since 2.3)
88 # @encrypt: details about encryption parameters; only set if image is
89 #     encrypted (since 2.10)
91 # @bitmaps: A list of qcow2 bitmap details (since 4.0)
93 # @compression-type: the image cluster compression method (since 5.1)
95 # Since: 1.7
97 { 'struct': 'ImageInfoSpecificQCow2',
98   'data': {
99       'compat': 'str',
100       '*data-file': 'str',
101       '*data-file-raw': 'bool',
102       '*extended-l2': 'bool',
103       '*lazy-refcounts': 'bool',
104       '*corrupt': 'bool',
105       'refcount-bits': 'int',
106       '*encrypt': 'ImageInfoSpecificQCow2Encryption',
107       '*bitmaps': ['Qcow2BitmapInfo'],
108       'compression-type': 'Qcow2CompressionType'
109   } }
112 # @ImageInfoSpecificVmdk:
114 # @create-type: The create type of VMDK image
116 # @cid: Content id of image
118 # @parent-cid: Parent VMDK image's cid
120 # @extents: List of extent files
122 # Since: 1.7
124 { 'struct': 'ImageInfoSpecificVmdk',
125   'data': {
126       'create-type': 'str',
127       'cid': 'int',
128       'parent-cid': 'int',
129       'extents': ['VmdkExtentInfo']
130   } }
133 # @VmdkExtentInfo:
135 # Information about a VMDK extent file
137 # @filename: Name of the extent file
139 # @format: Extent type (e.g. FLAT or SPARSE)
141 # @virtual-size: Number of bytes covered by this extent
143 # @cluster-size: Cluster size in bytes (for non-flat extents)
145 # @compressed: Whether this extent contains compressed data
147 # Since: 8.0
149 { 'struct': 'VmdkExtentInfo',
150   'data': {
151       'filename': 'str',
152       'format': 'str',
153       'virtual-size': 'int',
154       '*cluster-size': 'int',
155       '*compressed': 'bool'
156   } }
159 # @ImageInfoSpecificRbd:
161 # @encryption-format: Image encryption format
163 # Since: 6.1
165 { 'struct': 'ImageInfoSpecificRbd',
166   'data': {
167       '*encryption-format': 'RbdImageEncryptionFormat'
168   } }
171 # @ImageInfoSpecificFile:
173 # @extent-size-hint: Extent size hint (if available)
175 # Since: 8.0
177 { 'struct': 'ImageInfoSpecificFile',
178   'data': {
179       '*extent-size-hint': 'size'
180   } }
183 # @ImageInfoSpecificKind:
185 # @luks: Since 2.7
187 # @rbd: Since 6.1
189 # @file: Since 8.0
191 # Since: 1.7
193 { 'enum': 'ImageInfoSpecificKind',
194   'data': [ 'qcow2', 'vmdk', 'luks', 'rbd', 'file' ] }
197 # @ImageInfoSpecificQCow2Wrapper:
199 # Since: 1.7
201 { 'struct': 'ImageInfoSpecificQCow2Wrapper',
202   'data': { 'data': 'ImageInfoSpecificQCow2' } }
205 # @ImageInfoSpecificVmdkWrapper:
207 # Since: 6.1
209 { 'struct': 'ImageInfoSpecificVmdkWrapper',
210   'data': { 'data': 'ImageInfoSpecificVmdk' } }
213 # @ImageInfoSpecificLUKSWrapper:
215 # Since: 2.7
217 { 'struct': 'ImageInfoSpecificLUKSWrapper',
218   'data': { 'data': 'QCryptoBlockInfoLUKS' } }
219 # If we need to add block driver specific parameters for
220 # LUKS in future, then we'll subclass QCryptoBlockInfoLUKS
221 # to define a ImageInfoSpecificLUKS
224 # @ImageInfoSpecificRbdWrapper:
226 # Since: 6.1
228 { 'struct': 'ImageInfoSpecificRbdWrapper',
229   'data': { 'data': 'ImageInfoSpecificRbd' } }
232 # @ImageInfoSpecificFileWrapper:
234 # Since: 8.0
236 { 'struct': 'ImageInfoSpecificFileWrapper',
237   'data': { 'data': 'ImageInfoSpecificFile' } }
240 # @ImageInfoSpecific:
242 # A discriminated record of image format specific information
243 # structures.
245 # Since: 1.7
247 { 'union': 'ImageInfoSpecific',
248   'base': { 'type': 'ImageInfoSpecificKind' },
249   'discriminator': 'type',
250   'data': {
251       'qcow2': 'ImageInfoSpecificQCow2Wrapper',
252       'vmdk': 'ImageInfoSpecificVmdkWrapper',
253       'luks': 'ImageInfoSpecificLUKSWrapper',
254       'rbd': 'ImageInfoSpecificRbdWrapper',
255       'file': 'ImageInfoSpecificFileWrapper'
256   } }
259 # @BlockNodeInfo:
261 # Information about a QEMU image file
263 # @filename: name of the image file
265 # @format: format of the image file
267 # @virtual-size: maximum capacity in bytes of the image
269 # @actual-size: actual size on disk in bytes of the image
271 # @dirty-flag: true if image is not cleanly closed
273 # @cluster-size: size of a cluster in bytes
275 # @encrypted: true if the image is encrypted
277 # @compressed: true if the image is compressed (Since 1.7)
279 # @backing-filename: name of the backing file
281 # @full-backing-filename: full path of the backing file
283 # @backing-filename-format: the format of the backing file
285 # @snapshots: list of VM snapshots
287 # @format-specific: structure supplying additional format-specific
288 #     information (since 1.7)
290 # Since: 8.0
292 { 'struct': 'BlockNodeInfo',
293   'data': {'filename': 'str', 'format': 'str', '*dirty-flag': 'bool',
294            '*actual-size': 'int', 'virtual-size': 'int',
295            '*cluster-size': 'int', '*encrypted': 'bool', '*compressed': 'bool',
296            '*backing-filename': 'str', '*full-backing-filename': 'str',
297            '*backing-filename-format': 'str', '*snapshots': ['SnapshotInfo'],
298            '*format-specific': 'ImageInfoSpecific' } }
301 # @ImageInfo:
303 # Information about a QEMU image file, and potentially its backing
304 # image
306 # @backing-image: info of the backing image
308 # Since: 1.3
310 { 'struct': 'ImageInfo',
311   'base': 'BlockNodeInfo',
312   'data': {
313       '*backing-image': 'ImageInfo'
314   } }
317 # @BlockChildInfo:
319 # Information about all nodes in the block graph starting at some
320 # node, annotated with information about that node in relation to its
321 # parent.
323 # @name: Child name of the root node in the BlockGraphInfo struct, in
324 #     its role as the child of some undescribed parent node
326 # @info: Block graph information starting at this node
328 # Since: 8.0
330 { 'struct': 'BlockChildInfo',
331   'data': {
332       'name': 'str',
333       'info': 'BlockGraphInfo'
334   } }
337 # @BlockGraphInfo:
339 # Information about all nodes in a block (sub)graph in the form of
340 # BlockNodeInfo data.  The base BlockNodeInfo struct contains the
341 # information for the (sub)graph's root node.
343 # @children: Array of links to this node's child nodes' information
345 # Since: 8.0
347 { 'struct': 'BlockGraphInfo',
348   'base': 'BlockNodeInfo',
349   'data': { 'children': ['BlockChildInfo'] } }
352 # @ImageCheck:
354 # Information about a QEMU image file check
356 # @filename: name of the image file checked
358 # @format: format of the image file checked
360 # @check-errors: number of unexpected errors occurred during check
362 # @image-end-offset: offset (in bytes) where the image ends, this
363 #     field is present if the driver for the image format supports it
365 # @corruptions: number of corruptions found during the check if any
367 # @leaks: number of leaks found during the check if any
369 # @corruptions-fixed: number of corruptions fixed during the check if
370 #     any
372 # @leaks-fixed: number of leaks fixed during the check if any
374 # @total-clusters: total number of clusters, this field is present if
375 #     the driver for the image format supports it
377 # @allocated-clusters: total number of allocated clusters, this field
378 #     is present if the driver for the image format supports it
380 # @fragmented-clusters: total number of fragmented clusters, this
381 #     field is present if the driver for the image format supports it
383 # @compressed-clusters: total number of compressed clusters, this
384 #     field is present if the driver for the image format supports it
386 # Since: 1.4
388 { 'struct': 'ImageCheck',
389   'data': {'filename': 'str', 'format': 'str', 'check-errors': 'int',
390            '*image-end-offset': 'int', '*corruptions': 'int', '*leaks': 'int',
391            '*corruptions-fixed': 'int', '*leaks-fixed': 'int',
392            '*total-clusters': 'int', '*allocated-clusters': 'int',
393            '*fragmented-clusters': 'int', '*compressed-clusters': 'int' } }
396 # @MapEntry:
398 # Mapping information from a virtual block range to a host file range
400 # @start: virtual (guest) offset of the first byte described by this
401 #     entry
403 # @length: the number of bytes of the mapped virtual range
405 # @data: reading the image will actually read data from a file (in
406 #     particular, if @offset is present this means that the sectors
407 #     are not simply preallocated, but contain actual data in raw
408 #     format)
410 # @zero: whether the virtual blocks read as zeroes
412 # @compressed: true if the data is stored compressed (since 8.2)
414 # @depth: number of layers (0 = top image, 1 = top image's backing
415 #     file, ..., n - 1 = bottom image (where n is the number of images
416 #     in the chain)) before reaching one for which the range is
417 #     allocated
419 # @present: true if this layer provides the data, false if adding a
420 #     backing layer could impact this region (since 6.1)
422 # @offset: if present, the image file stores the data for this range
423 #     in raw format at the given (host) offset
425 # @filename: filename that is referred to by @offset
427 # Since: 2.6
429 { 'struct': 'MapEntry',
430   'data': {'start': 'int', 'length': 'int', 'data': 'bool',
431            'zero': 'bool', 'compressed': 'bool', 'depth': 'int',
432            'present': 'bool', '*offset': 'int', '*filename': 'str' } }
435 # @BlockdevCacheInfo:
437 # Cache mode information for a block device
439 # @writeback: true if writeback mode is enabled
441 # @direct: true if the host page cache is bypassed (O_DIRECT)
443 # @no-flush: true if flush requests are ignored for the device
445 # Since: 2.3
447 { 'struct': 'BlockdevCacheInfo',
448   'data': { 'writeback': 'bool',
449             'direct': 'bool',
450             'no-flush': 'bool' } }
453 # @BlockDeviceInfo:
455 # Information about the backing device for a block device.
457 # @file: the filename of the backing device
459 # @node-name: the name of the block driver node (Since 2.0)
461 # @ro: true if the backing device was open read-only
463 # @drv: the name of the block format used to open the backing device.
464 #     As of 0.14 this can be: 'blkdebug', 'bochs', 'cloop', 'cow',
465 #     'dmg', 'file', 'file', 'ftp', 'ftps', 'host_cdrom',
466 #     'host_device', 'http', 'https', 'luks', 'nbd', 'parallels',
467 #     'qcow', 'qcow2', 'raw', 'vdi', 'vmdk', 'vpc', 'vvfat' 2.2:
468 #     'archipelago' added, 'cow' dropped 2.3: 'host_floppy' deprecated
469 #     2.5: 'host_floppy' dropped 2.6: 'luks' added 2.8: 'replication'
470 #     added, 'tftp' dropped 2.9: 'archipelago' dropped
472 # @backing_file: the name of the backing file (for copy-on-write)
474 # @backing_file_depth: number of files in the backing file chain
475 #     (since: 1.2)
477 # @encrypted: true if the backing device is encrypted
479 # @detect_zeroes: detect and optimize zero writes (Since 2.1)
481 # @bps: total throughput limit in bytes per second is specified
483 # @bps_rd: read throughput limit in bytes per second is specified
485 # @bps_wr: write throughput limit in bytes per second is specified
487 # @iops: total I/O operations per second is specified
489 # @iops_rd: read I/O operations per second is specified
491 # @iops_wr: write I/O operations per second is specified
493 # @image: the info of image used (since: 1.6)
495 # @bps_max: total throughput limit during bursts, in bytes (Since 1.7)
497 # @bps_rd_max: read throughput limit during bursts, in bytes (Since
498 #     1.7)
500 # @bps_wr_max: write throughput limit during bursts, in bytes (Since
501 #     1.7)
503 # @iops_max: total I/O operations per second during bursts, in bytes
504 #     (Since 1.7)
506 # @iops_rd_max: read I/O operations per second during bursts, in bytes
507 #     (Since 1.7)
509 # @iops_wr_max: write I/O operations per second during bursts, in
510 #     bytes (Since 1.7)
512 # @bps_max_length: maximum length of the @bps_max burst period, in
513 #     seconds.  (Since 2.6)
515 # @bps_rd_max_length: maximum length of the @bps_rd_max burst period,
516 #     in seconds.  (Since 2.6)
518 # @bps_wr_max_length: maximum length of the @bps_wr_max burst period,
519 #     in seconds.  (Since 2.6)
521 # @iops_max_length: maximum length of the @iops burst period, in
522 #     seconds.  (Since 2.6)
524 # @iops_rd_max_length: maximum length of the @iops_rd_max burst
525 #     period, in seconds.  (Since 2.6)
527 # @iops_wr_max_length: maximum length of the @iops_wr_max burst
528 #     period, in seconds.  (Since 2.6)
530 # @iops_size: an I/O size in bytes (Since 1.7)
532 # @group: throttle group name (Since 2.4)
534 # @cache: the cache mode used for the block device (since: 2.3)
536 # @write_threshold: configured write threshold for the device.  0 if
537 #     disabled.  (Since 2.3)
539 # @dirty-bitmaps: dirty bitmaps information (only present if node has
540 #     one or more dirty bitmaps) (Since 4.2)
542 # Since: 0.14
544 { 'struct': 'BlockDeviceInfo',
545   'data': { 'file': 'str', '*node-name': 'str', 'ro': 'bool', 'drv': 'str',
546             '*backing_file': 'str', 'backing_file_depth': 'int',
547             'encrypted': 'bool',
548             'detect_zeroes': 'BlockdevDetectZeroesOptions',
549             'bps': 'int', 'bps_rd': 'int', 'bps_wr': 'int',
550             'iops': 'int', 'iops_rd': 'int', 'iops_wr': 'int',
551             'image': 'ImageInfo',
552             '*bps_max': 'int', '*bps_rd_max': 'int',
553             '*bps_wr_max': 'int', '*iops_max': 'int',
554             '*iops_rd_max': 'int', '*iops_wr_max': 'int',
555             '*bps_max_length': 'int', '*bps_rd_max_length': 'int',
556             '*bps_wr_max_length': 'int', '*iops_max_length': 'int',
557             '*iops_rd_max_length': 'int', '*iops_wr_max_length': 'int',
558             '*iops_size': 'int', '*group': 'str', 'cache': 'BlockdevCacheInfo',
559             'write_threshold': 'int', '*dirty-bitmaps': ['BlockDirtyInfo'] } }
562 # @BlockDeviceIoStatus:
564 # An enumeration of block device I/O status.
566 # @ok: The last I/O operation has succeeded
568 # @failed: The last I/O operation has failed
570 # @nospace: The last I/O operation has failed due to a no-space
571 #     condition
573 # Since: 1.0
575 { 'enum': 'BlockDeviceIoStatus', 'data': [ 'ok', 'failed', 'nospace' ] }
578 # @BlockDirtyInfo:
580 # Block dirty bitmap information.
582 # @name: the name of the dirty bitmap (Since 2.4)
584 # @count: number of dirty bytes according to the dirty bitmap
586 # @granularity: granularity of the dirty bitmap in bytes (since 1.4)
588 # @recording: true if the bitmap is recording new writes from the
589 #     guest.  (since 4.0)
591 # @busy: true if the bitmap is in-use by some operation (NBD or jobs)
592 #     and cannot be modified via QMP or used by another operation.
593 #     (since 4.0)
595 # @persistent: true if the bitmap was stored on disk, is scheduled to
596 #     be stored on disk, or both.  (since 4.0)
598 # @inconsistent: true if this is a persistent bitmap that was
599 #     improperly stored.  Implies @persistent to be true; @recording
600 #     and @busy to be false.  This bitmap cannot be used.  To remove
601 #     it, use @block-dirty-bitmap-remove.  (Since 4.0)
603 # Since: 1.3
605 { 'struct': 'BlockDirtyInfo',
606   'data': {'*name': 'str', 'count': 'int', 'granularity': 'uint32',
607            'recording': 'bool', 'busy': 'bool',
608            'persistent': 'bool', '*inconsistent': 'bool' } }
611 # @Qcow2BitmapInfoFlags:
613 # An enumeration of flags that a bitmap can report to the user.
615 # @in-use: This flag is set by any process actively modifying the
616 #     qcow2 file, and cleared when the updated bitmap is flushed to
617 #     the qcow2 image.  The presence of this flag in an offline image
618 #     means that the bitmap was not saved correctly after its last
619 #     usage, and may contain inconsistent data.
621 # @auto: The bitmap must reflect all changes of the virtual disk by
622 #     any application that would write to this qcow2 file.
624 # Since: 4.0
626 { 'enum': 'Qcow2BitmapInfoFlags',
627   'data': ['in-use', 'auto'] }
630 # @Qcow2BitmapInfo:
632 # Qcow2 bitmap information.
634 # @name: the name of the bitmap
636 # @granularity: granularity of the bitmap in bytes
638 # @flags: flags of the bitmap
640 # Since: 4.0
642 { 'struct': 'Qcow2BitmapInfo',
643   'data': {'name': 'str', 'granularity': 'uint32',
644            'flags': ['Qcow2BitmapInfoFlags'] } }
647 # @BlockLatencyHistogramInfo:
649 # Block latency histogram.
651 # @boundaries: list of interval boundary values in nanoseconds, all
652 #     greater than zero and in ascending order.  For example, the list
653 #     [10, 50, 100] produces the following histogram intervals: [0,
654 #     10), [10, 50), [50, 100), [100, +inf).
656 # @bins: list of io request counts corresponding to histogram
657 #     intervals, one more element than @boundaries has.  For the
658 #     example above, @bins may be something like [3, 1, 5, 2], and
659 #     corresponding histogram looks like::
661 #        5|           *
662 #        4|           *
663 #        3| *         *
664 #        2| *         *    *
665 #        1| *    *    *    *
666 #         +------------------
667 #             10   50   100
669 # Since: 4.0
671 { 'struct': 'BlockLatencyHistogramInfo',
672   'data': {'boundaries': ['uint64'], 'bins': ['uint64'] } }
675 # @BlockInfo:
677 # Block device information.  This structure describes a virtual device
678 # and the backing device associated with it.
680 # @device: The device name associated with the virtual device.
682 # @qdev: The qdev ID, or if no ID is assigned, the QOM path of the
683 #     block device.  (since 2.10)
685 # @type: This field is returned only for compatibility reasons, it
686 #     should not be used (always returns 'unknown')
688 # @removable: True if the device supports removable media.
690 # @locked: True if the guest has locked this device from having its
691 #     media removed
693 # @tray_open: True if the device's tray is open (only present if it
694 #     has a tray)
696 # @io-status: @BlockDeviceIoStatus.  Only present if the device
697 #     supports it and the VM is configured to stop on errors
698 #     (supported device models: virtio-blk, IDE, SCSI except
699 #     scsi-generic)
701 # @inserted: @BlockDeviceInfo describing the device if media is
702 #     present
704 # Since: 0.14
706 { 'struct': 'BlockInfo',
707   'data': {'device': 'str', '*qdev': 'str', 'type': 'str', 'removable': 'bool',
708            'locked': 'bool', '*inserted': 'BlockDeviceInfo',
709            '*tray_open': 'bool', '*io-status': 'BlockDeviceIoStatus' } }
712 # @BlockMeasureInfo:
714 # Image file size calculation information.  This structure describes
715 # the size requirements for creating a new image file.
717 # The size requirements depend on the new image file format.  File
718 # size always equals virtual disk size for the 'raw' format, even for
719 # sparse POSIX files.  Compact formats such as 'qcow2' represent
720 # unallocated and zero regions efficiently so file size may be smaller
721 # than virtual disk size.
723 # The values are upper bounds that are guaranteed to fit the new image
724 # file.  Subsequent modification, such as internal snapshot or further
725 # bitmap creation, may require additional space and is not covered
726 # here.
728 # @required: Size required for a new image file, in bytes, when
729 #     copying just allocated guest-visible contents.
731 # @fully-allocated: Image file size, in bytes, once data has been
732 #     written to all sectors, when copying just guest-visible
733 #     contents.
735 # @bitmaps: Additional size required if all the top-level bitmap
736 #     metadata in the source image were to be copied to the
737 #     destination, present only when source and destination both
738 #     support persistent bitmaps.  (since 5.1)
740 # Since: 2.10
742 { 'struct': 'BlockMeasureInfo',
743   'data': {'required': 'int', 'fully-allocated': 'int', '*bitmaps': 'int'} }
746 # @query-block:
748 # Get a list of BlockInfo for all virtual block devices.
750 # Returns: a list of @BlockInfo describing each virtual block device.
751 #     Filter nodes that were created implicitly are skipped over.
753 # Since: 0.14
755 # Example:
757 # -> { "execute": "query-block" }
758 # <- {
759 #       "return":[
760 #          {
761 #             "io-status": "ok",
762 #             "device":"ide0-hd0",
763 #             "locked":false,
764 #             "removable":false,
765 #             "inserted":{
766 #                "ro":false,
767 #                "drv":"qcow2",
768 #                "encrypted":false,
769 #                "file":"disks/test.qcow2",
770 #                "backing_file_depth":1,
771 #                "bps":1000000,
772 #                "bps_rd":0,
773 #                "bps_wr":0,
774 #                "iops":1000000,
775 #                "iops_rd":0,
776 #                "iops_wr":0,
777 #                "bps_max": 8000000,
778 #                "bps_rd_max": 0,
779 #                "bps_wr_max": 0,
780 #                "iops_max": 0,
781 #                "iops_rd_max": 0,
782 #                "iops_wr_max": 0,
783 #                "iops_size": 0,
784 #                "detect_zeroes": "on",
785 #                "write_threshold": 0,
786 #                "image":{
787 #                   "filename":"disks/test.qcow2",
788 #                   "format":"qcow2",
789 #                   "virtual-size":2048000,
790 #                   "backing_file":"base.qcow2",
791 #                   "full-backing-filename":"disks/base.qcow2",
792 #                   "backing-filename-format":"qcow2",
793 #                   "snapshots":[
794 #                      {
795 #                         "id": "1",
796 #                         "name": "snapshot1",
797 #                         "vm-state-size": 0,
798 #                         "date-sec": 10000200,
799 #                         "date-nsec": 12,
800 #                         "vm-clock-sec": 206,
801 #                         "vm-clock-nsec": 30
802 #                      }
803 #                   ],
804 #                   "backing-image":{
805 #                       "filename":"disks/base.qcow2",
806 #                       "format":"qcow2",
807 #                       "virtual-size":2048000
808 #                   }
809 #                }
810 #             },
811 #             "qdev": "ide_disk",
812 #             "type":"unknown"
813 #          },
814 #          {
815 #             "io-status": "ok",
816 #             "device":"ide1-cd0",
817 #             "locked":false,
818 #             "removable":true,
819 #             "qdev": "/machine/unattached/device[23]",
820 #             "tray_open": false,
821 #             "type":"unknown"
822 #          },
823 #          {
824 #             "device":"floppy0",
825 #             "locked":false,
826 #             "removable":true,
827 #             "qdev": "/machine/unattached/device[20]",
828 #             "type":"unknown"
829 #          },
830 #          {
831 #             "device":"sd0",
832 #             "locked":false,
833 #             "removable":true,
834 #             "type":"unknown"
835 #          }
836 #       ]
837 #    }
839 { 'command': 'query-block', 'returns': ['BlockInfo'],
840   'allow-preconfig': true }
843 # @BlockDeviceTimedStats:
845 # Statistics of a block device during a given interval of time.
847 # @interval_length: Interval used for calculating the statistics, in
848 #     seconds.
850 # @min_rd_latency_ns: Minimum latency of read operations in the
851 #     defined interval, in nanoseconds.
853 # @min_wr_latency_ns: Minimum latency of write operations in the
854 #     defined interval, in nanoseconds.
856 # @min_zone_append_latency_ns: Minimum latency of zone append
857 #     operations in the defined interval, in nanoseconds (since 8.1)
859 # @min_flush_latency_ns: Minimum latency of flush operations in the
860 #     defined interval, in nanoseconds.
862 # @max_rd_latency_ns: Maximum latency of read operations in the
863 #     defined interval, in nanoseconds.
865 # @max_wr_latency_ns: Maximum latency of write operations in the
866 #     defined interval, in nanoseconds.
868 # @max_zone_append_latency_ns: Maximum latency of zone append
869 #     operations in the defined interval, in nanoseconds (since 8.1)
871 # @max_flush_latency_ns: Maximum latency of flush operations in the
872 #     defined interval, in nanoseconds.
874 # @avg_rd_latency_ns: Average latency of read operations in the
875 #     defined interval, in nanoseconds.
877 # @avg_wr_latency_ns: Average latency of write operations in the
878 #     defined interval, in nanoseconds.
880 # @avg_zone_append_latency_ns: Average latency of zone append
881 #     operations in the defined interval, in nanoseconds (since 8.1)
883 # @avg_flush_latency_ns: Average latency of flush operations in the
884 #     defined interval, in nanoseconds.
886 # @avg_rd_queue_depth: Average number of pending read operations in
887 #     the defined interval.
889 # @avg_wr_queue_depth: Average number of pending write operations in
890 #     the defined interval.
892 # @avg_zone_append_queue_depth: Average number of pending zone append
893 #     operations in the defined interval (since 8.1).
895 # Since: 2.5
897 { 'struct': 'BlockDeviceTimedStats',
898   'data': { 'interval_length': 'int', 'min_rd_latency_ns': 'int',
899             'max_rd_latency_ns': 'int', 'avg_rd_latency_ns': 'int',
900             'min_wr_latency_ns': 'int', 'max_wr_latency_ns': 'int',
901             'avg_wr_latency_ns': 'int', 'min_zone_append_latency_ns': 'int',
902             'max_zone_append_latency_ns': 'int',
903             'avg_zone_append_latency_ns': 'int',
904             'min_flush_latency_ns': 'int', 'max_flush_latency_ns': 'int',
905             'avg_flush_latency_ns': 'int', 'avg_rd_queue_depth': 'number',
906             'avg_wr_queue_depth': 'number',
907             'avg_zone_append_queue_depth': 'number'  } }
910 # @BlockDeviceStats:
912 # Statistics of a virtual block device or a block backing device.
914 # @rd_bytes: The number of bytes read by the device.
916 # @wr_bytes: The number of bytes written by the device.
918 # @zone_append_bytes: The number of bytes appended by the zoned
919 #     devices (since 8.1)
921 # @unmap_bytes: The number of bytes unmapped by the device (Since 4.2)
923 # @rd_operations: The number of read operations performed by the
924 #     device.
926 # @wr_operations: The number of write operations performed by the
927 #     device.
929 # @zone_append_operations: The number of zone append operations
930 #     performed by the zoned devices (since 8.1)
932 # @flush_operations: The number of cache flush operations performed by
933 #     the device (since 0.15)
935 # @unmap_operations: The number of unmap operations performed by the
936 #     device (Since 4.2)
938 # @rd_total_time_ns: Total time spent on reads in nanoseconds (since
939 #     0.15).
941 # @wr_total_time_ns: Total time spent on writes in nanoseconds (since
942 #     0.15).
944 # @zone_append_total_time_ns: Total time spent on zone append writes
945 #     in nanoseconds (since 8.1)
947 # @flush_total_time_ns: Total time spent on cache flushes in
948 #     nanoseconds (since 0.15).
950 # @unmap_total_time_ns: Total time spent on unmap operations in
951 #     nanoseconds (Since 4.2)
953 # @wr_highest_offset: The offset after the greatest byte written to
954 #     the device.  The intended use of this information is for
955 #     growable sparse files (like qcow2) that are used on top of a
956 #     physical device.
958 # @rd_merged: Number of read requests that have been merged into
959 #     another request (Since 2.3).
961 # @wr_merged: Number of write requests that have been merged into
962 #     another request (Since 2.3).
964 # @zone_append_merged: Number of zone append requests that have been
965 #     merged into another request (since 8.1)
967 # @unmap_merged: Number of unmap requests that have been merged into
968 #     another request (Since 4.2)
970 # @idle_time_ns: Time since the last I/O operation, in nanoseconds.
971 #     If the field is absent it means that there haven't been any
972 #     operations yet (Since 2.5).
974 # @failed_rd_operations: The number of failed read operations
975 #     performed by the device (Since 2.5)
977 # @failed_wr_operations: The number of failed write operations
978 #     performed by the device (Since 2.5)
980 # @failed_zone_append_operations: The number of failed zone append
981 #     write operations performed by the zoned devices (since 8.1)
983 # @failed_flush_operations: The number of failed flush operations
984 #     performed by the device (Since 2.5)
986 # @failed_unmap_operations: The number of failed unmap operations
987 #     performed by the device (Since 4.2)
989 # @invalid_rd_operations: The number of invalid read operations
990 #     performed by the device (Since 2.5)
992 # @invalid_wr_operations: The number of invalid write operations
993 #     performed by the device (Since 2.5)
995 # @invalid_zone_append_operations: The number of invalid zone append
996 #     operations performed by the zoned device (since 8.1)
998 # @invalid_flush_operations: The number of invalid flush operations
999 #     performed by the device (Since 2.5)
1001 # @invalid_unmap_operations: The number of invalid unmap operations
1002 #     performed by the device (Since 4.2)
1004 # @account_invalid: Whether invalid operations are included in the
1005 #     last access statistics (Since 2.5)
1007 # @account_failed: Whether failed operations are included in the
1008 #     latency and last access statistics (Since 2.5)
1010 # @timed_stats: Statistics specific to the set of previously defined
1011 #     intervals of time (Since 2.5)
1013 # @rd_latency_histogram: @BlockLatencyHistogramInfo.  (Since 4.0)
1015 # @wr_latency_histogram: @BlockLatencyHistogramInfo.  (Since 4.0)
1017 # @zone_append_latency_histogram: @BlockLatencyHistogramInfo.
1018 #     (since 8.1)
1020 # @flush_latency_histogram: @BlockLatencyHistogramInfo.  (Since 4.0)
1022 # Since: 0.14
1024 { 'struct': 'BlockDeviceStats',
1025   'data': {'rd_bytes': 'int', 'wr_bytes': 'int', 'zone_append_bytes': 'int',
1026            'unmap_bytes' : 'int', 'rd_operations': 'int',
1027            'wr_operations': 'int', 'zone_append_operations': 'int',
1028            'flush_operations': 'int', 'unmap_operations': 'int',
1029            'rd_total_time_ns': 'int', 'wr_total_time_ns': 'int',
1030            'zone_append_total_time_ns': 'int', 'flush_total_time_ns': 'int',
1031            'unmap_total_time_ns': 'int', 'wr_highest_offset': 'int',
1032            'rd_merged': 'int', 'wr_merged': 'int', 'zone_append_merged': 'int',
1033            'unmap_merged': 'int', '*idle_time_ns': 'int',
1034            'failed_rd_operations': 'int', 'failed_wr_operations': 'int',
1035            'failed_zone_append_operations': 'int',
1036            'failed_flush_operations': 'int',
1037            'failed_unmap_operations': 'int', 'invalid_rd_operations': 'int',
1038            'invalid_wr_operations': 'int',
1039            'invalid_zone_append_operations': 'int',
1040            'invalid_flush_operations': 'int', 'invalid_unmap_operations': 'int',
1041            'account_invalid': 'bool', 'account_failed': 'bool',
1042            'timed_stats': ['BlockDeviceTimedStats'],
1043            '*rd_latency_histogram': 'BlockLatencyHistogramInfo',
1044            '*wr_latency_histogram': 'BlockLatencyHistogramInfo',
1045            '*zone_append_latency_histogram': 'BlockLatencyHistogramInfo',
1046            '*flush_latency_histogram': 'BlockLatencyHistogramInfo' } }
1049 # @BlockStatsSpecificFile:
1051 # File driver statistics
1053 # @discard-nb-ok: The number of successful discard operations
1054 #     performed by the driver.
1056 # @discard-nb-failed: The number of failed discard operations
1057 #     performed by the driver.
1059 # @discard-bytes-ok: The number of bytes discarded by the driver.
1061 # Since: 4.2
1063 { 'struct': 'BlockStatsSpecificFile',
1064   'data': {
1065       'discard-nb-ok': 'uint64',
1066       'discard-nb-failed': 'uint64',
1067       'discard-bytes-ok': 'uint64' } }
1070 # @BlockStatsSpecificNvme:
1072 # NVMe driver statistics
1074 # @completion-errors: The number of completion errors.
1076 # @aligned-accesses: The number of aligned accesses performed by the
1077 #     driver.
1079 # @unaligned-accesses: The number of unaligned accesses performed by
1080 #     the driver.
1082 # Since: 5.2
1084 { 'struct': 'BlockStatsSpecificNvme',
1085   'data': {
1086       'completion-errors': 'uint64',
1087       'aligned-accesses': 'uint64',
1088       'unaligned-accesses': 'uint64' } }
1091 # @BlockStatsSpecific:
1093 # Block driver specific statistics
1095 # Since: 4.2
1097 { 'union': 'BlockStatsSpecific',
1098   'base': { 'driver': 'BlockdevDriver' },
1099   'discriminator': 'driver',
1100   'data': {
1101       'file': 'BlockStatsSpecificFile',
1102       'host_device': { 'type': 'BlockStatsSpecificFile',
1103                        'if': 'HAVE_HOST_BLOCK_DEVICE' },
1104       'nvme': 'BlockStatsSpecificNvme' } }
1107 # @BlockStats:
1109 # Statistics of a virtual block device or a block backing device.
1111 # @device: If the stats are for a virtual block device, the name
1112 #     corresponding to the virtual block device.
1114 # @node-name: The node name of the device.  (Since 2.3)
1116 # @qdev: The qdev ID, or if no ID is assigned, the QOM path of the
1117 #     block device.  (since 3.0)
1119 # @stats: A @BlockDeviceStats for the device.
1121 # @driver-specific: Optional driver-specific stats.  (Since 4.2)
1123 # @parent: This describes the file block device if it has one.
1124 #     Contains recursively the statistics of the underlying protocol
1125 #     (e.g. the host file for a qcow2 image).  If there is no
1126 #     underlying protocol, this field is omitted
1128 # @backing: This describes the backing block device if it has one.
1129 #     (Since 2.0)
1131 # Since: 0.14
1133 { 'struct': 'BlockStats',
1134   'data': {'*device': 'str', '*qdev': 'str', '*node-name': 'str',
1135            'stats': 'BlockDeviceStats',
1136            '*driver-specific': 'BlockStatsSpecific',
1137            '*parent': 'BlockStats',
1138            '*backing': 'BlockStats'} }
1141 # @query-blockstats:
1143 # Query the @BlockStats for all virtual block devices.
1145 # @query-nodes: If true, the command will query all the block nodes
1146 #     that have a node name, in a list which will include "parent"
1147 #     information, but not "backing". If false or omitted, the
1148 #     behavior is as before - query all the device backends,
1149 #     recursively including their "parent" and "backing". Filter nodes
1150 #     that were created implicitly are skipped over in this mode.
1151 #     (Since 2.3)
1153 # Returns: A list of @BlockStats for each virtual block devices.
1155 # Since: 0.14
1157 # Example:
1159 # -> { "execute": "query-blockstats" }
1160 # <- {
1161 #       "return":[
1162 #          {
1163 #             "device":"ide0-hd0",
1164 #             "parent":{
1165 #                "stats":{
1166 #                   "wr_highest_offset":3686448128,
1167 #                   "wr_bytes":9786368,
1168 #                   "wr_operations":751,
1169 #                   "rd_bytes":122567168,
1170 #                   "rd_operations":36772
1171 #                   "wr_total_times_ns":313253456
1172 #                   "rd_total_times_ns":3465673657
1173 #                   "flush_total_times_ns":49653
1174 #                   "flush_operations":61,
1175 #                   "rd_merged":0,
1176 #                   "wr_merged":0,
1177 #                   "idle_time_ns":2953431879,
1178 #                   "account_invalid":true,
1179 #                   "account_failed":false
1180 #                }
1181 #             },
1182 #             "stats":{
1183 #                "wr_highest_offset":2821110784,
1184 #                "wr_bytes":9786368,
1185 #                "wr_operations":692,
1186 #                "rd_bytes":122739200,
1187 #                "rd_operations":36604
1188 #                "flush_operations":51,
1189 #                "wr_total_times_ns":313253456
1190 #                "rd_total_times_ns":3465673657
1191 #                "flush_total_times_ns":49653,
1192 #                "rd_merged":0,
1193 #                "wr_merged":0,
1194 #                "idle_time_ns":2953431879,
1195 #                "account_invalid":true,
1196 #                "account_failed":false
1197 #             },
1198 #             "qdev": "/machine/unattached/device[23]"
1199 #          },
1200 #          {
1201 #             "device":"ide1-cd0",
1202 #             "stats":{
1203 #                "wr_highest_offset":0,
1204 #                "wr_bytes":0,
1205 #                "wr_operations":0,
1206 #                "rd_bytes":0,
1207 #                "rd_operations":0
1208 #                "flush_operations":0,
1209 #                "wr_total_times_ns":0
1210 #                "rd_total_times_ns":0
1211 #                "flush_total_times_ns":0,
1212 #                "rd_merged":0,
1213 #                "wr_merged":0,
1214 #                "account_invalid":false,
1215 #                "account_failed":false
1216 #             },
1217 #             "qdev": "/machine/unattached/device[24]"
1218 #          },
1219 #          {
1220 #             "device":"floppy0",
1221 #             "stats":{
1222 #                "wr_highest_offset":0,
1223 #                "wr_bytes":0,
1224 #                "wr_operations":0,
1225 #                "rd_bytes":0,
1226 #                "rd_operations":0
1227 #                "flush_operations":0,
1228 #                "wr_total_times_ns":0
1229 #                "rd_total_times_ns":0
1230 #                "flush_total_times_ns":0,
1231 #                "rd_merged":0,
1232 #                "wr_merged":0,
1233 #                "account_invalid":false,
1234 #                "account_failed":false
1235 #             },
1236 #             "qdev": "/machine/unattached/device[16]"
1237 #          },
1238 #          {
1239 #             "device":"sd0",
1240 #             "stats":{
1241 #                "wr_highest_offset":0,
1242 #                "wr_bytes":0,
1243 #                "wr_operations":0,
1244 #                "rd_bytes":0,
1245 #                "rd_operations":0
1246 #                "flush_operations":0,
1247 #                "wr_total_times_ns":0
1248 #                "rd_total_times_ns":0
1249 #                "flush_total_times_ns":0,
1250 #                "rd_merged":0,
1251 #                "wr_merged":0,
1252 #                "account_invalid":false,
1253 #                "account_failed":false
1254 #             }
1255 #          }
1256 #       ]
1257 #    }
1259 { 'command': 'query-blockstats',
1260   'data': { '*query-nodes': 'bool' },
1261   'returns': ['BlockStats'],
1262   'allow-preconfig': true }
1265 # @BlockdevOnError:
1267 # An enumeration of possible behaviors for errors on I/O operations.
1268 # The exact meaning depends on whether the I/O was initiated by a
1269 # guest or by a block job
1271 # @report: for guest operations, report the error to the guest; for
1272 #     jobs, cancel the job
1274 # @ignore: ignore the error, only report a QMP event (BLOCK_IO_ERROR
1275 #     or BLOCK_JOB_ERROR). The backup, mirror and commit block jobs
1276 #     retry the failing request later and may still complete
1277 #     successfully.  The stream block job continues to stream and will
1278 #     complete with an error.
1280 # @enospc: same as @stop on ENOSPC, same as @report otherwise.
1282 # @stop: for guest operations, stop the virtual machine; for jobs,
1283 #     pause the job
1285 # @auto: inherit the error handling policy of the backend (since: 2.7)
1287 # Since: 1.3
1289 { 'enum': 'BlockdevOnError',
1290   'data': ['report', 'ignore', 'enospc', 'stop', 'auto'] }
1293 # @MirrorSyncMode:
1295 # An enumeration of possible behaviors for the initial synchronization
1296 # phase of storage mirroring.
1298 # @top: copies data in the topmost image to the destination
1300 # @full: copies data from all images to the destination
1302 # @none: only copy data written from now on
1304 # @incremental: only copy data described by the dirty bitmap.
1305 #     (since: 2.4)
1307 # @bitmap: only copy data described by the dirty bitmap.  (since: 4.2)
1308 #     Behavior on completion is determined by the BitmapSyncMode.
1310 # Since: 1.3
1312 { 'enum': 'MirrorSyncMode',
1313   'data': ['top', 'full', 'none', 'incremental', 'bitmap'] }
1316 # @BitmapSyncMode:
1318 # An enumeration of possible behaviors for the synchronization of a
1319 # bitmap when used for data copy operations.
1321 # @on-success: The bitmap is only synced when the operation is
1322 #     successful.  This is the behavior always used for 'INCREMENTAL'
1323 #     backups.
1325 # @never: The bitmap is never synchronized with the operation, and is
1326 #     treated solely as a read-only manifest of blocks to copy.
1328 # @always: The bitmap is always synchronized with the operation,
1329 #     regardless of whether or not the operation was successful.
1331 # Since: 4.2
1333 { 'enum': 'BitmapSyncMode',
1334   'data': ['on-success', 'never', 'always'] }
1337 # @MirrorCopyMode:
1339 # An enumeration whose values tell the mirror block job when to
1340 # trigger writes to the target.
1342 # @background: copy data in background only.
1344 # @write-blocking: when data is written to the source, write it
1345 #     (synchronously) to the target as well.  In addition, data is
1346 #     copied in background just like in @background mode.
1348 # Since: 3.0
1350 { 'enum': 'MirrorCopyMode',
1351   'data': ['background', 'write-blocking'] }
1354 # @BlockJobInfoMirror:
1356 # Information specific to mirror block jobs.
1358 # @actively-synced: Whether the source is actively synced to the
1359 #     target, i.e. same data and new writes are done synchronously to
1360 #     both.
1362 # Since: 8.2
1364 { 'struct': 'BlockJobInfoMirror',
1365   'data': { 'actively-synced': 'bool' } }
1368 # @BlockJobInfo:
1370 # Information about a long-running block device operation.
1372 # @type: the job type ('stream' for image streaming)
1374 # @device: The job identifier.  Originally the device name but other
1375 #     values are allowed since QEMU 2.7
1377 # @len: Estimated @offset value at the completion of the job.  This
1378 #     value can arbitrarily change while the job is running, in both
1379 #     directions.
1381 # @offset: Progress made until now.  The unit is arbitrary and the
1382 #     value can only meaningfully be used for the ratio of @offset to
1383 #     @len.  The value is monotonically increasing.
1385 # @busy: false if the job is known to be in a quiescent state, with no
1386 #     pending I/O.  (Since 1.3)
1388 # @paused: whether the job is paused or, if @busy is true, will pause
1389 #     itself as soon as possible.  (Since 1.3)
1391 # @speed: the rate limit, bytes per second
1393 # @io-status: the status of the job (since 1.3)
1395 # @ready: true if the job may be completed (since 2.2)
1397 # @status: Current job state/status (since 2.12)
1399 # @auto-finalize: Job will finalize itself when PENDING, moving to the
1400 #     CONCLUDED state.  (since 2.12)
1402 # @auto-dismiss: Job will dismiss itself when CONCLUDED, moving to the
1403 #     NULL state and disappearing from the query list.  (since 2.12)
1405 # @error: Error information if the job did not complete successfully.
1406 #     Not set if the job completed successfully.  (since 2.12.1)
1408 # Since: 1.1
1410 { 'union': 'BlockJobInfo',
1411   'base': {'type': 'JobType', 'device': 'str', 'len': 'int',
1412            'offset': 'int', 'busy': 'bool', 'paused': 'bool', 'speed': 'int',
1413            'io-status': 'BlockDeviceIoStatus', 'ready': 'bool',
1414            'status': 'JobStatus',
1415            'auto-finalize': 'bool', 'auto-dismiss': 'bool',
1416            '*error': 'str' },
1417   'discriminator': 'type',
1418   'data': { 'mirror': 'BlockJobInfoMirror' } }
1421 # @query-block-jobs:
1423 # Return information about long-running block device operations.
1425 # Returns: a list of @BlockJobInfo for each active block job
1427 # Since: 1.1
1429 { 'command': 'query-block-jobs', 'returns': ['BlockJobInfo'],
1430   'allow-preconfig': true }
1433 # @block_resize:
1435 # Resize a block image while a guest is running.
1437 # Either @device or @node-name must be set but not both.
1439 # @device: the name of the device to get the image resized
1441 # @node-name: graph node name to get the image resized (Since 2.0)
1443 # @size: new image size in bytes
1445 # Returns:
1446 #     - nothing on success
1447 #     - If @device is not a valid block device, DeviceNotFound
1449 # Since: 0.14
1451 # Example:
1453 # -> { "execute": "block_resize",
1454 #      "arguments": { "device": "scratch", "size": 1073741824 } }
1455 # <- { "return": {} }
1457 { 'command': 'block_resize',
1458   'data': { '*device': 'str',
1459             '*node-name': 'str',
1460             'size': 'int' },
1461   'coroutine': true,
1462   'allow-preconfig': true }
1465 # @NewImageMode:
1467 # An enumeration that tells QEMU how to set the backing file path in a
1468 # new image file.
1470 # @existing: QEMU should look for an existing image file.
1472 # @absolute-paths: QEMU should create a new image with absolute paths
1473 #     for the backing file.  If there is no backing file available,
1474 #     the new image will not be backed either.
1476 # Since: 1.1
1478 { 'enum': 'NewImageMode',
1479   'data': [ 'existing', 'absolute-paths' ] }
1482 # @BlockdevSnapshotSync:
1484 # Either @device or @node-name must be set but not both.
1486 # @device: the name of the device to take a snapshot of.
1488 # @node-name: graph node name to generate the snapshot from (Since
1489 #     2.0)
1491 # @snapshot-file: the target of the new overlay image.  If the file
1492 #     exists, or if it is a device, the overlay will be created in the
1493 #     existing file/device.  Otherwise, a new file will be created.
1495 # @snapshot-node-name: the graph node name of the new image (Since
1496 #     2.0)
1498 # @format: the format of the overlay image, default is 'qcow2'.
1500 # @mode: whether and how QEMU should create a new image, default is
1501 #     'absolute-paths'.
1503 { 'struct': 'BlockdevSnapshotSync',
1504   'data': { '*device': 'str', '*node-name': 'str',
1505             'snapshot-file': 'str', '*snapshot-node-name': 'str',
1506             '*format': 'str', '*mode': 'NewImageMode' } }
1509 # @BlockdevSnapshot:
1511 # @node: device or node name that will have a snapshot taken.
1513 # @overlay: reference to the existing block device that will become
1514 #     the overlay of @node, as part of taking the snapshot.  It must
1515 #     not have a current backing file (this can be achieved by passing
1516 #     "backing": null to blockdev-add).
1518 # Since: 2.5
1520 { 'struct': 'BlockdevSnapshot',
1521   'data': { 'node': 'str', 'overlay': 'str' } }
1524 # @BackupPerf:
1526 # Optional parameters for backup.  These parameters don't affect
1527 # functionality, but may significantly affect performance.
1529 # @use-copy-range: Use copy offloading.  Default false.
1531 # @max-workers: Maximum number of parallel requests for the sustained
1532 #     background copying process.  Doesn't influence copy-before-write
1533 #     operations.  Default 64.
1535 # @max-chunk: Maximum request length for the sustained background
1536 #     copying process.  Doesn't influence copy-before-write
1537 #     operations.  0 means unlimited.  If max-chunk is non-zero then
1538 #     it should not be less than job cluster size which is calculated
1539 #     as maximum of target image cluster size and 64k.  Default 0.
1541 # Since: 6.0
1543 { 'struct': 'BackupPerf',
1544   'data': { '*use-copy-range': 'bool',
1545             '*max-workers': 'int', '*max-chunk': 'int64' } }
1548 # @BackupCommon:
1550 # @job-id: identifier for the newly-created block job.  If omitted,
1551 #     the device name will be used.  (Since 2.7)
1553 # @device: the device name or node-name of a root node which should be
1554 #     copied.
1556 # @sync: what parts of the disk image should be copied to the
1557 #     destination (all the disk, only the sectors allocated in the
1558 #     topmost image, from a dirty bitmap, or only new I/O).
1560 # @speed: the maximum speed, in bytes per second.  The default is 0,
1561 #     for unlimited.
1563 # @bitmap: The name of a dirty bitmap to use.  Must be present if sync
1564 #     is "bitmap" or "incremental". Can be present if sync is "full"
1565 #     or "top".  Must not be present otherwise.
1566 #     (Since 2.4 (drive-backup), 3.1 (blockdev-backup))
1568 # @bitmap-mode: Specifies the type of data the bitmap should contain
1569 #     after the operation concludes.  Must be present if a bitmap was
1570 #     provided, Must NOT be present otherwise.  (Since 4.2)
1572 # @compress: true to compress data, if the target format supports it.
1573 #     (default: false) (since 2.8)
1575 # @on-source-error: the action to take on an error on the source,
1576 #     default 'report'.  'stop' and 'enospc' can only be used if the
1577 #     block device supports io-status (see BlockInfo).
1579 # @on-target-error: the action to take on an error on the target,
1580 #     default 'report' (no limitations, since this applies to a
1581 #     different block device than @device).
1583 # @auto-finalize: When false, this job will wait in a PENDING state
1584 #     after it has finished its work, waiting for @block-job-finalize
1585 #     before making any block graph changes.  When true, this job will
1586 #     automatically perform its abort or commit actions.  Defaults to
1587 #     true.  (Since 2.12)
1589 # @auto-dismiss: When false, this job will wait in a CONCLUDED state
1590 #     after it has completely ceased all work, and awaits
1591 #     @block-job-dismiss.  When true, this job will automatically
1592 #     disappear from the query list without user intervention.
1593 #     Defaults to true.  (Since 2.12)
1595 # @filter-node-name: the node name that should be assigned to the
1596 #     filter driver that the backup job inserts into the graph above
1597 #     node specified by @drive.  If this option is not given, a node
1598 #     name is autogenerated.  (Since: 4.2)
1600 # @x-perf: Performance options.  (Since 6.0)
1602 # Features:
1604 # @unstable: Member @x-perf is experimental.
1606 # Note: @on-source-error and @on-target-error only affect background
1607 #     I/O.  If an error occurs during a guest write request, the
1608 #     device's rerror/werror actions will be used.
1610 # Since: 4.2
1612 { 'struct': 'BackupCommon',
1613   'data': { '*job-id': 'str', 'device': 'str',
1614             'sync': 'MirrorSyncMode', '*speed': 'int',
1615             '*bitmap': 'str', '*bitmap-mode': 'BitmapSyncMode',
1616             '*compress': 'bool',
1617             '*on-source-error': 'BlockdevOnError',
1618             '*on-target-error': 'BlockdevOnError',
1619             '*auto-finalize': 'bool', '*auto-dismiss': 'bool',
1620             '*filter-node-name': 'str',
1621             '*x-perf': { 'type': 'BackupPerf',
1622                          'features': [ 'unstable' ] } } }
1625 # @DriveBackup:
1627 # @target: the target of the new image.  If the file exists, or if it
1628 #     is a device, the existing file/device will be used as the new
1629 #     destination.  If it does not exist, a new file will be created.
1631 # @format: the format of the new destination, default is to probe if
1632 #     @mode is 'existing', else the format of the source
1634 # @mode: whether and how QEMU should create a new image, default is
1635 #     'absolute-paths'.
1637 # Since: 1.6
1639 { 'struct': 'DriveBackup',
1640   'base': 'BackupCommon',
1641   'data': { 'target': 'str',
1642             '*format': 'str',
1643             '*mode': 'NewImageMode' } }
1646 # @BlockdevBackup:
1648 # @target: the device name or node-name of the backup target node.
1650 # Since: 2.3
1652 { 'struct': 'BlockdevBackup',
1653   'base': 'BackupCommon',
1654   'data': { 'target': 'str' } }
1657 # @blockdev-snapshot-sync:
1659 # Takes a synchronous snapshot of a block device.
1661 # For the arguments, see the documentation of BlockdevSnapshotSync.
1663 # Returns:
1664 #     - nothing on success
1665 #     - If @device is not a valid block device, DeviceNotFound
1667 # Since: 0.14
1669 # Example:
1671 # -> { "execute": "blockdev-snapshot-sync",
1672 #      "arguments": { "device": "ide-hd0",
1673 #                     "snapshot-file":
1674 #                     "/some/place/my-image",
1675 #                     "format": "qcow2" } }
1676 # <- { "return": {} }
1678 { 'command': 'blockdev-snapshot-sync',
1679   'data': 'BlockdevSnapshotSync',
1680   'allow-preconfig': true }
1683 # @blockdev-snapshot:
1685 # Takes a snapshot of a block device.
1687 # Take a snapshot, by installing 'node' as the backing image of
1688 # 'overlay'. Additionally, if 'node' is associated with a block
1689 # device, the block device changes to using 'overlay' as its new
1690 # active image.
1692 # For the arguments, see the documentation of BlockdevSnapshot.
1694 # Features:
1696 # @allow-write-only-overlay: If present, the check whether this
1697 #     operation is safe was relaxed so that it can be used to change
1698 #     backing file of a destination of a blockdev-mirror.  (since 5.0)
1700 # Since: 2.5
1702 # Example:
1704 # -> { "execute": "blockdev-add",
1705 #      "arguments": { "driver": "qcow2",
1706 #                     "node-name": "node1534",
1707 #                     "file": { "driver": "file",
1708 #                               "filename": "hd1.qcow2" },
1709 #                     "backing": null } }
1711 # <- { "return": {} }
1713 # -> { "execute": "blockdev-snapshot",
1714 #      "arguments": { "node": "ide-hd0",
1715 #                     "overlay": "node1534" } }
1716 # <- { "return": {} }
1718 { 'command': 'blockdev-snapshot',
1719   'data': 'BlockdevSnapshot',
1720   'features': [ 'allow-write-only-overlay' ],
1721   'allow-preconfig': true }
1724 # @change-backing-file:
1726 # Change the backing file in the image file metadata.  This does not
1727 # cause QEMU to reopen the image file to reparse the backing filename
1728 # (it may, however, perform a reopen to change permissions from r/o ->
1729 # r/w -> r/o, if needed). The new backing file string is written into
1730 # the image file metadata, and the QEMU internal strings are updated.
1732 # @image-node-name: The name of the block driver state node of the
1733 #     image to modify.  The "device" argument is used to verify
1734 #     "image-node-name" is in the chain described by "device".
1736 # @device: The device name or node-name of the root node that owns
1737 #     image-node-name.
1739 # @backing-file: The string to write as the backing file.  This string
1740 #     is not validated, so care should be taken when specifying the
1741 #     string or the image chain may not be able to be reopened again.
1743 # Returns:
1744 #     - Nothing on success
1745 #     - If "device" does not exist or cannot be determined,
1746 #       DeviceNotFound
1748 # Since: 2.1
1750 { 'command': 'change-backing-file',
1751   'data': { 'device': 'str', 'image-node-name': 'str',
1752             'backing-file': 'str' },
1753   'allow-preconfig': true }
1756 # @block-commit:
1758 # Live commit of data from overlay image nodes into backing nodes -
1759 # i.e., writes data between 'top' and 'base' into 'base'.
1761 # If top == base, that is an error.  If top has no overlays on top of
1762 # it, or if it is in use by a writer, the job will not be completed by
1763 # itself.  The user needs to complete the job with the
1764 # block-job-complete command after getting the ready event.  (Since
1765 # 2.0)
1767 # If the base image is smaller than top, then the base image will be
1768 # resized to be the same size as top.  If top is smaller than the base
1769 # image, the base will not be truncated.  If you want the base image
1770 # size to match the size of the smaller top, you can safely truncate
1771 # it yourself once the commit operation successfully completes.
1773 # @job-id: identifier for the newly-created block job.  If omitted,
1774 #     the device name will be used.  (Since 2.7)
1776 # @device: the device name or node-name of a root node
1778 # @base-node: The node name of the backing image to write data into.
1779 #     If not specified, this is the deepest backing image.
1780 #     (since: 3.1)
1782 # @base: Same as @base-node, except that it is a file name rather than
1783 #     a node name.  This must be the exact filename string that was
1784 #     used to open the node; other strings, even if addressing the
1785 #     same file, are not accepted
1787 # @top-node: The node name of the backing image within the image chain
1788 #     which contains the topmost data to be committed down.  If not
1789 #     specified, this is the active layer.  (since: 3.1)
1791 # @top: Same as @top-node, except that it is a file name rather than a
1792 #     node name.  This must be the exact filename string that was used
1793 #     to open the node; other strings, even if addressing the same
1794 #     file, are not accepted
1796 # @backing-file: The backing file string to write into the overlay
1797 #     image of 'top'.  If 'top' does not have an overlay image, or if
1798 #     'top' is in use by a writer, specifying a backing file string is
1799 #     an error.
1801 #     This filename is not validated.  If a pathname string is such
1802 #     that it cannot be resolved by QEMU, that means that subsequent
1803 #     QMP or HMP commands must use node-names for the image in
1804 #     question, as filename lookup methods will fail.
1806 #     If not specified, QEMU will automatically determine the backing
1807 #     file string to use, or error out if there is no obvious choice.
1808 #     Care should be taken when specifying the string, to specify a
1809 #     valid filename or protocol.  (Since 2.1)
1811 # @backing-mask-protocol: If true, replace any protocol mentioned in the
1812 #     'backing file format' with 'raw', rather than storing the protocol
1813 #     name as the backing format.  Can be used even when no image header
1814 #     will be updated (default false; since 9.0).
1816 # @speed: the maximum speed, in bytes per second
1818 # @on-error: the action to take on an error.  'ignore' means that the
1819 #     request should be retried.  (default: report; Since: 5.0)
1821 # @filter-node-name: the node name that should be assigned to the
1822 #     filter driver that the commit job inserts into the graph above
1823 #     @top.  If this option is not given, a node name is
1824 #     autogenerated.  (Since: 2.9)
1826 # @auto-finalize: When false, this job will wait in a PENDING state
1827 #     after it has finished its work, waiting for @block-job-finalize
1828 #     before making any block graph changes.  When true, this job will
1829 #     automatically perform its abort or commit actions.  Defaults to
1830 #     true.  (Since 3.1)
1832 # @auto-dismiss: When false, this job will wait in a CONCLUDED state
1833 #     after it has completely ceased all work, and awaits
1834 #     @block-job-dismiss.  When true, this job will automatically
1835 #     disappear from the query list without user intervention.
1836 #     Defaults to true.  (Since 3.1)
1838 # Features:
1840 # @deprecated: Members @base and @top are deprecated.  Use @base-node
1841 #     and @top-node instead.
1843 # Returns:
1844 #     - Nothing on success
1845 #     - If @device does not exist, DeviceNotFound
1846 #     - Any other error returns a GenericError.
1848 # Since: 1.3
1850 # Example:
1852 # -> { "execute": "block-commit",
1853 #      "arguments": { "device": "virtio0",
1854 #                     "top": "/tmp/snap1.qcow2" } }
1855 # <- { "return": {} }
1857 { 'command': 'block-commit',
1858   'data': { '*job-id': 'str', 'device': 'str', '*base-node': 'str',
1859             '*base': { 'type': 'str', 'features': [ 'deprecated' ] },
1860             '*top-node': 'str',
1861             '*top': { 'type': 'str', 'features': [ 'deprecated' ] },
1862             '*backing-file': 'str', '*backing-mask-protocol': 'bool',
1863             '*speed': 'int',
1864             '*on-error': 'BlockdevOnError',
1865             '*filter-node-name': 'str',
1866             '*auto-finalize': 'bool', '*auto-dismiss': 'bool' },
1867   'allow-preconfig': true }
1870 # @drive-backup:
1872 # Start a point-in-time copy of a block device to a new destination.
1873 # The status of ongoing drive-backup operations can be checked with
1874 # query-block-jobs where the BlockJobInfo.type field has the value
1875 # 'backup'. The operation can be stopped before it has completed using
1876 # the block-job-cancel command.
1878 # Features:
1880 # @deprecated: This command is deprecated.  Use @blockdev-backup
1881 #     instead.
1883 # Returns:
1884 #     - nothing on success
1885 #     - If @device is not a valid block device, GenericError
1887 # Since: 1.6
1889 # Example:
1891 # -> { "execute": "drive-backup",
1892 #      "arguments": { "device": "drive0",
1893 #                     "sync": "full",
1894 #                     "target": "backup.img" } }
1895 # <- { "return": {} }
1897 { 'command': 'drive-backup', 'boxed': true,
1898   'data': 'DriveBackup', 'features': ['deprecated'],
1899   'allow-preconfig': true }
1902 # @blockdev-backup:
1904 # Start a point-in-time copy of a block device to a new destination.
1905 # The status of ongoing blockdev-backup operations can be checked with
1906 # query-block-jobs where the BlockJobInfo.type field has the value
1907 # 'backup'. The operation can be stopped before it has completed using
1908 # the block-job-cancel command.
1910 # Returns:
1911 #     - nothing on success
1912 #     - If @device is not a valid block device, DeviceNotFound
1914 # Since: 2.3
1916 # Example:
1918 # -> { "execute": "blockdev-backup",
1919 #      "arguments": { "device": "src-id",
1920 #                     "sync": "full",
1921 #                     "target": "tgt-id" } }
1922 # <- { "return": {} }
1924 { 'command': 'blockdev-backup', 'boxed': true,
1925   'data': 'BlockdevBackup',
1926   'allow-preconfig': true }
1929 # @query-named-block-nodes:
1931 # Get the named block driver list
1933 # @flat: Omit the nested data about backing image ("backing-image"
1934 #     key) if true.  Default is false (Since 5.0)
1936 # Returns: the list of BlockDeviceInfo
1938 # Since: 2.0
1940 # Example:
1942 # -> { "execute": "query-named-block-nodes" }
1943 # <- { "return": [ { "ro":false,
1944 #                    "drv":"qcow2",
1945 #                    "encrypted":false,
1946 #                    "file":"disks/test.qcow2",
1947 #                    "node-name": "my-node",
1948 #                    "backing_file_depth":1,
1949 #                    "detect_zeroes":"off",
1950 #                    "bps":1000000,
1951 #                    "bps_rd":0,
1952 #                    "bps_wr":0,
1953 #                    "iops":1000000,
1954 #                    "iops_rd":0,
1955 #                    "iops_wr":0,
1956 #                    "bps_max": 8000000,
1957 #                    "bps_rd_max": 0,
1958 #                    "bps_wr_max": 0,
1959 #                    "iops_max": 0,
1960 #                    "iops_rd_max": 0,
1961 #                    "iops_wr_max": 0,
1962 #                    "iops_size": 0,
1963 #                    "write_threshold": 0,
1964 #                    "image":{
1965 #                       "filename":"disks/test.qcow2",
1966 #                       "format":"qcow2",
1967 #                       "virtual-size":2048000,
1968 #                       "backing_file":"base.qcow2",
1969 #                       "full-backing-filename":"disks/base.qcow2",
1970 #                       "backing-filename-format":"qcow2",
1971 #                       "snapshots":[
1972 #                          {
1973 #                             "id": "1",
1974 #                             "name": "snapshot1",
1975 #                             "vm-state-size": 0,
1976 #                             "date-sec": 10000200,
1977 #                             "date-nsec": 12,
1978 #                             "vm-clock-sec": 206,
1979 #                             "vm-clock-nsec": 30
1980 #                          }
1981 #                       ],
1982 #                       "backing-image":{
1983 #                           "filename":"disks/base.qcow2",
1984 #                           "format":"qcow2",
1985 #                           "virtual-size":2048000
1986 #                       }
1987 #                    } } ] }
1989 { 'command': 'query-named-block-nodes',
1990   'returns': [ 'BlockDeviceInfo' ],
1991   'data': { '*flat': 'bool' },
1992   'allow-preconfig': true }
1995 # @XDbgBlockGraphNodeType:
1997 # @block-backend: corresponds to BlockBackend
1999 # @block-job: corresponds to BlockJob
2001 # @block-driver: corresponds to BlockDriverState
2003 # Since: 4.0
2005 { 'enum': 'XDbgBlockGraphNodeType',
2006   'data': [ 'block-backend', 'block-job', 'block-driver' ] }
2009 # @XDbgBlockGraphNode:
2011 # @id: Block graph node identifier.  This @id is generated only for
2012 #     x-debug-query-block-graph and does not relate to any other
2013 #     identifiers in Qemu.
2015 # @type: Type of graph node.  Can be one of block-backend, block-job
2016 #     or block-driver-state.
2018 # @name: Human readable name of the node.  Corresponds to node-name
2019 #     for block-driver-state nodes; is not guaranteed to be unique in
2020 #     the whole graph (with block-jobs and block-backends).
2022 # Since: 4.0
2024 { 'struct': 'XDbgBlockGraphNode',
2025   'data': { 'id': 'uint64', 'type': 'XDbgBlockGraphNodeType', 'name': 'str' } }
2028 # @BlockPermission:
2030 # Enum of base block permissions.
2032 # @consistent-read: A user that has the "permission" of consistent
2033 #     reads is guaranteed that their view of the contents of the block
2034 #     device is complete and self-consistent, representing the
2035 #     contents of a disk at a specific point.  For most block devices
2036 #     (including their backing files) this is true, but the property
2037 #     cannot be maintained in a few situations like for intermediate
2038 #     nodes of a commit block job.
2040 # @write: This permission is required to change the visible disk
2041 #     contents.
2043 # @write-unchanged: This permission (which is weaker than
2044 #     BLK_PERM_WRITE) is both enough and required for writes to the
2045 #     block node when the caller promises that the visible disk
2046 #     content doesn't change.  As the BLK_PERM_WRITE permission is
2047 #     strictly stronger, either is sufficient to perform an unchanging
2048 #     write.
2050 # @resize: This permission is required to change the size of a block
2051 #     node.
2053 # Since: 4.0
2055 { 'enum': 'BlockPermission',
2056   'data': [ 'consistent-read', 'write', 'write-unchanged', 'resize' ] }
2059 # @XDbgBlockGraphEdge:
2061 # Block Graph edge description for x-debug-query-block-graph.
2063 # @parent: parent id
2065 # @child: child id
2067 # @name: name of the relation (examples are 'file' and 'backing')
2069 # @perm: granted permissions for the parent operating on the child
2071 # @shared-perm: permissions that can still be granted to other users
2072 #     of the child while it is still attached to this parent
2074 # Since: 4.0
2076 { 'struct': 'XDbgBlockGraphEdge',
2077   'data': { 'parent': 'uint64', 'child': 'uint64',
2078             'name': 'str', 'perm': [ 'BlockPermission' ],
2079             'shared-perm': [ 'BlockPermission' ] } }
2082 # @XDbgBlockGraph:
2084 # Block Graph - list of nodes and list of edges.
2086 # Since: 4.0
2088 { 'struct': 'XDbgBlockGraph',
2089   'data': { 'nodes': ['XDbgBlockGraphNode'], 'edges': ['XDbgBlockGraphEdge'] } }
2092 # @x-debug-query-block-graph:
2094 # Get the block graph.
2096 # Features:
2098 # @unstable: This command is meant for debugging.
2100 # Since: 4.0
2102 { 'command': 'x-debug-query-block-graph', 'returns': 'XDbgBlockGraph',
2103   'features': [ 'unstable' ],
2104   'allow-preconfig': true }
2107 # @drive-mirror:
2109 # Start mirroring a block device's writes to a new destination.
2110 # target specifies the target of the new image.  If the file exists,
2111 # or if it is a device, it will be used as the new destination for
2112 # writes.  If it does not exist, a new file will be created.  format
2113 # specifies the format of the mirror image, default is to probe if
2114 # mode='existing', else the format of the source.
2116 # Returns:
2117 #     - nothing on success
2118 #     - If @device is not a valid block device, GenericError
2120 # Since: 1.3
2122 # Example:
2124 # -> { "execute": "drive-mirror",
2125 #      "arguments": { "device": "ide-hd0",
2126 #                     "target": "/some/place/my-image",
2127 #                     "sync": "full",
2128 #                     "format": "qcow2" } }
2129 # <- { "return": {} }
2131 { 'command': 'drive-mirror', 'boxed': true,
2132   'data': 'DriveMirror',
2133   'allow-preconfig': true }
2136 # @DriveMirror:
2138 # A set of parameters describing drive mirror setup.
2140 # @job-id: identifier for the newly-created block job.  If omitted,
2141 #     the device name will be used.  (Since 2.7)
2143 # @device: the device name or node-name of a root node whose writes
2144 #     should be mirrored.
2146 # @target: the target of the new image.  If the file exists, or if it
2147 #     is a device, the existing file/device will be used as the new
2148 #     destination.  If it does not exist, a new file will be created.
2150 # @format: the format of the new destination, default is to probe if
2151 #     @mode is 'existing', else the format of the source
2153 # @node-name: the new block driver state node name in the graph (Since
2154 #     2.1)
2156 # @replaces: with sync=full graph node name to be replaced by the new
2157 #     image when a whole image copy is done.  This can be used to
2158 #     repair broken Quorum files.  By default, @device is replaced,
2159 #     although implicitly created filters on it are kept.  (Since 2.1)
2161 # @mode: whether and how QEMU should create a new image, default is
2162 #     'absolute-paths'.
2164 # @speed: the maximum speed, in bytes per second
2166 # @sync: what parts of the disk image should be copied to the
2167 #     destination (all the disk, only the sectors allocated in the
2168 #     topmost image, or only new I/O).
2170 # @granularity: granularity of the dirty bitmap, default is 64K if the
2171 #     image format doesn't have clusters, 4K if the clusters are
2172 #     smaller than that, else the cluster size.  Must be a power of 2
2173 #     between 512 and 64M (since 1.4).
2175 # @buf-size: maximum amount of data in flight from source to target
2176 #     (since 1.4).
2178 # @on-source-error: the action to take on an error on the source,
2179 #     default 'report'.  'stop' and 'enospc' can only be used if the
2180 #     block device supports io-status (see BlockInfo).
2182 # @on-target-error: the action to take on an error on the target,
2183 #     default 'report' (no limitations, since this applies to a
2184 #     different block device than @device).
2186 # @unmap: Whether to try to unmap target sectors where source has only
2187 #     zero.  If true, and target unallocated sectors will read as
2188 #     zero, target image sectors will be unmapped; otherwise, zeroes
2189 #     will be written.  Both will result in identical contents.
2190 #     Default is true.  (Since 2.4)
2192 # @copy-mode: when to copy data to the destination; defaults to
2193 #     'background' (Since: 3.0)
2195 # @auto-finalize: When false, this job will wait in a PENDING state
2196 #     after it has finished its work, waiting for @block-job-finalize
2197 #     before making any block graph changes.  When true, this job will
2198 #     automatically perform its abort or commit actions.  Defaults to
2199 #     true.  (Since 3.1)
2201 # @auto-dismiss: When false, this job will wait in a CONCLUDED state
2202 #     after it has completely ceased all work, and awaits
2203 #     @block-job-dismiss.  When true, this job will automatically
2204 #     disappear from the query list without user intervention.
2205 #     Defaults to true.  (Since 3.1)
2207 # Since: 1.3
2209 { 'struct': 'DriveMirror',
2210   'data': { '*job-id': 'str', 'device': 'str', 'target': 'str',
2211             '*format': 'str', '*node-name': 'str', '*replaces': 'str',
2212             'sync': 'MirrorSyncMode', '*mode': 'NewImageMode',
2213             '*speed': 'int', '*granularity': 'uint32',
2214             '*buf-size': 'int', '*on-source-error': 'BlockdevOnError',
2215             '*on-target-error': 'BlockdevOnError',
2216             '*unmap': 'bool', '*copy-mode': 'MirrorCopyMode',
2217             '*auto-finalize': 'bool', '*auto-dismiss': 'bool' } }
2220 # @BlockDirtyBitmap:
2222 # @node: name of device/node which the bitmap is tracking
2224 # @name: name of the dirty bitmap
2226 # Since: 2.4
2228 { 'struct': 'BlockDirtyBitmap',
2229   'data': { 'node': 'str', 'name': 'str' } }
2232 # @BlockDirtyBitmapAdd:
2234 # @node: name of device/node which the bitmap is tracking
2236 # @name: name of the dirty bitmap (must be less than 1024 bytes)
2238 # @granularity: the bitmap granularity, default is 64k for
2239 #     block-dirty-bitmap-add
2241 # @persistent: the bitmap is persistent, i.e. it will be saved to the
2242 #     corresponding block device image file on its close.  For now
2243 #     only Qcow2 disks support persistent bitmaps.  Default is false
2244 #     for block-dirty-bitmap-add.  (Since: 2.10)
2246 # @disabled: the bitmap is created in the disabled state, which means
2247 #     that it will not track drive changes.  The bitmap may be enabled
2248 #     with block-dirty-bitmap-enable.  Default is false.  (Since: 4.0)
2250 # Since: 2.4
2252 { 'struct': 'BlockDirtyBitmapAdd',
2253   'data': { 'node': 'str', 'name': 'str', '*granularity': 'uint32',
2254             '*persistent': 'bool', '*disabled': 'bool' } }
2257 # @BlockDirtyBitmapOrStr:
2259 # @local: name of the bitmap, attached to the same node as target
2260 #     bitmap.
2262 # @external: bitmap with specified node
2264 # Since: 4.1
2266 { 'alternate': 'BlockDirtyBitmapOrStr',
2267   'data': { 'local': 'str',
2268             'external': 'BlockDirtyBitmap' } }
2271 # @BlockDirtyBitmapMerge:
2273 # @node: name of device/node which the @target bitmap is tracking
2275 # @target: name of the destination dirty bitmap
2277 # @bitmaps: name(s) of the source dirty bitmap(s) at @node and/or
2278 #     fully specified BlockDirtyBitmap elements.  The latter are
2279 #     supported since 4.1.
2281 # Since: 4.0
2283 { 'struct': 'BlockDirtyBitmapMerge',
2284   'data': { 'node': 'str', 'target': 'str',
2285             'bitmaps': ['BlockDirtyBitmapOrStr'] } }
2288 # @block-dirty-bitmap-add:
2290 # Create a dirty bitmap with a name on the node, and start tracking
2291 # the writes.
2293 # Returns:
2294 #     - nothing on success
2295 #     - If @node is not a valid block device or node, DeviceNotFound
2296 #     - If @name is already taken, GenericError with an explanation
2298 # Since: 2.4
2300 # Example:
2302 # -> { "execute": "block-dirty-bitmap-add",
2303 #      "arguments": { "node": "drive0", "name": "bitmap0" } }
2304 # <- { "return": {} }
2306 { 'command': 'block-dirty-bitmap-add',
2307   'data': 'BlockDirtyBitmapAdd',
2308   'allow-preconfig': true }
2311 # @block-dirty-bitmap-remove:
2313 # Stop write tracking and remove the dirty bitmap that was created
2314 # with block-dirty-bitmap-add.  If the bitmap is persistent, remove it
2315 # from its storage too.
2317 # Returns:
2318 #     - nothing on success
2319 #     - If @node is not a valid block device or node, DeviceNotFound
2320 #     - If @name is not found, GenericError with an explanation
2321 #     - if @name is frozen by an operation, GenericError
2323 # Since: 2.4
2325 # Example:
2327 # -> { "execute": "block-dirty-bitmap-remove",
2328 #      "arguments": { "node": "drive0", "name": "bitmap0" } }
2329 # <- { "return": {} }
2331 { 'command': 'block-dirty-bitmap-remove',
2332   'data': 'BlockDirtyBitmap',
2333   'allow-preconfig': true }
2336 # @block-dirty-bitmap-clear:
2338 # Clear (reset) a dirty bitmap on the device, so that an incremental
2339 # backup from this point in time forward will only backup clusters
2340 # modified after this clear operation.
2342 # Returns:
2343 #     - nothing on success
2344 #     - If @node is not a valid block device, DeviceNotFound
2345 #     - If @name is not found, GenericError with an explanation
2347 # Since: 2.4
2349 # Example:
2351 # -> { "execute": "block-dirty-bitmap-clear",
2352 #      "arguments": { "node": "drive0", "name": "bitmap0" } }
2353 # <- { "return": {} }
2355 { 'command': 'block-dirty-bitmap-clear',
2356   'data': 'BlockDirtyBitmap',
2357   'allow-preconfig': true }
2360 # @block-dirty-bitmap-enable:
2362 # Enables a dirty bitmap so that it will begin tracking disk changes.
2364 # Returns:
2365 #     - nothing on success
2366 #     - If @node is not a valid block device, DeviceNotFound
2367 #     - If @name is not found, GenericError with an explanation
2369 # Since: 4.0
2371 # Example:
2373 # -> { "execute": "block-dirty-bitmap-enable",
2374 #      "arguments": { "node": "drive0", "name": "bitmap0" } }
2375 # <- { "return": {} }
2377 { 'command': 'block-dirty-bitmap-enable',
2378   'data': 'BlockDirtyBitmap',
2379   'allow-preconfig': true }
2382 # @block-dirty-bitmap-disable:
2384 # Disables a dirty bitmap so that it will stop tracking disk changes.
2386 # Returns:
2387 #     - nothing on success
2388 #     - If @node is not a valid block device, DeviceNotFound
2389 #     - If @name is not found, GenericError with an explanation
2391 # Since: 4.0
2393 # Example:
2395 # -> { "execute": "block-dirty-bitmap-disable",
2396 #      "arguments": { "node": "drive0", "name": "bitmap0" } }
2397 # <- { "return": {} }
2399 { 'command': 'block-dirty-bitmap-disable',
2400   'data': 'BlockDirtyBitmap',
2401   'allow-preconfig': true }
2404 # @block-dirty-bitmap-merge:
2406 # Merge dirty bitmaps listed in @bitmaps to the @target dirty bitmap.
2407 # Dirty bitmaps in @bitmaps will be unchanged, except if it also
2408 # appears as the @target bitmap.  Any bits already set in @target will
2409 # still be set after the merge, i.e., this operation does not clear
2410 # the target.  On error, @target is unchanged.
2412 # The resulting bitmap will count as dirty any clusters that were
2413 # dirty in any of the source bitmaps.  This can be used to achieve
2414 # backup checkpoints, or in simpler usages, to copy bitmaps.
2416 # Returns:
2417 #     - nothing on success
2418 #     - If @node is not a valid block device, DeviceNotFound
2419 #     - If any bitmap in @bitmaps or @target is not found,
2420 #       GenericError
2421 #     - If any of the bitmaps have different sizes or granularities,
2422 #       GenericError
2424 # Since: 4.0
2426 # Example:
2428 # -> { "execute": "block-dirty-bitmap-merge",
2429 #      "arguments": { "node": "drive0", "target": "bitmap0",
2430 #                     "bitmaps": ["bitmap1"] } }
2431 # <- { "return": {} }
2433 { 'command': 'block-dirty-bitmap-merge',
2434   'data': 'BlockDirtyBitmapMerge',
2435   'allow-preconfig': true }
2438 # @BlockDirtyBitmapSha256:
2440 # SHA256 hash of dirty bitmap data
2442 # @sha256: ASCII representation of SHA256 bitmap hash
2444 # Since: 2.10
2446 { 'struct': 'BlockDirtyBitmapSha256',
2447   'data': {'sha256': 'str'} }
2450 # @x-debug-block-dirty-bitmap-sha256:
2452 # Get bitmap SHA256.
2454 # Features:
2456 # @unstable: This command is meant for debugging.
2458 # Returns:
2459 #     - BlockDirtyBitmapSha256 on success
2460 #     - If @node is not a valid block device, DeviceNotFound
2461 #     - If @name is not found or if hashing has failed, GenericError
2462 #       with an explanation
2464 # Since: 2.10
2466 { 'command': 'x-debug-block-dirty-bitmap-sha256',
2467   'data': 'BlockDirtyBitmap', 'returns': 'BlockDirtyBitmapSha256',
2468   'features': [ 'unstable' ],
2469   'allow-preconfig': true }
2472 # @blockdev-mirror:
2474 # Start mirroring a block device's writes to a new destination.
2476 # @job-id: identifier for the newly-created block job.  If omitted,
2477 #     the device name will be used.  (Since 2.7)
2479 # @device: The device name or node-name of a root node whose writes
2480 #     should be mirrored.
2482 # @target: the id or node-name of the block device to mirror to.  This
2483 #     mustn't be attached to guest.
2485 # @replaces: with sync=full graph node name to be replaced by the new
2486 #     image when a whole image copy is done.  This can be used to
2487 #     repair broken Quorum files.  By default, @device is replaced,
2488 #     although implicitly created filters on it are kept.
2490 # @speed: the maximum speed, in bytes per second
2492 # @sync: what parts of the disk image should be copied to the
2493 #     destination (all the disk, only the sectors allocated in the
2494 #     topmost image, or only new I/O).
2496 # @granularity: granularity of the dirty bitmap, default is 64K if the
2497 #     image format doesn't have clusters, 4K if the clusters are
2498 #     smaller than that, else the cluster size.  Must be a power of 2
2499 #     between 512 and 64M
2501 # @buf-size: maximum amount of data in flight from source to target
2503 # @on-source-error: the action to take on an error on the source,
2504 #     default 'report'.  'stop' and 'enospc' can only be used if the
2505 #     block device supports io-status (see BlockInfo).
2507 # @on-target-error: the action to take on an error on the target,
2508 #     default 'report' (no limitations, since this applies to a
2509 #     different block device than @device).
2511 # @filter-node-name: the node name that should be assigned to the
2512 #     filter driver that the mirror job inserts into the graph above
2513 #     @device.  If this option is not given, a node name is
2514 #     autogenerated.  (Since: 2.9)
2516 # @copy-mode: when to copy data to the destination; defaults to
2517 #     'background' (Since: 3.0)
2519 # @auto-finalize: When false, this job will wait in a PENDING state
2520 #     after it has finished its work, waiting for @block-job-finalize
2521 #     before making any block graph changes.  When true, this job will
2522 #     automatically perform its abort or commit actions.  Defaults to
2523 #     true.  (Since 3.1)
2525 # @auto-dismiss: When false, this job will wait in a CONCLUDED state
2526 #     after it has completely ceased all work, and awaits
2527 #     @block-job-dismiss.  When true, this job will automatically
2528 #     disappear from the query list without user intervention.
2529 #     Defaults to true.  (Since 3.1)
2531 # Returns: nothing on success.
2533 # Since: 2.6
2535 # Example:
2537 # -> { "execute": "blockdev-mirror",
2538 #      "arguments": { "device": "ide-hd0",
2539 #                     "target": "target0",
2540 #                     "sync": "full" } }
2541 # <- { "return": {} }
2543 { 'command': 'blockdev-mirror',
2544   'data': { '*job-id': 'str', 'device': 'str', 'target': 'str',
2545             '*replaces': 'str',
2546             'sync': 'MirrorSyncMode',
2547             '*speed': 'int', '*granularity': 'uint32',
2548             '*buf-size': 'int', '*on-source-error': 'BlockdevOnError',
2549             '*on-target-error': 'BlockdevOnError',
2550             '*filter-node-name': 'str',
2551             '*copy-mode': 'MirrorCopyMode',
2552             '*auto-finalize': 'bool', '*auto-dismiss': 'bool' },
2553   'allow-preconfig': true }
2556 # @BlockIOThrottle:
2558 # A set of parameters describing block throttling.
2560 # @device: Block device name
2562 # @id: The name or QOM path of the guest device (since: 2.8)
2564 # @bps: total throughput limit in bytes per second
2566 # @bps_rd: read throughput limit in bytes per second
2568 # @bps_wr: write throughput limit in bytes per second
2570 # @iops: total I/O operations per second
2572 # @iops_rd: read I/O operations per second
2574 # @iops_wr: write I/O operations per second
2576 # @bps_max: total throughput limit during bursts, in bytes (Since 1.7)
2578 # @bps_rd_max: read throughput limit during bursts, in bytes (Since
2579 #     1.7)
2581 # @bps_wr_max: write throughput limit during bursts, in bytes (Since
2582 #     1.7)
2584 # @iops_max: total I/O operations per second during bursts, in bytes
2585 #     (Since 1.7)
2587 # @iops_rd_max: read I/O operations per second during bursts, in bytes
2588 #     (Since 1.7)
2590 # @iops_wr_max: write I/O operations per second during bursts, in
2591 #     bytes (Since 1.7)
2593 # @bps_max_length: maximum length of the @bps_max burst period, in
2594 #     seconds.  It must only be set if @bps_max is set as well.
2595 #     Defaults to 1. (Since 2.6)
2597 # @bps_rd_max_length: maximum length of the @bps_rd_max burst period,
2598 #     in seconds.  It must only be set if @bps_rd_max is set as well.
2599 #     Defaults to 1. (Since 2.6)
2601 # @bps_wr_max_length: maximum length of the @bps_wr_max burst period,
2602 #     in seconds.  It must only be set if @bps_wr_max is set as well.
2603 #     Defaults to 1. (Since 2.6)
2605 # @iops_max_length: maximum length of the @iops burst period, in
2606 #     seconds.  It must only be set if @iops_max is set as well.
2607 #     Defaults to 1. (Since 2.6)
2609 # @iops_rd_max_length: maximum length of the @iops_rd_max burst
2610 #     period, in seconds.  It must only be set if @iops_rd_max is set
2611 #     as well.  Defaults to 1. (Since 2.6)
2613 # @iops_wr_max_length: maximum length of the @iops_wr_max burst
2614 #     period, in seconds.  It must only be set if @iops_wr_max is set
2615 #     as well.  Defaults to 1. (Since 2.6)
2617 # @iops_size: an I/O size in bytes (Since 1.7)
2619 # @group: throttle group name (Since 2.4)
2621 # Features:
2623 # @deprecated: Member @device is deprecated.  Use @id instead.
2625 # Since: 1.1
2627 { 'struct': 'BlockIOThrottle',
2628   'data': { '*device': { 'type': 'str', 'features': [ 'deprecated' ] },
2629             '*id': 'str', 'bps': 'int', 'bps_rd': 'int',
2630             'bps_wr': 'int', 'iops': 'int', 'iops_rd': 'int', 'iops_wr': 'int',
2631             '*bps_max': 'int', '*bps_rd_max': 'int',
2632             '*bps_wr_max': 'int', '*iops_max': 'int',
2633             '*iops_rd_max': 'int', '*iops_wr_max': 'int',
2634             '*bps_max_length': 'int', '*bps_rd_max_length': 'int',
2635             '*bps_wr_max_length': 'int', '*iops_max_length': 'int',
2636             '*iops_rd_max_length': 'int', '*iops_wr_max_length': 'int',
2637             '*iops_size': 'int', '*group': 'str' } }
2640 # @ThrottleLimits:
2642 # Limit parameters for throttling.  Since some limit combinations are
2643 # illegal, limits should always be set in one transaction.  All fields
2644 # are optional.  When setting limits, if a field is missing the
2645 # current value is not changed.
2647 # @iops-total: limit total I/O operations per second
2649 # @iops-total-max: I/O operations burst
2651 # @iops-total-max-length: length of the iops-total-max burst period,
2652 #     in seconds It must only be set if @iops-total-max is set as
2653 #     well.
2655 # @iops-read: limit read operations per second
2657 # @iops-read-max: I/O operations read burst
2659 # @iops-read-max-length: length of the iops-read-max burst period, in
2660 #     seconds It must only be set if @iops-read-max is set as well.
2662 # @iops-write: limit write operations per second
2664 # @iops-write-max: I/O operations write burst
2666 # @iops-write-max-length: length of the iops-write-max burst period,
2667 #     in seconds It must only be set if @iops-write-max is set as
2668 #     well.
2670 # @bps-total: limit total bytes per second
2672 # @bps-total-max: total bytes burst
2674 # @bps-total-max-length: length of the bps-total-max burst period, in
2675 #     seconds.  It must only be set if @bps-total-max is set as well.
2677 # @bps-read: limit read bytes per second
2679 # @bps-read-max: total bytes read burst
2681 # @bps-read-max-length: length of the bps-read-max burst period, in
2682 #     seconds It must only be set if @bps-read-max is set as well.
2684 # @bps-write: limit write bytes per second
2686 # @bps-write-max: total bytes write burst
2688 # @bps-write-max-length: length of the bps-write-max burst period, in
2689 #     seconds It must only be set if @bps-write-max is set as well.
2691 # @iops-size: when limiting by iops max size of an I/O in bytes
2693 # Since: 2.11
2695 { 'struct': 'ThrottleLimits',
2696   'data': { '*iops-total' : 'int', '*iops-total-max' : 'int',
2697             '*iops-total-max-length' : 'int', '*iops-read' : 'int',
2698             '*iops-read-max' : 'int', '*iops-read-max-length' : 'int',
2699             '*iops-write' : 'int', '*iops-write-max' : 'int',
2700             '*iops-write-max-length' : 'int', '*bps-total' : 'int',
2701             '*bps-total-max' : 'int', '*bps-total-max-length' : 'int',
2702             '*bps-read' : 'int', '*bps-read-max' : 'int',
2703             '*bps-read-max-length' : 'int', '*bps-write' : 'int',
2704             '*bps-write-max' : 'int', '*bps-write-max-length' : 'int',
2705             '*iops-size' : 'int' } }
2708 # @ThrottleGroupProperties:
2710 # Properties for throttle-group objects.
2712 # @limits: limits to apply for this throttle group
2714 # Features:
2716 # @unstable: All members starting with x- are aliases for the same key
2717 #     without x- in the @limits object.  This is not a stable
2718 #     interface and may be removed or changed incompatibly in the
2719 #     future.  Use @limits for a supported stable interface.
2721 # Since: 2.11
2723 { 'struct': 'ThrottleGroupProperties',
2724   'data': { '*limits': 'ThrottleLimits',
2725             '*x-iops-total': { 'type': 'int',
2726                                'features': [ 'unstable' ] },
2727             '*x-iops-total-max': { 'type': 'int',
2728                                    'features': [ 'unstable' ] },
2729             '*x-iops-total-max-length': { 'type': 'int',
2730                                           'features': [ 'unstable' ] },
2731             '*x-iops-read': { 'type': 'int',
2732                               'features': [ 'unstable' ] },
2733             '*x-iops-read-max': { 'type': 'int',
2734                                   'features': [ 'unstable' ] },
2735             '*x-iops-read-max-length': { 'type': 'int',
2736                                          'features': [ 'unstable' ] },
2737             '*x-iops-write': { 'type': 'int',
2738                                'features': [ 'unstable' ] },
2739             '*x-iops-write-max': { 'type': 'int',
2740                                    'features': [ 'unstable' ] },
2741             '*x-iops-write-max-length': { 'type': 'int',
2742                                           'features': [ 'unstable' ] },
2743             '*x-bps-total': { 'type': 'int',
2744                               'features': [ 'unstable' ] },
2745             '*x-bps-total-max': { 'type': 'int',
2746                                   'features': [ 'unstable' ] },
2747             '*x-bps-total-max-length': { 'type': 'int',
2748                                          'features': [ 'unstable' ] },
2749             '*x-bps-read': { 'type': 'int',
2750                              'features': [ 'unstable' ] },
2751             '*x-bps-read-max': { 'type': 'int',
2752                                  'features': [ 'unstable' ] },
2753             '*x-bps-read-max-length': { 'type': 'int',
2754                                         'features': [ 'unstable' ] },
2755             '*x-bps-write': { 'type': 'int',
2756                               'features': [ 'unstable' ] },
2757             '*x-bps-write-max': { 'type': 'int',
2758                                   'features': [ 'unstable' ] },
2759             '*x-bps-write-max-length': { 'type': 'int',
2760                                          'features': [ 'unstable' ] },
2761             '*x-iops-size': { 'type': 'int',
2762                               'features': [ 'unstable' ] } } }
2765 # @block-stream:
2767 # Copy data from a backing file into a block device.
2769 # The block streaming operation is performed in the background until
2770 # the entire backing file has been copied.  This command returns
2771 # immediately once streaming has started.  The status of ongoing block
2772 # streaming operations can be checked with query-block-jobs.  The
2773 # operation can be stopped before it has completed using the
2774 # block-job-cancel command.
2776 # The node that receives the data is called the top image, can be
2777 # located in any part of the chain (but always above the base image;
2778 # see below) and can be specified using its device or node name.
2779 # Earlier qemu versions only allowed 'device' to name the top level
2780 # node; presence of the 'base-node' parameter during introspection can
2781 # be used as a witness of the enhanced semantics of 'device'.
2783 # If a base file is specified then sectors are not copied from that
2784 # base file and its backing chain.  This can be used to stream a
2785 # subset of the backing file chain instead of flattening the entire
2786 # image.  When streaming completes the image file will have the base
2787 # file as its backing file, unless that node was changed while the job
2788 # was running.  In that case, base's parent's backing (or filtered,
2789 # whichever exists) child (i.e., base at the beginning of the job)
2790 # will be the new backing file.
2792 # On successful completion the image file is updated to drop the
2793 # backing file and the BLOCK_JOB_COMPLETED event is emitted.
2795 # In case @device is a filter node, block-stream modifies the first
2796 # non-filter overlay node below it to point to the new backing node
2797 # instead of modifying @device itself.
2799 # @job-id: identifier for the newly-created block job.  If omitted,
2800 #     the device name will be used.  (Since 2.7)
2802 # @device: the device or node name of the top image
2804 # @base: the common backing file name.  It cannot be set if @base-node
2805 #     or @bottom is also set.
2807 # @base-node: the node name of the backing file.  It cannot be set if
2808 #     @base or @bottom is also set.  (Since 2.8)
2810 # @bottom: the last node in the chain that should be streamed into
2811 #     top.  It cannot be set if @base or @base-node is also set.  It
2812 #     cannot be filter node.  (Since 6.0)
2814 # @backing-file: The backing file string to write into the top image.
2815 #     This filename is not validated.
2817 #     If a pathname string is such that it cannot be resolved by QEMU,
2818 #     that means that subsequent QMP or HMP commands must use
2819 #     node-names for the image in question, as filename lookup methods
2820 #     will fail.
2822 #     If not specified, QEMU will automatically determine the backing
2823 #     file string to use, or error out if there is no obvious choice.
2824 #     Care should be taken when specifying the string, to specify a
2825 #     valid filename or protocol.  (Since 2.1)
2827 # @backing-mask-protocol: If true, replace any protocol mentioned in the
2828 #     'backing file format' with 'raw', rather than storing the protocol
2829 #     name as the backing format.  Can be used even when no image header
2830 #     will be updated (default false; since 9.0).
2832 # @speed: the maximum speed, in bytes per second
2834 # @on-error: the action to take on an error (default report). 'stop'
2835 #     and 'enospc' can only be used if the block device supports
2836 #     io-status (see BlockInfo).  (Since 1.3)
2838 # @filter-node-name: the node name that should be assigned to the
2839 #     filter driver that the stream job inserts into the graph above
2840 #     @device.  If this option is not given, a node name is
2841 #     autogenerated.  (Since: 6.0)
2843 # @auto-finalize: When false, this job will wait in a PENDING state
2844 #     after it has finished its work, waiting for @block-job-finalize
2845 #     before making any block graph changes.  When true, this job will
2846 #     automatically perform its abort or commit actions.  Defaults to
2847 #     true.  (Since 3.1)
2849 # @auto-dismiss: When false, this job will wait in a CONCLUDED state
2850 #     after it has completely ceased all work, and awaits
2851 #     @block-job-dismiss.  When true, this job will automatically
2852 #     disappear from the query list without user intervention.
2853 #     Defaults to true.  (Since 3.1)
2855 # Returns:
2856 #     - Nothing on success.
2857 #     - If @device does not exist, DeviceNotFound.
2859 # Since: 1.1
2861 # Example:
2863 # -> { "execute": "block-stream",
2864 #      "arguments": { "device": "virtio0",
2865 #                     "base": "/tmp/master.qcow2" } }
2866 # <- { "return": {} }
2868 { 'command': 'block-stream',
2869   'data': { '*job-id': 'str', 'device': 'str', '*base': 'str',
2870             '*base-node': 'str', '*backing-file': 'str',
2871             '*backing-mask-protocol': 'bool',
2872             '*bottom': 'str',
2873             '*speed': 'int', '*on-error': 'BlockdevOnError',
2874             '*filter-node-name': 'str',
2875             '*auto-finalize': 'bool', '*auto-dismiss': 'bool' },
2876   'allow-preconfig': true }
2879 # @block-job-set-speed:
2881 # Set maximum speed for a background block operation.
2883 # This command can only be issued when there is an active block job.
2885 # Throttling can be disabled by setting the speed to 0.
2887 # @device: The job identifier.  This used to be a device name (hence
2888 #     the name of the parameter), but since QEMU 2.7 it can have other
2889 #     values.
2891 # @speed: the maximum speed, in bytes per second, or 0 for unlimited.
2892 #     Defaults to 0.
2894 # Returns:
2895 #     - Nothing on success
2896 #     - If no background operation is active on this device,
2897 #       DeviceNotActive
2899 # Since: 1.1
2901 { 'command': 'block-job-set-speed',
2902   'data': { 'device': 'str', 'speed': 'int' },
2903   'allow-preconfig': true }
2906 # @block-job-cancel:
2908 # Stop an active background block operation.
2910 # This command returns immediately after marking the active background
2911 # block operation for cancellation.  It is an error to call this
2912 # command if no operation is in progress.
2914 # The operation will cancel as soon as possible and then emit the
2915 # BLOCK_JOB_CANCELLED event.  Before that happens the job is still
2916 # visible when enumerated using query-block-jobs.
2918 # Note that if you issue 'block-job-cancel' after 'drive-mirror' has
2919 # indicated (via the event BLOCK_JOB_READY) that the source and
2920 # destination are synchronized, then the event triggered by this
2921 # command changes to BLOCK_JOB_COMPLETED, to indicate that the
2922 # mirroring has ended and the destination now has a point-in-time copy
2923 # tied to the time of the cancellation.
2925 # For streaming, the image file retains its backing file unless the
2926 # streaming operation happens to complete just as it is being
2927 # cancelled.  A new streaming operation can be started at a later time
2928 # to finish copying all data from the backing file.
2930 # @device: The job identifier.  This used to be a device name (hence
2931 #     the name of the parameter), but since QEMU 2.7 it can have other
2932 #     values.
2934 # @force: If true, and the job has already emitted the event
2935 #     BLOCK_JOB_READY, abandon the job immediately (even if it is
2936 #     paused) instead of waiting for the destination to complete its
2937 #     final synchronization (since 1.3)
2939 # Returns:
2940 #     - Nothing on success
2941 #     - If no background operation is active on this device,
2942 #       DeviceNotActive
2944 # Since: 1.1
2946 { 'command': 'block-job-cancel', 'data': { 'device': 'str', '*force': 'bool' },
2947   'allow-preconfig': true }
2950 # @block-job-pause:
2952 # Pause an active background block operation.
2954 # This command returns immediately after marking the active background
2955 # block operation for pausing.  It is an error to call this command if
2956 # no operation is in progress or if the job is already paused.
2958 # The operation will pause as soon as possible.  No event is emitted
2959 # when the operation is actually paused.  Cancelling a paused job
2960 # automatically resumes it.
2962 # @device: The job identifier.  This used to be a device name (hence
2963 #     the name of the parameter), but since QEMU 2.7 it can have other
2964 #     values.
2966 # Returns:
2967 #     - Nothing on success
2968 #     - If no background operation is active on this device,
2969 #       DeviceNotActive
2971 # Since: 1.3
2973 { 'command': 'block-job-pause', 'data': { 'device': 'str' },
2974   'allow-preconfig': true }
2977 # @block-job-resume:
2979 # Resume an active background block operation.
2981 # This command returns immediately after resuming a paused background
2982 # block operation.  It is an error to call this command if no
2983 # operation is in progress or if the job is not paused.
2985 # This command also clears the error status of the job.
2987 # @device: The job identifier.  This used to be a device name (hence
2988 #     the name of the parameter), but since QEMU 2.7 it can have other
2989 #     values.
2991 # Returns:
2992 #     - Nothing on success
2993 #     - If no background operation is active on this device,
2994 #       DeviceNotActive
2996 # Since: 1.3
2998 { 'command': 'block-job-resume', 'data': { 'device': 'str' },
2999   'allow-preconfig': true }
3002 # @block-job-complete:
3004 # Manually trigger completion of an active background block operation.
3005 # This is supported for drive mirroring, where it also switches the
3006 # device to write to the target path only.  The ability to complete is
3007 # signaled with a BLOCK_JOB_READY event.
3009 # This command completes an active background block operation
3010 # synchronously.  The ordering of this command's return with the
3011 # BLOCK_JOB_COMPLETED event is not defined.  Note that if an I/O error
3012 # occurs during the processing of this command: 1) the command itself
3013 # will fail; 2) the error will be processed according to the
3014 # rerror/werror arguments that were specified when starting the
3015 # operation.
3017 # A cancelled or paused job cannot be completed.
3019 # @device: The job identifier.  This used to be a device name (hence
3020 #     the name of the parameter), but since QEMU 2.7 it can have other
3021 #     values.
3023 # Returns:
3024 #     - Nothing on success
3025 #     - If no background operation is active on this device,
3026 #       DeviceNotActive
3028 # Since: 1.3
3030 { 'command': 'block-job-complete', 'data': { 'device': 'str' },
3031   'allow-preconfig': true }
3034 # @block-job-dismiss:
3036 # For jobs that have already concluded, remove them from the
3037 # block-job-query list.  This command only needs to be run for jobs
3038 # which were started with QEMU 2.12+ job lifetime management
3039 # semantics.
3041 # This command will refuse to operate on any job that has not yet
3042 # reached its terminal state, JOB_STATUS_CONCLUDED. For jobs that make
3043 # use of the BLOCK_JOB_READY event, block-job-cancel or
3044 # block-job-complete will still need to be used as appropriate.
3046 # @id: The job identifier.
3048 # Returns: Nothing on success
3050 # Since: 2.12
3052 { 'command': 'block-job-dismiss', 'data': { 'id': 'str' },
3053   'allow-preconfig': true }
3056 # @block-job-finalize:
3058 # Once a job that has manual=true reaches the pending state, it can be
3059 # instructed to finalize any graph changes and do any necessary
3060 # cleanup via this command.  For jobs in a transaction, instructing
3061 # one job to finalize will force ALL jobs in the transaction to
3062 # finalize, so it is only necessary to instruct a single member job to
3063 # finalize.
3065 # @id: The job identifier.
3067 # Returns: Nothing on success
3069 # Since: 2.12
3071 { 'command': 'block-job-finalize', 'data': { 'id': 'str' },
3072   'allow-preconfig': true }
3075 # @BlockJobChangeOptionsMirror:
3077 # @copy-mode: Switch to this copy mode.  Currently, only the switch
3078 #     from 'background' to 'write-blocking' is implemented.
3080 # Since: 8.2
3082 { 'struct': 'BlockJobChangeOptionsMirror',
3083   'data': { 'copy-mode' : 'MirrorCopyMode' } }
3086 # @BlockJobChangeOptions:
3088 # Block job options that can be changed after job creation.
3090 # @id: The job identifier
3092 # @type: The job type
3094 # Since: 8.2
3096 { 'union': 'BlockJobChangeOptions',
3097   'base': { 'id': 'str', 'type': 'JobType' },
3098   'discriminator': 'type',
3099   'data': { 'mirror': 'BlockJobChangeOptionsMirror' } }
3102 # @block-job-change:
3104 # Change the block job's options.
3106 # Since: 8.2
3108 { 'command': 'block-job-change',
3109   'data': 'BlockJobChangeOptions', 'boxed': true }
3112 # @BlockdevDiscardOptions:
3114 # Determines how to handle discard requests.
3116 # @ignore: Ignore the request
3118 # @unmap: Forward as an unmap request
3120 # Since: 2.9
3122 { 'enum': 'BlockdevDiscardOptions',
3123   'data': [ 'ignore', 'unmap' ] }
3126 # @BlockdevDetectZeroesOptions:
3128 # Describes the operation mode for the automatic conversion of plain
3129 # zero writes by the OS to driver specific optimized zero write
3130 # commands.
3132 # @off: Disabled (default)
3134 # @on: Enabled
3136 # @unmap: Enabled and even try to unmap blocks if possible.  This
3137 #     requires also that @BlockdevDiscardOptions is set to unmap for
3138 #     this device.
3140 # Since: 2.1
3142 { 'enum': 'BlockdevDetectZeroesOptions',
3143   'data': [ 'off', 'on', 'unmap' ] }
3146 # @BlockdevAioOptions:
3148 # Selects the AIO backend to handle I/O requests
3150 # @threads: Use qemu's thread pool
3152 # @native: Use native AIO backend (only Linux and Windows)
3154 # @io_uring: Use linux io_uring (since 5.0)
3156 # Since: 2.9
3158 { 'enum': 'BlockdevAioOptions',
3159   'data': [ 'threads', 'native',
3160             { 'name': 'io_uring', 'if': 'CONFIG_LINUX_IO_URING' } ] }
3163 # @BlockdevCacheOptions:
3165 # Includes cache-related options for block devices
3167 # @direct: enables use of O_DIRECT (bypass the host page cache;
3168 #     default: false)
3170 # @no-flush: ignore any flush requests for the device (default: false)
3172 # Since: 2.9
3174 { 'struct': 'BlockdevCacheOptions',
3175   'data': { '*direct': 'bool',
3176             '*no-flush': 'bool' } }
3179 # @BlockdevDriver:
3181 # Drivers that are supported in block device operations.
3183 # @throttle: Since 2.11
3185 # @nvme: Since 2.12
3187 # @copy-on-read: Since 3.0
3189 # @blklogwrites: Since 3.0
3191 # @blkreplay: Since 4.2
3193 # @compress: Since 5.0
3195 # @copy-before-write: Since 6.2
3197 # @snapshot-access: Since 7.0
3199 # Since: 2.9
3201 { 'enum': 'BlockdevDriver',
3202   'data': [ 'blkdebug', 'blklogwrites', 'blkreplay', 'blkverify', 'bochs',
3203             'cloop', 'compress', 'copy-before-write', 'copy-on-read', 'dmg',
3204             'file', 'snapshot-access', 'ftp', 'ftps', 'gluster',
3205             {'name': 'host_cdrom', 'if': 'HAVE_HOST_BLOCK_DEVICE' },
3206             {'name': 'host_device', 'if': 'HAVE_HOST_BLOCK_DEVICE' },
3207             'http', 'https',
3208             { 'name': 'io_uring', 'if': 'CONFIG_BLKIO' },
3209             'iscsi',
3210             'luks', 'nbd', 'nfs', 'null-aio', 'null-co', 'nvme',
3211             { 'name': 'nvme-io_uring', 'if': 'CONFIG_BLKIO' },
3212             'parallels', 'preallocate', 'qcow', 'qcow2', 'qed', 'quorum',
3213             'raw', 'rbd',
3214             { 'name': 'replication', 'if': 'CONFIG_REPLICATION' },
3215             'ssh', 'throttle', 'vdi', 'vhdx',
3216             { 'name': 'virtio-blk-vfio-pci', 'if': 'CONFIG_BLKIO' },
3217             { 'name': 'virtio-blk-vhost-user', 'if': 'CONFIG_BLKIO' },
3218             { 'name': 'virtio-blk-vhost-vdpa', 'if': 'CONFIG_BLKIO' },
3219             'vmdk', 'vpc', 'vvfat' ] }
3222 # @BlockdevOptionsFile:
3224 # Driver specific block device options for the file backend.
3226 # @filename: path to the image file
3228 # @pr-manager: the id for the object that will handle persistent
3229 #     reservations for this device (default: none, forward the
3230 #     commands via SG_IO; since 2.11)
3232 # @aio: AIO backend (default: threads) (since: 2.8)
3234 # @aio-max-batch: maximum number of requests to batch together into a
3235 #     single submission in the AIO backend.  The smallest value
3236 #     between this and the aio-max-batch value of the IOThread object
3237 #     is chosen.  0 means that the AIO backend will handle it
3238 #     automatically.  (default: 0, since 6.2)
3240 # @locking: whether to enable file locking.  If set to 'auto', only
3241 #     enable when Open File Descriptor (OFD) locking API is available
3242 #     (default: auto, since 2.10)
3244 # @drop-cache: invalidate page cache during live migration.  This
3245 #     prevents stale data on the migration destination with
3246 #     cache.direct=off.  Currently only supported on Linux hosts.
3247 #     (default: on, since: 4.0)
3249 # @x-check-cache-dropped: whether to check that page cache was dropped
3250 #     on live migration.  May cause noticeable delays if the image
3251 #     file is large, do not use in production.  (default: off)
3252 #     (since: 3.0)
3254 # Features:
3256 # @dynamic-auto-read-only: If present, enabled auto-read-only means
3257 #     that the driver will open the image read-only at first,
3258 #     dynamically reopen the image file read-write when the first
3259 #     writer is attached to the node and reopen read-only when the
3260 #     last writer is detached.  This allows giving QEMU write
3261 #     permissions only on demand when an operation actually needs
3262 #     write access.
3264 # @unstable: Member x-check-cache-dropped is meant for debugging.
3266 # Since: 2.9
3268 { 'struct': 'BlockdevOptionsFile',
3269   'data': { 'filename': 'str',
3270             '*pr-manager': 'str',
3271             '*locking': 'OnOffAuto',
3272             '*aio': 'BlockdevAioOptions',
3273             '*aio-max-batch': 'int',
3274             '*drop-cache': {'type': 'bool',
3275                             'if': 'CONFIG_LINUX'},
3276             '*x-check-cache-dropped': { 'type': 'bool',
3277                                         'features': [ 'unstable' ] } },
3278   'features': [ { 'name': 'dynamic-auto-read-only',
3279                   'if': 'CONFIG_POSIX' } ] }
3282 # @BlockdevOptionsNull:
3284 # Driver specific block device options for the null backend.
3286 # @size: size of the device in bytes.
3288 # @latency-ns: emulated latency (in nanoseconds) in processing
3289 #     requests.  Default to zero which completes requests immediately.
3290 #     (Since 2.4)
3292 # @read-zeroes: if true, reads from the device produce zeroes; if
3293 #     false, the buffer is left unchanged.
3294 #     (default: false; since: 4.1)
3296 # Since: 2.9
3298 { 'struct': 'BlockdevOptionsNull',
3299   'data': { '*size': 'int', '*latency-ns': 'uint64', '*read-zeroes': 'bool' } }
3302 # @BlockdevOptionsNVMe:
3304 # Driver specific block device options for the NVMe backend.
3306 # @device: PCI controller address of the NVMe device in format
3307 #     hhhh:bb:ss.f (host:bus:slot.function)
3309 # @namespace: namespace number of the device, starting from 1.
3311 # Note that the PCI @device must have been unbound from any host
3312 # kernel driver before instructing QEMU to add the blockdev.
3314 # Since: 2.12
3316 { 'struct': 'BlockdevOptionsNVMe',
3317   'data': { 'device': 'str', 'namespace': 'int' } }
3320 # @BlockdevOptionsVVFAT:
3322 # Driver specific block device options for the vvfat protocol.
3324 # @dir: directory to be exported as FAT image
3326 # @fat-type: FAT type: 12, 16 or 32
3328 # @floppy: whether to export a floppy image (true) or partitioned hard
3329 #     disk (false; default)
3331 # @label: set the volume label, limited to 11 bytes.  FAT16 and FAT32
3332 #     traditionally have some restrictions on labels, which are
3333 #     ignored by most operating systems.  Defaults to "QEMU VVFAT".
3334 #     (since 2.4)
3336 # @rw: whether to allow write operations (default: false)
3338 # Since: 2.9
3340 { 'struct': 'BlockdevOptionsVVFAT',
3341   'data': { 'dir': 'str', '*fat-type': 'int', '*floppy': 'bool',
3342             '*label': 'str', '*rw': 'bool' } }
3345 # @BlockdevOptionsGenericFormat:
3347 # Driver specific block device options for image format that have no
3348 # option besides their data source.
3350 # @file: reference to or definition of the data source block device
3352 # Since: 2.9
3354 { 'struct': 'BlockdevOptionsGenericFormat',
3355   'data': { 'file': 'BlockdevRef' } }
3358 # @BlockdevOptionsLUKS:
3360 # Driver specific block device options for LUKS.
3362 # @key-secret: the ID of a QCryptoSecret object providing the
3363 #     decryption key (since 2.6). Mandatory except when doing a
3364 #     metadata-only probe of the image.
3366 # Since: 2.9
3368 { 'struct': 'BlockdevOptionsLUKS',
3369   'base': 'BlockdevOptionsGenericFormat',
3370   'data': { '*key-secret': 'str' } }
3373 # @BlockdevOptionsGenericCOWFormat:
3375 # Driver specific block device options for image format that have no
3376 # option besides their data source and an optional backing file.
3378 # @backing: reference to or definition of the backing file block
3379 #     device, null disables the backing file entirely.  Defaults to
3380 #     the backing file stored the image file.
3382 # Since: 2.9
3384 { 'struct': 'BlockdevOptionsGenericCOWFormat',
3385   'base': 'BlockdevOptionsGenericFormat',
3386   'data': { '*backing': 'BlockdevRefOrNull' } }
3389 # @Qcow2OverlapCheckMode:
3391 # General overlap check modes.
3393 # @none: Do not perform any checks
3395 # @constant: Perform only checks which can be done in constant time
3396 #     and without reading anything from disk
3398 # @cached: Perform only checks which can be done without reading
3399 #     anything from disk
3401 # @all: Perform all available overlap checks
3403 # Since: 2.9
3405 { 'enum': 'Qcow2OverlapCheckMode',
3406   'data': [ 'none', 'constant', 'cached', 'all' ] }
3409 # @Qcow2OverlapCheckFlags:
3411 # Structure of flags for each metadata structure.  Setting a field to
3412 # 'true' makes qemu guard that structure against unintended
3413 # overwriting.  The default value is chosen according to the template
3414 # given.
3416 # @template: Specifies a template mode which can be adjusted using the
3417 #     other flags, defaults to 'cached'
3419 # @bitmap-directory: since 3.0
3421 # Since: 2.9
3423 { 'struct': 'Qcow2OverlapCheckFlags',
3424   'data': { '*template':         'Qcow2OverlapCheckMode',
3425             '*main-header':      'bool',
3426             '*active-l1':        'bool',
3427             '*active-l2':        'bool',
3428             '*refcount-table':   'bool',
3429             '*refcount-block':   'bool',
3430             '*snapshot-table':   'bool',
3431             '*inactive-l1':      'bool',
3432             '*inactive-l2':      'bool',
3433             '*bitmap-directory': 'bool' } }
3436 # @Qcow2OverlapChecks:
3438 # Specifies which metadata structures should be guarded against
3439 # unintended overwriting.
3441 # @flags: set of flags for separate specification of each metadata
3442 #     structure type
3444 # @mode: named mode which chooses a specific set of flags
3446 # Since: 2.9
3448 { 'alternate': 'Qcow2OverlapChecks',
3449   'data': { 'flags': 'Qcow2OverlapCheckFlags',
3450             'mode':  'Qcow2OverlapCheckMode' } }
3453 # @BlockdevQcowEncryptionFormat:
3455 # @aes: AES-CBC with plain64 initialization vectors
3457 # Since: 2.10
3459 { 'enum': 'BlockdevQcowEncryptionFormat',
3460   'data': [ 'aes' ] }
3463 # @BlockdevQcowEncryption:
3465 # Since: 2.10
3467 { 'union': 'BlockdevQcowEncryption',
3468   'base': { 'format': 'BlockdevQcowEncryptionFormat' },
3469   'discriminator': 'format',
3470   'data': { 'aes': 'QCryptoBlockOptionsQCow' } }
3473 # @BlockdevOptionsQcow:
3475 # Driver specific block device options for qcow.
3477 # @encrypt: Image decryption options.  Mandatory for encrypted images,
3478 #     except when doing a metadata-only probe of the image.
3480 # Since: 2.10
3482 { 'struct': 'BlockdevOptionsQcow',
3483   'base': 'BlockdevOptionsGenericCOWFormat',
3484   'data': { '*encrypt': 'BlockdevQcowEncryption' } }
3487 # @BlockdevQcow2EncryptionFormat:
3489 # @aes: AES-CBC with plain64 initialization vectors
3491 # Since: 2.10
3493 { 'enum': 'BlockdevQcow2EncryptionFormat',
3494   'data': [ 'aes', 'luks' ] }
3497 # @BlockdevQcow2Encryption:
3499 # Since: 2.10
3501 { 'union': 'BlockdevQcow2Encryption',
3502   'base': { 'format': 'BlockdevQcow2EncryptionFormat' },
3503   'discriminator': 'format',
3504   'data': { 'aes': 'QCryptoBlockOptionsQCow',
3505             'luks': 'QCryptoBlockOptionsLUKS'} }
3508 # @BlockdevOptionsPreallocate:
3510 # Filter driver intended to be inserted between format and protocol
3511 # node and do preallocation in protocol node on write.
3513 # @prealloc-align: on preallocation, align file length to this number,
3514 #     default 1048576 (1M)
3516 # @prealloc-size: how much to preallocate, default 134217728 (128M)
3518 # Since: 6.0
3520 { 'struct': 'BlockdevOptionsPreallocate',
3521   'base': 'BlockdevOptionsGenericFormat',
3522   'data': { '*prealloc-align': 'int', '*prealloc-size': 'int' } }
3525 # @BlockdevOptionsQcow2:
3527 # Driver specific block device options for qcow2.
3529 # @lazy-refcounts: whether to enable the lazy refcounts feature
3530 #     (default is taken from the image file)
3532 # @pass-discard-request: whether discard requests to the qcow2 device
3533 #     should be forwarded to the data source
3535 # @pass-discard-snapshot: whether discard requests for the data source
3536 #     should be issued when a snapshot operation (e.g. deleting a
3537 #     snapshot) frees clusters in the qcow2 file
3539 # @pass-discard-other: whether discard requests for the data source
3540 #     should be issued on other occasions where a cluster gets freed
3542 # @discard-no-unref: when enabled, data clusters will remain
3543 #     preallocated when they are no longer used, e.g. because they are
3544 #     discarded or converted to zero clusters.  As usual, whether the
3545 #     old data is discarded or kept on the protocol level (i.e. in the
3546 #     image file) depends on the setting of the pass-discard-request
3547 #     option.  Keeping the clusters preallocated prevents qcow2
3548 #     fragmentation that would otherwise be caused by freeing and
3549 #     re-allocating them later.  Besides potential performance
3550 #     degradation, such fragmentation can lead to increased allocation
3551 #     of clusters past the end of the image file, resulting in image
3552 #     files whose file length can grow much larger than their guest disk
3553 #     size would suggest.  If image file length is of concern (e.g. when
3554 #     storing qcow2 images directly on block devices), you should
3555 #     consider enabling this option.  (since 8.1)
3557 # @overlap-check: which overlap checks to perform for writes to the
3558 #     image, defaults to 'cached' (since 2.2)
3560 # @cache-size: the maximum total size of the L2 table and refcount
3561 #     block caches in bytes (since 2.2)
3563 # @l2-cache-size: the maximum size of the L2 table cache in bytes
3564 #     (since 2.2)
3566 # @l2-cache-entry-size: the size of each entry in the L2 cache in
3567 #     bytes.  It must be a power of two between 512 and the cluster
3568 #     size.  The default value is the cluster size (since 2.12)
3570 # @refcount-cache-size: the maximum size of the refcount block cache
3571 #     in bytes (since 2.2)
3573 # @cache-clean-interval: clean unused entries in the L2 and refcount
3574 #     caches.  The interval is in seconds.  The default value is 600
3575 #     on supporting platforms, and 0 on other platforms.  0 disables
3576 #     this feature.  (since 2.5)
3578 # @encrypt: Image decryption options.  Mandatory for encrypted images,
3579 #     except when doing a metadata-only probe of the image.  (since
3580 #     2.10)
3582 # @data-file: reference to or definition of the external data file.
3583 #     This may only be specified for images that require an external
3584 #     data file.  If it is not specified for such an image, the data
3585 #     file name is loaded from the image file.  (since 4.0)
3587 # Since: 2.9
3589 { 'struct': 'BlockdevOptionsQcow2',
3590   'base': 'BlockdevOptionsGenericCOWFormat',
3591   'data': { '*lazy-refcounts': 'bool',
3592             '*pass-discard-request': 'bool',
3593             '*pass-discard-snapshot': 'bool',
3594             '*pass-discard-other': 'bool',
3595             '*discard-no-unref': 'bool',
3596             '*overlap-check': 'Qcow2OverlapChecks',
3597             '*cache-size': 'int',
3598             '*l2-cache-size': 'int',
3599             '*l2-cache-entry-size': 'int',
3600             '*refcount-cache-size': 'int',
3601             '*cache-clean-interval': 'int',
3602             '*encrypt': 'BlockdevQcow2Encryption',
3603             '*data-file': 'BlockdevRef' } }
3606 # @SshHostKeyCheckMode:
3608 # @none: Don't check the host key at all
3610 # @hash: Compare the host key with a given hash
3612 # @known_hosts: Check the host key against the known_hosts file
3614 # Since: 2.12
3616 { 'enum': 'SshHostKeyCheckMode',
3617   'data': [ 'none', 'hash', 'known_hosts' ] }
3620 # @SshHostKeyCheckHashType:
3622 # @md5: The given hash is an md5 hash
3624 # @sha1: The given hash is an sha1 hash
3626 # @sha256: The given hash is an sha256 hash
3628 # Since: 2.12
3630 { 'enum': 'SshHostKeyCheckHashType',
3631   'data': [ 'md5', 'sha1', 'sha256' ] }
3634 # @SshHostKeyHash:
3636 # @type: The hash algorithm used for the hash
3638 # @hash: The expected hash value
3640 # Since: 2.12
3642 { 'struct': 'SshHostKeyHash',
3643   'data': { 'type': 'SshHostKeyCheckHashType',
3644             'hash': 'str' }}
3647 # @SshHostKeyCheck:
3649 # Since: 2.12
3651 { 'union': 'SshHostKeyCheck',
3652   'base': { 'mode': 'SshHostKeyCheckMode' },
3653   'discriminator': 'mode',
3654   'data': { 'hash': 'SshHostKeyHash' } }
3657 # @BlockdevOptionsSsh:
3659 # @server: host address
3661 # @path: path to the image on the host
3663 # @user: user as which to connect, defaults to current local user name
3665 # @host-key-check: Defines how and what to check the host key against
3666 #     (default: known_hosts)
3668 # Since: 2.9
3670 { 'struct': 'BlockdevOptionsSsh',
3671   'data': { 'server': 'InetSocketAddress',
3672             'path': 'str',
3673             '*user': 'str',
3674             '*host-key-check': 'SshHostKeyCheck' } }
3677 # @BlkdebugEvent:
3679 # Trigger events supported by blkdebug.
3681 # @l1_shrink_write_table: write zeros to the l1 table to shrink image.
3682 #     (since 2.11)
3684 # @l1_shrink_free_l2_clusters: discard the l2 tables.  (since 2.11)
3686 # @cor_write: a write due to copy-on-read (since 2.11)
3688 # @cluster_alloc_space: an allocation of file space for a cluster
3689 #     (since 4.1)
3691 # @none: triggers once at creation of the blkdebug node (since 4.1)
3693 # Since: 2.9
3695 { 'enum': 'BlkdebugEvent', 'prefix': 'BLKDBG',
3696   'data': [ 'l1_update', 'l1_grow_alloc_table', 'l1_grow_write_table',
3697             'l1_grow_activate_table', 'l2_load', 'l2_update',
3698             'l2_update_compressed', 'l2_alloc_cow_read', 'l2_alloc_write',
3699             'read_aio', 'read_backing_aio', 'read_compressed', 'write_aio',
3700             'write_compressed', 'vmstate_load', 'vmstate_save', 'cow_read',
3701             'cow_write', 'reftable_load', 'reftable_grow', 'reftable_update',
3702             'refblock_load', 'refblock_update', 'refblock_update_part',
3703             'refblock_alloc', 'refblock_alloc_hookup', 'refblock_alloc_write',
3704             'refblock_alloc_write_blocks', 'refblock_alloc_write_table',
3705             'refblock_alloc_switch_table', 'cluster_alloc',
3706             'cluster_alloc_bytes', 'cluster_free', 'flush_to_os',
3707             'flush_to_disk', 'pwritev_rmw_head', 'pwritev_rmw_after_head',
3708             'pwritev_rmw_tail', 'pwritev_rmw_after_tail', 'pwritev',
3709             'pwritev_zero', 'pwritev_done', 'empty_image_prepare',
3710             'l1_shrink_write_table', 'l1_shrink_free_l2_clusters',
3711             'cor_write', 'cluster_alloc_space', 'none'] }
3714 # @BlkdebugIOType:
3716 # Kinds of I/O that blkdebug can inject errors in.
3718 # @read: .bdrv_co_preadv()
3720 # @write: .bdrv_co_pwritev()
3722 # @write-zeroes: .bdrv_co_pwrite_zeroes()
3724 # @discard: .bdrv_co_pdiscard()
3726 # @flush: .bdrv_co_flush_to_disk()
3728 # @block-status: .bdrv_co_block_status()
3730 # Since: 4.1
3732 { 'enum': 'BlkdebugIOType', 'prefix': 'BLKDEBUG_IO_TYPE',
3733   'data': [ 'read', 'write', 'write-zeroes', 'discard', 'flush',
3734             'block-status' ] }
3737 # @BlkdebugInjectErrorOptions:
3739 # Describes a single error injection for blkdebug.
3741 # @event: trigger event
3743 # @state: the state identifier blkdebug needs to be in to actually
3744 #     trigger the event; defaults to "any"
3746 # @iotype: the type of I/O operations on which this error should be
3747 #     injected; defaults to "all read, write, write-zeroes, discard,
3748 #     and flush operations" (since: 4.1)
3750 # @errno: error identifier (errno) to be returned; defaults to EIO
3752 # @sector: specifies the sector index which has to be affected in
3753 #     order to actually trigger the event; defaults to "any sector"
3755 # @once: disables further events after this one has been triggered;
3756 #     defaults to false
3758 # @immediately: fail immediately; defaults to false
3760 # Since: 2.9
3762 { 'struct': 'BlkdebugInjectErrorOptions',
3763   'data': { 'event': 'BlkdebugEvent',
3764             '*state': 'int',
3765             '*iotype': 'BlkdebugIOType',
3766             '*errno': 'int',
3767             '*sector': 'int',
3768             '*once': 'bool',
3769             '*immediately': 'bool' } }
3772 # @BlkdebugSetStateOptions:
3774 # Describes a single state-change event for blkdebug.
3776 # @event: trigger event
3778 # @state: the current state identifier blkdebug needs to be in;
3779 #     defaults to "any"
3781 # @new_state: the state identifier blkdebug is supposed to assume if
3782 #     this event is triggered
3784 # Since: 2.9
3786 { 'struct': 'BlkdebugSetStateOptions',
3787   'data': { 'event': 'BlkdebugEvent',
3788             '*state': 'int',
3789             'new_state': 'int' } }
3792 # @BlockdevOptionsBlkdebug:
3794 # Driver specific block device options for blkdebug.
3796 # @image: underlying raw block device (or image file)
3798 # @config: filename of the configuration file
3800 # @align: required alignment for requests in bytes, must be positive
3801 #     power of 2, or 0 for default
3803 # @max-transfer: maximum size for I/O transfers in bytes, must be
3804 #     positive multiple of @align and of the underlying file's request
3805 #     alignment (but need not be a power of 2), or 0 for default
3806 #     (since 2.10)
3808 # @opt-write-zero: preferred alignment for write zero requests in
3809 #     bytes, must be positive multiple of @align and of the underlying
3810 #     file's request alignment (but need not be a power of 2), or 0
3811 #     for default (since 2.10)
3813 # @max-write-zero: maximum size for write zero requests in bytes, must
3814 #     be positive multiple of @align, of @opt-write-zero, and of the
3815 #     underlying file's request alignment (but need not be a power of
3816 #     2), or 0 for default (since 2.10)
3818 # @opt-discard: preferred alignment for discard requests in bytes,
3819 #     must be positive multiple of @align and of the underlying file's
3820 #     request alignment (but need not be a power of 2), or 0 for
3821 #     default (since 2.10)
3823 # @max-discard: maximum size for discard requests in bytes, must be
3824 #     positive multiple of @align, of @opt-discard, and of the
3825 #     underlying file's request alignment (but need not be a power of
3826 #     2), or 0 for default (since 2.10)
3828 # @inject-error: array of error injection descriptions
3830 # @set-state: array of state-change descriptions
3832 # @take-child-perms: Permissions to take on @image in addition to what
3833 #     is necessary anyway (which depends on how the blkdebug node is
3834 #     used).  Defaults to none.  (since 5.0)
3836 # @unshare-child-perms: Permissions not to share on @image in addition
3837 #     to what cannot be shared anyway (which depends on how the
3838 #     blkdebug node is used).  Defaults to none.  (since 5.0)
3840 # Since: 2.9
3842 { 'struct': 'BlockdevOptionsBlkdebug',
3843   'data': { 'image': 'BlockdevRef',
3844             '*config': 'str',
3845             '*align': 'int', '*max-transfer': 'int32',
3846             '*opt-write-zero': 'int32', '*max-write-zero': 'int32',
3847             '*opt-discard': 'int32', '*max-discard': 'int32',
3848             '*inject-error': ['BlkdebugInjectErrorOptions'],
3849             '*set-state': ['BlkdebugSetStateOptions'],
3850             '*take-child-perms': ['BlockPermission'],
3851             '*unshare-child-perms': ['BlockPermission'] } }
3854 # @BlockdevOptionsBlklogwrites:
3856 # Driver specific block device options for blklogwrites.
3858 # @file: block device
3860 # @log: block device used to log writes to @file
3862 # @log-sector-size: sector size used in logging writes to @file,
3863 #     determines granularity of offsets and sizes of writes
3864 #     (default: 512)
3866 # @log-append: append to an existing log (default: false)
3868 # @log-super-update-interval: interval of write requests after which
3869 #     the log super block is updated to disk (default: 4096)
3871 # Since: 3.0
3873 { 'struct': 'BlockdevOptionsBlklogwrites',
3874   'data': { 'file': 'BlockdevRef',
3875             'log': 'BlockdevRef',
3876             '*log-sector-size': 'uint32',
3877             '*log-append': 'bool',
3878             '*log-super-update-interval': 'uint64' } }
3881 # @BlockdevOptionsBlkverify:
3883 # Driver specific block device options for blkverify.
3885 # @test: block device to be tested
3887 # @raw: raw image used for verification
3889 # Since: 2.9
3891 { 'struct': 'BlockdevOptionsBlkverify',
3892   'data': { 'test': 'BlockdevRef',
3893             'raw': 'BlockdevRef' } }
3896 # @BlockdevOptionsBlkreplay:
3898 # Driver specific block device options for blkreplay.
3900 # @image: disk image which should be controlled with blkreplay
3902 # Since: 4.2
3904 { 'struct': 'BlockdevOptionsBlkreplay',
3905   'data': { 'image': 'BlockdevRef' } }
3908 # @QuorumReadPattern:
3910 # An enumeration of quorum read patterns.
3912 # @quorum: read all the children and do a quorum vote on reads
3914 # @fifo: read only from the first child that has not failed
3916 # Since: 2.9
3918 { 'enum': 'QuorumReadPattern', 'data': [ 'quorum', 'fifo' ] }
3921 # @BlockdevOptionsQuorum:
3923 # Driver specific block device options for Quorum
3925 # @blkverify: true if the driver must print content mismatch set to
3926 #     false by default
3928 # @children: the children block devices to use
3930 # @vote-threshold: the vote limit under which a read will fail
3932 # @rewrite-corrupted: rewrite corrupted data when quorum is reached
3933 #     (Since 2.1)
3935 # @read-pattern: choose read pattern and set to quorum by default
3936 #     (Since 2.2)
3938 # Since: 2.9
3940 { 'struct': 'BlockdevOptionsQuorum',
3941   'data': { '*blkverify': 'bool',
3942             'children': [ 'BlockdevRef' ],
3943             'vote-threshold': 'int',
3944             '*rewrite-corrupted': 'bool',
3945             '*read-pattern': 'QuorumReadPattern' } }
3948 # @BlockdevOptionsGluster:
3950 # Driver specific block device options for Gluster
3952 # @volume: name of gluster volume where VM image resides
3954 # @path: absolute path to image file in gluster volume
3956 # @server: gluster servers description
3958 # @debug: libgfapi log level (default '4' which is Error) (Since 2.8)
3960 # @logfile: libgfapi log file (default /dev/stderr) (Since 2.8)
3962 # Since: 2.9
3964 { 'struct': 'BlockdevOptionsGluster',
3965   'data': { 'volume': 'str',
3966             'path': 'str',
3967             'server': ['SocketAddress'],
3968             '*debug': 'int',
3969             '*logfile': 'str' } }
3972 # @BlockdevOptionsIoUring:
3974 # Driver specific block device options for the io_uring backend.
3976 # @filename: path to the image file
3978 # Since: 7.2
3980 { 'struct': 'BlockdevOptionsIoUring',
3981   'data': { 'filename': 'str' },
3982   'if': 'CONFIG_BLKIO' }
3985 # @BlockdevOptionsNvmeIoUring:
3987 # Driver specific block device options for the nvme-io_uring backend.
3989 # @path: path to the NVMe namespace's character device (e.g.
3990 #     /dev/ng0n1).
3992 # Since: 7.2
3994 { 'struct': 'BlockdevOptionsNvmeIoUring',
3995   'data': { 'path': 'str' },
3996   'if': 'CONFIG_BLKIO' }
3999 # @BlockdevOptionsVirtioBlkVfioPci:
4001 # Driver specific block device options for the virtio-blk-vfio-pci
4002 # backend.
4004 # @path: path to the PCI device's sysfs directory (e.g.
4005 #     /sys/bus/pci/devices/0000:00:01.0).
4007 # Since: 7.2
4009 { 'struct': 'BlockdevOptionsVirtioBlkVfioPci',
4010   'data': { 'path': 'str' },
4011   'if': 'CONFIG_BLKIO' }
4014 # @BlockdevOptionsVirtioBlkVhostUser:
4016 # Driver specific block device options for the virtio-blk-vhost-user
4017 # backend.
4019 # @path: path to the vhost-user UNIX domain socket.
4021 # Since: 7.2
4023 { 'struct': 'BlockdevOptionsVirtioBlkVhostUser',
4024   'data': { 'path': 'str' },
4025   'if': 'CONFIG_BLKIO' }
4028 # @BlockdevOptionsVirtioBlkVhostVdpa:
4030 # Driver specific block device options for the virtio-blk-vhost-vdpa
4031 # backend.
4033 # @path: path to the vhost-vdpa character device.
4035 # Features:
4036 # @fdset: Member @path supports the special "/dev/fdset/N" path
4037 #     (since 8.1)
4039 # Since: 7.2
4041 { 'struct': 'BlockdevOptionsVirtioBlkVhostVdpa',
4042   'data': { 'path': 'str' },
4043   'features': [ { 'name' :'fdset',
4044                   'if': 'CONFIG_BLKIO_VHOST_VDPA_FD' } ],
4045   'if': 'CONFIG_BLKIO' }
4048 # @IscsiTransport:
4050 # An enumeration of libiscsi transport types
4052 # Since: 2.9
4054 { 'enum': 'IscsiTransport',
4055   'data': [ 'tcp', 'iser' ] }
4058 # @IscsiHeaderDigest:
4060 # An enumeration of header digests supported by libiscsi
4062 # Since: 2.9
4064 { 'enum': 'IscsiHeaderDigest',
4065   'prefix': 'QAPI_ISCSI_HEADER_DIGEST',
4066   'data': [ 'crc32c', 'none', 'crc32c-none', 'none-crc32c' ] }
4069 # @BlockdevOptionsIscsi:
4071 # Driver specific block device options for iscsi
4073 # @transport: The iscsi transport type
4075 # @portal: The address of the iscsi portal
4077 # @target: The target iqn name
4079 # @lun: LUN to connect to.  Defaults to 0.
4081 # @user: User name to log in with.  If omitted, no CHAP authentication
4082 #     is performed.
4084 # @password-secret: The ID of a QCryptoSecret object providing the
4085 #     password for the login.  This option is required if @user is
4086 #     specified.
4088 # @initiator-name: The iqn name we want to identify to the target as.
4089 #     If this option is not specified, an initiator name is generated
4090 #     automatically.
4092 # @header-digest: The desired header digest.  Defaults to none-crc32c.
4094 # @timeout: Timeout in seconds after which a request will timeout.  0
4095 #     means no timeout and is the default.
4097 # Since: 2.9
4099 { 'struct': 'BlockdevOptionsIscsi',
4100   'data': { 'transport': 'IscsiTransport',
4101             'portal': 'str',
4102             'target': 'str',
4103             '*lun': 'int',
4104             '*user': 'str',
4105             '*password-secret': 'str',
4106             '*initiator-name': 'str',
4107             '*header-digest': 'IscsiHeaderDigest',
4108             '*timeout': 'int' } }
4111 # @RbdAuthMode:
4113 # Since: 3.0
4115 { 'enum': 'RbdAuthMode',
4116   'data': [ 'cephx', 'none' ] }
4119 # @RbdImageEncryptionFormat:
4121 # @luks-any: Used for opening either luks or luks2 (Since 8.0)
4123 # Since: 6.1
4125 { 'enum': 'RbdImageEncryptionFormat',
4126   'data': [ 'luks', 'luks2', 'luks-any' ] }
4129 # @RbdEncryptionOptionsLUKSBase:
4131 # @key-secret: ID of a QCryptoSecret object providing a passphrase for
4132 #     unlocking the encryption
4134 # Since: 6.1
4136 { 'struct': 'RbdEncryptionOptionsLUKSBase',
4137   'data': { 'key-secret': 'str' } }
4140 # @RbdEncryptionCreateOptionsLUKSBase:
4142 # @cipher-alg: The encryption algorithm
4144 # Since: 6.1
4146 { 'struct': 'RbdEncryptionCreateOptionsLUKSBase',
4147   'base': 'RbdEncryptionOptionsLUKSBase',
4148   'data': { '*cipher-alg': 'QCryptoCipherAlgorithm' } }
4151 # @RbdEncryptionOptionsLUKS:
4153 # Since: 6.1
4155 { 'struct': 'RbdEncryptionOptionsLUKS',
4156   'base': 'RbdEncryptionOptionsLUKSBase',
4157   'data': { } }
4160 # @RbdEncryptionOptionsLUKS2:
4162 # Since: 6.1
4164 { 'struct': 'RbdEncryptionOptionsLUKS2',
4165   'base': 'RbdEncryptionOptionsLUKSBase',
4166   'data': { } }
4169 # @RbdEncryptionOptionsLUKSAny:
4171 # Since: 8.0
4173 { 'struct': 'RbdEncryptionOptionsLUKSAny',
4174   'base': 'RbdEncryptionOptionsLUKSBase',
4175   'data': { } }
4178 # @RbdEncryptionCreateOptionsLUKS:
4180 # Since: 6.1
4182 { 'struct': 'RbdEncryptionCreateOptionsLUKS',
4183   'base': 'RbdEncryptionCreateOptionsLUKSBase',
4184   'data': { } }
4187 # @RbdEncryptionCreateOptionsLUKS2:
4189 # Since: 6.1
4191 { 'struct': 'RbdEncryptionCreateOptionsLUKS2',
4192   'base': 'RbdEncryptionCreateOptionsLUKSBase',
4193   'data': { } }
4196 # @RbdEncryptionOptions:
4198 # @format: Encryption format.
4200 # @parent: Parent image encryption options (for cloned images).  Can
4201 #     be left unspecified if this cloned image is encrypted using the
4202 #     same format and secret as its parent image (i.e. not explicitly
4203 #     formatted) or if its parent image is not encrypted.  (Since 8.0)
4205 # Since: 6.1
4207 { 'union': 'RbdEncryptionOptions',
4208   'base': { 'format': 'RbdImageEncryptionFormat',
4209             '*parent': 'RbdEncryptionOptions' },
4210   'discriminator': 'format',
4211   'data': { 'luks': 'RbdEncryptionOptionsLUKS',
4212             'luks2': 'RbdEncryptionOptionsLUKS2',
4213             'luks-any': 'RbdEncryptionOptionsLUKSAny'} }
4216 # @RbdEncryptionCreateOptions:
4218 # Since: 6.1
4220 { 'union': 'RbdEncryptionCreateOptions',
4221   'base': { 'format': 'RbdImageEncryptionFormat' },
4222   'discriminator': 'format',
4223   'data': { 'luks': 'RbdEncryptionCreateOptionsLUKS',
4224             'luks2': 'RbdEncryptionCreateOptionsLUKS2' } }
4227 # @BlockdevOptionsRbd:
4229 # @pool: Ceph pool name.
4231 # @namespace: Rados namespace name in the Ceph pool.  (Since 5.0)
4233 # @image: Image name in the Ceph pool.
4235 # @conf: path to Ceph configuration file.  Values in the configuration
4236 #     file will be overridden by options specified via QAPI.
4238 # @snapshot: Ceph snapshot name.
4240 # @encrypt: Image encryption options.  (Since 6.1)
4242 # @user: Ceph id name.
4244 # @auth-client-required: Acceptable authentication modes.  This maps
4245 #     to Ceph configuration option "auth_client_required".  (Since
4246 #     3.0)
4248 # @key-secret: ID of a QCryptoSecret object providing a key for cephx
4249 #     authentication.  This maps to Ceph configuration option "key".
4250 #     (Since 3.0)
4252 # @server: Monitor host address and port.  This maps to the "mon_host"
4253 #     Ceph option.
4255 # Since: 2.9
4257 { 'struct': 'BlockdevOptionsRbd',
4258   'data': { 'pool': 'str',
4259             '*namespace': 'str',
4260             'image': 'str',
4261             '*conf': 'str',
4262             '*snapshot': 'str',
4263             '*encrypt': 'RbdEncryptionOptions',
4264             '*user': 'str',
4265             '*auth-client-required': ['RbdAuthMode'],
4266             '*key-secret': 'str',
4267             '*server': ['InetSocketAddressBase'] } }
4270 # @ReplicationMode:
4272 # An enumeration of replication modes.
4274 # @primary: Primary mode, the vm's state will be sent to secondary
4275 #     QEMU.
4277 # @secondary: Secondary mode, receive the vm's state from primary
4278 #     QEMU.
4280 # Since: 2.9
4282 { 'enum' : 'ReplicationMode', 'data' : [ 'primary', 'secondary' ],
4283   'if': 'CONFIG_REPLICATION' }
4286 # @BlockdevOptionsReplication:
4288 # Driver specific block device options for replication
4290 # @mode: the replication mode
4292 # @top-id: In secondary mode, node name or device ID of the root node
4293 #     who owns the replication node chain.  Must not be given in
4294 #     primary mode.
4296 # Since: 2.9
4298 { 'struct': 'BlockdevOptionsReplication',
4299   'base': 'BlockdevOptionsGenericFormat',
4300   'data': { 'mode': 'ReplicationMode',
4301             '*top-id': 'str' },
4302   'if': 'CONFIG_REPLICATION' }
4305 # @NFSTransport:
4307 # An enumeration of NFS transport types
4309 # @inet: TCP transport
4311 # Since: 2.9
4313 { 'enum': 'NFSTransport',
4314   'data': [ 'inet' ] }
4317 # @NFSServer:
4319 # Captures the address of the socket
4321 # @type: transport type used for NFS (only TCP supported)
4323 # @host: host address for NFS server
4325 # Since: 2.9
4327 { 'struct': 'NFSServer',
4328   'data': { 'type': 'NFSTransport',
4329             'host': 'str' } }
4332 # @BlockdevOptionsNfs:
4334 # Driver specific block device option for NFS
4336 # @server: host address
4338 # @path: path of the image on the host
4340 # @user: UID value to use when talking to the server (defaults to
4341 #     65534 on Windows and getuid() on unix)
4343 # @group: GID value to use when talking to the server (defaults to
4344 #     65534 on Windows and getgid() in unix)
4346 # @tcp-syn-count: number of SYNs during the session establishment
4347 #     (defaults to libnfs default)
4349 # @readahead-size: set the readahead size in bytes (defaults to libnfs
4350 #     default)
4352 # @page-cache-size: set the pagecache size in bytes (defaults to
4353 #     libnfs default)
4355 # @debug: set the NFS debug level (max 2) (defaults to libnfs default)
4357 # Since: 2.9
4359 { 'struct': 'BlockdevOptionsNfs',
4360   'data': { 'server': 'NFSServer',
4361             'path': 'str',
4362             '*user': 'int',
4363             '*group': 'int',
4364             '*tcp-syn-count': 'int',
4365             '*readahead-size': 'int',
4366             '*page-cache-size': 'int',
4367             '*debug': 'int' } }
4370 # @BlockdevOptionsCurlBase:
4372 # Driver specific block device options shared by all protocols
4373 # supported by the curl backend.
4375 # @url: URL of the image file
4377 # @readahead: Size of the read-ahead cache; must be a multiple of 512
4378 #     (defaults to 256 kB)
4380 # @timeout: Timeout for connections, in seconds (defaults to 5)
4382 # @username: Username for authentication (defaults to none)
4384 # @password-secret: ID of a QCryptoSecret object providing a password
4385 #     for authentication (defaults to no password)
4387 # @proxy-username: Username for proxy authentication (defaults to
4388 #     none)
4390 # @proxy-password-secret: ID of a QCryptoSecret object providing a
4391 #     password for proxy authentication (defaults to no password)
4393 # Since: 2.9
4395 { 'struct': 'BlockdevOptionsCurlBase',
4396   'data': { 'url': 'str',
4397             '*readahead': 'int',
4398             '*timeout': 'int',
4399             '*username': 'str',
4400             '*password-secret': 'str',
4401             '*proxy-username': 'str',
4402             '*proxy-password-secret': 'str' } }
4405 # @BlockdevOptionsCurlHttp:
4407 # Driver specific block device options for HTTP connections over the
4408 # curl backend.  URLs must start with "http://".
4410 # @cookie: List of cookies to set; format is "name1=content1;
4411 #     name2=content2;" as explained by CURLOPT_COOKIE(3). Defaults to
4412 #     no cookies.
4414 # @cookie-secret: ID of a QCryptoSecret object providing the cookie
4415 #     data in a secure way.  See @cookie for the format.  (since 2.10)
4417 # Since: 2.9
4419 { 'struct': 'BlockdevOptionsCurlHttp',
4420   'base': 'BlockdevOptionsCurlBase',
4421   'data': { '*cookie': 'str',
4422             '*cookie-secret': 'str'} }
4425 # @BlockdevOptionsCurlHttps:
4427 # Driver specific block device options for HTTPS connections over the
4428 # curl backend.  URLs must start with "https://".
4430 # @cookie: List of cookies to set; format is "name1=content1;
4431 #     name2=content2;" as explained by CURLOPT_COOKIE(3). Defaults to
4432 #     no cookies.
4434 # @sslverify: Whether to verify the SSL certificate's validity
4435 #     (defaults to true)
4437 # @cookie-secret: ID of a QCryptoSecret object providing the cookie
4438 #     data in a secure way.  See @cookie for the format.  (since 2.10)
4440 # Since: 2.9
4442 { 'struct': 'BlockdevOptionsCurlHttps',
4443   'base': 'BlockdevOptionsCurlBase',
4444   'data': { '*cookie': 'str',
4445             '*sslverify': 'bool',
4446             '*cookie-secret': 'str'} }
4449 # @BlockdevOptionsCurlFtp:
4451 # Driver specific block device options for FTP connections over the
4452 # curl backend.  URLs must start with "ftp://".
4454 # Since: 2.9
4456 { 'struct': 'BlockdevOptionsCurlFtp',
4457   'base': 'BlockdevOptionsCurlBase',
4458   'data': { } }
4461 # @BlockdevOptionsCurlFtps:
4463 # Driver specific block device options for FTPS connections over the
4464 # curl backend.  URLs must start with "ftps://".
4466 # @sslverify: Whether to verify the SSL certificate's validity
4467 #     (defaults to true)
4469 # Since: 2.9
4471 { 'struct': 'BlockdevOptionsCurlFtps',
4472   'base': 'BlockdevOptionsCurlBase',
4473   'data': { '*sslverify': 'bool' } }
4476 # @BlockdevOptionsNbd:
4478 # Driver specific block device options for NBD.
4480 # @server: NBD server address
4482 # @export: export name
4484 # @tls-creds: TLS credentials ID
4486 # @tls-hostname: TLS hostname override for certificate validation
4487 #     (Since 7.0)
4489 # @x-dirty-bitmap: A metadata context name such as
4490 #     "qemu:dirty-bitmap:NAME" or "qemu:allocation-depth" to query in
4491 #     place of the traditional "base:allocation" block status (see
4492 #     NBD_OPT_LIST_META_CONTEXT in the NBD protocol; and yes, naming
4493 #     this option x-context would have made more sense) (since 3.0)
4495 # @reconnect-delay: On an unexpected disconnect, the nbd client tries
4496 #     to connect again until succeeding or encountering a serious
4497 #     error.  During the first @reconnect-delay seconds, all requests
4498 #     are paused and will be rerun on a successful reconnect.  After
4499 #     that time, any delayed requests and all future requests before a
4500 #     successful reconnect will immediately fail.  Default 0 (Since
4501 #     4.2)
4503 # @open-timeout: In seconds.  If zero, the nbd driver tries the
4504 #     connection only once, and fails to open if the connection fails.
4505 #     If non-zero, the nbd driver will repeat connection attempts
4506 #     until successful or until @open-timeout seconds have elapsed.
4507 #     Default 0 (Since 7.0)
4509 # Features:
4511 # @unstable: Member @x-dirty-bitmap is experimental.
4513 # Since: 2.9
4515 { 'struct': 'BlockdevOptionsNbd',
4516   'data': { 'server': 'SocketAddress',
4517             '*export': 'str',
4518             '*tls-creds': 'str',
4519             '*tls-hostname': 'str',
4520             '*x-dirty-bitmap': { 'type': 'str', 'features': [ 'unstable' ] },
4521             '*reconnect-delay': 'uint32',
4522             '*open-timeout': 'uint32' } }
4525 # @BlockdevOptionsRaw:
4527 # Driver specific block device options for the raw driver.
4529 # @offset: position where the block device starts
4531 # @size: the assumed size of the device
4533 # Since: 2.9
4535 { 'struct': 'BlockdevOptionsRaw',
4536   'base': 'BlockdevOptionsGenericFormat',
4537   'data': { '*offset': 'int', '*size': 'int' } }
4540 # @BlockdevOptionsThrottle:
4542 # Driver specific block device options for the throttle driver
4544 # @throttle-group: the name of the throttle-group object to use.  It
4545 #     must already exist.
4547 # @file: reference to or definition of the data source block device
4549 # Since: 2.11
4551 { 'struct': 'BlockdevOptionsThrottle',
4552   'data': { 'throttle-group': 'str',
4553             'file' : 'BlockdevRef'
4554              } }
4557 # @BlockdevOptionsCor:
4559 # Driver specific block device options for the copy-on-read driver.
4561 # @bottom: The name of a non-filter node (allocation-bearing layer)
4562 #     that limits the COR operations in the backing chain (inclusive),
4563 #     so that no data below this node will be copied by this filter.
4564 #     If option is absent, the limit is not applied, so that data from
4565 #     all backing layers may be copied.
4567 # Since: 6.0
4569 { 'struct': 'BlockdevOptionsCor',
4570   'base': 'BlockdevOptionsGenericFormat',
4571   'data': { '*bottom': 'str' } }
4574 # @OnCbwError:
4576 # An enumeration of possible behaviors for copy-before-write operation
4577 # failures.
4579 # @break-guest-write: report the error to the guest.  This way, the
4580 #     guest will not be able to overwrite areas that cannot be backed
4581 #     up, so the backup process remains valid.
4583 # @break-snapshot: continue guest write.  Doing so will make the
4584 #     provided snapshot state invalid and any backup or export process
4585 #     based on it will finally fail.
4587 # Since: 7.1
4589 { 'enum': 'OnCbwError',
4590   'data': [ 'break-guest-write', 'break-snapshot' ] }
4593 # @BlockdevOptionsCbw:
4595 # Driver specific block device options for the copy-before-write
4596 # driver, which does so called copy-before-write operations: when data
4597 # is written to the filter, the filter first reads corresponding
4598 # blocks from its file child and copies them to @target child.  After
4599 # successfully copying, the write request is propagated to file child.
4600 # If copying fails, the original write request is failed too and no
4601 # data is written to file child.
4603 # @target: The target for copy-before-write operations.
4605 # @bitmap: If specified, copy-before-write filter will do
4606 #     copy-before-write operations only for dirty regions of the
4607 #     bitmap.  Bitmap size must be equal to length of file and target
4608 #     child of the filter.  Note also, that bitmap is used only to
4609 #     initialize internal bitmap of the process, so further
4610 #     modifications (or removing) of specified bitmap doesn't
4611 #     influence the filter.  (Since 7.0)
4613 # @on-cbw-error: Behavior on failure of copy-before-write operation.
4614 #     Default is @break-guest-write.  (Since 7.1)
4616 # @cbw-timeout: Zero means no limit.  Non-zero sets the timeout in
4617 #     seconds for copy-before-write operation.  When a timeout occurs,
4618 #     the respective copy-before-write operation will fail, and the
4619 #     @on-cbw-error parameter will decide how this failure is handled.
4620 #     Default 0. (Since 7.1)
4622 # Since: 6.2
4624 { 'struct': 'BlockdevOptionsCbw',
4625   'base': 'BlockdevOptionsGenericFormat',
4626   'data': { 'target': 'BlockdevRef', '*bitmap': 'BlockDirtyBitmap',
4627             '*on-cbw-error': 'OnCbwError', '*cbw-timeout': 'uint32' } }
4630 # @BlockdevOptions:
4632 # Options for creating a block device.  Many options are available for
4633 # all block devices, independent of the block driver:
4635 # @driver: block driver name
4637 # @node-name: the node name of the new node (Since 2.0). This option
4638 #     is required on the top level of blockdev-add.  Valid node names
4639 #     start with an alphabetic character and may contain only
4640 #     alphanumeric characters, '-', '.' and '_'. Their maximum length
4641 #     is 31 characters.
4643 # @discard: discard-related options (default: ignore)
4645 # @cache: cache-related options
4647 # @read-only: whether the block device should be read-only (default:
4648 #     false). Note that some block drivers support only read-only
4649 #     access, either generally or in certain configurations.  In this
4650 #     case, the default value does not work and the option must be
4651 #     specified explicitly.
4653 # @auto-read-only: if true and @read-only is false, QEMU may
4654 #     automatically decide not to open the image read-write as
4655 #     requested, but fall back to read-only instead (and switch
4656 #     between the modes later), e.g. depending on whether the image
4657 #     file is writable or whether a writing user is attached to the
4658 #     node (default: false, since 3.1)
4660 # @detect-zeroes: detect and optimize zero writes (Since 2.1)
4661 #     (default: off)
4663 # @force-share: force share all permission on added nodes.  Requires
4664 #     read-only=true.  (Since 2.10)
4666 # Since: 2.9
4668 { 'union': 'BlockdevOptions',
4669   'base': { 'driver': 'BlockdevDriver',
4670             '*node-name': 'str',
4671             '*discard': 'BlockdevDiscardOptions',
4672             '*cache': 'BlockdevCacheOptions',
4673             '*read-only': 'bool',
4674             '*auto-read-only': 'bool',
4675             '*force-share': 'bool',
4676             '*detect-zeroes': 'BlockdevDetectZeroesOptions' },
4677   'discriminator': 'driver',
4678   'data': {
4679       'blkdebug':   'BlockdevOptionsBlkdebug',
4680       'blklogwrites':'BlockdevOptionsBlklogwrites',
4681       'blkverify':  'BlockdevOptionsBlkverify',
4682       'blkreplay':  'BlockdevOptionsBlkreplay',
4683       'bochs':      'BlockdevOptionsGenericFormat',
4684       'cloop':      'BlockdevOptionsGenericFormat',
4685       'compress':   'BlockdevOptionsGenericFormat',
4686       'copy-before-write':'BlockdevOptionsCbw',
4687       'copy-on-read':'BlockdevOptionsCor',
4688       'dmg':        'BlockdevOptionsGenericFormat',
4689       'file':       'BlockdevOptionsFile',
4690       'ftp':        'BlockdevOptionsCurlFtp',
4691       'ftps':       'BlockdevOptionsCurlFtps',
4692       'gluster':    'BlockdevOptionsGluster',
4693       'host_cdrom':  { 'type': 'BlockdevOptionsFile',
4694                        'if': 'HAVE_HOST_BLOCK_DEVICE' },
4695       'host_device': { 'type': 'BlockdevOptionsFile',
4696                        'if': 'HAVE_HOST_BLOCK_DEVICE' },
4697       'http':       'BlockdevOptionsCurlHttp',
4698       'https':      'BlockdevOptionsCurlHttps',
4699       'io_uring':   { 'type': 'BlockdevOptionsIoUring',
4700                       'if': 'CONFIG_BLKIO' },
4701       'iscsi':      'BlockdevOptionsIscsi',
4702       'luks':       'BlockdevOptionsLUKS',
4703       'nbd':        'BlockdevOptionsNbd',
4704       'nfs':        'BlockdevOptionsNfs',
4705       'null-aio':   'BlockdevOptionsNull',
4706       'null-co':    'BlockdevOptionsNull',
4707       'nvme':       'BlockdevOptionsNVMe',
4708       'nvme-io_uring': { 'type': 'BlockdevOptionsNvmeIoUring',
4709                          'if': 'CONFIG_BLKIO' },
4710       'parallels':  'BlockdevOptionsGenericFormat',
4711       'preallocate':'BlockdevOptionsPreallocate',
4712       'qcow2':      'BlockdevOptionsQcow2',
4713       'qcow':       'BlockdevOptionsQcow',
4714       'qed':        'BlockdevOptionsGenericCOWFormat',
4715       'quorum':     'BlockdevOptionsQuorum',
4716       'raw':        'BlockdevOptionsRaw',
4717       'rbd':        'BlockdevOptionsRbd',
4718       'replication': { 'type': 'BlockdevOptionsReplication',
4719                        'if': 'CONFIG_REPLICATION' },
4720       'snapshot-access': 'BlockdevOptionsGenericFormat',
4721       'ssh':        'BlockdevOptionsSsh',
4722       'throttle':   'BlockdevOptionsThrottle',
4723       'vdi':        'BlockdevOptionsGenericFormat',
4724       'vhdx':       'BlockdevOptionsGenericFormat',
4725       'virtio-blk-vfio-pci':
4726                     { 'type': 'BlockdevOptionsVirtioBlkVfioPci',
4727                       'if': 'CONFIG_BLKIO' },
4728       'virtio-blk-vhost-user':
4729                     { 'type': 'BlockdevOptionsVirtioBlkVhostUser',
4730                       'if': 'CONFIG_BLKIO' },
4731       'virtio-blk-vhost-vdpa':
4732                     { 'type': 'BlockdevOptionsVirtioBlkVhostVdpa',
4733                       'if': 'CONFIG_BLKIO' },
4734       'vmdk':       'BlockdevOptionsGenericCOWFormat',
4735       'vpc':        'BlockdevOptionsGenericFormat',
4736       'vvfat':      'BlockdevOptionsVVFAT'
4737   } }
4740 # @BlockdevRef:
4742 # Reference to a block device.
4744 # @definition: defines a new block device inline
4746 # @reference: references the ID of an existing block device
4748 # Since: 2.9
4750 { 'alternate': 'BlockdevRef',
4751   'data': { 'definition': 'BlockdevOptions',
4752             'reference': 'str' } }
4755 # @BlockdevRefOrNull:
4757 # Reference to a block device.
4759 # @definition: defines a new block device inline
4761 # @reference: references the ID of an existing block device.  An empty
4762 #     string means that no block device should be referenced.
4763 #     Deprecated; use null instead.
4765 # @null: No block device should be referenced (since 2.10)
4767 # Since: 2.9
4769 { 'alternate': 'BlockdevRefOrNull',
4770   'data': { 'definition': 'BlockdevOptions',
4771             'reference': 'str',
4772             'null': 'null' } }
4775 # @blockdev-add:
4777 # Creates a new block device.
4779 # Since: 2.9
4781 # Examples:
4783 # -> { "execute": "blockdev-add",
4784 #      "arguments": {
4785 #           "driver": "qcow2",
4786 #           "node-name": "test1",
4787 #           "file": {
4788 #               "driver": "file",
4789 #               "filename": "test.qcow2"
4790 #            }
4791 #       }
4792 #     }
4793 # <- { "return": {} }
4795 # -> { "execute": "blockdev-add",
4796 #      "arguments": {
4797 #           "driver": "qcow2",
4798 #           "node-name": "node0",
4799 #           "discard": "unmap",
4800 #           "cache": {
4801 #              "direct": true
4802 #            },
4803 #            "file": {
4804 #              "driver": "file",
4805 #              "filename": "/tmp/test.qcow2"
4806 #            },
4807 #            "backing": {
4808 #               "driver": "raw",
4809 #               "file": {
4810 #                  "driver": "file",
4811 #                  "filename": "/dev/fdset/4"
4812 #                }
4813 #            }
4814 #        }
4815 #      }
4817 # <- { "return": {} }
4819 { 'command': 'blockdev-add', 'data': 'BlockdevOptions', 'boxed': true,
4820   'allow-preconfig': true }
4823 # @blockdev-reopen:
4825 # Reopens one or more block devices using the given set of options.
4826 # Any option not specified will be reset to its default value
4827 # regardless of its previous status.  If an option cannot be changed
4828 # or a particular driver does not support reopening then the command
4829 # will return an error.  All devices in the list are reopened in one
4830 # transaction, so if one of them fails then the whole transaction is
4831 # cancelled.
4833 # The command receives a list of block devices to reopen.  For each
4834 # one of them, the top-level @node-name option (from BlockdevOptions)
4835 # must be specified and is used to select the block device to be
4836 # reopened.  Other @node-name options must be either omitted or set to
4837 # the current name of the appropriate node.  This command won't change
4838 # any node name and any attempt to do it will result in an error.
4840 # In the case of options that refer to child nodes, the behavior of
4841 # this command depends on the value:
4843 #  1) A set of options (BlockdevOptions): the child is reopened with
4844 #     the specified set of options.
4846 #  2) A reference to the current child: the child is reopened using
4847 #     its existing set of options.
4849 #  3) A reference to a different node: the current child is replaced
4850 #     with the specified one.
4852 #  4) NULL: the current child (if any) is detached.
4854 # Options (1) and (2) are supported in all cases.  Option (3) is
4855 # supported for @file and @backing, and option (4) for @backing only.
4857 # Unlike with blockdev-add, the @backing option must always be present
4858 # unless the node being reopened does not have a backing file and its
4859 # image does not have a default backing file name as part of its
4860 # metadata.
4862 # Since: 6.1
4864 { 'command': 'blockdev-reopen',
4865   'data': { 'options': ['BlockdevOptions'] },
4866   'allow-preconfig': true }
4869 # @blockdev-del:
4871 # Deletes a block device that has been added using blockdev-add.  The
4872 # command will fail if the node is attached to a device or is
4873 # otherwise being used.
4875 # @node-name: Name of the graph node to delete.
4877 # Since: 2.9
4879 # Example:
4881 # -> { "execute": "blockdev-add",
4882 #      "arguments": {
4883 #           "driver": "qcow2",
4884 #           "node-name": "node0",
4885 #           "file": {
4886 #               "driver": "file",
4887 #               "filename": "test.qcow2"
4888 #           }
4889 #      }
4890 #    }
4891 # <- { "return": {} }
4893 # -> { "execute": "blockdev-del",
4894 #      "arguments": { "node-name": "node0" }
4895 #    }
4896 # <- { "return": {} }
4898 { 'command': 'blockdev-del', 'data': { 'node-name': 'str' },
4899   'allow-preconfig': true }
4902 # @BlockdevCreateOptionsFile:
4904 # Driver specific image creation options for file.
4906 # @filename: Filename for the new image file
4908 # @size: Size of the virtual disk in bytes
4910 # @preallocation: Preallocation mode for the new image (default: off;
4911 #     allowed values: off, falloc (if CONFIG_POSIX_FALLOCATE), full
4912 #     (if CONFIG_POSIX))
4914 # @nocow: Turn off copy-on-write (valid only on btrfs; default: off)
4916 # @extent-size-hint: Extent size hint to add to the image file; 0 for
4917 #     not adding an extent size hint (default: 1 MB, since 5.1)
4919 # Since: 2.12
4921 { 'struct': 'BlockdevCreateOptionsFile',
4922   'data': { 'filename':             'str',
4923             'size':                 'size',
4924             '*preallocation':       'PreallocMode',
4925             '*nocow':               'bool',
4926             '*extent-size-hint':    'size'} }
4929 # @BlockdevCreateOptionsGluster:
4931 # Driver specific image creation options for gluster.
4933 # @location: Where to store the new image file
4935 # @size: Size of the virtual disk in bytes
4937 # @preallocation: Preallocation mode for the new image (default: off;
4938 #     allowed values: off, falloc (if CONFIG_GLUSTERFS_FALLOCATE),
4939 #     full (if CONFIG_GLUSTERFS_ZEROFILL))
4941 # Since: 2.12
4943 { 'struct': 'BlockdevCreateOptionsGluster',
4944   'data': { 'location':         'BlockdevOptionsGluster',
4945             'size':             'size',
4946             '*preallocation':   'PreallocMode' } }
4949 # @BlockdevCreateOptionsLUKS:
4951 # Driver specific image creation options for LUKS.
4953 # @file: Node to create the image format on
4955 # @size: Size of the virtual disk in bytes
4957 # @preallocation: Preallocation mode for the new image (since: 4.2)
4958 #     (default: off; allowed values: off, metadata, falloc, full)
4960 # Since: 2.12
4962 { 'struct': 'BlockdevCreateOptionsLUKS',
4963   'base': 'QCryptoBlockCreateOptionsLUKS',
4964   'data': { 'file':             'BlockdevRef',
4965             'size':             'size',
4966             '*preallocation':   'PreallocMode' } }
4969 # @BlockdevCreateOptionsNfs:
4971 # Driver specific image creation options for NFS.
4973 # @location: Where to store the new image file
4975 # @size: Size of the virtual disk in bytes
4977 # Since: 2.12
4979 { 'struct': 'BlockdevCreateOptionsNfs',
4980   'data': { 'location':         'BlockdevOptionsNfs',
4981             'size':             'size' } }
4984 # @BlockdevCreateOptionsParallels:
4986 # Driver specific image creation options for parallels.
4988 # @file: Node to create the image format on
4990 # @size: Size of the virtual disk in bytes
4992 # @cluster-size: Cluster size in bytes (default: 1 MB)
4994 # Since: 2.12
4996 { 'struct': 'BlockdevCreateOptionsParallels',
4997   'data': { 'file':             'BlockdevRef',
4998             'size':             'size',
4999             '*cluster-size':    'size' } }
5002 # @BlockdevCreateOptionsQcow:
5004 # Driver specific image creation options for qcow.
5006 # @file: Node to create the image format on
5008 # @size: Size of the virtual disk in bytes
5010 # @backing-file: File name of the backing file if a backing file
5011 #     should be used
5013 # @encrypt: Encryption options if the image should be encrypted
5015 # Since: 2.12
5017 { 'struct': 'BlockdevCreateOptionsQcow',
5018   'data': { 'file':             'BlockdevRef',
5019             'size':             'size',
5020             '*backing-file':    'str',
5021             '*encrypt':         'QCryptoBlockCreateOptions' } }
5024 # @BlockdevQcow2Version:
5026 # @v2: The original QCOW2 format as introduced in qemu 0.10 (version
5027 #     2)
5029 # @v3: The extended QCOW2 format as introduced in qemu 1.1 (version 3)
5031 # Since: 2.12
5033 { 'enum': 'BlockdevQcow2Version',
5034   'data': [ 'v2', 'v3' ] }
5037 # @Qcow2CompressionType:
5039 # Compression type used in qcow2 image file
5041 # @zlib: zlib compression, see <http://zlib.net/>
5043 # @zstd: zstd compression, see <http://github.com/facebook/zstd>
5045 # Since: 5.1
5047 { 'enum': 'Qcow2CompressionType',
5048   'data': [ 'zlib', { 'name': 'zstd', 'if': 'CONFIG_ZSTD' } ] }
5051 # @BlockdevCreateOptionsQcow2:
5053 # Driver specific image creation options for qcow2.
5055 # @file: Node to create the image format on
5057 # @data-file: Node to use as an external data file in which all guest
5058 #     data is stored so that only metadata remains in the qcow2 file
5059 #     (since: 4.0)
5061 # @data-file-raw: True if the external data file must stay valid as a
5062 #     standalone (read-only) raw image without looking at qcow2
5063 #     metadata (default: false; since: 4.0)
5065 # @extended-l2: True to make the image have extended L2 entries
5066 #     (default: false; since 5.2)
5068 # @size: Size of the virtual disk in bytes
5070 # @version: Compatibility level (default: v3)
5072 # @backing-file: File name of the backing file if a backing file
5073 #     should be used
5075 # @backing-fmt: Name of the block driver to use for the backing file
5077 # @encrypt: Encryption options if the image should be encrypted
5079 # @cluster-size: qcow2 cluster size in bytes (default: 65536)
5081 # @preallocation: Preallocation mode for the new image (default: off;
5082 #     allowed values: off, falloc, full, metadata)
5084 # @lazy-refcounts: True if refcounts may be updated lazily
5085 #     (default: off)
5087 # @refcount-bits: Width of reference counts in bits (default: 16)
5089 # @compression-type: The image cluster compression method
5090 #     (default: zlib, since 5.1)
5092 # Since: 2.12
5094 { 'struct': 'BlockdevCreateOptionsQcow2',
5095   'data': { 'file':             'BlockdevRef',
5096             '*data-file':       'BlockdevRef',
5097             '*data-file-raw':   'bool',
5098             '*extended-l2':     'bool',
5099             'size':             'size',
5100             '*version':         'BlockdevQcow2Version',
5101             '*backing-file':    'str',
5102             '*backing-fmt':     'BlockdevDriver',
5103             '*encrypt':         'QCryptoBlockCreateOptions',
5104             '*cluster-size':    'size',
5105             '*preallocation':   'PreallocMode',
5106             '*lazy-refcounts':  'bool',
5107             '*refcount-bits':   'int',
5108             '*compression-type':'Qcow2CompressionType' } }
5111 # @BlockdevCreateOptionsQed:
5113 # Driver specific image creation options for qed.
5115 # @file: Node to create the image format on
5117 # @size: Size of the virtual disk in bytes
5119 # @backing-file: File name of the backing file if a backing file
5120 #     should be used
5122 # @backing-fmt: Name of the block driver to use for the backing file
5124 # @cluster-size: Cluster size in bytes (default: 65536)
5126 # @table-size: L1/L2 table size (in clusters)
5128 # Since: 2.12
5130 { 'struct': 'BlockdevCreateOptionsQed',
5131   'data': { 'file':             'BlockdevRef',
5132             'size':             'size',
5133             '*backing-file':    'str',
5134             '*backing-fmt':     'BlockdevDriver',
5135             '*cluster-size':    'size',
5136             '*table-size':      'int' } }
5139 # @BlockdevCreateOptionsRbd:
5141 # Driver specific image creation options for rbd/Ceph.
5143 # @location: Where to store the new image file.  This location cannot
5144 #     point to a snapshot.
5146 # @size: Size of the virtual disk in bytes
5148 # @cluster-size: RBD object size
5150 # @encrypt: Image encryption options.  (Since 6.1)
5152 # Since: 2.12
5154 { 'struct': 'BlockdevCreateOptionsRbd',
5155   'data': { 'location':         'BlockdevOptionsRbd',
5156             'size':             'size',
5157             '*cluster-size' :   'size',
5158             '*encrypt' :        'RbdEncryptionCreateOptions' } }
5161 # @BlockdevVmdkSubformat:
5163 # Subformat options for VMDK images
5165 # @monolithicSparse: Single file image with sparse cluster allocation
5167 # @monolithicFlat: Single flat data image and a descriptor file
5169 # @twoGbMaxExtentSparse: Data is split into 2GB (per virtual LBA)
5170 #     sparse extent files, in addition to a descriptor file
5172 # @twoGbMaxExtentFlat: Data is split into 2GB (per virtual LBA) flat
5173 #     extent files, in addition to a descriptor file
5175 # @streamOptimized: Single file image sparse cluster allocation,
5176 #     optimized for streaming over network.
5178 # Since: 4.0
5180 { 'enum': 'BlockdevVmdkSubformat',
5181   'data': [ 'monolithicSparse', 'monolithicFlat', 'twoGbMaxExtentSparse',
5182             'twoGbMaxExtentFlat', 'streamOptimized'] }
5185 # @BlockdevVmdkAdapterType:
5187 # Adapter type info for VMDK images
5189 # Since: 4.0
5191 { 'enum': 'BlockdevVmdkAdapterType',
5192   'data': [ 'ide', 'buslogic', 'lsilogic', 'legacyESX'] }
5195 # @BlockdevCreateOptionsVmdk:
5197 # Driver specific image creation options for VMDK.
5199 # @file: Where to store the new image file.  This refers to the image
5200 #     file for monolithcSparse and streamOptimized format, or the
5201 #     descriptor file for other formats.
5203 # @size: Size of the virtual disk in bytes
5205 # @extents: Where to store the data extents.  Required for
5206 #     monolithcFlat, twoGbMaxExtentSparse and twoGbMaxExtentFlat
5207 #     formats.  For monolithicFlat, only one entry is required; for
5208 #     twoGbMaxExtent* formats, the number of entries required is
5209 #     calculated as extent_number = virtual_size / 2GB. Providing more
5210 #     extents than will be used is an error.
5212 # @subformat: The subformat of the VMDK image.  Default:
5213 #     "monolithicSparse".
5215 # @backing-file: The path of backing file.  Default: no backing file
5216 #     is used.
5218 # @adapter-type: The adapter type used to fill in the descriptor.
5219 #     Default: ide.
5221 # @hwversion: Hardware version.  The meaningful options are "4" or
5222 #     "6". Default: "4".
5224 # @toolsversion: VMware guest tools version.  Default: "2147483647"
5225 #     (Since 6.2)
5227 # @zeroed-grain: Whether to enable zeroed-grain feature for sparse
5228 #     subformats.  Default: false.
5230 # Since: 4.0
5232 { 'struct': 'BlockdevCreateOptionsVmdk',
5233   'data': { 'file':             'BlockdevRef',
5234             'size':             'size',
5235             '*extents':          ['BlockdevRef'],
5236             '*subformat':       'BlockdevVmdkSubformat',
5237             '*backing-file':    'str',
5238             '*adapter-type':    'BlockdevVmdkAdapterType',
5239             '*hwversion':       'str',
5240             '*toolsversion':    'str',
5241             '*zeroed-grain':    'bool' } }
5244 # @BlockdevCreateOptionsSsh:
5246 # Driver specific image creation options for SSH.
5248 # @location: Where to store the new image file
5250 # @size: Size of the virtual disk in bytes
5252 # Since: 2.12
5254 { 'struct': 'BlockdevCreateOptionsSsh',
5255   'data': { 'location':         'BlockdevOptionsSsh',
5256             'size':             'size' } }
5259 # @BlockdevCreateOptionsVdi:
5261 # Driver specific image creation options for VDI.
5263 # @file: Node to create the image format on
5265 # @size: Size of the virtual disk in bytes
5267 # @preallocation: Preallocation mode for the new image (default: off;
5268 #     allowed values: off, metadata)
5270 # Since: 2.12
5272 { 'struct': 'BlockdevCreateOptionsVdi',
5273   'data': { 'file':             'BlockdevRef',
5274             'size':             'size',
5275             '*preallocation':   'PreallocMode' } }
5278 # @BlockdevVhdxSubformat:
5280 # @dynamic: Growing image file
5282 # @fixed: Preallocated fixed-size image file
5284 # Since: 2.12
5286 { 'enum': 'BlockdevVhdxSubformat',
5287   'data': [ 'dynamic', 'fixed' ] }
5290 # @BlockdevCreateOptionsVhdx:
5292 # Driver specific image creation options for vhdx.
5294 # @file: Node to create the image format on
5296 # @size: Size of the virtual disk in bytes
5298 # @log-size: Log size in bytes, must be a multiple of 1 MB (default: 1
5299 #     MB)
5301 # @block-size: Block size in bytes, must be a multiple of 1 MB and not
5302 #     larger than 256 MB (default: automatically choose a block size
5303 #     depending on the image size)
5305 # @subformat: vhdx subformat (default: dynamic)
5307 # @block-state-zero: Force use of payload blocks of type 'ZERO'.
5308 #     Non-standard, but default.  Do not set to 'off' when using
5309 #     'qemu-img convert' with subformat=dynamic.
5311 # Since: 2.12
5313 { 'struct': 'BlockdevCreateOptionsVhdx',
5314   'data': { 'file':                 'BlockdevRef',
5315             'size':                 'size',
5316             '*log-size':            'size',
5317             '*block-size':          'size',
5318             '*subformat':           'BlockdevVhdxSubformat',
5319             '*block-state-zero':    'bool' } }
5322 # @BlockdevVpcSubformat:
5324 # @dynamic: Growing image file
5326 # @fixed: Preallocated fixed-size image file
5328 # Since: 2.12
5330 { 'enum': 'BlockdevVpcSubformat',
5331   'data': [ 'dynamic', 'fixed' ] }
5334 # @BlockdevCreateOptionsVpc:
5336 # Driver specific image creation options for vpc (VHD).
5338 # @file: Node to create the image format on
5340 # @size: Size of the virtual disk in bytes
5342 # @subformat: vhdx subformat (default: dynamic)
5344 # @force-size: Force use of the exact byte size instead of rounding to
5345 #     the next size that can be represented in CHS geometry
5346 #     (default: false)
5348 # Since: 2.12
5350 { 'struct': 'BlockdevCreateOptionsVpc',
5351   'data': { 'file':                 'BlockdevRef',
5352             'size':                 'size',
5353             '*subformat':           'BlockdevVpcSubformat',
5354             '*force-size':          'bool' } }
5357 # @BlockdevCreateOptions:
5359 # Options for creating an image format on a given node.
5361 # @driver: block driver to create the image format
5363 # Since: 2.12
5365 { 'union': 'BlockdevCreateOptions',
5366   'base': {
5367       'driver':         'BlockdevDriver' },
5368   'discriminator': 'driver',
5369   'data': {
5370       'file':           'BlockdevCreateOptionsFile',
5371       'gluster':        'BlockdevCreateOptionsGluster',
5372       'luks':           'BlockdevCreateOptionsLUKS',
5373       'nfs':            'BlockdevCreateOptionsNfs',
5374       'parallels':      'BlockdevCreateOptionsParallels',
5375       'qcow':           'BlockdevCreateOptionsQcow',
5376       'qcow2':          'BlockdevCreateOptionsQcow2',
5377       'qed':            'BlockdevCreateOptionsQed',
5378       'rbd':            'BlockdevCreateOptionsRbd',
5379       'ssh':            'BlockdevCreateOptionsSsh',
5380       'vdi':            'BlockdevCreateOptionsVdi',
5381       'vhdx':           'BlockdevCreateOptionsVhdx',
5382       'vmdk':           'BlockdevCreateOptionsVmdk',
5383       'vpc':            'BlockdevCreateOptionsVpc'
5384   } }
5387 # @blockdev-create:
5389 # Starts a job to create an image format on a given node.  The job is
5390 # automatically finalized, but a manual job-dismiss is required.
5392 # @job-id: Identifier for the newly created job.
5394 # @options: Options for the image creation.
5396 # Since: 3.0
5398 { 'command': 'blockdev-create',
5399   'data': { 'job-id': 'str',
5400             'options': 'BlockdevCreateOptions' },
5401   'allow-preconfig': true }
5404 # @BlockdevAmendOptionsLUKS:
5406 # Driver specific image amend options for LUKS.
5408 # Since: 5.1
5410 { 'struct': 'BlockdevAmendOptionsLUKS',
5411   'base': 'QCryptoBlockAmendOptionsLUKS',
5412   'data': { }
5416 # @BlockdevAmendOptionsQcow2:
5418 # Driver specific image amend options for qcow2. For now, only
5419 # encryption options can be amended
5421 # @encrypt: Encryption options to be amended
5423 # Since: 5.1
5425 { 'struct': 'BlockdevAmendOptionsQcow2',
5426   'data': { '*encrypt':         'QCryptoBlockAmendOptions' } }
5429 # @BlockdevAmendOptions:
5431 # Options for amending an image format
5433 # @driver: Block driver of the node to amend.
5435 # Since: 5.1
5437 { 'union': 'BlockdevAmendOptions',
5438   'base': {
5439       'driver':         'BlockdevDriver' },
5440   'discriminator': 'driver',
5441   'data': {
5442       'luks':           'BlockdevAmendOptionsLUKS',
5443       'qcow2':          'BlockdevAmendOptionsQcow2' } }
5446 # @x-blockdev-amend:
5448 # Starts a job to amend format specific options of an existing open
5449 # block device The job is automatically finalized, but a manual
5450 # job-dismiss is required.
5452 # @job-id: Identifier for the newly created job.
5454 # @node-name: Name of the block node to work on
5456 # @options: Options (driver specific)
5458 # @force: Allow unsafe operations, format specific For luks that
5459 #     allows erase of the last active keyslot (permanent loss of
5460 #     data), and replacement of an active keyslot (possible loss of
5461 #     data if IO error happens)
5463 # Features:
5465 # @unstable: This command is experimental.
5467 # Since: 5.1
5469 { 'command': 'x-blockdev-amend',
5470   'data': { 'job-id': 'str',
5471             'node-name': 'str',
5472             'options': 'BlockdevAmendOptions',
5473             '*force': 'bool' },
5474   'features': [ 'unstable' ],
5475   'allow-preconfig': true }
5478 # @BlockErrorAction:
5480 # An enumeration of action that has been taken when a DISK I/O occurs
5482 # @ignore: error has been ignored
5484 # @report: error has been reported to the device
5486 # @stop: error caused VM to be stopped
5488 # Since: 2.1
5490 { 'enum': 'BlockErrorAction',
5491   'data': [ 'ignore', 'report', 'stop' ] }
5494 # @BLOCK_IMAGE_CORRUPTED:
5496 # Emitted when a disk image is being marked corrupt.  The image can be
5497 # identified by its device or node name.  The 'device' field is always
5498 # present for compatibility reasons, but it can be empty ("") if the
5499 # image does not have a device name associated.
5501 # @device: device name.  This is always present for compatibility
5502 #     reasons, but it can be empty ("") if the image does not have a
5503 #     device name associated.
5505 # @node-name: node name (Since: 2.4)
5507 # @msg: informative message for human consumption, such as the kind of
5508 #     corruption being detected.  It should not be parsed by machine
5509 #     as it is not guaranteed to be stable
5511 # @offset: if the corruption resulted from an image access, this is
5512 #     the host's access offset into the image
5514 # @size: if the corruption resulted from an image access, this is the
5515 #     access size
5517 # @fatal: if set, the image is marked corrupt and therefore unusable
5518 #     after this event and must be repaired (Since 2.2; before, every
5519 #     BLOCK_IMAGE_CORRUPTED event was fatal)
5521 # Note: If action is "stop", a STOP event will eventually follow the
5522 #     BLOCK_IO_ERROR event.
5524 # Example:
5526 # <- { "event": "BLOCK_IMAGE_CORRUPTED",
5527 #      "data": { "device": "", "node-name": "drive", "fatal": false,
5528 #                "msg": "L2 table offset 0x2a2a2a00 unaligned (L1 index: 0)" },
5529 #      "timestamp": { "seconds": 1648243240, "microseconds": 906060 } }
5531 # Since: 1.7
5533 { 'event': 'BLOCK_IMAGE_CORRUPTED',
5534   'data': { 'device'     : 'str',
5535             '*node-name' : 'str',
5536             'msg'        : 'str',
5537             '*offset'    : 'int',
5538             '*size'      : 'int',
5539             'fatal'      : 'bool' } }
5542 # @BLOCK_IO_ERROR:
5544 # Emitted when a disk I/O error occurs
5546 # @device: device name.  This is always present for compatibility
5547 #     reasons, but it can be empty ("") if the image does not have a
5548 #     device name associated.
5550 # @node-name: node name.  Note that errors may be reported for the
5551 #     root node that is directly attached to a guest device rather
5552 #     than for the node where the error occurred.  The node name is
5553 #     not present if the drive is empty.  (Since: 2.8)
5555 # @operation: I/O operation
5557 # @action: action that has been taken
5559 # @nospace: true if I/O error was caused due to a no-space condition.
5560 #     This key is only present if query-block's io-status is present,
5561 #     please see query-block documentation for more information
5562 #     (since: 2.2)
5564 # @reason: human readable string describing the error cause.  (This
5565 #     field is a debugging aid for humans, it should not be parsed by
5566 #     applications) (since: 2.2)
5568 # Note: If action is "stop", a STOP event will eventually follow the
5569 #     BLOCK_IO_ERROR event
5571 # Since: 0.13
5573 # Example:
5575 # <- { "event": "BLOCK_IO_ERROR",
5576 #      "data": { "device": "ide0-hd1",
5577 #                "node-name": "#block212",
5578 #                "operation": "write",
5579 #                "action": "stop",
5580 #                "reason": "No space left on device" },
5581 #      "timestamp": { "seconds": 1265044230, "microseconds": 450486 } }
5583 { 'event': 'BLOCK_IO_ERROR',
5584   'data': { 'device': 'str', '*node-name': 'str',
5585             'operation': 'IoOperationType',
5586             'action': 'BlockErrorAction', '*nospace': 'bool',
5587             'reason': 'str' } }
5590 # @BLOCK_JOB_COMPLETED:
5592 # Emitted when a block job has completed
5594 # @type: job type
5596 # @device: The job identifier.  Originally the device name but other
5597 #     values are allowed since QEMU 2.7
5599 # @len: maximum progress value
5601 # @offset: current progress value.  On success this is equal to len.
5602 #     On failure this is less than len
5604 # @speed: rate limit, bytes per second
5606 # @error: error message.  Only present on failure.  This field
5607 #     contains a human-readable error message.  There are no semantics
5608 #     other than that streaming has failed and clients should not try
5609 #     to interpret the error string
5611 # Since: 1.1
5613 # Example:
5615 # <- { "event": "BLOCK_JOB_COMPLETED",
5616 #      "data": { "type": "stream", "device": "virtio-disk0",
5617 #                "len": 10737418240, "offset": 10737418240,
5618 #                "speed": 0 },
5619 #      "timestamp": { "seconds": 1267061043, "microseconds": 959568 } }
5621 { 'event': 'BLOCK_JOB_COMPLETED',
5622   'data': { 'type'  : 'JobType',
5623             'device': 'str',
5624             'len'   : 'int',
5625             'offset': 'int',
5626             'speed' : 'int',
5627             '*error': 'str' } }
5630 # @BLOCK_JOB_CANCELLED:
5632 # Emitted when a block job has been cancelled
5634 # @type: job type
5636 # @device: The job identifier.  Originally the device name but other
5637 #     values are allowed since QEMU 2.7
5639 # @len: maximum progress value
5641 # @offset: current progress value.  On success this is equal to len.
5642 #     On failure this is less than len
5644 # @speed: rate limit, bytes per second
5646 # Since: 1.1
5648 # Example:
5650 # <- { "event": "BLOCK_JOB_CANCELLED",
5651 #      "data": { "type": "stream", "device": "virtio-disk0",
5652 #                "len": 10737418240, "offset": 134217728,
5653 #                "speed": 0 },
5654 #      "timestamp": { "seconds": 1267061043, "microseconds": 959568 } }
5656 { 'event': 'BLOCK_JOB_CANCELLED',
5657   'data': { 'type'  : 'JobType',
5658             'device': 'str',
5659             'len'   : 'int',
5660             'offset': 'int',
5661             'speed' : 'int' } }
5664 # @BLOCK_JOB_ERROR:
5666 # Emitted when a block job encounters an error
5668 # @device: The job identifier.  Originally the device name but other
5669 #     values are allowed since QEMU 2.7
5671 # @operation: I/O operation
5673 # @action: action that has been taken
5675 # Since: 1.3
5677 # Example:
5679 # <- { "event": "BLOCK_JOB_ERROR",
5680 #      "data": { "device": "ide0-hd1",
5681 #                "operation": "write",
5682 #                "action": "stop" },
5683 #      "timestamp": { "seconds": 1265044230, "microseconds": 450486 } }
5685 { 'event': 'BLOCK_JOB_ERROR',
5686   'data': { 'device'   : 'str',
5687             'operation': 'IoOperationType',
5688             'action'   : 'BlockErrorAction' } }
5691 # @BLOCK_JOB_READY:
5693 # Emitted when a block job is ready to complete
5695 # @type: job type
5697 # @device: The job identifier.  Originally the device name but other
5698 #     values are allowed since QEMU 2.7
5700 # @len: maximum progress value
5702 # @offset: current progress value.  On success this is equal to len.
5703 #     On failure this is less than len
5705 # @speed: rate limit, bytes per second
5707 # Note: The "ready to complete" status is always reset by a
5708 #     @BLOCK_JOB_ERROR event
5710 # Since: 1.3
5712 # Example:
5714 # <- { "event": "BLOCK_JOB_READY",
5715 #      "data": { "device": "drive0", "type": "mirror", "speed": 0,
5716 #                "len": 2097152, "offset": 2097152 },
5717 #      "timestamp": { "seconds": 1265044230, "microseconds": 450486 } }
5719 { 'event': 'BLOCK_JOB_READY',
5720   'data': { 'type'  : 'JobType',
5721             'device': 'str',
5722             'len'   : 'int',
5723             'offset': 'int',
5724             'speed' : 'int' } }
5727 # @BLOCK_JOB_PENDING:
5729 # Emitted when a block job is awaiting explicit authorization to
5730 # finalize graph changes via @block-job-finalize.  If this job is part
5731 # of a transaction, it will not emit this event until the transaction
5732 # has converged first.
5734 # @type: job type
5736 # @id: The job identifier.
5738 # Since: 2.12
5740 # Example:
5742 # <- { "event": "BLOCK_JOB_PENDING",
5743 #      "data": { "type": "mirror", "id": "backup_1" },
5744 #      "timestamp": { "seconds": 1265044230, "microseconds": 450486 } }
5746 { 'event': 'BLOCK_JOB_PENDING',
5747   'data': { 'type'  : 'JobType',
5748             'id'    : 'str' } }
5751 # @PreallocMode:
5753 # Preallocation mode of QEMU image file
5755 # @off: no preallocation
5757 # @metadata: preallocate only for metadata
5759 # @falloc: like @full preallocation but allocate disk space by
5760 #     posix_fallocate() rather than writing data.
5762 # @full: preallocate all data by writing it to the device to ensure
5763 #     disk space is really available.  This data may or may not be
5764 #     zero, depending on the image format and storage.  @full
5765 #     preallocation also sets up metadata correctly.
5767 # Since: 2.2
5769 { 'enum': 'PreallocMode',
5770   'data': [ 'off', 'metadata', 'falloc', 'full' ] }
5773 # @BLOCK_WRITE_THRESHOLD:
5775 # Emitted when writes on block device reaches or exceeds the
5776 # configured write threshold.  For thin-provisioned devices, this
5777 # means the device should be extended to avoid pausing for disk
5778 # exhaustion.  The event is one shot.  Once triggered, it needs to be
5779 # re-registered with another block-set-write-threshold command.
5781 # @node-name: graph node name on which the threshold was exceeded.
5783 # @amount-exceeded: amount of data which exceeded the threshold, in
5784 #     bytes.
5786 # @write-threshold: last configured threshold, in bytes.
5788 # Since: 2.3
5790 { 'event': 'BLOCK_WRITE_THRESHOLD',
5791   'data': { 'node-name': 'str',
5792             'amount-exceeded': 'uint64',
5793             'write-threshold': 'uint64' } }
5796 # @block-set-write-threshold:
5798 # Change the write threshold for a block drive.  An event will be
5799 # delivered if a write to this block drive crosses the configured
5800 # threshold.  The threshold is an offset, thus must be non-negative.
5801 # Default is no write threshold.  Setting the threshold to zero
5802 # disables it.
5804 # This is useful to transparently resize thin-provisioned drives
5805 # without the guest OS noticing.
5807 # @node-name: graph node name on which the threshold must be set.
5809 # @write-threshold: configured threshold for the block device, bytes.
5810 #     Use 0 to disable the threshold.
5812 # Since: 2.3
5814 # Example:
5816 # -> { "execute": "block-set-write-threshold",
5817 #      "arguments": { "node-name": "mydev",
5818 #                     "write-threshold": 17179869184 } }
5819 # <- { "return": {} }
5821 { 'command': 'block-set-write-threshold',
5822   'data': { 'node-name': 'str', 'write-threshold': 'uint64' },
5823   'allow-preconfig': true }
5826 # @x-blockdev-change:
5828 # Dynamically reconfigure the block driver state graph.  It can be
5829 # used to add, remove, insert or replace a graph node.  Currently only
5830 # the Quorum driver implements this feature to add or remove its
5831 # child.  This is useful to fix a broken quorum child.
5833 # If @node is specified, it will be inserted under @parent.  @child
5834 # may not be specified in this case.  If both @parent and @child are
5835 # specified but @node is not, @child will be detached from @parent.
5837 # @parent: the id or name of the parent node.
5839 # @child: the name of a child under the given parent node.
5841 # @node: the name of the node that will be added.
5843 # Features:
5845 # @unstable: This command is experimental, and its API is not stable.
5846 #     It does not support all kinds of operations, all kinds of
5847 #     children, nor all block drivers.
5849 #     FIXME Removing children from a quorum node means introducing
5850 #     gaps in the child indices.  This cannot be represented in the
5851 #     'children' list of BlockdevOptionsQuorum, as returned by
5852 #     .bdrv_refresh_filename().
5854 #     Warning: The data in a new quorum child MUST be consistent with
5855 #     that of the rest of the array.
5857 # Since: 2.7
5859 # Examples:
5861 # 1. Add a new node to a quorum
5863 # -> { "execute": "blockdev-add",
5864 #      "arguments": {
5865 #          "driver": "raw",
5866 #          "node-name": "new_node",
5867 #          "file": { "driver": "file",
5868 #                    "filename": "test.raw" } } }
5869 # <- { "return": {} }
5870 # -> { "execute": "x-blockdev-change",
5871 #      "arguments": { "parent": "disk1",
5872 #                     "node": "new_node" } }
5873 # <- { "return": {} }
5875 # 2. Delete a quorum's node
5877 # -> { "execute": "x-blockdev-change",
5878 #      "arguments": { "parent": "disk1",
5879 #                     "child": "children.1" } }
5880 # <- { "return": {} }
5882 { 'command': 'x-blockdev-change',
5883   'data' : { 'parent': 'str',
5884              '*child': 'str',
5885              '*node': 'str' },
5886   'features': [ 'unstable' ],
5887   'allow-preconfig': true }
5890 # @x-blockdev-set-iothread:
5892 # Move @node and its children into the @iothread.  If @iothread is
5893 # null then move @node and its children into the main loop.
5895 # The node must not be attached to a BlockBackend.
5897 # @node-name: the name of the block driver node
5899 # @iothread: the name of the IOThread object or null for the main loop
5901 # @force: true if the node and its children should be moved when a
5902 #     BlockBackend is already attached
5904 # Features:
5906 # @unstable: This command is experimental and intended for test cases
5907 #     that need control over IOThreads only.
5909 # Since: 2.12
5911 # Examples:
5913 # 1. Move a node into an IOThread
5915 # -> { "execute": "x-blockdev-set-iothread",
5916 #      "arguments": { "node-name": "disk1",
5917 #                     "iothread": "iothread0" } }
5918 # <- { "return": {} }
5920 # 2. Move a node into the main loop
5922 # -> { "execute": "x-blockdev-set-iothread",
5923 #      "arguments": { "node-name": "disk1",
5924 #                     "iothread": null } }
5925 # <- { "return": {} }
5927 { 'command': 'x-blockdev-set-iothread',
5928   'data' : { 'node-name': 'str',
5929              'iothread': 'StrOrNull',
5930              '*force': 'bool' },
5931   'features': [ 'unstable' ],
5932   'allow-preconfig': true }
5935 # @QuorumOpType:
5937 # An enumeration of the quorum operation types
5939 # @read: read operation
5941 # @write: write operation
5943 # @flush: flush operation
5945 # Since: 2.6
5947 { 'enum': 'QuorumOpType',
5948   'data': [ 'read', 'write', 'flush' ] }
5951 # @QUORUM_FAILURE:
5953 # Emitted by the Quorum block driver if it fails to establish a quorum
5955 # @reference: device name if defined else node name
5957 # @sector-num: number of the first sector of the failed read operation
5959 # @sectors-count: failed read operation sector count
5961 # Note: This event is rate-limited.
5963 # Since: 2.0
5965 # Example:
5967 # <- { "event": "QUORUM_FAILURE",
5968 #      "data": { "reference": "usr1", "sector-num": 345435, "sectors-count": 5 },
5969 #      "timestamp": { "seconds": 1344522075, "microseconds": 745528 } }
5971 { 'event': 'QUORUM_FAILURE',
5972   'data': { 'reference': 'str', 'sector-num': 'int', 'sectors-count': 'int' } }
5975 # @QUORUM_REPORT_BAD:
5977 # Emitted to report a corruption of a Quorum file
5979 # @type: quorum operation type (Since 2.6)
5981 # @error: error message.  Only present on failure.  This field
5982 #     contains a human-readable error message.  There are no semantics
5983 #     other than that the block layer reported an error and clients
5984 #     should not try to interpret the error string.
5986 # @node-name: the graph node name of the block driver state
5988 # @sector-num: number of the first sector of the failed read operation
5990 # @sectors-count: failed read operation sector count
5992 # Note: This event is rate-limited.
5994 # Since: 2.0
5996 # Examples:
5998 # 1. Read operation
6000 # <- { "event": "QUORUM_REPORT_BAD",
6001 #      "data": { "node-name": "node0", "sector-num": 345435, "sectors-count": 5,
6002 #                "type": "read" },
6003 #      "timestamp": { "seconds": 1344522075, "microseconds": 745528 } }
6005 # 2. Flush operation
6007 # <- { "event": "QUORUM_REPORT_BAD",
6008 #      "data": { "node-name": "node0", "sector-num": 0, "sectors-count": 2097120,
6009 #                "type": "flush", "error": "Broken pipe" },
6010 #      "timestamp": { "seconds": 1456406829, "microseconds": 291763 } }
6012 { 'event': 'QUORUM_REPORT_BAD',
6013   'data': { 'type': 'QuorumOpType', '*error': 'str', 'node-name': 'str',
6014             'sector-num': 'int', 'sectors-count': 'int' } }
6017 # @BlockdevSnapshotInternal:
6019 # @device: the device name or node-name of a root node to generate the
6020 #     snapshot from
6022 # @name: the name of the internal snapshot to be created
6024 # Notes: In transaction, if @name is empty, or any snapshot matching
6025 #     @name exists, the operation will fail.  Only some image formats
6026 #     support it, for example, qcow2, and rbd.
6028 # Since: 1.7
6030 { 'struct': 'BlockdevSnapshotInternal',
6031   'data': { 'device': 'str', 'name': 'str' } }
6034 # @blockdev-snapshot-internal-sync:
6036 # Synchronously take an internal snapshot of a block device, when the
6037 # format of the image used supports it.  If the name is an empty
6038 # string, or a snapshot with name already exists, the operation will
6039 # fail.
6041 # For the arguments, see the documentation of
6042 # BlockdevSnapshotInternal.
6044 # Returns:
6045 #     - nothing on success
6046 #     - If @device is not a valid block device, GenericError
6047 #     - If any snapshot matching @name exists, or @name is empty,
6048 #       GenericError
6049 #     - If the format of the image used does not support it,
6050 #       GenericError
6052 # Since: 1.7
6054 # Example:
6056 # -> { "execute": "blockdev-snapshot-internal-sync",
6057 #      "arguments": { "device": "ide-hd0",
6058 #                     "name": "snapshot0" }
6059 #    }
6060 # <- { "return": {} }
6062 { 'command': 'blockdev-snapshot-internal-sync',
6063   'data': 'BlockdevSnapshotInternal',
6064   'allow-preconfig': true }
6067 # @blockdev-snapshot-delete-internal-sync:
6069 # Synchronously delete an internal snapshot of a block device, when
6070 # the format of the image used support it.  The snapshot is identified
6071 # by name or id or both.  One of the name or id is required.  Return
6072 # SnapshotInfo for the successfully deleted snapshot.
6074 # @device: the device name or node-name of a root node to delete the
6075 #     snapshot from
6077 # @id: optional the snapshot's ID to be deleted
6079 # @name: optional the snapshot's name to be deleted
6081 # Returns:
6082 #     - SnapshotInfo on success
6083 #     - If @device is not a valid block device, GenericError
6084 #     - If snapshot not found, GenericError
6085 #     - If the format of the image used does not support it,
6086 #       GenericError
6087 #     - If @id and @name are both not specified, GenericError
6089 # Since: 1.7
6091 # Example:
6093 # -> { "execute": "blockdev-snapshot-delete-internal-sync",
6094 #      "arguments": { "device": "ide-hd0",
6095 #                     "name": "snapshot0" }
6096 #    }
6097 # <- { "return": {
6098 #                    "id": "1",
6099 #                    "name": "snapshot0",
6100 #                    "vm-state-size": 0,
6101 #                    "date-sec": 1000012,
6102 #                    "date-nsec": 10,
6103 #                    "vm-clock-sec": 100,
6104 #                    "vm-clock-nsec": 20,
6105 #                    "icount": 220414
6106 #      }
6107 #    }
6109 { 'command': 'blockdev-snapshot-delete-internal-sync',
6110   'data': { 'device': 'str', '*id': 'str', '*name': 'str'},
6111   'returns': 'SnapshotInfo',
6112   'allow-preconfig': true }
6115 # @DummyBlockCoreForceArrays:
6117 # Not used by QMP; hack to let us use BlockGraphInfoList internally
6119 # Since: 8.0
6121 { 'struct': 'DummyBlockCoreForceArrays',
6122   'data': { 'unused-block-graph-info': ['BlockGraphInfo'] } }