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