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