Merge remote-tracking branch 'remotes/cody/tags/block-pull-request' into staging
[qemu/ar7.git] / qapi / block-core.json
blobbc0ccd615c1bd5e114a86dab1568b91ed0f69eb2
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: #optional on or off; only valid for compat >= 1.1
42 # @corrupt: #optional 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: #optional actual size on disk in bytes of the image
108 # @dirty-flag: #optional true if image is not cleanly closed
110 # @cluster-size: #optional size of a cluster in bytes
112 # @encrypted: #optional true if the image is encrypted
114 # @compressed: #optional true if the image is compressed (Since 1.7)
116 # @backing-filename: #optional name of the backing file
118 # @full-backing-filename: #optional full path of the backing file
120 # @backing-filename-format: #optional the format of the backing file
122 # @snapshots: #optional list of VM snapshots
124 # @backing-image: #optional info of the backing image (since 1.6)
126 # @format-specific: #optional 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: #optional offset (in bytes) where the image ends, this
153 #                    field is present if the driver for the image format
154 #                    supports it
156 # @corruptions: #optional number of corruptions found during the check if any
158 # @leaks: #optional number of leaks found during the check if any
160 # @corruptions-fixed: #optional number of corruptions fixed during the check
161 #                     if any
163 # @leaks-fixed: #optional number of leaks fixed during the check if any
165 # @total-clusters: #optional total number of clusters, this field is present
166 #                  if the driver for the image format supports it
168 # @allocated-clusters: #optional total number of allocated clusters, this
169 #                      field is present if the driver for the image format
170 #                      supports it
172 # @fragmented-clusters: #optional total number of fragmented clusters, this
173 #                       field is present if the driver for the image format
174 #                       supports it
176 # @compressed-clusters: #optional 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: #optional the offset in file that the virtual sectors are mapped to
207 # @filename: #optional 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: #optional 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
255 # @backing_file: #optional the name of the backing file (for copy-on-write)
257 # @backing_file_depth: number of files in the backing file chain (since: 1.2)
259 # @encrypted: true if the backing device is encrypted
261 # @encryption_key_missing: true if the backing device is encrypted but an
262 #                          valid encryption key is missing
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: #optional total throughput limit during bursts,
281 #                     in bytes (Since 1.7)
283 # @bps_rd_max: #optional read throughput limit during bursts,
284 #                        in bytes (Since 1.7)
286 # @bps_wr_max: #optional write throughput limit during bursts,
287 #                        in bytes (Since 1.7)
289 # @iops_max: #optional total I/O operations per second during bursts,
290 #                      in bytes (Since 1.7)
292 # @iops_rd_max: #optional read I/O operations per second during bursts,
293 #                         in bytes (Since 1.7)
295 # @iops_wr_max: #optional write I/O operations per second during bursts,
296 #                         in bytes (Since 1.7)
298 # @bps_max_length: #optional maximum length of the @bps_max burst
299 #                            period, in seconds. (Since 2.6)
301 # @bps_rd_max_length: #optional maximum length of the @bps_rd_max
302 #                               burst period, in seconds. (Since 2.6)
304 # @bps_wr_max_length: #optional maximum length of the @bps_wr_max
305 #                               burst period, in seconds. (Since 2.6)
307 # @iops_max_length: #optional maximum length of the @iops burst
308 #                             period, in seconds. (Since 2.6)
310 # @iops_rd_max_length: #optional maximum length of the @iops_rd_max
311 #                                burst period, in seconds. (Since 2.6)
313 # @iops_wr_max_length: #optional maximum length of the @iops_wr_max
314 #                                burst period, in seconds. (Since 2.6)
316 # @iops_size: #optional an I/O size in bytes (Since 1.7)
318 # @group: #optional 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: #optional 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: #optional True if the device's tray is open
444 #             (only present if it has a tray)
446 # @dirty-bitmaps: #optional dirty bitmaps information (only present if the
447 #                 driver has one or more dirty bitmaps) (Since 2.0)
449 # @io-status: #optional @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-disk)
453 # @inserted: #optional @BlockDeviceInfo describing the device if media is
454 #            present
456 # Since:  0.14.0
458 { 'struct': 'BlockInfo',
459   'data': {'device': 'str', 'type': 'str', 'removable': 'bool',
460            'locked': 'bool', '*inserted': 'BlockDeviceInfo',
461            '*tray_open': 'bool', '*io-status': 'BlockDeviceIoStatus',
462            '*dirty-bitmaps': ['BlockDirtyInfo'] } }
465 # @query-block:
467 # Get a list of BlockInfo for all virtual block devices.
469 # Returns: a list of @BlockInfo describing each virtual block device
471 # Since: 0.14.0
473 # Example:
475 # -> { "execute": "query-block" }
476 # <- {
477 #       "return":[
478 #          {
479 #             "io-status": "ok",
480 #             "device":"ide0-hd0",
481 #             "locked":false,
482 #             "removable":false,
483 #             "inserted":{
484 #                "ro":false,
485 #                "drv":"qcow2",
486 #                "encrypted":false,
487 #                "file":"disks/test.qcow2",
488 #                "backing_file_depth":1,
489 #                "bps":1000000,
490 #                "bps_rd":0,
491 #                "bps_wr":0,
492 #                "iops":1000000,
493 #                "iops_rd":0,
494 #                "iops_wr":0,
495 #                "bps_max": 8000000,
496 #                "bps_rd_max": 0,
497 #                "bps_wr_max": 0,
498 #                "iops_max": 0,
499 #                "iops_rd_max": 0,
500 #                "iops_wr_max": 0,
501 #                "iops_size": 0,
502 #                "detect_zeroes": "on",
503 #                "write_threshold": 0,
504 #                "image":{
505 #                   "filename":"disks/test.qcow2",
506 #                   "format":"qcow2",
507 #                   "virtual-size":2048000,
508 #                   "backing_file":"base.qcow2",
509 #                   "full-backing-filename":"disks/base.qcow2",
510 #                   "backing-filename-format":"qcow2",
511 #                   "snapshots":[
512 #                      {
513 #                         "id": "1",
514 #                         "name": "snapshot1",
515 #                         "vm-state-size": 0,
516 #                         "date-sec": 10000200,
517 #                         "date-nsec": 12,
518 #                         "vm-clock-sec": 206,
519 #                         "vm-clock-nsec": 30
520 #                      }
521 #                   ],
522 #                   "backing-image":{
523 #                       "filename":"disks/base.qcow2",
524 #                       "format":"qcow2",
525 #                       "virtual-size":2048000
526 #                   }
527 #                }
528 #             },
529 #             "type":"unknown"
530 #          },
531 #          {
532 #             "io-status": "ok",
533 #             "device":"ide1-cd0",
534 #             "locked":false,
535 #             "removable":true,
536 #             "type":"unknown"
537 #          },
538 #          {
539 #             "device":"floppy0",
540 #             "locked":false,
541 #             "removable":true,
542 #             "type":"unknown"
543 #          },
544 #          {
545 #             "device":"sd0",
546 #             "locked":false,
547 #             "removable":true,
548 #             "type":"unknown"
549 #          }
550 #       ]
551 #    }
554 { 'command': 'query-block', 'returns': ['BlockInfo'] }
558 # @BlockDeviceTimedStats:
560 # Statistics of a block device during a given interval of time.
562 # @interval_length: Interval used for calculating the statistics,
563 #                   in seconds.
565 # @min_rd_latency_ns: Minimum latency of read operations in the
566 #                     defined interval, in nanoseconds.
568 # @min_wr_latency_ns: Minimum latency of write operations in the
569 #                     defined interval, in nanoseconds.
571 # @min_flush_latency_ns: Minimum latency of flush operations in the
572 #                        defined interval, in nanoseconds.
574 # @max_rd_latency_ns: Maximum latency of read operations in the
575 #                     defined interval, in nanoseconds.
577 # @max_wr_latency_ns: Maximum latency of write operations in the
578 #                     defined interval, in nanoseconds.
580 # @max_flush_latency_ns: Maximum latency of flush operations in the
581 #                        defined interval, in nanoseconds.
583 # @avg_rd_latency_ns: Average latency of read operations in the
584 #                     defined interval, in nanoseconds.
586 # @avg_wr_latency_ns: Average latency of write operations in the
587 #                     defined interval, in nanoseconds.
589 # @avg_flush_latency_ns: Average latency of flush operations in the
590 #                        defined interval, in nanoseconds.
592 # @avg_rd_queue_depth: Average number of pending read operations
593 #                      in the defined interval.
595 # @avg_wr_queue_depth: Average number of pending write operations
596 #                      in the defined interval.
598 # Since: 2.5
600 { 'struct': 'BlockDeviceTimedStats',
601   'data': { 'interval_length': 'int', 'min_rd_latency_ns': 'int',
602             'max_rd_latency_ns': 'int', 'avg_rd_latency_ns': 'int',
603             'min_wr_latency_ns': 'int', 'max_wr_latency_ns': 'int',
604             'avg_wr_latency_ns': 'int', 'min_flush_latency_ns': 'int',
605             'max_flush_latency_ns': 'int', 'avg_flush_latency_ns': 'int',
606             'avg_rd_queue_depth': 'number', 'avg_wr_queue_depth': 'number' } }
609 # @BlockDeviceStats:
611 # Statistics of a virtual block device or a block backing device.
613 # @rd_bytes:      The number of bytes read by the device.
615 # @wr_bytes:      The number of bytes written by the device.
617 # @rd_operations: The number of read operations performed by the device.
619 # @wr_operations: The number of write operations performed by the device.
621 # @flush_operations: The number of cache flush operations performed by the
622 #                    device (since 0.15.0)
624 # @flush_total_time_ns: Total time spend on cache flushes in nano-seconds
625 #                       (since 0.15.0).
627 # @wr_total_time_ns: Total time spend on writes in nano-seconds (since 0.15.0).
629 # @rd_total_time_ns: Total_time_spend on reads in nano-seconds (since 0.15.0).
631 # @wr_highest_offset: The offset after the greatest byte written to the
632 #                     device.  The intended use of this information is for
633 #                     growable sparse files (like qcow2) that are used on top
634 #                     of a physical device.
636 # @rd_merged: Number of read requests that have been merged into another
637 #             request (Since 2.3).
639 # @wr_merged: Number of write requests that have been merged into another
640 #             request (Since 2.3).
642 # @idle_time_ns: #optional Time since the last I/O operation, in
643 #                nanoseconds. If the field is absent it means that
644 #                there haven't been any operations yet (Since 2.5).
646 # @failed_rd_operations: The number of failed read operations
647 #                        performed by the device (Since 2.5)
649 # @failed_wr_operations: The number of failed write operations
650 #                        performed by the device (Since 2.5)
652 # @failed_flush_operations: The number of failed flush operations
653 #                           performed by the device (Since 2.5)
655 # @invalid_rd_operations: The number of invalid read operations
656 #                          performed by the device (Since 2.5)
658 # @invalid_wr_operations: The number of invalid write operations
659 #                         performed by the device (Since 2.5)
661 # @invalid_flush_operations: The number of invalid flush operations
662 #                            performed by the device (Since 2.5)
664 # @account_invalid: Whether invalid operations are included in the
665 #                   last access statistics (Since 2.5)
667 # @account_failed: Whether failed operations are included in the
668 #                  latency and last access statistics (Since 2.5)
670 # @timed_stats: Statistics specific to the set of previously defined
671 #               intervals of time (Since 2.5)
673 # Since: 0.14.0
675 { 'struct': 'BlockDeviceStats',
676   'data': {'rd_bytes': 'int', 'wr_bytes': 'int', 'rd_operations': 'int',
677            'wr_operations': 'int', 'flush_operations': 'int',
678            'flush_total_time_ns': 'int', 'wr_total_time_ns': 'int',
679            'rd_total_time_ns': 'int', 'wr_highest_offset': 'int',
680            'rd_merged': 'int', 'wr_merged': 'int', '*idle_time_ns': 'int',
681            'failed_rd_operations': 'int', 'failed_wr_operations': 'int',
682            'failed_flush_operations': 'int', 'invalid_rd_operations': 'int',
683            'invalid_wr_operations': 'int', 'invalid_flush_operations': 'int',
684            'account_invalid': 'bool', 'account_failed': 'bool',
685            'timed_stats': ['BlockDeviceTimedStats'] } }
688 # @BlockStats:
690 # Statistics of a virtual block device or a block backing device.
692 # @device: #optional If the stats are for a virtual block device, the name
693 #          corresponding to the virtual block device.
695 # @node-name: #optional The node name of the device. (Since 2.3)
697 # @stats:  A @BlockDeviceStats for the device.
699 # @parent: #optional This describes the file block device if it has one.
700 #          Contains recursively the statistics of the underlying
701 #          protocol (e.g. the host file for a qcow2 image). If there is
702 #          no underlying protocol, this field is omitted
704 # @backing: #optional This describes the backing block device if it has one.
705 #           (Since 2.0)
707 # Since: 0.14.0
709 { 'struct': 'BlockStats',
710   'data': {'*device': 'str', '*node-name': 'str',
711            'stats': 'BlockDeviceStats',
712            '*parent': 'BlockStats',
713            '*backing': 'BlockStats'} }
716 # @query-blockstats:
718 # Query the @BlockStats for all virtual block devices.
720 # @query-nodes: #optional If true, the command will query all the block nodes
721 #               that have a node name, in a list which will include "parent"
722 #               information, but not "backing".
723 #               If false or omitted, the behavior is as before - query all the
724 #               device backends, recursively including their "parent" and
725 #               "backing". (Since 2.3)
727 # Returns: A list of @BlockStats for each virtual block devices.
729 # Since: 0.14.0
731 # Example:
733 # -> { "execute": "query-blockstats" }
734 # <- {
735 #       "return":[
736 #          {
737 #             "device":"ide0-hd0",
738 #             "parent":{
739 #                "stats":{
740 #                   "wr_highest_offset":3686448128,
741 #                   "wr_bytes":9786368,
742 #                   "wr_operations":751,
743 #                   "rd_bytes":122567168,
744 #                   "rd_operations":36772
745 #                   "wr_total_times_ns":313253456
746 #                   "rd_total_times_ns":3465673657
747 #                   "flush_total_times_ns":49653
748 #                   "flush_operations":61,
749 #                   "rd_merged":0,
750 #                   "wr_merged":0,
751 #                   "idle_time_ns":2953431879,
752 #                   "account_invalid":true,
753 #                   "account_failed":false
754 #                }
755 #             },
756 #             "stats":{
757 #                "wr_highest_offset":2821110784,
758 #                "wr_bytes":9786368,
759 #                "wr_operations":692,
760 #                "rd_bytes":122739200,
761 #                "rd_operations":36604
762 #                "flush_operations":51,
763 #                "wr_total_times_ns":313253456
764 #                "rd_total_times_ns":3465673657
765 #                "flush_total_times_ns":49653,
766 #                "rd_merged":0,
767 #                "wr_merged":0,
768 #                "idle_time_ns":2953431879,
769 #                "account_invalid":true,
770 #                "account_failed":false
771 #             }
772 #          },
773 #          {
774 #             "device":"ide1-cd0",
775 #             "stats":{
776 #                "wr_highest_offset":0,
777 #                "wr_bytes":0,
778 #                "wr_operations":0,
779 #                "rd_bytes":0,
780 #                "rd_operations":0
781 #                "flush_operations":0,
782 #                "wr_total_times_ns":0
783 #                "rd_total_times_ns":0
784 #                "flush_total_times_ns":0,
785 #                "rd_merged":0,
786 #                "wr_merged":0,
787 #                "account_invalid":false,
788 #                "account_failed":false
789 #             }
790 #          },
791 #          {
792 #             "device":"floppy0",
793 #             "stats":{
794 #                "wr_highest_offset":0,
795 #                "wr_bytes":0,
796 #                "wr_operations":0,
797 #                "rd_bytes":0,
798 #                "rd_operations":0
799 #                "flush_operations":0,
800 #                "wr_total_times_ns":0
801 #                "rd_total_times_ns":0
802 #                "flush_total_times_ns":0,
803 #                "rd_merged":0,
804 #                "wr_merged":0,
805 #                "account_invalid":false,
806 #                "account_failed":false
807 #             }
808 #          },
809 #          {
810 #             "device":"sd0",
811 #             "stats":{
812 #                "wr_highest_offset":0,
813 #                "wr_bytes":0,
814 #                "wr_operations":0,
815 #                "rd_bytes":0,
816 #                "rd_operations":0
817 #                "flush_operations":0,
818 #                "wr_total_times_ns":0
819 #                "rd_total_times_ns":0
820 #                "flush_total_times_ns":0,
821 #                "rd_merged":0,
822 #                "wr_merged":0,
823 #                "account_invalid":false,
824 #                "account_failed":false
825 #             }
826 #          }
827 #       ]
828 #    }
831 { 'command': 'query-blockstats',
832   'data': { '*query-nodes': 'bool' },
833   'returns': ['BlockStats'] }
836 # @BlockdevOnError:
838 # An enumeration of possible behaviors for errors on I/O operations.
839 # The exact meaning depends on whether the I/O was initiated by a guest
840 # or by a block job
842 # @report: for guest operations, report the error to the guest;
843 #          for jobs, cancel the job
845 # @ignore: ignore the error, only report a QMP event (BLOCK_IO_ERROR
846 #          or BLOCK_JOB_ERROR)
848 # @enospc: same as @stop on ENOSPC, same as @report otherwise.
850 # @stop: for guest operations, stop the virtual machine;
851 #        for jobs, pause the job
853 # @auto: inherit the error handling policy of the backend (since: 2.7)
855 # Since: 1.3
857 { 'enum': 'BlockdevOnError',
858   'data': ['report', 'ignore', 'enospc', 'stop', 'auto'] }
861 # @MirrorSyncMode:
863 # An enumeration of possible behaviors for the initial synchronization
864 # phase of storage mirroring.
866 # @top: copies data in the topmost image to the destination
868 # @full: copies data from all images to the destination
870 # @none: only copy data written from now on
872 # @incremental: only copy data described by the dirty bitmap. Since: 2.4
874 # Since: 1.3
876 { 'enum': 'MirrorSyncMode',
877   'data': ['top', 'full', 'none', 'incremental'] }
880 # @BlockJobType:
882 # Type of a block job.
884 # @commit: block commit job type, see "block-commit"
886 # @stream: block stream job type, see "block-stream"
888 # @mirror: drive mirror job type, see "drive-mirror"
890 # @backup: drive backup job type, see "drive-backup"
892 # Since: 1.7
894 { 'enum': 'BlockJobType',
895   'data': ['commit', 'stream', 'mirror', 'backup'] }
898 # @BlockJobInfo:
900 # Information about a long-running block device operation.
902 # @type: the job type ('stream' for image streaming)
904 # @device: The job identifier. Originally the device name but other
905 #          values are allowed since QEMU 2.7
907 # @len: the maximum progress value
909 # @busy: false if the job is known to be in a quiescent state, with
910 #        no pending I/O.  Since 1.3.
912 # @paused: whether the job is paused or, if @busy is true, will
913 #          pause itself as soon as possible.  Since 1.3.
915 # @offset: the current progress value
917 # @speed: the rate limit, bytes per second
919 # @io-status: the status of the job (since 1.3)
921 # @ready: true if the job may be completed (since 2.2)
923 # Since: 1.1
925 { 'struct': 'BlockJobInfo',
926   'data': {'type': 'str', 'device': 'str', 'len': 'int',
927            'offset': 'int', 'busy': 'bool', 'paused': 'bool', 'speed': 'int',
928            'io-status': 'BlockDeviceIoStatus', 'ready': 'bool'} }
931 # @query-block-jobs:
933 # Return information about long-running block device operations.
935 # Returns: a list of @BlockJobInfo for each active block job
937 # Since: 1.1
939 { 'command': 'query-block-jobs', 'returns': ['BlockJobInfo'] }
942 # @block_passwd:
944 # This command sets the password of a block device that has not been open
945 # with a password and requires one.
947 # The two cases where this can happen are a block device is created through
948 # QEMU's initial command line or a block device is changed through the legacy
949 # @change interface.
951 # In the event that the block device is created through the initial command
952 # line, the VM will start in the stopped state regardless of whether '-S' is
953 # used.  The intention is for a management tool to query the block devices to
954 # determine which ones are encrypted, set the passwords with this command, and
955 # then start the guest with the @cont command.
957 # Either @device or @node-name must be set but not both.
959 # @device: #optional the name of the block backend device to set the password on
961 # @node-name: #optional graph node name to set the password on (Since 2.0)
963 # @password: the password to use for the device
965 # Returns: nothing on success
966 #          If @device is not a valid block device, DeviceNotFound
967 #          If @device is not encrypted, DeviceNotEncrypted
969 # Notes:  Not all block formats support encryption and some that do are not
970 #         able to validate that a password is correct.  Disk corruption may
971 #         occur if an invalid password is specified.
973 # Since: 0.14.0
975 # Example:
977 # -> { "execute": "block_passwd", "arguments": { "device": "ide0-hd0",
978 #                                                "password": "12345" } }
979 # <- { "return": {} }
982 { 'command': 'block_passwd', 'data': {'*device': 'str',
983                                       '*node-name': 'str', 'password': 'str'} }
986 # @block_resize:
988 # Resize a block image while a guest is running.
990 # Either @device or @node-name must be set but not both.
992 # @device: #optional the name of the device to get the image resized
994 # @node-name: #optional graph node name to get the image resized (Since 2.0)
996 # @size:  new image size in bytes
998 # Returns: nothing on success
999 #          If @device is not a valid block device, DeviceNotFound
1001 # Since: 0.14.0
1003 # Example:
1005 # -> { "execute": "block_resize",
1006 #      "arguments": { "device": "scratch", "size": 1073741824 } }
1007 # <- { "return": {} }
1010 { 'command': 'block_resize', 'data': { '*device': 'str',
1011                                        '*node-name': 'str',
1012                                        'size': 'int' }}
1015 # @NewImageMode:
1017 # An enumeration that tells QEMU how to set the backing file path in
1018 # a new image file.
1020 # @existing: QEMU should look for an existing image file.
1022 # @absolute-paths: QEMU should create a new image with absolute paths
1023 # for the backing file. If there is no backing file available, the new
1024 # image will not be backed either.
1026 # Since: 1.1
1028 { 'enum': 'NewImageMode',
1029   'data': [ 'existing', 'absolute-paths' ] }
1032 # @BlockdevSnapshotSync:
1034 # Either @device or @node-name must be set but not both.
1036 # @device: #optional the name of the device to generate the snapshot from.
1038 # @node-name: #optional graph node name to generate the snapshot from (Since 2.0)
1040 # @snapshot-file: the target of the new image. If the file exists, or
1041 # if it is a device, the snapshot will be created in the existing
1042 # file/device. Otherwise, a new file will be created.
1044 # @snapshot-node-name: #optional the graph node name of the new image (Since 2.0)
1046 # @format: #optional the format of the snapshot image, default is 'qcow2'.
1048 # @mode: #optional whether and how QEMU should create a new image, default is
1049 #        'absolute-paths'.
1051 { 'struct': 'BlockdevSnapshotSync',
1052   'data': { '*device': 'str', '*node-name': 'str',
1053             'snapshot-file': 'str', '*snapshot-node-name': 'str',
1054             '*format': 'str', '*mode': 'NewImageMode' } }
1057 # @BlockdevSnapshot:
1059 # @node: device or node name that will have a snapshot created.
1061 # @overlay: reference to the existing block device that will become
1062 #           the overlay of @node, as part of creating the snapshot.
1063 #           It must not have a current backing file (this can be
1064 #           achieved by passing "backing": "" to blockdev-add).
1066 # Since: 2.5
1068 { 'struct': 'BlockdevSnapshot',
1069   'data': { 'node': 'str', 'overlay': 'str' } }
1072 # @DriveBackup:
1074 # @job-id: #optional identifier for the newly-created block job. If
1075 #          omitted, the device name will be used. (Since 2.7)
1077 # @device: the device name or node-name of a root node which should be copied.
1079 # @target: the target of the new image. If the file exists, or if it
1080 #          is a device, the existing file/device will be used as the new
1081 #          destination.  If it does not exist, a new file will be created.
1083 # @format: #optional the format of the new destination, default is to
1084 #          probe if @mode is 'existing', else the format of the source
1086 # @sync: what parts of the disk image should be copied to the destination
1087 #        (all the disk, only the sectors allocated in the topmost image, from a
1088 #        dirty bitmap, or only new I/O).
1090 # @mode: #optional whether and how QEMU should create a new image, default is
1091 #        'absolute-paths'.
1093 # @speed: #optional the maximum speed, in bytes per second
1095 # @bitmap: #optional the name of dirty bitmap if sync is "incremental".
1096 #          Must be present if sync is "incremental", must NOT be present
1097 #          otherwise. (Since 2.4)
1099 # @compress: #optional true to compress data, if the target format supports it.
1100 #            (default: false) (since 2.8)
1102 # @on-source-error: #optional the action to take on an error on the source,
1103 #                   default 'report'.  'stop' and 'enospc' can only be used
1104 #                   if the block device supports io-status (see BlockInfo).
1106 # @on-target-error: #optional the action to take on an error on the target,
1107 #                   default 'report' (no limitations, since this applies to
1108 #                   a different block device than @device).
1110 # Note: @on-source-error and @on-target-error only affect background
1111 # I/O.  If an error occurs during a guest write request, the device's
1112 # rerror/werror actions will be used.
1114 # Since: 1.6
1116 { 'struct': 'DriveBackup',
1117   'data': { '*job-id': 'str', 'device': 'str', 'target': 'str',
1118             '*format': 'str', 'sync': 'MirrorSyncMode', '*mode': 'NewImageMode',
1119             '*speed': 'int', '*bitmap': 'str', '*compress': 'bool',
1120             '*on-source-error': 'BlockdevOnError',
1121             '*on-target-error': 'BlockdevOnError' } }
1124 # @BlockdevBackup:
1126 # @job-id: #optional identifier for the newly-created block job. If
1127 #          omitted, the device name will be used. (Since 2.7)
1129 # @device: the device name or node-name of a root node which should be copied.
1131 # @target: the device name or node-name of the backup target node.
1133 # @sync: what parts of the disk image should be copied to the destination
1134 #        (all the disk, only the sectors allocated in the topmost image, or
1135 #        only new I/O).
1137 # @speed: #optional the maximum speed, in bytes per second. The default is 0,
1138 #         for unlimited.
1140 # @compress: #optional true to compress data, if the target format supports it.
1141 #            (default: false) (since 2.8)
1143 # @on-source-error: #optional the action to take on an error on the source,
1144 #                   default 'report'.  'stop' and 'enospc' can only be used
1145 #                   if the block device supports io-status (see BlockInfo).
1147 # @on-target-error: #optional the action to take on an error on the target,
1148 #                   default 'report' (no limitations, since this applies to
1149 #                   a different block device than @device).
1151 # Note: @on-source-error and @on-target-error only affect background
1152 # I/O.  If an error occurs during a guest write request, the device's
1153 # rerror/werror actions will be used.
1155 # Since: 2.3
1157 { 'struct': 'BlockdevBackup',
1158   'data': { '*job-id': 'str', 'device': 'str', 'target': 'str',
1159             'sync': 'MirrorSyncMode',
1160             '*speed': 'int',
1161             '*compress': 'bool',
1162             '*on-source-error': 'BlockdevOnError',
1163             '*on-target-error': 'BlockdevOnError' } }
1166 # @blockdev-snapshot-sync:
1168 # Generates a synchronous snapshot of a block device.
1170 # For the arguments, see the documentation of BlockdevSnapshotSync.
1172 # Returns: nothing on success
1173 #          If @device is not a valid block device, DeviceNotFound
1175 # Since: 0.14.0
1177 # Example:
1179 # -> { "execute": "blockdev-snapshot-sync",
1180 #      "arguments": { "device": "ide-hd0",
1181 #                     "snapshot-file":
1182 #                     "/some/place/my-image",
1183 #                     "format": "qcow2" } }
1184 # <- { "return": {} }
1187 { 'command': 'blockdev-snapshot-sync',
1188   'data': 'BlockdevSnapshotSync' }
1192 # @blockdev-snapshot:
1194 # Generates a snapshot of a block device.
1196 # Create a snapshot, by installing 'node' as the backing image of
1197 # 'overlay'. Additionally, if 'node' is associated with a block
1198 # device, the block device changes to using 'overlay' as its new active
1199 # image.
1201 # For the arguments, see the documentation of BlockdevSnapshot.
1203 # Since: 2.5
1205 # Example:
1207 # -> { "execute": "blockdev-add",
1208 #      "arguments": { "options": { "driver": "qcow2",
1209 #                                  "node-name": "node1534",
1210 #                                  "file": { "driver": "file",
1211 #                                            "filename": "hd1.qcow2" },
1212 #                                  "backing": "" } } }
1214 # <- { "return": {} }
1216 # -> { "execute": "blockdev-snapshot",
1217 #      "arguments": { "node": "ide-hd0",
1218 #                     "overlay": "node1534" } }
1219 # <- { "return": {} }
1222 { 'command': 'blockdev-snapshot',
1223   'data': 'BlockdevSnapshot' }
1226 # @change-backing-file:
1228 # Change the backing file in the image file metadata.  This does not
1229 # cause QEMU to reopen the image file to reparse the backing filename
1230 # (it may, however, perform a reopen to change permissions from
1231 # r/o -> r/w -> r/o, if needed). The new backing file string is written
1232 # into the image file metadata, and the QEMU internal strings are
1233 # updated.
1235 # @image-node-name: The name of the block driver state node of the
1236 #                   image to modify. The "device" argument is used
1237 #                   to verify "image-node-name" is in the chain
1238 #                   described by "device".
1240 # @device:          The device name or node-name of the root node that owns
1241 #                   image-node-name.
1243 # @backing-file:    The string to write as the backing file.  This
1244 #                   string is not validated, so care should be taken
1245 #                   when specifying the string or the image chain may
1246 #                   not be able to be reopened again.
1248 # Returns: Nothing on success
1250 #          If "device" does not exist or cannot be determined, DeviceNotFound
1252 # Since: 2.1
1254 { 'command': 'change-backing-file',
1255   'data': { 'device': 'str', 'image-node-name': 'str',
1256             'backing-file': 'str' } }
1259 # @block-commit:
1261 # Live commit of data from overlay image nodes into backing nodes - i.e.,
1262 # writes data between 'top' and 'base' into 'base'.
1264 # @job-id: #optional identifier for the newly-created block job. If
1265 #          omitted, the device name will be used. (Since 2.7)
1267 # @device:  the device name or node-name of a root node
1269 # @base:   #optional The file name of the backing image to write data into.
1270 #                    If not specified, this is the deepest backing image.
1272 # @top:    #optional The file name of the backing image within the image chain,
1273 #                    which contains the topmost data to be committed down. If
1274 #                    not specified, this is the active layer.
1276 # @backing-file:  #optional The backing file string to write into the overlay
1277 #                           image of 'top'.  If 'top' is the active layer,
1278 #                           specifying a backing file string is an error. This
1279 #                           filename is not validated.
1281 #                           If a pathname string is such that it cannot be
1282 #                           resolved by QEMU, that means that subsequent QMP or
1283 #                           HMP commands must use node-names for the image in
1284 #                           question, as filename lookup methods will fail.
1286 #                           If not specified, QEMU will automatically determine
1287 #                           the backing file string to use, or error out if
1288 #                           there is no obvious choice. Care should be taken
1289 #                           when specifying the string, to specify a valid
1290 #                           filename or protocol.
1291 #                           (Since 2.1)
1293 #                    If top == base, that is an error.
1294 #                    If top == active, the job will not be completed by itself,
1295 #                    user needs to complete the job with the block-job-complete
1296 #                    command after getting the ready event. (Since 2.0)
1298 #                    If the base image is smaller than top, then the base image
1299 #                    will be resized to be the same size as top.  If top is
1300 #                    smaller than the base image, the base will not be
1301 #                    truncated.  If you want the base image size to match the
1302 #                    size of the smaller top, you can safely truncate it
1303 #                    yourself once the commit operation successfully completes.
1305 # @speed:  #optional the maximum speed, in bytes per second
1307 # @filter-node-name: #optional the node name that should be assigned to the
1308 #                    filter driver that the commit job inserts into the graph
1309 #                    above @top. If this option is not given, a node name is
1310 #                    autogenerated. (Since: 2.9)
1312 # Returns: Nothing on success
1313 #          If commit or stream is already active on this device, DeviceInUse
1314 #          If @device does not exist, DeviceNotFound
1315 #          If image commit is not supported by this device, NotSupported
1316 #          If @base or @top is invalid, a generic error is returned
1317 #          If @speed is invalid, InvalidParameter
1319 # Since: 1.3
1321 # Example:
1323 # -> { "execute": "block-commit",
1324 #      "arguments": { "device": "virtio0",
1325 #                     "top": "/tmp/snap1.qcow2" } }
1326 # <- { "return": {} }
1329 { 'command': 'block-commit',
1330   'data': { '*job-id': 'str', 'device': 'str', '*base': 'str', '*top': 'str',
1331             '*backing-file': 'str', '*speed': 'int',
1332             '*filter-node-name': 'str' } }
1335 # @drive-backup:
1337 # Start a point-in-time copy of a block device to a new destination.  The
1338 # status of ongoing drive-backup operations can be checked with
1339 # query-block-jobs where the BlockJobInfo.type field has the value 'backup'.
1340 # The operation can be stopped before it has completed using the
1341 # block-job-cancel command.
1343 # For the arguments, see the documentation of DriveBackup.
1345 # Returns: nothing on success
1346 #          If @device is not a valid block device, GenericError
1348 # Since: 1.6
1350 # Example:
1352 # -> { "execute": "drive-backup",
1353 #      "arguments": { "device": "drive0",
1354 #                     "sync": "full",
1355 #                     "target": "backup.img" } }
1356 # <- { "return": {} }
1359 { 'command': 'drive-backup', 'boxed': true,
1360   'data': 'DriveBackup' }
1363 # @blockdev-backup:
1365 # Start a point-in-time copy of a block device to a new destination.  The
1366 # status of ongoing blockdev-backup operations can be checked with
1367 # query-block-jobs where the BlockJobInfo.type field has the value 'backup'.
1368 # The operation can be stopped before it has completed using the
1369 # block-job-cancel command.
1371 # For the arguments, see the documentation of BlockdevBackup.
1373 # Returns: nothing on success
1374 #          If @device is not a valid block device, DeviceNotFound
1376 # Since: 2.3
1378 # Example:
1379 # -> { "execute": "blockdev-backup",
1380 #      "arguments": { "device": "src-id",
1381 #                     "sync": "full",
1382 #                     "target": "tgt-id" } }
1383 # <- { "return": {} }
1386 { 'command': 'blockdev-backup', 'boxed': true,
1387   'data': 'BlockdevBackup' }
1391 # @query-named-block-nodes:
1393 # Get the named block driver list
1395 # Returns: the list of BlockDeviceInfo
1397 # Since: 2.0
1399 # Example:
1401 # -> { "execute": "query-named-block-nodes" }
1402 # <- { "return": [ { "ro":false,
1403 #                    "drv":"qcow2",
1404 #                    "encrypted":false,
1405 #                    "file":"disks/test.qcow2",
1406 #                    "node-name": "my-node",
1407 #                    "backing_file_depth":1,
1408 #                    "bps":1000000,
1409 #                    "bps_rd":0,
1410 #                    "bps_wr":0,
1411 #                    "iops":1000000,
1412 #                    "iops_rd":0,
1413 #                    "iops_wr":0,
1414 #                    "bps_max": 8000000,
1415 #                    "bps_rd_max": 0,
1416 #                    "bps_wr_max": 0,
1417 #                    "iops_max": 0,
1418 #                    "iops_rd_max": 0,
1419 #                    "iops_wr_max": 0,
1420 #                    "iops_size": 0,
1421 #                    "write_threshold": 0,
1422 #                    "image":{
1423 #                       "filename":"disks/test.qcow2",
1424 #                       "format":"qcow2",
1425 #                       "virtual-size":2048000,
1426 #                       "backing_file":"base.qcow2",
1427 #                       "full-backing-filename":"disks/base.qcow2",
1428 #                       "backing-filename-format":"qcow2",
1429 #                       "snapshots":[
1430 #                          {
1431 #                             "id": "1",
1432 #                             "name": "snapshot1",
1433 #                             "vm-state-size": 0,
1434 #                             "date-sec": 10000200,
1435 #                             "date-nsec": 12,
1436 #                             "vm-clock-sec": 206,
1437 #                             "vm-clock-nsec": 30
1438 #                          }
1439 #                       ],
1440 #                       "backing-image":{
1441 #                           "filename":"disks/base.qcow2",
1442 #                           "format":"qcow2",
1443 #                           "virtual-size":2048000
1444 #                       }
1445 #                    } } ] }
1448 { 'command': 'query-named-block-nodes', 'returns': [ 'BlockDeviceInfo' ] }
1451 # @drive-mirror:
1453 # Start mirroring a block device's writes to a new destination. target
1454 # specifies the target of the new image. If the file exists, or if it
1455 # is a device, it will be used as the new destination for writes. If
1456 # it does not exist, a new file will be created. format specifies the
1457 # format of the mirror image, default is to probe if mode='existing',
1458 # else the format of the source.
1460 # See DriveMirror for parameter descriptions
1462 # Returns: nothing on success
1463 #          If @device is not a valid block device, GenericError
1465 # Since: 1.3
1467 # Example:
1469 # -> { "execute": "drive-mirror",
1470 #      "arguments": { "device": "ide-hd0",
1471 #                     "target": "/some/place/my-image",
1472 #                     "sync": "full",
1473 #                     "format": "qcow2" } }
1474 # <- { "return": {} }
1477 { 'command': 'drive-mirror', 'boxed': true,
1478   'data': 'DriveMirror' }
1481 # @DriveMirror:
1483 # A set of parameters describing drive mirror setup.
1485 # @job-id: #optional identifier for the newly-created block job. If
1486 #          omitted, the device name will be used. (Since 2.7)
1488 # @device:  the device name or node-name of a root node whose writes should be
1489 #           mirrored.
1491 # @target: the target of the new image. If the file exists, or if it
1492 #          is a device, the existing file/device will be used as the new
1493 #          destination.  If it does not exist, a new file will be created.
1495 # @format: #optional the format of the new destination, default is to
1496 #          probe if @mode is 'existing', else the format of the source
1498 # @node-name: #optional the new block driver state node name in the graph
1499 #             (Since 2.1)
1501 # @replaces: #optional with sync=full graph node name to be replaced by the new
1502 #            image when a whole image copy is done. This can be used to repair
1503 #            broken Quorum files. (Since 2.1)
1505 # @mode: #optional whether and how QEMU should create a new image, default is
1506 #        'absolute-paths'.
1508 # @speed:  #optional the maximum speed, in bytes per second
1510 # @sync: what parts of the disk image should be copied to the destination
1511 #        (all the disk, only the sectors allocated in the topmost image, or
1512 #        only new I/O).
1514 # @granularity: #optional granularity of the dirty bitmap, default is 64K
1515 #               if the image format doesn't have clusters, 4K if the clusters
1516 #               are smaller than that, else the cluster size.  Must be a
1517 #               power of 2 between 512 and 64M (since 1.4).
1519 # @buf-size: #optional maximum amount of data in flight from source to
1520 #            target (since 1.4).
1522 # @on-source-error: #optional the action to take on an error on the source,
1523 #                   default 'report'.  'stop' and 'enospc' can only be used
1524 #                   if the block device supports io-status (see BlockInfo).
1526 # @on-target-error: #optional the action to take on an error on the target,
1527 #                   default 'report' (no limitations, since this applies to
1528 #                   a different block device than @device).
1529 # @unmap: #optional Whether to try to unmap target sectors where source has
1530 #         only zero. If true, and target unallocated sectors will read as zero,
1531 #         target image sectors will be unmapped; otherwise, zeroes will be
1532 #         written. Both will result in identical contents.
1533 #         Default is true. (Since 2.4)
1535 # Since: 1.3
1537 { 'struct': 'DriveMirror',
1538   'data': { '*job-id': 'str', 'device': 'str', 'target': 'str',
1539             '*format': 'str', '*node-name': 'str', '*replaces': 'str',
1540             'sync': 'MirrorSyncMode', '*mode': 'NewImageMode',
1541             '*speed': 'int', '*granularity': 'uint32',
1542             '*buf-size': 'int', '*on-source-error': 'BlockdevOnError',
1543             '*on-target-error': 'BlockdevOnError',
1544             '*unmap': 'bool' } }
1547 # @BlockDirtyBitmap:
1549 # @node: name of device/node which the bitmap is tracking
1551 # @name: name of the dirty bitmap
1553 # Since: 2.4
1555 { 'struct': 'BlockDirtyBitmap',
1556   'data': { 'node': 'str', 'name': 'str' } }
1559 # @BlockDirtyBitmapAdd:
1561 # @node: name of device/node which the bitmap is tracking
1563 # @name: name of the dirty bitmap
1565 # @granularity: #optional the bitmap granularity, default is 64k for
1566 #               block-dirty-bitmap-add
1568 # Since: 2.4
1570 { 'struct': 'BlockDirtyBitmapAdd',
1571   'data': { 'node': 'str', 'name': 'str', '*granularity': 'uint32' } }
1574 # @block-dirty-bitmap-add:
1576 # Create a dirty bitmap with a name on the node, and start tracking the writes.
1578 # Returns: nothing on success
1579 #          If @node is not a valid block device or node, DeviceNotFound
1580 #          If @name is already taken, GenericError with an explanation
1582 # Since: 2.4
1584 # Example:
1586 # -> { "execute": "block-dirty-bitmap-add",
1587 #      "arguments": { "node": "drive0", "name": "bitmap0" } }
1588 # <- { "return": {} }
1591 { 'command': 'block-dirty-bitmap-add',
1592   'data': 'BlockDirtyBitmapAdd' }
1595 # @block-dirty-bitmap-remove:
1597 # Stop write tracking and remove the dirty bitmap that was created
1598 # with block-dirty-bitmap-add.
1600 # Returns: nothing on success
1601 #          If @node is not a valid block device or node, DeviceNotFound
1602 #          If @name is not found, GenericError with an explanation
1603 #          if @name is frozen by an operation, GenericError
1605 # Since: 2.4
1607 # Example:
1609 # -> { "execute": "block-dirty-bitmap-remove",
1610 #      "arguments": { "node": "drive0", "name": "bitmap0" } }
1611 # <- { "return": {} }
1614 { 'command': 'block-dirty-bitmap-remove',
1615   'data': 'BlockDirtyBitmap' }
1618 # @block-dirty-bitmap-clear:
1620 # Clear (reset) a dirty bitmap on the device, so that an incremental
1621 # backup from this point in time forward will only backup clusters
1622 # modified after this clear operation.
1624 # Returns: nothing on success
1625 #          If @node is not a valid block device, DeviceNotFound
1626 #          If @name is not found, GenericError with an explanation
1628 # Since: 2.4
1630 # Example:
1632 # -> { "execute": "block-dirty-bitmap-clear",
1633 #      "arguments": { "node": "drive0", "name": "bitmap0" } }
1634 # <- { "return": {} }
1637 { 'command': 'block-dirty-bitmap-clear',
1638   'data': 'BlockDirtyBitmap' }
1641 # @blockdev-mirror:
1643 # Start mirroring a block device's writes to a new destination.
1645 # @job-id: #optional identifier for the newly-created block job. If
1646 #          omitted, the device name will be used. (Since 2.7)
1648 # @device: The device name or node-name of a root node whose writes should be
1649 #          mirrored.
1651 # @target: the id or node-name of the block device to mirror to. This mustn't be
1652 #          attached to guest.
1654 # @replaces: #optional with sync=full graph node name to be replaced by the new
1655 #            image when a whole image copy is done. This can be used to repair
1656 #            broken Quorum files.
1658 # @speed:  #optional the maximum speed, in bytes per second
1660 # @sync: what parts of the disk image should be copied to the destination
1661 #        (all the disk, only the sectors allocated in the topmost image, or
1662 #        only new I/O).
1664 # @granularity: #optional granularity of the dirty bitmap, default is 64K
1665 #               if the image format doesn't have clusters, 4K if the clusters
1666 #               are smaller than that, else the cluster size.  Must be a
1667 #               power of 2 between 512 and 64M
1669 # @buf-size: #optional maximum amount of data in flight from source to
1670 #            target
1672 # @on-source-error: #optional the action to take on an error on the source,
1673 #                   default 'report'.  'stop' and 'enospc' can only be used
1674 #                   if the block device supports io-status (see BlockInfo).
1676 # @on-target-error: #optional the action to take on an error on the target,
1677 #                   default 'report' (no limitations, since this applies to
1678 #                   a different block device than @device).
1680 # @filter-node-name: #optional the node name that should be assigned to the
1681 #                    filter driver that the mirror job inserts into the graph
1682 #                    above @device. If this option is not given, a node name is
1683 #                    autogenerated. (Since: 2.9)
1685 # Returns: nothing on success.
1687 # Since: 2.6
1689 # Example:
1691 # -> { "execute": "blockdev-mirror",
1692 #      "arguments": { "device": "ide-hd0",
1693 #                     "target": "target0",
1694 #                     "sync": "full" } }
1695 # <- { "return": {} }
1698 { 'command': 'blockdev-mirror',
1699   'data': { '*job-id': 'str', 'device': 'str', 'target': 'str',
1700             '*replaces': 'str',
1701             'sync': 'MirrorSyncMode',
1702             '*speed': 'int', '*granularity': 'uint32',
1703             '*buf-size': 'int', '*on-source-error': 'BlockdevOnError',
1704             '*on-target-error': 'BlockdevOnError',
1705             '*filter-node-name': 'str' } }
1708 # @block_set_io_throttle:
1710 # Change I/O throttle limits for a block drive.
1712 # Since QEMU 2.4, each device with I/O limits is member of a throttle
1713 # group.
1715 # If two or more devices are members of the same group, the limits
1716 # will apply to the combined I/O of the whole group in a round-robin
1717 # fashion. Therefore, setting new I/O limits to a device will affect
1718 # the whole group.
1720 # The name of the group can be specified using the 'group' parameter.
1721 # If the parameter is unset, it is assumed to be the current group of
1722 # that device. If it's not in any group yet, the name of the device
1723 # will be used as the name for its group.
1725 # The 'group' parameter can also be used to move a device to a
1726 # different group. In this case the limits specified in the parameters
1727 # will be applied to the new group only.
1729 # I/O limits can be disabled by setting all of them to 0. In this case
1730 # the device will be removed from its group and the rest of its
1731 # members will not be affected. The 'group' parameter is ignored.
1733 # See BlockIOThrottle for parameter descriptions.
1735 # Returns: Nothing on success
1736 #          If @device is not a valid block device, DeviceNotFound
1738 # Since: 1.1
1740 # Example:
1742 # -> { "execute": "block_set_io_throttle",
1743 #      "arguments": { "id": "ide0-1-0",
1744 #                     "bps": 1000000,
1745 #                     "bps_rd": 0,
1746 #                     "bps_wr": 0,
1747 #                     "iops": 0,
1748 #                     "iops_rd": 0,
1749 #                     "iops_wr": 0,
1750 #                     "bps_max": 8000000,
1751 #                     "bps_rd_max": 0,
1752 #                     "bps_wr_max": 0,
1753 #                     "iops_max": 0,
1754 #                     "iops_rd_max": 0,
1755 #                     "iops_wr_max": 0,
1756 #                     "bps_max_length": 60,
1757 #                     "iops_size": 0 } }
1758 # <- { "return": {} }
1760 { 'command': 'block_set_io_throttle', 'boxed': true,
1761   'data': 'BlockIOThrottle' }
1764 # @BlockIOThrottle:
1766 # A set of parameters describing block throttling.
1768 # @device: #optional Block device name (deprecated, use @id instead)
1770 # @id: #optional The name or QOM path of the guest device (since: 2.8)
1772 # @bps: total throughput limit in bytes per second
1774 # @bps_rd: read throughput limit in bytes per second
1776 # @bps_wr: write throughput limit in bytes per second
1778 # @iops: total I/O operations per second
1780 # @iops_rd: read I/O operations per second
1782 # @iops_wr: write I/O operations per second
1784 # @bps_max: #optional total throughput limit during bursts,
1785 #                     in bytes (Since 1.7)
1787 # @bps_rd_max: #optional read throughput limit during bursts,
1788 #                        in bytes (Since 1.7)
1790 # @bps_wr_max: #optional write throughput limit during bursts,
1791 #                        in bytes (Since 1.7)
1793 # @iops_max: #optional total I/O operations per second during bursts,
1794 #                      in bytes (Since 1.7)
1796 # @iops_rd_max: #optional read I/O operations per second during bursts,
1797 #                         in bytes (Since 1.7)
1799 # @iops_wr_max: #optional write I/O operations per second during bursts,
1800 #                         in bytes (Since 1.7)
1802 # @bps_max_length: #optional maximum length of the @bps_max burst
1803 #                            period, in seconds. It must only
1804 #                            be set if @bps_max is set as well.
1805 #                            Defaults to 1. (Since 2.6)
1807 # @bps_rd_max_length: #optional maximum length of the @bps_rd_max
1808 #                               burst period, in seconds. It must only
1809 #                               be set if @bps_rd_max is set as well.
1810 #                               Defaults to 1. (Since 2.6)
1812 # @bps_wr_max_length: #optional maximum length of the @bps_wr_max
1813 #                               burst period, in seconds. It must only
1814 #                               be set if @bps_wr_max is set as well.
1815 #                               Defaults to 1. (Since 2.6)
1817 # @iops_max_length: #optional maximum length of the @iops burst
1818 #                             period, in seconds. It must only
1819 #                             be set if @iops_max is set as well.
1820 #                             Defaults to 1. (Since 2.6)
1822 # @iops_rd_max_length: #optional maximum length of the @iops_rd_max
1823 #                                burst period, in seconds. It must only
1824 #                                be set if @iops_rd_max is set as well.
1825 #                                Defaults to 1. (Since 2.6)
1827 # @iops_wr_max_length: #optional maximum length of the @iops_wr_max
1828 #                                burst period, in seconds. It must only
1829 #                                be set if @iops_wr_max is set as well.
1830 #                                Defaults to 1. (Since 2.6)
1832 # @iops_size: #optional an I/O size in bytes (Since 1.7)
1834 # @group: #optional throttle group name (Since 2.4)
1836 # Since: 1.1
1838 { 'struct': 'BlockIOThrottle',
1839   'data': { '*device': 'str', '*id': 'str', 'bps': 'int', 'bps_rd': 'int',
1840             'bps_wr': 'int', 'iops': 'int', 'iops_rd': 'int', 'iops_wr': 'int',
1841             '*bps_max': 'int', '*bps_rd_max': 'int',
1842             '*bps_wr_max': 'int', '*iops_max': 'int',
1843             '*iops_rd_max': 'int', '*iops_wr_max': 'int',
1844             '*bps_max_length': 'int', '*bps_rd_max_length': 'int',
1845             '*bps_wr_max_length': 'int', '*iops_max_length': 'int',
1846             '*iops_rd_max_length': 'int', '*iops_wr_max_length': 'int',
1847             '*iops_size': 'int', '*group': 'str' } }
1850 # @block-stream:
1852 # Copy data from a backing file into a block device.
1854 # The block streaming operation is performed in the background until the entire
1855 # backing file has been copied.  This command returns immediately once streaming
1856 # has started.  The status of ongoing block streaming operations can be checked
1857 # with query-block-jobs.  The operation can be stopped before it has completed
1858 # using the block-job-cancel command.
1860 # The node that receives the data is called the top image, can be located in
1861 # any part of the chain (but always above the base image; see below) and can be
1862 # specified using its device or node name. Earlier qemu versions only allowed
1863 # 'device' to name the top level node; presence of the 'base-node' parameter
1864 # during introspection can be used as a witness of the enhanced semantics
1865 # of 'device'.
1867 # If a base file is specified then sectors are not copied from that base file and
1868 # its backing chain.  When streaming completes the image file will have the base
1869 # file as its backing file.  This can be used to stream a subset of the backing
1870 # file chain instead of flattening the entire image.
1872 # On successful completion the image file is updated to drop the backing file
1873 # and the BLOCK_JOB_COMPLETED event is emitted.
1875 # @job-id: #optional identifier for the newly-created block job. If
1876 #          omitted, the device name will be used. (Since 2.7)
1878 # @device: the device or node name of the top image
1880 # @base:   #optional the common backing file name.
1881 #                    It cannot be set if @base-node is also set.
1883 # @base-node: #optional the node name of the backing file.
1884 #                       It cannot be set if @base is also set. (Since 2.8)
1886 # @backing-file: #optional The backing file string to write into the top
1887 #                          image. This filename is not validated.
1889 #                          If a pathname string is such that it cannot be
1890 #                          resolved by QEMU, that means that subsequent QMP or
1891 #                          HMP commands must use node-names for the image in
1892 #                          question, as filename lookup methods will fail.
1894 #                          If not specified, QEMU will automatically determine
1895 #                          the backing file string to use, or error out if there
1896 #                          is no obvious choice.  Care should be taken when
1897 #                          specifying the string, to specify a valid filename or
1898 #                          protocol.
1899 #                          (Since 2.1)
1901 # @speed:  #optional the maximum speed, in bytes per second
1903 # @on-error: #optional the action to take on an error (default report).
1904 #            'stop' and 'enospc' can only be used if the block device
1905 #            supports io-status (see BlockInfo).  Since 1.3.
1907 # Returns: Nothing on success. If @device does not exist, DeviceNotFound.
1909 # Since: 1.1
1911 # Example:
1913 # -> { "execute": "block-stream",
1914 #      "arguments": { "device": "virtio0",
1915 #                     "base": "/tmp/master.qcow2" } }
1916 # <- { "return": {} }
1919 { 'command': 'block-stream',
1920   'data': { '*job-id': 'str', 'device': 'str', '*base': 'str',
1921             '*base-node': 'str', '*backing-file': 'str', '*speed': 'int',
1922             '*on-error': 'BlockdevOnError' } }
1925 # @block-job-set-speed:
1927 # Set maximum speed for a background block operation.
1929 # This command can only be issued when there is an active block job.
1931 # Throttling can be disabled by setting the speed to 0.
1933 # @device: The job identifier. This used to be a device name (hence
1934 #          the name of the parameter), but since QEMU 2.7 it can have
1935 #          other values.
1937 # @speed:  the maximum speed, in bytes per second, or 0 for unlimited.
1938 #          Defaults to 0.
1940 # Returns: Nothing on success
1941 #          If no background operation is active on this device, DeviceNotActive
1943 # Since: 1.1
1945 { 'command': 'block-job-set-speed',
1946   'data': { 'device': 'str', 'speed': 'int' } }
1949 # @block-job-cancel:
1951 # Stop an active background block operation.
1953 # This command returns immediately after marking the active background block
1954 # operation for cancellation.  It is an error to call this command if no
1955 # operation is in progress.
1957 # The operation will cancel as soon as possible and then emit the
1958 # BLOCK_JOB_CANCELLED event.  Before that happens the job is still visible when
1959 # enumerated using query-block-jobs.
1961 # For streaming, the image file retains its backing file unless the streaming
1962 # operation happens to complete just as it is being cancelled.  A new streaming
1963 # operation can be started at a later time to finish copying all data from the
1964 # backing file.
1966 # @device: The job identifier. This used to be a device name (hence
1967 #          the name of the parameter), but since QEMU 2.7 it can have
1968 #          other values.
1970 # @force: #optional whether to allow cancellation of a paused job (default
1971 #         false).  Since 1.3.
1973 # Returns: Nothing on success
1974 #          If no background operation is active on this device, DeviceNotActive
1976 # Since: 1.1
1978 { 'command': 'block-job-cancel', 'data': { 'device': 'str', '*force': 'bool' } }
1981 # @block-job-pause:
1983 # Pause an active background block operation.
1985 # This command returns immediately after marking the active background block
1986 # operation for pausing.  It is an error to call this command if no
1987 # operation is in progress.  Pausing an already paused job has no cumulative
1988 # effect; a single block-job-resume command will resume the job.
1990 # The operation will pause as soon as possible.  No event is emitted when
1991 # the operation is actually paused.  Cancelling a paused job automatically
1992 # resumes it.
1994 # @device: The job identifier. This used to be a device name (hence
1995 #          the name of the parameter), but since QEMU 2.7 it can have
1996 #          other values.
1998 # Returns: Nothing on success
1999 #          If no background operation is active on this device, DeviceNotActive
2001 # Since: 1.3
2003 { 'command': 'block-job-pause', 'data': { 'device': 'str' } }
2006 # @block-job-resume:
2008 # Resume an active background block operation.
2010 # This command returns immediately after resuming a paused background block
2011 # operation.  It is an error to call this command if no operation is in
2012 # progress.  Resuming an already running job is not an error.
2014 # This command also clears the error status of the job.
2016 # @device: The job identifier. This used to be a device name (hence
2017 #          the name of the parameter), but since QEMU 2.7 it can have
2018 #          other values.
2020 # Returns: Nothing on success
2021 #          If no background operation is active on this device, DeviceNotActive
2023 # Since: 1.3
2025 { 'command': 'block-job-resume', 'data': { 'device': 'str' } }
2028 # @block-job-complete:
2030 # Manually trigger completion of an active background block operation.  This
2031 # is supported for drive mirroring, where it also switches the device to
2032 # write to the target path only.  The ability to complete is signaled with
2033 # a BLOCK_JOB_READY event.
2035 # This command completes an active background block operation synchronously.
2036 # The ordering of this command's return with the BLOCK_JOB_COMPLETED event
2037 # is not defined.  Note that if an I/O error occurs during the processing of
2038 # this command: 1) the command itself will fail; 2) the error will be processed
2039 # according to the rerror/werror arguments that were specified when starting
2040 # the operation.
2042 # A cancelled or paused job cannot be completed.
2044 # @device: The job identifier. This used to be a device name (hence
2045 #          the name of the parameter), but since QEMU 2.7 it can have
2046 #          other values.
2048 # Returns: Nothing on success
2049 #          If no background operation is active on this device, DeviceNotActive
2051 # Since: 1.3
2053 { 'command': 'block-job-complete', 'data': { 'device': 'str' } }
2056 # @BlockdevDiscardOptions:
2058 # Determines how to handle discard requests.
2060 # @ignore:      Ignore the request
2061 # @unmap:       Forward as an unmap request
2063 # Since: 1.7
2065 { 'enum': 'BlockdevDiscardOptions',
2066   'data': [ 'ignore', 'unmap' ] }
2069 # @BlockdevDetectZeroesOptions:
2071 # Describes the operation mode for the automatic conversion of plain
2072 # zero writes by the OS to driver specific optimized zero write commands.
2074 # @off:      Disabled (default)
2075 # @on:       Enabled
2076 # @unmap:    Enabled and even try to unmap blocks if possible. This requires
2077 #            also that @BlockdevDiscardOptions is set to unmap for this device.
2079 # Since: 2.1
2081 { 'enum': 'BlockdevDetectZeroesOptions',
2082   'data': [ 'off', 'on', 'unmap' ] }
2085 # @BlockdevAioOptions:
2087 # Selects the AIO backend to handle I/O requests
2089 # @threads:     Use qemu's thread pool
2090 # @native:      Use native AIO backend (only Linux and Windows)
2092 # Since: 1.7
2094 { 'enum': 'BlockdevAioOptions',
2095   'data': [ 'threads', 'native' ] }
2098 # @BlockdevCacheOptions:
2100 # Includes cache-related options for block devices
2102 # @direct:      #optional enables use of O_DIRECT (bypass the host page cache;
2103 #               default: false)
2104 # @no-flush:    #optional ignore any flush requests for the device (default:
2105 #               false)
2107 # Since: 1.7
2109 { 'struct': 'BlockdevCacheOptions',
2110   'data': { '*direct': 'bool',
2111             '*no-flush': 'bool' } }
2114 # @BlockdevDriver:
2116 # Drivers that are supported in block device operations.
2118 # @host_device: Since 2.1
2119 # @host_cdrom: Since 2.1
2120 # @gluster: Since 2.7
2121 # @nbd: Since 2.8
2122 # @nfs: Since 2.8
2123 # @replication: Since 2.8
2124 # @ssh: Since 2.8
2125 # @iscsi: Since 2.9
2126 # @rbd: Since 2.9
2128 # Since: 2.0
2130 { 'enum': 'BlockdevDriver',
2131   'data': [ 'archipelago', 'blkdebug', 'blkverify', 'bochs', 'cloop',
2132             'dmg', 'file', 'ftp', 'ftps', 'gluster', 'host_cdrom',
2133             'host_device', 'http', 'https', 'iscsi', 'luks', 'nbd', 'nfs',
2134             'null-aio', 'null-co', 'parallels', 'qcow', 'qcow2', 'qed',
2135             'quorum', 'raw', 'rbd', 'replication', 'ssh', 'vdi', 'vhdx', 'vmdk',
2136             'vpc', 'vvfat' ] }
2139 # @BlockdevOptionsFile:
2141 # Driver specific block device options for the file backend.
2143 # @filename:    path to the image file
2144 # @aio:         #optional AIO backend (default: threads) (since: 2.8)
2146 # Since: 1.7
2148 { 'struct': 'BlockdevOptionsFile',
2149   'data': { 'filename': 'str',
2150             '*aio': 'BlockdevAioOptions' } }
2153 # @BlockdevOptionsNull:
2155 # Driver specific block device options for the null backend.
2157 # @size:    #optional size of the device in bytes.
2158 # @latency-ns: #optional emulated latency (in nanoseconds) in processing
2159 #              requests. Default to zero which completes requests immediately.
2160 #              (Since 2.4)
2162 # Since: 2.2
2164 { 'struct': 'BlockdevOptionsNull',
2165   'data': { '*size': 'int', '*latency-ns': 'uint64' } }
2168 # @BlockdevOptionsVVFAT:
2170 # Driver specific block device options for the vvfat protocol.
2172 # @dir:         directory to be exported as FAT image
2173 # @fat-type:    #optional FAT type: 12, 16 or 32
2174 # @floppy:      #optional whether to export a floppy image (true) or
2175 #               partitioned hard disk (false; default)
2176 # @label:       #optional set the volume label, limited to 11 bytes. FAT16 and
2177 #               FAT32 traditionally have some restrictions on labels, which are
2178 #               ignored by most operating systems. Defaults to "QEMU VVFAT".
2179 #               (since 2.4)
2180 # @rw:          #optional whether to allow write operations (default: false)
2182 # Since: 1.7
2184 { 'struct': 'BlockdevOptionsVVFAT',
2185   'data': { 'dir': 'str', '*fat-type': 'int', '*floppy': 'bool',
2186             '*label': 'str', '*rw': 'bool' } }
2189 # @BlockdevOptionsGenericFormat:
2191 # Driver specific block device options for image format that have no option
2192 # besides their data source.
2194 # @file:        reference to or definition of the data source block device
2196 # Since: 1.7
2198 { 'struct': 'BlockdevOptionsGenericFormat',
2199   'data': { 'file': 'BlockdevRef' } }
2202 # @BlockdevOptionsLUKS:
2204 # Driver specific block device options for LUKS.
2206 # @key-secret: #optional the ID of a QCryptoSecret object providing
2207 #              the decryption key (since 2.6). Mandatory except when
2208 #              doing a metadata-only probe of the image.
2210 # Since: 2.6
2212 { 'struct': 'BlockdevOptionsLUKS',
2213   'base': 'BlockdevOptionsGenericFormat',
2214   'data': { '*key-secret': 'str' } }
2218 # @BlockdevOptionsGenericCOWFormat:
2220 # Driver specific block device options for image format that have no option
2221 # besides their data source and an optional backing file.
2223 # @backing:     #optional reference to or definition of the backing file block
2224 #               device (if missing, taken from the image file content). It is
2225 #               allowed to pass an empty string here in order to disable the
2226 #               default backing file.
2228 # Since: 1.7
2230 { 'struct': 'BlockdevOptionsGenericCOWFormat',
2231   'base': 'BlockdevOptionsGenericFormat',
2232   'data': { '*backing': 'BlockdevRef' } }
2235 # @Qcow2OverlapCheckMode:
2237 # General overlap check modes.
2239 # @none:        Do not perform any checks
2241 # @constant:    Perform only checks which can be done in constant time and
2242 #               without reading anything from disk
2244 # @cached:      Perform only checks which can be done without reading anything
2245 #               from disk
2247 # @all:         Perform all available overlap checks
2249 # Since: 2.2
2251 { 'enum': 'Qcow2OverlapCheckMode',
2252   'data': [ 'none', 'constant', 'cached', 'all' ] }
2255 # @Qcow2OverlapCheckFlags:
2257 # Structure of flags for each metadata structure. Setting a field to 'true'
2258 # makes qemu guard that structure against unintended overwriting. The default
2259 # value is chosen according to the template given.
2261 # @template: Specifies a template mode which can be adjusted using the other
2262 #            flags, defaults to 'cached'
2264 # Since: 2.2
2266 { 'struct': 'Qcow2OverlapCheckFlags',
2267   'data': { '*template':       'Qcow2OverlapCheckMode',
2268             '*main-header':    'bool',
2269             '*active-l1':      'bool',
2270             '*active-l2':      'bool',
2271             '*refcount-table': 'bool',
2272             '*refcount-block': 'bool',
2273             '*snapshot-table': 'bool',
2274             '*inactive-l1':    'bool',
2275             '*inactive-l2':    'bool' } }
2278 # @Qcow2OverlapChecks:
2280 # Specifies which metadata structures should be guarded against unintended
2281 # overwriting.
2283 # @flags:   set of flags for separate specification of each metadata structure
2284 #           type
2286 # @mode:    named mode which chooses a specific set of flags
2288 # Since: 2.2
2290 { 'alternate': 'Qcow2OverlapChecks',
2291   'data': { 'flags': 'Qcow2OverlapCheckFlags',
2292             'mode':  'Qcow2OverlapCheckMode' } }
2295 # @BlockdevOptionsQcow2:
2297 # Driver specific block device options for qcow2.
2299 # @lazy-refcounts:        #optional whether to enable the lazy refcounts
2300 #                         feature (default is taken from the image file)
2302 # @pass-discard-request:  #optional whether discard requests to the qcow2
2303 #                         device should be forwarded to the data source
2305 # @pass-discard-snapshot: #optional whether discard requests for the data source
2306 #                         should be issued when a snapshot operation (e.g.
2307 #                         deleting a snapshot) frees clusters in the qcow2 file
2309 # @pass-discard-other:    #optional whether discard requests for the data source
2310 #                         should be issued on other occasions where a cluster
2311 #                         gets freed
2313 # @overlap-check:         #optional which overlap checks to perform for writes
2314 #                         to the image, defaults to 'cached' (since 2.2)
2316 # @cache-size:            #optional the maximum total size of the L2 table and
2317 #                         refcount block caches in bytes (since 2.2)
2319 # @l2-cache-size:         #optional the maximum size of the L2 table cache in
2320 #                         bytes (since 2.2)
2322 # @refcount-cache-size:   #optional the maximum size of the refcount block cache
2323 #                         in bytes (since 2.2)
2325 # @cache-clean-interval:  #optional clean unused entries in the L2 and refcount
2326 #                         caches. The interval is in seconds. The default value
2327 #                         is 0 and it disables this feature (since 2.5)
2329 # Since: 1.7
2331 { 'struct': 'BlockdevOptionsQcow2',
2332   'base': 'BlockdevOptionsGenericCOWFormat',
2333   'data': { '*lazy-refcounts': 'bool',
2334             '*pass-discard-request': 'bool',
2335             '*pass-discard-snapshot': 'bool',
2336             '*pass-discard-other': 'bool',
2337             '*overlap-check': 'Qcow2OverlapChecks',
2338             '*cache-size': 'int',
2339             '*l2-cache-size': 'int',
2340             '*refcount-cache-size': 'int',
2341             '*cache-clean-interval': 'int' } }
2345 # @BlockdevOptionsArchipelago:
2347 # Driver specific block device options for Archipelago.
2349 # @volume:              Name of the Archipelago volume image
2351 # @mport:               #optional The port number on which mapperd is
2352 #                       listening. This is optional
2353 #                       and if not specified, QEMU will make Archipelago
2354 #                       use the default port (1001).
2356 # @vport:               #optional The port number on which vlmcd is
2357 #                       listening. This is optional
2358 #                       and if not specified, QEMU will make Archipelago
2359 #                       use the default port (501).
2361 # @segment:             #optional The name of the shared memory segment
2362 #                       Archipelago stack is using. This is optional
2363 #                       and if not specified, QEMU will make Archipelago
2364 #                       use the default value, 'archipelago'.
2365 # Since: 2.2
2367 { 'struct': 'BlockdevOptionsArchipelago',
2368   'data': { 'volume': 'str',
2369             '*mport': 'int',
2370             '*vport': 'int',
2371             '*segment': 'str' } }
2374 # @BlockdevOptionsSsh:
2376 # @server:              host address
2378 # @path:                path to the image on the host
2380 # @user:                #optional user as which to connect, defaults to current
2381 #                       local user name
2383 # TODO: Expose the host_key_check option in QMP
2385 # Since: 2.8
2387 { 'struct': 'BlockdevOptionsSsh',
2388   'data': { 'server': 'InetSocketAddress',
2389             'path': 'str',
2390             '*user': 'str' } }
2394 # @BlkdebugEvent:
2396 # Trigger events supported by blkdebug.
2398 # Since: 2.0
2400 { 'enum': 'BlkdebugEvent', 'prefix': 'BLKDBG',
2401   'data': [ 'l1_update', 'l1_grow_alloc_table', 'l1_grow_write_table',
2402             'l1_grow_activate_table', 'l2_load', 'l2_update',
2403             'l2_update_compressed', 'l2_alloc_cow_read', 'l2_alloc_write',
2404             'read_aio', 'read_backing_aio', 'read_compressed', 'write_aio',
2405             'write_compressed', 'vmstate_load', 'vmstate_save', 'cow_read',
2406             'cow_write', 'reftable_load', 'reftable_grow', 'reftable_update',
2407             'refblock_load', 'refblock_update', 'refblock_update_part',
2408             'refblock_alloc', 'refblock_alloc_hookup', 'refblock_alloc_write',
2409             'refblock_alloc_write_blocks', 'refblock_alloc_write_table',
2410             'refblock_alloc_switch_table', 'cluster_alloc',
2411             'cluster_alloc_bytes', 'cluster_free', 'flush_to_os',
2412             'flush_to_disk', 'pwritev_rmw_head', 'pwritev_rmw_after_head',
2413             'pwritev_rmw_tail', 'pwritev_rmw_after_tail', 'pwritev',
2414             'pwritev_zero', 'pwritev_done', 'empty_image_prepare' ] }
2417 # @BlkdebugInjectErrorOptions:
2419 # Describes a single error injection for blkdebug.
2421 # @event:       trigger event
2423 # @state:       #optional the state identifier blkdebug needs to be in to
2424 #               actually trigger the event; defaults to "any"
2426 # @errno:       #optional error identifier (errno) to be returned; defaults to
2427 #               EIO
2429 # @sector:      #optional specifies the sector index which has to be affected
2430 #               in order to actually trigger the event; defaults to "any
2431 #               sector"
2433 # @once:        #optional disables further events after this one has been
2434 #               triggered; defaults to false
2436 # @immediately: #optional fail immediately; defaults to false
2438 # Since: 2.0
2440 { 'struct': 'BlkdebugInjectErrorOptions',
2441   'data': { 'event': 'BlkdebugEvent',
2442             '*state': 'int',
2443             '*errno': 'int',
2444             '*sector': 'int',
2445             '*once': 'bool',
2446             '*immediately': 'bool' } }
2449 # @BlkdebugSetStateOptions:
2451 # Describes a single state-change event for blkdebug.
2453 # @event:       trigger event
2455 # @state:       #optional the current state identifier blkdebug needs to be in;
2456 #               defaults to "any"
2458 # @new_state:   the state identifier blkdebug is supposed to assume if
2459 #               this event is triggered
2461 # Since: 2.0
2463 { 'struct': 'BlkdebugSetStateOptions',
2464   'data': { 'event': 'BlkdebugEvent',
2465             '*state': 'int',
2466             'new_state': 'int' } }
2469 # @BlockdevOptionsBlkdebug:
2471 # Driver specific block device options for blkdebug.
2473 # @image:           underlying raw block device (or image file)
2475 # @config:          #optional filename of the configuration file
2477 # @align:           #optional required alignment for requests in bytes,
2478 #                   must be power of 2, or 0 for default
2480 # @inject-error:    #optional array of error injection descriptions
2482 # @set-state:       #optional array of state-change descriptions
2484 # Since: 2.0
2486 { 'struct': 'BlockdevOptionsBlkdebug',
2487   'data': { 'image': 'BlockdevRef',
2488             '*config': 'str',
2489             '*align': 'int',
2490             '*inject-error': ['BlkdebugInjectErrorOptions'],
2491             '*set-state': ['BlkdebugSetStateOptions'] } }
2494 # @BlockdevOptionsBlkverify:
2496 # Driver specific block device options for blkverify.
2498 # @test:    block device to be tested
2500 # @raw:     raw image used for verification
2502 # Since: 2.0
2504 { 'struct': 'BlockdevOptionsBlkverify',
2505   'data': { 'test': 'BlockdevRef',
2506             'raw': 'BlockdevRef' } }
2509 # @QuorumReadPattern:
2511 # An enumeration of quorum read patterns.
2513 # @quorum: read all the children and do a quorum vote on reads
2515 # @fifo: read only from the first child that has not failed
2517 # Since: 2.2
2519 { 'enum': 'QuorumReadPattern', 'data': [ 'quorum', 'fifo' ] }
2522 # @BlockdevOptionsQuorum:
2524 # Driver specific block device options for Quorum
2526 # @blkverify:      #optional true if the driver must print content mismatch
2527 #                  set to false by default
2529 # @children:       the children block devices to use
2531 # @vote-threshold: the vote limit under which a read will fail
2533 # @rewrite-corrupted: #optional rewrite corrupted data when quorum is reached
2534 #                     (Since 2.1)
2536 # @read-pattern: #optional choose read pattern and set to quorum by default
2537 #                (Since 2.2)
2539 # Since: 2.0
2541 { 'struct': 'BlockdevOptionsQuorum',
2542   'data': { '*blkverify': 'bool',
2543             'children': [ 'BlockdevRef' ],
2544             'vote-threshold': 'int',
2545             '*rewrite-corrupted': 'bool',
2546             '*read-pattern': 'QuorumReadPattern' } }
2549 # @GlusterTransport:
2551 # An enumeration of Gluster transport types
2553 # @tcp:   TCP   - Transmission Control Protocol
2555 # @unix:  UNIX  - Unix domain socket
2557 # Since: 2.7
2559 { 'enum': 'GlusterTransport',
2560   'data': [ 'unix', 'tcp' ] }
2564 # @GlusterServer:
2566 # Captures the address of a socket
2568 # Details for connecting to a gluster server
2570 # @type:       Transport type used for gluster connection
2572 # This is similar to SocketAddress, only distinction:
2574 # 1. GlusterServer is a flat union, SocketAddress is a simple union.
2575 #    A flat union is nicer than simple because it avoids nesting
2576 #    (i.e. more {}) on the wire.
2578 # 2. GlusterServer lacks case 'fd', since gluster doesn't let you
2579 #    pass in a file descriptor.
2581 # GlusterServer is actually not Gluster-specific, its a
2582 # compatibility evolved into an alternate for SocketAddress.
2584 # Since: 2.7
2586 { 'union': 'GlusterServer',
2587   'base': { 'type': 'GlusterTransport' },
2588   'discriminator': 'type',
2589   'data': { 'unix': 'UnixSocketAddress',
2590             'tcp': 'InetSocketAddress' } }
2593 # @BlockdevOptionsGluster:
2595 # Driver specific block device options for Gluster
2597 # @volume:      name of gluster volume where VM image resides
2599 # @path:        absolute path to image file in gluster volume
2601 # @server:      gluster servers description
2603 # @debug:       #optional libgfapi log level (default '4' which is Error)
2604 #               (Since 2.8)
2606 # @logfile:     #optional libgfapi log file (default /dev/stderr) (Since 2.8)
2608 # Since: 2.7
2610 { 'struct': 'BlockdevOptionsGluster',
2611   'data': { 'volume': 'str',
2612             'path': 'str',
2613             'server': ['GlusterServer'],
2614             '*debug': 'int',
2615             '*logfile': 'str' } }
2618 # @IscsiTransport:
2620 # An enumeration of libiscsi transport types
2622 # Since: 2.9
2624 { 'enum': 'IscsiTransport',
2625   'data': [ 'tcp', 'iser' ] }
2628 # @IscsiHeaderDigest:
2630 # An enumeration of header digests supported by libiscsi
2632 # Since: 2.9
2634 { 'enum': 'IscsiHeaderDigest',
2635   'prefix': 'QAPI_ISCSI_HEADER_DIGEST',
2636   'data': [ 'crc32c', 'none', 'crc32c-none', 'none-crc32c' ] }
2639 # @BlockdevOptionsIscsi:
2641 # @transport:       The iscsi transport type
2643 # @portal:          The address of the iscsi portal
2645 # @target:          The target iqn name
2647 # @lun:             #optional LUN to connect to. Defaults to 0.
2649 # @user:            #optional User name to log in with. If omitted, no CHAP
2650 #                   authentication is performed.
2652 # @password-secret: #optional The ID of a QCryptoSecret object providing
2653 #                   the password for the login. This option is required if
2654 #                   @user is specified.
2656 # @initiator-name:  #optional The iqn name we want to identify to the target
2657 #                   as. If this option is not specified, an initiator name is
2658 #                   generated automatically.
2660 # @header-digest:   #optional The desired header digest. Defaults to
2661 #                   none-crc32c.
2663 # @timeout:         #optional Timeout in seconds after which a request will
2664 #                   timeout. 0 means no timeout and is the default.
2666 # Driver specific block device options for iscsi
2668 # Since: 2.9
2670 { 'struct': 'BlockdevOptionsIscsi',
2671   'data': { 'transport': 'IscsiTransport',
2672             'portal': 'str',
2673             'target': 'str',
2674             '*lun': 'int',
2675             '*user': 'str',
2676             '*password-secret': 'str',
2677             '*initiator-name': 'str',
2678             '*header-digest': 'IscsiHeaderDigest',
2679             '*timeout': 'int' } }
2683 # @RbdAuthSupport:
2685 # An enumeration of RBD auth support
2687 # Since: 2.9
2689 { 'enum': 'RbdAuthSupport',
2690   'data': [ 'cephx', 'none' ] }
2694 # @RbdAuthMethod:
2696 # An enumeration of rados auth_supported types
2698 # Since: 2.9
2700 { 'struct': 'RbdAuthMethod',
2701   'data': { 'auth': 'RbdAuthSupport' } }
2704 # @BlockdevOptionsRbd:
2706 # @pool:               Ceph pool name.
2708 # @image:              Image name in the Ceph pool.
2710 # @conf:               #optional path to Ceph configuration file.  Values
2711 #                      in the configuration file will be overridden by
2712 #                      options specified via QAPI.
2714 # @snapshot:           #optional Ceph snapshot name.
2716 # @user:               #optional Ceph id name.
2718 # @server:             #optional Monitor host address and port.  This maps
2719 #                      to the "mon_host" Ceph option.
2721 # @auth-supported:     #optional Authentication supported.
2723 # @password-secret:    #optional The ID of a QCryptoSecret object providing
2724 #                      the password for the login.
2726 # Since: 2.9
2728 { 'struct': 'BlockdevOptionsRbd',
2729   'data': { 'pool': 'str',
2730             'image': 'str',
2731             '*conf': 'str',
2732             '*snapshot': 'str',
2733             '*user': 'str',
2734             '*server': ['InetSocketAddress'],
2735             '*auth-supported': ['RbdAuthMethod'],
2736             '*password-secret': 'str' } }
2739 # @ReplicationMode:
2741 # An enumeration of replication modes.
2743 # @primary: Primary mode, the vm's state will be sent to secondary QEMU.
2745 # @secondary: Secondary mode, receive the vm's state from primary QEMU.
2747 # Since: 2.8
2749 { 'enum' : 'ReplicationMode', 'data' : [ 'primary', 'secondary' ] }
2752 # @BlockdevOptionsReplication:
2754 # Driver specific block device options for replication
2756 # @mode: the replication mode
2758 # @top-id: #optional In secondary mode, node name or device ID of the root
2759 #          node who owns the replication node chain. Must not be given in
2760 #          primary mode.
2762 # Since: 2.8
2764 { 'struct': 'BlockdevOptionsReplication',
2765   'base': 'BlockdevOptionsGenericFormat',
2766   'data': { 'mode': 'ReplicationMode',
2767             '*top-id': 'str' } }
2770 # @NFSTransport:
2772 # An enumeration of NFS transport types
2774 # @inet:        TCP transport
2776 # Since: 2.8
2778 { 'enum': 'NFSTransport',
2779   'data': [ 'inet' ] }
2782 # @NFSServer:
2784 # Captures the address of the socket
2786 # @type:        transport type used for NFS (only TCP supported)
2788 # @host:        host address for NFS server
2790 # Since: 2.8
2792 { 'struct': 'NFSServer',
2793   'data': { 'type': 'NFSTransport',
2794             'host': 'str' } }
2797 # @BlockdevOptionsNfs:
2799 # Driver specific block device option for NFS
2801 # @server:                  host address
2803 # @path:                    path of the image on the host
2805 # @user:                    #optional UID value to use when talking to the
2806 #                           server (defaults to 65534 on Windows and getuid()
2807 #                           on unix)
2809 # @group:                   #optional GID value to use when talking to the
2810 #                           server (defaults to 65534 on Windows and getgid()
2811 #                           in unix)
2813 # @tcp-syn-count:           #optional number of SYNs during the session
2814 #                           establishment (defaults to libnfs default)
2816 # @readahead-size:          #optional set the readahead size in bytes (defaults
2817 #                           to libnfs default)
2819 # @page-cache-size:         #optional set the pagecache size in bytes (defaults
2820 #                           to libnfs default)
2822 # @debug:                   #optional set the NFS debug level (max 2) (defaults
2823 #                           to libnfs default)
2825 # Since: 2.8
2827 { 'struct': 'BlockdevOptionsNfs',
2828   'data': { 'server': 'NFSServer',
2829             'path': 'str',
2830             '*user': 'int',
2831             '*group': 'int',
2832             '*tcp-syn-count': 'int',
2833             '*readahead-size': 'int',
2834             '*page-cache-size': 'int',
2835             '*debug': 'int' } }
2838 # @BlockdevOptionsCurl:
2840 # Driver specific block device options for the curl backend.
2842 # @filename:    path to the image file
2844 # Since: 1.7
2846 { 'struct': 'BlockdevOptionsCurl',
2847   'data': { 'filename': 'str' } }
2850 # @BlockdevOptionsNbd:
2852 # Driver specific block device options for NBD.
2854 # @server:      NBD server address
2856 # @export:      #optional export name
2858 # @tls-creds:   #optional TLS credentials ID
2860 # Since: 2.8
2862 { 'struct': 'BlockdevOptionsNbd',
2863   'data': { 'server': 'SocketAddress',
2864             '*export': 'str',
2865             '*tls-creds': 'str' } }
2868 # @BlockdevOptionsRaw:
2870 # Driver specific block device options for the raw driver.
2872 # @offset:      #optional position where the block device starts
2873 # @size:        #optional the assumed size of the device
2875 # Since: 2.8
2877 { 'struct': 'BlockdevOptionsRaw',
2878   'base': 'BlockdevOptionsGenericFormat',
2879   'data': { '*offset': 'int', '*size': 'int' } }
2882 # @BlockdevOptions:
2884 # Options for creating a block device.  Many options are available for all
2885 # block devices, independent of the block driver:
2887 # @driver:        block driver name
2888 # @node-name:     #optional the node name of the new node (Since 2.0).
2889 #                 This option is required on the top level of blockdev-add.
2890 # @discard:       #optional discard-related options (default: ignore)
2891 # @cache:         #optional cache-related options
2892 # @read-only:     #optional whether the block device should be read-only
2893 #                 (default: false)
2894 # @detect-zeroes: #optional detect and optimize zero writes (Since 2.1)
2895 #                 (default: off)
2897 # Remaining options are determined by the block driver.
2899 # Since: 1.7
2901 { 'union': 'BlockdevOptions',
2902   'base': { 'driver': 'BlockdevDriver',
2903             '*node-name': 'str',
2904             '*discard': 'BlockdevDiscardOptions',
2905             '*cache': 'BlockdevCacheOptions',
2906             '*read-only': 'bool',
2907             '*detect-zeroes': 'BlockdevDetectZeroesOptions' },
2908   'discriminator': 'driver',
2909   'data': {
2910       'archipelago':'BlockdevOptionsArchipelago',
2911       'blkdebug':   'BlockdevOptionsBlkdebug',
2912       'blkverify':  'BlockdevOptionsBlkverify',
2913       'bochs':      'BlockdevOptionsGenericFormat',
2914       'cloop':      'BlockdevOptionsGenericFormat',
2915       'dmg':        'BlockdevOptionsGenericFormat',
2916       'file':       'BlockdevOptionsFile',
2917       'ftp':        'BlockdevOptionsCurl',
2918       'ftps':       'BlockdevOptionsCurl',
2919       'gluster':    'BlockdevOptionsGluster',
2920       'host_cdrom': 'BlockdevOptionsFile',
2921       'host_device':'BlockdevOptionsFile',
2922       'http':       'BlockdevOptionsCurl',
2923       'https':      'BlockdevOptionsCurl',
2924       'iscsi':      'BlockdevOptionsIscsi',
2925       'luks':       'BlockdevOptionsLUKS',
2926       'nbd':        'BlockdevOptionsNbd',
2927       'nfs':        'BlockdevOptionsNfs',
2928       'null-aio':   'BlockdevOptionsNull',
2929       'null-co':    'BlockdevOptionsNull',
2930       'parallels':  'BlockdevOptionsGenericFormat',
2931       'qcow2':      'BlockdevOptionsQcow2',
2932       'qcow':       'BlockdevOptionsGenericCOWFormat',
2933       'qed':        'BlockdevOptionsGenericCOWFormat',
2934       'quorum':     'BlockdevOptionsQuorum',
2935       'raw':        'BlockdevOptionsRaw',
2936       'rbd':        'BlockdevOptionsRbd',
2937       'replication':'BlockdevOptionsReplication',
2938 # TODO sheepdog: Wait for structured options
2939       'ssh':        'BlockdevOptionsSsh',
2940       'vdi':        'BlockdevOptionsGenericFormat',
2941       'vhdx':       'BlockdevOptionsGenericFormat',
2942       'vmdk':       'BlockdevOptionsGenericCOWFormat',
2943       'vpc':        'BlockdevOptionsGenericFormat',
2944       'vvfat':      'BlockdevOptionsVVFAT'
2945   } }
2948 # @BlockdevRef:
2950 # Reference to a block device.
2952 # @definition:      defines a new block device inline
2953 # @reference:       references the ID of an existing block device. An
2954 #                   empty string means that no block device should be
2955 #                   referenced.
2957 # Since: 1.7
2959 { 'alternate': 'BlockdevRef',
2960   'data': { 'definition': 'BlockdevOptions',
2961             'reference': 'str' } }
2964 # @blockdev-add:
2966 # Creates a new block device. If the @id option is given at the top level, a
2967 # BlockBackend will be created; otherwise, @node-name is mandatory at the top
2968 # level and no BlockBackend will be created.
2970 # For the arguments, see the documentation of BlockdevOptions.
2972 # Note: This command is still a work in progress.  It doesn't support all
2973 # block drivers among other things.  Stay away from it unless you want
2974 # to help with its development.
2976 # Since: 1.7
2978 # Example:
2980 # 1.
2981 # -> { "execute": "blockdev-add",
2982 #      "arguments": {
2983 #           "driver": "qcow2",
2984 #           "node-name": "test1",
2985 #           "file": {
2986 #               "driver": "file",
2987 #               "filename": "test.qcow2"
2988 #            }
2989 #       }
2990 #     }
2991 # <- { "return": {} }
2993 # 2.
2994 # -> { "execute": "blockdev-add",
2995 #      "arguments": {
2996 #           "driver": "qcow2",
2997 #           "node-name": "node0",
2998 #           "discard": "unmap",
2999 #           "cache": {
3000 #              "direct": true
3001 #            },
3002 #            "file": {
3003 #              "driver": "file",
3004 #              "filename": "/tmp/test.qcow2"
3005 #            },
3006 #            "backing": {
3007 #               "driver": "raw",
3008 #               "file": {
3009 #                  "driver": "file",
3010 #                  "filename": "/dev/fdset/4"
3011 #                }
3012 #            }
3013 #        }
3014 #      }
3016 # <- { "return": {} }
3019 { 'command': 'blockdev-add', 'data': 'BlockdevOptions', 'boxed': true }
3022 # @x-blockdev-del:
3024 # Deletes a block device that has been added using blockdev-add.
3025 # The command will fail if the node is attached to a device or is
3026 # otherwise being used.
3028 # @node-name: Name of the graph node to delete.
3030 # Note: This command is still a work in progress and is considered
3031 # experimental. Stay away from it unless you want to help with its
3032 # development.
3034 # Since: 2.5
3036 # Example:
3038 # -> { "execute": "blockdev-add",
3039 #      "arguments": {
3040 #           "driver": "qcow2",
3041 #           "node-name": "node0",
3042 #           "file": {
3043 #               "driver": "file",
3044 #               "filename": "test.qcow2"
3045 #           }
3046 #      }
3047 #    }
3048 # <- { "return": {} }
3050 # -> { "execute": "x-blockdev-del",
3051 #      "arguments": { "node-name": "node0" }
3052 #    }
3053 # <- { "return": {} }
3056 { 'command': 'x-blockdev-del', 'data': { 'node-name': 'str' } }
3059 # @blockdev-open-tray:
3061 # Opens a block device's tray. If there is a block driver state tree inserted as
3062 # a medium, it will become inaccessible to the guest (but it will remain
3063 # associated to the block device, so closing the tray will make it accessible
3064 # again).
3066 # If the tray was already open before, this will be a no-op.
3068 # Once the tray opens, a DEVICE_TRAY_MOVED event is emitted. There are cases in
3069 # which no such event will be generated, these include:
3070 # - if the guest has locked the tray, @force is false and the guest does not
3071 #   respond to the eject request
3072 # - if the BlockBackend denoted by @device does not have a guest device attached
3073 #   to it
3074 # - if the guest device does not have an actual tray
3076 # @device: #optional Block device name (deprecated, use @id instead)
3078 # @id:     #optional The name or QOM path of the guest device (since: 2.8)
3080 # @force:  #optional if false (the default), an eject request will be sent to
3081 #          the guest if it has locked the tray (and the tray will not be opened
3082 #          immediately); if true, the tray will be opened regardless of whether
3083 #          it is locked
3085 # Since: 2.5
3087 # Example:
3089 # -> { "execute": "blockdev-open-tray",
3090 #      "arguments": { "id": "ide0-1-0" } }
3092 # <- { "timestamp": { "seconds": 1418751016,
3093 #                     "microseconds": 716996 },
3094 #      "event": "DEVICE_TRAY_MOVED",
3095 #      "data": { "device": "ide1-cd0",
3096 #                "id": "ide0-1-0",
3097 #                "tray-open": true } }
3099 # <- { "return": {} }
3102 { 'command': 'blockdev-open-tray',
3103   'data': { '*device': 'str',
3104             '*id': 'str',
3105             '*force': 'bool' } }
3108 # @blockdev-close-tray:
3110 # Closes a block device's tray. If there is a block driver state tree associated
3111 # with the block device (which is currently ejected), that tree will be loaded
3112 # as the medium.
3114 # If the tray was already closed before, this will be a no-op.
3116 # @device:  #optional Block device name (deprecated, use @id instead)
3118 # @id:      #optional The name or QOM path of the guest device (since: 2.8)
3120 # Since: 2.5
3122 # Example:
3124 # -> { "execute": "blockdev-close-tray",
3125 #      "arguments": { "id": "ide0-1-0" } }
3127 # <- { "timestamp": { "seconds": 1418751345,
3128 #                     "microseconds": 272147 },
3129 #      "event": "DEVICE_TRAY_MOVED",
3130 #      "data": { "device": "ide1-cd0",
3131 #                "id": "ide0-1-0",
3132 #                "tray-open": false } }
3134 # <- { "return": {} }
3137 { 'command': 'blockdev-close-tray',
3138   'data': { '*device': 'str',
3139             '*id': 'str' } }
3142 # @x-blockdev-remove-medium:
3144 # Removes a medium (a block driver state tree) from a block device. That block
3145 # device's tray must currently be open (unless there is no attached guest
3146 # device).
3148 # If the tray is open and there is no medium inserted, this will be a no-op.
3150 # @device: #optional Block device name (deprecated, use @id instead)
3152 # @id:     #optional The name or QOM path of the guest device (since: 2.8)
3154 # Note: This command is still a work in progress and is considered experimental.
3155 # Stay away from it unless you want to help with its development.
3157 # Since: 2.5
3159 # Example:
3161 # -> { "execute": "x-blockdev-remove-medium",
3162 #      "arguments": { "id": "ide0-1-0" } }
3164 # <- { "error": { "class": "GenericError",
3165 #                 "desc": "Tray of device 'ide0-1-0' is not open" } }
3167 # -> { "execute": "blockdev-open-tray",
3168 #      "arguments": { "id": "ide0-1-0" } }
3170 # <- { "timestamp": { "seconds": 1418751627,
3171 #                     "microseconds": 549958 },
3172 #      "event": "DEVICE_TRAY_MOVED",
3173 #      "data": { "device": "ide1-cd0",
3174 #                "id": "ide0-1-0",
3175 #                "tray-open": true } }
3177 # <- { "return": {} }
3179 # -> { "execute": "x-blockdev-remove-medium",
3180 #      "arguments": { "device": "ide0-1-0" } }
3182 # <- { "return": {} }
3185 { 'command': 'x-blockdev-remove-medium',
3186   'data': { '*device': 'str',
3187             '*id': 'str' } }
3190 # @x-blockdev-insert-medium:
3192 # Inserts a medium (a block driver state tree) into a block device. That block
3193 # device's tray must currently be open (unless there is no attached guest
3194 # device) and there must be no medium inserted already.
3196 # @device:    #optional Block device name (deprecated, use @id instead)
3198 # @id:        #optional The name or QOM path of the guest device (since: 2.8)
3200 # @node-name: name of a node in the block driver state graph
3202 # Note: This command is still a work in progress and is considered experimental.
3203 # Stay away from it unless you want to help with its development.
3205 # Since: 2.5
3207 # Example:
3209 # -> { "execute": "blockdev-add",
3210 #      "arguments": {
3211 #          "options": { "node-name": "node0",
3212 #                       "driver": "raw",
3213 #                       "file": { "driver": "file",
3214 #                                 "filename": "fedora.iso" } } } }
3215 # <- { "return": {} }
3217 # -> { "execute": "x-blockdev-insert-medium",
3218 #      "arguments": { "id": "ide0-1-0",
3219 #                     "node-name": "node0" } }
3221 # <- { "return": {} }
3224 { 'command': 'x-blockdev-insert-medium',
3225   'data': { '*device': 'str',
3226             '*id': 'str',
3227             'node-name': 'str'} }
3231 # @BlockdevChangeReadOnlyMode:
3233 # Specifies the new read-only mode of a block device subject to the
3234 # @blockdev-change-medium command.
3236 # @retain:      Retains the current read-only mode
3238 # @read-only:   Makes the device read-only
3240 # @read-write:  Makes the device writable
3242 # Since: 2.3
3245 { 'enum': 'BlockdevChangeReadOnlyMode',
3246   'data': ['retain', 'read-only', 'read-write'] }
3250 # @blockdev-change-medium:
3252 # Changes the medium inserted into a block device by ejecting the current medium
3253 # and loading a new image file which is inserted as the new medium (this command
3254 # combines blockdev-open-tray, x-blockdev-remove-medium,
3255 # x-blockdev-insert-medium and blockdev-close-tray).
3257 # @device:          #optional Block device name (deprecated, use @id instead)
3259 # @id:              #optional The name or QOM path of the guest device
3260 #                   (since: 2.8)
3262 # @filename:        filename of the new image to be loaded
3264 # @format:          #optional format to open the new image with (defaults to
3265 #                   the probed format)
3267 # @read-only-mode:  #optional change the read-only mode of the device; defaults
3268 #                   to 'retain'
3270 # Since: 2.5
3272 # Examples:
3274 # 1. Change a removable medium
3276 # -> { "execute": "blockdev-change-medium",
3277 #      "arguments": { "id": "ide0-1-0",
3278 #                     "filename": "/srv/images/Fedora-12-x86_64-DVD.iso",
3279 #                     "format": "raw" } }
3280 # <- { "return": {} }
3282 # 2. Load a read-only medium into a writable drive
3284 # -> { "execute": "blockdev-change-medium",
3285 #      "arguments": { "id": "floppyA",
3286 #                     "filename": "/srv/images/ro.img",
3287 #                     "format": "raw",
3288 #                     "read-only-mode": "retain" } }
3290 # <- { "error":
3291 #      { "class": "GenericError",
3292 #        "desc": "Could not open '/srv/images/ro.img': Permission denied" } }
3294 # -> { "execute": "blockdev-change-medium",
3295 #      "arguments": { "id": "floppyA",
3296 #                     "filename": "/srv/images/ro.img",
3297 #                     "format": "raw",
3298 #                     "read-only-mode": "read-only" } }
3300 # <- { "return": {} }
3303 { 'command': 'blockdev-change-medium',
3304   'data': { '*device': 'str',
3305             '*id': 'str',
3306             'filename': 'str',
3307             '*format': 'str',
3308             '*read-only-mode': 'BlockdevChangeReadOnlyMode' } }
3312 # @BlockErrorAction:
3314 # An enumeration of action that has been taken when a DISK I/O occurs
3316 # @ignore: error has been ignored
3318 # @report: error has been reported to the device
3320 # @stop: error caused VM to be stopped
3322 # Since: 2.1
3324 { 'enum': 'BlockErrorAction',
3325   'data': [ 'ignore', 'report', 'stop' ] }
3329 # @BLOCK_IMAGE_CORRUPTED:
3331 # Emitted when a disk image is being marked corrupt. The image can be
3332 # identified by its device or node name. The 'device' field is always
3333 # present for compatibility reasons, but it can be empty ("") if the
3334 # image does not have a device name associated.
3336 # @device: device name. This is always present for compatibility
3337 #          reasons, but it can be empty ("") if the image does not
3338 #          have a device name associated.
3340 # @node-name: #optional node name (Since: 2.4)
3342 # @msg: informative message for human consumption, such as the kind of
3343 #       corruption being detected. It should not be parsed by machine as it is
3344 #       not guaranteed to be stable
3346 # @offset: #optional if the corruption resulted from an image access, this is
3347 #          the host's access offset into the image
3349 # @size: #optional if the corruption resulted from an image access, this is
3350 #        the access size
3352 # @fatal: if set, the image is marked corrupt and therefore unusable after this
3353 #        event and must be repaired (Since 2.2; before, every
3354 #        BLOCK_IMAGE_CORRUPTED event was fatal)
3356 # Note: If action is "stop", a STOP event will eventually follow the
3357 #       BLOCK_IO_ERROR event.
3359 # Example:
3361 # <- { "event": "BLOCK_IMAGE_CORRUPTED",
3362 #      "data": { "device": "ide0-hd0", "node-name": "node0",
3363 #                "msg": "Prevented active L1 table overwrite", "offset": 196608,
3364 #                "size": 65536 },
3365 #      "timestamp": { "seconds": 1378126126, "microseconds": 966463 } }
3367 # Since: 1.7
3369 { 'event': 'BLOCK_IMAGE_CORRUPTED',
3370   'data': { 'device'     : 'str',
3371             '*node-name' : 'str',
3372             'msg'        : 'str',
3373             '*offset'    : 'int',
3374             '*size'      : 'int',
3375             'fatal'      : 'bool' } }
3378 # @BLOCK_IO_ERROR:
3380 # Emitted when a disk I/O error occurs
3382 # @device: device name. This is always present for compatibility
3383 #          reasons, but it can be empty ("") if the image does not
3384 #          have a device name associated.
3386 # @node-name: node name. Note that errors may be reported for the root node
3387 #             that is directly attached to a guest device rather than for the
3388 #             node where the error occurred. (Since: 2.8)
3390 # @operation: I/O operation
3392 # @action: action that has been taken
3394 # @nospace: #optional true if I/O error was caused due to a no-space
3395 #           condition. This key is only present if query-block's
3396 #           io-status is present, please see query-block documentation
3397 #           for more information (since: 2.2)
3399 # @reason: human readable string describing the error cause.
3400 #          (This field is a debugging aid for humans, it should not
3401 #           be parsed by applications) (since: 2.2)
3403 # Note: If action is "stop", a STOP event will eventually follow the
3404 # BLOCK_IO_ERROR event
3406 # Since: 0.13.0
3408 # Example:
3410 # <- { "event": "BLOCK_IO_ERROR",
3411 #      "data": { "device": "ide0-hd1",
3412 #                "node-name": "#block212",
3413 #                "operation": "write",
3414 #                "action": "stop" },
3415 #      "timestamp": { "seconds": 1265044230, "microseconds": 450486 } }
3418 { 'event': 'BLOCK_IO_ERROR',
3419   'data': { 'device': 'str', 'node-name': 'str', 'operation': 'IoOperationType',
3420             'action': 'BlockErrorAction', '*nospace': 'bool',
3421             'reason': 'str' } }
3424 # @BLOCK_JOB_COMPLETED:
3426 # Emitted when a block job has completed
3428 # @type: job type
3430 # @device: The job identifier. Originally the device name but other
3431 #          values are allowed since QEMU 2.7
3433 # @len: maximum progress value
3435 # @offset: current progress value. On success this is equal to len.
3436 #          On failure this is less than len
3438 # @speed: rate limit, bytes per second
3440 # @error: #optional error message. Only present on failure. This field
3441 #         contains a human-readable error message. There are no semantics
3442 #         other than that streaming has failed and clients should not try to
3443 #         interpret the error string
3445 # Since: 1.1
3447 # Example:
3449 # <- { "event": "BLOCK_JOB_COMPLETED",
3450 #      "data": { "type": "stream", "device": "virtio-disk0",
3451 #                "len": 10737418240, "offset": 10737418240,
3452 #                "speed": 0 },
3453 #      "timestamp": { "seconds": 1267061043, "microseconds": 959568 } }
3456 { 'event': 'BLOCK_JOB_COMPLETED',
3457   'data': { 'type'  : 'BlockJobType',
3458             'device': 'str',
3459             'len'   : 'int',
3460             'offset': 'int',
3461             'speed' : 'int',
3462             '*error': 'str' } }
3465 # @BLOCK_JOB_CANCELLED:
3467 # Emitted when a block job has been cancelled
3469 # @type: job type
3471 # @device: The job identifier. Originally the device name but other
3472 #          values are allowed since QEMU 2.7
3474 # @len: maximum progress value
3476 # @offset: current progress value. On success this is equal to len.
3477 #          On failure this is less than len
3479 # @speed: rate limit, bytes per second
3481 # Since: 1.1
3483 # Example:
3485 # <- { "event": "BLOCK_JOB_CANCELLED",
3486 #      "data": { "type": "stream", "device": "virtio-disk0",
3487 #                "len": 10737418240, "offset": 134217728,
3488 #                "speed": 0 },
3489 #      "timestamp": { "seconds": 1267061043, "microseconds": 959568 } }
3492 { 'event': 'BLOCK_JOB_CANCELLED',
3493   'data': { 'type'  : 'BlockJobType',
3494             'device': 'str',
3495             'len'   : 'int',
3496             'offset': 'int',
3497             'speed' : 'int' } }
3500 # @BLOCK_JOB_ERROR:
3502 # Emitted when a block job encounters an error
3504 # @device: The job identifier. Originally the device name but other
3505 #          values are allowed since QEMU 2.7
3507 # @operation: I/O operation
3509 # @action: action that has been taken
3511 # Since: 1.3
3513 # Example:
3515 # <- { "event": "BLOCK_JOB_ERROR",
3516 #      "data": { "device": "ide0-hd1",
3517 #                "operation": "write",
3518 #                "action": "stop" },
3519 #      "timestamp": { "seconds": 1265044230, "microseconds": 450486 } }
3522 { 'event': 'BLOCK_JOB_ERROR',
3523   'data': { 'device'   : 'str',
3524             'operation': 'IoOperationType',
3525             'action'   : 'BlockErrorAction' } }
3528 # @BLOCK_JOB_READY:
3530 # Emitted when a block job is ready to complete
3532 # @type: job type
3534 # @device: The job identifier. Originally the device name but other
3535 #          values are allowed since QEMU 2.7
3537 # @len: maximum progress value
3539 # @offset: current progress value. On success this is equal to len.
3540 #          On failure this is less than len
3542 # @speed: rate limit, bytes per second
3544 # Note: The "ready to complete" status is always reset by a @BLOCK_JOB_ERROR
3545 # event
3547 # Since: 1.3
3549 # Example:
3551 # <- { "event": "BLOCK_JOB_READY",
3552 #      "data": { "device": "drive0", "type": "mirror", "speed": 0,
3553 #                "len": 2097152, "offset": 2097152 }
3554 #      "timestamp": { "seconds": 1265044230, "microseconds": 450486 } }
3557 { 'event': 'BLOCK_JOB_READY',
3558   'data': { 'type'  : 'BlockJobType',
3559             'device': 'str',
3560             'len'   : 'int',
3561             'offset': 'int',
3562             'speed' : 'int' } }
3565 # @PreallocMode:
3567 # Preallocation mode of QEMU image file
3569 # @off: no preallocation
3570 # @metadata: preallocate only for metadata
3571 # @falloc: like @full preallocation but allocate disk space by
3572 #          posix_fallocate() rather than writing zeros.
3573 # @full: preallocate all data by writing zeros to device to ensure disk
3574 #        space is really available. @full preallocation also sets up
3575 #        metadata correctly.
3577 # Since: 2.2
3579 { 'enum': 'PreallocMode',
3580   'data': [ 'off', 'metadata', 'falloc', 'full' ] }
3583 # @BLOCK_WRITE_THRESHOLD:
3585 # Emitted when writes on block device reaches or exceeds the
3586 # configured write threshold. For thin-provisioned devices, this
3587 # means the device should be extended to avoid pausing for
3588 # disk exhaustion.
3589 # The event is one shot. Once triggered, it needs to be
3590 # re-registered with another block-set-threshold command.
3592 # @node-name: graph node name on which the threshold was exceeded.
3594 # @amount-exceeded: amount of data which exceeded the threshold, in bytes.
3596 # @write-threshold: last configured threshold, in bytes.
3598 # Since: 2.3
3600 { 'event': 'BLOCK_WRITE_THRESHOLD',
3601   'data': { 'node-name': 'str',
3602             'amount-exceeded': 'uint64',
3603             'write-threshold': 'uint64' } }
3606 # @block-set-write-threshold:
3608 # Change the write threshold for a block drive. An event will be
3609 # delivered if a write to this block drive crosses the configured
3610 # threshold.  The threshold is an offset, thus must be
3611 # non-negative. Default is no write threshold. Setting the threshold
3612 # to zero disables it.
3614 # This is useful to transparently resize thin-provisioned drives without
3615 # the guest OS noticing.
3617 # @node-name: graph node name on which the threshold must be set.
3619 # @write-threshold: configured threshold for the block device, bytes.
3620 #                   Use 0 to disable the threshold.
3622 # Since: 2.3
3624 # Example:
3626 # -> { "execute": "block-set-write-threshold",
3627 #      "arguments": { "node-name": "mydev",
3628 #                     "write-threshold": 17179869184 } }
3629 # <- { "return": {} }
3632 { 'command': 'block-set-write-threshold',
3633   'data': { 'node-name': 'str', 'write-threshold': 'uint64' } }
3636 # @x-blockdev-change:
3638 # Dynamically reconfigure the block driver state graph. It can be used
3639 # to add, remove, insert or replace a graph node. Currently only the
3640 # Quorum driver implements this feature to add or remove its child. This
3641 # is useful to fix a broken quorum child.
3643 # If @node is specified, it will be inserted under @parent. @child
3644 # may not be specified in this case. If both @parent and @child are
3645 # specified but @node is not, @child will be detached from @parent.
3647 # @parent: the id or name of the parent node.
3649 # @child: #optional the name of a child under the given parent node.
3651 # @node: #optional the name of the node that will be added.
3653 # Note: this command is experimental, and its API is not stable. It
3654 # does not support all kinds of operations, all kinds of children, nor
3655 # all block drivers.
3657 # Warning: The data in a new quorum child MUST be consistent with that of
3658 # the rest of the array.
3660 # Since: 2.7
3662 # Example:
3664 # 1. Add a new node to a quorum
3665 # -> { "execute": "blockdev-add",
3666 #      "arguments": {
3667 #          "options": { "driver": "raw",
3668 #                       "node-name": "new_node",
3669 #                        "file": { "driver": "file",
3670 #                                  "filename": "test.raw" } } } }
3671 # <- { "return": {} }
3672 # -> { "execute": "x-blockdev-change",
3673 #      "arguments": { "parent": "disk1",
3674 #                     "node": "new_node" } }
3675 # <- { "return": {} }
3677 # 2. Delete a quorum's node
3678 # -> { "execute": "x-blockdev-change",
3679 #      "arguments": { "parent": "disk1",
3680 #                     "child": "children.1" } }
3681 # <- { "return": {} }
3684 { 'command': 'x-blockdev-change',
3685   'data' : { 'parent': 'str',
3686              '*child': 'str',
3687              '*node': 'str' } }