block: remove all encryption handling APIs
[qemu/ar7.git] / qapi / block-core.json
blobd04d2771289b188807098c5235e2123be2e57ee8
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: Deprecated; always false
264 # @detect_zeroes: detect and optimize zero writes (Since 2.1)
266 # @bps: total throughput limit in bytes per second is specified
268 # @bps_rd: read throughput limit in bytes per second is specified
270 # @bps_wr: write throughput limit in bytes per second is specified
272 # @iops: total I/O operations per second is specified
274 # @iops_rd: read I/O operations per second is specified
276 # @iops_wr: write I/O operations per second is specified
278 # @image: the info of image used (since: 1.6)
280 # @bps_max: total throughput limit during bursts,
281 #                     in bytes (Since 1.7)
283 # @bps_rd_max: read throughput limit during bursts,
284 #                        in bytes (Since 1.7)
286 # @bps_wr_max: write throughput limit during bursts,
287 #                        in bytes (Since 1.7)
289 # @iops_max: total I/O operations per second during bursts,
290 #                      in bytes (Since 1.7)
292 # @iops_rd_max: read I/O operations per second during bursts,
293 #                         in bytes (Since 1.7)
295 # @iops_wr_max: write I/O operations per second during bursts,
296 #                         in bytes (Since 1.7)
298 # @bps_max_length: maximum length of the @bps_max burst
299 #                            period, in seconds. (Since 2.6)
301 # @bps_rd_max_length: maximum length of the @bps_rd_max
302 #                               burst period, in seconds. (Since 2.6)
304 # @bps_wr_max_length: maximum length of the @bps_wr_max
305 #                               burst period, in seconds. (Since 2.6)
307 # @iops_max_length: maximum length of the @iops burst
308 #                             period, in seconds. (Since 2.6)
310 # @iops_rd_max_length: maximum length of the @iops_rd_max
311 #                                burst period, in seconds. (Since 2.6)
313 # @iops_wr_max_length: maximum length of the @iops_wr_max
314 #                                burst period, in seconds. (Since 2.6)
316 # @iops_size: an I/O size in bytes (Since 1.7)
318 # @group: throttle group name (Since 2.4)
320 # @cache: the cache mode used for the block device (since: 2.3)
322 # @write_threshold: configured write threshold for the device.
323 #                   0 if disabled. (Since 2.3)
325 # Since: 0.14.0
328 { 'struct': 'BlockDeviceInfo',
329   'data': { 'file': 'str', '*node-name': 'str', 'ro': 'bool', 'drv': 'str',
330             '*backing_file': 'str', 'backing_file_depth': 'int',
331             'encrypted': 'bool', 'encryption_key_missing': 'bool',
332             'detect_zeroes': 'BlockdevDetectZeroesOptions',
333             'bps': 'int', 'bps_rd': 'int', 'bps_wr': 'int',
334             'iops': 'int', 'iops_rd': 'int', 'iops_wr': 'int',
335             'image': 'ImageInfo',
336             '*bps_max': 'int', '*bps_rd_max': 'int',
337             '*bps_wr_max': 'int', '*iops_max': 'int',
338             '*iops_rd_max': 'int', '*iops_wr_max': 'int',
339             '*bps_max_length': 'int', '*bps_rd_max_length': 'int',
340             '*bps_wr_max_length': 'int', '*iops_max_length': 'int',
341             '*iops_rd_max_length': 'int', '*iops_wr_max_length': 'int',
342             '*iops_size': 'int', '*group': 'str', 'cache': 'BlockdevCacheInfo',
343             'write_threshold': 'int' } }
346 # @BlockDeviceIoStatus:
348 # An enumeration of block device I/O status.
350 # @ok: The last I/O operation has succeeded
352 # @failed: The last I/O operation has failed
354 # @nospace: The last I/O operation has failed due to a no-space condition
356 # Since: 1.0
358 { 'enum': 'BlockDeviceIoStatus', 'data': [ 'ok', 'failed', 'nospace' ] }
361 # @BlockDeviceMapEntry:
363 # Entry in the metadata map of the device (returned by "qemu-img map")
365 # @start: Offset in the image of the first byte described by this entry
366 #         (in bytes)
368 # @length: Length of the range described by this entry (in bytes)
370 # @depth: Number of layers (0 = top image, 1 = top image's backing file, etc.)
371 #         before reaching one for which the range is allocated.  The value is
372 #         in the range 0 to the depth of the image chain - 1.
374 # @zero: the sectors in this range read as zeros
376 # @data: reading the image will actually read data from a file (in particular,
377 #        if @offset is present this means that the sectors are not simply
378 #        preallocated, but contain actual data in raw format)
380 # @offset: if present, the image file stores the data for this range in
381 #          raw format at the given offset.
383 # Since: 1.7
385 { 'struct': 'BlockDeviceMapEntry',
386   'data': { 'start': 'int', 'length': 'int', 'depth': 'int', 'zero': 'bool',
387             'data': 'bool', '*offset': 'int' } }
390 # @DirtyBitmapStatus:
392 # An enumeration of possible states that a dirty bitmap can report to the user.
394 # @frozen: The bitmap is currently in-use by a backup operation or block job,
395 #          and is immutable.
397 # @disabled: The bitmap is currently in-use by an internal operation and is
398 #            read-only. It can still be deleted.
400 # @active: The bitmap is actively monitoring for new writes, and can be cleared,
401 #          deleted, or used for backup operations.
403 # Since: 2.4
405 { 'enum': 'DirtyBitmapStatus',
406   'data': ['active', 'disabled', 'frozen'] }
409 # @BlockDirtyInfo:
411 # Block dirty bitmap information.
413 # @name: the name of the dirty bitmap (Since 2.4)
415 # @count: number of dirty bytes according to the dirty bitmap
417 # @granularity: granularity of the dirty bitmap in bytes (since 1.4)
419 # @status: current status of the dirty bitmap (since 2.4)
421 # Since: 1.3
423 { 'struct': 'BlockDirtyInfo',
424   'data': {'*name': 'str', 'count': 'int', 'granularity': 'uint32',
425            'status': 'DirtyBitmapStatus'} }
428 # @BlockInfo:
430 # Block device information.  This structure describes a virtual device and
431 # the backing device associated with it.
433 # @device: The device name associated with the virtual device.
435 # @type: This field is returned only for compatibility reasons, it should
436 #        not be used (always returns 'unknown')
438 # @removable: True if the device supports removable media.
440 # @locked: True if the guest has locked this device from having its media
441 #          removed
443 # @tray_open: True if the device's tray is open
444 #             (only present if it has a tray)
446 # @dirty-bitmaps: dirty bitmaps information (only present if the
447 #                 driver has one or more dirty bitmaps) (Since 2.0)
449 # @io-status: @BlockDeviceIoStatus. Only present if the device
450 #             supports it and the VM is configured to stop on errors
451 #             (supported device models: virtio-blk, IDE, SCSI except
452 #             scsi-generic)
454 # @inserted: @BlockDeviceInfo describing the device if media is
455 #            present
457 # Since:  0.14.0
459 { 'struct': 'BlockInfo',
460   'data': {'device': 'str', 'type': 'str', 'removable': 'bool',
461            'locked': 'bool', '*inserted': 'BlockDeviceInfo',
462            '*tray_open': 'bool', '*io-status': 'BlockDeviceIoStatus',
463            '*dirty-bitmaps': ['BlockDirtyInfo'] } }
466 # @query-block:
468 # Get a list of BlockInfo for all virtual block devices.
470 # Returns: a list of @BlockInfo describing each virtual block device
472 # Since: 0.14.0
474 # Example:
476 # -> { "execute": "query-block" }
477 # <- {
478 #       "return":[
479 #          {
480 #             "io-status": "ok",
481 #             "device":"ide0-hd0",
482 #             "locked":false,
483 #             "removable":false,
484 #             "inserted":{
485 #                "ro":false,
486 #                "drv":"qcow2",
487 #                "encrypted":false,
488 #                "file":"disks/test.qcow2",
489 #                "backing_file_depth":1,
490 #                "bps":1000000,
491 #                "bps_rd":0,
492 #                "bps_wr":0,
493 #                "iops":1000000,
494 #                "iops_rd":0,
495 #                "iops_wr":0,
496 #                "bps_max": 8000000,
497 #                "bps_rd_max": 0,
498 #                "bps_wr_max": 0,
499 #                "iops_max": 0,
500 #                "iops_rd_max": 0,
501 #                "iops_wr_max": 0,
502 #                "iops_size": 0,
503 #                "detect_zeroes": "on",
504 #                "write_threshold": 0,
505 #                "image":{
506 #                   "filename":"disks/test.qcow2",
507 #                   "format":"qcow2",
508 #                   "virtual-size":2048000,
509 #                   "backing_file":"base.qcow2",
510 #                   "full-backing-filename":"disks/base.qcow2",
511 #                   "backing-filename-format":"qcow2",
512 #                   "snapshots":[
513 #                      {
514 #                         "id": "1",
515 #                         "name": "snapshot1",
516 #                         "vm-state-size": 0,
517 #                         "date-sec": 10000200,
518 #                         "date-nsec": 12,
519 #                         "vm-clock-sec": 206,
520 #                         "vm-clock-nsec": 30
521 #                      }
522 #                   ],
523 #                   "backing-image":{
524 #                       "filename":"disks/base.qcow2",
525 #                       "format":"qcow2",
526 #                       "virtual-size":2048000
527 #                   }
528 #                }
529 #             },
530 #             "type":"unknown"
531 #          },
532 #          {
533 #             "io-status": "ok",
534 #             "device":"ide1-cd0",
535 #             "locked":false,
536 #             "removable":true,
537 #             "type":"unknown"
538 #          },
539 #          {
540 #             "device":"floppy0",
541 #             "locked":false,
542 #             "removable":true,
543 #             "type":"unknown"
544 #          },
545 #          {
546 #             "device":"sd0",
547 #             "locked":false,
548 #             "removable":true,
549 #             "type":"unknown"
550 #          }
551 #       ]
552 #    }
555 { 'command': 'query-block', 'returns': ['BlockInfo'] }
559 # @BlockDeviceTimedStats:
561 # Statistics of a block device during a given interval of time.
563 # @interval_length: Interval used for calculating the statistics,
564 #                   in seconds.
566 # @min_rd_latency_ns: Minimum latency of read operations in the
567 #                     defined interval, in nanoseconds.
569 # @min_wr_latency_ns: Minimum latency of write operations in the
570 #                     defined interval, in nanoseconds.
572 # @min_flush_latency_ns: Minimum latency of flush operations in the
573 #                        defined interval, in nanoseconds.
575 # @max_rd_latency_ns: Maximum latency of read operations in the
576 #                     defined interval, in nanoseconds.
578 # @max_wr_latency_ns: Maximum latency of write operations in the
579 #                     defined interval, in nanoseconds.
581 # @max_flush_latency_ns: Maximum latency of flush operations in the
582 #                        defined interval, in nanoseconds.
584 # @avg_rd_latency_ns: Average latency of read operations in the
585 #                     defined interval, in nanoseconds.
587 # @avg_wr_latency_ns: Average latency of write operations in the
588 #                     defined interval, in nanoseconds.
590 # @avg_flush_latency_ns: Average latency of flush operations in the
591 #                        defined interval, in nanoseconds.
593 # @avg_rd_queue_depth: Average number of pending read operations
594 #                      in the defined interval.
596 # @avg_wr_queue_depth: Average number of pending write operations
597 #                      in the defined interval.
599 # Since: 2.5
601 { 'struct': 'BlockDeviceTimedStats',
602   'data': { 'interval_length': 'int', 'min_rd_latency_ns': 'int',
603             'max_rd_latency_ns': 'int', 'avg_rd_latency_ns': 'int',
604             'min_wr_latency_ns': 'int', 'max_wr_latency_ns': 'int',
605             'avg_wr_latency_ns': 'int', 'min_flush_latency_ns': 'int',
606             'max_flush_latency_ns': 'int', 'avg_flush_latency_ns': 'int',
607             'avg_rd_queue_depth': 'number', 'avg_wr_queue_depth': 'number' } }
610 # @BlockDeviceStats:
612 # Statistics of a virtual block device or a block backing device.
614 # @rd_bytes:      The number of bytes read by the device.
616 # @wr_bytes:      The number of bytes written by the device.
618 # @rd_operations: The number of read operations performed by the device.
620 # @wr_operations: The number of write operations performed by the device.
622 # @flush_operations: The number of cache flush operations performed by the
623 #                    device (since 0.15.0)
625 # @flush_total_time_ns: Total time spend on cache flushes in nano-seconds
626 #                       (since 0.15.0).
628 # @wr_total_time_ns: Total time spend on writes in nano-seconds (since 0.15.0).
630 # @rd_total_time_ns: Total_time_spend on reads in nano-seconds (since 0.15.0).
632 # @wr_highest_offset: The offset after the greatest byte written to the
633 #                     device.  The intended use of this information is for
634 #                     growable sparse files (like qcow2) that are used on top
635 #                     of a physical device.
637 # @rd_merged: Number of read requests that have been merged into another
638 #             request (Since 2.3).
640 # @wr_merged: Number of write requests that have been merged into another
641 #             request (Since 2.3).
643 # @idle_time_ns: Time since the last I/O operation, in
644 #                nanoseconds. If the field is absent it means that
645 #                there haven't been any operations yet (Since 2.5).
647 # @failed_rd_operations: The number of failed read operations
648 #                        performed by the device (Since 2.5)
650 # @failed_wr_operations: The number of failed write operations
651 #                        performed by the device (Since 2.5)
653 # @failed_flush_operations: The number of failed flush operations
654 #                           performed by the device (Since 2.5)
656 # @invalid_rd_operations: The number of invalid read operations
657 #                          performed by the device (Since 2.5)
659 # @invalid_wr_operations: The number of invalid write operations
660 #                         performed by the device (Since 2.5)
662 # @invalid_flush_operations: The number of invalid flush operations
663 #                            performed by the device (Since 2.5)
665 # @account_invalid: Whether invalid operations are included in the
666 #                   last access statistics (Since 2.5)
668 # @account_failed: Whether failed operations are included in the
669 #                  latency and last access statistics (Since 2.5)
671 # @timed_stats: Statistics specific to the set of previously defined
672 #               intervals of time (Since 2.5)
674 # Since: 0.14.0
676 { 'struct': 'BlockDeviceStats',
677   'data': {'rd_bytes': 'int', 'wr_bytes': 'int', 'rd_operations': 'int',
678            'wr_operations': 'int', 'flush_operations': 'int',
679            'flush_total_time_ns': 'int', 'wr_total_time_ns': 'int',
680            'rd_total_time_ns': 'int', 'wr_highest_offset': 'int',
681            'rd_merged': 'int', 'wr_merged': 'int', '*idle_time_ns': 'int',
682            'failed_rd_operations': 'int', 'failed_wr_operations': 'int',
683            'failed_flush_operations': 'int', 'invalid_rd_operations': 'int',
684            'invalid_wr_operations': 'int', 'invalid_flush_operations': 'int',
685            'account_invalid': 'bool', 'account_failed': 'bool',
686            'timed_stats': ['BlockDeviceTimedStats'] } }
689 # @BlockStats:
691 # Statistics of a virtual block device or a block backing device.
693 # @device: If the stats are for a virtual block device, the name
694 #          corresponding to the virtual block device.
696 # @node-name: The node name of the device. (Since 2.3)
698 # @stats:  A @BlockDeviceStats for the device.
700 # @parent: This describes the file block device if it has one.
701 #          Contains recursively the statistics of the underlying
702 #          protocol (e.g. the host file for a qcow2 image). If there is
703 #          no underlying protocol, this field is omitted
705 # @backing: This describes the backing block device if it has one.
706 #           (Since 2.0)
708 # Since: 0.14.0
710 { 'struct': 'BlockStats',
711   'data': {'*device': 'str', '*node-name': 'str',
712            'stats': 'BlockDeviceStats',
713            '*parent': 'BlockStats',
714            '*backing': 'BlockStats'} }
717 # @query-blockstats:
719 # Query the @BlockStats for all virtual block devices.
721 # @query-nodes: If true, the command will query all the block nodes
722 #               that have a node name, in a list which will include "parent"
723 #               information, but not "backing".
724 #               If false or omitted, the behavior is as before - query all the
725 #               device backends, recursively including their "parent" and
726 #               "backing". (Since 2.3)
728 # Returns: A list of @BlockStats for each virtual block devices.
730 # Since: 0.14.0
732 # Example:
734 # -> { "execute": "query-blockstats" }
735 # <- {
736 #       "return":[
737 #          {
738 #             "device":"ide0-hd0",
739 #             "parent":{
740 #                "stats":{
741 #                   "wr_highest_offset":3686448128,
742 #                   "wr_bytes":9786368,
743 #                   "wr_operations":751,
744 #                   "rd_bytes":122567168,
745 #                   "rd_operations":36772
746 #                   "wr_total_times_ns":313253456
747 #                   "rd_total_times_ns":3465673657
748 #                   "flush_total_times_ns":49653
749 #                   "flush_operations":61,
750 #                   "rd_merged":0,
751 #                   "wr_merged":0,
752 #                   "idle_time_ns":2953431879,
753 #                   "account_invalid":true,
754 #                   "account_failed":false
755 #                }
756 #             },
757 #             "stats":{
758 #                "wr_highest_offset":2821110784,
759 #                "wr_bytes":9786368,
760 #                "wr_operations":692,
761 #                "rd_bytes":122739200,
762 #                "rd_operations":36604
763 #                "flush_operations":51,
764 #                "wr_total_times_ns":313253456
765 #                "rd_total_times_ns":3465673657
766 #                "flush_total_times_ns":49653,
767 #                "rd_merged":0,
768 #                "wr_merged":0,
769 #                "idle_time_ns":2953431879,
770 #                "account_invalid":true,
771 #                "account_failed":false
772 #             }
773 #          },
774 #          {
775 #             "device":"ide1-cd0",
776 #             "stats":{
777 #                "wr_highest_offset":0,
778 #                "wr_bytes":0,
779 #                "wr_operations":0,
780 #                "rd_bytes":0,
781 #                "rd_operations":0
782 #                "flush_operations":0,
783 #                "wr_total_times_ns":0
784 #                "rd_total_times_ns":0
785 #                "flush_total_times_ns":0,
786 #                "rd_merged":0,
787 #                "wr_merged":0,
788 #                "account_invalid":false,
789 #                "account_failed":false
790 #             }
791 #          },
792 #          {
793 #             "device":"floppy0",
794 #             "stats":{
795 #                "wr_highest_offset":0,
796 #                "wr_bytes":0,
797 #                "wr_operations":0,
798 #                "rd_bytes":0,
799 #                "rd_operations":0
800 #                "flush_operations":0,
801 #                "wr_total_times_ns":0
802 #                "rd_total_times_ns":0
803 #                "flush_total_times_ns":0,
804 #                "rd_merged":0,
805 #                "wr_merged":0,
806 #                "account_invalid":false,
807 #                "account_failed":false
808 #             }
809 #          },
810 #          {
811 #             "device":"sd0",
812 #             "stats":{
813 #                "wr_highest_offset":0,
814 #                "wr_bytes":0,
815 #                "wr_operations":0,
816 #                "rd_bytes":0,
817 #                "rd_operations":0
818 #                "flush_operations":0,
819 #                "wr_total_times_ns":0
820 #                "rd_total_times_ns":0
821 #                "flush_total_times_ns":0,
822 #                "rd_merged":0,
823 #                "wr_merged":0,
824 #                "account_invalid":false,
825 #                "account_failed":false
826 #             }
827 #          }
828 #       ]
829 #    }
832 { 'command': 'query-blockstats',
833   'data': { '*query-nodes': 'bool' },
834   'returns': ['BlockStats'] }
837 # @BlockdevOnError:
839 # An enumeration of possible behaviors for errors on I/O operations.
840 # The exact meaning depends on whether the I/O was initiated by a guest
841 # or by a block job
843 # @report: for guest operations, report the error to the guest;
844 #          for jobs, cancel the job
846 # @ignore: ignore the error, only report a QMP event (BLOCK_IO_ERROR
847 #          or BLOCK_JOB_ERROR)
849 # @enospc: same as @stop on ENOSPC, same as @report otherwise.
851 # @stop: for guest operations, stop the virtual machine;
852 #        for jobs, pause the job
854 # @auto: inherit the error handling policy of the backend (since: 2.7)
856 # Since: 1.3
858 { 'enum': 'BlockdevOnError',
859   'data': ['report', 'ignore', 'enospc', 'stop', 'auto'] }
862 # @MirrorSyncMode:
864 # An enumeration of possible behaviors for the initial synchronization
865 # phase of storage mirroring.
867 # @top: copies data in the topmost image to the destination
869 # @full: copies data from all images to the destination
871 # @none: only copy data written from now on
873 # @incremental: only copy data described by the dirty bitmap. Since: 2.4
875 # Since: 1.3
877 { 'enum': 'MirrorSyncMode',
878   'data': ['top', 'full', 'none', 'incremental'] }
881 # @BlockJobType:
883 # Type of a block job.
885 # @commit: block commit job type, see "block-commit"
887 # @stream: block stream job type, see "block-stream"
889 # @mirror: drive mirror job type, see "drive-mirror"
891 # @backup: drive backup job type, see "drive-backup"
893 # Since: 1.7
895 { 'enum': 'BlockJobType',
896   'data': ['commit', 'stream', 'mirror', 'backup'] }
899 # @BlockJobInfo:
901 # Information about a long-running block device operation.
903 # @type: the job type ('stream' for image streaming)
905 # @device: The job identifier. Originally the device name but other
906 #          values are allowed since QEMU 2.7
908 # @len: the maximum progress value
910 # @busy: false if the job is known to be in a quiescent state, with
911 #        no pending I/O.  Since 1.3.
913 # @paused: whether the job is paused or, if @busy is true, will
914 #          pause itself as soon as possible.  Since 1.3.
916 # @offset: the current progress value
918 # @speed: the rate limit, bytes per second
920 # @io-status: the status of the job (since 1.3)
922 # @ready: true if the job may be completed (since 2.2)
924 # Since: 1.1
926 { 'struct': 'BlockJobInfo',
927   'data': {'type': 'str', 'device': 'str', 'len': 'int',
928            'offset': 'int', 'busy': 'bool', 'paused': 'bool', 'speed': 'int',
929            'io-status': 'BlockDeviceIoStatus', 'ready': 'bool'} }
932 # @query-block-jobs:
934 # Return information about long-running block device operations.
936 # Returns: a list of @BlockJobInfo for each active block job
938 # Since: 1.1
940 { 'command': 'query-block-jobs', 'returns': ['BlockJobInfo'] }
943 # @block_passwd:
945 # This command sets the password of a block device that has not been open
946 # with a password and requires one.
948 # This command is now obsolete and will always return an error since 2.10
951 { 'command': 'block_passwd', 'data': {'*device': 'str',
952                                       '*node-name': 'str', 'password': 'str'} }
955 # @block_resize:
957 # Resize a block image while a guest is running.
959 # Either @device or @node-name must be set but not both.
961 # @device: the name of the device to get the image resized
963 # @node-name: graph node name to get the image resized (Since 2.0)
965 # @size:  new image size in bytes
967 # Returns: nothing on success
968 #          If @device is not a valid block device, DeviceNotFound
970 # Since: 0.14.0
972 # Example:
974 # -> { "execute": "block_resize",
975 #      "arguments": { "device": "scratch", "size": 1073741824 } }
976 # <- { "return": {} }
979 { 'command': 'block_resize', 'data': { '*device': 'str',
980                                        '*node-name': 'str',
981                                        'size': 'int' }}
984 # @NewImageMode:
986 # An enumeration that tells QEMU how to set the backing file path in
987 # a new image file.
989 # @existing: QEMU should look for an existing image file.
991 # @absolute-paths: QEMU should create a new image with absolute paths
992 # for the backing file. If there is no backing file available, the new
993 # image will not be backed either.
995 # Since: 1.1
997 { 'enum': 'NewImageMode',
998   'data': [ 'existing', 'absolute-paths' ] }
1001 # @BlockdevSnapshotSync:
1003 # Either @device or @node-name must be set but not both.
1005 # @device: the name of the device to generate the snapshot from.
1007 # @node-name: graph node name to generate the snapshot from (Since 2.0)
1009 # @snapshot-file: the target of the new image. If the file exists, or
1010 # if it is a device, the snapshot will be created in the existing
1011 # file/device. Otherwise, a new file will be created.
1013 # @snapshot-node-name: the graph node name of the new image (Since 2.0)
1015 # @format: the format of the snapshot image, default is 'qcow2'.
1017 # @mode: whether and how QEMU should create a new image, default is
1018 #        'absolute-paths'.
1020 { 'struct': 'BlockdevSnapshotSync',
1021   'data': { '*device': 'str', '*node-name': 'str',
1022             'snapshot-file': 'str', '*snapshot-node-name': 'str',
1023             '*format': 'str', '*mode': 'NewImageMode' } }
1026 # @BlockdevSnapshot:
1028 # @node: device or node name that will have a snapshot created.
1030 # @overlay: reference to the existing block device that will become
1031 #           the overlay of @node, as part of creating the snapshot.
1032 #           It must not have a current backing file (this can be
1033 #           achieved by passing "backing": "" to blockdev-add).
1035 # Since: 2.5
1037 { 'struct': 'BlockdevSnapshot',
1038   'data': { 'node': 'str', 'overlay': 'str' } }
1041 # @DriveBackup:
1043 # @job-id: identifier for the newly-created block job. If
1044 #          omitted, the device name will be used. (Since 2.7)
1046 # @device: the device name or node-name of a root node which should be copied.
1048 # @target: the target of the new image. If the file exists, or if it
1049 #          is a device, the existing file/device will be used as the new
1050 #          destination.  If it does not exist, a new file will be created.
1052 # @format: the format of the new destination, default is to
1053 #          probe if @mode is 'existing', else the format of the source
1055 # @sync: what parts of the disk image should be copied to the destination
1056 #        (all the disk, only the sectors allocated in the topmost image, from a
1057 #        dirty bitmap, or only new I/O).
1059 # @mode: whether and how QEMU should create a new image, default is
1060 #        'absolute-paths'.
1062 # @speed: the maximum speed, in bytes per second
1064 # @bitmap: the name of dirty bitmap if sync is "incremental".
1065 #          Must be present if sync is "incremental", must NOT be present
1066 #          otherwise. (Since 2.4)
1068 # @compress: true to compress data, if the target format supports it.
1069 #            (default: false) (since 2.8)
1071 # @on-source-error: the action to take on an error on the source,
1072 #                   default 'report'.  'stop' and 'enospc' can only be used
1073 #                   if the block device supports io-status (see BlockInfo).
1075 # @on-target-error: the action to take on an error on the target,
1076 #                   default 'report' (no limitations, since this applies to
1077 #                   a different block device than @device).
1079 # Note: @on-source-error and @on-target-error only affect background
1080 # I/O.  If an error occurs during a guest write request, the device's
1081 # rerror/werror actions will be used.
1083 # Since: 1.6
1085 { 'struct': 'DriveBackup',
1086   'data': { '*job-id': 'str', 'device': 'str', 'target': 'str',
1087             '*format': 'str', 'sync': 'MirrorSyncMode', '*mode': 'NewImageMode',
1088             '*speed': 'int', '*bitmap': 'str', '*compress': 'bool',
1089             '*on-source-error': 'BlockdevOnError',
1090             '*on-target-error': 'BlockdevOnError' } }
1093 # @BlockdevBackup:
1095 # @job-id: identifier for the newly-created block job. If
1096 #          omitted, the device name will be used. (Since 2.7)
1098 # @device: the device name or node-name of a root node which should be copied.
1100 # @target: the device name or node-name of the backup target node.
1102 # @sync: what parts of the disk image should be copied to the destination
1103 #        (all the disk, only the sectors allocated in the topmost image, or
1104 #        only new I/O).
1106 # @speed: the maximum speed, in bytes per second. The default is 0,
1107 #         for unlimited.
1109 # @compress: true to compress data, if the target format supports it.
1110 #            (default: false) (since 2.8)
1112 # @on-source-error: the action to take on an error on the source,
1113 #                   default 'report'.  'stop' and 'enospc' can only be used
1114 #                   if the block device supports io-status (see BlockInfo).
1116 # @on-target-error: the action to take on an error on the target,
1117 #                   default 'report' (no limitations, since this applies to
1118 #                   a different block device than @device).
1120 # Note: @on-source-error and @on-target-error only affect background
1121 # I/O.  If an error occurs during a guest write request, the device's
1122 # rerror/werror actions will be used.
1124 # Since: 2.3
1126 { 'struct': 'BlockdevBackup',
1127   'data': { '*job-id': 'str', 'device': 'str', 'target': 'str',
1128             'sync': 'MirrorSyncMode',
1129             '*speed': 'int',
1130             '*compress': 'bool',
1131             '*on-source-error': 'BlockdevOnError',
1132             '*on-target-error': 'BlockdevOnError' } }
1135 # @blockdev-snapshot-sync:
1137 # Generates a synchronous snapshot of a block device.
1139 # For the arguments, see the documentation of BlockdevSnapshotSync.
1141 # Returns: nothing on success
1142 #          If @device is not a valid block device, DeviceNotFound
1144 # Since: 0.14.0
1146 # Example:
1148 # -> { "execute": "blockdev-snapshot-sync",
1149 #      "arguments": { "device": "ide-hd0",
1150 #                     "snapshot-file":
1151 #                     "/some/place/my-image",
1152 #                     "format": "qcow2" } }
1153 # <- { "return": {} }
1156 { 'command': 'blockdev-snapshot-sync',
1157   'data': 'BlockdevSnapshotSync' }
1161 # @blockdev-snapshot:
1163 # Generates a snapshot of a block device.
1165 # Create a snapshot, by installing 'node' as the backing image of
1166 # 'overlay'. Additionally, if 'node' is associated with a block
1167 # device, the block device changes to using 'overlay' as its new active
1168 # image.
1170 # For the arguments, see the documentation of BlockdevSnapshot.
1172 # Since: 2.5
1174 # Example:
1176 # -> { "execute": "blockdev-add",
1177 #      "arguments": { "driver": "qcow2",
1178 #                     "node-name": "node1534",
1179 #                     "file": { "driver": "file",
1180 #                               "filename": "hd1.qcow2" },
1181 #                     "backing": "" } }
1183 # <- { "return": {} }
1185 # -> { "execute": "blockdev-snapshot",
1186 #      "arguments": { "node": "ide-hd0",
1187 #                     "overlay": "node1534" } }
1188 # <- { "return": {} }
1191 { 'command': 'blockdev-snapshot',
1192   'data': 'BlockdevSnapshot' }
1195 # @change-backing-file:
1197 # Change the backing file in the image file metadata.  This does not
1198 # cause QEMU to reopen the image file to reparse the backing filename
1199 # (it may, however, perform a reopen to change permissions from
1200 # r/o -> r/w -> r/o, if needed). The new backing file string is written
1201 # into the image file metadata, and the QEMU internal strings are
1202 # updated.
1204 # @image-node-name: The name of the block driver state node of the
1205 #                   image to modify. The "device" argument is used
1206 #                   to verify "image-node-name" is in the chain
1207 #                   described by "device".
1209 # @device:          The device name or node-name of the root node that owns
1210 #                   image-node-name.
1212 # @backing-file:    The string to write as the backing file.  This
1213 #                   string is not validated, so care should be taken
1214 #                   when specifying the string or the image chain may
1215 #                   not be able to be reopened again.
1217 # Returns: Nothing on success
1219 #          If "device" does not exist or cannot be determined, DeviceNotFound
1221 # Since: 2.1
1223 { 'command': 'change-backing-file',
1224   'data': { 'device': 'str', 'image-node-name': 'str',
1225             'backing-file': 'str' } }
1228 # @block-commit:
1230 # Live commit of data from overlay image nodes into backing nodes - i.e.,
1231 # writes data between 'top' and 'base' into 'base'.
1233 # @job-id: identifier for the newly-created block job. If
1234 #          omitted, the device name will be used. (Since 2.7)
1236 # @device:  the device name or node-name of a root node
1238 # @base:   The file name of the backing image to write data into.
1239 #                    If not specified, this is the deepest backing image.
1241 # @top:    The file name of the backing image within the image chain,
1242 #                    which contains the topmost data to be committed down. If
1243 #                    not specified, this is the active layer.
1245 # @backing-file:  The backing file string to write into the overlay
1246 #                           image of 'top'.  If 'top' is the active layer,
1247 #                           specifying a backing file string is an error. This
1248 #                           filename is not validated.
1250 #                           If a pathname string is such that it cannot be
1251 #                           resolved by QEMU, that means that subsequent QMP or
1252 #                           HMP commands must use node-names for the image in
1253 #                           question, as filename lookup methods will fail.
1255 #                           If not specified, QEMU will automatically determine
1256 #                           the backing file string to use, or error out if
1257 #                           there is no obvious choice. Care should be taken
1258 #                           when specifying the string, to specify a valid
1259 #                           filename or protocol.
1260 #                           (Since 2.1)
1262 #                    If top == base, that is an error.
1263 #                    If top == active, the job will not be completed by itself,
1264 #                    user needs to complete the job with the block-job-complete
1265 #                    command after getting the ready event. (Since 2.0)
1267 #                    If the base image is smaller than top, then the base image
1268 #                    will be resized to be the same size as top.  If top is
1269 #                    smaller than the base image, the base will not be
1270 #                    truncated.  If you want the base image size to match the
1271 #                    size of the smaller top, you can safely truncate it
1272 #                    yourself once the commit operation successfully completes.
1274 # @speed:  the maximum speed, in bytes per second
1276 # @filter-node-name: the node name that should be assigned to the
1277 #                    filter driver that the commit job inserts into the graph
1278 #                    above @top. If this option is not given, a node name is
1279 #                    autogenerated. (Since: 2.9)
1281 # Returns: Nothing on success
1282 #          If commit or stream is already active on this device, DeviceInUse
1283 #          If @device does not exist, DeviceNotFound
1284 #          If image commit is not supported by this device, NotSupported
1285 #          If @base or @top is invalid, a generic error is returned
1286 #          If @speed is invalid, InvalidParameter
1288 # Since: 1.3
1290 # Example:
1292 # -> { "execute": "block-commit",
1293 #      "arguments": { "device": "virtio0",
1294 #                     "top": "/tmp/snap1.qcow2" } }
1295 # <- { "return": {} }
1298 { 'command': 'block-commit',
1299   'data': { '*job-id': 'str', 'device': 'str', '*base': 'str', '*top': 'str',
1300             '*backing-file': 'str', '*speed': 'int',
1301             '*filter-node-name': 'str' } }
1304 # @drive-backup:
1306 # Start a point-in-time copy of a block device to a new destination.  The
1307 # status of ongoing drive-backup operations can be checked with
1308 # query-block-jobs where the BlockJobInfo.type field has the value 'backup'.
1309 # The operation can be stopped before it has completed using the
1310 # block-job-cancel command.
1312 # Returns: nothing on success
1313 #          If @device is not a valid block device, GenericError
1315 # Since: 1.6
1317 # Example:
1319 # -> { "execute": "drive-backup",
1320 #      "arguments": { "device": "drive0",
1321 #                     "sync": "full",
1322 #                     "target": "backup.img" } }
1323 # <- { "return": {} }
1326 { 'command': 'drive-backup', 'boxed': true,
1327   'data': 'DriveBackup' }
1330 # @blockdev-backup:
1332 # Start a point-in-time copy of a block device to a new destination.  The
1333 # status of ongoing blockdev-backup operations can be checked with
1334 # query-block-jobs where the BlockJobInfo.type field has the value 'backup'.
1335 # The operation can be stopped before it has completed using the
1336 # block-job-cancel command.
1338 # Returns: nothing on success
1339 #          If @device is not a valid block device, DeviceNotFound
1341 # Since: 2.3
1343 # Example:
1344 # -> { "execute": "blockdev-backup",
1345 #      "arguments": { "device": "src-id",
1346 #                     "sync": "full",
1347 #                     "target": "tgt-id" } }
1348 # <- { "return": {} }
1351 { 'command': 'blockdev-backup', 'boxed': true,
1352   'data': 'BlockdevBackup' }
1356 # @query-named-block-nodes:
1358 # Get the named block driver list
1360 # Returns: the list of BlockDeviceInfo
1362 # Since: 2.0
1364 # Example:
1366 # -> { "execute": "query-named-block-nodes" }
1367 # <- { "return": [ { "ro":false,
1368 #                    "drv":"qcow2",
1369 #                    "encrypted":false,
1370 #                    "file":"disks/test.qcow2",
1371 #                    "node-name": "my-node",
1372 #                    "backing_file_depth":1,
1373 #                    "bps":1000000,
1374 #                    "bps_rd":0,
1375 #                    "bps_wr":0,
1376 #                    "iops":1000000,
1377 #                    "iops_rd":0,
1378 #                    "iops_wr":0,
1379 #                    "bps_max": 8000000,
1380 #                    "bps_rd_max": 0,
1381 #                    "bps_wr_max": 0,
1382 #                    "iops_max": 0,
1383 #                    "iops_rd_max": 0,
1384 #                    "iops_wr_max": 0,
1385 #                    "iops_size": 0,
1386 #                    "write_threshold": 0,
1387 #                    "image":{
1388 #                       "filename":"disks/test.qcow2",
1389 #                       "format":"qcow2",
1390 #                       "virtual-size":2048000,
1391 #                       "backing_file":"base.qcow2",
1392 #                       "full-backing-filename":"disks/base.qcow2",
1393 #                       "backing-filename-format":"qcow2",
1394 #                       "snapshots":[
1395 #                          {
1396 #                             "id": "1",
1397 #                             "name": "snapshot1",
1398 #                             "vm-state-size": 0,
1399 #                             "date-sec": 10000200,
1400 #                             "date-nsec": 12,
1401 #                             "vm-clock-sec": 206,
1402 #                             "vm-clock-nsec": 30
1403 #                          }
1404 #                       ],
1405 #                       "backing-image":{
1406 #                           "filename":"disks/base.qcow2",
1407 #                           "format":"qcow2",
1408 #                           "virtual-size":2048000
1409 #                       }
1410 #                    } } ] }
1413 { 'command': 'query-named-block-nodes', 'returns': [ 'BlockDeviceInfo' ] }
1416 # @drive-mirror:
1418 # Start mirroring a block device's writes to a new destination. target
1419 # specifies the target of the new image. If the file exists, or if it
1420 # is a device, it will be used as the new destination for writes. If
1421 # it does not exist, a new file will be created. format specifies the
1422 # format of the mirror image, default is to probe if mode='existing',
1423 # else the format of the source.
1425 # Returns: nothing on success
1426 #          If @device is not a valid block device, GenericError
1428 # Since: 1.3
1430 # Example:
1432 # -> { "execute": "drive-mirror",
1433 #      "arguments": { "device": "ide-hd0",
1434 #                     "target": "/some/place/my-image",
1435 #                     "sync": "full",
1436 #                     "format": "qcow2" } }
1437 # <- { "return": {} }
1440 { 'command': 'drive-mirror', 'boxed': true,
1441   'data': 'DriveMirror' }
1444 # @DriveMirror:
1446 # A set of parameters describing drive mirror setup.
1448 # @job-id: identifier for the newly-created block job. If
1449 #          omitted, the device name will be used. (Since 2.7)
1451 # @device:  the device name or node-name of a root node whose writes should be
1452 #           mirrored.
1454 # @target: the target of the new image. If the file exists, or if it
1455 #          is a device, the existing file/device will be used as the new
1456 #          destination.  If it does not exist, a new file will be created.
1458 # @format: the format of the new destination, default is to
1459 #          probe if @mode is 'existing', else the format of the source
1461 # @node-name: the new block driver state node name in the graph
1462 #             (Since 2.1)
1464 # @replaces: with sync=full graph node name to be replaced by the new
1465 #            image when a whole image copy is done. This can be used to repair
1466 #            broken Quorum files. (Since 2.1)
1468 # @mode: whether and how QEMU should create a new image, default is
1469 #        'absolute-paths'.
1471 # @speed:  the maximum speed, in bytes per second
1473 # @sync: what parts of the disk image should be copied to the destination
1474 #        (all the disk, only the sectors allocated in the topmost image, or
1475 #        only new I/O).
1477 # @granularity: granularity of the dirty bitmap, default is 64K
1478 #               if the image format doesn't have clusters, 4K if the clusters
1479 #               are smaller than that, else the cluster size.  Must be a
1480 #               power of 2 between 512 and 64M (since 1.4).
1482 # @buf-size: maximum amount of data in flight from source to
1483 #            target (since 1.4).
1485 # @on-source-error: the action to take on an error on the source,
1486 #                   default 'report'.  'stop' and 'enospc' can only be used
1487 #                   if the block device supports io-status (see BlockInfo).
1489 # @on-target-error: the action to take on an error on the target,
1490 #                   default 'report' (no limitations, since this applies to
1491 #                   a different block device than @device).
1492 # @unmap: Whether to try to unmap target sectors where source has
1493 #         only zero. If true, and target unallocated sectors will read as zero,
1494 #         target image sectors will be unmapped; otherwise, zeroes will be
1495 #         written. Both will result in identical contents.
1496 #         Default is true. (Since 2.4)
1498 # Since: 1.3
1500 { 'struct': 'DriveMirror',
1501   'data': { '*job-id': 'str', 'device': 'str', 'target': 'str',
1502             '*format': 'str', '*node-name': 'str', '*replaces': 'str',
1503             'sync': 'MirrorSyncMode', '*mode': 'NewImageMode',
1504             '*speed': 'int', '*granularity': 'uint32',
1505             '*buf-size': 'int', '*on-source-error': 'BlockdevOnError',
1506             '*on-target-error': 'BlockdevOnError',
1507             '*unmap': 'bool' } }
1510 # @BlockDirtyBitmap:
1512 # @node: name of device/node which the bitmap is tracking
1514 # @name: name of the dirty bitmap
1516 # Since: 2.4
1518 { 'struct': 'BlockDirtyBitmap',
1519   'data': { 'node': 'str', 'name': 'str' } }
1522 # @BlockDirtyBitmapAdd:
1524 # @node: name of device/node which the bitmap is tracking
1526 # @name: name of the dirty bitmap
1528 # @granularity: the bitmap granularity, default is 64k for
1529 #               block-dirty-bitmap-add
1531 # Since: 2.4
1533 { 'struct': 'BlockDirtyBitmapAdd',
1534   'data': { 'node': 'str', 'name': 'str', '*granularity': 'uint32' } }
1537 # @block-dirty-bitmap-add:
1539 # Create a dirty bitmap with a name on the node, and start tracking the writes.
1541 # Returns: nothing on success
1542 #          If @node is not a valid block device or node, DeviceNotFound
1543 #          If @name is already taken, GenericError with an explanation
1545 # Since: 2.4
1547 # Example:
1549 # -> { "execute": "block-dirty-bitmap-add",
1550 #      "arguments": { "node": "drive0", "name": "bitmap0" } }
1551 # <- { "return": {} }
1554 { 'command': 'block-dirty-bitmap-add',
1555   'data': 'BlockDirtyBitmapAdd' }
1558 # @block-dirty-bitmap-remove:
1560 # Stop write tracking and remove the dirty bitmap that was created
1561 # with block-dirty-bitmap-add.
1563 # Returns: nothing on success
1564 #          If @node is not a valid block device or node, DeviceNotFound
1565 #          If @name is not found, GenericError with an explanation
1566 #          if @name is frozen by an operation, GenericError
1568 # Since: 2.4
1570 # Example:
1572 # -> { "execute": "block-dirty-bitmap-remove",
1573 #      "arguments": { "node": "drive0", "name": "bitmap0" } }
1574 # <- { "return": {} }
1577 { 'command': 'block-dirty-bitmap-remove',
1578   'data': 'BlockDirtyBitmap' }
1581 # @block-dirty-bitmap-clear:
1583 # Clear (reset) a dirty bitmap on the device, so that an incremental
1584 # backup from this point in time forward will only backup clusters
1585 # modified after this clear operation.
1587 # Returns: nothing on success
1588 #          If @node is not a valid block device, DeviceNotFound
1589 #          If @name is not found, GenericError with an explanation
1591 # Since: 2.4
1593 # Example:
1595 # -> { "execute": "block-dirty-bitmap-clear",
1596 #      "arguments": { "node": "drive0", "name": "bitmap0" } }
1597 # <- { "return": {} }
1600 { 'command': 'block-dirty-bitmap-clear',
1601   'data': 'BlockDirtyBitmap' }
1604 # @blockdev-mirror:
1606 # Start mirroring a block device's writes to a new destination.
1608 # @job-id: identifier for the newly-created block job. If
1609 #          omitted, the device name will be used. (Since 2.7)
1611 # @device: The device name or node-name of a root node whose writes should be
1612 #          mirrored.
1614 # @target: the id or node-name of the block device to mirror to. This mustn't be
1615 #          attached to guest.
1617 # @replaces: with sync=full graph node name to be replaced by the new
1618 #            image when a whole image copy is done. This can be used to repair
1619 #            broken Quorum files.
1621 # @speed:  the maximum speed, in bytes per second
1623 # @sync: what parts of the disk image should be copied to the destination
1624 #        (all the disk, only the sectors allocated in the topmost image, or
1625 #        only new I/O).
1627 # @granularity: granularity of the dirty bitmap, default is 64K
1628 #               if the image format doesn't have clusters, 4K if the clusters
1629 #               are smaller than that, else the cluster size.  Must be a
1630 #               power of 2 between 512 and 64M
1632 # @buf-size: maximum amount of data in flight from source to
1633 #            target
1635 # @on-source-error: the action to take on an error on the source,
1636 #                   default 'report'.  'stop' and 'enospc' can only be used
1637 #                   if the block device supports io-status (see BlockInfo).
1639 # @on-target-error: the action to take on an error on the target,
1640 #                   default 'report' (no limitations, since this applies to
1641 #                   a different block device than @device).
1643 # @filter-node-name: the node name that should be assigned to the
1644 #                    filter driver that the mirror job inserts into the graph
1645 #                    above @device. If this option is not given, a node name is
1646 #                    autogenerated. (Since: 2.9)
1648 # Returns: nothing on success.
1650 # Since: 2.6
1652 # Example:
1654 # -> { "execute": "blockdev-mirror",
1655 #      "arguments": { "device": "ide-hd0",
1656 #                     "target": "target0",
1657 #                     "sync": "full" } }
1658 # <- { "return": {} }
1661 { 'command': 'blockdev-mirror',
1662   'data': { '*job-id': 'str', 'device': 'str', 'target': 'str',
1663             '*replaces': 'str',
1664             'sync': 'MirrorSyncMode',
1665             '*speed': 'int', '*granularity': 'uint32',
1666             '*buf-size': 'int', '*on-source-error': 'BlockdevOnError',
1667             '*on-target-error': 'BlockdevOnError',
1668             '*filter-node-name': 'str' } }
1671 # @block_set_io_throttle:
1673 # Change I/O throttle limits for a block drive.
1675 # Since QEMU 2.4, each device with I/O limits is member of a throttle
1676 # group.
1678 # If two or more devices are members of the same group, the limits
1679 # will apply to the combined I/O of the whole group in a round-robin
1680 # fashion. Therefore, setting new I/O limits to a device will affect
1681 # the whole group.
1683 # The name of the group can be specified using the 'group' parameter.
1684 # If the parameter is unset, it is assumed to be the current group of
1685 # that device. If it's not in any group yet, the name of the device
1686 # will be used as the name for its group.
1688 # The 'group' parameter can also be used to move a device to a
1689 # different group. In this case the limits specified in the parameters
1690 # will be applied to the new group only.
1692 # I/O limits can be disabled by setting all of them to 0. In this case
1693 # the device will be removed from its group and the rest of its
1694 # members will not be affected. The 'group' parameter is ignored.
1696 # Returns: Nothing on success
1697 #          If @device is not a valid block device, DeviceNotFound
1699 # Since: 1.1
1701 # Example:
1703 # -> { "execute": "block_set_io_throttle",
1704 #      "arguments": { "id": "ide0-1-0",
1705 #                     "bps": 1000000,
1706 #                     "bps_rd": 0,
1707 #                     "bps_wr": 0,
1708 #                     "iops": 0,
1709 #                     "iops_rd": 0,
1710 #                     "iops_wr": 0,
1711 #                     "bps_max": 8000000,
1712 #                     "bps_rd_max": 0,
1713 #                     "bps_wr_max": 0,
1714 #                     "iops_max": 0,
1715 #                     "iops_rd_max": 0,
1716 #                     "iops_wr_max": 0,
1717 #                     "bps_max_length": 60,
1718 #                     "iops_size": 0 } }
1719 # <- { "return": {} }
1721 { 'command': 'block_set_io_throttle', 'boxed': true,
1722   'data': 'BlockIOThrottle' }
1725 # @BlockIOThrottle:
1727 # A set of parameters describing block throttling.
1729 # @device: Block device name (deprecated, use @id instead)
1731 # @id: The name or QOM path of the guest device (since: 2.8)
1733 # @bps: total throughput limit in bytes per second
1735 # @bps_rd: read throughput limit in bytes per second
1737 # @bps_wr: write throughput limit in bytes per second
1739 # @iops: total I/O operations per second
1741 # @iops_rd: read I/O operations per second
1743 # @iops_wr: write I/O operations per second
1745 # @bps_max: total throughput limit during bursts,
1746 #                     in bytes (Since 1.7)
1748 # @bps_rd_max: read throughput limit during bursts,
1749 #                        in bytes (Since 1.7)
1751 # @bps_wr_max: write throughput limit during bursts,
1752 #                        in bytes (Since 1.7)
1754 # @iops_max: total I/O operations per second during bursts,
1755 #                      in bytes (Since 1.7)
1757 # @iops_rd_max: read I/O operations per second during bursts,
1758 #                         in bytes (Since 1.7)
1760 # @iops_wr_max: write I/O operations per second during bursts,
1761 #                         in bytes (Since 1.7)
1763 # @bps_max_length: maximum length of the @bps_max burst
1764 #                            period, in seconds. It must only
1765 #                            be set if @bps_max is set as well.
1766 #                            Defaults to 1. (Since 2.6)
1768 # @bps_rd_max_length: maximum length of the @bps_rd_max
1769 #                               burst period, in seconds. It must only
1770 #                               be set if @bps_rd_max is set as well.
1771 #                               Defaults to 1. (Since 2.6)
1773 # @bps_wr_max_length: maximum length of the @bps_wr_max
1774 #                               burst period, in seconds. It must only
1775 #                               be set if @bps_wr_max is set as well.
1776 #                               Defaults to 1. (Since 2.6)
1778 # @iops_max_length: maximum length of the @iops burst
1779 #                             period, in seconds. It must only
1780 #                             be set if @iops_max is set as well.
1781 #                             Defaults to 1. (Since 2.6)
1783 # @iops_rd_max_length: maximum length of the @iops_rd_max
1784 #                                burst period, in seconds. It must only
1785 #                                be set if @iops_rd_max is set as well.
1786 #                                Defaults to 1. (Since 2.6)
1788 # @iops_wr_max_length: maximum length of the @iops_wr_max
1789 #                                burst period, in seconds. It must only
1790 #                                be set if @iops_wr_max is set as well.
1791 #                                Defaults to 1. (Since 2.6)
1793 # @iops_size: an I/O size in bytes (Since 1.7)
1795 # @group: throttle group name (Since 2.4)
1797 # Since: 1.1
1799 { 'struct': 'BlockIOThrottle',
1800   'data': { '*device': 'str', '*id': 'str', 'bps': 'int', 'bps_rd': 'int',
1801             'bps_wr': 'int', 'iops': 'int', 'iops_rd': 'int', 'iops_wr': 'int',
1802             '*bps_max': 'int', '*bps_rd_max': 'int',
1803             '*bps_wr_max': 'int', '*iops_max': 'int',
1804             '*iops_rd_max': 'int', '*iops_wr_max': 'int',
1805             '*bps_max_length': 'int', '*bps_rd_max_length': 'int',
1806             '*bps_wr_max_length': 'int', '*iops_max_length': 'int',
1807             '*iops_rd_max_length': 'int', '*iops_wr_max_length': 'int',
1808             '*iops_size': 'int', '*group': 'str' } }
1811 # @block-stream:
1813 # Copy data from a backing file into a block device.
1815 # The block streaming operation is performed in the background until the entire
1816 # backing file has been copied.  This command returns immediately once streaming
1817 # has started.  The status of ongoing block streaming operations can be checked
1818 # with query-block-jobs.  The operation can be stopped before it has completed
1819 # using the block-job-cancel command.
1821 # The node that receives the data is called the top image, can be located in
1822 # any part of the chain (but always above the base image; see below) and can be
1823 # specified using its device or node name. Earlier qemu versions only allowed
1824 # 'device' to name the top level node; presence of the 'base-node' parameter
1825 # during introspection can be used as a witness of the enhanced semantics
1826 # of 'device'.
1828 # If a base file is specified then sectors are not copied from that base file and
1829 # its backing chain.  When streaming completes the image file will have the base
1830 # file as its backing file.  This can be used to stream a subset of the backing
1831 # file chain instead of flattening the entire image.
1833 # On successful completion the image file is updated to drop the backing file
1834 # and the BLOCK_JOB_COMPLETED event is emitted.
1836 # @job-id: identifier for the newly-created block job. If
1837 #          omitted, the device name will be used. (Since 2.7)
1839 # @device: the device or node name of the top image
1841 # @base:   the common backing file name.
1842 #                    It cannot be set if @base-node is also set.
1844 # @base-node: the node name of the backing file.
1845 #                       It cannot be set if @base is also set. (Since 2.8)
1847 # @backing-file: The backing file string to write into the top
1848 #                          image. This filename is not validated.
1850 #                          If a pathname string is such that it cannot be
1851 #                          resolved by QEMU, that means that subsequent QMP or
1852 #                          HMP commands must use node-names for the image in
1853 #                          question, as filename lookup methods will fail.
1855 #                          If not specified, QEMU will automatically determine
1856 #                          the backing file string to use, or error out if there
1857 #                          is no obvious choice.  Care should be taken when
1858 #                          specifying the string, to specify a valid filename or
1859 #                          protocol.
1860 #                          (Since 2.1)
1862 # @speed:  the maximum speed, in bytes per second
1864 # @on-error: the action to take on an error (default report).
1865 #            'stop' and 'enospc' can only be used if the block device
1866 #            supports io-status (see BlockInfo).  Since 1.3.
1868 # Returns: Nothing on success. If @device does not exist, DeviceNotFound.
1870 # Since: 1.1
1872 # Example:
1874 # -> { "execute": "block-stream",
1875 #      "arguments": { "device": "virtio0",
1876 #                     "base": "/tmp/master.qcow2" } }
1877 # <- { "return": {} }
1880 { 'command': 'block-stream',
1881   'data': { '*job-id': 'str', 'device': 'str', '*base': 'str',
1882             '*base-node': 'str', '*backing-file': 'str', '*speed': 'int',
1883             '*on-error': 'BlockdevOnError' } }
1886 # @block-job-set-speed:
1888 # Set maximum speed for a background block operation.
1890 # This command can only be issued when there is an active block job.
1892 # Throttling can be disabled by setting the speed to 0.
1894 # @device: The job identifier. This used to be a device name (hence
1895 #          the name of the parameter), but since QEMU 2.7 it can have
1896 #          other values.
1898 # @speed:  the maximum speed, in bytes per second, or 0 for unlimited.
1899 #          Defaults to 0.
1901 # Returns: Nothing on success
1902 #          If no background operation is active on this device, DeviceNotActive
1904 # Since: 1.1
1906 { 'command': 'block-job-set-speed',
1907   'data': { 'device': 'str', 'speed': 'int' } }
1910 # @block-job-cancel:
1912 # Stop an active background block operation.
1914 # This command returns immediately after marking the active background block
1915 # operation for cancellation.  It is an error to call this command if no
1916 # operation is in progress.
1918 # The operation will cancel as soon as possible and then emit the
1919 # BLOCK_JOB_CANCELLED event.  Before that happens the job is still visible when
1920 # enumerated using query-block-jobs.
1922 # For streaming, the image file retains its backing file unless the streaming
1923 # operation happens to complete just as it is being cancelled.  A new streaming
1924 # operation can be started at a later time to finish copying all data from the
1925 # backing file.
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 # @force: whether to allow cancellation of a paused job (default
1932 #         false).  Since 1.3.
1934 # Returns: Nothing on success
1935 #          If no background operation is active on this device, DeviceNotActive
1937 # Since: 1.1
1939 { 'command': 'block-job-cancel', 'data': { 'device': 'str', '*force': 'bool' } }
1942 # @block-job-pause:
1944 # Pause an active background block operation.
1946 # This command returns immediately after marking the active background block
1947 # operation for pausing.  It is an error to call this command if no
1948 # operation is in progress.  Pausing an already paused job has no cumulative
1949 # effect; a single block-job-resume command will resume the job.
1951 # The operation will pause as soon as possible.  No event is emitted when
1952 # the operation is actually paused.  Cancelling a paused job automatically
1953 # resumes it.
1955 # @device: The job identifier. This used to be a device name (hence
1956 #          the name of the parameter), but since QEMU 2.7 it can have
1957 #          other values.
1959 # Returns: Nothing on success
1960 #          If no background operation is active on this device, DeviceNotActive
1962 # Since: 1.3
1964 { 'command': 'block-job-pause', 'data': { 'device': 'str' } }
1967 # @block-job-resume:
1969 # Resume an active background block operation.
1971 # This command returns immediately after resuming a paused background block
1972 # operation.  It is an error to call this command if no operation is in
1973 # progress.  Resuming an already running job is not an error.
1975 # This command also clears the error status of the job.
1977 # @device: The job identifier. This used to be a device name (hence
1978 #          the name of the parameter), but since QEMU 2.7 it can have
1979 #          other values.
1981 # Returns: Nothing on success
1982 #          If no background operation is active on this device, DeviceNotActive
1984 # Since: 1.3
1986 { 'command': 'block-job-resume', 'data': { 'device': 'str' } }
1989 # @block-job-complete:
1991 # Manually trigger completion of an active background block operation.  This
1992 # is supported for drive mirroring, where it also switches the device to
1993 # write to the target path only.  The ability to complete is signaled with
1994 # a BLOCK_JOB_READY event.
1996 # This command completes an active background block operation synchronously.
1997 # The ordering of this command's return with the BLOCK_JOB_COMPLETED event
1998 # is not defined.  Note that if an I/O error occurs during the processing of
1999 # this command: 1) the command itself will fail; 2) the error will be processed
2000 # according to the rerror/werror arguments that were specified when starting
2001 # the operation.
2003 # A cancelled or paused job cannot be completed.
2005 # @device: The job identifier. This used to be a device name (hence
2006 #          the name of the parameter), but since QEMU 2.7 it can have
2007 #          other values.
2009 # Returns: Nothing on success
2010 #          If no background operation is active on this device, DeviceNotActive
2012 # Since: 1.3
2014 { 'command': 'block-job-complete', 'data': { 'device': 'str' } }
2017 # @BlockdevDiscardOptions:
2019 # Determines how to handle discard requests.
2021 # @ignore:      Ignore the request
2022 # @unmap:       Forward as an unmap request
2024 # Since: 2.9
2026 { 'enum': 'BlockdevDiscardOptions',
2027   'data': [ 'ignore', 'unmap' ] }
2030 # @BlockdevDetectZeroesOptions:
2032 # Describes the operation mode for the automatic conversion of plain
2033 # zero writes by the OS to driver specific optimized zero write commands.
2035 # @off:      Disabled (default)
2036 # @on:       Enabled
2037 # @unmap:    Enabled and even try to unmap blocks if possible. This requires
2038 #            also that @BlockdevDiscardOptions is set to unmap for this device.
2040 # Since: 2.1
2042 { 'enum': 'BlockdevDetectZeroesOptions',
2043   'data': [ 'off', 'on', 'unmap' ] }
2046 # @BlockdevAioOptions:
2048 # Selects the AIO backend to handle I/O requests
2050 # @threads:     Use qemu's thread pool
2051 # @native:      Use native AIO backend (only Linux and Windows)
2053 # Since: 2.9
2055 { 'enum': 'BlockdevAioOptions',
2056   'data': [ 'threads', 'native' ] }
2059 # @BlockdevCacheOptions:
2061 # Includes cache-related options for block devices
2063 # @direct:      enables use of O_DIRECT (bypass the host page cache;
2064 #               default: false)
2065 # @no-flush:    ignore any flush requests for the device (default:
2066 #               false)
2068 # Since: 2.9
2070 { 'struct': 'BlockdevCacheOptions',
2071   'data': { '*direct': 'bool',
2072             '*no-flush': 'bool' } }
2075 # @BlockdevDriver:
2077 # Drivers that are supported in block device operations.
2079 # @vxhs: Since 2.10
2081 # Since: 2.9
2083 { 'enum': 'BlockdevDriver',
2084   'data': [ 'blkdebug', 'blkverify', 'bochs', 'cloop',
2085             'dmg', 'file', 'ftp', 'ftps', 'gluster', 'host_cdrom',
2086             'host_device', 'http', 'https', 'iscsi', 'luks', 'nbd', 'nfs',
2087             'null-aio', 'null-co', 'parallels', 'qcow', 'qcow2', 'qed',
2088             'quorum', 'raw', 'rbd', 'replication', 'sheepdog', 'ssh',
2089             'vdi', 'vhdx', 'vmdk', 'vpc', 'vvfat', 'vxhs' ] }
2092 # @BlockdevOptionsFile:
2094 # Driver specific block device options for the file backend.
2096 # @filename:    path to the image file
2097 # @aio:         AIO backend (default: threads) (since: 2.8)
2098 # @locking:     whether to enable file locking. If set to 'auto', only enable
2099 #               when Open File Descriptor (OFD) locking API is available
2100 #               (default: auto, since 2.10)
2102 # Since: 2.9
2104 { 'struct': 'BlockdevOptionsFile',
2105   'data': { 'filename': 'str',
2106             '*locking': 'OnOffAuto',
2107             '*aio': 'BlockdevAioOptions' } }
2110 # @BlockdevOptionsNull:
2112 # Driver specific block device options for the null backend.
2114 # @size:    size of the device in bytes.
2115 # @latency-ns: emulated latency (in nanoseconds) in processing
2116 #              requests. Default to zero which completes requests immediately.
2117 #              (Since 2.4)
2119 # Since: 2.9
2121 { 'struct': 'BlockdevOptionsNull',
2122   'data': { '*size': 'int', '*latency-ns': 'uint64' } }
2125 # @BlockdevOptionsVVFAT:
2127 # Driver specific block device options for the vvfat protocol.
2129 # @dir:         directory to be exported as FAT image
2130 # @fat-type:    FAT type: 12, 16 or 32
2131 # @floppy:      whether to export a floppy image (true) or
2132 #               partitioned hard disk (false; default)
2133 # @label:       set the volume label, limited to 11 bytes. FAT16 and
2134 #               FAT32 traditionally have some restrictions on labels, which are
2135 #               ignored by most operating systems. Defaults to "QEMU VVFAT".
2136 #               (since 2.4)
2137 # @rw:          whether to allow write operations (default: false)
2139 # Since: 2.9
2141 { 'struct': 'BlockdevOptionsVVFAT',
2142   'data': { 'dir': 'str', '*fat-type': 'int', '*floppy': 'bool',
2143             '*label': 'str', '*rw': 'bool' } }
2146 # @BlockdevOptionsGenericFormat:
2148 # Driver specific block device options for image format that have no option
2149 # besides their data source.
2151 # @file:        reference to or definition of the data source block device
2153 # Since: 2.9
2155 { 'struct': 'BlockdevOptionsGenericFormat',
2156   'data': { 'file': 'BlockdevRef' } }
2159 # @BlockdevOptionsLUKS:
2161 # Driver specific block device options for LUKS.
2163 # @key-secret: the ID of a QCryptoSecret object providing
2164 #              the decryption key (since 2.6). Mandatory except when
2165 #              doing a metadata-only probe of the image.
2167 # Since: 2.9
2169 { 'struct': 'BlockdevOptionsLUKS',
2170   'base': 'BlockdevOptionsGenericFormat',
2171   'data': { '*key-secret': 'str' } }
2175 # @BlockdevOptionsGenericCOWFormat:
2177 # Driver specific block device options for image format that have no option
2178 # besides their data source and an optional backing file.
2180 # @backing:     reference to or definition of the backing file block
2181 #               device (if missing, taken from the image file content). It is
2182 #               allowed to pass an empty string here in order to disable the
2183 #               default backing file.
2185 # Since: 2.9
2187 { 'struct': 'BlockdevOptionsGenericCOWFormat',
2188   'base': 'BlockdevOptionsGenericFormat',
2189   'data': { '*backing': 'BlockdevRef' } }
2192 # @Qcow2OverlapCheckMode:
2194 # General overlap check modes.
2196 # @none:        Do not perform any checks
2198 # @constant:    Perform only checks which can be done in constant time and
2199 #               without reading anything from disk
2201 # @cached:      Perform only checks which can be done without reading anything
2202 #               from disk
2204 # @all:         Perform all available overlap checks
2206 # Since: 2.9
2208 { 'enum': 'Qcow2OverlapCheckMode',
2209   'data': [ 'none', 'constant', 'cached', 'all' ] }
2212 # @Qcow2OverlapCheckFlags:
2214 # Structure of flags for each metadata structure. Setting a field to 'true'
2215 # makes qemu guard that structure against unintended overwriting. The default
2216 # value is chosen according to the template given.
2218 # @template: Specifies a template mode which can be adjusted using the other
2219 #            flags, defaults to 'cached'
2221 # Since: 2.9
2223 { 'struct': 'Qcow2OverlapCheckFlags',
2224   'data': { '*template':       'Qcow2OverlapCheckMode',
2225             '*main-header':    'bool',
2226             '*active-l1':      'bool',
2227             '*active-l2':      'bool',
2228             '*refcount-table': 'bool',
2229             '*refcount-block': 'bool',
2230             '*snapshot-table': 'bool',
2231             '*inactive-l1':    'bool',
2232             '*inactive-l2':    'bool' } }
2235 # @Qcow2OverlapChecks:
2237 # Specifies which metadata structures should be guarded against unintended
2238 # overwriting.
2240 # @flags:   set of flags for separate specification of each metadata structure
2241 #           type
2243 # @mode:    named mode which chooses a specific set of flags
2245 # Since: 2.9
2247 { 'alternate': 'Qcow2OverlapChecks',
2248   'data': { 'flags': 'Qcow2OverlapCheckFlags',
2249             'mode':  'Qcow2OverlapCheckMode' } }
2252 # @BlockdevQcowEncryptionFormat:
2254 # @aes: AES-CBC with plain64 initialization vectors
2256 # Since: 2.10
2258 { 'enum': 'BlockdevQcowEncryptionFormat',
2259   'data': [ 'aes' ] }
2262 # @BlockdevQcowEncryption:
2264 # Since: 2.10
2266 { 'union': 'BlockdevQcowEncryption',
2267   'base': { 'format': 'BlockdevQcowEncryptionFormat' },
2268   'discriminator': 'format',
2269   'data': { 'aes': 'QCryptoBlockOptionsQCow' } }
2272 # @BlockdevOptionsQcow:
2274 # Driver specific block device options for qcow.
2276 # @encrypt:               Image decryption options. Mandatory for
2277 #                         encrypted images, except when doing a metadata-only
2278 #                         probe of the image.
2280 # Since: 2.10
2282 { 'struct': 'BlockdevOptionsQcow',
2283   'base': 'BlockdevOptionsGenericCOWFormat',
2284   'data': { '*encrypt': 'BlockdevQcowEncryption' } }
2289 # @BlockdevQcow2EncryptionFormat:
2290 # @aes: AES-CBC with plain64 initialization venctors
2292 # Since: 2.10
2294 { 'enum': 'BlockdevQcow2EncryptionFormat',
2295   'data': [ 'aes', 'luks' ] }
2298 # @BlockdevQcow2Encryption:
2300 # Since: 2.10
2302 { 'union': 'BlockdevQcow2Encryption',
2303   'base': { 'format': 'BlockdevQcow2EncryptionFormat' },
2304   'discriminator': 'format',
2305   'data': { 'aes': 'QCryptoBlockOptionsQCow',
2306             'luks': 'QCryptoBlockOptionsLUKS'} }
2309 # @BlockdevOptionsQcow2:
2311 # Driver specific block device options for qcow2.
2313 # @lazy-refcounts:        whether to enable the lazy refcounts
2314 #                         feature (default is taken from the image file)
2316 # @pass-discard-request:  whether discard requests to the qcow2
2317 #                         device should be forwarded to the data source
2319 # @pass-discard-snapshot: whether discard requests for the data source
2320 #                         should be issued when a snapshot operation (e.g.
2321 #                         deleting a snapshot) frees clusters in the qcow2 file
2323 # @pass-discard-other:    whether discard requests for the data source
2324 #                         should be issued on other occasions where a cluster
2325 #                         gets freed
2327 # @overlap-check:         which overlap checks to perform for writes
2328 #                         to the image, defaults to 'cached' (since 2.2)
2330 # @cache-size:            the maximum total size of the L2 table and
2331 #                         refcount block caches in bytes (since 2.2)
2333 # @l2-cache-size:         the maximum size of the L2 table cache in
2334 #                         bytes (since 2.2)
2336 # @refcount-cache-size:   the maximum size of the refcount block cache
2337 #                         in bytes (since 2.2)
2339 # @cache-clean-interval:  clean unused entries in the L2 and refcount
2340 #                         caches. The interval is in seconds. The default value
2341 #                         is 0 and it disables this feature (since 2.5)
2342 # @encrypt:               Image decryption options. Mandatory for
2343 #                         encrypted images, except when doing a metadata-only
2344 #                         probe of the image. (since 2.10)
2346 # Since: 2.9
2348 { 'struct': 'BlockdevOptionsQcow2',
2349   'base': 'BlockdevOptionsGenericCOWFormat',
2350   'data': { '*lazy-refcounts': 'bool',
2351             '*pass-discard-request': 'bool',
2352             '*pass-discard-snapshot': 'bool',
2353             '*pass-discard-other': 'bool',
2354             '*overlap-check': 'Qcow2OverlapChecks',
2355             '*cache-size': 'int',
2356             '*l2-cache-size': 'int',
2357             '*refcount-cache-size': 'int',
2358             '*cache-clean-interval': 'int',
2359             '*encrypt': 'BlockdevQcow2Encryption' } }
2362 # @BlockdevOptionsSsh:
2364 # @server:              host address
2366 # @path:                path to the image on the host
2368 # @user:                user as which to connect, defaults to current
2369 #                       local user name
2371 # TODO: Expose the host_key_check option in QMP
2373 # Since: 2.9
2375 { 'struct': 'BlockdevOptionsSsh',
2376   'data': { 'server': 'InetSocketAddress',
2377             'path': 'str',
2378             '*user': 'str' } }
2382 # @BlkdebugEvent:
2384 # Trigger events supported by blkdebug.
2386 # Since: 2.9
2388 { 'enum': 'BlkdebugEvent', 'prefix': 'BLKDBG',
2389   'data': [ 'l1_update', 'l1_grow_alloc_table', 'l1_grow_write_table',
2390             'l1_grow_activate_table', 'l2_load', 'l2_update',
2391             'l2_update_compressed', 'l2_alloc_cow_read', 'l2_alloc_write',
2392             'read_aio', 'read_backing_aio', 'read_compressed', 'write_aio',
2393             'write_compressed', 'vmstate_load', 'vmstate_save', 'cow_read',
2394             'cow_write', 'reftable_load', 'reftable_grow', 'reftable_update',
2395             'refblock_load', 'refblock_update', 'refblock_update_part',
2396             'refblock_alloc', 'refblock_alloc_hookup', 'refblock_alloc_write',
2397             'refblock_alloc_write_blocks', 'refblock_alloc_write_table',
2398             'refblock_alloc_switch_table', 'cluster_alloc',
2399             'cluster_alloc_bytes', 'cluster_free', 'flush_to_os',
2400             'flush_to_disk', 'pwritev_rmw_head', 'pwritev_rmw_after_head',
2401             'pwritev_rmw_tail', 'pwritev_rmw_after_tail', 'pwritev',
2402             'pwritev_zero', 'pwritev_done', 'empty_image_prepare' ] }
2405 # @BlkdebugInjectErrorOptions:
2407 # Describes a single error injection for blkdebug.
2409 # @event:       trigger event
2411 # @state:       the state identifier blkdebug needs to be in to
2412 #               actually trigger the event; defaults to "any"
2414 # @errno:       error identifier (errno) to be returned; defaults to
2415 #               EIO
2417 # @sector:      specifies the sector index which has to be affected
2418 #               in order to actually trigger the event; defaults to "any
2419 #               sector"
2421 # @once:        disables further events after this one has been
2422 #               triggered; defaults to false
2424 # @immediately: fail immediately; defaults to false
2426 # Since: 2.9
2428 { 'struct': 'BlkdebugInjectErrorOptions',
2429   'data': { 'event': 'BlkdebugEvent',
2430             '*state': 'int',
2431             '*errno': 'int',
2432             '*sector': 'int',
2433             '*once': 'bool',
2434             '*immediately': 'bool' } }
2437 # @BlkdebugSetStateOptions:
2439 # Describes a single state-change event for blkdebug.
2441 # @event:       trigger event
2443 # @state:       the current state identifier blkdebug needs to be in;
2444 #               defaults to "any"
2446 # @new_state:   the state identifier blkdebug is supposed to assume if
2447 #               this event is triggered
2449 # Since: 2.9
2451 { 'struct': 'BlkdebugSetStateOptions',
2452   'data': { 'event': 'BlkdebugEvent',
2453             '*state': 'int',
2454             'new_state': 'int' } }
2457 # @BlockdevOptionsBlkdebug:
2459 # Driver specific block device options for blkdebug.
2461 # @image:           underlying raw block device (or image file)
2463 # @config:          filename of the configuration file
2465 # @align:           required alignment for requests in bytes, must be
2466 #                   positive power of 2, or 0 for default
2468 # @max-transfer:    maximum size for I/O transfers in bytes, must be
2469 #                   positive multiple of @align and of the underlying
2470 #                   file's request alignment (but need not be a power of
2471 #                   2), or 0 for default (since 2.10)
2473 # @opt-write-zero:  preferred alignment for write zero requests in bytes,
2474 #                   must be positive multiple of @align and of the
2475 #                   underlying file's request alignment (but need not be a
2476 #                   power of 2), or 0 for default (since 2.10)
2478 # @max-write-zero:  maximum size for write zero requests in bytes, must be
2479 #                   positive multiple of @align, of @opt-write-zero, and of
2480 #                   the underlying file's request alignment (but need not
2481 #                   be a power of 2), or 0 for default (since 2.10)
2483 # @opt-discard:     preferred alignment for discard requests in bytes, must
2484 #                   be positive multiple of @align and of the underlying
2485 #                   file's request alignment (but need not be a power of
2486 #                   2), or 0 for default (since 2.10)
2488 # @max-discard:     maximum size for discard requests in bytes, must be
2489 #                   positive multiple of @align, of @opt-discard, and of
2490 #                   the underlying file's request alignment (but need not
2491 #                   be a power of 2), or 0 for default (since 2.10)
2493 # @inject-error:    array of error injection descriptions
2495 # @set-state:       array of state-change descriptions
2497 # Since: 2.9
2499 { 'struct': 'BlockdevOptionsBlkdebug',
2500   'data': { 'image': 'BlockdevRef',
2501             '*config': 'str',
2502             '*align': 'int', '*max-transfer': 'int32',
2503             '*opt-write-zero': 'int32', '*max-write-zero': 'int32',
2504             '*opt-discard': 'int32', '*max-discard': 'int32',
2505             '*inject-error': ['BlkdebugInjectErrorOptions'],
2506             '*set-state': ['BlkdebugSetStateOptions'] } }
2509 # @BlockdevOptionsBlkverify:
2511 # Driver specific block device options for blkverify.
2513 # @test:    block device to be tested
2515 # @raw:     raw image used for verification
2517 # Since: 2.9
2519 { 'struct': 'BlockdevOptionsBlkverify',
2520   'data': { 'test': 'BlockdevRef',
2521             'raw': 'BlockdevRef' } }
2524 # @QuorumReadPattern:
2526 # An enumeration of quorum read patterns.
2528 # @quorum: read all the children and do a quorum vote on reads
2530 # @fifo: read only from the first child that has not failed
2532 # Since: 2.9
2534 { 'enum': 'QuorumReadPattern', 'data': [ 'quorum', 'fifo' ] }
2537 # @BlockdevOptionsQuorum:
2539 # Driver specific block device options for Quorum
2541 # @blkverify:      true if the driver must print content mismatch
2542 #                  set to false by default
2544 # @children:       the children block devices to use
2546 # @vote-threshold: the vote limit under which a read will fail
2548 # @rewrite-corrupted: rewrite corrupted data when quorum is reached
2549 #                     (Since 2.1)
2551 # @read-pattern: choose read pattern and set to quorum by default
2552 #                (Since 2.2)
2554 # Since: 2.9
2556 { 'struct': 'BlockdevOptionsQuorum',
2557   'data': { '*blkverify': 'bool',
2558             'children': [ 'BlockdevRef' ],
2559             'vote-threshold': 'int',
2560             '*rewrite-corrupted': 'bool',
2561             '*read-pattern': 'QuorumReadPattern' } }
2564 # @BlockdevOptionsGluster:
2566 # Driver specific block device options for Gluster
2568 # @volume:      name of gluster volume where VM image resides
2570 # @path:        absolute path to image file in gluster volume
2572 # @server:      gluster servers description
2574 # @debug:       libgfapi log level (default '4' which is Error)
2575 #               (Since 2.8)
2577 # @logfile:     libgfapi log file (default /dev/stderr) (Since 2.8)
2579 # Since: 2.9
2581 { 'struct': 'BlockdevOptionsGluster',
2582   'data': { 'volume': 'str',
2583             'path': 'str',
2584             'server': ['SocketAddress'],
2585             '*debug': 'int',
2586             '*logfile': 'str' } }
2589 # @IscsiTransport:
2591 # An enumeration of libiscsi transport types
2593 # Since: 2.9
2595 { 'enum': 'IscsiTransport',
2596   'data': [ 'tcp', 'iser' ] }
2599 # @IscsiHeaderDigest:
2601 # An enumeration of header digests supported by libiscsi
2603 # Since: 2.9
2605 { 'enum': 'IscsiHeaderDigest',
2606   'prefix': 'QAPI_ISCSI_HEADER_DIGEST',
2607   'data': [ 'crc32c', 'none', 'crc32c-none', 'none-crc32c' ] }
2610 # @BlockdevOptionsIscsi:
2612 # @transport:       The iscsi transport type
2614 # @portal:          The address of the iscsi portal
2616 # @target:          The target iqn name
2618 # @lun:             LUN to connect to. Defaults to 0.
2620 # @user:            User name to log in with. If omitted, no CHAP
2621 #                   authentication is performed.
2623 # @password-secret: The ID of a QCryptoSecret object providing
2624 #                   the password for the login. This option is required if
2625 #                   @user is specified.
2627 # @initiator-name:  The iqn name we want to identify to the target
2628 #                   as. If this option is not specified, an initiator name is
2629 #                   generated automatically.
2631 # @header-digest:   The desired header digest. Defaults to
2632 #                   none-crc32c.
2634 # @timeout:         Timeout in seconds after which a request will
2635 #                   timeout. 0 means no timeout and is the default.
2637 # Driver specific block device options for iscsi
2639 # Since: 2.9
2641 { 'struct': 'BlockdevOptionsIscsi',
2642   'data': { 'transport': 'IscsiTransport',
2643             'portal': 'str',
2644             'target': 'str',
2645             '*lun': 'int',
2646             '*user': 'str',
2647             '*password-secret': 'str',
2648             '*initiator-name': 'str',
2649             '*header-digest': 'IscsiHeaderDigest',
2650             '*timeout': 'int' } }
2654 # @BlockdevOptionsRbd:
2656 # @pool:               Ceph pool name.
2658 # @image:              Image name in the Ceph pool.
2660 # @conf:               path to Ceph configuration file.  Values
2661 #                      in the configuration file will be overridden by
2662 #                      options specified via QAPI.
2664 # @snapshot:           Ceph snapshot name.
2666 # @user:               Ceph id name.
2668 # @server:             Monitor host address and port.  This maps
2669 #                      to the "mon_host" Ceph option.
2671 # Since: 2.9
2673 { 'struct': 'BlockdevOptionsRbd',
2674   'data': { 'pool': 'str',
2675             'image': 'str',
2676             '*conf': 'str',
2677             '*snapshot': 'str',
2678             '*user': 'str',
2679             '*server': ['InetSocketAddressBase'] } }
2682 # @BlockdevOptionsSheepdog:
2684 # Driver specific block device options for sheepdog
2686 # @vdi:         Virtual disk image name
2687 # @server:      The Sheepdog server to connect to
2688 # @snap-id:     Snapshot ID
2689 # @tag:         Snapshot tag name
2691 # Only one of @snap-id and @tag may be present.
2693 # Since: 2.9
2695 { 'struct': 'BlockdevOptionsSheepdog',
2696   'data': { 'server': 'SocketAddress',
2697             'vdi': 'str',
2698             '*snap-id': 'uint32',
2699             '*tag': 'str' } }
2702 # @ReplicationMode:
2704 # An enumeration of replication modes.
2706 # @primary: Primary mode, the vm's state will be sent to secondary QEMU.
2708 # @secondary: Secondary mode, receive the vm's state from primary QEMU.
2710 # Since: 2.9
2712 { 'enum' : 'ReplicationMode', 'data' : [ 'primary', 'secondary' ] }
2715 # @BlockdevOptionsReplication:
2717 # Driver specific block device options for replication
2719 # @mode: the replication mode
2721 # @top-id: In secondary mode, node name or device ID of the root
2722 #          node who owns the replication node chain. Must not be given in
2723 #          primary mode.
2725 # Since: 2.9
2727 { 'struct': 'BlockdevOptionsReplication',
2728   'base': 'BlockdevOptionsGenericFormat',
2729   'data': { 'mode': 'ReplicationMode',
2730             '*top-id': 'str' } }
2733 # @NFSTransport:
2735 # An enumeration of NFS transport types
2737 # @inet:        TCP transport
2739 # Since: 2.9
2741 { 'enum': 'NFSTransport',
2742   'data': [ 'inet' ] }
2745 # @NFSServer:
2747 # Captures the address of the socket
2749 # @type:        transport type used for NFS (only TCP supported)
2751 # @host:        host address for NFS server
2753 # Since: 2.9
2755 { 'struct': 'NFSServer',
2756   'data': { 'type': 'NFSTransport',
2757             'host': 'str' } }
2760 # @BlockdevOptionsNfs:
2762 # Driver specific block device option for NFS
2764 # @server:                  host address
2766 # @path:                    path of the image on the host
2768 # @user:                    UID value to use when talking to the
2769 #                           server (defaults to 65534 on Windows and getuid()
2770 #                           on unix)
2772 # @group:                   GID value to use when talking to the
2773 #                           server (defaults to 65534 on Windows and getgid()
2774 #                           in unix)
2776 # @tcp-syn-count:           number of SYNs during the session
2777 #                           establishment (defaults to libnfs default)
2779 # @readahead-size:          set the readahead size in bytes (defaults
2780 #                           to libnfs default)
2782 # @page-cache-size:         set the pagecache size in bytes (defaults
2783 #                           to libnfs default)
2785 # @debug:                   set the NFS debug level (max 2) (defaults
2786 #                           to libnfs default)
2788 # Since: 2.9
2790 { 'struct': 'BlockdevOptionsNfs',
2791   'data': { 'server': 'NFSServer',
2792             'path': 'str',
2793             '*user': 'int',
2794             '*group': 'int',
2795             '*tcp-syn-count': 'int',
2796             '*readahead-size': 'int',
2797             '*page-cache-size': 'int',
2798             '*debug': 'int' } }
2801 # @BlockdevOptionsCurlBase:
2803 # Driver specific block device options shared by all protocols supported by the
2804 # curl backend.
2806 # @url:                     URL of the image file
2808 # @readahead:               Size of the read-ahead cache; must be a multiple of
2809 #                           512 (defaults to 256 kB)
2811 # @timeout:                 Timeout for connections, in seconds (defaults to 5)
2813 # @username:                Username for authentication (defaults to none)
2815 # @password-secret:         ID of a QCryptoSecret object providing a password
2816 #                           for authentication (defaults to no password)
2818 # @proxy-username:          Username for proxy authentication (defaults to none)
2820 # @proxy-password-secret:   ID of a QCryptoSecret object providing a password
2821 #                           for proxy authentication (defaults to no password)
2823 # Since: 2.9
2825 { 'struct': 'BlockdevOptionsCurlBase',
2826   'data': { 'url': 'str',
2827             '*readahead': 'int',
2828             '*timeout': 'int',
2829             '*username': 'str',
2830             '*password-secret': 'str',
2831             '*proxy-username': 'str',
2832             '*proxy-password-secret': 'str' } }
2835 # @BlockdevOptionsCurlHttp:
2837 # Driver specific block device options for HTTP connections over the curl
2838 # backend.  URLs must start with "http://".
2840 # @cookie:      List of cookies to set; format is
2841 #               "name1=content1; name2=content2;" as explained by
2842 #               CURLOPT_COOKIE(3). Defaults to no cookies.
2844 # @cookie-secret: ID of a QCryptoSecret object providing the cookie data in a
2845 #                 secure way. See @cookie for the format. (since 2.10)
2847 # Since: 2.9
2849 { 'struct': 'BlockdevOptionsCurlHttp',
2850   'base': 'BlockdevOptionsCurlBase',
2851   'data': { '*cookie': 'str',
2852             '*cookie-secret': 'str'} }
2855 # @BlockdevOptionsCurlHttps:
2857 # Driver specific block device options for HTTPS connections over the curl
2858 # backend.  URLs must start with "https://".
2860 # @cookie:      List of cookies to set; format is
2861 #               "name1=content1; name2=content2;" as explained by
2862 #               CURLOPT_COOKIE(3). Defaults to no cookies.
2864 # @sslverify:   Whether to verify the SSL certificate's validity (defaults to
2865 #               true)
2867 # @cookie-secret: ID of a QCryptoSecret object providing the cookie data in a
2868 #                 secure way. See @cookie for the format. (since 2.10)
2870 # Since: 2.9
2872 { 'struct': 'BlockdevOptionsCurlHttps',
2873   'base': 'BlockdevOptionsCurlBase',
2874   'data': { '*cookie': 'str',
2875             '*sslverify': 'bool',
2876             '*cookie-secret': 'str'} }
2879 # @BlockdevOptionsCurlFtp:
2881 # Driver specific block device options for FTP connections over the curl
2882 # backend.  URLs must start with "ftp://".
2884 # Since: 2.9
2886 { 'struct': 'BlockdevOptionsCurlFtp',
2887   'base': 'BlockdevOptionsCurlBase',
2888   'data': { } }
2891 # @BlockdevOptionsCurlFtps:
2893 # Driver specific block device options for FTPS connections over the curl
2894 # backend.  URLs must start with "ftps://".
2896 # @sslverify:   Whether to verify the SSL certificate's validity (defaults to
2897 #               true)
2899 # Since: 2.9
2901 { 'struct': 'BlockdevOptionsCurlFtps',
2902   'base': 'BlockdevOptionsCurlBase',
2903   'data': { '*sslverify': 'bool' } }
2906 # @BlockdevOptionsNbd:
2908 # Driver specific block device options for NBD.
2910 # @server:      NBD server address
2912 # @export:      export name
2914 # @tls-creds:   TLS credentials ID
2916 # Since: 2.9
2918 { 'struct': 'BlockdevOptionsNbd',
2919   'data': { 'server': 'SocketAddress',
2920             '*export': 'str',
2921             '*tls-creds': 'str' } }
2924 # @BlockdevOptionsRaw:
2926 # Driver specific block device options for the raw driver.
2928 # @offset:      position where the block device starts
2929 # @size:        the assumed size of the device
2931 # Since: 2.9
2933 { 'struct': 'BlockdevOptionsRaw',
2934   'base': 'BlockdevOptionsGenericFormat',
2935   'data': { '*offset': 'int', '*size': 'int' } }
2938 # @BlockdevOptionsVxHS:
2940 # Driver specific block device options for VxHS
2942 # @vdisk-id:    UUID of VxHS volume
2943 # @server:      vxhs server IP, port
2944 # @tls-creds:   TLS credentials ID
2946 # Since: 2.10
2948 { 'struct': 'BlockdevOptionsVxHS',
2949   'data': { 'vdisk-id': 'str',
2950             'server': 'InetSocketAddressBase',
2951             '*tls-creds': 'str' } }
2954 # @BlockdevOptions:
2956 # Options for creating a block device.  Many options are available for all
2957 # block devices, independent of the block driver:
2959 # @driver:        block driver name
2960 # @node-name:     the node name of the new node (Since 2.0).
2961 #                 This option is required on the top level of blockdev-add.
2962 # @discard:       discard-related options (default: ignore)
2963 # @cache:         cache-related options
2964 # @read-only:     whether the block device should be read-only
2965 #                 (default: false)
2966 # @detect-zeroes: detect and optimize zero writes (Since 2.1)
2967 #                 (default: off)
2968 # @force-share:   force share all permission on added nodes.
2969 #                 Requires read-only=true. (Since 2.10)
2971 # Remaining options are determined by the block driver.
2973 # Since: 2.9
2975 { 'union': 'BlockdevOptions',
2976   'base': { 'driver': 'BlockdevDriver',
2977             '*node-name': 'str',
2978             '*discard': 'BlockdevDiscardOptions',
2979             '*cache': 'BlockdevCacheOptions',
2980             '*read-only': 'bool',
2981             '*force-share': 'bool',
2982             '*detect-zeroes': 'BlockdevDetectZeroesOptions' },
2983   'discriminator': 'driver',
2984   'data': {
2985       'blkdebug':   'BlockdevOptionsBlkdebug',
2986       'blkverify':  'BlockdevOptionsBlkverify',
2987       'bochs':      'BlockdevOptionsGenericFormat',
2988       'cloop':      'BlockdevOptionsGenericFormat',
2989       'dmg':        'BlockdevOptionsGenericFormat',
2990       'file':       'BlockdevOptionsFile',
2991       'ftp':        'BlockdevOptionsCurlFtp',
2992       'ftps':       'BlockdevOptionsCurlFtps',
2993       'gluster':    'BlockdevOptionsGluster',
2994       'host_cdrom': 'BlockdevOptionsFile',
2995       'host_device':'BlockdevOptionsFile',
2996       'http':       'BlockdevOptionsCurlHttp',
2997       'https':      'BlockdevOptionsCurlHttps',
2998       'iscsi':      'BlockdevOptionsIscsi',
2999       'luks':       'BlockdevOptionsLUKS',
3000       'nbd':        'BlockdevOptionsNbd',
3001       'nfs':        'BlockdevOptionsNfs',
3002       'null-aio':   'BlockdevOptionsNull',
3003       'null-co':    'BlockdevOptionsNull',
3004       'parallels':  'BlockdevOptionsGenericFormat',
3005       'qcow2':      'BlockdevOptionsQcow2',
3006       'qcow':       'BlockdevOptionsQcow',
3007       'qed':        'BlockdevOptionsGenericCOWFormat',
3008       'quorum':     'BlockdevOptionsQuorum',
3009       'raw':        'BlockdevOptionsRaw',
3010       'rbd':        'BlockdevOptionsRbd',
3011       'replication':'BlockdevOptionsReplication',
3012       'sheepdog':   'BlockdevOptionsSheepdog',
3013       'ssh':        'BlockdevOptionsSsh',
3014       'vdi':        'BlockdevOptionsGenericFormat',
3015       'vhdx':       'BlockdevOptionsGenericFormat',
3016       'vmdk':       'BlockdevOptionsGenericCOWFormat',
3017       'vpc':        'BlockdevOptionsGenericFormat',
3018       'vvfat':      'BlockdevOptionsVVFAT',
3019       'vxhs':       'BlockdevOptionsVxHS'
3020   } }
3023 # @BlockdevRef:
3025 # Reference to a block device.
3027 # @definition:      defines a new block device inline
3028 # @reference:       references the ID of an existing block device. An
3029 #                   empty string means that no block device should be
3030 #                   referenced.
3032 # Since: 2.9
3034 { 'alternate': 'BlockdevRef',
3035   'data': { 'definition': 'BlockdevOptions',
3036             'reference': 'str' } }
3039 # @blockdev-add:
3041 # Creates a new block device. If the @id option is given at the top level, a
3042 # BlockBackend will be created; otherwise, @node-name is mandatory at the top
3043 # level and no BlockBackend will be created.
3045 # Since: 2.9
3047 # Example:
3049 # 1.
3050 # -> { "execute": "blockdev-add",
3051 #      "arguments": {
3052 #           "driver": "qcow2",
3053 #           "node-name": "test1",
3054 #           "file": {
3055 #               "driver": "file",
3056 #               "filename": "test.qcow2"
3057 #            }
3058 #       }
3059 #     }
3060 # <- { "return": {} }
3062 # 2.
3063 # -> { "execute": "blockdev-add",
3064 #      "arguments": {
3065 #           "driver": "qcow2",
3066 #           "node-name": "node0",
3067 #           "discard": "unmap",
3068 #           "cache": {
3069 #              "direct": true
3070 #            },
3071 #            "file": {
3072 #              "driver": "file",
3073 #              "filename": "/tmp/test.qcow2"
3074 #            },
3075 #            "backing": {
3076 #               "driver": "raw",
3077 #               "file": {
3078 #                  "driver": "file",
3079 #                  "filename": "/dev/fdset/4"
3080 #                }
3081 #            }
3082 #        }
3083 #      }
3085 # <- { "return": {} }
3088 { 'command': 'blockdev-add', 'data': 'BlockdevOptions', 'boxed': true }
3091 # @blockdev-del:
3093 # Deletes a block device that has been added using blockdev-add.
3094 # The command will fail if the node is attached to a device or is
3095 # otherwise being used.
3097 # @node-name: Name of the graph node to delete.
3099 # Since: 2.9
3101 # Example:
3103 # -> { "execute": "blockdev-add",
3104 #      "arguments": {
3105 #           "driver": "qcow2",
3106 #           "node-name": "node0",
3107 #           "file": {
3108 #               "driver": "file",
3109 #               "filename": "test.qcow2"
3110 #           }
3111 #      }
3112 #    }
3113 # <- { "return": {} }
3115 # -> { "execute": "blockdev-del",
3116 #      "arguments": { "node-name": "node0" }
3117 #    }
3118 # <- { "return": {} }
3121 { 'command': 'blockdev-del', 'data': { 'node-name': 'str' } }
3124 # @blockdev-open-tray:
3126 # Opens a block device's tray. If there is a block driver state tree inserted as
3127 # a medium, it will become inaccessible to the guest (but it will remain
3128 # associated to the block device, so closing the tray will make it accessible
3129 # again).
3131 # If the tray was already open before, this will be a no-op.
3133 # Once the tray opens, a DEVICE_TRAY_MOVED event is emitted. There are cases in
3134 # which no such event will be generated, these include:
3135 # - if the guest has locked the tray, @force is false and the guest does not
3136 #   respond to the eject request
3137 # - if the BlockBackend denoted by @device does not have a guest device attached
3138 #   to it
3139 # - if the guest device does not have an actual tray
3141 # @device: Block device name (deprecated, use @id instead)
3143 # @id:     The name or QOM path of the guest device (since: 2.8)
3145 # @force:  if false (the default), an eject request will be sent to
3146 #          the guest if it has locked the tray (and the tray will not be opened
3147 #          immediately); if true, the tray will be opened regardless of whether
3148 #          it is locked
3150 # Since: 2.5
3152 # Example:
3154 # -> { "execute": "blockdev-open-tray",
3155 #      "arguments": { "id": "ide0-1-0" } }
3157 # <- { "timestamp": { "seconds": 1418751016,
3158 #                     "microseconds": 716996 },
3159 #      "event": "DEVICE_TRAY_MOVED",
3160 #      "data": { "device": "ide1-cd0",
3161 #                "id": "ide0-1-0",
3162 #                "tray-open": true } }
3164 # <- { "return": {} }
3167 { 'command': 'blockdev-open-tray',
3168   'data': { '*device': 'str',
3169             '*id': 'str',
3170             '*force': 'bool' } }
3173 # @blockdev-close-tray:
3175 # Closes a block device's tray. If there is a block driver state tree associated
3176 # with the block device (which is currently ejected), that tree will be loaded
3177 # as the medium.
3179 # If the tray was already closed before, this will be a no-op.
3181 # @device:  Block device name (deprecated, use @id instead)
3183 # @id:      The name or QOM path of the guest device (since: 2.8)
3185 # Since: 2.5
3187 # Example:
3189 # -> { "execute": "blockdev-close-tray",
3190 #      "arguments": { "id": "ide0-1-0" } }
3192 # <- { "timestamp": { "seconds": 1418751345,
3193 #                     "microseconds": 272147 },
3194 #      "event": "DEVICE_TRAY_MOVED",
3195 #      "data": { "device": "ide1-cd0",
3196 #                "id": "ide0-1-0",
3197 #                "tray-open": false } }
3199 # <- { "return": {} }
3202 { 'command': 'blockdev-close-tray',
3203   'data': { '*device': 'str',
3204             '*id': 'str' } }
3207 # @x-blockdev-remove-medium:
3209 # Removes a medium (a block driver state tree) from a block device. That block
3210 # device's tray must currently be open (unless there is no attached guest
3211 # device).
3213 # If the tray is open and there is no medium inserted, this will be a no-op.
3215 # @device: Block device name (deprecated, use @id instead)
3217 # @id:     The name or QOM path of the guest device (since: 2.8)
3219 # Note: This command is still a work in progress and is considered experimental.
3220 # Stay away from it unless you want to help with its development.
3222 # Since: 2.5
3224 # Example:
3226 # -> { "execute": "x-blockdev-remove-medium",
3227 #      "arguments": { "id": "ide0-1-0" } }
3229 # <- { "error": { "class": "GenericError",
3230 #                 "desc": "Tray of device 'ide0-1-0' is not open" } }
3232 # -> { "execute": "blockdev-open-tray",
3233 #      "arguments": { "id": "ide0-1-0" } }
3235 # <- { "timestamp": { "seconds": 1418751627,
3236 #                     "microseconds": 549958 },
3237 #      "event": "DEVICE_TRAY_MOVED",
3238 #      "data": { "device": "ide1-cd0",
3239 #                "id": "ide0-1-0",
3240 #                "tray-open": true } }
3242 # <- { "return": {} }
3244 # -> { "execute": "x-blockdev-remove-medium",
3245 #      "arguments": { "id": "ide0-1-0" } }
3247 # <- { "return": {} }
3250 { 'command': 'x-blockdev-remove-medium',
3251   'data': { '*device': 'str',
3252             '*id': 'str' } }
3255 # @x-blockdev-insert-medium:
3257 # Inserts a medium (a block driver state tree) into a block device. That block
3258 # device's tray must currently be open (unless there is no attached guest
3259 # device) and there must be no medium inserted already.
3261 # @device:    Block device name (deprecated, use @id instead)
3263 # @id:        The name or QOM path of the guest device (since: 2.8)
3265 # @node-name: name of a node in the block driver state graph
3267 # Note: This command is still a work in progress and is considered experimental.
3268 # Stay away from it unless you want to help with its development.
3270 # Since: 2.5
3272 # Example:
3274 # -> { "execute": "blockdev-add",
3275 #      "arguments": {
3276 #          "node-name": "node0",
3277 #          "driver": "raw",
3278 #          "file": { "driver": "file",
3279 #                    "filename": "fedora.iso" } } }
3280 # <- { "return": {} }
3282 # -> { "execute": "x-blockdev-insert-medium",
3283 #      "arguments": { "id": "ide0-1-0",
3284 #                     "node-name": "node0" } }
3286 # <- { "return": {} }
3289 { 'command': 'x-blockdev-insert-medium',
3290   'data': { '*device': 'str',
3291             '*id': 'str',
3292             'node-name': 'str'} }
3296 # @BlockdevChangeReadOnlyMode:
3298 # Specifies the new read-only mode of a block device subject to the
3299 # @blockdev-change-medium command.
3301 # @retain:      Retains the current read-only mode
3303 # @read-only:   Makes the device read-only
3305 # @read-write:  Makes the device writable
3307 # Since: 2.3
3310 { 'enum': 'BlockdevChangeReadOnlyMode',
3311   'data': ['retain', 'read-only', 'read-write'] }
3315 # @blockdev-change-medium:
3317 # Changes the medium inserted into a block device by ejecting the current medium
3318 # and loading a new image file which is inserted as the new medium (this command
3319 # combines blockdev-open-tray, x-blockdev-remove-medium,
3320 # x-blockdev-insert-medium and blockdev-close-tray).
3322 # @device:          Block device name (deprecated, use @id instead)
3324 # @id:              The name or QOM path of the guest device
3325 #                   (since: 2.8)
3327 # @filename:        filename of the new image to be loaded
3329 # @format:          format to open the new image with (defaults to
3330 #                   the probed format)
3332 # @read-only-mode:  change the read-only mode of the device; defaults
3333 #                   to 'retain'
3335 # Since: 2.5
3337 # Examples:
3339 # 1. Change a removable medium
3341 # -> { "execute": "blockdev-change-medium",
3342 #      "arguments": { "id": "ide0-1-0",
3343 #                     "filename": "/srv/images/Fedora-12-x86_64-DVD.iso",
3344 #                     "format": "raw" } }
3345 # <- { "return": {} }
3347 # 2. Load a read-only medium into a writable drive
3349 # -> { "execute": "blockdev-change-medium",
3350 #      "arguments": { "id": "floppyA",
3351 #                     "filename": "/srv/images/ro.img",
3352 #                     "format": "raw",
3353 #                     "read-only-mode": "retain" } }
3355 # <- { "error":
3356 #      { "class": "GenericError",
3357 #        "desc": "Could not open '/srv/images/ro.img': Permission denied" } }
3359 # -> { "execute": "blockdev-change-medium",
3360 #      "arguments": { "id": "floppyA",
3361 #                     "filename": "/srv/images/ro.img",
3362 #                     "format": "raw",
3363 #                     "read-only-mode": "read-only" } }
3365 # <- { "return": {} }
3368 { 'command': 'blockdev-change-medium',
3369   'data': { '*device': 'str',
3370             '*id': 'str',
3371             'filename': 'str',
3372             '*format': 'str',
3373             '*read-only-mode': 'BlockdevChangeReadOnlyMode' } }
3377 # @BlockErrorAction:
3379 # An enumeration of action that has been taken when a DISK I/O occurs
3381 # @ignore: error has been ignored
3383 # @report: error has been reported to the device
3385 # @stop: error caused VM to be stopped
3387 # Since: 2.1
3389 { 'enum': 'BlockErrorAction',
3390   'data': [ 'ignore', 'report', 'stop' ] }
3394 # @BLOCK_IMAGE_CORRUPTED:
3396 # Emitted when a disk image is being marked corrupt. The image can be
3397 # identified by its device or node name. The 'device' field is always
3398 # present for compatibility reasons, but it can be empty ("") if the
3399 # image does not have a device name associated.
3401 # @device: device name. This is always present for compatibility
3402 #          reasons, but it can be empty ("") if the image does not
3403 #          have a device name associated.
3405 # @node-name: node name (Since: 2.4)
3407 # @msg: informative message for human consumption, such as the kind of
3408 #       corruption being detected. It should not be parsed by machine as it is
3409 #       not guaranteed to be stable
3411 # @offset: if the corruption resulted from an image access, this is
3412 #          the host's access offset into the image
3414 # @size: if the corruption resulted from an image access, this is
3415 #        the access size
3417 # @fatal: if set, the image is marked corrupt and therefore unusable after this
3418 #        event and must be repaired (Since 2.2; before, every
3419 #        BLOCK_IMAGE_CORRUPTED event was fatal)
3421 # Note: If action is "stop", a STOP event will eventually follow the
3422 #       BLOCK_IO_ERROR event.
3424 # Example:
3426 # <- { "event": "BLOCK_IMAGE_CORRUPTED",
3427 #      "data": { "device": "ide0-hd0", "node-name": "node0",
3428 #                "msg": "Prevented active L1 table overwrite", "offset": 196608,
3429 #                "size": 65536 },
3430 #      "timestamp": { "seconds": 1378126126, "microseconds": 966463 } }
3432 # Since: 1.7
3434 { 'event': 'BLOCK_IMAGE_CORRUPTED',
3435   'data': { 'device'     : 'str',
3436             '*node-name' : 'str',
3437             'msg'        : 'str',
3438             '*offset'    : 'int',
3439             '*size'      : 'int',
3440             'fatal'      : 'bool' } }
3443 # @BLOCK_IO_ERROR:
3445 # Emitted when a disk I/O error occurs
3447 # @device: device name. This is always present for compatibility
3448 #          reasons, but it can be empty ("") if the image does not
3449 #          have a device name associated.
3451 # @node-name: node name. Note that errors may be reported for the root node
3452 #             that is directly attached to a guest device rather than for the
3453 #             node where the error occurred. (Since: 2.8)
3455 # @operation: I/O operation
3457 # @action: action that has been taken
3459 # @nospace: true if I/O error was caused due to a no-space
3460 #           condition. This key is only present if query-block's
3461 #           io-status is present, please see query-block documentation
3462 #           for more information (since: 2.2)
3464 # @reason: human readable string describing the error cause.
3465 #          (This field is a debugging aid for humans, it should not
3466 #           be parsed by applications) (since: 2.2)
3468 # Note: If action is "stop", a STOP event will eventually follow the
3469 # BLOCK_IO_ERROR event
3471 # Since: 0.13.0
3473 # Example:
3475 # <- { "event": "BLOCK_IO_ERROR",
3476 #      "data": { "device": "ide0-hd1",
3477 #                "node-name": "#block212",
3478 #                "operation": "write",
3479 #                "action": "stop" },
3480 #      "timestamp": { "seconds": 1265044230, "microseconds": 450486 } }
3483 { 'event': 'BLOCK_IO_ERROR',
3484   'data': { 'device': 'str', 'node-name': 'str', 'operation': 'IoOperationType',
3485             'action': 'BlockErrorAction', '*nospace': 'bool',
3486             'reason': 'str' } }
3489 # @BLOCK_JOB_COMPLETED:
3491 # Emitted when a block job has completed
3493 # @type: job type
3495 # @device: The job identifier. Originally the device name but other
3496 #          values are allowed since QEMU 2.7
3498 # @len: maximum progress value
3500 # @offset: current progress value. On success this is equal to len.
3501 #          On failure this is less than len
3503 # @speed: rate limit, bytes per second
3505 # @error: error message. Only present on failure. This field
3506 #         contains a human-readable error message. There are no semantics
3507 #         other than that streaming has failed and clients should not try to
3508 #         interpret the error string
3510 # Since: 1.1
3512 # Example:
3514 # <- { "event": "BLOCK_JOB_COMPLETED",
3515 #      "data": { "type": "stream", "device": "virtio-disk0",
3516 #                "len": 10737418240, "offset": 10737418240,
3517 #                "speed": 0 },
3518 #      "timestamp": { "seconds": 1267061043, "microseconds": 959568 } }
3521 { 'event': 'BLOCK_JOB_COMPLETED',
3522   'data': { 'type'  : 'BlockJobType',
3523             'device': 'str',
3524             'len'   : 'int',
3525             'offset': 'int',
3526             'speed' : 'int',
3527             '*error': 'str' } }
3530 # @BLOCK_JOB_CANCELLED:
3532 # Emitted when a block job has been cancelled
3534 # @type: job type
3536 # @device: The job identifier. Originally the device name but other
3537 #          values are allowed since QEMU 2.7
3539 # @len: maximum progress value
3541 # @offset: current progress value. On success this is equal to len.
3542 #          On failure this is less than len
3544 # @speed: rate limit, bytes per second
3546 # Since: 1.1
3548 # Example:
3550 # <- { "event": "BLOCK_JOB_CANCELLED",
3551 #      "data": { "type": "stream", "device": "virtio-disk0",
3552 #                "len": 10737418240, "offset": 134217728,
3553 #                "speed": 0 },
3554 #      "timestamp": { "seconds": 1267061043, "microseconds": 959568 } }
3557 { 'event': 'BLOCK_JOB_CANCELLED',
3558   'data': { 'type'  : 'BlockJobType',
3559             'device': 'str',
3560             'len'   : 'int',
3561             'offset': 'int',
3562             'speed' : 'int' } }
3565 # @BLOCK_JOB_ERROR:
3567 # Emitted when a block job encounters an error
3569 # @device: The job identifier. Originally the device name but other
3570 #          values are allowed since QEMU 2.7
3572 # @operation: I/O operation
3574 # @action: action that has been taken
3576 # Since: 1.3
3578 # Example:
3580 # <- { "event": "BLOCK_JOB_ERROR",
3581 #      "data": { "device": "ide0-hd1",
3582 #                "operation": "write",
3583 #                "action": "stop" },
3584 #      "timestamp": { "seconds": 1265044230, "microseconds": 450486 } }
3587 { 'event': 'BLOCK_JOB_ERROR',
3588   'data': { 'device'   : 'str',
3589             'operation': 'IoOperationType',
3590             'action'   : 'BlockErrorAction' } }
3593 # @BLOCK_JOB_READY:
3595 # Emitted when a block job is ready to complete
3597 # @type: job type
3599 # @device: The job identifier. Originally the device name but other
3600 #          values are allowed since QEMU 2.7
3602 # @len: maximum progress value
3604 # @offset: current progress value. On success this is equal to len.
3605 #          On failure this is less than len
3607 # @speed: rate limit, bytes per second
3609 # Note: The "ready to complete" status is always reset by a @BLOCK_JOB_ERROR
3610 # event
3612 # Since: 1.3
3614 # Example:
3616 # <- { "event": "BLOCK_JOB_READY",
3617 #      "data": { "device": "drive0", "type": "mirror", "speed": 0,
3618 #                "len": 2097152, "offset": 2097152 }
3619 #      "timestamp": { "seconds": 1265044230, "microseconds": 450486 } }
3622 { 'event': 'BLOCK_JOB_READY',
3623   'data': { 'type'  : 'BlockJobType',
3624             'device': 'str',
3625             'len'   : 'int',
3626             'offset': 'int',
3627             'speed' : 'int' } }
3630 # @PreallocMode:
3632 # Preallocation mode of QEMU image file
3634 # @off: no preallocation
3635 # @metadata: preallocate only for metadata
3636 # @falloc: like @full preallocation but allocate disk space by
3637 #          posix_fallocate() rather than writing zeros.
3638 # @full: preallocate all data by writing zeros to device to ensure disk
3639 #        space is really available. @full preallocation also sets up
3640 #        metadata correctly.
3642 # Since: 2.2
3644 { 'enum': 'PreallocMode',
3645   'data': [ 'off', 'metadata', 'falloc', 'full' ] }
3648 # @BLOCK_WRITE_THRESHOLD:
3650 # Emitted when writes on block device reaches or exceeds the
3651 # configured write threshold. For thin-provisioned devices, this
3652 # means the device should be extended to avoid pausing for
3653 # disk exhaustion.
3654 # The event is one shot. Once triggered, it needs to be
3655 # re-registered with another block-set-write-threshold command.
3657 # @node-name: graph node name on which the threshold was exceeded.
3659 # @amount-exceeded: amount of data which exceeded the threshold, in bytes.
3661 # @write-threshold: last configured threshold, in bytes.
3663 # Since: 2.3
3665 { 'event': 'BLOCK_WRITE_THRESHOLD',
3666   'data': { 'node-name': 'str',
3667             'amount-exceeded': 'uint64',
3668             'write-threshold': 'uint64' } }
3671 # @block-set-write-threshold:
3673 # Change the write threshold for a block drive. An event will be
3674 # delivered if a write to this block drive crosses the configured
3675 # threshold.  The threshold is an offset, thus must be
3676 # non-negative. Default is no write threshold. Setting the threshold
3677 # to zero disables it.
3679 # This is useful to transparently resize thin-provisioned drives without
3680 # the guest OS noticing.
3682 # @node-name: graph node name on which the threshold must be set.
3684 # @write-threshold: configured threshold for the block device, bytes.
3685 #                   Use 0 to disable the threshold.
3687 # Since: 2.3
3689 # Example:
3691 # -> { "execute": "block-set-write-threshold",
3692 #      "arguments": { "node-name": "mydev",
3693 #                     "write-threshold": 17179869184 } }
3694 # <- { "return": {} }
3697 { 'command': 'block-set-write-threshold',
3698   'data': { 'node-name': 'str', 'write-threshold': 'uint64' } }
3701 # @x-blockdev-change:
3703 # Dynamically reconfigure the block driver state graph. It can be used
3704 # to add, remove, insert or replace a graph node. Currently only the
3705 # Quorum driver implements this feature to add or remove its child. This
3706 # is useful to fix a broken quorum child.
3708 # If @node is specified, it will be inserted under @parent. @child
3709 # may not be specified in this case. If both @parent and @child are
3710 # specified but @node is not, @child will be detached from @parent.
3712 # @parent: the id or name of the parent node.
3714 # @child: the name of a child under the given parent node.
3716 # @node: the name of the node that will be added.
3718 # Note: this command is experimental, and its API is not stable. It
3719 # does not support all kinds of operations, all kinds of children, nor
3720 # all block drivers.
3722 # Warning: The data in a new quorum child MUST be consistent with that of
3723 # the rest of the array.
3725 # Since: 2.7
3727 # Example:
3729 # 1. Add a new node to a quorum
3730 # -> { "execute": "blockdev-add",
3731 #      "arguments": {
3732 #          "driver": "raw",
3733 #          "node-name": "new_node",
3734 #          "file": { "driver": "file",
3735 #                    "filename": "test.raw" } } }
3736 # <- { "return": {} }
3737 # -> { "execute": "x-blockdev-change",
3738 #      "arguments": { "parent": "disk1",
3739 #                     "node": "new_node" } }
3740 # <- { "return": {} }
3742 # 2. Delete a quorum's node
3743 # -> { "execute": "x-blockdev-change",
3744 #      "arguments": { "parent": "disk1",
3745 #                     "child": "children.1" } }
3746 # <- { "return": {} }
3749 { 'command': 'x-blockdev-change',
3750   'data' : { 'parent': 'str',
3751              '*child': 'str',
3752              '*node': 'str' } }