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