qapi/block-core: use JobType for BlockJobInfo's type
[qemu/kevin.git] / qapi / block-core.json
blob9d03210664e295a32e3d20a05322ca2ea1fa0dbd
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 # ::
663 #        5|           *
664 #        4|           *
665 #        3| *         *
666 #        2| *         *    *
667 #        1| *    *    *    *
668 #         +------------------
669 #             10   50   100
671 # Since: 4.0
673 { 'struct': 'BlockLatencyHistogramInfo',
674   'data': {'boundaries': ['uint64'], 'bins': ['uint64'] } }
677 # @BlockInfo:
679 # Block device information.  This structure describes a virtual device
680 # and the backing device associated with it.
682 # @device: The device name associated with the virtual device.
684 # @qdev: The qdev ID, or if no ID is assigned, the QOM path of the
685 #     block device.  (since 2.10)
687 # @type: This field is returned only for compatibility reasons, it
688 #     should not be used (always returns 'unknown')
690 # @removable: True if the device supports removable media.
692 # @locked: True if the guest has locked this device from having its
693 #     media removed
695 # @tray_open: True if the device's tray is open (only present if it
696 #     has a tray)
698 # @io-status: @BlockDeviceIoStatus.  Only present if the device
699 #     supports it and the VM is configured to stop on errors
700 #     (supported device models: virtio-blk, IDE, SCSI except
701 #     scsi-generic)
703 # @inserted: @BlockDeviceInfo describing the device if media is
704 #     present
706 # Since: 0.14
708 { 'struct': 'BlockInfo',
709   'data': {'device': 'str', '*qdev': 'str', 'type': 'str', 'removable': 'bool',
710            'locked': 'bool', '*inserted': 'BlockDeviceInfo',
711            '*tray_open': 'bool', '*io-status': 'BlockDeviceIoStatus' } }
714 # @BlockMeasureInfo:
716 # Image file size calculation information.  This structure describes
717 # the size requirements for creating a new image file.
719 # The size requirements depend on the new image file format.  File
720 # size always equals virtual disk size for the 'raw' format, even for
721 # sparse POSIX files.  Compact formats such as 'qcow2' represent
722 # unallocated and zero regions efficiently so file size may be smaller
723 # than virtual disk size.
725 # The values are upper bounds that are guaranteed to fit the new image
726 # file.  Subsequent modification, such as internal snapshot or further
727 # bitmap creation, may require additional space and is not covered
728 # here.
730 # @required: Size required for a new image file, in bytes, when
731 #     copying just allocated guest-visible contents.
733 # @fully-allocated: Image file size, in bytes, once data has been
734 #     written to all sectors, when copying just guest-visible
735 #     contents.
737 # @bitmaps: Additional size required if all the top-level bitmap
738 #     metadata in the source image were to be copied to the
739 #     destination, present only when source and destination both
740 #     support persistent bitmaps.  (since 5.1)
742 # Since: 2.10
744 { 'struct': 'BlockMeasureInfo',
745   'data': {'required': 'int', 'fully-allocated': 'int', '*bitmaps': 'int'} }
748 # @query-block:
750 # Get a list of BlockInfo for all virtual block devices.
752 # Returns: a list of @BlockInfo describing each virtual block device.
753 #     Filter nodes that were created implicitly are skipped over.
755 # Since: 0.14
757 # Example:
759 # -> { "execute": "query-block" }
760 # <- {
761 #       "return":[
762 #          {
763 #             "io-status": "ok",
764 #             "device":"ide0-hd0",
765 #             "locked":false,
766 #             "removable":false,
767 #             "inserted":{
768 #                "ro":false,
769 #                "drv":"qcow2",
770 #                "encrypted":false,
771 #                "file":"disks/test.qcow2",
772 #                "backing_file_depth":1,
773 #                "bps":1000000,
774 #                "bps_rd":0,
775 #                "bps_wr":0,
776 #                "iops":1000000,
777 #                "iops_rd":0,
778 #                "iops_wr":0,
779 #                "bps_max": 8000000,
780 #                "bps_rd_max": 0,
781 #                "bps_wr_max": 0,
782 #                "iops_max": 0,
783 #                "iops_rd_max": 0,
784 #                "iops_wr_max": 0,
785 #                "iops_size": 0,
786 #                "detect_zeroes": "on",
787 #                "write_threshold": 0,
788 #                "image":{
789 #                   "filename":"disks/test.qcow2",
790 #                   "format":"qcow2",
791 #                   "virtual-size":2048000,
792 #                   "backing_file":"base.qcow2",
793 #                   "full-backing-filename":"disks/base.qcow2",
794 #                   "backing-filename-format":"qcow2",
795 #                   "snapshots":[
796 #                      {
797 #                         "id": "1",
798 #                         "name": "snapshot1",
799 #                         "vm-state-size": 0,
800 #                         "date-sec": 10000200,
801 #                         "date-nsec": 12,
802 #                         "vm-clock-sec": 206,
803 #                         "vm-clock-nsec": 30
804 #                      }
805 #                   ],
806 #                   "backing-image":{
807 #                       "filename":"disks/base.qcow2",
808 #                       "format":"qcow2",
809 #                       "virtual-size":2048000
810 #                   }
811 #                }
812 #             },
813 #             "qdev": "ide_disk",
814 #             "type":"unknown"
815 #          },
816 #          {
817 #             "io-status": "ok",
818 #             "device":"ide1-cd0",
819 #             "locked":false,
820 #             "removable":true,
821 #             "qdev": "/machine/unattached/device[23]",
822 #             "tray_open": false,
823 #             "type":"unknown"
824 #          },
825 #          {
826 #             "device":"floppy0",
827 #             "locked":false,
828 #             "removable":true,
829 #             "qdev": "/machine/unattached/device[20]",
830 #             "type":"unknown"
831 #          },
832 #          {
833 #             "device":"sd0",
834 #             "locked":false,
835 #             "removable":true,
836 #             "type":"unknown"
837 #          }
838 #       ]
839 #    }
841 { 'command': 'query-block', 'returns': ['BlockInfo'],
842   'allow-preconfig': true }
845 # @BlockDeviceTimedStats:
847 # Statistics of a block device during a given interval of time.
849 # @interval_length: Interval used for calculating the statistics, in
850 #     seconds.
852 # @min_rd_latency_ns: Minimum latency of read operations in the
853 #     defined interval, in nanoseconds.
855 # @min_wr_latency_ns: Minimum latency of write operations in the
856 #     defined interval, in nanoseconds.
858 # @min_zone_append_latency_ns: Minimum latency of zone append
859 #     operations in the defined interval, in nanoseconds (since 8.1)
861 # @min_flush_latency_ns: Minimum latency of flush operations in the
862 #     defined interval, in nanoseconds.
864 # @max_rd_latency_ns: Maximum latency of read operations in the
865 #     defined interval, in nanoseconds.
867 # @max_wr_latency_ns: Maximum latency of write operations in the
868 #     defined interval, in nanoseconds.
870 # @max_zone_append_latency_ns: Maximum latency of zone append
871 #     operations in the defined interval, in nanoseconds (since 8.1)
873 # @max_flush_latency_ns: Maximum latency of flush operations in the
874 #     defined interval, in nanoseconds.
876 # @avg_rd_latency_ns: Average latency of read operations in the
877 #     defined interval, in nanoseconds.
879 # @avg_wr_latency_ns: Average latency of write operations in the
880 #     defined interval, in nanoseconds.
882 # @avg_zone_append_latency_ns: Average latency of zone append
883 #     operations in the defined interval, in nanoseconds (since 8.1)
885 # @avg_flush_latency_ns: Average latency of flush operations in the
886 #     defined interval, in nanoseconds.
888 # @avg_rd_queue_depth: Average number of pending read operations in
889 #     the defined interval.
891 # @avg_wr_queue_depth: Average number of pending write operations in
892 #     the defined interval.
894 # @avg_zone_append_queue_depth: Average number of pending zone append
895 #     operations in the defined interval (since 8.1).
897 # Since: 2.5
899 { 'struct': 'BlockDeviceTimedStats',
900   'data': { 'interval_length': 'int', 'min_rd_latency_ns': 'int',
901             'max_rd_latency_ns': 'int', 'avg_rd_latency_ns': 'int',
902             'min_wr_latency_ns': 'int', 'max_wr_latency_ns': 'int',
903             'avg_wr_latency_ns': 'int', 'min_zone_append_latency_ns': 'int',
904             'max_zone_append_latency_ns': 'int',
905             'avg_zone_append_latency_ns': 'int',
906             'min_flush_latency_ns': 'int', 'max_flush_latency_ns': 'int',
907             'avg_flush_latency_ns': 'int', 'avg_rd_queue_depth': 'number',
908             'avg_wr_queue_depth': 'number',
909             'avg_zone_append_queue_depth': 'number'  } }
912 # @BlockDeviceStats:
914 # Statistics of a virtual block device or a block backing device.
916 # @rd_bytes: The number of bytes read by the device.
918 # @wr_bytes: The number of bytes written by the device.
920 # @zone_append_bytes: The number of bytes appended by the zoned
921 #     devices (since 8.1)
923 # @unmap_bytes: The number of bytes unmapped by the device (Since 4.2)
925 # @rd_operations: The number of read operations performed by the
926 #     device.
928 # @wr_operations: The number of write operations performed by the
929 #     device.
931 # @zone_append_operations: The number of zone append operations
932 #     performed by the zoned devices (since 8.1)
934 # @flush_operations: The number of cache flush operations performed by
935 #     the device (since 0.15)
937 # @unmap_operations: The number of unmap operations performed by the
938 #     device (Since 4.2)
940 # @rd_total_time_ns: Total time spent on reads in nanoseconds (since
941 #     0.15).
943 # @wr_total_time_ns: Total time spent on writes in nanoseconds (since
944 #     0.15).
946 # @zone_append_total_time_ns: Total time spent on zone append writes
947 #     in nanoseconds (since 8.1)
949 # @flush_total_time_ns: Total time spent on cache flushes in
950 #     nanoseconds (since 0.15).
952 # @unmap_total_time_ns: Total time spent on unmap operations in
953 #     nanoseconds (Since 4.2)
955 # @wr_highest_offset: The offset after the greatest byte written to
956 #     the device.  The intended use of this information is for
957 #     growable sparse files (like qcow2) that are used on top of a
958 #     physical device.
960 # @rd_merged: Number of read requests that have been merged into
961 #     another request (Since 2.3).
963 # @wr_merged: Number of write requests that have been merged into
964 #     another request (Since 2.3).
966 # @zone_append_merged: Number of zone append requests that have been
967 #     merged into another request (since 8.1)
969 # @unmap_merged: Number of unmap requests that have been merged into
970 #     another request (Since 4.2)
972 # @idle_time_ns: Time since the last I/O operation, in nanoseconds.
973 #     If the field is absent it means that there haven't been any
974 #     operations yet (Since 2.5).
976 # @failed_rd_operations: The number of failed read operations
977 #     performed by the device (Since 2.5)
979 # @failed_wr_operations: The number of failed write operations
980 #     performed by the device (Since 2.5)
982 # @failed_zone_append_operations: The number of failed zone append
983 #     write operations performed by the zoned devices (since 8.1)
985 # @failed_flush_operations: The number of failed flush operations
986 #     performed by the device (Since 2.5)
988 # @failed_unmap_operations: The number of failed unmap operations
989 #     performed by the device (Since 4.2)
991 # @invalid_rd_operations: The number of invalid read operations
992 #     performed by the device (Since 2.5)
994 # @invalid_wr_operations: The number of invalid write operations
995 #     performed by the device (Since 2.5)
997 # @invalid_zone_append_operations: The number of invalid zone append
998 #     operations performed by the zoned device (since 8.1)
1000 # @invalid_flush_operations: The number of invalid flush operations
1001 #     performed by the device (Since 2.5)
1003 # @invalid_unmap_operations: The number of invalid unmap operations
1004 #     performed by the device (Since 4.2)
1006 # @account_invalid: Whether invalid operations are included in the
1007 #     last access statistics (Since 2.5)
1009 # @account_failed: Whether failed operations are included in the
1010 #     latency and last access statistics (Since 2.5)
1012 # @timed_stats: Statistics specific to the set of previously defined
1013 #     intervals of time (Since 2.5)
1015 # @rd_latency_histogram: @BlockLatencyHistogramInfo.  (Since 4.0)
1017 # @wr_latency_histogram: @BlockLatencyHistogramInfo.  (Since 4.0)
1019 # @zone_append_latency_histogram: @BlockLatencyHistogramInfo.
1020 #     (since 8.1)
1022 # @flush_latency_histogram: @BlockLatencyHistogramInfo.  (Since 4.0)
1024 # Since: 0.14
1026 { 'struct': 'BlockDeviceStats',
1027   'data': {'rd_bytes': 'int', 'wr_bytes': 'int', 'zone_append_bytes': 'int',
1028            'unmap_bytes' : 'int', 'rd_operations': 'int',
1029            'wr_operations': 'int', 'zone_append_operations': 'int',
1030            'flush_operations': 'int', 'unmap_operations': 'int',
1031            'rd_total_time_ns': 'int', 'wr_total_time_ns': 'int',
1032            'zone_append_total_time_ns': 'int', 'flush_total_time_ns': 'int',
1033            'unmap_total_time_ns': 'int', 'wr_highest_offset': 'int',
1034            'rd_merged': 'int', 'wr_merged': 'int', 'zone_append_merged': 'int',
1035            'unmap_merged': 'int', '*idle_time_ns': 'int',
1036            'failed_rd_operations': 'int', 'failed_wr_operations': 'int',
1037            'failed_zone_append_operations': 'int',
1038            'failed_flush_operations': 'int',
1039            'failed_unmap_operations': 'int', 'invalid_rd_operations': 'int',
1040            'invalid_wr_operations': 'int',
1041            'invalid_zone_append_operations': 'int',
1042            'invalid_flush_operations': 'int', 'invalid_unmap_operations': 'int',
1043            'account_invalid': 'bool', 'account_failed': 'bool',
1044            'timed_stats': ['BlockDeviceTimedStats'],
1045            '*rd_latency_histogram': 'BlockLatencyHistogramInfo',
1046            '*wr_latency_histogram': 'BlockLatencyHistogramInfo',
1047            '*zone_append_latency_histogram': 'BlockLatencyHistogramInfo',
1048            '*flush_latency_histogram': 'BlockLatencyHistogramInfo' } }
1051 # @BlockStatsSpecificFile:
1053 # File driver statistics
1055 # @discard-nb-ok: The number of successful discard operations
1056 #     performed by the driver.
1058 # @discard-nb-failed: The number of failed discard operations
1059 #     performed by the driver.
1061 # @discard-bytes-ok: The number of bytes discarded by the driver.
1063 # Since: 4.2
1065 { 'struct': 'BlockStatsSpecificFile',
1066   'data': {
1067       'discard-nb-ok': 'uint64',
1068       'discard-nb-failed': 'uint64',
1069       'discard-bytes-ok': 'uint64' } }
1072 # @BlockStatsSpecificNvme:
1074 # NVMe driver statistics
1076 # @completion-errors: The number of completion errors.
1078 # @aligned-accesses: The number of aligned accesses performed by the
1079 #     driver.
1081 # @unaligned-accesses: The number of unaligned accesses performed by
1082 #     the driver.
1084 # Since: 5.2
1086 { 'struct': 'BlockStatsSpecificNvme',
1087   'data': {
1088       'completion-errors': 'uint64',
1089       'aligned-accesses': 'uint64',
1090       'unaligned-accesses': 'uint64' } }
1093 # @BlockStatsSpecific:
1095 # Block driver specific statistics
1097 # Since: 4.2
1099 { 'union': 'BlockStatsSpecific',
1100   'base': { 'driver': 'BlockdevDriver' },
1101   'discriminator': 'driver',
1102   'data': {
1103       'file': 'BlockStatsSpecificFile',
1104       'host_device': { 'type': 'BlockStatsSpecificFile',
1105                        'if': 'HAVE_HOST_BLOCK_DEVICE' },
1106       'nvme': 'BlockStatsSpecificNvme' } }
1109 # @BlockStats:
1111 # Statistics of a virtual block device or a block backing device.
1113 # @device: If the stats are for a virtual block device, the name
1114 #     corresponding to the virtual block device.
1116 # @node-name: The node name of the device.  (Since 2.3)
1118 # @qdev: The qdev ID, or if no ID is assigned, the QOM path of the
1119 #     block device.  (since 3.0)
1121 # @stats: A @BlockDeviceStats for the device.
1123 # @driver-specific: Optional driver-specific stats.  (Since 4.2)
1125 # @parent: This describes the file block device if it has one.
1126 #     Contains recursively the statistics of the underlying protocol
1127 #     (e.g. the host file for a qcow2 image).  If there is no
1128 #     underlying protocol, this field is omitted
1130 # @backing: This describes the backing block device if it has one.
1131 #     (Since 2.0)
1133 # Since: 0.14
1135 { 'struct': 'BlockStats',
1136   'data': {'*device': 'str', '*qdev': 'str', '*node-name': 'str',
1137            'stats': 'BlockDeviceStats',
1138            '*driver-specific': 'BlockStatsSpecific',
1139            '*parent': 'BlockStats',
1140            '*backing': 'BlockStats'} }
1143 # @query-blockstats:
1145 # Query the @BlockStats for all virtual block devices.
1147 # @query-nodes: If true, the command will query all the block nodes
1148 #     that have a node name, in a list which will include "parent"
1149 #     information, but not "backing". If false or omitted, the
1150 #     behavior is as before - query all the device backends,
1151 #     recursively including their "parent" and "backing". Filter nodes
1152 #     that were created implicitly are skipped over in this mode.
1153 #     (Since 2.3)
1155 # Returns: A list of @BlockStats for each virtual block devices.
1157 # Since: 0.14
1159 # Example:
1161 # -> { "execute": "query-blockstats" }
1162 # <- {
1163 #       "return":[
1164 #          {
1165 #             "device":"ide0-hd0",
1166 #             "parent":{
1167 #                "stats":{
1168 #                   "wr_highest_offset":3686448128,
1169 #                   "wr_bytes":9786368,
1170 #                   "wr_operations":751,
1171 #                   "rd_bytes":122567168,
1172 #                   "rd_operations":36772
1173 #                   "wr_total_times_ns":313253456
1174 #                   "rd_total_times_ns":3465673657
1175 #                   "flush_total_times_ns":49653
1176 #                   "flush_operations":61,
1177 #                   "rd_merged":0,
1178 #                   "wr_merged":0,
1179 #                   "idle_time_ns":2953431879,
1180 #                   "account_invalid":true,
1181 #                   "account_failed":false
1182 #                }
1183 #             },
1184 #             "stats":{
1185 #                "wr_highest_offset":2821110784,
1186 #                "wr_bytes":9786368,
1187 #                "wr_operations":692,
1188 #                "rd_bytes":122739200,
1189 #                "rd_operations":36604
1190 #                "flush_operations":51,
1191 #                "wr_total_times_ns":313253456
1192 #                "rd_total_times_ns":3465673657
1193 #                "flush_total_times_ns":49653,
1194 #                "rd_merged":0,
1195 #                "wr_merged":0,
1196 #                "idle_time_ns":2953431879,
1197 #                "account_invalid":true,
1198 #                "account_failed":false
1199 #             },
1200 #             "qdev": "/machine/unattached/device[23]"
1201 #          },
1202 #          {
1203 #             "device":"ide1-cd0",
1204 #             "stats":{
1205 #                "wr_highest_offset":0,
1206 #                "wr_bytes":0,
1207 #                "wr_operations":0,
1208 #                "rd_bytes":0,
1209 #                "rd_operations":0
1210 #                "flush_operations":0,
1211 #                "wr_total_times_ns":0
1212 #                "rd_total_times_ns":0
1213 #                "flush_total_times_ns":0,
1214 #                "rd_merged":0,
1215 #                "wr_merged":0,
1216 #                "account_invalid":false,
1217 #                "account_failed":false
1218 #             },
1219 #             "qdev": "/machine/unattached/device[24]"
1220 #          },
1221 #          {
1222 #             "device":"floppy0",
1223 #             "stats":{
1224 #                "wr_highest_offset":0,
1225 #                "wr_bytes":0,
1226 #                "wr_operations":0,
1227 #                "rd_bytes":0,
1228 #                "rd_operations":0
1229 #                "flush_operations":0,
1230 #                "wr_total_times_ns":0
1231 #                "rd_total_times_ns":0
1232 #                "flush_total_times_ns":0,
1233 #                "rd_merged":0,
1234 #                "wr_merged":0,
1235 #                "account_invalid":false,
1236 #                "account_failed":false
1237 #             },
1238 #             "qdev": "/machine/unattached/device[16]"
1239 #          },
1240 #          {
1241 #             "device":"sd0",
1242 #             "stats":{
1243 #                "wr_highest_offset":0,
1244 #                "wr_bytes":0,
1245 #                "wr_operations":0,
1246 #                "rd_bytes":0,
1247 #                "rd_operations":0
1248 #                "flush_operations":0,
1249 #                "wr_total_times_ns":0
1250 #                "rd_total_times_ns":0
1251 #                "flush_total_times_ns":0,
1252 #                "rd_merged":0,
1253 #                "wr_merged":0,
1254 #                "account_invalid":false,
1255 #                "account_failed":false
1256 #             }
1257 #          }
1258 #       ]
1259 #    }
1261 { 'command': 'query-blockstats',
1262   'data': { '*query-nodes': 'bool' },
1263   'returns': ['BlockStats'],
1264   'allow-preconfig': true }
1267 # @BlockdevOnError:
1269 # An enumeration of possible behaviors for errors on I/O operations.
1270 # The exact meaning depends on whether the I/O was initiated by a
1271 # guest or by a block job
1273 # @report: for guest operations, report the error to the guest; for
1274 #     jobs, cancel the job
1276 # @ignore: ignore the error, only report a QMP event (BLOCK_IO_ERROR
1277 #     or BLOCK_JOB_ERROR). The backup, mirror and commit block jobs
1278 #     retry the failing request later and may still complete
1279 #     successfully.  The stream block job continues to stream and will
1280 #     complete with an error.
1282 # @enospc: same as @stop on ENOSPC, same as @report otherwise.
1284 # @stop: for guest operations, stop the virtual machine; for jobs,
1285 #     pause the job
1287 # @auto: inherit the error handling policy of the backend (since: 2.7)
1289 # Since: 1.3
1291 { 'enum': 'BlockdevOnError',
1292   'data': ['report', 'ignore', 'enospc', 'stop', 'auto'] }
1295 # @MirrorSyncMode:
1297 # An enumeration of possible behaviors for the initial synchronization
1298 # phase of storage mirroring.
1300 # @top: copies data in the topmost image to the destination
1302 # @full: copies data from all images to the destination
1304 # @none: only copy data written from now on
1306 # @incremental: only copy data described by the dirty bitmap.
1307 #     (since: 2.4)
1309 # @bitmap: only copy data described by the dirty bitmap.  (since: 4.2)
1310 #     Behavior on completion is determined by the BitmapSyncMode.
1312 # Since: 1.3
1314 { 'enum': 'MirrorSyncMode',
1315   'data': ['top', 'full', 'none', 'incremental', 'bitmap'] }
1318 # @BitmapSyncMode:
1320 # An enumeration of possible behaviors for the synchronization of a
1321 # bitmap when used for data copy operations.
1323 # @on-success: The bitmap is only synced when the operation is
1324 #     successful.  This is the behavior always used for 'INCREMENTAL'
1325 #     backups.
1327 # @never: The bitmap is never synchronized with the operation, and is
1328 #     treated solely as a read-only manifest of blocks to copy.
1330 # @always: The bitmap is always synchronized with the operation,
1331 #     regardless of whether or not the operation was successful.
1333 # Since: 4.2
1335 { 'enum': 'BitmapSyncMode',
1336   'data': ['on-success', 'never', 'always'] }
1339 # @MirrorCopyMode:
1341 # An enumeration whose values tell the mirror block job when to
1342 # trigger writes to the target.
1344 # @background: copy data in background only.
1346 # @write-blocking: when data is written to the source, write it
1347 #     (synchronously) to the target as well.  In addition, data is
1348 #     copied in background just like in @background mode.
1350 # Since: 3.0
1352 { 'enum': 'MirrorCopyMode',
1353   'data': ['background', 'write-blocking'] }
1356 # @BlockJobInfo:
1358 # Information about a long-running block device operation.
1360 # @type: the job type ('stream' for image streaming)
1362 # @device: The job identifier.  Originally the device name but other
1363 #     values are allowed since QEMU 2.7
1365 # @len: Estimated @offset value at the completion of the job.  This
1366 #     value can arbitrarily change while the job is running, in both
1367 #     directions.
1369 # @offset: Progress made until now.  The unit is arbitrary and the
1370 #     value can only meaningfully be used for the ratio of @offset to
1371 #     @len.  The value is monotonically increasing.
1373 # @busy: false if the job is known to be in a quiescent state, with no
1374 #     pending I/O.  (Since 1.3)
1376 # @paused: whether the job is paused or, if @busy is true, will pause
1377 #     itself as soon as possible.  (Since 1.3)
1379 # @speed: the rate limit, bytes per second
1381 # @io-status: the status of the job (since 1.3)
1383 # @ready: true if the job may be completed (since 2.2)
1385 # @status: Current job state/status (since 2.12)
1387 # @auto-finalize: Job will finalize itself when PENDING, moving to the
1388 #     CONCLUDED state.  (since 2.12)
1390 # @auto-dismiss: Job will dismiss itself when CONCLUDED, moving to the
1391 #     NULL state and disappearing from the query list.  (since 2.12)
1393 # @error: Error information if the job did not complete successfully.
1394 #     Not set if the job completed successfully.  (since 2.12.1)
1396 # Since: 1.1
1398 { 'struct': 'BlockJobInfo',
1399   'data': {'type': 'JobType', 'device': 'str', 'len': 'int',
1400            'offset': 'int', 'busy': 'bool', 'paused': 'bool', 'speed': 'int',
1401            'io-status': 'BlockDeviceIoStatus', 'ready': 'bool',
1402            'status': 'JobStatus',
1403            'auto-finalize': 'bool', 'auto-dismiss': 'bool',
1404            '*error': 'str' } }
1407 # @query-block-jobs:
1409 # Return information about long-running block device operations.
1411 # Returns: a list of @BlockJobInfo for each active block job
1413 # Since: 1.1
1415 { 'command': 'query-block-jobs', 'returns': ['BlockJobInfo'],
1416   'allow-preconfig': true }
1419 # @block_resize:
1421 # Resize a block image while a guest is running.
1423 # Either @device or @node-name must be set but not both.
1425 # @device: the name of the device to get the image resized
1427 # @node-name: graph node name to get the image resized (Since 2.0)
1429 # @size: new image size in bytes
1431 # Returns:
1432 #     - nothing on success
1433 #     - If @device is not a valid block device, DeviceNotFound
1435 # Since: 0.14
1437 # Example:
1439 # -> { "execute": "block_resize",
1440 #      "arguments": { "device": "scratch", "size": 1073741824 } }
1441 # <- { "return": {} }
1443 { 'command': 'block_resize',
1444   'data': { '*device': 'str',
1445             '*node-name': 'str',
1446             'size': 'int' },
1447   'coroutine': true,
1448   'allow-preconfig': true }
1451 # @NewImageMode:
1453 # An enumeration that tells QEMU how to set the backing file path in a
1454 # new image file.
1456 # @existing: QEMU should look for an existing image file.
1458 # @absolute-paths: QEMU should create a new image with absolute paths
1459 #     for the backing file.  If there is no backing file available,
1460 #     the new image will not be backed either.
1462 # Since: 1.1
1464 { 'enum': 'NewImageMode',
1465   'data': [ 'existing', 'absolute-paths' ] }
1468 # @BlockdevSnapshotSync:
1470 # Either @device or @node-name must be set but not both.
1472 # @device: the name of the device to take a snapshot of.
1474 # @node-name: graph node name to generate the snapshot from (Since
1475 #     2.0)
1477 # @snapshot-file: the target of the new overlay image.  If the file
1478 #     exists, or if it is a device, the overlay will be created in the
1479 #     existing file/device.  Otherwise, a new file will be created.
1481 # @snapshot-node-name: the graph node name of the new image (Since
1482 #     2.0)
1484 # @format: the format of the overlay image, default is 'qcow2'.
1486 # @mode: whether and how QEMU should create a new image, default is
1487 #     'absolute-paths'.
1489 { 'struct': 'BlockdevSnapshotSync',
1490   'data': { '*device': 'str', '*node-name': 'str',
1491             'snapshot-file': 'str', '*snapshot-node-name': 'str',
1492             '*format': 'str', '*mode': 'NewImageMode' } }
1495 # @BlockdevSnapshot:
1497 # @node: device or node name that will have a snapshot taken.
1499 # @overlay: reference to the existing block device that will become
1500 #     the overlay of @node, as part of taking the snapshot.  It must
1501 #     not have a current backing file (this can be achieved by passing
1502 #     "backing": null to blockdev-add).
1504 # Since: 2.5
1506 { 'struct': 'BlockdevSnapshot',
1507   'data': { 'node': 'str', 'overlay': 'str' } }
1510 # @BackupPerf:
1512 # Optional parameters for backup.  These parameters don't affect
1513 # functionality, but may significantly affect performance.
1515 # @use-copy-range: Use copy offloading.  Default false.
1517 # @max-workers: Maximum number of parallel requests for the sustained
1518 #     background copying process.  Doesn't influence copy-before-write
1519 #     operations.  Default 64.
1521 # @max-chunk: Maximum request length for the sustained background
1522 #     copying process.  Doesn't influence copy-before-write
1523 #     operations.  0 means unlimited.  If max-chunk is non-zero then
1524 #     it should not be less than job cluster size which is calculated
1525 #     as maximum of target image cluster size and 64k.  Default 0.
1527 # Since: 6.0
1529 { 'struct': 'BackupPerf',
1530   'data': { '*use-copy-range': 'bool',
1531             '*max-workers': 'int', '*max-chunk': 'int64' } }
1534 # @BackupCommon:
1536 # @job-id: identifier for the newly-created block job.  If omitted,
1537 #     the device name will be used.  (Since 2.7)
1539 # @device: the device name or node-name of a root node which should be
1540 #     copied.
1542 # @sync: what parts of the disk image should be copied to the
1543 #     destination (all the disk, only the sectors allocated in the
1544 #     topmost image, from a dirty bitmap, or only new I/O).
1546 # @speed: the maximum speed, in bytes per second.  The default is 0,
1547 #     for unlimited.
1549 # @bitmap: The name of a dirty bitmap to use.  Must be present if sync
1550 #     is "bitmap" or "incremental". Can be present if sync is "full"
1551 #     or "top".  Must not be present otherwise.
1552 #     (Since 2.4 (drive-backup), 3.1 (blockdev-backup))
1554 # @bitmap-mode: Specifies the type of data the bitmap should contain
1555 #     after the operation concludes.  Must be present if a bitmap was
1556 #     provided, Must NOT be present otherwise.  (Since 4.2)
1558 # @compress: true to compress data, if the target format supports it.
1559 #     (default: false) (since 2.8)
1561 # @on-source-error: the action to take on an error on the source,
1562 #     default 'report'.  'stop' and 'enospc' can only be used if the
1563 #     block device supports io-status (see BlockInfo).
1565 # @on-target-error: the action to take on an error on the target,
1566 #     default 'report' (no limitations, since this applies to a
1567 #     different block device than @device).
1569 # @auto-finalize: When false, this job will wait in a PENDING state
1570 #     after it has finished its work, waiting for @block-job-finalize
1571 #     before making any block graph changes.  When true, this job will
1572 #     automatically perform its abort or commit actions.  Defaults to
1573 #     true.  (Since 2.12)
1575 # @auto-dismiss: When false, this job will wait in a CONCLUDED state
1576 #     after it has completely ceased all work, and awaits
1577 #     @block-job-dismiss.  When true, this job will automatically
1578 #     disappear from the query list without user intervention.
1579 #     Defaults to true.  (Since 2.12)
1581 # @filter-node-name: the node name that should be assigned to the
1582 #     filter driver that the backup job inserts into the graph above
1583 #     node specified by @drive.  If this option is not given, a node
1584 #     name is autogenerated.  (Since: 4.2)
1586 # @x-perf: Performance options.  (Since 6.0)
1588 # Features:
1590 # @unstable: Member @x-perf is experimental.
1592 # Note: @on-source-error and @on-target-error only affect background
1593 #     I/O.  If an error occurs during a guest write request, the
1594 #     device's rerror/werror actions will be used.
1596 # Since: 4.2
1598 { 'struct': 'BackupCommon',
1599   'data': { '*job-id': 'str', 'device': 'str',
1600             'sync': 'MirrorSyncMode', '*speed': 'int',
1601             '*bitmap': 'str', '*bitmap-mode': 'BitmapSyncMode',
1602             '*compress': 'bool',
1603             '*on-source-error': 'BlockdevOnError',
1604             '*on-target-error': 'BlockdevOnError',
1605             '*auto-finalize': 'bool', '*auto-dismiss': 'bool',
1606             '*filter-node-name': 'str',
1607             '*x-perf': { 'type': 'BackupPerf',
1608                          'features': [ 'unstable' ] } } }
1611 # @DriveBackup:
1613 # @target: the target of the new image.  If the file exists, or if it
1614 #     is a device, the existing file/device will be used as the new
1615 #     destination.  If it does not exist, a new file will be created.
1617 # @format: the format of the new destination, default is to probe if
1618 #     @mode is 'existing', else the format of the source
1620 # @mode: whether and how QEMU should create a new image, default is
1621 #     'absolute-paths'.
1623 # Since: 1.6
1625 { 'struct': 'DriveBackup',
1626   'base': 'BackupCommon',
1627   'data': { 'target': 'str',
1628             '*format': 'str',
1629             '*mode': 'NewImageMode' } }
1632 # @BlockdevBackup:
1634 # @target: the device name or node-name of the backup target node.
1636 # Since: 2.3
1638 { 'struct': 'BlockdevBackup',
1639   'base': 'BackupCommon',
1640   'data': { 'target': 'str' } }
1643 # @blockdev-snapshot-sync:
1645 # Takes a synchronous snapshot of a block device.
1647 # For the arguments, see the documentation of BlockdevSnapshotSync.
1649 # Returns:
1650 #     - nothing on success
1651 #     - If @device is not a valid block device, DeviceNotFound
1653 # Since: 0.14
1655 # Example:
1657 # -> { "execute": "blockdev-snapshot-sync",
1658 #      "arguments": { "device": "ide-hd0",
1659 #                     "snapshot-file":
1660 #                     "/some/place/my-image",
1661 #                     "format": "qcow2" } }
1662 # <- { "return": {} }
1664 { 'command': 'blockdev-snapshot-sync',
1665   'data': 'BlockdevSnapshotSync',
1666   'allow-preconfig': true }
1669 # @blockdev-snapshot:
1671 # Takes a snapshot of a block device.
1673 # Take a snapshot, by installing 'node' as the backing image of
1674 # 'overlay'. Additionally, if 'node' is associated with a block
1675 # device, the block device changes to using 'overlay' as its new
1676 # active image.
1678 # For the arguments, see the documentation of BlockdevSnapshot.
1680 # Features:
1682 # @allow-write-only-overlay: If present, the check whether this
1683 #     operation is safe was relaxed so that it can be used to change
1684 #     backing file of a destination of a blockdev-mirror.  (since 5.0)
1686 # Since: 2.5
1688 # Example:
1690 # -> { "execute": "blockdev-add",
1691 #      "arguments": { "driver": "qcow2",
1692 #                     "node-name": "node1534",
1693 #                     "file": { "driver": "file",
1694 #                               "filename": "hd1.qcow2" },
1695 #                     "backing": null } }
1697 # <- { "return": {} }
1699 # -> { "execute": "blockdev-snapshot",
1700 #      "arguments": { "node": "ide-hd0",
1701 #                     "overlay": "node1534" } }
1702 # <- { "return": {} }
1704 { 'command': 'blockdev-snapshot',
1705   'data': 'BlockdevSnapshot',
1706   'features': [ 'allow-write-only-overlay' ],
1707   'allow-preconfig': true }
1710 # @change-backing-file:
1712 # Change the backing file in the image file metadata.  This does not
1713 # cause QEMU to reopen the image file to reparse the backing filename
1714 # (it may, however, perform a reopen to change permissions from r/o ->
1715 # r/w -> r/o, if needed). The new backing file string is written into
1716 # the image file metadata, and the QEMU internal strings are updated.
1718 # @image-node-name: The name of the block driver state node of the
1719 #     image to modify.  The "device" argument is used to verify
1720 #     "image-node-name" is in the chain described by "device".
1722 # @device: The device name or node-name of the root node that owns
1723 #     image-node-name.
1725 # @backing-file: The string to write as the backing file.  This string
1726 #     is not validated, so care should be taken when specifying the
1727 #     string or the image chain may not be able to be reopened again.
1729 # Returns:
1730 #     - Nothing on success
1731 #     - If "device" does not exist or cannot be determined,
1732 #       DeviceNotFound
1734 # Since: 2.1
1736 { 'command': 'change-backing-file',
1737   'data': { 'device': 'str', 'image-node-name': 'str',
1738             'backing-file': 'str' },
1739   'allow-preconfig': true }
1742 # @block-commit:
1744 # Live commit of data from overlay image nodes into backing nodes -
1745 # i.e., writes data between 'top' and 'base' into 'base'.
1747 # If top == base, that is an error.  If top has no overlays on top of
1748 # it, or if it is in use by a writer, the job will not be completed by
1749 # itself.  The user needs to complete the job with the
1750 # block-job-complete command after getting the ready event.  (Since
1751 # 2.0)
1753 # If the base image is smaller than top, then the base image will be
1754 # resized to be the same size as top.  If top is smaller than the base
1755 # image, the base will not be truncated.  If you want the base image
1756 # size to match the size of the smaller top, you can safely truncate
1757 # it yourself once the commit operation successfully completes.
1759 # @job-id: identifier for the newly-created block job.  If omitted,
1760 #     the device name will be used.  (Since 2.7)
1762 # @device: the device name or node-name of a root node
1764 # @base-node: The node name of the backing image to write data into.
1765 #     If not specified, this is the deepest backing image.
1766 #     (since: 3.1)
1768 # @base: Same as @base-node, except that it is a file name rather than
1769 #     a node name.  This must be the exact filename string that was
1770 #     used to open the node; other strings, even if addressing the
1771 #     same file, are not accepted
1773 # @top-node: The node name of the backing image within the image chain
1774 #     which contains the topmost data to be committed down.  If not
1775 #     specified, this is the active layer.  (since: 3.1)
1777 # @top: Same as @top-node, except that it is a file name rather than a
1778 #     node name.  This must be the exact filename string that was used
1779 #     to open the node; other strings, even if addressing the same
1780 #     file, are not accepted
1782 # @backing-file: The backing file string to write into the overlay
1783 #     image of 'top'.  If 'top' does not have an overlay image, or if
1784 #     'top' is in use by a writer, specifying a backing file string is
1785 #     an error.
1787 #     This filename is not validated.  If a pathname string is such
1788 #     that it cannot be resolved by QEMU, that means that subsequent
1789 #     QMP or HMP commands must use node-names for the image in
1790 #     question, as filename lookup methods will fail.
1792 #     If not specified, QEMU will automatically determine the backing
1793 #     file string to use, or error out if there is no obvious choice.
1794 #     Care should be taken when specifying the string, to specify a
1795 #     valid filename or protocol.  (Since 2.1)
1797 # @speed: the maximum speed, in bytes per second
1799 # @on-error: the action to take on an error.  'ignore' means that the
1800 #     request should be retried.  (default: report; Since: 5.0)
1802 # @filter-node-name: the node name that should be assigned to the
1803 #     filter driver that the commit job inserts into the graph above
1804 #     @top.  If this option is not given, a node name is
1805 #     autogenerated.  (Since: 2.9)
1807 # @auto-finalize: When false, this job will wait in a PENDING state
1808 #     after it has finished its work, waiting for @block-job-finalize
1809 #     before making any block graph changes.  When true, this job will
1810 #     automatically perform its abort or commit actions.  Defaults to
1811 #     true.  (Since 3.1)
1813 # @auto-dismiss: When false, this job will wait in a CONCLUDED state
1814 #     after it has completely ceased all work, and awaits
1815 #     @block-job-dismiss.  When true, this job will automatically
1816 #     disappear from the query list without user intervention.
1817 #     Defaults to true.  (Since 3.1)
1819 # Features:
1821 # @deprecated: Members @base and @top are deprecated.  Use @base-node
1822 #     and @top-node instead.
1824 # Returns:
1825 #     - Nothing on success
1826 #     - If @device does not exist, DeviceNotFound
1827 #     - Any other error returns a GenericError.
1829 # Since: 1.3
1831 # Example:
1833 # -> { "execute": "block-commit",
1834 #      "arguments": { "device": "virtio0",
1835 #                     "top": "/tmp/snap1.qcow2" } }
1836 # <- { "return": {} }
1838 { 'command': 'block-commit',
1839   'data': { '*job-id': 'str', 'device': 'str', '*base-node': 'str',
1840             '*base': { 'type': 'str', 'features': [ 'deprecated' ] },
1841             '*top-node': 'str',
1842             '*top': { 'type': 'str', 'features': [ 'deprecated' ] },
1843             '*backing-file': 'str', '*speed': 'int',
1844             '*on-error': 'BlockdevOnError',
1845             '*filter-node-name': 'str',
1846             '*auto-finalize': 'bool', '*auto-dismiss': 'bool' },
1847   'allow-preconfig': true }
1850 # @drive-backup:
1852 # Start a point-in-time copy of a block device to a new destination.
1853 # The status of ongoing drive-backup operations can be checked with
1854 # query-block-jobs where the BlockJobInfo.type field has the value
1855 # 'backup'. The operation can be stopped before it has completed using
1856 # the block-job-cancel command.
1858 # Features:
1860 # @deprecated: This command is deprecated.  Use @blockdev-backup
1861 #     instead.
1863 # Returns:
1864 #     - nothing on success
1865 #     - If @device is not a valid block device, GenericError
1867 # Since: 1.6
1869 # Example:
1871 # -> { "execute": "drive-backup",
1872 #      "arguments": { "device": "drive0",
1873 #                     "sync": "full",
1874 #                     "target": "backup.img" } }
1875 # <- { "return": {} }
1877 { 'command': 'drive-backup', 'boxed': true,
1878   'data': 'DriveBackup', 'features': ['deprecated'],
1879   'allow-preconfig': true }
1882 # @blockdev-backup:
1884 # Start a point-in-time copy of a block device to a new destination.
1885 # The status of ongoing blockdev-backup operations can be checked with
1886 # query-block-jobs where the BlockJobInfo.type field has the value
1887 # 'backup'. The operation can be stopped before it has completed using
1888 # the block-job-cancel command.
1890 # Returns:
1891 #     - nothing on success
1892 #     - If @device is not a valid block device, DeviceNotFound
1894 # Since: 2.3
1896 # Example:
1898 # -> { "execute": "blockdev-backup",
1899 #      "arguments": { "device": "src-id",
1900 #                     "sync": "full",
1901 #                     "target": "tgt-id" } }
1902 # <- { "return": {} }
1904 { 'command': 'blockdev-backup', 'boxed': true,
1905   'data': 'BlockdevBackup',
1906   'allow-preconfig': true }
1909 # @query-named-block-nodes:
1911 # Get the named block driver list
1913 # @flat: Omit the nested data about backing image ("backing-image"
1914 #     key) if true.  Default is false (Since 5.0)
1916 # Returns: the list of BlockDeviceInfo
1918 # Since: 2.0
1920 # Example:
1922 # -> { "execute": "query-named-block-nodes" }
1923 # <- { "return": [ { "ro":false,
1924 #                    "drv":"qcow2",
1925 #                    "encrypted":false,
1926 #                    "file":"disks/test.qcow2",
1927 #                    "node-name": "my-node",
1928 #                    "backing_file_depth":1,
1929 #                    "detect_zeroes":"off",
1930 #                    "bps":1000000,
1931 #                    "bps_rd":0,
1932 #                    "bps_wr":0,
1933 #                    "iops":1000000,
1934 #                    "iops_rd":0,
1935 #                    "iops_wr":0,
1936 #                    "bps_max": 8000000,
1937 #                    "bps_rd_max": 0,
1938 #                    "bps_wr_max": 0,
1939 #                    "iops_max": 0,
1940 #                    "iops_rd_max": 0,
1941 #                    "iops_wr_max": 0,
1942 #                    "iops_size": 0,
1943 #                    "write_threshold": 0,
1944 #                    "image":{
1945 #                       "filename":"disks/test.qcow2",
1946 #                       "format":"qcow2",
1947 #                       "virtual-size":2048000,
1948 #                       "backing_file":"base.qcow2",
1949 #                       "full-backing-filename":"disks/base.qcow2",
1950 #                       "backing-filename-format":"qcow2",
1951 #                       "snapshots":[
1952 #                          {
1953 #                             "id": "1",
1954 #                             "name": "snapshot1",
1955 #                             "vm-state-size": 0,
1956 #                             "date-sec": 10000200,
1957 #                             "date-nsec": 12,
1958 #                             "vm-clock-sec": 206,
1959 #                             "vm-clock-nsec": 30
1960 #                          }
1961 #                       ],
1962 #                       "backing-image":{
1963 #                           "filename":"disks/base.qcow2",
1964 #                           "format":"qcow2",
1965 #                           "virtual-size":2048000
1966 #                       }
1967 #                    } } ] }
1969 { 'command': 'query-named-block-nodes',
1970   'returns': [ 'BlockDeviceInfo' ],
1971   'data': { '*flat': 'bool' },
1972   'allow-preconfig': true }
1975 # @XDbgBlockGraphNodeType:
1977 # @block-backend: corresponds to BlockBackend
1979 # @block-job: corresponds to BlockJob
1981 # @block-driver: corresponds to BlockDriverState
1983 # Since: 4.0
1985 { 'enum': 'XDbgBlockGraphNodeType',
1986   'data': [ 'block-backend', 'block-job', 'block-driver' ] }
1989 # @XDbgBlockGraphNode:
1991 # @id: Block graph node identifier.  This @id is generated only for
1992 #     x-debug-query-block-graph and does not relate to any other
1993 #     identifiers in Qemu.
1995 # @type: Type of graph node.  Can be one of block-backend, block-job
1996 #     or block-driver-state.
1998 # @name: Human readable name of the node.  Corresponds to node-name
1999 #     for block-driver-state nodes; is not guaranteed to be unique in
2000 #     the whole graph (with block-jobs and block-backends).
2002 # Since: 4.0
2004 { 'struct': 'XDbgBlockGraphNode',
2005   'data': { 'id': 'uint64', 'type': 'XDbgBlockGraphNodeType', 'name': 'str' } }
2008 # @BlockPermission:
2010 # Enum of base block permissions.
2012 # @consistent-read: A user that has the "permission" of consistent
2013 #     reads is guaranteed that their view of the contents of the block
2014 #     device is complete and self-consistent, representing the
2015 #     contents of a disk at a specific point.  For most block devices
2016 #     (including their backing files) this is true, but the property
2017 #     cannot be maintained in a few situations like for intermediate
2018 #     nodes of a commit block job.
2020 # @write: This permission is required to change the visible disk
2021 #     contents.
2023 # @write-unchanged: This permission (which is weaker than
2024 #     BLK_PERM_WRITE) is both enough and required for writes to the
2025 #     block node when the caller promises that the visible disk
2026 #     content doesn't change.  As the BLK_PERM_WRITE permission is
2027 #     strictly stronger, either is sufficient to perform an unchanging
2028 #     write.
2030 # @resize: This permission is required to change the size of a block
2031 #     node.
2033 # Since: 4.0
2035 { 'enum': 'BlockPermission',
2036   'data': [ 'consistent-read', 'write', 'write-unchanged', 'resize' ] }
2039 # @XDbgBlockGraphEdge:
2041 # Block Graph edge description for x-debug-query-block-graph.
2043 # @parent: parent id
2045 # @child: child id
2047 # @name: name of the relation (examples are 'file' and 'backing')
2049 # @perm: granted permissions for the parent operating on the child
2051 # @shared-perm: permissions that can still be granted to other users
2052 #     of the child while it is still attached to this parent
2054 # Since: 4.0
2056 { 'struct': 'XDbgBlockGraphEdge',
2057   'data': { 'parent': 'uint64', 'child': 'uint64',
2058             'name': 'str', 'perm': [ 'BlockPermission' ],
2059             'shared-perm': [ 'BlockPermission' ] } }
2062 # @XDbgBlockGraph:
2064 # Block Graph - list of nodes and list of edges.
2066 # Since: 4.0
2068 { 'struct': 'XDbgBlockGraph',
2069   'data': { 'nodes': ['XDbgBlockGraphNode'], 'edges': ['XDbgBlockGraphEdge'] } }
2072 # @x-debug-query-block-graph:
2074 # Get the block graph.
2076 # Features:
2078 # @unstable: This command is meant for debugging.
2080 # Since: 4.0
2082 { 'command': 'x-debug-query-block-graph', 'returns': 'XDbgBlockGraph',
2083   'features': [ 'unstable' ],
2084   'allow-preconfig': true }
2087 # @drive-mirror:
2089 # Start mirroring a block device's writes to a new destination.
2090 # target specifies the target of the new image.  If the file exists,
2091 # or if it is a device, it will be used as the new destination for
2092 # writes.  If it does not exist, a new file will be created.  format
2093 # specifies the format of the mirror image, default is to probe if
2094 # mode='existing', else the format of the source.
2096 # Returns:
2097 #     - nothing on success
2098 #     - If @device is not a valid block device, GenericError
2100 # Since: 1.3
2102 # Example:
2104 # -> { "execute": "drive-mirror",
2105 #      "arguments": { "device": "ide-hd0",
2106 #                     "target": "/some/place/my-image",
2107 #                     "sync": "full",
2108 #                     "format": "qcow2" } }
2109 # <- { "return": {} }
2111 { 'command': 'drive-mirror', 'boxed': true,
2112   'data': 'DriveMirror',
2113   'allow-preconfig': true }
2116 # @DriveMirror:
2118 # A set of parameters describing drive mirror setup.
2120 # @job-id: identifier for the newly-created block job.  If omitted,
2121 #     the device name will be used.  (Since 2.7)
2123 # @device: the device name or node-name of a root node whose writes
2124 #     should be mirrored.
2126 # @target: the target of the new image.  If the file exists, or if it
2127 #     is a device, the existing file/device will be used as the new
2128 #     destination.  If it does not exist, a new file will be created.
2130 # @format: the format of the new destination, default is to probe if
2131 #     @mode is 'existing', else the format of the source
2133 # @node-name: the new block driver state node name in the graph (Since
2134 #     2.1)
2136 # @replaces: with sync=full graph node name to be replaced by the new
2137 #     image when a whole image copy is done.  This can be used to
2138 #     repair broken Quorum files.  By default, @device is replaced,
2139 #     although implicitly created filters on it are kept.  (Since 2.1)
2141 # @mode: whether and how QEMU should create a new image, default is
2142 #     'absolute-paths'.
2144 # @speed: the maximum speed, in bytes per second
2146 # @sync: what parts of the disk image should be copied to the
2147 #     destination (all the disk, only the sectors allocated in the
2148 #     topmost image, or only new I/O).
2150 # @granularity: granularity of the dirty bitmap, default is 64K if the
2151 #     image format doesn't have clusters, 4K if the clusters are
2152 #     smaller than that, else the cluster size.  Must be a power of 2
2153 #     between 512 and 64M (since 1.4).
2155 # @buf-size: maximum amount of data in flight from source to target
2156 #     (since 1.4).
2158 # @on-source-error: the action to take on an error on the source,
2159 #     default 'report'.  'stop' and 'enospc' can only be used if the
2160 #     block device supports io-status (see BlockInfo).
2162 # @on-target-error: the action to take on an error on the target,
2163 #     default 'report' (no limitations, since this applies to a
2164 #     different block device than @device).
2166 # @unmap: Whether to try to unmap target sectors where source has only
2167 #     zero.  If true, and target unallocated sectors will read as
2168 #     zero, target image sectors will be unmapped; otherwise, zeroes
2169 #     will be written.  Both will result in identical contents.
2170 #     Default is true.  (Since 2.4)
2172 # @copy-mode: when to copy data to the destination; defaults to
2173 #     'background' (Since: 3.0)
2175 # @auto-finalize: When false, this job will wait in a PENDING state
2176 #     after it has finished its work, waiting for @block-job-finalize
2177 #     before making any block graph changes.  When true, this job will
2178 #     automatically perform its abort or commit actions.  Defaults to
2179 #     true.  (Since 3.1)
2181 # @auto-dismiss: When false, this job will wait in a CONCLUDED state
2182 #     after it has completely ceased all work, and awaits
2183 #     @block-job-dismiss.  When true, this job will automatically
2184 #     disappear from the query list without user intervention.
2185 #     Defaults to true.  (Since 3.1)
2187 # Since: 1.3
2189 { 'struct': 'DriveMirror',
2190   'data': { '*job-id': 'str', 'device': 'str', 'target': 'str',
2191             '*format': 'str', '*node-name': 'str', '*replaces': 'str',
2192             'sync': 'MirrorSyncMode', '*mode': 'NewImageMode',
2193             '*speed': 'int', '*granularity': 'uint32',
2194             '*buf-size': 'int', '*on-source-error': 'BlockdevOnError',
2195             '*on-target-error': 'BlockdevOnError',
2196             '*unmap': 'bool', '*copy-mode': 'MirrorCopyMode',
2197             '*auto-finalize': 'bool', '*auto-dismiss': 'bool' } }
2200 # @BlockDirtyBitmap:
2202 # @node: name of device/node which the bitmap is tracking
2204 # @name: name of the dirty bitmap
2206 # Since: 2.4
2208 { 'struct': 'BlockDirtyBitmap',
2209   'data': { 'node': 'str', 'name': 'str' } }
2212 # @BlockDirtyBitmapAdd:
2214 # @node: name of device/node which the bitmap is tracking
2216 # @name: name of the dirty bitmap (must be less than 1024 bytes)
2218 # @granularity: the bitmap granularity, default is 64k for
2219 #     block-dirty-bitmap-add
2221 # @persistent: the bitmap is persistent, i.e. it will be saved to the
2222 #     corresponding block device image file on its close.  For now
2223 #     only Qcow2 disks support persistent bitmaps.  Default is false
2224 #     for block-dirty-bitmap-add.  (Since: 2.10)
2226 # @disabled: the bitmap is created in the disabled state, which means
2227 #     that it will not track drive changes.  The bitmap may be enabled
2228 #     with block-dirty-bitmap-enable.  Default is false.  (Since: 4.0)
2230 # Since: 2.4
2232 { 'struct': 'BlockDirtyBitmapAdd',
2233   'data': { 'node': 'str', 'name': 'str', '*granularity': 'uint32',
2234             '*persistent': 'bool', '*disabled': 'bool' } }
2237 # @BlockDirtyBitmapOrStr:
2239 # @local: name of the bitmap, attached to the same node as target
2240 #     bitmap.
2242 # @external: bitmap with specified node
2244 # Since: 4.1
2246 { 'alternate': 'BlockDirtyBitmapOrStr',
2247   'data': { 'local': 'str',
2248             'external': 'BlockDirtyBitmap' } }
2251 # @BlockDirtyBitmapMerge:
2253 # @node: name of device/node which the @target bitmap is tracking
2255 # @target: name of the destination dirty bitmap
2257 # @bitmaps: name(s) of the source dirty bitmap(s) at @node and/or
2258 #     fully specified BlockDirtyBitmap elements.  The latter are
2259 #     supported since 4.1.
2261 # Since: 4.0
2263 { 'struct': 'BlockDirtyBitmapMerge',
2264   'data': { 'node': 'str', 'target': 'str',
2265             'bitmaps': ['BlockDirtyBitmapOrStr'] } }
2268 # @block-dirty-bitmap-add:
2270 # Create a dirty bitmap with a name on the node, and start tracking
2271 # the writes.
2273 # Returns:
2274 #     - nothing on success
2275 #     - If @node is not a valid block device or node, DeviceNotFound
2276 #     - If @name is already taken, GenericError with an explanation
2278 # Since: 2.4
2280 # Example:
2282 # -> { "execute": "block-dirty-bitmap-add",
2283 #      "arguments": { "node": "drive0", "name": "bitmap0" } }
2284 # <- { "return": {} }
2286 { 'command': 'block-dirty-bitmap-add',
2287   'data': 'BlockDirtyBitmapAdd',
2288   'allow-preconfig': true }
2291 # @block-dirty-bitmap-remove:
2293 # Stop write tracking and remove the dirty bitmap that was created
2294 # with block-dirty-bitmap-add.  If the bitmap is persistent, remove it
2295 # from its storage too.
2297 # Returns:
2298 #     - nothing on success
2299 #     - If @node is not a valid block device or node, DeviceNotFound
2300 #     - If @name is not found, GenericError with an explanation
2301 #     - if @name is frozen by an operation, GenericError
2303 # Since: 2.4
2305 # Example:
2307 # -> { "execute": "block-dirty-bitmap-remove",
2308 #      "arguments": { "node": "drive0", "name": "bitmap0" } }
2309 # <- { "return": {} }
2311 { 'command': 'block-dirty-bitmap-remove',
2312   'data': 'BlockDirtyBitmap',
2313   'allow-preconfig': true }
2316 # @block-dirty-bitmap-clear:
2318 # Clear (reset) a dirty bitmap on the device, so that an incremental
2319 # backup from this point in time forward will only backup clusters
2320 # modified after this clear operation.
2322 # Returns:
2323 #     - nothing on success
2324 #     - If @node is not a valid block device, DeviceNotFound
2325 #     - If @name is not found, GenericError with an explanation
2327 # Since: 2.4
2329 # Example:
2331 # -> { "execute": "block-dirty-bitmap-clear",
2332 #      "arguments": { "node": "drive0", "name": "bitmap0" } }
2333 # <- { "return": {} }
2335 { 'command': 'block-dirty-bitmap-clear',
2336   'data': 'BlockDirtyBitmap',
2337   'allow-preconfig': true }
2340 # @block-dirty-bitmap-enable:
2342 # Enables a dirty bitmap so that it will begin tracking disk changes.
2344 # Returns:
2345 #     - nothing on success
2346 #     - If @node is not a valid block device, DeviceNotFound
2347 #     - If @name is not found, GenericError with an explanation
2349 # Since: 4.0
2351 # Example:
2353 # -> { "execute": "block-dirty-bitmap-enable",
2354 #      "arguments": { "node": "drive0", "name": "bitmap0" } }
2355 # <- { "return": {} }
2357 { 'command': 'block-dirty-bitmap-enable',
2358   'data': 'BlockDirtyBitmap',
2359   'allow-preconfig': true }
2362 # @block-dirty-bitmap-disable:
2364 # Disables a dirty bitmap so that it will stop tracking disk changes.
2366 # Returns:
2367 #     - nothing on success
2368 #     - If @node is not a valid block device, DeviceNotFound
2369 #     - If @name is not found, GenericError with an explanation
2371 # Since: 4.0
2373 # Example:
2375 # -> { "execute": "block-dirty-bitmap-disable",
2376 #      "arguments": { "node": "drive0", "name": "bitmap0" } }
2377 # <- { "return": {} }
2379 { 'command': 'block-dirty-bitmap-disable',
2380   'data': 'BlockDirtyBitmap',
2381   'allow-preconfig': true }
2384 # @block-dirty-bitmap-merge:
2386 # Merge dirty bitmaps listed in @bitmaps to the @target dirty bitmap.
2387 # Dirty bitmaps in @bitmaps will be unchanged, except if it also
2388 # appears as the @target bitmap.  Any bits already set in @target will
2389 # still be set after the merge, i.e., this operation does not clear
2390 # the target.  On error, @target is unchanged.
2392 # The resulting bitmap will count as dirty any clusters that were
2393 # dirty in any of the source bitmaps.  This can be used to achieve
2394 # backup checkpoints, or in simpler usages, to copy bitmaps.
2396 # Returns:
2397 #     - nothing on success
2398 #     - If @node is not a valid block device, DeviceNotFound
2399 #     - If any bitmap in @bitmaps or @target is not found,
2400 #       GenericError
2401 #     - If any of the bitmaps have different sizes or granularities,
2402 #       GenericError
2404 # Since: 4.0
2406 # Example:
2408 # -> { "execute": "block-dirty-bitmap-merge",
2409 #      "arguments": { "node": "drive0", "target": "bitmap0",
2410 #                     "bitmaps": ["bitmap1"] } }
2411 # <- { "return": {} }
2413 { 'command': 'block-dirty-bitmap-merge',
2414   'data': 'BlockDirtyBitmapMerge',
2415   'allow-preconfig': true }
2418 # @BlockDirtyBitmapSha256:
2420 # SHA256 hash of dirty bitmap data
2422 # @sha256: ASCII representation of SHA256 bitmap hash
2424 # Since: 2.10
2426 { 'struct': 'BlockDirtyBitmapSha256',
2427   'data': {'sha256': 'str'} }
2430 # @x-debug-block-dirty-bitmap-sha256:
2432 # Get bitmap SHA256.
2434 # Features:
2436 # @unstable: This command is meant for debugging.
2438 # Returns:
2439 #     - BlockDirtyBitmapSha256 on success
2440 #     - If @node is not a valid block device, DeviceNotFound
2441 #     - If @name is not found or if hashing has failed, GenericError
2442 #       with an explanation
2444 # Since: 2.10
2446 { 'command': 'x-debug-block-dirty-bitmap-sha256',
2447   'data': 'BlockDirtyBitmap', 'returns': 'BlockDirtyBitmapSha256',
2448   'features': [ 'unstable' ],
2449   'allow-preconfig': true }
2452 # @blockdev-mirror:
2454 # Start mirroring a block device's writes to a new destination.
2456 # @job-id: identifier for the newly-created block job.  If omitted,
2457 #     the device name will be used.  (Since 2.7)
2459 # @device: The device name or node-name of a root node whose writes
2460 #     should be mirrored.
2462 # @target: the id or node-name of the block device to mirror to.  This
2463 #     mustn't be attached to guest.
2465 # @replaces: with sync=full graph node name to be replaced by the new
2466 #     image when a whole image copy is done.  This can be used to
2467 #     repair broken Quorum files.  By default, @device is replaced,
2468 #     although implicitly created filters on it are kept.
2470 # @speed: the maximum speed, in bytes per second
2472 # @sync: what parts of the disk image should be copied to the
2473 #     destination (all the disk, only the sectors allocated in the
2474 #     topmost image, or only new I/O).
2476 # @granularity: granularity of the dirty bitmap, default is 64K if the
2477 #     image format doesn't have clusters, 4K if the clusters are
2478 #     smaller than that, else the cluster size.  Must be a power of 2
2479 #     between 512 and 64M
2481 # @buf-size: maximum amount of data in flight from source to target
2483 # @on-source-error: the action to take on an error on the source,
2484 #     default 'report'.  'stop' and 'enospc' can only be used if the
2485 #     block device supports io-status (see BlockInfo).
2487 # @on-target-error: the action to take on an error on the target,
2488 #     default 'report' (no limitations, since this applies to a
2489 #     different block device than @device).
2491 # @filter-node-name: the node name that should be assigned to the
2492 #     filter driver that the mirror job inserts into the graph above
2493 #     @device.  If this option is not given, a node name is
2494 #     autogenerated.  (Since: 2.9)
2496 # @copy-mode: when to copy data to the destination; defaults to
2497 #     'background' (Since: 3.0)
2499 # @auto-finalize: When false, this job will wait in a PENDING state
2500 #     after it has finished its work, waiting for @block-job-finalize
2501 #     before making any block graph changes.  When true, this job will
2502 #     automatically perform its abort or commit actions.  Defaults to
2503 #     true.  (Since 3.1)
2505 # @auto-dismiss: When false, this job will wait in a CONCLUDED state
2506 #     after it has completely ceased all work, and awaits
2507 #     @block-job-dismiss.  When true, this job will automatically
2508 #     disappear from the query list without user intervention.
2509 #     Defaults to true.  (Since 3.1)
2511 # Returns: nothing on success.
2513 # Since: 2.6
2515 # Example:
2517 # -> { "execute": "blockdev-mirror",
2518 #      "arguments": { "device": "ide-hd0",
2519 #                     "target": "target0",
2520 #                     "sync": "full" } }
2521 # <- { "return": {} }
2523 { 'command': 'blockdev-mirror',
2524   'data': { '*job-id': 'str', 'device': 'str', 'target': 'str',
2525             '*replaces': 'str',
2526             'sync': 'MirrorSyncMode',
2527             '*speed': 'int', '*granularity': 'uint32',
2528             '*buf-size': 'int', '*on-source-error': 'BlockdevOnError',
2529             '*on-target-error': 'BlockdevOnError',
2530             '*filter-node-name': 'str',
2531             '*copy-mode': 'MirrorCopyMode',
2532             '*auto-finalize': 'bool', '*auto-dismiss': 'bool' },
2533   'allow-preconfig': true }
2536 # @BlockIOThrottle:
2538 # A set of parameters describing block throttling.
2540 # @device: Block device name
2542 # @id: The name or QOM path of the guest device (since: 2.8)
2544 # @bps: total throughput limit in bytes per second
2546 # @bps_rd: read throughput limit in bytes per second
2548 # @bps_wr: write throughput limit in bytes per second
2550 # @iops: total I/O operations per second
2552 # @iops_rd: read I/O operations per second
2554 # @iops_wr: write I/O operations per second
2556 # @bps_max: total throughput limit during bursts, in bytes (Since 1.7)
2558 # @bps_rd_max: read throughput limit during bursts, in bytes (Since
2559 #     1.7)
2561 # @bps_wr_max: write throughput limit during bursts, in bytes (Since
2562 #     1.7)
2564 # @iops_max: total I/O operations per second during bursts, in bytes
2565 #     (Since 1.7)
2567 # @iops_rd_max: read I/O operations per second during bursts, in bytes
2568 #     (Since 1.7)
2570 # @iops_wr_max: write I/O operations per second during bursts, in
2571 #     bytes (Since 1.7)
2573 # @bps_max_length: maximum length of the @bps_max burst period, in
2574 #     seconds.  It must only be set if @bps_max is set as well.
2575 #     Defaults to 1. (Since 2.6)
2577 # @bps_rd_max_length: maximum length of the @bps_rd_max burst period,
2578 #     in seconds.  It must only be set if @bps_rd_max is set as well.
2579 #     Defaults to 1. (Since 2.6)
2581 # @bps_wr_max_length: maximum length of the @bps_wr_max burst period,
2582 #     in seconds.  It must only be set if @bps_wr_max is set as well.
2583 #     Defaults to 1. (Since 2.6)
2585 # @iops_max_length: maximum length of the @iops burst period, in
2586 #     seconds.  It must only be set if @iops_max is set as well.
2587 #     Defaults to 1. (Since 2.6)
2589 # @iops_rd_max_length: maximum length of the @iops_rd_max burst
2590 #     period, in seconds.  It must only be set if @iops_rd_max is set
2591 #     as well.  Defaults to 1. (Since 2.6)
2593 # @iops_wr_max_length: maximum length of the @iops_wr_max burst
2594 #     period, in seconds.  It must only be set if @iops_wr_max is set
2595 #     as well.  Defaults to 1. (Since 2.6)
2597 # @iops_size: an I/O size in bytes (Since 1.7)
2599 # @group: throttle group name (Since 2.4)
2601 # Features:
2603 # @deprecated: Member @device is deprecated.  Use @id instead.
2605 # Since: 1.1
2607 { 'struct': 'BlockIOThrottle',
2608   'data': { '*device': { 'type': 'str', 'features': [ 'deprecated' ] },
2609             '*id': 'str', 'bps': 'int', 'bps_rd': 'int',
2610             'bps_wr': 'int', 'iops': 'int', 'iops_rd': 'int', 'iops_wr': 'int',
2611             '*bps_max': 'int', '*bps_rd_max': 'int',
2612             '*bps_wr_max': 'int', '*iops_max': 'int',
2613             '*iops_rd_max': 'int', '*iops_wr_max': 'int',
2614             '*bps_max_length': 'int', '*bps_rd_max_length': 'int',
2615             '*bps_wr_max_length': 'int', '*iops_max_length': 'int',
2616             '*iops_rd_max_length': 'int', '*iops_wr_max_length': 'int',
2617             '*iops_size': 'int', '*group': 'str' } }
2620 # @ThrottleLimits:
2622 # Limit parameters for throttling.  Since some limit combinations are
2623 # illegal, limits should always be set in one transaction.  All fields
2624 # are optional.  When setting limits, if a field is missing the
2625 # current value is not changed.
2627 # @iops-total: limit total I/O operations per second
2629 # @iops-total-max: I/O operations burst
2631 # @iops-total-max-length: length of the iops-total-max burst period,
2632 #     in seconds It must only be set if @iops-total-max is set as
2633 #     well.
2635 # @iops-read: limit read operations per second
2637 # @iops-read-max: I/O operations read burst
2639 # @iops-read-max-length: length of the iops-read-max burst period, in
2640 #     seconds It must only be set if @iops-read-max is set as well.
2642 # @iops-write: limit write operations per second
2644 # @iops-write-max: I/O operations write burst
2646 # @iops-write-max-length: length of the iops-write-max burst period,
2647 #     in seconds It must only be set if @iops-write-max is set as
2648 #     well.
2650 # @bps-total: limit total bytes per second
2652 # @bps-total-max: total bytes burst
2654 # @bps-total-max-length: length of the bps-total-max burst period, in
2655 #     seconds.  It must only be set if @bps-total-max is set as well.
2657 # @bps-read: limit read bytes per second
2659 # @bps-read-max: total bytes read burst
2661 # @bps-read-max-length: length of the bps-read-max burst period, in
2662 #     seconds It must only be set if @bps-read-max is set as well.
2664 # @bps-write: limit write bytes per second
2666 # @bps-write-max: total bytes write burst
2668 # @bps-write-max-length: length of the bps-write-max burst period, in
2669 #     seconds It must only be set if @bps-write-max is set as well.
2671 # @iops-size: when limiting by iops max size of an I/O in bytes
2673 # Since: 2.11
2675 { 'struct': 'ThrottleLimits',
2676   'data': { '*iops-total' : 'int', '*iops-total-max' : 'int',
2677             '*iops-total-max-length' : 'int', '*iops-read' : 'int',
2678             '*iops-read-max' : 'int', '*iops-read-max-length' : 'int',
2679             '*iops-write' : 'int', '*iops-write-max' : 'int',
2680             '*iops-write-max-length' : 'int', '*bps-total' : 'int',
2681             '*bps-total-max' : 'int', '*bps-total-max-length' : 'int',
2682             '*bps-read' : 'int', '*bps-read-max' : 'int',
2683             '*bps-read-max-length' : 'int', '*bps-write' : 'int',
2684             '*bps-write-max' : 'int', '*bps-write-max-length' : 'int',
2685             '*iops-size' : 'int' } }
2688 # @ThrottleGroupProperties:
2690 # Properties for throttle-group objects.
2692 # @limits: limits to apply for this throttle group
2694 # Features:
2696 # @unstable: All members starting with x- are aliases for the same key
2697 #     without x- in the @limits object.  This is not a stable
2698 #     interface and may be removed or changed incompatibly in the
2699 #     future.  Use @limits for a supported stable interface.
2701 # Since: 2.11
2703 { 'struct': 'ThrottleGroupProperties',
2704   'data': { '*limits': 'ThrottleLimits',
2705             '*x-iops-total': { 'type': 'int',
2706                                'features': [ 'unstable' ] },
2707             '*x-iops-total-max': { 'type': 'int',
2708                                    'features': [ 'unstable' ] },
2709             '*x-iops-total-max-length': { 'type': 'int',
2710                                           'features': [ 'unstable' ] },
2711             '*x-iops-read': { 'type': 'int',
2712                               'features': [ 'unstable' ] },
2713             '*x-iops-read-max': { 'type': 'int',
2714                                   'features': [ 'unstable' ] },
2715             '*x-iops-read-max-length': { 'type': 'int',
2716                                          'features': [ 'unstable' ] },
2717             '*x-iops-write': { 'type': 'int',
2718                                'features': [ 'unstable' ] },
2719             '*x-iops-write-max': { 'type': 'int',
2720                                    'features': [ 'unstable' ] },
2721             '*x-iops-write-max-length': { 'type': 'int',
2722                                           'features': [ 'unstable' ] },
2723             '*x-bps-total': { 'type': 'int',
2724                               'features': [ 'unstable' ] },
2725             '*x-bps-total-max': { 'type': 'int',
2726                                   'features': [ 'unstable' ] },
2727             '*x-bps-total-max-length': { 'type': 'int',
2728                                          'features': [ 'unstable' ] },
2729             '*x-bps-read': { 'type': 'int',
2730                              'features': [ 'unstable' ] },
2731             '*x-bps-read-max': { 'type': 'int',
2732                                  'features': [ 'unstable' ] },
2733             '*x-bps-read-max-length': { 'type': 'int',
2734                                         'features': [ 'unstable' ] },
2735             '*x-bps-write': { 'type': 'int',
2736                               'features': [ 'unstable' ] },
2737             '*x-bps-write-max': { 'type': 'int',
2738                                   'features': [ 'unstable' ] },
2739             '*x-bps-write-max-length': { 'type': 'int',
2740                                          'features': [ 'unstable' ] },
2741             '*x-iops-size': { 'type': 'int',
2742                               'features': [ 'unstable' ] } } }
2745 # @block-stream:
2747 # Copy data from a backing file into a block device.
2749 # The block streaming operation is performed in the background until
2750 # the entire backing file has been copied.  This command returns
2751 # immediately once streaming has started.  The status of ongoing block
2752 # streaming operations can be checked with query-block-jobs.  The
2753 # operation can be stopped before it has completed using the
2754 # block-job-cancel command.
2756 # The node that receives the data is called the top image, can be
2757 # located in any part of the chain (but always above the base image;
2758 # see below) and can be specified using its device or node name.
2759 # Earlier qemu versions only allowed 'device' to name the top level
2760 # node; presence of the 'base-node' parameter during introspection can
2761 # be used as a witness of the enhanced semantics of 'device'.
2763 # If a base file is specified then sectors are not copied from that
2764 # base file and its backing chain.  This can be used to stream a
2765 # subset of the backing file chain instead of flattening the entire
2766 # image.  When streaming completes the image file will have the base
2767 # file as its backing file, unless that node was changed while the job
2768 # was running.  In that case, base's parent's backing (or filtered,
2769 # whichever exists) child (i.e., base at the beginning of the job)
2770 # will be the new backing file.
2772 # On successful completion the image file is updated to drop the
2773 # backing file and the BLOCK_JOB_COMPLETED event is emitted.
2775 # In case @device is a filter node, block-stream modifies the first
2776 # non-filter overlay node below it to point to the new backing node
2777 # instead of modifying @device itself.
2779 # @job-id: identifier for the newly-created block job.  If omitted,
2780 #     the device name will be used.  (Since 2.7)
2782 # @device: the device or node name of the top image
2784 # @base: the common backing file name.  It cannot be set if @base-node
2785 #     or @bottom is also set.
2787 # @base-node: the node name of the backing file.  It cannot be set if
2788 #     @base or @bottom is also set.  (Since 2.8)
2790 # @bottom: the last node in the chain that should be streamed into
2791 #     top.  It cannot be set if @base or @base-node is also set.  It
2792 #     cannot be filter node.  (Since 6.0)
2794 # @backing-file: The backing file string to write into the top image.
2795 #     This filename is not validated.
2797 #     If a pathname string is such that it cannot be resolved by QEMU,
2798 #     that means that subsequent QMP or HMP commands must use
2799 #     node-names for the image in question, as filename lookup methods
2800 #     will fail.
2802 #     If not specified, QEMU will automatically determine the backing
2803 #     file string to use, or error out if there is no obvious choice.
2804 #     Care should be taken when specifying the string, to specify a
2805 #     valid filename or protocol.  (Since 2.1)
2807 # @speed: the maximum speed, in bytes per second
2809 # @on-error: the action to take on an error (default report). 'stop'
2810 #     and 'enospc' can only be used if the block device supports
2811 #     io-status (see BlockInfo).  (Since 1.3)
2813 # @filter-node-name: the node name that should be assigned to the
2814 #     filter driver that the stream job inserts into the graph above
2815 #     @device.  If this option is not given, a node name is
2816 #     autogenerated.  (Since: 6.0)
2818 # @auto-finalize: When false, this job will wait in a PENDING state
2819 #     after it has finished its work, waiting for @block-job-finalize
2820 #     before making any block graph changes.  When true, this job will
2821 #     automatically perform its abort or commit actions.  Defaults to
2822 #     true.  (Since 3.1)
2824 # @auto-dismiss: When false, this job will wait in a CONCLUDED state
2825 #     after it has completely ceased all work, and awaits
2826 #     @block-job-dismiss.  When true, this job will automatically
2827 #     disappear from the query list without user intervention.
2828 #     Defaults to true.  (Since 3.1)
2830 # Returns:
2831 #     - Nothing on success.
2832 #     - If @device does not exist, DeviceNotFound.
2834 # Since: 1.1
2836 # Example:
2838 # -> { "execute": "block-stream",
2839 #      "arguments": { "device": "virtio0",
2840 #                     "base": "/tmp/master.qcow2" } }
2841 # <- { "return": {} }
2843 { 'command': 'block-stream',
2844   'data': { '*job-id': 'str', 'device': 'str', '*base': 'str',
2845             '*base-node': 'str', '*backing-file': 'str', '*bottom': 'str',
2846             '*speed': 'int', '*on-error': 'BlockdevOnError',
2847             '*filter-node-name': 'str',
2848             '*auto-finalize': 'bool', '*auto-dismiss': 'bool' },
2849   'allow-preconfig': true }
2852 # @block-job-set-speed:
2854 # Set maximum speed for a background block operation.
2856 # This command can only be issued when there is an active block job.
2858 # Throttling can be disabled by setting the speed to 0.
2860 # @device: The job identifier.  This used to be a device name (hence
2861 #     the name of the parameter), but since QEMU 2.7 it can have other
2862 #     values.
2864 # @speed: the maximum speed, in bytes per second, or 0 for unlimited.
2865 #     Defaults to 0.
2867 # Returns:
2868 #     - Nothing on success
2869 #     - If no background operation is active on this device,
2870 #       DeviceNotActive
2872 # Since: 1.1
2874 { 'command': 'block-job-set-speed',
2875   'data': { 'device': 'str', 'speed': 'int' },
2876   'allow-preconfig': true }
2879 # @block-job-cancel:
2881 # Stop an active background block operation.
2883 # This command returns immediately after marking the active background
2884 # block operation for cancellation.  It is an error to call this
2885 # command if no operation is in progress.
2887 # The operation will cancel as soon as possible and then emit the
2888 # BLOCK_JOB_CANCELLED event.  Before that happens the job is still
2889 # visible when enumerated using query-block-jobs.
2891 # Note that if you issue 'block-job-cancel' after 'drive-mirror' has
2892 # indicated (via the event BLOCK_JOB_READY) that the source and
2893 # destination are synchronized, then the event triggered by this
2894 # command changes to BLOCK_JOB_COMPLETED, to indicate that the
2895 # mirroring has ended and the destination now has a point-in-time copy
2896 # tied to the time of the cancellation.
2898 # For streaming, the image file retains its backing file unless the
2899 # streaming operation happens to complete just as it is being
2900 # cancelled.  A new streaming operation can be started at a later time
2901 # to finish copying all data from the backing file.
2903 # @device: The job identifier.  This used to be a device name (hence
2904 #     the name of the parameter), but since QEMU 2.7 it can have other
2905 #     values.
2907 # @force: If true, and the job has already emitted the event
2908 #     BLOCK_JOB_READY, abandon the job immediately (even if it is
2909 #     paused) instead of waiting for the destination to complete its
2910 #     final synchronization (since 1.3)
2912 # Returns:
2913 #     - Nothing on success
2914 #     - If no background operation is active on this device,
2915 #       DeviceNotActive
2917 # Since: 1.1
2919 { 'command': 'block-job-cancel', 'data': { 'device': 'str', '*force': 'bool' },
2920   'allow-preconfig': true }
2923 # @block-job-pause:
2925 # Pause an active background block operation.
2927 # This command returns immediately after marking the active background
2928 # block operation for pausing.  It is an error to call this command if
2929 # no operation is in progress or if the job is already paused.
2931 # The operation will pause as soon as possible.  No event is emitted
2932 # when the operation is actually paused.  Cancelling a paused job
2933 # automatically resumes it.
2935 # @device: The job identifier.  This used to be a device name (hence
2936 #     the name of the parameter), but since QEMU 2.7 it can have other
2937 #     values.
2939 # Returns:
2940 #     - Nothing on success
2941 #     - If no background operation is active on this device,
2942 #       DeviceNotActive
2944 # Since: 1.3
2946 { 'command': 'block-job-pause', 'data': { 'device': 'str' },
2947   'allow-preconfig': true }
2950 # @block-job-resume:
2952 # Resume an active background block operation.
2954 # This command returns immediately after resuming a paused background
2955 # block operation.  It is an error to call this command if no
2956 # operation is in progress or if the job is not paused.
2958 # This command also clears the error status of the job.
2960 # @device: The job identifier.  This used to be a device name (hence
2961 #     the name of the parameter), but since QEMU 2.7 it can have other
2962 #     values.
2964 # Returns:
2965 #     - Nothing on success
2966 #     - If no background operation is active on this device,
2967 #       DeviceNotActive
2969 # Since: 1.3
2971 { 'command': 'block-job-resume', 'data': { 'device': 'str' },
2972   'allow-preconfig': true }
2975 # @block-job-complete:
2977 # Manually trigger completion of an active background block operation.
2978 # This is supported for drive mirroring, where it also switches the
2979 # device to write to the target path only.  The ability to complete is
2980 # signaled with a BLOCK_JOB_READY event.
2982 # This command completes an active background block operation
2983 # synchronously.  The ordering of this command's return with the
2984 # BLOCK_JOB_COMPLETED event is not defined.  Note that if an I/O error
2985 # occurs during the processing of this command: 1) the command itself
2986 # will fail; 2) the error will be processed according to the
2987 # rerror/werror arguments that were specified when starting the
2988 # operation.
2990 # A cancelled or paused job cannot be completed.
2992 # @device: The job identifier.  This used to be a device name (hence
2993 #     the name of the parameter), but since QEMU 2.7 it can have other
2994 #     values.
2996 # Returns:
2997 #     - Nothing on success
2998 #     - If no background operation is active on this device,
2999 #       DeviceNotActive
3001 # Since: 1.3
3003 { 'command': 'block-job-complete', 'data': { 'device': 'str' },
3004   'allow-preconfig': true }
3007 # @block-job-dismiss:
3009 # For jobs that have already concluded, remove them from the
3010 # block-job-query list.  This command only needs to be run for jobs
3011 # which were started with QEMU 2.12+ job lifetime management
3012 # semantics.
3014 # This command will refuse to operate on any job that has not yet
3015 # reached its terminal state, JOB_STATUS_CONCLUDED. For jobs that make
3016 # use of the BLOCK_JOB_READY event, block-job-cancel or
3017 # block-job-complete will still need to be used as appropriate.
3019 # @id: The job identifier.
3021 # Returns: Nothing on success
3023 # Since: 2.12
3025 { 'command': 'block-job-dismiss', 'data': { 'id': 'str' },
3026   'allow-preconfig': true }
3029 # @block-job-finalize:
3031 # Once a job that has manual=true reaches the pending state, it can be
3032 # instructed to finalize any graph changes and do any necessary
3033 # cleanup via this command.  For jobs in a transaction, instructing
3034 # one job to finalize will force ALL jobs in the transaction to
3035 # finalize, so it is only necessary to instruct a single member job to
3036 # finalize.
3038 # @id: The job identifier.
3040 # Returns: Nothing on success
3042 # Since: 2.12
3044 { 'command': 'block-job-finalize', 'data': { 'id': 'str' },
3045   'allow-preconfig': true }
3048 # @BlockJobChangeOptionsMirror:
3050 # @copy-mode: Switch to this copy mode.  Currently, only the switch
3051 #     from 'background' to 'write-blocking' is implemented.
3053 # Since: 8.2
3055 { 'struct': 'BlockJobChangeOptionsMirror',
3056   'data': { 'copy-mode' : 'MirrorCopyMode' } }
3059 # @BlockJobChangeOptions:
3061 # Block job options that can be changed after job creation.
3063 # @id: The job identifier
3065 # @type: The job type
3067 # Since 8.2
3069 { 'union': 'BlockJobChangeOptions',
3070   'base': { 'id': 'str', 'type': 'JobType' },
3071   'discriminator': 'type',
3072   'data': { 'mirror': 'BlockJobChangeOptionsMirror' } }
3075 # @block-job-change:
3077 # Change the block job's options.
3079 # Since: 8.2
3081 { 'command': 'block-job-change',
3082   'data': 'BlockJobChangeOptions', 'boxed': true }
3085 # @BlockdevDiscardOptions:
3087 # Determines how to handle discard requests.
3089 # @ignore: Ignore the request
3091 # @unmap: Forward as an unmap request
3093 # Since: 2.9
3095 { 'enum': 'BlockdevDiscardOptions',
3096   'data': [ 'ignore', 'unmap' ] }
3099 # @BlockdevDetectZeroesOptions:
3101 # Describes the operation mode for the automatic conversion of plain
3102 # zero writes by the OS to driver specific optimized zero write
3103 # commands.
3105 # @off: Disabled (default)
3107 # @on: Enabled
3109 # @unmap: Enabled and even try to unmap blocks if possible.  This
3110 #     requires also that @BlockdevDiscardOptions is set to unmap for
3111 #     this device.
3113 # Since: 2.1
3115 { 'enum': 'BlockdevDetectZeroesOptions',
3116   'data': [ 'off', 'on', 'unmap' ] }
3119 # @BlockdevAioOptions:
3121 # Selects the AIO backend to handle I/O requests
3123 # @threads: Use qemu's thread pool
3125 # @native: Use native AIO backend (only Linux and Windows)
3127 # @io_uring: Use linux io_uring (since 5.0)
3129 # Since: 2.9
3131 { 'enum': 'BlockdevAioOptions',
3132   'data': [ 'threads', 'native',
3133             { 'name': 'io_uring', 'if': 'CONFIG_LINUX_IO_URING' } ] }
3136 # @BlockdevCacheOptions:
3138 # Includes cache-related options for block devices
3140 # @direct: enables use of O_DIRECT (bypass the host page cache;
3141 #     default: false)
3143 # @no-flush: ignore any flush requests for the device (default: false)
3145 # Since: 2.9
3147 { 'struct': 'BlockdevCacheOptions',
3148   'data': { '*direct': 'bool',
3149             '*no-flush': 'bool' } }
3152 # @BlockdevDriver:
3154 # Drivers that are supported in block device operations.
3156 # @throttle: Since 2.11
3158 # @nvme: Since 2.12
3160 # @copy-on-read: Since 3.0
3162 # @blklogwrites: Since 3.0
3164 # @blkreplay: Since 4.2
3166 # @compress: Since 5.0
3168 # @copy-before-write: Since 6.2
3170 # @snapshot-access: Since 7.0
3172 # Since: 2.9
3174 { 'enum': 'BlockdevDriver',
3175   'data': [ 'blkdebug', 'blklogwrites', 'blkreplay', 'blkverify', 'bochs',
3176             'cloop', 'compress', 'copy-before-write', 'copy-on-read', 'dmg',
3177             'file', 'snapshot-access', 'ftp', 'ftps', 'gluster',
3178             {'name': 'host_cdrom', 'if': 'HAVE_HOST_BLOCK_DEVICE' },
3179             {'name': 'host_device', 'if': 'HAVE_HOST_BLOCK_DEVICE' },
3180             'http', 'https',
3181             { 'name': 'io_uring', 'if': 'CONFIG_BLKIO' },
3182             'iscsi',
3183             'luks', 'nbd', 'nfs', 'null-aio', 'null-co', 'nvme',
3184             { 'name': 'nvme-io_uring', 'if': 'CONFIG_BLKIO' },
3185             'parallels', 'preallocate', 'qcow', 'qcow2', 'qed', 'quorum',
3186             'raw', 'rbd',
3187             { 'name': 'replication', 'if': 'CONFIG_REPLICATION' },
3188             'ssh', 'throttle', 'vdi', 'vhdx',
3189             { 'name': 'virtio-blk-vfio-pci', 'if': 'CONFIG_BLKIO' },
3190             { 'name': 'virtio-blk-vhost-user', 'if': 'CONFIG_BLKIO' },
3191             { 'name': 'virtio-blk-vhost-vdpa', 'if': 'CONFIG_BLKIO' },
3192             'vmdk', 'vpc', 'vvfat' ] }
3195 # @BlockdevOptionsFile:
3197 # Driver specific block device options for the file backend.
3199 # @filename: path to the image file
3201 # @pr-manager: the id for the object that will handle persistent
3202 #     reservations for this device (default: none, forward the
3203 #     commands via SG_IO; since 2.11)
3205 # @aio: AIO backend (default: threads) (since: 2.8)
3207 # @aio-max-batch: maximum number of requests to batch together into a
3208 #     single submission in the AIO backend.  The smallest value
3209 #     between this and the aio-max-batch value of the IOThread object
3210 #     is chosen.  0 means that the AIO backend will handle it
3211 #     automatically.  (default: 0, since 6.2)
3213 # @locking: whether to enable file locking.  If set to 'auto', only
3214 #     enable when Open File Descriptor (OFD) locking API is available
3215 #     (default: auto, since 2.10)
3217 # @drop-cache: invalidate page cache during live migration.  This
3218 #     prevents stale data on the migration destination with
3219 #     cache.direct=off.  Currently only supported on Linux hosts.
3220 #     (default: on, since: 4.0)
3222 # @x-check-cache-dropped: whether to check that page cache was dropped
3223 #     on live migration.  May cause noticeable delays if the image
3224 #     file is large, do not use in production.  (default: off)
3225 #     (since: 3.0)
3227 # Features:
3229 # @dynamic-auto-read-only: If present, enabled auto-read-only means
3230 #     that the driver will open the image read-only at first,
3231 #     dynamically reopen the image file read-write when the first
3232 #     writer is attached to the node and reopen read-only when the
3233 #     last writer is detached.  This allows giving QEMU write
3234 #     permissions only on demand when an operation actually needs
3235 #     write access.
3237 # @unstable: Member x-check-cache-dropped is meant for debugging.
3239 # Since: 2.9
3241 { 'struct': 'BlockdevOptionsFile',
3242   'data': { 'filename': 'str',
3243             '*pr-manager': 'str',
3244             '*locking': 'OnOffAuto',
3245             '*aio': 'BlockdevAioOptions',
3246             '*aio-max-batch': 'int',
3247             '*drop-cache': {'type': 'bool',
3248                             'if': 'CONFIG_LINUX'},
3249             '*x-check-cache-dropped': { 'type': 'bool',
3250                                         'features': [ 'unstable' ] } },
3251   'features': [ { 'name': 'dynamic-auto-read-only',
3252                   'if': 'CONFIG_POSIX' } ] }
3255 # @BlockdevOptionsNull:
3257 # Driver specific block device options for the null backend.
3259 # @size: size of the device in bytes.
3261 # @latency-ns: emulated latency (in nanoseconds) in processing
3262 #     requests.  Default to zero which completes requests immediately.
3263 #     (Since 2.4)
3265 # @read-zeroes: if true, reads from the device produce zeroes; if
3266 #     false, the buffer is left unchanged.
3267 #     (default: false; since: 4.1)
3269 # Since: 2.9
3271 { 'struct': 'BlockdevOptionsNull',
3272   'data': { '*size': 'int', '*latency-ns': 'uint64', '*read-zeroes': 'bool' } }
3275 # @BlockdevOptionsNVMe:
3277 # Driver specific block device options for the NVMe backend.
3279 # @device: PCI controller address of the NVMe device in format
3280 #     hhhh:bb:ss.f (host:bus:slot.function)
3282 # @namespace: namespace number of the device, starting from 1.
3284 # Note that the PCI @device must have been unbound from any host
3285 # kernel driver before instructing QEMU to add the blockdev.
3287 # Since: 2.12
3289 { 'struct': 'BlockdevOptionsNVMe',
3290   'data': { 'device': 'str', 'namespace': 'int' } }
3293 # @BlockdevOptionsVVFAT:
3295 # Driver specific block device options for the vvfat protocol.
3297 # @dir: directory to be exported as FAT image
3299 # @fat-type: FAT type: 12, 16 or 32
3301 # @floppy: whether to export a floppy image (true) or partitioned hard
3302 #     disk (false; default)
3304 # @label: set the volume label, limited to 11 bytes.  FAT16 and FAT32
3305 #     traditionally have some restrictions on labels, which are
3306 #     ignored by most operating systems.  Defaults to "QEMU VVFAT".
3307 #     (since 2.4)
3309 # @rw: whether to allow write operations (default: false)
3311 # Since: 2.9
3313 { 'struct': 'BlockdevOptionsVVFAT',
3314   'data': { 'dir': 'str', '*fat-type': 'int', '*floppy': 'bool',
3315             '*label': 'str', '*rw': 'bool' } }
3318 # @BlockdevOptionsGenericFormat:
3320 # Driver specific block device options for image format that have no
3321 # option besides their data source.
3323 # @file: reference to or definition of the data source block device
3325 # Since: 2.9
3327 { 'struct': 'BlockdevOptionsGenericFormat',
3328   'data': { 'file': 'BlockdevRef' } }
3331 # @BlockdevOptionsLUKS:
3333 # Driver specific block device options for LUKS.
3335 # @key-secret: the ID of a QCryptoSecret object providing the
3336 #     decryption key (since 2.6). Mandatory except when doing a
3337 #     metadata-only probe of the image.
3339 # Since: 2.9
3341 { 'struct': 'BlockdevOptionsLUKS',
3342   'base': 'BlockdevOptionsGenericFormat',
3343   'data': { '*key-secret': 'str' } }
3346 # @BlockdevOptionsGenericCOWFormat:
3348 # Driver specific block device options for image format that have no
3349 # option besides their data source and an optional backing file.
3351 # @backing: reference to or definition of the backing file block
3352 #     device, null disables the backing file entirely.  Defaults to
3353 #     the backing file stored the image file.
3355 # Since: 2.9
3357 { 'struct': 'BlockdevOptionsGenericCOWFormat',
3358   'base': 'BlockdevOptionsGenericFormat',
3359   'data': { '*backing': 'BlockdevRefOrNull' } }
3362 # @Qcow2OverlapCheckMode:
3364 # General overlap check modes.
3366 # @none: Do not perform any checks
3368 # @constant: Perform only checks which can be done in constant time
3369 #     and without reading anything from disk
3371 # @cached: Perform only checks which can be done without reading
3372 #     anything from disk
3374 # @all: Perform all available overlap checks
3376 # Since: 2.9
3378 { 'enum': 'Qcow2OverlapCheckMode',
3379   'data': [ 'none', 'constant', 'cached', 'all' ] }
3382 # @Qcow2OverlapCheckFlags:
3384 # Structure of flags for each metadata structure.  Setting a field to
3385 # 'true' makes qemu guard that structure against unintended
3386 # overwriting.  The default value is chosen according to the template
3387 # given.
3389 # @template: Specifies a template mode which can be adjusted using the
3390 #     other flags, defaults to 'cached'
3392 # @bitmap-directory: since 3.0
3394 # Since: 2.9
3396 { 'struct': 'Qcow2OverlapCheckFlags',
3397   'data': { '*template':         'Qcow2OverlapCheckMode',
3398             '*main-header':      'bool',
3399             '*active-l1':        'bool',
3400             '*active-l2':        'bool',
3401             '*refcount-table':   'bool',
3402             '*refcount-block':   'bool',
3403             '*snapshot-table':   'bool',
3404             '*inactive-l1':      'bool',
3405             '*inactive-l2':      'bool',
3406             '*bitmap-directory': 'bool' } }
3409 # @Qcow2OverlapChecks:
3411 # Specifies which metadata structures should be guarded against
3412 # unintended overwriting.
3414 # @flags: set of flags for separate specification of each metadata
3415 #     structure type
3417 # @mode: named mode which chooses a specific set of flags
3419 # Since: 2.9
3421 { 'alternate': 'Qcow2OverlapChecks',
3422   'data': { 'flags': 'Qcow2OverlapCheckFlags',
3423             'mode':  'Qcow2OverlapCheckMode' } }
3426 # @BlockdevQcowEncryptionFormat:
3428 # @aes: AES-CBC with plain64 initialization vectors
3430 # Since: 2.10
3432 { 'enum': 'BlockdevQcowEncryptionFormat',
3433   'data': [ 'aes' ] }
3436 # @BlockdevQcowEncryption:
3438 # Since: 2.10
3440 { 'union': 'BlockdevQcowEncryption',
3441   'base': { 'format': 'BlockdevQcowEncryptionFormat' },
3442   'discriminator': 'format',
3443   'data': { 'aes': 'QCryptoBlockOptionsQCow' } }
3446 # @BlockdevOptionsQcow:
3448 # Driver specific block device options for qcow.
3450 # @encrypt: Image decryption options.  Mandatory for encrypted images,
3451 #     except when doing a metadata-only probe of the image.
3453 # Since: 2.10
3455 { 'struct': 'BlockdevOptionsQcow',
3456   'base': 'BlockdevOptionsGenericCOWFormat',
3457   'data': { '*encrypt': 'BlockdevQcowEncryption' } }
3460 # @BlockdevQcow2EncryptionFormat:
3462 # @aes: AES-CBC with plain64 initialization vectors
3464 # Since: 2.10
3466 { 'enum': 'BlockdevQcow2EncryptionFormat',
3467   'data': [ 'aes', 'luks' ] }
3470 # @BlockdevQcow2Encryption:
3472 # Since: 2.10
3474 { 'union': 'BlockdevQcow2Encryption',
3475   'base': { 'format': 'BlockdevQcow2EncryptionFormat' },
3476   'discriminator': 'format',
3477   'data': { 'aes': 'QCryptoBlockOptionsQCow',
3478             'luks': 'QCryptoBlockOptionsLUKS'} }
3481 # @BlockdevOptionsPreallocate:
3483 # Filter driver intended to be inserted between format and protocol
3484 # node and do preallocation in protocol node on write.
3486 # @prealloc-align: on preallocation, align file length to this number,
3487 #     default 1048576 (1M)
3489 # @prealloc-size: how much to preallocate, default 134217728 (128M)
3491 # Since: 6.0
3493 { 'struct': 'BlockdevOptionsPreallocate',
3494   'base': 'BlockdevOptionsGenericFormat',
3495   'data': { '*prealloc-align': 'int', '*prealloc-size': 'int' } }
3498 # @BlockdevOptionsQcow2:
3500 # Driver specific block device options for qcow2.
3502 # @lazy-refcounts: whether to enable the lazy refcounts feature
3503 #     (default is taken from the image file)
3505 # @pass-discard-request: whether discard requests to the qcow2 device
3506 #     should be forwarded to the data source
3508 # @pass-discard-snapshot: whether discard requests for the data source
3509 #     should be issued when a snapshot operation (e.g. deleting a
3510 #     snapshot) frees clusters in the qcow2 file
3512 # @pass-discard-other: whether discard requests for the data source
3513 #     should be issued on other occasions where a cluster gets freed
3515 # @discard-no-unref: when enabled, discards from the guest will not
3516 #     cause cluster allocations to be relinquished.  This prevents
3517 #     qcow2 fragmentation that would be caused by such discards.
3518 #     Besides potential performance degradation, such fragmentation
3519 #     can lead to increased allocation of clusters past the end of the
3520 #     image file, resulting in image files whose file length can grow
3521 #     much larger than their guest disk size would suggest.  If image
3522 #     file length is of concern (e.g. when storing qcow2 images
3523 #     directly on block devices), you should consider enabling this
3524 #     option.  (since 8.1)
3526 # @overlap-check: which overlap checks to perform for writes to the
3527 #     image, defaults to 'cached' (since 2.2)
3529 # @cache-size: the maximum total size of the L2 table and refcount
3530 #     block caches in bytes (since 2.2)
3532 # @l2-cache-size: the maximum size of the L2 table cache in bytes
3533 #     (since 2.2)
3535 # @l2-cache-entry-size: the size of each entry in the L2 cache in
3536 #     bytes.  It must be a power of two between 512 and the cluster
3537 #     size.  The default value is the cluster size (since 2.12)
3539 # @refcount-cache-size: the maximum size of the refcount block cache
3540 #     in bytes (since 2.2)
3542 # @cache-clean-interval: clean unused entries in the L2 and refcount
3543 #     caches.  The interval is in seconds.  The default value is 600
3544 #     on supporting platforms, and 0 on other platforms.  0 disables
3545 #     this feature.  (since 2.5)
3547 # @encrypt: Image decryption options.  Mandatory for encrypted images,
3548 #     except when doing a metadata-only probe of the image.  (since
3549 #     2.10)
3551 # @data-file: reference to or definition of the external data file.
3552 #     This may only be specified for images that require an external
3553 #     data file.  If it is not specified for such an image, the data
3554 #     file name is loaded from the image file.  (since 4.0)
3556 # Since: 2.9
3558 { 'struct': 'BlockdevOptionsQcow2',
3559   'base': 'BlockdevOptionsGenericCOWFormat',
3560   'data': { '*lazy-refcounts': 'bool',
3561             '*pass-discard-request': 'bool',
3562             '*pass-discard-snapshot': 'bool',
3563             '*pass-discard-other': 'bool',
3564             '*discard-no-unref': 'bool',
3565             '*overlap-check': 'Qcow2OverlapChecks',
3566             '*cache-size': 'int',
3567             '*l2-cache-size': 'int',
3568             '*l2-cache-entry-size': 'int',
3569             '*refcount-cache-size': 'int',
3570             '*cache-clean-interval': 'int',
3571             '*encrypt': 'BlockdevQcow2Encryption',
3572             '*data-file': 'BlockdevRef' } }
3575 # @SshHostKeyCheckMode:
3577 # @none: Don't check the host key at all
3579 # @hash: Compare the host key with a given hash
3581 # @known_hosts: Check the host key against the known_hosts file
3583 # Since: 2.12
3585 { 'enum': 'SshHostKeyCheckMode',
3586   'data': [ 'none', 'hash', 'known_hosts' ] }
3589 # @SshHostKeyCheckHashType:
3591 # @md5: The given hash is an md5 hash
3593 # @sha1: The given hash is an sha1 hash
3595 # @sha256: The given hash is an sha256 hash
3597 # Since: 2.12
3599 { 'enum': 'SshHostKeyCheckHashType',
3600   'data': [ 'md5', 'sha1', 'sha256' ] }
3603 # @SshHostKeyHash:
3605 # @type: The hash algorithm used for the hash
3607 # @hash: The expected hash value
3609 # Since: 2.12
3611 { 'struct': 'SshHostKeyHash',
3612   'data': { 'type': 'SshHostKeyCheckHashType',
3613             'hash': 'str' }}
3616 # @SshHostKeyCheck:
3618 # Since: 2.12
3620 { 'union': 'SshHostKeyCheck',
3621   'base': { 'mode': 'SshHostKeyCheckMode' },
3622   'discriminator': 'mode',
3623   'data': { 'hash': 'SshHostKeyHash' } }
3626 # @BlockdevOptionsSsh:
3628 # @server: host address
3630 # @path: path to the image on the host
3632 # @user: user as which to connect, defaults to current local user name
3634 # @host-key-check: Defines how and what to check the host key against
3635 #     (default: known_hosts)
3637 # Since: 2.9
3639 { 'struct': 'BlockdevOptionsSsh',
3640   'data': { 'server': 'InetSocketAddress',
3641             'path': 'str',
3642             '*user': 'str',
3643             '*host-key-check': 'SshHostKeyCheck' } }
3646 # @BlkdebugEvent:
3648 # Trigger events supported by blkdebug.
3650 # @l1_shrink_write_table: write zeros to the l1 table to shrink image.
3651 #     (since 2.11)
3653 # @l1_shrink_free_l2_clusters: discard the l2 tables.  (since 2.11)
3655 # @cor_write: a write due to copy-on-read (since 2.11)
3657 # @cluster_alloc_space: an allocation of file space for a cluster
3658 #     (since 4.1)
3660 # @none: triggers once at creation of the blkdebug node (since 4.1)
3662 # Since: 2.9
3664 { 'enum': 'BlkdebugEvent', 'prefix': 'BLKDBG',
3665   'data': [ 'l1_update', 'l1_grow_alloc_table', 'l1_grow_write_table',
3666             'l1_grow_activate_table', 'l2_load', 'l2_update',
3667             'l2_update_compressed', 'l2_alloc_cow_read', 'l2_alloc_write',
3668             'read_aio', 'read_backing_aio', 'read_compressed', 'write_aio',
3669             'write_compressed', 'vmstate_load', 'vmstate_save', 'cow_read',
3670             'cow_write', 'reftable_load', 'reftable_grow', 'reftable_update',
3671             'refblock_load', 'refblock_update', 'refblock_update_part',
3672             'refblock_alloc', 'refblock_alloc_hookup', 'refblock_alloc_write',
3673             'refblock_alloc_write_blocks', 'refblock_alloc_write_table',
3674             'refblock_alloc_switch_table', 'cluster_alloc',
3675             'cluster_alloc_bytes', 'cluster_free', 'flush_to_os',
3676             'flush_to_disk', 'pwritev_rmw_head', 'pwritev_rmw_after_head',
3677             'pwritev_rmw_tail', 'pwritev_rmw_after_tail', 'pwritev',
3678             'pwritev_zero', 'pwritev_done', 'empty_image_prepare',
3679             'l1_shrink_write_table', 'l1_shrink_free_l2_clusters',
3680             'cor_write', 'cluster_alloc_space', 'none'] }
3683 # @BlkdebugIOType:
3685 # Kinds of I/O that blkdebug can inject errors in.
3687 # @read: .bdrv_co_preadv()
3689 # @write: .bdrv_co_pwritev()
3691 # @write-zeroes: .bdrv_co_pwrite_zeroes()
3693 # @discard: .bdrv_co_pdiscard()
3695 # @flush: .bdrv_co_flush_to_disk()
3697 # @block-status: .bdrv_co_block_status()
3699 # Since: 4.1
3701 { 'enum': 'BlkdebugIOType', 'prefix': 'BLKDEBUG_IO_TYPE',
3702   'data': [ 'read', 'write', 'write-zeroes', 'discard', 'flush',
3703             'block-status' ] }
3706 # @BlkdebugInjectErrorOptions:
3708 # Describes a single error injection for blkdebug.
3710 # @event: trigger event
3712 # @state: the state identifier blkdebug needs to be in to actually
3713 #     trigger the event; defaults to "any"
3715 # @iotype: the type of I/O operations on which this error should be
3716 #     injected; defaults to "all read, write, write-zeroes, discard,
3717 #     and flush operations" (since: 4.1)
3719 # @errno: error identifier (errno) to be returned; defaults to EIO
3721 # @sector: specifies the sector index which has to be affected in
3722 #     order to actually trigger the event; defaults to "any sector"
3724 # @once: disables further events after this one has been triggered;
3725 #     defaults to false
3727 # @immediately: fail immediately; defaults to false
3729 # Since: 2.9
3731 { 'struct': 'BlkdebugInjectErrorOptions',
3732   'data': { 'event': 'BlkdebugEvent',
3733             '*state': 'int',
3734             '*iotype': 'BlkdebugIOType',
3735             '*errno': 'int',
3736             '*sector': 'int',
3737             '*once': 'bool',
3738             '*immediately': 'bool' } }
3741 # @BlkdebugSetStateOptions:
3743 # Describes a single state-change event for blkdebug.
3745 # @event: trigger event
3747 # @state: the current state identifier blkdebug needs to be in;
3748 #     defaults to "any"
3750 # @new_state: the state identifier blkdebug is supposed to assume if
3751 #     this event is triggered
3753 # Since: 2.9
3755 { 'struct': 'BlkdebugSetStateOptions',
3756   'data': { 'event': 'BlkdebugEvent',
3757             '*state': 'int',
3758             'new_state': 'int' } }
3761 # @BlockdevOptionsBlkdebug:
3763 # Driver specific block device options for blkdebug.
3765 # @image: underlying raw block device (or image file)
3767 # @config: filename of the configuration file
3769 # @align: required alignment for requests in bytes, must be positive
3770 #     power of 2, or 0 for default
3772 # @max-transfer: maximum size for I/O transfers in bytes, must be
3773 #     positive multiple of @align and of the underlying file's request
3774 #     alignment (but need not be a power of 2), or 0 for default
3775 #     (since 2.10)
3777 # @opt-write-zero: preferred alignment for write zero requests in
3778 #     bytes, must be positive multiple of @align and of the underlying
3779 #     file's request alignment (but need not be a power of 2), or 0
3780 #     for default (since 2.10)
3782 # @max-write-zero: maximum size for write zero requests in bytes, must
3783 #     be positive multiple of @align, of @opt-write-zero, and of the
3784 #     underlying file's request alignment (but need not be a power of
3785 #     2), or 0 for default (since 2.10)
3787 # @opt-discard: preferred alignment for discard requests in bytes,
3788 #     must be positive multiple of @align and of the underlying file's
3789 #     request alignment (but need not be a power of 2), or 0 for
3790 #     default (since 2.10)
3792 # @max-discard: maximum size for discard requests in bytes, must be
3793 #     positive multiple of @align, of @opt-discard, and of the
3794 #     underlying file's request alignment (but need not be a power of
3795 #     2), or 0 for default (since 2.10)
3797 # @inject-error: array of error injection descriptions
3799 # @set-state: array of state-change descriptions
3801 # @take-child-perms: Permissions to take on @image in addition to what
3802 #     is necessary anyway (which depends on how the blkdebug node is
3803 #     used).  Defaults to none.  (since 5.0)
3805 # @unshare-child-perms: Permissions not to share on @image in addition
3806 #     to what cannot be shared anyway (which depends on how the
3807 #     blkdebug node is used).  Defaults to none.  (since 5.0)
3809 # Since: 2.9
3811 { 'struct': 'BlockdevOptionsBlkdebug',
3812   'data': { 'image': 'BlockdevRef',
3813             '*config': 'str',
3814             '*align': 'int', '*max-transfer': 'int32',
3815             '*opt-write-zero': 'int32', '*max-write-zero': 'int32',
3816             '*opt-discard': 'int32', '*max-discard': 'int32',
3817             '*inject-error': ['BlkdebugInjectErrorOptions'],
3818             '*set-state': ['BlkdebugSetStateOptions'],
3819             '*take-child-perms': ['BlockPermission'],
3820             '*unshare-child-perms': ['BlockPermission'] } }
3823 # @BlockdevOptionsBlklogwrites:
3825 # Driver specific block device options for blklogwrites.
3827 # @file: block device
3829 # @log: block device used to log writes to @file
3831 # @log-sector-size: sector size used in logging writes to @file,
3832 #     determines granularity of offsets and sizes of writes
3833 #     (default: 512)
3835 # @log-append: append to an existing log (default: false)
3837 # @log-super-update-interval: interval of write requests after which
3838 #     the log super block is updated to disk (default: 4096)
3840 # Since: 3.0
3842 { 'struct': 'BlockdevOptionsBlklogwrites',
3843   'data': { 'file': 'BlockdevRef',
3844             'log': 'BlockdevRef',
3845             '*log-sector-size': 'uint32',
3846             '*log-append': 'bool',
3847             '*log-super-update-interval': 'uint64' } }
3850 # @BlockdevOptionsBlkverify:
3852 # Driver specific block device options for blkverify.
3854 # @test: block device to be tested
3856 # @raw: raw image used for verification
3858 # Since: 2.9
3860 { 'struct': 'BlockdevOptionsBlkverify',
3861   'data': { 'test': 'BlockdevRef',
3862             'raw': 'BlockdevRef' } }
3865 # @BlockdevOptionsBlkreplay:
3867 # Driver specific block device options for blkreplay.
3869 # @image: disk image which should be controlled with blkreplay
3871 # Since: 4.2
3873 { 'struct': 'BlockdevOptionsBlkreplay',
3874   'data': { 'image': 'BlockdevRef' } }
3877 # @QuorumReadPattern:
3879 # An enumeration of quorum read patterns.
3881 # @quorum: read all the children and do a quorum vote on reads
3883 # @fifo: read only from the first child that has not failed
3885 # Since: 2.9
3887 { 'enum': 'QuorumReadPattern', 'data': [ 'quorum', 'fifo' ] }
3890 # @BlockdevOptionsQuorum:
3892 # Driver specific block device options for Quorum
3894 # @blkverify: true if the driver must print content mismatch set to
3895 #     false by default
3897 # @children: the children block devices to use
3899 # @vote-threshold: the vote limit under which a read will fail
3901 # @rewrite-corrupted: rewrite corrupted data when quorum is reached
3902 #     (Since 2.1)
3904 # @read-pattern: choose read pattern and set to quorum by default
3905 #     (Since 2.2)
3907 # Since: 2.9
3909 { 'struct': 'BlockdevOptionsQuorum',
3910   'data': { '*blkverify': 'bool',
3911             'children': [ 'BlockdevRef' ],
3912             'vote-threshold': 'int',
3913             '*rewrite-corrupted': 'bool',
3914             '*read-pattern': 'QuorumReadPattern' } }
3917 # @BlockdevOptionsGluster:
3919 # Driver specific block device options for Gluster
3921 # @volume: name of gluster volume where VM image resides
3923 # @path: absolute path to image file in gluster volume
3925 # @server: gluster servers description
3927 # @debug: libgfapi log level (default '4' which is Error) (Since 2.8)
3929 # @logfile: libgfapi log file (default /dev/stderr) (Since 2.8)
3931 # Since: 2.9
3933 { 'struct': 'BlockdevOptionsGluster',
3934   'data': { 'volume': 'str',
3935             'path': 'str',
3936             'server': ['SocketAddress'],
3937             '*debug': 'int',
3938             '*logfile': 'str' } }
3941 # @BlockdevOptionsIoUring:
3943 # Driver specific block device options for the io_uring backend.
3945 # @filename: path to the image file
3947 # Since: 7.2
3949 { 'struct': 'BlockdevOptionsIoUring',
3950   'data': { 'filename': 'str' },
3951   'if': 'CONFIG_BLKIO' }
3954 # @BlockdevOptionsNvmeIoUring:
3956 # Driver specific block device options for the nvme-io_uring backend.
3958 # @path: path to the NVMe namespace's character device (e.g.
3959 #     /dev/ng0n1).
3961 # Since: 7.2
3963 { 'struct': 'BlockdevOptionsNvmeIoUring',
3964   'data': { 'path': 'str' },
3965   'if': 'CONFIG_BLKIO' }
3968 # @BlockdevOptionsVirtioBlkVfioPci:
3970 # Driver specific block device options for the virtio-blk-vfio-pci
3971 # backend.
3973 # @path: path to the PCI device's sysfs directory (e.g.
3974 #     /sys/bus/pci/devices/0000:00:01.0).
3976 # Since: 7.2
3978 { 'struct': 'BlockdevOptionsVirtioBlkVfioPci',
3979   'data': { 'path': 'str' },
3980   'if': 'CONFIG_BLKIO' }
3983 # @BlockdevOptionsVirtioBlkVhostUser:
3985 # Driver specific block device options for the virtio-blk-vhost-user
3986 # backend.
3988 # @path: path to the vhost-user UNIX domain socket.
3990 # Since: 7.2
3992 { 'struct': 'BlockdevOptionsVirtioBlkVhostUser',
3993   'data': { 'path': 'str' },
3994   'if': 'CONFIG_BLKIO' }
3997 # @BlockdevOptionsVirtioBlkVhostVdpa:
3999 # Driver specific block device options for the virtio-blk-vhost-vdpa
4000 # backend.
4002 # @path: path to the vhost-vdpa character device.
4004 # Features:
4005 # @fdset: Member @path supports the special "/dev/fdset/N" path
4006 #     (since 8.1)
4008 # Since: 7.2
4010 { 'struct': 'BlockdevOptionsVirtioBlkVhostVdpa',
4011   'data': { 'path': 'str' },
4012   'features': [ { 'name' :'fdset',
4013                   'if': 'CONFIG_BLKIO_VHOST_VDPA_FD' } ],
4014   'if': 'CONFIG_BLKIO' }
4017 # @IscsiTransport:
4019 # An enumeration of libiscsi transport types
4021 # Since: 2.9
4023 { 'enum': 'IscsiTransport',
4024   'data': [ 'tcp', 'iser' ] }
4027 # @IscsiHeaderDigest:
4029 # An enumeration of header digests supported by libiscsi
4031 # Since: 2.9
4033 { 'enum': 'IscsiHeaderDigest',
4034   'prefix': 'QAPI_ISCSI_HEADER_DIGEST',
4035   'data': [ 'crc32c', 'none', 'crc32c-none', 'none-crc32c' ] }
4038 # @BlockdevOptionsIscsi:
4040 # @transport: The iscsi transport type
4042 # @portal: The address of the iscsi portal
4044 # @target: The target iqn name
4046 # @lun: LUN to connect to.  Defaults to 0.
4048 # @user: User name to log in with.  If omitted, no CHAP authentication
4049 #     is performed.
4051 # @password-secret: The ID of a QCryptoSecret object providing the
4052 #     password for the login.  This option is required if @user is
4053 #     specified.
4055 # @initiator-name: The iqn name we want to identify to the target as.
4056 #     If this option is not specified, an initiator name is generated
4057 #     automatically.
4059 # @header-digest: The desired header digest.  Defaults to none-crc32c.
4061 # @timeout: Timeout in seconds after which a request will timeout.  0
4062 #     means no timeout and is the default.
4064 # Driver specific block device options for iscsi
4066 # Since: 2.9
4068 { 'struct': 'BlockdevOptionsIscsi',
4069   'data': { 'transport': 'IscsiTransport',
4070             'portal': 'str',
4071             'target': 'str',
4072             '*lun': 'int',
4073             '*user': 'str',
4074             '*password-secret': 'str',
4075             '*initiator-name': 'str',
4076             '*header-digest': 'IscsiHeaderDigest',
4077             '*timeout': 'int' } }
4080 # @RbdAuthMode:
4082 # Since: 3.0
4084 { 'enum': 'RbdAuthMode',
4085   'data': [ 'cephx', 'none' ] }
4088 # @RbdImageEncryptionFormat:
4090 # @luks-any: Used for opening either luks or luks2 (Since 8.0)
4092 # Since: 6.1
4094 { 'enum': 'RbdImageEncryptionFormat',
4095   'data': [ 'luks', 'luks2', 'luks-any' ] }
4098 # @RbdEncryptionOptionsLUKSBase:
4100 # @key-secret: ID of a QCryptoSecret object providing a passphrase for
4101 #     unlocking the encryption
4103 # Since: 6.1
4105 { 'struct': 'RbdEncryptionOptionsLUKSBase',
4106   'data': { 'key-secret': 'str' } }
4109 # @RbdEncryptionCreateOptionsLUKSBase:
4111 # @cipher-alg: The encryption algorithm
4113 # Since: 6.1
4115 { 'struct': 'RbdEncryptionCreateOptionsLUKSBase',
4116   'base': 'RbdEncryptionOptionsLUKSBase',
4117   'data': { '*cipher-alg': 'QCryptoCipherAlgorithm' } }
4120 # @RbdEncryptionOptionsLUKS:
4122 # Since: 6.1
4124 { 'struct': 'RbdEncryptionOptionsLUKS',
4125   'base': 'RbdEncryptionOptionsLUKSBase',
4126   'data': { } }
4129 # @RbdEncryptionOptionsLUKS2:
4131 # Since: 6.1
4133 { 'struct': 'RbdEncryptionOptionsLUKS2',
4134   'base': 'RbdEncryptionOptionsLUKSBase',
4135   'data': { } }
4138 # @RbdEncryptionOptionsLUKSAny:
4140 # Since: 8.0
4142 { 'struct': 'RbdEncryptionOptionsLUKSAny',
4143   'base': 'RbdEncryptionOptionsLUKSBase',
4144   'data': { } }
4147 # @RbdEncryptionCreateOptionsLUKS:
4149 # Since: 6.1
4151 { 'struct': 'RbdEncryptionCreateOptionsLUKS',
4152   'base': 'RbdEncryptionCreateOptionsLUKSBase',
4153   'data': { } }
4156 # @RbdEncryptionCreateOptionsLUKS2:
4158 # Since: 6.1
4160 { 'struct': 'RbdEncryptionCreateOptionsLUKS2',
4161   'base': 'RbdEncryptionCreateOptionsLUKSBase',
4162   'data': { } }
4165 # @RbdEncryptionOptions:
4167 # @format: Encryption format.
4169 # @parent: Parent image encryption options (for cloned images).  Can
4170 #     be left unspecified if this cloned image is encrypted using the
4171 #     same format and secret as its parent image (i.e. not explicitly
4172 #     formatted) or if its parent image is not encrypted.  (Since 8.0)
4174 # Since: 6.1
4176 { 'union': 'RbdEncryptionOptions',
4177   'base': { 'format': 'RbdImageEncryptionFormat',
4178             '*parent': 'RbdEncryptionOptions' },
4179   'discriminator': 'format',
4180   'data': { 'luks': 'RbdEncryptionOptionsLUKS',
4181             'luks2': 'RbdEncryptionOptionsLUKS2',
4182             'luks-any': 'RbdEncryptionOptionsLUKSAny'} }
4185 # @RbdEncryptionCreateOptions:
4187 # Since: 6.1
4189 { 'union': 'RbdEncryptionCreateOptions',
4190   'base': { 'format': 'RbdImageEncryptionFormat' },
4191   'discriminator': 'format',
4192   'data': { 'luks': 'RbdEncryptionCreateOptionsLUKS',
4193             'luks2': 'RbdEncryptionCreateOptionsLUKS2' } }
4196 # @BlockdevOptionsRbd:
4198 # @pool: Ceph pool name.
4200 # @namespace: Rados namespace name in the Ceph pool.  (Since 5.0)
4202 # @image: Image name in the Ceph pool.
4204 # @conf: path to Ceph configuration file.  Values in the configuration
4205 #     file will be overridden by options specified via QAPI.
4207 # @snapshot: Ceph snapshot name.
4209 # @encrypt: Image encryption options.  (Since 6.1)
4211 # @user: Ceph id name.
4213 # @auth-client-required: Acceptable authentication modes.  This maps
4214 #     to Ceph configuration option "auth_client_required".  (Since
4215 #     3.0)
4217 # @key-secret: ID of a QCryptoSecret object providing a key for cephx
4218 #     authentication.  This maps to Ceph configuration option "key".
4219 #     (Since 3.0)
4221 # @server: Monitor host address and port.  This maps to the "mon_host"
4222 #     Ceph option.
4224 # Since: 2.9
4226 { 'struct': 'BlockdevOptionsRbd',
4227   'data': { 'pool': 'str',
4228             '*namespace': 'str',
4229             'image': 'str',
4230             '*conf': 'str',
4231             '*snapshot': 'str',
4232             '*encrypt': 'RbdEncryptionOptions',
4233             '*user': 'str',
4234             '*auth-client-required': ['RbdAuthMode'],
4235             '*key-secret': 'str',
4236             '*server': ['InetSocketAddressBase'] } }
4239 # @ReplicationMode:
4241 # An enumeration of replication modes.
4243 # @primary: Primary mode, the vm's state will be sent to secondary
4244 #     QEMU.
4246 # @secondary: Secondary mode, receive the vm's state from primary
4247 #     QEMU.
4249 # Since: 2.9
4251 { 'enum' : 'ReplicationMode', 'data' : [ 'primary', 'secondary' ],
4252   'if': 'CONFIG_REPLICATION' }
4255 # @BlockdevOptionsReplication:
4257 # Driver specific block device options for replication
4259 # @mode: the replication mode
4261 # @top-id: In secondary mode, node name or device ID of the root node
4262 #     who owns the replication node chain.  Must not be given in
4263 #     primary mode.
4265 # Since: 2.9
4267 { 'struct': 'BlockdevOptionsReplication',
4268   'base': 'BlockdevOptionsGenericFormat',
4269   'data': { 'mode': 'ReplicationMode',
4270             '*top-id': 'str' },
4271   'if': 'CONFIG_REPLICATION' }
4274 # @NFSTransport:
4276 # An enumeration of NFS transport types
4278 # @inet: TCP transport
4280 # Since: 2.9
4282 { 'enum': 'NFSTransport',
4283   'data': [ 'inet' ] }
4286 # @NFSServer:
4288 # Captures the address of the socket
4290 # @type: transport type used for NFS (only TCP supported)
4292 # @host: host address for NFS server
4294 # Since: 2.9
4296 { 'struct': 'NFSServer',
4297   'data': { 'type': 'NFSTransport',
4298             'host': 'str' } }
4301 # @BlockdevOptionsNfs:
4303 # Driver specific block device option for NFS
4305 # @server: host address
4307 # @path: path of the image on the host
4309 # @user: UID value to use when talking to the server (defaults to
4310 #     65534 on Windows and getuid() on unix)
4312 # @group: GID value to use when talking to the server (defaults to
4313 #     65534 on Windows and getgid() in unix)
4315 # @tcp-syn-count: number of SYNs during the session establishment
4316 #     (defaults to libnfs default)
4318 # @readahead-size: set the readahead size in bytes (defaults to libnfs
4319 #     default)
4321 # @page-cache-size: set the pagecache size in bytes (defaults to
4322 #     libnfs default)
4324 # @debug: set the NFS debug level (max 2) (defaults to libnfs default)
4326 # Since: 2.9
4328 { 'struct': 'BlockdevOptionsNfs',
4329   'data': { 'server': 'NFSServer',
4330             'path': 'str',
4331             '*user': 'int',
4332             '*group': 'int',
4333             '*tcp-syn-count': 'int',
4334             '*readahead-size': 'int',
4335             '*page-cache-size': 'int',
4336             '*debug': 'int' } }
4339 # @BlockdevOptionsCurlBase:
4341 # Driver specific block device options shared by all protocols
4342 # supported by the curl backend.
4344 # @url: URL of the image file
4346 # @readahead: Size of the read-ahead cache; must be a multiple of 512
4347 #     (defaults to 256 kB)
4349 # @timeout: Timeout for connections, in seconds (defaults to 5)
4351 # @username: Username for authentication (defaults to none)
4353 # @password-secret: ID of a QCryptoSecret object providing a password
4354 #     for authentication (defaults to no password)
4356 # @proxy-username: Username for proxy authentication (defaults to
4357 #     none)
4359 # @proxy-password-secret: ID of a QCryptoSecret object providing a
4360 #     password for proxy authentication (defaults to no password)
4362 # Since: 2.9
4364 { 'struct': 'BlockdevOptionsCurlBase',
4365   'data': { 'url': 'str',
4366             '*readahead': 'int',
4367             '*timeout': 'int',
4368             '*username': 'str',
4369             '*password-secret': 'str',
4370             '*proxy-username': 'str',
4371             '*proxy-password-secret': 'str' } }
4374 # @BlockdevOptionsCurlHttp:
4376 # Driver specific block device options for HTTP connections over the
4377 # curl backend.  URLs must start with "http://".
4379 # @cookie: List of cookies to set; format is "name1=content1;
4380 #     name2=content2;" as explained by CURLOPT_COOKIE(3). Defaults to
4381 #     no cookies.
4383 # @cookie-secret: ID of a QCryptoSecret object providing the cookie
4384 #     data in a secure way.  See @cookie for the format.  (since 2.10)
4386 # Since: 2.9
4388 { 'struct': 'BlockdevOptionsCurlHttp',
4389   'base': 'BlockdevOptionsCurlBase',
4390   'data': { '*cookie': 'str',
4391             '*cookie-secret': 'str'} }
4394 # @BlockdevOptionsCurlHttps:
4396 # Driver specific block device options for HTTPS connections over the
4397 # curl backend.  URLs must start with "https://".
4399 # @cookie: List of cookies to set; format is "name1=content1;
4400 #     name2=content2;" as explained by CURLOPT_COOKIE(3). Defaults to
4401 #     no cookies.
4403 # @sslverify: Whether to verify the SSL certificate's validity
4404 #     (defaults to true)
4406 # @cookie-secret: ID of a QCryptoSecret object providing the cookie
4407 #     data in a secure way.  See @cookie for the format.  (since 2.10)
4409 # Since: 2.9
4411 { 'struct': 'BlockdevOptionsCurlHttps',
4412   'base': 'BlockdevOptionsCurlBase',
4413   'data': { '*cookie': 'str',
4414             '*sslverify': 'bool',
4415             '*cookie-secret': 'str'} }
4418 # @BlockdevOptionsCurlFtp:
4420 # Driver specific block device options for FTP connections over the
4421 # curl backend.  URLs must start with "ftp://".
4423 # Since: 2.9
4425 { 'struct': 'BlockdevOptionsCurlFtp',
4426   'base': 'BlockdevOptionsCurlBase',
4427   'data': { } }
4430 # @BlockdevOptionsCurlFtps:
4432 # Driver specific block device options for FTPS connections over the
4433 # curl backend.  URLs must start with "ftps://".
4435 # @sslverify: Whether to verify the SSL certificate's validity
4436 #     (defaults to true)
4438 # Since: 2.9
4440 { 'struct': 'BlockdevOptionsCurlFtps',
4441   'base': 'BlockdevOptionsCurlBase',
4442   'data': { '*sslverify': 'bool' } }
4445 # @BlockdevOptionsNbd:
4447 # Driver specific block device options for NBD.
4449 # @server: NBD server address
4451 # @export: export name
4453 # @tls-creds: TLS credentials ID
4455 # @tls-hostname: TLS hostname override for certificate validation
4456 #     (Since 7.0)
4458 # @x-dirty-bitmap: A metadata context name such as
4459 #     "qemu:dirty-bitmap:NAME" or "qemu:allocation-depth" to query in
4460 #     place of the traditional "base:allocation" block status (see
4461 #     NBD_OPT_LIST_META_CONTEXT in the NBD protocol; and yes, naming
4462 #     this option x-context would have made more sense) (since 3.0)
4464 # @reconnect-delay: On an unexpected disconnect, the nbd client tries
4465 #     to connect again until succeeding or encountering a serious
4466 #     error.  During the first @reconnect-delay seconds, all requests
4467 #     are paused and will be rerun on a successful reconnect.  After
4468 #     that time, any delayed requests and all future requests before a
4469 #     successful reconnect will immediately fail.  Default 0 (Since
4470 #     4.2)
4472 # @open-timeout: In seconds.  If zero, the nbd driver tries the
4473 #     connection only once, and fails to open if the connection fails.
4474 #     If non-zero, the nbd driver will repeat connection attempts
4475 #     until successful or until @open-timeout seconds have elapsed.
4476 #     Default 0 (Since 7.0)
4478 # Features:
4480 # @unstable: Member @x-dirty-bitmap is experimental.
4482 # Since: 2.9
4484 { 'struct': 'BlockdevOptionsNbd',
4485   'data': { 'server': 'SocketAddress',
4486             '*export': 'str',
4487             '*tls-creds': 'str',
4488             '*tls-hostname': 'str',
4489             '*x-dirty-bitmap': { 'type': 'str', 'features': [ 'unstable' ] },
4490             '*reconnect-delay': 'uint32',
4491             '*open-timeout': 'uint32' } }
4494 # @BlockdevOptionsRaw:
4496 # Driver specific block device options for the raw driver.
4498 # @offset: position where the block device starts
4500 # @size: the assumed size of the device
4502 # Since: 2.9
4504 { 'struct': 'BlockdevOptionsRaw',
4505   'base': 'BlockdevOptionsGenericFormat',
4506   'data': { '*offset': 'int', '*size': 'int' } }
4509 # @BlockdevOptionsThrottle:
4511 # Driver specific block device options for the throttle driver
4513 # @throttle-group: the name of the throttle-group object to use.  It
4514 #     must already exist.
4516 # @file: reference to or definition of the data source block device
4518 # Since: 2.11
4520 { 'struct': 'BlockdevOptionsThrottle',
4521   'data': { 'throttle-group': 'str',
4522             'file' : 'BlockdevRef'
4523              } }
4526 # @BlockdevOptionsCor:
4528 # Driver specific block device options for the copy-on-read driver.
4530 # @bottom: The name of a non-filter node (allocation-bearing layer)
4531 #     that limits the COR operations in the backing chain (inclusive),
4532 #     so that no data below this node will be copied by this filter.
4533 #     If option is absent, the limit is not applied, so that data from
4534 #     all backing layers may be copied.
4536 # Since: 6.0
4538 { 'struct': 'BlockdevOptionsCor',
4539   'base': 'BlockdevOptionsGenericFormat',
4540   'data': { '*bottom': 'str' } }
4543 # @OnCbwError:
4545 # An enumeration of possible behaviors for copy-before-write operation
4546 # failures.
4548 # @break-guest-write: report the error to the guest.  This way, the
4549 #     guest will not be able to overwrite areas that cannot be backed
4550 #     up, so the backup process remains valid.
4552 # @break-snapshot: continue guest write.  Doing so will make the
4553 #     provided snapshot state invalid and any backup or export process
4554 #     based on it will finally fail.
4556 # Since: 7.1
4558 { 'enum': 'OnCbwError',
4559   'data': [ 'break-guest-write', 'break-snapshot' ] }
4562 # @BlockdevOptionsCbw:
4564 # Driver specific block device options for the copy-before-write
4565 # driver, which does so called copy-before-write operations: when data
4566 # is written to the filter, the filter first reads corresponding
4567 # blocks from its file child and copies them to @target child.  After
4568 # successfully copying, the write request is propagated to file child.
4569 # If copying fails, the original write request is failed too and no
4570 # data is written to file child.
4572 # @target: The target for copy-before-write operations.
4574 # @bitmap: If specified, copy-before-write filter will do
4575 #     copy-before-write operations only for dirty regions of the
4576 #     bitmap.  Bitmap size must be equal to length of file and target
4577 #     child of the filter.  Note also, that bitmap is used only to
4578 #     initialize internal bitmap of the process, so further
4579 #     modifications (or removing) of specified bitmap doesn't
4580 #     influence the filter.  (Since 7.0)
4582 # @on-cbw-error: Behavior on failure of copy-before-write operation.
4583 #     Default is @break-guest-write.  (Since 7.1)
4585 # @cbw-timeout: Zero means no limit.  Non-zero sets the timeout in
4586 #     seconds for copy-before-write operation.  When a timeout occurs,
4587 #     the respective copy-before-write operation will fail, and the
4588 #     @on-cbw-error parameter will decide how this failure is handled.
4589 #     Default 0. (Since 7.1)
4591 # Since: 6.2
4593 { 'struct': 'BlockdevOptionsCbw',
4594   'base': 'BlockdevOptionsGenericFormat',
4595   'data': { 'target': 'BlockdevRef', '*bitmap': 'BlockDirtyBitmap',
4596             '*on-cbw-error': 'OnCbwError', '*cbw-timeout': 'uint32' } }
4599 # @BlockdevOptions:
4601 # Options for creating a block device.  Many options are available for
4602 # all block devices, independent of the block driver:
4604 # @driver: block driver name
4606 # @node-name: the node name of the new node (Since 2.0). This option
4607 #     is required on the top level of blockdev-add.  Valid node names
4608 #     start with an alphabetic character and may contain only
4609 #     alphanumeric characters, '-', '.' and '_'. Their maximum length
4610 #     is 31 characters.
4612 # @discard: discard-related options (default: ignore)
4614 # @cache: cache-related options
4616 # @read-only: whether the block device should be read-only (default:
4617 #     false). Note that some block drivers support only read-only
4618 #     access, either generally or in certain configurations.  In this
4619 #     case, the default value does not work and the option must be
4620 #     specified explicitly.
4622 # @auto-read-only: if true and @read-only is false, QEMU may
4623 #     automatically decide not to open the image read-write as
4624 #     requested, but fall back to read-only instead (and switch
4625 #     between the modes later), e.g. depending on whether the image
4626 #     file is writable or whether a writing user is attached to the
4627 #     node (default: false, since 3.1)
4629 # @detect-zeroes: detect and optimize zero writes (Since 2.1)
4630 #     (default: off)
4632 # @force-share: force share all permission on added nodes.  Requires
4633 #     read-only=true.  (Since 2.10)
4635 # Remaining options are determined by the block driver.
4637 # Since: 2.9
4639 { 'union': 'BlockdevOptions',
4640   'base': { 'driver': 'BlockdevDriver',
4641             '*node-name': 'str',
4642             '*discard': 'BlockdevDiscardOptions',
4643             '*cache': 'BlockdevCacheOptions',
4644             '*read-only': 'bool',
4645             '*auto-read-only': 'bool',
4646             '*force-share': 'bool',
4647             '*detect-zeroes': 'BlockdevDetectZeroesOptions' },
4648   'discriminator': 'driver',
4649   'data': {
4650       'blkdebug':   'BlockdevOptionsBlkdebug',
4651       'blklogwrites':'BlockdevOptionsBlklogwrites',
4652       'blkverify':  'BlockdevOptionsBlkverify',
4653       'blkreplay':  'BlockdevOptionsBlkreplay',
4654       'bochs':      'BlockdevOptionsGenericFormat',
4655       'cloop':      'BlockdevOptionsGenericFormat',
4656       'compress':   'BlockdevOptionsGenericFormat',
4657       'copy-before-write':'BlockdevOptionsCbw',
4658       'copy-on-read':'BlockdevOptionsCor',
4659       'dmg':        'BlockdevOptionsGenericFormat',
4660       'file':       'BlockdevOptionsFile',
4661       'ftp':        'BlockdevOptionsCurlFtp',
4662       'ftps':       'BlockdevOptionsCurlFtps',
4663       'gluster':    'BlockdevOptionsGluster',
4664       'host_cdrom':  { 'type': 'BlockdevOptionsFile',
4665                        'if': 'HAVE_HOST_BLOCK_DEVICE' },
4666       'host_device': { 'type': 'BlockdevOptionsFile',
4667                        'if': 'HAVE_HOST_BLOCK_DEVICE' },
4668       'http':       'BlockdevOptionsCurlHttp',
4669       'https':      'BlockdevOptionsCurlHttps',
4670       'io_uring':   { 'type': 'BlockdevOptionsIoUring',
4671                       'if': 'CONFIG_BLKIO' },
4672       'iscsi':      'BlockdevOptionsIscsi',
4673       'luks':       'BlockdevOptionsLUKS',
4674       'nbd':        'BlockdevOptionsNbd',
4675       'nfs':        'BlockdevOptionsNfs',
4676       'null-aio':   'BlockdevOptionsNull',
4677       'null-co':    'BlockdevOptionsNull',
4678       'nvme':       'BlockdevOptionsNVMe',
4679       'nvme-io_uring': { 'type': 'BlockdevOptionsNvmeIoUring',
4680                          'if': 'CONFIG_BLKIO' },
4681       'parallels':  'BlockdevOptionsGenericFormat',
4682       'preallocate':'BlockdevOptionsPreallocate',
4683       'qcow2':      'BlockdevOptionsQcow2',
4684       'qcow':       'BlockdevOptionsQcow',
4685       'qed':        'BlockdevOptionsGenericCOWFormat',
4686       'quorum':     'BlockdevOptionsQuorum',
4687       'raw':        'BlockdevOptionsRaw',
4688       'rbd':        'BlockdevOptionsRbd',
4689       'replication': { 'type': 'BlockdevOptionsReplication',
4690                        'if': 'CONFIG_REPLICATION' },
4691       'snapshot-access': 'BlockdevOptionsGenericFormat',
4692       'ssh':        'BlockdevOptionsSsh',
4693       'throttle':   'BlockdevOptionsThrottle',
4694       'vdi':        'BlockdevOptionsGenericFormat',
4695       'vhdx':       'BlockdevOptionsGenericFormat',
4696       'virtio-blk-vfio-pci':
4697                     { 'type': 'BlockdevOptionsVirtioBlkVfioPci',
4698                       'if': 'CONFIG_BLKIO' },
4699       'virtio-blk-vhost-user':
4700                     { 'type': 'BlockdevOptionsVirtioBlkVhostUser',
4701                       'if': 'CONFIG_BLKIO' },
4702       'virtio-blk-vhost-vdpa':
4703                     { 'type': 'BlockdevOptionsVirtioBlkVhostVdpa',
4704                       'if': 'CONFIG_BLKIO' },
4705       'vmdk':       'BlockdevOptionsGenericCOWFormat',
4706       'vpc':        'BlockdevOptionsGenericFormat',
4707       'vvfat':      'BlockdevOptionsVVFAT'
4708   } }
4711 # @BlockdevRef:
4713 # Reference to a block device.
4715 # @definition: defines a new block device inline
4717 # @reference: references the ID of an existing block device
4719 # Since: 2.9
4721 { 'alternate': 'BlockdevRef',
4722   'data': { 'definition': 'BlockdevOptions',
4723             'reference': 'str' } }
4726 # @BlockdevRefOrNull:
4728 # Reference to a block device.
4730 # @definition: defines a new block device inline
4732 # @reference: references the ID of an existing block device.  An empty
4733 #     string means that no block device should be referenced.
4734 #     Deprecated; use null instead.
4736 # @null: No block device should be referenced (since 2.10)
4738 # Since: 2.9
4740 { 'alternate': 'BlockdevRefOrNull',
4741   'data': { 'definition': 'BlockdevOptions',
4742             'reference': 'str',
4743             'null': 'null' } }
4746 # @blockdev-add:
4748 # Creates a new block device.
4750 # Since: 2.9
4752 # Examples:
4754 # -> { "execute": "blockdev-add",
4755 #      "arguments": {
4756 #           "driver": "qcow2",
4757 #           "node-name": "test1",
4758 #           "file": {
4759 #               "driver": "file",
4760 #               "filename": "test.qcow2"
4761 #            }
4762 #       }
4763 #     }
4764 # <- { "return": {} }
4766 # -> { "execute": "blockdev-add",
4767 #      "arguments": {
4768 #           "driver": "qcow2",
4769 #           "node-name": "node0",
4770 #           "discard": "unmap",
4771 #           "cache": {
4772 #              "direct": true
4773 #            },
4774 #            "file": {
4775 #              "driver": "file",
4776 #              "filename": "/tmp/test.qcow2"
4777 #            },
4778 #            "backing": {
4779 #               "driver": "raw",
4780 #               "file": {
4781 #                  "driver": "file",
4782 #                  "filename": "/dev/fdset/4"
4783 #                }
4784 #            }
4785 #        }
4786 #      }
4788 # <- { "return": {} }
4790 { 'command': 'blockdev-add', 'data': 'BlockdevOptions', 'boxed': true,
4791   'allow-preconfig': true }
4794 # @blockdev-reopen:
4796 # Reopens one or more block devices using the given set of options.
4797 # Any option not specified will be reset to its default value
4798 # regardless of its previous status.  If an option cannot be changed
4799 # or a particular driver does not support reopening then the command
4800 # will return an error.  All devices in the list are reopened in one
4801 # transaction, so if one of them fails then the whole transaction is
4802 # cancelled.
4804 # The command receives a list of block devices to reopen.  For each
4805 # one of them, the top-level @node-name option (from BlockdevOptions)
4806 # must be specified and is used to select the block device to be
4807 # reopened.  Other @node-name options must be either omitted or set to
4808 # the current name of the appropriate node.  This command won't change
4809 # any node name and any attempt to do it will result in an error.
4811 # In the case of options that refer to child nodes, the behavior of
4812 # this command depends on the value:
4814 #  1) A set of options (BlockdevOptions): the child is reopened with
4815 #     the specified set of options.
4817 #  2) A reference to the current child: the child is reopened using
4818 #     its existing set of options.
4820 #  3) A reference to a different node: the current child is replaced
4821 #     with the specified one.
4823 #  4) NULL: the current child (if any) is detached.
4825 # Options (1) and (2) are supported in all cases.  Option (3) is
4826 # supported for @file and @backing, and option (4) for @backing only.
4828 # Unlike with blockdev-add, the @backing option must always be present
4829 # unless the node being reopened does not have a backing file and its
4830 # image does not have a default backing file name as part of its
4831 # metadata.
4833 # Since: 6.1
4835 { 'command': 'blockdev-reopen',
4836   'data': { 'options': ['BlockdevOptions'] },
4837   'allow-preconfig': true }
4840 # @blockdev-del:
4842 # Deletes a block device that has been added using blockdev-add.  The
4843 # command will fail if the node is attached to a device or is
4844 # otherwise being used.
4846 # @node-name: Name of the graph node to delete.
4848 # Since: 2.9
4850 # Example:
4852 # -> { "execute": "blockdev-add",
4853 #      "arguments": {
4854 #           "driver": "qcow2",
4855 #           "node-name": "node0",
4856 #           "file": {
4857 #               "driver": "file",
4858 #               "filename": "test.qcow2"
4859 #           }
4860 #      }
4861 #    }
4862 # <- { "return": {} }
4864 # -> { "execute": "blockdev-del",
4865 #      "arguments": { "node-name": "node0" }
4866 #    }
4867 # <- { "return": {} }
4869 { 'command': 'blockdev-del', 'data': { 'node-name': 'str' },
4870   'allow-preconfig': true }
4873 # @BlockdevCreateOptionsFile:
4875 # Driver specific image creation options for file.
4877 # @filename: Filename for the new image file
4879 # @size: Size of the virtual disk in bytes
4881 # @preallocation: Preallocation mode for the new image (default: off;
4882 #     allowed values: off, falloc (if CONFIG_POSIX_FALLOCATE), full
4883 #     (if CONFIG_POSIX))
4885 # @nocow: Turn off copy-on-write (valid only on btrfs; default: off)
4887 # @extent-size-hint: Extent size hint to add to the image file; 0 for
4888 #     not adding an extent size hint (default: 1 MB, since 5.1)
4890 # Since: 2.12
4892 { 'struct': 'BlockdevCreateOptionsFile',
4893   'data': { 'filename':             'str',
4894             'size':                 'size',
4895             '*preallocation':       'PreallocMode',
4896             '*nocow':               'bool',
4897             '*extent-size-hint':    'size'} }
4900 # @BlockdevCreateOptionsGluster:
4902 # Driver specific image creation options for gluster.
4904 # @location: Where to store the new image file
4906 # @size: Size of the virtual disk in bytes
4908 # @preallocation: Preallocation mode for the new image (default: off;
4909 #     allowed values: off, falloc (if CONFIG_GLUSTERFS_FALLOCATE),
4910 #     full (if CONFIG_GLUSTERFS_ZEROFILL))
4912 # Since: 2.12
4914 { 'struct': 'BlockdevCreateOptionsGluster',
4915   'data': { 'location':         'BlockdevOptionsGluster',
4916             'size':             'size',
4917             '*preallocation':   'PreallocMode' } }
4920 # @BlockdevCreateOptionsLUKS:
4922 # Driver specific image creation options for LUKS.
4924 # @file: Node to create the image format on
4926 # @size: Size of the virtual disk in bytes
4928 # @preallocation: Preallocation mode for the new image (since: 4.2)
4929 #     (default: off; allowed values: off, metadata, falloc, full)
4931 # Since: 2.12
4933 { 'struct': 'BlockdevCreateOptionsLUKS',
4934   'base': 'QCryptoBlockCreateOptionsLUKS',
4935   'data': { 'file':             'BlockdevRef',
4936             'size':             'size',
4937             '*preallocation':   'PreallocMode' } }
4940 # @BlockdevCreateOptionsNfs:
4942 # Driver specific image creation options for NFS.
4944 # @location: Where to store the new image file
4946 # @size: Size of the virtual disk in bytes
4948 # Since: 2.12
4950 { 'struct': 'BlockdevCreateOptionsNfs',
4951   'data': { 'location':         'BlockdevOptionsNfs',
4952             'size':             'size' } }
4955 # @BlockdevCreateOptionsParallels:
4957 # Driver specific image creation options for parallels.
4959 # @file: Node to create the image format on
4961 # @size: Size of the virtual disk in bytes
4963 # @cluster-size: Cluster size in bytes (default: 1 MB)
4965 # Since: 2.12
4967 { 'struct': 'BlockdevCreateOptionsParallels',
4968   'data': { 'file':             'BlockdevRef',
4969             'size':             'size',
4970             '*cluster-size':    'size' } }
4973 # @BlockdevCreateOptionsQcow:
4975 # Driver specific image creation options for qcow.
4977 # @file: Node to create the image format on
4979 # @size: Size of the virtual disk in bytes
4981 # @backing-file: File name of the backing file if a backing file
4982 #     should be used
4984 # @encrypt: Encryption options if the image should be encrypted
4986 # Since: 2.12
4988 { 'struct': 'BlockdevCreateOptionsQcow',
4989   'data': { 'file':             'BlockdevRef',
4990             'size':             'size',
4991             '*backing-file':    'str',
4992             '*encrypt':         'QCryptoBlockCreateOptions' } }
4995 # @BlockdevQcow2Version:
4997 # @v2: The original QCOW2 format as introduced in qemu 0.10 (version
4998 #     2)
5000 # @v3: The extended QCOW2 format as introduced in qemu 1.1 (version 3)
5002 # Since: 2.12
5004 { 'enum': 'BlockdevQcow2Version',
5005   'data': [ 'v2', 'v3' ] }
5008 # @Qcow2CompressionType:
5010 # Compression type used in qcow2 image file
5012 # @zlib: zlib compression, see <http://zlib.net/>
5014 # @zstd: zstd compression, see <http://github.com/facebook/zstd>
5016 # Since: 5.1
5018 { 'enum': 'Qcow2CompressionType',
5019   'data': [ 'zlib', { 'name': 'zstd', 'if': 'CONFIG_ZSTD' } ] }
5022 # @BlockdevCreateOptionsQcow2:
5024 # Driver specific image creation options for qcow2.
5026 # @file: Node to create the image format on
5028 # @data-file: Node to use as an external data file in which all guest
5029 #     data is stored so that only metadata remains in the qcow2 file
5030 #     (since: 4.0)
5032 # @data-file-raw: True if the external data file must stay valid as a
5033 #     standalone (read-only) raw image without looking at qcow2
5034 #     metadata (default: false; since: 4.0)
5036 # @extended-l2: True to make the image have extended L2 entries
5037 #     (default: false; since 5.2)
5039 # @size: Size of the virtual disk in bytes
5041 # @version: Compatibility level (default: v3)
5043 # @backing-file: File name of the backing file if a backing file
5044 #     should be used
5046 # @backing-fmt: Name of the block driver to use for the backing file
5048 # @encrypt: Encryption options if the image should be encrypted
5050 # @cluster-size: qcow2 cluster size in bytes (default: 65536)
5052 # @preallocation: Preallocation mode for the new image (default: off;
5053 #     allowed values: off, falloc, full, metadata)
5055 # @lazy-refcounts: True if refcounts may be updated lazily
5056 #     (default: off)
5058 # @refcount-bits: Width of reference counts in bits (default: 16)
5060 # @compression-type: The image cluster compression method
5061 #     (default: zlib, since 5.1)
5063 # Since: 2.12
5065 { 'struct': 'BlockdevCreateOptionsQcow2',
5066   'data': { 'file':             'BlockdevRef',
5067             '*data-file':       'BlockdevRef',
5068             '*data-file-raw':   'bool',
5069             '*extended-l2':     'bool',
5070             'size':             'size',
5071             '*version':         'BlockdevQcow2Version',
5072             '*backing-file':    'str',
5073             '*backing-fmt':     'BlockdevDriver',
5074             '*encrypt':         'QCryptoBlockCreateOptions',
5075             '*cluster-size':    'size',
5076             '*preallocation':   'PreallocMode',
5077             '*lazy-refcounts':  'bool',
5078             '*refcount-bits':   'int',
5079             '*compression-type':'Qcow2CompressionType' } }
5082 # @BlockdevCreateOptionsQed:
5084 # Driver specific image creation options for qed.
5086 # @file: Node to create the image format on
5088 # @size: Size of the virtual disk in bytes
5090 # @backing-file: File name of the backing file if a backing file
5091 #     should be used
5093 # @backing-fmt: Name of the block driver to use for the backing file
5095 # @cluster-size: Cluster size in bytes (default: 65536)
5097 # @table-size: L1/L2 table size (in clusters)
5099 # Since: 2.12
5101 { 'struct': 'BlockdevCreateOptionsQed',
5102   'data': { 'file':             'BlockdevRef',
5103             'size':             'size',
5104             '*backing-file':    'str',
5105             '*backing-fmt':     'BlockdevDriver',
5106             '*cluster-size':    'size',
5107             '*table-size':      'int' } }
5110 # @BlockdevCreateOptionsRbd:
5112 # Driver specific image creation options for rbd/Ceph.
5114 # @location: Where to store the new image file.  This location cannot
5115 #     point to a snapshot.
5117 # @size: Size of the virtual disk in bytes
5119 # @cluster-size: RBD object size
5121 # @encrypt: Image encryption options.  (Since 6.1)
5123 # Since: 2.12
5125 { 'struct': 'BlockdevCreateOptionsRbd',
5126   'data': { 'location':         'BlockdevOptionsRbd',
5127             'size':             'size',
5128             '*cluster-size' :   'size',
5129             '*encrypt' :        'RbdEncryptionCreateOptions' } }
5132 # @BlockdevVmdkSubformat:
5134 # Subformat options for VMDK images
5136 # @monolithicSparse: Single file image with sparse cluster allocation
5138 # @monolithicFlat: Single flat data image and a descriptor file
5140 # @twoGbMaxExtentSparse: Data is split into 2GB (per virtual LBA)
5141 #     sparse extent files, in addition to a descriptor file
5143 # @twoGbMaxExtentFlat: Data is split into 2GB (per virtual LBA) flat
5144 #     extent files, in addition to a descriptor file
5146 # @streamOptimized: Single file image sparse cluster allocation,
5147 #     optimized for streaming over network.
5149 # Since: 4.0
5151 { 'enum': 'BlockdevVmdkSubformat',
5152   'data': [ 'monolithicSparse', 'monolithicFlat', 'twoGbMaxExtentSparse',
5153             'twoGbMaxExtentFlat', 'streamOptimized'] }
5156 # @BlockdevVmdkAdapterType:
5158 # Adapter type info for VMDK images
5160 # Since: 4.0
5162 { 'enum': 'BlockdevVmdkAdapterType',
5163   'data': [ 'ide', 'buslogic', 'lsilogic', 'legacyESX'] }
5166 # @BlockdevCreateOptionsVmdk:
5168 # Driver specific image creation options for VMDK.
5170 # @file: Where to store the new image file.  This refers to the image
5171 #     file for monolithcSparse and streamOptimized format, or the
5172 #     descriptor file for other formats.
5174 # @size: Size of the virtual disk in bytes
5176 # @extents: Where to store the data extents.  Required for
5177 #     monolithcFlat, twoGbMaxExtentSparse and twoGbMaxExtentFlat
5178 #     formats.  For monolithicFlat, only one entry is required; for
5179 #     twoGbMaxExtent* formats, the number of entries required is
5180 #     calculated as extent_number = virtual_size / 2GB. Providing more
5181 #     extents than will be used is an error.
5183 # @subformat: The subformat of the VMDK image.  Default:
5184 #     "monolithicSparse".
5186 # @backing-file: The path of backing file.  Default: no backing file
5187 #     is used.
5189 # @adapter-type: The adapter type used to fill in the descriptor.
5190 #     Default: ide.
5192 # @hwversion: Hardware version.  The meaningful options are "4" or
5193 #     "6". Default: "4".
5195 # @toolsversion: VMware guest tools version.  Default: "2147483647"
5196 #     (Since 6.2)
5198 # @zeroed-grain: Whether to enable zeroed-grain feature for sparse
5199 #     subformats.  Default: false.
5201 # Since: 4.0
5203 { 'struct': 'BlockdevCreateOptionsVmdk',
5204   'data': { 'file':             'BlockdevRef',
5205             'size':             'size',
5206             '*extents':          ['BlockdevRef'],
5207             '*subformat':       'BlockdevVmdkSubformat',
5208             '*backing-file':    'str',
5209             '*adapter-type':    'BlockdevVmdkAdapterType',
5210             '*hwversion':       'str',
5211             '*toolsversion':    'str',
5212             '*zeroed-grain':    'bool' } }
5215 # @BlockdevCreateOptionsSsh:
5217 # Driver specific image creation options for SSH.
5219 # @location: Where to store the new image file
5221 # @size: Size of the virtual disk in bytes
5223 # Since: 2.12
5225 { 'struct': 'BlockdevCreateOptionsSsh',
5226   'data': { 'location':         'BlockdevOptionsSsh',
5227             'size':             'size' } }
5230 # @BlockdevCreateOptionsVdi:
5232 # Driver specific image creation options for VDI.
5234 # @file: Node to create the image format on
5236 # @size: Size of the virtual disk in bytes
5238 # @preallocation: Preallocation mode for the new image (default: off;
5239 #     allowed values: off, metadata)
5241 # Since: 2.12
5243 { 'struct': 'BlockdevCreateOptionsVdi',
5244   'data': { 'file':             'BlockdevRef',
5245             'size':             'size',
5246             '*preallocation':   'PreallocMode' } }
5249 # @BlockdevVhdxSubformat:
5251 # @dynamic: Growing image file
5253 # @fixed: Preallocated fixed-size image file
5255 # Since: 2.12
5257 { 'enum': 'BlockdevVhdxSubformat',
5258   'data': [ 'dynamic', 'fixed' ] }
5261 # @BlockdevCreateOptionsVhdx:
5263 # Driver specific image creation options for vhdx.
5265 # @file: Node to create the image format on
5267 # @size: Size of the virtual disk in bytes
5269 # @log-size: Log size in bytes, must be a multiple of 1 MB (default: 1
5270 #     MB)
5272 # @block-size: Block size in bytes, must be a multiple of 1 MB and not
5273 #     larger than 256 MB (default: automatically choose a block size
5274 #     depending on the image size)
5276 # @subformat: vhdx subformat (default: dynamic)
5278 # @block-state-zero: Force use of payload blocks of type 'ZERO'.
5279 #     Non-standard, but default.  Do not set to 'off' when using
5280 #     'qemu-img convert' with subformat=dynamic.
5282 # Since: 2.12
5284 { 'struct': 'BlockdevCreateOptionsVhdx',
5285   'data': { 'file':                 'BlockdevRef',
5286             'size':                 'size',
5287             '*log-size':            'size',
5288             '*block-size':          'size',
5289             '*subformat':           'BlockdevVhdxSubformat',
5290             '*block-state-zero':    'bool' } }
5293 # @BlockdevVpcSubformat:
5295 # @dynamic: Growing image file
5297 # @fixed: Preallocated fixed-size image file
5299 # Since: 2.12
5301 { 'enum': 'BlockdevVpcSubformat',
5302   'data': [ 'dynamic', 'fixed' ] }
5305 # @BlockdevCreateOptionsVpc:
5307 # Driver specific image creation options for vpc (VHD).
5309 # @file: Node to create the image format on
5311 # @size: Size of the virtual disk in bytes
5313 # @subformat: vhdx subformat (default: dynamic)
5315 # @force-size: Force use of the exact byte size instead of rounding to
5316 #     the next size that can be represented in CHS geometry
5317 #     (default: false)
5319 # Since: 2.12
5321 { 'struct': 'BlockdevCreateOptionsVpc',
5322   'data': { 'file':                 'BlockdevRef',
5323             'size':                 'size',
5324             '*subformat':           'BlockdevVpcSubformat',
5325             '*force-size':          'bool' } }
5328 # @BlockdevCreateOptions:
5330 # Options for creating an image format on a given node.
5332 # @driver: block driver to create the image format
5334 # Since: 2.12
5336 { 'union': 'BlockdevCreateOptions',
5337   'base': {
5338       'driver':         'BlockdevDriver' },
5339   'discriminator': 'driver',
5340   'data': {
5341       'file':           'BlockdevCreateOptionsFile',
5342       'gluster':        'BlockdevCreateOptionsGluster',
5343       'luks':           'BlockdevCreateOptionsLUKS',
5344       'nfs':            'BlockdevCreateOptionsNfs',
5345       'parallels':      'BlockdevCreateOptionsParallels',
5346       'qcow':           'BlockdevCreateOptionsQcow',
5347       'qcow2':          'BlockdevCreateOptionsQcow2',
5348       'qed':            'BlockdevCreateOptionsQed',
5349       'rbd':            'BlockdevCreateOptionsRbd',
5350       'ssh':            'BlockdevCreateOptionsSsh',
5351       'vdi':            'BlockdevCreateOptionsVdi',
5352       'vhdx':           'BlockdevCreateOptionsVhdx',
5353       'vmdk':           'BlockdevCreateOptionsVmdk',
5354       'vpc':            'BlockdevCreateOptionsVpc'
5355   } }
5358 # @blockdev-create:
5360 # Starts a job to create an image format on a given node.  The job is
5361 # automatically finalized, but a manual job-dismiss is required.
5363 # @job-id: Identifier for the newly created job.
5365 # @options: Options for the image creation.
5367 # Since: 3.0
5369 { 'command': 'blockdev-create',
5370   'data': { 'job-id': 'str',
5371             'options': 'BlockdevCreateOptions' },
5372   'allow-preconfig': true }
5375 # @BlockdevAmendOptionsLUKS:
5377 # Driver specific image amend options for LUKS.
5379 # Since: 5.1
5381 { 'struct': 'BlockdevAmendOptionsLUKS',
5382   'base': 'QCryptoBlockAmendOptionsLUKS',
5383   'data': { }
5387 # @BlockdevAmendOptionsQcow2:
5389 # Driver specific image amend options for qcow2. For now, only
5390 # encryption options can be amended
5392 # @encrypt: Encryption options to be amended
5394 # Since: 5.1
5396 { 'struct': 'BlockdevAmendOptionsQcow2',
5397   'data': { '*encrypt':         'QCryptoBlockAmendOptions' } }
5400 # @BlockdevAmendOptions:
5402 # Options for amending an image format
5404 # @driver: Block driver of the node to amend.
5406 # Since: 5.1
5408 { 'union': 'BlockdevAmendOptions',
5409   'base': {
5410       'driver':         'BlockdevDriver' },
5411   'discriminator': 'driver',
5412   'data': {
5413       'luks':           'BlockdevAmendOptionsLUKS',
5414       'qcow2':          'BlockdevAmendOptionsQcow2' } }
5417 # @x-blockdev-amend:
5419 # Starts a job to amend format specific options of an existing open
5420 # block device The job is automatically finalized, but a manual
5421 # job-dismiss is required.
5423 # @job-id: Identifier for the newly created job.
5425 # @node-name: Name of the block node to work on
5427 # @options: Options (driver specific)
5429 # @force: Allow unsafe operations, format specific For luks that
5430 #     allows erase of the last active keyslot (permanent loss of
5431 #     data), and replacement of an active keyslot (possible loss of
5432 #     data if IO error happens)
5434 # Features:
5436 # @unstable: This command is experimental.
5438 # Since: 5.1
5440 { 'command': 'x-blockdev-amend',
5441   'data': { 'job-id': 'str',
5442             'node-name': 'str',
5443             'options': 'BlockdevAmendOptions',
5444             '*force': 'bool' },
5445   'features': [ 'unstable' ],
5446   'allow-preconfig': true }
5449 # @BlockErrorAction:
5451 # An enumeration of action that has been taken when a DISK I/O occurs
5453 # @ignore: error has been ignored
5455 # @report: error has been reported to the device
5457 # @stop: error caused VM to be stopped
5459 # Since: 2.1
5461 { 'enum': 'BlockErrorAction',
5462   'data': [ 'ignore', 'report', 'stop' ] }
5465 # @BLOCK_IMAGE_CORRUPTED:
5467 # Emitted when a disk image is being marked corrupt.  The image can be
5468 # identified by its device or node name.  The 'device' field is always
5469 # present for compatibility reasons, but it can be empty ("") if the
5470 # image does not have a device name associated.
5472 # @device: device name.  This is always present for compatibility
5473 #     reasons, but it can be empty ("") if the image does not have a
5474 #     device name associated.
5476 # @node-name: node name (Since: 2.4)
5478 # @msg: informative message for human consumption, such as the kind of
5479 #     corruption being detected.  It should not be parsed by machine
5480 #     as it is not guaranteed to be stable
5482 # @offset: if the corruption resulted from an image access, this is
5483 #     the host's access offset into the image
5485 # @size: if the corruption resulted from an image access, this is the
5486 #     access size
5488 # @fatal: if set, the image is marked corrupt and therefore unusable
5489 #     after this event and must be repaired (Since 2.2; before, every
5490 #     BLOCK_IMAGE_CORRUPTED event was fatal)
5492 # Note: If action is "stop", a STOP event will eventually follow the
5493 #     BLOCK_IO_ERROR event.
5495 # Example:
5497 # <- { "event": "BLOCK_IMAGE_CORRUPTED",
5498 #      "data": { "device": "", "node-name": "drive", "fatal": false,
5499 #                "msg": "L2 table offset 0x2a2a2a00 unaligned (L1 index: 0)" },
5500 #      "timestamp": { "seconds": 1648243240, "microseconds": 906060 } }
5502 # Since: 1.7
5504 { 'event': 'BLOCK_IMAGE_CORRUPTED',
5505   'data': { 'device'     : 'str',
5506             '*node-name' : 'str',
5507             'msg'        : 'str',
5508             '*offset'    : 'int',
5509             '*size'      : 'int',
5510             'fatal'      : 'bool' } }
5513 # @BLOCK_IO_ERROR:
5515 # Emitted when a disk I/O error occurs
5517 # @device: device name.  This is always present for compatibility
5518 #     reasons, but it can be empty ("") if the image does not have a
5519 #     device name associated.
5521 # @node-name: node name.  Note that errors may be reported for the
5522 #     root node that is directly attached to a guest device rather
5523 #     than for the node where the error occurred.  The node name is
5524 #     not present if the drive is empty.  (Since: 2.8)
5526 # @operation: I/O operation
5528 # @action: action that has been taken
5530 # @nospace: true if I/O error was caused due to a no-space condition.
5531 #     This key is only present if query-block's io-status is present,
5532 #     please see query-block documentation for more information
5533 #     (since: 2.2)
5535 # @reason: human readable string describing the error cause.  (This
5536 #     field is a debugging aid for humans, it should not be parsed by
5537 #     applications) (since: 2.2)
5539 # Note: If action is "stop", a STOP event will eventually follow the
5540 #     BLOCK_IO_ERROR event
5542 # Since: 0.13
5544 # Example:
5546 # <- { "event": "BLOCK_IO_ERROR",
5547 #      "data": { "device": "ide0-hd1",
5548 #                "node-name": "#block212",
5549 #                "operation": "write",
5550 #                "action": "stop",
5551 #                "reason": "No space left on device" },
5552 #      "timestamp": { "seconds": 1265044230, "microseconds": 450486 } }
5554 { 'event': 'BLOCK_IO_ERROR',
5555   'data': { 'device': 'str', '*node-name': 'str',
5556             'operation': 'IoOperationType',
5557             'action': 'BlockErrorAction', '*nospace': 'bool',
5558             'reason': 'str' } }
5561 # @BLOCK_JOB_COMPLETED:
5563 # Emitted when a block job has completed
5565 # @type: job type
5567 # @device: The job identifier.  Originally the device name but other
5568 #     values are allowed since QEMU 2.7
5570 # @len: maximum progress value
5572 # @offset: current progress value.  On success this is equal to len.
5573 #     On failure this is less than len
5575 # @speed: rate limit, bytes per second
5577 # @error: error message.  Only present on failure.  This field
5578 #     contains a human-readable error message.  There are no semantics
5579 #     other than that streaming has failed and clients should not try
5580 #     to interpret the error string
5582 # Since: 1.1
5584 # Example:
5586 # <- { "event": "BLOCK_JOB_COMPLETED",
5587 #      "data": { "type": "stream", "device": "virtio-disk0",
5588 #                "len": 10737418240, "offset": 10737418240,
5589 #                "speed": 0 },
5590 #      "timestamp": { "seconds": 1267061043, "microseconds": 959568 } }
5592 { 'event': 'BLOCK_JOB_COMPLETED',
5593   'data': { 'type'  : 'JobType',
5594             'device': 'str',
5595             'len'   : 'int',
5596             'offset': 'int',
5597             'speed' : 'int',
5598             '*error': 'str' } }
5601 # @BLOCK_JOB_CANCELLED:
5603 # Emitted when a block job has been cancelled
5605 # @type: job type
5607 # @device: The job identifier.  Originally the device name but other
5608 #     values are allowed since QEMU 2.7
5610 # @len: maximum progress value
5612 # @offset: current progress value.  On success this is equal to len.
5613 #     On failure this is less than len
5615 # @speed: rate limit, bytes per second
5617 # Since: 1.1
5619 # Example:
5621 # <- { "event": "BLOCK_JOB_CANCELLED",
5622 #      "data": { "type": "stream", "device": "virtio-disk0",
5623 #                "len": 10737418240, "offset": 134217728,
5624 #                "speed": 0 },
5625 #      "timestamp": { "seconds": 1267061043, "microseconds": 959568 } }
5627 { 'event': 'BLOCK_JOB_CANCELLED',
5628   'data': { 'type'  : 'JobType',
5629             'device': 'str',
5630             'len'   : 'int',
5631             'offset': 'int',
5632             'speed' : 'int' } }
5635 # @BLOCK_JOB_ERROR:
5637 # Emitted when a block job encounters an error
5639 # @device: The job identifier.  Originally the device name but other
5640 #     values are allowed since QEMU 2.7
5642 # @operation: I/O operation
5644 # @action: action that has been taken
5646 # Since: 1.3
5648 # Example:
5650 # <- { "event": "BLOCK_JOB_ERROR",
5651 #      "data": { "device": "ide0-hd1",
5652 #                "operation": "write",
5653 #                "action": "stop" },
5654 #      "timestamp": { "seconds": 1265044230, "microseconds": 450486 } }
5656 { 'event': 'BLOCK_JOB_ERROR',
5657   'data': { 'device'   : 'str',
5658             'operation': 'IoOperationType',
5659             'action'   : 'BlockErrorAction' } }
5662 # @BLOCK_JOB_READY:
5664 # Emitted when a block job is ready to complete
5666 # @type: job type
5668 # @device: The job identifier.  Originally the device name but other
5669 #     values are allowed since QEMU 2.7
5671 # @len: maximum progress value
5673 # @offset: current progress value.  On success this is equal to len.
5674 #     On failure this is less than len
5676 # @speed: rate limit, bytes per second
5678 # Note: The "ready to complete" status is always reset by a
5679 #     @BLOCK_JOB_ERROR event
5681 # Since: 1.3
5683 # Example:
5685 # <- { "event": "BLOCK_JOB_READY",
5686 #      "data": { "device": "drive0", "type": "mirror", "speed": 0,
5687 #                "len": 2097152, "offset": 2097152 },
5688 #      "timestamp": { "seconds": 1265044230, "microseconds": 450486 } }
5690 { 'event': 'BLOCK_JOB_READY',
5691   'data': { 'type'  : 'JobType',
5692             'device': 'str',
5693             'len'   : 'int',
5694             'offset': 'int',
5695             'speed' : 'int' } }
5698 # @BLOCK_JOB_PENDING:
5700 # Emitted when a block job is awaiting explicit authorization to
5701 # finalize graph changes via @block-job-finalize.  If this job is part
5702 # of a transaction, it will not emit this event until the transaction
5703 # has converged first.
5705 # @type: job type
5707 # @id: The job identifier.
5709 # Since: 2.12
5711 # Example:
5713 # <- { "event": "BLOCK_JOB_PENDING",
5714 #      "data": { "type": "mirror", "id": "backup_1" },
5715 #      "timestamp": { "seconds": 1265044230, "microseconds": 450486 } }
5717 { 'event': 'BLOCK_JOB_PENDING',
5718   'data': { 'type'  : 'JobType',
5719             'id'    : 'str' } }
5722 # @PreallocMode:
5724 # Preallocation mode of QEMU image file
5726 # @off: no preallocation
5728 # @metadata: preallocate only for metadata
5730 # @falloc: like @full preallocation but allocate disk space by
5731 #     posix_fallocate() rather than writing data.
5733 # @full: preallocate all data by writing it to the device to ensure
5734 #     disk space is really available.  This data may or may not be
5735 #     zero, depending on the image format and storage.  @full
5736 #     preallocation also sets up metadata correctly.
5738 # Since: 2.2
5740 { 'enum': 'PreallocMode',
5741   'data': [ 'off', 'metadata', 'falloc', 'full' ] }
5744 # @BLOCK_WRITE_THRESHOLD:
5746 # Emitted when writes on block device reaches or exceeds the
5747 # configured write threshold.  For thin-provisioned devices, this
5748 # means the device should be extended to avoid pausing for disk
5749 # exhaustion.  The event is one shot.  Once triggered, it needs to be
5750 # re-registered with another block-set-write-threshold command.
5752 # @node-name: graph node name on which the threshold was exceeded.
5754 # @amount-exceeded: amount of data which exceeded the threshold, in
5755 #     bytes.
5757 # @write-threshold: last configured threshold, in bytes.
5759 # Since: 2.3
5761 { 'event': 'BLOCK_WRITE_THRESHOLD',
5762   'data': { 'node-name': 'str',
5763             'amount-exceeded': 'uint64',
5764             'write-threshold': 'uint64' } }
5767 # @block-set-write-threshold:
5769 # Change the write threshold for a block drive.  An event will be
5770 # delivered if a write to this block drive crosses the configured
5771 # threshold.  The threshold is an offset, thus must be non-negative.
5772 # Default is no write threshold.  Setting the threshold to zero
5773 # disables it.
5775 # This is useful to transparently resize thin-provisioned drives
5776 # without the guest OS noticing.
5778 # @node-name: graph node name on which the threshold must be set.
5780 # @write-threshold: configured threshold for the block device, bytes.
5781 #     Use 0 to disable the threshold.
5783 # Since: 2.3
5785 # Example:
5787 # -> { "execute": "block-set-write-threshold",
5788 #      "arguments": { "node-name": "mydev",
5789 #                     "write-threshold": 17179869184 } }
5790 # <- { "return": {} }
5792 { 'command': 'block-set-write-threshold',
5793   'data': { 'node-name': 'str', 'write-threshold': 'uint64' },
5794   'allow-preconfig': true }
5797 # @x-blockdev-change:
5799 # Dynamically reconfigure the block driver state graph.  It can be
5800 # used to add, remove, insert or replace a graph node.  Currently only
5801 # the Quorum driver implements this feature to add or remove its
5802 # child.  This is useful to fix a broken quorum child.
5804 # If @node is specified, it will be inserted under @parent.  @child
5805 # may not be specified in this case.  If both @parent and @child are
5806 # specified but @node is not, @child will be detached from @parent.
5808 # @parent: the id or name of the parent node.
5810 # @child: the name of a child under the given parent node.
5812 # @node: the name of the node that will be added.
5814 # Features:
5816 # @unstable: This command is experimental, and its API is not stable.
5817 #     It does not support all kinds of operations, all kinds of
5818 #     children, nor all block drivers.
5820 #     FIXME Removing children from a quorum node means introducing
5821 #     gaps in the child indices.  This cannot be represented in the
5822 #     'children' list of BlockdevOptionsQuorum, as returned by
5823 #     .bdrv_refresh_filename().
5825 #     Warning: The data in a new quorum child MUST be consistent with
5826 #     that of the rest of the array.
5828 # Since: 2.7
5830 # Examples:
5832 # 1. Add a new node to a quorum
5834 # -> { "execute": "blockdev-add",
5835 #      "arguments": {
5836 #          "driver": "raw",
5837 #          "node-name": "new_node",
5838 #          "file": { "driver": "file",
5839 #                    "filename": "test.raw" } } }
5840 # <- { "return": {} }
5841 # -> { "execute": "x-blockdev-change",
5842 #      "arguments": { "parent": "disk1",
5843 #                     "node": "new_node" } }
5844 # <- { "return": {} }
5846 # 2. Delete a quorum's node
5848 # -> { "execute": "x-blockdev-change",
5849 #      "arguments": { "parent": "disk1",
5850 #                     "child": "children.1" } }
5851 # <- { "return": {} }
5853 { 'command': 'x-blockdev-change',
5854   'data' : { 'parent': 'str',
5855              '*child': 'str',
5856              '*node': 'str' },
5857   'features': [ 'unstable' ],
5858   'allow-preconfig': true }
5861 # @x-blockdev-set-iothread:
5863 # Move @node and its children into the @iothread.  If @iothread is
5864 # null then move @node and its children into the main loop.
5866 # The node must not be attached to a BlockBackend.
5868 # @node-name: the name of the block driver node
5870 # @iothread: the name of the IOThread object or null for the main loop
5872 # @force: true if the node and its children should be moved when a
5873 #     BlockBackend is already attached
5875 # Features:
5877 # @unstable: This command is experimental and intended for test cases
5878 #     that need control over IOThreads only.
5880 # Since: 2.12
5882 # Examples:
5884 # 1. Move a node into an IOThread
5886 # -> { "execute": "x-blockdev-set-iothread",
5887 #      "arguments": { "node-name": "disk1",
5888 #                     "iothread": "iothread0" } }
5889 # <- { "return": {} }
5891 # 2. Move a node into the main loop
5893 # -> { "execute": "x-blockdev-set-iothread",
5894 #      "arguments": { "node-name": "disk1",
5895 #                     "iothread": null } }
5896 # <- { "return": {} }
5898 { 'command': 'x-blockdev-set-iothread',
5899   'data' : { 'node-name': 'str',
5900              'iothread': 'StrOrNull',
5901              '*force': 'bool' },
5902   'features': [ 'unstable' ],
5903   'allow-preconfig': true }
5906 # @QuorumOpType:
5908 # An enumeration of the quorum operation types
5910 # @read: read operation
5912 # @write: write operation
5914 # @flush: flush operation
5916 # Since: 2.6
5918 { 'enum': 'QuorumOpType',
5919   'data': [ 'read', 'write', 'flush' ] }
5922 # @QUORUM_FAILURE:
5924 # Emitted by the Quorum block driver if it fails to establish a quorum
5926 # @reference: device name if defined else node name
5928 # @sector-num: number of the first sector of the failed read operation
5930 # @sectors-count: failed read operation sector count
5932 # Note: This event is rate-limited.
5934 # Since: 2.0
5936 # Example:
5938 # <- { "event": "QUORUM_FAILURE",
5939 #      "data": { "reference": "usr1", "sector-num": 345435, "sectors-count": 5 },
5940 #      "timestamp": { "seconds": 1344522075, "microseconds": 745528 } }
5942 { 'event': 'QUORUM_FAILURE',
5943   'data': { 'reference': 'str', 'sector-num': 'int', 'sectors-count': 'int' } }
5946 # @QUORUM_REPORT_BAD:
5948 # Emitted to report a corruption of a Quorum file
5950 # @type: quorum operation type (Since 2.6)
5952 # @error: error message.  Only present on failure.  This field
5953 #     contains a human-readable error message.  There are no semantics
5954 #     other than that the block layer reported an error and clients
5955 #     should not try to interpret the error string.
5957 # @node-name: the graph node name of the block driver state
5959 # @sector-num: number of the first sector of the failed read operation
5961 # @sectors-count: failed read operation sector count
5963 # Note: This event is rate-limited.
5965 # Since: 2.0
5967 # Examples:
5969 # 1. Read operation
5971 # <- { "event": "QUORUM_REPORT_BAD",
5972 #      "data": { "node-name": "node0", "sector-num": 345435, "sectors-count": 5,
5973 #                "type": "read" },
5974 #      "timestamp": { "seconds": 1344522075, "microseconds": 745528 } }
5976 # 2. Flush operation
5978 # <- { "event": "QUORUM_REPORT_BAD",
5979 #      "data": { "node-name": "node0", "sector-num": 0, "sectors-count": 2097120,
5980 #                "type": "flush", "error": "Broken pipe" },
5981 #      "timestamp": { "seconds": 1456406829, "microseconds": 291763 } }
5983 { 'event': 'QUORUM_REPORT_BAD',
5984   'data': { 'type': 'QuorumOpType', '*error': 'str', 'node-name': 'str',
5985             'sector-num': 'int', 'sectors-count': 'int' } }
5988 # @BlockdevSnapshotInternal:
5990 # @device: the device name or node-name of a root node to generate the
5991 #     snapshot from
5993 # @name: the name of the internal snapshot to be created
5995 # Notes: In transaction, if @name is empty, or any snapshot matching
5996 #     @name exists, the operation will fail.  Only some image formats
5997 #     support it, for example, qcow2, and rbd.
5999 # Since: 1.7
6001 { 'struct': 'BlockdevSnapshotInternal',
6002   'data': { 'device': 'str', 'name': 'str' } }
6005 # @blockdev-snapshot-internal-sync:
6007 # Synchronously take an internal snapshot of a block device, when the
6008 # format of the image used supports it.  If the name is an empty
6009 # string, or a snapshot with name already exists, the operation will
6010 # fail.
6012 # For the arguments, see the documentation of
6013 # BlockdevSnapshotInternal.
6015 # Returns:
6016 #     - nothing on success
6017 #     - If @device is not a valid block device, GenericError
6018 #     - If any snapshot matching @name exists, or @name is empty,
6019 #       GenericError
6020 #     - If the format of the image used does not support it,
6021 #       GenericError
6023 # Since: 1.7
6025 # Example:
6027 # -> { "execute": "blockdev-snapshot-internal-sync",
6028 #      "arguments": { "device": "ide-hd0",
6029 #                     "name": "snapshot0" }
6030 #    }
6031 # <- { "return": {} }
6033 { 'command': 'blockdev-snapshot-internal-sync',
6034   'data': 'BlockdevSnapshotInternal',
6035   'allow-preconfig': true }
6038 # @blockdev-snapshot-delete-internal-sync:
6040 # Synchronously delete an internal snapshot of a block device, when
6041 # the format of the image used support it.  The snapshot is identified
6042 # by name or id or both.  One of the name or id is required.  Return
6043 # SnapshotInfo for the successfully deleted snapshot.
6045 # @device: the device name or node-name of a root node to delete the
6046 #     snapshot from
6048 # @id: optional the snapshot's ID to be deleted
6050 # @name: optional the snapshot's name to be deleted
6052 # Returns:
6053 #     - SnapshotInfo on success
6054 #     - If @device is not a valid block device, GenericError
6055 #     - If snapshot not found, GenericError
6056 #     - If the format of the image used does not support it,
6057 #       GenericError
6058 #     - If @id and @name are both not specified, GenericError
6060 # Since: 1.7
6062 # Example:
6064 # -> { "execute": "blockdev-snapshot-delete-internal-sync",
6065 #      "arguments": { "device": "ide-hd0",
6066 #                     "name": "snapshot0" }
6067 #    }
6068 # <- { "return": {
6069 #                    "id": "1",
6070 #                    "name": "snapshot0",
6071 #                    "vm-state-size": 0,
6072 #                    "date-sec": 1000012,
6073 #                    "date-nsec": 10,
6074 #                    "vm-clock-sec": 100,
6075 #                    "vm-clock-nsec": 20,
6076 #                    "icount": 220414
6077 #      }
6078 #    }
6080 { 'command': 'blockdev-snapshot-delete-internal-sync',
6081   'data': { 'device': 'str', '*id': 'str', '*name': 'str'},
6082   'returns': 'SnapshotInfo',
6083   'allow-preconfig': true }
6086 # @DummyBlockCoreForceArrays:
6088 # Not used by QMP; hack to let us use BlockGraphInfoList internally
6090 # Since: 8.0
6092 { 'struct': 'DummyBlockCoreForceArrays',
6093   'data': { 'unused-block-graph-info': ['BlockGraphInfo'] } }