qcow2: add support for LUKS encryption format
[qemu/kevin.git] / qapi / block-core.json
blobbb075c098f60ca0def9a5f22a44986b0b75d9ac0
1 # -*- Mode: Python -*-
3 ##
4 # == QAPI block core definitions (vm unrelated)
5 ##
7 # QAPI common definitions
8 { 'include': 'common.json' }
11 # @SnapshotInfo:
13 # @id: unique snapshot id
15 # @name: user chosen name
17 # @vm-state-size: size of the VM state
19 # @date-sec: UTC date of the snapshot in seconds
21 # @date-nsec: fractional part in nano seconds to be used with date-sec
23 # @vm-clock-sec: VM clock relative to boot in seconds
25 # @vm-clock-nsec: fractional part in nano seconds to be used with vm-clock-sec
27 # Since: 1.3
30 { 'struct': 'SnapshotInfo',
31   'data': { 'id': 'str', 'name': 'str', 'vm-state-size': 'int',
32             'date-sec': 'int', 'date-nsec': 'int',
33             'vm-clock-sec': 'int', 'vm-clock-nsec': 'int' } }
36 # @ImageInfoSpecificQCow2:
38 # @compat: compatibility level
40 # @lazy-refcounts: on or off; only valid for compat >= 1.1
42 # @corrupt: true if the image has been marked corrupt; only valid for
43 #           compat >= 1.1 (since 2.2)
45 # @refcount-bits: width of a refcount entry in bits (since 2.3)
47 # Since: 1.7
49 { 'struct': 'ImageInfoSpecificQCow2',
50   'data': {
51       'compat': 'str',
52       '*lazy-refcounts': 'bool',
53       '*corrupt': 'bool',
54       'refcount-bits': 'int'
55   } }
58 # @ImageInfoSpecificVmdk:
60 # @create-type: The create type of VMDK image
62 # @cid: Content id of image
64 # @parent-cid: Parent VMDK image's cid
66 # @extents: List of extent files
68 # Since: 1.7
70 { 'struct': 'ImageInfoSpecificVmdk',
71   'data': {
72       'create-type': 'str',
73       'cid': 'int',
74       'parent-cid': 'int',
75       'extents': ['ImageInfo']
76   } }
79 # @ImageInfoSpecific:
81 # A discriminated record of image format specific information structures.
83 # Since: 1.7
85 { 'union': 'ImageInfoSpecific',
86   'data': {
87       'qcow2': 'ImageInfoSpecificQCow2',
88       'vmdk': 'ImageInfoSpecificVmdk',
89       # If we need to add block driver specific parameters for
90       # LUKS in future, then we'll subclass QCryptoBlockInfoLUKS
91       # to define a ImageInfoSpecificLUKS
92       'luks': 'QCryptoBlockInfoLUKS'
93   } }
96 # @ImageInfo:
98 # Information about a QEMU image file
100 # @filename: name of the image file
102 # @format: format of the image file
104 # @virtual-size: maximum capacity in bytes of the image
106 # @actual-size: actual size on disk in bytes of the image
108 # @dirty-flag: true if image is not cleanly closed
110 # @cluster-size: size of a cluster in bytes
112 # @encrypted: true if the image is encrypted
114 # @compressed: true if the image is compressed (Since 1.7)
116 # @backing-filename: name of the backing file
118 # @full-backing-filename: full path of the backing file
120 # @backing-filename-format: the format of the backing file
122 # @snapshots: list of VM snapshots
124 # @backing-image: info of the backing image (since 1.6)
126 # @format-specific: structure supplying additional format-specific
127 # information (since 1.7)
129 # Since: 1.3
132 { 'struct': 'ImageInfo',
133   'data': {'filename': 'str', 'format': 'str', '*dirty-flag': 'bool',
134            '*actual-size': 'int', 'virtual-size': 'int',
135            '*cluster-size': 'int', '*encrypted': 'bool', '*compressed': 'bool',
136            '*backing-filename': 'str', '*full-backing-filename': 'str',
137            '*backing-filename-format': 'str', '*snapshots': ['SnapshotInfo'],
138            '*backing-image': 'ImageInfo',
139            '*format-specific': 'ImageInfoSpecific' } }
142 # @ImageCheck:
144 # Information about a QEMU image file check
146 # @filename: name of the image file checked
148 # @format: format of the image file checked
150 # @check-errors: number of unexpected errors occurred during check
152 # @image-end-offset: offset (in bytes) where the image ends, this
153 #                    field is present if the driver for the image format
154 #                    supports it
156 # @corruptions: number of corruptions found during the check if any
158 # @leaks: number of leaks found during the check if any
160 # @corruptions-fixed: number of corruptions fixed during the check
161 #                     if any
163 # @leaks-fixed: number of leaks fixed during the check if any
165 # @total-clusters: total number of clusters, this field is present
166 #                  if the driver for the image format supports it
168 # @allocated-clusters: total number of allocated clusters, this
169 #                      field is present if the driver for the image format
170 #                      supports it
172 # @fragmented-clusters: total number of fragmented clusters, this
173 #                       field is present if the driver for the image format
174 #                       supports it
176 # @compressed-clusters: total number of compressed clusters, this
177 #                       field is present if the driver for the image format
178 #                       supports it
180 # Since: 1.4
183 { 'struct': 'ImageCheck',
184   'data': {'filename': 'str', 'format': 'str', 'check-errors': 'int',
185            '*image-end-offset': 'int', '*corruptions': 'int', '*leaks': 'int',
186            '*corruptions-fixed': 'int', '*leaks-fixed': 'int',
187            '*total-clusters': 'int', '*allocated-clusters': 'int',
188            '*fragmented-clusters': 'int', '*compressed-clusters': 'int' } }
191 # @MapEntry:
193 # Mapping information from a virtual block range to a host file range
195 # @start: the start byte of the mapped virtual range
197 # @length: the number of bytes of the mapped virtual range
199 # @data: whether the mapped range has data
201 # @zero: whether the virtual blocks are zeroed
203 # @depth: the depth of the mapping
205 # @offset: the offset in file that the virtual sectors are mapped to
207 # @filename: filename that is referred to by @offset
209 # Since: 2.6
212 { 'struct': 'MapEntry',
213   'data': {'start': 'int', 'length': 'int', 'data': 'bool',
214            'zero': 'bool', 'depth': 'int', '*offset': 'int',
215            '*filename': 'str' } }
218 # @BlockdevCacheInfo:
220 # Cache mode information for a block device
222 # @writeback:   true if writeback mode is enabled
223 # @direct:      true if the host page cache is bypassed (O_DIRECT)
224 # @no-flush:    true if flush requests are ignored for the device
226 # Since: 2.3
228 { 'struct': 'BlockdevCacheInfo',
229   'data': { 'writeback': 'bool',
230             'direct': 'bool',
231             'no-flush': 'bool' } }
234 # @BlockDeviceInfo:
236 # Information about the backing device for a block device.
238 # @file: the filename of the backing device
240 # @node-name: the name of the block driver node (Since 2.0)
242 # @ro: true if the backing device was open read-only
244 # @drv: the name of the block format used to open the backing device. As of
245 #       0.14.0 this can be: 'blkdebug', 'bochs', 'cloop', 'cow', 'dmg',
246 #       'file', 'file', 'ftp', 'ftps', 'host_cdrom', 'host_device',
247 #       'http', 'https', 'luks', 'nbd', 'parallels', 'qcow',
248 #       'qcow2', 'raw', 'vdi', 'vmdk', 'vpc', 'vvfat'
249 #       2.2: 'archipelago' added, 'cow' dropped
250 #       2.3: 'host_floppy' deprecated
251 #       2.5: 'host_floppy' dropped
252 #       2.6: 'luks' added
253 #       2.8: 'replication' added, 'tftp' dropped
254 #       2.9: 'archipelago' dropped
256 # @backing_file: the name of the backing file (for copy-on-write)
258 # @backing_file_depth: number of files in the backing file chain (since: 1.2)
260 # @encrypted: true if the backing device is encrypted
262 # @encryption_key_missing: true if the backing device is encrypted but an
263 #                          valid encryption key is missing
265 # @detect_zeroes: detect and optimize zero writes (Since 2.1)
267 # @bps: total throughput limit in bytes per second is specified
269 # @bps_rd: read throughput limit in bytes per second is specified
271 # @bps_wr: write throughput limit in bytes per second is specified
273 # @iops: total I/O operations per second is specified
275 # @iops_rd: read I/O operations per second is specified
277 # @iops_wr: write I/O operations per second is specified
279 # @image: the info of image used (since: 1.6)
281 # @bps_max: total throughput limit during bursts,
282 #                     in bytes (Since 1.7)
284 # @bps_rd_max: read throughput limit during bursts,
285 #                        in bytes (Since 1.7)
287 # @bps_wr_max: write throughput limit during bursts,
288 #                        in bytes (Since 1.7)
290 # @iops_max: total I/O operations per second during bursts,
291 #                      in bytes (Since 1.7)
293 # @iops_rd_max: read I/O operations per second during bursts,
294 #                         in bytes (Since 1.7)
296 # @iops_wr_max: write I/O operations per second during bursts,
297 #                         in bytes (Since 1.7)
299 # @bps_max_length: maximum length of the @bps_max burst
300 #                            period, in seconds. (Since 2.6)
302 # @bps_rd_max_length: maximum length of the @bps_rd_max
303 #                               burst period, in seconds. (Since 2.6)
305 # @bps_wr_max_length: maximum length of the @bps_wr_max
306 #                               burst period, in seconds. (Since 2.6)
308 # @iops_max_length: maximum length of the @iops burst
309 #                             period, in seconds. (Since 2.6)
311 # @iops_rd_max_length: maximum length of the @iops_rd_max
312 #                                burst period, in seconds. (Since 2.6)
314 # @iops_wr_max_length: maximum length of the @iops_wr_max
315 #                                burst period, in seconds. (Since 2.6)
317 # @iops_size: an I/O size in bytes (Since 1.7)
319 # @group: throttle group name (Since 2.4)
321 # @cache: the cache mode used for the block device (since: 2.3)
323 # @write_threshold: configured write threshold for the device.
324 #                   0 if disabled. (Since 2.3)
326 # Since: 0.14.0
329 { 'struct': 'BlockDeviceInfo',
330   'data': { 'file': 'str', '*node-name': 'str', 'ro': 'bool', 'drv': 'str',
331             '*backing_file': 'str', 'backing_file_depth': 'int',
332             'encrypted': 'bool', 'encryption_key_missing': 'bool',
333             'detect_zeroes': 'BlockdevDetectZeroesOptions',
334             'bps': 'int', 'bps_rd': 'int', 'bps_wr': 'int',
335             'iops': 'int', 'iops_rd': 'int', 'iops_wr': 'int',
336             'image': 'ImageInfo',
337             '*bps_max': 'int', '*bps_rd_max': 'int',
338             '*bps_wr_max': 'int', '*iops_max': 'int',
339             '*iops_rd_max': 'int', '*iops_wr_max': 'int',
340             '*bps_max_length': 'int', '*bps_rd_max_length': 'int',
341             '*bps_wr_max_length': 'int', '*iops_max_length': 'int',
342             '*iops_rd_max_length': 'int', '*iops_wr_max_length': 'int',
343             '*iops_size': 'int', '*group': 'str', 'cache': 'BlockdevCacheInfo',
344             'write_threshold': 'int' } }
347 # @BlockDeviceIoStatus:
349 # An enumeration of block device I/O status.
351 # @ok: The last I/O operation has succeeded
353 # @failed: The last I/O operation has failed
355 # @nospace: The last I/O operation has failed due to a no-space condition
357 # Since: 1.0
359 { 'enum': 'BlockDeviceIoStatus', 'data': [ 'ok', 'failed', 'nospace' ] }
362 # @BlockDeviceMapEntry:
364 # Entry in the metadata map of the device (returned by "qemu-img map")
366 # @start: Offset in the image of the first byte described by this entry
367 #         (in bytes)
369 # @length: Length of the range described by this entry (in bytes)
371 # @depth: Number of layers (0 = top image, 1 = top image's backing file, etc.)
372 #         before reaching one for which the range is allocated.  The value is
373 #         in the range 0 to the depth of the image chain - 1.
375 # @zero: the sectors in this range read as zeros
377 # @data: reading the image will actually read data from a file (in particular,
378 #        if @offset is present this means that the sectors are not simply
379 #        preallocated, but contain actual data in raw format)
381 # @offset: if present, the image file stores the data for this range in
382 #          raw format at the given offset.
384 # Since: 1.7
386 { 'struct': 'BlockDeviceMapEntry',
387   'data': { 'start': 'int', 'length': 'int', 'depth': 'int', 'zero': 'bool',
388             'data': 'bool', '*offset': 'int' } }
391 # @DirtyBitmapStatus:
393 # An enumeration of possible states that a dirty bitmap can report to the user.
395 # @frozen: The bitmap is currently in-use by a backup operation or block job,
396 #          and is immutable.
398 # @disabled: The bitmap is currently in-use by an internal operation and is
399 #            read-only. It can still be deleted.
401 # @active: The bitmap is actively monitoring for new writes, and can be cleared,
402 #          deleted, or used for backup operations.
404 # Since: 2.4
406 { 'enum': 'DirtyBitmapStatus',
407   'data': ['active', 'disabled', 'frozen'] }
410 # @BlockDirtyInfo:
412 # Block dirty bitmap information.
414 # @name: the name of the dirty bitmap (Since 2.4)
416 # @count: number of dirty bytes according to the dirty bitmap
418 # @granularity: granularity of the dirty bitmap in bytes (since 1.4)
420 # @status: current status of the dirty bitmap (since 2.4)
422 # Since: 1.3
424 { 'struct': 'BlockDirtyInfo',
425   'data': {'*name': 'str', 'count': 'int', 'granularity': 'uint32',
426            'status': 'DirtyBitmapStatus'} }
429 # @BlockInfo:
431 # Block device information.  This structure describes a virtual device and
432 # the backing device associated with it.
434 # @device: The device name associated with the virtual device.
436 # @type: This field is returned only for compatibility reasons, it should
437 #        not be used (always returns 'unknown')
439 # @removable: True if the device supports removable media.
441 # @locked: True if the guest has locked this device from having its media
442 #          removed
444 # @tray_open: True if the device's tray is open
445 #             (only present if it has a tray)
447 # @dirty-bitmaps: dirty bitmaps information (only present if the
448 #                 driver has one or more dirty bitmaps) (Since 2.0)
450 # @io-status: @BlockDeviceIoStatus. Only present if the device
451 #             supports it and the VM is configured to stop on errors
452 #             (supported device models: virtio-blk, IDE, SCSI except
453 #             scsi-generic)
455 # @inserted: @BlockDeviceInfo describing the device if media is
456 #            present
458 # Since:  0.14.0
460 { 'struct': 'BlockInfo',
461   'data': {'device': 'str', 'type': 'str', 'removable': 'bool',
462            'locked': 'bool', '*inserted': 'BlockDeviceInfo',
463            '*tray_open': 'bool', '*io-status': 'BlockDeviceIoStatus',
464            '*dirty-bitmaps': ['BlockDirtyInfo'] } }
467 # @query-block:
469 # Get a list of BlockInfo for all virtual block devices.
471 # Returns: a list of @BlockInfo describing each virtual block device
473 # Since: 0.14.0
475 # Example:
477 # -> { "execute": "query-block" }
478 # <- {
479 #       "return":[
480 #          {
481 #             "io-status": "ok",
482 #             "device":"ide0-hd0",
483 #             "locked":false,
484 #             "removable":false,
485 #             "inserted":{
486 #                "ro":false,
487 #                "drv":"qcow2",
488 #                "encrypted":false,
489 #                "file":"disks/test.qcow2",
490 #                "backing_file_depth":1,
491 #                "bps":1000000,
492 #                "bps_rd":0,
493 #                "bps_wr":0,
494 #                "iops":1000000,
495 #                "iops_rd":0,
496 #                "iops_wr":0,
497 #                "bps_max": 8000000,
498 #                "bps_rd_max": 0,
499 #                "bps_wr_max": 0,
500 #                "iops_max": 0,
501 #                "iops_rd_max": 0,
502 #                "iops_wr_max": 0,
503 #                "iops_size": 0,
504 #                "detect_zeroes": "on",
505 #                "write_threshold": 0,
506 #                "image":{
507 #                   "filename":"disks/test.qcow2",
508 #                   "format":"qcow2",
509 #                   "virtual-size":2048000,
510 #                   "backing_file":"base.qcow2",
511 #                   "full-backing-filename":"disks/base.qcow2",
512 #                   "backing-filename-format":"qcow2",
513 #                   "snapshots":[
514 #                      {
515 #                         "id": "1",
516 #                         "name": "snapshot1",
517 #                         "vm-state-size": 0,
518 #                         "date-sec": 10000200,
519 #                         "date-nsec": 12,
520 #                         "vm-clock-sec": 206,
521 #                         "vm-clock-nsec": 30
522 #                      }
523 #                   ],
524 #                   "backing-image":{
525 #                       "filename":"disks/base.qcow2",
526 #                       "format":"qcow2",
527 #                       "virtual-size":2048000
528 #                   }
529 #                }
530 #             },
531 #             "type":"unknown"
532 #          },
533 #          {
534 #             "io-status": "ok",
535 #             "device":"ide1-cd0",
536 #             "locked":false,
537 #             "removable":true,
538 #             "type":"unknown"
539 #          },
540 #          {
541 #             "device":"floppy0",
542 #             "locked":false,
543 #             "removable":true,
544 #             "type":"unknown"
545 #          },
546 #          {
547 #             "device":"sd0",
548 #             "locked":false,
549 #             "removable":true,
550 #             "type":"unknown"
551 #          }
552 #       ]
553 #    }
556 { 'command': 'query-block', 'returns': ['BlockInfo'] }
560 # @BlockDeviceTimedStats:
562 # Statistics of a block device during a given interval of time.
564 # @interval_length: Interval used for calculating the statistics,
565 #                   in seconds.
567 # @min_rd_latency_ns: Minimum latency of read operations in the
568 #                     defined interval, in nanoseconds.
570 # @min_wr_latency_ns: Minimum latency of write operations in the
571 #                     defined interval, in nanoseconds.
573 # @min_flush_latency_ns: Minimum latency of flush operations in the
574 #                        defined interval, in nanoseconds.
576 # @max_rd_latency_ns: Maximum latency of read operations in the
577 #                     defined interval, in nanoseconds.
579 # @max_wr_latency_ns: Maximum latency of write operations in the
580 #                     defined interval, in nanoseconds.
582 # @max_flush_latency_ns: Maximum latency of flush operations in the
583 #                        defined interval, in nanoseconds.
585 # @avg_rd_latency_ns: Average latency of read operations in the
586 #                     defined interval, in nanoseconds.
588 # @avg_wr_latency_ns: Average latency of write operations in the
589 #                     defined interval, in nanoseconds.
591 # @avg_flush_latency_ns: Average latency of flush operations in the
592 #                        defined interval, in nanoseconds.
594 # @avg_rd_queue_depth: Average number of pending read operations
595 #                      in the defined interval.
597 # @avg_wr_queue_depth: Average number of pending write operations
598 #                      in the defined interval.
600 # Since: 2.5
602 { 'struct': 'BlockDeviceTimedStats',
603   'data': { 'interval_length': 'int', 'min_rd_latency_ns': 'int',
604             'max_rd_latency_ns': 'int', 'avg_rd_latency_ns': 'int',
605             'min_wr_latency_ns': 'int', 'max_wr_latency_ns': 'int',
606             'avg_wr_latency_ns': 'int', 'min_flush_latency_ns': 'int',
607             'max_flush_latency_ns': 'int', 'avg_flush_latency_ns': 'int',
608             'avg_rd_queue_depth': 'number', 'avg_wr_queue_depth': 'number' } }
611 # @BlockDeviceStats:
613 # Statistics of a virtual block device or a block backing device.
615 # @rd_bytes:      The number of bytes read by the device.
617 # @wr_bytes:      The number of bytes written by the device.
619 # @rd_operations: The number of read operations performed by the device.
621 # @wr_operations: The number of write operations performed by the device.
623 # @flush_operations: The number of cache flush operations performed by the
624 #                    device (since 0.15.0)
626 # @flush_total_time_ns: Total time spend on cache flushes in nano-seconds
627 #                       (since 0.15.0).
629 # @wr_total_time_ns: Total time spend on writes in nano-seconds (since 0.15.0).
631 # @rd_total_time_ns: Total_time_spend on reads in nano-seconds (since 0.15.0).
633 # @wr_highest_offset: The offset after the greatest byte written to the
634 #                     device.  The intended use of this information is for
635 #                     growable sparse files (like qcow2) that are used on top
636 #                     of a physical device.
638 # @rd_merged: Number of read requests that have been merged into another
639 #             request (Since 2.3).
641 # @wr_merged: Number of write requests that have been merged into another
642 #             request (Since 2.3).
644 # @idle_time_ns: Time since the last I/O operation, in
645 #                nanoseconds. If the field is absent it means that
646 #                there haven't been any operations yet (Since 2.5).
648 # @failed_rd_operations: The number of failed read operations
649 #                        performed by the device (Since 2.5)
651 # @failed_wr_operations: The number of failed write operations
652 #                        performed by the device (Since 2.5)
654 # @failed_flush_operations: The number of failed flush operations
655 #                           performed by the device (Since 2.5)
657 # @invalid_rd_operations: The number of invalid read operations
658 #                          performed by the device (Since 2.5)
660 # @invalid_wr_operations: The number of invalid write operations
661 #                         performed by the device (Since 2.5)
663 # @invalid_flush_operations: The number of invalid flush operations
664 #                            performed by the device (Since 2.5)
666 # @account_invalid: Whether invalid operations are included in the
667 #                   last access statistics (Since 2.5)
669 # @account_failed: Whether failed operations are included in the
670 #                  latency and last access statistics (Since 2.5)
672 # @timed_stats: Statistics specific to the set of previously defined
673 #               intervals of time (Since 2.5)
675 # Since: 0.14.0
677 { 'struct': 'BlockDeviceStats',
678   'data': {'rd_bytes': 'int', 'wr_bytes': 'int', 'rd_operations': 'int',
679            'wr_operations': 'int', 'flush_operations': 'int',
680            'flush_total_time_ns': 'int', 'wr_total_time_ns': 'int',
681            'rd_total_time_ns': 'int', 'wr_highest_offset': 'int',
682            'rd_merged': 'int', 'wr_merged': 'int', '*idle_time_ns': 'int',
683            'failed_rd_operations': 'int', 'failed_wr_operations': 'int',
684            'failed_flush_operations': 'int', 'invalid_rd_operations': 'int',
685            'invalid_wr_operations': 'int', 'invalid_flush_operations': 'int',
686            'account_invalid': 'bool', 'account_failed': 'bool',
687            'timed_stats': ['BlockDeviceTimedStats'] } }
690 # @BlockStats:
692 # Statistics of a virtual block device or a block backing device.
694 # @device: If the stats are for a virtual block device, the name
695 #          corresponding to the virtual block device.
697 # @node-name: The node name of the device. (Since 2.3)
699 # @stats:  A @BlockDeviceStats for the device.
701 # @parent: This describes the file block device if it has one.
702 #          Contains recursively the statistics of the underlying
703 #          protocol (e.g. the host file for a qcow2 image). If there is
704 #          no underlying protocol, this field is omitted
706 # @backing: This describes the backing block device if it has one.
707 #           (Since 2.0)
709 # Since: 0.14.0
711 { 'struct': 'BlockStats',
712   'data': {'*device': 'str', '*node-name': 'str',
713            'stats': 'BlockDeviceStats',
714            '*parent': 'BlockStats',
715            '*backing': 'BlockStats'} }
718 # @query-blockstats:
720 # Query the @BlockStats for all virtual block devices.
722 # @query-nodes: If true, the command will query all the block nodes
723 #               that have a node name, in a list which will include "parent"
724 #               information, but not "backing".
725 #               If false or omitted, the behavior is as before - query all the
726 #               device backends, recursively including their "parent" and
727 #               "backing". (Since 2.3)
729 # Returns: A list of @BlockStats for each virtual block devices.
731 # Since: 0.14.0
733 # Example:
735 # -> { "execute": "query-blockstats" }
736 # <- {
737 #       "return":[
738 #          {
739 #             "device":"ide0-hd0",
740 #             "parent":{
741 #                "stats":{
742 #                   "wr_highest_offset":3686448128,
743 #                   "wr_bytes":9786368,
744 #                   "wr_operations":751,
745 #                   "rd_bytes":122567168,
746 #                   "rd_operations":36772
747 #                   "wr_total_times_ns":313253456
748 #                   "rd_total_times_ns":3465673657
749 #                   "flush_total_times_ns":49653
750 #                   "flush_operations":61,
751 #                   "rd_merged":0,
752 #                   "wr_merged":0,
753 #                   "idle_time_ns":2953431879,
754 #                   "account_invalid":true,
755 #                   "account_failed":false
756 #                }
757 #             },
758 #             "stats":{
759 #                "wr_highest_offset":2821110784,
760 #                "wr_bytes":9786368,
761 #                "wr_operations":692,
762 #                "rd_bytes":122739200,
763 #                "rd_operations":36604
764 #                "flush_operations":51,
765 #                "wr_total_times_ns":313253456
766 #                "rd_total_times_ns":3465673657
767 #                "flush_total_times_ns":49653,
768 #                "rd_merged":0,
769 #                "wr_merged":0,
770 #                "idle_time_ns":2953431879,
771 #                "account_invalid":true,
772 #                "account_failed":false
773 #             }
774 #          },
775 #          {
776 #             "device":"ide1-cd0",
777 #             "stats":{
778 #                "wr_highest_offset":0,
779 #                "wr_bytes":0,
780 #                "wr_operations":0,
781 #                "rd_bytes":0,
782 #                "rd_operations":0
783 #                "flush_operations":0,
784 #                "wr_total_times_ns":0
785 #                "rd_total_times_ns":0
786 #                "flush_total_times_ns":0,
787 #                "rd_merged":0,
788 #                "wr_merged":0,
789 #                "account_invalid":false,
790 #                "account_failed":false
791 #             }
792 #          },
793 #          {
794 #             "device":"floppy0",
795 #             "stats":{
796 #                "wr_highest_offset":0,
797 #                "wr_bytes":0,
798 #                "wr_operations":0,
799 #                "rd_bytes":0,
800 #                "rd_operations":0
801 #                "flush_operations":0,
802 #                "wr_total_times_ns":0
803 #                "rd_total_times_ns":0
804 #                "flush_total_times_ns":0,
805 #                "rd_merged":0,
806 #                "wr_merged":0,
807 #                "account_invalid":false,
808 #                "account_failed":false
809 #             }
810 #          },
811 #          {
812 #             "device":"sd0",
813 #             "stats":{
814 #                "wr_highest_offset":0,
815 #                "wr_bytes":0,
816 #                "wr_operations":0,
817 #                "rd_bytes":0,
818 #                "rd_operations":0
819 #                "flush_operations":0,
820 #                "wr_total_times_ns":0
821 #                "rd_total_times_ns":0
822 #                "flush_total_times_ns":0,
823 #                "rd_merged":0,
824 #                "wr_merged":0,
825 #                "account_invalid":false,
826 #                "account_failed":false
827 #             }
828 #          }
829 #       ]
830 #    }
833 { 'command': 'query-blockstats',
834   'data': { '*query-nodes': 'bool' },
835   'returns': ['BlockStats'] }
838 # @BlockdevOnError:
840 # An enumeration of possible behaviors for errors on I/O operations.
841 # The exact meaning depends on whether the I/O was initiated by a guest
842 # or by a block job
844 # @report: for guest operations, report the error to the guest;
845 #          for jobs, cancel the job
847 # @ignore: ignore the error, only report a QMP event (BLOCK_IO_ERROR
848 #          or BLOCK_JOB_ERROR)
850 # @enospc: same as @stop on ENOSPC, same as @report otherwise.
852 # @stop: for guest operations, stop the virtual machine;
853 #        for jobs, pause the job
855 # @auto: inherit the error handling policy of the backend (since: 2.7)
857 # Since: 1.3
859 { 'enum': 'BlockdevOnError',
860   'data': ['report', 'ignore', 'enospc', 'stop', 'auto'] }
863 # @MirrorSyncMode:
865 # An enumeration of possible behaviors for the initial synchronization
866 # phase of storage mirroring.
868 # @top: copies data in the topmost image to the destination
870 # @full: copies data from all images to the destination
872 # @none: only copy data written from now on
874 # @incremental: only copy data described by the dirty bitmap. Since: 2.4
876 # Since: 1.3
878 { 'enum': 'MirrorSyncMode',
879   'data': ['top', 'full', 'none', 'incremental'] }
882 # @BlockJobType:
884 # Type of a block job.
886 # @commit: block commit job type, see "block-commit"
888 # @stream: block stream job type, see "block-stream"
890 # @mirror: drive mirror job type, see "drive-mirror"
892 # @backup: drive backup job type, see "drive-backup"
894 # Since: 1.7
896 { 'enum': 'BlockJobType',
897   'data': ['commit', 'stream', 'mirror', 'backup'] }
900 # @BlockJobInfo:
902 # Information about a long-running block device operation.
904 # @type: the job type ('stream' for image streaming)
906 # @device: The job identifier. Originally the device name but other
907 #          values are allowed since QEMU 2.7
909 # @len: the maximum progress value
911 # @busy: false if the job is known to be in a quiescent state, with
912 #        no pending I/O.  Since 1.3.
914 # @paused: whether the job is paused or, if @busy is true, will
915 #          pause itself as soon as possible.  Since 1.3.
917 # @offset: the current progress value
919 # @speed: the rate limit, bytes per second
921 # @io-status: the status of the job (since 1.3)
923 # @ready: true if the job may be completed (since 2.2)
925 # Since: 1.1
927 { 'struct': 'BlockJobInfo',
928   'data': {'type': 'str', 'device': 'str', 'len': 'int',
929            'offset': 'int', 'busy': 'bool', 'paused': 'bool', 'speed': 'int',
930            'io-status': 'BlockDeviceIoStatus', 'ready': 'bool'} }
933 # @query-block-jobs:
935 # Return information about long-running block device operations.
937 # Returns: a list of @BlockJobInfo for each active block job
939 # Since: 1.1
941 { 'command': 'query-block-jobs', 'returns': ['BlockJobInfo'] }
944 # @block_passwd:
946 # This command sets the password of a block device that has not been open
947 # with a password and requires one.
949 # The two cases where this can happen are a block device is created through
950 # QEMU's initial command line or a block device is changed through the legacy
951 # @change interface.
953 # In the event that the block device is created through the initial command
954 # line, the VM will start in the stopped state regardless of whether '-S' is
955 # used.  The intention is for a management tool to query the block devices to
956 # determine which ones are encrypted, set the passwords with this command, and
957 # then start the guest with the @cont command.
959 # Either @device or @node-name must be set but not both.
961 # @device: the name of the block backend device to set the password on
963 # @node-name: graph node name to set the password on (Since 2.0)
965 # @password: the password to use for the device
967 # Returns: nothing on success
968 #          If @device is not a valid block device, DeviceNotFound
969 #          If @device is not encrypted, DeviceNotEncrypted
971 # Notes:  Not all block formats support encryption and some that do are not
972 #         able to validate that a password is correct.  Disk corruption may
973 #         occur if an invalid password is specified.
975 # Since: 0.14.0
977 # Example:
979 # -> { "execute": "block_passwd", "arguments": { "device": "ide0-hd0",
980 #                                                "password": "12345" } }
981 # <- { "return": {} }
984 { 'command': 'block_passwd', 'data': {'*device': 'str',
985                                       '*node-name': 'str', 'password': 'str'} }
988 # @block_resize:
990 # Resize a block image while a guest is running.
992 # Either @device or @node-name must be set but not both.
994 # @device: the name of the device to get the image resized
996 # @node-name: graph node name to get the image resized (Since 2.0)
998 # @size:  new image size in bytes
1000 # Returns: nothing on success
1001 #          If @device is not a valid block device, DeviceNotFound
1003 # Since: 0.14.0
1005 # Example:
1007 # -> { "execute": "block_resize",
1008 #      "arguments": { "device": "scratch", "size": 1073741824 } }
1009 # <- { "return": {} }
1012 { 'command': 'block_resize', 'data': { '*device': 'str',
1013                                        '*node-name': 'str',
1014                                        'size': 'int' }}
1017 # @NewImageMode:
1019 # An enumeration that tells QEMU how to set the backing file path in
1020 # a new image file.
1022 # @existing: QEMU should look for an existing image file.
1024 # @absolute-paths: QEMU should create a new image with absolute paths
1025 # for the backing file. If there is no backing file available, the new
1026 # image will not be backed either.
1028 # Since: 1.1
1030 { 'enum': 'NewImageMode',
1031   'data': [ 'existing', 'absolute-paths' ] }
1034 # @BlockdevSnapshotSync:
1036 # Either @device or @node-name must be set but not both.
1038 # @device: the name of the device to generate the snapshot from.
1040 # @node-name: graph node name to generate the snapshot from (Since 2.0)
1042 # @snapshot-file: the target of the new image. If the file exists, or
1043 # if it is a device, the snapshot will be created in the existing
1044 # file/device. Otherwise, a new file will be created.
1046 # @snapshot-node-name: the graph node name of the new image (Since 2.0)
1048 # @format: the format of the snapshot image, default is 'qcow2'.
1050 # @mode: whether and how QEMU should create a new image, default is
1051 #        'absolute-paths'.
1053 { 'struct': 'BlockdevSnapshotSync',
1054   'data': { '*device': 'str', '*node-name': 'str',
1055             'snapshot-file': 'str', '*snapshot-node-name': 'str',
1056             '*format': 'str', '*mode': 'NewImageMode' } }
1059 # @BlockdevSnapshot:
1061 # @node: device or node name that will have a snapshot created.
1063 # @overlay: reference to the existing block device that will become
1064 #           the overlay of @node, as part of creating the snapshot.
1065 #           It must not have a current backing file (this can be
1066 #           achieved by passing "backing": "" to blockdev-add).
1068 # Since: 2.5
1070 { 'struct': 'BlockdevSnapshot',
1071   'data': { 'node': 'str', 'overlay': 'str' } }
1074 # @DriveBackup:
1076 # @job-id: identifier for the newly-created block job. If
1077 #          omitted, the device name will be used. (Since 2.7)
1079 # @device: the device name or node-name of a root node which should be copied.
1081 # @target: the target of the new image. If the file exists, or if it
1082 #          is a device, the existing file/device will be used as the new
1083 #          destination.  If it does not exist, a new file will be created.
1085 # @format: the format of the new destination, default is to
1086 #          probe if @mode is 'existing', else the format of the source
1088 # @sync: what parts of the disk image should be copied to the destination
1089 #        (all the disk, only the sectors allocated in the topmost image, from a
1090 #        dirty bitmap, or only new I/O).
1092 # @mode: whether and how QEMU should create a new image, default is
1093 #        'absolute-paths'.
1095 # @speed: the maximum speed, in bytes per second
1097 # @bitmap: the name of dirty bitmap if sync is "incremental".
1098 #          Must be present if sync is "incremental", must NOT be present
1099 #          otherwise. (Since 2.4)
1101 # @compress: true to compress data, if the target format supports it.
1102 #            (default: false) (since 2.8)
1104 # @on-source-error: the action to take on an error on the source,
1105 #                   default 'report'.  'stop' and 'enospc' can only be used
1106 #                   if the block device supports io-status (see BlockInfo).
1108 # @on-target-error: the action to take on an error on the target,
1109 #                   default 'report' (no limitations, since this applies to
1110 #                   a different block device than @device).
1112 # Note: @on-source-error and @on-target-error only affect background
1113 # I/O.  If an error occurs during a guest write request, the device's
1114 # rerror/werror actions will be used.
1116 # Since: 1.6
1118 { 'struct': 'DriveBackup',
1119   'data': { '*job-id': 'str', 'device': 'str', 'target': 'str',
1120             '*format': 'str', 'sync': 'MirrorSyncMode', '*mode': 'NewImageMode',
1121             '*speed': 'int', '*bitmap': 'str', '*compress': 'bool',
1122             '*on-source-error': 'BlockdevOnError',
1123             '*on-target-error': 'BlockdevOnError' } }
1126 # @BlockdevBackup:
1128 # @job-id: identifier for the newly-created block job. If
1129 #          omitted, the device name will be used. (Since 2.7)
1131 # @device: the device name or node-name of a root node which should be copied.
1133 # @target: the device name or node-name of the backup target node.
1135 # @sync: what parts of the disk image should be copied to the destination
1136 #        (all the disk, only the sectors allocated in the topmost image, or
1137 #        only new I/O).
1139 # @speed: the maximum speed, in bytes per second. The default is 0,
1140 #         for unlimited.
1142 # @compress: true to compress data, if the target format supports it.
1143 #            (default: false) (since 2.8)
1145 # @on-source-error: the action to take on an error on the source,
1146 #                   default 'report'.  'stop' and 'enospc' can only be used
1147 #                   if the block device supports io-status (see BlockInfo).
1149 # @on-target-error: the action to take on an error on the target,
1150 #                   default 'report' (no limitations, since this applies to
1151 #                   a different block device than @device).
1153 # Note: @on-source-error and @on-target-error only affect background
1154 # I/O.  If an error occurs during a guest write request, the device's
1155 # rerror/werror actions will be used.
1157 # Since: 2.3
1159 { 'struct': 'BlockdevBackup',
1160   'data': { '*job-id': 'str', 'device': 'str', 'target': 'str',
1161             'sync': 'MirrorSyncMode',
1162             '*speed': 'int',
1163             '*compress': 'bool',
1164             '*on-source-error': 'BlockdevOnError',
1165             '*on-target-error': 'BlockdevOnError' } }
1168 # @blockdev-snapshot-sync:
1170 # Generates a synchronous snapshot of a block device.
1172 # For the arguments, see the documentation of BlockdevSnapshotSync.
1174 # Returns: nothing on success
1175 #          If @device is not a valid block device, DeviceNotFound
1177 # Since: 0.14.0
1179 # Example:
1181 # -> { "execute": "blockdev-snapshot-sync",
1182 #      "arguments": { "device": "ide-hd0",
1183 #                     "snapshot-file":
1184 #                     "/some/place/my-image",
1185 #                     "format": "qcow2" } }
1186 # <- { "return": {} }
1189 { 'command': 'blockdev-snapshot-sync',
1190   'data': 'BlockdevSnapshotSync' }
1194 # @blockdev-snapshot:
1196 # Generates a snapshot of a block device.
1198 # Create a snapshot, by installing 'node' as the backing image of
1199 # 'overlay'. Additionally, if 'node' is associated with a block
1200 # device, the block device changes to using 'overlay' as its new active
1201 # image.
1203 # For the arguments, see the documentation of BlockdevSnapshot.
1205 # Since: 2.5
1207 # Example:
1209 # -> { "execute": "blockdev-add",
1210 #      "arguments": { "driver": "qcow2",
1211 #                     "node-name": "node1534",
1212 #                     "file": { "driver": "file",
1213 #                               "filename": "hd1.qcow2" },
1214 #                     "backing": "" } }
1216 # <- { "return": {} }
1218 # -> { "execute": "blockdev-snapshot",
1219 #      "arguments": { "node": "ide-hd0",
1220 #                     "overlay": "node1534" } }
1221 # <- { "return": {} }
1224 { 'command': 'blockdev-snapshot',
1225   'data': 'BlockdevSnapshot' }
1228 # @change-backing-file:
1230 # Change the backing file in the image file metadata.  This does not
1231 # cause QEMU to reopen the image file to reparse the backing filename
1232 # (it may, however, perform a reopen to change permissions from
1233 # r/o -> r/w -> r/o, if needed). The new backing file string is written
1234 # into the image file metadata, and the QEMU internal strings are
1235 # updated.
1237 # @image-node-name: The name of the block driver state node of the
1238 #                   image to modify. The "device" argument is used
1239 #                   to verify "image-node-name" is in the chain
1240 #                   described by "device".
1242 # @device:          The device name or node-name of the root node that owns
1243 #                   image-node-name.
1245 # @backing-file:    The string to write as the backing file.  This
1246 #                   string is not validated, so care should be taken
1247 #                   when specifying the string or the image chain may
1248 #                   not be able to be reopened again.
1250 # Returns: Nothing on success
1252 #          If "device" does not exist or cannot be determined, DeviceNotFound
1254 # Since: 2.1
1256 { 'command': 'change-backing-file',
1257   'data': { 'device': 'str', 'image-node-name': 'str',
1258             'backing-file': 'str' } }
1261 # @block-commit:
1263 # Live commit of data from overlay image nodes into backing nodes - i.e.,
1264 # writes data between 'top' and 'base' into 'base'.
1266 # @job-id: identifier for the newly-created block job. If
1267 #          omitted, the device name will be used. (Since 2.7)
1269 # @device:  the device name or node-name of a root node
1271 # @base:   The file name of the backing image to write data into.
1272 #                    If not specified, this is the deepest backing image.
1274 # @top:    The file name of the backing image within the image chain,
1275 #                    which contains the topmost data to be committed down. If
1276 #                    not specified, this is the active layer.
1278 # @backing-file:  The backing file string to write into the overlay
1279 #                           image of 'top'.  If 'top' is the active layer,
1280 #                           specifying a backing file string is an error. This
1281 #                           filename is not validated.
1283 #                           If a pathname string is such that it cannot be
1284 #                           resolved by QEMU, that means that subsequent QMP or
1285 #                           HMP commands must use node-names for the image in
1286 #                           question, as filename lookup methods will fail.
1288 #                           If not specified, QEMU will automatically determine
1289 #                           the backing file string to use, or error out if
1290 #                           there is no obvious choice. Care should be taken
1291 #                           when specifying the string, to specify a valid
1292 #                           filename or protocol.
1293 #                           (Since 2.1)
1295 #                    If top == base, that is an error.
1296 #                    If top == active, the job will not be completed by itself,
1297 #                    user needs to complete the job with the block-job-complete
1298 #                    command after getting the ready event. (Since 2.0)
1300 #                    If the base image is smaller than top, then the base image
1301 #                    will be resized to be the same size as top.  If top is
1302 #                    smaller than the base image, the base will not be
1303 #                    truncated.  If you want the base image size to match the
1304 #                    size of the smaller top, you can safely truncate it
1305 #                    yourself once the commit operation successfully completes.
1307 # @speed:  the maximum speed, in bytes per second
1309 # @filter-node-name: the node name that should be assigned to the
1310 #                    filter driver that the commit job inserts into the graph
1311 #                    above @top. If this option is not given, a node name is
1312 #                    autogenerated. (Since: 2.9)
1314 # Returns: Nothing on success
1315 #          If commit or stream is already active on this device, DeviceInUse
1316 #          If @device does not exist, DeviceNotFound
1317 #          If image commit is not supported by this device, NotSupported
1318 #          If @base or @top is invalid, a generic error is returned
1319 #          If @speed is invalid, InvalidParameter
1321 # Since: 1.3
1323 # Example:
1325 # -> { "execute": "block-commit",
1326 #      "arguments": { "device": "virtio0",
1327 #                     "top": "/tmp/snap1.qcow2" } }
1328 # <- { "return": {} }
1331 { 'command': 'block-commit',
1332   'data': { '*job-id': 'str', 'device': 'str', '*base': 'str', '*top': 'str',
1333             '*backing-file': 'str', '*speed': 'int',
1334             '*filter-node-name': 'str' } }
1337 # @drive-backup:
1339 # Start a point-in-time copy of a block device to a new destination.  The
1340 # status of ongoing drive-backup operations can be checked with
1341 # query-block-jobs where the BlockJobInfo.type field has the value 'backup'.
1342 # The operation can be stopped before it has completed using the
1343 # block-job-cancel command.
1345 # Returns: nothing on success
1346 #          If @device is not a valid block device, GenericError
1348 # Since: 1.6
1350 # Example:
1352 # -> { "execute": "drive-backup",
1353 #      "arguments": { "device": "drive0",
1354 #                     "sync": "full",
1355 #                     "target": "backup.img" } }
1356 # <- { "return": {} }
1359 { 'command': 'drive-backup', 'boxed': true,
1360   'data': 'DriveBackup' }
1363 # @blockdev-backup:
1365 # Start a point-in-time copy of a block device to a new destination.  The
1366 # status of ongoing blockdev-backup operations can be checked with
1367 # query-block-jobs where the BlockJobInfo.type field has the value 'backup'.
1368 # The operation can be stopped before it has completed using the
1369 # block-job-cancel command.
1371 # Returns: nothing on success
1372 #          If @device is not a valid block device, DeviceNotFound
1374 # Since: 2.3
1376 # Example:
1377 # -> { "execute": "blockdev-backup",
1378 #      "arguments": { "device": "src-id",
1379 #                     "sync": "full",
1380 #                     "target": "tgt-id" } }
1381 # <- { "return": {} }
1384 { 'command': 'blockdev-backup', 'boxed': true,
1385   'data': 'BlockdevBackup' }
1389 # @query-named-block-nodes:
1391 # Get the named block driver list
1393 # Returns: the list of BlockDeviceInfo
1395 # Since: 2.0
1397 # Example:
1399 # -> { "execute": "query-named-block-nodes" }
1400 # <- { "return": [ { "ro":false,
1401 #                    "drv":"qcow2",
1402 #                    "encrypted":false,
1403 #                    "file":"disks/test.qcow2",
1404 #                    "node-name": "my-node",
1405 #                    "backing_file_depth":1,
1406 #                    "bps":1000000,
1407 #                    "bps_rd":0,
1408 #                    "bps_wr":0,
1409 #                    "iops":1000000,
1410 #                    "iops_rd":0,
1411 #                    "iops_wr":0,
1412 #                    "bps_max": 8000000,
1413 #                    "bps_rd_max": 0,
1414 #                    "bps_wr_max": 0,
1415 #                    "iops_max": 0,
1416 #                    "iops_rd_max": 0,
1417 #                    "iops_wr_max": 0,
1418 #                    "iops_size": 0,
1419 #                    "write_threshold": 0,
1420 #                    "image":{
1421 #                       "filename":"disks/test.qcow2",
1422 #                       "format":"qcow2",
1423 #                       "virtual-size":2048000,
1424 #                       "backing_file":"base.qcow2",
1425 #                       "full-backing-filename":"disks/base.qcow2",
1426 #                       "backing-filename-format":"qcow2",
1427 #                       "snapshots":[
1428 #                          {
1429 #                             "id": "1",
1430 #                             "name": "snapshot1",
1431 #                             "vm-state-size": 0,
1432 #                             "date-sec": 10000200,
1433 #                             "date-nsec": 12,
1434 #                             "vm-clock-sec": 206,
1435 #                             "vm-clock-nsec": 30
1436 #                          }
1437 #                       ],
1438 #                       "backing-image":{
1439 #                           "filename":"disks/base.qcow2",
1440 #                           "format":"qcow2",
1441 #                           "virtual-size":2048000
1442 #                       }
1443 #                    } } ] }
1446 { 'command': 'query-named-block-nodes', 'returns': [ 'BlockDeviceInfo' ] }
1449 # @drive-mirror:
1451 # Start mirroring a block device's writes to a new destination. target
1452 # specifies the target of the new image. If the file exists, or if it
1453 # is a device, it will be used as the new destination for writes. If
1454 # it does not exist, a new file will be created. format specifies the
1455 # format of the mirror image, default is to probe if mode='existing',
1456 # else the format of the source.
1458 # Returns: nothing on success
1459 #          If @device is not a valid block device, GenericError
1461 # Since: 1.3
1463 # Example:
1465 # -> { "execute": "drive-mirror",
1466 #      "arguments": { "device": "ide-hd0",
1467 #                     "target": "/some/place/my-image",
1468 #                     "sync": "full",
1469 #                     "format": "qcow2" } }
1470 # <- { "return": {} }
1473 { 'command': 'drive-mirror', 'boxed': true,
1474   'data': 'DriveMirror' }
1477 # @DriveMirror:
1479 # A set of parameters describing drive mirror setup.
1481 # @job-id: identifier for the newly-created block job. If
1482 #          omitted, the device name will be used. (Since 2.7)
1484 # @device:  the device name or node-name of a root node whose writes should be
1485 #           mirrored.
1487 # @target: the target of the new image. If the file exists, or if it
1488 #          is a device, the existing file/device will be used as the new
1489 #          destination.  If it does not exist, a new file will be created.
1491 # @format: the format of the new destination, default is to
1492 #          probe if @mode is 'existing', else the format of the source
1494 # @node-name: the new block driver state node name in the graph
1495 #             (Since 2.1)
1497 # @replaces: with sync=full graph node name to be replaced by the new
1498 #            image when a whole image copy is done. This can be used to repair
1499 #            broken Quorum files. (Since 2.1)
1501 # @mode: whether and how QEMU should create a new image, default is
1502 #        'absolute-paths'.
1504 # @speed:  the maximum speed, in bytes per second
1506 # @sync: what parts of the disk image should be copied to the destination
1507 #        (all the disk, only the sectors allocated in the topmost image, or
1508 #        only new I/O).
1510 # @granularity: granularity of the dirty bitmap, default is 64K
1511 #               if the image format doesn't have clusters, 4K if the clusters
1512 #               are smaller than that, else the cluster size.  Must be a
1513 #               power of 2 between 512 and 64M (since 1.4).
1515 # @buf-size: maximum amount of data in flight from source to
1516 #            target (since 1.4).
1518 # @on-source-error: the action to take on an error on the source,
1519 #                   default 'report'.  'stop' and 'enospc' can only be used
1520 #                   if the block device supports io-status (see BlockInfo).
1522 # @on-target-error: the action to take on an error on the target,
1523 #                   default 'report' (no limitations, since this applies to
1524 #                   a different block device than @device).
1525 # @unmap: Whether to try to unmap target sectors where source has
1526 #         only zero. If true, and target unallocated sectors will read as zero,
1527 #         target image sectors will be unmapped; otherwise, zeroes will be
1528 #         written. Both will result in identical contents.
1529 #         Default is true. (Since 2.4)
1531 # Since: 1.3
1533 { 'struct': 'DriveMirror',
1534   'data': { '*job-id': 'str', 'device': 'str', 'target': 'str',
1535             '*format': 'str', '*node-name': 'str', '*replaces': 'str',
1536             'sync': 'MirrorSyncMode', '*mode': 'NewImageMode',
1537             '*speed': 'int', '*granularity': 'uint32',
1538             '*buf-size': 'int', '*on-source-error': 'BlockdevOnError',
1539             '*on-target-error': 'BlockdevOnError',
1540             '*unmap': 'bool' } }
1543 # @BlockDirtyBitmap:
1545 # @node: name of device/node which the bitmap is tracking
1547 # @name: name of the dirty bitmap
1549 # Since: 2.4
1551 { 'struct': 'BlockDirtyBitmap',
1552   'data': { 'node': 'str', 'name': 'str' } }
1555 # @BlockDirtyBitmapAdd:
1557 # @node: name of device/node which the bitmap is tracking
1559 # @name: name of the dirty bitmap
1561 # @granularity: the bitmap granularity, default is 64k for
1562 #               block-dirty-bitmap-add
1564 # Since: 2.4
1566 { 'struct': 'BlockDirtyBitmapAdd',
1567   'data': { 'node': 'str', 'name': 'str', '*granularity': 'uint32' } }
1570 # @block-dirty-bitmap-add:
1572 # Create a dirty bitmap with a name on the node, and start tracking the writes.
1574 # Returns: nothing on success
1575 #          If @node is not a valid block device or node, DeviceNotFound
1576 #          If @name is already taken, GenericError with an explanation
1578 # Since: 2.4
1580 # Example:
1582 # -> { "execute": "block-dirty-bitmap-add",
1583 #      "arguments": { "node": "drive0", "name": "bitmap0" } }
1584 # <- { "return": {} }
1587 { 'command': 'block-dirty-bitmap-add',
1588   'data': 'BlockDirtyBitmapAdd' }
1591 # @block-dirty-bitmap-remove:
1593 # Stop write tracking and remove the dirty bitmap that was created
1594 # with block-dirty-bitmap-add.
1596 # Returns: nothing on success
1597 #          If @node is not a valid block device or node, DeviceNotFound
1598 #          If @name is not found, GenericError with an explanation
1599 #          if @name is frozen by an operation, GenericError
1601 # Since: 2.4
1603 # Example:
1605 # -> { "execute": "block-dirty-bitmap-remove",
1606 #      "arguments": { "node": "drive0", "name": "bitmap0" } }
1607 # <- { "return": {} }
1610 { 'command': 'block-dirty-bitmap-remove',
1611   'data': 'BlockDirtyBitmap' }
1614 # @block-dirty-bitmap-clear:
1616 # Clear (reset) a dirty bitmap on the device, so that an incremental
1617 # backup from this point in time forward will only backup clusters
1618 # modified after this clear operation.
1620 # Returns: nothing on success
1621 #          If @node is not a valid block device, DeviceNotFound
1622 #          If @name is not found, GenericError with an explanation
1624 # Since: 2.4
1626 # Example:
1628 # -> { "execute": "block-dirty-bitmap-clear",
1629 #      "arguments": { "node": "drive0", "name": "bitmap0" } }
1630 # <- { "return": {} }
1633 { 'command': 'block-dirty-bitmap-clear',
1634   'data': 'BlockDirtyBitmap' }
1637 # @blockdev-mirror:
1639 # Start mirroring a block device's writes to a new destination.
1641 # @job-id: identifier for the newly-created block job. If
1642 #          omitted, the device name will be used. (Since 2.7)
1644 # @device: The device name or node-name of a root node whose writes should be
1645 #          mirrored.
1647 # @target: the id or node-name of the block device to mirror to. This mustn't be
1648 #          attached to guest.
1650 # @replaces: with sync=full graph node name to be replaced by the new
1651 #            image when a whole image copy is done. This can be used to repair
1652 #            broken Quorum files.
1654 # @speed:  the maximum speed, in bytes per second
1656 # @sync: what parts of the disk image should be copied to the destination
1657 #        (all the disk, only the sectors allocated in the topmost image, or
1658 #        only new I/O).
1660 # @granularity: granularity of the dirty bitmap, default is 64K
1661 #               if the image format doesn't have clusters, 4K if the clusters
1662 #               are smaller than that, else the cluster size.  Must be a
1663 #               power of 2 between 512 and 64M
1665 # @buf-size: maximum amount of data in flight from source to
1666 #            target
1668 # @on-source-error: the action to take on an error on the source,
1669 #                   default 'report'.  'stop' and 'enospc' can only be used
1670 #                   if the block device supports io-status (see BlockInfo).
1672 # @on-target-error: the action to take on an error on the target,
1673 #                   default 'report' (no limitations, since this applies to
1674 #                   a different block device than @device).
1676 # @filter-node-name: the node name that should be assigned to the
1677 #                    filter driver that the mirror job inserts into the graph
1678 #                    above @device. If this option is not given, a node name is
1679 #                    autogenerated. (Since: 2.9)
1681 # Returns: nothing on success.
1683 # Since: 2.6
1685 # Example:
1687 # -> { "execute": "blockdev-mirror",
1688 #      "arguments": { "device": "ide-hd0",
1689 #                     "target": "target0",
1690 #                     "sync": "full" } }
1691 # <- { "return": {} }
1694 { 'command': 'blockdev-mirror',
1695   'data': { '*job-id': 'str', 'device': 'str', 'target': 'str',
1696             '*replaces': 'str',
1697             'sync': 'MirrorSyncMode',
1698             '*speed': 'int', '*granularity': 'uint32',
1699             '*buf-size': 'int', '*on-source-error': 'BlockdevOnError',
1700             '*on-target-error': 'BlockdevOnError',
1701             '*filter-node-name': 'str' } }
1704 # @block_set_io_throttle:
1706 # Change I/O throttle limits for a block drive.
1708 # Since QEMU 2.4, each device with I/O limits is member of a throttle
1709 # group.
1711 # If two or more devices are members of the same group, the limits
1712 # will apply to the combined I/O of the whole group in a round-robin
1713 # fashion. Therefore, setting new I/O limits to a device will affect
1714 # the whole group.
1716 # The name of the group can be specified using the 'group' parameter.
1717 # If the parameter is unset, it is assumed to be the current group of
1718 # that device. If it's not in any group yet, the name of the device
1719 # will be used as the name for its group.
1721 # The 'group' parameter can also be used to move a device to a
1722 # different group. In this case the limits specified in the parameters
1723 # will be applied to the new group only.
1725 # I/O limits can be disabled by setting all of them to 0. In this case
1726 # the device will be removed from its group and the rest of its
1727 # members will not be affected. The 'group' parameter is ignored.
1729 # Returns: Nothing on success
1730 #          If @device is not a valid block device, DeviceNotFound
1732 # Since: 1.1
1734 # Example:
1736 # -> { "execute": "block_set_io_throttle",
1737 #      "arguments": { "id": "ide0-1-0",
1738 #                     "bps": 1000000,
1739 #                     "bps_rd": 0,
1740 #                     "bps_wr": 0,
1741 #                     "iops": 0,
1742 #                     "iops_rd": 0,
1743 #                     "iops_wr": 0,
1744 #                     "bps_max": 8000000,
1745 #                     "bps_rd_max": 0,
1746 #                     "bps_wr_max": 0,
1747 #                     "iops_max": 0,
1748 #                     "iops_rd_max": 0,
1749 #                     "iops_wr_max": 0,
1750 #                     "bps_max_length": 60,
1751 #                     "iops_size": 0 } }
1752 # <- { "return": {} }
1754 { 'command': 'block_set_io_throttle', 'boxed': true,
1755   'data': 'BlockIOThrottle' }
1758 # @BlockIOThrottle:
1760 # A set of parameters describing block throttling.
1762 # @device: Block device name (deprecated, use @id instead)
1764 # @id: The name or QOM path of the guest device (since: 2.8)
1766 # @bps: total throughput limit in bytes per second
1768 # @bps_rd: read throughput limit in bytes per second
1770 # @bps_wr: write throughput limit in bytes per second
1772 # @iops: total I/O operations per second
1774 # @iops_rd: read I/O operations per second
1776 # @iops_wr: write I/O operations per second
1778 # @bps_max: total throughput limit during bursts,
1779 #                     in bytes (Since 1.7)
1781 # @bps_rd_max: read throughput limit during bursts,
1782 #                        in bytes (Since 1.7)
1784 # @bps_wr_max: write throughput limit during bursts,
1785 #                        in bytes (Since 1.7)
1787 # @iops_max: total I/O operations per second during bursts,
1788 #                      in bytes (Since 1.7)
1790 # @iops_rd_max: read I/O operations per second during bursts,
1791 #                         in bytes (Since 1.7)
1793 # @iops_wr_max: write I/O operations per second during bursts,
1794 #                         in bytes (Since 1.7)
1796 # @bps_max_length: maximum length of the @bps_max burst
1797 #                            period, in seconds. It must only
1798 #                            be set if @bps_max is set as well.
1799 #                            Defaults to 1. (Since 2.6)
1801 # @bps_rd_max_length: maximum length of the @bps_rd_max
1802 #                               burst period, in seconds. It must only
1803 #                               be set if @bps_rd_max is set as well.
1804 #                               Defaults to 1. (Since 2.6)
1806 # @bps_wr_max_length: maximum length of the @bps_wr_max
1807 #                               burst period, in seconds. It must only
1808 #                               be set if @bps_wr_max is set as well.
1809 #                               Defaults to 1. (Since 2.6)
1811 # @iops_max_length: maximum length of the @iops burst
1812 #                             period, in seconds. It must only
1813 #                             be set if @iops_max is set as well.
1814 #                             Defaults to 1. (Since 2.6)
1816 # @iops_rd_max_length: maximum length of the @iops_rd_max
1817 #                                burst period, in seconds. It must only
1818 #                                be set if @iops_rd_max is set as well.
1819 #                                Defaults to 1. (Since 2.6)
1821 # @iops_wr_max_length: maximum length of the @iops_wr_max
1822 #                                burst period, in seconds. It must only
1823 #                                be set if @iops_wr_max is set as well.
1824 #                                Defaults to 1. (Since 2.6)
1826 # @iops_size: an I/O size in bytes (Since 1.7)
1828 # @group: throttle group name (Since 2.4)
1830 # Since: 1.1
1832 { 'struct': 'BlockIOThrottle',
1833   'data': { '*device': 'str', '*id': 'str', 'bps': 'int', 'bps_rd': 'int',
1834             'bps_wr': 'int', 'iops': 'int', 'iops_rd': 'int', 'iops_wr': 'int',
1835             '*bps_max': 'int', '*bps_rd_max': 'int',
1836             '*bps_wr_max': 'int', '*iops_max': 'int',
1837             '*iops_rd_max': 'int', '*iops_wr_max': 'int',
1838             '*bps_max_length': 'int', '*bps_rd_max_length': 'int',
1839             '*bps_wr_max_length': 'int', '*iops_max_length': 'int',
1840             '*iops_rd_max_length': 'int', '*iops_wr_max_length': 'int',
1841             '*iops_size': 'int', '*group': 'str' } }
1844 # @block-stream:
1846 # Copy data from a backing file into a block device.
1848 # The block streaming operation is performed in the background until the entire
1849 # backing file has been copied.  This command returns immediately once streaming
1850 # has started.  The status of ongoing block streaming operations can be checked
1851 # with query-block-jobs.  The operation can be stopped before it has completed
1852 # using the block-job-cancel command.
1854 # The node that receives the data is called the top image, can be located in
1855 # any part of the chain (but always above the base image; see below) and can be
1856 # specified using its device or node name. Earlier qemu versions only allowed
1857 # 'device' to name the top level node; presence of the 'base-node' parameter
1858 # during introspection can be used as a witness of the enhanced semantics
1859 # of 'device'.
1861 # If a base file is specified then sectors are not copied from that base file and
1862 # its backing chain.  When streaming completes the image file will have the base
1863 # file as its backing file.  This can be used to stream a subset of the backing
1864 # file chain instead of flattening the entire image.
1866 # On successful completion the image file is updated to drop the backing file
1867 # and the BLOCK_JOB_COMPLETED event is emitted.
1869 # @job-id: identifier for the newly-created block job. If
1870 #          omitted, the device name will be used. (Since 2.7)
1872 # @device: the device or node name of the top image
1874 # @base:   the common backing file name.
1875 #                    It cannot be set if @base-node is also set.
1877 # @base-node: the node name of the backing file.
1878 #                       It cannot be set if @base is also set. (Since 2.8)
1880 # @backing-file: The backing file string to write into the top
1881 #                          image. This filename is not validated.
1883 #                          If a pathname string is such that it cannot be
1884 #                          resolved by QEMU, that means that subsequent QMP or
1885 #                          HMP commands must use node-names for the image in
1886 #                          question, as filename lookup methods will fail.
1888 #                          If not specified, QEMU will automatically determine
1889 #                          the backing file string to use, or error out if there
1890 #                          is no obvious choice.  Care should be taken when
1891 #                          specifying the string, to specify a valid filename or
1892 #                          protocol.
1893 #                          (Since 2.1)
1895 # @speed:  the maximum speed, in bytes per second
1897 # @on-error: the action to take on an error (default report).
1898 #            'stop' and 'enospc' can only be used if the block device
1899 #            supports io-status (see BlockInfo).  Since 1.3.
1901 # Returns: Nothing on success. If @device does not exist, DeviceNotFound.
1903 # Since: 1.1
1905 # Example:
1907 # -> { "execute": "block-stream",
1908 #      "arguments": { "device": "virtio0",
1909 #                     "base": "/tmp/master.qcow2" } }
1910 # <- { "return": {} }
1913 { 'command': 'block-stream',
1914   'data': { '*job-id': 'str', 'device': 'str', '*base': 'str',
1915             '*base-node': 'str', '*backing-file': 'str', '*speed': 'int',
1916             '*on-error': 'BlockdevOnError' } }
1919 # @block-job-set-speed:
1921 # Set maximum speed for a background block operation.
1923 # This command can only be issued when there is an active block job.
1925 # Throttling can be disabled by setting the speed to 0.
1927 # @device: The job identifier. This used to be a device name (hence
1928 #          the name of the parameter), but since QEMU 2.7 it can have
1929 #          other values.
1931 # @speed:  the maximum speed, in bytes per second, or 0 for unlimited.
1932 #          Defaults to 0.
1934 # Returns: Nothing on success
1935 #          If no background operation is active on this device, DeviceNotActive
1937 # Since: 1.1
1939 { 'command': 'block-job-set-speed',
1940   'data': { 'device': 'str', 'speed': 'int' } }
1943 # @block-job-cancel:
1945 # Stop an active background block operation.
1947 # This command returns immediately after marking the active background block
1948 # operation for cancellation.  It is an error to call this command if no
1949 # operation is in progress.
1951 # The operation will cancel as soon as possible and then emit the
1952 # BLOCK_JOB_CANCELLED event.  Before that happens the job is still visible when
1953 # enumerated using query-block-jobs.
1955 # For streaming, the image file retains its backing file unless the streaming
1956 # operation happens to complete just as it is being cancelled.  A new streaming
1957 # operation can be started at a later time to finish copying all data from the
1958 # backing file.
1960 # @device: The job identifier. This used to be a device name (hence
1961 #          the name of the parameter), but since QEMU 2.7 it can have
1962 #          other values.
1964 # @force: whether to allow cancellation of a paused job (default
1965 #         false).  Since 1.3.
1967 # Returns: Nothing on success
1968 #          If no background operation is active on this device, DeviceNotActive
1970 # Since: 1.1
1972 { 'command': 'block-job-cancel', 'data': { 'device': 'str', '*force': 'bool' } }
1975 # @block-job-pause:
1977 # Pause an active background block operation.
1979 # This command returns immediately after marking the active background block
1980 # operation for pausing.  It is an error to call this command if no
1981 # operation is in progress.  Pausing an already paused job has no cumulative
1982 # effect; a single block-job-resume command will resume the job.
1984 # The operation will pause as soon as possible.  No event is emitted when
1985 # the operation is actually paused.  Cancelling a paused job automatically
1986 # resumes it.
1988 # @device: The job identifier. This used to be a device name (hence
1989 #          the name of the parameter), but since QEMU 2.7 it can have
1990 #          other values.
1992 # Returns: Nothing on success
1993 #          If no background operation is active on this device, DeviceNotActive
1995 # Since: 1.3
1997 { 'command': 'block-job-pause', 'data': { 'device': 'str' } }
2000 # @block-job-resume:
2002 # Resume an active background block operation.
2004 # This command returns immediately after resuming a paused background block
2005 # operation.  It is an error to call this command if no operation is in
2006 # progress.  Resuming an already running job is not an error.
2008 # This command also clears the error status of the job.
2010 # @device: The job identifier. This used to be a device name (hence
2011 #          the name of the parameter), but since QEMU 2.7 it can have
2012 #          other values.
2014 # Returns: Nothing on success
2015 #          If no background operation is active on this device, DeviceNotActive
2017 # Since: 1.3
2019 { 'command': 'block-job-resume', 'data': { 'device': 'str' } }
2022 # @block-job-complete:
2024 # Manually trigger completion of an active background block operation.  This
2025 # is supported for drive mirroring, where it also switches the device to
2026 # write to the target path only.  The ability to complete is signaled with
2027 # a BLOCK_JOB_READY event.
2029 # This command completes an active background block operation synchronously.
2030 # The ordering of this command's return with the BLOCK_JOB_COMPLETED event
2031 # is not defined.  Note that if an I/O error occurs during the processing of
2032 # this command: 1) the command itself will fail; 2) the error will be processed
2033 # according to the rerror/werror arguments that were specified when starting
2034 # the operation.
2036 # A cancelled or paused job cannot be completed.
2038 # @device: The job identifier. This used to be a device name (hence
2039 #          the name of the parameter), but since QEMU 2.7 it can have
2040 #          other values.
2042 # Returns: Nothing on success
2043 #          If no background operation is active on this device, DeviceNotActive
2045 # Since: 1.3
2047 { 'command': 'block-job-complete', 'data': { 'device': 'str' } }
2050 # @BlockdevDiscardOptions:
2052 # Determines how to handle discard requests.
2054 # @ignore:      Ignore the request
2055 # @unmap:       Forward as an unmap request
2057 # Since: 2.9
2059 { 'enum': 'BlockdevDiscardOptions',
2060   'data': [ 'ignore', 'unmap' ] }
2063 # @BlockdevDetectZeroesOptions:
2065 # Describes the operation mode for the automatic conversion of plain
2066 # zero writes by the OS to driver specific optimized zero write commands.
2068 # @off:      Disabled (default)
2069 # @on:       Enabled
2070 # @unmap:    Enabled and even try to unmap blocks if possible. This requires
2071 #            also that @BlockdevDiscardOptions is set to unmap for this device.
2073 # Since: 2.1
2075 { 'enum': 'BlockdevDetectZeroesOptions',
2076   'data': [ 'off', 'on', 'unmap' ] }
2079 # @BlockdevAioOptions:
2081 # Selects the AIO backend to handle I/O requests
2083 # @threads:     Use qemu's thread pool
2084 # @native:      Use native AIO backend (only Linux and Windows)
2086 # Since: 2.9
2088 { 'enum': 'BlockdevAioOptions',
2089   'data': [ 'threads', 'native' ] }
2092 # @BlockdevCacheOptions:
2094 # Includes cache-related options for block devices
2096 # @direct:      enables use of O_DIRECT (bypass the host page cache;
2097 #               default: false)
2098 # @no-flush:    ignore any flush requests for the device (default:
2099 #               false)
2101 # Since: 2.9
2103 { 'struct': 'BlockdevCacheOptions',
2104   'data': { '*direct': 'bool',
2105             '*no-flush': 'bool' } }
2108 # @BlockdevDriver:
2110 # Drivers that are supported in block device operations.
2112 # @vxhs: Since 2.10
2114 # Since: 2.9
2116 { 'enum': 'BlockdevDriver',
2117   'data': [ 'blkdebug', 'blkverify', 'bochs', 'cloop',
2118             'dmg', 'file', 'ftp', 'ftps', 'gluster', 'host_cdrom',
2119             'host_device', 'http', 'https', 'iscsi', 'luks', 'nbd', 'nfs',
2120             'null-aio', 'null-co', 'parallels', 'qcow', 'qcow2', 'qed',
2121             'quorum', 'raw', 'rbd', 'replication', 'sheepdog', 'ssh',
2122             'vdi', 'vhdx', 'vmdk', 'vpc', 'vvfat', 'vxhs' ] }
2125 # @BlockdevOptionsFile:
2127 # Driver specific block device options for the file backend.
2129 # @filename:    path to the image file
2130 # @aio:         AIO backend (default: threads) (since: 2.8)
2131 # @locking:     whether to enable file locking. If set to 'auto', only enable
2132 #               when Open File Descriptor (OFD) locking API is available
2133 #               (default: auto, since 2.10)
2135 # Since: 2.9
2137 { 'struct': 'BlockdevOptionsFile',
2138   'data': { 'filename': 'str',
2139             '*locking': 'OnOffAuto',
2140             '*aio': 'BlockdevAioOptions' } }
2143 # @BlockdevOptionsNull:
2145 # Driver specific block device options for the null backend.
2147 # @size:    size of the device in bytes.
2148 # @latency-ns: emulated latency (in nanoseconds) in processing
2149 #              requests. Default to zero which completes requests immediately.
2150 #              (Since 2.4)
2152 # Since: 2.9
2154 { 'struct': 'BlockdevOptionsNull',
2155   'data': { '*size': 'int', '*latency-ns': 'uint64' } }
2158 # @BlockdevOptionsVVFAT:
2160 # Driver specific block device options for the vvfat protocol.
2162 # @dir:         directory to be exported as FAT image
2163 # @fat-type:    FAT type: 12, 16 or 32
2164 # @floppy:      whether to export a floppy image (true) or
2165 #               partitioned hard disk (false; default)
2166 # @label:       set the volume label, limited to 11 bytes. FAT16 and
2167 #               FAT32 traditionally have some restrictions on labels, which are
2168 #               ignored by most operating systems. Defaults to "QEMU VVFAT".
2169 #               (since 2.4)
2170 # @rw:          whether to allow write operations (default: false)
2172 # Since: 2.9
2174 { 'struct': 'BlockdevOptionsVVFAT',
2175   'data': { 'dir': 'str', '*fat-type': 'int', '*floppy': 'bool',
2176             '*label': 'str', '*rw': 'bool' } }
2179 # @BlockdevOptionsGenericFormat:
2181 # Driver specific block device options for image format that have no option
2182 # besides their data source.
2184 # @file:        reference to or definition of the data source block device
2186 # Since: 2.9
2188 { 'struct': 'BlockdevOptionsGenericFormat',
2189   'data': { 'file': 'BlockdevRef' } }
2192 # @BlockdevOptionsLUKS:
2194 # Driver specific block device options for LUKS.
2196 # @key-secret: the ID of a QCryptoSecret object providing
2197 #              the decryption key (since 2.6). Mandatory except when
2198 #              doing a metadata-only probe of the image.
2200 # Since: 2.9
2202 { 'struct': 'BlockdevOptionsLUKS',
2203   'base': 'BlockdevOptionsGenericFormat',
2204   'data': { '*key-secret': 'str' } }
2208 # @BlockdevOptionsGenericCOWFormat:
2210 # Driver specific block device options for image format that have no option
2211 # besides their data source and an optional backing file.
2213 # @backing:     reference to or definition of the backing file block
2214 #               device (if missing, taken from the image file content). It is
2215 #               allowed to pass an empty string here in order to disable the
2216 #               default backing file.
2218 # Since: 2.9
2220 { 'struct': 'BlockdevOptionsGenericCOWFormat',
2221   'base': 'BlockdevOptionsGenericFormat',
2222   'data': { '*backing': 'BlockdevRef' } }
2225 # @Qcow2OverlapCheckMode:
2227 # General overlap check modes.
2229 # @none:        Do not perform any checks
2231 # @constant:    Perform only checks which can be done in constant time and
2232 #               without reading anything from disk
2234 # @cached:      Perform only checks which can be done without reading anything
2235 #               from disk
2237 # @all:         Perform all available overlap checks
2239 # Since: 2.9
2241 { 'enum': 'Qcow2OverlapCheckMode',
2242   'data': [ 'none', 'constant', 'cached', 'all' ] }
2245 # @Qcow2OverlapCheckFlags:
2247 # Structure of flags for each metadata structure. Setting a field to 'true'
2248 # makes qemu guard that structure against unintended overwriting. The default
2249 # value is chosen according to the template given.
2251 # @template: Specifies a template mode which can be adjusted using the other
2252 #            flags, defaults to 'cached'
2254 # Since: 2.9
2256 { 'struct': 'Qcow2OverlapCheckFlags',
2257   'data': { '*template':       'Qcow2OverlapCheckMode',
2258             '*main-header':    'bool',
2259             '*active-l1':      'bool',
2260             '*active-l2':      'bool',
2261             '*refcount-table': 'bool',
2262             '*refcount-block': 'bool',
2263             '*snapshot-table': 'bool',
2264             '*inactive-l1':    'bool',
2265             '*inactive-l2':    'bool' } }
2268 # @Qcow2OverlapChecks:
2270 # Specifies which metadata structures should be guarded against unintended
2271 # overwriting.
2273 # @flags:   set of flags for separate specification of each metadata structure
2274 #           type
2276 # @mode:    named mode which chooses a specific set of flags
2278 # Since: 2.9
2280 { 'alternate': 'Qcow2OverlapChecks',
2281   'data': { 'flags': 'Qcow2OverlapCheckFlags',
2282             'mode':  'Qcow2OverlapCheckMode' } }
2285 # @BlockdevQcowEncryptionFormat:
2287 # @aes: AES-CBC with plain64 initialization vectors
2289 # Since: 2.10
2291 { 'enum': 'BlockdevQcowEncryptionFormat',
2292   'data': [ 'aes' ] }
2295 # @BlockdevQcowEncryption:
2297 # Since: 2.10
2299 { 'union': 'BlockdevQcowEncryption',
2300   'base': { 'format': 'BlockdevQcowEncryptionFormat' },
2301   'discriminator': 'format',
2302   'data': { 'aes': 'QCryptoBlockOptionsQCow' } }
2305 # @BlockdevOptionsQcow:
2307 # Driver specific block device options for qcow.
2309 # @encrypt:               Image decryption options. Mandatory for
2310 #                         encrypted images, except when doing a metadata-only
2311 #                         probe of the image.
2313 # Since: 2.10
2315 { 'struct': 'BlockdevOptionsQcow',
2316   'base': 'BlockdevOptionsGenericCOWFormat',
2317   'data': { '*encrypt': 'BlockdevQcowEncryption' } }
2322 # @BlockdevQcow2EncryptionFormat:
2323 # @aes: AES-CBC with plain64 initialization venctors
2325 # Since: 2.10
2327 { 'enum': 'BlockdevQcow2EncryptionFormat',
2328   'data': [ 'aes', 'luks' ] }
2331 # @BlockdevQcow2Encryption:
2333 # Since: 2.10
2335 { 'union': 'BlockdevQcow2Encryption',
2336   'base': { 'format': 'BlockdevQcow2EncryptionFormat' },
2337   'discriminator': 'format',
2338   'data': { 'aes': 'QCryptoBlockOptionsQCow',
2339             'luks': 'QCryptoBlockOptionsLUKS'} }
2342 # @BlockdevOptionsQcow2:
2344 # Driver specific block device options for qcow2.
2346 # @lazy-refcounts:        whether to enable the lazy refcounts
2347 #                         feature (default is taken from the image file)
2349 # @pass-discard-request:  whether discard requests to the qcow2
2350 #                         device should be forwarded to the data source
2352 # @pass-discard-snapshot: whether discard requests for the data source
2353 #                         should be issued when a snapshot operation (e.g.
2354 #                         deleting a snapshot) frees clusters in the qcow2 file
2356 # @pass-discard-other:    whether discard requests for the data source
2357 #                         should be issued on other occasions where a cluster
2358 #                         gets freed
2360 # @overlap-check:         which overlap checks to perform for writes
2361 #                         to the image, defaults to 'cached' (since 2.2)
2363 # @cache-size:            the maximum total size of the L2 table and
2364 #                         refcount block caches in bytes (since 2.2)
2366 # @l2-cache-size:         the maximum size of the L2 table cache in
2367 #                         bytes (since 2.2)
2369 # @refcount-cache-size:   the maximum size of the refcount block cache
2370 #                         in bytes (since 2.2)
2372 # @cache-clean-interval:  clean unused entries in the L2 and refcount
2373 #                         caches. The interval is in seconds. The default value
2374 #                         is 0 and it disables this feature (since 2.5)
2375 # @encrypt:               Image decryption options. Mandatory for
2376 #                         encrypted images, except when doing a metadata-only
2377 #                         probe of the image. (since 2.10)
2379 # Since: 2.9
2381 { 'struct': 'BlockdevOptionsQcow2',
2382   'base': 'BlockdevOptionsGenericCOWFormat',
2383   'data': { '*lazy-refcounts': 'bool',
2384             '*pass-discard-request': 'bool',
2385             '*pass-discard-snapshot': 'bool',
2386             '*pass-discard-other': 'bool',
2387             '*overlap-check': 'Qcow2OverlapChecks',
2388             '*cache-size': 'int',
2389             '*l2-cache-size': 'int',
2390             '*refcount-cache-size': 'int',
2391             '*cache-clean-interval': 'int',
2392             '*encrypt': 'BlockdevQcow2Encryption' } }
2395 # @BlockdevOptionsSsh:
2397 # @server:              host address
2399 # @path:                path to the image on the host
2401 # @user:                user as which to connect, defaults to current
2402 #                       local user name
2404 # TODO: Expose the host_key_check option in QMP
2406 # Since: 2.9
2408 { 'struct': 'BlockdevOptionsSsh',
2409   'data': { 'server': 'InetSocketAddress',
2410             'path': 'str',
2411             '*user': 'str' } }
2415 # @BlkdebugEvent:
2417 # Trigger events supported by blkdebug.
2419 # Since: 2.9
2421 { 'enum': 'BlkdebugEvent', 'prefix': 'BLKDBG',
2422   'data': [ 'l1_update', 'l1_grow_alloc_table', 'l1_grow_write_table',
2423             'l1_grow_activate_table', 'l2_load', 'l2_update',
2424             'l2_update_compressed', 'l2_alloc_cow_read', 'l2_alloc_write',
2425             'read_aio', 'read_backing_aio', 'read_compressed', 'write_aio',
2426             'write_compressed', 'vmstate_load', 'vmstate_save', 'cow_read',
2427             'cow_write', 'reftable_load', 'reftable_grow', 'reftable_update',
2428             'refblock_load', 'refblock_update', 'refblock_update_part',
2429             'refblock_alloc', 'refblock_alloc_hookup', 'refblock_alloc_write',
2430             'refblock_alloc_write_blocks', 'refblock_alloc_write_table',
2431             'refblock_alloc_switch_table', 'cluster_alloc',
2432             'cluster_alloc_bytes', 'cluster_free', 'flush_to_os',
2433             'flush_to_disk', 'pwritev_rmw_head', 'pwritev_rmw_after_head',
2434             'pwritev_rmw_tail', 'pwritev_rmw_after_tail', 'pwritev',
2435             'pwritev_zero', 'pwritev_done', 'empty_image_prepare' ] }
2438 # @BlkdebugInjectErrorOptions:
2440 # Describes a single error injection for blkdebug.
2442 # @event:       trigger event
2444 # @state:       the state identifier blkdebug needs to be in to
2445 #               actually trigger the event; defaults to "any"
2447 # @errno:       error identifier (errno) to be returned; defaults to
2448 #               EIO
2450 # @sector:      specifies the sector index which has to be affected
2451 #               in order to actually trigger the event; defaults to "any
2452 #               sector"
2454 # @once:        disables further events after this one has been
2455 #               triggered; defaults to false
2457 # @immediately: fail immediately; defaults to false
2459 # Since: 2.9
2461 { 'struct': 'BlkdebugInjectErrorOptions',
2462   'data': { 'event': 'BlkdebugEvent',
2463             '*state': 'int',
2464             '*errno': 'int',
2465             '*sector': 'int',
2466             '*once': 'bool',
2467             '*immediately': 'bool' } }
2470 # @BlkdebugSetStateOptions:
2472 # Describes a single state-change event for blkdebug.
2474 # @event:       trigger event
2476 # @state:       the current state identifier blkdebug needs to be in;
2477 #               defaults to "any"
2479 # @new_state:   the state identifier blkdebug is supposed to assume if
2480 #               this event is triggered
2482 # Since: 2.9
2484 { 'struct': 'BlkdebugSetStateOptions',
2485   'data': { 'event': 'BlkdebugEvent',
2486             '*state': 'int',
2487             'new_state': 'int' } }
2490 # @BlockdevOptionsBlkdebug:
2492 # Driver specific block device options for blkdebug.
2494 # @image:           underlying raw block device (or image file)
2496 # @config:          filename of the configuration file
2498 # @align:           required alignment for requests in bytes, must be
2499 #                   positive power of 2, or 0 for default
2501 # @max-transfer:    maximum size for I/O transfers in bytes, must be
2502 #                   positive multiple of @align and of the underlying
2503 #                   file's request alignment (but need not be a power of
2504 #                   2), or 0 for default (since 2.10)
2506 # @opt-write-zero:  preferred alignment for write zero requests in bytes,
2507 #                   must be positive multiple of @align and of the
2508 #                   underlying file's request alignment (but need not be a
2509 #                   power of 2), or 0 for default (since 2.10)
2511 # @max-write-zero:  maximum size for write zero requests in bytes, must be
2512 #                   positive multiple of @align, of @opt-write-zero, and of
2513 #                   the underlying file's request alignment (but need not
2514 #                   be a power of 2), or 0 for default (since 2.10)
2516 # @opt-discard:     preferred alignment for discard requests in bytes, must
2517 #                   be positive multiple of @align and of the underlying
2518 #                   file's request alignment (but need not be a power of
2519 #                   2), or 0 for default (since 2.10)
2521 # @max-discard:     maximum size for discard requests in bytes, must be
2522 #                   positive multiple of @align, of @opt-discard, and of
2523 #                   the underlying file's request alignment (but need not
2524 #                   be a power of 2), or 0 for default (since 2.10)
2526 # @inject-error:    array of error injection descriptions
2528 # @set-state:       array of state-change descriptions
2530 # Since: 2.9
2532 { 'struct': 'BlockdevOptionsBlkdebug',
2533   'data': { 'image': 'BlockdevRef',
2534             '*config': 'str',
2535             '*align': 'int', '*max-transfer': 'int32',
2536             '*opt-write-zero': 'int32', '*max-write-zero': 'int32',
2537             '*opt-discard': 'int32', '*max-discard': 'int32',
2538             '*inject-error': ['BlkdebugInjectErrorOptions'],
2539             '*set-state': ['BlkdebugSetStateOptions'] } }
2542 # @BlockdevOptionsBlkverify:
2544 # Driver specific block device options for blkverify.
2546 # @test:    block device to be tested
2548 # @raw:     raw image used for verification
2550 # Since: 2.9
2552 { 'struct': 'BlockdevOptionsBlkverify',
2553   'data': { 'test': 'BlockdevRef',
2554             'raw': 'BlockdevRef' } }
2557 # @QuorumReadPattern:
2559 # An enumeration of quorum read patterns.
2561 # @quorum: read all the children and do a quorum vote on reads
2563 # @fifo: read only from the first child that has not failed
2565 # Since: 2.9
2567 { 'enum': 'QuorumReadPattern', 'data': [ 'quorum', 'fifo' ] }
2570 # @BlockdevOptionsQuorum:
2572 # Driver specific block device options for Quorum
2574 # @blkverify:      true if the driver must print content mismatch
2575 #                  set to false by default
2577 # @children:       the children block devices to use
2579 # @vote-threshold: the vote limit under which a read will fail
2581 # @rewrite-corrupted: rewrite corrupted data when quorum is reached
2582 #                     (Since 2.1)
2584 # @read-pattern: choose read pattern and set to quorum by default
2585 #                (Since 2.2)
2587 # Since: 2.9
2589 { 'struct': 'BlockdevOptionsQuorum',
2590   'data': { '*blkverify': 'bool',
2591             'children': [ 'BlockdevRef' ],
2592             'vote-threshold': 'int',
2593             '*rewrite-corrupted': 'bool',
2594             '*read-pattern': 'QuorumReadPattern' } }
2597 # @BlockdevOptionsGluster:
2599 # Driver specific block device options for Gluster
2601 # @volume:      name of gluster volume where VM image resides
2603 # @path:        absolute path to image file in gluster volume
2605 # @server:      gluster servers description
2607 # @debug:       libgfapi log level (default '4' which is Error)
2608 #               (Since 2.8)
2610 # @logfile:     libgfapi log file (default /dev/stderr) (Since 2.8)
2612 # Since: 2.9
2614 { 'struct': 'BlockdevOptionsGluster',
2615   'data': { 'volume': 'str',
2616             'path': 'str',
2617             'server': ['SocketAddress'],
2618             '*debug': 'int',
2619             '*logfile': 'str' } }
2622 # @IscsiTransport:
2624 # An enumeration of libiscsi transport types
2626 # Since: 2.9
2628 { 'enum': 'IscsiTransport',
2629   'data': [ 'tcp', 'iser' ] }
2632 # @IscsiHeaderDigest:
2634 # An enumeration of header digests supported by libiscsi
2636 # Since: 2.9
2638 { 'enum': 'IscsiHeaderDigest',
2639   'prefix': 'QAPI_ISCSI_HEADER_DIGEST',
2640   'data': [ 'crc32c', 'none', 'crc32c-none', 'none-crc32c' ] }
2643 # @BlockdevOptionsIscsi:
2645 # @transport:       The iscsi transport type
2647 # @portal:          The address of the iscsi portal
2649 # @target:          The target iqn name
2651 # @lun:             LUN to connect to. Defaults to 0.
2653 # @user:            User name to log in with. If omitted, no CHAP
2654 #                   authentication is performed.
2656 # @password-secret: The ID of a QCryptoSecret object providing
2657 #                   the password for the login. This option is required if
2658 #                   @user is specified.
2660 # @initiator-name:  The iqn name we want to identify to the target
2661 #                   as. If this option is not specified, an initiator name is
2662 #                   generated automatically.
2664 # @header-digest:   The desired header digest. Defaults to
2665 #                   none-crc32c.
2667 # @timeout:         Timeout in seconds after which a request will
2668 #                   timeout. 0 means no timeout and is the default.
2670 # Driver specific block device options for iscsi
2672 # Since: 2.9
2674 { 'struct': 'BlockdevOptionsIscsi',
2675   'data': { 'transport': 'IscsiTransport',
2676             'portal': 'str',
2677             'target': 'str',
2678             '*lun': 'int',
2679             '*user': 'str',
2680             '*password-secret': 'str',
2681             '*initiator-name': 'str',
2682             '*header-digest': 'IscsiHeaderDigest',
2683             '*timeout': 'int' } }
2687 # @BlockdevOptionsRbd:
2689 # @pool:               Ceph pool name.
2691 # @image:              Image name in the Ceph pool.
2693 # @conf:               path to Ceph configuration file.  Values
2694 #                      in the configuration file will be overridden by
2695 #                      options specified via QAPI.
2697 # @snapshot:           Ceph snapshot name.
2699 # @user:               Ceph id name.
2701 # @server:             Monitor host address and port.  This maps
2702 #                      to the "mon_host" Ceph option.
2704 # Since: 2.9
2706 { 'struct': 'BlockdevOptionsRbd',
2707   'data': { 'pool': 'str',
2708             'image': 'str',
2709             '*conf': 'str',
2710             '*snapshot': 'str',
2711             '*user': 'str',
2712             '*server': ['InetSocketAddressBase'] } }
2715 # @BlockdevOptionsSheepdog:
2717 # Driver specific block device options for sheepdog
2719 # @vdi:         Virtual disk image name
2720 # @server:      The Sheepdog server to connect to
2721 # @snap-id:     Snapshot ID
2722 # @tag:         Snapshot tag name
2724 # Only one of @snap-id and @tag may be present.
2726 # Since: 2.9
2728 { 'struct': 'BlockdevOptionsSheepdog',
2729   'data': { 'server': 'SocketAddress',
2730             'vdi': 'str',
2731             '*snap-id': 'uint32',
2732             '*tag': 'str' } }
2735 # @ReplicationMode:
2737 # An enumeration of replication modes.
2739 # @primary: Primary mode, the vm's state will be sent to secondary QEMU.
2741 # @secondary: Secondary mode, receive the vm's state from primary QEMU.
2743 # Since: 2.9
2745 { 'enum' : 'ReplicationMode', 'data' : [ 'primary', 'secondary' ] }
2748 # @BlockdevOptionsReplication:
2750 # Driver specific block device options for replication
2752 # @mode: the replication mode
2754 # @top-id: In secondary mode, node name or device ID of the root
2755 #          node who owns the replication node chain. Must not be given in
2756 #          primary mode.
2758 # Since: 2.9
2760 { 'struct': 'BlockdevOptionsReplication',
2761   'base': 'BlockdevOptionsGenericFormat',
2762   'data': { 'mode': 'ReplicationMode',
2763             '*top-id': 'str' } }
2766 # @NFSTransport:
2768 # An enumeration of NFS transport types
2770 # @inet:        TCP transport
2772 # Since: 2.9
2774 { 'enum': 'NFSTransport',
2775   'data': [ 'inet' ] }
2778 # @NFSServer:
2780 # Captures the address of the socket
2782 # @type:        transport type used for NFS (only TCP supported)
2784 # @host:        host address for NFS server
2786 # Since: 2.9
2788 { 'struct': 'NFSServer',
2789   'data': { 'type': 'NFSTransport',
2790             'host': 'str' } }
2793 # @BlockdevOptionsNfs:
2795 # Driver specific block device option for NFS
2797 # @server:                  host address
2799 # @path:                    path of the image on the host
2801 # @user:                    UID value to use when talking to the
2802 #                           server (defaults to 65534 on Windows and getuid()
2803 #                           on unix)
2805 # @group:                   GID value to use when talking to the
2806 #                           server (defaults to 65534 on Windows and getgid()
2807 #                           in unix)
2809 # @tcp-syn-count:           number of SYNs during the session
2810 #                           establishment (defaults to libnfs default)
2812 # @readahead-size:          set the readahead size in bytes (defaults
2813 #                           to libnfs default)
2815 # @page-cache-size:         set the pagecache size in bytes (defaults
2816 #                           to libnfs default)
2818 # @debug:                   set the NFS debug level (max 2) (defaults
2819 #                           to libnfs default)
2821 # Since: 2.9
2823 { 'struct': 'BlockdevOptionsNfs',
2824   'data': { 'server': 'NFSServer',
2825             'path': 'str',
2826             '*user': 'int',
2827             '*group': 'int',
2828             '*tcp-syn-count': 'int',
2829             '*readahead-size': 'int',
2830             '*page-cache-size': 'int',
2831             '*debug': 'int' } }
2834 # @BlockdevOptionsCurlBase:
2836 # Driver specific block device options shared by all protocols supported by the
2837 # curl backend.
2839 # @url:                     URL of the image file
2841 # @readahead:               Size of the read-ahead cache; must be a multiple of
2842 #                           512 (defaults to 256 kB)
2844 # @timeout:                 Timeout for connections, in seconds (defaults to 5)
2846 # @username:                Username for authentication (defaults to none)
2848 # @password-secret:         ID of a QCryptoSecret object providing a password
2849 #                           for authentication (defaults to no password)
2851 # @proxy-username:          Username for proxy authentication (defaults to none)
2853 # @proxy-password-secret:   ID of a QCryptoSecret object providing a password
2854 #                           for proxy authentication (defaults to no password)
2856 # Since: 2.9
2858 { 'struct': 'BlockdevOptionsCurlBase',
2859   'data': { 'url': 'str',
2860             '*readahead': 'int',
2861             '*timeout': 'int',
2862             '*username': 'str',
2863             '*password-secret': 'str',
2864             '*proxy-username': 'str',
2865             '*proxy-password-secret': 'str' } }
2868 # @BlockdevOptionsCurlHttp:
2870 # Driver specific block device options for HTTP connections over the curl
2871 # backend.  URLs must start with "http://".
2873 # @cookie:      List of cookies to set; format is
2874 #               "name1=content1; name2=content2;" as explained by
2875 #               CURLOPT_COOKIE(3). Defaults to no cookies.
2877 # @cookie-secret: ID of a QCryptoSecret object providing the cookie data in a
2878 #                 secure way. See @cookie for the format. (since 2.10)
2880 # Since: 2.9
2882 { 'struct': 'BlockdevOptionsCurlHttp',
2883   'base': 'BlockdevOptionsCurlBase',
2884   'data': { '*cookie': 'str',
2885             '*cookie-secret': 'str'} }
2888 # @BlockdevOptionsCurlHttps:
2890 # Driver specific block device options for HTTPS connections over the curl
2891 # backend.  URLs must start with "https://".
2893 # @cookie:      List of cookies to set; format is
2894 #               "name1=content1; name2=content2;" as explained by
2895 #               CURLOPT_COOKIE(3). Defaults to no cookies.
2897 # @sslverify:   Whether to verify the SSL certificate's validity (defaults to
2898 #               true)
2900 # @cookie-secret: ID of a QCryptoSecret object providing the cookie data in a
2901 #                 secure way. See @cookie for the format. (since 2.10)
2903 # Since: 2.9
2905 { 'struct': 'BlockdevOptionsCurlHttps',
2906   'base': 'BlockdevOptionsCurlBase',
2907   'data': { '*cookie': 'str',
2908             '*sslverify': 'bool',
2909             '*cookie-secret': 'str'} }
2912 # @BlockdevOptionsCurlFtp:
2914 # Driver specific block device options for FTP connections over the curl
2915 # backend.  URLs must start with "ftp://".
2917 # Since: 2.9
2919 { 'struct': 'BlockdevOptionsCurlFtp',
2920   'base': 'BlockdevOptionsCurlBase',
2921   'data': { } }
2924 # @BlockdevOptionsCurlFtps:
2926 # Driver specific block device options for FTPS connections over the curl
2927 # backend.  URLs must start with "ftps://".
2929 # @sslverify:   Whether to verify the SSL certificate's validity (defaults to
2930 #               true)
2932 # Since: 2.9
2934 { 'struct': 'BlockdevOptionsCurlFtps',
2935   'base': 'BlockdevOptionsCurlBase',
2936   'data': { '*sslverify': 'bool' } }
2939 # @BlockdevOptionsNbd:
2941 # Driver specific block device options for NBD.
2943 # @server:      NBD server address
2945 # @export:      export name
2947 # @tls-creds:   TLS credentials ID
2949 # Since: 2.9
2951 { 'struct': 'BlockdevOptionsNbd',
2952   'data': { 'server': 'SocketAddress',
2953             '*export': 'str',
2954             '*tls-creds': 'str' } }
2957 # @BlockdevOptionsRaw:
2959 # Driver specific block device options for the raw driver.
2961 # @offset:      position where the block device starts
2962 # @size:        the assumed size of the device
2964 # Since: 2.9
2966 { 'struct': 'BlockdevOptionsRaw',
2967   'base': 'BlockdevOptionsGenericFormat',
2968   'data': { '*offset': 'int', '*size': 'int' } }
2971 # @BlockdevOptionsVxHS:
2973 # Driver specific block device options for VxHS
2975 # @vdisk-id:    UUID of VxHS volume
2976 # @server:      vxhs server IP, port
2977 # @tls-creds:   TLS credentials ID
2979 # Since: 2.10
2981 { 'struct': 'BlockdevOptionsVxHS',
2982   'data': { 'vdisk-id': 'str',
2983             'server': 'InetSocketAddressBase',
2984             '*tls-creds': 'str' } }
2987 # @BlockdevOptions:
2989 # Options for creating a block device.  Many options are available for all
2990 # block devices, independent of the block driver:
2992 # @driver:        block driver name
2993 # @node-name:     the node name of the new node (Since 2.0).
2994 #                 This option is required on the top level of blockdev-add.
2995 # @discard:       discard-related options (default: ignore)
2996 # @cache:         cache-related options
2997 # @read-only:     whether the block device should be read-only
2998 #                 (default: false)
2999 # @detect-zeroes: detect and optimize zero writes (Since 2.1)
3000 #                 (default: off)
3001 # @force-share:   force share all permission on added nodes.
3002 #                 Requires read-only=true. (Since 2.10)
3004 # Remaining options are determined by the block driver.
3006 # Since: 2.9
3008 { 'union': 'BlockdevOptions',
3009   'base': { 'driver': 'BlockdevDriver',
3010             '*node-name': 'str',
3011             '*discard': 'BlockdevDiscardOptions',
3012             '*cache': 'BlockdevCacheOptions',
3013             '*read-only': 'bool',
3014             '*force-share': 'bool',
3015             '*detect-zeroes': 'BlockdevDetectZeroesOptions' },
3016   'discriminator': 'driver',
3017   'data': {
3018       'blkdebug':   'BlockdevOptionsBlkdebug',
3019       'blkverify':  'BlockdevOptionsBlkverify',
3020       'bochs':      'BlockdevOptionsGenericFormat',
3021       'cloop':      'BlockdevOptionsGenericFormat',
3022       'dmg':        'BlockdevOptionsGenericFormat',
3023       'file':       'BlockdevOptionsFile',
3024       'ftp':        'BlockdevOptionsCurlFtp',
3025       'ftps':       'BlockdevOptionsCurlFtps',
3026       'gluster':    'BlockdevOptionsGluster',
3027       'host_cdrom': 'BlockdevOptionsFile',
3028       'host_device':'BlockdevOptionsFile',
3029       'http':       'BlockdevOptionsCurlHttp',
3030       'https':      'BlockdevOptionsCurlHttps',
3031       'iscsi':      'BlockdevOptionsIscsi',
3032       'luks':       'BlockdevOptionsLUKS',
3033       'nbd':        'BlockdevOptionsNbd',
3034       'nfs':        'BlockdevOptionsNfs',
3035       'null-aio':   'BlockdevOptionsNull',
3036       'null-co':    'BlockdevOptionsNull',
3037       'parallels':  'BlockdevOptionsGenericFormat',
3038       'qcow2':      'BlockdevOptionsQcow2',
3039       'qcow':       'BlockdevOptionsQcow',
3040       'qed':        'BlockdevOptionsGenericCOWFormat',
3041       'quorum':     'BlockdevOptionsQuorum',
3042       'raw':        'BlockdevOptionsRaw',
3043       'rbd':        'BlockdevOptionsRbd',
3044       'replication':'BlockdevOptionsReplication',
3045       'sheepdog':   'BlockdevOptionsSheepdog',
3046       'ssh':        'BlockdevOptionsSsh',
3047       'vdi':        'BlockdevOptionsGenericFormat',
3048       'vhdx':       'BlockdevOptionsGenericFormat',
3049       'vmdk':       'BlockdevOptionsGenericCOWFormat',
3050       'vpc':        'BlockdevOptionsGenericFormat',
3051       'vvfat':      'BlockdevOptionsVVFAT',
3052       'vxhs':       'BlockdevOptionsVxHS'
3053   } }
3056 # @BlockdevRef:
3058 # Reference to a block device.
3060 # @definition:      defines a new block device inline
3061 # @reference:       references the ID of an existing block device. An
3062 #                   empty string means that no block device should be
3063 #                   referenced.
3065 # Since: 2.9
3067 { 'alternate': 'BlockdevRef',
3068   'data': { 'definition': 'BlockdevOptions',
3069             'reference': 'str' } }
3072 # @blockdev-add:
3074 # Creates a new block device. If the @id option is given at the top level, a
3075 # BlockBackend will be created; otherwise, @node-name is mandatory at the top
3076 # level and no BlockBackend will be created.
3078 # Since: 2.9
3080 # Example:
3082 # 1.
3083 # -> { "execute": "blockdev-add",
3084 #      "arguments": {
3085 #           "driver": "qcow2",
3086 #           "node-name": "test1",
3087 #           "file": {
3088 #               "driver": "file",
3089 #               "filename": "test.qcow2"
3090 #            }
3091 #       }
3092 #     }
3093 # <- { "return": {} }
3095 # 2.
3096 # -> { "execute": "blockdev-add",
3097 #      "arguments": {
3098 #           "driver": "qcow2",
3099 #           "node-name": "node0",
3100 #           "discard": "unmap",
3101 #           "cache": {
3102 #              "direct": true
3103 #            },
3104 #            "file": {
3105 #              "driver": "file",
3106 #              "filename": "/tmp/test.qcow2"
3107 #            },
3108 #            "backing": {
3109 #               "driver": "raw",
3110 #               "file": {
3111 #                  "driver": "file",
3112 #                  "filename": "/dev/fdset/4"
3113 #                }
3114 #            }
3115 #        }
3116 #      }
3118 # <- { "return": {} }
3121 { 'command': 'blockdev-add', 'data': 'BlockdevOptions', 'boxed': true }
3124 # @blockdev-del:
3126 # Deletes a block device that has been added using blockdev-add.
3127 # The command will fail if the node is attached to a device or is
3128 # otherwise being used.
3130 # @node-name: Name of the graph node to delete.
3132 # Since: 2.9
3134 # Example:
3136 # -> { "execute": "blockdev-add",
3137 #      "arguments": {
3138 #           "driver": "qcow2",
3139 #           "node-name": "node0",
3140 #           "file": {
3141 #               "driver": "file",
3142 #               "filename": "test.qcow2"
3143 #           }
3144 #      }
3145 #    }
3146 # <- { "return": {} }
3148 # -> { "execute": "blockdev-del",
3149 #      "arguments": { "node-name": "node0" }
3150 #    }
3151 # <- { "return": {} }
3154 { 'command': 'blockdev-del', 'data': { 'node-name': 'str' } }
3157 # @blockdev-open-tray:
3159 # Opens a block device's tray. If there is a block driver state tree inserted as
3160 # a medium, it will become inaccessible to the guest (but it will remain
3161 # associated to the block device, so closing the tray will make it accessible
3162 # again).
3164 # If the tray was already open before, this will be a no-op.
3166 # Once the tray opens, a DEVICE_TRAY_MOVED event is emitted. There are cases in
3167 # which no such event will be generated, these include:
3168 # - if the guest has locked the tray, @force is false and the guest does not
3169 #   respond to the eject request
3170 # - if the BlockBackend denoted by @device does not have a guest device attached
3171 #   to it
3172 # - if the guest device does not have an actual tray
3174 # @device: Block device name (deprecated, use @id instead)
3176 # @id:     The name or QOM path of the guest device (since: 2.8)
3178 # @force:  if false (the default), an eject request will be sent to
3179 #          the guest if it has locked the tray (and the tray will not be opened
3180 #          immediately); if true, the tray will be opened regardless of whether
3181 #          it is locked
3183 # Since: 2.5
3185 # Example:
3187 # -> { "execute": "blockdev-open-tray",
3188 #      "arguments": { "id": "ide0-1-0" } }
3190 # <- { "timestamp": { "seconds": 1418751016,
3191 #                     "microseconds": 716996 },
3192 #      "event": "DEVICE_TRAY_MOVED",
3193 #      "data": { "device": "ide1-cd0",
3194 #                "id": "ide0-1-0",
3195 #                "tray-open": true } }
3197 # <- { "return": {} }
3200 { 'command': 'blockdev-open-tray',
3201   'data': { '*device': 'str',
3202             '*id': 'str',
3203             '*force': 'bool' } }
3206 # @blockdev-close-tray:
3208 # Closes a block device's tray. If there is a block driver state tree associated
3209 # with the block device (which is currently ejected), that tree will be loaded
3210 # as the medium.
3212 # If the tray was already closed before, this will be a no-op.
3214 # @device:  Block device name (deprecated, use @id instead)
3216 # @id:      The name or QOM path of the guest device (since: 2.8)
3218 # Since: 2.5
3220 # Example:
3222 # -> { "execute": "blockdev-close-tray",
3223 #      "arguments": { "id": "ide0-1-0" } }
3225 # <- { "timestamp": { "seconds": 1418751345,
3226 #                     "microseconds": 272147 },
3227 #      "event": "DEVICE_TRAY_MOVED",
3228 #      "data": { "device": "ide1-cd0",
3229 #                "id": "ide0-1-0",
3230 #                "tray-open": false } }
3232 # <- { "return": {} }
3235 { 'command': 'blockdev-close-tray',
3236   'data': { '*device': 'str',
3237             '*id': 'str' } }
3240 # @x-blockdev-remove-medium:
3242 # Removes a medium (a block driver state tree) from a block device. That block
3243 # device's tray must currently be open (unless there is no attached guest
3244 # device).
3246 # If the tray is open and there is no medium inserted, this will be a no-op.
3248 # @device: Block device name (deprecated, use @id instead)
3250 # @id:     The name or QOM path of the guest device (since: 2.8)
3252 # Note: This command is still a work in progress and is considered experimental.
3253 # Stay away from it unless you want to help with its development.
3255 # Since: 2.5
3257 # Example:
3259 # -> { "execute": "x-blockdev-remove-medium",
3260 #      "arguments": { "id": "ide0-1-0" } }
3262 # <- { "error": { "class": "GenericError",
3263 #                 "desc": "Tray of device 'ide0-1-0' is not open" } }
3265 # -> { "execute": "blockdev-open-tray",
3266 #      "arguments": { "id": "ide0-1-0" } }
3268 # <- { "timestamp": { "seconds": 1418751627,
3269 #                     "microseconds": 549958 },
3270 #      "event": "DEVICE_TRAY_MOVED",
3271 #      "data": { "device": "ide1-cd0",
3272 #                "id": "ide0-1-0",
3273 #                "tray-open": true } }
3275 # <- { "return": {} }
3277 # -> { "execute": "x-blockdev-remove-medium",
3278 #      "arguments": { "id": "ide0-1-0" } }
3280 # <- { "return": {} }
3283 { 'command': 'x-blockdev-remove-medium',
3284   'data': { '*device': 'str',
3285             '*id': 'str' } }
3288 # @x-blockdev-insert-medium:
3290 # Inserts a medium (a block driver state tree) into a block device. That block
3291 # device's tray must currently be open (unless there is no attached guest
3292 # device) and there must be no medium inserted already.
3294 # @device:    Block device name (deprecated, use @id instead)
3296 # @id:        The name or QOM path of the guest device (since: 2.8)
3298 # @node-name: name of a node in the block driver state graph
3300 # Note: This command is still a work in progress and is considered experimental.
3301 # Stay away from it unless you want to help with its development.
3303 # Since: 2.5
3305 # Example:
3307 # -> { "execute": "blockdev-add",
3308 #      "arguments": {
3309 #          "node-name": "node0",
3310 #          "driver": "raw",
3311 #          "file": { "driver": "file",
3312 #                    "filename": "fedora.iso" } } }
3313 # <- { "return": {} }
3315 # -> { "execute": "x-blockdev-insert-medium",
3316 #      "arguments": { "id": "ide0-1-0",
3317 #                     "node-name": "node0" } }
3319 # <- { "return": {} }
3322 { 'command': 'x-blockdev-insert-medium',
3323   'data': { '*device': 'str',
3324             '*id': 'str',
3325             'node-name': 'str'} }
3329 # @BlockdevChangeReadOnlyMode:
3331 # Specifies the new read-only mode of a block device subject to the
3332 # @blockdev-change-medium command.
3334 # @retain:      Retains the current read-only mode
3336 # @read-only:   Makes the device read-only
3338 # @read-write:  Makes the device writable
3340 # Since: 2.3
3343 { 'enum': 'BlockdevChangeReadOnlyMode',
3344   'data': ['retain', 'read-only', 'read-write'] }
3348 # @blockdev-change-medium:
3350 # Changes the medium inserted into a block device by ejecting the current medium
3351 # and loading a new image file which is inserted as the new medium (this command
3352 # combines blockdev-open-tray, x-blockdev-remove-medium,
3353 # x-blockdev-insert-medium and blockdev-close-tray).
3355 # @device:          Block device name (deprecated, use @id instead)
3357 # @id:              The name or QOM path of the guest device
3358 #                   (since: 2.8)
3360 # @filename:        filename of the new image to be loaded
3362 # @format:          format to open the new image with (defaults to
3363 #                   the probed format)
3365 # @read-only-mode:  change the read-only mode of the device; defaults
3366 #                   to 'retain'
3368 # Since: 2.5
3370 # Examples:
3372 # 1. Change a removable medium
3374 # -> { "execute": "blockdev-change-medium",
3375 #      "arguments": { "id": "ide0-1-0",
3376 #                     "filename": "/srv/images/Fedora-12-x86_64-DVD.iso",
3377 #                     "format": "raw" } }
3378 # <- { "return": {} }
3380 # 2. Load a read-only medium into a writable drive
3382 # -> { "execute": "blockdev-change-medium",
3383 #      "arguments": { "id": "floppyA",
3384 #                     "filename": "/srv/images/ro.img",
3385 #                     "format": "raw",
3386 #                     "read-only-mode": "retain" } }
3388 # <- { "error":
3389 #      { "class": "GenericError",
3390 #        "desc": "Could not open '/srv/images/ro.img': Permission denied" } }
3392 # -> { "execute": "blockdev-change-medium",
3393 #      "arguments": { "id": "floppyA",
3394 #                     "filename": "/srv/images/ro.img",
3395 #                     "format": "raw",
3396 #                     "read-only-mode": "read-only" } }
3398 # <- { "return": {} }
3401 { 'command': 'blockdev-change-medium',
3402   'data': { '*device': 'str',
3403             '*id': 'str',
3404             'filename': 'str',
3405             '*format': 'str',
3406             '*read-only-mode': 'BlockdevChangeReadOnlyMode' } }
3410 # @BlockErrorAction:
3412 # An enumeration of action that has been taken when a DISK I/O occurs
3414 # @ignore: error has been ignored
3416 # @report: error has been reported to the device
3418 # @stop: error caused VM to be stopped
3420 # Since: 2.1
3422 { 'enum': 'BlockErrorAction',
3423   'data': [ 'ignore', 'report', 'stop' ] }
3427 # @BLOCK_IMAGE_CORRUPTED:
3429 # Emitted when a disk image is being marked corrupt. The image can be
3430 # identified by its device or node name. The 'device' field is always
3431 # present for compatibility reasons, but it can be empty ("") if the
3432 # image does not have a device name associated.
3434 # @device: device name. This is always present for compatibility
3435 #          reasons, but it can be empty ("") if the image does not
3436 #          have a device name associated.
3438 # @node-name: node name (Since: 2.4)
3440 # @msg: informative message for human consumption, such as the kind of
3441 #       corruption being detected. It should not be parsed by machine as it is
3442 #       not guaranteed to be stable
3444 # @offset: if the corruption resulted from an image access, this is
3445 #          the host's access offset into the image
3447 # @size: if the corruption resulted from an image access, this is
3448 #        the access size
3450 # @fatal: if set, the image is marked corrupt and therefore unusable after this
3451 #        event and must be repaired (Since 2.2; before, every
3452 #        BLOCK_IMAGE_CORRUPTED event was fatal)
3454 # Note: If action is "stop", a STOP event will eventually follow the
3455 #       BLOCK_IO_ERROR event.
3457 # Example:
3459 # <- { "event": "BLOCK_IMAGE_CORRUPTED",
3460 #      "data": { "device": "ide0-hd0", "node-name": "node0",
3461 #                "msg": "Prevented active L1 table overwrite", "offset": 196608,
3462 #                "size": 65536 },
3463 #      "timestamp": { "seconds": 1378126126, "microseconds": 966463 } }
3465 # Since: 1.7
3467 { 'event': 'BLOCK_IMAGE_CORRUPTED',
3468   'data': { 'device'     : 'str',
3469             '*node-name' : 'str',
3470             'msg'        : 'str',
3471             '*offset'    : 'int',
3472             '*size'      : 'int',
3473             'fatal'      : 'bool' } }
3476 # @BLOCK_IO_ERROR:
3478 # Emitted when a disk I/O error occurs
3480 # @device: device name. This is always present for compatibility
3481 #          reasons, but it can be empty ("") if the image does not
3482 #          have a device name associated.
3484 # @node-name: node name. Note that errors may be reported for the root node
3485 #             that is directly attached to a guest device rather than for the
3486 #             node where the error occurred. (Since: 2.8)
3488 # @operation: I/O operation
3490 # @action: action that has been taken
3492 # @nospace: true if I/O error was caused due to a no-space
3493 #           condition. This key is only present if query-block's
3494 #           io-status is present, please see query-block documentation
3495 #           for more information (since: 2.2)
3497 # @reason: human readable string describing the error cause.
3498 #          (This field is a debugging aid for humans, it should not
3499 #           be parsed by applications) (since: 2.2)
3501 # Note: If action is "stop", a STOP event will eventually follow the
3502 # BLOCK_IO_ERROR event
3504 # Since: 0.13.0
3506 # Example:
3508 # <- { "event": "BLOCK_IO_ERROR",
3509 #      "data": { "device": "ide0-hd1",
3510 #                "node-name": "#block212",
3511 #                "operation": "write",
3512 #                "action": "stop" },
3513 #      "timestamp": { "seconds": 1265044230, "microseconds": 450486 } }
3516 { 'event': 'BLOCK_IO_ERROR',
3517   'data': { 'device': 'str', 'node-name': 'str', 'operation': 'IoOperationType',
3518             'action': 'BlockErrorAction', '*nospace': 'bool',
3519             'reason': 'str' } }
3522 # @BLOCK_JOB_COMPLETED:
3524 # Emitted when a block job has completed
3526 # @type: job type
3528 # @device: The job identifier. Originally the device name but other
3529 #          values are allowed since QEMU 2.7
3531 # @len: maximum progress value
3533 # @offset: current progress value. On success this is equal to len.
3534 #          On failure this is less than len
3536 # @speed: rate limit, bytes per second
3538 # @error: error message. Only present on failure. This field
3539 #         contains a human-readable error message. There are no semantics
3540 #         other than that streaming has failed and clients should not try to
3541 #         interpret the error string
3543 # Since: 1.1
3545 # Example:
3547 # <- { "event": "BLOCK_JOB_COMPLETED",
3548 #      "data": { "type": "stream", "device": "virtio-disk0",
3549 #                "len": 10737418240, "offset": 10737418240,
3550 #                "speed": 0 },
3551 #      "timestamp": { "seconds": 1267061043, "microseconds": 959568 } }
3554 { 'event': 'BLOCK_JOB_COMPLETED',
3555   'data': { 'type'  : 'BlockJobType',
3556             'device': 'str',
3557             'len'   : 'int',
3558             'offset': 'int',
3559             'speed' : 'int',
3560             '*error': 'str' } }
3563 # @BLOCK_JOB_CANCELLED:
3565 # Emitted when a block job has been cancelled
3567 # @type: job type
3569 # @device: The job identifier. Originally the device name but other
3570 #          values are allowed since QEMU 2.7
3572 # @len: maximum progress value
3574 # @offset: current progress value. On success this is equal to len.
3575 #          On failure this is less than len
3577 # @speed: rate limit, bytes per second
3579 # Since: 1.1
3581 # Example:
3583 # <- { "event": "BLOCK_JOB_CANCELLED",
3584 #      "data": { "type": "stream", "device": "virtio-disk0",
3585 #                "len": 10737418240, "offset": 134217728,
3586 #                "speed": 0 },
3587 #      "timestamp": { "seconds": 1267061043, "microseconds": 959568 } }
3590 { 'event': 'BLOCK_JOB_CANCELLED',
3591   'data': { 'type'  : 'BlockJobType',
3592             'device': 'str',
3593             'len'   : 'int',
3594             'offset': 'int',
3595             'speed' : 'int' } }
3598 # @BLOCK_JOB_ERROR:
3600 # Emitted when a block job encounters an error
3602 # @device: The job identifier. Originally the device name but other
3603 #          values are allowed since QEMU 2.7
3605 # @operation: I/O operation
3607 # @action: action that has been taken
3609 # Since: 1.3
3611 # Example:
3613 # <- { "event": "BLOCK_JOB_ERROR",
3614 #      "data": { "device": "ide0-hd1",
3615 #                "operation": "write",
3616 #                "action": "stop" },
3617 #      "timestamp": { "seconds": 1265044230, "microseconds": 450486 } }
3620 { 'event': 'BLOCK_JOB_ERROR',
3621   'data': { 'device'   : 'str',
3622             'operation': 'IoOperationType',
3623             'action'   : 'BlockErrorAction' } }
3626 # @BLOCK_JOB_READY:
3628 # Emitted when a block job is ready to complete
3630 # @type: job type
3632 # @device: The job identifier. Originally the device name but other
3633 #          values are allowed since QEMU 2.7
3635 # @len: maximum progress value
3637 # @offset: current progress value. On success this is equal to len.
3638 #          On failure this is less than len
3640 # @speed: rate limit, bytes per second
3642 # Note: The "ready to complete" status is always reset by a @BLOCK_JOB_ERROR
3643 # event
3645 # Since: 1.3
3647 # Example:
3649 # <- { "event": "BLOCK_JOB_READY",
3650 #      "data": { "device": "drive0", "type": "mirror", "speed": 0,
3651 #                "len": 2097152, "offset": 2097152 }
3652 #      "timestamp": { "seconds": 1265044230, "microseconds": 450486 } }
3655 { 'event': 'BLOCK_JOB_READY',
3656   'data': { 'type'  : 'BlockJobType',
3657             'device': 'str',
3658             'len'   : 'int',
3659             'offset': 'int',
3660             'speed' : 'int' } }
3663 # @PreallocMode:
3665 # Preallocation mode of QEMU image file
3667 # @off: no preallocation
3668 # @metadata: preallocate only for metadata
3669 # @falloc: like @full preallocation but allocate disk space by
3670 #          posix_fallocate() rather than writing zeros.
3671 # @full: preallocate all data by writing zeros to device to ensure disk
3672 #        space is really available. @full preallocation also sets up
3673 #        metadata correctly.
3675 # Since: 2.2
3677 { 'enum': 'PreallocMode',
3678   'data': [ 'off', 'metadata', 'falloc', 'full' ] }
3681 # @BLOCK_WRITE_THRESHOLD:
3683 # Emitted when writes on block device reaches or exceeds the
3684 # configured write threshold. For thin-provisioned devices, this
3685 # means the device should be extended to avoid pausing for
3686 # disk exhaustion.
3687 # The event is one shot. Once triggered, it needs to be
3688 # re-registered with another block-set-write-threshold command.
3690 # @node-name: graph node name on which the threshold was exceeded.
3692 # @amount-exceeded: amount of data which exceeded the threshold, in bytes.
3694 # @write-threshold: last configured threshold, in bytes.
3696 # Since: 2.3
3698 { 'event': 'BLOCK_WRITE_THRESHOLD',
3699   'data': { 'node-name': 'str',
3700             'amount-exceeded': 'uint64',
3701             'write-threshold': 'uint64' } }
3704 # @block-set-write-threshold:
3706 # Change the write threshold for a block drive. An event will be
3707 # delivered if a write to this block drive crosses the configured
3708 # threshold.  The threshold is an offset, thus must be
3709 # non-negative. Default is no write threshold. Setting the threshold
3710 # to zero disables it.
3712 # This is useful to transparently resize thin-provisioned drives without
3713 # the guest OS noticing.
3715 # @node-name: graph node name on which the threshold must be set.
3717 # @write-threshold: configured threshold for the block device, bytes.
3718 #                   Use 0 to disable the threshold.
3720 # Since: 2.3
3722 # Example:
3724 # -> { "execute": "block-set-write-threshold",
3725 #      "arguments": { "node-name": "mydev",
3726 #                     "write-threshold": 17179869184 } }
3727 # <- { "return": {} }
3730 { 'command': 'block-set-write-threshold',
3731   'data': { 'node-name': 'str', 'write-threshold': 'uint64' } }
3734 # @x-blockdev-change:
3736 # Dynamically reconfigure the block driver state graph. It can be used
3737 # to add, remove, insert or replace a graph node. Currently only the
3738 # Quorum driver implements this feature to add or remove its child. This
3739 # is useful to fix a broken quorum child.
3741 # If @node is specified, it will be inserted under @parent. @child
3742 # may not be specified in this case. If both @parent and @child are
3743 # specified but @node is not, @child will be detached from @parent.
3745 # @parent: the id or name of the parent node.
3747 # @child: the name of a child under the given parent node.
3749 # @node: the name of the node that will be added.
3751 # Note: this command is experimental, and its API is not stable. It
3752 # does not support all kinds of operations, all kinds of children, nor
3753 # all block drivers.
3755 # Warning: The data in a new quorum child MUST be consistent with that of
3756 # the rest of the array.
3758 # Since: 2.7
3760 # Example:
3762 # 1. Add a new node to a quorum
3763 # -> { "execute": "blockdev-add",
3764 #      "arguments": {
3765 #          "driver": "raw",
3766 #          "node-name": "new_node",
3767 #          "file": { "driver": "file",
3768 #                    "filename": "test.raw" } } }
3769 # <- { "return": {} }
3770 # -> { "execute": "x-blockdev-change",
3771 #      "arguments": { "parent": "disk1",
3772 #                     "node": "new_node" } }
3773 # <- { "return": {} }
3775 # 2. Delete a quorum's node
3776 # -> { "execute": "x-blockdev-change",
3777 #      "arguments": { "parent": "disk1",
3778 #                     "child": "children.1" } }
3779 # <- { "return": {} }
3782 { 'command': 'x-blockdev-change',
3783   'data' : { 'parent': 'str',
3784              '*child': 'str',
3785              '*node': 'str' } }