MAINTAINERS: Add section "Migration dirty limit and dirty page rate"
[qemu/armbru.git] / qapi / block-core.json
blob2b1d493d6e09470c03142c215887178c1a61eb21
1 # -*- Mode: Python -*-
2 # vim: filetype=python
4 ##
5 # == Block core (VM unrelated)
6 ##
8 { 'include': 'common.json' }
9 { 'include': 'crypto.json' }
10 { 'include': 'job.json' }
11 { 'include': 'sockets.json' }
14 # @SnapshotInfo:
16 # @id: unique snapshot id
18 # @name: user chosen name
20 # @vm-state-size: size of the VM state
22 # @date-sec: UTC date of the snapshot in seconds
24 # @date-nsec: fractional part in nano seconds to be used with date-sec
26 # @vm-clock-sec: VM clock relative to boot in seconds
28 # @vm-clock-nsec: fractional part in nano seconds to be used with
29 #     vm-clock-sec
31 # @icount: Current instruction count.  Appears when execution
32 #     record/replay is enabled.  Used for "time-traveling" to match
33 #     the moment in the recorded execution with the snapshots.  This
34 #     counter may be obtained through @query-replay command (since
35 #     5.2)
37 # Since: 1.3
39 { 'struct': 'SnapshotInfo',
40   'data': { 'id': 'str', 'name': 'str', 'vm-state-size': 'int',
41             'date-sec': 'int', 'date-nsec': 'int',
42             'vm-clock-sec': 'int', 'vm-clock-nsec': 'int',
43             '*icount': 'int' } }
46 # @ImageInfoSpecificQCow2EncryptionBase:
48 # @format: The encryption format
50 # Since: 2.10
52 { 'struct': 'ImageInfoSpecificQCow2EncryptionBase',
53   'data': { 'format': 'BlockdevQcow2EncryptionFormat'}}
56 # @ImageInfoSpecificQCow2Encryption:
58 # Since: 2.10
60 { 'union': 'ImageInfoSpecificQCow2Encryption',
61   'base': 'ImageInfoSpecificQCow2EncryptionBase',
62   'discriminator': 'format',
63   'data': { 'luks': 'QCryptoBlockInfoLUKS' } }
66 # @ImageInfoSpecificQCow2:
68 # @compat: compatibility level
70 # @data-file: the filename of the external data file that is stored in
71 #     the image and used as a default for opening the image
72 #     (since: 4.0)
74 # @data-file-raw: True if the external data file must stay valid as a
75 #     standalone (read-only) raw image without looking at qcow2
76 #     metadata (since: 4.0)
78 # @extended-l2: true if the image has extended L2 entries; only valid
79 #     for compat >= 1.1 (since 5.2)
81 # @lazy-refcounts: on or off; only valid for compat >= 1.1
83 # @corrupt: true if the image has been marked corrupt; only valid for
84 #     compat >= 1.1 (since 2.2)
86 # @refcount-bits: width of a refcount entry in bits (since 2.3)
88 # @encrypt: details about encryption parameters; only set if image is
89 #     encrypted (since 2.10)
91 # @bitmaps: A list of qcow2 bitmap details (since 4.0)
93 # @compression-type: the image cluster compression method (since 5.1)
95 # Since: 1.7
97 { 'struct': 'ImageInfoSpecificQCow2',
98   'data': {
99       'compat': 'str',
100       '*data-file': 'str',
101       '*data-file-raw': 'bool',
102       '*extended-l2': 'bool',
103       '*lazy-refcounts': 'bool',
104       '*corrupt': 'bool',
105       'refcount-bits': 'int',
106       '*encrypt': 'ImageInfoSpecificQCow2Encryption',
107       '*bitmaps': ['Qcow2BitmapInfo'],
108       'compression-type': 'Qcow2CompressionType'
109   } }
112 # @ImageInfoSpecificVmdk:
114 # @create-type: The create type of VMDK image
116 # @cid: Content id of image
118 # @parent-cid: Parent VMDK image's cid
120 # @extents: List of extent files
122 # Since: 1.7
124 { 'struct': 'ImageInfoSpecificVmdk',
125   'data': {
126       'create-type': 'str',
127       'cid': 'int',
128       'parent-cid': 'int',
129       'extents': ['VmdkExtentInfo']
130   } }
133 # @VmdkExtentInfo:
135 # Information about a VMDK extent file
137 # @filename: Name of the extent file
139 # @format: Extent type (e.g. FLAT or SPARSE)
141 # @virtual-size: Number of bytes covered by this extent
143 # @cluster-size: Cluster size in bytes (for non-flat extents)
145 # @compressed: Whether this extent contains compressed data
147 # Since: 8.0
149 { 'struct': 'VmdkExtentInfo',
150   'data': {
151       'filename': 'str',
152       'format': 'str',
153       'virtual-size': 'int',
154       '*cluster-size': 'int',
155       '*compressed': 'bool'
156   } }
159 # @ImageInfoSpecificRbd:
161 # @encryption-format: Image encryption format
163 # Since: 6.1
165 { 'struct': 'ImageInfoSpecificRbd',
166   'data': {
167       '*encryption-format': 'RbdImageEncryptionFormat'
168   } }
171 # @ImageInfoSpecificFile:
173 # @extent-size-hint: Extent size hint (if available)
175 # Since: 8.0
177 { 'struct': 'ImageInfoSpecificFile',
178   'data': {
179       '*extent-size-hint': 'size'
180   } }
183 # @ImageInfoSpecificKind:
185 # @luks: Since 2.7
187 # @rbd: Since 6.1
189 # @file: Since 8.0
191 # Since: 1.7
193 { 'enum': 'ImageInfoSpecificKind',
194   'data': [ 'qcow2', 'vmdk', 'luks', 'rbd', 'file' ] }
197 # @ImageInfoSpecificQCow2Wrapper:
199 # Since: 1.7
201 { 'struct': 'ImageInfoSpecificQCow2Wrapper',
202   'data': { 'data': 'ImageInfoSpecificQCow2' } }
205 # @ImageInfoSpecificVmdkWrapper:
207 # Since: 6.1
209 { 'struct': 'ImageInfoSpecificVmdkWrapper',
210   'data': { 'data': 'ImageInfoSpecificVmdk' } }
213 # @ImageInfoSpecificLUKSWrapper:
215 # Since: 2.7
217 { 'struct': 'ImageInfoSpecificLUKSWrapper',
218   'data': { 'data': 'QCryptoBlockInfoLUKS' } }
219 # If we need to add block driver specific parameters for
220 # LUKS in future, then we'll subclass QCryptoBlockInfoLUKS
221 # to define a ImageInfoSpecificLUKS
224 # @ImageInfoSpecificRbdWrapper:
226 # Since: 6.1
228 { 'struct': 'ImageInfoSpecificRbdWrapper',
229   'data': { 'data': 'ImageInfoSpecificRbd' } }
232 # @ImageInfoSpecificFileWrapper:
234 # Since: 8.0
236 { 'struct': 'ImageInfoSpecificFileWrapper',
237   'data': { 'data': 'ImageInfoSpecificFile' } }
240 # @ImageInfoSpecific:
242 # A discriminated record of image format specific information
243 # structures.
245 # Since: 1.7
247 { 'union': 'ImageInfoSpecific',
248   'base': { 'type': 'ImageInfoSpecificKind' },
249   'discriminator': 'type',
250   'data': {
251       'qcow2': 'ImageInfoSpecificQCow2Wrapper',
252       'vmdk': 'ImageInfoSpecificVmdkWrapper',
253       'luks': 'ImageInfoSpecificLUKSWrapper',
254       'rbd': 'ImageInfoSpecificRbdWrapper',
255       'file': 'ImageInfoSpecificFileWrapper'
256   } }
259 # @BlockNodeInfo:
261 # Information about a QEMU image file
263 # @filename: name of the image file
265 # @format: format of the image file
267 # @virtual-size: maximum capacity in bytes of the image
269 # @actual-size: actual size on disk in bytes of the image
271 # @dirty-flag: true if image is not cleanly closed
273 # @cluster-size: size of a cluster in bytes
275 # @encrypted: true if the image is encrypted
277 # @compressed: true if the image is compressed (Since 1.7)
279 # @backing-filename: name of the backing file
281 # @full-backing-filename: full path of the backing file
283 # @backing-filename-format: the format of the backing file
285 # @snapshots: list of VM snapshots
287 # @format-specific: structure supplying additional format-specific
288 #     information (since 1.7)
290 # Since: 8.0
292 { 'struct': 'BlockNodeInfo',
293   'data': {'filename': 'str', 'format': 'str', '*dirty-flag': 'bool',
294            '*actual-size': 'int', 'virtual-size': 'int',
295            '*cluster-size': 'int', '*encrypted': 'bool', '*compressed': 'bool',
296            '*backing-filename': 'str', '*full-backing-filename': 'str',
297            '*backing-filename-format': 'str', '*snapshots': ['SnapshotInfo'],
298            '*format-specific': 'ImageInfoSpecific' } }
301 # @ImageInfo:
303 # Information about a QEMU image file, and potentially its backing
304 # image
306 # @backing-image: info of the backing image
308 # Since: 1.3
310 { 'struct': 'ImageInfo',
311   'base': 'BlockNodeInfo',
312   'data': {
313       '*backing-image': 'ImageInfo'
314   } }
317 # @BlockChildInfo:
319 # Information about all nodes in the block graph starting at some
320 # node, annotated with information about that node in relation to its
321 # parent.
323 # @name: Child name of the root node in the BlockGraphInfo struct, in
324 #     its role as the child of some undescribed parent node
326 # @info: Block graph information starting at this node
328 # Since: 8.0
330 { 'struct': 'BlockChildInfo',
331   'data': {
332       'name': 'str',
333       'info': 'BlockGraphInfo'
334   } }
337 # @BlockGraphInfo:
339 # Information about all nodes in a block (sub)graph in the form of
340 # BlockNodeInfo data.  The base BlockNodeInfo struct contains the
341 # information for the (sub)graph's root node.
343 # @children: Array of links to this node's child nodes' information
345 # Since: 8.0
347 { 'struct': 'BlockGraphInfo',
348   'base': 'BlockNodeInfo',
349   'data': { 'children': ['BlockChildInfo'] } }
352 # @ImageCheck:
354 # Information about a QEMU image file check
356 # @filename: name of the image file checked
358 # @format: format of the image file checked
360 # @check-errors: number of unexpected errors occurred during check
362 # @image-end-offset: offset (in bytes) where the image ends, this
363 #     field is present if the driver for the image format supports it
365 # @corruptions: number of corruptions found during the check if any
367 # @leaks: number of leaks found during the check if any
369 # @corruptions-fixed: number of corruptions fixed during the check if
370 #     any
372 # @leaks-fixed: number of leaks fixed during the check if any
374 # @total-clusters: total number of clusters, this field is present if
375 #     the driver for the image format supports it
377 # @allocated-clusters: total number of allocated clusters, this field
378 #     is present if the driver for the image format supports it
380 # @fragmented-clusters: total number of fragmented clusters, this
381 #     field is present if the driver for the image format supports it
383 # @compressed-clusters: total number of compressed clusters, this
384 #     field is present if the driver for the image format supports it
386 # Since: 1.4
388 { 'struct': 'ImageCheck',
389   'data': {'filename': 'str', 'format': 'str', 'check-errors': 'int',
390            '*image-end-offset': 'int', '*corruptions': 'int', '*leaks': 'int',
391            '*corruptions-fixed': 'int', '*leaks-fixed': 'int',
392            '*total-clusters': 'int', '*allocated-clusters': 'int',
393            '*fragmented-clusters': 'int', '*compressed-clusters': 'int' } }
396 # @MapEntry:
398 # Mapping information from a virtual block range to a host file range
400 # @start: virtual (guest) offset of the first byte described by this
401 #     entry
403 # @length: the number of bytes of the mapped virtual range
405 # @data: reading the image will actually read data from a file (in
406 #     particular, if @offset is present this means that the sectors
407 #     are not simply preallocated, but contain actual data in raw
408 #     format)
410 # @zero: whether the virtual blocks read as zeroes
412 # @depth: number of layers (0 = top image, 1 = top image's backing
413 #     file, ..., n - 1 = bottom image (where n is the number of images
414 #     in the chain)) before reaching one for which the range is
415 #     allocated
417 # @present: true if this layer provides the data, false if adding a
418 #     backing layer could impact this region (since 6.1)
420 # @offset: if present, the image file stores the data for this range
421 #     in raw format at the given (host) offset
423 # @filename: filename that is referred to by @offset
425 # Since: 2.6
427 { 'struct': 'MapEntry',
428   'data': {'start': 'int', 'length': 'int', 'data': 'bool',
429            'zero': 'bool', 'depth': 'int', 'present': 'bool',
430            '*offset': 'int', '*filename': 'str' } }
433 # @BlockdevCacheInfo:
435 # Cache mode information for a block device
437 # @writeback: true if writeback mode is enabled
439 # @direct: true if the host page cache is bypassed (O_DIRECT)
441 # @no-flush: true if flush requests are ignored for the device
443 # Since: 2.3
445 { 'struct': 'BlockdevCacheInfo',
446   'data': { 'writeback': 'bool',
447             'direct': 'bool',
448             'no-flush': 'bool' } }
451 # @BlockDeviceInfo:
453 # Information about the backing device for a block device.
455 # @file: the filename of the backing device
457 # @node-name: the name of the block driver node (Since 2.0)
459 # @ro: true if the backing device was open read-only
461 # @drv: the name of the block format used to open the backing device.
462 #     As of 0.14 this can be: 'blkdebug', 'bochs', 'cloop', 'cow',
463 #     'dmg', 'file', 'file', 'ftp', 'ftps', 'host_cdrom',
464 #     'host_device', 'http', 'https', 'luks', 'nbd', 'parallels',
465 #     'qcow', 'qcow2', 'raw', 'vdi', 'vmdk', 'vpc', 'vvfat' 2.2:
466 #     'archipelago' added, 'cow' dropped 2.3: 'host_floppy' deprecated
467 #     2.5: 'host_floppy' dropped 2.6: 'luks' added 2.8: 'replication'
468 #     added, 'tftp' dropped 2.9: 'archipelago' dropped
470 # @backing_file: the name of the backing file (for copy-on-write)
472 # @backing_file_depth: number of files in the backing file chain
473 #     (since: 1.2)
475 # @encrypted: true if the backing device is encrypted
477 # @detect_zeroes: detect and optimize zero writes (Since 2.1)
479 # @bps: total throughput limit in bytes per second is specified
481 # @bps_rd: read throughput limit in bytes per second is specified
483 # @bps_wr: write throughput limit in bytes per second is specified
485 # @iops: total I/O operations per second is specified
487 # @iops_rd: read I/O operations per second is specified
489 # @iops_wr: write I/O operations per second is specified
491 # @image: the info of image used (since: 1.6)
493 # @bps_max: total throughput limit during bursts, in bytes (Since 1.7)
495 # @bps_rd_max: read throughput limit during bursts, in bytes (Since
496 #     1.7)
498 # @bps_wr_max: write throughput limit during bursts, in bytes (Since
499 #     1.7)
501 # @iops_max: total I/O operations per second during bursts, in bytes
502 #     (Since 1.7)
504 # @iops_rd_max: read I/O operations per second during bursts, in bytes
505 #     (Since 1.7)
507 # @iops_wr_max: write I/O operations per second during bursts, in
508 #     bytes (Since 1.7)
510 # @bps_max_length: maximum length of the @bps_max burst period, in
511 #     seconds.  (Since 2.6)
513 # @bps_rd_max_length: maximum length of the @bps_rd_max burst period,
514 #     in seconds.  (Since 2.6)
516 # @bps_wr_max_length: maximum length of the @bps_wr_max burst period,
517 #     in seconds.  (Since 2.6)
519 # @iops_max_length: maximum length of the @iops burst period, in
520 #     seconds.  (Since 2.6)
522 # @iops_rd_max_length: maximum length of the @iops_rd_max burst
523 #     period, in seconds.  (Since 2.6)
525 # @iops_wr_max_length: maximum length of the @iops_wr_max burst
526 #     period, in seconds.  (Since 2.6)
528 # @iops_size: an I/O size in bytes (Since 1.7)
530 # @group: throttle group name (Since 2.4)
532 # @cache: the cache mode used for the block device (since: 2.3)
534 # @write_threshold: configured write threshold for the device.  0 if
535 #     disabled.  (Since 2.3)
537 # @dirty-bitmaps: dirty bitmaps information (only present if node has
538 #     one or more dirty bitmaps) (Since 4.2)
540 # Since: 0.14
542 { 'struct': 'BlockDeviceInfo',
543   'data': { 'file': 'str', '*node-name': 'str', 'ro': 'bool', 'drv': 'str',
544             '*backing_file': 'str', 'backing_file_depth': 'int',
545             'encrypted': 'bool',
546             'detect_zeroes': 'BlockdevDetectZeroesOptions',
547             'bps': 'int', 'bps_rd': 'int', 'bps_wr': 'int',
548             'iops': 'int', 'iops_rd': 'int', 'iops_wr': 'int',
549             'image': 'ImageInfo',
550             '*bps_max': 'int', '*bps_rd_max': 'int',
551             '*bps_wr_max': 'int', '*iops_max': 'int',
552             '*iops_rd_max': 'int', '*iops_wr_max': 'int',
553             '*bps_max_length': 'int', '*bps_rd_max_length': 'int',
554             '*bps_wr_max_length': 'int', '*iops_max_length': 'int',
555             '*iops_rd_max_length': 'int', '*iops_wr_max_length': 'int',
556             '*iops_size': 'int', '*group': 'str', 'cache': 'BlockdevCacheInfo',
557             'write_threshold': 'int', '*dirty-bitmaps': ['BlockDirtyInfo'] } }
560 # @BlockDeviceIoStatus:
562 # An enumeration of block device I/O status.
564 # @ok: The last I/O operation has succeeded
566 # @failed: The last I/O operation has failed
568 # @nospace: The last I/O operation has failed due to a no-space
569 #     condition
571 # Since: 1.0
573 { 'enum': 'BlockDeviceIoStatus', 'data': [ 'ok', 'failed', 'nospace' ] }
576 # @BlockDirtyInfo:
578 # Block dirty bitmap information.
580 # @name: the name of the dirty bitmap (Since 2.4)
582 # @count: number of dirty bytes according to the dirty bitmap
584 # @granularity: granularity of the dirty bitmap in bytes (since 1.4)
586 # @recording: true if the bitmap is recording new writes from the
587 #     guest.  (since 4.0)
589 # @busy: true if the bitmap is in-use by some operation (NBD or jobs)
590 #     and cannot be modified via QMP or used by another operation.
591 #     (since 4.0)
593 # @persistent: true if the bitmap was stored on disk, is scheduled to
594 #     be stored on disk, or both.  (since 4.0)
596 # @inconsistent: true if this is a persistent bitmap that was
597 #     improperly stored.  Implies @persistent to be true; @recording
598 #     and @busy to be false.  This bitmap cannot be used.  To remove
599 #     it, use @block-dirty-bitmap-remove.  (Since 4.0)
601 # Since: 1.3
603 { 'struct': 'BlockDirtyInfo',
604   'data': {'*name': 'str', 'count': 'int', 'granularity': 'uint32',
605            'recording': 'bool', 'busy': 'bool',
606            'persistent': 'bool', '*inconsistent': 'bool' } }
609 # @Qcow2BitmapInfoFlags:
611 # An enumeration of flags that a bitmap can report to the user.
613 # @in-use: This flag is set by any process actively modifying the
614 #     qcow2 file, and cleared when the updated bitmap is flushed to
615 #     the qcow2 image.  The presence of this flag in an offline image
616 #     means that the bitmap was not saved correctly after its last
617 #     usage, and may contain inconsistent data.
619 # @auto: The bitmap must reflect all changes of the virtual disk by
620 #     any application that would write to this qcow2 file.
622 # Since: 4.0
624 { 'enum': 'Qcow2BitmapInfoFlags',
625   'data': ['in-use', 'auto'] }
628 # @Qcow2BitmapInfo:
630 # Qcow2 bitmap information.
632 # @name: the name of the bitmap
634 # @granularity: granularity of the bitmap in bytes
636 # @flags: flags of the bitmap
638 # Since: 4.0
640 { 'struct': 'Qcow2BitmapInfo',
641   'data': {'name': 'str', 'granularity': 'uint32',
642            'flags': ['Qcow2BitmapInfoFlags'] } }
645 # @BlockLatencyHistogramInfo:
647 # Block latency histogram.
649 # @boundaries: list of interval boundary values in nanoseconds, all
650 #     greater than zero and in ascending order.  For example, the list
651 #     [10, 50, 100] produces the following histogram intervals: [0,
652 #     10), [10, 50), [50, 100), [100, +inf).
654 # @bins: list of io request counts corresponding to histogram
655 #     intervals, one more element than @boundaries has.  For the
656 #     example above, @bins may be something like [3, 1, 5, 2], and
657 #     corresponding histogram looks like:
659 # ::
661 #        5|           *
662 #        4|           *
663 #        3| *         *
664 #        2| *         *    *
665 #        1| *    *    *    *
666 #         +------------------
667 #             10   50   100
669 # Since: 4.0
671 { 'struct': 'BlockLatencyHistogramInfo',
672   'data': {'boundaries': ['uint64'], 'bins': ['uint64'] } }
675 # @BlockInfo:
677 # Block device information.  This structure describes a virtual device
678 # and the backing device associated with it.
680 # @device: The device name associated with the virtual device.
682 # @qdev: The qdev ID, or if no ID is assigned, the QOM path of the
683 #     block device.  (since 2.10)
685 # @type: This field is returned only for compatibility reasons, it
686 #     should not be used (always returns 'unknown')
688 # @removable: True if the device supports removable media.
690 # @locked: True if the guest has locked this device from having its
691 #     media removed
693 # @tray_open: True if the device's tray is open (only present if it
694 #     has a tray)
696 # @io-status: @BlockDeviceIoStatus.  Only present if the device
697 #     supports it and the VM is configured to stop on errors
698 #     (supported device models: virtio-blk, IDE, SCSI except
699 #     scsi-generic)
701 # @inserted: @BlockDeviceInfo describing the device if media is
702 #     present
704 # Since: 0.14
706 { 'struct': 'BlockInfo',
707   'data': {'device': 'str', '*qdev': 'str', 'type': 'str', 'removable': 'bool',
708            'locked': 'bool', '*inserted': 'BlockDeviceInfo',
709            '*tray_open': 'bool', '*io-status': 'BlockDeviceIoStatus' } }
712 # @BlockMeasureInfo:
714 # Image file size calculation information.  This structure describes
715 # the size requirements for creating a new image file.
717 # The size requirements depend on the new image file format.  File
718 # size always equals virtual disk size for the 'raw' format, even for
719 # sparse POSIX files.  Compact formats such as 'qcow2' represent
720 # unallocated and zero regions efficiently so file size may be smaller
721 # than virtual disk size.
723 # The values are upper bounds that are guaranteed to fit the new image
724 # file.  Subsequent modification, such as internal snapshot or further
725 # bitmap creation, may require additional space and is not covered
726 # here.
728 # @required: Size required for a new image file, in bytes, when
729 #     copying just allocated guest-visible contents.
731 # @fully-allocated: Image file size, in bytes, once data has been
732 #     written to all sectors, when copying just guest-visible
733 #     contents.
735 # @bitmaps: Additional size required if all the top-level bitmap
736 #     metadata in the source image were to be copied to the
737 #     destination, present only when source and destination both
738 #     support persistent bitmaps.  (since 5.1)
740 # Since: 2.10
742 { 'struct': 'BlockMeasureInfo',
743   'data': {'required': 'int', 'fully-allocated': 'int', '*bitmaps': 'int'} }
746 # @query-block:
748 # Get a list of BlockInfo for all virtual block devices.
750 # Returns: a list of @BlockInfo describing each virtual block device.
751 #     Filter nodes that were created implicitly are skipped over.
753 # Since: 0.14
755 # Example:
757 # -> { "execute": "query-block" }
758 # <- {
759 #       "return":[
760 #          {
761 #             "io-status": "ok",
762 #             "device":"ide0-hd0",
763 #             "locked":false,
764 #             "removable":false,
765 #             "inserted":{
766 #                "ro":false,
767 #                "drv":"qcow2",
768 #                "encrypted":false,
769 #                "file":"disks/test.qcow2",
770 #                "backing_file_depth":1,
771 #                "bps":1000000,
772 #                "bps_rd":0,
773 #                "bps_wr":0,
774 #                "iops":1000000,
775 #                "iops_rd":0,
776 #                "iops_wr":0,
777 #                "bps_max": 8000000,
778 #                "bps_rd_max": 0,
779 #                "bps_wr_max": 0,
780 #                "iops_max": 0,
781 #                "iops_rd_max": 0,
782 #                "iops_wr_max": 0,
783 #                "iops_size": 0,
784 #                "detect_zeroes": "on",
785 #                "write_threshold": 0,
786 #                "image":{
787 #                   "filename":"disks/test.qcow2",
788 #                   "format":"qcow2",
789 #                   "virtual-size":2048000,
790 #                   "backing_file":"base.qcow2",
791 #                   "full-backing-filename":"disks/base.qcow2",
792 #                   "backing-filename-format":"qcow2",
793 #                   "snapshots":[
794 #                      {
795 #                         "id": "1",
796 #                         "name": "snapshot1",
797 #                         "vm-state-size": 0,
798 #                         "date-sec": 10000200,
799 #                         "date-nsec": 12,
800 #                         "vm-clock-sec": 206,
801 #                         "vm-clock-nsec": 30
802 #                      }
803 #                   ],
804 #                   "backing-image":{
805 #                       "filename":"disks/base.qcow2",
806 #                       "format":"qcow2",
807 #                       "virtual-size":2048000
808 #                   }
809 #                }
810 #             },
811 #             "qdev": "ide_disk",
812 #             "type":"unknown"
813 #          },
814 #          {
815 #             "io-status": "ok",
816 #             "device":"ide1-cd0",
817 #             "locked":false,
818 #             "removable":true,
819 #             "qdev": "/machine/unattached/device[23]",
820 #             "tray_open": false,
821 #             "type":"unknown"
822 #          },
823 #          {
824 #             "device":"floppy0",
825 #             "locked":false,
826 #             "removable":true,
827 #             "qdev": "/machine/unattached/device[20]",
828 #             "type":"unknown"
829 #          },
830 #          {
831 #             "device":"sd0",
832 #             "locked":false,
833 #             "removable":true,
834 #             "type":"unknown"
835 #          }
836 #       ]
837 #    }
839 { 'command': 'query-block', 'returns': ['BlockInfo'],
840   'allow-preconfig': true }
843 # @BlockDeviceTimedStats:
845 # Statistics of a block device during a given interval of time.
847 # @interval_length: Interval used for calculating the statistics, in
848 #     seconds.
850 # @min_rd_latency_ns: Minimum latency of read operations in the
851 #     defined interval, in nanoseconds.
853 # @min_wr_latency_ns: Minimum latency of write operations in the
854 #     defined interval, in nanoseconds.
856 # @min_zone_append_latency_ns: Minimum latency of zone append
857 #     operations in the defined interval, in nanoseconds (since 8.1)
859 # @min_flush_latency_ns: Minimum latency of flush operations in the
860 #     defined interval, in nanoseconds.
862 # @max_rd_latency_ns: Maximum latency of read operations in the
863 #     defined interval, in nanoseconds.
865 # @max_wr_latency_ns: Maximum latency of write operations in the
866 #     defined interval, in nanoseconds.
868 # @max_zone_append_latency_ns: Maximum latency of zone append
869 #     operations in the defined interval, in nanoseconds (since 8.1)
871 # @max_flush_latency_ns: Maximum latency of flush operations in the
872 #     defined interval, in nanoseconds.
874 # @avg_rd_latency_ns: Average latency of read operations in the
875 #     defined interval, in nanoseconds.
877 # @avg_wr_latency_ns: Average latency of write operations in the
878 #     defined interval, in nanoseconds.
880 # @avg_zone_append_latency_ns: Average latency of zone append
881 #     operations in the defined interval, in nanoseconds (since 8.1)
883 # @avg_flush_latency_ns: Average latency of flush operations in the
884 #     defined interval, in nanoseconds.
886 # @avg_rd_queue_depth: Average number of pending read operations in
887 #     the defined interval.
889 # @avg_wr_queue_depth: Average number of pending write operations in
890 #     the defined interval.
892 # @avg_zone_append_queue_depth: Average number of pending zone append
893 #     operations in the defined interval (since 8.1).
895 # Since: 2.5
897 { 'struct': 'BlockDeviceTimedStats',
898   'data': { 'interval_length': 'int', 'min_rd_latency_ns': 'int',
899             'max_rd_latency_ns': 'int', 'avg_rd_latency_ns': 'int',
900             'min_wr_latency_ns': 'int', 'max_wr_latency_ns': 'int',
901             'avg_wr_latency_ns': 'int', 'min_zone_append_latency_ns': 'int',
902             'max_zone_append_latency_ns': 'int',
903             'avg_zone_append_latency_ns': 'int',
904             'min_flush_latency_ns': 'int', 'max_flush_latency_ns': 'int',
905             'avg_flush_latency_ns': 'int', 'avg_rd_queue_depth': 'number',
906             'avg_wr_queue_depth': 'number',
907             'avg_zone_append_queue_depth': 'number'  } }
910 # @BlockDeviceStats:
912 # Statistics of a virtual block device or a block backing device.
914 # @rd_bytes: The number of bytes read by the device.
916 # @wr_bytes: The number of bytes written by the device.
918 # @zone_append_bytes: The number of bytes appended by the zoned
919 #     devices (since 8.1)
921 # @unmap_bytes: The number of bytes unmapped by the device (Since 4.2)
923 # @rd_operations: The number of read operations performed by the
924 #     device.
926 # @wr_operations: The number of write operations performed by the
927 #     device.
929 # @zone_append_operations: The number of zone append operations
930 #     performed by the zoned devices (since 8.1)
932 # @flush_operations: The number of cache flush operations performed by
933 #     the device (since 0.15)
935 # @unmap_operations: The number of unmap operations performed by the
936 #     device (Since 4.2)
938 # @rd_total_time_ns: Total time spent on reads in nanoseconds (since
939 #     0.15).
941 # @wr_total_time_ns: Total time spent on writes in nanoseconds (since
942 #     0.15).
944 # @zone_append_total_time_ns: Total time spent on zone append writes
945 #     in nanoseconds (since 8.1)
947 # @flush_total_time_ns: Total time spent on cache flushes in
948 #     nanoseconds (since 0.15).
950 # @unmap_total_time_ns: Total time spent on unmap operations in
951 #     nanoseconds (Since 4.2)
953 # @wr_highest_offset: The offset after the greatest byte written to
954 #     the device.  The intended use of this information is for
955 #     growable sparse files (like qcow2) that are used on top of a
956 #     physical device.
958 # @rd_merged: Number of read requests that have been merged into
959 #     another request (Since 2.3).
961 # @wr_merged: Number of write requests that have been merged into
962 #     another request (Since 2.3).
964 # @zone_append_merged: Number of zone append requests that have been
965 #     merged into another request (since 8.1)
967 # @unmap_merged: Number of unmap requests that have been merged into
968 #     another request (Since 4.2)
970 # @idle_time_ns: Time since the last I/O operation, in nanoseconds.
971 #     If the field is absent it means that there haven't been any
972 #     operations yet (Since 2.5).
974 # @failed_rd_operations: The number of failed read operations
975 #     performed by the device (Since 2.5)
977 # @failed_wr_operations: The number of failed write operations
978 #     performed by the device (Since 2.5)
980 # @failed_zone_append_operations: The number of failed zone append
981 #     write operations performed by the zoned devices (since 8.1)
983 # @failed_flush_operations: The number of failed flush operations
984 #     performed by the device (Since 2.5)
986 # @failed_unmap_operations: The number of failed unmap operations
987 #     performed by the device (Since 4.2)
989 # @invalid_rd_operations: The number of invalid read operations
990 #     performed by the device (Since 2.5)
992 # @invalid_wr_operations: The number of invalid write operations
993 #     performed by the device (Since 2.5)
995 # @invalid_zone_append_operations: The number of invalid zone append
996 #     operations performed by the zoned device (since 8.1)
998 # @invalid_flush_operations: The number of invalid flush operations
999 #     performed by the device (Since 2.5)
1001 # @invalid_unmap_operations: The number of invalid unmap operations
1002 #     performed by the device (Since 4.2)
1004 # @account_invalid: Whether invalid operations are included in the
1005 #     last access statistics (Since 2.5)
1007 # @account_failed: Whether failed operations are included in the
1008 #     latency and last access statistics (Since 2.5)
1010 # @timed_stats: Statistics specific to the set of previously defined
1011 #     intervals of time (Since 2.5)
1013 # @rd_latency_histogram: @BlockLatencyHistogramInfo.  (Since 4.0)
1015 # @wr_latency_histogram: @BlockLatencyHistogramInfo.  (Since 4.0)
1017 # @zone_append_latency_histogram: @BlockLatencyHistogramInfo.
1018 #     (since 8.1)
1020 # @flush_latency_histogram: @BlockLatencyHistogramInfo.  (Since 4.0)
1022 # Since: 0.14
1024 { 'struct': 'BlockDeviceStats',
1025   'data': {'rd_bytes': 'int', 'wr_bytes': 'int', 'zone_append_bytes': 'int',
1026            'unmap_bytes' : 'int', 'rd_operations': 'int',
1027            'wr_operations': 'int', 'zone_append_operations': 'int',
1028            'flush_operations': 'int', 'unmap_operations': 'int',
1029            'rd_total_time_ns': 'int', 'wr_total_time_ns': 'int',
1030            'zone_append_total_time_ns': 'int', 'flush_total_time_ns': 'int',
1031            'unmap_total_time_ns': 'int', 'wr_highest_offset': 'int',
1032            'rd_merged': 'int', 'wr_merged': 'int', 'zone_append_merged': 'int',
1033            'unmap_merged': 'int', '*idle_time_ns': 'int',
1034            'failed_rd_operations': 'int', 'failed_wr_operations': 'int',
1035            'failed_zone_append_operations': 'int',
1036            'failed_flush_operations': 'int',
1037            'failed_unmap_operations': 'int', 'invalid_rd_operations': 'int',
1038            'invalid_wr_operations': 'int',
1039            'invalid_zone_append_operations': 'int',
1040            'invalid_flush_operations': 'int', 'invalid_unmap_operations': 'int',
1041            'account_invalid': 'bool', 'account_failed': 'bool',
1042            'timed_stats': ['BlockDeviceTimedStats'],
1043            '*rd_latency_histogram': 'BlockLatencyHistogramInfo',
1044            '*wr_latency_histogram': 'BlockLatencyHistogramInfo',
1045            '*zone_append_latency_histogram': 'BlockLatencyHistogramInfo',
1046            '*flush_latency_histogram': 'BlockLatencyHistogramInfo' } }
1049 # @BlockStatsSpecificFile:
1051 # File driver statistics
1053 # @discard-nb-ok: The number of successful discard operations
1054 #     performed by the driver.
1056 # @discard-nb-failed: The number of failed discard operations
1057 #     performed by the driver.
1059 # @discard-bytes-ok: The number of bytes discarded by the driver.
1061 # Since: 4.2
1063 { 'struct': 'BlockStatsSpecificFile',
1064   'data': {
1065       'discard-nb-ok': 'uint64',
1066       'discard-nb-failed': 'uint64',
1067       'discard-bytes-ok': 'uint64' } }
1070 # @BlockStatsSpecificNvme:
1072 # NVMe driver statistics
1074 # @completion-errors: The number of completion errors.
1076 # @aligned-accesses: The number of aligned accesses performed by the
1077 #     driver.
1079 # @unaligned-accesses: The number of unaligned accesses performed by
1080 #     the driver.
1082 # Since: 5.2
1084 { 'struct': 'BlockStatsSpecificNvme',
1085   'data': {
1086       'completion-errors': 'uint64',
1087       'aligned-accesses': 'uint64',
1088       'unaligned-accesses': 'uint64' } }
1091 # @BlockStatsSpecific:
1093 # Block driver specific statistics
1095 # Since: 4.2
1097 { 'union': 'BlockStatsSpecific',
1098   'base': { 'driver': 'BlockdevDriver' },
1099   'discriminator': 'driver',
1100   'data': {
1101       'file': 'BlockStatsSpecificFile',
1102       'host_device': { 'type': 'BlockStatsSpecificFile',
1103                        'if': 'HAVE_HOST_BLOCK_DEVICE' },
1104       'nvme': 'BlockStatsSpecificNvme' } }
1107 # @BlockStats:
1109 # Statistics of a virtual block device or a block backing device.
1111 # @device: If the stats are for a virtual block device, the name
1112 #     corresponding to the virtual block device.
1114 # @node-name: The node name of the device.  (Since 2.3)
1116 # @qdev: The qdev ID, or if no ID is assigned, the QOM path of the
1117 #     block device.  (since 3.0)
1119 # @stats: A @BlockDeviceStats for the device.
1121 # @driver-specific: Optional driver-specific stats.  (Since 4.2)
1123 # @parent: This describes the file block device if it has one.
1124 #     Contains recursively the statistics of the underlying protocol
1125 #     (e.g. the host file for a qcow2 image).  If there is no
1126 #     underlying protocol, this field is omitted
1128 # @backing: This describes the backing block device if it has one.
1129 #     (Since 2.0)
1131 # Since: 0.14
1133 { 'struct': 'BlockStats',
1134   'data': {'*device': 'str', '*qdev': 'str', '*node-name': 'str',
1135            'stats': 'BlockDeviceStats',
1136            '*driver-specific': 'BlockStatsSpecific',
1137            '*parent': 'BlockStats',
1138            '*backing': 'BlockStats'} }
1141 # @query-blockstats:
1143 # Query the @BlockStats for all virtual block devices.
1145 # @query-nodes: If true, the command will query all the block nodes
1146 #     that have a node name, in a list which will include "parent"
1147 #     information, but not "backing". If false or omitted, the
1148 #     behavior is as before - query all the device backends,
1149 #     recursively including their "parent" and "backing". Filter nodes
1150 #     that were created implicitly are skipped over in this mode.
1151 #     (Since 2.3)
1153 # Returns: A list of @BlockStats for each virtual block devices.
1155 # Since: 0.14
1157 # Example:
1159 # -> { "execute": "query-blockstats" }
1160 # <- {
1161 #       "return":[
1162 #          {
1163 #             "device":"ide0-hd0",
1164 #             "parent":{
1165 #                "stats":{
1166 #                   "wr_highest_offset":3686448128,
1167 #                   "wr_bytes":9786368,
1168 #                   "wr_operations":751,
1169 #                   "rd_bytes":122567168,
1170 #                   "rd_operations":36772
1171 #                   "wr_total_times_ns":313253456
1172 #                   "rd_total_times_ns":3465673657
1173 #                   "flush_total_times_ns":49653
1174 #                   "flush_operations":61,
1175 #                   "rd_merged":0,
1176 #                   "wr_merged":0,
1177 #                   "idle_time_ns":2953431879,
1178 #                   "account_invalid":true,
1179 #                   "account_failed":false
1180 #                }
1181 #             },
1182 #             "stats":{
1183 #                "wr_highest_offset":2821110784,
1184 #                "wr_bytes":9786368,
1185 #                "wr_operations":692,
1186 #                "rd_bytes":122739200,
1187 #                "rd_operations":36604
1188 #                "flush_operations":51,
1189 #                "wr_total_times_ns":313253456
1190 #                "rd_total_times_ns":3465673657
1191 #                "flush_total_times_ns":49653,
1192 #                "rd_merged":0,
1193 #                "wr_merged":0,
1194 #                "idle_time_ns":2953431879,
1195 #                "account_invalid":true,
1196 #                "account_failed":false
1197 #             },
1198 #             "qdev": "/machine/unattached/device[23]"
1199 #          },
1200 #          {
1201 #             "device":"ide1-cd0",
1202 #             "stats":{
1203 #                "wr_highest_offset":0,
1204 #                "wr_bytes":0,
1205 #                "wr_operations":0,
1206 #                "rd_bytes":0,
1207 #                "rd_operations":0
1208 #                "flush_operations":0,
1209 #                "wr_total_times_ns":0
1210 #                "rd_total_times_ns":0
1211 #                "flush_total_times_ns":0,
1212 #                "rd_merged":0,
1213 #                "wr_merged":0,
1214 #                "account_invalid":false,
1215 #                "account_failed":false
1216 #             },
1217 #             "qdev": "/machine/unattached/device[24]"
1218 #          },
1219 #          {
1220 #             "device":"floppy0",
1221 #             "stats":{
1222 #                "wr_highest_offset":0,
1223 #                "wr_bytes":0,
1224 #                "wr_operations":0,
1225 #                "rd_bytes":0,
1226 #                "rd_operations":0
1227 #                "flush_operations":0,
1228 #                "wr_total_times_ns":0
1229 #                "rd_total_times_ns":0
1230 #                "flush_total_times_ns":0,
1231 #                "rd_merged":0,
1232 #                "wr_merged":0,
1233 #                "account_invalid":false,
1234 #                "account_failed":false
1235 #             },
1236 #             "qdev": "/machine/unattached/device[16]"
1237 #          },
1238 #          {
1239 #             "device":"sd0",
1240 #             "stats":{
1241 #                "wr_highest_offset":0,
1242 #                "wr_bytes":0,
1243 #                "wr_operations":0,
1244 #                "rd_bytes":0,
1245 #                "rd_operations":0
1246 #                "flush_operations":0,
1247 #                "wr_total_times_ns":0
1248 #                "rd_total_times_ns":0
1249 #                "flush_total_times_ns":0,
1250 #                "rd_merged":0,
1251 #                "wr_merged":0,
1252 #                "account_invalid":false,
1253 #                "account_failed":false
1254 #             }
1255 #          }
1256 #       ]
1257 #    }
1259 { 'command': 'query-blockstats',
1260   'data': { '*query-nodes': 'bool' },
1261   'returns': ['BlockStats'],
1262   'allow-preconfig': true }
1265 # @BlockdevOnError:
1267 # An enumeration of possible behaviors for errors on I/O operations.
1268 # The exact meaning depends on whether the I/O was initiated by a
1269 # guest or by a block job
1271 # @report: for guest operations, report the error to the guest; for
1272 #     jobs, cancel the job
1274 # @ignore: ignore the error, only report a QMP event (BLOCK_IO_ERROR
1275 #     or BLOCK_JOB_ERROR). The backup, mirror and commit block jobs
1276 #     retry the failing request later and may still complete
1277 #     successfully.  The stream block job continues to stream and will
1278 #     complete with an error.
1280 # @enospc: same as @stop on ENOSPC, same as @report otherwise.
1282 # @stop: for guest operations, stop the virtual machine; for jobs,
1283 #     pause the job
1285 # @auto: inherit the error handling policy of the backend (since: 2.7)
1287 # Since: 1.3
1289 { 'enum': 'BlockdevOnError',
1290   'data': ['report', 'ignore', 'enospc', 'stop', 'auto'] }
1293 # @MirrorSyncMode:
1295 # An enumeration of possible behaviors for the initial synchronization
1296 # phase of storage mirroring.
1298 # @top: copies data in the topmost image to the destination
1300 # @full: copies data from all images to the destination
1302 # @none: only copy data written from now on
1304 # @incremental: only copy data described by the dirty bitmap.
1305 #     (since: 2.4)
1307 # @bitmap: only copy data described by the dirty bitmap.  (since: 4.2)
1308 #     Behavior on completion is determined by the BitmapSyncMode.
1310 # Since: 1.3
1312 { 'enum': 'MirrorSyncMode',
1313   'data': ['top', 'full', 'none', 'incremental', 'bitmap'] }
1316 # @BitmapSyncMode:
1318 # An enumeration of possible behaviors for the synchronization of a
1319 # bitmap when used for data copy operations.
1321 # @on-success: The bitmap is only synced when the operation is
1322 #     successful.  This is the behavior always used for 'INCREMENTAL'
1323 #     backups.
1325 # @never: The bitmap is never synchronized with the operation, and is
1326 #     treated solely as a read-only manifest of blocks to copy.
1328 # @always: The bitmap is always synchronized with the operation,
1329 #     regardless of whether or not the operation was successful.
1331 # Since: 4.2
1333 { 'enum': 'BitmapSyncMode',
1334   'data': ['on-success', 'never', 'always'] }
1337 # @MirrorCopyMode:
1339 # An enumeration whose values tell the mirror block job when to
1340 # trigger writes to the target.
1342 # @background: copy data in background only.
1344 # @write-blocking: when data is written to the source, write it
1345 #     (synchronously) to the target as well.  In addition, data is
1346 #     copied in background just like in @background mode.
1348 # Since: 3.0
1350 { 'enum': 'MirrorCopyMode',
1351   'data': ['background', 'write-blocking'] }
1354 # @BlockJobInfo:
1356 # Information about a long-running block device operation.
1358 # @type: the job type ('stream' for image streaming)
1360 # @device: The job identifier.  Originally the device name but other
1361 #     values are allowed since QEMU 2.7
1363 # @len: Estimated @offset value at the completion of the job.  This
1364 #     value can arbitrarily change while the job is running, in both
1365 #     directions.
1367 # @offset: Progress made until now.  The unit is arbitrary and the
1368 #     value can only meaningfully be used for the ratio of @offset to
1369 #     @len.  The value is monotonically increasing.
1371 # @busy: false if the job is known to be in a quiescent state, with no
1372 #     pending I/O.  (Since 1.3)
1374 # @paused: whether the job is paused or, if @busy is true, will pause
1375 #     itself as soon as possible.  (Since 1.3)
1377 # @speed: the rate limit, bytes per second
1379 # @io-status: the status of the job (since 1.3)
1381 # @ready: true if the job may be completed (since 2.2)
1383 # @status: Current job state/status (since 2.12)
1385 # @auto-finalize: Job will finalize itself when PENDING, moving to the
1386 #     CONCLUDED state.  (since 2.12)
1388 # @auto-dismiss: Job will dismiss itself when CONCLUDED, moving to the
1389 #     NULL state and disappearing from the query list.  (since 2.12)
1391 # @error: Error information if the job did not complete successfully.
1392 #     Not set if the job completed successfully.  (since 2.12.1)
1394 # Since: 1.1
1396 { 'struct': 'BlockJobInfo',
1397   'data': {'type': 'str', 'device': 'str', 'len': 'int',
1398            'offset': 'int', 'busy': 'bool', 'paused': 'bool', 'speed': 'int',
1399            'io-status': 'BlockDeviceIoStatus', 'ready': 'bool',
1400            'status': 'JobStatus',
1401            'auto-finalize': 'bool', 'auto-dismiss': 'bool',
1402            '*error': 'str' } }
1405 # @query-block-jobs:
1407 # Return information about long-running block device operations.
1409 # Returns: a list of @BlockJobInfo for each active block job
1411 # Since: 1.1
1413 { 'command': 'query-block-jobs', 'returns': ['BlockJobInfo'],
1414   'allow-preconfig': true }
1417 # @block_resize:
1419 # Resize a block image while a guest is running.
1421 # Either @device or @node-name must be set but not both.
1423 # @device: the name of the device to get the image resized
1425 # @node-name: graph node name to get the image resized (Since 2.0)
1427 # @size: new image size in bytes
1429 # Returns:
1430 #     - nothing on success
1431 #     - If @device is not a valid block device, DeviceNotFound
1433 # Since: 0.14
1435 # Example:
1437 # -> { "execute": "block_resize",
1438 #      "arguments": { "device": "scratch", "size": 1073741824 } }
1439 # <- { "return": {} }
1441 { 'command': 'block_resize',
1442   'data': { '*device': 'str',
1443             '*node-name': 'str',
1444             'size': 'int' },
1445   'coroutine': true,
1446   'allow-preconfig': true }
1449 # @NewImageMode:
1451 # An enumeration that tells QEMU how to set the backing file path in a
1452 # new image file.
1454 # @existing: QEMU should look for an existing image file.
1456 # @absolute-paths: QEMU should create a new image with absolute paths
1457 #     for the backing file.  If there is no backing file available,
1458 #     the new image will not be backed either.
1460 # Since: 1.1
1462 { 'enum': 'NewImageMode',
1463   'data': [ 'existing', 'absolute-paths' ] }
1466 # @BlockdevSnapshotSync:
1468 # Either @device or @node-name must be set but not both.
1470 # @device: the name of the device to take a snapshot of.
1472 # @node-name: graph node name to generate the snapshot from (Since
1473 #     2.0)
1475 # @snapshot-file: the target of the new overlay image.  If the file
1476 #     exists, or if it is a device, the overlay will be created in the
1477 #     existing file/device.  Otherwise, a new file will be created.
1479 # @snapshot-node-name: the graph node name of the new image (Since
1480 #     2.0)
1482 # @format: the format of the overlay image, default is 'qcow2'.
1484 # @mode: whether and how QEMU should create a new image, default is
1485 #     'absolute-paths'.
1487 { 'struct': 'BlockdevSnapshotSync',
1488   'data': { '*device': 'str', '*node-name': 'str',
1489             'snapshot-file': 'str', '*snapshot-node-name': 'str',
1490             '*format': 'str', '*mode': 'NewImageMode' } }
1493 # @BlockdevSnapshot:
1495 # @node: device or node name that will have a snapshot taken.
1497 # @overlay: reference to the existing block device that will become
1498 #     the overlay of @node, as part of taking the snapshot.  It must
1499 #     not have a current backing file (this can be achieved by passing
1500 #     "backing": null to blockdev-add).
1502 # Since: 2.5
1504 { 'struct': 'BlockdevSnapshot',
1505   'data': { 'node': 'str', 'overlay': 'str' } }
1508 # @BackupPerf:
1510 # Optional parameters for backup.  These parameters don't affect
1511 # functionality, but may significantly affect performance.
1513 # @use-copy-range: Use copy offloading.  Default false.
1515 # @max-workers: Maximum number of parallel requests for the sustained
1516 #     background copying process.  Doesn't influence copy-before-write
1517 #     operations.  Default 64.
1519 # @max-chunk: Maximum request length for the sustained background
1520 #     copying process.  Doesn't influence copy-before-write
1521 #     operations.  0 means unlimited.  If max-chunk is non-zero then
1522 #     it should not be less than job cluster size which is calculated
1523 #     as maximum of target image cluster size and 64k.  Default 0.
1525 # Since: 6.0
1527 { 'struct': 'BackupPerf',
1528   'data': { '*use-copy-range': 'bool',
1529             '*max-workers': 'int', '*max-chunk': 'int64' } }
1532 # @BackupCommon:
1534 # @job-id: identifier for the newly-created block job.  If omitted,
1535 #     the device name will be used.  (Since 2.7)
1537 # @device: the device name or node-name of a root node which should be
1538 #     copied.
1540 # @sync: what parts of the disk image should be copied to the
1541 #     destination (all the disk, only the sectors allocated in the
1542 #     topmost image, from a dirty bitmap, or only new I/O).
1544 # @speed: the maximum speed, in bytes per second.  The default is 0,
1545 #     for unlimited.
1547 # @bitmap: The name of a dirty bitmap to use.  Must be present if sync
1548 #     is "bitmap" or "incremental". Can be present if sync is "full"
1549 #     or "top".  Must not be present otherwise.
1550 #     (Since 2.4 (drive-backup), 3.1 (blockdev-backup))
1552 # @bitmap-mode: Specifies the type of data the bitmap should contain
1553 #     after the operation concludes.  Must be present if a bitmap was
1554 #     provided, Must NOT be present otherwise.  (Since 4.2)
1556 # @compress: true to compress data, if the target format supports it.
1557 #     (default: false) (since 2.8)
1559 # @on-source-error: the action to take on an error on the source,
1560 #     default 'report'.  'stop' and 'enospc' can only be used if the
1561 #     block device supports io-status (see BlockInfo).
1563 # @on-target-error: the action to take on an error on the target,
1564 #     default 'report' (no limitations, since this applies to a
1565 #     different block device than @device).
1567 # @auto-finalize: When false, this job will wait in a PENDING state
1568 #     after it has finished its work, waiting for @block-job-finalize
1569 #     before making any block graph changes.  When true, this job will
1570 #     automatically perform its abort or commit actions.  Defaults to
1571 #     true.  (Since 2.12)
1573 # @auto-dismiss: When false, this job will wait in a CONCLUDED state
1574 #     after it has completely ceased all work, and awaits
1575 #     @block-job-dismiss.  When true, this job will automatically
1576 #     disappear from the query list without user intervention.
1577 #     Defaults to true.  (Since 2.12)
1579 # @filter-node-name: the node name that should be assigned to the
1580 #     filter driver that the backup job inserts into the graph above
1581 #     node specified by @drive.  If this option is not given, a node
1582 #     name is autogenerated.  (Since: 4.2)
1584 # @x-perf: Performance options.  (Since 6.0)
1586 # Features:
1588 # @unstable: Member @x-perf is experimental.
1590 # Note: @on-source-error and @on-target-error only affect background
1591 #     I/O.  If an error occurs during a guest write request, the
1592 #     device's rerror/werror actions will be used.
1594 # Since: 4.2
1596 { 'struct': 'BackupCommon',
1597   'data': { '*job-id': 'str', 'device': 'str',
1598             'sync': 'MirrorSyncMode', '*speed': 'int',
1599             '*bitmap': 'str', '*bitmap-mode': 'BitmapSyncMode',
1600             '*compress': 'bool',
1601             '*on-source-error': 'BlockdevOnError',
1602             '*on-target-error': 'BlockdevOnError',
1603             '*auto-finalize': 'bool', '*auto-dismiss': 'bool',
1604             '*filter-node-name': 'str',
1605             '*x-perf': { 'type': 'BackupPerf',
1606                          'features': [ 'unstable' ] } } }
1609 # @DriveBackup:
1611 # @target: the target of the new image.  If the file exists, or if it
1612 #     is a device, the existing file/device will be used as the new
1613 #     destination.  If it does not exist, a new file will be created.
1615 # @format: the format of the new destination, default is to probe if
1616 #     @mode is 'existing', else the format of the source
1618 # @mode: whether and how QEMU should create a new image, default is
1619 #     'absolute-paths'.
1621 # Since: 1.6
1623 { 'struct': 'DriveBackup',
1624   'base': 'BackupCommon',
1625   'data': { 'target': 'str',
1626             '*format': 'str',
1627             '*mode': 'NewImageMode' } }
1630 # @BlockdevBackup:
1632 # @target: the device name or node-name of the backup target node.
1634 # Since: 2.3
1636 { 'struct': 'BlockdevBackup',
1637   'base': 'BackupCommon',
1638   'data': { 'target': 'str' } }
1641 # @blockdev-snapshot-sync:
1643 # Takes a synchronous snapshot of a block device.
1645 # For the arguments, see the documentation of BlockdevSnapshotSync.
1647 # Returns:
1648 #     - nothing on success
1649 #     - If @device is not a valid block device, DeviceNotFound
1651 # Since: 0.14
1653 # Example:
1655 # -> { "execute": "blockdev-snapshot-sync",
1656 #      "arguments": { "device": "ide-hd0",
1657 #                     "snapshot-file":
1658 #                     "/some/place/my-image",
1659 #                     "format": "qcow2" } }
1660 # <- { "return": {} }
1662 { 'command': 'blockdev-snapshot-sync',
1663   'data': 'BlockdevSnapshotSync',
1664   'allow-preconfig': true }
1667 # @blockdev-snapshot:
1669 # Takes a snapshot of a block device.
1671 # Take a snapshot, by installing 'node' as the backing image of
1672 # 'overlay'. Additionally, if 'node' is associated with a block
1673 # device, the block device changes to using 'overlay' as its new
1674 # active image.
1676 # For the arguments, see the documentation of BlockdevSnapshot.
1678 # Features:
1680 # @allow-write-only-overlay: If present, the check whether this
1681 #     operation is safe was relaxed so that it can be used to change
1682 #     backing file of a destination of a blockdev-mirror.  (since 5.0)
1684 # Since: 2.5
1686 # Example:
1688 # -> { "execute": "blockdev-add",
1689 #      "arguments": { "driver": "qcow2",
1690 #                     "node-name": "node1534",
1691 #                     "file": { "driver": "file",
1692 #                               "filename": "hd1.qcow2" },
1693 #                     "backing": null } }
1695 # <- { "return": {} }
1697 # -> { "execute": "blockdev-snapshot",
1698 #      "arguments": { "node": "ide-hd0",
1699 #                     "overlay": "node1534" } }
1700 # <- { "return": {} }
1702 { 'command': 'blockdev-snapshot',
1703   'data': 'BlockdevSnapshot',
1704   'features': [ 'allow-write-only-overlay' ],
1705   'allow-preconfig': true }
1708 # @change-backing-file:
1710 # Change the backing file in the image file metadata.  This does not
1711 # cause QEMU to reopen the image file to reparse the backing filename
1712 # (it may, however, perform a reopen to change permissions from r/o ->
1713 # r/w -> r/o, if needed). The new backing file string is written into
1714 # the image file metadata, and the QEMU internal strings are updated.
1716 # @image-node-name: The name of the block driver state node of the
1717 #     image to modify.  The "device" argument is used to verify
1718 #     "image-node-name" is in the chain described by "device".
1720 # @device: The device name or node-name of the root node that owns
1721 #     image-node-name.
1723 # @backing-file: The string to write as the backing file.  This string
1724 #     is not validated, so care should be taken when specifying the
1725 #     string or the image chain may not be able to be reopened again.
1727 # Returns:
1728 #     - Nothing on success
1729 #     - If "device" does not exist or cannot be determined,
1730 #       DeviceNotFound
1732 # Since: 2.1
1734 { 'command': 'change-backing-file',
1735   'data': { 'device': 'str', 'image-node-name': 'str',
1736             'backing-file': 'str' },
1737   'allow-preconfig': true }
1740 # @block-commit:
1742 # Live commit of data from overlay image nodes into backing nodes -
1743 # i.e., writes data between 'top' and 'base' into 'base'.
1745 # If top == base, that is an error.  If top has no overlays on top of
1746 # it, or if it is in use by a writer, the job will not be completed by
1747 # itself.  The user needs to complete the job with the
1748 # block-job-complete command after getting the ready event.  (Since
1749 # 2.0)
1751 # If the base image is smaller than top, then the base image will be
1752 # resized to be the same size as top.  If top is smaller than the base
1753 # image, the base will not be truncated.  If you want the base image
1754 # size to match the size of the smaller top, you can safely truncate
1755 # it yourself once the commit operation successfully completes.
1757 # @job-id: identifier for the newly-created block job.  If omitted,
1758 #     the device name will be used.  (Since 2.7)
1760 # @device: the device name or node-name of a root node
1762 # @base-node: The node name of the backing image to write data into.
1763 #     If not specified, this is the deepest backing image.
1764 #     (since: 3.1)
1766 # @base: Same as @base-node, except that it is a file name rather than
1767 #     a node name.  This must be the exact filename string that was
1768 #     used to open the node; other strings, even if addressing the
1769 #     same file, are not accepted
1771 # @top-node: The node name of the backing image within the image chain
1772 #     which contains the topmost data to be committed down.  If not
1773 #     specified, this is the active layer.  (since: 3.1)
1775 # @top: Same as @top-node, except that it is a file name rather than a
1776 #     node name.  This must be the exact filename string that was used
1777 #     to open the node; other strings, even if addressing the same
1778 #     file, are not accepted
1780 # @backing-file: The backing file string to write into the overlay
1781 #     image of 'top'.  If 'top' does not have an overlay image, or if
1782 #     'top' is in use by a writer, specifying a backing file string is
1783 #     an error.
1785 #     This filename is not validated.  If a pathname string is such
1786 #     that it cannot be resolved by QEMU, that means that subsequent
1787 #     QMP or HMP commands must use node-names for the image in
1788 #     question, as filename lookup methods will fail.
1790 #     If not specified, QEMU will automatically determine the backing
1791 #     file string to use, or error out if there is no obvious choice.
1792 #     Care should be taken when specifying the string, to specify a
1793 #     valid filename or protocol.  (Since 2.1)
1795 # @speed: the maximum speed, in bytes per second
1797 # @on-error: the action to take on an error.  'ignore' means that the
1798 #     request should be retried.  (default: report; Since: 5.0)
1800 # @filter-node-name: the node name that should be assigned to the
1801 #     filter driver that the commit job inserts into the graph above
1802 #     @top.  If this option is not given, a node name is
1803 #     autogenerated.  (Since: 2.9)
1805 # @auto-finalize: When false, this job will wait in a PENDING state
1806 #     after it has finished its work, waiting for @block-job-finalize
1807 #     before making any block graph changes.  When true, this job will
1808 #     automatically perform its abort or commit actions.  Defaults to
1809 #     true.  (Since 3.1)
1811 # @auto-dismiss: When false, this job will wait in a CONCLUDED state
1812 #     after it has completely ceased all work, and awaits
1813 #     @block-job-dismiss.  When true, this job will automatically
1814 #     disappear from the query list without user intervention.
1815 #     Defaults to true.  (Since 3.1)
1817 # Features:
1819 # @deprecated: Members @base and @top are deprecated.  Use @base-node
1820 #     and @top-node instead.
1822 # Returns:
1823 #     - Nothing on success
1824 #     - If @device does not exist, DeviceNotFound
1825 #     - Any other error returns a GenericError.
1827 # Since: 1.3
1829 # Example:
1831 # -> { "execute": "block-commit",
1832 #      "arguments": { "device": "virtio0",
1833 #                     "top": "/tmp/snap1.qcow2" } }
1834 # <- { "return": {} }
1836 { 'command': 'block-commit',
1837   'data': { '*job-id': 'str', 'device': 'str', '*base-node': 'str',
1838             '*base': { 'type': 'str', 'features': [ 'deprecated' ] },
1839             '*top-node': 'str',
1840             '*top': { 'type': 'str', 'features': [ 'deprecated' ] },
1841             '*backing-file': 'str', '*speed': 'int',
1842             '*on-error': 'BlockdevOnError',
1843             '*filter-node-name': 'str',
1844             '*auto-finalize': 'bool', '*auto-dismiss': 'bool' },
1845   'allow-preconfig': true }
1848 # @drive-backup:
1850 # Start a point-in-time copy of a block device to a new destination.
1851 # The status of ongoing drive-backup operations can be checked with
1852 # query-block-jobs where the BlockJobInfo.type field has the value
1853 # 'backup'. The operation can be stopped before it has completed using
1854 # the block-job-cancel command.
1856 # Features:
1858 # @deprecated: This command is deprecated.  Use @blockdev-backup
1859 #     instead.
1861 # Returns:
1862 #     - nothing on success
1863 #     - If @device is not a valid block device, GenericError
1865 # Since: 1.6
1867 # Example:
1869 # -> { "execute": "drive-backup",
1870 #      "arguments": { "device": "drive0",
1871 #                     "sync": "full",
1872 #                     "target": "backup.img" } }
1873 # <- { "return": {} }
1875 { 'command': 'drive-backup', 'boxed': true,
1876   'data': 'DriveBackup', 'features': ['deprecated'],
1877   'allow-preconfig': true }
1880 # @blockdev-backup:
1882 # Start a point-in-time copy of a block device to a new destination.
1883 # The status of ongoing blockdev-backup operations can be checked with
1884 # query-block-jobs where the BlockJobInfo.type field has the value
1885 # 'backup'. The operation can be stopped before it has completed using
1886 # the block-job-cancel command.
1888 # Returns:
1889 #     - nothing on success
1890 #     - If @device is not a valid block device, DeviceNotFound
1892 # Since: 2.3
1894 # Example:
1896 # -> { "execute": "blockdev-backup",
1897 #      "arguments": { "device": "src-id",
1898 #                     "sync": "full",
1899 #                     "target": "tgt-id" } }
1900 # <- { "return": {} }
1902 { 'command': 'blockdev-backup', 'boxed': true,
1903   'data': 'BlockdevBackup',
1904   'allow-preconfig': true }
1907 # @query-named-block-nodes:
1909 # Get the named block driver list
1911 # @flat: Omit the nested data about backing image ("backing-image"
1912 #     key) if true.  Default is false (Since 5.0)
1914 # Returns: the list of BlockDeviceInfo
1916 # Since: 2.0
1918 # Example:
1920 # -> { "execute": "query-named-block-nodes" }
1921 # <- { "return": [ { "ro":false,
1922 #                    "drv":"qcow2",
1923 #                    "encrypted":false,
1924 #                    "file":"disks/test.qcow2",
1925 #                    "node-name": "my-node",
1926 #                    "backing_file_depth":1,
1927 #                    "detect_zeroes":"off",
1928 #                    "bps":1000000,
1929 #                    "bps_rd":0,
1930 #                    "bps_wr":0,
1931 #                    "iops":1000000,
1932 #                    "iops_rd":0,
1933 #                    "iops_wr":0,
1934 #                    "bps_max": 8000000,
1935 #                    "bps_rd_max": 0,
1936 #                    "bps_wr_max": 0,
1937 #                    "iops_max": 0,
1938 #                    "iops_rd_max": 0,
1939 #                    "iops_wr_max": 0,
1940 #                    "iops_size": 0,
1941 #                    "write_threshold": 0,
1942 #                    "image":{
1943 #                       "filename":"disks/test.qcow2",
1944 #                       "format":"qcow2",
1945 #                       "virtual-size":2048000,
1946 #                       "backing_file":"base.qcow2",
1947 #                       "full-backing-filename":"disks/base.qcow2",
1948 #                       "backing-filename-format":"qcow2",
1949 #                       "snapshots":[
1950 #                          {
1951 #                             "id": "1",
1952 #                             "name": "snapshot1",
1953 #                             "vm-state-size": 0,
1954 #                             "date-sec": 10000200,
1955 #                             "date-nsec": 12,
1956 #                             "vm-clock-sec": 206,
1957 #                             "vm-clock-nsec": 30
1958 #                          }
1959 #                       ],
1960 #                       "backing-image":{
1961 #                           "filename":"disks/base.qcow2",
1962 #                           "format":"qcow2",
1963 #                           "virtual-size":2048000
1964 #                       }
1965 #                    } } ] }
1967 { 'command': 'query-named-block-nodes',
1968   'returns': [ 'BlockDeviceInfo' ],
1969   'data': { '*flat': 'bool' },
1970   'allow-preconfig': true }
1973 # @XDbgBlockGraphNodeType:
1975 # @block-backend: corresponds to BlockBackend
1977 # @block-job: corresponds to BlockJob
1979 # @block-driver: corresponds to BlockDriverState
1981 # Since: 4.0
1983 { 'enum': 'XDbgBlockGraphNodeType',
1984   'data': [ 'block-backend', 'block-job', 'block-driver' ] }
1987 # @XDbgBlockGraphNode:
1989 # @id: Block graph node identifier.  This @id is generated only for
1990 #     x-debug-query-block-graph and does not relate to any other
1991 #     identifiers in Qemu.
1993 # @type: Type of graph node.  Can be one of block-backend, block-job
1994 #     or block-driver-state.
1996 # @name: Human readable name of the node.  Corresponds to node-name
1997 #     for block-driver-state nodes; is not guaranteed to be unique in
1998 #     the whole graph (with block-jobs and block-backends).
2000 # Since: 4.0
2002 { 'struct': 'XDbgBlockGraphNode',
2003   'data': { 'id': 'uint64', 'type': 'XDbgBlockGraphNodeType', 'name': 'str' } }
2006 # @BlockPermission:
2008 # Enum of base block permissions.
2010 # @consistent-read: A user that has the "permission" of consistent
2011 #     reads is guaranteed that their view of the contents of the block
2012 #     device is complete and self-consistent, representing the
2013 #     contents of a disk at a specific point.  For most block devices
2014 #     (including their backing files) this is true, but the property
2015 #     cannot be maintained in a few situations like for intermediate
2016 #     nodes of a commit block job.
2018 # @write: This permission is required to change the visible disk
2019 #     contents.
2021 # @write-unchanged: This permission (which is weaker than
2022 #     BLK_PERM_WRITE) is both enough and required for writes to the
2023 #     block node when the caller promises that the visible disk
2024 #     content doesn't change.  As the BLK_PERM_WRITE permission is
2025 #     strictly stronger, either is sufficient to perform an unchanging
2026 #     write.
2028 # @resize: This permission is required to change the size of a block
2029 #     node.
2031 # Since: 4.0
2033 { 'enum': 'BlockPermission',
2034   'data': [ 'consistent-read', 'write', 'write-unchanged', 'resize' ] }
2037 # @XDbgBlockGraphEdge:
2039 # Block Graph edge description for x-debug-query-block-graph.
2041 # @parent: parent id
2043 # @child: child id
2045 # @name: name of the relation (examples are 'file' and 'backing')
2047 # @perm: granted permissions for the parent operating on the child
2049 # @shared-perm: permissions that can still be granted to other users
2050 #     of the child while it is still attached to this parent
2052 # Since: 4.0
2054 { 'struct': 'XDbgBlockGraphEdge',
2055   'data': { 'parent': 'uint64', 'child': 'uint64',
2056             'name': 'str', 'perm': [ 'BlockPermission' ],
2057             'shared-perm': [ 'BlockPermission' ] } }
2060 # @XDbgBlockGraph:
2062 # Block Graph - list of nodes and list of edges.
2064 # Since: 4.0
2066 { 'struct': 'XDbgBlockGraph',
2067   'data': { 'nodes': ['XDbgBlockGraphNode'], 'edges': ['XDbgBlockGraphEdge'] } }
2070 # @x-debug-query-block-graph:
2072 # Get the block graph.
2074 # Features:
2076 # @unstable: This command is meant for debugging.
2078 # Since: 4.0
2080 { 'command': 'x-debug-query-block-graph', 'returns': 'XDbgBlockGraph',
2081   'features': [ 'unstable' ],
2082   'allow-preconfig': true }
2085 # @drive-mirror:
2087 # Start mirroring a block device's writes to a new destination.
2088 # target specifies the target of the new image.  If the file exists,
2089 # or if it is a device, it will be used as the new destination for
2090 # writes.  If it does not exist, a new file will be created.  format
2091 # specifies the format of the mirror image, default is to probe if
2092 # mode='existing', else the format of the source.
2094 # Returns:
2095 #     - nothing on success
2096 #     - If @device is not a valid block device, GenericError
2098 # Since: 1.3
2100 # Example:
2102 # -> { "execute": "drive-mirror",
2103 #      "arguments": { "device": "ide-hd0",
2104 #                     "target": "/some/place/my-image",
2105 #                     "sync": "full",
2106 #                     "format": "qcow2" } }
2107 # <- { "return": {} }
2109 { 'command': 'drive-mirror', 'boxed': true,
2110   'data': 'DriveMirror',
2111   'allow-preconfig': true }
2114 # @DriveMirror:
2116 # A set of parameters describing drive mirror setup.
2118 # @job-id: identifier for the newly-created block job.  If omitted,
2119 #     the device name will be used.  (Since 2.7)
2121 # @device: the device name or node-name of a root node whose writes
2122 #     should be mirrored.
2124 # @target: the target of the new image.  If the file exists, or if it
2125 #     is a device, the existing file/device will be used as the new
2126 #     destination.  If it does not exist, a new file will be created.
2128 # @format: the format of the new destination, default is to probe if
2129 #     @mode is 'existing', else the format of the source
2131 # @node-name: the new block driver state node name in the graph (Since
2132 #     2.1)
2134 # @replaces: with sync=full graph node name to be replaced by the new
2135 #     image when a whole image copy is done.  This can be used to
2136 #     repair broken Quorum files.  By default, @device is replaced,
2137 #     although implicitly created filters on it are kept.  (Since 2.1)
2139 # @mode: whether and how QEMU should create a new image, default is
2140 #     'absolute-paths'.
2142 # @speed: the maximum speed, in bytes per second
2144 # @sync: what parts of the disk image should be copied to the
2145 #     destination (all the disk, only the sectors allocated in the
2146 #     topmost image, or only new I/O).
2148 # @granularity: granularity of the dirty bitmap, default is 64K if the
2149 #     image format doesn't have clusters, 4K if the clusters are
2150 #     smaller than that, else the cluster size.  Must be a power of 2
2151 #     between 512 and 64M (since 1.4).
2153 # @buf-size: maximum amount of data in flight from source to target
2154 #     (since 1.4).
2156 # @on-source-error: the action to take on an error on the source,
2157 #     default 'report'.  'stop' and 'enospc' can only be used if the
2158 #     block device supports io-status (see BlockInfo).
2160 # @on-target-error: the action to take on an error on the target,
2161 #     default 'report' (no limitations, since this applies to a
2162 #     different block device than @device).
2164 # @unmap: Whether to try to unmap target sectors where source has only
2165 #     zero.  If true, and target unallocated sectors will read as
2166 #     zero, target image sectors will be unmapped; otherwise, zeroes
2167 #     will be written.  Both will result in identical contents.
2168 #     Default is true.  (Since 2.4)
2170 # @copy-mode: when to copy data to the destination; defaults to
2171 #     'background' (Since: 3.0)
2173 # @auto-finalize: When false, this job will wait in a PENDING state
2174 #     after it has finished its work, waiting for @block-job-finalize
2175 #     before making any block graph changes.  When true, this job will
2176 #     automatically perform its abort or commit actions.  Defaults to
2177 #     true.  (Since 3.1)
2179 # @auto-dismiss: When false, this job will wait in a CONCLUDED state
2180 #     after it has completely ceased all work, and awaits
2181 #     @block-job-dismiss.  When true, this job will automatically
2182 #     disappear from the query list without user intervention.
2183 #     Defaults to true.  (Since 3.1)
2185 # Since: 1.3
2187 { 'struct': 'DriveMirror',
2188   'data': { '*job-id': 'str', 'device': 'str', 'target': 'str',
2189             '*format': 'str', '*node-name': 'str', '*replaces': 'str',
2190             'sync': 'MirrorSyncMode', '*mode': 'NewImageMode',
2191             '*speed': 'int', '*granularity': 'uint32',
2192             '*buf-size': 'int', '*on-source-error': 'BlockdevOnError',
2193             '*on-target-error': 'BlockdevOnError',
2194             '*unmap': 'bool', '*copy-mode': 'MirrorCopyMode',
2195             '*auto-finalize': 'bool', '*auto-dismiss': 'bool' } }
2198 # @BlockDirtyBitmap:
2200 # @node: name of device/node which the bitmap is tracking
2202 # @name: name of the dirty bitmap
2204 # Since: 2.4
2206 { 'struct': 'BlockDirtyBitmap',
2207   'data': { 'node': 'str', 'name': 'str' } }
2210 # @BlockDirtyBitmapAdd:
2212 # @node: name of device/node which the bitmap is tracking
2214 # @name: name of the dirty bitmap (must be less than 1024 bytes)
2216 # @granularity: the bitmap granularity, default is 64k for
2217 #     block-dirty-bitmap-add
2219 # @persistent: the bitmap is persistent, i.e. it will be saved to the
2220 #     corresponding block device image file on its close.  For now
2221 #     only Qcow2 disks support persistent bitmaps.  Default is false
2222 #     for block-dirty-bitmap-add.  (Since: 2.10)
2224 # @disabled: the bitmap is created in the disabled state, which means
2225 #     that it will not track drive changes.  The bitmap may be enabled
2226 #     with block-dirty-bitmap-enable.  Default is false.  (Since: 4.0)
2228 # Since: 2.4
2230 { 'struct': 'BlockDirtyBitmapAdd',
2231   'data': { 'node': 'str', 'name': 'str', '*granularity': 'uint32',
2232             '*persistent': 'bool', '*disabled': 'bool' } }
2235 # @BlockDirtyBitmapOrStr:
2237 # @local: name of the bitmap, attached to the same node as target
2238 #     bitmap.
2240 # @external: bitmap with specified node
2242 # Since: 4.1
2244 { 'alternate': 'BlockDirtyBitmapOrStr',
2245   'data': { 'local': 'str',
2246             'external': 'BlockDirtyBitmap' } }
2249 # @BlockDirtyBitmapMerge:
2251 # @node: name of device/node which the @target bitmap is tracking
2253 # @target: name of the destination dirty bitmap
2255 # @bitmaps: name(s) of the source dirty bitmap(s) at @node and/or
2256 #     fully specified BlockDirtyBitmap elements.  The latter are
2257 #     supported since 4.1.
2259 # Since: 4.0
2261 { 'struct': 'BlockDirtyBitmapMerge',
2262   'data': { 'node': 'str', 'target': 'str',
2263             'bitmaps': ['BlockDirtyBitmapOrStr'] } }
2266 # @block-dirty-bitmap-add:
2268 # Create a dirty bitmap with a name on the node, and start tracking
2269 # the writes.
2271 # Returns:
2272 #     - nothing on success
2273 #     - If @node is not a valid block device or node, DeviceNotFound
2274 #     - If @name is already taken, GenericError with an explanation
2276 # Since: 2.4
2278 # Example:
2280 # -> { "execute": "block-dirty-bitmap-add",
2281 #      "arguments": { "node": "drive0", "name": "bitmap0" } }
2282 # <- { "return": {} }
2284 { 'command': 'block-dirty-bitmap-add',
2285   'data': 'BlockDirtyBitmapAdd',
2286   'allow-preconfig': true }
2289 # @block-dirty-bitmap-remove:
2291 # Stop write tracking and remove the dirty bitmap that was created
2292 # with block-dirty-bitmap-add.  If the bitmap is persistent, remove it
2293 # from its storage too.
2295 # Returns:
2296 #     - nothing on success
2297 #     - If @node is not a valid block device or node, DeviceNotFound
2298 #     - If @name is not found, GenericError with an explanation
2299 #     - if @name is frozen by an operation, GenericError
2301 # Since: 2.4
2303 # Example:
2305 # -> { "execute": "block-dirty-bitmap-remove",
2306 #      "arguments": { "node": "drive0", "name": "bitmap0" } }
2307 # <- { "return": {} }
2309 { 'command': 'block-dirty-bitmap-remove',
2310   'data': 'BlockDirtyBitmap',
2311   'allow-preconfig': true }
2314 # @block-dirty-bitmap-clear:
2316 # Clear (reset) a dirty bitmap on the device, so that an incremental
2317 # backup from this point in time forward will only backup clusters
2318 # modified after this clear operation.
2320 # Returns:
2321 #     - nothing on success
2322 #     - If @node is not a valid block device, DeviceNotFound
2323 #     - If @name is not found, GenericError with an explanation
2325 # Since: 2.4
2327 # Example:
2329 # -> { "execute": "block-dirty-bitmap-clear",
2330 #      "arguments": { "node": "drive0", "name": "bitmap0" } }
2331 # <- { "return": {} }
2333 { 'command': 'block-dirty-bitmap-clear',
2334   'data': 'BlockDirtyBitmap',
2335   'allow-preconfig': true }
2338 # @block-dirty-bitmap-enable:
2340 # Enables a dirty bitmap so that it will begin tracking disk changes.
2342 # Returns:
2343 #     - nothing on success
2344 #     - If @node is not a valid block device, DeviceNotFound
2345 #     - If @name is not found, GenericError with an explanation
2347 # Since: 4.0
2349 # Example:
2351 # -> { "execute": "block-dirty-bitmap-enable",
2352 #      "arguments": { "node": "drive0", "name": "bitmap0" } }
2353 # <- { "return": {} }
2355 { 'command': 'block-dirty-bitmap-enable',
2356   'data': 'BlockDirtyBitmap',
2357   'allow-preconfig': true }
2360 # @block-dirty-bitmap-disable:
2362 # Disables a dirty bitmap so that it will stop tracking disk changes.
2364 # Returns:
2365 #     - nothing on success
2366 #     - If @node is not a valid block device, DeviceNotFound
2367 #     - If @name is not found, GenericError with an explanation
2369 # Since: 4.0
2371 # Example:
2373 # -> { "execute": "block-dirty-bitmap-disable",
2374 #      "arguments": { "node": "drive0", "name": "bitmap0" } }
2375 # <- { "return": {} }
2377 { 'command': 'block-dirty-bitmap-disable',
2378   'data': 'BlockDirtyBitmap',
2379   'allow-preconfig': true }
2382 # @block-dirty-bitmap-merge:
2384 # Merge dirty bitmaps listed in @bitmaps to the @target dirty bitmap.
2385 # Dirty bitmaps in @bitmaps will be unchanged, except if it also
2386 # appears as the @target bitmap.  Any bits already set in @target will
2387 # still be set after the merge, i.e., this operation does not clear
2388 # the target.  On error, @target is unchanged.
2390 # The resulting bitmap will count as dirty any clusters that were
2391 # dirty in any of the source bitmaps.  This can be used to achieve
2392 # backup checkpoints, or in simpler usages, to copy bitmaps.
2394 # Returns:
2395 #     - nothing on success
2396 #     - If @node is not a valid block device, DeviceNotFound
2397 #     - If any bitmap in @bitmaps or @target is not found,
2398 #       GenericError
2399 #     - If any of the bitmaps have different sizes or granularities,
2400 #       GenericError
2402 # Since: 4.0
2404 # Example:
2406 # -> { "execute": "block-dirty-bitmap-merge",
2407 #      "arguments": { "node": "drive0", "target": "bitmap0",
2408 #                     "bitmaps": ["bitmap1"] } }
2409 # <- { "return": {} }
2411 { 'command': 'block-dirty-bitmap-merge',
2412   'data': 'BlockDirtyBitmapMerge',
2413   'allow-preconfig': true }
2416 # @BlockDirtyBitmapSha256:
2418 # SHA256 hash of dirty bitmap data
2420 # @sha256: ASCII representation of SHA256 bitmap hash
2422 # Since: 2.10
2424 { 'struct': 'BlockDirtyBitmapSha256',
2425   'data': {'sha256': 'str'} }
2428 # @x-debug-block-dirty-bitmap-sha256:
2430 # Get bitmap SHA256.
2432 # Features:
2434 # @unstable: This command is meant for debugging.
2436 # Returns:
2437 #     - BlockDirtyBitmapSha256 on success
2438 #     - If @node is not a valid block device, DeviceNotFound
2439 #     - If @name is not found or if hashing has failed, GenericError
2440 #       with an explanation
2442 # Since: 2.10
2444 { 'command': 'x-debug-block-dirty-bitmap-sha256',
2445   'data': 'BlockDirtyBitmap', 'returns': 'BlockDirtyBitmapSha256',
2446   'features': [ 'unstable' ],
2447   'allow-preconfig': true }
2450 # @blockdev-mirror:
2452 # Start mirroring a block device's writes to a new destination.
2454 # @job-id: identifier for the newly-created block job.  If omitted,
2455 #     the device name will be used.  (Since 2.7)
2457 # @device: The device name or node-name of a root node whose writes
2458 #     should be mirrored.
2460 # @target: the id or node-name of the block device to mirror to.  This
2461 #     mustn't be attached to guest.
2463 # @replaces: with sync=full graph node name to be replaced by the new
2464 #     image when a whole image copy is done.  This can be used to
2465 #     repair broken Quorum files.  By default, @device is replaced,
2466 #     although implicitly created filters on it are kept.
2468 # @speed: the maximum speed, in bytes per second
2470 # @sync: what parts of the disk image should be copied to the
2471 #     destination (all the disk, only the sectors allocated in the
2472 #     topmost image, or only new I/O).
2474 # @granularity: granularity of the dirty bitmap, default is 64K if the
2475 #     image format doesn't have clusters, 4K if the clusters are
2476 #     smaller than that, else the cluster size.  Must be a power of 2
2477 #     between 512 and 64M
2479 # @buf-size: maximum amount of data in flight from source to target
2481 # @on-source-error: the action to take on an error on the source,
2482 #     default 'report'.  'stop' and 'enospc' can only be used if the
2483 #     block device supports io-status (see BlockInfo).
2485 # @on-target-error: the action to take on an error on the target,
2486 #     default 'report' (no limitations, since this applies to a
2487 #     different block device than @device).
2489 # @filter-node-name: the node name that should be assigned to the
2490 #     filter driver that the mirror job inserts into the graph above
2491 #     @device.  If this option is not given, a node name is
2492 #     autogenerated.  (Since: 2.9)
2494 # @copy-mode: when to copy data to the destination; defaults to
2495 #     'background' (Since: 3.0)
2497 # @auto-finalize: When false, this job will wait in a PENDING state
2498 #     after it has finished its work, waiting for @block-job-finalize
2499 #     before making any block graph changes.  When true, this job will
2500 #     automatically perform its abort or commit actions.  Defaults to
2501 #     true.  (Since 3.1)
2503 # @auto-dismiss: When false, this job will wait in a CONCLUDED state
2504 #     after it has completely ceased all work, and awaits
2505 #     @block-job-dismiss.  When true, this job will automatically
2506 #     disappear from the query list without user intervention.
2507 #     Defaults to true.  (Since 3.1)
2509 # Returns: nothing on success.
2511 # Since: 2.6
2513 # Example:
2515 # -> { "execute": "blockdev-mirror",
2516 #      "arguments": { "device": "ide-hd0",
2517 #                     "target": "target0",
2518 #                     "sync": "full" } }
2519 # <- { "return": {} }
2521 { 'command': 'blockdev-mirror',
2522   'data': { '*job-id': 'str', 'device': 'str', 'target': 'str',
2523             '*replaces': 'str',
2524             'sync': 'MirrorSyncMode',
2525             '*speed': 'int', '*granularity': 'uint32',
2526             '*buf-size': 'int', '*on-source-error': 'BlockdevOnError',
2527             '*on-target-error': 'BlockdevOnError',
2528             '*filter-node-name': 'str',
2529             '*copy-mode': 'MirrorCopyMode',
2530             '*auto-finalize': 'bool', '*auto-dismiss': 'bool' },
2531   'allow-preconfig': true }
2534 # @BlockIOThrottle:
2536 # A set of parameters describing block throttling.
2538 # @device: Block device name
2540 # @id: The name or QOM path of the guest device (since: 2.8)
2542 # @bps: total throughput limit in bytes per second
2544 # @bps_rd: read throughput limit in bytes per second
2546 # @bps_wr: write throughput limit in bytes per second
2548 # @iops: total I/O operations per second
2550 # @iops_rd: read I/O operations per second
2552 # @iops_wr: write I/O operations per second
2554 # @bps_max: total throughput limit during bursts, in bytes (Since 1.7)
2556 # @bps_rd_max: read throughput limit during bursts, in bytes (Since
2557 #     1.7)
2559 # @bps_wr_max: write throughput limit during bursts, in bytes (Since
2560 #     1.7)
2562 # @iops_max: total I/O operations per second during bursts, in bytes
2563 #     (Since 1.7)
2565 # @iops_rd_max: read I/O operations per second during bursts, in bytes
2566 #     (Since 1.7)
2568 # @iops_wr_max: write I/O operations per second during bursts, in
2569 #     bytes (Since 1.7)
2571 # @bps_max_length: maximum length of the @bps_max burst period, in
2572 #     seconds.  It must only be set if @bps_max is set as well.
2573 #     Defaults to 1. (Since 2.6)
2575 # @bps_rd_max_length: maximum length of the @bps_rd_max burst period,
2576 #     in seconds.  It must only be set if @bps_rd_max is set as well.
2577 #     Defaults to 1. (Since 2.6)
2579 # @bps_wr_max_length: maximum length of the @bps_wr_max burst period,
2580 #     in seconds.  It must only be set if @bps_wr_max is set as well.
2581 #     Defaults to 1. (Since 2.6)
2583 # @iops_max_length: maximum length of the @iops burst period, in
2584 #     seconds.  It must only be set if @iops_max is set as well.
2585 #     Defaults to 1. (Since 2.6)
2587 # @iops_rd_max_length: maximum length of the @iops_rd_max burst
2588 #     period, in seconds.  It must only be set if @iops_rd_max is set
2589 #     as well.  Defaults to 1. (Since 2.6)
2591 # @iops_wr_max_length: maximum length of the @iops_wr_max burst
2592 #     period, in seconds.  It must only be set if @iops_wr_max is set
2593 #     as well.  Defaults to 1. (Since 2.6)
2595 # @iops_size: an I/O size in bytes (Since 1.7)
2597 # @group: throttle group name (Since 2.4)
2599 # Features:
2601 # @deprecated: Member @device is deprecated.  Use @id instead.
2603 # Since: 1.1
2605 { 'struct': 'BlockIOThrottle',
2606   'data': { '*device': { 'type': 'str', 'features': [ 'deprecated' ] },
2607             '*id': 'str', 'bps': 'int', 'bps_rd': 'int',
2608             'bps_wr': 'int', 'iops': 'int', 'iops_rd': 'int', 'iops_wr': 'int',
2609             '*bps_max': 'int', '*bps_rd_max': 'int',
2610             '*bps_wr_max': 'int', '*iops_max': 'int',
2611             '*iops_rd_max': 'int', '*iops_wr_max': 'int',
2612             '*bps_max_length': 'int', '*bps_rd_max_length': 'int',
2613             '*bps_wr_max_length': 'int', '*iops_max_length': 'int',
2614             '*iops_rd_max_length': 'int', '*iops_wr_max_length': 'int',
2615             '*iops_size': 'int', '*group': 'str' } }
2618 # @ThrottleLimits:
2620 # Limit parameters for throttling.  Since some limit combinations are
2621 # illegal, limits should always be set in one transaction.  All fields
2622 # are optional.  When setting limits, if a field is missing the
2623 # current value is not changed.
2625 # @iops-total: limit total I/O operations per second
2627 # @iops-total-max: I/O operations burst
2629 # @iops-total-max-length: length of the iops-total-max burst period,
2630 #     in seconds It must only be set if @iops-total-max is set as
2631 #     well.
2633 # @iops-read: limit read operations per second
2635 # @iops-read-max: I/O operations read burst
2637 # @iops-read-max-length: length of the iops-read-max burst period, in
2638 #     seconds It must only be set if @iops-read-max is set as well.
2640 # @iops-write: limit write operations per second
2642 # @iops-write-max: I/O operations write burst
2644 # @iops-write-max-length: length of the iops-write-max burst period,
2645 #     in seconds It must only be set if @iops-write-max is set as
2646 #     well.
2648 # @bps-total: limit total bytes per second
2650 # @bps-total-max: total bytes burst
2652 # @bps-total-max-length: length of the bps-total-max burst period, in
2653 #     seconds.  It must only be set if @bps-total-max is set as well.
2655 # @bps-read: limit read bytes per second
2657 # @bps-read-max: total bytes read burst
2659 # @bps-read-max-length: length of the bps-read-max burst period, in
2660 #     seconds It must only be set if @bps-read-max is set as well.
2662 # @bps-write: limit write bytes per second
2664 # @bps-write-max: total bytes write burst
2666 # @bps-write-max-length: length of the bps-write-max burst period, in
2667 #     seconds It must only be set if @bps-write-max is set as well.
2669 # @iops-size: when limiting by iops max size of an I/O in bytes
2671 # Since: 2.11
2673 { 'struct': 'ThrottleLimits',
2674   'data': { '*iops-total' : 'int', '*iops-total-max' : 'int',
2675             '*iops-total-max-length' : 'int', '*iops-read' : 'int',
2676             '*iops-read-max' : 'int', '*iops-read-max-length' : 'int',
2677             '*iops-write' : 'int', '*iops-write-max' : 'int',
2678             '*iops-write-max-length' : 'int', '*bps-total' : 'int',
2679             '*bps-total-max' : 'int', '*bps-total-max-length' : 'int',
2680             '*bps-read' : 'int', '*bps-read-max' : 'int',
2681             '*bps-read-max-length' : 'int', '*bps-write' : 'int',
2682             '*bps-write-max' : 'int', '*bps-write-max-length' : 'int',
2683             '*iops-size' : 'int' } }
2686 # @ThrottleGroupProperties:
2688 # Properties for throttle-group objects.
2690 # @limits: limits to apply for this throttle group
2692 # Features:
2694 # @unstable: All members starting with x- are aliases for the same key
2695 #     without x- in the @limits object.  This is not a stable
2696 #     interface and may be removed or changed incompatibly in the
2697 #     future.  Use @limits for a supported stable interface.
2699 # Since: 2.11
2701 { 'struct': 'ThrottleGroupProperties',
2702   'data': { '*limits': 'ThrottleLimits',
2703             '*x-iops-total': { 'type': 'int',
2704                                'features': [ 'unstable' ] },
2705             '*x-iops-total-max': { 'type': 'int',
2706                                    'features': [ 'unstable' ] },
2707             '*x-iops-total-max-length': { 'type': 'int',
2708                                           'features': [ 'unstable' ] },
2709             '*x-iops-read': { 'type': 'int',
2710                               'features': [ 'unstable' ] },
2711             '*x-iops-read-max': { 'type': 'int',
2712                                   'features': [ 'unstable' ] },
2713             '*x-iops-read-max-length': { 'type': 'int',
2714                                          'features': [ 'unstable' ] },
2715             '*x-iops-write': { 'type': 'int',
2716                                'features': [ 'unstable' ] },
2717             '*x-iops-write-max': { 'type': 'int',
2718                                    'features': [ 'unstable' ] },
2719             '*x-iops-write-max-length': { 'type': 'int',
2720                                           'features': [ 'unstable' ] },
2721             '*x-bps-total': { 'type': 'int',
2722                               'features': [ 'unstable' ] },
2723             '*x-bps-total-max': { 'type': 'int',
2724                                   'features': [ 'unstable' ] },
2725             '*x-bps-total-max-length': { 'type': 'int',
2726                                          'features': [ 'unstable' ] },
2727             '*x-bps-read': { 'type': 'int',
2728                              'features': [ 'unstable' ] },
2729             '*x-bps-read-max': { 'type': 'int',
2730                                  'features': [ 'unstable' ] },
2731             '*x-bps-read-max-length': { 'type': 'int',
2732                                         'features': [ 'unstable' ] },
2733             '*x-bps-write': { 'type': 'int',
2734                               'features': [ 'unstable' ] },
2735             '*x-bps-write-max': { 'type': 'int',
2736                                   'features': [ 'unstable' ] },
2737             '*x-bps-write-max-length': { 'type': 'int',
2738                                          'features': [ 'unstable' ] },
2739             '*x-iops-size': { 'type': 'int',
2740                               'features': [ 'unstable' ] } } }
2743 # @block-stream:
2745 # Copy data from a backing file into a block device.
2747 # The block streaming operation is performed in the background until
2748 # the entire backing file has been copied.  This command returns
2749 # immediately once streaming has started.  The status of ongoing block
2750 # streaming operations can be checked with query-block-jobs.  The
2751 # operation can be stopped before it has completed using the
2752 # block-job-cancel command.
2754 # The node that receives the data is called the top image, can be
2755 # located in any part of the chain (but always above the base image;
2756 # see below) and can be specified using its device or node name.
2757 # Earlier qemu versions only allowed 'device' to name the top level
2758 # node; presence of the 'base-node' parameter during introspection can
2759 # be used as a witness of the enhanced semantics of 'device'.
2761 # If a base file is specified then sectors are not copied from that
2762 # base file and its backing chain.  This can be used to stream a
2763 # subset of the backing file chain instead of flattening the entire
2764 # image.  When streaming completes the image file will have the base
2765 # file as its backing file, unless that node was changed while the job
2766 # was running.  In that case, base's parent's backing (or filtered,
2767 # whichever exists) child (i.e., base at the beginning of the job)
2768 # will be the new backing file.
2770 # On successful completion the image file is updated to drop the
2771 # backing file and the BLOCK_JOB_COMPLETED event is emitted.
2773 # In case @device is a filter node, block-stream modifies the first
2774 # non-filter overlay node below it to point to the new backing node
2775 # instead of modifying @device itself.
2777 # @job-id: identifier for the newly-created block job.  If omitted,
2778 #     the device name will be used.  (Since 2.7)
2780 # @device: the device or node name of the top image
2782 # @base: the common backing file name.  It cannot be set if @base-node
2783 #     or @bottom is also set.
2785 # @base-node: the node name of the backing file.  It cannot be set if
2786 #     @base or @bottom is also set.  (Since 2.8)
2788 # @bottom: the last node in the chain that should be streamed into
2789 #     top.  It cannot be set if @base or @base-node is also set.  It
2790 #     cannot be filter node.  (Since 6.0)
2792 # @backing-file: The backing file string to write into the top image.
2793 #     This filename is not validated.
2795 #     If a pathname string is such that it cannot be resolved by QEMU,
2796 #     that means that subsequent QMP or HMP commands must use
2797 #     node-names for the image in question, as filename lookup methods
2798 #     will fail.
2800 #     If not specified, QEMU will automatically determine the backing
2801 #     file string to use, or error out if there is no obvious choice.
2802 #     Care should be taken when specifying the string, to specify a
2803 #     valid filename or protocol.  (Since 2.1)
2805 # @speed: the maximum speed, in bytes per second
2807 # @on-error: the action to take on an error (default report). 'stop'
2808 #     and 'enospc' can only be used if the block device supports
2809 #     io-status (see BlockInfo).  (Since 1.3)
2811 # @filter-node-name: the node name that should be assigned to the
2812 #     filter driver that the stream job inserts into the graph above
2813 #     @device.  If this option is not given, a node name is
2814 #     autogenerated.  (Since: 6.0)
2816 # @auto-finalize: When false, this job will wait in a PENDING state
2817 #     after it has finished its work, waiting for @block-job-finalize
2818 #     before making any block graph changes.  When true, this job will
2819 #     automatically perform its abort or commit actions.  Defaults to
2820 #     true.  (Since 3.1)
2822 # @auto-dismiss: When false, this job will wait in a CONCLUDED state
2823 #     after it has completely ceased all work, and awaits
2824 #     @block-job-dismiss.  When true, this job will automatically
2825 #     disappear from the query list without user intervention.
2826 #     Defaults to true.  (Since 3.1)
2828 # Returns:
2829 #     - Nothing on success.
2830 #     - If @device does not exist, DeviceNotFound.
2832 # Since: 1.1
2834 # Example:
2836 # -> { "execute": "block-stream",
2837 #      "arguments": { "device": "virtio0",
2838 #                     "base": "/tmp/master.qcow2" } }
2839 # <- { "return": {} }
2841 { 'command': 'block-stream',
2842   'data': { '*job-id': 'str', 'device': 'str', '*base': 'str',
2843             '*base-node': 'str', '*backing-file': 'str', '*bottom': 'str',
2844             '*speed': 'int', '*on-error': 'BlockdevOnError',
2845             '*filter-node-name': 'str',
2846             '*auto-finalize': 'bool', '*auto-dismiss': 'bool' },
2847   'allow-preconfig': true }
2850 # @block-job-set-speed:
2852 # Set maximum speed for a background block operation.
2854 # This command can only be issued when there is an active block job.
2856 # Throttling can be disabled by setting the speed to 0.
2858 # @device: The job identifier.  This used to be a device name (hence
2859 #     the name of the parameter), but since QEMU 2.7 it can have other
2860 #     values.
2862 # @speed: the maximum speed, in bytes per second, or 0 for unlimited.
2863 #     Defaults to 0.
2865 # Returns:
2866 #     - Nothing on success
2867 #     - If no background operation is active on this device,
2868 #       DeviceNotActive
2870 # Since: 1.1
2872 { 'command': 'block-job-set-speed',
2873   'data': { 'device': 'str', 'speed': 'int' },
2874   'allow-preconfig': true }
2877 # @block-job-cancel:
2879 # Stop an active background block operation.
2881 # This command returns immediately after marking the active background
2882 # block operation for cancellation.  It is an error to call this
2883 # command if no operation is in progress.
2885 # The operation will cancel as soon as possible and then emit the
2886 # BLOCK_JOB_CANCELLED event.  Before that happens the job is still
2887 # visible when enumerated using query-block-jobs.
2889 # Note that if you issue 'block-job-cancel' after 'drive-mirror' has
2890 # indicated (via the event BLOCK_JOB_READY) that the source and
2891 # destination are synchronized, then the event triggered by this
2892 # command changes to BLOCK_JOB_COMPLETED, to indicate that the
2893 # mirroring has ended and the destination now has a point-in-time copy
2894 # tied to the time of the cancellation.
2896 # For streaming, the image file retains its backing file unless the
2897 # streaming operation happens to complete just as it is being
2898 # cancelled.  A new streaming operation can be started at a later time
2899 # to finish copying all data from the backing file.
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 # @force: If true, and the job has already emitted the event
2906 #     BLOCK_JOB_READY, abandon the job immediately (even if it is
2907 #     paused) instead of waiting for the destination to complete its
2908 #     final synchronization (since 1.3)
2910 # Returns:
2911 #     - Nothing on success
2912 #     - If no background operation is active on this device,
2913 #       DeviceNotActive
2915 # Since: 1.1
2917 { 'command': 'block-job-cancel', 'data': { 'device': 'str', '*force': 'bool' },
2918   'allow-preconfig': true }
2921 # @block-job-pause:
2923 # Pause an active background block operation.
2925 # This command returns immediately after marking the active background
2926 # block operation for pausing.  It is an error to call this command if
2927 # no operation is in progress or if the job is already paused.
2929 # The operation will pause as soon as possible.  No event is emitted
2930 # when the operation is actually paused.  Cancelling a paused job
2931 # automatically resumes it.
2933 # @device: The job identifier.  This used to be a device name (hence
2934 #     the name of the parameter), but since QEMU 2.7 it can have other
2935 #     values.
2937 # Returns:
2938 #     - Nothing on success
2939 #     - If no background operation is active on this device,
2940 #       DeviceNotActive
2942 # Since: 1.3
2944 { 'command': 'block-job-pause', 'data': { 'device': 'str' },
2945   'allow-preconfig': true }
2948 # @block-job-resume:
2950 # Resume an active background block operation.
2952 # This command returns immediately after resuming a paused background
2953 # block operation.  It is an error to call this command if no
2954 # operation is in progress or if the job is not paused.
2956 # This command also clears the error status of the job.
2958 # @device: The job identifier.  This used to be a device name (hence
2959 #     the name of the parameter), but since QEMU 2.7 it can have other
2960 #     values.
2962 # Returns:
2963 #     - Nothing on success
2964 #     - If no background operation is active on this device,
2965 #       DeviceNotActive
2967 # Since: 1.3
2969 { 'command': 'block-job-resume', 'data': { 'device': 'str' },
2970   'allow-preconfig': true }
2973 # @block-job-complete:
2975 # Manually trigger completion of an active background block operation.
2976 # This is supported for drive mirroring, where it also switches the
2977 # device to write to the target path only.  The ability to complete is
2978 # signaled with a BLOCK_JOB_READY event.
2980 # This command completes an active background block operation
2981 # synchronously.  The ordering of this command's return with the
2982 # BLOCK_JOB_COMPLETED event is not defined.  Note that if an I/O error
2983 # occurs during the processing of this command: 1) the command itself
2984 # will fail; 2) the error will be processed according to the
2985 # rerror/werror arguments that were specified when starting the
2986 # operation.
2988 # A cancelled or paused job cannot be completed.
2990 # @device: The job identifier.  This used to be a device name (hence
2991 #     the name of the parameter), but since QEMU 2.7 it can have other
2992 #     values.
2994 # Returns:
2995 #     - Nothing on success
2996 #     - If no background operation is active on this device,
2997 #       DeviceNotActive
2999 # Since: 1.3
3001 { 'command': 'block-job-complete', 'data': { 'device': 'str' },
3002   'allow-preconfig': true }
3005 # @block-job-dismiss:
3007 # For jobs that have already concluded, remove them from the
3008 # block-job-query list.  This command only needs to be run for jobs
3009 # which were started with QEMU 2.12+ job lifetime management
3010 # semantics.
3012 # This command will refuse to operate on any job that has not yet
3013 # reached its terminal state, JOB_STATUS_CONCLUDED. For jobs that make
3014 # use of the BLOCK_JOB_READY event, block-job-cancel or
3015 # block-job-complete will still need to be used as appropriate.
3017 # @id: The job identifier.
3019 # Returns: Nothing on success
3021 # Since: 2.12
3023 { 'command': 'block-job-dismiss', 'data': { 'id': 'str' },
3024   'allow-preconfig': true }
3027 # @block-job-finalize:
3029 # Once a job that has manual=true reaches the pending state, it can be
3030 # instructed to finalize any graph changes and do any necessary
3031 # cleanup via this command.  For jobs in a transaction, instructing
3032 # one job to finalize will force ALL jobs in the transaction to
3033 # finalize, so it is only necessary to instruct a single member job to
3034 # finalize.
3036 # @id: The job identifier.
3038 # Returns: Nothing on success
3040 # Since: 2.12
3042 { 'command': 'block-job-finalize', 'data': { 'id': 'str' },
3043   'allow-preconfig': true }
3046 # @BlockdevDiscardOptions:
3048 # Determines how to handle discard requests.
3050 # @ignore: Ignore the request
3052 # @unmap: Forward as an unmap request
3054 # Since: 2.9
3056 { 'enum': 'BlockdevDiscardOptions',
3057   'data': [ 'ignore', 'unmap' ] }
3060 # @BlockdevDetectZeroesOptions:
3062 # Describes the operation mode for the automatic conversion of plain
3063 # zero writes by the OS to driver specific optimized zero write
3064 # commands.
3066 # @off: Disabled (default)
3068 # @on: Enabled
3070 # @unmap: Enabled and even try to unmap blocks if possible.  This
3071 #     requires also that @BlockdevDiscardOptions is set to unmap for
3072 #     this device.
3074 # Since: 2.1
3076 { 'enum': 'BlockdevDetectZeroesOptions',
3077   'data': [ 'off', 'on', 'unmap' ] }
3080 # @BlockdevAioOptions:
3082 # Selects the AIO backend to handle I/O requests
3084 # @threads: Use qemu's thread pool
3086 # @native: Use native AIO backend (only Linux and Windows)
3088 # @io_uring: Use linux io_uring (since 5.0)
3090 # Since: 2.9
3092 { 'enum': 'BlockdevAioOptions',
3093   'data': [ 'threads', 'native',
3094             { 'name': 'io_uring', 'if': 'CONFIG_LINUX_IO_URING' } ] }
3097 # @BlockdevCacheOptions:
3099 # Includes cache-related options for block devices
3101 # @direct: enables use of O_DIRECT (bypass the host page cache;
3102 #     default: false)
3104 # @no-flush: ignore any flush requests for the device (default: false)
3106 # Since: 2.9
3108 { 'struct': 'BlockdevCacheOptions',
3109   'data': { '*direct': 'bool',
3110             '*no-flush': 'bool' } }
3113 # @BlockdevDriver:
3115 # Drivers that are supported in block device operations.
3117 # @throttle: Since 2.11
3119 # @nvme: Since 2.12
3121 # @copy-on-read: Since 3.0
3123 # @blklogwrites: Since 3.0
3125 # @blkreplay: Since 4.2
3127 # @compress: Since 5.0
3129 # @copy-before-write: Since 6.2
3131 # @snapshot-access: Since 7.0
3133 # Since: 2.9
3135 { 'enum': 'BlockdevDriver',
3136   'data': [ 'blkdebug', 'blklogwrites', 'blkreplay', 'blkverify', 'bochs',
3137             'cloop', 'compress', 'copy-before-write', 'copy-on-read', 'dmg',
3138             'file', 'snapshot-access', 'ftp', 'ftps', 'gluster',
3139             {'name': 'host_cdrom', 'if': 'HAVE_HOST_BLOCK_DEVICE' },
3140             {'name': 'host_device', 'if': 'HAVE_HOST_BLOCK_DEVICE' },
3141             'http', 'https',
3142             { 'name': 'io_uring', 'if': 'CONFIG_BLKIO' },
3143             'iscsi',
3144             'luks', 'nbd', 'nfs', 'null-aio', 'null-co', 'nvme',
3145             { 'name': 'nvme-io_uring', 'if': 'CONFIG_BLKIO' },
3146             'parallels', 'preallocate', 'qcow', 'qcow2', 'qed', 'quorum',
3147             'raw', 'rbd',
3148             { 'name': 'replication', 'if': 'CONFIG_REPLICATION' },
3149             'ssh', 'throttle', 'vdi', 'vhdx',
3150             { 'name': 'virtio-blk-vfio-pci', 'if': 'CONFIG_BLKIO' },
3151             { 'name': 'virtio-blk-vhost-user', 'if': 'CONFIG_BLKIO' },
3152             { 'name': 'virtio-blk-vhost-vdpa', 'if': 'CONFIG_BLKIO' },
3153             'vmdk', 'vpc', 'vvfat' ] }
3156 # @BlockdevOptionsFile:
3158 # Driver specific block device options for the file backend.
3160 # @filename: path to the image file
3162 # @pr-manager: the id for the object that will handle persistent
3163 #     reservations for this device (default: none, forward the
3164 #     commands via SG_IO; since 2.11)
3166 # @aio: AIO backend (default: threads) (since: 2.8)
3168 # @aio-max-batch: maximum number of requests to batch together into a
3169 #     single submission in the AIO backend.  The smallest value
3170 #     between this and the aio-max-batch value of the IOThread object
3171 #     is chosen.  0 means that the AIO backend will handle it
3172 #     automatically.  (default: 0, since 6.2)
3174 # @locking: whether to enable file locking.  If set to 'auto', only
3175 #     enable when Open File Descriptor (OFD) locking API is available
3176 #     (default: auto, since 2.10)
3178 # @drop-cache: invalidate page cache during live migration.  This
3179 #     prevents stale data on the migration destination with
3180 #     cache.direct=off.  Currently only supported on Linux hosts.
3181 #     (default: on, since: 4.0)
3183 # @x-check-cache-dropped: whether to check that page cache was dropped
3184 #     on live migration.  May cause noticeable delays if the image
3185 #     file is large, do not use in production.  (default: off)
3186 #     (since: 3.0)
3188 # Features:
3190 # @dynamic-auto-read-only: If present, enabled auto-read-only means
3191 #     that the driver will open the image read-only at first,
3192 #     dynamically reopen the image file read-write when the first
3193 #     writer is attached to the node and reopen read-only when the
3194 #     last writer is detached.  This allows giving QEMU write
3195 #     permissions only on demand when an operation actually needs
3196 #     write access.
3198 # @unstable: Member x-check-cache-dropped is meant for debugging.
3200 # Since: 2.9
3202 { 'struct': 'BlockdevOptionsFile',
3203   'data': { 'filename': 'str',
3204             '*pr-manager': 'str',
3205             '*locking': 'OnOffAuto',
3206             '*aio': 'BlockdevAioOptions',
3207             '*aio-max-batch': 'int',
3208             '*drop-cache': {'type': 'bool',
3209                             'if': 'CONFIG_LINUX'},
3210             '*x-check-cache-dropped': { 'type': 'bool',
3211                                         'features': [ 'unstable' ] } },
3212   'features': [ { 'name': 'dynamic-auto-read-only',
3213                   'if': 'CONFIG_POSIX' } ] }
3216 # @BlockdevOptionsNull:
3218 # Driver specific block device options for the null backend.
3220 # @size: size of the device in bytes.
3222 # @latency-ns: emulated latency (in nanoseconds) in processing
3223 #     requests.  Default to zero which completes requests immediately.
3224 #     (Since 2.4)
3226 # @read-zeroes: if true, reads from the device produce zeroes; if
3227 #     false, the buffer is left unchanged.
3228 #     (default: false; since: 4.1)
3230 # Since: 2.9
3232 { 'struct': 'BlockdevOptionsNull',
3233   'data': { '*size': 'int', '*latency-ns': 'uint64', '*read-zeroes': 'bool' } }
3236 # @BlockdevOptionsNVMe:
3238 # Driver specific block device options for the NVMe backend.
3240 # @device: PCI controller address of the NVMe device in format
3241 #     hhhh:bb:ss.f (host:bus:slot.function)
3243 # @namespace: namespace number of the device, starting from 1.
3245 # Note that the PCI @device must have been unbound from any host
3246 # kernel driver before instructing QEMU to add the blockdev.
3248 # Since: 2.12
3250 { 'struct': 'BlockdevOptionsNVMe',
3251   'data': { 'device': 'str', 'namespace': 'int' } }
3254 # @BlockdevOptionsVVFAT:
3256 # Driver specific block device options for the vvfat protocol.
3258 # @dir: directory to be exported as FAT image
3260 # @fat-type: FAT type: 12, 16 or 32
3262 # @floppy: whether to export a floppy image (true) or partitioned hard
3263 #     disk (false; default)
3265 # @label: set the volume label, limited to 11 bytes.  FAT16 and FAT32
3266 #     traditionally have some restrictions on labels, which are
3267 #     ignored by most operating systems.  Defaults to "QEMU VVFAT".
3268 #     (since 2.4)
3270 # @rw: whether to allow write operations (default: false)
3272 # Since: 2.9
3274 { 'struct': 'BlockdevOptionsVVFAT',
3275   'data': { 'dir': 'str', '*fat-type': 'int', '*floppy': 'bool',
3276             '*label': 'str', '*rw': 'bool' } }
3279 # @BlockdevOptionsGenericFormat:
3281 # Driver specific block device options for image format that have no
3282 # option besides their data source.
3284 # @file: reference to or definition of the data source block device
3286 # Since: 2.9
3288 { 'struct': 'BlockdevOptionsGenericFormat',
3289   'data': { 'file': 'BlockdevRef' } }
3292 # @BlockdevOptionsLUKS:
3294 # Driver specific block device options for LUKS.
3296 # @key-secret: the ID of a QCryptoSecret object providing the
3297 #     decryption key (since 2.6). Mandatory except when doing a
3298 #     metadata-only probe of the image.
3300 # Since: 2.9
3302 { 'struct': 'BlockdevOptionsLUKS',
3303   'base': 'BlockdevOptionsGenericFormat',
3304   'data': { '*key-secret': 'str' } }
3307 # @BlockdevOptionsGenericCOWFormat:
3309 # Driver specific block device options for image format that have no
3310 # option besides their data source and an optional backing file.
3312 # @backing: reference to or definition of the backing file block
3313 #     device, null disables the backing file entirely.  Defaults to
3314 #     the backing file stored the image file.
3316 # Since: 2.9
3318 { 'struct': 'BlockdevOptionsGenericCOWFormat',
3319   'base': 'BlockdevOptionsGenericFormat',
3320   'data': { '*backing': 'BlockdevRefOrNull' } }
3323 # @Qcow2OverlapCheckMode:
3325 # General overlap check modes.
3327 # @none: Do not perform any checks
3329 # @constant: Perform only checks which can be done in constant time
3330 #     and without reading anything from disk
3332 # @cached: Perform only checks which can be done without reading
3333 #     anything from disk
3335 # @all: Perform all available overlap checks
3337 # Since: 2.9
3339 { 'enum': 'Qcow2OverlapCheckMode',
3340   'data': [ 'none', 'constant', 'cached', 'all' ] }
3343 # @Qcow2OverlapCheckFlags:
3345 # Structure of flags for each metadata structure.  Setting a field to
3346 # 'true' makes qemu guard that structure against unintended
3347 # overwriting.  The default value is chosen according to the template
3348 # given.
3350 # @template: Specifies a template mode which can be adjusted using the
3351 #     other flags, defaults to 'cached'
3353 # @bitmap-directory: since 3.0
3355 # Since: 2.9
3357 { 'struct': 'Qcow2OverlapCheckFlags',
3358   'data': { '*template':         'Qcow2OverlapCheckMode',
3359             '*main-header':      'bool',
3360             '*active-l1':        'bool',
3361             '*active-l2':        'bool',
3362             '*refcount-table':   'bool',
3363             '*refcount-block':   'bool',
3364             '*snapshot-table':   'bool',
3365             '*inactive-l1':      'bool',
3366             '*inactive-l2':      'bool',
3367             '*bitmap-directory': 'bool' } }
3370 # @Qcow2OverlapChecks:
3372 # Specifies which metadata structures should be guarded against
3373 # unintended overwriting.
3375 # @flags: set of flags for separate specification of each metadata
3376 #     structure type
3378 # @mode: named mode which chooses a specific set of flags
3380 # Since: 2.9
3382 { 'alternate': 'Qcow2OverlapChecks',
3383   'data': { 'flags': 'Qcow2OverlapCheckFlags',
3384             'mode':  'Qcow2OverlapCheckMode' } }
3387 # @BlockdevQcowEncryptionFormat:
3389 # @aes: AES-CBC with plain64 initialization vectors
3391 # Since: 2.10
3393 { 'enum': 'BlockdevQcowEncryptionFormat',
3394   'data': [ 'aes' ] }
3397 # @BlockdevQcowEncryption:
3399 # Since: 2.10
3401 { 'union': 'BlockdevQcowEncryption',
3402   'base': { 'format': 'BlockdevQcowEncryptionFormat' },
3403   'discriminator': 'format',
3404   'data': { 'aes': 'QCryptoBlockOptionsQCow' } }
3407 # @BlockdevOptionsQcow:
3409 # Driver specific block device options for qcow.
3411 # @encrypt: Image decryption options.  Mandatory for encrypted images,
3412 #     except when doing a metadata-only probe of the image.
3414 # Since: 2.10
3416 { 'struct': 'BlockdevOptionsQcow',
3417   'base': 'BlockdevOptionsGenericCOWFormat',
3418   'data': { '*encrypt': 'BlockdevQcowEncryption' } }
3421 # @BlockdevQcow2EncryptionFormat:
3423 # @aes: AES-CBC with plain64 initialization vectors
3425 # Since: 2.10
3427 { 'enum': 'BlockdevQcow2EncryptionFormat',
3428   'data': [ 'aes', 'luks' ] }
3431 # @BlockdevQcow2Encryption:
3433 # Since: 2.10
3435 { 'union': 'BlockdevQcow2Encryption',
3436   'base': { 'format': 'BlockdevQcow2EncryptionFormat' },
3437   'discriminator': 'format',
3438   'data': { 'aes': 'QCryptoBlockOptionsQCow',
3439             'luks': 'QCryptoBlockOptionsLUKS'} }
3442 # @BlockdevOptionsPreallocate:
3444 # Filter driver intended to be inserted between format and protocol
3445 # node and do preallocation in protocol node on write.
3447 # @prealloc-align: on preallocation, align file length to this number,
3448 #     default 1048576 (1M)
3450 # @prealloc-size: how much to preallocate, default 134217728 (128M)
3452 # Since: 6.0
3454 { 'struct': 'BlockdevOptionsPreallocate',
3455   'base': 'BlockdevOptionsGenericFormat',
3456   'data': { '*prealloc-align': 'int', '*prealloc-size': 'int' } }
3459 # @BlockdevOptionsQcow2:
3461 # Driver specific block device options for qcow2.
3463 # @lazy-refcounts: whether to enable the lazy refcounts feature
3464 #     (default is taken from the image file)
3466 # @pass-discard-request: whether discard requests to the qcow2 device
3467 #     should be forwarded to the data source
3469 # @pass-discard-snapshot: whether discard requests for the data source
3470 #     should be issued when a snapshot operation (e.g. deleting a
3471 #     snapshot) frees clusters in the qcow2 file
3473 # @pass-discard-other: whether discard requests for the data source
3474 #     should be issued on other occasions where a cluster gets freed
3476 # @discard-no-unref: when enabled, discards from the guest will not
3477 #     cause cluster allocations to be relinquished.  This prevents
3478 #     qcow2 fragmentation that would be caused by such discards.
3479 #     Besides potential performance degradation, such fragmentation
3480 #     can lead to increased allocation of clusters past the end of the
3481 #     image file, resulting in image files whose file length can grow
3482 #     much larger than their guest disk size would suggest.  If image
3483 #     file length is of concern (e.g. when storing qcow2 images
3484 #     directly on block devices), you should consider enabling this
3485 #     option.  (since 8.1)
3487 # @overlap-check: which overlap checks to perform for writes to the
3488 #     image, defaults to 'cached' (since 2.2)
3490 # @cache-size: the maximum total size of the L2 table and refcount
3491 #     block caches in bytes (since 2.2)
3493 # @l2-cache-size: the maximum size of the L2 table cache in bytes
3494 #     (since 2.2)
3496 # @l2-cache-entry-size: the size of each entry in the L2 cache in
3497 #     bytes.  It must be a power of two between 512 and the cluster
3498 #     size.  The default value is the cluster size (since 2.12)
3500 # @refcount-cache-size: the maximum size of the refcount block cache
3501 #     in bytes (since 2.2)
3503 # @cache-clean-interval: clean unused entries in the L2 and refcount
3504 #     caches.  The interval is in seconds.  The default value is 600
3505 #     on supporting platforms, and 0 on other platforms.  0 disables
3506 #     this feature.  (since 2.5)
3508 # @encrypt: Image decryption options.  Mandatory for encrypted images,
3509 #     except when doing a metadata-only probe of the image.  (since
3510 #     2.10)
3512 # @data-file: reference to or definition of the external data file.
3513 #     This may only be specified for images that require an external
3514 #     data file.  If it is not specified for such an image, the data
3515 #     file name is loaded from the image file.  (since 4.0)
3517 # Since: 2.9
3519 { 'struct': 'BlockdevOptionsQcow2',
3520   'base': 'BlockdevOptionsGenericCOWFormat',
3521   'data': { '*lazy-refcounts': 'bool',
3522             '*pass-discard-request': 'bool',
3523             '*pass-discard-snapshot': 'bool',
3524             '*pass-discard-other': 'bool',
3525             '*discard-no-unref': 'bool',
3526             '*overlap-check': 'Qcow2OverlapChecks',
3527             '*cache-size': 'int',
3528             '*l2-cache-size': 'int',
3529             '*l2-cache-entry-size': 'int',
3530             '*refcount-cache-size': 'int',
3531             '*cache-clean-interval': 'int',
3532             '*encrypt': 'BlockdevQcow2Encryption',
3533             '*data-file': 'BlockdevRef' } }
3536 # @SshHostKeyCheckMode:
3538 # @none: Don't check the host key at all
3540 # @hash: Compare the host key with a given hash
3542 # @known_hosts: Check the host key against the known_hosts file
3544 # Since: 2.12
3546 { 'enum': 'SshHostKeyCheckMode',
3547   'data': [ 'none', 'hash', 'known_hosts' ] }
3550 # @SshHostKeyCheckHashType:
3552 # @md5: The given hash is an md5 hash
3554 # @sha1: The given hash is an sha1 hash
3556 # @sha256: The given hash is an sha256 hash
3558 # Since: 2.12
3560 { 'enum': 'SshHostKeyCheckHashType',
3561   'data': [ 'md5', 'sha1', 'sha256' ] }
3564 # @SshHostKeyHash:
3566 # @type: The hash algorithm used for the hash
3568 # @hash: The expected hash value
3570 # Since: 2.12
3572 { 'struct': 'SshHostKeyHash',
3573   'data': { 'type': 'SshHostKeyCheckHashType',
3574             'hash': 'str' }}
3577 # @SshHostKeyCheck:
3579 # Since: 2.12
3581 { 'union': 'SshHostKeyCheck',
3582   'base': { 'mode': 'SshHostKeyCheckMode' },
3583   'discriminator': 'mode',
3584   'data': { 'hash': 'SshHostKeyHash' } }
3587 # @BlockdevOptionsSsh:
3589 # @server: host address
3591 # @path: path to the image on the host
3593 # @user: user as which to connect, defaults to current local user name
3595 # @host-key-check: Defines how and what to check the host key against
3596 #     (default: known_hosts)
3598 # Since: 2.9
3600 { 'struct': 'BlockdevOptionsSsh',
3601   'data': { 'server': 'InetSocketAddress',
3602             'path': 'str',
3603             '*user': 'str',
3604             '*host-key-check': 'SshHostKeyCheck' } }
3607 # @BlkdebugEvent:
3609 # Trigger events supported by blkdebug.
3611 # @l1_shrink_write_table: write zeros to the l1 table to shrink image.
3612 #     (since 2.11)
3614 # @l1_shrink_free_l2_clusters: discard the l2 tables.  (since 2.11)
3616 # @cor_write: a write due to copy-on-read (since 2.11)
3618 # @cluster_alloc_space: an allocation of file space for a cluster
3619 #     (since 4.1)
3621 # @none: triggers once at creation of the blkdebug node (since 4.1)
3623 # Since: 2.9
3625 { 'enum': 'BlkdebugEvent', 'prefix': 'BLKDBG',
3626   'data': [ 'l1_update', 'l1_grow_alloc_table', 'l1_grow_write_table',
3627             'l1_grow_activate_table', 'l2_load', 'l2_update',
3628             'l2_update_compressed', 'l2_alloc_cow_read', 'l2_alloc_write',
3629             'read_aio', 'read_backing_aio', 'read_compressed', 'write_aio',
3630             'write_compressed', 'vmstate_load', 'vmstate_save', 'cow_read',
3631             'cow_write', 'reftable_load', 'reftable_grow', 'reftable_update',
3632             'refblock_load', 'refblock_update', 'refblock_update_part',
3633             'refblock_alloc', 'refblock_alloc_hookup', 'refblock_alloc_write',
3634             'refblock_alloc_write_blocks', 'refblock_alloc_write_table',
3635             'refblock_alloc_switch_table', 'cluster_alloc',
3636             'cluster_alloc_bytes', 'cluster_free', 'flush_to_os',
3637             'flush_to_disk', 'pwritev_rmw_head', 'pwritev_rmw_after_head',
3638             'pwritev_rmw_tail', 'pwritev_rmw_after_tail', 'pwritev',
3639             'pwritev_zero', 'pwritev_done', 'empty_image_prepare',
3640             'l1_shrink_write_table', 'l1_shrink_free_l2_clusters',
3641             'cor_write', 'cluster_alloc_space', 'none'] }
3644 # @BlkdebugIOType:
3646 # Kinds of I/O that blkdebug can inject errors in.
3648 # @read: .bdrv_co_preadv()
3650 # @write: .bdrv_co_pwritev()
3652 # @write-zeroes: .bdrv_co_pwrite_zeroes()
3654 # @discard: .bdrv_co_pdiscard()
3656 # @flush: .bdrv_co_flush_to_disk()
3658 # @block-status: .bdrv_co_block_status()
3660 # Since: 4.1
3662 { 'enum': 'BlkdebugIOType', 'prefix': 'BLKDEBUG_IO_TYPE',
3663   'data': [ 'read', 'write', 'write-zeroes', 'discard', 'flush',
3664             'block-status' ] }
3667 # @BlkdebugInjectErrorOptions:
3669 # Describes a single error injection for blkdebug.
3671 # @event: trigger event
3673 # @state: the state identifier blkdebug needs to be in to actually
3674 #     trigger the event; defaults to "any"
3676 # @iotype: the type of I/O operations on which this error should be
3677 #     injected; defaults to "all read, write, write-zeroes, discard,
3678 #     and flush operations" (since: 4.1)
3680 # @errno: error identifier (errno) to be returned; defaults to EIO
3682 # @sector: specifies the sector index which has to be affected in
3683 #     order to actually trigger the event; defaults to "any sector"
3685 # @once: disables further events after this one has been triggered;
3686 #     defaults to false
3688 # @immediately: fail immediately; defaults to false
3690 # Since: 2.9
3692 { 'struct': 'BlkdebugInjectErrorOptions',
3693   'data': { 'event': 'BlkdebugEvent',
3694             '*state': 'int',
3695             '*iotype': 'BlkdebugIOType',
3696             '*errno': 'int',
3697             '*sector': 'int',
3698             '*once': 'bool',
3699             '*immediately': 'bool' } }
3702 # @BlkdebugSetStateOptions:
3704 # Describes a single state-change event for blkdebug.
3706 # @event: trigger event
3708 # @state: the current state identifier blkdebug needs to be in;
3709 #     defaults to "any"
3711 # @new_state: the state identifier blkdebug is supposed to assume if
3712 #     this event is triggered
3714 # Since: 2.9
3716 { 'struct': 'BlkdebugSetStateOptions',
3717   'data': { 'event': 'BlkdebugEvent',
3718             '*state': 'int',
3719             'new_state': 'int' } }
3722 # @BlockdevOptionsBlkdebug:
3724 # Driver specific block device options for blkdebug.
3726 # @image: underlying raw block device (or image file)
3728 # @config: filename of the configuration file
3730 # @align: required alignment for requests in bytes, must be positive
3731 #     power of 2, or 0 for default
3733 # @max-transfer: maximum size for I/O transfers in bytes, must be
3734 #     positive multiple of @align and of the underlying file's request
3735 #     alignment (but need not be a power of 2), or 0 for default
3736 #     (since 2.10)
3738 # @opt-write-zero: preferred alignment for write zero requests in
3739 #     bytes, must be positive multiple of @align and of the underlying
3740 #     file's request alignment (but need not be a power of 2), or 0
3741 #     for default (since 2.10)
3743 # @max-write-zero: maximum size for write zero requests in bytes, must
3744 #     be positive multiple of @align, of @opt-write-zero, and of the
3745 #     underlying file's request alignment (but need not be a power of
3746 #     2), or 0 for default (since 2.10)
3748 # @opt-discard: preferred alignment for discard requests in bytes,
3749 #     must be positive multiple of @align and of the underlying file's
3750 #     request alignment (but need not be a power of 2), or 0 for
3751 #     default (since 2.10)
3753 # @max-discard: maximum size for discard requests in bytes, must be
3754 #     positive multiple of @align, of @opt-discard, and of the
3755 #     underlying file's request alignment (but need not be a power of
3756 #     2), or 0 for default (since 2.10)
3758 # @inject-error: array of error injection descriptions
3760 # @set-state: array of state-change descriptions
3762 # @take-child-perms: Permissions to take on @image in addition to what
3763 #     is necessary anyway (which depends on how the blkdebug node is
3764 #     used).  Defaults to none.  (since 5.0)
3766 # @unshare-child-perms: Permissions not to share on @image in addition
3767 #     to what cannot be shared anyway (which depends on how the
3768 #     blkdebug node is used).  Defaults to none.  (since 5.0)
3770 # Since: 2.9
3772 { 'struct': 'BlockdevOptionsBlkdebug',
3773   'data': { 'image': 'BlockdevRef',
3774             '*config': 'str',
3775             '*align': 'int', '*max-transfer': 'int32',
3776             '*opt-write-zero': 'int32', '*max-write-zero': 'int32',
3777             '*opt-discard': 'int32', '*max-discard': 'int32',
3778             '*inject-error': ['BlkdebugInjectErrorOptions'],
3779             '*set-state': ['BlkdebugSetStateOptions'],
3780             '*take-child-perms': ['BlockPermission'],
3781             '*unshare-child-perms': ['BlockPermission'] } }
3784 # @BlockdevOptionsBlklogwrites:
3786 # Driver specific block device options for blklogwrites.
3788 # @file: block device
3790 # @log: block device used to log writes to @file
3792 # @log-sector-size: sector size used in logging writes to @file,
3793 #     determines granularity of offsets and sizes of writes
3794 #     (default: 512)
3796 # @log-append: append to an existing log (default: false)
3798 # @log-super-update-interval: interval of write requests after which
3799 #     the log super block is updated to disk (default: 4096)
3801 # Since: 3.0
3803 { 'struct': 'BlockdevOptionsBlklogwrites',
3804   'data': { 'file': 'BlockdevRef',
3805             'log': 'BlockdevRef',
3806             '*log-sector-size': 'uint32',
3807             '*log-append': 'bool',
3808             '*log-super-update-interval': 'uint64' } }
3811 # @BlockdevOptionsBlkverify:
3813 # Driver specific block device options for blkverify.
3815 # @test: block device to be tested
3817 # @raw: raw image used for verification
3819 # Since: 2.9
3821 { 'struct': 'BlockdevOptionsBlkverify',
3822   'data': { 'test': 'BlockdevRef',
3823             'raw': 'BlockdevRef' } }
3826 # @BlockdevOptionsBlkreplay:
3828 # Driver specific block device options for blkreplay.
3830 # @image: disk image which should be controlled with blkreplay
3832 # Since: 4.2
3834 { 'struct': 'BlockdevOptionsBlkreplay',
3835   'data': { 'image': 'BlockdevRef' } }
3838 # @QuorumReadPattern:
3840 # An enumeration of quorum read patterns.
3842 # @quorum: read all the children and do a quorum vote on reads
3844 # @fifo: read only from the first child that has not failed
3846 # Since: 2.9
3848 { 'enum': 'QuorumReadPattern', 'data': [ 'quorum', 'fifo' ] }
3851 # @BlockdevOptionsQuorum:
3853 # Driver specific block device options for Quorum
3855 # @blkverify: true if the driver must print content mismatch set to
3856 #     false by default
3858 # @children: the children block devices to use
3860 # @vote-threshold: the vote limit under which a read will fail
3862 # @rewrite-corrupted: rewrite corrupted data when quorum is reached
3863 #     (Since 2.1)
3865 # @read-pattern: choose read pattern and set to quorum by default
3866 #     (Since 2.2)
3868 # Since: 2.9
3870 { 'struct': 'BlockdevOptionsQuorum',
3871   'data': { '*blkverify': 'bool',
3872             'children': [ 'BlockdevRef' ],
3873             'vote-threshold': 'int',
3874             '*rewrite-corrupted': 'bool',
3875             '*read-pattern': 'QuorumReadPattern' } }
3878 # @BlockdevOptionsGluster:
3880 # Driver specific block device options for Gluster
3882 # @volume: name of gluster volume where VM image resides
3884 # @path: absolute path to image file in gluster volume
3886 # @server: gluster servers description
3888 # @debug: libgfapi log level (default '4' which is Error) (Since 2.8)
3890 # @logfile: libgfapi log file (default /dev/stderr) (Since 2.8)
3892 # Since: 2.9
3894 { 'struct': 'BlockdevOptionsGluster',
3895   'data': { 'volume': 'str',
3896             'path': 'str',
3897             'server': ['SocketAddress'],
3898             '*debug': 'int',
3899             '*logfile': 'str' } }
3902 # @BlockdevOptionsIoUring:
3904 # Driver specific block device options for the io_uring backend.
3906 # @filename: path to the image file
3908 # Since: 7.2
3910 { 'struct': 'BlockdevOptionsIoUring',
3911   'data': { 'filename': 'str' },
3912   'if': 'CONFIG_BLKIO' }
3915 # @BlockdevOptionsNvmeIoUring:
3917 # Driver specific block device options for the nvme-io_uring backend.
3919 # @path: path to the NVMe namespace's character device (e.g.
3920 #     /dev/ng0n1).
3922 # Since: 7.2
3924 { 'struct': 'BlockdevOptionsNvmeIoUring',
3925   'data': { 'path': 'str' },
3926   'if': 'CONFIG_BLKIO' }
3929 # @BlockdevOptionsVirtioBlkVfioPci:
3931 # Driver specific block device options for the virtio-blk-vfio-pci
3932 # backend.
3934 # @path: path to the PCI device's sysfs directory (e.g.
3935 #     /sys/bus/pci/devices/0000:00:01.0).
3937 # Since: 7.2
3939 { 'struct': 'BlockdevOptionsVirtioBlkVfioPci',
3940   'data': { 'path': 'str' },
3941   'if': 'CONFIG_BLKIO' }
3944 # @BlockdevOptionsVirtioBlkVhostUser:
3946 # Driver specific block device options for the virtio-blk-vhost-user
3947 # backend.
3949 # @path: path to the vhost-user UNIX domain socket.
3951 # Since: 7.2
3953 { 'struct': 'BlockdevOptionsVirtioBlkVhostUser',
3954   'data': { 'path': 'str' },
3955   'if': 'CONFIG_BLKIO' }
3958 # @BlockdevOptionsVirtioBlkVhostVdpa:
3960 # Driver specific block device options for the virtio-blk-vhost-vdpa
3961 # backend.
3963 # @path: path to the vhost-vdpa character device.
3965 # Features:
3966 # @fdset: Member @path supports the special "/dev/fdset/N" path
3967 #     (since 8.1)
3969 # Since: 7.2
3971 { 'struct': 'BlockdevOptionsVirtioBlkVhostVdpa',
3972   'data': { 'path': 'str' },
3973   'features': [ { 'name' :'fdset',
3974                   'if': 'CONFIG_BLKIO_VHOST_VDPA_FD' } ],
3975   'if': 'CONFIG_BLKIO' }
3978 # @IscsiTransport:
3980 # An enumeration of libiscsi transport types
3982 # Since: 2.9
3984 { 'enum': 'IscsiTransport',
3985   'data': [ 'tcp', 'iser' ] }
3988 # @IscsiHeaderDigest:
3990 # An enumeration of header digests supported by libiscsi
3992 # Since: 2.9
3994 { 'enum': 'IscsiHeaderDigest',
3995   'prefix': 'QAPI_ISCSI_HEADER_DIGEST',
3996   'data': [ 'crc32c', 'none', 'crc32c-none', 'none-crc32c' ] }
3999 # @BlockdevOptionsIscsi:
4001 # @transport: The iscsi transport type
4003 # @portal: The address of the iscsi portal
4005 # @target: The target iqn name
4007 # @lun: LUN to connect to.  Defaults to 0.
4009 # @user: User name to log in with.  If omitted, no CHAP authentication
4010 #     is performed.
4012 # @password-secret: The ID of a QCryptoSecret object providing the
4013 #     password for the login.  This option is required if @user is
4014 #     specified.
4016 # @initiator-name: The iqn name we want to identify to the target as.
4017 #     If this option is not specified, an initiator name is generated
4018 #     automatically.
4020 # @header-digest: The desired header digest.  Defaults to none-crc32c.
4022 # @timeout: Timeout in seconds after which a request will timeout.  0
4023 #     means no timeout and is the default.
4025 # Driver specific block device options for iscsi
4027 # Since: 2.9
4029 { 'struct': 'BlockdevOptionsIscsi',
4030   'data': { 'transport': 'IscsiTransport',
4031             'portal': 'str',
4032             'target': 'str',
4033             '*lun': 'int',
4034             '*user': 'str',
4035             '*password-secret': 'str',
4036             '*initiator-name': 'str',
4037             '*header-digest': 'IscsiHeaderDigest',
4038             '*timeout': 'int' } }
4041 # @RbdAuthMode:
4043 # Since: 3.0
4045 { 'enum': 'RbdAuthMode',
4046   'data': [ 'cephx', 'none' ] }
4049 # @RbdImageEncryptionFormat:
4051 # @luks-any: Used for opening either luks or luks2 (Since 8.0)
4053 # Since: 6.1
4055 { 'enum': 'RbdImageEncryptionFormat',
4056   'data': [ 'luks', 'luks2', 'luks-any' ] }
4059 # @RbdEncryptionOptionsLUKSBase:
4061 # @key-secret: ID of a QCryptoSecret object providing a passphrase for
4062 #     unlocking the encryption
4064 # Since: 6.1
4066 { 'struct': 'RbdEncryptionOptionsLUKSBase',
4067   'data': { 'key-secret': 'str' } }
4070 # @RbdEncryptionCreateOptionsLUKSBase:
4072 # @cipher-alg: The encryption algorithm
4074 # Since: 6.1
4076 { 'struct': 'RbdEncryptionCreateOptionsLUKSBase',
4077   'base': 'RbdEncryptionOptionsLUKSBase',
4078   'data': { '*cipher-alg': 'QCryptoCipherAlgorithm' } }
4081 # @RbdEncryptionOptionsLUKS:
4083 # Since: 6.1
4085 { 'struct': 'RbdEncryptionOptionsLUKS',
4086   'base': 'RbdEncryptionOptionsLUKSBase',
4087   'data': { } }
4090 # @RbdEncryptionOptionsLUKS2:
4092 # Since: 6.1
4094 { 'struct': 'RbdEncryptionOptionsLUKS2',
4095   'base': 'RbdEncryptionOptionsLUKSBase',
4096   'data': { } }
4099 # @RbdEncryptionOptionsLUKSAny:
4101 # Since: 8.0
4103 { 'struct': 'RbdEncryptionOptionsLUKSAny',
4104   'base': 'RbdEncryptionOptionsLUKSBase',
4105   'data': { } }
4108 # @RbdEncryptionCreateOptionsLUKS:
4110 # Since: 6.1
4112 { 'struct': 'RbdEncryptionCreateOptionsLUKS',
4113   'base': 'RbdEncryptionCreateOptionsLUKSBase',
4114   'data': { } }
4117 # @RbdEncryptionCreateOptionsLUKS2:
4119 # Since: 6.1
4121 { 'struct': 'RbdEncryptionCreateOptionsLUKS2',
4122   'base': 'RbdEncryptionCreateOptionsLUKSBase',
4123   'data': { } }
4126 # @RbdEncryptionOptions:
4128 # @format: Encryption format.
4130 # @parent: Parent image encryption options (for cloned images).  Can
4131 #     be left unspecified if this cloned image is encrypted using the
4132 #     same format and secret as its parent image (i.e. not explicitly
4133 #     formatted) or if its parent image is not encrypted.  (Since 8.0)
4135 # Since: 6.1
4137 { 'union': 'RbdEncryptionOptions',
4138   'base': { 'format': 'RbdImageEncryptionFormat',
4139             '*parent': 'RbdEncryptionOptions' },
4140   'discriminator': 'format',
4141   'data': { 'luks': 'RbdEncryptionOptionsLUKS',
4142             'luks2': 'RbdEncryptionOptionsLUKS2',
4143             'luks-any': 'RbdEncryptionOptionsLUKSAny'} }
4146 # @RbdEncryptionCreateOptions:
4148 # Since: 6.1
4150 { 'union': 'RbdEncryptionCreateOptions',
4151   'base': { 'format': 'RbdImageEncryptionFormat' },
4152   'discriminator': 'format',
4153   'data': { 'luks': 'RbdEncryptionCreateOptionsLUKS',
4154             'luks2': 'RbdEncryptionCreateOptionsLUKS2' } }
4157 # @BlockdevOptionsRbd:
4159 # @pool: Ceph pool name.
4161 # @namespace: Rados namespace name in the Ceph pool.  (Since 5.0)
4163 # @image: Image name in the Ceph pool.
4165 # @conf: path to Ceph configuration file.  Values in the configuration
4166 #     file will be overridden by options specified via QAPI.
4168 # @snapshot: Ceph snapshot name.
4170 # @encrypt: Image encryption options.  (Since 6.1)
4172 # @user: Ceph id name.
4174 # @auth-client-required: Acceptable authentication modes.  This maps
4175 #     to Ceph configuration option "auth_client_required".  (Since
4176 #     3.0)
4178 # @key-secret: ID of a QCryptoSecret object providing a key for cephx
4179 #     authentication.  This maps to Ceph configuration option "key".
4180 #     (Since 3.0)
4182 # @server: Monitor host address and port.  This maps to the "mon_host"
4183 #     Ceph option.
4185 # Since: 2.9
4187 { 'struct': 'BlockdevOptionsRbd',
4188   'data': { 'pool': 'str',
4189             '*namespace': 'str',
4190             'image': 'str',
4191             '*conf': 'str',
4192             '*snapshot': 'str',
4193             '*encrypt': 'RbdEncryptionOptions',
4194             '*user': 'str',
4195             '*auth-client-required': ['RbdAuthMode'],
4196             '*key-secret': 'str',
4197             '*server': ['InetSocketAddressBase'] } }
4200 # @ReplicationMode:
4202 # An enumeration of replication modes.
4204 # @primary: Primary mode, the vm's state will be sent to secondary
4205 #     QEMU.
4207 # @secondary: Secondary mode, receive the vm's state from primary
4208 #     QEMU.
4210 # Since: 2.9
4212 { 'enum' : 'ReplicationMode', 'data' : [ 'primary', 'secondary' ],
4213   'if': 'CONFIG_REPLICATION' }
4216 # @BlockdevOptionsReplication:
4218 # Driver specific block device options for replication
4220 # @mode: the replication mode
4222 # @top-id: In secondary mode, node name or device ID of the root node
4223 #     who owns the replication node chain.  Must not be given in
4224 #     primary mode.
4226 # Since: 2.9
4228 { 'struct': 'BlockdevOptionsReplication',
4229   'base': 'BlockdevOptionsGenericFormat',
4230   'data': { 'mode': 'ReplicationMode',
4231             '*top-id': 'str' },
4232   'if': 'CONFIG_REPLICATION' }
4235 # @NFSTransport:
4237 # An enumeration of NFS transport types
4239 # @inet: TCP transport
4241 # Since: 2.9
4243 { 'enum': 'NFSTransport',
4244   'data': [ 'inet' ] }
4247 # @NFSServer:
4249 # Captures the address of the socket
4251 # @type: transport type used for NFS (only TCP supported)
4253 # @host: host address for NFS server
4255 # Since: 2.9
4257 { 'struct': 'NFSServer',
4258   'data': { 'type': 'NFSTransport',
4259             'host': 'str' } }
4262 # @BlockdevOptionsNfs:
4264 # Driver specific block device option for NFS
4266 # @server: host address
4268 # @path: path of the image on the host
4270 # @user: UID value to use when talking to the server (defaults to
4271 #     65534 on Windows and getuid() on unix)
4273 # @group: GID value to use when talking to the server (defaults to
4274 #     65534 on Windows and getgid() in unix)
4276 # @tcp-syn-count: number of SYNs during the session establishment
4277 #     (defaults to libnfs default)
4279 # @readahead-size: set the readahead size in bytes (defaults to libnfs
4280 #     default)
4282 # @page-cache-size: set the pagecache size in bytes (defaults to
4283 #     libnfs default)
4285 # @debug: set the NFS debug level (max 2) (defaults to libnfs default)
4287 # Since: 2.9
4289 { 'struct': 'BlockdevOptionsNfs',
4290   'data': { 'server': 'NFSServer',
4291             'path': 'str',
4292             '*user': 'int',
4293             '*group': 'int',
4294             '*tcp-syn-count': 'int',
4295             '*readahead-size': 'int',
4296             '*page-cache-size': 'int',
4297             '*debug': 'int' } }
4300 # @BlockdevOptionsCurlBase:
4302 # Driver specific block device options shared by all protocols
4303 # supported by the curl backend.
4305 # @url: URL of the image file
4307 # @readahead: Size of the read-ahead cache; must be a multiple of 512
4308 #     (defaults to 256 kB)
4310 # @timeout: Timeout for connections, in seconds (defaults to 5)
4312 # @username: Username for authentication (defaults to none)
4314 # @password-secret: ID of a QCryptoSecret object providing a password
4315 #     for authentication (defaults to no password)
4317 # @proxy-username: Username for proxy authentication (defaults to
4318 #     none)
4320 # @proxy-password-secret: ID of a QCryptoSecret object providing a
4321 #     password for proxy authentication (defaults to no password)
4323 # Since: 2.9
4325 { 'struct': 'BlockdevOptionsCurlBase',
4326   'data': { 'url': 'str',
4327             '*readahead': 'int',
4328             '*timeout': 'int',
4329             '*username': 'str',
4330             '*password-secret': 'str',
4331             '*proxy-username': 'str',
4332             '*proxy-password-secret': 'str' } }
4335 # @BlockdevOptionsCurlHttp:
4337 # Driver specific block device options for HTTP connections over the
4338 # curl backend.  URLs must start with "http://".
4340 # @cookie: List of cookies to set; format is "name1=content1;
4341 #     name2=content2;" as explained by CURLOPT_COOKIE(3). Defaults to
4342 #     no cookies.
4344 # @cookie-secret: ID of a QCryptoSecret object providing the cookie
4345 #     data in a secure way.  See @cookie for the format.  (since 2.10)
4347 # Since: 2.9
4349 { 'struct': 'BlockdevOptionsCurlHttp',
4350   'base': 'BlockdevOptionsCurlBase',
4351   'data': { '*cookie': 'str',
4352             '*cookie-secret': 'str'} }
4355 # @BlockdevOptionsCurlHttps:
4357 # Driver specific block device options for HTTPS connections over the
4358 # curl backend.  URLs must start with "https://".
4360 # @cookie: List of cookies to set; format is "name1=content1;
4361 #     name2=content2;" as explained by CURLOPT_COOKIE(3). Defaults to
4362 #     no cookies.
4364 # @sslverify: Whether to verify the SSL certificate's validity
4365 #     (defaults to true)
4367 # @cookie-secret: ID of a QCryptoSecret object providing the cookie
4368 #     data in a secure way.  See @cookie for the format.  (since 2.10)
4370 # Since: 2.9
4372 { 'struct': 'BlockdevOptionsCurlHttps',
4373   'base': 'BlockdevOptionsCurlBase',
4374   'data': { '*cookie': 'str',
4375             '*sslverify': 'bool',
4376             '*cookie-secret': 'str'} }
4379 # @BlockdevOptionsCurlFtp:
4381 # Driver specific block device options for FTP connections over the
4382 # curl backend.  URLs must start with "ftp://".
4384 # Since: 2.9
4386 { 'struct': 'BlockdevOptionsCurlFtp',
4387   'base': 'BlockdevOptionsCurlBase',
4388   'data': { } }
4391 # @BlockdevOptionsCurlFtps:
4393 # Driver specific block device options for FTPS connections over the
4394 # curl backend.  URLs must start with "ftps://".
4396 # @sslverify: Whether to verify the SSL certificate's validity
4397 #     (defaults to true)
4399 # Since: 2.9
4401 { 'struct': 'BlockdevOptionsCurlFtps',
4402   'base': 'BlockdevOptionsCurlBase',
4403   'data': { '*sslverify': 'bool' } }
4406 # @BlockdevOptionsNbd:
4408 # Driver specific block device options for NBD.
4410 # @server: NBD server address
4412 # @export: export name
4414 # @tls-creds: TLS credentials ID
4416 # @tls-hostname: TLS hostname override for certificate validation
4417 #     (Since 7.0)
4419 # @x-dirty-bitmap: A metadata context name such as
4420 #     "qemu:dirty-bitmap:NAME" or "qemu:allocation-depth" to query in
4421 #     place of the traditional "base:allocation" block status (see
4422 #     NBD_OPT_LIST_META_CONTEXT in the NBD protocol; and yes, naming
4423 #     this option x-context would have made more sense) (since 3.0)
4425 # @reconnect-delay: On an unexpected disconnect, the nbd client tries
4426 #     to connect again until succeeding or encountering a serious
4427 #     error.  During the first @reconnect-delay seconds, all requests
4428 #     are paused and will be rerun on a successful reconnect.  After
4429 #     that time, any delayed requests and all future requests before a
4430 #     successful reconnect will immediately fail.  Default 0 (Since
4431 #     4.2)
4433 # @open-timeout: In seconds.  If zero, the nbd driver tries the
4434 #     connection only once, and fails to open if the connection fails.
4435 #     If non-zero, the nbd driver will repeat connection attempts
4436 #     until successful or until @open-timeout seconds have elapsed.
4437 #     Default 0 (Since 7.0)
4439 # Features:
4441 # @unstable: Member @x-dirty-bitmap is experimental.
4443 # Since: 2.9
4445 { 'struct': 'BlockdevOptionsNbd',
4446   'data': { 'server': 'SocketAddress',
4447             '*export': 'str',
4448             '*tls-creds': 'str',
4449             '*tls-hostname': 'str',
4450             '*x-dirty-bitmap': { 'type': 'str', 'features': [ 'unstable' ] },
4451             '*reconnect-delay': 'uint32',
4452             '*open-timeout': 'uint32' } }
4455 # @BlockdevOptionsRaw:
4457 # Driver specific block device options for the raw driver.
4459 # @offset: position where the block device starts
4461 # @size: the assumed size of the device
4463 # Since: 2.9
4465 { 'struct': 'BlockdevOptionsRaw',
4466   'base': 'BlockdevOptionsGenericFormat',
4467   'data': { '*offset': 'int', '*size': 'int' } }
4470 # @BlockdevOptionsThrottle:
4472 # Driver specific block device options for the throttle driver
4474 # @throttle-group: the name of the throttle-group object to use.  It
4475 #     must already exist.
4477 # @file: reference to or definition of the data source block device
4479 # Since: 2.11
4481 { 'struct': 'BlockdevOptionsThrottle',
4482   'data': { 'throttle-group': 'str',
4483             'file' : 'BlockdevRef'
4484              } }
4487 # @BlockdevOptionsCor:
4489 # Driver specific block device options for the copy-on-read driver.
4491 # @bottom: The name of a non-filter node (allocation-bearing layer)
4492 #     that limits the COR operations in the backing chain (inclusive),
4493 #     so that no data below this node will be copied by this filter.
4494 #     If option is absent, the limit is not applied, so that data from
4495 #     all backing layers may be copied.
4497 # Since: 6.0
4499 { 'struct': 'BlockdevOptionsCor',
4500   'base': 'BlockdevOptionsGenericFormat',
4501   'data': { '*bottom': 'str' } }
4504 # @OnCbwError:
4506 # An enumeration of possible behaviors for copy-before-write operation
4507 # failures.
4509 # @break-guest-write: report the error to the guest.  This way, the
4510 #     guest will not be able to overwrite areas that cannot be backed
4511 #     up, so the backup process remains valid.
4513 # @break-snapshot: continue guest write.  Doing so will make the
4514 #     provided snapshot state invalid and any backup or export process
4515 #     based on it will finally fail.
4517 # Since: 7.1
4519 { 'enum': 'OnCbwError',
4520   'data': [ 'break-guest-write', 'break-snapshot' ] }
4523 # @BlockdevOptionsCbw:
4525 # Driver specific block device options for the copy-before-write
4526 # driver, which does so called copy-before-write operations: when data
4527 # is written to the filter, the filter first reads corresponding
4528 # blocks from its file child and copies them to @target child.  After
4529 # successfully copying, the write request is propagated to file child.
4530 # If copying fails, the original write request is failed too and no
4531 # data is written to file child.
4533 # @target: The target for copy-before-write operations.
4535 # @bitmap: If specified, copy-before-write filter will do
4536 #     copy-before-write operations only for dirty regions of the
4537 #     bitmap.  Bitmap size must be equal to length of file and target
4538 #     child of the filter.  Note also, that bitmap is used only to
4539 #     initialize internal bitmap of the process, so further
4540 #     modifications (or removing) of specified bitmap doesn't
4541 #     influence the filter.  (Since 7.0)
4543 # @on-cbw-error: Behavior on failure of copy-before-write operation.
4544 #     Default is @break-guest-write.  (Since 7.1)
4546 # @cbw-timeout: Zero means no limit.  Non-zero sets the timeout in
4547 #     seconds for copy-before-write operation.  When a timeout occurs,
4548 #     the respective copy-before-write operation will fail, and the
4549 #     @on-cbw-error parameter will decide how this failure is handled.
4550 #     Default 0. (Since 7.1)
4552 # Since: 6.2
4554 { 'struct': 'BlockdevOptionsCbw',
4555   'base': 'BlockdevOptionsGenericFormat',
4556   'data': { 'target': 'BlockdevRef', '*bitmap': 'BlockDirtyBitmap',
4557             '*on-cbw-error': 'OnCbwError', '*cbw-timeout': 'uint32' } }
4560 # @BlockdevOptions:
4562 # Options for creating a block device.  Many options are available for
4563 # all block devices, independent of the block driver:
4565 # @driver: block driver name
4567 # @node-name: the node name of the new node (Since 2.0). This option
4568 #     is required on the top level of blockdev-add.  Valid node names
4569 #     start with an alphabetic character and may contain only
4570 #     alphanumeric characters, '-', '.' and '_'. Their maximum length
4571 #     is 31 characters.
4573 # @discard: discard-related options (default: ignore)
4575 # @cache: cache-related options
4577 # @read-only: whether the block device should be read-only (default:
4578 #     false). Note that some block drivers support only read-only
4579 #     access, either generally or in certain configurations.  In this
4580 #     case, the default value does not work and the option must be
4581 #     specified explicitly.
4583 # @auto-read-only: if true and @read-only is false, QEMU may
4584 #     automatically decide not to open the image read-write as
4585 #     requested, but fall back to read-only instead (and switch
4586 #     between the modes later), e.g. depending on whether the image
4587 #     file is writable or whether a writing user is attached to the
4588 #     node (default: false, since 3.1)
4590 # @detect-zeroes: detect and optimize zero writes (Since 2.1)
4591 #     (default: off)
4593 # @force-share: force share all permission on added nodes.  Requires
4594 #     read-only=true.  (Since 2.10)
4596 # Remaining options are determined by the block driver.
4598 # Since: 2.9
4600 { 'union': 'BlockdevOptions',
4601   'base': { 'driver': 'BlockdevDriver',
4602             '*node-name': 'str',
4603             '*discard': 'BlockdevDiscardOptions',
4604             '*cache': 'BlockdevCacheOptions',
4605             '*read-only': 'bool',
4606             '*auto-read-only': 'bool',
4607             '*force-share': 'bool',
4608             '*detect-zeroes': 'BlockdevDetectZeroesOptions' },
4609   'discriminator': 'driver',
4610   'data': {
4611       'blkdebug':   'BlockdevOptionsBlkdebug',
4612       'blklogwrites':'BlockdevOptionsBlklogwrites',
4613       'blkverify':  'BlockdevOptionsBlkverify',
4614       'blkreplay':  'BlockdevOptionsBlkreplay',
4615       'bochs':      'BlockdevOptionsGenericFormat',
4616       'cloop':      'BlockdevOptionsGenericFormat',
4617       'compress':   'BlockdevOptionsGenericFormat',
4618       'copy-before-write':'BlockdevOptionsCbw',
4619       'copy-on-read':'BlockdevOptionsCor',
4620       'dmg':        'BlockdevOptionsGenericFormat',
4621       'file':       'BlockdevOptionsFile',
4622       'ftp':        'BlockdevOptionsCurlFtp',
4623       'ftps':       'BlockdevOptionsCurlFtps',
4624       'gluster':    'BlockdevOptionsGluster',
4625       'host_cdrom':  { 'type': 'BlockdevOptionsFile',
4626                        'if': 'HAVE_HOST_BLOCK_DEVICE' },
4627       'host_device': { 'type': 'BlockdevOptionsFile',
4628                        'if': 'HAVE_HOST_BLOCK_DEVICE' },
4629       'http':       'BlockdevOptionsCurlHttp',
4630       'https':      'BlockdevOptionsCurlHttps',
4631       'io_uring':   { 'type': 'BlockdevOptionsIoUring',
4632                       'if': 'CONFIG_BLKIO' },
4633       'iscsi':      'BlockdevOptionsIscsi',
4634       'luks':       'BlockdevOptionsLUKS',
4635       'nbd':        'BlockdevOptionsNbd',
4636       'nfs':        'BlockdevOptionsNfs',
4637       'null-aio':   'BlockdevOptionsNull',
4638       'null-co':    'BlockdevOptionsNull',
4639       'nvme':       'BlockdevOptionsNVMe',
4640       'nvme-io_uring': { 'type': 'BlockdevOptionsNvmeIoUring',
4641                          'if': 'CONFIG_BLKIO' },
4642       'parallels':  'BlockdevOptionsGenericFormat',
4643       'preallocate':'BlockdevOptionsPreallocate',
4644       'qcow2':      'BlockdevOptionsQcow2',
4645       'qcow':       'BlockdevOptionsQcow',
4646       'qed':        'BlockdevOptionsGenericCOWFormat',
4647       'quorum':     'BlockdevOptionsQuorum',
4648       'raw':        'BlockdevOptionsRaw',
4649       'rbd':        'BlockdevOptionsRbd',
4650       'replication': { 'type': 'BlockdevOptionsReplication',
4651                        'if': 'CONFIG_REPLICATION' },
4652       'snapshot-access': 'BlockdevOptionsGenericFormat',
4653       'ssh':        'BlockdevOptionsSsh',
4654       'throttle':   'BlockdevOptionsThrottle',
4655       'vdi':        'BlockdevOptionsGenericFormat',
4656       'vhdx':       'BlockdevOptionsGenericFormat',
4657       'virtio-blk-vfio-pci':
4658                     { 'type': 'BlockdevOptionsVirtioBlkVfioPci',
4659                       'if': 'CONFIG_BLKIO' },
4660       'virtio-blk-vhost-user':
4661                     { 'type': 'BlockdevOptionsVirtioBlkVhostUser',
4662                       'if': 'CONFIG_BLKIO' },
4663       'virtio-blk-vhost-vdpa':
4664                     { 'type': 'BlockdevOptionsVirtioBlkVhostVdpa',
4665                       'if': 'CONFIG_BLKIO' },
4666       'vmdk':       'BlockdevOptionsGenericCOWFormat',
4667       'vpc':        'BlockdevOptionsGenericFormat',
4668       'vvfat':      'BlockdevOptionsVVFAT'
4669   } }
4672 # @BlockdevRef:
4674 # Reference to a block device.
4676 # @definition: defines a new block device inline
4678 # @reference: references the ID of an existing block device
4680 # Since: 2.9
4682 { 'alternate': 'BlockdevRef',
4683   'data': { 'definition': 'BlockdevOptions',
4684             'reference': 'str' } }
4687 # @BlockdevRefOrNull:
4689 # Reference to a block device.
4691 # @definition: defines a new block device inline
4693 # @reference: references the ID of an existing block device.  An empty
4694 #     string means that no block device should be referenced.
4695 #     Deprecated; use null instead.
4697 # @null: No block device should be referenced (since 2.10)
4699 # Since: 2.9
4701 { 'alternate': 'BlockdevRefOrNull',
4702   'data': { 'definition': 'BlockdevOptions',
4703             'reference': 'str',
4704             'null': 'null' } }
4707 # @blockdev-add:
4709 # Creates a new block device.
4711 # Since: 2.9
4713 # Examples:
4715 # -> { "execute": "blockdev-add",
4716 #      "arguments": {
4717 #           "driver": "qcow2",
4718 #           "node-name": "test1",
4719 #           "file": {
4720 #               "driver": "file",
4721 #               "filename": "test.qcow2"
4722 #            }
4723 #       }
4724 #     }
4725 # <- { "return": {} }
4727 # -> { "execute": "blockdev-add",
4728 #      "arguments": {
4729 #           "driver": "qcow2",
4730 #           "node-name": "node0",
4731 #           "discard": "unmap",
4732 #           "cache": {
4733 #              "direct": true
4734 #            },
4735 #            "file": {
4736 #              "driver": "file",
4737 #              "filename": "/tmp/test.qcow2"
4738 #            },
4739 #            "backing": {
4740 #               "driver": "raw",
4741 #               "file": {
4742 #                  "driver": "file",
4743 #                  "filename": "/dev/fdset/4"
4744 #                }
4745 #            }
4746 #        }
4747 #      }
4749 # <- { "return": {} }
4751 { 'command': 'blockdev-add', 'data': 'BlockdevOptions', 'boxed': true,
4752   'allow-preconfig': true }
4755 # @blockdev-reopen:
4757 # Reopens one or more block devices using the given set of options.
4758 # Any option not specified will be reset to its default value
4759 # regardless of its previous status.  If an option cannot be changed
4760 # or a particular driver does not support reopening then the command
4761 # will return an error.  All devices in the list are reopened in one
4762 # transaction, so if one of them fails then the whole transaction is
4763 # cancelled.
4765 # The command receives a list of block devices to reopen.  For each
4766 # one of them, the top-level @node-name option (from BlockdevOptions)
4767 # must be specified and is used to select the block device to be
4768 # reopened.  Other @node-name options must be either omitted or set to
4769 # the current name of the appropriate node.  This command won't change
4770 # any node name and any attempt to do it will result in an error.
4772 # In the case of options that refer to child nodes, the behavior of
4773 # this command depends on the value:
4775 #  1) A set of options (BlockdevOptions): the child is reopened with
4776 #     the specified set of options.
4778 #  2) A reference to the current child: the child is reopened using
4779 #     its existing set of options.
4781 #  3) A reference to a different node: the current child is replaced
4782 #     with the specified one.
4784 #  4) NULL: the current child (if any) is detached.
4786 # Options (1) and (2) are supported in all cases.  Option (3) is
4787 # supported for @file and @backing, and option (4) for @backing only.
4789 # Unlike with blockdev-add, the @backing option must always be present
4790 # unless the node being reopened does not have a backing file and its
4791 # image does not have a default backing file name as part of its
4792 # metadata.
4794 # Since: 6.1
4796 { 'command': 'blockdev-reopen',
4797   'data': { 'options': ['BlockdevOptions'] },
4798   'allow-preconfig': true }
4801 # @blockdev-del:
4803 # Deletes a block device that has been added using blockdev-add.  The
4804 # command will fail if the node is attached to a device or is
4805 # otherwise being used.
4807 # @node-name: Name of the graph node to delete.
4809 # Since: 2.9
4811 # Example:
4813 # -> { "execute": "blockdev-add",
4814 #      "arguments": {
4815 #           "driver": "qcow2",
4816 #           "node-name": "node0",
4817 #           "file": {
4818 #               "driver": "file",
4819 #               "filename": "test.qcow2"
4820 #           }
4821 #      }
4822 #    }
4823 # <- { "return": {} }
4825 # -> { "execute": "blockdev-del",
4826 #      "arguments": { "node-name": "node0" }
4827 #    }
4828 # <- { "return": {} }
4830 { 'command': 'blockdev-del', 'data': { 'node-name': 'str' },
4831   'allow-preconfig': true }
4834 # @BlockdevCreateOptionsFile:
4836 # Driver specific image creation options for file.
4838 # @filename: Filename for the new image file
4840 # @size: Size of the virtual disk in bytes
4842 # @preallocation: Preallocation mode for the new image (default: off;
4843 #     allowed values: off, falloc (if CONFIG_POSIX_FALLOCATE), full
4844 #     (if CONFIG_POSIX))
4846 # @nocow: Turn off copy-on-write (valid only on btrfs; default: off)
4848 # @extent-size-hint: Extent size hint to add to the image file; 0 for
4849 #     not adding an extent size hint (default: 1 MB, since 5.1)
4851 # Since: 2.12
4853 { 'struct': 'BlockdevCreateOptionsFile',
4854   'data': { 'filename':             'str',
4855             'size':                 'size',
4856             '*preallocation':       'PreallocMode',
4857             '*nocow':               'bool',
4858             '*extent-size-hint':    'size'} }
4861 # @BlockdevCreateOptionsGluster:
4863 # Driver specific image creation options for gluster.
4865 # @location: Where to store the new image file
4867 # @size: Size of the virtual disk in bytes
4869 # @preallocation: Preallocation mode for the new image (default: off;
4870 #     allowed values: off, falloc (if CONFIG_GLUSTERFS_FALLOCATE),
4871 #     full (if CONFIG_GLUSTERFS_ZEROFILL))
4873 # Since: 2.12
4875 { 'struct': 'BlockdevCreateOptionsGluster',
4876   'data': { 'location':         'BlockdevOptionsGluster',
4877             'size':             'size',
4878             '*preallocation':   'PreallocMode' } }
4881 # @BlockdevCreateOptionsLUKS:
4883 # Driver specific image creation options for LUKS.
4885 # @file: Node to create the image format on
4887 # @size: Size of the virtual disk in bytes
4889 # @preallocation: Preallocation mode for the new image (since: 4.2)
4890 #     (default: off; allowed values: off, metadata, falloc, full)
4892 # Since: 2.12
4894 { 'struct': 'BlockdevCreateOptionsLUKS',
4895   'base': 'QCryptoBlockCreateOptionsLUKS',
4896   'data': { 'file':             'BlockdevRef',
4897             'size':             'size',
4898             '*preallocation':   'PreallocMode' } }
4901 # @BlockdevCreateOptionsNfs:
4903 # Driver specific image creation options for NFS.
4905 # @location: Where to store the new image file
4907 # @size: Size of the virtual disk in bytes
4909 # Since: 2.12
4911 { 'struct': 'BlockdevCreateOptionsNfs',
4912   'data': { 'location':         'BlockdevOptionsNfs',
4913             'size':             'size' } }
4916 # @BlockdevCreateOptionsParallels:
4918 # Driver specific image creation options for parallels.
4920 # @file: Node to create the image format on
4922 # @size: Size of the virtual disk in bytes
4924 # @cluster-size: Cluster size in bytes (default: 1 MB)
4926 # Since: 2.12
4928 { 'struct': 'BlockdevCreateOptionsParallels',
4929   'data': { 'file':             'BlockdevRef',
4930             'size':             'size',
4931             '*cluster-size':    'size' } }
4934 # @BlockdevCreateOptionsQcow:
4936 # Driver specific image creation options for qcow.
4938 # @file: Node to create the image format on
4940 # @size: Size of the virtual disk in bytes
4942 # @backing-file: File name of the backing file if a backing file
4943 #     should be used
4945 # @encrypt: Encryption options if the image should be encrypted
4947 # Since: 2.12
4949 { 'struct': 'BlockdevCreateOptionsQcow',
4950   'data': { 'file':             'BlockdevRef',
4951             'size':             'size',
4952             '*backing-file':    'str',
4953             '*encrypt':         'QCryptoBlockCreateOptions' } }
4956 # @BlockdevQcow2Version:
4958 # @v2: The original QCOW2 format as introduced in qemu 0.10 (version
4959 #     2)
4961 # @v3: The extended QCOW2 format as introduced in qemu 1.1 (version 3)
4963 # Since: 2.12
4965 { 'enum': 'BlockdevQcow2Version',
4966   'data': [ 'v2', 'v3' ] }
4969 # @Qcow2CompressionType:
4971 # Compression type used in qcow2 image file
4973 # @zlib: zlib compression, see <http://zlib.net/>
4975 # @zstd: zstd compression, see <http://github.com/facebook/zstd>
4977 # Since: 5.1
4979 { 'enum': 'Qcow2CompressionType',
4980   'data': [ 'zlib', { 'name': 'zstd', 'if': 'CONFIG_ZSTD' } ] }
4983 # @BlockdevCreateOptionsQcow2:
4985 # Driver specific image creation options for qcow2.
4987 # @file: Node to create the image format on
4989 # @data-file: Node to use as an external data file in which all guest
4990 #     data is stored so that only metadata remains in the qcow2 file
4991 #     (since: 4.0)
4993 # @data-file-raw: True if the external data file must stay valid as a
4994 #     standalone (read-only) raw image without looking at qcow2
4995 #     metadata (default: false; since: 4.0)
4997 # @extended-l2: True to make the image have extended L2 entries
4998 #     (default: false; since 5.2)
5000 # @size: Size of the virtual disk in bytes
5002 # @version: Compatibility level (default: v3)
5004 # @backing-file: File name of the backing file if a backing file
5005 #     should be used
5007 # @backing-fmt: Name of the block driver to use for the backing file
5009 # @encrypt: Encryption options if the image should be encrypted
5011 # @cluster-size: qcow2 cluster size in bytes (default: 65536)
5013 # @preallocation: Preallocation mode for the new image (default: off;
5014 #     allowed values: off, falloc, full, metadata)
5016 # @lazy-refcounts: True if refcounts may be updated lazily
5017 #     (default: off)
5019 # @refcount-bits: Width of reference counts in bits (default: 16)
5021 # @compression-type: The image cluster compression method
5022 #     (default: zlib, since 5.1)
5024 # Since: 2.12
5026 { 'struct': 'BlockdevCreateOptionsQcow2',
5027   'data': { 'file':             'BlockdevRef',
5028             '*data-file':       'BlockdevRef',
5029             '*data-file-raw':   'bool',
5030             '*extended-l2':     'bool',
5031             'size':             'size',
5032             '*version':         'BlockdevQcow2Version',
5033             '*backing-file':    'str',
5034             '*backing-fmt':     'BlockdevDriver',
5035             '*encrypt':         'QCryptoBlockCreateOptions',
5036             '*cluster-size':    'size',
5037             '*preallocation':   'PreallocMode',
5038             '*lazy-refcounts':  'bool',
5039             '*refcount-bits':   'int',
5040             '*compression-type':'Qcow2CompressionType' } }
5043 # @BlockdevCreateOptionsQed:
5045 # Driver specific image creation options for qed.
5047 # @file: Node to create the image format on
5049 # @size: Size of the virtual disk in bytes
5051 # @backing-file: File name of the backing file if a backing file
5052 #     should be used
5054 # @backing-fmt: Name of the block driver to use for the backing file
5056 # @cluster-size: Cluster size in bytes (default: 65536)
5058 # @table-size: L1/L2 table size (in clusters)
5060 # Since: 2.12
5062 { 'struct': 'BlockdevCreateOptionsQed',
5063   'data': { 'file':             'BlockdevRef',
5064             'size':             'size',
5065             '*backing-file':    'str',
5066             '*backing-fmt':     'BlockdevDriver',
5067             '*cluster-size':    'size',
5068             '*table-size':      'int' } }
5071 # @BlockdevCreateOptionsRbd:
5073 # Driver specific image creation options for rbd/Ceph.
5075 # @location: Where to store the new image file.  This location cannot
5076 #     point to a snapshot.
5078 # @size: Size of the virtual disk in bytes
5080 # @cluster-size: RBD object size
5082 # @encrypt: Image encryption options.  (Since 6.1)
5084 # Since: 2.12
5086 { 'struct': 'BlockdevCreateOptionsRbd',
5087   'data': { 'location':         'BlockdevOptionsRbd',
5088             'size':             'size',
5089             '*cluster-size' :   'size',
5090             '*encrypt' :        'RbdEncryptionCreateOptions' } }
5093 # @BlockdevVmdkSubformat:
5095 # Subformat options for VMDK images
5097 # @monolithicSparse: Single file image with sparse cluster allocation
5099 # @monolithicFlat: Single flat data image and a descriptor file
5101 # @twoGbMaxExtentSparse: Data is split into 2GB (per virtual LBA)
5102 #     sparse extent files, in addition to a descriptor file
5104 # @twoGbMaxExtentFlat: Data is split into 2GB (per virtual LBA) flat
5105 #     extent files, in addition to a descriptor file
5107 # @streamOptimized: Single file image sparse cluster allocation,
5108 #     optimized for streaming over network.
5110 # Since: 4.0
5112 { 'enum': 'BlockdevVmdkSubformat',
5113   'data': [ 'monolithicSparse', 'monolithicFlat', 'twoGbMaxExtentSparse',
5114             'twoGbMaxExtentFlat', 'streamOptimized'] }
5117 # @BlockdevVmdkAdapterType:
5119 # Adapter type info for VMDK images
5121 # Since: 4.0
5123 { 'enum': 'BlockdevVmdkAdapterType',
5124   'data': [ 'ide', 'buslogic', 'lsilogic', 'legacyESX'] }
5127 # @BlockdevCreateOptionsVmdk:
5129 # Driver specific image creation options for VMDK.
5131 # @file: Where to store the new image file.  This refers to the image
5132 #     file for monolithcSparse and streamOptimized format, or the
5133 #     descriptor file for other formats.
5135 # @size: Size of the virtual disk in bytes
5137 # @extents: Where to store the data extents.  Required for
5138 #     monolithcFlat, twoGbMaxExtentSparse and twoGbMaxExtentFlat
5139 #     formats.  For monolithicFlat, only one entry is required; for
5140 #     twoGbMaxExtent* formats, the number of entries required is
5141 #     calculated as extent_number = virtual_size / 2GB. Providing more
5142 #     extents than will be used is an error.
5144 # @subformat: The subformat of the VMDK image.  Default:
5145 #     "monolithicSparse".
5147 # @backing-file: The path of backing file.  Default: no backing file
5148 #     is used.
5150 # @adapter-type: The adapter type used to fill in the descriptor.
5151 #     Default: ide.
5153 # @hwversion: Hardware version.  The meaningful options are "4" or
5154 #     "6". Default: "4".
5156 # @toolsversion: VMware guest tools version.  Default: "2147483647"
5157 #     (Since 6.2)
5159 # @zeroed-grain: Whether to enable zeroed-grain feature for sparse
5160 #     subformats.  Default: false.
5162 # Since: 4.0
5164 { 'struct': 'BlockdevCreateOptionsVmdk',
5165   'data': { 'file':             'BlockdevRef',
5166             'size':             'size',
5167             '*extents':          ['BlockdevRef'],
5168             '*subformat':       'BlockdevVmdkSubformat',
5169             '*backing-file':    'str',
5170             '*adapter-type':    'BlockdevVmdkAdapterType',
5171             '*hwversion':       'str',
5172             '*toolsversion':    'str',
5173             '*zeroed-grain':    'bool' } }
5176 # @BlockdevCreateOptionsSsh:
5178 # Driver specific image creation options for SSH.
5180 # @location: Where to store the new image file
5182 # @size: Size of the virtual disk in bytes
5184 # Since: 2.12
5186 { 'struct': 'BlockdevCreateOptionsSsh',
5187   'data': { 'location':         'BlockdevOptionsSsh',
5188             'size':             'size' } }
5191 # @BlockdevCreateOptionsVdi:
5193 # Driver specific image creation options for VDI.
5195 # @file: Node to create the image format on
5197 # @size: Size of the virtual disk in bytes
5199 # @preallocation: Preallocation mode for the new image (default: off;
5200 #     allowed values: off, metadata)
5202 # Since: 2.12
5204 { 'struct': 'BlockdevCreateOptionsVdi',
5205   'data': { 'file':             'BlockdevRef',
5206             'size':             'size',
5207             '*preallocation':   'PreallocMode' } }
5210 # @BlockdevVhdxSubformat:
5212 # @dynamic: Growing image file
5214 # @fixed: Preallocated fixed-size image file
5216 # Since: 2.12
5218 { 'enum': 'BlockdevVhdxSubformat',
5219   'data': [ 'dynamic', 'fixed' ] }
5222 # @BlockdevCreateOptionsVhdx:
5224 # Driver specific image creation options for vhdx.
5226 # @file: Node to create the image format on
5228 # @size: Size of the virtual disk in bytes
5230 # @log-size: Log size in bytes, must be a multiple of 1 MB (default: 1
5231 #     MB)
5233 # @block-size: Block size in bytes, must be a multiple of 1 MB and not
5234 #     larger than 256 MB (default: automatically choose a block size
5235 #     depending on the image size)
5237 # @subformat: vhdx subformat (default: dynamic)
5239 # @block-state-zero: Force use of payload blocks of type 'ZERO'.
5240 #     Non-standard, but default.  Do not set to 'off' when using
5241 #     'qemu-img convert' with subformat=dynamic.
5243 # Since: 2.12
5245 { 'struct': 'BlockdevCreateOptionsVhdx',
5246   'data': { 'file':                 'BlockdevRef',
5247             'size':                 'size',
5248             '*log-size':            'size',
5249             '*block-size':          'size',
5250             '*subformat':           'BlockdevVhdxSubformat',
5251             '*block-state-zero':    'bool' } }
5254 # @BlockdevVpcSubformat:
5256 # @dynamic: Growing image file
5258 # @fixed: Preallocated fixed-size image file
5260 # Since: 2.12
5262 { 'enum': 'BlockdevVpcSubformat',
5263   'data': [ 'dynamic', 'fixed' ] }
5266 # @BlockdevCreateOptionsVpc:
5268 # Driver specific image creation options for vpc (VHD).
5270 # @file: Node to create the image format on
5272 # @size: Size of the virtual disk in bytes
5274 # @subformat: vhdx subformat (default: dynamic)
5276 # @force-size: Force use of the exact byte size instead of rounding to
5277 #     the next size that can be represented in CHS geometry
5278 #     (default: false)
5280 # Since: 2.12
5282 { 'struct': 'BlockdevCreateOptionsVpc',
5283   'data': { 'file':                 'BlockdevRef',
5284             'size':                 'size',
5285             '*subformat':           'BlockdevVpcSubformat',
5286             '*force-size':          'bool' } }
5289 # @BlockdevCreateOptions:
5291 # Options for creating an image format on a given node.
5293 # @driver: block driver to create the image format
5295 # Since: 2.12
5297 { 'union': 'BlockdevCreateOptions',
5298   'base': {
5299       'driver':         'BlockdevDriver' },
5300   'discriminator': 'driver',
5301   'data': {
5302       'file':           'BlockdevCreateOptionsFile',
5303       'gluster':        'BlockdevCreateOptionsGluster',
5304       'luks':           'BlockdevCreateOptionsLUKS',
5305       'nfs':            'BlockdevCreateOptionsNfs',
5306       'parallels':      'BlockdevCreateOptionsParallels',
5307       'qcow':           'BlockdevCreateOptionsQcow',
5308       'qcow2':          'BlockdevCreateOptionsQcow2',
5309       'qed':            'BlockdevCreateOptionsQed',
5310       'rbd':            'BlockdevCreateOptionsRbd',
5311       'ssh':            'BlockdevCreateOptionsSsh',
5312       'vdi':            'BlockdevCreateOptionsVdi',
5313       'vhdx':           'BlockdevCreateOptionsVhdx',
5314       'vmdk':           'BlockdevCreateOptionsVmdk',
5315       'vpc':            'BlockdevCreateOptionsVpc'
5316   } }
5319 # @blockdev-create:
5321 # Starts a job to create an image format on a given node.  The job is
5322 # automatically finalized, but a manual job-dismiss is required.
5324 # @job-id: Identifier for the newly created job.
5326 # @options: Options for the image creation.
5328 # Since: 3.0
5330 { 'command': 'blockdev-create',
5331   'data': { 'job-id': 'str',
5332             'options': 'BlockdevCreateOptions' },
5333   'allow-preconfig': true }
5336 # @BlockdevAmendOptionsLUKS:
5338 # Driver specific image amend options for LUKS.
5340 # Since: 5.1
5342 { 'struct': 'BlockdevAmendOptionsLUKS',
5343   'base': 'QCryptoBlockAmendOptionsLUKS',
5344   'data': { }
5348 # @BlockdevAmendOptionsQcow2:
5350 # Driver specific image amend options for qcow2. For now, only
5351 # encryption options can be amended
5353 # @encrypt: Encryption options to be amended
5355 # Since: 5.1
5357 { 'struct': 'BlockdevAmendOptionsQcow2',
5358   'data': { '*encrypt':         'QCryptoBlockAmendOptions' } }
5361 # @BlockdevAmendOptions:
5363 # Options for amending an image format
5365 # @driver: Block driver of the node to amend.
5367 # Since: 5.1
5369 { 'union': 'BlockdevAmendOptions',
5370   'base': {
5371       'driver':         'BlockdevDriver' },
5372   'discriminator': 'driver',
5373   'data': {
5374       'luks':           'BlockdevAmendOptionsLUKS',
5375       'qcow2':          'BlockdevAmendOptionsQcow2' } }
5378 # @x-blockdev-amend:
5380 # Starts a job to amend format specific options of an existing open
5381 # block device The job is automatically finalized, but a manual
5382 # job-dismiss is required.
5384 # @job-id: Identifier for the newly created job.
5386 # @node-name: Name of the block node to work on
5388 # @options: Options (driver specific)
5390 # @force: Allow unsafe operations, format specific For luks that
5391 #     allows erase of the last active keyslot (permanent loss of
5392 #     data), and replacement of an active keyslot (possible loss of
5393 #     data if IO error happens)
5395 # Features:
5397 # @unstable: This command is experimental.
5399 # Since: 5.1
5401 { 'command': 'x-blockdev-amend',
5402   'data': { 'job-id': 'str',
5403             'node-name': 'str',
5404             'options': 'BlockdevAmendOptions',
5405             '*force': 'bool' },
5406   'features': [ 'unstable' ],
5407   'allow-preconfig': true }
5410 # @BlockErrorAction:
5412 # An enumeration of action that has been taken when a DISK I/O occurs
5414 # @ignore: error has been ignored
5416 # @report: error has been reported to the device
5418 # @stop: error caused VM to be stopped
5420 # Since: 2.1
5422 { 'enum': 'BlockErrorAction',
5423   'data': [ 'ignore', 'report', 'stop' ] }
5426 # @BLOCK_IMAGE_CORRUPTED:
5428 # Emitted when a disk image is being marked corrupt.  The image can be
5429 # identified by its device or node name.  The 'device' field is always
5430 # present for compatibility reasons, but it can be empty ("") if the
5431 # image does not have a device name associated.
5433 # @device: device name.  This is always present for compatibility
5434 #     reasons, but it can be empty ("") if the image does not have a
5435 #     device name associated.
5437 # @node-name: node name (Since: 2.4)
5439 # @msg: informative message for human consumption, such as the kind of
5440 #     corruption being detected.  It should not be parsed by machine
5441 #     as it is not guaranteed to be stable
5443 # @offset: if the corruption resulted from an image access, this is
5444 #     the host's access offset into the image
5446 # @size: if the corruption resulted from an image access, this is the
5447 #     access size
5449 # @fatal: if set, the image is marked corrupt and therefore unusable
5450 #     after this event and must be repaired (Since 2.2; before, every
5451 #     BLOCK_IMAGE_CORRUPTED event was fatal)
5453 # Note: If action is "stop", a STOP event will eventually follow the
5454 #     BLOCK_IO_ERROR event.
5456 # Example:
5458 # <- { "event": "BLOCK_IMAGE_CORRUPTED",
5459 #      "data": { "device": "", "node-name": "drive", "fatal": false,
5460 #                "msg": "L2 table offset 0x2a2a2a00 unaligned (L1 index: 0)" },
5461 #      "timestamp": { "seconds": 1648243240, "microseconds": 906060 } }
5463 # Since: 1.7
5465 { 'event': 'BLOCK_IMAGE_CORRUPTED',
5466   'data': { 'device'     : 'str',
5467             '*node-name' : 'str',
5468             'msg'        : 'str',
5469             '*offset'    : 'int',
5470             '*size'      : 'int',
5471             'fatal'      : 'bool' } }
5474 # @BLOCK_IO_ERROR:
5476 # Emitted when a disk I/O error occurs
5478 # @device: device name.  This is always present for compatibility
5479 #     reasons, but it can be empty ("") if the image does not have a
5480 #     device name associated.
5482 # @node-name: node name.  Note that errors may be reported for the
5483 #     root node that is directly attached to a guest device rather
5484 #     than for the node where the error occurred.  The node name is
5485 #     not present if the drive is empty.  (Since: 2.8)
5487 # @operation: I/O operation
5489 # @action: action that has been taken
5491 # @nospace: true if I/O error was caused due to a no-space condition.
5492 #     This key is only present if query-block's io-status is present,
5493 #     please see query-block documentation for more information
5494 #     (since: 2.2)
5496 # @reason: human readable string describing the error cause.  (This
5497 #     field is a debugging aid for humans, it should not be parsed by
5498 #     applications) (since: 2.2)
5500 # Note: If action is "stop", a STOP event will eventually follow the
5501 #     BLOCK_IO_ERROR event
5503 # Since: 0.13
5505 # Example:
5507 # <- { "event": "BLOCK_IO_ERROR",
5508 #      "data": { "device": "ide0-hd1",
5509 #                "node-name": "#block212",
5510 #                "operation": "write",
5511 #                "action": "stop",
5512 #                "reason": "No space left on device" },
5513 #      "timestamp": { "seconds": 1265044230, "microseconds": 450486 } }
5515 { 'event': 'BLOCK_IO_ERROR',
5516   'data': { 'device': 'str', '*node-name': 'str',
5517             'operation': 'IoOperationType',
5518             'action': 'BlockErrorAction', '*nospace': 'bool',
5519             'reason': 'str' } }
5522 # @BLOCK_JOB_COMPLETED:
5524 # Emitted when a block job has completed
5526 # @type: job type
5528 # @device: The job identifier.  Originally the device name but other
5529 #     values are allowed since QEMU 2.7
5531 # @len: maximum progress value
5533 # @offset: current progress value.  On success this is equal to len.
5534 #     On failure this is less than len
5536 # @speed: rate limit, bytes per second
5538 # @error: error message.  Only present on failure.  This field
5539 #     contains a human-readable error message.  There are no semantics
5540 #     other than that streaming has failed and clients should not try
5541 #     to interpret the error string
5543 # Since: 1.1
5545 # Example:
5547 # <- { "event": "BLOCK_JOB_COMPLETED",
5548 #      "data": { "type": "stream", "device": "virtio-disk0",
5549 #                "len": 10737418240, "offset": 10737418240,
5550 #                "speed": 0 },
5551 #      "timestamp": { "seconds": 1267061043, "microseconds": 959568 } }
5553 { 'event': 'BLOCK_JOB_COMPLETED',
5554   'data': { 'type'  : 'JobType',
5555             'device': 'str',
5556             'len'   : 'int',
5557             'offset': 'int',
5558             'speed' : 'int',
5559             '*error': 'str' } }
5562 # @BLOCK_JOB_CANCELLED:
5564 # Emitted when a block job has been cancelled
5566 # @type: job type
5568 # @device: The job identifier.  Originally the device name but other
5569 #     values are allowed since QEMU 2.7
5571 # @len: maximum progress value
5573 # @offset: current progress value.  On success this is equal to len.
5574 #     On failure this is less than len
5576 # @speed: rate limit, bytes per second
5578 # Since: 1.1
5580 # Example:
5582 # <- { "event": "BLOCK_JOB_CANCELLED",
5583 #      "data": { "type": "stream", "device": "virtio-disk0",
5584 #                "len": 10737418240, "offset": 134217728,
5585 #                "speed": 0 },
5586 #      "timestamp": { "seconds": 1267061043, "microseconds": 959568 } }
5588 { 'event': 'BLOCK_JOB_CANCELLED',
5589   'data': { 'type'  : 'JobType',
5590             'device': 'str',
5591             'len'   : 'int',
5592             'offset': 'int',
5593             'speed' : 'int' } }
5596 # @BLOCK_JOB_ERROR:
5598 # Emitted when a block job encounters an error
5600 # @device: The job identifier.  Originally the device name but other
5601 #     values are allowed since QEMU 2.7
5603 # @operation: I/O operation
5605 # @action: action that has been taken
5607 # Since: 1.3
5609 # Example:
5611 # <- { "event": "BLOCK_JOB_ERROR",
5612 #      "data": { "device": "ide0-hd1",
5613 #                "operation": "write",
5614 #                "action": "stop" },
5615 #      "timestamp": { "seconds": 1265044230, "microseconds": 450486 } }
5617 { 'event': 'BLOCK_JOB_ERROR',
5618   'data': { 'device'   : 'str',
5619             'operation': 'IoOperationType',
5620             'action'   : 'BlockErrorAction' } }
5623 # @BLOCK_JOB_READY:
5625 # Emitted when a block job is ready to complete
5627 # @type: job type
5629 # @device: The job identifier.  Originally the device name but other
5630 #     values are allowed since QEMU 2.7
5632 # @len: maximum progress value
5634 # @offset: current progress value.  On success this is equal to len.
5635 #     On failure this is less than len
5637 # @speed: rate limit, bytes per second
5639 # Note: The "ready to complete" status is always reset by a
5640 #     @BLOCK_JOB_ERROR event
5642 # Since: 1.3
5644 # Example:
5646 # <- { "event": "BLOCK_JOB_READY",
5647 #      "data": { "device": "drive0", "type": "mirror", "speed": 0,
5648 #                "len": 2097152, "offset": 2097152 },
5649 #      "timestamp": { "seconds": 1265044230, "microseconds": 450486 } }
5651 { 'event': 'BLOCK_JOB_READY',
5652   'data': { 'type'  : 'JobType',
5653             'device': 'str',
5654             'len'   : 'int',
5655             'offset': 'int',
5656             'speed' : 'int' } }
5659 # @BLOCK_JOB_PENDING:
5661 # Emitted when a block job is awaiting explicit authorization to
5662 # finalize graph changes via @block-job-finalize.  If this job is part
5663 # of a transaction, it will not emit this event until the transaction
5664 # has converged first.
5666 # @type: job type
5668 # @id: The job identifier.
5670 # Since: 2.12
5672 # Example:
5674 # <- { "event": "BLOCK_JOB_PENDING",
5675 #      "data": { "type": "mirror", "id": "backup_1" },
5676 #      "timestamp": { "seconds": 1265044230, "microseconds": 450486 } }
5678 { 'event': 'BLOCK_JOB_PENDING',
5679   'data': { 'type'  : 'JobType',
5680             'id'    : 'str' } }
5683 # @PreallocMode:
5685 # Preallocation mode of QEMU image file
5687 # @off: no preallocation
5689 # @metadata: preallocate only for metadata
5691 # @falloc: like @full preallocation but allocate disk space by
5692 #     posix_fallocate() rather than writing data.
5694 # @full: preallocate all data by writing it to the device to ensure
5695 #     disk space is really available.  This data may or may not be
5696 #     zero, depending on the image format and storage.  @full
5697 #     preallocation also sets up metadata correctly.
5699 # Since: 2.2
5701 { 'enum': 'PreallocMode',
5702   'data': [ 'off', 'metadata', 'falloc', 'full' ] }
5705 # @BLOCK_WRITE_THRESHOLD:
5707 # Emitted when writes on block device reaches or exceeds the
5708 # configured write threshold.  For thin-provisioned devices, this
5709 # means the device should be extended to avoid pausing for disk
5710 # exhaustion.  The event is one shot.  Once triggered, it needs to be
5711 # re-registered with another block-set-write-threshold command.
5713 # @node-name: graph node name on which the threshold was exceeded.
5715 # @amount-exceeded: amount of data which exceeded the threshold, in
5716 #     bytes.
5718 # @write-threshold: last configured threshold, in bytes.
5720 # Since: 2.3
5722 { 'event': 'BLOCK_WRITE_THRESHOLD',
5723   'data': { 'node-name': 'str',
5724             'amount-exceeded': 'uint64',
5725             'write-threshold': 'uint64' } }
5728 # @block-set-write-threshold:
5730 # Change the write threshold for a block drive.  An event will be
5731 # delivered if a write to this block drive crosses the configured
5732 # threshold.  The threshold is an offset, thus must be non-negative.
5733 # Default is no write threshold.  Setting the threshold to zero
5734 # disables it.
5736 # This is useful to transparently resize thin-provisioned drives
5737 # without the guest OS noticing.
5739 # @node-name: graph node name on which the threshold must be set.
5741 # @write-threshold: configured threshold for the block device, bytes.
5742 #     Use 0 to disable the threshold.
5744 # Since: 2.3
5746 # Example:
5748 # -> { "execute": "block-set-write-threshold",
5749 #      "arguments": { "node-name": "mydev",
5750 #                     "write-threshold": 17179869184 } }
5751 # <- { "return": {} }
5753 { 'command': 'block-set-write-threshold',
5754   'data': { 'node-name': 'str', 'write-threshold': 'uint64' },
5755   'allow-preconfig': true }
5758 # @x-blockdev-change:
5760 # Dynamically reconfigure the block driver state graph.  It can be
5761 # used to add, remove, insert or replace a graph node.  Currently only
5762 # the Quorum driver implements this feature to add or remove its
5763 # child.  This is useful to fix a broken quorum child.
5765 # If @node is specified, it will be inserted under @parent.  @child
5766 # may not be specified in this case.  If both @parent and @child are
5767 # specified but @node is not, @child will be detached from @parent.
5769 # @parent: the id or name of the parent node.
5771 # @child: the name of a child under the given parent node.
5773 # @node: the name of the node that will be added.
5775 # Features:
5777 # @unstable: This command is experimental, and its API is not stable.
5778 #     It does not support all kinds of operations, all kinds of
5779 #     children, nor all block drivers.
5781 #     FIXME Removing children from a quorum node means introducing
5782 #     gaps in the child indices.  This cannot be represented in the
5783 #     'children' list of BlockdevOptionsQuorum, as returned by
5784 #     .bdrv_refresh_filename().
5786 #     Warning: The data in a new quorum child MUST be consistent with
5787 #     that of the rest of the array.
5789 # Since: 2.7
5791 # Examples:
5793 # 1. Add a new node to a quorum
5795 # -> { "execute": "blockdev-add",
5796 #      "arguments": {
5797 #          "driver": "raw",
5798 #          "node-name": "new_node",
5799 #          "file": { "driver": "file",
5800 #                    "filename": "test.raw" } } }
5801 # <- { "return": {} }
5802 # -> { "execute": "x-blockdev-change",
5803 #      "arguments": { "parent": "disk1",
5804 #                     "node": "new_node" } }
5805 # <- { "return": {} }
5807 # 2. Delete a quorum's node
5809 # -> { "execute": "x-blockdev-change",
5810 #      "arguments": { "parent": "disk1",
5811 #                     "child": "children.1" } }
5812 # <- { "return": {} }
5814 { 'command': 'x-blockdev-change',
5815   'data' : { 'parent': 'str',
5816              '*child': 'str',
5817              '*node': 'str' },
5818   'features': [ 'unstable' ],
5819   'allow-preconfig': true }
5822 # @x-blockdev-set-iothread:
5824 # Move @node and its children into the @iothread.  If @iothread is
5825 # null then move @node and its children into the main loop.
5827 # The node must not be attached to a BlockBackend.
5829 # @node-name: the name of the block driver node
5831 # @iothread: the name of the IOThread object or null for the main loop
5833 # @force: true if the node and its children should be moved when a
5834 #     BlockBackend is already attached
5836 # Features:
5838 # @unstable: This command is experimental and intended for test cases
5839 #     that need control over IOThreads only.
5841 # Since: 2.12
5843 # Examples:
5845 # 1. Move a node into an IOThread
5847 # -> { "execute": "x-blockdev-set-iothread",
5848 #      "arguments": { "node-name": "disk1",
5849 #                     "iothread": "iothread0" } }
5850 # <- { "return": {} }
5852 # 2. Move a node into the main loop
5854 # -> { "execute": "x-blockdev-set-iothread",
5855 #      "arguments": { "node-name": "disk1",
5856 #                     "iothread": null } }
5857 # <- { "return": {} }
5859 { 'command': 'x-blockdev-set-iothread',
5860   'data' : { 'node-name': 'str',
5861              'iothread': 'StrOrNull',
5862              '*force': 'bool' },
5863   'features': [ 'unstable' ],
5864   'allow-preconfig': true }
5867 # @QuorumOpType:
5869 # An enumeration of the quorum operation types
5871 # @read: read operation
5873 # @write: write operation
5875 # @flush: flush operation
5877 # Since: 2.6
5879 { 'enum': 'QuorumOpType',
5880   'data': [ 'read', 'write', 'flush' ] }
5883 # @QUORUM_FAILURE:
5885 # Emitted by the Quorum block driver if it fails to establish a quorum
5887 # @reference: device name if defined else node name
5889 # @sector-num: number of the first sector of the failed read operation
5891 # @sectors-count: failed read operation sector count
5893 # Note: This event is rate-limited.
5895 # Since: 2.0
5897 # Example:
5899 # <- { "event": "QUORUM_FAILURE",
5900 #      "data": { "reference": "usr1", "sector-num": 345435, "sectors-count": 5 },
5901 #      "timestamp": { "seconds": 1344522075, "microseconds": 745528 } }
5903 { 'event': 'QUORUM_FAILURE',
5904   'data': { 'reference': 'str', 'sector-num': 'int', 'sectors-count': 'int' } }
5907 # @QUORUM_REPORT_BAD:
5909 # Emitted to report a corruption of a Quorum file
5911 # @type: quorum operation type (Since 2.6)
5913 # @error: error message.  Only present on failure.  This field
5914 #     contains a human-readable error message.  There are no semantics
5915 #     other than that the block layer reported an error and clients
5916 #     should not try to interpret the error string.
5918 # @node-name: the graph node name of the block driver state
5920 # @sector-num: number of the first sector of the failed read operation
5922 # @sectors-count: failed read operation sector count
5924 # Note: This event is rate-limited.
5926 # Since: 2.0
5928 # Examples:
5930 # 1. Read operation
5932 # <- { "event": "QUORUM_REPORT_BAD",
5933 #      "data": { "node-name": "node0", "sector-num": 345435, "sectors-count": 5,
5934 #                "type": "read" },
5935 #      "timestamp": { "seconds": 1344522075, "microseconds": 745528 } }
5937 # 2. Flush operation
5939 # <- { "event": "QUORUM_REPORT_BAD",
5940 #      "data": { "node-name": "node0", "sector-num": 0, "sectors-count": 2097120,
5941 #                "type": "flush", "error": "Broken pipe" },
5942 #      "timestamp": { "seconds": 1456406829, "microseconds": 291763 } }
5944 { 'event': 'QUORUM_REPORT_BAD',
5945   'data': { 'type': 'QuorumOpType', '*error': 'str', 'node-name': 'str',
5946             'sector-num': 'int', 'sectors-count': 'int' } }
5949 # @BlockdevSnapshotInternal:
5951 # @device: the device name or node-name of a root node to generate the
5952 #     snapshot from
5954 # @name: the name of the internal snapshot to be created
5956 # Notes: In transaction, if @name is empty, or any snapshot matching
5957 #     @name exists, the operation will fail.  Only some image formats
5958 #     support it, for example, qcow2, and rbd.
5960 # Since: 1.7
5962 { 'struct': 'BlockdevSnapshotInternal',
5963   'data': { 'device': 'str', 'name': 'str' } }
5966 # @blockdev-snapshot-internal-sync:
5968 # Synchronously take an internal snapshot of a block device, when the
5969 # format of the image used supports it.  If the name is an empty
5970 # string, or a snapshot with name already exists, the operation will
5971 # fail.
5973 # For the arguments, see the documentation of
5974 # BlockdevSnapshotInternal.
5976 # Returns:
5977 #     - nothing on success
5978 #     - If @device is not a valid block device, GenericError
5979 #     - If any snapshot matching @name exists, or @name is empty,
5980 #       GenericError
5981 #     - If the format of the image used does not support it,
5982 #       GenericError
5984 # Since: 1.7
5986 # Example:
5988 # -> { "execute": "blockdev-snapshot-internal-sync",
5989 #      "arguments": { "device": "ide-hd0",
5990 #                     "name": "snapshot0" }
5991 #    }
5992 # <- { "return": {} }
5994 { 'command': 'blockdev-snapshot-internal-sync',
5995   'data': 'BlockdevSnapshotInternal',
5996   'allow-preconfig': true }
5999 # @blockdev-snapshot-delete-internal-sync:
6001 # Synchronously delete an internal snapshot of a block device, when
6002 # the format of the image used support it.  The snapshot is identified
6003 # by name or id or both.  One of the name or id is required.  Return
6004 # SnapshotInfo for the successfully deleted snapshot.
6006 # @device: the device name or node-name of a root node to delete the
6007 #     snapshot from
6009 # @id: optional the snapshot's ID to be deleted
6011 # @name: optional the snapshot's name to be deleted
6013 # Returns:
6014 #     - SnapshotInfo on success
6015 #     - If @device is not a valid block device, GenericError
6016 #     - If snapshot not found, GenericError
6017 #     - If the format of the image used does not support it,
6018 #       GenericError
6019 #     - If @id and @name are both not specified, GenericError
6021 # Since: 1.7
6023 # Example:
6025 # -> { "execute": "blockdev-snapshot-delete-internal-sync",
6026 #      "arguments": { "device": "ide-hd0",
6027 #                     "name": "snapshot0" }
6028 #    }
6029 # <- { "return": {
6030 #                    "id": "1",
6031 #                    "name": "snapshot0",
6032 #                    "vm-state-size": 0,
6033 #                    "date-sec": 1000012,
6034 #                    "date-nsec": 10,
6035 #                    "vm-clock-sec": 100,
6036 #                    "vm-clock-nsec": 20,
6037 #                    "icount": 220414
6038 #      }
6039 #    }
6041 { 'command': 'blockdev-snapshot-delete-internal-sync',
6042   'data': { 'device': 'str', '*id': 'str', '*name': 'str'},
6043   'returns': 'SnapshotInfo',
6044   'allow-preconfig': true }
6047 # @DummyBlockCoreForceArrays:
6049 # Not used by QMP; hack to let us use BlockGraphInfoList internally
6051 # Since: 8.0
6053 { 'struct': 'DummyBlockCoreForceArrays',
6054   'data': { 'unused-block-graph-info': ['BlockGraphInfo'] } }