dirty-bitmaps: remove deprecated autoload parameter
[qemu/ar7.git] / qapi / block-core.json
blobb274aef713821fccfd7fd10220ee692a1d7f8b1f
1 # -*- Mode: Python -*-
3 ##
4 # == Block core (VM unrelated)
5 ##
7 { 'include': 'common.json' }
8 { 'include': 'crypto.json' }
9 { 'include': 'job.json' }
10 { 'include': 'sockets.json' }
13 # @SnapshotInfo:
15 # @id: unique snapshot id
17 # @name: user chosen name
19 # @vm-state-size: size of the VM state
21 # @date-sec: UTC date of the snapshot in seconds
23 # @date-nsec: fractional part in nano seconds to be used with date-sec
25 # @vm-clock-sec: VM clock relative to boot in seconds
27 # @vm-clock-nsec: fractional part in nano seconds to be used with vm-clock-sec
29 # Since: 1.3
32 { 'struct': 'SnapshotInfo',
33   'data': { 'id': 'str', 'name': 'str', 'vm-state-size': 'int',
34             'date-sec': 'int', 'date-nsec': 'int',
35             'vm-clock-sec': 'int', 'vm-clock-nsec': 'int' } }
38 # @ImageInfoSpecificQCow2EncryptionBase:
40 # @format: The encryption format
42 # Since: 2.10
44 { 'struct': 'ImageInfoSpecificQCow2EncryptionBase',
45   'data': { 'format': 'BlockdevQcow2EncryptionFormat'}}
48 # @ImageInfoSpecificQCow2Encryption:
50 # Since: 2.10
52 { 'union': 'ImageInfoSpecificQCow2Encryption',
53   'base': 'ImageInfoSpecificQCow2EncryptionBase',
54   'discriminator': 'format',
55   'data': { 'luks': 'QCryptoBlockInfoLUKS' } }
58 # @ImageInfoSpecificQCow2:
60 # @compat: compatibility level
62 # @data-file: the filename of the external data file that is stored in the
63 #             image and used as a default for opening the image (since: 4.0)
65 # @data-file-raw: True if the external data file must stay valid as a
66 #                 standalone (read-only) raw image without looking at qcow2
67 #                 metadata (since: 4.0)
69 # @lazy-refcounts: on or off; only valid for compat >= 1.1
71 # @corrupt: true if the image has been marked corrupt; only valid for
72 #           compat >= 1.1 (since 2.2)
74 # @refcount-bits: width of a refcount entry in bits (since 2.3)
76 # @encrypt: details about encryption parameters; only set if image
77 #           is encrypted (since 2.10)
79 # @bitmaps: A list of qcow2 bitmap details (since 4.0)
81 # Since: 1.7
83 { 'struct': 'ImageInfoSpecificQCow2',
84   'data': {
85       'compat': 'str',
86       '*data-file': 'str',
87       '*data-file-raw': 'bool',
88       '*lazy-refcounts': 'bool',
89       '*corrupt': 'bool',
90       'refcount-bits': 'int',
91       '*encrypt': 'ImageInfoSpecificQCow2Encryption',
92       '*bitmaps': ['Qcow2BitmapInfo']
93   } }
96 # @ImageInfoSpecificVmdk:
98 # @create-type: The create type of VMDK image
100 # @cid: Content id of image
102 # @parent-cid: Parent VMDK image's cid
104 # @extents: List of extent files
106 # Since: 1.7
108 { 'struct': 'ImageInfoSpecificVmdk',
109   'data': {
110       'create-type': 'str',
111       'cid': 'int',
112       'parent-cid': 'int',
113       'extents': ['ImageInfo']
114   } }
117 # @ImageInfoSpecific:
119 # A discriminated record of image format specific information structures.
121 # Since: 1.7
123 { 'union': 'ImageInfoSpecific',
124   'data': {
125       'qcow2': 'ImageInfoSpecificQCow2',
126       'vmdk': 'ImageInfoSpecificVmdk',
127       # If we need to add block driver specific parameters for
128       # LUKS in future, then we'll subclass QCryptoBlockInfoLUKS
129       # to define a ImageInfoSpecificLUKS
130       'luks': 'QCryptoBlockInfoLUKS'
131   } }
134 # @ImageInfo:
136 # Information about a QEMU image file
138 # @filename: name of the image file
140 # @format: format of the image file
142 # @virtual-size: maximum capacity in bytes of the image
144 # @actual-size: actual size on disk in bytes of the image
146 # @dirty-flag: true if image is not cleanly closed
148 # @cluster-size: size of a cluster in bytes
150 # @encrypted: true if the image is encrypted
152 # @compressed: true if the image is compressed (Since 1.7)
154 # @backing-filename: name of the backing file
156 # @full-backing-filename: full path of the backing file
158 # @backing-filename-format: the format of the backing file
160 # @snapshots: list of VM snapshots
162 # @backing-image: info of the backing image (since 1.6)
164 # @format-specific: structure supplying additional format-specific
165 # information (since 1.7)
167 # Since: 1.3
170 { 'struct': 'ImageInfo',
171   'data': {'filename': 'str', 'format': 'str', '*dirty-flag': 'bool',
172            '*actual-size': 'int', 'virtual-size': 'int',
173            '*cluster-size': 'int', '*encrypted': 'bool', '*compressed': 'bool',
174            '*backing-filename': 'str', '*full-backing-filename': 'str',
175            '*backing-filename-format': 'str', '*snapshots': ['SnapshotInfo'],
176            '*backing-image': 'ImageInfo',
177            '*format-specific': 'ImageInfoSpecific' } }
180 # @ImageCheck:
182 # Information about a QEMU image file check
184 # @filename: name of the image file checked
186 # @format: format of the image file checked
188 # @check-errors: number of unexpected errors occurred during check
190 # @image-end-offset: offset (in bytes) where the image ends, this
191 #                    field is present if the driver for the image format
192 #                    supports it
194 # @corruptions: number of corruptions found during the check if any
196 # @leaks: number of leaks found during the check if any
198 # @corruptions-fixed: number of corruptions fixed during the check
199 #                     if any
201 # @leaks-fixed: number of leaks fixed during the check if any
203 # @total-clusters: total number of clusters, this field is present
204 #                  if the driver for the image format supports it
206 # @allocated-clusters: total number of allocated clusters, this
207 #                      field is present if the driver for the image format
208 #                      supports it
210 # @fragmented-clusters: total number of fragmented clusters, this
211 #                       field is present if the driver for the image format
212 #                       supports it
214 # @compressed-clusters: total number of compressed clusters, this
215 #                       field is present if the driver for the image format
216 #                       supports it
218 # Since: 1.4
221 { 'struct': 'ImageCheck',
222   'data': {'filename': 'str', 'format': 'str', 'check-errors': 'int',
223            '*image-end-offset': 'int', '*corruptions': 'int', '*leaks': 'int',
224            '*corruptions-fixed': 'int', '*leaks-fixed': 'int',
225            '*total-clusters': 'int', '*allocated-clusters': 'int',
226            '*fragmented-clusters': 'int', '*compressed-clusters': 'int' } }
229 # @MapEntry:
231 # Mapping information from a virtual block range to a host file range
233 # @start: the start byte of the mapped virtual range
235 # @length: the number of bytes of the mapped virtual range
237 # @data: whether the mapped range has data
239 # @zero: whether the virtual blocks are zeroed
241 # @depth: the depth of the mapping
243 # @offset: the offset in file that the virtual sectors are mapped to
245 # @filename: filename that is referred to by @offset
247 # Since: 2.6
250 { 'struct': 'MapEntry',
251   'data': {'start': 'int', 'length': 'int', 'data': 'bool',
252            'zero': 'bool', 'depth': 'int', '*offset': 'int',
253            '*filename': 'str' } }
256 # @BlockdevCacheInfo:
258 # Cache mode information for a block device
260 # @writeback:   true if writeback mode is enabled
261 # @direct:      true if the host page cache is bypassed (O_DIRECT)
262 # @no-flush:    true if flush requests are ignored for the device
264 # Since: 2.3
266 { 'struct': 'BlockdevCacheInfo',
267   'data': { 'writeback': 'bool',
268             'direct': 'bool',
269             'no-flush': 'bool' } }
272 # @BlockDeviceInfo:
274 # Information about the backing device for a block device.
276 # @file: the filename of the backing device
278 # @node-name: the name of the block driver node (Since 2.0)
280 # @ro: true if the backing device was open read-only
282 # @drv: the name of the block format used to open the backing device. As of
283 #       0.14.0 this can be: 'blkdebug', 'bochs', 'cloop', 'cow', 'dmg',
284 #       'file', 'file', 'ftp', 'ftps', 'host_cdrom', 'host_device',
285 #       'http', 'https', 'luks', 'nbd', 'parallels', 'qcow',
286 #       'qcow2', 'raw', 'vdi', 'vmdk', 'vpc', 'vvfat'
287 #       2.2: 'archipelago' added, 'cow' dropped
288 #       2.3: 'host_floppy' deprecated
289 #       2.5: 'host_floppy' dropped
290 #       2.6: 'luks' added
291 #       2.8: 'replication' added, 'tftp' dropped
292 #       2.9: 'archipelago' dropped
294 # @backing_file: the name of the backing file (for copy-on-write)
296 # @backing_file_depth: number of files in the backing file chain (since: 1.2)
298 # @encrypted: true if the backing device is encrypted
300 # @encryption_key_missing: Deprecated; always false
302 # @detect_zeroes: detect and optimize zero writes (Since 2.1)
304 # @bps: total throughput limit in bytes per second is specified
306 # @bps_rd: read throughput limit in bytes per second is specified
308 # @bps_wr: write throughput limit in bytes per second is specified
310 # @iops: total I/O operations per second is specified
312 # @iops_rd: read I/O operations per second is specified
314 # @iops_wr: write I/O operations per second is specified
316 # @image: the info of image used (since: 1.6)
318 # @bps_max: total throughput limit during bursts,
319 #                     in bytes (Since 1.7)
321 # @bps_rd_max: read throughput limit during bursts,
322 #                        in bytes (Since 1.7)
324 # @bps_wr_max: write throughput limit during bursts,
325 #                        in bytes (Since 1.7)
327 # @iops_max: total I/O operations per second during bursts,
328 #                      in bytes (Since 1.7)
330 # @iops_rd_max: read I/O operations per second during bursts,
331 #                         in bytes (Since 1.7)
333 # @iops_wr_max: write I/O operations per second during bursts,
334 #                         in bytes (Since 1.7)
336 # @bps_max_length: maximum length of the @bps_max burst
337 #                            period, in seconds. (Since 2.6)
339 # @bps_rd_max_length: maximum length of the @bps_rd_max
340 #                               burst period, in seconds. (Since 2.6)
342 # @bps_wr_max_length: maximum length of the @bps_wr_max
343 #                               burst period, in seconds. (Since 2.6)
345 # @iops_max_length: maximum length of the @iops burst
346 #                             period, in seconds. (Since 2.6)
348 # @iops_rd_max_length: maximum length of the @iops_rd_max
349 #                                burst period, in seconds. (Since 2.6)
351 # @iops_wr_max_length: maximum length of the @iops_wr_max
352 #                                burst period, in seconds. (Since 2.6)
354 # @iops_size: an I/O size in bytes (Since 1.7)
356 # @group: throttle group name (Since 2.4)
358 # @cache: the cache mode used for the block device (since: 2.3)
360 # @write_threshold: configured write threshold for the device.
361 #                   0 if disabled. (Since 2.3)
363 # @dirty-bitmaps: dirty bitmaps information (only present if node
364 #                 has one or more dirty bitmaps) (Since 4.2)
366 # Since: 0.14.0
369 { 'struct': 'BlockDeviceInfo',
370   'data': { 'file': 'str', '*node-name': 'str', 'ro': 'bool', 'drv': 'str',
371             '*backing_file': 'str', 'backing_file_depth': 'int',
372             'encrypted': 'bool', 'encryption_key_missing': 'bool',
373             'detect_zeroes': 'BlockdevDetectZeroesOptions',
374             'bps': 'int', 'bps_rd': 'int', 'bps_wr': 'int',
375             'iops': 'int', 'iops_rd': 'int', 'iops_wr': 'int',
376             'image': 'ImageInfo',
377             '*bps_max': 'int', '*bps_rd_max': 'int',
378             '*bps_wr_max': 'int', '*iops_max': 'int',
379             '*iops_rd_max': 'int', '*iops_wr_max': 'int',
380             '*bps_max_length': 'int', '*bps_rd_max_length': 'int',
381             '*bps_wr_max_length': 'int', '*iops_max_length': 'int',
382             '*iops_rd_max_length': 'int', '*iops_wr_max_length': 'int',
383             '*iops_size': 'int', '*group': 'str', 'cache': 'BlockdevCacheInfo',
384             'write_threshold': 'int', '*dirty-bitmaps': ['BlockDirtyInfo'] } }
387 # @BlockDeviceIoStatus:
389 # An enumeration of block device I/O status.
391 # @ok: The last I/O operation has succeeded
393 # @failed: The last I/O operation has failed
395 # @nospace: The last I/O operation has failed due to a no-space condition
397 # Since: 1.0
399 { 'enum': 'BlockDeviceIoStatus', 'data': [ 'ok', 'failed', 'nospace' ] }
402 # @BlockDeviceMapEntry:
404 # Entry in the metadata map of the device (returned by "qemu-img map")
406 # @start: Offset in the image of the first byte described by this entry
407 #         (in bytes)
409 # @length: Length of the range described by this entry (in bytes)
411 # @depth: Number of layers (0 = top image, 1 = top image's backing file, etc.)
412 #         before reaching one for which the range is allocated.  The value is
413 #         in the range 0 to the depth of the image chain - 1.
415 # @zero: the sectors in this range read as zeros
417 # @data: reading the image will actually read data from a file (in particular,
418 #        if @offset is present this means that the sectors are not simply
419 #        preallocated, but contain actual data in raw format)
421 # @offset: if present, the image file stores the data for this range in
422 #          raw format at the given offset.
424 # Since: 1.7
426 { 'struct': 'BlockDeviceMapEntry',
427   'data': { 'start': 'int', 'length': 'int', 'depth': 'int', 'zero': 'bool',
428             'data': 'bool', '*offset': 'int' } }
431 # @DirtyBitmapStatus:
433 # An enumeration of possible states that a dirty bitmap can report to the user.
435 # @frozen: The bitmap is currently in-use by some operation and is immutable.
436 #          If the bitmap was @active prior to the operation, new writes by the
437 #          guest are being recorded in a temporary buffer, and will not be lost.
438 #          Generally, bitmaps are cleared on successful use in an operation and
439 #          the temporary buffer is committed into the bitmap. On failure, the
440 #          temporary buffer is merged back into the bitmap without first
441 #          clearing it.
442 #          Please refer to the documentation for each bitmap-using operation,
443 #          See also @blockdev-backup, @drive-backup.
445 # @disabled: The bitmap is not currently recording new writes by the guest.
446 #            This is requested explicitly via @block-dirty-bitmap-disable.
447 #            It can still be cleared, deleted, or used for backup operations.
449 # @active: The bitmap is actively monitoring for new writes, and can be cleared,
450 #          deleted, or used for backup operations.
452 # @locked: The bitmap is currently in-use by some operation and is immutable.
453 #          If the bitmap was @active prior to the operation, it is still
454 #          recording new writes. If the bitmap was @disabled, it is not
455 #          recording new writes. (Since 2.12)
457 # @inconsistent: This is a persistent dirty bitmap that was marked in-use on
458 #                disk, and is unusable by QEMU. It can only be deleted.
459 #                Please rely on the inconsistent field in @BlockDirtyInfo
460 #                instead, as the status field is deprecated. (Since 4.0)
462 # Since: 2.4
464 { 'enum': 'DirtyBitmapStatus',
465   'data': ['active', 'disabled', 'frozen', 'locked', 'inconsistent'] }
468 # @BlockDirtyInfo:
470 # Block dirty bitmap information.
472 # @name: the name of the dirty bitmap (Since 2.4)
474 # @count: number of dirty bytes according to the dirty bitmap
476 # @granularity: granularity of the dirty bitmap in bytes (since 1.4)
478 # @status: Deprecated in favor of @recording and @locked. (since 2.4)
480 # @recording: true if the bitmap is recording new writes from the guest.
481 #             Replaces `active` and `disabled` statuses. (since 4.0)
483 # @busy: true if the bitmap is in-use by some operation (NBD or jobs)
484 #        and cannot be modified via QMP or used by another operation.
485 #        Replaces `locked` and `frozen` statuses. (since 4.0)
487 # @persistent: true if the bitmap was stored on disk, is scheduled to be stored
488 #              on disk, or both. (since 4.0)
490 # @inconsistent: true if this is a persistent bitmap that was improperly
491 #                stored. Implies @persistent to be true; @recording and
492 #                @busy to be false. This bitmap cannot be used. To remove
493 #                it, use @block-dirty-bitmap-remove. (Since 4.0)
495 # Since: 1.3
497 { 'struct': 'BlockDirtyInfo',
498   'data': {'*name': 'str', 'count': 'int', 'granularity': 'uint32',
499            'recording': 'bool', 'busy': 'bool', 'status': 'DirtyBitmapStatus',
500            'persistent': 'bool', '*inconsistent': 'bool' } }
503 # @Qcow2BitmapInfoFlags:
505 # An enumeration of flags that a bitmap can report to the user.
507 # @in-use: This flag is set by any process actively modifying the qcow2 file,
508 #          and cleared when the updated bitmap is flushed to the qcow2 image.
509 #          The presence of this flag in an offline image means that the bitmap
510 #          was not saved correctly after its last usage, and may contain
511 #          inconsistent data.
513 # @auto: The bitmap must reflect all changes of the virtual disk by any
514 #        application that would write to this qcow2 file.
516 # Since: 4.0
518 { 'enum': 'Qcow2BitmapInfoFlags',
519   'data': ['in-use', 'auto'] }
522 # @Qcow2BitmapInfo:
524 # Qcow2 bitmap information.
526 # @name: the name of the bitmap
528 # @granularity: granularity of the bitmap in bytes
530 # @flags: flags of the bitmap
532 # Since: 4.0
534 { 'struct': 'Qcow2BitmapInfo',
535   'data': {'name': 'str', 'granularity': 'uint32',
536            'flags': ['Qcow2BitmapInfoFlags'] } }
539 # @BlockLatencyHistogramInfo:
541 # Block latency histogram.
543 # @boundaries: list of interval boundary values in nanoseconds, all greater
544 #              than zero and in ascending order.
545 #              For example, the list [10, 50, 100] produces the following
546 #              histogram intervals: [0, 10), [10, 50), [50, 100), [100, +inf).
548 # @bins: list of io request counts corresponding to histogram intervals.
549 #        len(@bins) = len(@boundaries) + 1
550 #        For the example above, @bins may be something like [3, 1, 5, 2],
551 #        and corresponding histogram looks like:
553 #        5|           *
554 #        4|           *
555 #        3| *         *
556 #        2| *         *    *
557 #        1| *    *    *    *
558 #         +------------------
559 #             10   50   100
561 # Since: 4.0
563 { 'struct': 'BlockLatencyHistogramInfo',
564   'data': {'boundaries': ['uint64'], 'bins': ['uint64'] } }
567 # @block-latency-histogram-set:
569 # Manage read, write and flush latency histograms for the device.
571 # If only @id parameter is specified, remove all present latency histograms
572 # for the device. Otherwise, add/reset some of (or all) latency histograms.
574 # @id: The name or QOM path of the guest device.
576 # @boundaries: list of interval boundary values (see description in
577 #              BlockLatencyHistogramInfo definition). If specified, all
578 #              latency histograms are removed, and empty ones created for all
579 #              io types with intervals corresponding to @boundaries (except for
580 #              io types, for which specific boundaries are set through the
581 #              following parameters).
583 # @boundaries-read: list of interval boundary values for read latency
584 #                   histogram. If specified, old read latency histogram is
585 #                   removed, and empty one created with intervals
586 #                   corresponding to @boundaries-read. The parameter has higher
587 #                   priority then @boundaries.
589 # @boundaries-write: list of interval boundary values for write latency
590 #                    histogram.
592 # @boundaries-flush: list of interval boundary values for flush latency
593 #                    histogram.
595 # Returns: error if device is not found or any boundary arrays are invalid.
597 # Since: 4.0
599 # Example: set new histograms for all io types with intervals
600 # [0, 10), [10, 50), [50, 100), [100, +inf):
602 # -> { "execute": "block-latency-histogram-set",
603 #      "arguments": { "id": "drive0",
604 #                     "boundaries": [10, 50, 100] } }
605 # <- { "return": {} }
607 # Example: set new histogram only for write, other histograms will remain
608 # not changed (or not created):
610 # -> { "execute": "block-latency-histogram-set",
611 #      "arguments": { "id": "drive0",
612 #                     "boundaries-write": [10, 50, 100] } }
613 # <- { "return": {} }
615 # Example: set new histograms with the following intervals:
616 #   read, flush: [0, 10), [10, 50), [50, 100), [100, +inf)
617 #   write: [0, 1000), [1000, 5000), [5000, +inf)
619 # -> { "execute": "block-latency-histogram-set",
620 #      "arguments": { "id": "drive0",
621 #                     "boundaries": [10, 50, 100],
622 #                     "boundaries-write": [1000, 5000] } }
623 # <- { "return": {} }
625 # Example: remove all latency histograms:
627 # -> { "execute": "block-latency-histogram-set",
628 #      "arguments": { "id": "drive0" } }
629 # <- { "return": {} }
631 { 'command': 'block-latency-histogram-set',
632   'data': {'id': 'str',
633            '*boundaries': ['uint64'],
634            '*boundaries-read': ['uint64'],
635            '*boundaries-write': ['uint64'],
636            '*boundaries-flush': ['uint64'] } }
639 # @BlockInfo:
641 # Block device information.  This structure describes a virtual device and
642 # the backing device associated with it.
644 # @device: The device name associated with the virtual device.
646 # @qdev: The qdev ID, or if no ID is assigned, the QOM path of the block
647 #        device. (since 2.10)
649 # @type: This field is returned only for compatibility reasons, it should
650 #        not be used (always returns 'unknown')
652 # @removable: True if the device supports removable media.
654 # @locked: True if the guest has locked this device from having its media
655 #          removed
657 # @tray_open: True if the device's tray is open
658 #             (only present if it has a tray)
660 # @dirty-bitmaps: dirty bitmaps information (only present if the
661 #                 driver has one or more dirty bitmaps) (Since 2.0)
662 #                 Deprecated in 4.2; see BlockDeviceInfo instead.
664 # @io-status: @BlockDeviceIoStatus. Only present if the device
665 #             supports it and the VM is configured to stop on errors
666 #             (supported device models: virtio-blk, IDE, SCSI except
667 #             scsi-generic)
669 # @inserted: @BlockDeviceInfo describing the device if media is
670 #            present
672 # Since:  0.14.0
674 { 'struct': 'BlockInfo',
675   'data': {'device': 'str', '*qdev': 'str', 'type': 'str', 'removable': 'bool',
676            'locked': 'bool', '*inserted': 'BlockDeviceInfo',
677            '*tray_open': 'bool', '*io-status': 'BlockDeviceIoStatus',
678            '*dirty-bitmaps': ['BlockDirtyInfo'] } }
681 # @BlockMeasureInfo:
683 # Image file size calculation information.  This structure describes the size
684 # requirements for creating a new image file.
686 # The size requirements depend on the new image file format.  File size always
687 # equals virtual disk size for the 'raw' format, even for sparse POSIX files.
688 # Compact formats such as 'qcow2' represent unallocated and zero regions
689 # efficiently so file size may be smaller than virtual disk size.
691 # The values are upper bounds that are guaranteed to fit the new image file.
692 # Subsequent modification, such as internal snapshot or bitmap creation, may
693 # require additional space and is not covered here.
695 # @required: Size required for a new image file, in bytes.
697 # @fully-allocated: Image file size, in bytes, once data has been written
698 #                   to all sectors.
700 # Since: 2.10
702 { 'struct': 'BlockMeasureInfo',
703   'data': {'required': 'int', 'fully-allocated': 'int'} }
706 # @query-block:
708 # Get a list of BlockInfo for all virtual block devices.
710 # Returns: a list of @BlockInfo describing each virtual block device. Filter
711 # nodes that were created implicitly are skipped over.
713 # Since: 0.14.0
715 # Example:
717 # -> { "execute": "query-block" }
718 # <- {
719 #       "return":[
720 #          {
721 #             "io-status": "ok",
722 #             "device":"ide0-hd0",
723 #             "locked":false,
724 #             "removable":false,
725 #             "inserted":{
726 #                "ro":false,
727 #                "drv":"qcow2",
728 #                "encrypted":false,
729 #                "file":"disks/test.qcow2",
730 #                "backing_file_depth":1,
731 #                "bps":1000000,
732 #                "bps_rd":0,
733 #                "bps_wr":0,
734 #                "iops":1000000,
735 #                "iops_rd":0,
736 #                "iops_wr":0,
737 #                "bps_max": 8000000,
738 #                "bps_rd_max": 0,
739 #                "bps_wr_max": 0,
740 #                "iops_max": 0,
741 #                "iops_rd_max": 0,
742 #                "iops_wr_max": 0,
743 #                "iops_size": 0,
744 #                "detect_zeroes": "on",
745 #                "write_threshold": 0,
746 #                "image":{
747 #                   "filename":"disks/test.qcow2",
748 #                   "format":"qcow2",
749 #                   "virtual-size":2048000,
750 #                   "backing_file":"base.qcow2",
751 #                   "full-backing-filename":"disks/base.qcow2",
752 #                   "backing-filename-format":"qcow2",
753 #                   "snapshots":[
754 #                      {
755 #                         "id": "1",
756 #                         "name": "snapshot1",
757 #                         "vm-state-size": 0,
758 #                         "date-sec": 10000200,
759 #                         "date-nsec": 12,
760 #                         "vm-clock-sec": 206,
761 #                         "vm-clock-nsec": 30
762 #                      }
763 #                   ],
764 #                   "backing-image":{
765 #                       "filename":"disks/base.qcow2",
766 #                       "format":"qcow2",
767 #                       "virtual-size":2048000
768 #                   }
769 #                }
770 #             },
771 #             "qdev": "ide_disk",
772 #             "type":"unknown"
773 #          },
774 #          {
775 #             "io-status": "ok",
776 #             "device":"ide1-cd0",
777 #             "locked":false,
778 #             "removable":true,
779 #             "qdev": "/machine/unattached/device[23]",
780 #             "tray_open": false,
781 #             "type":"unknown"
782 #          },
783 #          {
784 #             "device":"floppy0",
785 #             "locked":false,
786 #             "removable":true,
787 #             "qdev": "/machine/unattached/device[20]",
788 #             "type":"unknown"
789 #          },
790 #          {
791 #             "device":"sd0",
792 #             "locked":false,
793 #             "removable":true,
794 #             "type":"unknown"
795 #          }
796 #       ]
797 #    }
800 { 'command': 'query-block', 'returns': ['BlockInfo'] }
804 # @BlockDeviceTimedStats:
806 # Statistics of a block device during a given interval of time.
808 # @interval_length: Interval used for calculating the statistics,
809 #                   in seconds.
811 # @min_rd_latency_ns: Minimum latency of read operations in the
812 #                     defined interval, in nanoseconds.
814 # @min_wr_latency_ns: Minimum latency of write operations in the
815 #                     defined interval, in nanoseconds.
817 # @min_flush_latency_ns: Minimum latency of flush operations in the
818 #                        defined interval, in nanoseconds.
820 # @max_rd_latency_ns: Maximum latency of read operations in the
821 #                     defined interval, in nanoseconds.
823 # @max_wr_latency_ns: Maximum latency of write operations in the
824 #                     defined interval, in nanoseconds.
826 # @max_flush_latency_ns: Maximum latency of flush operations in the
827 #                        defined interval, in nanoseconds.
829 # @avg_rd_latency_ns: Average latency of read operations in the
830 #                     defined interval, in nanoseconds.
832 # @avg_wr_latency_ns: Average latency of write operations in the
833 #                     defined interval, in nanoseconds.
835 # @avg_flush_latency_ns: Average latency of flush operations in the
836 #                        defined interval, in nanoseconds.
838 # @avg_rd_queue_depth: Average number of pending read operations
839 #                      in the defined interval.
841 # @avg_wr_queue_depth: Average number of pending write operations
842 #                      in the defined interval.
844 # Since: 2.5
846 { 'struct': 'BlockDeviceTimedStats',
847   'data': { 'interval_length': 'int', 'min_rd_latency_ns': 'int',
848             'max_rd_latency_ns': 'int', 'avg_rd_latency_ns': 'int',
849             'min_wr_latency_ns': 'int', 'max_wr_latency_ns': 'int',
850             'avg_wr_latency_ns': 'int', 'min_flush_latency_ns': 'int',
851             'max_flush_latency_ns': 'int', 'avg_flush_latency_ns': 'int',
852             'avg_rd_queue_depth': 'number', 'avg_wr_queue_depth': 'number' } }
855 # @BlockDeviceStats:
857 # Statistics of a virtual block device or a block backing device.
859 # @rd_bytes:      The number of bytes read by the device.
861 # @wr_bytes:      The number of bytes written by the device.
863 # @unmap_bytes: The number of bytes unmapped by the device (Since 4.2)
865 # @rd_operations: The number of read operations performed by the device.
867 # @wr_operations: The number of write operations performed by the device.
869 # @flush_operations: The number of cache flush operations performed by the
870 #                    device (since 0.15.0)
872 # @unmap_operations: The number of unmap operations performed by the device
873 #                    (Since 4.2)
875 # @rd_total_time_ns: Total time spent on reads in nanoseconds (since 0.15.0).
877 # @wr_total_time_ns: Total time spent on writes in nanoseconds (since 0.15.0).
879 # @flush_total_time_ns: Total time spent on cache flushes in nanoseconds
880 #                       (since 0.15.0).
882 # @unmap_total_time_ns: Total time spent on unmap operations in nanoseconds
883 #                       (Since 4.2)
885 # @wr_highest_offset: The offset after the greatest byte written to the
886 #                     device.  The intended use of this information is for
887 #                     growable sparse files (like qcow2) that are used on top
888 #                     of a physical device.
890 # @rd_merged: Number of read requests that have been merged into another
891 #             request (Since 2.3).
893 # @wr_merged: Number of write requests that have been merged into another
894 #             request (Since 2.3).
896 # @unmap_merged: Number of unmap requests that have been merged into another
897 #                request (Since 4.2)
899 # @idle_time_ns: Time since the last I/O operation, in
900 #                nanoseconds. If the field is absent it means that
901 #                there haven't been any operations yet (Since 2.5).
903 # @failed_rd_operations: The number of failed read operations
904 #                        performed by the device (Since 2.5)
906 # @failed_wr_operations: The number of failed write operations
907 #                        performed by the device (Since 2.5)
909 # @failed_flush_operations: The number of failed flush operations
910 #                           performed by the device (Since 2.5)
912 # @failed_unmap_operations: The number of failed unmap operations performed
913 #                           by the device (Since 4.2)
915 # @invalid_rd_operations: The number of invalid read operations
916 #                          performed by the device (Since 2.5)
918 # @invalid_wr_operations: The number of invalid write operations
919 #                         performed by the device (Since 2.5)
921 # @invalid_flush_operations: The number of invalid flush operations
922 #                            performed by the device (Since 2.5)
924 # @invalid_unmap_operations: The number of invalid unmap operations performed
925 #                            by the device (Since 4.2)
927 # @account_invalid: Whether invalid operations are included in the
928 #                   last access statistics (Since 2.5)
930 # @account_failed: Whether failed operations are included in the
931 #                  latency and last access statistics (Since 2.5)
933 # @timed_stats: Statistics specific to the set of previously defined
934 #               intervals of time (Since 2.5)
936 # @rd_latency_histogram: @BlockLatencyHistogramInfo. (Since 4.0)
938 # @wr_latency_histogram: @BlockLatencyHistogramInfo. (Since 4.0)
940 # @flush_latency_histogram: @BlockLatencyHistogramInfo. (Since 4.0)
942 # Since: 0.14.0
944 { 'struct': 'BlockDeviceStats',
945   'data': {'rd_bytes': 'int', 'wr_bytes': 'int', 'unmap_bytes' : 'int',
946            'rd_operations': 'int', 'wr_operations': 'int',
947            'flush_operations': 'int', 'unmap_operations': 'int',
948            'rd_total_time_ns': 'int', 'wr_total_time_ns': 'int',
949            'flush_total_time_ns': 'int', 'unmap_total_time_ns': 'int',
950            'wr_highest_offset': 'int',
951            'rd_merged': 'int', 'wr_merged': 'int', 'unmap_merged': 'int',
952            '*idle_time_ns': 'int',
953            'failed_rd_operations': 'int', 'failed_wr_operations': 'int',
954            'failed_flush_operations': 'int', 'failed_unmap_operations': 'int',
955            'invalid_rd_operations': 'int', 'invalid_wr_operations': 'int',
956            'invalid_flush_operations': 'int', 'invalid_unmap_operations': 'int',
957            'account_invalid': 'bool', 'account_failed': 'bool',
958            'timed_stats': ['BlockDeviceTimedStats'],
959            '*rd_latency_histogram': 'BlockLatencyHistogramInfo',
960            '*wr_latency_histogram': 'BlockLatencyHistogramInfo',
961            '*flush_latency_histogram': 'BlockLatencyHistogramInfo' } }
964 # @BlockStatsSpecificFile:
966 # File driver statistics
968 # @discard-nb-ok: The number of successful discard operations performed by
969 #                 the driver.
971 # @discard-nb-failed: The number of failed discard operations performed by
972 #                     the driver.
974 # @discard-bytes-ok: The number of bytes discarded by the driver.
976 # Since: 4.2
978 { 'struct': 'BlockStatsSpecificFile',
979   'data': {
980       'discard-nb-ok': 'uint64',
981       'discard-nb-failed': 'uint64',
982       'discard-bytes-ok': 'uint64' } }
985 # @BlockStatsSpecific:
987 # Block driver specific statistics
989 # Since: 4.2
991 { 'union': 'BlockStatsSpecific',
992   'base': { 'driver': 'BlockdevDriver' },
993   'discriminator': 'driver',
994   'data': {
995       'file': 'BlockStatsSpecificFile',
996       'host_device': 'BlockStatsSpecificFile' } }
999 # @BlockStats:
1001 # Statistics of a virtual block device or a block backing device.
1003 # @device: If the stats are for a virtual block device, the name
1004 #          corresponding to the virtual block device.
1006 # @node-name: The node name of the device. (Since 2.3)
1008 # @qdev: The qdev ID, or if no ID is assigned, the QOM path of the block
1009 #        device. (since 3.0)
1011 # @stats:  A @BlockDeviceStats for the device.
1013 # @driver-specific: Optional driver-specific stats. (Since 4.2)
1015 # @parent: This describes the file block device if it has one.
1016 #          Contains recursively the statistics of the underlying
1017 #          protocol (e.g. the host file for a qcow2 image). If there is
1018 #          no underlying protocol, this field is omitted
1020 # @backing: This describes the backing block device if it has one.
1021 #           (Since 2.0)
1023 # Since: 0.14.0
1025 { 'struct': 'BlockStats',
1026   'data': {'*device': 'str', '*qdev': 'str', '*node-name': 'str',
1027            'stats': 'BlockDeviceStats',
1028            '*driver-specific': 'BlockStatsSpecific',
1029            '*parent': 'BlockStats',
1030            '*backing': 'BlockStats'} }
1033 # @query-blockstats:
1035 # Query the @BlockStats for all virtual block devices.
1037 # @query-nodes: If true, the command will query all the block nodes
1038 #               that have a node name, in a list which will include "parent"
1039 #               information, but not "backing".
1040 #               If false or omitted, the behavior is as before - query all the
1041 #               device backends, recursively including their "parent" and
1042 #               "backing". Filter nodes that were created implicitly are
1043 #               skipped over in this mode. (Since 2.3)
1045 # Returns: A list of @BlockStats for each virtual block devices.
1047 # Since: 0.14.0
1049 # Example:
1051 # -> { "execute": "query-blockstats" }
1052 # <- {
1053 #       "return":[
1054 #          {
1055 #             "device":"ide0-hd0",
1056 #             "parent":{
1057 #                "stats":{
1058 #                   "wr_highest_offset":3686448128,
1059 #                   "wr_bytes":9786368,
1060 #                   "wr_operations":751,
1061 #                   "rd_bytes":122567168,
1062 #                   "rd_operations":36772
1063 #                   "wr_total_times_ns":313253456
1064 #                   "rd_total_times_ns":3465673657
1065 #                   "flush_total_times_ns":49653
1066 #                   "flush_operations":61,
1067 #                   "rd_merged":0,
1068 #                   "wr_merged":0,
1069 #                   "idle_time_ns":2953431879,
1070 #                   "account_invalid":true,
1071 #                   "account_failed":false
1072 #                }
1073 #             },
1074 #             "stats":{
1075 #                "wr_highest_offset":2821110784,
1076 #                "wr_bytes":9786368,
1077 #                "wr_operations":692,
1078 #                "rd_bytes":122739200,
1079 #                "rd_operations":36604
1080 #                "flush_operations":51,
1081 #                "wr_total_times_ns":313253456
1082 #                "rd_total_times_ns":3465673657
1083 #                "flush_total_times_ns":49653,
1084 #                "rd_merged":0,
1085 #                "wr_merged":0,
1086 #                "idle_time_ns":2953431879,
1087 #                "account_invalid":true,
1088 #                "account_failed":false
1089 #             },
1090 #             "qdev": "/machine/unattached/device[23]"
1091 #          },
1092 #          {
1093 #             "device":"ide1-cd0",
1094 #             "stats":{
1095 #                "wr_highest_offset":0,
1096 #                "wr_bytes":0,
1097 #                "wr_operations":0,
1098 #                "rd_bytes":0,
1099 #                "rd_operations":0
1100 #                "flush_operations":0,
1101 #                "wr_total_times_ns":0
1102 #                "rd_total_times_ns":0
1103 #                "flush_total_times_ns":0,
1104 #                "rd_merged":0,
1105 #                "wr_merged":0,
1106 #                "account_invalid":false,
1107 #                "account_failed":false
1108 #             },
1109 #             "qdev": "/machine/unattached/device[24]"
1110 #          },
1111 #          {
1112 #             "device":"floppy0",
1113 #             "stats":{
1114 #                "wr_highest_offset":0,
1115 #                "wr_bytes":0,
1116 #                "wr_operations":0,
1117 #                "rd_bytes":0,
1118 #                "rd_operations":0
1119 #                "flush_operations":0,
1120 #                "wr_total_times_ns":0
1121 #                "rd_total_times_ns":0
1122 #                "flush_total_times_ns":0,
1123 #                "rd_merged":0,
1124 #                "wr_merged":0,
1125 #                "account_invalid":false,
1126 #                "account_failed":false
1127 #             },
1128 #             "qdev": "/machine/unattached/device[16]"
1129 #          },
1130 #          {
1131 #             "device":"sd0",
1132 #             "stats":{
1133 #                "wr_highest_offset":0,
1134 #                "wr_bytes":0,
1135 #                "wr_operations":0,
1136 #                "rd_bytes":0,
1137 #                "rd_operations":0
1138 #                "flush_operations":0,
1139 #                "wr_total_times_ns":0
1140 #                "rd_total_times_ns":0
1141 #                "flush_total_times_ns":0,
1142 #                "rd_merged":0,
1143 #                "wr_merged":0,
1144 #                "account_invalid":false,
1145 #                "account_failed":false
1146 #             }
1147 #          }
1148 #       ]
1149 #    }
1152 { 'command': 'query-blockstats',
1153   'data': { '*query-nodes': 'bool' },
1154   'returns': ['BlockStats'] }
1157 # @BlockdevOnError:
1159 # An enumeration of possible behaviors for errors on I/O operations.
1160 # The exact meaning depends on whether the I/O was initiated by a guest
1161 # or by a block job
1163 # @report: for guest operations, report the error to the guest;
1164 #          for jobs, cancel the job
1166 # @ignore: ignore the error, only report a QMP event (BLOCK_IO_ERROR
1167 #          or BLOCK_JOB_ERROR)
1169 # @enospc: same as @stop on ENOSPC, same as @report otherwise.
1171 # @stop: for guest operations, stop the virtual machine;
1172 #        for jobs, pause the job
1174 # @auto: inherit the error handling policy of the backend (since: 2.7)
1176 # Since: 1.3
1178 { 'enum': 'BlockdevOnError',
1179   'data': ['report', 'ignore', 'enospc', 'stop', 'auto'] }
1182 # @MirrorSyncMode:
1184 # An enumeration of possible behaviors for the initial synchronization
1185 # phase of storage mirroring.
1187 # @top: copies data in the topmost image to the destination
1189 # @full: copies data from all images to the destination
1191 # @none: only copy data written from now on
1193 # @incremental: only copy data described by the dirty bitmap. (since: 2.4)
1195 # @bitmap: only copy data described by the dirty bitmap. (since: 4.2)
1196 #          Behavior on completion is determined by the BitmapSyncMode.
1198 # Since: 1.3
1200 { 'enum': 'MirrorSyncMode',
1201   'data': ['top', 'full', 'none', 'incremental', 'bitmap'] }
1204 # @BitmapSyncMode:
1206 # An enumeration of possible behaviors for the synchronization of a bitmap
1207 # when used for data copy operations.
1209 # @on-success: The bitmap is only synced when the operation is successful.
1210 #              This is the behavior always used for 'INCREMENTAL' backups.
1212 # @never: The bitmap is never synchronized with the operation, and is
1213 #         treated solely as a read-only manifest of blocks to copy.
1215 # @always: The bitmap is always synchronized with the operation,
1216 #          regardless of whether or not the operation was successful.
1218 # Since: 4.2
1220 { 'enum': 'BitmapSyncMode',
1221   'data': ['on-success', 'never', 'always'] }
1224 # @MirrorCopyMode:
1226 # An enumeration whose values tell the mirror block job when to
1227 # trigger writes to the target.
1229 # @background: copy data in background only.
1231 # @write-blocking: when data is written to the source, write it
1232 #                  (synchronously) to the target as well.  In
1233 #                  addition, data is copied in background just like in
1234 #                  @background mode.
1236 # Since: 3.0
1238 { 'enum': 'MirrorCopyMode',
1239   'data': ['background', 'write-blocking'] }
1242 # @BlockJobInfo:
1244 # Information about a long-running block device operation.
1246 # @type: the job type ('stream' for image streaming)
1248 # @device: The job identifier. Originally the device name but other
1249 #          values are allowed since QEMU 2.7
1251 # @len: Estimated @offset value at the completion of the job. This value can
1252 #       arbitrarily change while the job is running, in both directions.
1254 # @offset: Progress made until now. The unit is arbitrary and the value can
1255 #          only meaningfully be used for the ratio of @offset to @len. The
1256 #          value is monotonically increasing.
1258 # @busy: false if the job is known to be in a quiescent state, with
1259 #        no pending I/O.  Since 1.3.
1261 # @paused: whether the job is paused or, if @busy is true, will
1262 #          pause itself as soon as possible.  Since 1.3.
1264 # @speed: the rate limit, bytes per second
1266 # @io-status: the status of the job (since 1.3)
1268 # @ready: true if the job may be completed (since 2.2)
1270 # @status: Current job state/status (since 2.12)
1272 # @auto-finalize: Job will finalize itself when PENDING, moving to
1273 #                 the CONCLUDED state. (since 2.12)
1275 # @auto-dismiss: Job will dismiss itself when CONCLUDED, moving to the NULL
1276 #                state and disappearing from the query list. (since 2.12)
1278 # @error: Error information if the job did not complete successfully.
1279 #         Not set if the job completed successfully. (since 2.12.1)
1281 # Since: 1.1
1283 { 'struct': 'BlockJobInfo',
1284   'data': {'type': 'str', 'device': 'str', 'len': 'int',
1285            'offset': 'int', 'busy': 'bool', 'paused': 'bool', 'speed': 'int',
1286            'io-status': 'BlockDeviceIoStatus', 'ready': 'bool',
1287            'status': 'JobStatus',
1288            'auto-finalize': 'bool', 'auto-dismiss': 'bool',
1289            '*error': 'str' } }
1292 # @query-block-jobs:
1294 # Return information about long-running block device operations.
1296 # Returns: a list of @BlockJobInfo for each active block job
1298 # Since: 1.1
1300 { 'command': 'query-block-jobs', 'returns': ['BlockJobInfo'] }
1303 # @block_passwd:
1305 # This command sets the password of a block device that has not been open
1306 # with a password and requires one.
1308 # This command is now obsolete and will always return an error since 2.10
1311 { 'command': 'block_passwd',
1312   'data': { '*device': 'str',
1313             '*node-name': 'str',
1314             'password': 'str' } }
1317 # @block_resize:
1319 # Resize a block image while a guest is running.
1321 # Either @device or @node-name must be set but not both.
1323 # @device: the name of the device to get the image resized
1325 # @node-name: graph node name to get the image resized (Since 2.0)
1327 # @size:  new image size in bytes
1329 # Returns: nothing on success
1330 #          If @device is not a valid block device, DeviceNotFound
1332 # Since: 0.14.0
1334 # Example:
1336 # -> { "execute": "block_resize",
1337 #      "arguments": { "device": "scratch", "size": 1073741824 } }
1338 # <- { "return": {} }
1341 { 'command': 'block_resize',
1342   'data': { '*device': 'str',
1343             '*node-name': 'str',
1344             'size': 'int' } }
1347 # @NewImageMode:
1349 # An enumeration that tells QEMU how to set the backing file path in
1350 # a new image file.
1352 # @existing: QEMU should look for an existing image file.
1354 # @absolute-paths: QEMU should create a new image with absolute paths
1355 # for the backing file. If there is no backing file available, the new
1356 # image will not be backed either.
1358 # Since: 1.1
1360 { 'enum': 'NewImageMode',
1361   'data': [ 'existing', 'absolute-paths' ] }
1364 # @BlockdevSnapshotSync:
1366 # Either @device or @node-name must be set but not both.
1368 # @device: the name of the device to take a snapshot of.
1370 # @node-name: graph node name to generate the snapshot from (Since 2.0)
1372 # @snapshot-file: the target of the new overlay image. If the file
1373 # exists, or if it is a device, the overlay will be created in the
1374 # existing file/device. Otherwise, a new file will be created.
1376 # @snapshot-node-name: the graph node name of the new image (Since 2.0)
1378 # @format: the format of the overlay image, default is 'qcow2'.
1380 # @mode: whether and how QEMU should create a new image, default is
1381 #        'absolute-paths'.
1383 { 'struct': 'BlockdevSnapshotSync',
1384   'data': { '*device': 'str', '*node-name': 'str',
1385             'snapshot-file': 'str', '*snapshot-node-name': 'str',
1386             '*format': 'str', '*mode': 'NewImageMode' } }
1389 # @BlockdevSnapshot:
1391 # @node: device or node name that will have a snapshot taken.
1393 # @overlay: reference to the existing block device that will become
1394 #           the overlay of @node, as part of taking the snapshot.
1395 #           It must not have a current backing file (this can be
1396 #           achieved by passing "backing": null to blockdev-add).
1398 # Since: 2.5
1400 { 'struct': 'BlockdevSnapshot',
1401   'data': { 'node': 'str', 'overlay': 'str' } }
1404 # @BackupCommon:
1406 # @job-id: identifier for the newly-created block job. If
1407 #          omitted, the device name will be used. (Since 2.7)
1409 # @device: the device name or node-name of a root node which should be copied.
1411 # @sync: what parts of the disk image should be copied to the destination
1412 #        (all the disk, only the sectors allocated in the topmost image, from a
1413 #        dirty bitmap, or only new I/O).
1415 # @speed: the maximum speed, in bytes per second. The default is 0,
1416 #         for unlimited.
1418 # @bitmap: The name of a dirty bitmap to use.
1419 #          Must be present if sync is "bitmap" or "incremental".
1420 #          Can be present if sync is "full" or "top".
1421 #          Must not be present otherwise.
1422 #          (Since 2.4 (drive-backup), 3.1 (blockdev-backup))
1424 # @bitmap-mode: Specifies the type of data the bitmap should contain after
1425 #               the operation concludes.
1426 #               Must be present if a bitmap was provided,
1427 #               Must NOT be present otherwise. (Since 4.2)
1429 # @compress: true to compress data, if the target format supports it.
1430 #            (default: false) (since 2.8)
1432 # @on-source-error: the action to take on an error on the source,
1433 #                   default 'report'.  'stop' and 'enospc' can only be used
1434 #                   if the block device supports io-status (see BlockInfo).
1436 # @on-target-error: the action to take on an error on the target,
1437 #                   default 'report' (no limitations, since this applies to
1438 #                   a different block device than @device).
1440 # @auto-finalize: When false, this job will wait in a PENDING state after it has
1441 #                 finished its work, waiting for @block-job-finalize before
1442 #                 making any block graph changes.
1443 #                 When true, this job will automatically
1444 #                 perform its abort or commit actions.
1445 #                 Defaults to true. (Since 2.12)
1447 # @auto-dismiss: When false, this job will wait in a CONCLUDED state after it
1448 #                has completely ceased all work, and awaits @block-job-dismiss.
1449 #                When true, this job will automatically disappear from the query
1450 #                list without user intervention.
1451 #                Defaults to true. (Since 2.12)
1453 # @filter-node-name: the node name that should be assigned to the
1454 #                    filter driver that the backup job inserts into the graph
1455 #                    above node specified by @drive. If this option is not given,
1456 #                    a node name is autogenerated. (Since: 4.2)
1458 # Note: @on-source-error and @on-target-error only affect background
1459 # I/O.  If an error occurs during a guest write request, the device's
1460 # rerror/werror actions will be used.
1462 # Since: 4.2
1464 { 'struct': 'BackupCommon',
1465   'data': { '*job-id': 'str', 'device': 'str',
1466             'sync': 'MirrorSyncMode', '*speed': 'int',
1467             '*bitmap': 'str', '*bitmap-mode': 'BitmapSyncMode',
1468             '*compress': 'bool',
1469             '*on-source-error': 'BlockdevOnError',
1470             '*on-target-error': 'BlockdevOnError',
1471             '*auto-finalize': 'bool', '*auto-dismiss': 'bool',
1472             '*filter-node-name': 'str' } }
1475 # @DriveBackup:
1477 # @target: the target of the new image. If the file exists, or if it
1478 #          is a device, the existing file/device will be used as the new
1479 #          destination.  If it does not exist, a new file will be created.
1481 # @format: the format of the new destination, default is to
1482 #          probe if @mode is 'existing', else the format of the source
1484 # @mode: whether and how QEMU should create a new image, default is
1485 #        'absolute-paths'.
1487 # Since: 1.6
1489 { 'struct': 'DriveBackup',
1490   'base': 'BackupCommon',
1491   'data': { 'target': 'str',
1492             '*format': 'str',
1493             '*mode': 'NewImageMode' } }
1496 # @BlockdevBackup:
1498 # @target: the device name or node-name of the backup target node.
1500 # Since: 2.3
1502 { 'struct': 'BlockdevBackup',
1503   'base': 'BackupCommon',
1504   'data': { 'target': 'str' } }
1507 # @blockdev-snapshot-sync:
1509 # Takes a synchronous snapshot of a block device.
1511 # For the arguments, see the documentation of BlockdevSnapshotSync.
1513 # Returns: nothing on success
1514 #          If @device is not a valid block device, DeviceNotFound
1516 # Since: 0.14.0
1518 # Example:
1520 # -> { "execute": "blockdev-snapshot-sync",
1521 #      "arguments": { "device": "ide-hd0",
1522 #                     "snapshot-file":
1523 #                     "/some/place/my-image",
1524 #                     "format": "qcow2" } }
1525 # <- { "return": {} }
1528 { 'command': 'blockdev-snapshot-sync',
1529   'data': 'BlockdevSnapshotSync' }
1533 # @blockdev-snapshot:
1535 # Takes a snapshot of a block device.
1537 # Take a snapshot, by installing 'node' as the backing image of
1538 # 'overlay'. Additionally, if 'node' is associated with a block
1539 # device, the block device changes to using 'overlay' as its new active
1540 # image.
1542 # For the arguments, see the documentation of BlockdevSnapshot.
1544 # Since: 2.5
1546 # Example:
1548 # -> { "execute": "blockdev-add",
1549 #      "arguments": { "driver": "qcow2",
1550 #                     "node-name": "node1534",
1551 #                     "file": { "driver": "file",
1552 #                               "filename": "hd1.qcow2" },
1553 #                     "backing": null } }
1555 # <- { "return": {} }
1557 # -> { "execute": "blockdev-snapshot",
1558 #      "arguments": { "node": "ide-hd0",
1559 #                     "overlay": "node1534" } }
1560 # <- { "return": {} }
1563 { 'command': 'blockdev-snapshot',
1564   'data': 'BlockdevSnapshot' }
1567 # @change-backing-file:
1569 # Change the backing file in the image file metadata.  This does not
1570 # cause QEMU to reopen the image file to reparse the backing filename
1571 # (it may, however, perform a reopen to change permissions from
1572 # r/o -> r/w -> r/o, if needed). The new backing file string is written
1573 # into the image file metadata, and the QEMU internal strings are
1574 # updated.
1576 # @image-node-name: The name of the block driver state node of the
1577 #                   image to modify. The "device" argument is used
1578 #                   to verify "image-node-name" is in the chain
1579 #                   described by "device".
1581 # @device:          The device name or node-name of the root node that owns
1582 #                   image-node-name.
1584 # @backing-file:    The string to write as the backing file.  This
1585 #                   string is not validated, so care should be taken
1586 #                   when specifying the string or the image chain may
1587 #                   not be able to be reopened again.
1589 # Returns: Nothing on success
1591 #          If "device" does not exist or cannot be determined, DeviceNotFound
1593 # Since: 2.1
1595 { 'command': 'change-backing-file',
1596   'data': { 'device': 'str', 'image-node-name': 'str',
1597             'backing-file': 'str' } }
1600 # @block-commit:
1602 # Live commit of data from overlay image nodes into backing nodes - i.e.,
1603 # writes data between 'top' and 'base' into 'base'.
1605 # @job-id: identifier for the newly-created block job. If
1606 #          omitted, the device name will be used. (Since 2.7)
1608 # @device:  the device name or node-name of a root node
1610 # @base-node: The node name of the backing image to write data into.
1611 #             If not specified, this is the deepest backing image.
1612 #             (since: 3.1)
1614 # @base: Same as @base-node, except that it is a file name rather than a node
1615 #        name. This must be the exact filename string that was used to open the
1616 #        node; other strings, even if addressing the same file, are not
1617 #        accepted (deprecated, use @base-node instead)
1619 # @top-node: The node name of the backing image within the image chain
1620 #            which contains the topmost data to be committed down. If
1621 #            not specified, this is the active layer. (since: 3.1)
1623 # @top: Same as @top-node, except that it is a file name rather than a node
1624 #       name. This must be the exact filename string that was used to open the
1625 #       node; other strings, even if addressing the same file, are not
1626 #       accepted (deprecated, use @base-node instead)
1628 # @backing-file:  The backing file string to write into the overlay
1629 #                           image of 'top'.  If 'top' is the active layer,
1630 #                           specifying a backing file string is an error. This
1631 #                           filename is not validated.
1633 #                           If a pathname string is such that it cannot be
1634 #                           resolved by QEMU, that means that subsequent QMP or
1635 #                           HMP commands must use node-names for the image in
1636 #                           question, as filename lookup methods will fail.
1638 #                           If not specified, QEMU will automatically determine
1639 #                           the backing file string to use, or error out if
1640 #                           there is no obvious choice. Care should be taken
1641 #                           when specifying the string, to specify a valid
1642 #                           filename or protocol.
1643 #                           (Since 2.1)
1645 #                    If top == base, that is an error.
1646 #                    If top == active, the job will not be completed by itself,
1647 #                    user needs to complete the job with the block-job-complete
1648 #                    command after getting the ready event. (Since 2.0)
1650 #                    If the base image is smaller than top, then the base image
1651 #                    will be resized to be the same size as top.  If top is
1652 #                    smaller than the base image, the base will not be
1653 #                    truncated.  If you want the base image size to match the
1654 #                    size of the smaller top, you can safely truncate it
1655 #                    yourself once the commit operation successfully completes.
1657 # @speed:  the maximum speed, in bytes per second
1659 # @filter-node-name: the node name that should be assigned to the
1660 #                    filter driver that the commit job inserts into the graph
1661 #                    above @top. If this option is not given, a node name is
1662 #                    autogenerated. (Since: 2.9)
1664 # @auto-finalize: When false, this job will wait in a PENDING state after it has
1665 #                 finished its work, waiting for @block-job-finalize before
1666 #                 making any block graph changes.
1667 #                 When true, this job will automatically
1668 #                 perform its abort or commit actions.
1669 #                 Defaults to true. (Since 3.1)
1671 # @auto-dismiss: When false, this job will wait in a CONCLUDED state after it
1672 #                has completely ceased all work, and awaits @block-job-dismiss.
1673 #                When true, this job will automatically disappear from the query
1674 #                list without user intervention.
1675 #                Defaults to true. (Since 3.1)
1677 # Returns: Nothing on success
1678 #          If @device does not exist, DeviceNotFound
1679 #          Any other error returns a GenericError.
1681 # Since: 1.3
1683 # Example:
1685 # -> { "execute": "block-commit",
1686 #      "arguments": { "device": "virtio0",
1687 #                     "top": "/tmp/snap1.qcow2" } }
1688 # <- { "return": {} }
1691 { 'command': 'block-commit',
1692   'data': { '*job-id': 'str', 'device': 'str', '*base-node': 'str',
1693             '*base': 'str', '*top-node': 'str', '*top': 'str',
1694             '*backing-file': 'str', '*speed': 'int',
1695             '*filter-node-name': 'str',
1696             '*auto-finalize': 'bool', '*auto-dismiss': 'bool' } }
1699 # @drive-backup:
1701 # Start a point-in-time copy of a block device to a new destination.  The
1702 # status of ongoing drive-backup operations can be checked with
1703 # query-block-jobs where the BlockJobInfo.type field has the value 'backup'.
1704 # The operation can be stopped before it has completed using the
1705 # block-job-cancel command.
1707 # Returns: nothing on success
1708 #          If @device is not a valid block device, GenericError
1710 # Since: 1.6
1712 # Example:
1714 # -> { "execute": "drive-backup",
1715 #      "arguments": { "device": "drive0",
1716 #                     "sync": "full",
1717 #                     "target": "backup.img" } }
1718 # <- { "return": {} }
1721 { 'command': 'drive-backup', 'boxed': true,
1722   'data': 'DriveBackup' }
1725 # @blockdev-backup:
1727 # Start a point-in-time copy of a block device to a new destination.  The
1728 # status of ongoing blockdev-backup operations can be checked with
1729 # query-block-jobs where the BlockJobInfo.type field has the value 'backup'.
1730 # The operation can be stopped before it has completed using the
1731 # block-job-cancel command.
1733 # Returns: nothing on success
1734 #          If @device is not a valid block device, DeviceNotFound
1736 # Since: 2.3
1738 # Example:
1739 # -> { "execute": "blockdev-backup",
1740 #      "arguments": { "device": "src-id",
1741 #                     "sync": "full",
1742 #                     "target": "tgt-id" } }
1743 # <- { "return": {} }
1746 { 'command': 'blockdev-backup', 'boxed': true,
1747   'data': 'BlockdevBackup' }
1751 # @query-named-block-nodes:
1753 # Get the named block driver list
1755 # Returns: the list of BlockDeviceInfo
1757 # Since: 2.0
1759 # Example:
1761 # -> { "execute": "query-named-block-nodes" }
1762 # <- { "return": [ { "ro":false,
1763 #                    "drv":"qcow2",
1764 #                    "encrypted":false,
1765 #                    "file":"disks/test.qcow2",
1766 #                    "node-name": "my-node",
1767 #                    "backing_file_depth":1,
1768 #                    "bps":1000000,
1769 #                    "bps_rd":0,
1770 #                    "bps_wr":0,
1771 #                    "iops":1000000,
1772 #                    "iops_rd":0,
1773 #                    "iops_wr":0,
1774 #                    "bps_max": 8000000,
1775 #                    "bps_rd_max": 0,
1776 #                    "bps_wr_max": 0,
1777 #                    "iops_max": 0,
1778 #                    "iops_rd_max": 0,
1779 #                    "iops_wr_max": 0,
1780 #                    "iops_size": 0,
1781 #                    "write_threshold": 0,
1782 #                    "image":{
1783 #                       "filename":"disks/test.qcow2",
1784 #                       "format":"qcow2",
1785 #                       "virtual-size":2048000,
1786 #                       "backing_file":"base.qcow2",
1787 #                       "full-backing-filename":"disks/base.qcow2",
1788 #                       "backing-filename-format":"qcow2",
1789 #                       "snapshots":[
1790 #                          {
1791 #                             "id": "1",
1792 #                             "name": "snapshot1",
1793 #                             "vm-state-size": 0,
1794 #                             "date-sec": 10000200,
1795 #                             "date-nsec": 12,
1796 #                             "vm-clock-sec": 206,
1797 #                             "vm-clock-nsec": 30
1798 #                          }
1799 #                       ],
1800 #                       "backing-image":{
1801 #                           "filename":"disks/base.qcow2",
1802 #                           "format":"qcow2",
1803 #                           "virtual-size":2048000
1804 #                       }
1805 #                    } } ] }
1808 { 'command': 'query-named-block-nodes', 'returns': [ 'BlockDeviceInfo' ] }
1811 # @XDbgBlockGraphNodeType:
1813 # @block-backend: corresponds to BlockBackend
1815 # @block-job: corresonds to BlockJob
1817 # @block-driver: corresponds to BlockDriverState
1819 # Since: 4.0
1821 { 'enum': 'XDbgBlockGraphNodeType',
1822   'data': [ 'block-backend', 'block-job', 'block-driver' ] }
1825 # @XDbgBlockGraphNode:
1827 # @id: Block graph node identifier. This @id is generated only for
1828 #      x-debug-query-block-graph and does not relate to any other identifiers in
1829 #      Qemu.
1831 # @type: Type of graph node. Can be one of block-backend, block-job or
1832 #        block-driver-state.
1834 # @name: Human readable name of the node. Corresponds to node-name for
1835 #        block-driver-state nodes; is not guaranteed to be unique in the whole
1836 #        graph (with block-jobs and block-backends).
1838 # Since: 4.0
1840 { 'struct': 'XDbgBlockGraphNode',
1841   'data': { 'id': 'uint64', 'type': 'XDbgBlockGraphNodeType', 'name': 'str' } }
1844 # @BlockPermission:
1846 # Enum of base block permissions.
1848 # @consistent-read: A user that has the "permission" of consistent reads is
1849 #                   guaranteed that their view of the contents of the block
1850 #                   device is complete and self-consistent, representing the
1851 #                   contents of a disk at a specific point.
1852 #                   For most block devices (including their backing files) this
1853 #                   is true, but the property cannot be maintained in a few
1854 #                   situations like for intermediate nodes of a commit block
1855 #                   job.
1857 # @write: This permission is required to change the visible disk contents.
1859 # @write-unchanged: This permission (which is weaker than BLK_PERM_WRITE) is
1860 #                   both enough and required for writes to the block node when
1861 #                   the caller promises that the visible disk content doesn't
1862 #                   change.
1863 #                   As the BLK_PERM_WRITE permission is strictly stronger,
1864 #                   either is sufficient to perform an unchanging write.
1866 # @resize: This permission is required to change the size of a block node.
1868 # @graph-mod: This permission is required to change the node that this
1869 #             BdrvChild points to.
1871 # Since: 4.0
1873   { 'enum': 'BlockPermission',
1874     'data': [ 'consistent-read', 'write', 'write-unchanged', 'resize',
1875               'graph-mod' ] }
1877 # @XDbgBlockGraphEdge:
1879 # Block Graph edge description for x-debug-query-block-graph.
1881 # @parent: parent id
1883 # @child: child id
1885 # @name: name of the relation (examples are 'file' and 'backing')
1887 # @perm: granted permissions for the parent operating on the child
1889 # @shared-perm: permissions that can still be granted to other users of the
1890 #               child while it is still attached to this parent
1892 # Since: 4.0
1894 { 'struct': 'XDbgBlockGraphEdge',
1895   'data': { 'parent': 'uint64', 'child': 'uint64',
1896             'name': 'str', 'perm': [ 'BlockPermission' ],
1897             'shared-perm': [ 'BlockPermission' ] } }
1900 # @XDbgBlockGraph:
1902 # Block Graph - list of nodes and list of edges.
1904 # Since: 4.0
1906 { 'struct': 'XDbgBlockGraph',
1907   'data': { 'nodes': ['XDbgBlockGraphNode'], 'edges': ['XDbgBlockGraphEdge'] } }
1910 # @x-debug-query-block-graph:
1912 # Get the block graph.
1914 # Since: 4.0
1916 { 'command': 'x-debug-query-block-graph', 'returns': 'XDbgBlockGraph' }
1919 # @drive-mirror:
1921 # Start mirroring a block device's writes to a new destination. target
1922 # specifies the target of the new image. If the file exists, or if it
1923 # is a device, it will be used as the new destination for writes. If
1924 # it does not exist, a new file will be created. format specifies the
1925 # format of the mirror image, default is to probe if mode='existing',
1926 # else the format of the source.
1928 # Returns: nothing on success
1929 #          If @device is not a valid block device, GenericError
1931 # Since: 1.3
1933 # Example:
1935 # -> { "execute": "drive-mirror",
1936 #      "arguments": { "device": "ide-hd0",
1937 #                     "target": "/some/place/my-image",
1938 #                     "sync": "full",
1939 #                     "format": "qcow2" } }
1940 # <- { "return": {} }
1943 { 'command': 'drive-mirror', 'boxed': true,
1944   'data': 'DriveMirror' }
1947 # @DriveMirror:
1949 # A set of parameters describing drive mirror setup.
1951 # @job-id: identifier for the newly-created block job. If
1952 #          omitted, the device name will be used. (Since 2.7)
1954 # @device:  the device name or node-name of a root node whose writes should be
1955 #           mirrored.
1957 # @target: the target of the new image. If the file exists, or if it
1958 #          is a device, the existing file/device will be used as the new
1959 #          destination.  If it does not exist, a new file will be created.
1961 # @format: the format of the new destination, default is to
1962 #          probe if @mode is 'existing', else the format of the source
1964 # @node-name: the new block driver state node name in the graph
1965 #             (Since 2.1)
1967 # @replaces: with sync=full graph node name to be replaced by the new
1968 #            image when a whole image copy is done. This can be used to repair
1969 #            broken Quorum files. (Since 2.1)
1971 # @mode: whether and how QEMU should create a new image, default is
1972 #        'absolute-paths'.
1974 # @speed:  the maximum speed, in bytes per second
1976 # @sync: what parts of the disk image should be copied to the destination
1977 #        (all the disk, only the sectors allocated in the topmost image, or
1978 #        only new I/O).
1980 # @granularity: granularity of the dirty bitmap, default is 64K
1981 #               if the image format doesn't have clusters, 4K if the clusters
1982 #               are smaller than that, else the cluster size.  Must be a
1983 #               power of 2 between 512 and 64M (since 1.4).
1985 # @buf-size: maximum amount of data in flight from source to
1986 #            target (since 1.4).
1988 # @on-source-error: the action to take on an error on the source,
1989 #                   default 'report'.  'stop' and 'enospc' can only be used
1990 #                   if the block device supports io-status (see BlockInfo).
1992 # @on-target-error: the action to take on an error on the target,
1993 #                   default 'report' (no limitations, since this applies to
1994 #                   a different block device than @device).
1995 # @unmap: Whether to try to unmap target sectors where source has
1996 #         only zero. If true, and target unallocated sectors will read as zero,
1997 #         target image sectors will be unmapped; otherwise, zeroes will be
1998 #         written. Both will result in identical contents.
1999 #         Default is true. (Since 2.4)
2001 # @copy-mode: when to copy data to the destination; defaults to 'background'
2002 #             (Since: 3.0)
2004 # @auto-finalize: When false, this job will wait in a PENDING state after it has
2005 #                 finished its work, waiting for @block-job-finalize before
2006 #                 making any block graph changes.
2007 #                 When true, this job will automatically
2008 #                 perform its abort or commit actions.
2009 #                 Defaults to true. (Since 3.1)
2011 # @auto-dismiss: When false, this job will wait in a CONCLUDED state after it
2012 #                has completely ceased all work, and awaits @block-job-dismiss.
2013 #                When true, this job will automatically disappear from the query
2014 #                list without user intervention.
2015 #                Defaults to true. (Since 3.1)
2016 # Since: 1.3
2018 { 'struct': 'DriveMirror',
2019   'data': { '*job-id': 'str', 'device': 'str', 'target': 'str',
2020             '*format': 'str', '*node-name': 'str', '*replaces': 'str',
2021             'sync': 'MirrorSyncMode', '*mode': 'NewImageMode',
2022             '*speed': 'int', '*granularity': 'uint32',
2023             '*buf-size': 'int', '*on-source-error': 'BlockdevOnError',
2024             '*on-target-error': 'BlockdevOnError',
2025             '*unmap': 'bool', '*copy-mode': 'MirrorCopyMode',
2026             '*auto-finalize': 'bool', '*auto-dismiss': 'bool' } }
2029 # @BlockDirtyBitmap:
2031 # @node: name of device/node which the bitmap is tracking
2033 # @name: name of the dirty bitmap
2035 # Since: 2.4
2037 { 'struct': 'BlockDirtyBitmap',
2038   'data': { 'node': 'str', 'name': 'str' } }
2041 # @BlockDirtyBitmapAdd:
2043 # @node: name of device/node which the bitmap is tracking
2045 # @name: name of the dirty bitmap
2047 # @granularity: the bitmap granularity, default is 64k for
2048 #               block-dirty-bitmap-add
2050 # @persistent: the bitmap is persistent, i.e. it will be saved to the
2051 #              corresponding block device image file on its close. For now only
2052 #              Qcow2 disks support persistent bitmaps. Default is false for
2053 #              block-dirty-bitmap-add. (Since: 2.10)
2055 # @disabled: the bitmap is created in the disabled state, which means that
2056 #            it will not track drive changes. The bitmap may be enabled with
2057 #            block-dirty-bitmap-enable. Default is false. (Since: 4.0)
2059 # Since: 2.4
2061 { 'struct': 'BlockDirtyBitmapAdd',
2062   'data': { 'node': 'str', 'name': 'str', '*granularity': 'uint32',
2063             '*persistent': 'bool', '*disabled': 'bool' } }
2066 # @BlockDirtyBitmapMergeSource:
2068 # @local: name of the bitmap, attached to the same node as target bitmap.
2070 # @external: bitmap with specified node
2072 # Since: 4.1
2074 { 'alternate': 'BlockDirtyBitmapMergeSource',
2075   'data': { 'local': 'str',
2076             'external': 'BlockDirtyBitmap' } }
2079 # @BlockDirtyBitmapMerge:
2081 # @node: name of device/node which the @target bitmap is tracking
2083 # @target: name of the destination dirty bitmap
2085 # @bitmaps: name(s) of the source dirty bitmap(s) at @node and/or fully
2086 #           specifed BlockDirtyBitmap elements. The latter are supported
2087 #           since 4.1.
2089 # Since: 4.0
2091 { 'struct': 'BlockDirtyBitmapMerge',
2092   'data': { 'node': 'str', 'target': 'str',
2093             'bitmaps': ['BlockDirtyBitmapMergeSource'] } }
2096 # @block-dirty-bitmap-add:
2098 # Create a dirty bitmap with a name on the node, and start tracking the writes.
2100 # Returns: nothing on success
2101 #          If @node is not a valid block device or node, DeviceNotFound
2102 #          If @name is already taken, GenericError with an explanation
2104 # Since: 2.4
2106 # Example:
2108 # -> { "execute": "block-dirty-bitmap-add",
2109 #      "arguments": { "node": "drive0", "name": "bitmap0" } }
2110 # <- { "return": {} }
2113 { 'command': 'block-dirty-bitmap-add',
2114   'data': 'BlockDirtyBitmapAdd' }
2117 # @block-dirty-bitmap-remove:
2119 # Stop write tracking and remove the dirty bitmap that was created
2120 # with block-dirty-bitmap-add. If the bitmap is persistent, remove it from its
2121 # storage too.
2123 # Returns: nothing on success
2124 #          If @node is not a valid block device or node, DeviceNotFound
2125 #          If @name is not found, GenericError with an explanation
2126 #          if @name is frozen by an operation, GenericError
2128 # Since: 2.4
2130 # Example:
2132 # -> { "execute": "block-dirty-bitmap-remove",
2133 #      "arguments": { "node": "drive0", "name": "bitmap0" } }
2134 # <- { "return": {} }
2137 { 'command': 'block-dirty-bitmap-remove',
2138   'data': 'BlockDirtyBitmap' }
2141 # @block-dirty-bitmap-clear:
2143 # Clear (reset) a dirty bitmap on the device, so that an incremental
2144 # backup from this point in time forward will only backup clusters
2145 # modified after this clear operation.
2147 # Returns: nothing on success
2148 #          If @node is not a valid block device, DeviceNotFound
2149 #          If @name is not found, GenericError with an explanation
2151 # Since: 2.4
2153 # Example:
2155 # -> { "execute": "block-dirty-bitmap-clear",
2156 #      "arguments": { "node": "drive0", "name": "bitmap0" } }
2157 # <- { "return": {} }
2160 { 'command': 'block-dirty-bitmap-clear',
2161   'data': 'BlockDirtyBitmap' }
2164 # @block-dirty-bitmap-enable:
2166 # Enables a dirty bitmap so that it will begin tracking disk changes.
2168 # Returns: nothing on success
2169 #          If @node is not a valid block device, DeviceNotFound
2170 #          If @name is not found, GenericError with an explanation
2172 # Since: 4.0
2174 # Example:
2176 # -> { "execute": "block-dirty-bitmap-enable",
2177 #      "arguments": { "node": "drive0", "name": "bitmap0" } }
2178 # <- { "return": {} }
2181   { 'command': 'block-dirty-bitmap-enable',
2182     'data': 'BlockDirtyBitmap' }
2185 # @block-dirty-bitmap-disable:
2187 # Disables a dirty bitmap so that it will stop tracking disk changes.
2189 # Returns: nothing on success
2190 #          If @node is not a valid block device, DeviceNotFound
2191 #          If @name is not found, GenericError with an explanation
2193 # Since: 4.0
2195 # Example:
2197 # -> { "execute": "block-dirty-bitmap-disable",
2198 #      "arguments": { "node": "drive0", "name": "bitmap0" } }
2199 # <- { "return": {} }
2202     { 'command': 'block-dirty-bitmap-disable',
2203       'data': 'BlockDirtyBitmap' }
2206 # @block-dirty-bitmap-merge:
2208 # Merge dirty bitmaps listed in @bitmaps to the @target dirty bitmap.
2209 # Dirty bitmaps in @bitmaps will be unchanged, except if it also appears
2210 # as the @target bitmap. Any bits already set in @target will still be
2211 # set after the merge, i.e., this operation does not clear the target.
2212 # On error, @target is unchanged.
2214 # The resulting bitmap will count as dirty any clusters that were dirty in any
2215 # of the source bitmaps. This can be used to achieve backup checkpoints, or in
2216 # simpler usages, to copy bitmaps.
2218 # Returns: nothing on success
2219 #          If @node is not a valid block device, DeviceNotFound
2220 #          If any bitmap in @bitmaps or @target is not found, GenericError
2221 #          If any of the bitmaps have different sizes or granularities,
2222 #              GenericError
2224 # Since: 4.0
2226 # Example:
2228 # -> { "execute": "block-dirty-bitmap-merge",
2229 #      "arguments": { "node": "drive0", "target": "bitmap0",
2230 #                     "bitmaps": ["bitmap1"] } }
2231 # <- { "return": {} }
2234       { 'command': 'block-dirty-bitmap-merge',
2235         'data': 'BlockDirtyBitmapMerge' }
2238 # @BlockDirtyBitmapSha256:
2240 # SHA256 hash of dirty bitmap data
2242 # @sha256: ASCII representation of SHA256 bitmap hash
2244 # Since: 2.10
2246   { 'struct': 'BlockDirtyBitmapSha256',
2247     'data': {'sha256': 'str'} }
2250 # @x-debug-block-dirty-bitmap-sha256:
2252 # Get bitmap SHA256.
2254 # Returns: BlockDirtyBitmapSha256 on success
2255 #          If @node is not a valid block device, DeviceNotFound
2256 #          If @name is not found or if hashing has failed, GenericError with an
2257 #          explanation
2259 # Since: 2.10
2261   { 'command': 'x-debug-block-dirty-bitmap-sha256',
2262     'data': 'BlockDirtyBitmap', 'returns': 'BlockDirtyBitmapSha256' }
2265 # @blockdev-mirror:
2267 # Start mirroring a block device's writes to a new destination.
2269 # @job-id: identifier for the newly-created block job. If
2270 #          omitted, the device name will be used. (Since 2.7)
2272 # @device: The device name or node-name of a root node whose writes should be
2273 #          mirrored.
2275 # @target: the id or node-name of the block device to mirror to. This mustn't be
2276 #          attached to guest.
2278 # @replaces: with sync=full graph node name to be replaced by the new
2279 #            image when a whole image copy is done. This can be used to repair
2280 #            broken Quorum files.
2282 # @speed:  the maximum speed, in bytes per second
2284 # @sync: what parts of the disk image should be copied to the destination
2285 #        (all the disk, only the sectors allocated in the topmost image, or
2286 #        only new I/O).
2288 # @granularity: granularity of the dirty bitmap, default is 64K
2289 #               if the image format doesn't have clusters, 4K if the clusters
2290 #               are smaller than that, else the cluster size.  Must be a
2291 #               power of 2 between 512 and 64M
2293 # @buf-size: maximum amount of data in flight from source to
2294 #            target
2296 # @on-source-error: the action to take on an error on the source,
2297 #                   default 'report'.  'stop' and 'enospc' can only be used
2298 #                   if the block device supports io-status (see BlockInfo).
2300 # @on-target-error: the action to take on an error on the target,
2301 #                   default 'report' (no limitations, since this applies to
2302 #                   a different block device than @device).
2304 # @filter-node-name: the node name that should be assigned to the
2305 #                    filter driver that the mirror job inserts into the graph
2306 #                    above @device. If this option is not given, a node name is
2307 #                    autogenerated. (Since: 2.9)
2309 # @copy-mode: when to copy data to the destination; defaults to 'background'
2310 #             (Since: 3.0)
2312 # @auto-finalize: When false, this job will wait in a PENDING state after it has
2313 #                 finished its work, waiting for @block-job-finalize before
2314 #                 making any block graph changes.
2315 #                 When true, this job will automatically
2316 #                 perform its abort or commit actions.
2317 #                 Defaults to true. (Since 3.1)
2319 # @auto-dismiss: When false, this job will wait in a CONCLUDED state after it
2320 #                has completely ceased all work, and awaits @block-job-dismiss.
2321 #                When true, this job will automatically disappear from the query
2322 #                list without user intervention.
2323 #                Defaults to true. (Since 3.1)
2324 # Returns: nothing on success.
2326 # Since: 2.6
2328 # Example:
2330 # -> { "execute": "blockdev-mirror",
2331 #      "arguments": { "device": "ide-hd0",
2332 #                     "target": "target0",
2333 #                     "sync": "full" } }
2334 # <- { "return": {} }
2337 { 'command': 'blockdev-mirror',
2338   'data': { '*job-id': 'str', 'device': 'str', 'target': 'str',
2339             '*replaces': 'str',
2340             'sync': 'MirrorSyncMode',
2341             '*speed': 'int', '*granularity': 'uint32',
2342             '*buf-size': 'int', '*on-source-error': 'BlockdevOnError',
2343             '*on-target-error': 'BlockdevOnError',
2344             '*filter-node-name': 'str',
2345             '*copy-mode': 'MirrorCopyMode',
2346             '*auto-finalize': 'bool', '*auto-dismiss': 'bool' } }
2349 # @block_set_io_throttle:
2351 # Change I/O throttle limits for a block drive.
2353 # Since QEMU 2.4, each device with I/O limits is member of a throttle
2354 # group.
2356 # If two or more devices are members of the same group, the limits
2357 # will apply to the combined I/O of the whole group in a round-robin
2358 # fashion. Therefore, setting new I/O limits to a device will affect
2359 # the whole group.
2361 # The name of the group can be specified using the 'group' parameter.
2362 # If the parameter is unset, it is assumed to be the current group of
2363 # that device. If it's not in any group yet, the name of the device
2364 # will be used as the name for its group.
2366 # The 'group' parameter can also be used to move a device to a
2367 # different group. In this case the limits specified in the parameters
2368 # will be applied to the new group only.
2370 # I/O limits can be disabled by setting all of them to 0. In this case
2371 # the device will be removed from its group and the rest of its
2372 # members will not be affected. The 'group' parameter is ignored.
2374 # Returns: Nothing on success
2375 #          If @device is not a valid block device, DeviceNotFound
2377 # Since: 1.1
2379 # Example:
2381 # -> { "execute": "block_set_io_throttle",
2382 #      "arguments": { "id": "virtio-blk-pci0/virtio-backend",
2383 #                     "bps": 0,
2384 #                     "bps_rd": 0,
2385 #                     "bps_wr": 0,
2386 #                     "iops": 512,
2387 #                     "iops_rd": 0,
2388 #                     "iops_wr": 0,
2389 #                     "bps_max": 0,
2390 #                     "bps_rd_max": 0,
2391 #                     "bps_wr_max": 0,
2392 #                     "iops_max": 0,
2393 #                     "iops_rd_max": 0,
2394 #                     "iops_wr_max": 0,
2395 #                     "bps_max_length": 0,
2396 #                     "iops_size": 0 } }
2397 # <- { "return": {} }
2399 # -> { "execute": "block_set_io_throttle",
2400 #      "arguments": { "id": "ide0-1-0",
2401 #                     "bps": 1000000,
2402 #                     "bps_rd": 0,
2403 #                     "bps_wr": 0,
2404 #                     "iops": 0,
2405 #                     "iops_rd": 0,
2406 #                     "iops_wr": 0,
2407 #                     "bps_max": 8000000,
2408 #                     "bps_rd_max": 0,
2409 #                     "bps_wr_max": 0,
2410 #                     "iops_max": 0,
2411 #                     "iops_rd_max": 0,
2412 #                     "iops_wr_max": 0,
2413 #                     "bps_max_length": 60,
2414 #                     "iops_size": 0 } }
2415 # <- { "return": {} }
2417 { 'command': 'block_set_io_throttle', 'boxed': true,
2418   'data': 'BlockIOThrottle' }
2421 # @BlockIOThrottle:
2423 # A set of parameters describing block throttling.
2425 # @device: Block device name (deprecated, use @id instead)
2427 # @id: The name or QOM path of the guest device (since: 2.8)
2429 # @bps: total throughput limit in bytes per second
2431 # @bps_rd: read throughput limit in bytes per second
2433 # @bps_wr: write throughput limit in bytes per second
2435 # @iops: total I/O operations per second
2437 # @iops_rd: read I/O operations per second
2439 # @iops_wr: write I/O operations per second
2441 # @bps_max: total throughput limit during bursts,
2442 #                     in bytes (Since 1.7)
2444 # @bps_rd_max: read throughput limit during bursts,
2445 #                        in bytes (Since 1.7)
2447 # @bps_wr_max: write throughput limit during bursts,
2448 #                        in bytes (Since 1.7)
2450 # @iops_max: total I/O operations per second during bursts,
2451 #                      in bytes (Since 1.7)
2453 # @iops_rd_max: read I/O operations per second during bursts,
2454 #                         in bytes (Since 1.7)
2456 # @iops_wr_max: write I/O operations per second during bursts,
2457 #                         in bytes (Since 1.7)
2459 # @bps_max_length: maximum length of the @bps_max burst
2460 #                            period, in seconds. It must only
2461 #                            be set if @bps_max is set as well.
2462 #                            Defaults to 1. (Since 2.6)
2464 # @bps_rd_max_length: maximum length of the @bps_rd_max
2465 #                               burst period, in seconds. It must only
2466 #                               be set if @bps_rd_max is set as well.
2467 #                               Defaults to 1. (Since 2.6)
2469 # @bps_wr_max_length: maximum length of the @bps_wr_max
2470 #                               burst period, in seconds. It must only
2471 #                               be set if @bps_wr_max is set as well.
2472 #                               Defaults to 1. (Since 2.6)
2474 # @iops_max_length: maximum length of the @iops burst
2475 #                             period, in seconds. It must only
2476 #                             be set if @iops_max is set as well.
2477 #                             Defaults to 1. (Since 2.6)
2479 # @iops_rd_max_length: maximum length of the @iops_rd_max
2480 #                                burst period, in seconds. It must only
2481 #                                be set if @iops_rd_max is set as well.
2482 #                                Defaults to 1. (Since 2.6)
2484 # @iops_wr_max_length: maximum length of the @iops_wr_max
2485 #                                burst period, in seconds. It must only
2486 #                                be set if @iops_wr_max is set as well.
2487 #                                Defaults to 1. (Since 2.6)
2489 # @iops_size: an I/O size in bytes (Since 1.7)
2491 # @group: throttle group name (Since 2.4)
2493 # Since: 1.1
2495 { 'struct': 'BlockIOThrottle',
2496   'data': { '*device': 'str', '*id': 'str', 'bps': 'int', 'bps_rd': 'int',
2497             'bps_wr': 'int', 'iops': 'int', 'iops_rd': 'int', 'iops_wr': 'int',
2498             '*bps_max': 'int', '*bps_rd_max': 'int',
2499             '*bps_wr_max': 'int', '*iops_max': 'int',
2500             '*iops_rd_max': 'int', '*iops_wr_max': 'int',
2501             '*bps_max_length': 'int', '*bps_rd_max_length': 'int',
2502             '*bps_wr_max_length': 'int', '*iops_max_length': 'int',
2503             '*iops_rd_max_length': 'int', '*iops_wr_max_length': 'int',
2504             '*iops_size': 'int', '*group': 'str' } }
2507 # @ThrottleLimits:
2509 # Limit parameters for throttling.
2510 # Since some limit combinations are illegal, limits should always be set in one
2511 # transaction. All fields are optional. When setting limits, if a field is
2512 # missing the current value is not changed.
2514 # @iops-total:             limit total I/O operations per second
2515 # @iops-total-max:         I/O operations burst
2516 # @iops-total-max-length:  length of the iops-total-max burst period, in seconds
2517 #                          It must only be set if @iops-total-max is set as well.
2518 # @iops-read:              limit read operations per second
2519 # @iops-read-max:          I/O operations read burst
2520 # @iops-read-max-length:   length of the iops-read-max burst period, in seconds
2521 #                          It must only be set if @iops-read-max is set as well.
2522 # @iops-write:             limit write operations per second
2523 # @iops-write-max:         I/O operations write burst
2524 # @iops-write-max-length:  length of the iops-write-max burst period, in seconds
2525 #                          It must only be set if @iops-write-max is set as well.
2526 # @bps-total:              limit total bytes per second
2527 # @bps-total-max:          total bytes burst
2528 # @bps-total-max-length:   length of the bps-total-max burst period, in seconds.
2529 #                          It must only be set if @bps-total-max is set as well.
2530 # @bps-read:               limit read bytes per second
2531 # @bps-read-max:           total bytes read burst
2532 # @bps-read-max-length:    length of the bps-read-max burst period, in seconds
2533 #                          It must only be set if @bps-read-max is set as well.
2534 # @bps-write:              limit write bytes per second
2535 # @bps-write-max:          total bytes write burst
2536 # @bps-write-max-length:   length of the bps-write-max burst period, in seconds
2537 #                          It must only be set if @bps-write-max is set as well.
2538 # @iops-size:              when limiting by iops max size of an I/O in bytes
2540 # Since: 2.11
2542 { 'struct': 'ThrottleLimits',
2543   'data': { '*iops-total' : 'int', '*iops-total-max' : 'int',
2544             '*iops-total-max-length' : 'int', '*iops-read' : 'int',
2545             '*iops-read-max' : 'int', '*iops-read-max-length' : 'int',
2546             '*iops-write' : 'int', '*iops-write-max' : 'int',
2547             '*iops-write-max-length' : 'int', '*bps-total' : 'int',
2548             '*bps-total-max' : 'int', '*bps-total-max-length' : 'int',
2549             '*bps-read' : 'int', '*bps-read-max' : 'int',
2550             '*bps-read-max-length' : 'int', '*bps-write' : 'int',
2551             '*bps-write-max' : 'int', '*bps-write-max-length' : 'int',
2552             '*iops-size' : 'int' } }
2555 # @block-stream:
2557 # Copy data from a backing file into a block device.
2559 # The block streaming operation is performed in the background until the entire
2560 # backing file has been copied.  This command returns immediately once streaming
2561 # has started.  The status of ongoing block streaming operations can be checked
2562 # with query-block-jobs.  The operation can be stopped before it has completed
2563 # using the block-job-cancel command.
2565 # The node that receives the data is called the top image, can be located in
2566 # any part of the chain (but always above the base image; see below) and can be
2567 # specified using its device or node name. Earlier qemu versions only allowed
2568 # 'device' to name the top level node; presence of the 'base-node' parameter
2569 # during introspection can be used as a witness of the enhanced semantics
2570 # of 'device'.
2572 # If a base file is specified then sectors are not copied from that base file and
2573 # its backing chain.  When streaming completes the image file will have the base
2574 # file as its backing file.  This can be used to stream a subset of the backing
2575 # file chain instead of flattening the entire image.
2577 # On successful completion the image file is updated to drop the backing file
2578 # and the BLOCK_JOB_COMPLETED event is emitted.
2580 # @job-id: identifier for the newly-created block job. If
2581 #          omitted, the device name will be used. (Since 2.7)
2583 # @device: the device or node name of the top image
2585 # @base:   the common backing file name.
2586 #                    It cannot be set if @base-node is also set.
2588 # @base-node: the node name of the backing file.
2589 #                       It cannot be set if @base is also set. (Since 2.8)
2591 # @backing-file: The backing file string to write into the top
2592 #                          image. This filename is not validated.
2594 #                          If a pathname string is such that it cannot be
2595 #                          resolved by QEMU, that means that subsequent QMP or
2596 #                          HMP commands must use node-names for the image in
2597 #                          question, as filename lookup methods will fail.
2599 #                          If not specified, QEMU will automatically determine
2600 #                          the backing file string to use, or error out if there
2601 #                          is no obvious choice.  Care should be taken when
2602 #                          specifying the string, to specify a valid filename or
2603 #                          protocol.
2604 #                          (Since 2.1)
2606 # @speed:  the maximum speed, in bytes per second
2608 # @on-error: the action to take on an error (default report).
2609 #            'stop' and 'enospc' can only be used if the block device
2610 #            supports io-status (see BlockInfo).  Since 1.3.
2612 # @auto-finalize: When false, this job will wait in a PENDING state after it has
2613 #                 finished its work, waiting for @block-job-finalize before
2614 #                 making any block graph changes.
2615 #                 When true, this job will automatically
2616 #                 perform its abort or commit actions.
2617 #                 Defaults to true. (Since 3.1)
2619 # @auto-dismiss: When false, this job will wait in a CONCLUDED state after it
2620 #                has completely ceased all work, and awaits @block-job-dismiss.
2621 #                When true, this job will automatically disappear from the query
2622 #                list without user intervention.
2623 #                Defaults to true. (Since 3.1)
2625 # Returns: Nothing on success. If @device does not exist, DeviceNotFound.
2627 # Since: 1.1
2629 # Example:
2631 # -> { "execute": "block-stream",
2632 #      "arguments": { "device": "virtio0",
2633 #                     "base": "/tmp/master.qcow2" } }
2634 # <- { "return": {} }
2637 { 'command': 'block-stream',
2638   'data': { '*job-id': 'str', 'device': 'str', '*base': 'str',
2639             '*base-node': 'str', '*backing-file': 'str', '*speed': 'int',
2640             '*on-error': 'BlockdevOnError',
2641             '*auto-finalize': 'bool', '*auto-dismiss': 'bool' } }
2644 # @block-job-set-speed:
2646 # Set maximum speed for a background block operation.
2648 # This command can only be issued when there is an active block job.
2650 # Throttling can be disabled by setting the speed to 0.
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 # @speed:  the maximum speed, in bytes per second, or 0 for unlimited.
2657 #          Defaults to 0.
2659 # Returns: Nothing on success
2660 #          If no background operation is active on this device, DeviceNotActive
2662 # Since: 1.1
2664 { 'command': 'block-job-set-speed',
2665   'data': { 'device': 'str', 'speed': 'int' } }
2668 # @block-job-cancel:
2670 # Stop an active background block operation.
2672 # This command returns immediately after marking the active background block
2673 # operation for cancellation.  It is an error to call this command if no
2674 # operation is in progress.
2676 # The operation will cancel as soon as possible and then emit the
2677 # BLOCK_JOB_CANCELLED event.  Before that happens the job is still visible when
2678 # enumerated using query-block-jobs.
2680 # Note that if you issue 'block-job-cancel' after 'drive-mirror' has indicated
2681 # (via the event BLOCK_JOB_READY) that the source and destination are
2682 # synchronized, then the event triggered by this command changes to
2683 # BLOCK_JOB_COMPLETED, to indicate that the mirroring has ended and the
2684 # destination now has a point-in-time copy tied to the time of the cancellation.
2686 # For streaming, the image file retains its backing file unless the streaming
2687 # operation happens to complete just as it is being cancelled.  A new streaming
2688 # operation can be started at a later time to finish copying all data from the
2689 # backing file.
2691 # @device: The job identifier. This used to be a device name (hence
2692 #          the name of the parameter), but since QEMU 2.7 it can have
2693 #          other values.
2695 # @force: If true, and the job has already emitted the event BLOCK_JOB_READY,
2696 #         abandon the job immediately (even if it is paused) instead of waiting
2697 #         for the destination to complete its final synchronization (since 1.3)
2699 # Returns: Nothing on success
2700 #          If no background operation is active on this device, DeviceNotActive
2702 # Since: 1.1
2704 { 'command': 'block-job-cancel', 'data': { 'device': 'str', '*force': 'bool' } }
2707 # @block-job-pause:
2709 # Pause an active background block operation.
2711 # This command returns immediately after marking the active background block
2712 # operation for pausing.  It is an error to call this command if no
2713 # operation is in progress or if the job is already paused.
2715 # The operation will pause as soon as possible.  No event is emitted when
2716 # the operation is actually paused.  Cancelling a paused job automatically
2717 # resumes it.
2719 # @device: The job identifier. This used to be a device name (hence
2720 #          the name of the parameter), but since QEMU 2.7 it can have
2721 #          other values.
2723 # Returns: Nothing on success
2724 #          If no background operation is active on this device, DeviceNotActive
2726 # Since: 1.3
2728 { 'command': 'block-job-pause', 'data': { 'device': 'str' } }
2731 # @block-job-resume:
2733 # Resume an active background block operation.
2735 # This command returns immediately after resuming a paused background block
2736 # operation.  It is an error to call this command if no operation is in
2737 # progress or if the job is not paused.
2739 # This command also clears the error status of the job.
2741 # @device: The job identifier. This used to be a device name (hence
2742 #          the name of the parameter), but since QEMU 2.7 it can have
2743 #          other values.
2745 # Returns: Nothing on success
2746 #          If no background operation is active on this device, DeviceNotActive
2748 # Since: 1.3
2750 { 'command': 'block-job-resume', 'data': { 'device': 'str' } }
2753 # @block-job-complete:
2755 # Manually trigger completion of an active background block operation.  This
2756 # is supported for drive mirroring, where it also switches the device to
2757 # write to the target path only.  The ability to complete is signaled with
2758 # a BLOCK_JOB_READY event.
2760 # This command completes an active background block operation synchronously.
2761 # The ordering of this command's return with the BLOCK_JOB_COMPLETED event
2762 # is not defined.  Note that if an I/O error occurs during the processing of
2763 # this command: 1) the command itself will fail; 2) the error will be processed
2764 # according to the rerror/werror arguments that were specified when starting
2765 # the operation.
2767 # A cancelled or paused job cannot be completed.
2769 # @device: The job identifier. This used to be a device name (hence
2770 #          the name of the parameter), but since QEMU 2.7 it can have
2771 #          other values.
2773 # Returns: Nothing on success
2774 #          If no background operation is active on this device, DeviceNotActive
2776 # Since: 1.3
2778 { 'command': 'block-job-complete', 'data': { 'device': 'str' } }
2781 # @block-job-dismiss:
2783 # For jobs that have already concluded, remove them from the block-job-query
2784 # list. This command only needs to be run for jobs which were started with
2785 # QEMU 2.12+ job lifetime management semantics.
2787 # This command will refuse to operate on any job that has not yet reached
2788 # its terminal state, JOB_STATUS_CONCLUDED. For jobs that make use of the
2789 # BLOCK_JOB_READY event, block-job-cancel or block-job-complete will still need
2790 # to be used as appropriate.
2792 # @id: The job identifier.
2794 # Returns: Nothing on success
2796 # Since: 2.12
2798 { 'command': 'block-job-dismiss', 'data': { 'id': 'str' } }
2801 # @block-job-finalize:
2803 # Once a job that has manual=true reaches the pending state, it can be
2804 # instructed to finalize any graph changes and do any necessary cleanup
2805 # via this command.
2806 # For jobs in a transaction, instructing one job to finalize will force
2807 # ALL jobs in the transaction to finalize, so it is only necessary to instruct
2808 # a single member job to finalize.
2810 # @id: The job identifier.
2812 # Returns: Nothing on success
2814 # Since: 2.12
2816 { 'command': 'block-job-finalize', 'data': { 'id': 'str' } }
2819 # @BlockdevDiscardOptions:
2821 # Determines how to handle discard requests.
2823 # @ignore:      Ignore the request
2824 # @unmap:       Forward as an unmap request
2826 # Since: 2.9
2828 { 'enum': 'BlockdevDiscardOptions',
2829   'data': [ 'ignore', 'unmap' ] }
2832 # @BlockdevDetectZeroesOptions:
2834 # Describes the operation mode for the automatic conversion of plain
2835 # zero writes by the OS to driver specific optimized zero write commands.
2837 # @off:      Disabled (default)
2838 # @on:       Enabled
2839 # @unmap:    Enabled and even try to unmap blocks if possible. This requires
2840 #            also that @BlockdevDiscardOptions is set to unmap for this device.
2842 # Since: 2.1
2844 { 'enum': 'BlockdevDetectZeroesOptions',
2845   'data': [ 'off', 'on', 'unmap' ] }
2848 # @BlockdevAioOptions:
2850 # Selects the AIO backend to handle I/O requests
2852 # @threads:     Use qemu's thread pool
2853 # @native:      Use native AIO backend (only Linux and Windows)
2855 # Since: 2.9
2857 { 'enum': 'BlockdevAioOptions',
2858   'data': [ 'threads', 'native' ] }
2861 # @BlockdevCacheOptions:
2863 # Includes cache-related options for block devices
2865 # @direct:      enables use of O_DIRECT (bypass the host page cache;
2866 #               default: false)
2867 # @no-flush:    ignore any flush requests for the device (default:
2868 #               false)
2870 # Since: 2.9
2872 { 'struct': 'BlockdevCacheOptions',
2873   'data': { '*direct': 'bool',
2874             '*no-flush': 'bool' } }
2877 # @BlockdevDriver:
2879 # Drivers that are supported in block device operations.
2881 # @vxhs: Since 2.10
2882 # @throttle: Since 2.11
2883 # @nvme: Since 2.12
2884 # @copy-on-read: Since 3.0
2885 # @blklogwrites: Since 3.0
2887 # Since: 2.9
2889 { 'enum': 'BlockdevDriver',
2890   'data': [ 'blkdebug', 'blklogwrites', 'blkverify', 'bochs', 'cloop',
2891             'copy-on-read', 'dmg', 'file', 'ftp', 'ftps', 'gluster',
2892             'host_cdrom', 'host_device', 'http', 'https', 'iscsi', 'luks',
2893             'nbd', 'nfs', 'null-aio', 'null-co', 'nvme', 'parallels', 'qcow',
2894             'qcow2', 'qed', 'quorum', 'raw', 'rbd',
2895             { 'name': 'replication', 'if': 'defined(CONFIG_REPLICATION)' },
2896             'sheepdog',
2897             'ssh', 'throttle', 'vdi', 'vhdx', 'vmdk', 'vpc', 'vvfat', 'vxhs' ] }
2900 # @BlockdevOptionsFile:
2902 # Driver specific block device options for the file backend.
2904 # @filename:    path to the image file
2905 # @pr-manager:  the id for the object that will handle persistent reservations
2906 #               for this device (default: none, forward the commands via SG_IO;
2907 #               since 2.11)
2908 # @aio:         AIO backend (default: threads) (since: 2.8)
2909 # @locking:     whether to enable file locking. If set to 'auto', only enable
2910 #               when Open File Descriptor (OFD) locking API is available
2911 #               (default: auto, since 2.10)
2912 # @drop-cache:  invalidate page cache during live migration.  This prevents
2913 #               stale data on the migration destination with cache.direct=off.
2914 #               Currently only supported on Linux hosts.
2915 #               (default: on, since: 4.0)
2916 # @x-check-cache-dropped: whether to check that page cache was dropped on live
2917 #                         migration.  May cause noticeable delays if the image
2918 #                         file is large, do not use in production.
2919 #                         (default: off) (since: 3.0)
2921 # Features:
2922 # @dynamic-auto-read-only: If present, enabled auto-read-only means that the
2923 #                          driver will open the image read-only at first,
2924 #                          dynamically reopen the image file read-write when
2925 #                          the first writer is attached to the node and reopen
2926 #                          read-only when the last writer is detached. This
2927 #                          allows giving QEMU write permissions only on demand
2928 #                          when an operation actually needs write access.
2930 # Since: 2.9
2932 { 'struct': 'BlockdevOptionsFile',
2933   'data': { 'filename': 'str',
2934             '*pr-manager': 'str',
2935             '*locking': 'OnOffAuto',
2936             '*aio': 'BlockdevAioOptions',
2937             '*drop-cache': {'type': 'bool',
2938                             'if': 'defined(CONFIG_LINUX)'},
2939             '*x-check-cache-dropped': 'bool' },
2940   'features': [ { 'name': 'dynamic-auto-read-only',
2941                   'if': 'defined(CONFIG_POSIX)' } ] }
2944 # @BlockdevOptionsNull:
2946 # Driver specific block device options for the null backend.
2948 # @size:    size of the device in bytes.
2949 # @latency-ns: emulated latency (in nanoseconds) in processing
2950 #              requests. Default to zero which completes requests immediately.
2951 #              (Since 2.4)
2952 # @read-zeroes: if true, reads from the device produce zeroes; if false, the
2953 #               buffer is left unchanged. (default: false; since: 4.1)
2955 # Since: 2.9
2957 { 'struct': 'BlockdevOptionsNull',
2958   'data': { '*size': 'int', '*latency-ns': 'uint64', '*read-zeroes': 'bool' } }
2961 # @BlockdevOptionsNVMe:
2963 # Driver specific block device options for the NVMe backend.
2965 # @device:    controller address of the NVMe device.
2966 # @namespace: namespace number of the device, starting from 1.
2968 # Since: 2.12
2970 { 'struct': 'BlockdevOptionsNVMe',
2971   'data': { 'device': 'str', 'namespace': 'int' } }
2974 # @BlockdevOptionsVVFAT:
2976 # Driver specific block device options for the vvfat protocol.
2978 # @dir:         directory to be exported as FAT image
2979 # @fat-type:    FAT type: 12, 16 or 32
2980 # @floppy:      whether to export a floppy image (true) or
2981 #               partitioned hard disk (false; default)
2982 # @label:       set the volume label, limited to 11 bytes. FAT16 and
2983 #               FAT32 traditionally have some restrictions on labels, which are
2984 #               ignored by most operating systems. Defaults to "QEMU VVFAT".
2985 #               (since 2.4)
2986 # @rw:          whether to allow write operations (default: false)
2988 # Since: 2.9
2990 { 'struct': 'BlockdevOptionsVVFAT',
2991   'data': { 'dir': 'str', '*fat-type': 'int', '*floppy': 'bool',
2992             '*label': 'str', '*rw': 'bool' } }
2995 # @BlockdevOptionsGenericFormat:
2997 # Driver specific block device options for image format that have no option
2998 # besides their data source.
3000 # @file:        reference to or definition of the data source block device
3002 # Since: 2.9
3004 { 'struct': 'BlockdevOptionsGenericFormat',
3005   'data': { 'file': 'BlockdevRef' } }
3008 # @BlockdevOptionsLUKS:
3010 # Driver specific block device options for LUKS.
3012 # @key-secret: the ID of a QCryptoSecret object providing
3013 #              the decryption key (since 2.6). Mandatory except when
3014 #              doing a metadata-only probe of the image.
3016 # Since: 2.9
3018 { 'struct': 'BlockdevOptionsLUKS',
3019   'base': 'BlockdevOptionsGenericFormat',
3020   'data': { '*key-secret': 'str' } }
3024 # @BlockdevOptionsGenericCOWFormat:
3026 # Driver specific block device options for image format that have no option
3027 # besides their data source and an optional backing file.
3029 # @backing:     reference to or definition of the backing file block
3030 #               device, null disables the backing file entirely.
3031 #               Defaults to the backing file stored the image file.
3033 # Since: 2.9
3035 { 'struct': 'BlockdevOptionsGenericCOWFormat',
3036   'base': 'BlockdevOptionsGenericFormat',
3037   'data': { '*backing': 'BlockdevRefOrNull' } }
3040 # @Qcow2OverlapCheckMode:
3042 # General overlap check modes.
3044 # @none:        Do not perform any checks
3046 # @constant:    Perform only checks which can be done in constant time and
3047 #               without reading anything from disk
3049 # @cached:      Perform only checks which can be done without reading anything
3050 #               from disk
3052 # @all:         Perform all available overlap checks
3054 # Since: 2.9
3056 { 'enum': 'Qcow2OverlapCheckMode',
3057   'data': [ 'none', 'constant', 'cached', 'all' ] }
3060 # @Qcow2OverlapCheckFlags:
3062 # Structure of flags for each metadata structure. Setting a field to 'true'
3063 # makes qemu guard that structure against unintended overwriting. The default
3064 # value is chosen according to the template given.
3066 # @template: Specifies a template mode which can be adjusted using the other
3067 #            flags, defaults to 'cached'
3069 # @bitmap-directory: since 3.0
3071 # Since: 2.9
3073 { 'struct': 'Qcow2OverlapCheckFlags',
3074   'data': { '*template':         'Qcow2OverlapCheckMode',
3075             '*main-header':      'bool',
3076             '*active-l1':        'bool',
3077             '*active-l2':        'bool',
3078             '*refcount-table':   'bool',
3079             '*refcount-block':   'bool',
3080             '*snapshot-table':   'bool',
3081             '*inactive-l1':      'bool',
3082             '*inactive-l2':      'bool',
3083             '*bitmap-directory': 'bool' } }
3086 # @Qcow2OverlapChecks:
3088 # Specifies which metadata structures should be guarded against unintended
3089 # overwriting.
3091 # @flags:   set of flags for separate specification of each metadata structure
3092 #           type
3094 # @mode:    named mode which chooses a specific set of flags
3096 # Since: 2.9
3098 { 'alternate': 'Qcow2OverlapChecks',
3099   'data': { 'flags': 'Qcow2OverlapCheckFlags',
3100             'mode':  'Qcow2OverlapCheckMode' } }
3103 # @BlockdevQcowEncryptionFormat:
3105 # @aes: AES-CBC with plain64 initialization vectors
3107 # Since: 2.10
3109 { 'enum': 'BlockdevQcowEncryptionFormat',
3110   'data': [ 'aes' ] }
3113 # @BlockdevQcowEncryption:
3115 # Since: 2.10
3117 { 'union': 'BlockdevQcowEncryption',
3118   'base': { 'format': 'BlockdevQcowEncryptionFormat' },
3119   'discriminator': 'format',
3120   'data': { 'aes': 'QCryptoBlockOptionsQCow' } }
3123 # @BlockdevOptionsQcow:
3125 # Driver specific block device options for qcow.
3127 # @encrypt:               Image decryption options. Mandatory for
3128 #                         encrypted images, except when doing a metadata-only
3129 #                         probe of the image.
3131 # Since: 2.10
3133 { 'struct': 'BlockdevOptionsQcow',
3134   'base': 'BlockdevOptionsGenericCOWFormat',
3135   'data': { '*encrypt': 'BlockdevQcowEncryption' } }
3140 # @BlockdevQcow2EncryptionFormat:
3141 # @aes: AES-CBC with plain64 initialization vectors
3143 # Since: 2.10
3145 { 'enum': 'BlockdevQcow2EncryptionFormat',
3146   'data': [ 'aes', 'luks' ] }
3149 # @BlockdevQcow2Encryption:
3151 # Since: 2.10
3153 { 'union': 'BlockdevQcow2Encryption',
3154   'base': { 'format': 'BlockdevQcow2EncryptionFormat' },
3155   'discriminator': 'format',
3156   'data': { 'aes': 'QCryptoBlockOptionsQCow',
3157             'luks': 'QCryptoBlockOptionsLUKS'} }
3160 # @BlockdevOptionsQcow2:
3162 # Driver specific block device options for qcow2.
3164 # @lazy-refcounts:        whether to enable the lazy refcounts
3165 #                         feature (default is taken from the image file)
3167 # @pass-discard-request:  whether discard requests to the qcow2
3168 #                         device should be forwarded to the data source
3170 # @pass-discard-snapshot: whether discard requests for the data source
3171 #                         should be issued when a snapshot operation (e.g.
3172 #                         deleting a snapshot) frees clusters in the qcow2 file
3174 # @pass-discard-other:    whether discard requests for the data source
3175 #                         should be issued on other occasions where a cluster
3176 #                         gets freed
3178 # @overlap-check:         which overlap checks to perform for writes
3179 #                         to the image, defaults to 'cached' (since 2.2)
3181 # @cache-size:            the maximum total size of the L2 table and
3182 #                         refcount block caches in bytes (since 2.2)
3184 # @l2-cache-size:         the maximum size of the L2 table cache in
3185 #                         bytes (since 2.2)
3187 # @l2-cache-entry-size:   the size of each entry in the L2 cache in
3188 #                         bytes. It must be a power of two between 512
3189 #                         and the cluster size. The default value is
3190 #                         the cluster size (since 2.12)
3192 # @refcount-cache-size:   the maximum size of the refcount block cache
3193 #                         in bytes (since 2.2)
3195 # @cache-clean-interval:  clean unused entries in the L2 and refcount
3196 #                         caches. The interval is in seconds. The default value
3197 #                         is 600 on supporting platforms, and 0 on other
3198 #                         platforms. 0 disables this feature. (since 2.5)
3200 # @encrypt:               Image decryption options. Mandatory for
3201 #                         encrypted images, except when doing a metadata-only
3202 #                         probe of the image. (since 2.10)
3204 # @data-file:             reference to or definition of the external data file.
3205 #                         This may only be specified for images that require an
3206 #                         external data file. If it is not specified for such
3207 #                         an image, the data file name is loaded from the image
3208 #                         file. (since 4.0)
3210 # Since: 2.9
3212 { 'struct': 'BlockdevOptionsQcow2',
3213   'base': 'BlockdevOptionsGenericCOWFormat',
3214   'data': { '*lazy-refcounts': 'bool',
3215             '*pass-discard-request': 'bool',
3216             '*pass-discard-snapshot': 'bool',
3217             '*pass-discard-other': 'bool',
3218             '*overlap-check': 'Qcow2OverlapChecks',
3219             '*cache-size': 'int',
3220             '*l2-cache-size': 'int',
3221             '*l2-cache-entry-size': 'int',
3222             '*refcount-cache-size': 'int',
3223             '*cache-clean-interval': 'int',
3224             '*encrypt': 'BlockdevQcow2Encryption',
3225             '*data-file': 'BlockdevRef' } }
3228 # @SshHostKeyCheckMode:
3230 # @none             Don't check the host key at all
3231 # @hash             Compare the host key with a given hash
3232 # @known_hosts      Check the host key against the known_hosts file
3234 # Since: 2.12
3236 { 'enum': 'SshHostKeyCheckMode',
3237   'data': [ 'none', 'hash', 'known_hosts' ] }
3240 # @SshHostKeyCheckHashType:
3242 # @md5              The given hash is an md5 hash
3243 # @sha1             The given hash is an sha1 hash
3245 # Since: 2.12
3247 { 'enum': 'SshHostKeyCheckHashType',
3248   'data': [ 'md5', 'sha1' ] }
3251 # @SshHostKeyHash:
3253 # @type             The hash algorithm used for the hash
3254 # @hash             The expected hash value
3256 # Since: 2.12
3258 { 'struct': 'SshHostKeyHash',
3259   'data': { 'type': 'SshHostKeyCheckHashType',
3260             'hash': 'str' }}
3263 # @SshHostKeyCheck:
3265 # Since: 2.12
3267 { 'union': 'SshHostKeyCheck',
3268   'base': { 'mode': 'SshHostKeyCheckMode' },
3269   'discriminator': 'mode',
3270   'data': { 'hash': 'SshHostKeyHash' } }
3273 # @BlockdevOptionsSsh:
3275 # @server:              host address
3277 # @path:                path to the image on the host
3279 # @user:                user as which to connect, defaults to current
3280 #                       local user name
3282 # @host-key-check:      Defines how and what to check the host key against
3283 #                       (default: known_hosts)
3285 # Since: 2.9
3287 { 'struct': 'BlockdevOptionsSsh',
3288   'data': { 'server': 'InetSocketAddress',
3289             'path': 'str',
3290             '*user': 'str',
3291             '*host-key-check': 'SshHostKeyCheck' } }
3295 # @BlkdebugEvent:
3297 # Trigger events supported by blkdebug.
3299 # @l1_shrink_write_table:      write zeros to the l1 table to shrink image.
3300 #                              (since 2.11)
3302 # @l1_shrink_free_l2_clusters: discard the l2 tables. (since 2.11)
3304 # @cor_write: a write due to copy-on-read (since 2.11)
3306 # @cluster_alloc_space: an allocation of file space for a cluster (since 4.1)
3308 # @none: triggers once at creation of the blkdebug node (since 4.1)
3310 # Since: 2.9
3312 { 'enum': 'BlkdebugEvent', 'prefix': 'BLKDBG',
3313   'data': [ 'l1_update', 'l1_grow_alloc_table', 'l1_grow_write_table',
3314             'l1_grow_activate_table', 'l2_load', 'l2_update',
3315             'l2_update_compressed', 'l2_alloc_cow_read', 'l2_alloc_write',
3316             'read_aio', 'read_backing_aio', 'read_compressed', 'write_aio',
3317             'write_compressed', 'vmstate_load', 'vmstate_save', 'cow_read',
3318             'cow_write', 'reftable_load', 'reftable_grow', 'reftable_update',
3319             'refblock_load', 'refblock_update', 'refblock_update_part',
3320             'refblock_alloc', 'refblock_alloc_hookup', 'refblock_alloc_write',
3321             'refblock_alloc_write_blocks', 'refblock_alloc_write_table',
3322             'refblock_alloc_switch_table', 'cluster_alloc',
3323             'cluster_alloc_bytes', 'cluster_free', 'flush_to_os',
3324             'flush_to_disk', 'pwritev_rmw_head', 'pwritev_rmw_after_head',
3325             'pwritev_rmw_tail', 'pwritev_rmw_after_tail', 'pwritev',
3326             'pwritev_zero', 'pwritev_done', 'empty_image_prepare',
3327             'l1_shrink_write_table', 'l1_shrink_free_l2_clusters',
3328             'cor_write', 'cluster_alloc_space', 'none'] }
3331 # @BlkdebugIOType:
3333 # Kinds of I/O that blkdebug can inject errors in.
3335 # @read: .bdrv_co_preadv()
3337 # @write: .bdrv_co_pwritev()
3339 # @write-zeroes: .bdrv_co_pwrite_zeroes()
3341 # @discard: .bdrv_co_pdiscard()
3343 # @flush: .bdrv_co_flush_to_disk()
3345 # @block-status: .bdrv_co_block_status()
3347 # Since: 4.1
3349 { 'enum': 'BlkdebugIOType', 'prefix': 'BLKDEBUG_IO_TYPE',
3350   'data': [ 'read', 'write', 'write-zeroes', 'discard', 'flush',
3351             'block-status' ] }
3354 # @BlkdebugInjectErrorOptions:
3356 # Describes a single error injection for blkdebug.
3358 # @event:       trigger event
3360 # @state:       the state identifier blkdebug needs to be in to
3361 #               actually trigger the event; defaults to "any"
3363 # @iotype:      the type of I/O operations on which this error should
3364 #               be injected; defaults to "all read, write,
3365 #               write-zeroes, discard, and flush operations"
3366 #               (since: 4.1)
3368 # @errno:       error identifier (errno) to be returned; defaults to
3369 #               EIO
3371 # @sector:      specifies the sector index which has to be affected
3372 #               in order to actually trigger the event; defaults to "any
3373 #               sector"
3375 # @once:        disables further events after this one has been
3376 #               triggered; defaults to false
3378 # @immediately: fail immediately; defaults to false
3380 # Since: 2.9
3382 { 'struct': 'BlkdebugInjectErrorOptions',
3383   'data': { 'event': 'BlkdebugEvent',
3384             '*state': 'int',
3385             '*iotype': 'BlkdebugIOType',
3386             '*errno': 'int',
3387             '*sector': 'int',
3388             '*once': 'bool',
3389             '*immediately': 'bool' } }
3392 # @BlkdebugSetStateOptions:
3394 # Describes a single state-change event for blkdebug.
3396 # @event:       trigger event
3398 # @state:       the current state identifier blkdebug needs to be in;
3399 #               defaults to "any"
3401 # @new_state:   the state identifier blkdebug is supposed to assume if
3402 #               this event is triggered
3404 # Since: 2.9
3406 { 'struct': 'BlkdebugSetStateOptions',
3407   'data': { 'event': 'BlkdebugEvent',
3408             '*state': 'int',
3409             'new_state': 'int' } }
3412 # @BlockdevOptionsBlkdebug:
3414 # Driver specific block device options for blkdebug.
3416 # @image:           underlying raw block device (or image file)
3418 # @config:          filename of the configuration file
3420 # @align:           required alignment for requests in bytes, must be
3421 #                   positive power of 2, or 0 for default
3423 # @max-transfer:    maximum size for I/O transfers in bytes, must be
3424 #                   positive multiple of @align and of the underlying
3425 #                   file's request alignment (but need not be a power of
3426 #                   2), or 0 for default (since 2.10)
3428 # @opt-write-zero:  preferred alignment for write zero requests in bytes,
3429 #                   must be positive multiple of @align and of the
3430 #                   underlying file's request alignment (but need not be a
3431 #                   power of 2), or 0 for default (since 2.10)
3433 # @max-write-zero:  maximum size for write zero requests in bytes, must be
3434 #                   positive multiple of @align, of @opt-write-zero, and of
3435 #                   the underlying file's request alignment (but need not
3436 #                   be a power of 2), or 0 for default (since 2.10)
3438 # @opt-discard:     preferred alignment for discard requests in bytes, must
3439 #                   be positive multiple of @align and of the underlying
3440 #                   file's request alignment (but need not be a power of
3441 #                   2), or 0 for default (since 2.10)
3443 # @max-discard:     maximum size for discard requests in bytes, must be
3444 #                   positive multiple of @align, of @opt-discard, and of
3445 #                   the underlying file's request alignment (but need not
3446 #                   be a power of 2), or 0 for default (since 2.10)
3448 # @inject-error:    array of error injection descriptions
3450 # @set-state:       array of state-change descriptions
3452 # Since: 2.9
3454 { 'struct': 'BlockdevOptionsBlkdebug',
3455   'data': { 'image': 'BlockdevRef',
3456             '*config': 'str',
3457             '*align': 'int', '*max-transfer': 'int32',
3458             '*opt-write-zero': 'int32', '*max-write-zero': 'int32',
3459             '*opt-discard': 'int32', '*max-discard': 'int32',
3460             '*inject-error': ['BlkdebugInjectErrorOptions'],
3461             '*set-state': ['BlkdebugSetStateOptions'] } }
3464 # @BlockdevOptionsBlklogwrites:
3466 # Driver specific block device options for blklogwrites.
3468 # @file:            block device
3470 # @log:             block device used to log writes to @file
3472 # @log-sector-size: sector size used in logging writes to @file, determines
3473 #                   granularity of offsets and sizes of writes (default: 512)
3475 # @log-append:      append to an existing log (default: false)
3477 # @log-super-update-interval: interval of write requests after which the log
3478 #                             super block is updated to disk (default: 4096)
3480 # Since: 3.0
3482 { 'struct': 'BlockdevOptionsBlklogwrites',
3483   'data': { 'file': 'BlockdevRef',
3484             'log': 'BlockdevRef',
3485             '*log-sector-size': 'uint32',
3486             '*log-append': 'bool',
3487             '*log-super-update-interval': 'uint64' } }
3490 # @BlockdevOptionsBlkverify:
3492 # Driver specific block device options for blkverify.
3494 # @test:    block device to be tested
3496 # @raw:     raw image used for verification
3498 # Since: 2.9
3500 { 'struct': 'BlockdevOptionsBlkverify',
3501   'data': { 'test': 'BlockdevRef',
3502             'raw': 'BlockdevRef' } }
3505 # @QuorumReadPattern:
3507 # An enumeration of quorum read patterns.
3509 # @quorum: read all the children and do a quorum vote on reads
3511 # @fifo: read only from the first child that has not failed
3513 # Since: 2.9
3515 { 'enum': 'QuorumReadPattern', 'data': [ 'quorum', 'fifo' ] }
3518 # @BlockdevOptionsQuorum:
3520 # Driver specific block device options for Quorum
3522 # @blkverify:      true if the driver must print content mismatch
3523 #                  set to false by default
3525 # @children:       the children block devices to use
3527 # @vote-threshold: the vote limit under which a read will fail
3529 # @rewrite-corrupted: rewrite corrupted data when quorum is reached
3530 #                     (Since 2.1)
3532 # @read-pattern: choose read pattern and set to quorum by default
3533 #                (Since 2.2)
3535 # Since: 2.9
3537 { 'struct': 'BlockdevOptionsQuorum',
3538   'data': { '*blkverify': 'bool',
3539             'children': [ 'BlockdevRef' ],
3540             'vote-threshold': 'int',
3541             '*rewrite-corrupted': 'bool',
3542             '*read-pattern': 'QuorumReadPattern' } }
3545 # @BlockdevOptionsGluster:
3547 # Driver specific block device options for Gluster
3549 # @volume:      name of gluster volume where VM image resides
3551 # @path:        absolute path to image file in gluster volume
3553 # @server:      gluster servers description
3555 # @debug:       libgfapi log level (default '4' which is Error)
3556 #               (Since 2.8)
3558 # @logfile:     libgfapi log file (default /dev/stderr) (Since 2.8)
3560 # Since: 2.9
3562 { 'struct': 'BlockdevOptionsGluster',
3563   'data': { 'volume': 'str',
3564             'path': 'str',
3565             'server': ['SocketAddress'],
3566             '*debug': 'int',
3567             '*logfile': 'str' } }
3570 # @IscsiTransport:
3572 # An enumeration of libiscsi transport types
3574 # Since: 2.9
3576 { 'enum': 'IscsiTransport',
3577   'data': [ 'tcp', 'iser' ] }
3580 # @IscsiHeaderDigest:
3582 # An enumeration of header digests supported by libiscsi
3584 # Since: 2.9
3586 { 'enum': 'IscsiHeaderDigest',
3587   'prefix': 'QAPI_ISCSI_HEADER_DIGEST',
3588   'data': [ 'crc32c', 'none', 'crc32c-none', 'none-crc32c' ] }
3591 # @BlockdevOptionsIscsi:
3593 # @transport:       The iscsi transport type
3595 # @portal:          The address of the iscsi portal
3597 # @target:          The target iqn name
3599 # @lun:             LUN to connect to. Defaults to 0.
3601 # @user:            User name to log in with. If omitted, no CHAP
3602 #                   authentication is performed.
3604 # @password-secret: The ID of a QCryptoSecret object providing
3605 #                   the password for the login. This option is required if
3606 #                   @user is specified.
3608 # @initiator-name:  The iqn name we want to identify to the target
3609 #                   as. If this option is not specified, an initiator name is
3610 #                   generated automatically.
3612 # @header-digest:   The desired header digest. Defaults to
3613 #                   none-crc32c.
3615 # @timeout:         Timeout in seconds after which a request will
3616 #                   timeout. 0 means no timeout and is the default.
3618 # Driver specific block device options for iscsi
3620 # Since: 2.9
3622 { 'struct': 'BlockdevOptionsIscsi',
3623   'data': { 'transport': 'IscsiTransport',
3624             'portal': 'str',
3625             'target': 'str',
3626             '*lun': 'int',
3627             '*user': 'str',
3628             '*password-secret': 'str',
3629             '*initiator-name': 'str',
3630             '*header-digest': 'IscsiHeaderDigest',
3631             '*timeout': 'int' } }
3635 # @RbdAuthMode:
3637 # Since: 3.0
3639 { 'enum': 'RbdAuthMode',
3640   'data': [ 'cephx', 'none' ] }
3643 # @BlockdevOptionsRbd:
3645 # @pool:               Ceph pool name.
3647 # @image:              Image name in the Ceph pool.
3649 # @conf:               path to Ceph configuration file.  Values
3650 #                      in the configuration file will be overridden by
3651 #                      options specified via QAPI.
3653 # @snapshot:           Ceph snapshot name.
3655 # @user:               Ceph id name.
3657 # @auth-client-required: Acceptable authentication modes.
3658 #                      This maps to Ceph configuration option
3659 #                      "auth_client_required".  (Since 3.0)
3661 # @key-secret:         ID of a QCryptoSecret object providing a key
3662 #                      for cephx authentication.
3663 #                      This maps to Ceph configuration option
3664 #                      "key".  (Since 3.0)
3666 # @server:             Monitor host address and port.  This maps
3667 #                      to the "mon_host" Ceph option.
3669 # Since: 2.9
3671 { 'struct': 'BlockdevOptionsRbd',
3672   'data': { 'pool': 'str',
3673             'image': 'str',
3674             '*conf': 'str',
3675             '*snapshot': 'str',
3676             '*user': 'str',
3677             '*auth-client-required': ['RbdAuthMode'],
3678             '*key-secret': 'str',
3679             '*server': ['InetSocketAddressBase'] } }
3682 # @BlockdevOptionsSheepdog:
3684 # Driver specific block device options for sheepdog
3686 # @vdi:         Virtual disk image name
3687 # @server:      The Sheepdog server to connect to
3688 # @snap-id:     Snapshot ID
3689 # @tag:         Snapshot tag name
3691 # Only one of @snap-id and @tag may be present.
3693 # Since: 2.9
3695 { 'struct': 'BlockdevOptionsSheepdog',
3696   'data': { 'server': 'SocketAddress',
3697             'vdi': 'str',
3698             '*snap-id': 'uint32',
3699             '*tag': 'str' } }
3702 # @ReplicationMode:
3704 # An enumeration of replication modes.
3706 # @primary: Primary mode, the vm's state will be sent to secondary QEMU.
3708 # @secondary: Secondary mode, receive the vm's state from primary QEMU.
3710 # Since: 2.9
3712 { 'enum' : 'ReplicationMode', 'data' : [ 'primary', 'secondary' ],
3713   'if': 'defined(CONFIG_REPLICATION)' }
3716 # @BlockdevOptionsReplication:
3718 # Driver specific block device options for replication
3720 # @mode: the replication mode
3722 # @top-id: In secondary mode, node name or device ID of the root
3723 #          node who owns the replication node chain. Must not be given in
3724 #          primary mode.
3726 # Since: 2.9
3728 { 'struct': 'BlockdevOptionsReplication',
3729   'base': 'BlockdevOptionsGenericFormat',
3730   'data': { 'mode': 'ReplicationMode',
3731             '*top-id': 'str' },
3732   'if': 'defined(CONFIG_REPLICATION)' }
3735 # @NFSTransport:
3737 # An enumeration of NFS transport types
3739 # @inet:        TCP transport
3741 # Since: 2.9
3743 { 'enum': 'NFSTransport',
3744   'data': [ 'inet' ] }
3747 # @NFSServer:
3749 # Captures the address of the socket
3751 # @type:        transport type used for NFS (only TCP supported)
3753 # @host:        host address for NFS server
3755 # Since: 2.9
3757 { 'struct': 'NFSServer',
3758   'data': { 'type': 'NFSTransport',
3759             'host': 'str' } }
3762 # @BlockdevOptionsNfs:
3764 # Driver specific block device option for NFS
3766 # @server:                  host address
3768 # @path:                    path of the image on the host
3770 # @user:                    UID value to use when talking to the
3771 #                           server (defaults to 65534 on Windows and getuid()
3772 #                           on unix)
3774 # @group:                   GID value to use when talking to the
3775 #                           server (defaults to 65534 on Windows and getgid()
3776 #                           in unix)
3778 # @tcp-syn-count:           number of SYNs during the session
3779 #                           establishment (defaults to libnfs default)
3781 # @readahead-size:          set the readahead size in bytes (defaults
3782 #                           to libnfs default)
3784 # @page-cache-size:         set the pagecache size in bytes (defaults
3785 #                           to libnfs default)
3787 # @debug:                   set the NFS debug level (max 2) (defaults
3788 #                           to libnfs default)
3790 # Since: 2.9
3792 { 'struct': 'BlockdevOptionsNfs',
3793   'data': { 'server': 'NFSServer',
3794             'path': 'str',
3795             '*user': 'int',
3796             '*group': 'int',
3797             '*tcp-syn-count': 'int',
3798             '*readahead-size': 'int',
3799             '*page-cache-size': 'int',
3800             '*debug': 'int' } }
3803 # @BlockdevOptionsCurlBase:
3805 # Driver specific block device options shared by all protocols supported by the
3806 # curl backend.
3808 # @url:                     URL of the image file
3810 # @readahead:               Size of the read-ahead cache; must be a multiple of
3811 #                           512 (defaults to 256 kB)
3813 # @timeout:                 Timeout for connections, in seconds (defaults to 5)
3815 # @username:                Username for authentication (defaults to none)
3817 # @password-secret:         ID of a QCryptoSecret object providing a password
3818 #                           for authentication (defaults to no password)
3820 # @proxy-username:          Username for proxy authentication (defaults to none)
3822 # @proxy-password-secret:   ID of a QCryptoSecret object providing a password
3823 #                           for proxy authentication (defaults to no password)
3825 # Since: 2.9
3827 { 'struct': 'BlockdevOptionsCurlBase',
3828   'data': { 'url': 'str',
3829             '*readahead': 'int',
3830             '*timeout': 'int',
3831             '*username': 'str',
3832             '*password-secret': 'str',
3833             '*proxy-username': 'str',
3834             '*proxy-password-secret': 'str' } }
3837 # @BlockdevOptionsCurlHttp:
3839 # Driver specific block device options for HTTP connections over the curl
3840 # backend.  URLs must start with "http://".
3842 # @cookie:      List of cookies to set; format is
3843 #               "name1=content1; name2=content2;" as explained by
3844 #               CURLOPT_COOKIE(3). Defaults to no cookies.
3846 # @cookie-secret: ID of a QCryptoSecret object providing the cookie data in a
3847 #                 secure way. See @cookie for the format. (since 2.10)
3849 # Since: 2.9
3851 { 'struct': 'BlockdevOptionsCurlHttp',
3852   'base': 'BlockdevOptionsCurlBase',
3853   'data': { '*cookie': 'str',
3854             '*cookie-secret': 'str'} }
3857 # @BlockdevOptionsCurlHttps:
3859 # Driver specific block device options for HTTPS connections over the curl
3860 # backend.  URLs must start with "https://".
3862 # @cookie:      List of cookies to set; format is
3863 #               "name1=content1; name2=content2;" as explained by
3864 #               CURLOPT_COOKIE(3). Defaults to no cookies.
3866 # @sslverify:   Whether to verify the SSL certificate's validity (defaults to
3867 #               true)
3869 # @cookie-secret: ID of a QCryptoSecret object providing the cookie data in a
3870 #                 secure way. See @cookie for the format. (since 2.10)
3872 # Since: 2.9
3874 { 'struct': 'BlockdevOptionsCurlHttps',
3875   'base': 'BlockdevOptionsCurlBase',
3876   'data': { '*cookie': 'str',
3877             '*sslverify': 'bool',
3878             '*cookie-secret': 'str'} }
3881 # @BlockdevOptionsCurlFtp:
3883 # Driver specific block device options for FTP connections over the curl
3884 # backend.  URLs must start with "ftp://".
3886 # Since: 2.9
3888 { 'struct': 'BlockdevOptionsCurlFtp',
3889   'base': 'BlockdevOptionsCurlBase',
3890   'data': { } }
3893 # @BlockdevOptionsCurlFtps:
3895 # Driver specific block device options for FTPS connections over the curl
3896 # backend.  URLs must start with "ftps://".
3898 # @sslverify:   Whether to verify the SSL certificate's validity (defaults to
3899 #               true)
3901 # Since: 2.9
3903 { 'struct': 'BlockdevOptionsCurlFtps',
3904   'base': 'BlockdevOptionsCurlBase',
3905   'data': { '*sslverify': 'bool' } }
3908 # @BlockdevOptionsNbd:
3910 # Driver specific block device options for NBD.
3912 # @server:      NBD server address
3914 # @export:      export name
3916 # @tls-creds:   TLS credentials ID
3918 # @x-dirty-bitmap: A "qemu:dirty-bitmap:NAME" string to query in place of
3919 #                  traditional "base:allocation" block status (see
3920 #                  NBD_OPT_LIST_META_CONTEXT in the NBD protocol) (since 3.0)
3922 # @reconnect-delay: On an unexpected disconnect, the nbd client tries to
3923 #                   connect again until succeeding or encountering a serious
3924 #                   error.  During the first @reconnect-delay seconds, all
3925 #                   requests are paused and will be rerun on a successful
3926 #                   reconnect. After that time, any delayed requests and all
3927 #                   future requests before a successful reconnect will
3928 #                   immediately fail. Default 0 (Since 4.2)
3930 # Since: 2.9
3932 { 'struct': 'BlockdevOptionsNbd',
3933   'data': { 'server': 'SocketAddress',
3934             '*export': 'str',
3935             '*tls-creds': 'str',
3936             '*x-dirty-bitmap': 'str',
3937             '*reconnect-delay': 'uint32' } }
3940 # @BlockdevOptionsRaw:
3942 # Driver specific block device options for the raw driver.
3944 # @offset:      position where the block device starts
3945 # @size:        the assumed size of the device
3947 # Since: 2.9
3949 { 'struct': 'BlockdevOptionsRaw',
3950   'base': 'BlockdevOptionsGenericFormat',
3951   'data': { '*offset': 'int', '*size': 'int' } }
3954 # @BlockdevOptionsVxHS:
3956 # Driver specific block device options for VxHS
3958 # @vdisk-id:    UUID of VxHS volume
3959 # @server:      vxhs server IP, port
3960 # @tls-creds:   TLS credentials ID
3962 # Since: 2.10
3964 { 'struct': 'BlockdevOptionsVxHS',
3965   'data': { 'vdisk-id': 'str',
3966             'server': 'InetSocketAddressBase',
3967             '*tls-creds': 'str' } }
3970 # @BlockdevOptionsThrottle:
3972 # Driver specific block device options for the throttle driver
3974 # @throttle-group:   the name of the throttle-group object to use. It
3975 #                    must already exist.
3976 # @file:             reference to or definition of the data source block device
3977 # Since: 2.11
3979 { 'struct': 'BlockdevOptionsThrottle',
3980   'data': { 'throttle-group': 'str',
3981             'file' : 'BlockdevRef'
3982              } }
3984 # @BlockdevOptions:
3986 # Options for creating a block device.  Many options are available for all
3987 # block devices, independent of the block driver:
3989 # @driver:        block driver name
3990 # @node-name:     the node name of the new node (Since 2.0).
3991 #                 This option is required on the top level of blockdev-add.
3992 #                 Valid node names start with an alphabetic character and may
3993 #                 contain only alphanumeric characters, '-', '.' and '_'. Their
3994 #                 maximum length is 31 characters.
3995 # @discard:       discard-related options (default: ignore)
3996 # @cache:         cache-related options
3997 # @read-only:     whether the block device should be read-only (default: false).
3998 #                 Note that some block drivers support only read-only access,
3999 #                 either generally or in certain configurations. In this case,
4000 #                 the default value does not work and the option must be
4001 #                 specified explicitly.
4002 # @auto-read-only: if true and @read-only is false, QEMU may automatically
4003 #                  decide not to open the image read-write as requested, but
4004 #                  fall back to read-only instead (and switch between the modes
4005 #                  later), e.g. depending on whether the image file is writable
4006 #                  or whether a writing user is attached to the node
4007 #                  (default: false, since 3.1)
4008 # @detect-zeroes: detect and optimize zero writes (Since 2.1)
4009 #                 (default: off)
4010 # @force-share:   force share all permission on added nodes.
4011 #                 Requires read-only=true. (Since 2.10)
4013 # Remaining options are determined by the block driver.
4015 # Since: 2.9
4017 { 'union': 'BlockdevOptions',
4018   'base': { 'driver': 'BlockdevDriver',
4019             '*node-name': 'str',
4020             '*discard': 'BlockdevDiscardOptions',
4021             '*cache': 'BlockdevCacheOptions',
4022             '*read-only': 'bool',
4023             '*auto-read-only': 'bool',
4024             '*force-share': 'bool',
4025             '*detect-zeroes': 'BlockdevDetectZeroesOptions' },
4026   'discriminator': 'driver',
4027   'data': {
4028       'blkdebug':   'BlockdevOptionsBlkdebug',
4029       'blklogwrites':'BlockdevOptionsBlklogwrites',
4030       'blkverify':  'BlockdevOptionsBlkverify',
4031       'bochs':      'BlockdevOptionsGenericFormat',
4032       'cloop':      'BlockdevOptionsGenericFormat',
4033       'copy-on-read':'BlockdevOptionsGenericFormat',
4034       'dmg':        'BlockdevOptionsGenericFormat',
4035       'file':       'BlockdevOptionsFile',
4036       'ftp':        'BlockdevOptionsCurlFtp',
4037       'ftps':       'BlockdevOptionsCurlFtps',
4038       'gluster':    'BlockdevOptionsGluster',
4039       'host_cdrom': 'BlockdevOptionsFile',
4040       'host_device':'BlockdevOptionsFile',
4041       'http':       'BlockdevOptionsCurlHttp',
4042       'https':      'BlockdevOptionsCurlHttps',
4043       'iscsi':      'BlockdevOptionsIscsi',
4044       'luks':       'BlockdevOptionsLUKS',
4045       'nbd':        'BlockdevOptionsNbd',
4046       'nfs':        'BlockdevOptionsNfs',
4047       'null-aio':   'BlockdevOptionsNull',
4048       'null-co':    'BlockdevOptionsNull',
4049       'nvme':       'BlockdevOptionsNVMe',
4050       'parallels':  'BlockdevOptionsGenericFormat',
4051       'qcow2':      'BlockdevOptionsQcow2',
4052       'qcow':       'BlockdevOptionsQcow',
4053       'qed':        'BlockdevOptionsGenericCOWFormat',
4054       'quorum':     'BlockdevOptionsQuorum',
4055       'raw':        'BlockdevOptionsRaw',
4056       'rbd':        'BlockdevOptionsRbd',
4057       'replication': { 'type': 'BlockdevOptionsReplication',
4058                        'if': 'defined(CONFIG_REPLICATION)' },
4059       'sheepdog':   'BlockdevOptionsSheepdog',
4060       'ssh':        'BlockdevOptionsSsh',
4061       'throttle':   'BlockdevOptionsThrottle',
4062       'vdi':        'BlockdevOptionsGenericFormat',
4063       'vhdx':       'BlockdevOptionsGenericFormat',
4064       'vmdk':       'BlockdevOptionsGenericCOWFormat',
4065       'vpc':        'BlockdevOptionsGenericFormat',
4066       'vvfat':      'BlockdevOptionsVVFAT',
4067       'vxhs':       'BlockdevOptionsVxHS'
4068   } }
4071 # @BlockdevRef:
4073 # Reference to a block device.
4075 # @definition:      defines a new block device inline
4076 # @reference:       references the ID of an existing block device
4078 # Since: 2.9
4080 { 'alternate': 'BlockdevRef',
4081   'data': { 'definition': 'BlockdevOptions',
4082             'reference': 'str' } }
4085 # @BlockdevRefOrNull:
4087 # Reference to a block device.
4089 # @definition:      defines a new block device inline
4090 # @reference:       references the ID of an existing block device.
4091 #                   An empty string means that no block device should
4092 #                   be referenced.  Deprecated; use null instead.
4093 # @null:            No block device should be referenced (since 2.10)
4095 # Since: 2.9
4097 { 'alternate': 'BlockdevRefOrNull',
4098   'data': { 'definition': 'BlockdevOptions',
4099             'reference': 'str',
4100             'null': 'null' } }
4103 # @blockdev-add:
4105 # Creates a new block device. If the @id option is given at the top level, a
4106 # BlockBackend will be created; otherwise, @node-name is mandatory at the top
4107 # level and no BlockBackend will be created.
4109 # Since: 2.9
4111 # Example:
4113 # 1.
4114 # -> { "execute": "blockdev-add",
4115 #      "arguments": {
4116 #           "driver": "qcow2",
4117 #           "node-name": "test1",
4118 #           "file": {
4119 #               "driver": "file",
4120 #               "filename": "test.qcow2"
4121 #            }
4122 #       }
4123 #     }
4124 # <- { "return": {} }
4126 # 2.
4127 # -> { "execute": "blockdev-add",
4128 #      "arguments": {
4129 #           "driver": "qcow2",
4130 #           "node-name": "node0",
4131 #           "discard": "unmap",
4132 #           "cache": {
4133 #              "direct": true
4134 #            },
4135 #            "file": {
4136 #              "driver": "file",
4137 #              "filename": "/tmp/test.qcow2"
4138 #            },
4139 #            "backing": {
4140 #               "driver": "raw",
4141 #               "file": {
4142 #                  "driver": "file",
4143 #                  "filename": "/dev/fdset/4"
4144 #                }
4145 #            }
4146 #        }
4147 #      }
4149 # <- { "return": {} }
4152 { 'command': 'blockdev-add', 'data': 'BlockdevOptions', 'boxed': true }
4155 # @x-blockdev-reopen:
4157 # Reopens a block device using the given set of options. Any option
4158 # not specified will be reset to its default value regardless of its
4159 # previous status. If an option cannot be changed or a particular
4160 # driver does not support reopening then the command will return an
4161 # error.
4163 # The top-level @node-name option (from BlockdevOptions) must be
4164 # specified and is used to select the block device to be reopened.
4165 # Other @node-name options must be either omitted or set to the
4166 # current name of the appropriate node. This command won't change any
4167 # node name and any attempt to do it will result in an error.
4169 # In the case of options that refer to child nodes, the behavior of
4170 # this command depends on the value:
4172 #  1) A set of options (BlockdevOptions): the child is reopened with
4173 #     the specified set of options.
4175 #  2) A reference to the current child: the child is reopened using
4176 #     its existing set of options.
4178 #  3) A reference to a different node: the current child is replaced
4179 #     with the specified one.
4181 #  4) NULL: the current child (if any) is detached.
4183 # Options (1) and (2) are supported in all cases, but at the moment
4184 # only @backing allows replacing or detaching an existing child.
4186 # Unlike with blockdev-add, the @backing option must always be present
4187 # unless the node being reopened does not have a backing file and its
4188 # image does not have a default backing file name as part of its
4189 # metadata.
4191 # Since: 4.0
4193 { 'command': 'x-blockdev-reopen',
4194   'data': 'BlockdevOptions', 'boxed': true }
4197 # @blockdev-del:
4199 # Deletes a block device that has been added using blockdev-add.
4200 # The command will fail if the node is attached to a device or is
4201 # otherwise being used.
4203 # @node-name: Name of the graph node to delete.
4205 # Since: 2.9
4207 # Example:
4209 # -> { "execute": "blockdev-add",
4210 #      "arguments": {
4211 #           "driver": "qcow2",
4212 #           "node-name": "node0",
4213 #           "file": {
4214 #               "driver": "file",
4215 #               "filename": "test.qcow2"
4216 #           }
4217 #      }
4218 #    }
4219 # <- { "return": {} }
4221 # -> { "execute": "blockdev-del",
4222 #      "arguments": { "node-name": "node0" }
4223 #    }
4224 # <- { "return": {} }
4227 { 'command': 'blockdev-del', 'data': { 'node-name': 'str' } }
4230 # @BlockdevCreateOptionsFile:
4232 # Driver specific image creation options for file.
4234 # @filename         Filename for the new image file
4235 # @size             Size of the virtual disk in bytes
4236 # @preallocation    Preallocation mode for the new image (default: off;
4237 #                   allowed values: off,
4238 #                   falloc (if defined CONFIG_POSIX_FALLOCATE),
4239 #                   full (if defined CONFIG_POSIX))
4240 # @nocow            Turn off copy-on-write (valid only on btrfs; default: off)
4242 # Since: 2.12
4244 { 'struct': 'BlockdevCreateOptionsFile',
4245   'data': { 'filename':         'str',
4246             'size':             'size',
4247             '*preallocation':   'PreallocMode',
4248             '*nocow':           'bool' } }
4251 # @BlockdevCreateOptionsGluster:
4253 # Driver specific image creation options for gluster.
4255 # @location         Where to store the new image file
4256 # @size             Size of the virtual disk in bytes
4257 # @preallocation    Preallocation mode for the new image (default: off;
4258 #                   allowed values: off,
4259 #                   falloc (if defined CONFIG_GLUSTERFS_FALLOCATE),
4260 #                   full (if defined CONFIG_GLUSTERFS_ZEROFILL))
4262 # Since: 2.12
4264 { 'struct': 'BlockdevCreateOptionsGluster',
4265   'data': { 'location':         'BlockdevOptionsGluster',
4266             'size':             'size',
4267             '*preallocation':   'PreallocMode' } }
4270 # @BlockdevCreateOptionsLUKS:
4272 # Driver specific image creation options for LUKS.
4274 # @file             Node to create the image format on
4275 # @size             Size of the virtual disk in bytes
4276 # @preallocation    Preallocation mode for the new image
4277 #                   (since: 4.2)
4278 #                   (default: off; allowed values: off, metadata, falloc, full)
4280 # Since: 2.12
4282 { 'struct': 'BlockdevCreateOptionsLUKS',
4283   'base': 'QCryptoBlockCreateOptionsLUKS',
4284   'data': { 'file':             'BlockdevRef',
4285             'size':             'size',
4286             '*preallocation':   'PreallocMode' } }
4289 # @BlockdevCreateOptionsNfs:
4291 # Driver specific image creation options for NFS.
4293 # @location         Where to store the new image file
4294 # @size             Size of the virtual disk in bytes
4296 # Since: 2.12
4298 { 'struct': 'BlockdevCreateOptionsNfs',
4299   'data': { 'location':         'BlockdevOptionsNfs',
4300             'size':             'size' } }
4303 # @BlockdevCreateOptionsParallels:
4305 # Driver specific image creation options for parallels.
4307 # @file             Node to create the image format on
4308 # @size             Size of the virtual disk in bytes
4309 # @cluster-size     Cluster size in bytes (default: 1 MB)
4311 # Since: 2.12
4313 { 'struct': 'BlockdevCreateOptionsParallels',
4314   'data': { 'file':             'BlockdevRef',
4315             'size':             'size',
4316             '*cluster-size':    'size' } }
4319 # @BlockdevCreateOptionsQcow:
4321 # Driver specific image creation options for qcow.
4323 # @file             Node to create the image format on
4324 # @size             Size of the virtual disk in bytes
4325 # @backing-file     File name of the backing file if a backing file
4326 #                   should be used
4327 # @encrypt          Encryption options if the image should be encrypted
4329 # Since: 2.12
4331 { 'struct': 'BlockdevCreateOptionsQcow',
4332   'data': { 'file':             'BlockdevRef',
4333             'size':             'size',
4334             '*backing-file':    'str',
4335             '*encrypt':         'QCryptoBlockCreateOptions' } }
4338 # @BlockdevQcow2Version:
4340 # @v2:  The original QCOW2 format as introduced in qemu 0.10 (version 2)
4341 # @v3:  The extended QCOW2 format as introduced in qemu 1.1 (version 3)
4343 # Since: 2.12
4345 { 'enum': 'BlockdevQcow2Version',
4346   'data': [ 'v2', 'v3' ] }
4350 # @BlockdevCreateOptionsQcow2:
4352 # Driver specific image creation options for qcow2.
4354 # @file             Node to create the image format on
4355 # @data-file        Node to use as an external data file in which all guest
4356 #                   data is stored so that only metadata remains in the qcow2
4357 #                   file (since: 4.0)
4358 # @data-file-raw    True if the external data file must stay valid as a
4359 #                   standalone (read-only) raw image without looking at qcow2
4360 #                   metadata (default: false; since: 4.0)
4361 # @size             Size of the virtual disk in bytes
4362 # @version          Compatibility level (default: v3)
4363 # @backing-file     File name of the backing file if a backing file
4364 #                   should be used
4365 # @backing-fmt      Name of the block driver to use for the backing file
4366 # @encrypt          Encryption options if the image should be encrypted
4367 # @cluster-size     qcow2 cluster size in bytes (default: 65536)
4368 # @preallocation    Preallocation mode for the new image (default: off;
4369 #                   allowed values: off, falloc, full, metadata)
4370 # @lazy-refcounts   True if refcounts may be updated lazily (default: off)
4371 # @refcount-bits    Width of reference counts in bits (default: 16)
4373 # Since: 2.12
4375 { 'struct': 'BlockdevCreateOptionsQcow2',
4376   'data': { 'file':             'BlockdevRef',
4377             '*data-file':       'BlockdevRef',
4378             '*data-file-raw':   'bool',
4379             'size':             'size',
4380             '*version':         'BlockdevQcow2Version',
4381             '*backing-file':    'str',
4382             '*backing-fmt':     'BlockdevDriver',
4383             '*encrypt':         'QCryptoBlockCreateOptions',
4384             '*cluster-size':    'size',
4385             '*preallocation':   'PreallocMode',
4386             '*lazy-refcounts':  'bool',
4387             '*refcount-bits':   'int' } }
4390 # @BlockdevCreateOptionsQed:
4392 # Driver specific image creation options for qed.
4394 # @file             Node to create the image format on
4395 # @size             Size of the virtual disk in bytes
4396 # @backing-file     File name of the backing file if a backing file
4397 #                   should be used
4398 # @backing-fmt      Name of the block driver to use for the backing file
4399 # @cluster-size     Cluster size in bytes (default: 65536)
4400 # @table-size       L1/L2 table size (in clusters)
4402 # Since: 2.12
4404 { 'struct': 'BlockdevCreateOptionsQed',
4405   'data': { 'file':             'BlockdevRef',
4406             'size':             'size',
4407             '*backing-file':    'str',
4408             '*backing-fmt':     'BlockdevDriver',
4409             '*cluster-size':    'size',
4410             '*table-size':      'int' } }
4413 # @BlockdevCreateOptionsRbd:
4415 # Driver specific image creation options for rbd/Ceph.
4417 # @location         Where to store the new image file. This location cannot
4418 #                   point to a snapshot.
4419 # @size             Size of the virtual disk in bytes
4420 # @cluster-size     RBD object size
4422 # Since: 2.12
4424 { 'struct': 'BlockdevCreateOptionsRbd',
4425   'data': { 'location':         'BlockdevOptionsRbd',
4426             'size':             'size',
4427             '*cluster-size' :   'size' } }
4430 # @BlockdevVmdkSubformat:
4432 # Subformat options for VMDK images
4434 # @monolithicSparse:     Single file image with sparse cluster allocation
4436 # @monolithicFlat:       Single flat data image and a descriptor file
4438 # @twoGbMaxExtentSparse: Data is split into 2GB (per virtual LBA) sparse extent
4439 #                        files, in addition to a descriptor file
4441 # @twoGbMaxExtentFlat:   Data is split into 2GB (per virtual LBA) flat extent
4442 #                        files, in addition to a descriptor file
4444 # @streamOptimized:      Single file image sparse cluster allocation, optimized
4445 #                        for streaming over network.
4447 # Since: 4.0
4449 { 'enum': 'BlockdevVmdkSubformat',
4450   'data': [ 'monolithicSparse', 'monolithicFlat', 'twoGbMaxExtentSparse',
4451             'twoGbMaxExtentFlat', 'streamOptimized'] }
4454 # @BlockdevVmdkAdapterType:
4456 # Adapter type info for VMDK images
4458 # Since: 4.0
4460 { 'enum': 'BlockdevVmdkAdapterType',
4461   'data': [ 'ide', 'buslogic', 'lsilogic', 'legacyESX'] }
4464 # @BlockdevCreateOptionsVmdk:
4466 # Driver specific image creation options for VMDK.
4468 # @file         Where to store the new image file. This refers to the image
4469 #               file for monolithcSparse and streamOptimized format, or the
4470 #               descriptor file for other formats.
4471 # @size         Size of the virtual disk in bytes
4472 # @extents      Where to store the data extents. Required for monolithcFlat,
4473 #               twoGbMaxExtentSparse and twoGbMaxExtentFlat formats. For
4474 #               monolithicFlat, only one entry is required; for
4475 #               twoGbMaxExtent* formats, the number of entries required is
4476 #               calculated as extent_number = virtual_size / 2GB. Providing
4477 #               more extents than will be used is an error.
4478 # @subformat    The subformat of the VMDK image. Default: "monolithicSparse".
4479 # @backing-file The path of backing file. Default: no backing file is used.
4480 # @adapter-type The adapter type used to fill in the descriptor. Default: ide.
4481 # @hwversion    Hardware version. The meaningful options are "4" or "6".
4482 #               Default: "4".
4483 # @zeroed-grain Whether to enable zeroed-grain feature for sparse subformats.
4484 #               Default: false.
4486 # Since: 4.0
4488 { 'struct': 'BlockdevCreateOptionsVmdk',
4489   'data': { 'file':             'BlockdevRef',
4490             'size':             'size',
4491             '*extents':          ['BlockdevRef'],
4492             '*subformat':       'BlockdevVmdkSubformat',
4493             '*backing-file':    'str',
4494             '*adapter-type':    'BlockdevVmdkAdapterType',
4495             '*hwversion':       'str',
4496             '*zeroed-grain':    'bool' } }
4500 # @SheepdogRedundancyType:
4502 # @full             Create a fully replicated vdi with x copies
4503 # @erasure-coded    Create an erasure coded vdi with x data strips and
4504 #                   y parity strips
4506 # Since: 2.12
4508 { 'enum': 'SheepdogRedundancyType',
4509   'data': [ 'full', 'erasure-coded' ] }
4512 # @SheepdogRedundancyFull:
4514 # @copies           Number of copies to use (between 1 and 31)
4516 # Since: 2.12
4518 { 'struct': 'SheepdogRedundancyFull',
4519   'data': { 'copies': 'int' }}
4522 # @SheepdogRedundancyErasureCoded:
4524 # @data-strips      Number of data strips to use (one of {2,4,8,16})
4525 # @parity-strips    Number of parity strips to use (between 1 and 15)
4527 # Since: 2.12
4529 { 'struct': 'SheepdogRedundancyErasureCoded',
4530   'data': { 'data-strips': 'int',
4531             'parity-strips': 'int' }}
4534 # @SheepdogRedundancy:
4536 # Since: 2.12
4538 { 'union': 'SheepdogRedundancy',
4539   'base': { 'type': 'SheepdogRedundancyType' },
4540   'discriminator': 'type',
4541   'data': { 'full': 'SheepdogRedundancyFull',
4542             'erasure-coded': 'SheepdogRedundancyErasureCoded' } }
4545 # @BlockdevCreateOptionsSheepdog:
4547 # Driver specific image creation options for Sheepdog.
4549 # @location         Where to store the new image file
4550 # @size             Size of the virtual disk in bytes
4551 # @backing-file     File name of a base image
4552 # @preallocation    Preallocation mode for the new image (default: off;
4553 #                   allowed values: off, full)
4554 # @redundancy       Redundancy of the image
4555 # @object-size      Object size of the image
4557 # Since: 2.12
4559 { 'struct': 'BlockdevCreateOptionsSheepdog',
4560   'data': { 'location':         'BlockdevOptionsSheepdog',
4561             'size':             'size',
4562             '*backing-file':    'str',
4563             '*preallocation':   'PreallocMode',
4564             '*redundancy':      'SheepdogRedundancy',
4565             '*object-size':     'size' } }
4568 # @BlockdevCreateOptionsSsh:
4570 # Driver specific image creation options for SSH.
4572 # @location         Where to store the new image file
4573 # @size             Size of the virtual disk in bytes
4575 # Since: 2.12
4577 { 'struct': 'BlockdevCreateOptionsSsh',
4578   'data': { 'location':         'BlockdevOptionsSsh',
4579             'size':             'size' } }
4582 # @BlockdevCreateOptionsVdi:
4584 # Driver specific image creation options for VDI.
4586 # @file             Node to create the image format on
4587 # @size             Size of the virtual disk in bytes
4588 # @preallocation    Preallocation mode for the new image (default: off;
4589 #                   allowed values: off, metadata)
4591 # Since: 2.12
4593 { 'struct': 'BlockdevCreateOptionsVdi',
4594   'data': { 'file':             'BlockdevRef',
4595             'size':             'size',
4596             '*preallocation':   'PreallocMode' } }
4599 # @BlockdevVhdxSubformat:
4601 # @dynamic: Growing image file
4602 # @fixed:   Preallocated fixed-size image file
4604 # Since: 2.12
4606 { 'enum': 'BlockdevVhdxSubformat',
4607   'data': [ 'dynamic', 'fixed' ] }
4610 # @BlockdevCreateOptionsVhdx:
4612 # Driver specific image creation options for vhdx.
4614 # @file             Node to create the image format on
4615 # @size             Size of the virtual disk in bytes
4616 # @log-size         Log size in bytes, must be a multiple of 1 MB
4617 #                   (default: 1 MB)
4618 # @block-size       Block size in bytes, must be a multiple of 1 MB and not
4619 #                   larger than 256 MB (default: automatically choose a block
4620 #                   size depending on the image size)
4621 # @subformat        vhdx subformat (default: dynamic)
4622 # @block-state-zero Force use of payload blocks of type 'ZERO'. Non-standard,
4623 #                   but default.  Do not set to 'off' when using 'qemu-img
4624 #                   convert' with subformat=dynamic.
4626 # Since: 2.12
4628 { 'struct': 'BlockdevCreateOptionsVhdx',
4629   'data': { 'file':                 'BlockdevRef',
4630             'size':                 'size',
4631             '*log-size':            'size',
4632             '*block-size':          'size',
4633             '*subformat':           'BlockdevVhdxSubformat',
4634             '*block-state-zero':    'bool' } }
4637 # @BlockdevVpcSubformat:
4639 # @dynamic: Growing image file
4640 # @fixed:   Preallocated fixed-size image file
4642 # Since: 2.12
4644 { 'enum': 'BlockdevVpcSubformat',
4645   'data': [ 'dynamic', 'fixed' ] }
4648 # @BlockdevCreateOptionsVpc:
4650 # Driver specific image creation options for vpc (VHD).
4652 # @file             Node to create the image format on
4653 # @size             Size of the virtual disk in bytes
4654 # @subformat        vhdx subformat (default: dynamic)
4655 # @force-size       Force use of the exact byte size instead of rounding to the
4656 #                   next size that can be represented in CHS geometry
4657 #                   (default: false)
4659 # Since: 2.12
4661 { 'struct': 'BlockdevCreateOptionsVpc',
4662   'data': { 'file':                 'BlockdevRef',
4663             'size':                 'size',
4664             '*subformat':           'BlockdevVpcSubformat',
4665             '*force-size':          'bool' } }
4668 # @BlockdevCreateOptions:
4670 # Options for creating an image format on a given node.
4672 # @driver           block driver to create the image format
4674 # Since: 2.12
4676 { 'union': 'BlockdevCreateOptions',
4677   'base': {
4678       'driver':         'BlockdevDriver' },
4679   'discriminator': 'driver',
4680   'data': {
4681       'file':           'BlockdevCreateOptionsFile',
4682       'gluster':        'BlockdevCreateOptionsGluster',
4683       'luks':           'BlockdevCreateOptionsLUKS',
4684       'nfs':            'BlockdevCreateOptionsNfs',
4685       'parallels':      'BlockdevCreateOptionsParallels',
4686       'qcow':           'BlockdevCreateOptionsQcow',
4687       'qcow2':          'BlockdevCreateOptionsQcow2',
4688       'qed':            'BlockdevCreateOptionsQed',
4689       'rbd':            'BlockdevCreateOptionsRbd',
4690       'sheepdog':       'BlockdevCreateOptionsSheepdog',
4691       'ssh':            'BlockdevCreateOptionsSsh',
4692       'vdi':            'BlockdevCreateOptionsVdi',
4693       'vhdx':           'BlockdevCreateOptionsVhdx',
4694       'vmdk':           'BlockdevCreateOptionsVmdk',
4695       'vpc':            'BlockdevCreateOptionsVpc'
4696   } }
4699 # @blockdev-create:
4701 # Starts a job to create an image format on a given node. The job is
4702 # automatically finalized, but a manual job-dismiss is required.
4704 # @job-id:          Identifier for the newly created job.
4706 # @options:         Options for the image creation.
4708 # Since: 3.0
4710 { 'command': 'blockdev-create',
4711   'data': { 'job-id': 'str',
4712             'options': 'BlockdevCreateOptions' } }
4715 # @blockdev-open-tray:
4717 # Opens a block device's tray. If there is a block driver state tree inserted as
4718 # a medium, it will become inaccessible to the guest (but it will remain
4719 # associated to the block device, so closing the tray will make it accessible
4720 # again).
4722 # If the tray was already open before, this will be a no-op.
4724 # Once the tray opens, a DEVICE_TRAY_MOVED event is emitted. There are cases in
4725 # which no such event will be generated, these include:
4726 # - if the guest has locked the tray, @force is false and the guest does not
4727 #   respond to the eject request
4728 # - if the BlockBackend denoted by @device does not have a guest device attached
4729 #   to it
4730 # - if the guest device does not have an actual tray
4732 # @device: Block device name (deprecated, use @id instead)
4734 # @id:     The name or QOM path of the guest device (since: 2.8)
4736 # @force:  if false (the default), an eject request will be sent to
4737 #          the guest if it has locked the tray (and the tray will not be opened
4738 #          immediately); if true, the tray will be opened regardless of whether
4739 #          it is locked
4741 # Since: 2.5
4743 # Example:
4745 # -> { "execute": "blockdev-open-tray",
4746 #      "arguments": { "id": "ide0-1-0" } }
4748 # <- { "timestamp": { "seconds": 1418751016,
4749 #                     "microseconds": 716996 },
4750 #      "event": "DEVICE_TRAY_MOVED",
4751 #      "data": { "device": "ide1-cd0",
4752 #                "id": "ide0-1-0",
4753 #                "tray-open": true } }
4755 # <- { "return": {} }
4758 { 'command': 'blockdev-open-tray',
4759   'data': { '*device': 'str',
4760             '*id': 'str',
4761             '*force': 'bool' } }
4764 # @blockdev-close-tray:
4766 # Closes a block device's tray. If there is a block driver state tree associated
4767 # with the block device (which is currently ejected), that tree will be loaded
4768 # as the medium.
4770 # If the tray was already closed before, this will be a no-op.
4772 # @device:  Block device name (deprecated, use @id instead)
4774 # @id:      The name or QOM path of the guest device (since: 2.8)
4776 # Since: 2.5
4778 # Example:
4780 # -> { "execute": "blockdev-close-tray",
4781 #      "arguments": { "id": "ide0-1-0" } }
4783 # <- { "timestamp": { "seconds": 1418751345,
4784 #                     "microseconds": 272147 },
4785 #      "event": "DEVICE_TRAY_MOVED",
4786 #      "data": { "device": "ide1-cd0",
4787 #                "id": "ide0-1-0",
4788 #                "tray-open": false } }
4790 # <- { "return": {} }
4793 { 'command': 'blockdev-close-tray',
4794   'data': { '*device': 'str',
4795             '*id': 'str' } }
4798 # @blockdev-remove-medium:
4800 # Removes a medium (a block driver state tree) from a block device. That block
4801 # device's tray must currently be open (unless there is no attached guest
4802 # device).
4804 # If the tray is open and there is no medium inserted, this will be a no-op.
4806 # @id:     The name or QOM path of the guest device
4808 # Since: 2.12
4810 # Example:
4812 # -> { "execute": "blockdev-remove-medium",
4813 #      "arguments": { "id": "ide0-1-0" } }
4815 # <- { "error": { "class": "GenericError",
4816 #                 "desc": "Tray of device 'ide0-1-0' is not open" } }
4818 # -> { "execute": "blockdev-open-tray",
4819 #      "arguments": { "id": "ide0-1-0" } }
4821 # <- { "timestamp": { "seconds": 1418751627,
4822 #                     "microseconds": 549958 },
4823 #      "event": "DEVICE_TRAY_MOVED",
4824 #      "data": { "device": "ide1-cd0",
4825 #                "id": "ide0-1-0",
4826 #                "tray-open": true } }
4828 # <- { "return": {} }
4830 # -> { "execute": "blockdev-remove-medium",
4831 #      "arguments": { "id": "ide0-1-0" } }
4833 # <- { "return": {} }
4836 { 'command': 'blockdev-remove-medium',
4837   'data': { 'id': 'str' } }
4840 # @blockdev-insert-medium:
4842 # Inserts a medium (a block driver state tree) into a block device. That block
4843 # device's tray must currently be open (unless there is no attached guest
4844 # device) and there must be no medium inserted already.
4846 # @id:        The name or QOM path of the guest device
4848 # @node-name: name of a node in the block driver state graph
4850 # Since: 2.12
4852 # Example:
4854 # -> { "execute": "blockdev-add",
4855 #      "arguments": {
4856 #          "node-name": "node0",
4857 #          "driver": "raw",
4858 #          "file": { "driver": "file",
4859 #                    "filename": "fedora.iso" } } }
4860 # <- { "return": {} }
4862 # -> { "execute": "blockdev-insert-medium",
4863 #      "arguments": { "id": "ide0-1-0",
4864 #                     "node-name": "node0" } }
4866 # <- { "return": {} }
4869 { 'command': 'blockdev-insert-medium',
4870   'data': { 'id': 'str',
4871             'node-name': 'str'} }
4875 # @BlockdevChangeReadOnlyMode:
4877 # Specifies the new read-only mode of a block device subject to the
4878 # @blockdev-change-medium command.
4880 # @retain:      Retains the current read-only mode
4882 # @read-only:   Makes the device read-only
4884 # @read-write:  Makes the device writable
4886 # Since: 2.3
4889 { 'enum': 'BlockdevChangeReadOnlyMode',
4890   'data': ['retain', 'read-only', 'read-write'] }
4894 # @blockdev-change-medium:
4896 # Changes the medium inserted into a block device by ejecting the current medium
4897 # and loading a new image file which is inserted as the new medium (this command
4898 # combines blockdev-open-tray, blockdev-remove-medium, blockdev-insert-medium
4899 # and blockdev-close-tray).
4901 # @device:          Block device name (deprecated, use @id instead)
4903 # @id:              The name or QOM path of the guest device
4904 #                   (since: 2.8)
4906 # @filename:        filename of the new image to be loaded
4908 # @format:          format to open the new image with (defaults to
4909 #                   the probed format)
4911 # @read-only-mode:  change the read-only mode of the device; defaults
4912 #                   to 'retain'
4914 # Since: 2.5
4916 # Examples:
4918 # 1. Change a removable medium
4920 # -> { "execute": "blockdev-change-medium",
4921 #      "arguments": { "id": "ide0-1-0",
4922 #                     "filename": "/srv/images/Fedora-12-x86_64-DVD.iso",
4923 #                     "format": "raw" } }
4924 # <- { "return": {} }
4926 # 2. Load a read-only medium into a writable drive
4928 # -> { "execute": "blockdev-change-medium",
4929 #      "arguments": { "id": "floppyA",
4930 #                     "filename": "/srv/images/ro.img",
4931 #                     "format": "raw",
4932 #                     "read-only-mode": "retain" } }
4934 # <- { "error":
4935 #      { "class": "GenericError",
4936 #        "desc": "Could not open '/srv/images/ro.img': Permission denied" } }
4938 # -> { "execute": "blockdev-change-medium",
4939 #      "arguments": { "id": "floppyA",
4940 #                     "filename": "/srv/images/ro.img",
4941 #                     "format": "raw",
4942 #                     "read-only-mode": "read-only" } }
4944 # <- { "return": {} }
4947 { 'command': 'blockdev-change-medium',
4948   'data': { '*device': 'str',
4949             '*id': 'str',
4950             'filename': 'str',
4951             '*format': 'str',
4952             '*read-only-mode': 'BlockdevChangeReadOnlyMode' } }
4956 # @BlockErrorAction:
4958 # An enumeration of action that has been taken when a DISK I/O occurs
4960 # @ignore: error has been ignored
4962 # @report: error has been reported to the device
4964 # @stop: error caused VM to be stopped
4966 # Since: 2.1
4968 { 'enum': 'BlockErrorAction',
4969   'data': [ 'ignore', 'report', 'stop' ] }
4973 # @BLOCK_IMAGE_CORRUPTED:
4975 # Emitted when a disk image is being marked corrupt. The image can be
4976 # identified by its device or node name. The 'device' field is always
4977 # present for compatibility reasons, but it can be empty ("") if the
4978 # image does not have a device name associated.
4980 # @device: device name. This is always present for compatibility
4981 #          reasons, but it can be empty ("") if the image does not
4982 #          have a device name associated.
4984 # @node-name: node name (Since: 2.4)
4986 # @msg: informative message for human consumption, such as the kind of
4987 #       corruption being detected. It should not be parsed by machine as it is
4988 #       not guaranteed to be stable
4990 # @offset: if the corruption resulted from an image access, this is
4991 #          the host's access offset into the image
4993 # @size: if the corruption resulted from an image access, this is
4994 #        the access size
4996 # @fatal: if set, the image is marked corrupt and therefore unusable after this
4997 #        event and must be repaired (Since 2.2; before, every
4998 #        BLOCK_IMAGE_CORRUPTED event was fatal)
5000 # Note: If action is "stop", a STOP event will eventually follow the
5001 #       BLOCK_IO_ERROR event.
5003 # Example:
5005 # <- { "event": "BLOCK_IMAGE_CORRUPTED",
5006 #      "data": { "device": "ide0-hd0", "node-name": "node0",
5007 #                "msg": "Prevented active L1 table overwrite", "offset": 196608,
5008 #                "size": 65536 },
5009 #      "timestamp": { "seconds": 1378126126, "microseconds": 966463 } }
5011 # Since: 1.7
5013 { 'event': 'BLOCK_IMAGE_CORRUPTED',
5014   'data': { 'device'     : 'str',
5015             '*node-name' : 'str',
5016             'msg'        : 'str',
5017             '*offset'    : 'int',
5018             '*size'      : 'int',
5019             'fatal'      : 'bool' } }
5022 # @BLOCK_IO_ERROR:
5024 # Emitted when a disk I/O error occurs
5026 # @device: device name. This is always present for compatibility
5027 #          reasons, but it can be empty ("") if the image does not
5028 #          have a device name associated.
5030 # @node-name: node name. Note that errors may be reported for the root node
5031 #             that is directly attached to a guest device rather than for the
5032 #             node where the error occurred. The node name is not present if
5033 #             the drive is empty. (Since: 2.8)
5035 # @operation: I/O operation
5037 # @action: action that has been taken
5039 # @nospace: true if I/O error was caused due to a no-space
5040 #           condition. This key is only present if query-block's
5041 #           io-status is present, please see query-block documentation
5042 #           for more information (since: 2.2)
5044 # @reason: human readable string describing the error cause.
5045 #          (This field is a debugging aid for humans, it should not
5046 #           be parsed by applications) (since: 2.2)
5048 # Note: If action is "stop", a STOP event will eventually follow the
5049 # BLOCK_IO_ERROR event
5051 # Since: 0.13.0
5053 # Example:
5055 # <- { "event": "BLOCK_IO_ERROR",
5056 #      "data": { "device": "ide0-hd1",
5057 #                "node-name": "#block212",
5058 #                "operation": "write",
5059 #                "action": "stop" },
5060 #      "timestamp": { "seconds": 1265044230, "microseconds": 450486 } }
5063 { 'event': 'BLOCK_IO_ERROR',
5064   'data': { 'device': 'str', '*node-name': 'str',
5065             'operation': 'IoOperationType',
5066             'action': 'BlockErrorAction', '*nospace': 'bool',
5067             'reason': 'str' } }
5070 # @BLOCK_JOB_COMPLETED:
5072 # Emitted when a block job has completed
5074 # @type: job type
5076 # @device: The job identifier. Originally the device name but other
5077 #          values are allowed since QEMU 2.7
5079 # @len: maximum progress value
5081 # @offset: current progress value. On success this is equal to len.
5082 #          On failure this is less than len
5084 # @speed: rate limit, bytes per second
5086 # @error: error message. Only present on failure. This field
5087 #         contains a human-readable error message. There are no semantics
5088 #         other than that streaming has failed and clients should not try to
5089 #         interpret the error string
5091 # Since: 1.1
5093 # Example:
5095 # <- { "event": "BLOCK_JOB_COMPLETED",
5096 #      "data": { "type": "stream", "device": "virtio-disk0",
5097 #                "len": 10737418240, "offset": 10737418240,
5098 #                "speed": 0 },
5099 #      "timestamp": { "seconds": 1267061043, "microseconds": 959568 } }
5102 { 'event': 'BLOCK_JOB_COMPLETED',
5103   'data': { 'type'  : 'JobType',
5104             'device': 'str',
5105             'len'   : 'int',
5106             'offset': 'int',
5107             'speed' : 'int',
5108             '*error': 'str' } }
5111 # @BLOCK_JOB_CANCELLED:
5113 # Emitted when a block job has been cancelled
5115 # @type: job type
5117 # @device: The job identifier. Originally the device name but other
5118 #          values are allowed since QEMU 2.7
5120 # @len: maximum progress value
5122 # @offset: current progress value. On success this is equal to len.
5123 #          On failure this is less than len
5125 # @speed: rate limit, bytes per second
5127 # Since: 1.1
5129 # Example:
5131 # <- { "event": "BLOCK_JOB_CANCELLED",
5132 #      "data": { "type": "stream", "device": "virtio-disk0",
5133 #                "len": 10737418240, "offset": 134217728,
5134 #                "speed": 0 },
5135 #      "timestamp": { "seconds": 1267061043, "microseconds": 959568 } }
5138 { 'event': 'BLOCK_JOB_CANCELLED',
5139   'data': { 'type'  : 'JobType',
5140             'device': 'str',
5141             'len'   : 'int',
5142             'offset': 'int',
5143             'speed' : 'int' } }
5146 # @BLOCK_JOB_ERROR:
5148 # Emitted when a block job encounters an error
5150 # @device: The job identifier. Originally the device name but other
5151 #          values are allowed since QEMU 2.7
5153 # @operation: I/O operation
5155 # @action: action that has been taken
5157 # Since: 1.3
5159 # Example:
5161 # <- { "event": "BLOCK_JOB_ERROR",
5162 #      "data": { "device": "ide0-hd1",
5163 #                "operation": "write",
5164 #                "action": "stop" },
5165 #      "timestamp": { "seconds": 1265044230, "microseconds": 450486 } }
5168 { 'event': 'BLOCK_JOB_ERROR',
5169   'data': { 'device'   : 'str',
5170             'operation': 'IoOperationType',
5171             'action'   : 'BlockErrorAction' } }
5174 # @BLOCK_JOB_READY:
5176 # Emitted when a block job is ready to complete
5178 # @type: job type
5180 # @device: The job identifier. Originally the device name but other
5181 #          values are allowed since QEMU 2.7
5183 # @len: maximum progress value
5185 # @offset: current progress value. On success this is equal to len.
5186 #          On failure this is less than len
5188 # @speed: rate limit, bytes per second
5190 # Note: The "ready to complete" status is always reset by a @BLOCK_JOB_ERROR
5191 # event
5193 # Since: 1.3
5195 # Example:
5197 # <- { "event": "BLOCK_JOB_READY",
5198 #      "data": { "device": "drive0", "type": "mirror", "speed": 0,
5199 #                "len": 2097152, "offset": 2097152 }
5200 #      "timestamp": { "seconds": 1265044230, "microseconds": 450486 } }
5203 { 'event': 'BLOCK_JOB_READY',
5204   'data': { 'type'  : 'JobType',
5205             'device': 'str',
5206             'len'   : 'int',
5207             'offset': 'int',
5208             'speed' : 'int' } }
5211 # @BLOCK_JOB_PENDING:
5213 # Emitted when a block job is awaiting explicit authorization to finalize graph
5214 # changes via @block-job-finalize. If this job is part of a transaction, it will
5215 # not emit this event until the transaction has converged first.
5217 # @type: job type
5219 # @id: The job identifier.
5221 # Since: 2.12
5223 # Example:
5225 # <- { "event": "BLOCK_JOB_WAITING",
5226 #      "data": { "device": "drive0", "type": "mirror" },
5227 #      "timestamp": { "seconds": 1265044230, "microseconds": 450486 } }
5230 { 'event': 'BLOCK_JOB_PENDING',
5231   'data': { 'type'  : 'JobType',
5232             'id'    : 'str' } }
5235 # @PreallocMode:
5237 # Preallocation mode of QEMU image file
5239 # @off: no preallocation
5240 # @metadata: preallocate only for metadata
5241 # @falloc: like @full preallocation but allocate disk space by
5242 #          posix_fallocate() rather than writing data.
5243 # @full: preallocate all data by writing it to the device to ensure
5244 #        disk space is really available. This data may or may not be
5245 #        zero, depending on the image format and storage.
5246 #        @full preallocation also sets up metadata correctly.
5248 # Since: 2.2
5250 { 'enum': 'PreallocMode',
5251   'data': [ 'off', 'metadata', 'falloc', 'full' ] }
5254 # @BLOCK_WRITE_THRESHOLD:
5256 # Emitted when writes on block device reaches or exceeds the
5257 # configured write threshold. For thin-provisioned devices, this
5258 # means the device should be extended to avoid pausing for
5259 # disk exhaustion.
5260 # The event is one shot. Once triggered, it needs to be
5261 # re-registered with another block-set-write-threshold command.
5263 # @node-name: graph node name on which the threshold was exceeded.
5265 # @amount-exceeded: amount of data which exceeded the threshold, in bytes.
5267 # @write-threshold: last configured threshold, in bytes.
5269 # Since: 2.3
5271 { 'event': 'BLOCK_WRITE_THRESHOLD',
5272   'data': { 'node-name': 'str',
5273             'amount-exceeded': 'uint64',
5274             'write-threshold': 'uint64' } }
5277 # @block-set-write-threshold:
5279 # Change the write threshold for a block drive. An event will be
5280 # delivered if a write to this block drive crosses the configured
5281 # threshold.  The threshold is an offset, thus must be
5282 # non-negative. Default is no write threshold. Setting the threshold
5283 # to zero disables it.
5285 # This is useful to transparently resize thin-provisioned drives without
5286 # the guest OS noticing.
5288 # @node-name: graph node name on which the threshold must be set.
5290 # @write-threshold: configured threshold for the block device, bytes.
5291 #                   Use 0 to disable the threshold.
5293 # Since: 2.3
5295 # Example:
5297 # -> { "execute": "block-set-write-threshold",
5298 #      "arguments": { "node-name": "mydev",
5299 #                     "write-threshold": 17179869184 } }
5300 # <- { "return": {} }
5303 { 'command': 'block-set-write-threshold',
5304   'data': { 'node-name': 'str', 'write-threshold': 'uint64' } }
5307 # @x-blockdev-change:
5309 # Dynamically reconfigure the block driver state graph. It can be used
5310 # to add, remove, insert or replace a graph node. Currently only the
5311 # Quorum driver implements this feature to add or remove its child. This
5312 # is useful to fix a broken quorum child.
5314 # If @node is specified, it will be inserted under @parent. @child
5315 # may not be specified in this case. If both @parent and @child are
5316 # specified but @node is not, @child will be detached from @parent.
5318 # @parent: the id or name of the parent node.
5320 # @child: the name of a child under the given parent node.
5322 # @node: the name of the node that will be added.
5324 # Note: this command is experimental, and its API is not stable. It
5325 # does not support all kinds of operations, all kinds of children, nor
5326 # all block drivers.
5328 # FIXME Removing children from a quorum node means introducing gaps in the
5329 # child indices. This cannot be represented in the 'children' list of
5330 # BlockdevOptionsQuorum, as returned by .bdrv_refresh_filename().
5332 # Warning: The data in a new quorum child MUST be consistent with that of
5333 # the rest of the array.
5335 # Since: 2.7
5337 # Example:
5339 # 1. Add a new node to a quorum
5340 # -> { "execute": "blockdev-add",
5341 #      "arguments": {
5342 #          "driver": "raw",
5343 #          "node-name": "new_node",
5344 #          "file": { "driver": "file",
5345 #                    "filename": "test.raw" } } }
5346 # <- { "return": {} }
5347 # -> { "execute": "x-blockdev-change",
5348 #      "arguments": { "parent": "disk1",
5349 #                     "node": "new_node" } }
5350 # <- { "return": {} }
5352 # 2. Delete a quorum's node
5353 # -> { "execute": "x-blockdev-change",
5354 #      "arguments": { "parent": "disk1",
5355 #                     "child": "children.1" } }
5356 # <- { "return": {} }
5359 { 'command': 'x-blockdev-change',
5360   'data' : { 'parent': 'str',
5361              '*child': 'str',
5362              '*node': 'str' } }
5365 # @x-blockdev-set-iothread:
5367 # Move @node and its children into the @iothread.  If @iothread is null then
5368 # move @node and its children into the main loop.
5370 # The node must not be attached to a BlockBackend.
5372 # @node-name: the name of the block driver node
5374 # @iothread: the name of the IOThread object or null for the main loop
5376 # @force: true if the node and its children should be moved when a BlockBackend
5377 #         is already attached
5379 # Note: this command is experimental and intended for test cases that need
5380 # control over IOThreads only.
5382 # Since: 2.12
5384 # Example:
5386 # 1. Move a node into an IOThread
5387 # -> { "execute": "x-blockdev-set-iothread",
5388 #      "arguments": { "node-name": "disk1",
5389 #                     "iothread": "iothread0" } }
5390 # <- { "return": {} }
5392 # 2. Move a node into the main loop
5393 # -> { "execute": "x-blockdev-set-iothread",
5394 #      "arguments": { "node-name": "disk1",
5395 #                     "iothread": null } }
5396 # <- { "return": {} }
5399 { 'command': 'x-blockdev-set-iothread',
5400   'data' : { 'node-name': 'str',
5401              'iothread': 'StrOrNull',
5402              '*force': 'bool' } }