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