OSDN Git Service

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