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