qapi/block-core: Improve MapEntry documentation
[qemu.git] / qapi / block-core.json
blob3f86675357c1fd485a95e0e532709835cf864365
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 # @icount: Current instruction count. Appears when execution record/replay
31 #          is enabled. Used for "time-traveling" to match the moment
32 #          in the recorded execution with the snapshots. This counter may
33 #          be obtained through @query-replay command (since 5.2)
35 # Since: 1.3
38 { 'struct': 'SnapshotInfo',
39   'data': { 'id': 'str', 'name': 'str', 'vm-state-size': 'int',
40             'date-sec': 'int', 'date-nsec': 'int',
41             'vm-clock-sec': 'int', 'vm-clock-nsec': 'int',
42             '*icount': 'int' } }
45 # @ImageInfoSpecificQCow2EncryptionBase:
47 # @format: The encryption format
49 # Since: 2.10
51 { 'struct': 'ImageInfoSpecificQCow2EncryptionBase',
52   'data': { 'format': 'BlockdevQcow2EncryptionFormat'}}
55 # @ImageInfoSpecificQCow2Encryption:
57 # Since: 2.10
59 { 'union': 'ImageInfoSpecificQCow2Encryption',
60   'base': 'ImageInfoSpecificQCow2EncryptionBase',
61   'discriminator': 'format',
62   'data': { 'luks': 'QCryptoBlockInfoLUKS' } }
65 # @ImageInfoSpecificQCow2:
67 # @compat: compatibility level
69 # @data-file: the filename of the external data file that is stored in the
70 #             image and used as a default for opening the image (since: 4.0)
72 # @data-file-raw: True if the external data file must stay valid as a
73 #                 standalone (read-only) raw image without looking at qcow2
74 #                 metadata (since: 4.0)
76 # @extended-l2: true if the image has extended L2 entries; only valid for
77 #               compat >= 1.1 (since 5.2)
79 # @lazy-refcounts: on or off; only valid for compat >= 1.1
81 # @corrupt: true if the image has been marked corrupt; only valid for
82 #           compat >= 1.1 (since 2.2)
84 # @refcount-bits: width of a refcount entry in bits (since 2.3)
86 # @encrypt: details about encryption parameters; only set if image
87 #           is encrypted (since 2.10)
89 # @bitmaps: A list of qcow2 bitmap details (since 4.0)
91 # @compression-type: the image cluster compression method (since 5.1)
93 # Since: 1.7
95 { 'struct': 'ImageInfoSpecificQCow2',
96   'data': {
97       'compat': 'str',
98       '*data-file': 'str',
99       '*data-file-raw': 'bool',
100       '*extended-l2': 'bool',
101       '*lazy-refcounts': 'bool',
102       '*corrupt': 'bool',
103       'refcount-bits': 'int',
104       '*encrypt': 'ImageInfoSpecificQCow2Encryption',
105       '*bitmaps': ['Qcow2BitmapInfo'],
106       'compression-type': 'Qcow2CompressionType'
107   } }
110 # @ImageInfoSpecificVmdk:
112 # @create-type: The create type of VMDK image
114 # @cid: Content id of image
116 # @parent-cid: Parent VMDK image's cid
118 # @extents: List of extent files
120 # Since: 1.7
122 { 'struct': 'ImageInfoSpecificVmdk',
123   'data': {
124       'create-type': 'str',
125       'cid': 'int',
126       'parent-cid': 'int',
127       'extents': ['ImageInfo']
128   } }
131 # @ImageInfoSpecific:
133 # A discriminated record of image format specific information structures.
135 # Since: 1.7
137 { 'union': 'ImageInfoSpecific',
138   'data': {
139       'qcow2': 'ImageInfoSpecificQCow2',
140       'vmdk': 'ImageInfoSpecificVmdk',
141       # If we need to add block driver specific parameters for
142       # LUKS in future, then we'll subclass QCryptoBlockInfoLUKS
143       # to define a ImageInfoSpecificLUKS
144       'luks': 'QCryptoBlockInfoLUKS'
145   } }
148 # @ImageInfo:
150 # Information about a QEMU image file
152 # @filename: name of the image file
154 # @format: format of the image file
156 # @virtual-size: maximum capacity in bytes of the image
158 # @actual-size: actual size on disk in bytes of the image
160 # @dirty-flag: true if image is not cleanly closed
162 # @cluster-size: size of a cluster in bytes
164 # @encrypted: true if the image is encrypted
166 # @compressed: true if the image is compressed (Since 1.7)
168 # @backing-filename: name of the backing file
170 # @full-backing-filename: full path of the backing file
172 # @backing-filename-format: the format of the backing file
174 # @snapshots: list of VM snapshots
176 # @backing-image: info of the backing image (since 1.6)
178 # @format-specific: structure supplying additional format-specific
179 #                   information (since 1.7)
181 # Since: 1.3
184 { 'struct': 'ImageInfo',
185   'data': {'filename': 'str', 'format': 'str', '*dirty-flag': 'bool',
186            '*actual-size': 'int', 'virtual-size': 'int',
187            '*cluster-size': 'int', '*encrypted': 'bool', '*compressed': 'bool',
188            '*backing-filename': 'str', '*full-backing-filename': 'str',
189            '*backing-filename-format': 'str', '*snapshots': ['SnapshotInfo'],
190            '*backing-image': 'ImageInfo',
191            '*format-specific': 'ImageInfoSpecific' } }
194 # @ImageCheck:
196 # Information about a QEMU image file check
198 # @filename: name of the image file checked
200 # @format: format of the image file checked
202 # @check-errors: number of unexpected errors occurred during check
204 # @image-end-offset: offset (in bytes) where the image ends, this
205 #                    field is present if the driver for the image format
206 #                    supports it
208 # @corruptions: number of corruptions found during the check if any
210 # @leaks: number of leaks found during the check if any
212 # @corruptions-fixed: number of corruptions fixed during the check
213 #                     if any
215 # @leaks-fixed: number of leaks fixed during the check if any
217 # @total-clusters: total number of clusters, this field is present
218 #                  if the driver for the image format supports it
220 # @allocated-clusters: total number of allocated clusters, this
221 #                      field is present if the driver for the image format
222 #                      supports it
224 # @fragmented-clusters: total number of fragmented clusters, this
225 #                       field is present if the driver for the image format
226 #                       supports it
228 # @compressed-clusters: total number of compressed clusters, this
229 #                       field is present if the driver for the image format
230 #                       supports it
232 # Since: 1.4
235 { 'struct': 'ImageCheck',
236   'data': {'filename': 'str', 'format': 'str', 'check-errors': 'int',
237            '*image-end-offset': 'int', '*corruptions': 'int', '*leaks': 'int',
238            '*corruptions-fixed': 'int', '*leaks-fixed': 'int',
239            '*total-clusters': 'int', '*allocated-clusters': 'int',
240            '*fragmented-clusters': 'int', '*compressed-clusters': 'int' } }
243 # @MapEntry:
245 # Mapping information from a virtual block range to a host file range
247 # @start: virtual (guest) offset of the first byte described by this
248 #         entry
250 # @length: the number of bytes of the mapped virtual range
252 # @data: reading the image will actually read data from a file (in
253 #        particular, if @offset is present this means that the sectors
254 #        are not simply preallocated, but contain actual data in raw
255 #        format)
257 # @zero: whether the virtual blocks read as zeroes
259 # @depth: number of layers (0 = top image, 1 = top image's backing
260 #         file, ..., n - 1 = bottom image (where n is the number of
261 #         images in the chain)) before reaching one for which the
262 #         range is allocated
264 # @offset: if present, the image file stores the data for this range
265 #          in raw format at the given (host) offset
267 # @filename: filename that is referred to by @offset
269 # Since: 2.6
272 { 'struct': 'MapEntry',
273   'data': {'start': 'int', 'length': 'int', 'data': 'bool',
274            'zero': 'bool', 'depth': 'int', '*offset': 'int',
275            '*filename': 'str' } }
278 # @BlockdevCacheInfo:
280 # Cache mode information for a block device
282 # @writeback:   true if writeback mode is enabled
283 # @direct:      true if the host page cache is bypassed (O_DIRECT)
284 # @no-flush:    true if flush requests are ignored for the device
286 # Since: 2.3
288 { 'struct': 'BlockdevCacheInfo',
289   'data': { 'writeback': 'bool',
290             'direct': 'bool',
291             'no-flush': 'bool' } }
294 # @BlockDeviceInfo:
296 # Information about the backing device for a block device.
298 # @file: the filename of the backing device
300 # @node-name: the name of the block driver node (Since 2.0)
302 # @ro: true if the backing device was open read-only
304 # @drv: the name of the block format used to open the backing device. As of
305 #       0.14.0 this can be: 'blkdebug', 'bochs', 'cloop', 'cow', 'dmg',
306 #       'file', 'file', 'ftp', 'ftps', 'host_cdrom', 'host_device',
307 #       'http', 'https', 'luks', 'nbd', 'parallels', 'qcow',
308 #       'qcow2', 'raw', 'vdi', 'vmdk', 'vpc', 'vvfat'
309 #       2.2: 'archipelago' added, 'cow' dropped
310 #       2.3: 'host_floppy' deprecated
311 #       2.5: 'host_floppy' dropped
312 #       2.6: 'luks' added
313 #       2.8: 'replication' added, 'tftp' dropped
314 #       2.9: 'archipelago' dropped
316 # @backing_file: the name of the backing file (for copy-on-write)
318 # @backing_file_depth: number of files in the backing file chain (since: 1.2)
320 # @encrypted: true if the backing device is encrypted
322 # @encryption_key_missing: always false
324 # @detect_zeroes: detect and optimize zero writes (Since 2.1)
326 # @bps: total throughput limit in bytes per second is specified
328 # @bps_rd: read throughput limit in bytes per second is specified
330 # @bps_wr: write throughput limit in bytes per second is specified
332 # @iops: total I/O operations per second is specified
334 # @iops_rd: read I/O operations per second is specified
336 # @iops_wr: write I/O operations per second is specified
338 # @image: the info of image used (since: 1.6)
340 # @bps_max: total throughput limit during bursts,
341 #                     in bytes (Since 1.7)
343 # @bps_rd_max: read throughput limit during bursts,
344 #                        in bytes (Since 1.7)
346 # @bps_wr_max: write throughput limit during bursts,
347 #                        in bytes (Since 1.7)
349 # @iops_max: total I/O operations per second during bursts,
350 #                      in bytes (Since 1.7)
352 # @iops_rd_max: read I/O operations per second during bursts,
353 #                         in bytes (Since 1.7)
355 # @iops_wr_max: write I/O operations per second during bursts,
356 #                         in bytes (Since 1.7)
358 # @bps_max_length: maximum length of the @bps_max burst
359 #                            period, in seconds. (Since 2.6)
361 # @bps_rd_max_length: maximum length of the @bps_rd_max
362 #                               burst period, in seconds. (Since 2.6)
364 # @bps_wr_max_length: maximum length of the @bps_wr_max
365 #                               burst period, in seconds. (Since 2.6)
367 # @iops_max_length: maximum length of the @iops burst
368 #                             period, in seconds. (Since 2.6)
370 # @iops_rd_max_length: maximum length of the @iops_rd_max
371 #                                burst period, in seconds. (Since 2.6)
373 # @iops_wr_max_length: maximum length of the @iops_wr_max
374 #                                burst period, in seconds. (Since 2.6)
376 # @iops_size: an I/O size in bytes (Since 1.7)
378 # @group: throttle group name (Since 2.4)
380 # @cache: the cache mode used for the block device (since: 2.3)
382 # @write_threshold: configured write threshold for the device.
383 #                   0 if disabled. (Since 2.3)
385 # @dirty-bitmaps: dirty bitmaps information (only present if node
386 #                 has one or more dirty bitmaps) (Since 4.2)
388 # Features:
389 # @deprecated: Member @encryption_key_missing is deprecated.  It is
390 #              always false.
392 # Since: 0.14.0
395 { 'struct': 'BlockDeviceInfo',
396   'data': { 'file': 'str', '*node-name': 'str', 'ro': 'bool', 'drv': 'str',
397             '*backing_file': 'str', 'backing_file_depth': 'int',
398             'encrypted': 'bool',
399             'encryption_key_missing': { 'type': 'bool',
400                                         'features': [ 'deprecated' ] },
401             'detect_zeroes': 'BlockdevDetectZeroesOptions',
402             'bps': 'int', 'bps_rd': 'int', 'bps_wr': 'int',
403             'iops': 'int', 'iops_rd': 'int', 'iops_wr': 'int',
404             'image': 'ImageInfo',
405             '*bps_max': 'int', '*bps_rd_max': 'int',
406             '*bps_wr_max': 'int', '*iops_max': 'int',
407             '*iops_rd_max': 'int', '*iops_wr_max': 'int',
408             '*bps_max_length': 'int', '*bps_rd_max_length': 'int',
409             '*bps_wr_max_length': 'int', '*iops_max_length': 'int',
410             '*iops_rd_max_length': 'int', '*iops_wr_max_length': 'int',
411             '*iops_size': 'int', '*group': 'str', 'cache': 'BlockdevCacheInfo',
412             'write_threshold': 'int', '*dirty-bitmaps': ['BlockDirtyInfo'] } }
415 # @BlockDeviceIoStatus:
417 # An enumeration of block device I/O status.
419 # @ok: The last I/O operation has succeeded
421 # @failed: The last I/O operation has failed
423 # @nospace: The last I/O operation has failed due to a no-space condition
425 # Since: 1.0
427 { 'enum': 'BlockDeviceIoStatus', 'data': [ 'ok', 'failed', 'nospace' ] }
430 # @BlockDeviceMapEntry:
432 # Entry in the metadata map of the device (returned by "qemu-img map")
434 # @start: Offset in the image of the first byte described by this entry
435 #         (in bytes)
437 # @length: Length of the range described by this entry (in bytes)
439 # @depth: Number of layers (0 = top image, 1 = top image's backing file, etc.)
440 #         before reaching one for which the range is allocated.  The value is
441 #         in the range 0 to the depth of the image chain - 1.
443 # @zero: the sectors in this range read as zeros
445 # @data: reading the image will actually read data from a file (in particular,
446 #        if @offset is present this means that the sectors are not simply
447 #        preallocated, but contain actual data in raw format)
449 # @offset: if present, the image file stores the data for this range in
450 #          raw format at the given offset.
452 # Since: 1.7
454 { 'struct': 'BlockDeviceMapEntry',
455   'data': { 'start': 'int', 'length': 'int', 'depth': 'int', 'zero': 'bool',
456             'data': 'bool', '*offset': 'int' } }
459 # @DirtyBitmapStatus:
461 # An enumeration of possible states that a dirty bitmap can report to the user.
463 # @frozen: The bitmap is currently in-use by some operation and is immutable.
464 #          If the bitmap was @active prior to the operation, new writes by the
465 #          guest are being recorded in a temporary buffer, and will not be lost.
466 #          Generally, bitmaps are cleared on successful use in an operation and
467 #          the temporary buffer is committed into the bitmap. On failure, the
468 #          temporary buffer is merged back into the bitmap without first
469 #          clearing it.
470 #          Please refer to the documentation for each bitmap-using operation,
471 #          See also @blockdev-backup, @drive-backup.
473 # @disabled: The bitmap is not currently recording new writes by the guest.
474 #            This is requested explicitly via @block-dirty-bitmap-disable.
475 #            It can still be cleared, deleted, or used for backup operations.
477 # @active: The bitmap is actively monitoring for new writes, and can be cleared,
478 #          deleted, or used for backup operations.
480 # @locked: The bitmap is currently in-use by some operation and is immutable.
481 #          If the bitmap was @active prior to the operation, it is still
482 #          recording new writes. If the bitmap was @disabled, it is not
483 #          recording new writes. (Since 2.12)
485 # @inconsistent: This is a persistent dirty bitmap that was marked in-use on
486 #                disk, and is unusable by QEMU. It can only be deleted.
487 #                Please rely on the inconsistent field in @BlockDirtyInfo
488 #                instead, as the status field is deprecated. (Since 4.0)
490 # Since: 2.4
492 { 'enum': 'DirtyBitmapStatus',
493   'data': ['active', 'disabled', 'frozen', 'locked', 'inconsistent'] }
496 # @BlockDirtyInfo:
498 # Block dirty bitmap information.
500 # @name: the name of the dirty bitmap (Since 2.4)
502 # @count: number of dirty bytes according to the dirty bitmap
504 # @granularity: granularity of the dirty bitmap in bytes (since 1.4)
506 # @status: current status of the dirty bitmap (since 2.4)
508 # @recording: true if the bitmap is recording new writes from the guest.
509 #             Replaces `active` and `disabled` statuses. (since 4.0)
511 # @busy: true if the bitmap is in-use by some operation (NBD or jobs)
512 #        and cannot be modified via QMP or used by another operation.
513 #        Replaces `locked` and `frozen` statuses. (since 4.0)
515 # @persistent: true if the bitmap was stored on disk, is scheduled to be stored
516 #              on disk, or both. (since 4.0)
518 # @inconsistent: true if this is a persistent bitmap that was improperly
519 #                stored. Implies @persistent to be true; @recording and
520 #                @busy to be false. This bitmap cannot be used. To remove
521 #                it, use @block-dirty-bitmap-remove. (Since 4.0)
523 # Features:
524 # @deprecated: Member @status is deprecated.  Use @recording and
525 #              @locked instead.
527 # Since: 1.3
529 { 'struct': 'BlockDirtyInfo',
530   'data': {'*name': 'str', 'count': 'int', 'granularity': 'uint32',
531            'recording': 'bool', 'busy': 'bool',
532            'status': { 'type': 'DirtyBitmapStatus',
533                        'features': [ 'deprecated' ] },
534            'persistent': 'bool', '*inconsistent': 'bool' } }
537 # @Qcow2BitmapInfoFlags:
539 # An enumeration of flags that a bitmap can report to the user.
541 # @in-use: This flag is set by any process actively modifying the qcow2 file,
542 #          and cleared when the updated bitmap is flushed to the qcow2 image.
543 #          The presence of this flag in an offline image means that the bitmap
544 #          was not saved correctly after its last usage, and may contain
545 #          inconsistent data.
547 # @auto: The bitmap must reflect all changes of the virtual disk by any
548 #        application that would write to this qcow2 file.
550 # Since: 4.0
552 { 'enum': 'Qcow2BitmapInfoFlags',
553   'data': ['in-use', 'auto'] }
556 # @Qcow2BitmapInfo:
558 # Qcow2 bitmap information.
560 # @name: the name of the bitmap
562 # @granularity: granularity of the bitmap in bytes
564 # @flags: flags of the bitmap
566 # Since: 4.0
568 { 'struct': 'Qcow2BitmapInfo',
569   'data': {'name': 'str', 'granularity': 'uint32',
570            'flags': ['Qcow2BitmapInfoFlags'] } }
573 # @BlockLatencyHistogramInfo:
575 # Block latency histogram.
577 # @boundaries: list of interval boundary values in nanoseconds, all greater
578 #              than zero and in ascending order.
579 #              For example, the list [10, 50, 100] produces the following
580 #              histogram intervals: [0, 10), [10, 50), [50, 100), [100, +inf).
582 # @bins: list of io request counts corresponding to histogram intervals.
583 #        len(@bins) = len(@boundaries) + 1
584 #        For the example above, @bins may be something like [3, 1, 5, 2],
585 #        and corresponding histogram looks like:
587 # ::
589 #        5|           *
590 #        4|           *
591 #        3| *         *
592 #        2| *         *    *
593 #        1| *    *    *    *
594 #         +------------------
595 #             10   50   100
597 # Since: 4.0
599 { 'struct': 'BlockLatencyHistogramInfo',
600   'data': {'boundaries': ['uint64'], 'bins': ['uint64'] } }
603 # @BlockInfo:
605 # Block device information.  This structure describes a virtual device and
606 # the backing device associated with it.
608 # @device: The device name associated with the virtual device.
610 # @qdev: The qdev ID, or if no ID is assigned, the QOM path of the block
611 #        device. (since 2.10)
613 # @type: This field is returned only for compatibility reasons, it should
614 #        not be used (always returns 'unknown')
616 # @removable: True if the device supports removable media.
618 # @locked: True if the guest has locked this device from having its media
619 #          removed
621 # @tray_open: True if the device's tray is open
622 #             (only present if it has a tray)
624 # @dirty-bitmaps: dirty bitmaps information (only present if the
625 #                 driver has one or more dirty bitmaps) (Since 2.0)
627 # @io-status: @BlockDeviceIoStatus. Only present if the device
628 #             supports it and the VM is configured to stop on errors
629 #             (supported device models: virtio-blk, IDE, SCSI except
630 #             scsi-generic)
632 # @inserted: @BlockDeviceInfo describing the device if media is
633 #            present
635 # Features:
636 # @deprecated: Member @dirty-bitmaps is deprecated.  Use @inserted
637 #              member @dirty-bitmaps instead.
639 # Since:  0.14.0
641 { 'struct': 'BlockInfo',
642   'data': {'device': 'str', '*qdev': 'str', 'type': 'str', 'removable': 'bool',
643            'locked': 'bool', '*inserted': 'BlockDeviceInfo',
644            '*tray_open': 'bool', '*io-status': 'BlockDeviceIoStatus',
645            '*dirty-bitmaps': { 'type': ['BlockDirtyInfo'],
646                                'features': [ 'deprecated' ] } } }
649 # @BlockMeasureInfo:
651 # Image file size calculation information.  This structure describes the size
652 # requirements for creating a new image file.
654 # The size requirements depend on the new image file format.  File size always
655 # equals virtual disk size for the 'raw' format, even for sparse POSIX files.
656 # Compact formats such as 'qcow2' represent unallocated and zero regions
657 # efficiently so file size may be smaller than virtual disk size.
659 # The values are upper bounds that are guaranteed to fit the new image file.
660 # Subsequent modification, such as internal snapshot or further bitmap
661 # creation, may require additional space and is not covered here.
663 # @required: Size required for a new image file, in bytes, when copying just
664 #            allocated guest-visible contents.
666 # @fully-allocated: Image file size, in bytes, once data has been written
667 #                   to all sectors, when copying just guest-visible contents.
669 # @bitmaps: Additional size required if all the top-level bitmap metadata
670 #           in the source image were to be copied to the destination,
671 #           present only when source and destination both support
672 #           persistent bitmaps. (since 5.1)
674 # Since: 2.10
676 { 'struct': 'BlockMeasureInfo',
677   'data': {'required': 'int', 'fully-allocated': 'int', '*bitmaps': 'int'} }
680 # @query-block:
682 # Get a list of BlockInfo for all virtual block devices.
684 # Returns: a list of @BlockInfo describing each virtual block device. Filter
685 #          nodes that were created implicitly are skipped over.
687 # Since: 0.14.0
689 # Example:
691 # -> { "execute": "query-block" }
692 # <- {
693 #       "return":[
694 #          {
695 #             "io-status": "ok",
696 #             "device":"ide0-hd0",
697 #             "locked":false,
698 #             "removable":false,
699 #             "inserted":{
700 #                "ro":false,
701 #                "drv":"qcow2",
702 #                "encrypted":false,
703 #                "file":"disks/test.qcow2",
704 #                "backing_file_depth":1,
705 #                "bps":1000000,
706 #                "bps_rd":0,
707 #                "bps_wr":0,
708 #                "iops":1000000,
709 #                "iops_rd":0,
710 #                "iops_wr":0,
711 #                "bps_max": 8000000,
712 #                "bps_rd_max": 0,
713 #                "bps_wr_max": 0,
714 #                "iops_max": 0,
715 #                "iops_rd_max": 0,
716 #                "iops_wr_max": 0,
717 #                "iops_size": 0,
718 #                "detect_zeroes": "on",
719 #                "write_threshold": 0,
720 #                "image":{
721 #                   "filename":"disks/test.qcow2",
722 #                   "format":"qcow2",
723 #                   "virtual-size":2048000,
724 #                   "backing_file":"base.qcow2",
725 #                   "full-backing-filename":"disks/base.qcow2",
726 #                   "backing-filename-format":"qcow2",
727 #                   "snapshots":[
728 #                      {
729 #                         "id": "1",
730 #                         "name": "snapshot1",
731 #                         "vm-state-size": 0,
732 #                         "date-sec": 10000200,
733 #                         "date-nsec": 12,
734 #                         "vm-clock-sec": 206,
735 #                         "vm-clock-nsec": 30
736 #                      }
737 #                   ],
738 #                   "backing-image":{
739 #                       "filename":"disks/base.qcow2",
740 #                       "format":"qcow2",
741 #                       "virtual-size":2048000
742 #                   }
743 #                }
744 #             },
745 #             "qdev": "ide_disk",
746 #             "type":"unknown"
747 #          },
748 #          {
749 #             "io-status": "ok",
750 #             "device":"ide1-cd0",
751 #             "locked":false,
752 #             "removable":true,
753 #             "qdev": "/machine/unattached/device[23]",
754 #             "tray_open": false,
755 #             "type":"unknown"
756 #          },
757 #          {
758 #             "device":"floppy0",
759 #             "locked":false,
760 #             "removable":true,
761 #             "qdev": "/machine/unattached/device[20]",
762 #             "type":"unknown"
763 #          },
764 #          {
765 #             "device":"sd0",
766 #             "locked":false,
767 #             "removable":true,
768 #             "type":"unknown"
769 #          }
770 #       ]
771 #    }
774 { 'command': 'query-block', 'returns': ['BlockInfo'] }
778 # @BlockDeviceTimedStats:
780 # Statistics of a block device during a given interval of time.
782 # @interval_length: Interval used for calculating the statistics,
783 #                   in seconds.
785 # @min_rd_latency_ns: Minimum latency of read operations in the
786 #                     defined interval, in nanoseconds.
788 # @min_wr_latency_ns: Minimum latency of write operations in the
789 #                     defined interval, in nanoseconds.
791 # @min_flush_latency_ns: Minimum latency of flush operations in the
792 #                        defined interval, in nanoseconds.
794 # @max_rd_latency_ns: Maximum latency of read operations in the
795 #                     defined interval, in nanoseconds.
797 # @max_wr_latency_ns: Maximum latency of write operations in the
798 #                     defined interval, in nanoseconds.
800 # @max_flush_latency_ns: Maximum latency of flush operations in the
801 #                        defined interval, in nanoseconds.
803 # @avg_rd_latency_ns: Average latency of read operations in the
804 #                     defined interval, in nanoseconds.
806 # @avg_wr_latency_ns: Average latency of write operations in the
807 #                     defined interval, in nanoseconds.
809 # @avg_flush_latency_ns: Average latency of flush operations in the
810 #                        defined interval, in nanoseconds.
812 # @avg_rd_queue_depth: Average number of pending read operations
813 #                      in the defined interval.
815 # @avg_wr_queue_depth: Average number of pending write operations
816 #                      in the defined interval.
818 # Since: 2.5
820 { 'struct': 'BlockDeviceTimedStats',
821   'data': { 'interval_length': 'int', 'min_rd_latency_ns': 'int',
822             'max_rd_latency_ns': 'int', 'avg_rd_latency_ns': 'int',
823             'min_wr_latency_ns': 'int', 'max_wr_latency_ns': 'int',
824             'avg_wr_latency_ns': 'int', 'min_flush_latency_ns': 'int',
825             'max_flush_latency_ns': 'int', 'avg_flush_latency_ns': 'int',
826             'avg_rd_queue_depth': 'number', 'avg_wr_queue_depth': 'number' } }
829 # @BlockDeviceStats:
831 # Statistics of a virtual block device or a block backing device.
833 # @rd_bytes:      The number of bytes read by the device.
835 # @wr_bytes:      The number of bytes written by the device.
837 # @unmap_bytes: The number of bytes unmapped by the device (Since 4.2)
839 # @rd_operations: The number of read operations performed by the device.
841 # @wr_operations: The number of write operations performed by the device.
843 # @flush_operations: The number of cache flush operations performed by the
844 #                    device (since 0.15.0)
846 # @unmap_operations: The number of unmap operations performed by the device
847 #                    (Since 4.2)
849 # @rd_total_time_ns: Total time spent on reads in nanoseconds (since 0.15.0).
851 # @wr_total_time_ns: Total time spent on writes in nanoseconds (since 0.15.0).
853 # @flush_total_time_ns: Total time spent on cache flushes in nanoseconds
854 #                       (since 0.15.0).
856 # @unmap_total_time_ns: Total time spent on unmap operations in nanoseconds
857 #                       (Since 4.2)
859 # @wr_highest_offset: The offset after the greatest byte written to the
860 #                     device.  The intended use of this information is for
861 #                     growable sparse files (like qcow2) that are used on top
862 #                     of a physical device.
864 # @rd_merged: Number of read requests that have been merged into another
865 #             request (Since 2.3).
867 # @wr_merged: Number of write requests that have been merged into another
868 #             request (Since 2.3).
870 # @unmap_merged: Number of unmap requests that have been merged into another
871 #                request (Since 4.2)
873 # @idle_time_ns: Time since the last I/O operation, in
874 #                nanoseconds. If the field is absent it means that
875 #                there haven't been any operations yet (Since 2.5).
877 # @failed_rd_operations: The number of failed read operations
878 #                        performed by the device (Since 2.5)
880 # @failed_wr_operations: The number of failed write operations
881 #                        performed by the device (Since 2.5)
883 # @failed_flush_operations: The number of failed flush operations
884 #                           performed by the device (Since 2.5)
886 # @failed_unmap_operations: The number of failed unmap operations performed
887 #                           by the device (Since 4.2)
889 # @invalid_rd_operations: The number of invalid read operations
890 #                          performed by the device (Since 2.5)
892 # @invalid_wr_operations: The number of invalid write operations
893 #                         performed by the device (Since 2.5)
895 # @invalid_flush_operations: The number of invalid flush operations
896 #                            performed by the device (Since 2.5)
898 # @invalid_unmap_operations: The number of invalid unmap operations performed
899 #                            by the device (Since 4.2)
901 # @account_invalid: Whether invalid operations are included in the
902 #                   last access statistics (Since 2.5)
904 # @account_failed: Whether failed operations are included in the
905 #                  latency and last access statistics (Since 2.5)
907 # @timed_stats: Statistics specific to the set of previously defined
908 #               intervals of time (Since 2.5)
910 # @rd_latency_histogram: @BlockLatencyHistogramInfo. (Since 4.0)
912 # @wr_latency_histogram: @BlockLatencyHistogramInfo. (Since 4.0)
914 # @flush_latency_histogram: @BlockLatencyHistogramInfo. (Since 4.0)
916 # Since: 0.14.0
918 { 'struct': 'BlockDeviceStats',
919   'data': {'rd_bytes': 'int', 'wr_bytes': 'int', 'unmap_bytes' : 'int',
920            'rd_operations': 'int', 'wr_operations': 'int',
921            'flush_operations': 'int', 'unmap_operations': 'int',
922            'rd_total_time_ns': 'int', 'wr_total_time_ns': 'int',
923            'flush_total_time_ns': 'int', 'unmap_total_time_ns': 'int',
924            'wr_highest_offset': 'int',
925            'rd_merged': 'int', 'wr_merged': 'int', 'unmap_merged': 'int',
926            '*idle_time_ns': 'int',
927            'failed_rd_operations': 'int', 'failed_wr_operations': 'int',
928            'failed_flush_operations': 'int', 'failed_unmap_operations': 'int',
929            'invalid_rd_operations': 'int', 'invalid_wr_operations': 'int',
930            'invalid_flush_operations': 'int', 'invalid_unmap_operations': 'int',
931            'account_invalid': 'bool', 'account_failed': 'bool',
932            'timed_stats': ['BlockDeviceTimedStats'],
933            '*rd_latency_histogram': 'BlockLatencyHistogramInfo',
934            '*wr_latency_histogram': 'BlockLatencyHistogramInfo',
935            '*flush_latency_histogram': 'BlockLatencyHistogramInfo' } }
938 # @BlockStatsSpecificFile:
940 # File driver statistics
942 # @discard-nb-ok: The number of successful discard operations performed by
943 #                 the driver.
945 # @discard-nb-failed: The number of failed discard operations performed by
946 #                     the driver.
948 # @discard-bytes-ok: The number of bytes discarded by the driver.
950 # Since: 4.2
952 { 'struct': 'BlockStatsSpecificFile',
953   'data': {
954       'discard-nb-ok': 'uint64',
955       'discard-nb-failed': 'uint64',
956       'discard-bytes-ok': 'uint64' } }
959 # @BlockStatsSpecificNvme:
961 # NVMe driver statistics
963 # @completion-errors: The number of completion errors.
965 # @aligned-accesses: The number of aligned accesses performed by
966 #                    the driver.
968 # @unaligned-accesses: The number of unaligned accesses performed by
969 #                      the driver.
971 # Since: 5.2
973 { 'struct': 'BlockStatsSpecificNvme',
974   'data': {
975       'completion-errors': 'uint64',
976       'aligned-accesses': 'uint64',
977       'unaligned-accesses': 'uint64' } }
980 # @BlockStatsSpecific:
982 # Block driver specific statistics
984 # Since: 4.2
986 { 'union': 'BlockStatsSpecific',
987   'base': { 'driver': 'BlockdevDriver' },
988   'discriminator': 'driver',
989   'data': {
990       'file': 'BlockStatsSpecificFile',
991       'host_device': 'BlockStatsSpecificFile',
992       'nvme': 'BlockStatsSpecificNvme' } }
995 # @BlockStats:
997 # Statistics of a virtual block device or a block backing device.
999 # @device: If the stats are for a virtual block device, the name
1000 #          corresponding to the virtual block device.
1002 # @node-name: The node name of the device. (Since 2.3)
1004 # @qdev: The qdev ID, or if no ID is assigned, the QOM path of the block
1005 #        device. (since 3.0)
1007 # @stats:  A @BlockDeviceStats for the device.
1009 # @driver-specific: Optional driver-specific stats. (Since 4.2)
1011 # @parent: This describes the file block device if it has one.
1012 #          Contains recursively the statistics of the underlying
1013 #          protocol (e.g. the host file for a qcow2 image). If there is
1014 #          no underlying protocol, this field is omitted
1016 # @backing: This describes the backing block device if it has one.
1017 #           (Since 2.0)
1019 # Since: 0.14.0
1021 { 'struct': 'BlockStats',
1022   'data': {'*device': 'str', '*qdev': 'str', '*node-name': 'str',
1023            'stats': 'BlockDeviceStats',
1024            '*driver-specific': 'BlockStatsSpecific',
1025            '*parent': 'BlockStats',
1026            '*backing': 'BlockStats'} }
1029 # @query-blockstats:
1031 # Query the @BlockStats for all virtual block devices.
1033 # @query-nodes: If true, the command will query all the block nodes
1034 #               that have a node name, in a list which will include "parent"
1035 #               information, but not "backing".
1036 #               If false or omitted, the behavior is as before - query all the
1037 #               device backends, recursively including their "parent" and
1038 #               "backing". Filter nodes that were created implicitly are
1039 #               skipped over in this mode. (Since 2.3)
1041 # Returns: A list of @BlockStats for each virtual block devices.
1043 # Since: 0.14.0
1045 # Example:
1047 # -> { "execute": "query-blockstats" }
1048 # <- {
1049 #       "return":[
1050 #          {
1051 #             "device":"ide0-hd0",
1052 #             "parent":{
1053 #                "stats":{
1054 #                   "wr_highest_offset":3686448128,
1055 #                   "wr_bytes":9786368,
1056 #                   "wr_operations":751,
1057 #                   "rd_bytes":122567168,
1058 #                   "rd_operations":36772
1059 #                   "wr_total_times_ns":313253456
1060 #                   "rd_total_times_ns":3465673657
1061 #                   "flush_total_times_ns":49653
1062 #                   "flush_operations":61,
1063 #                   "rd_merged":0,
1064 #                   "wr_merged":0,
1065 #                   "idle_time_ns":2953431879,
1066 #                   "account_invalid":true,
1067 #                   "account_failed":false
1068 #                }
1069 #             },
1070 #             "stats":{
1071 #                "wr_highest_offset":2821110784,
1072 #                "wr_bytes":9786368,
1073 #                "wr_operations":692,
1074 #                "rd_bytes":122739200,
1075 #                "rd_operations":36604
1076 #                "flush_operations":51,
1077 #                "wr_total_times_ns":313253456
1078 #                "rd_total_times_ns":3465673657
1079 #                "flush_total_times_ns":49653,
1080 #                "rd_merged":0,
1081 #                "wr_merged":0,
1082 #                "idle_time_ns":2953431879,
1083 #                "account_invalid":true,
1084 #                "account_failed":false
1085 #             },
1086 #             "qdev": "/machine/unattached/device[23]"
1087 #          },
1088 #          {
1089 #             "device":"ide1-cd0",
1090 #             "stats":{
1091 #                "wr_highest_offset":0,
1092 #                "wr_bytes":0,
1093 #                "wr_operations":0,
1094 #                "rd_bytes":0,
1095 #                "rd_operations":0
1096 #                "flush_operations":0,
1097 #                "wr_total_times_ns":0
1098 #                "rd_total_times_ns":0
1099 #                "flush_total_times_ns":0,
1100 #                "rd_merged":0,
1101 #                "wr_merged":0,
1102 #                "account_invalid":false,
1103 #                "account_failed":false
1104 #             },
1105 #             "qdev": "/machine/unattached/device[24]"
1106 #          },
1107 #          {
1108 #             "device":"floppy0",
1109 #             "stats":{
1110 #                "wr_highest_offset":0,
1111 #                "wr_bytes":0,
1112 #                "wr_operations":0,
1113 #                "rd_bytes":0,
1114 #                "rd_operations":0
1115 #                "flush_operations":0,
1116 #                "wr_total_times_ns":0
1117 #                "rd_total_times_ns":0
1118 #                "flush_total_times_ns":0,
1119 #                "rd_merged":0,
1120 #                "wr_merged":0,
1121 #                "account_invalid":false,
1122 #                "account_failed":false
1123 #             },
1124 #             "qdev": "/machine/unattached/device[16]"
1125 #          },
1126 #          {
1127 #             "device":"sd0",
1128 #             "stats":{
1129 #                "wr_highest_offset":0,
1130 #                "wr_bytes":0,
1131 #                "wr_operations":0,
1132 #                "rd_bytes":0,
1133 #                "rd_operations":0
1134 #                "flush_operations":0,
1135 #                "wr_total_times_ns":0
1136 #                "rd_total_times_ns":0
1137 #                "flush_total_times_ns":0,
1138 #                "rd_merged":0,
1139 #                "wr_merged":0,
1140 #                "account_invalid":false,
1141 #                "account_failed":false
1142 #             }
1143 #          }
1144 #       ]
1145 #    }
1148 { 'command': 'query-blockstats',
1149   'data': { '*query-nodes': 'bool' },
1150   'returns': ['BlockStats'] }
1153 # @BlockdevOnError:
1155 # An enumeration of possible behaviors for errors on I/O operations.
1156 # The exact meaning depends on whether the I/O was initiated by a guest
1157 # or by a block job
1159 # @report: for guest operations, report the error to the guest;
1160 #          for jobs, cancel the job
1162 # @ignore: ignore the error, only report a QMP event (BLOCK_IO_ERROR
1163 #          or BLOCK_JOB_ERROR). The backup, mirror and commit block jobs retry
1164 #          the failing request later and may still complete successfully. The
1165 #          stream block job continues to stream and will complete with an
1166 #          error.
1168 # @enospc: same as @stop on ENOSPC, same as @report otherwise.
1170 # @stop: for guest operations, stop the virtual machine;
1171 #        for jobs, pause the job
1173 # @auto: inherit the error handling policy of the backend (since: 2.7)
1175 # Since: 1.3
1177 { 'enum': 'BlockdevOnError',
1178   'data': ['report', 'ignore', 'enospc', 'stop', 'auto'] }
1181 # @MirrorSyncMode:
1183 # An enumeration of possible behaviors for the initial synchronization
1184 # phase of storage mirroring.
1186 # @top: copies data in the topmost image to the destination
1188 # @full: copies data from all images to the destination
1190 # @none: only copy data written from now on
1192 # @incremental: only copy data described by the dirty bitmap. (since: 2.4)
1194 # @bitmap: only copy data described by the dirty bitmap. (since: 4.2)
1195 #          Behavior on completion is determined by the BitmapSyncMode.
1197 # Since: 1.3
1199 { 'enum': 'MirrorSyncMode',
1200   'data': ['top', 'full', 'none', 'incremental', 'bitmap'] }
1203 # @BitmapSyncMode:
1205 # An enumeration of possible behaviors for the synchronization of a bitmap
1206 # when used for data copy operations.
1208 # @on-success: The bitmap is only synced when the operation is successful.
1209 #              This is the behavior always used for 'INCREMENTAL' backups.
1211 # @never: The bitmap is never synchronized with the operation, and is
1212 #         treated solely as a read-only manifest of blocks to copy.
1214 # @always: The bitmap is always synchronized with the operation,
1215 #          regardless of whether or not the operation was successful.
1217 # Since: 4.2
1219 { 'enum': 'BitmapSyncMode',
1220   'data': ['on-success', 'never', 'always'] }
1223 # @MirrorCopyMode:
1225 # An enumeration whose values tell the mirror block job when to
1226 # trigger writes to the target.
1228 # @background: copy data in background only.
1230 # @write-blocking: when data is written to the source, write it
1231 #                  (synchronously) to the target as well.  In
1232 #                  addition, data is copied in background just like in
1233 #                  @background mode.
1235 # Since: 3.0
1237 { 'enum': 'MirrorCopyMode',
1238   'data': ['background', 'write-blocking'] }
1241 # @BlockJobInfo:
1243 # Information about a long-running block device operation.
1245 # @type: the job type ('stream' for image streaming)
1247 # @device: The job identifier. Originally the device name but other
1248 #          values are allowed since QEMU 2.7
1250 # @len: Estimated @offset value at the completion of the job. This value can
1251 #       arbitrarily change while the job is running, in both directions.
1253 # @offset: Progress made until now. The unit is arbitrary and the value can
1254 #          only meaningfully be used for the ratio of @offset to @len. The
1255 #          value is monotonically increasing.
1257 # @busy: false if the job is known to be in a quiescent state, with
1258 #        no pending I/O.  Since 1.3.
1260 # @paused: whether the job is paused or, if @busy is true, will
1261 #          pause itself as soon as possible.  Since 1.3.
1263 # @speed: the rate limit, bytes per second
1265 # @io-status: the status of the job (since 1.3)
1267 # @ready: true if the job may be completed (since 2.2)
1269 # @status: Current job state/status (since 2.12)
1271 # @auto-finalize: Job will finalize itself when PENDING, moving to
1272 #                 the CONCLUDED state. (since 2.12)
1274 # @auto-dismiss: Job will dismiss itself when CONCLUDED, moving to the NULL
1275 #                state and disappearing from the query list. (since 2.12)
1277 # @error: Error information if the job did not complete successfully.
1278 #         Not set if the job completed successfully. (since 2.12.1)
1280 # Since: 1.1
1282 { 'struct': 'BlockJobInfo',
1283   'data': {'type': 'str', 'device': 'str', 'len': 'int',
1284            'offset': 'int', 'busy': 'bool', 'paused': 'bool', 'speed': 'int',
1285            'io-status': 'BlockDeviceIoStatus', 'ready': 'bool',
1286            'status': 'JobStatus',
1287            'auto-finalize': 'bool', 'auto-dismiss': 'bool',
1288            '*error': 'str' } }
1291 # @query-block-jobs:
1293 # Return information about long-running block device operations.
1295 # Returns: a list of @BlockJobInfo for each active block job
1297 # Since: 1.1
1299 { 'command': 'query-block-jobs', 'returns': ['BlockJobInfo'] }
1302 # @block_passwd:
1304 # This command sets the password of a block device that has not been open
1305 # with a password and requires one.
1307 # This command is now obsolete and will always return an error since 2.10
1310 { 'command': 'block_passwd',
1311   'data': { '*device': 'str',
1312             '*node-name': 'str',
1313             'password': 'str' } }
1316 # @block_resize:
1318 # Resize a block image while a guest is running.
1320 # Either @device or @node-name must be set but not both.
1322 # @device: the name of the device to get the image resized
1324 # @node-name: graph node name to get the image resized (Since 2.0)
1326 # @size:  new image size in bytes
1328 # Returns: - nothing on success
1329 #          - If @device is not a valid block device, DeviceNotFound
1331 # Since: 0.14.0
1333 # Example:
1335 # -> { "execute": "block_resize",
1336 #      "arguments": { "device": "scratch", "size": 1073741824 } }
1337 # <- { "return": {} }
1340 { 'command': 'block_resize',
1341   'data': { '*device': 'str',
1342             '*node-name': 'str',
1343             'size': 'int' },
1344   'coroutine': true }
1347 # @NewImageMode:
1349 # An enumeration that tells QEMU how to set the backing file path in
1350 # a new image file.
1352 # @existing: QEMU should look for an existing image file.
1354 # @absolute-paths: QEMU should create a new image with absolute paths
1355 #                  for the backing file. If there is no backing file available, the new
1356 #                  image will not be backed either.
1358 # Since: 1.1
1360 { 'enum': 'NewImageMode',
1361   'data': [ 'existing', 'absolute-paths' ] }
1364 # @BlockdevSnapshotSync:
1366 # Either @device or @node-name must be set but not both.
1368 # @device: the name of the device to take a snapshot of.
1370 # @node-name: graph node name to generate the snapshot from (Since 2.0)
1372 # @snapshot-file: the target of the new overlay image. If the file
1373 #                 exists, or if it is a device, the overlay will be created in the
1374 #                 existing file/device. Otherwise, a new file will be created.
1376 # @snapshot-node-name: the graph node name of the new image (Since 2.0)
1378 # @format: the format of the overlay image, default is 'qcow2'.
1380 # @mode: whether and how QEMU should create a new image, default is
1381 #        'absolute-paths'.
1383 { 'struct': 'BlockdevSnapshotSync',
1384   'data': { '*device': 'str', '*node-name': 'str',
1385             'snapshot-file': 'str', '*snapshot-node-name': 'str',
1386             '*format': 'str', '*mode': 'NewImageMode' } }
1389 # @BlockdevSnapshot:
1391 # @node: device or node name that will have a snapshot taken.
1393 # @overlay: reference to the existing block device that will become
1394 #           the overlay of @node, as part of taking the snapshot.
1395 #           It must not have a current backing file (this can be
1396 #           achieved by passing "backing": null to blockdev-add).
1398 # Since: 2.5
1400 { 'struct': 'BlockdevSnapshot',
1401   'data': { 'node': 'str', 'overlay': 'str' } }
1404 # @BackupCommon:
1406 # @job-id: identifier for the newly-created block job. If
1407 #          omitted, the device name will be used. (Since 2.7)
1409 # @device: the device name or node-name of a root node which should be copied.
1411 # @sync: what parts of the disk image should be copied to the destination
1412 #        (all the disk, only the sectors allocated in the topmost image, from a
1413 #        dirty bitmap, or only new I/O).
1415 # @speed: the maximum speed, in bytes per second. The default is 0,
1416 #         for unlimited.
1418 # @bitmap: The name of a dirty bitmap to use.
1419 #          Must be present if sync is "bitmap" or "incremental".
1420 #          Can be present if sync is "full" or "top".
1421 #          Must not be present otherwise.
1422 #          (Since 2.4 (drive-backup), 3.1 (blockdev-backup))
1424 # @bitmap-mode: Specifies the type of data the bitmap should contain after
1425 #               the operation concludes.
1426 #               Must be present if a bitmap was provided,
1427 #               Must NOT be present otherwise. (Since 4.2)
1429 # @compress: true to compress data, if the target format supports it.
1430 #            (default: false) (since 2.8)
1432 # @on-source-error: the action to take on an error on the source,
1433 #                   default 'report'.  'stop' and 'enospc' can only be used
1434 #                   if the block device supports io-status (see BlockInfo).
1436 # @on-target-error: the action to take on an error on the target,
1437 #                   default 'report' (no limitations, since this applies to
1438 #                   a different block device than @device).
1440 # @auto-finalize: When false, this job will wait in a PENDING state after it has
1441 #                 finished its work, waiting for @block-job-finalize before
1442 #                 making any block graph changes.
1443 #                 When true, this job will automatically
1444 #                 perform its abort or commit actions.
1445 #                 Defaults to true. (Since 2.12)
1447 # @auto-dismiss: When false, this job will wait in a CONCLUDED state after it
1448 #                has completely ceased all work, and awaits @block-job-dismiss.
1449 #                When true, this job will automatically disappear from the query
1450 #                list without user intervention.
1451 #                Defaults to true. (Since 2.12)
1453 # @filter-node-name: the node name that should be assigned to the
1454 #                    filter driver that the backup job inserts into the graph
1455 #                    above node specified by @drive. If this option is not given,
1456 #                    a node name is autogenerated. (Since: 4.2)
1458 # Note: @on-source-error and @on-target-error only affect background
1459 #       I/O.  If an error occurs during a guest write request, the device's
1460 #       rerror/werror actions will be used.
1462 # Since: 4.2
1464 { 'struct': 'BackupCommon',
1465   'data': { '*job-id': 'str', 'device': 'str',
1466             'sync': 'MirrorSyncMode', '*speed': 'int',
1467             '*bitmap': 'str', '*bitmap-mode': 'BitmapSyncMode',
1468             '*compress': 'bool',
1469             '*on-source-error': 'BlockdevOnError',
1470             '*on-target-error': 'BlockdevOnError',
1471             '*auto-finalize': 'bool', '*auto-dismiss': 'bool',
1472             '*filter-node-name': 'str' } }
1475 # @DriveBackup:
1477 # @target: the target of the new image. If the file exists, or if it
1478 #          is a device, the existing file/device will be used as the new
1479 #          destination.  If it does not exist, a new file will be created.
1481 # @format: the format of the new destination, default is to
1482 #          probe if @mode is 'existing', else the format of the source
1484 # @mode: whether and how QEMU should create a new image, default is
1485 #        'absolute-paths'.
1487 # Since: 1.6
1489 { 'struct': 'DriveBackup',
1490   'base': 'BackupCommon',
1491   'data': { 'target': 'str',
1492             '*format': 'str',
1493             '*mode': 'NewImageMode' } }
1496 # @BlockdevBackup:
1498 # @target: the device name or node-name of the backup target node.
1500 # Since: 2.3
1502 { 'struct': 'BlockdevBackup',
1503   'base': 'BackupCommon',
1504   'data': { 'target': 'str' } }
1507 # @blockdev-snapshot-sync:
1509 # Takes a synchronous snapshot of a block device.
1511 # For the arguments, see the documentation of BlockdevSnapshotSync.
1513 # Returns: - nothing on success
1514 #          - If @device is not a valid block device, DeviceNotFound
1516 # Since: 0.14.0
1518 # Example:
1520 # -> { "execute": "blockdev-snapshot-sync",
1521 #      "arguments": { "device": "ide-hd0",
1522 #                     "snapshot-file":
1523 #                     "/some/place/my-image",
1524 #                     "format": "qcow2" } }
1525 # <- { "return": {} }
1528 { 'command': 'blockdev-snapshot-sync',
1529   'data': 'BlockdevSnapshotSync' }
1533 # @blockdev-snapshot:
1535 # Takes a snapshot of a block device.
1537 # Take a snapshot, by installing 'node' as the backing image of
1538 # 'overlay'. Additionally, if 'node' is associated with a block
1539 # device, the block device changes to using 'overlay' as its new active
1540 # image.
1542 # For the arguments, see the documentation of BlockdevSnapshot.
1544 # Features:
1545 # @allow-write-only-overlay: If present, the check whether this operation is safe
1546 #                            was relaxed so that it can be used to change
1547 #                            backing file of a destination of a blockdev-mirror.
1548 #                            (since 5.0)
1550 # Since: 2.5
1552 # Example:
1554 # -> { "execute": "blockdev-add",
1555 #      "arguments": { "driver": "qcow2",
1556 #                     "node-name": "node1534",
1557 #                     "file": { "driver": "file",
1558 #                               "filename": "hd1.qcow2" },
1559 #                     "backing": null } }
1561 # <- { "return": {} }
1563 # -> { "execute": "blockdev-snapshot",
1564 #      "arguments": { "node": "ide-hd0",
1565 #                     "overlay": "node1534" } }
1566 # <- { "return": {} }
1569 { 'command': 'blockdev-snapshot',
1570   'data': 'BlockdevSnapshot',
1571   'features': [ 'allow-write-only-overlay' ] }
1574 # @change-backing-file:
1576 # Change the backing file in the image file metadata.  This does not
1577 # cause QEMU to reopen the image file to reparse the backing filename
1578 # (it may, however, perform a reopen to change permissions from
1579 # r/o -> r/w -> r/o, if needed). The new backing file string is written
1580 # into the image file metadata, and the QEMU internal strings are
1581 # updated.
1583 # @image-node-name: The name of the block driver state node of the
1584 #                   image to modify. The "device" argument is used
1585 #                   to verify "image-node-name" is in the chain
1586 #                   described by "device".
1588 # @device: The device name or node-name of the root node that owns
1589 #          image-node-name.
1591 # @backing-file: The string to write as the backing file.  This
1592 #                string is not validated, so care should be taken
1593 #                when specifying the string or the image chain may
1594 #                not be able to be reopened again.
1596 # Returns: - Nothing on success
1597 #          - If "device" does not exist or cannot be determined, DeviceNotFound
1599 # Since: 2.1
1601 { 'command': 'change-backing-file',
1602   'data': { 'device': 'str', 'image-node-name': 'str',
1603             'backing-file': 'str' } }
1606 # @block-commit:
1608 # Live commit of data from overlay image nodes into backing nodes - i.e.,
1609 # writes data between 'top' and 'base' into 'base'.
1611 # If top == base, that is an error.
1612 # If top has no overlays on top of it, or if it is in use by a writer,
1613 # the job will not be completed by itself.  The user needs to complete
1614 # the job with the block-job-complete command after getting the ready
1615 # event. (Since 2.0)
1617 # If the base image is smaller than top, then the base image will be
1618 # resized to be the same size as top.  If top is smaller than the base
1619 # image, the base will not be truncated.  If you want the base image
1620 # size to match the size of the smaller top, you can safely truncate
1621 # it yourself once the commit operation successfully completes.
1623 # @job-id: identifier for the newly-created block job. If
1624 #          omitted, the device name will be used. (Since 2.7)
1626 # @device: the device name or node-name of a root node
1628 # @base-node: The node name of the backing image to write data into.
1629 #             If not specified, this is the deepest backing image.
1630 #             (since: 3.1)
1632 # @base: Same as @base-node, except that it is a file name rather than a node
1633 #        name. This must be the exact filename string that was used to open the
1634 #        node; other strings, even if addressing the same file, are not
1635 #        accepted
1637 # @top-node: The node name of the backing image within the image chain
1638 #            which contains the topmost data to be committed down. If
1639 #            not specified, this is the active layer. (since: 3.1)
1641 # @top: Same as @top-node, except that it is a file name rather than a node
1642 #       name. This must be the exact filename string that was used to open the
1643 #       node; other strings, even if addressing the same file, are not
1644 #       accepted
1646 # @backing-file: The backing file string to write into the overlay
1647 #                image of 'top'.  If 'top' does not have an overlay
1648 #                image, or if 'top' is in use by a writer, specifying
1649 #                a backing file string is an error.
1651 #                This filename is not validated.  If a pathname string
1652 #                is such that it cannot be resolved by QEMU, that
1653 #                means that subsequent QMP or HMP commands must use
1654 #                node-names for the image in question, as filename
1655 #                lookup methods will fail.
1657 #                If not specified, QEMU will automatically determine
1658 #                the backing file string to use, or error out if
1659 #                there is no obvious choice. Care should be taken
1660 #                when specifying the string, to specify a valid
1661 #                filename or protocol.
1662 #                (Since 2.1)
1664 # @speed: the maximum speed, in bytes per second
1666 # @on-error: the action to take on an error. 'ignore' means that the request
1667 #            should be retried. (default: report; Since: 5.0)
1669 # @filter-node-name: the node name that should be assigned to the
1670 #                    filter driver that the commit job inserts into the graph
1671 #                    above @top. If this option is not given, a node name is
1672 #                    autogenerated. (Since: 2.9)
1674 # @auto-finalize: When false, this job will wait in a PENDING state after it has
1675 #                 finished its work, waiting for @block-job-finalize before
1676 #                 making any block graph changes.
1677 #                 When true, this job will automatically
1678 #                 perform its abort or commit actions.
1679 #                 Defaults to true. (Since 3.1)
1681 # @auto-dismiss: When false, this job will wait in a CONCLUDED state after it
1682 #                has completely ceased all work, and awaits @block-job-dismiss.
1683 #                When true, this job will automatically disappear from the query
1684 #                list without user intervention.
1685 #                Defaults to true. (Since 3.1)
1687 # Features:
1688 # @deprecated: Members @base and @top are deprecated.  Use @base-node
1689 #              and @top-node instead.
1691 # Returns: - Nothing on success
1692 #          - If @device does not exist, DeviceNotFound
1693 #          - Any other error returns a GenericError.
1695 # Since: 1.3
1697 # Example:
1699 # -> { "execute": "block-commit",
1700 #      "arguments": { "device": "virtio0",
1701 #                     "top": "/tmp/snap1.qcow2" } }
1702 # <- { "return": {} }
1705 { 'command': 'block-commit',
1706   'data': { '*job-id': 'str', 'device': 'str', '*base-node': 'str',
1707             '*base': { 'type': 'str', 'features': [ 'deprecated' ] },
1708             '*top-node': 'str',
1709             '*top': { 'type': 'str', 'features': [ 'deprecated' ] },
1710             '*backing-file': 'str', '*speed': 'int',
1711             '*on-error': 'BlockdevOnError',
1712             '*filter-node-name': 'str',
1713             '*auto-finalize': 'bool', '*auto-dismiss': 'bool' } }
1716 # @drive-backup:
1718 # Start a point-in-time copy of a block device to a new destination.  The
1719 # status of ongoing drive-backup operations can be checked with
1720 # query-block-jobs where the BlockJobInfo.type field has the value 'backup'.
1721 # The operation can be stopped before it has completed using the
1722 # block-job-cancel command.
1724 # Returns: - nothing on success
1725 #          - If @device is not a valid block device, GenericError
1727 # Since: 1.6
1729 # Example:
1731 # -> { "execute": "drive-backup",
1732 #      "arguments": { "device": "drive0",
1733 #                     "sync": "full",
1734 #                     "target": "backup.img" } }
1735 # <- { "return": {} }
1738 { 'command': 'drive-backup', 'boxed': true,
1739   'data': 'DriveBackup' }
1742 # @blockdev-backup:
1744 # Start a point-in-time copy of a block device to a new destination.  The
1745 # status of ongoing blockdev-backup operations can be checked with
1746 # query-block-jobs where the BlockJobInfo.type field has the value 'backup'.
1747 # The operation can be stopped before it has completed using the
1748 # block-job-cancel command.
1750 # Returns: - nothing on success
1751 #          - If @device is not a valid block device, DeviceNotFound
1753 # Since: 2.3
1755 # Example:
1756 # -> { "execute": "blockdev-backup",
1757 #      "arguments": { "device": "src-id",
1758 #                     "sync": "full",
1759 #                     "target": "tgt-id" } }
1760 # <- { "return": {} }
1763 { 'command': 'blockdev-backup', 'boxed': true,
1764   'data': 'BlockdevBackup' }
1768 # @query-named-block-nodes:
1770 # Get the named block driver list
1772 # @flat: Omit the nested data about backing image ("backing-image" key) if true.
1773 #        Default is false (Since 5.0)
1775 # Returns: the list of BlockDeviceInfo
1777 # Since: 2.0
1779 # Example:
1781 # -> { "execute": "query-named-block-nodes" }
1782 # <- { "return": [ { "ro":false,
1783 #                    "drv":"qcow2",
1784 #                    "encrypted":false,
1785 #                    "file":"disks/test.qcow2",
1786 #                    "node-name": "my-node",
1787 #                    "backing_file_depth":1,
1788 #                    "bps":1000000,
1789 #                    "bps_rd":0,
1790 #                    "bps_wr":0,
1791 #                    "iops":1000000,
1792 #                    "iops_rd":0,
1793 #                    "iops_wr":0,
1794 #                    "bps_max": 8000000,
1795 #                    "bps_rd_max": 0,
1796 #                    "bps_wr_max": 0,
1797 #                    "iops_max": 0,
1798 #                    "iops_rd_max": 0,
1799 #                    "iops_wr_max": 0,
1800 #                    "iops_size": 0,
1801 #                    "write_threshold": 0,
1802 #                    "image":{
1803 #                       "filename":"disks/test.qcow2",
1804 #                       "format":"qcow2",
1805 #                       "virtual-size":2048000,
1806 #                       "backing_file":"base.qcow2",
1807 #                       "full-backing-filename":"disks/base.qcow2",
1808 #                       "backing-filename-format":"qcow2",
1809 #                       "snapshots":[
1810 #                          {
1811 #                             "id": "1",
1812 #                             "name": "snapshot1",
1813 #                             "vm-state-size": 0,
1814 #                             "date-sec": 10000200,
1815 #                             "date-nsec": 12,
1816 #                             "vm-clock-sec": 206,
1817 #                             "vm-clock-nsec": 30
1818 #                          }
1819 #                       ],
1820 #                       "backing-image":{
1821 #                           "filename":"disks/base.qcow2",
1822 #                           "format":"qcow2",
1823 #                           "virtual-size":2048000
1824 #                       }
1825 #                    } } ] }
1828 { 'command': 'query-named-block-nodes',
1829   'returns': [ 'BlockDeviceInfo' ],
1830   'data': { '*flat': 'bool' } }
1833 # @XDbgBlockGraphNodeType:
1835 # @block-backend: corresponds to BlockBackend
1837 # @block-job: corresponds to BlockJob
1839 # @block-driver: corresponds to BlockDriverState
1841 # Since: 4.0
1843 { 'enum': 'XDbgBlockGraphNodeType',
1844   'data': [ 'block-backend', 'block-job', 'block-driver' ] }
1847 # @XDbgBlockGraphNode:
1849 # @id: Block graph node identifier. This @id is generated only for
1850 #      x-debug-query-block-graph and does not relate to any other identifiers in
1851 #      Qemu.
1853 # @type: Type of graph node. Can be one of block-backend, block-job or
1854 #        block-driver-state.
1856 # @name: Human readable name of the node. Corresponds to node-name for
1857 #        block-driver-state nodes; is not guaranteed to be unique in the whole
1858 #        graph (with block-jobs and block-backends).
1860 # Since: 4.0
1862 { 'struct': 'XDbgBlockGraphNode',
1863   'data': { 'id': 'uint64', 'type': 'XDbgBlockGraphNodeType', 'name': 'str' } }
1866 # @BlockPermission:
1868 # Enum of base block permissions.
1870 # @consistent-read: A user that has the "permission" of consistent reads is
1871 #                   guaranteed that their view of the contents of the block
1872 #                   device is complete and self-consistent, representing the
1873 #                   contents of a disk at a specific point.
1874 #                   For most block devices (including their backing files) this
1875 #                   is true, but the property cannot be maintained in a few
1876 #                   situations like for intermediate nodes of a commit block
1877 #                   job.
1879 # @write: This permission is required to change the visible disk contents.
1881 # @write-unchanged: This permission (which is weaker than BLK_PERM_WRITE) is
1882 #                   both enough and required for writes to the block node when
1883 #                   the caller promises that the visible disk content doesn't
1884 #                   change.
1885 #                   As the BLK_PERM_WRITE permission is strictly stronger,
1886 #                   either is sufficient to perform an unchanging write.
1888 # @resize: This permission is required to change the size of a block node.
1890 # @graph-mod: This permission is required to change the node that this
1891 #             BdrvChild points to.
1893 # Since: 4.0
1895 { 'enum': 'BlockPermission',
1896   'data': [ 'consistent-read', 'write', 'write-unchanged', 'resize',
1897             'graph-mod' ] }
1899 # @XDbgBlockGraphEdge:
1901 # Block Graph edge description for x-debug-query-block-graph.
1903 # @parent: parent id
1905 # @child: child id
1907 # @name: name of the relation (examples are 'file' and 'backing')
1909 # @perm: granted permissions for the parent operating on the child
1911 # @shared-perm: permissions that can still be granted to other users of the
1912 #               child while it is still attached to this parent
1914 # Since: 4.0
1916 { 'struct': 'XDbgBlockGraphEdge',
1917   'data': { 'parent': 'uint64', 'child': 'uint64',
1918             'name': 'str', 'perm': [ 'BlockPermission' ],
1919             'shared-perm': [ 'BlockPermission' ] } }
1922 # @XDbgBlockGraph:
1924 # Block Graph - list of nodes and list of edges.
1926 # Since: 4.0
1928 { 'struct': 'XDbgBlockGraph',
1929   'data': { 'nodes': ['XDbgBlockGraphNode'], 'edges': ['XDbgBlockGraphEdge'] } }
1932 # @x-debug-query-block-graph:
1934 # Get the block graph.
1936 # Since: 4.0
1938 { 'command': 'x-debug-query-block-graph', 'returns': 'XDbgBlockGraph' }
1941 # @drive-mirror:
1943 # Start mirroring a block device's writes to a new destination. target
1944 # specifies the target of the new image. If the file exists, or if it
1945 # is a device, it will be used as the new destination for writes. If
1946 # it does not exist, a new file will be created. format specifies the
1947 # format of the mirror image, default is to probe if mode='existing',
1948 # else the format of the source.
1950 # Returns: - nothing on success
1951 #          - If @device is not a valid block device, GenericError
1953 # Since: 1.3
1955 # Example:
1957 # -> { "execute": "drive-mirror",
1958 #      "arguments": { "device": "ide-hd0",
1959 #                     "target": "/some/place/my-image",
1960 #                     "sync": "full",
1961 #                     "format": "qcow2" } }
1962 # <- { "return": {} }
1965 { 'command': 'drive-mirror', 'boxed': true,
1966   'data': 'DriveMirror' }
1969 # @DriveMirror:
1971 # A set of parameters describing drive mirror setup.
1973 # @job-id: identifier for the newly-created block job. If
1974 #          omitted, the device name will be used. (Since 2.7)
1976 # @device:  the device name or node-name of a root node whose writes should be
1977 #           mirrored.
1979 # @target: the target of the new image. If the file exists, or if it
1980 #          is a device, the existing file/device will be used as the new
1981 #          destination.  If it does not exist, a new file will be created.
1983 # @format: the format of the new destination, default is to
1984 #          probe if @mode is 'existing', else the format of the source
1986 # @node-name: the new block driver state node name in the graph
1987 #             (Since 2.1)
1989 # @replaces: with sync=full graph node name to be replaced by the new
1990 #            image when a whole image copy is done. This can be used to repair
1991 #            broken Quorum files.  By default, @device is replaced, although
1992 #            implicitly created filters on it are kept. (Since 2.1)
1994 # @mode: whether and how QEMU should create a new image, default is
1995 #        'absolute-paths'.
1997 # @speed:  the maximum speed, in bytes per second
1999 # @sync: what parts of the disk image should be copied to the destination
2000 #        (all the disk, only the sectors allocated in the topmost image, or
2001 #        only new I/O).
2003 # @granularity: granularity of the dirty bitmap, default is 64K
2004 #               if the image format doesn't have clusters, 4K if the clusters
2005 #               are smaller than that, else the cluster size.  Must be a
2006 #               power of 2 between 512 and 64M (since 1.4).
2008 # @buf-size: maximum amount of data in flight from source to
2009 #            target (since 1.4).
2011 # @on-source-error: the action to take on an error on the source,
2012 #                   default 'report'.  'stop' and 'enospc' can only be used
2013 #                   if the block device supports io-status (see BlockInfo).
2015 # @on-target-error: the action to take on an error on the target,
2016 #                   default 'report' (no limitations, since this applies to
2017 #                   a different block device than @device).
2018 # @unmap: Whether to try to unmap target sectors where source has
2019 #         only zero. If true, and target unallocated sectors will read as zero,
2020 #         target image sectors will be unmapped; otherwise, zeroes will be
2021 #         written. Both will result in identical contents.
2022 #         Default is true. (Since 2.4)
2024 # @copy-mode: when to copy data to the destination; defaults to 'background'
2025 #             (Since: 3.0)
2027 # @auto-finalize: When false, this job will wait in a PENDING state after it has
2028 #                 finished its work, waiting for @block-job-finalize before
2029 #                 making any block graph changes.
2030 #                 When true, this job will automatically
2031 #                 perform its abort or commit actions.
2032 #                 Defaults to true. (Since 3.1)
2034 # @auto-dismiss: When false, this job will wait in a CONCLUDED state after it
2035 #                has completely ceased all work, and awaits @block-job-dismiss.
2036 #                When true, this job will automatically disappear from the query
2037 #                list without user intervention.
2038 #                Defaults to true. (Since 3.1)
2039 # Since: 1.3
2041 { 'struct': 'DriveMirror',
2042   'data': { '*job-id': 'str', 'device': 'str', 'target': 'str',
2043             '*format': 'str', '*node-name': 'str', '*replaces': 'str',
2044             'sync': 'MirrorSyncMode', '*mode': 'NewImageMode',
2045             '*speed': 'int', '*granularity': 'uint32',
2046             '*buf-size': 'int', '*on-source-error': 'BlockdevOnError',
2047             '*on-target-error': 'BlockdevOnError',
2048             '*unmap': 'bool', '*copy-mode': 'MirrorCopyMode',
2049             '*auto-finalize': 'bool', '*auto-dismiss': 'bool' } }
2052 # @BlockDirtyBitmap:
2054 # @node: name of device/node which the bitmap is tracking
2056 # @name: name of the dirty bitmap
2058 # Since: 2.4
2060 { 'struct': 'BlockDirtyBitmap',
2061   'data': { 'node': 'str', 'name': 'str' } }
2064 # @BlockDirtyBitmapAdd:
2066 # @node: name of device/node which the bitmap is tracking
2068 # @name: name of the dirty bitmap (must be less than 1024 bytes)
2070 # @granularity: the bitmap granularity, default is 64k for
2071 #               block-dirty-bitmap-add
2073 # @persistent: the bitmap is persistent, i.e. it will be saved to the
2074 #              corresponding block device image file on its close. For now only
2075 #              Qcow2 disks support persistent bitmaps. Default is false for
2076 #              block-dirty-bitmap-add. (Since: 2.10)
2078 # @disabled: the bitmap is created in the disabled state, which means that
2079 #            it will not track drive changes. The bitmap may be enabled with
2080 #            block-dirty-bitmap-enable. Default is false. (Since: 4.0)
2082 # Since: 2.4
2084 { 'struct': 'BlockDirtyBitmapAdd',
2085   'data': { 'node': 'str', 'name': 'str', '*granularity': 'uint32',
2086             '*persistent': 'bool', '*disabled': 'bool' } }
2089 # @BlockDirtyBitmapMergeSource:
2091 # @local: name of the bitmap, attached to the same node as target bitmap.
2093 # @external: bitmap with specified node
2095 # Since: 4.1
2097 { 'alternate': 'BlockDirtyBitmapMergeSource',
2098   'data': { 'local': 'str',
2099             'external': 'BlockDirtyBitmap' } }
2102 # @BlockDirtyBitmapMerge:
2104 # @node: name of device/node which the @target bitmap is tracking
2106 # @target: name of the destination dirty bitmap
2108 # @bitmaps: name(s) of the source dirty bitmap(s) at @node and/or fully
2109 #           specified BlockDirtyBitmap elements. The latter are supported
2110 #           since 4.1.
2112 # Since: 4.0
2114 { 'struct': 'BlockDirtyBitmapMerge',
2115   'data': { 'node': 'str', 'target': 'str',
2116             'bitmaps': ['BlockDirtyBitmapMergeSource'] } }
2119 # @block-dirty-bitmap-add:
2121 # Create a dirty bitmap with a name on the node, and start tracking the writes.
2123 # Returns: - nothing on success
2124 #          - If @node is not a valid block device or node, DeviceNotFound
2125 #          - If @name is already taken, GenericError with an explanation
2127 # Since: 2.4
2129 # Example:
2131 # -> { "execute": "block-dirty-bitmap-add",
2132 #      "arguments": { "node": "drive0", "name": "bitmap0" } }
2133 # <- { "return": {} }
2136 { 'command': 'block-dirty-bitmap-add',
2137   'data': 'BlockDirtyBitmapAdd' }
2140 # @block-dirty-bitmap-remove:
2142 # Stop write tracking and remove the dirty bitmap that was created
2143 # with block-dirty-bitmap-add. If the bitmap is persistent, remove it from its
2144 # storage too.
2146 # Returns: - nothing on success
2147 #          - If @node is not a valid block device or node, DeviceNotFound
2148 #          - If @name is not found, GenericError with an explanation
2149 #          - if @name is frozen by an operation, GenericError
2151 # Since: 2.4
2153 # Example:
2155 # -> { "execute": "block-dirty-bitmap-remove",
2156 #      "arguments": { "node": "drive0", "name": "bitmap0" } }
2157 # <- { "return": {} }
2160 { 'command': 'block-dirty-bitmap-remove',
2161   'data': 'BlockDirtyBitmap' }
2164 # @block-dirty-bitmap-clear:
2166 # Clear (reset) a dirty bitmap on the device, so that an incremental
2167 # backup from this point in time forward will only backup clusters
2168 # modified after this clear operation.
2170 # Returns: - nothing on success
2171 #          - If @node is not a valid block device, DeviceNotFound
2172 #          - If @name is not found, GenericError with an explanation
2174 # Since: 2.4
2176 # Example:
2178 # -> { "execute": "block-dirty-bitmap-clear",
2179 #      "arguments": { "node": "drive0", "name": "bitmap0" } }
2180 # <- { "return": {} }
2183 { 'command': 'block-dirty-bitmap-clear',
2184   'data': 'BlockDirtyBitmap' }
2187 # @block-dirty-bitmap-enable:
2189 # Enables a dirty bitmap so that it will begin tracking disk changes.
2191 # Returns: - nothing on success
2192 #          - If @node is not a valid block device, DeviceNotFound
2193 #          - If @name is not found, GenericError with an explanation
2195 # Since: 4.0
2197 # Example:
2199 # -> { "execute": "block-dirty-bitmap-enable",
2200 #      "arguments": { "node": "drive0", "name": "bitmap0" } }
2201 # <- { "return": {} }
2204 { 'command': 'block-dirty-bitmap-enable',
2205   'data': 'BlockDirtyBitmap' }
2208 # @block-dirty-bitmap-disable:
2210 # Disables a dirty bitmap so that it will stop tracking disk changes.
2212 # Returns: - nothing on success
2213 #          - If @node is not a valid block device, DeviceNotFound
2214 #          - If @name is not found, GenericError with an explanation
2216 # Since: 4.0
2218 # Example:
2220 # -> { "execute": "block-dirty-bitmap-disable",
2221 #      "arguments": { "node": "drive0", "name": "bitmap0" } }
2222 # <- { "return": {} }
2225 { 'command': 'block-dirty-bitmap-disable',
2226   'data': 'BlockDirtyBitmap' }
2229 # @block-dirty-bitmap-merge:
2231 # Merge dirty bitmaps listed in @bitmaps to the @target dirty bitmap.
2232 # Dirty bitmaps in @bitmaps will be unchanged, except if it also appears
2233 # as the @target bitmap. Any bits already set in @target will still be
2234 # set after the merge, i.e., this operation does not clear the target.
2235 # On error, @target is unchanged.
2237 # The resulting bitmap will count as dirty any clusters that were dirty in any
2238 # of the source bitmaps. This can be used to achieve backup checkpoints, or in
2239 # simpler usages, to copy bitmaps.
2241 # Returns: - nothing on success
2242 #          - If @node is not a valid block device, DeviceNotFound
2243 #          - If any bitmap in @bitmaps or @target is not found, GenericError
2244 #          - If any of the bitmaps have different sizes or granularities,
2245 #            GenericError
2247 # Since: 4.0
2249 # Example:
2251 # -> { "execute": "block-dirty-bitmap-merge",
2252 #      "arguments": { "node": "drive0", "target": "bitmap0",
2253 #                     "bitmaps": ["bitmap1"] } }
2254 # <- { "return": {} }
2257 { 'command': 'block-dirty-bitmap-merge',
2258   'data': 'BlockDirtyBitmapMerge' }
2261 # @BlockDirtyBitmapSha256:
2263 # SHA256 hash of dirty bitmap data
2265 # @sha256: ASCII representation of SHA256 bitmap hash
2267 # Since: 2.10
2269 { 'struct': 'BlockDirtyBitmapSha256',
2270   'data': {'sha256': 'str'} }
2273 # @x-debug-block-dirty-bitmap-sha256:
2275 # Get bitmap SHA256.
2277 # Returns: - BlockDirtyBitmapSha256 on success
2278 #          - If @node is not a valid block device, DeviceNotFound
2279 #          - If @name is not found or if hashing has failed, GenericError with an
2280 #            explanation
2282 # Since: 2.10
2284 { 'command': 'x-debug-block-dirty-bitmap-sha256',
2285   'data': 'BlockDirtyBitmap', 'returns': 'BlockDirtyBitmapSha256' }
2288 # @blockdev-mirror:
2290 # Start mirroring a block device's writes to a new destination.
2292 # @job-id: identifier for the newly-created block job. If
2293 #          omitted, the device name will be used. (Since 2.7)
2295 # @device: The device name or node-name of a root node whose writes should be
2296 #          mirrored.
2298 # @target: the id or node-name of the block device to mirror to. This mustn't be
2299 #          attached to guest.
2301 # @replaces: with sync=full graph node name to be replaced by the new
2302 #            image when a whole image copy is done. This can be used to repair
2303 #            broken Quorum files.  By default, @device is replaced, although
2304 #            implicitly created filters on it are kept.
2306 # @speed:  the maximum speed, in bytes per second
2308 # @sync: what parts of the disk image should be copied to the destination
2309 #        (all the disk, only the sectors allocated in the topmost image, or
2310 #        only new I/O).
2312 # @granularity: granularity of the dirty bitmap, default is 64K
2313 #               if the image format doesn't have clusters, 4K if the clusters
2314 #               are smaller than that, else the cluster size.  Must be a
2315 #               power of 2 between 512 and 64M
2317 # @buf-size: maximum amount of data in flight from source to
2318 #            target
2320 # @on-source-error: the action to take on an error on the source,
2321 #                   default 'report'.  'stop' and 'enospc' can only be used
2322 #                   if the block device supports io-status (see BlockInfo).
2324 # @on-target-error: the action to take on an error on the target,
2325 #                   default 'report' (no limitations, since this applies to
2326 #                   a different block device than @device).
2328 # @filter-node-name: the node name that should be assigned to the
2329 #                    filter driver that the mirror job inserts into the graph
2330 #                    above @device. If this option is not given, a node name is
2331 #                    autogenerated. (Since: 2.9)
2333 # @copy-mode: when to copy data to the destination; defaults to 'background'
2334 #             (Since: 3.0)
2336 # @auto-finalize: When false, this job will wait in a PENDING state after it has
2337 #                 finished its work, waiting for @block-job-finalize before
2338 #                 making any block graph changes.
2339 #                 When true, this job will automatically
2340 #                 perform its abort or commit actions.
2341 #                 Defaults to true. (Since 3.1)
2343 # @auto-dismiss: When false, this job will wait in a CONCLUDED state after it
2344 #                has completely ceased all work, and awaits @block-job-dismiss.
2345 #                When true, this job will automatically disappear from the query
2346 #                list without user intervention.
2347 #                Defaults to true. (Since 3.1)
2348 # Returns: nothing on success.
2350 # Since: 2.6
2352 # Example:
2354 # -> { "execute": "blockdev-mirror",
2355 #      "arguments": { "device": "ide-hd0",
2356 #                     "target": "target0",
2357 #                     "sync": "full" } }
2358 # <- { "return": {} }
2361 { 'command': 'blockdev-mirror',
2362   'data': { '*job-id': 'str', 'device': 'str', 'target': 'str',
2363             '*replaces': 'str',
2364             'sync': 'MirrorSyncMode',
2365             '*speed': 'int', '*granularity': 'uint32',
2366             '*buf-size': 'int', '*on-source-error': 'BlockdevOnError',
2367             '*on-target-error': 'BlockdevOnError',
2368             '*filter-node-name': 'str',
2369             '*copy-mode': 'MirrorCopyMode',
2370             '*auto-finalize': 'bool', '*auto-dismiss': 'bool' } }
2373 # @BlockIOThrottle:
2375 # A set of parameters describing block throttling.
2377 # @device: Block device name
2379 # @id: The name or QOM path of the guest device (since: 2.8)
2381 # @bps: total throughput limit in bytes per second
2383 # @bps_rd: read throughput limit in bytes per second
2385 # @bps_wr: write throughput limit in bytes per second
2387 # @iops: total I/O operations per second
2389 # @iops_rd: read I/O operations per second
2391 # @iops_wr: write I/O operations per second
2393 # @bps_max: total throughput limit during bursts,
2394 #           in bytes (Since 1.7)
2396 # @bps_rd_max: read throughput limit during bursts,
2397 #              in bytes (Since 1.7)
2399 # @bps_wr_max: write throughput limit during bursts,
2400 #              in bytes (Since 1.7)
2402 # @iops_max: total I/O operations per second during bursts,
2403 #            in bytes (Since 1.7)
2405 # @iops_rd_max: read I/O operations per second during bursts,
2406 #               in bytes (Since 1.7)
2408 # @iops_wr_max: write I/O operations per second during bursts,
2409 #               in bytes (Since 1.7)
2411 # @bps_max_length: maximum length of the @bps_max burst
2412 #                  period, in seconds. It must only
2413 #                  be set if @bps_max is set as well.
2414 #                  Defaults to 1. (Since 2.6)
2416 # @bps_rd_max_length: maximum length of the @bps_rd_max
2417 #                     burst period, in seconds. It must only
2418 #                     be set if @bps_rd_max is set as well.
2419 #                     Defaults to 1. (Since 2.6)
2421 # @bps_wr_max_length: maximum length of the @bps_wr_max
2422 #                     burst period, in seconds. It must only
2423 #                     be set if @bps_wr_max is set as well.
2424 #                     Defaults to 1. (Since 2.6)
2426 # @iops_max_length: maximum length of the @iops burst
2427 #                   period, in seconds. It must only
2428 #                   be set if @iops_max is set as well.
2429 #                   Defaults to 1. (Since 2.6)
2431 # @iops_rd_max_length: maximum length of the @iops_rd_max
2432 #                      burst period, in seconds. It must only
2433 #                      be set if @iops_rd_max is set as well.
2434 #                      Defaults to 1. (Since 2.6)
2436 # @iops_wr_max_length: maximum length of the @iops_wr_max
2437 #                      burst period, in seconds. It must only
2438 #                      be set if @iops_wr_max is set as well.
2439 #                      Defaults to 1. (Since 2.6)
2441 # @iops_size: an I/O size in bytes (Since 1.7)
2443 # @group: throttle group name (Since 2.4)
2445 # Features:
2446 # @deprecated: Member @device is deprecated.  Use @id instead.
2448 # Since: 1.1
2450 { 'struct': 'BlockIOThrottle',
2451   'data': { '*device': { 'type': 'str', 'features': [ 'deprecated' ] },
2452             '*id': 'str', 'bps': 'int', 'bps_rd': 'int',
2453             'bps_wr': 'int', 'iops': 'int', 'iops_rd': 'int', 'iops_wr': 'int',
2454             '*bps_max': 'int', '*bps_rd_max': 'int',
2455             '*bps_wr_max': 'int', '*iops_max': 'int',
2456             '*iops_rd_max': 'int', '*iops_wr_max': 'int',
2457             '*bps_max_length': 'int', '*bps_rd_max_length': 'int',
2458             '*bps_wr_max_length': 'int', '*iops_max_length': 'int',
2459             '*iops_rd_max_length': 'int', '*iops_wr_max_length': 'int',
2460             '*iops_size': 'int', '*group': 'str' } }
2463 # @ThrottleLimits:
2465 # Limit parameters for throttling.
2466 # Since some limit combinations are illegal, limits should always be set in one
2467 # transaction. All fields are optional. When setting limits, if a field is
2468 # missing the current value is not changed.
2470 # @iops-total: limit total I/O operations per second
2471 # @iops-total-max: I/O operations burst
2472 # @iops-total-max-length: length of the iops-total-max burst period, in seconds
2473 #                         It must only be set if @iops-total-max is set as well.
2474 # @iops-read: limit read operations per second
2475 # @iops-read-max: I/O operations read burst
2476 # @iops-read-max-length: length of the iops-read-max burst period, in seconds
2477 #                        It must only be set if @iops-read-max is set as well.
2478 # @iops-write: limit write operations per second
2479 # @iops-write-max: I/O operations write burst
2480 # @iops-write-max-length: length of the iops-write-max burst period, in seconds
2481 #                         It must only be set if @iops-write-max is set as well.
2482 # @bps-total: limit total bytes per second
2483 # @bps-total-max: total bytes burst
2484 # @bps-total-max-length: length of the bps-total-max burst period, in seconds.
2485 #                        It must only be set if @bps-total-max is set as well.
2486 # @bps-read: limit read bytes per second
2487 # @bps-read-max: total bytes read burst
2488 # @bps-read-max-length: length of the bps-read-max burst period, in seconds
2489 #                       It must only be set if @bps-read-max is set as well.
2490 # @bps-write: limit write bytes per second
2491 # @bps-write-max: total bytes write burst
2492 # @bps-write-max-length: length of the bps-write-max burst period, in seconds
2493 #                        It must only be set if @bps-write-max is set as well.
2494 # @iops-size: when limiting by iops max size of an I/O in bytes
2496 # Since: 2.11
2498 { 'struct': 'ThrottleLimits',
2499   'data': { '*iops-total' : 'int', '*iops-total-max' : 'int',
2500             '*iops-total-max-length' : 'int', '*iops-read' : 'int',
2501             '*iops-read-max' : 'int', '*iops-read-max-length' : 'int',
2502             '*iops-write' : 'int', '*iops-write-max' : 'int',
2503             '*iops-write-max-length' : 'int', '*bps-total' : 'int',
2504             '*bps-total-max' : 'int', '*bps-total-max-length' : 'int',
2505             '*bps-read' : 'int', '*bps-read-max' : 'int',
2506             '*bps-read-max-length' : 'int', '*bps-write' : 'int',
2507             '*bps-write-max' : 'int', '*bps-write-max-length' : 'int',
2508             '*iops-size' : 'int' } }
2511 # @block-stream:
2513 # Copy data from a backing file into a block device.
2515 # The block streaming operation is performed in the background until the entire
2516 # backing file has been copied.  This command returns immediately once streaming
2517 # has started.  The status of ongoing block streaming operations can be checked
2518 # with query-block-jobs.  The operation can be stopped before it has completed
2519 # using the block-job-cancel command.
2521 # The node that receives the data is called the top image, can be located in
2522 # any part of the chain (but always above the base image; see below) and can be
2523 # specified using its device or node name. Earlier qemu versions only allowed
2524 # 'device' to name the top level node; presence of the 'base-node' parameter
2525 # during introspection can be used as a witness of the enhanced semantics
2526 # of 'device'.
2528 # If a base file is specified then sectors are not copied from that base file and
2529 # its backing chain.  This can be used to stream a subset of the backing file
2530 # chain instead of flattening the entire image.
2531 # When streaming completes the image file will have the base file as its backing
2532 # file, unless that node was changed while the job was running.  In that case,
2533 # base's parent's backing (or filtered, whichever exists) child (i.e., base at
2534 # the beginning of the job) will be the new backing file.
2536 # On successful completion the image file is updated to drop the backing file
2537 # and the BLOCK_JOB_COMPLETED event is emitted.
2539 # In case @device is a filter node, block-stream modifies the first non-filter
2540 # overlay node below it to point to the new backing node instead of modifying
2541 # @device itself.
2543 # @job-id: identifier for the newly-created block job. If
2544 #          omitted, the device name will be used. (Since 2.7)
2546 # @device: the device or node name of the top image
2548 # @base: the common backing file name.
2549 #        It cannot be set if @base-node is also set.
2551 # @base-node: the node name of the backing file.
2552 #             It cannot be set if @base is also set. (Since 2.8)
2554 # @backing-file: The backing file string to write into the top
2555 #                image. This filename is not validated.
2557 #                If a pathname string is such that it cannot be
2558 #                resolved by QEMU, that means that subsequent QMP or
2559 #                HMP commands must use node-names for the image in
2560 #                question, as filename lookup methods will fail.
2562 #                If not specified, QEMU will automatically determine
2563 #                the backing file string to use, or error out if there
2564 #                is no obvious choice.  Care should be taken when
2565 #                specifying the string, to specify a valid filename or
2566 #                protocol.
2567 #                (Since 2.1)
2569 # @speed: the maximum speed, in bytes per second
2571 # @on-error: the action to take on an error (default report).
2572 #            'stop' and 'enospc' can only be used if the block device
2573 #            supports io-status (see BlockInfo).  Since 1.3.
2575 # @auto-finalize: When false, this job will wait in a PENDING state after it has
2576 #                 finished its work, waiting for @block-job-finalize before
2577 #                 making any block graph changes.
2578 #                 When true, this job will automatically
2579 #                 perform its abort or commit actions.
2580 #                 Defaults to true. (Since 3.1)
2582 # @auto-dismiss: When false, this job will wait in a CONCLUDED state after it
2583 #                has completely ceased all work, and awaits @block-job-dismiss.
2584 #                When true, this job will automatically disappear from the query
2585 #                list without user intervention.
2586 #                Defaults to true. (Since 3.1)
2588 # Returns: - Nothing on success.
2589 #          - If @device does not exist, DeviceNotFound.
2591 # Since: 1.1
2593 # Example:
2595 # -> { "execute": "block-stream",
2596 #      "arguments": { "device": "virtio0",
2597 #                     "base": "/tmp/master.qcow2" } }
2598 # <- { "return": {} }
2601 { 'command': 'block-stream',
2602   'data': { '*job-id': 'str', 'device': 'str', '*base': 'str',
2603             '*base-node': 'str', '*backing-file': 'str', '*speed': 'int',
2604             '*on-error': 'BlockdevOnError',
2605             '*auto-finalize': 'bool', '*auto-dismiss': 'bool' } }
2608 # @block-job-set-speed:
2610 # Set maximum speed for a background block operation.
2612 # This command can only be issued when there is an active block job.
2614 # Throttling can be disabled by setting the speed to 0.
2616 # @device: The job identifier. This used to be a device name (hence
2617 #          the name of the parameter), but since QEMU 2.7 it can have
2618 #          other values.
2620 # @speed: the maximum speed, in bytes per second, or 0 for unlimited.
2621 #         Defaults to 0.
2623 # Returns: - Nothing on success
2624 #          - If no background operation is active on this device, DeviceNotActive
2626 # Since: 1.1
2628 { 'command': 'block-job-set-speed',
2629   'data': { 'device': 'str', 'speed': 'int' } }
2632 # @block-job-cancel:
2634 # Stop an active background block operation.
2636 # This command returns immediately after marking the active background block
2637 # operation for cancellation.  It is an error to call this command if no
2638 # operation is in progress.
2640 # The operation will cancel as soon as possible and then emit the
2641 # BLOCK_JOB_CANCELLED event.  Before that happens the job is still visible when
2642 # enumerated using query-block-jobs.
2644 # Note that if you issue 'block-job-cancel' after 'drive-mirror' has indicated
2645 # (via the event BLOCK_JOB_READY) that the source and destination are
2646 # synchronized, then the event triggered by this command changes to
2647 # BLOCK_JOB_COMPLETED, to indicate that the mirroring has ended and the
2648 # destination now has a point-in-time copy tied to the time of the cancellation.
2650 # For streaming, the image file retains its backing file unless the streaming
2651 # operation happens to complete just as it is being cancelled.  A new streaming
2652 # operation can be started at a later time to finish copying all data from the
2653 # backing file.
2655 # @device: The job identifier. This used to be a device name (hence
2656 #          the name of the parameter), but since QEMU 2.7 it can have
2657 #          other values.
2659 # @force: If true, and the job has already emitted the event BLOCK_JOB_READY,
2660 #         abandon the job immediately (even if it is paused) instead of waiting
2661 #         for the destination to complete its final synchronization (since 1.3)
2663 # Returns: - Nothing on success
2664 #          - If no background operation is active on this device, DeviceNotActive
2666 # Since: 1.1
2668 { 'command': 'block-job-cancel', 'data': { 'device': 'str', '*force': 'bool' } }
2671 # @block-job-pause:
2673 # Pause an active background block operation.
2675 # This command returns immediately after marking the active background block
2676 # operation for pausing.  It is an error to call this command if no
2677 # operation is in progress or if the job is already paused.
2679 # The operation will pause as soon as possible.  No event is emitted when
2680 # the operation is actually paused.  Cancelling a paused job automatically
2681 # resumes it.
2683 # @device: The job identifier. This used to be a device name (hence
2684 #          the name of the parameter), but since QEMU 2.7 it can have
2685 #          other values.
2687 # Returns: - Nothing on success
2688 #          - If no background operation is active on this device, DeviceNotActive
2690 # Since: 1.3
2692 { 'command': 'block-job-pause', 'data': { 'device': 'str' } }
2695 # @block-job-resume:
2697 # Resume an active background block operation.
2699 # This command returns immediately after resuming a paused background block
2700 # operation.  It is an error to call this command if no operation is in
2701 # progress or if the job is not paused.
2703 # This command also clears the error status of the job.
2705 # @device: The job identifier. This used to be a device name (hence
2706 #          the name of the parameter), but since QEMU 2.7 it can have
2707 #          other values.
2709 # Returns: - Nothing on success
2710 #          - If no background operation is active on this device, DeviceNotActive
2712 # Since: 1.3
2714 { 'command': 'block-job-resume', 'data': { 'device': 'str' } }
2717 # @block-job-complete:
2719 # Manually trigger completion of an active background block operation.  This
2720 # is supported for drive mirroring, where it also switches the device to
2721 # write to the target path only.  The ability to complete is signaled with
2722 # a BLOCK_JOB_READY event.
2724 # This command completes an active background block operation synchronously.
2725 # The ordering of this command's return with the BLOCK_JOB_COMPLETED event
2726 # is not defined.  Note that if an I/O error occurs during the processing of
2727 # this command: 1) the command itself will fail; 2) the error will be processed
2728 # according to the rerror/werror arguments that were specified when starting
2729 # the operation.
2731 # A cancelled or paused job cannot be completed.
2733 # @device: The job identifier. This used to be a device name (hence
2734 #          the name of the parameter), but since QEMU 2.7 it can have
2735 #          other values.
2737 # Returns: - Nothing on success
2738 #          - If no background operation is active on this device, DeviceNotActive
2740 # Since: 1.3
2742 { 'command': 'block-job-complete', 'data': { 'device': 'str' } }
2745 # @block-job-dismiss:
2747 # For jobs that have already concluded, remove them from the block-job-query
2748 # list. This command only needs to be run for jobs which were started with
2749 # QEMU 2.12+ job lifetime management semantics.
2751 # This command will refuse to operate on any job that has not yet reached
2752 # its terminal state, JOB_STATUS_CONCLUDED. For jobs that make use of the
2753 # BLOCK_JOB_READY event, block-job-cancel or block-job-complete will still need
2754 # to be used as appropriate.
2756 # @id: The job identifier.
2758 # Returns: Nothing on success
2760 # Since: 2.12
2762 { 'command': 'block-job-dismiss', 'data': { 'id': 'str' } }
2765 # @block-job-finalize:
2767 # Once a job that has manual=true reaches the pending state, it can be
2768 # instructed to finalize any graph changes and do any necessary cleanup
2769 # via this command.
2770 # For jobs in a transaction, instructing one job to finalize will force
2771 # ALL jobs in the transaction to finalize, so it is only necessary to instruct
2772 # a single member job to finalize.
2774 # @id: The job identifier.
2776 # Returns: Nothing on success
2778 # Since: 2.12
2780 { 'command': 'block-job-finalize', 'data': { 'id': 'str' } }
2783 # @BlockdevDiscardOptions:
2785 # Determines how to handle discard requests.
2787 # @ignore: Ignore the request
2788 # @unmap: Forward as an unmap request
2790 # Since: 2.9
2792 { 'enum': 'BlockdevDiscardOptions',
2793   'data': [ 'ignore', 'unmap' ] }
2796 # @BlockdevDetectZeroesOptions:
2798 # Describes the operation mode for the automatic conversion of plain
2799 # zero writes by the OS to driver specific optimized zero write commands.
2801 # @off: Disabled (default)
2802 # @on: Enabled
2803 # @unmap: Enabled and even try to unmap blocks if possible. This requires
2804 #         also that @BlockdevDiscardOptions is set to unmap for this device.
2806 # Since: 2.1
2808 { 'enum': 'BlockdevDetectZeroesOptions',
2809   'data': [ 'off', 'on', 'unmap' ] }
2812 # @BlockdevAioOptions:
2814 # Selects the AIO backend to handle I/O requests
2816 # @threads: Use qemu's thread pool
2817 # @native: Use native AIO backend (only Linux and Windows)
2818 # @io_uring: Use linux io_uring (since 5.0)
2820 # Since: 2.9
2822 { 'enum': 'BlockdevAioOptions',
2823   'data': [ 'threads', 'native',
2824             { 'name': 'io_uring', 'if': 'defined(CONFIG_LINUX_IO_URING)' } ] }
2827 # @BlockdevCacheOptions:
2829 # Includes cache-related options for block devices
2831 # @direct: enables use of O_DIRECT (bypass the host page cache;
2832 #          default: false)
2833 # @no-flush: ignore any flush requests for the device (default:
2834 #            false)
2836 # Since: 2.9
2838 { 'struct': 'BlockdevCacheOptions',
2839   'data': { '*direct': 'bool',
2840             '*no-flush': 'bool' } }
2843 # @BlockdevDriver:
2845 # Drivers that are supported in block device operations.
2847 # @throttle: Since 2.11
2848 # @nvme: Since 2.12
2849 # @copy-on-read: Since 3.0
2850 # @blklogwrites: Since 3.0
2851 # @blkreplay: Since 4.2
2852 # @compress: Since 5.0
2854 # Since: 2.9
2856 { 'enum': 'BlockdevDriver',
2857   'data': [ 'blkdebug', 'blklogwrites', 'blkreplay', 'blkverify', 'bochs',
2858             'cloop', 'compress', 'copy-on-read', 'dmg', 'file', 'ftp', 'ftps',
2859             'gluster', 'host_cdrom', 'host_device', 'http', 'https', 'iscsi',
2860             'luks', 'nbd', 'nfs', 'null-aio', 'null-co', 'nvme', 'parallels',
2861             'qcow', 'qcow2', 'qed', 'quorum', 'raw', 'rbd',
2862             { 'name': 'replication', 'if': 'defined(CONFIG_REPLICATION)' },
2863             'sheepdog',
2864             'ssh', 'throttle', 'vdi', 'vhdx', 'vmdk', 'vpc', 'vvfat' ] }
2867 # @BlockdevOptionsFile:
2869 # Driver specific block device options for the file backend.
2871 # @filename: path to the image file
2872 # @pr-manager: the id for the object that will handle persistent reservations
2873 #              for this device (default: none, forward the commands via SG_IO;
2874 #              since 2.11)
2875 # @aio: AIO backend (default: threads) (since: 2.8)
2876 # @locking: whether to enable file locking. If set to 'auto', only enable
2877 #           when Open File Descriptor (OFD) locking API is available
2878 #           (default: auto, since 2.10)
2879 # @drop-cache: invalidate page cache during live migration.  This prevents
2880 #              stale data on the migration destination with cache.direct=off.
2881 #              Currently only supported on Linux hosts.
2882 #              (default: on, since: 4.0)
2883 # @x-check-cache-dropped: whether to check that page cache was dropped on live
2884 #                         migration.  May cause noticeable delays if the image
2885 #                         file is large, do not use in production.
2886 #                         (default: off) (since: 3.0)
2888 # Features:
2889 # @dynamic-auto-read-only: If present, enabled auto-read-only means that the
2890 #                          driver will open the image read-only at first,
2891 #                          dynamically reopen the image file read-write when
2892 #                          the first writer is attached to the node and reopen
2893 #                          read-only when the last writer is detached. This
2894 #                          allows giving QEMU write permissions only on demand
2895 #                          when an operation actually needs write access.
2897 # Since: 2.9
2899 { 'struct': 'BlockdevOptionsFile',
2900   'data': { 'filename': 'str',
2901             '*pr-manager': 'str',
2902             '*locking': 'OnOffAuto',
2903             '*aio': 'BlockdevAioOptions',
2904             '*drop-cache': {'type': 'bool',
2905                             'if': 'defined(CONFIG_LINUX)'},
2906             '*x-check-cache-dropped': 'bool' },
2907   'features': [ { 'name': 'dynamic-auto-read-only',
2908                   'if': 'defined(CONFIG_POSIX)' } ] }
2911 # @BlockdevOptionsNull:
2913 # Driver specific block device options for the null backend.
2915 # @size: size of the device in bytes.
2916 # @latency-ns: emulated latency (in nanoseconds) in processing
2917 #              requests. Default to zero which completes requests immediately.
2918 #              (Since 2.4)
2919 # @read-zeroes: if true, reads from the device produce zeroes; if false, the
2920 #               buffer is left unchanged. (default: false; since: 4.1)
2922 # Since: 2.9
2924 { 'struct': 'BlockdevOptionsNull',
2925   'data': { '*size': 'int', '*latency-ns': 'uint64', '*read-zeroes': 'bool' } }
2928 # @BlockdevOptionsNVMe:
2930 # Driver specific block device options for the NVMe backend.
2932 # @device: PCI controller address of the NVMe device in
2933 #          format hhhh:bb:ss.f (host:bus:slot.function)
2934 # @namespace: namespace number of the device, starting from 1.
2936 # Note that the PCI @device must have been unbound from any host
2937 # kernel driver before instructing QEMU to add the blockdev.
2939 # Since: 2.12
2941 { 'struct': 'BlockdevOptionsNVMe',
2942   'data': { 'device': 'str', 'namespace': 'int' } }
2945 # @BlockdevOptionsVVFAT:
2947 # Driver specific block device options for the vvfat protocol.
2949 # @dir: directory to be exported as FAT image
2950 # @fat-type: FAT type: 12, 16 or 32
2951 # @floppy: whether to export a floppy image (true) or
2952 #          partitioned hard disk (false; default)
2953 # @label: set the volume label, limited to 11 bytes. FAT16 and
2954 #         FAT32 traditionally have some restrictions on labels, which are
2955 #         ignored by most operating systems. Defaults to "QEMU VVFAT".
2956 #         (since 2.4)
2957 # @rw: whether to allow write operations (default: false)
2959 # Since: 2.9
2961 { 'struct': 'BlockdevOptionsVVFAT',
2962   'data': { 'dir': 'str', '*fat-type': 'int', '*floppy': 'bool',
2963             '*label': 'str', '*rw': 'bool' } }
2966 # @BlockdevOptionsGenericFormat:
2968 # Driver specific block device options for image format that have no option
2969 # besides their data source.
2971 # @file: reference to or definition of the data source block device
2973 # Since: 2.9
2975 { 'struct': 'BlockdevOptionsGenericFormat',
2976   'data': { 'file': 'BlockdevRef' } }
2979 # @BlockdevOptionsLUKS:
2981 # Driver specific block device options for LUKS.
2983 # @key-secret: the ID of a QCryptoSecret object providing
2984 #              the decryption key (since 2.6). Mandatory except when
2985 #              doing a metadata-only probe of the image.
2987 # Since: 2.9
2989 { 'struct': 'BlockdevOptionsLUKS',
2990   'base': 'BlockdevOptionsGenericFormat',
2991   'data': { '*key-secret': 'str' } }
2995 # @BlockdevOptionsGenericCOWFormat:
2997 # Driver specific block device options for image format that have no option
2998 # besides their data source and an optional backing file.
3000 # @backing: reference to or definition of the backing file block
3001 #           device, null disables the backing file entirely.
3002 #           Defaults to the backing file stored the image file.
3004 # Since: 2.9
3006 { 'struct': 'BlockdevOptionsGenericCOWFormat',
3007   'base': 'BlockdevOptionsGenericFormat',
3008   'data': { '*backing': 'BlockdevRefOrNull' } }
3011 # @Qcow2OverlapCheckMode:
3013 # General overlap check modes.
3015 # @none: Do not perform any checks
3017 # @constant: Perform only checks which can be done in constant time and
3018 #            without reading anything from disk
3020 # @cached: Perform only checks which can be done without reading anything
3021 #          from disk
3023 # @all: Perform all available overlap checks
3025 # Since: 2.9
3027 { 'enum': 'Qcow2OverlapCheckMode',
3028   'data': [ 'none', 'constant', 'cached', 'all' ] }
3031 # @Qcow2OverlapCheckFlags:
3033 # Structure of flags for each metadata structure. Setting a field to 'true'
3034 # makes qemu guard that structure against unintended overwriting. The default
3035 # value is chosen according to the template given.
3037 # @template: Specifies a template mode which can be adjusted using the other
3038 #            flags, defaults to 'cached'
3040 # @bitmap-directory: since 3.0
3042 # Since: 2.9
3044 { 'struct': 'Qcow2OverlapCheckFlags',
3045   'data': { '*template':         'Qcow2OverlapCheckMode',
3046             '*main-header':      'bool',
3047             '*active-l1':        'bool',
3048             '*active-l2':        'bool',
3049             '*refcount-table':   'bool',
3050             '*refcount-block':   'bool',
3051             '*snapshot-table':   'bool',
3052             '*inactive-l1':      'bool',
3053             '*inactive-l2':      'bool',
3054             '*bitmap-directory': 'bool' } }
3057 # @Qcow2OverlapChecks:
3059 # Specifies which metadata structures should be guarded against unintended
3060 # overwriting.
3062 # @flags: set of flags for separate specification of each metadata structure
3063 #         type
3065 # @mode: named mode which chooses a specific set of flags
3067 # Since: 2.9
3069 { 'alternate': 'Qcow2OverlapChecks',
3070   'data': { 'flags': 'Qcow2OverlapCheckFlags',
3071             'mode':  'Qcow2OverlapCheckMode' } }
3074 # @BlockdevQcowEncryptionFormat:
3076 # @aes: AES-CBC with plain64 initialization vectors
3078 # Since: 2.10
3080 { 'enum': 'BlockdevQcowEncryptionFormat',
3081   'data': [ 'aes' ] }
3084 # @BlockdevQcowEncryption:
3086 # Since: 2.10
3088 { 'union': 'BlockdevQcowEncryption',
3089   'base': { 'format': 'BlockdevQcowEncryptionFormat' },
3090   'discriminator': 'format',
3091   'data': { 'aes': 'QCryptoBlockOptionsQCow' } }
3094 # @BlockdevOptionsQcow:
3096 # Driver specific block device options for qcow.
3098 # @encrypt: Image decryption options. Mandatory for
3099 #           encrypted images, except when doing a metadata-only
3100 #           probe of the image.
3102 # Since: 2.10
3104 { 'struct': 'BlockdevOptionsQcow',
3105   'base': 'BlockdevOptionsGenericCOWFormat',
3106   'data': { '*encrypt': 'BlockdevQcowEncryption' } }
3111 # @BlockdevQcow2EncryptionFormat:
3112 # @aes: AES-CBC with plain64 initialization vectors
3114 # Since: 2.10
3116 { 'enum': 'BlockdevQcow2EncryptionFormat',
3117   'data': [ 'aes', 'luks' ] }
3120 # @BlockdevQcow2Encryption:
3122 # Since: 2.10
3124 { 'union': 'BlockdevQcow2Encryption',
3125   'base': { 'format': 'BlockdevQcow2EncryptionFormat' },
3126   'discriminator': 'format',
3127   'data': { 'aes': 'QCryptoBlockOptionsQCow',
3128             'luks': 'QCryptoBlockOptionsLUKS'} }
3131 # @BlockdevOptionsQcow2:
3133 # Driver specific block device options for qcow2.
3135 # @lazy-refcounts: whether to enable the lazy refcounts
3136 #                  feature (default is taken from the image file)
3138 # @pass-discard-request: whether discard requests to the qcow2
3139 #                        device should be forwarded to the data source
3141 # @pass-discard-snapshot: whether discard requests for the data source
3142 #                         should be issued when a snapshot operation (e.g.
3143 #                         deleting a snapshot) frees clusters in the qcow2 file
3145 # @pass-discard-other: whether discard requests for the data source
3146 #                      should be issued on other occasions where a cluster
3147 #                      gets freed
3149 # @overlap-check: which overlap checks to perform for writes
3150 #                 to the image, defaults to 'cached' (since 2.2)
3152 # @cache-size: the maximum total size of the L2 table and
3153 #              refcount block caches in bytes (since 2.2)
3155 # @l2-cache-size: the maximum size of the L2 table cache in
3156 #                 bytes (since 2.2)
3158 # @l2-cache-entry-size: the size of each entry in the L2 cache in
3159 #                       bytes. It must be a power of two between 512
3160 #                       and the cluster size. The default value is
3161 #                       the cluster size (since 2.12)
3163 # @refcount-cache-size: the maximum size of the refcount block cache
3164 #                       in bytes (since 2.2)
3166 # @cache-clean-interval: clean unused entries in the L2 and refcount
3167 #                        caches. The interval is in seconds. The default value
3168 #                        is 600 on supporting platforms, and 0 on other
3169 #                        platforms. 0 disables this feature. (since 2.5)
3171 # @encrypt: Image decryption options. Mandatory for
3172 #           encrypted images, except when doing a metadata-only
3173 #           probe of the image. (since 2.10)
3175 # @data-file: reference to or definition of the external data file.
3176 #             This may only be specified for images that require an
3177 #             external data file. If it is not specified for such
3178 #             an image, the data file name is loaded from the image
3179 #             file. (since 4.0)
3181 # Since: 2.9
3183 { 'struct': 'BlockdevOptionsQcow2',
3184   'base': 'BlockdevOptionsGenericCOWFormat',
3185   'data': { '*lazy-refcounts': 'bool',
3186             '*pass-discard-request': 'bool',
3187             '*pass-discard-snapshot': 'bool',
3188             '*pass-discard-other': 'bool',
3189             '*overlap-check': 'Qcow2OverlapChecks',
3190             '*cache-size': 'int',
3191             '*l2-cache-size': 'int',
3192             '*l2-cache-entry-size': 'int',
3193             '*refcount-cache-size': 'int',
3194             '*cache-clean-interval': 'int',
3195             '*encrypt': 'BlockdevQcow2Encryption',
3196             '*data-file': 'BlockdevRef' } }
3199 # @SshHostKeyCheckMode:
3201 # @none: Don't check the host key at all
3202 # @hash: Compare the host key with a given hash
3203 # @known_hosts: Check the host key against the known_hosts file
3205 # Since: 2.12
3207 { 'enum': 'SshHostKeyCheckMode',
3208   'data': [ 'none', 'hash', 'known_hosts' ] }
3211 # @SshHostKeyCheckHashType:
3213 # @md5: The given hash is an md5 hash
3214 # @sha1: The given hash is an sha1 hash
3216 # Since: 2.12
3218 { 'enum': 'SshHostKeyCheckHashType',
3219   'data': [ 'md5', 'sha1' ] }
3222 # @SshHostKeyHash:
3224 # @type: The hash algorithm used for the hash
3225 # @hash: The expected hash value
3227 # Since: 2.12
3229 { 'struct': 'SshHostKeyHash',
3230   'data': { 'type': 'SshHostKeyCheckHashType',
3231             'hash': 'str' }}
3234 # @SshHostKeyCheck:
3236 # Since: 2.12
3238 { 'union': 'SshHostKeyCheck',
3239   'base': { 'mode': 'SshHostKeyCheckMode' },
3240   'discriminator': 'mode',
3241   'data': { 'hash': 'SshHostKeyHash' } }
3244 # @BlockdevOptionsSsh:
3246 # @server:              host address
3248 # @path:                path to the image on the host
3250 # @user:                user as which to connect, defaults to current
3251 #                       local user name
3253 # @host-key-check:      Defines how and what to check the host key against
3254 #                       (default: known_hosts)
3256 # Since: 2.9
3258 { 'struct': 'BlockdevOptionsSsh',
3259   'data': { 'server': 'InetSocketAddress',
3260             'path': 'str',
3261             '*user': 'str',
3262             '*host-key-check': 'SshHostKeyCheck' } }
3266 # @BlkdebugEvent:
3268 # Trigger events supported by blkdebug.
3270 # @l1_shrink_write_table: write zeros to the l1 table to shrink image.
3271 #                         (since 2.11)
3273 # @l1_shrink_free_l2_clusters: discard the l2 tables. (since 2.11)
3275 # @cor_write: a write due to copy-on-read (since 2.11)
3277 # @cluster_alloc_space: an allocation of file space for a cluster (since 4.1)
3279 # @none: triggers once at creation of the blkdebug node (since 4.1)
3281 # Since: 2.9
3283 { 'enum': 'BlkdebugEvent', 'prefix': 'BLKDBG',
3284   'data': [ 'l1_update', 'l1_grow_alloc_table', 'l1_grow_write_table',
3285             'l1_grow_activate_table', 'l2_load', 'l2_update',
3286             'l2_update_compressed', 'l2_alloc_cow_read', 'l2_alloc_write',
3287             'read_aio', 'read_backing_aio', 'read_compressed', 'write_aio',
3288             'write_compressed', 'vmstate_load', 'vmstate_save', 'cow_read',
3289             'cow_write', 'reftable_load', 'reftable_grow', 'reftable_update',
3290             'refblock_load', 'refblock_update', 'refblock_update_part',
3291             'refblock_alloc', 'refblock_alloc_hookup', 'refblock_alloc_write',
3292             'refblock_alloc_write_blocks', 'refblock_alloc_write_table',
3293             'refblock_alloc_switch_table', 'cluster_alloc',
3294             'cluster_alloc_bytes', 'cluster_free', 'flush_to_os',
3295             'flush_to_disk', 'pwritev_rmw_head', 'pwritev_rmw_after_head',
3296             'pwritev_rmw_tail', 'pwritev_rmw_after_tail', 'pwritev',
3297             'pwritev_zero', 'pwritev_done', 'empty_image_prepare',
3298             'l1_shrink_write_table', 'l1_shrink_free_l2_clusters',
3299             'cor_write', 'cluster_alloc_space', 'none'] }
3302 # @BlkdebugIOType:
3304 # Kinds of I/O that blkdebug can inject errors in.
3306 # @read: .bdrv_co_preadv()
3308 # @write: .bdrv_co_pwritev()
3310 # @write-zeroes: .bdrv_co_pwrite_zeroes()
3312 # @discard: .bdrv_co_pdiscard()
3314 # @flush: .bdrv_co_flush_to_disk()
3316 # @block-status: .bdrv_co_block_status()
3318 # Since: 4.1
3320 { 'enum': 'BlkdebugIOType', 'prefix': 'BLKDEBUG_IO_TYPE',
3321   'data': [ 'read', 'write', 'write-zeroes', 'discard', 'flush',
3322             'block-status' ] }
3325 # @BlkdebugInjectErrorOptions:
3327 # Describes a single error injection for blkdebug.
3329 # @event: trigger event
3331 # @state: the state identifier blkdebug needs to be in to
3332 #         actually trigger the event; defaults to "any"
3334 # @iotype: the type of I/O operations on which this error should
3335 #          be injected; defaults to "all read, write,
3336 #          write-zeroes, discard, and flush operations"
3337 #          (since: 4.1)
3339 # @errno: error identifier (errno) to be returned; defaults to
3340 #         EIO
3342 # @sector: specifies the sector index which has to be affected
3343 #          in order to actually trigger the event; defaults to "any
3344 #          sector"
3346 # @once: disables further events after this one has been
3347 #        triggered; defaults to false
3349 # @immediately: fail immediately; defaults to false
3351 # Since: 2.9
3353 { 'struct': 'BlkdebugInjectErrorOptions',
3354   'data': { 'event': 'BlkdebugEvent',
3355             '*state': 'int',
3356             '*iotype': 'BlkdebugIOType',
3357             '*errno': 'int',
3358             '*sector': 'int',
3359             '*once': 'bool',
3360             '*immediately': 'bool' } }
3363 # @BlkdebugSetStateOptions:
3365 # Describes a single state-change event for blkdebug.
3367 # @event: trigger event
3369 # @state: the current state identifier blkdebug needs to be in;
3370 #         defaults to "any"
3372 # @new_state: the state identifier blkdebug is supposed to assume if
3373 #             this event is triggered
3375 # Since: 2.9
3377 { 'struct': 'BlkdebugSetStateOptions',
3378   'data': { 'event': 'BlkdebugEvent',
3379             '*state': 'int',
3380             'new_state': 'int' } }
3383 # @BlockdevOptionsBlkdebug:
3385 # Driver specific block device options for blkdebug.
3387 # @image: underlying raw block device (or image file)
3389 # @config: filename of the configuration file
3391 # @align: required alignment for requests in bytes, must be
3392 #         positive power of 2, or 0 for default
3394 # @max-transfer: maximum size for I/O transfers in bytes, must be
3395 #                positive multiple of @align and of the underlying
3396 #                file's request alignment (but need not be a power of
3397 #                2), or 0 for default (since 2.10)
3399 # @opt-write-zero: preferred alignment for write zero requests in bytes,
3400 #                  must be positive multiple of @align and of the
3401 #                  underlying file's request alignment (but need not be a
3402 #                  power of 2), or 0 for default (since 2.10)
3404 # @max-write-zero: maximum size for write zero requests in bytes, must be
3405 #                  positive multiple of @align, of @opt-write-zero, and of
3406 #                  the underlying file's request alignment (but need not
3407 #                  be a power of 2), or 0 for default (since 2.10)
3409 # @opt-discard: preferred alignment for discard requests in bytes, must
3410 #               be positive multiple of @align and of the underlying
3411 #               file's request alignment (but need not be a power of
3412 #               2), or 0 for default (since 2.10)
3414 # @max-discard: maximum size for discard requests in bytes, must be
3415 #               positive multiple of @align, of @opt-discard, and of
3416 #               the underlying file's request alignment (but need not
3417 #               be a power of 2), or 0 for default (since 2.10)
3419 # @inject-error: array of error injection descriptions
3421 # @set-state: array of state-change descriptions
3423 # @take-child-perms: Permissions to take on @image in addition to what
3424 #                    is necessary anyway (which depends on how the
3425 #                    blkdebug node is used).  Defaults to none.
3426 #                    (since 5.0)
3428 # @unshare-child-perms: Permissions not to share on @image in addition
3429 #                       to what cannot be shared anyway (which depends
3430 #                       on how the blkdebug node is used).  Defaults
3431 #                       to none.  (since 5.0)
3433 # Since: 2.9
3435 { 'struct': 'BlockdevOptionsBlkdebug',
3436   'data': { 'image': 'BlockdevRef',
3437             '*config': 'str',
3438             '*align': 'int', '*max-transfer': 'int32',
3439             '*opt-write-zero': 'int32', '*max-write-zero': 'int32',
3440             '*opt-discard': 'int32', '*max-discard': 'int32',
3441             '*inject-error': ['BlkdebugInjectErrorOptions'],
3442             '*set-state': ['BlkdebugSetStateOptions'],
3443             '*take-child-perms': ['BlockPermission'],
3444             '*unshare-child-perms': ['BlockPermission'] } }
3447 # @BlockdevOptionsBlklogwrites:
3449 # Driver specific block device options for blklogwrites.
3451 # @file: block device
3453 # @log: block device used to log writes to @file
3455 # @log-sector-size: sector size used in logging writes to @file, determines
3456 #                   granularity of offsets and sizes of writes (default: 512)
3458 # @log-append: append to an existing log (default: false)
3460 # @log-super-update-interval: interval of write requests after which the log
3461 #                             super block is updated to disk (default: 4096)
3463 # Since: 3.0
3465 { 'struct': 'BlockdevOptionsBlklogwrites',
3466   'data': { 'file': 'BlockdevRef',
3467             'log': 'BlockdevRef',
3468             '*log-sector-size': 'uint32',
3469             '*log-append': 'bool',
3470             '*log-super-update-interval': 'uint64' } }
3473 # @BlockdevOptionsBlkverify:
3475 # Driver specific block device options for blkverify.
3477 # @test: block device to be tested
3479 # @raw: raw image used for verification
3481 # Since: 2.9
3483 { 'struct': 'BlockdevOptionsBlkverify',
3484   'data': { 'test': 'BlockdevRef',
3485             'raw': 'BlockdevRef' } }
3488 # @BlockdevOptionsBlkreplay:
3490 # Driver specific block device options for blkreplay.
3492 # @image: disk image which should be controlled with blkreplay
3494 # Since: 4.2
3496 { 'struct': 'BlockdevOptionsBlkreplay',
3497   'data': { 'image': 'BlockdevRef' } }
3500 # @QuorumReadPattern:
3502 # An enumeration of quorum read patterns.
3504 # @quorum: read all the children and do a quorum vote on reads
3506 # @fifo: read only from the first child that has not failed
3508 # Since: 2.9
3510 { 'enum': 'QuorumReadPattern', 'data': [ 'quorum', 'fifo' ] }
3513 # @BlockdevOptionsQuorum:
3515 # Driver specific block device options for Quorum
3517 # @blkverify: true if the driver must print content mismatch
3518 #                  set to false by default
3520 # @children: the children block devices to use
3522 # @vote-threshold: the vote limit under which a read will fail
3524 # @rewrite-corrupted: rewrite corrupted data when quorum is reached
3525 #                     (Since 2.1)
3527 # @read-pattern: choose read pattern and set to quorum by default
3528 #                (Since 2.2)
3530 # Since: 2.9
3532 { 'struct': 'BlockdevOptionsQuorum',
3533   'data': { '*blkverify': 'bool',
3534             'children': [ 'BlockdevRef' ],
3535             'vote-threshold': 'int',
3536             '*rewrite-corrupted': 'bool',
3537             '*read-pattern': 'QuorumReadPattern' } }
3540 # @BlockdevOptionsGluster:
3542 # Driver specific block device options for Gluster
3544 # @volume: name of gluster volume where VM image resides
3546 # @path: absolute path to image file in gluster volume
3548 # @server: gluster servers description
3550 # @debug: libgfapi log level (default '4' which is Error)
3551 #         (Since 2.8)
3553 # @logfile: libgfapi log file (default /dev/stderr) (Since 2.8)
3555 # Since: 2.9
3557 { 'struct': 'BlockdevOptionsGluster',
3558   'data': { 'volume': 'str',
3559             'path': 'str',
3560             'server': ['SocketAddress'],
3561             '*debug': 'int',
3562             '*logfile': 'str' } }
3565 # @IscsiTransport:
3567 # An enumeration of libiscsi transport types
3569 # Since: 2.9
3571 { 'enum': 'IscsiTransport',
3572   'data': [ 'tcp', 'iser' ] }
3575 # @IscsiHeaderDigest:
3577 # An enumeration of header digests supported by libiscsi
3579 # Since: 2.9
3581 { 'enum': 'IscsiHeaderDigest',
3582   'prefix': 'QAPI_ISCSI_HEADER_DIGEST',
3583   'data': [ 'crc32c', 'none', 'crc32c-none', 'none-crc32c' ] }
3586 # @BlockdevOptionsIscsi:
3588 # @transport: The iscsi transport type
3590 # @portal: The address of the iscsi portal
3592 # @target: The target iqn name
3594 # @lun: LUN to connect to. Defaults to 0.
3596 # @user: User name to log in with. If omitted, no CHAP
3597 #        authentication is performed.
3599 # @password-secret: The ID of a QCryptoSecret object providing
3600 #                   the password for the login. This option is required if
3601 #                   @user is specified.
3603 # @initiator-name: The iqn name we want to identify to the target
3604 #                  as. If this option is not specified, an initiator name is
3605 #                  generated automatically.
3607 # @header-digest: The desired header digest. Defaults to
3608 #                 none-crc32c.
3610 # @timeout: Timeout in seconds after which a request will
3611 #           timeout. 0 means no timeout and is the default.
3613 # Driver specific block device options for iscsi
3615 # Since: 2.9
3617 { 'struct': 'BlockdevOptionsIscsi',
3618   'data': { 'transport': 'IscsiTransport',
3619             'portal': 'str',
3620             'target': 'str',
3621             '*lun': 'int',
3622             '*user': 'str',
3623             '*password-secret': 'str',
3624             '*initiator-name': 'str',
3625             '*header-digest': 'IscsiHeaderDigest',
3626             '*timeout': 'int' } }
3630 # @RbdAuthMode:
3632 # Since: 3.0
3634 { 'enum': 'RbdAuthMode',
3635   'data': [ 'cephx', 'none' ] }
3638 # @BlockdevOptionsRbd:
3640 # @pool: Ceph pool name.
3642 # @namespace: Rados namespace name in the Ceph pool. (Since 5.0)
3644 # @image: Image name in the Ceph pool.
3646 # @conf: path to Ceph configuration file.  Values
3647 #        in the configuration file will be overridden by
3648 #        options specified via QAPI.
3650 # @snapshot: Ceph snapshot name.
3652 # @user: Ceph id name.
3654 # @auth-client-required: Acceptable authentication modes.
3655 #                        This maps to Ceph configuration option
3656 #                        "auth_client_required".  (Since 3.0)
3658 # @key-secret: ID of a QCryptoSecret object providing a key
3659 #              for cephx authentication.
3660 #              This maps to Ceph configuration option
3661 #              "key".  (Since 3.0)
3663 # @server: Monitor host address and port.  This maps
3664 #          to the "mon_host" Ceph option.
3666 # Since: 2.9
3668 { 'struct': 'BlockdevOptionsRbd',
3669   'data': { 'pool': 'str',
3670             '*namespace': 'str',
3671             'image': 'str',
3672             '*conf': 'str',
3673             '*snapshot': 'str',
3674             '*user': 'str',
3675             '*auth-client-required': ['RbdAuthMode'],
3676             '*key-secret': 'str',
3677             '*server': ['InetSocketAddressBase'] } }
3680 # @BlockdevOptionsSheepdog:
3682 # Driver specific block device options for sheepdog
3684 # @vdi: Virtual disk image name
3685 # @server: The Sheepdog server to connect to
3686 # @snap-id: Snapshot ID
3687 # @tag: Snapshot tag name
3689 # Only one of @snap-id and @tag may be present.
3691 # Since: 2.9
3693 { 'struct': 'BlockdevOptionsSheepdog',
3694   'data': { 'server': 'SocketAddress',
3695             'vdi': 'str',
3696             '*snap-id': 'uint32',
3697             '*tag': 'str' } }
3700 # @ReplicationMode:
3702 # An enumeration of replication modes.
3704 # @primary: Primary mode, the vm's state will be sent to secondary QEMU.
3706 # @secondary: Secondary mode, receive the vm's state from primary QEMU.
3708 # Since: 2.9
3710 { 'enum' : 'ReplicationMode', 'data' : [ 'primary', 'secondary' ],
3711   'if': 'defined(CONFIG_REPLICATION)' }
3714 # @BlockdevOptionsReplication:
3716 # Driver specific block device options for replication
3718 # @mode: the replication mode
3720 # @top-id: In secondary mode, node name or device ID of the root
3721 #          node who owns the replication node chain. Must not be given in
3722 #          primary mode.
3724 # Since: 2.9
3726 { 'struct': 'BlockdevOptionsReplication',
3727   'base': 'BlockdevOptionsGenericFormat',
3728   'data': { 'mode': 'ReplicationMode',
3729             '*top-id': 'str' },
3730   'if': 'defined(CONFIG_REPLICATION)' }
3733 # @NFSTransport:
3735 # An enumeration of NFS transport types
3737 # @inet: TCP transport
3739 # Since: 2.9
3741 { 'enum': 'NFSTransport',
3742   'data': [ 'inet' ] }
3745 # @NFSServer:
3747 # Captures the address of the socket
3749 # @type: transport type used for NFS (only TCP supported)
3751 # @host: host address for NFS server
3753 # Since: 2.9
3755 { 'struct': 'NFSServer',
3756   'data': { 'type': 'NFSTransport',
3757             'host': 'str' } }
3760 # @BlockdevOptionsNfs:
3762 # Driver specific block device option for NFS
3764 # @server: host address
3766 # @path: path of the image on the host
3768 # @user: UID value to use when talking to the
3769 #        server (defaults to 65534 on Windows and getuid()
3770 #        on unix)
3772 # @group: GID value to use when talking to the
3773 #         server (defaults to 65534 on Windows and getgid()
3774 #         in unix)
3776 # @tcp-syn-count: number of SYNs during the session
3777 #                 establishment (defaults to libnfs default)
3779 # @readahead-size: set the readahead size in bytes (defaults
3780 #                  to libnfs default)
3782 # @page-cache-size: set the pagecache size in bytes (defaults
3783 #                   to libnfs default)
3785 # @debug: set the NFS debug level (max 2) (defaults
3786 #         to libnfs default)
3788 # Since: 2.9
3790 { 'struct': 'BlockdevOptionsNfs',
3791   'data': { 'server': 'NFSServer',
3792             'path': 'str',
3793             '*user': 'int',
3794             '*group': 'int',
3795             '*tcp-syn-count': 'int',
3796             '*readahead-size': 'int',
3797             '*page-cache-size': 'int',
3798             '*debug': 'int' } }
3801 # @BlockdevOptionsCurlBase:
3803 # Driver specific block device options shared by all protocols supported by the
3804 # curl backend.
3806 # @url: URL of the image file
3808 # @readahead: Size of the read-ahead cache; must be a multiple of
3809 #             512 (defaults to 256 kB)
3811 # @timeout: Timeout for connections, in seconds (defaults to 5)
3813 # @username: Username for authentication (defaults to none)
3815 # @password-secret: ID of a QCryptoSecret object providing a password
3816 #                   for authentication (defaults to no password)
3818 # @proxy-username: Username for proxy authentication (defaults to none)
3820 # @proxy-password-secret: ID of a QCryptoSecret object providing a password
3821 #                         for proxy authentication (defaults to no password)
3823 # Since: 2.9
3825 { 'struct': 'BlockdevOptionsCurlBase',
3826   'data': { 'url': 'str',
3827             '*readahead': 'int',
3828             '*timeout': 'int',
3829             '*username': 'str',
3830             '*password-secret': 'str',
3831             '*proxy-username': 'str',
3832             '*proxy-password-secret': 'str' } }
3835 # @BlockdevOptionsCurlHttp:
3837 # Driver specific block device options for HTTP connections over the curl
3838 # backend.  URLs must start with "http://".
3840 # @cookie: List of cookies to set; format is
3841 #          "name1=content1; name2=content2;" as explained by
3842 #          CURLOPT_COOKIE(3). Defaults to no cookies.
3844 # @cookie-secret: ID of a QCryptoSecret object providing the cookie data in a
3845 #                 secure way. See @cookie for the format. (since 2.10)
3847 # Since: 2.9
3849 { 'struct': 'BlockdevOptionsCurlHttp',
3850   'base': 'BlockdevOptionsCurlBase',
3851   'data': { '*cookie': 'str',
3852             '*cookie-secret': 'str'} }
3855 # @BlockdevOptionsCurlHttps:
3857 # Driver specific block device options for HTTPS connections over the curl
3858 # backend.  URLs must start with "https://".
3860 # @cookie: List of cookies to set; format is
3861 #          "name1=content1; name2=content2;" as explained by
3862 #          CURLOPT_COOKIE(3). Defaults to no cookies.
3864 # @sslverify: Whether to verify the SSL certificate's validity (defaults to
3865 #             true)
3867 # @cookie-secret: ID of a QCryptoSecret object providing the cookie data in a
3868 #                 secure way. See @cookie for the format. (since 2.10)
3870 # Since: 2.9
3872 { 'struct': 'BlockdevOptionsCurlHttps',
3873   'base': 'BlockdevOptionsCurlBase',
3874   'data': { '*cookie': 'str',
3875             '*sslverify': 'bool',
3876             '*cookie-secret': 'str'} }
3879 # @BlockdevOptionsCurlFtp:
3881 # Driver specific block device options for FTP connections over the curl
3882 # backend.  URLs must start with "ftp://".
3884 # Since: 2.9
3886 { 'struct': 'BlockdevOptionsCurlFtp',
3887   'base': 'BlockdevOptionsCurlBase',
3888   'data': { } }
3891 # @BlockdevOptionsCurlFtps:
3893 # Driver specific block device options for FTPS connections over the curl
3894 # backend.  URLs must start with "ftps://".
3896 # @sslverify: Whether to verify the SSL certificate's validity (defaults to
3897 #             true)
3899 # Since: 2.9
3901 { 'struct': 'BlockdevOptionsCurlFtps',
3902   'base': 'BlockdevOptionsCurlBase',
3903   'data': { '*sslverify': 'bool' } }
3906 # @BlockdevOptionsNbd:
3908 # Driver specific block device options for NBD.
3910 # @server: NBD server address
3912 # @export: export name
3914 # @tls-creds: TLS credentials ID
3916 # @x-dirty-bitmap: A metadata context name such as "qemu:dirty-bitmap:NAME"
3917 #                  or "qemu:allocation-depth" to query in place of the
3918 #                  traditional "base:allocation" block status (see
3919 #                  NBD_OPT_LIST_META_CONTEXT in the NBD protocol; and
3920 #                  yes, naming this option x-context would have made
3921 #                  more sense) (since 3.0)
3923 # @reconnect-delay: On an unexpected disconnect, the nbd client tries to
3924 #                   connect again until succeeding or encountering a serious
3925 #                   error.  During the first @reconnect-delay seconds, all
3926 #                   requests are paused and will be rerun on a successful
3927 #                   reconnect. After that time, any delayed requests and all
3928 #                   future requests before a successful reconnect will
3929 #                   immediately fail. Default 0 (Since 4.2)
3931 # Since: 2.9
3933 { 'struct': 'BlockdevOptionsNbd',
3934   'data': { 'server': 'SocketAddress',
3935             '*export': 'str',
3936             '*tls-creds': 'str',
3937             '*x-dirty-bitmap': 'str',
3938             '*reconnect-delay': 'uint32' } }
3941 # @BlockdevOptionsRaw:
3943 # Driver specific block device options for the raw driver.
3945 # @offset: position where the block device starts
3946 # @size: the assumed size of the device
3948 # Since: 2.9
3950 { 'struct': 'BlockdevOptionsRaw',
3951   'base': 'BlockdevOptionsGenericFormat',
3952   'data': { '*offset': 'int', '*size': 'int' } }
3955 # @BlockdevOptionsThrottle:
3957 # Driver specific block device options for the throttle driver
3959 # @throttle-group: the name of the throttle-group object to use. It
3960 #                  must already exist.
3961 # @file: reference to or definition of the data source block device
3962 # Since: 2.11
3964 { 'struct': 'BlockdevOptionsThrottle',
3965   'data': { 'throttle-group': 'str',
3966             'file' : 'BlockdevRef'
3967              } }
3969 # @BlockdevOptions:
3971 # Options for creating a block device.  Many options are available for all
3972 # block devices, independent of the block driver:
3974 # @driver: block driver name
3975 # @node-name: the node name of the new node (Since 2.0).
3976 #             This option is required on the top level of blockdev-add.
3977 #             Valid node names start with an alphabetic character and may
3978 #             contain only alphanumeric characters, '-', '.' and '_'. Their
3979 #             maximum length is 31 characters.
3980 # @discard: discard-related options (default: ignore)
3981 # @cache: cache-related options
3982 # @read-only: whether the block device should be read-only (default: false).
3983 #             Note that some block drivers support only read-only access,
3984 #             either generally or in certain configurations. In this case,
3985 #             the default value does not work and the option must be
3986 #             specified explicitly.
3987 # @auto-read-only: if true and @read-only is false, QEMU may automatically
3988 #                  decide not to open the image read-write as requested, but
3989 #                  fall back to read-only instead (and switch between the modes
3990 #                  later), e.g. depending on whether the image file is writable
3991 #                  or whether a writing user is attached to the node
3992 #                  (default: false, since 3.1)
3993 # @detect-zeroes: detect and optimize zero writes (Since 2.1)
3994 #                 (default: off)
3995 # @force-share: force share all permission on added nodes.
3996 #               Requires read-only=true. (Since 2.10)
3998 # Remaining options are determined by the block driver.
4000 # Since: 2.9
4002 { 'union': 'BlockdevOptions',
4003   'base': { 'driver': 'BlockdevDriver',
4004             '*node-name': 'str',
4005             '*discard': 'BlockdevDiscardOptions',
4006             '*cache': 'BlockdevCacheOptions',
4007             '*read-only': 'bool',
4008             '*auto-read-only': 'bool',
4009             '*force-share': 'bool',
4010             '*detect-zeroes': 'BlockdevDetectZeroesOptions' },
4011   'discriminator': 'driver',
4012   'data': {
4013       'blkdebug':   'BlockdevOptionsBlkdebug',
4014       'blklogwrites':'BlockdevOptionsBlklogwrites',
4015       'blkverify':  'BlockdevOptionsBlkverify',
4016       'blkreplay':  'BlockdevOptionsBlkreplay',
4017       'bochs':      'BlockdevOptionsGenericFormat',
4018       'cloop':      'BlockdevOptionsGenericFormat',
4019       'compress':   'BlockdevOptionsGenericFormat',
4020       'copy-on-read':'BlockdevOptionsGenericFormat',
4021       'dmg':        'BlockdevOptionsGenericFormat',
4022       'file':       'BlockdevOptionsFile',
4023       'ftp':        'BlockdevOptionsCurlFtp',
4024       'ftps':       'BlockdevOptionsCurlFtps',
4025       'gluster':    'BlockdevOptionsGluster',
4026       'host_cdrom': 'BlockdevOptionsFile',
4027       'host_device':'BlockdevOptionsFile',
4028       'http':       'BlockdevOptionsCurlHttp',
4029       'https':      'BlockdevOptionsCurlHttps',
4030       'iscsi':      'BlockdevOptionsIscsi',
4031       'luks':       'BlockdevOptionsLUKS',
4032       'nbd':        'BlockdevOptionsNbd',
4033       'nfs':        'BlockdevOptionsNfs',
4034       'null-aio':   'BlockdevOptionsNull',
4035       'null-co':    'BlockdevOptionsNull',
4036       'nvme':       'BlockdevOptionsNVMe',
4037       'parallels':  'BlockdevOptionsGenericFormat',
4038       'qcow2':      'BlockdevOptionsQcow2',
4039       'qcow':       'BlockdevOptionsQcow',
4040       'qed':        'BlockdevOptionsGenericCOWFormat',
4041       'quorum':     'BlockdevOptionsQuorum',
4042       'raw':        'BlockdevOptionsRaw',
4043       'rbd':        'BlockdevOptionsRbd',
4044       'replication': { 'type': 'BlockdevOptionsReplication',
4045                        'if': 'defined(CONFIG_REPLICATION)' },
4046       'sheepdog':   'BlockdevOptionsSheepdog',
4047       'ssh':        'BlockdevOptionsSsh',
4048       'throttle':   'BlockdevOptionsThrottle',
4049       'vdi':        'BlockdevOptionsGenericFormat',
4050       'vhdx':       'BlockdevOptionsGenericFormat',
4051       'vmdk':       'BlockdevOptionsGenericCOWFormat',
4052       'vpc':        'BlockdevOptionsGenericFormat',
4053       'vvfat':      'BlockdevOptionsVVFAT'
4054   } }
4057 # @BlockdevRef:
4059 # Reference to a block device.
4061 # @definition: defines a new block device inline
4062 # @reference: references the ID of an existing block device
4064 # Since: 2.9
4066 { 'alternate': 'BlockdevRef',
4067   'data': { 'definition': 'BlockdevOptions',
4068             'reference': 'str' } }
4071 # @BlockdevRefOrNull:
4073 # Reference to a block device.
4075 # @definition: defines a new block device inline
4076 # @reference: references the ID of an existing block device.
4077 #             An empty string means that no block device should
4078 #             be referenced.  Deprecated; use null instead.
4079 # @null: No block device should be referenced (since 2.10)
4081 # Since: 2.9
4083 { 'alternate': 'BlockdevRefOrNull',
4084   'data': { 'definition': 'BlockdevOptions',
4085             'reference': 'str',
4086             'null': 'null' } }
4089 # @blockdev-add:
4091 # Creates a new block device.
4093 # Since: 2.9
4095 # Example:
4097 # 1.
4098 # -> { "execute": "blockdev-add",
4099 #      "arguments": {
4100 #           "driver": "qcow2",
4101 #           "node-name": "test1",
4102 #           "file": {
4103 #               "driver": "file",
4104 #               "filename": "test.qcow2"
4105 #            }
4106 #       }
4107 #     }
4108 # <- { "return": {} }
4110 # 2.
4111 # -> { "execute": "blockdev-add",
4112 #      "arguments": {
4113 #           "driver": "qcow2",
4114 #           "node-name": "node0",
4115 #           "discard": "unmap",
4116 #           "cache": {
4117 #              "direct": true
4118 #            },
4119 #            "file": {
4120 #              "driver": "file",
4121 #              "filename": "/tmp/test.qcow2"
4122 #            },
4123 #            "backing": {
4124 #               "driver": "raw",
4125 #               "file": {
4126 #                  "driver": "file",
4127 #                  "filename": "/dev/fdset/4"
4128 #                }
4129 #            }
4130 #        }
4131 #      }
4133 # <- { "return": {} }
4136 { 'command': 'blockdev-add', 'data': 'BlockdevOptions', 'boxed': true }
4139 # @x-blockdev-reopen:
4141 # Reopens a block device using the given set of options. Any option
4142 # not specified will be reset to its default value regardless of its
4143 # previous status. If an option cannot be changed or a particular
4144 # driver does not support reopening then the command will return an
4145 # error.
4147 # The top-level @node-name option (from BlockdevOptions) must be
4148 # specified and is used to select the block device to be reopened.
4149 # Other @node-name options must be either omitted or set to the
4150 # current name of the appropriate node. This command won't change any
4151 # node name and any attempt to do it will result in an error.
4153 # In the case of options that refer to child nodes, the behavior of
4154 # this command depends on the value:
4156 #  1) A set of options (BlockdevOptions): the child is reopened with
4157 #     the specified set of options.
4159 #  2) A reference to the current child: the child is reopened using
4160 #     its existing set of options.
4162 #  3) A reference to a different node: the current child is replaced
4163 #     with the specified one.
4165 #  4) NULL: the current child (if any) is detached.
4167 # Options (1) and (2) are supported in all cases, but at the moment
4168 # only @backing allows replacing or detaching an existing child.
4170 # Unlike with blockdev-add, the @backing option must always be present
4171 # unless the node being reopened does not have a backing file and its
4172 # image does not have a default backing file name as part of its
4173 # metadata.
4175 # Since: 4.0
4177 { 'command': 'x-blockdev-reopen',
4178   'data': 'BlockdevOptions', 'boxed': true }
4181 # @blockdev-del:
4183 # Deletes a block device that has been added using blockdev-add.
4184 # The command will fail if the node is attached to a device or is
4185 # otherwise being used.
4187 # @node-name: Name of the graph node to delete.
4189 # Since: 2.9
4191 # Example:
4193 # -> { "execute": "blockdev-add",
4194 #      "arguments": {
4195 #           "driver": "qcow2",
4196 #           "node-name": "node0",
4197 #           "file": {
4198 #               "driver": "file",
4199 #               "filename": "test.qcow2"
4200 #           }
4201 #      }
4202 #    }
4203 # <- { "return": {} }
4205 # -> { "execute": "blockdev-del",
4206 #      "arguments": { "node-name": "node0" }
4207 #    }
4208 # <- { "return": {} }
4211 { 'command': 'blockdev-del', 'data': { 'node-name': 'str' } }
4214 # @BlockdevCreateOptionsFile:
4216 # Driver specific image creation options for file.
4218 # @filename: Filename for the new image file
4219 # @size: Size of the virtual disk in bytes
4220 # @preallocation: Preallocation mode for the new image (default: off;
4221 #                 allowed values: off,
4222 #                 falloc (if defined CONFIG_POSIX_FALLOCATE),
4223 #                 full (if defined CONFIG_POSIX))
4224 # @nocow: Turn off copy-on-write (valid only on btrfs; default: off)
4225 # @extent-size-hint: Extent size hint to add to the image file; 0 for not
4226 #                    adding an extent size hint (default: 1 MB, since 5.1)
4228 # Since: 2.12
4230 { 'struct': 'BlockdevCreateOptionsFile',
4231   'data': { 'filename':             'str',
4232             'size':                 'size',
4233             '*preallocation':       'PreallocMode',
4234             '*nocow':               'bool',
4235             '*extent-size-hint':    'size'} }
4238 # @BlockdevCreateOptionsGluster:
4240 # Driver specific image creation options for gluster.
4242 # @location: Where to store the new image file
4243 # @size: Size of the virtual disk in bytes
4244 # @preallocation: Preallocation mode for the new image (default: off;
4245 #                 allowed values: off,
4246 #                 falloc (if defined CONFIG_GLUSTERFS_FALLOCATE),
4247 #                 full (if defined CONFIG_GLUSTERFS_ZEROFILL))
4249 # Since: 2.12
4251 { 'struct': 'BlockdevCreateOptionsGluster',
4252   'data': { 'location':         'BlockdevOptionsGluster',
4253             'size':             'size',
4254             '*preallocation':   'PreallocMode' } }
4257 # @BlockdevCreateOptionsLUKS:
4259 # Driver specific image creation options for LUKS.
4261 # @file: Node to create the image format on
4262 # @size: Size of the virtual disk in bytes
4263 # @preallocation: Preallocation mode for the new image
4264 #                 (since: 4.2)
4265 #                 (default: off; allowed values: off, metadata, falloc, full)
4267 # Since: 2.12
4269 { 'struct': 'BlockdevCreateOptionsLUKS',
4270   'base': 'QCryptoBlockCreateOptionsLUKS',
4271   'data': { 'file':             'BlockdevRef',
4272             'size':             'size',
4273             '*preallocation':   'PreallocMode' } }
4276 # @BlockdevCreateOptionsNfs:
4278 # Driver specific image creation options for NFS.
4280 # @location: Where to store the new image file
4281 # @size: Size of the virtual disk in bytes
4283 # Since: 2.12
4285 { 'struct': 'BlockdevCreateOptionsNfs',
4286   'data': { 'location':         'BlockdevOptionsNfs',
4287             'size':             'size' } }
4290 # @BlockdevCreateOptionsParallels:
4292 # Driver specific image creation options for parallels.
4294 # @file: Node to create the image format on
4295 # @size: Size of the virtual disk in bytes
4296 # @cluster-size: Cluster size in bytes (default: 1 MB)
4298 # Since: 2.12
4300 { 'struct': 'BlockdevCreateOptionsParallels',
4301   'data': { 'file':             'BlockdevRef',
4302             'size':             'size',
4303             '*cluster-size':    'size' } }
4306 # @BlockdevCreateOptionsQcow:
4308 # Driver specific image creation options for qcow.
4310 # @file: Node to create the image format on
4311 # @size: Size of the virtual disk in bytes
4312 # @backing-file: File name of the backing file if a backing file
4313 #                should be used
4314 # @encrypt: Encryption options if the image should be encrypted
4316 # Since: 2.12
4318 { 'struct': 'BlockdevCreateOptionsQcow',
4319   'data': { 'file':             'BlockdevRef',
4320             'size':             'size',
4321             '*backing-file':    'str',
4322             '*encrypt':         'QCryptoBlockCreateOptions' } }
4325 # @BlockdevQcow2Version:
4327 # @v2:  The original QCOW2 format as introduced in qemu 0.10 (version 2)
4328 # @v3:  The extended QCOW2 format as introduced in qemu 1.1 (version 3)
4330 # Since: 2.12
4332 { 'enum': 'BlockdevQcow2Version',
4333   'data': [ 'v2', 'v3' ] }
4337 # @Qcow2CompressionType:
4339 # Compression type used in qcow2 image file
4341 # @zlib: zlib compression, see <http://zlib.net/>
4342 # @zstd: zstd compression, see <http://github.com/facebook/zstd>
4344 # Since: 5.1
4346 { 'enum': 'Qcow2CompressionType',
4347   'data': [ 'zlib', { 'name': 'zstd', 'if': 'defined(CONFIG_ZSTD)' } ] }
4350 # @BlockdevCreateOptionsQcow2:
4352 # Driver specific image creation options for qcow2.
4354 # @file: Node to create the image format on
4355 # @data-file: Node to use as an external data file in which all guest
4356 #             data is stored so that only metadata remains in the qcow2
4357 #             file (since: 4.0)
4358 # @data-file-raw: True if the external data file must stay valid as a
4359 #                 standalone (read-only) raw image without looking at qcow2
4360 #                 metadata (default: false; since: 4.0)
4361 # @extended-l2: True to make the image have extended L2 entries
4362 #               (default: false; since 5.2)
4363 # @size: Size of the virtual disk in bytes
4364 # @version: Compatibility level (default: v3)
4365 # @backing-file: File name of the backing file if a backing file
4366 #                should be used
4367 # @backing-fmt: Name of the block driver to use for the backing file
4368 # @encrypt: Encryption options if the image should be encrypted
4369 # @cluster-size: qcow2 cluster size in bytes (default: 65536)
4370 # @preallocation: Preallocation mode for the new image (default: off;
4371 #                 allowed values: off, falloc, full, metadata)
4372 # @lazy-refcounts: True if refcounts may be updated lazily (default: off)
4373 # @refcount-bits: Width of reference counts in bits (default: 16)
4374 # @compression-type: The image cluster compression method
4375 #                    (default: zlib, since 5.1)
4377 # Since: 2.12
4379 { 'struct': 'BlockdevCreateOptionsQcow2',
4380   'data': { 'file':             'BlockdevRef',
4381             '*data-file':       'BlockdevRef',
4382             '*data-file-raw':   'bool',
4383             '*extended-l2':     'bool',
4384             'size':             'size',
4385             '*version':         'BlockdevQcow2Version',
4386             '*backing-file':    'str',
4387             '*backing-fmt':     'BlockdevDriver',
4388             '*encrypt':         'QCryptoBlockCreateOptions',
4389             '*cluster-size':    'size',
4390             '*preallocation':   'PreallocMode',
4391             '*lazy-refcounts':  'bool',
4392             '*refcount-bits':   'int',
4393             '*compression-type':'Qcow2CompressionType' } }
4396 # @BlockdevCreateOptionsQed:
4398 # Driver specific image creation options for qed.
4400 # @file: Node to create the image format on
4401 # @size: Size of the virtual disk in bytes
4402 # @backing-file: File name of the backing file if a backing file
4403 #                should be used
4404 # @backing-fmt: Name of the block driver to use for the backing file
4405 # @cluster-size: Cluster size in bytes (default: 65536)
4406 # @table-size: L1/L2 table size (in clusters)
4408 # Since: 2.12
4410 { 'struct': 'BlockdevCreateOptionsQed',
4411   'data': { 'file':             'BlockdevRef',
4412             'size':             'size',
4413             '*backing-file':    'str',
4414             '*backing-fmt':     'BlockdevDriver',
4415             '*cluster-size':    'size',
4416             '*table-size':      'int' } }
4419 # @BlockdevCreateOptionsRbd:
4421 # Driver specific image creation options for rbd/Ceph.
4423 # @location: Where to store the new image file. This location cannot
4424 #            point to a snapshot.
4425 # @size: Size of the virtual disk in bytes
4426 # @cluster-size: RBD object size
4428 # Since: 2.12
4430 { 'struct': 'BlockdevCreateOptionsRbd',
4431   'data': { 'location':         'BlockdevOptionsRbd',
4432             'size':             'size',
4433             '*cluster-size' :   'size' } }
4436 # @BlockdevVmdkSubformat:
4438 # Subformat options for VMDK images
4440 # @monolithicSparse:     Single file image with sparse cluster allocation
4442 # @monolithicFlat:       Single flat data image and a descriptor file
4444 # @twoGbMaxExtentSparse: Data is split into 2GB (per virtual LBA) sparse extent
4445 #                        files, in addition to a descriptor file
4447 # @twoGbMaxExtentFlat:   Data is split into 2GB (per virtual LBA) flat extent
4448 #                        files, in addition to a descriptor file
4450 # @streamOptimized:      Single file image sparse cluster allocation, optimized
4451 #                        for streaming over network.
4453 # Since: 4.0
4455 { 'enum': 'BlockdevVmdkSubformat',
4456   'data': [ 'monolithicSparse', 'monolithicFlat', 'twoGbMaxExtentSparse',
4457             'twoGbMaxExtentFlat', 'streamOptimized'] }
4460 # @BlockdevVmdkAdapterType:
4462 # Adapter type info for VMDK images
4464 # Since: 4.0
4466 { 'enum': 'BlockdevVmdkAdapterType',
4467   'data': [ 'ide', 'buslogic', 'lsilogic', 'legacyESX'] }
4470 # @BlockdevCreateOptionsVmdk:
4472 # Driver specific image creation options for VMDK.
4474 # @file: Where to store the new image file. This refers to the image
4475 #        file for monolithcSparse and streamOptimized format, or the
4476 #        descriptor file for other formats.
4477 # @size: Size of the virtual disk in bytes
4478 # @extents: Where to store the data extents. Required for monolithcFlat,
4479 #           twoGbMaxExtentSparse and twoGbMaxExtentFlat formats. For
4480 #           monolithicFlat, only one entry is required; for
4481 #           twoGbMaxExtent* formats, the number of entries required is
4482 #           calculated as extent_number = virtual_size / 2GB. Providing
4483 #           more extents than will be used is an error.
4484 # @subformat: The subformat of the VMDK image. Default: "monolithicSparse".
4485 # @backing-file: The path of backing file. Default: no backing file is used.
4486 # @adapter-type: The adapter type used to fill in the descriptor. Default: ide.
4487 # @hwversion: Hardware version. The meaningful options are "4" or "6".
4488 #             Default: "4".
4489 # @zeroed-grain: Whether to enable zeroed-grain feature for sparse subformats.
4490 #                Default: false.
4492 # Since: 4.0
4494 { 'struct': 'BlockdevCreateOptionsVmdk',
4495   'data': { 'file':             'BlockdevRef',
4496             'size':             'size',
4497             '*extents':          ['BlockdevRef'],
4498             '*subformat':       'BlockdevVmdkSubformat',
4499             '*backing-file':    'str',
4500             '*adapter-type':    'BlockdevVmdkAdapterType',
4501             '*hwversion':       'str',
4502             '*zeroed-grain':    'bool' } }
4506 # @SheepdogRedundancyType:
4508 # @full: Create a fully replicated vdi with x copies
4509 # @erasure-coded: Create an erasure coded vdi with x data strips and
4510 #                 y parity strips
4512 # Since: 2.12
4514 { 'enum': 'SheepdogRedundancyType',
4515   'data': [ 'full', 'erasure-coded' ] }
4518 # @SheepdogRedundancyFull:
4520 # @copies: Number of copies to use (between 1 and 31)
4522 # Since: 2.12
4524 { 'struct': 'SheepdogRedundancyFull',
4525   'data': { 'copies': 'int' }}
4528 # @SheepdogRedundancyErasureCoded:
4530 # @data-strips: Number of data strips to use (one of {2,4,8,16})
4531 # @parity-strips: Number of parity strips to use (between 1 and 15)
4533 # Since: 2.12
4535 { 'struct': 'SheepdogRedundancyErasureCoded',
4536   'data': { 'data-strips': 'int',
4537             'parity-strips': 'int' }}
4540 # @SheepdogRedundancy:
4542 # Since: 2.12
4544 { 'union': 'SheepdogRedundancy',
4545   'base': { 'type': 'SheepdogRedundancyType' },
4546   'discriminator': 'type',
4547   'data': { 'full': 'SheepdogRedundancyFull',
4548             'erasure-coded': 'SheepdogRedundancyErasureCoded' } }
4551 # @BlockdevCreateOptionsSheepdog:
4553 # Driver specific image creation options for Sheepdog.
4555 # @location: Where to store the new image file
4556 # @size: Size of the virtual disk in bytes
4557 # @backing-file: File name of a base image
4558 # @preallocation: Preallocation mode for the new image (default: off;
4559 #                 allowed values: off, full)
4560 # @redundancy: Redundancy of the image
4561 # @object-size: Object size of the image
4563 # Since: 2.12
4565 { 'struct': 'BlockdevCreateOptionsSheepdog',
4566   'data': { 'location':         'BlockdevOptionsSheepdog',
4567             'size':             'size',
4568             '*backing-file':    'str',
4569             '*preallocation':   'PreallocMode',
4570             '*redundancy':      'SheepdogRedundancy',
4571             '*object-size':     'size' } }
4574 # @BlockdevCreateOptionsSsh:
4576 # Driver specific image creation options for SSH.
4578 # @location: Where to store the new image file
4579 # @size: Size of the virtual disk in bytes
4581 # Since: 2.12
4583 { 'struct': 'BlockdevCreateOptionsSsh',
4584   'data': { 'location':         'BlockdevOptionsSsh',
4585             'size':             'size' } }
4588 # @BlockdevCreateOptionsVdi:
4590 # Driver specific image creation options for VDI.
4592 # @file: Node to create the image format on
4593 # @size: Size of the virtual disk in bytes
4594 # @preallocation: Preallocation mode for the new image (default: off;
4595 #                 allowed values: off, metadata)
4597 # Since: 2.12
4599 { 'struct': 'BlockdevCreateOptionsVdi',
4600   'data': { 'file':             'BlockdevRef',
4601             'size':             'size',
4602             '*preallocation':   'PreallocMode' } }
4605 # @BlockdevVhdxSubformat:
4607 # @dynamic: Growing image file
4608 # @fixed:   Preallocated fixed-size image file
4610 # Since: 2.12
4612 { 'enum': 'BlockdevVhdxSubformat',
4613   'data': [ 'dynamic', 'fixed' ] }
4616 # @BlockdevCreateOptionsVhdx:
4618 # Driver specific image creation options for vhdx.
4620 # @file: Node to create the image format on
4621 # @size: Size of the virtual disk in bytes
4622 # @log-size: Log size in bytes, must be a multiple of 1 MB
4623 #            (default: 1 MB)
4624 # @block-size: Block size in bytes, must be a multiple of 1 MB and not
4625 #              larger than 256 MB (default: automatically choose a block
4626 #              size depending on the image size)
4627 # @subformat: vhdx subformat (default: dynamic)
4628 # @block-state-zero: Force use of payload blocks of type 'ZERO'. Non-standard,
4629 #                    but default.  Do not set to 'off' when using 'qemu-img
4630 #                    convert' with subformat=dynamic.
4632 # Since: 2.12
4634 { 'struct': 'BlockdevCreateOptionsVhdx',
4635   'data': { 'file':                 'BlockdevRef',
4636             'size':                 'size',
4637             '*log-size':            'size',
4638             '*block-size':          'size',
4639             '*subformat':           'BlockdevVhdxSubformat',
4640             '*block-state-zero':    'bool' } }
4643 # @BlockdevVpcSubformat:
4645 # @dynamic: Growing image file
4646 # @fixed:   Preallocated fixed-size image file
4648 # Since: 2.12
4650 { 'enum': 'BlockdevVpcSubformat',
4651   'data': [ 'dynamic', 'fixed' ] }
4654 # @BlockdevCreateOptionsVpc:
4656 # Driver specific image creation options for vpc (VHD).
4658 # @file: Node to create the image format on
4659 # @size: Size of the virtual disk in bytes
4660 # @subformat: vhdx subformat (default: dynamic)
4661 # @force-size: Force use of the exact byte size instead of rounding to the
4662 #              next size that can be represented in CHS geometry
4663 #              (default: false)
4665 # Since: 2.12
4667 { 'struct': 'BlockdevCreateOptionsVpc',
4668   'data': { 'file':                 'BlockdevRef',
4669             'size':                 'size',
4670             '*subformat':           'BlockdevVpcSubformat',
4671             '*force-size':          'bool' } }
4674 # @BlockdevCreateOptions:
4676 # Options for creating an image format on a given node.
4678 # @driver: block driver to create the image format
4680 # Since: 2.12
4682 { 'union': 'BlockdevCreateOptions',
4683   'base': {
4684       'driver':         'BlockdevDriver' },
4685   'discriminator': 'driver',
4686   'data': {
4687       'file':           'BlockdevCreateOptionsFile',
4688       'gluster':        'BlockdevCreateOptionsGluster',
4689       'luks':           'BlockdevCreateOptionsLUKS',
4690       'nfs':            'BlockdevCreateOptionsNfs',
4691       'parallels':      'BlockdevCreateOptionsParallels',
4692       'qcow':           'BlockdevCreateOptionsQcow',
4693       'qcow2':          'BlockdevCreateOptionsQcow2',
4694       'qed':            'BlockdevCreateOptionsQed',
4695       'rbd':            'BlockdevCreateOptionsRbd',
4696       'sheepdog':       'BlockdevCreateOptionsSheepdog',
4697       'ssh':            'BlockdevCreateOptionsSsh',
4698       'vdi':            'BlockdevCreateOptionsVdi',
4699       'vhdx':           'BlockdevCreateOptionsVhdx',
4700       'vmdk':           'BlockdevCreateOptionsVmdk',
4701       'vpc':            'BlockdevCreateOptionsVpc'
4702   } }
4705 # @blockdev-create:
4707 # Starts a job to create an image format on a given node. The job is
4708 # automatically finalized, but a manual job-dismiss is required.
4710 # @job-id:          Identifier for the newly created job.
4712 # @options:         Options for the image creation.
4714 # Since: 3.0
4716 { 'command': 'blockdev-create',
4717   'data': { 'job-id': 'str',
4718             'options': 'BlockdevCreateOptions' } }
4721 # @BlockdevAmendOptionsLUKS:
4723 # Driver specific image amend options for LUKS.
4725 # Since: 5.1
4727 { 'struct': 'BlockdevAmendOptionsLUKS',
4728   'base': 'QCryptoBlockAmendOptionsLUKS',
4729   'data': { }
4733 # @BlockdevAmendOptionsQcow2:
4735 # Driver specific image amend options for qcow2.
4736 # For now, only encryption options can be amended
4738 # @encrypt          Encryption options to be amended
4740 # Since: 5.1
4742 { 'struct': 'BlockdevAmendOptionsQcow2',
4743   'data': { '*encrypt':         'QCryptoBlockAmendOptions' } }
4746 # @BlockdevAmendOptions:
4748 # Options for amending an image format
4750 # @driver:          Block driver of the node to amend.
4752 # Since: 5.1
4754 { 'union': 'BlockdevAmendOptions',
4755   'base': {
4756       'driver':         'BlockdevDriver' },
4757   'discriminator': 'driver',
4758   'data': {
4759       'luks':           'BlockdevAmendOptionsLUKS',
4760       'qcow2':          'BlockdevAmendOptionsQcow2' } }
4763 # @x-blockdev-amend:
4765 # Starts a job to amend format specific options of an existing open block device
4766 # The job is automatically finalized, but a manual job-dismiss is required.
4768 # @job-id:          Identifier for the newly created job.
4770 # @node-name:       Name of the block node to work on
4772 # @options:         Options (driver specific)
4774 # @force:           Allow unsafe operations, format specific
4775 #                   For luks that allows erase of the last active keyslot
4776 #                   (permanent loss of data),
4777 #                   and replacement of an active keyslot
4778 #                   (possible loss of data if IO error happens)
4780 # Since: 5.1
4782 { 'command': 'x-blockdev-amend',
4783   'data': { 'job-id': 'str',
4784             'node-name': 'str',
4785             'options': 'BlockdevAmendOptions',
4786             '*force': 'bool' } }
4789 # @BlockErrorAction:
4791 # An enumeration of action that has been taken when a DISK I/O occurs
4793 # @ignore: error has been ignored
4795 # @report: error has been reported to the device
4797 # @stop: error caused VM to be stopped
4799 # Since: 2.1
4801 { 'enum': 'BlockErrorAction',
4802   'data': [ 'ignore', 'report', 'stop' ] }
4806 # @BLOCK_IMAGE_CORRUPTED:
4808 # Emitted when a disk image is being marked corrupt. The image can be
4809 # identified by its device or node name. The 'device' field is always
4810 # present for compatibility reasons, but it can be empty ("") if the
4811 # image does not have a device name associated.
4813 # @device: device name. This is always present for compatibility
4814 #          reasons, but it can be empty ("") if the image does not
4815 #          have a device name associated.
4817 # @node-name: node name (Since: 2.4)
4819 # @msg: informative message for human consumption, such as the kind of
4820 #       corruption being detected. It should not be parsed by machine as it is
4821 #       not guaranteed to be stable
4823 # @offset: if the corruption resulted from an image access, this is
4824 #          the host's access offset into the image
4826 # @size: if the corruption resulted from an image access, this is
4827 #        the access size
4829 # @fatal: if set, the image is marked corrupt and therefore unusable after this
4830 #         event and must be repaired (Since 2.2; before, every
4831 #         BLOCK_IMAGE_CORRUPTED event was fatal)
4833 # Note: If action is "stop", a STOP event will eventually follow the
4834 #       BLOCK_IO_ERROR event.
4836 # Example:
4838 # <- { "event": "BLOCK_IMAGE_CORRUPTED",
4839 #      "data": { "device": "ide0-hd0", "node-name": "node0",
4840 #                "msg": "Prevented active L1 table overwrite", "offset": 196608,
4841 #                "size": 65536 },
4842 #      "timestamp": { "seconds": 1378126126, "microseconds": 966463 } }
4844 # Since: 1.7
4846 { 'event': 'BLOCK_IMAGE_CORRUPTED',
4847   'data': { 'device'     : 'str',
4848             '*node-name' : 'str',
4849             'msg'        : 'str',
4850             '*offset'    : 'int',
4851             '*size'      : 'int',
4852             'fatal'      : 'bool' } }
4855 # @BLOCK_IO_ERROR:
4857 # Emitted when a disk I/O error occurs
4859 # @device: device name. This is always present for compatibility
4860 #          reasons, but it can be empty ("") if the image does not
4861 #          have a device name associated.
4863 # @node-name: node name. Note that errors may be reported for the root node
4864 #             that is directly attached to a guest device rather than for the
4865 #             node where the error occurred. The node name is not present if
4866 #             the drive is empty. (Since: 2.8)
4868 # @operation: I/O operation
4870 # @action: action that has been taken
4872 # @nospace: true if I/O error was caused due to a no-space
4873 #           condition. This key is only present if query-block's
4874 #           io-status is present, please see query-block documentation
4875 #           for more information (since: 2.2)
4877 # @reason: human readable string describing the error cause.
4878 #          (This field is a debugging aid for humans, it should not
4879 #          be parsed by applications) (since: 2.2)
4881 # Note: If action is "stop", a STOP event will eventually follow the
4882 #       BLOCK_IO_ERROR event
4884 # Since: 0.13.0
4886 # Example:
4888 # <- { "event": "BLOCK_IO_ERROR",
4889 #      "data": { "device": "ide0-hd1",
4890 #                "node-name": "#block212",
4891 #                "operation": "write",
4892 #                "action": "stop" },
4893 #      "timestamp": { "seconds": 1265044230, "microseconds": 450486 } }
4896 { 'event': 'BLOCK_IO_ERROR',
4897   'data': { 'device': 'str', '*node-name': 'str',
4898             'operation': 'IoOperationType',
4899             'action': 'BlockErrorAction', '*nospace': 'bool',
4900             'reason': 'str' } }
4903 # @BLOCK_JOB_COMPLETED:
4905 # Emitted when a block job has completed
4907 # @type: job type
4909 # @device: The job identifier. Originally the device name but other
4910 #          values are allowed since QEMU 2.7
4912 # @len: maximum progress value
4914 # @offset: current progress value. On success this is equal to len.
4915 #          On failure this is less than len
4917 # @speed: rate limit, bytes per second
4919 # @error: error message. Only present on failure. This field
4920 #         contains a human-readable error message. There are no semantics
4921 #         other than that streaming has failed and clients should not try to
4922 #         interpret the error string
4924 # Since: 1.1
4926 # Example:
4928 # <- { "event": "BLOCK_JOB_COMPLETED",
4929 #      "data": { "type": "stream", "device": "virtio-disk0",
4930 #                "len": 10737418240, "offset": 10737418240,
4931 #                "speed": 0 },
4932 #      "timestamp": { "seconds": 1267061043, "microseconds": 959568 } }
4935 { 'event': 'BLOCK_JOB_COMPLETED',
4936   'data': { 'type'  : 'JobType',
4937             'device': 'str',
4938             'len'   : 'int',
4939             'offset': 'int',
4940             'speed' : 'int',
4941             '*error': 'str' } }
4944 # @BLOCK_JOB_CANCELLED:
4946 # Emitted when a block job has been cancelled
4948 # @type: job type
4950 # @device: The job identifier. Originally the device name but other
4951 #          values are allowed since QEMU 2.7
4953 # @len: maximum progress value
4955 # @offset: current progress value. On success this is equal to len.
4956 #          On failure this is less than len
4958 # @speed: rate limit, bytes per second
4960 # Since: 1.1
4962 # Example:
4964 # <- { "event": "BLOCK_JOB_CANCELLED",
4965 #      "data": { "type": "stream", "device": "virtio-disk0",
4966 #                "len": 10737418240, "offset": 134217728,
4967 #                "speed": 0 },
4968 #      "timestamp": { "seconds": 1267061043, "microseconds": 959568 } }
4971 { 'event': 'BLOCK_JOB_CANCELLED',
4972   'data': { 'type'  : 'JobType',
4973             'device': 'str',
4974             'len'   : 'int',
4975             'offset': 'int',
4976             'speed' : 'int' } }
4979 # @BLOCK_JOB_ERROR:
4981 # Emitted when a block job encounters an error
4983 # @device: The job identifier. Originally the device name but other
4984 #          values are allowed since QEMU 2.7
4986 # @operation: I/O operation
4988 # @action: action that has been taken
4990 # Since: 1.3
4992 # Example:
4994 # <- { "event": "BLOCK_JOB_ERROR",
4995 #      "data": { "device": "ide0-hd1",
4996 #                "operation": "write",
4997 #                "action": "stop" },
4998 #      "timestamp": { "seconds": 1265044230, "microseconds": 450486 } }
5001 { 'event': 'BLOCK_JOB_ERROR',
5002   'data': { 'device'   : 'str',
5003             'operation': 'IoOperationType',
5004             'action'   : 'BlockErrorAction' } }
5007 # @BLOCK_JOB_READY:
5009 # Emitted when a block job is ready to complete
5011 # @type: job type
5013 # @device: The job identifier. Originally the device name but other
5014 #          values are allowed since QEMU 2.7
5016 # @len: maximum progress value
5018 # @offset: current progress value. On success this is equal to len.
5019 #          On failure this is less than len
5021 # @speed: rate limit, bytes per second
5023 # Note: The "ready to complete" status is always reset by a @BLOCK_JOB_ERROR
5024 #       event
5026 # Since: 1.3
5028 # Example:
5030 # <- { "event": "BLOCK_JOB_READY",
5031 #      "data": { "device": "drive0", "type": "mirror", "speed": 0,
5032 #                "len": 2097152, "offset": 2097152 }
5033 #      "timestamp": { "seconds": 1265044230, "microseconds": 450486 } }
5036 { 'event': 'BLOCK_JOB_READY',
5037   'data': { 'type'  : 'JobType',
5038             'device': 'str',
5039             'len'   : 'int',
5040             'offset': 'int',
5041             'speed' : 'int' } }
5044 # @BLOCK_JOB_PENDING:
5046 # Emitted when a block job is awaiting explicit authorization to finalize graph
5047 # changes via @block-job-finalize. If this job is part of a transaction, it will
5048 # not emit this event until the transaction has converged first.
5050 # @type: job type
5052 # @id: The job identifier.
5054 # Since: 2.12
5056 # Example:
5058 # <- { "event": "BLOCK_JOB_WAITING",
5059 #      "data": { "device": "drive0", "type": "mirror" },
5060 #      "timestamp": { "seconds": 1265044230, "microseconds": 450486 } }
5063 { 'event': 'BLOCK_JOB_PENDING',
5064   'data': { 'type'  : 'JobType',
5065             'id'    : 'str' } }
5068 # @PreallocMode:
5070 # Preallocation mode of QEMU image file
5072 # @off: no preallocation
5073 # @metadata: preallocate only for metadata
5074 # @falloc: like @full preallocation but allocate disk space by
5075 #          posix_fallocate() rather than writing data.
5076 # @full: preallocate all data by writing it to the device to ensure
5077 #        disk space is really available. This data may or may not be
5078 #        zero, depending on the image format and storage.
5079 #        @full preallocation also sets up metadata correctly.
5081 # Since: 2.2
5083 { 'enum': 'PreallocMode',
5084   'data': [ 'off', 'metadata', 'falloc', 'full' ] }
5087 # @BLOCK_WRITE_THRESHOLD:
5089 # Emitted when writes on block device reaches or exceeds the
5090 # configured write threshold. For thin-provisioned devices, this
5091 # means the device should be extended to avoid pausing for
5092 # disk exhaustion.
5093 # The event is one shot. Once triggered, it needs to be
5094 # re-registered with another block-set-write-threshold command.
5096 # @node-name: graph node name on which the threshold was exceeded.
5098 # @amount-exceeded: amount of data which exceeded the threshold, in bytes.
5100 # @write-threshold: last configured threshold, in bytes.
5102 # Since: 2.3
5104 { 'event': 'BLOCK_WRITE_THRESHOLD',
5105   'data': { 'node-name': 'str',
5106             'amount-exceeded': 'uint64',
5107             'write-threshold': 'uint64' } }
5110 # @block-set-write-threshold:
5112 # Change the write threshold for a block drive. An event will be
5113 # delivered if a write to this block drive crosses the configured
5114 # threshold.  The threshold is an offset, thus must be
5115 # non-negative. Default is no write threshold. Setting the threshold
5116 # to zero disables it.
5118 # This is useful to transparently resize thin-provisioned drives without
5119 # the guest OS noticing.
5121 # @node-name: graph node name on which the threshold must be set.
5123 # @write-threshold: configured threshold for the block device, bytes.
5124 #                   Use 0 to disable the threshold.
5126 # Since: 2.3
5128 # Example:
5130 # -> { "execute": "block-set-write-threshold",
5131 #      "arguments": { "node-name": "mydev",
5132 #                     "write-threshold": 17179869184 } }
5133 # <- { "return": {} }
5136 { 'command': 'block-set-write-threshold',
5137   'data': { 'node-name': 'str', 'write-threshold': 'uint64' } }
5140 # @x-blockdev-change:
5142 # Dynamically reconfigure the block driver state graph. It can be used
5143 # to add, remove, insert or replace a graph node. Currently only the
5144 # Quorum driver implements this feature to add or remove its child. This
5145 # is useful to fix a broken quorum child.
5147 # If @node is specified, it will be inserted under @parent. @child
5148 # may not be specified in this case. If both @parent and @child are
5149 # specified but @node is not, @child will be detached from @parent.
5151 # @parent: the id or name of the parent node.
5153 # @child: the name of a child under the given parent node.
5155 # @node: the name of the node that will be added.
5157 # Note: this command is experimental, and its API is not stable. It
5158 #       does not support all kinds of operations, all kinds of children, nor
5159 #       all block drivers.
5161 #       FIXME Removing children from a quorum node means introducing gaps in the
5162 #       child indices. This cannot be represented in the 'children' list of
5163 #       BlockdevOptionsQuorum, as returned by .bdrv_refresh_filename().
5165 #       Warning: The data in a new quorum child MUST be consistent with that of
5166 #       the rest of the array.
5168 # Since: 2.7
5170 # Example:
5172 # 1. Add a new node to a quorum
5173 # -> { "execute": "blockdev-add",
5174 #      "arguments": {
5175 #          "driver": "raw",
5176 #          "node-name": "new_node",
5177 #          "file": { "driver": "file",
5178 #                    "filename": "test.raw" } } }
5179 # <- { "return": {} }
5180 # -> { "execute": "x-blockdev-change",
5181 #      "arguments": { "parent": "disk1",
5182 #                     "node": "new_node" } }
5183 # <- { "return": {} }
5185 # 2. Delete a quorum's node
5186 # -> { "execute": "x-blockdev-change",
5187 #      "arguments": { "parent": "disk1",
5188 #                     "child": "children.1" } }
5189 # <- { "return": {} }
5192 { 'command': 'x-blockdev-change',
5193   'data' : { 'parent': 'str',
5194              '*child': 'str',
5195              '*node': 'str' } }
5198 # @x-blockdev-set-iothread:
5200 # Move @node and its children into the @iothread.  If @iothread is null then
5201 # move @node and its children into the main loop.
5203 # The node must not be attached to a BlockBackend.
5205 # @node-name: the name of the block driver node
5207 # @iothread: the name of the IOThread object or null for the main loop
5209 # @force: true if the node and its children should be moved when a BlockBackend
5210 #         is already attached
5212 # Note: this command is experimental and intended for test cases that need
5213 #       control over IOThreads only.
5215 # Since: 2.12
5217 # Example:
5219 # 1. Move a node into an IOThread
5220 # -> { "execute": "x-blockdev-set-iothread",
5221 #      "arguments": { "node-name": "disk1",
5222 #                     "iothread": "iothread0" } }
5223 # <- { "return": {} }
5225 # 2. Move a node into the main loop
5226 # -> { "execute": "x-blockdev-set-iothread",
5227 #      "arguments": { "node-name": "disk1",
5228 #                     "iothread": null } }
5229 # <- { "return": {} }
5232 { 'command': 'x-blockdev-set-iothread',
5233   'data' : { 'node-name': 'str',
5234              'iothread': 'StrOrNull',
5235              '*force': 'bool' } }
5238 # @QuorumOpType:
5240 # An enumeration of the quorum operation types
5242 # @read: read operation
5244 # @write: write operation
5246 # @flush: flush operation
5248 # Since: 2.6
5250 { 'enum': 'QuorumOpType',
5251   'data': [ 'read', 'write', 'flush' ] }
5254 # @QUORUM_FAILURE:
5256 # Emitted by the Quorum block driver if it fails to establish a quorum
5258 # @reference: device name if defined else node name
5260 # @sector-num: number of the first sector of the failed read operation
5262 # @sectors-count: failed read operation sector count
5264 # Note: This event is rate-limited.
5266 # Since: 2.0
5268 # Example:
5270 # <- { "event": "QUORUM_FAILURE",
5271 #      "data": { "reference": "usr1", "sector-num": 345435, "sectors-count": 5 },
5272 #      "timestamp": { "seconds": 1344522075, "microseconds": 745528 } }
5275 { 'event': 'QUORUM_FAILURE',
5276   'data': { 'reference': 'str', 'sector-num': 'int', 'sectors-count': 'int' } }
5279 # @QUORUM_REPORT_BAD:
5281 # Emitted to report a corruption of a Quorum file
5283 # @type: quorum operation type (Since 2.6)
5285 # @error: error message. Only present on failure. This field
5286 #         contains a human-readable error message. There are no semantics other
5287 #         than that the block layer reported an error and clients should not
5288 #         try to interpret the error string.
5290 # @node-name: the graph node name of the block driver state
5292 # @sector-num: number of the first sector of the failed read operation
5294 # @sectors-count: failed read operation sector count
5296 # Note: This event is rate-limited.
5298 # Since: 2.0
5300 # Example:
5302 # 1. Read operation
5304 # { "event": "QUORUM_REPORT_BAD",
5305 #      "data": { "node-name": "node0", "sector-num": 345435, "sectors-count": 5,
5306 #                "type": "read" },
5307 #      "timestamp": { "seconds": 1344522075, "microseconds": 745528 } }
5309 # 2. Flush operation
5311 # { "event": "QUORUM_REPORT_BAD",
5312 #      "data": { "node-name": "node0", "sector-num": 0, "sectors-count": 2097120,
5313 #                "type": "flush", "error": "Broken pipe" },
5314 #      "timestamp": { "seconds": 1456406829, "microseconds": 291763 } }
5317 { 'event': 'QUORUM_REPORT_BAD',
5318   'data': { 'type': 'QuorumOpType', '*error': 'str', 'node-name': 'str',
5319             'sector-num': 'int', 'sectors-count': 'int' } }
5322 # @BlockdevSnapshotInternal:
5324 # @device: the device name or node-name of a root node to generate the snapshot
5325 #          from
5327 # @name: the name of the internal snapshot to be created
5329 # Notes: In transaction, if @name is empty, or any snapshot matching @name
5330 #        exists, the operation will fail. Only some image formats support it,
5331 #        for example, qcow2, rbd, and sheepdog.
5333 # Since: 1.7
5335 { 'struct': 'BlockdevSnapshotInternal',
5336   'data': { 'device': 'str', 'name': 'str' } }
5339 # @blockdev-snapshot-internal-sync:
5341 # Synchronously take an internal snapshot of a block device, when the
5342 # format of the image used supports it. If the name is an empty
5343 # string, or a snapshot with name already exists, the operation will
5344 # fail.
5346 # For the arguments, see the documentation of BlockdevSnapshotInternal.
5348 # Returns: - nothing on success
5349 #          - If @device is not a valid block device, GenericError
5350 #          - If any snapshot matching @name exists, or @name is empty,
5351 #            GenericError
5352 #          - If the format of the image used does not support it,
5353 #            BlockFormatFeatureNotSupported
5355 # Since: 1.7
5357 # Example:
5359 # -> { "execute": "blockdev-snapshot-internal-sync",
5360 #      "arguments": { "device": "ide-hd0",
5361 #                     "name": "snapshot0" }
5362 #    }
5363 # <- { "return": {} }
5366 { 'command': 'blockdev-snapshot-internal-sync',
5367   'data': 'BlockdevSnapshotInternal' }
5370 # @blockdev-snapshot-delete-internal-sync:
5372 # Synchronously delete an internal snapshot of a block device, when the format
5373 # of the image used support it. The snapshot is identified by name or id or
5374 # both. One of the name or id is required. Return SnapshotInfo for the
5375 # successfully deleted snapshot.
5377 # @device: the device name or node-name of a root node to delete the snapshot
5378 #          from
5380 # @id: optional the snapshot's ID to be deleted
5382 # @name: optional the snapshot's name to be deleted
5384 # Returns: - SnapshotInfo on success
5385 #          - If @device is not a valid block device, GenericError
5386 #          - If snapshot not found, GenericError
5387 #          - If the format of the image used does not support it,
5388 #            BlockFormatFeatureNotSupported
5389 #          - If @id and @name are both not specified, GenericError
5391 # Since: 1.7
5393 # Example:
5395 # -> { "execute": "blockdev-snapshot-delete-internal-sync",
5396 #      "arguments": { "device": "ide-hd0",
5397 #                     "name": "snapshot0" }
5398 #    }
5399 # <- { "return": {
5400 #                    "id": "1",
5401 #                    "name": "snapshot0",
5402 #                    "vm-state-size": 0,
5403 #                    "date-sec": 1000012,
5404 #                    "date-nsec": 10,
5405 #                    "vm-clock-sec": 100,
5406 #                    "vm-clock-nsec": 20,
5407 #                    "icount": 220414
5408 #      }
5409 #    }
5412 { 'command': 'blockdev-snapshot-delete-internal-sync',
5413   'data': { 'device': 'str', '*id': 'str', '*name': 'str'},
5414   'returns': 'SnapshotInfo' }