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