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