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