hw: megasas: consider 'iov_count=0' is an error in megasas_map_sgl
[qemu/ar7.git] / qapi / block-core.json
blob86ed72ef9fa0ca4c1af286a24245103202c6a120
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 vm-clock-sec
30 # Since: 1.3
33 { 'struct': 'SnapshotInfo',
34   'data': { 'id': 'str', 'name': 'str', 'vm-state-size': 'int',
35             'date-sec': 'int', 'date-nsec': 'int',
36             'vm-clock-sec': 'int', 'vm-clock-nsec': 'int' } }
39 # @ImageInfoSpecificQCow2EncryptionBase:
41 # @format: The encryption format
43 # Since: 2.10
45 { 'struct': 'ImageInfoSpecificQCow2EncryptionBase',
46   'data': { 'format': 'BlockdevQcow2EncryptionFormat'}}
49 # @ImageInfoSpecificQCow2Encryption:
51 # Since: 2.10
53 { 'union': 'ImageInfoSpecificQCow2Encryption',
54   'base': 'ImageInfoSpecificQCow2EncryptionBase',
55   'discriminator': 'format',
56   'data': { 'luks': 'QCryptoBlockInfoLUKS' } }
59 # @ImageInfoSpecificQCow2:
61 # @compat: compatibility level
63 # @data-file: the filename of the external data file that is stored in the
64 #             image and used as a default for opening the image (since: 4.0)
66 # @data-file-raw: True if the external data file must stay valid as a
67 #                 standalone (read-only) raw image without looking at qcow2
68 #                 metadata (since: 4.0)
70 # @extended-l2: true if the image has extended L2 entries; only valid for
71 #               compat >= 1.1 (since 5.2)
73 # @lazy-refcounts: on or off; only valid for compat >= 1.1
75 # @corrupt: true if the image has been marked corrupt; only valid for
76 #           compat >= 1.1 (since 2.2)
78 # @refcount-bits: width of a refcount entry in bits (since 2.3)
80 # @encrypt: details about encryption parameters; only set if image
81 #           is encrypted (since 2.10)
83 # @bitmaps: A list of qcow2 bitmap details (since 4.0)
85 # @compression-type: the image cluster compression method (since 5.1)
87 # Since: 1.7
89 { 'struct': 'ImageInfoSpecificQCow2',
90   'data': {
91       'compat': 'str',
92       '*data-file': 'str',
93       '*data-file-raw': 'bool',
94       '*extended-l2': 'bool',
95       '*lazy-refcounts': 'bool',
96       '*corrupt': 'bool',
97       'refcount-bits': 'int',
98       '*encrypt': 'ImageInfoSpecificQCow2Encryption',
99       '*bitmaps': ['Qcow2BitmapInfo'],
100       'compression-type': 'Qcow2CompressionType'
101   } }
104 # @ImageInfoSpecificVmdk:
106 # @create-type: The create type of VMDK image
108 # @cid: Content id of image
110 # @parent-cid: Parent VMDK image's cid
112 # @extents: List of extent files
114 # Since: 1.7
116 { 'struct': 'ImageInfoSpecificVmdk',
117   'data': {
118       'create-type': 'str',
119       'cid': 'int',
120       'parent-cid': 'int',
121       'extents': ['ImageInfo']
122   } }
125 # @ImageInfoSpecific:
127 # A discriminated record of image format specific information structures.
129 # Since: 1.7
131 { 'union': 'ImageInfoSpecific',
132   'data': {
133       'qcow2': 'ImageInfoSpecificQCow2',
134       'vmdk': 'ImageInfoSpecificVmdk',
135       # If we need to add block driver specific parameters for
136       # LUKS in future, then we'll subclass QCryptoBlockInfoLUKS
137       # to define a ImageInfoSpecificLUKS
138       'luks': 'QCryptoBlockInfoLUKS'
139   } }
142 # @ImageInfo:
144 # Information about a QEMU image file
146 # @filename: name of the image file
148 # @format: format of the image file
150 # @virtual-size: maximum capacity in bytes of the image
152 # @actual-size: actual size on disk in bytes of the image
154 # @dirty-flag: true if image is not cleanly closed
156 # @cluster-size: size of a cluster in bytes
158 # @encrypted: true if the image is encrypted
160 # @compressed: true if the image is compressed (Since 1.7)
162 # @backing-filename: name of the backing file
164 # @full-backing-filename: full path of the backing file
166 # @backing-filename-format: the format of the backing file
168 # @snapshots: list of VM snapshots
170 # @backing-image: info of the backing image (since 1.6)
172 # @format-specific: structure supplying additional format-specific
173 #                   information (since 1.7)
175 # Since: 1.3
178 { 'struct': 'ImageInfo',
179   'data': {'filename': 'str', 'format': 'str', '*dirty-flag': 'bool',
180            '*actual-size': 'int', 'virtual-size': 'int',
181            '*cluster-size': 'int', '*encrypted': 'bool', '*compressed': 'bool',
182            '*backing-filename': 'str', '*full-backing-filename': 'str',
183            '*backing-filename-format': 'str', '*snapshots': ['SnapshotInfo'],
184            '*backing-image': 'ImageInfo',
185            '*format-specific': 'ImageInfoSpecific' } }
188 # @ImageCheck:
190 # Information about a QEMU image file check
192 # @filename: name of the image file checked
194 # @format: format of the image file checked
196 # @check-errors: number of unexpected errors occurred during check
198 # @image-end-offset: offset (in bytes) where the image ends, this
199 #                    field is present if the driver for the image format
200 #                    supports it
202 # @corruptions: number of corruptions found during the check if any
204 # @leaks: number of leaks found during the check if any
206 # @corruptions-fixed: number of corruptions fixed during the check
207 #                     if any
209 # @leaks-fixed: number of leaks fixed during the check if any
211 # @total-clusters: total number of clusters, this field is present
212 #                  if the driver for the image format supports it
214 # @allocated-clusters: total number of allocated clusters, this
215 #                      field is present if the driver for the image format
216 #                      supports it
218 # @fragmented-clusters: total number of fragmented clusters, this
219 #                       field is present if the driver for the image format
220 #                       supports it
222 # @compressed-clusters: total number of compressed clusters, this
223 #                       field is present if the driver for the image format
224 #                       supports it
226 # Since: 1.4
229 { 'struct': 'ImageCheck',
230   'data': {'filename': 'str', 'format': 'str', 'check-errors': 'int',
231            '*image-end-offset': 'int', '*corruptions': 'int', '*leaks': 'int',
232            '*corruptions-fixed': 'int', '*leaks-fixed': 'int',
233            '*total-clusters': 'int', '*allocated-clusters': 'int',
234            '*fragmented-clusters': 'int', '*compressed-clusters': 'int' } }
237 # @MapEntry:
239 # Mapping information from a virtual block range to a host file range
241 # @start: the start byte of the mapped virtual range
243 # @length: the number of bytes of the mapped virtual range
245 # @data: whether the mapped range has data
247 # @zero: whether the virtual blocks are zeroed
249 # @depth: the depth of the mapping
251 # @offset: the offset in file that the virtual sectors are mapped to
253 # @filename: filename that is referred to by @offset
255 # Since: 2.6
258 { 'struct': 'MapEntry',
259   'data': {'start': 'int', 'length': 'int', 'data': 'bool',
260            'zero': 'bool', 'depth': 'int', '*offset': 'int',
261            '*filename': 'str' } }
264 # @BlockdevCacheInfo:
266 # Cache mode information for a block device
268 # @writeback:   true if writeback mode is enabled
269 # @direct:      true if the host page cache is bypassed (O_DIRECT)
270 # @no-flush:    true if flush requests are ignored for the device
272 # Since: 2.3
274 { 'struct': 'BlockdevCacheInfo',
275   'data': { 'writeback': 'bool',
276             'direct': 'bool',
277             'no-flush': 'bool' } }
280 # @BlockDeviceInfo:
282 # Information about the backing device for a block device.
284 # @file: the filename of the backing device
286 # @node-name: the name of the block driver node (Since 2.0)
288 # @ro: true if the backing device was open read-only
290 # @drv: the name of the block format used to open the backing device. As of
291 #       0.14.0 this can be: 'blkdebug', 'bochs', 'cloop', 'cow', 'dmg',
292 #       'file', 'file', 'ftp', 'ftps', 'host_cdrom', 'host_device',
293 #       'http', 'https', 'luks', 'nbd', 'parallels', 'qcow',
294 #       'qcow2', 'raw', 'vdi', 'vmdk', 'vpc', 'vvfat'
295 #       2.2: 'archipelago' added, 'cow' dropped
296 #       2.3: 'host_floppy' deprecated
297 #       2.5: 'host_floppy' dropped
298 #       2.6: 'luks' added
299 #       2.8: 'replication' added, 'tftp' dropped
300 #       2.9: 'archipelago' dropped
302 # @backing_file: the name of the backing file (for copy-on-write)
304 # @backing_file_depth: number of files in the backing file chain (since: 1.2)
306 # @encrypted: true if the backing device is encrypted
308 # @encryption_key_missing: always false
310 # @detect_zeroes: detect and optimize zero writes (Since 2.1)
312 # @bps: total throughput limit in bytes per second is specified
314 # @bps_rd: read throughput limit in bytes per second is specified
316 # @bps_wr: write throughput limit in bytes per second is specified
318 # @iops: total I/O operations per second is specified
320 # @iops_rd: read I/O operations per second is specified
322 # @iops_wr: write I/O operations per second is specified
324 # @image: the info of image used (since: 1.6)
326 # @bps_max: total throughput limit during bursts,
327 #                     in bytes (Since 1.7)
329 # @bps_rd_max: read throughput limit during bursts,
330 #                        in bytes (Since 1.7)
332 # @bps_wr_max: write throughput limit during bursts,
333 #                        in bytes (Since 1.7)
335 # @iops_max: total I/O operations per second during bursts,
336 #                      in bytes (Since 1.7)
338 # @iops_rd_max: read I/O operations per second during bursts,
339 #                         in bytes (Since 1.7)
341 # @iops_wr_max: write I/O operations per second during bursts,
342 #                         in bytes (Since 1.7)
344 # @bps_max_length: maximum length of the @bps_max burst
345 #                            period, in seconds. (Since 2.6)
347 # @bps_rd_max_length: maximum length of the @bps_rd_max
348 #                               burst period, in seconds. (Since 2.6)
350 # @bps_wr_max_length: maximum length of the @bps_wr_max
351 #                               burst period, in seconds. (Since 2.6)
353 # @iops_max_length: maximum length of the @iops burst
354 #                             period, in seconds. (Since 2.6)
356 # @iops_rd_max_length: maximum length of the @iops_rd_max
357 #                                burst period, in seconds. (Since 2.6)
359 # @iops_wr_max_length: maximum length of the @iops_wr_max
360 #                                burst period, in seconds. (Since 2.6)
362 # @iops_size: an I/O size in bytes (Since 1.7)
364 # @group: throttle group name (Since 2.4)
366 # @cache: the cache mode used for the block device (since: 2.3)
368 # @write_threshold: configured write threshold for the device.
369 #                   0 if disabled. (Since 2.3)
371 # @dirty-bitmaps: dirty bitmaps information (only present if node
372 #                 has one or more dirty bitmaps) (Since 4.2)
374 # Features:
375 # @deprecated: Member @encryption_key_missing is deprecated.  It is
376 #              always false.
378 # Since: 0.14.0
381 { 'struct': 'BlockDeviceInfo',
382   'data': { 'file': 'str', '*node-name': 'str', 'ro': 'bool', 'drv': 'str',
383             '*backing_file': 'str', 'backing_file_depth': 'int',
384             'encrypted': 'bool',
385             'encryption_key_missing': { 'type': 'bool',
386                                         'features': [ 'deprecated' ] },
387             'detect_zeroes': 'BlockdevDetectZeroesOptions',
388             'bps': 'int', 'bps_rd': 'int', 'bps_wr': 'int',
389             'iops': 'int', 'iops_rd': 'int', 'iops_wr': 'int',
390             'image': 'ImageInfo',
391             '*bps_max': 'int', '*bps_rd_max': 'int',
392             '*bps_wr_max': 'int', '*iops_max': 'int',
393             '*iops_rd_max': 'int', '*iops_wr_max': 'int',
394             '*bps_max_length': 'int', '*bps_rd_max_length': 'int',
395             '*bps_wr_max_length': 'int', '*iops_max_length': 'int',
396             '*iops_rd_max_length': 'int', '*iops_wr_max_length': 'int',
397             '*iops_size': 'int', '*group': 'str', 'cache': 'BlockdevCacheInfo',
398             'write_threshold': 'int', '*dirty-bitmaps': ['BlockDirtyInfo'] } }
401 # @BlockDeviceIoStatus:
403 # An enumeration of block device I/O status.
405 # @ok: The last I/O operation has succeeded
407 # @failed: The last I/O operation has failed
409 # @nospace: The last I/O operation has failed due to a no-space condition
411 # Since: 1.0
413 { 'enum': 'BlockDeviceIoStatus', 'data': [ 'ok', 'failed', 'nospace' ] }
416 # @BlockDeviceMapEntry:
418 # Entry in the metadata map of the device (returned by "qemu-img map")
420 # @start: Offset in the image of the first byte described by this entry
421 #         (in bytes)
423 # @length: Length of the range described by this entry (in bytes)
425 # @depth: Number of layers (0 = top image, 1 = top image's backing file, etc.)
426 #         before reaching one for which the range is allocated.  The value is
427 #         in the range 0 to the depth of the image chain - 1.
429 # @zero: the sectors in this range read as zeros
431 # @data: reading the image will actually read data from a file (in particular,
432 #        if @offset is present this means that the sectors are not simply
433 #        preallocated, but contain actual data in raw format)
435 # @offset: if present, the image file stores the data for this range in
436 #          raw format at the given offset.
438 # Since: 1.7
440 { 'struct': 'BlockDeviceMapEntry',
441   'data': { 'start': 'int', 'length': 'int', 'depth': 'int', 'zero': 'bool',
442             'data': 'bool', '*offset': 'int' } }
445 # @DirtyBitmapStatus:
447 # An enumeration of possible states that a dirty bitmap can report to the user.
449 # @frozen: The bitmap is currently in-use by some operation and is immutable.
450 #          If the bitmap was @active prior to the operation, new writes by the
451 #          guest are being recorded in a temporary buffer, and will not be lost.
452 #          Generally, bitmaps are cleared on successful use in an operation and
453 #          the temporary buffer is committed into the bitmap. On failure, the
454 #          temporary buffer is merged back into the bitmap without first
455 #          clearing it.
456 #          Please refer to the documentation for each bitmap-using operation,
457 #          See also @blockdev-backup, @drive-backup.
459 # @disabled: The bitmap is not currently recording new writes by the guest.
460 #            This is requested explicitly via @block-dirty-bitmap-disable.
461 #            It can still be cleared, deleted, or used for backup operations.
463 # @active: The bitmap is actively monitoring for new writes, and can be cleared,
464 #          deleted, or used for backup operations.
466 # @locked: The bitmap is currently in-use by some operation and is immutable.
467 #          If the bitmap was @active prior to the operation, it is still
468 #          recording new writes. If the bitmap was @disabled, it is not
469 #          recording new writes. (Since 2.12)
471 # @inconsistent: This is a persistent dirty bitmap that was marked in-use on
472 #                disk, and is unusable by QEMU. It can only be deleted.
473 #                Please rely on the inconsistent field in @BlockDirtyInfo
474 #                instead, as the status field is deprecated. (Since 4.0)
476 # Since: 2.4
478 { 'enum': 'DirtyBitmapStatus',
479   'data': ['active', 'disabled', 'frozen', 'locked', 'inconsistent'] }
482 # @BlockDirtyInfo:
484 # Block dirty bitmap information.
486 # @name: the name of the dirty bitmap (Since 2.4)
488 # @count: number of dirty bytes according to the dirty bitmap
490 # @granularity: granularity of the dirty bitmap in bytes (since 1.4)
492 # @status: current status of the dirty bitmap (since 2.4)
494 # @recording: true if the bitmap is recording new writes from the guest.
495 #             Replaces `active` and `disabled` statuses. (since 4.0)
497 # @busy: true if the bitmap is in-use by some operation (NBD or jobs)
498 #        and cannot be modified via QMP or used by another operation.
499 #        Replaces `locked` and `frozen` statuses. (since 4.0)
501 # @persistent: true if the bitmap was stored on disk, is scheduled to be stored
502 #              on disk, or both. (since 4.0)
504 # @inconsistent: true if this is a persistent bitmap that was improperly
505 #                stored. Implies @persistent to be true; @recording and
506 #                @busy to be false. This bitmap cannot be used. To remove
507 #                it, use @block-dirty-bitmap-remove. (Since 4.0)
509 # Features:
510 # @deprecated: Member @status is deprecated.  Use @recording and
511 #              @locked instead.
513 # Since: 1.3
515 { 'struct': 'BlockDirtyInfo',
516   'data': {'*name': 'str', 'count': 'int', 'granularity': 'uint32',
517            'recording': 'bool', 'busy': 'bool',
518            'status': { 'type': 'DirtyBitmapStatus',
519                        'features': [ 'deprecated' ] },
520            'persistent': 'bool', '*inconsistent': 'bool' } }
523 # @Qcow2BitmapInfoFlags:
525 # An enumeration of flags that a bitmap can report to the user.
527 # @in-use: This flag is set by any process actively modifying the qcow2 file,
528 #          and cleared when the updated bitmap is flushed to the qcow2 image.
529 #          The presence of this flag in an offline image means that the bitmap
530 #          was not saved correctly after its last usage, and may contain
531 #          inconsistent data.
533 # @auto: The bitmap must reflect all changes of the virtual disk by any
534 #        application that would write to this qcow2 file.
536 # Since: 4.0
538 { 'enum': 'Qcow2BitmapInfoFlags',
539   'data': ['in-use', 'auto'] }
542 # @Qcow2BitmapInfo:
544 # Qcow2 bitmap information.
546 # @name: the name of the bitmap
548 # @granularity: granularity of the bitmap in bytes
550 # @flags: flags of the bitmap
552 # Since: 4.0
554 { 'struct': 'Qcow2BitmapInfo',
555   'data': {'name': 'str', 'granularity': 'uint32',
556            'flags': ['Qcow2BitmapInfoFlags'] } }
559 # @BlockLatencyHistogramInfo:
561 # Block latency histogram.
563 # @boundaries: list of interval boundary values in nanoseconds, all greater
564 #              than zero and in ascending order.
565 #              For example, the list [10, 50, 100] produces the following
566 #              histogram intervals: [0, 10), [10, 50), [50, 100), [100, +inf).
568 # @bins: list of io request counts corresponding to histogram intervals.
569 #        len(@bins) = len(@boundaries) + 1
570 #        For the example above, @bins may be something like [3, 1, 5, 2],
571 #        and corresponding histogram looks like:
573 # ::
575 #        5|           *
576 #        4|           *
577 #        3| *         *
578 #        2| *         *    *
579 #        1| *    *    *    *
580 #         +------------------
581 #             10   50   100
583 # Since: 4.0
585 { 'struct': 'BlockLatencyHistogramInfo',
586   'data': {'boundaries': ['uint64'], 'bins': ['uint64'] } }
589 # @BlockInfo:
591 # Block device information.  This structure describes a virtual device and
592 # the backing device associated with it.
594 # @device: The device name associated with the virtual device.
596 # @qdev: The qdev ID, or if no ID is assigned, the QOM path of the block
597 #        device. (since 2.10)
599 # @type: This field is returned only for compatibility reasons, it should
600 #        not be used (always returns 'unknown')
602 # @removable: True if the device supports removable media.
604 # @locked: True if the guest has locked this device from having its media
605 #          removed
607 # @tray_open: True if the device's tray is open
608 #             (only present if it has a tray)
610 # @dirty-bitmaps: dirty bitmaps information (only present if the
611 #                 driver has one or more dirty bitmaps) (Since 2.0)
613 # @io-status: @BlockDeviceIoStatus. Only present if the device
614 #             supports it and the VM is configured to stop on errors
615 #             (supported device models: virtio-blk, IDE, SCSI except
616 #             scsi-generic)
618 # @inserted: @BlockDeviceInfo describing the device if media is
619 #            present
621 # Features:
622 # @deprecated: Member @dirty-bitmaps is deprecated.  Use @inserted
623 #              member @dirty-bitmaps instead.
625 # Since:  0.14.0
627 { 'struct': 'BlockInfo',
628   'data': {'device': 'str', '*qdev': 'str', 'type': 'str', 'removable': 'bool',
629            'locked': 'bool', '*inserted': 'BlockDeviceInfo',
630            '*tray_open': 'bool', '*io-status': 'BlockDeviceIoStatus',
631            '*dirty-bitmaps': { 'type': ['BlockDirtyInfo'],
632                                'features': [ 'deprecated' ] } } }
635 # @BlockMeasureInfo:
637 # Image file size calculation information.  This structure describes the size
638 # requirements for creating a new image file.
640 # The size requirements depend on the new image file format.  File size always
641 # equals virtual disk size for the 'raw' format, even for sparse POSIX files.
642 # Compact formats such as 'qcow2' represent unallocated and zero regions
643 # efficiently so file size may be smaller than virtual disk size.
645 # The values are upper bounds that are guaranteed to fit the new image file.
646 # Subsequent modification, such as internal snapshot or further bitmap
647 # creation, may require additional space and is not covered here.
649 # @required: Size required for a new image file, in bytes, when copying just
650 #            allocated guest-visible contents.
652 # @fully-allocated: Image file size, in bytes, once data has been written
653 #                   to all sectors, when copying just guest-visible contents.
655 # @bitmaps: Additional size required if all the top-level bitmap metadata
656 #           in the source image were to be copied to the destination,
657 #           present only when source and destination both support
658 #           persistent bitmaps. (since 5.1)
660 # Since: 2.10
662 { 'struct': 'BlockMeasureInfo',
663   'data': {'required': 'int', 'fully-allocated': 'int', '*bitmaps': 'int'} }
666 # @query-block:
668 # Get a list of BlockInfo for all virtual block devices.
670 # Returns: a list of @BlockInfo describing each virtual block device. Filter
671 #          nodes that were created implicitly are skipped over.
673 # Since: 0.14.0
675 # Example:
677 # -> { "execute": "query-block" }
678 # <- {
679 #       "return":[
680 #          {
681 #             "io-status": "ok",
682 #             "device":"ide0-hd0",
683 #             "locked":false,
684 #             "removable":false,
685 #             "inserted":{
686 #                "ro":false,
687 #                "drv":"qcow2",
688 #                "encrypted":false,
689 #                "file":"disks/test.qcow2",
690 #                "backing_file_depth":1,
691 #                "bps":1000000,
692 #                "bps_rd":0,
693 #                "bps_wr":0,
694 #                "iops":1000000,
695 #                "iops_rd":0,
696 #                "iops_wr":0,
697 #                "bps_max": 8000000,
698 #                "bps_rd_max": 0,
699 #                "bps_wr_max": 0,
700 #                "iops_max": 0,
701 #                "iops_rd_max": 0,
702 #                "iops_wr_max": 0,
703 #                "iops_size": 0,
704 #                "detect_zeroes": "on",
705 #                "write_threshold": 0,
706 #                "image":{
707 #                   "filename":"disks/test.qcow2",
708 #                   "format":"qcow2",
709 #                   "virtual-size":2048000,
710 #                   "backing_file":"base.qcow2",
711 #                   "full-backing-filename":"disks/base.qcow2",
712 #                   "backing-filename-format":"qcow2",
713 #                   "snapshots":[
714 #                      {
715 #                         "id": "1",
716 #                         "name": "snapshot1",
717 #                         "vm-state-size": 0,
718 #                         "date-sec": 10000200,
719 #                         "date-nsec": 12,
720 #                         "vm-clock-sec": 206,
721 #                         "vm-clock-nsec": 30
722 #                      }
723 #                   ],
724 #                   "backing-image":{
725 #                       "filename":"disks/base.qcow2",
726 #                       "format":"qcow2",
727 #                       "virtual-size":2048000
728 #                   }
729 #                }
730 #             },
731 #             "qdev": "ide_disk",
732 #             "type":"unknown"
733 #          },
734 #          {
735 #             "io-status": "ok",
736 #             "device":"ide1-cd0",
737 #             "locked":false,
738 #             "removable":true,
739 #             "qdev": "/machine/unattached/device[23]",
740 #             "tray_open": false,
741 #             "type":"unknown"
742 #          },
743 #          {
744 #             "device":"floppy0",
745 #             "locked":false,
746 #             "removable":true,
747 #             "qdev": "/machine/unattached/device[20]",
748 #             "type":"unknown"
749 #          },
750 #          {
751 #             "device":"sd0",
752 #             "locked":false,
753 #             "removable":true,
754 #             "type":"unknown"
755 #          }
756 #       ]
757 #    }
760 { 'command': 'query-block', 'returns': ['BlockInfo'] }
764 # @BlockDeviceTimedStats:
766 # Statistics of a block device during a given interval of time.
768 # @interval_length: Interval used for calculating the statistics,
769 #                   in seconds.
771 # @min_rd_latency_ns: Minimum latency of read operations in the
772 #                     defined interval, in nanoseconds.
774 # @min_wr_latency_ns: Minimum latency of write operations in the
775 #                     defined interval, in nanoseconds.
777 # @min_flush_latency_ns: Minimum latency of flush operations in the
778 #                        defined interval, in nanoseconds.
780 # @max_rd_latency_ns: Maximum latency of read operations in the
781 #                     defined interval, in nanoseconds.
783 # @max_wr_latency_ns: Maximum latency of write operations in the
784 #                     defined interval, in nanoseconds.
786 # @max_flush_latency_ns: Maximum latency of flush operations in the
787 #                        defined interval, in nanoseconds.
789 # @avg_rd_latency_ns: Average latency of read operations in the
790 #                     defined interval, in nanoseconds.
792 # @avg_wr_latency_ns: Average latency of write operations in the
793 #                     defined interval, in nanoseconds.
795 # @avg_flush_latency_ns: Average latency of flush operations in the
796 #                        defined interval, in nanoseconds.
798 # @avg_rd_queue_depth: Average number of pending read operations
799 #                      in the defined interval.
801 # @avg_wr_queue_depth: Average number of pending write operations
802 #                      in the defined interval.
804 # Since: 2.5
806 { 'struct': 'BlockDeviceTimedStats',
807   'data': { 'interval_length': 'int', 'min_rd_latency_ns': 'int',
808             'max_rd_latency_ns': 'int', 'avg_rd_latency_ns': 'int',
809             'min_wr_latency_ns': 'int', 'max_wr_latency_ns': 'int',
810             'avg_wr_latency_ns': 'int', 'min_flush_latency_ns': 'int',
811             'max_flush_latency_ns': 'int', 'avg_flush_latency_ns': 'int',
812             'avg_rd_queue_depth': 'number', 'avg_wr_queue_depth': 'number' } }
815 # @BlockDeviceStats:
817 # Statistics of a virtual block device or a block backing device.
819 # @rd_bytes:      The number of bytes read by the device.
821 # @wr_bytes:      The number of bytes written by the device.
823 # @unmap_bytes: The number of bytes unmapped by the device (Since 4.2)
825 # @rd_operations: The number of read operations performed by the device.
827 # @wr_operations: The number of write operations performed by the device.
829 # @flush_operations: The number of cache flush operations performed by the
830 #                    device (since 0.15.0)
832 # @unmap_operations: The number of unmap operations performed by the device
833 #                    (Since 4.2)
835 # @rd_total_time_ns: Total time spent on reads in nanoseconds (since 0.15.0).
837 # @wr_total_time_ns: Total time spent on writes in nanoseconds (since 0.15.0).
839 # @flush_total_time_ns: Total time spent on cache flushes in nanoseconds
840 #                       (since 0.15.0).
842 # @unmap_total_time_ns: Total time spent on unmap operations in nanoseconds
843 #                       (Since 4.2)
845 # @wr_highest_offset: The offset after the greatest byte written to the
846 #                     device.  The intended use of this information is for
847 #                     growable sparse files (like qcow2) that are used on top
848 #                     of a physical device.
850 # @rd_merged: Number of read requests that have been merged into another
851 #             request (Since 2.3).
853 # @wr_merged: Number of write requests that have been merged into another
854 #             request (Since 2.3).
856 # @unmap_merged: Number of unmap requests that have been merged into another
857 #                request (Since 4.2)
859 # @idle_time_ns: Time since the last I/O operation, in
860 #                nanoseconds. If the field is absent it means that
861 #                there haven't been any operations yet (Since 2.5).
863 # @failed_rd_operations: The number of failed read operations
864 #                        performed by the device (Since 2.5)
866 # @failed_wr_operations: The number of failed write operations
867 #                        performed by the device (Since 2.5)
869 # @failed_flush_operations: The number of failed flush operations
870 #                           performed by the device (Since 2.5)
872 # @failed_unmap_operations: The number of failed unmap operations performed
873 #                           by the device (Since 4.2)
875 # @invalid_rd_operations: The number of invalid read operations
876 #                          performed by the device (Since 2.5)
878 # @invalid_wr_operations: The number of invalid write operations
879 #                         performed by the device (Since 2.5)
881 # @invalid_flush_operations: The number of invalid flush operations
882 #                            performed by the device (Since 2.5)
884 # @invalid_unmap_operations: The number of invalid unmap operations performed
885 #                            by the device (Since 4.2)
887 # @account_invalid: Whether invalid operations are included in the
888 #                   last access statistics (Since 2.5)
890 # @account_failed: Whether failed operations are included in the
891 #                  latency and last access statistics (Since 2.5)
893 # @timed_stats: Statistics specific to the set of previously defined
894 #               intervals of time (Since 2.5)
896 # @rd_latency_histogram: @BlockLatencyHistogramInfo. (Since 4.0)
898 # @wr_latency_histogram: @BlockLatencyHistogramInfo. (Since 4.0)
900 # @flush_latency_histogram: @BlockLatencyHistogramInfo. (Since 4.0)
902 # Since: 0.14.0
904 { 'struct': 'BlockDeviceStats',
905   'data': {'rd_bytes': 'int', 'wr_bytes': 'int', 'unmap_bytes' : 'int',
906            'rd_operations': 'int', 'wr_operations': 'int',
907            'flush_operations': 'int', 'unmap_operations': 'int',
908            'rd_total_time_ns': 'int', 'wr_total_time_ns': 'int',
909            'flush_total_time_ns': 'int', 'unmap_total_time_ns': 'int',
910            'wr_highest_offset': 'int',
911            'rd_merged': 'int', 'wr_merged': 'int', 'unmap_merged': 'int',
912            '*idle_time_ns': 'int',
913            'failed_rd_operations': 'int', 'failed_wr_operations': 'int',
914            'failed_flush_operations': 'int', 'failed_unmap_operations': 'int',
915            'invalid_rd_operations': 'int', 'invalid_wr_operations': 'int',
916            'invalid_flush_operations': 'int', 'invalid_unmap_operations': 'int',
917            'account_invalid': 'bool', 'account_failed': 'bool',
918            'timed_stats': ['BlockDeviceTimedStats'],
919            '*rd_latency_histogram': 'BlockLatencyHistogramInfo',
920            '*wr_latency_histogram': 'BlockLatencyHistogramInfo',
921            '*flush_latency_histogram': 'BlockLatencyHistogramInfo' } }
924 # @BlockStatsSpecificFile:
926 # File driver statistics
928 # @discard-nb-ok: The number of successful discard operations performed by
929 #                 the driver.
931 # @discard-nb-failed: The number of failed discard operations performed by
932 #                     the driver.
934 # @discard-bytes-ok: The number of bytes discarded by the driver.
936 # Since: 4.2
938 { 'struct': 'BlockStatsSpecificFile',
939   'data': {
940       'discard-nb-ok': 'uint64',
941       'discard-nb-failed': 'uint64',
942       'discard-bytes-ok': 'uint64' } }
945 # @BlockStatsSpecific:
947 # Block driver specific statistics
949 # Since: 4.2
951 { 'union': 'BlockStatsSpecific',
952   'base': { 'driver': 'BlockdevDriver' },
953   'discriminator': 'driver',
954   'data': {
955       'file': 'BlockStatsSpecificFile',
956       'host_device': 'BlockStatsSpecificFile' } }
959 # @BlockStats:
961 # Statistics of a virtual block device or a block backing device.
963 # @device: If the stats are for a virtual block device, the name
964 #          corresponding to the virtual block device.
966 # @node-name: The node name of the device. (Since 2.3)
968 # @qdev: The qdev ID, or if no ID is assigned, the QOM path of the block
969 #        device. (since 3.0)
971 # @stats:  A @BlockDeviceStats for the device.
973 # @driver-specific: Optional driver-specific stats. (Since 4.2)
975 # @parent: This describes the file block device if it has one.
976 #          Contains recursively the statistics of the underlying
977 #          protocol (e.g. the host file for a qcow2 image). If there is
978 #          no underlying protocol, this field is omitted
980 # @backing: This describes the backing block device if it has one.
981 #           (Since 2.0)
983 # Since: 0.14.0
985 { 'struct': 'BlockStats',
986   'data': {'*device': 'str', '*qdev': 'str', '*node-name': 'str',
987            'stats': 'BlockDeviceStats',
988            '*driver-specific': 'BlockStatsSpecific',
989            '*parent': 'BlockStats',
990            '*backing': 'BlockStats'} }
993 # @query-blockstats:
995 # Query the @BlockStats for all virtual block devices.
997 # @query-nodes: If true, the command will query all the block nodes
998 #               that have a node name, in a list which will include "parent"
999 #               information, but not "backing".
1000 #               If false or omitted, the behavior is as before - query all the
1001 #               device backends, recursively including their "parent" and
1002 #               "backing". Filter nodes that were created implicitly are
1003 #               skipped over in this mode. (Since 2.3)
1005 # Returns: A list of @BlockStats for each virtual block devices.
1007 # Since: 0.14.0
1009 # Example:
1011 # -> { "execute": "query-blockstats" }
1012 # <- {
1013 #       "return":[
1014 #          {
1015 #             "device":"ide0-hd0",
1016 #             "parent":{
1017 #                "stats":{
1018 #                   "wr_highest_offset":3686448128,
1019 #                   "wr_bytes":9786368,
1020 #                   "wr_operations":751,
1021 #                   "rd_bytes":122567168,
1022 #                   "rd_operations":36772
1023 #                   "wr_total_times_ns":313253456
1024 #                   "rd_total_times_ns":3465673657
1025 #                   "flush_total_times_ns":49653
1026 #                   "flush_operations":61,
1027 #                   "rd_merged":0,
1028 #                   "wr_merged":0,
1029 #                   "idle_time_ns":2953431879,
1030 #                   "account_invalid":true,
1031 #                   "account_failed":false
1032 #                }
1033 #             },
1034 #             "stats":{
1035 #                "wr_highest_offset":2821110784,
1036 #                "wr_bytes":9786368,
1037 #                "wr_operations":692,
1038 #                "rd_bytes":122739200,
1039 #                "rd_operations":36604
1040 #                "flush_operations":51,
1041 #                "wr_total_times_ns":313253456
1042 #                "rd_total_times_ns":3465673657
1043 #                "flush_total_times_ns":49653,
1044 #                "rd_merged":0,
1045 #                "wr_merged":0,
1046 #                "idle_time_ns":2953431879,
1047 #                "account_invalid":true,
1048 #                "account_failed":false
1049 #             },
1050 #             "qdev": "/machine/unattached/device[23]"
1051 #          },
1052 #          {
1053 #             "device":"ide1-cd0",
1054 #             "stats":{
1055 #                "wr_highest_offset":0,
1056 #                "wr_bytes":0,
1057 #                "wr_operations":0,
1058 #                "rd_bytes":0,
1059 #                "rd_operations":0
1060 #                "flush_operations":0,
1061 #                "wr_total_times_ns":0
1062 #                "rd_total_times_ns":0
1063 #                "flush_total_times_ns":0,
1064 #                "rd_merged":0,
1065 #                "wr_merged":0,
1066 #                "account_invalid":false,
1067 #                "account_failed":false
1068 #             },
1069 #             "qdev": "/machine/unattached/device[24]"
1070 #          },
1071 #          {
1072 #             "device":"floppy0",
1073 #             "stats":{
1074 #                "wr_highest_offset":0,
1075 #                "wr_bytes":0,
1076 #                "wr_operations":0,
1077 #                "rd_bytes":0,
1078 #                "rd_operations":0
1079 #                "flush_operations":0,
1080 #                "wr_total_times_ns":0
1081 #                "rd_total_times_ns":0
1082 #                "flush_total_times_ns":0,
1083 #                "rd_merged":0,
1084 #                "wr_merged":0,
1085 #                "account_invalid":false,
1086 #                "account_failed":false
1087 #             },
1088 #             "qdev": "/machine/unattached/device[16]"
1089 #          },
1090 #          {
1091 #             "device":"sd0",
1092 #             "stats":{
1093 #                "wr_highest_offset":0,
1094 #                "wr_bytes":0,
1095 #                "wr_operations":0,
1096 #                "rd_bytes":0,
1097 #                "rd_operations":0
1098 #                "flush_operations":0,
1099 #                "wr_total_times_ns":0
1100 #                "rd_total_times_ns":0
1101 #                "flush_total_times_ns":0,
1102 #                "rd_merged":0,
1103 #                "wr_merged":0,
1104 #                "account_invalid":false,
1105 #                "account_failed":false
1106 #             }
1107 #          }
1108 #       ]
1109 #    }
1112 { 'command': 'query-blockstats',
1113   'data': { '*query-nodes': 'bool' },
1114   'returns': ['BlockStats'] }
1117 # @BlockdevOnError:
1119 # An enumeration of possible behaviors for errors on I/O operations.
1120 # The exact meaning depends on whether the I/O was initiated by a guest
1121 # or by a block job
1123 # @report: for guest operations, report the error to the guest;
1124 #          for jobs, cancel the job
1126 # @ignore: ignore the error, only report a QMP event (BLOCK_IO_ERROR
1127 #          or BLOCK_JOB_ERROR). The backup, mirror and commit block jobs retry
1128 #          the failing request later and may still complete successfully. The
1129 #          stream block job continues to stream and will complete with an
1130 #          error.
1132 # @enospc: same as @stop on ENOSPC, same as @report otherwise.
1134 # @stop: for guest operations, stop the virtual machine;
1135 #        for jobs, pause the job
1137 # @auto: inherit the error handling policy of the backend (since: 2.7)
1139 # Since: 1.3
1141 { 'enum': 'BlockdevOnError',
1142   'data': ['report', 'ignore', 'enospc', 'stop', 'auto'] }
1145 # @MirrorSyncMode:
1147 # An enumeration of possible behaviors for the initial synchronization
1148 # phase of storage mirroring.
1150 # @top: copies data in the topmost image to the destination
1152 # @full: copies data from all images to the destination
1154 # @none: only copy data written from now on
1156 # @incremental: only copy data described by the dirty bitmap. (since: 2.4)
1158 # @bitmap: only copy data described by the dirty bitmap. (since: 4.2)
1159 #          Behavior on completion is determined by the BitmapSyncMode.
1161 # Since: 1.3
1163 { 'enum': 'MirrorSyncMode',
1164   'data': ['top', 'full', 'none', 'incremental', 'bitmap'] }
1167 # @BitmapSyncMode:
1169 # An enumeration of possible behaviors for the synchronization of a bitmap
1170 # when used for data copy operations.
1172 # @on-success: The bitmap is only synced when the operation is successful.
1173 #              This is the behavior always used for 'INCREMENTAL' backups.
1175 # @never: The bitmap is never synchronized with the operation, and is
1176 #         treated solely as a read-only manifest of blocks to copy.
1178 # @always: The bitmap is always synchronized with the operation,
1179 #          regardless of whether or not the operation was successful.
1181 # Since: 4.2
1183 { 'enum': 'BitmapSyncMode',
1184   'data': ['on-success', 'never', 'always'] }
1187 # @MirrorCopyMode:
1189 # An enumeration whose values tell the mirror block job when to
1190 # trigger writes to the target.
1192 # @background: copy data in background only.
1194 # @write-blocking: when data is written to the source, write it
1195 #                  (synchronously) to the target as well.  In
1196 #                  addition, data is copied in background just like in
1197 #                  @background mode.
1199 # Since: 3.0
1201 { 'enum': 'MirrorCopyMode',
1202   'data': ['background', 'write-blocking'] }
1205 # @BlockJobInfo:
1207 # Information about a long-running block device operation.
1209 # @type: the job type ('stream' for image streaming)
1211 # @device: The job identifier. Originally the device name but other
1212 #          values are allowed since QEMU 2.7
1214 # @len: Estimated @offset value at the completion of the job. This value can
1215 #       arbitrarily change while the job is running, in both directions.
1217 # @offset: Progress made until now. The unit is arbitrary and the value can
1218 #          only meaningfully be used for the ratio of @offset to @len. The
1219 #          value is monotonically increasing.
1221 # @busy: false if the job is known to be in a quiescent state, with
1222 #        no pending I/O.  Since 1.3.
1224 # @paused: whether the job is paused or, if @busy is true, will
1225 #          pause itself as soon as possible.  Since 1.3.
1227 # @speed: the rate limit, bytes per second
1229 # @io-status: the status of the job (since 1.3)
1231 # @ready: true if the job may be completed (since 2.2)
1233 # @status: Current job state/status (since 2.12)
1235 # @auto-finalize: Job will finalize itself when PENDING, moving to
1236 #                 the CONCLUDED state. (since 2.12)
1238 # @auto-dismiss: Job will dismiss itself when CONCLUDED, moving to the NULL
1239 #                state and disappearing from the query list. (since 2.12)
1241 # @error: Error information if the job did not complete successfully.
1242 #         Not set if the job completed successfully. (since 2.12.1)
1244 # Since: 1.1
1246 { 'struct': 'BlockJobInfo',
1247   'data': {'type': 'str', 'device': 'str', 'len': 'int',
1248            'offset': 'int', 'busy': 'bool', 'paused': 'bool', 'speed': 'int',
1249            'io-status': 'BlockDeviceIoStatus', 'ready': 'bool',
1250            'status': 'JobStatus',
1251            'auto-finalize': 'bool', 'auto-dismiss': 'bool',
1252            '*error': 'str' } }
1255 # @query-block-jobs:
1257 # Return information about long-running block device operations.
1259 # Returns: a list of @BlockJobInfo for each active block job
1261 # Since: 1.1
1263 { 'command': 'query-block-jobs', 'returns': ['BlockJobInfo'] }
1266 # @block_passwd:
1268 # This command sets the password of a block device that has not been open
1269 # with a password and requires one.
1271 # This command is now obsolete and will always return an error since 2.10
1274 { 'command': 'block_passwd',
1275   'data': { '*device': 'str',
1276             '*node-name': 'str',
1277             'password': 'str' } }
1280 # @block_resize:
1282 # Resize a block image while a guest is running.
1284 # Either @device or @node-name must be set but not both.
1286 # @device: the name of the device to get the image resized
1288 # @node-name: graph node name to get the image resized (Since 2.0)
1290 # @size:  new image size in bytes
1292 # Returns: - nothing on success
1293 #          - If @device is not a valid block device, DeviceNotFound
1295 # Since: 0.14.0
1297 # Example:
1299 # -> { "execute": "block_resize",
1300 #      "arguments": { "device": "scratch", "size": 1073741824 } }
1301 # <- { "return": {} }
1304 { 'command': 'block_resize',
1305   'data': { '*device': 'str',
1306             '*node-name': 'str',
1307             'size': 'int' } }
1310 # @NewImageMode:
1312 # An enumeration that tells QEMU how to set the backing file path in
1313 # a new image file.
1315 # @existing: QEMU should look for an existing image file.
1317 # @absolute-paths: QEMU should create a new image with absolute paths
1318 #                  for the backing file. If there is no backing file available, the new
1319 #                  image will not be backed either.
1321 # Since: 1.1
1323 { 'enum': 'NewImageMode',
1324   'data': [ 'existing', 'absolute-paths' ] }
1327 # @BlockdevSnapshotSync:
1329 # Either @device or @node-name must be set but not both.
1331 # @device: the name of the device to take a snapshot of.
1333 # @node-name: graph node name to generate the snapshot from (Since 2.0)
1335 # @snapshot-file: the target of the new overlay image. If the file
1336 #                 exists, or if it is a device, the overlay will be created in the
1337 #                 existing file/device. Otherwise, a new file will be created.
1339 # @snapshot-node-name: the graph node name of the new image (Since 2.0)
1341 # @format: the format of the overlay image, default is 'qcow2'.
1343 # @mode: whether and how QEMU should create a new image, default is
1344 #        'absolute-paths'.
1346 { 'struct': 'BlockdevSnapshotSync',
1347   'data': { '*device': 'str', '*node-name': 'str',
1348             'snapshot-file': 'str', '*snapshot-node-name': 'str',
1349             '*format': 'str', '*mode': 'NewImageMode' } }
1352 # @BlockdevSnapshot:
1354 # @node: device or node name that will have a snapshot taken.
1356 # @overlay: reference to the existing block device that will become
1357 #           the overlay of @node, as part of taking the snapshot.
1358 #           It must not have a current backing file (this can be
1359 #           achieved by passing "backing": null to blockdev-add).
1361 # Since: 2.5
1363 { 'struct': 'BlockdevSnapshot',
1364   'data': { 'node': 'str', 'overlay': 'str' } }
1367 # @BackupCommon:
1369 # @job-id: identifier for the newly-created block job. If
1370 #          omitted, the device name will be used. (Since 2.7)
1372 # @device: the device name or node-name of a root node which should be copied.
1374 # @sync: what parts of the disk image should be copied to the destination
1375 #        (all the disk, only the sectors allocated in the topmost image, from a
1376 #        dirty bitmap, or only new I/O).
1378 # @speed: the maximum speed, in bytes per second. The default is 0,
1379 #         for unlimited.
1381 # @bitmap: The name of a dirty bitmap to use.
1382 #          Must be present if sync is "bitmap" or "incremental".
1383 #          Can be present if sync is "full" or "top".
1384 #          Must not be present otherwise.
1385 #          (Since 2.4 (drive-backup), 3.1 (blockdev-backup))
1387 # @bitmap-mode: Specifies the type of data the bitmap should contain after
1388 #               the operation concludes.
1389 #               Must be present if a bitmap was provided,
1390 #               Must NOT be present otherwise. (Since 4.2)
1392 # @compress: true to compress data, if the target format supports it.
1393 #            (default: false) (since 2.8)
1395 # @on-source-error: the action to take on an error on the source,
1396 #                   default 'report'.  'stop' and 'enospc' can only be used
1397 #                   if the block device supports io-status (see BlockInfo).
1399 # @on-target-error: the action to take on an error on the target,
1400 #                   default 'report' (no limitations, since this applies to
1401 #                   a different block device than @device).
1403 # @auto-finalize: When false, this job will wait in a PENDING state after it has
1404 #                 finished its work, waiting for @block-job-finalize before
1405 #                 making any block graph changes.
1406 #                 When true, this job will automatically
1407 #                 perform its abort or commit actions.
1408 #                 Defaults to true. (Since 2.12)
1410 # @auto-dismiss: When false, this job will wait in a CONCLUDED state after it
1411 #                has completely ceased all work, and awaits @block-job-dismiss.
1412 #                When true, this job will automatically disappear from the query
1413 #                list without user intervention.
1414 #                Defaults to true. (Since 2.12)
1416 # @filter-node-name: the node name that should be assigned to the
1417 #                    filter driver that the backup job inserts into the graph
1418 #                    above node specified by @drive. If this option is not given,
1419 #                    a node name is autogenerated. (Since: 4.2)
1421 # Note: @on-source-error and @on-target-error only affect background
1422 #       I/O.  If an error occurs during a guest write request, the device's
1423 #       rerror/werror actions will be used.
1425 # Since: 4.2
1427 { 'struct': 'BackupCommon',
1428   'data': { '*job-id': 'str', 'device': 'str',
1429             'sync': 'MirrorSyncMode', '*speed': 'int',
1430             '*bitmap': 'str', '*bitmap-mode': 'BitmapSyncMode',
1431             '*compress': 'bool',
1432             '*on-source-error': 'BlockdevOnError',
1433             '*on-target-error': 'BlockdevOnError',
1434             '*auto-finalize': 'bool', '*auto-dismiss': 'bool',
1435             '*filter-node-name': 'str' } }
1438 # @DriveBackup:
1440 # @target: the target of the new image. If the file exists, or if it
1441 #          is a device, the existing file/device will be used as the new
1442 #          destination.  If it does not exist, a new file will be created.
1444 # @format: the format of the new destination, default is to
1445 #          probe if @mode is 'existing', else the format of the source
1447 # @mode: whether and how QEMU should create a new image, default is
1448 #        'absolute-paths'.
1450 # Since: 1.6
1452 { 'struct': 'DriveBackup',
1453   'base': 'BackupCommon',
1454   'data': { 'target': 'str',
1455             '*format': 'str',
1456             '*mode': 'NewImageMode' } }
1459 # @BlockdevBackup:
1461 # @target: the device name or node-name of the backup target node.
1463 # Since: 2.3
1465 { 'struct': 'BlockdevBackup',
1466   'base': 'BackupCommon',
1467   'data': { 'target': 'str' } }
1470 # @blockdev-snapshot-sync:
1472 # Takes a synchronous snapshot of a block device.
1474 # For the arguments, see the documentation of BlockdevSnapshotSync.
1476 # Returns: - nothing on success
1477 #          - If @device is not a valid block device, DeviceNotFound
1479 # Since: 0.14.0
1481 # Example:
1483 # -> { "execute": "blockdev-snapshot-sync",
1484 #      "arguments": { "device": "ide-hd0",
1485 #                     "snapshot-file":
1486 #                     "/some/place/my-image",
1487 #                     "format": "qcow2" } }
1488 # <- { "return": {} }
1491 { 'command': 'blockdev-snapshot-sync',
1492   'data': 'BlockdevSnapshotSync' }
1496 # @blockdev-snapshot:
1498 # Takes a snapshot of a block device.
1500 # Take a snapshot, by installing 'node' as the backing image of
1501 # 'overlay'. Additionally, if 'node' is associated with a block
1502 # device, the block device changes to using 'overlay' as its new active
1503 # image.
1505 # For the arguments, see the documentation of BlockdevSnapshot.
1507 # Features:
1508 # @allow-write-only-overlay: If present, the check whether this operation is safe
1509 #                            was relaxed so that it can be used to change
1510 #                            backing file of a destination of a blockdev-mirror.
1511 #                            (since 5.0)
1513 # Since: 2.5
1515 # Example:
1517 # -> { "execute": "blockdev-add",
1518 #      "arguments": { "driver": "qcow2",
1519 #                     "node-name": "node1534",
1520 #                     "file": { "driver": "file",
1521 #                               "filename": "hd1.qcow2" },
1522 #                     "backing": null } }
1524 # <- { "return": {} }
1526 # -> { "execute": "blockdev-snapshot",
1527 #      "arguments": { "node": "ide-hd0",
1528 #                     "overlay": "node1534" } }
1529 # <- { "return": {} }
1532 { 'command': 'blockdev-snapshot',
1533   'data': 'BlockdevSnapshot',
1534   'features': [ 'allow-write-only-overlay' ] }
1537 # @change-backing-file:
1539 # Change the backing file in the image file metadata.  This does not
1540 # cause QEMU to reopen the image file to reparse the backing filename
1541 # (it may, however, perform a reopen to change permissions from
1542 # r/o -> r/w -> r/o, if needed). The new backing file string is written
1543 # into the image file metadata, and the QEMU internal strings are
1544 # updated.
1546 # @image-node-name: The name of the block driver state node of the
1547 #                   image to modify. The "device" argument is used
1548 #                   to verify "image-node-name" is in the chain
1549 #                   described by "device".
1551 # @device: The device name or node-name of the root node that owns
1552 #          image-node-name.
1554 # @backing-file: The string to write as the backing file.  This
1555 #                string is not validated, so care should be taken
1556 #                when specifying the string or the image chain may
1557 #                not be able to be reopened again.
1559 # Returns: - Nothing on success
1560 #          - If "device" does not exist or cannot be determined, DeviceNotFound
1562 # Since: 2.1
1564 { 'command': 'change-backing-file',
1565   'data': { 'device': 'str', 'image-node-name': 'str',
1566             'backing-file': 'str' } }
1569 # @block-commit:
1571 # Live commit of data from overlay image nodes into backing nodes - i.e.,
1572 # writes data between 'top' and 'base' into 'base'.
1574 # If top == base, that is an error.
1575 # If top has no overlays on top of it, or if it is in use by a writer,
1576 # the job will not be completed by itself.  The user needs to complete
1577 # the job with the block-job-complete command after getting the ready
1578 # event. (Since 2.0)
1580 # If the base image is smaller than top, then the base image will be
1581 # resized to be the same size as top.  If top is smaller than the base
1582 # image, the base will not be truncated.  If you want the base image
1583 # size to match the size of the smaller top, you can safely truncate
1584 # it yourself once the commit operation successfully completes.
1586 # @job-id: identifier for the newly-created block job. If
1587 #          omitted, the device name will be used. (Since 2.7)
1589 # @device: the device name or node-name of a root node
1591 # @base-node: The node name of the backing image to write data into.
1592 #             If not specified, this is the deepest backing image.
1593 #             (since: 3.1)
1595 # @base: Same as @base-node, except that it is a file name rather than a node
1596 #        name. This must be the exact filename string that was used to open the
1597 #        node; other strings, even if addressing the same file, are not
1598 #        accepted
1600 # @top-node: The node name of the backing image within the image chain
1601 #            which contains the topmost data to be committed down. If
1602 #            not specified, this is the active layer. (since: 3.1)
1604 # @top: Same as @top-node, except that it is a file name rather than a node
1605 #       name. This must be the exact filename string that was used to open the
1606 #       node; other strings, even if addressing the same file, are not
1607 #       accepted
1609 # @backing-file: The backing file string to write into the overlay
1610 #                image of 'top'.  If 'top' does not have an overlay
1611 #                image, or if 'top' is in use by a writer, specifying
1612 #                a backing file string is an error.
1614 #                This filename is not validated.  If a pathname string
1615 #                is such that it cannot be resolved by QEMU, that
1616 #                means that subsequent QMP or HMP commands must use
1617 #                node-names for the image in question, as filename
1618 #                lookup methods will fail.
1620 #                If not specified, QEMU will automatically determine
1621 #                the backing file string to use, or error out if
1622 #                there is no obvious choice. Care should be taken
1623 #                when specifying the string, to specify a valid
1624 #                filename or protocol.
1625 #                (Since 2.1)
1627 # @speed: the maximum speed, in bytes per second
1629 # @on-error: the action to take on an error. 'ignore' means that the request
1630 #            should be retried. (default: report; Since: 5.0)
1632 # @filter-node-name: the node name that should be assigned to the
1633 #                    filter driver that the commit job inserts into the graph
1634 #                    above @top. If this option is not given, a node name is
1635 #                    autogenerated. (Since: 2.9)
1637 # @auto-finalize: When false, this job will wait in a PENDING state after it has
1638 #                 finished its work, waiting for @block-job-finalize before
1639 #                 making any block graph changes.
1640 #                 When true, this job will automatically
1641 #                 perform its abort or commit actions.
1642 #                 Defaults to true. (Since 3.1)
1644 # @auto-dismiss: When false, this job will wait in a CONCLUDED state after it
1645 #                has completely ceased all work, and awaits @block-job-dismiss.
1646 #                When true, this job will automatically disappear from the query
1647 #                list without user intervention.
1648 #                Defaults to true. (Since 3.1)
1650 # Features:
1651 # @deprecated: Members @base and @top are deprecated.  Use @base-node
1652 #              and @top-node instead.
1654 # Returns: - Nothing on success
1655 #          - If @device does not exist, DeviceNotFound
1656 #          - Any other error returns a GenericError.
1658 # Since: 1.3
1660 # Example:
1662 # -> { "execute": "block-commit",
1663 #      "arguments": { "device": "virtio0",
1664 #                     "top": "/tmp/snap1.qcow2" } }
1665 # <- { "return": {} }
1668 { 'command': 'block-commit',
1669   'data': { '*job-id': 'str', 'device': 'str', '*base-node': 'str',
1670             '*base': { 'type': 'str', 'features': [ 'deprecated' ] },
1671             '*top-node': 'str',
1672             '*top': { 'type': 'str', 'features': [ 'deprecated' ] },
1673             '*backing-file': 'str', '*speed': 'int',
1674             '*on-error': 'BlockdevOnError',
1675             '*filter-node-name': 'str',
1676             '*auto-finalize': 'bool', '*auto-dismiss': 'bool' } }
1679 # @drive-backup:
1681 # Start a point-in-time copy of a block device to a new destination.  The
1682 # status of ongoing drive-backup operations can be checked with
1683 # query-block-jobs where the BlockJobInfo.type field has the value 'backup'.
1684 # The operation can be stopped before it has completed using the
1685 # block-job-cancel command.
1687 # Returns: - nothing on success
1688 #          - If @device is not a valid block device, GenericError
1690 # Since: 1.6
1692 # Example:
1694 # -> { "execute": "drive-backup",
1695 #      "arguments": { "device": "drive0",
1696 #                     "sync": "full",
1697 #                     "target": "backup.img" } }
1698 # <- { "return": {} }
1701 { 'command': 'drive-backup', 'boxed': true,
1702   'data': 'DriveBackup' }
1705 # @blockdev-backup:
1707 # Start a point-in-time copy of a block device to a new destination.  The
1708 # status of ongoing blockdev-backup operations can be checked with
1709 # query-block-jobs where the BlockJobInfo.type field has the value 'backup'.
1710 # The operation can be stopped before it has completed using the
1711 # block-job-cancel command.
1713 # Returns: - nothing on success
1714 #          - If @device is not a valid block device, DeviceNotFound
1716 # Since: 2.3
1718 # Example:
1719 # -> { "execute": "blockdev-backup",
1720 #      "arguments": { "device": "src-id",
1721 #                     "sync": "full",
1722 #                     "target": "tgt-id" } }
1723 # <- { "return": {} }
1726 { 'command': 'blockdev-backup', 'boxed': true,
1727   'data': 'BlockdevBackup' }
1731 # @query-named-block-nodes:
1733 # Get the named block driver list
1735 # @flat: Omit the nested data about backing image ("backing-image" key) if true.
1736 #        Default is false (Since 5.0)
1738 # Returns: the list of BlockDeviceInfo
1740 # Since: 2.0
1742 # Example:
1744 # -> { "execute": "query-named-block-nodes" }
1745 # <- { "return": [ { "ro":false,
1746 #                    "drv":"qcow2",
1747 #                    "encrypted":false,
1748 #                    "file":"disks/test.qcow2",
1749 #                    "node-name": "my-node",
1750 #                    "backing_file_depth":1,
1751 #                    "bps":1000000,
1752 #                    "bps_rd":0,
1753 #                    "bps_wr":0,
1754 #                    "iops":1000000,
1755 #                    "iops_rd":0,
1756 #                    "iops_wr":0,
1757 #                    "bps_max": 8000000,
1758 #                    "bps_rd_max": 0,
1759 #                    "bps_wr_max": 0,
1760 #                    "iops_max": 0,
1761 #                    "iops_rd_max": 0,
1762 #                    "iops_wr_max": 0,
1763 #                    "iops_size": 0,
1764 #                    "write_threshold": 0,
1765 #                    "image":{
1766 #                       "filename":"disks/test.qcow2",
1767 #                       "format":"qcow2",
1768 #                       "virtual-size":2048000,
1769 #                       "backing_file":"base.qcow2",
1770 #                       "full-backing-filename":"disks/base.qcow2",
1771 #                       "backing-filename-format":"qcow2",
1772 #                       "snapshots":[
1773 #                          {
1774 #                             "id": "1",
1775 #                             "name": "snapshot1",
1776 #                             "vm-state-size": 0,
1777 #                             "date-sec": 10000200,
1778 #                             "date-nsec": 12,
1779 #                             "vm-clock-sec": 206,
1780 #                             "vm-clock-nsec": 30
1781 #                          }
1782 #                       ],
1783 #                       "backing-image":{
1784 #                           "filename":"disks/base.qcow2",
1785 #                           "format":"qcow2",
1786 #                           "virtual-size":2048000
1787 #                       }
1788 #                    } } ] }
1791 { 'command': 'query-named-block-nodes',
1792   'returns': [ 'BlockDeviceInfo' ],
1793   'data': { '*flat': 'bool' } }
1796 # @XDbgBlockGraphNodeType:
1798 # @block-backend: corresponds to BlockBackend
1800 # @block-job: corresponds to BlockJob
1802 # @block-driver: corresponds to BlockDriverState
1804 # Since: 4.0
1806 { 'enum': 'XDbgBlockGraphNodeType',
1807   'data': [ 'block-backend', 'block-job', 'block-driver' ] }
1810 # @XDbgBlockGraphNode:
1812 # @id: Block graph node identifier. This @id is generated only for
1813 #      x-debug-query-block-graph and does not relate to any other identifiers in
1814 #      Qemu.
1816 # @type: Type of graph node. Can be one of block-backend, block-job or
1817 #        block-driver-state.
1819 # @name: Human readable name of the node. Corresponds to node-name for
1820 #        block-driver-state nodes; is not guaranteed to be unique in the whole
1821 #        graph (with block-jobs and block-backends).
1823 # Since: 4.0
1825 { 'struct': 'XDbgBlockGraphNode',
1826   'data': { 'id': 'uint64', 'type': 'XDbgBlockGraphNodeType', 'name': 'str' } }
1829 # @BlockPermission:
1831 # Enum of base block permissions.
1833 # @consistent-read: A user that has the "permission" of consistent reads is
1834 #                   guaranteed that their view of the contents of the block
1835 #                   device is complete and self-consistent, representing the
1836 #                   contents of a disk at a specific point.
1837 #                   For most block devices (including their backing files) this
1838 #                   is true, but the property cannot be maintained in a few
1839 #                   situations like for intermediate nodes of a commit block
1840 #                   job.
1842 # @write: This permission is required to change the visible disk contents.
1844 # @write-unchanged: This permission (which is weaker than BLK_PERM_WRITE) is
1845 #                   both enough and required for writes to the block node when
1846 #                   the caller promises that the visible disk content doesn't
1847 #                   change.
1848 #                   As the BLK_PERM_WRITE permission is strictly stronger,
1849 #                   either is sufficient to perform an unchanging write.
1851 # @resize: This permission is required to change the size of a block node.
1853 # @graph-mod: This permission is required to change the node that this
1854 #             BdrvChild points to.
1856 # Since: 4.0
1858 { 'enum': 'BlockPermission',
1859   'data': [ 'consistent-read', 'write', 'write-unchanged', 'resize',
1860             'graph-mod' ] }
1862 # @XDbgBlockGraphEdge:
1864 # Block Graph edge description for x-debug-query-block-graph.
1866 # @parent: parent id
1868 # @child: child id
1870 # @name: name of the relation (examples are 'file' and 'backing')
1872 # @perm: granted permissions for the parent operating on the child
1874 # @shared-perm: permissions that can still be granted to other users of the
1875 #               child while it is still attached to this parent
1877 # Since: 4.0
1879 { 'struct': 'XDbgBlockGraphEdge',
1880   'data': { 'parent': 'uint64', 'child': 'uint64',
1881             'name': 'str', 'perm': [ 'BlockPermission' ],
1882             'shared-perm': [ 'BlockPermission' ] } }
1885 # @XDbgBlockGraph:
1887 # Block Graph - list of nodes and list of edges.
1889 # Since: 4.0
1891 { 'struct': 'XDbgBlockGraph',
1892   'data': { 'nodes': ['XDbgBlockGraphNode'], 'edges': ['XDbgBlockGraphEdge'] } }
1895 # @x-debug-query-block-graph:
1897 # Get the block graph.
1899 # Since: 4.0
1901 { 'command': 'x-debug-query-block-graph', 'returns': 'XDbgBlockGraph' }
1904 # @drive-mirror:
1906 # Start mirroring a block device's writes to a new destination. target
1907 # specifies the target of the new image. If the file exists, or if it
1908 # is a device, it will be used as the new destination for writes. If
1909 # it does not exist, a new file will be created. format specifies the
1910 # format of the mirror image, default is to probe if mode='existing',
1911 # else the format of the source.
1913 # Returns: - nothing on success
1914 #          - If @device is not a valid block device, GenericError
1916 # Since: 1.3
1918 # Example:
1920 # -> { "execute": "drive-mirror",
1921 #      "arguments": { "device": "ide-hd0",
1922 #                     "target": "/some/place/my-image",
1923 #                     "sync": "full",
1924 #                     "format": "qcow2" } }
1925 # <- { "return": {} }
1928 { 'command': 'drive-mirror', 'boxed': true,
1929   'data': 'DriveMirror' }
1932 # @DriveMirror:
1934 # A set of parameters describing drive mirror setup.
1936 # @job-id: identifier for the newly-created block job. If
1937 #          omitted, the device name will be used. (Since 2.7)
1939 # @device:  the device name or node-name of a root node whose writes should be
1940 #           mirrored.
1942 # @target: the target of the new image. If the file exists, or if it
1943 #          is a device, the existing file/device will be used as the new
1944 #          destination.  If it does not exist, a new file will be created.
1946 # @format: the format of the new destination, default is to
1947 #          probe if @mode is 'existing', else the format of the source
1949 # @node-name: the new block driver state node name in the graph
1950 #             (Since 2.1)
1952 # @replaces: with sync=full graph node name to be replaced by the new
1953 #            image when a whole image copy is done. This can be used to repair
1954 #            broken Quorum files.  By default, @device is replaced, although
1955 #            implicitly created filters on it are kept. (Since 2.1)
1957 # @mode: whether and how QEMU should create a new image, default is
1958 #        'absolute-paths'.
1960 # @speed:  the maximum speed, in bytes per second
1962 # @sync: what parts of the disk image should be copied to the destination
1963 #        (all the disk, only the sectors allocated in the topmost image, or
1964 #        only new I/O).
1966 # @granularity: granularity of the dirty bitmap, default is 64K
1967 #               if the image format doesn't have clusters, 4K if the clusters
1968 #               are smaller than that, else the cluster size.  Must be a
1969 #               power of 2 between 512 and 64M (since 1.4).
1971 # @buf-size: maximum amount of data in flight from source to
1972 #            target (since 1.4).
1974 # @on-source-error: the action to take on an error on the source,
1975 #                   default 'report'.  'stop' and 'enospc' can only be used
1976 #                   if the block device supports io-status (see BlockInfo).
1978 # @on-target-error: the action to take on an error on the target,
1979 #                   default 'report' (no limitations, since this applies to
1980 #                   a different block device than @device).
1981 # @unmap: Whether to try to unmap target sectors where source has
1982 #         only zero. If true, and target unallocated sectors will read as zero,
1983 #         target image sectors will be unmapped; otherwise, zeroes will be
1984 #         written. Both will result in identical contents.
1985 #         Default is true. (Since 2.4)
1987 # @copy-mode: when to copy data to the destination; defaults to 'background'
1988 #             (Since: 3.0)
1990 # @auto-finalize: When false, this job will wait in a PENDING state after it has
1991 #                 finished its work, waiting for @block-job-finalize before
1992 #                 making any block graph changes.
1993 #                 When true, this job will automatically
1994 #                 perform its abort or commit actions.
1995 #                 Defaults to true. (Since 3.1)
1997 # @auto-dismiss: When false, this job will wait in a CONCLUDED state after it
1998 #                has completely ceased all work, and awaits @block-job-dismiss.
1999 #                When true, this job will automatically disappear from the query
2000 #                list without user intervention.
2001 #                Defaults to true. (Since 3.1)
2002 # Since: 1.3
2004 { 'struct': 'DriveMirror',
2005   'data': { '*job-id': 'str', 'device': 'str', 'target': 'str',
2006             '*format': 'str', '*node-name': 'str', '*replaces': 'str',
2007             'sync': 'MirrorSyncMode', '*mode': 'NewImageMode',
2008             '*speed': 'int', '*granularity': 'uint32',
2009             '*buf-size': 'int', '*on-source-error': 'BlockdevOnError',
2010             '*on-target-error': 'BlockdevOnError',
2011             '*unmap': 'bool', '*copy-mode': 'MirrorCopyMode',
2012             '*auto-finalize': 'bool', '*auto-dismiss': 'bool' } }
2015 # @BlockDirtyBitmap:
2017 # @node: name of device/node which the bitmap is tracking
2019 # @name: name of the dirty bitmap
2021 # Since: 2.4
2023 { 'struct': 'BlockDirtyBitmap',
2024   'data': { 'node': 'str', 'name': 'str' } }
2027 # @BlockDirtyBitmapAdd:
2029 # @node: name of device/node which the bitmap is tracking
2031 # @name: name of the dirty bitmap (must be less than 1024 bytes)
2033 # @granularity: the bitmap granularity, default is 64k for
2034 #               block-dirty-bitmap-add
2036 # @persistent: the bitmap is persistent, i.e. it will be saved to the
2037 #              corresponding block device image file on its close. For now only
2038 #              Qcow2 disks support persistent bitmaps. Default is false for
2039 #              block-dirty-bitmap-add. (Since: 2.10)
2041 # @disabled: the bitmap is created in the disabled state, which means that
2042 #            it will not track drive changes. The bitmap may be enabled with
2043 #            block-dirty-bitmap-enable. Default is false. (Since: 4.0)
2045 # Since: 2.4
2047 { 'struct': 'BlockDirtyBitmapAdd',
2048   'data': { 'node': 'str', 'name': 'str', '*granularity': 'uint32',
2049             '*persistent': 'bool', '*disabled': 'bool' } }
2052 # @BlockDirtyBitmapMergeSource:
2054 # @local: name of the bitmap, attached to the same node as target bitmap.
2056 # @external: bitmap with specified node
2058 # Since: 4.1
2060 { 'alternate': 'BlockDirtyBitmapMergeSource',
2061   'data': { 'local': 'str',
2062             'external': 'BlockDirtyBitmap' } }
2065 # @BlockDirtyBitmapMerge:
2067 # @node: name of device/node which the @target bitmap is tracking
2069 # @target: name of the destination dirty bitmap
2071 # @bitmaps: name(s) of the source dirty bitmap(s) at @node and/or fully
2072 #           specified BlockDirtyBitmap elements. The latter are supported
2073 #           since 4.1.
2075 # Since: 4.0
2077 { 'struct': 'BlockDirtyBitmapMerge',
2078   'data': { 'node': 'str', 'target': 'str',
2079             'bitmaps': ['BlockDirtyBitmapMergeSource'] } }
2082 # @block-dirty-bitmap-add:
2084 # Create a dirty bitmap with a name on the node, and start tracking the writes.
2086 # Returns: - nothing on success
2087 #          - If @node is not a valid block device or node, DeviceNotFound
2088 #          - If @name is already taken, GenericError with an explanation
2090 # Since: 2.4
2092 # Example:
2094 # -> { "execute": "block-dirty-bitmap-add",
2095 #      "arguments": { "node": "drive0", "name": "bitmap0" } }
2096 # <- { "return": {} }
2099 { 'command': 'block-dirty-bitmap-add',
2100   'data': 'BlockDirtyBitmapAdd' }
2103 # @block-dirty-bitmap-remove:
2105 # Stop write tracking and remove the dirty bitmap that was created
2106 # with block-dirty-bitmap-add. If the bitmap is persistent, remove it from its
2107 # storage too.
2109 # Returns: - nothing on success
2110 #          - If @node is not a valid block device or node, DeviceNotFound
2111 #          - If @name is not found, GenericError with an explanation
2112 #          - if @name is frozen by an operation, GenericError
2114 # Since: 2.4
2116 # Example:
2118 # -> { "execute": "block-dirty-bitmap-remove",
2119 #      "arguments": { "node": "drive0", "name": "bitmap0" } }
2120 # <- { "return": {} }
2123 { 'command': 'block-dirty-bitmap-remove',
2124   'data': 'BlockDirtyBitmap' }
2127 # @block-dirty-bitmap-clear:
2129 # Clear (reset) a dirty bitmap on the device, so that an incremental
2130 # backup from this point in time forward will only backup clusters
2131 # modified after this clear operation.
2133 # Returns: - nothing on success
2134 #          - If @node is not a valid block device, DeviceNotFound
2135 #          - If @name is not found, GenericError with an explanation
2137 # Since: 2.4
2139 # Example:
2141 # -> { "execute": "block-dirty-bitmap-clear",
2142 #      "arguments": { "node": "drive0", "name": "bitmap0" } }
2143 # <- { "return": {} }
2146 { 'command': 'block-dirty-bitmap-clear',
2147   'data': 'BlockDirtyBitmap' }
2150 # @block-dirty-bitmap-enable:
2152 # Enables a dirty bitmap so that it will begin tracking disk changes.
2154 # Returns: - nothing on success
2155 #          - If @node is not a valid block device, DeviceNotFound
2156 #          - If @name is not found, GenericError with an explanation
2158 # Since: 4.0
2160 # Example:
2162 # -> { "execute": "block-dirty-bitmap-enable",
2163 #      "arguments": { "node": "drive0", "name": "bitmap0" } }
2164 # <- { "return": {} }
2167 { 'command': 'block-dirty-bitmap-enable',
2168   'data': 'BlockDirtyBitmap' }
2171 # @block-dirty-bitmap-disable:
2173 # Disables a dirty bitmap so that it will stop tracking disk changes.
2175 # Returns: - nothing on success
2176 #          - If @node is not a valid block device, DeviceNotFound
2177 #          - If @name is not found, GenericError with an explanation
2179 # Since: 4.0
2181 # Example:
2183 # -> { "execute": "block-dirty-bitmap-disable",
2184 #      "arguments": { "node": "drive0", "name": "bitmap0" } }
2185 # <- { "return": {} }
2188 { 'command': 'block-dirty-bitmap-disable',
2189   'data': 'BlockDirtyBitmap' }
2192 # @block-dirty-bitmap-merge:
2194 # Merge dirty bitmaps listed in @bitmaps to the @target dirty bitmap.
2195 # Dirty bitmaps in @bitmaps will be unchanged, except if it also appears
2196 # as the @target bitmap. Any bits already set in @target will still be
2197 # set after the merge, i.e., this operation does not clear the target.
2198 # On error, @target is unchanged.
2200 # The resulting bitmap will count as dirty any clusters that were dirty in any
2201 # of the source bitmaps. This can be used to achieve backup checkpoints, or in
2202 # simpler usages, to copy bitmaps.
2204 # Returns: - nothing on success
2205 #          - If @node is not a valid block device, DeviceNotFound
2206 #          - If any bitmap in @bitmaps or @target is not found, GenericError
2207 #          - If any of the bitmaps have different sizes or granularities,
2208 #            GenericError
2210 # Since: 4.0
2212 # Example:
2214 # -> { "execute": "block-dirty-bitmap-merge",
2215 #      "arguments": { "node": "drive0", "target": "bitmap0",
2216 #                     "bitmaps": ["bitmap1"] } }
2217 # <- { "return": {} }
2220 { 'command': 'block-dirty-bitmap-merge',
2221   'data': 'BlockDirtyBitmapMerge' }
2224 # @BlockDirtyBitmapSha256:
2226 # SHA256 hash of dirty bitmap data
2228 # @sha256: ASCII representation of SHA256 bitmap hash
2230 # Since: 2.10
2232 { 'struct': 'BlockDirtyBitmapSha256',
2233   'data': {'sha256': 'str'} }
2236 # @x-debug-block-dirty-bitmap-sha256:
2238 # Get bitmap SHA256.
2240 # Returns: - BlockDirtyBitmapSha256 on success
2241 #          - If @node is not a valid block device, DeviceNotFound
2242 #          - If @name is not found or if hashing has failed, GenericError with an
2243 #            explanation
2245 # Since: 2.10
2247 { 'command': 'x-debug-block-dirty-bitmap-sha256',
2248   'data': 'BlockDirtyBitmap', 'returns': 'BlockDirtyBitmapSha256' }
2251 # @blockdev-mirror:
2253 # Start mirroring a block device's writes to a new destination.
2255 # @job-id: identifier for the newly-created block job. If
2256 #          omitted, the device name will be used. (Since 2.7)
2258 # @device: The device name or node-name of a root node whose writes should be
2259 #          mirrored.
2261 # @target: the id or node-name of the block device to mirror to. This mustn't be
2262 #          attached to guest.
2264 # @replaces: with sync=full graph node name to be replaced by the new
2265 #            image when a whole image copy is done. This can be used to repair
2266 #            broken Quorum files.  By default, @device is replaced, although
2267 #            implicitly created filters on it are kept.
2269 # @speed:  the maximum speed, in bytes per second
2271 # @sync: what parts of the disk image should be copied to the destination
2272 #        (all the disk, only the sectors allocated in the topmost image, or
2273 #        only new I/O).
2275 # @granularity: granularity of the dirty bitmap, default is 64K
2276 #               if the image format doesn't have clusters, 4K if the clusters
2277 #               are smaller than that, else the cluster size.  Must be a
2278 #               power of 2 between 512 and 64M
2280 # @buf-size: maximum amount of data in flight from source to
2281 #            target
2283 # @on-source-error: the action to take on an error on the source,
2284 #                   default 'report'.  'stop' and 'enospc' can only be used
2285 #                   if the block device supports io-status (see BlockInfo).
2287 # @on-target-error: the action to take on an error on the target,
2288 #                   default 'report' (no limitations, since this applies to
2289 #                   a different block device than @device).
2291 # @filter-node-name: the node name that should be assigned to the
2292 #                    filter driver that the mirror job inserts into the graph
2293 #                    above @device. If this option is not given, a node name is
2294 #                    autogenerated. (Since: 2.9)
2296 # @copy-mode: when to copy data to the destination; defaults to 'background'
2297 #             (Since: 3.0)
2299 # @auto-finalize: When false, this job will wait in a PENDING state after it has
2300 #                 finished its work, waiting for @block-job-finalize before
2301 #                 making any block graph changes.
2302 #                 When true, this job will automatically
2303 #                 perform its abort or commit actions.
2304 #                 Defaults to true. (Since 3.1)
2306 # @auto-dismiss: When false, this job will wait in a CONCLUDED state after it
2307 #                has completely ceased all work, and awaits @block-job-dismiss.
2308 #                When true, this job will automatically disappear from the query
2309 #                list without user intervention.
2310 #                Defaults to true. (Since 3.1)
2311 # Returns: nothing on success.
2313 # Since: 2.6
2315 # Example:
2317 # -> { "execute": "blockdev-mirror",
2318 #      "arguments": { "device": "ide-hd0",
2319 #                     "target": "target0",
2320 #                     "sync": "full" } }
2321 # <- { "return": {} }
2324 { 'command': 'blockdev-mirror',
2325   'data': { '*job-id': 'str', 'device': 'str', 'target': 'str',
2326             '*replaces': 'str',
2327             'sync': 'MirrorSyncMode',
2328             '*speed': 'int', '*granularity': 'uint32',
2329             '*buf-size': 'int', '*on-source-error': 'BlockdevOnError',
2330             '*on-target-error': 'BlockdevOnError',
2331             '*filter-node-name': 'str',
2332             '*copy-mode': 'MirrorCopyMode',
2333             '*auto-finalize': 'bool', '*auto-dismiss': 'bool' } }
2336 # @BlockIOThrottle:
2338 # A set of parameters describing block throttling.
2340 # @device: Block device name
2342 # @id: The name or QOM path of the guest device (since: 2.8)
2344 # @bps: total throughput limit in bytes per second
2346 # @bps_rd: read throughput limit in bytes per second
2348 # @bps_wr: write throughput limit in bytes per second
2350 # @iops: total I/O operations per second
2352 # @iops_rd: read I/O operations per second
2354 # @iops_wr: write I/O operations per second
2356 # @bps_max: total throughput limit during bursts,
2357 #           in bytes (Since 1.7)
2359 # @bps_rd_max: read throughput limit during bursts,
2360 #              in bytes (Since 1.7)
2362 # @bps_wr_max: write throughput limit during bursts,
2363 #              in bytes (Since 1.7)
2365 # @iops_max: total I/O operations per second during bursts,
2366 #            in bytes (Since 1.7)
2368 # @iops_rd_max: read I/O operations per second during bursts,
2369 #               in bytes (Since 1.7)
2371 # @iops_wr_max: write I/O operations per second during bursts,
2372 #               in bytes (Since 1.7)
2374 # @bps_max_length: maximum length of the @bps_max burst
2375 #                  period, in seconds. It must only
2376 #                  be set if @bps_max is set as well.
2377 #                  Defaults to 1. (Since 2.6)
2379 # @bps_rd_max_length: maximum length of the @bps_rd_max
2380 #                     burst period, in seconds. It must only
2381 #                     be set if @bps_rd_max is set as well.
2382 #                     Defaults to 1. (Since 2.6)
2384 # @bps_wr_max_length: maximum length of the @bps_wr_max
2385 #                     burst period, in seconds. It must only
2386 #                     be set if @bps_wr_max is set as well.
2387 #                     Defaults to 1. (Since 2.6)
2389 # @iops_max_length: maximum length of the @iops burst
2390 #                   period, in seconds. It must only
2391 #                   be set if @iops_max is set as well.
2392 #                   Defaults to 1. (Since 2.6)
2394 # @iops_rd_max_length: maximum length of the @iops_rd_max
2395 #                      burst period, in seconds. It must only
2396 #                      be set if @iops_rd_max is set as well.
2397 #                      Defaults to 1. (Since 2.6)
2399 # @iops_wr_max_length: maximum length of the @iops_wr_max
2400 #                      burst period, in seconds. It must only
2401 #                      be set if @iops_wr_max is set as well.
2402 #                      Defaults to 1. (Since 2.6)
2404 # @iops_size: an I/O size in bytes (Since 1.7)
2406 # @group: throttle group name (Since 2.4)
2408 # Features:
2409 # @deprecated: Member @device is deprecated.  Use @id instead.
2411 # Since: 1.1
2413 { 'struct': 'BlockIOThrottle',
2414   'data': { '*device': { 'type': 'str', 'features': [ 'deprecated' ] },
2415             '*id': 'str', 'bps': 'int', 'bps_rd': 'int',
2416             'bps_wr': 'int', 'iops': 'int', 'iops_rd': 'int', 'iops_wr': 'int',
2417             '*bps_max': 'int', '*bps_rd_max': 'int',
2418             '*bps_wr_max': 'int', '*iops_max': 'int',
2419             '*iops_rd_max': 'int', '*iops_wr_max': 'int',
2420             '*bps_max_length': 'int', '*bps_rd_max_length': 'int',
2421             '*bps_wr_max_length': 'int', '*iops_max_length': 'int',
2422             '*iops_rd_max_length': 'int', '*iops_wr_max_length': 'int',
2423             '*iops_size': 'int', '*group': 'str' } }
2426 # @ThrottleLimits:
2428 # Limit parameters for throttling.
2429 # Since some limit combinations are illegal, limits should always be set in one
2430 # transaction. All fields are optional. When setting limits, if a field is
2431 # missing the current value is not changed.
2433 # @iops-total: limit total I/O operations per second
2434 # @iops-total-max: I/O operations burst
2435 # @iops-total-max-length: length of the iops-total-max burst period, in seconds
2436 #                         It must only be set if @iops-total-max is set as well.
2437 # @iops-read: limit read operations per second
2438 # @iops-read-max: I/O operations read burst
2439 # @iops-read-max-length: length of the iops-read-max burst period, in seconds
2440 #                        It must only be set if @iops-read-max is set as well.
2441 # @iops-write: limit write operations per second
2442 # @iops-write-max: I/O operations write burst
2443 # @iops-write-max-length: length of the iops-write-max burst period, in seconds
2444 #                         It must only be set if @iops-write-max is set as well.
2445 # @bps-total: limit total bytes per second
2446 # @bps-total-max: total bytes burst
2447 # @bps-total-max-length: length of the bps-total-max burst period, in seconds.
2448 #                        It must only be set if @bps-total-max is set as well.
2449 # @bps-read: limit read bytes per second
2450 # @bps-read-max: total bytes read burst
2451 # @bps-read-max-length: length of the bps-read-max burst period, in seconds
2452 #                       It must only be set if @bps-read-max is set as well.
2453 # @bps-write: limit write bytes per second
2454 # @bps-write-max: total bytes write burst
2455 # @bps-write-max-length: length of the bps-write-max burst period, in seconds
2456 #                        It must only be set if @bps-write-max is set as well.
2457 # @iops-size: when limiting by iops max size of an I/O in bytes
2459 # Since: 2.11
2461 { 'struct': 'ThrottleLimits',
2462   'data': { '*iops-total' : 'int', '*iops-total-max' : 'int',
2463             '*iops-total-max-length' : 'int', '*iops-read' : 'int',
2464             '*iops-read-max' : 'int', '*iops-read-max-length' : 'int',
2465             '*iops-write' : 'int', '*iops-write-max' : 'int',
2466             '*iops-write-max-length' : 'int', '*bps-total' : 'int',
2467             '*bps-total-max' : 'int', '*bps-total-max-length' : 'int',
2468             '*bps-read' : 'int', '*bps-read-max' : 'int',
2469             '*bps-read-max-length' : 'int', '*bps-write' : 'int',
2470             '*bps-write-max' : 'int', '*bps-write-max-length' : 'int',
2471             '*iops-size' : 'int' } }
2474 # @block-stream:
2476 # Copy data from a backing file into a block device.
2478 # The block streaming operation is performed in the background until the entire
2479 # backing file has been copied.  This command returns immediately once streaming
2480 # has started.  The status of ongoing block streaming operations can be checked
2481 # with query-block-jobs.  The operation can be stopped before it has completed
2482 # using the block-job-cancel command.
2484 # The node that receives the data is called the top image, can be located in
2485 # any part of the chain (but always above the base image; see below) and can be
2486 # specified using its device or node name. Earlier qemu versions only allowed
2487 # 'device' to name the top level node; presence of the 'base-node' parameter
2488 # during introspection can be used as a witness of the enhanced semantics
2489 # of 'device'.
2491 # If a base file is specified then sectors are not copied from that base file and
2492 # its backing chain.  This can be used to stream a subset of the backing file
2493 # chain instead of flattening the entire image.
2494 # When streaming completes the image file will have the base file as its backing
2495 # file, unless that node was changed while the job was running.  In that case,
2496 # base's parent's backing (or filtered, whichever exists) child (i.e., base at
2497 # the beginning of the job) will be the new backing file.
2499 # On successful completion the image file is updated to drop the backing file
2500 # and the BLOCK_JOB_COMPLETED event is emitted.
2502 # In case @device is a filter node, block-stream modifies the first non-filter
2503 # overlay node below it to point to the new backing node instead of modifying
2504 # @device itself.
2506 # @job-id: identifier for the newly-created block job. If
2507 #          omitted, the device name will be used. (Since 2.7)
2509 # @device: the device or node name of the top image
2511 # @base: the common backing file name.
2512 #        It cannot be set if @base-node is also set.
2514 # @base-node: the node name of the backing file.
2515 #             It cannot be set if @base is also set. (Since 2.8)
2517 # @backing-file: The backing file string to write into the top
2518 #                image. This filename is not validated.
2520 #                If a pathname string is such that it cannot be
2521 #                resolved by QEMU, that means that subsequent QMP or
2522 #                HMP commands must use node-names for the image in
2523 #                question, as filename lookup methods will fail.
2525 #                If not specified, QEMU will automatically determine
2526 #                the backing file string to use, or error out if there
2527 #                is no obvious choice.  Care should be taken when
2528 #                specifying the string, to specify a valid filename or
2529 #                protocol.
2530 #                (Since 2.1)
2532 # @speed: the maximum speed, in bytes per second
2534 # @on-error: the action to take on an error (default report).
2535 #            'stop' and 'enospc' can only be used if the block device
2536 #            supports io-status (see BlockInfo).  Since 1.3.
2538 # @auto-finalize: When false, this job will wait in a PENDING state after it has
2539 #                 finished its work, waiting for @block-job-finalize before
2540 #                 making any block graph changes.
2541 #                 When true, this job will automatically
2542 #                 perform its abort or commit actions.
2543 #                 Defaults to true. (Since 3.1)
2545 # @auto-dismiss: When false, this job will wait in a CONCLUDED state after it
2546 #                has completely ceased all work, and awaits @block-job-dismiss.
2547 #                When true, this job will automatically disappear from the query
2548 #                list without user intervention.
2549 #                Defaults to true. (Since 3.1)
2551 # Returns: - Nothing on success.
2552 #          - If @device does not exist, DeviceNotFound.
2554 # Since: 1.1
2556 # Example:
2558 # -> { "execute": "block-stream",
2559 #      "arguments": { "device": "virtio0",
2560 #                     "base": "/tmp/master.qcow2" } }
2561 # <- { "return": {} }
2564 { 'command': 'block-stream',
2565   'data': { '*job-id': 'str', 'device': 'str', '*base': 'str',
2566             '*base-node': 'str', '*backing-file': 'str', '*speed': 'int',
2567             '*on-error': 'BlockdevOnError',
2568             '*auto-finalize': 'bool', '*auto-dismiss': 'bool' } }
2571 # @block-job-set-speed:
2573 # Set maximum speed for a background block operation.
2575 # This command can only be issued when there is an active block job.
2577 # Throttling can be disabled by setting the speed to 0.
2579 # @device: The job identifier. This used to be a device name (hence
2580 #          the name of the parameter), but since QEMU 2.7 it can have
2581 #          other values.
2583 # @speed: the maximum speed, in bytes per second, or 0 for unlimited.
2584 #         Defaults to 0.
2586 # Returns: - Nothing on success
2587 #          - If no background operation is active on this device, DeviceNotActive
2589 # Since: 1.1
2591 { 'command': 'block-job-set-speed',
2592   'data': { 'device': 'str', 'speed': 'int' } }
2595 # @block-job-cancel:
2597 # Stop an active background block operation.
2599 # This command returns immediately after marking the active background block
2600 # operation for cancellation.  It is an error to call this command if no
2601 # operation is in progress.
2603 # The operation will cancel as soon as possible and then emit the
2604 # BLOCK_JOB_CANCELLED event.  Before that happens the job is still visible when
2605 # enumerated using query-block-jobs.
2607 # Note that if you issue 'block-job-cancel' after 'drive-mirror' has indicated
2608 # (via the event BLOCK_JOB_READY) that the source and destination are
2609 # synchronized, then the event triggered by this command changes to
2610 # BLOCK_JOB_COMPLETED, to indicate that the mirroring has ended and the
2611 # destination now has a point-in-time copy tied to the time of the cancellation.
2613 # For streaming, the image file retains its backing file unless the streaming
2614 # operation happens to complete just as it is being cancelled.  A new streaming
2615 # operation can be started at a later time to finish copying all data from the
2616 # backing file.
2618 # @device: The job identifier. This used to be a device name (hence
2619 #          the name of the parameter), but since QEMU 2.7 it can have
2620 #          other values.
2622 # @force: If true, and the job has already emitted the event BLOCK_JOB_READY,
2623 #         abandon the job immediately (even if it is paused) instead of waiting
2624 #         for the destination to complete its final synchronization (since 1.3)
2626 # Returns: - Nothing on success
2627 #          - If no background operation is active on this device, DeviceNotActive
2629 # Since: 1.1
2631 { 'command': 'block-job-cancel', 'data': { 'device': 'str', '*force': 'bool' } }
2634 # @block-job-pause:
2636 # Pause an active background block operation.
2638 # This command returns immediately after marking the active background block
2639 # operation for pausing.  It is an error to call this command if no
2640 # operation is in progress or if the job is already paused.
2642 # The operation will pause as soon as possible.  No event is emitted when
2643 # the operation is actually paused.  Cancelling a paused job automatically
2644 # resumes it.
2646 # @device: The job identifier. This used to be a device name (hence
2647 #          the name of the parameter), but since QEMU 2.7 it can have
2648 #          other values.
2650 # Returns: - Nothing on success
2651 #          - If no background operation is active on this device, DeviceNotActive
2653 # Since: 1.3
2655 { 'command': 'block-job-pause', 'data': { 'device': 'str' } }
2658 # @block-job-resume:
2660 # Resume an active background block operation.
2662 # This command returns immediately after resuming a paused background block
2663 # operation.  It is an error to call this command if no operation is in
2664 # progress or if the job is not paused.
2666 # This command also clears the error status of the job.
2668 # @device: The job identifier. This used to be a device name (hence
2669 #          the name of the parameter), but since QEMU 2.7 it can have
2670 #          other values.
2672 # Returns: - Nothing on success
2673 #          - If no background operation is active on this device, DeviceNotActive
2675 # Since: 1.3
2677 { 'command': 'block-job-resume', 'data': { 'device': 'str' } }
2680 # @block-job-complete:
2682 # Manually trigger completion of an active background block operation.  This
2683 # is supported for drive mirroring, where it also switches the device to
2684 # write to the target path only.  The ability to complete is signaled with
2685 # a BLOCK_JOB_READY event.
2687 # This command completes an active background block operation synchronously.
2688 # The ordering of this command's return with the BLOCK_JOB_COMPLETED event
2689 # is not defined.  Note that if an I/O error occurs during the processing of
2690 # this command: 1) the command itself will fail; 2) the error will be processed
2691 # according to the rerror/werror arguments that were specified when starting
2692 # the operation.
2694 # A cancelled or paused job cannot be completed.
2696 # @device: The job identifier. This used to be a device name (hence
2697 #          the name of the parameter), but since QEMU 2.7 it can have
2698 #          other values.
2700 # Returns: - Nothing on success
2701 #          - If no background operation is active on this device, DeviceNotActive
2703 # Since: 1.3
2705 { 'command': 'block-job-complete', 'data': { 'device': 'str' } }
2708 # @block-job-dismiss:
2710 # For jobs that have already concluded, remove them from the block-job-query
2711 # list. This command only needs to be run for jobs which were started with
2712 # QEMU 2.12+ job lifetime management semantics.
2714 # This command will refuse to operate on any job that has not yet reached
2715 # its terminal state, JOB_STATUS_CONCLUDED. For jobs that make use of the
2716 # BLOCK_JOB_READY event, block-job-cancel or block-job-complete will still need
2717 # to be used as appropriate.
2719 # @id: The job identifier.
2721 # Returns: Nothing on success
2723 # Since: 2.12
2725 { 'command': 'block-job-dismiss', 'data': { 'id': 'str' } }
2728 # @block-job-finalize:
2730 # Once a job that has manual=true reaches the pending state, it can be
2731 # instructed to finalize any graph changes and do any necessary cleanup
2732 # via this command.
2733 # For jobs in a transaction, instructing one job to finalize will force
2734 # ALL jobs in the transaction to finalize, so it is only necessary to instruct
2735 # a single member job to finalize.
2737 # @id: The job identifier.
2739 # Returns: Nothing on success
2741 # Since: 2.12
2743 { 'command': 'block-job-finalize', 'data': { 'id': 'str' } }
2746 # @BlockdevDiscardOptions:
2748 # Determines how to handle discard requests.
2750 # @ignore: Ignore the request
2751 # @unmap: Forward as an unmap request
2753 # Since: 2.9
2755 { 'enum': 'BlockdevDiscardOptions',
2756   'data': [ 'ignore', 'unmap' ] }
2759 # @BlockdevDetectZeroesOptions:
2761 # Describes the operation mode for the automatic conversion of plain
2762 # zero writes by the OS to driver specific optimized zero write commands.
2764 # @off: Disabled (default)
2765 # @on: Enabled
2766 # @unmap: Enabled and even try to unmap blocks if possible. This requires
2767 #         also that @BlockdevDiscardOptions is set to unmap for this device.
2769 # Since: 2.1
2771 { 'enum': 'BlockdevDetectZeroesOptions',
2772   'data': [ 'off', 'on', 'unmap' ] }
2775 # @BlockdevAioOptions:
2777 # Selects the AIO backend to handle I/O requests
2779 # @threads: Use qemu's thread pool
2780 # @native: Use native AIO backend (only Linux and Windows)
2781 # @io_uring: Use linux io_uring (since 5.0)
2783 # Since: 2.9
2785 { 'enum': 'BlockdevAioOptions',
2786   'data': [ 'threads', 'native',
2787             { 'name': 'io_uring', 'if': 'defined(CONFIG_LINUX_IO_URING)' } ] }
2790 # @BlockdevCacheOptions:
2792 # Includes cache-related options for block devices
2794 # @direct: enables use of O_DIRECT (bypass the host page cache;
2795 #          default: false)
2796 # @no-flush: ignore any flush requests for the device (default:
2797 #            false)
2799 # Since: 2.9
2801 { 'struct': 'BlockdevCacheOptions',
2802   'data': { '*direct': 'bool',
2803             '*no-flush': 'bool' } }
2806 # @BlockdevDriver:
2808 # Drivers that are supported in block device operations.
2810 # @throttle: Since 2.11
2811 # @nvme: Since 2.12
2812 # @copy-on-read: Since 3.0
2813 # @blklogwrites: Since 3.0
2814 # @blkreplay: Since 4.2
2815 # @compress: Since 5.0
2817 # Since: 2.9
2819 { 'enum': 'BlockdevDriver',
2820   'data': [ 'blkdebug', 'blklogwrites', 'blkreplay', 'blkverify', 'bochs',
2821             'cloop', 'compress', 'copy-on-read', 'dmg', 'file', 'ftp', 'ftps',
2822             'gluster', 'host_cdrom', 'host_device', 'http', 'https', 'iscsi',
2823             'luks', 'nbd', 'nfs', 'null-aio', 'null-co', 'nvme', 'parallels',
2824             'qcow', 'qcow2', 'qed', 'quorum', 'raw', 'rbd',
2825             { 'name': 'replication', 'if': 'defined(CONFIG_REPLICATION)' },
2826             'sheepdog',
2827             'ssh', 'throttle', 'vdi', 'vhdx', 'vmdk', 'vpc', 'vvfat' ] }
2830 # @BlockdevOptionsFile:
2832 # Driver specific block device options for the file backend.
2834 # @filename: path to the image file
2835 # @pr-manager: the id for the object that will handle persistent reservations
2836 #              for this device (default: none, forward the commands via SG_IO;
2837 #              since 2.11)
2838 # @aio: AIO backend (default: threads) (since: 2.8)
2839 # @locking: whether to enable file locking. If set to 'auto', only enable
2840 #           when Open File Descriptor (OFD) locking API is available
2841 #           (default: auto, since 2.10)
2842 # @drop-cache: invalidate page cache during live migration.  This prevents
2843 #              stale data on the migration destination with cache.direct=off.
2844 #              Currently only supported on Linux hosts.
2845 #              (default: on, since: 4.0)
2846 # @x-check-cache-dropped: whether to check that page cache was dropped on live
2847 #                         migration.  May cause noticeable delays if the image
2848 #                         file is large, do not use in production.
2849 #                         (default: off) (since: 3.0)
2851 # Features:
2852 # @dynamic-auto-read-only: If present, enabled auto-read-only means that the
2853 #                          driver will open the image read-only at first,
2854 #                          dynamically reopen the image file read-write when
2855 #                          the first writer is attached to the node and reopen
2856 #                          read-only when the last writer is detached. This
2857 #                          allows giving QEMU write permissions only on demand
2858 #                          when an operation actually needs write access.
2860 # Since: 2.9
2862 { 'struct': 'BlockdevOptionsFile',
2863   'data': { 'filename': 'str',
2864             '*pr-manager': 'str',
2865             '*locking': 'OnOffAuto',
2866             '*aio': 'BlockdevAioOptions',
2867             '*drop-cache': {'type': 'bool',
2868                             'if': 'defined(CONFIG_LINUX)'},
2869             '*x-check-cache-dropped': 'bool' },
2870   'features': [ { 'name': 'dynamic-auto-read-only',
2871                   'if': 'defined(CONFIG_POSIX)' } ] }
2874 # @BlockdevOptionsNull:
2876 # Driver specific block device options for the null backend.
2878 # @size: size of the device in bytes.
2879 # @latency-ns: emulated latency (in nanoseconds) in processing
2880 #              requests. Default to zero which completes requests immediately.
2881 #              (Since 2.4)
2882 # @read-zeroes: if true, reads from the device produce zeroes; if false, the
2883 #               buffer is left unchanged. (default: false; since: 4.1)
2885 # Since: 2.9
2887 { 'struct': 'BlockdevOptionsNull',
2888   'data': { '*size': 'int', '*latency-ns': 'uint64', '*read-zeroes': 'bool' } }
2891 # @BlockdevOptionsNVMe:
2893 # Driver specific block device options for the NVMe backend.
2895 # @device: PCI controller address of the NVMe device in
2896 #          format hhhh:bb:ss.f (host:bus:slot.function)
2897 # @namespace: namespace number of the device, starting from 1.
2899 # Note that the PCI @device must have been unbound from any host
2900 # kernel driver before instructing QEMU to add the blockdev.
2902 # Since: 2.12
2904 { 'struct': 'BlockdevOptionsNVMe',
2905   'data': { 'device': 'str', 'namespace': 'int' } }
2908 # @BlockdevOptionsVVFAT:
2910 # Driver specific block device options for the vvfat protocol.
2912 # @dir: directory to be exported as FAT image
2913 # @fat-type: FAT type: 12, 16 or 32
2914 # @floppy: whether to export a floppy image (true) or
2915 #          partitioned hard disk (false; default)
2916 # @label: set the volume label, limited to 11 bytes. FAT16 and
2917 #         FAT32 traditionally have some restrictions on labels, which are
2918 #         ignored by most operating systems. Defaults to "QEMU VVFAT".
2919 #         (since 2.4)
2920 # @rw: whether to allow write operations (default: false)
2922 # Since: 2.9
2924 { 'struct': 'BlockdevOptionsVVFAT',
2925   'data': { 'dir': 'str', '*fat-type': 'int', '*floppy': 'bool',
2926             '*label': 'str', '*rw': 'bool' } }
2929 # @BlockdevOptionsGenericFormat:
2931 # Driver specific block device options for image format that have no option
2932 # besides their data source.
2934 # @file: reference to or definition of the data source block device
2936 # Since: 2.9
2938 { 'struct': 'BlockdevOptionsGenericFormat',
2939   'data': { 'file': 'BlockdevRef' } }
2942 # @BlockdevOptionsLUKS:
2944 # Driver specific block device options for LUKS.
2946 # @key-secret: the ID of a QCryptoSecret object providing
2947 #              the decryption key (since 2.6). Mandatory except when
2948 #              doing a metadata-only probe of the image.
2950 # Since: 2.9
2952 { 'struct': 'BlockdevOptionsLUKS',
2953   'base': 'BlockdevOptionsGenericFormat',
2954   'data': { '*key-secret': 'str' } }
2958 # @BlockdevOptionsGenericCOWFormat:
2960 # Driver specific block device options for image format that have no option
2961 # besides their data source and an optional backing file.
2963 # @backing: reference to or definition of the backing file block
2964 #           device, null disables the backing file entirely.
2965 #           Defaults to the backing file stored the image file.
2967 # Since: 2.9
2969 { 'struct': 'BlockdevOptionsGenericCOWFormat',
2970   'base': 'BlockdevOptionsGenericFormat',
2971   'data': { '*backing': 'BlockdevRefOrNull' } }
2974 # @Qcow2OverlapCheckMode:
2976 # General overlap check modes.
2978 # @none: Do not perform any checks
2980 # @constant: Perform only checks which can be done in constant time and
2981 #            without reading anything from disk
2983 # @cached: Perform only checks which can be done without reading anything
2984 #          from disk
2986 # @all: Perform all available overlap checks
2988 # Since: 2.9
2990 { 'enum': 'Qcow2OverlapCheckMode',
2991   'data': [ 'none', 'constant', 'cached', 'all' ] }
2994 # @Qcow2OverlapCheckFlags:
2996 # Structure of flags for each metadata structure. Setting a field to 'true'
2997 # makes qemu guard that structure against unintended overwriting. The default
2998 # value is chosen according to the template given.
3000 # @template: Specifies a template mode which can be adjusted using the other
3001 #            flags, defaults to 'cached'
3003 # @bitmap-directory: since 3.0
3005 # Since: 2.9
3007 { 'struct': 'Qcow2OverlapCheckFlags',
3008   'data': { '*template':         'Qcow2OverlapCheckMode',
3009             '*main-header':      'bool',
3010             '*active-l1':        'bool',
3011             '*active-l2':        'bool',
3012             '*refcount-table':   'bool',
3013             '*refcount-block':   'bool',
3014             '*snapshot-table':   'bool',
3015             '*inactive-l1':      'bool',
3016             '*inactive-l2':      'bool',
3017             '*bitmap-directory': 'bool' } }
3020 # @Qcow2OverlapChecks:
3022 # Specifies which metadata structures should be guarded against unintended
3023 # overwriting.
3025 # @flags: set of flags for separate specification of each metadata structure
3026 #         type
3028 # @mode: named mode which chooses a specific set of flags
3030 # Since: 2.9
3032 { 'alternate': 'Qcow2OverlapChecks',
3033   'data': { 'flags': 'Qcow2OverlapCheckFlags',
3034             'mode':  'Qcow2OverlapCheckMode' } }
3037 # @BlockdevQcowEncryptionFormat:
3039 # @aes: AES-CBC with plain64 initialization vectors
3041 # Since: 2.10
3043 { 'enum': 'BlockdevQcowEncryptionFormat',
3044   'data': [ 'aes' ] }
3047 # @BlockdevQcowEncryption:
3049 # Since: 2.10
3051 { 'union': 'BlockdevQcowEncryption',
3052   'base': { 'format': 'BlockdevQcowEncryptionFormat' },
3053   'discriminator': 'format',
3054   'data': { 'aes': 'QCryptoBlockOptionsQCow' } }
3057 # @BlockdevOptionsQcow:
3059 # Driver specific block device options for qcow.
3061 # @encrypt: Image decryption options. Mandatory for
3062 #           encrypted images, except when doing a metadata-only
3063 #           probe of the image.
3065 # Since: 2.10
3067 { 'struct': 'BlockdevOptionsQcow',
3068   'base': 'BlockdevOptionsGenericCOWFormat',
3069   'data': { '*encrypt': 'BlockdevQcowEncryption' } }
3074 # @BlockdevQcow2EncryptionFormat:
3075 # @aes: AES-CBC with plain64 initialization vectors
3077 # Since: 2.10
3079 { 'enum': 'BlockdevQcow2EncryptionFormat',
3080   'data': [ 'aes', 'luks' ] }
3083 # @BlockdevQcow2Encryption:
3085 # Since: 2.10
3087 { 'union': 'BlockdevQcow2Encryption',
3088   'base': { 'format': 'BlockdevQcow2EncryptionFormat' },
3089   'discriminator': 'format',
3090   'data': { 'aes': 'QCryptoBlockOptionsQCow',
3091             'luks': 'QCryptoBlockOptionsLUKS'} }
3094 # @BlockdevOptionsQcow2:
3096 # Driver specific block device options for qcow2.
3098 # @lazy-refcounts: whether to enable the lazy refcounts
3099 #                  feature (default is taken from the image file)
3101 # @pass-discard-request: whether discard requests to the qcow2
3102 #                        device should be forwarded to the data source
3104 # @pass-discard-snapshot: whether discard requests for the data source
3105 #                         should be issued when a snapshot operation (e.g.
3106 #                         deleting a snapshot) frees clusters in the qcow2 file
3108 # @pass-discard-other: whether discard requests for the data source
3109 #                      should be issued on other occasions where a cluster
3110 #                      gets freed
3112 # @overlap-check: which overlap checks to perform for writes
3113 #                 to the image, defaults to 'cached' (since 2.2)
3115 # @cache-size: the maximum total size of the L2 table and
3116 #              refcount block caches in bytes (since 2.2)
3118 # @l2-cache-size: the maximum size of the L2 table cache in
3119 #                 bytes (since 2.2)
3121 # @l2-cache-entry-size: the size of each entry in the L2 cache in
3122 #                       bytes. It must be a power of two between 512
3123 #                       and the cluster size. The default value is
3124 #                       the cluster size (since 2.12)
3126 # @refcount-cache-size: the maximum size of the refcount block cache
3127 #                       in bytes (since 2.2)
3129 # @cache-clean-interval: clean unused entries in the L2 and refcount
3130 #                        caches. The interval is in seconds. The default value
3131 #                        is 600 on supporting platforms, and 0 on other
3132 #                        platforms. 0 disables this feature. (since 2.5)
3134 # @encrypt: Image decryption options. Mandatory for
3135 #           encrypted images, except when doing a metadata-only
3136 #           probe of the image. (since 2.10)
3138 # @data-file: reference to or definition of the external data file.
3139 #             This may only be specified for images that require an
3140 #             external data file. If it is not specified for such
3141 #             an image, the data file name is loaded from the image
3142 #             file. (since 4.0)
3144 # Since: 2.9
3146 { 'struct': 'BlockdevOptionsQcow2',
3147   'base': 'BlockdevOptionsGenericCOWFormat',
3148   'data': { '*lazy-refcounts': 'bool',
3149             '*pass-discard-request': 'bool',
3150             '*pass-discard-snapshot': 'bool',
3151             '*pass-discard-other': 'bool',
3152             '*overlap-check': 'Qcow2OverlapChecks',
3153             '*cache-size': 'int',
3154             '*l2-cache-size': 'int',
3155             '*l2-cache-entry-size': 'int',
3156             '*refcount-cache-size': 'int',
3157             '*cache-clean-interval': 'int',
3158             '*encrypt': 'BlockdevQcow2Encryption',
3159             '*data-file': 'BlockdevRef' } }
3162 # @SshHostKeyCheckMode:
3164 # @none: Don't check the host key at all
3165 # @hash: Compare the host key with a given hash
3166 # @known_hosts: Check the host key against the known_hosts file
3168 # Since: 2.12
3170 { 'enum': 'SshHostKeyCheckMode',
3171   'data': [ 'none', 'hash', 'known_hosts' ] }
3174 # @SshHostKeyCheckHashType:
3176 # @md5: The given hash is an md5 hash
3177 # @sha1: The given hash is an sha1 hash
3179 # Since: 2.12
3181 { 'enum': 'SshHostKeyCheckHashType',
3182   'data': [ 'md5', 'sha1' ] }
3185 # @SshHostKeyHash:
3187 # @type: The hash algorithm used for the hash
3188 # @hash: The expected hash value
3190 # Since: 2.12
3192 { 'struct': 'SshHostKeyHash',
3193   'data': { 'type': 'SshHostKeyCheckHashType',
3194             'hash': 'str' }}
3197 # @SshHostKeyCheck:
3199 # Since: 2.12
3201 { 'union': 'SshHostKeyCheck',
3202   'base': { 'mode': 'SshHostKeyCheckMode' },
3203   'discriminator': 'mode',
3204   'data': { 'hash': 'SshHostKeyHash' } }
3207 # @BlockdevOptionsSsh:
3209 # @server:              host address
3211 # @path:                path to the image on the host
3213 # @user:                user as which to connect, defaults to current
3214 #                       local user name
3216 # @host-key-check:      Defines how and what to check the host key against
3217 #                       (default: known_hosts)
3219 # Since: 2.9
3221 { 'struct': 'BlockdevOptionsSsh',
3222   'data': { 'server': 'InetSocketAddress',
3223             'path': 'str',
3224             '*user': 'str',
3225             '*host-key-check': 'SshHostKeyCheck' } }
3229 # @BlkdebugEvent:
3231 # Trigger events supported by blkdebug.
3233 # @l1_shrink_write_table: write zeros to the l1 table to shrink image.
3234 #                         (since 2.11)
3236 # @l1_shrink_free_l2_clusters: discard the l2 tables. (since 2.11)
3238 # @cor_write: a write due to copy-on-read (since 2.11)
3240 # @cluster_alloc_space: an allocation of file space for a cluster (since 4.1)
3242 # @none: triggers once at creation of the blkdebug node (since 4.1)
3244 # Since: 2.9
3246 { 'enum': 'BlkdebugEvent', 'prefix': 'BLKDBG',
3247   'data': [ 'l1_update', 'l1_grow_alloc_table', 'l1_grow_write_table',
3248             'l1_grow_activate_table', 'l2_load', 'l2_update',
3249             'l2_update_compressed', 'l2_alloc_cow_read', 'l2_alloc_write',
3250             'read_aio', 'read_backing_aio', 'read_compressed', 'write_aio',
3251             'write_compressed', 'vmstate_load', 'vmstate_save', 'cow_read',
3252             'cow_write', 'reftable_load', 'reftable_grow', 'reftable_update',
3253             'refblock_load', 'refblock_update', 'refblock_update_part',
3254             'refblock_alloc', 'refblock_alloc_hookup', 'refblock_alloc_write',
3255             'refblock_alloc_write_blocks', 'refblock_alloc_write_table',
3256             'refblock_alloc_switch_table', 'cluster_alloc',
3257             'cluster_alloc_bytes', 'cluster_free', 'flush_to_os',
3258             'flush_to_disk', 'pwritev_rmw_head', 'pwritev_rmw_after_head',
3259             'pwritev_rmw_tail', 'pwritev_rmw_after_tail', 'pwritev',
3260             'pwritev_zero', 'pwritev_done', 'empty_image_prepare',
3261             'l1_shrink_write_table', 'l1_shrink_free_l2_clusters',
3262             'cor_write', 'cluster_alloc_space', 'none'] }
3265 # @BlkdebugIOType:
3267 # Kinds of I/O that blkdebug can inject errors in.
3269 # @read: .bdrv_co_preadv()
3271 # @write: .bdrv_co_pwritev()
3273 # @write-zeroes: .bdrv_co_pwrite_zeroes()
3275 # @discard: .bdrv_co_pdiscard()
3277 # @flush: .bdrv_co_flush_to_disk()
3279 # @block-status: .bdrv_co_block_status()
3281 # Since: 4.1
3283 { 'enum': 'BlkdebugIOType', 'prefix': 'BLKDEBUG_IO_TYPE',
3284   'data': [ 'read', 'write', 'write-zeroes', 'discard', 'flush',
3285             'block-status' ] }
3288 # @BlkdebugInjectErrorOptions:
3290 # Describes a single error injection for blkdebug.
3292 # @event: trigger event
3294 # @state: the state identifier blkdebug needs to be in to
3295 #         actually trigger the event; defaults to "any"
3297 # @iotype: the type of I/O operations on which this error should
3298 #          be injected; defaults to "all read, write,
3299 #          write-zeroes, discard, and flush operations"
3300 #          (since: 4.1)
3302 # @errno: error identifier (errno) to be returned; defaults to
3303 #         EIO
3305 # @sector: specifies the sector index which has to be affected
3306 #          in order to actually trigger the event; defaults to "any
3307 #          sector"
3309 # @once: disables further events after this one has been
3310 #        triggered; defaults to false
3312 # @immediately: fail immediately; defaults to false
3314 # Since: 2.9
3316 { 'struct': 'BlkdebugInjectErrorOptions',
3317   'data': { 'event': 'BlkdebugEvent',
3318             '*state': 'int',
3319             '*iotype': 'BlkdebugIOType',
3320             '*errno': 'int',
3321             '*sector': 'int',
3322             '*once': 'bool',
3323             '*immediately': 'bool' } }
3326 # @BlkdebugSetStateOptions:
3328 # Describes a single state-change event for blkdebug.
3330 # @event: trigger event
3332 # @state: the current state identifier blkdebug needs to be in;
3333 #         defaults to "any"
3335 # @new_state: the state identifier blkdebug is supposed to assume if
3336 #             this event is triggered
3338 # Since: 2.9
3340 { 'struct': 'BlkdebugSetStateOptions',
3341   'data': { 'event': 'BlkdebugEvent',
3342             '*state': 'int',
3343             'new_state': 'int' } }
3346 # @BlockdevOptionsBlkdebug:
3348 # Driver specific block device options for blkdebug.
3350 # @image: underlying raw block device (or image file)
3352 # @config: filename of the configuration file
3354 # @align: required alignment for requests in bytes, must be
3355 #         positive power of 2, or 0 for default
3357 # @max-transfer: maximum size for I/O transfers in bytes, must be
3358 #                positive multiple of @align and of the underlying
3359 #                file's request alignment (but need not be a power of
3360 #                2), or 0 for default (since 2.10)
3362 # @opt-write-zero: preferred alignment for write zero requests in bytes,
3363 #                  must be positive multiple of @align and of the
3364 #                  underlying file's request alignment (but need not be a
3365 #                  power of 2), or 0 for default (since 2.10)
3367 # @max-write-zero: maximum size for write zero requests in bytes, must be
3368 #                  positive multiple of @align, of @opt-write-zero, and of
3369 #                  the underlying file's request alignment (but need not
3370 #                  be a power of 2), or 0 for default (since 2.10)
3372 # @opt-discard: preferred alignment for discard requests in bytes, must
3373 #               be positive multiple of @align and of the underlying
3374 #               file's request alignment (but need not be a power of
3375 #               2), or 0 for default (since 2.10)
3377 # @max-discard: maximum size for discard requests in bytes, must be
3378 #               positive multiple of @align, of @opt-discard, and of
3379 #               the underlying file's request alignment (but need not
3380 #               be a power of 2), or 0 for default (since 2.10)
3382 # @inject-error: array of error injection descriptions
3384 # @set-state: array of state-change descriptions
3386 # @take-child-perms: Permissions to take on @image in addition to what
3387 #                    is necessary anyway (which depends on how the
3388 #                    blkdebug node is used).  Defaults to none.
3389 #                    (since 5.0)
3391 # @unshare-child-perms: Permissions not to share on @image in addition
3392 #                       to what cannot be shared anyway (which depends
3393 #                       on how the blkdebug node is used).  Defaults
3394 #                       to none.  (since 5.0)
3396 # Since: 2.9
3398 { 'struct': 'BlockdevOptionsBlkdebug',
3399   'data': { 'image': 'BlockdevRef',
3400             '*config': 'str',
3401             '*align': 'int', '*max-transfer': 'int32',
3402             '*opt-write-zero': 'int32', '*max-write-zero': 'int32',
3403             '*opt-discard': 'int32', '*max-discard': 'int32',
3404             '*inject-error': ['BlkdebugInjectErrorOptions'],
3405             '*set-state': ['BlkdebugSetStateOptions'],
3406             '*take-child-perms': ['BlockPermission'],
3407             '*unshare-child-perms': ['BlockPermission'] } }
3410 # @BlockdevOptionsBlklogwrites:
3412 # Driver specific block device options for blklogwrites.
3414 # @file: block device
3416 # @log: block device used to log writes to @file
3418 # @log-sector-size: sector size used in logging writes to @file, determines
3419 #                   granularity of offsets and sizes of writes (default: 512)
3421 # @log-append: append to an existing log (default: false)
3423 # @log-super-update-interval: interval of write requests after which the log
3424 #                             super block is updated to disk (default: 4096)
3426 # Since: 3.0
3428 { 'struct': 'BlockdevOptionsBlklogwrites',
3429   'data': { 'file': 'BlockdevRef',
3430             'log': 'BlockdevRef',
3431             '*log-sector-size': 'uint32',
3432             '*log-append': 'bool',
3433             '*log-super-update-interval': 'uint64' } }
3436 # @BlockdevOptionsBlkverify:
3438 # Driver specific block device options for blkverify.
3440 # @test: block device to be tested
3442 # @raw: raw image used for verification
3444 # Since: 2.9
3446 { 'struct': 'BlockdevOptionsBlkverify',
3447   'data': { 'test': 'BlockdevRef',
3448             'raw': 'BlockdevRef' } }
3451 # @BlockdevOptionsBlkreplay:
3453 # Driver specific block device options for blkreplay.
3455 # @image: disk image which should be controlled with blkreplay
3457 # Since: 4.2
3459 { 'struct': 'BlockdevOptionsBlkreplay',
3460   'data': { 'image': 'BlockdevRef' } }
3463 # @QuorumReadPattern:
3465 # An enumeration of quorum read patterns.
3467 # @quorum: read all the children and do a quorum vote on reads
3469 # @fifo: read only from the first child that has not failed
3471 # Since: 2.9
3473 { 'enum': 'QuorumReadPattern', 'data': [ 'quorum', 'fifo' ] }
3476 # @BlockdevOptionsQuorum:
3478 # Driver specific block device options for Quorum
3480 # @blkverify: true if the driver must print content mismatch
3481 #                  set to false by default
3483 # @children: the children block devices to use
3485 # @vote-threshold: the vote limit under which a read will fail
3487 # @rewrite-corrupted: rewrite corrupted data when quorum is reached
3488 #                     (Since 2.1)
3490 # @read-pattern: choose read pattern and set to quorum by default
3491 #                (Since 2.2)
3493 # Since: 2.9
3495 { 'struct': 'BlockdevOptionsQuorum',
3496   'data': { '*blkverify': 'bool',
3497             'children': [ 'BlockdevRef' ],
3498             'vote-threshold': 'int',
3499             '*rewrite-corrupted': 'bool',
3500             '*read-pattern': 'QuorumReadPattern' } }
3503 # @BlockdevOptionsGluster:
3505 # Driver specific block device options for Gluster
3507 # @volume: name of gluster volume where VM image resides
3509 # @path: absolute path to image file in gluster volume
3511 # @server: gluster servers description
3513 # @debug: libgfapi log level (default '4' which is Error)
3514 #         (Since 2.8)
3516 # @logfile: libgfapi log file (default /dev/stderr) (Since 2.8)
3518 # Since: 2.9
3520 { 'struct': 'BlockdevOptionsGluster',
3521   'data': { 'volume': 'str',
3522             'path': 'str',
3523             'server': ['SocketAddress'],
3524             '*debug': 'int',
3525             '*logfile': 'str' } }
3528 # @IscsiTransport:
3530 # An enumeration of libiscsi transport types
3532 # Since: 2.9
3534 { 'enum': 'IscsiTransport',
3535   'data': [ 'tcp', 'iser' ] }
3538 # @IscsiHeaderDigest:
3540 # An enumeration of header digests supported by libiscsi
3542 # Since: 2.9
3544 { 'enum': 'IscsiHeaderDigest',
3545   'prefix': 'QAPI_ISCSI_HEADER_DIGEST',
3546   'data': [ 'crc32c', 'none', 'crc32c-none', 'none-crc32c' ] }
3549 # @BlockdevOptionsIscsi:
3551 # @transport: The iscsi transport type
3553 # @portal: The address of the iscsi portal
3555 # @target: The target iqn name
3557 # @lun: LUN to connect to. Defaults to 0.
3559 # @user: User name to log in with. If omitted, no CHAP
3560 #        authentication is performed.
3562 # @password-secret: The ID of a QCryptoSecret object providing
3563 #                   the password for the login. This option is required if
3564 #                   @user is specified.
3566 # @initiator-name: The iqn name we want to identify to the target
3567 #                  as. If this option is not specified, an initiator name is
3568 #                  generated automatically.
3570 # @header-digest: The desired header digest. Defaults to
3571 #                 none-crc32c.
3573 # @timeout: Timeout in seconds after which a request will
3574 #           timeout. 0 means no timeout and is the default.
3576 # Driver specific block device options for iscsi
3578 # Since: 2.9
3580 { 'struct': 'BlockdevOptionsIscsi',
3581   'data': { 'transport': 'IscsiTransport',
3582             'portal': 'str',
3583             'target': 'str',
3584             '*lun': 'int',
3585             '*user': 'str',
3586             '*password-secret': 'str',
3587             '*initiator-name': 'str',
3588             '*header-digest': 'IscsiHeaderDigest',
3589             '*timeout': 'int' } }
3593 # @RbdAuthMode:
3595 # Since: 3.0
3597 { 'enum': 'RbdAuthMode',
3598   'data': [ 'cephx', 'none' ] }
3601 # @BlockdevOptionsRbd:
3603 # @pool: Ceph pool name.
3605 # @namespace: Rados namespace name in the Ceph pool. (Since 5.0)
3607 # @image: Image name in the Ceph pool.
3609 # @conf: path to Ceph configuration file.  Values
3610 #        in the configuration file will be overridden by
3611 #        options specified via QAPI.
3613 # @snapshot: Ceph snapshot name.
3615 # @user: Ceph id name.
3617 # @auth-client-required: Acceptable authentication modes.
3618 #                        This maps to Ceph configuration option
3619 #                        "auth_client_required".  (Since 3.0)
3621 # @key-secret: ID of a QCryptoSecret object providing a key
3622 #              for cephx authentication.
3623 #              This maps to Ceph configuration option
3624 #              "key".  (Since 3.0)
3626 # @server: Monitor host address and port.  This maps
3627 #          to the "mon_host" Ceph option.
3629 # Since: 2.9
3631 { 'struct': 'BlockdevOptionsRbd',
3632   'data': { 'pool': 'str',
3633             '*namespace': 'str',
3634             'image': 'str',
3635             '*conf': 'str',
3636             '*snapshot': 'str',
3637             '*user': 'str',
3638             '*auth-client-required': ['RbdAuthMode'],
3639             '*key-secret': 'str',
3640             '*server': ['InetSocketAddressBase'] } }
3643 # @BlockdevOptionsSheepdog:
3645 # Driver specific block device options for sheepdog
3647 # @vdi: Virtual disk image name
3648 # @server: The Sheepdog server to connect to
3649 # @snap-id: Snapshot ID
3650 # @tag: Snapshot tag name
3652 # Only one of @snap-id and @tag may be present.
3654 # Since: 2.9
3656 { 'struct': 'BlockdevOptionsSheepdog',
3657   'data': { 'server': 'SocketAddress',
3658             'vdi': 'str',
3659             '*snap-id': 'uint32',
3660             '*tag': 'str' } }
3663 # @ReplicationMode:
3665 # An enumeration of replication modes.
3667 # @primary: Primary mode, the vm's state will be sent to secondary QEMU.
3669 # @secondary: Secondary mode, receive the vm's state from primary QEMU.
3671 # Since: 2.9
3673 { 'enum' : 'ReplicationMode', 'data' : [ 'primary', 'secondary' ],
3674   'if': 'defined(CONFIG_REPLICATION)' }
3677 # @BlockdevOptionsReplication:
3679 # Driver specific block device options for replication
3681 # @mode: the replication mode
3683 # @top-id: In secondary mode, node name or device ID of the root
3684 #          node who owns the replication node chain. Must not be given in
3685 #          primary mode.
3687 # Since: 2.9
3689 { 'struct': 'BlockdevOptionsReplication',
3690   'base': 'BlockdevOptionsGenericFormat',
3691   'data': { 'mode': 'ReplicationMode',
3692             '*top-id': 'str' },
3693   'if': 'defined(CONFIG_REPLICATION)' }
3696 # @NFSTransport:
3698 # An enumeration of NFS transport types
3700 # @inet: TCP transport
3702 # Since: 2.9
3704 { 'enum': 'NFSTransport',
3705   'data': [ 'inet' ] }
3708 # @NFSServer:
3710 # Captures the address of the socket
3712 # @type: transport type used for NFS (only TCP supported)
3714 # @host: host address for NFS server
3716 # Since: 2.9
3718 { 'struct': 'NFSServer',
3719   'data': { 'type': 'NFSTransport',
3720             'host': 'str' } }
3723 # @BlockdevOptionsNfs:
3725 # Driver specific block device option for NFS
3727 # @server: host address
3729 # @path: path of the image on the host
3731 # @user: UID value to use when talking to the
3732 #        server (defaults to 65534 on Windows and getuid()
3733 #        on unix)
3735 # @group: GID value to use when talking to the
3736 #         server (defaults to 65534 on Windows and getgid()
3737 #         in unix)
3739 # @tcp-syn-count: number of SYNs during the session
3740 #                 establishment (defaults to libnfs default)
3742 # @readahead-size: set the readahead size in bytes (defaults
3743 #                  to libnfs default)
3745 # @page-cache-size: set the pagecache size in bytes (defaults
3746 #                   to libnfs default)
3748 # @debug: set the NFS debug level (max 2) (defaults
3749 #         to libnfs default)
3751 # Since: 2.9
3753 { 'struct': 'BlockdevOptionsNfs',
3754   'data': { 'server': 'NFSServer',
3755             'path': 'str',
3756             '*user': 'int',
3757             '*group': 'int',
3758             '*tcp-syn-count': 'int',
3759             '*readahead-size': 'int',
3760             '*page-cache-size': 'int',
3761             '*debug': 'int' } }
3764 # @BlockdevOptionsCurlBase:
3766 # Driver specific block device options shared by all protocols supported by the
3767 # curl backend.
3769 # @url: URL of the image file
3771 # @readahead: Size of the read-ahead cache; must be a multiple of
3772 #             512 (defaults to 256 kB)
3774 # @timeout: Timeout for connections, in seconds (defaults to 5)
3776 # @username: Username for authentication (defaults to none)
3778 # @password-secret: ID of a QCryptoSecret object providing a password
3779 #                   for authentication (defaults to no password)
3781 # @proxy-username: Username for proxy authentication (defaults to none)
3783 # @proxy-password-secret: ID of a QCryptoSecret object providing a password
3784 #                         for proxy authentication (defaults to no password)
3786 # Since: 2.9
3788 { 'struct': 'BlockdevOptionsCurlBase',
3789   'data': { 'url': 'str',
3790             '*readahead': 'int',
3791             '*timeout': 'int',
3792             '*username': 'str',
3793             '*password-secret': 'str',
3794             '*proxy-username': 'str',
3795             '*proxy-password-secret': 'str' } }
3798 # @BlockdevOptionsCurlHttp:
3800 # Driver specific block device options for HTTP connections over the curl
3801 # backend.  URLs must start with "http://".
3803 # @cookie: List of cookies to set; format is
3804 #          "name1=content1; name2=content2;" as explained by
3805 #          CURLOPT_COOKIE(3). Defaults to no cookies.
3807 # @cookie-secret: ID of a QCryptoSecret object providing the cookie data in a
3808 #                 secure way. See @cookie for the format. (since 2.10)
3810 # Since: 2.9
3812 { 'struct': 'BlockdevOptionsCurlHttp',
3813   'base': 'BlockdevOptionsCurlBase',
3814   'data': { '*cookie': 'str',
3815             '*cookie-secret': 'str'} }
3818 # @BlockdevOptionsCurlHttps:
3820 # Driver specific block device options for HTTPS connections over the curl
3821 # backend.  URLs must start with "https://".
3823 # @cookie: List of cookies to set; format is
3824 #          "name1=content1; name2=content2;" as explained by
3825 #          CURLOPT_COOKIE(3). Defaults to no cookies.
3827 # @sslverify: Whether to verify the SSL certificate's validity (defaults to
3828 #             true)
3830 # @cookie-secret: ID of a QCryptoSecret object providing the cookie data in a
3831 #                 secure way. See @cookie for the format. (since 2.10)
3833 # Since: 2.9
3835 { 'struct': 'BlockdevOptionsCurlHttps',
3836   'base': 'BlockdevOptionsCurlBase',
3837   'data': { '*cookie': 'str',
3838             '*sslverify': 'bool',
3839             '*cookie-secret': 'str'} }
3842 # @BlockdevOptionsCurlFtp:
3844 # Driver specific block device options for FTP connections over the curl
3845 # backend.  URLs must start with "ftp://".
3847 # Since: 2.9
3849 { 'struct': 'BlockdevOptionsCurlFtp',
3850   'base': 'BlockdevOptionsCurlBase',
3851   'data': { } }
3854 # @BlockdevOptionsCurlFtps:
3856 # Driver specific block device options for FTPS connections over the curl
3857 # backend.  URLs must start with "ftps://".
3859 # @sslverify: Whether to verify the SSL certificate's validity (defaults to
3860 #             true)
3862 # Since: 2.9
3864 { 'struct': 'BlockdevOptionsCurlFtps',
3865   'base': 'BlockdevOptionsCurlBase',
3866   'data': { '*sslverify': 'bool' } }
3869 # @BlockdevOptionsNbd:
3871 # Driver specific block device options for NBD.
3873 # @server: NBD server address
3875 # @export: export name
3877 # @tls-creds: TLS credentials ID
3879 # @x-dirty-bitmap: A "qemu:dirty-bitmap:NAME" string to query in place of
3880 #                  traditional "base:allocation" block status (see
3881 #                  NBD_OPT_LIST_META_CONTEXT in the NBD protocol) (since 3.0)
3883 # @reconnect-delay: On an unexpected disconnect, the nbd client tries to
3884 #                   connect again until succeeding or encountering a serious
3885 #                   error.  During the first @reconnect-delay seconds, all
3886 #                   requests are paused and will be rerun on a successful
3887 #                   reconnect. After that time, any delayed requests and all
3888 #                   future requests before a successful reconnect will
3889 #                   immediately fail. Default 0 (Since 4.2)
3891 # Since: 2.9
3893 { 'struct': 'BlockdevOptionsNbd',
3894   'data': { 'server': 'SocketAddress',
3895             '*export': 'str',
3896             '*tls-creds': 'str',
3897             '*x-dirty-bitmap': 'str',
3898             '*reconnect-delay': 'uint32' } }
3901 # @BlockdevOptionsRaw:
3903 # Driver specific block device options for the raw driver.
3905 # @offset: position where the block device starts
3906 # @size: the assumed size of the device
3908 # Since: 2.9
3910 { 'struct': 'BlockdevOptionsRaw',
3911   'base': 'BlockdevOptionsGenericFormat',
3912   'data': { '*offset': 'int', '*size': 'int' } }
3915 # @BlockdevOptionsThrottle:
3917 # Driver specific block device options for the throttle driver
3919 # @throttle-group: the name of the throttle-group object to use. It
3920 #                  must already exist.
3921 # @file: reference to or definition of the data source block device
3922 # Since: 2.11
3924 { 'struct': 'BlockdevOptionsThrottle',
3925   'data': { 'throttle-group': 'str',
3926             'file' : 'BlockdevRef'
3927              } }
3929 # @BlockdevOptions:
3931 # Options for creating a block device.  Many options are available for all
3932 # block devices, independent of the block driver:
3934 # @driver: block driver name
3935 # @node-name: the node name of the new node (Since 2.0).
3936 #             This option is required on the top level of blockdev-add.
3937 #             Valid node names start with an alphabetic character and may
3938 #             contain only alphanumeric characters, '-', '.' and '_'. Their
3939 #             maximum length is 31 characters.
3940 # @discard: discard-related options (default: ignore)
3941 # @cache: cache-related options
3942 # @read-only: whether the block device should be read-only (default: false).
3943 #             Note that some block drivers support only read-only access,
3944 #             either generally or in certain configurations. In this case,
3945 #             the default value does not work and the option must be
3946 #             specified explicitly.
3947 # @auto-read-only: if true and @read-only is false, QEMU may automatically
3948 #                  decide not to open the image read-write as requested, but
3949 #                  fall back to read-only instead (and switch between the modes
3950 #                  later), e.g. depending on whether the image file is writable
3951 #                  or whether a writing user is attached to the node
3952 #                  (default: false, since 3.1)
3953 # @detect-zeroes: detect and optimize zero writes (Since 2.1)
3954 #                 (default: off)
3955 # @force-share: force share all permission on added nodes.
3956 #               Requires read-only=true. (Since 2.10)
3958 # Remaining options are determined by the block driver.
3960 # Since: 2.9
3962 { 'union': 'BlockdevOptions',
3963   'base': { 'driver': 'BlockdevDriver',
3964             '*node-name': 'str',
3965             '*discard': 'BlockdevDiscardOptions',
3966             '*cache': 'BlockdevCacheOptions',
3967             '*read-only': 'bool',
3968             '*auto-read-only': 'bool',
3969             '*force-share': 'bool',
3970             '*detect-zeroes': 'BlockdevDetectZeroesOptions' },
3971   'discriminator': 'driver',
3972   'data': {
3973       'blkdebug':   'BlockdevOptionsBlkdebug',
3974       'blklogwrites':'BlockdevOptionsBlklogwrites',
3975       'blkverify':  'BlockdevOptionsBlkverify',
3976       'blkreplay':  'BlockdevOptionsBlkreplay',
3977       'bochs':      'BlockdevOptionsGenericFormat',
3978       'cloop':      'BlockdevOptionsGenericFormat',
3979       'compress':   'BlockdevOptionsGenericFormat',
3980       'copy-on-read':'BlockdevOptionsGenericFormat',
3981       'dmg':        'BlockdevOptionsGenericFormat',
3982       'file':       'BlockdevOptionsFile',
3983       'ftp':        'BlockdevOptionsCurlFtp',
3984       'ftps':       'BlockdevOptionsCurlFtps',
3985       'gluster':    'BlockdevOptionsGluster',
3986       'host_cdrom': 'BlockdevOptionsFile',
3987       'host_device':'BlockdevOptionsFile',
3988       'http':       'BlockdevOptionsCurlHttp',
3989       'https':      'BlockdevOptionsCurlHttps',
3990       'iscsi':      'BlockdevOptionsIscsi',
3991       'luks':       'BlockdevOptionsLUKS',
3992       'nbd':        'BlockdevOptionsNbd',
3993       'nfs':        'BlockdevOptionsNfs',
3994       'null-aio':   'BlockdevOptionsNull',
3995       'null-co':    'BlockdevOptionsNull',
3996       'nvme':       'BlockdevOptionsNVMe',
3997       'parallels':  'BlockdevOptionsGenericFormat',
3998       'qcow2':      'BlockdevOptionsQcow2',
3999       'qcow':       'BlockdevOptionsQcow',
4000       'qed':        'BlockdevOptionsGenericCOWFormat',
4001       'quorum':     'BlockdevOptionsQuorum',
4002       'raw':        'BlockdevOptionsRaw',
4003       'rbd':        'BlockdevOptionsRbd',
4004       'replication': { 'type': 'BlockdevOptionsReplication',
4005                        'if': 'defined(CONFIG_REPLICATION)' },
4006       'sheepdog':   'BlockdevOptionsSheepdog',
4007       'ssh':        'BlockdevOptionsSsh',
4008       'throttle':   'BlockdevOptionsThrottle',
4009       'vdi':        'BlockdevOptionsGenericFormat',
4010       'vhdx':       'BlockdevOptionsGenericFormat',
4011       'vmdk':       'BlockdevOptionsGenericCOWFormat',
4012       'vpc':        'BlockdevOptionsGenericFormat',
4013       'vvfat':      'BlockdevOptionsVVFAT'
4014   } }
4017 # @BlockdevRef:
4019 # Reference to a block device.
4021 # @definition: defines a new block device inline
4022 # @reference: references the ID of an existing block device
4024 # Since: 2.9
4026 { 'alternate': 'BlockdevRef',
4027   'data': { 'definition': 'BlockdevOptions',
4028             'reference': 'str' } }
4031 # @BlockdevRefOrNull:
4033 # Reference to a block device.
4035 # @definition: defines a new block device inline
4036 # @reference: references the ID of an existing block device.
4037 #             An empty string means that no block device should
4038 #             be referenced.  Deprecated; use null instead.
4039 # @null: No block device should be referenced (since 2.10)
4041 # Since: 2.9
4043 { 'alternate': 'BlockdevRefOrNull',
4044   'data': { 'definition': 'BlockdevOptions',
4045             'reference': 'str',
4046             'null': 'null' } }
4049 # @blockdev-add:
4051 # Creates a new block device.
4053 # Since: 2.9
4055 # Example:
4057 # 1.
4058 # -> { "execute": "blockdev-add",
4059 #      "arguments": {
4060 #           "driver": "qcow2",
4061 #           "node-name": "test1",
4062 #           "file": {
4063 #               "driver": "file",
4064 #               "filename": "test.qcow2"
4065 #            }
4066 #       }
4067 #     }
4068 # <- { "return": {} }
4070 # 2.
4071 # -> { "execute": "blockdev-add",
4072 #      "arguments": {
4073 #           "driver": "qcow2",
4074 #           "node-name": "node0",
4075 #           "discard": "unmap",
4076 #           "cache": {
4077 #              "direct": true
4078 #            },
4079 #            "file": {
4080 #              "driver": "file",
4081 #              "filename": "/tmp/test.qcow2"
4082 #            },
4083 #            "backing": {
4084 #               "driver": "raw",
4085 #               "file": {
4086 #                  "driver": "file",
4087 #                  "filename": "/dev/fdset/4"
4088 #                }
4089 #            }
4090 #        }
4091 #      }
4093 # <- { "return": {} }
4096 { 'command': 'blockdev-add', 'data': 'BlockdevOptions', 'boxed': true }
4099 # @x-blockdev-reopen:
4101 # Reopens a block device using the given set of options. Any option
4102 # not specified will be reset to its default value regardless of its
4103 # previous status. If an option cannot be changed or a particular
4104 # driver does not support reopening then the command will return an
4105 # error.
4107 # The top-level @node-name option (from BlockdevOptions) must be
4108 # specified and is used to select the block device to be reopened.
4109 # Other @node-name options must be either omitted or set to the
4110 # current name of the appropriate node. This command won't change any
4111 # node name and any attempt to do it will result in an error.
4113 # In the case of options that refer to child nodes, the behavior of
4114 # this command depends on the value:
4116 #  1) A set of options (BlockdevOptions): the child is reopened with
4117 #     the specified set of options.
4119 #  2) A reference to the current child: the child is reopened using
4120 #     its existing set of options.
4122 #  3) A reference to a different node: the current child is replaced
4123 #     with the specified one.
4125 #  4) NULL: the current child (if any) is detached.
4127 # Options (1) and (2) are supported in all cases, but at the moment
4128 # only @backing allows replacing or detaching an existing child.
4130 # Unlike with blockdev-add, the @backing option must always be present
4131 # unless the node being reopened does not have a backing file and its
4132 # image does not have a default backing file name as part of its
4133 # metadata.
4135 # Since: 4.0
4137 { 'command': 'x-blockdev-reopen',
4138   'data': 'BlockdevOptions', 'boxed': true }
4141 # @blockdev-del:
4143 # Deletes a block device that has been added using blockdev-add.
4144 # The command will fail if the node is attached to a device or is
4145 # otherwise being used.
4147 # @node-name: Name of the graph node to delete.
4149 # Since: 2.9
4151 # Example:
4153 # -> { "execute": "blockdev-add",
4154 #      "arguments": {
4155 #           "driver": "qcow2",
4156 #           "node-name": "node0",
4157 #           "file": {
4158 #               "driver": "file",
4159 #               "filename": "test.qcow2"
4160 #           }
4161 #      }
4162 #    }
4163 # <- { "return": {} }
4165 # -> { "execute": "blockdev-del",
4166 #      "arguments": { "node-name": "node0" }
4167 #    }
4168 # <- { "return": {} }
4171 { 'command': 'blockdev-del', 'data': { 'node-name': 'str' } }
4174 # @BlockdevCreateOptionsFile:
4176 # Driver specific image creation options for file.
4178 # @filename: Filename for the new image file
4179 # @size: Size of the virtual disk in bytes
4180 # @preallocation: Preallocation mode for the new image (default: off;
4181 #                 allowed values: off,
4182 #                 falloc (if defined CONFIG_POSIX_FALLOCATE),
4183 #                 full (if defined CONFIG_POSIX))
4184 # @nocow: Turn off copy-on-write (valid only on btrfs; default: off)
4185 # @extent-size-hint: Extent size hint to add to the image file; 0 for not
4186 #                    adding an extent size hint (default: 1 MB, since 5.1)
4188 # Since: 2.12
4190 { 'struct': 'BlockdevCreateOptionsFile',
4191   'data': { 'filename':             'str',
4192             'size':                 'size',
4193             '*preallocation':       'PreallocMode',
4194             '*nocow':               'bool',
4195             '*extent-size-hint':    'size'} }
4198 # @BlockdevCreateOptionsGluster:
4200 # Driver specific image creation options for gluster.
4202 # @location: Where to store the new image file
4203 # @size: Size of the virtual disk in bytes
4204 # @preallocation: Preallocation mode for the new image (default: off;
4205 #                 allowed values: off,
4206 #                 falloc (if defined CONFIG_GLUSTERFS_FALLOCATE),
4207 #                 full (if defined CONFIG_GLUSTERFS_ZEROFILL))
4209 # Since: 2.12
4211 { 'struct': 'BlockdevCreateOptionsGluster',
4212   'data': { 'location':         'BlockdevOptionsGluster',
4213             'size':             'size',
4214             '*preallocation':   'PreallocMode' } }
4217 # @BlockdevCreateOptionsLUKS:
4219 # Driver specific image creation options for LUKS.
4221 # @file: Node to create the image format on
4222 # @size: Size of the virtual disk in bytes
4223 # @preallocation: Preallocation mode for the new image
4224 #                 (since: 4.2)
4225 #                 (default: off; allowed values: off, metadata, falloc, full)
4227 # Since: 2.12
4229 { 'struct': 'BlockdevCreateOptionsLUKS',
4230   'base': 'QCryptoBlockCreateOptionsLUKS',
4231   'data': { 'file':             'BlockdevRef',
4232             'size':             'size',
4233             '*preallocation':   'PreallocMode' } }
4236 # @BlockdevCreateOptionsNfs:
4238 # Driver specific image creation options for NFS.
4240 # @location: Where to store the new image file
4241 # @size: Size of the virtual disk in bytes
4243 # Since: 2.12
4245 { 'struct': 'BlockdevCreateOptionsNfs',
4246   'data': { 'location':         'BlockdevOptionsNfs',
4247             'size':             'size' } }
4250 # @BlockdevCreateOptionsParallels:
4252 # Driver specific image creation options for parallels.
4254 # @file: Node to create the image format on
4255 # @size: Size of the virtual disk in bytes
4256 # @cluster-size: Cluster size in bytes (default: 1 MB)
4258 # Since: 2.12
4260 { 'struct': 'BlockdevCreateOptionsParallels',
4261   'data': { 'file':             'BlockdevRef',
4262             'size':             'size',
4263             '*cluster-size':    'size' } }
4266 # @BlockdevCreateOptionsQcow:
4268 # Driver specific image creation options for qcow.
4270 # @file: Node to create the image format on
4271 # @size: Size of the virtual disk in bytes
4272 # @backing-file: File name of the backing file if a backing file
4273 #                should be used
4274 # @encrypt: Encryption options if the image should be encrypted
4276 # Since: 2.12
4278 { 'struct': 'BlockdevCreateOptionsQcow',
4279   'data': { 'file':             'BlockdevRef',
4280             'size':             'size',
4281             '*backing-file':    'str',
4282             '*encrypt':         'QCryptoBlockCreateOptions' } }
4285 # @BlockdevQcow2Version:
4287 # @v2:  The original QCOW2 format as introduced in qemu 0.10 (version 2)
4288 # @v3:  The extended QCOW2 format as introduced in qemu 1.1 (version 3)
4290 # Since: 2.12
4292 { 'enum': 'BlockdevQcow2Version',
4293   'data': [ 'v2', 'v3' ] }
4297 # @Qcow2CompressionType:
4299 # Compression type used in qcow2 image file
4301 # @zlib: zlib compression, see <http://zlib.net/>
4302 # @zstd: zstd compression, see <http://github.com/facebook/zstd>
4304 # Since: 5.1
4306 { 'enum': 'Qcow2CompressionType',
4307   'data': [ 'zlib', { 'name': 'zstd', 'if': 'defined(CONFIG_ZSTD)' } ] }
4310 # @BlockdevCreateOptionsQcow2:
4312 # Driver specific image creation options for qcow2.
4314 # @file: Node to create the image format on
4315 # @data-file: Node to use as an external data file in which all guest
4316 #             data is stored so that only metadata remains in the qcow2
4317 #             file (since: 4.0)
4318 # @data-file-raw: True if the external data file must stay valid as a
4319 #                 standalone (read-only) raw image without looking at qcow2
4320 #                 metadata (default: false; since: 4.0)
4321 # @extended-l2: True to make the image have extended L2 entries
4322 #               (default: false; since 5.2)
4323 # @size: Size of the virtual disk in bytes
4324 # @version: Compatibility level (default: v3)
4325 # @backing-file: File name of the backing file if a backing file
4326 #                should be used
4327 # @backing-fmt: Name of the block driver to use for the backing file
4328 # @encrypt: Encryption options if the image should be encrypted
4329 # @cluster-size: qcow2 cluster size in bytes (default: 65536)
4330 # @preallocation: Preallocation mode for the new image (default: off;
4331 #                 allowed values: off, falloc, full, metadata)
4332 # @lazy-refcounts: True if refcounts may be updated lazily (default: off)
4333 # @refcount-bits: Width of reference counts in bits (default: 16)
4334 # @compression-type: The image cluster compression method
4335 #                    (default: zlib, since 5.1)
4337 # Since: 2.12
4339 { 'struct': 'BlockdevCreateOptionsQcow2',
4340   'data': { 'file':             'BlockdevRef',
4341             '*data-file':       'BlockdevRef',
4342             '*data-file-raw':   'bool',
4343             '*extended-l2':     'bool',
4344             'size':             'size',
4345             '*version':         'BlockdevQcow2Version',
4346             '*backing-file':    'str',
4347             '*backing-fmt':     'BlockdevDriver',
4348             '*encrypt':         'QCryptoBlockCreateOptions',
4349             '*cluster-size':    'size',
4350             '*preallocation':   'PreallocMode',
4351             '*lazy-refcounts':  'bool',
4352             '*refcount-bits':   'int',
4353             '*compression-type':'Qcow2CompressionType' } }
4356 # @BlockdevCreateOptionsQed:
4358 # Driver specific image creation options for qed.
4360 # @file: Node to create the image format on
4361 # @size: Size of the virtual disk in bytes
4362 # @backing-file: File name of the backing file if a backing file
4363 #                should be used
4364 # @backing-fmt: Name of the block driver to use for the backing file
4365 # @cluster-size: Cluster size in bytes (default: 65536)
4366 # @table-size: L1/L2 table size (in clusters)
4368 # Since: 2.12
4370 { 'struct': 'BlockdevCreateOptionsQed',
4371   'data': { 'file':             'BlockdevRef',
4372             'size':             'size',
4373             '*backing-file':    'str',
4374             '*backing-fmt':     'BlockdevDriver',
4375             '*cluster-size':    'size',
4376             '*table-size':      'int' } }
4379 # @BlockdevCreateOptionsRbd:
4381 # Driver specific image creation options for rbd/Ceph.
4383 # @location: Where to store the new image file. This location cannot
4384 #            point to a snapshot.
4385 # @size: Size of the virtual disk in bytes
4386 # @cluster-size: RBD object size
4388 # Since: 2.12
4390 { 'struct': 'BlockdevCreateOptionsRbd',
4391   'data': { 'location':         'BlockdevOptionsRbd',
4392             'size':             'size',
4393             '*cluster-size' :   'size' } }
4396 # @BlockdevVmdkSubformat:
4398 # Subformat options for VMDK images
4400 # @monolithicSparse:     Single file image with sparse cluster allocation
4402 # @monolithicFlat:       Single flat data image and a descriptor file
4404 # @twoGbMaxExtentSparse: Data is split into 2GB (per virtual LBA) sparse extent
4405 #                        files, in addition to a descriptor file
4407 # @twoGbMaxExtentFlat:   Data is split into 2GB (per virtual LBA) flat extent
4408 #                        files, in addition to a descriptor file
4410 # @streamOptimized:      Single file image sparse cluster allocation, optimized
4411 #                        for streaming over network.
4413 # Since: 4.0
4415 { 'enum': 'BlockdevVmdkSubformat',
4416   'data': [ 'monolithicSparse', 'monolithicFlat', 'twoGbMaxExtentSparse',
4417             'twoGbMaxExtentFlat', 'streamOptimized'] }
4420 # @BlockdevVmdkAdapterType:
4422 # Adapter type info for VMDK images
4424 # Since: 4.0
4426 { 'enum': 'BlockdevVmdkAdapterType',
4427   'data': [ 'ide', 'buslogic', 'lsilogic', 'legacyESX'] }
4430 # @BlockdevCreateOptionsVmdk:
4432 # Driver specific image creation options for VMDK.
4434 # @file: Where to store the new image file. This refers to the image
4435 #        file for monolithcSparse and streamOptimized format, or the
4436 #        descriptor file for other formats.
4437 # @size: Size of the virtual disk in bytes
4438 # @extents: Where to store the data extents. Required for monolithcFlat,
4439 #           twoGbMaxExtentSparse and twoGbMaxExtentFlat formats. For
4440 #           monolithicFlat, only one entry is required; for
4441 #           twoGbMaxExtent* formats, the number of entries required is
4442 #           calculated as extent_number = virtual_size / 2GB. Providing
4443 #           more extents than will be used is an error.
4444 # @subformat: The subformat of the VMDK image. Default: "monolithicSparse".
4445 # @backing-file: The path of backing file. Default: no backing file is used.
4446 # @adapter-type: The adapter type used to fill in the descriptor. Default: ide.
4447 # @hwversion: Hardware version. The meaningful options are "4" or "6".
4448 #             Default: "4".
4449 # @zeroed-grain: Whether to enable zeroed-grain feature for sparse subformats.
4450 #                Default: false.
4452 # Since: 4.0
4454 { 'struct': 'BlockdevCreateOptionsVmdk',
4455   'data': { 'file':             'BlockdevRef',
4456             'size':             'size',
4457             '*extents':          ['BlockdevRef'],
4458             '*subformat':       'BlockdevVmdkSubformat',
4459             '*backing-file':    'str',
4460             '*adapter-type':    'BlockdevVmdkAdapterType',
4461             '*hwversion':       'str',
4462             '*zeroed-grain':    'bool' } }
4466 # @SheepdogRedundancyType:
4468 # @full: Create a fully replicated vdi with x copies
4469 # @erasure-coded: Create an erasure coded vdi with x data strips and
4470 #                 y parity strips
4472 # Since: 2.12
4474 { 'enum': 'SheepdogRedundancyType',
4475   'data': [ 'full', 'erasure-coded' ] }
4478 # @SheepdogRedundancyFull:
4480 # @copies: Number of copies to use (between 1 and 31)
4482 # Since: 2.12
4484 { 'struct': 'SheepdogRedundancyFull',
4485   'data': { 'copies': 'int' }}
4488 # @SheepdogRedundancyErasureCoded:
4490 # @data-strips: Number of data strips to use (one of {2,4,8,16})
4491 # @parity-strips: Number of parity strips to use (between 1 and 15)
4493 # Since: 2.12
4495 { 'struct': 'SheepdogRedundancyErasureCoded',
4496   'data': { 'data-strips': 'int',
4497             'parity-strips': 'int' }}
4500 # @SheepdogRedundancy:
4502 # Since: 2.12
4504 { 'union': 'SheepdogRedundancy',
4505   'base': { 'type': 'SheepdogRedundancyType' },
4506   'discriminator': 'type',
4507   'data': { 'full': 'SheepdogRedundancyFull',
4508             'erasure-coded': 'SheepdogRedundancyErasureCoded' } }
4511 # @BlockdevCreateOptionsSheepdog:
4513 # Driver specific image creation options for Sheepdog.
4515 # @location: Where to store the new image file
4516 # @size: Size of the virtual disk in bytes
4517 # @backing-file: File name of a base image
4518 # @preallocation: Preallocation mode for the new image (default: off;
4519 #                 allowed values: off, full)
4520 # @redundancy: Redundancy of the image
4521 # @object-size: Object size of the image
4523 # Since: 2.12
4525 { 'struct': 'BlockdevCreateOptionsSheepdog',
4526   'data': { 'location':         'BlockdevOptionsSheepdog',
4527             'size':             'size',
4528             '*backing-file':    'str',
4529             '*preallocation':   'PreallocMode',
4530             '*redundancy':      'SheepdogRedundancy',
4531             '*object-size':     'size' } }
4534 # @BlockdevCreateOptionsSsh:
4536 # Driver specific image creation options for SSH.
4538 # @location: Where to store the new image file
4539 # @size: Size of the virtual disk in bytes
4541 # Since: 2.12
4543 { 'struct': 'BlockdevCreateOptionsSsh',
4544   'data': { 'location':         'BlockdevOptionsSsh',
4545             'size':             'size' } }
4548 # @BlockdevCreateOptionsVdi:
4550 # Driver specific image creation options for VDI.
4552 # @file: Node to create the image format on
4553 # @size: Size of the virtual disk in bytes
4554 # @preallocation: Preallocation mode for the new image (default: off;
4555 #                 allowed values: off, metadata)
4557 # Since: 2.12
4559 { 'struct': 'BlockdevCreateOptionsVdi',
4560   'data': { 'file':             'BlockdevRef',
4561             'size':             'size',
4562             '*preallocation':   'PreallocMode' } }
4565 # @BlockdevVhdxSubformat:
4567 # @dynamic: Growing image file
4568 # @fixed:   Preallocated fixed-size image file
4570 # Since: 2.12
4572 { 'enum': 'BlockdevVhdxSubformat',
4573   'data': [ 'dynamic', 'fixed' ] }
4576 # @BlockdevCreateOptionsVhdx:
4578 # Driver specific image creation options for vhdx.
4580 # @file: Node to create the image format on
4581 # @size: Size of the virtual disk in bytes
4582 # @log-size: Log size in bytes, must be a multiple of 1 MB
4583 #            (default: 1 MB)
4584 # @block-size: Block size in bytes, must be a multiple of 1 MB and not
4585 #              larger than 256 MB (default: automatically choose a block
4586 #              size depending on the image size)
4587 # @subformat: vhdx subformat (default: dynamic)
4588 # @block-state-zero: Force use of payload blocks of type 'ZERO'. Non-standard,
4589 #                    but default.  Do not set to 'off' when using 'qemu-img
4590 #                    convert' with subformat=dynamic.
4592 # Since: 2.12
4594 { 'struct': 'BlockdevCreateOptionsVhdx',
4595   'data': { 'file':                 'BlockdevRef',
4596             'size':                 'size',
4597             '*log-size':            'size',
4598             '*block-size':          'size',
4599             '*subformat':           'BlockdevVhdxSubformat',
4600             '*block-state-zero':    'bool' } }
4603 # @BlockdevVpcSubformat:
4605 # @dynamic: Growing image file
4606 # @fixed:   Preallocated fixed-size image file
4608 # Since: 2.12
4610 { 'enum': 'BlockdevVpcSubformat',
4611   'data': [ 'dynamic', 'fixed' ] }
4614 # @BlockdevCreateOptionsVpc:
4616 # Driver specific image creation options for vpc (VHD).
4618 # @file: Node to create the image format on
4619 # @size: Size of the virtual disk in bytes
4620 # @subformat: vhdx subformat (default: dynamic)
4621 # @force-size: Force use of the exact byte size instead of rounding to the
4622 #              next size that can be represented in CHS geometry
4623 #              (default: false)
4625 # Since: 2.12
4627 { 'struct': 'BlockdevCreateOptionsVpc',
4628   'data': { 'file':                 'BlockdevRef',
4629             'size':                 'size',
4630             '*subformat':           'BlockdevVpcSubformat',
4631             '*force-size':          'bool' } }
4634 # @BlockdevCreateOptions:
4636 # Options for creating an image format on a given node.
4638 # @driver: block driver to create the image format
4640 # Since: 2.12
4642 { 'union': 'BlockdevCreateOptions',
4643   'base': {
4644       'driver':         'BlockdevDriver' },
4645   'discriminator': 'driver',
4646   'data': {
4647       'file':           'BlockdevCreateOptionsFile',
4648       'gluster':        'BlockdevCreateOptionsGluster',
4649       'luks':           'BlockdevCreateOptionsLUKS',
4650       'nfs':            'BlockdevCreateOptionsNfs',
4651       'parallels':      'BlockdevCreateOptionsParallels',
4652       'qcow':           'BlockdevCreateOptionsQcow',
4653       'qcow2':          'BlockdevCreateOptionsQcow2',
4654       'qed':            'BlockdevCreateOptionsQed',
4655       'rbd':            'BlockdevCreateOptionsRbd',
4656       'sheepdog':       'BlockdevCreateOptionsSheepdog',
4657       'ssh':            'BlockdevCreateOptionsSsh',
4658       'vdi':            'BlockdevCreateOptionsVdi',
4659       'vhdx':           'BlockdevCreateOptionsVhdx',
4660       'vmdk':           'BlockdevCreateOptionsVmdk',
4661       'vpc':            'BlockdevCreateOptionsVpc'
4662   } }
4665 # @blockdev-create:
4667 # Starts a job to create an image format on a given node. The job is
4668 # automatically finalized, but a manual job-dismiss is required.
4670 # @job-id:          Identifier for the newly created job.
4672 # @options:         Options for the image creation.
4674 # Since: 3.0
4676 { 'command': 'blockdev-create',
4677   'data': { 'job-id': 'str',
4678             'options': 'BlockdevCreateOptions' } }
4681 # @BlockdevAmendOptionsLUKS:
4683 # Driver specific image amend options for LUKS.
4685 # Since: 5.1
4687 { 'struct': 'BlockdevAmendOptionsLUKS',
4688   'base': 'QCryptoBlockAmendOptionsLUKS',
4689   'data': { }
4693 # @BlockdevAmendOptionsQcow2:
4695 # Driver specific image amend options for qcow2.
4696 # For now, only encryption options can be amended
4698 # @encrypt          Encryption options to be amended
4700 # Since: 5.1
4702 { 'struct': 'BlockdevAmendOptionsQcow2',
4703   'data': { '*encrypt':         'QCryptoBlockAmendOptions' } }
4706 # @BlockdevAmendOptions:
4708 # Options for amending an image format
4710 # @driver:          Block driver of the node to amend.
4712 # Since: 5.1
4714 { 'union': 'BlockdevAmendOptions',
4715   'base': {
4716       'driver':         'BlockdevDriver' },
4717   'discriminator': 'driver',
4718   'data': {
4719       'luks':           'BlockdevAmendOptionsLUKS',
4720       'qcow2':          'BlockdevAmendOptionsQcow2' } }
4723 # @x-blockdev-amend:
4725 # Starts a job to amend format specific options of an existing open block device
4726 # The job is automatically finalized, but a manual job-dismiss is required.
4728 # @job-id:          Identifier for the newly created job.
4730 # @node-name:       Name of the block node to work on
4732 # @options:         Options (driver specific)
4734 # @force:           Allow unsafe operations, format specific
4735 #                   For luks that allows erase of the last active keyslot
4736 #                   (permanent loss of data),
4737 #                   and replacement of an active keyslot
4738 #                   (possible loss of data if IO error happens)
4740 # Since: 5.1
4742 { 'command': 'x-blockdev-amend',
4743   'data': { 'job-id': 'str',
4744             'node-name': 'str',
4745             'options': 'BlockdevAmendOptions',
4746             '*force': 'bool' } }
4749 # @BlockErrorAction:
4751 # An enumeration of action that has been taken when a DISK I/O occurs
4753 # @ignore: error has been ignored
4755 # @report: error has been reported to the device
4757 # @stop: error caused VM to be stopped
4759 # Since: 2.1
4761 { 'enum': 'BlockErrorAction',
4762   'data': [ 'ignore', 'report', 'stop' ] }
4766 # @BLOCK_IMAGE_CORRUPTED:
4768 # Emitted when a disk image is being marked corrupt. The image can be
4769 # identified by its device or node name. The 'device' field is always
4770 # present for compatibility reasons, but it can be empty ("") if the
4771 # image does not have a device name associated.
4773 # @device: device name. This is always present for compatibility
4774 #          reasons, but it can be empty ("") if the image does not
4775 #          have a device name associated.
4777 # @node-name: node name (Since: 2.4)
4779 # @msg: informative message for human consumption, such as the kind of
4780 #       corruption being detected. It should not be parsed by machine as it is
4781 #       not guaranteed to be stable
4783 # @offset: if the corruption resulted from an image access, this is
4784 #          the host's access offset into the image
4786 # @size: if the corruption resulted from an image access, this is
4787 #        the access size
4789 # @fatal: if set, the image is marked corrupt and therefore unusable after this
4790 #         event and must be repaired (Since 2.2; before, every
4791 #         BLOCK_IMAGE_CORRUPTED event was fatal)
4793 # Note: If action is "stop", a STOP event will eventually follow the
4794 #       BLOCK_IO_ERROR event.
4796 # Example:
4798 # <- { "event": "BLOCK_IMAGE_CORRUPTED",
4799 #      "data": { "device": "ide0-hd0", "node-name": "node0",
4800 #                "msg": "Prevented active L1 table overwrite", "offset": 196608,
4801 #                "size": 65536 },
4802 #      "timestamp": { "seconds": 1378126126, "microseconds": 966463 } }
4804 # Since: 1.7
4806 { 'event': 'BLOCK_IMAGE_CORRUPTED',
4807   'data': { 'device'     : 'str',
4808             '*node-name' : 'str',
4809             'msg'        : 'str',
4810             '*offset'    : 'int',
4811             '*size'      : 'int',
4812             'fatal'      : 'bool' } }
4815 # @BLOCK_IO_ERROR:
4817 # Emitted when a disk I/O error occurs
4819 # @device: device name. This is always present for compatibility
4820 #          reasons, but it can be empty ("") if the image does not
4821 #          have a device name associated.
4823 # @node-name: node name. Note that errors may be reported for the root node
4824 #             that is directly attached to a guest device rather than for the
4825 #             node where the error occurred. The node name is not present if
4826 #             the drive is empty. (Since: 2.8)
4828 # @operation: I/O operation
4830 # @action: action that has been taken
4832 # @nospace: true if I/O error was caused due to a no-space
4833 #           condition. This key is only present if query-block's
4834 #           io-status is present, please see query-block documentation
4835 #           for more information (since: 2.2)
4837 # @reason: human readable string describing the error cause.
4838 #          (This field is a debugging aid for humans, it should not
4839 #          be parsed by applications) (since: 2.2)
4841 # Note: If action is "stop", a STOP event will eventually follow the
4842 #       BLOCK_IO_ERROR event
4844 # Since: 0.13.0
4846 # Example:
4848 # <- { "event": "BLOCK_IO_ERROR",
4849 #      "data": { "device": "ide0-hd1",
4850 #                "node-name": "#block212",
4851 #                "operation": "write",
4852 #                "action": "stop" },
4853 #      "timestamp": { "seconds": 1265044230, "microseconds": 450486 } }
4856 { 'event': 'BLOCK_IO_ERROR',
4857   'data': { 'device': 'str', '*node-name': 'str',
4858             'operation': 'IoOperationType',
4859             'action': 'BlockErrorAction', '*nospace': 'bool',
4860             'reason': 'str' } }
4863 # @BLOCK_JOB_COMPLETED:
4865 # Emitted when a block job has completed
4867 # @type: job type
4869 # @device: The job identifier. Originally the device name but other
4870 #          values are allowed since QEMU 2.7
4872 # @len: maximum progress value
4874 # @offset: current progress value. On success this is equal to len.
4875 #          On failure this is less than len
4877 # @speed: rate limit, bytes per second
4879 # @error: error message. Only present on failure. This field
4880 #         contains a human-readable error message. There are no semantics
4881 #         other than that streaming has failed and clients should not try to
4882 #         interpret the error string
4884 # Since: 1.1
4886 # Example:
4888 # <- { "event": "BLOCK_JOB_COMPLETED",
4889 #      "data": { "type": "stream", "device": "virtio-disk0",
4890 #                "len": 10737418240, "offset": 10737418240,
4891 #                "speed": 0 },
4892 #      "timestamp": { "seconds": 1267061043, "microseconds": 959568 } }
4895 { 'event': 'BLOCK_JOB_COMPLETED',
4896   'data': { 'type'  : 'JobType',
4897             'device': 'str',
4898             'len'   : 'int',
4899             'offset': 'int',
4900             'speed' : 'int',
4901             '*error': 'str' } }
4904 # @BLOCK_JOB_CANCELLED:
4906 # Emitted when a block job has been cancelled
4908 # @type: job type
4910 # @device: The job identifier. Originally the device name but other
4911 #          values are allowed since QEMU 2.7
4913 # @len: maximum progress value
4915 # @offset: current progress value. On success this is equal to len.
4916 #          On failure this is less than len
4918 # @speed: rate limit, bytes per second
4920 # Since: 1.1
4922 # Example:
4924 # <- { "event": "BLOCK_JOB_CANCELLED",
4925 #      "data": { "type": "stream", "device": "virtio-disk0",
4926 #                "len": 10737418240, "offset": 134217728,
4927 #                "speed": 0 },
4928 #      "timestamp": { "seconds": 1267061043, "microseconds": 959568 } }
4931 { 'event': 'BLOCK_JOB_CANCELLED',
4932   'data': { 'type'  : 'JobType',
4933             'device': 'str',
4934             'len'   : 'int',
4935             'offset': 'int',
4936             'speed' : 'int' } }
4939 # @BLOCK_JOB_ERROR:
4941 # Emitted when a block job encounters an error
4943 # @device: The job identifier. Originally the device name but other
4944 #          values are allowed since QEMU 2.7
4946 # @operation: I/O operation
4948 # @action: action that has been taken
4950 # Since: 1.3
4952 # Example:
4954 # <- { "event": "BLOCK_JOB_ERROR",
4955 #      "data": { "device": "ide0-hd1",
4956 #                "operation": "write",
4957 #                "action": "stop" },
4958 #      "timestamp": { "seconds": 1265044230, "microseconds": 450486 } }
4961 { 'event': 'BLOCK_JOB_ERROR',
4962   'data': { 'device'   : 'str',
4963             'operation': 'IoOperationType',
4964             'action'   : 'BlockErrorAction' } }
4967 # @BLOCK_JOB_READY:
4969 # Emitted when a block job is ready to complete
4971 # @type: job type
4973 # @device: The job identifier. Originally the device name but other
4974 #          values are allowed since QEMU 2.7
4976 # @len: maximum progress value
4978 # @offset: current progress value. On success this is equal to len.
4979 #          On failure this is less than len
4981 # @speed: rate limit, bytes per second
4983 # Note: The "ready to complete" status is always reset by a @BLOCK_JOB_ERROR
4984 #       event
4986 # Since: 1.3
4988 # Example:
4990 # <- { "event": "BLOCK_JOB_READY",
4991 #      "data": { "device": "drive0", "type": "mirror", "speed": 0,
4992 #                "len": 2097152, "offset": 2097152 }
4993 #      "timestamp": { "seconds": 1265044230, "microseconds": 450486 } }
4996 { 'event': 'BLOCK_JOB_READY',
4997   'data': { 'type'  : 'JobType',
4998             'device': 'str',
4999             'len'   : 'int',
5000             'offset': 'int',
5001             'speed' : 'int' } }
5004 # @BLOCK_JOB_PENDING:
5006 # Emitted when a block job is awaiting explicit authorization to finalize graph
5007 # changes via @block-job-finalize. If this job is part of a transaction, it will
5008 # not emit this event until the transaction has converged first.
5010 # @type: job type
5012 # @id: The job identifier.
5014 # Since: 2.12
5016 # Example:
5018 # <- { "event": "BLOCK_JOB_WAITING",
5019 #      "data": { "device": "drive0", "type": "mirror" },
5020 #      "timestamp": { "seconds": 1265044230, "microseconds": 450486 } }
5023 { 'event': 'BLOCK_JOB_PENDING',
5024   'data': { 'type'  : 'JobType',
5025             'id'    : 'str' } }
5028 # @PreallocMode:
5030 # Preallocation mode of QEMU image file
5032 # @off: no preallocation
5033 # @metadata: preallocate only for metadata
5034 # @falloc: like @full preallocation but allocate disk space by
5035 #          posix_fallocate() rather than writing data.
5036 # @full: preallocate all data by writing it to the device to ensure
5037 #        disk space is really available. This data may or may not be
5038 #        zero, depending on the image format and storage.
5039 #        @full preallocation also sets up metadata correctly.
5041 # Since: 2.2
5043 { 'enum': 'PreallocMode',
5044   'data': [ 'off', 'metadata', 'falloc', 'full' ] }
5047 # @BLOCK_WRITE_THRESHOLD:
5049 # Emitted when writes on block device reaches or exceeds the
5050 # configured write threshold. For thin-provisioned devices, this
5051 # means the device should be extended to avoid pausing for
5052 # disk exhaustion.
5053 # The event is one shot. Once triggered, it needs to be
5054 # re-registered with another block-set-write-threshold command.
5056 # @node-name: graph node name on which the threshold was exceeded.
5058 # @amount-exceeded: amount of data which exceeded the threshold, in bytes.
5060 # @write-threshold: last configured threshold, in bytes.
5062 # Since: 2.3
5064 { 'event': 'BLOCK_WRITE_THRESHOLD',
5065   'data': { 'node-name': 'str',
5066             'amount-exceeded': 'uint64',
5067             'write-threshold': 'uint64' } }
5070 # @block-set-write-threshold:
5072 # Change the write threshold for a block drive. An event will be
5073 # delivered if a write to this block drive crosses the configured
5074 # threshold.  The threshold is an offset, thus must be
5075 # non-negative. Default is no write threshold. Setting the threshold
5076 # to zero disables it.
5078 # This is useful to transparently resize thin-provisioned drives without
5079 # the guest OS noticing.
5081 # @node-name: graph node name on which the threshold must be set.
5083 # @write-threshold: configured threshold for the block device, bytes.
5084 #                   Use 0 to disable the threshold.
5086 # Since: 2.3
5088 # Example:
5090 # -> { "execute": "block-set-write-threshold",
5091 #      "arguments": { "node-name": "mydev",
5092 #                     "write-threshold": 17179869184 } }
5093 # <- { "return": {} }
5096 { 'command': 'block-set-write-threshold',
5097   'data': { 'node-name': 'str', 'write-threshold': 'uint64' } }
5100 # @x-blockdev-change:
5102 # Dynamically reconfigure the block driver state graph. It can be used
5103 # to add, remove, insert or replace a graph node. Currently only the
5104 # Quorum driver implements this feature to add or remove its child. This
5105 # is useful to fix a broken quorum child.
5107 # If @node is specified, it will be inserted under @parent. @child
5108 # may not be specified in this case. If both @parent and @child are
5109 # specified but @node is not, @child will be detached from @parent.
5111 # @parent: the id or name of the parent node.
5113 # @child: the name of a child under the given parent node.
5115 # @node: the name of the node that will be added.
5117 # Note: this command is experimental, and its API is not stable. It
5118 #       does not support all kinds of operations, all kinds of children, nor
5119 #       all block drivers.
5121 #       FIXME Removing children from a quorum node means introducing gaps in the
5122 #       child indices. This cannot be represented in the 'children' list of
5123 #       BlockdevOptionsQuorum, as returned by .bdrv_refresh_filename().
5125 #       Warning: The data in a new quorum child MUST be consistent with that of
5126 #       the rest of the array.
5128 # Since: 2.7
5130 # Example:
5132 # 1. Add a new node to a quorum
5133 # -> { "execute": "blockdev-add",
5134 #      "arguments": {
5135 #          "driver": "raw",
5136 #          "node-name": "new_node",
5137 #          "file": { "driver": "file",
5138 #                    "filename": "test.raw" } } }
5139 # <- { "return": {} }
5140 # -> { "execute": "x-blockdev-change",
5141 #      "arguments": { "parent": "disk1",
5142 #                     "node": "new_node" } }
5143 # <- { "return": {} }
5145 # 2. Delete a quorum's node
5146 # -> { "execute": "x-blockdev-change",
5147 #      "arguments": { "parent": "disk1",
5148 #                     "child": "children.1" } }
5149 # <- { "return": {} }
5152 { 'command': 'x-blockdev-change',
5153   'data' : { 'parent': 'str',
5154              '*child': 'str',
5155              '*node': 'str' } }
5158 # @x-blockdev-set-iothread:
5160 # Move @node and its children into the @iothread.  If @iothread is null then
5161 # move @node and its children into the main loop.
5163 # The node must not be attached to a BlockBackend.
5165 # @node-name: the name of the block driver node
5167 # @iothread: the name of the IOThread object or null for the main loop
5169 # @force: true if the node and its children should be moved when a BlockBackend
5170 #         is already attached
5172 # Note: this command is experimental and intended for test cases that need
5173 #       control over IOThreads only.
5175 # Since: 2.12
5177 # Example:
5179 # 1. Move a node into an IOThread
5180 # -> { "execute": "x-blockdev-set-iothread",
5181 #      "arguments": { "node-name": "disk1",
5182 #                     "iothread": "iothread0" } }
5183 # <- { "return": {} }
5185 # 2. Move a node into the main loop
5186 # -> { "execute": "x-blockdev-set-iothread",
5187 #      "arguments": { "node-name": "disk1",
5188 #                     "iothread": null } }
5189 # <- { "return": {} }
5192 { 'command': 'x-blockdev-set-iothread',
5193   'data' : { 'node-name': 'str',
5194              'iothread': 'StrOrNull',
5195              '*force': 'bool' } }
5198 # @NbdServerOptions:
5200 # @addr: Address on which to listen.
5201 # @tls-creds: ID of the TLS credentials object (since 2.6).
5202 # @tls-authz: ID of the QAuthZ authorization object used to validate
5203 #             the client's x509 distinguished name. This object is
5204 #             is only resolved at time of use, so can be deleted and
5205 #             recreated on the fly while the NBD server is active.
5206 #             If missing, it will default to denying access (since 4.0).
5208 # Keep this type consistent with the nbd-server-start arguments. The only
5209 # intended difference is using SocketAddress instead of SocketAddressLegacy.
5211 # Since: 4.2
5213 { 'struct': 'NbdServerOptions',
5214   'data': { 'addr': 'SocketAddress',
5215             '*tls-creds': 'str',
5216             '*tls-authz': 'str'} }
5219 # @nbd-server-start:
5221 # Start an NBD server listening on the given host and port.  Block
5222 # devices can then be exported using @nbd-server-add.  The NBD
5223 # server will present them as named exports; for example, another
5224 # QEMU instance could refer to them as "nbd:HOST:PORT:exportname=NAME".
5226 # Keep this type consistent with the NbdServerOptions type. The only intended
5227 # difference is using SocketAddressLegacy instead of SocketAddress.
5229 # @addr: Address on which to listen.
5230 # @tls-creds: ID of the TLS credentials object (since 2.6).
5231 # @tls-authz: ID of the QAuthZ authorization object used to validate
5232 #             the client's x509 distinguished name. This object is
5233 #             is only resolved at time of use, so can be deleted and
5234 #             recreated on the fly while the NBD server is active.
5235 #             If missing, it will default to denying access (since 4.0).
5237 # Returns: error if the server is already running.
5239 # Since: 1.3.0
5241 { 'command': 'nbd-server-start',
5242   'data': { 'addr': 'SocketAddressLegacy',
5243             '*tls-creds': 'str',
5244             '*tls-authz': 'str'} }
5247 # @BlockExportNbd:
5249 # An NBD block export.
5251 # @device: The device name or node name of the node to be exported
5253 # @name: Export name. If unspecified, the @device parameter is used as the
5254 #        export name. (Since 2.12)
5256 # @description: Free-form description of the export, up to 4096 bytes.
5257 #               (Since 5.0)
5259 # @writable: Whether clients should be able to write to the device via the
5260 #            NBD connection (default false).
5262 # @bitmap: Also export the dirty bitmap reachable from @device, so the
5263 #          NBD client can use NBD_OPT_SET_META_CONTEXT with
5264 #          "qemu:dirty-bitmap:NAME" to inspect the bitmap. (since 4.0)
5266 # Since: 5.0
5268 { 'struct': 'BlockExportNbd',
5269   'data': {'device': 'str', '*name': 'str', '*description': 'str',
5270            '*writable': 'bool', '*bitmap': 'str' } }
5273 # @nbd-server-add:
5275 # Export a block node to QEMU's embedded NBD server.
5277 # Returns: error if the server is not running, or export with the same name
5278 #          already exists.
5280 # Since: 1.3.0
5282 { 'command': 'nbd-server-add',
5283   'data': 'BlockExportNbd', 'boxed': true }
5286 # @NbdServerRemoveMode:
5288 # Mode for removing an NBD export.
5290 # @safe: Remove export if there are no existing connections, fail otherwise.
5292 # @hard: Drop all connections immediately and remove export.
5294 # Potential additional modes to be added in the future:
5296 # hide: Just hide export from new clients, leave existing connections as is.
5297 # Remove export after all clients are disconnected.
5299 # soft: Hide export from new clients, answer with ESHUTDOWN for all further
5300 # requests from existing clients.
5302 # Since: 2.12
5304 {'enum': 'NbdServerRemoveMode', 'data': ['safe', 'hard']}
5307 # @nbd-server-remove:
5309 # Remove NBD export by name.
5311 # @name: Export name.
5313 # @mode: Mode of command operation. See @NbdServerRemoveMode description.
5314 #        Default is 'safe'.
5316 # Returns: error if
5317 #            - the server is not running
5318 #            - export is not found
5319 #            - mode is 'safe' and there are existing connections
5321 # Since: 2.12
5323 { 'command': 'nbd-server-remove',
5324   'data': {'name': 'str', '*mode': 'NbdServerRemoveMode'} }
5327 # @nbd-server-stop:
5329 # Stop QEMU's embedded NBD server, and unregister all devices previously
5330 # added via @nbd-server-add.
5332 # Since: 1.3.0
5334 { 'command': 'nbd-server-stop' }
5337 # @BlockExportType:
5339 # An enumeration of block export types
5341 # @nbd: NBD export
5343 # Since: 4.2
5345 { 'enum': 'BlockExportType',
5346   'data': [ 'nbd' ] }
5349 # @BlockExport:
5351 # Describes a block export, i.e. how single node should be exported on an
5352 # external interface.
5354 # Since: 4.2
5356 { 'union': 'BlockExport',
5357   'base': { 'type': 'BlockExportType' },
5358   'discriminator': 'type',
5359   'data': {
5360       'nbd': 'BlockExportNbd'
5361    } }
5364 # @QuorumOpType:
5366 # An enumeration of the quorum operation types
5368 # @read: read operation
5370 # @write: write operation
5372 # @flush: flush operation
5374 # Since: 2.6
5376 { 'enum': 'QuorumOpType',
5377   'data': [ 'read', 'write', 'flush' ] }
5380 # @QUORUM_FAILURE:
5382 # Emitted by the Quorum block driver if it fails to establish a quorum
5384 # @reference: device name if defined else node name
5386 # @sector-num: number of the first sector of the failed read operation
5388 # @sectors-count: failed read operation sector count
5390 # Note: This event is rate-limited.
5392 # Since: 2.0
5394 # Example:
5396 # <- { "event": "QUORUM_FAILURE",
5397 #      "data": { "reference": "usr1", "sector-num": 345435, "sectors-count": 5 },
5398 #      "timestamp": { "seconds": 1344522075, "microseconds": 745528 } }
5401 { 'event': 'QUORUM_FAILURE',
5402   'data': { 'reference': 'str', 'sector-num': 'int', 'sectors-count': 'int' } }
5405 # @QUORUM_REPORT_BAD:
5407 # Emitted to report a corruption of a Quorum file
5409 # @type: quorum operation type (Since 2.6)
5411 # @error: error message. Only present on failure. This field
5412 #         contains a human-readable error message. There are no semantics other
5413 #         than that the block layer reported an error and clients should not
5414 #         try to interpret the error string.
5416 # @node-name: the graph node name of the block driver state
5418 # @sector-num: number of the first sector of the failed read operation
5420 # @sectors-count: failed read operation sector count
5422 # Note: This event is rate-limited.
5424 # Since: 2.0
5426 # Example:
5428 # 1. Read operation
5430 # { "event": "QUORUM_REPORT_BAD",
5431 #      "data": { "node-name": "node0", "sector-num": 345435, "sectors-count": 5,
5432 #                "type": "read" },
5433 #      "timestamp": { "seconds": 1344522075, "microseconds": 745528 } }
5435 # 2. Flush operation
5437 # { "event": "QUORUM_REPORT_BAD",
5438 #      "data": { "node-name": "node0", "sector-num": 0, "sectors-count": 2097120,
5439 #                "type": "flush", "error": "Broken pipe" },
5440 #      "timestamp": { "seconds": 1456406829, "microseconds": 291763 } }
5443 { 'event': 'QUORUM_REPORT_BAD',
5444   'data': { 'type': 'QuorumOpType', '*error': 'str', 'node-name': 'str',
5445             'sector-num': 'int', 'sectors-count': 'int' } }
5448 # @BlockdevSnapshotInternal:
5450 # @device: the device name or node-name of a root node to generate the snapshot
5451 #          from
5453 # @name: the name of the internal snapshot to be created
5455 # Notes: In transaction, if @name is empty, or any snapshot matching @name
5456 #        exists, the operation will fail. Only some image formats support it,
5457 #        for example, qcow2, rbd, and sheepdog.
5459 # Since: 1.7
5461 { 'struct': 'BlockdevSnapshotInternal',
5462   'data': { 'device': 'str', 'name': 'str' } }
5465 # @blockdev-snapshot-internal-sync:
5467 # Synchronously take an internal snapshot of a block device, when the
5468 # format of the image used supports it. If the name is an empty
5469 # string, or a snapshot with name already exists, the operation will
5470 # fail.
5472 # For the arguments, see the documentation of BlockdevSnapshotInternal.
5474 # Returns: - nothing on success
5475 #          - If @device is not a valid block device, GenericError
5476 #          - If any snapshot matching @name exists, or @name is empty,
5477 #            GenericError
5478 #          - If the format of the image used does not support it,
5479 #            BlockFormatFeatureNotSupported
5481 # Since: 1.7
5483 # Example:
5485 # -> { "execute": "blockdev-snapshot-internal-sync",
5486 #      "arguments": { "device": "ide-hd0",
5487 #                     "name": "snapshot0" }
5488 #    }
5489 # <- { "return": {} }
5492 { 'command': 'blockdev-snapshot-internal-sync',
5493   'data': 'BlockdevSnapshotInternal' }
5496 # @blockdev-snapshot-delete-internal-sync:
5498 # Synchronously delete an internal snapshot of a block device, when the format
5499 # of the image used support it. The snapshot is identified by name or id or
5500 # both. One of the name or id is required. Return SnapshotInfo for the
5501 # successfully deleted snapshot.
5503 # @device: the device name or node-name of a root node to delete the snapshot
5504 #          from
5506 # @id: optional the snapshot's ID to be deleted
5508 # @name: optional the snapshot's name to be deleted
5510 # Returns: - SnapshotInfo on success
5511 #          - If @device is not a valid block device, GenericError
5512 #          - If snapshot not found, GenericError
5513 #          - If the format of the image used does not support it,
5514 #            BlockFormatFeatureNotSupported
5515 #          - If @id and @name are both not specified, GenericError
5517 # Since: 1.7
5519 # Example:
5521 # -> { "execute": "blockdev-snapshot-delete-internal-sync",
5522 #      "arguments": { "device": "ide-hd0",
5523 #                     "name": "snapshot0" }
5524 #    }
5525 # <- { "return": {
5526 #                    "id": "1",
5527 #                    "name": "snapshot0",
5528 #                    "vm-state-size": 0,
5529 #                    "date-sec": 1000012,
5530 #                    "date-nsec": 10,
5531 #                    "vm-clock-sec": 100,
5532 #                    "vm-clock-nsec": 20
5533 #      }
5534 #    }
5537 { 'command': 'blockdev-snapshot-delete-internal-sync',
5538   'data': { 'device': 'str', '*id': 'str', '*name': 'str'},
5539   'returns': 'SnapshotInfo' }