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