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