xref: /openbmc/qemu/qapi/block-core.json (revision 3908b7a8)
1# -*- Mode: Python -*-
2# vim: filetype=python
3
4##
5# == Block core (VM unrelated)
6##
7
8{ 'include': 'common.json' }
9{ 'include': 'crypto.json' }
10{ 'include': 'job.json' }
11{ 'include': 'sockets.json' }
12
13##
14# @SnapshotInfo:
15#
16# @id: unique snapshot id
17#
18# @name: user chosen name
19#
20# @vm-state-size: size of the VM state
21#
22# @date-sec: UTC date of the snapshot in seconds
23#
24# @date-nsec: fractional part in nano seconds to be used with date-sec
25#
26# @vm-clock-sec: VM clock relative to boot in seconds
27#
28# @vm-clock-nsec: fractional part in nano seconds to be used with vm-clock-sec
29#
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)
34#
35# Since: 1.3
36#
37##
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' } }
43
44##
45# @ImageInfoSpecificQCow2EncryptionBase:
46#
47# @format: The encryption format
48#
49# Since: 2.10
50##
51{ 'struct': 'ImageInfoSpecificQCow2EncryptionBase',
52  'data': { 'format': 'BlockdevQcow2EncryptionFormat'}}
53
54##
55# @ImageInfoSpecificQCow2Encryption:
56#
57# Since: 2.10
58##
59{ 'union': 'ImageInfoSpecificQCow2Encryption',
60  'base': 'ImageInfoSpecificQCow2EncryptionBase',
61  'discriminator': 'format',
62  'data': { 'luks': 'QCryptoBlockInfoLUKS' } }
63
64##
65# @ImageInfoSpecificQCow2:
66#
67# @compat: compatibility level
68#
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)
71#
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)
75#
76# @extended-l2: true if the image has extended L2 entries; only valid for
77#               compat >= 1.1 (since 5.2)
78#
79# @lazy-refcounts: on or off; only valid for compat >= 1.1
80#
81# @corrupt: true if the image has been marked corrupt; only valid for
82#           compat >= 1.1 (since 2.2)
83#
84# @refcount-bits: width of a refcount entry in bits (since 2.3)
85#
86# @encrypt: details about encryption parameters; only set if image
87#           is encrypted (since 2.10)
88#
89# @bitmaps: A list of qcow2 bitmap details (since 4.0)
90#
91# @compression-type: the image cluster compression method (since 5.1)
92#
93# Since: 1.7
94##
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  } }
108
109##
110# @ImageInfoSpecificVmdk:
111#
112# @create-type: The create type of VMDK image
113#
114# @cid: Content id of image
115#
116# @parent-cid: Parent VMDK image's cid
117#
118# @extents: List of extent files
119#
120# Since: 1.7
121##
122{ 'struct': 'ImageInfoSpecificVmdk',
123  'data': {
124      'create-type': 'str',
125      'cid': 'int',
126      'parent-cid': 'int',
127      'extents': ['ImageInfo']
128  } }
129
130##
131# @ImageInfoSpecificRbd:
132#
133# @encryption-format: Image encryption format
134#
135# Since: 6.1
136##
137{ 'struct': 'ImageInfoSpecificRbd',
138  'data': {
139      '*encryption-format': 'RbdImageEncryptionFormat'
140  } }
141
142##
143# @ImageInfoSpecific:
144#
145# A discriminated record of image format specific information structures.
146#
147# Since: 1.7
148##
149{ 'union': 'ImageInfoSpecific',
150  'data': {
151      'qcow2': 'ImageInfoSpecificQCow2',
152      'vmdk': 'ImageInfoSpecificVmdk',
153      # If we need to add block driver specific parameters for
154      # LUKS in future, then we'll subclass QCryptoBlockInfoLUKS
155      # to define a ImageInfoSpecificLUKS
156      'luks': 'QCryptoBlockInfoLUKS',
157      'rbd': 'ImageInfoSpecificRbd'
158  } }
159
160##
161# @ImageInfo:
162#
163# Information about a QEMU image file
164#
165# @filename: name of the image file
166#
167# @format: format of the image file
168#
169# @virtual-size: maximum capacity in bytes of the image
170#
171# @actual-size: actual size on disk in bytes of the image
172#
173# @dirty-flag: true if image is not cleanly closed
174#
175# @cluster-size: size of a cluster in bytes
176#
177# @encrypted: true if the image is encrypted
178#
179# @compressed: true if the image is compressed (Since 1.7)
180#
181# @backing-filename: name of the backing file
182#
183# @full-backing-filename: full path of the backing file
184#
185# @backing-filename-format: the format of the backing file
186#
187# @snapshots: list of VM snapshots
188#
189# @backing-image: info of the backing image (since 1.6)
190#
191# @format-specific: structure supplying additional format-specific
192#                   information (since 1.7)
193#
194# Since: 1.3
195#
196##
197{ 'struct': 'ImageInfo',
198  'data': {'filename': 'str', 'format': 'str', '*dirty-flag': 'bool',
199           '*actual-size': 'int', 'virtual-size': 'int',
200           '*cluster-size': 'int', '*encrypted': 'bool', '*compressed': 'bool',
201           '*backing-filename': 'str', '*full-backing-filename': 'str',
202           '*backing-filename-format': 'str', '*snapshots': ['SnapshotInfo'],
203           '*backing-image': 'ImageInfo',
204           '*format-specific': 'ImageInfoSpecific' } }
205
206##
207# @ImageCheck:
208#
209# Information about a QEMU image file check
210#
211# @filename: name of the image file checked
212#
213# @format: format of the image file checked
214#
215# @check-errors: number of unexpected errors occurred during check
216#
217# @image-end-offset: offset (in bytes) where the image ends, this
218#                    field is present if the driver for the image format
219#                    supports it
220#
221# @corruptions: number of corruptions found during the check if any
222#
223# @leaks: number of leaks found during the check if any
224#
225# @corruptions-fixed: number of corruptions fixed during the check
226#                     if any
227#
228# @leaks-fixed: number of leaks fixed during the check if any
229#
230# @total-clusters: total number of clusters, this field is present
231#                  if the driver for the image format supports it
232#
233# @allocated-clusters: total number of allocated clusters, this
234#                      field is present if the driver for the image format
235#                      supports it
236#
237# @fragmented-clusters: total number of fragmented clusters, this
238#                       field is present if the driver for the image format
239#                       supports it
240#
241# @compressed-clusters: total number of compressed clusters, this
242#                       field is present if the driver for the image format
243#                       supports it
244#
245# Since: 1.4
246#
247##
248{ 'struct': 'ImageCheck',
249  'data': {'filename': 'str', 'format': 'str', 'check-errors': 'int',
250           '*image-end-offset': 'int', '*corruptions': 'int', '*leaks': 'int',
251           '*corruptions-fixed': 'int', '*leaks-fixed': 'int',
252           '*total-clusters': 'int', '*allocated-clusters': 'int',
253           '*fragmented-clusters': 'int', '*compressed-clusters': 'int' } }
254
255##
256# @MapEntry:
257#
258# Mapping information from a virtual block range to a host file range
259#
260# @start: virtual (guest) offset of the first byte described by this
261#         entry
262#
263# @length: the number of bytes of the mapped virtual range
264#
265# @data: reading the image will actually read data from a file (in
266#        particular, if @offset is present this means that the sectors
267#        are not simply preallocated, but contain actual data in raw
268#        format)
269#
270# @zero: whether the virtual blocks read as zeroes
271#
272# @depth: number of layers (0 = top image, 1 = top image's backing
273#         file, ..., n - 1 = bottom image (where n is the number of
274#         images in the chain)) before reaching one for which the
275#         range is allocated
276#
277# @offset: if present, the image file stores the data for this range
278#          in raw format at the given (host) offset
279#
280# @filename: filename that is referred to by @offset
281#
282# Since: 2.6
283#
284##
285{ 'struct': 'MapEntry',
286  'data': {'start': 'int', 'length': 'int', 'data': 'bool',
287           'zero': 'bool', 'depth': 'int', '*offset': 'int',
288           '*filename': 'str' } }
289
290##
291# @BlockdevCacheInfo:
292#
293# Cache mode information for a block device
294#
295# @writeback:   true if writeback mode is enabled
296# @direct:      true if the host page cache is bypassed (O_DIRECT)
297# @no-flush:    true if flush requests are ignored for the device
298#
299# Since: 2.3
300##
301{ 'struct': 'BlockdevCacheInfo',
302  'data': { 'writeback': 'bool',
303            'direct': 'bool',
304            'no-flush': 'bool' } }
305
306##
307# @BlockDeviceInfo:
308#
309# Information about the backing device for a block device.
310#
311# @file: the filename of the backing device
312#
313# @node-name: the name of the block driver node (Since 2.0)
314#
315# @ro: true if the backing device was open read-only
316#
317# @drv: the name of the block format used to open the backing device. As of
318#       0.14 this can be: 'blkdebug', 'bochs', 'cloop', 'cow', 'dmg',
319#       'file', 'file', 'ftp', 'ftps', 'host_cdrom', 'host_device',
320#       'http', 'https', 'luks', 'nbd', 'parallels', 'qcow',
321#       'qcow2', 'raw', 'vdi', 'vmdk', 'vpc', 'vvfat'
322#       2.2: 'archipelago' added, 'cow' dropped
323#       2.3: 'host_floppy' deprecated
324#       2.5: 'host_floppy' dropped
325#       2.6: 'luks' added
326#       2.8: 'replication' added, 'tftp' dropped
327#       2.9: 'archipelago' dropped
328#
329# @backing_file: the name of the backing file (for copy-on-write)
330#
331# @backing_file_depth: number of files in the backing file chain (since: 1.2)
332#
333# @encrypted: true if the backing device is encrypted
334#
335# @detect_zeroes: detect and optimize zero writes (Since 2.1)
336#
337# @bps: total throughput limit in bytes per second is specified
338#
339# @bps_rd: read throughput limit in bytes per second is specified
340#
341# @bps_wr: write throughput limit in bytes per second is specified
342#
343# @iops: total I/O operations per second is specified
344#
345# @iops_rd: read I/O operations per second is specified
346#
347# @iops_wr: write I/O operations per second is specified
348#
349# @image: the info of image used (since: 1.6)
350#
351# @bps_max: total throughput limit during bursts,
352#                     in bytes (Since 1.7)
353#
354# @bps_rd_max: read throughput limit during bursts,
355#                        in bytes (Since 1.7)
356#
357# @bps_wr_max: write throughput limit during bursts,
358#                        in bytes (Since 1.7)
359#
360# @iops_max: total I/O operations per second during bursts,
361#                      in bytes (Since 1.7)
362#
363# @iops_rd_max: read I/O operations per second during bursts,
364#                         in bytes (Since 1.7)
365#
366# @iops_wr_max: write I/O operations per second during bursts,
367#                         in bytes (Since 1.7)
368#
369# @bps_max_length: maximum length of the @bps_max burst
370#                            period, in seconds. (Since 2.6)
371#
372# @bps_rd_max_length: maximum length of the @bps_rd_max
373#                               burst period, in seconds. (Since 2.6)
374#
375# @bps_wr_max_length: maximum length of the @bps_wr_max
376#                               burst period, in seconds. (Since 2.6)
377#
378# @iops_max_length: maximum length of the @iops burst
379#                             period, in seconds. (Since 2.6)
380#
381# @iops_rd_max_length: maximum length of the @iops_rd_max
382#                                burst period, in seconds. (Since 2.6)
383#
384# @iops_wr_max_length: maximum length of the @iops_wr_max
385#                                burst period, in seconds. (Since 2.6)
386#
387# @iops_size: an I/O size in bytes (Since 1.7)
388#
389# @group: throttle group name (Since 2.4)
390#
391# @cache: the cache mode used for the block device (since: 2.3)
392#
393# @write_threshold: configured write threshold for the device.
394#                   0 if disabled. (Since 2.3)
395#
396# @dirty-bitmaps: dirty bitmaps information (only present if node
397#                 has one or more dirty bitmaps) (Since 4.2)
398#
399# Since: 0.14
400#
401##
402{ 'struct': 'BlockDeviceInfo',
403  'data': { 'file': 'str', '*node-name': 'str', 'ro': 'bool', 'drv': 'str',
404            '*backing_file': 'str', 'backing_file_depth': 'int',
405            'encrypted': 'bool',
406            'detect_zeroes': 'BlockdevDetectZeroesOptions',
407            'bps': 'int', 'bps_rd': 'int', 'bps_wr': 'int',
408            'iops': 'int', 'iops_rd': 'int', 'iops_wr': 'int',
409            'image': 'ImageInfo',
410            '*bps_max': 'int', '*bps_rd_max': 'int',
411            '*bps_wr_max': 'int', '*iops_max': 'int',
412            '*iops_rd_max': 'int', '*iops_wr_max': 'int',
413            '*bps_max_length': 'int', '*bps_rd_max_length': 'int',
414            '*bps_wr_max_length': 'int', '*iops_max_length': 'int',
415            '*iops_rd_max_length': 'int', '*iops_wr_max_length': 'int',
416            '*iops_size': 'int', '*group': 'str', 'cache': 'BlockdevCacheInfo',
417            'write_threshold': 'int', '*dirty-bitmaps': ['BlockDirtyInfo'] } }
418
419##
420# @BlockDeviceIoStatus:
421#
422# An enumeration of block device I/O status.
423#
424# @ok: The last I/O operation has succeeded
425#
426# @failed: The last I/O operation has failed
427#
428# @nospace: The last I/O operation has failed due to a no-space condition
429#
430# Since: 1.0
431##
432{ 'enum': 'BlockDeviceIoStatus', 'data': [ 'ok', 'failed', 'nospace' ] }
433
434##
435# @BlockDirtyInfo:
436#
437# Block dirty bitmap information.
438#
439# @name: the name of the dirty bitmap (Since 2.4)
440#
441# @count: number of dirty bytes according to the dirty bitmap
442#
443# @granularity: granularity of the dirty bitmap in bytes (since 1.4)
444#
445# @recording: true if the bitmap is recording new writes from the guest.
446#             Replaces `active` and `disabled` statuses. (since 4.0)
447#
448# @busy: true if the bitmap is in-use by some operation (NBD or jobs)
449#        and cannot be modified via QMP or used by another operation.
450#        Replaces `locked` and `frozen` statuses. (since 4.0)
451#
452# @persistent: true if the bitmap was stored on disk, is scheduled to be stored
453#              on disk, or both. (since 4.0)
454#
455# @inconsistent: true if this is a persistent bitmap that was improperly
456#                stored. Implies @persistent to be true; @recording and
457#                @busy to be false. This bitmap cannot be used. To remove
458#                it, use @block-dirty-bitmap-remove. (Since 4.0)
459#
460# Since: 1.3
461##
462{ 'struct': 'BlockDirtyInfo',
463  'data': {'*name': 'str', 'count': 'int', 'granularity': 'uint32',
464           'recording': 'bool', 'busy': 'bool',
465           'persistent': 'bool', '*inconsistent': 'bool' } }
466
467##
468# @Qcow2BitmapInfoFlags:
469#
470# An enumeration of flags that a bitmap can report to the user.
471#
472# @in-use: This flag is set by any process actively modifying the qcow2 file,
473#          and cleared when the updated bitmap is flushed to the qcow2 image.
474#          The presence of this flag in an offline image means that the bitmap
475#          was not saved correctly after its last usage, and may contain
476#          inconsistent data.
477#
478# @auto: The bitmap must reflect all changes of the virtual disk by any
479#        application that would write to this qcow2 file.
480#
481# Since: 4.0
482##
483{ 'enum': 'Qcow2BitmapInfoFlags',
484  'data': ['in-use', 'auto'] }
485
486##
487# @Qcow2BitmapInfo:
488#
489# Qcow2 bitmap information.
490#
491# @name: the name of the bitmap
492#
493# @granularity: granularity of the bitmap in bytes
494#
495# @flags: flags of the bitmap
496#
497# Since: 4.0
498##
499{ 'struct': 'Qcow2BitmapInfo',
500  'data': {'name': 'str', 'granularity': 'uint32',
501           'flags': ['Qcow2BitmapInfoFlags'] } }
502
503##
504# @BlockLatencyHistogramInfo:
505#
506# Block latency histogram.
507#
508# @boundaries: list of interval boundary values in nanoseconds, all greater
509#              than zero and in ascending order.
510#              For example, the list [10, 50, 100] produces the following
511#              histogram intervals: [0, 10), [10, 50), [50, 100), [100, +inf).
512#
513# @bins: list of io request counts corresponding to histogram intervals.
514#        len(@bins) = len(@boundaries) + 1
515#        For the example above, @bins may be something like [3, 1, 5, 2],
516#        and corresponding histogram looks like:
517#
518# ::
519#
520#        5|           *
521#        4|           *
522#        3| *         *
523#        2| *         *    *
524#        1| *    *    *    *
525#         +------------------
526#             10   50   100
527#
528# Since: 4.0
529##
530{ 'struct': 'BlockLatencyHistogramInfo',
531  'data': {'boundaries': ['uint64'], 'bins': ['uint64'] } }
532
533##
534# @BlockInfo:
535#
536# Block device information.  This structure describes a virtual device and
537# the backing device associated with it.
538#
539# @device: The device name associated with the virtual device.
540#
541# @qdev: The qdev ID, or if no ID is assigned, the QOM path of the block
542#        device. (since 2.10)
543#
544# @type: This field is returned only for compatibility reasons, it should
545#        not be used (always returns 'unknown')
546#
547# @removable: True if the device supports removable media.
548#
549# @locked: True if the guest has locked this device from having its media
550#          removed
551#
552# @tray_open: True if the device's tray is open
553#             (only present if it has a tray)
554#
555# @io-status: @BlockDeviceIoStatus. Only present if the device
556#             supports it and the VM is configured to stop on errors
557#             (supported device models: virtio-blk, IDE, SCSI except
558#             scsi-generic)
559#
560# @inserted: @BlockDeviceInfo describing the device if media is
561#            present
562#
563# Since:  0.14
564##
565{ 'struct': 'BlockInfo',
566  'data': {'device': 'str', '*qdev': 'str', 'type': 'str', 'removable': 'bool',
567           'locked': 'bool', '*inserted': 'BlockDeviceInfo',
568           '*tray_open': 'bool', '*io-status': 'BlockDeviceIoStatus' } }
569
570##
571# @BlockMeasureInfo:
572#
573# Image file size calculation information.  This structure describes the size
574# requirements for creating a new image file.
575#
576# The size requirements depend on the new image file format.  File size always
577# equals virtual disk size for the 'raw' format, even for sparse POSIX files.
578# Compact formats such as 'qcow2' represent unallocated and zero regions
579# efficiently so file size may be smaller than virtual disk size.
580#
581# The values are upper bounds that are guaranteed to fit the new image file.
582# Subsequent modification, such as internal snapshot or further bitmap
583# creation, may require additional space and is not covered here.
584#
585# @required: Size required for a new image file, in bytes, when copying just
586#            allocated guest-visible contents.
587#
588# @fully-allocated: Image file size, in bytes, once data has been written
589#                   to all sectors, when copying just guest-visible contents.
590#
591# @bitmaps: Additional size required if all the top-level bitmap metadata
592#           in the source image were to be copied to the destination,
593#           present only when source and destination both support
594#           persistent bitmaps. (since 5.1)
595#
596# Since: 2.10
597##
598{ 'struct': 'BlockMeasureInfo',
599  'data': {'required': 'int', 'fully-allocated': 'int', '*bitmaps': 'int'} }
600
601##
602# @query-block:
603#
604# Get a list of BlockInfo for all virtual block devices.
605#
606# Returns: a list of @BlockInfo describing each virtual block device. Filter
607#          nodes that were created implicitly are skipped over.
608#
609# Since: 0.14
610#
611# Example:
612#
613# -> { "execute": "query-block" }
614# <- {
615#       "return":[
616#          {
617#             "io-status": "ok",
618#             "device":"ide0-hd0",
619#             "locked":false,
620#             "removable":false,
621#             "inserted":{
622#                "ro":false,
623#                "drv":"qcow2",
624#                "encrypted":false,
625#                "file":"disks/test.qcow2",
626#                "backing_file_depth":1,
627#                "bps":1000000,
628#                "bps_rd":0,
629#                "bps_wr":0,
630#                "iops":1000000,
631#                "iops_rd":0,
632#                "iops_wr":0,
633#                "bps_max": 8000000,
634#                "bps_rd_max": 0,
635#                "bps_wr_max": 0,
636#                "iops_max": 0,
637#                "iops_rd_max": 0,
638#                "iops_wr_max": 0,
639#                "iops_size": 0,
640#                "detect_zeroes": "on",
641#                "write_threshold": 0,
642#                "image":{
643#                   "filename":"disks/test.qcow2",
644#                   "format":"qcow2",
645#                   "virtual-size":2048000,
646#                   "backing_file":"base.qcow2",
647#                   "full-backing-filename":"disks/base.qcow2",
648#                   "backing-filename-format":"qcow2",
649#                   "snapshots":[
650#                      {
651#                         "id": "1",
652#                         "name": "snapshot1",
653#                         "vm-state-size": 0,
654#                         "date-sec": 10000200,
655#                         "date-nsec": 12,
656#                         "vm-clock-sec": 206,
657#                         "vm-clock-nsec": 30
658#                      }
659#                   ],
660#                   "backing-image":{
661#                       "filename":"disks/base.qcow2",
662#                       "format":"qcow2",
663#                       "virtual-size":2048000
664#                   }
665#                }
666#             },
667#             "qdev": "ide_disk",
668#             "type":"unknown"
669#          },
670#          {
671#             "io-status": "ok",
672#             "device":"ide1-cd0",
673#             "locked":false,
674#             "removable":true,
675#             "qdev": "/machine/unattached/device[23]",
676#             "tray_open": false,
677#             "type":"unknown"
678#          },
679#          {
680#             "device":"floppy0",
681#             "locked":false,
682#             "removable":true,
683#             "qdev": "/machine/unattached/device[20]",
684#             "type":"unknown"
685#          },
686#          {
687#             "device":"sd0",
688#             "locked":false,
689#             "removable":true,
690#             "type":"unknown"
691#          }
692#       ]
693#    }
694#
695##
696{ 'command': 'query-block', 'returns': ['BlockInfo'] }
697
698
699##
700# @BlockDeviceTimedStats:
701#
702# Statistics of a block device during a given interval of time.
703#
704# @interval_length: Interval used for calculating the statistics,
705#                   in seconds.
706#
707# @min_rd_latency_ns: Minimum latency of read operations in the
708#                     defined interval, in nanoseconds.
709#
710# @min_wr_latency_ns: Minimum latency of write operations in the
711#                     defined interval, in nanoseconds.
712#
713# @min_flush_latency_ns: Minimum latency of flush operations in the
714#                        defined interval, in nanoseconds.
715#
716# @max_rd_latency_ns: Maximum latency of read operations in the
717#                     defined interval, in nanoseconds.
718#
719# @max_wr_latency_ns: Maximum latency of write operations in the
720#                     defined interval, in nanoseconds.
721#
722# @max_flush_latency_ns: Maximum latency of flush operations in the
723#                        defined interval, in nanoseconds.
724#
725# @avg_rd_latency_ns: Average latency of read operations in the
726#                     defined interval, in nanoseconds.
727#
728# @avg_wr_latency_ns: Average latency of write operations in the
729#                     defined interval, in nanoseconds.
730#
731# @avg_flush_latency_ns: Average latency of flush operations in the
732#                        defined interval, in nanoseconds.
733#
734# @avg_rd_queue_depth: Average number of pending read operations
735#                      in the defined interval.
736#
737# @avg_wr_queue_depth: Average number of pending write operations
738#                      in the defined interval.
739#
740# Since: 2.5
741##
742{ 'struct': 'BlockDeviceTimedStats',
743  'data': { 'interval_length': 'int', 'min_rd_latency_ns': 'int',
744            'max_rd_latency_ns': 'int', 'avg_rd_latency_ns': 'int',
745            'min_wr_latency_ns': 'int', 'max_wr_latency_ns': 'int',
746            'avg_wr_latency_ns': 'int', 'min_flush_latency_ns': 'int',
747            'max_flush_latency_ns': 'int', 'avg_flush_latency_ns': 'int',
748            'avg_rd_queue_depth': 'number', 'avg_wr_queue_depth': 'number' } }
749
750##
751# @BlockDeviceStats:
752#
753# Statistics of a virtual block device or a block backing device.
754#
755# @rd_bytes:      The number of bytes read by the device.
756#
757# @wr_bytes:      The number of bytes written by the device.
758#
759# @unmap_bytes: The number of bytes unmapped by the device (Since 4.2)
760#
761# @rd_operations: The number of read operations performed by the device.
762#
763# @wr_operations: The number of write operations performed by the device.
764#
765# @flush_operations: The number of cache flush operations performed by the
766#                    device (since 0.15)
767#
768# @unmap_operations: The number of unmap operations performed by the device
769#                    (Since 4.2)
770#
771# @rd_total_time_ns: Total time spent on reads in nanoseconds (since 0.15).
772#
773# @wr_total_time_ns: Total time spent on writes in nanoseconds (since 0.15).
774#
775# @flush_total_time_ns: Total time spent on cache flushes in nanoseconds
776#                       (since 0.15).
777#
778# @unmap_total_time_ns: Total time spent on unmap operations in nanoseconds
779#                       (Since 4.2)
780#
781# @wr_highest_offset: The offset after the greatest byte written to the
782#                     device.  The intended use of this information is for
783#                     growable sparse files (like qcow2) that are used on top
784#                     of a physical device.
785#
786# @rd_merged: Number of read requests that have been merged into another
787#             request (Since 2.3).
788#
789# @wr_merged: Number of write requests that have been merged into another
790#             request (Since 2.3).
791#
792# @unmap_merged: Number of unmap requests that have been merged into another
793#                request (Since 4.2)
794#
795# @idle_time_ns: Time since the last I/O operation, in
796#                nanoseconds. If the field is absent it means that
797#                there haven't been any operations yet (Since 2.5).
798#
799# @failed_rd_operations: The number of failed read operations
800#                        performed by the device (Since 2.5)
801#
802# @failed_wr_operations: The number of failed write operations
803#                        performed by the device (Since 2.5)
804#
805# @failed_flush_operations: The number of failed flush operations
806#                           performed by the device (Since 2.5)
807#
808# @failed_unmap_operations: The number of failed unmap operations performed
809#                           by the device (Since 4.2)
810#
811# @invalid_rd_operations: The number of invalid read operations
812#                          performed by the device (Since 2.5)
813#
814# @invalid_wr_operations: The number of invalid write operations
815#                         performed by the device (Since 2.5)
816#
817# @invalid_flush_operations: The number of invalid flush operations
818#                            performed by the device (Since 2.5)
819#
820# @invalid_unmap_operations: The number of invalid unmap operations performed
821#                            by the device (Since 4.2)
822#
823# @account_invalid: Whether invalid operations are included in the
824#                   last access statistics (Since 2.5)
825#
826# @account_failed: Whether failed operations are included in the
827#                  latency and last access statistics (Since 2.5)
828#
829# @timed_stats: Statistics specific to the set of previously defined
830#               intervals of time (Since 2.5)
831#
832# @rd_latency_histogram: @BlockLatencyHistogramInfo. (Since 4.0)
833#
834# @wr_latency_histogram: @BlockLatencyHistogramInfo. (Since 4.0)
835#
836# @flush_latency_histogram: @BlockLatencyHistogramInfo. (Since 4.0)
837#
838# Since: 0.14
839##
840{ 'struct': 'BlockDeviceStats',
841  'data': {'rd_bytes': 'int', 'wr_bytes': 'int', 'unmap_bytes' : 'int',
842           'rd_operations': 'int', 'wr_operations': 'int',
843           'flush_operations': 'int', 'unmap_operations': 'int',
844           'rd_total_time_ns': 'int', 'wr_total_time_ns': 'int',
845           'flush_total_time_ns': 'int', 'unmap_total_time_ns': 'int',
846           'wr_highest_offset': 'int',
847           'rd_merged': 'int', 'wr_merged': 'int', 'unmap_merged': 'int',
848           '*idle_time_ns': 'int',
849           'failed_rd_operations': 'int', 'failed_wr_operations': 'int',
850           'failed_flush_operations': 'int', 'failed_unmap_operations': 'int',
851           'invalid_rd_operations': 'int', 'invalid_wr_operations': 'int',
852           'invalid_flush_operations': 'int', 'invalid_unmap_operations': 'int',
853           'account_invalid': 'bool', 'account_failed': 'bool',
854           'timed_stats': ['BlockDeviceTimedStats'],
855           '*rd_latency_histogram': 'BlockLatencyHistogramInfo',
856           '*wr_latency_histogram': 'BlockLatencyHistogramInfo',
857           '*flush_latency_histogram': 'BlockLatencyHistogramInfo' } }
858
859##
860# @BlockStatsSpecificFile:
861#
862# File driver statistics
863#
864# @discard-nb-ok: The number of successful discard operations performed by
865#                 the driver.
866#
867# @discard-nb-failed: The number of failed discard operations performed by
868#                     the driver.
869#
870# @discard-bytes-ok: The number of bytes discarded by the driver.
871#
872# Since: 4.2
873##
874{ 'struct': 'BlockStatsSpecificFile',
875  'data': {
876      'discard-nb-ok': 'uint64',
877      'discard-nb-failed': 'uint64',
878      'discard-bytes-ok': 'uint64' } }
879
880##
881# @BlockStatsSpecificNvme:
882#
883# NVMe driver statistics
884#
885# @completion-errors: The number of completion errors.
886#
887# @aligned-accesses: The number of aligned accesses performed by
888#                    the driver.
889#
890# @unaligned-accesses: The number of unaligned accesses performed by
891#                      the driver.
892#
893# Since: 5.2
894##
895{ 'struct': 'BlockStatsSpecificNvme',
896  'data': {
897      'completion-errors': 'uint64',
898      'aligned-accesses': 'uint64',
899      'unaligned-accesses': 'uint64' } }
900
901##
902# @BlockStatsSpecific:
903#
904# Block driver specific statistics
905#
906# Since: 4.2
907##
908{ 'union': 'BlockStatsSpecific',
909  'base': { 'driver': 'BlockdevDriver' },
910  'discriminator': 'driver',
911  'data': {
912      'file': 'BlockStatsSpecificFile',
913      'host_device': { 'type': 'BlockStatsSpecificFile',
914                       'if': 'defined(HAVE_HOST_BLOCK_DEVICE)' },
915      'nvme': 'BlockStatsSpecificNvme' } }
916
917##
918# @BlockStats:
919#
920# Statistics of a virtual block device or a block backing device.
921#
922# @device: If the stats are for a virtual block device, the name
923#          corresponding to the virtual block device.
924#
925# @node-name: The node name of the device. (Since 2.3)
926#
927# @qdev: The qdev ID, or if no ID is assigned, the QOM path of the block
928#        device. (since 3.0)
929#
930# @stats:  A @BlockDeviceStats for the device.
931#
932# @driver-specific: Optional driver-specific stats. (Since 4.2)
933#
934# @parent: This describes the file block device if it has one.
935#          Contains recursively the statistics of the underlying
936#          protocol (e.g. the host file for a qcow2 image). If there is
937#          no underlying protocol, this field is omitted
938#
939# @backing: This describes the backing block device if it has one.
940#           (Since 2.0)
941#
942# Since: 0.14
943##
944{ 'struct': 'BlockStats',
945  'data': {'*device': 'str', '*qdev': 'str', '*node-name': 'str',
946           'stats': 'BlockDeviceStats',
947           '*driver-specific': 'BlockStatsSpecific',
948           '*parent': 'BlockStats',
949           '*backing': 'BlockStats'} }
950
951##
952# @query-blockstats:
953#
954# Query the @BlockStats for all virtual block devices.
955#
956# @query-nodes: If true, the command will query all the block nodes
957#               that have a node name, in a list which will include "parent"
958#               information, but not "backing".
959#               If false or omitted, the behavior is as before - query all the
960#               device backends, recursively including their "parent" and
961#               "backing". Filter nodes that were created implicitly are
962#               skipped over in this mode. (Since 2.3)
963#
964# Returns: A list of @BlockStats for each virtual block devices.
965#
966# Since: 0.14
967#
968# Example:
969#
970# -> { "execute": "query-blockstats" }
971# <- {
972#       "return":[
973#          {
974#             "device":"ide0-hd0",
975#             "parent":{
976#                "stats":{
977#                   "wr_highest_offset":3686448128,
978#                   "wr_bytes":9786368,
979#                   "wr_operations":751,
980#                   "rd_bytes":122567168,
981#                   "rd_operations":36772
982#                   "wr_total_times_ns":313253456
983#                   "rd_total_times_ns":3465673657
984#                   "flush_total_times_ns":49653
985#                   "flush_operations":61,
986#                   "rd_merged":0,
987#                   "wr_merged":0,
988#                   "idle_time_ns":2953431879,
989#                   "account_invalid":true,
990#                   "account_failed":false
991#                }
992#             },
993#             "stats":{
994#                "wr_highest_offset":2821110784,
995#                "wr_bytes":9786368,
996#                "wr_operations":692,
997#                "rd_bytes":122739200,
998#                "rd_operations":36604
999#                "flush_operations":51,
1000#                "wr_total_times_ns":313253456
1001#                "rd_total_times_ns":3465673657
1002#                "flush_total_times_ns":49653,
1003#                "rd_merged":0,
1004#                "wr_merged":0,
1005#                "idle_time_ns":2953431879,
1006#                "account_invalid":true,
1007#                "account_failed":false
1008#             },
1009#             "qdev": "/machine/unattached/device[23]"
1010#          },
1011#          {
1012#             "device":"ide1-cd0",
1013#             "stats":{
1014#                "wr_highest_offset":0,
1015#                "wr_bytes":0,
1016#                "wr_operations":0,
1017#                "rd_bytes":0,
1018#                "rd_operations":0
1019#                "flush_operations":0,
1020#                "wr_total_times_ns":0
1021#                "rd_total_times_ns":0
1022#                "flush_total_times_ns":0,
1023#                "rd_merged":0,
1024#                "wr_merged":0,
1025#                "account_invalid":false,
1026#                "account_failed":false
1027#             },
1028#             "qdev": "/machine/unattached/device[24]"
1029#          },
1030#          {
1031#             "device":"floppy0",
1032#             "stats":{
1033#                "wr_highest_offset":0,
1034#                "wr_bytes":0,
1035#                "wr_operations":0,
1036#                "rd_bytes":0,
1037#                "rd_operations":0
1038#                "flush_operations":0,
1039#                "wr_total_times_ns":0
1040#                "rd_total_times_ns":0
1041#                "flush_total_times_ns":0,
1042#                "rd_merged":0,
1043#                "wr_merged":0,
1044#                "account_invalid":false,
1045#                "account_failed":false
1046#             },
1047#             "qdev": "/machine/unattached/device[16]"
1048#          },
1049#          {
1050#             "device":"sd0",
1051#             "stats":{
1052#                "wr_highest_offset":0,
1053#                "wr_bytes":0,
1054#                "wr_operations":0,
1055#                "rd_bytes":0,
1056#                "rd_operations":0
1057#                "flush_operations":0,
1058#                "wr_total_times_ns":0
1059#                "rd_total_times_ns":0
1060#                "flush_total_times_ns":0,
1061#                "rd_merged":0,
1062#                "wr_merged":0,
1063#                "account_invalid":false,
1064#                "account_failed":false
1065#             }
1066#          }
1067#       ]
1068#    }
1069#
1070##
1071{ 'command': 'query-blockstats',
1072  'data': { '*query-nodes': 'bool' },
1073  'returns': ['BlockStats'] }
1074
1075##
1076# @BlockdevOnError:
1077#
1078# An enumeration of possible behaviors for errors on I/O operations.
1079# The exact meaning depends on whether the I/O was initiated by a guest
1080# or by a block job
1081#
1082# @report: for guest operations, report the error to the guest;
1083#          for jobs, cancel the job
1084#
1085# @ignore: ignore the error, only report a QMP event (BLOCK_IO_ERROR
1086#          or BLOCK_JOB_ERROR). The backup, mirror and commit block jobs retry
1087#          the failing request later and may still complete successfully. The
1088#          stream block job continues to stream and will complete with an
1089#          error.
1090#
1091# @enospc: same as @stop on ENOSPC, same as @report otherwise.
1092#
1093# @stop: for guest operations, stop the virtual machine;
1094#        for jobs, pause the job
1095#
1096# @auto: inherit the error handling policy of the backend (since: 2.7)
1097#
1098# Since: 1.3
1099##
1100{ 'enum': 'BlockdevOnError',
1101  'data': ['report', 'ignore', 'enospc', 'stop', 'auto'] }
1102
1103##
1104# @MirrorSyncMode:
1105#
1106# An enumeration of possible behaviors for the initial synchronization
1107# phase of storage mirroring.
1108#
1109# @top: copies data in the topmost image to the destination
1110#
1111# @full: copies data from all images to the destination
1112#
1113# @none: only copy data written from now on
1114#
1115# @incremental: only copy data described by the dirty bitmap. (since: 2.4)
1116#
1117# @bitmap: only copy data described by the dirty bitmap. (since: 4.2)
1118#          Behavior on completion is determined by the BitmapSyncMode.
1119#
1120# Since: 1.3
1121##
1122{ 'enum': 'MirrorSyncMode',
1123  'data': ['top', 'full', 'none', 'incremental', 'bitmap'] }
1124
1125##
1126# @BitmapSyncMode:
1127#
1128# An enumeration of possible behaviors for the synchronization of a bitmap
1129# when used for data copy operations.
1130#
1131# @on-success: The bitmap is only synced when the operation is successful.
1132#              This is the behavior always used for 'INCREMENTAL' backups.
1133#
1134# @never: The bitmap is never synchronized with the operation, and is
1135#         treated solely as a read-only manifest of blocks to copy.
1136#
1137# @always: The bitmap is always synchronized with the operation,
1138#          regardless of whether or not the operation was successful.
1139#
1140# Since: 4.2
1141##
1142{ 'enum': 'BitmapSyncMode',
1143  'data': ['on-success', 'never', 'always'] }
1144
1145##
1146# @MirrorCopyMode:
1147#
1148# An enumeration whose values tell the mirror block job when to
1149# trigger writes to the target.
1150#
1151# @background: copy data in background only.
1152#
1153# @write-blocking: when data is written to the source, write it
1154#                  (synchronously) to the target as well.  In
1155#                  addition, data is copied in background just like in
1156#                  @background mode.
1157#
1158# Since: 3.0
1159##
1160{ 'enum': 'MirrorCopyMode',
1161  'data': ['background', 'write-blocking'] }
1162
1163##
1164# @BlockJobInfo:
1165#
1166# Information about a long-running block device operation.
1167#
1168# @type: the job type ('stream' for image streaming)
1169#
1170# @device: The job identifier. Originally the device name but other
1171#          values are allowed since QEMU 2.7
1172#
1173# @len: Estimated @offset value at the completion of the job. This value can
1174#       arbitrarily change while the job is running, in both directions.
1175#
1176# @offset: Progress made until now. The unit is arbitrary and the value can
1177#          only meaningfully be used for the ratio of @offset to @len. The
1178#          value is monotonically increasing.
1179#
1180# @busy: false if the job is known to be in a quiescent state, with
1181#        no pending I/O.  Since 1.3.
1182#
1183# @paused: whether the job is paused or, if @busy is true, will
1184#          pause itself as soon as possible.  Since 1.3.
1185#
1186# @speed: the rate limit, bytes per second
1187#
1188# @io-status: the status of the job (since 1.3)
1189#
1190# @ready: true if the job may be completed (since 2.2)
1191#
1192# @status: Current job state/status (since 2.12)
1193#
1194# @auto-finalize: Job will finalize itself when PENDING, moving to
1195#                 the CONCLUDED state. (since 2.12)
1196#
1197# @auto-dismiss: Job will dismiss itself when CONCLUDED, moving to the NULL
1198#                state and disappearing from the query list. (since 2.12)
1199#
1200# @error: Error information if the job did not complete successfully.
1201#         Not set if the job completed successfully. (since 2.12.1)
1202#
1203# Since: 1.1
1204##
1205{ 'struct': 'BlockJobInfo',
1206  'data': {'type': 'str', 'device': 'str', 'len': 'int',
1207           'offset': 'int', 'busy': 'bool', 'paused': 'bool', 'speed': 'int',
1208           'io-status': 'BlockDeviceIoStatus', 'ready': 'bool',
1209           'status': 'JobStatus',
1210           'auto-finalize': 'bool', 'auto-dismiss': 'bool',
1211           '*error': 'str' } }
1212
1213##
1214# @query-block-jobs:
1215#
1216# Return information about long-running block device operations.
1217#
1218# Returns: a list of @BlockJobInfo for each active block job
1219#
1220# Since: 1.1
1221##
1222{ 'command': 'query-block-jobs', 'returns': ['BlockJobInfo'] }
1223
1224##
1225# @block_resize:
1226#
1227# Resize a block image while a guest is running.
1228#
1229# Either @device or @node-name must be set but not both.
1230#
1231# @device: the name of the device to get the image resized
1232#
1233# @node-name: graph node name to get the image resized (Since 2.0)
1234#
1235# @size:  new image size in bytes
1236#
1237# Returns: - nothing on success
1238#          - If @device is not a valid block device, DeviceNotFound
1239#
1240# Since: 0.14
1241#
1242# Example:
1243#
1244# -> { "execute": "block_resize",
1245#      "arguments": { "device": "scratch", "size": 1073741824 } }
1246# <- { "return": {} }
1247#
1248##
1249{ 'command': 'block_resize',
1250  'data': { '*device': 'str',
1251            '*node-name': 'str',
1252            'size': 'int' },
1253  'coroutine': true }
1254
1255##
1256# @NewImageMode:
1257#
1258# An enumeration that tells QEMU how to set the backing file path in
1259# a new image file.
1260#
1261# @existing: QEMU should look for an existing image file.
1262#
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.
1266#
1267# Since: 1.1
1268##
1269{ 'enum': 'NewImageMode',
1270  'data': [ 'existing', 'absolute-paths' ] }
1271
1272##
1273# @BlockdevSnapshotSync:
1274#
1275# Either @device or @node-name must be set but not both.
1276#
1277# @device: the name of the device to take a snapshot of.
1278#
1279# @node-name: graph node name to generate the snapshot from (Since 2.0)
1280#
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.
1284#
1285# @snapshot-node-name: the graph node name of the new image (Since 2.0)
1286#
1287# @format: the format of the overlay image, default is 'qcow2'.
1288#
1289# @mode: whether and how QEMU should create a new image, default is
1290#        'absolute-paths'.
1291##
1292{ 'struct': 'BlockdevSnapshotSync',
1293  'data': { '*device': 'str', '*node-name': 'str',
1294            'snapshot-file': 'str', '*snapshot-node-name': 'str',
1295            '*format': 'str', '*mode': 'NewImageMode' } }
1296
1297##
1298# @BlockdevSnapshot:
1299#
1300# @node: device or node name that will have a snapshot taken.
1301#
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).
1306#
1307# Since: 2.5
1308##
1309{ 'struct': 'BlockdevSnapshot',
1310  'data': { 'node': 'str', 'overlay': 'str' } }
1311
1312##
1313# @BackupPerf:
1314#
1315# Optional parameters for backup. These parameters don't affect
1316# functionality, but may significantly affect performance.
1317#
1318# @use-copy-range: Use copy offloading. Default false.
1319#
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.
1323#
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.
1329#
1330# Since: 6.0
1331##
1332{ 'struct': 'BackupPerf',
1333  'data': { '*use-copy-range': 'bool',
1334            '*max-workers': 'int', '*max-chunk': 'int64' } }
1335
1336##
1337# @BackupCommon:
1338#
1339# @job-id: identifier for the newly-created block job. If
1340#          omitted, the device name will be used. (Since 2.7)
1341#
1342# @device: the device name or node-name of a root node which should be copied.
1343#
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).
1347#
1348# @speed: the maximum speed, in bytes per second. The default is 0,
1349#         for unlimited.
1350#
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))
1356#
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)
1361#
1362# @compress: true to compress data, if the target format supports it.
1363#            (default: false) (since 2.8)
1364#
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).
1368#
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).
1372#
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)
1379#
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)
1385#
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)
1390#
1391# @x-perf: Performance options. (Since 6.0)
1392#
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.
1396#
1397# Since: 4.2
1398##
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'  } }
1408
1409##
1410# @DriveBackup:
1411#
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.
1415#
1416# @format: the format of the new destination, default is to
1417#          probe if @mode is 'existing', else the format of the source
1418#
1419# @mode: whether and how QEMU should create a new image, default is
1420#        'absolute-paths'.
1421#
1422# Since: 1.6
1423##
1424{ 'struct': 'DriveBackup',
1425  'base': 'BackupCommon',
1426  'data': { 'target': 'str',
1427            '*format': 'str',
1428            '*mode': 'NewImageMode' } }
1429
1430##
1431# @BlockdevBackup:
1432#
1433# @target: the device name or node-name of the backup target node.
1434#
1435# Since: 2.3
1436##
1437{ 'struct': 'BlockdevBackup',
1438  'base': 'BackupCommon',
1439  'data': { 'target': 'str' } }
1440
1441##
1442# @blockdev-snapshot-sync:
1443#
1444# Takes a synchronous snapshot of a block device.
1445#
1446# For the arguments, see the documentation of BlockdevSnapshotSync.
1447#
1448# Returns: - nothing on success
1449#          - If @device is not a valid block device, DeviceNotFound
1450#
1451# Since: 0.14
1452#
1453# Example:
1454#
1455# -> { "execute": "blockdev-snapshot-sync",
1456#      "arguments": { "device": "ide-hd0",
1457#                     "snapshot-file":
1458#                     "/some/place/my-image",
1459#                     "format": "qcow2" } }
1460# <- { "return": {} }
1461#
1462##
1463{ 'command': 'blockdev-snapshot-sync',
1464  'data': 'BlockdevSnapshotSync' }
1465
1466
1467##
1468# @blockdev-snapshot:
1469#
1470# Takes a snapshot of a block device.
1471#
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.
1476#
1477# For the arguments, see the documentation of BlockdevSnapshot.
1478#
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)
1484#
1485# Since: 2.5
1486#
1487# Example:
1488#
1489# -> { "execute": "blockdev-add",
1490#      "arguments": { "driver": "qcow2",
1491#                     "node-name": "node1534",
1492#                     "file": { "driver": "file",
1493#                               "filename": "hd1.qcow2" },
1494#                     "backing": null } }
1495#
1496# <- { "return": {} }
1497#
1498# -> { "execute": "blockdev-snapshot",
1499#      "arguments": { "node": "ide-hd0",
1500#                     "overlay": "node1534" } }
1501# <- { "return": {} }
1502#
1503##
1504{ 'command': 'blockdev-snapshot',
1505  'data': 'BlockdevSnapshot',
1506  'features': [ 'allow-write-only-overlay' ] }
1507
1508##
1509# @change-backing-file:
1510#
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.
1517#
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".
1522#
1523# @device: The device name or node-name of the root node that owns
1524#          image-node-name.
1525#
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.
1530#
1531# Returns: - Nothing on success
1532#          - If "device" does not exist or cannot be determined, DeviceNotFound
1533#
1534# Since: 2.1
1535##
1536{ 'command': 'change-backing-file',
1537  'data': { 'device': 'str', 'image-node-name': 'str',
1538            'backing-file': 'str' } }
1539
1540##
1541# @block-commit:
1542#
1543# Live commit of data from overlay image nodes into backing nodes - i.e.,
1544# writes data between 'top' and 'base' into 'base'.
1545#
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)
1551#
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.
1557#
1558# @job-id: identifier for the newly-created block job. If
1559#          omitted, the device name will be used. (Since 2.7)
1560#
1561# @device: the device name or node-name of a root node
1562#
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)
1566#
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
1571#
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)
1575#
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
1580#
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.
1585#
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.
1591#
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)
1598#
1599# @speed: the maximum speed, in bytes per second
1600#
1601# @on-error: the action to take on an error. 'ignore' means that the request
1602#            should be retried. (default: report; Since: 5.0)
1603#
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)
1608#
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)
1615#
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)
1621#
1622# Features:
1623# @deprecated: Members @base and @top are deprecated.  Use @base-node
1624#              and @top-node instead.
1625#
1626# Returns: - Nothing on success
1627#          - If @device does not exist, DeviceNotFound
1628#          - Any other error returns a GenericError.
1629#
1630# Since: 1.3
1631#
1632# Example:
1633#
1634# -> { "execute": "block-commit",
1635#      "arguments": { "device": "virtio0",
1636#                     "top": "/tmp/snap1.qcow2" } }
1637# <- { "return": {} }
1638#
1639##
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' } }
1649
1650##
1651# @drive-backup:
1652#
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.
1658#
1659# Returns: - nothing on success
1660#          - If @device is not a valid block device, GenericError
1661#
1662# Since: 1.6
1663#
1664# Example:
1665#
1666# -> { "execute": "drive-backup",
1667#      "arguments": { "device": "drive0",
1668#                     "sync": "full",
1669#                     "target": "backup.img" } }
1670# <- { "return": {} }
1671#
1672##
1673{ 'command': 'drive-backup', 'boxed': true,
1674  'data': 'DriveBackup' }
1675
1676##
1677# @blockdev-backup:
1678#
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.
1684#
1685# Returns: - nothing on success
1686#          - If @device is not a valid block device, DeviceNotFound
1687#
1688# Since: 2.3
1689#
1690# Example:
1691# -> { "execute": "blockdev-backup",
1692#      "arguments": { "device": "src-id",
1693#                     "sync": "full",
1694#                     "target": "tgt-id" } }
1695# <- { "return": {} }
1696#
1697##
1698{ 'command': 'blockdev-backup', 'boxed': true,
1699  'data': 'BlockdevBackup' }
1700
1701
1702##
1703# @query-named-block-nodes:
1704#
1705# Get the named block driver list
1706#
1707# @flat: Omit the nested data about backing image ("backing-image" key) if true.
1708#        Default is false (Since 5.0)
1709#
1710# Returns: the list of BlockDeviceInfo
1711#
1712# Since: 2.0
1713#
1714# Example:
1715#
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#                    } } ] }
1761#
1762##
1763{ 'command': 'query-named-block-nodes',
1764  'returns': [ 'BlockDeviceInfo' ],
1765  'data': { '*flat': 'bool' } }
1766
1767##
1768# @XDbgBlockGraphNodeType:
1769#
1770# @block-backend: corresponds to BlockBackend
1771#
1772# @block-job: corresponds to BlockJob
1773#
1774# @block-driver: corresponds to BlockDriverState
1775#
1776# Since: 4.0
1777##
1778{ 'enum': 'XDbgBlockGraphNodeType',
1779  'data': [ 'block-backend', 'block-job', 'block-driver' ] }
1780
1781##
1782# @XDbgBlockGraphNode:
1783#
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.
1787#
1788# @type: Type of graph node. Can be one of block-backend, block-job or
1789#        block-driver-state.
1790#
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).
1794#
1795# Since: 4.0
1796##
1797{ 'struct': 'XDbgBlockGraphNode',
1798  'data': { 'id': 'uint64', 'type': 'XDbgBlockGraphNodeType', 'name': 'str' } }
1799
1800##
1801# @BlockPermission:
1802#
1803# Enum of base block permissions.
1804#
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.
1813#
1814# @write: This permission is required to change the visible disk contents.
1815#
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.
1822#
1823# @resize: This permission is required to change the size of a block node.
1824#
1825# @graph-mod: This permission is required to change the node that this
1826#             BdrvChild points to.
1827#
1828# Since: 4.0
1829##
1830{ 'enum': 'BlockPermission',
1831  'data': [ 'consistent-read', 'write', 'write-unchanged', 'resize',
1832            'graph-mod' ] }
1833##
1834# @XDbgBlockGraphEdge:
1835#
1836# Block Graph edge description for x-debug-query-block-graph.
1837#
1838# @parent: parent id
1839#
1840# @child: child id
1841#
1842# @name: name of the relation (examples are 'file' and 'backing')
1843#
1844# @perm: granted permissions for the parent operating on the child
1845#
1846# @shared-perm: permissions that can still be granted to other users of the
1847#               child while it is still attached to this parent
1848#
1849# Since: 4.0
1850##
1851{ 'struct': 'XDbgBlockGraphEdge',
1852  'data': { 'parent': 'uint64', 'child': 'uint64',
1853            'name': 'str', 'perm': [ 'BlockPermission' ],
1854            'shared-perm': [ 'BlockPermission' ] } }
1855
1856##
1857# @XDbgBlockGraph:
1858#
1859# Block Graph - list of nodes and list of edges.
1860#
1861# Since: 4.0
1862##
1863{ 'struct': 'XDbgBlockGraph',
1864  'data': { 'nodes': ['XDbgBlockGraphNode'], 'edges': ['XDbgBlockGraphEdge'] } }
1865
1866##
1867# @x-debug-query-block-graph:
1868#
1869# Get the block graph.
1870#
1871# Since: 4.0
1872##
1873{ 'command': 'x-debug-query-block-graph', 'returns': 'XDbgBlockGraph' }
1874
1875##
1876# @drive-mirror:
1877#
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.
1884#
1885# Returns: - nothing on success
1886#          - If @device is not a valid block device, GenericError
1887#
1888# Since: 1.3
1889#
1890# Example:
1891#
1892# -> { "execute": "drive-mirror",
1893#      "arguments": { "device": "ide-hd0",
1894#                     "target": "/some/place/my-image",
1895#                     "sync": "full",
1896#                     "format": "qcow2" } }
1897# <- { "return": {} }
1898#
1899##
1900{ 'command': 'drive-mirror', 'boxed': true,
1901  'data': 'DriveMirror' }
1902
1903##
1904# @DriveMirror:
1905#
1906# A set of parameters describing drive mirror setup.
1907#
1908# @job-id: identifier for the newly-created block job. If
1909#          omitted, the device name will be used. (Since 2.7)
1910#
1911# @device:  the device name or node-name of a root node whose writes should be
1912#           mirrored.
1913#
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.
1917#
1918# @format: the format of the new destination, default is to
1919#          probe if @mode is 'existing', else the format of the source
1920#
1921# @node-name: the new block driver state node name in the graph
1922#             (Since 2.1)
1923#
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)
1928#
1929# @mode: whether and how QEMU should create a new image, default is
1930#        'absolute-paths'.
1931#
1932# @speed:  the maximum speed, in bytes per second
1933#
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).
1937#
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).
1942#
1943# @buf-size: maximum amount of data in flight from source to
1944#            target (since 1.4).
1945#
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).
1949#
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)
1958#
1959# @copy-mode: when to copy data to the destination; defaults to 'background'
1960#             (Since: 3.0)
1961#
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)
1968#
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
1975##
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' } }
1985
1986##
1987# @BlockDirtyBitmap:
1988#
1989# @node: name of device/node which the bitmap is tracking
1990#
1991# @name: name of the dirty bitmap
1992#
1993# Since: 2.4
1994##
1995{ 'struct': 'BlockDirtyBitmap',
1996  'data': { 'node': 'str', 'name': 'str' } }
1997
1998##
1999# @BlockDirtyBitmapAdd:
2000#
2001# @node: name of device/node which the bitmap is tracking
2002#
2003# @name: name of the dirty bitmap (must be less than 1024 bytes)
2004#
2005# @granularity: the bitmap granularity, default is 64k for
2006#               block-dirty-bitmap-add
2007#
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)
2012#
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)
2016#
2017# Since: 2.4
2018##
2019{ 'struct': 'BlockDirtyBitmapAdd',
2020  'data': { 'node': 'str', 'name': 'str', '*granularity': 'uint32',
2021            '*persistent': 'bool', '*disabled': 'bool' } }
2022
2023##
2024# @BlockDirtyBitmapMergeSource:
2025#
2026# @local: name of the bitmap, attached to the same node as target bitmap.
2027#
2028# @external: bitmap with specified node
2029#
2030# Since: 4.1
2031##
2032{ 'alternate': 'BlockDirtyBitmapMergeSource',
2033  'data': { 'local': 'str',
2034            'external': 'BlockDirtyBitmap' } }
2035
2036##
2037# @BlockDirtyBitmapMerge:
2038#
2039# @node: name of device/node which the @target bitmap is tracking
2040#
2041# @target: name of the destination dirty bitmap
2042#
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.
2046#
2047# Since: 4.0
2048##
2049{ 'struct': 'BlockDirtyBitmapMerge',
2050  'data': { 'node': 'str', 'target': 'str',
2051            'bitmaps': ['BlockDirtyBitmapMergeSource'] } }
2052
2053##
2054# @block-dirty-bitmap-add:
2055#
2056# Create a dirty bitmap with a name on the node, and start tracking the writes.
2057#
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
2061#
2062# Since: 2.4
2063#
2064# Example:
2065#
2066# -> { "execute": "block-dirty-bitmap-add",
2067#      "arguments": { "node": "drive0", "name": "bitmap0" } }
2068# <- { "return": {} }
2069#
2070##
2071{ 'command': 'block-dirty-bitmap-add',
2072  'data': 'BlockDirtyBitmapAdd' }
2073
2074##
2075# @block-dirty-bitmap-remove:
2076#
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.
2080#
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
2085#
2086# Since: 2.4
2087#
2088# Example:
2089#
2090# -> { "execute": "block-dirty-bitmap-remove",
2091#      "arguments": { "node": "drive0", "name": "bitmap0" } }
2092# <- { "return": {} }
2093#
2094##
2095{ 'command': 'block-dirty-bitmap-remove',
2096  'data': 'BlockDirtyBitmap' }
2097
2098##
2099# @block-dirty-bitmap-clear:
2100#
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.
2104#
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
2108#
2109# Since: 2.4
2110#
2111# Example:
2112#
2113# -> { "execute": "block-dirty-bitmap-clear",
2114#      "arguments": { "node": "drive0", "name": "bitmap0" } }
2115# <- { "return": {} }
2116#
2117##
2118{ 'command': 'block-dirty-bitmap-clear',
2119  'data': 'BlockDirtyBitmap' }
2120
2121##
2122# @block-dirty-bitmap-enable:
2123#
2124# Enables a dirty bitmap so that it will begin tracking disk changes.
2125#
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
2129#
2130# Since: 4.0
2131#
2132# Example:
2133#
2134# -> { "execute": "block-dirty-bitmap-enable",
2135#      "arguments": { "node": "drive0", "name": "bitmap0" } }
2136# <- { "return": {} }
2137#
2138##
2139{ 'command': 'block-dirty-bitmap-enable',
2140  'data': 'BlockDirtyBitmap' }
2141
2142##
2143# @block-dirty-bitmap-disable:
2144#
2145# Disables a dirty bitmap so that it will stop tracking disk changes.
2146#
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
2150#
2151# Since: 4.0
2152#
2153# Example:
2154#
2155# -> { "execute": "block-dirty-bitmap-disable",
2156#      "arguments": { "node": "drive0", "name": "bitmap0" } }
2157# <- { "return": {} }
2158#
2159##
2160{ 'command': 'block-dirty-bitmap-disable',
2161  'data': 'BlockDirtyBitmap' }
2162
2163##
2164# @block-dirty-bitmap-merge:
2165#
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.
2171#
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.
2175#
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
2181#
2182# Since: 4.0
2183#
2184# Example:
2185#
2186# -> { "execute": "block-dirty-bitmap-merge",
2187#      "arguments": { "node": "drive0", "target": "bitmap0",
2188#                     "bitmaps": ["bitmap1"] } }
2189# <- { "return": {} }
2190#
2191##
2192{ 'command': 'block-dirty-bitmap-merge',
2193  'data': 'BlockDirtyBitmapMerge' }
2194
2195##
2196# @BlockDirtyBitmapSha256:
2197#
2198# SHA256 hash of dirty bitmap data
2199#
2200# @sha256: ASCII representation of SHA256 bitmap hash
2201#
2202# Since: 2.10
2203##
2204{ 'struct': 'BlockDirtyBitmapSha256',
2205  'data': {'sha256': 'str'} }
2206
2207##
2208# @x-debug-block-dirty-bitmap-sha256:
2209#
2210# Get bitmap SHA256.
2211#
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
2216#
2217# Since: 2.10
2218##
2219{ 'command': 'x-debug-block-dirty-bitmap-sha256',
2220  'data': 'BlockDirtyBitmap', 'returns': 'BlockDirtyBitmapSha256' }
2221
2222##
2223# @blockdev-mirror:
2224#
2225# Start mirroring a block device's writes to a new destination.
2226#
2227# @job-id: identifier for the newly-created block job. If
2228#          omitted, the device name will be used. (Since 2.7)
2229#
2230# @device: The device name or node-name of a root node whose writes should be
2231#          mirrored.
2232#
2233# @target: the id or node-name of the block device to mirror to. This mustn't be
2234#          attached to guest.
2235#
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.
2240#
2241# @speed:  the maximum speed, in bytes per second
2242#
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).
2246#
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
2251#
2252# @buf-size: maximum amount of data in flight from source to
2253#            target
2254#
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).
2258#
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).
2262#
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)
2267#
2268# @copy-mode: when to copy data to the destination; defaults to 'background'
2269#             (Since: 3.0)
2270#
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)
2277#
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.
2284#
2285# Since: 2.6
2286#
2287# Example:
2288#
2289# -> { "execute": "blockdev-mirror",
2290#      "arguments": { "device": "ide-hd0",
2291#                     "target": "target0",
2292#                     "sync": "full" } }
2293# <- { "return": {} }
2294#
2295##
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' } }
2306
2307##
2308# @BlockIOThrottle:
2309#
2310# A set of parameters describing block throttling.
2311#
2312# @device: Block device name
2313#
2314# @id: The name or QOM path of the guest device (since: 2.8)
2315#
2316# @bps: total throughput limit in bytes per second
2317#
2318# @bps_rd: read throughput limit in bytes per second
2319#
2320# @bps_wr: write throughput limit in bytes per second
2321#
2322# @iops: total I/O operations per second
2323#
2324# @iops_rd: read I/O operations per second
2325#
2326# @iops_wr: write I/O operations per second
2327#
2328# @bps_max: total throughput limit during bursts,
2329#           in bytes (Since 1.7)
2330#
2331# @bps_rd_max: read throughput limit during bursts,
2332#              in bytes (Since 1.7)
2333#
2334# @bps_wr_max: write throughput limit during bursts,
2335#              in bytes (Since 1.7)
2336#
2337# @iops_max: total I/O operations per second during bursts,
2338#            in bytes (Since 1.7)
2339#
2340# @iops_rd_max: read I/O operations per second during bursts,
2341#               in bytes (Since 1.7)
2342#
2343# @iops_wr_max: write I/O operations per second during bursts,
2344#               in bytes (Since 1.7)
2345#
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)
2350#
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)
2355#
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)
2360#
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)
2365#
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)
2370#
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)
2375#
2376# @iops_size: an I/O size in bytes (Since 1.7)
2377#
2378# @group: throttle group name (Since 2.4)
2379#
2380# Features:
2381# @deprecated: Member @device is deprecated.  Use @id instead.
2382#
2383# Since: 1.1
2384##
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' } }
2396
2397##
2398# @ThrottleLimits:
2399#
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.
2404#
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
2430#
2431# Since: 2.11
2432##
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' } }
2444
2445##
2446# @ThrottleGroupProperties:
2447#
2448# Properties for throttle-group objects.
2449#
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.
2454#
2455# @limits: limits to apply for this throttle group
2456#
2457# Since: 2.11
2458##
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' } }
2471
2472##
2473# @block-stream:
2474#
2475# Copy data from a backing file into a block device.
2476#
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.
2482#
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'.
2489#
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.
2497#
2498# On successful completion the image file is updated to drop the backing file
2499# and the BLOCK_JOB_COMPLETED event is emitted.
2500#
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.
2504#
2505# @job-id: identifier for the newly-created block job. If
2506#          omitted, the device name will be used. (Since 2.7)
2507#
2508# @device: the device or node name of the top image
2509#
2510# @base: the common backing file name.
2511#        It cannot be set if @base-node or @bottom is also set.
2512#
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)
2515#
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)
2519#
2520# @backing-file: The backing file string to write into the top
2521#                image. This filename is not validated.
2522#
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.
2527#
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)
2534#
2535# @speed: the maximum speed, in bytes per second
2536#
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.
2540#
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)
2545#
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)
2552#
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)
2558#
2559# Returns: - Nothing on success.
2560#          - If @device does not exist, DeviceNotFound.
2561#
2562# Since: 1.1
2563#
2564# Example:
2565#
2566# -> { "execute": "block-stream",
2567#      "arguments": { "device": "virtio0",
2568#                     "base": "/tmp/master.qcow2" } }
2569# <- { "return": {} }
2570#
2571##
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' } }
2578
2579##
2580# @block-job-set-speed:
2581#
2582# Set maximum speed for a background block operation.
2583#
2584# This command can only be issued when there is an active block job.
2585#
2586# Throttling can be disabled by setting the speed to 0.
2587#
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.
2591#
2592# @speed: the maximum speed, in bytes per second, or 0 for unlimited.
2593#         Defaults to 0.
2594#
2595# Returns: - Nothing on success
2596#          - If no background operation is active on this device, DeviceNotActive
2597#
2598# Since: 1.1
2599##
2600{ 'command': 'block-job-set-speed',
2601  'data': { 'device': 'str', 'speed': 'int' } }
2602
2603##
2604# @block-job-cancel:
2605#
2606# Stop an active background block operation.
2607#
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.
2611#
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.
2615#
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.
2621#
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.
2626#
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.
2630#
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)
2634#
2635# Returns: - Nothing on success
2636#          - If no background operation is active on this device, DeviceNotActive
2637#
2638# Since: 1.1
2639##
2640{ 'command': 'block-job-cancel', 'data': { 'device': 'str', '*force': 'bool' } }
2641
2642##
2643# @block-job-pause:
2644#
2645# Pause an active background block operation.
2646#
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.
2650#
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.
2654#
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.
2658#
2659# Returns: - Nothing on success
2660#          - If no background operation is active on this device, DeviceNotActive
2661#
2662# Since: 1.3
2663##
2664{ 'command': 'block-job-pause', 'data': { 'device': 'str' } }
2665
2666##
2667# @block-job-resume:
2668#
2669# Resume an active background block operation.
2670#
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.
2674#
2675# This command also clears the error status of the job.
2676#
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.
2680#
2681# Returns: - Nothing on success
2682#          - If no background operation is active on this device, DeviceNotActive
2683#
2684# Since: 1.3
2685##
2686{ 'command': 'block-job-resume', 'data': { 'device': 'str' } }
2687
2688##
2689# @block-job-complete:
2690#
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.
2695#
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.
2702#
2703# A cancelled or paused job cannot be completed.
2704#
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.
2708#
2709# Returns: - Nothing on success
2710#          - If no background operation is active on this device, DeviceNotActive
2711#
2712# Since: 1.3
2713##
2714{ 'command': 'block-job-complete', 'data': { 'device': 'str' } }
2715
2716##
2717# @block-job-dismiss:
2718#
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.
2722#
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.
2727#
2728# @id: The job identifier.
2729#
2730# Returns: Nothing on success
2731#
2732# Since: 2.12
2733##
2734{ 'command': 'block-job-dismiss', 'data': { 'id': 'str' } }
2735
2736##
2737# @block-job-finalize:
2738#
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.
2745#
2746# @id: The job identifier.
2747#
2748# Returns: Nothing on success
2749#
2750# Since: 2.12
2751##
2752{ 'command': 'block-job-finalize', 'data': { 'id': 'str' } }
2753
2754##
2755# @BlockdevDiscardOptions:
2756#
2757# Determines how to handle discard requests.
2758#
2759# @ignore: Ignore the request
2760# @unmap: Forward as an unmap request
2761#
2762# Since: 2.9
2763##
2764{ 'enum': 'BlockdevDiscardOptions',
2765  'data': [ 'ignore', 'unmap' ] }
2766
2767##
2768# @BlockdevDetectZeroesOptions:
2769#
2770# Describes the operation mode for the automatic conversion of plain
2771# zero writes by the OS to driver specific optimized zero write commands.
2772#
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.
2777#
2778# Since: 2.1
2779##
2780{ 'enum': 'BlockdevDetectZeroesOptions',
2781  'data': [ 'off', 'on', 'unmap' ] }
2782
2783##
2784# @BlockdevAioOptions:
2785#
2786# Selects the AIO backend to handle I/O requests
2787#
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)
2791#
2792# Since: 2.9
2793##
2794{ 'enum': 'BlockdevAioOptions',
2795  'data': [ 'threads', 'native',
2796            { 'name': 'io_uring', 'if': 'defined(CONFIG_LINUX_IO_URING)' } ] }
2797
2798##
2799# @BlockdevCacheOptions:
2800#
2801# Includes cache-related options for block devices
2802#
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)
2807#
2808# Since: 2.9
2809##
2810{ 'struct': 'BlockdevCacheOptions',
2811  'data': { '*direct': 'bool',
2812            '*no-flush': 'bool' } }
2813
2814##
2815# @BlockdevDriver:
2816#
2817# Drivers that are supported in block device operations.
2818#
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
2825#
2826# Since: 2.9
2827##
2828{ 'enum': 'BlockdevDriver',
2829  'data': [ 'blkdebug', 'blklogwrites', 'blkreplay', 'blkverify', 'bochs',
2830            'cloop', 'compress', 'copy-on-read', 'dmg', 'file', 'ftp', 'ftps',
2831            'gluster',
2832            {'name': 'host_cdrom', 'if': 'defined(HAVE_HOST_BLOCK_DEVICE)' },
2833            {'name': 'host_device', 'if': 'defined(HAVE_HOST_BLOCK_DEVICE)' },
2834            'http', 'https', 'iscsi',
2835            'luks', 'nbd', 'nfs', 'null-aio', 'null-co', 'nvme', 'parallels',
2836            'preallocate', 'qcow', 'qcow2', 'qed', 'quorum', 'raw', 'rbd',
2837            { 'name': 'replication', 'if': 'defined(CONFIG_REPLICATION)' },
2838            'ssh', 'throttle', 'vdi', 'vhdx', 'vmdk', 'vpc', 'vvfat' ] }
2839
2840##
2841# @BlockdevOptionsFile:
2842#
2843# Driver specific block device options for the file backend.
2844#
2845# @filename: path to the image file
2846# @pr-manager: the id for the object that will handle persistent reservations
2847#              for this device (default: none, forward the commands via SG_IO;
2848#              since 2.11)
2849# @aio: AIO backend (default: threads) (since: 2.8)
2850# @locking: whether to enable file locking. If set to 'auto', only enable
2851#           when Open File Descriptor (OFD) locking API is available
2852#           (default: auto, since 2.10)
2853# @drop-cache: invalidate page cache during live migration.  This prevents
2854#              stale data on the migration destination with cache.direct=off.
2855#              Currently only supported on Linux hosts.
2856#              (default: on, since: 4.0)
2857# @x-check-cache-dropped: whether to check that page cache was dropped on live
2858#                         migration.  May cause noticeable delays if the image
2859#                         file is large, do not use in production.
2860#                         (default: off) (since: 3.0)
2861#
2862# Features:
2863# @dynamic-auto-read-only: If present, enabled auto-read-only means that the
2864#                          driver will open the image read-only at first,
2865#                          dynamically reopen the image file read-write when
2866#                          the first writer is attached to the node and reopen
2867#                          read-only when the last writer is detached. This
2868#                          allows giving QEMU write permissions only on demand
2869#                          when an operation actually needs write access.
2870#
2871# Since: 2.9
2872##
2873{ 'struct': 'BlockdevOptionsFile',
2874  'data': { 'filename': 'str',
2875            '*pr-manager': 'str',
2876            '*locking': 'OnOffAuto',
2877            '*aio': 'BlockdevAioOptions',
2878            '*drop-cache': {'type': 'bool',
2879                            'if': 'defined(CONFIG_LINUX)'},
2880            '*x-check-cache-dropped': 'bool' },
2881  'features': [ { 'name': 'dynamic-auto-read-only',
2882                  'if': 'defined(CONFIG_POSIX)' } ] }
2883
2884##
2885# @BlockdevOptionsNull:
2886#
2887# Driver specific block device options for the null backend.
2888#
2889# @size: size of the device in bytes.
2890# @latency-ns: emulated latency (in nanoseconds) in processing
2891#              requests. Default to zero which completes requests immediately.
2892#              (Since 2.4)
2893# @read-zeroes: if true, reads from the device produce zeroes; if false, the
2894#               buffer is left unchanged. (default: false; since: 4.1)
2895#
2896# Since: 2.9
2897##
2898{ 'struct': 'BlockdevOptionsNull',
2899  'data': { '*size': 'int', '*latency-ns': 'uint64', '*read-zeroes': 'bool' } }
2900
2901##
2902# @BlockdevOptionsNVMe:
2903#
2904# Driver specific block device options for the NVMe backend.
2905#
2906# @device: PCI controller address of the NVMe device in
2907#          format hhhh:bb:ss.f (host:bus:slot.function)
2908# @namespace: namespace number of the device, starting from 1.
2909#
2910# Note that the PCI @device must have been unbound from any host
2911# kernel driver before instructing QEMU to add the blockdev.
2912#
2913# Since: 2.12
2914##
2915{ 'struct': 'BlockdevOptionsNVMe',
2916  'data': { 'device': 'str', 'namespace': 'int' } }
2917
2918##
2919# @BlockdevOptionsVVFAT:
2920#
2921# Driver specific block device options for the vvfat protocol.
2922#
2923# @dir: directory to be exported as FAT image
2924# @fat-type: FAT type: 12, 16 or 32
2925# @floppy: whether to export a floppy image (true) or
2926#          partitioned hard disk (false; default)
2927# @label: set the volume label, limited to 11 bytes. FAT16 and
2928#         FAT32 traditionally have some restrictions on labels, which are
2929#         ignored by most operating systems. Defaults to "QEMU VVFAT".
2930#         (since 2.4)
2931# @rw: whether to allow write operations (default: false)
2932#
2933# Since: 2.9
2934##
2935{ 'struct': 'BlockdevOptionsVVFAT',
2936  'data': { 'dir': 'str', '*fat-type': 'int', '*floppy': 'bool',
2937            '*label': 'str', '*rw': 'bool' } }
2938
2939##
2940# @BlockdevOptionsGenericFormat:
2941#
2942# Driver specific block device options for image format that have no option
2943# besides their data source.
2944#
2945# @file: reference to or definition of the data source block device
2946#
2947# Since: 2.9
2948##
2949{ 'struct': 'BlockdevOptionsGenericFormat',
2950  'data': { 'file': 'BlockdevRef' } }
2951
2952##
2953# @BlockdevOptionsLUKS:
2954#
2955# Driver specific block device options for LUKS.
2956#
2957# @key-secret: the ID of a QCryptoSecret object providing
2958#              the decryption key (since 2.6). Mandatory except when
2959#              doing a metadata-only probe of the image.
2960#
2961# Since: 2.9
2962##
2963{ 'struct': 'BlockdevOptionsLUKS',
2964  'base': 'BlockdevOptionsGenericFormat',
2965  'data': { '*key-secret': 'str' } }
2966
2967
2968##
2969# @BlockdevOptionsGenericCOWFormat:
2970#
2971# Driver specific block device options for image format that have no option
2972# besides their data source and an optional backing file.
2973#
2974# @backing: reference to or definition of the backing file block
2975#           device, null disables the backing file entirely.
2976#           Defaults to the backing file stored the image file.
2977#
2978# Since: 2.9
2979##
2980{ 'struct': 'BlockdevOptionsGenericCOWFormat',
2981  'base': 'BlockdevOptionsGenericFormat',
2982  'data': { '*backing': 'BlockdevRefOrNull' } }
2983
2984##
2985# @Qcow2OverlapCheckMode:
2986#
2987# General overlap check modes.
2988#
2989# @none: Do not perform any checks
2990#
2991# @constant: Perform only checks which can be done in constant time and
2992#            without reading anything from disk
2993#
2994# @cached: Perform only checks which can be done without reading anything
2995#          from disk
2996#
2997# @all: Perform all available overlap checks
2998#
2999# Since: 2.9
3000##
3001{ 'enum': 'Qcow2OverlapCheckMode',
3002  'data': [ 'none', 'constant', 'cached', 'all' ] }
3003
3004##
3005# @Qcow2OverlapCheckFlags:
3006#
3007# Structure of flags for each metadata structure. Setting a field to 'true'
3008# makes qemu guard that structure against unintended overwriting. The default
3009# value is chosen according to the template given.
3010#
3011# @template: Specifies a template mode which can be adjusted using the other
3012#            flags, defaults to 'cached'
3013#
3014# @bitmap-directory: since 3.0
3015#
3016# Since: 2.9
3017##
3018{ 'struct': 'Qcow2OverlapCheckFlags',
3019  'data': { '*template':         'Qcow2OverlapCheckMode',
3020            '*main-header':      'bool',
3021            '*active-l1':        'bool',
3022            '*active-l2':        'bool',
3023            '*refcount-table':   'bool',
3024            '*refcount-block':   'bool',
3025            '*snapshot-table':   'bool',
3026            '*inactive-l1':      'bool',
3027            '*inactive-l2':      'bool',
3028            '*bitmap-directory': 'bool' } }
3029
3030##
3031# @Qcow2OverlapChecks:
3032#
3033# Specifies which metadata structures should be guarded against unintended
3034# overwriting.
3035#
3036# @flags: set of flags for separate specification of each metadata structure
3037#         type
3038#
3039# @mode: named mode which chooses a specific set of flags
3040#
3041# Since: 2.9
3042##
3043{ 'alternate': 'Qcow2OverlapChecks',
3044  'data': { 'flags': 'Qcow2OverlapCheckFlags',
3045            'mode':  'Qcow2OverlapCheckMode' } }
3046
3047##
3048# @BlockdevQcowEncryptionFormat:
3049#
3050# @aes: AES-CBC with plain64 initialization vectors
3051#
3052# Since: 2.10
3053##
3054{ 'enum': 'BlockdevQcowEncryptionFormat',
3055  'data': [ 'aes' ] }
3056
3057##
3058# @BlockdevQcowEncryption:
3059#
3060# Since: 2.10
3061##
3062{ 'union': 'BlockdevQcowEncryption',
3063  'base': { 'format': 'BlockdevQcowEncryptionFormat' },
3064  'discriminator': 'format',
3065  'data': { 'aes': 'QCryptoBlockOptionsQCow' } }
3066
3067##
3068# @BlockdevOptionsQcow:
3069#
3070# Driver specific block device options for qcow.
3071#
3072# @encrypt: Image decryption options. Mandatory for
3073#           encrypted images, except when doing a metadata-only
3074#           probe of the image.
3075#
3076# Since: 2.10
3077##
3078{ 'struct': 'BlockdevOptionsQcow',
3079  'base': 'BlockdevOptionsGenericCOWFormat',
3080  'data': { '*encrypt': 'BlockdevQcowEncryption' } }
3081
3082
3083
3084##
3085# @BlockdevQcow2EncryptionFormat:
3086# @aes: AES-CBC with plain64 initialization vectors
3087#
3088# Since: 2.10
3089##
3090{ 'enum': 'BlockdevQcow2EncryptionFormat',
3091  'data': [ 'aes', 'luks' ] }
3092
3093##
3094# @BlockdevQcow2Encryption:
3095#
3096# Since: 2.10
3097##
3098{ 'union': 'BlockdevQcow2Encryption',
3099  'base': { 'format': 'BlockdevQcow2EncryptionFormat' },
3100  'discriminator': 'format',
3101  'data': { 'aes': 'QCryptoBlockOptionsQCow',
3102            'luks': 'QCryptoBlockOptionsLUKS'} }
3103
3104##
3105# @BlockdevOptionsPreallocate:
3106#
3107# Filter driver intended to be inserted between format and protocol node
3108# and do preallocation in protocol node on write.
3109#
3110# @prealloc-align: on preallocation, align file length to this number,
3111#                  default 1048576 (1M)
3112#
3113# @prealloc-size: how much to preallocate, default 134217728 (128M)
3114#
3115# Since: 6.0
3116##
3117{ 'struct': 'BlockdevOptionsPreallocate',
3118  'base': 'BlockdevOptionsGenericFormat',
3119  'data': { '*prealloc-align': 'int', '*prealloc-size': 'int' } }
3120
3121##
3122# @BlockdevOptionsQcow2:
3123#
3124# Driver specific block device options for qcow2.
3125#
3126# @lazy-refcounts: whether to enable the lazy refcounts
3127#                  feature (default is taken from the image file)
3128#
3129# @pass-discard-request: whether discard requests to the qcow2
3130#                        device should be forwarded to the data source
3131#
3132# @pass-discard-snapshot: whether discard requests for the data source
3133#                         should be issued when a snapshot operation (e.g.
3134#                         deleting a snapshot) frees clusters in the qcow2 file
3135#
3136# @pass-discard-other: whether discard requests for the data source
3137#                      should be issued on other occasions where a cluster
3138#                      gets freed
3139#
3140# @overlap-check: which overlap checks to perform for writes
3141#                 to the image, defaults to 'cached' (since 2.2)
3142#
3143# @cache-size: the maximum total size of the L2 table and
3144#              refcount block caches in bytes (since 2.2)
3145#
3146# @l2-cache-size: the maximum size of the L2 table cache in
3147#                 bytes (since 2.2)
3148#
3149# @l2-cache-entry-size: the size of each entry in the L2 cache in
3150#                       bytes. It must be a power of two between 512
3151#                       and the cluster size. The default value is
3152#                       the cluster size (since 2.12)
3153#
3154# @refcount-cache-size: the maximum size of the refcount block cache
3155#                       in bytes (since 2.2)
3156#
3157# @cache-clean-interval: clean unused entries in the L2 and refcount
3158#                        caches. The interval is in seconds. The default value
3159#                        is 600 on supporting platforms, and 0 on other
3160#                        platforms. 0 disables this feature. (since 2.5)
3161#
3162# @encrypt: Image decryption options. Mandatory for
3163#           encrypted images, except when doing a metadata-only
3164#           probe of the image. (since 2.10)
3165#
3166# @data-file: reference to or definition of the external data file.
3167#             This may only be specified for images that require an
3168#             external data file. If it is not specified for such
3169#             an image, the data file name is loaded from the image
3170#             file. (since 4.0)
3171#
3172# Since: 2.9
3173##
3174{ 'struct': 'BlockdevOptionsQcow2',
3175  'base': 'BlockdevOptionsGenericCOWFormat',
3176  'data': { '*lazy-refcounts': 'bool',
3177            '*pass-discard-request': 'bool',
3178            '*pass-discard-snapshot': 'bool',
3179            '*pass-discard-other': 'bool',
3180            '*overlap-check': 'Qcow2OverlapChecks',
3181            '*cache-size': 'int',
3182            '*l2-cache-size': 'int',
3183            '*l2-cache-entry-size': 'int',
3184            '*refcount-cache-size': 'int',
3185            '*cache-clean-interval': 'int',
3186            '*encrypt': 'BlockdevQcow2Encryption',
3187            '*data-file': 'BlockdevRef' } }
3188
3189##
3190# @SshHostKeyCheckMode:
3191#
3192# @none: Don't check the host key at all
3193# @hash: Compare the host key with a given hash
3194# @known_hosts: Check the host key against the known_hosts file
3195#
3196# Since: 2.12
3197##
3198{ 'enum': 'SshHostKeyCheckMode',
3199  'data': [ 'none', 'hash', 'known_hosts' ] }
3200
3201##
3202# @SshHostKeyCheckHashType:
3203#
3204# @md5: The given hash is an md5 hash
3205# @sha1: The given hash is an sha1 hash
3206# @sha256: The given hash is an sha256 hash
3207#
3208# Since: 2.12
3209##
3210{ 'enum': 'SshHostKeyCheckHashType',
3211  'data': [ 'md5', 'sha1', 'sha256' ] }
3212
3213##
3214# @SshHostKeyHash:
3215#
3216# @type: The hash algorithm used for the hash
3217# @hash: The expected hash value
3218#
3219# Since: 2.12
3220##
3221{ 'struct': 'SshHostKeyHash',
3222  'data': { 'type': 'SshHostKeyCheckHashType',
3223            'hash': 'str' }}
3224
3225##
3226# @SshHostKeyCheck:
3227#
3228# Since: 2.12
3229##
3230{ 'union': 'SshHostKeyCheck',
3231  'base': { 'mode': 'SshHostKeyCheckMode' },
3232  'discriminator': 'mode',
3233  'data': { 'hash': 'SshHostKeyHash' } }
3234
3235##
3236# @BlockdevOptionsSsh:
3237#
3238# @server:              host address
3239#
3240# @path:                path to the image on the host
3241#
3242# @user:                user as which to connect, defaults to current
3243#                       local user name
3244#
3245# @host-key-check:      Defines how and what to check the host key against
3246#                       (default: known_hosts)
3247#
3248# Since: 2.9
3249##
3250{ 'struct': 'BlockdevOptionsSsh',
3251  'data': { 'server': 'InetSocketAddress',
3252            'path': 'str',
3253            '*user': 'str',
3254            '*host-key-check': 'SshHostKeyCheck' } }
3255
3256
3257##
3258# @BlkdebugEvent:
3259#
3260# Trigger events supported by blkdebug.
3261#
3262# @l1_shrink_write_table: write zeros to the l1 table to shrink image.
3263#                         (since 2.11)
3264#
3265# @l1_shrink_free_l2_clusters: discard the l2 tables. (since 2.11)
3266#
3267# @cor_write: a write due to copy-on-read (since 2.11)
3268#
3269# @cluster_alloc_space: an allocation of file space for a cluster (since 4.1)
3270#
3271# @none: triggers once at creation of the blkdebug node (since 4.1)
3272#
3273# Since: 2.9
3274##
3275{ 'enum': 'BlkdebugEvent', 'prefix': 'BLKDBG',
3276  'data': [ 'l1_update', 'l1_grow_alloc_table', 'l1_grow_write_table',
3277            'l1_grow_activate_table', 'l2_load', 'l2_update',
3278            'l2_update_compressed', 'l2_alloc_cow_read', 'l2_alloc_write',
3279            'read_aio', 'read_backing_aio', 'read_compressed', 'write_aio',
3280            'write_compressed', 'vmstate_load', 'vmstate_save', 'cow_read',
3281            'cow_write', 'reftable_load', 'reftable_grow', 'reftable_update',
3282            'refblock_load', 'refblock_update', 'refblock_update_part',
3283            'refblock_alloc', 'refblock_alloc_hookup', 'refblock_alloc_write',
3284            'refblock_alloc_write_blocks', 'refblock_alloc_write_table',
3285            'refblock_alloc_switch_table', 'cluster_alloc',
3286            'cluster_alloc_bytes', 'cluster_free', 'flush_to_os',
3287            'flush_to_disk', 'pwritev_rmw_head', 'pwritev_rmw_after_head',
3288            'pwritev_rmw_tail', 'pwritev_rmw_after_tail', 'pwritev',
3289            'pwritev_zero', 'pwritev_done', 'empty_image_prepare',
3290            'l1_shrink_write_table', 'l1_shrink_free_l2_clusters',
3291            'cor_write', 'cluster_alloc_space', 'none'] }
3292
3293##
3294# @BlkdebugIOType:
3295#
3296# Kinds of I/O that blkdebug can inject errors in.
3297#
3298# @read: .bdrv_co_preadv()
3299#
3300# @write: .bdrv_co_pwritev()
3301#
3302# @write-zeroes: .bdrv_co_pwrite_zeroes()
3303#
3304# @discard: .bdrv_co_pdiscard()
3305#
3306# @flush: .bdrv_co_flush_to_disk()
3307#
3308# @block-status: .bdrv_co_block_status()
3309#
3310# Since: 4.1
3311##
3312{ 'enum': 'BlkdebugIOType', 'prefix': 'BLKDEBUG_IO_TYPE',
3313  'data': [ 'read', 'write', 'write-zeroes', 'discard', 'flush',
3314            'block-status' ] }
3315
3316##
3317# @BlkdebugInjectErrorOptions:
3318#
3319# Describes a single error injection for blkdebug.
3320#
3321# @event: trigger event
3322#
3323# @state: the state identifier blkdebug needs to be in to
3324#         actually trigger the event; defaults to "any"
3325#
3326# @iotype: the type of I/O operations on which this error should
3327#          be injected; defaults to "all read, write,
3328#          write-zeroes, discard, and flush operations"
3329#          (since: 4.1)
3330#
3331# @errno: error identifier (errno) to be returned; defaults to
3332#         EIO
3333#
3334# @sector: specifies the sector index which has to be affected
3335#          in order to actually trigger the event; defaults to "any
3336#          sector"
3337#
3338# @once: disables further events after this one has been
3339#        triggered; defaults to false
3340#
3341# @immediately: fail immediately; defaults to false
3342#
3343# Since: 2.9
3344##
3345{ 'struct': 'BlkdebugInjectErrorOptions',
3346  'data': { 'event': 'BlkdebugEvent',
3347            '*state': 'int',
3348            '*iotype': 'BlkdebugIOType',
3349            '*errno': 'int',
3350            '*sector': 'int',
3351            '*once': 'bool',
3352            '*immediately': 'bool' } }
3353
3354##
3355# @BlkdebugSetStateOptions:
3356#
3357# Describes a single state-change event for blkdebug.
3358#
3359# @event: trigger event
3360#
3361# @state: the current state identifier blkdebug needs to be in;
3362#         defaults to "any"
3363#
3364# @new_state: the state identifier blkdebug is supposed to assume if
3365#             this event is triggered
3366#
3367# Since: 2.9
3368##
3369{ 'struct': 'BlkdebugSetStateOptions',
3370  'data': { 'event': 'BlkdebugEvent',
3371            '*state': 'int',
3372            'new_state': 'int' } }
3373
3374##
3375# @BlockdevOptionsBlkdebug:
3376#
3377# Driver specific block device options for blkdebug.
3378#
3379# @image: underlying raw block device (or image file)
3380#
3381# @config: filename of the configuration file
3382#
3383# @align: required alignment for requests in bytes, must be
3384#         positive power of 2, or 0 for default
3385#
3386# @max-transfer: maximum size for I/O transfers in bytes, must be
3387#                positive multiple of @align and of the underlying
3388#                file's request alignment (but need not be a power of
3389#                2), or 0 for default (since 2.10)
3390#
3391# @opt-write-zero: preferred alignment for write zero requests in bytes,
3392#                  must be positive multiple of @align and of the
3393#                  underlying file's request alignment (but need not be a
3394#                  power of 2), or 0 for default (since 2.10)
3395#
3396# @max-write-zero: maximum size for write zero requests in bytes, must be
3397#                  positive multiple of @align, of @opt-write-zero, and of
3398#                  the underlying file's request alignment (but need not
3399#                  be a power of 2), or 0 for default (since 2.10)
3400#
3401# @opt-discard: preferred alignment for discard requests in bytes, must
3402#               be positive multiple of @align and of the underlying
3403#               file's request alignment (but need not be a power of
3404#               2), or 0 for default (since 2.10)
3405#
3406# @max-discard: maximum size for discard requests in bytes, must be
3407#               positive multiple of @align, of @opt-discard, and of
3408#               the underlying file's request alignment (but need not
3409#               be a power of 2), or 0 for default (since 2.10)
3410#
3411# @inject-error: array of error injection descriptions
3412#
3413# @set-state: array of state-change descriptions
3414#
3415# @take-child-perms: Permissions to take on @image in addition to what
3416#                    is necessary anyway (which depends on how the
3417#                    blkdebug node is used).  Defaults to none.
3418#                    (since 5.0)
3419#
3420# @unshare-child-perms: Permissions not to share on @image in addition
3421#                       to what cannot be shared anyway (which depends
3422#                       on how the blkdebug node is used).  Defaults
3423#                       to none.  (since 5.0)
3424#
3425# Since: 2.9
3426##
3427{ 'struct': 'BlockdevOptionsBlkdebug',
3428  'data': { 'image': 'BlockdevRef',
3429            '*config': 'str',
3430            '*align': 'int', '*max-transfer': 'int32',
3431            '*opt-write-zero': 'int32', '*max-write-zero': 'int32',
3432            '*opt-discard': 'int32', '*max-discard': 'int32',
3433            '*inject-error': ['BlkdebugInjectErrorOptions'],
3434            '*set-state': ['BlkdebugSetStateOptions'],
3435            '*take-child-perms': ['BlockPermission'],
3436            '*unshare-child-perms': ['BlockPermission'] } }
3437
3438##
3439# @BlockdevOptionsBlklogwrites:
3440#
3441# Driver specific block device options for blklogwrites.
3442#
3443# @file: block device
3444#
3445# @log: block device used to log writes to @file
3446#
3447# @log-sector-size: sector size used in logging writes to @file, determines
3448#                   granularity of offsets and sizes of writes (default: 512)
3449#
3450# @log-append: append to an existing log (default: false)
3451#
3452# @log-super-update-interval: interval of write requests after which the log
3453#                             super block is updated to disk (default: 4096)
3454#
3455# Since: 3.0
3456##
3457{ 'struct': 'BlockdevOptionsBlklogwrites',
3458  'data': { 'file': 'BlockdevRef',
3459            'log': 'BlockdevRef',
3460            '*log-sector-size': 'uint32',
3461            '*log-append': 'bool',
3462            '*log-super-update-interval': 'uint64' } }
3463
3464##
3465# @BlockdevOptionsBlkverify:
3466#
3467# Driver specific block device options for blkverify.
3468#
3469# @test: block device to be tested
3470#
3471# @raw: raw image used for verification
3472#
3473# Since: 2.9
3474##
3475{ 'struct': 'BlockdevOptionsBlkverify',
3476  'data': { 'test': 'BlockdevRef',
3477            'raw': 'BlockdevRef' } }
3478
3479##
3480# @BlockdevOptionsBlkreplay:
3481#
3482# Driver specific block device options for blkreplay.
3483#
3484# @image: disk image which should be controlled with blkreplay
3485#
3486# Since: 4.2
3487##
3488{ 'struct': 'BlockdevOptionsBlkreplay',
3489  'data': { 'image': 'BlockdevRef' } }
3490
3491##
3492# @QuorumReadPattern:
3493#
3494# An enumeration of quorum read patterns.
3495#
3496# @quorum: read all the children and do a quorum vote on reads
3497#
3498# @fifo: read only from the first child that has not failed
3499#
3500# Since: 2.9
3501##
3502{ 'enum': 'QuorumReadPattern', 'data': [ 'quorum', 'fifo' ] }
3503
3504##
3505# @BlockdevOptionsQuorum:
3506#
3507# Driver specific block device options for Quorum
3508#
3509# @blkverify: true if the driver must print content mismatch
3510#                  set to false by default
3511#
3512# @children: the children block devices to use
3513#
3514# @vote-threshold: the vote limit under which a read will fail
3515#
3516# @rewrite-corrupted: rewrite corrupted data when quorum is reached
3517#                     (Since 2.1)
3518#
3519# @read-pattern: choose read pattern and set to quorum by default
3520#                (Since 2.2)
3521#
3522# Since: 2.9
3523##
3524{ 'struct': 'BlockdevOptionsQuorum',
3525  'data': { '*blkverify': 'bool',
3526            'children': [ 'BlockdevRef' ],
3527            'vote-threshold': 'int',
3528            '*rewrite-corrupted': 'bool',
3529            '*read-pattern': 'QuorumReadPattern' } }
3530
3531##
3532# @BlockdevOptionsGluster:
3533#
3534# Driver specific block device options for Gluster
3535#
3536# @volume: name of gluster volume where VM image resides
3537#
3538# @path: absolute path to image file in gluster volume
3539#
3540# @server: gluster servers description
3541#
3542# @debug: libgfapi log level (default '4' which is Error)
3543#         (Since 2.8)
3544#
3545# @logfile: libgfapi log file (default /dev/stderr) (Since 2.8)
3546#
3547# Since: 2.9
3548##
3549{ 'struct': 'BlockdevOptionsGluster',
3550  'data': { 'volume': 'str',
3551            'path': 'str',
3552            'server': ['SocketAddress'],
3553            '*debug': 'int',
3554            '*logfile': 'str' } }
3555
3556##
3557# @IscsiTransport:
3558#
3559# An enumeration of libiscsi transport types
3560#
3561# Since: 2.9
3562##
3563{ 'enum': 'IscsiTransport',
3564  'data': [ 'tcp', 'iser' ] }
3565
3566##
3567# @IscsiHeaderDigest:
3568#
3569# An enumeration of header digests supported by libiscsi
3570#
3571# Since: 2.9
3572##
3573{ 'enum': 'IscsiHeaderDigest',
3574  'prefix': 'QAPI_ISCSI_HEADER_DIGEST',
3575  'data': [ 'crc32c', 'none', 'crc32c-none', 'none-crc32c' ] }
3576
3577##
3578# @BlockdevOptionsIscsi:
3579#
3580# @transport: The iscsi transport type
3581#
3582# @portal: The address of the iscsi portal
3583#
3584# @target: The target iqn name
3585#
3586# @lun: LUN to connect to. Defaults to 0.
3587#
3588# @user: User name to log in with. If omitted, no CHAP
3589#        authentication is performed.
3590#
3591# @password-secret: The ID of a QCryptoSecret object providing
3592#                   the password for the login. This option is required if
3593#                   @user is specified.
3594#
3595# @initiator-name: The iqn name we want to identify to the target
3596#                  as. If this option is not specified, an initiator name is
3597#                  generated automatically.
3598#
3599# @header-digest: The desired header digest. Defaults to
3600#                 none-crc32c.
3601#
3602# @timeout: Timeout in seconds after which a request will
3603#           timeout. 0 means no timeout and is the default.
3604#
3605# Driver specific block device options for iscsi
3606#
3607# Since: 2.9
3608##
3609{ 'struct': 'BlockdevOptionsIscsi',
3610  'data': { 'transport': 'IscsiTransport',
3611            'portal': 'str',
3612            'target': 'str',
3613            '*lun': 'int',
3614            '*user': 'str',
3615            '*password-secret': 'str',
3616            '*initiator-name': 'str',
3617            '*header-digest': 'IscsiHeaderDigest',
3618            '*timeout': 'int' } }
3619
3620
3621##
3622# @RbdAuthMode:
3623#
3624# Since: 3.0
3625##
3626{ 'enum': 'RbdAuthMode',
3627  'data': [ 'cephx', 'none' ] }
3628
3629##
3630# @RbdImageEncryptionFormat:
3631#
3632# Since: 6.1
3633##
3634{ 'enum': 'RbdImageEncryptionFormat',
3635  'data': [ 'luks', 'luks2' ] }
3636
3637##
3638# @RbdEncryptionOptionsLUKSBase:
3639#
3640# @key-secret: ID of a QCryptoSecret object providing a passphrase
3641#              for unlocking the encryption
3642#
3643# Since: 6.1
3644##
3645{ 'struct': 'RbdEncryptionOptionsLUKSBase',
3646  'data': { 'key-secret': 'str' } }
3647
3648##
3649# @RbdEncryptionCreateOptionsLUKSBase:
3650#
3651# @cipher-alg: The encryption algorithm
3652#
3653# Since: 6.1
3654##
3655{ 'struct': 'RbdEncryptionCreateOptionsLUKSBase',
3656  'base': 'RbdEncryptionOptionsLUKSBase',
3657  'data': { '*cipher-alg': 'QCryptoCipherAlgorithm' } }
3658
3659##
3660# @RbdEncryptionOptionsLUKS:
3661#
3662# Since: 6.1
3663##
3664{ 'struct': 'RbdEncryptionOptionsLUKS',
3665  'base': 'RbdEncryptionOptionsLUKSBase',
3666  'data': { } }
3667
3668##
3669# @RbdEncryptionOptionsLUKS2:
3670#
3671# Since: 6.1
3672##
3673{ 'struct': 'RbdEncryptionOptionsLUKS2',
3674  'base': 'RbdEncryptionOptionsLUKSBase',
3675  'data': { } }
3676
3677##
3678# @RbdEncryptionCreateOptionsLUKS:
3679#
3680# Since: 6.1
3681##
3682{ 'struct': 'RbdEncryptionCreateOptionsLUKS',
3683  'base': 'RbdEncryptionCreateOptionsLUKSBase',
3684  'data': { } }
3685
3686##
3687# @RbdEncryptionCreateOptionsLUKS2:
3688#
3689# Since: 6.1
3690##
3691{ 'struct': 'RbdEncryptionCreateOptionsLUKS2',
3692  'base': 'RbdEncryptionCreateOptionsLUKSBase',
3693  'data': { } }
3694
3695##
3696# @RbdEncryptionOptions:
3697#
3698# Since: 6.1
3699##
3700{ 'union': 'RbdEncryptionOptions',
3701  'base': { 'format': 'RbdImageEncryptionFormat' },
3702  'discriminator': 'format',
3703  'data': { 'luks': 'RbdEncryptionOptionsLUKS',
3704            'luks2': 'RbdEncryptionOptionsLUKS2' } }
3705
3706##
3707# @RbdEncryptionCreateOptions:
3708#
3709# Since: 6.1
3710##
3711{ 'union': 'RbdEncryptionCreateOptions',
3712  'base': { 'format': 'RbdImageEncryptionFormat' },
3713  'discriminator': 'format',
3714  'data': { 'luks': 'RbdEncryptionCreateOptionsLUKS',
3715            'luks2': 'RbdEncryptionCreateOptionsLUKS2' } }
3716
3717##
3718# @BlockdevOptionsRbd:
3719#
3720# @pool: Ceph pool name.
3721#
3722# @namespace: Rados namespace name in the Ceph pool. (Since 5.0)
3723#
3724# @image: Image name in the Ceph pool.
3725#
3726# @conf: path to Ceph configuration file.  Values
3727#        in the configuration file will be overridden by
3728#        options specified via QAPI.
3729#
3730# @snapshot: Ceph snapshot name.
3731#
3732# @encrypt: Image encryption options. (Since 6.1)
3733#
3734# @user: Ceph id name.
3735#
3736# @auth-client-required: Acceptable authentication modes.
3737#                        This maps to Ceph configuration option
3738#                        "auth_client_required".  (Since 3.0)
3739#
3740# @key-secret: ID of a QCryptoSecret object providing a key
3741#              for cephx authentication.
3742#              This maps to Ceph configuration option
3743#              "key".  (Since 3.0)
3744#
3745# @server: Monitor host address and port.  This maps
3746#          to the "mon_host" Ceph option.
3747#
3748# Since: 2.9
3749##
3750{ 'struct': 'BlockdevOptionsRbd',
3751  'data': { 'pool': 'str',
3752            '*namespace': 'str',
3753            'image': 'str',
3754            '*conf': 'str',
3755            '*snapshot': 'str',
3756            '*encrypt': 'RbdEncryptionOptions',
3757            '*user': 'str',
3758            '*auth-client-required': ['RbdAuthMode'],
3759            '*key-secret': 'str',
3760            '*server': ['InetSocketAddressBase'] } }
3761
3762##
3763# @ReplicationMode:
3764#
3765# An enumeration of replication modes.
3766#
3767# @primary: Primary mode, the vm's state will be sent to secondary QEMU.
3768#
3769# @secondary: Secondary mode, receive the vm's state from primary QEMU.
3770#
3771# Since: 2.9
3772##
3773{ 'enum' : 'ReplicationMode', 'data' : [ 'primary', 'secondary' ],
3774  'if': 'defined(CONFIG_REPLICATION)' }
3775
3776##
3777# @BlockdevOptionsReplication:
3778#
3779# Driver specific block device options for replication
3780#
3781# @mode: the replication mode
3782#
3783# @top-id: In secondary mode, node name or device ID of the root
3784#          node who owns the replication node chain. Must not be given in
3785#          primary mode.
3786#
3787# Since: 2.9
3788##
3789{ 'struct': 'BlockdevOptionsReplication',
3790  'base': 'BlockdevOptionsGenericFormat',
3791  'data': { 'mode': 'ReplicationMode',
3792            '*top-id': 'str' },
3793  'if': 'defined(CONFIG_REPLICATION)' }
3794
3795##
3796# @NFSTransport:
3797#
3798# An enumeration of NFS transport types
3799#
3800# @inet: TCP transport
3801#
3802# Since: 2.9
3803##
3804{ 'enum': 'NFSTransport',
3805  'data': [ 'inet' ] }
3806
3807##
3808# @NFSServer:
3809#
3810# Captures the address of the socket
3811#
3812# @type: transport type used for NFS (only TCP supported)
3813#
3814# @host: host address for NFS server
3815#
3816# Since: 2.9
3817##
3818{ 'struct': 'NFSServer',
3819  'data': { 'type': 'NFSTransport',
3820            'host': 'str' } }
3821
3822##
3823# @BlockdevOptionsNfs:
3824#
3825# Driver specific block device option for NFS
3826#
3827# @server: host address
3828#
3829# @path: path of the image on the host
3830#
3831# @user: UID value to use when talking to the
3832#        server (defaults to 65534 on Windows and getuid()
3833#        on unix)
3834#
3835# @group: GID value to use when talking to the
3836#         server (defaults to 65534 on Windows and getgid()
3837#         in unix)
3838#
3839# @tcp-syn-count: number of SYNs during the session
3840#                 establishment (defaults to libnfs default)
3841#
3842# @readahead-size: set the readahead size in bytes (defaults
3843#                  to libnfs default)
3844#
3845# @page-cache-size: set the pagecache size in bytes (defaults
3846#                   to libnfs default)
3847#
3848# @debug: set the NFS debug level (max 2) (defaults
3849#         to libnfs default)
3850#
3851# Since: 2.9
3852##
3853{ 'struct': 'BlockdevOptionsNfs',
3854  'data': { 'server': 'NFSServer',
3855            'path': 'str',
3856            '*user': 'int',
3857            '*group': 'int',
3858            '*tcp-syn-count': 'int',
3859            '*readahead-size': 'int',
3860            '*page-cache-size': 'int',
3861            '*debug': 'int' } }
3862
3863##
3864# @BlockdevOptionsCurlBase:
3865#
3866# Driver specific block device options shared by all protocols supported by the
3867# curl backend.
3868#
3869# @url: URL of the image file
3870#
3871# @readahead: Size of the read-ahead cache; must be a multiple of
3872#             512 (defaults to 256 kB)
3873#
3874# @timeout: Timeout for connections, in seconds (defaults to 5)
3875#
3876# @username: Username for authentication (defaults to none)
3877#
3878# @password-secret: ID of a QCryptoSecret object providing a password
3879#                   for authentication (defaults to no password)
3880#
3881# @proxy-username: Username for proxy authentication (defaults to none)
3882#
3883# @proxy-password-secret: ID of a QCryptoSecret object providing a password
3884#                         for proxy authentication (defaults to no password)
3885#
3886# Since: 2.9
3887##
3888{ 'struct': 'BlockdevOptionsCurlBase',
3889  'data': { 'url': 'str',
3890            '*readahead': 'int',
3891            '*timeout': 'int',
3892            '*username': 'str',
3893            '*password-secret': 'str',
3894            '*proxy-username': 'str',
3895            '*proxy-password-secret': 'str' } }
3896
3897##
3898# @BlockdevOptionsCurlHttp:
3899#
3900# Driver specific block device options for HTTP connections over the curl
3901# backend.  URLs must start with "http://".
3902#
3903# @cookie: List of cookies to set; format is
3904#          "name1=content1; name2=content2;" as explained by
3905#          CURLOPT_COOKIE(3). Defaults to no cookies.
3906#
3907# @cookie-secret: ID of a QCryptoSecret object providing the cookie data in a
3908#                 secure way. See @cookie for the format. (since 2.10)
3909#
3910# Since: 2.9
3911##
3912{ 'struct': 'BlockdevOptionsCurlHttp',
3913  'base': 'BlockdevOptionsCurlBase',
3914  'data': { '*cookie': 'str',
3915            '*cookie-secret': 'str'} }
3916
3917##
3918# @BlockdevOptionsCurlHttps:
3919#
3920# Driver specific block device options for HTTPS connections over the curl
3921# backend.  URLs must start with "https://".
3922#
3923# @cookie: List of cookies to set; format is
3924#          "name1=content1; name2=content2;" as explained by
3925#          CURLOPT_COOKIE(3). Defaults to no cookies.
3926#
3927# @sslverify: Whether to verify the SSL certificate's validity (defaults to
3928#             true)
3929#
3930# @cookie-secret: ID of a QCryptoSecret object providing the cookie data in a
3931#                 secure way. See @cookie for the format. (since 2.10)
3932#
3933# Since: 2.9
3934##
3935{ 'struct': 'BlockdevOptionsCurlHttps',
3936  'base': 'BlockdevOptionsCurlBase',
3937  'data': { '*cookie': 'str',
3938            '*sslverify': 'bool',
3939            '*cookie-secret': 'str'} }
3940
3941##
3942# @BlockdevOptionsCurlFtp:
3943#
3944# Driver specific block device options for FTP connections over the curl
3945# backend.  URLs must start with "ftp://".
3946#
3947# Since: 2.9
3948##
3949{ 'struct': 'BlockdevOptionsCurlFtp',
3950  'base': 'BlockdevOptionsCurlBase',
3951  'data': { } }
3952
3953##
3954# @BlockdevOptionsCurlFtps:
3955#
3956# Driver specific block device options for FTPS connections over the curl
3957# backend.  URLs must start with "ftps://".
3958#
3959# @sslverify: Whether to verify the SSL certificate's validity (defaults to
3960#             true)
3961#
3962# Since: 2.9
3963##
3964{ 'struct': 'BlockdevOptionsCurlFtps',
3965  'base': 'BlockdevOptionsCurlBase',
3966  'data': { '*sslverify': 'bool' } }
3967
3968##
3969# @BlockdevOptionsNbd:
3970#
3971# Driver specific block device options for NBD.
3972#
3973# @server: NBD server address
3974#
3975# @export: export name
3976#
3977# @tls-creds: TLS credentials ID
3978#
3979# @x-dirty-bitmap: A metadata context name such as "qemu:dirty-bitmap:NAME"
3980#                  or "qemu:allocation-depth" to query in place of the
3981#                  traditional "base:allocation" block status (see
3982#                  NBD_OPT_LIST_META_CONTEXT in the NBD protocol; and
3983#                  yes, naming this option x-context would have made
3984#                  more sense) (since 3.0)
3985#
3986# @reconnect-delay: On an unexpected disconnect, the nbd client tries to
3987#                   connect again until succeeding or encountering a serious
3988#                   error.  During the first @reconnect-delay seconds, all
3989#                   requests are paused and will be rerun on a successful
3990#                   reconnect. After that time, any delayed requests and all
3991#                   future requests before a successful reconnect will
3992#                   immediately fail. Default 0 (Since 4.2)
3993#
3994# Since: 2.9
3995##
3996{ 'struct': 'BlockdevOptionsNbd',
3997  'data': { 'server': 'SocketAddress',
3998            '*export': 'str',
3999            '*tls-creds': 'str',
4000            '*x-dirty-bitmap': 'str',
4001            '*reconnect-delay': 'uint32' } }
4002
4003##
4004# @BlockdevOptionsRaw:
4005#
4006# Driver specific block device options for the raw driver.
4007#
4008# @offset: position where the block device starts
4009# @size: the assumed size of the device
4010#
4011# Since: 2.9
4012##
4013{ 'struct': 'BlockdevOptionsRaw',
4014  'base': 'BlockdevOptionsGenericFormat',
4015  'data': { '*offset': 'int', '*size': 'int' } }
4016
4017##
4018# @BlockdevOptionsThrottle:
4019#
4020# Driver specific block device options for the throttle driver
4021#
4022# @throttle-group: the name of the throttle-group object to use. It
4023#                  must already exist.
4024# @file: reference to or definition of the data source block device
4025# Since: 2.11
4026##
4027{ 'struct': 'BlockdevOptionsThrottle',
4028  'data': { 'throttle-group': 'str',
4029            'file' : 'BlockdevRef'
4030             } }
4031
4032##
4033# @BlockdevOptionsCor:
4034#
4035# Driver specific block device options for the copy-on-read driver.
4036#
4037# @bottom: The name of a non-filter node (allocation-bearing layer) that
4038#          limits the COR operations in the backing chain (inclusive), so
4039#          that no data below this node will be copied by this filter.
4040#          If option is absent, the limit is not applied, so that data
4041#          from all backing layers may be copied.
4042#
4043# Since: 6.0
4044##
4045{ 'struct': 'BlockdevOptionsCor',
4046  'base': 'BlockdevOptionsGenericFormat',
4047  'data': { '*bottom': 'str' } }
4048
4049##
4050# @BlockdevOptions:
4051#
4052# Options for creating a block device.  Many options are available for all
4053# block devices, independent of the block driver:
4054#
4055# @driver: block driver name
4056# @node-name: the node name of the new node (Since 2.0).
4057#             This option is required on the top level of blockdev-add.
4058#             Valid node names start with an alphabetic character and may
4059#             contain only alphanumeric characters, '-', '.' and '_'. Their
4060#             maximum length is 31 characters.
4061# @discard: discard-related options (default: ignore)
4062# @cache: cache-related options
4063# @read-only: whether the block device should be read-only (default: false).
4064#             Note that some block drivers support only read-only access,
4065#             either generally or in certain configurations. In this case,
4066#             the default value does not work and the option must be
4067#             specified explicitly.
4068# @auto-read-only: if true and @read-only is false, QEMU may automatically
4069#                  decide not to open the image read-write as requested, but
4070#                  fall back to read-only instead (and switch between the modes
4071#                  later), e.g. depending on whether the image file is writable
4072#                  or whether a writing user is attached to the node
4073#                  (default: false, since 3.1)
4074# @detect-zeroes: detect and optimize zero writes (Since 2.1)
4075#                 (default: off)
4076# @force-share: force share all permission on added nodes.
4077#               Requires read-only=true. (Since 2.10)
4078#
4079# Remaining options are determined by the block driver.
4080#
4081# Since: 2.9
4082##
4083{ 'union': 'BlockdevOptions',
4084  'base': { 'driver': 'BlockdevDriver',
4085            '*node-name': 'str',
4086            '*discard': 'BlockdevDiscardOptions',
4087            '*cache': 'BlockdevCacheOptions',
4088            '*read-only': 'bool',
4089            '*auto-read-only': 'bool',
4090            '*force-share': 'bool',
4091            '*detect-zeroes': 'BlockdevDetectZeroesOptions' },
4092  'discriminator': 'driver',
4093  'data': {
4094      'blkdebug':   'BlockdevOptionsBlkdebug',
4095      'blklogwrites':'BlockdevOptionsBlklogwrites',
4096      'blkverify':  'BlockdevOptionsBlkverify',
4097      'blkreplay':  'BlockdevOptionsBlkreplay',
4098      'bochs':      'BlockdevOptionsGenericFormat',
4099      'cloop':      'BlockdevOptionsGenericFormat',
4100      'compress':   'BlockdevOptionsGenericFormat',
4101      'copy-on-read':'BlockdevOptionsCor',
4102      'dmg':        'BlockdevOptionsGenericFormat',
4103      'file':       'BlockdevOptionsFile',
4104      'ftp':        'BlockdevOptionsCurlFtp',
4105      'ftps':       'BlockdevOptionsCurlFtps',
4106      'gluster':    'BlockdevOptionsGluster',
4107      'host_cdrom':  { 'type': 'BlockdevOptionsFile',
4108                       'if': 'defined(HAVE_HOST_BLOCK_DEVICE)' },
4109      'host_device': { 'type': 'BlockdevOptionsFile',
4110                       'if': 'defined(HAVE_HOST_BLOCK_DEVICE)' },
4111      'http':       'BlockdevOptionsCurlHttp',
4112      'https':      'BlockdevOptionsCurlHttps',
4113      'iscsi':      'BlockdevOptionsIscsi',
4114      'luks':       'BlockdevOptionsLUKS',
4115      'nbd':        'BlockdevOptionsNbd',
4116      'nfs':        'BlockdevOptionsNfs',
4117      'null-aio':   'BlockdevOptionsNull',
4118      'null-co':    'BlockdevOptionsNull',
4119      'nvme':       'BlockdevOptionsNVMe',
4120      'parallels':  'BlockdevOptionsGenericFormat',
4121      'preallocate':'BlockdevOptionsPreallocate',
4122      'qcow2':      'BlockdevOptionsQcow2',
4123      'qcow':       'BlockdevOptionsQcow',
4124      'qed':        'BlockdevOptionsGenericCOWFormat',
4125      'quorum':     'BlockdevOptionsQuorum',
4126      'raw':        'BlockdevOptionsRaw',
4127      'rbd':        'BlockdevOptionsRbd',
4128      'replication': { 'type': 'BlockdevOptionsReplication',
4129                       'if': 'defined(CONFIG_REPLICATION)' },
4130      'ssh':        'BlockdevOptionsSsh',
4131      'throttle':   'BlockdevOptionsThrottle',
4132      'vdi':        'BlockdevOptionsGenericFormat',
4133      'vhdx':       'BlockdevOptionsGenericFormat',
4134      'vmdk':       'BlockdevOptionsGenericCOWFormat',
4135      'vpc':        'BlockdevOptionsGenericFormat',
4136      'vvfat':      'BlockdevOptionsVVFAT'
4137  } }
4138
4139##
4140# @BlockdevRef:
4141#
4142# Reference to a block device.
4143#
4144# @definition: defines a new block device inline
4145# @reference: references the ID of an existing block device
4146#
4147# Since: 2.9
4148##
4149{ 'alternate': 'BlockdevRef',
4150  'data': { 'definition': 'BlockdevOptions',
4151            'reference': 'str' } }
4152
4153##
4154# @BlockdevRefOrNull:
4155#
4156# Reference to a block device.
4157#
4158# @definition: defines a new block device inline
4159# @reference: references the ID of an existing block device.
4160#             An empty string means that no block device should
4161#             be referenced.  Deprecated; use null instead.
4162# @null: No block device should be referenced (since 2.10)
4163#
4164# Since: 2.9
4165##
4166{ 'alternate': 'BlockdevRefOrNull',
4167  'data': { 'definition': 'BlockdevOptions',
4168            'reference': 'str',
4169            'null': 'null' } }
4170
4171##
4172# @blockdev-add:
4173#
4174# Creates a new block device.
4175#
4176# Since: 2.9
4177#
4178# Example:
4179#
4180# 1.
4181# -> { "execute": "blockdev-add",
4182#      "arguments": {
4183#           "driver": "qcow2",
4184#           "node-name": "test1",
4185#           "file": {
4186#               "driver": "file",
4187#               "filename": "test.qcow2"
4188#            }
4189#       }
4190#     }
4191# <- { "return": {} }
4192#
4193# 2.
4194# -> { "execute": "blockdev-add",
4195#      "arguments": {
4196#           "driver": "qcow2",
4197#           "node-name": "node0",
4198#           "discard": "unmap",
4199#           "cache": {
4200#              "direct": true
4201#            },
4202#            "file": {
4203#              "driver": "file",
4204#              "filename": "/tmp/test.qcow2"
4205#            },
4206#            "backing": {
4207#               "driver": "raw",
4208#               "file": {
4209#                  "driver": "file",
4210#                  "filename": "/dev/fdset/4"
4211#                }
4212#            }
4213#        }
4214#      }
4215#
4216# <- { "return": {} }
4217#
4218##
4219{ 'command': 'blockdev-add', 'data': 'BlockdevOptions', 'boxed': true }
4220
4221##
4222# @x-blockdev-reopen:
4223#
4224# Reopens one or more block devices using the given set of options.
4225# Any option not specified will be reset to its default value regardless
4226# of its previous status. If an option cannot be changed or a particular
4227# driver does not support reopening then the command will return an
4228# error. All devices in the list are reopened in one transaction, so
4229# if one of them fails then the whole transaction is cancelled.
4230#
4231# The command receives a list of block devices to reopen. For each one
4232# of them, the top-level @node-name option (from BlockdevOptions) must be
4233# specified and is used to select the block device to be reopened.
4234# Other @node-name options must be either omitted or set to the
4235# current name of the appropriate node. This command won't change any
4236# node name and any attempt to do it will result in an error.
4237#
4238# In the case of options that refer to child nodes, the behavior of
4239# this command depends on the value:
4240#
4241#  1) A set of options (BlockdevOptions): the child is reopened with
4242#     the specified set of options.
4243#
4244#  2) A reference to the current child: the child is reopened using
4245#     its existing set of options.
4246#
4247#  3) A reference to a different node: the current child is replaced
4248#     with the specified one.
4249#
4250#  4) NULL: the current child (if any) is detached.
4251#
4252# Options (1) and (2) are supported in all cases. Option (3) is
4253# supported for @file and @backing, and option (4) for @backing only.
4254#
4255# Unlike with blockdev-add, the @backing option must always be present
4256# unless the node being reopened does not have a backing file and its
4257# image does not have a default backing file name as part of its
4258# metadata.
4259#
4260# Since: 4.0
4261##
4262{ 'command': 'x-blockdev-reopen',
4263  'data': { 'options': ['BlockdevOptions'] } }
4264
4265##
4266# @blockdev-del:
4267#
4268# Deletes a block device that has been added using blockdev-add.
4269# The command will fail if the node is attached to a device or is
4270# otherwise being used.
4271#
4272# @node-name: Name of the graph node to delete.
4273#
4274# Since: 2.9
4275#
4276# Example:
4277#
4278# -> { "execute": "blockdev-add",
4279#      "arguments": {
4280#           "driver": "qcow2",
4281#           "node-name": "node0",
4282#           "file": {
4283#               "driver": "file",
4284#               "filename": "test.qcow2"
4285#           }
4286#      }
4287#    }
4288# <- { "return": {} }
4289#
4290# -> { "execute": "blockdev-del",
4291#      "arguments": { "node-name": "node0" }
4292#    }
4293# <- { "return": {} }
4294#
4295##
4296{ 'command': 'blockdev-del', 'data': { 'node-name': 'str' } }
4297
4298##
4299# @BlockdevCreateOptionsFile:
4300#
4301# Driver specific image creation options for file.
4302#
4303# @filename: Filename for the new image file
4304# @size: Size of the virtual disk in bytes
4305# @preallocation: Preallocation mode for the new image (default: off;
4306#                 allowed values: off,
4307#                 falloc (if defined CONFIG_POSIX_FALLOCATE),
4308#                 full (if defined CONFIG_POSIX))
4309# @nocow: Turn off copy-on-write (valid only on btrfs; default: off)
4310# @extent-size-hint: Extent size hint to add to the image file; 0 for not
4311#                    adding an extent size hint (default: 1 MB, since 5.1)
4312#
4313# Since: 2.12
4314##
4315{ 'struct': 'BlockdevCreateOptionsFile',
4316  'data': { 'filename':             'str',
4317            'size':                 'size',
4318            '*preallocation':       'PreallocMode',
4319            '*nocow':               'bool',
4320            '*extent-size-hint':    'size'} }
4321
4322##
4323# @BlockdevCreateOptionsGluster:
4324#
4325# Driver specific image creation options for gluster.
4326#
4327# @location: Where to store the new image file
4328# @size: Size of the virtual disk in bytes
4329# @preallocation: Preallocation mode for the new image (default: off;
4330#                 allowed values: off,
4331#                 falloc (if defined CONFIG_GLUSTERFS_FALLOCATE),
4332#                 full (if defined CONFIG_GLUSTERFS_ZEROFILL))
4333#
4334# Since: 2.12
4335##
4336{ 'struct': 'BlockdevCreateOptionsGluster',
4337  'data': { 'location':         'BlockdevOptionsGluster',
4338            'size':             'size',
4339            '*preallocation':   'PreallocMode' } }
4340
4341##
4342# @BlockdevCreateOptionsLUKS:
4343#
4344# Driver specific image creation options for LUKS.
4345#
4346# @file: Node to create the image format on
4347# @size: Size of the virtual disk in bytes
4348# @preallocation: Preallocation mode for the new image
4349#                 (since: 4.2)
4350#                 (default: off; allowed values: off, metadata, falloc, full)
4351#
4352# Since: 2.12
4353##
4354{ 'struct': 'BlockdevCreateOptionsLUKS',
4355  'base': 'QCryptoBlockCreateOptionsLUKS',
4356  'data': { 'file':             'BlockdevRef',
4357            'size':             'size',
4358            '*preallocation':   'PreallocMode' } }
4359
4360##
4361# @BlockdevCreateOptionsNfs:
4362#
4363# Driver specific image creation options for NFS.
4364#
4365# @location: Where to store the new image file
4366# @size: Size of the virtual disk in bytes
4367#
4368# Since: 2.12
4369##
4370{ 'struct': 'BlockdevCreateOptionsNfs',
4371  'data': { 'location':         'BlockdevOptionsNfs',
4372            'size':             'size' } }
4373
4374##
4375# @BlockdevCreateOptionsParallels:
4376#
4377# Driver specific image creation options for parallels.
4378#
4379# @file: Node to create the image format on
4380# @size: Size of the virtual disk in bytes
4381# @cluster-size: Cluster size in bytes (default: 1 MB)
4382#
4383# Since: 2.12
4384##
4385{ 'struct': 'BlockdevCreateOptionsParallels',
4386  'data': { 'file':             'BlockdevRef',
4387            'size':             'size',
4388            '*cluster-size':    'size' } }
4389
4390##
4391# @BlockdevCreateOptionsQcow:
4392#
4393# Driver specific image creation options for qcow.
4394#
4395# @file: Node to create the image format on
4396# @size: Size of the virtual disk in bytes
4397# @backing-file: File name of the backing file if a backing file
4398#                should be used
4399# @encrypt: Encryption options if the image should be encrypted
4400#
4401# Since: 2.12
4402##
4403{ 'struct': 'BlockdevCreateOptionsQcow',
4404  'data': { 'file':             'BlockdevRef',
4405            'size':             'size',
4406            '*backing-file':    'str',
4407            '*encrypt':         'QCryptoBlockCreateOptions' } }
4408
4409##
4410# @BlockdevQcow2Version:
4411#
4412# @v2:  The original QCOW2 format as introduced in qemu 0.10 (version 2)
4413# @v3:  The extended QCOW2 format as introduced in qemu 1.1 (version 3)
4414#
4415# Since: 2.12
4416##
4417{ 'enum': 'BlockdevQcow2Version',
4418  'data': [ 'v2', 'v3' ] }
4419
4420
4421##
4422# @Qcow2CompressionType:
4423#
4424# Compression type used in qcow2 image file
4425#
4426# @zlib: zlib compression, see <http://zlib.net/>
4427# @zstd: zstd compression, see <http://github.com/facebook/zstd>
4428#
4429# Since: 5.1
4430##
4431{ 'enum': 'Qcow2CompressionType',
4432  'data': [ 'zlib', { 'name': 'zstd', 'if': 'defined(CONFIG_ZSTD)' } ] }
4433
4434##
4435# @BlockdevCreateOptionsQcow2:
4436#
4437# Driver specific image creation options for qcow2.
4438#
4439# @file: Node to create the image format on
4440# @data-file: Node to use as an external data file in which all guest
4441#             data is stored so that only metadata remains in the qcow2
4442#             file (since: 4.0)
4443# @data-file-raw: True if the external data file must stay valid as a
4444#                 standalone (read-only) raw image without looking at qcow2
4445#                 metadata (default: false; since: 4.0)
4446# @extended-l2: True to make the image have extended L2 entries
4447#               (default: false; since 5.2)
4448# @size: Size of the virtual disk in bytes
4449# @version: Compatibility level (default: v3)
4450# @backing-file: File name of the backing file if a backing file
4451#                should be used
4452# @backing-fmt: Name of the block driver to use for the backing file
4453# @encrypt: Encryption options if the image should be encrypted
4454# @cluster-size: qcow2 cluster size in bytes (default: 65536)
4455# @preallocation: Preallocation mode for the new image (default: off;
4456#                 allowed values: off, falloc, full, metadata)
4457# @lazy-refcounts: True if refcounts may be updated lazily (default: off)
4458# @refcount-bits: Width of reference counts in bits (default: 16)
4459# @compression-type: The image cluster compression method
4460#                    (default: zlib, since 5.1)
4461#
4462# Since: 2.12
4463##
4464{ 'struct': 'BlockdevCreateOptionsQcow2',
4465  'data': { 'file':             'BlockdevRef',
4466            '*data-file':       'BlockdevRef',
4467            '*data-file-raw':   'bool',
4468            '*extended-l2':     'bool',
4469            'size':             'size',
4470            '*version':         'BlockdevQcow2Version',
4471            '*backing-file':    'str',
4472            '*backing-fmt':     'BlockdevDriver',
4473            '*encrypt':         'QCryptoBlockCreateOptions',
4474            '*cluster-size':    'size',
4475            '*preallocation':   'PreallocMode',
4476            '*lazy-refcounts':  'bool',
4477            '*refcount-bits':   'int',
4478            '*compression-type':'Qcow2CompressionType' } }
4479
4480##
4481# @BlockdevCreateOptionsQed:
4482#
4483# Driver specific image creation options for qed.
4484#
4485# @file: Node to create the image format on
4486# @size: Size of the virtual disk in bytes
4487# @backing-file: File name of the backing file if a backing file
4488#                should be used
4489# @backing-fmt: Name of the block driver to use for the backing file
4490# @cluster-size: Cluster size in bytes (default: 65536)
4491# @table-size: L1/L2 table size (in clusters)
4492#
4493# Since: 2.12
4494##
4495{ 'struct': 'BlockdevCreateOptionsQed',
4496  'data': { 'file':             'BlockdevRef',
4497            'size':             'size',
4498            '*backing-file':    'str',
4499            '*backing-fmt':     'BlockdevDriver',
4500            '*cluster-size':    'size',
4501            '*table-size':      'int' } }
4502
4503##
4504# @BlockdevCreateOptionsRbd:
4505#
4506# Driver specific image creation options for rbd/Ceph.
4507#
4508# @location: Where to store the new image file. This location cannot
4509#            point to a snapshot.
4510# @size: Size of the virtual disk in bytes
4511# @cluster-size: RBD object size
4512# @encrypt: Image encryption options. (Since 6.1)
4513#
4514# Since: 2.12
4515##
4516{ 'struct': 'BlockdevCreateOptionsRbd',
4517  'data': { 'location':         'BlockdevOptionsRbd',
4518            'size':             'size',
4519            '*cluster-size' :   'size',
4520            '*encrypt' :        'RbdEncryptionCreateOptions' } }
4521
4522##
4523# @BlockdevVmdkSubformat:
4524#
4525# Subformat options for VMDK images
4526#
4527# @monolithicSparse:     Single file image with sparse cluster allocation
4528#
4529# @monolithicFlat:       Single flat data image and a descriptor file
4530#
4531# @twoGbMaxExtentSparse: Data is split into 2GB (per virtual LBA) sparse extent
4532#                        files, in addition to a descriptor file
4533#
4534# @twoGbMaxExtentFlat:   Data is split into 2GB (per virtual LBA) flat extent
4535#                        files, in addition to a descriptor file
4536#
4537# @streamOptimized:      Single file image sparse cluster allocation, optimized
4538#                        for streaming over network.
4539#
4540# Since: 4.0
4541##
4542{ 'enum': 'BlockdevVmdkSubformat',
4543  'data': [ 'monolithicSparse', 'monolithicFlat', 'twoGbMaxExtentSparse',
4544            'twoGbMaxExtentFlat', 'streamOptimized'] }
4545
4546##
4547# @BlockdevVmdkAdapterType:
4548#
4549# Adapter type info for VMDK images
4550#
4551# Since: 4.0
4552##
4553{ 'enum': 'BlockdevVmdkAdapterType',
4554  'data': [ 'ide', 'buslogic', 'lsilogic', 'legacyESX'] }
4555
4556##
4557# @BlockdevCreateOptionsVmdk:
4558#
4559# Driver specific image creation options for VMDK.
4560#
4561# @file: Where to store the new image file. This refers to the image
4562#        file for monolithcSparse and streamOptimized format, or the
4563#        descriptor file for other formats.
4564# @size: Size of the virtual disk in bytes
4565# @extents: Where to store the data extents. Required for monolithcFlat,
4566#           twoGbMaxExtentSparse and twoGbMaxExtentFlat formats. For
4567#           monolithicFlat, only one entry is required; for
4568#           twoGbMaxExtent* formats, the number of entries required is
4569#           calculated as extent_number = virtual_size / 2GB. Providing
4570#           more extents than will be used is an error.
4571# @subformat: The subformat of the VMDK image. Default: "monolithicSparse".
4572# @backing-file: The path of backing file. Default: no backing file is used.
4573# @adapter-type: The adapter type used to fill in the descriptor. Default: ide.
4574# @hwversion: Hardware version. The meaningful options are "4" or "6".
4575#             Default: "4".
4576# @zeroed-grain: Whether to enable zeroed-grain feature for sparse subformats.
4577#                Default: false.
4578#
4579# Since: 4.0
4580##
4581{ 'struct': 'BlockdevCreateOptionsVmdk',
4582  'data': { 'file':             'BlockdevRef',
4583            'size':             'size',
4584            '*extents':          ['BlockdevRef'],
4585            '*subformat':       'BlockdevVmdkSubformat',
4586            '*backing-file':    'str',
4587            '*adapter-type':    'BlockdevVmdkAdapterType',
4588            '*hwversion':       'str',
4589            '*zeroed-grain':    'bool' } }
4590
4591
4592##
4593# @BlockdevCreateOptionsSsh:
4594#
4595# Driver specific image creation options for SSH.
4596#
4597# @location: Where to store the new image file
4598# @size: Size of the virtual disk in bytes
4599#
4600# Since: 2.12
4601##
4602{ 'struct': 'BlockdevCreateOptionsSsh',
4603  'data': { 'location':         'BlockdevOptionsSsh',
4604            'size':             'size' } }
4605
4606##
4607# @BlockdevCreateOptionsVdi:
4608#
4609# Driver specific image creation options for VDI.
4610#
4611# @file: Node to create the image format on
4612# @size: Size of the virtual disk in bytes
4613# @preallocation: Preallocation mode for the new image (default: off;
4614#                 allowed values: off, metadata)
4615#
4616# Since: 2.12
4617##
4618{ 'struct': 'BlockdevCreateOptionsVdi',
4619  'data': { 'file':             'BlockdevRef',
4620            'size':             'size',
4621            '*preallocation':   'PreallocMode' } }
4622
4623##
4624# @BlockdevVhdxSubformat:
4625#
4626# @dynamic: Growing image file
4627# @fixed:   Preallocated fixed-size image file
4628#
4629# Since: 2.12
4630##
4631{ 'enum': 'BlockdevVhdxSubformat',
4632  'data': [ 'dynamic', 'fixed' ] }
4633
4634##
4635# @BlockdevCreateOptionsVhdx:
4636#
4637# Driver specific image creation options for vhdx.
4638#
4639# @file: Node to create the image format on
4640# @size: Size of the virtual disk in bytes
4641# @log-size: Log size in bytes, must be a multiple of 1 MB
4642#            (default: 1 MB)
4643# @block-size: Block size in bytes, must be a multiple of 1 MB and not
4644#              larger than 256 MB (default: automatically choose a block
4645#              size depending on the image size)
4646# @subformat: vhdx subformat (default: dynamic)
4647# @block-state-zero: Force use of payload blocks of type 'ZERO'. Non-standard,
4648#                    but default.  Do not set to 'off' when using 'qemu-img
4649#                    convert' with subformat=dynamic.
4650#
4651# Since: 2.12
4652##
4653{ 'struct': 'BlockdevCreateOptionsVhdx',
4654  'data': { 'file':                 'BlockdevRef',
4655            'size':                 'size',
4656            '*log-size':            'size',
4657            '*block-size':          'size',
4658            '*subformat':           'BlockdevVhdxSubformat',
4659            '*block-state-zero':    'bool' } }
4660
4661##
4662# @BlockdevVpcSubformat:
4663#
4664# @dynamic: Growing image file
4665# @fixed:   Preallocated fixed-size image file
4666#
4667# Since: 2.12
4668##
4669{ 'enum': 'BlockdevVpcSubformat',
4670  'data': [ 'dynamic', 'fixed' ] }
4671
4672##
4673# @BlockdevCreateOptionsVpc:
4674#
4675# Driver specific image creation options for vpc (VHD).
4676#
4677# @file: Node to create the image format on
4678# @size: Size of the virtual disk in bytes
4679# @subformat: vhdx subformat (default: dynamic)
4680# @force-size: Force use of the exact byte size instead of rounding to the
4681#              next size that can be represented in CHS geometry
4682#              (default: false)
4683#
4684# Since: 2.12
4685##
4686{ 'struct': 'BlockdevCreateOptionsVpc',
4687  'data': { 'file':                 'BlockdevRef',
4688            'size':                 'size',
4689            '*subformat':           'BlockdevVpcSubformat',
4690            '*force-size':          'bool' } }
4691
4692##
4693# @BlockdevCreateOptions:
4694#
4695# Options for creating an image format on a given node.
4696#
4697# @driver: block driver to create the image format
4698#
4699# Since: 2.12
4700##
4701{ 'union': 'BlockdevCreateOptions',
4702  'base': {
4703      'driver':         'BlockdevDriver' },
4704  'discriminator': 'driver',
4705  'data': {
4706      'file':           'BlockdevCreateOptionsFile',
4707      'gluster':        'BlockdevCreateOptionsGluster',
4708      'luks':           'BlockdevCreateOptionsLUKS',
4709      'nfs':            'BlockdevCreateOptionsNfs',
4710      'parallels':      'BlockdevCreateOptionsParallels',
4711      'qcow':           'BlockdevCreateOptionsQcow',
4712      'qcow2':          'BlockdevCreateOptionsQcow2',
4713      'qed':            'BlockdevCreateOptionsQed',
4714      'rbd':            'BlockdevCreateOptionsRbd',
4715      'ssh':            'BlockdevCreateOptionsSsh',
4716      'vdi':            'BlockdevCreateOptionsVdi',
4717      'vhdx':           'BlockdevCreateOptionsVhdx',
4718      'vmdk':           'BlockdevCreateOptionsVmdk',
4719      'vpc':            'BlockdevCreateOptionsVpc'
4720  } }
4721
4722##
4723# @blockdev-create:
4724#
4725# Starts a job to create an image format on a given node. The job is
4726# automatically finalized, but a manual job-dismiss is required.
4727#
4728# @job-id:          Identifier for the newly created job.
4729#
4730# @options:         Options for the image creation.
4731#
4732# Since: 3.0
4733##
4734{ 'command': 'blockdev-create',
4735  'data': { 'job-id': 'str',
4736            'options': 'BlockdevCreateOptions' } }
4737
4738##
4739# @BlockdevAmendOptionsLUKS:
4740#
4741# Driver specific image amend options for LUKS.
4742#
4743# Since: 5.1
4744##
4745{ 'struct': 'BlockdevAmendOptionsLUKS',
4746  'base': 'QCryptoBlockAmendOptionsLUKS',
4747  'data': { }
4748}
4749
4750##
4751# @BlockdevAmendOptionsQcow2:
4752#
4753# Driver specific image amend options for qcow2.
4754# For now, only encryption options can be amended
4755#
4756# @encrypt          Encryption options to be amended
4757#
4758# Since: 5.1
4759##
4760{ 'struct': 'BlockdevAmendOptionsQcow2',
4761  'data': { '*encrypt':         'QCryptoBlockAmendOptions' } }
4762
4763##
4764# @BlockdevAmendOptions:
4765#
4766# Options for amending an image format
4767#
4768# @driver:          Block driver of the node to amend.
4769#
4770# Since: 5.1
4771##
4772{ 'union': 'BlockdevAmendOptions',
4773  'base': {
4774      'driver':         'BlockdevDriver' },
4775  'discriminator': 'driver',
4776  'data': {
4777      'luks':           'BlockdevAmendOptionsLUKS',
4778      'qcow2':          'BlockdevAmendOptionsQcow2' } }
4779
4780##
4781# @x-blockdev-amend:
4782#
4783# Starts a job to amend format specific options of an existing open block device
4784# The job is automatically finalized, but a manual job-dismiss is required.
4785#
4786# @job-id:          Identifier for the newly created job.
4787#
4788# @node-name:       Name of the block node to work on
4789#
4790# @options:         Options (driver specific)
4791#
4792# @force:           Allow unsafe operations, format specific
4793#                   For luks that allows erase of the last active keyslot
4794#                   (permanent loss of data),
4795#                   and replacement of an active keyslot
4796#                   (possible loss of data if IO error happens)
4797#
4798# Since: 5.1
4799##
4800{ 'command': 'x-blockdev-amend',
4801  'data': { 'job-id': 'str',
4802            'node-name': 'str',
4803            'options': 'BlockdevAmendOptions',
4804            '*force': 'bool' } }
4805
4806##
4807# @BlockErrorAction:
4808#
4809# An enumeration of action that has been taken when a DISK I/O occurs
4810#
4811# @ignore: error has been ignored
4812#
4813# @report: error has been reported to the device
4814#
4815# @stop: error caused VM to be stopped
4816#
4817# Since: 2.1
4818##
4819{ 'enum': 'BlockErrorAction',
4820  'data': [ 'ignore', 'report', 'stop' ] }
4821
4822
4823##
4824# @BLOCK_IMAGE_CORRUPTED:
4825#
4826# Emitted when a disk image is being marked corrupt. The image can be
4827# identified by its device or node name. The 'device' field is always
4828# present for compatibility reasons, but it can be empty ("") if the
4829# image does not have a device name associated.
4830#
4831# @device: device name. This is always present for compatibility
4832#          reasons, but it can be empty ("") if the image does not
4833#          have a device name associated.
4834#
4835# @node-name: node name (Since: 2.4)
4836#
4837# @msg: informative message for human consumption, such as the kind of
4838#       corruption being detected. It should not be parsed by machine as it is
4839#       not guaranteed to be stable
4840#
4841# @offset: if the corruption resulted from an image access, this is
4842#          the host's access offset into the image
4843#
4844# @size: if the corruption resulted from an image access, this is
4845#        the access size
4846#
4847# @fatal: if set, the image is marked corrupt and therefore unusable after this
4848#         event and must be repaired (Since 2.2; before, every
4849#         BLOCK_IMAGE_CORRUPTED event was fatal)
4850#
4851# Note: If action is "stop", a STOP event will eventually follow the
4852#       BLOCK_IO_ERROR event.
4853#
4854# Example:
4855#
4856# <- { "event": "BLOCK_IMAGE_CORRUPTED",
4857#      "data": { "device": "ide0-hd0", "node-name": "node0",
4858#                "msg": "Prevented active L1 table overwrite", "offset": 196608,
4859#                "size": 65536 },
4860#      "timestamp": { "seconds": 1378126126, "microseconds": 966463 } }
4861#
4862# Since: 1.7
4863##
4864{ 'event': 'BLOCK_IMAGE_CORRUPTED',
4865  'data': { 'device'     : 'str',
4866            '*node-name' : 'str',
4867            'msg'        : 'str',
4868            '*offset'    : 'int',
4869            '*size'      : 'int',
4870            'fatal'      : 'bool' } }
4871
4872##
4873# @BLOCK_IO_ERROR:
4874#
4875# Emitted when a disk I/O error occurs
4876#
4877# @device: device name. This is always present for compatibility
4878#          reasons, but it can be empty ("") if the image does not
4879#          have a device name associated.
4880#
4881# @node-name: node name. Note that errors may be reported for the root node
4882#             that is directly attached to a guest device rather than for the
4883#             node where the error occurred. The node name is not present if
4884#             the drive is empty. (Since: 2.8)
4885#
4886# @operation: I/O operation
4887#
4888# @action: action that has been taken
4889#
4890# @nospace: true if I/O error was caused due to a no-space
4891#           condition. This key is only present if query-block's
4892#           io-status is present, please see query-block documentation
4893#           for more information (since: 2.2)
4894#
4895# @reason: human readable string describing the error cause.
4896#          (This field is a debugging aid for humans, it should not
4897#          be parsed by applications) (since: 2.2)
4898#
4899# Note: If action is "stop", a STOP event will eventually follow the
4900#       BLOCK_IO_ERROR event
4901#
4902# Since: 0.13
4903#
4904# Example:
4905#
4906# <- { "event": "BLOCK_IO_ERROR",
4907#      "data": { "device": "ide0-hd1",
4908#                "node-name": "#block212",
4909#                "operation": "write",
4910#                "action": "stop" },
4911#      "timestamp": { "seconds": 1265044230, "microseconds": 450486 } }
4912#
4913##
4914{ 'event': 'BLOCK_IO_ERROR',
4915  'data': { 'device': 'str', '*node-name': 'str',
4916            'operation': 'IoOperationType',
4917            'action': 'BlockErrorAction', '*nospace': 'bool',
4918            'reason': 'str' } }
4919
4920##
4921# @BLOCK_JOB_COMPLETED:
4922#
4923# Emitted when a block job has completed
4924#
4925# @type: job type
4926#
4927# @device: The job identifier. Originally the device name but other
4928#          values are allowed since QEMU 2.7
4929#
4930# @len: maximum progress value
4931#
4932# @offset: current progress value. On success this is equal to len.
4933#          On failure this is less than len
4934#
4935# @speed: rate limit, bytes per second
4936#
4937# @error: error message. Only present on failure. This field
4938#         contains a human-readable error message. There are no semantics
4939#         other than that streaming has failed and clients should not try to
4940#         interpret the error string
4941#
4942# Since: 1.1
4943#
4944# Example:
4945#
4946# <- { "event": "BLOCK_JOB_COMPLETED",
4947#      "data": { "type": "stream", "device": "virtio-disk0",
4948#                "len": 10737418240, "offset": 10737418240,
4949#                "speed": 0 },
4950#      "timestamp": { "seconds": 1267061043, "microseconds": 959568 } }
4951#
4952##
4953{ 'event': 'BLOCK_JOB_COMPLETED',
4954  'data': { 'type'  : 'JobType',
4955            'device': 'str',
4956            'len'   : 'int',
4957            'offset': 'int',
4958            'speed' : 'int',
4959            '*error': 'str' } }
4960
4961##
4962# @BLOCK_JOB_CANCELLED:
4963#
4964# Emitted when a block job has been cancelled
4965#
4966# @type: job type
4967#
4968# @device: The job identifier. Originally the device name but other
4969#          values are allowed since QEMU 2.7
4970#
4971# @len: maximum progress value
4972#
4973# @offset: current progress value. On success this is equal to len.
4974#          On failure this is less than len
4975#
4976# @speed: rate limit, bytes per second
4977#
4978# Since: 1.1
4979#
4980# Example:
4981#
4982# <- { "event": "BLOCK_JOB_CANCELLED",
4983#      "data": { "type": "stream", "device": "virtio-disk0",
4984#                "len": 10737418240, "offset": 134217728,
4985#                "speed": 0 },
4986#      "timestamp": { "seconds": 1267061043, "microseconds": 959568 } }
4987#
4988##
4989{ 'event': 'BLOCK_JOB_CANCELLED',
4990  'data': { 'type'  : 'JobType',
4991            'device': 'str',
4992            'len'   : 'int',
4993            'offset': 'int',
4994            'speed' : 'int' } }
4995
4996##
4997# @BLOCK_JOB_ERROR:
4998#
4999# Emitted when a block job encounters an error
5000#
5001# @device: The job identifier. Originally the device name but other
5002#          values are allowed since QEMU 2.7
5003#
5004# @operation: I/O operation
5005#
5006# @action: action that has been taken
5007#
5008# Since: 1.3
5009#
5010# Example:
5011#
5012# <- { "event": "BLOCK_JOB_ERROR",
5013#      "data": { "device": "ide0-hd1",
5014#                "operation": "write",
5015#                "action": "stop" },
5016#      "timestamp": { "seconds": 1265044230, "microseconds": 450486 } }
5017#
5018##
5019{ 'event': 'BLOCK_JOB_ERROR',
5020  'data': { 'device'   : 'str',
5021            'operation': 'IoOperationType',
5022            'action'   : 'BlockErrorAction' } }
5023
5024##
5025# @BLOCK_JOB_READY:
5026#
5027# Emitted when a block job is ready to complete
5028#
5029# @type: job type
5030#
5031# @device: The job identifier. Originally the device name but other
5032#          values are allowed since QEMU 2.7
5033#
5034# @len: maximum progress value
5035#
5036# @offset: current progress value. On success this is equal to len.
5037#          On failure this is less than len
5038#
5039# @speed: rate limit, bytes per second
5040#
5041# Note: The "ready to complete" status is always reset by a @BLOCK_JOB_ERROR
5042#       event
5043#
5044# Since: 1.3
5045#
5046# Example:
5047#
5048# <- { "event": "BLOCK_JOB_READY",
5049#      "data": { "device": "drive0", "type": "mirror", "speed": 0,
5050#                "len": 2097152, "offset": 2097152 }
5051#      "timestamp": { "seconds": 1265044230, "microseconds": 450486 } }
5052#
5053##
5054{ 'event': 'BLOCK_JOB_READY',
5055  'data': { 'type'  : 'JobType',
5056            'device': 'str',
5057            'len'   : 'int',
5058            'offset': 'int',
5059            'speed' : 'int' } }
5060
5061##
5062# @BLOCK_JOB_PENDING:
5063#
5064# Emitted when a block job is awaiting explicit authorization to finalize graph
5065# changes via @block-job-finalize. If this job is part of a transaction, it will
5066# not emit this event until the transaction has converged first.
5067#
5068# @type: job type
5069#
5070# @id: The job identifier.
5071#
5072# Since: 2.12
5073#
5074# Example:
5075#
5076# <- { "event": "BLOCK_JOB_WAITING",
5077#      "data": { "device": "drive0", "type": "mirror" },
5078#      "timestamp": { "seconds": 1265044230, "microseconds": 450486 } }
5079#
5080##
5081{ 'event': 'BLOCK_JOB_PENDING',
5082  'data': { 'type'  : 'JobType',
5083            'id'    : 'str' } }
5084
5085##
5086# @PreallocMode:
5087#
5088# Preallocation mode of QEMU image file
5089#
5090# @off: no preallocation
5091# @metadata: preallocate only for metadata
5092# @falloc: like @full preallocation but allocate disk space by
5093#          posix_fallocate() rather than writing data.
5094# @full: preallocate all data by writing it to the device to ensure
5095#        disk space is really available. This data may or may not be
5096#        zero, depending on the image format and storage.
5097#        @full preallocation also sets up metadata correctly.
5098#
5099# Since: 2.2
5100##
5101{ 'enum': 'PreallocMode',
5102  'data': [ 'off', 'metadata', 'falloc', 'full' ] }
5103
5104##
5105# @BLOCK_WRITE_THRESHOLD:
5106#
5107# Emitted when writes on block device reaches or exceeds the
5108# configured write threshold. For thin-provisioned devices, this
5109# means the device should be extended to avoid pausing for
5110# disk exhaustion.
5111# The event is one shot. Once triggered, it needs to be
5112# re-registered with another block-set-write-threshold command.
5113#
5114# @node-name: graph node name on which the threshold was exceeded.
5115#
5116# @amount-exceeded: amount of data which exceeded the threshold, in bytes.
5117#
5118# @write-threshold: last configured threshold, in bytes.
5119#
5120# Since: 2.3
5121##
5122{ 'event': 'BLOCK_WRITE_THRESHOLD',
5123  'data': { 'node-name': 'str',
5124            'amount-exceeded': 'uint64',
5125            'write-threshold': 'uint64' } }
5126
5127##
5128# @block-set-write-threshold:
5129#
5130# Change the write threshold for a block drive. An event will be
5131# delivered if a write to this block drive crosses the configured
5132# threshold.  The threshold is an offset, thus must be
5133# non-negative. Default is no write threshold. Setting the threshold
5134# to zero disables it.
5135#
5136# This is useful to transparently resize thin-provisioned drives without
5137# the guest OS noticing.
5138#
5139# @node-name: graph node name on which the threshold must be set.
5140#
5141# @write-threshold: configured threshold for the block device, bytes.
5142#                   Use 0 to disable the threshold.
5143#
5144# Since: 2.3
5145#
5146# Example:
5147#
5148# -> { "execute": "block-set-write-threshold",
5149#      "arguments": { "node-name": "mydev",
5150#                     "write-threshold": 17179869184 } }
5151# <- { "return": {} }
5152#
5153##
5154{ 'command': 'block-set-write-threshold',
5155  'data': { 'node-name': 'str', 'write-threshold': 'uint64' } }
5156
5157##
5158# @x-blockdev-change:
5159#
5160# Dynamically reconfigure the block driver state graph. It can be used
5161# to add, remove, insert or replace a graph node. Currently only the
5162# Quorum driver implements this feature to add or remove its child. This
5163# is useful to fix a broken quorum child.
5164#
5165# If @node is specified, it will be inserted under @parent. @child
5166# may not be specified in this case. If both @parent and @child are
5167# specified but @node is not, @child will be detached from @parent.
5168#
5169# @parent: the id or name of the parent node.
5170#
5171# @child: the name of a child under the given parent node.
5172#
5173# @node: the name of the node that will be added.
5174#
5175# Note: this command is experimental, and its API is not stable. It
5176#       does not support all kinds of operations, all kinds of children, nor
5177#       all block drivers.
5178#
5179#       FIXME Removing children from a quorum node means introducing gaps in the
5180#       child indices. This cannot be represented in the 'children' list of
5181#       BlockdevOptionsQuorum, as returned by .bdrv_refresh_filename().
5182#
5183#       Warning: The data in a new quorum child MUST be consistent with that of
5184#       the rest of the array.
5185#
5186# Since: 2.7
5187#
5188# Example:
5189#
5190# 1. Add a new node to a quorum
5191# -> { "execute": "blockdev-add",
5192#      "arguments": {
5193#          "driver": "raw",
5194#          "node-name": "new_node",
5195#          "file": { "driver": "file",
5196#                    "filename": "test.raw" } } }
5197# <- { "return": {} }
5198# -> { "execute": "x-blockdev-change",
5199#      "arguments": { "parent": "disk1",
5200#                     "node": "new_node" } }
5201# <- { "return": {} }
5202#
5203# 2. Delete a quorum's node
5204# -> { "execute": "x-blockdev-change",
5205#      "arguments": { "parent": "disk1",
5206#                     "child": "children.1" } }
5207# <- { "return": {} }
5208#
5209##
5210{ 'command': 'x-blockdev-change',
5211  'data' : { 'parent': 'str',
5212             '*child': 'str',
5213             '*node': 'str' } }
5214
5215##
5216# @x-blockdev-set-iothread:
5217#
5218# Move @node and its children into the @iothread.  If @iothread is null then
5219# move @node and its children into the main loop.
5220#
5221# The node must not be attached to a BlockBackend.
5222#
5223# @node-name: the name of the block driver node
5224#
5225# @iothread: the name of the IOThread object or null for the main loop
5226#
5227# @force: true if the node and its children should be moved when a BlockBackend
5228#         is already attached
5229#
5230# Note: this command is experimental and intended for test cases that need
5231#       control over IOThreads only.
5232#
5233# Since: 2.12
5234#
5235# Example:
5236#
5237# 1. Move a node into an IOThread
5238# -> { "execute": "x-blockdev-set-iothread",
5239#      "arguments": { "node-name": "disk1",
5240#                     "iothread": "iothread0" } }
5241# <- { "return": {} }
5242#
5243# 2. Move a node into the main loop
5244# -> { "execute": "x-blockdev-set-iothread",
5245#      "arguments": { "node-name": "disk1",
5246#                     "iothread": null } }
5247# <- { "return": {} }
5248#
5249##
5250{ 'command': 'x-blockdev-set-iothread',
5251  'data' : { 'node-name': 'str',
5252             'iothread': 'StrOrNull',
5253             '*force': 'bool' } }
5254
5255##
5256# @QuorumOpType:
5257#
5258# An enumeration of the quorum operation types
5259#
5260# @read: read operation
5261#
5262# @write: write operation
5263#
5264# @flush: flush operation
5265#
5266# Since: 2.6
5267##
5268{ 'enum': 'QuorumOpType',
5269  'data': [ 'read', 'write', 'flush' ] }
5270
5271##
5272# @QUORUM_FAILURE:
5273#
5274# Emitted by the Quorum block driver if it fails to establish a quorum
5275#
5276# @reference: device name if defined else node name
5277#
5278# @sector-num: number of the first sector of the failed read operation
5279#
5280# @sectors-count: failed read operation sector count
5281#
5282# Note: This event is rate-limited.
5283#
5284# Since: 2.0
5285#
5286# Example:
5287#
5288# <- { "event": "QUORUM_FAILURE",
5289#      "data": { "reference": "usr1", "sector-num": 345435, "sectors-count": 5 },
5290#      "timestamp": { "seconds": 1344522075, "microseconds": 745528 } }
5291#
5292##
5293{ 'event': 'QUORUM_FAILURE',
5294  'data': { 'reference': 'str', 'sector-num': 'int', 'sectors-count': 'int' } }
5295
5296##
5297# @QUORUM_REPORT_BAD:
5298#
5299# Emitted to report a corruption of a Quorum file
5300#
5301# @type: quorum operation type (Since 2.6)
5302#
5303# @error: error message. Only present on failure. This field
5304#         contains a human-readable error message. There are no semantics other
5305#         than that the block layer reported an error and clients should not
5306#         try to interpret the error string.
5307#
5308# @node-name: the graph node name of the block driver state
5309#
5310# @sector-num: number of the first sector of the failed read operation
5311#
5312# @sectors-count: failed read operation sector count
5313#
5314# Note: This event is rate-limited.
5315#
5316# Since: 2.0
5317#
5318# Example:
5319#
5320# 1. Read operation
5321#
5322# { "event": "QUORUM_REPORT_BAD",
5323#      "data": { "node-name": "node0", "sector-num": 345435, "sectors-count": 5,
5324#                "type": "read" },
5325#      "timestamp": { "seconds": 1344522075, "microseconds": 745528 } }
5326#
5327# 2. Flush operation
5328#
5329# { "event": "QUORUM_REPORT_BAD",
5330#      "data": { "node-name": "node0", "sector-num": 0, "sectors-count": 2097120,
5331#                "type": "flush", "error": "Broken pipe" },
5332#      "timestamp": { "seconds": 1456406829, "microseconds": 291763 } }
5333#
5334##
5335{ 'event': 'QUORUM_REPORT_BAD',
5336  'data': { 'type': 'QuorumOpType', '*error': 'str', 'node-name': 'str',
5337            'sector-num': 'int', 'sectors-count': 'int' } }
5338
5339##
5340# @BlockdevSnapshotInternal:
5341#
5342# @device: the device name or node-name of a root node to generate the snapshot
5343#          from
5344#
5345# @name: the name of the internal snapshot to be created
5346#
5347# Notes: In transaction, if @name is empty, or any snapshot matching @name
5348#        exists, the operation will fail. Only some image formats support it,
5349#        for example, qcow2, and rbd.
5350#
5351# Since: 1.7
5352##
5353{ 'struct': 'BlockdevSnapshotInternal',
5354  'data': { 'device': 'str', 'name': 'str' } }
5355
5356##
5357# @blockdev-snapshot-internal-sync:
5358#
5359# Synchronously take an internal snapshot of a block device, when the
5360# format of the image used supports it. If the name is an empty
5361# string, or a snapshot with name already exists, the operation will
5362# fail.
5363#
5364# For the arguments, see the documentation of BlockdevSnapshotInternal.
5365#
5366# Returns: - nothing on success
5367#          - If @device is not a valid block device, GenericError
5368#          - If any snapshot matching @name exists, or @name is empty,
5369#            GenericError
5370#          - If the format of the image used does not support it,
5371#            BlockFormatFeatureNotSupported
5372#
5373# Since: 1.7
5374#
5375# Example:
5376#
5377# -> { "execute": "blockdev-snapshot-internal-sync",
5378#      "arguments": { "device": "ide-hd0",
5379#                     "name": "snapshot0" }
5380#    }
5381# <- { "return": {} }
5382#
5383##
5384{ 'command': 'blockdev-snapshot-internal-sync',
5385  'data': 'BlockdevSnapshotInternal' }
5386
5387##
5388# @blockdev-snapshot-delete-internal-sync:
5389#
5390# Synchronously delete an internal snapshot of a block device, when the format
5391# of the image used support it. The snapshot is identified by name or id or
5392# both. One of the name or id is required. Return SnapshotInfo for the
5393# successfully deleted snapshot.
5394#
5395# @device: the device name or node-name of a root node to delete the snapshot
5396#          from
5397#
5398# @id: optional the snapshot's ID to be deleted
5399#
5400# @name: optional the snapshot's name to be deleted
5401#
5402# Returns: - SnapshotInfo on success
5403#          - If @device is not a valid block device, GenericError
5404#          - If snapshot not found, GenericError
5405#          - If the format of the image used does not support it,
5406#            BlockFormatFeatureNotSupported
5407#          - If @id and @name are both not specified, GenericError
5408#
5409# Since: 1.7
5410#
5411# Example:
5412#
5413# -> { "execute": "blockdev-snapshot-delete-internal-sync",
5414#      "arguments": { "device": "ide-hd0",
5415#                     "name": "snapshot0" }
5416#    }
5417# <- { "return": {
5418#                    "id": "1",
5419#                    "name": "snapshot0",
5420#                    "vm-state-size": 0,
5421#                    "date-sec": 1000012,
5422#                    "date-nsec": 10,
5423#                    "vm-clock-sec": 100,
5424#                    "vm-clock-nsec": 20,
5425#                    "icount": 220414
5426#      }
5427#    }
5428#
5429##
5430{ 'command': 'blockdev-snapshot-delete-internal-sync',
5431  'data': { 'device': 'str', '*id': 'str', '*name': 'str'},
5432  'returns': 'SnapshotInfo' }
5433