replay: introduce info hmp/qmp command
[qemu/ar7.git] / qapi / block-core.json
blob3758ea991269f314d113ee5331deff1d62dc9354
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: the start byte of the mapped virtual range
249 # @length: the number of bytes of the mapped virtual range
251 # @data: whether the mapped range has data
253 # @zero: whether the virtual blocks are zeroed
255 # @depth: the depth of the mapping
257 # @offset: the offset in file that the virtual sectors are mapped to
259 # @filename: filename that is referred to by @offset
261 # Since: 2.6
264 { 'struct': 'MapEntry',
265   'data': {'start': 'int', 'length': 'int', 'data': 'bool',
266            'zero': 'bool', 'depth': 'int', '*offset': 'int',
267            '*filename': 'str' } }
270 # @BlockdevCacheInfo:
272 # Cache mode information for a block device
274 # @writeback:   true if writeback mode is enabled
275 # @direct:      true if the host page cache is bypassed (O_DIRECT)
276 # @no-flush:    true if flush requests are ignored for the device
278 # Since: 2.3
280 { 'struct': 'BlockdevCacheInfo',
281   'data': { 'writeback': 'bool',
282             'direct': 'bool',
283             'no-flush': 'bool' } }
286 # @BlockDeviceInfo:
288 # Information about the backing device for a block device.
290 # @file: the filename of the backing device
292 # @node-name: the name of the block driver node (Since 2.0)
294 # @ro: true if the backing device was open read-only
296 # @drv: the name of the block format used to open the backing device. As of
297 #       0.14.0 this can be: 'blkdebug', 'bochs', 'cloop', 'cow', 'dmg',
298 #       'file', 'file', 'ftp', 'ftps', 'host_cdrom', 'host_device',
299 #       'http', 'https', 'luks', 'nbd', 'parallels', 'qcow',
300 #       'qcow2', 'raw', 'vdi', 'vmdk', 'vpc', 'vvfat'
301 #       2.2: 'archipelago' added, 'cow' dropped
302 #       2.3: 'host_floppy' deprecated
303 #       2.5: 'host_floppy' dropped
304 #       2.6: 'luks' added
305 #       2.8: 'replication' added, 'tftp' dropped
306 #       2.9: 'archipelago' dropped
308 # @backing_file: the name of the backing file (for copy-on-write)
310 # @backing_file_depth: number of files in the backing file chain (since: 1.2)
312 # @encrypted: true if the backing device is encrypted
314 # @encryption_key_missing: always false
316 # @detect_zeroes: detect and optimize zero writes (Since 2.1)
318 # @bps: total throughput limit in bytes per second is specified
320 # @bps_rd: read throughput limit in bytes per second is specified
322 # @bps_wr: write throughput limit in bytes per second is specified
324 # @iops: total I/O operations per second is specified
326 # @iops_rd: read I/O operations per second is specified
328 # @iops_wr: write I/O operations per second is specified
330 # @image: the info of image used (since: 1.6)
332 # @bps_max: total throughput limit during bursts,
333 #                     in bytes (Since 1.7)
335 # @bps_rd_max: read throughput limit during bursts,
336 #                        in bytes (Since 1.7)
338 # @bps_wr_max: write throughput limit during bursts,
339 #                        in bytes (Since 1.7)
341 # @iops_max: total I/O operations per second during bursts,
342 #                      in bytes (Since 1.7)
344 # @iops_rd_max: read I/O operations per second during bursts,
345 #                         in bytes (Since 1.7)
347 # @iops_wr_max: write I/O operations per second during bursts,
348 #                         in bytes (Since 1.7)
350 # @bps_max_length: maximum length of the @bps_max burst
351 #                            period, in seconds. (Since 2.6)
353 # @bps_rd_max_length: maximum length of the @bps_rd_max
354 #                               burst period, in seconds. (Since 2.6)
356 # @bps_wr_max_length: maximum length of the @bps_wr_max
357 #                               burst period, in seconds. (Since 2.6)
359 # @iops_max_length: maximum length of the @iops burst
360 #                             period, in seconds. (Since 2.6)
362 # @iops_rd_max_length: maximum length of the @iops_rd_max
363 #                                burst period, in seconds. (Since 2.6)
365 # @iops_wr_max_length: maximum length of the @iops_wr_max
366 #                                burst period, in seconds. (Since 2.6)
368 # @iops_size: an I/O size in bytes (Since 1.7)
370 # @group: throttle group name (Since 2.4)
372 # @cache: the cache mode used for the block device (since: 2.3)
374 # @write_threshold: configured write threshold for the device.
375 #                   0 if disabled. (Since 2.3)
377 # @dirty-bitmaps: dirty bitmaps information (only present if node
378 #                 has one or more dirty bitmaps) (Since 4.2)
380 # Features:
381 # @deprecated: Member @encryption_key_missing is deprecated.  It is
382 #              always false.
384 # Since: 0.14.0
387 { 'struct': 'BlockDeviceInfo',
388   'data': { 'file': 'str', '*node-name': 'str', 'ro': 'bool', 'drv': 'str',
389             '*backing_file': 'str', 'backing_file_depth': 'int',
390             'encrypted': 'bool',
391             'encryption_key_missing': { 'type': 'bool',
392                                         'features': [ 'deprecated' ] },
393             'detect_zeroes': 'BlockdevDetectZeroesOptions',
394             'bps': 'int', 'bps_rd': 'int', 'bps_wr': 'int',
395             'iops': 'int', 'iops_rd': 'int', 'iops_wr': 'int',
396             'image': 'ImageInfo',
397             '*bps_max': 'int', '*bps_rd_max': 'int',
398             '*bps_wr_max': 'int', '*iops_max': 'int',
399             '*iops_rd_max': 'int', '*iops_wr_max': 'int',
400             '*bps_max_length': 'int', '*bps_rd_max_length': 'int',
401             '*bps_wr_max_length': 'int', '*iops_max_length': 'int',
402             '*iops_rd_max_length': 'int', '*iops_wr_max_length': 'int',
403             '*iops_size': 'int', '*group': 'str', 'cache': 'BlockdevCacheInfo',
404             'write_threshold': 'int', '*dirty-bitmaps': ['BlockDirtyInfo'] } }
407 # @BlockDeviceIoStatus:
409 # An enumeration of block device I/O status.
411 # @ok: The last I/O operation has succeeded
413 # @failed: The last I/O operation has failed
415 # @nospace: The last I/O operation has failed due to a no-space condition
417 # Since: 1.0
419 { 'enum': 'BlockDeviceIoStatus', 'data': [ 'ok', 'failed', 'nospace' ] }
422 # @BlockDeviceMapEntry:
424 # Entry in the metadata map of the device (returned by "qemu-img map")
426 # @start: Offset in the image of the first byte described by this entry
427 #         (in bytes)
429 # @length: Length of the range described by this entry (in bytes)
431 # @depth: Number of layers (0 = top image, 1 = top image's backing file, etc.)
432 #         before reaching one for which the range is allocated.  The value is
433 #         in the range 0 to the depth of the image chain - 1.
435 # @zero: the sectors in this range read as zeros
437 # @data: reading the image will actually read data from a file (in particular,
438 #        if @offset is present this means that the sectors are not simply
439 #        preallocated, but contain actual data in raw format)
441 # @offset: if present, the image file stores the data for this range in
442 #          raw format at the given offset.
444 # Since: 1.7
446 { 'struct': 'BlockDeviceMapEntry',
447   'data': { 'start': 'int', 'length': 'int', 'depth': 'int', 'zero': 'bool',
448             'data': 'bool', '*offset': 'int' } }
451 # @DirtyBitmapStatus:
453 # An enumeration of possible states that a dirty bitmap can report to the user.
455 # @frozen: The bitmap is currently in-use by some operation and is immutable.
456 #          If the bitmap was @active prior to the operation, new writes by the
457 #          guest are being recorded in a temporary buffer, and will not be lost.
458 #          Generally, bitmaps are cleared on successful use in an operation and
459 #          the temporary buffer is committed into the bitmap. On failure, the
460 #          temporary buffer is merged back into the bitmap without first
461 #          clearing it.
462 #          Please refer to the documentation for each bitmap-using operation,
463 #          See also @blockdev-backup, @drive-backup.
465 # @disabled: The bitmap is not currently recording new writes by the guest.
466 #            This is requested explicitly via @block-dirty-bitmap-disable.
467 #            It can still be cleared, deleted, or used for backup operations.
469 # @active: The bitmap is actively monitoring for new writes, and can be cleared,
470 #          deleted, or used for backup operations.
472 # @locked: The bitmap is currently in-use by some operation and is immutable.
473 #          If the bitmap was @active prior to the operation, it is still
474 #          recording new writes. If the bitmap was @disabled, it is not
475 #          recording new writes. (Since 2.12)
477 # @inconsistent: This is a persistent dirty bitmap that was marked in-use on
478 #                disk, and is unusable by QEMU. It can only be deleted.
479 #                Please rely on the inconsistent field in @BlockDirtyInfo
480 #                instead, as the status field is deprecated. (Since 4.0)
482 # Since: 2.4
484 { 'enum': 'DirtyBitmapStatus',
485   'data': ['active', 'disabled', 'frozen', 'locked', 'inconsistent'] }
488 # @BlockDirtyInfo:
490 # Block dirty bitmap information.
492 # @name: the name of the dirty bitmap (Since 2.4)
494 # @count: number of dirty bytes according to the dirty bitmap
496 # @granularity: granularity of the dirty bitmap in bytes (since 1.4)
498 # @status: current status of the dirty bitmap (since 2.4)
500 # @recording: true if the bitmap is recording new writes from the guest.
501 #             Replaces `active` and `disabled` statuses. (since 4.0)
503 # @busy: true if the bitmap is in-use by some operation (NBD or jobs)
504 #        and cannot be modified via QMP or used by another operation.
505 #        Replaces `locked` and `frozen` statuses. (since 4.0)
507 # @persistent: true if the bitmap was stored on disk, is scheduled to be stored
508 #              on disk, or both. (since 4.0)
510 # @inconsistent: true if this is a persistent bitmap that was improperly
511 #                stored. Implies @persistent to be true; @recording and
512 #                @busy to be false. This bitmap cannot be used. To remove
513 #                it, use @block-dirty-bitmap-remove. (Since 4.0)
515 # Features:
516 # @deprecated: Member @status is deprecated.  Use @recording and
517 #              @locked instead.
519 # Since: 1.3
521 { 'struct': 'BlockDirtyInfo',
522   'data': {'*name': 'str', 'count': 'int', 'granularity': 'uint32',
523            'recording': 'bool', 'busy': 'bool',
524            'status': { 'type': 'DirtyBitmapStatus',
525                        'features': [ 'deprecated' ] },
526            'persistent': 'bool', '*inconsistent': 'bool' } }
529 # @Qcow2BitmapInfoFlags:
531 # An enumeration of flags that a bitmap can report to the user.
533 # @in-use: This flag is set by any process actively modifying the qcow2 file,
534 #          and cleared when the updated bitmap is flushed to the qcow2 image.
535 #          The presence of this flag in an offline image means that the bitmap
536 #          was not saved correctly after its last usage, and may contain
537 #          inconsistent data.
539 # @auto: The bitmap must reflect all changes of the virtual disk by any
540 #        application that would write to this qcow2 file.
542 # Since: 4.0
544 { 'enum': 'Qcow2BitmapInfoFlags',
545   'data': ['in-use', 'auto'] }
548 # @Qcow2BitmapInfo:
550 # Qcow2 bitmap information.
552 # @name: the name of the bitmap
554 # @granularity: granularity of the bitmap in bytes
556 # @flags: flags of the bitmap
558 # Since: 4.0
560 { 'struct': 'Qcow2BitmapInfo',
561   'data': {'name': 'str', 'granularity': 'uint32',
562            'flags': ['Qcow2BitmapInfoFlags'] } }
565 # @BlockLatencyHistogramInfo:
567 # Block latency histogram.
569 # @boundaries: list of interval boundary values in nanoseconds, all greater
570 #              than zero and in ascending order.
571 #              For example, the list [10, 50, 100] produces the following
572 #              histogram intervals: [0, 10), [10, 50), [50, 100), [100, +inf).
574 # @bins: list of io request counts corresponding to histogram intervals.
575 #        len(@bins) = len(@boundaries) + 1
576 #        For the example above, @bins may be something like [3, 1, 5, 2],
577 #        and corresponding histogram looks like:
579 # ::
581 #        5|           *
582 #        4|           *
583 #        3| *         *
584 #        2| *         *    *
585 #        1| *    *    *    *
586 #         +------------------
587 #             10   50   100
589 # Since: 4.0
591 { 'struct': 'BlockLatencyHistogramInfo',
592   'data': {'boundaries': ['uint64'], 'bins': ['uint64'] } }
595 # @BlockInfo:
597 # Block device information.  This structure describes a virtual device and
598 # the backing device associated with it.
600 # @device: The device name associated with the virtual device.
602 # @qdev: The qdev ID, or if no ID is assigned, the QOM path of the block
603 #        device. (since 2.10)
605 # @type: This field is returned only for compatibility reasons, it should
606 #        not be used (always returns 'unknown')
608 # @removable: True if the device supports removable media.
610 # @locked: True if the guest has locked this device from having its media
611 #          removed
613 # @tray_open: True if the device's tray is open
614 #             (only present if it has a tray)
616 # @dirty-bitmaps: dirty bitmaps information (only present if the
617 #                 driver has one or more dirty bitmaps) (Since 2.0)
619 # @io-status: @BlockDeviceIoStatus. Only present if the device
620 #             supports it and the VM is configured to stop on errors
621 #             (supported device models: virtio-blk, IDE, SCSI except
622 #             scsi-generic)
624 # @inserted: @BlockDeviceInfo describing the device if media is
625 #            present
627 # Features:
628 # @deprecated: Member @dirty-bitmaps is deprecated.  Use @inserted
629 #              member @dirty-bitmaps instead.
631 # Since:  0.14.0
633 { 'struct': 'BlockInfo',
634   'data': {'device': 'str', '*qdev': 'str', 'type': 'str', 'removable': 'bool',
635            'locked': 'bool', '*inserted': 'BlockDeviceInfo',
636            '*tray_open': 'bool', '*io-status': 'BlockDeviceIoStatus',
637            '*dirty-bitmaps': { 'type': ['BlockDirtyInfo'],
638                                'features': [ 'deprecated' ] } } }
641 # @BlockMeasureInfo:
643 # Image file size calculation information.  This structure describes the size
644 # requirements for creating a new image file.
646 # The size requirements depend on the new image file format.  File size always
647 # equals virtual disk size for the 'raw' format, even for sparse POSIX files.
648 # Compact formats such as 'qcow2' represent unallocated and zero regions
649 # efficiently so file size may be smaller than virtual disk size.
651 # The values are upper bounds that are guaranteed to fit the new image file.
652 # Subsequent modification, such as internal snapshot or further bitmap
653 # creation, may require additional space and is not covered here.
655 # @required: Size required for a new image file, in bytes, when copying just
656 #            allocated guest-visible contents.
658 # @fully-allocated: Image file size, in bytes, once data has been written
659 #                   to all sectors, when copying just guest-visible contents.
661 # @bitmaps: Additional size required if all the top-level bitmap metadata
662 #           in the source image were to be copied to the destination,
663 #           present only when source and destination both support
664 #           persistent bitmaps. (since 5.1)
666 # Since: 2.10
668 { 'struct': 'BlockMeasureInfo',
669   'data': {'required': 'int', 'fully-allocated': 'int', '*bitmaps': 'int'} }
672 # @query-block:
674 # Get a list of BlockInfo for all virtual block devices.
676 # Returns: a list of @BlockInfo describing each virtual block device. Filter
677 #          nodes that were created implicitly are skipped over.
679 # Since: 0.14.0
681 # Example:
683 # -> { "execute": "query-block" }
684 # <- {
685 #       "return":[
686 #          {
687 #             "io-status": "ok",
688 #             "device":"ide0-hd0",
689 #             "locked":false,
690 #             "removable":false,
691 #             "inserted":{
692 #                "ro":false,
693 #                "drv":"qcow2",
694 #                "encrypted":false,
695 #                "file":"disks/test.qcow2",
696 #                "backing_file_depth":1,
697 #                "bps":1000000,
698 #                "bps_rd":0,
699 #                "bps_wr":0,
700 #                "iops":1000000,
701 #                "iops_rd":0,
702 #                "iops_wr":0,
703 #                "bps_max": 8000000,
704 #                "bps_rd_max": 0,
705 #                "bps_wr_max": 0,
706 #                "iops_max": 0,
707 #                "iops_rd_max": 0,
708 #                "iops_wr_max": 0,
709 #                "iops_size": 0,
710 #                "detect_zeroes": "on",
711 #                "write_threshold": 0,
712 #                "image":{
713 #                   "filename":"disks/test.qcow2",
714 #                   "format":"qcow2",
715 #                   "virtual-size":2048000,
716 #                   "backing_file":"base.qcow2",
717 #                   "full-backing-filename":"disks/base.qcow2",
718 #                   "backing-filename-format":"qcow2",
719 #                   "snapshots":[
720 #                      {
721 #                         "id": "1",
722 #                         "name": "snapshot1",
723 #                         "vm-state-size": 0,
724 #                         "date-sec": 10000200,
725 #                         "date-nsec": 12,
726 #                         "vm-clock-sec": 206,
727 #                         "vm-clock-nsec": 30
728 #                      }
729 #                   ],
730 #                   "backing-image":{
731 #                       "filename":"disks/base.qcow2",
732 #                       "format":"qcow2",
733 #                       "virtual-size":2048000
734 #                   }
735 #                }
736 #             },
737 #             "qdev": "ide_disk",
738 #             "type":"unknown"
739 #          },
740 #          {
741 #             "io-status": "ok",
742 #             "device":"ide1-cd0",
743 #             "locked":false,
744 #             "removable":true,
745 #             "qdev": "/machine/unattached/device[23]",
746 #             "tray_open": false,
747 #             "type":"unknown"
748 #          },
749 #          {
750 #             "device":"floppy0",
751 #             "locked":false,
752 #             "removable":true,
753 #             "qdev": "/machine/unattached/device[20]",
754 #             "type":"unknown"
755 #          },
756 #          {
757 #             "device":"sd0",
758 #             "locked":false,
759 #             "removable":true,
760 #             "type":"unknown"
761 #          }
762 #       ]
763 #    }
766 { 'command': 'query-block', 'returns': ['BlockInfo'] }
770 # @BlockDeviceTimedStats:
772 # Statistics of a block device during a given interval of time.
774 # @interval_length: Interval used for calculating the statistics,
775 #                   in seconds.
777 # @min_rd_latency_ns: Minimum latency of read operations in the
778 #                     defined interval, in nanoseconds.
780 # @min_wr_latency_ns: Minimum latency of write operations in the
781 #                     defined interval, in nanoseconds.
783 # @min_flush_latency_ns: Minimum latency of flush operations in the
784 #                        defined interval, in nanoseconds.
786 # @max_rd_latency_ns: Maximum latency of read operations in the
787 #                     defined interval, in nanoseconds.
789 # @max_wr_latency_ns: Maximum latency of write operations in the
790 #                     defined interval, in nanoseconds.
792 # @max_flush_latency_ns: Maximum latency of flush operations in the
793 #                        defined interval, in nanoseconds.
795 # @avg_rd_latency_ns: Average latency of read operations in the
796 #                     defined interval, in nanoseconds.
798 # @avg_wr_latency_ns: Average latency of write operations in the
799 #                     defined interval, in nanoseconds.
801 # @avg_flush_latency_ns: Average latency of flush operations in the
802 #                        defined interval, in nanoseconds.
804 # @avg_rd_queue_depth: Average number of pending read operations
805 #                      in the defined interval.
807 # @avg_wr_queue_depth: Average number of pending write operations
808 #                      in the defined interval.
810 # Since: 2.5
812 { 'struct': 'BlockDeviceTimedStats',
813   'data': { 'interval_length': 'int', 'min_rd_latency_ns': 'int',
814             'max_rd_latency_ns': 'int', 'avg_rd_latency_ns': 'int',
815             'min_wr_latency_ns': 'int', 'max_wr_latency_ns': 'int',
816             'avg_wr_latency_ns': 'int', 'min_flush_latency_ns': 'int',
817             'max_flush_latency_ns': 'int', 'avg_flush_latency_ns': 'int',
818             'avg_rd_queue_depth': 'number', 'avg_wr_queue_depth': 'number' } }
821 # @BlockDeviceStats:
823 # Statistics of a virtual block device or a block backing device.
825 # @rd_bytes:      The number of bytes read by the device.
827 # @wr_bytes:      The number of bytes written by the device.
829 # @unmap_bytes: The number of bytes unmapped by the device (Since 4.2)
831 # @rd_operations: The number of read operations performed by the device.
833 # @wr_operations: The number of write operations performed by the device.
835 # @flush_operations: The number of cache flush operations performed by the
836 #                    device (since 0.15.0)
838 # @unmap_operations: The number of unmap operations performed by the device
839 #                    (Since 4.2)
841 # @rd_total_time_ns: Total time spent on reads in nanoseconds (since 0.15.0).
843 # @wr_total_time_ns: Total time spent on writes in nanoseconds (since 0.15.0).
845 # @flush_total_time_ns: Total time spent on cache flushes in nanoseconds
846 #                       (since 0.15.0).
848 # @unmap_total_time_ns: Total time spent on unmap operations in nanoseconds
849 #                       (Since 4.2)
851 # @wr_highest_offset: The offset after the greatest byte written to the
852 #                     device.  The intended use of this information is for
853 #                     growable sparse files (like qcow2) that are used on top
854 #                     of a physical device.
856 # @rd_merged: Number of read requests that have been merged into another
857 #             request (Since 2.3).
859 # @wr_merged: Number of write requests that have been merged into another
860 #             request (Since 2.3).
862 # @unmap_merged: Number of unmap requests that have been merged into another
863 #                request (Since 4.2)
865 # @idle_time_ns: Time since the last I/O operation, in
866 #                nanoseconds. If the field is absent it means that
867 #                there haven't been any operations yet (Since 2.5).
869 # @failed_rd_operations: The number of failed read operations
870 #                        performed by the device (Since 2.5)
872 # @failed_wr_operations: The number of failed write operations
873 #                        performed by the device (Since 2.5)
875 # @failed_flush_operations: The number of failed flush operations
876 #                           performed by the device (Since 2.5)
878 # @failed_unmap_operations: The number of failed unmap operations performed
879 #                           by the device (Since 4.2)
881 # @invalid_rd_operations: The number of invalid read operations
882 #                          performed by the device (Since 2.5)
884 # @invalid_wr_operations: The number of invalid write operations
885 #                         performed by the device (Since 2.5)
887 # @invalid_flush_operations: The number of invalid flush operations
888 #                            performed by the device (Since 2.5)
890 # @invalid_unmap_operations: The number of invalid unmap operations performed
891 #                            by the device (Since 4.2)
893 # @account_invalid: Whether invalid operations are included in the
894 #                   last access statistics (Since 2.5)
896 # @account_failed: Whether failed operations are included in the
897 #                  latency and last access statistics (Since 2.5)
899 # @timed_stats: Statistics specific to the set of previously defined
900 #               intervals of time (Since 2.5)
902 # @rd_latency_histogram: @BlockLatencyHistogramInfo. (Since 4.0)
904 # @wr_latency_histogram: @BlockLatencyHistogramInfo. (Since 4.0)
906 # @flush_latency_histogram: @BlockLatencyHistogramInfo. (Since 4.0)
908 # Since: 0.14.0
910 { 'struct': 'BlockDeviceStats',
911   'data': {'rd_bytes': 'int', 'wr_bytes': 'int', 'unmap_bytes' : 'int',
912            'rd_operations': 'int', 'wr_operations': 'int',
913            'flush_operations': 'int', 'unmap_operations': 'int',
914            'rd_total_time_ns': 'int', 'wr_total_time_ns': 'int',
915            'flush_total_time_ns': 'int', 'unmap_total_time_ns': 'int',
916            'wr_highest_offset': 'int',
917            'rd_merged': 'int', 'wr_merged': 'int', 'unmap_merged': 'int',
918            '*idle_time_ns': 'int',
919            'failed_rd_operations': 'int', 'failed_wr_operations': 'int',
920            'failed_flush_operations': 'int', 'failed_unmap_operations': 'int',
921            'invalid_rd_operations': 'int', 'invalid_wr_operations': 'int',
922            'invalid_flush_operations': 'int', 'invalid_unmap_operations': 'int',
923            'account_invalid': 'bool', 'account_failed': 'bool',
924            'timed_stats': ['BlockDeviceTimedStats'],
925            '*rd_latency_histogram': 'BlockLatencyHistogramInfo',
926            '*wr_latency_histogram': 'BlockLatencyHistogramInfo',
927            '*flush_latency_histogram': 'BlockLatencyHistogramInfo' } }
930 # @BlockStatsSpecificFile:
932 # File driver statistics
934 # @discard-nb-ok: The number of successful discard operations performed by
935 #                 the driver.
937 # @discard-nb-failed: The number of failed discard operations performed by
938 #                     the driver.
940 # @discard-bytes-ok: The number of bytes discarded by the driver.
942 # Since: 4.2
944 { 'struct': 'BlockStatsSpecificFile',
945   'data': {
946       'discard-nb-ok': 'uint64',
947       'discard-nb-failed': 'uint64',
948       'discard-bytes-ok': 'uint64' } }
951 # @BlockStatsSpecific:
953 # Block driver specific statistics
955 # Since: 4.2
957 { 'union': 'BlockStatsSpecific',
958   'base': { 'driver': 'BlockdevDriver' },
959   'discriminator': 'driver',
960   'data': {
961       'file': 'BlockStatsSpecificFile',
962       'host_device': 'BlockStatsSpecificFile' } }
965 # @BlockStats:
967 # Statistics of a virtual block device or a block backing device.
969 # @device: If the stats are for a virtual block device, the name
970 #          corresponding to the virtual block device.
972 # @node-name: The node name of the device. (Since 2.3)
974 # @qdev: The qdev ID, or if no ID is assigned, the QOM path of the block
975 #        device. (since 3.0)
977 # @stats:  A @BlockDeviceStats for the device.
979 # @driver-specific: Optional driver-specific stats. (Since 4.2)
981 # @parent: This describes the file block device if it has one.
982 #          Contains recursively the statistics of the underlying
983 #          protocol (e.g. the host file for a qcow2 image). If there is
984 #          no underlying protocol, this field is omitted
986 # @backing: This describes the backing block device if it has one.
987 #           (Since 2.0)
989 # Since: 0.14.0
991 { 'struct': 'BlockStats',
992   'data': {'*device': 'str', '*qdev': 'str', '*node-name': 'str',
993            'stats': 'BlockDeviceStats',
994            '*driver-specific': 'BlockStatsSpecific',
995            '*parent': 'BlockStats',
996            '*backing': 'BlockStats'} }
999 # @query-blockstats:
1001 # Query the @BlockStats for all virtual block devices.
1003 # @query-nodes: If true, the command will query all the block nodes
1004 #               that have a node name, in a list which will include "parent"
1005 #               information, but not "backing".
1006 #               If false or omitted, the behavior is as before - query all the
1007 #               device backends, recursively including their "parent" and
1008 #               "backing". Filter nodes that were created implicitly are
1009 #               skipped over in this mode. (Since 2.3)
1011 # Returns: A list of @BlockStats for each virtual block devices.
1013 # Since: 0.14.0
1015 # Example:
1017 # -> { "execute": "query-blockstats" }
1018 # <- {
1019 #       "return":[
1020 #          {
1021 #             "device":"ide0-hd0",
1022 #             "parent":{
1023 #                "stats":{
1024 #                   "wr_highest_offset":3686448128,
1025 #                   "wr_bytes":9786368,
1026 #                   "wr_operations":751,
1027 #                   "rd_bytes":122567168,
1028 #                   "rd_operations":36772
1029 #                   "wr_total_times_ns":313253456
1030 #                   "rd_total_times_ns":3465673657
1031 #                   "flush_total_times_ns":49653
1032 #                   "flush_operations":61,
1033 #                   "rd_merged":0,
1034 #                   "wr_merged":0,
1035 #                   "idle_time_ns":2953431879,
1036 #                   "account_invalid":true,
1037 #                   "account_failed":false
1038 #                }
1039 #             },
1040 #             "stats":{
1041 #                "wr_highest_offset":2821110784,
1042 #                "wr_bytes":9786368,
1043 #                "wr_operations":692,
1044 #                "rd_bytes":122739200,
1045 #                "rd_operations":36604
1046 #                "flush_operations":51,
1047 #                "wr_total_times_ns":313253456
1048 #                "rd_total_times_ns":3465673657
1049 #                "flush_total_times_ns":49653,
1050 #                "rd_merged":0,
1051 #                "wr_merged":0,
1052 #                "idle_time_ns":2953431879,
1053 #                "account_invalid":true,
1054 #                "account_failed":false
1055 #             },
1056 #             "qdev": "/machine/unattached/device[23]"
1057 #          },
1058 #          {
1059 #             "device":"ide1-cd0",
1060 #             "stats":{
1061 #                "wr_highest_offset":0,
1062 #                "wr_bytes":0,
1063 #                "wr_operations":0,
1064 #                "rd_bytes":0,
1065 #                "rd_operations":0
1066 #                "flush_operations":0,
1067 #                "wr_total_times_ns":0
1068 #                "rd_total_times_ns":0
1069 #                "flush_total_times_ns":0,
1070 #                "rd_merged":0,
1071 #                "wr_merged":0,
1072 #                "account_invalid":false,
1073 #                "account_failed":false
1074 #             },
1075 #             "qdev": "/machine/unattached/device[24]"
1076 #          },
1077 #          {
1078 #             "device":"floppy0",
1079 #             "stats":{
1080 #                "wr_highest_offset":0,
1081 #                "wr_bytes":0,
1082 #                "wr_operations":0,
1083 #                "rd_bytes":0,
1084 #                "rd_operations":0
1085 #                "flush_operations":0,
1086 #                "wr_total_times_ns":0
1087 #                "rd_total_times_ns":0
1088 #                "flush_total_times_ns":0,
1089 #                "rd_merged":0,
1090 #                "wr_merged":0,
1091 #                "account_invalid":false,
1092 #                "account_failed":false
1093 #             },
1094 #             "qdev": "/machine/unattached/device[16]"
1095 #          },
1096 #          {
1097 #             "device":"sd0",
1098 #             "stats":{
1099 #                "wr_highest_offset":0,
1100 #                "wr_bytes":0,
1101 #                "wr_operations":0,
1102 #                "rd_bytes":0,
1103 #                "rd_operations":0
1104 #                "flush_operations":0,
1105 #                "wr_total_times_ns":0
1106 #                "rd_total_times_ns":0
1107 #                "flush_total_times_ns":0,
1108 #                "rd_merged":0,
1109 #                "wr_merged":0,
1110 #                "account_invalid":false,
1111 #                "account_failed":false
1112 #             }
1113 #          }
1114 #       ]
1115 #    }
1118 { 'command': 'query-blockstats',
1119   'data': { '*query-nodes': 'bool' },
1120   'returns': ['BlockStats'] }
1123 # @BlockdevOnError:
1125 # An enumeration of possible behaviors for errors on I/O operations.
1126 # The exact meaning depends on whether the I/O was initiated by a guest
1127 # or by a block job
1129 # @report: for guest operations, report the error to the guest;
1130 #          for jobs, cancel the job
1132 # @ignore: ignore the error, only report a QMP event (BLOCK_IO_ERROR
1133 #          or BLOCK_JOB_ERROR). The backup, mirror and commit block jobs retry
1134 #          the failing request later and may still complete successfully. The
1135 #          stream block job continues to stream and will complete with an
1136 #          error.
1138 # @enospc: same as @stop on ENOSPC, same as @report otherwise.
1140 # @stop: for guest operations, stop the virtual machine;
1141 #        for jobs, pause the job
1143 # @auto: inherit the error handling policy of the backend (since: 2.7)
1145 # Since: 1.3
1147 { 'enum': 'BlockdevOnError',
1148   'data': ['report', 'ignore', 'enospc', 'stop', 'auto'] }
1151 # @MirrorSyncMode:
1153 # An enumeration of possible behaviors for the initial synchronization
1154 # phase of storage mirroring.
1156 # @top: copies data in the topmost image to the destination
1158 # @full: copies data from all images to the destination
1160 # @none: only copy data written from now on
1162 # @incremental: only copy data described by the dirty bitmap. (since: 2.4)
1164 # @bitmap: only copy data described by the dirty bitmap. (since: 4.2)
1165 #          Behavior on completion is determined by the BitmapSyncMode.
1167 # Since: 1.3
1169 { 'enum': 'MirrorSyncMode',
1170   'data': ['top', 'full', 'none', 'incremental', 'bitmap'] }
1173 # @BitmapSyncMode:
1175 # An enumeration of possible behaviors for the synchronization of a bitmap
1176 # when used for data copy operations.
1178 # @on-success: The bitmap is only synced when the operation is successful.
1179 #              This is the behavior always used for 'INCREMENTAL' backups.
1181 # @never: The bitmap is never synchronized with the operation, and is
1182 #         treated solely as a read-only manifest of blocks to copy.
1184 # @always: The bitmap is always synchronized with the operation,
1185 #          regardless of whether or not the operation was successful.
1187 # Since: 4.2
1189 { 'enum': 'BitmapSyncMode',
1190   'data': ['on-success', 'never', 'always'] }
1193 # @MirrorCopyMode:
1195 # An enumeration whose values tell the mirror block job when to
1196 # trigger writes to the target.
1198 # @background: copy data in background only.
1200 # @write-blocking: when data is written to the source, write it
1201 #                  (synchronously) to the target as well.  In
1202 #                  addition, data is copied in background just like in
1203 #                  @background mode.
1205 # Since: 3.0
1207 { 'enum': 'MirrorCopyMode',
1208   'data': ['background', 'write-blocking'] }
1211 # @BlockJobInfo:
1213 # Information about a long-running block device operation.
1215 # @type: the job type ('stream' for image streaming)
1217 # @device: The job identifier. Originally the device name but other
1218 #          values are allowed since QEMU 2.7
1220 # @len: Estimated @offset value at the completion of the job. This value can
1221 #       arbitrarily change while the job is running, in both directions.
1223 # @offset: Progress made until now. The unit is arbitrary and the value can
1224 #          only meaningfully be used for the ratio of @offset to @len. The
1225 #          value is monotonically increasing.
1227 # @busy: false if the job is known to be in a quiescent state, with
1228 #        no pending I/O.  Since 1.3.
1230 # @paused: whether the job is paused or, if @busy is true, will
1231 #          pause itself as soon as possible.  Since 1.3.
1233 # @speed: the rate limit, bytes per second
1235 # @io-status: the status of the job (since 1.3)
1237 # @ready: true if the job may be completed (since 2.2)
1239 # @status: Current job state/status (since 2.12)
1241 # @auto-finalize: Job will finalize itself when PENDING, moving to
1242 #                 the CONCLUDED state. (since 2.12)
1244 # @auto-dismiss: Job will dismiss itself when CONCLUDED, moving to the NULL
1245 #                state and disappearing from the query list. (since 2.12)
1247 # @error: Error information if the job did not complete successfully.
1248 #         Not set if the job completed successfully. (since 2.12.1)
1250 # Since: 1.1
1252 { 'struct': 'BlockJobInfo',
1253   'data': {'type': 'str', 'device': 'str', 'len': 'int',
1254            'offset': 'int', 'busy': 'bool', 'paused': 'bool', 'speed': 'int',
1255            'io-status': 'BlockDeviceIoStatus', 'ready': 'bool',
1256            'status': 'JobStatus',
1257            'auto-finalize': 'bool', 'auto-dismiss': 'bool',
1258            '*error': 'str' } }
1261 # @query-block-jobs:
1263 # Return information about long-running block device operations.
1265 # Returns: a list of @BlockJobInfo for each active block job
1267 # Since: 1.1
1269 { 'command': 'query-block-jobs', 'returns': ['BlockJobInfo'] }
1272 # @block_passwd:
1274 # This command sets the password of a block device that has not been open
1275 # with a password and requires one.
1277 # This command is now obsolete and will always return an error since 2.10
1280 { 'command': 'block_passwd',
1281   'data': { '*device': 'str',
1282             '*node-name': 'str',
1283             'password': 'str' } }
1286 # @block_resize:
1288 # Resize a block image while a guest is running.
1290 # Either @device or @node-name must be set but not both.
1292 # @device: the name of the device to get the image resized
1294 # @node-name: graph node name to get the image resized (Since 2.0)
1296 # @size:  new image size in bytes
1298 # Returns: - nothing on success
1299 #          - If @device is not a valid block device, DeviceNotFound
1301 # Since: 0.14.0
1303 # Example:
1305 # -> { "execute": "block_resize",
1306 #      "arguments": { "device": "scratch", "size": 1073741824 } }
1307 # <- { "return": {} }
1310 { 'command': 'block_resize',
1311   'data': { '*device': 'str',
1312             '*node-name': 'str',
1313             'size': 'int' } }
1316 # @NewImageMode:
1318 # An enumeration that tells QEMU how to set the backing file path in
1319 # a new image file.
1321 # @existing: QEMU should look for an existing image file.
1323 # @absolute-paths: QEMU should create a new image with absolute paths
1324 #                  for the backing file. If there is no backing file available, the new
1325 #                  image will not be backed either.
1327 # Since: 1.1
1329 { 'enum': 'NewImageMode',
1330   'data': [ 'existing', 'absolute-paths' ] }
1333 # @BlockdevSnapshotSync:
1335 # Either @device or @node-name must be set but not both.
1337 # @device: the name of the device to take a snapshot of.
1339 # @node-name: graph node name to generate the snapshot from (Since 2.0)
1341 # @snapshot-file: the target of the new overlay image. If the file
1342 #                 exists, or if it is a device, the overlay will be created in the
1343 #                 existing file/device. Otherwise, a new file will be created.
1345 # @snapshot-node-name: the graph node name of the new image (Since 2.0)
1347 # @format: the format of the overlay image, default is 'qcow2'.
1349 # @mode: whether and how QEMU should create a new image, default is
1350 #        'absolute-paths'.
1352 { 'struct': 'BlockdevSnapshotSync',
1353   'data': { '*device': 'str', '*node-name': 'str',
1354             'snapshot-file': 'str', '*snapshot-node-name': 'str',
1355             '*format': 'str', '*mode': 'NewImageMode' } }
1358 # @BlockdevSnapshot:
1360 # @node: device or node name that will have a snapshot taken.
1362 # @overlay: reference to the existing block device that will become
1363 #           the overlay of @node, as part of taking the snapshot.
1364 #           It must not have a current backing file (this can be
1365 #           achieved by passing "backing": null to blockdev-add).
1367 # Since: 2.5
1369 { 'struct': 'BlockdevSnapshot',
1370   'data': { 'node': 'str', 'overlay': 'str' } }
1373 # @BackupCommon:
1375 # @job-id: identifier for the newly-created block job. If
1376 #          omitted, the device name will be used. (Since 2.7)
1378 # @device: the device name or node-name of a root node which should be copied.
1380 # @sync: what parts of the disk image should be copied to the destination
1381 #        (all the disk, only the sectors allocated in the topmost image, from a
1382 #        dirty bitmap, or only new I/O).
1384 # @speed: the maximum speed, in bytes per second. The default is 0,
1385 #         for unlimited.
1387 # @bitmap: The name of a dirty bitmap to use.
1388 #          Must be present if sync is "bitmap" or "incremental".
1389 #          Can be present if sync is "full" or "top".
1390 #          Must not be present otherwise.
1391 #          (Since 2.4 (drive-backup), 3.1 (blockdev-backup))
1393 # @bitmap-mode: Specifies the type of data the bitmap should contain after
1394 #               the operation concludes.
1395 #               Must be present if a bitmap was provided,
1396 #               Must NOT be present otherwise. (Since 4.2)
1398 # @compress: true to compress data, if the target format supports it.
1399 #            (default: false) (since 2.8)
1401 # @on-source-error: the action to take on an error on the source,
1402 #                   default 'report'.  'stop' and 'enospc' can only be used
1403 #                   if the block device supports io-status (see BlockInfo).
1405 # @on-target-error: the action to take on an error on the target,
1406 #                   default 'report' (no limitations, since this applies to
1407 #                   a different block device than @device).
1409 # @auto-finalize: When false, this job will wait in a PENDING state after it has
1410 #                 finished its work, waiting for @block-job-finalize before
1411 #                 making any block graph changes.
1412 #                 When true, this job will automatically
1413 #                 perform its abort or commit actions.
1414 #                 Defaults to true. (Since 2.12)
1416 # @auto-dismiss: When false, this job will wait in a CONCLUDED state after it
1417 #                has completely ceased all work, and awaits @block-job-dismiss.
1418 #                When true, this job will automatically disappear from the query
1419 #                list without user intervention.
1420 #                Defaults to true. (Since 2.12)
1422 # @filter-node-name: the node name that should be assigned to the
1423 #                    filter driver that the backup job inserts into the graph
1424 #                    above node specified by @drive. If this option is not given,
1425 #                    a node name is autogenerated. (Since: 4.2)
1427 # Note: @on-source-error and @on-target-error only affect background
1428 #       I/O.  If an error occurs during a guest write request, the device's
1429 #       rerror/werror actions will be used.
1431 # Since: 4.2
1433 { 'struct': 'BackupCommon',
1434   'data': { '*job-id': 'str', 'device': 'str',
1435             'sync': 'MirrorSyncMode', '*speed': 'int',
1436             '*bitmap': 'str', '*bitmap-mode': 'BitmapSyncMode',
1437             '*compress': 'bool',
1438             '*on-source-error': 'BlockdevOnError',
1439             '*on-target-error': 'BlockdevOnError',
1440             '*auto-finalize': 'bool', '*auto-dismiss': 'bool',
1441             '*filter-node-name': 'str' } }
1444 # @DriveBackup:
1446 # @target: the target of the new image. If the file exists, or if it
1447 #          is a device, the existing file/device will be used as the new
1448 #          destination.  If it does not exist, a new file will be created.
1450 # @format: the format of the new destination, default is to
1451 #          probe if @mode is 'existing', else the format of the source
1453 # @mode: whether and how QEMU should create a new image, default is
1454 #        'absolute-paths'.
1456 # Since: 1.6
1458 { 'struct': 'DriveBackup',
1459   'base': 'BackupCommon',
1460   'data': { 'target': 'str',
1461             '*format': 'str',
1462             '*mode': 'NewImageMode' } }
1465 # @BlockdevBackup:
1467 # @target: the device name or node-name of the backup target node.
1469 # Since: 2.3
1471 { 'struct': 'BlockdevBackup',
1472   'base': 'BackupCommon',
1473   'data': { 'target': 'str' } }
1476 # @blockdev-snapshot-sync:
1478 # Takes a synchronous snapshot of a block device.
1480 # For the arguments, see the documentation of BlockdevSnapshotSync.
1482 # Returns: - nothing on success
1483 #          - If @device is not a valid block device, DeviceNotFound
1485 # Since: 0.14.0
1487 # Example:
1489 # -> { "execute": "blockdev-snapshot-sync",
1490 #      "arguments": { "device": "ide-hd0",
1491 #                     "snapshot-file":
1492 #                     "/some/place/my-image",
1493 #                     "format": "qcow2" } }
1494 # <- { "return": {} }
1497 { 'command': 'blockdev-snapshot-sync',
1498   'data': 'BlockdevSnapshotSync' }
1502 # @blockdev-snapshot:
1504 # Takes a snapshot of a block device.
1506 # Take a snapshot, by installing 'node' as the backing image of
1507 # 'overlay'. Additionally, if 'node' is associated with a block
1508 # device, the block device changes to using 'overlay' as its new active
1509 # image.
1511 # For the arguments, see the documentation of BlockdevSnapshot.
1513 # Features:
1514 # @allow-write-only-overlay: If present, the check whether this operation is safe
1515 #                            was relaxed so that it can be used to change
1516 #                            backing file of a destination of a blockdev-mirror.
1517 #                            (since 5.0)
1519 # Since: 2.5
1521 # Example:
1523 # -> { "execute": "blockdev-add",
1524 #      "arguments": { "driver": "qcow2",
1525 #                     "node-name": "node1534",
1526 #                     "file": { "driver": "file",
1527 #                               "filename": "hd1.qcow2" },
1528 #                     "backing": null } }
1530 # <- { "return": {} }
1532 # -> { "execute": "blockdev-snapshot",
1533 #      "arguments": { "node": "ide-hd0",
1534 #                     "overlay": "node1534" } }
1535 # <- { "return": {} }
1538 { 'command': 'blockdev-snapshot',
1539   'data': 'BlockdevSnapshot',
1540   'features': [ 'allow-write-only-overlay' ] }
1543 # @change-backing-file:
1545 # Change the backing file in the image file metadata.  This does not
1546 # cause QEMU to reopen the image file to reparse the backing filename
1547 # (it may, however, perform a reopen to change permissions from
1548 # r/o -> r/w -> r/o, if needed). The new backing file string is written
1549 # into the image file metadata, and the QEMU internal strings are
1550 # updated.
1552 # @image-node-name: The name of the block driver state node of the
1553 #                   image to modify. The "device" argument is used
1554 #                   to verify "image-node-name" is in the chain
1555 #                   described by "device".
1557 # @device: The device name or node-name of the root node that owns
1558 #          image-node-name.
1560 # @backing-file: The string to write as the backing file.  This
1561 #                string is not validated, so care should be taken
1562 #                when specifying the string or the image chain may
1563 #                not be able to be reopened again.
1565 # Returns: - Nothing on success
1566 #          - If "device" does not exist or cannot be determined, DeviceNotFound
1568 # Since: 2.1
1570 { 'command': 'change-backing-file',
1571   'data': { 'device': 'str', 'image-node-name': 'str',
1572             'backing-file': 'str' } }
1575 # @block-commit:
1577 # Live commit of data from overlay image nodes into backing nodes - i.e.,
1578 # writes data between 'top' and 'base' into 'base'.
1580 # If top == base, that is an error.
1581 # If top has no overlays on top of it, or if it is in use by a writer,
1582 # the job will not be completed by itself.  The user needs to complete
1583 # the job with the block-job-complete command after getting the ready
1584 # event. (Since 2.0)
1586 # If the base image is smaller than top, then the base image will be
1587 # resized to be the same size as top.  If top is smaller than the base
1588 # image, the base will not be truncated.  If you want the base image
1589 # size to match the size of the smaller top, you can safely truncate
1590 # it yourself once the commit operation successfully completes.
1592 # @job-id: identifier for the newly-created block job. If
1593 #          omitted, the device name will be used. (Since 2.7)
1595 # @device: the device name or node-name of a root node
1597 # @base-node: The node name of the backing image to write data into.
1598 #             If not specified, this is the deepest backing image.
1599 #             (since: 3.1)
1601 # @base: Same as @base-node, except that it is a file name rather than a node
1602 #        name. This must be the exact filename string that was used to open the
1603 #        node; other strings, even if addressing the same file, are not
1604 #        accepted
1606 # @top-node: The node name of the backing image within the image chain
1607 #            which contains the topmost data to be committed down. If
1608 #            not specified, this is the active layer. (since: 3.1)
1610 # @top: Same as @top-node, except that it is a file name rather than a node
1611 #       name. This must be the exact filename string that was used to open the
1612 #       node; other strings, even if addressing the same file, are not
1613 #       accepted
1615 # @backing-file: The backing file string to write into the overlay
1616 #                image of 'top'.  If 'top' does not have an overlay
1617 #                image, or if 'top' is in use by a writer, specifying
1618 #                a backing file string is an error.
1620 #                This filename is not validated.  If a pathname string
1621 #                is such that it cannot be resolved by QEMU, that
1622 #                means that subsequent QMP or HMP commands must use
1623 #                node-names for the image in question, as filename
1624 #                lookup methods will fail.
1626 #                If not specified, QEMU will automatically determine
1627 #                the backing file string to use, or error out if
1628 #                there is no obvious choice. Care should be taken
1629 #                when specifying the string, to specify a valid
1630 #                filename or protocol.
1631 #                (Since 2.1)
1633 # @speed: the maximum speed, in bytes per second
1635 # @on-error: the action to take on an error. 'ignore' means that the request
1636 #            should be retried. (default: report; Since: 5.0)
1638 # @filter-node-name: the node name that should be assigned to the
1639 #                    filter driver that the commit job inserts into the graph
1640 #                    above @top. If this option is not given, a node name is
1641 #                    autogenerated. (Since: 2.9)
1643 # @auto-finalize: When false, this job will wait in a PENDING state after it has
1644 #                 finished its work, waiting for @block-job-finalize before
1645 #                 making any block graph changes.
1646 #                 When true, this job will automatically
1647 #                 perform its abort or commit actions.
1648 #                 Defaults to true. (Since 3.1)
1650 # @auto-dismiss: When false, this job will wait in a CONCLUDED state after it
1651 #                has completely ceased all work, and awaits @block-job-dismiss.
1652 #                When true, this job will automatically disappear from the query
1653 #                list without user intervention.
1654 #                Defaults to true. (Since 3.1)
1656 # Features:
1657 # @deprecated: Members @base and @top are deprecated.  Use @base-node
1658 #              and @top-node instead.
1660 # Returns: - Nothing on success
1661 #          - If @device does not exist, DeviceNotFound
1662 #          - Any other error returns a GenericError.
1664 # Since: 1.3
1666 # Example:
1668 # -> { "execute": "block-commit",
1669 #      "arguments": { "device": "virtio0",
1670 #                     "top": "/tmp/snap1.qcow2" } }
1671 # <- { "return": {} }
1674 { 'command': 'block-commit',
1675   'data': { '*job-id': 'str', 'device': 'str', '*base-node': 'str',
1676             '*base': { 'type': 'str', 'features': [ 'deprecated' ] },
1677             '*top-node': 'str',
1678             '*top': { 'type': 'str', 'features': [ 'deprecated' ] },
1679             '*backing-file': 'str', '*speed': 'int',
1680             '*on-error': 'BlockdevOnError',
1681             '*filter-node-name': 'str',
1682             '*auto-finalize': 'bool', '*auto-dismiss': 'bool' } }
1685 # @drive-backup:
1687 # Start a point-in-time copy of a block device to a new destination.  The
1688 # status of ongoing drive-backup operations can be checked with
1689 # query-block-jobs where the BlockJobInfo.type field has the value 'backup'.
1690 # The operation can be stopped before it has completed using the
1691 # block-job-cancel command.
1693 # Returns: - nothing on success
1694 #          - If @device is not a valid block device, GenericError
1696 # Since: 1.6
1698 # Example:
1700 # -> { "execute": "drive-backup",
1701 #      "arguments": { "device": "drive0",
1702 #                     "sync": "full",
1703 #                     "target": "backup.img" } }
1704 # <- { "return": {} }
1707 { 'command': 'drive-backup', 'boxed': true,
1708   'data': 'DriveBackup' }
1711 # @blockdev-backup:
1713 # Start a point-in-time copy of a block device to a new destination.  The
1714 # status of ongoing blockdev-backup operations can be checked with
1715 # query-block-jobs where the BlockJobInfo.type field has the value 'backup'.
1716 # The operation can be stopped before it has completed using the
1717 # block-job-cancel command.
1719 # Returns: - nothing on success
1720 #          - If @device is not a valid block device, DeviceNotFound
1722 # Since: 2.3
1724 # Example:
1725 # -> { "execute": "blockdev-backup",
1726 #      "arguments": { "device": "src-id",
1727 #                     "sync": "full",
1728 #                     "target": "tgt-id" } }
1729 # <- { "return": {} }
1732 { 'command': 'blockdev-backup', 'boxed': true,
1733   'data': 'BlockdevBackup' }
1737 # @query-named-block-nodes:
1739 # Get the named block driver list
1741 # @flat: Omit the nested data about backing image ("backing-image" key) if true.
1742 #        Default is false (Since 5.0)
1744 # Returns: the list of BlockDeviceInfo
1746 # Since: 2.0
1748 # Example:
1750 # -> { "execute": "query-named-block-nodes" }
1751 # <- { "return": [ { "ro":false,
1752 #                    "drv":"qcow2",
1753 #                    "encrypted":false,
1754 #                    "file":"disks/test.qcow2",
1755 #                    "node-name": "my-node",
1756 #                    "backing_file_depth":1,
1757 #                    "bps":1000000,
1758 #                    "bps_rd":0,
1759 #                    "bps_wr":0,
1760 #                    "iops":1000000,
1761 #                    "iops_rd":0,
1762 #                    "iops_wr":0,
1763 #                    "bps_max": 8000000,
1764 #                    "bps_rd_max": 0,
1765 #                    "bps_wr_max": 0,
1766 #                    "iops_max": 0,
1767 #                    "iops_rd_max": 0,
1768 #                    "iops_wr_max": 0,
1769 #                    "iops_size": 0,
1770 #                    "write_threshold": 0,
1771 #                    "image":{
1772 #                       "filename":"disks/test.qcow2",
1773 #                       "format":"qcow2",
1774 #                       "virtual-size":2048000,
1775 #                       "backing_file":"base.qcow2",
1776 #                       "full-backing-filename":"disks/base.qcow2",
1777 #                       "backing-filename-format":"qcow2",
1778 #                       "snapshots":[
1779 #                          {
1780 #                             "id": "1",
1781 #                             "name": "snapshot1",
1782 #                             "vm-state-size": 0,
1783 #                             "date-sec": 10000200,
1784 #                             "date-nsec": 12,
1785 #                             "vm-clock-sec": 206,
1786 #                             "vm-clock-nsec": 30
1787 #                          }
1788 #                       ],
1789 #                       "backing-image":{
1790 #                           "filename":"disks/base.qcow2",
1791 #                           "format":"qcow2",
1792 #                           "virtual-size":2048000
1793 #                       }
1794 #                    } } ] }
1797 { 'command': 'query-named-block-nodes',
1798   'returns': [ 'BlockDeviceInfo' ],
1799   'data': { '*flat': 'bool' } }
1802 # @XDbgBlockGraphNodeType:
1804 # @block-backend: corresponds to BlockBackend
1806 # @block-job: corresponds to BlockJob
1808 # @block-driver: corresponds to BlockDriverState
1810 # Since: 4.0
1812 { 'enum': 'XDbgBlockGraphNodeType',
1813   'data': [ 'block-backend', 'block-job', 'block-driver' ] }
1816 # @XDbgBlockGraphNode:
1818 # @id: Block graph node identifier. This @id is generated only for
1819 #      x-debug-query-block-graph and does not relate to any other identifiers in
1820 #      Qemu.
1822 # @type: Type of graph node. Can be one of block-backend, block-job or
1823 #        block-driver-state.
1825 # @name: Human readable name of the node. Corresponds to node-name for
1826 #        block-driver-state nodes; is not guaranteed to be unique in the whole
1827 #        graph (with block-jobs and block-backends).
1829 # Since: 4.0
1831 { 'struct': 'XDbgBlockGraphNode',
1832   'data': { 'id': 'uint64', 'type': 'XDbgBlockGraphNodeType', 'name': 'str' } }
1835 # @BlockPermission:
1837 # Enum of base block permissions.
1839 # @consistent-read: A user that has the "permission" of consistent reads is
1840 #                   guaranteed that their view of the contents of the block
1841 #                   device is complete and self-consistent, representing the
1842 #                   contents of a disk at a specific point.
1843 #                   For most block devices (including their backing files) this
1844 #                   is true, but the property cannot be maintained in a few
1845 #                   situations like for intermediate nodes of a commit block
1846 #                   job.
1848 # @write: This permission is required to change the visible disk contents.
1850 # @write-unchanged: This permission (which is weaker than BLK_PERM_WRITE) is
1851 #                   both enough and required for writes to the block node when
1852 #                   the caller promises that the visible disk content doesn't
1853 #                   change.
1854 #                   As the BLK_PERM_WRITE permission is strictly stronger,
1855 #                   either is sufficient to perform an unchanging write.
1857 # @resize: This permission is required to change the size of a block node.
1859 # @graph-mod: This permission is required to change the node that this
1860 #             BdrvChild points to.
1862 # Since: 4.0
1864 { 'enum': 'BlockPermission',
1865   'data': [ 'consistent-read', 'write', 'write-unchanged', 'resize',
1866             'graph-mod' ] }
1868 # @XDbgBlockGraphEdge:
1870 # Block Graph edge description for x-debug-query-block-graph.
1872 # @parent: parent id
1874 # @child: child id
1876 # @name: name of the relation (examples are 'file' and 'backing')
1878 # @perm: granted permissions for the parent operating on the child
1880 # @shared-perm: permissions that can still be granted to other users of the
1881 #               child while it is still attached to this parent
1883 # Since: 4.0
1885 { 'struct': 'XDbgBlockGraphEdge',
1886   'data': { 'parent': 'uint64', 'child': 'uint64',
1887             'name': 'str', 'perm': [ 'BlockPermission' ],
1888             'shared-perm': [ 'BlockPermission' ] } }
1891 # @XDbgBlockGraph:
1893 # Block Graph - list of nodes and list of edges.
1895 # Since: 4.0
1897 { 'struct': 'XDbgBlockGraph',
1898   'data': { 'nodes': ['XDbgBlockGraphNode'], 'edges': ['XDbgBlockGraphEdge'] } }
1901 # @x-debug-query-block-graph:
1903 # Get the block graph.
1905 # Since: 4.0
1907 { 'command': 'x-debug-query-block-graph', 'returns': 'XDbgBlockGraph' }
1910 # @drive-mirror:
1912 # Start mirroring a block device's writes to a new destination. target
1913 # specifies the target of the new image. If the file exists, or if it
1914 # is a device, it will be used as the new destination for writes. If
1915 # it does not exist, a new file will be created. format specifies the
1916 # format of the mirror image, default is to probe if mode='existing',
1917 # else the format of the source.
1919 # Returns: - nothing on success
1920 #          - If @device is not a valid block device, GenericError
1922 # Since: 1.3
1924 # Example:
1926 # -> { "execute": "drive-mirror",
1927 #      "arguments": { "device": "ide-hd0",
1928 #                     "target": "/some/place/my-image",
1929 #                     "sync": "full",
1930 #                     "format": "qcow2" } }
1931 # <- { "return": {} }
1934 { 'command': 'drive-mirror', 'boxed': true,
1935   'data': 'DriveMirror' }
1938 # @DriveMirror:
1940 # A set of parameters describing drive mirror setup.
1942 # @job-id: identifier for the newly-created block job. If
1943 #          omitted, the device name will be used. (Since 2.7)
1945 # @device:  the device name or node-name of a root node whose writes should be
1946 #           mirrored.
1948 # @target: the target of the new image. If the file exists, or if it
1949 #          is a device, the existing file/device will be used as the new
1950 #          destination.  If it does not exist, a new file will be created.
1952 # @format: the format of the new destination, default is to
1953 #          probe if @mode is 'existing', else the format of the source
1955 # @node-name: the new block driver state node name in the graph
1956 #             (Since 2.1)
1958 # @replaces: with sync=full graph node name to be replaced by the new
1959 #            image when a whole image copy is done. This can be used to repair
1960 #            broken Quorum files.  By default, @device is replaced, although
1961 #            implicitly created filters on it are kept. (Since 2.1)
1963 # @mode: whether and how QEMU should create a new image, default is
1964 #        'absolute-paths'.
1966 # @speed:  the maximum speed, in bytes per second
1968 # @sync: what parts of the disk image should be copied to the destination
1969 #        (all the disk, only the sectors allocated in the topmost image, or
1970 #        only new I/O).
1972 # @granularity: granularity of the dirty bitmap, default is 64K
1973 #               if the image format doesn't have clusters, 4K if the clusters
1974 #               are smaller than that, else the cluster size.  Must be a
1975 #               power of 2 between 512 and 64M (since 1.4).
1977 # @buf-size: maximum amount of data in flight from source to
1978 #            target (since 1.4).
1980 # @on-source-error: the action to take on an error on the source,
1981 #                   default 'report'.  'stop' and 'enospc' can only be used
1982 #                   if the block device supports io-status (see BlockInfo).
1984 # @on-target-error: the action to take on an error on the target,
1985 #                   default 'report' (no limitations, since this applies to
1986 #                   a different block device than @device).
1987 # @unmap: Whether to try to unmap target sectors where source has
1988 #         only zero. If true, and target unallocated sectors will read as zero,
1989 #         target image sectors will be unmapped; otherwise, zeroes will be
1990 #         written. Both will result in identical contents.
1991 #         Default is true. (Since 2.4)
1993 # @copy-mode: when to copy data to the destination; defaults to 'background'
1994 #             (Since: 3.0)
1996 # @auto-finalize: When false, this job will wait in a PENDING state after it has
1997 #                 finished its work, waiting for @block-job-finalize before
1998 #                 making any block graph changes.
1999 #                 When true, this job will automatically
2000 #                 perform its abort or commit actions.
2001 #                 Defaults to true. (Since 3.1)
2003 # @auto-dismiss: When false, this job will wait in a CONCLUDED state after it
2004 #                has completely ceased all work, and awaits @block-job-dismiss.
2005 #                When true, this job will automatically disappear from the query
2006 #                list without user intervention.
2007 #                Defaults to true. (Since 3.1)
2008 # Since: 1.3
2010 { 'struct': 'DriveMirror',
2011   'data': { '*job-id': 'str', 'device': 'str', 'target': 'str',
2012             '*format': 'str', '*node-name': 'str', '*replaces': 'str',
2013             'sync': 'MirrorSyncMode', '*mode': 'NewImageMode',
2014             '*speed': 'int', '*granularity': 'uint32',
2015             '*buf-size': 'int', '*on-source-error': 'BlockdevOnError',
2016             '*on-target-error': 'BlockdevOnError',
2017             '*unmap': 'bool', '*copy-mode': 'MirrorCopyMode',
2018             '*auto-finalize': 'bool', '*auto-dismiss': 'bool' } }
2021 # @BlockDirtyBitmap:
2023 # @node: name of device/node which the bitmap is tracking
2025 # @name: name of the dirty bitmap
2027 # Since: 2.4
2029 { 'struct': 'BlockDirtyBitmap',
2030   'data': { 'node': 'str', 'name': 'str' } }
2033 # @BlockDirtyBitmapAdd:
2035 # @node: name of device/node which the bitmap is tracking
2037 # @name: name of the dirty bitmap (must be less than 1024 bytes)
2039 # @granularity: the bitmap granularity, default is 64k for
2040 #               block-dirty-bitmap-add
2042 # @persistent: the bitmap is persistent, i.e. it will be saved to the
2043 #              corresponding block device image file on its close. For now only
2044 #              Qcow2 disks support persistent bitmaps. Default is false for
2045 #              block-dirty-bitmap-add. (Since: 2.10)
2047 # @disabled: the bitmap is created in the disabled state, which means that
2048 #            it will not track drive changes. The bitmap may be enabled with
2049 #            block-dirty-bitmap-enable. Default is false. (Since: 4.0)
2051 # Since: 2.4
2053 { 'struct': 'BlockDirtyBitmapAdd',
2054   'data': { 'node': 'str', 'name': 'str', '*granularity': 'uint32',
2055             '*persistent': 'bool', '*disabled': 'bool' } }
2058 # @BlockDirtyBitmapMergeSource:
2060 # @local: name of the bitmap, attached to the same node as target bitmap.
2062 # @external: bitmap with specified node
2064 # Since: 4.1
2066 { 'alternate': 'BlockDirtyBitmapMergeSource',
2067   'data': { 'local': 'str',
2068             'external': 'BlockDirtyBitmap' } }
2071 # @BlockDirtyBitmapMerge:
2073 # @node: name of device/node which the @target bitmap is tracking
2075 # @target: name of the destination dirty bitmap
2077 # @bitmaps: name(s) of the source dirty bitmap(s) at @node and/or fully
2078 #           specified BlockDirtyBitmap elements. The latter are supported
2079 #           since 4.1.
2081 # Since: 4.0
2083 { 'struct': 'BlockDirtyBitmapMerge',
2084   'data': { 'node': 'str', 'target': 'str',
2085             'bitmaps': ['BlockDirtyBitmapMergeSource'] } }
2088 # @block-dirty-bitmap-add:
2090 # Create a dirty bitmap with a name on the node, and start tracking the writes.
2092 # Returns: - nothing on success
2093 #          - If @node is not a valid block device or node, DeviceNotFound
2094 #          - If @name is already taken, GenericError with an explanation
2096 # Since: 2.4
2098 # Example:
2100 # -> { "execute": "block-dirty-bitmap-add",
2101 #      "arguments": { "node": "drive0", "name": "bitmap0" } }
2102 # <- { "return": {} }
2105 { 'command': 'block-dirty-bitmap-add',
2106   'data': 'BlockDirtyBitmapAdd' }
2109 # @block-dirty-bitmap-remove:
2111 # Stop write tracking and remove the dirty bitmap that was created
2112 # with block-dirty-bitmap-add. If the bitmap is persistent, remove it from its
2113 # storage too.
2115 # Returns: - nothing on success
2116 #          - If @node is not a valid block device or node, DeviceNotFound
2117 #          - If @name is not found, GenericError with an explanation
2118 #          - if @name is frozen by an operation, GenericError
2120 # Since: 2.4
2122 # Example:
2124 # -> { "execute": "block-dirty-bitmap-remove",
2125 #      "arguments": { "node": "drive0", "name": "bitmap0" } }
2126 # <- { "return": {} }
2129 { 'command': 'block-dirty-bitmap-remove',
2130   'data': 'BlockDirtyBitmap' }
2133 # @block-dirty-bitmap-clear:
2135 # Clear (reset) a dirty bitmap on the device, so that an incremental
2136 # backup from this point in time forward will only backup clusters
2137 # modified after this clear operation.
2139 # Returns: - nothing on success
2140 #          - If @node is not a valid block device, DeviceNotFound
2141 #          - If @name is not found, GenericError with an explanation
2143 # Since: 2.4
2145 # Example:
2147 # -> { "execute": "block-dirty-bitmap-clear",
2148 #      "arguments": { "node": "drive0", "name": "bitmap0" } }
2149 # <- { "return": {} }
2152 { 'command': 'block-dirty-bitmap-clear',
2153   'data': 'BlockDirtyBitmap' }
2156 # @block-dirty-bitmap-enable:
2158 # Enables a dirty bitmap so that it will begin tracking disk changes.
2160 # Returns: - nothing on success
2161 #          - If @node is not a valid block device, DeviceNotFound
2162 #          - If @name is not found, GenericError with an explanation
2164 # Since: 4.0
2166 # Example:
2168 # -> { "execute": "block-dirty-bitmap-enable",
2169 #      "arguments": { "node": "drive0", "name": "bitmap0" } }
2170 # <- { "return": {} }
2173 { 'command': 'block-dirty-bitmap-enable',
2174   'data': 'BlockDirtyBitmap' }
2177 # @block-dirty-bitmap-disable:
2179 # Disables a dirty bitmap so that it will stop tracking disk changes.
2181 # Returns: - nothing on success
2182 #          - If @node is not a valid block device, DeviceNotFound
2183 #          - If @name is not found, GenericError with an explanation
2185 # Since: 4.0
2187 # Example:
2189 # -> { "execute": "block-dirty-bitmap-disable",
2190 #      "arguments": { "node": "drive0", "name": "bitmap0" } }
2191 # <- { "return": {} }
2194 { 'command': 'block-dirty-bitmap-disable',
2195   'data': 'BlockDirtyBitmap' }
2198 # @block-dirty-bitmap-merge:
2200 # Merge dirty bitmaps listed in @bitmaps to the @target dirty bitmap.
2201 # Dirty bitmaps in @bitmaps will be unchanged, except if it also appears
2202 # as the @target bitmap. Any bits already set in @target will still be
2203 # set after the merge, i.e., this operation does not clear the target.
2204 # On error, @target is unchanged.
2206 # The resulting bitmap will count as dirty any clusters that were dirty in any
2207 # of the source bitmaps. This can be used to achieve backup checkpoints, or in
2208 # simpler usages, to copy bitmaps.
2210 # Returns: - nothing on success
2211 #          - If @node is not a valid block device, DeviceNotFound
2212 #          - If any bitmap in @bitmaps or @target is not found, GenericError
2213 #          - If any of the bitmaps have different sizes or granularities,
2214 #            GenericError
2216 # Since: 4.0
2218 # Example:
2220 # -> { "execute": "block-dirty-bitmap-merge",
2221 #      "arguments": { "node": "drive0", "target": "bitmap0",
2222 #                     "bitmaps": ["bitmap1"] } }
2223 # <- { "return": {} }
2226 { 'command': 'block-dirty-bitmap-merge',
2227   'data': 'BlockDirtyBitmapMerge' }
2230 # @BlockDirtyBitmapSha256:
2232 # SHA256 hash of dirty bitmap data
2234 # @sha256: ASCII representation of SHA256 bitmap hash
2236 # Since: 2.10
2238 { 'struct': 'BlockDirtyBitmapSha256',
2239   'data': {'sha256': 'str'} }
2242 # @x-debug-block-dirty-bitmap-sha256:
2244 # Get bitmap SHA256.
2246 # Returns: - BlockDirtyBitmapSha256 on success
2247 #          - If @node is not a valid block device, DeviceNotFound
2248 #          - If @name is not found or if hashing has failed, GenericError with an
2249 #            explanation
2251 # Since: 2.10
2253 { 'command': 'x-debug-block-dirty-bitmap-sha256',
2254   'data': 'BlockDirtyBitmap', 'returns': 'BlockDirtyBitmapSha256' }
2257 # @blockdev-mirror:
2259 # Start mirroring a block device's writes to a new destination.
2261 # @job-id: identifier for the newly-created block job. If
2262 #          omitted, the device name will be used. (Since 2.7)
2264 # @device: The device name or node-name of a root node whose writes should be
2265 #          mirrored.
2267 # @target: the id or node-name of the block device to mirror to. This mustn't be
2268 #          attached to guest.
2270 # @replaces: with sync=full graph node name to be replaced by the new
2271 #            image when a whole image copy is done. This can be used to repair
2272 #            broken Quorum files.  By default, @device is replaced, although
2273 #            implicitly created filters on it are kept.
2275 # @speed:  the maximum speed, in bytes per second
2277 # @sync: what parts of the disk image should be copied to the destination
2278 #        (all the disk, only the sectors allocated in the topmost image, or
2279 #        only new I/O).
2281 # @granularity: granularity of the dirty bitmap, default is 64K
2282 #               if the image format doesn't have clusters, 4K if the clusters
2283 #               are smaller than that, else the cluster size.  Must be a
2284 #               power of 2 between 512 and 64M
2286 # @buf-size: maximum amount of data in flight from source to
2287 #            target
2289 # @on-source-error: the action to take on an error on the source,
2290 #                   default 'report'.  'stop' and 'enospc' can only be used
2291 #                   if the block device supports io-status (see BlockInfo).
2293 # @on-target-error: the action to take on an error on the target,
2294 #                   default 'report' (no limitations, since this applies to
2295 #                   a different block device than @device).
2297 # @filter-node-name: the node name that should be assigned to the
2298 #                    filter driver that the mirror job inserts into the graph
2299 #                    above @device. If this option is not given, a node name is
2300 #                    autogenerated. (Since: 2.9)
2302 # @copy-mode: when to copy data to the destination; defaults to 'background'
2303 #             (Since: 3.0)
2305 # @auto-finalize: When false, this job will wait in a PENDING state after it has
2306 #                 finished its work, waiting for @block-job-finalize before
2307 #                 making any block graph changes.
2308 #                 When true, this job will automatically
2309 #                 perform its abort or commit actions.
2310 #                 Defaults to true. (Since 3.1)
2312 # @auto-dismiss: When false, this job will wait in a CONCLUDED state after it
2313 #                has completely ceased all work, and awaits @block-job-dismiss.
2314 #                When true, this job will automatically disappear from the query
2315 #                list without user intervention.
2316 #                Defaults to true. (Since 3.1)
2317 # Returns: nothing on success.
2319 # Since: 2.6
2321 # Example:
2323 # -> { "execute": "blockdev-mirror",
2324 #      "arguments": { "device": "ide-hd0",
2325 #                     "target": "target0",
2326 #                     "sync": "full" } }
2327 # <- { "return": {} }
2330 { 'command': 'blockdev-mirror',
2331   'data': { '*job-id': 'str', 'device': 'str', 'target': 'str',
2332             '*replaces': 'str',
2333             'sync': 'MirrorSyncMode',
2334             '*speed': 'int', '*granularity': 'uint32',
2335             '*buf-size': 'int', '*on-source-error': 'BlockdevOnError',
2336             '*on-target-error': 'BlockdevOnError',
2337             '*filter-node-name': 'str',
2338             '*copy-mode': 'MirrorCopyMode',
2339             '*auto-finalize': 'bool', '*auto-dismiss': 'bool' } }
2342 # @BlockIOThrottle:
2344 # A set of parameters describing block throttling.
2346 # @device: Block device name
2348 # @id: The name or QOM path of the guest device (since: 2.8)
2350 # @bps: total throughput limit in bytes per second
2352 # @bps_rd: read throughput limit in bytes per second
2354 # @bps_wr: write throughput limit in bytes per second
2356 # @iops: total I/O operations per second
2358 # @iops_rd: read I/O operations per second
2360 # @iops_wr: write I/O operations per second
2362 # @bps_max: total throughput limit during bursts,
2363 #           in bytes (Since 1.7)
2365 # @bps_rd_max: read throughput limit during bursts,
2366 #              in bytes (Since 1.7)
2368 # @bps_wr_max: write throughput limit during bursts,
2369 #              in bytes (Since 1.7)
2371 # @iops_max: total I/O operations per second during bursts,
2372 #            in bytes (Since 1.7)
2374 # @iops_rd_max: read I/O operations per second during bursts,
2375 #               in bytes (Since 1.7)
2377 # @iops_wr_max: write I/O operations per second during bursts,
2378 #               in bytes (Since 1.7)
2380 # @bps_max_length: maximum length of the @bps_max burst
2381 #                  period, in seconds. It must only
2382 #                  be set if @bps_max is set as well.
2383 #                  Defaults to 1. (Since 2.6)
2385 # @bps_rd_max_length: maximum length of the @bps_rd_max
2386 #                     burst period, in seconds. It must only
2387 #                     be set if @bps_rd_max is set as well.
2388 #                     Defaults to 1. (Since 2.6)
2390 # @bps_wr_max_length: maximum length of the @bps_wr_max
2391 #                     burst period, in seconds. It must only
2392 #                     be set if @bps_wr_max is set as well.
2393 #                     Defaults to 1. (Since 2.6)
2395 # @iops_max_length: maximum length of the @iops burst
2396 #                   period, in seconds. It must only
2397 #                   be set if @iops_max is set as well.
2398 #                   Defaults to 1. (Since 2.6)
2400 # @iops_rd_max_length: maximum length of the @iops_rd_max
2401 #                      burst period, in seconds. It must only
2402 #                      be set if @iops_rd_max is set as well.
2403 #                      Defaults to 1. (Since 2.6)
2405 # @iops_wr_max_length: maximum length of the @iops_wr_max
2406 #                      burst period, in seconds. It must only
2407 #                      be set if @iops_wr_max is set as well.
2408 #                      Defaults to 1. (Since 2.6)
2410 # @iops_size: an I/O size in bytes (Since 1.7)
2412 # @group: throttle group name (Since 2.4)
2414 # Features:
2415 # @deprecated: Member @device is deprecated.  Use @id instead.
2417 # Since: 1.1
2419 { 'struct': 'BlockIOThrottle',
2420   'data': { '*device': { 'type': 'str', 'features': [ 'deprecated' ] },
2421             '*id': 'str', 'bps': 'int', 'bps_rd': 'int',
2422             'bps_wr': 'int', 'iops': 'int', 'iops_rd': 'int', 'iops_wr': 'int',
2423             '*bps_max': 'int', '*bps_rd_max': 'int',
2424             '*bps_wr_max': 'int', '*iops_max': 'int',
2425             '*iops_rd_max': 'int', '*iops_wr_max': 'int',
2426             '*bps_max_length': 'int', '*bps_rd_max_length': 'int',
2427             '*bps_wr_max_length': 'int', '*iops_max_length': 'int',
2428             '*iops_rd_max_length': 'int', '*iops_wr_max_length': 'int',
2429             '*iops_size': 'int', '*group': 'str' } }
2432 # @ThrottleLimits:
2434 # Limit parameters for throttling.
2435 # Since some limit combinations are illegal, limits should always be set in one
2436 # transaction. All fields are optional. When setting limits, if a field is
2437 # missing the current value is not changed.
2439 # @iops-total: limit total I/O operations per second
2440 # @iops-total-max: I/O operations burst
2441 # @iops-total-max-length: length of the iops-total-max burst period, in seconds
2442 #                         It must only be set if @iops-total-max is set as well.
2443 # @iops-read: limit read operations per second
2444 # @iops-read-max: I/O operations read burst
2445 # @iops-read-max-length: length of the iops-read-max burst period, in seconds
2446 #                        It must only be set if @iops-read-max is set as well.
2447 # @iops-write: limit write operations per second
2448 # @iops-write-max: I/O operations write burst
2449 # @iops-write-max-length: length of the iops-write-max burst period, in seconds
2450 #                         It must only be set if @iops-write-max is set as well.
2451 # @bps-total: limit total bytes per second
2452 # @bps-total-max: total bytes burst
2453 # @bps-total-max-length: length of the bps-total-max burst period, in seconds.
2454 #                        It must only be set if @bps-total-max is set as well.
2455 # @bps-read: limit read bytes per second
2456 # @bps-read-max: total bytes read burst
2457 # @bps-read-max-length: length of the bps-read-max burst period, in seconds
2458 #                       It must only be set if @bps-read-max is set as well.
2459 # @bps-write: limit write bytes per second
2460 # @bps-write-max: total bytes write burst
2461 # @bps-write-max-length: length of the bps-write-max burst period, in seconds
2462 #                        It must only be set if @bps-write-max is set as well.
2463 # @iops-size: when limiting by iops max size of an I/O in bytes
2465 # Since: 2.11
2467 { 'struct': 'ThrottleLimits',
2468   'data': { '*iops-total' : 'int', '*iops-total-max' : 'int',
2469             '*iops-total-max-length' : 'int', '*iops-read' : 'int',
2470             '*iops-read-max' : 'int', '*iops-read-max-length' : 'int',
2471             '*iops-write' : 'int', '*iops-write-max' : 'int',
2472             '*iops-write-max-length' : 'int', '*bps-total' : 'int',
2473             '*bps-total-max' : 'int', '*bps-total-max-length' : 'int',
2474             '*bps-read' : 'int', '*bps-read-max' : 'int',
2475             '*bps-read-max-length' : 'int', '*bps-write' : 'int',
2476             '*bps-write-max' : 'int', '*bps-write-max-length' : 'int',
2477             '*iops-size' : 'int' } }
2480 # @block-stream:
2482 # Copy data from a backing file into a block device.
2484 # The block streaming operation is performed in the background until the entire
2485 # backing file has been copied.  This command returns immediately once streaming
2486 # has started.  The status of ongoing block streaming operations can be checked
2487 # with query-block-jobs.  The operation can be stopped before it has completed
2488 # using the block-job-cancel command.
2490 # The node that receives the data is called the top image, can be located in
2491 # any part of the chain (but always above the base image; see below) and can be
2492 # specified using its device or node name. Earlier qemu versions only allowed
2493 # 'device' to name the top level node; presence of the 'base-node' parameter
2494 # during introspection can be used as a witness of the enhanced semantics
2495 # of 'device'.
2497 # If a base file is specified then sectors are not copied from that base file and
2498 # its backing chain.  This can be used to stream a subset of the backing file
2499 # chain instead of flattening the entire image.
2500 # When streaming completes the image file will have the base file as its backing
2501 # file, unless that node was changed while the job was running.  In that case,
2502 # base's parent's backing (or filtered, whichever exists) child (i.e., base at
2503 # the beginning of the job) will be the new backing file.
2505 # On successful completion the image file is updated to drop the backing file
2506 # and the BLOCK_JOB_COMPLETED event is emitted.
2508 # In case @device is a filter node, block-stream modifies the first non-filter
2509 # overlay node below it to point to the new backing node instead of modifying
2510 # @device itself.
2512 # @job-id: identifier for the newly-created block job. If
2513 #          omitted, the device name will be used. (Since 2.7)
2515 # @device: the device or node name of the top image
2517 # @base: the common backing file name.
2518 #        It cannot be set if @base-node is also set.
2520 # @base-node: the node name of the backing file.
2521 #             It cannot be set if @base is also set. (Since 2.8)
2523 # @backing-file: The backing file string to write into the top
2524 #                image. This filename is not validated.
2526 #                If a pathname string is such that it cannot be
2527 #                resolved by QEMU, that means that subsequent QMP or
2528 #                HMP commands must use node-names for the image in
2529 #                question, as filename lookup methods will fail.
2531 #                If not specified, QEMU will automatically determine
2532 #                the backing file string to use, or error out if there
2533 #                is no obvious choice.  Care should be taken when
2534 #                specifying the string, to specify a valid filename or
2535 #                protocol.
2536 #                (Since 2.1)
2538 # @speed: the maximum speed, in bytes per second
2540 # @on-error: the action to take on an error (default report).
2541 #            'stop' and 'enospc' can only be used if the block device
2542 #            supports io-status (see BlockInfo).  Since 1.3.
2544 # @auto-finalize: When false, this job will wait in a PENDING state after it has
2545 #                 finished its work, waiting for @block-job-finalize before
2546 #                 making any block graph changes.
2547 #                 When true, this job will automatically
2548 #                 perform its abort or commit actions.
2549 #                 Defaults to true. (Since 3.1)
2551 # @auto-dismiss: When false, this job will wait in a CONCLUDED state after it
2552 #                has completely ceased all work, and awaits @block-job-dismiss.
2553 #                When true, this job will automatically disappear from the query
2554 #                list without user intervention.
2555 #                Defaults to true. (Since 3.1)
2557 # Returns: - Nothing on success.
2558 #          - If @device does not exist, DeviceNotFound.
2560 # Since: 1.1
2562 # Example:
2564 # -> { "execute": "block-stream",
2565 #      "arguments": { "device": "virtio0",
2566 #                     "base": "/tmp/master.qcow2" } }
2567 # <- { "return": {} }
2570 { 'command': 'block-stream',
2571   'data': { '*job-id': 'str', 'device': 'str', '*base': 'str',
2572             '*base-node': 'str', '*backing-file': 'str', '*speed': 'int',
2573             '*on-error': 'BlockdevOnError',
2574             '*auto-finalize': 'bool', '*auto-dismiss': 'bool' } }
2577 # @block-job-set-speed:
2579 # Set maximum speed for a background block operation.
2581 # This command can only be issued when there is an active block job.
2583 # Throttling can be disabled by setting the speed to 0.
2585 # @device: The job identifier. This used to be a device name (hence
2586 #          the name of the parameter), but since QEMU 2.7 it can have
2587 #          other values.
2589 # @speed: the maximum speed, in bytes per second, or 0 for unlimited.
2590 #         Defaults to 0.
2592 # Returns: - Nothing on success
2593 #          - If no background operation is active on this device, DeviceNotActive
2595 # Since: 1.1
2597 { 'command': 'block-job-set-speed',
2598   'data': { 'device': 'str', 'speed': 'int' } }
2601 # @block-job-cancel:
2603 # Stop an active background block operation.
2605 # This command returns immediately after marking the active background block
2606 # operation for cancellation.  It is an error to call this command if no
2607 # operation is in progress.
2609 # The operation will cancel as soon as possible and then emit the
2610 # BLOCK_JOB_CANCELLED event.  Before that happens the job is still visible when
2611 # enumerated using query-block-jobs.
2613 # Note that if you issue 'block-job-cancel' after 'drive-mirror' has indicated
2614 # (via the event BLOCK_JOB_READY) that the source and destination are
2615 # synchronized, then the event triggered by this command changes to
2616 # BLOCK_JOB_COMPLETED, to indicate that the mirroring has ended and the
2617 # destination now has a point-in-time copy tied to the time of the cancellation.
2619 # For streaming, the image file retains its backing file unless the streaming
2620 # operation happens to complete just as it is being cancelled.  A new streaming
2621 # operation can be started at a later time to finish copying all data from the
2622 # backing file.
2624 # @device: The job identifier. This used to be a device name (hence
2625 #          the name of the parameter), but since QEMU 2.7 it can have
2626 #          other values.
2628 # @force: If true, and the job has already emitted the event BLOCK_JOB_READY,
2629 #         abandon the job immediately (even if it is paused) instead of waiting
2630 #         for the destination to complete its final synchronization (since 1.3)
2632 # Returns: - Nothing on success
2633 #          - If no background operation is active on this device, DeviceNotActive
2635 # Since: 1.1
2637 { 'command': 'block-job-cancel', 'data': { 'device': 'str', '*force': 'bool' } }
2640 # @block-job-pause:
2642 # Pause an active background block operation.
2644 # This command returns immediately after marking the active background block
2645 # operation for pausing.  It is an error to call this command if no
2646 # operation is in progress or if the job is already paused.
2648 # The operation will pause as soon as possible.  No event is emitted when
2649 # the operation is actually paused.  Cancelling a paused job automatically
2650 # resumes it.
2652 # @device: The job identifier. This used to be a device name (hence
2653 #          the name of the parameter), but since QEMU 2.7 it can have
2654 #          other values.
2656 # Returns: - Nothing on success
2657 #          - If no background operation is active on this device, DeviceNotActive
2659 # Since: 1.3
2661 { 'command': 'block-job-pause', 'data': { 'device': 'str' } }
2664 # @block-job-resume:
2666 # Resume an active background block operation.
2668 # This command returns immediately after resuming a paused background block
2669 # operation.  It is an error to call this command if no operation is in
2670 # progress or if the job is not paused.
2672 # This command also clears the error status of the job.
2674 # @device: The job identifier. This used to be a device name (hence
2675 #          the name of the parameter), but since QEMU 2.7 it can have
2676 #          other values.
2678 # Returns: - Nothing on success
2679 #          - If no background operation is active on this device, DeviceNotActive
2681 # Since: 1.3
2683 { 'command': 'block-job-resume', 'data': { 'device': 'str' } }
2686 # @block-job-complete:
2688 # Manually trigger completion of an active background block operation.  This
2689 # is supported for drive mirroring, where it also switches the device to
2690 # write to the target path only.  The ability to complete is signaled with
2691 # a BLOCK_JOB_READY event.
2693 # This command completes an active background block operation synchronously.
2694 # The ordering of this command's return with the BLOCK_JOB_COMPLETED event
2695 # is not defined.  Note that if an I/O error occurs during the processing of
2696 # this command: 1) the command itself will fail; 2) the error will be processed
2697 # according to the rerror/werror arguments that were specified when starting
2698 # the operation.
2700 # A cancelled or paused job cannot be completed.
2702 # @device: The job identifier. This used to be a device name (hence
2703 #          the name of the parameter), but since QEMU 2.7 it can have
2704 #          other values.
2706 # Returns: - Nothing on success
2707 #          - If no background operation is active on this device, DeviceNotActive
2709 # Since: 1.3
2711 { 'command': 'block-job-complete', 'data': { 'device': 'str' } }
2714 # @block-job-dismiss:
2716 # For jobs that have already concluded, remove them from the block-job-query
2717 # list. This command only needs to be run for jobs which were started with
2718 # QEMU 2.12+ job lifetime management semantics.
2720 # This command will refuse to operate on any job that has not yet reached
2721 # its terminal state, JOB_STATUS_CONCLUDED. For jobs that make use of the
2722 # BLOCK_JOB_READY event, block-job-cancel or block-job-complete will still need
2723 # to be used as appropriate.
2725 # @id: The job identifier.
2727 # Returns: Nothing on success
2729 # Since: 2.12
2731 { 'command': 'block-job-dismiss', 'data': { 'id': 'str' } }
2734 # @block-job-finalize:
2736 # Once a job that has manual=true reaches the pending state, it can be
2737 # instructed to finalize any graph changes and do any necessary cleanup
2738 # via this command.
2739 # For jobs in a transaction, instructing one job to finalize will force
2740 # ALL jobs in the transaction to finalize, so it is only necessary to instruct
2741 # a single member job to finalize.
2743 # @id: The job identifier.
2745 # Returns: Nothing on success
2747 # Since: 2.12
2749 { 'command': 'block-job-finalize', 'data': { 'id': 'str' } }
2752 # @BlockdevDiscardOptions:
2754 # Determines how to handle discard requests.
2756 # @ignore: Ignore the request
2757 # @unmap: Forward as an unmap request
2759 # Since: 2.9
2761 { 'enum': 'BlockdevDiscardOptions',
2762   'data': [ 'ignore', 'unmap' ] }
2765 # @BlockdevDetectZeroesOptions:
2767 # Describes the operation mode for the automatic conversion of plain
2768 # zero writes by the OS to driver specific optimized zero write commands.
2770 # @off: Disabled (default)
2771 # @on: Enabled
2772 # @unmap: Enabled and even try to unmap blocks if possible. This requires
2773 #         also that @BlockdevDiscardOptions is set to unmap for this device.
2775 # Since: 2.1
2777 { 'enum': 'BlockdevDetectZeroesOptions',
2778   'data': [ 'off', 'on', 'unmap' ] }
2781 # @BlockdevAioOptions:
2783 # Selects the AIO backend to handle I/O requests
2785 # @threads: Use qemu's thread pool
2786 # @native: Use native AIO backend (only Linux and Windows)
2787 # @io_uring: Use linux io_uring (since 5.0)
2789 # Since: 2.9
2791 { 'enum': 'BlockdevAioOptions',
2792   'data': [ 'threads', 'native',
2793             { 'name': 'io_uring', 'if': 'defined(CONFIG_LINUX_IO_URING)' } ] }
2796 # @BlockdevCacheOptions:
2798 # Includes cache-related options for block devices
2800 # @direct: enables use of O_DIRECT (bypass the host page cache;
2801 #          default: false)
2802 # @no-flush: ignore any flush requests for the device (default:
2803 #            false)
2805 # Since: 2.9
2807 { 'struct': 'BlockdevCacheOptions',
2808   'data': { '*direct': 'bool',
2809             '*no-flush': 'bool' } }
2812 # @BlockdevDriver:
2814 # Drivers that are supported in block device operations.
2816 # @throttle: Since 2.11
2817 # @nvme: Since 2.12
2818 # @copy-on-read: Since 3.0
2819 # @blklogwrites: Since 3.0
2820 # @blkreplay: Since 4.2
2821 # @compress: Since 5.0
2823 # Since: 2.9
2825 { 'enum': 'BlockdevDriver',
2826   'data': [ 'blkdebug', 'blklogwrites', 'blkreplay', 'blkverify', 'bochs',
2827             'cloop', 'compress', 'copy-on-read', 'dmg', 'file', 'ftp', 'ftps',
2828             'gluster', 'host_cdrom', 'host_device', 'http', 'https', 'iscsi',
2829             'luks', 'nbd', 'nfs', 'null-aio', 'null-co', 'nvme', 'parallels',
2830             'qcow', 'qcow2', 'qed', 'quorum', 'raw', 'rbd',
2831             { 'name': 'replication', 'if': 'defined(CONFIG_REPLICATION)' },
2832             'sheepdog',
2833             'ssh', 'throttle', 'vdi', 'vhdx', 'vmdk', 'vpc', 'vvfat' ] }
2836 # @BlockdevOptionsFile:
2838 # Driver specific block device options for the file backend.
2840 # @filename: path to the image file
2841 # @pr-manager: the id for the object that will handle persistent reservations
2842 #              for this device (default: none, forward the commands via SG_IO;
2843 #              since 2.11)
2844 # @aio: AIO backend (default: threads) (since: 2.8)
2845 # @locking: whether to enable file locking. If set to 'auto', only enable
2846 #           when Open File Descriptor (OFD) locking API is available
2847 #           (default: auto, since 2.10)
2848 # @drop-cache: invalidate page cache during live migration.  This prevents
2849 #              stale data on the migration destination with cache.direct=off.
2850 #              Currently only supported on Linux hosts.
2851 #              (default: on, since: 4.0)
2852 # @x-check-cache-dropped: whether to check that page cache was dropped on live
2853 #                         migration.  May cause noticeable delays if the image
2854 #                         file is large, do not use in production.
2855 #                         (default: off) (since: 3.0)
2857 # Features:
2858 # @dynamic-auto-read-only: If present, enabled auto-read-only means that the
2859 #                          driver will open the image read-only at first,
2860 #                          dynamically reopen the image file read-write when
2861 #                          the first writer is attached to the node and reopen
2862 #                          read-only when the last writer is detached. This
2863 #                          allows giving QEMU write permissions only on demand
2864 #                          when an operation actually needs write access.
2866 # Since: 2.9
2868 { 'struct': 'BlockdevOptionsFile',
2869   'data': { 'filename': 'str',
2870             '*pr-manager': 'str',
2871             '*locking': 'OnOffAuto',
2872             '*aio': 'BlockdevAioOptions',
2873             '*drop-cache': {'type': 'bool',
2874                             'if': 'defined(CONFIG_LINUX)'},
2875             '*x-check-cache-dropped': 'bool' },
2876   'features': [ { 'name': 'dynamic-auto-read-only',
2877                   'if': 'defined(CONFIG_POSIX)' } ] }
2880 # @BlockdevOptionsNull:
2882 # Driver specific block device options for the null backend.
2884 # @size: size of the device in bytes.
2885 # @latency-ns: emulated latency (in nanoseconds) in processing
2886 #              requests. Default to zero which completes requests immediately.
2887 #              (Since 2.4)
2888 # @read-zeroes: if true, reads from the device produce zeroes; if false, the
2889 #               buffer is left unchanged. (default: false; since: 4.1)
2891 # Since: 2.9
2893 { 'struct': 'BlockdevOptionsNull',
2894   'data': { '*size': 'int', '*latency-ns': 'uint64', '*read-zeroes': 'bool' } }
2897 # @BlockdevOptionsNVMe:
2899 # Driver specific block device options for the NVMe backend.
2901 # @device: PCI controller address of the NVMe device in
2902 #          format hhhh:bb:ss.f (host:bus:slot.function)
2903 # @namespace: namespace number of the device, starting from 1.
2905 # Note that the PCI @device must have been unbound from any host
2906 # kernel driver before instructing QEMU to add the blockdev.
2908 # Since: 2.12
2910 { 'struct': 'BlockdevOptionsNVMe',
2911   'data': { 'device': 'str', 'namespace': 'int' } }
2914 # @BlockdevOptionsVVFAT:
2916 # Driver specific block device options for the vvfat protocol.
2918 # @dir: directory to be exported as FAT image
2919 # @fat-type: FAT type: 12, 16 or 32
2920 # @floppy: whether to export a floppy image (true) or
2921 #          partitioned hard disk (false; default)
2922 # @label: set the volume label, limited to 11 bytes. FAT16 and
2923 #         FAT32 traditionally have some restrictions on labels, which are
2924 #         ignored by most operating systems. Defaults to "QEMU VVFAT".
2925 #         (since 2.4)
2926 # @rw: whether to allow write operations (default: false)
2928 # Since: 2.9
2930 { 'struct': 'BlockdevOptionsVVFAT',
2931   'data': { 'dir': 'str', '*fat-type': 'int', '*floppy': 'bool',
2932             '*label': 'str', '*rw': 'bool' } }
2935 # @BlockdevOptionsGenericFormat:
2937 # Driver specific block device options for image format that have no option
2938 # besides their data source.
2940 # @file: reference to or definition of the data source block device
2942 # Since: 2.9
2944 { 'struct': 'BlockdevOptionsGenericFormat',
2945   'data': { 'file': 'BlockdevRef' } }
2948 # @BlockdevOptionsLUKS:
2950 # Driver specific block device options for LUKS.
2952 # @key-secret: the ID of a QCryptoSecret object providing
2953 #              the decryption key (since 2.6). Mandatory except when
2954 #              doing a metadata-only probe of the image.
2956 # Since: 2.9
2958 { 'struct': 'BlockdevOptionsLUKS',
2959   'base': 'BlockdevOptionsGenericFormat',
2960   'data': { '*key-secret': 'str' } }
2964 # @BlockdevOptionsGenericCOWFormat:
2966 # Driver specific block device options for image format that have no option
2967 # besides their data source and an optional backing file.
2969 # @backing: reference to or definition of the backing file block
2970 #           device, null disables the backing file entirely.
2971 #           Defaults to the backing file stored the image file.
2973 # Since: 2.9
2975 { 'struct': 'BlockdevOptionsGenericCOWFormat',
2976   'base': 'BlockdevOptionsGenericFormat',
2977   'data': { '*backing': 'BlockdevRefOrNull' } }
2980 # @Qcow2OverlapCheckMode:
2982 # General overlap check modes.
2984 # @none: Do not perform any checks
2986 # @constant: Perform only checks which can be done in constant time and
2987 #            without reading anything from disk
2989 # @cached: Perform only checks which can be done without reading anything
2990 #          from disk
2992 # @all: Perform all available overlap checks
2994 # Since: 2.9
2996 { 'enum': 'Qcow2OverlapCheckMode',
2997   'data': [ 'none', 'constant', 'cached', 'all' ] }
3000 # @Qcow2OverlapCheckFlags:
3002 # Structure of flags for each metadata structure. Setting a field to 'true'
3003 # makes qemu guard that structure against unintended overwriting. The default
3004 # value is chosen according to the template given.
3006 # @template: Specifies a template mode which can be adjusted using the other
3007 #            flags, defaults to 'cached'
3009 # @bitmap-directory: since 3.0
3011 # Since: 2.9
3013 { 'struct': 'Qcow2OverlapCheckFlags',
3014   'data': { '*template':         'Qcow2OverlapCheckMode',
3015             '*main-header':      'bool',
3016             '*active-l1':        'bool',
3017             '*active-l2':        'bool',
3018             '*refcount-table':   'bool',
3019             '*refcount-block':   'bool',
3020             '*snapshot-table':   'bool',
3021             '*inactive-l1':      'bool',
3022             '*inactive-l2':      'bool',
3023             '*bitmap-directory': 'bool' } }
3026 # @Qcow2OverlapChecks:
3028 # Specifies which metadata structures should be guarded against unintended
3029 # overwriting.
3031 # @flags: set of flags for separate specification of each metadata structure
3032 #         type
3034 # @mode: named mode which chooses a specific set of flags
3036 # Since: 2.9
3038 { 'alternate': 'Qcow2OverlapChecks',
3039   'data': { 'flags': 'Qcow2OverlapCheckFlags',
3040             'mode':  'Qcow2OverlapCheckMode' } }
3043 # @BlockdevQcowEncryptionFormat:
3045 # @aes: AES-CBC with plain64 initialization vectors
3047 # Since: 2.10
3049 { 'enum': 'BlockdevQcowEncryptionFormat',
3050   'data': [ 'aes' ] }
3053 # @BlockdevQcowEncryption:
3055 # Since: 2.10
3057 { 'union': 'BlockdevQcowEncryption',
3058   'base': { 'format': 'BlockdevQcowEncryptionFormat' },
3059   'discriminator': 'format',
3060   'data': { 'aes': 'QCryptoBlockOptionsQCow' } }
3063 # @BlockdevOptionsQcow:
3065 # Driver specific block device options for qcow.
3067 # @encrypt: Image decryption options. Mandatory for
3068 #           encrypted images, except when doing a metadata-only
3069 #           probe of the image.
3071 # Since: 2.10
3073 { 'struct': 'BlockdevOptionsQcow',
3074   'base': 'BlockdevOptionsGenericCOWFormat',
3075   'data': { '*encrypt': 'BlockdevQcowEncryption' } }
3080 # @BlockdevQcow2EncryptionFormat:
3081 # @aes: AES-CBC with plain64 initialization vectors
3083 # Since: 2.10
3085 { 'enum': 'BlockdevQcow2EncryptionFormat',
3086   'data': [ 'aes', 'luks' ] }
3089 # @BlockdevQcow2Encryption:
3091 # Since: 2.10
3093 { 'union': 'BlockdevQcow2Encryption',
3094   'base': { 'format': 'BlockdevQcow2EncryptionFormat' },
3095   'discriminator': 'format',
3096   'data': { 'aes': 'QCryptoBlockOptionsQCow',
3097             'luks': 'QCryptoBlockOptionsLUKS'} }
3100 # @BlockdevOptionsQcow2:
3102 # Driver specific block device options for qcow2.
3104 # @lazy-refcounts: whether to enable the lazy refcounts
3105 #                  feature (default is taken from the image file)
3107 # @pass-discard-request: whether discard requests to the qcow2
3108 #                        device should be forwarded to the data source
3110 # @pass-discard-snapshot: whether discard requests for the data source
3111 #                         should be issued when a snapshot operation (e.g.
3112 #                         deleting a snapshot) frees clusters in the qcow2 file
3114 # @pass-discard-other: whether discard requests for the data source
3115 #                      should be issued on other occasions where a cluster
3116 #                      gets freed
3118 # @overlap-check: which overlap checks to perform for writes
3119 #                 to the image, defaults to 'cached' (since 2.2)
3121 # @cache-size: the maximum total size of the L2 table and
3122 #              refcount block caches in bytes (since 2.2)
3124 # @l2-cache-size: the maximum size of the L2 table cache in
3125 #                 bytes (since 2.2)
3127 # @l2-cache-entry-size: the size of each entry in the L2 cache in
3128 #                       bytes. It must be a power of two between 512
3129 #                       and the cluster size. The default value is
3130 #                       the cluster size (since 2.12)
3132 # @refcount-cache-size: the maximum size of the refcount block cache
3133 #                       in bytes (since 2.2)
3135 # @cache-clean-interval: clean unused entries in the L2 and refcount
3136 #                        caches. The interval is in seconds. The default value
3137 #                        is 600 on supporting platforms, and 0 on other
3138 #                        platforms. 0 disables this feature. (since 2.5)
3140 # @encrypt: Image decryption options. Mandatory for
3141 #           encrypted images, except when doing a metadata-only
3142 #           probe of the image. (since 2.10)
3144 # @data-file: reference to or definition of the external data file.
3145 #             This may only be specified for images that require an
3146 #             external data file. If it is not specified for such
3147 #             an image, the data file name is loaded from the image
3148 #             file. (since 4.0)
3150 # Since: 2.9
3152 { 'struct': 'BlockdevOptionsQcow2',
3153   'base': 'BlockdevOptionsGenericCOWFormat',
3154   'data': { '*lazy-refcounts': 'bool',
3155             '*pass-discard-request': 'bool',
3156             '*pass-discard-snapshot': 'bool',
3157             '*pass-discard-other': 'bool',
3158             '*overlap-check': 'Qcow2OverlapChecks',
3159             '*cache-size': 'int',
3160             '*l2-cache-size': 'int',
3161             '*l2-cache-entry-size': 'int',
3162             '*refcount-cache-size': 'int',
3163             '*cache-clean-interval': 'int',
3164             '*encrypt': 'BlockdevQcow2Encryption',
3165             '*data-file': 'BlockdevRef' } }
3168 # @SshHostKeyCheckMode:
3170 # @none: Don't check the host key at all
3171 # @hash: Compare the host key with a given hash
3172 # @known_hosts: Check the host key against the known_hosts file
3174 # Since: 2.12
3176 { 'enum': 'SshHostKeyCheckMode',
3177   'data': [ 'none', 'hash', 'known_hosts' ] }
3180 # @SshHostKeyCheckHashType:
3182 # @md5: The given hash is an md5 hash
3183 # @sha1: The given hash is an sha1 hash
3185 # Since: 2.12
3187 { 'enum': 'SshHostKeyCheckHashType',
3188   'data': [ 'md5', 'sha1' ] }
3191 # @SshHostKeyHash:
3193 # @type: The hash algorithm used for the hash
3194 # @hash: The expected hash value
3196 # Since: 2.12
3198 { 'struct': 'SshHostKeyHash',
3199   'data': { 'type': 'SshHostKeyCheckHashType',
3200             'hash': 'str' }}
3203 # @SshHostKeyCheck:
3205 # Since: 2.12
3207 { 'union': 'SshHostKeyCheck',
3208   'base': { 'mode': 'SshHostKeyCheckMode' },
3209   'discriminator': 'mode',
3210   'data': { 'hash': 'SshHostKeyHash' } }
3213 # @BlockdevOptionsSsh:
3215 # @server:              host address
3217 # @path:                path to the image on the host
3219 # @user:                user as which to connect, defaults to current
3220 #                       local user name
3222 # @host-key-check:      Defines how and what to check the host key against
3223 #                       (default: known_hosts)
3225 # Since: 2.9
3227 { 'struct': 'BlockdevOptionsSsh',
3228   'data': { 'server': 'InetSocketAddress',
3229             'path': 'str',
3230             '*user': 'str',
3231             '*host-key-check': 'SshHostKeyCheck' } }
3235 # @BlkdebugEvent:
3237 # Trigger events supported by blkdebug.
3239 # @l1_shrink_write_table: write zeros to the l1 table to shrink image.
3240 #                         (since 2.11)
3242 # @l1_shrink_free_l2_clusters: discard the l2 tables. (since 2.11)
3244 # @cor_write: a write due to copy-on-read (since 2.11)
3246 # @cluster_alloc_space: an allocation of file space for a cluster (since 4.1)
3248 # @none: triggers once at creation of the blkdebug node (since 4.1)
3250 # Since: 2.9
3252 { 'enum': 'BlkdebugEvent', 'prefix': 'BLKDBG',
3253   'data': [ 'l1_update', 'l1_grow_alloc_table', 'l1_grow_write_table',
3254             'l1_grow_activate_table', 'l2_load', 'l2_update',
3255             'l2_update_compressed', 'l2_alloc_cow_read', 'l2_alloc_write',
3256             'read_aio', 'read_backing_aio', 'read_compressed', 'write_aio',
3257             'write_compressed', 'vmstate_load', 'vmstate_save', 'cow_read',
3258             'cow_write', 'reftable_load', 'reftable_grow', 'reftable_update',
3259             'refblock_load', 'refblock_update', 'refblock_update_part',
3260             'refblock_alloc', 'refblock_alloc_hookup', 'refblock_alloc_write',
3261             'refblock_alloc_write_blocks', 'refblock_alloc_write_table',
3262             'refblock_alloc_switch_table', 'cluster_alloc',
3263             'cluster_alloc_bytes', 'cluster_free', 'flush_to_os',
3264             'flush_to_disk', 'pwritev_rmw_head', 'pwritev_rmw_after_head',
3265             'pwritev_rmw_tail', 'pwritev_rmw_after_tail', 'pwritev',
3266             'pwritev_zero', 'pwritev_done', 'empty_image_prepare',
3267             'l1_shrink_write_table', 'l1_shrink_free_l2_clusters',
3268             'cor_write', 'cluster_alloc_space', 'none'] }
3271 # @BlkdebugIOType:
3273 # Kinds of I/O that blkdebug can inject errors in.
3275 # @read: .bdrv_co_preadv()
3277 # @write: .bdrv_co_pwritev()
3279 # @write-zeroes: .bdrv_co_pwrite_zeroes()
3281 # @discard: .bdrv_co_pdiscard()
3283 # @flush: .bdrv_co_flush_to_disk()
3285 # @block-status: .bdrv_co_block_status()
3287 # Since: 4.1
3289 { 'enum': 'BlkdebugIOType', 'prefix': 'BLKDEBUG_IO_TYPE',
3290   'data': [ 'read', 'write', 'write-zeroes', 'discard', 'flush',
3291             'block-status' ] }
3294 # @BlkdebugInjectErrorOptions:
3296 # Describes a single error injection for blkdebug.
3298 # @event: trigger event
3300 # @state: the state identifier blkdebug needs to be in to
3301 #         actually trigger the event; defaults to "any"
3303 # @iotype: the type of I/O operations on which this error should
3304 #          be injected; defaults to "all read, write,
3305 #          write-zeroes, discard, and flush operations"
3306 #          (since: 4.1)
3308 # @errno: error identifier (errno) to be returned; defaults to
3309 #         EIO
3311 # @sector: specifies the sector index which has to be affected
3312 #          in order to actually trigger the event; defaults to "any
3313 #          sector"
3315 # @once: disables further events after this one has been
3316 #        triggered; defaults to false
3318 # @immediately: fail immediately; defaults to false
3320 # Since: 2.9
3322 { 'struct': 'BlkdebugInjectErrorOptions',
3323   'data': { 'event': 'BlkdebugEvent',
3324             '*state': 'int',
3325             '*iotype': 'BlkdebugIOType',
3326             '*errno': 'int',
3327             '*sector': 'int',
3328             '*once': 'bool',
3329             '*immediately': 'bool' } }
3332 # @BlkdebugSetStateOptions:
3334 # Describes a single state-change event for blkdebug.
3336 # @event: trigger event
3338 # @state: the current state identifier blkdebug needs to be in;
3339 #         defaults to "any"
3341 # @new_state: the state identifier blkdebug is supposed to assume if
3342 #             this event is triggered
3344 # Since: 2.9
3346 { 'struct': 'BlkdebugSetStateOptions',
3347   'data': { 'event': 'BlkdebugEvent',
3348             '*state': 'int',
3349             'new_state': 'int' } }
3352 # @BlockdevOptionsBlkdebug:
3354 # Driver specific block device options for blkdebug.
3356 # @image: underlying raw block device (or image file)
3358 # @config: filename of the configuration file
3360 # @align: required alignment for requests in bytes, must be
3361 #         positive power of 2, or 0 for default
3363 # @max-transfer: maximum size for I/O transfers in bytes, must be
3364 #                positive multiple of @align and of the underlying
3365 #                file's request alignment (but need not be a power of
3366 #                2), or 0 for default (since 2.10)
3368 # @opt-write-zero: preferred alignment for write zero requests in bytes,
3369 #                  must be positive multiple of @align and of the
3370 #                  underlying file's request alignment (but need not be a
3371 #                  power of 2), or 0 for default (since 2.10)
3373 # @max-write-zero: maximum size for write zero requests in bytes, must be
3374 #                  positive multiple of @align, of @opt-write-zero, and of
3375 #                  the underlying file's request alignment (but need not
3376 #                  be a power of 2), or 0 for default (since 2.10)
3378 # @opt-discard: preferred alignment for discard requests in bytes, must
3379 #               be positive multiple of @align and of the underlying
3380 #               file's request alignment (but need not be a power of
3381 #               2), or 0 for default (since 2.10)
3383 # @max-discard: maximum size for discard requests in bytes, must be
3384 #               positive multiple of @align, of @opt-discard, and of
3385 #               the underlying file's request alignment (but need not
3386 #               be a power of 2), or 0 for default (since 2.10)
3388 # @inject-error: array of error injection descriptions
3390 # @set-state: array of state-change descriptions
3392 # @take-child-perms: Permissions to take on @image in addition to what
3393 #                    is necessary anyway (which depends on how the
3394 #                    blkdebug node is used).  Defaults to none.
3395 #                    (since 5.0)
3397 # @unshare-child-perms: Permissions not to share on @image in addition
3398 #                       to what cannot be shared anyway (which depends
3399 #                       on how the blkdebug node is used).  Defaults
3400 #                       to none.  (since 5.0)
3402 # Since: 2.9
3404 { 'struct': 'BlockdevOptionsBlkdebug',
3405   'data': { 'image': 'BlockdevRef',
3406             '*config': 'str',
3407             '*align': 'int', '*max-transfer': 'int32',
3408             '*opt-write-zero': 'int32', '*max-write-zero': 'int32',
3409             '*opt-discard': 'int32', '*max-discard': 'int32',
3410             '*inject-error': ['BlkdebugInjectErrorOptions'],
3411             '*set-state': ['BlkdebugSetStateOptions'],
3412             '*take-child-perms': ['BlockPermission'],
3413             '*unshare-child-perms': ['BlockPermission'] } }
3416 # @BlockdevOptionsBlklogwrites:
3418 # Driver specific block device options for blklogwrites.
3420 # @file: block device
3422 # @log: block device used to log writes to @file
3424 # @log-sector-size: sector size used in logging writes to @file, determines
3425 #                   granularity of offsets and sizes of writes (default: 512)
3427 # @log-append: append to an existing log (default: false)
3429 # @log-super-update-interval: interval of write requests after which the log
3430 #                             super block is updated to disk (default: 4096)
3432 # Since: 3.0
3434 { 'struct': 'BlockdevOptionsBlklogwrites',
3435   'data': { 'file': 'BlockdevRef',
3436             'log': 'BlockdevRef',
3437             '*log-sector-size': 'uint32',
3438             '*log-append': 'bool',
3439             '*log-super-update-interval': 'uint64' } }
3442 # @BlockdevOptionsBlkverify:
3444 # Driver specific block device options for blkverify.
3446 # @test: block device to be tested
3448 # @raw: raw image used for verification
3450 # Since: 2.9
3452 { 'struct': 'BlockdevOptionsBlkverify',
3453   'data': { 'test': 'BlockdevRef',
3454             'raw': 'BlockdevRef' } }
3457 # @BlockdevOptionsBlkreplay:
3459 # Driver specific block device options for blkreplay.
3461 # @image: disk image which should be controlled with blkreplay
3463 # Since: 4.2
3465 { 'struct': 'BlockdevOptionsBlkreplay',
3466   'data': { 'image': 'BlockdevRef' } }
3469 # @QuorumReadPattern:
3471 # An enumeration of quorum read patterns.
3473 # @quorum: read all the children and do a quorum vote on reads
3475 # @fifo: read only from the first child that has not failed
3477 # Since: 2.9
3479 { 'enum': 'QuorumReadPattern', 'data': [ 'quorum', 'fifo' ] }
3482 # @BlockdevOptionsQuorum:
3484 # Driver specific block device options for Quorum
3486 # @blkverify: true if the driver must print content mismatch
3487 #                  set to false by default
3489 # @children: the children block devices to use
3491 # @vote-threshold: the vote limit under which a read will fail
3493 # @rewrite-corrupted: rewrite corrupted data when quorum is reached
3494 #                     (Since 2.1)
3496 # @read-pattern: choose read pattern and set to quorum by default
3497 #                (Since 2.2)
3499 # Since: 2.9
3501 { 'struct': 'BlockdevOptionsQuorum',
3502   'data': { '*blkverify': 'bool',
3503             'children': [ 'BlockdevRef' ],
3504             'vote-threshold': 'int',
3505             '*rewrite-corrupted': 'bool',
3506             '*read-pattern': 'QuorumReadPattern' } }
3509 # @BlockdevOptionsGluster:
3511 # Driver specific block device options for Gluster
3513 # @volume: name of gluster volume where VM image resides
3515 # @path: absolute path to image file in gluster volume
3517 # @server: gluster servers description
3519 # @debug: libgfapi log level (default '4' which is Error)
3520 #         (Since 2.8)
3522 # @logfile: libgfapi log file (default /dev/stderr) (Since 2.8)
3524 # Since: 2.9
3526 { 'struct': 'BlockdevOptionsGluster',
3527   'data': { 'volume': 'str',
3528             'path': 'str',
3529             'server': ['SocketAddress'],
3530             '*debug': 'int',
3531             '*logfile': 'str' } }
3534 # @IscsiTransport:
3536 # An enumeration of libiscsi transport types
3538 # Since: 2.9
3540 { 'enum': 'IscsiTransport',
3541   'data': [ 'tcp', 'iser' ] }
3544 # @IscsiHeaderDigest:
3546 # An enumeration of header digests supported by libiscsi
3548 # Since: 2.9
3550 { 'enum': 'IscsiHeaderDigest',
3551   'prefix': 'QAPI_ISCSI_HEADER_DIGEST',
3552   'data': [ 'crc32c', 'none', 'crc32c-none', 'none-crc32c' ] }
3555 # @BlockdevOptionsIscsi:
3557 # @transport: The iscsi transport type
3559 # @portal: The address of the iscsi portal
3561 # @target: The target iqn name
3563 # @lun: LUN to connect to. Defaults to 0.
3565 # @user: User name to log in with. If omitted, no CHAP
3566 #        authentication is performed.
3568 # @password-secret: The ID of a QCryptoSecret object providing
3569 #                   the password for the login. This option is required if
3570 #                   @user is specified.
3572 # @initiator-name: The iqn name we want to identify to the target
3573 #                  as. If this option is not specified, an initiator name is
3574 #                  generated automatically.
3576 # @header-digest: The desired header digest. Defaults to
3577 #                 none-crc32c.
3579 # @timeout: Timeout in seconds after which a request will
3580 #           timeout. 0 means no timeout and is the default.
3582 # Driver specific block device options for iscsi
3584 # Since: 2.9
3586 { 'struct': 'BlockdevOptionsIscsi',
3587   'data': { 'transport': 'IscsiTransport',
3588             'portal': 'str',
3589             'target': 'str',
3590             '*lun': 'int',
3591             '*user': 'str',
3592             '*password-secret': 'str',
3593             '*initiator-name': 'str',
3594             '*header-digest': 'IscsiHeaderDigest',
3595             '*timeout': 'int' } }
3599 # @RbdAuthMode:
3601 # Since: 3.0
3603 { 'enum': 'RbdAuthMode',
3604   'data': [ 'cephx', 'none' ] }
3607 # @BlockdevOptionsRbd:
3609 # @pool: Ceph pool name.
3611 # @namespace: Rados namespace name in the Ceph pool. (Since 5.0)
3613 # @image: Image name in the Ceph pool.
3615 # @conf: path to Ceph configuration file.  Values
3616 #        in the configuration file will be overridden by
3617 #        options specified via QAPI.
3619 # @snapshot: Ceph snapshot name.
3621 # @user: Ceph id name.
3623 # @auth-client-required: Acceptable authentication modes.
3624 #                        This maps to Ceph configuration option
3625 #                        "auth_client_required".  (Since 3.0)
3627 # @key-secret: ID of a QCryptoSecret object providing a key
3628 #              for cephx authentication.
3629 #              This maps to Ceph configuration option
3630 #              "key".  (Since 3.0)
3632 # @server: Monitor host address and port.  This maps
3633 #          to the "mon_host" Ceph option.
3635 # Since: 2.9
3637 { 'struct': 'BlockdevOptionsRbd',
3638   'data': { 'pool': 'str',
3639             '*namespace': 'str',
3640             'image': 'str',
3641             '*conf': 'str',
3642             '*snapshot': 'str',
3643             '*user': 'str',
3644             '*auth-client-required': ['RbdAuthMode'],
3645             '*key-secret': 'str',
3646             '*server': ['InetSocketAddressBase'] } }
3649 # @BlockdevOptionsSheepdog:
3651 # Driver specific block device options for sheepdog
3653 # @vdi: Virtual disk image name
3654 # @server: The Sheepdog server to connect to
3655 # @snap-id: Snapshot ID
3656 # @tag: Snapshot tag name
3658 # Only one of @snap-id and @tag may be present.
3660 # Since: 2.9
3662 { 'struct': 'BlockdevOptionsSheepdog',
3663   'data': { 'server': 'SocketAddress',
3664             'vdi': 'str',
3665             '*snap-id': 'uint32',
3666             '*tag': 'str' } }
3669 # @ReplicationMode:
3671 # An enumeration of replication modes.
3673 # @primary: Primary mode, the vm's state will be sent to secondary QEMU.
3675 # @secondary: Secondary mode, receive the vm's state from primary QEMU.
3677 # Since: 2.9
3679 { 'enum' : 'ReplicationMode', 'data' : [ 'primary', 'secondary' ],
3680   'if': 'defined(CONFIG_REPLICATION)' }
3683 # @BlockdevOptionsReplication:
3685 # Driver specific block device options for replication
3687 # @mode: the replication mode
3689 # @top-id: In secondary mode, node name or device ID of the root
3690 #          node who owns the replication node chain. Must not be given in
3691 #          primary mode.
3693 # Since: 2.9
3695 { 'struct': 'BlockdevOptionsReplication',
3696   'base': 'BlockdevOptionsGenericFormat',
3697   'data': { 'mode': 'ReplicationMode',
3698             '*top-id': 'str' },
3699   'if': 'defined(CONFIG_REPLICATION)' }
3702 # @NFSTransport:
3704 # An enumeration of NFS transport types
3706 # @inet: TCP transport
3708 # Since: 2.9
3710 { 'enum': 'NFSTransport',
3711   'data': [ 'inet' ] }
3714 # @NFSServer:
3716 # Captures the address of the socket
3718 # @type: transport type used for NFS (only TCP supported)
3720 # @host: host address for NFS server
3722 # Since: 2.9
3724 { 'struct': 'NFSServer',
3725   'data': { 'type': 'NFSTransport',
3726             'host': 'str' } }
3729 # @BlockdevOptionsNfs:
3731 # Driver specific block device option for NFS
3733 # @server: host address
3735 # @path: path of the image on the host
3737 # @user: UID value to use when talking to the
3738 #        server (defaults to 65534 on Windows and getuid()
3739 #        on unix)
3741 # @group: GID value to use when talking to the
3742 #         server (defaults to 65534 on Windows and getgid()
3743 #         in unix)
3745 # @tcp-syn-count: number of SYNs during the session
3746 #                 establishment (defaults to libnfs default)
3748 # @readahead-size: set the readahead size in bytes (defaults
3749 #                  to libnfs default)
3751 # @page-cache-size: set the pagecache size in bytes (defaults
3752 #                   to libnfs default)
3754 # @debug: set the NFS debug level (max 2) (defaults
3755 #         to libnfs default)
3757 # Since: 2.9
3759 { 'struct': 'BlockdevOptionsNfs',
3760   'data': { 'server': 'NFSServer',
3761             'path': 'str',
3762             '*user': 'int',
3763             '*group': 'int',
3764             '*tcp-syn-count': 'int',
3765             '*readahead-size': 'int',
3766             '*page-cache-size': 'int',
3767             '*debug': 'int' } }
3770 # @BlockdevOptionsCurlBase:
3772 # Driver specific block device options shared by all protocols supported by the
3773 # curl backend.
3775 # @url: URL of the image file
3777 # @readahead: Size of the read-ahead cache; must be a multiple of
3778 #             512 (defaults to 256 kB)
3780 # @timeout: Timeout for connections, in seconds (defaults to 5)
3782 # @username: Username for authentication (defaults to none)
3784 # @password-secret: ID of a QCryptoSecret object providing a password
3785 #                   for authentication (defaults to no password)
3787 # @proxy-username: Username for proxy authentication (defaults to none)
3789 # @proxy-password-secret: ID of a QCryptoSecret object providing a password
3790 #                         for proxy authentication (defaults to no password)
3792 # Since: 2.9
3794 { 'struct': 'BlockdevOptionsCurlBase',
3795   'data': { 'url': 'str',
3796             '*readahead': 'int',
3797             '*timeout': 'int',
3798             '*username': 'str',
3799             '*password-secret': 'str',
3800             '*proxy-username': 'str',
3801             '*proxy-password-secret': 'str' } }
3804 # @BlockdevOptionsCurlHttp:
3806 # Driver specific block device options for HTTP connections over the curl
3807 # backend.  URLs must start with "http://".
3809 # @cookie: List of cookies to set; format is
3810 #          "name1=content1; name2=content2;" as explained by
3811 #          CURLOPT_COOKIE(3). Defaults to no cookies.
3813 # @cookie-secret: ID of a QCryptoSecret object providing the cookie data in a
3814 #                 secure way. See @cookie for the format. (since 2.10)
3816 # Since: 2.9
3818 { 'struct': 'BlockdevOptionsCurlHttp',
3819   'base': 'BlockdevOptionsCurlBase',
3820   'data': { '*cookie': 'str',
3821             '*cookie-secret': 'str'} }
3824 # @BlockdevOptionsCurlHttps:
3826 # Driver specific block device options for HTTPS connections over the curl
3827 # backend.  URLs must start with "https://".
3829 # @cookie: List of cookies to set; format is
3830 #          "name1=content1; name2=content2;" as explained by
3831 #          CURLOPT_COOKIE(3). Defaults to no cookies.
3833 # @sslverify: Whether to verify the SSL certificate's validity (defaults to
3834 #             true)
3836 # @cookie-secret: ID of a QCryptoSecret object providing the cookie data in a
3837 #                 secure way. See @cookie for the format. (since 2.10)
3839 # Since: 2.9
3841 { 'struct': 'BlockdevOptionsCurlHttps',
3842   'base': 'BlockdevOptionsCurlBase',
3843   'data': { '*cookie': 'str',
3844             '*sslverify': 'bool',
3845             '*cookie-secret': 'str'} }
3848 # @BlockdevOptionsCurlFtp:
3850 # Driver specific block device options for FTP connections over the curl
3851 # backend.  URLs must start with "ftp://".
3853 # Since: 2.9
3855 { 'struct': 'BlockdevOptionsCurlFtp',
3856   'base': 'BlockdevOptionsCurlBase',
3857   'data': { } }
3860 # @BlockdevOptionsCurlFtps:
3862 # Driver specific block device options for FTPS connections over the curl
3863 # backend.  URLs must start with "ftps://".
3865 # @sslverify: Whether to verify the SSL certificate's validity (defaults to
3866 #             true)
3868 # Since: 2.9
3870 { 'struct': 'BlockdevOptionsCurlFtps',
3871   'base': 'BlockdevOptionsCurlBase',
3872   'data': { '*sslverify': 'bool' } }
3875 # @BlockdevOptionsNbd:
3877 # Driver specific block device options for NBD.
3879 # @server: NBD server address
3881 # @export: export name
3883 # @tls-creds: TLS credentials ID
3885 # @x-dirty-bitmap: A "qemu:dirty-bitmap:NAME" string to query in place of
3886 #                  traditional "base:allocation" block status (see
3887 #                  NBD_OPT_LIST_META_CONTEXT in the NBD protocol) (since 3.0)
3889 # @reconnect-delay: On an unexpected disconnect, the nbd client tries to
3890 #                   connect again until succeeding or encountering a serious
3891 #                   error.  During the first @reconnect-delay seconds, all
3892 #                   requests are paused and will be rerun on a successful
3893 #                   reconnect. After that time, any delayed requests and all
3894 #                   future requests before a successful reconnect will
3895 #                   immediately fail. Default 0 (Since 4.2)
3897 # Since: 2.9
3899 { 'struct': 'BlockdevOptionsNbd',
3900   'data': { 'server': 'SocketAddress',
3901             '*export': 'str',
3902             '*tls-creds': 'str',
3903             '*x-dirty-bitmap': 'str',
3904             '*reconnect-delay': 'uint32' } }
3907 # @BlockdevOptionsRaw:
3909 # Driver specific block device options for the raw driver.
3911 # @offset: position where the block device starts
3912 # @size: the assumed size of the device
3914 # Since: 2.9
3916 { 'struct': 'BlockdevOptionsRaw',
3917   'base': 'BlockdevOptionsGenericFormat',
3918   'data': { '*offset': 'int', '*size': 'int' } }
3921 # @BlockdevOptionsThrottle:
3923 # Driver specific block device options for the throttle driver
3925 # @throttle-group: the name of the throttle-group object to use. It
3926 #                  must already exist.
3927 # @file: reference to or definition of the data source block device
3928 # Since: 2.11
3930 { 'struct': 'BlockdevOptionsThrottle',
3931   'data': { 'throttle-group': 'str',
3932             'file' : 'BlockdevRef'
3933              } }
3935 # @BlockdevOptions:
3937 # Options for creating a block device.  Many options are available for all
3938 # block devices, independent of the block driver:
3940 # @driver: block driver name
3941 # @node-name: the node name of the new node (Since 2.0).
3942 #             This option is required on the top level of blockdev-add.
3943 #             Valid node names start with an alphabetic character and may
3944 #             contain only alphanumeric characters, '-', '.' and '_'. Their
3945 #             maximum length is 31 characters.
3946 # @discard: discard-related options (default: ignore)
3947 # @cache: cache-related options
3948 # @read-only: whether the block device should be read-only (default: false).
3949 #             Note that some block drivers support only read-only access,
3950 #             either generally or in certain configurations. In this case,
3951 #             the default value does not work and the option must be
3952 #             specified explicitly.
3953 # @auto-read-only: if true and @read-only is false, QEMU may automatically
3954 #                  decide not to open the image read-write as requested, but
3955 #                  fall back to read-only instead (and switch between the modes
3956 #                  later), e.g. depending on whether the image file is writable
3957 #                  or whether a writing user is attached to the node
3958 #                  (default: false, since 3.1)
3959 # @detect-zeroes: detect and optimize zero writes (Since 2.1)
3960 #                 (default: off)
3961 # @force-share: force share all permission on added nodes.
3962 #               Requires read-only=true. (Since 2.10)
3964 # Remaining options are determined by the block driver.
3966 # Since: 2.9
3968 { 'union': 'BlockdevOptions',
3969   'base': { 'driver': 'BlockdevDriver',
3970             '*node-name': 'str',
3971             '*discard': 'BlockdevDiscardOptions',
3972             '*cache': 'BlockdevCacheOptions',
3973             '*read-only': 'bool',
3974             '*auto-read-only': 'bool',
3975             '*force-share': 'bool',
3976             '*detect-zeroes': 'BlockdevDetectZeroesOptions' },
3977   'discriminator': 'driver',
3978   'data': {
3979       'blkdebug':   'BlockdevOptionsBlkdebug',
3980       'blklogwrites':'BlockdevOptionsBlklogwrites',
3981       'blkverify':  'BlockdevOptionsBlkverify',
3982       'blkreplay':  'BlockdevOptionsBlkreplay',
3983       'bochs':      'BlockdevOptionsGenericFormat',
3984       'cloop':      'BlockdevOptionsGenericFormat',
3985       'compress':   'BlockdevOptionsGenericFormat',
3986       'copy-on-read':'BlockdevOptionsGenericFormat',
3987       'dmg':        'BlockdevOptionsGenericFormat',
3988       'file':       'BlockdevOptionsFile',
3989       'ftp':        'BlockdevOptionsCurlFtp',
3990       'ftps':       'BlockdevOptionsCurlFtps',
3991       'gluster':    'BlockdevOptionsGluster',
3992       'host_cdrom': 'BlockdevOptionsFile',
3993       'host_device':'BlockdevOptionsFile',
3994       'http':       'BlockdevOptionsCurlHttp',
3995       'https':      'BlockdevOptionsCurlHttps',
3996       'iscsi':      'BlockdevOptionsIscsi',
3997       'luks':       'BlockdevOptionsLUKS',
3998       'nbd':        'BlockdevOptionsNbd',
3999       'nfs':        'BlockdevOptionsNfs',
4000       'null-aio':   'BlockdevOptionsNull',
4001       'null-co':    'BlockdevOptionsNull',
4002       'nvme':       'BlockdevOptionsNVMe',
4003       'parallels':  'BlockdevOptionsGenericFormat',
4004       'qcow2':      'BlockdevOptionsQcow2',
4005       'qcow':       'BlockdevOptionsQcow',
4006       'qed':        'BlockdevOptionsGenericCOWFormat',
4007       'quorum':     'BlockdevOptionsQuorum',
4008       'raw':        'BlockdevOptionsRaw',
4009       'rbd':        'BlockdevOptionsRbd',
4010       'replication': { 'type': 'BlockdevOptionsReplication',
4011                        'if': 'defined(CONFIG_REPLICATION)' },
4012       'sheepdog':   'BlockdevOptionsSheepdog',
4013       'ssh':        'BlockdevOptionsSsh',
4014       'throttle':   'BlockdevOptionsThrottle',
4015       'vdi':        'BlockdevOptionsGenericFormat',
4016       'vhdx':       'BlockdevOptionsGenericFormat',
4017       'vmdk':       'BlockdevOptionsGenericCOWFormat',
4018       'vpc':        'BlockdevOptionsGenericFormat',
4019       'vvfat':      'BlockdevOptionsVVFAT'
4020   } }
4023 # @BlockdevRef:
4025 # Reference to a block device.
4027 # @definition: defines a new block device inline
4028 # @reference: references the ID of an existing block device
4030 # Since: 2.9
4032 { 'alternate': 'BlockdevRef',
4033   'data': { 'definition': 'BlockdevOptions',
4034             'reference': 'str' } }
4037 # @BlockdevRefOrNull:
4039 # Reference to a block device.
4041 # @definition: defines a new block device inline
4042 # @reference: references the ID of an existing block device.
4043 #             An empty string means that no block device should
4044 #             be referenced.  Deprecated; use null instead.
4045 # @null: No block device should be referenced (since 2.10)
4047 # Since: 2.9
4049 { 'alternate': 'BlockdevRefOrNull',
4050   'data': { 'definition': 'BlockdevOptions',
4051             'reference': 'str',
4052             'null': 'null' } }
4055 # @blockdev-add:
4057 # Creates a new block device.
4059 # Since: 2.9
4061 # Example:
4063 # 1.
4064 # -> { "execute": "blockdev-add",
4065 #      "arguments": {
4066 #           "driver": "qcow2",
4067 #           "node-name": "test1",
4068 #           "file": {
4069 #               "driver": "file",
4070 #               "filename": "test.qcow2"
4071 #            }
4072 #       }
4073 #     }
4074 # <- { "return": {} }
4076 # 2.
4077 # -> { "execute": "blockdev-add",
4078 #      "arguments": {
4079 #           "driver": "qcow2",
4080 #           "node-name": "node0",
4081 #           "discard": "unmap",
4082 #           "cache": {
4083 #              "direct": true
4084 #            },
4085 #            "file": {
4086 #              "driver": "file",
4087 #              "filename": "/tmp/test.qcow2"
4088 #            },
4089 #            "backing": {
4090 #               "driver": "raw",
4091 #               "file": {
4092 #                  "driver": "file",
4093 #                  "filename": "/dev/fdset/4"
4094 #                }
4095 #            }
4096 #        }
4097 #      }
4099 # <- { "return": {} }
4102 { 'command': 'blockdev-add', 'data': 'BlockdevOptions', 'boxed': true }
4105 # @x-blockdev-reopen:
4107 # Reopens a block device using the given set of options. Any option
4108 # not specified will be reset to its default value regardless of its
4109 # previous status. If an option cannot be changed or a particular
4110 # driver does not support reopening then the command will return an
4111 # error.
4113 # The top-level @node-name option (from BlockdevOptions) must be
4114 # specified and is used to select the block device to be reopened.
4115 # Other @node-name options must be either omitted or set to the
4116 # current name of the appropriate node. This command won't change any
4117 # node name and any attempt to do it will result in an error.
4119 # In the case of options that refer to child nodes, the behavior of
4120 # this command depends on the value:
4122 #  1) A set of options (BlockdevOptions): the child is reopened with
4123 #     the specified set of options.
4125 #  2) A reference to the current child: the child is reopened using
4126 #     its existing set of options.
4128 #  3) A reference to a different node: the current child is replaced
4129 #     with the specified one.
4131 #  4) NULL: the current child (if any) is detached.
4133 # Options (1) and (2) are supported in all cases, but at the moment
4134 # only @backing allows replacing or detaching an existing child.
4136 # Unlike with blockdev-add, the @backing option must always be present
4137 # unless the node being reopened does not have a backing file and its
4138 # image does not have a default backing file name as part of its
4139 # metadata.
4141 # Since: 4.0
4143 { 'command': 'x-blockdev-reopen',
4144   'data': 'BlockdevOptions', 'boxed': true }
4147 # @blockdev-del:
4149 # Deletes a block device that has been added using blockdev-add.
4150 # The command will fail if the node is attached to a device or is
4151 # otherwise being used.
4153 # @node-name: Name of the graph node to delete.
4155 # Since: 2.9
4157 # Example:
4159 # -> { "execute": "blockdev-add",
4160 #      "arguments": {
4161 #           "driver": "qcow2",
4162 #           "node-name": "node0",
4163 #           "file": {
4164 #               "driver": "file",
4165 #               "filename": "test.qcow2"
4166 #           }
4167 #      }
4168 #    }
4169 # <- { "return": {} }
4171 # -> { "execute": "blockdev-del",
4172 #      "arguments": { "node-name": "node0" }
4173 #    }
4174 # <- { "return": {} }
4177 { 'command': 'blockdev-del', 'data': { 'node-name': 'str' } }
4180 # @BlockdevCreateOptionsFile:
4182 # Driver specific image creation options for file.
4184 # @filename: Filename for the new image file
4185 # @size: Size of the virtual disk in bytes
4186 # @preallocation: Preallocation mode for the new image (default: off;
4187 #                 allowed values: off,
4188 #                 falloc (if defined CONFIG_POSIX_FALLOCATE),
4189 #                 full (if defined CONFIG_POSIX))
4190 # @nocow: Turn off copy-on-write (valid only on btrfs; default: off)
4191 # @extent-size-hint: Extent size hint to add to the image file; 0 for not
4192 #                    adding an extent size hint (default: 1 MB, since 5.1)
4194 # Since: 2.12
4196 { 'struct': 'BlockdevCreateOptionsFile',
4197   'data': { 'filename':             'str',
4198             'size':                 'size',
4199             '*preallocation':       'PreallocMode',
4200             '*nocow':               'bool',
4201             '*extent-size-hint':    'size'} }
4204 # @BlockdevCreateOptionsGluster:
4206 # Driver specific image creation options for gluster.
4208 # @location: Where to store the new image file
4209 # @size: Size of the virtual disk in bytes
4210 # @preallocation: Preallocation mode for the new image (default: off;
4211 #                 allowed values: off,
4212 #                 falloc (if defined CONFIG_GLUSTERFS_FALLOCATE),
4213 #                 full (if defined CONFIG_GLUSTERFS_ZEROFILL))
4215 # Since: 2.12
4217 { 'struct': 'BlockdevCreateOptionsGluster',
4218   'data': { 'location':         'BlockdevOptionsGluster',
4219             'size':             'size',
4220             '*preallocation':   'PreallocMode' } }
4223 # @BlockdevCreateOptionsLUKS:
4225 # Driver specific image creation options for LUKS.
4227 # @file: Node to create the image format on
4228 # @size: Size of the virtual disk in bytes
4229 # @preallocation: Preallocation mode for the new image
4230 #                 (since: 4.2)
4231 #                 (default: off; allowed values: off, metadata, falloc, full)
4233 # Since: 2.12
4235 { 'struct': 'BlockdevCreateOptionsLUKS',
4236   'base': 'QCryptoBlockCreateOptionsLUKS',
4237   'data': { 'file':             'BlockdevRef',
4238             'size':             'size',
4239             '*preallocation':   'PreallocMode' } }
4242 # @BlockdevCreateOptionsNfs:
4244 # Driver specific image creation options for NFS.
4246 # @location: Where to store the new image file
4247 # @size: Size of the virtual disk in bytes
4249 # Since: 2.12
4251 { 'struct': 'BlockdevCreateOptionsNfs',
4252   'data': { 'location':         'BlockdevOptionsNfs',
4253             'size':             'size' } }
4256 # @BlockdevCreateOptionsParallels:
4258 # Driver specific image creation options for parallels.
4260 # @file: Node to create the image format on
4261 # @size: Size of the virtual disk in bytes
4262 # @cluster-size: Cluster size in bytes (default: 1 MB)
4264 # Since: 2.12
4266 { 'struct': 'BlockdevCreateOptionsParallels',
4267   'data': { 'file':             'BlockdevRef',
4268             'size':             'size',
4269             '*cluster-size':    'size' } }
4272 # @BlockdevCreateOptionsQcow:
4274 # Driver specific image creation options for qcow.
4276 # @file: Node to create the image format on
4277 # @size: Size of the virtual disk in bytes
4278 # @backing-file: File name of the backing file if a backing file
4279 #                should be used
4280 # @encrypt: Encryption options if the image should be encrypted
4282 # Since: 2.12
4284 { 'struct': 'BlockdevCreateOptionsQcow',
4285   'data': { 'file':             'BlockdevRef',
4286             'size':             'size',
4287             '*backing-file':    'str',
4288             '*encrypt':         'QCryptoBlockCreateOptions' } }
4291 # @BlockdevQcow2Version:
4293 # @v2:  The original QCOW2 format as introduced in qemu 0.10 (version 2)
4294 # @v3:  The extended QCOW2 format as introduced in qemu 1.1 (version 3)
4296 # Since: 2.12
4298 { 'enum': 'BlockdevQcow2Version',
4299   'data': [ 'v2', 'v3' ] }
4303 # @Qcow2CompressionType:
4305 # Compression type used in qcow2 image file
4307 # @zlib: zlib compression, see <http://zlib.net/>
4308 # @zstd: zstd compression, see <http://github.com/facebook/zstd>
4310 # Since: 5.1
4312 { 'enum': 'Qcow2CompressionType',
4313   'data': [ 'zlib', { 'name': 'zstd', 'if': 'defined(CONFIG_ZSTD)' } ] }
4316 # @BlockdevCreateOptionsQcow2:
4318 # Driver specific image creation options for qcow2.
4320 # @file: Node to create the image format on
4321 # @data-file: Node to use as an external data file in which all guest
4322 #             data is stored so that only metadata remains in the qcow2
4323 #             file (since: 4.0)
4324 # @data-file-raw: True if the external data file must stay valid as a
4325 #                 standalone (read-only) raw image without looking at qcow2
4326 #                 metadata (default: false; since: 4.0)
4327 # @extended-l2: True to make the image have extended L2 entries
4328 #               (default: false; since 5.2)
4329 # @size: Size of the virtual disk in bytes
4330 # @version: Compatibility level (default: v3)
4331 # @backing-file: File name of the backing file if a backing file
4332 #                should be used
4333 # @backing-fmt: Name of the block driver to use for the backing file
4334 # @encrypt: Encryption options if the image should be encrypted
4335 # @cluster-size: qcow2 cluster size in bytes (default: 65536)
4336 # @preallocation: Preallocation mode for the new image (default: off;
4337 #                 allowed values: off, falloc, full, metadata)
4338 # @lazy-refcounts: True if refcounts may be updated lazily (default: off)
4339 # @refcount-bits: Width of reference counts in bits (default: 16)
4340 # @compression-type: The image cluster compression method
4341 #                    (default: zlib, since 5.1)
4343 # Since: 2.12
4345 { 'struct': 'BlockdevCreateOptionsQcow2',
4346   'data': { 'file':             'BlockdevRef',
4347             '*data-file':       'BlockdevRef',
4348             '*data-file-raw':   'bool',
4349             '*extended-l2':     'bool',
4350             'size':             'size',
4351             '*version':         'BlockdevQcow2Version',
4352             '*backing-file':    'str',
4353             '*backing-fmt':     'BlockdevDriver',
4354             '*encrypt':         'QCryptoBlockCreateOptions',
4355             '*cluster-size':    'size',
4356             '*preallocation':   'PreallocMode',
4357             '*lazy-refcounts':  'bool',
4358             '*refcount-bits':   'int',
4359             '*compression-type':'Qcow2CompressionType' } }
4362 # @BlockdevCreateOptionsQed:
4364 # Driver specific image creation options for qed.
4366 # @file: Node to create the image format on
4367 # @size: Size of the virtual disk in bytes
4368 # @backing-file: File name of the backing file if a backing file
4369 #                should be used
4370 # @backing-fmt: Name of the block driver to use for the backing file
4371 # @cluster-size: Cluster size in bytes (default: 65536)
4372 # @table-size: L1/L2 table size (in clusters)
4374 # Since: 2.12
4376 { 'struct': 'BlockdevCreateOptionsQed',
4377   'data': { 'file':             'BlockdevRef',
4378             'size':             'size',
4379             '*backing-file':    'str',
4380             '*backing-fmt':     'BlockdevDriver',
4381             '*cluster-size':    'size',
4382             '*table-size':      'int' } }
4385 # @BlockdevCreateOptionsRbd:
4387 # Driver specific image creation options for rbd/Ceph.
4389 # @location: Where to store the new image file. This location cannot
4390 #            point to a snapshot.
4391 # @size: Size of the virtual disk in bytes
4392 # @cluster-size: RBD object size
4394 # Since: 2.12
4396 { 'struct': 'BlockdevCreateOptionsRbd',
4397   'data': { 'location':         'BlockdevOptionsRbd',
4398             'size':             'size',
4399             '*cluster-size' :   'size' } }
4402 # @BlockdevVmdkSubformat:
4404 # Subformat options for VMDK images
4406 # @monolithicSparse:     Single file image with sparse cluster allocation
4408 # @monolithicFlat:       Single flat data image and a descriptor file
4410 # @twoGbMaxExtentSparse: Data is split into 2GB (per virtual LBA) sparse extent
4411 #                        files, in addition to a descriptor file
4413 # @twoGbMaxExtentFlat:   Data is split into 2GB (per virtual LBA) flat extent
4414 #                        files, in addition to a descriptor file
4416 # @streamOptimized:      Single file image sparse cluster allocation, optimized
4417 #                        for streaming over network.
4419 # Since: 4.0
4421 { 'enum': 'BlockdevVmdkSubformat',
4422   'data': [ 'monolithicSparse', 'monolithicFlat', 'twoGbMaxExtentSparse',
4423             'twoGbMaxExtentFlat', 'streamOptimized'] }
4426 # @BlockdevVmdkAdapterType:
4428 # Adapter type info for VMDK images
4430 # Since: 4.0
4432 { 'enum': 'BlockdevVmdkAdapterType',
4433   'data': [ 'ide', 'buslogic', 'lsilogic', 'legacyESX'] }
4436 # @BlockdevCreateOptionsVmdk:
4438 # Driver specific image creation options for VMDK.
4440 # @file: Where to store the new image file. This refers to the image
4441 #        file for monolithcSparse and streamOptimized format, or the
4442 #        descriptor file for other formats.
4443 # @size: Size of the virtual disk in bytes
4444 # @extents: Where to store the data extents. Required for monolithcFlat,
4445 #           twoGbMaxExtentSparse and twoGbMaxExtentFlat formats. For
4446 #           monolithicFlat, only one entry is required; for
4447 #           twoGbMaxExtent* formats, the number of entries required is
4448 #           calculated as extent_number = virtual_size / 2GB. Providing
4449 #           more extents than will be used is an error.
4450 # @subformat: The subformat of the VMDK image. Default: "monolithicSparse".
4451 # @backing-file: The path of backing file. Default: no backing file is used.
4452 # @adapter-type: The adapter type used to fill in the descriptor. Default: ide.
4453 # @hwversion: Hardware version. The meaningful options are "4" or "6".
4454 #             Default: "4".
4455 # @zeroed-grain: Whether to enable zeroed-grain feature for sparse subformats.
4456 #                Default: false.
4458 # Since: 4.0
4460 { 'struct': 'BlockdevCreateOptionsVmdk',
4461   'data': { 'file':             'BlockdevRef',
4462             'size':             'size',
4463             '*extents':          ['BlockdevRef'],
4464             '*subformat':       'BlockdevVmdkSubformat',
4465             '*backing-file':    'str',
4466             '*adapter-type':    'BlockdevVmdkAdapterType',
4467             '*hwversion':       'str',
4468             '*zeroed-grain':    'bool' } }
4472 # @SheepdogRedundancyType:
4474 # @full: Create a fully replicated vdi with x copies
4475 # @erasure-coded: Create an erasure coded vdi with x data strips and
4476 #                 y parity strips
4478 # Since: 2.12
4480 { 'enum': 'SheepdogRedundancyType',
4481   'data': [ 'full', 'erasure-coded' ] }
4484 # @SheepdogRedundancyFull:
4486 # @copies: Number of copies to use (between 1 and 31)
4488 # Since: 2.12
4490 { 'struct': 'SheepdogRedundancyFull',
4491   'data': { 'copies': 'int' }}
4494 # @SheepdogRedundancyErasureCoded:
4496 # @data-strips: Number of data strips to use (one of {2,4,8,16})
4497 # @parity-strips: Number of parity strips to use (between 1 and 15)
4499 # Since: 2.12
4501 { 'struct': 'SheepdogRedundancyErasureCoded',
4502   'data': { 'data-strips': 'int',
4503             'parity-strips': 'int' }}
4506 # @SheepdogRedundancy:
4508 # Since: 2.12
4510 { 'union': 'SheepdogRedundancy',
4511   'base': { 'type': 'SheepdogRedundancyType' },
4512   'discriminator': 'type',
4513   'data': { 'full': 'SheepdogRedundancyFull',
4514             'erasure-coded': 'SheepdogRedundancyErasureCoded' } }
4517 # @BlockdevCreateOptionsSheepdog:
4519 # Driver specific image creation options for Sheepdog.
4521 # @location: Where to store the new image file
4522 # @size: Size of the virtual disk in bytes
4523 # @backing-file: File name of a base image
4524 # @preallocation: Preallocation mode for the new image (default: off;
4525 #                 allowed values: off, full)
4526 # @redundancy: Redundancy of the image
4527 # @object-size: Object size of the image
4529 # Since: 2.12
4531 { 'struct': 'BlockdevCreateOptionsSheepdog',
4532   'data': { 'location':         'BlockdevOptionsSheepdog',
4533             'size':             'size',
4534             '*backing-file':    'str',
4535             '*preallocation':   'PreallocMode',
4536             '*redundancy':      'SheepdogRedundancy',
4537             '*object-size':     'size' } }
4540 # @BlockdevCreateOptionsSsh:
4542 # Driver specific image creation options for SSH.
4544 # @location: Where to store the new image file
4545 # @size: Size of the virtual disk in bytes
4547 # Since: 2.12
4549 { 'struct': 'BlockdevCreateOptionsSsh',
4550   'data': { 'location':         'BlockdevOptionsSsh',
4551             'size':             'size' } }
4554 # @BlockdevCreateOptionsVdi:
4556 # Driver specific image creation options for VDI.
4558 # @file: Node to create the image format on
4559 # @size: Size of the virtual disk in bytes
4560 # @preallocation: Preallocation mode for the new image (default: off;
4561 #                 allowed values: off, metadata)
4563 # Since: 2.12
4565 { 'struct': 'BlockdevCreateOptionsVdi',
4566   'data': { 'file':             'BlockdevRef',
4567             'size':             'size',
4568             '*preallocation':   'PreallocMode' } }
4571 # @BlockdevVhdxSubformat:
4573 # @dynamic: Growing image file
4574 # @fixed:   Preallocated fixed-size image file
4576 # Since: 2.12
4578 { 'enum': 'BlockdevVhdxSubformat',
4579   'data': [ 'dynamic', 'fixed' ] }
4582 # @BlockdevCreateOptionsVhdx:
4584 # Driver specific image creation options for vhdx.
4586 # @file: Node to create the image format on
4587 # @size: Size of the virtual disk in bytes
4588 # @log-size: Log size in bytes, must be a multiple of 1 MB
4589 #            (default: 1 MB)
4590 # @block-size: Block size in bytes, must be a multiple of 1 MB and not
4591 #              larger than 256 MB (default: automatically choose a block
4592 #              size depending on the image size)
4593 # @subformat: vhdx subformat (default: dynamic)
4594 # @block-state-zero: Force use of payload blocks of type 'ZERO'. Non-standard,
4595 #                    but default.  Do not set to 'off' when using 'qemu-img
4596 #                    convert' with subformat=dynamic.
4598 # Since: 2.12
4600 { 'struct': 'BlockdevCreateOptionsVhdx',
4601   'data': { 'file':                 'BlockdevRef',
4602             'size':                 'size',
4603             '*log-size':            'size',
4604             '*block-size':          'size',
4605             '*subformat':           'BlockdevVhdxSubformat',
4606             '*block-state-zero':    'bool' } }
4609 # @BlockdevVpcSubformat:
4611 # @dynamic: Growing image file
4612 # @fixed:   Preallocated fixed-size image file
4614 # Since: 2.12
4616 { 'enum': 'BlockdevVpcSubformat',
4617   'data': [ 'dynamic', 'fixed' ] }
4620 # @BlockdevCreateOptionsVpc:
4622 # Driver specific image creation options for vpc (VHD).
4624 # @file: Node to create the image format on
4625 # @size: Size of the virtual disk in bytes
4626 # @subformat: vhdx subformat (default: dynamic)
4627 # @force-size: Force use of the exact byte size instead of rounding to the
4628 #              next size that can be represented in CHS geometry
4629 #              (default: false)
4631 # Since: 2.12
4633 { 'struct': 'BlockdevCreateOptionsVpc',
4634   'data': { 'file':                 'BlockdevRef',
4635             'size':                 'size',
4636             '*subformat':           'BlockdevVpcSubformat',
4637             '*force-size':          'bool' } }
4640 # @BlockdevCreateOptions:
4642 # Options for creating an image format on a given node.
4644 # @driver: block driver to create the image format
4646 # Since: 2.12
4648 { 'union': 'BlockdevCreateOptions',
4649   'base': {
4650       'driver':         'BlockdevDriver' },
4651   'discriminator': 'driver',
4652   'data': {
4653       'file':           'BlockdevCreateOptionsFile',
4654       'gluster':        'BlockdevCreateOptionsGluster',
4655       'luks':           'BlockdevCreateOptionsLUKS',
4656       'nfs':            'BlockdevCreateOptionsNfs',
4657       'parallels':      'BlockdevCreateOptionsParallels',
4658       'qcow':           'BlockdevCreateOptionsQcow',
4659       'qcow2':          'BlockdevCreateOptionsQcow2',
4660       'qed':            'BlockdevCreateOptionsQed',
4661       'rbd':            'BlockdevCreateOptionsRbd',
4662       'sheepdog':       'BlockdevCreateOptionsSheepdog',
4663       'ssh':            'BlockdevCreateOptionsSsh',
4664       'vdi':            'BlockdevCreateOptionsVdi',
4665       'vhdx':           'BlockdevCreateOptionsVhdx',
4666       'vmdk':           'BlockdevCreateOptionsVmdk',
4667       'vpc':            'BlockdevCreateOptionsVpc'
4668   } }
4671 # @blockdev-create:
4673 # Starts a job to create an image format on a given node. The job is
4674 # automatically finalized, but a manual job-dismiss is required.
4676 # @job-id:          Identifier for the newly created job.
4678 # @options:         Options for the image creation.
4680 # Since: 3.0
4682 { 'command': 'blockdev-create',
4683   'data': { 'job-id': 'str',
4684             'options': 'BlockdevCreateOptions' } }
4687 # @BlockdevAmendOptionsLUKS:
4689 # Driver specific image amend options for LUKS.
4691 # Since: 5.1
4693 { 'struct': 'BlockdevAmendOptionsLUKS',
4694   'base': 'QCryptoBlockAmendOptionsLUKS',
4695   'data': { }
4699 # @BlockdevAmendOptionsQcow2:
4701 # Driver specific image amend options for qcow2.
4702 # For now, only encryption options can be amended
4704 # @encrypt          Encryption options to be amended
4706 # Since: 5.1
4708 { 'struct': 'BlockdevAmendOptionsQcow2',
4709   'data': { '*encrypt':         'QCryptoBlockAmendOptions' } }
4712 # @BlockdevAmendOptions:
4714 # Options for amending an image format
4716 # @driver:          Block driver of the node to amend.
4718 # Since: 5.1
4720 { 'union': 'BlockdevAmendOptions',
4721   'base': {
4722       'driver':         'BlockdevDriver' },
4723   'discriminator': 'driver',
4724   'data': {
4725       'luks':           'BlockdevAmendOptionsLUKS',
4726       'qcow2':          'BlockdevAmendOptionsQcow2' } }
4729 # @x-blockdev-amend:
4731 # Starts a job to amend format specific options of an existing open block device
4732 # The job is automatically finalized, but a manual job-dismiss is required.
4734 # @job-id:          Identifier for the newly created job.
4736 # @node-name:       Name of the block node to work on
4738 # @options:         Options (driver specific)
4740 # @force:           Allow unsafe operations, format specific
4741 #                   For luks that allows erase of the last active keyslot
4742 #                   (permanent loss of data),
4743 #                   and replacement of an active keyslot
4744 #                   (possible loss of data if IO error happens)
4746 # Since: 5.1
4748 { 'command': 'x-blockdev-amend',
4749   'data': { 'job-id': 'str',
4750             'node-name': 'str',
4751             'options': 'BlockdevAmendOptions',
4752             '*force': 'bool' } }
4755 # @BlockErrorAction:
4757 # An enumeration of action that has been taken when a DISK I/O occurs
4759 # @ignore: error has been ignored
4761 # @report: error has been reported to the device
4763 # @stop: error caused VM to be stopped
4765 # Since: 2.1
4767 { 'enum': 'BlockErrorAction',
4768   'data': [ 'ignore', 'report', 'stop' ] }
4772 # @BLOCK_IMAGE_CORRUPTED:
4774 # Emitted when a disk image is being marked corrupt. The image can be
4775 # identified by its device or node name. The 'device' field is always
4776 # present for compatibility reasons, but it can be empty ("") if the
4777 # image does not have a device name associated.
4779 # @device: device name. This is always present for compatibility
4780 #          reasons, but it can be empty ("") if the image does not
4781 #          have a device name associated.
4783 # @node-name: node name (Since: 2.4)
4785 # @msg: informative message for human consumption, such as the kind of
4786 #       corruption being detected. It should not be parsed by machine as it is
4787 #       not guaranteed to be stable
4789 # @offset: if the corruption resulted from an image access, this is
4790 #          the host's access offset into the image
4792 # @size: if the corruption resulted from an image access, this is
4793 #        the access size
4795 # @fatal: if set, the image is marked corrupt and therefore unusable after this
4796 #         event and must be repaired (Since 2.2; before, every
4797 #         BLOCK_IMAGE_CORRUPTED event was fatal)
4799 # Note: If action is "stop", a STOP event will eventually follow the
4800 #       BLOCK_IO_ERROR event.
4802 # Example:
4804 # <- { "event": "BLOCK_IMAGE_CORRUPTED",
4805 #      "data": { "device": "ide0-hd0", "node-name": "node0",
4806 #                "msg": "Prevented active L1 table overwrite", "offset": 196608,
4807 #                "size": 65536 },
4808 #      "timestamp": { "seconds": 1378126126, "microseconds": 966463 } }
4810 # Since: 1.7
4812 { 'event': 'BLOCK_IMAGE_CORRUPTED',
4813   'data': { 'device'     : 'str',
4814             '*node-name' : 'str',
4815             'msg'        : 'str',
4816             '*offset'    : 'int',
4817             '*size'      : 'int',
4818             'fatal'      : 'bool' } }
4821 # @BLOCK_IO_ERROR:
4823 # Emitted when a disk I/O error occurs
4825 # @device: device name. This is always present for compatibility
4826 #          reasons, but it can be empty ("") if the image does not
4827 #          have a device name associated.
4829 # @node-name: node name. Note that errors may be reported for the root node
4830 #             that is directly attached to a guest device rather than for the
4831 #             node where the error occurred. The node name is not present if
4832 #             the drive is empty. (Since: 2.8)
4834 # @operation: I/O operation
4836 # @action: action that has been taken
4838 # @nospace: true if I/O error was caused due to a no-space
4839 #           condition. This key is only present if query-block's
4840 #           io-status is present, please see query-block documentation
4841 #           for more information (since: 2.2)
4843 # @reason: human readable string describing the error cause.
4844 #          (This field is a debugging aid for humans, it should not
4845 #          be parsed by applications) (since: 2.2)
4847 # Note: If action is "stop", a STOP event will eventually follow the
4848 #       BLOCK_IO_ERROR event
4850 # Since: 0.13.0
4852 # Example:
4854 # <- { "event": "BLOCK_IO_ERROR",
4855 #      "data": { "device": "ide0-hd1",
4856 #                "node-name": "#block212",
4857 #                "operation": "write",
4858 #                "action": "stop" },
4859 #      "timestamp": { "seconds": 1265044230, "microseconds": 450486 } }
4862 { 'event': 'BLOCK_IO_ERROR',
4863   'data': { 'device': 'str', '*node-name': 'str',
4864             'operation': 'IoOperationType',
4865             'action': 'BlockErrorAction', '*nospace': 'bool',
4866             'reason': 'str' } }
4869 # @BLOCK_JOB_COMPLETED:
4871 # Emitted when a block job has completed
4873 # @type: job type
4875 # @device: The job identifier. Originally the device name but other
4876 #          values are allowed since QEMU 2.7
4878 # @len: maximum progress value
4880 # @offset: current progress value. On success this is equal to len.
4881 #          On failure this is less than len
4883 # @speed: rate limit, bytes per second
4885 # @error: error message. Only present on failure. This field
4886 #         contains a human-readable error message. There are no semantics
4887 #         other than that streaming has failed and clients should not try to
4888 #         interpret the error string
4890 # Since: 1.1
4892 # Example:
4894 # <- { "event": "BLOCK_JOB_COMPLETED",
4895 #      "data": { "type": "stream", "device": "virtio-disk0",
4896 #                "len": 10737418240, "offset": 10737418240,
4897 #                "speed": 0 },
4898 #      "timestamp": { "seconds": 1267061043, "microseconds": 959568 } }
4901 { 'event': 'BLOCK_JOB_COMPLETED',
4902   'data': { 'type'  : 'JobType',
4903             'device': 'str',
4904             'len'   : 'int',
4905             'offset': 'int',
4906             'speed' : 'int',
4907             '*error': 'str' } }
4910 # @BLOCK_JOB_CANCELLED:
4912 # Emitted when a block job has been cancelled
4914 # @type: job type
4916 # @device: The job identifier. Originally the device name but other
4917 #          values are allowed since QEMU 2.7
4919 # @len: maximum progress value
4921 # @offset: current progress value. On success this is equal to len.
4922 #          On failure this is less than len
4924 # @speed: rate limit, bytes per second
4926 # Since: 1.1
4928 # Example:
4930 # <- { "event": "BLOCK_JOB_CANCELLED",
4931 #      "data": { "type": "stream", "device": "virtio-disk0",
4932 #                "len": 10737418240, "offset": 134217728,
4933 #                "speed": 0 },
4934 #      "timestamp": { "seconds": 1267061043, "microseconds": 959568 } }
4937 { 'event': 'BLOCK_JOB_CANCELLED',
4938   'data': { 'type'  : 'JobType',
4939             'device': 'str',
4940             'len'   : 'int',
4941             'offset': 'int',
4942             'speed' : 'int' } }
4945 # @BLOCK_JOB_ERROR:
4947 # Emitted when a block job encounters an error
4949 # @device: The job identifier. Originally the device name but other
4950 #          values are allowed since QEMU 2.7
4952 # @operation: I/O operation
4954 # @action: action that has been taken
4956 # Since: 1.3
4958 # Example:
4960 # <- { "event": "BLOCK_JOB_ERROR",
4961 #      "data": { "device": "ide0-hd1",
4962 #                "operation": "write",
4963 #                "action": "stop" },
4964 #      "timestamp": { "seconds": 1265044230, "microseconds": 450486 } }
4967 { 'event': 'BLOCK_JOB_ERROR',
4968   'data': { 'device'   : 'str',
4969             'operation': 'IoOperationType',
4970             'action'   : 'BlockErrorAction' } }
4973 # @BLOCK_JOB_READY:
4975 # Emitted when a block job is ready to complete
4977 # @type: job type
4979 # @device: The job identifier. Originally the device name but other
4980 #          values are allowed since QEMU 2.7
4982 # @len: maximum progress value
4984 # @offset: current progress value. On success this is equal to len.
4985 #          On failure this is less than len
4987 # @speed: rate limit, bytes per second
4989 # Note: The "ready to complete" status is always reset by a @BLOCK_JOB_ERROR
4990 #       event
4992 # Since: 1.3
4994 # Example:
4996 # <- { "event": "BLOCK_JOB_READY",
4997 #      "data": { "device": "drive0", "type": "mirror", "speed": 0,
4998 #                "len": 2097152, "offset": 2097152 }
4999 #      "timestamp": { "seconds": 1265044230, "microseconds": 450486 } }
5002 { 'event': 'BLOCK_JOB_READY',
5003   'data': { 'type'  : 'JobType',
5004             'device': 'str',
5005             'len'   : 'int',
5006             'offset': 'int',
5007             'speed' : 'int' } }
5010 # @BLOCK_JOB_PENDING:
5012 # Emitted when a block job is awaiting explicit authorization to finalize graph
5013 # changes via @block-job-finalize. If this job is part of a transaction, it will
5014 # not emit this event until the transaction has converged first.
5016 # @type: job type
5018 # @id: The job identifier.
5020 # Since: 2.12
5022 # Example:
5024 # <- { "event": "BLOCK_JOB_WAITING",
5025 #      "data": { "device": "drive0", "type": "mirror" },
5026 #      "timestamp": { "seconds": 1265044230, "microseconds": 450486 } }
5029 { 'event': 'BLOCK_JOB_PENDING',
5030   'data': { 'type'  : 'JobType',
5031             'id'    : 'str' } }
5034 # @PreallocMode:
5036 # Preallocation mode of QEMU image file
5038 # @off: no preallocation
5039 # @metadata: preallocate only for metadata
5040 # @falloc: like @full preallocation but allocate disk space by
5041 #          posix_fallocate() rather than writing data.
5042 # @full: preallocate all data by writing it to the device to ensure
5043 #        disk space is really available. This data may or may not be
5044 #        zero, depending on the image format and storage.
5045 #        @full preallocation also sets up metadata correctly.
5047 # Since: 2.2
5049 { 'enum': 'PreallocMode',
5050   'data': [ 'off', 'metadata', 'falloc', 'full' ] }
5053 # @BLOCK_WRITE_THRESHOLD:
5055 # Emitted when writes on block device reaches or exceeds the
5056 # configured write threshold. For thin-provisioned devices, this
5057 # means the device should be extended to avoid pausing for
5058 # disk exhaustion.
5059 # The event is one shot. Once triggered, it needs to be
5060 # re-registered with another block-set-write-threshold command.
5062 # @node-name: graph node name on which the threshold was exceeded.
5064 # @amount-exceeded: amount of data which exceeded the threshold, in bytes.
5066 # @write-threshold: last configured threshold, in bytes.
5068 # Since: 2.3
5070 { 'event': 'BLOCK_WRITE_THRESHOLD',
5071   'data': { 'node-name': 'str',
5072             'amount-exceeded': 'uint64',
5073             'write-threshold': 'uint64' } }
5076 # @block-set-write-threshold:
5078 # Change the write threshold for a block drive. An event will be
5079 # delivered if a write to this block drive crosses the configured
5080 # threshold.  The threshold is an offset, thus must be
5081 # non-negative. Default is no write threshold. Setting the threshold
5082 # to zero disables it.
5084 # This is useful to transparently resize thin-provisioned drives without
5085 # the guest OS noticing.
5087 # @node-name: graph node name on which the threshold must be set.
5089 # @write-threshold: configured threshold for the block device, bytes.
5090 #                   Use 0 to disable the threshold.
5092 # Since: 2.3
5094 # Example:
5096 # -> { "execute": "block-set-write-threshold",
5097 #      "arguments": { "node-name": "mydev",
5098 #                     "write-threshold": 17179869184 } }
5099 # <- { "return": {} }
5102 { 'command': 'block-set-write-threshold',
5103   'data': { 'node-name': 'str', 'write-threshold': 'uint64' } }
5106 # @x-blockdev-change:
5108 # Dynamically reconfigure the block driver state graph. It can be used
5109 # to add, remove, insert or replace a graph node. Currently only the
5110 # Quorum driver implements this feature to add or remove its child. This
5111 # is useful to fix a broken quorum child.
5113 # If @node is specified, it will be inserted under @parent. @child
5114 # may not be specified in this case. If both @parent and @child are
5115 # specified but @node is not, @child will be detached from @parent.
5117 # @parent: the id or name of the parent node.
5119 # @child: the name of a child under the given parent node.
5121 # @node: the name of the node that will be added.
5123 # Note: this command is experimental, and its API is not stable. It
5124 #       does not support all kinds of operations, all kinds of children, nor
5125 #       all block drivers.
5127 #       FIXME Removing children from a quorum node means introducing gaps in the
5128 #       child indices. This cannot be represented in the 'children' list of
5129 #       BlockdevOptionsQuorum, as returned by .bdrv_refresh_filename().
5131 #       Warning: The data in a new quorum child MUST be consistent with that of
5132 #       the rest of the array.
5134 # Since: 2.7
5136 # Example:
5138 # 1. Add a new node to a quorum
5139 # -> { "execute": "blockdev-add",
5140 #      "arguments": {
5141 #          "driver": "raw",
5142 #          "node-name": "new_node",
5143 #          "file": { "driver": "file",
5144 #                    "filename": "test.raw" } } }
5145 # <- { "return": {} }
5146 # -> { "execute": "x-blockdev-change",
5147 #      "arguments": { "parent": "disk1",
5148 #                     "node": "new_node" } }
5149 # <- { "return": {} }
5151 # 2. Delete a quorum's node
5152 # -> { "execute": "x-blockdev-change",
5153 #      "arguments": { "parent": "disk1",
5154 #                     "child": "children.1" } }
5155 # <- { "return": {} }
5158 { 'command': 'x-blockdev-change',
5159   'data' : { 'parent': 'str',
5160              '*child': 'str',
5161              '*node': 'str' } }
5164 # @x-blockdev-set-iothread:
5166 # Move @node and its children into the @iothread.  If @iothread is null then
5167 # move @node and its children into the main loop.
5169 # The node must not be attached to a BlockBackend.
5171 # @node-name: the name of the block driver node
5173 # @iothread: the name of the IOThread object or null for the main loop
5175 # @force: true if the node and its children should be moved when a BlockBackend
5176 #         is already attached
5178 # Note: this command is experimental and intended for test cases that need
5179 #       control over IOThreads only.
5181 # Since: 2.12
5183 # Example:
5185 # 1. Move a node into an IOThread
5186 # -> { "execute": "x-blockdev-set-iothread",
5187 #      "arguments": { "node-name": "disk1",
5188 #                     "iothread": "iothread0" } }
5189 # <- { "return": {} }
5191 # 2. Move a node into the main loop
5192 # -> { "execute": "x-blockdev-set-iothread",
5193 #      "arguments": { "node-name": "disk1",
5194 #                     "iothread": null } }
5195 # <- { "return": {} }
5198 { 'command': 'x-blockdev-set-iothread',
5199   'data' : { 'node-name': 'str',
5200              'iothread': 'StrOrNull',
5201              '*force': 'bool' } }
5204 # @QuorumOpType:
5206 # An enumeration of the quorum operation types
5208 # @read: read operation
5210 # @write: write operation
5212 # @flush: flush operation
5214 # Since: 2.6
5216 { 'enum': 'QuorumOpType',
5217   'data': [ 'read', 'write', 'flush' ] }
5220 # @QUORUM_FAILURE:
5222 # Emitted by the Quorum block driver if it fails to establish a quorum
5224 # @reference: device name if defined else node name
5226 # @sector-num: number of the first sector of the failed read operation
5228 # @sectors-count: failed read operation sector count
5230 # Note: This event is rate-limited.
5232 # Since: 2.0
5234 # Example:
5236 # <- { "event": "QUORUM_FAILURE",
5237 #      "data": { "reference": "usr1", "sector-num": 345435, "sectors-count": 5 },
5238 #      "timestamp": { "seconds": 1344522075, "microseconds": 745528 } }
5241 { 'event': 'QUORUM_FAILURE',
5242   'data': { 'reference': 'str', 'sector-num': 'int', 'sectors-count': 'int' } }
5245 # @QUORUM_REPORT_BAD:
5247 # Emitted to report a corruption of a Quorum file
5249 # @type: quorum operation type (Since 2.6)
5251 # @error: error message. Only present on failure. This field
5252 #         contains a human-readable error message. There are no semantics other
5253 #         than that the block layer reported an error and clients should not
5254 #         try to interpret the error string.
5256 # @node-name: the graph node name of the block driver state
5258 # @sector-num: number of the first sector of the failed read operation
5260 # @sectors-count: failed read operation sector count
5262 # Note: This event is rate-limited.
5264 # Since: 2.0
5266 # Example:
5268 # 1. Read operation
5270 # { "event": "QUORUM_REPORT_BAD",
5271 #      "data": { "node-name": "node0", "sector-num": 345435, "sectors-count": 5,
5272 #                "type": "read" },
5273 #      "timestamp": { "seconds": 1344522075, "microseconds": 745528 } }
5275 # 2. Flush operation
5277 # { "event": "QUORUM_REPORT_BAD",
5278 #      "data": { "node-name": "node0", "sector-num": 0, "sectors-count": 2097120,
5279 #                "type": "flush", "error": "Broken pipe" },
5280 #      "timestamp": { "seconds": 1456406829, "microseconds": 291763 } }
5283 { 'event': 'QUORUM_REPORT_BAD',
5284   'data': { 'type': 'QuorumOpType', '*error': 'str', 'node-name': 'str',
5285             'sector-num': 'int', 'sectors-count': 'int' } }
5288 # @BlockdevSnapshotInternal:
5290 # @device: the device name or node-name of a root node to generate the snapshot
5291 #          from
5293 # @name: the name of the internal snapshot to be created
5295 # Notes: In transaction, if @name is empty, or any snapshot matching @name
5296 #        exists, the operation will fail. Only some image formats support it,
5297 #        for example, qcow2, rbd, and sheepdog.
5299 # Since: 1.7
5301 { 'struct': 'BlockdevSnapshotInternal',
5302   'data': { 'device': 'str', 'name': 'str' } }
5305 # @blockdev-snapshot-internal-sync:
5307 # Synchronously take an internal snapshot of a block device, when the
5308 # format of the image used supports it. If the name is an empty
5309 # string, or a snapshot with name already exists, the operation will
5310 # fail.
5312 # For the arguments, see the documentation of BlockdevSnapshotInternal.
5314 # Returns: - nothing on success
5315 #          - If @device is not a valid block device, GenericError
5316 #          - If any snapshot matching @name exists, or @name is empty,
5317 #            GenericError
5318 #          - If the format of the image used does not support it,
5319 #            BlockFormatFeatureNotSupported
5321 # Since: 1.7
5323 # Example:
5325 # -> { "execute": "blockdev-snapshot-internal-sync",
5326 #      "arguments": { "device": "ide-hd0",
5327 #                     "name": "snapshot0" }
5328 #    }
5329 # <- { "return": {} }
5332 { 'command': 'blockdev-snapshot-internal-sync',
5333   'data': 'BlockdevSnapshotInternal' }
5336 # @blockdev-snapshot-delete-internal-sync:
5338 # Synchronously delete an internal snapshot of a block device, when the format
5339 # of the image used support it. The snapshot is identified by name or id or
5340 # both. One of the name or id is required. Return SnapshotInfo for the
5341 # successfully deleted snapshot.
5343 # @device: the device name or node-name of a root node to delete the snapshot
5344 #          from
5346 # @id: optional the snapshot's ID to be deleted
5348 # @name: optional the snapshot's name to be deleted
5350 # Returns: - SnapshotInfo on success
5351 #          - If @device is not a valid block device, GenericError
5352 #          - If snapshot not found, GenericError
5353 #          - If the format of the image used does not support it,
5354 #            BlockFormatFeatureNotSupported
5355 #          - If @id and @name are both not specified, GenericError
5357 # Since: 1.7
5359 # Example:
5361 # -> { "execute": "blockdev-snapshot-delete-internal-sync",
5362 #      "arguments": { "device": "ide-hd0",
5363 #                     "name": "snapshot0" }
5364 #    }
5365 # <- { "return": {
5366 #                    "id": "1",
5367 #                    "name": "snapshot0",
5368 #                    "vm-state-size": 0,
5369 #                    "date-sec": 1000012,
5370 #                    "date-nsec": 10,
5371 #                    "vm-clock-sec": 100,
5372 #                    "vm-clock-nsec": 20,
5373 #                    "icount": 220414
5374 #      }
5375 #    }
5378 { 'command': 'blockdev-snapshot-delete-internal-sync',
5379   'data': { 'device': 'str', '*id': 'str', '*name': 'str'},
5380   'returns': 'SnapshotInfo' }