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