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