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