OSDN Git Service

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