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