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