block/backup: add 'always' bitmap sync policy
[qemu/ar7.git] / qapi / block-core.json
blob8344fbe20309abfba84455915b14cc9477e92fa1
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 # Since: 0.14.0
366 { 'struct': 'BlockDeviceInfo',
367   'data': { 'file': 'str', '*node-name': 'str', 'ro': 'bool', 'drv': 'str',
368             '*backing_file': 'str', 'backing_file_depth': 'int',
369             'encrypted': 'bool', 'encryption_key_missing': 'bool',
370             'detect_zeroes': 'BlockdevDetectZeroesOptions',
371             'bps': 'int', 'bps_rd': 'int', 'bps_wr': 'int',
372             'iops': 'int', 'iops_rd': 'int', 'iops_wr': 'int',
373             'image': 'ImageInfo',
374             '*bps_max': 'int', '*bps_rd_max': 'int',
375             '*bps_wr_max': 'int', '*iops_max': 'int',
376             '*iops_rd_max': 'int', '*iops_wr_max': 'int',
377             '*bps_max_length': 'int', '*bps_rd_max_length': 'int',
378             '*bps_wr_max_length': 'int', '*iops_max_length': 'int',
379             '*iops_rd_max_length': 'int', '*iops_wr_max_length': 'int',
380             '*iops_size': 'int', '*group': 'str', 'cache': 'BlockdevCacheInfo',
381             'write_threshold': 'int' } }
384 # @BlockDeviceIoStatus:
386 # An enumeration of block device I/O status.
388 # @ok: The last I/O operation has succeeded
390 # @failed: The last I/O operation has failed
392 # @nospace: The last I/O operation has failed due to a no-space condition
394 # Since: 1.0
396 { 'enum': 'BlockDeviceIoStatus', 'data': [ 'ok', 'failed', 'nospace' ] }
399 # @BlockDeviceMapEntry:
401 # Entry in the metadata map of the device (returned by "qemu-img map")
403 # @start: Offset in the image of the first byte described by this entry
404 #         (in bytes)
406 # @length: Length of the range described by this entry (in bytes)
408 # @depth: Number of layers (0 = top image, 1 = top image's backing file, etc.)
409 #         before reaching one for which the range is allocated.  The value is
410 #         in the range 0 to the depth of the image chain - 1.
412 # @zero: the sectors in this range read as zeros
414 # @data: reading the image will actually read data from a file (in particular,
415 #        if @offset is present this means that the sectors are not simply
416 #        preallocated, but contain actual data in raw format)
418 # @offset: if present, the image file stores the data for this range in
419 #          raw format at the given offset.
421 # Since: 1.7
423 { 'struct': 'BlockDeviceMapEntry',
424   'data': { 'start': 'int', 'length': 'int', 'depth': 'int', 'zero': 'bool',
425             'data': 'bool', '*offset': 'int' } }
428 # @DirtyBitmapStatus:
430 # An enumeration of possible states that a dirty bitmap can report to the user.
432 # @frozen: The bitmap is currently in-use by some operation and is immutable.
433 #          If the bitmap was @active prior to the operation, new writes by the
434 #          guest are being recorded in a temporary buffer, and will not be lost.
435 #          Generally, bitmaps are cleared on successful use in an operation and
436 #          the temporary buffer is committed into the bitmap. On failure, the
437 #          temporary buffer is merged back into the bitmap without first
438 #          clearing it.
439 #          Please refer to the documentation for each bitmap-using operation,
440 #          See also @blockdev-backup, @drive-backup.
442 # @disabled: The bitmap is not currently recording new writes by the guest.
443 #            This is requested explicitly via @block-dirty-bitmap-disable.
444 #            It can still be cleared, deleted, or used for backup operations.
446 # @active: The bitmap is actively monitoring for new writes, and can be cleared,
447 #          deleted, or used for backup operations.
449 # @locked: The bitmap is currently in-use by some operation and is immutable.
450 #          If the bitmap was @active prior to the operation, it is still
451 #          recording new writes. If the bitmap was @disabled, it is not
452 #          recording new writes. (Since 2.12)
454 # @inconsistent: This is a persistent dirty bitmap that was marked in-use on
455 #                disk, and is unusable by QEMU. It can only be deleted.
456 #                Please rely on the inconsistent field in @BlockDirtyInfo
457 #                instead, as the status field is deprecated. (Since 4.0)
459 # Since: 2.4
461 { 'enum': 'DirtyBitmapStatus',
462   'data': ['active', 'disabled', 'frozen', 'locked', 'inconsistent'] }
465 # @BlockDirtyInfo:
467 # Block dirty bitmap information.
469 # @name: the name of the dirty bitmap (Since 2.4)
471 # @count: number of dirty bytes according to the dirty bitmap
473 # @granularity: granularity of the dirty bitmap in bytes (since 1.4)
475 # @status: Deprecated in favor of @recording and @locked. (since 2.4)
477 # @recording: true if the bitmap is recording new writes from the guest.
478 #             Replaces `active` and `disabled` statuses. (since 4.0)
480 # @busy: true if the bitmap is in-use by some operation (NBD or jobs)
481 #        and cannot be modified via QMP or used by another operation.
482 #        Replaces `locked` and `frozen` statuses. (since 4.0)
484 # @persistent: true if the bitmap was stored on disk, is scheduled to be stored
485 #              on disk, or both. (since 4.0)
487 # @inconsistent: true if this is a persistent bitmap that was improperly
488 #                stored. Implies @persistent to be true; @recording and
489 #                @busy to be false. This bitmap cannot be used. To remove
490 #                it, use @block-dirty-bitmap-remove. (Since 4.0)
492 # Since: 1.3
494 { 'struct': 'BlockDirtyInfo',
495   'data': {'*name': 'str', 'count': 'int', 'granularity': 'uint32',
496            'recording': 'bool', 'busy': 'bool', 'status': 'DirtyBitmapStatus',
497            'persistent': 'bool', '*inconsistent': 'bool' } }
500 # @Qcow2BitmapInfoFlags:
502 # An enumeration of flags that a bitmap can report to the user.
504 # @in-use: This flag is set by any process actively modifying the qcow2 file,
505 #          and cleared when the updated bitmap is flushed to the qcow2 image.
506 #          The presence of this flag in an offline image means that the bitmap
507 #          was not saved correctly after its last usage, and may contain
508 #          inconsistent data.
510 # @auto: The bitmap must reflect all changes of the virtual disk by any
511 #        application that would write to this qcow2 file.
513 # Since: 4.0
515 { 'enum': 'Qcow2BitmapInfoFlags',
516   'data': ['in-use', 'auto'] }
519 # @Qcow2BitmapInfo:
521 # Qcow2 bitmap information.
523 # @name: the name of the bitmap
525 # @granularity: granularity of the bitmap in bytes
527 # @flags: flags of the bitmap
529 # Since: 4.0
531 { 'struct': 'Qcow2BitmapInfo',
532   'data': {'name': 'str', 'granularity': 'uint32',
533            'flags': ['Qcow2BitmapInfoFlags'] } }
536 # @BlockLatencyHistogramInfo:
538 # Block latency histogram.
540 # @boundaries: list of interval boundary values in nanoseconds, all greater
541 #              than zero and in ascending order.
542 #              For example, the list [10, 50, 100] produces the following
543 #              histogram intervals: [0, 10), [10, 50), [50, 100), [100, +inf).
545 # @bins: list of io request counts corresponding to histogram intervals.
546 #        len(@bins) = len(@boundaries) + 1
547 #        For the example above, @bins may be something like [3, 1, 5, 2],
548 #        and corresponding histogram looks like:
550 #        5|           *
551 #        4|           *
552 #        3| *         *
553 #        2| *         *    *
554 #        1| *    *    *    *
555 #         +------------------
556 #             10   50   100
558 # Since: 4.0
560 { 'struct': 'BlockLatencyHistogramInfo',
561   'data': {'boundaries': ['uint64'], 'bins': ['uint64'] } }
564 # @block-latency-histogram-set:
566 # Manage read, write and flush latency histograms for the device.
568 # If only @id parameter is specified, remove all present latency histograms
569 # for the device. Otherwise, add/reset some of (or all) latency histograms.
571 # @id: The name or QOM path of the guest device.
573 # @boundaries: list of interval boundary values (see description in
574 #              BlockLatencyHistogramInfo definition). If specified, all
575 #              latency histograms are removed, and empty ones created for all
576 #              io types with intervals corresponding to @boundaries (except for
577 #              io types, for which specific boundaries are set through the
578 #              following parameters).
580 # @boundaries-read: list of interval boundary values for read latency
581 #                   histogram. If specified, old read latency histogram is
582 #                   removed, and empty one created with intervals
583 #                   corresponding to @boundaries-read. The parameter has higher
584 #                   priority then @boundaries.
586 # @boundaries-write: list of interval boundary values for write latency
587 #                    histogram.
589 # @boundaries-flush: list of interval boundary values for flush latency
590 #                    histogram.
592 # Returns: error if device is not found or any boundary arrays are invalid.
594 # Since: 4.0
596 # Example: set new histograms for all io types with intervals
597 # [0, 10), [10, 50), [50, 100), [100, +inf):
599 # -> { "execute": "block-latency-histogram-set",
600 #      "arguments": { "id": "drive0",
601 #                     "boundaries": [10, 50, 100] } }
602 # <- { "return": {} }
604 # Example: set new histogram only for write, other histograms will remain
605 # not changed (or not created):
607 # -> { "execute": "block-latency-histogram-set",
608 #      "arguments": { "id": "drive0",
609 #                     "boundaries-write": [10, 50, 100] } }
610 # <- { "return": {} }
612 # Example: set new histograms with the following intervals:
613 #   read, flush: [0, 10), [10, 50), [50, 100), [100, +inf)
614 #   write: [0, 1000), [1000, 5000), [5000, +inf)
616 # -> { "execute": "block-latency-histogram-set",
617 #      "arguments": { "id": "drive0",
618 #                     "boundaries": [10, 50, 100],
619 #                     "boundaries-write": [1000, 5000] } }
620 # <- { "return": {} }
622 # Example: remove all latency histograms:
624 # -> { "execute": "block-latency-histogram-set",
625 #      "arguments": { "id": "drive0" } }
626 # <- { "return": {} }
628 { 'command': 'block-latency-histogram-set',
629   'data': {'id': 'str',
630            '*boundaries': ['uint64'],
631            '*boundaries-read': ['uint64'],
632            '*boundaries-write': ['uint64'],
633            '*boundaries-flush': ['uint64'] } }
636 # @BlockInfo:
638 # Block device information.  This structure describes a virtual device and
639 # the backing device associated with it.
641 # @device: The device name associated with the virtual device.
643 # @qdev: The qdev ID, or if no ID is assigned, the QOM path of the block
644 #        device. (since 2.10)
646 # @type: This field is returned only for compatibility reasons, it should
647 #        not be used (always returns 'unknown')
649 # @removable: True if the device supports removable media.
651 # @locked: True if the guest has locked this device from having its media
652 #          removed
654 # @tray_open: True if the device's tray is open
655 #             (only present if it has a tray)
657 # @dirty-bitmaps: dirty bitmaps information (only present if the
658 #                 driver has one or more dirty bitmaps) (Since 2.0)
660 # @io-status: @BlockDeviceIoStatus. Only present if the device
661 #             supports it and the VM is configured to stop on errors
662 #             (supported device models: virtio-blk, IDE, SCSI except
663 #             scsi-generic)
665 # @inserted: @BlockDeviceInfo describing the device if media is
666 #            present
668 # Since:  0.14.0
670 { 'struct': 'BlockInfo',
671   'data': {'device': 'str', '*qdev': 'str', 'type': 'str', 'removable': 'bool',
672            'locked': 'bool', '*inserted': 'BlockDeviceInfo',
673            '*tray_open': 'bool', '*io-status': 'BlockDeviceIoStatus',
674            '*dirty-bitmaps': ['BlockDirtyInfo'] } }
677 # @BlockMeasureInfo:
679 # Image file size calculation information.  This structure describes the size
680 # requirements for creating a new image file.
682 # The size requirements depend on the new image file format.  File size always
683 # equals virtual disk size for the 'raw' format, even for sparse POSIX files.
684 # Compact formats such as 'qcow2' represent unallocated and zero regions
685 # efficiently so file size may be smaller than virtual disk size.
687 # The values are upper bounds that are guaranteed to fit the new image file.
688 # Subsequent modification, such as internal snapshot or bitmap creation, may
689 # require additional space and is not covered here.
691 # @required: Size required for a new image file, in bytes.
693 # @fully-allocated: Image file size, in bytes, once data has been written
694 #                   to all sectors.
696 # Since: 2.10
698 { 'struct': 'BlockMeasureInfo',
699   'data': {'required': 'int', 'fully-allocated': 'int'} }
702 # @query-block:
704 # Get a list of BlockInfo for all virtual block devices.
706 # Returns: a list of @BlockInfo describing each virtual block device. Filter
707 # nodes that were created implicitly are skipped over.
709 # Since: 0.14.0
711 # Example:
713 # -> { "execute": "query-block" }
714 # <- {
715 #       "return":[
716 #          {
717 #             "io-status": "ok",
718 #             "device":"ide0-hd0",
719 #             "locked":false,
720 #             "removable":false,
721 #             "inserted":{
722 #                "ro":false,
723 #                "drv":"qcow2",
724 #                "encrypted":false,
725 #                "file":"disks/test.qcow2",
726 #                "backing_file_depth":1,
727 #                "bps":1000000,
728 #                "bps_rd":0,
729 #                "bps_wr":0,
730 #                "iops":1000000,
731 #                "iops_rd":0,
732 #                "iops_wr":0,
733 #                "bps_max": 8000000,
734 #                "bps_rd_max": 0,
735 #                "bps_wr_max": 0,
736 #                "iops_max": 0,
737 #                "iops_rd_max": 0,
738 #                "iops_wr_max": 0,
739 #                "iops_size": 0,
740 #                "detect_zeroes": "on",
741 #                "write_threshold": 0,
742 #                "image":{
743 #                   "filename":"disks/test.qcow2",
744 #                   "format":"qcow2",
745 #                   "virtual-size":2048000,
746 #                   "backing_file":"base.qcow2",
747 #                   "full-backing-filename":"disks/base.qcow2",
748 #                   "backing-filename-format":"qcow2",
749 #                   "snapshots":[
750 #                      {
751 #                         "id": "1",
752 #                         "name": "snapshot1",
753 #                         "vm-state-size": 0,
754 #                         "date-sec": 10000200,
755 #                         "date-nsec": 12,
756 #                         "vm-clock-sec": 206,
757 #                         "vm-clock-nsec": 30
758 #                      }
759 #                   ],
760 #                   "backing-image":{
761 #                       "filename":"disks/base.qcow2",
762 #                       "format":"qcow2",
763 #                       "virtual-size":2048000
764 #                   }
765 #                }
766 #             },
767 #             "qdev": "ide_disk",
768 #             "type":"unknown"
769 #          },
770 #          {
771 #             "io-status": "ok",
772 #             "device":"ide1-cd0",
773 #             "locked":false,
774 #             "removable":true,
775 #             "qdev": "/machine/unattached/device[23]",
776 #             "tray_open": false,
777 #             "type":"unknown"
778 #          },
779 #          {
780 #             "device":"floppy0",
781 #             "locked":false,
782 #             "removable":true,
783 #             "qdev": "/machine/unattached/device[20]",
784 #             "type":"unknown"
785 #          },
786 #          {
787 #             "device":"sd0",
788 #             "locked":false,
789 #             "removable":true,
790 #             "type":"unknown"
791 #          }
792 #       ]
793 #    }
796 { 'command': 'query-block', 'returns': ['BlockInfo'] }
800 # @BlockDeviceTimedStats:
802 # Statistics of a block device during a given interval of time.
804 # @interval_length: Interval used for calculating the statistics,
805 #                   in seconds.
807 # @min_rd_latency_ns: Minimum latency of read operations in the
808 #                     defined interval, in nanoseconds.
810 # @min_wr_latency_ns: Minimum latency of write operations in the
811 #                     defined interval, in nanoseconds.
813 # @min_flush_latency_ns: Minimum latency of flush operations in the
814 #                        defined interval, in nanoseconds.
816 # @max_rd_latency_ns: Maximum latency of read operations in the
817 #                     defined interval, in nanoseconds.
819 # @max_wr_latency_ns: Maximum latency of write operations in the
820 #                     defined interval, in nanoseconds.
822 # @max_flush_latency_ns: Maximum latency of flush operations in the
823 #                        defined interval, in nanoseconds.
825 # @avg_rd_latency_ns: Average latency of read operations in the
826 #                     defined interval, in nanoseconds.
828 # @avg_wr_latency_ns: Average latency of write operations in the
829 #                     defined interval, in nanoseconds.
831 # @avg_flush_latency_ns: Average latency of flush operations in the
832 #                        defined interval, in nanoseconds.
834 # @avg_rd_queue_depth: Average number of pending read operations
835 #                      in the defined interval.
837 # @avg_wr_queue_depth: Average number of pending write operations
838 #                      in the defined interval.
840 # Since: 2.5
842 { 'struct': 'BlockDeviceTimedStats',
843   'data': { 'interval_length': 'int', 'min_rd_latency_ns': 'int',
844             'max_rd_latency_ns': 'int', 'avg_rd_latency_ns': 'int',
845             'min_wr_latency_ns': 'int', 'max_wr_latency_ns': 'int',
846             'avg_wr_latency_ns': 'int', 'min_flush_latency_ns': 'int',
847             'max_flush_latency_ns': 'int', 'avg_flush_latency_ns': 'int',
848             'avg_rd_queue_depth': 'number', 'avg_wr_queue_depth': 'number' } }
851 # @BlockDeviceStats:
853 # Statistics of a virtual block device or a block backing device.
855 # @rd_bytes:      The number of bytes read by the device.
857 # @wr_bytes:      The number of bytes written by the device.
859 # @rd_operations: The number of read operations performed by the device.
861 # @wr_operations: The number of write operations performed by the device.
863 # @flush_operations: The number of cache flush operations performed by the
864 #                    device (since 0.15.0)
866 # @flush_total_time_ns: Total time spend on cache flushes in nano-seconds
867 #                       (since 0.15.0).
869 # @wr_total_time_ns: Total time spend on writes in nano-seconds (since 0.15.0).
871 # @rd_total_time_ns: Total_time_spend on reads in nano-seconds (since 0.15.0).
873 # @wr_highest_offset: The offset after the greatest byte written to the
874 #                     device.  The intended use of this information is for
875 #                     growable sparse files (like qcow2) that are used on top
876 #                     of a physical device.
878 # @rd_merged: Number of read requests that have been merged into another
879 #             request (Since 2.3).
881 # @wr_merged: Number of write requests that have been merged into another
882 #             request (Since 2.3).
884 # @idle_time_ns: Time since the last I/O operation, in
885 #                nanoseconds. If the field is absent it means that
886 #                there haven't been any operations yet (Since 2.5).
888 # @failed_rd_operations: The number of failed read operations
889 #                        performed by the device (Since 2.5)
891 # @failed_wr_operations: The number of failed write operations
892 #                        performed by the device (Since 2.5)
894 # @failed_flush_operations: The number of failed flush operations
895 #                           performed by the device (Since 2.5)
897 # @invalid_rd_operations: The number of invalid read operations
898 #                          performed by the device (Since 2.5)
900 # @invalid_wr_operations: The number of invalid write operations
901 #                         performed by the device (Since 2.5)
903 # @invalid_flush_operations: The number of invalid flush operations
904 #                            performed by the device (Since 2.5)
906 # @account_invalid: Whether invalid operations are included in the
907 #                   last access statistics (Since 2.5)
909 # @account_failed: Whether failed operations are included in the
910 #                  latency and last access statistics (Since 2.5)
912 # @timed_stats: Statistics specific to the set of previously defined
913 #               intervals of time (Since 2.5)
915 # @rd_latency_histogram: @BlockLatencyHistogramInfo. (Since 4.0)
917 # @wr_latency_histogram: @BlockLatencyHistogramInfo. (Since 4.0)
919 # @flush_latency_histogram: @BlockLatencyHistogramInfo. (Since 4.0)
921 # Since: 0.14.0
923 { 'struct': 'BlockDeviceStats',
924   'data': {'rd_bytes': 'int', 'wr_bytes': 'int', 'rd_operations': 'int',
925            'wr_operations': 'int', 'flush_operations': 'int',
926            'flush_total_time_ns': 'int', 'wr_total_time_ns': 'int',
927            'rd_total_time_ns': 'int', 'wr_highest_offset': 'int',
928            'rd_merged': 'int', 'wr_merged': 'int', '*idle_time_ns': 'int',
929            'failed_rd_operations': 'int', 'failed_wr_operations': 'int',
930            'failed_flush_operations': 'int', 'invalid_rd_operations': 'int',
931            'invalid_wr_operations': 'int', 'invalid_flush_operations': 'int',
932            'account_invalid': 'bool', 'account_failed': 'bool',
933            'timed_stats': ['BlockDeviceTimedStats'],
934            '*rd_latency_histogram': 'BlockLatencyHistogramInfo',
935            '*wr_latency_histogram': 'BlockLatencyHistogramInfo',
936            '*flush_latency_histogram': 'BlockLatencyHistogramInfo' } }
939 # @BlockStats:
941 # Statistics of a virtual block device or a block backing device.
943 # @device: If the stats are for a virtual block device, the name
944 #          corresponding to the virtual block device.
946 # @node-name: The node name of the device. (Since 2.3)
948 # @qdev: The qdev ID, or if no ID is assigned, the QOM path of the block
949 #        device. (since 3.0)
951 # @stats:  A @BlockDeviceStats for the device.
953 # @parent: This describes the file block device if it has one.
954 #          Contains recursively the statistics of the underlying
955 #          protocol (e.g. the host file for a qcow2 image). If there is
956 #          no underlying protocol, this field is omitted
958 # @backing: This describes the backing block device if it has one.
959 #           (Since 2.0)
961 # Since: 0.14.0
963 { 'struct': 'BlockStats',
964   'data': {'*device': 'str', '*qdev': 'str', '*node-name': 'str',
965            'stats': 'BlockDeviceStats',
966            '*parent': 'BlockStats',
967            '*backing': 'BlockStats'} }
970 # @query-blockstats:
972 # Query the @BlockStats for all virtual block devices.
974 # @query-nodes: If true, the command will query all the block nodes
975 #               that have a node name, in a list which will include "parent"
976 #               information, but not "backing".
977 #               If false or omitted, the behavior is as before - query all the
978 #               device backends, recursively including their "parent" and
979 #               "backing". Filter nodes that were created implicitly are
980 #               skipped over in this mode. (Since 2.3)
982 # Returns: A list of @BlockStats for each virtual block devices.
984 # Since: 0.14.0
986 # Example:
988 # -> { "execute": "query-blockstats" }
989 # <- {
990 #       "return":[
991 #          {
992 #             "device":"ide0-hd0",
993 #             "parent":{
994 #                "stats":{
995 #                   "wr_highest_offset":3686448128,
996 #                   "wr_bytes":9786368,
997 #                   "wr_operations":751,
998 #                   "rd_bytes":122567168,
999 #                   "rd_operations":36772
1000 #                   "wr_total_times_ns":313253456
1001 #                   "rd_total_times_ns":3465673657
1002 #                   "flush_total_times_ns":49653
1003 #                   "flush_operations":61,
1004 #                   "rd_merged":0,
1005 #                   "wr_merged":0,
1006 #                   "idle_time_ns":2953431879,
1007 #                   "account_invalid":true,
1008 #                   "account_failed":false
1009 #                }
1010 #             },
1011 #             "stats":{
1012 #                "wr_highest_offset":2821110784,
1013 #                "wr_bytes":9786368,
1014 #                "wr_operations":692,
1015 #                "rd_bytes":122739200,
1016 #                "rd_operations":36604
1017 #                "flush_operations":51,
1018 #                "wr_total_times_ns":313253456
1019 #                "rd_total_times_ns":3465673657
1020 #                "flush_total_times_ns":49653,
1021 #                "rd_merged":0,
1022 #                "wr_merged":0,
1023 #                "idle_time_ns":2953431879,
1024 #                "account_invalid":true,
1025 #                "account_failed":false
1026 #             },
1027 #             "qdev": "/machine/unattached/device[23]"
1028 #          },
1029 #          {
1030 #             "device":"ide1-cd0",
1031 #             "stats":{
1032 #                "wr_highest_offset":0,
1033 #                "wr_bytes":0,
1034 #                "wr_operations":0,
1035 #                "rd_bytes":0,
1036 #                "rd_operations":0
1037 #                "flush_operations":0,
1038 #                "wr_total_times_ns":0
1039 #                "rd_total_times_ns":0
1040 #                "flush_total_times_ns":0,
1041 #                "rd_merged":0,
1042 #                "wr_merged":0,
1043 #                "account_invalid":false,
1044 #                "account_failed":false
1045 #             },
1046 #             "qdev": "/machine/unattached/device[24]"
1047 #          },
1048 #          {
1049 #             "device":"floppy0",
1050 #             "stats":{
1051 #                "wr_highest_offset":0,
1052 #                "wr_bytes":0,
1053 #                "wr_operations":0,
1054 #                "rd_bytes":0,
1055 #                "rd_operations":0
1056 #                "flush_operations":0,
1057 #                "wr_total_times_ns":0
1058 #                "rd_total_times_ns":0
1059 #                "flush_total_times_ns":0,
1060 #                "rd_merged":0,
1061 #                "wr_merged":0,
1062 #                "account_invalid":false,
1063 #                "account_failed":false
1064 #             },
1065 #             "qdev": "/machine/unattached/device[16]"
1066 #          },
1067 #          {
1068 #             "device":"sd0",
1069 #             "stats":{
1070 #                "wr_highest_offset":0,
1071 #                "wr_bytes":0,
1072 #                "wr_operations":0,
1073 #                "rd_bytes":0,
1074 #                "rd_operations":0
1075 #                "flush_operations":0,
1076 #                "wr_total_times_ns":0
1077 #                "rd_total_times_ns":0
1078 #                "flush_total_times_ns":0,
1079 #                "rd_merged":0,
1080 #                "wr_merged":0,
1081 #                "account_invalid":false,
1082 #                "account_failed":false
1083 #             }
1084 #          }
1085 #       ]
1086 #    }
1089 { 'command': 'query-blockstats',
1090   'data': { '*query-nodes': 'bool' },
1091   'returns': ['BlockStats'] }
1094 # @BlockdevOnError:
1096 # An enumeration of possible behaviors for errors on I/O operations.
1097 # The exact meaning depends on whether the I/O was initiated by a guest
1098 # or by a block job
1100 # @report: for guest operations, report the error to the guest;
1101 #          for jobs, cancel the job
1103 # @ignore: ignore the error, only report a QMP event (BLOCK_IO_ERROR
1104 #          or BLOCK_JOB_ERROR)
1106 # @enospc: same as @stop on ENOSPC, same as @report otherwise.
1108 # @stop: for guest operations, stop the virtual machine;
1109 #        for jobs, pause the job
1111 # @auto: inherit the error handling policy of the backend (since: 2.7)
1113 # Since: 1.3
1115 { 'enum': 'BlockdevOnError',
1116   'data': ['report', 'ignore', 'enospc', 'stop', 'auto'] }
1119 # @MirrorSyncMode:
1121 # An enumeration of possible behaviors for the initial synchronization
1122 # phase of storage mirroring.
1124 # @top: copies data in the topmost image to the destination
1126 # @full: copies data from all images to the destination
1128 # @none: only copy data written from now on
1130 # @incremental: only copy data described by the dirty bitmap. (since: 2.4)
1132 # @bitmap: only copy data described by the dirty bitmap. (since: 4.2)
1133 #          Behavior on completion is determined by the BitmapSyncMode.
1135 # Since: 1.3
1137 { 'enum': 'MirrorSyncMode',
1138   'data': ['top', 'full', 'none', 'incremental', 'bitmap'] }
1141 # @BitmapSyncMode:
1143 # An enumeration of possible behaviors for the synchronization of a bitmap
1144 # when used for data copy operations.
1146 # @on-success: The bitmap is only synced when the operation is successful.
1147 #              This is the behavior always used for 'INCREMENTAL' backups.
1149 # @never: The bitmap is never synchronized with the operation, and is
1150 #         treated solely as a read-only manifest of blocks to copy.
1152 # @always: The bitmap is always synchronized with the operation,
1153 #          regardless of whether or not the operation was successful.
1155 # Since: 4.2
1157 { 'enum': 'BitmapSyncMode',
1158   'data': ['on-success', 'never', 'always'] }
1161 # @MirrorCopyMode:
1163 # An enumeration whose values tell the mirror block job when to
1164 # trigger writes to the target.
1166 # @background: copy data in background only.
1168 # @write-blocking: when data is written to the source, write it
1169 #                  (synchronously) to the target as well.  In
1170 #                  addition, data is copied in background just like in
1171 #                  @background mode.
1173 # Since: 3.0
1175 { 'enum': 'MirrorCopyMode',
1176   'data': ['background', 'write-blocking'] }
1179 # @BlockJobInfo:
1181 # Information about a long-running block device operation.
1183 # @type: the job type ('stream' for image streaming)
1185 # @device: The job identifier. Originally the device name but other
1186 #          values are allowed since QEMU 2.7
1188 # @len: Estimated @offset value at the completion of the job. This value can
1189 #       arbitrarily change while the job is running, in both directions.
1191 # @offset: Progress made until now. The unit is arbitrary and the value can
1192 #          only meaningfully be used for the ratio of @offset to @len. The
1193 #          value is monotonically increasing.
1195 # @busy: false if the job is known to be in a quiescent state, with
1196 #        no pending I/O.  Since 1.3.
1198 # @paused: whether the job is paused or, if @busy is true, will
1199 #          pause itself as soon as possible.  Since 1.3.
1201 # @speed: the rate limit, bytes per second
1203 # @io-status: the status of the job (since 1.3)
1205 # @ready: true if the job may be completed (since 2.2)
1207 # @status: Current job state/status (since 2.12)
1209 # @auto-finalize: Job will finalize itself when PENDING, moving to
1210 #                 the CONCLUDED state. (since 2.12)
1212 # @auto-dismiss: Job will dismiss itself when CONCLUDED, moving to the NULL
1213 #                state and disappearing from the query list. (since 2.12)
1215 # @error: Error information if the job did not complete successfully.
1216 #         Not set if the job completed successfully. (since 2.12.1)
1218 # Since: 1.1
1220 { 'struct': 'BlockJobInfo',
1221   'data': {'type': 'str', 'device': 'str', 'len': 'int',
1222            'offset': 'int', 'busy': 'bool', 'paused': 'bool', 'speed': 'int',
1223            'io-status': 'BlockDeviceIoStatus', 'ready': 'bool',
1224            'status': 'JobStatus',
1225            'auto-finalize': 'bool', 'auto-dismiss': 'bool',
1226            '*error': 'str' } }
1229 # @query-block-jobs:
1231 # Return information about long-running block device operations.
1233 # Returns: a list of @BlockJobInfo for each active block job
1235 # Since: 1.1
1237 { 'command': 'query-block-jobs', 'returns': ['BlockJobInfo'] }
1240 # @block_passwd:
1242 # This command sets the password of a block device that has not been open
1243 # with a password and requires one.
1245 # This command is now obsolete and will always return an error since 2.10
1248 { 'command': 'block_passwd',
1249   'data': { '*device': 'str',
1250             '*node-name': 'str',
1251             'password': 'str' } }
1254 # @block_resize:
1256 # Resize a block image while a guest is running.
1258 # Either @device or @node-name must be set but not both.
1260 # @device: the name of the device to get the image resized
1262 # @node-name: graph node name to get the image resized (Since 2.0)
1264 # @size:  new image size in bytes
1266 # Returns: nothing on success
1267 #          If @device is not a valid block device, DeviceNotFound
1269 # Since: 0.14.0
1271 # Example:
1273 # -> { "execute": "block_resize",
1274 #      "arguments": { "device": "scratch", "size": 1073741824 } }
1275 # <- { "return": {} }
1278 { 'command': 'block_resize',
1279   'data': { '*device': 'str',
1280             '*node-name': 'str',
1281             'size': 'int' } }
1284 # @NewImageMode:
1286 # An enumeration that tells QEMU how to set the backing file path in
1287 # a new image file.
1289 # @existing: QEMU should look for an existing image file.
1291 # @absolute-paths: QEMU should create a new image with absolute paths
1292 # for the backing file. If there is no backing file available, the new
1293 # image will not be backed either.
1295 # Since: 1.1
1297 { 'enum': 'NewImageMode',
1298   'data': [ 'existing', 'absolute-paths' ] }
1301 # @BlockdevSnapshotSync:
1303 # Either @device or @node-name must be set but not both.
1305 # @device: the name of the device to take a snapshot of.
1307 # @node-name: graph node name to generate the snapshot from (Since 2.0)
1309 # @snapshot-file: the target of the new overlay image. If the file
1310 # exists, or if it is a device, the overlay will be created in the
1311 # existing file/device. Otherwise, a new file will be created.
1313 # @snapshot-node-name: the graph node name of the new image (Since 2.0)
1315 # @format: the format of the overlay image, default is 'qcow2'.
1317 # @mode: whether and how QEMU should create a new image, default is
1318 #        'absolute-paths'.
1320 { 'struct': 'BlockdevSnapshotSync',
1321   'data': { '*device': 'str', '*node-name': 'str',
1322             'snapshot-file': 'str', '*snapshot-node-name': 'str',
1323             '*format': 'str', '*mode': 'NewImageMode' } }
1326 # @BlockdevSnapshot:
1328 # @node: device or node name that will have a snapshot taken.
1330 # @overlay: reference to the existing block device that will become
1331 #           the overlay of @node, as part of taking the snapshot.
1332 #           It must not have a current backing file (this can be
1333 #           achieved by passing "backing": null to blockdev-add).
1335 # Since: 2.5
1337 { 'struct': 'BlockdevSnapshot',
1338   'data': { 'node': 'str', 'overlay': 'str' } }
1341 # @BackupCommon:
1343 # @job-id: identifier for the newly-created block job. If
1344 #          omitted, the device name will be used. (Since 2.7)
1346 # @device: the device name or node-name of a root node which should be copied.
1348 # @sync: what parts of the disk image should be copied to the destination
1349 #        (all the disk, only the sectors allocated in the topmost image, from a
1350 #        dirty bitmap, or only new I/O).
1352 # @speed: the maximum speed, in bytes per second. The default is 0,
1353 #         for unlimited.
1355 # @bitmap: the name of a dirty bitmap if sync is "bitmap" or "incremental".
1356 #          Must be present if sync is "bitmap" or "incremental".
1357 #          Must not be present otherwise.
1358 #          (Since 2.4 (drive-backup), 3.1 (blockdev-backup))
1360 # @bitmap-mode: Specifies the type of data the bitmap should contain after
1361 #               the operation concludes. Must be present if sync is "bitmap".
1362 #               Must NOT be present otherwise. (Since 4.2)
1364 # @compress: true to compress data, if the target format supports it.
1365 #            (default: false) (since 2.8)
1367 # @on-source-error: the action to take on an error on the source,
1368 #                   default 'report'.  'stop' and 'enospc' can only be used
1369 #                   if the block device supports io-status (see BlockInfo).
1371 # @on-target-error: the action to take on an error on the target,
1372 #                   default 'report' (no limitations, since this applies to
1373 #                   a different block device than @device).
1375 # @auto-finalize: When false, this job will wait in a PENDING state after it has
1376 #                 finished its work, waiting for @block-job-finalize before
1377 #                 making any block graph changes.
1378 #                 When true, this job will automatically
1379 #                 perform its abort or commit actions.
1380 #                 Defaults to true. (Since 2.12)
1382 # @auto-dismiss: When false, this job will wait in a CONCLUDED state after it
1383 #                has completely ceased all work, and awaits @block-job-dismiss.
1384 #                When true, this job will automatically disappear from the query
1385 #                list without user intervention.
1386 #                Defaults to true. (Since 2.12)
1388 # Note: @on-source-error and @on-target-error only affect background
1389 # I/O.  If an error occurs during a guest write request, the device's
1390 # rerror/werror actions will be used.
1392 # Since: 4.2
1394 { 'struct': 'BackupCommon',
1395   'data': { '*job-id': 'str', 'device': 'str',
1396             'sync': 'MirrorSyncMode', '*speed': 'int',
1397             '*bitmap': 'str', '*bitmap-mode': 'BitmapSyncMode',
1398             '*compress': 'bool',
1399             '*on-source-error': 'BlockdevOnError',
1400             '*on-target-error': 'BlockdevOnError',
1401             '*auto-finalize': 'bool', '*auto-dismiss': 'bool' } }
1404 # @DriveBackup:
1406 # @target: the target of the new image. If the file exists, or if it
1407 #          is a device, the existing file/device will be used as the new
1408 #          destination.  If it does not exist, a new file will be created.
1410 # @format: the format of the new destination, default is to
1411 #          probe if @mode is 'existing', else the format of the source
1413 # @mode: whether and how QEMU should create a new image, default is
1414 #        'absolute-paths'.
1416 # Since: 1.6
1418 { 'struct': 'DriveBackup',
1419   'base': 'BackupCommon',
1420   'data': { 'target': 'str',
1421             '*format': 'str',
1422             '*mode': 'NewImageMode' } }
1425 # @BlockdevBackup:
1427 # @target: the device name or node-name of the backup target node.
1429 # Since: 2.3
1431 { 'struct': 'BlockdevBackup',
1432   'base': 'BackupCommon',
1433   'data': { 'target': 'str' } }
1436 # @blockdev-snapshot-sync:
1438 # Takes a synchronous snapshot of a block device.
1440 # For the arguments, see the documentation of BlockdevSnapshotSync.
1442 # Returns: nothing on success
1443 #          If @device is not a valid block device, DeviceNotFound
1445 # Since: 0.14.0
1447 # Example:
1449 # -> { "execute": "blockdev-snapshot-sync",
1450 #      "arguments": { "device": "ide-hd0",
1451 #                     "snapshot-file":
1452 #                     "/some/place/my-image",
1453 #                     "format": "qcow2" } }
1454 # <- { "return": {} }
1457 { 'command': 'blockdev-snapshot-sync',
1458   'data': 'BlockdevSnapshotSync' }
1462 # @blockdev-snapshot:
1464 # Takes a snapshot of a block device.
1466 # Take a snapshot, by installing 'node' as the backing image of
1467 # 'overlay'. Additionally, if 'node' is associated with a block
1468 # device, the block device changes to using 'overlay' as its new active
1469 # image.
1471 # For the arguments, see the documentation of BlockdevSnapshot.
1473 # Since: 2.5
1475 # Example:
1477 # -> { "execute": "blockdev-add",
1478 #      "arguments": { "driver": "qcow2",
1479 #                     "node-name": "node1534",
1480 #                     "file": { "driver": "file",
1481 #                               "filename": "hd1.qcow2" },
1482 #                     "backing": null } }
1484 # <- { "return": {} }
1486 # -> { "execute": "blockdev-snapshot",
1487 #      "arguments": { "node": "ide-hd0",
1488 #                     "overlay": "node1534" } }
1489 # <- { "return": {} }
1492 { 'command': 'blockdev-snapshot',
1493   'data': 'BlockdevSnapshot' }
1496 # @change-backing-file:
1498 # Change the backing file in the image file metadata.  This does not
1499 # cause QEMU to reopen the image file to reparse the backing filename
1500 # (it may, however, perform a reopen to change permissions from
1501 # r/o -> r/w -> r/o, if needed). The new backing file string is written
1502 # into the image file metadata, and the QEMU internal strings are
1503 # updated.
1505 # @image-node-name: The name of the block driver state node of the
1506 #                   image to modify. The "device" argument is used
1507 #                   to verify "image-node-name" is in the chain
1508 #                   described by "device".
1510 # @device:          The device name or node-name of the root node that owns
1511 #                   image-node-name.
1513 # @backing-file:    The string to write as the backing file.  This
1514 #                   string is not validated, so care should be taken
1515 #                   when specifying the string or the image chain may
1516 #                   not be able to be reopened again.
1518 # Returns: Nothing on success
1520 #          If "device" does not exist or cannot be determined, DeviceNotFound
1522 # Since: 2.1
1524 { 'command': 'change-backing-file',
1525   'data': { 'device': 'str', 'image-node-name': 'str',
1526             'backing-file': 'str' } }
1529 # @block-commit:
1531 # Live commit of data from overlay image nodes into backing nodes - i.e.,
1532 # writes data between 'top' and 'base' into 'base'.
1534 # @job-id: identifier for the newly-created block job. If
1535 #          omitted, the device name will be used. (Since 2.7)
1537 # @device:  the device name or node-name of a root node
1539 # @base-node: The node name of the backing image to write data into.
1540 #             If not specified, this is the deepest backing image.
1541 #             (since: 3.1)
1543 # @base: Same as @base-node, except that it is a file name rather than a node
1544 #        name. This must be the exact filename string that was used to open the
1545 #        node; other strings, even if addressing the same file, are not
1546 #        accepted (deprecated, use @base-node instead)
1548 # @top-node: The node name of the backing image within the image chain
1549 #            which contains the topmost data to be committed down. If
1550 #            not specified, this is the active layer. (since: 3.1)
1552 # @top: Same as @top-node, except that it is a file name rather than a node
1553 #       name. This must be the exact filename string that was used to open the
1554 #       node; other strings, even if addressing the same file, are not
1555 #       accepted (deprecated, use @base-node instead)
1557 # @backing-file:  The backing file string to write into the overlay
1558 #                           image of 'top'.  If 'top' is the active layer,
1559 #                           specifying a backing file string is an error. This
1560 #                           filename is not validated.
1562 #                           If a pathname string is such that it cannot be
1563 #                           resolved by QEMU, that means that subsequent QMP or
1564 #                           HMP commands must use node-names for the image in
1565 #                           question, as filename lookup methods will fail.
1567 #                           If not specified, QEMU will automatically determine
1568 #                           the backing file string to use, or error out if
1569 #                           there is no obvious choice. Care should be taken
1570 #                           when specifying the string, to specify a valid
1571 #                           filename or protocol.
1572 #                           (Since 2.1)
1574 #                    If top == base, that is an error.
1575 #                    If top == active, the job will not be completed by itself,
1576 #                    user needs to complete the job with the block-job-complete
1577 #                    command after getting the ready event. (Since 2.0)
1579 #                    If the base image is smaller than top, then the base image
1580 #                    will be resized to be the same size as top.  If top is
1581 #                    smaller than the base image, the base will not be
1582 #                    truncated.  If you want the base image size to match the
1583 #                    size of the smaller top, you can safely truncate it
1584 #                    yourself once the commit operation successfully completes.
1586 # @speed:  the maximum speed, in bytes per second
1588 # @filter-node-name: the node name that should be assigned to the
1589 #                    filter driver that the commit job inserts into the graph
1590 #                    above @top. If this option is not given, a node name is
1591 #                    autogenerated. (Since: 2.9)
1593 # @auto-finalize: When false, this job will wait in a PENDING state after it has
1594 #                 finished its work, waiting for @block-job-finalize before
1595 #                 making any block graph changes.
1596 #                 When true, this job will automatically
1597 #                 perform its abort or commit actions.
1598 #                 Defaults to true. (Since 3.1)
1600 # @auto-dismiss: When false, this job will wait in a CONCLUDED state after it
1601 #                has completely ceased all work, and awaits @block-job-dismiss.
1602 #                When true, this job will automatically disappear from the query
1603 #                list without user intervention.
1604 #                Defaults to true. (Since 3.1)
1606 # Returns: Nothing on success
1607 #          If @device does not exist, DeviceNotFound
1608 #          Any other error returns a GenericError.
1610 # Since: 1.3
1612 # Example:
1614 # -> { "execute": "block-commit",
1615 #      "arguments": { "device": "virtio0",
1616 #                     "top": "/tmp/snap1.qcow2" } }
1617 # <- { "return": {} }
1620 { 'command': 'block-commit',
1621   'data': { '*job-id': 'str', 'device': 'str', '*base-node': 'str',
1622             '*base': 'str', '*top-node': 'str', '*top': 'str',
1623             '*backing-file': 'str', '*speed': 'int',
1624             '*filter-node-name': 'str',
1625             '*auto-finalize': 'bool', '*auto-dismiss': 'bool' } }
1628 # @drive-backup:
1630 # Start a point-in-time copy of a block device to a new destination.  The
1631 # status of ongoing drive-backup operations can be checked with
1632 # query-block-jobs where the BlockJobInfo.type field has the value 'backup'.
1633 # The operation can be stopped before it has completed using the
1634 # block-job-cancel command.
1636 # Returns: nothing on success
1637 #          If @device is not a valid block device, GenericError
1639 # Since: 1.6
1641 # Example:
1643 # -> { "execute": "drive-backup",
1644 #      "arguments": { "device": "drive0",
1645 #                     "sync": "full",
1646 #                     "target": "backup.img" } }
1647 # <- { "return": {} }
1650 { 'command': 'drive-backup', 'boxed': true,
1651   'data': 'DriveBackup' }
1654 # @blockdev-backup:
1656 # Start a point-in-time copy of a block device to a new destination.  The
1657 # status of ongoing blockdev-backup operations can be checked with
1658 # query-block-jobs where the BlockJobInfo.type field has the value 'backup'.
1659 # The operation can be stopped before it has completed using the
1660 # block-job-cancel command.
1662 # Returns: nothing on success
1663 #          If @device is not a valid block device, DeviceNotFound
1665 # Since: 2.3
1667 # Example:
1668 # -> { "execute": "blockdev-backup",
1669 #      "arguments": { "device": "src-id",
1670 #                     "sync": "full",
1671 #                     "target": "tgt-id" } }
1672 # <- { "return": {} }
1675 { 'command': 'blockdev-backup', 'boxed': true,
1676   'data': 'BlockdevBackup' }
1680 # @query-named-block-nodes:
1682 # Get the named block driver list
1684 # Returns: the list of BlockDeviceInfo
1686 # Since: 2.0
1688 # Example:
1690 # -> { "execute": "query-named-block-nodes" }
1691 # <- { "return": [ { "ro":false,
1692 #                    "drv":"qcow2",
1693 #                    "encrypted":false,
1694 #                    "file":"disks/test.qcow2",
1695 #                    "node-name": "my-node",
1696 #                    "backing_file_depth":1,
1697 #                    "bps":1000000,
1698 #                    "bps_rd":0,
1699 #                    "bps_wr":0,
1700 #                    "iops":1000000,
1701 #                    "iops_rd":0,
1702 #                    "iops_wr":0,
1703 #                    "bps_max": 8000000,
1704 #                    "bps_rd_max": 0,
1705 #                    "bps_wr_max": 0,
1706 #                    "iops_max": 0,
1707 #                    "iops_rd_max": 0,
1708 #                    "iops_wr_max": 0,
1709 #                    "iops_size": 0,
1710 #                    "write_threshold": 0,
1711 #                    "image":{
1712 #                       "filename":"disks/test.qcow2",
1713 #                       "format":"qcow2",
1714 #                       "virtual-size":2048000,
1715 #                       "backing_file":"base.qcow2",
1716 #                       "full-backing-filename":"disks/base.qcow2",
1717 #                       "backing-filename-format":"qcow2",
1718 #                       "snapshots":[
1719 #                          {
1720 #                             "id": "1",
1721 #                             "name": "snapshot1",
1722 #                             "vm-state-size": 0,
1723 #                             "date-sec": 10000200,
1724 #                             "date-nsec": 12,
1725 #                             "vm-clock-sec": 206,
1726 #                             "vm-clock-nsec": 30
1727 #                          }
1728 #                       ],
1729 #                       "backing-image":{
1730 #                           "filename":"disks/base.qcow2",
1731 #                           "format":"qcow2",
1732 #                           "virtual-size":2048000
1733 #                       }
1734 #                    } } ] }
1737 { 'command': 'query-named-block-nodes', 'returns': [ 'BlockDeviceInfo' ] }
1740 # @XDbgBlockGraphNodeType:
1742 # @block-backend: corresponds to BlockBackend
1744 # @block-job: corresonds to BlockJob
1746 # @block-driver: corresponds to BlockDriverState
1748 # Since: 4.0
1750 { 'enum': 'XDbgBlockGraphNodeType',
1751   'data': [ 'block-backend', 'block-job', 'block-driver' ] }
1754 # @XDbgBlockGraphNode:
1756 # @id: Block graph node identifier. This @id is generated only for
1757 #      x-debug-query-block-graph and does not relate to any other identifiers in
1758 #      Qemu.
1760 # @type: Type of graph node. Can be one of block-backend, block-job or
1761 #        block-driver-state.
1763 # @name: Human readable name of the node. Corresponds to node-name for
1764 #        block-driver-state nodes; is not guaranteed to be unique in the whole
1765 #        graph (with block-jobs and block-backends).
1767 # Since: 4.0
1769 { 'struct': 'XDbgBlockGraphNode',
1770   'data': { 'id': 'uint64', 'type': 'XDbgBlockGraphNodeType', 'name': 'str' } }
1773 # @BlockPermission:
1775 # Enum of base block permissions.
1777 # @consistent-read: A user that has the "permission" of consistent reads is
1778 #                   guaranteed that their view of the contents of the block
1779 #                   device is complete and self-consistent, representing the
1780 #                   contents of a disk at a specific point.
1781 #                   For most block devices (including their backing files) this
1782 #                   is true, but the property cannot be maintained in a few
1783 #                   situations like for intermediate nodes of a commit block
1784 #                   job.
1786 # @write: This permission is required to change the visible disk contents.
1788 # @write-unchanged: This permission (which is weaker than BLK_PERM_WRITE) is
1789 #                   both enough and required for writes to the block node when
1790 #                   the caller promises that the visible disk content doesn't
1791 #                   change.
1792 #                   As the BLK_PERM_WRITE permission is strictly stronger,
1793 #                   either is sufficient to perform an unchanging write.
1795 # @resize: This permission is required to change the size of a block node.
1797 # @graph-mod: This permission is required to change the node that this
1798 #             BdrvChild points to.
1800 # Since: 4.0
1802   { 'enum': 'BlockPermission',
1803     'data': [ 'consistent-read', 'write', 'write-unchanged', 'resize',
1804               'graph-mod' ] }
1806 # @XDbgBlockGraphEdge:
1808 # Block Graph edge description for x-debug-query-block-graph.
1810 # @parent: parent id
1812 # @child: child id
1814 # @name: name of the relation (examples are 'file' and 'backing')
1816 # @perm: granted permissions for the parent operating on the child
1818 # @shared-perm: permissions that can still be granted to other users of the
1819 #               child while it is still attached to this parent
1821 # Since: 4.0
1823 { 'struct': 'XDbgBlockGraphEdge',
1824   'data': { 'parent': 'uint64', 'child': 'uint64',
1825             'name': 'str', 'perm': [ 'BlockPermission' ],
1826             'shared-perm': [ 'BlockPermission' ] } }
1829 # @XDbgBlockGraph:
1831 # Block Graph - list of nodes and list of edges.
1833 # Since: 4.0
1835 { 'struct': 'XDbgBlockGraph',
1836   'data': { 'nodes': ['XDbgBlockGraphNode'], 'edges': ['XDbgBlockGraphEdge'] } }
1839 # @x-debug-query-block-graph:
1841 # Get the block graph.
1843 # Since: 4.0
1845 { 'command': 'x-debug-query-block-graph', 'returns': 'XDbgBlockGraph' }
1848 # @drive-mirror:
1850 # Start mirroring a block device's writes to a new destination. target
1851 # specifies the target of the new image. If the file exists, or if it
1852 # is a device, it will be used as the new destination for writes. If
1853 # it does not exist, a new file will be created. format specifies the
1854 # format of the mirror image, default is to probe if mode='existing',
1855 # else the format of the source.
1857 # Returns: nothing on success
1858 #          If @device is not a valid block device, GenericError
1860 # Since: 1.3
1862 # Example:
1864 # -> { "execute": "drive-mirror",
1865 #      "arguments": { "device": "ide-hd0",
1866 #                     "target": "/some/place/my-image",
1867 #                     "sync": "full",
1868 #                     "format": "qcow2" } }
1869 # <- { "return": {} }
1872 { 'command': 'drive-mirror', 'boxed': true,
1873   'data': 'DriveMirror' }
1876 # @DriveMirror:
1878 # A set of parameters describing drive mirror setup.
1880 # @job-id: identifier for the newly-created block job. If
1881 #          omitted, the device name will be used. (Since 2.7)
1883 # @device:  the device name or node-name of a root node whose writes should be
1884 #           mirrored.
1886 # @target: the target of the new image. If the file exists, or if it
1887 #          is a device, the existing file/device will be used as the new
1888 #          destination.  If it does not exist, a new file will be created.
1890 # @format: the format of the new destination, default is to
1891 #          probe if @mode is 'existing', else the format of the source
1893 # @node-name: the new block driver state node name in the graph
1894 #             (Since 2.1)
1896 # @replaces: with sync=full graph node name to be replaced by the new
1897 #            image when a whole image copy is done. This can be used to repair
1898 #            broken Quorum files. (Since 2.1)
1900 # @mode: whether and how QEMU should create a new image, default is
1901 #        'absolute-paths'.
1903 # @speed:  the maximum speed, in bytes per second
1905 # @sync: what parts of the disk image should be copied to the destination
1906 #        (all the disk, only the sectors allocated in the topmost image, or
1907 #        only new I/O).
1909 # @granularity: granularity of the dirty bitmap, default is 64K
1910 #               if the image format doesn't have clusters, 4K if the clusters
1911 #               are smaller than that, else the cluster size.  Must be a
1912 #               power of 2 between 512 and 64M (since 1.4).
1914 # @buf-size: maximum amount of data in flight from source to
1915 #            target (since 1.4).
1917 # @on-source-error: the action to take on an error on the source,
1918 #                   default 'report'.  'stop' and 'enospc' can only be used
1919 #                   if the block device supports io-status (see BlockInfo).
1921 # @on-target-error: the action to take on an error on the target,
1922 #                   default 'report' (no limitations, since this applies to
1923 #                   a different block device than @device).
1924 # @unmap: Whether to try to unmap target sectors where source has
1925 #         only zero. If true, and target unallocated sectors will read as zero,
1926 #         target image sectors will be unmapped; otherwise, zeroes will be
1927 #         written. Both will result in identical contents.
1928 #         Default is true. (Since 2.4)
1930 # @copy-mode: when to copy data to the destination; defaults to 'background'
1931 #             (Since: 3.0)
1933 # @auto-finalize: When false, this job will wait in a PENDING state after it has
1934 #                 finished its work, waiting for @block-job-finalize before
1935 #                 making any block graph changes.
1936 #                 When true, this job will automatically
1937 #                 perform its abort or commit actions.
1938 #                 Defaults to true. (Since 3.1)
1940 # @auto-dismiss: When false, this job will wait in a CONCLUDED state after it
1941 #                has completely ceased all work, and awaits @block-job-dismiss.
1942 #                When true, this job will automatically disappear from the query
1943 #                list without user intervention.
1944 #                Defaults to true. (Since 3.1)
1945 # Since: 1.3
1947 { 'struct': 'DriveMirror',
1948   'data': { '*job-id': 'str', 'device': 'str', 'target': 'str',
1949             '*format': 'str', '*node-name': 'str', '*replaces': 'str',
1950             'sync': 'MirrorSyncMode', '*mode': 'NewImageMode',
1951             '*speed': 'int', '*granularity': 'uint32',
1952             '*buf-size': 'int', '*on-source-error': 'BlockdevOnError',
1953             '*on-target-error': 'BlockdevOnError',
1954             '*unmap': 'bool', '*copy-mode': 'MirrorCopyMode',
1955             '*auto-finalize': 'bool', '*auto-dismiss': 'bool' } }
1958 # @BlockDirtyBitmap:
1960 # @node: name of device/node which the bitmap is tracking
1962 # @name: name of the dirty bitmap
1964 # Since: 2.4
1966 { 'struct': 'BlockDirtyBitmap',
1967   'data': { 'node': 'str', 'name': 'str' } }
1970 # @BlockDirtyBitmapAdd:
1972 # @node: name of device/node which the bitmap is tracking
1974 # @name: name of the dirty bitmap
1976 # @granularity: the bitmap granularity, default is 64k for
1977 #               block-dirty-bitmap-add
1979 # @persistent: the bitmap is persistent, i.e. it will be saved to the
1980 #              corresponding block device image file on its close. For now only
1981 #              Qcow2 disks support persistent bitmaps. Default is false for
1982 #              block-dirty-bitmap-add. (Since: 2.10)
1984 # @autoload: ignored and deprecated since 2.12.
1985 #            Currently, all dirty tracking bitmaps are loaded from Qcow2 on
1986 #            open.
1988 # @disabled: the bitmap is created in the disabled state, which means that
1989 #            it will not track drive changes. The bitmap may be enabled with
1990 #            block-dirty-bitmap-enable. Default is false. (Since: 4.0)
1992 # Since: 2.4
1994 { 'struct': 'BlockDirtyBitmapAdd',
1995   'data': { 'node': 'str', 'name': 'str', '*granularity': 'uint32',
1996             '*persistent': 'bool', '*autoload': 'bool', '*disabled': 'bool' } }
1999 # @BlockDirtyBitmapMergeSource:
2001 # @local: name of the bitmap, attached to the same node as target bitmap.
2003 # @external: bitmap with specified node
2005 # Since: 4.1
2007 { 'alternate': 'BlockDirtyBitmapMergeSource',
2008   'data': { 'local': 'str',
2009             'external': 'BlockDirtyBitmap' } }
2012 # @BlockDirtyBitmapMerge:
2014 # @node: name of device/node which the @target bitmap is tracking
2016 # @target: name of the destination dirty bitmap
2018 # @bitmaps: name(s) of the source dirty bitmap(s) at @node and/or fully
2019 #           specifed BlockDirtyBitmap elements. The latter are supported
2020 #           since 4.1.
2022 # Since: 4.0
2024 { 'struct': 'BlockDirtyBitmapMerge',
2025   'data': { 'node': 'str', 'target': 'str',
2026             'bitmaps': ['BlockDirtyBitmapMergeSource'] } }
2029 # @block-dirty-bitmap-add:
2031 # Create a dirty bitmap with a name on the node, and start tracking the writes.
2033 # Returns: nothing on success
2034 #          If @node is not a valid block device or node, DeviceNotFound
2035 #          If @name is already taken, GenericError with an explanation
2037 # Since: 2.4
2039 # Example:
2041 # -> { "execute": "block-dirty-bitmap-add",
2042 #      "arguments": { "node": "drive0", "name": "bitmap0" } }
2043 # <- { "return": {} }
2046 { 'command': 'block-dirty-bitmap-add',
2047   'data': 'BlockDirtyBitmapAdd' }
2050 # @block-dirty-bitmap-remove:
2052 # Stop write tracking and remove the dirty bitmap that was created
2053 # with block-dirty-bitmap-add. If the bitmap is persistent, remove it from its
2054 # storage too.
2056 # Returns: nothing on success
2057 #          If @node is not a valid block device or node, DeviceNotFound
2058 #          If @name is not found, GenericError with an explanation
2059 #          if @name is frozen by an operation, GenericError
2061 # Since: 2.4
2063 # Example:
2065 # -> { "execute": "block-dirty-bitmap-remove",
2066 #      "arguments": { "node": "drive0", "name": "bitmap0" } }
2067 # <- { "return": {} }
2070 { 'command': 'block-dirty-bitmap-remove',
2071   'data': 'BlockDirtyBitmap' }
2074 # @block-dirty-bitmap-clear:
2076 # Clear (reset) a dirty bitmap on the device, so that an incremental
2077 # backup from this point in time forward will only backup clusters
2078 # modified after this clear operation.
2080 # Returns: nothing on success
2081 #          If @node is not a valid block device, DeviceNotFound
2082 #          If @name is not found, GenericError with an explanation
2084 # Since: 2.4
2086 # Example:
2088 # -> { "execute": "block-dirty-bitmap-clear",
2089 #      "arguments": { "node": "drive0", "name": "bitmap0" } }
2090 # <- { "return": {} }
2093 { 'command': 'block-dirty-bitmap-clear',
2094   'data': 'BlockDirtyBitmap' }
2097 # @block-dirty-bitmap-enable:
2099 # Enables a dirty bitmap so that it will begin tracking disk changes.
2101 # Returns: nothing on success
2102 #          If @node is not a valid block device, DeviceNotFound
2103 #          If @name is not found, GenericError with an explanation
2105 # Since: 4.0
2107 # Example:
2109 # -> { "execute": "block-dirty-bitmap-enable",
2110 #      "arguments": { "node": "drive0", "name": "bitmap0" } }
2111 # <- { "return": {} }
2114   { 'command': 'block-dirty-bitmap-enable',
2115     'data': 'BlockDirtyBitmap' }
2118 # @block-dirty-bitmap-disable:
2120 # Disables a dirty bitmap so that it will stop tracking disk changes.
2122 # Returns: nothing on success
2123 #          If @node is not a valid block device, DeviceNotFound
2124 #          If @name is not found, GenericError with an explanation
2126 # Since: 4.0
2128 # Example:
2130 # -> { "execute": "block-dirty-bitmap-disable",
2131 #      "arguments": { "node": "drive0", "name": "bitmap0" } }
2132 # <- { "return": {} }
2135     { 'command': 'block-dirty-bitmap-disable',
2136       'data': 'BlockDirtyBitmap' }
2139 # @block-dirty-bitmap-merge:
2141 # Merge dirty bitmaps listed in @bitmaps to the @target dirty bitmap.
2142 # Dirty bitmaps in @bitmaps will be unchanged, except if it also appears
2143 # as the @target bitmap. Any bits already set in @target will still be
2144 # set after the merge, i.e., this operation does not clear the target.
2145 # On error, @target is unchanged.
2147 # The resulting bitmap will count as dirty any clusters that were dirty in any
2148 # of the source bitmaps. This can be used to achieve backup checkpoints, or in
2149 # simpler usages, to copy bitmaps.
2151 # Returns: nothing on success
2152 #          If @node is not a valid block device, DeviceNotFound
2153 #          If any bitmap in @bitmaps or @target is not found, GenericError
2154 #          If any of the bitmaps have different sizes or granularities,
2155 #              GenericError
2157 # Since: 4.0
2159 # Example:
2161 # -> { "execute": "block-dirty-bitmap-merge",
2162 #      "arguments": { "node": "drive0", "target": "bitmap0",
2163 #                     "bitmaps": ["bitmap1"] } }
2164 # <- { "return": {} }
2167       { 'command': 'block-dirty-bitmap-merge',
2168         'data': 'BlockDirtyBitmapMerge' }
2171 # @BlockDirtyBitmapSha256:
2173 # SHA256 hash of dirty bitmap data
2175 # @sha256: ASCII representation of SHA256 bitmap hash
2177 # Since: 2.10
2179   { 'struct': 'BlockDirtyBitmapSha256',
2180     'data': {'sha256': 'str'} }
2183 # @x-debug-block-dirty-bitmap-sha256:
2185 # Get bitmap SHA256.
2187 # Returns: BlockDirtyBitmapSha256 on success
2188 #          If @node is not a valid block device, DeviceNotFound
2189 #          If @name is not found or if hashing has failed, GenericError with an
2190 #          explanation
2192 # Since: 2.10
2194   { 'command': 'x-debug-block-dirty-bitmap-sha256',
2195     'data': 'BlockDirtyBitmap', 'returns': 'BlockDirtyBitmapSha256' }
2198 # @blockdev-mirror:
2200 # Start mirroring a block device's writes to a new destination.
2202 # @job-id: identifier for the newly-created block job. If
2203 #          omitted, the device name will be used. (Since 2.7)
2205 # @device: The device name or node-name of a root node whose writes should be
2206 #          mirrored.
2208 # @target: the id or node-name of the block device to mirror to. This mustn't be
2209 #          attached to guest.
2211 # @replaces: with sync=full graph node name to be replaced by the new
2212 #            image when a whole image copy is done. This can be used to repair
2213 #            broken Quorum files.
2215 # @speed:  the maximum speed, in bytes per second
2217 # @sync: what parts of the disk image should be copied to the destination
2218 #        (all the disk, only the sectors allocated in the topmost image, or
2219 #        only new I/O).
2221 # @granularity: granularity of the dirty bitmap, default is 64K
2222 #               if the image format doesn't have clusters, 4K if the clusters
2223 #               are smaller than that, else the cluster size.  Must be a
2224 #               power of 2 between 512 and 64M
2226 # @buf-size: maximum amount of data in flight from source to
2227 #            target
2229 # @on-source-error: the action to take on an error on the source,
2230 #                   default 'report'.  'stop' and 'enospc' can only be used
2231 #                   if the block device supports io-status (see BlockInfo).
2233 # @on-target-error: the action to take on an error on the target,
2234 #                   default 'report' (no limitations, since this applies to
2235 #                   a different block device than @device).
2237 # @filter-node-name: the node name that should be assigned to the
2238 #                    filter driver that the mirror job inserts into the graph
2239 #                    above @device. If this option is not given, a node name is
2240 #                    autogenerated. (Since: 2.9)
2242 # @copy-mode: when to copy data to the destination; defaults to 'background'
2243 #             (Since: 3.0)
2245 # @auto-finalize: When false, this job will wait in a PENDING state after it has
2246 #                 finished its work, waiting for @block-job-finalize before
2247 #                 making any block graph changes.
2248 #                 When true, this job will automatically
2249 #                 perform its abort or commit actions.
2250 #                 Defaults to true. (Since 3.1)
2252 # @auto-dismiss: When false, this job will wait in a CONCLUDED state after it
2253 #                has completely ceased all work, and awaits @block-job-dismiss.
2254 #                When true, this job will automatically disappear from the query
2255 #                list without user intervention.
2256 #                Defaults to true. (Since 3.1)
2257 # Returns: nothing on success.
2259 # Since: 2.6
2261 # Example:
2263 # -> { "execute": "blockdev-mirror",
2264 #      "arguments": { "device": "ide-hd0",
2265 #                     "target": "target0",
2266 #                     "sync": "full" } }
2267 # <- { "return": {} }
2270 { 'command': 'blockdev-mirror',
2271   'data': { '*job-id': 'str', 'device': 'str', 'target': 'str',
2272             '*replaces': 'str',
2273             'sync': 'MirrorSyncMode',
2274             '*speed': 'int', '*granularity': 'uint32',
2275             '*buf-size': 'int', '*on-source-error': 'BlockdevOnError',
2276             '*on-target-error': 'BlockdevOnError',
2277             '*filter-node-name': 'str',
2278             '*copy-mode': 'MirrorCopyMode',
2279             '*auto-finalize': 'bool', '*auto-dismiss': 'bool' } }
2282 # @block_set_io_throttle:
2284 # Change I/O throttle limits for a block drive.
2286 # Since QEMU 2.4, each device with I/O limits is member of a throttle
2287 # group.
2289 # If two or more devices are members of the same group, the limits
2290 # will apply to the combined I/O of the whole group in a round-robin
2291 # fashion. Therefore, setting new I/O limits to a device will affect
2292 # the whole group.
2294 # The name of the group can be specified using the 'group' parameter.
2295 # If the parameter is unset, it is assumed to be the current group of
2296 # that device. If it's not in any group yet, the name of the device
2297 # will be used as the name for its group.
2299 # The 'group' parameter can also be used to move a device to a
2300 # different group. In this case the limits specified in the parameters
2301 # will be applied to the new group only.
2303 # I/O limits can be disabled by setting all of them to 0. In this case
2304 # the device will be removed from its group and the rest of its
2305 # members will not be affected. The 'group' parameter is ignored.
2307 # Returns: Nothing on success
2308 #          If @device is not a valid block device, DeviceNotFound
2310 # Since: 1.1
2312 # Example:
2314 # -> { "execute": "block_set_io_throttle",
2315 #      "arguments": { "id": "virtio-blk-pci0/virtio-backend",
2316 #                     "bps": 0,
2317 #                     "bps_rd": 0,
2318 #                     "bps_wr": 0,
2319 #                     "iops": 512,
2320 #                     "iops_rd": 0,
2321 #                     "iops_wr": 0,
2322 #                     "bps_max": 0,
2323 #                     "bps_rd_max": 0,
2324 #                     "bps_wr_max": 0,
2325 #                     "iops_max": 0,
2326 #                     "iops_rd_max": 0,
2327 #                     "iops_wr_max": 0,
2328 #                     "bps_max_length": 0,
2329 #                     "iops_size": 0 } }
2330 # <- { "return": {} }
2332 # -> { "execute": "block_set_io_throttle",
2333 #      "arguments": { "id": "ide0-1-0",
2334 #                     "bps": 1000000,
2335 #                     "bps_rd": 0,
2336 #                     "bps_wr": 0,
2337 #                     "iops": 0,
2338 #                     "iops_rd": 0,
2339 #                     "iops_wr": 0,
2340 #                     "bps_max": 8000000,
2341 #                     "bps_rd_max": 0,
2342 #                     "bps_wr_max": 0,
2343 #                     "iops_max": 0,
2344 #                     "iops_rd_max": 0,
2345 #                     "iops_wr_max": 0,
2346 #                     "bps_max_length": 60,
2347 #                     "iops_size": 0 } }
2348 # <- { "return": {} }
2350 { 'command': 'block_set_io_throttle', 'boxed': true,
2351   'data': 'BlockIOThrottle' }
2354 # @BlockIOThrottle:
2356 # A set of parameters describing block throttling.
2358 # @device: Block device name (deprecated, use @id instead)
2360 # @id: The name or QOM path of the guest device (since: 2.8)
2362 # @bps: total throughput limit in bytes per second
2364 # @bps_rd: read throughput limit in bytes per second
2366 # @bps_wr: write throughput limit in bytes per second
2368 # @iops: total I/O operations per second
2370 # @iops_rd: read I/O operations per second
2372 # @iops_wr: write I/O operations per second
2374 # @bps_max: total throughput limit during bursts,
2375 #                     in bytes (Since 1.7)
2377 # @bps_rd_max: read throughput limit during bursts,
2378 #                        in bytes (Since 1.7)
2380 # @bps_wr_max: write throughput limit during bursts,
2381 #                        in bytes (Since 1.7)
2383 # @iops_max: total I/O operations per second during bursts,
2384 #                      in bytes (Since 1.7)
2386 # @iops_rd_max: read I/O operations per second during bursts,
2387 #                         in bytes (Since 1.7)
2389 # @iops_wr_max: write I/O operations per second during bursts,
2390 #                         in bytes (Since 1.7)
2392 # @bps_max_length: maximum length of the @bps_max burst
2393 #                            period, in seconds. It must only
2394 #                            be set if @bps_max is set as well.
2395 #                            Defaults to 1. (Since 2.6)
2397 # @bps_rd_max_length: maximum length of the @bps_rd_max
2398 #                               burst period, in seconds. It must only
2399 #                               be set if @bps_rd_max is set as well.
2400 #                               Defaults to 1. (Since 2.6)
2402 # @bps_wr_max_length: maximum length of the @bps_wr_max
2403 #                               burst period, in seconds. It must only
2404 #                               be set if @bps_wr_max is set as well.
2405 #                               Defaults to 1. (Since 2.6)
2407 # @iops_max_length: maximum length of the @iops burst
2408 #                             period, in seconds. It must only
2409 #                             be set if @iops_max is set as well.
2410 #                             Defaults to 1. (Since 2.6)
2412 # @iops_rd_max_length: maximum length of the @iops_rd_max
2413 #                                burst period, in seconds. It must only
2414 #                                be set if @iops_rd_max is set as well.
2415 #                                Defaults to 1. (Since 2.6)
2417 # @iops_wr_max_length: maximum length of the @iops_wr_max
2418 #                                burst period, in seconds. It must only
2419 #                                be set if @iops_wr_max is set as well.
2420 #                                Defaults to 1. (Since 2.6)
2422 # @iops_size: an I/O size in bytes (Since 1.7)
2424 # @group: throttle group name (Since 2.4)
2426 # Since: 1.1
2428 { 'struct': 'BlockIOThrottle',
2429   'data': { '*device': 'str', '*id': 'str', 'bps': 'int', 'bps_rd': 'int',
2430             'bps_wr': 'int', 'iops': 'int', 'iops_rd': 'int', 'iops_wr': 'int',
2431             '*bps_max': 'int', '*bps_rd_max': 'int',
2432             '*bps_wr_max': 'int', '*iops_max': 'int',
2433             '*iops_rd_max': 'int', '*iops_wr_max': 'int',
2434             '*bps_max_length': 'int', '*bps_rd_max_length': 'int',
2435             '*bps_wr_max_length': 'int', '*iops_max_length': 'int',
2436             '*iops_rd_max_length': 'int', '*iops_wr_max_length': 'int',
2437             '*iops_size': 'int', '*group': 'str' } }
2440 # @ThrottleLimits:
2442 # Limit parameters for throttling.
2443 # Since some limit combinations are illegal, limits should always be set in one
2444 # transaction. All fields are optional. When setting limits, if a field is
2445 # missing the current value is not changed.
2447 # @iops-total:             limit total I/O operations per second
2448 # @iops-total-max:         I/O operations burst
2449 # @iops-total-max-length:  length of the iops-total-max burst period, in seconds
2450 #                          It must only be set if @iops-total-max is set as well.
2451 # @iops-read:              limit read operations per second
2452 # @iops-read-max:          I/O operations read burst
2453 # @iops-read-max-length:   length of the iops-read-max burst period, in seconds
2454 #                          It must only be set if @iops-read-max is set as well.
2455 # @iops-write:             limit write operations per second
2456 # @iops-write-max:         I/O operations write burst
2457 # @iops-write-max-length:  length of the iops-write-max burst period, in seconds
2458 #                          It must only be set if @iops-write-max is set as well.
2459 # @bps-total:              limit total bytes per second
2460 # @bps-total-max:          total bytes burst
2461 # @bps-total-max-length:   length of the bps-total-max burst period, in seconds.
2462 #                          It must only be set if @bps-total-max is set as well.
2463 # @bps-read:               limit read bytes per second
2464 # @bps-read-max:           total bytes read burst
2465 # @bps-read-max-length:    length of the bps-read-max burst period, in seconds
2466 #                          It must only be set if @bps-read-max is set as well.
2467 # @bps-write:              limit write bytes per second
2468 # @bps-write-max:          total bytes write burst
2469 # @bps-write-max-length:   length of the bps-write-max burst period, in seconds
2470 #                          It must only be set if @bps-write-max is set as well.
2471 # @iops-size:              when limiting by iops max size of an I/O in bytes
2473 # Since: 2.11
2475 { 'struct': 'ThrottleLimits',
2476   'data': { '*iops-total' : 'int', '*iops-total-max' : 'int',
2477             '*iops-total-max-length' : 'int', '*iops-read' : 'int',
2478             '*iops-read-max' : 'int', '*iops-read-max-length' : 'int',
2479             '*iops-write' : 'int', '*iops-write-max' : 'int',
2480             '*iops-write-max-length' : 'int', '*bps-total' : 'int',
2481             '*bps-total-max' : 'int', '*bps-total-max-length' : 'int',
2482             '*bps-read' : 'int', '*bps-read-max' : 'int',
2483             '*bps-read-max-length' : 'int', '*bps-write' : 'int',
2484             '*bps-write-max' : 'int', '*bps-write-max-length' : 'int',
2485             '*iops-size' : 'int' } }
2488 # @block-stream:
2490 # Copy data from a backing file into a block device.
2492 # The block streaming operation is performed in the background until the entire
2493 # backing file has been copied.  This command returns immediately once streaming
2494 # has started.  The status of ongoing block streaming operations can be checked
2495 # with query-block-jobs.  The operation can be stopped before it has completed
2496 # using the block-job-cancel command.
2498 # The node that receives the data is called the top image, can be located in
2499 # any part of the chain (but always above the base image; see below) and can be
2500 # specified using its device or node name. Earlier qemu versions only allowed
2501 # 'device' to name the top level node; presence of the 'base-node' parameter
2502 # during introspection can be used as a witness of the enhanced semantics
2503 # of 'device'.
2505 # If a base file is specified then sectors are not copied from that base file and
2506 # its backing chain.  When streaming completes the image file will have the base
2507 # file as its backing file.  This can be used to stream a subset of the backing
2508 # file chain instead of flattening the entire image.
2510 # On successful completion the image file is updated to drop the backing file
2511 # and the BLOCK_JOB_COMPLETED event is emitted.
2513 # @job-id: identifier for the newly-created block job. If
2514 #          omitted, the device name will be used. (Since 2.7)
2516 # @device: the device or node name of the top image
2518 # @base:   the common backing file name.
2519 #                    It cannot be set if @base-node is also set.
2521 # @base-node: the node name of the backing file.
2522 #                       It cannot be set if @base is also set. (Since 2.8)
2524 # @backing-file: The backing file string to write into the top
2525 #                          image. This filename is not validated.
2527 #                          If a pathname string is such that it cannot be
2528 #                          resolved by QEMU, that means that subsequent QMP or
2529 #                          HMP commands must use node-names for the image in
2530 #                          question, as filename lookup methods will fail.
2532 #                          If not specified, QEMU will automatically determine
2533 #                          the backing file string to use, or error out if there
2534 #                          is no obvious choice.  Care should be taken when
2535 #                          specifying the string, to specify a valid filename or
2536 #                          protocol.
2537 #                          (Since 2.1)
2539 # @speed:  the maximum speed, in bytes per second
2541 # @on-error: the action to take on an error (default report).
2542 #            'stop' and 'enospc' can only be used if the block device
2543 #            supports io-status (see BlockInfo).  Since 1.3.
2545 # @auto-finalize: When false, this job will wait in a PENDING state after it has
2546 #                 finished its work, waiting for @block-job-finalize before
2547 #                 making any block graph changes.
2548 #                 When true, this job will automatically
2549 #                 perform its abort or commit actions.
2550 #                 Defaults to true. (Since 3.1)
2552 # @auto-dismiss: When false, this job will wait in a CONCLUDED state after it
2553 #                has completely ceased all work, and awaits @block-job-dismiss.
2554 #                When true, this job will automatically disappear from the query
2555 #                list without user intervention.
2556 #                Defaults to true. (Since 3.1)
2558 # Returns: Nothing on success. If @device does not exist, DeviceNotFound.
2560 # Since: 1.1
2562 # Example:
2564 # -> { "execute": "block-stream",
2565 #      "arguments": { "device": "virtio0",
2566 #                     "base": "/tmp/master.qcow2" } }
2567 # <- { "return": {} }
2570 { 'command': 'block-stream',
2571   'data': { '*job-id': 'str', 'device': 'str', '*base': 'str',
2572             '*base-node': 'str', '*backing-file': 'str', '*speed': 'int',
2573             '*on-error': 'BlockdevOnError',
2574             '*auto-finalize': 'bool', '*auto-dismiss': 'bool' } }
2577 # @block-job-set-speed:
2579 # Set maximum speed for a background block operation.
2581 # This command can only be issued when there is an active block job.
2583 # Throttling can be disabled by setting the speed to 0.
2585 # @device: The job identifier. This used to be a device name (hence
2586 #          the name of the parameter), but since QEMU 2.7 it can have
2587 #          other values.
2589 # @speed:  the maximum speed, in bytes per second, or 0 for unlimited.
2590 #          Defaults to 0.
2592 # Returns: Nothing on success
2593 #          If no background operation is active on this device, DeviceNotActive
2595 # Since: 1.1
2597 { 'command': 'block-job-set-speed',
2598   'data': { 'device': 'str', 'speed': 'int' } }
2601 # @block-job-cancel:
2603 # Stop an active background block operation.
2605 # This command returns immediately after marking the active background block
2606 # operation for cancellation.  It is an error to call this command if no
2607 # operation is in progress.
2609 # The operation will cancel as soon as possible and then emit the
2610 # BLOCK_JOB_CANCELLED event.  Before that happens the job is still visible when
2611 # enumerated using query-block-jobs.
2613 # Note that if you issue 'block-job-cancel' after 'drive-mirror' has indicated
2614 # (via the event BLOCK_JOB_READY) that the source and destination are
2615 # synchronized, then the event triggered by this command changes to
2616 # BLOCK_JOB_COMPLETED, to indicate that the mirroring has ended and the
2617 # destination now has a point-in-time copy tied to the time of the cancellation.
2619 # For streaming, the image file retains its backing file unless the streaming
2620 # operation happens to complete just as it is being cancelled.  A new streaming
2621 # operation can be started at a later time to finish copying all data from the
2622 # backing file.
2624 # @device: The job identifier. This used to be a device name (hence
2625 #          the name of the parameter), but since QEMU 2.7 it can have
2626 #          other values.
2628 # @force: If true, and the job has already emitted the event BLOCK_JOB_READY,
2629 #         abandon the job immediately (even if it is paused) instead of waiting
2630 #         for the destination to complete its final synchronization (since 1.3)
2632 # Returns: Nothing on success
2633 #          If no background operation is active on this device, DeviceNotActive
2635 # Since: 1.1
2637 { 'command': 'block-job-cancel', 'data': { 'device': 'str', '*force': 'bool' } }
2640 # @block-job-pause:
2642 # Pause an active background block operation.
2644 # This command returns immediately after marking the active background block
2645 # operation for pausing.  It is an error to call this command if no
2646 # operation is in progress or if the job is already paused.
2648 # The operation will pause as soon as possible.  No event is emitted when
2649 # the operation is actually paused.  Cancelling a paused job automatically
2650 # resumes it.
2652 # @device: The job identifier. This used to be a device name (hence
2653 #          the name of the parameter), but since QEMU 2.7 it can have
2654 #          other values.
2656 # Returns: Nothing on success
2657 #          If no background operation is active on this device, DeviceNotActive
2659 # Since: 1.3
2661 { 'command': 'block-job-pause', 'data': { 'device': 'str' } }
2664 # @block-job-resume:
2666 # Resume an active background block operation.
2668 # This command returns immediately after resuming a paused background block
2669 # operation.  It is an error to call this command if no operation is in
2670 # progress or if the job is not paused.
2672 # This command also clears the error status of the job.
2674 # @device: The job identifier. This used to be a device name (hence
2675 #          the name of the parameter), but since QEMU 2.7 it can have
2676 #          other values.
2678 # Returns: Nothing on success
2679 #          If no background operation is active on this device, DeviceNotActive
2681 # Since: 1.3
2683 { 'command': 'block-job-resume', 'data': { 'device': 'str' } }
2686 # @block-job-complete:
2688 # Manually trigger completion of an active background block operation.  This
2689 # is supported for drive mirroring, where it also switches the device to
2690 # write to the target path only.  The ability to complete is signaled with
2691 # a BLOCK_JOB_READY event.
2693 # This command completes an active background block operation synchronously.
2694 # The ordering of this command's return with the BLOCK_JOB_COMPLETED event
2695 # is not defined.  Note that if an I/O error occurs during the processing of
2696 # this command: 1) the command itself will fail; 2) the error will be processed
2697 # according to the rerror/werror arguments that were specified when starting
2698 # the operation.
2700 # A cancelled or paused job cannot be completed.
2702 # @device: The job identifier. This used to be a device name (hence
2703 #          the name of the parameter), but since QEMU 2.7 it can have
2704 #          other values.
2706 # Returns: Nothing on success
2707 #          If no background operation is active on this device, DeviceNotActive
2709 # Since: 1.3
2711 { 'command': 'block-job-complete', 'data': { 'device': 'str' } }
2714 # @block-job-dismiss:
2716 # For jobs that have already concluded, remove them from the block-job-query
2717 # list. This command only needs to be run for jobs which were started with
2718 # QEMU 2.12+ job lifetime management semantics.
2720 # This command will refuse to operate on any job that has not yet reached
2721 # its terminal state, JOB_STATUS_CONCLUDED. For jobs that make use of the
2722 # BLOCK_JOB_READY event, block-job-cancel or block-job-complete will still need
2723 # to be used as appropriate.
2725 # @id: The job identifier.
2727 # Returns: Nothing on success
2729 # Since: 2.12
2731 { 'command': 'block-job-dismiss', 'data': { 'id': 'str' } }
2734 # @block-job-finalize:
2736 # Once a job that has manual=true reaches the pending state, it can be
2737 # instructed to finalize any graph changes and do any necessary cleanup
2738 # via this command.
2739 # For jobs in a transaction, instructing one job to finalize will force
2740 # ALL jobs in the transaction to finalize, so it is only necessary to instruct
2741 # a single member job to finalize.
2743 # @id: The job identifier.
2745 # Returns: Nothing on success
2747 # Since: 2.12
2749 { 'command': 'block-job-finalize', 'data': { 'id': 'str' } }
2752 # @BlockdevDiscardOptions:
2754 # Determines how to handle discard requests.
2756 # @ignore:      Ignore the request
2757 # @unmap:       Forward as an unmap request
2759 # Since: 2.9
2761 { 'enum': 'BlockdevDiscardOptions',
2762   'data': [ 'ignore', 'unmap' ] }
2765 # @BlockdevDetectZeroesOptions:
2767 # Describes the operation mode for the automatic conversion of plain
2768 # zero writes by the OS to driver specific optimized zero write commands.
2770 # @off:      Disabled (default)
2771 # @on:       Enabled
2772 # @unmap:    Enabled and even try to unmap blocks if possible. This requires
2773 #            also that @BlockdevDiscardOptions is set to unmap for this device.
2775 # Since: 2.1
2777 { 'enum': 'BlockdevDetectZeroesOptions',
2778   'data': [ 'off', 'on', 'unmap' ] }
2781 # @BlockdevAioOptions:
2783 # Selects the AIO backend to handle I/O requests
2785 # @threads:     Use qemu's thread pool
2786 # @native:      Use native AIO backend (only Linux and Windows)
2788 # Since: 2.9
2790 { 'enum': 'BlockdevAioOptions',
2791   'data': [ 'threads', 'native' ] }
2794 # @BlockdevCacheOptions:
2796 # Includes cache-related options for block devices
2798 # @direct:      enables use of O_DIRECT (bypass the host page cache;
2799 #               default: false)
2800 # @no-flush:    ignore any flush requests for the device (default:
2801 #               false)
2803 # Since: 2.9
2805 { 'struct': 'BlockdevCacheOptions',
2806   'data': { '*direct': 'bool',
2807             '*no-flush': 'bool' } }
2810 # @BlockdevDriver:
2812 # Drivers that are supported in block device operations.
2814 # @vxhs: Since 2.10
2815 # @throttle: Since 2.11
2816 # @nvme: Since 2.12
2817 # @copy-on-read: Since 3.0
2818 # @blklogwrites: Since 3.0
2820 # Since: 2.9
2822 { 'enum': 'BlockdevDriver',
2823   'data': [ 'blkdebug', 'blklogwrites', 'blkverify', 'bochs', 'cloop',
2824             'copy-on-read', 'dmg', 'file', 'ftp', 'ftps', 'gluster',
2825             'host_cdrom', 'host_device', 'http', 'https', 'iscsi', 'luks',
2826             'nbd', 'nfs', 'null-aio', 'null-co', 'nvme', 'parallels', 'qcow',
2827             'qcow2', 'qed', 'quorum', 'raw', 'rbd',
2828             { 'name': 'replication', 'if': 'defined(CONFIG_REPLICATION)' },
2829             'sheepdog',
2830             'ssh', 'throttle', 'vdi', 'vhdx', 'vmdk', 'vpc', 'vvfat', 'vxhs' ] }
2833 # @BlockdevOptionsFile:
2835 # Driver specific block device options for the file backend.
2837 # @filename:    path to the image file
2838 # @pr-manager:  the id for the object that will handle persistent reservations
2839 #               for this device (default: none, forward the commands via SG_IO;
2840 #               since 2.11)
2841 # @aio:         AIO backend (default: threads) (since: 2.8)
2842 # @locking:     whether to enable file locking. If set to 'auto', only enable
2843 #               when Open File Descriptor (OFD) locking API is available
2844 #               (default: auto, since 2.10)
2845 # @drop-cache:  invalidate page cache during live migration.  This prevents
2846 #               stale data on the migration destination with cache.direct=off.
2847 #               Currently only supported on Linux hosts.
2848 #               (default: on, since: 4.0)
2849 # @x-check-cache-dropped: whether to check that page cache was dropped on live
2850 #                         migration.  May cause noticeable delays if the image
2851 #                         file is large, do not use in production.
2852 #                         (default: off) (since: 3.0)
2854 # Features:
2855 # @dynamic-auto-read-only: If present, enabled auto-read-only means that the
2856 #                          driver will open the image read-only at first,
2857 #                          dynamically reopen the image file read-write when
2858 #                          the first writer is attached to the node and reopen
2859 #                          read-only when the last writer is detached. This
2860 #                          allows giving QEMU write permissions only on demand
2861 #                          when an operation actually needs write access.
2863 # Since: 2.9
2865 { 'struct': 'BlockdevOptionsFile',
2866   'data': { 'filename': 'str',
2867             '*pr-manager': 'str',
2868             '*locking': 'OnOffAuto',
2869             '*aio': 'BlockdevAioOptions',
2870             '*drop-cache': {'type': 'bool',
2871                             'if': 'defined(CONFIG_LINUX)'},
2872             '*x-check-cache-dropped': 'bool' },
2873   'features': [ { 'name': 'dynamic-auto-read-only',
2874                   'if': 'defined(CONFIG_POSIX)' } ] }
2877 # @BlockdevOptionsNull:
2879 # Driver specific block device options for the null backend.
2881 # @size:    size of the device in bytes.
2882 # @latency-ns: emulated latency (in nanoseconds) in processing
2883 #              requests. Default to zero which completes requests immediately.
2884 #              (Since 2.4)
2885 # @read-zeroes: if true, reads from the device produce zeroes; if false, the
2886 #               buffer is left unchanged. (default: false; since: 4.1)
2888 # Since: 2.9
2890 { 'struct': 'BlockdevOptionsNull',
2891   'data': { '*size': 'int', '*latency-ns': 'uint64', '*read-zeroes': 'bool' } }
2894 # @BlockdevOptionsNVMe:
2896 # Driver specific block device options for the NVMe backend.
2898 # @device:    controller address of the NVMe device.
2899 # @namespace: namespace number of the device, starting from 1.
2901 # Since: 2.12
2903 { 'struct': 'BlockdevOptionsNVMe',
2904   'data': { 'device': 'str', 'namespace': 'int' } }
2907 # @BlockdevOptionsVVFAT:
2909 # Driver specific block device options for the vvfat protocol.
2911 # @dir:         directory to be exported as FAT image
2912 # @fat-type:    FAT type: 12, 16 or 32
2913 # @floppy:      whether to export a floppy image (true) or
2914 #               partitioned hard disk (false; default)
2915 # @label:       set the volume label, limited to 11 bytes. FAT16 and
2916 #               FAT32 traditionally have some restrictions on labels, which are
2917 #               ignored by most operating systems. Defaults to "QEMU VVFAT".
2918 #               (since 2.4)
2919 # @rw:          whether to allow write operations (default: false)
2921 # Since: 2.9
2923 { 'struct': 'BlockdevOptionsVVFAT',
2924   'data': { 'dir': 'str', '*fat-type': 'int', '*floppy': 'bool',
2925             '*label': 'str', '*rw': 'bool' } }
2928 # @BlockdevOptionsGenericFormat:
2930 # Driver specific block device options for image format that have no option
2931 # besides their data source.
2933 # @file:        reference to or definition of the data source block device
2935 # Since: 2.9
2937 { 'struct': 'BlockdevOptionsGenericFormat',
2938   'data': { 'file': 'BlockdevRef' } }
2941 # @BlockdevOptionsLUKS:
2943 # Driver specific block device options for LUKS.
2945 # @key-secret: the ID of a QCryptoSecret object providing
2946 #              the decryption key (since 2.6). Mandatory except when
2947 #              doing a metadata-only probe of the image.
2949 # Since: 2.9
2951 { 'struct': 'BlockdevOptionsLUKS',
2952   'base': 'BlockdevOptionsGenericFormat',
2953   'data': { '*key-secret': 'str' } }
2957 # @BlockdevOptionsGenericCOWFormat:
2959 # Driver specific block device options for image format that have no option
2960 # besides their data source and an optional backing file.
2962 # @backing:     reference to or definition of the backing file block
2963 #               device, null disables the backing file entirely.
2964 #               Defaults to the backing file stored the image file.
2966 # Since: 2.9
2968 { 'struct': 'BlockdevOptionsGenericCOWFormat',
2969   'base': 'BlockdevOptionsGenericFormat',
2970   'data': { '*backing': 'BlockdevRefOrNull' } }
2973 # @Qcow2OverlapCheckMode:
2975 # General overlap check modes.
2977 # @none:        Do not perform any checks
2979 # @constant:    Perform only checks which can be done in constant time and
2980 #               without reading anything from disk
2982 # @cached:      Perform only checks which can be done without reading anything
2983 #               from disk
2985 # @all:         Perform all available overlap checks
2987 # Since: 2.9
2989 { 'enum': 'Qcow2OverlapCheckMode',
2990   'data': [ 'none', 'constant', 'cached', 'all' ] }
2993 # @Qcow2OverlapCheckFlags:
2995 # Structure of flags for each metadata structure. Setting a field to 'true'
2996 # makes qemu guard that structure against unintended overwriting. The default
2997 # value is chosen according to the template given.
2999 # @template: Specifies a template mode which can be adjusted using the other
3000 #            flags, defaults to 'cached'
3002 # @bitmap-directory: since 3.0
3004 # Since: 2.9
3006 { 'struct': 'Qcow2OverlapCheckFlags',
3007   'data': { '*template':         'Qcow2OverlapCheckMode',
3008             '*main-header':      'bool',
3009             '*active-l1':        'bool',
3010             '*active-l2':        'bool',
3011             '*refcount-table':   'bool',
3012             '*refcount-block':   'bool',
3013             '*snapshot-table':   'bool',
3014             '*inactive-l1':      'bool',
3015             '*inactive-l2':      'bool',
3016             '*bitmap-directory': 'bool' } }
3019 # @Qcow2OverlapChecks:
3021 # Specifies which metadata structures should be guarded against unintended
3022 # overwriting.
3024 # @flags:   set of flags for separate specification of each metadata structure
3025 #           type
3027 # @mode:    named mode which chooses a specific set of flags
3029 # Since: 2.9
3031 { 'alternate': 'Qcow2OverlapChecks',
3032   'data': { 'flags': 'Qcow2OverlapCheckFlags',
3033             'mode':  'Qcow2OverlapCheckMode' } }
3036 # @BlockdevQcowEncryptionFormat:
3038 # @aes: AES-CBC with plain64 initialization vectors
3040 # Since: 2.10
3042 { 'enum': 'BlockdevQcowEncryptionFormat',
3043   'data': [ 'aes' ] }
3046 # @BlockdevQcowEncryption:
3048 # Since: 2.10
3050 { 'union': 'BlockdevQcowEncryption',
3051   'base': { 'format': 'BlockdevQcowEncryptionFormat' },
3052   'discriminator': 'format',
3053   'data': { 'aes': 'QCryptoBlockOptionsQCow' } }
3056 # @BlockdevOptionsQcow:
3058 # Driver specific block device options for qcow.
3060 # @encrypt:               Image decryption options. Mandatory for
3061 #                         encrypted images, except when doing a metadata-only
3062 #                         probe of the image.
3064 # Since: 2.10
3066 { 'struct': 'BlockdevOptionsQcow',
3067   'base': 'BlockdevOptionsGenericCOWFormat',
3068   'data': { '*encrypt': 'BlockdevQcowEncryption' } }
3073 # @BlockdevQcow2EncryptionFormat:
3074 # @aes: AES-CBC with plain64 initialization vectors
3076 # Since: 2.10
3078 { 'enum': 'BlockdevQcow2EncryptionFormat',
3079   'data': [ 'aes', 'luks' ] }
3082 # @BlockdevQcow2Encryption:
3084 # Since: 2.10
3086 { 'union': 'BlockdevQcow2Encryption',
3087   'base': { 'format': 'BlockdevQcow2EncryptionFormat' },
3088   'discriminator': 'format',
3089   'data': { 'aes': 'QCryptoBlockOptionsQCow',
3090             'luks': 'QCryptoBlockOptionsLUKS'} }
3093 # @BlockdevOptionsQcow2:
3095 # Driver specific block device options for qcow2.
3097 # @lazy-refcounts:        whether to enable the lazy refcounts
3098 #                         feature (default is taken from the image file)
3100 # @pass-discard-request:  whether discard requests to the qcow2
3101 #                         device should be forwarded to the data source
3103 # @pass-discard-snapshot: whether discard requests for the data source
3104 #                         should be issued when a snapshot operation (e.g.
3105 #                         deleting a snapshot) frees clusters in the qcow2 file
3107 # @pass-discard-other:    whether discard requests for the data source
3108 #                         should be issued on other occasions where a cluster
3109 #                         gets freed
3111 # @overlap-check:         which overlap checks to perform for writes
3112 #                         to the image, defaults to 'cached' (since 2.2)
3114 # @cache-size:            the maximum total size of the L2 table and
3115 #                         refcount block caches in bytes (since 2.2)
3117 # @l2-cache-size:         the maximum size of the L2 table cache in
3118 #                         bytes (since 2.2)
3120 # @l2-cache-entry-size:   the size of each entry in the L2 cache in
3121 #                         bytes. It must be a power of two between 512
3122 #                         and the cluster size. The default value is
3123 #                         the cluster size (since 2.12)
3125 # @refcount-cache-size:   the maximum size of the refcount block cache
3126 #                         in bytes (since 2.2)
3128 # @cache-clean-interval:  clean unused entries in the L2 and refcount
3129 #                         caches. The interval is in seconds. The default value
3130 #                         is 600 on supporting platforms, and 0 on other
3131 #                         platforms. 0 disables this feature. (since 2.5)
3133 # @encrypt:               Image decryption options. Mandatory for
3134 #                         encrypted images, except when doing a metadata-only
3135 #                         probe of the image. (since 2.10)
3137 # @data-file:             reference to or definition of the external data file.
3138 #                         This may only be specified for images that require an
3139 #                         external data file. If it is not specified for such
3140 #                         an image, the data file name is loaded from the image
3141 #                         file. (since 4.0)
3143 # Since: 2.9
3145 { 'struct': 'BlockdevOptionsQcow2',
3146   'base': 'BlockdevOptionsGenericCOWFormat',
3147   'data': { '*lazy-refcounts': 'bool',
3148             '*pass-discard-request': 'bool',
3149             '*pass-discard-snapshot': 'bool',
3150             '*pass-discard-other': 'bool',
3151             '*overlap-check': 'Qcow2OverlapChecks',
3152             '*cache-size': 'int',
3153             '*l2-cache-size': 'int',
3154             '*l2-cache-entry-size': 'int',
3155             '*refcount-cache-size': 'int',
3156             '*cache-clean-interval': 'int',
3157             '*encrypt': 'BlockdevQcow2Encryption',
3158             '*data-file': 'BlockdevRef' } }
3161 # @SshHostKeyCheckMode:
3163 # @none             Don't check the host key at all
3164 # @hash             Compare the host key with a given hash
3165 # @known_hosts      Check the host key against the known_hosts file
3167 # Since: 2.12
3169 { 'enum': 'SshHostKeyCheckMode',
3170   'data': [ 'none', 'hash', 'known_hosts' ] }
3173 # @SshHostKeyCheckHashType:
3175 # @md5              The given hash is an md5 hash
3176 # @sha1             The given hash is an sha1 hash
3178 # Since: 2.12
3180 { 'enum': 'SshHostKeyCheckHashType',
3181   'data': [ 'md5', 'sha1' ] }
3184 # @SshHostKeyHash:
3186 # @type             The hash algorithm used for the hash
3187 # @hash             The expected hash value
3189 # Since: 2.12
3191 { 'struct': 'SshHostKeyHash',
3192   'data': { 'type': 'SshHostKeyCheckHashType',
3193             'hash': 'str' }}
3196 # @SshHostKeyCheck:
3198 # Since: 2.12
3200 { 'union': 'SshHostKeyCheck',
3201   'base': { 'mode': 'SshHostKeyCheckMode' },
3202   'discriminator': 'mode',
3203   'data': { 'hash': 'SshHostKeyHash' } }
3206 # @BlockdevOptionsSsh:
3208 # @server:              host address
3210 # @path:                path to the image on the host
3212 # @user:                user as which to connect, defaults to current
3213 #                       local user name
3215 # @host-key-check:      Defines how and what to check the host key against
3216 #                       (default: known_hosts)
3218 # Since: 2.9
3220 { 'struct': 'BlockdevOptionsSsh',
3221   'data': { 'server': 'InetSocketAddress',
3222             'path': 'str',
3223             '*user': 'str',
3224             '*host-key-check': 'SshHostKeyCheck' } }
3228 # @BlkdebugEvent:
3230 # Trigger events supported by blkdebug.
3232 # @l1_shrink_write_table:      write zeros to the l1 table to shrink image.
3233 #                              (since 2.11)
3235 # @l1_shrink_free_l2_clusters: discard the l2 tables. (since 2.11)
3237 # @cor_write: a write due to copy-on-read (since 2.11)
3239 # @cluster_alloc_space: an allocation of file space for a cluster (since 4.1)
3241 # @none: triggers once at creation of the blkdebug node (since 4.1)
3243 # Since: 2.9
3245 { 'enum': 'BlkdebugEvent', 'prefix': 'BLKDBG',
3246   'data': [ 'l1_update', 'l1_grow_alloc_table', 'l1_grow_write_table',
3247             'l1_grow_activate_table', 'l2_load', 'l2_update',
3248             'l2_update_compressed', 'l2_alloc_cow_read', 'l2_alloc_write',
3249             'read_aio', 'read_backing_aio', 'read_compressed', 'write_aio',
3250             'write_compressed', 'vmstate_load', 'vmstate_save', 'cow_read',
3251             'cow_write', 'reftable_load', 'reftable_grow', 'reftable_update',
3252             'refblock_load', 'refblock_update', 'refblock_update_part',
3253             'refblock_alloc', 'refblock_alloc_hookup', 'refblock_alloc_write',
3254             'refblock_alloc_write_blocks', 'refblock_alloc_write_table',
3255             'refblock_alloc_switch_table', 'cluster_alloc',
3256             'cluster_alloc_bytes', 'cluster_free', 'flush_to_os',
3257             'flush_to_disk', 'pwritev_rmw_head', 'pwritev_rmw_after_head',
3258             'pwritev_rmw_tail', 'pwritev_rmw_after_tail', 'pwritev',
3259             'pwritev_zero', 'pwritev_done', 'empty_image_prepare',
3260             'l1_shrink_write_table', 'l1_shrink_free_l2_clusters',
3261             'cor_write', 'cluster_alloc_space', 'none'] }
3264 # @BlkdebugIOType:
3266 # Kinds of I/O that blkdebug can inject errors in.
3268 # @read: .bdrv_co_preadv()
3270 # @write: .bdrv_co_pwritev()
3272 # @write-zeroes: .bdrv_co_pwrite_zeroes()
3274 # @discard: .bdrv_co_pdiscard()
3276 # @flush: .bdrv_co_flush_to_disk()
3278 # @block-status: .bdrv_co_block_status()
3280 # Since: 4.1
3282 { 'enum': 'BlkdebugIOType', 'prefix': 'BLKDEBUG_IO_TYPE',
3283   'data': [ 'read', 'write', 'write-zeroes', 'discard', 'flush',
3284             'block-status' ] }
3287 # @BlkdebugInjectErrorOptions:
3289 # Describes a single error injection for blkdebug.
3291 # @event:       trigger event
3293 # @state:       the state identifier blkdebug needs to be in to
3294 #               actually trigger the event; defaults to "any"
3296 # @iotype:      the type of I/O operations on which this error should
3297 #               be injected; defaults to "all read, write,
3298 #               write-zeroes, discard, and flush operations"
3299 #               (since: 4.1)
3301 # @errno:       error identifier (errno) to be returned; defaults to
3302 #               EIO
3304 # @sector:      specifies the sector index which has to be affected
3305 #               in order to actually trigger the event; defaults to "any
3306 #               sector"
3308 # @once:        disables further events after this one has been
3309 #               triggered; defaults to false
3311 # @immediately: fail immediately; defaults to false
3313 # Since: 2.9
3315 { 'struct': 'BlkdebugInjectErrorOptions',
3316   'data': { 'event': 'BlkdebugEvent',
3317             '*state': 'int',
3318             '*iotype': 'BlkdebugIOType',
3319             '*errno': 'int',
3320             '*sector': 'int',
3321             '*once': 'bool',
3322             '*immediately': 'bool' } }
3325 # @BlkdebugSetStateOptions:
3327 # Describes a single state-change event for blkdebug.
3329 # @event:       trigger event
3331 # @state:       the current state identifier blkdebug needs to be in;
3332 #               defaults to "any"
3334 # @new_state:   the state identifier blkdebug is supposed to assume if
3335 #               this event is triggered
3337 # Since: 2.9
3339 { 'struct': 'BlkdebugSetStateOptions',
3340   'data': { 'event': 'BlkdebugEvent',
3341             '*state': 'int',
3342             'new_state': 'int' } }
3345 # @BlockdevOptionsBlkdebug:
3347 # Driver specific block device options for blkdebug.
3349 # @image:           underlying raw block device (or image file)
3351 # @config:          filename of the configuration file
3353 # @align:           required alignment for requests in bytes, must be
3354 #                   positive power of 2, or 0 for default
3356 # @max-transfer:    maximum size for I/O transfers in bytes, must be
3357 #                   positive multiple of @align and of the underlying
3358 #                   file's request alignment (but need not be a power of
3359 #                   2), or 0 for default (since 2.10)
3361 # @opt-write-zero:  preferred alignment for write zero requests in bytes,
3362 #                   must be positive multiple of @align and of the
3363 #                   underlying file's request alignment (but need not be a
3364 #                   power of 2), or 0 for default (since 2.10)
3366 # @max-write-zero:  maximum size for write zero requests in bytes, must be
3367 #                   positive multiple of @align, of @opt-write-zero, and of
3368 #                   the underlying file's request alignment (but need not
3369 #                   be a power of 2), or 0 for default (since 2.10)
3371 # @opt-discard:     preferred alignment for discard requests in bytes, must
3372 #                   be positive multiple of @align and of the underlying
3373 #                   file's request alignment (but need not be a power of
3374 #                   2), or 0 for default (since 2.10)
3376 # @max-discard:     maximum size for discard requests in bytes, must be
3377 #                   positive multiple of @align, of @opt-discard, and of
3378 #                   the underlying file's request alignment (but need not
3379 #                   be a power of 2), or 0 for default (since 2.10)
3381 # @inject-error:    array of error injection descriptions
3383 # @set-state:       array of state-change descriptions
3385 # Since: 2.9
3387 { 'struct': 'BlockdevOptionsBlkdebug',
3388   'data': { 'image': 'BlockdevRef',
3389             '*config': 'str',
3390             '*align': 'int', '*max-transfer': 'int32',
3391             '*opt-write-zero': 'int32', '*max-write-zero': 'int32',
3392             '*opt-discard': 'int32', '*max-discard': 'int32',
3393             '*inject-error': ['BlkdebugInjectErrorOptions'],
3394             '*set-state': ['BlkdebugSetStateOptions'] } }
3397 # @BlockdevOptionsBlklogwrites:
3399 # Driver specific block device options for blklogwrites.
3401 # @file:            block device
3403 # @log:             block device used to log writes to @file
3405 # @log-sector-size: sector size used in logging writes to @file, determines
3406 #                   granularity of offsets and sizes of writes (default: 512)
3408 # @log-append:      append to an existing log (default: false)
3410 # @log-super-update-interval: interval of write requests after which the log
3411 #                             super block is updated to disk (default: 4096)
3413 # Since: 3.0
3415 { 'struct': 'BlockdevOptionsBlklogwrites',
3416   'data': { 'file': 'BlockdevRef',
3417             'log': 'BlockdevRef',
3418             '*log-sector-size': 'uint32',
3419             '*log-append': 'bool',
3420             '*log-super-update-interval': 'uint64' } }
3423 # @BlockdevOptionsBlkverify:
3425 # Driver specific block device options for blkverify.
3427 # @test:    block device to be tested
3429 # @raw:     raw image used for verification
3431 # Since: 2.9
3433 { 'struct': 'BlockdevOptionsBlkverify',
3434   'data': { 'test': 'BlockdevRef',
3435             'raw': 'BlockdevRef' } }
3438 # @QuorumReadPattern:
3440 # An enumeration of quorum read patterns.
3442 # @quorum: read all the children and do a quorum vote on reads
3444 # @fifo: read only from the first child that has not failed
3446 # Since: 2.9
3448 { 'enum': 'QuorumReadPattern', 'data': [ 'quorum', 'fifo' ] }
3451 # @BlockdevOptionsQuorum:
3453 # Driver specific block device options for Quorum
3455 # @blkverify:      true if the driver must print content mismatch
3456 #                  set to false by default
3458 # @children:       the children block devices to use
3460 # @vote-threshold: the vote limit under which a read will fail
3462 # @rewrite-corrupted: rewrite corrupted data when quorum is reached
3463 #                     (Since 2.1)
3465 # @read-pattern: choose read pattern and set to quorum by default
3466 #                (Since 2.2)
3468 # Since: 2.9
3470 { 'struct': 'BlockdevOptionsQuorum',
3471   'data': { '*blkverify': 'bool',
3472             'children': [ 'BlockdevRef' ],
3473             'vote-threshold': 'int',
3474             '*rewrite-corrupted': 'bool',
3475             '*read-pattern': 'QuorumReadPattern' } }
3478 # @BlockdevOptionsGluster:
3480 # Driver specific block device options for Gluster
3482 # @volume:      name of gluster volume where VM image resides
3484 # @path:        absolute path to image file in gluster volume
3486 # @server:      gluster servers description
3488 # @debug:       libgfapi log level (default '4' which is Error)
3489 #               (Since 2.8)
3491 # @logfile:     libgfapi log file (default /dev/stderr) (Since 2.8)
3493 # Since: 2.9
3495 { 'struct': 'BlockdevOptionsGluster',
3496   'data': { 'volume': 'str',
3497             'path': 'str',
3498             'server': ['SocketAddress'],
3499             '*debug': 'int',
3500             '*logfile': 'str' } }
3503 # @IscsiTransport:
3505 # An enumeration of libiscsi transport types
3507 # Since: 2.9
3509 { 'enum': 'IscsiTransport',
3510   'data': [ 'tcp', 'iser' ] }
3513 # @IscsiHeaderDigest:
3515 # An enumeration of header digests supported by libiscsi
3517 # Since: 2.9
3519 { 'enum': 'IscsiHeaderDigest',
3520   'prefix': 'QAPI_ISCSI_HEADER_DIGEST',
3521   'data': [ 'crc32c', 'none', 'crc32c-none', 'none-crc32c' ] }
3524 # @BlockdevOptionsIscsi:
3526 # @transport:       The iscsi transport type
3528 # @portal:          The address of the iscsi portal
3530 # @target:          The target iqn name
3532 # @lun:             LUN to connect to. Defaults to 0.
3534 # @user:            User name to log in with. If omitted, no CHAP
3535 #                   authentication is performed.
3537 # @password-secret: The ID of a QCryptoSecret object providing
3538 #                   the password for the login. This option is required if
3539 #                   @user is specified.
3541 # @initiator-name:  The iqn name we want to identify to the target
3542 #                   as. If this option is not specified, an initiator name is
3543 #                   generated automatically.
3545 # @header-digest:   The desired header digest. Defaults to
3546 #                   none-crc32c.
3548 # @timeout:         Timeout in seconds after which a request will
3549 #                   timeout. 0 means no timeout and is the default.
3551 # Driver specific block device options for iscsi
3553 # Since: 2.9
3555 { 'struct': 'BlockdevOptionsIscsi',
3556   'data': { 'transport': 'IscsiTransport',
3557             'portal': 'str',
3558             'target': 'str',
3559             '*lun': 'int',
3560             '*user': 'str',
3561             '*password-secret': 'str',
3562             '*initiator-name': 'str',
3563             '*header-digest': 'IscsiHeaderDigest',
3564             '*timeout': 'int' } }
3568 # @RbdAuthMode:
3570 # Since: 3.0
3572 { 'enum': 'RbdAuthMode',
3573   'data': [ 'cephx', 'none' ] }
3576 # @BlockdevOptionsRbd:
3578 # @pool:               Ceph pool name.
3580 # @image:              Image name in the Ceph pool.
3582 # @conf:               path to Ceph configuration file.  Values
3583 #                      in the configuration file will be overridden by
3584 #                      options specified via QAPI.
3586 # @snapshot:           Ceph snapshot name.
3588 # @user:               Ceph id name.
3590 # @auth-client-required: Acceptable authentication modes.
3591 #                      This maps to Ceph configuration option
3592 #                      "auth_client_required".  (Since 3.0)
3594 # @key-secret:         ID of a QCryptoSecret object providing a key
3595 #                      for cephx authentication.
3596 #                      This maps to Ceph configuration option
3597 #                      "key".  (Since 3.0)
3599 # @server:             Monitor host address and port.  This maps
3600 #                      to the "mon_host" Ceph option.
3602 # Since: 2.9
3604 { 'struct': 'BlockdevOptionsRbd',
3605   'data': { 'pool': 'str',
3606             'image': 'str',
3607             '*conf': 'str',
3608             '*snapshot': 'str',
3609             '*user': 'str',
3610             '*auth-client-required': ['RbdAuthMode'],
3611             '*key-secret': 'str',
3612             '*server': ['InetSocketAddressBase'] } }
3615 # @BlockdevOptionsSheepdog:
3617 # Driver specific block device options for sheepdog
3619 # @vdi:         Virtual disk image name
3620 # @server:      The Sheepdog server to connect to
3621 # @snap-id:     Snapshot ID
3622 # @tag:         Snapshot tag name
3624 # Only one of @snap-id and @tag may be present.
3626 # Since: 2.9
3628 { 'struct': 'BlockdevOptionsSheepdog',
3629   'data': { 'server': 'SocketAddress',
3630             'vdi': 'str',
3631             '*snap-id': 'uint32',
3632             '*tag': 'str' } }
3635 # @ReplicationMode:
3637 # An enumeration of replication modes.
3639 # @primary: Primary mode, the vm's state will be sent to secondary QEMU.
3641 # @secondary: Secondary mode, receive the vm's state from primary QEMU.
3643 # Since: 2.9
3645 { 'enum' : 'ReplicationMode', 'data' : [ 'primary', 'secondary' ],
3646   'if': 'defined(CONFIG_REPLICATION)' }
3649 # @BlockdevOptionsReplication:
3651 # Driver specific block device options for replication
3653 # @mode: the replication mode
3655 # @top-id: In secondary mode, node name or device ID of the root
3656 #          node who owns the replication node chain. Must not be given in
3657 #          primary mode.
3659 # Since: 2.9
3661 { 'struct': 'BlockdevOptionsReplication',
3662   'base': 'BlockdevOptionsGenericFormat',
3663   'data': { 'mode': 'ReplicationMode',
3664             '*top-id': 'str' },
3665   'if': 'defined(CONFIG_REPLICATION)' }
3668 # @NFSTransport:
3670 # An enumeration of NFS transport types
3672 # @inet:        TCP transport
3674 # Since: 2.9
3676 { 'enum': 'NFSTransport',
3677   'data': [ 'inet' ] }
3680 # @NFSServer:
3682 # Captures the address of the socket
3684 # @type:        transport type used for NFS (only TCP supported)
3686 # @host:        host address for NFS server
3688 # Since: 2.9
3690 { 'struct': 'NFSServer',
3691   'data': { 'type': 'NFSTransport',
3692             'host': 'str' } }
3695 # @BlockdevOptionsNfs:
3697 # Driver specific block device option for NFS
3699 # @server:                  host address
3701 # @path:                    path of the image on the host
3703 # @user:                    UID value to use when talking to the
3704 #                           server (defaults to 65534 on Windows and getuid()
3705 #                           on unix)
3707 # @group:                   GID value to use when talking to the
3708 #                           server (defaults to 65534 on Windows and getgid()
3709 #                           in unix)
3711 # @tcp-syn-count:           number of SYNs during the session
3712 #                           establishment (defaults to libnfs default)
3714 # @readahead-size:          set the readahead size in bytes (defaults
3715 #                           to libnfs default)
3717 # @page-cache-size:         set the pagecache size in bytes (defaults
3718 #                           to libnfs default)
3720 # @debug:                   set the NFS debug level (max 2) (defaults
3721 #                           to libnfs default)
3723 # Since: 2.9
3725 { 'struct': 'BlockdevOptionsNfs',
3726   'data': { 'server': 'NFSServer',
3727             'path': 'str',
3728             '*user': 'int',
3729             '*group': 'int',
3730             '*tcp-syn-count': 'int',
3731             '*readahead-size': 'int',
3732             '*page-cache-size': 'int',
3733             '*debug': 'int' } }
3736 # @BlockdevOptionsCurlBase:
3738 # Driver specific block device options shared by all protocols supported by the
3739 # curl backend.
3741 # @url:                     URL of the image file
3743 # @readahead:               Size of the read-ahead cache; must be a multiple of
3744 #                           512 (defaults to 256 kB)
3746 # @timeout:                 Timeout for connections, in seconds (defaults to 5)
3748 # @username:                Username for authentication (defaults to none)
3750 # @password-secret:         ID of a QCryptoSecret object providing a password
3751 #                           for authentication (defaults to no password)
3753 # @proxy-username:          Username for proxy authentication (defaults to none)
3755 # @proxy-password-secret:   ID of a QCryptoSecret object providing a password
3756 #                           for proxy authentication (defaults to no password)
3758 # Since: 2.9
3760 { 'struct': 'BlockdevOptionsCurlBase',
3761   'data': { 'url': 'str',
3762             '*readahead': 'int',
3763             '*timeout': 'int',
3764             '*username': 'str',
3765             '*password-secret': 'str',
3766             '*proxy-username': 'str',
3767             '*proxy-password-secret': 'str' } }
3770 # @BlockdevOptionsCurlHttp:
3772 # Driver specific block device options for HTTP connections over the curl
3773 # backend.  URLs must start with "http://".
3775 # @cookie:      List of cookies to set; format is
3776 #               "name1=content1; name2=content2;" as explained by
3777 #               CURLOPT_COOKIE(3). Defaults to no cookies.
3779 # @cookie-secret: ID of a QCryptoSecret object providing the cookie data in a
3780 #                 secure way. See @cookie for the format. (since 2.10)
3782 # Since: 2.9
3784 { 'struct': 'BlockdevOptionsCurlHttp',
3785   'base': 'BlockdevOptionsCurlBase',
3786   'data': { '*cookie': 'str',
3787             '*cookie-secret': 'str'} }
3790 # @BlockdevOptionsCurlHttps:
3792 # Driver specific block device options for HTTPS connections over the curl
3793 # backend.  URLs must start with "https://".
3795 # @cookie:      List of cookies to set; format is
3796 #               "name1=content1; name2=content2;" as explained by
3797 #               CURLOPT_COOKIE(3). Defaults to no cookies.
3799 # @sslverify:   Whether to verify the SSL certificate's validity (defaults to
3800 #               true)
3802 # @cookie-secret: ID of a QCryptoSecret object providing the cookie data in a
3803 #                 secure way. See @cookie for the format. (since 2.10)
3805 # Since: 2.9
3807 { 'struct': 'BlockdevOptionsCurlHttps',
3808   'base': 'BlockdevOptionsCurlBase',
3809   'data': { '*cookie': 'str',
3810             '*sslverify': 'bool',
3811             '*cookie-secret': 'str'} }
3814 # @BlockdevOptionsCurlFtp:
3816 # Driver specific block device options for FTP connections over the curl
3817 # backend.  URLs must start with "ftp://".
3819 # Since: 2.9
3821 { 'struct': 'BlockdevOptionsCurlFtp',
3822   'base': 'BlockdevOptionsCurlBase',
3823   'data': { } }
3826 # @BlockdevOptionsCurlFtps:
3828 # Driver specific block device options for FTPS connections over the curl
3829 # backend.  URLs must start with "ftps://".
3831 # @sslverify:   Whether to verify the SSL certificate's validity (defaults to
3832 #               true)
3834 # Since: 2.9
3836 { 'struct': 'BlockdevOptionsCurlFtps',
3837   'base': 'BlockdevOptionsCurlBase',
3838   'data': { '*sslverify': 'bool' } }
3841 # @BlockdevOptionsNbd:
3843 # Driver specific block device options for NBD.
3845 # @server:      NBD server address
3847 # @export:      export name
3849 # @tls-creds:   TLS credentials ID
3851 # @x-dirty-bitmap: A "qemu:dirty-bitmap:NAME" string to query in place of
3852 #                  traditional "base:allocation" block status (see
3853 #                  NBD_OPT_LIST_META_CONTEXT in the NBD protocol) (since 3.0)
3855 # @reconnect-delay: On an unexpected disconnect, the nbd client tries to
3856 #                   connect again until succeeding or encountering a serious
3857 #                   error.  During the first @reconnect-delay seconds, all
3858 #                   requests are paused and will be rerun on a successful
3859 #                   reconnect. After that time, any delayed requests and all
3860 #                   future requests before a successful reconnect will
3861 #                   immediately fail. Default 0 (Since 4.2)
3863 # Since: 2.9
3865 { 'struct': 'BlockdevOptionsNbd',
3866   'data': { 'server': 'SocketAddress',
3867             '*export': 'str',
3868             '*tls-creds': 'str',
3869             '*x-dirty-bitmap': 'str',
3870             '*reconnect-delay': 'uint32' } }
3873 # @BlockdevOptionsRaw:
3875 # Driver specific block device options for the raw driver.
3877 # @offset:      position where the block device starts
3878 # @size:        the assumed size of the device
3880 # Since: 2.9
3882 { 'struct': 'BlockdevOptionsRaw',
3883   'base': 'BlockdevOptionsGenericFormat',
3884   'data': { '*offset': 'int', '*size': 'int' } }
3887 # @BlockdevOptionsVxHS:
3889 # Driver specific block device options for VxHS
3891 # @vdisk-id:    UUID of VxHS volume
3892 # @server:      vxhs server IP, port
3893 # @tls-creds:   TLS credentials ID
3895 # Since: 2.10
3897 { 'struct': 'BlockdevOptionsVxHS',
3898   'data': { 'vdisk-id': 'str',
3899             'server': 'InetSocketAddressBase',
3900             '*tls-creds': 'str' } }
3903 # @BlockdevOptionsThrottle:
3905 # Driver specific block device options for the throttle driver
3907 # @throttle-group:   the name of the throttle-group object to use. It
3908 #                    must already exist.
3909 # @file:             reference to or definition of the data source block device
3910 # Since: 2.11
3912 { 'struct': 'BlockdevOptionsThrottle',
3913   'data': { 'throttle-group': 'str',
3914             'file' : 'BlockdevRef'
3915              } }
3917 # @BlockdevOptions:
3919 # Options for creating a block device.  Many options are available for all
3920 # block devices, independent of the block driver:
3922 # @driver:        block driver name
3923 # @node-name:     the node name of the new node (Since 2.0).
3924 #                 This option is required on the top level of blockdev-add.
3925 #                 Valid node names start with an alphabetic character and may
3926 #                 contain only alphanumeric characters, '-', '.' and '_'. Their
3927 #                 maximum length is 31 characters.
3928 # @discard:       discard-related options (default: ignore)
3929 # @cache:         cache-related options
3930 # @read-only:     whether the block device should be read-only (default: false).
3931 #                 Note that some block drivers support only read-only access,
3932 #                 either generally or in certain configurations. In this case,
3933 #                 the default value does not work and the option must be
3934 #                 specified explicitly.
3935 # @auto-read-only: if true and @read-only is false, QEMU may automatically
3936 #                  decide not to open the image read-write as requested, but
3937 #                  fall back to read-only instead (and switch between the modes
3938 #                  later), e.g. depending on whether the image file is writable
3939 #                  or whether a writing user is attached to the node
3940 #                  (default: false, since 3.1)
3941 # @detect-zeroes: detect and optimize zero writes (Since 2.1)
3942 #                 (default: off)
3943 # @force-share:   force share all permission on added nodes.
3944 #                 Requires read-only=true. (Since 2.10)
3946 # Remaining options are determined by the block driver.
3948 # Since: 2.9
3950 { 'union': 'BlockdevOptions',
3951   'base': { 'driver': 'BlockdevDriver',
3952             '*node-name': 'str',
3953             '*discard': 'BlockdevDiscardOptions',
3954             '*cache': 'BlockdevCacheOptions',
3955             '*read-only': 'bool',
3956             '*auto-read-only': 'bool',
3957             '*force-share': 'bool',
3958             '*detect-zeroes': 'BlockdevDetectZeroesOptions' },
3959   'discriminator': 'driver',
3960   'data': {
3961       'blkdebug':   'BlockdevOptionsBlkdebug',
3962       'blklogwrites':'BlockdevOptionsBlklogwrites',
3963       'blkverify':  'BlockdevOptionsBlkverify',
3964       'bochs':      'BlockdevOptionsGenericFormat',
3965       'cloop':      'BlockdevOptionsGenericFormat',
3966       'copy-on-read':'BlockdevOptionsGenericFormat',
3967       'dmg':        'BlockdevOptionsGenericFormat',
3968       'file':       'BlockdevOptionsFile',
3969       'ftp':        'BlockdevOptionsCurlFtp',
3970       'ftps':       'BlockdevOptionsCurlFtps',
3971       'gluster':    'BlockdevOptionsGluster',
3972       'host_cdrom': 'BlockdevOptionsFile',
3973       'host_device':'BlockdevOptionsFile',
3974       'http':       'BlockdevOptionsCurlHttp',
3975       'https':      'BlockdevOptionsCurlHttps',
3976       'iscsi':      'BlockdevOptionsIscsi',
3977       'luks':       'BlockdevOptionsLUKS',
3978       'nbd':        'BlockdevOptionsNbd',
3979       'nfs':        'BlockdevOptionsNfs',
3980       'null-aio':   'BlockdevOptionsNull',
3981       'null-co':    'BlockdevOptionsNull',
3982       'nvme':       'BlockdevOptionsNVMe',
3983       'parallels':  'BlockdevOptionsGenericFormat',
3984       'qcow2':      'BlockdevOptionsQcow2',
3985       'qcow':       'BlockdevOptionsQcow',
3986       'qed':        'BlockdevOptionsGenericCOWFormat',
3987       'quorum':     'BlockdevOptionsQuorum',
3988       'raw':        'BlockdevOptionsRaw',
3989       'rbd':        'BlockdevOptionsRbd',
3990       'replication': { 'type': 'BlockdevOptionsReplication',
3991                        'if': 'defined(CONFIG_REPLICATION)' },
3992       'sheepdog':   'BlockdevOptionsSheepdog',
3993       'ssh':        'BlockdevOptionsSsh',
3994       'throttle':   'BlockdevOptionsThrottle',
3995       'vdi':        'BlockdevOptionsGenericFormat',
3996       'vhdx':       'BlockdevOptionsGenericFormat',
3997       'vmdk':       'BlockdevOptionsGenericCOWFormat',
3998       'vpc':        'BlockdevOptionsGenericFormat',
3999       'vvfat':      'BlockdevOptionsVVFAT',
4000       'vxhs':       'BlockdevOptionsVxHS'
4001   } }
4004 # @BlockdevRef:
4006 # Reference to a block device.
4008 # @definition:      defines a new block device inline
4009 # @reference:       references the ID of an existing block device
4011 # Since: 2.9
4013 { 'alternate': 'BlockdevRef',
4014   'data': { 'definition': 'BlockdevOptions',
4015             'reference': 'str' } }
4018 # @BlockdevRefOrNull:
4020 # Reference to a block device.
4022 # @definition:      defines a new block device inline
4023 # @reference:       references the ID of an existing block device.
4024 #                   An empty string means that no block device should
4025 #                   be referenced.  Deprecated; use null instead.
4026 # @null:            No block device should be referenced (since 2.10)
4028 # Since: 2.9
4030 { 'alternate': 'BlockdevRefOrNull',
4031   'data': { 'definition': 'BlockdevOptions',
4032             'reference': 'str',
4033             'null': 'null' } }
4036 # @blockdev-add:
4038 # Creates a new block device. If the @id option is given at the top level, a
4039 # BlockBackend will be created; otherwise, @node-name is mandatory at the top
4040 # level and no BlockBackend will be created.
4042 # Since: 2.9
4044 # Example:
4046 # 1.
4047 # -> { "execute": "blockdev-add",
4048 #      "arguments": {
4049 #           "driver": "qcow2",
4050 #           "node-name": "test1",
4051 #           "file": {
4052 #               "driver": "file",
4053 #               "filename": "test.qcow2"
4054 #            }
4055 #       }
4056 #     }
4057 # <- { "return": {} }
4059 # 2.
4060 # -> { "execute": "blockdev-add",
4061 #      "arguments": {
4062 #           "driver": "qcow2",
4063 #           "node-name": "node0",
4064 #           "discard": "unmap",
4065 #           "cache": {
4066 #              "direct": true
4067 #            },
4068 #            "file": {
4069 #              "driver": "file",
4070 #              "filename": "/tmp/test.qcow2"
4071 #            },
4072 #            "backing": {
4073 #               "driver": "raw",
4074 #               "file": {
4075 #                  "driver": "file",
4076 #                  "filename": "/dev/fdset/4"
4077 #                }
4078 #            }
4079 #        }
4080 #      }
4082 # <- { "return": {} }
4085 { 'command': 'blockdev-add', 'data': 'BlockdevOptions', 'boxed': true }
4088 # @x-blockdev-reopen:
4090 # Reopens a block device using the given set of options. Any option
4091 # not specified will be reset to its default value regardless of its
4092 # previous status. If an option cannot be changed or a particular
4093 # driver does not support reopening then the command will return an
4094 # error.
4096 # The top-level @node-name option (from BlockdevOptions) must be
4097 # specified and is used to select the block device to be reopened.
4098 # Other @node-name options must be either omitted or set to the
4099 # current name of the appropriate node. This command won't change any
4100 # node name and any attempt to do it will result in an error.
4102 # In the case of options that refer to child nodes, the behavior of
4103 # this command depends on the value:
4105 #  1) A set of options (BlockdevOptions): the child is reopened with
4106 #     the specified set of options.
4108 #  2) A reference to the current child: the child is reopened using
4109 #     its existing set of options.
4111 #  3) A reference to a different node: the current child is replaced
4112 #     with the specified one.
4114 #  4) NULL: the current child (if any) is detached.
4116 # Options (1) and (2) are supported in all cases, but at the moment
4117 # only @backing allows replacing or detaching an existing child.
4119 # Unlike with blockdev-add, the @backing option must always be present
4120 # unless the node being reopened does not have a backing file and its
4121 # image does not have a default backing file name as part of its
4122 # metadata.
4124 # Since: 4.0
4126 { 'command': 'x-blockdev-reopen',
4127   'data': 'BlockdevOptions', 'boxed': true }
4130 # @blockdev-del:
4132 # Deletes a block device that has been added using blockdev-add.
4133 # The command will fail if the node is attached to a device or is
4134 # otherwise being used.
4136 # @node-name: Name of the graph node to delete.
4138 # Since: 2.9
4140 # Example:
4142 # -> { "execute": "blockdev-add",
4143 #      "arguments": {
4144 #           "driver": "qcow2",
4145 #           "node-name": "node0",
4146 #           "file": {
4147 #               "driver": "file",
4148 #               "filename": "test.qcow2"
4149 #           }
4150 #      }
4151 #    }
4152 # <- { "return": {} }
4154 # -> { "execute": "blockdev-del",
4155 #      "arguments": { "node-name": "node0" }
4156 #    }
4157 # <- { "return": {} }
4160 { 'command': 'blockdev-del', 'data': { 'node-name': 'str' } }
4163 # @BlockdevCreateOptionsFile:
4165 # Driver specific image creation options for file.
4167 # @filename         Filename for the new image file
4168 # @size             Size of the virtual disk in bytes
4169 # @preallocation    Preallocation mode for the new image (default: off;
4170 #                   allowed values: off,
4171 #                   falloc (if defined CONFIG_POSIX_FALLOCATE),
4172 #                   full (if defined CONFIG_POSIX))
4173 # @nocow            Turn off copy-on-write (valid only on btrfs; default: off)
4175 # Since: 2.12
4177 { 'struct': 'BlockdevCreateOptionsFile',
4178   'data': { 'filename':         'str',
4179             'size':             'size',
4180             '*preallocation':   'PreallocMode',
4181             '*nocow':           'bool' } }
4184 # @BlockdevCreateOptionsGluster:
4186 # Driver specific image creation options for gluster.
4188 # @location         Where to store the new image file
4189 # @size             Size of the virtual disk in bytes
4190 # @preallocation    Preallocation mode for the new image (default: off;
4191 #                   allowed values: off,
4192 #                   falloc (if defined CONFIG_GLUSTERFS_FALLOCATE),
4193 #                   full (if defined CONFIG_GLUSTERFS_ZEROFILL))
4195 # Since: 2.12
4197 { 'struct': 'BlockdevCreateOptionsGluster',
4198   'data': { 'location':         'BlockdevOptionsGluster',
4199             'size':             'size',
4200             '*preallocation':   'PreallocMode' } }
4203 # @BlockdevCreateOptionsLUKS:
4205 # Driver specific image creation options for LUKS.
4207 # @file             Node to create the image format on
4208 # @size             Size of the virtual disk in bytes
4210 # Since: 2.12
4212 { 'struct': 'BlockdevCreateOptionsLUKS',
4213   'base': 'QCryptoBlockCreateOptionsLUKS',
4214   'data': { 'file':             'BlockdevRef',
4215             'size':             'size' } }
4218 # @BlockdevCreateOptionsNfs:
4220 # Driver specific image creation options for NFS.
4222 # @location         Where to store the new image file
4223 # @size             Size of the virtual disk in bytes
4225 # Since: 2.12
4227 { 'struct': 'BlockdevCreateOptionsNfs',
4228   'data': { 'location':         'BlockdevOptionsNfs',
4229             'size':             'size' } }
4232 # @BlockdevCreateOptionsParallels:
4234 # Driver specific image creation options for parallels.
4236 # @file             Node to create the image format on
4237 # @size             Size of the virtual disk in bytes
4238 # @cluster-size     Cluster size in bytes (default: 1 MB)
4240 # Since: 2.12
4242 { 'struct': 'BlockdevCreateOptionsParallels',
4243   'data': { 'file':             'BlockdevRef',
4244             'size':             'size',
4245             '*cluster-size':    'size' } }
4248 # @BlockdevCreateOptionsQcow:
4250 # Driver specific image creation options for qcow.
4252 # @file             Node to create the image format on
4253 # @size             Size of the virtual disk in bytes
4254 # @backing-file     File name of the backing file if a backing file
4255 #                   should be used
4256 # @encrypt          Encryption options if the image should be encrypted
4258 # Since: 2.12
4260 { 'struct': 'BlockdevCreateOptionsQcow',
4261   'data': { 'file':             'BlockdevRef',
4262             'size':             'size',
4263             '*backing-file':    'str',
4264             '*encrypt':         'QCryptoBlockCreateOptions' } }
4267 # @BlockdevQcow2Version:
4269 # @v2:  The original QCOW2 format as introduced in qemu 0.10 (version 2)
4270 # @v3:  The extended QCOW2 format as introduced in qemu 1.1 (version 3)
4272 # Since: 2.12
4274 { 'enum': 'BlockdevQcow2Version',
4275   'data': [ 'v2', 'v3' ] }
4279 # @BlockdevCreateOptionsQcow2:
4281 # Driver specific image creation options for qcow2.
4283 # @file             Node to create the image format on
4284 # @data-file        Node to use as an external data file in which all guest
4285 #                   data is stored so that only metadata remains in the qcow2
4286 #                   file (since: 4.0)
4287 # @data-file-raw    True if the external data file must stay valid as a
4288 #                   standalone (read-only) raw image without looking at qcow2
4289 #                   metadata (default: false; since: 4.0)
4290 # @size             Size of the virtual disk in bytes
4291 # @version          Compatibility level (default: v3)
4292 # @backing-file     File name of the backing file if a backing file
4293 #                   should be used
4294 # @backing-fmt      Name of the block driver to use for the backing file
4295 # @encrypt          Encryption options if the image should be encrypted
4296 # @cluster-size     qcow2 cluster size in bytes (default: 65536)
4297 # @preallocation    Preallocation mode for the new image (default: off;
4298 #                   allowed values: off, falloc, full, metadata)
4299 # @lazy-refcounts   True if refcounts may be updated lazily (default: off)
4300 # @refcount-bits    Width of reference counts in bits (default: 16)
4302 # Since: 2.12
4304 { 'struct': 'BlockdevCreateOptionsQcow2',
4305   'data': { 'file':             'BlockdevRef',
4306             '*data-file':       'BlockdevRef',
4307             '*data-file-raw':   'bool',
4308             'size':             'size',
4309             '*version':         'BlockdevQcow2Version',
4310             '*backing-file':    'str',
4311             '*backing-fmt':     'BlockdevDriver',
4312             '*encrypt':         'QCryptoBlockCreateOptions',
4313             '*cluster-size':    'size',
4314             '*preallocation':   'PreallocMode',
4315             '*lazy-refcounts':  'bool',
4316             '*refcount-bits':   'int' } }
4319 # @BlockdevCreateOptionsQed:
4321 # Driver specific image creation options for qed.
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 # @backing-fmt      Name of the block driver to use for the backing file
4328 # @cluster-size     Cluster size in bytes (default: 65536)
4329 # @table-size       L1/L2 table size (in clusters)
4331 # Since: 2.12
4333 { 'struct': 'BlockdevCreateOptionsQed',
4334   'data': { 'file':             'BlockdevRef',
4335             'size':             'size',
4336             '*backing-file':    'str',
4337             '*backing-fmt':     'BlockdevDriver',
4338             '*cluster-size':    'size',
4339             '*table-size':      'int' } }
4342 # @BlockdevCreateOptionsRbd:
4344 # Driver specific image creation options for rbd/Ceph.
4346 # @location         Where to store the new image file. This location cannot
4347 #                   point to a snapshot.
4348 # @size             Size of the virtual disk in bytes
4349 # @cluster-size     RBD object size
4351 # Since: 2.12
4353 { 'struct': 'BlockdevCreateOptionsRbd',
4354   'data': { 'location':         'BlockdevOptionsRbd',
4355             'size':             'size',
4356             '*cluster-size' :   'size' } }
4359 # @BlockdevVmdkSubformat:
4361 # Subformat options for VMDK images
4363 # @monolithicSparse:     Single file image with sparse cluster allocation
4365 # @monolithicFlat:       Single flat data image and a descriptor file
4367 # @twoGbMaxExtentSparse: Data is split into 2GB (per virtual LBA) sparse extent
4368 #                        files, in addition to a descriptor file
4370 # @twoGbMaxExtentFlat:   Data is split into 2GB (per virtual LBA) flat extent
4371 #                        files, in addition to a descriptor file
4373 # @streamOptimized:      Single file image sparse cluster allocation, optimized
4374 #                        for streaming over network.
4376 # Since: 4.0
4378 { 'enum': 'BlockdevVmdkSubformat',
4379   'data': [ 'monolithicSparse', 'monolithicFlat', 'twoGbMaxExtentSparse',
4380             'twoGbMaxExtentFlat', 'streamOptimized'] }
4383 # @BlockdevVmdkAdapterType:
4385 # Adapter type info for VMDK images
4387 # Since: 4.0
4389 { 'enum': 'BlockdevVmdkAdapterType',
4390   'data': [ 'ide', 'buslogic', 'lsilogic', 'legacyESX'] }
4393 # @BlockdevCreateOptionsVmdk:
4395 # Driver specific image creation options for VMDK.
4397 # @file         Where to store the new image file. This refers to the image
4398 #               file for monolithcSparse and streamOptimized format, or the
4399 #               descriptor file for other formats.
4400 # @size         Size of the virtual disk in bytes
4401 # @extents      Where to store the data extents. Required for monolithcFlat,
4402 #               twoGbMaxExtentSparse and twoGbMaxExtentFlat formats. For
4403 #               monolithicFlat, only one entry is required; for
4404 #               twoGbMaxExtent* formats, the number of entries required is
4405 #               calculated as extent_number = virtual_size / 2GB. Providing
4406 #               more extents than will be used is an error.
4407 # @subformat    The subformat of the VMDK image. Default: "monolithicSparse".
4408 # @backing-file The path of backing file. Default: no backing file is used.
4409 # @adapter-type The adapter type used to fill in the descriptor. Default: ide.
4410 # @hwversion    Hardware version. The meaningful options are "4" or "6".
4411 #               Default: "4".
4412 # @zeroed-grain Whether to enable zeroed-grain feature for sparse subformats.
4413 #               Default: false.
4415 # Since: 4.0
4417 { 'struct': 'BlockdevCreateOptionsVmdk',
4418   'data': { 'file':             'BlockdevRef',
4419             'size':             'size',
4420             '*extents':          ['BlockdevRef'],
4421             '*subformat':       'BlockdevVmdkSubformat',
4422             '*backing-file':    'str',
4423             '*adapter-type':    'BlockdevVmdkAdapterType',
4424             '*hwversion':       'str',
4425             '*zeroed-grain':    'bool' } }
4429 # @SheepdogRedundancyType:
4431 # @full             Create a fully replicated vdi with x copies
4432 # @erasure-coded    Create an erasure coded vdi with x data strips and
4433 #                   y parity strips
4435 # Since: 2.12
4437 { 'enum': 'SheepdogRedundancyType',
4438   'data': [ 'full', 'erasure-coded' ] }
4441 # @SheepdogRedundancyFull:
4443 # @copies           Number of copies to use (between 1 and 31)
4445 # Since: 2.12
4447 { 'struct': 'SheepdogRedundancyFull',
4448   'data': { 'copies': 'int' }}
4451 # @SheepdogRedundancyErasureCoded:
4453 # @data-strips      Number of data strips to use (one of {2,4,8,16})
4454 # @parity-strips    Number of parity strips to use (between 1 and 15)
4456 # Since: 2.12
4458 { 'struct': 'SheepdogRedundancyErasureCoded',
4459   'data': { 'data-strips': 'int',
4460             'parity-strips': 'int' }}
4463 # @SheepdogRedundancy:
4465 # Since: 2.12
4467 { 'union': 'SheepdogRedundancy',
4468   'base': { 'type': 'SheepdogRedundancyType' },
4469   'discriminator': 'type',
4470   'data': { 'full': 'SheepdogRedundancyFull',
4471             'erasure-coded': 'SheepdogRedundancyErasureCoded' } }
4474 # @BlockdevCreateOptionsSheepdog:
4476 # Driver specific image creation options for Sheepdog.
4478 # @location         Where to store the new image file
4479 # @size             Size of the virtual disk in bytes
4480 # @backing-file     File name of a base image
4481 # @preallocation    Preallocation mode for the new image (default: off;
4482 #                   allowed values: off, full)
4483 # @redundancy       Redundancy of the image
4484 # @object-size      Object size of the image
4486 # Since: 2.12
4488 { 'struct': 'BlockdevCreateOptionsSheepdog',
4489   'data': { 'location':         'BlockdevOptionsSheepdog',
4490             'size':             'size',
4491             '*backing-file':    'str',
4492             '*preallocation':   'PreallocMode',
4493             '*redundancy':      'SheepdogRedundancy',
4494             '*object-size':     'size' } }
4497 # @BlockdevCreateOptionsSsh:
4499 # Driver specific image creation options for SSH.
4501 # @location         Where to store the new image file
4502 # @size             Size of the virtual disk in bytes
4504 # Since: 2.12
4506 { 'struct': 'BlockdevCreateOptionsSsh',
4507   'data': { 'location':         'BlockdevOptionsSsh',
4508             'size':             'size' } }
4511 # @BlockdevCreateOptionsVdi:
4513 # Driver specific image creation options for VDI.
4515 # @file             Node to create the image format on
4516 # @size             Size of the virtual disk in bytes
4517 # @preallocation    Preallocation mode for the new image (default: off;
4518 #                   allowed values: off, metadata)
4520 # Since: 2.12
4522 { 'struct': 'BlockdevCreateOptionsVdi',
4523   'data': { 'file':             'BlockdevRef',
4524             'size':             'size',
4525             '*preallocation':   'PreallocMode' } }
4528 # @BlockdevVhdxSubformat:
4530 # @dynamic: Growing image file
4531 # @fixed:   Preallocated fixed-size image file
4533 # Since: 2.12
4535 { 'enum': 'BlockdevVhdxSubformat',
4536   'data': [ 'dynamic', 'fixed' ] }
4539 # @BlockdevCreateOptionsVhdx:
4541 # Driver specific image creation options for vhdx.
4543 # @file             Node to create the image format on
4544 # @size             Size of the virtual disk in bytes
4545 # @log-size         Log size in bytes, must be a multiple of 1 MB
4546 #                   (default: 1 MB)
4547 # @block-size       Block size in bytes, must be a multiple of 1 MB and not
4548 #                   larger than 256 MB (default: automatically choose a block
4549 #                   size depending on the image size)
4550 # @subformat        vhdx subformat (default: dynamic)
4551 # @block-state-zero Force use of payload blocks of type 'ZERO'. Non-standard,
4552 #                   but default.  Do not set to 'off' when using 'qemu-img
4553 #                   convert' with subformat=dynamic.
4555 # Since: 2.12
4557 { 'struct': 'BlockdevCreateOptionsVhdx',
4558   'data': { 'file':                 'BlockdevRef',
4559             'size':                 'size',
4560             '*log-size':            'size',
4561             '*block-size':          'size',
4562             '*subformat':           'BlockdevVhdxSubformat',
4563             '*block-state-zero':    'bool' } }
4566 # @BlockdevVpcSubformat:
4568 # @dynamic: Growing image file
4569 # @fixed:   Preallocated fixed-size image file
4571 # Since: 2.12
4573 { 'enum': 'BlockdevVpcSubformat',
4574   'data': [ 'dynamic', 'fixed' ] }
4577 # @BlockdevCreateOptionsVpc:
4579 # Driver specific image creation options for vpc (VHD).
4581 # @file             Node to create the image format on
4582 # @size             Size of the virtual disk in bytes
4583 # @subformat        vhdx subformat (default: dynamic)
4584 # @force-size       Force use of the exact byte size instead of rounding to the
4585 #                   next size that can be represented in CHS geometry
4586 #                   (default: false)
4588 # Since: 2.12
4590 { 'struct': 'BlockdevCreateOptionsVpc',
4591   'data': { 'file':                 'BlockdevRef',
4592             'size':                 'size',
4593             '*subformat':           'BlockdevVpcSubformat',
4594             '*force-size':          'bool' } }
4597 # @BlockdevCreateOptions:
4599 # Options for creating an image format on a given node.
4601 # @driver           block driver to create the image format
4603 # Since: 2.12
4605 { 'union': 'BlockdevCreateOptions',
4606   'base': {
4607       'driver':         'BlockdevDriver' },
4608   'discriminator': 'driver',
4609   'data': {
4610       'file':           'BlockdevCreateOptionsFile',
4611       'gluster':        'BlockdevCreateOptionsGluster',
4612       'luks':           'BlockdevCreateOptionsLUKS',
4613       'nfs':            'BlockdevCreateOptionsNfs',
4614       'parallels':      'BlockdevCreateOptionsParallels',
4615       'qcow':           'BlockdevCreateOptionsQcow',
4616       'qcow2':          'BlockdevCreateOptionsQcow2',
4617       'qed':            'BlockdevCreateOptionsQed',
4618       'rbd':            'BlockdevCreateOptionsRbd',
4619       'sheepdog':       'BlockdevCreateOptionsSheepdog',
4620       'ssh':            'BlockdevCreateOptionsSsh',
4621       'vdi':            'BlockdevCreateOptionsVdi',
4622       'vhdx':           'BlockdevCreateOptionsVhdx',
4623       'vmdk':           'BlockdevCreateOptionsVmdk',
4624       'vpc':            'BlockdevCreateOptionsVpc'
4625   } }
4628 # @blockdev-create:
4630 # Starts a job to create an image format on a given node. The job is
4631 # automatically finalized, but a manual job-dismiss is required.
4633 # @job-id:          Identifier for the newly created job.
4635 # @options:         Options for the image creation.
4637 # Since: 3.0
4639 { 'command': 'blockdev-create',
4640   'data': { 'job-id': 'str',
4641             'options': 'BlockdevCreateOptions' } }
4644 # @blockdev-open-tray:
4646 # Opens a block device's tray. If there is a block driver state tree inserted as
4647 # a medium, it will become inaccessible to the guest (but it will remain
4648 # associated to the block device, so closing the tray will make it accessible
4649 # again).
4651 # If the tray was already open before, this will be a no-op.
4653 # Once the tray opens, a DEVICE_TRAY_MOVED event is emitted. There are cases in
4654 # which no such event will be generated, these include:
4655 # - if the guest has locked the tray, @force is false and the guest does not
4656 #   respond to the eject request
4657 # - if the BlockBackend denoted by @device does not have a guest device attached
4658 #   to it
4659 # - if the guest device does not have an actual tray
4661 # @device: Block device name (deprecated, use @id instead)
4663 # @id:     The name or QOM path of the guest device (since: 2.8)
4665 # @force:  if false (the default), an eject request will be sent to
4666 #          the guest if it has locked the tray (and the tray will not be opened
4667 #          immediately); if true, the tray will be opened regardless of whether
4668 #          it is locked
4670 # Since: 2.5
4672 # Example:
4674 # -> { "execute": "blockdev-open-tray",
4675 #      "arguments": { "id": "ide0-1-0" } }
4677 # <- { "timestamp": { "seconds": 1418751016,
4678 #                     "microseconds": 716996 },
4679 #      "event": "DEVICE_TRAY_MOVED",
4680 #      "data": { "device": "ide1-cd0",
4681 #                "id": "ide0-1-0",
4682 #                "tray-open": true } }
4684 # <- { "return": {} }
4687 { 'command': 'blockdev-open-tray',
4688   'data': { '*device': 'str',
4689             '*id': 'str',
4690             '*force': 'bool' } }
4693 # @blockdev-close-tray:
4695 # Closes a block device's tray. If there is a block driver state tree associated
4696 # with the block device (which is currently ejected), that tree will be loaded
4697 # as the medium.
4699 # If the tray was already closed before, this will be a no-op.
4701 # @device:  Block device name (deprecated, use @id instead)
4703 # @id:      The name or QOM path of the guest device (since: 2.8)
4705 # Since: 2.5
4707 # Example:
4709 # -> { "execute": "blockdev-close-tray",
4710 #      "arguments": { "id": "ide0-1-0" } }
4712 # <- { "timestamp": { "seconds": 1418751345,
4713 #                     "microseconds": 272147 },
4714 #      "event": "DEVICE_TRAY_MOVED",
4715 #      "data": { "device": "ide1-cd0",
4716 #                "id": "ide0-1-0",
4717 #                "tray-open": false } }
4719 # <- { "return": {} }
4722 { 'command': 'blockdev-close-tray',
4723   'data': { '*device': 'str',
4724             '*id': 'str' } }
4727 # @blockdev-remove-medium:
4729 # Removes a medium (a block driver state tree) from a block device. That block
4730 # device's tray must currently be open (unless there is no attached guest
4731 # device).
4733 # If the tray is open and there is no medium inserted, this will be a no-op.
4735 # @id:     The name or QOM path of the guest device
4737 # Since: 2.12
4739 # Example:
4741 # -> { "execute": "blockdev-remove-medium",
4742 #      "arguments": { "id": "ide0-1-0" } }
4744 # <- { "error": { "class": "GenericError",
4745 #                 "desc": "Tray of device 'ide0-1-0' is not open" } }
4747 # -> { "execute": "blockdev-open-tray",
4748 #      "arguments": { "id": "ide0-1-0" } }
4750 # <- { "timestamp": { "seconds": 1418751627,
4751 #                     "microseconds": 549958 },
4752 #      "event": "DEVICE_TRAY_MOVED",
4753 #      "data": { "device": "ide1-cd0",
4754 #                "id": "ide0-1-0",
4755 #                "tray-open": true } }
4757 # <- { "return": {} }
4759 # -> { "execute": "blockdev-remove-medium",
4760 #      "arguments": { "id": "ide0-1-0" } }
4762 # <- { "return": {} }
4765 { 'command': 'blockdev-remove-medium',
4766   'data': { 'id': 'str' } }
4769 # @blockdev-insert-medium:
4771 # Inserts a medium (a block driver state tree) into a block device. That block
4772 # device's tray must currently be open (unless there is no attached guest
4773 # device) and there must be no medium inserted already.
4775 # @id:        The name or QOM path of the guest device
4777 # @node-name: name of a node in the block driver state graph
4779 # Since: 2.12
4781 # Example:
4783 # -> { "execute": "blockdev-add",
4784 #      "arguments": {
4785 #          "node-name": "node0",
4786 #          "driver": "raw",
4787 #          "file": { "driver": "file",
4788 #                    "filename": "fedora.iso" } } }
4789 # <- { "return": {} }
4791 # -> { "execute": "blockdev-insert-medium",
4792 #      "arguments": { "id": "ide0-1-0",
4793 #                     "node-name": "node0" } }
4795 # <- { "return": {} }
4798 { 'command': 'blockdev-insert-medium',
4799   'data': { 'id': 'str',
4800             'node-name': 'str'} }
4804 # @BlockdevChangeReadOnlyMode:
4806 # Specifies the new read-only mode of a block device subject to the
4807 # @blockdev-change-medium command.
4809 # @retain:      Retains the current read-only mode
4811 # @read-only:   Makes the device read-only
4813 # @read-write:  Makes the device writable
4815 # Since: 2.3
4818 { 'enum': 'BlockdevChangeReadOnlyMode',
4819   'data': ['retain', 'read-only', 'read-write'] }
4823 # @blockdev-change-medium:
4825 # Changes the medium inserted into a block device by ejecting the current medium
4826 # and loading a new image file which is inserted as the new medium (this command
4827 # combines blockdev-open-tray, blockdev-remove-medium, blockdev-insert-medium
4828 # and blockdev-close-tray).
4830 # @device:          Block device name (deprecated, use @id instead)
4832 # @id:              The name or QOM path of the guest device
4833 #                   (since: 2.8)
4835 # @filename:        filename of the new image to be loaded
4837 # @format:          format to open the new image with (defaults to
4838 #                   the probed format)
4840 # @read-only-mode:  change the read-only mode of the device; defaults
4841 #                   to 'retain'
4843 # Since: 2.5
4845 # Examples:
4847 # 1. Change a removable medium
4849 # -> { "execute": "blockdev-change-medium",
4850 #      "arguments": { "id": "ide0-1-0",
4851 #                     "filename": "/srv/images/Fedora-12-x86_64-DVD.iso",
4852 #                     "format": "raw" } }
4853 # <- { "return": {} }
4855 # 2. Load a read-only medium into a writable drive
4857 # -> { "execute": "blockdev-change-medium",
4858 #      "arguments": { "id": "floppyA",
4859 #                     "filename": "/srv/images/ro.img",
4860 #                     "format": "raw",
4861 #                     "read-only-mode": "retain" } }
4863 # <- { "error":
4864 #      { "class": "GenericError",
4865 #        "desc": "Could not open '/srv/images/ro.img': Permission denied" } }
4867 # -> { "execute": "blockdev-change-medium",
4868 #      "arguments": { "id": "floppyA",
4869 #                     "filename": "/srv/images/ro.img",
4870 #                     "format": "raw",
4871 #                     "read-only-mode": "read-only" } }
4873 # <- { "return": {} }
4876 { 'command': 'blockdev-change-medium',
4877   'data': { '*device': 'str',
4878             '*id': 'str',
4879             'filename': 'str',
4880             '*format': 'str',
4881             '*read-only-mode': 'BlockdevChangeReadOnlyMode' } }
4885 # @BlockErrorAction:
4887 # An enumeration of action that has been taken when a DISK I/O occurs
4889 # @ignore: error has been ignored
4891 # @report: error has been reported to the device
4893 # @stop: error caused VM to be stopped
4895 # Since: 2.1
4897 { 'enum': 'BlockErrorAction',
4898   'data': [ 'ignore', 'report', 'stop' ] }
4902 # @BLOCK_IMAGE_CORRUPTED:
4904 # Emitted when a disk image is being marked corrupt. The image can be
4905 # identified by its device or node name. The 'device' field is always
4906 # present for compatibility reasons, but it can be empty ("") if the
4907 # image does not have a device name associated.
4909 # @device: device name. This is always present for compatibility
4910 #          reasons, but it can be empty ("") if the image does not
4911 #          have a device name associated.
4913 # @node-name: node name (Since: 2.4)
4915 # @msg: informative message for human consumption, such as the kind of
4916 #       corruption being detected. It should not be parsed by machine as it is
4917 #       not guaranteed to be stable
4919 # @offset: if the corruption resulted from an image access, this is
4920 #          the host's access offset into the image
4922 # @size: if the corruption resulted from an image access, this is
4923 #        the access size
4925 # @fatal: if set, the image is marked corrupt and therefore unusable after this
4926 #        event and must be repaired (Since 2.2; before, every
4927 #        BLOCK_IMAGE_CORRUPTED event was fatal)
4929 # Note: If action is "stop", a STOP event will eventually follow the
4930 #       BLOCK_IO_ERROR event.
4932 # Example:
4934 # <- { "event": "BLOCK_IMAGE_CORRUPTED",
4935 #      "data": { "device": "ide0-hd0", "node-name": "node0",
4936 #                "msg": "Prevented active L1 table overwrite", "offset": 196608,
4937 #                "size": 65536 },
4938 #      "timestamp": { "seconds": 1378126126, "microseconds": 966463 } }
4940 # Since: 1.7
4942 { 'event': 'BLOCK_IMAGE_CORRUPTED',
4943   'data': { 'device'     : 'str',
4944             '*node-name' : 'str',
4945             'msg'        : 'str',
4946             '*offset'    : 'int',
4947             '*size'      : 'int',
4948             'fatal'      : 'bool' } }
4951 # @BLOCK_IO_ERROR:
4953 # Emitted when a disk I/O error occurs
4955 # @device: device name. This is always present for compatibility
4956 #          reasons, but it can be empty ("") if the image does not
4957 #          have a device name associated.
4959 # @node-name: node name. Note that errors may be reported for the root node
4960 #             that is directly attached to a guest device rather than for the
4961 #             node where the error occurred. The node name is not present if
4962 #             the drive is empty. (Since: 2.8)
4964 # @operation: I/O operation
4966 # @action: action that has been taken
4968 # @nospace: true if I/O error was caused due to a no-space
4969 #           condition. This key is only present if query-block's
4970 #           io-status is present, please see query-block documentation
4971 #           for more information (since: 2.2)
4973 # @reason: human readable string describing the error cause.
4974 #          (This field is a debugging aid for humans, it should not
4975 #           be parsed by applications) (since: 2.2)
4977 # Note: If action is "stop", a STOP event will eventually follow the
4978 # BLOCK_IO_ERROR event
4980 # Since: 0.13.0
4982 # Example:
4984 # <- { "event": "BLOCK_IO_ERROR",
4985 #      "data": { "device": "ide0-hd1",
4986 #                "node-name": "#block212",
4987 #                "operation": "write",
4988 #                "action": "stop" },
4989 #      "timestamp": { "seconds": 1265044230, "microseconds": 450486 } }
4992 { 'event': 'BLOCK_IO_ERROR',
4993   'data': { 'device': 'str', '*node-name': 'str',
4994             'operation': 'IoOperationType',
4995             'action': 'BlockErrorAction', '*nospace': 'bool',
4996             'reason': 'str' } }
4999 # @BLOCK_JOB_COMPLETED:
5001 # Emitted when a block job has completed
5003 # @type: job type
5005 # @device: The job identifier. Originally the device name but other
5006 #          values are allowed since QEMU 2.7
5008 # @len: maximum progress value
5010 # @offset: current progress value. On success this is equal to len.
5011 #          On failure this is less than len
5013 # @speed: rate limit, bytes per second
5015 # @error: error message. Only present on failure. This field
5016 #         contains a human-readable error message. There are no semantics
5017 #         other than that streaming has failed and clients should not try to
5018 #         interpret the error string
5020 # Since: 1.1
5022 # Example:
5024 # <- { "event": "BLOCK_JOB_COMPLETED",
5025 #      "data": { "type": "stream", "device": "virtio-disk0",
5026 #                "len": 10737418240, "offset": 10737418240,
5027 #                "speed": 0 },
5028 #      "timestamp": { "seconds": 1267061043, "microseconds": 959568 } }
5031 { 'event': 'BLOCK_JOB_COMPLETED',
5032   'data': { 'type'  : 'JobType',
5033             'device': 'str',
5034             'len'   : 'int',
5035             'offset': 'int',
5036             'speed' : 'int',
5037             '*error': 'str' } }
5040 # @BLOCK_JOB_CANCELLED:
5042 # Emitted when a block job has been cancelled
5044 # @type: job type
5046 # @device: The job identifier. Originally the device name but other
5047 #          values are allowed since QEMU 2.7
5049 # @len: maximum progress value
5051 # @offset: current progress value. On success this is equal to len.
5052 #          On failure this is less than len
5054 # @speed: rate limit, bytes per second
5056 # Since: 1.1
5058 # Example:
5060 # <- { "event": "BLOCK_JOB_CANCELLED",
5061 #      "data": { "type": "stream", "device": "virtio-disk0",
5062 #                "len": 10737418240, "offset": 134217728,
5063 #                "speed": 0 },
5064 #      "timestamp": { "seconds": 1267061043, "microseconds": 959568 } }
5067 { 'event': 'BLOCK_JOB_CANCELLED',
5068   'data': { 'type'  : 'JobType',
5069             'device': 'str',
5070             'len'   : 'int',
5071             'offset': 'int',
5072             'speed' : 'int' } }
5075 # @BLOCK_JOB_ERROR:
5077 # Emitted when a block job encounters an error
5079 # @device: The job identifier. Originally the device name but other
5080 #          values are allowed since QEMU 2.7
5082 # @operation: I/O operation
5084 # @action: action that has been taken
5086 # Since: 1.3
5088 # Example:
5090 # <- { "event": "BLOCK_JOB_ERROR",
5091 #      "data": { "device": "ide0-hd1",
5092 #                "operation": "write",
5093 #                "action": "stop" },
5094 #      "timestamp": { "seconds": 1265044230, "microseconds": 450486 } }
5097 { 'event': 'BLOCK_JOB_ERROR',
5098   'data': { 'device'   : 'str',
5099             'operation': 'IoOperationType',
5100             'action'   : 'BlockErrorAction' } }
5103 # @BLOCK_JOB_READY:
5105 # Emitted when a block job is ready to complete
5107 # @type: job type
5109 # @device: The job identifier. Originally the device name but other
5110 #          values are allowed since QEMU 2.7
5112 # @len: maximum progress value
5114 # @offset: current progress value. On success this is equal to len.
5115 #          On failure this is less than len
5117 # @speed: rate limit, bytes per second
5119 # Note: The "ready to complete" status is always reset by a @BLOCK_JOB_ERROR
5120 # event
5122 # Since: 1.3
5124 # Example:
5126 # <- { "event": "BLOCK_JOB_READY",
5127 #      "data": { "device": "drive0", "type": "mirror", "speed": 0,
5128 #                "len": 2097152, "offset": 2097152 }
5129 #      "timestamp": { "seconds": 1265044230, "microseconds": 450486 } }
5132 { 'event': 'BLOCK_JOB_READY',
5133   'data': { 'type'  : 'JobType',
5134             'device': 'str',
5135             'len'   : 'int',
5136             'offset': 'int',
5137             'speed' : 'int' } }
5140 # @BLOCK_JOB_PENDING:
5142 # Emitted when a block job is awaiting explicit authorization to finalize graph
5143 # changes via @block-job-finalize. If this job is part of a transaction, it will
5144 # not emit this event until the transaction has converged first.
5146 # @type: job type
5148 # @id: The job identifier.
5150 # Since: 2.12
5152 # Example:
5154 # <- { "event": "BLOCK_JOB_WAITING",
5155 #      "data": { "device": "drive0", "type": "mirror" },
5156 #      "timestamp": { "seconds": 1265044230, "microseconds": 450486 } }
5159 { 'event': 'BLOCK_JOB_PENDING',
5160   'data': { 'type'  : 'JobType',
5161             'id'    : 'str' } }
5164 # @PreallocMode:
5166 # Preallocation mode of QEMU image file
5168 # @off: no preallocation
5169 # @metadata: preallocate only for metadata
5170 # @falloc: like @full preallocation but allocate disk space by
5171 #          posix_fallocate() rather than writing zeros.
5172 # @full: preallocate all data by writing zeros to device to ensure disk
5173 #        space is really available. @full preallocation also sets up
5174 #        metadata correctly.
5176 # Since: 2.2
5178 { 'enum': 'PreallocMode',
5179   'data': [ 'off', 'metadata', 'falloc', 'full' ] }
5182 # @BLOCK_WRITE_THRESHOLD:
5184 # Emitted when writes on block device reaches or exceeds the
5185 # configured write threshold. For thin-provisioned devices, this
5186 # means the device should be extended to avoid pausing for
5187 # disk exhaustion.
5188 # The event is one shot. Once triggered, it needs to be
5189 # re-registered with another block-set-write-threshold command.
5191 # @node-name: graph node name on which the threshold was exceeded.
5193 # @amount-exceeded: amount of data which exceeded the threshold, in bytes.
5195 # @write-threshold: last configured threshold, in bytes.
5197 # Since: 2.3
5199 { 'event': 'BLOCK_WRITE_THRESHOLD',
5200   'data': { 'node-name': 'str',
5201             'amount-exceeded': 'uint64',
5202             'write-threshold': 'uint64' } }
5205 # @block-set-write-threshold:
5207 # Change the write threshold for a block drive. An event will be
5208 # delivered if a write to this block drive crosses the configured
5209 # threshold.  The threshold is an offset, thus must be
5210 # non-negative. Default is no write threshold. Setting the threshold
5211 # to zero disables it.
5213 # This is useful to transparently resize thin-provisioned drives without
5214 # the guest OS noticing.
5216 # @node-name: graph node name on which the threshold must be set.
5218 # @write-threshold: configured threshold for the block device, bytes.
5219 #                   Use 0 to disable the threshold.
5221 # Since: 2.3
5223 # Example:
5225 # -> { "execute": "block-set-write-threshold",
5226 #      "arguments": { "node-name": "mydev",
5227 #                     "write-threshold": 17179869184 } }
5228 # <- { "return": {} }
5231 { 'command': 'block-set-write-threshold',
5232   'data': { 'node-name': 'str', 'write-threshold': 'uint64' } }
5235 # @x-blockdev-change:
5237 # Dynamically reconfigure the block driver state graph. It can be used
5238 # to add, remove, insert or replace a graph node. Currently only the
5239 # Quorum driver implements this feature to add or remove its child. This
5240 # is useful to fix a broken quorum child.
5242 # If @node is specified, it will be inserted under @parent. @child
5243 # may not be specified in this case. If both @parent and @child are
5244 # specified but @node is not, @child will be detached from @parent.
5246 # @parent: the id or name of the parent node.
5248 # @child: the name of a child under the given parent node.
5250 # @node: the name of the node that will be added.
5252 # Note: this command is experimental, and its API is not stable. It
5253 # does not support all kinds of operations, all kinds of children, nor
5254 # all block drivers.
5256 # FIXME Removing children from a quorum node means introducing gaps in the
5257 # child indices. This cannot be represented in the 'children' list of
5258 # BlockdevOptionsQuorum, as returned by .bdrv_refresh_filename().
5260 # Warning: The data in a new quorum child MUST be consistent with that of
5261 # the rest of the array.
5263 # Since: 2.7
5265 # Example:
5267 # 1. Add a new node to a quorum
5268 # -> { "execute": "blockdev-add",
5269 #      "arguments": {
5270 #          "driver": "raw",
5271 #          "node-name": "new_node",
5272 #          "file": { "driver": "file",
5273 #                    "filename": "test.raw" } } }
5274 # <- { "return": {} }
5275 # -> { "execute": "x-blockdev-change",
5276 #      "arguments": { "parent": "disk1",
5277 #                     "node": "new_node" } }
5278 # <- { "return": {} }
5280 # 2. Delete a quorum's node
5281 # -> { "execute": "x-blockdev-change",
5282 #      "arguments": { "parent": "disk1",
5283 #                     "child": "children.1" } }
5284 # <- { "return": {} }
5287 { 'command': 'x-blockdev-change',
5288   'data' : { 'parent': 'str',
5289              '*child': 'str',
5290              '*node': 'str' } }
5293 # @x-blockdev-set-iothread:
5295 # Move @node and its children into the @iothread.  If @iothread is null then
5296 # move @node and its children into the main loop.
5298 # The node must not be attached to a BlockBackend.
5300 # @node-name: the name of the block driver node
5302 # @iothread: the name of the IOThread object or null for the main loop
5304 # @force: true if the node and its children should be moved when a BlockBackend
5305 #         is already attached
5307 # Note: this command is experimental and intended for test cases that need
5308 # control over IOThreads only.
5310 # Since: 2.12
5312 # Example:
5314 # 1. Move a node into an IOThread
5315 # -> { "execute": "x-blockdev-set-iothread",
5316 #      "arguments": { "node-name": "disk1",
5317 #                     "iothread": "iothread0" } }
5318 # <- { "return": {} }
5320 # 2. Move a node into the main loop
5321 # -> { "execute": "x-blockdev-set-iothread",
5322 #      "arguments": { "node-name": "disk1",
5323 #                     "iothread": null } }
5324 # <- { "return": {} }
5327 { 'command': 'x-blockdev-set-iothread',
5328   'data' : { 'node-name': 'str',
5329              'iothread': 'StrOrNull',
5330              '*force': 'bool' } }