include/ui/console.h: Delete is_surface_bgr()
[qemu/ar7.git] / qapi / block-core.json
blob1c3f1deb0381f0e4afe4d8561800378b3b15b16c
1 # -*- Mode: Python -*-
2 # vim: filetype=python
4 ##
5 # == Block core (VM unrelated)
6 ##
8 { 'include': 'common.json' }
9 { 'include': 'crypto.json' }
10 { 'include': 'job.json' }
11 { 'include': 'sockets.json' }
14 # @SnapshotInfo:
16 # @id: unique snapshot id
18 # @name: user chosen name
20 # @vm-state-size: size of the VM state
22 # @date-sec: UTC date of the snapshot in seconds
24 # @date-nsec: fractional part in nano seconds to be used with date-sec
26 # @vm-clock-sec: VM clock relative to boot in seconds
28 # @vm-clock-nsec: fractional part in nano seconds to be used with vm-clock-sec
30 # @icount: Current instruction count. Appears when execution record/replay
31 #          is enabled. Used for "time-traveling" to match the moment
32 #          in the recorded execution with the snapshots. This counter may
33 #          be obtained through @query-replay command (since 5.2)
35 # Since: 1.3
38 { 'struct': 'SnapshotInfo',
39   'data': { 'id': 'str', 'name': 'str', 'vm-state-size': 'int',
40             'date-sec': 'int', 'date-nsec': 'int',
41             'vm-clock-sec': 'int', 'vm-clock-nsec': 'int',
42             '*icount': 'int' } }
45 # @ImageInfoSpecificQCow2EncryptionBase:
47 # @format: The encryption format
49 # Since: 2.10
51 { 'struct': 'ImageInfoSpecificQCow2EncryptionBase',
52   'data': { 'format': 'BlockdevQcow2EncryptionFormat'}}
55 # @ImageInfoSpecificQCow2Encryption:
57 # Since: 2.10
59 { 'union': 'ImageInfoSpecificQCow2Encryption',
60   'base': 'ImageInfoSpecificQCow2EncryptionBase',
61   'discriminator': 'format',
62   'data': { 'luks': 'QCryptoBlockInfoLUKS' } }
65 # @ImageInfoSpecificQCow2:
67 # @compat: compatibility level
69 # @data-file: the filename of the external data file that is stored in the
70 #             image and used as a default for opening the image (since: 4.0)
72 # @data-file-raw: True if the external data file must stay valid as a
73 #                 standalone (read-only) raw image without looking at qcow2
74 #                 metadata (since: 4.0)
76 # @extended-l2: true if the image has extended L2 entries; only valid for
77 #               compat >= 1.1 (since 5.2)
79 # @lazy-refcounts: on or off; only valid for compat >= 1.1
81 # @corrupt: true if the image has been marked corrupt; only valid for
82 #           compat >= 1.1 (since 2.2)
84 # @refcount-bits: width of a refcount entry in bits (since 2.3)
86 # @encrypt: details about encryption parameters; only set if image
87 #           is encrypted (since 2.10)
89 # @bitmaps: A list of qcow2 bitmap details (since 4.0)
91 # @compression-type: the image cluster compression method (since 5.1)
93 # Since: 1.7
95 { 'struct': 'ImageInfoSpecificQCow2',
96   'data': {
97       'compat': 'str',
98       '*data-file': 'str',
99       '*data-file-raw': 'bool',
100       '*extended-l2': 'bool',
101       '*lazy-refcounts': 'bool',
102       '*corrupt': 'bool',
103       'refcount-bits': 'int',
104       '*encrypt': 'ImageInfoSpecificQCow2Encryption',
105       '*bitmaps': ['Qcow2BitmapInfo'],
106       'compression-type': 'Qcow2CompressionType'
107   } }
110 # @ImageInfoSpecificVmdk:
112 # @create-type: The create type of VMDK image
114 # @cid: Content id of image
116 # @parent-cid: Parent VMDK image's cid
118 # @extents: List of extent files
120 # Since: 1.7
122 { 'struct': 'ImageInfoSpecificVmdk',
123   'data': {
124       'create-type': 'str',
125       'cid': 'int',
126       'parent-cid': 'int',
127       'extents': ['ImageInfo']
128   } }
131 # @ImageInfoSpecific:
133 # A discriminated record of image format specific information structures.
135 # Since: 1.7
137 { 'union': 'ImageInfoSpecific',
138   'data': {
139       'qcow2': 'ImageInfoSpecificQCow2',
140       'vmdk': 'ImageInfoSpecificVmdk',
141       # If we need to add block driver specific parameters for
142       # LUKS in future, then we'll subclass QCryptoBlockInfoLUKS
143       # to define a ImageInfoSpecificLUKS
144       'luks': 'QCryptoBlockInfoLUKS'
145   } }
148 # @ImageInfo:
150 # Information about a QEMU image file
152 # @filename: name of the image file
154 # @format: format of the image file
156 # @virtual-size: maximum capacity in bytes of the image
158 # @actual-size: actual size on disk in bytes of the image
160 # @dirty-flag: true if image is not cleanly closed
162 # @cluster-size: size of a cluster in bytes
164 # @encrypted: true if the image is encrypted
166 # @compressed: true if the image is compressed (Since 1.7)
168 # @backing-filename: name of the backing file
170 # @full-backing-filename: full path of the backing file
172 # @backing-filename-format: the format of the backing file
174 # @snapshots: list of VM snapshots
176 # @backing-image: info of the backing image (since 1.6)
178 # @format-specific: structure supplying additional format-specific
179 #                   information (since 1.7)
181 # Since: 1.3
184 { 'struct': 'ImageInfo',
185   'data': {'filename': 'str', 'format': 'str', '*dirty-flag': 'bool',
186            '*actual-size': 'int', 'virtual-size': 'int',
187            '*cluster-size': 'int', '*encrypted': 'bool', '*compressed': 'bool',
188            '*backing-filename': 'str', '*full-backing-filename': 'str',
189            '*backing-filename-format': 'str', '*snapshots': ['SnapshotInfo'],
190            '*backing-image': 'ImageInfo',
191            '*format-specific': 'ImageInfoSpecific' } }
194 # @ImageCheck:
196 # Information about a QEMU image file check
198 # @filename: name of the image file checked
200 # @format: format of the image file checked
202 # @check-errors: number of unexpected errors occurred during check
204 # @image-end-offset: offset (in bytes) where the image ends, this
205 #                    field is present if the driver for the image format
206 #                    supports it
208 # @corruptions: number of corruptions found during the check if any
210 # @leaks: number of leaks found during the check if any
212 # @corruptions-fixed: number of corruptions fixed during the check
213 #                     if any
215 # @leaks-fixed: number of leaks fixed during the check if any
217 # @total-clusters: total number of clusters, this field is present
218 #                  if the driver for the image format supports it
220 # @allocated-clusters: total number of allocated clusters, this
221 #                      field is present if the driver for the image format
222 #                      supports it
224 # @fragmented-clusters: total number of fragmented clusters, this
225 #                       field is present if the driver for the image format
226 #                       supports it
228 # @compressed-clusters: total number of compressed clusters, this
229 #                       field is present if the driver for the image format
230 #                       supports it
232 # Since: 1.4
235 { 'struct': 'ImageCheck',
236   'data': {'filename': 'str', 'format': 'str', 'check-errors': 'int',
237            '*image-end-offset': 'int', '*corruptions': 'int', '*leaks': 'int',
238            '*corruptions-fixed': 'int', '*leaks-fixed': 'int',
239            '*total-clusters': 'int', '*allocated-clusters': 'int',
240            '*fragmented-clusters': 'int', '*compressed-clusters': 'int' } }
243 # @MapEntry:
245 # Mapping information from a virtual block range to a host file range
247 # @start: virtual (guest) offset of the first byte described by this
248 #         entry
250 # @length: the number of bytes of the mapped virtual range
252 # @data: reading the image will actually read data from a file (in
253 #        particular, if @offset is present this means that the sectors
254 #        are not simply preallocated, but contain actual data in raw
255 #        format)
257 # @zero: whether the virtual blocks read as zeroes
259 # @depth: number of layers (0 = top image, 1 = top image's backing
260 #         file, ..., n - 1 = bottom image (where n is the number of
261 #         images in the chain)) before reaching one for which the
262 #         range is allocated
264 # @offset: if present, the image file stores the data for this range
265 #          in raw format at the given (host) offset
267 # @filename: filename that is referred to by @offset
269 # Since: 2.6
272 { 'struct': 'MapEntry',
273   'data': {'start': 'int', 'length': 'int', 'data': 'bool',
274            'zero': 'bool', 'depth': 'int', '*offset': 'int',
275            '*filename': 'str' } }
278 # @BlockdevCacheInfo:
280 # Cache mode information for a block device
282 # @writeback:   true if writeback mode is enabled
283 # @direct:      true if the host page cache is bypassed (O_DIRECT)
284 # @no-flush:    true if flush requests are ignored for the device
286 # Since: 2.3
288 { 'struct': 'BlockdevCacheInfo',
289   'data': { 'writeback': 'bool',
290             'direct': 'bool',
291             'no-flush': 'bool' } }
294 # @BlockDeviceInfo:
296 # Information about the backing device for a block device.
298 # @file: the filename of the backing device
300 # @node-name: the name of the block driver node (Since 2.0)
302 # @ro: true if the backing device was open read-only
304 # @drv: the name of the block format used to open the backing device. As of
305 #       0.14 this can be: 'blkdebug', 'bochs', 'cloop', 'cow', 'dmg',
306 #       'file', 'file', 'ftp', 'ftps', 'host_cdrom', 'host_device',
307 #       'http', 'https', 'luks', 'nbd', 'parallels', 'qcow',
308 #       'qcow2', 'raw', 'vdi', 'vmdk', 'vpc', 'vvfat'
309 #       2.2: 'archipelago' added, 'cow' dropped
310 #       2.3: 'host_floppy' deprecated
311 #       2.5: 'host_floppy' dropped
312 #       2.6: 'luks' added
313 #       2.8: 'replication' added, 'tftp' dropped
314 #       2.9: 'archipelago' dropped
316 # @backing_file: the name of the backing file (for copy-on-write)
318 # @backing_file_depth: number of files in the backing file chain (since: 1.2)
320 # @encrypted: true if the backing device is encrypted
322 # @detect_zeroes: detect and optimize zero writes (Since 2.1)
324 # @bps: total throughput limit in bytes per second is specified
326 # @bps_rd: read throughput limit in bytes per second is specified
328 # @bps_wr: write throughput limit in bytes per second is specified
330 # @iops: total I/O operations per second is specified
332 # @iops_rd: read I/O operations per second is specified
334 # @iops_wr: write I/O operations per second is specified
336 # @image: the info of image used (since: 1.6)
338 # @bps_max: total throughput limit during bursts,
339 #                     in bytes (Since 1.7)
341 # @bps_rd_max: read throughput limit during bursts,
342 #                        in bytes (Since 1.7)
344 # @bps_wr_max: write throughput limit during bursts,
345 #                        in bytes (Since 1.7)
347 # @iops_max: total I/O operations per second during bursts,
348 #                      in bytes (Since 1.7)
350 # @iops_rd_max: read I/O operations per second during bursts,
351 #                         in bytes (Since 1.7)
353 # @iops_wr_max: write I/O operations per second during bursts,
354 #                         in bytes (Since 1.7)
356 # @bps_max_length: maximum length of the @bps_max burst
357 #                            period, in seconds. (Since 2.6)
359 # @bps_rd_max_length: maximum length of the @bps_rd_max
360 #                               burst period, in seconds. (Since 2.6)
362 # @bps_wr_max_length: maximum length of the @bps_wr_max
363 #                               burst period, in seconds. (Since 2.6)
365 # @iops_max_length: maximum length of the @iops burst
366 #                             period, in seconds. (Since 2.6)
368 # @iops_rd_max_length: maximum length of the @iops_rd_max
369 #                                burst period, in seconds. (Since 2.6)
371 # @iops_wr_max_length: maximum length of the @iops_wr_max
372 #                                burst period, in seconds. (Since 2.6)
374 # @iops_size: an I/O size in bytes (Since 1.7)
376 # @group: throttle group name (Since 2.4)
378 # @cache: the cache mode used for the block device (since: 2.3)
380 # @write_threshold: configured write threshold for the device.
381 #                   0 if disabled. (Since 2.3)
383 # @dirty-bitmaps: dirty bitmaps information (only present if node
384 #                 has one or more dirty bitmaps) (Since 4.2)
386 # Since: 0.14
389 { 'struct': 'BlockDeviceInfo',
390   'data': { 'file': 'str', '*node-name': 'str', 'ro': 'bool', 'drv': 'str',
391             '*backing_file': 'str', 'backing_file_depth': 'int',
392             'encrypted': 'bool',
393             'detect_zeroes': 'BlockdevDetectZeroesOptions',
394             'bps': 'int', 'bps_rd': 'int', 'bps_wr': 'int',
395             'iops': 'int', 'iops_rd': 'int', 'iops_wr': 'int',
396             'image': 'ImageInfo',
397             '*bps_max': 'int', '*bps_rd_max': 'int',
398             '*bps_wr_max': 'int', '*iops_max': 'int',
399             '*iops_rd_max': 'int', '*iops_wr_max': 'int',
400             '*bps_max_length': 'int', '*bps_rd_max_length': 'int',
401             '*bps_wr_max_length': 'int', '*iops_max_length': 'int',
402             '*iops_rd_max_length': 'int', '*iops_wr_max_length': 'int',
403             '*iops_size': 'int', '*group': 'str', 'cache': 'BlockdevCacheInfo',
404             'write_threshold': 'int', '*dirty-bitmaps': ['BlockDirtyInfo'] } }
407 # @BlockDeviceIoStatus:
409 # An enumeration of block device I/O status.
411 # @ok: The last I/O operation has succeeded
413 # @failed: The last I/O operation has failed
415 # @nospace: The last I/O operation has failed due to a no-space condition
417 # Since: 1.0
419 { 'enum': 'BlockDeviceIoStatus', 'data': [ 'ok', 'failed', 'nospace' ] }
422 # @BlockDirtyInfo:
424 # Block dirty bitmap information.
426 # @name: the name of the dirty bitmap (Since 2.4)
428 # @count: number of dirty bytes according to the dirty bitmap
430 # @granularity: granularity of the dirty bitmap in bytes (since 1.4)
432 # @recording: true if the bitmap is recording new writes from the guest.
433 #             Replaces `active` and `disabled` statuses. (since 4.0)
435 # @busy: true if the bitmap is in-use by some operation (NBD or jobs)
436 #        and cannot be modified via QMP or used by another operation.
437 #        Replaces `locked` and `frozen` statuses. (since 4.0)
439 # @persistent: true if the bitmap was stored on disk, is scheduled to be stored
440 #              on disk, or both. (since 4.0)
442 # @inconsistent: true if this is a persistent bitmap that was improperly
443 #                stored. Implies @persistent to be true; @recording and
444 #                @busy to be false. This bitmap cannot be used. To remove
445 #                it, use @block-dirty-bitmap-remove. (Since 4.0)
447 # Since: 1.3
449 { 'struct': 'BlockDirtyInfo',
450   'data': {'*name': 'str', 'count': 'int', 'granularity': 'uint32',
451            'recording': 'bool', 'busy': 'bool',
452            'persistent': 'bool', '*inconsistent': 'bool' } }
455 # @Qcow2BitmapInfoFlags:
457 # An enumeration of flags that a bitmap can report to the user.
459 # @in-use: This flag is set by any process actively modifying the qcow2 file,
460 #          and cleared when the updated bitmap is flushed to the qcow2 image.
461 #          The presence of this flag in an offline image means that the bitmap
462 #          was not saved correctly after its last usage, and may contain
463 #          inconsistent data.
465 # @auto: The bitmap must reflect all changes of the virtual disk by any
466 #        application that would write to this qcow2 file.
468 # Since: 4.0
470 { 'enum': 'Qcow2BitmapInfoFlags',
471   'data': ['in-use', 'auto'] }
474 # @Qcow2BitmapInfo:
476 # Qcow2 bitmap information.
478 # @name: the name of the bitmap
480 # @granularity: granularity of the bitmap in bytes
482 # @flags: flags of the bitmap
484 # Since: 4.0
486 { 'struct': 'Qcow2BitmapInfo',
487   'data': {'name': 'str', 'granularity': 'uint32',
488            'flags': ['Qcow2BitmapInfoFlags'] } }
491 # @BlockLatencyHistogramInfo:
493 # Block latency histogram.
495 # @boundaries: list of interval boundary values in nanoseconds, all greater
496 #              than zero and in ascending order.
497 #              For example, the list [10, 50, 100] produces the following
498 #              histogram intervals: [0, 10), [10, 50), [50, 100), [100, +inf).
500 # @bins: list of io request counts corresponding to histogram intervals.
501 #        len(@bins) = len(@boundaries) + 1
502 #        For the example above, @bins may be something like [3, 1, 5, 2],
503 #        and corresponding histogram looks like:
505 # ::
507 #        5|           *
508 #        4|           *
509 #        3| *         *
510 #        2| *         *    *
511 #        1| *    *    *    *
512 #         +------------------
513 #             10   50   100
515 # Since: 4.0
517 { 'struct': 'BlockLatencyHistogramInfo',
518   'data': {'boundaries': ['uint64'], 'bins': ['uint64'] } }
521 # @BlockInfo:
523 # Block device information.  This structure describes a virtual device and
524 # the backing device associated with it.
526 # @device: The device name associated with the virtual device.
528 # @qdev: The qdev ID, or if no ID is assigned, the QOM path of the block
529 #        device. (since 2.10)
531 # @type: This field is returned only for compatibility reasons, it should
532 #        not be used (always returns 'unknown')
534 # @removable: True if the device supports removable media.
536 # @locked: True if the guest has locked this device from having its media
537 #          removed
539 # @tray_open: True if the device's tray is open
540 #             (only present if it has a tray)
542 # @io-status: @BlockDeviceIoStatus. Only present if the device
543 #             supports it and the VM is configured to stop on errors
544 #             (supported device models: virtio-blk, IDE, SCSI except
545 #             scsi-generic)
547 # @inserted: @BlockDeviceInfo describing the device if media is
548 #            present
550 # Since:  0.14
552 { 'struct': 'BlockInfo',
553   'data': {'device': 'str', '*qdev': 'str', 'type': 'str', 'removable': 'bool',
554            'locked': 'bool', '*inserted': 'BlockDeviceInfo',
555            '*tray_open': 'bool', '*io-status': 'BlockDeviceIoStatus' } }
558 # @BlockMeasureInfo:
560 # Image file size calculation information.  This structure describes the size
561 # requirements for creating a new image file.
563 # The size requirements depend on the new image file format.  File size always
564 # equals virtual disk size for the 'raw' format, even for sparse POSIX files.
565 # Compact formats such as 'qcow2' represent unallocated and zero regions
566 # efficiently so file size may be smaller than virtual disk size.
568 # The values are upper bounds that are guaranteed to fit the new image file.
569 # Subsequent modification, such as internal snapshot or further bitmap
570 # creation, may require additional space and is not covered here.
572 # @required: Size required for a new image file, in bytes, when copying just
573 #            allocated guest-visible contents.
575 # @fully-allocated: Image file size, in bytes, once data has been written
576 #                   to all sectors, when copying just guest-visible contents.
578 # @bitmaps: Additional size required if all the top-level bitmap metadata
579 #           in the source image were to be copied to the destination,
580 #           present only when source and destination both support
581 #           persistent bitmaps. (since 5.1)
583 # Since: 2.10
585 { 'struct': 'BlockMeasureInfo',
586   'data': {'required': 'int', 'fully-allocated': 'int', '*bitmaps': 'int'} }
589 # @query-block:
591 # Get a list of BlockInfo for all virtual block devices.
593 # Returns: a list of @BlockInfo describing each virtual block device. Filter
594 #          nodes that were created implicitly are skipped over.
596 # Since: 0.14
598 # Example:
600 # -> { "execute": "query-block" }
601 # <- {
602 #       "return":[
603 #          {
604 #             "io-status": "ok",
605 #             "device":"ide0-hd0",
606 #             "locked":false,
607 #             "removable":false,
608 #             "inserted":{
609 #                "ro":false,
610 #                "drv":"qcow2",
611 #                "encrypted":false,
612 #                "file":"disks/test.qcow2",
613 #                "backing_file_depth":1,
614 #                "bps":1000000,
615 #                "bps_rd":0,
616 #                "bps_wr":0,
617 #                "iops":1000000,
618 #                "iops_rd":0,
619 #                "iops_wr":0,
620 #                "bps_max": 8000000,
621 #                "bps_rd_max": 0,
622 #                "bps_wr_max": 0,
623 #                "iops_max": 0,
624 #                "iops_rd_max": 0,
625 #                "iops_wr_max": 0,
626 #                "iops_size": 0,
627 #                "detect_zeroes": "on",
628 #                "write_threshold": 0,
629 #                "image":{
630 #                   "filename":"disks/test.qcow2",
631 #                   "format":"qcow2",
632 #                   "virtual-size":2048000,
633 #                   "backing_file":"base.qcow2",
634 #                   "full-backing-filename":"disks/base.qcow2",
635 #                   "backing-filename-format":"qcow2",
636 #                   "snapshots":[
637 #                      {
638 #                         "id": "1",
639 #                         "name": "snapshot1",
640 #                         "vm-state-size": 0,
641 #                         "date-sec": 10000200,
642 #                         "date-nsec": 12,
643 #                         "vm-clock-sec": 206,
644 #                         "vm-clock-nsec": 30
645 #                      }
646 #                   ],
647 #                   "backing-image":{
648 #                       "filename":"disks/base.qcow2",
649 #                       "format":"qcow2",
650 #                       "virtual-size":2048000
651 #                   }
652 #                }
653 #             },
654 #             "qdev": "ide_disk",
655 #             "type":"unknown"
656 #          },
657 #          {
658 #             "io-status": "ok",
659 #             "device":"ide1-cd0",
660 #             "locked":false,
661 #             "removable":true,
662 #             "qdev": "/machine/unattached/device[23]",
663 #             "tray_open": false,
664 #             "type":"unknown"
665 #          },
666 #          {
667 #             "device":"floppy0",
668 #             "locked":false,
669 #             "removable":true,
670 #             "qdev": "/machine/unattached/device[20]",
671 #             "type":"unknown"
672 #          },
673 #          {
674 #             "device":"sd0",
675 #             "locked":false,
676 #             "removable":true,
677 #             "type":"unknown"
678 #          }
679 #       ]
680 #    }
683 { 'command': 'query-block', 'returns': ['BlockInfo'] }
687 # @BlockDeviceTimedStats:
689 # Statistics of a block device during a given interval of time.
691 # @interval_length: Interval used for calculating the statistics,
692 #                   in seconds.
694 # @min_rd_latency_ns: Minimum latency of read operations in the
695 #                     defined interval, in nanoseconds.
697 # @min_wr_latency_ns: Minimum latency of write operations in the
698 #                     defined interval, in nanoseconds.
700 # @min_flush_latency_ns: Minimum latency of flush operations in the
701 #                        defined interval, in nanoseconds.
703 # @max_rd_latency_ns: Maximum latency of read operations in the
704 #                     defined interval, in nanoseconds.
706 # @max_wr_latency_ns: Maximum latency of write operations in the
707 #                     defined interval, in nanoseconds.
709 # @max_flush_latency_ns: Maximum latency of flush operations in the
710 #                        defined interval, in nanoseconds.
712 # @avg_rd_latency_ns: Average latency of read operations in the
713 #                     defined interval, in nanoseconds.
715 # @avg_wr_latency_ns: Average latency of write operations in the
716 #                     defined interval, in nanoseconds.
718 # @avg_flush_latency_ns: Average latency of flush operations in the
719 #                        defined interval, in nanoseconds.
721 # @avg_rd_queue_depth: Average number of pending read operations
722 #                      in the defined interval.
724 # @avg_wr_queue_depth: Average number of pending write operations
725 #                      in the defined interval.
727 # Since: 2.5
729 { 'struct': 'BlockDeviceTimedStats',
730   'data': { 'interval_length': 'int', 'min_rd_latency_ns': 'int',
731             'max_rd_latency_ns': 'int', 'avg_rd_latency_ns': 'int',
732             'min_wr_latency_ns': 'int', 'max_wr_latency_ns': 'int',
733             'avg_wr_latency_ns': 'int', 'min_flush_latency_ns': 'int',
734             'max_flush_latency_ns': 'int', 'avg_flush_latency_ns': 'int',
735             'avg_rd_queue_depth': 'number', 'avg_wr_queue_depth': 'number' } }
738 # @BlockDeviceStats:
740 # Statistics of a virtual block device or a block backing device.
742 # @rd_bytes:      The number of bytes read by the device.
744 # @wr_bytes:      The number of bytes written by the device.
746 # @unmap_bytes: The number of bytes unmapped by the device (Since 4.2)
748 # @rd_operations: The number of read operations performed by the device.
750 # @wr_operations: The number of write operations performed by the device.
752 # @flush_operations: The number of cache flush operations performed by the
753 #                    device (since 0.15)
755 # @unmap_operations: The number of unmap operations performed by the device
756 #                    (Since 4.2)
758 # @rd_total_time_ns: Total time spent on reads in nanoseconds (since 0.15).
760 # @wr_total_time_ns: Total time spent on writes in nanoseconds (since 0.15).
762 # @flush_total_time_ns: Total time spent on cache flushes in nanoseconds
763 #                       (since 0.15).
765 # @unmap_total_time_ns: Total time spent on unmap operations in nanoseconds
766 #                       (Since 4.2)
768 # @wr_highest_offset: The offset after the greatest byte written to the
769 #                     device.  The intended use of this information is for
770 #                     growable sparse files (like qcow2) that are used on top
771 #                     of a physical device.
773 # @rd_merged: Number of read requests that have been merged into another
774 #             request (Since 2.3).
776 # @wr_merged: Number of write requests that have been merged into another
777 #             request (Since 2.3).
779 # @unmap_merged: Number of unmap requests that have been merged into another
780 #                request (Since 4.2)
782 # @idle_time_ns: Time since the last I/O operation, in
783 #                nanoseconds. If the field is absent it means that
784 #                there haven't been any operations yet (Since 2.5).
786 # @failed_rd_operations: The number of failed read operations
787 #                        performed by the device (Since 2.5)
789 # @failed_wr_operations: The number of failed write operations
790 #                        performed by the device (Since 2.5)
792 # @failed_flush_operations: The number of failed flush operations
793 #                           performed by the device (Since 2.5)
795 # @failed_unmap_operations: The number of failed unmap operations performed
796 #                           by the device (Since 4.2)
798 # @invalid_rd_operations: The number of invalid read operations
799 #                          performed by the device (Since 2.5)
801 # @invalid_wr_operations: The number of invalid write operations
802 #                         performed by the device (Since 2.5)
804 # @invalid_flush_operations: The number of invalid flush operations
805 #                            performed by the device (Since 2.5)
807 # @invalid_unmap_operations: The number of invalid unmap operations performed
808 #                            by the device (Since 4.2)
810 # @account_invalid: Whether invalid operations are included in the
811 #                   last access statistics (Since 2.5)
813 # @account_failed: Whether failed operations are included in the
814 #                  latency and last access statistics (Since 2.5)
816 # @timed_stats: Statistics specific to the set of previously defined
817 #               intervals of time (Since 2.5)
819 # @rd_latency_histogram: @BlockLatencyHistogramInfo. (Since 4.0)
821 # @wr_latency_histogram: @BlockLatencyHistogramInfo. (Since 4.0)
823 # @flush_latency_histogram: @BlockLatencyHistogramInfo. (Since 4.0)
825 # Since: 0.14
827 { 'struct': 'BlockDeviceStats',
828   'data': {'rd_bytes': 'int', 'wr_bytes': 'int', 'unmap_bytes' : 'int',
829            'rd_operations': 'int', 'wr_operations': 'int',
830            'flush_operations': 'int', 'unmap_operations': 'int',
831            'rd_total_time_ns': 'int', 'wr_total_time_ns': 'int',
832            'flush_total_time_ns': 'int', 'unmap_total_time_ns': 'int',
833            'wr_highest_offset': 'int',
834            'rd_merged': 'int', 'wr_merged': 'int', 'unmap_merged': 'int',
835            '*idle_time_ns': 'int',
836            'failed_rd_operations': 'int', 'failed_wr_operations': 'int',
837            'failed_flush_operations': 'int', 'failed_unmap_operations': 'int',
838            'invalid_rd_operations': 'int', 'invalid_wr_operations': 'int',
839            'invalid_flush_operations': 'int', 'invalid_unmap_operations': 'int',
840            'account_invalid': 'bool', 'account_failed': 'bool',
841            'timed_stats': ['BlockDeviceTimedStats'],
842            '*rd_latency_histogram': 'BlockLatencyHistogramInfo',
843            '*wr_latency_histogram': 'BlockLatencyHistogramInfo',
844            '*flush_latency_histogram': 'BlockLatencyHistogramInfo' } }
847 # @BlockStatsSpecificFile:
849 # File driver statistics
851 # @discard-nb-ok: The number of successful discard operations performed by
852 #                 the driver.
854 # @discard-nb-failed: The number of failed discard operations performed by
855 #                     the driver.
857 # @discard-bytes-ok: The number of bytes discarded by the driver.
859 # Since: 4.2
861 { 'struct': 'BlockStatsSpecificFile',
862   'data': {
863       'discard-nb-ok': 'uint64',
864       'discard-nb-failed': 'uint64',
865       'discard-bytes-ok': 'uint64' } }
868 # @BlockStatsSpecificNvme:
870 # NVMe driver statistics
872 # @completion-errors: The number of completion errors.
874 # @aligned-accesses: The number of aligned accesses performed by
875 #                    the driver.
877 # @unaligned-accesses: The number of unaligned accesses performed by
878 #                      the driver.
880 # Since: 5.2
882 { 'struct': 'BlockStatsSpecificNvme',
883   'data': {
884       'completion-errors': 'uint64',
885       'aligned-accesses': 'uint64',
886       'unaligned-accesses': 'uint64' } }
889 # @BlockStatsSpecific:
891 # Block driver specific statistics
893 # Since: 4.2
895 { 'union': 'BlockStatsSpecific',
896   'base': { 'driver': 'BlockdevDriver' },
897   'discriminator': 'driver',
898   'data': {
899       'file': 'BlockStatsSpecificFile',
900       'host_device': 'BlockStatsSpecificFile',
901       'nvme': 'BlockStatsSpecificNvme' } }
904 # @BlockStats:
906 # Statistics of a virtual block device or a block backing device.
908 # @device: If the stats are for a virtual block device, the name
909 #          corresponding to the virtual block device.
911 # @node-name: The node name of the device. (Since 2.3)
913 # @qdev: The qdev ID, or if no ID is assigned, the QOM path of the block
914 #        device. (since 3.0)
916 # @stats:  A @BlockDeviceStats for the device.
918 # @driver-specific: Optional driver-specific stats. (Since 4.2)
920 # @parent: This describes the file block device if it has one.
921 #          Contains recursively the statistics of the underlying
922 #          protocol (e.g. the host file for a qcow2 image). If there is
923 #          no underlying protocol, this field is omitted
925 # @backing: This describes the backing block device if it has one.
926 #           (Since 2.0)
928 # Since: 0.14
930 { 'struct': 'BlockStats',
931   'data': {'*device': 'str', '*qdev': 'str', '*node-name': 'str',
932            'stats': 'BlockDeviceStats',
933            '*driver-specific': 'BlockStatsSpecific',
934            '*parent': 'BlockStats',
935            '*backing': 'BlockStats'} }
938 # @query-blockstats:
940 # Query the @BlockStats for all virtual block devices.
942 # @query-nodes: If true, the command will query all the block nodes
943 #               that have a node name, in a list which will include "parent"
944 #               information, but not "backing".
945 #               If false or omitted, the behavior is as before - query all the
946 #               device backends, recursively including their "parent" and
947 #               "backing". Filter nodes that were created implicitly are
948 #               skipped over in this mode. (Since 2.3)
950 # Returns: A list of @BlockStats for each virtual block devices.
952 # Since: 0.14
954 # Example:
956 # -> { "execute": "query-blockstats" }
957 # <- {
958 #       "return":[
959 #          {
960 #             "device":"ide0-hd0",
961 #             "parent":{
962 #                "stats":{
963 #                   "wr_highest_offset":3686448128,
964 #                   "wr_bytes":9786368,
965 #                   "wr_operations":751,
966 #                   "rd_bytes":122567168,
967 #                   "rd_operations":36772
968 #                   "wr_total_times_ns":313253456
969 #                   "rd_total_times_ns":3465673657
970 #                   "flush_total_times_ns":49653
971 #                   "flush_operations":61,
972 #                   "rd_merged":0,
973 #                   "wr_merged":0,
974 #                   "idle_time_ns":2953431879,
975 #                   "account_invalid":true,
976 #                   "account_failed":false
977 #                }
978 #             },
979 #             "stats":{
980 #                "wr_highest_offset":2821110784,
981 #                "wr_bytes":9786368,
982 #                "wr_operations":692,
983 #                "rd_bytes":122739200,
984 #                "rd_operations":36604
985 #                "flush_operations":51,
986 #                "wr_total_times_ns":313253456
987 #                "rd_total_times_ns":3465673657
988 #                "flush_total_times_ns":49653,
989 #                "rd_merged":0,
990 #                "wr_merged":0,
991 #                "idle_time_ns":2953431879,
992 #                "account_invalid":true,
993 #                "account_failed":false
994 #             },
995 #             "qdev": "/machine/unattached/device[23]"
996 #          },
997 #          {
998 #             "device":"ide1-cd0",
999 #             "stats":{
1000 #                "wr_highest_offset":0,
1001 #                "wr_bytes":0,
1002 #                "wr_operations":0,
1003 #                "rd_bytes":0,
1004 #                "rd_operations":0
1005 #                "flush_operations":0,
1006 #                "wr_total_times_ns":0
1007 #                "rd_total_times_ns":0
1008 #                "flush_total_times_ns":0,
1009 #                "rd_merged":0,
1010 #                "wr_merged":0,
1011 #                "account_invalid":false,
1012 #                "account_failed":false
1013 #             },
1014 #             "qdev": "/machine/unattached/device[24]"
1015 #          },
1016 #          {
1017 #             "device":"floppy0",
1018 #             "stats":{
1019 #                "wr_highest_offset":0,
1020 #                "wr_bytes":0,
1021 #                "wr_operations":0,
1022 #                "rd_bytes":0,
1023 #                "rd_operations":0
1024 #                "flush_operations":0,
1025 #                "wr_total_times_ns":0
1026 #                "rd_total_times_ns":0
1027 #                "flush_total_times_ns":0,
1028 #                "rd_merged":0,
1029 #                "wr_merged":0,
1030 #                "account_invalid":false,
1031 #                "account_failed":false
1032 #             },
1033 #             "qdev": "/machine/unattached/device[16]"
1034 #          },
1035 #          {
1036 #             "device":"sd0",
1037 #             "stats":{
1038 #                "wr_highest_offset":0,
1039 #                "wr_bytes":0,
1040 #                "wr_operations":0,
1041 #                "rd_bytes":0,
1042 #                "rd_operations":0
1043 #                "flush_operations":0,
1044 #                "wr_total_times_ns":0
1045 #                "rd_total_times_ns":0
1046 #                "flush_total_times_ns":0,
1047 #                "rd_merged":0,
1048 #                "wr_merged":0,
1049 #                "account_invalid":false,
1050 #                "account_failed":false
1051 #             }
1052 #          }
1053 #       ]
1054 #    }
1057 { 'command': 'query-blockstats',
1058   'data': { '*query-nodes': 'bool' },
1059   'returns': ['BlockStats'] }
1062 # @BlockdevOnError:
1064 # An enumeration of possible behaviors for errors on I/O operations.
1065 # The exact meaning depends on whether the I/O was initiated by a guest
1066 # or by a block job
1068 # @report: for guest operations, report the error to the guest;
1069 #          for jobs, cancel the job
1071 # @ignore: ignore the error, only report a QMP event (BLOCK_IO_ERROR
1072 #          or BLOCK_JOB_ERROR). The backup, mirror and commit block jobs retry
1073 #          the failing request later and may still complete successfully. The
1074 #          stream block job continues to stream and will complete with an
1075 #          error.
1077 # @enospc: same as @stop on ENOSPC, same as @report otherwise.
1079 # @stop: for guest operations, stop the virtual machine;
1080 #        for jobs, pause the job
1082 # @auto: inherit the error handling policy of the backend (since: 2.7)
1084 # Since: 1.3
1086 { 'enum': 'BlockdevOnError',
1087   'data': ['report', 'ignore', 'enospc', 'stop', 'auto'] }
1090 # @MirrorSyncMode:
1092 # An enumeration of possible behaviors for the initial synchronization
1093 # phase of storage mirroring.
1095 # @top: copies data in the topmost image to the destination
1097 # @full: copies data from all images to the destination
1099 # @none: only copy data written from now on
1101 # @incremental: only copy data described by the dirty bitmap. (since: 2.4)
1103 # @bitmap: only copy data described by the dirty bitmap. (since: 4.2)
1104 #          Behavior on completion is determined by the BitmapSyncMode.
1106 # Since: 1.3
1108 { 'enum': 'MirrorSyncMode',
1109   'data': ['top', 'full', 'none', 'incremental', 'bitmap'] }
1112 # @BitmapSyncMode:
1114 # An enumeration of possible behaviors for the synchronization of a bitmap
1115 # when used for data copy operations.
1117 # @on-success: The bitmap is only synced when the operation is successful.
1118 #              This is the behavior always used for 'INCREMENTAL' backups.
1120 # @never: The bitmap is never synchronized with the operation, and is
1121 #         treated solely as a read-only manifest of blocks to copy.
1123 # @always: The bitmap is always synchronized with the operation,
1124 #          regardless of whether or not the operation was successful.
1126 # Since: 4.2
1128 { 'enum': 'BitmapSyncMode',
1129   'data': ['on-success', 'never', 'always'] }
1132 # @MirrorCopyMode:
1134 # An enumeration whose values tell the mirror block job when to
1135 # trigger writes to the target.
1137 # @background: copy data in background only.
1139 # @write-blocking: when data is written to the source, write it
1140 #                  (synchronously) to the target as well.  In
1141 #                  addition, data is copied in background just like in
1142 #                  @background mode.
1144 # Since: 3.0
1146 { 'enum': 'MirrorCopyMode',
1147   'data': ['background', 'write-blocking'] }
1150 # @BlockJobInfo:
1152 # Information about a long-running block device operation.
1154 # @type: the job type ('stream' for image streaming)
1156 # @device: The job identifier. Originally the device name but other
1157 #          values are allowed since QEMU 2.7
1159 # @len: Estimated @offset value at the completion of the job. This value can
1160 #       arbitrarily change while the job is running, in both directions.
1162 # @offset: Progress made until now. The unit is arbitrary and the value can
1163 #          only meaningfully be used for the ratio of @offset to @len. The
1164 #          value is monotonically increasing.
1166 # @busy: false if the job is known to be in a quiescent state, with
1167 #        no pending I/O.  Since 1.3.
1169 # @paused: whether the job is paused or, if @busy is true, will
1170 #          pause itself as soon as possible.  Since 1.3.
1172 # @speed: the rate limit, bytes per second
1174 # @io-status: the status of the job (since 1.3)
1176 # @ready: true if the job may be completed (since 2.2)
1178 # @status: Current job state/status (since 2.12)
1180 # @auto-finalize: Job will finalize itself when PENDING, moving to
1181 #                 the CONCLUDED state. (since 2.12)
1183 # @auto-dismiss: Job will dismiss itself when CONCLUDED, moving to the NULL
1184 #                state and disappearing from the query list. (since 2.12)
1186 # @error: Error information if the job did not complete successfully.
1187 #         Not set if the job completed successfully. (since 2.12.1)
1189 # Since: 1.1
1191 { 'struct': 'BlockJobInfo',
1192   'data': {'type': 'str', 'device': 'str', 'len': 'int',
1193            'offset': 'int', 'busy': 'bool', 'paused': 'bool', 'speed': 'int',
1194            'io-status': 'BlockDeviceIoStatus', 'ready': 'bool',
1195            'status': 'JobStatus',
1196            'auto-finalize': 'bool', 'auto-dismiss': 'bool',
1197            '*error': 'str' } }
1200 # @query-block-jobs:
1202 # Return information about long-running block device operations.
1204 # Returns: a list of @BlockJobInfo for each active block job
1206 # Since: 1.1
1208 { 'command': 'query-block-jobs', 'returns': ['BlockJobInfo'] }
1211 # @block_passwd:
1213 # This command sets the password of a block device that has not been open
1214 # with a password and requires one.
1216 # This command is now obsolete and will always return an error since 2.10
1219 { 'command': 'block_passwd',
1220   'data': { '*device': 'str',
1221             '*node-name': 'str',
1222             'password': 'str' } }
1225 # @block_resize:
1227 # Resize a block image while a guest is running.
1229 # Either @device or @node-name must be set but not both.
1231 # @device: the name of the device to get the image resized
1233 # @node-name: graph node name to get the image resized (Since 2.0)
1235 # @size:  new image size in bytes
1237 # Returns: - nothing on success
1238 #          - If @device is not a valid block device, DeviceNotFound
1240 # Since: 0.14
1242 # Example:
1244 # -> { "execute": "block_resize",
1245 #      "arguments": { "device": "scratch", "size": 1073741824 } }
1246 # <- { "return": {} }
1249 { 'command': 'block_resize',
1250   'data': { '*device': 'str',
1251             '*node-name': 'str',
1252             'size': 'int' },
1253   'coroutine': true }
1256 # @NewImageMode:
1258 # An enumeration that tells QEMU how to set the backing file path in
1259 # a new image file.
1261 # @existing: QEMU should look for an existing image file.
1263 # @absolute-paths: QEMU should create a new image with absolute paths
1264 #                  for the backing file. If there is no backing file available, the new
1265 #                  image will not be backed either.
1267 # Since: 1.1
1269 { 'enum': 'NewImageMode',
1270   'data': [ 'existing', 'absolute-paths' ] }
1273 # @BlockdevSnapshotSync:
1275 # Either @device or @node-name must be set but not both.
1277 # @device: the name of the device to take a snapshot of.
1279 # @node-name: graph node name to generate the snapshot from (Since 2.0)
1281 # @snapshot-file: the target of the new overlay image. If the file
1282 #                 exists, or if it is a device, the overlay will be created in the
1283 #                 existing file/device. Otherwise, a new file will be created.
1285 # @snapshot-node-name: the graph node name of the new image (Since 2.0)
1287 # @format: the format of the overlay image, default is 'qcow2'.
1289 # @mode: whether and how QEMU should create a new image, default is
1290 #        'absolute-paths'.
1292 { 'struct': 'BlockdevSnapshotSync',
1293   'data': { '*device': 'str', '*node-name': 'str',
1294             'snapshot-file': 'str', '*snapshot-node-name': 'str',
1295             '*format': 'str', '*mode': 'NewImageMode' } }
1298 # @BlockdevSnapshot:
1300 # @node: device or node name that will have a snapshot taken.
1302 # @overlay: reference to the existing block device that will become
1303 #           the overlay of @node, as part of taking the snapshot.
1304 #           It must not have a current backing file (this can be
1305 #           achieved by passing "backing": null to blockdev-add).
1307 # Since: 2.5
1309 { 'struct': 'BlockdevSnapshot',
1310   'data': { 'node': 'str', 'overlay': 'str' } }
1313 # @BackupPerf:
1315 # Optional parameters for backup. These parameters don't affect
1316 # functionality, but may significantly affect performance.
1318 # @use-copy-range: Use copy offloading. Default false.
1320 # @max-workers: Maximum number of parallel requests for the sustained background
1321 #               copying process. Doesn't influence copy-before-write operations.
1322 #               Default 64.
1324 # @max-chunk: Maximum request length for the sustained background copying
1325 #             process. Doesn't influence copy-before-write operations.
1326 #             0 means unlimited. If max-chunk is non-zero then it should not be
1327 #             less than job cluster size which is calculated as maximum of
1328 #             target image cluster size and 64k. Default 0.
1330 # Since: 6.0
1332 { 'struct': 'BackupPerf',
1333   'data': { '*use-copy-range': 'bool',
1334             '*max-workers': 'int', '*max-chunk': 'int64' } }
1337 # @BackupCommon:
1339 # @job-id: identifier for the newly-created block job. If
1340 #          omitted, the device name will be used. (Since 2.7)
1342 # @device: the device name or node-name of a root node which should be copied.
1344 # @sync: what parts of the disk image should be copied to the destination
1345 #        (all the disk, only the sectors allocated in the topmost image, from a
1346 #        dirty bitmap, or only new I/O).
1348 # @speed: the maximum speed, in bytes per second. The default is 0,
1349 #         for unlimited.
1351 # @bitmap: The name of a dirty bitmap to use.
1352 #          Must be present if sync is "bitmap" or "incremental".
1353 #          Can be present if sync is "full" or "top".
1354 #          Must not be present otherwise.
1355 #          (Since 2.4 (drive-backup), 3.1 (blockdev-backup))
1357 # @bitmap-mode: Specifies the type of data the bitmap should contain after
1358 #               the operation concludes.
1359 #               Must be present if a bitmap was provided,
1360 #               Must NOT be present otherwise. (Since 4.2)
1362 # @compress: true to compress data, if the target format supports it.
1363 #            (default: false) (since 2.8)
1365 # @on-source-error: the action to take on an error on the source,
1366 #                   default 'report'.  'stop' and 'enospc' can only be used
1367 #                   if the block device supports io-status (see BlockInfo).
1369 # @on-target-error: the action to take on an error on the target,
1370 #                   default 'report' (no limitations, since this applies to
1371 #                   a different block device than @device).
1373 # @auto-finalize: When false, this job will wait in a PENDING state after it has
1374 #                 finished its work, waiting for @block-job-finalize before
1375 #                 making any block graph changes.
1376 #                 When true, this job will automatically
1377 #                 perform its abort or commit actions.
1378 #                 Defaults to true. (Since 2.12)
1380 # @auto-dismiss: When false, this job will wait in a CONCLUDED state after it
1381 #                has completely ceased all work, and awaits @block-job-dismiss.
1382 #                When true, this job will automatically disappear from the query
1383 #                list without user intervention.
1384 #                Defaults to true. (Since 2.12)
1386 # @filter-node-name: the node name that should be assigned to the
1387 #                    filter driver that the backup job inserts into the graph
1388 #                    above node specified by @drive. If this option is not given,
1389 #                    a node name is autogenerated. (Since: 4.2)
1391 # @x-perf: Performance options. (Since 6.0)
1393 # Note: @on-source-error and @on-target-error only affect background
1394 #       I/O.  If an error occurs during a guest write request, the device's
1395 #       rerror/werror actions will be used.
1397 # Since: 4.2
1399 { 'struct': 'BackupCommon',
1400   'data': { '*job-id': 'str', 'device': 'str',
1401             'sync': 'MirrorSyncMode', '*speed': 'int',
1402             '*bitmap': 'str', '*bitmap-mode': 'BitmapSyncMode',
1403             '*compress': 'bool',
1404             '*on-source-error': 'BlockdevOnError',
1405             '*on-target-error': 'BlockdevOnError',
1406             '*auto-finalize': 'bool', '*auto-dismiss': 'bool',
1407             '*filter-node-name': 'str', '*x-perf': 'BackupPerf'  } }
1410 # @DriveBackup:
1412 # @target: the target of the new image. If the file exists, or if it
1413 #          is a device, the existing file/device will be used as the new
1414 #          destination.  If it does not exist, a new file will be created.
1416 # @format: the format of the new destination, default is to
1417 #          probe if @mode is 'existing', else the format of the source
1419 # @mode: whether and how QEMU should create a new image, default is
1420 #        'absolute-paths'.
1422 # Since: 1.6
1424 { 'struct': 'DriveBackup',
1425   'base': 'BackupCommon',
1426   'data': { 'target': 'str',
1427             '*format': 'str',
1428             '*mode': 'NewImageMode' } }
1431 # @BlockdevBackup:
1433 # @target: the device name or node-name of the backup target node.
1435 # Since: 2.3
1437 { 'struct': 'BlockdevBackup',
1438   'base': 'BackupCommon',
1439   'data': { 'target': 'str' } }
1442 # @blockdev-snapshot-sync:
1444 # Takes a synchronous snapshot of a block device.
1446 # For the arguments, see the documentation of BlockdevSnapshotSync.
1448 # Returns: - nothing on success
1449 #          - If @device is not a valid block device, DeviceNotFound
1451 # Since: 0.14
1453 # Example:
1455 # -> { "execute": "blockdev-snapshot-sync",
1456 #      "arguments": { "device": "ide-hd0",
1457 #                     "snapshot-file":
1458 #                     "/some/place/my-image",
1459 #                     "format": "qcow2" } }
1460 # <- { "return": {} }
1463 { 'command': 'blockdev-snapshot-sync',
1464   'data': 'BlockdevSnapshotSync' }
1468 # @blockdev-snapshot:
1470 # Takes a snapshot of a block device.
1472 # Take a snapshot, by installing 'node' as the backing image of
1473 # 'overlay'. Additionally, if 'node' is associated with a block
1474 # device, the block device changes to using 'overlay' as its new active
1475 # image.
1477 # For the arguments, see the documentation of BlockdevSnapshot.
1479 # Features:
1480 # @allow-write-only-overlay: If present, the check whether this operation is safe
1481 #                            was relaxed so that it can be used to change
1482 #                            backing file of a destination of a blockdev-mirror.
1483 #                            (since 5.0)
1485 # Since: 2.5
1487 # Example:
1489 # -> { "execute": "blockdev-add",
1490 #      "arguments": { "driver": "qcow2",
1491 #                     "node-name": "node1534",
1492 #                     "file": { "driver": "file",
1493 #                               "filename": "hd1.qcow2" },
1494 #                     "backing": null } }
1496 # <- { "return": {} }
1498 # -> { "execute": "blockdev-snapshot",
1499 #      "arguments": { "node": "ide-hd0",
1500 #                     "overlay": "node1534" } }
1501 # <- { "return": {} }
1504 { 'command': 'blockdev-snapshot',
1505   'data': 'BlockdevSnapshot',
1506   'features': [ 'allow-write-only-overlay' ] }
1509 # @change-backing-file:
1511 # Change the backing file in the image file metadata.  This does not
1512 # cause QEMU to reopen the image file to reparse the backing filename
1513 # (it may, however, perform a reopen to change permissions from
1514 # r/o -> r/w -> r/o, if needed). The new backing file string is written
1515 # into the image file metadata, and the QEMU internal strings are
1516 # updated.
1518 # @image-node-name: The name of the block driver state node of the
1519 #                   image to modify. The "device" argument is used
1520 #                   to verify "image-node-name" is in the chain
1521 #                   described by "device".
1523 # @device: The device name or node-name of the root node that owns
1524 #          image-node-name.
1526 # @backing-file: The string to write as the backing file.  This
1527 #                string is not validated, so care should be taken
1528 #                when specifying the string or the image chain may
1529 #                not be able to be reopened again.
1531 # Returns: - Nothing on success
1532 #          - If "device" does not exist or cannot be determined, DeviceNotFound
1534 # Since: 2.1
1536 { 'command': 'change-backing-file',
1537   'data': { 'device': 'str', 'image-node-name': 'str',
1538             'backing-file': 'str' } }
1541 # @block-commit:
1543 # Live commit of data from overlay image nodes into backing nodes - i.e.,
1544 # writes data between 'top' and 'base' into 'base'.
1546 # If top == base, that is an error.
1547 # If top has no overlays on top of it, or if it is in use by a writer,
1548 # the job will not be completed by itself.  The user needs to complete
1549 # the job with the block-job-complete command after getting the ready
1550 # event. (Since 2.0)
1552 # If the base image is smaller than top, then the base image will be
1553 # resized to be the same size as top.  If top is smaller than the base
1554 # image, the base will not be truncated.  If you want the base image
1555 # size to match the size of the smaller top, you can safely truncate
1556 # it yourself once the commit operation successfully completes.
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' does not have an overlay
1583 #                image, or if 'top' is in use by a writer, specifying
1584 #                a backing file string is an error.
1586 #                This filename is not validated.  If a pathname string
1587 #                is such that it cannot be resolved by QEMU, that
1588 #                means that subsequent QMP or HMP commands must use
1589 #                node-names for the image in question, as filename
1590 #                lookup methods will fail.
1592 #                If not specified, QEMU will automatically determine
1593 #                the backing file string to use, or error out if
1594 #                there is no obvious choice. Care should be taken
1595 #                when specifying the string, to specify a valid
1596 #                filename or protocol.
1597 #                (Since 2.1)
1599 # @speed: the maximum speed, in bytes per second
1601 # @on-error: the action to take on an error. 'ignore' means that the request
1602 #            should be retried. (default: report; Since: 5.0)
1604 # @filter-node-name: the node name that should be assigned to the
1605 #                    filter driver that the commit job inserts into the graph
1606 #                    above @top. If this option is not given, a node name is
1607 #                    autogenerated. (Since: 2.9)
1609 # @auto-finalize: When false, this job will wait in a PENDING state after it has
1610 #                 finished its work, waiting for @block-job-finalize before
1611 #                 making any block graph changes.
1612 #                 When true, this job will automatically
1613 #                 perform its abort or commit actions.
1614 #                 Defaults to true. (Since 3.1)
1616 # @auto-dismiss: When false, this job will wait in a CONCLUDED state after it
1617 #                has completely ceased all work, and awaits @block-job-dismiss.
1618 #                When true, this job will automatically disappear from the query
1619 #                list without user intervention.
1620 #                Defaults to true. (Since 3.1)
1622 # Features:
1623 # @deprecated: Members @base and @top are deprecated.  Use @base-node
1624 #              and @top-node instead.
1626 # Returns: - Nothing on success
1627 #          - If @device does not exist, DeviceNotFound
1628 #          - Any other error returns a GenericError.
1630 # Since: 1.3
1632 # Example:
1634 # -> { "execute": "block-commit",
1635 #      "arguments": { "device": "virtio0",
1636 #                     "top": "/tmp/snap1.qcow2" } }
1637 # <- { "return": {} }
1640 { 'command': 'block-commit',
1641   'data': { '*job-id': 'str', 'device': 'str', '*base-node': 'str',
1642             '*base': { 'type': 'str', 'features': [ 'deprecated' ] },
1643             '*top-node': 'str',
1644             '*top': { 'type': 'str', 'features': [ 'deprecated' ] },
1645             '*backing-file': 'str', '*speed': 'int',
1646             '*on-error': 'BlockdevOnError',
1647             '*filter-node-name': 'str',
1648             '*auto-finalize': 'bool', '*auto-dismiss': 'bool' } }
1651 # @drive-backup:
1653 # Start a point-in-time copy of a block device to a new destination.  The
1654 # status of ongoing drive-backup operations can be checked with
1655 # query-block-jobs where the BlockJobInfo.type field has the value 'backup'.
1656 # The operation can be stopped before it has completed using the
1657 # block-job-cancel command.
1659 # Returns: - nothing on success
1660 #          - If @device is not a valid block device, GenericError
1662 # Since: 1.6
1664 # Example:
1666 # -> { "execute": "drive-backup",
1667 #      "arguments": { "device": "drive0",
1668 #                     "sync": "full",
1669 #                     "target": "backup.img" } }
1670 # <- { "return": {} }
1673 { 'command': 'drive-backup', 'boxed': true,
1674   'data': 'DriveBackup' }
1677 # @blockdev-backup:
1679 # Start a point-in-time copy of a block device to a new destination.  The
1680 # status of ongoing blockdev-backup operations can be checked with
1681 # query-block-jobs where the BlockJobInfo.type field has the value 'backup'.
1682 # The operation can be stopped before it has completed using the
1683 # block-job-cancel command.
1685 # Returns: - nothing on success
1686 #          - If @device is not a valid block device, DeviceNotFound
1688 # Since: 2.3
1690 # Example:
1691 # -> { "execute": "blockdev-backup",
1692 #      "arguments": { "device": "src-id",
1693 #                     "sync": "full",
1694 #                     "target": "tgt-id" } }
1695 # <- { "return": {} }
1698 { 'command': 'blockdev-backup', 'boxed': true,
1699   'data': 'BlockdevBackup' }
1703 # @query-named-block-nodes:
1705 # Get the named block driver list
1707 # @flat: Omit the nested data about backing image ("backing-image" key) if true.
1708 #        Default is false (Since 5.0)
1710 # Returns: the list of BlockDeviceInfo
1712 # Since: 2.0
1714 # Example:
1716 # -> { "execute": "query-named-block-nodes" }
1717 # <- { "return": [ { "ro":false,
1718 #                    "drv":"qcow2",
1719 #                    "encrypted":false,
1720 #                    "file":"disks/test.qcow2",
1721 #                    "node-name": "my-node",
1722 #                    "backing_file_depth":1,
1723 #                    "bps":1000000,
1724 #                    "bps_rd":0,
1725 #                    "bps_wr":0,
1726 #                    "iops":1000000,
1727 #                    "iops_rd":0,
1728 #                    "iops_wr":0,
1729 #                    "bps_max": 8000000,
1730 #                    "bps_rd_max": 0,
1731 #                    "bps_wr_max": 0,
1732 #                    "iops_max": 0,
1733 #                    "iops_rd_max": 0,
1734 #                    "iops_wr_max": 0,
1735 #                    "iops_size": 0,
1736 #                    "write_threshold": 0,
1737 #                    "image":{
1738 #                       "filename":"disks/test.qcow2",
1739 #                       "format":"qcow2",
1740 #                       "virtual-size":2048000,
1741 #                       "backing_file":"base.qcow2",
1742 #                       "full-backing-filename":"disks/base.qcow2",
1743 #                       "backing-filename-format":"qcow2",
1744 #                       "snapshots":[
1745 #                          {
1746 #                             "id": "1",
1747 #                             "name": "snapshot1",
1748 #                             "vm-state-size": 0,
1749 #                             "date-sec": 10000200,
1750 #                             "date-nsec": 12,
1751 #                             "vm-clock-sec": 206,
1752 #                             "vm-clock-nsec": 30
1753 #                          }
1754 #                       ],
1755 #                       "backing-image":{
1756 #                           "filename":"disks/base.qcow2",
1757 #                           "format":"qcow2",
1758 #                           "virtual-size":2048000
1759 #                       }
1760 #                    } } ] }
1763 { 'command': 'query-named-block-nodes',
1764   'returns': [ 'BlockDeviceInfo' ],
1765   'data': { '*flat': 'bool' } }
1768 # @XDbgBlockGraphNodeType:
1770 # @block-backend: corresponds to BlockBackend
1772 # @block-job: corresponds to BlockJob
1774 # @block-driver: corresponds to BlockDriverState
1776 # Since: 4.0
1778 { 'enum': 'XDbgBlockGraphNodeType',
1779   'data': [ 'block-backend', 'block-job', 'block-driver' ] }
1782 # @XDbgBlockGraphNode:
1784 # @id: Block graph node identifier. This @id is generated only for
1785 #      x-debug-query-block-graph and does not relate to any other identifiers in
1786 #      Qemu.
1788 # @type: Type of graph node. Can be one of block-backend, block-job or
1789 #        block-driver-state.
1791 # @name: Human readable name of the node. Corresponds to node-name for
1792 #        block-driver-state nodes; is not guaranteed to be unique in the whole
1793 #        graph (with block-jobs and block-backends).
1795 # Since: 4.0
1797 { 'struct': 'XDbgBlockGraphNode',
1798   'data': { 'id': 'uint64', 'type': 'XDbgBlockGraphNodeType', 'name': 'str' } }
1801 # @BlockPermission:
1803 # Enum of base block permissions.
1805 # @consistent-read: A user that has the "permission" of consistent reads is
1806 #                   guaranteed that their view of the contents of the block
1807 #                   device is complete and self-consistent, representing the
1808 #                   contents of a disk at a specific point.
1809 #                   For most block devices (including their backing files) this
1810 #                   is true, but the property cannot be maintained in a few
1811 #                   situations like for intermediate nodes of a commit block
1812 #                   job.
1814 # @write: This permission is required to change the visible disk contents.
1816 # @write-unchanged: This permission (which is weaker than BLK_PERM_WRITE) is
1817 #                   both enough and required for writes to the block node when
1818 #                   the caller promises that the visible disk content doesn't
1819 #                   change.
1820 #                   As the BLK_PERM_WRITE permission is strictly stronger,
1821 #                   either is sufficient to perform an unchanging write.
1823 # @resize: This permission is required to change the size of a block node.
1825 # @graph-mod: This permission is required to change the node that this
1826 #             BdrvChild points to.
1828 # Since: 4.0
1830 { 'enum': 'BlockPermission',
1831   'data': [ 'consistent-read', 'write', 'write-unchanged', 'resize',
1832             'graph-mod' ] }
1834 # @XDbgBlockGraphEdge:
1836 # Block Graph edge description for x-debug-query-block-graph.
1838 # @parent: parent id
1840 # @child: child id
1842 # @name: name of the relation (examples are 'file' and 'backing')
1844 # @perm: granted permissions for the parent operating on the child
1846 # @shared-perm: permissions that can still be granted to other users of the
1847 #               child while it is still attached to this parent
1849 # Since: 4.0
1851 { 'struct': 'XDbgBlockGraphEdge',
1852   'data': { 'parent': 'uint64', 'child': 'uint64',
1853             'name': 'str', 'perm': [ 'BlockPermission' ],
1854             'shared-perm': [ 'BlockPermission' ] } }
1857 # @XDbgBlockGraph:
1859 # Block Graph - list of nodes and list of edges.
1861 # Since: 4.0
1863 { 'struct': 'XDbgBlockGraph',
1864   'data': { 'nodes': ['XDbgBlockGraphNode'], 'edges': ['XDbgBlockGraphEdge'] } }
1867 # @x-debug-query-block-graph:
1869 # Get the block graph.
1871 # Since: 4.0
1873 { 'command': 'x-debug-query-block-graph', 'returns': 'XDbgBlockGraph' }
1876 # @drive-mirror:
1878 # Start mirroring a block device's writes to a new destination. target
1879 # specifies the target of the new image. If the file exists, or if it
1880 # is a device, it will be used as the new destination for writes. If
1881 # it does not exist, a new file will be created. format specifies the
1882 # format of the mirror image, default is to probe if mode='existing',
1883 # else the format of the source.
1885 # Returns: - nothing on success
1886 #          - If @device is not a valid block device, GenericError
1888 # Since: 1.3
1890 # Example:
1892 # -> { "execute": "drive-mirror",
1893 #      "arguments": { "device": "ide-hd0",
1894 #                     "target": "/some/place/my-image",
1895 #                     "sync": "full",
1896 #                     "format": "qcow2" } }
1897 # <- { "return": {} }
1900 { 'command': 'drive-mirror', 'boxed': true,
1901   'data': 'DriveMirror' }
1904 # @DriveMirror:
1906 # A set of parameters describing drive mirror setup.
1908 # @job-id: identifier for the newly-created block job. If
1909 #          omitted, the device name will be used. (Since 2.7)
1911 # @device:  the device name or node-name of a root node whose writes should be
1912 #           mirrored.
1914 # @target: the target of the new image. If the file exists, or if it
1915 #          is a device, the existing file/device will be used as the new
1916 #          destination.  If it does not exist, a new file will be created.
1918 # @format: the format of the new destination, default is to
1919 #          probe if @mode is 'existing', else the format of the source
1921 # @node-name: the new block driver state node name in the graph
1922 #             (Since 2.1)
1924 # @replaces: with sync=full graph node name to be replaced by the new
1925 #            image when a whole image copy is done. This can be used to repair
1926 #            broken Quorum files.  By default, @device is replaced, although
1927 #            implicitly created filters on it are kept. (Since 2.1)
1929 # @mode: whether and how QEMU should create a new image, default is
1930 #        'absolute-paths'.
1932 # @speed:  the maximum speed, in bytes per second
1934 # @sync: what parts of the disk image should be copied to the destination
1935 #        (all the disk, only the sectors allocated in the topmost image, or
1936 #        only new I/O).
1938 # @granularity: granularity of the dirty bitmap, default is 64K
1939 #               if the image format doesn't have clusters, 4K if the clusters
1940 #               are smaller than that, else the cluster size.  Must be a
1941 #               power of 2 between 512 and 64M (since 1.4).
1943 # @buf-size: maximum amount of data in flight from source to
1944 #            target (since 1.4).
1946 # @on-source-error: the action to take on an error on the source,
1947 #                   default 'report'.  'stop' and 'enospc' can only be used
1948 #                   if the block device supports io-status (see BlockInfo).
1950 # @on-target-error: the action to take on an error on the target,
1951 #                   default 'report' (no limitations, since this applies to
1952 #                   a different block device than @device).
1953 # @unmap: Whether to try to unmap target sectors where source has
1954 #         only zero. If true, and target unallocated sectors will read as zero,
1955 #         target image sectors will be unmapped; otherwise, zeroes will be
1956 #         written. Both will result in identical contents.
1957 #         Default is true. (Since 2.4)
1959 # @copy-mode: when to copy data to the destination; defaults to 'background'
1960 #             (Since: 3.0)
1962 # @auto-finalize: When false, this job will wait in a PENDING state after it has
1963 #                 finished its work, waiting for @block-job-finalize before
1964 #                 making any block graph changes.
1965 #                 When true, this job will automatically
1966 #                 perform its abort or commit actions.
1967 #                 Defaults to true. (Since 3.1)
1969 # @auto-dismiss: When false, this job will wait in a CONCLUDED state after it
1970 #                has completely ceased all work, and awaits @block-job-dismiss.
1971 #                When true, this job will automatically disappear from the query
1972 #                list without user intervention.
1973 #                Defaults to true. (Since 3.1)
1974 # Since: 1.3
1976 { 'struct': 'DriveMirror',
1977   'data': { '*job-id': 'str', 'device': 'str', 'target': 'str',
1978             '*format': 'str', '*node-name': 'str', '*replaces': 'str',
1979             'sync': 'MirrorSyncMode', '*mode': 'NewImageMode',
1980             '*speed': 'int', '*granularity': 'uint32',
1981             '*buf-size': 'int', '*on-source-error': 'BlockdevOnError',
1982             '*on-target-error': 'BlockdevOnError',
1983             '*unmap': 'bool', '*copy-mode': 'MirrorCopyMode',
1984             '*auto-finalize': 'bool', '*auto-dismiss': 'bool' } }
1987 # @BlockDirtyBitmap:
1989 # @node: name of device/node which the bitmap is tracking
1991 # @name: name of the dirty bitmap
1993 # Since: 2.4
1995 { 'struct': 'BlockDirtyBitmap',
1996   'data': { 'node': 'str', 'name': 'str' } }
1999 # @BlockDirtyBitmapAdd:
2001 # @node: name of device/node which the bitmap is tracking
2003 # @name: name of the dirty bitmap (must be less than 1024 bytes)
2005 # @granularity: the bitmap granularity, default is 64k for
2006 #               block-dirty-bitmap-add
2008 # @persistent: the bitmap is persistent, i.e. it will be saved to the
2009 #              corresponding block device image file on its close. For now only
2010 #              Qcow2 disks support persistent bitmaps. Default is false for
2011 #              block-dirty-bitmap-add. (Since: 2.10)
2013 # @disabled: the bitmap is created in the disabled state, which means that
2014 #            it will not track drive changes. The bitmap may be enabled with
2015 #            block-dirty-bitmap-enable. Default is false. (Since: 4.0)
2017 # Since: 2.4
2019 { 'struct': 'BlockDirtyBitmapAdd',
2020   'data': { 'node': 'str', 'name': 'str', '*granularity': 'uint32',
2021             '*persistent': 'bool', '*disabled': 'bool' } }
2024 # @BlockDirtyBitmapMergeSource:
2026 # @local: name of the bitmap, attached to the same node as target bitmap.
2028 # @external: bitmap with specified node
2030 # Since: 4.1
2032 { 'alternate': 'BlockDirtyBitmapMergeSource',
2033   'data': { 'local': 'str',
2034             'external': 'BlockDirtyBitmap' } }
2037 # @BlockDirtyBitmapMerge:
2039 # @node: name of device/node which the @target bitmap is tracking
2041 # @target: name of the destination dirty bitmap
2043 # @bitmaps: name(s) of the source dirty bitmap(s) at @node and/or fully
2044 #           specified BlockDirtyBitmap elements. The latter are supported
2045 #           since 4.1.
2047 # Since: 4.0
2049 { 'struct': 'BlockDirtyBitmapMerge',
2050   'data': { 'node': 'str', 'target': 'str',
2051             'bitmaps': ['BlockDirtyBitmapMergeSource'] } }
2054 # @block-dirty-bitmap-add:
2056 # Create a dirty bitmap with a name on the node, and start tracking the writes.
2058 # Returns: - nothing on success
2059 #          - If @node is not a valid block device or node, DeviceNotFound
2060 #          - If @name is already taken, GenericError with an explanation
2062 # Since: 2.4
2064 # Example:
2066 # -> { "execute": "block-dirty-bitmap-add",
2067 #      "arguments": { "node": "drive0", "name": "bitmap0" } }
2068 # <- { "return": {} }
2071 { 'command': 'block-dirty-bitmap-add',
2072   'data': 'BlockDirtyBitmapAdd' }
2075 # @block-dirty-bitmap-remove:
2077 # Stop write tracking and remove the dirty bitmap that was created
2078 # with block-dirty-bitmap-add. If the bitmap is persistent, remove it from its
2079 # storage too.
2081 # Returns: - nothing on success
2082 #          - If @node is not a valid block device or node, DeviceNotFound
2083 #          - If @name is not found, GenericError with an explanation
2084 #          - if @name is frozen by an operation, GenericError
2086 # Since: 2.4
2088 # Example:
2090 # -> { "execute": "block-dirty-bitmap-remove",
2091 #      "arguments": { "node": "drive0", "name": "bitmap0" } }
2092 # <- { "return": {} }
2095 { 'command': 'block-dirty-bitmap-remove',
2096   'data': 'BlockDirtyBitmap' }
2099 # @block-dirty-bitmap-clear:
2101 # Clear (reset) a dirty bitmap on the device, so that an incremental
2102 # backup from this point in time forward will only backup clusters
2103 # modified after this clear operation.
2105 # Returns: - nothing on success
2106 #          - If @node is not a valid block device, DeviceNotFound
2107 #          - If @name is not found, GenericError with an explanation
2109 # Since: 2.4
2111 # Example:
2113 # -> { "execute": "block-dirty-bitmap-clear",
2114 #      "arguments": { "node": "drive0", "name": "bitmap0" } }
2115 # <- { "return": {} }
2118 { 'command': 'block-dirty-bitmap-clear',
2119   'data': 'BlockDirtyBitmap' }
2122 # @block-dirty-bitmap-enable:
2124 # Enables a dirty bitmap so that it will begin tracking disk changes.
2126 # Returns: - nothing on success
2127 #          - If @node is not a valid block device, DeviceNotFound
2128 #          - If @name is not found, GenericError with an explanation
2130 # Since: 4.0
2132 # Example:
2134 # -> { "execute": "block-dirty-bitmap-enable",
2135 #      "arguments": { "node": "drive0", "name": "bitmap0" } }
2136 # <- { "return": {} }
2139 { 'command': 'block-dirty-bitmap-enable',
2140   'data': 'BlockDirtyBitmap' }
2143 # @block-dirty-bitmap-disable:
2145 # Disables a dirty bitmap so that it will stop tracking disk changes.
2147 # Returns: - nothing on success
2148 #          - If @node is not a valid block device, DeviceNotFound
2149 #          - If @name is not found, GenericError with an explanation
2151 # Since: 4.0
2153 # Example:
2155 # -> { "execute": "block-dirty-bitmap-disable",
2156 #      "arguments": { "node": "drive0", "name": "bitmap0" } }
2157 # <- { "return": {} }
2160 { 'command': 'block-dirty-bitmap-disable',
2161   'data': 'BlockDirtyBitmap' }
2164 # @block-dirty-bitmap-merge:
2166 # Merge dirty bitmaps listed in @bitmaps to the @target dirty bitmap.
2167 # Dirty bitmaps in @bitmaps will be unchanged, except if it also appears
2168 # as the @target bitmap. Any bits already set in @target will still be
2169 # set after the merge, i.e., this operation does not clear the target.
2170 # On error, @target is unchanged.
2172 # The resulting bitmap will count as dirty any clusters that were dirty in any
2173 # of the source bitmaps. This can be used to achieve backup checkpoints, or in
2174 # simpler usages, to copy bitmaps.
2176 # Returns: - nothing on success
2177 #          - If @node is not a valid block device, DeviceNotFound
2178 #          - If any bitmap in @bitmaps or @target is not found, GenericError
2179 #          - If any of the bitmaps have different sizes or granularities,
2180 #            GenericError
2182 # Since: 4.0
2184 # Example:
2186 # -> { "execute": "block-dirty-bitmap-merge",
2187 #      "arguments": { "node": "drive0", "target": "bitmap0",
2188 #                     "bitmaps": ["bitmap1"] } }
2189 # <- { "return": {} }
2192 { 'command': 'block-dirty-bitmap-merge',
2193   'data': 'BlockDirtyBitmapMerge' }
2196 # @BlockDirtyBitmapSha256:
2198 # SHA256 hash of dirty bitmap data
2200 # @sha256: ASCII representation of SHA256 bitmap hash
2202 # Since: 2.10
2204 { 'struct': 'BlockDirtyBitmapSha256',
2205   'data': {'sha256': 'str'} }
2208 # @x-debug-block-dirty-bitmap-sha256:
2210 # Get bitmap SHA256.
2212 # Returns: - BlockDirtyBitmapSha256 on success
2213 #          - If @node is not a valid block device, DeviceNotFound
2214 #          - If @name is not found or if hashing has failed, GenericError with an
2215 #            explanation
2217 # Since: 2.10
2219 { 'command': 'x-debug-block-dirty-bitmap-sha256',
2220   'data': 'BlockDirtyBitmap', 'returns': 'BlockDirtyBitmapSha256' }
2223 # @blockdev-mirror:
2225 # Start mirroring a block device's writes to a new destination.
2227 # @job-id: identifier for the newly-created block job. If
2228 #          omitted, the device name will be used. (Since 2.7)
2230 # @device: The device name or node-name of a root node whose writes should be
2231 #          mirrored.
2233 # @target: the id or node-name of the block device to mirror to. This mustn't be
2234 #          attached to guest.
2236 # @replaces: with sync=full graph node name to be replaced by the new
2237 #            image when a whole image copy is done. This can be used to repair
2238 #            broken Quorum files.  By default, @device is replaced, although
2239 #            implicitly created filters on it are kept.
2241 # @speed:  the maximum speed, in bytes per second
2243 # @sync: what parts of the disk image should be copied to the destination
2244 #        (all the disk, only the sectors allocated in the topmost image, or
2245 #        only new I/O).
2247 # @granularity: granularity of the dirty bitmap, default is 64K
2248 #               if the image format doesn't have clusters, 4K if the clusters
2249 #               are smaller than that, else the cluster size.  Must be a
2250 #               power of 2 between 512 and 64M
2252 # @buf-size: maximum amount of data in flight from source to
2253 #            target
2255 # @on-source-error: the action to take on an error on the source,
2256 #                   default 'report'.  'stop' and 'enospc' can only be used
2257 #                   if the block device supports io-status (see BlockInfo).
2259 # @on-target-error: the action to take on an error on the target,
2260 #                   default 'report' (no limitations, since this applies to
2261 #                   a different block device than @device).
2263 # @filter-node-name: the node name that should be assigned to the
2264 #                    filter driver that the mirror job inserts into the graph
2265 #                    above @device. If this option is not given, a node name is
2266 #                    autogenerated. (Since: 2.9)
2268 # @copy-mode: when to copy data to the destination; defaults to 'background'
2269 #             (Since: 3.0)
2271 # @auto-finalize: When false, this job will wait in a PENDING state after it has
2272 #                 finished its work, waiting for @block-job-finalize before
2273 #                 making any block graph changes.
2274 #                 When true, this job will automatically
2275 #                 perform its abort or commit actions.
2276 #                 Defaults to true. (Since 3.1)
2278 # @auto-dismiss: When false, this job will wait in a CONCLUDED state after it
2279 #                has completely ceased all work, and awaits @block-job-dismiss.
2280 #                When true, this job will automatically disappear from the query
2281 #                list without user intervention.
2282 #                Defaults to true. (Since 3.1)
2283 # Returns: nothing on success.
2285 # Since: 2.6
2287 # Example:
2289 # -> { "execute": "blockdev-mirror",
2290 #      "arguments": { "device": "ide-hd0",
2291 #                     "target": "target0",
2292 #                     "sync": "full" } }
2293 # <- { "return": {} }
2296 { 'command': 'blockdev-mirror',
2297   'data': { '*job-id': 'str', 'device': 'str', 'target': 'str',
2298             '*replaces': 'str',
2299             'sync': 'MirrorSyncMode',
2300             '*speed': 'int', '*granularity': 'uint32',
2301             '*buf-size': 'int', '*on-source-error': 'BlockdevOnError',
2302             '*on-target-error': 'BlockdevOnError',
2303             '*filter-node-name': 'str',
2304             '*copy-mode': 'MirrorCopyMode',
2305             '*auto-finalize': 'bool', '*auto-dismiss': 'bool' } }
2308 # @BlockIOThrottle:
2310 # A set of parameters describing block throttling.
2312 # @device: Block device name
2314 # @id: The name or QOM path of the guest device (since: 2.8)
2316 # @bps: total throughput limit in bytes per second
2318 # @bps_rd: read throughput limit in bytes per second
2320 # @bps_wr: write throughput limit in bytes per second
2322 # @iops: total I/O operations per second
2324 # @iops_rd: read I/O operations per second
2326 # @iops_wr: write I/O operations per second
2328 # @bps_max: total throughput limit during bursts,
2329 #           in bytes (Since 1.7)
2331 # @bps_rd_max: read throughput limit during bursts,
2332 #              in bytes (Since 1.7)
2334 # @bps_wr_max: write throughput limit during bursts,
2335 #              in bytes (Since 1.7)
2337 # @iops_max: total I/O operations per second during bursts,
2338 #            in bytes (Since 1.7)
2340 # @iops_rd_max: read I/O operations per second during bursts,
2341 #               in bytes (Since 1.7)
2343 # @iops_wr_max: write I/O operations per second during bursts,
2344 #               in bytes (Since 1.7)
2346 # @bps_max_length: maximum length of the @bps_max burst
2347 #                  period, in seconds. It must only
2348 #                  be set if @bps_max is set as well.
2349 #                  Defaults to 1. (Since 2.6)
2351 # @bps_rd_max_length: maximum length of the @bps_rd_max
2352 #                     burst period, in seconds. It must only
2353 #                     be set if @bps_rd_max is set as well.
2354 #                     Defaults to 1. (Since 2.6)
2356 # @bps_wr_max_length: maximum length of the @bps_wr_max
2357 #                     burst period, in seconds. It must only
2358 #                     be set if @bps_wr_max is set as well.
2359 #                     Defaults to 1. (Since 2.6)
2361 # @iops_max_length: maximum length of the @iops burst
2362 #                   period, in seconds. It must only
2363 #                   be set if @iops_max is set as well.
2364 #                   Defaults to 1. (Since 2.6)
2366 # @iops_rd_max_length: maximum length of the @iops_rd_max
2367 #                      burst period, in seconds. It must only
2368 #                      be set if @iops_rd_max is set as well.
2369 #                      Defaults to 1. (Since 2.6)
2371 # @iops_wr_max_length: maximum length of the @iops_wr_max
2372 #                      burst period, in seconds. It must only
2373 #                      be set if @iops_wr_max is set as well.
2374 #                      Defaults to 1. (Since 2.6)
2376 # @iops_size: an I/O size in bytes (Since 1.7)
2378 # @group: throttle group name (Since 2.4)
2380 # Features:
2381 # @deprecated: Member @device is deprecated.  Use @id instead.
2383 # Since: 1.1
2385 { 'struct': 'BlockIOThrottle',
2386   'data': { '*device': { 'type': 'str', 'features': [ 'deprecated' ] },
2387             '*id': 'str', 'bps': 'int', 'bps_rd': 'int',
2388             'bps_wr': 'int', 'iops': 'int', 'iops_rd': 'int', 'iops_wr': 'int',
2389             '*bps_max': 'int', '*bps_rd_max': 'int',
2390             '*bps_wr_max': 'int', '*iops_max': 'int',
2391             '*iops_rd_max': 'int', '*iops_wr_max': 'int',
2392             '*bps_max_length': 'int', '*bps_rd_max_length': 'int',
2393             '*bps_wr_max_length': 'int', '*iops_max_length': 'int',
2394             '*iops_rd_max_length': 'int', '*iops_wr_max_length': 'int',
2395             '*iops_size': 'int', '*group': 'str' } }
2398 # @ThrottleLimits:
2400 # Limit parameters for throttling.
2401 # Since some limit combinations are illegal, limits should always be set in one
2402 # transaction. All fields are optional. When setting limits, if a field is
2403 # missing the current value is not changed.
2405 # @iops-total: limit total I/O operations per second
2406 # @iops-total-max: I/O operations burst
2407 # @iops-total-max-length: length of the iops-total-max burst period, in seconds
2408 #                         It must only be set if @iops-total-max is set as well.
2409 # @iops-read: limit read operations per second
2410 # @iops-read-max: I/O operations read burst
2411 # @iops-read-max-length: length of the iops-read-max burst period, in seconds
2412 #                        It must only be set if @iops-read-max is set as well.
2413 # @iops-write: limit write operations per second
2414 # @iops-write-max: I/O operations write burst
2415 # @iops-write-max-length: length of the iops-write-max burst period, in seconds
2416 #                         It must only be set if @iops-write-max is set as well.
2417 # @bps-total: limit total bytes per second
2418 # @bps-total-max: total bytes burst
2419 # @bps-total-max-length: length of the bps-total-max burst period, in seconds.
2420 #                        It must only be set if @bps-total-max is set as well.
2421 # @bps-read: limit read bytes per second
2422 # @bps-read-max: total bytes read burst
2423 # @bps-read-max-length: length of the bps-read-max burst period, in seconds
2424 #                       It must only be set if @bps-read-max is set as well.
2425 # @bps-write: limit write bytes per second
2426 # @bps-write-max: total bytes write burst
2427 # @bps-write-max-length: length of the bps-write-max burst period, in seconds
2428 #                        It must only be set if @bps-write-max is set as well.
2429 # @iops-size: when limiting by iops max size of an I/O in bytes
2431 # Since: 2.11
2433 { 'struct': 'ThrottleLimits',
2434   'data': { '*iops-total' : 'int', '*iops-total-max' : 'int',
2435             '*iops-total-max-length' : 'int', '*iops-read' : 'int',
2436             '*iops-read-max' : 'int', '*iops-read-max-length' : 'int',
2437             '*iops-write' : 'int', '*iops-write-max' : 'int',
2438             '*iops-write-max-length' : 'int', '*bps-total' : 'int',
2439             '*bps-total-max' : 'int', '*bps-total-max-length' : 'int',
2440             '*bps-read' : 'int', '*bps-read-max' : 'int',
2441             '*bps-read-max-length' : 'int', '*bps-write' : 'int',
2442             '*bps-write-max' : 'int', '*bps-write-max-length' : 'int',
2443             '*iops-size' : 'int' } }
2446 # @ThrottleGroupProperties:
2448 # Properties for throttle-group objects.
2450 # The options starting with x- are aliases for the same key without x- in
2451 # the @limits object. As indicated by the x- prefix, this is not a stable
2452 # interface and may be removed or changed incompatibly in the future. Use
2453 # @limits for a supported stable interface.
2455 # @limits: limits to apply for this throttle group
2457 # Since: 2.11
2459 { 'struct': 'ThrottleGroupProperties',
2460   'data': { '*limits': 'ThrottleLimits',
2461             '*x-iops-total' : 'int', '*x-iops-total-max' : 'int',
2462             '*x-iops-total-max-length' : 'int', '*x-iops-read' : 'int',
2463             '*x-iops-read-max' : 'int', '*x-iops-read-max-length' : 'int',
2464             '*x-iops-write' : 'int', '*x-iops-write-max' : 'int',
2465             '*x-iops-write-max-length' : 'int', '*x-bps-total' : 'int',
2466             '*x-bps-total-max' : 'int', '*x-bps-total-max-length' : 'int',
2467             '*x-bps-read' : 'int', '*x-bps-read-max' : 'int',
2468             '*x-bps-read-max-length' : 'int', '*x-bps-write' : 'int',
2469             '*x-bps-write-max' : 'int', '*x-bps-write-max-length' : 'int',
2470             '*x-iops-size' : 'int' } }
2473 # @block-stream:
2475 # Copy data from a backing file into a block device.
2477 # The block streaming operation is performed in the background until the entire
2478 # backing file has been copied.  This command returns immediately once streaming
2479 # has started.  The status of ongoing block streaming operations can be checked
2480 # with query-block-jobs.  The operation can be stopped before it has completed
2481 # using the block-job-cancel command.
2483 # The node that receives the data is called the top image, can be located in
2484 # any part of the chain (but always above the base image; see below) and can be
2485 # specified using its device or node name. Earlier qemu versions only allowed
2486 # 'device' to name the top level node; presence of the 'base-node' parameter
2487 # during introspection can be used as a witness of the enhanced semantics
2488 # of 'device'.
2490 # If a base file is specified then sectors are not copied from that base file and
2491 # its backing chain.  This can be used to stream a subset of the backing file
2492 # chain instead of flattening the entire image.
2493 # When streaming completes the image file will have the base file as its backing
2494 # file, unless that node was changed while the job was running.  In that case,
2495 # base's parent's backing (or filtered, whichever exists) child (i.e., base at
2496 # the beginning of the job) will be the new backing file.
2498 # On successful completion the image file is updated to drop the backing file
2499 # and the BLOCK_JOB_COMPLETED event is emitted.
2501 # In case @device is a filter node, block-stream modifies the first non-filter
2502 # overlay node below it to point to the new backing node instead of modifying
2503 # @device itself.
2505 # @job-id: identifier for the newly-created block job. If
2506 #          omitted, the device name will be used. (Since 2.7)
2508 # @device: the device or node name of the top image
2510 # @base: the common backing file name.
2511 #        It cannot be set if @base-node or @bottom is also set.
2513 # @base-node: the node name of the backing file.
2514 #             It cannot be set if @base or @bottom is also set. (Since 2.8)
2516 # @bottom: the last node in the chain that should be streamed into
2517 #          top. It cannot be set if @base or @base-node is also set.
2518 #          It cannot be filter node. (Since 6.0)
2520 # @backing-file: The backing file string to write into the top
2521 #                image. This filename is not validated.
2523 #                If a pathname string is such that it cannot be
2524 #                resolved by QEMU, that means that subsequent QMP or
2525 #                HMP commands must use node-names for the image in
2526 #                question, as filename lookup methods will fail.
2528 #                If not specified, QEMU will automatically determine
2529 #                the backing file string to use, or error out if there
2530 #                is no obvious choice.  Care should be taken when
2531 #                specifying the string, to specify a valid filename or
2532 #                protocol.
2533 #                (Since 2.1)
2535 # @speed: the maximum speed, in bytes per second
2537 # @on-error: the action to take on an error (default report).
2538 #            'stop' and 'enospc' can only be used if the block device
2539 #            supports io-status (see BlockInfo).  Since 1.3.
2541 # @filter-node-name: the node name that should be assigned to the
2542 #                    filter driver that the stream job inserts into the graph
2543 #                    above @device. If this option is not given, a node name is
2544 #                    autogenerated. (Since: 6.0)
2546 # @auto-finalize: When false, this job will wait in a PENDING state after it has
2547 #                 finished its work, waiting for @block-job-finalize before
2548 #                 making any block graph changes.
2549 #                 When true, this job will automatically
2550 #                 perform its abort or commit actions.
2551 #                 Defaults to true. (Since 3.1)
2553 # @auto-dismiss: When false, this job will wait in a CONCLUDED state after it
2554 #                has completely ceased all work, and awaits @block-job-dismiss.
2555 #                When true, this job will automatically disappear from the query
2556 #                list without user intervention.
2557 #                Defaults to true. (Since 3.1)
2559 # Returns: - Nothing on success.
2560 #          - If @device does not exist, DeviceNotFound.
2562 # Since: 1.1
2564 # Example:
2566 # -> { "execute": "block-stream",
2567 #      "arguments": { "device": "virtio0",
2568 #                     "base": "/tmp/master.qcow2" } }
2569 # <- { "return": {} }
2572 { 'command': 'block-stream',
2573   'data': { '*job-id': 'str', 'device': 'str', '*base': 'str',
2574             '*base-node': 'str', '*backing-file': 'str', '*bottom': 'str',
2575             '*speed': 'int', '*on-error': 'BlockdevOnError',
2576             '*filter-node-name': 'str',
2577             '*auto-finalize': 'bool', '*auto-dismiss': 'bool' } }
2580 # @block-job-set-speed:
2582 # Set maximum speed for a background block operation.
2584 # This command can only be issued when there is an active block job.
2586 # Throttling can be disabled by setting the speed to 0.
2588 # @device: The job identifier. This used to be a device name (hence
2589 #          the name of the parameter), but since QEMU 2.7 it can have
2590 #          other values.
2592 # @speed: the maximum speed, in bytes per second, or 0 for unlimited.
2593 #         Defaults to 0.
2595 # Returns: - Nothing on success
2596 #          - If no background operation is active on this device, DeviceNotActive
2598 # Since: 1.1
2600 { 'command': 'block-job-set-speed',
2601   'data': { 'device': 'str', 'speed': 'int' } }
2604 # @block-job-cancel:
2606 # Stop an active background block operation.
2608 # This command returns immediately after marking the active background block
2609 # operation for cancellation.  It is an error to call this command if no
2610 # operation is in progress.
2612 # The operation will cancel as soon as possible and then emit the
2613 # BLOCK_JOB_CANCELLED event.  Before that happens the job is still visible when
2614 # enumerated using query-block-jobs.
2616 # Note that if you issue 'block-job-cancel' after 'drive-mirror' has indicated
2617 # (via the event BLOCK_JOB_READY) that the source and destination are
2618 # synchronized, then the event triggered by this command changes to
2619 # BLOCK_JOB_COMPLETED, to indicate that the mirroring has ended and the
2620 # destination now has a point-in-time copy tied to the time of the cancellation.
2622 # For streaming, the image file retains its backing file unless the streaming
2623 # operation happens to complete just as it is being cancelled.  A new streaming
2624 # operation can be started at a later time to finish copying all data from the
2625 # backing file.
2627 # @device: The job identifier. This used to be a device name (hence
2628 #          the name of the parameter), but since QEMU 2.7 it can have
2629 #          other values.
2631 # @force: If true, and the job has already emitted the event BLOCK_JOB_READY,
2632 #         abandon the job immediately (even if it is paused) instead of waiting
2633 #         for the destination to complete its final synchronization (since 1.3)
2635 # Returns: - Nothing on success
2636 #          - If no background operation is active on this device, DeviceNotActive
2638 # Since: 1.1
2640 { 'command': 'block-job-cancel', 'data': { 'device': 'str', '*force': 'bool' } }
2643 # @block-job-pause:
2645 # Pause an active background block operation.
2647 # This command returns immediately after marking the active background block
2648 # operation for pausing.  It is an error to call this command if no
2649 # operation is in progress or if the job is already paused.
2651 # The operation will pause as soon as possible.  No event is emitted when
2652 # the operation is actually paused.  Cancelling a paused job automatically
2653 # resumes it.
2655 # @device: The job identifier. This used to be a device name (hence
2656 #          the name of the parameter), but since QEMU 2.7 it can have
2657 #          other values.
2659 # Returns: - Nothing on success
2660 #          - If no background operation is active on this device, DeviceNotActive
2662 # Since: 1.3
2664 { 'command': 'block-job-pause', 'data': { 'device': 'str' } }
2667 # @block-job-resume:
2669 # Resume an active background block operation.
2671 # This command returns immediately after resuming a paused background block
2672 # operation.  It is an error to call this command if no operation is in
2673 # progress or if the job is not paused.
2675 # This command also clears the error status of the job.
2677 # @device: The job identifier. This used to be a device name (hence
2678 #          the name of the parameter), but since QEMU 2.7 it can have
2679 #          other values.
2681 # Returns: - Nothing on success
2682 #          - If no background operation is active on this device, DeviceNotActive
2684 # Since: 1.3
2686 { 'command': 'block-job-resume', 'data': { 'device': 'str' } }
2689 # @block-job-complete:
2691 # Manually trigger completion of an active background block operation.  This
2692 # is supported for drive mirroring, where it also switches the device to
2693 # write to the target path only.  The ability to complete is signaled with
2694 # a BLOCK_JOB_READY event.
2696 # This command completes an active background block operation synchronously.
2697 # The ordering of this command's return with the BLOCK_JOB_COMPLETED event
2698 # is not defined.  Note that if an I/O error occurs during the processing of
2699 # this command: 1) the command itself will fail; 2) the error will be processed
2700 # according to the rerror/werror arguments that were specified when starting
2701 # the operation.
2703 # A cancelled or paused job cannot be completed.
2705 # @device: The job identifier. This used to be a device name (hence
2706 #          the name of the parameter), but since QEMU 2.7 it can have
2707 #          other values.
2709 # Returns: - Nothing on success
2710 #          - If no background operation is active on this device, DeviceNotActive
2712 # Since: 1.3
2714 { 'command': 'block-job-complete', 'data': { 'device': 'str' } }
2717 # @block-job-dismiss:
2719 # For jobs that have already concluded, remove them from the block-job-query
2720 # list. This command only needs to be run for jobs which were started with
2721 # QEMU 2.12+ job lifetime management semantics.
2723 # This command will refuse to operate on any job that has not yet reached
2724 # its terminal state, JOB_STATUS_CONCLUDED. For jobs that make use of the
2725 # BLOCK_JOB_READY event, block-job-cancel or block-job-complete will still need
2726 # to be used as appropriate.
2728 # @id: The job identifier.
2730 # Returns: Nothing on success
2732 # Since: 2.12
2734 { 'command': 'block-job-dismiss', 'data': { 'id': 'str' } }
2737 # @block-job-finalize:
2739 # Once a job that has manual=true reaches the pending state, it can be
2740 # instructed to finalize any graph changes and do any necessary cleanup
2741 # via this command.
2742 # For jobs in a transaction, instructing one job to finalize will force
2743 # ALL jobs in the transaction to finalize, so it is only necessary to instruct
2744 # a single member job to finalize.
2746 # @id: The job identifier.
2748 # Returns: Nothing on success
2750 # Since: 2.12
2752 { 'command': 'block-job-finalize', 'data': { 'id': 'str' } }
2755 # @BlockdevDiscardOptions:
2757 # Determines how to handle discard requests.
2759 # @ignore: Ignore the request
2760 # @unmap: Forward as an unmap request
2762 # Since: 2.9
2764 { 'enum': 'BlockdevDiscardOptions',
2765   'data': [ 'ignore', 'unmap' ] }
2768 # @BlockdevDetectZeroesOptions:
2770 # Describes the operation mode for the automatic conversion of plain
2771 # zero writes by the OS to driver specific optimized zero write commands.
2773 # @off: Disabled (default)
2774 # @on: Enabled
2775 # @unmap: Enabled and even try to unmap blocks if possible. This requires
2776 #         also that @BlockdevDiscardOptions is set to unmap for this device.
2778 # Since: 2.1
2780 { 'enum': 'BlockdevDetectZeroesOptions',
2781   'data': [ 'off', 'on', 'unmap' ] }
2784 # @BlockdevAioOptions:
2786 # Selects the AIO backend to handle I/O requests
2788 # @threads: Use qemu's thread pool
2789 # @native: Use native AIO backend (only Linux and Windows)
2790 # @io_uring: Use linux io_uring (since 5.0)
2792 # Since: 2.9
2794 { 'enum': 'BlockdevAioOptions',
2795   'data': [ 'threads', 'native',
2796             { 'name': 'io_uring', 'if': 'defined(CONFIG_LINUX_IO_URING)' } ] }
2799 # @BlockdevCacheOptions:
2801 # Includes cache-related options for block devices
2803 # @direct: enables use of O_DIRECT (bypass the host page cache;
2804 #          default: false)
2805 # @no-flush: ignore any flush requests for the device (default:
2806 #            false)
2808 # Since: 2.9
2810 { 'struct': 'BlockdevCacheOptions',
2811   'data': { '*direct': 'bool',
2812             '*no-flush': 'bool' } }
2815 # @BlockdevDriver:
2817 # Drivers that are supported in block device operations.
2819 # @throttle: Since 2.11
2820 # @nvme: Since 2.12
2821 # @copy-on-read: Since 3.0
2822 # @blklogwrites: Since 3.0
2823 # @blkreplay: Since 4.2
2824 # @compress: Since 5.0
2826 # Since: 2.9
2828 { 'enum': 'BlockdevDriver',
2829   'data': [ 'blkdebug', 'blklogwrites', 'blkreplay', 'blkverify', 'bochs',
2830             'cloop', 'compress', 'copy-on-read', 'dmg', 'file', 'ftp', 'ftps',
2831             'gluster', 'host_cdrom', 'host_device', 'http', 'https', 'iscsi',
2832             'luks', 'nbd', 'nfs', 'null-aio', 'null-co', 'nvme', 'parallels',
2833             'preallocate', 'qcow', 'qcow2', 'qed', 'quorum', 'raw', 'rbd',
2834             { 'name': 'replication', 'if': 'defined(CONFIG_REPLICATION)' },
2835             'sheepdog',
2836             'ssh', 'throttle', 'vdi', 'vhdx', 'vmdk', 'vpc', 'vvfat' ] }
2839 # @BlockdevOptionsFile:
2841 # Driver specific block device options for the file backend.
2843 # @filename: path to the image file
2844 # @pr-manager: the id for the object that will handle persistent reservations
2845 #              for this device (default: none, forward the commands via SG_IO;
2846 #              since 2.11)
2847 # @aio: AIO backend (default: threads) (since: 2.8)
2848 # @locking: whether to enable file locking. If set to 'auto', only enable
2849 #           when Open File Descriptor (OFD) locking API is available
2850 #           (default: auto, since 2.10)
2851 # @drop-cache: invalidate page cache during live migration.  This prevents
2852 #              stale data on the migration destination with cache.direct=off.
2853 #              Currently only supported on Linux hosts.
2854 #              (default: on, since: 4.0)
2855 # @x-check-cache-dropped: whether to check that page cache was dropped on live
2856 #                         migration.  May cause noticeable delays if the image
2857 #                         file is large, do not use in production.
2858 #                         (default: off) (since: 3.0)
2860 # Features:
2861 # @dynamic-auto-read-only: If present, enabled auto-read-only means that the
2862 #                          driver will open the image read-only at first,
2863 #                          dynamically reopen the image file read-write when
2864 #                          the first writer is attached to the node and reopen
2865 #                          read-only when the last writer is detached. This
2866 #                          allows giving QEMU write permissions only on demand
2867 #                          when an operation actually needs write access.
2869 # Since: 2.9
2871 { 'struct': 'BlockdevOptionsFile',
2872   'data': { 'filename': 'str',
2873             '*pr-manager': 'str',
2874             '*locking': 'OnOffAuto',
2875             '*aio': 'BlockdevAioOptions',
2876             '*drop-cache': {'type': 'bool',
2877                             'if': 'defined(CONFIG_LINUX)'},
2878             '*x-check-cache-dropped': 'bool' },
2879   'features': [ { 'name': 'dynamic-auto-read-only',
2880                   'if': 'defined(CONFIG_POSIX)' } ] }
2883 # @BlockdevOptionsNull:
2885 # Driver specific block device options for the null backend.
2887 # @size: size of the device in bytes.
2888 # @latency-ns: emulated latency (in nanoseconds) in processing
2889 #              requests. Default to zero which completes requests immediately.
2890 #              (Since 2.4)
2891 # @read-zeroes: if true, reads from the device produce zeroes; if false, the
2892 #               buffer is left unchanged. (default: false; since: 4.1)
2894 # Since: 2.9
2896 { 'struct': 'BlockdevOptionsNull',
2897   'data': { '*size': 'int', '*latency-ns': 'uint64', '*read-zeroes': 'bool' } }
2900 # @BlockdevOptionsNVMe:
2902 # Driver specific block device options for the NVMe backend.
2904 # @device: PCI controller address of the NVMe device in
2905 #          format hhhh:bb:ss.f (host:bus:slot.function)
2906 # @namespace: namespace number of the device, starting from 1.
2908 # Note that the PCI @device must have been unbound from any host
2909 # kernel driver before instructing QEMU to add the blockdev.
2911 # Since: 2.12
2913 { 'struct': 'BlockdevOptionsNVMe',
2914   'data': { 'device': 'str', 'namespace': 'int' } }
2917 # @BlockdevOptionsVVFAT:
2919 # Driver specific block device options for the vvfat protocol.
2921 # @dir: directory to be exported as FAT image
2922 # @fat-type: FAT type: 12, 16 or 32
2923 # @floppy: whether to export a floppy image (true) or
2924 #          partitioned hard disk (false; default)
2925 # @label: set the volume label, limited to 11 bytes. FAT16 and
2926 #         FAT32 traditionally have some restrictions on labels, which are
2927 #         ignored by most operating systems. Defaults to "QEMU VVFAT".
2928 #         (since 2.4)
2929 # @rw: whether to allow write operations (default: false)
2931 # Since: 2.9
2933 { 'struct': 'BlockdevOptionsVVFAT',
2934   'data': { 'dir': 'str', '*fat-type': 'int', '*floppy': 'bool',
2935             '*label': 'str', '*rw': 'bool' } }
2938 # @BlockdevOptionsGenericFormat:
2940 # Driver specific block device options for image format that have no option
2941 # besides their data source.
2943 # @file: reference to or definition of the data source block device
2945 # Since: 2.9
2947 { 'struct': 'BlockdevOptionsGenericFormat',
2948   'data': { 'file': 'BlockdevRef' } }
2951 # @BlockdevOptionsLUKS:
2953 # Driver specific block device options for LUKS.
2955 # @key-secret: the ID of a QCryptoSecret object providing
2956 #              the decryption key (since 2.6). Mandatory except when
2957 #              doing a metadata-only probe of the image.
2959 # Since: 2.9
2961 { 'struct': 'BlockdevOptionsLUKS',
2962   'base': 'BlockdevOptionsGenericFormat',
2963   'data': { '*key-secret': 'str' } }
2967 # @BlockdevOptionsGenericCOWFormat:
2969 # Driver specific block device options for image format that have no option
2970 # besides their data source and an optional backing file.
2972 # @backing: reference to or definition of the backing file block
2973 #           device, null disables the backing file entirely.
2974 #           Defaults to the backing file stored the image file.
2976 # Since: 2.9
2978 { 'struct': 'BlockdevOptionsGenericCOWFormat',
2979   'base': 'BlockdevOptionsGenericFormat',
2980   'data': { '*backing': 'BlockdevRefOrNull' } }
2983 # @Qcow2OverlapCheckMode:
2985 # General overlap check modes.
2987 # @none: Do not perform any checks
2989 # @constant: Perform only checks which can be done in constant time and
2990 #            without reading anything from disk
2992 # @cached: Perform only checks which can be done without reading anything
2993 #          from disk
2995 # @all: Perform all available overlap checks
2997 # Since: 2.9
2999 { 'enum': 'Qcow2OverlapCheckMode',
3000   'data': [ 'none', 'constant', 'cached', 'all' ] }
3003 # @Qcow2OverlapCheckFlags:
3005 # Structure of flags for each metadata structure. Setting a field to 'true'
3006 # makes qemu guard that structure against unintended overwriting. The default
3007 # value is chosen according to the template given.
3009 # @template: Specifies a template mode which can be adjusted using the other
3010 #            flags, defaults to 'cached'
3012 # @bitmap-directory: since 3.0
3014 # Since: 2.9
3016 { 'struct': 'Qcow2OverlapCheckFlags',
3017   'data': { '*template':         'Qcow2OverlapCheckMode',
3018             '*main-header':      'bool',
3019             '*active-l1':        'bool',
3020             '*active-l2':        'bool',
3021             '*refcount-table':   'bool',
3022             '*refcount-block':   'bool',
3023             '*snapshot-table':   'bool',
3024             '*inactive-l1':      'bool',
3025             '*inactive-l2':      'bool',
3026             '*bitmap-directory': 'bool' } }
3029 # @Qcow2OverlapChecks:
3031 # Specifies which metadata structures should be guarded against unintended
3032 # overwriting.
3034 # @flags: set of flags for separate specification of each metadata structure
3035 #         type
3037 # @mode: named mode which chooses a specific set of flags
3039 # Since: 2.9
3041 { 'alternate': 'Qcow2OverlapChecks',
3042   'data': { 'flags': 'Qcow2OverlapCheckFlags',
3043             'mode':  'Qcow2OverlapCheckMode' } }
3046 # @BlockdevQcowEncryptionFormat:
3048 # @aes: AES-CBC with plain64 initialization vectors
3050 # Since: 2.10
3052 { 'enum': 'BlockdevQcowEncryptionFormat',
3053   'data': [ 'aes' ] }
3056 # @BlockdevQcowEncryption:
3058 # Since: 2.10
3060 { 'union': 'BlockdevQcowEncryption',
3061   'base': { 'format': 'BlockdevQcowEncryptionFormat' },
3062   'discriminator': 'format',
3063   'data': { 'aes': 'QCryptoBlockOptionsQCow' } }
3066 # @BlockdevOptionsQcow:
3068 # Driver specific block device options for qcow.
3070 # @encrypt: Image decryption options. Mandatory for
3071 #           encrypted images, except when doing a metadata-only
3072 #           probe of the image.
3074 # Since: 2.10
3076 { 'struct': 'BlockdevOptionsQcow',
3077   'base': 'BlockdevOptionsGenericCOWFormat',
3078   'data': { '*encrypt': 'BlockdevQcowEncryption' } }
3083 # @BlockdevQcow2EncryptionFormat:
3084 # @aes: AES-CBC with plain64 initialization vectors
3086 # Since: 2.10
3088 { 'enum': 'BlockdevQcow2EncryptionFormat',
3089   'data': [ 'aes', 'luks' ] }
3092 # @BlockdevQcow2Encryption:
3094 # Since: 2.10
3096 { 'union': 'BlockdevQcow2Encryption',
3097   'base': { 'format': 'BlockdevQcow2EncryptionFormat' },
3098   'discriminator': 'format',
3099   'data': { 'aes': 'QCryptoBlockOptionsQCow',
3100             'luks': 'QCryptoBlockOptionsLUKS'} }
3103 # @BlockdevOptionsPreallocate:
3105 # Filter driver intended to be inserted between format and protocol node
3106 # and do preallocation in protocol node on write.
3108 # @prealloc-align: on preallocation, align file length to this number,
3109 #                  default 1048576 (1M)
3111 # @prealloc-size: how much to preallocate, default 134217728 (128M)
3113 # Since: 6.0
3115 { 'struct': 'BlockdevOptionsPreallocate',
3116   'base': 'BlockdevOptionsGenericFormat',
3117   'data': { '*prealloc-align': 'int', '*prealloc-size': 'int' } }
3120 # @BlockdevOptionsQcow2:
3122 # Driver specific block device options for qcow2.
3124 # @lazy-refcounts: whether to enable the lazy refcounts
3125 #                  feature (default is taken from the image file)
3127 # @pass-discard-request: whether discard requests to the qcow2
3128 #                        device should be forwarded to the data source
3130 # @pass-discard-snapshot: whether discard requests for the data source
3131 #                         should be issued when a snapshot operation (e.g.
3132 #                         deleting a snapshot) frees clusters in the qcow2 file
3134 # @pass-discard-other: whether discard requests for the data source
3135 #                      should be issued on other occasions where a cluster
3136 #                      gets freed
3138 # @overlap-check: which overlap checks to perform for writes
3139 #                 to the image, defaults to 'cached' (since 2.2)
3141 # @cache-size: the maximum total size of the L2 table and
3142 #              refcount block caches in bytes (since 2.2)
3144 # @l2-cache-size: the maximum size of the L2 table cache in
3145 #                 bytes (since 2.2)
3147 # @l2-cache-entry-size: the size of each entry in the L2 cache in
3148 #                       bytes. It must be a power of two between 512
3149 #                       and the cluster size. The default value is
3150 #                       the cluster size (since 2.12)
3152 # @refcount-cache-size: the maximum size of the refcount block cache
3153 #                       in bytes (since 2.2)
3155 # @cache-clean-interval: clean unused entries in the L2 and refcount
3156 #                        caches. The interval is in seconds. The default value
3157 #                        is 600 on supporting platforms, and 0 on other
3158 #                        platforms. 0 disables this feature. (since 2.5)
3160 # @encrypt: Image decryption options. Mandatory for
3161 #           encrypted images, except when doing a metadata-only
3162 #           probe of the image. (since 2.10)
3164 # @data-file: reference to or definition of the external data file.
3165 #             This may only be specified for images that require an
3166 #             external data file. If it is not specified for such
3167 #             an image, the data file name is loaded from the image
3168 #             file. (since 4.0)
3170 # Since: 2.9
3172 { 'struct': 'BlockdevOptionsQcow2',
3173   'base': 'BlockdevOptionsGenericCOWFormat',
3174   'data': { '*lazy-refcounts': 'bool',
3175             '*pass-discard-request': 'bool',
3176             '*pass-discard-snapshot': 'bool',
3177             '*pass-discard-other': 'bool',
3178             '*overlap-check': 'Qcow2OverlapChecks',
3179             '*cache-size': 'int',
3180             '*l2-cache-size': 'int',
3181             '*l2-cache-entry-size': 'int',
3182             '*refcount-cache-size': 'int',
3183             '*cache-clean-interval': 'int',
3184             '*encrypt': 'BlockdevQcow2Encryption',
3185             '*data-file': 'BlockdevRef' } }
3188 # @SshHostKeyCheckMode:
3190 # @none: Don't check the host key at all
3191 # @hash: Compare the host key with a given hash
3192 # @known_hosts: Check the host key against the known_hosts file
3194 # Since: 2.12
3196 { 'enum': 'SshHostKeyCheckMode',
3197   'data': [ 'none', 'hash', 'known_hosts' ] }
3200 # @SshHostKeyCheckHashType:
3202 # @md5: The given hash is an md5 hash
3203 # @sha1: The given hash is an sha1 hash
3205 # Since: 2.12
3207 { 'enum': 'SshHostKeyCheckHashType',
3208   'data': [ 'md5', 'sha1' ] }
3211 # @SshHostKeyHash:
3213 # @type: The hash algorithm used for the hash
3214 # @hash: The expected hash value
3216 # Since: 2.12
3218 { 'struct': 'SshHostKeyHash',
3219   'data': { 'type': 'SshHostKeyCheckHashType',
3220             'hash': 'str' }}
3223 # @SshHostKeyCheck:
3225 # Since: 2.12
3227 { 'union': 'SshHostKeyCheck',
3228   'base': { 'mode': 'SshHostKeyCheckMode' },
3229   'discriminator': 'mode',
3230   'data': { 'hash': 'SshHostKeyHash' } }
3233 # @BlockdevOptionsSsh:
3235 # @server:              host address
3237 # @path:                path to the image on the host
3239 # @user:                user as which to connect, defaults to current
3240 #                       local user name
3242 # @host-key-check:      Defines how and what to check the host key against
3243 #                       (default: known_hosts)
3245 # Since: 2.9
3247 { 'struct': 'BlockdevOptionsSsh',
3248   'data': { 'server': 'InetSocketAddress',
3249             'path': 'str',
3250             '*user': 'str',
3251             '*host-key-check': 'SshHostKeyCheck' } }
3255 # @BlkdebugEvent:
3257 # Trigger events supported by blkdebug.
3259 # @l1_shrink_write_table: write zeros to the l1 table to shrink image.
3260 #                         (since 2.11)
3262 # @l1_shrink_free_l2_clusters: discard the l2 tables. (since 2.11)
3264 # @cor_write: a write due to copy-on-read (since 2.11)
3266 # @cluster_alloc_space: an allocation of file space for a cluster (since 4.1)
3268 # @none: triggers once at creation of the blkdebug node (since 4.1)
3270 # Since: 2.9
3272 { 'enum': 'BlkdebugEvent', 'prefix': 'BLKDBG',
3273   'data': [ 'l1_update', 'l1_grow_alloc_table', 'l1_grow_write_table',
3274             'l1_grow_activate_table', 'l2_load', 'l2_update',
3275             'l2_update_compressed', 'l2_alloc_cow_read', 'l2_alloc_write',
3276             'read_aio', 'read_backing_aio', 'read_compressed', 'write_aio',
3277             'write_compressed', 'vmstate_load', 'vmstate_save', 'cow_read',
3278             'cow_write', 'reftable_load', 'reftable_grow', 'reftable_update',
3279             'refblock_load', 'refblock_update', 'refblock_update_part',
3280             'refblock_alloc', 'refblock_alloc_hookup', 'refblock_alloc_write',
3281             'refblock_alloc_write_blocks', 'refblock_alloc_write_table',
3282             'refblock_alloc_switch_table', 'cluster_alloc',
3283             'cluster_alloc_bytes', 'cluster_free', 'flush_to_os',
3284             'flush_to_disk', 'pwritev_rmw_head', 'pwritev_rmw_after_head',
3285             'pwritev_rmw_tail', 'pwritev_rmw_after_tail', 'pwritev',
3286             'pwritev_zero', 'pwritev_done', 'empty_image_prepare',
3287             'l1_shrink_write_table', 'l1_shrink_free_l2_clusters',
3288             'cor_write', 'cluster_alloc_space', 'none'] }
3291 # @BlkdebugIOType:
3293 # Kinds of I/O that blkdebug can inject errors in.
3295 # @read: .bdrv_co_preadv()
3297 # @write: .bdrv_co_pwritev()
3299 # @write-zeroes: .bdrv_co_pwrite_zeroes()
3301 # @discard: .bdrv_co_pdiscard()
3303 # @flush: .bdrv_co_flush_to_disk()
3305 # @block-status: .bdrv_co_block_status()
3307 # Since: 4.1
3309 { 'enum': 'BlkdebugIOType', 'prefix': 'BLKDEBUG_IO_TYPE',
3310   'data': [ 'read', 'write', 'write-zeroes', 'discard', 'flush',
3311             'block-status' ] }
3314 # @BlkdebugInjectErrorOptions:
3316 # Describes a single error injection for blkdebug.
3318 # @event: trigger event
3320 # @state: the state identifier blkdebug needs to be in to
3321 #         actually trigger the event; defaults to "any"
3323 # @iotype: the type of I/O operations on which this error should
3324 #          be injected; defaults to "all read, write,
3325 #          write-zeroes, discard, and flush operations"
3326 #          (since: 4.1)
3328 # @errno: error identifier (errno) to be returned; defaults to
3329 #         EIO
3331 # @sector: specifies the sector index which has to be affected
3332 #          in order to actually trigger the event; defaults to "any
3333 #          sector"
3335 # @once: disables further events after this one has been
3336 #        triggered; defaults to false
3338 # @immediately: fail immediately; defaults to false
3340 # Since: 2.9
3342 { 'struct': 'BlkdebugInjectErrorOptions',
3343   'data': { 'event': 'BlkdebugEvent',
3344             '*state': 'int',
3345             '*iotype': 'BlkdebugIOType',
3346             '*errno': 'int',
3347             '*sector': 'int',
3348             '*once': 'bool',
3349             '*immediately': 'bool' } }
3352 # @BlkdebugSetStateOptions:
3354 # Describes a single state-change event for blkdebug.
3356 # @event: trigger event
3358 # @state: the current state identifier blkdebug needs to be in;
3359 #         defaults to "any"
3361 # @new_state: the state identifier blkdebug is supposed to assume if
3362 #             this event is triggered
3364 # Since: 2.9
3366 { 'struct': 'BlkdebugSetStateOptions',
3367   'data': { 'event': 'BlkdebugEvent',
3368             '*state': 'int',
3369             'new_state': 'int' } }
3372 # @BlockdevOptionsBlkdebug:
3374 # Driver specific block device options for blkdebug.
3376 # @image: underlying raw block device (or image file)
3378 # @config: filename of the configuration file
3380 # @align: required alignment for requests in bytes, must be
3381 #         positive power of 2, or 0 for default
3383 # @max-transfer: maximum size for I/O transfers in bytes, must be
3384 #                positive multiple of @align and of the underlying
3385 #                file's request alignment (but need not be a power of
3386 #                2), or 0 for default (since 2.10)
3388 # @opt-write-zero: preferred alignment for write zero requests in bytes,
3389 #                  must be positive multiple of @align and of the
3390 #                  underlying file's request alignment (but need not be a
3391 #                  power of 2), or 0 for default (since 2.10)
3393 # @max-write-zero: maximum size for write zero requests in bytes, must be
3394 #                  positive multiple of @align, of @opt-write-zero, and of
3395 #                  the underlying file's request alignment (but need not
3396 #                  be a power of 2), or 0 for default (since 2.10)
3398 # @opt-discard: preferred alignment for discard requests in bytes, must
3399 #               be positive multiple of @align and of the underlying
3400 #               file's request alignment (but need not be a power of
3401 #               2), or 0 for default (since 2.10)
3403 # @max-discard: maximum size for discard requests in bytes, must be
3404 #               positive multiple of @align, of @opt-discard, and of
3405 #               the underlying file's request alignment (but need not
3406 #               be a power of 2), or 0 for default (since 2.10)
3408 # @inject-error: array of error injection descriptions
3410 # @set-state: array of state-change descriptions
3412 # @take-child-perms: Permissions to take on @image in addition to what
3413 #                    is necessary anyway (which depends on how the
3414 #                    blkdebug node is used).  Defaults to none.
3415 #                    (since 5.0)
3417 # @unshare-child-perms: Permissions not to share on @image in addition
3418 #                       to what cannot be shared anyway (which depends
3419 #                       on how the blkdebug node is used).  Defaults
3420 #                       to none.  (since 5.0)
3422 # Since: 2.9
3424 { 'struct': 'BlockdevOptionsBlkdebug',
3425   'data': { 'image': 'BlockdevRef',
3426             '*config': 'str',
3427             '*align': 'int', '*max-transfer': 'int32',
3428             '*opt-write-zero': 'int32', '*max-write-zero': 'int32',
3429             '*opt-discard': 'int32', '*max-discard': 'int32',
3430             '*inject-error': ['BlkdebugInjectErrorOptions'],
3431             '*set-state': ['BlkdebugSetStateOptions'],
3432             '*take-child-perms': ['BlockPermission'],
3433             '*unshare-child-perms': ['BlockPermission'] } }
3436 # @BlockdevOptionsBlklogwrites:
3438 # Driver specific block device options for blklogwrites.
3440 # @file: block device
3442 # @log: block device used to log writes to @file
3444 # @log-sector-size: sector size used in logging writes to @file, determines
3445 #                   granularity of offsets and sizes of writes (default: 512)
3447 # @log-append: append to an existing log (default: false)
3449 # @log-super-update-interval: interval of write requests after which the log
3450 #                             super block is updated to disk (default: 4096)
3452 # Since: 3.0
3454 { 'struct': 'BlockdevOptionsBlklogwrites',
3455   'data': { 'file': 'BlockdevRef',
3456             'log': 'BlockdevRef',
3457             '*log-sector-size': 'uint32',
3458             '*log-append': 'bool',
3459             '*log-super-update-interval': 'uint64' } }
3462 # @BlockdevOptionsBlkverify:
3464 # Driver specific block device options for blkverify.
3466 # @test: block device to be tested
3468 # @raw: raw image used for verification
3470 # Since: 2.9
3472 { 'struct': 'BlockdevOptionsBlkverify',
3473   'data': { 'test': 'BlockdevRef',
3474             'raw': 'BlockdevRef' } }
3477 # @BlockdevOptionsBlkreplay:
3479 # Driver specific block device options for blkreplay.
3481 # @image: disk image which should be controlled with blkreplay
3483 # Since: 4.2
3485 { 'struct': 'BlockdevOptionsBlkreplay',
3486   'data': { 'image': 'BlockdevRef' } }
3489 # @QuorumReadPattern:
3491 # An enumeration of quorum read patterns.
3493 # @quorum: read all the children and do a quorum vote on reads
3495 # @fifo: read only from the first child that has not failed
3497 # Since: 2.9
3499 { 'enum': 'QuorumReadPattern', 'data': [ 'quorum', 'fifo' ] }
3502 # @BlockdevOptionsQuorum:
3504 # Driver specific block device options for Quorum
3506 # @blkverify: true if the driver must print content mismatch
3507 #                  set to false by default
3509 # @children: the children block devices to use
3511 # @vote-threshold: the vote limit under which a read will fail
3513 # @rewrite-corrupted: rewrite corrupted data when quorum is reached
3514 #                     (Since 2.1)
3516 # @read-pattern: choose read pattern and set to quorum by default
3517 #                (Since 2.2)
3519 # Since: 2.9
3521 { 'struct': 'BlockdevOptionsQuorum',
3522   'data': { '*blkverify': 'bool',
3523             'children': [ 'BlockdevRef' ],
3524             'vote-threshold': 'int',
3525             '*rewrite-corrupted': 'bool',
3526             '*read-pattern': 'QuorumReadPattern' } }
3529 # @BlockdevOptionsGluster:
3531 # Driver specific block device options for Gluster
3533 # @volume: name of gluster volume where VM image resides
3535 # @path: absolute path to image file in gluster volume
3537 # @server: gluster servers description
3539 # @debug: libgfapi log level (default '4' which is Error)
3540 #         (Since 2.8)
3542 # @logfile: libgfapi log file (default /dev/stderr) (Since 2.8)
3544 # Since: 2.9
3546 { 'struct': 'BlockdevOptionsGluster',
3547   'data': { 'volume': 'str',
3548             'path': 'str',
3549             'server': ['SocketAddress'],
3550             '*debug': 'int',
3551             '*logfile': 'str' } }
3554 # @IscsiTransport:
3556 # An enumeration of libiscsi transport types
3558 # Since: 2.9
3560 { 'enum': 'IscsiTransport',
3561   'data': [ 'tcp', 'iser' ] }
3564 # @IscsiHeaderDigest:
3566 # An enumeration of header digests supported by libiscsi
3568 # Since: 2.9
3570 { 'enum': 'IscsiHeaderDigest',
3571   'prefix': 'QAPI_ISCSI_HEADER_DIGEST',
3572   'data': [ 'crc32c', 'none', 'crc32c-none', 'none-crc32c' ] }
3575 # @BlockdevOptionsIscsi:
3577 # @transport: The iscsi transport type
3579 # @portal: The address of the iscsi portal
3581 # @target: The target iqn name
3583 # @lun: LUN to connect to. Defaults to 0.
3585 # @user: User name to log in with. If omitted, no CHAP
3586 #        authentication is performed.
3588 # @password-secret: The ID of a QCryptoSecret object providing
3589 #                   the password for the login. This option is required if
3590 #                   @user is specified.
3592 # @initiator-name: The iqn name we want to identify to the target
3593 #                  as. If this option is not specified, an initiator name is
3594 #                  generated automatically.
3596 # @header-digest: The desired header digest. Defaults to
3597 #                 none-crc32c.
3599 # @timeout: Timeout in seconds after which a request will
3600 #           timeout. 0 means no timeout and is the default.
3602 # Driver specific block device options for iscsi
3604 # Since: 2.9
3606 { 'struct': 'BlockdevOptionsIscsi',
3607   'data': { 'transport': 'IscsiTransport',
3608             'portal': 'str',
3609             'target': 'str',
3610             '*lun': 'int',
3611             '*user': 'str',
3612             '*password-secret': 'str',
3613             '*initiator-name': 'str',
3614             '*header-digest': 'IscsiHeaderDigest',
3615             '*timeout': 'int' } }
3619 # @RbdAuthMode:
3621 # Since: 3.0
3623 { 'enum': 'RbdAuthMode',
3624   'data': [ 'cephx', 'none' ] }
3627 # @BlockdevOptionsRbd:
3629 # @pool: Ceph pool name.
3631 # @namespace: Rados namespace name in the Ceph pool. (Since 5.0)
3633 # @image: Image name in the Ceph pool.
3635 # @conf: path to Ceph configuration file.  Values
3636 #        in the configuration file will be overridden by
3637 #        options specified via QAPI.
3639 # @snapshot: Ceph snapshot name.
3641 # @user: Ceph id name.
3643 # @auth-client-required: Acceptable authentication modes.
3644 #                        This maps to Ceph configuration option
3645 #                        "auth_client_required".  (Since 3.0)
3647 # @key-secret: ID of a QCryptoSecret object providing a key
3648 #              for cephx authentication.
3649 #              This maps to Ceph configuration option
3650 #              "key".  (Since 3.0)
3652 # @server: Monitor host address and port.  This maps
3653 #          to the "mon_host" Ceph option.
3655 # Since: 2.9
3657 { 'struct': 'BlockdevOptionsRbd',
3658   'data': { 'pool': 'str',
3659             '*namespace': 'str',
3660             'image': 'str',
3661             '*conf': 'str',
3662             '*snapshot': 'str',
3663             '*user': 'str',
3664             '*auth-client-required': ['RbdAuthMode'],
3665             '*key-secret': 'str',
3666             '*server': ['InetSocketAddressBase'] } }
3669 # @BlockdevOptionsSheepdog:
3671 # Driver specific block device options for sheepdog
3673 # @vdi: Virtual disk image name
3674 # @server: The Sheepdog server to connect to
3675 # @snap-id: Snapshot ID
3676 # @tag: Snapshot tag name
3678 # Only one of @snap-id and @tag may be present.
3680 # Since: 2.9
3682 { 'struct': 'BlockdevOptionsSheepdog',
3683   'data': { 'server': 'SocketAddress',
3684             'vdi': 'str',
3685             '*snap-id': 'uint32',
3686             '*tag': 'str' } }
3689 # @ReplicationMode:
3691 # An enumeration of replication modes.
3693 # @primary: Primary mode, the vm's state will be sent to secondary QEMU.
3695 # @secondary: Secondary mode, receive the vm's state from primary QEMU.
3697 # Since: 2.9
3699 { 'enum' : 'ReplicationMode', 'data' : [ 'primary', 'secondary' ],
3700   'if': 'defined(CONFIG_REPLICATION)' }
3703 # @BlockdevOptionsReplication:
3705 # Driver specific block device options for replication
3707 # @mode: the replication mode
3709 # @top-id: In secondary mode, node name or device ID of the root
3710 #          node who owns the replication node chain. Must not be given in
3711 #          primary mode.
3713 # Since: 2.9
3715 { 'struct': 'BlockdevOptionsReplication',
3716   'base': 'BlockdevOptionsGenericFormat',
3717   'data': { 'mode': 'ReplicationMode',
3718             '*top-id': 'str' },
3719   'if': 'defined(CONFIG_REPLICATION)' }
3722 # @NFSTransport:
3724 # An enumeration of NFS transport types
3726 # @inet: TCP transport
3728 # Since: 2.9
3730 { 'enum': 'NFSTransport',
3731   'data': [ 'inet' ] }
3734 # @NFSServer:
3736 # Captures the address of the socket
3738 # @type: transport type used for NFS (only TCP supported)
3740 # @host: host address for NFS server
3742 # Since: 2.9
3744 { 'struct': 'NFSServer',
3745   'data': { 'type': 'NFSTransport',
3746             'host': 'str' } }
3749 # @BlockdevOptionsNfs:
3751 # Driver specific block device option for NFS
3753 # @server: host address
3755 # @path: path of the image on the host
3757 # @user: UID value to use when talking to the
3758 #        server (defaults to 65534 on Windows and getuid()
3759 #        on unix)
3761 # @group: GID value to use when talking to the
3762 #         server (defaults to 65534 on Windows and getgid()
3763 #         in unix)
3765 # @tcp-syn-count: number of SYNs during the session
3766 #                 establishment (defaults to libnfs default)
3768 # @readahead-size: set the readahead size in bytes (defaults
3769 #                  to libnfs default)
3771 # @page-cache-size: set the pagecache size in bytes (defaults
3772 #                   to libnfs default)
3774 # @debug: set the NFS debug level (max 2) (defaults
3775 #         to libnfs default)
3777 # Since: 2.9
3779 { 'struct': 'BlockdevOptionsNfs',
3780   'data': { 'server': 'NFSServer',
3781             'path': 'str',
3782             '*user': 'int',
3783             '*group': 'int',
3784             '*tcp-syn-count': 'int',
3785             '*readahead-size': 'int',
3786             '*page-cache-size': 'int',
3787             '*debug': 'int' } }
3790 # @BlockdevOptionsCurlBase:
3792 # Driver specific block device options shared by all protocols supported by the
3793 # curl backend.
3795 # @url: URL of the image file
3797 # @readahead: Size of the read-ahead cache; must be a multiple of
3798 #             512 (defaults to 256 kB)
3800 # @timeout: Timeout for connections, in seconds (defaults to 5)
3802 # @username: Username for authentication (defaults to none)
3804 # @password-secret: ID of a QCryptoSecret object providing a password
3805 #                   for authentication (defaults to no password)
3807 # @proxy-username: Username for proxy authentication (defaults to none)
3809 # @proxy-password-secret: ID of a QCryptoSecret object providing a password
3810 #                         for proxy authentication (defaults to no password)
3812 # Since: 2.9
3814 { 'struct': 'BlockdevOptionsCurlBase',
3815   'data': { 'url': 'str',
3816             '*readahead': 'int',
3817             '*timeout': 'int',
3818             '*username': 'str',
3819             '*password-secret': 'str',
3820             '*proxy-username': 'str',
3821             '*proxy-password-secret': 'str' } }
3824 # @BlockdevOptionsCurlHttp:
3826 # Driver specific block device options for HTTP connections over the curl
3827 # backend.  URLs must start with "http://".
3829 # @cookie: List of cookies to set; format is
3830 #          "name1=content1; name2=content2;" as explained by
3831 #          CURLOPT_COOKIE(3). Defaults to no cookies.
3833 # @cookie-secret: ID of a QCryptoSecret object providing the cookie data in a
3834 #                 secure way. See @cookie for the format. (since 2.10)
3836 # Since: 2.9
3838 { 'struct': 'BlockdevOptionsCurlHttp',
3839   'base': 'BlockdevOptionsCurlBase',
3840   'data': { '*cookie': 'str',
3841             '*cookie-secret': 'str'} }
3844 # @BlockdevOptionsCurlHttps:
3846 # Driver specific block device options for HTTPS connections over the curl
3847 # backend.  URLs must start with "https://".
3849 # @cookie: List of cookies to set; format is
3850 #          "name1=content1; name2=content2;" as explained by
3851 #          CURLOPT_COOKIE(3). Defaults to no cookies.
3853 # @sslverify: Whether to verify the SSL certificate's validity (defaults to
3854 #             true)
3856 # @cookie-secret: ID of a QCryptoSecret object providing the cookie data in a
3857 #                 secure way. See @cookie for the format. (since 2.10)
3859 # Since: 2.9
3861 { 'struct': 'BlockdevOptionsCurlHttps',
3862   'base': 'BlockdevOptionsCurlBase',
3863   'data': { '*cookie': 'str',
3864             '*sslverify': 'bool',
3865             '*cookie-secret': 'str'} }
3868 # @BlockdevOptionsCurlFtp:
3870 # Driver specific block device options for FTP connections over the curl
3871 # backend.  URLs must start with "ftp://".
3873 # Since: 2.9
3875 { 'struct': 'BlockdevOptionsCurlFtp',
3876   'base': 'BlockdevOptionsCurlBase',
3877   'data': { } }
3880 # @BlockdevOptionsCurlFtps:
3882 # Driver specific block device options for FTPS connections over the curl
3883 # backend.  URLs must start with "ftps://".
3885 # @sslverify: Whether to verify the SSL certificate's validity (defaults to
3886 #             true)
3888 # Since: 2.9
3890 { 'struct': 'BlockdevOptionsCurlFtps',
3891   'base': 'BlockdevOptionsCurlBase',
3892   'data': { '*sslverify': 'bool' } }
3895 # @BlockdevOptionsNbd:
3897 # Driver specific block device options for NBD.
3899 # @server: NBD server address
3901 # @export: export name
3903 # @tls-creds: TLS credentials ID
3905 # @x-dirty-bitmap: A metadata context name such as "qemu:dirty-bitmap:NAME"
3906 #                  or "qemu:allocation-depth" to query in place of the
3907 #                  traditional "base:allocation" block status (see
3908 #                  NBD_OPT_LIST_META_CONTEXT in the NBD protocol; and
3909 #                  yes, naming this option x-context would have made
3910 #                  more sense) (since 3.0)
3912 # @reconnect-delay: On an unexpected disconnect, the nbd client tries to
3913 #                   connect again until succeeding or encountering a serious
3914 #                   error.  During the first @reconnect-delay seconds, all
3915 #                   requests are paused and will be rerun on a successful
3916 #                   reconnect. After that time, any delayed requests and all
3917 #                   future requests before a successful reconnect will
3918 #                   immediately fail. Default 0 (Since 4.2)
3920 # Since: 2.9
3922 { 'struct': 'BlockdevOptionsNbd',
3923   'data': { 'server': 'SocketAddress',
3924             '*export': 'str',
3925             '*tls-creds': 'str',
3926             '*x-dirty-bitmap': 'str',
3927             '*reconnect-delay': 'uint32' } }
3930 # @BlockdevOptionsRaw:
3932 # Driver specific block device options for the raw driver.
3934 # @offset: position where the block device starts
3935 # @size: the assumed size of the device
3937 # Since: 2.9
3939 { 'struct': 'BlockdevOptionsRaw',
3940   'base': 'BlockdevOptionsGenericFormat',
3941   'data': { '*offset': 'int', '*size': 'int' } }
3944 # @BlockdevOptionsThrottle:
3946 # Driver specific block device options for the throttle driver
3948 # @throttle-group: the name of the throttle-group object to use. It
3949 #                  must already exist.
3950 # @file: reference to or definition of the data source block device
3951 # Since: 2.11
3953 { 'struct': 'BlockdevOptionsThrottle',
3954   'data': { 'throttle-group': 'str',
3955             'file' : 'BlockdevRef'
3956              } }
3959 # @BlockdevOptionsCor:
3961 # Driver specific block device options for the copy-on-read driver.
3963 # @bottom: The name of a non-filter node (allocation-bearing layer) that
3964 #          limits the COR operations in the backing chain (inclusive), so
3965 #          that no data below this node will be copied by this filter.
3966 #          If option is absent, the limit is not applied, so that data
3967 #          from all backing layers may be copied.
3969 # Since: 6.0
3971 { 'struct': 'BlockdevOptionsCor',
3972   'base': 'BlockdevOptionsGenericFormat',
3973   'data': { '*bottom': 'str' } }
3976 # @BlockdevOptions:
3978 # Options for creating a block device.  Many options are available for all
3979 # block devices, independent of the block driver:
3981 # @driver: block driver name
3982 # @node-name: the node name of the new node (Since 2.0).
3983 #             This option is required on the top level of blockdev-add.
3984 #             Valid node names start with an alphabetic character and may
3985 #             contain only alphanumeric characters, '-', '.' and '_'. Their
3986 #             maximum length is 31 characters.
3987 # @discard: discard-related options (default: ignore)
3988 # @cache: cache-related options
3989 # @read-only: whether the block device should be read-only (default: false).
3990 #             Note that some block drivers support only read-only access,
3991 #             either generally or in certain configurations. In this case,
3992 #             the default value does not work and the option must be
3993 #             specified explicitly.
3994 # @auto-read-only: if true and @read-only is false, QEMU may automatically
3995 #                  decide not to open the image read-write as requested, but
3996 #                  fall back to read-only instead (and switch between the modes
3997 #                  later), e.g. depending on whether the image file is writable
3998 #                  or whether a writing user is attached to the node
3999 #                  (default: false, since 3.1)
4000 # @detect-zeroes: detect and optimize zero writes (Since 2.1)
4001 #                 (default: off)
4002 # @force-share: force share all permission on added nodes.
4003 #               Requires read-only=true. (Since 2.10)
4005 # Remaining options are determined by the block driver.
4007 # Since: 2.9
4009 { 'union': 'BlockdevOptions',
4010   'base': { 'driver': 'BlockdevDriver',
4011             '*node-name': 'str',
4012             '*discard': 'BlockdevDiscardOptions',
4013             '*cache': 'BlockdevCacheOptions',
4014             '*read-only': 'bool',
4015             '*auto-read-only': 'bool',
4016             '*force-share': 'bool',
4017             '*detect-zeroes': 'BlockdevDetectZeroesOptions' },
4018   'discriminator': 'driver',
4019   'data': {
4020       'blkdebug':   'BlockdevOptionsBlkdebug',
4021       'blklogwrites':'BlockdevOptionsBlklogwrites',
4022       'blkverify':  'BlockdevOptionsBlkverify',
4023       'blkreplay':  'BlockdevOptionsBlkreplay',
4024       'bochs':      'BlockdevOptionsGenericFormat',
4025       'cloop':      'BlockdevOptionsGenericFormat',
4026       'compress':   'BlockdevOptionsGenericFormat',
4027       'copy-on-read':'BlockdevOptionsCor',
4028       'dmg':        'BlockdevOptionsGenericFormat',
4029       'file':       'BlockdevOptionsFile',
4030       'ftp':        'BlockdevOptionsCurlFtp',
4031       'ftps':       'BlockdevOptionsCurlFtps',
4032       'gluster':    'BlockdevOptionsGluster',
4033       'host_cdrom': 'BlockdevOptionsFile',
4034       'host_device':'BlockdevOptionsFile',
4035       'http':       'BlockdevOptionsCurlHttp',
4036       'https':      'BlockdevOptionsCurlHttps',
4037       'iscsi':      'BlockdevOptionsIscsi',
4038       'luks':       'BlockdevOptionsLUKS',
4039       'nbd':        'BlockdevOptionsNbd',
4040       'nfs':        'BlockdevOptionsNfs',
4041       'null-aio':   'BlockdevOptionsNull',
4042       'null-co':    'BlockdevOptionsNull',
4043       'nvme':       'BlockdevOptionsNVMe',
4044       'parallels':  'BlockdevOptionsGenericFormat',
4045       'preallocate':'BlockdevOptionsPreallocate',
4046       'qcow2':      'BlockdevOptionsQcow2',
4047       'qcow':       'BlockdevOptionsQcow',
4048       'qed':        'BlockdevOptionsGenericCOWFormat',
4049       'quorum':     'BlockdevOptionsQuorum',
4050       'raw':        'BlockdevOptionsRaw',
4051       'rbd':        'BlockdevOptionsRbd',
4052       'replication': { 'type': 'BlockdevOptionsReplication',
4053                        'if': 'defined(CONFIG_REPLICATION)' },
4054       'sheepdog':   'BlockdevOptionsSheepdog',
4055       'ssh':        'BlockdevOptionsSsh',
4056       'throttle':   'BlockdevOptionsThrottle',
4057       'vdi':        'BlockdevOptionsGenericFormat',
4058       'vhdx':       'BlockdevOptionsGenericFormat',
4059       'vmdk':       'BlockdevOptionsGenericCOWFormat',
4060       'vpc':        'BlockdevOptionsGenericFormat',
4061       'vvfat':      'BlockdevOptionsVVFAT'
4062   } }
4065 # @BlockdevRef:
4067 # Reference to a block device.
4069 # @definition: defines a new block device inline
4070 # @reference: references the ID of an existing block device
4072 # Since: 2.9
4074 { 'alternate': 'BlockdevRef',
4075   'data': { 'definition': 'BlockdevOptions',
4076             'reference': 'str' } }
4079 # @BlockdevRefOrNull:
4081 # Reference to a block device.
4083 # @definition: defines a new block device inline
4084 # @reference: references the ID of an existing block device.
4085 #             An empty string means that no block device should
4086 #             be referenced.  Deprecated; use null instead.
4087 # @null: No block device should be referenced (since 2.10)
4089 # Since: 2.9
4091 { 'alternate': 'BlockdevRefOrNull',
4092   'data': { 'definition': 'BlockdevOptions',
4093             'reference': 'str',
4094             'null': 'null' } }
4097 # @blockdev-add:
4099 # Creates a new block device.
4101 # Since: 2.9
4103 # Example:
4105 # 1.
4106 # -> { "execute": "blockdev-add",
4107 #      "arguments": {
4108 #           "driver": "qcow2",
4109 #           "node-name": "test1",
4110 #           "file": {
4111 #               "driver": "file",
4112 #               "filename": "test.qcow2"
4113 #            }
4114 #       }
4115 #     }
4116 # <- { "return": {} }
4118 # 2.
4119 # -> { "execute": "blockdev-add",
4120 #      "arguments": {
4121 #           "driver": "qcow2",
4122 #           "node-name": "node0",
4123 #           "discard": "unmap",
4124 #           "cache": {
4125 #              "direct": true
4126 #            },
4127 #            "file": {
4128 #              "driver": "file",
4129 #              "filename": "/tmp/test.qcow2"
4130 #            },
4131 #            "backing": {
4132 #               "driver": "raw",
4133 #               "file": {
4134 #                  "driver": "file",
4135 #                  "filename": "/dev/fdset/4"
4136 #                }
4137 #            }
4138 #        }
4139 #      }
4141 # <- { "return": {} }
4144 { 'command': 'blockdev-add', 'data': 'BlockdevOptions', 'boxed': true }
4147 # @x-blockdev-reopen:
4149 # Reopens a block device using the given set of options. Any option
4150 # not specified will be reset to its default value regardless of its
4151 # previous status. If an option cannot be changed or a particular
4152 # driver does not support reopening then the command will return an
4153 # error.
4155 # The top-level @node-name option (from BlockdevOptions) must be
4156 # specified and is used to select the block device to be reopened.
4157 # Other @node-name options must be either omitted or set to the
4158 # current name of the appropriate node. This command won't change any
4159 # node name and any attempt to do it will result in an error.
4161 # In the case of options that refer to child nodes, the behavior of
4162 # this command depends on the value:
4164 #  1) A set of options (BlockdevOptions): the child is reopened with
4165 #     the specified set of options.
4167 #  2) A reference to the current child: the child is reopened using
4168 #     its existing set of options.
4170 #  3) A reference to a different node: the current child is replaced
4171 #     with the specified one.
4173 #  4) NULL: the current child (if any) is detached.
4175 # Options (1) and (2) are supported in all cases, but at the moment
4176 # only @backing allows replacing or detaching an existing child.
4178 # Unlike with blockdev-add, the @backing option must always be present
4179 # unless the node being reopened does not have a backing file and its
4180 # image does not have a default backing file name as part of its
4181 # metadata.
4183 # Since: 4.0
4185 { 'command': 'x-blockdev-reopen',
4186   'data': 'BlockdevOptions', 'boxed': true }
4189 # @blockdev-del:
4191 # Deletes a block device that has been added using blockdev-add.
4192 # The command will fail if the node is attached to a device or is
4193 # otherwise being used.
4195 # @node-name: Name of the graph node to delete.
4197 # Since: 2.9
4199 # Example:
4201 # -> { "execute": "blockdev-add",
4202 #      "arguments": {
4203 #           "driver": "qcow2",
4204 #           "node-name": "node0",
4205 #           "file": {
4206 #               "driver": "file",
4207 #               "filename": "test.qcow2"
4208 #           }
4209 #      }
4210 #    }
4211 # <- { "return": {} }
4213 # -> { "execute": "blockdev-del",
4214 #      "arguments": { "node-name": "node0" }
4215 #    }
4216 # <- { "return": {} }
4219 { 'command': 'blockdev-del', 'data': { 'node-name': 'str' } }
4222 # @BlockdevCreateOptionsFile:
4224 # Driver specific image creation options for file.
4226 # @filename: Filename for the new image file
4227 # @size: Size of the virtual disk in bytes
4228 # @preallocation: Preallocation mode for the new image (default: off;
4229 #                 allowed values: off,
4230 #                 falloc (if defined CONFIG_POSIX_FALLOCATE),
4231 #                 full (if defined CONFIG_POSIX))
4232 # @nocow: Turn off copy-on-write (valid only on btrfs; default: off)
4233 # @extent-size-hint: Extent size hint to add to the image file; 0 for not
4234 #                    adding an extent size hint (default: 1 MB, since 5.1)
4236 # Since: 2.12
4238 { 'struct': 'BlockdevCreateOptionsFile',
4239   'data': { 'filename':             'str',
4240             'size':                 'size',
4241             '*preallocation':       'PreallocMode',
4242             '*nocow':               'bool',
4243             '*extent-size-hint':    'size'} }
4246 # @BlockdevCreateOptionsGluster:
4248 # Driver specific image creation options for gluster.
4250 # @location: Where to store the new image file
4251 # @size: Size of the virtual disk in bytes
4252 # @preallocation: Preallocation mode for the new image (default: off;
4253 #                 allowed values: off,
4254 #                 falloc (if defined CONFIG_GLUSTERFS_FALLOCATE),
4255 #                 full (if defined CONFIG_GLUSTERFS_ZEROFILL))
4257 # Since: 2.12
4259 { 'struct': 'BlockdevCreateOptionsGluster',
4260   'data': { 'location':         'BlockdevOptionsGluster',
4261             'size':             'size',
4262             '*preallocation':   'PreallocMode' } }
4265 # @BlockdevCreateOptionsLUKS:
4267 # Driver specific image creation options for LUKS.
4269 # @file: Node to create the image format on
4270 # @size: Size of the virtual disk in bytes
4271 # @preallocation: Preallocation mode for the new image
4272 #                 (since: 4.2)
4273 #                 (default: off; allowed values: off, metadata, falloc, full)
4275 # Since: 2.12
4277 { 'struct': 'BlockdevCreateOptionsLUKS',
4278   'base': 'QCryptoBlockCreateOptionsLUKS',
4279   'data': { 'file':             'BlockdevRef',
4280             'size':             'size',
4281             '*preallocation':   'PreallocMode' } }
4284 # @BlockdevCreateOptionsNfs:
4286 # Driver specific image creation options for NFS.
4288 # @location: Where to store the new image file
4289 # @size: Size of the virtual disk in bytes
4291 # Since: 2.12
4293 { 'struct': 'BlockdevCreateOptionsNfs',
4294   'data': { 'location':         'BlockdevOptionsNfs',
4295             'size':             'size' } }
4298 # @BlockdevCreateOptionsParallels:
4300 # Driver specific image creation options for parallels.
4302 # @file: Node to create the image format on
4303 # @size: Size of the virtual disk in bytes
4304 # @cluster-size: Cluster size in bytes (default: 1 MB)
4306 # Since: 2.12
4308 { 'struct': 'BlockdevCreateOptionsParallels',
4309   'data': { 'file':             'BlockdevRef',
4310             'size':             'size',
4311             '*cluster-size':    'size' } }
4314 # @BlockdevCreateOptionsQcow:
4316 # Driver specific image creation options for qcow.
4318 # @file: Node to create the image format on
4319 # @size: Size of the virtual disk in bytes
4320 # @backing-file: File name of the backing file if a backing file
4321 #                should be used
4322 # @encrypt: Encryption options if the image should be encrypted
4324 # Since: 2.12
4326 { 'struct': 'BlockdevCreateOptionsQcow',
4327   'data': { 'file':             'BlockdevRef',
4328             'size':             'size',
4329             '*backing-file':    'str',
4330             '*encrypt':         'QCryptoBlockCreateOptions' } }
4333 # @BlockdevQcow2Version:
4335 # @v2:  The original QCOW2 format as introduced in qemu 0.10 (version 2)
4336 # @v3:  The extended QCOW2 format as introduced in qemu 1.1 (version 3)
4338 # Since: 2.12
4340 { 'enum': 'BlockdevQcow2Version',
4341   'data': [ 'v2', 'v3' ] }
4345 # @Qcow2CompressionType:
4347 # Compression type used in qcow2 image file
4349 # @zlib: zlib compression, see <http://zlib.net/>
4350 # @zstd: zstd compression, see <http://github.com/facebook/zstd>
4352 # Since: 5.1
4354 { 'enum': 'Qcow2CompressionType',
4355   'data': [ 'zlib', { 'name': 'zstd', 'if': 'defined(CONFIG_ZSTD)' } ] }
4358 # @BlockdevCreateOptionsQcow2:
4360 # Driver specific image creation options for qcow2.
4362 # @file: Node to create the image format on
4363 # @data-file: Node to use as an external data file in which all guest
4364 #             data is stored so that only metadata remains in the qcow2
4365 #             file (since: 4.0)
4366 # @data-file-raw: True if the external data file must stay valid as a
4367 #                 standalone (read-only) raw image without looking at qcow2
4368 #                 metadata (default: false; since: 4.0)
4369 # @extended-l2: True to make the image have extended L2 entries
4370 #               (default: false; since 5.2)
4371 # @size: Size of the virtual disk in bytes
4372 # @version: Compatibility level (default: v3)
4373 # @backing-file: File name of the backing file if a backing file
4374 #                should be used
4375 # @backing-fmt: Name of the block driver to use for the backing file
4376 # @encrypt: Encryption options if the image should be encrypted
4377 # @cluster-size: qcow2 cluster size in bytes (default: 65536)
4378 # @preallocation: Preallocation mode for the new image (default: off;
4379 #                 allowed values: off, falloc, full, metadata)
4380 # @lazy-refcounts: True if refcounts may be updated lazily (default: off)
4381 # @refcount-bits: Width of reference counts in bits (default: 16)
4382 # @compression-type: The image cluster compression method
4383 #                    (default: zlib, since 5.1)
4385 # Since: 2.12
4387 { 'struct': 'BlockdevCreateOptionsQcow2',
4388   'data': { 'file':             'BlockdevRef',
4389             '*data-file':       'BlockdevRef',
4390             '*data-file-raw':   'bool',
4391             '*extended-l2':     'bool',
4392             'size':             'size',
4393             '*version':         'BlockdevQcow2Version',
4394             '*backing-file':    'str',
4395             '*backing-fmt':     'BlockdevDriver',
4396             '*encrypt':         'QCryptoBlockCreateOptions',
4397             '*cluster-size':    'size',
4398             '*preallocation':   'PreallocMode',
4399             '*lazy-refcounts':  'bool',
4400             '*refcount-bits':   'int',
4401             '*compression-type':'Qcow2CompressionType' } }
4404 # @BlockdevCreateOptionsQed:
4406 # Driver specific image creation options for qed.
4408 # @file: Node to create the image format on
4409 # @size: Size of the virtual disk in bytes
4410 # @backing-file: File name of the backing file if a backing file
4411 #                should be used
4412 # @backing-fmt: Name of the block driver to use for the backing file
4413 # @cluster-size: Cluster size in bytes (default: 65536)
4414 # @table-size: L1/L2 table size (in clusters)
4416 # Since: 2.12
4418 { 'struct': 'BlockdevCreateOptionsQed',
4419   'data': { 'file':             'BlockdevRef',
4420             'size':             'size',
4421             '*backing-file':    'str',
4422             '*backing-fmt':     'BlockdevDriver',
4423             '*cluster-size':    'size',
4424             '*table-size':      'int' } }
4427 # @BlockdevCreateOptionsRbd:
4429 # Driver specific image creation options for rbd/Ceph.
4431 # @location: Where to store the new image file. This location cannot
4432 #            point to a snapshot.
4433 # @size: Size of the virtual disk in bytes
4434 # @cluster-size: RBD object size
4436 # Since: 2.12
4438 { 'struct': 'BlockdevCreateOptionsRbd',
4439   'data': { 'location':         'BlockdevOptionsRbd',
4440             'size':             'size',
4441             '*cluster-size' :   'size' } }
4444 # @BlockdevVmdkSubformat:
4446 # Subformat options for VMDK images
4448 # @monolithicSparse:     Single file image with sparse cluster allocation
4450 # @monolithicFlat:       Single flat data image and a descriptor file
4452 # @twoGbMaxExtentSparse: Data is split into 2GB (per virtual LBA) sparse extent
4453 #                        files, in addition to a descriptor file
4455 # @twoGbMaxExtentFlat:   Data is split into 2GB (per virtual LBA) flat extent
4456 #                        files, in addition to a descriptor file
4458 # @streamOptimized:      Single file image sparse cluster allocation, optimized
4459 #                        for streaming over network.
4461 # Since: 4.0
4463 { 'enum': 'BlockdevVmdkSubformat',
4464   'data': [ 'monolithicSparse', 'monolithicFlat', 'twoGbMaxExtentSparse',
4465             'twoGbMaxExtentFlat', 'streamOptimized'] }
4468 # @BlockdevVmdkAdapterType:
4470 # Adapter type info for VMDK images
4472 # Since: 4.0
4474 { 'enum': 'BlockdevVmdkAdapterType',
4475   'data': [ 'ide', 'buslogic', 'lsilogic', 'legacyESX'] }
4478 # @BlockdevCreateOptionsVmdk:
4480 # Driver specific image creation options for VMDK.
4482 # @file: Where to store the new image file. This refers to the image
4483 #        file for monolithcSparse and streamOptimized format, or the
4484 #        descriptor file for other formats.
4485 # @size: Size of the virtual disk in bytes
4486 # @extents: Where to store the data extents. Required for monolithcFlat,
4487 #           twoGbMaxExtentSparse and twoGbMaxExtentFlat formats. For
4488 #           monolithicFlat, only one entry is required; for
4489 #           twoGbMaxExtent* formats, the number of entries required is
4490 #           calculated as extent_number = virtual_size / 2GB. Providing
4491 #           more extents than will be used is an error.
4492 # @subformat: The subformat of the VMDK image. Default: "monolithicSparse".
4493 # @backing-file: The path of backing file. Default: no backing file is used.
4494 # @adapter-type: The adapter type used to fill in the descriptor. Default: ide.
4495 # @hwversion: Hardware version. The meaningful options are "4" or "6".
4496 #             Default: "4".
4497 # @zeroed-grain: Whether to enable zeroed-grain feature for sparse subformats.
4498 #                Default: false.
4500 # Since: 4.0
4502 { 'struct': 'BlockdevCreateOptionsVmdk',
4503   'data': { 'file':             'BlockdevRef',
4504             'size':             'size',
4505             '*extents':          ['BlockdevRef'],
4506             '*subformat':       'BlockdevVmdkSubformat',
4507             '*backing-file':    'str',
4508             '*adapter-type':    'BlockdevVmdkAdapterType',
4509             '*hwversion':       'str',
4510             '*zeroed-grain':    'bool' } }
4514 # @SheepdogRedundancyType:
4516 # @full: Create a fully replicated vdi with x copies
4517 # @erasure-coded: Create an erasure coded vdi with x data strips and
4518 #                 y parity strips
4520 # Since: 2.12
4522 { 'enum': 'SheepdogRedundancyType',
4523   'data': [ 'full', 'erasure-coded' ] }
4526 # @SheepdogRedundancyFull:
4528 # @copies: Number of copies to use (between 1 and 31)
4530 # Since: 2.12
4532 { 'struct': 'SheepdogRedundancyFull',
4533   'data': { 'copies': 'int' }}
4536 # @SheepdogRedundancyErasureCoded:
4538 # @data-strips: Number of data strips to use (one of {2,4,8,16})
4539 # @parity-strips: Number of parity strips to use (between 1 and 15)
4541 # Since: 2.12
4543 { 'struct': 'SheepdogRedundancyErasureCoded',
4544   'data': { 'data-strips': 'int',
4545             'parity-strips': 'int' }}
4548 # @SheepdogRedundancy:
4550 # Since: 2.12
4552 { 'union': 'SheepdogRedundancy',
4553   'base': { 'type': 'SheepdogRedundancyType' },
4554   'discriminator': 'type',
4555   'data': { 'full': 'SheepdogRedundancyFull',
4556             'erasure-coded': 'SheepdogRedundancyErasureCoded' } }
4559 # @BlockdevCreateOptionsSheepdog:
4561 # Driver specific image creation options for Sheepdog.
4563 # @location: Where to store the new image file
4564 # @size: Size of the virtual disk in bytes
4565 # @backing-file: File name of a base image
4566 # @preallocation: Preallocation mode for the new image (default: off;
4567 #                 allowed values: off, full)
4568 # @redundancy: Redundancy of the image
4569 # @object-size: Object size of the image
4571 # Since: 2.12
4573 { 'struct': 'BlockdevCreateOptionsSheepdog',
4574   'data': { 'location':         'BlockdevOptionsSheepdog',
4575             'size':             'size',
4576             '*backing-file':    'str',
4577             '*preallocation':   'PreallocMode',
4578             '*redundancy':      'SheepdogRedundancy',
4579             '*object-size':     'size' } }
4582 # @BlockdevCreateOptionsSsh:
4584 # Driver specific image creation options for SSH.
4586 # @location: Where to store the new image file
4587 # @size: Size of the virtual disk in bytes
4589 # Since: 2.12
4591 { 'struct': 'BlockdevCreateOptionsSsh',
4592   'data': { 'location':         'BlockdevOptionsSsh',
4593             'size':             'size' } }
4596 # @BlockdevCreateOptionsVdi:
4598 # Driver specific image creation options for VDI.
4600 # @file: Node to create the image format on
4601 # @size: Size of the virtual disk in bytes
4602 # @preallocation: Preallocation mode for the new image (default: off;
4603 #                 allowed values: off, metadata)
4605 # Since: 2.12
4607 { 'struct': 'BlockdevCreateOptionsVdi',
4608   'data': { 'file':             'BlockdevRef',
4609             'size':             'size',
4610             '*preallocation':   'PreallocMode' } }
4613 # @BlockdevVhdxSubformat:
4615 # @dynamic: Growing image file
4616 # @fixed:   Preallocated fixed-size image file
4618 # Since: 2.12
4620 { 'enum': 'BlockdevVhdxSubformat',
4621   'data': [ 'dynamic', 'fixed' ] }
4624 # @BlockdevCreateOptionsVhdx:
4626 # Driver specific image creation options for vhdx.
4628 # @file: Node to create the image format on
4629 # @size: Size of the virtual disk in bytes
4630 # @log-size: Log size in bytes, must be a multiple of 1 MB
4631 #            (default: 1 MB)
4632 # @block-size: Block size in bytes, must be a multiple of 1 MB and not
4633 #              larger than 256 MB (default: automatically choose a block
4634 #              size depending on the image size)
4635 # @subformat: vhdx subformat (default: dynamic)
4636 # @block-state-zero: Force use of payload blocks of type 'ZERO'. Non-standard,
4637 #                    but default.  Do not set to 'off' when using 'qemu-img
4638 #                    convert' with subformat=dynamic.
4640 # Since: 2.12
4642 { 'struct': 'BlockdevCreateOptionsVhdx',
4643   'data': { 'file':                 'BlockdevRef',
4644             'size':                 'size',
4645             '*log-size':            'size',
4646             '*block-size':          'size',
4647             '*subformat':           'BlockdevVhdxSubformat',
4648             '*block-state-zero':    'bool' } }
4651 # @BlockdevVpcSubformat:
4653 # @dynamic: Growing image file
4654 # @fixed:   Preallocated fixed-size image file
4656 # Since: 2.12
4658 { 'enum': 'BlockdevVpcSubformat',
4659   'data': [ 'dynamic', 'fixed' ] }
4662 # @BlockdevCreateOptionsVpc:
4664 # Driver specific image creation options for vpc (VHD).
4666 # @file: Node to create the image format on
4667 # @size: Size of the virtual disk in bytes
4668 # @subformat: vhdx subformat (default: dynamic)
4669 # @force-size: Force use of the exact byte size instead of rounding to the
4670 #              next size that can be represented in CHS geometry
4671 #              (default: false)
4673 # Since: 2.12
4675 { 'struct': 'BlockdevCreateOptionsVpc',
4676   'data': { 'file':                 'BlockdevRef',
4677             'size':                 'size',
4678             '*subformat':           'BlockdevVpcSubformat',
4679             '*force-size':          'bool' } }
4682 # @BlockdevCreateOptions:
4684 # Options for creating an image format on a given node.
4686 # @driver: block driver to create the image format
4688 # Since: 2.12
4690 { 'union': 'BlockdevCreateOptions',
4691   'base': {
4692       'driver':         'BlockdevDriver' },
4693   'discriminator': 'driver',
4694   'data': {
4695       'file':           'BlockdevCreateOptionsFile',
4696       'gluster':        'BlockdevCreateOptionsGluster',
4697       'luks':           'BlockdevCreateOptionsLUKS',
4698       'nfs':            'BlockdevCreateOptionsNfs',
4699       'parallels':      'BlockdevCreateOptionsParallels',
4700       'qcow':           'BlockdevCreateOptionsQcow',
4701       'qcow2':          'BlockdevCreateOptionsQcow2',
4702       'qed':            'BlockdevCreateOptionsQed',
4703       'rbd':            'BlockdevCreateOptionsRbd',
4704       'sheepdog':       'BlockdevCreateOptionsSheepdog',
4705       'ssh':            'BlockdevCreateOptionsSsh',
4706       'vdi':            'BlockdevCreateOptionsVdi',
4707       'vhdx':           'BlockdevCreateOptionsVhdx',
4708       'vmdk':           'BlockdevCreateOptionsVmdk',
4709       'vpc':            'BlockdevCreateOptionsVpc'
4710   } }
4713 # @blockdev-create:
4715 # Starts a job to create an image format on a given node. The job is
4716 # automatically finalized, but a manual job-dismiss is required.
4718 # @job-id:          Identifier for the newly created job.
4720 # @options:         Options for the image creation.
4722 # Since: 3.0
4724 { 'command': 'blockdev-create',
4725   'data': { 'job-id': 'str',
4726             'options': 'BlockdevCreateOptions' } }
4729 # @BlockdevAmendOptionsLUKS:
4731 # Driver specific image amend options for LUKS.
4733 # Since: 5.1
4735 { 'struct': 'BlockdevAmendOptionsLUKS',
4736   'base': 'QCryptoBlockAmendOptionsLUKS',
4737   'data': { }
4741 # @BlockdevAmendOptionsQcow2:
4743 # Driver specific image amend options for qcow2.
4744 # For now, only encryption options can be amended
4746 # @encrypt          Encryption options to be amended
4748 # Since: 5.1
4750 { 'struct': 'BlockdevAmendOptionsQcow2',
4751   'data': { '*encrypt':         'QCryptoBlockAmendOptions' } }
4754 # @BlockdevAmendOptions:
4756 # Options for amending an image format
4758 # @driver:          Block driver of the node to amend.
4760 # Since: 5.1
4762 { 'union': 'BlockdevAmendOptions',
4763   'base': {
4764       'driver':         'BlockdevDriver' },
4765   'discriminator': 'driver',
4766   'data': {
4767       'luks':           'BlockdevAmendOptionsLUKS',
4768       'qcow2':          'BlockdevAmendOptionsQcow2' } }
4771 # @x-blockdev-amend:
4773 # Starts a job to amend format specific options of an existing open block device
4774 # The job is automatically finalized, but a manual job-dismiss is required.
4776 # @job-id:          Identifier for the newly created job.
4778 # @node-name:       Name of the block node to work on
4780 # @options:         Options (driver specific)
4782 # @force:           Allow unsafe operations, format specific
4783 #                   For luks that allows erase of the last active keyslot
4784 #                   (permanent loss of data),
4785 #                   and replacement of an active keyslot
4786 #                   (possible loss of data if IO error happens)
4788 # Since: 5.1
4790 { 'command': 'x-blockdev-amend',
4791   'data': { 'job-id': 'str',
4792             'node-name': 'str',
4793             'options': 'BlockdevAmendOptions',
4794             '*force': 'bool' } }
4797 # @BlockErrorAction:
4799 # An enumeration of action that has been taken when a DISK I/O occurs
4801 # @ignore: error has been ignored
4803 # @report: error has been reported to the device
4805 # @stop: error caused VM to be stopped
4807 # Since: 2.1
4809 { 'enum': 'BlockErrorAction',
4810   'data': [ 'ignore', 'report', 'stop' ] }
4814 # @BLOCK_IMAGE_CORRUPTED:
4816 # Emitted when a disk image is being marked corrupt. The image can be
4817 # identified by its device or node name. The 'device' field is always
4818 # present for compatibility reasons, but it can be empty ("") if the
4819 # image does not have a device name associated.
4821 # @device: device name. This is always present for compatibility
4822 #          reasons, but it can be empty ("") if the image does not
4823 #          have a device name associated.
4825 # @node-name: node name (Since: 2.4)
4827 # @msg: informative message for human consumption, such as the kind of
4828 #       corruption being detected. It should not be parsed by machine as it is
4829 #       not guaranteed to be stable
4831 # @offset: if the corruption resulted from an image access, this is
4832 #          the host's access offset into the image
4834 # @size: if the corruption resulted from an image access, this is
4835 #        the access size
4837 # @fatal: if set, the image is marked corrupt and therefore unusable after this
4838 #         event and must be repaired (Since 2.2; before, every
4839 #         BLOCK_IMAGE_CORRUPTED event was fatal)
4841 # Note: If action is "stop", a STOP event will eventually follow the
4842 #       BLOCK_IO_ERROR event.
4844 # Example:
4846 # <- { "event": "BLOCK_IMAGE_CORRUPTED",
4847 #      "data": { "device": "ide0-hd0", "node-name": "node0",
4848 #                "msg": "Prevented active L1 table overwrite", "offset": 196608,
4849 #                "size": 65536 },
4850 #      "timestamp": { "seconds": 1378126126, "microseconds": 966463 } }
4852 # Since: 1.7
4854 { 'event': 'BLOCK_IMAGE_CORRUPTED',
4855   'data': { 'device'     : 'str',
4856             '*node-name' : 'str',
4857             'msg'        : 'str',
4858             '*offset'    : 'int',
4859             '*size'      : 'int',
4860             'fatal'      : 'bool' } }
4863 # @BLOCK_IO_ERROR:
4865 # Emitted when a disk I/O error occurs
4867 # @device: device name. This is always present for compatibility
4868 #          reasons, but it can be empty ("") if the image does not
4869 #          have a device name associated.
4871 # @node-name: node name. Note that errors may be reported for the root node
4872 #             that is directly attached to a guest device rather than for the
4873 #             node where the error occurred. The node name is not present if
4874 #             the drive is empty. (Since: 2.8)
4876 # @operation: I/O operation
4878 # @action: action that has been taken
4880 # @nospace: true if I/O error was caused due to a no-space
4881 #           condition. This key is only present if query-block's
4882 #           io-status is present, please see query-block documentation
4883 #           for more information (since: 2.2)
4885 # @reason: human readable string describing the error cause.
4886 #          (This field is a debugging aid for humans, it should not
4887 #          be parsed by applications) (since: 2.2)
4889 # Note: If action is "stop", a STOP event will eventually follow the
4890 #       BLOCK_IO_ERROR event
4892 # Since: 0.13
4894 # Example:
4896 # <- { "event": "BLOCK_IO_ERROR",
4897 #      "data": { "device": "ide0-hd1",
4898 #                "node-name": "#block212",
4899 #                "operation": "write",
4900 #                "action": "stop" },
4901 #      "timestamp": { "seconds": 1265044230, "microseconds": 450486 } }
4904 { 'event': 'BLOCK_IO_ERROR',
4905   'data': { 'device': 'str', '*node-name': 'str',
4906             'operation': 'IoOperationType',
4907             'action': 'BlockErrorAction', '*nospace': 'bool',
4908             'reason': 'str' } }
4911 # @BLOCK_JOB_COMPLETED:
4913 # Emitted when a block job has completed
4915 # @type: job type
4917 # @device: The job identifier. Originally the device name but other
4918 #          values are allowed since QEMU 2.7
4920 # @len: maximum progress value
4922 # @offset: current progress value. On success this is equal to len.
4923 #          On failure this is less than len
4925 # @speed: rate limit, bytes per second
4927 # @error: error message. Only present on failure. This field
4928 #         contains a human-readable error message. There are no semantics
4929 #         other than that streaming has failed and clients should not try to
4930 #         interpret the error string
4932 # Since: 1.1
4934 # Example:
4936 # <- { "event": "BLOCK_JOB_COMPLETED",
4937 #      "data": { "type": "stream", "device": "virtio-disk0",
4938 #                "len": 10737418240, "offset": 10737418240,
4939 #                "speed": 0 },
4940 #      "timestamp": { "seconds": 1267061043, "microseconds": 959568 } }
4943 { 'event': 'BLOCK_JOB_COMPLETED',
4944   'data': { 'type'  : 'JobType',
4945             'device': 'str',
4946             'len'   : 'int',
4947             'offset': 'int',
4948             'speed' : 'int',
4949             '*error': 'str' } }
4952 # @BLOCK_JOB_CANCELLED:
4954 # Emitted when a block job has been cancelled
4956 # @type: job type
4958 # @device: The job identifier. Originally the device name but other
4959 #          values are allowed since QEMU 2.7
4961 # @len: maximum progress value
4963 # @offset: current progress value. On success this is equal to len.
4964 #          On failure this is less than len
4966 # @speed: rate limit, bytes per second
4968 # Since: 1.1
4970 # Example:
4972 # <- { "event": "BLOCK_JOB_CANCELLED",
4973 #      "data": { "type": "stream", "device": "virtio-disk0",
4974 #                "len": 10737418240, "offset": 134217728,
4975 #                "speed": 0 },
4976 #      "timestamp": { "seconds": 1267061043, "microseconds": 959568 } }
4979 { 'event': 'BLOCK_JOB_CANCELLED',
4980   'data': { 'type'  : 'JobType',
4981             'device': 'str',
4982             'len'   : 'int',
4983             'offset': 'int',
4984             'speed' : 'int' } }
4987 # @BLOCK_JOB_ERROR:
4989 # Emitted when a block job encounters an error
4991 # @device: The job identifier. Originally the device name but other
4992 #          values are allowed since QEMU 2.7
4994 # @operation: I/O operation
4996 # @action: action that has been taken
4998 # Since: 1.3
5000 # Example:
5002 # <- { "event": "BLOCK_JOB_ERROR",
5003 #      "data": { "device": "ide0-hd1",
5004 #                "operation": "write",
5005 #                "action": "stop" },
5006 #      "timestamp": { "seconds": 1265044230, "microseconds": 450486 } }
5009 { 'event': 'BLOCK_JOB_ERROR',
5010   'data': { 'device'   : 'str',
5011             'operation': 'IoOperationType',
5012             'action'   : 'BlockErrorAction' } }
5015 # @BLOCK_JOB_READY:
5017 # Emitted when a block job is ready to complete
5019 # @type: job type
5021 # @device: The job identifier. Originally the device name but other
5022 #          values are allowed since QEMU 2.7
5024 # @len: maximum progress value
5026 # @offset: current progress value. On success this is equal to len.
5027 #          On failure this is less than len
5029 # @speed: rate limit, bytes per second
5031 # Note: The "ready to complete" status is always reset by a @BLOCK_JOB_ERROR
5032 #       event
5034 # Since: 1.3
5036 # Example:
5038 # <- { "event": "BLOCK_JOB_READY",
5039 #      "data": { "device": "drive0", "type": "mirror", "speed": 0,
5040 #                "len": 2097152, "offset": 2097152 }
5041 #      "timestamp": { "seconds": 1265044230, "microseconds": 450486 } }
5044 { 'event': 'BLOCK_JOB_READY',
5045   'data': { 'type'  : 'JobType',
5046             'device': 'str',
5047             'len'   : 'int',
5048             'offset': 'int',
5049             'speed' : 'int' } }
5052 # @BLOCK_JOB_PENDING:
5054 # Emitted when a block job is awaiting explicit authorization to finalize graph
5055 # changes via @block-job-finalize. If this job is part of a transaction, it will
5056 # not emit this event until the transaction has converged first.
5058 # @type: job type
5060 # @id: The job identifier.
5062 # Since: 2.12
5064 # Example:
5066 # <- { "event": "BLOCK_JOB_WAITING",
5067 #      "data": { "device": "drive0", "type": "mirror" },
5068 #      "timestamp": { "seconds": 1265044230, "microseconds": 450486 } }
5071 { 'event': 'BLOCK_JOB_PENDING',
5072   'data': { 'type'  : 'JobType',
5073             'id'    : 'str' } }
5076 # @PreallocMode:
5078 # Preallocation mode of QEMU image file
5080 # @off: no preallocation
5081 # @metadata: preallocate only for metadata
5082 # @falloc: like @full preallocation but allocate disk space by
5083 #          posix_fallocate() rather than writing data.
5084 # @full: preallocate all data by writing it to the device to ensure
5085 #        disk space is really available. This data may or may not be
5086 #        zero, depending on the image format and storage.
5087 #        @full preallocation also sets up metadata correctly.
5089 # Since: 2.2
5091 { 'enum': 'PreallocMode',
5092   'data': [ 'off', 'metadata', 'falloc', 'full' ] }
5095 # @BLOCK_WRITE_THRESHOLD:
5097 # Emitted when writes on block device reaches or exceeds the
5098 # configured write threshold. For thin-provisioned devices, this
5099 # means the device should be extended to avoid pausing for
5100 # disk exhaustion.
5101 # The event is one shot. Once triggered, it needs to be
5102 # re-registered with another block-set-write-threshold command.
5104 # @node-name: graph node name on which the threshold was exceeded.
5106 # @amount-exceeded: amount of data which exceeded the threshold, in bytes.
5108 # @write-threshold: last configured threshold, in bytes.
5110 # Since: 2.3
5112 { 'event': 'BLOCK_WRITE_THRESHOLD',
5113   'data': { 'node-name': 'str',
5114             'amount-exceeded': 'uint64',
5115             'write-threshold': 'uint64' } }
5118 # @block-set-write-threshold:
5120 # Change the write threshold for a block drive. An event will be
5121 # delivered if a write to this block drive crosses the configured
5122 # threshold.  The threshold is an offset, thus must be
5123 # non-negative. Default is no write threshold. Setting the threshold
5124 # to zero disables it.
5126 # This is useful to transparently resize thin-provisioned drives without
5127 # the guest OS noticing.
5129 # @node-name: graph node name on which the threshold must be set.
5131 # @write-threshold: configured threshold for the block device, bytes.
5132 #                   Use 0 to disable the threshold.
5134 # Since: 2.3
5136 # Example:
5138 # -> { "execute": "block-set-write-threshold",
5139 #      "arguments": { "node-name": "mydev",
5140 #                     "write-threshold": 17179869184 } }
5141 # <- { "return": {} }
5144 { 'command': 'block-set-write-threshold',
5145   'data': { 'node-name': 'str', 'write-threshold': 'uint64' } }
5148 # @x-blockdev-change:
5150 # Dynamically reconfigure the block driver state graph. It can be used
5151 # to add, remove, insert or replace a graph node. Currently only the
5152 # Quorum driver implements this feature to add or remove its child. This
5153 # is useful to fix a broken quorum child.
5155 # If @node is specified, it will be inserted under @parent. @child
5156 # may not be specified in this case. If both @parent and @child are
5157 # specified but @node is not, @child will be detached from @parent.
5159 # @parent: the id or name of the parent node.
5161 # @child: the name of a child under the given parent node.
5163 # @node: the name of the node that will be added.
5165 # Note: this command is experimental, and its API is not stable. It
5166 #       does not support all kinds of operations, all kinds of children, nor
5167 #       all block drivers.
5169 #       FIXME Removing children from a quorum node means introducing gaps in the
5170 #       child indices. This cannot be represented in the 'children' list of
5171 #       BlockdevOptionsQuorum, as returned by .bdrv_refresh_filename().
5173 #       Warning: The data in a new quorum child MUST be consistent with that of
5174 #       the rest of the array.
5176 # Since: 2.7
5178 # Example:
5180 # 1. Add a new node to a quorum
5181 # -> { "execute": "blockdev-add",
5182 #      "arguments": {
5183 #          "driver": "raw",
5184 #          "node-name": "new_node",
5185 #          "file": { "driver": "file",
5186 #                    "filename": "test.raw" } } }
5187 # <- { "return": {} }
5188 # -> { "execute": "x-blockdev-change",
5189 #      "arguments": { "parent": "disk1",
5190 #                     "node": "new_node" } }
5191 # <- { "return": {} }
5193 # 2. Delete a quorum's node
5194 # -> { "execute": "x-blockdev-change",
5195 #      "arguments": { "parent": "disk1",
5196 #                     "child": "children.1" } }
5197 # <- { "return": {} }
5200 { 'command': 'x-blockdev-change',
5201   'data' : { 'parent': 'str',
5202              '*child': 'str',
5203              '*node': 'str' } }
5206 # @x-blockdev-set-iothread:
5208 # Move @node and its children into the @iothread.  If @iothread is null then
5209 # move @node and its children into the main loop.
5211 # The node must not be attached to a BlockBackend.
5213 # @node-name: the name of the block driver node
5215 # @iothread: the name of the IOThread object or null for the main loop
5217 # @force: true if the node and its children should be moved when a BlockBackend
5218 #         is already attached
5220 # Note: this command is experimental and intended for test cases that need
5221 #       control over IOThreads only.
5223 # Since: 2.12
5225 # Example:
5227 # 1. Move a node into an IOThread
5228 # -> { "execute": "x-blockdev-set-iothread",
5229 #      "arguments": { "node-name": "disk1",
5230 #                     "iothread": "iothread0" } }
5231 # <- { "return": {} }
5233 # 2. Move a node into the main loop
5234 # -> { "execute": "x-blockdev-set-iothread",
5235 #      "arguments": { "node-name": "disk1",
5236 #                     "iothread": null } }
5237 # <- { "return": {} }
5240 { 'command': 'x-blockdev-set-iothread',
5241   'data' : { 'node-name': 'str',
5242              'iothread': 'StrOrNull',
5243              '*force': 'bool' } }
5246 # @QuorumOpType:
5248 # An enumeration of the quorum operation types
5250 # @read: read operation
5252 # @write: write operation
5254 # @flush: flush operation
5256 # Since: 2.6
5258 { 'enum': 'QuorumOpType',
5259   'data': [ 'read', 'write', 'flush' ] }
5262 # @QUORUM_FAILURE:
5264 # Emitted by the Quorum block driver if it fails to establish a quorum
5266 # @reference: device name if defined else node name
5268 # @sector-num: number of the first sector of the failed read operation
5270 # @sectors-count: failed read operation sector count
5272 # Note: This event is rate-limited.
5274 # Since: 2.0
5276 # Example:
5278 # <- { "event": "QUORUM_FAILURE",
5279 #      "data": { "reference": "usr1", "sector-num": 345435, "sectors-count": 5 },
5280 #      "timestamp": { "seconds": 1344522075, "microseconds": 745528 } }
5283 { 'event': 'QUORUM_FAILURE',
5284   'data': { 'reference': 'str', 'sector-num': 'int', 'sectors-count': 'int' } }
5287 # @QUORUM_REPORT_BAD:
5289 # Emitted to report a corruption of a Quorum file
5291 # @type: quorum operation type (Since 2.6)
5293 # @error: error message. Only present on failure. This field
5294 #         contains a human-readable error message. There are no semantics other
5295 #         than that the block layer reported an error and clients should not
5296 #         try to interpret the error string.
5298 # @node-name: the graph node name of the block driver state
5300 # @sector-num: number of the first sector of the failed read operation
5302 # @sectors-count: failed read operation sector count
5304 # Note: This event is rate-limited.
5306 # Since: 2.0
5308 # Example:
5310 # 1. Read operation
5312 # { "event": "QUORUM_REPORT_BAD",
5313 #      "data": { "node-name": "node0", "sector-num": 345435, "sectors-count": 5,
5314 #                "type": "read" },
5315 #      "timestamp": { "seconds": 1344522075, "microseconds": 745528 } }
5317 # 2. Flush operation
5319 # { "event": "QUORUM_REPORT_BAD",
5320 #      "data": { "node-name": "node0", "sector-num": 0, "sectors-count": 2097120,
5321 #                "type": "flush", "error": "Broken pipe" },
5322 #      "timestamp": { "seconds": 1456406829, "microseconds": 291763 } }
5325 { 'event': 'QUORUM_REPORT_BAD',
5326   'data': { 'type': 'QuorumOpType', '*error': 'str', 'node-name': 'str',
5327             'sector-num': 'int', 'sectors-count': 'int' } }
5330 # @BlockdevSnapshotInternal:
5332 # @device: the device name or node-name of a root node to generate the snapshot
5333 #          from
5335 # @name: the name of the internal snapshot to be created
5337 # Notes: In transaction, if @name is empty, or any snapshot matching @name
5338 #        exists, the operation will fail. Only some image formats support it,
5339 #        for example, qcow2, rbd, and sheepdog.
5341 # Since: 1.7
5343 { 'struct': 'BlockdevSnapshotInternal',
5344   'data': { 'device': 'str', 'name': 'str' } }
5347 # @blockdev-snapshot-internal-sync:
5349 # Synchronously take an internal snapshot of a block device, when the
5350 # format of the image used supports it. If the name is an empty
5351 # string, or a snapshot with name already exists, the operation will
5352 # fail.
5354 # For the arguments, see the documentation of BlockdevSnapshotInternal.
5356 # Returns: - nothing on success
5357 #          - If @device is not a valid block device, GenericError
5358 #          - If any snapshot matching @name exists, or @name is empty,
5359 #            GenericError
5360 #          - If the format of the image used does not support it,
5361 #            BlockFormatFeatureNotSupported
5363 # Since: 1.7
5365 # Example:
5367 # -> { "execute": "blockdev-snapshot-internal-sync",
5368 #      "arguments": { "device": "ide-hd0",
5369 #                     "name": "snapshot0" }
5370 #    }
5371 # <- { "return": {} }
5374 { 'command': 'blockdev-snapshot-internal-sync',
5375   'data': 'BlockdevSnapshotInternal' }
5378 # @blockdev-snapshot-delete-internal-sync:
5380 # Synchronously delete an internal snapshot of a block device, when the format
5381 # of the image used support it. The snapshot is identified by name or id or
5382 # both. One of the name or id is required. Return SnapshotInfo for the
5383 # successfully deleted snapshot.
5385 # @device: the device name or node-name of a root node to delete the snapshot
5386 #          from
5388 # @id: optional the snapshot's ID to be deleted
5390 # @name: optional the snapshot's name to be deleted
5392 # Returns: - SnapshotInfo on success
5393 #          - If @device is not a valid block device, GenericError
5394 #          - If snapshot not found, GenericError
5395 #          - If the format of the image used does not support it,
5396 #            BlockFormatFeatureNotSupported
5397 #          - If @id and @name are both not specified, GenericError
5399 # Since: 1.7
5401 # Example:
5403 # -> { "execute": "blockdev-snapshot-delete-internal-sync",
5404 #      "arguments": { "device": "ide-hd0",
5405 #                     "name": "snapshot0" }
5406 #    }
5407 # <- { "return": {
5408 #                    "id": "1",
5409 #                    "name": "snapshot0",
5410 #                    "vm-state-size": 0,
5411 #                    "date-sec": 1000012,
5412 #                    "date-nsec": 10,
5413 #                    "vm-clock-sec": 100,
5414 #                    "vm-clock-nsec": 20,
5415 #                    "icount": 220414
5416 #      }
5417 #    }
5420 { 'command': 'blockdev-snapshot-delete-internal-sync',
5421   'data': { 'device': 'str', '*id': 'str', '*name': 'str'},
5422   'returns': 'SnapshotInfo' }