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