block: trickle down the fallback image creation function use to the block drivers
[qemu/ar7.git] / qapi / block-core.json
blob943df1926a918c67f457c37906943858d9000b98
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: 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 # Features:
367 # @deprecated: Member @encryption_key_missing is deprecated.  It is
368 #     always false.
370 # Since: 0.14.0
373 { 'struct': 'BlockDeviceInfo',
374   'data': { 'file': 'str', '*node-name': 'str', 'ro': 'bool', 'drv': 'str',
375             '*backing_file': 'str', 'backing_file_depth': 'int',
376             'encrypted': 'bool',
377             'encryption_key_missing': { 'type': 'bool',
378                                         'features': [ 'deprecated' ] },
379             'detect_zeroes': 'BlockdevDetectZeroesOptions',
380             'bps': 'int', 'bps_rd': 'int', 'bps_wr': 'int',
381             'iops': 'int', 'iops_rd': 'int', 'iops_wr': 'int',
382             'image': 'ImageInfo',
383             '*bps_max': 'int', '*bps_rd_max': 'int',
384             '*bps_wr_max': 'int', '*iops_max': 'int',
385             '*iops_rd_max': 'int', '*iops_wr_max': 'int',
386             '*bps_max_length': 'int', '*bps_rd_max_length': 'int',
387             '*bps_wr_max_length': 'int', '*iops_max_length': 'int',
388             '*iops_rd_max_length': 'int', '*iops_wr_max_length': 'int',
389             '*iops_size': 'int', '*group': 'str', 'cache': 'BlockdevCacheInfo',
390             'write_threshold': 'int', '*dirty-bitmaps': ['BlockDirtyInfo'] } }
393 # @BlockDeviceIoStatus:
395 # An enumeration of block device I/O status.
397 # @ok: The last I/O operation has succeeded
399 # @failed: The last I/O operation has failed
401 # @nospace: The last I/O operation has failed due to a no-space condition
403 # Since: 1.0
405 { 'enum': 'BlockDeviceIoStatus', 'data': [ 'ok', 'failed', 'nospace' ] }
408 # @BlockDeviceMapEntry:
410 # Entry in the metadata map of the device (returned by "qemu-img map")
412 # @start: Offset in the image of the first byte described by this entry
413 #         (in bytes)
415 # @length: Length of the range described by this entry (in bytes)
417 # @depth: Number of layers (0 = top image, 1 = top image's backing file, etc.)
418 #         before reaching one for which the range is allocated.  The value is
419 #         in the range 0 to the depth of the image chain - 1.
421 # @zero: the sectors in this range read as zeros
423 # @data: reading the image will actually read data from a file (in particular,
424 #        if @offset is present this means that the sectors are not simply
425 #        preallocated, but contain actual data in raw format)
427 # @offset: if present, the image file stores the data for this range in
428 #          raw format at the given offset.
430 # Since: 1.7
432 { 'struct': 'BlockDeviceMapEntry',
433   'data': { 'start': 'int', 'length': 'int', 'depth': 'int', 'zero': 'bool',
434             'data': 'bool', '*offset': 'int' } }
437 # @DirtyBitmapStatus:
439 # An enumeration of possible states that a dirty bitmap can report to the user.
441 # @frozen: The bitmap is currently in-use by some operation and is immutable.
442 #          If the bitmap was @active prior to the operation, new writes by the
443 #          guest are being recorded in a temporary buffer, and will not be lost.
444 #          Generally, bitmaps are cleared on successful use in an operation and
445 #          the temporary buffer is committed into the bitmap. On failure, the
446 #          temporary buffer is merged back into the bitmap without first
447 #          clearing it.
448 #          Please refer to the documentation for each bitmap-using operation,
449 #          See also @blockdev-backup, @drive-backup.
451 # @disabled: The bitmap is not currently recording new writes by the guest.
452 #            This is requested explicitly via @block-dirty-bitmap-disable.
453 #            It can still be cleared, deleted, or used for backup operations.
455 # @active: The bitmap is actively monitoring for new writes, and can be cleared,
456 #          deleted, or used for backup operations.
458 # @locked: The bitmap is currently in-use by some operation and is immutable.
459 #          If the bitmap was @active prior to the operation, it is still
460 #          recording new writes. If the bitmap was @disabled, it is not
461 #          recording new writes. (Since 2.12)
463 # @inconsistent: This is a persistent dirty bitmap that was marked in-use on
464 #                disk, and is unusable by QEMU. It can only be deleted.
465 #                Please rely on the inconsistent field in @BlockDirtyInfo
466 #                instead, as the status field is deprecated. (Since 4.0)
468 # Since: 2.4
470 { 'enum': 'DirtyBitmapStatus',
471   'data': ['active', 'disabled', 'frozen', 'locked', 'inconsistent'] }
474 # @BlockDirtyInfo:
476 # Block dirty bitmap information.
478 # @name: the name of the dirty bitmap (Since 2.4)
480 # @count: number of dirty bytes according to the dirty bitmap
482 # @granularity: granularity of the dirty bitmap in bytes (since 1.4)
484 # @status: current status of the dirty bitmap (since 2.4)
486 # @recording: true if the bitmap is recording new writes from the guest.
487 #             Replaces `active` and `disabled` statuses. (since 4.0)
489 # @busy: true if the bitmap is in-use by some operation (NBD or jobs)
490 #        and cannot be modified via QMP or used by another operation.
491 #        Replaces `locked` and `frozen` statuses. (since 4.0)
493 # @persistent: true if the bitmap was stored on disk, is scheduled to be stored
494 #              on disk, or both. (since 4.0)
496 # @inconsistent: true if this is a persistent bitmap that was improperly
497 #                stored. Implies @persistent to be true; @recording and
498 #                @busy to be false. This bitmap cannot be used. To remove
499 #                it, use @block-dirty-bitmap-remove. (Since 4.0)
501 # Features:
502 # @deprecated: Member @status is deprecated.  Use @recording and
503 #     @locked instead.
505 # Since: 1.3
507 { 'struct': 'BlockDirtyInfo',
508   'data': {'*name': 'str', 'count': 'int', 'granularity': 'uint32',
509            'recording': 'bool', 'busy': 'bool',
510            'status': { 'type': 'DirtyBitmapStatus',
511                        'features': [ 'deprecated' ] },
512            'persistent': 'bool', '*inconsistent': 'bool' } }
515 # @Qcow2BitmapInfoFlags:
517 # An enumeration of flags that a bitmap can report to the user.
519 # @in-use: This flag is set by any process actively modifying the qcow2 file,
520 #          and cleared when the updated bitmap is flushed to the qcow2 image.
521 #          The presence of this flag in an offline image means that the bitmap
522 #          was not saved correctly after its last usage, and may contain
523 #          inconsistent data.
525 # @auto: The bitmap must reflect all changes of the virtual disk by any
526 #        application that would write to this qcow2 file.
528 # Since: 4.0
530 { 'enum': 'Qcow2BitmapInfoFlags',
531   'data': ['in-use', 'auto'] }
534 # @Qcow2BitmapInfo:
536 # Qcow2 bitmap information.
538 # @name: the name of the bitmap
540 # @granularity: granularity of the bitmap in bytes
542 # @flags: flags of the bitmap
544 # Since: 4.0
546 { 'struct': 'Qcow2BitmapInfo',
547   'data': {'name': 'str', 'granularity': 'uint32',
548            'flags': ['Qcow2BitmapInfoFlags'] } }
551 # @BlockLatencyHistogramInfo:
553 # Block latency histogram.
555 # @boundaries: list of interval boundary values in nanoseconds, all greater
556 #              than zero and in ascending order.
557 #              For example, the list [10, 50, 100] produces the following
558 #              histogram intervals: [0, 10), [10, 50), [50, 100), [100, +inf).
560 # @bins: list of io request counts corresponding to histogram intervals.
561 #        len(@bins) = len(@boundaries) + 1
562 #        For the example above, @bins may be something like [3, 1, 5, 2],
563 #        and corresponding histogram looks like:
565 # |      5|           *
566 # |      4|           *
567 # |      3| *         *
568 # |      2| *         *    *
569 # |      1| *    *    *    *
570 # |       +------------------
571 # |           10   50   100
573 # Since: 4.0
575 { 'struct': 'BlockLatencyHistogramInfo',
576   'data': {'boundaries': ['uint64'], 'bins': ['uint64'] } }
579 # @BlockInfo:
581 # Block device information.  This structure describes a virtual device and
582 # the backing device associated with it.
584 # @device: The device name associated with the virtual device.
586 # @qdev: The qdev ID, or if no ID is assigned, the QOM path of the block
587 #        device. (since 2.10)
589 # @type: This field is returned only for compatibility reasons, it should
590 #        not be used (always returns 'unknown')
592 # @removable: True if the device supports removable media.
594 # @locked: True if the guest has locked this device from having its media
595 #          removed
597 # @tray_open: True if the device's tray is open
598 #             (only present if it has a tray)
600 # @dirty-bitmaps: dirty bitmaps information (only present if the
601 #                 driver has one or more dirty bitmaps) (Since 2.0)
603 # @io-status: @BlockDeviceIoStatus. Only present if the device
604 #             supports it and the VM is configured to stop on errors
605 #             (supported device models: virtio-blk, IDE, SCSI except
606 #             scsi-generic)
608 # @inserted: @BlockDeviceInfo describing the device if media is
609 #            present
611 # Features:
612 # @deprecated: Member @dirty-bitmaps is deprecated.  Use @inserted
613 #     member @dirty-bitmaps instead.
615 # Since:  0.14.0
617 { 'struct': 'BlockInfo',
618   'data': {'device': 'str', '*qdev': 'str', 'type': 'str', 'removable': 'bool',
619            'locked': 'bool', '*inserted': 'BlockDeviceInfo',
620            '*tray_open': 'bool', '*io-status': 'BlockDeviceIoStatus',
621            '*dirty-bitmaps': { 'type': ['BlockDirtyInfo'],
622                                'features': [ 'deprecated' ] } } }
625 # @BlockMeasureInfo:
627 # Image file size calculation information.  This structure describes the size
628 # requirements for creating a new image file.
630 # The size requirements depend on the new image file format.  File size always
631 # equals virtual disk size for the 'raw' format, even for sparse POSIX files.
632 # Compact formats such as 'qcow2' represent unallocated and zero regions
633 # efficiently so file size may be smaller than virtual disk size.
635 # The values are upper bounds that are guaranteed to fit the new image file.
636 # Subsequent modification, such as internal snapshot or bitmap creation, may
637 # require additional space and is not covered here.
639 # @required: Size required for a new image file, in bytes.
641 # @fully-allocated: Image file size, in bytes, once data has been written
642 #                   to all sectors.
644 # Since: 2.10
646 { 'struct': 'BlockMeasureInfo',
647   'data': {'required': 'int', 'fully-allocated': 'int'} }
650 # @query-block:
652 # Get a list of BlockInfo for all virtual block devices.
654 # Returns: a list of @BlockInfo describing each virtual block device. Filter
655 #          nodes that were created implicitly are skipped over.
657 # Since: 0.14.0
659 # Example:
661 # -> { "execute": "query-block" }
662 # <- {
663 #       "return":[
664 #          {
665 #             "io-status": "ok",
666 #             "device":"ide0-hd0",
667 #             "locked":false,
668 #             "removable":false,
669 #             "inserted":{
670 #                "ro":false,
671 #                "drv":"qcow2",
672 #                "encrypted":false,
673 #                "file":"disks/test.qcow2",
674 #                "backing_file_depth":1,
675 #                "bps":1000000,
676 #                "bps_rd":0,
677 #                "bps_wr":0,
678 #                "iops":1000000,
679 #                "iops_rd":0,
680 #                "iops_wr":0,
681 #                "bps_max": 8000000,
682 #                "bps_rd_max": 0,
683 #                "bps_wr_max": 0,
684 #                "iops_max": 0,
685 #                "iops_rd_max": 0,
686 #                "iops_wr_max": 0,
687 #                "iops_size": 0,
688 #                "detect_zeroes": "on",
689 #                "write_threshold": 0,
690 #                "image":{
691 #                   "filename":"disks/test.qcow2",
692 #                   "format":"qcow2",
693 #                   "virtual-size":2048000,
694 #                   "backing_file":"base.qcow2",
695 #                   "full-backing-filename":"disks/base.qcow2",
696 #                   "backing-filename-format":"qcow2",
697 #                   "snapshots":[
698 #                      {
699 #                         "id": "1",
700 #                         "name": "snapshot1",
701 #                         "vm-state-size": 0,
702 #                         "date-sec": 10000200,
703 #                         "date-nsec": 12,
704 #                         "vm-clock-sec": 206,
705 #                         "vm-clock-nsec": 30
706 #                      }
707 #                   ],
708 #                   "backing-image":{
709 #                       "filename":"disks/base.qcow2",
710 #                       "format":"qcow2",
711 #                       "virtual-size":2048000
712 #                   }
713 #                }
714 #             },
715 #             "qdev": "ide_disk",
716 #             "type":"unknown"
717 #          },
718 #          {
719 #             "io-status": "ok",
720 #             "device":"ide1-cd0",
721 #             "locked":false,
722 #             "removable":true,
723 #             "qdev": "/machine/unattached/device[23]",
724 #             "tray_open": false,
725 #             "type":"unknown"
726 #          },
727 #          {
728 #             "device":"floppy0",
729 #             "locked":false,
730 #             "removable":true,
731 #             "qdev": "/machine/unattached/device[20]",
732 #             "type":"unknown"
733 #          },
734 #          {
735 #             "device":"sd0",
736 #             "locked":false,
737 #             "removable":true,
738 #             "type":"unknown"
739 #          }
740 #       ]
741 #    }
744 { 'command': 'query-block', 'returns': ['BlockInfo'] }
748 # @BlockDeviceTimedStats:
750 # Statistics of a block device during a given interval of time.
752 # @interval_length: Interval used for calculating the statistics,
753 #                   in seconds.
755 # @min_rd_latency_ns: Minimum latency of read operations in the
756 #                     defined interval, in nanoseconds.
758 # @min_wr_latency_ns: Minimum latency of write operations in the
759 #                     defined interval, in nanoseconds.
761 # @min_flush_latency_ns: Minimum latency of flush operations in the
762 #                        defined interval, in nanoseconds.
764 # @max_rd_latency_ns: Maximum latency of read operations in the
765 #                     defined interval, in nanoseconds.
767 # @max_wr_latency_ns: Maximum latency of write operations in the
768 #                     defined interval, in nanoseconds.
770 # @max_flush_latency_ns: Maximum latency of flush operations in the
771 #                        defined interval, in nanoseconds.
773 # @avg_rd_latency_ns: Average latency of read operations in the
774 #                     defined interval, in nanoseconds.
776 # @avg_wr_latency_ns: Average latency of write operations in the
777 #                     defined interval, in nanoseconds.
779 # @avg_flush_latency_ns: Average latency of flush operations in the
780 #                        defined interval, in nanoseconds.
782 # @avg_rd_queue_depth: Average number of pending read operations
783 #                      in the defined interval.
785 # @avg_wr_queue_depth: Average number of pending write operations
786 #                      in the defined interval.
788 # Since: 2.5
790 { 'struct': 'BlockDeviceTimedStats',
791   'data': { 'interval_length': 'int', 'min_rd_latency_ns': 'int',
792             'max_rd_latency_ns': 'int', 'avg_rd_latency_ns': 'int',
793             'min_wr_latency_ns': 'int', 'max_wr_latency_ns': 'int',
794             'avg_wr_latency_ns': 'int', 'min_flush_latency_ns': 'int',
795             'max_flush_latency_ns': 'int', 'avg_flush_latency_ns': 'int',
796             'avg_rd_queue_depth': 'number', 'avg_wr_queue_depth': 'number' } }
799 # @BlockDeviceStats:
801 # Statistics of a virtual block device or a block backing device.
803 # @rd_bytes:      The number of bytes read by the device.
805 # @wr_bytes:      The number of bytes written by the device.
807 # @unmap_bytes: The number of bytes unmapped by the device (Since 4.2)
809 # @rd_operations: The number of read operations performed by the device.
811 # @wr_operations: The number of write operations performed by the device.
813 # @flush_operations: The number of cache flush operations performed by the
814 #                    device (since 0.15.0)
816 # @unmap_operations: The number of unmap operations performed by the device
817 #                    (Since 4.2)
819 # @rd_total_time_ns: Total time spent on reads in nanoseconds (since 0.15.0).
821 # @wr_total_time_ns: Total time spent on writes in nanoseconds (since 0.15.0).
823 # @flush_total_time_ns: Total time spent on cache flushes in nanoseconds
824 #                       (since 0.15.0).
826 # @unmap_total_time_ns: Total time spent on unmap operations in nanoseconds
827 #                       (Since 4.2)
829 # @wr_highest_offset: The offset after the greatest byte written to the
830 #                     device.  The intended use of this information is for
831 #                     growable sparse files (like qcow2) that are used on top
832 #                     of a physical device.
834 # @rd_merged: Number of read requests that have been merged into another
835 #             request (Since 2.3).
837 # @wr_merged: Number of write requests that have been merged into another
838 #             request (Since 2.3).
840 # @unmap_merged: Number of unmap requests that have been merged into another
841 #                request (Since 4.2)
843 # @idle_time_ns: Time since the last I/O operation, in
844 #                nanoseconds. If the field is absent it means that
845 #                there haven't been any operations yet (Since 2.5).
847 # @failed_rd_operations: The number of failed read operations
848 #                        performed by the device (Since 2.5)
850 # @failed_wr_operations: The number of failed write operations
851 #                        performed by the device (Since 2.5)
853 # @failed_flush_operations: The number of failed flush operations
854 #                           performed by the device (Since 2.5)
856 # @failed_unmap_operations: The number of failed unmap operations performed
857 #                           by the device (Since 4.2)
859 # @invalid_rd_operations: The number of invalid read operations
860 #                          performed by the device (Since 2.5)
862 # @invalid_wr_operations: The number of invalid write operations
863 #                         performed by the device (Since 2.5)
865 # @invalid_flush_operations: The number of invalid flush operations
866 #                            performed by the device (Since 2.5)
868 # @invalid_unmap_operations: The number of invalid unmap operations performed
869 #                            by the device (Since 4.2)
871 # @account_invalid: Whether invalid operations are included in the
872 #                   last access statistics (Since 2.5)
874 # @account_failed: Whether failed operations are included in the
875 #                  latency and last access statistics (Since 2.5)
877 # @timed_stats: Statistics specific to the set of previously defined
878 #               intervals of time (Since 2.5)
880 # @rd_latency_histogram: @BlockLatencyHistogramInfo. (Since 4.0)
882 # @wr_latency_histogram: @BlockLatencyHistogramInfo. (Since 4.0)
884 # @flush_latency_histogram: @BlockLatencyHistogramInfo. (Since 4.0)
886 # Since: 0.14.0
888 { 'struct': 'BlockDeviceStats',
889   'data': {'rd_bytes': 'int', 'wr_bytes': 'int', 'unmap_bytes' : 'int',
890            'rd_operations': 'int', 'wr_operations': 'int',
891            'flush_operations': 'int', 'unmap_operations': 'int',
892            'rd_total_time_ns': 'int', 'wr_total_time_ns': 'int',
893            'flush_total_time_ns': 'int', 'unmap_total_time_ns': 'int',
894            'wr_highest_offset': 'int',
895            'rd_merged': 'int', 'wr_merged': 'int', 'unmap_merged': 'int',
896            '*idle_time_ns': 'int',
897            'failed_rd_operations': 'int', 'failed_wr_operations': 'int',
898            'failed_flush_operations': 'int', 'failed_unmap_operations': 'int',
899            'invalid_rd_operations': 'int', 'invalid_wr_operations': 'int',
900            'invalid_flush_operations': 'int', 'invalid_unmap_operations': 'int',
901            'account_invalid': 'bool', 'account_failed': 'bool',
902            'timed_stats': ['BlockDeviceTimedStats'],
903            '*rd_latency_histogram': 'BlockLatencyHistogramInfo',
904            '*wr_latency_histogram': 'BlockLatencyHistogramInfo',
905            '*flush_latency_histogram': 'BlockLatencyHistogramInfo' } }
908 # @BlockStatsSpecificFile:
910 # File driver statistics
912 # @discard-nb-ok: The number of successful discard operations performed by
913 #                 the driver.
915 # @discard-nb-failed: The number of failed discard operations performed by
916 #                     the driver.
918 # @discard-bytes-ok: The number of bytes discarded by the driver.
920 # Since: 4.2
922 { 'struct': 'BlockStatsSpecificFile',
923   'data': {
924       'discard-nb-ok': 'uint64',
925       'discard-nb-failed': 'uint64',
926       'discard-bytes-ok': 'uint64' } }
929 # @BlockStatsSpecific:
931 # Block driver specific statistics
933 # Since: 4.2
935 { 'union': 'BlockStatsSpecific',
936   'base': { 'driver': 'BlockdevDriver' },
937   'discriminator': 'driver',
938   'data': {
939       'file': 'BlockStatsSpecificFile',
940       'host_device': 'BlockStatsSpecificFile' } }
943 # @BlockStats:
945 # Statistics of a virtual block device or a block backing device.
947 # @device: If the stats are for a virtual block device, the name
948 #          corresponding to the virtual block device.
950 # @node-name: The node name of the device. (Since 2.3)
952 # @qdev: The qdev ID, or if no ID is assigned, the QOM path of the block
953 #        device. (since 3.0)
955 # @stats:  A @BlockDeviceStats for the device.
957 # @driver-specific: Optional driver-specific stats. (Since 4.2)
959 # @parent: This describes the file block device if it has one.
960 #          Contains recursively the statistics of the underlying
961 #          protocol (e.g. the host file for a qcow2 image). If there is
962 #          no underlying protocol, this field is omitted
964 # @backing: This describes the backing block device if it has one.
965 #           (Since 2.0)
967 # Since: 0.14.0
969 { 'struct': 'BlockStats',
970   'data': {'*device': 'str', '*qdev': 'str', '*node-name': 'str',
971            'stats': 'BlockDeviceStats',
972            '*driver-specific': 'BlockStatsSpecific',
973            '*parent': 'BlockStats',
974            '*backing': 'BlockStats'} }
977 # @query-blockstats:
979 # Query the @BlockStats for all virtual block devices.
981 # @query-nodes: If true, the command will query all the block nodes
982 #               that have a node name, in a list which will include "parent"
983 #               information, but not "backing".
984 #               If false or omitted, the behavior is as before - query all the
985 #               device backends, recursively including their "parent" and
986 #               "backing". Filter nodes that were created implicitly are
987 #               skipped over in this mode. (Since 2.3)
989 # Returns: A list of @BlockStats for each virtual block devices.
991 # Since: 0.14.0
993 # Example:
995 # -> { "execute": "query-blockstats" }
996 # <- {
997 #       "return":[
998 #          {
999 #             "device":"ide0-hd0",
1000 #             "parent":{
1001 #                "stats":{
1002 #                   "wr_highest_offset":3686448128,
1003 #                   "wr_bytes":9786368,
1004 #                   "wr_operations":751,
1005 #                   "rd_bytes":122567168,
1006 #                   "rd_operations":36772
1007 #                   "wr_total_times_ns":313253456
1008 #                   "rd_total_times_ns":3465673657
1009 #                   "flush_total_times_ns":49653
1010 #                   "flush_operations":61,
1011 #                   "rd_merged":0,
1012 #                   "wr_merged":0,
1013 #                   "idle_time_ns":2953431879,
1014 #                   "account_invalid":true,
1015 #                   "account_failed":false
1016 #                }
1017 #             },
1018 #             "stats":{
1019 #                "wr_highest_offset":2821110784,
1020 #                "wr_bytes":9786368,
1021 #                "wr_operations":692,
1022 #                "rd_bytes":122739200,
1023 #                "rd_operations":36604
1024 #                "flush_operations":51,
1025 #                "wr_total_times_ns":313253456
1026 #                "rd_total_times_ns":3465673657
1027 #                "flush_total_times_ns":49653,
1028 #                "rd_merged":0,
1029 #                "wr_merged":0,
1030 #                "idle_time_ns":2953431879,
1031 #                "account_invalid":true,
1032 #                "account_failed":false
1033 #             },
1034 #             "qdev": "/machine/unattached/device[23]"
1035 #          },
1036 #          {
1037 #             "device":"ide1-cd0",
1038 #             "stats":{
1039 #                "wr_highest_offset":0,
1040 #                "wr_bytes":0,
1041 #                "wr_operations":0,
1042 #                "rd_bytes":0,
1043 #                "rd_operations":0
1044 #                "flush_operations":0,
1045 #                "wr_total_times_ns":0
1046 #                "rd_total_times_ns":0
1047 #                "flush_total_times_ns":0,
1048 #                "rd_merged":0,
1049 #                "wr_merged":0,
1050 #                "account_invalid":false,
1051 #                "account_failed":false
1052 #             },
1053 #             "qdev": "/machine/unattached/device[24]"
1054 #          },
1055 #          {
1056 #             "device":"floppy0",
1057 #             "stats":{
1058 #                "wr_highest_offset":0,
1059 #                "wr_bytes":0,
1060 #                "wr_operations":0,
1061 #                "rd_bytes":0,
1062 #                "rd_operations":0
1063 #                "flush_operations":0,
1064 #                "wr_total_times_ns":0
1065 #                "rd_total_times_ns":0
1066 #                "flush_total_times_ns":0,
1067 #                "rd_merged":0,
1068 #                "wr_merged":0,
1069 #                "account_invalid":false,
1070 #                "account_failed":false
1071 #             },
1072 #             "qdev": "/machine/unattached/device[16]"
1073 #          },
1074 #          {
1075 #             "device":"sd0",
1076 #             "stats":{
1077 #                "wr_highest_offset":0,
1078 #                "wr_bytes":0,
1079 #                "wr_operations":0,
1080 #                "rd_bytes":0,
1081 #                "rd_operations":0
1082 #                "flush_operations":0,
1083 #                "wr_total_times_ns":0
1084 #                "rd_total_times_ns":0
1085 #                "flush_total_times_ns":0,
1086 #                "rd_merged":0,
1087 #                "wr_merged":0,
1088 #                "account_invalid":false,
1089 #                "account_failed":false
1090 #             }
1091 #          }
1092 #       ]
1093 #    }
1096 { 'command': 'query-blockstats',
1097   'data': { '*query-nodes': 'bool' },
1098   'returns': ['BlockStats'] }
1101 # @BlockdevOnError:
1103 # An enumeration of possible behaviors for errors on I/O operations.
1104 # The exact meaning depends on whether the I/O was initiated by a guest
1105 # or by a block job
1107 # @report: for guest operations, report the error to the guest;
1108 #          for jobs, cancel the job
1110 # @ignore: ignore the error, only report a QMP event (BLOCK_IO_ERROR
1111 #          or BLOCK_JOB_ERROR). The backup, mirror and commit block jobs retry
1112 #          the failing request later and may still complete successfully. The
1113 #          stream block job continues to stream and will complete with an
1114 #          error.
1116 # @enospc: same as @stop on ENOSPC, same as @report otherwise.
1118 # @stop: for guest operations, stop the virtual machine;
1119 #        for jobs, pause the job
1121 # @auto: inherit the error handling policy of the backend (since: 2.7)
1123 # Since: 1.3
1125 { 'enum': 'BlockdevOnError',
1126   'data': ['report', 'ignore', 'enospc', 'stop', 'auto'] }
1129 # @MirrorSyncMode:
1131 # An enumeration of possible behaviors for the initial synchronization
1132 # phase of storage mirroring.
1134 # @top: copies data in the topmost image to the destination
1136 # @full: copies data from all images to the destination
1138 # @none: only copy data written from now on
1140 # @incremental: only copy data described by the dirty bitmap. (since: 2.4)
1142 # @bitmap: only copy data described by the dirty bitmap. (since: 4.2)
1143 #          Behavior on completion is determined by the BitmapSyncMode.
1145 # Since: 1.3
1147 { 'enum': 'MirrorSyncMode',
1148   'data': ['top', 'full', 'none', 'incremental', 'bitmap'] }
1151 # @BitmapSyncMode:
1153 # An enumeration of possible behaviors for the synchronization of a bitmap
1154 # when used for data copy operations.
1156 # @on-success: The bitmap is only synced when the operation is successful.
1157 #              This is the behavior always used for 'INCREMENTAL' backups.
1159 # @never: The bitmap is never synchronized with the operation, and is
1160 #         treated solely as a read-only manifest of blocks to copy.
1162 # @always: The bitmap is always synchronized with the operation,
1163 #          regardless of whether or not the operation was successful.
1165 # Since: 4.2
1167 { 'enum': 'BitmapSyncMode',
1168   'data': ['on-success', 'never', 'always'] }
1171 # @MirrorCopyMode:
1173 # An enumeration whose values tell the mirror block job when to
1174 # trigger writes to the target.
1176 # @background: copy data in background only.
1178 # @write-blocking: when data is written to the source, write it
1179 #                  (synchronously) to the target as well.  In
1180 #                  addition, data is copied in background just like in
1181 #                  @background mode.
1183 # Since: 3.0
1185 { 'enum': 'MirrorCopyMode',
1186   'data': ['background', 'write-blocking'] }
1189 # @BlockJobInfo:
1191 # Information about a long-running block device operation.
1193 # @type: the job type ('stream' for image streaming)
1195 # @device: The job identifier. Originally the device name but other
1196 #          values are allowed since QEMU 2.7
1198 # @len: Estimated @offset value at the completion of the job. This value can
1199 #       arbitrarily change while the job is running, in both directions.
1201 # @offset: Progress made until now. The unit is arbitrary and the value can
1202 #          only meaningfully be used for the ratio of @offset to @len. The
1203 #          value is monotonically increasing.
1205 # @busy: false if the job is known to be in a quiescent state, with
1206 #        no pending I/O.  Since 1.3.
1208 # @paused: whether the job is paused or, if @busy is true, will
1209 #          pause itself as soon as possible.  Since 1.3.
1211 # @speed: the rate limit, bytes per second
1213 # @io-status: the status of the job (since 1.3)
1215 # @ready: true if the job may be completed (since 2.2)
1217 # @status: Current job state/status (since 2.12)
1219 # @auto-finalize: Job will finalize itself when PENDING, moving to
1220 #                 the CONCLUDED state. (since 2.12)
1222 # @auto-dismiss: Job will dismiss itself when CONCLUDED, moving to the NULL
1223 #                state and disappearing from the query list. (since 2.12)
1225 # @error: Error information if the job did not complete successfully.
1226 #         Not set if the job completed successfully. (since 2.12.1)
1228 # Since: 1.1
1230 { 'struct': 'BlockJobInfo',
1231   'data': {'type': 'str', 'device': 'str', 'len': 'int',
1232            'offset': 'int', 'busy': 'bool', 'paused': 'bool', 'speed': 'int',
1233            'io-status': 'BlockDeviceIoStatus', 'ready': 'bool',
1234            'status': 'JobStatus',
1235            'auto-finalize': 'bool', 'auto-dismiss': 'bool',
1236            '*error': 'str' } }
1239 # @query-block-jobs:
1241 # Return information about long-running block device operations.
1243 # Returns: a list of @BlockJobInfo for each active block job
1245 # Since: 1.1
1247 { 'command': 'query-block-jobs', 'returns': ['BlockJobInfo'] }
1250 # @block_passwd:
1252 # This command sets the password of a block device that has not been open
1253 # with a password and requires one.
1255 # This command is now obsolete and will always return an error since 2.10
1258 { 'command': 'block_passwd',
1259   'data': { '*device': 'str',
1260             '*node-name': 'str',
1261             'password': 'str' } }
1264 # @block_resize:
1266 # Resize a block image while a guest is running.
1268 # Either @device or @node-name must be set but not both.
1270 # @device: the name of the device to get the image resized
1272 # @node-name: graph node name to get the image resized (Since 2.0)
1274 # @size:  new image size in bytes
1276 # Returns: - nothing on success
1277 #          - If @device is not a valid block device, DeviceNotFound
1279 # Since: 0.14.0
1281 # Example:
1283 # -> { "execute": "block_resize",
1284 #      "arguments": { "device": "scratch", "size": 1073741824 } }
1285 # <- { "return": {} }
1288 { 'command': 'block_resize',
1289   'data': { '*device': 'str',
1290             '*node-name': 'str',
1291             'size': 'int' } }
1294 # @NewImageMode:
1296 # An enumeration that tells QEMU how to set the backing file path in
1297 # a new image file.
1299 # @existing: QEMU should look for an existing image file.
1301 # @absolute-paths: QEMU should create a new image with absolute paths
1302 #                  for the backing file. If there is no backing file available, the new
1303 #                  image will not be backed either.
1305 # Since: 1.1
1307 { 'enum': 'NewImageMode',
1308   'data': [ 'existing', 'absolute-paths' ] }
1311 # @BlockdevSnapshotSync:
1313 # Either @device or @node-name must be set but not both.
1315 # @device: the name of the device to take a snapshot of.
1317 # @node-name: graph node name to generate the snapshot from (Since 2.0)
1319 # @snapshot-file: the target of the new overlay image. If the file
1320 #                 exists, or if it is a device, the overlay will be created in the
1321 #                 existing file/device. Otherwise, a new file will be created.
1323 # @snapshot-node-name: the graph node name of the new image (Since 2.0)
1325 # @format: the format of the overlay image, default is 'qcow2'.
1327 # @mode: whether and how QEMU should create a new image, default is
1328 #        'absolute-paths'.
1330 { 'struct': 'BlockdevSnapshotSync',
1331   'data': { '*device': 'str', '*node-name': 'str',
1332             'snapshot-file': 'str', '*snapshot-node-name': 'str',
1333             '*format': 'str', '*mode': 'NewImageMode' } }
1336 # @BlockdevSnapshot:
1338 # @node: device or node name that will have a snapshot taken.
1340 # @overlay: reference to the existing block device that will become
1341 #           the overlay of @node, as part of taking the snapshot.
1342 #           It must not have a current backing file (this can be
1343 #           achieved by passing "backing": null to blockdev-add).
1345 # Since: 2.5
1347 { 'struct': 'BlockdevSnapshot',
1348   'data': { 'node': 'str', 'overlay': 'str' } }
1351 # @BackupCommon:
1353 # @job-id: identifier for the newly-created block job. If
1354 #          omitted, the device name will be used. (Since 2.7)
1356 # @device: the device name or node-name of a root node which should be copied.
1358 # @sync: what parts of the disk image should be copied to the destination
1359 #        (all the disk, only the sectors allocated in the topmost image, from a
1360 #        dirty bitmap, or only new I/O).
1362 # @speed: the maximum speed, in bytes per second. The default is 0,
1363 #         for unlimited.
1365 # @bitmap: The name of a dirty bitmap to use.
1366 #          Must be present if sync is "bitmap" or "incremental".
1367 #          Can be present if sync is "full" or "top".
1368 #          Must not be present otherwise.
1369 #          (Since 2.4 (drive-backup), 3.1 (blockdev-backup))
1371 # @bitmap-mode: Specifies the type of data the bitmap should contain after
1372 #               the operation concludes.
1373 #               Must be present if a bitmap was provided,
1374 #               Must NOT be present otherwise. (Since 4.2)
1376 # @compress: true to compress data, if the target format supports it.
1377 #            (default: false) (since 2.8)
1379 # @on-source-error: the action to take on an error on the source,
1380 #                   default 'report'.  'stop' and 'enospc' can only be used
1381 #                   if the block device supports io-status (see BlockInfo).
1383 # @on-target-error: the action to take on an error on the target,
1384 #                   default 'report' (no limitations, since this applies to
1385 #                   a different block device than @device).
1387 # @auto-finalize: When false, this job will wait in a PENDING state after it has
1388 #                 finished its work, waiting for @block-job-finalize before
1389 #                 making any block graph changes.
1390 #                 When true, this job will automatically
1391 #                 perform its abort or commit actions.
1392 #                 Defaults to true. (Since 2.12)
1394 # @auto-dismiss: When false, this job will wait in a CONCLUDED state after it
1395 #                has completely ceased all work, and awaits @block-job-dismiss.
1396 #                When true, this job will automatically disappear from the query
1397 #                list without user intervention.
1398 #                Defaults to true. (Since 2.12)
1400 # @filter-node-name: the node name that should be assigned to the
1401 #                    filter driver that the backup job inserts into the graph
1402 #                    above node specified by @drive. If this option is not given,
1403 #                    a node name is autogenerated. (Since: 4.2)
1405 # Note: @on-source-error and @on-target-error only affect background
1406 #       I/O.  If an error occurs during a guest write request, the device's
1407 #       rerror/werror actions will be used.
1409 # Since: 4.2
1411 { 'struct': 'BackupCommon',
1412   'data': { '*job-id': 'str', 'device': 'str',
1413             'sync': 'MirrorSyncMode', '*speed': 'int',
1414             '*bitmap': 'str', '*bitmap-mode': 'BitmapSyncMode',
1415             '*compress': 'bool',
1416             '*on-source-error': 'BlockdevOnError',
1417             '*on-target-error': 'BlockdevOnError',
1418             '*auto-finalize': 'bool', '*auto-dismiss': 'bool',
1419             '*filter-node-name': 'str' } }
1422 # @DriveBackup:
1424 # @target: the target of the new image. If the file exists, or if it
1425 #          is a device, the existing file/device will be used as the new
1426 #          destination.  If it does not exist, a new file will be created.
1428 # @format: the format of the new destination, default is to
1429 #          probe if @mode is 'existing', else the format of the source
1431 # @mode: whether and how QEMU should create a new image, default is
1432 #        'absolute-paths'.
1434 # Since: 1.6
1436 { 'struct': 'DriveBackup',
1437   'base': 'BackupCommon',
1438   'data': { 'target': 'str',
1439             '*format': 'str',
1440             '*mode': 'NewImageMode' } }
1443 # @BlockdevBackup:
1445 # @target: the device name or node-name of the backup target node.
1447 # Since: 2.3
1449 { 'struct': 'BlockdevBackup',
1450   'base': 'BackupCommon',
1451   'data': { 'target': 'str' } }
1454 # @blockdev-snapshot-sync:
1456 # Takes a synchronous snapshot of a block device.
1458 # For the arguments, see the documentation of BlockdevSnapshotSync.
1460 # Returns: - nothing on success
1461 #          - If @device is not a valid block device, DeviceNotFound
1463 # Since: 0.14.0
1465 # Example:
1467 # -> { "execute": "blockdev-snapshot-sync",
1468 #      "arguments": { "device": "ide-hd0",
1469 #                     "snapshot-file":
1470 #                     "/some/place/my-image",
1471 #                     "format": "qcow2" } }
1472 # <- { "return": {} }
1475 { 'command': 'blockdev-snapshot-sync',
1476   'data': 'BlockdevSnapshotSync' }
1480 # @blockdev-snapshot:
1482 # Takes a snapshot of a block device.
1484 # Take a snapshot, by installing 'node' as the backing image of
1485 # 'overlay'. Additionally, if 'node' is associated with a block
1486 # device, the block device changes to using 'overlay' as its new active
1487 # image.
1489 # For the arguments, see the documentation of BlockdevSnapshot.
1491 # Features:
1492 # @allow-write-only-overlay: If present, the check whether this operation is safe
1493 #                            was relaxed so that it can be used to change
1494 #                            backing file of a destination of a blockdev-mirror.
1495 #                            (since 5.0)
1497 # Since: 2.5
1499 # Example:
1501 # -> { "execute": "blockdev-add",
1502 #      "arguments": { "driver": "qcow2",
1503 #                     "node-name": "node1534",
1504 #                     "file": { "driver": "file",
1505 #                               "filename": "hd1.qcow2" },
1506 #                     "backing": null } }
1508 # <- { "return": {} }
1510 # -> { "execute": "blockdev-snapshot",
1511 #      "arguments": { "node": "ide-hd0",
1512 #                     "overlay": "node1534" } }
1513 # <- { "return": {} }
1516 { 'command': 'blockdev-snapshot',
1517   'data': 'BlockdevSnapshot',
1518   'features': [ 'allow-write-only-overlay' ] }
1521 # @change-backing-file:
1523 # Change the backing file in the image file metadata.  This does not
1524 # cause QEMU to reopen the image file to reparse the backing filename
1525 # (it may, however, perform a reopen to change permissions from
1526 # r/o -> r/w -> r/o, if needed). The new backing file string is written
1527 # into the image file metadata, and the QEMU internal strings are
1528 # updated.
1530 # @image-node-name: The name of the block driver state node of the
1531 #                   image to modify. The "device" argument is used
1532 #                   to verify "image-node-name" is in the chain
1533 #                   described by "device".
1535 # @device: The device name or node-name of the root node that owns
1536 #          image-node-name.
1538 # @backing-file: The string to write as the backing file.  This
1539 #                string is not validated, so care should be taken
1540 #                when specifying the string or the image chain may
1541 #                not be able to be reopened again.
1543 # Returns: - Nothing on success
1544 #          - If "device" does not exist or cannot be determined, DeviceNotFound
1546 # Since: 2.1
1548 { 'command': 'change-backing-file',
1549   'data': { 'device': 'str', 'image-node-name': 'str',
1550             'backing-file': 'str' } }
1553 # @block-commit:
1555 # Live commit of data from overlay image nodes into backing nodes - i.e.,
1556 # writes data between 'top' and 'base' into 'base'.
1558 # @job-id: identifier for the newly-created block job. If
1559 #          omitted, the device name will be used. (Since 2.7)
1561 # @device: the device name or node-name of a root node
1563 # @base-node: The node name of the backing image to write data into.
1564 #             If not specified, this is the deepest backing image.
1565 #             (since: 3.1)
1567 # @base: Same as @base-node, except that it is a file name rather than a node
1568 #        name. This must be the exact filename string that was used to open the
1569 #        node; other strings, even if addressing the same file, are not
1570 #        accepted
1572 # @top-node: The node name of the backing image within the image chain
1573 #            which contains the topmost data to be committed down. If
1574 #            not specified, this is the active layer. (since: 3.1)
1576 # @top: Same as @top-node, except that it is a file name rather than a node
1577 #       name. This must be the exact filename string that was used to open the
1578 #       node; other strings, even if addressing the same file, are not
1579 #       accepted
1581 # @backing-file: The backing file string to write into the overlay
1582 #                image of 'top'.  If 'top' is the active layer,
1583 #                specifying a backing file string is an error. This
1584 #                filename is not validated.
1586 #                If a pathname string is such that it cannot be
1587 #                resolved by QEMU, that means that subsequent QMP or
1588 #                HMP commands must use node-names for the image in
1589 #                question, as filename lookup methods will fail.
1591 #                If not specified, QEMU will automatically determine
1592 #                the backing file string to use, or error out if
1593 #                there is no obvious choice. Care should be taken
1594 #                when specifying the string, to specify a valid
1595 #                filename or protocol.
1596 #                (Since 2.1)
1598 #                If top == base, that is an error.
1599 #                If top == active, the job will not be completed by itself,
1600 #                user needs to complete the job with the block-job-complete
1601 #                command after getting the ready event. (Since 2.0)
1603 #                If the base image is smaller than top, then the base image
1604 #                will be resized to be the same size as top.  If top is
1605 #                smaller than the base image, the base will not be
1606 #                truncated.  If you want the base image size to match the
1607 #                size of the smaller top, you can safely truncate it
1608 #                yourself once the commit operation successfully completes.
1610 # @speed: the maximum speed, in bytes per second
1612 # @on-error: the action to take on an error. 'ignore' means that the request
1613 #            should be retried. (default: report; Since: 5.0)
1615 # @filter-node-name: the node name that should be assigned to the
1616 #                    filter driver that the commit job inserts into the graph
1617 #                    above @top. If this option is not given, a node name is
1618 #                    autogenerated. (Since: 2.9)
1620 # @auto-finalize: When false, this job will wait in a PENDING state after it has
1621 #                 finished its work, waiting for @block-job-finalize before
1622 #                 making any block graph changes.
1623 #                 When true, this job will automatically
1624 #                 perform its abort or commit actions.
1625 #                 Defaults to true. (Since 3.1)
1627 # @auto-dismiss: When false, this job will wait in a CONCLUDED state after it
1628 #                has completely ceased all work, and awaits @block-job-dismiss.
1629 #                When true, this job will automatically disappear from the query
1630 #                list without user intervention.
1631 #                Defaults to true. (Since 3.1)
1633 # Features:
1634 # @deprecated: Members @base and @top are deprecated.  Use @base-node
1635 #     and @top-node instead.
1637 # Returns: - Nothing on success
1638 #          - If @device does not exist, DeviceNotFound
1639 #          - Any other error returns a GenericError.
1641 # Since: 1.3
1643 # Example:
1645 # -> { "execute": "block-commit",
1646 #      "arguments": { "device": "virtio0",
1647 #                     "top": "/tmp/snap1.qcow2" } }
1648 # <- { "return": {} }
1651 { 'command': 'block-commit',
1652   'data': { '*job-id': 'str', 'device': 'str', '*base-node': 'str',
1653             '*base': { 'type': 'str', 'features': [ 'deprecated' ] },
1654             '*top-node': 'str',
1655             '*top': { 'type': 'str', 'features': [ 'deprecated' ] },
1656             '*backing-file': 'str', '*speed': 'int',
1657             '*on-error': 'BlockdevOnError',
1658             '*filter-node-name': 'str',
1659             '*auto-finalize': 'bool', '*auto-dismiss': 'bool' } }
1662 # @drive-backup:
1664 # Start a point-in-time copy of a block device to a new destination.  The
1665 # status of ongoing drive-backup operations can be checked with
1666 # query-block-jobs where the BlockJobInfo.type field has the value 'backup'.
1667 # The operation can be stopped before it has completed using the
1668 # block-job-cancel command.
1670 # Returns: - nothing on success
1671 #          - If @device is not a valid block device, GenericError
1673 # Since: 1.6
1675 # Example:
1677 # -> { "execute": "drive-backup",
1678 #      "arguments": { "device": "drive0",
1679 #                     "sync": "full",
1680 #                     "target": "backup.img" } }
1681 # <- { "return": {} }
1684 { 'command': 'drive-backup', 'boxed': true,
1685   'data': 'DriveBackup' }
1688 # @blockdev-backup:
1690 # Start a point-in-time copy of a block device to a new destination.  The
1691 # status of ongoing blockdev-backup operations can be checked with
1692 # query-block-jobs where the BlockJobInfo.type field has the value 'backup'.
1693 # The operation can be stopped before it has completed using the
1694 # block-job-cancel command.
1696 # Returns: - nothing on success
1697 #          - If @device is not a valid block device, DeviceNotFound
1699 # Since: 2.3
1701 # Example:
1702 # -> { "execute": "blockdev-backup",
1703 #      "arguments": { "device": "src-id",
1704 #                     "sync": "full",
1705 #                     "target": "tgt-id" } }
1706 # <- { "return": {} }
1709 { 'command': 'blockdev-backup', 'boxed': true,
1710   'data': 'BlockdevBackup' }
1714 # @query-named-block-nodes:
1716 # Get the named block driver list
1718 # @flat: Omit the nested data about backing image ("backing-image" key) if true.
1719 #        Default is false (Since 5.0)
1721 # Returns: the list of BlockDeviceInfo
1723 # Since: 2.0
1725 # Example:
1727 # -> { "execute": "query-named-block-nodes" }
1728 # <- { "return": [ { "ro":false,
1729 #                    "drv":"qcow2",
1730 #                    "encrypted":false,
1731 #                    "file":"disks/test.qcow2",
1732 #                    "node-name": "my-node",
1733 #                    "backing_file_depth":1,
1734 #                    "bps":1000000,
1735 #                    "bps_rd":0,
1736 #                    "bps_wr":0,
1737 #                    "iops":1000000,
1738 #                    "iops_rd":0,
1739 #                    "iops_wr":0,
1740 #                    "bps_max": 8000000,
1741 #                    "bps_rd_max": 0,
1742 #                    "bps_wr_max": 0,
1743 #                    "iops_max": 0,
1744 #                    "iops_rd_max": 0,
1745 #                    "iops_wr_max": 0,
1746 #                    "iops_size": 0,
1747 #                    "write_threshold": 0,
1748 #                    "image":{
1749 #                       "filename":"disks/test.qcow2",
1750 #                       "format":"qcow2",
1751 #                       "virtual-size":2048000,
1752 #                       "backing_file":"base.qcow2",
1753 #                       "full-backing-filename":"disks/base.qcow2",
1754 #                       "backing-filename-format":"qcow2",
1755 #                       "snapshots":[
1756 #                          {
1757 #                             "id": "1",
1758 #                             "name": "snapshot1",
1759 #                             "vm-state-size": 0,
1760 #                             "date-sec": 10000200,
1761 #                             "date-nsec": 12,
1762 #                             "vm-clock-sec": 206,
1763 #                             "vm-clock-nsec": 30
1764 #                          }
1765 #                       ],
1766 #                       "backing-image":{
1767 #                           "filename":"disks/base.qcow2",
1768 #                           "format":"qcow2",
1769 #                           "virtual-size":2048000
1770 #                       }
1771 #                    } } ] }
1774 { 'command': 'query-named-block-nodes',
1775   'returns': [ 'BlockDeviceInfo' ],
1776   'data': { '*flat': 'bool' } }
1779 # @XDbgBlockGraphNodeType:
1781 # @block-backend: corresponds to BlockBackend
1783 # @block-job: corresonds to BlockJob
1785 # @block-driver: corresponds to BlockDriverState
1787 # Since: 4.0
1789 { 'enum': 'XDbgBlockGraphNodeType',
1790   'data': [ 'block-backend', 'block-job', 'block-driver' ] }
1793 # @XDbgBlockGraphNode:
1795 # @id: Block graph node identifier. This @id is generated only for
1796 #      x-debug-query-block-graph and does not relate to any other identifiers in
1797 #      Qemu.
1799 # @type: Type of graph node. Can be one of block-backend, block-job or
1800 #        block-driver-state.
1802 # @name: Human readable name of the node. Corresponds to node-name for
1803 #        block-driver-state nodes; is not guaranteed to be unique in the whole
1804 #        graph (with block-jobs and block-backends).
1806 # Since: 4.0
1808 { 'struct': 'XDbgBlockGraphNode',
1809   'data': { 'id': 'uint64', 'type': 'XDbgBlockGraphNodeType', 'name': 'str' } }
1812 # @BlockPermission:
1814 # Enum of base block permissions.
1816 # @consistent-read: A user that has the "permission" of consistent reads is
1817 #                   guaranteed that their view of the contents of the block
1818 #                   device is complete and self-consistent, representing the
1819 #                   contents of a disk at a specific point.
1820 #                   For most block devices (including their backing files) this
1821 #                   is true, but the property cannot be maintained in a few
1822 #                   situations like for intermediate nodes of a commit block
1823 #                   job.
1825 # @write: This permission is required to change the visible disk contents.
1827 # @write-unchanged: This permission (which is weaker than BLK_PERM_WRITE) is
1828 #                   both enough and required for writes to the block node when
1829 #                   the caller promises that the visible disk content doesn't
1830 #                   change.
1831 #                   As the BLK_PERM_WRITE permission is strictly stronger,
1832 #                   either is sufficient to perform an unchanging write.
1834 # @resize: This permission is required to change the size of a block node.
1836 # @graph-mod: This permission is required to change the node that this
1837 #             BdrvChild points to.
1839 # Since: 4.0
1841   { 'enum': 'BlockPermission',
1842     'data': [ 'consistent-read', 'write', 'write-unchanged', 'resize',
1843               'graph-mod' ] }
1845 # @XDbgBlockGraphEdge:
1847 # Block Graph edge description for x-debug-query-block-graph.
1849 # @parent: parent id
1851 # @child: child id
1853 # @name: name of the relation (examples are 'file' and 'backing')
1855 # @perm: granted permissions for the parent operating on the child
1857 # @shared-perm: permissions that can still be granted to other users of the
1858 #               child while it is still attached to this parent
1860 # Since: 4.0
1862 { 'struct': 'XDbgBlockGraphEdge',
1863   'data': { 'parent': 'uint64', 'child': 'uint64',
1864             'name': 'str', 'perm': [ 'BlockPermission' ],
1865             'shared-perm': [ 'BlockPermission' ] } }
1868 # @XDbgBlockGraph:
1870 # Block Graph - list of nodes and list of edges.
1872 # Since: 4.0
1874 { 'struct': 'XDbgBlockGraph',
1875   'data': { 'nodes': ['XDbgBlockGraphNode'], 'edges': ['XDbgBlockGraphEdge'] } }
1878 # @x-debug-query-block-graph:
1880 # Get the block graph.
1882 # Since: 4.0
1884 { 'command': 'x-debug-query-block-graph', 'returns': 'XDbgBlockGraph' }
1887 # @drive-mirror:
1889 # Start mirroring a block device's writes to a new destination. target
1890 # specifies the target of the new image. If the file exists, or if it
1891 # is a device, it will be used as the new destination for writes. If
1892 # it does not exist, a new file will be created. format specifies the
1893 # format of the mirror image, default is to probe if mode='existing',
1894 # else the format of the source.
1896 # Returns: - nothing on success
1897 #          - If @device is not a valid block device, GenericError
1899 # Since: 1.3
1901 # Example:
1903 # -> { "execute": "drive-mirror",
1904 #      "arguments": { "device": "ide-hd0",
1905 #                     "target": "/some/place/my-image",
1906 #                     "sync": "full",
1907 #                     "format": "qcow2" } }
1908 # <- { "return": {} }
1911 { 'command': 'drive-mirror', 'boxed': true,
1912   'data': 'DriveMirror' }
1915 # @DriveMirror:
1917 # A set of parameters describing drive mirror setup.
1919 # @job-id: identifier for the newly-created block job. If
1920 #          omitted, the device name will be used. (Since 2.7)
1922 # @device:  the device name or node-name of a root node whose writes should be
1923 #           mirrored.
1925 # @target: the target of the new image. If the file exists, or if it
1926 #          is a device, the existing file/device will be used as the new
1927 #          destination.  If it does not exist, a new file will be created.
1929 # @format: the format of the new destination, default is to
1930 #          probe if @mode is 'existing', else the format of the source
1932 # @node-name: the new block driver state node name in the graph
1933 #             (Since 2.1)
1935 # @replaces: with sync=full graph node name to be replaced by the new
1936 #            image when a whole image copy is done. This can be used to repair
1937 #            broken Quorum files. (Since 2.1)
1939 # @mode: whether and how QEMU should create a new image, default is
1940 #        'absolute-paths'.
1942 # @speed:  the maximum speed, in bytes per second
1944 # @sync: what parts of the disk image should be copied to the destination
1945 #        (all the disk, only the sectors allocated in the topmost image, or
1946 #        only new I/O).
1948 # @granularity: granularity of the dirty bitmap, default is 64K
1949 #               if the image format doesn't have clusters, 4K if the clusters
1950 #               are smaller than that, else the cluster size.  Must be a
1951 #               power of 2 between 512 and 64M (since 1.4).
1953 # @buf-size: maximum amount of data in flight from source to
1954 #            target (since 1.4).
1956 # @on-source-error: the action to take on an error on the source,
1957 #                   default 'report'.  'stop' and 'enospc' can only be used
1958 #                   if the block device supports io-status (see BlockInfo).
1960 # @on-target-error: the action to take on an error on the target,
1961 #                   default 'report' (no limitations, since this applies to
1962 #                   a different block device than @device).
1963 # @unmap: Whether to try to unmap target sectors where source has
1964 #         only zero. If true, and target unallocated sectors will read as zero,
1965 #         target image sectors will be unmapped; otherwise, zeroes will be
1966 #         written. Both will result in identical contents.
1967 #         Default is true. (Since 2.4)
1969 # @copy-mode: when to copy data to the destination; defaults to 'background'
1970 #             (Since: 3.0)
1972 # @auto-finalize: When false, this job will wait in a PENDING state after it has
1973 #                 finished its work, waiting for @block-job-finalize before
1974 #                 making any block graph changes.
1975 #                 When true, this job will automatically
1976 #                 perform its abort or commit actions.
1977 #                 Defaults to true. (Since 3.1)
1979 # @auto-dismiss: When false, this job will wait in a CONCLUDED state after it
1980 #                has completely ceased all work, and awaits @block-job-dismiss.
1981 #                When true, this job will automatically disappear from the query
1982 #                list without user intervention.
1983 #                Defaults to true. (Since 3.1)
1984 # Since: 1.3
1986 { 'struct': 'DriveMirror',
1987   'data': { '*job-id': 'str', 'device': 'str', 'target': 'str',
1988             '*format': 'str', '*node-name': 'str', '*replaces': 'str',
1989             'sync': 'MirrorSyncMode', '*mode': 'NewImageMode',
1990             '*speed': 'int', '*granularity': 'uint32',
1991             '*buf-size': 'int', '*on-source-error': 'BlockdevOnError',
1992             '*on-target-error': 'BlockdevOnError',
1993             '*unmap': 'bool', '*copy-mode': 'MirrorCopyMode',
1994             '*auto-finalize': 'bool', '*auto-dismiss': 'bool' } }
1997 # @BlockDirtyBitmap:
1999 # @node: name of device/node which the bitmap is tracking
2001 # @name: name of the dirty bitmap
2003 # Since: 2.4
2005 { 'struct': 'BlockDirtyBitmap',
2006   'data': { 'node': 'str', 'name': 'str' } }
2009 # @BlockDirtyBitmapAdd:
2011 # @node: name of device/node which the bitmap is tracking
2013 # @name: name of the dirty bitmap (must be less than 1024 bytes)
2015 # @granularity: the bitmap granularity, default is 64k for
2016 #               block-dirty-bitmap-add
2018 # @persistent: the bitmap is persistent, i.e. it will be saved to the
2019 #              corresponding block device image file on its close. For now only
2020 #              Qcow2 disks support persistent bitmaps. Default is false for
2021 #              block-dirty-bitmap-add. (Since: 2.10)
2023 # @disabled: the bitmap is created in the disabled state, which means that
2024 #            it will not track drive changes. The bitmap may be enabled with
2025 #            block-dirty-bitmap-enable. Default is false. (Since: 4.0)
2027 # Since: 2.4
2029 { 'struct': 'BlockDirtyBitmapAdd',
2030   'data': { 'node': 'str', 'name': 'str', '*granularity': 'uint32',
2031             '*persistent': 'bool', '*disabled': 'bool' } }
2034 # @BlockDirtyBitmapMergeSource:
2036 # @local: name of the bitmap, attached to the same node as target bitmap.
2038 # @external: bitmap with specified node
2040 # Since: 4.1
2042 { 'alternate': 'BlockDirtyBitmapMergeSource',
2043   'data': { 'local': 'str',
2044             'external': 'BlockDirtyBitmap' } }
2047 # @BlockDirtyBitmapMerge:
2049 # @node: name of device/node which the @target bitmap is tracking
2051 # @target: name of the destination dirty bitmap
2053 # @bitmaps: name(s) of the source dirty bitmap(s) at @node and/or fully
2054 #           specifed BlockDirtyBitmap elements. The latter are supported
2055 #           since 4.1.
2057 # Since: 4.0
2059 { 'struct': 'BlockDirtyBitmapMerge',
2060   'data': { 'node': 'str', 'target': 'str',
2061             'bitmaps': ['BlockDirtyBitmapMergeSource'] } }
2064 # @block-dirty-bitmap-add:
2066 # Create a dirty bitmap with a name on the node, and start tracking the writes.
2068 # Returns: - nothing on success
2069 #          - If @node is not a valid block device or node, DeviceNotFound
2070 #          - If @name is already taken, GenericError with an explanation
2072 # Since: 2.4
2074 # Example:
2076 # -> { "execute": "block-dirty-bitmap-add",
2077 #      "arguments": { "node": "drive0", "name": "bitmap0" } }
2078 # <- { "return": {} }
2081 { 'command': 'block-dirty-bitmap-add',
2082   'data': 'BlockDirtyBitmapAdd' }
2085 # @block-dirty-bitmap-remove:
2087 # Stop write tracking and remove the dirty bitmap that was created
2088 # with block-dirty-bitmap-add. If the bitmap is persistent, remove it from its
2089 # storage too.
2091 # Returns: - nothing on success
2092 #          - If @node is not a valid block device or node, DeviceNotFound
2093 #          - If @name is not found, GenericError with an explanation
2094 #          - if @name is frozen by an operation, GenericError
2096 # Since: 2.4
2098 # Example:
2100 # -> { "execute": "block-dirty-bitmap-remove",
2101 #      "arguments": { "node": "drive0", "name": "bitmap0" } }
2102 # <- { "return": {} }
2105 { 'command': 'block-dirty-bitmap-remove',
2106   'data': 'BlockDirtyBitmap' }
2109 # @block-dirty-bitmap-clear:
2111 # Clear (reset) a dirty bitmap on the device, so that an incremental
2112 # backup from this point in time forward will only backup clusters
2113 # modified after this clear operation.
2115 # Returns: - nothing on success
2116 #          - If @node is not a valid block device, DeviceNotFound
2117 #          - If @name is not found, GenericError with an explanation
2119 # Since: 2.4
2121 # Example:
2123 # -> { "execute": "block-dirty-bitmap-clear",
2124 #      "arguments": { "node": "drive0", "name": "bitmap0" } }
2125 # <- { "return": {} }
2128 { 'command': 'block-dirty-bitmap-clear',
2129   'data': 'BlockDirtyBitmap' }
2132 # @block-dirty-bitmap-enable:
2134 # Enables a dirty bitmap so that it will begin tracking disk changes.
2136 # Returns: - nothing on success
2137 #          - If @node is not a valid block device, DeviceNotFound
2138 #          - If @name is not found, GenericError with an explanation
2140 # Since: 4.0
2142 # Example:
2144 # -> { "execute": "block-dirty-bitmap-enable",
2145 #      "arguments": { "node": "drive0", "name": "bitmap0" } }
2146 # <- { "return": {} }
2149   { 'command': 'block-dirty-bitmap-enable',
2150     'data': 'BlockDirtyBitmap' }
2153 # @block-dirty-bitmap-disable:
2155 # Disables a dirty bitmap so that it will stop tracking disk changes.
2157 # Returns: - nothing on success
2158 #          - If @node is not a valid block device, DeviceNotFound
2159 #          - If @name is not found, GenericError with an explanation
2161 # Since: 4.0
2163 # Example:
2165 # -> { "execute": "block-dirty-bitmap-disable",
2166 #      "arguments": { "node": "drive0", "name": "bitmap0" } }
2167 # <- { "return": {} }
2170     { 'command': 'block-dirty-bitmap-disable',
2171       'data': 'BlockDirtyBitmap' }
2174 # @block-dirty-bitmap-merge:
2176 # Merge dirty bitmaps listed in @bitmaps to the @target dirty bitmap.
2177 # Dirty bitmaps in @bitmaps will be unchanged, except if it also appears
2178 # as the @target bitmap. Any bits already set in @target will still be
2179 # set after the merge, i.e., this operation does not clear the target.
2180 # On error, @target is unchanged.
2182 # The resulting bitmap will count as dirty any clusters that were dirty in any
2183 # of the source bitmaps. This can be used to achieve backup checkpoints, or in
2184 # simpler usages, to copy bitmaps.
2186 # Returns: - nothing on success
2187 #          - If @node is not a valid block device, DeviceNotFound
2188 #          - If any bitmap in @bitmaps or @target is not found, GenericError
2189 #          - If any of the bitmaps have different sizes or granularities,
2190 #            GenericError
2192 # Since: 4.0
2194 # Example:
2196 # -> { "execute": "block-dirty-bitmap-merge",
2197 #      "arguments": { "node": "drive0", "target": "bitmap0",
2198 #                     "bitmaps": ["bitmap1"] } }
2199 # <- { "return": {} }
2202       { 'command': 'block-dirty-bitmap-merge',
2203         'data': 'BlockDirtyBitmapMerge' }
2206 # @BlockDirtyBitmapSha256:
2208 # SHA256 hash of dirty bitmap data
2210 # @sha256: ASCII representation of SHA256 bitmap hash
2212 # Since: 2.10
2214   { 'struct': 'BlockDirtyBitmapSha256',
2215     'data': {'sha256': 'str'} }
2218 # @x-debug-block-dirty-bitmap-sha256:
2220 # Get bitmap SHA256.
2222 # Returns: - BlockDirtyBitmapSha256 on success
2223 #          - If @node is not a valid block device, DeviceNotFound
2224 #          - If @name is not found or if hashing has failed, GenericError with an
2225 #            explanation
2227 # Since: 2.10
2229   { 'command': 'x-debug-block-dirty-bitmap-sha256',
2230     'data': 'BlockDirtyBitmap', 'returns': 'BlockDirtyBitmapSha256' }
2233 # @blockdev-mirror:
2235 # Start mirroring a block device's writes to a new destination.
2237 # @job-id: identifier for the newly-created block job. If
2238 #          omitted, the device name will be used. (Since 2.7)
2240 # @device: The device name or node-name of a root node whose writes should be
2241 #          mirrored.
2243 # @target: the id or node-name of the block device to mirror to. This mustn't be
2244 #          attached to guest.
2246 # @replaces: with sync=full graph node name to be replaced by the new
2247 #            image when a whole image copy is done. This can be used to repair
2248 #            broken Quorum files.
2250 # @speed:  the maximum speed, in bytes per second
2252 # @sync: what parts of the disk image should be copied to the destination
2253 #        (all the disk, only the sectors allocated in the topmost image, or
2254 #        only new I/O).
2256 # @granularity: granularity of the dirty bitmap, default is 64K
2257 #               if the image format doesn't have clusters, 4K if the clusters
2258 #               are smaller than that, else the cluster size.  Must be a
2259 #               power of 2 between 512 and 64M
2261 # @buf-size: maximum amount of data in flight from source to
2262 #            target
2264 # @on-source-error: the action to take on an error on the source,
2265 #                   default 'report'.  'stop' and 'enospc' can only be used
2266 #                   if the block device supports io-status (see BlockInfo).
2268 # @on-target-error: the action to take on an error on the target,
2269 #                   default 'report' (no limitations, since this applies to
2270 #                   a different block device than @device).
2272 # @filter-node-name: the node name that should be assigned to the
2273 #                    filter driver that the mirror job inserts into the graph
2274 #                    above @device. If this option is not given, a node name is
2275 #                    autogenerated. (Since: 2.9)
2277 # @copy-mode: when to copy data to the destination; defaults to 'background'
2278 #             (Since: 3.0)
2280 # @auto-finalize: When false, this job will wait in a PENDING state after it has
2281 #                 finished its work, waiting for @block-job-finalize before
2282 #                 making any block graph changes.
2283 #                 When true, this job will automatically
2284 #                 perform its abort or commit actions.
2285 #                 Defaults to true. (Since 3.1)
2287 # @auto-dismiss: When false, this job will wait in a CONCLUDED state after it
2288 #                has completely ceased all work, and awaits @block-job-dismiss.
2289 #                When true, this job will automatically disappear from the query
2290 #                list without user intervention.
2291 #                Defaults to true. (Since 3.1)
2292 # Returns: nothing on success.
2294 # Since: 2.6
2296 # Example:
2298 # -> { "execute": "blockdev-mirror",
2299 #      "arguments": { "device": "ide-hd0",
2300 #                     "target": "target0",
2301 #                     "sync": "full" } }
2302 # <- { "return": {} }
2305 { 'command': 'blockdev-mirror',
2306   'data': { '*job-id': 'str', 'device': 'str', 'target': 'str',
2307             '*replaces': 'str',
2308             'sync': 'MirrorSyncMode',
2309             '*speed': 'int', '*granularity': 'uint32',
2310             '*buf-size': 'int', '*on-source-error': 'BlockdevOnError',
2311             '*on-target-error': 'BlockdevOnError',
2312             '*filter-node-name': 'str',
2313             '*copy-mode': 'MirrorCopyMode',
2314             '*auto-finalize': 'bool', '*auto-dismiss': 'bool' } }
2317 # @BlockIOThrottle:
2319 # A set of parameters describing block throttling.
2321 # @device: Block device name
2323 # @id: The name or QOM path of the guest device (since: 2.8)
2325 # @bps: total throughput limit in bytes per second
2327 # @bps_rd: read throughput limit in bytes per second
2329 # @bps_wr: write throughput limit in bytes per second
2331 # @iops: total I/O operations per second
2333 # @iops_rd: read I/O operations per second
2335 # @iops_wr: write I/O operations per second
2337 # @bps_max: total throughput limit during bursts,
2338 #           in bytes (Since 1.7)
2340 # @bps_rd_max: read throughput limit during bursts,
2341 #              in bytes (Since 1.7)
2343 # @bps_wr_max: write throughput limit during bursts,
2344 #              in bytes (Since 1.7)
2346 # @iops_max: total I/O operations per second during bursts,
2347 #            in bytes (Since 1.7)
2349 # @iops_rd_max: read I/O operations per second during bursts,
2350 #               in bytes (Since 1.7)
2352 # @iops_wr_max: write I/O operations per second during bursts,
2353 #               in bytes (Since 1.7)
2355 # @bps_max_length: maximum length of the @bps_max burst
2356 #                  period, in seconds. It must only
2357 #                  be set if @bps_max is set as well.
2358 #                  Defaults to 1. (Since 2.6)
2360 # @bps_rd_max_length: maximum length of the @bps_rd_max
2361 #                     burst period, in seconds. It must only
2362 #                     be set if @bps_rd_max is set as well.
2363 #                     Defaults to 1. (Since 2.6)
2365 # @bps_wr_max_length: maximum length of the @bps_wr_max
2366 #                     burst period, in seconds. It must only
2367 #                     be set if @bps_wr_max is set as well.
2368 #                     Defaults to 1. (Since 2.6)
2370 # @iops_max_length: maximum length of the @iops burst
2371 #                   period, in seconds. It must only
2372 #                   be set if @iops_max is set as well.
2373 #                   Defaults to 1. (Since 2.6)
2375 # @iops_rd_max_length: maximum length of the @iops_rd_max
2376 #                      burst period, in seconds. It must only
2377 #                      be set if @iops_rd_max is set as well.
2378 #                      Defaults to 1. (Since 2.6)
2380 # @iops_wr_max_length: maximum length of the @iops_wr_max
2381 #                      burst period, in seconds. It must only
2382 #                      be set if @iops_wr_max is set as well.
2383 #                      Defaults to 1. (Since 2.6)
2385 # @iops_size: an I/O size in bytes (Since 1.7)
2387 # @group: throttle group name (Since 2.4)
2389 # Features:
2390 # @deprecated: Member @device is deprecated.  Use @id instead.
2392 # Since: 1.1
2394 { 'struct': 'BlockIOThrottle',
2395   'data': { '*device': { 'type': 'str', 'features': [ 'deprecated' ] },
2396             '*id': 'str', 'bps': 'int', 'bps_rd': 'int',
2397             'bps_wr': 'int', 'iops': 'int', 'iops_rd': 'int', 'iops_wr': 'int',
2398             '*bps_max': 'int', '*bps_rd_max': 'int',
2399             '*bps_wr_max': 'int', '*iops_max': 'int',
2400             '*iops_rd_max': 'int', '*iops_wr_max': 'int',
2401             '*bps_max_length': 'int', '*bps_rd_max_length': 'int',
2402             '*bps_wr_max_length': 'int', '*iops_max_length': 'int',
2403             '*iops_rd_max_length': 'int', '*iops_wr_max_length': 'int',
2404             '*iops_size': 'int', '*group': 'str' } }
2407 # @ThrottleLimits:
2409 # Limit parameters for throttling.
2410 # Since some limit combinations are illegal, limits should always be set in one
2411 # transaction. All fields are optional. When setting limits, if a field is
2412 # missing the current value is not changed.
2414 # @iops-total: limit total I/O operations per second
2415 # @iops-total-max: I/O operations burst
2416 # @iops-total-max-length: length of the iops-total-max burst period, in seconds
2417 #                         It must only be set if @iops-total-max is set as well.
2418 # @iops-read: limit read operations per second
2419 # @iops-read-max: I/O operations read burst
2420 # @iops-read-max-length: length of the iops-read-max burst period, in seconds
2421 #                        It must only be set if @iops-read-max is set as well.
2422 # @iops-write: limit write operations per second
2423 # @iops-write-max: I/O operations write burst
2424 # @iops-write-max-length: length of the iops-write-max burst period, in seconds
2425 #                         It must only be set if @iops-write-max is set as well.
2426 # @bps-total: limit total bytes per second
2427 # @bps-total-max: total bytes burst
2428 # @bps-total-max-length: length of the bps-total-max burst period, in seconds.
2429 #                        It must only be set if @bps-total-max is set as well.
2430 # @bps-read: limit read bytes per second
2431 # @bps-read-max: total bytes read burst
2432 # @bps-read-max-length: length of the bps-read-max burst period, in seconds
2433 #                       It must only be set if @bps-read-max is set as well.
2434 # @bps-write: limit write bytes per second
2435 # @bps-write-max: total bytes write burst
2436 # @bps-write-max-length: length of the bps-write-max burst period, in seconds
2437 #                        It must only be set if @bps-write-max is set as well.
2438 # @iops-size: when limiting by iops max size of an I/O in bytes
2440 # Since: 2.11
2442 { 'struct': 'ThrottleLimits',
2443   'data': { '*iops-total' : 'int', '*iops-total-max' : 'int',
2444             '*iops-total-max-length' : 'int', '*iops-read' : 'int',
2445             '*iops-read-max' : 'int', '*iops-read-max-length' : 'int',
2446             '*iops-write' : 'int', '*iops-write-max' : 'int',
2447             '*iops-write-max-length' : 'int', '*bps-total' : 'int',
2448             '*bps-total-max' : 'int', '*bps-total-max-length' : 'int',
2449             '*bps-read' : 'int', '*bps-read-max' : 'int',
2450             '*bps-read-max-length' : 'int', '*bps-write' : 'int',
2451             '*bps-write-max' : 'int', '*bps-write-max-length' : 'int',
2452             '*iops-size' : 'int' } }
2455 # @block-stream:
2457 # Copy data from a backing file into a block device.
2459 # The block streaming operation is performed in the background until the entire
2460 # backing file has been copied.  This command returns immediately once streaming
2461 # has started.  The status of ongoing block streaming operations can be checked
2462 # with query-block-jobs.  The operation can be stopped before it has completed
2463 # using the block-job-cancel command.
2465 # The node that receives the data is called the top image, can be located in
2466 # any part of the chain (but always above the base image; see below) and can be
2467 # specified using its device or node name. Earlier qemu versions only allowed
2468 # 'device' to name the top level node; presence of the 'base-node' parameter
2469 # during introspection can be used as a witness of the enhanced semantics
2470 # of 'device'.
2472 # If a base file is specified then sectors are not copied from that base file and
2473 # its backing chain.  When streaming completes the image file will have the base
2474 # file as its backing file.  This can be used to stream a subset of the backing
2475 # file chain instead of flattening the entire image.
2477 # On successful completion the image file is updated to drop the backing file
2478 # and the BLOCK_JOB_COMPLETED event is emitted.
2480 # @job-id: identifier for the newly-created block job. If
2481 #          omitted, the device name will be used. (Since 2.7)
2483 # @device: the device or node name of the top image
2485 # @base: the common backing file name.
2486 #        It cannot be set if @base-node is also set.
2488 # @base-node: the node name of the backing file.
2489 #             It cannot be set if @base is also set. (Since 2.8)
2491 # @backing-file: The backing file string to write into the top
2492 #                image. This filename is not validated.
2494 #                If a pathname string is such that it cannot be
2495 #                resolved by QEMU, that means that subsequent QMP or
2496 #                HMP commands must use node-names for the image in
2497 #                question, as filename lookup methods will fail.
2499 #                If not specified, QEMU will automatically determine
2500 #                the backing file string to use, or error out if there
2501 #                is no obvious choice.  Care should be taken when
2502 #                specifying the string, to specify a valid filename or
2503 #                protocol.
2504 #                (Since 2.1)
2506 # @speed: the maximum speed, in bytes per second
2508 # @on-error: the action to take on an error (default report).
2509 #            'stop' and 'enospc' can only be used if the block device
2510 #            supports io-status (see BlockInfo).  Since 1.3.
2512 # @auto-finalize: When false, this job will wait in a PENDING state after it has
2513 #                 finished its work, waiting for @block-job-finalize before
2514 #                 making any block graph changes.
2515 #                 When true, this job will automatically
2516 #                 perform its abort or commit actions.
2517 #                 Defaults to true. (Since 3.1)
2519 # @auto-dismiss: When false, this job will wait in a CONCLUDED state after it
2520 #                has completely ceased all work, and awaits @block-job-dismiss.
2521 #                When true, this job will automatically disappear from the query
2522 #                list without user intervention.
2523 #                Defaults to true. (Since 3.1)
2525 # Returns: - Nothing on success.
2526 #          - If @device does not exist, DeviceNotFound.
2528 # Since: 1.1
2530 # Example:
2532 # -> { "execute": "block-stream",
2533 #      "arguments": { "device": "virtio0",
2534 #                     "base": "/tmp/master.qcow2" } }
2535 # <- { "return": {} }
2538 { 'command': 'block-stream',
2539   'data': { '*job-id': 'str', 'device': 'str', '*base': 'str',
2540             '*base-node': 'str', '*backing-file': 'str', '*speed': 'int',
2541             '*on-error': 'BlockdevOnError',
2542             '*auto-finalize': 'bool', '*auto-dismiss': 'bool' } }
2545 # @block-job-set-speed:
2547 # Set maximum speed for a background block operation.
2549 # This command can only be issued when there is an active block job.
2551 # Throttling can be disabled by setting the speed to 0.
2553 # @device: The job identifier. This used to be a device name (hence
2554 #          the name of the parameter), but since QEMU 2.7 it can have
2555 #          other values.
2557 # @speed: the maximum speed, in bytes per second, or 0 for unlimited.
2558 #         Defaults to 0.
2560 # Returns: - Nothing on success
2561 #          - If no background operation is active on this device, DeviceNotActive
2563 # Since: 1.1
2565 { 'command': 'block-job-set-speed',
2566   'data': { 'device': 'str', 'speed': 'int' } }
2569 # @block-job-cancel:
2571 # Stop an active background block operation.
2573 # This command returns immediately after marking the active background block
2574 # operation for cancellation.  It is an error to call this command if no
2575 # operation is in progress.
2577 # The operation will cancel as soon as possible and then emit the
2578 # BLOCK_JOB_CANCELLED event.  Before that happens the job is still visible when
2579 # enumerated using query-block-jobs.
2581 # Note that if you issue 'block-job-cancel' after 'drive-mirror' has indicated
2582 # (via the event BLOCK_JOB_READY) that the source and destination are
2583 # synchronized, then the event triggered by this command changes to
2584 # BLOCK_JOB_COMPLETED, to indicate that the mirroring has ended and the
2585 # destination now has a point-in-time copy tied to the time of the cancellation.
2587 # For streaming, the image file retains its backing file unless the streaming
2588 # operation happens to complete just as it is being cancelled.  A new streaming
2589 # operation can be started at a later time to finish copying all data from the
2590 # backing file.
2592 # @device: The job identifier. This used to be a device name (hence
2593 #          the name of the parameter), but since QEMU 2.7 it can have
2594 #          other values.
2596 # @force: If true, and the job has already emitted the event BLOCK_JOB_READY,
2597 #         abandon the job immediately (even if it is paused) instead of waiting
2598 #         for the destination to complete its final synchronization (since 1.3)
2600 # Returns: - Nothing on success
2601 #          - If no background operation is active on this device, DeviceNotActive
2603 # Since: 1.1
2605 { 'command': 'block-job-cancel', 'data': { 'device': 'str', '*force': 'bool' } }
2608 # @block-job-pause:
2610 # Pause an active background block operation.
2612 # This command returns immediately after marking the active background block
2613 # operation for pausing.  It is an error to call this command if no
2614 # operation is in progress or if the job is already paused.
2616 # The operation will pause as soon as possible.  No event is emitted when
2617 # the operation is actually paused.  Cancelling a paused job automatically
2618 # resumes it.
2620 # @device: The job identifier. This used to be a device name (hence
2621 #          the name of the parameter), but since QEMU 2.7 it can have
2622 #          other values.
2624 # Returns: - Nothing on success
2625 #          - If no background operation is active on this device, DeviceNotActive
2627 # Since: 1.3
2629 { 'command': 'block-job-pause', 'data': { 'device': 'str' } }
2632 # @block-job-resume:
2634 # Resume an active background block operation.
2636 # This command returns immediately after resuming a paused background block
2637 # operation.  It is an error to call this command if no operation is in
2638 # progress or if the job is not paused.
2640 # This command also clears the error status of the job.
2642 # @device: The job identifier. This used to be a device name (hence
2643 #          the name of the parameter), but since QEMU 2.7 it can have
2644 #          other values.
2646 # Returns: - Nothing on success
2647 #          - If no background operation is active on this device, DeviceNotActive
2649 # Since: 1.3
2651 { 'command': 'block-job-resume', 'data': { 'device': 'str' } }
2654 # @block-job-complete:
2656 # Manually trigger completion of an active background block operation.  This
2657 # is supported for drive mirroring, where it also switches the device to
2658 # write to the target path only.  The ability to complete is signaled with
2659 # a BLOCK_JOB_READY event.
2661 # This command completes an active background block operation synchronously.
2662 # The ordering of this command's return with the BLOCK_JOB_COMPLETED event
2663 # is not defined.  Note that if an I/O error occurs during the processing of
2664 # this command: 1) the command itself will fail; 2) the error will be processed
2665 # according to the rerror/werror arguments that were specified when starting
2666 # the operation.
2668 # A cancelled or paused job cannot be completed.
2670 # @device: The job identifier. This used to be a device name (hence
2671 #          the name of the parameter), but since QEMU 2.7 it can have
2672 #          other values.
2674 # Returns: - Nothing on success
2675 #          - If no background operation is active on this device, DeviceNotActive
2677 # Since: 1.3
2679 { 'command': 'block-job-complete', 'data': { 'device': 'str' } }
2682 # @block-job-dismiss:
2684 # For jobs that have already concluded, remove them from the block-job-query
2685 # list. This command only needs to be run for jobs which were started with
2686 # QEMU 2.12+ job lifetime management semantics.
2688 # This command will refuse to operate on any job that has not yet reached
2689 # its terminal state, JOB_STATUS_CONCLUDED. For jobs that make use of the
2690 # BLOCK_JOB_READY event, block-job-cancel or block-job-complete will still need
2691 # to be used as appropriate.
2693 # @id: The job identifier.
2695 # Returns: Nothing on success
2697 # Since: 2.12
2699 { 'command': 'block-job-dismiss', 'data': { 'id': 'str' } }
2702 # @block-job-finalize:
2704 # Once a job that has manual=true reaches the pending state, it can be
2705 # instructed to finalize any graph changes and do any necessary cleanup
2706 # via this command.
2707 # For jobs in a transaction, instructing one job to finalize will force
2708 # ALL jobs in the transaction to finalize, so it is only necessary to instruct
2709 # a single member job to finalize.
2711 # @id: The job identifier.
2713 # Returns: Nothing on success
2715 # Since: 2.12
2717 { 'command': 'block-job-finalize', 'data': { 'id': 'str' } }
2720 # @BlockdevDiscardOptions:
2722 # Determines how to handle discard requests.
2724 # @ignore: Ignore the request
2725 # @unmap: Forward as an unmap request
2727 # Since: 2.9
2729 { 'enum': 'BlockdevDiscardOptions',
2730   'data': [ 'ignore', 'unmap' ] }
2733 # @BlockdevDetectZeroesOptions:
2735 # Describes the operation mode for the automatic conversion of plain
2736 # zero writes by the OS to driver specific optimized zero write commands.
2738 # @off: Disabled (default)
2739 # @on: Enabled
2740 # @unmap: Enabled and even try to unmap blocks if possible. This requires
2741 #         also that @BlockdevDiscardOptions is set to unmap for this device.
2743 # Since: 2.1
2745 { 'enum': 'BlockdevDetectZeroesOptions',
2746   'data': [ 'off', 'on', 'unmap' ] }
2749 # @BlockdevAioOptions:
2751 # Selects the AIO backend to handle I/O requests
2753 # @threads: Use qemu's thread pool
2754 # @native: Use native AIO backend (only Linux and Windows)
2755 # @io_uring: Use linux io_uring (since 5.0)
2757 # Since: 2.9
2759 { 'enum': 'BlockdevAioOptions',
2760   'data': [ 'threads', 'native',
2761             { 'name': 'io_uring', 'if': 'defined(CONFIG_LINUX_IO_URING)' } ] }
2764 # @BlockdevCacheOptions:
2766 # Includes cache-related options for block devices
2768 # @direct: enables use of O_DIRECT (bypass the host page cache;
2769 #          default: false)
2770 # @no-flush: ignore any flush requests for the device (default:
2771 #            false)
2773 # Since: 2.9
2775 { 'struct': 'BlockdevCacheOptions',
2776   'data': { '*direct': 'bool',
2777             '*no-flush': 'bool' } }
2780 # @BlockdevDriver:
2782 # Drivers that are supported in block device operations.
2784 # @vxhs: Since 2.10
2785 # @throttle: Since 2.11
2786 # @nvme: Since 2.12
2787 # @copy-on-read: Since 3.0
2788 # @blklogwrites: Since 3.0
2789 # @blkreplay: Since 4.2
2790 # @compress: Since 5.0
2792 # Since: 2.9
2794 { 'enum': 'BlockdevDriver',
2795   'data': [ 'blkdebug', 'blklogwrites', 'blkreplay', 'blkverify', 'bochs',
2796             'cloop', 'compress', 'copy-on-read', 'dmg', 'file', 'ftp', 'ftps',
2797             'gluster', 'host_cdrom', 'host_device', 'http', 'https', 'iscsi',
2798             'luks', 'nbd', 'nfs', 'null-aio', 'null-co', 'nvme', 'parallels',
2799             'qcow', 'qcow2', 'qed', 'quorum', 'raw', 'rbd',
2800             { 'name': 'replication', 'if': 'defined(CONFIG_REPLICATION)' },
2801             'sheepdog',
2802             'ssh', 'throttle', 'vdi', 'vhdx', 'vmdk', 'vpc', 'vvfat', 'vxhs' ] }
2805 # @BlockdevOptionsFile:
2807 # Driver specific block device options for the file backend.
2809 # @filename: path to the image file
2810 # @pr-manager: the id for the object that will handle persistent reservations
2811 #              for this device (default: none, forward the commands via SG_IO;
2812 #              since 2.11)
2813 # @aio: AIO backend (default: threads) (since: 2.8)
2814 # @locking: whether to enable file locking. If set to 'auto', only enable
2815 #           when Open File Descriptor (OFD) locking API is available
2816 #           (default: auto, since 2.10)
2817 # @drop-cache: invalidate page cache during live migration.  This prevents
2818 #              stale data on the migration destination with cache.direct=off.
2819 #              Currently only supported on Linux hosts.
2820 #              (default: on, since: 4.0)
2821 # @x-check-cache-dropped: whether to check that page cache was dropped on live
2822 #                         migration.  May cause noticeable delays if the image
2823 #                         file is large, do not use in production.
2824 #                         (default: off) (since: 3.0)
2826 # Features:
2827 # @dynamic-auto-read-only: If present, enabled auto-read-only means that the
2828 #                          driver will open the image read-only at first,
2829 #                          dynamically reopen the image file read-write when
2830 #                          the first writer is attached to the node and reopen
2831 #                          read-only when the last writer is detached. This
2832 #                          allows giving QEMU write permissions only on demand
2833 #                          when an operation actually needs write access.
2835 # Since: 2.9
2837 { 'struct': 'BlockdevOptionsFile',
2838   'data': { 'filename': 'str',
2839             '*pr-manager': 'str',
2840             '*locking': 'OnOffAuto',
2841             '*aio': 'BlockdevAioOptions',
2842             '*drop-cache': {'type': 'bool',
2843                             'if': 'defined(CONFIG_LINUX)'},
2844             '*x-check-cache-dropped': 'bool' },
2845   'features': [ { 'name': 'dynamic-auto-read-only',
2846                   'if': 'defined(CONFIG_POSIX)' } ] }
2849 # @BlockdevOptionsNull:
2851 # Driver specific block device options for the null backend.
2853 # @size: size of the device in bytes.
2854 # @latency-ns: emulated latency (in nanoseconds) in processing
2855 #              requests. Default to zero which completes requests immediately.
2856 #              (Since 2.4)
2857 # @read-zeroes: if true, reads from the device produce zeroes; if false, the
2858 #               buffer is left unchanged. (default: false; since: 4.1)
2860 # Since: 2.9
2862 { 'struct': 'BlockdevOptionsNull',
2863   'data': { '*size': 'int', '*latency-ns': 'uint64', '*read-zeroes': 'bool' } }
2866 # @BlockdevOptionsNVMe:
2868 # Driver specific block device options for the NVMe backend.
2870 # @device: PCI controller address of the NVMe device in
2871 #          format hhhh:bb:ss.f (host:bus:slot.function)
2872 # @namespace: namespace number of the device, starting from 1.
2874 # Note that the PCI @device must have been unbound from any host
2875 # kernel driver before instructing QEMU to add the blockdev.
2877 # Since: 2.12
2879 { 'struct': 'BlockdevOptionsNVMe',
2880   'data': { 'device': 'str', 'namespace': 'int' } }
2883 # @BlockdevOptionsVVFAT:
2885 # Driver specific block device options for the vvfat protocol.
2887 # @dir: directory to be exported as FAT image
2888 # @fat-type: FAT type: 12, 16 or 32
2889 # @floppy: whether to export a floppy image (true) or
2890 #          partitioned hard disk (false; default)
2891 # @label: set the volume label, limited to 11 bytes. FAT16 and
2892 #         FAT32 traditionally have some restrictions on labels, which are
2893 #         ignored by most operating systems. Defaults to "QEMU VVFAT".
2894 #         (since 2.4)
2895 # @rw: whether to allow write operations (default: false)
2897 # Since: 2.9
2899 { 'struct': 'BlockdevOptionsVVFAT',
2900   'data': { 'dir': 'str', '*fat-type': 'int', '*floppy': 'bool',
2901             '*label': 'str', '*rw': 'bool' } }
2904 # @BlockdevOptionsGenericFormat:
2906 # Driver specific block device options for image format that have no option
2907 # besides their data source.
2909 # @file: reference to or definition of the data source block device
2911 # Since: 2.9
2913 { 'struct': 'BlockdevOptionsGenericFormat',
2914   'data': { 'file': 'BlockdevRef' } }
2917 # @BlockdevOptionsLUKS:
2919 # Driver specific block device options for LUKS.
2921 # @key-secret: the ID of a QCryptoSecret object providing
2922 #              the decryption key (since 2.6). Mandatory except when
2923 #              doing a metadata-only probe of the image.
2925 # Since: 2.9
2927 { 'struct': 'BlockdevOptionsLUKS',
2928   'base': 'BlockdevOptionsGenericFormat',
2929   'data': { '*key-secret': 'str' } }
2933 # @BlockdevOptionsGenericCOWFormat:
2935 # Driver specific block device options for image format that have no option
2936 # besides their data source and an optional backing file.
2938 # @backing: reference to or definition of the backing file block
2939 #           device, null disables the backing file entirely.
2940 #           Defaults to the backing file stored the image file.
2942 # Since: 2.9
2944 { 'struct': 'BlockdevOptionsGenericCOWFormat',
2945   'base': 'BlockdevOptionsGenericFormat',
2946   'data': { '*backing': 'BlockdevRefOrNull' } }
2949 # @Qcow2OverlapCheckMode:
2951 # General overlap check modes.
2953 # @none: Do not perform any checks
2955 # @constant: Perform only checks which can be done in constant time and
2956 #            without reading anything from disk
2958 # @cached: Perform only checks which can be done without reading anything
2959 #          from disk
2961 # @all: Perform all available overlap checks
2963 # Since: 2.9
2965 { 'enum': 'Qcow2OverlapCheckMode',
2966   'data': [ 'none', 'constant', 'cached', 'all' ] }
2969 # @Qcow2OverlapCheckFlags:
2971 # Structure of flags for each metadata structure. Setting a field to 'true'
2972 # makes qemu guard that structure against unintended overwriting. The default
2973 # value is chosen according to the template given.
2975 # @template: Specifies a template mode which can be adjusted using the other
2976 #            flags, defaults to 'cached'
2978 # @bitmap-directory: since 3.0
2980 # Since: 2.9
2982 { 'struct': 'Qcow2OverlapCheckFlags',
2983   'data': { '*template':         'Qcow2OverlapCheckMode',
2984             '*main-header':      'bool',
2985             '*active-l1':        'bool',
2986             '*active-l2':        'bool',
2987             '*refcount-table':   'bool',
2988             '*refcount-block':   'bool',
2989             '*snapshot-table':   'bool',
2990             '*inactive-l1':      'bool',
2991             '*inactive-l2':      'bool',
2992             '*bitmap-directory': 'bool' } }
2995 # @Qcow2OverlapChecks:
2997 # Specifies which metadata structures should be guarded against unintended
2998 # overwriting.
3000 # @flags: set of flags for separate specification of each metadata structure
3001 #         type
3003 # @mode: named mode which chooses a specific set of flags
3005 # Since: 2.9
3007 { 'alternate': 'Qcow2OverlapChecks',
3008   'data': { 'flags': 'Qcow2OverlapCheckFlags',
3009             'mode':  'Qcow2OverlapCheckMode' } }
3012 # @BlockdevQcowEncryptionFormat:
3014 # @aes: AES-CBC with plain64 initialization vectors
3016 # Since: 2.10
3018 { 'enum': 'BlockdevQcowEncryptionFormat',
3019   'data': [ 'aes' ] }
3022 # @BlockdevQcowEncryption:
3024 # Since: 2.10
3026 { 'union': 'BlockdevQcowEncryption',
3027   'base': { 'format': 'BlockdevQcowEncryptionFormat' },
3028   'discriminator': 'format',
3029   'data': { 'aes': 'QCryptoBlockOptionsQCow' } }
3032 # @BlockdevOptionsQcow:
3034 # Driver specific block device options for qcow.
3036 # @encrypt: Image decryption options. Mandatory for
3037 #           encrypted images, except when doing a metadata-only
3038 #           probe of the image.
3040 # Since: 2.10
3042 { 'struct': 'BlockdevOptionsQcow',
3043   'base': 'BlockdevOptionsGenericCOWFormat',
3044   'data': { '*encrypt': 'BlockdevQcowEncryption' } }
3049 # @BlockdevQcow2EncryptionFormat:
3050 # @aes: AES-CBC with plain64 initialization vectors
3052 # Since: 2.10
3054 { 'enum': 'BlockdevQcow2EncryptionFormat',
3055   'data': [ 'aes', 'luks' ] }
3058 # @BlockdevQcow2Encryption:
3060 # Since: 2.10
3062 { 'union': 'BlockdevQcow2Encryption',
3063   'base': { 'format': 'BlockdevQcow2EncryptionFormat' },
3064   'discriminator': 'format',
3065   'data': { 'aes': 'QCryptoBlockOptionsQCow',
3066             'luks': 'QCryptoBlockOptionsLUKS'} }
3069 # @BlockdevOptionsQcow2:
3071 # Driver specific block device options for qcow2.
3073 # @lazy-refcounts: whether to enable the lazy refcounts
3074 #                  feature (default is taken from the image file)
3076 # @pass-discard-request: whether discard requests to the qcow2
3077 #                        device should be forwarded to the data source
3079 # @pass-discard-snapshot: whether discard requests for the data source
3080 #                         should be issued when a snapshot operation (e.g.
3081 #                         deleting a snapshot) frees clusters in the qcow2 file
3083 # @pass-discard-other: whether discard requests for the data source
3084 #                      should be issued on other occasions where a cluster
3085 #                      gets freed
3087 # @overlap-check: which overlap checks to perform for writes
3088 #                 to the image, defaults to 'cached' (since 2.2)
3090 # @cache-size: the maximum total size of the L2 table and
3091 #              refcount block caches in bytes (since 2.2)
3093 # @l2-cache-size: the maximum size of the L2 table cache in
3094 #                 bytes (since 2.2)
3096 # @l2-cache-entry-size: the size of each entry in the L2 cache in
3097 #                       bytes. It must be a power of two between 512
3098 #                       and the cluster size. The default value is
3099 #                       the cluster size (since 2.12)
3101 # @refcount-cache-size: the maximum size of the refcount block cache
3102 #                       in bytes (since 2.2)
3104 # @cache-clean-interval: clean unused entries in the L2 and refcount
3105 #                        caches. The interval is in seconds. The default value
3106 #                        is 600 on supporting platforms, and 0 on other
3107 #                        platforms. 0 disables this feature. (since 2.5)
3109 # @encrypt: Image decryption options. Mandatory for
3110 #           encrypted images, except when doing a metadata-only
3111 #           probe of the image. (since 2.10)
3113 # @data-file: reference to or definition of the external data file.
3114 #             This may only be specified for images that require an
3115 #             external data file. If it is not specified for such
3116 #             an image, the data file name is loaded from the image
3117 #             file. (since 4.0)
3119 # Since: 2.9
3121 { 'struct': 'BlockdevOptionsQcow2',
3122   'base': 'BlockdevOptionsGenericCOWFormat',
3123   'data': { '*lazy-refcounts': 'bool',
3124             '*pass-discard-request': 'bool',
3125             '*pass-discard-snapshot': 'bool',
3126             '*pass-discard-other': 'bool',
3127             '*overlap-check': 'Qcow2OverlapChecks',
3128             '*cache-size': 'int',
3129             '*l2-cache-size': 'int',
3130             '*l2-cache-entry-size': 'int',
3131             '*refcount-cache-size': 'int',
3132             '*cache-clean-interval': 'int',
3133             '*encrypt': 'BlockdevQcow2Encryption',
3134             '*data-file': 'BlockdevRef' } }
3137 # @SshHostKeyCheckMode:
3139 # @none: Don't check the host key at all
3140 # @hash: Compare the host key with a given hash
3141 # @known_hosts: Check the host key against the known_hosts file
3143 # Since: 2.12
3145 { 'enum': 'SshHostKeyCheckMode',
3146   'data': [ 'none', 'hash', 'known_hosts' ] }
3149 # @SshHostKeyCheckHashType:
3151 # @md5: The given hash is an md5 hash
3152 # @sha1: The given hash is an sha1 hash
3154 # Since: 2.12
3156 { 'enum': 'SshHostKeyCheckHashType',
3157   'data': [ 'md5', 'sha1' ] }
3160 # @SshHostKeyHash:
3162 # @type: The hash algorithm used for the hash
3163 # @hash: The expected hash value
3165 # Since: 2.12
3167 { 'struct': 'SshHostKeyHash',
3168   'data': { 'type': 'SshHostKeyCheckHashType',
3169             'hash': 'str' }}
3172 # @SshHostKeyCheck:
3174 # Since: 2.12
3176 { 'union': 'SshHostKeyCheck',
3177   'base': { 'mode': 'SshHostKeyCheckMode' },
3178   'discriminator': 'mode',
3179   'data': { 'hash': 'SshHostKeyHash' } }
3182 # @BlockdevOptionsSsh:
3184 # @server:              host address
3186 # @path:                path to the image on the host
3188 # @user:                user as which to connect, defaults to current
3189 #                       local user name
3191 # @host-key-check:      Defines how and what to check the host key against
3192 #                       (default: known_hosts)
3194 # Since: 2.9
3196 { 'struct': 'BlockdevOptionsSsh',
3197   'data': { 'server': 'InetSocketAddress',
3198             'path': 'str',
3199             '*user': 'str',
3200             '*host-key-check': 'SshHostKeyCheck' } }
3204 # @BlkdebugEvent:
3206 # Trigger events supported by blkdebug.
3208 # @l1_shrink_write_table: write zeros to the l1 table to shrink image.
3209 #                         (since 2.11)
3211 # @l1_shrink_free_l2_clusters: discard the l2 tables. (since 2.11)
3213 # @cor_write: a write due to copy-on-read (since 2.11)
3215 # @cluster_alloc_space: an allocation of file space for a cluster (since 4.1)
3217 # @none: triggers once at creation of the blkdebug node (since 4.1)
3219 # Since: 2.9
3221 { 'enum': 'BlkdebugEvent', 'prefix': 'BLKDBG',
3222   'data': [ 'l1_update', 'l1_grow_alloc_table', 'l1_grow_write_table',
3223             'l1_grow_activate_table', 'l2_load', 'l2_update',
3224             'l2_update_compressed', 'l2_alloc_cow_read', 'l2_alloc_write',
3225             'read_aio', 'read_backing_aio', 'read_compressed', 'write_aio',
3226             'write_compressed', 'vmstate_load', 'vmstate_save', 'cow_read',
3227             'cow_write', 'reftable_load', 'reftable_grow', 'reftable_update',
3228             'refblock_load', 'refblock_update', 'refblock_update_part',
3229             'refblock_alloc', 'refblock_alloc_hookup', 'refblock_alloc_write',
3230             'refblock_alloc_write_blocks', 'refblock_alloc_write_table',
3231             'refblock_alloc_switch_table', 'cluster_alloc',
3232             'cluster_alloc_bytes', 'cluster_free', 'flush_to_os',
3233             'flush_to_disk', 'pwritev_rmw_head', 'pwritev_rmw_after_head',
3234             'pwritev_rmw_tail', 'pwritev_rmw_after_tail', 'pwritev',
3235             'pwritev_zero', 'pwritev_done', 'empty_image_prepare',
3236             'l1_shrink_write_table', 'l1_shrink_free_l2_clusters',
3237             'cor_write', 'cluster_alloc_space', 'none'] }
3240 # @BlkdebugIOType:
3242 # Kinds of I/O that blkdebug can inject errors in.
3244 # @read: .bdrv_co_preadv()
3246 # @write: .bdrv_co_pwritev()
3248 # @write-zeroes: .bdrv_co_pwrite_zeroes()
3250 # @discard: .bdrv_co_pdiscard()
3252 # @flush: .bdrv_co_flush_to_disk()
3254 # @block-status: .bdrv_co_block_status()
3256 # Since: 4.1
3258 { 'enum': 'BlkdebugIOType', 'prefix': 'BLKDEBUG_IO_TYPE',
3259   'data': [ 'read', 'write', 'write-zeroes', 'discard', 'flush',
3260             'block-status' ] }
3263 # @BlkdebugInjectErrorOptions:
3265 # Describes a single error injection for blkdebug.
3267 # @event: trigger event
3269 # @state: the state identifier blkdebug needs to be in to
3270 #         actually trigger the event; defaults to "any"
3272 # @iotype: the type of I/O operations on which this error should
3273 #          be injected; defaults to "all read, write,
3274 #          write-zeroes, discard, and flush operations"
3275 #          (since: 4.1)
3277 # @errno: error identifier (errno) to be returned; defaults to
3278 #         EIO
3280 # @sector: specifies the sector index which has to be affected
3281 #          in order to actually trigger the event; defaults to "any
3282 #          sector"
3284 # @once: disables further events after this one has been
3285 #        triggered; defaults to false
3287 # @immediately: fail immediately; defaults to false
3289 # Since: 2.9
3291 { 'struct': 'BlkdebugInjectErrorOptions',
3292   'data': { 'event': 'BlkdebugEvent',
3293             '*state': 'int',
3294             '*iotype': 'BlkdebugIOType',
3295             '*errno': 'int',
3296             '*sector': 'int',
3297             '*once': 'bool',
3298             '*immediately': 'bool' } }
3301 # @BlkdebugSetStateOptions:
3303 # Describes a single state-change event for blkdebug.
3305 # @event: trigger event
3307 # @state: the current state identifier blkdebug needs to be in;
3308 #         defaults to "any"
3310 # @new_state: the state identifier blkdebug is supposed to assume if
3311 #             this event is triggered
3313 # Since: 2.9
3315 { 'struct': 'BlkdebugSetStateOptions',
3316   'data': { 'event': 'BlkdebugEvent',
3317             '*state': 'int',
3318             'new_state': 'int' } }
3321 # @BlockdevOptionsBlkdebug:
3323 # Driver specific block device options for blkdebug.
3325 # @image: underlying raw block device (or image file)
3327 # @config: filename of the configuration file
3329 # @align: required alignment for requests in bytes, must be
3330 #         positive power of 2, or 0 for default
3332 # @max-transfer: maximum size for I/O transfers in bytes, must be
3333 #                positive multiple of @align and of the underlying
3334 #                file's request alignment (but need not be a power of
3335 #                2), or 0 for default (since 2.10)
3337 # @opt-write-zero: preferred alignment for write zero requests in bytes,
3338 #                  must be positive multiple of @align and of the
3339 #                  underlying file's request alignment (but need not be a
3340 #                  power of 2), or 0 for default (since 2.10)
3342 # @max-write-zero: maximum size for write zero requests in bytes, must be
3343 #                  positive multiple of @align, of @opt-write-zero, and of
3344 #                  the underlying file's request alignment (but need not
3345 #                  be a power of 2), or 0 for default (since 2.10)
3347 # @opt-discard: preferred alignment for discard requests in bytes, must
3348 #               be positive multiple of @align and of the underlying
3349 #               file's request alignment (but need not be a power of
3350 #               2), or 0 for default (since 2.10)
3352 # @max-discard: maximum size for discard requests in bytes, must be
3353 #               positive multiple of @align, of @opt-discard, and of
3354 #               the underlying file's request alignment (but need not
3355 #               be a power of 2), or 0 for default (since 2.10)
3357 # @inject-error: array of error injection descriptions
3359 # @set-state: array of state-change descriptions
3361 # @take-child-perms: Permissions to take on @image in addition to what
3362 #                    is necessary anyway (which depends on how the
3363 #                    blkdebug node is used).  Defaults to none.
3364 #                    (since 5.0)
3366 # @unshare-child-perms: Permissions not to share on @image in addition
3367 #                       to what cannot be shared anyway (which depends
3368 #                       on how the blkdebug node is used).  Defaults
3369 #                       to none.  (since 5.0)
3371 # Since: 2.9
3373 { 'struct': 'BlockdevOptionsBlkdebug',
3374   'data': { 'image': 'BlockdevRef',
3375             '*config': 'str',
3376             '*align': 'int', '*max-transfer': 'int32',
3377             '*opt-write-zero': 'int32', '*max-write-zero': 'int32',
3378             '*opt-discard': 'int32', '*max-discard': 'int32',
3379             '*inject-error': ['BlkdebugInjectErrorOptions'],
3380             '*set-state': ['BlkdebugSetStateOptions'],
3381             '*take-child-perms': ['BlockPermission'],
3382             '*unshare-child-perms': ['BlockPermission'] } }
3385 # @BlockdevOptionsBlklogwrites:
3387 # Driver specific block device options for blklogwrites.
3389 # @file: block device
3391 # @log: block device used to log writes to @file
3393 # @log-sector-size: sector size used in logging writes to @file, determines
3394 #                   granularity of offsets and sizes of writes (default: 512)
3396 # @log-append: append to an existing log (default: false)
3398 # @log-super-update-interval: interval of write requests after which the log
3399 #                             super block is updated to disk (default: 4096)
3401 # Since: 3.0
3403 { 'struct': 'BlockdevOptionsBlklogwrites',
3404   'data': { 'file': 'BlockdevRef',
3405             'log': 'BlockdevRef',
3406             '*log-sector-size': 'uint32',
3407             '*log-append': 'bool',
3408             '*log-super-update-interval': 'uint64' } }
3411 # @BlockdevOptionsBlkverify:
3413 # Driver specific block device options for blkverify.
3415 # @test: block device to be tested
3417 # @raw: raw image used for verification
3419 # Since: 2.9
3421 { 'struct': 'BlockdevOptionsBlkverify',
3422   'data': { 'test': 'BlockdevRef',
3423             'raw': 'BlockdevRef' } }
3426 # @BlockdevOptionsBlkreplay:
3428 # Driver specific block device options for blkreplay.
3430 # @image: disk image which should be controlled with blkreplay
3432 # Since: 4.2
3434 { 'struct': 'BlockdevOptionsBlkreplay',
3435   'data': { 'image': 'BlockdevRef' } }
3438 # @QuorumReadPattern:
3440 # An enumeration of quorum read patterns.
3442 # @quorum: read all the children and do a quorum vote on reads
3444 # @fifo: read only from the first child that has not failed
3446 # Since: 2.9
3448 { 'enum': 'QuorumReadPattern', 'data': [ 'quorum', 'fifo' ] }
3451 # @BlockdevOptionsQuorum:
3453 # Driver specific block device options for Quorum
3455 # @blkverify: true if the driver must print content mismatch
3456 #                  set to false by default
3458 # @children: the children block devices to use
3460 # @vote-threshold: the vote limit under which a read will fail
3462 # @rewrite-corrupted: rewrite corrupted data when quorum is reached
3463 #                     (Since 2.1)
3465 # @read-pattern: choose read pattern and set to quorum by default
3466 #                (Since 2.2)
3468 # Since: 2.9
3470 { 'struct': 'BlockdevOptionsQuorum',
3471   'data': { '*blkverify': 'bool',
3472             'children': [ 'BlockdevRef' ],
3473             'vote-threshold': 'int',
3474             '*rewrite-corrupted': 'bool',
3475             '*read-pattern': 'QuorumReadPattern' } }
3478 # @BlockdevOptionsGluster:
3480 # Driver specific block device options for Gluster
3482 # @volume: name of gluster volume where VM image resides
3484 # @path: absolute path to image file in gluster volume
3486 # @server: gluster servers description
3488 # @debug: libgfapi log level (default '4' which is Error)
3489 #         (Since 2.8)
3491 # @logfile: libgfapi log file (default /dev/stderr) (Since 2.8)
3493 # Since: 2.9
3495 { 'struct': 'BlockdevOptionsGluster',
3496   'data': { 'volume': 'str',
3497             'path': 'str',
3498             'server': ['SocketAddress'],
3499             '*debug': 'int',
3500             '*logfile': 'str' } }
3503 # @IscsiTransport:
3505 # An enumeration of libiscsi transport types
3507 # Since: 2.9
3509 { 'enum': 'IscsiTransport',
3510   'data': [ 'tcp', 'iser' ] }
3513 # @IscsiHeaderDigest:
3515 # An enumeration of header digests supported by libiscsi
3517 # Since: 2.9
3519 { 'enum': 'IscsiHeaderDigest',
3520   'prefix': 'QAPI_ISCSI_HEADER_DIGEST',
3521   'data': [ 'crc32c', 'none', 'crc32c-none', 'none-crc32c' ] }
3524 # @BlockdevOptionsIscsi:
3526 # @transport: The iscsi transport type
3528 # @portal: The address of the iscsi portal
3530 # @target: The target iqn name
3532 # @lun: LUN to connect to. Defaults to 0.
3534 # @user: User name to log in with. If omitted, no CHAP
3535 #        authentication is performed.
3537 # @password-secret: The ID of a QCryptoSecret object providing
3538 #                   the password for the login. This option is required if
3539 #                   @user is specified.
3541 # @initiator-name: The iqn name we want to identify to the target
3542 #                  as. If this option is not specified, an initiator name is
3543 #                  generated automatically.
3545 # @header-digest: The desired header digest. Defaults to
3546 #                 none-crc32c.
3548 # @timeout: Timeout in seconds after which a request will
3549 #           timeout. 0 means no timeout and is the default.
3551 # Driver specific block device options for iscsi
3553 # Since: 2.9
3555 { 'struct': 'BlockdevOptionsIscsi',
3556   'data': { 'transport': 'IscsiTransport',
3557             'portal': 'str',
3558             'target': 'str',
3559             '*lun': 'int',
3560             '*user': 'str',
3561             '*password-secret': 'str',
3562             '*initiator-name': 'str',
3563             '*header-digest': 'IscsiHeaderDigest',
3564             '*timeout': 'int' } }
3568 # @RbdAuthMode:
3570 # Since: 3.0
3572 { 'enum': 'RbdAuthMode',
3573   'data': [ 'cephx', 'none' ] }
3576 # @BlockdevOptionsRbd:
3578 # @pool: Ceph pool name.
3580 # @namespace: Rados namespace name in the Ceph pool. (Since 5.0)
3582 # @image: Image name in the Ceph pool.
3584 # @conf: path to Ceph configuration file.  Values
3585 #        in the configuration file will be overridden by
3586 #        options specified via QAPI.
3588 # @snapshot: Ceph snapshot name.
3590 # @user: Ceph id name.
3592 # @auth-client-required: Acceptable authentication modes.
3593 #                        This maps to Ceph configuration option
3594 #                        "auth_client_required".  (Since 3.0)
3596 # @key-secret: ID of a QCryptoSecret object providing a key
3597 #              for cephx authentication.
3598 #              This maps to Ceph configuration option
3599 #              "key".  (Since 3.0)
3601 # @server: Monitor host address and port.  This maps
3602 #          to the "mon_host" Ceph option.
3604 # Since: 2.9
3606 { 'struct': 'BlockdevOptionsRbd',
3607   'data': { 'pool': 'str',
3608             '*namespace': 'str',
3609             'image': 'str',
3610             '*conf': 'str',
3611             '*snapshot': 'str',
3612             '*user': 'str',
3613             '*auth-client-required': ['RbdAuthMode'],
3614             '*key-secret': 'str',
3615             '*server': ['InetSocketAddressBase'] } }
3618 # @BlockdevOptionsSheepdog:
3620 # Driver specific block device options for sheepdog
3622 # @vdi: Virtual disk image name
3623 # @server: The Sheepdog server to connect to
3624 # @snap-id: Snapshot ID
3625 # @tag: Snapshot tag name
3627 # Only one of @snap-id and @tag may be present.
3629 # Since: 2.9
3631 { 'struct': 'BlockdevOptionsSheepdog',
3632   'data': { 'server': 'SocketAddress',
3633             'vdi': 'str',
3634             '*snap-id': 'uint32',
3635             '*tag': 'str' } }
3638 # @ReplicationMode:
3640 # An enumeration of replication modes.
3642 # @primary: Primary mode, the vm's state will be sent to secondary QEMU.
3644 # @secondary: Secondary mode, receive the vm's state from primary QEMU.
3646 # Since: 2.9
3648 { 'enum' : 'ReplicationMode', 'data' : [ 'primary', 'secondary' ],
3649   'if': 'defined(CONFIG_REPLICATION)' }
3652 # @BlockdevOptionsReplication:
3654 # Driver specific block device options for replication
3656 # @mode: the replication mode
3658 # @top-id: In secondary mode, node name or device ID of the root
3659 #          node who owns the replication node chain. Must not be given in
3660 #          primary mode.
3662 # Since: 2.9
3664 { 'struct': 'BlockdevOptionsReplication',
3665   'base': 'BlockdevOptionsGenericFormat',
3666   'data': { 'mode': 'ReplicationMode',
3667             '*top-id': 'str' },
3668   'if': 'defined(CONFIG_REPLICATION)' }
3671 # @NFSTransport:
3673 # An enumeration of NFS transport types
3675 # @inet: TCP transport
3677 # Since: 2.9
3679 { 'enum': 'NFSTransport',
3680   'data': [ 'inet' ] }
3683 # @NFSServer:
3685 # Captures the address of the socket
3687 # @type: transport type used for NFS (only TCP supported)
3689 # @host: host address for NFS server
3691 # Since: 2.9
3693 { 'struct': 'NFSServer',
3694   'data': { 'type': 'NFSTransport',
3695             'host': 'str' } }
3698 # @BlockdevOptionsNfs:
3700 # Driver specific block device option for NFS
3702 # @server: host address
3704 # @path: path of the image on the host
3706 # @user: UID value to use when talking to the
3707 #        server (defaults to 65534 on Windows and getuid()
3708 #        on unix)
3710 # @group: GID value to use when talking to the
3711 #         server (defaults to 65534 on Windows and getgid()
3712 #         in unix)
3714 # @tcp-syn-count: number of SYNs during the session
3715 #                 establishment (defaults to libnfs default)
3717 # @readahead-size: set the readahead size in bytes (defaults
3718 #                  to libnfs default)
3720 # @page-cache-size: set the pagecache size in bytes (defaults
3721 #                   to libnfs default)
3723 # @debug: set the NFS debug level (max 2) (defaults
3724 #         to libnfs default)
3726 # Since: 2.9
3728 { 'struct': 'BlockdevOptionsNfs',
3729   'data': { 'server': 'NFSServer',
3730             'path': 'str',
3731             '*user': 'int',
3732             '*group': 'int',
3733             '*tcp-syn-count': 'int',
3734             '*readahead-size': 'int',
3735             '*page-cache-size': 'int',
3736             '*debug': 'int' } }
3739 # @BlockdevOptionsCurlBase:
3741 # Driver specific block device options shared by all protocols supported by the
3742 # curl backend.
3744 # @url: URL of the image file
3746 # @readahead: Size of the read-ahead cache; must be a multiple of
3747 #             512 (defaults to 256 kB)
3749 # @timeout: Timeout for connections, in seconds (defaults to 5)
3751 # @username: Username for authentication (defaults to none)
3753 # @password-secret: ID of a QCryptoSecret object providing a password
3754 #                   for authentication (defaults to no password)
3756 # @proxy-username: Username for proxy authentication (defaults to none)
3758 # @proxy-password-secret: ID of a QCryptoSecret object providing a password
3759 #                         for proxy authentication (defaults to no password)
3761 # Since: 2.9
3763 { 'struct': 'BlockdevOptionsCurlBase',
3764   'data': { 'url': 'str',
3765             '*readahead': 'int',
3766             '*timeout': 'int',
3767             '*username': 'str',
3768             '*password-secret': 'str',
3769             '*proxy-username': 'str',
3770             '*proxy-password-secret': 'str' } }
3773 # @BlockdevOptionsCurlHttp:
3775 # Driver specific block device options for HTTP connections over the curl
3776 # backend.  URLs must start with "http://".
3778 # @cookie: List of cookies to set; format is
3779 #          "name1=content1; name2=content2;" as explained by
3780 #          CURLOPT_COOKIE(3). Defaults to no cookies.
3782 # @cookie-secret: ID of a QCryptoSecret object providing the cookie data in a
3783 #                 secure way. See @cookie for the format. (since 2.10)
3785 # Since: 2.9
3787 { 'struct': 'BlockdevOptionsCurlHttp',
3788   'base': 'BlockdevOptionsCurlBase',
3789   'data': { '*cookie': 'str',
3790             '*cookie-secret': 'str'} }
3793 # @BlockdevOptionsCurlHttps:
3795 # Driver specific block device options for HTTPS connections over the curl
3796 # backend.  URLs must start with "https://".
3798 # @cookie: List of cookies to set; format is
3799 #          "name1=content1; name2=content2;" as explained by
3800 #          CURLOPT_COOKIE(3). Defaults to no cookies.
3802 # @sslverify: Whether to verify the SSL certificate's validity (defaults to
3803 #             true)
3805 # @cookie-secret: ID of a QCryptoSecret object providing the cookie data in a
3806 #                 secure way. See @cookie for the format. (since 2.10)
3808 # Since: 2.9
3810 { 'struct': 'BlockdevOptionsCurlHttps',
3811   'base': 'BlockdevOptionsCurlBase',
3812   'data': { '*cookie': 'str',
3813             '*sslverify': 'bool',
3814             '*cookie-secret': 'str'} }
3817 # @BlockdevOptionsCurlFtp:
3819 # Driver specific block device options for FTP connections over the curl
3820 # backend.  URLs must start with "ftp://".
3822 # Since: 2.9
3824 { 'struct': 'BlockdevOptionsCurlFtp',
3825   'base': 'BlockdevOptionsCurlBase',
3826   'data': { } }
3829 # @BlockdevOptionsCurlFtps:
3831 # Driver specific block device options for FTPS connections over the curl
3832 # backend.  URLs must start with "ftps://".
3834 # @sslverify: Whether to verify the SSL certificate's validity (defaults to
3835 #             true)
3837 # Since: 2.9
3839 { 'struct': 'BlockdevOptionsCurlFtps',
3840   'base': 'BlockdevOptionsCurlBase',
3841   'data': { '*sslverify': 'bool' } }
3844 # @BlockdevOptionsNbd:
3846 # Driver specific block device options for NBD.
3848 # @server: NBD server address
3850 # @export: export name
3852 # @tls-creds: TLS credentials ID
3854 # @x-dirty-bitmap: A "qemu:dirty-bitmap:NAME" string to query in place of
3855 #                  traditional "base:allocation" block status (see
3856 #                  NBD_OPT_LIST_META_CONTEXT in the NBD protocol) (since 3.0)
3858 # @reconnect-delay: On an unexpected disconnect, the nbd client tries to
3859 #                   connect again until succeeding or encountering a serious
3860 #                   error.  During the first @reconnect-delay seconds, all
3861 #                   requests are paused and will be rerun on a successful
3862 #                   reconnect. After that time, any delayed requests and all
3863 #                   future requests before a successful reconnect will
3864 #                   immediately fail. Default 0 (Since 4.2)
3866 # Since: 2.9
3868 { 'struct': 'BlockdevOptionsNbd',
3869   'data': { 'server': 'SocketAddress',
3870             '*export': 'str',
3871             '*tls-creds': 'str',
3872             '*x-dirty-bitmap': 'str',
3873             '*reconnect-delay': 'uint32' } }
3876 # @BlockdevOptionsRaw:
3878 # Driver specific block device options for the raw driver.
3880 # @offset: position where the block device starts
3881 # @size: the assumed size of the device
3883 # Since: 2.9
3885 { 'struct': 'BlockdevOptionsRaw',
3886   'base': 'BlockdevOptionsGenericFormat',
3887   'data': { '*offset': 'int', '*size': 'int' } }
3890 # @BlockdevOptionsVxHS:
3892 # Driver specific block device options for VxHS
3894 # @vdisk-id: UUID of VxHS volume
3895 # @server: vxhs server IP, port
3896 # @tls-creds: TLS credentials ID
3898 # Since: 2.10
3900 { 'struct': 'BlockdevOptionsVxHS',
3901   'data': { 'vdisk-id': 'str',
3902             'server': 'InetSocketAddressBase',
3903             '*tls-creds': 'str' } }
3906 # @BlockdevOptionsThrottle:
3908 # Driver specific block device options for the throttle driver
3910 # @throttle-group: the name of the throttle-group object to use. It
3911 #                  must already exist.
3912 # @file: reference to or definition of the data source block device
3913 # Since: 2.11
3915 { 'struct': 'BlockdevOptionsThrottle',
3916   'data': { 'throttle-group': 'str',
3917             'file' : 'BlockdevRef'
3918              } }
3920 # @BlockdevOptions:
3922 # Options for creating a block device.  Many options are available for all
3923 # block devices, independent of the block driver:
3925 # @driver: block driver name
3926 # @node-name: the node name of the new node (Since 2.0).
3927 #             This option is required on the top level of blockdev-add.
3928 #             Valid node names start with an alphabetic character and may
3929 #             contain only alphanumeric characters, '-', '.' and '_'. Their
3930 #             maximum length is 31 characters.
3931 # @discard: discard-related options (default: ignore)
3932 # @cache: cache-related options
3933 # @read-only: whether the block device should be read-only (default: false).
3934 #             Note that some block drivers support only read-only access,
3935 #             either generally or in certain configurations. In this case,
3936 #             the default value does not work and the option must be
3937 #             specified explicitly.
3938 # @auto-read-only: if true and @read-only is false, QEMU may automatically
3939 #                  decide not to open the image read-write as requested, but
3940 #                  fall back to read-only instead (and switch between the modes
3941 #                  later), e.g. depending on whether the image file is writable
3942 #                  or whether a writing user is attached to the node
3943 #                  (default: false, since 3.1)
3944 # @detect-zeroes: detect and optimize zero writes (Since 2.1)
3945 #                 (default: off)
3946 # @force-share: force share all permission on added nodes.
3947 #               Requires read-only=true. (Since 2.10)
3949 # Remaining options are determined by the block driver.
3951 # Since: 2.9
3953 { 'union': 'BlockdevOptions',
3954   'base': { 'driver': 'BlockdevDriver',
3955             '*node-name': 'str',
3956             '*discard': 'BlockdevDiscardOptions',
3957             '*cache': 'BlockdevCacheOptions',
3958             '*read-only': 'bool',
3959             '*auto-read-only': 'bool',
3960             '*force-share': 'bool',
3961             '*detect-zeroes': 'BlockdevDetectZeroesOptions' },
3962   'discriminator': 'driver',
3963   'data': {
3964       'blkdebug':   'BlockdevOptionsBlkdebug',
3965       'blklogwrites':'BlockdevOptionsBlklogwrites',
3966       'blkverify':  'BlockdevOptionsBlkverify',
3967       'blkreplay':  'BlockdevOptionsBlkreplay',
3968       'bochs':      'BlockdevOptionsGenericFormat',
3969       'cloop':      'BlockdevOptionsGenericFormat',
3970       'compress':   'BlockdevOptionsGenericFormat',
3971       'copy-on-read':'BlockdevOptionsGenericFormat',
3972       'dmg':        'BlockdevOptionsGenericFormat',
3973       'file':       'BlockdevOptionsFile',
3974       'ftp':        'BlockdevOptionsCurlFtp',
3975       'ftps':       'BlockdevOptionsCurlFtps',
3976       'gluster':    'BlockdevOptionsGluster',
3977       'host_cdrom': 'BlockdevOptionsFile',
3978       'host_device':'BlockdevOptionsFile',
3979       'http':       'BlockdevOptionsCurlHttp',
3980       'https':      'BlockdevOptionsCurlHttps',
3981       'iscsi':      'BlockdevOptionsIscsi',
3982       'luks':       'BlockdevOptionsLUKS',
3983       'nbd':        'BlockdevOptionsNbd',
3984       'nfs':        'BlockdevOptionsNfs',
3985       'null-aio':   'BlockdevOptionsNull',
3986       'null-co':    'BlockdevOptionsNull',
3987       'nvme':       'BlockdevOptionsNVMe',
3988       'parallels':  'BlockdevOptionsGenericFormat',
3989       'qcow2':      'BlockdevOptionsQcow2',
3990       'qcow':       'BlockdevOptionsQcow',
3991       'qed':        'BlockdevOptionsGenericCOWFormat',
3992       'quorum':     'BlockdevOptionsQuorum',
3993       'raw':        'BlockdevOptionsRaw',
3994       'rbd':        'BlockdevOptionsRbd',
3995       'replication': { 'type': 'BlockdevOptionsReplication',
3996                        'if': 'defined(CONFIG_REPLICATION)' },
3997       'sheepdog':   'BlockdevOptionsSheepdog',
3998       'ssh':        'BlockdevOptionsSsh',
3999       'throttle':   'BlockdevOptionsThrottle',
4000       'vdi':        'BlockdevOptionsGenericFormat',
4001       'vhdx':       'BlockdevOptionsGenericFormat',
4002       'vmdk':       'BlockdevOptionsGenericCOWFormat',
4003       'vpc':        'BlockdevOptionsGenericFormat',
4004       'vvfat':      'BlockdevOptionsVVFAT',
4005       'vxhs':       'BlockdevOptionsVxHS'
4006   } }
4009 # @BlockdevRef:
4011 # Reference to a block device.
4013 # @definition: defines a new block device inline
4014 # @reference: references the ID of an existing block device
4016 # Since: 2.9
4018 { 'alternate': 'BlockdevRef',
4019   'data': { 'definition': 'BlockdevOptions',
4020             'reference': 'str' } }
4023 # @BlockdevRefOrNull:
4025 # Reference to a block device.
4027 # @definition: defines a new block device inline
4028 # @reference: references the ID of an existing block device.
4029 #             An empty string means that no block device should
4030 #             be referenced.  Deprecated; use null instead.
4031 # @null: No block device should be referenced (since 2.10)
4033 # Since: 2.9
4035 { 'alternate': 'BlockdevRefOrNull',
4036   'data': { 'definition': 'BlockdevOptions',
4037             'reference': 'str',
4038             'null': 'null' } }
4041 # @blockdev-add:
4043 # Creates a new block device. If the @id option is given at the top level, a
4044 # BlockBackend will be created; otherwise, @node-name is mandatory at the top
4045 # level and no BlockBackend will be created.
4047 # Since: 2.9
4049 # Example:
4051 # 1.
4052 # -> { "execute": "blockdev-add",
4053 #      "arguments": {
4054 #           "driver": "qcow2",
4055 #           "node-name": "test1",
4056 #           "file": {
4057 #               "driver": "file",
4058 #               "filename": "test.qcow2"
4059 #            }
4060 #       }
4061 #     }
4062 # <- { "return": {} }
4064 # 2.
4065 # -> { "execute": "blockdev-add",
4066 #      "arguments": {
4067 #           "driver": "qcow2",
4068 #           "node-name": "node0",
4069 #           "discard": "unmap",
4070 #           "cache": {
4071 #              "direct": true
4072 #            },
4073 #            "file": {
4074 #              "driver": "file",
4075 #              "filename": "/tmp/test.qcow2"
4076 #            },
4077 #            "backing": {
4078 #               "driver": "raw",
4079 #               "file": {
4080 #                  "driver": "file",
4081 #                  "filename": "/dev/fdset/4"
4082 #                }
4083 #            }
4084 #        }
4085 #      }
4087 # <- { "return": {} }
4090 { 'command': 'blockdev-add', 'data': 'BlockdevOptions', 'boxed': true }
4093 # @x-blockdev-reopen:
4095 # Reopens a block device using the given set of options. Any option
4096 # not specified will be reset to its default value regardless of its
4097 # previous status. If an option cannot be changed or a particular
4098 # driver does not support reopening then the command will return an
4099 # error.
4101 # The top-level @node-name option (from BlockdevOptions) must be
4102 # specified and is used to select the block device to be reopened.
4103 # Other @node-name options must be either omitted or set to the
4104 # current name of the appropriate node. This command won't change any
4105 # node name and any attempt to do it will result in an error.
4107 # In the case of options that refer to child nodes, the behavior of
4108 # this command depends on the value:
4110 #  1) A set of options (BlockdevOptions): the child is reopened with
4111 #     the specified set of options.
4113 #  2) A reference to the current child: the child is reopened using
4114 #     its existing set of options.
4116 #  3) A reference to a different node: the current child is replaced
4117 #     with the specified one.
4119 #  4) NULL: the current child (if any) is detached.
4121 # Options (1) and (2) are supported in all cases, but at the moment
4122 # only @backing allows replacing or detaching an existing child.
4124 # Unlike with blockdev-add, the @backing option must always be present
4125 # unless the node being reopened does not have a backing file and its
4126 # image does not have a default backing file name as part of its
4127 # metadata.
4129 # Since: 4.0
4131 { 'command': 'x-blockdev-reopen',
4132   'data': 'BlockdevOptions', 'boxed': true }
4135 # @blockdev-del:
4137 # Deletes a block device that has been added using blockdev-add.
4138 # The command will fail if the node is attached to a device or is
4139 # otherwise being used.
4141 # @node-name: Name of the graph node to delete.
4143 # Since: 2.9
4145 # Example:
4147 # -> { "execute": "blockdev-add",
4148 #      "arguments": {
4149 #           "driver": "qcow2",
4150 #           "node-name": "node0",
4151 #           "file": {
4152 #               "driver": "file",
4153 #               "filename": "test.qcow2"
4154 #           }
4155 #      }
4156 #    }
4157 # <- { "return": {} }
4159 # -> { "execute": "blockdev-del",
4160 #      "arguments": { "node-name": "node0" }
4161 #    }
4162 # <- { "return": {} }
4165 { 'command': 'blockdev-del', 'data': { 'node-name': 'str' } }
4168 # @BlockdevCreateOptionsFile:
4170 # Driver specific image creation options for file.
4172 # @filename: Filename for the new image file
4173 # @size: Size of the virtual disk in bytes
4174 # @preallocation: Preallocation mode for the new image (default: off;
4175 #                 allowed values: off,
4176 #                 falloc (if defined CONFIG_POSIX_FALLOCATE),
4177 #                 full (if defined CONFIG_POSIX))
4178 # @nocow: Turn off copy-on-write (valid only on btrfs; default: off)
4180 # Since: 2.12
4182 { 'struct': 'BlockdevCreateOptionsFile',
4183   'data': { 'filename':         'str',
4184             'size':             'size',
4185             '*preallocation':   'PreallocMode',
4186             '*nocow':           'bool' } }
4189 # @BlockdevCreateOptionsGluster:
4191 # Driver specific image creation options for gluster.
4193 # @location: Where to store the new image file
4194 # @size: Size of the virtual disk in bytes
4195 # @preallocation: Preallocation mode for the new image (default: off;
4196 #                 allowed values: off,
4197 #                 falloc (if defined CONFIG_GLUSTERFS_FALLOCATE),
4198 #                 full (if defined CONFIG_GLUSTERFS_ZEROFILL))
4200 # Since: 2.12
4202 { 'struct': 'BlockdevCreateOptionsGluster',
4203   'data': { 'location':         'BlockdevOptionsGluster',
4204             'size':             'size',
4205             '*preallocation':   'PreallocMode' } }
4208 # @BlockdevCreateOptionsLUKS:
4210 # Driver specific image creation options for LUKS.
4212 # @file: Node to create the image format on
4213 # @size: Size of the virtual disk in bytes
4214 # @preallocation: Preallocation mode for the new image
4215 #                 (since: 4.2)
4216 #                 (default: off; allowed values: off, metadata, falloc, full)
4218 # Since: 2.12
4220 { 'struct': 'BlockdevCreateOptionsLUKS',
4221   'base': 'QCryptoBlockCreateOptionsLUKS',
4222   'data': { 'file':             'BlockdevRef',
4223             'size':             'size',
4224             '*preallocation':   'PreallocMode' } }
4227 # @BlockdevCreateOptionsNfs:
4229 # Driver specific image creation options for NFS.
4231 # @location: Where to store the new image file
4232 # @size: Size of the virtual disk in bytes
4234 # Since: 2.12
4236 { 'struct': 'BlockdevCreateOptionsNfs',
4237   'data': { 'location':         'BlockdevOptionsNfs',
4238             'size':             'size' } }
4241 # @BlockdevCreateOptionsParallels:
4243 # Driver specific image creation options for parallels.
4245 # @file: Node to create the image format on
4246 # @size: Size of the virtual disk in bytes
4247 # @cluster-size: Cluster size in bytes (default: 1 MB)
4249 # Since: 2.12
4251 { 'struct': 'BlockdevCreateOptionsParallels',
4252   'data': { 'file':             'BlockdevRef',
4253             'size':             'size',
4254             '*cluster-size':    'size' } }
4257 # @BlockdevCreateOptionsQcow:
4259 # Driver specific image creation options for qcow.
4261 # @file: Node to create the image format on
4262 # @size: Size of the virtual disk in bytes
4263 # @backing-file: File name of the backing file if a backing file
4264 #                should be used
4265 # @encrypt: Encryption options if the image should be encrypted
4267 # Since: 2.12
4269 { 'struct': 'BlockdevCreateOptionsQcow',
4270   'data': { 'file':             'BlockdevRef',
4271             'size':             'size',
4272             '*backing-file':    'str',
4273             '*encrypt':         'QCryptoBlockCreateOptions' } }
4276 # @BlockdevQcow2Version:
4278 # @v2:  The original QCOW2 format as introduced in qemu 0.10 (version 2)
4279 # @v3:  The extended QCOW2 format as introduced in qemu 1.1 (version 3)
4281 # Since: 2.12
4283 { 'enum': 'BlockdevQcow2Version',
4284   'data': [ 'v2', 'v3' ] }
4288 # @BlockdevCreateOptionsQcow2:
4290 # Driver specific image creation options for qcow2.
4292 # @file: Node to create the image format on
4293 # @data-file: Node to use as an external data file in which all guest
4294 #             data is stored so that only metadata remains in the qcow2
4295 #             file (since: 4.0)
4296 # @data-file-raw: True if the external data file must stay valid as a
4297 #                 standalone (read-only) raw image without looking at qcow2
4298 #                 metadata (default: false; since: 4.0)
4299 # @size: Size of the virtual disk in bytes
4300 # @version: Compatibility level (default: v3)
4301 # @backing-file: File name of the backing file if a backing file
4302 #                should be used
4303 # @backing-fmt: Name of the block driver to use for the backing file
4304 # @encrypt: Encryption options if the image should be encrypted
4305 # @cluster-size: qcow2 cluster size in bytes (default: 65536)
4306 # @preallocation: Preallocation mode for the new image (default: off;
4307 #                 allowed values: off, falloc, full, metadata)
4308 # @lazy-refcounts: True if refcounts may be updated lazily (default: off)
4309 # @refcount-bits: Width of reference counts in bits (default: 16)
4311 # Since: 2.12
4313 { 'struct': 'BlockdevCreateOptionsQcow2',
4314   'data': { 'file':             'BlockdevRef',
4315             '*data-file':       'BlockdevRef',
4316             '*data-file-raw':   'bool',
4317             'size':             'size',
4318             '*version':         'BlockdevQcow2Version',
4319             '*backing-file':    'str',
4320             '*backing-fmt':     'BlockdevDriver',
4321             '*encrypt':         'QCryptoBlockCreateOptions',
4322             '*cluster-size':    'size',
4323             '*preallocation':   'PreallocMode',
4324             '*lazy-refcounts':  'bool',
4325             '*refcount-bits':   'int' } }
4328 # @BlockdevCreateOptionsQed:
4330 # Driver specific image creation options for qed.
4332 # @file: Node to create the image format on
4333 # @size: Size of the virtual disk in bytes
4334 # @backing-file: File name of the backing file if a backing file
4335 #                should be used
4336 # @backing-fmt: Name of the block driver to use for the backing file
4337 # @cluster-size: Cluster size in bytes (default: 65536)
4338 # @table-size: L1/L2 table size (in clusters)
4340 # Since: 2.12
4342 { 'struct': 'BlockdevCreateOptionsQed',
4343   'data': { 'file':             'BlockdevRef',
4344             'size':             'size',
4345             '*backing-file':    'str',
4346             '*backing-fmt':     'BlockdevDriver',
4347             '*cluster-size':    'size',
4348             '*table-size':      'int' } }
4351 # @BlockdevCreateOptionsRbd:
4353 # Driver specific image creation options for rbd/Ceph.
4355 # @location: Where to store the new image file. This location cannot
4356 #            point to a snapshot.
4357 # @size: Size of the virtual disk in bytes
4358 # @cluster-size: RBD object size
4360 # Since: 2.12
4362 { 'struct': 'BlockdevCreateOptionsRbd',
4363   'data': { 'location':         'BlockdevOptionsRbd',
4364             'size':             'size',
4365             '*cluster-size' :   'size' } }
4368 # @BlockdevVmdkSubformat:
4370 # Subformat options for VMDK images
4372 # @monolithicSparse:     Single file image with sparse cluster allocation
4374 # @monolithicFlat:       Single flat data image and a descriptor file
4376 # @twoGbMaxExtentSparse: Data is split into 2GB (per virtual LBA) sparse extent
4377 #                        files, in addition to a descriptor file
4379 # @twoGbMaxExtentFlat:   Data is split into 2GB (per virtual LBA) flat extent
4380 #                        files, in addition to a descriptor file
4382 # @streamOptimized:      Single file image sparse cluster allocation, optimized
4383 #                        for streaming over network.
4385 # Since: 4.0
4387 { 'enum': 'BlockdevVmdkSubformat',
4388   'data': [ 'monolithicSparse', 'monolithicFlat', 'twoGbMaxExtentSparse',
4389             'twoGbMaxExtentFlat', 'streamOptimized'] }
4392 # @BlockdevVmdkAdapterType:
4394 # Adapter type info for VMDK images
4396 # Since: 4.0
4398 { 'enum': 'BlockdevVmdkAdapterType',
4399   'data': [ 'ide', 'buslogic', 'lsilogic', 'legacyESX'] }
4402 # @BlockdevCreateOptionsVmdk:
4404 # Driver specific image creation options for VMDK.
4406 # @file: Where to store the new image file. This refers to the image
4407 #        file for monolithcSparse and streamOptimized format, or the
4408 #        descriptor file for other formats.
4409 # @size: Size of the virtual disk in bytes
4410 # @extents: Where to store the data extents. Required for monolithcFlat,
4411 #           twoGbMaxExtentSparse and twoGbMaxExtentFlat formats. For
4412 #           monolithicFlat, only one entry is required; for
4413 #           twoGbMaxExtent* formats, the number of entries required is
4414 #           calculated as extent_number = virtual_size / 2GB. Providing
4415 #           more extents than will be used is an error.
4416 # @subformat: The subformat of the VMDK image. Default: "monolithicSparse".
4417 # @backing-file: The path of backing file. Default: no backing file is used.
4418 # @adapter-type: The adapter type used to fill in the descriptor. Default: ide.
4419 # @hwversion: Hardware version. The meaningful options are "4" or "6".
4420 #             Default: "4".
4421 # @zeroed-grain: Whether to enable zeroed-grain feature for sparse subformats.
4422 #                Default: false.
4424 # Since: 4.0
4426 { 'struct': 'BlockdevCreateOptionsVmdk',
4427   'data': { 'file':             'BlockdevRef',
4428             'size':             'size',
4429             '*extents':          ['BlockdevRef'],
4430             '*subformat':       'BlockdevVmdkSubformat',
4431             '*backing-file':    'str',
4432             '*adapter-type':    'BlockdevVmdkAdapterType',
4433             '*hwversion':       'str',
4434             '*zeroed-grain':    'bool' } }
4438 # @SheepdogRedundancyType:
4440 # @full: Create a fully replicated vdi with x copies
4441 # @erasure-coded: Create an erasure coded vdi with x data strips and
4442 #                 y parity strips
4444 # Since: 2.12
4446 { 'enum': 'SheepdogRedundancyType',
4447   'data': [ 'full', 'erasure-coded' ] }
4450 # @SheepdogRedundancyFull:
4452 # @copies: Number of copies to use (between 1 and 31)
4454 # Since: 2.12
4456 { 'struct': 'SheepdogRedundancyFull',
4457   'data': { 'copies': 'int' }}
4460 # @SheepdogRedundancyErasureCoded:
4462 # @data-strips: Number of data strips to use (one of {2,4,8,16})
4463 # @parity-strips: Number of parity strips to use (between 1 and 15)
4465 # Since: 2.12
4467 { 'struct': 'SheepdogRedundancyErasureCoded',
4468   'data': { 'data-strips': 'int',
4469             'parity-strips': 'int' }}
4472 # @SheepdogRedundancy:
4474 # Since: 2.12
4476 { 'union': 'SheepdogRedundancy',
4477   'base': { 'type': 'SheepdogRedundancyType' },
4478   'discriminator': 'type',
4479   'data': { 'full': 'SheepdogRedundancyFull',
4480             'erasure-coded': 'SheepdogRedundancyErasureCoded' } }
4483 # @BlockdevCreateOptionsSheepdog:
4485 # Driver specific image creation options for Sheepdog.
4487 # @location: Where to store the new image file
4488 # @size: Size of the virtual disk in bytes
4489 # @backing-file: File name of a base image
4490 # @preallocation: Preallocation mode for the new image (default: off;
4491 #                 allowed values: off, full)
4492 # @redundancy: Redundancy of the image
4493 # @object-size: Object size of the image
4495 # Since: 2.12
4497 { 'struct': 'BlockdevCreateOptionsSheepdog',
4498   'data': { 'location':         'BlockdevOptionsSheepdog',
4499             'size':             'size',
4500             '*backing-file':    'str',
4501             '*preallocation':   'PreallocMode',
4502             '*redundancy':      'SheepdogRedundancy',
4503             '*object-size':     'size' } }
4506 # @BlockdevCreateOptionsSsh:
4508 # Driver specific image creation options for SSH.
4510 # @location: Where to store the new image file
4511 # @size: Size of the virtual disk in bytes
4513 # Since: 2.12
4515 { 'struct': 'BlockdevCreateOptionsSsh',
4516   'data': { 'location':         'BlockdevOptionsSsh',
4517             'size':             'size' } }
4520 # @BlockdevCreateOptionsVdi:
4522 # Driver specific image creation options for VDI.
4524 # @file: Node to create the image format on
4525 # @size: Size of the virtual disk in bytes
4526 # @preallocation: Preallocation mode for the new image (default: off;
4527 #                 allowed values: off, metadata)
4529 # Since: 2.12
4531 { 'struct': 'BlockdevCreateOptionsVdi',
4532   'data': { 'file':             'BlockdevRef',
4533             'size':             'size',
4534             '*preallocation':   'PreallocMode' } }
4537 # @BlockdevVhdxSubformat:
4539 # @dynamic: Growing image file
4540 # @fixed:   Preallocated fixed-size image file
4542 # Since: 2.12
4544 { 'enum': 'BlockdevVhdxSubformat',
4545   'data': [ 'dynamic', 'fixed' ] }
4548 # @BlockdevCreateOptionsVhdx:
4550 # Driver specific image creation options for vhdx.
4552 # @file: Node to create the image format on
4553 # @size: Size of the virtual disk in bytes
4554 # @log-size: Log size in bytes, must be a multiple of 1 MB
4555 #            (default: 1 MB)
4556 # @block-size: Block size in bytes, must be a multiple of 1 MB and not
4557 #              larger than 256 MB (default: automatically choose a block
4558 #              size depending on the image size)
4559 # @subformat: vhdx subformat (default: dynamic)
4560 # @block-state-zero: Force use of payload blocks of type 'ZERO'. Non-standard,
4561 #                    but default.  Do not set to 'off' when using 'qemu-img
4562 #                    convert' with subformat=dynamic.
4564 # Since: 2.12
4566 { 'struct': 'BlockdevCreateOptionsVhdx',
4567   'data': { 'file':                 'BlockdevRef',
4568             'size':                 'size',
4569             '*log-size':            'size',
4570             '*block-size':          'size',
4571             '*subformat':           'BlockdevVhdxSubformat',
4572             '*block-state-zero':    'bool' } }
4575 # @BlockdevVpcSubformat:
4577 # @dynamic: Growing image file
4578 # @fixed:   Preallocated fixed-size image file
4580 # Since: 2.12
4582 { 'enum': 'BlockdevVpcSubformat',
4583   'data': [ 'dynamic', 'fixed' ] }
4586 # @BlockdevCreateOptionsVpc:
4588 # Driver specific image creation options for vpc (VHD).
4590 # @file: Node to create the image format on
4591 # @size: Size of the virtual disk in bytes
4592 # @subformat: vhdx subformat (default: dynamic)
4593 # @force-size: Force use of the exact byte size instead of rounding to the
4594 #              next size that can be represented in CHS geometry
4595 #              (default: false)
4597 # Since: 2.12
4599 { 'struct': 'BlockdevCreateOptionsVpc',
4600   'data': { 'file':                 'BlockdevRef',
4601             'size':                 'size',
4602             '*subformat':           'BlockdevVpcSubformat',
4603             '*force-size':          'bool' } }
4606 # @BlockdevCreateOptions:
4608 # Options for creating an image format on a given node.
4610 # @driver: block driver to create the image format
4612 # Since: 2.12
4614 { 'union': 'BlockdevCreateOptions',
4615   'base': {
4616       'driver':         'BlockdevDriver' },
4617   'discriminator': 'driver',
4618   'data': {
4619       'file':           'BlockdevCreateOptionsFile',
4620       'gluster':        'BlockdevCreateOptionsGluster',
4621       'luks':           'BlockdevCreateOptionsLUKS',
4622       'nfs':            'BlockdevCreateOptionsNfs',
4623       'parallels':      'BlockdevCreateOptionsParallels',
4624       'qcow':           'BlockdevCreateOptionsQcow',
4625       'qcow2':          'BlockdevCreateOptionsQcow2',
4626       'qed':            'BlockdevCreateOptionsQed',
4627       'rbd':            'BlockdevCreateOptionsRbd',
4628       'sheepdog':       'BlockdevCreateOptionsSheepdog',
4629       'ssh':            'BlockdevCreateOptionsSsh',
4630       'vdi':            'BlockdevCreateOptionsVdi',
4631       'vhdx':           'BlockdevCreateOptionsVhdx',
4632       'vmdk':           'BlockdevCreateOptionsVmdk',
4633       'vpc':            'BlockdevCreateOptionsVpc'
4634   } }
4637 # @blockdev-create:
4639 # Starts a job to create an image format on a given node. The job is
4640 # automatically finalized, but a manual job-dismiss is required.
4642 # @job-id:          Identifier for the newly created job.
4644 # @options:         Options for the image creation.
4646 # Since: 3.0
4648 { 'command': 'blockdev-create',
4649   'data': { 'job-id': 'str',
4650             'options': 'BlockdevCreateOptions' } }
4653 # @BlockErrorAction:
4655 # An enumeration of action that has been taken when a DISK I/O occurs
4657 # @ignore: error has been ignored
4659 # @report: error has been reported to the device
4661 # @stop: error caused VM to be stopped
4663 # Since: 2.1
4665 { 'enum': 'BlockErrorAction',
4666   'data': [ 'ignore', 'report', 'stop' ] }
4670 # @BLOCK_IMAGE_CORRUPTED:
4672 # Emitted when a disk image is being marked corrupt. The image can be
4673 # identified by its device or node name. The 'device' field is always
4674 # present for compatibility reasons, but it can be empty ("") if the
4675 # image does not have a device name associated.
4677 # @device: device name. This is always present for compatibility
4678 #          reasons, but it can be empty ("") if the image does not
4679 #          have a device name associated.
4681 # @node-name: node name (Since: 2.4)
4683 # @msg: informative message for human consumption, such as the kind of
4684 #       corruption being detected. It should not be parsed by machine as it is
4685 #       not guaranteed to be stable
4687 # @offset: if the corruption resulted from an image access, this is
4688 #          the host's access offset into the image
4690 # @size: if the corruption resulted from an image access, this is
4691 #        the access size
4693 # @fatal: if set, the image is marked corrupt and therefore unusable after this
4694 #         event and must be repaired (Since 2.2; before, every
4695 #         BLOCK_IMAGE_CORRUPTED event was fatal)
4697 # Note: If action is "stop", a STOP event will eventually follow the
4698 #       BLOCK_IO_ERROR event.
4700 # Example:
4702 # <- { "event": "BLOCK_IMAGE_CORRUPTED",
4703 #      "data": { "device": "ide0-hd0", "node-name": "node0",
4704 #                "msg": "Prevented active L1 table overwrite", "offset": 196608,
4705 #                "size": 65536 },
4706 #      "timestamp": { "seconds": 1378126126, "microseconds": 966463 } }
4708 # Since: 1.7
4710 { 'event': 'BLOCK_IMAGE_CORRUPTED',
4711   'data': { 'device'     : 'str',
4712             '*node-name' : 'str',
4713             'msg'        : 'str',
4714             '*offset'    : 'int',
4715             '*size'      : 'int',
4716             'fatal'      : 'bool' } }
4719 # @BLOCK_IO_ERROR:
4721 # Emitted when a disk I/O error occurs
4723 # @device: device name. This is always present for compatibility
4724 #          reasons, but it can be empty ("") if the image does not
4725 #          have a device name associated.
4727 # @node-name: node name. Note that errors may be reported for the root node
4728 #             that is directly attached to a guest device rather than for the
4729 #             node where the error occurred. The node name is not present if
4730 #             the drive is empty. (Since: 2.8)
4732 # @operation: I/O operation
4734 # @action: action that has been taken
4736 # @nospace: true if I/O error was caused due to a no-space
4737 #           condition. This key is only present if query-block's
4738 #           io-status is present, please see query-block documentation
4739 #           for more information (since: 2.2)
4741 # @reason: human readable string describing the error cause.
4742 #          (This field is a debugging aid for humans, it should not
4743 #          be parsed by applications) (since: 2.2)
4745 # Note: If action is "stop", a STOP event will eventually follow the
4746 #       BLOCK_IO_ERROR event
4748 # Since: 0.13.0
4750 # Example:
4752 # <- { "event": "BLOCK_IO_ERROR",
4753 #      "data": { "device": "ide0-hd1",
4754 #                "node-name": "#block212",
4755 #                "operation": "write",
4756 #                "action": "stop" },
4757 #      "timestamp": { "seconds": 1265044230, "microseconds": 450486 } }
4760 { 'event': 'BLOCK_IO_ERROR',
4761   'data': { 'device': 'str', '*node-name': 'str',
4762             'operation': 'IoOperationType',
4763             'action': 'BlockErrorAction', '*nospace': 'bool',
4764             'reason': 'str' } }
4767 # @BLOCK_JOB_COMPLETED:
4769 # Emitted when a block job has completed
4771 # @type: job type
4773 # @device: The job identifier. Originally the device name but other
4774 #          values are allowed since QEMU 2.7
4776 # @len: maximum progress value
4778 # @offset: current progress value. On success this is equal to len.
4779 #          On failure this is less than len
4781 # @speed: rate limit, bytes per second
4783 # @error: error message. Only present on failure. This field
4784 #         contains a human-readable error message. There are no semantics
4785 #         other than that streaming has failed and clients should not try to
4786 #         interpret the error string
4788 # Since: 1.1
4790 # Example:
4792 # <- { "event": "BLOCK_JOB_COMPLETED",
4793 #      "data": { "type": "stream", "device": "virtio-disk0",
4794 #                "len": 10737418240, "offset": 10737418240,
4795 #                "speed": 0 },
4796 #      "timestamp": { "seconds": 1267061043, "microseconds": 959568 } }
4799 { 'event': 'BLOCK_JOB_COMPLETED',
4800   'data': { 'type'  : 'JobType',
4801             'device': 'str',
4802             'len'   : 'int',
4803             'offset': 'int',
4804             'speed' : 'int',
4805             '*error': 'str' } }
4808 # @BLOCK_JOB_CANCELLED:
4810 # Emitted when a block job has been cancelled
4812 # @type: job type
4814 # @device: The job identifier. Originally the device name but other
4815 #          values are allowed since QEMU 2.7
4817 # @len: maximum progress value
4819 # @offset: current progress value. On success this is equal to len.
4820 #          On failure this is less than len
4822 # @speed: rate limit, bytes per second
4824 # Since: 1.1
4826 # Example:
4828 # <- { "event": "BLOCK_JOB_CANCELLED",
4829 #      "data": { "type": "stream", "device": "virtio-disk0",
4830 #                "len": 10737418240, "offset": 134217728,
4831 #                "speed": 0 },
4832 #      "timestamp": { "seconds": 1267061043, "microseconds": 959568 } }
4835 { 'event': 'BLOCK_JOB_CANCELLED',
4836   'data': { 'type'  : 'JobType',
4837             'device': 'str',
4838             'len'   : 'int',
4839             'offset': 'int',
4840             'speed' : 'int' } }
4843 # @BLOCK_JOB_ERROR:
4845 # Emitted when a block job encounters an error
4847 # @device: The job identifier. Originally the device name but other
4848 #          values are allowed since QEMU 2.7
4850 # @operation: I/O operation
4852 # @action: action that has been taken
4854 # Since: 1.3
4856 # Example:
4858 # <- { "event": "BLOCK_JOB_ERROR",
4859 #      "data": { "device": "ide0-hd1",
4860 #                "operation": "write",
4861 #                "action": "stop" },
4862 #      "timestamp": { "seconds": 1265044230, "microseconds": 450486 } }
4865 { 'event': 'BLOCK_JOB_ERROR',
4866   'data': { 'device'   : 'str',
4867             'operation': 'IoOperationType',
4868             'action'   : 'BlockErrorAction' } }
4871 # @BLOCK_JOB_READY:
4873 # Emitted when a block job is ready to complete
4875 # @type: job type
4877 # @device: The job identifier. Originally the device name but other
4878 #          values are allowed since QEMU 2.7
4880 # @len: maximum progress value
4882 # @offset: current progress value. On success this is equal to len.
4883 #          On failure this is less than len
4885 # @speed: rate limit, bytes per second
4887 # Note: The "ready to complete" status is always reset by a @BLOCK_JOB_ERROR
4888 #       event
4890 # Since: 1.3
4892 # Example:
4894 # <- { "event": "BLOCK_JOB_READY",
4895 #      "data": { "device": "drive0", "type": "mirror", "speed": 0,
4896 #                "len": 2097152, "offset": 2097152 }
4897 #      "timestamp": { "seconds": 1265044230, "microseconds": 450486 } }
4900 { 'event': 'BLOCK_JOB_READY',
4901   'data': { 'type'  : 'JobType',
4902             'device': 'str',
4903             'len'   : 'int',
4904             'offset': 'int',
4905             'speed' : 'int' } }
4908 # @BLOCK_JOB_PENDING:
4910 # Emitted when a block job is awaiting explicit authorization to finalize graph
4911 # changes via @block-job-finalize. If this job is part of a transaction, it will
4912 # not emit this event until the transaction has converged first.
4914 # @type: job type
4916 # @id: The job identifier.
4918 # Since: 2.12
4920 # Example:
4922 # <- { "event": "BLOCK_JOB_WAITING",
4923 #      "data": { "device": "drive0", "type": "mirror" },
4924 #      "timestamp": { "seconds": 1265044230, "microseconds": 450486 } }
4927 { 'event': 'BLOCK_JOB_PENDING',
4928   'data': { 'type'  : 'JobType',
4929             'id'    : 'str' } }
4932 # @PreallocMode:
4934 # Preallocation mode of QEMU image file
4936 # @off: no preallocation
4937 # @metadata: preallocate only for metadata
4938 # @falloc: like @full preallocation but allocate disk space by
4939 #          posix_fallocate() rather than writing data.
4940 # @full: preallocate all data by writing it to the device to ensure
4941 #        disk space is really available. This data may or may not be
4942 #        zero, depending on the image format and storage.
4943 #        @full preallocation also sets up metadata correctly.
4945 # Since: 2.2
4947 { 'enum': 'PreallocMode',
4948   'data': [ 'off', 'metadata', 'falloc', 'full' ] }
4951 # @BLOCK_WRITE_THRESHOLD:
4953 # Emitted when writes on block device reaches or exceeds the
4954 # configured write threshold. For thin-provisioned devices, this
4955 # means the device should be extended to avoid pausing for
4956 # disk exhaustion.
4957 # The event is one shot. Once triggered, it needs to be
4958 # re-registered with another block-set-write-threshold command.
4960 # @node-name: graph node name on which the threshold was exceeded.
4962 # @amount-exceeded: amount of data which exceeded the threshold, in bytes.
4964 # @write-threshold: last configured threshold, in bytes.
4966 # Since: 2.3
4968 { 'event': 'BLOCK_WRITE_THRESHOLD',
4969   'data': { 'node-name': 'str',
4970             'amount-exceeded': 'uint64',
4971             'write-threshold': 'uint64' } }
4974 # @block-set-write-threshold:
4976 # Change the write threshold for a block drive. An event will be
4977 # delivered if a write to this block drive crosses the configured
4978 # threshold.  The threshold is an offset, thus must be
4979 # non-negative. Default is no write threshold. Setting the threshold
4980 # to zero disables it.
4982 # This is useful to transparently resize thin-provisioned drives without
4983 # the guest OS noticing.
4985 # @node-name: graph node name on which the threshold must be set.
4987 # @write-threshold: configured threshold for the block device, bytes.
4988 #                   Use 0 to disable the threshold.
4990 # Since: 2.3
4992 # Example:
4994 # -> { "execute": "block-set-write-threshold",
4995 #      "arguments": { "node-name": "mydev",
4996 #                     "write-threshold": 17179869184 } }
4997 # <- { "return": {} }
5000 { 'command': 'block-set-write-threshold',
5001   'data': { 'node-name': 'str', 'write-threshold': 'uint64' } }
5004 # @x-blockdev-change:
5006 # Dynamically reconfigure the block driver state graph. It can be used
5007 # to add, remove, insert or replace a graph node. Currently only the
5008 # Quorum driver implements this feature to add or remove its child. This
5009 # is useful to fix a broken quorum child.
5011 # If @node is specified, it will be inserted under @parent. @child
5012 # may not be specified in this case. If both @parent and @child are
5013 # specified but @node is not, @child will be detached from @parent.
5015 # @parent: the id or name of the parent node.
5017 # @child: the name of a child under the given parent node.
5019 # @node: the name of the node that will be added.
5021 # Note: this command is experimental, and its API is not stable. It
5022 #       does not support all kinds of operations, all kinds of children, nor
5023 #       all block drivers.
5025 #       FIXME Removing children from a quorum node means introducing gaps in the
5026 #       child indices. This cannot be represented in the 'children' list of
5027 #       BlockdevOptionsQuorum, as returned by .bdrv_refresh_filename().
5029 #       Warning: The data in a new quorum child MUST be consistent with that of
5030 #       the rest of the array.
5032 # Since: 2.7
5034 # Example:
5036 # 1. Add a new node to a quorum
5037 # -> { "execute": "blockdev-add",
5038 #      "arguments": {
5039 #          "driver": "raw",
5040 #          "node-name": "new_node",
5041 #          "file": { "driver": "file",
5042 #                    "filename": "test.raw" } } }
5043 # <- { "return": {} }
5044 # -> { "execute": "x-blockdev-change",
5045 #      "arguments": { "parent": "disk1",
5046 #                     "node": "new_node" } }
5047 # <- { "return": {} }
5049 # 2. Delete a quorum's node
5050 # -> { "execute": "x-blockdev-change",
5051 #      "arguments": { "parent": "disk1",
5052 #                     "child": "children.1" } }
5053 # <- { "return": {} }
5056 { 'command': 'x-blockdev-change',
5057   'data' : { 'parent': 'str',
5058              '*child': 'str',
5059              '*node': 'str' } }
5062 # @x-blockdev-set-iothread:
5064 # Move @node and its children into the @iothread.  If @iothread is null then
5065 # move @node and its children into the main loop.
5067 # The node must not be attached to a BlockBackend.
5069 # @node-name: the name of the block driver node
5071 # @iothread: the name of the IOThread object or null for the main loop
5073 # @force: true if the node and its children should be moved when a BlockBackend
5074 #         is already attached
5076 # Note: this command is experimental and intended for test cases that need
5077 #       control over IOThreads only.
5079 # Since: 2.12
5081 # Example:
5083 # 1. Move a node into an IOThread
5084 # -> { "execute": "x-blockdev-set-iothread",
5085 #      "arguments": { "node-name": "disk1",
5086 #                     "iothread": "iothread0" } }
5087 # <- { "return": {} }
5089 # 2. Move a node into the main loop
5090 # -> { "execute": "x-blockdev-set-iothread",
5091 #      "arguments": { "node-name": "disk1",
5092 #                     "iothread": null } }
5093 # <- { "return": {} }
5096 { 'command': 'x-blockdev-set-iothread',
5097   'data' : { 'node-name': 'str',
5098              'iothread': 'StrOrNull',
5099              '*force': 'bool' } }
5102 # @NbdServerOptions:
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 # Keep this type consistent with the nbd-server-start arguments. The only
5113 # intended difference is using SocketAddress instead of SocketAddressLegacy.
5115 # Since: 4.2
5117 { 'struct': 'NbdServerOptions',
5118   'data': { 'addr': 'SocketAddress',
5119             '*tls-creds': 'str',
5120             '*tls-authz': 'str'} }
5123 # @nbd-server-start:
5125 # Start an NBD server listening on the given host and port.  Block
5126 # devices can then be exported using @nbd-server-add.  The NBD
5127 # server will present them as named exports; for example, another
5128 # QEMU instance could refer to them as "nbd:HOST:PORT:exportname=NAME".
5130 # @addr: Address on which to listen.
5131 # @tls-creds: ID of the TLS credentials object (since 2.6).
5132 # @tls-authz: ID of the QAuthZ authorization object used to validate
5133 #             the client's x509 distinguished name. This object is
5134 #             is only resolved at time of use, so can be deleted and
5135 #             recreated on the fly while the NBD server is active.
5136 #             If missing, it will default to denying access (since 4.0).
5138 # Returns: error if the server is already running.
5140 # Keep this type consistent with the NbdServerOptions type. The only intended
5141 # difference is using SocketAddressLegacy instead of SocketAddress.
5143 # Since: 1.3.0
5145 { 'command': 'nbd-server-start',
5146   'data': { 'addr': 'SocketAddressLegacy',
5147             '*tls-creds': 'str',
5148             '*tls-authz': 'str'} }
5151 # @BlockExportNbd:
5153 # An NBD block export.
5155 # @device: The device name or node name of the node to be exported
5157 # @name: Export name. If unspecified, the @device parameter is used as the
5158 #        export name. (Since 2.12)
5160 # @description: Free-form description of the export, up to 4096 bytes.
5161 #               (Since 5.0)
5163 # @writable: Whether clients should be able to write to the device via the
5164 #            NBD connection (default false).
5166 # @bitmap: Also export the dirty bitmap reachable from @device, so the
5167 #          NBD client can use NBD_OPT_SET_META_CONTEXT with
5168 #          "qemu:dirty-bitmap:NAME" to inspect the bitmap. (since 4.0)
5170 # Since: 5.0
5172 { 'struct': 'BlockExportNbd',
5173   'data': {'device': 'str', '*name': 'str', '*description': 'str',
5174            '*writable': 'bool', '*bitmap': 'str' } }
5177 # @nbd-server-add:
5179 # Export a block node to QEMU's embedded NBD server.
5181 # Returns: error if the server is not running, or export with the same name
5182 #          already exists.
5184 # Since: 1.3.0
5186 { 'command': 'nbd-server-add',
5187   'data': 'BlockExportNbd', 'boxed': true }
5190 # @NbdServerRemoveMode:
5192 # Mode for removing an NBD export.
5194 # @safe: Remove export if there are no existing connections, fail otherwise.
5196 # @hard: Drop all connections immediately and remove export.
5198 # Potential additional modes to be added in the future:
5200 # hide: Just hide export from new clients, leave existing connections as is.
5201 # Remove export after all clients are disconnected.
5203 # soft: Hide export from new clients, answer with ESHUTDOWN for all further
5204 # requests from existing clients.
5206 # Since: 2.12
5208 {'enum': 'NbdServerRemoveMode', 'data': ['safe', 'hard']}
5211 # @nbd-server-remove:
5213 # Remove NBD export by name.
5215 # @name: Export name.
5217 # @mode: Mode of command operation. See @NbdServerRemoveMode description.
5218 #        Default is 'safe'.
5220 # Returns: error if
5221 #            - the server is not running
5222 #            - export is not found
5223 #            - mode is 'safe' and there are existing connections
5225 # Since: 2.12
5227 { 'command': 'nbd-server-remove',
5228   'data': {'name': 'str', '*mode': 'NbdServerRemoveMode'} }
5231 # @nbd-server-stop:
5233 # Stop QEMU's embedded NBD server, and unregister all devices previously
5234 # added via @nbd-server-add.
5236 # Since: 1.3.0
5238 { 'command': 'nbd-server-stop' }
5241 # @BlockExportType:
5243 # An enumeration of block export types
5245 # @nbd: NBD export
5247 # Since: 4.2
5249 { 'enum': 'BlockExportType',
5250   'data': [ 'nbd' ] }
5253 # @BlockExport:
5255 # Describes a block export, i.e. how single node should be exported on an
5256 # external interface.
5258 # Since: 4.2
5260 { 'union': 'BlockExport',
5261   'base': { 'type': 'BlockExportType' },
5262   'discriminator': 'type',
5263   'data': {
5264       'nbd': 'BlockExportNbd'
5265    } }
5268 # @QuorumOpType:
5270 # An enumeration of the quorum operation types
5272 # @read: read operation
5274 # @write: write operation
5276 # @flush: flush operation
5278 # Since: 2.6
5280 { 'enum': 'QuorumOpType',
5281   'data': [ 'read', 'write', 'flush' ] }
5284 # @QUORUM_FAILURE:
5286 # Emitted by the Quorum block driver if it fails to establish a quorum
5288 # @reference: device name if defined else node name
5290 # @sector-num: number of the first sector of the failed read operation
5292 # @sectors-count: failed read operation sector count
5294 # Note: This event is rate-limited.
5296 # Since: 2.0
5298 # Example:
5300 # <- { "event": "QUORUM_FAILURE",
5301 #      "data": { "reference": "usr1", "sector-num": 345435, "sectors-count": 5 },
5302 #      "timestamp": { "seconds": 1344522075, "microseconds": 745528 } }
5305 { 'event': 'QUORUM_FAILURE',
5306   'data': { 'reference': 'str', 'sector-num': 'int', 'sectors-count': 'int' } }
5309 # @QUORUM_REPORT_BAD:
5311 # Emitted to report a corruption of a Quorum file
5313 # @type: quorum operation type (Since 2.6)
5315 # @error: error message. Only present on failure. This field
5316 #         contains a human-readable error message. There are no semantics other
5317 #         than that the block layer reported an error and clients should not
5318 #         try to interpret the error string.
5320 # @node-name: the graph node name of the block driver state
5322 # @sector-num: number of the first sector of the failed read operation
5324 # @sectors-count: failed read operation sector count
5326 # Note: This event is rate-limited.
5328 # Since: 2.0
5330 # Example:
5332 # 1. Read operation
5334 # { "event": "QUORUM_REPORT_BAD",
5335 #      "data": { "node-name": "node0", "sector-num": 345435, "sectors-count": 5,
5336 #                "type": "read" },
5337 #      "timestamp": { "seconds": 1344522075, "microseconds": 745528 } }
5339 # 2. Flush operation
5341 # { "event": "QUORUM_REPORT_BAD",
5342 #      "data": { "node-name": "node0", "sector-num": 0, "sectors-count": 2097120,
5343 #                "type": "flush", "error": "Broken pipe" },
5344 #      "timestamp": { "seconds": 1456406829, "microseconds": 291763 } }
5347 { 'event': 'QUORUM_REPORT_BAD',
5348   'data': { 'type': 'QuorumOpType', '*error': 'str', 'node-name': 'str',
5349             'sector-num': 'int', 'sectors-count': 'int' } }
5352 # @BlockdevSnapshotInternal:
5354 # @device: the device name or node-name of a root node to generate the snapshot
5355 #          from
5357 # @name: the name of the internal snapshot to be created
5359 # Notes: In transaction, if @name is empty, or any snapshot matching @name
5360 #        exists, the operation will fail. Only some image formats support it,
5361 #        for example, qcow2, rbd, and sheepdog.
5363 # Since: 1.7
5365 { 'struct': 'BlockdevSnapshotInternal',
5366   'data': { 'device': 'str', 'name': 'str' } }
5369 # @blockdev-snapshot-internal-sync:
5371 # Synchronously take an internal snapshot of a block device, when the
5372 # format of the image used supports it. If the name is an empty
5373 # string, or a snapshot with name already exists, the operation will
5374 # fail.
5376 # For the arguments, see the documentation of BlockdevSnapshotInternal.
5378 # Returns: - nothing on success
5379 #          - If @device is not a valid block device, GenericError
5380 #          - If any snapshot matching @name exists, or @name is empty,
5381 #            GenericError
5382 #          - If the format of the image used does not support it,
5383 #            BlockFormatFeatureNotSupported
5385 # Since: 1.7
5387 # Example:
5389 # -> { "execute": "blockdev-snapshot-internal-sync",
5390 #      "arguments": { "device": "ide-hd0",
5391 #                     "name": "snapshot0" }
5392 #    }
5393 # <- { "return": {} }
5396 { 'command': 'blockdev-snapshot-internal-sync',
5397   'data': 'BlockdevSnapshotInternal' }
5400 # @blockdev-snapshot-delete-internal-sync:
5402 # Synchronously delete an internal snapshot of a block device, when the format
5403 # of the image used support it. The snapshot is identified by name or id or
5404 # both. One of the name or id is required. Return SnapshotInfo for the
5405 # successfully deleted snapshot.
5407 # @device: the device name or node-name of a root node to delete the snapshot
5408 #          from
5410 # @id: optional the snapshot's ID to be deleted
5412 # @name: optional the snapshot's name to be deleted
5414 # Returns: - SnapshotInfo on success
5415 #          - If @device is not a valid block device, GenericError
5416 #          - If snapshot not found, GenericError
5417 #          - If the format of the image used does not support it,
5418 #            BlockFormatFeatureNotSupported
5419 #          - If @id and @name are both not specified, GenericError
5421 # Since: 1.7
5423 # Example:
5425 # -> { "execute": "blockdev-snapshot-delete-internal-sync",
5426 #      "arguments": { "device": "ide-hd0",
5427 #                     "name": "snapshot0" }
5428 #    }
5429 # <- { "return": {
5430 #                    "id": "1",
5431 #                    "name": "snapshot0",
5432 #                    "vm-state-size": 0,
5433 #                    "date-sec": 1000012,
5434 #                    "date-nsec": 10,
5435 #                    "vm-clock-sec": 100,
5436 #                    "vm-clock-nsec": 20
5437 #      }
5438 #    }
5441 { 'command': 'blockdev-snapshot-delete-internal-sync',
5442   'data': { 'device': 'str', '*id': 'str', '*name': 'str'},
5443   'returns': 'SnapshotInfo' }