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