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