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