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