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