qapi/audio: add documentation for AudioFormat
[qemu/ar7.git] / qapi / block-core.json
blob91586fb1fb896430795abfab5518b2ae6d97a678
1 # -*- Mode: Python -*-
3 ##
4 # == Block core (VM unrelated)
5 ##
7 { 'include': 'common.json' }
8 { 'include': 'crypto.json' }
9 { 'include': 'job.json' }
10 { 'include': 'sockets.json' }
13 # @SnapshotInfo:
15 # @id: unique snapshot id
17 # @name: user chosen name
19 # @vm-state-size: size of the VM state
21 # @date-sec: UTC date of the snapshot in seconds
23 # @date-nsec: fractional part in nano seconds to be used with date-sec
25 # @vm-clock-sec: VM clock relative to boot in seconds
27 # @vm-clock-nsec: fractional part in nano seconds to be used with vm-clock-sec
29 # Since: 1.3
32 { 'struct': 'SnapshotInfo',
33   'data': { 'id': 'str', 'name': 'str', 'vm-state-size': 'int',
34             'date-sec': 'int', 'date-nsec': 'int',
35             'vm-clock-sec': 'int', 'vm-clock-nsec': 'int' } }
38 # @ImageInfoSpecificQCow2EncryptionBase:
40 # @format: The encryption format
42 # Since: 2.10
44 { 'struct': 'ImageInfoSpecificQCow2EncryptionBase',
45   'data': { 'format': 'BlockdevQcow2EncryptionFormat'}}
48 # @ImageInfoSpecificQCow2Encryption:
50 # Since: 2.10
52 { 'union': 'ImageInfoSpecificQCow2Encryption',
53   'base': 'ImageInfoSpecificQCow2EncryptionBase',
54   'discriminator': 'format',
55   'data': { 'luks': 'QCryptoBlockInfoLUKS' } }
58 # @ImageInfoSpecificQCow2:
60 # @compat: compatibility level
62 # @data-file: the filename of the external data file that is stored in the
63 #             image and used as a default for opening the image (since: 4.0)
65 # @data-file-raw: True if the external data file must stay valid as a
66 #                 standalone (read-only) raw image without looking at qcow2
67 #                 metadata (since: 4.0)
69 # @lazy-refcounts: on or off; only valid for compat >= 1.1
71 # @corrupt: true if the image has been marked corrupt; only valid for
72 #           compat >= 1.1 (since 2.2)
74 # @refcount-bits: width of a refcount entry in bits (since 2.3)
76 # @encrypt: details about encryption parameters; only set if image
77 #           is encrypted (since 2.10)
79 # @bitmaps: A list of qcow2 bitmap details (since 4.0)
81 # Since: 1.7
83 { 'struct': 'ImageInfoSpecificQCow2',
84   'data': {
85       'compat': 'str',
86       '*data-file': 'str',
87       '*data-file-raw': 'bool',
88       '*lazy-refcounts': 'bool',
89       '*corrupt': 'bool',
90       'refcount-bits': 'int',
91       '*encrypt': 'ImageInfoSpecificQCow2Encryption',
92       '*bitmaps': ['Qcow2BitmapInfo']
93   } }
96 # @ImageInfoSpecificVmdk:
98 # @create-type: The create type of VMDK image
100 # @cid: Content id of image
102 # @parent-cid: Parent VMDK image's cid
104 # @extents: List of extent files
106 # Since: 1.7
108 { 'struct': 'ImageInfoSpecificVmdk',
109   'data': {
110       'create-type': 'str',
111       'cid': 'int',
112       'parent-cid': 'int',
113       'extents': ['ImageInfo']
114   } }
117 # @ImageInfoSpecific:
119 # A discriminated record of image format specific information structures.
121 # Since: 1.7
123 { 'union': 'ImageInfoSpecific',
124   'data': {
125       'qcow2': 'ImageInfoSpecificQCow2',
126       'vmdk': 'ImageInfoSpecificVmdk',
127       # If we need to add block driver specific parameters for
128       # LUKS in future, then we'll subclass QCryptoBlockInfoLUKS
129       # to define a ImageInfoSpecificLUKS
130       'luks': 'QCryptoBlockInfoLUKS'
131   } }
134 # @ImageInfo:
136 # Information about a QEMU image file
138 # @filename: name of the image file
140 # @format: format of the image file
142 # @virtual-size: maximum capacity in bytes of the image
144 # @actual-size: actual size on disk in bytes of the image
146 # @dirty-flag: true if image is not cleanly closed
148 # @cluster-size: size of a cluster in bytes
150 # @encrypted: true if the image is encrypted
152 # @compressed: true if the image is compressed (Since 1.7)
154 # @backing-filename: name of the backing file
156 # @full-backing-filename: full path of the backing file
158 # @backing-filename-format: the format of the backing file
160 # @snapshots: list of VM snapshots
162 # @backing-image: info of the backing image (since 1.6)
164 # @format-specific: structure supplying additional format-specific
165 #                   information (since 1.7)
167 # Since: 1.3
170 { 'struct': 'ImageInfo',
171   'data': {'filename': 'str', 'format': 'str', '*dirty-flag': 'bool',
172            '*actual-size': 'int', 'virtual-size': 'int',
173            '*cluster-size': 'int', '*encrypted': 'bool', '*compressed': 'bool',
174            '*backing-filename': 'str', '*full-backing-filename': 'str',
175            '*backing-filename-format': 'str', '*snapshots': ['SnapshotInfo'],
176            '*backing-image': 'ImageInfo',
177            '*format-specific': 'ImageInfoSpecific' } }
180 # @ImageCheck:
182 # Information about a QEMU image file check
184 # @filename: name of the image file checked
186 # @format: format of the image file checked
188 # @check-errors: number of unexpected errors occurred during check
190 # @image-end-offset: offset (in bytes) where the image ends, this
191 #                    field is present if the driver for the image format
192 #                    supports it
194 # @corruptions: number of corruptions found during the check if any
196 # @leaks: number of leaks found during the check if any
198 # @corruptions-fixed: number of corruptions fixed during the check
199 #                     if any
201 # @leaks-fixed: number of leaks fixed during the check if any
203 # @total-clusters: total number of clusters, this field is present
204 #                  if the driver for the image format supports it
206 # @allocated-clusters: total number of allocated clusters, this
207 #                      field is present if the driver for the image format
208 #                      supports it
210 # @fragmented-clusters: total number of fragmented clusters, this
211 #                       field is present if the driver for the image format
212 #                       supports it
214 # @compressed-clusters: total number of compressed clusters, this
215 #                       field is present if the driver for the image format
216 #                       supports it
218 # Since: 1.4
221 { 'struct': 'ImageCheck',
222   'data': {'filename': 'str', 'format': 'str', 'check-errors': 'int',
223            '*image-end-offset': 'int', '*corruptions': 'int', '*leaks': 'int',
224            '*corruptions-fixed': 'int', '*leaks-fixed': 'int',
225            '*total-clusters': 'int', '*allocated-clusters': 'int',
226            '*fragmented-clusters': 'int', '*compressed-clusters': 'int' } }
229 # @MapEntry:
231 # Mapping information from a virtual block range to a host file range
233 # @start: the start byte of the mapped virtual range
235 # @length: the number of bytes of the mapped virtual range
237 # @data: whether the mapped range has data
239 # @zero: whether the virtual blocks are zeroed
241 # @depth: the depth of the mapping
243 # @offset: the offset in file that the virtual sectors are mapped to
245 # @filename: filename that is referred to by @offset
247 # Since: 2.6
250 { 'struct': 'MapEntry',
251   'data': {'start': 'int', 'length': 'int', 'data': 'bool',
252            'zero': 'bool', 'depth': 'int', '*offset': 'int',
253            '*filename': 'str' } }
256 # @BlockdevCacheInfo:
258 # Cache mode information for a block device
260 # @writeback:   true if writeback mode is enabled
261 # @direct:      true if the host page cache is bypassed (O_DIRECT)
262 # @no-flush:    true if flush requests are ignored for the device
264 # Since: 2.3
266 { 'struct': 'BlockdevCacheInfo',
267   'data': { 'writeback': 'bool',
268             'direct': 'bool',
269             'no-flush': 'bool' } }
272 # @BlockDeviceInfo:
274 # Information about the backing device for a block device.
276 # @file: the filename of the backing device
278 # @node-name: the name of the block driver node (Since 2.0)
280 # @ro: true if the backing device was open read-only
282 # @drv: the name of the block format used to open the backing device. As of
283 #       0.14.0 this can be: 'blkdebug', 'bochs', 'cloop', 'cow', 'dmg',
284 #       'file', 'file', 'ftp', 'ftps', 'host_cdrom', 'host_device',
285 #       'http', 'https', 'luks', 'nbd', 'parallels', 'qcow',
286 #       'qcow2', 'raw', 'vdi', 'vmdk', 'vpc', 'vvfat'
287 #       2.2: 'archipelago' added, 'cow' dropped
288 #       2.3: 'host_floppy' deprecated
289 #       2.5: 'host_floppy' dropped
290 #       2.6: 'luks' added
291 #       2.8: 'replication' added, 'tftp' dropped
292 #       2.9: 'archipelago' dropped
294 # @backing_file: the name of the backing file (for copy-on-write)
296 # @backing_file_depth: number of files in the backing file chain (since: 1.2)
298 # @encrypted: true if the backing device is encrypted
300 # @encryption_key_missing: Deprecated; always false
302 # @detect_zeroes: detect and optimize zero writes (Since 2.1)
304 # @bps: total throughput limit in bytes per second is specified
306 # @bps_rd: read throughput limit in bytes per second is specified
308 # @bps_wr: write throughput limit in bytes per second is specified
310 # @iops: total I/O operations per second is specified
312 # @iops_rd: read I/O operations per second is specified
314 # @iops_wr: write I/O operations per second is specified
316 # @image: the info of image used (since: 1.6)
318 # @bps_max: total throughput limit during bursts,
319 #                     in bytes (Since 1.7)
321 # @bps_rd_max: read throughput limit during bursts,
322 #                        in bytes (Since 1.7)
324 # @bps_wr_max: write throughput limit during bursts,
325 #                        in bytes (Since 1.7)
327 # @iops_max: total I/O operations per second during bursts,
328 #                      in bytes (Since 1.7)
330 # @iops_rd_max: read I/O operations per second during bursts,
331 #                         in bytes (Since 1.7)
333 # @iops_wr_max: write I/O operations per second during bursts,
334 #                         in bytes (Since 1.7)
336 # @bps_max_length: maximum length of the @bps_max burst
337 #                            period, in seconds. (Since 2.6)
339 # @bps_rd_max_length: maximum length of the @bps_rd_max
340 #                               burst period, in seconds. (Since 2.6)
342 # @bps_wr_max_length: maximum length of the @bps_wr_max
343 #                               burst period, in seconds. (Since 2.6)
345 # @iops_max_length: maximum length of the @iops burst
346 #                             period, in seconds. (Since 2.6)
348 # @iops_rd_max_length: maximum length of the @iops_rd_max
349 #                                burst period, in seconds. (Since 2.6)
351 # @iops_wr_max_length: maximum length of the @iops_wr_max
352 #                                burst period, in seconds. (Since 2.6)
354 # @iops_size: an I/O size in bytes (Since 1.7)
356 # @group: throttle group name (Since 2.4)
358 # @cache: the cache mode used for the block device (since: 2.3)
360 # @write_threshold: configured write threshold for the device.
361 #                   0 if disabled. (Since 2.3)
363 # @dirty-bitmaps: dirty bitmaps information (only present if node
364 #                 has one or more dirty bitmaps) (Since 4.2)
366 # Since: 0.14.0
369 { 'struct': 'BlockDeviceInfo',
370   'data': { 'file': 'str', '*node-name': 'str', 'ro': 'bool', 'drv': 'str',
371             '*backing_file': 'str', 'backing_file_depth': 'int',
372             'encrypted': 'bool', 'encryption_key_missing': 'bool',
373             'detect_zeroes': 'BlockdevDetectZeroesOptions',
374             'bps': 'int', 'bps_rd': 'int', 'bps_wr': 'int',
375             'iops': 'int', 'iops_rd': 'int', 'iops_wr': 'int',
376             'image': 'ImageInfo',
377             '*bps_max': 'int', '*bps_rd_max': 'int',
378             '*bps_wr_max': 'int', '*iops_max': 'int',
379             '*iops_rd_max': 'int', '*iops_wr_max': 'int',
380             '*bps_max_length': 'int', '*bps_rd_max_length': 'int',
381             '*bps_wr_max_length': 'int', '*iops_max_length': 'int',
382             '*iops_rd_max_length': 'int', '*iops_wr_max_length': 'int',
383             '*iops_size': 'int', '*group': 'str', 'cache': 'BlockdevCacheInfo',
384             'write_threshold': 'int', '*dirty-bitmaps': ['BlockDirtyInfo'] } }
387 # @BlockDeviceIoStatus:
389 # An enumeration of block device I/O status.
391 # @ok: The last I/O operation has succeeded
393 # @failed: The last I/O operation has failed
395 # @nospace: The last I/O operation has failed due to a no-space condition
397 # Since: 1.0
399 { 'enum': 'BlockDeviceIoStatus', 'data': [ 'ok', 'failed', 'nospace' ] }
402 # @BlockDeviceMapEntry:
404 # Entry in the metadata map of the device (returned by "qemu-img map")
406 # @start: Offset in the image of the first byte described by this entry
407 #         (in bytes)
409 # @length: Length of the range described by this entry (in bytes)
411 # @depth: Number of layers (0 = top image, 1 = top image's backing file, etc.)
412 #         before reaching one for which the range is allocated.  The value is
413 #         in the range 0 to the depth of the image chain - 1.
415 # @zero: the sectors in this range read as zeros
417 # @data: reading the image will actually read data from a file (in particular,
418 #        if @offset is present this means that the sectors are not simply
419 #        preallocated, but contain actual data in raw format)
421 # @offset: if present, the image file stores the data for this range in
422 #          raw format at the given offset.
424 # Since: 1.7
426 { 'struct': 'BlockDeviceMapEntry',
427   'data': { 'start': 'int', 'length': 'int', 'depth': 'int', 'zero': 'bool',
428             'data': 'bool', '*offset': 'int' } }
431 # @DirtyBitmapStatus:
433 # An enumeration of possible states that a dirty bitmap can report to the user.
435 # @frozen: The bitmap is currently in-use by some operation and is immutable.
436 #          If the bitmap was @active prior to the operation, new writes by the
437 #          guest are being recorded in a temporary buffer, and will not be lost.
438 #          Generally, bitmaps are cleared on successful use in an operation and
439 #          the temporary buffer is committed into the bitmap. On failure, the
440 #          temporary buffer is merged back into the bitmap without first
441 #          clearing it.
442 #          Please refer to the documentation for each bitmap-using operation,
443 #          See also @blockdev-backup, @drive-backup.
445 # @disabled: The bitmap is not currently recording new writes by the guest.
446 #            This is requested explicitly via @block-dirty-bitmap-disable.
447 #            It can still be cleared, deleted, or used for backup operations.
449 # @active: The bitmap is actively monitoring for new writes, and can be cleared,
450 #          deleted, or used for backup operations.
452 # @locked: The bitmap is currently in-use by some operation and is immutable.
453 #          If the bitmap was @active prior to the operation, it is still
454 #          recording new writes. If the bitmap was @disabled, it is not
455 #          recording new writes. (Since 2.12)
457 # @inconsistent: This is a persistent dirty bitmap that was marked in-use on
458 #                disk, and is unusable by QEMU. It can only be deleted.
459 #                Please rely on the inconsistent field in @BlockDirtyInfo
460 #                instead, as the status field is deprecated. (Since 4.0)
462 # Since: 2.4
464 { 'enum': 'DirtyBitmapStatus',
465   'data': ['active', 'disabled', 'frozen', 'locked', 'inconsistent'] }
468 # @BlockDirtyInfo:
470 # Block dirty bitmap information.
472 # @name: the name of the dirty bitmap (Since 2.4)
474 # @count: number of dirty bytes according to the dirty bitmap
476 # @granularity: granularity of the dirty bitmap in bytes (since 1.4)
478 # @status: Deprecated in favor of @recording and @locked. (since 2.4)
480 # @recording: true if the bitmap is recording new writes from the guest.
481 #             Replaces `active` and `disabled` statuses. (since 4.0)
483 # @busy: true if the bitmap is in-use by some operation (NBD or jobs)
484 #        and cannot be modified via QMP or used by another operation.
485 #        Replaces `locked` and `frozen` statuses. (since 4.0)
487 # @persistent: true if the bitmap was stored on disk, is scheduled to be stored
488 #              on disk, or both. (since 4.0)
490 # @inconsistent: true if this is a persistent bitmap that was improperly
491 #                stored. Implies @persistent to be true; @recording and
492 #                @busy to be false. This bitmap cannot be used. To remove
493 #                it, use @block-dirty-bitmap-remove. (Since 4.0)
495 # Since: 1.3
497 { 'struct': 'BlockDirtyInfo',
498   'data': {'*name': 'str', 'count': 'int', 'granularity': 'uint32',
499            'recording': 'bool', 'busy': 'bool', 'status': 'DirtyBitmapStatus',
500            'persistent': 'bool', '*inconsistent': 'bool' } }
503 # @Qcow2BitmapInfoFlags:
505 # An enumeration of flags that a bitmap can report to the user.
507 # @in-use: This flag is set by any process actively modifying the qcow2 file,
508 #          and cleared when the updated bitmap is flushed to the qcow2 image.
509 #          The presence of this flag in an offline image means that the bitmap
510 #          was not saved correctly after its last usage, and may contain
511 #          inconsistent data.
513 # @auto: The bitmap must reflect all changes of the virtual disk by any
514 #        application that would write to this qcow2 file.
516 # Since: 4.0
518 { 'enum': 'Qcow2BitmapInfoFlags',
519   'data': ['in-use', 'auto'] }
522 # @Qcow2BitmapInfo:
524 # Qcow2 bitmap information.
526 # @name: the name of the bitmap
528 # @granularity: granularity of the bitmap in bytes
530 # @flags: flags of the bitmap
532 # Since: 4.0
534 { 'struct': 'Qcow2BitmapInfo',
535   'data': {'name': 'str', 'granularity': 'uint32',
536            'flags': ['Qcow2BitmapInfoFlags'] } }
539 # @BlockLatencyHistogramInfo:
541 # Block latency histogram.
543 # @boundaries: list of interval boundary values in nanoseconds, all greater
544 #              than zero and in ascending order.
545 #              For example, the list [10, 50, 100] produces the following
546 #              histogram intervals: [0, 10), [10, 50), [50, 100), [100, +inf).
548 # @bins: list of io request counts corresponding to histogram intervals.
549 #        len(@bins) = len(@boundaries) + 1
550 #        For the example above, @bins may be something like [3, 1, 5, 2],
551 #        and corresponding histogram looks like:
553 # |      5|           *
554 # |      4|           *
555 # |      3| *         *
556 # |      2| *         *    *
557 # |      1| *    *    *    *
558 # |       +------------------
559 # |           10   50   100
561 # Since: 4.0
563 { 'struct': 'BlockLatencyHistogramInfo',
564   'data': {'boundaries': ['uint64'], 'bins': ['uint64'] } }
567 # @BlockInfo:
569 # Block device information.  This structure describes a virtual device and
570 # the backing device associated with it.
572 # @device: The device name associated with the virtual device.
574 # @qdev: The qdev ID, or if no ID is assigned, the QOM path of the block
575 #        device. (since 2.10)
577 # @type: This field is returned only for compatibility reasons, it should
578 #        not be used (always returns 'unknown')
580 # @removable: True if the device supports removable media.
582 # @locked: True if the guest has locked this device from having its media
583 #          removed
585 # @tray_open: True if the device's tray is open
586 #             (only present if it has a tray)
588 # @dirty-bitmaps: dirty bitmaps information (only present if the
589 #                 driver has one or more dirty bitmaps) (Since 2.0)
590 #                 Deprecated in 4.2; see BlockDeviceInfo instead.
592 # @io-status: @BlockDeviceIoStatus. Only present if the device
593 #             supports it and the VM is configured to stop on errors
594 #             (supported device models: virtio-blk, IDE, SCSI except
595 #             scsi-generic)
597 # @inserted: @BlockDeviceInfo describing the device if media is
598 #            present
600 # Since:  0.14.0
602 { 'struct': 'BlockInfo',
603   'data': {'device': 'str', '*qdev': 'str', 'type': 'str', 'removable': 'bool',
604            'locked': 'bool', '*inserted': 'BlockDeviceInfo',
605            '*tray_open': 'bool', '*io-status': 'BlockDeviceIoStatus',
606            '*dirty-bitmaps': ['BlockDirtyInfo'] } }
609 # @BlockMeasureInfo:
611 # Image file size calculation information.  This structure describes the size
612 # requirements for creating a new image file.
614 # The size requirements depend on the new image file format.  File size always
615 # equals virtual disk size for the 'raw' format, even for sparse POSIX files.
616 # Compact formats such as 'qcow2' represent unallocated and zero regions
617 # efficiently so file size may be smaller than virtual disk size.
619 # The values are upper bounds that are guaranteed to fit the new image file.
620 # Subsequent modification, such as internal snapshot or bitmap creation, may
621 # require additional space and is not covered here.
623 # @required: Size required for a new image file, in bytes.
625 # @fully-allocated: Image file size, in bytes, once data has been written
626 #                   to all sectors.
628 # Since: 2.10
630 { 'struct': 'BlockMeasureInfo',
631   'data': {'required': 'int', 'fully-allocated': 'int'} }
634 # @query-block:
636 # Get a list of BlockInfo for all virtual block devices.
638 # Returns: a list of @BlockInfo describing each virtual block device. Filter
639 #          nodes that were created implicitly are skipped over.
641 # Since: 0.14.0
643 # Example:
645 # -> { "execute": "query-block" }
646 # <- {
647 #       "return":[
648 #          {
649 #             "io-status": "ok",
650 #             "device":"ide0-hd0",
651 #             "locked":false,
652 #             "removable":false,
653 #             "inserted":{
654 #                "ro":false,
655 #                "drv":"qcow2",
656 #                "encrypted":false,
657 #                "file":"disks/test.qcow2",
658 #                "backing_file_depth":1,
659 #                "bps":1000000,
660 #                "bps_rd":0,
661 #                "bps_wr":0,
662 #                "iops":1000000,
663 #                "iops_rd":0,
664 #                "iops_wr":0,
665 #                "bps_max": 8000000,
666 #                "bps_rd_max": 0,
667 #                "bps_wr_max": 0,
668 #                "iops_max": 0,
669 #                "iops_rd_max": 0,
670 #                "iops_wr_max": 0,
671 #                "iops_size": 0,
672 #                "detect_zeroes": "on",
673 #                "write_threshold": 0,
674 #                "image":{
675 #                   "filename":"disks/test.qcow2",
676 #                   "format":"qcow2",
677 #                   "virtual-size":2048000,
678 #                   "backing_file":"base.qcow2",
679 #                   "full-backing-filename":"disks/base.qcow2",
680 #                   "backing-filename-format":"qcow2",
681 #                   "snapshots":[
682 #                      {
683 #                         "id": "1",
684 #                         "name": "snapshot1",
685 #                         "vm-state-size": 0,
686 #                         "date-sec": 10000200,
687 #                         "date-nsec": 12,
688 #                         "vm-clock-sec": 206,
689 #                         "vm-clock-nsec": 30
690 #                      }
691 #                   ],
692 #                   "backing-image":{
693 #                       "filename":"disks/base.qcow2",
694 #                       "format":"qcow2",
695 #                       "virtual-size":2048000
696 #                   }
697 #                }
698 #             },
699 #             "qdev": "ide_disk",
700 #             "type":"unknown"
701 #          },
702 #          {
703 #             "io-status": "ok",
704 #             "device":"ide1-cd0",
705 #             "locked":false,
706 #             "removable":true,
707 #             "qdev": "/machine/unattached/device[23]",
708 #             "tray_open": false,
709 #             "type":"unknown"
710 #          },
711 #          {
712 #             "device":"floppy0",
713 #             "locked":false,
714 #             "removable":true,
715 #             "qdev": "/machine/unattached/device[20]",
716 #             "type":"unknown"
717 #          },
718 #          {
719 #             "device":"sd0",
720 #             "locked":false,
721 #             "removable":true,
722 #             "type":"unknown"
723 #          }
724 #       ]
725 #    }
728 { 'command': 'query-block', 'returns': ['BlockInfo'] }
732 # @BlockDeviceTimedStats:
734 # Statistics of a block device during a given interval of time.
736 # @interval_length: Interval used for calculating the statistics,
737 #                   in seconds.
739 # @min_rd_latency_ns: Minimum latency of read operations in the
740 #                     defined interval, in nanoseconds.
742 # @min_wr_latency_ns: Minimum latency of write operations in the
743 #                     defined interval, in nanoseconds.
745 # @min_flush_latency_ns: Minimum latency of flush operations in the
746 #                        defined interval, in nanoseconds.
748 # @max_rd_latency_ns: Maximum latency of read operations in the
749 #                     defined interval, in nanoseconds.
751 # @max_wr_latency_ns: Maximum latency of write operations in the
752 #                     defined interval, in nanoseconds.
754 # @max_flush_latency_ns: Maximum latency of flush operations in the
755 #                        defined interval, in nanoseconds.
757 # @avg_rd_latency_ns: Average latency of read operations in the
758 #                     defined interval, in nanoseconds.
760 # @avg_wr_latency_ns: Average latency of write operations in the
761 #                     defined interval, in nanoseconds.
763 # @avg_flush_latency_ns: Average latency of flush operations in the
764 #                        defined interval, in nanoseconds.
766 # @avg_rd_queue_depth: Average number of pending read operations
767 #                      in the defined interval.
769 # @avg_wr_queue_depth: Average number of pending write operations
770 #                      in the defined interval.
772 # Since: 2.5
774 { 'struct': 'BlockDeviceTimedStats',
775   'data': { 'interval_length': 'int', 'min_rd_latency_ns': 'int',
776             'max_rd_latency_ns': 'int', 'avg_rd_latency_ns': 'int',
777             'min_wr_latency_ns': 'int', 'max_wr_latency_ns': 'int',
778             'avg_wr_latency_ns': 'int', 'min_flush_latency_ns': 'int',
779             'max_flush_latency_ns': 'int', 'avg_flush_latency_ns': 'int',
780             'avg_rd_queue_depth': 'number', 'avg_wr_queue_depth': 'number' } }
783 # @BlockDeviceStats:
785 # Statistics of a virtual block device or a block backing device.
787 # @rd_bytes:      The number of bytes read by the device.
789 # @wr_bytes:      The number of bytes written by the device.
791 # @unmap_bytes: The number of bytes unmapped by the device (Since 4.2)
793 # @rd_operations: The number of read operations performed by the device.
795 # @wr_operations: The number of write operations performed by the device.
797 # @flush_operations: The number of cache flush operations performed by the
798 #                    device (since 0.15.0)
800 # @unmap_operations: The number of unmap operations performed by the device
801 #                    (Since 4.2)
803 # @rd_total_time_ns: Total time spent on reads in nanoseconds (since 0.15.0).
805 # @wr_total_time_ns: Total time spent on writes in nanoseconds (since 0.15.0).
807 # @flush_total_time_ns: Total time spent on cache flushes in nanoseconds
808 #                       (since 0.15.0).
810 # @unmap_total_time_ns: Total time spent on unmap operations in nanoseconds
811 #                       (Since 4.2)
813 # @wr_highest_offset: The offset after the greatest byte written to the
814 #                     device.  The intended use of this information is for
815 #                     growable sparse files (like qcow2) that are used on top
816 #                     of a physical device.
818 # @rd_merged: Number of read requests that have been merged into another
819 #             request (Since 2.3).
821 # @wr_merged: Number of write requests that have been merged into another
822 #             request (Since 2.3).
824 # @unmap_merged: Number of unmap requests that have been merged into another
825 #                request (Since 4.2)
827 # @idle_time_ns: Time since the last I/O operation, in
828 #                nanoseconds. If the field is absent it means that
829 #                there haven't been any operations yet (Since 2.5).
831 # @failed_rd_operations: The number of failed read operations
832 #                        performed by the device (Since 2.5)
834 # @failed_wr_operations: The number of failed write operations
835 #                        performed by the device (Since 2.5)
837 # @failed_flush_operations: The number of failed flush operations
838 #                           performed by the device (Since 2.5)
840 # @failed_unmap_operations: The number of failed unmap operations performed
841 #                           by the device (Since 4.2)
843 # @invalid_rd_operations: The number of invalid read operations
844 #                          performed by the device (Since 2.5)
846 # @invalid_wr_operations: The number of invalid write operations
847 #                         performed by the device (Since 2.5)
849 # @invalid_flush_operations: The number of invalid flush operations
850 #                            performed by the device (Since 2.5)
852 # @invalid_unmap_operations: The number of invalid unmap operations performed
853 #                            by the device (Since 4.2)
855 # @account_invalid: Whether invalid operations are included in the
856 #                   last access statistics (Since 2.5)
858 # @account_failed: Whether failed operations are included in the
859 #                  latency and last access statistics (Since 2.5)
861 # @timed_stats: Statistics specific to the set of previously defined
862 #               intervals of time (Since 2.5)
864 # @rd_latency_histogram: @BlockLatencyHistogramInfo. (Since 4.0)
866 # @wr_latency_histogram: @BlockLatencyHistogramInfo. (Since 4.0)
868 # @flush_latency_histogram: @BlockLatencyHistogramInfo. (Since 4.0)
870 # Since: 0.14.0
872 { 'struct': 'BlockDeviceStats',
873   'data': {'rd_bytes': 'int', 'wr_bytes': 'int', 'unmap_bytes' : 'int',
874            'rd_operations': 'int', 'wr_operations': 'int',
875            'flush_operations': 'int', 'unmap_operations': 'int',
876            'rd_total_time_ns': 'int', 'wr_total_time_ns': 'int',
877            'flush_total_time_ns': 'int', 'unmap_total_time_ns': 'int',
878            'wr_highest_offset': 'int',
879            'rd_merged': 'int', 'wr_merged': 'int', 'unmap_merged': 'int',
880            '*idle_time_ns': 'int',
881            'failed_rd_operations': 'int', 'failed_wr_operations': 'int',
882            'failed_flush_operations': 'int', 'failed_unmap_operations': 'int',
883            'invalid_rd_operations': 'int', 'invalid_wr_operations': 'int',
884            'invalid_flush_operations': 'int', 'invalid_unmap_operations': 'int',
885            'account_invalid': 'bool', 'account_failed': 'bool',
886            'timed_stats': ['BlockDeviceTimedStats'],
887            '*rd_latency_histogram': 'BlockLatencyHistogramInfo',
888            '*wr_latency_histogram': 'BlockLatencyHistogramInfo',
889            '*flush_latency_histogram': 'BlockLatencyHistogramInfo' } }
892 # @BlockStatsSpecificFile:
894 # File driver statistics
896 # @discard-nb-ok: The number of successful discard operations performed by
897 #                 the driver.
899 # @discard-nb-failed: The number of failed discard operations performed by
900 #                     the driver.
902 # @discard-bytes-ok: The number of bytes discarded by the driver.
904 # Since: 4.2
906 { 'struct': 'BlockStatsSpecificFile',
907   'data': {
908       'discard-nb-ok': 'uint64',
909       'discard-nb-failed': 'uint64',
910       'discard-bytes-ok': 'uint64' } }
913 # @BlockStatsSpecific:
915 # Block driver specific statistics
917 # Since: 4.2
919 { 'union': 'BlockStatsSpecific',
920   'base': { 'driver': 'BlockdevDriver' },
921   'discriminator': 'driver',
922   'data': {
923       'file': 'BlockStatsSpecificFile',
924       'host_device': 'BlockStatsSpecificFile' } }
927 # @BlockStats:
929 # Statistics of a virtual block device or a block backing device.
931 # @device: If the stats are for a virtual block device, the name
932 #          corresponding to the virtual block device.
934 # @node-name: The node name of the device. (Since 2.3)
936 # @qdev: The qdev ID, or if no ID is assigned, the QOM path of the block
937 #        device. (since 3.0)
939 # @stats:  A @BlockDeviceStats for the device.
941 # @driver-specific: Optional driver-specific stats. (Since 4.2)
943 # @parent: This describes the file block device if it has one.
944 #          Contains recursively the statistics of the underlying
945 #          protocol (e.g. the host file for a qcow2 image). If there is
946 #          no underlying protocol, this field is omitted
948 # @backing: This describes the backing block device if it has one.
949 #           (Since 2.0)
951 # Since: 0.14.0
953 { 'struct': 'BlockStats',
954   'data': {'*device': 'str', '*qdev': 'str', '*node-name': 'str',
955            'stats': 'BlockDeviceStats',
956            '*driver-specific': 'BlockStatsSpecific',
957            '*parent': 'BlockStats',
958            '*backing': 'BlockStats'} }
961 # @query-blockstats:
963 # Query the @BlockStats for all virtual block devices.
965 # @query-nodes: If true, the command will query all the block nodes
966 #               that have a node name, in a list which will include "parent"
967 #               information, but not "backing".
968 #               If false or omitted, the behavior is as before - query all the
969 #               device backends, recursively including their "parent" and
970 #               "backing". Filter nodes that were created implicitly are
971 #               skipped over in this mode. (Since 2.3)
973 # Returns: A list of @BlockStats for each virtual block devices.
975 # Since: 0.14.0
977 # Example:
979 # -> { "execute": "query-blockstats" }
980 # <- {
981 #       "return":[
982 #          {
983 #             "device":"ide0-hd0",
984 #             "parent":{
985 #                "stats":{
986 #                   "wr_highest_offset":3686448128,
987 #                   "wr_bytes":9786368,
988 #                   "wr_operations":751,
989 #                   "rd_bytes":122567168,
990 #                   "rd_operations":36772
991 #                   "wr_total_times_ns":313253456
992 #                   "rd_total_times_ns":3465673657
993 #                   "flush_total_times_ns":49653
994 #                   "flush_operations":61,
995 #                   "rd_merged":0,
996 #                   "wr_merged":0,
997 #                   "idle_time_ns":2953431879,
998 #                   "account_invalid":true,
999 #                   "account_failed":false
1000 #                }
1001 #             },
1002 #             "stats":{
1003 #                "wr_highest_offset":2821110784,
1004 #                "wr_bytes":9786368,
1005 #                "wr_operations":692,
1006 #                "rd_bytes":122739200,
1007 #                "rd_operations":36604
1008 #                "flush_operations":51,
1009 #                "wr_total_times_ns":313253456
1010 #                "rd_total_times_ns":3465673657
1011 #                "flush_total_times_ns":49653,
1012 #                "rd_merged":0,
1013 #                "wr_merged":0,
1014 #                "idle_time_ns":2953431879,
1015 #                "account_invalid":true,
1016 #                "account_failed":false
1017 #             },
1018 #             "qdev": "/machine/unattached/device[23]"
1019 #          },
1020 #          {
1021 #             "device":"ide1-cd0",
1022 #             "stats":{
1023 #                "wr_highest_offset":0,
1024 #                "wr_bytes":0,
1025 #                "wr_operations":0,
1026 #                "rd_bytes":0,
1027 #                "rd_operations":0
1028 #                "flush_operations":0,
1029 #                "wr_total_times_ns":0
1030 #                "rd_total_times_ns":0
1031 #                "flush_total_times_ns":0,
1032 #                "rd_merged":0,
1033 #                "wr_merged":0,
1034 #                "account_invalid":false,
1035 #                "account_failed":false
1036 #             },
1037 #             "qdev": "/machine/unattached/device[24]"
1038 #          },
1039 #          {
1040 #             "device":"floppy0",
1041 #             "stats":{
1042 #                "wr_highest_offset":0,
1043 #                "wr_bytes":0,
1044 #                "wr_operations":0,
1045 #                "rd_bytes":0,
1046 #                "rd_operations":0
1047 #                "flush_operations":0,
1048 #                "wr_total_times_ns":0
1049 #                "rd_total_times_ns":0
1050 #                "flush_total_times_ns":0,
1051 #                "rd_merged":0,
1052 #                "wr_merged":0,
1053 #                "account_invalid":false,
1054 #                "account_failed":false
1055 #             },
1056 #             "qdev": "/machine/unattached/device[16]"
1057 #          },
1058 #          {
1059 #             "device":"sd0",
1060 #             "stats":{
1061 #                "wr_highest_offset":0,
1062 #                "wr_bytes":0,
1063 #                "wr_operations":0,
1064 #                "rd_bytes":0,
1065 #                "rd_operations":0
1066 #                "flush_operations":0,
1067 #                "wr_total_times_ns":0
1068 #                "rd_total_times_ns":0
1069 #                "flush_total_times_ns":0,
1070 #                "rd_merged":0,
1071 #                "wr_merged":0,
1072 #                "account_invalid":false,
1073 #                "account_failed":false
1074 #             }
1075 #          }
1076 #       ]
1077 #    }
1080 { 'command': 'query-blockstats',
1081   'data': { '*query-nodes': 'bool' },
1082   'returns': ['BlockStats'] }
1085 # @BlockdevOnError:
1087 # An enumeration of possible behaviors for errors on I/O operations.
1088 # The exact meaning depends on whether the I/O was initiated by a guest
1089 # or by a block job
1091 # @report: for guest operations, report the error to the guest;
1092 #          for jobs, cancel the job
1094 # @ignore: ignore the error, only report a QMP event (BLOCK_IO_ERROR
1095 #          or BLOCK_JOB_ERROR). The backup, mirror and commit block jobs retry
1096 #          the failing request later and may still complete successfully. The
1097 #          stream block job continues to stream and will complete with an
1098 #          error.
1100 # @enospc: same as @stop on ENOSPC, same as @report otherwise.
1102 # @stop: for guest operations, stop the virtual machine;
1103 #        for jobs, pause the job
1105 # @auto: inherit the error handling policy of the backend (since: 2.7)
1107 # Since: 1.3
1109 { 'enum': 'BlockdevOnError',
1110   'data': ['report', 'ignore', 'enospc', 'stop', 'auto'] }
1113 # @MirrorSyncMode:
1115 # An enumeration of possible behaviors for the initial synchronization
1116 # phase of storage mirroring.
1118 # @top: copies data in the topmost image to the destination
1120 # @full: copies data from all images to the destination
1122 # @none: only copy data written from now on
1124 # @incremental: only copy data described by the dirty bitmap. (since: 2.4)
1126 # @bitmap: only copy data described by the dirty bitmap. (since: 4.2)
1127 #          Behavior on completion is determined by the BitmapSyncMode.
1129 # Since: 1.3
1131 { 'enum': 'MirrorSyncMode',
1132   'data': ['top', 'full', 'none', 'incremental', 'bitmap'] }
1135 # @BitmapSyncMode:
1137 # An enumeration of possible behaviors for the synchronization of a bitmap
1138 # when used for data copy operations.
1140 # @on-success: The bitmap is only synced when the operation is successful.
1141 #              This is the behavior always used for 'INCREMENTAL' backups.
1143 # @never: The bitmap is never synchronized with the operation, and is
1144 #         treated solely as a read-only manifest of blocks to copy.
1146 # @always: The bitmap is always synchronized with the operation,
1147 #          regardless of whether or not the operation was successful.
1149 # Since: 4.2
1151 { 'enum': 'BitmapSyncMode',
1152   'data': ['on-success', 'never', 'always'] }
1155 # @MirrorCopyMode:
1157 # An enumeration whose values tell the mirror block job when to
1158 # trigger writes to the target.
1160 # @background: copy data in background only.
1162 # @write-blocking: when data is written to the source, write it
1163 #                  (synchronously) to the target as well.  In
1164 #                  addition, data is copied in background just like in
1165 #                  @background mode.
1167 # Since: 3.0
1169 { 'enum': 'MirrorCopyMode',
1170   'data': ['background', 'write-blocking'] }
1173 # @BlockJobInfo:
1175 # Information about a long-running block device operation.
1177 # @type: the job type ('stream' for image streaming)
1179 # @device: The job identifier. Originally the device name but other
1180 #          values are allowed since QEMU 2.7
1182 # @len: Estimated @offset value at the completion of the job. This value can
1183 #       arbitrarily change while the job is running, in both directions.
1185 # @offset: Progress made until now. The unit is arbitrary and the value can
1186 #          only meaningfully be used for the ratio of @offset to @len. The
1187 #          value is monotonically increasing.
1189 # @busy: false if the job is known to be in a quiescent state, with
1190 #        no pending I/O.  Since 1.3.
1192 # @paused: whether the job is paused or, if @busy is true, will
1193 #          pause itself as soon as possible.  Since 1.3.
1195 # @speed: the rate limit, bytes per second
1197 # @io-status: the status of the job (since 1.3)
1199 # @ready: true if the job may be completed (since 2.2)
1201 # @status: Current job state/status (since 2.12)
1203 # @auto-finalize: Job will finalize itself when PENDING, moving to
1204 #                 the CONCLUDED state. (since 2.12)
1206 # @auto-dismiss: Job will dismiss itself when CONCLUDED, moving to the NULL
1207 #                state and disappearing from the query list. (since 2.12)
1209 # @error: Error information if the job did not complete successfully.
1210 #         Not set if the job completed successfully. (since 2.12.1)
1212 # Since: 1.1
1214 { 'struct': 'BlockJobInfo',
1215   'data': {'type': 'str', 'device': 'str', 'len': 'int',
1216            'offset': 'int', 'busy': 'bool', 'paused': 'bool', 'speed': 'int',
1217            'io-status': 'BlockDeviceIoStatus', 'ready': 'bool',
1218            'status': 'JobStatus',
1219            'auto-finalize': 'bool', 'auto-dismiss': 'bool',
1220            '*error': 'str' } }
1223 # @query-block-jobs:
1225 # Return information about long-running block device operations.
1227 # Returns: a list of @BlockJobInfo for each active block job
1229 # Since: 1.1
1231 { 'command': 'query-block-jobs', 'returns': ['BlockJobInfo'] }
1234 # @block_passwd:
1236 # This command sets the password of a block device that has not been open
1237 # with a password and requires one.
1239 # This command is now obsolete and will always return an error since 2.10
1242 { 'command': 'block_passwd',
1243   'data': { '*device': 'str',
1244             '*node-name': 'str',
1245             'password': 'str' } }
1248 # @block_resize:
1250 # Resize a block image while a guest is running.
1252 # Either @device or @node-name must be set but not both.
1254 # @device: the name of the device to get the image resized
1256 # @node-name: graph node name to get the image resized (Since 2.0)
1258 # @size:  new image size in bytes
1260 # Returns: - nothing on success
1261 #          - If @device is not a valid block device, DeviceNotFound
1263 # Since: 0.14.0
1265 # Example:
1267 # -> { "execute": "block_resize",
1268 #      "arguments": { "device": "scratch", "size": 1073741824 } }
1269 # <- { "return": {} }
1272 { 'command': 'block_resize',
1273   'data': { '*device': 'str',
1274             '*node-name': 'str',
1275             'size': 'int' } }
1278 # @NewImageMode:
1280 # An enumeration that tells QEMU how to set the backing file path in
1281 # a new image file.
1283 # @existing: QEMU should look for an existing image file.
1285 # @absolute-paths: QEMU should create a new image with absolute paths
1286 #                  for the backing file. If there is no backing file available, the new
1287 #                  image will not be backed either.
1289 # Since: 1.1
1291 { 'enum': 'NewImageMode',
1292   'data': [ 'existing', 'absolute-paths' ] }
1295 # @BlockdevSnapshotSync:
1297 # Either @device or @node-name must be set but not both.
1299 # @device: the name of the device to take a snapshot of.
1301 # @node-name: graph node name to generate the snapshot from (Since 2.0)
1303 # @snapshot-file: the target of the new overlay image. If the file
1304 #                 exists, or if it is a device, the overlay will be created in the
1305 #                 existing file/device. Otherwise, a new file will be created.
1307 # @snapshot-node-name: the graph node name of the new image (Since 2.0)
1309 # @format: the format of the overlay image, default is 'qcow2'.
1311 # @mode: whether and how QEMU should create a new image, default is
1312 #        'absolute-paths'.
1314 { 'struct': 'BlockdevSnapshotSync',
1315   'data': { '*device': 'str', '*node-name': 'str',
1316             'snapshot-file': 'str', '*snapshot-node-name': 'str',
1317             '*format': 'str', '*mode': 'NewImageMode' } }
1320 # @BlockdevSnapshot:
1322 # @node: device or node name that will have a snapshot taken.
1324 # @overlay: reference to the existing block device that will become
1325 #           the overlay of @node, as part of taking the snapshot.
1326 #           It must not have a current backing file (this can be
1327 #           achieved by passing "backing": null to blockdev-add).
1329 # Since: 2.5
1331 { 'struct': 'BlockdevSnapshot',
1332   'data': { 'node': 'str', 'overlay': 'str' } }
1335 # @BackupCommon:
1337 # @job-id: identifier for the newly-created block job. If
1338 #          omitted, the device name will be used. (Since 2.7)
1340 # @device: the device name or node-name of a root node which should be copied.
1342 # @sync: what parts of the disk image should be copied to the destination
1343 #        (all the disk, only the sectors allocated in the topmost image, from a
1344 #        dirty bitmap, or only new I/O).
1346 # @speed: the maximum speed, in bytes per second. The default is 0,
1347 #         for unlimited.
1349 # @bitmap: The name of a dirty bitmap to use.
1350 #          Must be present if sync is "bitmap" or "incremental".
1351 #          Can be present if sync is "full" or "top".
1352 #          Must not be present otherwise.
1353 #          (Since 2.4 (drive-backup), 3.1 (blockdev-backup))
1355 # @bitmap-mode: Specifies the type of data the bitmap should contain after
1356 #               the operation concludes.
1357 #               Must be present if a bitmap was provided,
1358 #               Must NOT be present otherwise. (Since 4.2)
1360 # @compress: true to compress data, if the target format supports it.
1361 #            (default: false) (since 2.8)
1363 # @on-source-error: the action to take on an error on the source,
1364 #                   default 'report'.  'stop' and 'enospc' can only be used
1365 #                   if the block device supports io-status (see BlockInfo).
1367 # @on-target-error: the action to take on an error on the target,
1368 #                   default 'report' (no limitations, since this applies to
1369 #                   a different block device than @device).
1371 # @auto-finalize: When false, this job will wait in a PENDING state after it has
1372 #                 finished its work, waiting for @block-job-finalize before
1373 #                 making any block graph changes.
1374 #                 When true, this job will automatically
1375 #                 perform its abort or commit actions.
1376 #                 Defaults to true. (Since 2.12)
1378 # @auto-dismiss: When false, this job will wait in a CONCLUDED state after it
1379 #                has completely ceased all work, and awaits @block-job-dismiss.
1380 #                When true, this job will automatically disappear from the query
1381 #                list without user intervention.
1382 #                Defaults to true. (Since 2.12)
1384 # @filter-node-name: the node name that should be assigned to the
1385 #                    filter driver that the backup job inserts into the graph
1386 #                    above node specified by @drive. If this option is not given,
1387 #                    a node name is autogenerated. (Since: 4.2)
1389 # Note: @on-source-error and @on-target-error only affect background
1390 #       I/O.  If an error occurs during a guest write request, the device's
1391 #       rerror/werror actions will be used.
1393 # Since: 4.2
1395 { 'struct': 'BackupCommon',
1396   'data': { '*job-id': 'str', 'device': 'str',
1397             'sync': 'MirrorSyncMode', '*speed': 'int',
1398             '*bitmap': 'str', '*bitmap-mode': 'BitmapSyncMode',
1399             '*compress': 'bool',
1400             '*on-source-error': 'BlockdevOnError',
1401             '*on-target-error': 'BlockdevOnError',
1402             '*auto-finalize': 'bool', '*auto-dismiss': 'bool',
1403             '*filter-node-name': 'str' } }
1406 # @DriveBackup:
1408 # @target: the target of the new image. If the file exists, or if it
1409 #          is a device, the existing file/device will be used as the new
1410 #          destination.  If it does not exist, a new file will be created.
1412 # @format: the format of the new destination, default is to
1413 #          probe if @mode is 'existing', else the format of the source
1415 # @mode: whether and how QEMU should create a new image, default is
1416 #        'absolute-paths'.
1418 # Since: 1.6
1420 { 'struct': 'DriveBackup',
1421   'base': 'BackupCommon',
1422   'data': { 'target': 'str',
1423             '*format': 'str',
1424             '*mode': 'NewImageMode' } }
1427 # @BlockdevBackup:
1429 # @target: the device name or node-name of the backup target node.
1431 # Since: 2.3
1433 { 'struct': 'BlockdevBackup',
1434   'base': 'BackupCommon',
1435   'data': { 'target': 'str' } }
1438 # @blockdev-snapshot-sync:
1440 # Takes a synchronous snapshot of a block device.
1442 # For the arguments, see the documentation of BlockdevSnapshotSync.
1444 # Returns: - nothing on success
1445 #          - If @device is not a valid block device, DeviceNotFound
1447 # Since: 0.14.0
1449 # Example:
1451 # -> { "execute": "blockdev-snapshot-sync",
1452 #      "arguments": { "device": "ide-hd0",
1453 #                     "snapshot-file":
1454 #                     "/some/place/my-image",
1455 #                     "format": "qcow2" } }
1456 # <- { "return": {} }
1459 { 'command': 'blockdev-snapshot-sync',
1460   'data': 'BlockdevSnapshotSync' }
1464 # @blockdev-snapshot:
1466 # Takes a snapshot of a block device.
1468 # Take a snapshot, by installing 'node' as the backing image of
1469 # 'overlay'. Additionally, if 'node' is associated with a block
1470 # device, the block device changes to using 'overlay' as its new active
1471 # image.
1473 # For the arguments, see the documentation of BlockdevSnapshot.
1475 # Features:
1476 # @allow-write-only-overlay: If present, the check whether this operation is safe
1477 #                            was relaxed so that it can be used to change
1478 #                            backing file of a destination of a blockdev-mirror.
1479 #                            (since 5.0)
1481 # Since: 2.5
1483 # Example:
1485 # -> { "execute": "blockdev-add",
1486 #      "arguments": { "driver": "qcow2",
1487 #                     "node-name": "node1534",
1488 #                     "file": { "driver": "file",
1489 #                               "filename": "hd1.qcow2" },
1490 #                     "backing": null } }
1492 # <- { "return": {} }
1494 # -> { "execute": "blockdev-snapshot",
1495 #      "arguments": { "node": "ide-hd0",
1496 #                     "overlay": "node1534" } }
1497 # <- { "return": {} }
1500 { 'command': 'blockdev-snapshot',
1501   'data': 'BlockdevSnapshot',
1502   'features': [ 'allow-write-only-overlay' ] }
1505 # @change-backing-file:
1507 # Change the backing file in the image file metadata.  This does not
1508 # cause QEMU to reopen the image file to reparse the backing filename
1509 # (it may, however, perform a reopen to change permissions from
1510 # r/o -> r/w -> r/o, if needed). The new backing file string is written
1511 # into the image file metadata, and the QEMU internal strings are
1512 # updated.
1514 # @image-node-name: The name of the block driver state node of the
1515 #                   image to modify. The "device" argument is used
1516 #                   to verify "image-node-name" is in the chain
1517 #                   described by "device".
1519 # @device: The device name or node-name of the root node that owns
1520 #          image-node-name.
1522 # @backing-file: The string to write as the backing file.  This
1523 #                string is not validated, so care should be taken
1524 #                when specifying the string or the image chain may
1525 #                not be able to be reopened again.
1527 # Returns: - Nothing on success
1528 #          - If "device" does not exist or cannot be determined, DeviceNotFound
1530 # Since: 2.1
1532 { 'command': 'change-backing-file',
1533   'data': { 'device': 'str', 'image-node-name': 'str',
1534             'backing-file': 'str' } }
1537 # @block-commit:
1539 # Live commit of data from overlay image nodes into backing nodes - i.e.,
1540 # writes data between 'top' and 'base' into 'base'.
1542 # @job-id: identifier for the newly-created block job. If
1543 #          omitted, the device name will be used. (Since 2.7)
1545 # @device: the device name or node-name of a root node
1547 # @base-node: The node name of the backing image to write data into.
1548 #             If not specified, this is the deepest backing image.
1549 #             (since: 3.1)
1551 # @base: Same as @base-node, except that it is a file name rather than a node
1552 #        name. This must be the exact filename string that was used to open the
1553 #        node; other strings, even if addressing the same file, are not
1554 #        accepted (deprecated, use @base-node instead)
1556 # @top-node: The node name of the backing image within the image chain
1557 #            which contains the topmost data to be committed down. If
1558 #            not specified, this is the active layer. (since: 3.1)
1560 # @top: Same as @top-node, except that it is a file name rather than a node
1561 #       name. This must be the exact filename string that was used to open the
1562 #       node; other strings, even if addressing the same file, are not
1563 #       accepted (deprecated, use @base-node instead)
1565 # @backing-file: The backing file string to write into the overlay
1566 #                image of 'top'.  If 'top' is the active layer,
1567 #                specifying a backing file string is an error. This
1568 #                filename is not validated.
1570 #                If a pathname string is such that it cannot be
1571 #                resolved by QEMU, that means that subsequent QMP or
1572 #                HMP commands must use node-names for the image in
1573 #                question, as filename lookup methods will fail.
1575 #                If not specified, QEMU will automatically determine
1576 #                the backing file string to use, or error out if
1577 #                there is no obvious choice. Care should be taken
1578 #                when specifying the string, to specify a valid
1579 #                filename or protocol.
1580 #                (Since 2.1)
1582 #                If top == base, that is an error.
1583 #                If top == active, the job will not be completed by itself,
1584 #                user needs to complete the job with the block-job-complete
1585 #                command after getting the ready event. (Since 2.0)
1587 #                If the base image is smaller than top, then the base image
1588 #                will be resized to be the same size as top.  If top is
1589 #                smaller than the base image, the base will not be
1590 #                truncated.  If you want the base image size to match the
1591 #                size of the smaller top, you can safely truncate it
1592 #                yourself once the commit operation successfully completes.
1594 # @speed: the maximum speed, in bytes per second
1596 # @on-error: the action to take on an error. 'ignore' means that the request
1597 #            should be retried. (default: report; Since: 5.0)
1599 # @filter-node-name: the node name that should be assigned to the
1600 #                    filter driver that the commit job inserts into the graph
1601 #                    above @top. If this option is not given, a node name is
1602 #                    autogenerated. (Since: 2.9)
1604 # @auto-finalize: When false, this job will wait in a PENDING state after it has
1605 #                 finished its work, waiting for @block-job-finalize before
1606 #                 making any block graph changes.
1607 #                 When true, this job will automatically
1608 #                 perform its abort or commit actions.
1609 #                 Defaults to true. (Since 3.1)
1611 # @auto-dismiss: When false, this job will wait in a CONCLUDED state after it
1612 #                has completely ceased all work, and awaits @block-job-dismiss.
1613 #                When true, this job will automatically disappear from the query
1614 #                list without user intervention.
1615 #                Defaults to true. (Since 3.1)
1617 # Returns: - Nothing on success
1618 #          - If @device does not exist, DeviceNotFound
1619 #          - Any other error returns a GenericError.
1621 # Since: 1.3
1623 # Example:
1625 # -> { "execute": "block-commit",
1626 #      "arguments": { "device": "virtio0",
1627 #                     "top": "/tmp/snap1.qcow2" } }
1628 # <- { "return": {} }
1631 { 'command': 'block-commit',
1632   'data': { '*job-id': 'str', 'device': 'str', '*base-node': 'str',
1633             '*base': 'str', '*top-node': 'str', '*top': 'str',
1634             '*backing-file': 'str', '*speed': 'int',
1635             '*on-error': 'BlockdevOnError',
1636             '*filter-node-name': 'str',
1637             '*auto-finalize': 'bool', '*auto-dismiss': 'bool' } }
1640 # @drive-backup:
1642 # Start a point-in-time copy of a block device to a new destination.  The
1643 # status of ongoing drive-backup operations can be checked with
1644 # query-block-jobs where the BlockJobInfo.type field has the value 'backup'.
1645 # The operation can be stopped before it has completed using the
1646 # block-job-cancel command.
1648 # Returns: - nothing on success
1649 #          - If @device is not a valid block device, GenericError
1651 # Since: 1.6
1653 # Example:
1655 # -> { "execute": "drive-backup",
1656 #      "arguments": { "device": "drive0",
1657 #                     "sync": "full",
1658 #                     "target": "backup.img" } }
1659 # <- { "return": {} }
1662 { 'command': 'drive-backup', 'boxed': true,
1663   'data': 'DriveBackup' }
1666 # @blockdev-backup:
1668 # Start a point-in-time copy of a block device to a new destination.  The
1669 # status of ongoing blockdev-backup operations can be checked with
1670 # query-block-jobs where the BlockJobInfo.type field has the value 'backup'.
1671 # The operation can be stopped before it has completed using the
1672 # block-job-cancel command.
1674 # Returns: - nothing on success
1675 #          - If @device is not a valid block device, DeviceNotFound
1677 # Since: 2.3
1679 # Example:
1680 # -> { "execute": "blockdev-backup",
1681 #      "arguments": { "device": "src-id",
1682 #                     "sync": "full",
1683 #                     "target": "tgt-id" } }
1684 # <- { "return": {} }
1687 { 'command': 'blockdev-backup', 'boxed': true,
1688   'data': 'BlockdevBackup' }
1692 # @query-named-block-nodes:
1694 # Get the named block driver list
1696 # @flat: Omit the nested data about backing image ("backing-image" key) if true.
1697 #        Default is false (Since 5.0)
1699 # Returns: the list of BlockDeviceInfo
1701 # Since: 2.0
1703 # Example:
1705 # -> { "execute": "query-named-block-nodes" }
1706 # <- { "return": [ { "ro":false,
1707 #                    "drv":"qcow2",
1708 #                    "encrypted":false,
1709 #                    "file":"disks/test.qcow2",
1710 #                    "node-name": "my-node",
1711 #                    "backing_file_depth":1,
1712 #                    "bps":1000000,
1713 #                    "bps_rd":0,
1714 #                    "bps_wr":0,
1715 #                    "iops":1000000,
1716 #                    "iops_rd":0,
1717 #                    "iops_wr":0,
1718 #                    "bps_max": 8000000,
1719 #                    "bps_rd_max": 0,
1720 #                    "bps_wr_max": 0,
1721 #                    "iops_max": 0,
1722 #                    "iops_rd_max": 0,
1723 #                    "iops_wr_max": 0,
1724 #                    "iops_size": 0,
1725 #                    "write_threshold": 0,
1726 #                    "image":{
1727 #                       "filename":"disks/test.qcow2",
1728 #                       "format":"qcow2",
1729 #                       "virtual-size":2048000,
1730 #                       "backing_file":"base.qcow2",
1731 #                       "full-backing-filename":"disks/base.qcow2",
1732 #                       "backing-filename-format":"qcow2",
1733 #                       "snapshots":[
1734 #                          {
1735 #                             "id": "1",
1736 #                             "name": "snapshot1",
1737 #                             "vm-state-size": 0,
1738 #                             "date-sec": 10000200,
1739 #                             "date-nsec": 12,
1740 #                             "vm-clock-sec": 206,
1741 #                             "vm-clock-nsec": 30
1742 #                          }
1743 #                       ],
1744 #                       "backing-image":{
1745 #                           "filename":"disks/base.qcow2",
1746 #                           "format":"qcow2",
1747 #                           "virtual-size":2048000
1748 #                       }
1749 #                    } } ] }
1752 { 'command': 'query-named-block-nodes',
1753   'returns': [ 'BlockDeviceInfo' ],
1754   'data': { '*flat': 'bool' } }
1757 # @XDbgBlockGraphNodeType:
1759 # @block-backend: corresponds to BlockBackend
1761 # @block-job: corresonds to BlockJob
1763 # @block-driver: corresponds to BlockDriverState
1765 # Since: 4.0
1767 { 'enum': 'XDbgBlockGraphNodeType',
1768   'data': [ 'block-backend', 'block-job', 'block-driver' ] }
1771 # @XDbgBlockGraphNode:
1773 # @id: Block graph node identifier. This @id is generated only for
1774 #      x-debug-query-block-graph and does not relate to any other identifiers in
1775 #      Qemu.
1777 # @type: Type of graph node. Can be one of block-backend, block-job or
1778 #        block-driver-state.
1780 # @name: Human readable name of the node. Corresponds to node-name for
1781 #        block-driver-state nodes; is not guaranteed to be unique in the whole
1782 #        graph (with block-jobs and block-backends).
1784 # Since: 4.0
1786 { 'struct': 'XDbgBlockGraphNode',
1787   'data': { 'id': 'uint64', 'type': 'XDbgBlockGraphNodeType', 'name': 'str' } }
1790 # @BlockPermission:
1792 # Enum of base block permissions.
1794 # @consistent-read: A user that has the "permission" of consistent reads is
1795 #                   guaranteed that their view of the contents of the block
1796 #                   device is complete and self-consistent, representing the
1797 #                   contents of a disk at a specific point.
1798 #                   For most block devices (including their backing files) this
1799 #                   is true, but the property cannot be maintained in a few
1800 #                   situations like for intermediate nodes of a commit block
1801 #                   job.
1803 # @write: This permission is required to change the visible disk contents.
1805 # @write-unchanged: This permission (which is weaker than BLK_PERM_WRITE) is
1806 #                   both enough and required for writes to the block node when
1807 #                   the caller promises that the visible disk content doesn't
1808 #                   change.
1809 #                   As the BLK_PERM_WRITE permission is strictly stronger,
1810 #                   either is sufficient to perform an unchanging write.
1812 # @resize: This permission is required to change the size of a block node.
1814 # @graph-mod: This permission is required to change the node that this
1815 #             BdrvChild points to.
1817 # Since: 4.0
1819   { 'enum': 'BlockPermission',
1820     'data': [ 'consistent-read', 'write', 'write-unchanged', 'resize',
1821               'graph-mod' ] }
1823 # @XDbgBlockGraphEdge:
1825 # Block Graph edge description for x-debug-query-block-graph.
1827 # @parent: parent id
1829 # @child: child id
1831 # @name: name of the relation (examples are 'file' and 'backing')
1833 # @perm: granted permissions for the parent operating on the child
1835 # @shared-perm: permissions that can still be granted to other users of the
1836 #               child while it is still attached to this parent
1838 # Since: 4.0
1840 { 'struct': 'XDbgBlockGraphEdge',
1841   'data': { 'parent': 'uint64', 'child': 'uint64',
1842             'name': 'str', 'perm': [ 'BlockPermission' ],
1843             'shared-perm': [ 'BlockPermission' ] } }
1846 # @XDbgBlockGraph:
1848 # Block Graph - list of nodes and list of edges.
1850 # Since: 4.0
1852 { 'struct': 'XDbgBlockGraph',
1853   'data': { 'nodes': ['XDbgBlockGraphNode'], 'edges': ['XDbgBlockGraphEdge'] } }
1856 # @x-debug-query-block-graph:
1858 # Get the block graph.
1860 # Since: 4.0
1862 { 'command': 'x-debug-query-block-graph', 'returns': 'XDbgBlockGraph' }
1865 # @drive-mirror:
1867 # Start mirroring a block device's writes to a new destination. target
1868 # specifies the target of the new image. If the file exists, or if it
1869 # is a device, it will be used as the new destination for writes. If
1870 # it does not exist, a new file will be created. format specifies the
1871 # format of the mirror image, default is to probe if mode='existing',
1872 # else the format of the source.
1874 # Returns: - nothing on success
1875 #          - If @device is not a valid block device, GenericError
1877 # Since: 1.3
1879 # Example:
1881 # -> { "execute": "drive-mirror",
1882 #      "arguments": { "device": "ide-hd0",
1883 #                     "target": "/some/place/my-image",
1884 #                     "sync": "full",
1885 #                     "format": "qcow2" } }
1886 # <- { "return": {} }
1889 { 'command': 'drive-mirror', 'boxed': true,
1890   'data': 'DriveMirror' }
1893 # @DriveMirror:
1895 # A set of parameters describing drive mirror setup.
1897 # @job-id: identifier for the newly-created block job. If
1898 #          omitted, the device name will be used. (Since 2.7)
1900 # @device:  the device name or node-name of a root node whose writes should be
1901 #           mirrored.
1903 # @target: the target of the new image. If the file exists, or if it
1904 #          is a device, the existing file/device will be used as the new
1905 #          destination.  If it does not exist, a new file will be created.
1907 # @format: the format of the new destination, default is to
1908 #          probe if @mode is 'existing', else the format of the source
1910 # @node-name: the new block driver state node name in the graph
1911 #             (Since 2.1)
1913 # @replaces: with sync=full graph node name to be replaced by the new
1914 #            image when a whole image copy is done. This can be used to repair
1915 #            broken Quorum files. (Since 2.1)
1917 # @mode: whether and how QEMU should create a new image, default is
1918 #        'absolute-paths'.
1920 # @speed:  the maximum speed, in bytes per second
1922 # @sync: what parts of the disk image should be copied to the destination
1923 #        (all the disk, only the sectors allocated in the topmost image, or
1924 #        only new I/O).
1926 # @granularity: granularity of the dirty bitmap, default is 64K
1927 #               if the image format doesn't have clusters, 4K if the clusters
1928 #               are smaller than that, else the cluster size.  Must be a
1929 #               power of 2 between 512 and 64M (since 1.4).
1931 # @buf-size: maximum amount of data in flight from source to
1932 #            target (since 1.4).
1934 # @on-source-error: the action to take on an error on the source,
1935 #                   default 'report'.  'stop' and 'enospc' can only be used
1936 #                   if the block device supports io-status (see BlockInfo).
1938 # @on-target-error: the action to take on an error on the target,
1939 #                   default 'report' (no limitations, since this applies to
1940 #                   a different block device than @device).
1941 # @unmap: Whether to try to unmap target sectors where source has
1942 #         only zero. If true, and target unallocated sectors will read as zero,
1943 #         target image sectors will be unmapped; otherwise, zeroes will be
1944 #         written. Both will result in identical contents.
1945 #         Default is true. (Since 2.4)
1947 # @copy-mode: when to copy data to the destination; defaults to 'background'
1948 #             (Since: 3.0)
1950 # @auto-finalize: When false, this job will wait in a PENDING state after it has
1951 #                 finished its work, waiting for @block-job-finalize before
1952 #                 making any block graph changes.
1953 #                 When true, this job will automatically
1954 #                 perform its abort or commit actions.
1955 #                 Defaults to true. (Since 3.1)
1957 # @auto-dismiss: When false, this job will wait in a CONCLUDED state after it
1958 #                has completely ceased all work, and awaits @block-job-dismiss.
1959 #                When true, this job will automatically disappear from the query
1960 #                list without user intervention.
1961 #                Defaults to true. (Since 3.1)
1962 # Since: 1.3
1964 { 'struct': 'DriveMirror',
1965   'data': { '*job-id': 'str', 'device': 'str', 'target': 'str',
1966             '*format': 'str', '*node-name': 'str', '*replaces': 'str',
1967             'sync': 'MirrorSyncMode', '*mode': 'NewImageMode',
1968             '*speed': 'int', '*granularity': 'uint32',
1969             '*buf-size': 'int', '*on-source-error': 'BlockdevOnError',
1970             '*on-target-error': 'BlockdevOnError',
1971             '*unmap': 'bool', '*copy-mode': 'MirrorCopyMode',
1972             '*auto-finalize': 'bool', '*auto-dismiss': 'bool' } }
1975 # @BlockDirtyBitmap:
1977 # @node: name of device/node which the bitmap is tracking
1979 # @name: name of the dirty bitmap
1981 # Since: 2.4
1983 { 'struct': 'BlockDirtyBitmap',
1984   'data': { 'node': 'str', 'name': 'str' } }
1987 # @BlockDirtyBitmapAdd:
1989 # @node: name of device/node which the bitmap is tracking
1991 # @name: name of the dirty bitmap (must be less than 1024 bytes)
1993 # @granularity: the bitmap granularity, default is 64k for
1994 #               block-dirty-bitmap-add
1996 # @persistent: the bitmap is persistent, i.e. it will be saved to the
1997 #              corresponding block device image file on its close. For now only
1998 #              Qcow2 disks support persistent bitmaps. Default is false for
1999 #              block-dirty-bitmap-add. (Since: 2.10)
2001 # @disabled: the bitmap is created in the disabled state, which means that
2002 #            it will not track drive changes. The bitmap may be enabled with
2003 #            block-dirty-bitmap-enable. Default is false. (Since: 4.0)
2005 # Since: 2.4
2007 { 'struct': 'BlockDirtyBitmapAdd',
2008   'data': { 'node': 'str', 'name': 'str', '*granularity': 'uint32',
2009             '*persistent': 'bool', '*disabled': 'bool' } }
2012 # @BlockDirtyBitmapMergeSource:
2014 # @local: name of the bitmap, attached to the same node as target bitmap.
2016 # @external: bitmap with specified node
2018 # Since: 4.1
2020 { 'alternate': 'BlockDirtyBitmapMergeSource',
2021   'data': { 'local': 'str',
2022             'external': 'BlockDirtyBitmap' } }
2025 # @BlockDirtyBitmapMerge:
2027 # @node: name of device/node which the @target bitmap is tracking
2029 # @target: name of the destination dirty bitmap
2031 # @bitmaps: name(s) of the source dirty bitmap(s) at @node and/or fully
2032 #           specifed BlockDirtyBitmap elements. The latter are supported
2033 #           since 4.1.
2035 # Since: 4.0
2037 { 'struct': 'BlockDirtyBitmapMerge',
2038   'data': { 'node': 'str', 'target': 'str',
2039             'bitmaps': ['BlockDirtyBitmapMergeSource'] } }
2042 # @block-dirty-bitmap-add:
2044 # Create a dirty bitmap with a name on the node, and start tracking the writes.
2046 # Returns: - nothing on success
2047 #          - If @node is not a valid block device or node, DeviceNotFound
2048 #          - If @name is already taken, GenericError with an explanation
2050 # Since: 2.4
2052 # Example:
2054 # -> { "execute": "block-dirty-bitmap-add",
2055 #      "arguments": { "node": "drive0", "name": "bitmap0" } }
2056 # <- { "return": {} }
2059 { 'command': 'block-dirty-bitmap-add',
2060   'data': 'BlockDirtyBitmapAdd' }
2063 # @block-dirty-bitmap-remove:
2065 # Stop write tracking and remove the dirty bitmap that was created
2066 # with block-dirty-bitmap-add. If the bitmap is persistent, remove it from its
2067 # storage too.
2069 # Returns: - nothing on success
2070 #          - If @node is not a valid block device or node, DeviceNotFound
2071 #          - If @name is not found, GenericError with an explanation
2072 #          - if @name is frozen by an operation, GenericError
2074 # Since: 2.4
2076 # Example:
2078 # -> { "execute": "block-dirty-bitmap-remove",
2079 #      "arguments": { "node": "drive0", "name": "bitmap0" } }
2080 # <- { "return": {} }
2083 { 'command': 'block-dirty-bitmap-remove',
2084   'data': 'BlockDirtyBitmap' }
2087 # @block-dirty-bitmap-clear:
2089 # Clear (reset) a dirty bitmap on the device, so that an incremental
2090 # backup from this point in time forward will only backup clusters
2091 # modified after this clear operation.
2093 # Returns: - nothing on success
2094 #          - If @node is not a valid block device, DeviceNotFound
2095 #          - If @name is not found, GenericError with an explanation
2097 # Since: 2.4
2099 # Example:
2101 # -> { "execute": "block-dirty-bitmap-clear",
2102 #      "arguments": { "node": "drive0", "name": "bitmap0" } }
2103 # <- { "return": {} }
2106 { 'command': 'block-dirty-bitmap-clear',
2107   'data': 'BlockDirtyBitmap' }
2110 # @block-dirty-bitmap-enable:
2112 # Enables a dirty bitmap so that it will begin tracking disk changes.
2114 # Returns: - nothing on success
2115 #          - If @node is not a valid block device, DeviceNotFound
2116 #          - If @name is not found, GenericError with an explanation
2118 # Since: 4.0
2120 # Example:
2122 # -> { "execute": "block-dirty-bitmap-enable",
2123 #      "arguments": { "node": "drive0", "name": "bitmap0" } }
2124 # <- { "return": {} }
2127   { 'command': 'block-dirty-bitmap-enable',
2128     'data': 'BlockDirtyBitmap' }
2131 # @block-dirty-bitmap-disable:
2133 # Disables a dirty bitmap so that it will stop tracking disk changes.
2135 # Returns: - nothing on success
2136 #          - If @node is not a valid block device, DeviceNotFound
2137 #          - If @name is not found, GenericError with an explanation
2139 # Since: 4.0
2141 # Example:
2143 # -> { "execute": "block-dirty-bitmap-disable",
2144 #      "arguments": { "node": "drive0", "name": "bitmap0" } }
2145 # <- { "return": {} }
2148     { 'command': 'block-dirty-bitmap-disable',
2149       'data': 'BlockDirtyBitmap' }
2152 # @block-dirty-bitmap-merge:
2154 # Merge dirty bitmaps listed in @bitmaps to the @target dirty bitmap.
2155 # Dirty bitmaps in @bitmaps will be unchanged, except if it also appears
2156 # as the @target bitmap. Any bits already set in @target will still be
2157 # set after the merge, i.e., this operation does not clear the target.
2158 # On error, @target is unchanged.
2160 # The resulting bitmap will count as dirty any clusters that were dirty in any
2161 # of the source bitmaps. This can be used to achieve backup checkpoints, or in
2162 # simpler usages, to copy bitmaps.
2164 # Returns: - nothing on success
2165 #          - If @node is not a valid block device, DeviceNotFound
2166 #          - If any bitmap in @bitmaps or @target is not found, GenericError
2167 #          - If any of the bitmaps have different sizes or granularities,
2168 #            GenericError
2170 # Since: 4.0
2172 # Example:
2174 # -> { "execute": "block-dirty-bitmap-merge",
2175 #      "arguments": { "node": "drive0", "target": "bitmap0",
2176 #                     "bitmaps": ["bitmap1"] } }
2177 # <- { "return": {} }
2180       { 'command': 'block-dirty-bitmap-merge',
2181         'data': 'BlockDirtyBitmapMerge' }
2184 # @BlockDirtyBitmapSha256:
2186 # SHA256 hash of dirty bitmap data
2188 # @sha256: ASCII representation of SHA256 bitmap hash
2190 # Since: 2.10
2192   { 'struct': 'BlockDirtyBitmapSha256',
2193     'data': {'sha256': 'str'} }
2196 # @x-debug-block-dirty-bitmap-sha256:
2198 # Get bitmap SHA256.
2200 # Returns: - BlockDirtyBitmapSha256 on success
2201 #          - If @node is not a valid block device, DeviceNotFound
2202 #          - If @name is not found or if hashing has failed, GenericError with an
2203 #            explanation
2205 # Since: 2.10
2207   { 'command': 'x-debug-block-dirty-bitmap-sha256',
2208     'data': 'BlockDirtyBitmap', 'returns': 'BlockDirtyBitmapSha256' }
2211 # @blockdev-mirror:
2213 # Start mirroring a block device's writes to a new destination.
2215 # @job-id: identifier for the newly-created block job. If
2216 #          omitted, the device name will be used. (Since 2.7)
2218 # @device: The device name or node-name of a root node whose writes should be
2219 #          mirrored.
2221 # @target: the id or node-name of the block device to mirror to. This mustn't be
2222 #          attached to guest.
2224 # @replaces: with sync=full graph node name to be replaced by the new
2225 #            image when a whole image copy is done. This can be used to repair
2226 #            broken Quorum files.
2228 # @speed:  the maximum speed, in bytes per second
2230 # @sync: what parts of the disk image should be copied to the destination
2231 #        (all the disk, only the sectors allocated in the topmost image, or
2232 #        only new I/O).
2234 # @granularity: granularity of the dirty bitmap, default is 64K
2235 #               if the image format doesn't have clusters, 4K if the clusters
2236 #               are smaller than that, else the cluster size.  Must be a
2237 #               power of 2 between 512 and 64M
2239 # @buf-size: maximum amount of data in flight from source to
2240 #            target
2242 # @on-source-error: the action to take on an error on the source,
2243 #                   default 'report'.  'stop' and 'enospc' can only be used
2244 #                   if the block device supports io-status (see BlockInfo).
2246 # @on-target-error: the action to take on an error on the target,
2247 #                   default 'report' (no limitations, since this applies to
2248 #                   a different block device than @device).
2250 # @filter-node-name: the node name that should be assigned to the
2251 #                    filter driver that the mirror job inserts into the graph
2252 #                    above @device. If this option is not given, a node name is
2253 #                    autogenerated. (Since: 2.9)
2255 # @copy-mode: when to copy data to the destination; defaults to 'background'
2256 #             (Since: 3.0)
2258 # @auto-finalize: When false, this job will wait in a PENDING state after it has
2259 #                 finished its work, waiting for @block-job-finalize before
2260 #                 making any block graph changes.
2261 #                 When true, this job will automatically
2262 #                 perform its abort or commit actions.
2263 #                 Defaults to true. (Since 3.1)
2265 # @auto-dismiss: When false, this job will wait in a CONCLUDED state after it
2266 #                has completely ceased all work, and awaits @block-job-dismiss.
2267 #                When true, this job will automatically disappear from the query
2268 #                list without user intervention.
2269 #                Defaults to true. (Since 3.1)
2270 # Returns: nothing on success.
2272 # Since: 2.6
2274 # Example:
2276 # -> { "execute": "blockdev-mirror",
2277 #      "arguments": { "device": "ide-hd0",
2278 #                     "target": "target0",
2279 #                     "sync": "full" } }
2280 # <- { "return": {} }
2283 { 'command': 'blockdev-mirror',
2284   'data': { '*job-id': 'str', 'device': 'str', 'target': 'str',
2285             '*replaces': 'str',
2286             'sync': 'MirrorSyncMode',
2287             '*speed': 'int', '*granularity': 'uint32',
2288             '*buf-size': 'int', '*on-source-error': 'BlockdevOnError',
2289             '*on-target-error': 'BlockdevOnError',
2290             '*filter-node-name': 'str',
2291             '*copy-mode': 'MirrorCopyMode',
2292             '*auto-finalize': 'bool', '*auto-dismiss': 'bool' } }
2295 # @BlockIOThrottle:
2297 # A set of parameters describing block throttling.
2299 # @device: Block device name (deprecated, use @id instead)
2301 # @id: The name or QOM path of the guest device (since: 2.8)
2303 # @bps: total throughput limit in bytes per second
2305 # @bps_rd: read throughput limit in bytes per second
2307 # @bps_wr: write throughput limit in bytes per second
2309 # @iops: total I/O operations per second
2311 # @iops_rd: read I/O operations per second
2313 # @iops_wr: write I/O operations per second
2315 # @bps_max: total throughput limit during bursts,
2316 #           in bytes (Since 1.7)
2318 # @bps_rd_max: read throughput limit during bursts,
2319 #              in bytes (Since 1.7)
2321 # @bps_wr_max: write throughput limit during bursts,
2322 #              in bytes (Since 1.7)
2324 # @iops_max: total I/O operations per second during bursts,
2325 #            in bytes (Since 1.7)
2327 # @iops_rd_max: read I/O operations per second during bursts,
2328 #               in bytes (Since 1.7)
2330 # @iops_wr_max: write I/O operations per second during bursts,
2331 #               in bytes (Since 1.7)
2333 # @bps_max_length: maximum length of the @bps_max burst
2334 #                  period, in seconds. It must only
2335 #                  be set if @bps_max is set as well.
2336 #                  Defaults to 1. (Since 2.6)
2338 # @bps_rd_max_length: maximum length of the @bps_rd_max
2339 #                     burst period, in seconds. It must only
2340 #                     be set if @bps_rd_max is set as well.
2341 #                     Defaults to 1. (Since 2.6)
2343 # @bps_wr_max_length: maximum length of the @bps_wr_max
2344 #                     burst period, in seconds. It must only
2345 #                     be set if @bps_wr_max is set as well.
2346 #                     Defaults to 1. (Since 2.6)
2348 # @iops_max_length: maximum length of the @iops burst
2349 #                   period, in seconds. It must only
2350 #                   be set if @iops_max is set as well.
2351 #                   Defaults to 1. (Since 2.6)
2353 # @iops_rd_max_length: maximum length of the @iops_rd_max
2354 #                      burst period, in seconds. It must only
2355 #                      be set if @iops_rd_max is set as well.
2356 #                      Defaults to 1. (Since 2.6)
2358 # @iops_wr_max_length: maximum length of the @iops_wr_max
2359 #                      burst period, in seconds. It must only
2360 #                      be set if @iops_wr_max is set as well.
2361 #                      Defaults to 1. (Since 2.6)
2363 # @iops_size: an I/O size in bytes (Since 1.7)
2365 # @group: throttle group name (Since 2.4)
2367 # Since: 1.1
2369 { 'struct': 'BlockIOThrottle',
2370   'data': { '*device': 'str', '*id': 'str', 'bps': 'int', 'bps_rd': 'int',
2371             'bps_wr': 'int', 'iops': 'int', 'iops_rd': 'int', 'iops_wr': 'int',
2372             '*bps_max': 'int', '*bps_rd_max': 'int',
2373             '*bps_wr_max': 'int', '*iops_max': 'int',
2374             '*iops_rd_max': 'int', '*iops_wr_max': 'int',
2375             '*bps_max_length': 'int', '*bps_rd_max_length': 'int',
2376             '*bps_wr_max_length': 'int', '*iops_max_length': 'int',
2377             '*iops_rd_max_length': 'int', '*iops_wr_max_length': 'int',
2378             '*iops_size': 'int', '*group': 'str' } }
2381 # @ThrottleLimits:
2383 # Limit parameters for throttling.
2384 # Since some limit combinations are illegal, limits should always be set in one
2385 # transaction. All fields are optional. When setting limits, if a field is
2386 # missing the current value is not changed.
2388 # @iops-total: limit total I/O operations per second
2389 # @iops-total-max: I/O operations burst
2390 # @iops-total-max-length: length of the iops-total-max burst period, in seconds
2391 #                         It must only be set if @iops-total-max is set as well.
2392 # @iops-read: limit read operations per second
2393 # @iops-read-max: I/O operations read burst
2394 # @iops-read-max-length: length of the iops-read-max burst period, in seconds
2395 #                        It must only be set if @iops-read-max is set as well.
2396 # @iops-write: limit write operations per second
2397 # @iops-write-max: I/O operations write burst
2398 # @iops-write-max-length: length of the iops-write-max burst period, in seconds
2399 #                         It must only be set if @iops-write-max is set as well.
2400 # @bps-total: limit total bytes per second
2401 # @bps-total-max: total bytes burst
2402 # @bps-total-max-length: length of the bps-total-max burst period, in seconds.
2403 #                        It must only be set if @bps-total-max is set as well.
2404 # @bps-read: limit read bytes per second
2405 # @bps-read-max: total bytes read burst
2406 # @bps-read-max-length: length of the bps-read-max burst period, in seconds
2407 #                       It must only be set if @bps-read-max is set as well.
2408 # @bps-write: limit write bytes per second
2409 # @bps-write-max: total bytes write burst
2410 # @bps-write-max-length: length of the bps-write-max burst period, in seconds
2411 #                        It must only be set if @bps-write-max is set as well.
2412 # @iops-size: when limiting by iops max size of an I/O in bytes
2414 # Since: 2.11
2416 { 'struct': 'ThrottleLimits',
2417   'data': { '*iops-total' : 'int', '*iops-total-max' : 'int',
2418             '*iops-total-max-length' : 'int', '*iops-read' : 'int',
2419             '*iops-read-max' : 'int', '*iops-read-max-length' : 'int',
2420             '*iops-write' : 'int', '*iops-write-max' : 'int',
2421             '*iops-write-max-length' : 'int', '*bps-total' : 'int',
2422             '*bps-total-max' : 'int', '*bps-total-max-length' : 'int',
2423             '*bps-read' : 'int', '*bps-read-max' : 'int',
2424             '*bps-read-max-length' : 'int', '*bps-write' : 'int',
2425             '*bps-write-max' : 'int', '*bps-write-max-length' : 'int',
2426             '*iops-size' : 'int' } }
2429 # @block-stream:
2431 # Copy data from a backing file into a block device.
2433 # The block streaming operation is performed in the background until the entire
2434 # backing file has been copied.  This command returns immediately once streaming
2435 # has started.  The status of ongoing block streaming operations can be checked
2436 # with query-block-jobs.  The operation can be stopped before it has completed
2437 # using the block-job-cancel command.
2439 # The node that receives the data is called the top image, can be located in
2440 # any part of the chain (but always above the base image; see below) and can be
2441 # specified using its device or node name. Earlier qemu versions only allowed
2442 # 'device' to name the top level node; presence of the 'base-node' parameter
2443 # during introspection can be used as a witness of the enhanced semantics
2444 # of 'device'.
2446 # If a base file is specified then sectors are not copied from that base file and
2447 # its backing chain.  When streaming completes the image file will have the base
2448 # file as its backing file.  This can be used to stream a subset of the backing
2449 # file chain instead of flattening the entire image.
2451 # On successful completion the image file is updated to drop the backing file
2452 # and the BLOCK_JOB_COMPLETED event is emitted.
2454 # @job-id: identifier for the newly-created block job. If
2455 #          omitted, the device name will be used. (Since 2.7)
2457 # @device: the device or node name of the top image
2459 # @base: the common backing file name.
2460 #        It cannot be set if @base-node is also set.
2462 # @base-node: the node name of the backing file.
2463 #             It cannot be set if @base is also set. (Since 2.8)
2465 # @backing-file: The backing file string to write into the top
2466 #                image. This filename is not validated.
2468 #                If a pathname string is such that it cannot be
2469 #                resolved by QEMU, that means that subsequent QMP or
2470 #                HMP commands must use node-names for the image in
2471 #                question, as filename lookup methods will fail.
2473 #                If not specified, QEMU will automatically determine
2474 #                the backing file string to use, or error out if there
2475 #                is no obvious choice.  Care should be taken when
2476 #                specifying the string, to specify a valid filename or
2477 #                protocol.
2478 #                (Since 2.1)
2480 # @speed: the maximum speed, in bytes per second
2482 # @on-error: the action to take on an error (default report).
2483 #            'stop' and 'enospc' can only be used if the block device
2484 #            supports io-status (see BlockInfo).  Since 1.3.
2486 # @auto-finalize: When false, this job will wait in a PENDING state after it has
2487 #                 finished its work, waiting for @block-job-finalize before
2488 #                 making any block graph changes.
2489 #                 When true, this job will automatically
2490 #                 perform its abort or commit actions.
2491 #                 Defaults to true. (Since 3.1)
2493 # @auto-dismiss: When false, this job will wait in a CONCLUDED state after it
2494 #                has completely ceased all work, and awaits @block-job-dismiss.
2495 #                When true, this job will automatically disappear from the query
2496 #                list without user intervention.
2497 #                Defaults to true. (Since 3.1)
2499 # Returns: - Nothing on success.
2500 #          - If @device does not exist, DeviceNotFound.
2502 # Since: 1.1
2504 # Example:
2506 # -> { "execute": "block-stream",
2507 #      "arguments": { "device": "virtio0",
2508 #                     "base": "/tmp/master.qcow2" } }
2509 # <- { "return": {} }
2512 { 'command': 'block-stream',
2513   'data': { '*job-id': 'str', 'device': 'str', '*base': 'str',
2514             '*base-node': 'str', '*backing-file': 'str', '*speed': 'int',
2515             '*on-error': 'BlockdevOnError',
2516             '*auto-finalize': 'bool', '*auto-dismiss': 'bool' } }
2519 # @block-job-set-speed:
2521 # Set maximum speed for a background block operation.
2523 # This command can only be issued when there is an active block job.
2525 # Throttling can be disabled by setting the speed to 0.
2527 # @device: The job identifier. This used to be a device name (hence
2528 #          the name of the parameter), but since QEMU 2.7 it can have
2529 #          other values.
2531 # @speed: the maximum speed, in bytes per second, or 0 for unlimited.
2532 #         Defaults to 0.
2534 # Returns: - Nothing on success
2535 #          - If no background operation is active on this device, DeviceNotActive
2537 # Since: 1.1
2539 { 'command': 'block-job-set-speed',
2540   'data': { 'device': 'str', 'speed': 'int' } }
2543 # @block-job-cancel:
2545 # Stop an active background block operation.
2547 # This command returns immediately after marking the active background block
2548 # operation for cancellation.  It is an error to call this command if no
2549 # operation is in progress.
2551 # The operation will cancel as soon as possible and then emit the
2552 # BLOCK_JOB_CANCELLED event.  Before that happens the job is still visible when
2553 # enumerated using query-block-jobs.
2555 # Note that if you issue 'block-job-cancel' after 'drive-mirror' has indicated
2556 # (via the event BLOCK_JOB_READY) that the source and destination are
2557 # synchronized, then the event triggered by this command changes to
2558 # BLOCK_JOB_COMPLETED, to indicate that the mirroring has ended and the
2559 # destination now has a point-in-time copy tied to the time of the cancellation.
2561 # For streaming, the image file retains its backing file unless the streaming
2562 # operation happens to complete just as it is being cancelled.  A new streaming
2563 # operation can be started at a later time to finish copying all data from the
2564 # backing file.
2566 # @device: The job identifier. This used to be a device name (hence
2567 #          the name of the parameter), but since QEMU 2.7 it can have
2568 #          other values.
2570 # @force: If true, and the job has already emitted the event BLOCK_JOB_READY,
2571 #         abandon the job immediately (even if it is paused) instead of waiting
2572 #         for the destination to complete its final synchronization (since 1.3)
2574 # Returns: - Nothing on success
2575 #          - If no background operation is active on this device, DeviceNotActive
2577 # Since: 1.1
2579 { 'command': 'block-job-cancel', 'data': { 'device': 'str', '*force': 'bool' } }
2582 # @block-job-pause:
2584 # Pause an active background block operation.
2586 # This command returns immediately after marking the active background block
2587 # operation for pausing.  It is an error to call this command if no
2588 # operation is in progress or if the job is already paused.
2590 # The operation will pause as soon as possible.  No event is emitted when
2591 # the operation is actually paused.  Cancelling a paused job automatically
2592 # resumes it.
2594 # @device: The job identifier. This used to be a device name (hence
2595 #          the name of the parameter), but since QEMU 2.7 it can have
2596 #          other values.
2598 # Returns: - Nothing on success
2599 #          - If no background operation is active on this device, DeviceNotActive
2601 # Since: 1.3
2603 { 'command': 'block-job-pause', 'data': { 'device': 'str' } }
2606 # @block-job-resume:
2608 # Resume an active background block operation.
2610 # This command returns immediately after resuming a paused background block
2611 # operation.  It is an error to call this command if no operation is in
2612 # progress or if the job is not paused.
2614 # This command also clears the error status of the job.
2616 # @device: The job identifier. This used to be a device name (hence
2617 #          the name of the parameter), but since QEMU 2.7 it can have
2618 #          other values.
2620 # Returns: - Nothing on success
2621 #          - If no background operation is active on this device, DeviceNotActive
2623 # Since: 1.3
2625 { 'command': 'block-job-resume', 'data': { 'device': 'str' } }
2628 # @block-job-complete:
2630 # Manually trigger completion of an active background block operation.  This
2631 # is supported for drive mirroring, where it also switches the device to
2632 # write to the target path only.  The ability to complete is signaled with
2633 # a BLOCK_JOB_READY event.
2635 # This command completes an active background block operation synchronously.
2636 # The ordering of this command's return with the BLOCK_JOB_COMPLETED event
2637 # is not defined.  Note that if an I/O error occurs during the processing of
2638 # this command: 1) the command itself will fail; 2) the error will be processed
2639 # according to the rerror/werror arguments that were specified when starting
2640 # the operation.
2642 # A cancelled or paused job cannot be completed.
2644 # @device: The job identifier. This used to be a device name (hence
2645 #          the name of the parameter), but since QEMU 2.7 it can have
2646 #          other values.
2648 # Returns: - Nothing on success
2649 #          - If no background operation is active on this device, DeviceNotActive
2651 # Since: 1.3
2653 { 'command': 'block-job-complete', 'data': { 'device': 'str' } }
2656 # @block-job-dismiss:
2658 # For jobs that have already concluded, remove them from the block-job-query
2659 # list. This command only needs to be run for jobs which were started with
2660 # QEMU 2.12+ job lifetime management semantics.
2662 # This command will refuse to operate on any job that has not yet reached
2663 # its terminal state, JOB_STATUS_CONCLUDED. For jobs that make use of the
2664 # BLOCK_JOB_READY event, block-job-cancel or block-job-complete will still need
2665 # to be used as appropriate.
2667 # @id: The job identifier.
2669 # Returns: Nothing on success
2671 # Since: 2.12
2673 { 'command': 'block-job-dismiss', 'data': { 'id': 'str' } }
2676 # @block-job-finalize:
2678 # Once a job that has manual=true reaches the pending state, it can be
2679 # instructed to finalize any graph changes and do any necessary cleanup
2680 # via this command.
2681 # For jobs in a transaction, instructing one job to finalize will force
2682 # ALL jobs in the transaction to finalize, so it is only necessary to instruct
2683 # a single member job to finalize.
2685 # @id: The job identifier.
2687 # Returns: Nothing on success
2689 # Since: 2.12
2691 { 'command': 'block-job-finalize', 'data': { 'id': 'str' } }
2694 # @BlockdevDiscardOptions:
2696 # Determines how to handle discard requests.
2698 # @ignore: Ignore the request
2699 # @unmap: Forward as an unmap request
2701 # Since: 2.9
2703 { 'enum': 'BlockdevDiscardOptions',
2704   'data': [ 'ignore', 'unmap' ] }
2707 # @BlockdevDetectZeroesOptions:
2709 # Describes the operation mode for the automatic conversion of plain
2710 # zero writes by the OS to driver specific optimized zero write commands.
2712 # @off: Disabled (default)
2713 # @on: Enabled
2714 # @unmap: Enabled and even try to unmap blocks if possible. This requires
2715 #         also that @BlockdevDiscardOptions is set to unmap for this device.
2717 # Since: 2.1
2719 { 'enum': 'BlockdevDetectZeroesOptions',
2720   'data': [ 'off', 'on', 'unmap' ] }
2723 # @BlockdevAioOptions:
2725 # Selects the AIO backend to handle I/O requests
2727 # @threads: Use qemu's thread pool
2728 # @native: Use native AIO backend (only Linux and Windows)
2729 # @io_uring: Use linux io_uring (since 5.0)
2731 # Since: 2.9
2733 { 'enum': 'BlockdevAioOptions',
2734   'data': [ 'threads', 'native',
2735             { 'name': 'io_uring', 'if': 'defined(CONFIG_LINUX_IO_URING)' } ] }
2738 # @BlockdevCacheOptions:
2740 # Includes cache-related options for block devices
2742 # @direct: enables use of O_DIRECT (bypass the host page cache;
2743 #          default: false)
2744 # @no-flush: ignore any flush requests for the device (default:
2745 #            false)
2747 # Since: 2.9
2749 { 'struct': 'BlockdevCacheOptions',
2750   'data': { '*direct': 'bool',
2751             '*no-flush': 'bool' } }
2754 # @BlockdevDriver:
2756 # Drivers that are supported in block device operations.
2758 # @vxhs: Since 2.10
2759 # @throttle: Since 2.11
2760 # @nvme: Since 2.12
2761 # @copy-on-read: Since 3.0
2762 # @blklogwrites: Since 3.0
2763 # @blkreplay: Since 4.2
2764 # @compress: Since 5.0
2766 # Since: 2.9
2768 { 'enum': 'BlockdevDriver',
2769   'data': [ 'blkdebug', 'blklogwrites', 'blkreplay', 'blkverify', 'bochs',
2770             'cloop', 'compress', 'copy-on-read', 'dmg', 'file', 'ftp', 'ftps',
2771             'gluster', 'host_cdrom', 'host_device', 'http', 'https', 'iscsi',
2772             'luks', 'nbd', 'nfs', 'null-aio', 'null-co', 'nvme', 'parallels',
2773             'qcow', 'qcow2', 'qed', 'quorum', 'raw', 'rbd',
2774             { 'name': 'replication', 'if': 'defined(CONFIG_REPLICATION)' },
2775             'sheepdog',
2776             'ssh', 'throttle', 'vdi', 'vhdx', 'vmdk', 'vpc', 'vvfat', 'vxhs' ] }
2779 # @BlockdevOptionsFile:
2781 # Driver specific block device options for the file backend.
2783 # @filename: path to the image file
2784 # @pr-manager: the id for the object that will handle persistent reservations
2785 #              for this device (default: none, forward the commands via SG_IO;
2786 #              since 2.11)
2787 # @aio: AIO backend (default: threads) (since: 2.8)
2788 # @locking: whether to enable file locking. If set to 'auto', only enable
2789 #           when Open File Descriptor (OFD) locking API is available
2790 #           (default: auto, since 2.10)
2791 # @drop-cache: invalidate page cache during live migration.  This prevents
2792 #              stale data on the migration destination with cache.direct=off.
2793 #              Currently only supported on Linux hosts.
2794 #              (default: on, since: 4.0)
2795 # @x-check-cache-dropped: whether to check that page cache was dropped on live
2796 #                         migration.  May cause noticeable delays if the image
2797 #                         file is large, do not use in production.
2798 #                         (default: off) (since: 3.0)
2800 # Features:
2801 # @dynamic-auto-read-only: If present, enabled auto-read-only means that the
2802 #                          driver will open the image read-only at first,
2803 #                          dynamically reopen the image file read-write when
2804 #                          the first writer is attached to the node and reopen
2805 #                          read-only when the last writer is detached. This
2806 #                          allows giving QEMU write permissions only on demand
2807 #                          when an operation actually needs write access.
2809 # Since: 2.9
2811 { 'struct': 'BlockdevOptionsFile',
2812   'data': { 'filename': 'str',
2813             '*pr-manager': 'str',
2814             '*locking': 'OnOffAuto',
2815             '*aio': 'BlockdevAioOptions',
2816             '*drop-cache': {'type': 'bool',
2817                             'if': 'defined(CONFIG_LINUX)'},
2818             '*x-check-cache-dropped': 'bool' },
2819   'features': [ { 'name': 'dynamic-auto-read-only',
2820                   'if': 'defined(CONFIG_POSIX)' } ] }
2823 # @BlockdevOptionsNull:
2825 # Driver specific block device options for the null backend.
2827 # @size: size of the device in bytes.
2828 # @latency-ns: emulated latency (in nanoseconds) in processing
2829 #              requests. Default to zero which completes requests immediately.
2830 #              (Since 2.4)
2831 # @read-zeroes: if true, reads from the device produce zeroes; if false, the
2832 #               buffer is left unchanged. (default: false; since: 4.1)
2834 # Since: 2.9
2836 { 'struct': 'BlockdevOptionsNull',
2837   'data': { '*size': 'int', '*latency-ns': 'uint64', '*read-zeroes': 'bool' } }
2840 # @BlockdevOptionsNVMe:
2842 # Driver specific block device options for the NVMe backend.
2844 # @device: PCI controller address of the NVMe device in
2845 #          format hhhh:bb:ss.f (host:bus:slot.function)
2846 # @namespace: namespace number of the device, starting from 1.
2848 # Note that the PCI @device must have been unbound from any host
2849 # kernel driver before instructing QEMU to add the blockdev.
2851 # Since: 2.12
2853 { 'struct': 'BlockdevOptionsNVMe',
2854   'data': { 'device': 'str', 'namespace': 'int' } }
2857 # @BlockdevOptionsVVFAT:
2859 # Driver specific block device options for the vvfat protocol.
2861 # @dir: directory to be exported as FAT image
2862 # @fat-type: FAT type: 12, 16 or 32
2863 # @floppy: whether to export a floppy image (true) or
2864 #          partitioned hard disk (false; default)
2865 # @label: set the volume label, limited to 11 bytes. FAT16 and
2866 #         FAT32 traditionally have some restrictions on labels, which are
2867 #         ignored by most operating systems. Defaults to "QEMU VVFAT".
2868 #         (since 2.4)
2869 # @rw: whether to allow write operations (default: false)
2871 # Since: 2.9
2873 { 'struct': 'BlockdevOptionsVVFAT',
2874   'data': { 'dir': 'str', '*fat-type': 'int', '*floppy': 'bool',
2875             '*label': 'str', '*rw': 'bool' } }
2878 # @BlockdevOptionsGenericFormat:
2880 # Driver specific block device options for image format that have no option
2881 # besides their data source.
2883 # @file: reference to or definition of the data source block device
2885 # Since: 2.9
2887 { 'struct': 'BlockdevOptionsGenericFormat',
2888   'data': { 'file': 'BlockdevRef' } }
2891 # @BlockdevOptionsLUKS:
2893 # Driver specific block device options for LUKS.
2895 # @key-secret: the ID of a QCryptoSecret object providing
2896 #              the decryption key (since 2.6). Mandatory except when
2897 #              doing a metadata-only probe of the image.
2899 # Since: 2.9
2901 { 'struct': 'BlockdevOptionsLUKS',
2902   'base': 'BlockdevOptionsGenericFormat',
2903   'data': { '*key-secret': 'str' } }
2907 # @BlockdevOptionsGenericCOWFormat:
2909 # Driver specific block device options for image format that have no option
2910 # besides their data source and an optional backing file.
2912 # @backing: reference to or definition of the backing file block
2913 #           device, null disables the backing file entirely.
2914 #           Defaults to the backing file stored the image file.
2916 # Since: 2.9
2918 { 'struct': 'BlockdevOptionsGenericCOWFormat',
2919   'base': 'BlockdevOptionsGenericFormat',
2920   'data': { '*backing': 'BlockdevRefOrNull' } }
2923 # @Qcow2OverlapCheckMode:
2925 # General overlap check modes.
2927 # @none: Do not perform any checks
2929 # @constant: Perform only checks which can be done in constant time and
2930 #            without reading anything from disk
2932 # @cached: Perform only checks which can be done without reading anything
2933 #          from disk
2935 # @all: Perform all available overlap checks
2937 # Since: 2.9
2939 { 'enum': 'Qcow2OverlapCheckMode',
2940   'data': [ 'none', 'constant', 'cached', 'all' ] }
2943 # @Qcow2OverlapCheckFlags:
2945 # Structure of flags for each metadata structure. Setting a field to 'true'
2946 # makes qemu guard that structure against unintended overwriting. The default
2947 # value is chosen according to the template given.
2949 # @template: Specifies a template mode which can be adjusted using the other
2950 #            flags, defaults to 'cached'
2952 # @bitmap-directory: since 3.0
2954 # Since: 2.9
2956 { 'struct': 'Qcow2OverlapCheckFlags',
2957   'data': { '*template':         'Qcow2OverlapCheckMode',
2958             '*main-header':      'bool',
2959             '*active-l1':        'bool',
2960             '*active-l2':        'bool',
2961             '*refcount-table':   'bool',
2962             '*refcount-block':   'bool',
2963             '*snapshot-table':   'bool',
2964             '*inactive-l1':      'bool',
2965             '*inactive-l2':      'bool',
2966             '*bitmap-directory': 'bool' } }
2969 # @Qcow2OverlapChecks:
2971 # Specifies which metadata structures should be guarded against unintended
2972 # overwriting.
2974 # @flags: set of flags for separate specification of each metadata structure
2975 #         type
2977 # @mode: named mode which chooses a specific set of flags
2979 # Since: 2.9
2981 { 'alternate': 'Qcow2OverlapChecks',
2982   'data': { 'flags': 'Qcow2OverlapCheckFlags',
2983             'mode':  'Qcow2OverlapCheckMode' } }
2986 # @BlockdevQcowEncryptionFormat:
2988 # @aes: AES-CBC with plain64 initialization vectors
2990 # Since: 2.10
2992 { 'enum': 'BlockdevQcowEncryptionFormat',
2993   'data': [ 'aes' ] }
2996 # @BlockdevQcowEncryption:
2998 # Since: 2.10
3000 { 'union': 'BlockdevQcowEncryption',
3001   'base': { 'format': 'BlockdevQcowEncryptionFormat' },
3002   'discriminator': 'format',
3003   'data': { 'aes': 'QCryptoBlockOptionsQCow' } }
3006 # @BlockdevOptionsQcow:
3008 # Driver specific block device options for qcow.
3010 # @encrypt: Image decryption options. Mandatory for
3011 #           encrypted images, except when doing a metadata-only
3012 #           probe of the image.
3014 # Since: 2.10
3016 { 'struct': 'BlockdevOptionsQcow',
3017   'base': 'BlockdevOptionsGenericCOWFormat',
3018   'data': { '*encrypt': 'BlockdevQcowEncryption' } }
3023 # @BlockdevQcow2EncryptionFormat:
3024 # @aes: AES-CBC with plain64 initialization vectors
3026 # Since: 2.10
3028 { 'enum': 'BlockdevQcow2EncryptionFormat',
3029   'data': [ 'aes', 'luks' ] }
3032 # @BlockdevQcow2Encryption:
3034 # Since: 2.10
3036 { 'union': 'BlockdevQcow2Encryption',
3037   'base': { 'format': 'BlockdevQcow2EncryptionFormat' },
3038   'discriminator': 'format',
3039   'data': { 'aes': 'QCryptoBlockOptionsQCow',
3040             'luks': 'QCryptoBlockOptionsLUKS'} }
3043 # @BlockdevOptionsQcow2:
3045 # Driver specific block device options for qcow2.
3047 # @lazy-refcounts: whether to enable the lazy refcounts
3048 #                  feature (default is taken from the image file)
3050 # @pass-discard-request: whether discard requests to the qcow2
3051 #                        device should be forwarded to the data source
3053 # @pass-discard-snapshot: whether discard requests for the data source
3054 #                         should be issued when a snapshot operation (e.g.
3055 #                         deleting a snapshot) frees clusters in the qcow2 file
3057 # @pass-discard-other: whether discard requests for the data source
3058 #                      should be issued on other occasions where a cluster
3059 #                      gets freed
3061 # @overlap-check: which overlap checks to perform for writes
3062 #                 to the image, defaults to 'cached' (since 2.2)
3064 # @cache-size: the maximum total size of the L2 table and
3065 #              refcount block caches in bytes (since 2.2)
3067 # @l2-cache-size: the maximum size of the L2 table cache in
3068 #                 bytes (since 2.2)
3070 # @l2-cache-entry-size: the size of each entry in the L2 cache in
3071 #                       bytes. It must be a power of two between 512
3072 #                       and the cluster size. The default value is
3073 #                       the cluster size (since 2.12)
3075 # @refcount-cache-size: the maximum size of the refcount block cache
3076 #                       in bytes (since 2.2)
3078 # @cache-clean-interval: clean unused entries in the L2 and refcount
3079 #                        caches. The interval is in seconds. The default value
3080 #                        is 600 on supporting platforms, and 0 on other
3081 #                        platforms. 0 disables this feature. (since 2.5)
3083 # @encrypt: Image decryption options. Mandatory for
3084 #           encrypted images, except when doing a metadata-only
3085 #           probe of the image. (since 2.10)
3087 # @data-file: reference to or definition of the external data file.
3088 #             This may only be specified for images that require an
3089 #             external data file. If it is not specified for such
3090 #             an image, the data file name is loaded from the image
3091 #             file. (since 4.0)
3093 # Since: 2.9
3095 { 'struct': 'BlockdevOptionsQcow2',
3096   'base': 'BlockdevOptionsGenericCOWFormat',
3097   'data': { '*lazy-refcounts': 'bool',
3098             '*pass-discard-request': 'bool',
3099             '*pass-discard-snapshot': 'bool',
3100             '*pass-discard-other': 'bool',
3101             '*overlap-check': 'Qcow2OverlapChecks',
3102             '*cache-size': 'int',
3103             '*l2-cache-size': 'int',
3104             '*l2-cache-entry-size': 'int',
3105             '*refcount-cache-size': 'int',
3106             '*cache-clean-interval': 'int',
3107             '*encrypt': 'BlockdevQcow2Encryption',
3108             '*data-file': 'BlockdevRef' } }
3111 # @SshHostKeyCheckMode:
3113 # @none: Don't check the host key at all
3114 # @hash: Compare the host key with a given hash
3115 # @known_hosts: Check the host key against the known_hosts file
3117 # Since: 2.12
3119 { 'enum': 'SshHostKeyCheckMode',
3120   'data': [ 'none', 'hash', 'known_hosts' ] }
3123 # @SshHostKeyCheckHashType:
3125 # @md5: The given hash is an md5 hash
3126 # @sha1: The given hash is an sha1 hash
3128 # Since: 2.12
3130 { 'enum': 'SshHostKeyCheckHashType',
3131   'data': [ 'md5', 'sha1' ] }
3134 # @SshHostKeyHash:
3136 # @type: The hash algorithm used for the hash
3137 # @hash: The expected hash value
3139 # Since: 2.12
3141 { 'struct': 'SshHostKeyHash',
3142   'data': { 'type': 'SshHostKeyCheckHashType',
3143             'hash': 'str' }}
3146 # @SshHostKeyCheck:
3148 # Since: 2.12
3150 { 'union': 'SshHostKeyCheck',
3151   'base': { 'mode': 'SshHostKeyCheckMode' },
3152   'discriminator': 'mode',
3153   'data': { 'hash': 'SshHostKeyHash' } }
3156 # @BlockdevOptionsSsh:
3158 # @server:              host address
3160 # @path:                path to the image on the host
3162 # @user:                user as which to connect, defaults to current
3163 #                       local user name
3165 # @host-key-check:      Defines how and what to check the host key against
3166 #                       (default: known_hosts)
3168 # Since: 2.9
3170 { 'struct': 'BlockdevOptionsSsh',
3171   'data': { 'server': 'InetSocketAddress',
3172             'path': 'str',
3173             '*user': 'str',
3174             '*host-key-check': 'SshHostKeyCheck' } }
3178 # @BlkdebugEvent:
3180 # Trigger events supported by blkdebug.
3182 # @l1_shrink_write_table: write zeros to the l1 table to shrink image.
3183 #                         (since 2.11)
3185 # @l1_shrink_free_l2_clusters: discard the l2 tables. (since 2.11)
3187 # @cor_write: a write due to copy-on-read (since 2.11)
3189 # @cluster_alloc_space: an allocation of file space for a cluster (since 4.1)
3191 # @none: triggers once at creation of the blkdebug node (since 4.1)
3193 # Since: 2.9
3195 { 'enum': 'BlkdebugEvent', 'prefix': 'BLKDBG',
3196   'data': [ 'l1_update', 'l1_grow_alloc_table', 'l1_grow_write_table',
3197             'l1_grow_activate_table', 'l2_load', 'l2_update',
3198             'l2_update_compressed', 'l2_alloc_cow_read', 'l2_alloc_write',
3199             'read_aio', 'read_backing_aio', 'read_compressed', 'write_aio',
3200             'write_compressed', 'vmstate_load', 'vmstate_save', 'cow_read',
3201             'cow_write', 'reftable_load', 'reftable_grow', 'reftable_update',
3202             'refblock_load', 'refblock_update', 'refblock_update_part',
3203             'refblock_alloc', 'refblock_alloc_hookup', 'refblock_alloc_write',
3204             'refblock_alloc_write_blocks', 'refblock_alloc_write_table',
3205             'refblock_alloc_switch_table', 'cluster_alloc',
3206             'cluster_alloc_bytes', 'cluster_free', 'flush_to_os',
3207             'flush_to_disk', 'pwritev_rmw_head', 'pwritev_rmw_after_head',
3208             'pwritev_rmw_tail', 'pwritev_rmw_after_tail', 'pwritev',
3209             'pwritev_zero', 'pwritev_done', 'empty_image_prepare',
3210             'l1_shrink_write_table', 'l1_shrink_free_l2_clusters',
3211             'cor_write', 'cluster_alloc_space', 'none'] }
3214 # @BlkdebugIOType:
3216 # Kinds of I/O that blkdebug can inject errors in.
3218 # @read: .bdrv_co_preadv()
3220 # @write: .bdrv_co_pwritev()
3222 # @write-zeroes: .bdrv_co_pwrite_zeroes()
3224 # @discard: .bdrv_co_pdiscard()
3226 # @flush: .bdrv_co_flush_to_disk()
3228 # @block-status: .bdrv_co_block_status()
3230 # Since: 4.1
3232 { 'enum': 'BlkdebugIOType', 'prefix': 'BLKDEBUG_IO_TYPE',
3233   'data': [ 'read', 'write', 'write-zeroes', 'discard', 'flush',
3234             'block-status' ] }
3237 # @BlkdebugInjectErrorOptions:
3239 # Describes a single error injection for blkdebug.
3241 # @event: trigger event
3243 # @state: the state identifier blkdebug needs to be in to
3244 #         actually trigger the event; defaults to "any"
3246 # @iotype: the type of I/O operations on which this error should
3247 #          be injected; defaults to "all read, write,
3248 #          write-zeroes, discard, and flush operations"
3249 #          (since: 4.1)
3251 # @errno: error identifier (errno) to be returned; defaults to
3252 #         EIO
3254 # @sector: specifies the sector index which has to be affected
3255 #          in order to actually trigger the event; defaults to "any
3256 #          sector"
3258 # @once: disables further events after this one has been
3259 #        triggered; defaults to false
3261 # @immediately: fail immediately; defaults to false
3263 # Since: 2.9
3265 { 'struct': 'BlkdebugInjectErrorOptions',
3266   'data': { 'event': 'BlkdebugEvent',
3267             '*state': 'int',
3268             '*iotype': 'BlkdebugIOType',
3269             '*errno': 'int',
3270             '*sector': 'int',
3271             '*once': 'bool',
3272             '*immediately': 'bool' } }
3275 # @BlkdebugSetStateOptions:
3277 # Describes a single state-change event for blkdebug.
3279 # @event: trigger event
3281 # @state: the current state identifier blkdebug needs to be in;
3282 #         defaults to "any"
3284 # @new_state: the state identifier blkdebug is supposed to assume if
3285 #             this event is triggered
3287 # Since: 2.9
3289 { 'struct': 'BlkdebugSetStateOptions',
3290   'data': { 'event': 'BlkdebugEvent',
3291             '*state': 'int',
3292             'new_state': 'int' } }
3295 # @BlockdevOptionsBlkdebug:
3297 # Driver specific block device options for blkdebug.
3299 # @image: underlying raw block device (or image file)
3301 # @config: filename of the configuration file
3303 # @align: required alignment for requests in bytes, must be
3304 #         positive power of 2, or 0 for default
3306 # @max-transfer: maximum size for I/O transfers in bytes, must be
3307 #                positive multiple of @align and of the underlying
3308 #                file's request alignment (but need not be a power of
3309 #                2), or 0 for default (since 2.10)
3311 # @opt-write-zero: preferred alignment for write zero requests in bytes,
3312 #                  must be positive multiple of @align and of the
3313 #                  underlying file's request alignment (but need not be a
3314 #                  power of 2), or 0 for default (since 2.10)
3316 # @max-write-zero: maximum size for write zero requests in bytes, must be
3317 #                  positive multiple of @align, of @opt-write-zero, and of
3318 #                  the underlying file's request alignment (but need not
3319 #                  be a power of 2), or 0 for default (since 2.10)
3321 # @opt-discard: preferred alignment for discard requests in bytes, must
3322 #               be positive multiple of @align and of the underlying
3323 #               file's request alignment (but need not be a power of
3324 #               2), or 0 for default (since 2.10)
3326 # @max-discard: maximum size for discard requests in bytes, must be
3327 #               positive multiple of @align, of @opt-discard, and of
3328 #               the underlying file's request alignment (but need not
3329 #               be a power of 2), or 0 for default (since 2.10)
3331 # @inject-error: array of error injection descriptions
3333 # @set-state: array of state-change descriptions
3335 # @take-child-perms: Permissions to take on @image in addition to what
3336 #                    is necessary anyway (which depends on how the
3337 #                    blkdebug node is used).  Defaults to none.
3338 #                    (since 5.0)
3340 # @unshare-child-perms: Permissions not to share on @image in addition
3341 #                       to what cannot be shared anyway (which depends
3342 #                       on how the blkdebug node is used).  Defaults
3343 #                       to none.  (since 5.0)
3345 # Since: 2.9
3347 { 'struct': 'BlockdevOptionsBlkdebug',
3348   'data': { 'image': 'BlockdevRef',
3349             '*config': 'str',
3350             '*align': 'int', '*max-transfer': 'int32',
3351             '*opt-write-zero': 'int32', '*max-write-zero': 'int32',
3352             '*opt-discard': 'int32', '*max-discard': 'int32',
3353             '*inject-error': ['BlkdebugInjectErrorOptions'],
3354             '*set-state': ['BlkdebugSetStateOptions'],
3355             '*take-child-perms': ['BlockPermission'],
3356             '*unshare-child-perms': ['BlockPermission'] } }
3359 # @BlockdevOptionsBlklogwrites:
3361 # Driver specific block device options for blklogwrites.
3363 # @file: block device
3365 # @log: block device used to log writes to @file
3367 # @log-sector-size: sector size used in logging writes to @file, determines
3368 #                   granularity of offsets and sizes of writes (default: 512)
3370 # @log-append: append to an existing log (default: false)
3372 # @log-super-update-interval: interval of write requests after which the log
3373 #                             super block is updated to disk (default: 4096)
3375 # Since: 3.0
3377 { 'struct': 'BlockdevOptionsBlklogwrites',
3378   'data': { 'file': 'BlockdevRef',
3379             'log': 'BlockdevRef',
3380             '*log-sector-size': 'uint32',
3381             '*log-append': 'bool',
3382             '*log-super-update-interval': 'uint64' } }
3385 # @BlockdevOptionsBlkverify:
3387 # Driver specific block device options for blkverify.
3389 # @test: block device to be tested
3391 # @raw: raw image used for verification
3393 # Since: 2.9
3395 { 'struct': 'BlockdevOptionsBlkverify',
3396   'data': { 'test': 'BlockdevRef',
3397             'raw': 'BlockdevRef' } }
3400 # @BlockdevOptionsBlkreplay:
3402 # Driver specific block device options for blkreplay.
3404 # @image: disk image which should be controlled with blkreplay
3406 # Since: 4.2
3408 { 'struct': 'BlockdevOptionsBlkreplay',
3409   'data': { 'image': 'BlockdevRef' } }
3412 # @QuorumReadPattern:
3414 # An enumeration of quorum read patterns.
3416 # @quorum: read all the children and do a quorum vote on reads
3418 # @fifo: read only from the first child that has not failed
3420 # Since: 2.9
3422 { 'enum': 'QuorumReadPattern', 'data': [ 'quorum', 'fifo' ] }
3425 # @BlockdevOptionsQuorum:
3427 # Driver specific block device options for Quorum
3429 # @blkverify: true if the driver must print content mismatch
3430 #                  set to false by default
3432 # @children: the children block devices to use
3434 # @vote-threshold: the vote limit under which a read will fail
3436 # @rewrite-corrupted: rewrite corrupted data when quorum is reached
3437 #                     (Since 2.1)
3439 # @read-pattern: choose read pattern and set to quorum by default
3440 #                (Since 2.2)
3442 # Since: 2.9
3444 { 'struct': 'BlockdevOptionsQuorum',
3445   'data': { '*blkverify': 'bool',
3446             'children': [ 'BlockdevRef' ],
3447             'vote-threshold': 'int',
3448             '*rewrite-corrupted': 'bool',
3449             '*read-pattern': 'QuorumReadPattern' } }
3452 # @BlockdevOptionsGluster:
3454 # Driver specific block device options for Gluster
3456 # @volume: name of gluster volume where VM image resides
3458 # @path: absolute path to image file in gluster volume
3460 # @server: gluster servers description
3462 # @debug: libgfapi log level (default '4' which is Error)
3463 #         (Since 2.8)
3465 # @logfile: libgfapi log file (default /dev/stderr) (Since 2.8)
3467 # Since: 2.9
3469 { 'struct': 'BlockdevOptionsGluster',
3470   'data': { 'volume': 'str',
3471             'path': 'str',
3472             'server': ['SocketAddress'],
3473             '*debug': 'int',
3474             '*logfile': 'str' } }
3477 # @IscsiTransport:
3479 # An enumeration of libiscsi transport types
3481 # Since: 2.9
3483 { 'enum': 'IscsiTransport',
3484   'data': [ 'tcp', 'iser' ] }
3487 # @IscsiHeaderDigest:
3489 # An enumeration of header digests supported by libiscsi
3491 # Since: 2.9
3493 { 'enum': 'IscsiHeaderDigest',
3494   'prefix': 'QAPI_ISCSI_HEADER_DIGEST',
3495   'data': [ 'crc32c', 'none', 'crc32c-none', 'none-crc32c' ] }
3498 # @BlockdevOptionsIscsi:
3500 # @transport: The iscsi transport type
3502 # @portal: The address of the iscsi portal
3504 # @target: The target iqn name
3506 # @lun: LUN to connect to. Defaults to 0.
3508 # @user: User name to log in with. If omitted, no CHAP
3509 #        authentication is performed.
3511 # @password-secret: The ID of a QCryptoSecret object providing
3512 #                   the password for the login. This option is required if
3513 #                   @user is specified.
3515 # @initiator-name: The iqn name we want to identify to the target
3516 #                  as. If this option is not specified, an initiator name is
3517 #                  generated automatically.
3519 # @header-digest: The desired header digest. Defaults to
3520 #                 none-crc32c.
3522 # @timeout: Timeout in seconds after which a request will
3523 #           timeout. 0 means no timeout and is the default.
3525 # Driver specific block device options for iscsi
3527 # Since: 2.9
3529 { 'struct': 'BlockdevOptionsIscsi',
3530   'data': { 'transport': 'IscsiTransport',
3531             'portal': 'str',
3532             'target': 'str',
3533             '*lun': 'int',
3534             '*user': 'str',
3535             '*password-secret': 'str',
3536             '*initiator-name': 'str',
3537             '*header-digest': 'IscsiHeaderDigest',
3538             '*timeout': 'int' } }
3542 # @RbdAuthMode:
3544 # Since: 3.0
3546 { 'enum': 'RbdAuthMode',
3547   'data': [ 'cephx', 'none' ] }
3550 # @BlockdevOptionsRbd:
3552 # @pool: Ceph pool name.
3554 # @namespace: Rados namespace name in the Ceph pool. (Since 5.0)
3556 # @image: Image name in the Ceph pool.
3558 # @conf: path to Ceph configuration file.  Values
3559 #        in the configuration file will be overridden by
3560 #        options specified via QAPI.
3562 # @snapshot: Ceph snapshot name.
3564 # @user: Ceph id name.
3566 # @auth-client-required: Acceptable authentication modes.
3567 #                        This maps to Ceph configuration option
3568 #                        "auth_client_required".  (Since 3.0)
3570 # @key-secret: ID of a QCryptoSecret object providing a key
3571 #              for cephx authentication.
3572 #              This maps to Ceph configuration option
3573 #              "key".  (Since 3.0)
3575 # @server: Monitor host address and port.  This maps
3576 #          to the "mon_host" Ceph option.
3578 # Since: 2.9
3580 { 'struct': 'BlockdevOptionsRbd',
3581   'data': { 'pool': 'str',
3582             '*namespace': 'str',
3583             'image': 'str',
3584             '*conf': 'str',
3585             '*snapshot': 'str',
3586             '*user': 'str',
3587             '*auth-client-required': ['RbdAuthMode'],
3588             '*key-secret': 'str',
3589             '*server': ['InetSocketAddressBase'] } }
3592 # @BlockdevOptionsSheepdog:
3594 # Driver specific block device options for sheepdog
3596 # @vdi: Virtual disk image name
3597 # @server: The Sheepdog server to connect to
3598 # @snap-id: Snapshot ID
3599 # @tag: Snapshot tag name
3601 # Only one of @snap-id and @tag may be present.
3603 # Since: 2.9
3605 { 'struct': 'BlockdevOptionsSheepdog',
3606   'data': { 'server': 'SocketAddress',
3607             'vdi': 'str',
3608             '*snap-id': 'uint32',
3609             '*tag': 'str' } }
3612 # @ReplicationMode:
3614 # An enumeration of replication modes.
3616 # @primary: Primary mode, the vm's state will be sent to secondary QEMU.
3618 # @secondary: Secondary mode, receive the vm's state from primary QEMU.
3620 # Since: 2.9
3622 { 'enum' : 'ReplicationMode', 'data' : [ 'primary', 'secondary' ],
3623   'if': 'defined(CONFIG_REPLICATION)' }
3626 # @BlockdevOptionsReplication:
3628 # Driver specific block device options for replication
3630 # @mode: the replication mode
3632 # @top-id: In secondary mode, node name or device ID of the root
3633 #          node who owns the replication node chain. Must not be given in
3634 #          primary mode.
3636 # Since: 2.9
3638 { 'struct': 'BlockdevOptionsReplication',
3639   'base': 'BlockdevOptionsGenericFormat',
3640   'data': { 'mode': 'ReplicationMode',
3641             '*top-id': 'str' },
3642   'if': 'defined(CONFIG_REPLICATION)' }
3645 # @NFSTransport:
3647 # An enumeration of NFS transport types
3649 # @inet: TCP transport
3651 # Since: 2.9
3653 { 'enum': 'NFSTransport',
3654   'data': [ 'inet' ] }
3657 # @NFSServer:
3659 # Captures the address of the socket
3661 # @type: transport type used for NFS (only TCP supported)
3663 # @host: host address for NFS server
3665 # Since: 2.9
3667 { 'struct': 'NFSServer',
3668   'data': { 'type': 'NFSTransport',
3669             'host': 'str' } }
3672 # @BlockdevOptionsNfs:
3674 # Driver specific block device option for NFS
3676 # @server: host address
3678 # @path: path of the image on the host
3680 # @user: UID value to use when talking to the
3681 #        server (defaults to 65534 on Windows and getuid()
3682 #        on unix)
3684 # @group: GID value to use when talking to the
3685 #         server (defaults to 65534 on Windows and getgid()
3686 #         in unix)
3688 # @tcp-syn-count: number of SYNs during the session
3689 #                 establishment (defaults to libnfs default)
3691 # @readahead-size: set the readahead size in bytes (defaults
3692 #                  to libnfs default)
3694 # @page-cache-size: set the pagecache size in bytes (defaults
3695 #                   to libnfs default)
3697 # @debug: set the NFS debug level (max 2) (defaults
3698 #         to libnfs default)
3700 # Since: 2.9
3702 { 'struct': 'BlockdevOptionsNfs',
3703   'data': { 'server': 'NFSServer',
3704             'path': 'str',
3705             '*user': 'int',
3706             '*group': 'int',
3707             '*tcp-syn-count': 'int',
3708             '*readahead-size': 'int',
3709             '*page-cache-size': 'int',
3710             '*debug': 'int' } }
3713 # @BlockdevOptionsCurlBase:
3715 # Driver specific block device options shared by all protocols supported by the
3716 # curl backend.
3718 # @url: URL of the image file
3720 # @readahead: Size of the read-ahead cache; must be a multiple of
3721 #             512 (defaults to 256 kB)
3723 # @timeout: Timeout for connections, in seconds (defaults to 5)
3725 # @username: Username for authentication (defaults to none)
3727 # @password-secret: ID of a QCryptoSecret object providing a password
3728 #                   for authentication (defaults to no password)
3730 # @proxy-username: Username for proxy authentication (defaults to none)
3732 # @proxy-password-secret: ID of a QCryptoSecret object providing a password
3733 #                         for proxy authentication (defaults to no password)
3735 # Since: 2.9
3737 { 'struct': 'BlockdevOptionsCurlBase',
3738   'data': { 'url': 'str',
3739             '*readahead': 'int',
3740             '*timeout': 'int',
3741             '*username': 'str',
3742             '*password-secret': 'str',
3743             '*proxy-username': 'str',
3744             '*proxy-password-secret': 'str' } }
3747 # @BlockdevOptionsCurlHttp:
3749 # Driver specific block device options for HTTP connections over the curl
3750 # backend.  URLs must start with "http://".
3752 # @cookie: List of cookies to set; format is
3753 #          "name1=content1; name2=content2;" as explained by
3754 #          CURLOPT_COOKIE(3). Defaults to no cookies.
3756 # @cookie-secret: ID of a QCryptoSecret object providing the cookie data in a
3757 #                 secure way. See @cookie for the format. (since 2.10)
3759 # Since: 2.9
3761 { 'struct': 'BlockdevOptionsCurlHttp',
3762   'base': 'BlockdevOptionsCurlBase',
3763   'data': { '*cookie': 'str',
3764             '*cookie-secret': 'str'} }
3767 # @BlockdevOptionsCurlHttps:
3769 # Driver specific block device options for HTTPS connections over the curl
3770 # backend.  URLs must start with "https://".
3772 # @cookie: List of cookies to set; format is
3773 #          "name1=content1; name2=content2;" as explained by
3774 #          CURLOPT_COOKIE(3). Defaults to no cookies.
3776 # @sslverify: Whether to verify the SSL certificate's validity (defaults to
3777 #             true)
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': 'BlockdevOptionsCurlHttps',
3785   'base': 'BlockdevOptionsCurlBase',
3786   'data': { '*cookie': 'str',
3787             '*sslverify': 'bool',
3788             '*cookie-secret': 'str'} }
3791 # @BlockdevOptionsCurlFtp:
3793 # Driver specific block device options for FTP connections over the curl
3794 # backend.  URLs must start with "ftp://".
3796 # Since: 2.9
3798 { 'struct': 'BlockdevOptionsCurlFtp',
3799   'base': 'BlockdevOptionsCurlBase',
3800   'data': { } }
3803 # @BlockdevOptionsCurlFtps:
3805 # Driver specific block device options for FTPS connections over the curl
3806 # backend.  URLs must start with "ftps://".
3808 # @sslverify: Whether to verify the SSL certificate's validity (defaults to
3809 #             true)
3811 # Since: 2.9
3813 { 'struct': 'BlockdevOptionsCurlFtps',
3814   'base': 'BlockdevOptionsCurlBase',
3815   'data': { '*sslverify': 'bool' } }
3818 # @BlockdevOptionsNbd:
3820 # Driver specific block device options for NBD.
3822 # @server: NBD server address
3824 # @export: export name
3826 # @tls-creds: TLS credentials ID
3828 # @x-dirty-bitmap: A "qemu:dirty-bitmap:NAME" string to query in place of
3829 #                  traditional "base:allocation" block status (see
3830 #                  NBD_OPT_LIST_META_CONTEXT in the NBD protocol) (since 3.0)
3832 # @reconnect-delay: On an unexpected disconnect, the nbd client tries to
3833 #                   connect again until succeeding or encountering a serious
3834 #                   error.  During the first @reconnect-delay seconds, all
3835 #                   requests are paused and will be rerun on a successful
3836 #                   reconnect. After that time, any delayed requests and all
3837 #                   future requests before a successful reconnect will
3838 #                   immediately fail. Default 0 (Since 4.2)
3840 # Since: 2.9
3842 { 'struct': 'BlockdevOptionsNbd',
3843   'data': { 'server': 'SocketAddress',
3844             '*export': 'str',
3845             '*tls-creds': 'str',
3846             '*x-dirty-bitmap': 'str',
3847             '*reconnect-delay': 'uint32' } }
3850 # @BlockdevOptionsRaw:
3852 # Driver specific block device options for the raw driver.
3854 # @offset: position where the block device starts
3855 # @size: the assumed size of the device
3857 # Since: 2.9
3859 { 'struct': 'BlockdevOptionsRaw',
3860   'base': 'BlockdevOptionsGenericFormat',
3861   'data': { '*offset': 'int', '*size': 'int' } }
3864 # @BlockdevOptionsVxHS:
3866 # Driver specific block device options for VxHS
3868 # @vdisk-id: UUID of VxHS volume
3869 # @server: vxhs server IP, port
3870 # @tls-creds: TLS credentials ID
3872 # Since: 2.10
3874 { 'struct': 'BlockdevOptionsVxHS',
3875   'data': { 'vdisk-id': 'str',
3876             'server': 'InetSocketAddressBase',
3877             '*tls-creds': 'str' } }
3880 # @BlockdevOptionsThrottle:
3882 # Driver specific block device options for the throttle driver
3884 # @throttle-group: the name of the throttle-group object to use. It
3885 #                  must already exist.
3886 # @file: reference to or definition of the data source block device
3887 # Since: 2.11
3889 { 'struct': 'BlockdevOptionsThrottle',
3890   'data': { 'throttle-group': 'str',
3891             'file' : 'BlockdevRef'
3892              } }
3894 # @BlockdevOptions:
3896 # Options for creating a block device.  Many options are available for all
3897 # block devices, independent of the block driver:
3899 # @driver: block driver name
3900 # @node-name: the node name of the new node (Since 2.0).
3901 #             This option is required on the top level of blockdev-add.
3902 #             Valid node names start with an alphabetic character and may
3903 #             contain only alphanumeric characters, '-', '.' and '_'. Their
3904 #             maximum length is 31 characters.
3905 # @discard: discard-related options (default: ignore)
3906 # @cache: cache-related options
3907 # @read-only: whether the block device should be read-only (default: false).
3908 #             Note that some block drivers support only read-only access,
3909 #             either generally or in certain configurations. In this case,
3910 #             the default value does not work and the option must be
3911 #             specified explicitly.
3912 # @auto-read-only: if true and @read-only is false, QEMU may automatically
3913 #                  decide not to open the image read-write as requested, but
3914 #                  fall back to read-only instead (and switch between the modes
3915 #                  later), e.g. depending on whether the image file is writable
3916 #                  or whether a writing user is attached to the node
3917 #                  (default: false, since 3.1)
3918 # @detect-zeroes: detect and optimize zero writes (Since 2.1)
3919 #                 (default: off)
3920 # @force-share: force share all permission on added nodes.
3921 #               Requires read-only=true. (Since 2.10)
3923 # Remaining options are determined by the block driver.
3925 # Since: 2.9
3927 { 'union': 'BlockdevOptions',
3928   'base': { 'driver': 'BlockdevDriver',
3929             '*node-name': 'str',
3930             '*discard': 'BlockdevDiscardOptions',
3931             '*cache': 'BlockdevCacheOptions',
3932             '*read-only': 'bool',
3933             '*auto-read-only': 'bool',
3934             '*force-share': 'bool',
3935             '*detect-zeroes': 'BlockdevDetectZeroesOptions' },
3936   'discriminator': 'driver',
3937   'data': {
3938       'blkdebug':   'BlockdevOptionsBlkdebug',
3939       'blklogwrites':'BlockdevOptionsBlklogwrites',
3940       'blkverify':  'BlockdevOptionsBlkverify',
3941       'blkreplay':  'BlockdevOptionsBlkreplay',
3942       'bochs':      'BlockdevOptionsGenericFormat',
3943       'cloop':      'BlockdevOptionsGenericFormat',
3944       'compress':   'BlockdevOptionsGenericFormat',
3945       'copy-on-read':'BlockdevOptionsGenericFormat',
3946       'dmg':        'BlockdevOptionsGenericFormat',
3947       'file':       'BlockdevOptionsFile',
3948       'ftp':        'BlockdevOptionsCurlFtp',
3949       'ftps':       'BlockdevOptionsCurlFtps',
3950       'gluster':    'BlockdevOptionsGluster',
3951       'host_cdrom': 'BlockdevOptionsFile',
3952       'host_device':'BlockdevOptionsFile',
3953       'http':       'BlockdevOptionsCurlHttp',
3954       'https':      'BlockdevOptionsCurlHttps',
3955       'iscsi':      'BlockdevOptionsIscsi',
3956       'luks':       'BlockdevOptionsLUKS',
3957       'nbd':        'BlockdevOptionsNbd',
3958       'nfs':        'BlockdevOptionsNfs',
3959       'null-aio':   'BlockdevOptionsNull',
3960       'null-co':    'BlockdevOptionsNull',
3961       'nvme':       'BlockdevOptionsNVMe',
3962       'parallels':  'BlockdevOptionsGenericFormat',
3963       'qcow2':      'BlockdevOptionsQcow2',
3964       'qcow':       'BlockdevOptionsQcow',
3965       'qed':        'BlockdevOptionsGenericCOWFormat',
3966       'quorum':     'BlockdevOptionsQuorum',
3967       'raw':        'BlockdevOptionsRaw',
3968       'rbd':        'BlockdevOptionsRbd',
3969       'replication': { 'type': 'BlockdevOptionsReplication',
3970                        'if': 'defined(CONFIG_REPLICATION)' },
3971       'sheepdog':   'BlockdevOptionsSheepdog',
3972       'ssh':        'BlockdevOptionsSsh',
3973       'throttle':   'BlockdevOptionsThrottle',
3974       'vdi':        'BlockdevOptionsGenericFormat',
3975       'vhdx':       'BlockdevOptionsGenericFormat',
3976       'vmdk':       'BlockdevOptionsGenericCOWFormat',
3977       'vpc':        'BlockdevOptionsGenericFormat',
3978       'vvfat':      'BlockdevOptionsVVFAT',
3979       'vxhs':       'BlockdevOptionsVxHS'
3980   } }
3983 # @BlockdevRef:
3985 # Reference to a block device.
3987 # @definition: defines a new block device inline
3988 # @reference: references the ID of an existing block device
3990 # Since: 2.9
3992 { 'alternate': 'BlockdevRef',
3993   'data': { 'definition': 'BlockdevOptions',
3994             'reference': 'str' } }
3997 # @BlockdevRefOrNull:
3999 # Reference to a block device.
4001 # @definition: defines a new block device inline
4002 # @reference: references the ID of an existing block device.
4003 #             An empty string means that no block device should
4004 #             be referenced.  Deprecated; use null instead.
4005 # @null: No block device should be referenced (since 2.10)
4007 # Since: 2.9
4009 { 'alternate': 'BlockdevRefOrNull',
4010   'data': { 'definition': 'BlockdevOptions',
4011             'reference': 'str',
4012             'null': 'null' } }
4015 # @blockdev-add:
4017 # Creates a new block device. If the @id option is given at the top level, a
4018 # BlockBackend will be created; otherwise, @node-name is mandatory at the top
4019 # level and no BlockBackend will be created.
4021 # Since: 2.9
4023 # Example:
4025 # 1.
4026 # -> { "execute": "blockdev-add",
4027 #      "arguments": {
4028 #           "driver": "qcow2",
4029 #           "node-name": "test1",
4030 #           "file": {
4031 #               "driver": "file",
4032 #               "filename": "test.qcow2"
4033 #            }
4034 #       }
4035 #     }
4036 # <- { "return": {} }
4038 # 2.
4039 # -> { "execute": "blockdev-add",
4040 #      "arguments": {
4041 #           "driver": "qcow2",
4042 #           "node-name": "node0",
4043 #           "discard": "unmap",
4044 #           "cache": {
4045 #              "direct": true
4046 #            },
4047 #            "file": {
4048 #              "driver": "file",
4049 #              "filename": "/tmp/test.qcow2"
4050 #            },
4051 #            "backing": {
4052 #               "driver": "raw",
4053 #               "file": {
4054 #                  "driver": "file",
4055 #                  "filename": "/dev/fdset/4"
4056 #                }
4057 #            }
4058 #        }
4059 #      }
4061 # <- { "return": {} }
4064 { 'command': 'blockdev-add', 'data': 'BlockdevOptions', 'boxed': true }
4067 # @x-blockdev-reopen:
4069 # Reopens a block device using the given set of options. Any option
4070 # not specified will be reset to its default value regardless of its
4071 # previous status. If an option cannot be changed or a particular
4072 # driver does not support reopening then the command will return an
4073 # error.
4075 # The top-level @node-name option (from BlockdevOptions) must be
4076 # specified and is used to select the block device to be reopened.
4077 # Other @node-name options must be either omitted or set to the
4078 # current name of the appropriate node. This command won't change any
4079 # node name and any attempt to do it will result in an error.
4081 # In the case of options that refer to child nodes, the behavior of
4082 # this command depends on the value:
4084 #  1) A set of options (BlockdevOptions): the child is reopened with
4085 #     the specified set of options.
4087 #  2) A reference to the current child: the child is reopened using
4088 #     its existing set of options.
4090 #  3) A reference to a different node: the current child is replaced
4091 #     with the specified one.
4093 #  4) NULL: the current child (if any) is detached.
4095 # Options (1) and (2) are supported in all cases, but at the moment
4096 # only @backing allows replacing or detaching an existing child.
4098 # Unlike with blockdev-add, the @backing option must always be present
4099 # unless the node being reopened does not have a backing file and its
4100 # image does not have a default backing file name as part of its
4101 # metadata.
4103 # Since: 4.0
4105 { 'command': 'x-blockdev-reopen',
4106   'data': 'BlockdevOptions', 'boxed': true }
4109 # @blockdev-del:
4111 # Deletes a block device that has been added using blockdev-add.
4112 # The command will fail if the node is attached to a device or is
4113 # otherwise being used.
4115 # @node-name: Name of the graph node to delete.
4117 # Since: 2.9
4119 # Example:
4121 # -> { "execute": "blockdev-add",
4122 #      "arguments": {
4123 #           "driver": "qcow2",
4124 #           "node-name": "node0",
4125 #           "file": {
4126 #               "driver": "file",
4127 #               "filename": "test.qcow2"
4128 #           }
4129 #      }
4130 #    }
4131 # <- { "return": {} }
4133 # -> { "execute": "blockdev-del",
4134 #      "arguments": { "node-name": "node0" }
4135 #    }
4136 # <- { "return": {} }
4139 { 'command': 'blockdev-del', 'data': { 'node-name': 'str' } }
4142 # @BlockdevCreateOptionsFile:
4144 # Driver specific image creation options for file.
4146 # @filename: Filename for the new image file
4147 # @size: Size of the virtual disk in bytes
4148 # @preallocation: Preallocation mode for the new image (default: off;
4149 #                 allowed values: off,
4150 #                 falloc (if defined CONFIG_POSIX_FALLOCATE),
4151 #                 full (if defined CONFIG_POSIX))
4152 # @nocow: Turn off copy-on-write (valid only on btrfs; default: off)
4154 # Since: 2.12
4156 { 'struct': 'BlockdevCreateOptionsFile',
4157   'data': { 'filename':         'str',
4158             'size':             'size',
4159             '*preallocation':   'PreallocMode',
4160             '*nocow':           'bool' } }
4163 # @BlockdevCreateOptionsGluster:
4165 # Driver specific image creation options for gluster.
4167 # @location: Where to store 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_GLUSTERFS_FALLOCATE),
4172 #                 full (if defined CONFIG_GLUSTERFS_ZEROFILL))
4174 # Since: 2.12
4176 { 'struct': 'BlockdevCreateOptionsGluster',
4177   'data': { 'location':         'BlockdevOptionsGluster',
4178             'size':             'size',
4179             '*preallocation':   'PreallocMode' } }
4182 # @BlockdevCreateOptionsLUKS:
4184 # Driver specific image creation options for LUKS.
4186 # @file: Node to create the image format on
4187 # @size: Size of the virtual disk in bytes
4188 # @preallocation: Preallocation mode for the new image
4189 #                 (since: 4.2)
4190 #                 (default: off; allowed values: off, metadata, falloc, full)
4192 # Since: 2.12
4194 { 'struct': 'BlockdevCreateOptionsLUKS',
4195   'base': 'QCryptoBlockCreateOptionsLUKS',
4196   'data': { 'file':             'BlockdevRef',
4197             'size':             'size',
4198             '*preallocation':   'PreallocMode' } }
4201 # @BlockdevCreateOptionsNfs:
4203 # Driver specific image creation options for NFS.
4205 # @location: Where to store the new image file
4206 # @size: Size of the virtual disk in bytes
4208 # Since: 2.12
4210 { 'struct': 'BlockdevCreateOptionsNfs',
4211   'data': { 'location':         'BlockdevOptionsNfs',
4212             'size':             'size' } }
4215 # @BlockdevCreateOptionsParallels:
4217 # Driver specific image creation options for parallels.
4219 # @file: Node to create the image format on
4220 # @size: Size of the virtual disk in bytes
4221 # @cluster-size: Cluster size in bytes (default: 1 MB)
4223 # Since: 2.12
4225 { 'struct': 'BlockdevCreateOptionsParallels',
4226   'data': { 'file':             'BlockdevRef',
4227             'size':             'size',
4228             '*cluster-size':    'size' } }
4231 # @BlockdevCreateOptionsQcow:
4233 # Driver specific image creation options for qcow.
4235 # @file: Node to create the image format on
4236 # @size: Size of the virtual disk in bytes
4237 # @backing-file: File name of the backing file if a backing file
4238 #                should be used
4239 # @encrypt: Encryption options if the image should be encrypted
4241 # Since: 2.12
4243 { 'struct': 'BlockdevCreateOptionsQcow',
4244   'data': { 'file':             'BlockdevRef',
4245             'size':             'size',
4246             '*backing-file':    'str',
4247             '*encrypt':         'QCryptoBlockCreateOptions' } }
4250 # @BlockdevQcow2Version:
4252 # @v2:  The original QCOW2 format as introduced in qemu 0.10 (version 2)
4253 # @v3:  The extended QCOW2 format as introduced in qemu 1.1 (version 3)
4255 # Since: 2.12
4257 { 'enum': 'BlockdevQcow2Version',
4258   'data': [ 'v2', 'v3' ] }
4262 # @BlockdevCreateOptionsQcow2:
4264 # Driver specific image creation options for qcow2.
4266 # @file: Node to create the image format on
4267 # @data-file: Node to use as an external data file in which all guest
4268 #             data is stored so that only metadata remains in the qcow2
4269 #             file (since: 4.0)
4270 # @data-file-raw: True if the external data file must stay valid as a
4271 #                 standalone (read-only) raw image without looking at qcow2
4272 #                 metadata (default: false; since: 4.0)
4273 # @size: Size of the virtual disk in bytes
4274 # @version: Compatibility level (default: v3)
4275 # @backing-file: File name of the backing file if a backing file
4276 #                should be used
4277 # @backing-fmt: Name of the block driver to use for the backing file
4278 # @encrypt: Encryption options if the image should be encrypted
4279 # @cluster-size: qcow2 cluster size in bytes (default: 65536)
4280 # @preallocation: Preallocation mode for the new image (default: off;
4281 #                 allowed values: off, falloc, full, metadata)
4282 # @lazy-refcounts: True if refcounts may be updated lazily (default: off)
4283 # @refcount-bits: Width of reference counts in bits (default: 16)
4285 # Since: 2.12
4287 { 'struct': 'BlockdevCreateOptionsQcow2',
4288   'data': { 'file':             'BlockdevRef',
4289             '*data-file':       'BlockdevRef',
4290             '*data-file-raw':   'bool',
4291             'size':             'size',
4292             '*version':         'BlockdevQcow2Version',
4293             '*backing-file':    'str',
4294             '*backing-fmt':     'BlockdevDriver',
4295             '*encrypt':         'QCryptoBlockCreateOptions',
4296             '*cluster-size':    'size',
4297             '*preallocation':   'PreallocMode',
4298             '*lazy-refcounts':  'bool',
4299             '*refcount-bits':   'int' } }
4302 # @BlockdevCreateOptionsQed:
4304 # Driver specific image creation options for qed.
4306 # @file: Node to create the image format on
4307 # @size: Size of the virtual disk in bytes
4308 # @backing-file: File name of the backing file if a backing file
4309 #                should be used
4310 # @backing-fmt: Name of the block driver to use for the backing file
4311 # @cluster-size: Cluster size in bytes (default: 65536)
4312 # @table-size: L1/L2 table size (in clusters)
4314 # Since: 2.12
4316 { 'struct': 'BlockdevCreateOptionsQed',
4317   'data': { 'file':             'BlockdevRef',
4318             'size':             'size',
4319             '*backing-file':    'str',
4320             '*backing-fmt':     'BlockdevDriver',
4321             '*cluster-size':    'size',
4322             '*table-size':      'int' } }
4325 # @BlockdevCreateOptionsRbd:
4327 # Driver specific image creation options for rbd/Ceph.
4329 # @location: Where to store the new image file. This location cannot
4330 #            point to a snapshot.
4331 # @size: Size of the virtual disk in bytes
4332 # @cluster-size: RBD object size
4334 # Since: 2.12
4336 { 'struct': 'BlockdevCreateOptionsRbd',
4337   'data': { 'location':         'BlockdevOptionsRbd',
4338             'size':             'size',
4339             '*cluster-size' :   'size' } }
4342 # @BlockdevVmdkSubformat:
4344 # Subformat options for VMDK images
4346 # @monolithicSparse:     Single file image with sparse cluster allocation
4348 # @monolithicFlat:       Single flat data image and a descriptor file
4350 # @twoGbMaxExtentSparse: Data is split into 2GB (per virtual LBA) sparse extent
4351 #                        files, in addition to a descriptor file
4353 # @twoGbMaxExtentFlat:   Data is split into 2GB (per virtual LBA) flat extent
4354 #                        files, in addition to a descriptor file
4356 # @streamOptimized:      Single file image sparse cluster allocation, optimized
4357 #                        for streaming over network.
4359 # Since: 4.0
4361 { 'enum': 'BlockdevVmdkSubformat',
4362   'data': [ 'monolithicSparse', 'monolithicFlat', 'twoGbMaxExtentSparse',
4363             'twoGbMaxExtentFlat', 'streamOptimized'] }
4366 # @BlockdevVmdkAdapterType:
4368 # Adapter type info for VMDK images
4370 # Since: 4.0
4372 { 'enum': 'BlockdevVmdkAdapterType',
4373   'data': [ 'ide', 'buslogic', 'lsilogic', 'legacyESX'] }
4376 # @BlockdevCreateOptionsVmdk:
4378 # Driver specific image creation options for VMDK.
4380 # @file: Where to store the new image file. This refers to the image
4381 #        file for monolithcSparse and streamOptimized format, or the
4382 #        descriptor file for other formats.
4383 # @size: Size of the virtual disk in bytes
4384 # @extents: Where to store the data extents. Required for monolithcFlat,
4385 #           twoGbMaxExtentSparse and twoGbMaxExtentFlat formats. For
4386 #           monolithicFlat, only one entry is required; for
4387 #           twoGbMaxExtent* formats, the number of entries required is
4388 #           calculated as extent_number = virtual_size / 2GB. Providing
4389 #           more extents than will be used is an error.
4390 # @subformat: The subformat of the VMDK image. Default: "monolithicSparse".
4391 # @backing-file: The path of backing file. Default: no backing file is used.
4392 # @adapter-type: The adapter type used to fill in the descriptor. Default: ide.
4393 # @hwversion: Hardware version. The meaningful options are "4" or "6".
4394 #             Default: "4".
4395 # @zeroed-grain: Whether to enable zeroed-grain feature for sparse subformats.
4396 #                Default: false.
4398 # Since: 4.0
4400 { 'struct': 'BlockdevCreateOptionsVmdk',
4401   'data': { 'file':             'BlockdevRef',
4402             'size':             'size',
4403             '*extents':          ['BlockdevRef'],
4404             '*subformat':       'BlockdevVmdkSubformat',
4405             '*backing-file':    'str',
4406             '*adapter-type':    'BlockdevVmdkAdapterType',
4407             '*hwversion':       'str',
4408             '*zeroed-grain':    'bool' } }
4412 # @SheepdogRedundancyType:
4414 # @full: Create a fully replicated vdi with x copies
4415 # @erasure-coded: Create an erasure coded vdi with x data strips and
4416 #                 y parity strips
4418 # Since: 2.12
4420 { 'enum': 'SheepdogRedundancyType',
4421   'data': [ 'full', 'erasure-coded' ] }
4424 # @SheepdogRedundancyFull:
4426 # @copies: Number of copies to use (between 1 and 31)
4428 # Since: 2.12
4430 { 'struct': 'SheepdogRedundancyFull',
4431   'data': { 'copies': 'int' }}
4434 # @SheepdogRedundancyErasureCoded:
4436 # @data-strips: Number of data strips to use (one of {2,4,8,16})
4437 # @parity-strips: Number of parity strips to use (between 1 and 15)
4439 # Since: 2.12
4441 { 'struct': 'SheepdogRedundancyErasureCoded',
4442   'data': { 'data-strips': 'int',
4443             'parity-strips': 'int' }}
4446 # @SheepdogRedundancy:
4448 # Since: 2.12
4450 { 'union': 'SheepdogRedundancy',
4451   'base': { 'type': 'SheepdogRedundancyType' },
4452   'discriminator': 'type',
4453   'data': { 'full': 'SheepdogRedundancyFull',
4454             'erasure-coded': 'SheepdogRedundancyErasureCoded' } }
4457 # @BlockdevCreateOptionsSheepdog:
4459 # Driver specific image creation options for Sheepdog.
4461 # @location: Where to store the new image file
4462 # @size: Size of the virtual disk in bytes
4463 # @backing-file: File name of a base image
4464 # @preallocation: Preallocation mode for the new image (default: off;
4465 #                 allowed values: off, full)
4466 # @redundancy: Redundancy of the image
4467 # @object-size: Object size of the image
4469 # Since: 2.12
4471 { 'struct': 'BlockdevCreateOptionsSheepdog',
4472   'data': { 'location':         'BlockdevOptionsSheepdog',
4473             'size':             'size',
4474             '*backing-file':    'str',
4475             '*preallocation':   'PreallocMode',
4476             '*redundancy':      'SheepdogRedundancy',
4477             '*object-size':     'size' } }
4480 # @BlockdevCreateOptionsSsh:
4482 # Driver specific image creation options for SSH.
4484 # @location: Where to store the new image file
4485 # @size: Size of the virtual disk in bytes
4487 # Since: 2.12
4489 { 'struct': 'BlockdevCreateOptionsSsh',
4490   'data': { 'location':         'BlockdevOptionsSsh',
4491             'size':             'size' } }
4494 # @BlockdevCreateOptionsVdi:
4496 # Driver specific image creation options for VDI.
4498 # @file: Node to create the image format on
4499 # @size: Size of the virtual disk in bytes
4500 # @preallocation: Preallocation mode for the new image (default: off;
4501 #                 allowed values: off, metadata)
4503 # Since: 2.12
4505 { 'struct': 'BlockdevCreateOptionsVdi',
4506   'data': { 'file':             'BlockdevRef',
4507             'size':             'size',
4508             '*preallocation':   'PreallocMode' } }
4511 # @BlockdevVhdxSubformat:
4513 # @dynamic: Growing image file
4514 # @fixed:   Preallocated fixed-size image file
4516 # Since: 2.12
4518 { 'enum': 'BlockdevVhdxSubformat',
4519   'data': [ 'dynamic', 'fixed' ] }
4522 # @BlockdevCreateOptionsVhdx:
4524 # Driver specific image creation options for vhdx.
4526 # @file: Node to create the image format on
4527 # @size: Size of the virtual disk in bytes
4528 # @log-size: Log size in bytes, must be a multiple of 1 MB
4529 #            (default: 1 MB)
4530 # @block-size: Block size in bytes, must be a multiple of 1 MB and not
4531 #              larger than 256 MB (default: automatically choose a block
4532 #              size depending on the image size)
4533 # @subformat: vhdx subformat (default: dynamic)
4534 # @block-state-zero: Force use of payload blocks of type 'ZERO'. Non-standard,
4535 #                    but default.  Do not set to 'off' when using 'qemu-img
4536 #                    convert' with subformat=dynamic.
4538 # Since: 2.12
4540 { 'struct': 'BlockdevCreateOptionsVhdx',
4541   'data': { 'file':                 'BlockdevRef',
4542             'size':                 'size',
4543             '*log-size':            'size',
4544             '*block-size':          'size',
4545             '*subformat':           'BlockdevVhdxSubformat',
4546             '*block-state-zero':    'bool' } }
4549 # @BlockdevVpcSubformat:
4551 # @dynamic: Growing image file
4552 # @fixed:   Preallocated fixed-size image file
4554 # Since: 2.12
4556 { 'enum': 'BlockdevVpcSubformat',
4557   'data': [ 'dynamic', 'fixed' ] }
4560 # @BlockdevCreateOptionsVpc:
4562 # Driver specific image creation options for vpc (VHD).
4564 # @file: Node to create the image format on
4565 # @size: Size of the virtual disk in bytes
4566 # @subformat: vhdx subformat (default: dynamic)
4567 # @force-size: Force use of the exact byte size instead of rounding to the
4568 #              next size that can be represented in CHS geometry
4569 #              (default: false)
4571 # Since: 2.12
4573 { 'struct': 'BlockdevCreateOptionsVpc',
4574   'data': { 'file':                 'BlockdevRef',
4575             'size':                 'size',
4576             '*subformat':           'BlockdevVpcSubformat',
4577             '*force-size':          'bool' } }
4580 # @BlockdevCreateOptions:
4582 # Options for creating an image format on a given node.
4584 # @driver: block driver to create the image format
4586 # Since: 2.12
4588 { 'union': 'BlockdevCreateOptions',
4589   'base': {
4590       'driver':         'BlockdevDriver' },
4591   'discriminator': 'driver',
4592   'data': {
4593       'file':           'BlockdevCreateOptionsFile',
4594       'gluster':        'BlockdevCreateOptionsGluster',
4595       'luks':           'BlockdevCreateOptionsLUKS',
4596       'nfs':            'BlockdevCreateOptionsNfs',
4597       'parallels':      'BlockdevCreateOptionsParallels',
4598       'qcow':           'BlockdevCreateOptionsQcow',
4599       'qcow2':          'BlockdevCreateOptionsQcow2',
4600       'qed':            'BlockdevCreateOptionsQed',
4601       'rbd':            'BlockdevCreateOptionsRbd',
4602       'sheepdog':       'BlockdevCreateOptionsSheepdog',
4603       'ssh':            'BlockdevCreateOptionsSsh',
4604       'vdi':            'BlockdevCreateOptionsVdi',
4605       'vhdx':           'BlockdevCreateOptionsVhdx',
4606       'vmdk':           'BlockdevCreateOptionsVmdk',
4607       'vpc':            'BlockdevCreateOptionsVpc'
4608   } }
4611 # @blockdev-create:
4613 # Starts a job to create an image format on a given node. The job is
4614 # automatically finalized, but a manual job-dismiss is required.
4616 # @job-id:          Identifier for the newly created job.
4618 # @options:         Options for the image creation.
4620 # Since: 3.0
4622 { 'command': 'blockdev-create',
4623   'data': { 'job-id': 'str',
4624             'options': 'BlockdevCreateOptions' } }
4627 # @BlockErrorAction:
4629 # An enumeration of action that has been taken when a DISK I/O occurs
4631 # @ignore: error has been ignored
4633 # @report: error has been reported to the device
4635 # @stop: error caused VM to be stopped
4637 # Since: 2.1
4639 { 'enum': 'BlockErrorAction',
4640   'data': [ 'ignore', 'report', 'stop' ] }
4644 # @BLOCK_IMAGE_CORRUPTED:
4646 # Emitted when a disk image is being marked corrupt. The image can be
4647 # identified by its device or node name. The 'device' field is always
4648 # present for compatibility reasons, but it can be empty ("") if the
4649 # image does not have a device name associated.
4651 # @device: device name. This is always present for compatibility
4652 #          reasons, but it can be empty ("") if the image does not
4653 #          have a device name associated.
4655 # @node-name: node name (Since: 2.4)
4657 # @msg: informative message for human consumption, such as the kind of
4658 #       corruption being detected. It should not be parsed by machine as it is
4659 #       not guaranteed to be stable
4661 # @offset: if the corruption resulted from an image access, this is
4662 #          the host's access offset into the image
4664 # @size: if the corruption resulted from an image access, this is
4665 #        the access size
4667 # @fatal: if set, the image is marked corrupt and therefore unusable after this
4668 #         event and must be repaired (Since 2.2; before, every
4669 #         BLOCK_IMAGE_CORRUPTED event was fatal)
4671 # Note: If action is "stop", a STOP event will eventually follow the
4672 #       BLOCK_IO_ERROR event.
4674 # Example:
4676 # <- { "event": "BLOCK_IMAGE_CORRUPTED",
4677 #      "data": { "device": "ide0-hd0", "node-name": "node0",
4678 #                "msg": "Prevented active L1 table overwrite", "offset": 196608,
4679 #                "size": 65536 },
4680 #      "timestamp": { "seconds": 1378126126, "microseconds": 966463 } }
4682 # Since: 1.7
4684 { 'event': 'BLOCK_IMAGE_CORRUPTED',
4685   'data': { 'device'     : 'str',
4686             '*node-name' : 'str',
4687             'msg'        : 'str',
4688             '*offset'    : 'int',
4689             '*size'      : 'int',
4690             'fatal'      : 'bool' } }
4693 # @BLOCK_IO_ERROR:
4695 # Emitted when a disk I/O error occurs
4697 # @device: device name. This is always present for compatibility
4698 #          reasons, but it can be empty ("") if the image does not
4699 #          have a device name associated.
4701 # @node-name: node name. Note that errors may be reported for the root node
4702 #             that is directly attached to a guest device rather than for the
4703 #             node where the error occurred. The node name is not present if
4704 #             the drive is empty. (Since: 2.8)
4706 # @operation: I/O operation
4708 # @action: action that has been taken
4710 # @nospace: true if I/O error was caused due to a no-space
4711 #           condition. This key is only present if query-block's
4712 #           io-status is present, please see query-block documentation
4713 #           for more information (since: 2.2)
4715 # @reason: human readable string describing the error cause.
4716 #          (This field is a debugging aid for humans, it should not
4717 #          be parsed by applications) (since: 2.2)
4719 # Note: If action is "stop", a STOP event will eventually follow the
4720 #       BLOCK_IO_ERROR event
4722 # Since: 0.13.0
4724 # Example:
4726 # <- { "event": "BLOCK_IO_ERROR",
4727 #      "data": { "device": "ide0-hd1",
4728 #                "node-name": "#block212",
4729 #                "operation": "write",
4730 #                "action": "stop" },
4731 #      "timestamp": { "seconds": 1265044230, "microseconds": 450486 } }
4734 { 'event': 'BLOCK_IO_ERROR',
4735   'data': { 'device': 'str', '*node-name': 'str',
4736             'operation': 'IoOperationType',
4737             'action': 'BlockErrorAction', '*nospace': 'bool',
4738             'reason': 'str' } }
4741 # @BLOCK_JOB_COMPLETED:
4743 # Emitted when a block job has completed
4745 # @type: job type
4747 # @device: The job identifier. Originally the device name but other
4748 #          values are allowed since QEMU 2.7
4750 # @len: maximum progress value
4752 # @offset: current progress value. On success this is equal to len.
4753 #          On failure this is less than len
4755 # @speed: rate limit, bytes per second
4757 # @error: error message. Only present on failure. This field
4758 #         contains a human-readable error message. There are no semantics
4759 #         other than that streaming has failed and clients should not try to
4760 #         interpret the error string
4762 # Since: 1.1
4764 # Example:
4766 # <- { "event": "BLOCK_JOB_COMPLETED",
4767 #      "data": { "type": "stream", "device": "virtio-disk0",
4768 #                "len": 10737418240, "offset": 10737418240,
4769 #                "speed": 0 },
4770 #      "timestamp": { "seconds": 1267061043, "microseconds": 959568 } }
4773 { 'event': 'BLOCK_JOB_COMPLETED',
4774   'data': { 'type'  : 'JobType',
4775             'device': 'str',
4776             'len'   : 'int',
4777             'offset': 'int',
4778             'speed' : 'int',
4779             '*error': 'str' } }
4782 # @BLOCK_JOB_CANCELLED:
4784 # Emitted when a block job has been cancelled
4786 # @type: job type
4788 # @device: The job identifier. Originally the device name but other
4789 #          values are allowed since QEMU 2.7
4791 # @len: maximum progress value
4793 # @offset: current progress value. On success this is equal to len.
4794 #          On failure this is less than len
4796 # @speed: rate limit, bytes per second
4798 # Since: 1.1
4800 # Example:
4802 # <- { "event": "BLOCK_JOB_CANCELLED",
4803 #      "data": { "type": "stream", "device": "virtio-disk0",
4804 #                "len": 10737418240, "offset": 134217728,
4805 #                "speed": 0 },
4806 #      "timestamp": { "seconds": 1267061043, "microseconds": 959568 } }
4809 { 'event': 'BLOCK_JOB_CANCELLED',
4810   'data': { 'type'  : 'JobType',
4811             'device': 'str',
4812             'len'   : 'int',
4813             'offset': 'int',
4814             'speed' : 'int' } }
4817 # @BLOCK_JOB_ERROR:
4819 # Emitted when a block job encounters an error
4821 # @device: The job identifier. Originally the device name but other
4822 #          values are allowed since QEMU 2.7
4824 # @operation: I/O operation
4826 # @action: action that has been taken
4828 # Since: 1.3
4830 # Example:
4832 # <- { "event": "BLOCK_JOB_ERROR",
4833 #      "data": { "device": "ide0-hd1",
4834 #                "operation": "write",
4835 #                "action": "stop" },
4836 #      "timestamp": { "seconds": 1265044230, "microseconds": 450486 } }
4839 { 'event': 'BLOCK_JOB_ERROR',
4840   'data': { 'device'   : 'str',
4841             'operation': 'IoOperationType',
4842             'action'   : 'BlockErrorAction' } }
4845 # @BLOCK_JOB_READY:
4847 # Emitted when a block job is ready to complete
4849 # @type: job type
4851 # @device: The job identifier. Originally the device name but other
4852 #          values are allowed since QEMU 2.7
4854 # @len: maximum progress value
4856 # @offset: current progress value. On success this is equal to len.
4857 #          On failure this is less than len
4859 # @speed: rate limit, bytes per second
4861 # Note: The "ready to complete" status is always reset by a @BLOCK_JOB_ERROR
4862 #       event
4864 # Since: 1.3
4866 # Example:
4868 # <- { "event": "BLOCK_JOB_READY",
4869 #      "data": { "device": "drive0", "type": "mirror", "speed": 0,
4870 #                "len": 2097152, "offset": 2097152 }
4871 #      "timestamp": { "seconds": 1265044230, "microseconds": 450486 } }
4874 { 'event': 'BLOCK_JOB_READY',
4875   'data': { 'type'  : 'JobType',
4876             'device': 'str',
4877             'len'   : 'int',
4878             'offset': 'int',
4879             'speed' : 'int' } }
4882 # @BLOCK_JOB_PENDING:
4884 # Emitted when a block job is awaiting explicit authorization to finalize graph
4885 # changes via @block-job-finalize. If this job is part of a transaction, it will
4886 # not emit this event until the transaction has converged first.
4888 # @type: job type
4890 # @id: The job identifier.
4892 # Since: 2.12
4894 # Example:
4896 # <- { "event": "BLOCK_JOB_WAITING",
4897 #      "data": { "device": "drive0", "type": "mirror" },
4898 #      "timestamp": { "seconds": 1265044230, "microseconds": 450486 } }
4901 { 'event': 'BLOCK_JOB_PENDING',
4902   'data': { 'type'  : 'JobType',
4903             'id'    : 'str' } }
4906 # @PreallocMode:
4908 # Preallocation mode of QEMU image file
4910 # @off: no preallocation
4911 # @metadata: preallocate only for metadata
4912 # @falloc: like @full preallocation but allocate disk space by
4913 #          posix_fallocate() rather than writing data.
4914 # @full: preallocate all data by writing it to the device to ensure
4915 #        disk space is really available. This data may or may not be
4916 #        zero, depending on the image format and storage.
4917 #        @full preallocation also sets up metadata correctly.
4919 # Since: 2.2
4921 { 'enum': 'PreallocMode',
4922   'data': [ 'off', 'metadata', 'falloc', 'full' ] }
4925 # @BLOCK_WRITE_THRESHOLD:
4927 # Emitted when writes on block device reaches or exceeds the
4928 # configured write threshold. For thin-provisioned devices, this
4929 # means the device should be extended to avoid pausing for
4930 # disk exhaustion.
4931 # The event is one shot. Once triggered, it needs to be
4932 # re-registered with another block-set-write-threshold command.
4934 # @node-name: graph node name on which the threshold was exceeded.
4936 # @amount-exceeded: amount of data which exceeded the threshold, in bytes.
4938 # @write-threshold: last configured threshold, in bytes.
4940 # Since: 2.3
4942 { 'event': 'BLOCK_WRITE_THRESHOLD',
4943   'data': { 'node-name': 'str',
4944             'amount-exceeded': 'uint64',
4945             'write-threshold': 'uint64' } }
4948 # @block-set-write-threshold:
4950 # Change the write threshold for a block drive. An event will be
4951 # delivered if a write to this block drive crosses the configured
4952 # threshold.  The threshold is an offset, thus must be
4953 # non-negative. Default is no write threshold. Setting the threshold
4954 # to zero disables it.
4956 # This is useful to transparently resize thin-provisioned drives without
4957 # the guest OS noticing.
4959 # @node-name: graph node name on which the threshold must be set.
4961 # @write-threshold: configured threshold for the block device, bytes.
4962 #                   Use 0 to disable the threshold.
4964 # Since: 2.3
4966 # Example:
4968 # -> { "execute": "block-set-write-threshold",
4969 #      "arguments": { "node-name": "mydev",
4970 #                     "write-threshold": 17179869184 } }
4971 # <- { "return": {} }
4974 { 'command': 'block-set-write-threshold',
4975   'data': { 'node-name': 'str', 'write-threshold': 'uint64' } }
4978 # @x-blockdev-change:
4980 # Dynamically reconfigure the block driver state graph. It can be used
4981 # to add, remove, insert or replace a graph node. Currently only the
4982 # Quorum driver implements this feature to add or remove its child. This
4983 # is useful to fix a broken quorum child.
4985 # If @node is specified, it will be inserted under @parent. @child
4986 # may not be specified in this case. If both @parent and @child are
4987 # specified but @node is not, @child will be detached from @parent.
4989 # @parent: the id or name of the parent node.
4991 # @child: the name of a child under the given parent node.
4993 # @node: the name of the node that will be added.
4995 # Note: this command is experimental, and its API is not stable. It
4996 #       does not support all kinds of operations, all kinds of children, nor
4997 #       all block drivers.
4999 #       FIXME Removing children from a quorum node means introducing gaps in the
5000 #       child indices. This cannot be represented in the 'children' list of
5001 #       BlockdevOptionsQuorum, as returned by .bdrv_refresh_filename().
5003 #       Warning: The data in a new quorum child MUST be consistent with that of
5004 #       the rest of the array.
5006 # Since: 2.7
5008 # Example:
5010 # 1. Add a new node to a quorum
5011 # -> { "execute": "blockdev-add",
5012 #      "arguments": {
5013 #          "driver": "raw",
5014 #          "node-name": "new_node",
5015 #          "file": { "driver": "file",
5016 #                    "filename": "test.raw" } } }
5017 # <- { "return": {} }
5018 # -> { "execute": "x-blockdev-change",
5019 #      "arguments": { "parent": "disk1",
5020 #                     "node": "new_node" } }
5021 # <- { "return": {} }
5023 # 2. Delete a quorum's node
5024 # -> { "execute": "x-blockdev-change",
5025 #      "arguments": { "parent": "disk1",
5026 #                     "child": "children.1" } }
5027 # <- { "return": {} }
5030 { 'command': 'x-blockdev-change',
5031   'data' : { 'parent': 'str',
5032              '*child': 'str',
5033              '*node': 'str' } }
5036 # @x-blockdev-set-iothread:
5038 # Move @node and its children into the @iothread.  If @iothread is null then
5039 # move @node and its children into the main loop.
5041 # The node must not be attached to a BlockBackend.
5043 # @node-name: the name of the block driver node
5045 # @iothread: the name of the IOThread object or null for the main loop
5047 # @force: true if the node and its children should be moved when a BlockBackend
5048 #         is already attached
5050 # Note: this command is experimental and intended for test cases that need
5051 #       control over IOThreads only.
5053 # Since: 2.12
5055 # Example:
5057 # 1. Move a node into an IOThread
5058 # -> { "execute": "x-blockdev-set-iothread",
5059 #      "arguments": { "node-name": "disk1",
5060 #                     "iothread": "iothread0" } }
5061 # <- { "return": {} }
5063 # 2. Move a node into the main loop
5064 # -> { "execute": "x-blockdev-set-iothread",
5065 #      "arguments": { "node-name": "disk1",
5066 #                     "iothread": null } }
5067 # <- { "return": {} }
5070 { 'command': 'x-blockdev-set-iothread',
5071   'data' : { 'node-name': 'str',
5072              'iothread': 'StrOrNull',
5073              '*force': 'bool' } }
5076 # @NbdServerOptions:
5078 # @addr: Address on which to listen.
5079 # @tls-creds: ID of the TLS credentials object (since 2.6).
5080 # @tls-authz: ID of the QAuthZ authorization object used to validate
5081 #             the client's x509 distinguished name. This object is
5082 #             is only resolved at time of use, so can be deleted and
5083 #             recreated on the fly while the NBD server is active.
5084 #             If missing, it will default to denying access (since 4.0).
5086 # Keep this type consistent with the nbd-server-start arguments. The only
5087 # intended difference is using SocketAddress instead of SocketAddressLegacy.
5089 # Since: 4.2
5091 { 'struct': 'NbdServerOptions',
5092   'data': { 'addr': 'SocketAddress',
5093             '*tls-creds': 'str',
5094             '*tls-authz': 'str'} }
5097 # @nbd-server-start:
5099 # Start an NBD server listening on the given host and port.  Block
5100 # devices can then be exported using @nbd-server-add.  The NBD
5101 # server will present them as named exports; for example, another
5102 # QEMU instance could refer to them as "nbd:HOST:PORT:exportname=NAME".
5104 # @addr: Address on which to listen.
5105 # @tls-creds: ID of the TLS credentials object (since 2.6).
5106 # @tls-authz: ID of the QAuthZ authorization object used to validate
5107 #             the client's x509 distinguished name. This object is
5108 #             is only resolved at time of use, so can be deleted and
5109 #             recreated on the fly while the NBD server is active.
5110 #             If missing, it will default to denying access (since 4.0).
5112 # Returns: error if the server is already running.
5114 # Keep this type consistent with the NbdServerOptions type. The only intended
5115 # difference is using SocketAddressLegacy instead of SocketAddress.
5117 # Since: 1.3.0
5119 { 'command': 'nbd-server-start',
5120   'data': { 'addr': 'SocketAddressLegacy',
5121             '*tls-creds': 'str',
5122             '*tls-authz': 'str'} }
5125 # @BlockExportNbd:
5127 # An NBD block export.
5129 # @device: The device name or node name of the node to be exported
5131 # @name: Export name. If unspecified, the @device parameter is used as the
5132 #        export name. (Since 2.12)
5134 # @description: Free-form description of the export, up to 4096 bytes.
5135 #               (Since 5.0)
5137 # @writable: Whether clients should be able to write to the device via the
5138 #            NBD connection (default false).
5140 # @bitmap: Also export the dirty bitmap reachable from @device, so the
5141 #          NBD client can use NBD_OPT_SET_META_CONTEXT with
5142 #          "qemu:dirty-bitmap:NAME" to inspect the bitmap. (since 4.0)
5144 # Since: 5.0
5146 { 'struct': 'BlockExportNbd',
5147   'data': {'device': 'str', '*name': 'str', '*description': 'str',
5148            '*writable': 'bool', '*bitmap': 'str' } }
5151 # @nbd-server-add:
5153 # Export a block node to QEMU's embedded NBD server.
5155 # Returns: error if the server is not running, or export with the same name
5156 #          already exists.
5158 # Since: 1.3.0
5160 { 'command': 'nbd-server-add',
5161   'data': 'BlockExportNbd', 'boxed': true }
5164 # @NbdServerRemoveMode:
5166 # Mode for removing an NBD export.
5168 # @safe: Remove export if there are no existing connections, fail otherwise.
5170 # @hard: Drop all connections immediately and remove export.
5172 # Potential additional modes to be added in the future:
5174 # hide: Just hide export from new clients, leave existing connections as is.
5175 # Remove export after all clients are disconnected.
5177 # soft: Hide export from new clients, answer with ESHUTDOWN for all further
5178 # requests from existing clients.
5180 # Since: 2.12
5182 {'enum': 'NbdServerRemoveMode', 'data': ['safe', 'hard']}
5185 # @nbd-server-remove:
5187 # Remove NBD export by name.
5189 # @name: Export name.
5191 # @mode: Mode of command operation. See @NbdServerRemoveMode description.
5192 #        Default is 'safe'.
5194 # Returns: error if
5195 #            - the server is not running
5196 #            - export is not found
5197 #            - mode is 'safe' and there are existing connections
5199 # Since: 2.12
5201 { 'command': 'nbd-server-remove',
5202   'data': {'name': 'str', '*mode': 'NbdServerRemoveMode'} }
5205 # @nbd-server-stop:
5207 # Stop QEMU's embedded NBD server, and unregister all devices previously
5208 # added via @nbd-server-add.
5210 # Since: 1.3.0
5212 { 'command': 'nbd-server-stop' }
5215 # @BlockExportType:
5217 # An enumeration of block export types
5219 # @nbd: NBD export
5221 # Since: 4.2
5223 { 'enum': 'BlockExportType',
5224   'data': [ 'nbd' ] }
5227 # @BlockExport:
5229 # Describes a block export, i.e. how single node should be exported on an
5230 # external interface.
5232 # Since: 4.2
5234 { 'union': 'BlockExport',
5235   'base': { 'type': 'BlockExportType' },
5236   'discriminator': 'type',
5237   'data': {
5238       'nbd': 'BlockExportNbd'
5239    } }
5242 # @QuorumOpType:
5244 # An enumeration of the quorum operation types
5246 # @read: read operation
5248 # @write: write operation
5250 # @flush: flush operation
5252 # Since: 2.6
5254 { 'enum': 'QuorumOpType',
5255   'data': [ 'read', 'write', 'flush' ] }
5258 # @QUORUM_FAILURE:
5260 # Emitted by the Quorum block driver if it fails to establish a quorum
5262 # @reference: device name if defined else node name
5264 # @sector-num: number of the first sector of the failed read operation
5266 # @sectors-count: failed read operation sector count
5268 # Note: This event is rate-limited.
5270 # Since: 2.0
5272 # Example:
5274 # <- { "event": "QUORUM_FAILURE",
5275 #      "data": { "reference": "usr1", "sector-num": 345435, "sectors-count": 5 },
5276 #      "timestamp": { "seconds": 1344522075, "microseconds": 745528 } }
5279 { 'event': 'QUORUM_FAILURE',
5280   'data': { 'reference': 'str', 'sector-num': 'int', 'sectors-count': 'int' } }
5283 # @QUORUM_REPORT_BAD:
5285 # Emitted to report a corruption of a Quorum file
5287 # @type: quorum operation type (Since 2.6)
5289 # @error: error message. Only present on failure. This field
5290 #         contains a human-readable error message. There are no semantics other
5291 #         than that the block layer reported an error and clients should not
5292 #         try to interpret the error string.
5294 # @node-name: the graph node name of the block driver state
5296 # @sector-num: number of the first sector of the failed read operation
5298 # @sectors-count: failed read operation sector count
5300 # Note: This event is rate-limited.
5302 # Since: 2.0
5304 # Example:
5306 # 1. Read operation
5308 # { "event": "QUORUM_REPORT_BAD",
5309 #      "data": { "node-name": "node0", "sector-num": 345435, "sectors-count": 5,
5310 #                "type": "read" },
5311 #      "timestamp": { "seconds": 1344522075, "microseconds": 745528 } }
5313 # 2. Flush operation
5315 # { "event": "QUORUM_REPORT_BAD",
5316 #      "data": { "node-name": "node0", "sector-num": 0, "sectors-count": 2097120,
5317 #                "type": "flush", "error": "Broken pipe" },
5318 #      "timestamp": { "seconds": 1456406829, "microseconds": 291763 } }
5321 { 'event': 'QUORUM_REPORT_BAD',
5322   'data': { 'type': 'QuorumOpType', '*error': 'str', 'node-name': 'str',
5323             'sector-num': 'int', 'sectors-count': 'int' } }
5326 # @BlockdevSnapshotInternal:
5328 # @device: the device name or node-name of a root node to generate the snapshot
5329 #          from
5331 # @name: the name of the internal snapshot to be created
5333 # Notes: In transaction, if @name is empty, or any snapshot matching @name
5334 #        exists, the operation will fail. Only some image formats support it,
5335 #        for example, qcow2, rbd, and sheepdog.
5337 # Since: 1.7
5339 { 'struct': 'BlockdevSnapshotInternal',
5340   'data': { 'device': 'str', 'name': 'str' } }
5343 # @blockdev-snapshot-internal-sync:
5345 # Synchronously take an internal snapshot of a block device, when the
5346 # format of the image used supports it. If the name is an empty
5347 # string, or a snapshot with name already exists, the operation will
5348 # fail.
5350 # For the arguments, see the documentation of BlockdevSnapshotInternal.
5352 # Returns: - nothing on success
5353 #          - If @device is not a valid block device, GenericError
5354 #          - If any snapshot matching @name exists, or @name is empty,
5355 #            GenericError
5356 #          - If the format of the image used does not support it,
5357 #            BlockFormatFeatureNotSupported
5359 # Since: 1.7
5361 # Example:
5363 # -> { "execute": "blockdev-snapshot-internal-sync",
5364 #      "arguments": { "device": "ide-hd0",
5365 #                     "name": "snapshot0" }
5366 #    }
5367 # <- { "return": {} }
5370 { 'command': 'blockdev-snapshot-internal-sync',
5371   'data': 'BlockdevSnapshotInternal' }
5374 # @blockdev-snapshot-delete-internal-sync:
5376 # Synchronously delete an internal snapshot of a block device, when the format
5377 # of the image used support it. The snapshot is identified by name or id or
5378 # both. One of the name or id is required. Return SnapshotInfo for the
5379 # successfully deleted snapshot.
5381 # @device: the device name or node-name of a root node to delete the snapshot
5382 #          from
5384 # @id: optional the snapshot's ID to be deleted
5386 # @name: optional the snapshot's name to be deleted
5388 # Returns: - SnapshotInfo on success
5389 #          - If @device is not a valid block device, GenericError
5390 #          - If snapshot not found, GenericError
5391 #          - If the format of the image used does not support it,
5392 #            BlockFormatFeatureNotSupported
5393 #          - If @id and @name are both not specified, GenericError
5395 # Since: 1.7
5397 # Example:
5399 # -> { "execute": "blockdev-snapshot-delete-internal-sync",
5400 #      "arguments": { "device": "ide-hd0",
5401 #                     "name": "snapshot0" }
5402 #    }
5403 # <- { "return": {
5404 #                    "id": "1",
5405 #                    "name": "snapshot0",
5406 #                    "vm-state-size": 0,
5407 #                    "date-sec": 1000012,
5408 #                    "date-nsec": 10,
5409 #                    "vm-clock-sec": 100,
5410 #                    "vm-clock-nsec": 20
5411 #      }
5412 #    }
5415 { 'command': 'blockdev-snapshot-delete-internal-sync',
5416   'data': { 'device': 'str', '*id': 'str', '*name': 'str'},
5417   'returns': 'SnapshotInfo' }