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