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