qapi: Rename QAPIDoc.Section.name to .tag
[qemu/armbru.git] / qapi / block-core.json
blobab5a93a966b69253f3be7f9edf126b983f4e4799
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 # @data: image information specific to QCOW2
201 # Since: 1.7
203 { 'struct': 'ImageInfoSpecificQCow2Wrapper',
204   'data': { 'data': 'ImageInfoSpecificQCow2' } }
207 # @ImageInfoSpecificVmdkWrapper:
209 # @data: image information specific to VMDK
211 # Since: 6.1
213 { 'struct': 'ImageInfoSpecificVmdkWrapper',
214   'data': { 'data': 'ImageInfoSpecificVmdk' } }
217 # @ImageInfoSpecificLUKSWrapper:
219 # @data: image information specific to LUKS
221 # Since: 2.7
223 { 'struct': 'ImageInfoSpecificLUKSWrapper',
224   'data': { 'data': 'QCryptoBlockInfoLUKS' } }
225 # If we need to add block driver specific parameters for
226 # LUKS in future, then we'll subclass QCryptoBlockInfoLUKS
227 # to define a ImageInfoSpecificLUKS
230 # @ImageInfoSpecificRbdWrapper:
232 # @data: image information specific to RBD
234 # Since: 6.1
236 { 'struct': 'ImageInfoSpecificRbdWrapper',
237   'data': { 'data': 'ImageInfoSpecificRbd' } }
240 # @ImageInfoSpecificFileWrapper:
242 # @data: image information specific to files
244 # Since: 8.0
246 { 'struct': 'ImageInfoSpecificFileWrapper',
247   'data': { 'data': 'ImageInfoSpecificFile' } }
250 # @ImageInfoSpecific:
252 # A discriminated record of image format specific information
253 # structures.
255 # @type: block driver name
257 # Since: 1.7
259 { 'union': 'ImageInfoSpecific',
260   'base': { 'type': 'ImageInfoSpecificKind' },
261   'discriminator': 'type',
262   'data': {
263       'qcow2': 'ImageInfoSpecificQCow2Wrapper',
264       'vmdk': 'ImageInfoSpecificVmdkWrapper',
265       'luks': 'ImageInfoSpecificLUKSWrapper',
266       'rbd': 'ImageInfoSpecificRbdWrapper',
267       'file': 'ImageInfoSpecificFileWrapper'
268   } }
271 # @BlockNodeInfo:
273 # Information about a QEMU image file
275 # @filename: name of the image file
277 # @format: format of the image file
279 # @virtual-size: maximum capacity in bytes of the image
281 # @actual-size: actual size on disk in bytes of the image
283 # @dirty-flag: true if image is not cleanly closed
285 # @cluster-size: size of a cluster in bytes
287 # @encrypted: true if the image is encrypted
289 # @compressed: true if the image is compressed (Since 1.7)
291 # @backing-filename: name of the backing file
293 # @full-backing-filename: full path of the backing file
295 # @backing-filename-format: the format of the backing file
297 # @snapshots: list of VM snapshots
299 # @format-specific: structure supplying additional format-specific
300 #     information (since 1.7)
302 # Since: 8.0
304 { 'struct': 'BlockNodeInfo',
305   'data': {'filename': 'str', 'format': 'str', '*dirty-flag': 'bool',
306            '*actual-size': 'int', 'virtual-size': 'int',
307            '*cluster-size': 'int', '*encrypted': 'bool', '*compressed': 'bool',
308            '*backing-filename': 'str', '*full-backing-filename': 'str',
309            '*backing-filename-format': 'str', '*snapshots': ['SnapshotInfo'],
310            '*format-specific': 'ImageInfoSpecific' } }
313 # @ImageInfo:
315 # Information about a QEMU image file, and potentially its backing
316 # image
318 # @backing-image: info of the backing image
320 # Since: 1.3
322 { 'struct': 'ImageInfo',
323   'base': 'BlockNodeInfo',
324   'data': {
325       '*backing-image': 'ImageInfo'
326   } }
329 # @BlockChildInfo:
331 # Information about all nodes in the block graph starting at some
332 # node, annotated with information about that node in relation to its
333 # parent.
335 # @name: Child name of the root node in the BlockGraphInfo struct, in
336 #     its role as the child of some undescribed parent node
338 # @info: Block graph information starting at this node
340 # Since: 8.0
342 { 'struct': 'BlockChildInfo',
343   'data': {
344       'name': 'str',
345       'info': 'BlockGraphInfo'
346   } }
349 # @BlockGraphInfo:
351 # Information about all nodes in a block (sub)graph in the form of
352 # BlockNodeInfo data.  The base BlockNodeInfo struct contains the
353 # information for the (sub)graph's root node.
355 # @children: Array of links to this node's child nodes' information
357 # Since: 8.0
359 { 'struct': 'BlockGraphInfo',
360   'base': 'BlockNodeInfo',
361   'data': { 'children': ['BlockChildInfo'] } }
364 # @ImageCheck:
366 # Information about a QEMU image file check
368 # @filename: name of the image file checked
370 # @format: format of the image file checked
372 # @check-errors: number of unexpected errors occurred during check
374 # @image-end-offset: offset (in bytes) where the image ends, this
375 #     field is present if the driver for the image format supports it
377 # @corruptions: number of corruptions found during the check if any
379 # @leaks: number of leaks found during the check if any
381 # @corruptions-fixed: number of corruptions fixed during the check if
382 #     any
384 # @leaks-fixed: number of leaks fixed during the check if any
386 # @total-clusters: total number of clusters, this field is present if
387 #     the driver for the image format supports it
389 # @allocated-clusters: total number of allocated clusters, this field
390 #     is present if the driver for the image format supports it
392 # @fragmented-clusters: total number of fragmented clusters, this
393 #     field is present if the driver for the image format supports it
395 # @compressed-clusters: total number of compressed clusters, this
396 #     field is present if the driver for the image format supports it
398 # Since: 1.4
400 { 'struct': 'ImageCheck',
401   'data': {'filename': 'str', 'format': 'str', 'check-errors': 'int',
402            '*image-end-offset': 'int', '*corruptions': 'int', '*leaks': 'int',
403            '*corruptions-fixed': 'int', '*leaks-fixed': 'int',
404            '*total-clusters': 'int', '*allocated-clusters': 'int',
405            '*fragmented-clusters': 'int', '*compressed-clusters': 'int' } }
408 # @MapEntry:
410 # Mapping information from a virtual block range to a host file range
412 # @start: virtual (guest) offset of the first byte described by this
413 #     entry
415 # @length: the number of bytes of the mapped virtual range
417 # @data: reading the image will actually read data from a file (in
418 #     particular, if @offset is present this means that the sectors
419 #     are not simply preallocated, but contain actual data in raw
420 #     format)
422 # @zero: whether the virtual blocks read as zeroes
424 # @compressed: true if the data is stored compressed (since 8.2)
426 # @depth: number of layers (0 = top image, 1 = top image's backing
427 #     file, ..., n - 1 = bottom image (where n is the number of images
428 #     in the chain)) before reaching one for which the range is
429 #     allocated
431 # @present: true if this layer provides the data, false if adding a
432 #     backing layer could impact this region (since 6.1)
434 # @offset: if present, the image file stores the data for this range
435 #     in raw format at the given (host) offset
437 # @filename: filename that is referred to by @offset
439 # Since: 2.6
441 { 'struct': 'MapEntry',
442   'data': {'start': 'int', 'length': 'int', 'data': 'bool',
443            'zero': 'bool', 'compressed': 'bool', 'depth': 'int',
444            'present': 'bool', '*offset': 'int', '*filename': 'str' } }
447 # @BlockdevCacheInfo:
449 # Cache mode information for a block device
451 # @writeback: true if writeback mode is enabled
453 # @direct: true if the host page cache is bypassed (O_DIRECT)
455 # @no-flush: true if flush requests are ignored for the device
457 # Since: 2.3
459 { 'struct': 'BlockdevCacheInfo',
460   'data': { 'writeback': 'bool',
461             'direct': 'bool',
462             'no-flush': 'bool' } }
465 # @BlockDeviceInfo:
467 # Information about the backing device for a block device.
469 # @file: the filename of the backing device
471 # @node-name: the name of the block driver node (Since 2.0)
473 # @ro: true if the backing device was open read-only
475 # @drv: the name of the block format used to open the backing device.
476 #     As of 0.14 this can be: 'blkdebug', 'bochs', 'cloop', 'cow',
477 #     'dmg', 'file', 'file', 'ftp', 'ftps', 'host_cdrom',
478 #     'host_device', 'http', 'https', 'luks', 'nbd', 'parallels',
479 #     'qcow', 'qcow2', 'raw', 'vdi', 'vmdk', 'vpc', 'vvfat' 2.2:
480 #     'archipelago' added, 'cow' dropped 2.3: 'host_floppy' deprecated
481 #     2.5: 'host_floppy' dropped 2.6: 'luks' added 2.8: 'replication'
482 #     added, 'tftp' dropped 2.9: 'archipelago' dropped
484 # @backing_file: the name of the backing file (for copy-on-write)
486 # @backing_file_depth: number of files in the backing file chain
487 #     (since: 1.2)
489 # @encrypted: true if the backing device is encrypted
491 # @detect_zeroes: detect and optimize zero writes (Since 2.1)
493 # @bps: total throughput limit in bytes per second is specified
495 # @bps_rd: read throughput limit in bytes per second is specified
497 # @bps_wr: write throughput limit in bytes per second is specified
499 # @iops: total I/O operations per second is specified
501 # @iops_rd: read I/O operations per second is specified
503 # @iops_wr: write I/O operations per second is specified
505 # @image: the info of image used (since: 1.6)
507 # @bps_max: total throughput limit during bursts, in bytes (Since 1.7)
509 # @bps_rd_max: read throughput limit during bursts, in bytes (Since
510 #     1.7)
512 # @bps_wr_max: write throughput limit during bursts, in bytes (Since
513 #     1.7)
515 # @iops_max: total I/O operations per second during bursts, in bytes
516 #     (Since 1.7)
518 # @iops_rd_max: read I/O operations per second during bursts, in bytes
519 #     (Since 1.7)
521 # @iops_wr_max: write I/O operations per second during bursts, in
522 #     bytes (Since 1.7)
524 # @bps_max_length: maximum length of the @bps_max burst period, in
525 #     seconds.  (Since 2.6)
527 # @bps_rd_max_length: maximum length of the @bps_rd_max burst period,
528 #     in seconds.  (Since 2.6)
530 # @bps_wr_max_length: maximum length of the @bps_wr_max burst period,
531 #     in seconds.  (Since 2.6)
533 # @iops_max_length: maximum length of the @iops burst period, in
534 #     seconds.  (Since 2.6)
536 # @iops_rd_max_length: maximum length of the @iops_rd_max burst
537 #     period, in seconds.  (Since 2.6)
539 # @iops_wr_max_length: maximum length of the @iops_wr_max burst
540 #     period, in seconds.  (Since 2.6)
542 # @iops_size: an I/O size in bytes (Since 1.7)
544 # @group: throttle group name (Since 2.4)
546 # @cache: the cache mode used for the block device (since: 2.3)
548 # @write_threshold: configured write threshold for the device.  0 if
549 #     disabled.  (Since 2.3)
551 # @dirty-bitmaps: dirty bitmaps information (only present if node has
552 #     one or more dirty bitmaps) (Since 4.2)
554 # Since: 0.14
556 { 'struct': 'BlockDeviceInfo',
557   'data': { 'file': 'str', '*node-name': 'str', 'ro': 'bool', 'drv': 'str',
558             '*backing_file': 'str', 'backing_file_depth': 'int',
559             'encrypted': 'bool',
560             'detect_zeroes': 'BlockdevDetectZeroesOptions',
561             'bps': 'int', 'bps_rd': 'int', 'bps_wr': 'int',
562             'iops': 'int', 'iops_rd': 'int', 'iops_wr': 'int',
563             'image': 'ImageInfo',
564             '*bps_max': 'int', '*bps_rd_max': 'int',
565             '*bps_wr_max': 'int', '*iops_max': 'int',
566             '*iops_rd_max': 'int', '*iops_wr_max': 'int',
567             '*bps_max_length': 'int', '*bps_rd_max_length': 'int',
568             '*bps_wr_max_length': 'int', '*iops_max_length': 'int',
569             '*iops_rd_max_length': 'int', '*iops_wr_max_length': 'int',
570             '*iops_size': 'int', '*group': 'str', 'cache': 'BlockdevCacheInfo',
571             'write_threshold': 'int', '*dirty-bitmaps': ['BlockDirtyInfo'] } }
574 # @BlockDeviceIoStatus:
576 # An enumeration of block device I/O status.
578 # @ok: The last I/O operation has succeeded
580 # @failed: The last I/O operation has failed
582 # @nospace: The last I/O operation has failed due to a no-space
583 #     condition
585 # Since: 1.0
587 { 'enum': 'BlockDeviceIoStatus', 'data': [ 'ok', 'failed', 'nospace' ] }
590 # @BlockDirtyInfo:
592 # Block dirty bitmap information.
594 # @name: the name of the dirty bitmap (Since 2.4)
596 # @count: number of dirty bytes according to the dirty bitmap
598 # @granularity: granularity of the dirty bitmap in bytes (since 1.4)
600 # @recording: true if the bitmap is recording new writes from the
601 #     guest.  (since 4.0)
603 # @busy: true if the bitmap is in-use by some operation (NBD or jobs)
604 #     and cannot be modified via QMP or used by another operation.
605 #     (since 4.0)
607 # @persistent: true if the bitmap was stored on disk, is scheduled to
608 #     be stored on disk, or both.  (since 4.0)
610 # @inconsistent: true if this is a persistent bitmap that was
611 #     improperly stored.  Implies @persistent to be true; @recording
612 #     and @busy to be false.  This bitmap cannot be used.  To remove
613 #     it, use @block-dirty-bitmap-remove.  (Since 4.0)
615 # Since: 1.3
617 { 'struct': 'BlockDirtyInfo',
618   'data': {'*name': 'str', 'count': 'int', 'granularity': 'uint32',
619            'recording': 'bool', 'busy': 'bool',
620            'persistent': 'bool', '*inconsistent': 'bool' } }
623 # @Qcow2BitmapInfoFlags:
625 # An enumeration of flags that a bitmap can report to the user.
627 # @in-use: This flag is set by any process actively modifying the
628 #     qcow2 file, and cleared when the updated bitmap is flushed to
629 #     the qcow2 image.  The presence of this flag in an offline image
630 #     means that the bitmap was not saved correctly after its last
631 #     usage, and may contain inconsistent data.
633 # @auto: The bitmap must reflect all changes of the virtual disk by
634 #     any application that would write to this qcow2 file.
636 # Since: 4.0
638 { 'enum': 'Qcow2BitmapInfoFlags',
639   'data': ['in-use', 'auto'] }
642 # @Qcow2BitmapInfo:
644 # Qcow2 bitmap information.
646 # @name: the name of the bitmap
648 # @granularity: granularity of the bitmap in bytes
650 # @flags: flags of the bitmap
652 # Since: 4.0
654 { 'struct': 'Qcow2BitmapInfo',
655   'data': {'name': 'str', 'granularity': 'uint32',
656            'flags': ['Qcow2BitmapInfoFlags'] } }
659 # @BlockLatencyHistogramInfo:
661 # Block latency histogram.
663 # @boundaries: list of interval boundary values in nanoseconds, all
664 #     greater than zero and in ascending order.  For example, the list
665 #     [10, 50, 100] produces the following histogram intervals: [0,
666 #     10), [10, 50), [50, 100), [100, +inf).
668 # @bins: list of io request counts corresponding to histogram
669 #     intervals, one more element than @boundaries has.  For the
670 #     example above, @bins may be something like [3, 1, 5, 2], and
671 #     corresponding histogram looks like::
673 #        5|           *
674 #        4|           *
675 #        3| *         *
676 #        2| *         *    *
677 #        1| *    *    *    *
678 #         +------------------
679 #             10   50   100
681 # Since: 4.0
683 { 'struct': 'BlockLatencyHistogramInfo',
684   'data': {'boundaries': ['uint64'], 'bins': ['uint64'] } }
687 # @BlockInfo:
689 # Block device information.  This structure describes a virtual device
690 # and the backing device associated with it.
692 # @device: The device name associated with the virtual device.
694 # @qdev: The qdev ID, or if no ID is assigned, the QOM path of the
695 #     block device.  (since 2.10)
697 # @type: This field is returned only for compatibility reasons, it
698 #     should not be used (always returns 'unknown')
700 # @removable: True if the device supports removable media.
702 # @locked: True if the guest has locked this device from having its
703 #     media removed
705 # @tray_open: True if the device's tray is open (only present if it
706 #     has a tray)
708 # @io-status: @BlockDeviceIoStatus.  Only present if the device
709 #     supports it and the VM is configured to stop on errors
710 #     (supported device models: virtio-blk, IDE, SCSI except
711 #     scsi-generic)
713 # @inserted: @BlockDeviceInfo describing the device if media is
714 #     present
716 # Since: 0.14
718 { 'struct': 'BlockInfo',
719   'data': {'device': 'str', '*qdev': 'str', 'type': 'str', 'removable': 'bool',
720            'locked': 'bool', '*inserted': 'BlockDeviceInfo',
721            '*tray_open': 'bool', '*io-status': 'BlockDeviceIoStatus' } }
724 # @BlockMeasureInfo:
726 # Image file size calculation information.  This structure describes
727 # the size requirements for creating a new image file.
729 # The size requirements depend on the new image file format.  File
730 # size always equals virtual disk size for the 'raw' format, even for
731 # sparse POSIX files.  Compact formats such as 'qcow2' represent
732 # unallocated and zero regions efficiently so file size may be smaller
733 # than virtual disk size.
735 # The values are upper bounds that are guaranteed to fit the new image
736 # file.  Subsequent modification, such as internal snapshot or further
737 # bitmap creation, may require additional space and is not covered
738 # here.
740 # @required: Size required for a new image file, in bytes, when
741 #     copying just allocated guest-visible contents.
743 # @fully-allocated: Image file size, in bytes, once data has been
744 #     written to all sectors, when copying just guest-visible
745 #     contents.
747 # @bitmaps: Additional size required if all the top-level bitmap
748 #     metadata in the source image were to be copied to the
749 #     destination, present only when source and destination both
750 #     support persistent bitmaps.  (since 5.1)
752 # Since: 2.10
754 { 'struct': 'BlockMeasureInfo',
755   'data': {'required': 'int', 'fully-allocated': 'int', '*bitmaps': 'int'} }
758 # @query-block:
760 # Get a list of BlockInfo for all virtual block devices.
762 # Returns: a list of @BlockInfo describing each virtual block device.
763 #     Filter nodes that were created implicitly are skipped over.
765 # Since: 0.14
767 # Example:
769 # -> { "execute": "query-block" }
770 # <- {
771 #       "return":[
772 #          {
773 #             "io-status": "ok",
774 #             "device":"ide0-hd0",
775 #             "locked":false,
776 #             "removable":false,
777 #             "inserted":{
778 #                "ro":false,
779 #                "drv":"qcow2",
780 #                "encrypted":false,
781 #                "file":"disks/test.qcow2",
782 #                "backing_file_depth":1,
783 #                "bps":1000000,
784 #                "bps_rd":0,
785 #                "bps_wr":0,
786 #                "iops":1000000,
787 #                "iops_rd":0,
788 #                "iops_wr":0,
789 #                "bps_max": 8000000,
790 #                "bps_rd_max": 0,
791 #                "bps_wr_max": 0,
792 #                "iops_max": 0,
793 #                "iops_rd_max": 0,
794 #                "iops_wr_max": 0,
795 #                "iops_size": 0,
796 #                "detect_zeroes": "on",
797 #                "write_threshold": 0,
798 #                "image":{
799 #                   "filename":"disks/test.qcow2",
800 #                   "format":"qcow2",
801 #                   "virtual-size":2048000,
802 #                   "backing_file":"base.qcow2",
803 #                   "full-backing-filename":"disks/base.qcow2",
804 #                   "backing-filename-format":"qcow2",
805 #                   "snapshots":[
806 #                      {
807 #                         "id": "1",
808 #                         "name": "snapshot1",
809 #                         "vm-state-size": 0,
810 #                         "date-sec": 10000200,
811 #                         "date-nsec": 12,
812 #                         "vm-clock-sec": 206,
813 #                         "vm-clock-nsec": 30
814 #                      }
815 #                   ],
816 #                   "backing-image":{
817 #                       "filename":"disks/base.qcow2",
818 #                       "format":"qcow2",
819 #                       "virtual-size":2048000
820 #                   }
821 #                }
822 #             },
823 #             "qdev": "ide_disk",
824 #             "type":"unknown"
825 #          },
826 #          {
827 #             "io-status": "ok",
828 #             "device":"ide1-cd0",
829 #             "locked":false,
830 #             "removable":true,
831 #             "qdev": "/machine/unattached/device[23]",
832 #             "tray_open": false,
833 #             "type":"unknown"
834 #          },
835 #          {
836 #             "device":"floppy0",
837 #             "locked":false,
838 #             "removable":true,
839 #             "qdev": "/machine/unattached/device[20]",
840 #             "type":"unknown"
841 #          },
842 #          {
843 #             "device":"sd0",
844 #             "locked":false,
845 #             "removable":true,
846 #             "type":"unknown"
847 #          }
848 #       ]
849 #    }
851 { 'command': 'query-block', 'returns': ['BlockInfo'],
852   'allow-preconfig': true }
855 # @BlockDeviceTimedStats:
857 # Statistics of a block device during a given interval of time.
859 # @interval_length: Interval used for calculating the statistics, in
860 #     seconds.
862 # @min_rd_latency_ns: Minimum latency of read operations in the
863 #     defined interval, in nanoseconds.
865 # @min_wr_latency_ns: Minimum latency of write operations in the
866 #     defined interval, in nanoseconds.
868 # @min_zone_append_latency_ns: Minimum latency of zone append
869 #     operations in the defined interval, in nanoseconds (since 8.1)
871 # @min_flush_latency_ns: Minimum latency of flush operations in the
872 #     defined interval, in nanoseconds.
874 # @max_rd_latency_ns: Maximum latency of read operations in the
875 #     defined interval, in nanoseconds.
877 # @max_wr_latency_ns: Maximum latency of write operations in the
878 #     defined interval, in nanoseconds.
880 # @max_zone_append_latency_ns: Maximum latency of zone append
881 #     operations in the defined interval, in nanoseconds (since 8.1)
883 # @max_flush_latency_ns: Maximum latency of flush operations in the
884 #     defined interval, in nanoseconds.
886 # @avg_rd_latency_ns: Average latency of read operations in the
887 #     defined interval, in nanoseconds.
889 # @avg_wr_latency_ns: Average latency of write operations in the
890 #     defined interval, in nanoseconds.
892 # @avg_zone_append_latency_ns: Average latency of zone append
893 #     operations in the defined interval, in nanoseconds (since 8.1)
895 # @avg_flush_latency_ns: Average latency of flush operations in the
896 #     defined interval, in nanoseconds.
898 # @avg_rd_queue_depth: Average number of pending read operations in
899 #     the defined interval.
901 # @avg_wr_queue_depth: Average number of pending write operations in
902 #     the defined interval.
904 # @avg_zone_append_queue_depth: Average number of pending zone append
905 #     operations in the defined interval (since 8.1).
907 # Since: 2.5
909 { 'struct': 'BlockDeviceTimedStats',
910   'data': { 'interval_length': 'int', 'min_rd_latency_ns': 'int',
911             'max_rd_latency_ns': 'int', 'avg_rd_latency_ns': 'int',
912             'min_wr_latency_ns': 'int', 'max_wr_latency_ns': 'int',
913             'avg_wr_latency_ns': 'int', 'min_zone_append_latency_ns': 'int',
914             'max_zone_append_latency_ns': 'int',
915             'avg_zone_append_latency_ns': 'int',
916             'min_flush_latency_ns': 'int', 'max_flush_latency_ns': 'int',
917             'avg_flush_latency_ns': 'int', 'avg_rd_queue_depth': 'number',
918             'avg_wr_queue_depth': 'number',
919             'avg_zone_append_queue_depth': 'number'  } }
922 # @BlockDeviceStats:
924 # Statistics of a virtual block device or a block backing device.
926 # @rd_bytes: The number of bytes read by the device.
928 # @wr_bytes: The number of bytes written by the device.
930 # @zone_append_bytes: The number of bytes appended by the zoned
931 #     devices (since 8.1)
933 # @unmap_bytes: The number of bytes unmapped by the device (Since 4.2)
935 # @rd_operations: The number of read operations performed by the
936 #     device.
938 # @wr_operations: The number of write operations performed by the
939 #     device.
941 # @zone_append_operations: The number of zone append operations
942 #     performed by the zoned devices (since 8.1)
944 # @flush_operations: The number of cache flush operations performed by
945 #     the device (since 0.15)
947 # @unmap_operations: The number of unmap operations performed by the
948 #     device (Since 4.2)
950 # @rd_total_time_ns: Total time spent on reads in nanoseconds (since
951 #     0.15).
953 # @wr_total_time_ns: Total time spent on writes in nanoseconds (since
954 #     0.15).
956 # @zone_append_total_time_ns: Total time spent on zone append writes
957 #     in nanoseconds (since 8.1)
959 # @flush_total_time_ns: Total time spent on cache flushes in
960 #     nanoseconds (since 0.15).
962 # @unmap_total_time_ns: Total time spent on unmap operations in
963 #     nanoseconds (Since 4.2)
965 # @wr_highest_offset: The offset after the greatest byte written to
966 #     the device.  The intended use of this information is for
967 #     growable sparse files (like qcow2) that are used on top of a
968 #     physical device.
970 # @rd_merged: Number of read requests that have been merged into
971 #     another request (Since 2.3).
973 # @wr_merged: Number of write requests that have been merged into
974 #     another request (Since 2.3).
976 # @zone_append_merged: Number of zone append requests that have been
977 #     merged into another request (since 8.1)
979 # @unmap_merged: Number of unmap requests that have been merged into
980 #     another request (Since 4.2)
982 # @idle_time_ns: Time since the last I/O operation, in nanoseconds.
983 #     If the field is absent it means that there haven't been any
984 #     operations yet (Since 2.5).
986 # @failed_rd_operations: The number of failed read operations
987 #     performed by the device (Since 2.5)
989 # @failed_wr_operations: The number of failed write operations
990 #     performed by the device (Since 2.5)
992 # @failed_zone_append_operations: The number of failed zone append
993 #     write operations performed by the zoned devices (since 8.1)
995 # @failed_flush_operations: The number of failed flush operations
996 #     performed by the device (Since 2.5)
998 # @failed_unmap_operations: The number of failed unmap operations
999 #     performed by the device (Since 4.2)
1001 # @invalid_rd_operations: The number of invalid read operations
1002 #     performed by the device (Since 2.5)
1004 # @invalid_wr_operations: The number of invalid write operations
1005 #     performed by the device (Since 2.5)
1007 # @invalid_zone_append_operations: The number of invalid zone append
1008 #     operations performed by the zoned device (since 8.1)
1010 # @invalid_flush_operations: The number of invalid flush operations
1011 #     performed by the device (Since 2.5)
1013 # @invalid_unmap_operations: The number of invalid unmap operations
1014 #     performed by the device (Since 4.2)
1016 # @account_invalid: Whether invalid operations are included in the
1017 #     last access statistics (Since 2.5)
1019 # @account_failed: Whether failed operations are included in the
1020 #     latency and last access statistics (Since 2.5)
1022 # @timed_stats: Statistics specific to the set of previously defined
1023 #     intervals of time (Since 2.5)
1025 # @rd_latency_histogram: @BlockLatencyHistogramInfo.  (Since 4.0)
1027 # @wr_latency_histogram: @BlockLatencyHistogramInfo.  (Since 4.0)
1029 # @zone_append_latency_histogram: @BlockLatencyHistogramInfo.
1030 #     (since 8.1)
1032 # @flush_latency_histogram: @BlockLatencyHistogramInfo.  (Since 4.0)
1034 # Since: 0.14
1036 { 'struct': 'BlockDeviceStats',
1037   'data': {'rd_bytes': 'int', 'wr_bytes': 'int', 'zone_append_bytes': 'int',
1038            'unmap_bytes' : 'int', 'rd_operations': 'int',
1039            'wr_operations': 'int', 'zone_append_operations': 'int',
1040            'flush_operations': 'int', 'unmap_operations': 'int',
1041            'rd_total_time_ns': 'int', 'wr_total_time_ns': 'int',
1042            'zone_append_total_time_ns': 'int', 'flush_total_time_ns': 'int',
1043            'unmap_total_time_ns': 'int', 'wr_highest_offset': 'int',
1044            'rd_merged': 'int', 'wr_merged': 'int', 'zone_append_merged': 'int',
1045            'unmap_merged': 'int', '*idle_time_ns': 'int',
1046            'failed_rd_operations': 'int', 'failed_wr_operations': 'int',
1047            'failed_zone_append_operations': 'int',
1048            'failed_flush_operations': 'int',
1049            'failed_unmap_operations': 'int', 'invalid_rd_operations': 'int',
1050            'invalid_wr_operations': 'int',
1051            'invalid_zone_append_operations': 'int',
1052            'invalid_flush_operations': 'int', 'invalid_unmap_operations': 'int',
1053            'account_invalid': 'bool', 'account_failed': 'bool',
1054            'timed_stats': ['BlockDeviceTimedStats'],
1055            '*rd_latency_histogram': 'BlockLatencyHistogramInfo',
1056            '*wr_latency_histogram': 'BlockLatencyHistogramInfo',
1057            '*zone_append_latency_histogram': 'BlockLatencyHistogramInfo',
1058            '*flush_latency_histogram': 'BlockLatencyHistogramInfo' } }
1061 # @BlockStatsSpecificFile:
1063 # File driver statistics
1065 # @discard-nb-ok: The number of successful discard operations
1066 #     performed by the driver.
1068 # @discard-nb-failed: The number of failed discard operations
1069 #     performed by the driver.
1071 # @discard-bytes-ok: The number of bytes discarded by the driver.
1073 # Since: 4.2
1075 { 'struct': 'BlockStatsSpecificFile',
1076   'data': {
1077       'discard-nb-ok': 'uint64',
1078       'discard-nb-failed': 'uint64',
1079       'discard-bytes-ok': 'uint64' } }
1082 # @BlockStatsSpecificNvme:
1084 # NVMe driver statistics
1086 # @completion-errors: The number of completion errors.
1088 # @aligned-accesses: The number of aligned accesses performed by the
1089 #     driver.
1091 # @unaligned-accesses: The number of unaligned accesses performed by
1092 #     the driver.
1094 # Since: 5.2
1096 { 'struct': 'BlockStatsSpecificNvme',
1097   'data': {
1098       'completion-errors': 'uint64',
1099       'aligned-accesses': 'uint64',
1100       'unaligned-accesses': 'uint64' } }
1103 # @BlockStatsSpecific:
1105 # Block driver specific statistics
1107 # @driver: block driver name
1109 # Since: 4.2
1111 { 'union': 'BlockStatsSpecific',
1112   'base': { 'driver': 'BlockdevDriver' },
1113   'discriminator': 'driver',
1114   'data': {
1115       'file': 'BlockStatsSpecificFile',
1116       'host_device': { 'type': 'BlockStatsSpecificFile',
1117                        'if': 'HAVE_HOST_BLOCK_DEVICE' },
1118       'nvme': 'BlockStatsSpecificNvme' } }
1121 # @BlockStats:
1123 # Statistics of a virtual block device or a block backing device.
1125 # @device: If the stats are for a virtual block device, the name
1126 #     corresponding to the virtual block device.
1128 # @node-name: The node name of the device.  (Since 2.3)
1130 # @qdev: The qdev ID, or if no ID is assigned, the QOM path of the
1131 #     block device.  (since 3.0)
1133 # @stats: A @BlockDeviceStats for the device.
1135 # @driver-specific: Optional driver-specific stats.  (Since 4.2)
1137 # @parent: This describes the file block device if it has one.
1138 #     Contains recursively the statistics of the underlying protocol
1139 #     (e.g. the host file for a qcow2 image).  If there is no
1140 #     underlying protocol, this field is omitted
1142 # @backing: This describes the backing block device if it has one.
1143 #     (Since 2.0)
1145 # Since: 0.14
1147 { 'struct': 'BlockStats',
1148   'data': {'*device': 'str', '*qdev': 'str', '*node-name': 'str',
1149            'stats': 'BlockDeviceStats',
1150            '*driver-specific': 'BlockStatsSpecific',
1151            '*parent': 'BlockStats',
1152            '*backing': 'BlockStats'} }
1155 # @query-blockstats:
1157 # Query the @BlockStats for all virtual block devices.
1159 # @query-nodes: If true, the command will query all the block nodes
1160 #     that have a node name, in a list which will include "parent"
1161 #     information, but not "backing". If false or omitted, the
1162 #     behavior is as before - query all the device backends,
1163 #     recursively including their "parent" and "backing". Filter nodes
1164 #     that were created implicitly are skipped over in this mode.
1165 #     (Since 2.3)
1167 # Returns: A list of @BlockStats for each virtual block devices.
1169 # Since: 0.14
1171 # Example:
1173 # -> { "execute": "query-blockstats" }
1174 # <- {
1175 #       "return":[
1176 #          {
1177 #             "device":"ide0-hd0",
1178 #             "parent":{
1179 #                "stats":{
1180 #                   "wr_highest_offset":3686448128,
1181 #                   "wr_bytes":9786368,
1182 #                   "wr_operations":751,
1183 #                   "rd_bytes":122567168,
1184 #                   "rd_operations":36772
1185 #                   "wr_total_times_ns":313253456
1186 #                   "rd_total_times_ns":3465673657
1187 #                   "flush_total_times_ns":49653
1188 #                   "flush_operations":61,
1189 #                   "rd_merged":0,
1190 #                   "wr_merged":0,
1191 #                   "idle_time_ns":2953431879,
1192 #                   "account_invalid":true,
1193 #                   "account_failed":false
1194 #                }
1195 #             },
1196 #             "stats":{
1197 #                "wr_highest_offset":2821110784,
1198 #                "wr_bytes":9786368,
1199 #                "wr_operations":692,
1200 #                "rd_bytes":122739200,
1201 #                "rd_operations":36604
1202 #                "flush_operations":51,
1203 #                "wr_total_times_ns":313253456
1204 #                "rd_total_times_ns":3465673657
1205 #                "flush_total_times_ns":49653,
1206 #                "rd_merged":0,
1207 #                "wr_merged":0,
1208 #                "idle_time_ns":2953431879,
1209 #                "account_invalid":true,
1210 #                "account_failed":false
1211 #             },
1212 #             "qdev": "/machine/unattached/device[23]"
1213 #          },
1214 #          {
1215 #             "device":"ide1-cd0",
1216 #             "stats":{
1217 #                "wr_highest_offset":0,
1218 #                "wr_bytes":0,
1219 #                "wr_operations":0,
1220 #                "rd_bytes":0,
1221 #                "rd_operations":0
1222 #                "flush_operations":0,
1223 #                "wr_total_times_ns":0
1224 #                "rd_total_times_ns":0
1225 #                "flush_total_times_ns":0,
1226 #                "rd_merged":0,
1227 #                "wr_merged":0,
1228 #                "account_invalid":false,
1229 #                "account_failed":false
1230 #             },
1231 #             "qdev": "/machine/unattached/device[24]"
1232 #          },
1233 #          {
1234 #             "device":"floppy0",
1235 #             "stats":{
1236 #                "wr_highest_offset":0,
1237 #                "wr_bytes":0,
1238 #                "wr_operations":0,
1239 #                "rd_bytes":0,
1240 #                "rd_operations":0
1241 #                "flush_operations":0,
1242 #                "wr_total_times_ns":0
1243 #                "rd_total_times_ns":0
1244 #                "flush_total_times_ns":0,
1245 #                "rd_merged":0,
1246 #                "wr_merged":0,
1247 #                "account_invalid":false,
1248 #                "account_failed":false
1249 #             },
1250 #             "qdev": "/machine/unattached/device[16]"
1251 #          },
1252 #          {
1253 #             "device":"sd0",
1254 #             "stats":{
1255 #                "wr_highest_offset":0,
1256 #                "wr_bytes":0,
1257 #                "wr_operations":0,
1258 #                "rd_bytes":0,
1259 #                "rd_operations":0
1260 #                "flush_operations":0,
1261 #                "wr_total_times_ns":0
1262 #                "rd_total_times_ns":0
1263 #                "flush_total_times_ns":0,
1264 #                "rd_merged":0,
1265 #                "wr_merged":0,
1266 #                "account_invalid":false,
1267 #                "account_failed":false
1268 #             }
1269 #          }
1270 #       ]
1271 #    }
1273 { 'command': 'query-blockstats',
1274   'data': { '*query-nodes': 'bool' },
1275   'returns': ['BlockStats'],
1276   'allow-preconfig': true }
1279 # @BlockdevOnError:
1281 # An enumeration of possible behaviors for errors on I/O operations.
1282 # The exact meaning depends on whether the I/O was initiated by a
1283 # guest or by a block job
1285 # @report: for guest operations, report the error to the guest; for
1286 #     jobs, cancel the job
1288 # @ignore: ignore the error, only report a QMP event (BLOCK_IO_ERROR
1289 #     or BLOCK_JOB_ERROR). The backup, mirror and commit block jobs
1290 #     retry the failing request later and may still complete
1291 #     successfully.  The stream block job continues to stream and will
1292 #     complete with an error.
1294 # @enospc: same as @stop on ENOSPC, same as @report otherwise.
1296 # @stop: for guest operations, stop the virtual machine; for jobs,
1297 #     pause the job
1299 # @auto: inherit the error handling policy of the backend (since: 2.7)
1301 # Since: 1.3
1303 { 'enum': 'BlockdevOnError',
1304   'data': ['report', 'ignore', 'enospc', 'stop', 'auto'] }
1307 # @MirrorSyncMode:
1309 # An enumeration of possible behaviors for the initial synchronization
1310 # phase of storage mirroring.
1312 # @top: copies data in the topmost image to the destination
1314 # @full: copies data from all images to the destination
1316 # @none: only copy data written from now on
1318 # @incremental: only copy data described by the dirty bitmap.
1319 #     (since: 2.4)
1321 # @bitmap: only copy data described by the dirty bitmap.  (since: 4.2)
1322 #     Behavior on completion is determined by the BitmapSyncMode.
1324 # Since: 1.3
1326 { 'enum': 'MirrorSyncMode',
1327   'data': ['top', 'full', 'none', 'incremental', 'bitmap'] }
1330 # @BitmapSyncMode:
1332 # An enumeration of possible behaviors for the synchronization of a
1333 # bitmap when used for data copy operations.
1335 # @on-success: The bitmap is only synced when the operation is
1336 #     successful.  This is the behavior always used for 'INCREMENTAL'
1337 #     backups.
1339 # @never: The bitmap is never synchronized with the operation, and is
1340 #     treated solely as a read-only manifest of blocks to copy.
1342 # @always: The bitmap is always synchronized with the operation,
1343 #     regardless of whether or not the operation was successful.
1345 # Since: 4.2
1347 { 'enum': 'BitmapSyncMode',
1348   'data': ['on-success', 'never', 'always'] }
1351 # @MirrorCopyMode:
1353 # An enumeration whose values tell the mirror block job when to
1354 # trigger writes to the target.
1356 # @background: copy data in background only.
1358 # @write-blocking: when data is written to the source, write it
1359 #     (synchronously) to the target as well.  In addition, data is
1360 #     copied in background just like in @background mode.
1362 # Since: 3.0
1364 { 'enum': 'MirrorCopyMode',
1365   'data': ['background', 'write-blocking'] }
1368 # @BlockJobInfoMirror:
1370 # Information specific to mirror block jobs.
1372 # @actively-synced: Whether the source is actively synced to the
1373 #     target, i.e. same data and new writes are done synchronously to
1374 #     both.
1376 # Since: 8.2
1378 { 'struct': 'BlockJobInfoMirror',
1379   'data': { 'actively-synced': 'bool' } }
1382 # @BlockJobInfo:
1384 # Information about a long-running block device operation.
1386 # @type: the job type ('stream' for image streaming)
1388 # @device: The job identifier.  Originally the device name but other
1389 #     values are allowed since QEMU 2.7
1391 # @len: Estimated @offset value at the completion of the job.  This
1392 #     value can arbitrarily change while the job is running, in both
1393 #     directions.
1395 # @offset: Progress made until now.  The unit is arbitrary and the
1396 #     value can only meaningfully be used for the ratio of @offset to
1397 #     @len.  The value is monotonically increasing.
1399 # @busy: false if the job is known to be in a quiescent state, with no
1400 #     pending I/O.  (Since 1.3)
1402 # @paused: whether the job is paused or, if @busy is true, will pause
1403 #     itself as soon as possible.  (Since 1.3)
1405 # @speed: the rate limit, bytes per second
1407 # @io-status: the status of the job (since 1.3)
1409 # @ready: true if the job may be completed (since 2.2)
1411 # @status: Current job state/status (since 2.12)
1413 # @auto-finalize: Job will finalize itself when PENDING, moving to the
1414 #     CONCLUDED state.  (since 2.12)
1416 # @auto-dismiss: Job will dismiss itself when CONCLUDED, moving to the
1417 #     NULL state and disappearing from the query list.  (since 2.12)
1419 # @error: Error information if the job did not complete successfully.
1420 #     Not set if the job completed successfully.  (since 2.12.1)
1422 # Since: 1.1
1424 { 'union': 'BlockJobInfo',
1425   'base': {'type': 'JobType', 'device': 'str', 'len': 'int',
1426            'offset': 'int', 'busy': 'bool', 'paused': 'bool', 'speed': 'int',
1427            'io-status': 'BlockDeviceIoStatus', 'ready': 'bool',
1428            'status': 'JobStatus',
1429            'auto-finalize': 'bool', 'auto-dismiss': 'bool',
1430            '*error': 'str' },
1431   'discriminator': 'type',
1432   'data': { 'mirror': 'BlockJobInfoMirror' } }
1435 # @query-block-jobs:
1437 # Return information about long-running block device operations.
1439 # Returns: a list of @BlockJobInfo for each active block job
1441 # Since: 1.1
1443 { 'command': 'query-block-jobs', 'returns': ['BlockJobInfo'],
1444   'allow-preconfig': true }
1447 # @block_resize:
1449 # Resize a block image while a guest is running.
1451 # Either @device or @node-name must be set but not both.
1453 # @device: the name of the device to get the image resized
1455 # @node-name: graph node name to get the image resized (Since 2.0)
1457 # @size: new image size in bytes
1459 # Returns:
1460 #     - nothing on success
1461 #     - If @device is not a valid block device, DeviceNotFound
1463 # Since: 0.14
1465 # Example:
1467 # -> { "execute": "block_resize",
1468 #      "arguments": { "device": "scratch", "size": 1073741824 } }
1469 # <- { "return": {} }
1471 { 'command': 'block_resize',
1472   'data': { '*device': 'str',
1473             '*node-name': 'str',
1474             'size': 'int' },
1475   'coroutine': true,
1476   'allow-preconfig': true }
1479 # @NewImageMode:
1481 # An enumeration that tells QEMU how to set the backing file path in a
1482 # new image file.
1484 # @existing: QEMU should look for an existing image file.
1486 # @absolute-paths: QEMU should create a new image with absolute paths
1487 #     for the backing file.  If there is no backing file available,
1488 #     the new image will not be backed either.
1490 # Since: 1.1
1492 { 'enum': 'NewImageMode',
1493   'data': [ 'existing', 'absolute-paths' ] }
1496 # @BlockdevSnapshotSync:
1498 # Either @device or @node-name must be set but not both.
1500 # @device: the name of the device to take a snapshot of.
1502 # @node-name: graph node name to generate the snapshot from (Since
1503 #     2.0)
1505 # @snapshot-file: the target of the new overlay image.  If the file
1506 #     exists, or if it is a device, the overlay will be created in the
1507 #     existing file/device.  Otherwise, a new file will be created.
1509 # @snapshot-node-name: the graph node name of the new image (Since
1510 #     2.0)
1512 # @format: the format of the overlay image, default is 'qcow2'.
1514 # @mode: whether and how QEMU should create a new image, default is
1515 #     'absolute-paths'.
1517 { 'struct': 'BlockdevSnapshotSync',
1518   'data': { '*device': 'str', '*node-name': 'str',
1519             'snapshot-file': 'str', '*snapshot-node-name': 'str',
1520             '*format': 'str', '*mode': 'NewImageMode' } }
1523 # @BlockdevSnapshot:
1525 # @node: device or node name that will have a snapshot taken.
1527 # @overlay: reference to the existing block device that will become
1528 #     the overlay of @node, as part of taking the snapshot.  It must
1529 #     not have a current backing file (this can be achieved by passing
1530 #     "backing": null to blockdev-add).
1532 # Since: 2.5
1534 { 'struct': 'BlockdevSnapshot',
1535   'data': { 'node': 'str', 'overlay': 'str' } }
1538 # @BackupPerf:
1540 # Optional parameters for backup.  These parameters don't affect
1541 # functionality, but may significantly affect performance.
1543 # @use-copy-range: Use copy offloading.  Default false.
1545 # @max-workers: Maximum number of parallel requests for the sustained
1546 #     background copying process.  Doesn't influence copy-before-write
1547 #     operations.  Default 64.
1549 # @max-chunk: Maximum request length for the sustained background
1550 #     copying process.  Doesn't influence copy-before-write
1551 #     operations.  0 means unlimited.  If max-chunk is non-zero then
1552 #     it should not be less than job cluster size which is calculated
1553 #     as maximum of target image cluster size and 64k.  Default 0.
1555 # Since: 6.0
1557 { 'struct': 'BackupPerf',
1558   'data': { '*use-copy-range': 'bool',
1559             '*max-workers': 'int', '*max-chunk': 'int64' } }
1562 # @BackupCommon:
1564 # @job-id: identifier for the newly-created block job.  If omitted,
1565 #     the device name will be used.  (Since 2.7)
1567 # @device: the device name or node-name of a root node which should be
1568 #     copied.
1570 # @sync: what parts of the disk image should be copied to the
1571 #     destination (all the disk, only the sectors allocated in the
1572 #     topmost image, from a dirty bitmap, or only new I/O).
1574 # @speed: the maximum speed, in bytes per second.  The default is 0,
1575 #     for unlimited.
1577 # @bitmap: The name of a dirty bitmap to use.  Must be present if sync
1578 #     is "bitmap" or "incremental". Can be present if sync is "full"
1579 #     or "top".  Must not be present otherwise.
1580 #     (Since 2.4 (drive-backup), 3.1 (blockdev-backup))
1582 # @bitmap-mode: Specifies the type of data the bitmap should contain
1583 #     after the operation concludes.  Must be present if a bitmap was
1584 #     provided, Must NOT be present otherwise.  (Since 4.2)
1586 # @compress: true to compress data, if the target format supports it.
1587 #     (default: false) (since 2.8)
1589 # @on-source-error: the action to take on an error on the source,
1590 #     default 'report'.  'stop' and 'enospc' can only be used if the
1591 #     block device supports io-status (see BlockInfo).
1593 # @on-target-error: the action to take on an error on the target,
1594 #     default 'report' (no limitations, since this applies to a
1595 #     different block device than @device).
1597 # @auto-finalize: When false, this job will wait in a PENDING state
1598 #     after it has finished its work, waiting for @block-job-finalize
1599 #     before making any block graph changes.  When true, this job will
1600 #     automatically perform its abort or commit actions.  Defaults to
1601 #     true.  (Since 2.12)
1603 # @auto-dismiss: When false, this job will wait in a CONCLUDED state
1604 #     after it has completely ceased all work, and awaits
1605 #     @block-job-dismiss.  When true, this job will automatically
1606 #     disappear from the query list without user intervention.
1607 #     Defaults to true.  (Since 2.12)
1609 # @filter-node-name: the node name that should be assigned to the
1610 #     filter driver that the backup job inserts into the graph above
1611 #     node specified by @drive.  If this option is not given, a node
1612 #     name is autogenerated.  (Since: 4.2)
1614 # @x-perf: Performance options.  (Since 6.0)
1616 # Features:
1618 # @unstable: Member @x-perf is experimental.
1620 # Note: @on-source-error and @on-target-error only affect background
1621 #     I/O.  If an error occurs during a guest write request, the
1622 #     device's rerror/werror actions will be used.
1624 # Since: 4.2
1626 { 'struct': 'BackupCommon',
1627   'data': { '*job-id': 'str', 'device': 'str',
1628             'sync': 'MirrorSyncMode', '*speed': 'int',
1629             '*bitmap': 'str', '*bitmap-mode': 'BitmapSyncMode',
1630             '*compress': 'bool',
1631             '*on-source-error': 'BlockdevOnError',
1632             '*on-target-error': 'BlockdevOnError',
1633             '*auto-finalize': 'bool', '*auto-dismiss': 'bool',
1634             '*filter-node-name': 'str',
1635             '*x-perf': { 'type': 'BackupPerf',
1636                          'features': [ 'unstable' ] } } }
1639 # @DriveBackup:
1641 # @target: the target of the new image.  If the file exists, or if it
1642 #     is a device, the existing file/device will be used as the new
1643 #     destination.  If it does not exist, a new file will be created.
1645 # @format: the format of the new destination, default is to probe if
1646 #     @mode is 'existing', else the format of the source
1648 # @mode: whether and how QEMU should create a new image, default is
1649 #     'absolute-paths'.
1651 # Since: 1.6
1653 { 'struct': 'DriveBackup',
1654   'base': 'BackupCommon',
1655   'data': { 'target': 'str',
1656             '*format': 'str',
1657             '*mode': 'NewImageMode' } }
1660 # @BlockdevBackup:
1662 # @target: the device name or node-name of the backup target node.
1664 # Since: 2.3
1666 { 'struct': 'BlockdevBackup',
1667   'base': 'BackupCommon',
1668   'data': { 'target': 'str' } }
1671 # @blockdev-snapshot-sync:
1673 # Takes a synchronous snapshot of a block device.
1675 # For the arguments, see the documentation of BlockdevSnapshotSync.
1677 # Returns:
1678 #     - nothing on success
1679 #     - If @device is not a valid block device, DeviceNotFound
1681 # Since: 0.14
1683 # Example:
1685 # -> { "execute": "blockdev-snapshot-sync",
1686 #      "arguments": { "device": "ide-hd0",
1687 #                     "snapshot-file":
1688 #                     "/some/place/my-image",
1689 #                     "format": "qcow2" } }
1690 # <- { "return": {} }
1692 { 'command': 'blockdev-snapshot-sync',
1693   'data': 'BlockdevSnapshotSync',
1694   'allow-preconfig': true }
1697 # @blockdev-snapshot:
1699 # Takes a snapshot of a block device.
1701 # Take a snapshot, by installing 'node' as the backing image of
1702 # 'overlay'. Additionally, if 'node' is associated with a block
1703 # device, the block device changes to using 'overlay' as its new
1704 # active image.
1706 # For the arguments, see the documentation of BlockdevSnapshot.
1708 # Features:
1710 # @allow-write-only-overlay: If present, the check whether this
1711 #     operation is safe was relaxed so that it can be used to change
1712 #     backing file of a destination of a blockdev-mirror.  (since 5.0)
1714 # Since: 2.5
1716 # Example:
1718 # -> { "execute": "blockdev-add",
1719 #      "arguments": { "driver": "qcow2",
1720 #                     "node-name": "node1534",
1721 #                     "file": { "driver": "file",
1722 #                               "filename": "hd1.qcow2" },
1723 #                     "backing": null } }
1725 # <- { "return": {} }
1727 # -> { "execute": "blockdev-snapshot",
1728 #      "arguments": { "node": "ide-hd0",
1729 #                     "overlay": "node1534" } }
1730 # <- { "return": {} }
1732 { 'command': 'blockdev-snapshot',
1733   'data': 'BlockdevSnapshot',
1734   'features': [ 'allow-write-only-overlay' ],
1735   'allow-preconfig': true }
1738 # @change-backing-file:
1740 # Change the backing file in the image file metadata.  This does not
1741 # cause QEMU to reopen the image file to reparse the backing filename
1742 # (it may, however, perform a reopen to change permissions from r/o ->
1743 # r/w -> r/o, if needed). The new backing file string is written into
1744 # the image file metadata, and the QEMU internal strings are updated.
1746 # @image-node-name: The name of the block driver state node of the
1747 #     image to modify.  The "device" argument is used to verify
1748 #     "image-node-name" is in the chain described by "device".
1750 # @device: The device name or node-name of the root node that owns
1751 #     image-node-name.
1753 # @backing-file: The string to write as the backing file.  This string
1754 #     is not validated, so care should be taken when specifying the
1755 #     string or the image chain may not be able to be reopened again.
1757 # Returns:
1758 #     - Nothing on success
1759 #     - If "device" does not exist or cannot be determined,
1760 #       DeviceNotFound
1762 # Since: 2.1
1764 { 'command': 'change-backing-file',
1765   'data': { 'device': 'str', 'image-node-name': 'str',
1766             'backing-file': 'str' },
1767   'allow-preconfig': true }
1770 # @block-commit:
1772 # Live commit of data from overlay image nodes into backing nodes -
1773 # i.e., writes data between 'top' and 'base' into 'base'.
1775 # If top == base, that is an error.  If top has no overlays on top of
1776 # it, or if it is in use by a writer, the job will not be completed by
1777 # itself.  The user needs to complete the job with the
1778 # block-job-complete command after getting the ready event.  (Since
1779 # 2.0)
1781 # If the base image is smaller than top, then the base image will be
1782 # resized to be the same size as top.  If top is smaller than the base
1783 # image, the base will not be truncated.  If you want the base image
1784 # size to match the size of the smaller top, you can safely truncate
1785 # it yourself once the commit operation successfully completes.
1787 # @job-id: identifier for the newly-created block job.  If omitted,
1788 #     the device name will be used.  (Since 2.7)
1790 # @device: the device name or node-name of a root node
1792 # @base-node: The node name of the backing image to write data into.
1793 #     If not specified, this is the deepest backing image.
1794 #     (since: 3.1)
1796 # @base: Same as @base-node, except that it is a file name rather than
1797 #     a node name.  This must be the exact filename string that was
1798 #     used to open the node; other strings, even if addressing the
1799 #     same file, are not accepted
1801 # @top-node: The node name of the backing image within the image chain
1802 #     which contains the topmost data to be committed down.  If not
1803 #     specified, this is the active layer.  (since: 3.1)
1805 # @top: Same as @top-node, except that it is a file name rather than a
1806 #     node name.  This must be the exact filename string that was used
1807 #     to open the node; other strings, even if addressing the same
1808 #     file, are not accepted
1810 # @backing-file: The backing file string to write into the overlay
1811 #     image of 'top'.  If 'top' does not have an overlay image, or if
1812 #     'top' is in use by a writer, specifying a backing file string is
1813 #     an error.
1815 #     This filename is not validated.  If a pathname string is such
1816 #     that it cannot be resolved by QEMU, that means that subsequent
1817 #     QMP or HMP commands must use node-names for the image in
1818 #     question, as filename lookup methods will fail.
1820 #     If not specified, QEMU will automatically determine the backing
1821 #     file string to use, or error out if there is no obvious choice.
1822 #     Care should be taken when specifying the string, to specify a
1823 #     valid filename or protocol.  (Since 2.1)
1825 # @backing-mask-protocol: If true, replace any protocol mentioned in the
1826 #     'backing file format' with 'raw', rather than storing the protocol
1827 #     name as the backing format.  Can be used even when no image header
1828 #     will be updated (default false; since 9.0).
1830 # @speed: the maximum speed, in bytes per second
1832 # @on-error: the action to take on an error.  'ignore' means that the
1833 #     request should be retried.  (default: report; Since: 5.0)
1835 # @filter-node-name: the node name that should be assigned to the
1836 #     filter driver that the commit job inserts into the graph above
1837 #     @top.  If this option is not given, a node name is
1838 #     autogenerated.  (Since: 2.9)
1840 # @auto-finalize: When false, this job will wait in a PENDING state
1841 #     after it has finished its work, waiting for @block-job-finalize
1842 #     before making any block graph changes.  When true, this job will
1843 #     automatically perform its abort or commit actions.  Defaults to
1844 #     true.  (Since 3.1)
1846 # @auto-dismiss: When false, this job will wait in a CONCLUDED state
1847 #     after it has completely ceased all work, and awaits
1848 #     @block-job-dismiss.  When true, this job will automatically
1849 #     disappear from the query list without user intervention.
1850 #     Defaults to true.  (Since 3.1)
1852 # Features:
1854 # @deprecated: Members @base and @top are deprecated.  Use @base-node
1855 #     and @top-node instead.
1857 # Returns:
1858 #     - Nothing on success
1859 #     - If @device does not exist, DeviceNotFound
1860 #     - Any other error returns a GenericError.
1862 # Since: 1.3
1864 # Example:
1866 # -> { "execute": "block-commit",
1867 #      "arguments": { "device": "virtio0",
1868 #                     "top": "/tmp/snap1.qcow2" } }
1869 # <- { "return": {} }
1871 { 'command': 'block-commit',
1872   'data': { '*job-id': 'str', 'device': 'str', '*base-node': 'str',
1873             '*base': { 'type': 'str', 'features': [ 'deprecated' ] },
1874             '*top-node': 'str',
1875             '*top': { 'type': 'str', 'features': [ 'deprecated' ] },
1876             '*backing-file': 'str', '*backing-mask-protocol': 'bool',
1877             '*speed': 'int',
1878             '*on-error': 'BlockdevOnError',
1879             '*filter-node-name': 'str',
1880             '*auto-finalize': 'bool', '*auto-dismiss': 'bool' },
1881   'allow-preconfig': true }
1884 # @drive-backup:
1886 # Start a point-in-time copy of a block device to a new destination.
1887 # The status of ongoing drive-backup operations can be checked with
1888 # query-block-jobs where the BlockJobInfo.type field has the value
1889 # 'backup'. The operation can be stopped before it has completed using
1890 # the block-job-cancel command.
1892 # Features:
1894 # @deprecated: This command is deprecated.  Use @blockdev-backup
1895 #     instead.
1897 # Returns:
1898 #     - nothing on success
1899 #     - If @device is not a valid block device, GenericError
1901 # Since: 1.6
1903 # Example:
1905 # -> { "execute": "drive-backup",
1906 #      "arguments": { "device": "drive0",
1907 #                     "sync": "full",
1908 #                     "target": "backup.img" } }
1909 # <- { "return": {} }
1911 { 'command': 'drive-backup', 'boxed': true,
1912   'data': 'DriveBackup', 'features': ['deprecated'],
1913   'allow-preconfig': true }
1916 # @blockdev-backup:
1918 # Start a point-in-time copy of a block device to a new destination.
1919 # The status of ongoing blockdev-backup operations can be checked with
1920 # query-block-jobs where the BlockJobInfo.type field has the value
1921 # 'backup'. The operation can be stopped before it has completed using
1922 # the block-job-cancel command.
1924 # Returns:
1925 #     - nothing on success
1926 #     - If @device is not a valid block device, DeviceNotFound
1928 # Since: 2.3
1930 # Example:
1932 # -> { "execute": "blockdev-backup",
1933 #      "arguments": { "device": "src-id",
1934 #                     "sync": "full",
1935 #                     "target": "tgt-id" } }
1936 # <- { "return": {} }
1938 { 'command': 'blockdev-backup', 'boxed': true,
1939   'data': 'BlockdevBackup',
1940   'allow-preconfig': true }
1943 # @query-named-block-nodes:
1945 # Get the named block driver list
1947 # @flat: Omit the nested data about backing image ("backing-image"
1948 #     key) if true.  Default is false (Since 5.0)
1950 # Returns: the list of BlockDeviceInfo
1952 # Since: 2.0
1954 # Example:
1956 # -> { "execute": "query-named-block-nodes" }
1957 # <- { "return": [ { "ro":false,
1958 #                    "drv":"qcow2",
1959 #                    "encrypted":false,
1960 #                    "file":"disks/test.qcow2",
1961 #                    "node-name": "my-node",
1962 #                    "backing_file_depth":1,
1963 #                    "detect_zeroes":"off",
1964 #                    "bps":1000000,
1965 #                    "bps_rd":0,
1966 #                    "bps_wr":0,
1967 #                    "iops":1000000,
1968 #                    "iops_rd":0,
1969 #                    "iops_wr":0,
1970 #                    "bps_max": 8000000,
1971 #                    "bps_rd_max": 0,
1972 #                    "bps_wr_max": 0,
1973 #                    "iops_max": 0,
1974 #                    "iops_rd_max": 0,
1975 #                    "iops_wr_max": 0,
1976 #                    "iops_size": 0,
1977 #                    "write_threshold": 0,
1978 #                    "image":{
1979 #                       "filename":"disks/test.qcow2",
1980 #                       "format":"qcow2",
1981 #                       "virtual-size":2048000,
1982 #                       "backing_file":"base.qcow2",
1983 #                       "full-backing-filename":"disks/base.qcow2",
1984 #                       "backing-filename-format":"qcow2",
1985 #                       "snapshots":[
1986 #                          {
1987 #                             "id": "1",
1988 #                             "name": "snapshot1",
1989 #                             "vm-state-size": 0,
1990 #                             "date-sec": 10000200,
1991 #                             "date-nsec": 12,
1992 #                             "vm-clock-sec": 206,
1993 #                             "vm-clock-nsec": 30
1994 #                          }
1995 #                       ],
1996 #                       "backing-image":{
1997 #                           "filename":"disks/base.qcow2",
1998 #                           "format":"qcow2",
1999 #                           "virtual-size":2048000
2000 #                       }
2001 #                    } } ] }
2003 { 'command': 'query-named-block-nodes',
2004   'returns': [ 'BlockDeviceInfo' ],
2005   'data': { '*flat': 'bool' },
2006   'allow-preconfig': true }
2009 # @XDbgBlockGraphNodeType:
2011 # @block-backend: corresponds to BlockBackend
2013 # @block-job: corresponds to BlockJob
2015 # @block-driver: corresponds to BlockDriverState
2017 # Since: 4.0
2019 { 'enum': 'XDbgBlockGraphNodeType',
2020   'data': [ 'block-backend', 'block-job', 'block-driver' ] }
2023 # @XDbgBlockGraphNode:
2025 # @id: Block graph node identifier.  This @id is generated only for
2026 #     x-debug-query-block-graph and does not relate to any other
2027 #     identifiers in Qemu.
2029 # @type: Type of graph node.  Can be one of block-backend, block-job
2030 #     or block-driver-state.
2032 # @name: Human readable name of the node.  Corresponds to node-name
2033 #     for block-driver-state nodes; is not guaranteed to be unique in
2034 #     the whole graph (with block-jobs and block-backends).
2036 # Since: 4.0
2038 { 'struct': 'XDbgBlockGraphNode',
2039   'data': { 'id': 'uint64', 'type': 'XDbgBlockGraphNodeType', 'name': 'str' } }
2042 # @BlockPermission:
2044 # Enum of base block permissions.
2046 # @consistent-read: A user that has the "permission" of consistent
2047 #     reads is guaranteed that their view of the contents of the block
2048 #     device is complete and self-consistent, representing the
2049 #     contents of a disk at a specific point.  For most block devices
2050 #     (including their backing files) this is true, but the property
2051 #     cannot be maintained in a few situations like for intermediate
2052 #     nodes of a commit block job.
2054 # @write: This permission is required to change the visible disk
2055 #     contents.
2057 # @write-unchanged: This permission (which is weaker than
2058 #     BLK_PERM_WRITE) is both enough and required for writes to the
2059 #     block node when the caller promises that the visible disk
2060 #     content doesn't change.  As the BLK_PERM_WRITE permission is
2061 #     strictly stronger, either is sufficient to perform an unchanging
2062 #     write.
2064 # @resize: This permission is required to change the size of a block
2065 #     node.
2067 # Since: 4.0
2069 { 'enum': 'BlockPermission',
2070   'data': [ 'consistent-read', 'write', 'write-unchanged', 'resize' ] }
2073 # @XDbgBlockGraphEdge:
2075 # Block Graph edge description for x-debug-query-block-graph.
2077 # @parent: parent id
2079 # @child: child id
2081 # @name: name of the relation (examples are 'file' and 'backing')
2083 # @perm: granted permissions for the parent operating on the child
2085 # @shared-perm: permissions that can still be granted to other users
2086 #     of the child while it is still attached to this parent
2088 # Since: 4.0
2090 { 'struct': 'XDbgBlockGraphEdge',
2091   'data': { 'parent': 'uint64', 'child': 'uint64',
2092             'name': 'str', 'perm': [ 'BlockPermission' ],
2093             'shared-perm': [ 'BlockPermission' ] } }
2096 # @XDbgBlockGraph:
2098 # Block Graph - list of nodes and list of edges.
2100 # Since: 4.0
2102 { 'struct': 'XDbgBlockGraph',
2103   'data': { 'nodes': ['XDbgBlockGraphNode'], 'edges': ['XDbgBlockGraphEdge'] } }
2106 # @x-debug-query-block-graph:
2108 # Get the block graph.
2110 # Features:
2112 # @unstable: This command is meant for debugging.
2114 # Since: 4.0
2116 { 'command': 'x-debug-query-block-graph', 'returns': 'XDbgBlockGraph',
2117   'features': [ 'unstable' ],
2118   'allow-preconfig': true }
2121 # @drive-mirror:
2123 # Start mirroring a block device's writes to a new destination.
2124 # target specifies the target of the new image.  If the file exists,
2125 # or if it is a device, it will be used as the new destination for
2126 # writes.  If it does not exist, a new file will be created.  format
2127 # specifies the format of the mirror image, default is to probe if
2128 # mode='existing', else the format of the source.
2130 # Returns:
2131 #     - nothing on success
2132 #     - If @device is not a valid block device, GenericError
2134 # Since: 1.3
2136 # Example:
2138 # -> { "execute": "drive-mirror",
2139 #      "arguments": { "device": "ide-hd0",
2140 #                     "target": "/some/place/my-image",
2141 #                     "sync": "full",
2142 #                     "format": "qcow2" } }
2143 # <- { "return": {} }
2145 { 'command': 'drive-mirror', 'boxed': true,
2146   'data': 'DriveMirror',
2147   'allow-preconfig': true }
2150 # @DriveMirror:
2152 # A set of parameters describing drive mirror setup.
2154 # @job-id: identifier for the newly-created block job.  If omitted,
2155 #     the device name will be used.  (Since 2.7)
2157 # @device: the device name or node-name of a root node whose writes
2158 #     should be mirrored.
2160 # @target: the target of the new image.  If the file exists, or if it
2161 #     is a device, the existing file/device will be used as the new
2162 #     destination.  If it does not exist, a new file will be created.
2164 # @format: the format of the new destination, default is to probe if
2165 #     @mode is 'existing', else the format of the source
2167 # @node-name: the new block driver state node name in the graph (Since
2168 #     2.1)
2170 # @replaces: with sync=full graph node name to be replaced by the new
2171 #     image when a whole image copy is done.  This can be used to
2172 #     repair broken Quorum files.  By default, @device is replaced,
2173 #     although implicitly created filters on it are kept.  (Since 2.1)
2175 # @mode: whether and how QEMU should create a new image, default is
2176 #     'absolute-paths'.
2178 # @speed: the maximum speed, in bytes per second
2180 # @sync: what parts of the disk image should be copied to the
2181 #     destination (all the disk, only the sectors allocated in the
2182 #     topmost image, or only new I/O).
2184 # @granularity: granularity of the dirty bitmap, default is 64K if the
2185 #     image format doesn't have clusters, 4K if the clusters are
2186 #     smaller than that, else the cluster size.  Must be a power of 2
2187 #     between 512 and 64M (since 1.4).
2189 # @buf-size: maximum amount of data in flight from source to target
2190 #     (since 1.4).
2192 # @on-source-error: the action to take on an error on the source,
2193 #     default 'report'.  'stop' and 'enospc' can only be used if the
2194 #     block device supports io-status (see BlockInfo).
2196 # @on-target-error: the action to take on an error on the target,
2197 #     default 'report' (no limitations, since this applies to a
2198 #     different block device than @device).
2200 # @unmap: Whether to try to unmap target sectors where source has only
2201 #     zero.  If true, and target unallocated sectors will read as
2202 #     zero, target image sectors will be unmapped; otherwise, zeroes
2203 #     will be written.  Both will result in identical contents.
2204 #     Default is true.  (Since 2.4)
2206 # @copy-mode: when to copy data to the destination; defaults to
2207 #     'background' (Since: 3.0)
2209 # @auto-finalize: When false, this job will wait in a PENDING state
2210 #     after it has finished its work, waiting for @block-job-finalize
2211 #     before making any block graph changes.  When true, this job will
2212 #     automatically perform its abort or commit actions.  Defaults to
2213 #     true.  (Since 3.1)
2215 # @auto-dismiss: When false, this job will wait in a CONCLUDED state
2216 #     after it has completely ceased all work, and awaits
2217 #     @block-job-dismiss.  When true, this job will automatically
2218 #     disappear from the query list without user intervention.
2219 #     Defaults to true.  (Since 3.1)
2221 # Since: 1.3
2223 { 'struct': 'DriveMirror',
2224   'data': { '*job-id': 'str', 'device': 'str', 'target': 'str',
2225             '*format': 'str', '*node-name': 'str', '*replaces': 'str',
2226             'sync': 'MirrorSyncMode', '*mode': 'NewImageMode',
2227             '*speed': 'int', '*granularity': 'uint32',
2228             '*buf-size': 'int', '*on-source-error': 'BlockdevOnError',
2229             '*on-target-error': 'BlockdevOnError',
2230             '*unmap': 'bool', '*copy-mode': 'MirrorCopyMode',
2231             '*auto-finalize': 'bool', '*auto-dismiss': 'bool' } }
2234 # @BlockDirtyBitmap:
2236 # @node: name of device/node which the bitmap is tracking
2238 # @name: name of the dirty bitmap
2240 # Since: 2.4
2242 { 'struct': 'BlockDirtyBitmap',
2243   'data': { 'node': 'str', 'name': 'str' } }
2246 # @BlockDirtyBitmapAdd:
2248 # @node: name of device/node which the bitmap is tracking
2250 # @name: name of the dirty bitmap (must be less than 1024 bytes)
2252 # @granularity: the bitmap granularity, default is 64k for
2253 #     block-dirty-bitmap-add
2255 # @persistent: the bitmap is persistent, i.e. it will be saved to the
2256 #     corresponding block device image file on its close.  For now
2257 #     only Qcow2 disks support persistent bitmaps.  Default is false
2258 #     for block-dirty-bitmap-add.  (Since: 2.10)
2260 # @disabled: the bitmap is created in the disabled state, which means
2261 #     that it will not track drive changes.  The bitmap may be enabled
2262 #     with block-dirty-bitmap-enable.  Default is false.  (Since: 4.0)
2264 # Since: 2.4
2266 { 'struct': 'BlockDirtyBitmapAdd',
2267   'data': { 'node': 'str', 'name': 'str', '*granularity': 'uint32',
2268             '*persistent': 'bool', '*disabled': 'bool' } }
2271 # @BlockDirtyBitmapOrStr:
2273 # @local: name of the bitmap, attached to the same node as target
2274 #     bitmap.
2276 # @external: bitmap with specified node
2278 # Since: 4.1
2280 { 'alternate': 'BlockDirtyBitmapOrStr',
2281   'data': { 'local': 'str',
2282             'external': 'BlockDirtyBitmap' } }
2285 # @BlockDirtyBitmapMerge:
2287 # @node: name of device/node which the @target bitmap is tracking
2289 # @target: name of the destination dirty bitmap
2291 # @bitmaps: name(s) of the source dirty bitmap(s) at @node and/or
2292 #     fully specified BlockDirtyBitmap elements.  The latter are
2293 #     supported since 4.1.
2295 # Since: 4.0
2297 { 'struct': 'BlockDirtyBitmapMerge',
2298   'data': { 'node': 'str', 'target': 'str',
2299             'bitmaps': ['BlockDirtyBitmapOrStr'] } }
2302 # @block-dirty-bitmap-add:
2304 # Create a dirty bitmap with a name on the node, and start tracking
2305 # the writes.
2307 # Returns:
2308 #     - nothing on success
2309 #     - If @node is not a valid block device or node, DeviceNotFound
2310 #     - If @name is already taken, GenericError with an explanation
2312 # Since: 2.4
2314 # Example:
2316 # -> { "execute": "block-dirty-bitmap-add",
2317 #      "arguments": { "node": "drive0", "name": "bitmap0" } }
2318 # <- { "return": {} }
2320 { 'command': 'block-dirty-bitmap-add',
2321   'data': 'BlockDirtyBitmapAdd',
2322   'allow-preconfig': true }
2325 # @block-dirty-bitmap-remove:
2327 # Stop write tracking and remove the dirty bitmap that was created
2328 # with block-dirty-bitmap-add.  If the bitmap is persistent, remove it
2329 # from its storage too.
2331 # Returns:
2332 #     - nothing on success
2333 #     - If @node is not a valid block device or node, DeviceNotFound
2334 #     - If @name is not found, GenericError with an explanation
2335 #     - if @name is frozen by an operation, GenericError
2337 # Since: 2.4
2339 # Example:
2341 # -> { "execute": "block-dirty-bitmap-remove",
2342 #      "arguments": { "node": "drive0", "name": "bitmap0" } }
2343 # <- { "return": {} }
2345 { 'command': 'block-dirty-bitmap-remove',
2346   'data': 'BlockDirtyBitmap',
2347   'allow-preconfig': true }
2350 # @block-dirty-bitmap-clear:
2352 # Clear (reset) a dirty bitmap on the device, so that an incremental
2353 # backup from this point in time forward will only backup clusters
2354 # modified after this clear operation.
2356 # Returns:
2357 #     - nothing on success
2358 #     - If @node is not a valid block device, DeviceNotFound
2359 #     - If @name is not found, GenericError with an explanation
2361 # Since: 2.4
2363 # Example:
2365 # -> { "execute": "block-dirty-bitmap-clear",
2366 #      "arguments": { "node": "drive0", "name": "bitmap0" } }
2367 # <- { "return": {} }
2369 { 'command': 'block-dirty-bitmap-clear',
2370   'data': 'BlockDirtyBitmap',
2371   'allow-preconfig': true }
2374 # @block-dirty-bitmap-enable:
2376 # Enables a dirty bitmap so that it will begin tracking disk changes.
2378 # Returns:
2379 #     - nothing on success
2380 #     - If @node is not a valid block device, DeviceNotFound
2381 #     - If @name is not found, GenericError with an explanation
2383 # Since: 4.0
2385 # Example:
2387 # -> { "execute": "block-dirty-bitmap-enable",
2388 #      "arguments": { "node": "drive0", "name": "bitmap0" } }
2389 # <- { "return": {} }
2391 { 'command': 'block-dirty-bitmap-enable',
2392   'data': 'BlockDirtyBitmap',
2393   'allow-preconfig': true }
2396 # @block-dirty-bitmap-disable:
2398 # Disables a dirty bitmap so that it will stop tracking disk changes.
2400 # Returns:
2401 #     - nothing on success
2402 #     - If @node is not a valid block device, DeviceNotFound
2403 #     - If @name is not found, GenericError with an explanation
2405 # Since: 4.0
2407 # Example:
2409 # -> { "execute": "block-dirty-bitmap-disable",
2410 #      "arguments": { "node": "drive0", "name": "bitmap0" } }
2411 # <- { "return": {} }
2413 { 'command': 'block-dirty-bitmap-disable',
2414   'data': 'BlockDirtyBitmap',
2415   'allow-preconfig': true }
2418 # @block-dirty-bitmap-merge:
2420 # Merge dirty bitmaps listed in @bitmaps to the @target dirty bitmap.
2421 # Dirty bitmaps in @bitmaps will be unchanged, except if it also
2422 # appears as the @target bitmap.  Any bits already set in @target will
2423 # still be set after the merge, i.e., this operation does not clear
2424 # the target.  On error, @target is unchanged.
2426 # The resulting bitmap will count as dirty any clusters that were
2427 # dirty in any of the source bitmaps.  This can be used to achieve
2428 # backup checkpoints, or in simpler usages, to copy bitmaps.
2430 # Returns:
2431 #     - nothing on success
2432 #     - If @node is not a valid block device, DeviceNotFound
2433 #     - If any bitmap in @bitmaps or @target is not found,
2434 #       GenericError
2435 #     - If any of the bitmaps have different sizes or granularities,
2436 #       GenericError
2438 # Since: 4.0
2440 # Example:
2442 # -> { "execute": "block-dirty-bitmap-merge",
2443 #      "arguments": { "node": "drive0", "target": "bitmap0",
2444 #                     "bitmaps": ["bitmap1"] } }
2445 # <- { "return": {} }
2447 { 'command': 'block-dirty-bitmap-merge',
2448   'data': 'BlockDirtyBitmapMerge',
2449   'allow-preconfig': true }
2452 # @BlockDirtyBitmapSha256:
2454 # SHA256 hash of dirty bitmap data
2456 # @sha256: ASCII representation of SHA256 bitmap hash
2458 # Since: 2.10
2460 { 'struct': 'BlockDirtyBitmapSha256',
2461   'data': {'sha256': 'str'} }
2464 # @x-debug-block-dirty-bitmap-sha256:
2466 # Get bitmap SHA256.
2468 # Features:
2470 # @unstable: This command is meant for debugging.
2472 # Returns:
2473 #     - BlockDirtyBitmapSha256 on success
2474 #     - If @node is not a valid block device, DeviceNotFound
2475 #     - If @name is not found or if hashing has failed, GenericError
2476 #       with an explanation
2478 # Since: 2.10
2480 { 'command': 'x-debug-block-dirty-bitmap-sha256',
2481   'data': 'BlockDirtyBitmap', 'returns': 'BlockDirtyBitmapSha256',
2482   'features': [ 'unstable' ],
2483   'allow-preconfig': true }
2486 # @blockdev-mirror:
2488 # Start mirroring a block device's writes to a new destination.
2490 # @job-id: identifier for the newly-created block job.  If omitted,
2491 #     the device name will be used.  (Since 2.7)
2493 # @device: The device name or node-name of a root node whose writes
2494 #     should be mirrored.
2496 # @target: the id or node-name of the block device to mirror to.  This
2497 #     mustn't be attached to guest.
2499 # @replaces: with sync=full graph node name to be replaced by the new
2500 #     image when a whole image copy is done.  This can be used to
2501 #     repair broken Quorum files.  By default, @device is replaced,
2502 #     although implicitly created filters on it are kept.
2504 # @speed: the maximum speed, in bytes per second
2506 # @sync: what parts of the disk image should be copied to the
2507 #     destination (all the disk, only the sectors allocated in the
2508 #     topmost image, or only new I/O).
2510 # @granularity: granularity of the dirty bitmap, default is 64K if the
2511 #     image format doesn't have clusters, 4K if the clusters are
2512 #     smaller than that, else the cluster size.  Must be a power of 2
2513 #     between 512 and 64M
2515 # @buf-size: maximum amount of data in flight from source to target
2517 # @on-source-error: the action to take on an error on the source,
2518 #     default 'report'.  'stop' and 'enospc' can only be used if the
2519 #     block device supports io-status (see BlockInfo).
2521 # @on-target-error: the action to take on an error on the target,
2522 #     default 'report' (no limitations, since this applies to a
2523 #     different block device than @device).
2525 # @filter-node-name: the node name that should be assigned to the
2526 #     filter driver that the mirror job inserts into the graph above
2527 #     @device.  If this option is not given, a node name is
2528 #     autogenerated.  (Since: 2.9)
2530 # @copy-mode: when to copy data to the destination; defaults to
2531 #     'background' (Since: 3.0)
2533 # @auto-finalize: When false, this job will wait in a PENDING state
2534 #     after it has finished its work, waiting for @block-job-finalize
2535 #     before making any block graph changes.  When true, this job will
2536 #     automatically perform its abort or commit actions.  Defaults to
2537 #     true.  (Since 3.1)
2539 # @auto-dismiss: When false, this job will wait in a CONCLUDED state
2540 #     after it has completely ceased all work, and awaits
2541 #     @block-job-dismiss.  When true, this job will automatically
2542 #     disappear from the query list without user intervention.
2543 #     Defaults to true.  (Since 3.1)
2545 # Returns: nothing on success.
2547 # Since: 2.6
2549 # Example:
2551 # -> { "execute": "blockdev-mirror",
2552 #      "arguments": { "device": "ide-hd0",
2553 #                     "target": "target0",
2554 #                     "sync": "full" } }
2555 # <- { "return": {} }
2557 { 'command': 'blockdev-mirror',
2558   'data': { '*job-id': 'str', 'device': 'str', 'target': 'str',
2559             '*replaces': 'str',
2560             'sync': 'MirrorSyncMode',
2561             '*speed': 'int', '*granularity': 'uint32',
2562             '*buf-size': 'int', '*on-source-error': 'BlockdevOnError',
2563             '*on-target-error': 'BlockdevOnError',
2564             '*filter-node-name': 'str',
2565             '*copy-mode': 'MirrorCopyMode',
2566             '*auto-finalize': 'bool', '*auto-dismiss': 'bool' },
2567   'allow-preconfig': true }
2570 # @BlockIOThrottle:
2572 # A set of parameters describing block throttling.
2574 # @device: Block device name
2576 # @id: The name or QOM path of the guest device (since: 2.8)
2578 # @bps: total throughput limit in bytes per second
2580 # @bps_rd: read throughput limit in bytes per second
2582 # @bps_wr: write throughput limit in bytes per second
2584 # @iops: total I/O operations per second
2586 # @iops_rd: read I/O operations per second
2588 # @iops_wr: write I/O operations per second
2590 # @bps_max: total throughput limit during bursts, in bytes (Since 1.7)
2592 # @bps_rd_max: read throughput limit during bursts, in bytes (Since
2593 #     1.7)
2595 # @bps_wr_max: write throughput limit during bursts, in bytes (Since
2596 #     1.7)
2598 # @iops_max: total I/O operations per second during bursts, in bytes
2599 #     (Since 1.7)
2601 # @iops_rd_max: read I/O operations per second during bursts, in bytes
2602 #     (Since 1.7)
2604 # @iops_wr_max: write I/O operations per second during bursts, in
2605 #     bytes (Since 1.7)
2607 # @bps_max_length: maximum length of the @bps_max burst period, in
2608 #     seconds.  It must only be set if @bps_max is set as well.
2609 #     Defaults to 1. (Since 2.6)
2611 # @bps_rd_max_length: maximum length of the @bps_rd_max burst period,
2612 #     in seconds.  It must only be set if @bps_rd_max is set as well.
2613 #     Defaults to 1. (Since 2.6)
2615 # @bps_wr_max_length: maximum length of the @bps_wr_max burst period,
2616 #     in seconds.  It must only be set if @bps_wr_max is set as well.
2617 #     Defaults to 1. (Since 2.6)
2619 # @iops_max_length: maximum length of the @iops burst period, in
2620 #     seconds.  It must only be set if @iops_max is set as well.
2621 #     Defaults to 1. (Since 2.6)
2623 # @iops_rd_max_length: maximum length of the @iops_rd_max burst
2624 #     period, in seconds.  It must only be set if @iops_rd_max is set
2625 #     as well.  Defaults to 1. (Since 2.6)
2627 # @iops_wr_max_length: maximum length of the @iops_wr_max burst
2628 #     period, in seconds.  It must only be set if @iops_wr_max is set
2629 #     as well.  Defaults to 1. (Since 2.6)
2631 # @iops_size: an I/O size in bytes (Since 1.7)
2633 # @group: throttle group name (Since 2.4)
2635 # Features:
2637 # @deprecated: Member @device is deprecated.  Use @id instead.
2639 # Since: 1.1
2641 { 'struct': 'BlockIOThrottle',
2642   'data': { '*device': { 'type': 'str', 'features': [ 'deprecated' ] },
2643             '*id': 'str', 'bps': 'int', 'bps_rd': 'int',
2644             'bps_wr': 'int', 'iops': 'int', 'iops_rd': 'int', 'iops_wr': 'int',
2645             '*bps_max': 'int', '*bps_rd_max': 'int',
2646             '*bps_wr_max': 'int', '*iops_max': 'int',
2647             '*iops_rd_max': 'int', '*iops_wr_max': 'int',
2648             '*bps_max_length': 'int', '*bps_rd_max_length': 'int',
2649             '*bps_wr_max_length': 'int', '*iops_max_length': 'int',
2650             '*iops_rd_max_length': 'int', '*iops_wr_max_length': 'int',
2651             '*iops_size': 'int', '*group': 'str' } }
2654 # @ThrottleLimits:
2656 # Limit parameters for throttling.  Since some limit combinations are
2657 # illegal, limits should always be set in one transaction.  All fields
2658 # are optional.  When setting limits, if a field is missing the
2659 # current value is not changed.
2661 # @iops-total: limit total I/O operations per second
2663 # @iops-total-max: I/O operations burst
2665 # @iops-total-max-length: length of the iops-total-max burst period,
2666 #     in seconds It must only be set if @iops-total-max is set as
2667 #     well.
2669 # @iops-read: limit read operations per second
2671 # @iops-read-max: I/O operations read burst
2673 # @iops-read-max-length: length of the iops-read-max burst period, in
2674 #     seconds It must only be set if @iops-read-max is set as well.
2676 # @iops-write: limit write operations per second
2678 # @iops-write-max: I/O operations write burst
2680 # @iops-write-max-length: length of the iops-write-max burst period,
2681 #     in seconds It must only be set if @iops-write-max is set as
2682 #     well.
2684 # @bps-total: limit total bytes per second
2686 # @bps-total-max: total bytes burst
2688 # @bps-total-max-length: length of the bps-total-max burst period, in
2689 #     seconds.  It must only be set if @bps-total-max is set as well.
2691 # @bps-read: limit read bytes per second
2693 # @bps-read-max: total bytes read burst
2695 # @bps-read-max-length: length of the bps-read-max burst period, in
2696 #     seconds It must only be set if @bps-read-max is set as well.
2698 # @bps-write: limit write bytes per second
2700 # @bps-write-max: total bytes write burst
2702 # @bps-write-max-length: length of the bps-write-max burst period, in
2703 #     seconds It must only be set if @bps-write-max is set as well.
2705 # @iops-size: when limiting by iops max size of an I/O in bytes
2707 # Since: 2.11
2709 { 'struct': 'ThrottleLimits',
2710   'data': { '*iops-total' : 'int', '*iops-total-max' : 'int',
2711             '*iops-total-max-length' : 'int', '*iops-read' : 'int',
2712             '*iops-read-max' : 'int', '*iops-read-max-length' : 'int',
2713             '*iops-write' : 'int', '*iops-write-max' : 'int',
2714             '*iops-write-max-length' : 'int', '*bps-total' : 'int',
2715             '*bps-total-max' : 'int', '*bps-total-max-length' : 'int',
2716             '*bps-read' : 'int', '*bps-read-max' : 'int',
2717             '*bps-read-max-length' : 'int', '*bps-write' : 'int',
2718             '*bps-write-max' : 'int', '*bps-write-max-length' : 'int',
2719             '*iops-size' : 'int' } }
2722 # @ThrottleGroupProperties:
2724 # Properties for throttle-group objects.
2726 # @limits: limits to apply for this throttle group
2728 # Features:
2730 # @unstable: All members starting with x- are aliases for the same key
2731 #     without x- in the @limits object.  This is not a stable
2732 #     interface and may be removed or changed incompatibly in the
2733 #     future.  Use @limits for a supported stable interface.
2735 # Since: 2.11
2737 { 'struct': 'ThrottleGroupProperties',
2738   'data': { '*limits': 'ThrottleLimits',
2739             '*x-iops-total': { 'type': 'int',
2740                                'features': [ 'unstable' ] },
2741             '*x-iops-total-max': { 'type': 'int',
2742                                    'features': [ 'unstable' ] },
2743             '*x-iops-total-max-length': { 'type': 'int',
2744                                           'features': [ 'unstable' ] },
2745             '*x-iops-read': { 'type': 'int',
2746                               'features': [ 'unstable' ] },
2747             '*x-iops-read-max': { 'type': 'int',
2748                                   'features': [ 'unstable' ] },
2749             '*x-iops-read-max-length': { 'type': 'int',
2750                                          'features': [ 'unstable' ] },
2751             '*x-iops-write': { 'type': 'int',
2752                                'features': [ 'unstable' ] },
2753             '*x-iops-write-max': { 'type': 'int',
2754                                    'features': [ 'unstable' ] },
2755             '*x-iops-write-max-length': { 'type': 'int',
2756                                           'features': [ 'unstable' ] },
2757             '*x-bps-total': { 'type': 'int',
2758                               'features': [ 'unstable' ] },
2759             '*x-bps-total-max': { 'type': 'int',
2760                                   'features': [ 'unstable' ] },
2761             '*x-bps-total-max-length': { 'type': 'int',
2762                                          'features': [ 'unstable' ] },
2763             '*x-bps-read': { 'type': 'int',
2764                              'features': [ 'unstable' ] },
2765             '*x-bps-read-max': { 'type': 'int',
2766                                  'features': [ 'unstable' ] },
2767             '*x-bps-read-max-length': { 'type': 'int',
2768                                         'features': [ 'unstable' ] },
2769             '*x-bps-write': { 'type': 'int',
2770                               'features': [ 'unstable' ] },
2771             '*x-bps-write-max': { 'type': 'int',
2772                                   'features': [ 'unstable' ] },
2773             '*x-bps-write-max-length': { 'type': 'int',
2774                                          'features': [ 'unstable' ] },
2775             '*x-iops-size': { 'type': 'int',
2776                               'features': [ 'unstable' ] } } }
2779 # @block-stream:
2781 # Copy data from a backing file into a block device.
2783 # The block streaming operation is performed in the background until
2784 # the entire backing file has been copied.  This command returns
2785 # immediately once streaming has started.  The status of ongoing block
2786 # streaming operations can be checked with query-block-jobs.  The
2787 # operation can be stopped before it has completed using the
2788 # block-job-cancel command.
2790 # The node that receives the data is called the top image, can be
2791 # located in any part of the chain (but always above the base image;
2792 # see below) and can be specified using its device or node name.
2793 # Earlier qemu versions only allowed 'device' to name the top level
2794 # node; presence of the 'base-node' parameter during introspection can
2795 # be used as a witness of the enhanced semantics of 'device'.
2797 # If a base file is specified then sectors are not copied from that
2798 # base file and its backing chain.  This can be used to stream a
2799 # subset of the backing file chain instead of flattening the entire
2800 # image.  When streaming completes the image file will have the base
2801 # file as its backing file, unless that node was changed while the job
2802 # was running.  In that case, base's parent's backing (or filtered,
2803 # whichever exists) child (i.e., base at the beginning of the job)
2804 # will be the new backing file.
2806 # On successful completion the image file is updated to drop the
2807 # backing file and the BLOCK_JOB_COMPLETED event is emitted.
2809 # In case @device is a filter node, block-stream modifies the first
2810 # non-filter overlay node below it to point to the new backing node
2811 # instead of modifying @device itself.
2813 # @job-id: identifier for the newly-created block job.  If omitted,
2814 #     the device name will be used.  (Since 2.7)
2816 # @device: the device or node name of the top image
2818 # @base: the common backing file name.  It cannot be set if @base-node
2819 #     or @bottom is also set.
2821 # @base-node: the node name of the backing file.  It cannot be set if
2822 #     @base or @bottom is also set.  (Since 2.8)
2824 # @bottom: the last node in the chain that should be streamed into
2825 #     top.  It cannot be set if @base or @base-node is also set.  It
2826 #     cannot be filter node.  (Since 6.0)
2828 # @backing-file: The backing file string to write into the top image.
2829 #     This filename is not validated.
2831 #     If a pathname string is such that it cannot be resolved by QEMU,
2832 #     that means that subsequent QMP or HMP commands must use
2833 #     node-names for the image in question, as filename lookup methods
2834 #     will fail.
2836 #     If not specified, QEMU will automatically determine the backing
2837 #     file string to use, or error out if there is no obvious choice.
2838 #     Care should be taken when specifying the string, to specify a
2839 #     valid filename or protocol.  (Since 2.1)
2841 # @backing-mask-protocol: If true, replace any protocol mentioned in the
2842 #     'backing file format' with 'raw', rather than storing the protocol
2843 #     name as the backing format.  Can be used even when no image header
2844 #     will be updated (default false; since 9.0).
2846 # @speed: the maximum speed, in bytes per second
2848 # @on-error: the action to take on an error (default report). 'stop'
2849 #     and 'enospc' can only be used if the block device supports
2850 #     io-status (see BlockInfo).  (Since 1.3)
2852 # @filter-node-name: the node name that should be assigned to the
2853 #     filter driver that the stream job inserts into the graph above
2854 #     @device.  If this option is not given, a node name is
2855 #     autogenerated.  (Since: 6.0)
2857 # @auto-finalize: When false, this job will wait in a PENDING state
2858 #     after it has finished its work, waiting for @block-job-finalize
2859 #     before making any block graph changes.  When true, this job will
2860 #     automatically perform its abort or commit actions.  Defaults to
2861 #     true.  (Since 3.1)
2863 # @auto-dismiss: When false, this job will wait in a CONCLUDED state
2864 #     after it has completely ceased all work, and awaits
2865 #     @block-job-dismiss.  When true, this job will automatically
2866 #     disappear from the query list without user intervention.
2867 #     Defaults to true.  (Since 3.1)
2869 # Returns:
2870 #     - Nothing on success.
2871 #     - If @device does not exist, DeviceNotFound.
2873 # Since: 1.1
2875 # Example:
2877 # -> { "execute": "block-stream",
2878 #      "arguments": { "device": "virtio0",
2879 #                     "base": "/tmp/master.qcow2" } }
2880 # <- { "return": {} }
2882 { 'command': 'block-stream',
2883   'data': { '*job-id': 'str', 'device': 'str', '*base': 'str',
2884             '*base-node': 'str', '*backing-file': 'str',
2885             '*backing-mask-protocol': 'bool',
2886             '*bottom': 'str',
2887             '*speed': 'int', '*on-error': 'BlockdevOnError',
2888             '*filter-node-name': 'str',
2889             '*auto-finalize': 'bool', '*auto-dismiss': 'bool' },
2890   'allow-preconfig': true }
2893 # @block-job-set-speed:
2895 # Set maximum speed for a background block operation.
2897 # This command can only be issued when there is an active block job.
2899 # Throttling can be disabled by setting the speed to 0.
2901 # @device: The job identifier.  This used to be a device name (hence
2902 #     the name of the parameter), but since QEMU 2.7 it can have other
2903 #     values.
2905 # @speed: the maximum speed, in bytes per second, or 0 for unlimited.
2906 #     Defaults to 0.
2908 # Returns:
2909 #     - Nothing on success
2910 #     - If no background operation is active on this device,
2911 #       DeviceNotActive
2913 # Since: 1.1
2915 { 'command': 'block-job-set-speed',
2916   'data': { 'device': 'str', 'speed': 'int' },
2917   'allow-preconfig': true }
2920 # @block-job-cancel:
2922 # Stop an active background block operation.
2924 # This command returns immediately after marking the active background
2925 # block operation for cancellation.  It is an error to call this
2926 # command if no operation is in progress.
2928 # The operation will cancel as soon as possible and then emit the
2929 # BLOCK_JOB_CANCELLED event.  Before that happens the job is still
2930 # visible when enumerated using query-block-jobs.
2932 # Note that if you issue 'block-job-cancel' after 'drive-mirror' has
2933 # indicated (via the event BLOCK_JOB_READY) that the source and
2934 # destination are synchronized, then the event triggered by this
2935 # command changes to BLOCK_JOB_COMPLETED, to indicate that the
2936 # mirroring has ended and the destination now has a point-in-time copy
2937 # tied to the time of the cancellation.
2939 # For streaming, the image file retains its backing file unless the
2940 # streaming operation happens to complete just as it is being
2941 # cancelled.  A new streaming operation can be started at a later time
2942 # to finish copying all data from the backing file.
2944 # @device: The job identifier.  This used to be a device name (hence
2945 #     the name of the parameter), but since QEMU 2.7 it can have other
2946 #     values.
2948 # @force: If true, and the job has already emitted the event
2949 #     BLOCK_JOB_READY, abandon the job immediately (even if it is
2950 #     paused) instead of waiting for the destination to complete its
2951 #     final synchronization (since 1.3)
2953 # Returns:
2954 #     - Nothing on success
2955 #     - If no background operation is active on this device,
2956 #       DeviceNotActive
2958 # Since: 1.1
2960 { 'command': 'block-job-cancel', 'data': { 'device': 'str', '*force': 'bool' },
2961   'allow-preconfig': true }
2964 # @block-job-pause:
2966 # Pause an active background block operation.
2968 # This command returns immediately after marking the active background
2969 # block operation for pausing.  It is an error to call this command if
2970 # no operation is in progress or if the job is already paused.
2972 # The operation will pause as soon as possible.  No event is emitted
2973 # when the operation is actually paused.  Cancelling a paused job
2974 # automatically resumes it.
2976 # @device: The job identifier.  This used to be a device name (hence
2977 #     the name of the parameter), but since QEMU 2.7 it can have other
2978 #     values.
2980 # Returns:
2981 #     - Nothing on success
2982 #     - If no background operation is active on this device,
2983 #       DeviceNotActive
2985 # Since: 1.3
2987 { 'command': 'block-job-pause', 'data': { 'device': 'str' },
2988   'allow-preconfig': true }
2991 # @block-job-resume:
2993 # Resume an active background block operation.
2995 # This command returns immediately after resuming a paused background
2996 # block operation.  It is an error to call this command if no
2997 # operation is in progress or if the job is not paused.
2999 # This command also clears the error status of the job.
3001 # @device: The job identifier.  This used to be a device name (hence
3002 #     the name of the parameter), but since QEMU 2.7 it can have other
3003 #     values.
3005 # Returns:
3006 #     - Nothing on success
3007 #     - If no background operation is active on this device,
3008 #       DeviceNotActive
3010 # Since: 1.3
3012 { 'command': 'block-job-resume', 'data': { 'device': 'str' },
3013   'allow-preconfig': true }
3016 # @block-job-complete:
3018 # Manually trigger completion of an active background block operation.
3019 # This is supported for drive mirroring, where it also switches the
3020 # device to write to the target path only.  The ability to complete is
3021 # signaled with a BLOCK_JOB_READY event.
3023 # This command completes an active background block operation
3024 # synchronously.  The ordering of this command's return with the
3025 # BLOCK_JOB_COMPLETED event is not defined.  Note that if an I/O error
3026 # occurs during the processing of this command: 1) the command itself
3027 # will fail; 2) the error will be processed according to the
3028 # rerror/werror arguments that were specified when starting the
3029 # operation.
3031 # A cancelled or paused job cannot be completed.
3033 # @device: The job identifier.  This used to be a device name (hence
3034 #     the name of the parameter), but since QEMU 2.7 it can have other
3035 #     values.
3037 # Returns:
3038 #     - Nothing on success
3039 #     - If no background operation is active on this device,
3040 #       DeviceNotActive
3042 # Since: 1.3
3044 { 'command': 'block-job-complete', 'data': { 'device': 'str' },
3045   'allow-preconfig': true }
3048 # @block-job-dismiss:
3050 # For jobs that have already concluded, remove them from the
3051 # block-job-query list.  This command only needs to be run for jobs
3052 # which were started with QEMU 2.12+ job lifetime management
3053 # semantics.
3055 # This command will refuse to operate on any job that has not yet
3056 # reached its terminal state, JOB_STATUS_CONCLUDED. For jobs that make
3057 # use of the BLOCK_JOB_READY event, block-job-cancel or
3058 # block-job-complete will still need to be used as appropriate.
3060 # @id: The job identifier.
3062 # Returns: Nothing on success
3064 # Since: 2.12
3066 { 'command': 'block-job-dismiss', 'data': { 'id': 'str' },
3067   'allow-preconfig': true }
3070 # @block-job-finalize:
3072 # Once a job that has manual=true reaches the pending state, it can be
3073 # instructed to finalize any graph changes and do any necessary
3074 # cleanup via this command.  For jobs in a transaction, instructing
3075 # one job to finalize will force ALL jobs in the transaction to
3076 # finalize, so it is only necessary to instruct a single member job to
3077 # finalize.
3079 # @id: The job identifier.
3081 # Returns: Nothing on success
3083 # Since: 2.12
3085 { 'command': 'block-job-finalize', 'data': { 'id': 'str' },
3086   'allow-preconfig': true }
3089 # @BlockJobChangeOptionsMirror:
3091 # @copy-mode: Switch to this copy mode.  Currently, only the switch
3092 #     from 'background' to 'write-blocking' is implemented.
3094 # Since: 8.2
3096 { 'struct': 'BlockJobChangeOptionsMirror',
3097   'data': { 'copy-mode' : 'MirrorCopyMode' } }
3100 # @BlockJobChangeOptions:
3102 # Block job options that can be changed after job creation.
3104 # @id: The job identifier
3106 # @type: The job type
3108 # Since: 8.2
3110 { 'union': 'BlockJobChangeOptions',
3111   'base': { 'id': 'str', 'type': 'JobType' },
3112   'discriminator': 'type',
3113   'data': { 'mirror': 'BlockJobChangeOptionsMirror' } }
3116 # @block-job-change:
3118 # Change the block job's options.
3120 # Since: 8.2
3122 { 'command': 'block-job-change',
3123   'data': 'BlockJobChangeOptions', 'boxed': true }
3126 # @BlockdevDiscardOptions:
3128 # Determines how to handle discard requests.
3130 # @ignore: Ignore the request
3132 # @unmap: Forward as an unmap request
3134 # Since: 2.9
3136 { 'enum': 'BlockdevDiscardOptions',
3137   'data': [ 'ignore', 'unmap' ] }
3140 # @BlockdevDetectZeroesOptions:
3142 # Describes the operation mode for the automatic conversion of plain
3143 # zero writes by the OS to driver specific optimized zero write
3144 # commands.
3146 # @off: Disabled (default)
3148 # @on: Enabled
3150 # @unmap: Enabled and even try to unmap blocks if possible.  This
3151 #     requires also that @BlockdevDiscardOptions is set to unmap for
3152 #     this device.
3154 # Since: 2.1
3156 { 'enum': 'BlockdevDetectZeroesOptions',
3157   'data': [ 'off', 'on', 'unmap' ] }
3160 # @BlockdevAioOptions:
3162 # Selects the AIO backend to handle I/O requests
3164 # @threads: Use qemu's thread pool
3166 # @native: Use native AIO backend (only Linux and Windows)
3168 # @io_uring: Use linux io_uring (since 5.0)
3170 # Since: 2.9
3172 { 'enum': 'BlockdevAioOptions',
3173   'data': [ 'threads', 'native',
3174             { 'name': 'io_uring', 'if': 'CONFIG_LINUX_IO_URING' } ] }
3177 # @BlockdevCacheOptions:
3179 # Includes cache-related options for block devices
3181 # @direct: enables use of O_DIRECT (bypass the host page cache;
3182 #     default: false)
3184 # @no-flush: ignore any flush requests for the device (default: false)
3186 # Since: 2.9
3188 { 'struct': 'BlockdevCacheOptions',
3189   'data': { '*direct': 'bool',
3190             '*no-flush': 'bool' } }
3193 # @BlockdevDriver:
3195 # Drivers that are supported in block device operations.
3197 # @throttle: Since 2.11
3199 # @nvme: Since 2.12
3201 # @copy-on-read: Since 3.0
3203 # @blklogwrites: Since 3.0
3205 # @blkreplay: Since 4.2
3207 # @compress: Since 5.0
3209 # @copy-before-write: Since 6.2
3211 # @snapshot-access: Since 7.0
3213 # Since: 2.9
3215 { 'enum': 'BlockdevDriver',
3216   'data': [ 'blkdebug', 'blklogwrites', 'blkreplay', 'blkverify', 'bochs',
3217             'cloop', 'compress', 'copy-before-write', 'copy-on-read', 'dmg',
3218             'file', 'snapshot-access', 'ftp', 'ftps', 'gluster',
3219             {'name': 'host_cdrom', 'if': 'HAVE_HOST_BLOCK_DEVICE' },
3220             {'name': 'host_device', 'if': 'HAVE_HOST_BLOCK_DEVICE' },
3221             'http', 'https',
3222             { 'name': 'io_uring', 'if': 'CONFIG_BLKIO' },
3223             'iscsi',
3224             'luks', 'nbd', 'nfs', 'null-aio', 'null-co', 'nvme',
3225             { 'name': 'nvme-io_uring', 'if': 'CONFIG_BLKIO' },
3226             'parallels', 'preallocate', 'qcow', 'qcow2', 'qed', 'quorum',
3227             'raw', 'rbd',
3228             { 'name': 'replication', 'if': 'CONFIG_REPLICATION' },
3229             'ssh', 'throttle', 'vdi', 'vhdx',
3230             { 'name': 'virtio-blk-vfio-pci', 'if': 'CONFIG_BLKIO' },
3231             { 'name': 'virtio-blk-vhost-user', 'if': 'CONFIG_BLKIO' },
3232             { 'name': 'virtio-blk-vhost-vdpa', 'if': 'CONFIG_BLKIO' },
3233             'vmdk', 'vpc', 'vvfat' ] }
3236 # @BlockdevOptionsFile:
3238 # Driver specific block device options for the file backend.
3240 # @filename: path to the image file
3242 # @pr-manager: the id for the object that will handle persistent
3243 #     reservations for this device (default: none, forward the
3244 #     commands via SG_IO; since 2.11)
3246 # @aio: AIO backend (default: threads) (since: 2.8)
3248 # @aio-max-batch: maximum number of requests to batch together into a
3249 #     single submission in the AIO backend.  The smallest value
3250 #     between this and the aio-max-batch value of the IOThread object
3251 #     is chosen.  0 means that the AIO backend will handle it
3252 #     automatically.  (default: 0, since 6.2)
3254 # @locking: whether to enable file locking.  If set to 'auto', only
3255 #     enable when Open File Descriptor (OFD) locking API is available
3256 #     (default: auto, since 2.10)
3258 # @drop-cache: invalidate page cache during live migration.  This
3259 #     prevents stale data on the migration destination with
3260 #     cache.direct=off.  Currently only supported on Linux hosts.
3261 #     (default: on, since: 4.0)
3263 # @x-check-cache-dropped: whether to check that page cache was dropped
3264 #     on live migration.  May cause noticeable delays if the image
3265 #     file is large, do not use in production.  (default: off)
3266 #     (since: 3.0)
3268 # Features:
3270 # @dynamic-auto-read-only: If present, enabled auto-read-only means
3271 #     that the driver will open the image read-only at first,
3272 #     dynamically reopen the image file read-write when the first
3273 #     writer is attached to the node and reopen read-only when the
3274 #     last writer is detached.  This allows giving QEMU write
3275 #     permissions only on demand when an operation actually needs
3276 #     write access.
3278 # @unstable: Member x-check-cache-dropped is meant for debugging.
3280 # Since: 2.9
3282 { 'struct': 'BlockdevOptionsFile',
3283   'data': { 'filename': 'str',
3284             '*pr-manager': 'str',
3285             '*locking': 'OnOffAuto',
3286             '*aio': 'BlockdevAioOptions',
3287             '*aio-max-batch': 'int',
3288             '*drop-cache': {'type': 'bool',
3289                             'if': 'CONFIG_LINUX'},
3290             '*x-check-cache-dropped': { 'type': 'bool',
3291                                         'features': [ 'unstable' ] } },
3292   'features': [ { 'name': 'dynamic-auto-read-only',
3293                   'if': 'CONFIG_POSIX' } ] }
3296 # @BlockdevOptionsNull:
3298 # Driver specific block device options for the null backend.
3300 # @size: size of the device in bytes.
3302 # @latency-ns: emulated latency (in nanoseconds) in processing
3303 #     requests.  Default to zero which completes requests immediately.
3304 #     (Since 2.4)
3306 # @read-zeroes: if true, reads from the device produce zeroes; if
3307 #     false, the buffer is left unchanged.
3308 #     (default: false; since: 4.1)
3310 # Since: 2.9
3312 { 'struct': 'BlockdevOptionsNull',
3313   'data': { '*size': 'int', '*latency-ns': 'uint64', '*read-zeroes': 'bool' } }
3316 # @BlockdevOptionsNVMe:
3318 # Driver specific block device options for the NVMe backend.
3320 # @device: PCI controller address of the NVMe device in format
3321 #     hhhh:bb:ss.f (host:bus:slot.function)
3323 # @namespace: namespace number of the device, starting from 1.
3325 # Note that the PCI @device must have been unbound from any host
3326 # kernel driver before instructing QEMU to add the blockdev.
3328 # Since: 2.12
3330 { 'struct': 'BlockdevOptionsNVMe',
3331   'data': { 'device': 'str', 'namespace': 'int' } }
3334 # @BlockdevOptionsVVFAT:
3336 # Driver specific block device options for the vvfat protocol.
3338 # @dir: directory to be exported as FAT image
3340 # @fat-type: FAT type: 12, 16 or 32
3342 # @floppy: whether to export a floppy image (true) or partitioned hard
3343 #     disk (false; default)
3345 # @label: set the volume label, limited to 11 bytes.  FAT16 and FAT32
3346 #     traditionally have some restrictions on labels, which are
3347 #     ignored by most operating systems.  Defaults to "QEMU VVFAT".
3348 #     (since 2.4)
3350 # @rw: whether to allow write operations (default: false)
3352 # Since: 2.9
3354 { 'struct': 'BlockdevOptionsVVFAT',
3355   'data': { 'dir': 'str', '*fat-type': 'int', '*floppy': 'bool',
3356             '*label': 'str', '*rw': 'bool' } }
3359 # @BlockdevOptionsGenericFormat:
3361 # Driver specific block device options for image format that have no
3362 # option besides their data source.
3364 # @file: reference to or definition of the data source block device
3366 # Since: 2.9
3368 { 'struct': 'BlockdevOptionsGenericFormat',
3369   'data': { 'file': 'BlockdevRef' } }
3372 # @BlockdevOptionsLUKS:
3374 # Driver specific block device options for LUKS.
3376 # @key-secret: the ID of a QCryptoSecret object providing the
3377 #     decryption key (since 2.6). Mandatory except when doing a
3378 #     metadata-only probe of the image.
3380 # @header: block device holding a detached LUKS header. (since 9.0)
3382 # Since: 2.9
3384 { 'struct': 'BlockdevOptionsLUKS',
3385   'base': 'BlockdevOptionsGenericFormat',
3386   'data': { '*key-secret': 'str',
3387             '*header': 'BlockdevRef'} }
3390 # @BlockdevOptionsGenericCOWFormat:
3392 # Driver specific block device options for image format that have no
3393 # option besides their data source and an optional backing file.
3395 # @backing: reference to or definition of the backing file block
3396 #     device, null disables the backing file entirely.  Defaults to
3397 #     the backing file stored the image file.
3399 # Since: 2.9
3401 { 'struct': 'BlockdevOptionsGenericCOWFormat',
3402   'base': 'BlockdevOptionsGenericFormat',
3403   'data': { '*backing': 'BlockdevRefOrNull' } }
3406 # @Qcow2OverlapCheckMode:
3408 # General overlap check modes.
3410 # @none: Do not perform any checks
3412 # @constant: Perform only checks which can be done in constant time
3413 #     and without reading anything from disk
3415 # @cached: Perform only checks which can be done without reading
3416 #     anything from disk
3418 # @all: Perform all available overlap checks
3420 # Since: 2.9
3422 { 'enum': 'Qcow2OverlapCheckMode',
3423   'data': [ 'none', 'constant', 'cached', 'all' ] }
3426 # @Qcow2OverlapCheckFlags:
3428 # Structure of flags for each metadata structure.  Setting a field to
3429 # 'true' makes qemu guard that structure against unintended
3430 # overwriting.  The default value is chosen according to the template
3431 # given.
3433 # @template: Specifies a template mode which can be adjusted using the
3434 #     other flags, defaults to 'cached'
3436 # @bitmap-directory: since 3.0
3438 # Since: 2.9
3440 { 'struct': 'Qcow2OverlapCheckFlags',
3441   'data': { '*template':         'Qcow2OverlapCheckMode',
3442             '*main-header':      'bool',
3443             '*active-l1':        'bool',
3444             '*active-l2':        'bool',
3445             '*refcount-table':   'bool',
3446             '*refcount-block':   'bool',
3447             '*snapshot-table':   'bool',
3448             '*inactive-l1':      'bool',
3449             '*inactive-l2':      'bool',
3450             '*bitmap-directory': 'bool' } }
3453 # @Qcow2OverlapChecks:
3455 # Specifies which metadata structures should be guarded against
3456 # unintended overwriting.
3458 # @flags: set of flags for separate specification of each metadata
3459 #     structure type
3461 # @mode: named mode which chooses a specific set of flags
3463 # Since: 2.9
3465 { 'alternate': 'Qcow2OverlapChecks',
3466   'data': { 'flags': 'Qcow2OverlapCheckFlags',
3467             'mode':  'Qcow2OverlapCheckMode' } }
3470 # @BlockdevQcowEncryptionFormat:
3472 # @aes: AES-CBC with plain64 initialization vectors
3474 # Since: 2.10
3476 { 'enum': 'BlockdevQcowEncryptionFormat',
3477   'data': [ 'aes' ] }
3480 # @BlockdevQcowEncryption:
3482 # @format: encryption format
3484 # Since: 2.10
3486 { 'union': 'BlockdevQcowEncryption',
3487   'base': { 'format': 'BlockdevQcowEncryptionFormat' },
3488   'discriminator': 'format',
3489   'data': { 'aes': 'QCryptoBlockOptionsQCow' } }
3492 # @BlockdevOptionsQcow:
3494 # Driver specific block device options for qcow.
3496 # @encrypt: Image decryption options.  Mandatory for encrypted images,
3497 #     except when doing a metadata-only probe of the image.
3499 # Since: 2.10
3501 { 'struct': 'BlockdevOptionsQcow',
3502   'base': 'BlockdevOptionsGenericCOWFormat',
3503   'data': { '*encrypt': 'BlockdevQcowEncryption' } }
3506 # @BlockdevQcow2EncryptionFormat:
3508 # @aes: AES-CBC with plain64 initialization vectors
3510 # Since: 2.10
3512 { 'enum': 'BlockdevQcow2EncryptionFormat',
3513   'data': [ 'aes', 'luks' ] }
3516 # @BlockdevQcow2Encryption:
3518 # @format: encryption format
3520 # Since: 2.10
3522 { 'union': 'BlockdevQcow2Encryption',
3523   'base': { 'format': 'BlockdevQcow2EncryptionFormat' },
3524   'discriminator': 'format',
3525   'data': { 'aes': 'QCryptoBlockOptionsQCow',
3526             'luks': 'QCryptoBlockOptionsLUKS'} }
3529 # @BlockdevOptionsPreallocate:
3531 # Filter driver intended to be inserted between format and protocol
3532 # node and do preallocation in protocol node on write.
3534 # @prealloc-align: on preallocation, align file length to this number,
3535 #     default 1048576 (1M)
3537 # @prealloc-size: how much to preallocate, default 134217728 (128M)
3539 # Since: 6.0
3541 { 'struct': 'BlockdevOptionsPreallocate',
3542   'base': 'BlockdevOptionsGenericFormat',
3543   'data': { '*prealloc-align': 'int', '*prealloc-size': 'int' } }
3546 # @BlockdevOptionsQcow2:
3548 # Driver specific block device options for qcow2.
3550 # @lazy-refcounts: whether to enable the lazy refcounts feature
3551 #     (default is taken from the image file)
3553 # @pass-discard-request: whether discard requests to the qcow2 device
3554 #     should be forwarded to the data source
3556 # @pass-discard-snapshot: whether discard requests for the data source
3557 #     should be issued when a snapshot operation (e.g. deleting a
3558 #     snapshot) frees clusters in the qcow2 file
3560 # @pass-discard-other: whether discard requests for the data source
3561 #     should be issued on other occasions where a cluster gets freed
3563 # @discard-no-unref: when enabled, data clusters will remain
3564 #     preallocated when they are no longer used, e.g. because they are
3565 #     discarded or converted to zero clusters.  As usual, whether the
3566 #     old data is discarded or kept on the protocol level (i.e. in the
3567 #     image file) depends on the setting of the pass-discard-request
3568 #     option.  Keeping the clusters preallocated prevents qcow2
3569 #     fragmentation that would otherwise be caused by freeing and
3570 #     re-allocating them later.  Besides potential performance
3571 #     degradation, such fragmentation can lead to increased allocation
3572 #     of clusters past the end of the image file, resulting in image
3573 #     files whose file length can grow much larger than their guest disk
3574 #     size would suggest.  If image file length is of concern (e.g. when
3575 #     storing qcow2 images directly on block devices), you should
3576 #     consider enabling this option.  (since 8.1)
3578 # @overlap-check: which overlap checks to perform for writes to the
3579 #     image, defaults to 'cached' (since 2.2)
3581 # @cache-size: the maximum total size of the L2 table and refcount
3582 #     block caches in bytes (since 2.2)
3584 # @l2-cache-size: the maximum size of the L2 table cache in bytes
3585 #     (since 2.2)
3587 # @l2-cache-entry-size: the size of each entry in the L2 cache in
3588 #     bytes.  It must be a power of two between 512 and the cluster
3589 #     size.  The default value is the cluster size (since 2.12)
3591 # @refcount-cache-size: the maximum size of the refcount block cache
3592 #     in bytes (since 2.2)
3594 # @cache-clean-interval: clean unused entries in the L2 and refcount
3595 #     caches.  The interval is in seconds.  The default value is 600
3596 #     on supporting platforms, and 0 on other platforms.  0 disables
3597 #     this feature.  (since 2.5)
3599 # @encrypt: Image decryption options.  Mandatory for encrypted images,
3600 #     except when doing a metadata-only probe of the image.  (since
3601 #     2.10)
3603 # @data-file: reference to or definition of the external data file.
3604 #     This may only be specified for images that require an external
3605 #     data file.  If it is not specified for such an image, the data
3606 #     file name is loaded from the image file.  (since 4.0)
3608 # Since: 2.9
3610 { 'struct': 'BlockdevOptionsQcow2',
3611   'base': 'BlockdevOptionsGenericCOWFormat',
3612   'data': { '*lazy-refcounts': 'bool',
3613             '*pass-discard-request': 'bool',
3614             '*pass-discard-snapshot': 'bool',
3615             '*pass-discard-other': 'bool',
3616             '*discard-no-unref': 'bool',
3617             '*overlap-check': 'Qcow2OverlapChecks',
3618             '*cache-size': 'int',
3619             '*l2-cache-size': 'int',
3620             '*l2-cache-entry-size': 'int',
3621             '*refcount-cache-size': 'int',
3622             '*cache-clean-interval': 'int',
3623             '*encrypt': 'BlockdevQcow2Encryption',
3624             '*data-file': 'BlockdevRef' } }
3627 # @SshHostKeyCheckMode:
3629 # @none: Don't check the host key at all
3631 # @hash: Compare the host key with a given hash
3633 # @known_hosts: Check the host key against the known_hosts file
3635 # Since: 2.12
3637 { 'enum': 'SshHostKeyCheckMode',
3638   'data': [ 'none', 'hash', 'known_hosts' ] }
3641 # @SshHostKeyCheckHashType:
3643 # @md5: The given hash is an md5 hash
3645 # @sha1: The given hash is an sha1 hash
3647 # @sha256: The given hash is an sha256 hash
3649 # Since: 2.12
3651 { 'enum': 'SshHostKeyCheckHashType',
3652   'data': [ 'md5', 'sha1', 'sha256' ] }
3655 # @SshHostKeyHash:
3657 # @type: The hash algorithm used for the hash
3659 # @hash: The expected hash value
3661 # Since: 2.12
3663 { 'struct': 'SshHostKeyHash',
3664   'data': { 'type': 'SshHostKeyCheckHashType',
3665             'hash': 'str' }}
3668 # @SshHostKeyCheck:
3670 # @mode: How to check the host key
3672 # Since: 2.12
3674 { 'union': 'SshHostKeyCheck',
3675   'base': { 'mode': 'SshHostKeyCheckMode' },
3676   'discriminator': 'mode',
3677   'data': { 'hash': 'SshHostKeyHash' } }
3680 # @BlockdevOptionsSsh:
3682 # @server: host address
3684 # @path: path to the image on the host
3686 # @user: user as which to connect, defaults to current local user name
3688 # @host-key-check: Defines how and what to check the host key against
3689 #     (default: known_hosts)
3691 # Since: 2.9
3693 { 'struct': 'BlockdevOptionsSsh',
3694   'data': { 'server': 'InetSocketAddress',
3695             'path': 'str',
3696             '*user': 'str',
3697             '*host-key-check': 'SshHostKeyCheck' } }
3700 # @BlkdebugEvent:
3702 # Trigger events supported by blkdebug.
3704 # @l1_shrink_write_table: write zeros to the l1 table to shrink image.
3705 #     (since 2.11)
3707 # @l1_shrink_free_l2_clusters: discard the l2 tables.  (since 2.11)
3709 # @cor_write: a write due to copy-on-read (since 2.11)
3711 # @cluster_alloc_space: an allocation of file space for a cluster
3712 #     (since 4.1)
3714 # @none: triggers once at creation of the blkdebug node (since 4.1)
3716 # Since: 2.9
3718 { 'enum': 'BlkdebugEvent', 'prefix': 'BLKDBG',
3719   'data': [ 'l1_update', 'l1_grow_alloc_table', 'l1_grow_write_table',
3720             'l1_grow_activate_table', 'l2_load', 'l2_update',
3721             'l2_update_compressed', 'l2_alloc_cow_read', 'l2_alloc_write',
3722             'read_aio', 'read_backing_aio', 'read_compressed', 'write_aio',
3723             'write_compressed', 'vmstate_load', 'vmstate_save', 'cow_read',
3724             'cow_write', 'reftable_load', 'reftable_grow', 'reftable_update',
3725             'refblock_load', 'refblock_update', 'refblock_update_part',
3726             'refblock_alloc', 'refblock_alloc_hookup', 'refblock_alloc_write',
3727             'refblock_alloc_write_blocks', 'refblock_alloc_write_table',
3728             'refblock_alloc_switch_table', 'cluster_alloc',
3729             'cluster_alloc_bytes', 'cluster_free', 'flush_to_os',
3730             'flush_to_disk', 'pwritev_rmw_head', 'pwritev_rmw_after_head',
3731             'pwritev_rmw_tail', 'pwritev_rmw_after_tail', 'pwritev',
3732             'pwritev_zero', 'pwritev_done', 'empty_image_prepare',
3733             'l1_shrink_write_table', 'l1_shrink_free_l2_clusters',
3734             'cor_write', 'cluster_alloc_space', 'none'] }
3737 # @BlkdebugIOType:
3739 # Kinds of I/O that blkdebug can inject errors in.
3741 # @read: .bdrv_co_preadv()
3743 # @write: .bdrv_co_pwritev()
3745 # @write-zeroes: .bdrv_co_pwrite_zeroes()
3747 # @discard: .bdrv_co_pdiscard()
3749 # @flush: .bdrv_co_flush_to_disk()
3751 # @block-status: .bdrv_co_block_status()
3753 # Since: 4.1
3755 { 'enum': 'BlkdebugIOType', 'prefix': 'BLKDEBUG_IO_TYPE',
3756   'data': [ 'read', 'write', 'write-zeroes', 'discard', 'flush',
3757             'block-status' ] }
3760 # @BlkdebugInjectErrorOptions:
3762 # Describes a single error injection for blkdebug.
3764 # @event: trigger event
3766 # @state: the state identifier blkdebug needs to be in to actually
3767 #     trigger the event; defaults to "any"
3769 # @iotype: the type of I/O operations on which this error should be
3770 #     injected; defaults to "all read, write, write-zeroes, discard,
3771 #     and flush operations" (since: 4.1)
3773 # @errno: error identifier (errno) to be returned; defaults to EIO
3775 # @sector: specifies the sector index which has to be affected in
3776 #     order to actually trigger the event; defaults to "any sector"
3778 # @once: disables further events after this one has been triggered;
3779 #     defaults to false
3781 # @immediately: fail immediately; defaults to false
3783 # Since: 2.9
3785 { 'struct': 'BlkdebugInjectErrorOptions',
3786   'data': { 'event': 'BlkdebugEvent',
3787             '*state': 'int',
3788             '*iotype': 'BlkdebugIOType',
3789             '*errno': 'int',
3790             '*sector': 'int',
3791             '*once': 'bool',
3792             '*immediately': 'bool' } }
3795 # @BlkdebugSetStateOptions:
3797 # Describes a single state-change event for blkdebug.
3799 # @event: trigger event
3801 # @state: the current state identifier blkdebug needs to be in;
3802 #     defaults to "any"
3804 # @new_state: the state identifier blkdebug is supposed to assume if
3805 #     this event is triggered
3807 # Since: 2.9
3809 { 'struct': 'BlkdebugSetStateOptions',
3810   'data': { 'event': 'BlkdebugEvent',
3811             '*state': 'int',
3812             'new_state': 'int' } }
3815 # @BlockdevOptionsBlkdebug:
3817 # Driver specific block device options for blkdebug.
3819 # @image: underlying raw block device (or image file)
3821 # @config: filename of the configuration file
3823 # @align: required alignment for requests in bytes, must be positive
3824 #     power of 2, or 0 for default
3826 # @max-transfer: maximum size for I/O transfers in bytes, must be
3827 #     positive multiple of @align and of the underlying file's request
3828 #     alignment (but need not be a power of 2), or 0 for default
3829 #     (since 2.10)
3831 # @opt-write-zero: preferred alignment for write zero requests in
3832 #     bytes, must be positive multiple of @align and of the underlying
3833 #     file's request alignment (but need not be a power of 2), or 0
3834 #     for default (since 2.10)
3836 # @max-write-zero: maximum size for write zero requests in bytes, must
3837 #     be positive multiple of @align, of @opt-write-zero, and of the
3838 #     underlying file's request alignment (but need not be a power of
3839 #     2), or 0 for default (since 2.10)
3841 # @opt-discard: preferred alignment for discard requests in bytes,
3842 #     must be positive multiple of @align and of the underlying file's
3843 #     request alignment (but need not be a power of 2), or 0 for
3844 #     default (since 2.10)
3846 # @max-discard: maximum size for discard requests in bytes, must be
3847 #     positive multiple of @align, of @opt-discard, and of the
3848 #     underlying file's request alignment (but need not be a power of
3849 #     2), or 0 for default (since 2.10)
3851 # @inject-error: array of error injection descriptions
3853 # @set-state: array of state-change descriptions
3855 # @take-child-perms: Permissions to take on @image in addition to what
3856 #     is necessary anyway (which depends on how the blkdebug node is
3857 #     used).  Defaults to none.  (since 5.0)
3859 # @unshare-child-perms: Permissions not to share on @image in addition
3860 #     to what cannot be shared anyway (which depends on how the
3861 #     blkdebug node is used).  Defaults to none.  (since 5.0)
3863 # Since: 2.9
3865 { 'struct': 'BlockdevOptionsBlkdebug',
3866   'data': { 'image': 'BlockdevRef',
3867             '*config': 'str',
3868             '*align': 'int', '*max-transfer': 'int32',
3869             '*opt-write-zero': 'int32', '*max-write-zero': 'int32',
3870             '*opt-discard': 'int32', '*max-discard': 'int32',
3871             '*inject-error': ['BlkdebugInjectErrorOptions'],
3872             '*set-state': ['BlkdebugSetStateOptions'],
3873             '*take-child-perms': ['BlockPermission'],
3874             '*unshare-child-perms': ['BlockPermission'] } }
3877 # @BlockdevOptionsBlklogwrites:
3879 # Driver specific block device options for blklogwrites.
3881 # @file: block device
3883 # @log: block device used to log writes to @file
3885 # @log-sector-size: sector size used in logging writes to @file,
3886 #     determines granularity of offsets and sizes of writes
3887 #     (default: 512)
3889 # @log-append: append to an existing log (default: false)
3891 # @log-super-update-interval: interval of write requests after which
3892 #     the log super block is updated to disk (default: 4096)
3894 # Since: 3.0
3896 { 'struct': 'BlockdevOptionsBlklogwrites',
3897   'data': { 'file': 'BlockdevRef',
3898             'log': 'BlockdevRef',
3899             '*log-sector-size': 'uint32',
3900             '*log-append': 'bool',
3901             '*log-super-update-interval': 'uint64' } }
3904 # @BlockdevOptionsBlkverify:
3906 # Driver specific block device options for blkverify.
3908 # @test: block device to be tested
3910 # @raw: raw image used for verification
3912 # Since: 2.9
3914 { 'struct': 'BlockdevOptionsBlkverify',
3915   'data': { 'test': 'BlockdevRef',
3916             'raw': 'BlockdevRef' } }
3919 # @BlockdevOptionsBlkreplay:
3921 # Driver specific block device options for blkreplay.
3923 # @image: disk image which should be controlled with blkreplay
3925 # Since: 4.2
3927 { 'struct': 'BlockdevOptionsBlkreplay',
3928   'data': { 'image': 'BlockdevRef' } }
3931 # @QuorumReadPattern:
3933 # An enumeration of quorum read patterns.
3935 # @quorum: read all the children and do a quorum vote on reads
3937 # @fifo: read only from the first child that has not failed
3939 # Since: 2.9
3941 { 'enum': 'QuorumReadPattern', 'data': [ 'quorum', 'fifo' ] }
3944 # @BlockdevOptionsQuorum:
3946 # Driver specific block device options for Quorum
3948 # @blkverify: true if the driver must print content mismatch set to
3949 #     false by default
3951 # @children: the children block devices to use
3953 # @vote-threshold: the vote limit under which a read will fail
3955 # @rewrite-corrupted: rewrite corrupted data when quorum is reached
3956 #     (Since 2.1)
3958 # @read-pattern: choose read pattern and set to quorum by default
3959 #     (Since 2.2)
3961 # Since: 2.9
3963 { 'struct': 'BlockdevOptionsQuorum',
3964   'data': { '*blkverify': 'bool',
3965             'children': [ 'BlockdevRef' ],
3966             'vote-threshold': 'int',
3967             '*rewrite-corrupted': 'bool',
3968             '*read-pattern': 'QuorumReadPattern' } }
3971 # @BlockdevOptionsGluster:
3973 # Driver specific block device options for Gluster
3975 # @volume: name of gluster volume where VM image resides
3977 # @path: absolute path to image file in gluster volume
3979 # @server: gluster servers description
3981 # @debug: libgfapi log level (default '4' which is Error) (Since 2.8)
3983 # @logfile: libgfapi log file (default /dev/stderr) (Since 2.8)
3985 # Since: 2.9
3987 { 'struct': 'BlockdevOptionsGluster',
3988   'data': { 'volume': 'str',
3989             'path': 'str',
3990             'server': ['SocketAddress'],
3991             '*debug': 'int',
3992             '*logfile': 'str' } }
3995 # @BlockdevOptionsIoUring:
3997 # Driver specific block device options for the io_uring backend.
3999 # @filename: path to the image file
4001 # Since: 7.2
4003 { 'struct': 'BlockdevOptionsIoUring',
4004   'data': { 'filename': 'str' },
4005   'if': 'CONFIG_BLKIO' }
4008 # @BlockdevOptionsNvmeIoUring:
4010 # Driver specific block device options for the nvme-io_uring backend.
4012 # @path: path to the NVMe namespace's character device (e.g.
4013 #     /dev/ng0n1).
4015 # Since: 7.2
4017 { 'struct': 'BlockdevOptionsNvmeIoUring',
4018   'data': { 'path': 'str' },
4019   'if': 'CONFIG_BLKIO' }
4022 # @BlockdevOptionsVirtioBlkVfioPci:
4024 # Driver specific block device options for the virtio-blk-vfio-pci
4025 # backend.
4027 # @path: path to the PCI device's sysfs directory (e.g.
4028 #     /sys/bus/pci/devices/0000:00:01.0).
4030 # Since: 7.2
4032 { 'struct': 'BlockdevOptionsVirtioBlkVfioPci',
4033   'data': { 'path': 'str' },
4034   'if': 'CONFIG_BLKIO' }
4037 # @BlockdevOptionsVirtioBlkVhostUser:
4039 # Driver specific block device options for the virtio-blk-vhost-user
4040 # backend.
4042 # @path: path to the vhost-user UNIX domain socket.
4044 # Since: 7.2
4046 { 'struct': 'BlockdevOptionsVirtioBlkVhostUser',
4047   'data': { 'path': 'str' },
4048   'if': 'CONFIG_BLKIO' }
4051 # @BlockdevOptionsVirtioBlkVhostVdpa:
4053 # Driver specific block device options for the virtio-blk-vhost-vdpa
4054 # backend.
4056 # @path: path to the vhost-vdpa character device.
4058 # Features:
4059 # @fdset: Member @path supports the special "/dev/fdset/N" path
4060 #     (since 8.1)
4062 # Since: 7.2
4064 { 'struct': 'BlockdevOptionsVirtioBlkVhostVdpa',
4065   'data': { 'path': 'str' },
4066   'features': [ { 'name' :'fdset',
4067                   'if': 'CONFIG_BLKIO_VHOST_VDPA_FD' } ],
4068   'if': 'CONFIG_BLKIO' }
4071 # @IscsiTransport:
4073 # An enumeration of libiscsi transport types
4075 # Since: 2.9
4077 { 'enum': 'IscsiTransport',
4078   'data': [ 'tcp', 'iser' ] }
4081 # @IscsiHeaderDigest:
4083 # An enumeration of header digests supported by libiscsi
4085 # Since: 2.9
4087 { 'enum': 'IscsiHeaderDigest',
4088   'prefix': 'QAPI_ISCSI_HEADER_DIGEST',
4089   'data': [ 'crc32c', 'none', 'crc32c-none', 'none-crc32c' ] }
4092 # @BlockdevOptionsIscsi:
4094 # Driver specific block device options for iscsi
4096 # @transport: The iscsi transport type
4098 # @portal: The address of the iscsi portal
4100 # @target: The target iqn name
4102 # @lun: LUN to connect to.  Defaults to 0.
4104 # @user: User name to log in with.  If omitted, no CHAP authentication
4105 #     is performed.
4107 # @password-secret: The ID of a QCryptoSecret object providing the
4108 #     password for the login.  This option is required if @user is
4109 #     specified.
4111 # @initiator-name: The iqn name we want to identify to the target as.
4112 #     If this option is not specified, an initiator name is generated
4113 #     automatically.
4115 # @header-digest: The desired header digest.  Defaults to none-crc32c.
4117 # @timeout: Timeout in seconds after which a request will timeout.  0
4118 #     means no timeout and is the default.
4120 # Since: 2.9
4122 { 'struct': 'BlockdevOptionsIscsi',
4123   'data': { 'transport': 'IscsiTransport',
4124             'portal': 'str',
4125             'target': 'str',
4126             '*lun': 'int',
4127             '*user': 'str',
4128             '*password-secret': 'str',
4129             '*initiator-name': 'str',
4130             '*header-digest': 'IscsiHeaderDigest',
4131             '*timeout': 'int' } }
4134 # @RbdAuthMode:
4136 # Since: 3.0
4138 { 'enum': 'RbdAuthMode',
4139   'data': [ 'cephx', 'none' ] }
4142 # @RbdImageEncryptionFormat:
4144 # @luks-any: Used for opening either luks or luks2 (Since 8.0)
4146 # Since: 6.1
4148 { 'enum': 'RbdImageEncryptionFormat',
4149   'data': [ 'luks', 'luks2', 'luks-any' ] }
4152 # @RbdEncryptionOptionsLUKSBase:
4154 # @key-secret: ID of a QCryptoSecret object providing a passphrase for
4155 #     unlocking the encryption
4157 # Since: 6.1
4159 { 'struct': 'RbdEncryptionOptionsLUKSBase',
4160   'data': { 'key-secret': 'str' } }
4163 # @RbdEncryptionCreateOptionsLUKSBase:
4165 # @cipher-alg: The encryption algorithm
4167 # Since: 6.1
4169 { 'struct': 'RbdEncryptionCreateOptionsLUKSBase',
4170   'base': 'RbdEncryptionOptionsLUKSBase',
4171   'data': { '*cipher-alg': 'QCryptoCipherAlgorithm' } }
4174 # @RbdEncryptionOptionsLUKS:
4176 # Since: 6.1
4178 { 'struct': 'RbdEncryptionOptionsLUKS',
4179   'base': 'RbdEncryptionOptionsLUKSBase',
4180   'data': { } }
4183 # @RbdEncryptionOptionsLUKS2:
4185 # Since: 6.1
4187 { 'struct': 'RbdEncryptionOptionsLUKS2',
4188   'base': 'RbdEncryptionOptionsLUKSBase',
4189   'data': { } }
4192 # @RbdEncryptionOptionsLUKSAny:
4194 # Since: 8.0
4196 { 'struct': 'RbdEncryptionOptionsLUKSAny',
4197   'base': 'RbdEncryptionOptionsLUKSBase',
4198   'data': { } }
4201 # @RbdEncryptionCreateOptionsLUKS:
4203 # Since: 6.1
4205 { 'struct': 'RbdEncryptionCreateOptionsLUKS',
4206   'base': 'RbdEncryptionCreateOptionsLUKSBase',
4207   'data': { } }
4210 # @RbdEncryptionCreateOptionsLUKS2:
4212 # Since: 6.1
4214 { 'struct': 'RbdEncryptionCreateOptionsLUKS2',
4215   'base': 'RbdEncryptionCreateOptionsLUKSBase',
4216   'data': { } }
4219 # @RbdEncryptionOptions:
4221 # @format: Encryption format.
4223 # @parent: Parent image encryption options (for cloned images).  Can
4224 #     be left unspecified if this cloned image is encrypted using the
4225 #     same format and secret as its parent image (i.e. not explicitly
4226 #     formatted) or if its parent image is not encrypted.  (Since 8.0)
4228 # Since: 6.1
4230 { 'union': 'RbdEncryptionOptions',
4231   'base': { 'format': 'RbdImageEncryptionFormat',
4232             '*parent': 'RbdEncryptionOptions' },
4233   'discriminator': 'format',
4234   'data': { 'luks': 'RbdEncryptionOptionsLUKS',
4235             'luks2': 'RbdEncryptionOptionsLUKS2',
4236             'luks-any': 'RbdEncryptionOptionsLUKSAny'} }
4239 # @RbdEncryptionCreateOptions:
4241 # @format: Encryption format.
4243 # Since: 6.1
4245 { 'union': 'RbdEncryptionCreateOptions',
4246   'base': { 'format': 'RbdImageEncryptionFormat' },
4247   'discriminator': 'format',
4248   'data': { 'luks': 'RbdEncryptionCreateOptionsLUKS',
4249             'luks2': 'RbdEncryptionCreateOptionsLUKS2' } }
4252 # @BlockdevOptionsRbd:
4254 # @pool: Ceph pool name.
4256 # @namespace: Rados namespace name in the Ceph pool.  (Since 5.0)
4258 # @image: Image name in the Ceph pool.
4260 # @conf: path to Ceph configuration file.  Values in the configuration
4261 #     file will be overridden by options specified via QAPI.
4263 # @snapshot: Ceph snapshot name.
4265 # @encrypt: Image encryption options.  (Since 6.1)
4267 # @user: Ceph id name.
4269 # @auth-client-required: Acceptable authentication modes.  This maps
4270 #     to Ceph configuration option "auth_client_required".  (Since
4271 #     3.0)
4273 # @key-secret: ID of a QCryptoSecret object providing a key for cephx
4274 #     authentication.  This maps to Ceph configuration option "key".
4275 #     (Since 3.0)
4277 # @server: Monitor host address and port.  This maps to the "mon_host"
4278 #     Ceph option.
4280 # Since: 2.9
4282 { 'struct': 'BlockdevOptionsRbd',
4283   'data': { 'pool': 'str',
4284             '*namespace': 'str',
4285             'image': 'str',
4286             '*conf': 'str',
4287             '*snapshot': 'str',
4288             '*encrypt': 'RbdEncryptionOptions',
4289             '*user': 'str',
4290             '*auth-client-required': ['RbdAuthMode'],
4291             '*key-secret': 'str',
4292             '*server': ['InetSocketAddressBase'] } }
4295 # @ReplicationMode:
4297 # An enumeration of replication modes.
4299 # @primary: Primary mode, the vm's state will be sent to secondary
4300 #     QEMU.
4302 # @secondary: Secondary mode, receive the vm's state from primary
4303 #     QEMU.
4305 # Since: 2.9
4307 { 'enum' : 'ReplicationMode', 'data' : [ 'primary', 'secondary' ],
4308   'if': 'CONFIG_REPLICATION' }
4311 # @BlockdevOptionsReplication:
4313 # Driver specific block device options for replication
4315 # @mode: the replication mode
4317 # @top-id: In secondary mode, node name or device ID of the root node
4318 #     who owns the replication node chain.  Must not be given in
4319 #     primary mode.
4321 # Since: 2.9
4323 { 'struct': 'BlockdevOptionsReplication',
4324   'base': 'BlockdevOptionsGenericFormat',
4325   'data': { 'mode': 'ReplicationMode',
4326             '*top-id': 'str' },
4327   'if': 'CONFIG_REPLICATION' }
4330 # @NFSTransport:
4332 # An enumeration of NFS transport types
4334 # @inet: TCP transport
4336 # Since: 2.9
4338 { 'enum': 'NFSTransport',
4339   'data': [ 'inet' ] }
4342 # @NFSServer:
4344 # Captures the address of the socket
4346 # @type: transport type used for NFS (only TCP supported)
4348 # @host: host address for NFS server
4350 # Since: 2.9
4352 { 'struct': 'NFSServer',
4353   'data': { 'type': 'NFSTransport',
4354             'host': 'str' } }
4357 # @BlockdevOptionsNfs:
4359 # Driver specific block device option for NFS
4361 # @server: host address
4363 # @path: path of the image on the host
4365 # @user: UID value to use when talking to the server (defaults to
4366 #     65534 on Windows and getuid() on unix)
4368 # @group: GID value to use when talking to the server (defaults to
4369 #     65534 on Windows and getgid() in unix)
4371 # @tcp-syn-count: number of SYNs during the session establishment
4372 #     (defaults to libnfs default)
4374 # @readahead-size: set the readahead size in bytes (defaults to libnfs
4375 #     default)
4377 # @page-cache-size: set the pagecache size in bytes (defaults to
4378 #     libnfs default)
4380 # @debug: set the NFS debug level (max 2) (defaults to libnfs default)
4382 # Since: 2.9
4384 { 'struct': 'BlockdevOptionsNfs',
4385   'data': { 'server': 'NFSServer',
4386             'path': 'str',
4387             '*user': 'int',
4388             '*group': 'int',
4389             '*tcp-syn-count': 'int',
4390             '*readahead-size': 'int',
4391             '*page-cache-size': 'int',
4392             '*debug': 'int' } }
4395 # @BlockdevOptionsCurlBase:
4397 # Driver specific block device options shared by all protocols
4398 # supported by the curl backend.
4400 # @url: URL of the image file
4402 # @readahead: Size of the read-ahead cache; must be a multiple of 512
4403 #     (defaults to 256 kB)
4405 # @timeout: Timeout for connections, in seconds (defaults to 5)
4407 # @username: Username for authentication (defaults to none)
4409 # @password-secret: ID of a QCryptoSecret object providing a password
4410 #     for authentication (defaults to no password)
4412 # @proxy-username: Username for proxy authentication (defaults to
4413 #     none)
4415 # @proxy-password-secret: ID of a QCryptoSecret object providing a
4416 #     password for proxy authentication (defaults to no password)
4418 # Since: 2.9
4420 { 'struct': 'BlockdevOptionsCurlBase',
4421   'data': { 'url': 'str',
4422             '*readahead': 'int',
4423             '*timeout': 'int',
4424             '*username': 'str',
4425             '*password-secret': 'str',
4426             '*proxy-username': 'str',
4427             '*proxy-password-secret': 'str' } }
4430 # @BlockdevOptionsCurlHttp:
4432 # Driver specific block device options for HTTP connections over the
4433 # curl backend.  URLs must start with "http://".
4435 # @cookie: List of cookies to set; format is "name1=content1;
4436 #     name2=content2;" as explained by CURLOPT_COOKIE(3). Defaults to
4437 #     no cookies.
4439 # @cookie-secret: ID of a QCryptoSecret object providing the cookie
4440 #     data in a secure way.  See @cookie for the format.  (since 2.10)
4442 # Since: 2.9
4444 { 'struct': 'BlockdevOptionsCurlHttp',
4445   'base': 'BlockdevOptionsCurlBase',
4446   'data': { '*cookie': 'str',
4447             '*cookie-secret': 'str'} }
4450 # @BlockdevOptionsCurlHttps:
4452 # Driver specific block device options for HTTPS connections over the
4453 # curl backend.  URLs must start with "https://".
4455 # @cookie: List of cookies to set; format is "name1=content1;
4456 #     name2=content2;" as explained by CURLOPT_COOKIE(3). Defaults to
4457 #     no cookies.
4459 # @sslverify: Whether to verify the SSL certificate's validity
4460 #     (defaults to true)
4462 # @cookie-secret: ID of a QCryptoSecret object providing the cookie
4463 #     data in a secure way.  See @cookie for the format.  (since 2.10)
4465 # Since: 2.9
4467 { 'struct': 'BlockdevOptionsCurlHttps',
4468   'base': 'BlockdevOptionsCurlBase',
4469   'data': { '*cookie': 'str',
4470             '*sslverify': 'bool',
4471             '*cookie-secret': 'str'} }
4474 # @BlockdevOptionsCurlFtp:
4476 # Driver specific block device options for FTP connections over the
4477 # curl backend.  URLs must start with "ftp://".
4479 # Since: 2.9
4481 { 'struct': 'BlockdevOptionsCurlFtp',
4482   'base': 'BlockdevOptionsCurlBase',
4483   'data': { } }
4486 # @BlockdevOptionsCurlFtps:
4488 # Driver specific block device options for FTPS connections over the
4489 # curl backend.  URLs must start with "ftps://".
4491 # @sslverify: Whether to verify the SSL certificate's validity
4492 #     (defaults to true)
4494 # Since: 2.9
4496 { 'struct': 'BlockdevOptionsCurlFtps',
4497   'base': 'BlockdevOptionsCurlBase',
4498   'data': { '*sslverify': 'bool' } }
4501 # @BlockdevOptionsNbd:
4503 # Driver specific block device options for NBD.
4505 # @server: NBD server address
4507 # @export: export name
4509 # @tls-creds: TLS credentials ID
4511 # @tls-hostname: TLS hostname override for certificate validation
4512 #     (Since 7.0)
4514 # @x-dirty-bitmap: A metadata context name such as
4515 #     "qemu:dirty-bitmap:NAME" or "qemu:allocation-depth" to query in
4516 #     place of the traditional "base:allocation" block status (see
4517 #     NBD_OPT_LIST_META_CONTEXT in the NBD protocol; and yes, naming
4518 #     this option x-context would have made more sense) (since 3.0)
4520 # @reconnect-delay: On an unexpected disconnect, the nbd client tries
4521 #     to connect again until succeeding or encountering a serious
4522 #     error.  During the first @reconnect-delay seconds, all requests
4523 #     are paused and will be rerun on a successful reconnect.  After
4524 #     that time, any delayed requests and all future requests before a
4525 #     successful reconnect will immediately fail.  Default 0 (Since
4526 #     4.2)
4528 # @open-timeout: In seconds.  If zero, the nbd driver tries the
4529 #     connection only once, and fails to open if the connection fails.
4530 #     If non-zero, the nbd driver will repeat connection attempts
4531 #     until successful or until @open-timeout seconds have elapsed.
4532 #     Default 0 (Since 7.0)
4534 # Features:
4536 # @unstable: Member @x-dirty-bitmap is experimental.
4538 # Since: 2.9
4540 { 'struct': 'BlockdevOptionsNbd',
4541   'data': { 'server': 'SocketAddress',
4542             '*export': 'str',
4543             '*tls-creds': 'str',
4544             '*tls-hostname': 'str',
4545             '*x-dirty-bitmap': { 'type': 'str', 'features': [ 'unstable' ] },
4546             '*reconnect-delay': 'uint32',
4547             '*open-timeout': 'uint32' } }
4550 # @BlockdevOptionsRaw:
4552 # Driver specific block device options for the raw driver.
4554 # @offset: position where the block device starts
4556 # @size: the assumed size of the device
4558 # Since: 2.9
4560 { 'struct': 'BlockdevOptionsRaw',
4561   'base': 'BlockdevOptionsGenericFormat',
4562   'data': { '*offset': 'int', '*size': 'int' } }
4565 # @BlockdevOptionsThrottle:
4567 # Driver specific block device options for the throttle driver
4569 # @throttle-group: the name of the throttle-group object to use.  It
4570 #     must already exist.
4572 # @file: reference to or definition of the data source block device
4574 # Since: 2.11
4576 { 'struct': 'BlockdevOptionsThrottle',
4577   'data': { 'throttle-group': 'str',
4578             'file' : 'BlockdevRef'
4579              } }
4582 # @BlockdevOptionsCor:
4584 # Driver specific block device options for the copy-on-read driver.
4586 # @bottom: The name of a non-filter node (allocation-bearing layer)
4587 #     that limits the COR operations in the backing chain (inclusive),
4588 #     so that no data below this node will be copied by this filter.
4589 #     If option is absent, the limit is not applied, so that data from
4590 #     all backing layers may be copied.
4592 # Since: 6.0
4594 { 'struct': 'BlockdevOptionsCor',
4595   'base': 'BlockdevOptionsGenericFormat',
4596   'data': { '*bottom': 'str' } }
4599 # @OnCbwError:
4601 # An enumeration of possible behaviors for copy-before-write operation
4602 # failures.
4604 # @break-guest-write: report the error to the guest.  This way, the
4605 #     guest will not be able to overwrite areas that cannot be backed
4606 #     up, so the backup process remains valid.
4608 # @break-snapshot: continue guest write.  Doing so will make the
4609 #     provided snapshot state invalid and any backup or export process
4610 #     based on it will finally fail.
4612 # Since: 7.1
4614 { 'enum': 'OnCbwError',
4615   'data': [ 'break-guest-write', 'break-snapshot' ] }
4618 # @BlockdevOptionsCbw:
4620 # Driver specific block device options for the copy-before-write
4621 # driver, which does so called copy-before-write operations: when data
4622 # is written to the filter, the filter first reads corresponding
4623 # blocks from its file child and copies them to @target child.  After
4624 # successfully copying, the write request is propagated to file child.
4625 # If copying fails, the original write request is failed too and no
4626 # data is written to file child.
4628 # @target: The target for copy-before-write operations.
4630 # @bitmap: If specified, copy-before-write filter will do
4631 #     copy-before-write operations only for dirty regions of the
4632 #     bitmap.  Bitmap size must be equal to length of file and target
4633 #     child of the filter.  Note also, that bitmap is used only to
4634 #     initialize internal bitmap of the process, so further
4635 #     modifications (or removing) of specified bitmap doesn't
4636 #     influence the filter.  (Since 7.0)
4638 # @on-cbw-error: Behavior on failure of copy-before-write operation.
4639 #     Default is @break-guest-write.  (Since 7.1)
4641 # @cbw-timeout: Zero means no limit.  Non-zero sets the timeout in
4642 #     seconds for copy-before-write operation.  When a timeout occurs,
4643 #     the respective copy-before-write operation will fail, and the
4644 #     @on-cbw-error parameter will decide how this failure is handled.
4645 #     Default 0. (Since 7.1)
4647 # Since: 6.2
4649 { 'struct': 'BlockdevOptionsCbw',
4650   'base': 'BlockdevOptionsGenericFormat',
4651   'data': { 'target': 'BlockdevRef', '*bitmap': 'BlockDirtyBitmap',
4652             '*on-cbw-error': 'OnCbwError', '*cbw-timeout': 'uint32' } }
4655 # @BlockdevOptions:
4657 # Options for creating a block device.  Many options are available for
4658 # all block devices, independent of the block driver:
4660 # @driver: block driver name
4662 # @node-name: the node name of the new node (Since 2.0). This option
4663 #     is required on the top level of blockdev-add.  Valid node names
4664 #     start with an alphabetic character and may contain only
4665 #     alphanumeric characters, '-', '.' and '_'. Their maximum length
4666 #     is 31 characters.
4668 # @discard: discard-related options (default: ignore)
4670 # @cache: cache-related options
4672 # @read-only: whether the block device should be read-only (default:
4673 #     false). Note that some block drivers support only read-only
4674 #     access, either generally or in certain configurations.  In this
4675 #     case, the default value does not work and the option must be
4676 #     specified explicitly.
4678 # @auto-read-only: if true and @read-only is false, QEMU may
4679 #     automatically decide not to open the image read-write as
4680 #     requested, but fall back to read-only instead (and switch
4681 #     between the modes later), e.g. depending on whether the image
4682 #     file is writable or whether a writing user is attached to the
4683 #     node (default: false, since 3.1)
4685 # @detect-zeroes: detect and optimize zero writes (Since 2.1)
4686 #     (default: off)
4688 # @force-share: force share all permission on added nodes.  Requires
4689 #     read-only=true.  (Since 2.10)
4691 # Since: 2.9
4693 { 'union': 'BlockdevOptions',
4694   'base': { 'driver': 'BlockdevDriver',
4695             '*node-name': 'str',
4696             '*discard': 'BlockdevDiscardOptions',
4697             '*cache': 'BlockdevCacheOptions',
4698             '*read-only': 'bool',
4699             '*auto-read-only': 'bool',
4700             '*force-share': 'bool',
4701             '*detect-zeroes': 'BlockdevDetectZeroesOptions' },
4702   'discriminator': 'driver',
4703   'data': {
4704       'blkdebug':   'BlockdevOptionsBlkdebug',
4705       'blklogwrites':'BlockdevOptionsBlklogwrites',
4706       'blkverify':  'BlockdevOptionsBlkverify',
4707       'blkreplay':  'BlockdevOptionsBlkreplay',
4708       'bochs':      'BlockdevOptionsGenericFormat',
4709       'cloop':      'BlockdevOptionsGenericFormat',
4710       'compress':   'BlockdevOptionsGenericFormat',
4711       'copy-before-write':'BlockdevOptionsCbw',
4712       'copy-on-read':'BlockdevOptionsCor',
4713       'dmg':        'BlockdevOptionsGenericFormat',
4714       'file':       'BlockdevOptionsFile',
4715       'ftp':        'BlockdevOptionsCurlFtp',
4716       'ftps':       'BlockdevOptionsCurlFtps',
4717       'gluster':    'BlockdevOptionsGluster',
4718       'host_cdrom':  { 'type': 'BlockdevOptionsFile',
4719                        'if': 'HAVE_HOST_BLOCK_DEVICE' },
4720       'host_device': { 'type': 'BlockdevOptionsFile',
4721                        'if': 'HAVE_HOST_BLOCK_DEVICE' },
4722       'http':       'BlockdevOptionsCurlHttp',
4723       'https':      'BlockdevOptionsCurlHttps',
4724       'io_uring':   { 'type': 'BlockdevOptionsIoUring',
4725                       'if': 'CONFIG_BLKIO' },
4726       'iscsi':      'BlockdevOptionsIscsi',
4727       'luks':       'BlockdevOptionsLUKS',
4728       'nbd':        'BlockdevOptionsNbd',
4729       'nfs':        'BlockdevOptionsNfs',
4730       'null-aio':   'BlockdevOptionsNull',
4731       'null-co':    'BlockdevOptionsNull',
4732       'nvme':       'BlockdevOptionsNVMe',
4733       'nvme-io_uring': { 'type': 'BlockdevOptionsNvmeIoUring',
4734                          'if': 'CONFIG_BLKIO' },
4735       'parallels':  'BlockdevOptionsGenericFormat',
4736       'preallocate':'BlockdevOptionsPreallocate',
4737       'qcow2':      'BlockdevOptionsQcow2',
4738       'qcow':       'BlockdevOptionsQcow',
4739       'qed':        'BlockdevOptionsGenericCOWFormat',
4740       'quorum':     'BlockdevOptionsQuorum',
4741       'raw':        'BlockdevOptionsRaw',
4742       'rbd':        'BlockdevOptionsRbd',
4743       'replication': { 'type': 'BlockdevOptionsReplication',
4744                        'if': 'CONFIG_REPLICATION' },
4745       'snapshot-access': 'BlockdevOptionsGenericFormat',
4746       'ssh':        'BlockdevOptionsSsh',
4747       'throttle':   'BlockdevOptionsThrottle',
4748       'vdi':        'BlockdevOptionsGenericFormat',
4749       'vhdx':       'BlockdevOptionsGenericFormat',
4750       'virtio-blk-vfio-pci':
4751                     { 'type': 'BlockdevOptionsVirtioBlkVfioPci',
4752                       'if': 'CONFIG_BLKIO' },
4753       'virtio-blk-vhost-user':
4754                     { 'type': 'BlockdevOptionsVirtioBlkVhostUser',
4755                       'if': 'CONFIG_BLKIO' },
4756       'virtio-blk-vhost-vdpa':
4757                     { 'type': 'BlockdevOptionsVirtioBlkVhostVdpa',
4758                       'if': 'CONFIG_BLKIO' },
4759       'vmdk':       'BlockdevOptionsGenericCOWFormat',
4760       'vpc':        'BlockdevOptionsGenericFormat',
4761       'vvfat':      'BlockdevOptionsVVFAT'
4762   } }
4765 # @BlockdevRef:
4767 # Reference to a block device.
4769 # @definition: defines a new block device inline
4771 # @reference: references the ID of an existing block device
4773 # Since: 2.9
4775 { 'alternate': 'BlockdevRef',
4776   'data': { 'definition': 'BlockdevOptions',
4777             'reference': 'str' } }
4780 # @BlockdevRefOrNull:
4782 # Reference to a block device.
4784 # @definition: defines a new block device inline
4786 # @reference: references the ID of an existing block device.  An empty
4787 #     string means that no block device should be referenced.
4788 #     Deprecated; use null instead.
4790 # @null: No block device should be referenced (since 2.10)
4792 # Since: 2.9
4794 { 'alternate': 'BlockdevRefOrNull',
4795   'data': { 'definition': 'BlockdevOptions',
4796             'reference': 'str',
4797             'null': 'null' } }
4800 # @blockdev-add:
4802 # Creates a new block device.
4804 # Since: 2.9
4806 # Examples:
4808 # -> { "execute": "blockdev-add",
4809 #      "arguments": {
4810 #           "driver": "qcow2",
4811 #           "node-name": "test1",
4812 #           "file": {
4813 #               "driver": "file",
4814 #               "filename": "test.qcow2"
4815 #            }
4816 #       }
4817 #     }
4818 # <- { "return": {} }
4820 # -> { "execute": "blockdev-add",
4821 #      "arguments": {
4822 #           "driver": "qcow2",
4823 #           "node-name": "node0",
4824 #           "discard": "unmap",
4825 #           "cache": {
4826 #              "direct": true
4827 #            },
4828 #            "file": {
4829 #              "driver": "file",
4830 #              "filename": "/tmp/test.qcow2"
4831 #            },
4832 #            "backing": {
4833 #               "driver": "raw",
4834 #               "file": {
4835 #                  "driver": "file",
4836 #                  "filename": "/dev/fdset/4"
4837 #                }
4838 #            }
4839 #        }
4840 #      }
4842 # <- { "return": {} }
4844 { 'command': 'blockdev-add', 'data': 'BlockdevOptions', 'boxed': true,
4845   'allow-preconfig': true }
4848 # @blockdev-reopen:
4850 # Reopens one or more block devices using the given set of options.
4851 # Any option not specified will be reset to its default value
4852 # regardless of its previous status.  If an option cannot be changed
4853 # or a particular driver does not support reopening then the command
4854 # will return an error.  All devices in the list are reopened in one
4855 # transaction, so if one of them fails then the whole transaction is
4856 # cancelled.
4858 # The command receives a list of block devices to reopen.  For each
4859 # one of them, the top-level @node-name option (from BlockdevOptions)
4860 # must be specified and is used to select the block device to be
4861 # reopened.  Other @node-name options must be either omitted or set to
4862 # the current name of the appropriate node.  This command won't change
4863 # any node name and any attempt to do it will result in an error.
4865 # In the case of options that refer to child nodes, the behavior of
4866 # this command depends on the value:
4868 #  1) A set of options (BlockdevOptions): the child is reopened with
4869 #     the specified set of options.
4871 #  2) A reference to the current child: the child is reopened using
4872 #     its existing set of options.
4874 #  3) A reference to a different node: the current child is replaced
4875 #     with the specified one.
4877 #  4) NULL: the current child (if any) is detached.
4879 # Options (1) and (2) are supported in all cases.  Option (3) is
4880 # supported for @file and @backing, and option (4) for @backing only.
4882 # Unlike with blockdev-add, the @backing option must always be present
4883 # unless the node being reopened does not have a backing file and its
4884 # image does not have a default backing file name as part of its
4885 # metadata.
4887 # Since: 6.1
4889 { 'command': 'blockdev-reopen',
4890   'data': { 'options': ['BlockdevOptions'] },
4891   'allow-preconfig': true }
4894 # @blockdev-del:
4896 # Deletes a block device that has been added using blockdev-add.  The
4897 # command will fail if the node is attached to a device or is
4898 # otherwise being used.
4900 # @node-name: Name of the graph node to delete.
4902 # Since: 2.9
4904 # Example:
4906 # -> { "execute": "blockdev-add",
4907 #      "arguments": {
4908 #           "driver": "qcow2",
4909 #           "node-name": "node0",
4910 #           "file": {
4911 #               "driver": "file",
4912 #               "filename": "test.qcow2"
4913 #           }
4914 #      }
4915 #    }
4916 # <- { "return": {} }
4918 # -> { "execute": "blockdev-del",
4919 #      "arguments": { "node-name": "node0" }
4920 #    }
4921 # <- { "return": {} }
4923 { 'command': 'blockdev-del', 'data': { 'node-name': 'str' },
4924   'allow-preconfig': true }
4927 # @BlockdevCreateOptionsFile:
4929 # Driver specific image creation options for file.
4931 # @filename: Filename for the new image file
4933 # @size: Size of the virtual disk in bytes
4935 # @preallocation: Preallocation mode for the new image (default: off;
4936 #     allowed values: off, falloc (if CONFIG_POSIX_FALLOCATE), full
4937 #     (if CONFIG_POSIX))
4939 # @nocow: Turn off copy-on-write (valid only on btrfs; default: off)
4941 # @extent-size-hint: Extent size hint to add to the image file; 0 for
4942 #     not adding an extent size hint (default: 1 MB, since 5.1)
4944 # Since: 2.12
4946 { 'struct': 'BlockdevCreateOptionsFile',
4947   'data': { 'filename':             'str',
4948             'size':                 'size',
4949             '*preallocation':       'PreallocMode',
4950             '*nocow':               'bool',
4951             '*extent-size-hint':    'size'} }
4954 # @BlockdevCreateOptionsGluster:
4956 # Driver specific image creation options for gluster.
4958 # @location: Where to store the new image file
4960 # @size: Size of the virtual disk in bytes
4962 # @preallocation: Preallocation mode for the new image (default: off;
4963 #     allowed values: off, falloc (if CONFIG_GLUSTERFS_FALLOCATE),
4964 #     full (if CONFIG_GLUSTERFS_ZEROFILL))
4966 # Since: 2.12
4968 { 'struct': 'BlockdevCreateOptionsGluster',
4969   'data': { 'location':         'BlockdevOptionsGluster',
4970             'size':             'size',
4971             '*preallocation':   'PreallocMode' } }
4974 # @BlockdevCreateOptionsLUKS:
4976 # Driver specific image creation options for LUKS.
4978 # @file: Node to create the image format on, mandatory except when
4979 #        'preallocation' is not requested
4981 # @header: Block device holding a detached LUKS header. (since 9.0)
4983 # @size: Size of the virtual disk in bytes
4985 # @preallocation: Preallocation mode for the new image (since: 4.2)
4986 #     (default: off; allowed values: off, metadata, falloc, full)
4988 # Since: 2.12
4990 { 'struct': 'BlockdevCreateOptionsLUKS',
4991   'base': 'QCryptoBlockCreateOptionsLUKS',
4992   'data': { '*file':            'BlockdevRef',
4993             '*header':          'BlockdevRef',
4994             'size':             'size',
4995             '*preallocation':   'PreallocMode' } }
4998 # @BlockdevCreateOptionsNfs:
5000 # Driver specific image creation options for NFS.
5002 # @location: Where to store the new image file
5004 # @size: Size of the virtual disk in bytes
5006 # Since: 2.12
5008 { 'struct': 'BlockdevCreateOptionsNfs',
5009   'data': { 'location':         'BlockdevOptionsNfs',
5010             'size':             'size' } }
5013 # @BlockdevCreateOptionsParallels:
5015 # Driver specific image creation options for parallels.
5017 # @file: Node to create the image format on
5019 # @size: Size of the virtual disk in bytes
5021 # @cluster-size: Cluster size in bytes (default: 1 MB)
5023 # Since: 2.12
5025 { 'struct': 'BlockdevCreateOptionsParallels',
5026   'data': { 'file':             'BlockdevRef',
5027             'size':             'size',
5028             '*cluster-size':    'size' } }
5031 # @BlockdevCreateOptionsQcow:
5033 # Driver specific image creation options for qcow.
5035 # @file: Node to create the image format on
5037 # @size: Size of the virtual disk in bytes
5039 # @backing-file: File name of the backing file if a backing file
5040 #     should be used
5042 # @encrypt: Encryption options if the image should be encrypted
5044 # Since: 2.12
5046 { 'struct': 'BlockdevCreateOptionsQcow',
5047   'data': { 'file':             'BlockdevRef',
5048             'size':             'size',
5049             '*backing-file':    'str',
5050             '*encrypt':         'QCryptoBlockCreateOptions' } }
5053 # @BlockdevQcow2Version:
5055 # @v2: The original QCOW2 format as introduced in qemu 0.10 (version
5056 #     2)
5058 # @v3: The extended QCOW2 format as introduced in qemu 1.1 (version 3)
5060 # Since: 2.12
5062 { 'enum': 'BlockdevQcow2Version',
5063   'data': [ 'v2', 'v3' ] }
5066 # @Qcow2CompressionType:
5068 # Compression type used in qcow2 image file
5070 # @zlib: zlib compression, see <http://zlib.net/>
5072 # @zstd: zstd compression, see <http://github.com/facebook/zstd>
5074 # Since: 5.1
5076 { 'enum': 'Qcow2CompressionType',
5077   'data': [ 'zlib', { 'name': 'zstd', 'if': 'CONFIG_ZSTD' } ] }
5080 # @BlockdevCreateOptionsQcow2:
5082 # Driver specific image creation options for qcow2.
5084 # @file: Node to create the image format on
5086 # @data-file: Node to use as an external data file in which all guest
5087 #     data is stored so that only metadata remains in the qcow2 file
5088 #     (since: 4.0)
5090 # @data-file-raw: True if the external data file must stay valid as a
5091 #     standalone (read-only) raw image without looking at qcow2
5092 #     metadata (default: false; since: 4.0)
5094 # @extended-l2: True to make the image have extended L2 entries
5095 #     (default: false; since 5.2)
5097 # @size: Size of the virtual disk in bytes
5099 # @version: Compatibility level (default: v3)
5101 # @backing-file: File name of the backing file if a backing file
5102 #     should be used
5104 # @backing-fmt: Name of the block driver to use for the backing file
5106 # @encrypt: Encryption options if the image should be encrypted
5108 # @cluster-size: qcow2 cluster size in bytes (default: 65536)
5110 # @preallocation: Preallocation mode for the new image (default: off;
5111 #     allowed values: off, falloc, full, metadata)
5113 # @lazy-refcounts: True if refcounts may be updated lazily
5114 #     (default: off)
5116 # @refcount-bits: Width of reference counts in bits (default: 16)
5118 # @compression-type: The image cluster compression method
5119 #     (default: zlib, since 5.1)
5121 # Since: 2.12
5123 { 'struct': 'BlockdevCreateOptionsQcow2',
5124   'data': { 'file':             'BlockdevRef',
5125             '*data-file':       'BlockdevRef',
5126             '*data-file-raw':   'bool',
5127             '*extended-l2':     'bool',
5128             'size':             'size',
5129             '*version':         'BlockdevQcow2Version',
5130             '*backing-file':    'str',
5131             '*backing-fmt':     'BlockdevDriver',
5132             '*encrypt':         'QCryptoBlockCreateOptions',
5133             '*cluster-size':    'size',
5134             '*preallocation':   'PreallocMode',
5135             '*lazy-refcounts':  'bool',
5136             '*refcount-bits':   'int',
5137             '*compression-type':'Qcow2CompressionType' } }
5140 # @BlockdevCreateOptionsQed:
5142 # Driver specific image creation options for qed.
5144 # @file: Node to create the image format on
5146 # @size: Size of the virtual disk in bytes
5148 # @backing-file: File name of the backing file if a backing file
5149 #     should be used
5151 # @backing-fmt: Name of the block driver to use for the backing file
5153 # @cluster-size: Cluster size in bytes (default: 65536)
5155 # @table-size: L1/L2 table size (in clusters)
5157 # Since: 2.12
5159 { 'struct': 'BlockdevCreateOptionsQed',
5160   'data': { 'file':             'BlockdevRef',
5161             'size':             'size',
5162             '*backing-file':    'str',
5163             '*backing-fmt':     'BlockdevDriver',
5164             '*cluster-size':    'size',
5165             '*table-size':      'int' } }
5168 # @BlockdevCreateOptionsRbd:
5170 # Driver specific image creation options for rbd/Ceph.
5172 # @location: Where to store the new image file.  This location cannot
5173 #     point to a snapshot.
5175 # @size: Size of the virtual disk in bytes
5177 # @cluster-size: RBD object size
5179 # @encrypt: Image encryption options.  (Since 6.1)
5181 # Since: 2.12
5183 { 'struct': 'BlockdevCreateOptionsRbd',
5184   'data': { 'location':         'BlockdevOptionsRbd',
5185             'size':             'size',
5186             '*cluster-size' :   'size',
5187             '*encrypt' :        'RbdEncryptionCreateOptions' } }
5190 # @BlockdevVmdkSubformat:
5192 # Subformat options for VMDK images
5194 # @monolithicSparse: Single file image with sparse cluster allocation
5196 # @monolithicFlat: Single flat data image and a descriptor file
5198 # @twoGbMaxExtentSparse: Data is split into 2GB (per virtual LBA)
5199 #     sparse extent files, in addition to a descriptor file
5201 # @twoGbMaxExtentFlat: Data is split into 2GB (per virtual LBA) flat
5202 #     extent files, in addition to a descriptor file
5204 # @streamOptimized: Single file image sparse cluster allocation,
5205 #     optimized for streaming over network.
5207 # Since: 4.0
5209 { 'enum': 'BlockdevVmdkSubformat',
5210   'data': [ 'monolithicSparse', 'monolithicFlat', 'twoGbMaxExtentSparse',
5211             'twoGbMaxExtentFlat', 'streamOptimized'] }
5214 # @BlockdevVmdkAdapterType:
5216 # Adapter type info for VMDK images
5218 # Since: 4.0
5220 { 'enum': 'BlockdevVmdkAdapterType',
5221   'data': [ 'ide', 'buslogic', 'lsilogic', 'legacyESX'] }
5224 # @BlockdevCreateOptionsVmdk:
5226 # Driver specific image creation options for VMDK.
5228 # @file: Where to store the new image file.  This refers to the image
5229 #     file for monolithcSparse and streamOptimized format, or the
5230 #     descriptor file for other formats.
5232 # @size: Size of the virtual disk in bytes
5234 # @extents: Where to store the data extents.  Required for
5235 #     monolithcFlat, twoGbMaxExtentSparse and twoGbMaxExtentFlat
5236 #     formats.  For monolithicFlat, only one entry is required; for
5237 #     twoGbMaxExtent* formats, the number of entries required is
5238 #     calculated as extent_number = virtual_size / 2GB. Providing more
5239 #     extents than will be used is an error.
5241 # @subformat: The subformat of the VMDK image.  Default:
5242 #     "monolithicSparse".
5244 # @backing-file: The path of backing file.  Default: no backing file
5245 #     is used.
5247 # @adapter-type: The adapter type used to fill in the descriptor.
5248 #     Default: ide.
5250 # @hwversion: Hardware version.  The meaningful options are "4" or
5251 #     "6". Default: "4".
5253 # @toolsversion: VMware guest tools version.  Default: "2147483647"
5254 #     (Since 6.2)
5256 # @zeroed-grain: Whether to enable zeroed-grain feature for sparse
5257 #     subformats.  Default: false.
5259 # Since: 4.0
5261 { 'struct': 'BlockdevCreateOptionsVmdk',
5262   'data': { 'file':             'BlockdevRef',
5263             'size':             'size',
5264             '*extents':          ['BlockdevRef'],
5265             '*subformat':       'BlockdevVmdkSubformat',
5266             '*backing-file':    'str',
5267             '*adapter-type':    'BlockdevVmdkAdapterType',
5268             '*hwversion':       'str',
5269             '*toolsversion':    'str',
5270             '*zeroed-grain':    'bool' } }
5273 # @BlockdevCreateOptionsSsh:
5275 # Driver specific image creation options for SSH.
5277 # @location: Where to store the new image file
5279 # @size: Size of the virtual disk in bytes
5281 # Since: 2.12
5283 { 'struct': 'BlockdevCreateOptionsSsh',
5284   'data': { 'location':         'BlockdevOptionsSsh',
5285             'size':             'size' } }
5288 # @BlockdevCreateOptionsVdi:
5290 # Driver specific image creation options for VDI.
5292 # @file: Node to create the image format on
5294 # @size: Size of the virtual disk in bytes
5296 # @preallocation: Preallocation mode for the new image (default: off;
5297 #     allowed values: off, metadata)
5299 # Since: 2.12
5301 { 'struct': 'BlockdevCreateOptionsVdi',
5302   'data': { 'file':             'BlockdevRef',
5303             'size':             'size',
5304             '*preallocation':   'PreallocMode' } }
5307 # @BlockdevVhdxSubformat:
5309 # @dynamic: Growing image file
5311 # @fixed: Preallocated fixed-size image file
5313 # Since: 2.12
5315 { 'enum': 'BlockdevVhdxSubformat',
5316   'data': [ 'dynamic', 'fixed' ] }
5319 # @BlockdevCreateOptionsVhdx:
5321 # Driver specific image creation options for vhdx.
5323 # @file: Node to create the image format on
5325 # @size: Size of the virtual disk in bytes
5327 # @log-size: Log size in bytes, must be a multiple of 1 MB (default: 1
5328 #     MB)
5330 # @block-size: Block size in bytes, must be a multiple of 1 MB and not
5331 #     larger than 256 MB (default: automatically choose a block size
5332 #     depending on the image size)
5334 # @subformat: vhdx subformat (default: dynamic)
5336 # @block-state-zero: Force use of payload blocks of type 'ZERO'.
5337 #     Non-standard, but default.  Do not set to 'off' when using
5338 #     'qemu-img convert' with subformat=dynamic.
5340 # Since: 2.12
5342 { 'struct': 'BlockdevCreateOptionsVhdx',
5343   'data': { 'file':                 'BlockdevRef',
5344             'size':                 'size',
5345             '*log-size':            'size',
5346             '*block-size':          'size',
5347             '*subformat':           'BlockdevVhdxSubformat',
5348             '*block-state-zero':    'bool' } }
5351 # @BlockdevVpcSubformat:
5353 # @dynamic: Growing image file
5355 # @fixed: Preallocated fixed-size image file
5357 # Since: 2.12
5359 { 'enum': 'BlockdevVpcSubformat',
5360   'data': [ 'dynamic', 'fixed' ] }
5363 # @BlockdevCreateOptionsVpc:
5365 # Driver specific image creation options for vpc (VHD).
5367 # @file: Node to create the image format on
5369 # @size: Size of the virtual disk in bytes
5371 # @subformat: vhdx subformat (default: dynamic)
5373 # @force-size: Force use of the exact byte size instead of rounding to
5374 #     the next size that can be represented in CHS geometry
5375 #     (default: false)
5377 # Since: 2.12
5379 { 'struct': 'BlockdevCreateOptionsVpc',
5380   'data': { 'file':                 'BlockdevRef',
5381             'size':                 'size',
5382             '*subformat':           'BlockdevVpcSubformat',
5383             '*force-size':          'bool' } }
5386 # @BlockdevCreateOptions:
5388 # Options for creating an image format on a given node.
5390 # @driver: block driver to create the image format
5392 # Since: 2.12
5394 { 'union': 'BlockdevCreateOptions',
5395   'base': {
5396       'driver':         'BlockdevDriver' },
5397   'discriminator': 'driver',
5398   'data': {
5399       'file':           'BlockdevCreateOptionsFile',
5400       'gluster':        'BlockdevCreateOptionsGluster',
5401       'luks':           'BlockdevCreateOptionsLUKS',
5402       'nfs':            'BlockdevCreateOptionsNfs',
5403       'parallels':      'BlockdevCreateOptionsParallels',
5404       'qcow':           'BlockdevCreateOptionsQcow',
5405       'qcow2':          'BlockdevCreateOptionsQcow2',
5406       'qed':            'BlockdevCreateOptionsQed',
5407       'rbd':            'BlockdevCreateOptionsRbd',
5408       'ssh':            'BlockdevCreateOptionsSsh',
5409       'vdi':            'BlockdevCreateOptionsVdi',
5410       'vhdx':           'BlockdevCreateOptionsVhdx',
5411       'vmdk':           'BlockdevCreateOptionsVmdk',
5412       'vpc':            'BlockdevCreateOptionsVpc'
5413   } }
5416 # @blockdev-create:
5418 # Starts a job to create an image format on a given node.  The job is
5419 # automatically finalized, but a manual job-dismiss is required.
5421 # @job-id: Identifier for the newly created job.
5423 # @options: Options for the image creation.
5425 # Since: 3.0
5427 { 'command': 'blockdev-create',
5428   'data': { 'job-id': 'str',
5429             'options': 'BlockdevCreateOptions' },
5430   'allow-preconfig': true }
5433 # @BlockdevAmendOptionsLUKS:
5435 # Driver specific image amend options for LUKS.
5437 # Since: 5.1
5439 { 'struct': 'BlockdevAmendOptionsLUKS',
5440   'base': 'QCryptoBlockAmendOptionsLUKS',
5441   'data': { }
5445 # @BlockdevAmendOptionsQcow2:
5447 # Driver specific image amend options for qcow2. For now, only
5448 # encryption options can be amended
5450 # @encrypt: Encryption options to be amended
5452 # Since: 5.1
5454 { 'struct': 'BlockdevAmendOptionsQcow2',
5455   'data': { '*encrypt':         'QCryptoBlockAmendOptions' } }
5458 # @BlockdevAmendOptions:
5460 # Options for amending an image format
5462 # @driver: Block driver of the node to amend.
5464 # Since: 5.1
5466 { 'union': 'BlockdevAmendOptions',
5467   'base': {
5468       'driver':         'BlockdevDriver' },
5469   'discriminator': 'driver',
5470   'data': {
5471       'luks':           'BlockdevAmendOptionsLUKS',
5472       'qcow2':          'BlockdevAmendOptionsQcow2' } }
5475 # @x-blockdev-amend:
5477 # Starts a job to amend format specific options of an existing open
5478 # block device The job is automatically finalized, but a manual
5479 # job-dismiss is required.
5481 # @job-id: Identifier for the newly created job.
5483 # @node-name: Name of the block node to work on
5485 # @options: Options (driver specific)
5487 # @force: Allow unsafe operations, format specific For luks that
5488 #     allows erase of the last active keyslot (permanent loss of
5489 #     data), and replacement of an active keyslot (possible loss of
5490 #     data if IO error happens)
5492 # Features:
5494 # @unstable: This command is experimental.
5496 # Since: 5.1
5498 { 'command': 'x-blockdev-amend',
5499   'data': { 'job-id': 'str',
5500             'node-name': 'str',
5501             'options': 'BlockdevAmendOptions',
5502             '*force': 'bool' },
5503   'features': [ 'unstable' ],
5504   'allow-preconfig': true }
5507 # @BlockErrorAction:
5509 # An enumeration of action that has been taken when a DISK I/O occurs
5511 # @ignore: error has been ignored
5513 # @report: error has been reported to the device
5515 # @stop: error caused VM to be stopped
5517 # Since: 2.1
5519 { 'enum': 'BlockErrorAction',
5520   'data': [ 'ignore', 'report', 'stop' ] }
5523 # @BLOCK_IMAGE_CORRUPTED:
5525 # Emitted when a disk image is being marked corrupt.  The image can be
5526 # identified by its device or node name.  The 'device' field is always
5527 # present for compatibility reasons, but it can be empty ("") if the
5528 # image does not have a device name associated.
5530 # @device: device name.  This is always present for compatibility
5531 #     reasons, but it can be empty ("") if the image does not have a
5532 #     device name associated.
5534 # @node-name: node name (Since: 2.4)
5536 # @msg: informative message for human consumption, such as the kind of
5537 #     corruption being detected.  It should not be parsed by machine
5538 #     as it is not guaranteed to be stable
5540 # @offset: if the corruption resulted from an image access, this is
5541 #     the host's access offset into the image
5543 # @size: if the corruption resulted from an image access, this is the
5544 #     access size
5546 # @fatal: if set, the image is marked corrupt and therefore unusable
5547 #     after this event and must be repaired (Since 2.2; before, every
5548 #     BLOCK_IMAGE_CORRUPTED event was fatal)
5550 # Note: If action is "stop", a STOP event will eventually follow the
5551 #     BLOCK_IO_ERROR event.
5553 # Example:
5555 # <- { "event": "BLOCK_IMAGE_CORRUPTED",
5556 #      "data": { "device": "", "node-name": "drive", "fatal": false,
5557 #                "msg": "L2 table offset 0x2a2a2a00 unaligned (L1 index: 0)" },
5558 #      "timestamp": { "seconds": 1648243240, "microseconds": 906060 } }
5560 # Since: 1.7
5562 { 'event': 'BLOCK_IMAGE_CORRUPTED',
5563   'data': { 'device'     : 'str',
5564             '*node-name' : 'str',
5565             'msg'        : 'str',
5566             '*offset'    : 'int',
5567             '*size'      : 'int',
5568             'fatal'      : 'bool' } }
5571 # @BLOCK_IO_ERROR:
5573 # Emitted when a disk I/O error occurs
5575 # @device: device name.  This is always present for compatibility
5576 #     reasons, but it can be empty ("") if the image does not have a
5577 #     device name associated.
5579 # @node-name: node name.  Note that errors may be reported for the
5580 #     root node that is directly attached to a guest device rather
5581 #     than for the node where the error occurred.  The node name is
5582 #     not present if the drive is empty.  (Since: 2.8)
5584 # @operation: I/O operation
5586 # @action: action that has been taken
5588 # @nospace: true if I/O error was caused due to a no-space condition.
5589 #     This key is only present if query-block's io-status is present,
5590 #     please see query-block documentation for more information
5591 #     (since: 2.2)
5593 # @reason: human readable string describing the error cause.  (This
5594 #     field is a debugging aid for humans, it should not be parsed by
5595 #     applications) (since: 2.2)
5597 # Note: If action is "stop", a STOP event will eventually follow the
5598 #     BLOCK_IO_ERROR event
5600 # Since: 0.13
5602 # Example:
5604 # <- { "event": "BLOCK_IO_ERROR",
5605 #      "data": { "device": "ide0-hd1",
5606 #                "node-name": "#block212",
5607 #                "operation": "write",
5608 #                "action": "stop",
5609 #                "reason": "No space left on device" },
5610 #      "timestamp": { "seconds": 1265044230, "microseconds": 450486 } }
5612 { 'event': 'BLOCK_IO_ERROR',
5613   'data': { 'device': 'str', '*node-name': 'str',
5614             'operation': 'IoOperationType',
5615             'action': 'BlockErrorAction', '*nospace': 'bool',
5616             'reason': 'str' } }
5619 # @BLOCK_JOB_COMPLETED:
5621 # Emitted when a block job has completed
5623 # @type: job type
5625 # @device: The job identifier.  Originally the device name but other
5626 #     values are allowed since QEMU 2.7
5628 # @len: maximum progress value
5630 # @offset: current progress value.  On success this is equal to len.
5631 #     On failure this is less than len
5633 # @speed: rate limit, bytes per second
5635 # @error: error message.  Only present on failure.  This field
5636 #     contains a human-readable error message.  There are no semantics
5637 #     other than that streaming has failed and clients should not try
5638 #     to interpret the error string
5640 # Since: 1.1
5642 # Example:
5644 # <- { "event": "BLOCK_JOB_COMPLETED",
5645 #      "data": { "type": "stream", "device": "virtio-disk0",
5646 #                "len": 10737418240, "offset": 10737418240,
5647 #                "speed": 0 },
5648 #      "timestamp": { "seconds": 1267061043, "microseconds": 959568 } }
5650 { 'event': 'BLOCK_JOB_COMPLETED',
5651   'data': { 'type'  : 'JobType',
5652             'device': 'str',
5653             'len'   : 'int',
5654             'offset': 'int',
5655             'speed' : 'int',
5656             '*error': 'str' } }
5659 # @BLOCK_JOB_CANCELLED:
5661 # Emitted when a block job has been cancelled
5663 # @type: job type
5665 # @device: The job identifier.  Originally the device name but other
5666 #     values are allowed since QEMU 2.7
5668 # @len: maximum progress value
5670 # @offset: current progress value.  On success this is equal to len.
5671 #     On failure this is less than len
5673 # @speed: rate limit, bytes per second
5675 # Since: 1.1
5677 # Example:
5679 # <- { "event": "BLOCK_JOB_CANCELLED",
5680 #      "data": { "type": "stream", "device": "virtio-disk0",
5681 #                "len": 10737418240, "offset": 134217728,
5682 #                "speed": 0 },
5683 #      "timestamp": { "seconds": 1267061043, "microseconds": 959568 } }
5685 { 'event': 'BLOCK_JOB_CANCELLED',
5686   'data': { 'type'  : 'JobType',
5687             'device': 'str',
5688             'len'   : 'int',
5689             'offset': 'int',
5690             'speed' : 'int' } }
5693 # @BLOCK_JOB_ERROR:
5695 # Emitted when a block job encounters an error
5697 # @device: The job identifier.  Originally the device name but other
5698 #     values are allowed since QEMU 2.7
5700 # @operation: I/O operation
5702 # @action: action that has been taken
5704 # Since: 1.3
5706 # Example:
5708 # <- { "event": "BLOCK_JOB_ERROR",
5709 #      "data": { "device": "ide0-hd1",
5710 #                "operation": "write",
5711 #                "action": "stop" },
5712 #      "timestamp": { "seconds": 1265044230, "microseconds": 450486 } }
5714 { 'event': 'BLOCK_JOB_ERROR',
5715   'data': { 'device'   : 'str',
5716             'operation': 'IoOperationType',
5717             'action'   : 'BlockErrorAction' } }
5720 # @BLOCK_JOB_READY:
5722 # Emitted when a block job is ready to complete
5724 # @type: job type
5726 # @device: The job identifier.  Originally the device name but other
5727 #     values are allowed since QEMU 2.7
5729 # @len: maximum progress value
5731 # @offset: current progress value.  On success this is equal to len.
5732 #     On failure this is less than len
5734 # @speed: rate limit, bytes per second
5736 # Note: The "ready to complete" status is always reset by a
5737 #     @BLOCK_JOB_ERROR event
5739 # Since: 1.3
5741 # Example:
5743 # <- { "event": "BLOCK_JOB_READY",
5744 #      "data": { "device": "drive0", "type": "mirror", "speed": 0,
5745 #                "len": 2097152, "offset": 2097152 },
5746 #      "timestamp": { "seconds": 1265044230, "microseconds": 450486 } }
5748 { 'event': 'BLOCK_JOB_READY',
5749   'data': { 'type'  : 'JobType',
5750             'device': 'str',
5751             'len'   : 'int',
5752             'offset': 'int',
5753             'speed' : 'int' } }
5756 # @BLOCK_JOB_PENDING:
5758 # Emitted when a block job is awaiting explicit authorization to
5759 # finalize graph changes via @block-job-finalize.  If this job is part
5760 # of a transaction, it will not emit this event until the transaction
5761 # has converged first.
5763 # @type: job type
5765 # @id: The job identifier.
5767 # Since: 2.12
5769 # Example:
5771 # <- { "event": "BLOCK_JOB_PENDING",
5772 #      "data": { "type": "mirror", "id": "backup_1" },
5773 #      "timestamp": { "seconds": 1265044230, "microseconds": 450486 } }
5775 { 'event': 'BLOCK_JOB_PENDING',
5776   'data': { 'type'  : 'JobType',
5777             'id'    : 'str' } }
5780 # @PreallocMode:
5782 # Preallocation mode of QEMU image file
5784 # @off: no preallocation
5786 # @metadata: preallocate only for metadata
5788 # @falloc: like @full preallocation but allocate disk space by
5789 #     posix_fallocate() rather than writing data.
5791 # @full: preallocate all data by writing it to the device to ensure
5792 #     disk space is really available.  This data may or may not be
5793 #     zero, depending on the image format and storage.  @full
5794 #     preallocation also sets up metadata correctly.
5796 # Since: 2.2
5798 { 'enum': 'PreallocMode',
5799   'data': [ 'off', 'metadata', 'falloc', 'full' ] }
5802 # @BLOCK_WRITE_THRESHOLD:
5804 # Emitted when writes on block device reaches or exceeds the
5805 # configured write threshold.  For thin-provisioned devices, this
5806 # means the device should be extended to avoid pausing for disk
5807 # exhaustion.  The event is one shot.  Once triggered, it needs to be
5808 # re-registered with another block-set-write-threshold command.
5810 # @node-name: graph node name on which the threshold was exceeded.
5812 # @amount-exceeded: amount of data which exceeded the threshold, in
5813 #     bytes.
5815 # @write-threshold: last configured threshold, in bytes.
5817 # Since: 2.3
5819 { 'event': 'BLOCK_WRITE_THRESHOLD',
5820   'data': { 'node-name': 'str',
5821             'amount-exceeded': 'uint64',
5822             'write-threshold': 'uint64' } }
5825 # @block-set-write-threshold:
5827 # Change the write threshold for a block drive.  An event will be
5828 # delivered if a write to this block drive crosses the configured
5829 # threshold.  The threshold is an offset, thus must be non-negative.
5830 # Default is no write threshold.  Setting the threshold to zero
5831 # disables it.
5833 # This is useful to transparently resize thin-provisioned drives
5834 # without the guest OS noticing.
5836 # @node-name: graph node name on which the threshold must be set.
5838 # @write-threshold: configured threshold for the block device, bytes.
5839 #     Use 0 to disable the threshold.
5841 # Since: 2.3
5843 # Example:
5845 # -> { "execute": "block-set-write-threshold",
5846 #      "arguments": { "node-name": "mydev",
5847 #                     "write-threshold": 17179869184 } }
5848 # <- { "return": {} }
5850 { 'command': 'block-set-write-threshold',
5851   'data': { 'node-name': 'str', 'write-threshold': 'uint64' },
5852   'allow-preconfig': true }
5855 # @x-blockdev-change:
5857 # Dynamically reconfigure the block driver state graph.  It can be
5858 # used to add, remove, insert or replace a graph node.  Currently only
5859 # the Quorum driver implements this feature to add or remove its
5860 # child.  This is useful to fix a broken quorum child.
5862 # If @node is specified, it will be inserted under @parent.  @child
5863 # may not be specified in this case.  If both @parent and @child are
5864 # specified but @node is not, @child will be detached from @parent.
5866 # @parent: the id or name of the parent node.
5868 # @child: the name of a child under the given parent node.
5870 # @node: the name of the node that will be added.
5872 # Features:
5874 # @unstable: This command is experimental, and its API is not stable.
5875 #     It does not support all kinds of operations, all kinds of
5876 #     children, nor all block drivers.
5878 #     FIXME Removing children from a quorum node means introducing
5879 #     gaps in the child indices.  This cannot be represented in the
5880 #     'children' list of BlockdevOptionsQuorum, as returned by
5881 #     .bdrv_refresh_filename().
5883 #     Warning: The data in a new quorum child MUST be consistent with
5884 #     that of the rest of the array.
5886 # Since: 2.7
5888 # Examples:
5890 # 1. Add a new node to a quorum
5892 # -> { "execute": "blockdev-add",
5893 #      "arguments": {
5894 #          "driver": "raw",
5895 #          "node-name": "new_node",
5896 #          "file": { "driver": "file",
5897 #                    "filename": "test.raw" } } }
5898 # <- { "return": {} }
5899 # -> { "execute": "x-blockdev-change",
5900 #      "arguments": { "parent": "disk1",
5901 #                     "node": "new_node" } }
5902 # <- { "return": {} }
5904 # 2. Delete a quorum's node
5906 # -> { "execute": "x-blockdev-change",
5907 #      "arguments": { "parent": "disk1",
5908 #                     "child": "children.1" } }
5909 # <- { "return": {} }
5911 { 'command': 'x-blockdev-change',
5912   'data' : { 'parent': 'str',
5913              '*child': 'str',
5914              '*node': 'str' },
5915   'features': [ 'unstable' ],
5916   'allow-preconfig': true }
5919 # @x-blockdev-set-iothread:
5921 # Move @node and its children into the @iothread.  If @iothread is
5922 # null then move @node and its children into the main loop.
5924 # The node must not be attached to a BlockBackend.
5926 # @node-name: the name of the block driver node
5928 # @iothread: the name of the IOThread object or null for the main loop
5930 # @force: true if the node and its children should be moved when a
5931 #     BlockBackend is already attached
5933 # Features:
5935 # @unstable: This command is experimental and intended for test cases
5936 #     that need control over IOThreads only.
5938 # Since: 2.12
5940 # Examples:
5942 # 1. Move a node into an IOThread
5944 # -> { "execute": "x-blockdev-set-iothread",
5945 #      "arguments": { "node-name": "disk1",
5946 #                     "iothread": "iothread0" } }
5947 # <- { "return": {} }
5949 # 2. Move a node into the main loop
5951 # -> { "execute": "x-blockdev-set-iothread",
5952 #      "arguments": { "node-name": "disk1",
5953 #                     "iothread": null } }
5954 # <- { "return": {} }
5956 { 'command': 'x-blockdev-set-iothread',
5957   'data' : { 'node-name': 'str',
5958              'iothread': 'StrOrNull',
5959              '*force': 'bool' },
5960   'features': [ 'unstable' ],
5961   'allow-preconfig': true }
5964 # @QuorumOpType:
5966 # An enumeration of the quorum operation types
5968 # @read: read operation
5970 # @write: write operation
5972 # @flush: flush operation
5974 # Since: 2.6
5976 { 'enum': 'QuorumOpType',
5977   'data': [ 'read', 'write', 'flush' ] }
5980 # @QUORUM_FAILURE:
5982 # Emitted by the Quorum block driver if it fails to establish a quorum
5984 # @reference: device name if defined else node name
5986 # @sector-num: number of the first sector of the failed read operation
5988 # @sectors-count: failed read operation sector count
5990 # Note: This event is rate-limited.
5992 # Since: 2.0
5994 # Example:
5996 # <- { "event": "QUORUM_FAILURE",
5997 #      "data": { "reference": "usr1", "sector-num": 345435, "sectors-count": 5 },
5998 #      "timestamp": { "seconds": 1344522075, "microseconds": 745528 } }
6000 { 'event': 'QUORUM_FAILURE',
6001   'data': { 'reference': 'str', 'sector-num': 'int', 'sectors-count': 'int' } }
6004 # @QUORUM_REPORT_BAD:
6006 # Emitted to report a corruption of a Quorum file
6008 # @type: quorum operation type (Since 2.6)
6010 # @error: error message.  Only present on failure.  This field
6011 #     contains a human-readable error message.  There are no semantics
6012 #     other than that the block layer reported an error and clients
6013 #     should not try to interpret the error string.
6015 # @node-name: the graph node name of the block driver state
6017 # @sector-num: number of the first sector of the failed read operation
6019 # @sectors-count: failed read operation sector count
6021 # Note: This event is rate-limited.
6023 # Since: 2.0
6025 # Examples:
6027 # 1. Read operation
6029 # <- { "event": "QUORUM_REPORT_BAD",
6030 #      "data": { "node-name": "node0", "sector-num": 345435, "sectors-count": 5,
6031 #                "type": "read" },
6032 #      "timestamp": { "seconds": 1344522075, "microseconds": 745528 } }
6034 # 2. Flush operation
6036 # <- { "event": "QUORUM_REPORT_BAD",
6037 #      "data": { "node-name": "node0", "sector-num": 0, "sectors-count": 2097120,
6038 #                "type": "flush", "error": "Broken pipe" },
6039 #      "timestamp": { "seconds": 1456406829, "microseconds": 291763 } }
6041 { 'event': 'QUORUM_REPORT_BAD',
6042   'data': { 'type': 'QuorumOpType', '*error': 'str', 'node-name': 'str',
6043             'sector-num': 'int', 'sectors-count': 'int' } }
6046 # @BlockdevSnapshotInternal:
6048 # @device: the device name or node-name of a root node to generate the
6049 #     snapshot from
6051 # @name: the name of the internal snapshot to be created
6053 # Notes: In transaction, if @name is empty, or any snapshot matching
6054 #     @name exists, the operation will fail.  Only some image formats
6055 #     support it, for example, qcow2, and rbd.
6057 # Since: 1.7
6059 { 'struct': 'BlockdevSnapshotInternal',
6060   'data': { 'device': 'str', 'name': 'str' } }
6063 # @blockdev-snapshot-internal-sync:
6065 # Synchronously take an internal snapshot of a block device, when the
6066 # format of the image used supports it.  If the name is an empty
6067 # string, or a snapshot with name already exists, the operation will
6068 # fail.
6070 # For the arguments, see the documentation of
6071 # BlockdevSnapshotInternal.
6073 # Returns:
6074 #     - nothing on success
6075 #     - If @device is not a valid block device, GenericError
6076 #     - If any snapshot matching @name exists, or @name is empty,
6077 #       GenericError
6078 #     - If the format of the image used does not support it,
6079 #       GenericError
6081 # Since: 1.7
6083 # Example:
6085 # -> { "execute": "blockdev-snapshot-internal-sync",
6086 #      "arguments": { "device": "ide-hd0",
6087 #                     "name": "snapshot0" }
6088 #    }
6089 # <- { "return": {} }
6091 { 'command': 'blockdev-snapshot-internal-sync',
6092   'data': 'BlockdevSnapshotInternal',
6093   'allow-preconfig': true }
6096 # @blockdev-snapshot-delete-internal-sync:
6098 # Synchronously delete an internal snapshot of a block device, when
6099 # the format of the image used support it.  The snapshot is identified
6100 # by name or id or both.  One of the name or id is required.  Return
6101 # SnapshotInfo for the successfully deleted snapshot.
6103 # @device: the device name or node-name of a root node to delete the
6104 #     snapshot from
6106 # @id: optional the snapshot's ID to be deleted
6108 # @name: optional the snapshot's name to be deleted
6110 # Returns:
6111 #     - SnapshotInfo on success
6112 #     - If @device is not a valid block device, GenericError
6113 #     - If snapshot not found, GenericError
6114 #     - If the format of the image used does not support it,
6115 #       GenericError
6116 #     - If @id and @name are both not specified, GenericError
6118 # Since: 1.7
6120 # Example:
6122 # -> { "execute": "blockdev-snapshot-delete-internal-sync",
6123 #      "arguments": { "device": "ide-hd0",
6124 #                     "name": "snapshot0" }
6125 #    }
6126 # <- { "return": {
6127 #                    "id": "1",
6128 #                    "name": "snapshot0",
6129 #                    "vm-state-size": 0,
6130 #                    "date-sec": 1000012,
6131 #                    "date-nsec": 10,
6132 #                    "vm-clock-sec": 100,
6133 #                    "vm-clock-nsec": 20,
6134 #                    "icount": 220414
6135 #      }
6136 #    }
6138 { 'command': 'blockdev-snapshot-delete-internal-sync',
6139   'data': { 'device': 'str', '*id': 'str', '*name': 'str'},
6140   'returns': 'SnapshotInfo',
6141   'allow-preconfig': true }
6144 # @DummyBlockCoreForceArrays:
6146 # Not used by QMP; hack to let us use BlockGraphInfoList internally
6148 # Since: 8.0
6150 { 'struct': 'DummyBlockCoreForceArrays',
6151   'data': { 'unused-block-graph-info': ['BlockGraphInfo'] } }