fpu_helper.c: fix helper_fpscr_clrbit() function
[qemu/ar7.git] / qapi / block-core.json
blobcc3ede06309bd1cd284e8ab1a5bae27670419720
1 # -*- Mode: Python -*-
3 ##
4 # == Block core (VM unrelated)
5 ##
7 { 'include': 'common.json' }
8 { 'include': 'crypto.json' }
9 { 'include': 'job.json' }
10 { 'include': 'sockets.json' }
13 # @SnapshotInfo:
15 # @id: unique snapshot id
17 # @name: user chosen name
19 # @vm-state-size: size of the VM state
21 # @date-sec: UTC date of the snapshot in seconds
23 # @date-nsec: fractional part in nano seconds to be used with date-sec
25 # @vm-clock-sec: VM clock relative to boot in seconds
27 # @vm-clock-nsec: fractional part in nano seconds to be used with vm-clock-sec
29 # Since: 1.3
32 { 'struct': 'SnapshotInfo',
33   'data': { 'id': 'str', 'name': 'str', 'vm-state-size': 'int',
34             'date-sec': 'int', 'date-nsec': 'int',
35             'vm-clock-sec': 'int', 'vm-clock-nsec': 'int' } }
38 # @ImageInfoSpecificQCow2EncryptionBase:
40 # @format: The encryption format
42 # Since: 2.10
44 { 'struct': 'ImageInfoSpecificQCow2EncryptionBase',
45   'data': { 'format': 'BlockdevQcow2EncryptionFormat'}}
48 # @ImageInfoSpecificQCow2Encryption:
50 # Since: 2.10
52 { 'union': 'ImageInfoSpecificQCow2Encryption',
53   'base': 'ImageInfoSpecificQCow2EncryptionBase',
54   'discriminator': 'format',
55   'data': { 'aes': 'QCryptoBlockInfoQCow',
56             'luks': 'QCryptoBlockInfoLUKS' } }
59 # @ImageInfoSpecificQCow2:
61 # @compat: compatibility level
63 # @lazy-refcounts: on or off; only valid for compat >= 1.1
65 # @corrupt: true if the image has been marked corrupt; only valid for
66 #           compat >= 1.1 (since 2.2)
68 # @refcount-bits: width of a refcount entry in bits (since 2.3)
70 # @encrypt: details about encryption parameters; only set if image
71 #           is encrypted (since 2.10)
73 # Since: 1.7
75 { 'struct': 'ImageInfoSpecificQCow2',
76   'data': {
77       'compat': 'str',
78       '*lazy-refcounts': 'bool',
79       '*corrupt': 'bool',
80       'refcount-bits': 'int',
81       '*encrypt': 'ImageInfoSpecificQCow2Encryption'
82   } }
85 # @ImageInfoSpecificVmdk:
87 # @create-type: The create type of VMDK image
89 # @cid: Content id of image
91 # @parent-cid: Parent VMDK image's cid
93 # @extents: List of extent files
95 # Since: 1.7
97 { 'struct': 'ImageInfoSpecificVmdk',
98   'data': {
99       'create-type': 'str',
100       'cid': 'int',
101       'parent-cid': 'int',
102       'extents': ['ImageInfo']
103   } }
106 # @ImageInfoSpecific:
108 # A discriminated record of image format specific information structures.
110 # Since: 1.7
112 { 'union': 'ImageInfoSpecific',
113   'data': {
114       'qcow2': 'ImageInfoSpecificQCow2',
115       'vmdk': 'ImageInfoSpecificVmdk',
116       # If we need to add block driver specific parameters for
117       # LUKS in future, then we'll subclass QCryptoBlockInfoLUKS
118       # to define a ImageInfoSpecificLUKS
119       'luks': 'QCryptoBlockInfoLUKS'
120   } }
123 # @ImageInfo:
125 # Information about a QEMU image file
127 # @filename: name of the image file
129 # @format: format of the image file
131 # @virtual-size: maximum capacity in bytes of the image
133 # @actual-size: actual size on disk in bytes of the image
135 # @dirty-flag: true if image is not cleanly closed
137 # @cluster-size: size of a cluster in bytes
139 # @encrypted: true if the image is encrypted
141 # @compressed: true if the image is compressed (Since 1.7)
143 # @backing-filename: name of the backing file
145 # @full-backing-filename: full path of the backing file
147 # @backing-filename-format: the format of the backing file
149 # @snapshots: list of VM snapshots
151 # @backing-image: info of the backing image (since 1.6)
153 # @format-specific: structure supplying additional format-specific
154 # information (since 1.7)
156 # Since: 1.3
159 { 'struct': 'ImageInfo',
160   'data': {'filename': 'str', 'format': 'str', '*dirty-flag': 'bool',
161            '*actual-size': 'int', 'virtual-size': 'int',
162            '*cluster-size': 'int', '*encrypted': 'bool', '*compressed': 'bool',
163            '*backing-filename': 'str', '*full-backing-filename': 'str',
164            '*backing-filename-format': 'str', '*snapshots': ['SnapshotInfo'],
165            '*backing-image': 'ImageInfo',
166            '*format-specific': 'ImageInfoSpecific' } }
169 # @ImageCheck:
171 # Information about a QEMU image file check
173 # @filename: name of the image file checked
175 # @format: format of the image file checked
177 # @check-errors: number of unexpected errors occurred during check
179 # @image-end-offset: offset (in bytes) where the image ends, this
180 #                    field is present if the driver for the image format
181 #                    supports it
183 # @corruptions: number of corruptions found during the check if any
185 # @leaks: number of leaks found during the check if any
187 # @corruptions-fixed: number of corruptions fixed during the check
188 #                     if any
190 # @leaks-fixed: number of leaks fixed during the check if any
192 # @total-clusters: total number of clusters, this field is present
193 #                  if the driver for the image format supports it
195 # @allocated-clusters: total number of allocated clusters, this
196 #                      field is present if the driver for the image format
197 #                      supports it
199 # @fragmented-clusters: total number of fragmented clusters, this
200 #                       field is present if the driver for the image format
201 #                       supports it
203 # @compressed-clusters: total number of compressed clusters, this
204 #                       field is present if the driver for the image format
205 #                       supports it
207 # Since: 1.4
210 { 'struct': 'ImageCheck',
211   'data': {'filename': 'str', 'format': 'str', 'check-errors': 'int',
212            '*image-end-offset': 'int', '*corruptions': 'int', '*leaks': 'int',
213            '*corruptions-fixed': 'int', '*leaks-fixed': 'int',
214            '*total-clusters': 'int', '*allocated-clusters': 'int',
215            '*fragmented-clusters': 'int', '*compressed-clusters': 'int' } }
218 # @MapEntry:
220 # Mapping information from a virtual block range to a host file range
222 # @start: the start byte of the mapped virtual range
224 # @length: the number of bytes of the mapped virtual range
226 # @data: whether the mapped range has data
228 # @zero: whether the virtual blocks are zeroed
230 # @depth: the depth of the mapping
232 # @offset: the offset in file that the virtual sectors are mapped to
234 # @filename: filename that is referred to by @offset
236 # Since: 2.6
239 { 'struct': 'MapEntry',
240   'data': {'start': 'int', 'length': 'int', 'data': 'bool',
241            'zero': 'bool', 'depth': 'int', '*offset': 'int',
242            '*filename': 'str' } }
245 # @BlockdevCacheInfo:
247 # Cache mode information for a block device
249 # @writeback:   true if writeback mode is enabled
250 # @direct:      true if the host page cache is bypassed (O_DIRECT)
251 # @no-flush:    true if flush requests are ignored for the device
253 # Since: 2.3
255 { 'struct': 'BlockdevCacheInfo',
256   'data': { 'writeback': 'bool',
257             'direct': 'bool',
258             'no-flush': 'bool' } }
261 # @BlockDeviceInfo:
263 # Information about the backing device for a block device.
265 # @file: the filename of the backing device
267 # @node-name: the name of the block driver node (Since 2.0)
269 # @ro: true if the backing device was open read-only
271 # @drv: the name of the block format used to open the backing device. As of
272 #       0.14.0 this can be: 'blkdebug', 'bochs', 'cloop', 'cow', 'dmg',
273 #       'file', 'file', 'ftp', 'ftps', 'host_cdrom', 'host_device',
274 #       'http', 'https', 'luks', 'nbd', 'parallels', 'qcow',
275 #       'qcow2', 'raw', 'vdi', 'vmdk', 'vpc', 'vvfat'
276 #       2.2: 'archipelago' added, 'cow' dropped
277 #       2.3: 'host_floppy' deprecated
278 #       2.5: 'host_floppy' dropped
279 #       2.6: 'luks' added
280 #       2.8: 'replication' added, 'tftp' dropped
281 #       2.9: 'archipelago' dropped
283 # @backing_file: the name of the backing file (for copy-on-write)
285 # @backing_file_depth: number of files in the backing file chain (since: 1.2)
287 # @encrypted: true if the backing device is encrypted
289 # @encryption_key_missing: Deprecated; always false
291 # @detect_zeroes: detect and optimize zero writes (Since 2.1)
293 # @bps: total throughput limit in bytes per second is specified
295 # @bps_rd: read throughput limit in bytes per second is specified
297 # @bps_wr: write throughput limit in bytes per second is specified
299 # @iops: total I/O operations per second is specified
301 # @iops_rd: read I/O operations per second is specified
303 # @iops_wr: write I/O operations per second is specified
305 # @image: the info of image used (since: 1.6)
307 # @bps_max: total throughput limit during bursts,
308 #                     in bytes (Since 1.7)
310 # @bps_rd_max: read throughput limit during bursts,
311 #                        in bytes (Since 1.7)
313 # @bps_wr_max: write throughput limit during bursts,
314 #                        in bytes (Since 1.7)
316 # @iops_max: total I/O operations per second during bursts,
317 #                      in bytes (Since 1.7)
319 # @iops_rd_max: read I/O operations per second during bursts,
320 #                         in bytes (Since 1.7)
322 # @iops_wr_max: write I/O operations per second during bursts,
323 #                         in bytes (Since 1.7)
325 # @bps_max_length: maximum length of the @bps_max burst
326 #                            period, in seconds. (Since 2.6)
328 # @bps_rd_max_length: maximum length of the @bps_rd_max
329 #                               burst period, in seconds. (Since 2.6)
331 # @bps_wr_max_length: maximum length of the @bps_wr_max
332 #                               burst period, in seconds. (Since 2.6)
334 # @iops_max_length: maximum length of the @iops burst
335 #                             period, in seconds. (Since 2.6)
337 # @iops_rd_max_length: maximum length of the @iops_rd_max
338 #                                burst period, in seconds. (Since 2.6)
340 # @iops_wr_max_length: maximum length of the @iops_wr_max
341 #                                burst period, in seconds. (Since 2.6)
343 # @iops_size: an I/O size in bytes (Since 1.7)
345 # @group: throttle group name (Since 2.4)
347 # @cache: the cache mode used for the block device (since: 2.3)
349 # @write_threshold: configured write threshold for the device.
350 #                   0 if disabled. (Since 2.3)
352 # Since: 0.14.0
355 { 'struct': 'BlockDeviceInfo',
356   'data': { 'file': 'str', '*node-name': 'str', 'ro': 'bool', 'drv': 'str',
357             '*backing_file': 'str', 'backing_file_depth': 'int',
358             'encrypted': 'bool', 'encryption_key_missing': 'bool',
359             'detect_zeroes': 'BlockdevDetectZeroesOptions',
360             'bps': 'int', 'bps_rd': 'int', 'bps_wr': 'int',
361             'iops': 'int', 'iops_rd': 'int', 'iops_wr': 'int',
362             'image': 'ImageInfo',
363             '*bps_max': 'int', '*bps_rd_max': 'int',
364             '*bps_wr_max': 'int', '*iops_max': 'int',
365             '*iops_rd_max': 'int', '*iops_wr_max': 'int',
366             '*bps_max_length': 'int', '*bps_rd_max_length': 'int',
367             '*bps_wr_max_length': 'int', '*iops_max_length': 'int',
368             '*iops_rd_max_length': 'int', '*iops_wr_max_length': 'int',
369             '*iops_size': 'int', '*group': 'str', 'cache': 'BlockdevCacheInfo',
370             'write_threshold': 'int' } }
373 # @BlockDeviceIoStatus:
375 # An enumeration of block device I/O status.
377 # @ok: The last I/O operation has succeeded
379 # @failed: The last I/O operation has failed
381 # @nospace: The last I/O operation has failed due to a no-space condition
383 # Since: 1.0
385 { 'enum': 'BlockDeviceIoStatus', 'data': [ 'ok', 'failed', 'nospace' ] }
388 # @BlockDeviceMapEntry:
390 # Entry in the metadata map of the device (returned by "qemu-img map")
392 # @start: Offset in the image of the first byte described by this entry
393 #         (in bytes)
395 # @length: Length of the range described by this entry (in bytes)
397 # @depth: Number of layers (0 = top image, 1 = top image's backing file, etc.)
398 #         before reaching one for which the range is allocated.  The value is
399 #         in the range 0 to the depth of the image chain - 1.
401 # @zero: the sectors in this range read as zeros
403 # @data: reading the image will actually read data from a file (in particular,
404 #        if @offset is present this means that the sectors are not simply
405 #        preallocated, but contain actual data in raw format)
407 # @offset: if present, the image file stores the data for this range in
408 #          raw format at the given offset.
410 # Since: 1.7
412 { 'struct': 'BlockDeviceMapEntry',
413   'data': { 'start': 'int', 'length': 'int', 'depth': 'int', 'zero': 'bool',
414             'data': 'bool', '*offset': 'int' } }
417 # @DirtyBitmapStatus:
419 # An enumeration of possible states that a dirty bitmap can report to the user.
421 # @frozen: The bitmap is currently in-use by a backup operation or block job,
422 #          and is immutable.
424 # @disabled: The bitmap is currently in-use by an internal operation and is
425 #            read-only. It can still be deleted.
427 # @active: The bitmap is actively monitoring for new writes, and can be cleared,
428 #          deleted, or used for backup operations.
430 # @locked: The bitmap is currently in-use by some operation and can not be
431 #          cleared, deleted, or used for backup operations. (Since 2.12)
433 # Since: 2.4
435 { 'enum': 'DirtyBitmapStatus',
436   'data': ['active', 'disabled', 'frozen', 'locked'] }
439 # @BlockDirtyInfo:
441 # Block dirty bitmap information.
443 # @name: the name of the dirty bitmap (Since 2.4)
445 # @count: number of dirty bytes according to the dirty bitmap
447 # @granularity: granularity of the dirty bitmap in bytes (since 1.4)
449 # @status: current status of the dirty bitmap (since 2.4)
451 # Since: 1.3
453 { 'struct': 'BlockDirtyInfo',
454   'data': {'*name': 'str', 'count': 'int', 'granularity': 'uint32',
455            'status': 'DirtyBitmapStatus'} }
458 # @BlockLatencyHistogramInfo:
460 # Block latency histogram.
462 # @boundaries: list of interval boundary values in nanoseconds, all greater
463 #              than zero and in ascending order.
464 #              For example, the list [10, 50, 100] produces the following
465 #              histogram intervals: [0, 10), [10, 50), [50, 100), [100, +inf).
467 # @bins: list of io request counts corresponding to histogram intervals.
468 #        len(@bins) = len(@boundaries) + 1
469 #        For the example above, @bins may be something like [3, 1, 5, 2],
470 #        and corresponding histogram looks like:
472 #        5|           *
473 #        4|           *
474 #        3| *         *
475 #        2| *         *    *
476 #        1| *    *    *    *
477 #         +------------------
478 #             10   50   100
480 # Since: 2.12
482 { 'struct': 'BlockLatencyHistogramInfo',
483   'data': {'boundaries': ['uint64'], 'bins': ['uint64'] } }
486 # @x-block-latency-histogram-set:
488 # Manage read, write and flush latency histograms for the device.
490 # If only @device parameter is specified, remove all present latency histograms
491 # for the device. Otherwise, add/reset some of (or all) latency histograms.
493 # @device: device name to set latency histogram for.
495 # @boundaries: list of interval boundary values (see description in
496 #              BlockLatencyHistogramInfo definition). If specified, all
497 #              latency histograms are removed, and empty ones created for all
498 #              io types with intervals corresponding to @boundaries (except for
499 #              io types, for which specific boundaries are set through the
500 #              following parameters).
502 # @boundaries-read: list of interval boundary values for read latency
503 #                   histogram. If specified, old read latency histogram is
504 #                   removed, and empty one created with intervals
505 #                   corresponding to @boundaries-read. The parameter has higher
506 #                   priority then @boundaries.
508 # @boundaries-write: list of interval boundary values for write latency
509 #                    histogram.
511 # @boundaries-flush: list of interval boundary values for flush latency
512 #                    histogram.
514 # Returns: error if device is not found or any boundary arrays are invalid.
516 # Since: 2.12
518 # Example: set new histograms for all io types with intervals
519 # [0, 10), [10, 50), [50, 100), [100, +inf):
521 # -> { "execute": "block-latency-histogram-set",
522 #      "arguments": { "device": "drive0",
523 #                     "boundaries": [10, 50, 100] } }
524 # <- { "return": {} }
526 # Example: set new histogram only for write, other histograms will remain
527 # not changed (or not created):
529 # -> { "execute": "block-latency-histogram-set",
530 #      "arguments": { "device": "drive0",
531 #                     "boundaries-write": [10, 50, 100] } }
532 # <- { "return": {} }
534 # Example: set new histograms with the following intervals:
535 #   read, flush: [0, 10), [10, 50), [50, 100), [100, +inf)
536 #   write: [0, 1000), [1000, 5000), [5000, +inf)
538 # -> { "execute": "block-latency-histogram-set",
539 #      "arguments": { "device": "drive0",
540 #                     "boundaries": [10, 50, 100],
541 #                     "boundaries-write": [1000, 5000] } }
542 # <- { "return": {} }
544 # Example: remove all latency histograms:
546 # -> { "execute": "block-latency-histogram-set",
547 #      "arguments": { "device": "drive0" } }
548 # <- { "return": {} }
550 { 'command': 'x-block-latency-histogram-set',
551   'data': {'device': 'str',
552            '*boundaries': ['uint64'],
553            '*boundaries-read': ['uint64'],
554            '*boundaries-write': ['uint64'],
555            '*boundaries-flush': ['uint64'] } }
558 # @BlockInfo:
560 # Block device information.  This structure describes a virtual device and
561 # the backing device associated with it.
563 # @device: The device name associated with the virtual device.
565 # @qdev: The qdev ID, or if no ID is assigned, the QOM path of the block
566 #        device. (since 2.10)
568 # @type: This field is returned only for compatibility reasons, it should
569 #        not be used (always returns 'unknown')
571 # @removable: True if the device supports removable media.
573 # @locked: True if the guest has locked this device from having its media
574 #          removed
576 # @tray_open: True if the device's tray is open
577 #             (only present if it has a tray)
579 # @dirty-bitmaps: dirty bitmaps information (only present if the
580 #                 driver has one or more dirty bitmaps) (Since 2.0)
582 # @io-status: @BlockDeviceIoStatus. Only present if the device
583 #             supports it and the VM is configured to stop on errors
584 #             (supported device models: virtio-blk, IDE, SCSI except
585 #             scsi-generic)
587 # @inserted: @BlockDeviceInfo describing the device if media is
588 #            present
590 # Since:  0.14.0
592 { 'struct': 'BlockInfo',
593   'data': {'device': 'str', '*qdev': 'str', 'type': 'str', 'removable': 'bool',
594            'locked': 'bool', '*inserted': 'BlockDeviceInfo',
595            '*tray_open': 'bool', '*io-status': 'BlockDeviceIoStatus',
596            '*dirty-bitmaps': ['BlockDirtyInfo'] } }
599 # @BlockMeasureInfo:
601 # Image file size calculation information.  This structure describes the size
602 # requirements for creating a new image file.
604 # The size requirements depend on the new image file format.  File size always
605 # equals virtual disk size for the 'raw' format, even for sparse POSIX files.
606 # Compact formats such as 'qcow2' represent unallocated and zero regions
607 # efficiently so file size may be smaller than virtual disk size.
609 # The values are upper bounds that are guaranteed to fit the new image file.
610 # Subsequent modification, such as internal snapshot or bitmap creation, may
611 # require additional space and is not covered here.
613 # @required: Size required for a new image file, in bytes.
615 # @fully-allocated: Image file size, in bytes, once data has been written
616 #                   to all sectors.
618 # Since: 2.10
620 { 'struct': 'BlockMeasureInfo',
621   'data': {'required': 'int', 'fully-allocated': 'int'} }
624 # @query-block:
626 # Get a list of BlockInfo for all virtual block devices.
628 # Returns: a list of @BlockInfo describing each virtual block device. Filter
629 # nodes that were created implicitly are skipped over.
631 # Since: 0.14.0
633 # Example:
635 # -> { "execute": "query-block" }
636 # <- {
637 #       "return":[
638 #          {
639 #             "io-status": "ok",
640 #             "device":"ide0-hd0",
641 #             "locked":false,
642 #             "removable":false,
643 #             "inserted":{
644 #                "ro":false,
645 #                "drv":"qcow2",
646 #                "encrypted":false,
647 #                "file":"disks/test.qcow2",
648 #                "backing_file_depth":1,
649 #                "bps":1000000,
650 #                "bps_rd":0,
651 #                "bps_wr":0,
652 #                "iops":1000000,
653 #                "iops_rd":0,
654 #                "iops_wr":0,
655 #                "bps_max": 8000000,
656 #                "bps_rd_max": 0,
657 #                "bps_wr_max": 0,
658 #                "iops_max": 0,
659 #                "iops_rd_max": 0,
660 #                "iops_wr_max": 0,
661 #                "iops_size": 0,
662 #                "detect_zeroes": "on",
663 #                "write_threshold": 0,
664 #                "image":{
665 #                   "filename":"disks/test.qcow2",
666 #                   "format":"qcow2",
667 #                   "virtual-size":2048000,
668 #                   "backing_file":"base.qcow2",
669 #                   "full-backing-filename":"disks/base.qcow2",
670 #                   "backing-filename-format":"qcow2",
671 #                   "snapshots":[
672 #                      {
673 #                         "id": "1",
674 #                         "name": "snapshot1",
675 #                         "vm-state-size": 0,
676 #                         "date-sec": 10000200,
677 #                         "date-nsec": 12,
678 #                         "vm-clock-sec": 206,
679 #                         "vm-clock-nsec": 30
680 #                      }
681 #                   ],
682 #                   "backing-image":{
683 #                       "filename":"disks/base.qcow2",
684 #                       "format":"qcow2",
685 #                       "virtual-size":2048000
686 #                   }
687 #                }
688 #             },
689 #             "qdev": "ide_disk",
690 #             "type":"unknown"
691 #          },
692 #          {
693 #             "io-status": "ok",
694 #             "device":"ide1-cd0",
695 #             "locked":false,
696 #             "removable":true,
697 #             "qdev": "/machine/unattached/device[23]",
698 #             "tray_open": false,
699 #             "type":"unknown"
700 #          },
701 #          {
702 #             "device":"floppy0",
703 #             "locked":false,
704 #             "removable":true,
705 #             "qdev": "/machine/unattached/device[20]",
706 #             "type":"unknown"
707 #          },
708 #          {
709 #             "device":"sd0",
710 #             "locked":false,
711 #             "removable":true,
712 #             "type":"unknown"
713 #          }
714 #       ]
715 #    }
718 { 'command': 'query-block', 'returns': ['BlockInfo'] }
722 # @BlockDeviceTimedStats:
724 # Statistics of a block device during a given interval of time.
726 # @interval_length: Interval used for calculating the statistics,
727 #                   in seconds.
729 # @min_rd_latency_ns: Minimum latency of read operations in the
730 #                     defined interval, in nanoseconds.
732 # @min_wr_latency_ns: Minimum latency of write operations in the
733 #                     defined interval, in nanoseconds.
735 # @min_flush_latency_ns: Minimum latency of flush operations in the
736 #                        defined interval, in nanoseconds.
738 # @max_rd_latency_ns: Maximum latency of read operations in the
739 #                     defined interval, in nanoseconds.
741 # @max_wr_latency_ns: Maximum latency of write operations in the
742 #                     defined interval, in nanoseconds.
744 # @max_flush_latency_ns: Maximum latency of flush operations in the
745 #                        defined interval, in nanoseconds.
747 # @avg_rd_latency_ns: Average latency of read operations in the
748 #                     defined interval, in nanoseconds.
750 # @avg_wr_latency_ns: Average latency of write operations in the
751 #                     defined interval, in nanoseconds.
753 # @avg_flush_latency_ns: Average latency of flush operations in the
754 #                        defined interval, in nanoseconds.
756 # @avg_rd_queue_depth: Average number of pending read operations
757 #                      in the defined interval.
759 # @avg_wr_queue_depth: Average number of pending write operations
760 #                      in the defined interval.
762 # Since: 2.5
764 { 'struct': 'BlockDeviceTimedStats',
765   'data': { 'interval_length': 'int', 'min_rd_latency_ns': 'int',
766             'max_rd_latency_ns': 'int', 'avg_rd_latency_ns': 'int',
767             'min_wr_latency_ns': 'int', 'max_wr_latency_ns': 'int',
768             'avg_wr_latency_ns': 'int', 'min_flush_latency_ns': 'int',
769             'max_flush_latency_ns': 'int', 'avg_flush_latency_ns': 'int',
770             'avg_rd_queue_depth': 'number', 'avg_wr_queue_depth': 'number' } }
773 # @BlockDeviceStats:
775 # Statistics of a virtual block device or a block backing device.
777 # @rd_bytes:      The number of bytes read by the device.
779 # @wr_bytes:      The number of bytes written by the device.
781 # @rd_operations: The number of read operations performed by the device.
783 # @wr_operations: The number of write operations performed by the device.
785 # @flush_operations: The number of cache flush operations performed by the
786 #                    device (since 0.15.0)
788 # @flush_total_time_ns: Total time spend on cache flushes in nano-seconds
789 #                       (since 0.15.0).
791 # @wr_total_time_ns: Total time spend on writes in nano-seconds (since 0.15.0).
793 # @rd_total_time_ns: Total_time_spend on reads in nano-seconds (since 0.15.0).
795 # @wr_highest_offset: The offset after the greatest byte written to the
796 #                     device.  The intended use of this information is for
797 #                     growable sparse files (like qcow2) that are used on top
798 #                     of a physical device.
800 # @rd_merged: Number of read requests that have been merged into another
801 #             request (Since 2.3).
803 # @wr_merged: Number of write requests that have been merged into another
804 #             request (Since 2.3).
806 # @idle_time_ns: Time since the last I/O operation, in
807 #                nanoseconds. If the field is absent it means that
808 #                there haven't been any operations yet (Since 2.5).
810 # @failed_rd_operations: The number of failed read operations
811 #                        performed by the device (Since 2.5)
813 # @failed_wr_operations: The number of failed write operations
814 #                        performed by the device (Since 2.5)
816 # @failed_flush_operations: The number of failed flush operations
817 #                           performed by the device (Since 2.5)
819 # @invalid_rd_operations: The number of invalid read operations
820 #                          performed by the device (Since 2.5)
822 # @invalid_wr_operations: The number of invalid write operations
823 #                         performed by the device (Since 2.5)
825 # @invalid_flush_operations: The number of invalid flush operations
826 #                            performed by the device (Since 2.5)
828 # @account_invalid: Whether invalid operations are included in the
829 #                   last access statistics (Since 2.5)
831 # @account_failed: Whether failed operations are included in the
832 #                  latency and last access statistics (Since 2.5)
834 # @timed_stats: Statistics specific to the set of previously defined
835 #               intervals of time (Since 2.5)
837 # @x_rd_latency_histogram: @BlockLatencyHistogramInfo. (Since 2.12)
839 # @x_wr_latency_histogram: @BlockLatencyHistogramInfo. (Since 2.12)
841 # @x_flush_latency_histogram: @BlockLatencyHistogramInfo. (Since 2.12)
843 # Since: 0.14.0
845 { 'struct': 'BlockDeviceStats',
846   'data': {'rd_bytes': 'int', 'wr_bytes': 'int', 'rd_operations': 'int',
847            'wr_operations': 'int', 'flush_operations': 'int',
848            'flush_total_time_ns': 'int', 'wr_total_time_ns': 'int',
849            'rd_total_time_ns': 'int', 'wr_highest_offset': 'int',
850            'rd_merged': 'int', 'wr_merged': 'int', '*idle_time_ns': 'int',
851            'failed_rd_operations': 'int', 'failed_wr_operations': 'int',
852            'failed_flush_operations': 'int', 'invalid_rd_operations': 'int',
853            'invalid_wr_operations': 'int', 'invalid_flush_operations': 'int',
854            'account_invalid': 'bool', 'account_failed': 'bool',
855            'timed_stats': ['BlockDeviceTimedStats'],
856            '*x_rd_latency_histogram': 'BlockLatencyHistogramInfo',
857            '*x_wr_latency_histogram': 'BlockLatencyHistogramInfo',
858            '*x_flush_latency_histogram': 'BlockLatencyHistogramInfo' } }
861 # @BlockStats:
863 # Statistics of a virtual block device or a block backing device.
865 # @device: If the stats are for a virtual block device, the name
866 #          corresponding to the virtual block device.
868 # @node-name: The node name of the device. (Since 2.3)
870 # @stats:  A @BlockDeviceStats for the device.
872 # @parent: This describes the file block device if it has one.
873 #          Contains recursively the statistics of the underlying
874 #          protocol (e.g. the host file for a qcow2 image). If there is
875 #          no underlying protocol, this field is omitted
877 # @backing: This describes the backing block device if it has one.
878 #           (Since 2.0)
880 # Since: 0.14.0
882 { 'struct': 'BlockStats',
883   'data': {'*device': 'str', '*node-name': 'str',
884            'stats': 'BlockDeviceStats',
885            '*parent': 'BlockStats',
886            '*backing': 'BlockStats'} }
889 # @query-blockstats:
891 # Query the @BlockStats for all virtual block devices.
893 # @query-nodes: If true, the command will query all the block nodes
894 #               that have a node name, in a list which will include "parent"
895 #               information, but not "backing".
896 #               If false or omitted, the behavior is as before - query all the
897 #               device backends, recursively including their "parent" and
898 #               "backing". Filter nodes that were created implicitly are
899 #               skipped over in this mode. (Since 2.3)
901 # Returns: A list of @BlockStats for each virtual block devices.
903 # Since: 0.14.0
905 # Example:
907 # -> { "execute": "query-blockstats" }
908 # <- {
909 #       "return":[
910 #          {
911 #             "device":"ide0-hd0",
912 #             "parent":{
913 #                "stats":{
914 #                   "wr_highest_offset":3686448128,
915 #                   "wr_bytes":9786368,
916 #                   "wr_operations":751,
917 #                   "rd_bytes":122567168,
918 #                   "rd_operations":36772
919 #                   "wr_total_times_ns":313253456
920 #                   "rd_total_times_ns":3465673657
921 #                   "flush_total_times_ns":49653
922 #                   "flush_operations":61,
923 #                   "rd_merged":0,
924 #                   "wr_merged":0,
925 #                   "idle_time_ns":2953431879,
926 #                   "account_invalid":true,
927 #                   "account_failed":false
928 #                }
929 #             },
930 #             "stats":{
931 #                "wr_highest_offset":2821110784,
932 #                "wr_bytes":9786368,
933 #                "wr_operations":692,
934 #                "rd_bytes":122739200,
935 #                "rd_operations":36604
936 #                "flush_operations":51,
937 #                "wr_total_times_ns":313253456
938 #                "rd_total_times_ns":3465673657
939 #                "flush_total_times_ns":49653,
940 #                "rd_merged":0,
941 #                "wr_merged":0,
942 #                "idle_time_ns":2953431879,
943 #                "account_invalid":true,
944 #                "account_failed":false
945 #             }
946 #          },
947 #          {
948 #             "device":"ide1-cd0",
949 #             "stats":{
950 #                "wr_highest_offset":0,
951 #                "wr_bytes":0,
952 #                "wr_operations":0,
953 #                "rd_bytes":0,
954 #                "rd_operations":0
955 #                "flush_operations":0,
956 #                "wr_total_times_ns":0
957 #                "rd_total_times_ns":0
958 #                "flush_total_times_ns":0,
959 #                "rd_merged":0,
960 #                "wr_merged":0,
961 #                "account_invalid":false,
962 #                "account_failed":false
963 #             }
964 #          },
965 #          {
966 #             "device":"floppy0",
967 #             "stats":{
968 #                "wr_highest_offset":0,
969 #                "wr_bytes":0,
970 #                "wr_operations":0,
971 #                "rd_bytes":0,
972 #                "rd_operations":0
973 #                "flush_operations":0,
974 #                "wr_total_times_ns":0
975 #                "rd_total_times_ns":0
976 #                "flush_total_times_ns":0,
977 #                "rd_merged":0,
978 #                "wr_merged":0,
979 #                "account_invalid":false,
980 #                "account_failed":false
981 #             }
982 #          },
983 #          {
984 #             "device":"sd0",
985 #             "stats":{
986 #                "wr_highest_offset":0,
987 #                "wr_bytes":0,
988 #                "wr_operations":0,
989 #                "rd_bytes":0,
990 #                "rd_operations":0
991 #                "flush_operations":0,
992 #                "wr_total_times_ns":0
993 #                "rd_total_times_ns":0
994 #                "flush_total_times_ns":0,
995 #                "rd_merged":0,
996 #                "wr_merged":0,
997 #                "account_invalid":false,
998 #                "account_failed":false
999 #             }
1000 #          }
1001 #       ]
1002 #    }
1005 { 'command': 'query-blockstats',
1006   'data': { '*query-nodes': 'bool' },
1007   'returns': ['BlockStats'] }
1010 # @BlockdevOnError:
1012 # An enumeration of possible behaviors for errors on I/O operations.
1013 # The exact meaning depends on whether the I/O was initiated by a guest
1014 # or by a block job
1016 # @report: for guest operations, report the error to the guest;
1017 #          for jobs, cancel the job
1019 # @ignore: ignore the error, only report a QMP event (BLOCK_IO_ERROR
1020 #          or BLOCK_JOB_ERROR)
1022 # @enospc: same as @stop on ENOSPC, same as @report otherwise.
1024 # @stop: for guest operations, stop the virtual machine;
1025 #        for jobs, pause the job
1027 # @auto: inherit the error handling policy of the backend (since: 2.7)
1029 # Since: 1.3
1031 { 'enum': 'BlockdevOnError',
1032   'data': ['report', 'ignore', 'enospc', 'stop', 'auto'] }
1035 # @MirrorSyncMode:
1037 # An enumeration of possible behaviors for the initial synchronization
1038 # phase of storage mirroring.
1040 # @top: copies data in the topmost image to the destination
1042 # @full: copies data from all images to the destination
1044 # @none: only copy data written from now on
1046 # @incremental: only copy data described by the dirty bitmap. Since: 2.4
1048 # Since: 1.3
1050 { 'enum': 'MirrorSyncMode',
1051   'data': ['top', 'full', 'none', 'incremental'] }
1054 # @MirrorCopyMode:
1056 # An enumeration whose values tell the mirror block job when to
1057 # trigger writes to the target.
1059 # @background: copy data in background only.
1061 # @write-blocking: when data is written to the source, write it
1062 #                  (synchronously) to the target as well.  In
1063 #                  addition, data is copied in background just like in
1064 #                  @background mode.
1066 # Since: 3.0
1068 { 'enum': 'MirrorCopyMode',
1069   'data': ['background', 'write-blocking'] }
1072 # @BlockJobInfo:
1074 # Information about a long-running block device operation.
1076 # @type: the job type ('stream' for image streaming)
1078 # @device: The job identifier. Originally the device name but other
1079 #          values are allowed since QEMU 2.7
1081 # @len: Estimated @offset value at the completion of the job. This value can
1082 #       arbitrarily change while the job is running, in both directions.
1084 # @offset: Progress made until now. The unit is arbitrary and the value can
1085 #          only meaningfully be used for the ratio of @offset to @len. The
1086 #          value is monotonically increasing.
1088 # @busy: false if the job is known to be in a quiescent state, with
1089 #        no pending I/O.  Since 1.3.
1091 # @paused: whether the job is paused or, if @busy is true, will
1092 #          pause itself as soon as possible.  Since 1.3.
1094 # @speed: the rate limit, bytes per second
1096 # @io-status: the status of the job (since 1.3)
1098 # @ready: true if the job may be completed (since 2.2)
1100 # @status: Current job state/status (since 2.12)
1102 # @auto-finalize: Job will finalize itself when PENDING, moving to
1103 #                 the CONCLUDED state. (since 2.12)
1105 # @auto-dismiss: Job will dismiss itself when CONCLUDED, moving to the NULL
1106 #                state and disappearing from the query list. (since 2.12)
1108 # @error: Error information if the job did not complete successfully.
1109 #         Not set if the job completed successfully. (since 2.12.1)
1111 # Since: 1.1
1113 { 'struct': 'BlockJobInfo',
1114   'data': {'type': 'str', 'device': 'str', 'len': 'int',
1115            'offset': 'int', 'busy': 'bool', 'paused': 'bool', 'speed': 'int',
1116            'io-status': 'BlockDeviceIoStatus', 'ready': 'bool',
1117            'status': 'JobStatus',
1118            'auto-finalize': 'bool', 'auto-dismiss': 'bool',
1119            '*error': 'str' } }
1122 # @query-block-jobs:
1124 # Return information about long-running block device operations.
1126 # Returns: a list of @BlockJobInfo for each active block job
1128 # Since: 1.1
1130 { 'command': 'query-block-jobs', 'returns': ['BlockJobInfo'] }
1133 # @block_passwd:
1135 # This command sets the password of a block device that has not been open
1136 # with a password and requires one.
1138 # This command is now obsolete and will always return an error since 2.10
1141 { 'command': 'block_passwd', 'data': {'*device': 'str',
1142                                       '*node-name': 'str', 'password': 'str'} }
1145 # @block_resize:
1147 # Resize a block image while a guest is running.
1149 # Either @device or @node-name must be set but not both.
1151 # @device: the name of the device to get the image resized
1153 # @node-name: graph node name to get the image resized (Since 2.0)
1155 # @size:  new image size in bytes
1157 # Returns: nothing on success
1158 #          If @device is not a valid block device, DeviceNotFound
1160 # Since: 0.14.0
1162 # Example:
1164 # -> { "execute": "block_resize",
1165 #      "arguments": { "device": "scratch", "size": 1073741824 } }
1166 # <- { "return": {} }
1169 { 'command': 'block_resize', 'data': { '*device': 'str',
1170                                        '*node-name': 'str',
1171                                        'size': 'int' }}
1174 # @NewImageMode:
1176 # An enumeration that tells QEMU how to set the backing file path in
1177 # a new image file.
1179 # @existing: QEMU should look for an existing image file.
1181 # @absolute-paths: QEMU should create a new image with absolute paths
1182 # for the backing file. If there is no backing file available, the new
1183 # image will not be backed either.
1185 # Since: 1.1
1187 { 'enum': 'NewImageMode',
1188   'data': [ 'existing', 'absolute-paths' ] }
1191 # @BlockdevSnapshotSync:
1193 # Either @device or @node-name must be set but not both.
1195 # @device: the name of the device to generate the snapshot from.
1197 # @node-name: graph node name to generate the snapshot from (Since 2.0)
1199 # @snapshot-file: the target of the new image. If the file exists, or
1200 # if it is a device, the snapshot will be created in the existing
1201 # file/device. Otherwise, a new file will be created.
1203 # @snapshot-node-name: the graph node name of the new image (Since 2.0)
1205 # @format: the format of the snapshot image, default is 'qcow2'.
1207 # @mode: whether and how QEMU should create a new image, default is
1208 #        'absolute-paths'.
1210 { 'struct': 'BlockdevSnapshotSync',
1211   'data': { '*device': 'str', '*node-name': 'str',
1212             'snapshot-file': 'str', '*snapshot-node-name': 'str',
1213             '*format': 'str', '*mode': 'NewImageMode' } }
1216 # @BlockdevSnapshot:
1218 # @node: device or node name that will have a snapshot created.
1220 # @overlay: reference to the existing block device that will become
1221 #           the overlay of @node, as part of creating the snapshot.
1222 #           It must not have a current backing file (this can be
1223 #           achieved by passing "backing": null to blockdev-add).
1225 # Since: 2.5
1227 { 'struct': 'BlockdevSnapshot',
1228   'data': { 'node': 'str', 'overlay': 'str' } }
1231 # @DriveBackup:
1233 # @job-id: identifier for the newly-created block job. If
1234 #          omitted, the device name will be used. (Since 2.7)
1236 # @device: the device name or node-name of a root node which should be copied.
1238 # @target: the target of the new image. If the file exists, or if it
1239 #          is a device, the existing file/device will be used as the new
1240 #          destination.  If it does not exist, a new file will be created.
1242 # @format: the format of the new destination, default is to
1243 #          probe if @mode is 'existing', else the format of the source
1245 # @sync: what parts of the disk image should be copied to the destination
1246 #        (all the disk, only the sectors allocated in the topmost image, from a
1247 #        dirty bitmap, or only new I/O).
1249 # @mode: whether and how QEMU should create a new image, default is
1250 #        'absolute-paths'.
1252 # @speed: the maximum speed, in bytes per second
1254 # @bitmap: the name of dirty bitmap if sync is "incremental".
1255 #          Must be present if sync is "incremental", must NOT be present
1256 #          otherwise. (Since 2.4)
1258 # @compress: true to compress data, if the target format supports it.
1259 #            (default: false) (since 2.8)
1261 # @on-source-error: the action to take on an error on the source,
1262 #                   default 'report'.  'stop' and 'enospc' can only be used
1263 #                   if the block device supports io-status (see BlockInfo).
1265 # @on-target-error: the action to take on an error on the target,
1266 #                   default 'report' (no limitations, since this applies to
1267 #                   a different block device than @device).
1269 # @auto-finalize: When false, this job will wait in a PENDING state after it has
1270 #                 finished its work, waiting for @block-job-finalize.
1271 #                 When true, this job will automatically perform its abort or
1272 #                 commit actions.
1273 #                 Defaults to true. (Since 2.12)
1275 # @auto-dismiss: When false, this job will wait in a CONCLUDED state after it
1276 #                has completed ceased all work, and wait for @block-job-dismiss.
1277 #                When true, this job will automatically disappear from the query
1278 #                list without user intervention.
1279 #                Defaults to true. (Since 2.12)
1281 # Note: @on-source-error and @on-target-error only affect background
1282 # I/O.  If an error occurs during a guest write request, the device's
1283 # rerror/werror actions will be used.
1285 # Since: 1.6
1287 { 'struct': 'DriveBackup',
1288   'data': { '*job-id': 'str', 'device': 'str', 'target': 'str',
1289             '*format': 'str', 'sync': 'MirrorSyncMode',
1290             '*mode': 'NewImageMode', '*speed': 'int',
1291             '*bitmap': 'str', '*compress': 'bool',
1292             '*on-source-error': 'BlockdevOnError',
1293             '*on-target-error': 'BlockdevOnError',
1294             '*auto-finalize': 'bool', '*auto-dismiss': 'bool' } }
1297 # @BlockdevBackup:
1299 # @job-id: identifier for the newly-created block job. If
1300 #          omitted, the device name will be used. (Since 2.7)
1302 # @device: the device name or node-name of a root node which should be copied.
1304 # @target: the device name or node-name of the backup target node.
1306 # @sync: what parts of the disk image should be copied to the destination
1307 #        (all the disk, only the sectors allocated in the topmost image, or
1308 #        only new I/O).
1310 # @speed: the maximum speed, in bytes per second. The default is 0,
1311 #         for unlimited.
1313 # @compress: true to compress data, if the target format supports it.
1314 #            (default: false) (since 2.8)
1316 # @on-source-error: the action to take on an error on the source,
1317 #                   default 'report'.  'stop' and 'enospc' can only be used
1318 #                   if the block device supports io-status (see BlockInfo).
1320 # @on-target-error: the action to take on an error on the target,
1321 #                   default 'report' (no limitations, since this applies to
1322 #                   a different block device than @device).
1324 # @auto-finalize: When false, this job will wait in a PENDING state after it has
1325 #                 finished its work, waiting for @block-job-finalize.
1326 #                 When true, this job will automatically perform its abort or
1327 #                 commit actions.
1328 #                 Defaults to true. (Since 2.12)
1330 # @auto-dismiss: When false, this job will wait in a CONCLUDED state after it
1331 #                has completed ceased all work, and wait for @block-job-dismiss.
1332 #                When true, this job will automatically disappear from the query
1333 #                list without user intervention.
1334 #                Defaults to true. (Since 2.12)
1336 # Note: @on-source-error and @on-target-error only affect background
1337 # I/O.  If an error occurs during a guest write request, the device's
1338 # rerror/werror actions will be used.
1340 # Since: 2.3
1342 { 'struct': 'BlockdevBackup',
1343   'data': { '*job-id': 'str', 'device': 'str', 'target': 'str',
1344             'sync': 'MirrorSyncMode', '*speed': 'int', '*compress': 'bool',
1345             '*on-source-error': 'BlockdevOnError',
1346             '*on-target-error': 'BlockdevOnError',
1347             '*auto-finalize': 'bool', '*auto-dismiss': 'bool' } }
1350 # @blockdev-snapshot-sync:
1352 # Generates a synchronous snapshot of a block device.
1354 # For the arguments, see the documentation of BlockdevSnapshotSync.
1356 # Returns: nothing on success
1357 #          If @device is not a valid block device, DeviceNotFound
1359 # Since: 0.14.0
1361 # Example:
1363 # -> { "execute": "blockdev-snapshot-sync",
1364 #      "arguments": { "device": "ide-hd0",
1365 #                     "snapshot-file":
1366 #                     "/some/place/my-image",
1367 #                     "format": "qcow2" } }
1368 # <- { "return": {} }
1371 { 'command': 'blockdev-snapshot-sync',
1372   'data': 'BlockdevSnapshotSync' }
1376 # @blockdev-snapshot:
1378 # Generates a snapshot of a block device.
1380 # Create a snapshot, by installing 'node' as the backing image of
1381 # 'overlay'. Additionally, if 'node' is associated with a block
1382 # device, the block device changes to using 'overlay' as its new active
1383 # image.
1385 # For the arguments, see the documentation of BlockdevSnapshot.
1387 # Since: 2.5
1389 # Example:
1391 # -> { "execute": "blockdev-add",
1392 #      "arguments": { "driver": "qcow2",
1393 #                     "node-name": "node1534",
1394 #                     "file": { "driver": "file",
1395 #                               "filename": "hd1.qcow2" },
1396 #                     "backing": null } }
1398 # <- { "return": {} }
1400 # -> { "execute": "blockdev-snapshot",
1401 #      "arguments": { "node": "ide-hd0",
1402 #                     "overlay": "node1534" } }
1403 # <- { "return": {} }
1406 { 'command': 'blockdev-snapshot',
1407   'data': 'BlockdevSnapshot' }
1410 # @change-backing-file:
1412 # Change the backing file in the image file metadata.  This does not
1413 # cause QEMU to reopen the image file to reparse the backing filename
1414 # (it may, however, perform a reopen to change permissions from
1415 # r/o -> r/w -> r/o, if needed). The new backing file string is written
1416 # into the image file metadata, and the QEMU internal strings are
1417 # updated.
1419 # @image-node-name: The name of the block driver state node of the
1420 #                   image to modify. The "device" argument is used
1421 #                   to verify "image-node-name" is in the chain
1422 #                   described by "device".
1424 # @device:          The device name or node-name of the root node that owns
1425 #                   image-node-name.
1427 # @backing-file:    The string to write as the backing file.  This
1428 #                   string is not validated, so care should be taken
1429 #                   when specifying the string or the image chain may
1430 #                   not be able to be reopened again.
1432 # Returns: Nothing on success
1434 #          If "device" does not exist or cannot be determined, DeviceNotFound
1436 # Since: 2.1
1438 { 'command': 'change-backing-file',
1439   'data': { 'device': 'str', 'image-node-name': 'str',
1440             'backing-file': 'str' } }
1443 # @block-commit:
1445 # Live commit of data from overlay image nodes into backing nodes - i.e.,
1446 # writes data between 'top' and 'base' into 'base'.
1448 # @job-id: identifier for the newly-created block job. If
1449 #          omitted, the device name will be used. (Since 2.7)
1451 # @device:  the device name or node-name of a root node
1453 # @base:   The file name of the backing image to write data into.
1454 #                    If not specified, this is the deepest backing image.
1456 # @top:    The file name of the backing image within the image chain,
1457 #                    which contains the topmost data to be committed down. If
1458 #                    not specified, this is the active layer.
1460 # @backing-file:  The backing file string to write into the overlay
1461 #                           image of 'top'.  If 'top' is the active layer,
1462 #                           specifying a backing file string is an error. This
1463 #                           filename is not validated.
1465 #                           If a pathname string is such that it cannot be
1466 #                           resolved by QEMU, that means that subsequent QMP or
1467 #                           HMP commands must use node-names for the image in
1468 #                           question, as filename lookup methods will fail.
1470 #                           If not specified, QEMU will automatically determine
1471 #                           the backing file string to use, or error out if
1472 #                           there is no obvious choice. Care should be taken
1473 #                           when specifying the string, to specify a valid
1474 #                           filename or protocol.
1475 #                           (Since 2.1)
1477 #                    If top == base, that is an error.
1478 #                    If top == active, the job will not be completed by itself,
1479 #                    user needs to complete the job with the block-job-complete
1480 #                    command after getting the ready event. (Since 2.0)
1482 #                    If the base image is smaller than top, then the base image
1483 #                    will be resized to be the same size as top.  If top is
1484 #                    smaller than the base image, the base will not be
1485 #                    truncated.  If you want the base image size to match the
1486 #                    size of the smaller top, you can safely truncate it
1487 #                    yourself once the commit operation successfully completes.
1489 # @speed:  the maximum speed, in bytes per second
1491 # @filter-node-name: the node name that should be assigned to the
1492 #                    filter driver that the commit job inserts into the graph
1493 #                    above @top. If this option is not given, a node name is
1494 #                    autogenerated. (Since: 2.9)
1496 # Returns: Nothing on success
1497 #          If commit or stream is already active on this device, DeviceInUse
1498 #          If @device does not exist, DeviceNotFound
1499 #          If image commit is not supported by this device, NotSupported
1500 #          If @base or @top is invalid, a generic error is returned
1501 #          If @speed is invalid, InvalidParameter
1503 # Since: 1.3
1505 # Example:
1507 # -> { "execute": "block-commit",
1508 #      "arguments": { "device": "virtio0",
1509 #                     "top": "/tmp/snap1.qcow2" } }
1510 # <- { "return": {} }
1513 { 'command': 'block-commit',
1514   'data': { '*job-id': 'str', 'device': 'str', '*base': 'str', '*top': 'str',
1515             '*backing-file': 'str', '*speed': 'int',
1516             '*filter-node-name': 'str' } }
1519 # @drive-backup:
1521 # Start a point-in-time copy of a block device to a new destination.  The
1522 # status of ongoing drive-backup operations can be checked with
1523 # query-block-jobs where the BlockJobInfo.type field has the value 'backup'.
1524 # The operation can be stopped before it has completed using the
1525 # block-job-cancel command.
1527 # Returns: nothing on success
1528 #          If @device is not a valid block device, GenericError
1530 # Since: 1.6
1532 # Example:
1534 # -> { "execute": "drive-backup",
1535 #      "arguments": { "device": "drive0",
1536 #                     "sync": "full",
1537 #                     "target": "backup.img" } }
1538 # <- { "return": {} }
1541 { 'command': 'drive-backup', 'boxed': true,
1542   'data': 'DriveBackup' }
1545 # @blockdev-backup:
1547 # Start a point-in-time copy of a block device to a new destination.  The
1548 # status of ongoing blockdev-backup operations can be checked with
1549 # query-block-jobs where the BlockJobInfo.type field has the value 'backup'.
1550 # The operation can be stopped before it has completed using the
1551 # block-job-cancel command.
1553 # Returns: nothing on success
1554 #          If @device is not a valid block device, DeviceNotFound
1556 # Since: 2.3
1558 # Example:
1559 # -> { "execute": "blockdev-backup",
1560 #      "arguments": { "device": "src-id",
1561 #                     "sync": "full",
1562 #                     "target": "tgt-id" } }
1563 # <- { "return": {} }
1566 { 'command': 'blockdev-backup', 'boxed': true,
1567   'data': 'BlockdevBackup' }
1571 # @query-named-block-nodes:
1573 # Get the named block driver list
1575 # Returns: the list of BlockDeviceInfo
1577 # Since: 2.0
1579 # Example:
1581 # -> { "execute": "query-named-block-nodes" }
1582 # <- { "return": [ { "ro":false,
1583 #                    "drv":"qcow2",
1584 #                    "encrypted":false,
1585 #                    "file":"disks/test.qcow2",
1586 #                    "node-name": "my-node",
1587 #                    "backing_file_depth":1,
1588 #                    "bps":1000000,
1589 #                    "bps_rd":0,
1590 #                    "bps_wr":0,
1591 #                    "iops":1000000,
1592 #                    "iops_rd":0,
1593 #                    "iops_wr":0,
1594 #                    "bps_max": 8000000,
1595 #                    "bps_rd_max": 0,
1596 #                    "bps_wr_max": 0,
1597 #                    "iops_max": 0,
1598 #                    "iops_rd_max": 0,
1599 #                    "iops_wr_max": 0,
1600 #                    "iops_size": 0,
1601 #                    "write_threshold": 0,
1602 #                    "image":{
1603 #                       "filename":"disks/test.qcow2",
1604 #                       "format":"qcow2",
1605 #                       "virtual-size":2048000,
1606 #                       "backing_file":"base.qcow2",
1607 #                       "full-backing-filename":"disks/base.qcow2",
1608 #                       "backing-filename-format":"qcow2",
1609 #                       "snapshots":[
1610 #                          {
1611 #                             "id": "1",
1612 #                             "name": "snapshot1",
1613 #                             "vm-state-size": 0,
1614 #                             "date-sec": 10000200,
1615 #                             "date-nsec": 12,
1616 #                             "vm-clock-sec": 206,
1617 #                             "vm-clock-nsec": 30
1618 #                          }
1619 #                       ],
1620 #                       "backing-image":{
1621 #                           "filename":"disks/base.qcow2",
1622 #                           "format":"qcow2",
1623 #                           "virtual-size":2048000
1624 #                       }
1625 #                    } } ] }
1628 { 'command': 'query-named-block-nodes', 'returns': [ 'BlockDeviceInfo' ] }
1631 # @drive-mirror:
1633 # Start mirroring a block device's writes to a new destination. target
1634 # specifies the target of the new image. If the file exists, or if it
1635 # is a device, it will be used as the new destination for writes. If
1636 # it does not exist, a new file will be created. format specifies the
1637 # format of the mirror image, default is to probe if mode='existing',
1638 # else the format of the source.
1640 # Returns: nothing on success
1641 #          If @device is not a valid block device, GenericError
1643 # Since: 1.3
1645 # Example:
1647 # -> { "execute": "drive-mirror",
1648 #      "arguments": { "device": "ide-hd0",
1649 #                     "target": "/some/place/my-image",
1650 #                     "sync": "full",
1651 #                     "format": "qcow2" } }
1652 # <- { "return": {} }
1655 { 'command': 'drive-mirror', 'boxed': true,
1656   'data': 'DriveMirror' }
1659 # @DriveMirror:
1661 # A set of parameters describing drive mirror setup.
1663 # @job-id: identifier for the newly-created block job. If
1664 #          omitted, the device name will be used. (Since 2.7)
1666 # @device:  the device name or node-name of a root node whose writes should be
1667 #           mirrored.
1669 # @target: the target of the new image. If the file exists, or if it
1670 #          is a device, the existing file/device will be used as the new
1671 #          destination.  If it does not exist, a new file will be created.
1673 # @format: the format of the new destination, default is to
1674 #          probe if @mode is 'existing', else the format of the source
1676 # @node-name: the new block driver state node name in the graph
1677 #             (Since 2.1)
1679 # @replaces: with sync=full graph node name to be replaced by the new
1680 #            image when a whole image copy is done. This can be used to repair
1681 #            broken Quorum files. (Since 2.1)
1683 # @mode: whether and how QEMU should create a new image, default is
1684 #        'absolute-paths'.
1686 # @speed:  the maximum speed, in bytes per second
1688 # @sync: what parts of the disk image should be copied to the destination
1689 #        (all the disk, only the sectors allocated in the topmost image, or
1690 #        only new I/O).
1692 # @granularity: granularity of the dirty bitmap, default is 64K
1693 #               if the image format doesn't have clusters, 4K if the clusters
1694 #               are smaller than that, else the cluster size.  Must be a
1695 #               power of 2 between 512 and 64M (since 1.4).
1697 # @buf-size: maximum amount of data in flight from source to
1698 #            target (since 1.4).
1700 # @on-source-error: the action to take on an error on the source,
1701 #                   default 'report'.  'stop' and 'enospc' can only be used
1702 #                   if the block device supports io-status (see BlockInfo).
1704 # @on-target-error: the action to take on an error on the target,
1705 #                   default 'report' (no limitations, since this applies to
1706 #                   a different block device than @device).
1707 # @unmap: Whether to try to unmap target sectors where source has
1708 #         only zero. If true, and target unallocated sectors will read as zero,
1709 #         target image sectors will be unmapped; otherwise, zeroes will be
1710 #         written. Both will result in identical contents.
1711 #         Default is true. (Since 2.4)
1713 # @copy-mode: when to copy data to the destination; defaults to 'background'
1714 #             (Since: 3.0)
1716 # Since: 1.3
1718 { 'struct': 'DriveMirror',
1719   'data': { '*job-id': 'str', 'device': 'str', 'target': 'str',
1720             '*format': 'str', '*node-name': 'str', '*replaces': 'str',
1721             'sync': 'MirrorSyncMode', '*mode': 'NewImageMode',
1722             '*speed': 'int', '*granularity': 'uint32',
1723             '*buf-size': 'int', '*on-source-error': 'BlockdevOnError',
1724             '*on-target-error': 'BlockdevOnError',
1725             '*unmap': 'bool', '*copy-mode': 'MirrorCopyMode' } }
1728 # @BlockDirtyBitmap:
1730 # @node: name of device/node which the bitmap is tracking
1732 # @name: name of the dirty bitmap
1734 # Since: 2.4
1736 { 'struct': 'BlockDirtyBitmap',
1737   'data': { 'node': 'str', 'name': 'str' } }
1740 # @BlockDirtyBitmapAdd:
1742 # @node: name of device/node which the bitmap is tracking
1744 # @name: name of the dirty bitmap
1746 # @granularity: the bitmap granularity, default is 64k for
1747 #               block-dirty-bitmap-add
1749 # @persistent: the bitmap is persistent, i.e. it will be saved to the
1750 #              corresponding block device image file on its close. For now only
1751 #              Qcow2 disks support persistent bitmaps. Default is false for
1752 #              block-dirty-bitmap-add. (Since: 2.10)
1754 # @autoload: ignored and deprecated since 2.12.
1755 #            Currently, all dirty tracking bitmaps are loaded from Qcow2 on
1756 #            open.
1758 # @x-disabled: the bitmap is created in the disabled state, which means that
1759 #              it will not track drive changes. The bitmap may be enabled with
1760 #              x-block-dirty-bitmap-enable. Default is false. (Since: 3.0)
1762 # Since: 2.4
1764 { 'struct': 'BlockDirtyBitmapAdd',
1765   'data': { 'node': 'str', 'name': 'str', '*granularity': 'uint32',
1766             '*persistent': 'bool', '*autoload': 'bool', '*x-disabled': 'bool' } }
1769 # @BlockDirtyBitmapMerge:
1771 # @node: name of device/node which the bitmap is tracking
1773 # @dst_name: name of the destination dirty bitmap
1775 # @src_name: name of the source dirty bitmap
1777 # Since: 3.0
1779 { 'struct': 'BlockDirtyBitmapMerge',
1780   'data': { 'node': 'str', 'dst_name': 'str', 'src_name': 'str' } }
1783 # @block-dirty-bitmap-add:
1785 # Create a dirty bitmap with a name on the node, and start tracking the writes.
1787 # Returns: nothing on success
1788 #          If @node is not a valid block device or node, DeviceNotFound
1789 #          If @name is already taken, GenericError with an explanation
1791 # Since: 2.4
1793 # Example:
1795 # -> { "execute": "block-dirty-bitmap-add",
1796 #      "arguments": { "node": "drive0", "name": "bitmap0" } }
1797 # <- { "return": {} }
1800 { 'command': 'block-dirty-bitmap-add',
1801   'data': 'BlockDirtyBitmapAdd' }
1804 # @block-dirty-bitmap-remove:
1806 # Stop write tracking and remove the dirty bitmap that was created
1807 # with block-dirty-bitmap-add. If the bitmap is persistent, remove it from its
1808 # storage too.
1810 # Returns: nothing on success
1811 #          If @node is not a valid block device or node, DeviceNotFound
1812 #          If @name is not found, GenericError with an explanation
1813 #          if @name is frozen by an operation, GenericError
1815 # Since: 2.4
1817 # Example:
1819 # -> { "execute": "block-dirty-bitmap-remove",
1820 #      "arguments": { "node": "drive0", "name": "bitmap0" } }
1821 # <- { "return": {} }
1824 { 'command': 'block-dirty-bitmap-remove',
1825   'data': 'BlockDirtyBitmap' }
1828 # @block-dirty-bitmap-clear:
1830 # Clear (reset) a dirty bitmap on the device, so that an incremental
1831 # backup from this point in time forward will only backup clusters
1832 # modified after this clear operation.
1834 # Returns: nothing on success
1835 #          If @node is not a valid block device, DeviceNotFound
1836 #          If @name is not found, GenericError with an explanation
1838 # Since: 2.4
1840 # Example:
1842 # -> { "execute": "block-dirty-bitmap-clear",
1843 #      "arguments": { "node": "drive0", "name": "bitmap0" } }
1844 # <- { "return": {} }
1847 { 'command': 'block-dirty-bitmap-clear',
1848   'data': 'BlockDirtyBitmap' }
1851 # @x-block-dirty-bitmap-enable:
1853 # Enables a dirty bitmap so that it will begin tracking disk changes.
1855 # Returns: nothing on success
1856 #          If @node is not a valid block device, DeviceNotFound
1857 #          If @name is not found, GenericError with an explanation
1859 # Since: 3.0
1861 # Example:
1863 # -> { "execute": "x-block-dirty-bitmap-enable",
1864 #      "arguments": { "node": "drive0", "name": "bitmap0" } }
1865 # <- { "return": {} }
1868   { 'command': 'x-block-dirty-bitmap-enable',
1869     'data': 'BlockDirtyBitmap' }
1872 # @x-block-dirty-bitmap-disable:
1874 # Disables a dirty bitmap so that it will stop tracking disk changes.
1876 # Returns: nothing on success
1877 #          If @node is not a valid block device, DeviceNotFound
1878 #          If @name is not found, GenericError with an explanation
1880 # Since: 3.0
1882 # Example:
1884 # -> { "execute": "x-block-dirty-bitmap-disable",
1885 #      "arguments": { "node": "drive0", "name": "bitmap0" } }
1886 # <- { "return": {} }
1889     { 'command': 'x-block-dirty-bitmap-disable',
1890       'data': 'BlockDirtyBitmap' }
1893 # @x-block-dirty-bitmap-merge:
1895 # Merge @src_name dirty bitmap to @dst_name dirty bitmap. @src_name dirty
1896 # bitmap is unchanged. On error, @dst_name is unchanged.
1898 # Returns: nothing on success
1899 #          If @node is not a valid block device, DeviceNotFound
1900 #          If @dst_name or @src_name is not found, GenericError
1901 #          If bitmaps has different sizes or granularities, GenericError
1903 # Since: 3.0
1905 # Example:
1907 # -> { "execute": "x-block-dirty-bitmap-merge",
1908 #      "arguments": { "node": "drive0", "dst_name": "bitmap0",
1909 #                     "src_name": "bitmap1" } }
1910 # <- { "return": {} }
1913       { 'command': 'x-block-dirty-bitmap-merge',
1914         'data': 'BlockDirtyBitmapMerge' }
1917 # @BlockDirtyBitmapSha256:
1919 # SHA256 hash of dirty bitmap data
1921 # @sha256: ASCII representation of SHA256 bitmap hash
1923 # Since: 2.10
1925   { 'struct': 'BlockDirtyBitmapSha256',
1926     'data': {'sha256': 'str'} }
1929 # @x-debug-block-dirty-bitmap-sha256:
1931 # Get bitmap SHA256
1933 # Returns: BlockDirtyBitmapSha256 on success
1934 #          If @node is not a valid block device, DeviceNotFound
1935 #          If @name is not found or if hashing has failed, GenericError with an
1936 #          explanation
1938 # Since: 2.10
1940   { 'command': 'x-debug-block-dirty-bitmap-sha256',
1941     'data': 'BlockDirtyBitmap', 'returns': 'BlockDirtyBitmapSha256' }
1944 # @blockdev-mirror:
1946 # Start mirroring a block device's writes to a new destination.
1948 # @job-id: identifier for the newly-created block job. If
1949 #          omitted, the device name will be used. (Since 2.7)
1951 # @device: The device name or node-name of a root node whose writes should be
1952 #          mirrored.
1954 # @target: the id or node-name of the block device to mirror to. This mustn't be
1955 #          attached to guest.
1957 # @replaces: with sync=full graph node name to be replaced by the new
1958 #            image when a whole image copy is done. This can be used to repair
1959 #            broken Quorum files.
1961 # @speed:  the maximum speed, in bytes per second
1963 # @sync: what parts of the disk image should be copied to the destination
1964 #        (all the disk, only the sectors allocated in the topmost image, or
1965 #        only new I/O).
1967 # @granularity: granularity of the dirty bitmap, default is 64K
1968 #               if the image format doesn't have clusters, 4K if the clusters
1969 #               are smaller than that, else the cluster size.  Must be a
1970 #               power of 2 between 512 and 64M
1972 # @buf-size: maximum amount of data in flight from source to
1973 #            target
1975 # @on-source-error: the action to take on an error on the source,
1976 #                   default 'report'.  'stop' and 'enospc' can only be used
1977 #                   if the block device supports io-status (see BlockInfo).
1979 # @on-target-error: the action to take on an error on the target,
1980 #                   default 'report' (no limitations, since this applies to
1981 #                   a different block device than @device).
1983 # @filter-node-name: the node name that should be assigned to the
1984 #                    filter driver that the mirror job inserts into the graph
1985 #                    above @device. If this option is not given, a node name is
1986 #                    autogenerated. (Since: 2.9)
1988 # @copy-mode: when to copy data to the destination; defaults to 'background'
1989 #             (Since: 3.0)
1991 # Returns: nothing on success.
1993 # Since: 2.6
1995 # Example:
1997 # -> { "execute": "blockdev-mirror",
1998 #      "arguments": { "device": "ide-hd0",
1999 #                     "target": "target0",
2000 #                     "sync": "full" } }
2001 # <- { "return": {} }
2004 { 'command': 'blockdev-mirror',
2005   'data': { '*job-id': 'str', 'device': 'str', 'target': 'str',
2006             '*replaces': 'str',
2007             'sync': 'MirrorSyncMode',
2008             '*speed': 'int', '*granularity': 'uint32',
2009             '*buf-size': 'int', '*on-source-error': 'BlockdevOnError',
2010             '*on-target-error': 'BlockdevOnError',
2011             '*filter-node-name': 'str',
2012             '*copy-mode': 'MirrorCopyMode' } }
2015 # @block_set_io_throttle:
2017 # Change I/O throttle limits for a block drive.
2019 # Since QEMU 2.4, each device with I/O limits is member of a throttle
2020 # group.
2022 # If two or more devices are members of the same group, the limits
2023 # will apply to the combined I/O of the whole group in a round-robin
2024 # fashion. Therefore, setting new I/O limits to a device will affect
2025 # the whole group.
2027 # The name of the group can be specified using the 'group' parameter.
2028 # If the parameter is unset, it is assumed to be the current group of
2029 # that device. If it's not in any group yet, the name of the device
2030 # will be used as the name for its group.
2032 # The 'group' parameter can also be used to move a device to a
2033 # different group. In this case the limits specified in the parameters
2034 # will be applied to the new group only.
2036 # I/O limits can be disabled by setting all of them to 0. In this case
2037 # the device will be removed from its group and the rest of its
2038 # members will not be affected. The 'group' parameter is ignored.
2040 # Returns: Nothing on success
2041 #          If @device is not a valid block device, DeviceNotFound
2043 # Since: 1.1
2045 # Example:
2047 # -> { "execute": "block_set_io_throttle",
2048 #      "arguments": { "id": "virtio-blk-pci0/virtio-backend",
2049 #                     "bps": 0,
2050 #                     "bps_rd": 0,
2051 #                     "bps_wr": 0,
2052 #                     "iops": 512,
2053 #                     "iops_rd": 0,
2054 #                     "iops_wr": 0,
2055 #                     "bps_max": 0,
2056 #                     "bps_rd_max": 0,
2057 #                     "bps_wr_max": 0,
2058 #                     "iops_max": 0,
2059 #                     "iops_rd_max": 0,
2060 #                     "iops_wr_max": 0,
2061 #                     "bps_max_length": 0,
2062 #                     "iops_size": 0 } }
2063 # <- { "return": {} }
2065 # -> { "execute": "block_set_io_throttle",
2066 #      "arguments": { "id": "ide0-1-0",
2067 #                     "bps": 1000000,
2068 #                     "bps_rd": 0,
2069 #                     "bps_wr": 0,
2070 #                     "iops": 0,
2071 #                     "iops_rd": 0,
2072 #                     "iops_wr": 0,
2073 #                     "bps_max": 8000000,
2074 #                     "bps_rd_max": 0,
2075 #                     "bps_wr_max": 0,
2076 #                     "iops_max": 0,
2077 #                     "iops_rd_max": 0,
2078 #                     "iops_wr_max": 0,
2079 #                     "bps_max_length": 60,
2080 #                     "iops_size": 0 } }
2081 # <- { "return": {} }
2083 { 'command': 'block_set_io_throttle', 'boxed': true,
2084   'data': 'BlockIOThrottle' }
2087 # @BlockIOThrottle:
2089 # A set of parameters describing block throttling.
2091 # @device: Block device name (deprecated, use @id instead)
2093 # @id: The name or QOM path of the guest device (since: 2.8)
2095 # @bps: total throughput limit in bytes per second
2097 # @bps_rd: read throughput limit in bytes per second
2099 # @bps_wr: write throughput limit in bytes per second
2101 # @iops: total I/O operations per second
2103 # @iops_rd: read I/O operations per second
2105 # @iops_wr: write I/O operations per second
2107 # @bps_max: total throughput limit during bursts,
2108 #                     in bytes (Since 1.7)
2110 # @bps_rd_max: read throughput limit during bursts,
2111 #                        in bytes (Since 1.7)
2113 # @bps_wr_max: write throughput limit during bursts,
2114 #                        in bytes (Since 1.7)
2116 # @iops_max: total I/O operations per second during bursts,
2117 #                      in bytes (Since 1.7)
2119 # @iops_rd_max: read I/O operations per second during bursts,
2120 #                         in bytes (Since 1.7)
2122 # @iops_wr_max: write I/O operations per second during bursts,
2123 #                         in bytes (Since 1.7)
2125 # @bps_max_length: maximum length of the @bps_max burst
2126 #                            period, in seconds. It must only
2127 #                            be set if @bps_max is set as well.
2128 #                            Defaults to 1. (Since 2.6)
2130 # @bps_rd_max_length: maximum length of the @bps_rd_max
2131 #                               burst period, in seconds. It must only
2132 #                               be set if @bps_rd_max is set as well.
2133 #                               Defaults to 1. (Since 2.6)
2135 # @bps_wr_max_length: maximum length of the @bps_wr_max
2136 #                               burst period, in seconds. It must only
2137 #                               be set if @bps_wr_max is set as well.
2138 #                               Defaults to 1. (Since 2.6)
2140 # @iops_max_length: maximum length of the @iops burst
2141 #                             period, in seconds. It must only
2142 #                             be set if @iops_max is set as well.
2143 #                             Defaults to 1. (Since 2.6)
2145 # @iops_rd_max_length: maximum length of the @iops_rd_max
2146 #                                burst period, in seconds. It must only
2147 #                                be set if @iops_rd_max is set as well.
2148 #                                Defaults to 1. (Since 2.6)
2150 # @iops_wr_max_length: maximum length of the @iops_wr_max
2151 #                                burst period, in seconds. It must only
2152 #                                be set if @iops_wr_max is set as well.
2153 #                                Defaults to 1. (Since 2.6)
2155 # @iops_size: an I/O size in bytes (Since 1.7)
2157 # @group: throttle group name (Since 2.4)
2159 # Since: 1.1
2161 { 'struct': 'BlockIOThrottle',
2162   'data': { '*device': 'str', '*id': 'str', 'bps': 'int', 'bps_rd': 'int',
2163             'bps_wr': 'int', 'iops': 'int', 'iops_rd': 'int', 'iops_wr': 'int',
2164             '*bps_max': 'int', '*bps_rd_max': 'int',
2165             '*bps_wr_max': 'int', '*iops_max': 'int',
2166             '*iops_rd_max': 'int', '*iops_wr_max': 'int',
2167             '*bps_max_length': 'int', '*bps_rd_max_length': 'int',
2168             '*bps_wr_max_length': 'int', '*iops_max_length': 'int',
2169             '*iops_rd_max_length': 'int', '*iops_wr_max_length': 'int',
2170             '*iops_size': 'int', '*group': 'str' } }
2173 # @ThrottleLimits:
2175 # Limit parameters for throttling.
2176 # Since some limit combinations are illegal, limits should always be set in one
2177 # transaction. All fields are optional. When setting limits, if a field is
2178 # missing the current value is not changed.
2180 # @iops-total:             limit total I/O operations per second
2181 # @iops-total-max:         I/O operations burst
2182 # @iops-total-max-length:  length of the iops-total-max burst period, in seconds
2183 #                          It must only be set if @iops-total-max is set as well.
2184 # @iops-read:              limit read operations per second
2185 # @iops-read-max:          I/O operations read burst
2186 # @iops-read-max-length:   length of the iops-read-max burst period, in seconds
2187 #                          It must only be set if @iops-read-max is set as well.
2188 # @iops-write:             limit write operations per second
2189 # @iops-write-max:         I/O operations write burst
2190 # @iops-write-max-length:  length of the iops-write-max burst period, in seconds
2191 #                          It must only be set if @iops-write-max is set as well.
2192 # @bps-total:              limit total bytes per second
2193 # @bps-total-max:          total bytes burst
2194 # @bps-total-max-length:   length of the bps-total-max burst period, in seconds.
2195 #                          It must only be set if @bps-total-max is set as well.
2196 # @bps-read:               limit read bytes per second
2197 # @bps-read-max:           total bytes read burst
2198 # @bps-read-max-length:    length of the bps-read-max burst period, in seconds
2199 #                          It must only be set if @bps-read-max is set as well.
2200 # @bps-write:              limit write bytes per second
2201 # @bps-write-max:          total bytes write burst
2202 # @bps-write-max-length:   length of the bps-write-max burst period, in seconds
2203 #                          It must only be set if @bps-write-max is set as well.
2204 # @iops-size:              when limiting by iops max size of an I/O in bytes
2206 # Since: 2.11
2208 { 'struct': 'ThrottleLimits',
2209   'data': { '*iops-total' : 'int', '*iops-total-max' : 'int',
2210             '*iops-total-max-length' : 'int', '*iops-read' : 'int',
2211             '*iops-read-max' : 'int', '*iops-read-max-length' : 'int',
2212             '*iops-write' : 'int', '*iops-write-max' : 'int',
2213             '*iops-write-max-length' : 'int', '*bps-total' : 'int',
2214             '*bps-total-max' : 'int', '*bps-total-max-length' : 'int',
2215             '*bps-read' : 'int', '*bps-read-max' : 'int',
2216             '*bps-read-max-length' : 'int', '*bps-write' : 'int',
2217             '*bps-write-max' : 'int', '*bps-write-max-length' : 'int',
2218             '*iops-size' : 'int' } }
2221 # @block-stream:
2223 # Copy data from a backing file into a block device.
2225 # The block streaming operation is performed in the background until the entire
2226 # backing file has been copied.  This command returns immediately once streaming
2227 # has started.  The status of ongoing block streaming operations can be checked
2228 # with query-block-jobs.  The operation can be stopped before it has completed
2229 # using the block-job-cancel command.
2231 # The node that receives the data is called the top image, can be located in
2232 # any part of the chain (but always above the base image; see below) and can be
2233 # specified using its device or node name. Earlier qemu versions only allowed
2234 # 'device' to name the top level node; presence of the 'base-node' parameter
2235 # during introspection can be used as a witness of the enhanced semantics
2236 # of 'device'.
2238 # If a base file is specified then sectors are not copied from that base file and
2239 # its backing chain.  When streaming completes the image file will have the base
2240 # file as its backing file.  This can be used to stream a subset of the backing
2241 # file chain instead of flattening the entire image.
2243 # On successful completion the image file is updated to drop the backing file
2244 # and the BLOCK_JOB_COMPLETED event is emitted.
2246 # @job-id: identifier for the newly-created block job. If
2247 #          omitted, the device name will be used. (Since 2.7)
2249 # @device: the device or node name of the top image
2251 # @base:   the common backing file name.
2252 #                    It cannot be set if @base-node is also set.
2254 # @base-node: the node name of the backing file.
2255 #                       It cannot be set if @base is also set. (Since 2.8)
2257 # @backing-file: The backing file string to write into the top
2258 #                          image. This filename is not validated.
2260 #                          If a pathname string is such that it cannot be
2261 #                          resolved by QEMU, that means that subsequent QMP or
2262 #                          HMP commands must use node-names for the image in
2263 #                          question, as filename lookup methods will fail.
2265 #                          If not specified, QEMU will automatically determine
2266 #                          the backing file string to use, or error out if there
2267 #                          is no obvious choice.  Care should be taken when
2268 #                          specifying the string, to specify a valid filename or
2269 #                          protocol.
2270 #                          (Since 2.1)
2272 # @speed:  the maximum speed, in bytes per second
2274 # @on-error: the action to take on an error (default report).
2275 #            'stop' and 'enospc' can only be used if the block device
2276 #            supports io-status (see BlockInfo).  Since 1.3.
2278 # Returns: Nothing on success. If @device does not exist, DeviceNotFound.
2280 # Since: 1.1
2282 # Example:
2284 # -> { "execute": "block-stream",
2285 #      "arguments": { "device": "virtio0",
2286 #                     "base": "/tmp/master.qcow2" } }
2287 # <- { "return": {} }
2290 { 'command': 'block-stream',
2291   'data': { '*job-id': 'str', 'device': 'str', '*base': 'str',
2292             '*base-node': 'str', '*backing-file': 'str', '*speed': 'int',
2293             '*on-error': 'BlockdevOnError' } }
2296 # @block-job-set-speed:
2298 # Set maximum speed for a background block operation.
2300 # This command can only be issued when there is an active block job.
2302 # Throttling can be disabled by setting the speed to 0.
2304 # @device: The job identifier. This used to be a device name (hence
2305 #          the name of the parameter), but since QEMU 2.7 it can have
2306 #          other values.
2308 # @speed:  the maximum speed, in bytes per second, or 0 for unlimited.
2309 #          Defaults to 0.
2311 # Returns: Nothing on success
2312 #          If no background operation is active on this device, DeviceNotActive
2314 # Since: 1.1
2316 { 'command': 'block-job-set-speed',
2317   'data': { 'device': 'str', 'speed': 'int' } }
2320 # @block-job-cancel:
2322 # Stop an active background block operation.
2324 # This command returns immediately after marking the active background block
2325 # operation for cancellation.  It is an error to call this command if no
2326 # operation is in progress.
2328 # The operation will cancel as soon as possible and then emit the
2329 # BLOCK_JOB_CANCELLED event.  Before that happens the job is still visible when
2330 # enumerated using query-block-jobs.
2332 # Note that if you issue 'block-job-cancel' after 'drive-mirror' has indicated
2333 # (via the event BLOCK_JOB_READY) that the source and destination are
2334 # synchronized, then the event triggered by this command changes to
2335 # BLOCK_JOB_COMPLETED, to indicate that the mirroring has ended and the
2336 # destination now has a point-in-time copy tied to the time of the cancellation.
2338 # For streaming, the image file retains its backing file unless the streaming
2339 # operation happens to complete just as it is being cancelled.  A new streaming
2340 # operation can be started at a later time to finish copying all data from the
2341 # backing file.
2343 # @device: The job identifier. This used to be a device name (hence
2344 #          the name of the parameter), but since QEMU 2.7 it can have
2345 #          other values.
2347 # @force: If true, and the job has already emitted the event BLOCK_JOB_READY,
2348 #         abandon the job immediately (even if it is paused) instead of waiting
2349 #         for the destination to complete its final synchronization (since 1.3)
2351 # Returns: Nothing on success
2352 #          If no background operation is active on this device, DeviceNotActive
2354 # Since: 1.1
2356 { 'command': 'block-job-cancel', 'data': { 'device': 'str', '*force': 'bool' } }
2359 # @block-job-pause:
2361 # Pause an active background block operation.
2363 # This command returns immediately after marking the active background block
2364 # operation for pausing.  It is an error to call this command if no
2365 # operation is in progress or if the job is already paused.
2367 # The operation will pause as soon as possible.  No event is emitted when
2368 # the operation is actually paused.  Cancelling a paused job automatically
2369 # resumes it.
2371 # @device: The job identifier. This used to be a device name (hence
2372 #          the name of the parameter), but since QEMU 2.7 it can have
2373 #          other values.
2375 # Returns: Nothing on success
2376 #          If no background operation is active on this device, DeviceNotActive
2378 # Since: 1.3
2380 { 'command': 'block-job-pause', 'data': { 'device': 'str' } }
2383 # @block-job-resume:
2385 # Resume an active background block operation.
2387 # This command returns immediately after resuming a paused background block
2388 # operation.  It is an error to call this command if no operation is in
2389 # progress or if the job is not paused.
2391 # This command also clears the error status of the job.
2393 # @device: The job identifier. This used to be a device name (hence
2394 #          the name of the parameter), but since QEMU 2.7 it can have
2395 #          other values.
2397 # Returns: Nothing on success
2398 #          If no background operation is active on this device, DeviceNotActive
2400 # Since: 1.3
2402 { 'command': 'block-job-resume', 'data': { 'device': 'str' } }
2405 # @block-job-complete:
2407 # Manually trigger completion of an active background block operation.  This
2408 # is supported for drive mirroring, where it also switches the device to
2409 # write to the target path only.  The ability to complete is signaled with
2410 # a BLOCK_JOB_READY event.
2412 # This command completes an active background block operation synchronously.
2413 # The ordering of this command's return with the BLOCK_JOB_COMPLETED event
2414 # is not defined.  Note that if an I/O error occurs during the processing of
2415 # this command: 1) the command itself will fail; 2) the error will be processed
2416 # according to the rerror/werror arguments that were specified when starting
2417 # the operation.
2419 # A cancelled or paused job cannot be completed.
2421 # @device: The job identifier. This used to be a device name (hence
2422 #          the name of the parameter), but since QEMU 2.7 it can have
2423 #          other values.
2425 # Returns: Nothing on success
2426 #          If no background operation is active on this device, DeviceNotActive
2428 # Since: 1.3
2430 { 'command': 'block-job-complete', 'data': { 'device': 'str' } }
2433 # @block-job-dismiss:
2435 # For jobs that have already concluded, remove them from the block-job-query
2436 # list. This command only needs to be run for jobs which were started with
2437 # QEMU 2.12+ job lifetime management semantics.
2439 # This command will refuse to operate on any job that has not yet reached
2440 # its terminal state, JOB_STATUS_CONCLUDED. For jobs that make use of the
2441 # BLOCK_JOB_READY event, block-job-cancel or block-job-complete will still need
2442 # to be used as appropriate.
2444 # @id: The job identifier.
2446 # Returns: Nothing on success
2448 # Since: 2.12
2450 { 'command': 'block-job-dismiss', 'data': { 'id': 'str' } }
2453 # @block-job-finalize:
2455 # Once a job that has manual=true reaches the pending state, it can be
2456 # instructed to finalize any graph changes and do any necessary cleanup
2457 # via this command.
2458 # For jobs in a transaction, instructing one job to finalize will force
2459 # ALL jobs in the transaction to finalize, so it is only necessary to instruct
2460 # a single member job to finalize.
2462 # @id: The job identifier.
2464 # Returns: Nothing on success
2466 # Since: 2.12
2468 { 'command': 'block-job-finalize', 'data': { 'id': 'str' } }
2471 # @BlockdevDiscardOptions:
2473 # Determines how to handle discard requests.
2475 # @ignore:      Ignore the request
2476 # @unmap:       Forward as an unmap request
2478 # Since: 2.9
2480 { 'enum': 'BlockdevDiscardOptions',
2481   'data': [ 'ignore', 'unmap' ] }
2484 # @BlockdevDetectZeroesOptions:
2486 # Describes the operation mode for the automatic conversion of plain
2487 # zero writes by the OS to driver specific optimized zero write commands.
2489 # @off:      Disabled (default)
2490 # @on:       Enabled
2491 # @unmap:    Enabled and even try to unmap blocks if possible. This requires
2492 #            also that @BlockdevDiscardOptions is set to unmap for this device.
2494 # Since: 2.1
2496 { 'enum': 'BlockdevDetectZeroesOptions',
2497   'data': [ 'off', 'on', 'unmap' ] }
2500 # @BlockdevAioOptions:
2502 # Selects the AIO backend to handle I/O requests
2504 # @threads:     Use qemu's thread pool
2505 # @native:      Use native AIO backend (only Linux and Windows)
2507 # Since: 2.9
2509 { 'enum': 'BlockdevAioOptions',
2510   'data': [ 'threads', 'native' ] }
2513 # @BlockdevCacheOptions:
2515 # Includes cache-related options for block devices
2517 # @direct:      enables use of O_DIRECT (bypass the host page cache;
2518 #               default: false)
2519 # @no-flush:    ignore any flush requests for the device (default:
2520 #               false)
2522 # Since: 2.9
2524 { 'struct': 'BlockdevCacheOptions',
2525   'data': { '*direct': 'bool',
2526             '*no-flush': 'bool' } }
2529 # @BlockdevDriver:
2531 # Drivers that are supported in block device operations.
2533 # @vxhs: Since 2.10
2534 # @throttle: Since 2.11
2535 # @nvme: Since 2.12
2536 # @copy-on-read: Since 3.0
2538 # Since: 2.9
2540 { 'enum': 'BlockdevDriver',
2541   'data': [ 'blkdebug', 'blkverify', 'bochs', 'cloop', 'copy-on-read',
2542             'dmg', 'file', 'ftp', 'ftps', 'gluster', 'host_cdrom',
2543             'host_device', 'http', 'https', 'iscsi', 'luks', 'nbd', 'nfs',
2544             'null-aio', 'null-co', 'nvme', 'parallels', 'qcow', 'qcow2', 'qed',
2545             'quorum', 'raw', 'rbd', 'replication', 'sheepdog', 'ssh',
2546             'throttle', 'vdi', 'vhdx', 'vmdk', 'vpc', 'vvfat', 'vxhs' ] }
2549 # @BlockdevOptionsFile:
2551 # Driver specific block device options for the file backend.
2553 # @filename:    path to the image file
2554 # @pr-manager:  the id for the object that will handle persistent reservations
2555 #               for this device (default: none, forward the commands via SG_IO;
2556 #               since 2.11)
2557 # @aio:         AIO backend (default: threads) (since: 2.8)
2558 # @locking:     whether to enable file locking. If set to 'auto', only enable
2559 #               when Open File Descriptor (OFD) locking API is available
2560 #               (default: auto, since 2.10)
2561 # @x-check-cache-dropped: whether to check that page cache was dropped on live
2562 #                         migration.  May cause noticeable delays if the image
2563 #                         file is large, do not use in production.
2564 #                         (default: off) (since: 3.0)
2566 # Since: 2.9
2568 { 'struct': 'BlockdevOptionsFile',
2569   'data': { 'filename': 'str',
2570             '*pr-manager': 'str',
2571             '*locking': 'OnOffAuto',
2572             '*aio': 'BlockdevAioOptions',
2573             '*x-check-cache-dropped': 'bool' } }
2576 # @BlockdevOptionsNull:
2578 # Driver specific block device options for the null backend.
2580 # @size:    size of the device in bytes.
2581 # @latency-ns: emulated latency (in nanoseconds) in processing
2582 #              requests. Default to zero which completes requests immediately.
2583 #              (Since 2.4)
2585 # Since: 2.9
2587 { 'struct': 'BlockdevOptionsNull',
2588   'data': { '*size': 'int', '*latency-ns': 'uint64' } }
2591 # @BlockdevOptionsNVMe:
2593 # Driver specific block device options for the NVMe backend.
2595 # @device:    controller address of the NVMe device.
2596 # @namespace: namespace number of the device, starting from 1.
2598 # Since: 2.12
2600 { 'struct': 'BlockdevOptionsNVMe',
2601   'data': { 'device': 'str', 'namespace': 'int' } }
2604 # @BlockdevOptionsVVFAT:
2606 # Driver specific block device options for the vvfat protocol.
2608 # @dir:         directory to be exported as FAT image
2609 # @fat-type:    FAT type: 12, 16 or 32
2610 # @floppy:      whether to export a floppy image (true) or
2611 #               partitioned hard disk (false; default)
2612 # @label:       set the volume label, limited to 11 bytes. FAT16 and
2613 #               FAT32 traditionally have some restrictions on labels, which are
2614 #               ignored by most operating systems. Defaults to "QEMU VVFAT".
2615 #               (since 2.4)
2616 # @rw:          whether to allow write operations (default: false)
2618 # Since: 2.9
2620 { 'struct': 'BlockdevOptionsVVFAT',
2621   'data': { 'dir': 'str', '*fat-type': 'int', '*floppy': 'bool',
2622             '*label': 'str', '*rw': 'bool' } }
2625 # @BlockdevOptionsGenericFormat:
2627 # Driver specific block device options for image format that have no option
2628 # besides their data source.
2630 # @file:        reference to or definition of the data source block device
2632 # Since: 2.9
2634 { 'struct': 'BlockdevOptionsGenericFormat',
2635   'data': { 'file': 'BlockdevRef' } }
2638 # @BlockdevOptionsLUKS:
2640 # Driver specific block device options for LUKS.
2642 # @key-secret: the ID of a QCryptoSecret object providing
2643 #              the decryption key (since 2.6). Mandatory except when
2644 #              doing a metadata-only probe of the image.
2646 # Since: 2.9
2648 { 'struct': 'BlockdevOptionsLUKS',
2649   'base': 'BlockdevOptionsGenericFormat',
2650   'data': { '*key-secret': 'str' } }
2654 # @BlockdevOptionsGenericCOWFormat:
2656 # Driver specific block device options for image format that have no option
2657 # besides their data source and an optional backing file.
2659 # @backing:     reference to or definition of the backing file block
2660 #               device, null disables the backing file entirely.
2661 #               Defaults to the backing file stored the image file.
2663 # Since: 2.9
2665 { 'struct': 'BlockdevOptionsGenericCOWFormat',
2666   'base': 'BlockdevOptionsGenericFormat',
2667   'data': { '*backing': 'BlockdevRefOrNull' } }
2670 # @Qcow2OverlapCheckMode:
2672 # General overlap check modes.
2674 # @none:        Do not perform any checks
2676 # @constant:    Perform only checks which can be done in constant time and
2677 #               without reading anything from disk
2679 # @cached:      Perform only checks which can be done without reading anything
2680 #               from disk
2682 # @all:         Perform all available overlap checks
2684 # Since: 2.9
2686 { 'enum': 'Qcow2OverlapCheckMode',
2687   'data': [ 'none', 'constant', 'cached', 'all' ] }
2690 # @Qcow2OverlapCheckFlags:
2692 # Structure of flags for each metadata structure. Setting a field to 'true'
2693 # makes qemu guard that structure against unintended overwriting. The default
2694 # value is chosen according to the template given.
2696 # @template: Specifies a template mode which can be adjusted using the other
2697 #            flags, defaults to 'cached'
2699 # Since: 2.9
2701 { 'struct': 'Qcow2OverlapCheckFlags',
2702   'data': { '*template':       'Qcow2OverlapCheckMode',
2703             '*main-header':    'bool',
2704             '*active-l1':      'bool',
2705             '*active-l2':      'bool',
2706             '*refcount-table': 'bool',
2707             '*refcount-block': 'bool',
2708             '*snapshot-table': 'bool',
2709             '*inactive-l1':    'bool',
2710             '*inactive-l2':    'bool' } }
2713 # @Qcow2OverlapChecks:
2715 # Specifies which metadata structures should be guarded against unintended
2716 # overwriting.
2718 # @flags:   set of flags for separate specification of each metadata structure
2719 #           type
2721 # @mode:    named mode which chooses a specific set of flags
2723 # Since: 2.9
2725 { 'alternate': 'Qcow2OverlapChecks',
2726   'data': { 'flags': 'Qcow2OverlapCheckFlags',
2727             'mode':  'Qcow2OverlapCheckMode' } }
2730 # @BlockdevQcowEncryptionFormat:
2732 # @aes: AES-CBC with plain64 initialization vectors
2734 # Since: 2.10
2736 { 'enum': 'BlockdevQcowEncryptionFormat',
2737   'data': [ 'aes' ] }
2740 # @BlockdevQcowEncryption:
2742 # Since: 2.10
2744 { 'union': 'BlockdevQcowEncryption',
2745   'base': { 'format': 'BlockdevQcowEncryptionFormat' },
2746   'discriminator': 'format',
2747   'data': { 'aes': 'QCryptoBlockOptionsQCow' } }
2750 # @BlockdevOptionsQcow:
2752 # Driver specific block device options for qcow.
2754 # @encrypt:               Image decryption options. Mandatory for
2755 #                         encrypted images, except when doing a metadata-only
2756 #                         probe of the image.
2758 # Since: 2.10
2760 { 'struct': 'BlockdevOptionsQcow',
2761   'base': 'BlockdevOptionsGenericCOWFormat',
2762   'data': { '*encrypt': 'BlockdevQcowEncryption' } }
2767 # @BlockdevQcow2EncryptionFormat:
2768 # @aes: AES-CBC with plain64 initialization venctors
2770 # Since: 2.10
2772 { 'enum': 'BlockdevQcow2EncryptionFormat',
2773   'data': [ 'aes', 'luks' ] }
2776 # @BlockdevQcow2Encryption:
2778 # Since: 2.10
2780 { 'union': 'BlockdevQcow2Encryption',
2781   'base': { 'format': 'BlockdevQcow2EncryptionFormat' },
2782   'discriminator': 'format',
2783   'data': { 'aes': 'QCryptoBlockOptionsQCow',
2784             'luks': 'QCryptoBlockOptionsLUKS'} }
2787 # @BlockdevOptionsQcow2:
2789 # Driver specific block device options for qcow2.
2791 # @lazy-refcounts:        whether to enable the lazy refcounts
2792 #                         feature (default is taken from the image file)
2794 # @pass-discard-request:  whether discard requests to the qcow2
2795 #                         device should be forwarded to the data source
2797 # @pass-discard-snapshot: whether discard requests for the data source
2798 #                         should be issued when a snapshot operation (e.g.
2799 #                         deleting a snapshot) frees clusters in the qcow2 file
2801 # @pass-discard-other:    whether discard requests for the data source
2802 #                         should be issued on other occasions where a cluster
2803 #                         gets freed
2805 # @overlap-check:         which overlap checks to perform for writes
2806 #                         to the image, defaults to 'cached' (since 2.2)
2808 # @cache-size:            the maximum total size of the L2 table and
2809 #                         refcount block caches in bytes (since 2.2)
2811 # @l2-cache-size:         the maximum size of the L2 table cache in
2812 #                         bytes (since 2.2)
2814 # @l2-cache-entry-size:   the size of each entry in the L2 cache in
2815 #                         bytes. It must be a power of two between 512
2816 #                         and the cluster size. The default value is
2817 #                         the cluster size (since 2.12)
2819 # @refcount-cache-size:   the maximum size of the refcount block cache
2820 #                         in bytes (since 2.2)
2822 # @cache-clean-interval:  clean unused entries in the L2 and refcount
2823 #                         caches. The interval is in seconds. The default value
2824 #                         is 0 and it disables this feature (since 2.5)
2825 # @encrypt:               Image decryption options. Mandatory for
2826 #                         encrypted images, except when doing a metadata-only
2827 #                         probe of the image. (since 2.10)
2829 # Since: 2.9
2831 { 'struct': 'BlockdevOptionsQcow2',
2832   'base': 'BlockdevOptionsGenericCOWFormat',
2833   'data': { '*lazy-refcounts': 'bool',
2834             '*pass-discard-request': 'bool',
2835             '*pass-discard-snapshot': 'bool',
2836             '*pass-discard-other': 'bool',
2837             '*overlap-check': 'Qcow2OverlapChecks',
2838             '*cache-size': 'int',
2839             '*l2-cache-size': 'int',
2840             '*l2-cache-entry-size': 'int',
2841             '*refcount-cache-size': 'int',
2842             '*cache-clean-interval': 'int',
2843             '*encrypt': 'BlockdevQcow2Encryption' } }
2846 # @SshHostKeyCheckMode:
2848 # @none             Don't check the host key at all
2849 # @hash             Compare the host key with a given hash
2850 # @known_hosts      Check the host key against the known_hosts file
2852 # Since: 2.12
2854 { 'enum': 'SshHostKeyCheckMode',
2855   'data': [ 'none', 'hash', 'known_hosts' ] }
2858 # @SshHostKeyCheckHashType:
2860 # @md5              The given hash is an md5 hash
2861 # @sha1             The given hash is an sha1 hash
2863 # Since: 2.12
2865 { 'enum': 'SshHostKeyCheckHashType',
2866   'data': [ 'md5', 'sha1' ] }
2869 # @SshHostKeyHash:
2871 # @type             The hash algorithm used for the hash
2872 # @hash             The expected hash value
2874 # Since: 2.12
2876 { 'struct': 'SshHostKeyHash',
2877   'data': { 'type': 'SshHostKeyCheckHashType',
2878             'hash': 'str' }}
2881 # @SshHostKeyDummy:
2883 # For those union branches that don't need additional fields.
2885 # Since: 2.12
2887 { 'struct': 'SshHostKeyDummy',
2888   'data': {} }
2891 # @SshHostKeyCheck:
2893 # Since: 2.12
2895 { 'union': 'SshHostKeyCheck',
2896   'base': { 'mode': 'SshHostKeyCheckMode' },
2897   'discriminator': 'mode',
2898   'data': { 'none': 'SshHostKeyDummy',
2899             'hash': 'SshHostKeyHash',
2900             'known_hosts': 'SshHostKeyDummy' } }
2903 # @BlockdevOptionsSsh:
2905 # @server:              host address
2907 # @path:                path to the image on the host
2909 # @user:                user as which to connect, defaults to current
2910 #                       local user name
2912 # @host-key-check:      Defines how and what to check the host key against
2913 #                       (default: known_hosts)
2915 # Since: 2.9
2917 { 'struct': 'BlockdevOptionsSsh',
2918   'data': { 'server': 'InetSocketAddress',
2919             'path': 'str',
2920             '*user': 'str',
2921             '*host-key-check': 'SshHostKeyCheck' } }
2925 # @BlkdebugEvent:
2927 # Trigger events supported by blkdebug.
2929 # @l1_shrink_write_table:      write zeros to the l1 table to shrink image.
2930 #                              (since 2.11)
2932 # @l1_shrink_free_l2_clusters: discard the l2 tables. (since 2.11)
2934 # @cor_write: a write due to copy-on-read (since 2.11)
2936 # Since: 2.9
2938 { 'enum': 'BlkdebugEvent', 'prefix': 'BLKDBG',
2939   'data': [ 'l1_update', 'l1_grow_alloc_table', 'l1_grow_write_table',
2940             'l1_grow_activate_table', 'l2_load', 'l2_update',
2941             'l2_update_compressed', 'l2_alloc_cow_read', 'l2_alloc_write',
2942             'read_aio', 'read_backing_aio', 'read_compressed', 'write_aio',
2943             'write_compressed', 'vmstate_load', 'vmstate_save', 'cow_read',
2944             'cow_write', 'reftable_load', 'reftable_grow', 'reftable_update',
2945             'refblock_load', 'refblock_update', 'refblock_update_part',
2946             'refblock_alloc', 'refblock_alloc_hookup', 'refblock_alloc_write',
2947             'refblock_alloc_write_blocks', 'refblock_alloc_write_table',
2948             'refblock_alloc_switch_table', 'cluster_alloc',
2949             'cluster_alloc_bytes', 'cluster_free', 'flush_to_os',
2950             'flush_to_disk', 'pwritev_rmw_head', 'pwritev_rmw_after_head',
2951             'pwritev_rmw_tail', 'pwritev_rmw_after_tail', 'pwritev',
2952             'pwritev_zero', 'pwritev_done', 'empty_image_prepare',
2953             'l1_shrink_write_table', 'l1_shrink_free_l2_clusters',
2954             'cor_write'] }
2957 # @BlkdebugInjectErrorOptions:
2959 # Describes a single error injection for blkdebug.
2961 # @event:       trigger event
2963 # @state:       the state identifier blkdebug needs to be in to
2964 #               actually trigger the event; defaults to "any"
2966 # @errno:       error identifier (errno) to be returned; defaults to
2967 #               EIO
2969 # @sector:      specifies the sector index which has to be affected
2970 #               in order to actually trigger the event; defaults to "any
2971 #               sector"
2973 # @once:        disables further events after this one has been
2974 #               triggered; defaults to false
2976 # @immediately: fail immediately; defaults to false
2978 # Since: 2.9
2980 { 'struct': 'BlkdebugInjectErrorOptions',
2981   'data': { 'event': 'BlkdebugEvent',
2982             '*state': 'int',
2983             '*errno': 'int',
2984             '*sector': 'int',
2985             '*once': 'bool',
2986             '*immediately': 'bool' } }
2989 # @BlkdebugSetStateOptions:
2991 # Describes a single state-change event for blkdebug.
2993 # @event:       trigger event
2995 # @state:       the current state identifier blkdebug needs to be in;
2996 #               defaults to "any"
2998 # @new_state:   the state identifier blkdebug is supposed to assume if
2999 #               this event is triggered
3001 # Since: 2.9
3003 { 'struct': 'BlkdebugSetStateOptions',
3004   'data': { 'event': 'BlkdebugEvent',
3005             '*state': 'int',
3006             'new_state': 'int' } }
3009 # @BlockdevOptionsBlkdebug:
3011 # Driver specific block device options for blkdebug.
3013 # @image:           underlying raw block device (or image file)
3015 # @config:          filename of the configuration file
3017 # @align:           required alignment for requests in bytes, must be
3018 #                   positive power of 2, or 0 for default
3020 # @max-transfer:    maximum size for I/O transfers in bytes, must be
3021 #                   positive multiple of @align and of the underlying
3022 #                   file's request alignment (but need not be a power of
3023 #                   2), or 0 for default (since 2.10)
3025 # @opt-write-zero:  preferred alignment for write zero requests in bytes,
3026 #                   must be positive multiple of @align and of the
3027 #                   underlying file's request alignment (but need not be a
3028 #                   power of 2), or 0 for default (since 2.10)
3030 # @max-write-zero:  maximum size for write zero requests in bytes, must be
3031 #                   positive multiple of @align, of @opt-write-zero, and of
3032 #                   the underlying file's request alignment (but need not
3033 #                   be a power of 2), or 0 for default (since 2.10)
3035 # @opt-discard:     preferred alignment for discard requests in bytes, must
3036 #                   be positive multiple of @align and of the underlying
3037 #                   file's request alignment (but need not be a power of
3038 #                   2), or 0 for default (since 2.10)
3040 # @max-discard:     maximum size for discard requests in bytes, must be
3041 #                   positive multiple of @align, of @opt-discard, and of
3042 #                   the underlying file's request alignment (but need not
3043 #                   be a power of 2), or 0 for default (since 2.10)
3045 # @inject-error:    array of error injection descriptions
3047 # @set-state:       array of state-change descriptions
3049 # Since: 2.9
3051 { 'struct': 'BlockdevOptionsBlkdebug',
3052   'data': { 'image': 'BlockdevRef',
3053             '*config': 'str',
3054             '*align': 'int', '*max-transfer': 'int32',
3055             '*opt-write-zero': 'int32', '*max-write-zero': 'int32',
3056             '*opt-discard': 'int32', '*max-discard': 'int32',
3057             '*inject-error': ['BlkdebugInjectErrorOptions'],
3058             '*set-state': ['BlkdebugSetStateOptions'] } }
3061 # @BlockdevOptionsBlkverify:
3063 # Driver specific block device options for blkverify.
3065 # @test:    block device to be tested
3067 # @raw:     raw image used for verification
3069 # Since: 2.9
3071 { 'struct': 'BlockdevOptionsBlkverify',
3072   'data': { 'test': 'BlockdevRef',
3073             'raw': 'BlockdevRef' } }
3076 # @QuorumReadPattern:
3078 # An enumeration of quorum read patterns.
3080 # @quorum: read all the children and do a quorum vote on reads
3082 # @fifo: read only from the first child that has not failed
3084 # Since: 2.9
3086 { 'enum': 'QuorumReadPattern', 'data': [ 'quorum', 'fifo' ] }
3089 # @BlockdevOptionsQuorum:
3091 # Driver specific block device options for Quorum
3093 # @blkverify:      true if the driver must print content mismatch
3094 #                  set to false by default
3096 # @children:       the children block devices to use
3098 # @vote-threshold: the vote limit under which a read will fail
3100 # @rewrite-corrupted: rewrite corrupted data when quorum is reached
3101 #                     (Since 2.1)
3103 # @read-pattern: choose read pattern and set to quorum by default
3104 #                (Since 2.2)
3106 # Since: 2.9
3108 { 'struct': 'BlockdevOptionsQuorum',
3109   'data': { '*blkverify': 'bool',
3110             'children': [ 'BlockdevRef' ],
3111             'vote-threshold': 'int',
3112             '*rewrite-corrupted': 'bool',
3113             '*read-pattern': 'QuorumReadPattern' } }
3116 # @BlockdevOptionsGluster:
3118 # Driver specific block device options for Gluster
3120 # @volume:      name of gluster volume where VM image resides
3122 # @path:        absolute path to image file in gluster volume
3124 # @server:      gluster servers description
3126 # @debug:       libgfapi log level (default '4' which is Error)
3127 #               (Since 2.8)
3129 # @logfile:     libgfapi log file (default /dev/stderr) (Since 2.8)
3131 # Since: 2.9
3133 { 'struct': 'BlockdevOptionsGluster',
3134   'data': { 'volume': 'str',
3135             'path': 'str',
3136             'server': ['SocketAddress'],
3137             '*debug': 'int',
3138             '*logfile': 'str' } }
3141 # @IscsiTransport:
3143 # An enumeration of libiscsi transport types
3145 # Since: 2.9
3147 { 'enum': 'IscsiTransport',
3148   'data': [ 'tcp', 'iser' ] }
3151 # @IscsiHeaderDigest:
3153 # An enumeration of header digests supported by libiscsi
3155 # Since: 2.9
3157 { 'enum': 'IscsiHeaderDigest',
3158   'prefix': 'QAPI_ISCSI_HEADER_DIGEST',
3159   'data': [ 'crc32c', 'none', 'crc32c-none', 'none-crc32c' ] }
3162 # @BlockdevOptionsIscsi:
3164 # @transport:       The iscsi transport type
3166 # @portal:          The address of the iscsi portal
3168 # @target:          The target iqn name
3170 # @lun:             LUN to connect to. Defaults to 0.
3172 # @user:            User name to log in with. If omitted, no CHAP
3173 #                   authentication is performed.
3175 # @password-secret: The ID of a QCryptoSecret object providing
3176 #                   the password for the login. This option is required if
3177 #                   @user is specified.
3179 # @initiator-name:  The iqn name we want to identify to the target
3180 #                   as. If this option is not specified, an initiator name is
3181 #                   generated automatically.
3183 # @header-digest:   The desired header digest. Defaults to
3184 #                   none-crc32c.
3186 # @timeout:         Timeout in seconds after which a request will
3187 #                   timeout. 0 means no timeout and is the default.
3189 # Driver specific block device options for iscsi
3191 # Since: 2.9
3193 { 'struct': 'BlockdevOptionsIscsi',
3194   'data': { 'transport': 'IscsiTransport',
3195             'portal': 'str',
3196             'target': 'str',
3197             '*lun': 'int',
3198             '*user': 'str',
3199             '*password-secret': 'str',
3200             '*initiator-name': 'str',
3201             '*header-digest': 'IscsiHeaderDigest',
3202             '*timeout': 'int' } }
3206 # @RbdAuthMode:
3208 # Since: 3.0
3210 { 'enum': 'RbdAuthMode',
3211   'data': [ 'cephx', 'none' ] }
3214 # @BlockdevOptionsRbd:
3216 # @pool:               Ceph pool name.
3218 # @image:              Image name in the Ceph pool.
3220 # @conf:               path to Ceph configuration file.  Values
3221 #                      in the configuration file will be overridden by
3222 #                      options specified via QAPI.
3224 # @snapshot:           Ceph snapshot name.
3226 # @user:               Ceph id name.
3228 # @auth-client-required: Acceptable authentication modes.
3229 #                      This maps to Ceph configuration option
3230 #                      "auth_client_required".  (Since 3.0)
3232 # @key-secret:         ID of a QCryptoSecret object providing a key
3233 #                      for cephx authentication.
3234 #                      This maps to Ceph configuration option
3235 #                      "key".  (Since 3.0)
3237 # @server:             Monitor host address and port.  This maps
3238 #                      to the "mon_host" Ceph option.
3240 # Since: 2.9
3242 { 'struct': 'BlockdevOptionsRbd',
3243   'data': { 'pool': 'str',
3244             'image': 'str',
3245             '*conf': 'str',
3246             '*snapshot': 'str',
3247             '*user': 'str',
3248             '*auth-client-required': ['RbdAuthMode'],
3249             '*key-secret': 'str',
3250             '*server': ['InetSocketAddressBase'] } }
3253 # @BlockdevOptionsSheepdog:
3255 # Driver specific block device options for sheepdog
3257 # @vdi:         Virtual disk image name
3258 # @server:      The Sheepdog server to connect to
3259 # @snap-id:     Snapshot ID
3260 # @tag:         Snapshot tag name
3262 # Only one of @snap-id and @tag may be present.
3264 # Since: 2.9
3266 { 'struct': 'BlockdevOptionsSheepdog',
3267   'data': { 'server': 'SocketAddress',
3268             'vdi': 'str',
3269             '*snap-id': 'uint32',
3270             '*tag': 'str' } }
3273 # @ReplicationMode:
3275 # An enumeration of replication modes.
3277 # @primary: Primary mode, the vm's state will be sent to secondary QEMU.
3279 # @secondary: Secondary mode, receive the vm's state from primary QEMU.
3281 # Since: 2.9
3283 { 'enum' : 'ReplicationMode', 'data' : [ 'primary', 'secondary' ] }
3286 # @BlockdevOptionsReplication:
3288 # Driver specific block device options for replication
3290 # @mode: the replication mode
3292 # @top-id: In secondary mode, node name or device ID of the root
3293 #          node who owns the replication node chain. Must not be given in
3294 #          primary mode.
3296 # Since: 2.9
3298 { 'struct': 'BlockdevOptionsReplication',
3299   'base': 'BlockdevOptionsGenericFormat',
3300   'data': { 'mode': 'ReplicationMode',
3301             '*top-id': 'str' } }
3304 # @NFSTransport:
3306 # An enumeration of NFS transport types
3308 # @inet:        TCP transport
3310 # Since: 2.9
3312 { 'enum': 'NFSTransport',
3313   'data': [ 'inet' ] }
3316 # @NFSServer:
3318 # Captures the address of the socket
3320 # @type:        transport type used for NFS (only TCP supported)
3322 # @host:        host address for NFS server
3324 # Since: 2.9
3326 { 'struct': 'NFSServer',
3327   'data': { 'type': 'NFSTransport',
3328             'host': 'str' } }
3331 # @BlockdevOptionsNfs:
3333 # Driver specific block device option for NFS
3335 # @server:                  host address
3337 # @path:                    path of the image on the host
3339 # @user:                    UID value to use when talking to the
3340 #                           server (defaults to 65534 on Windows and getuid()
3341 #                           on unix)
3343 # @group:                   GID value to use when talking to the
3344 #                           server (defaults to 65534 on Windows and getgid()
3345 #                           in unix)
3347 # @tcp-syn-count:           number of SYNs during the session
3348 #                           establishment (defaults to libnfs default)
3350 # @readahead-size:          set the readahead size in bytes (defaults
3351 #                           to libnfs default)
3353 # @page-cache-size:         set the pagecache size in bytes (defaults
3354 #                           to libnfs default)
3356 # @debug:                   set the NFS debug level (max 2) (defaults
3357 #                           to libnfs default)
3359 # Since: 2.9
3361 { 'struct': 'BlockdevOptionsNfs',
3362   'data': { 'server': 'NFSServer',
3363             'path': 'str',
3364             '*user': 'int',
3365             '*group': 'int',
3366             '*tcp-syn-count': 'int',
3367             '*readahead-size': 'int',
3368             '*page-cache-size': 'int',
3369             '*debug': 'int' } }
3372 # @BlockdevOptionsCurlBase:
3374 # Driver specific block device options shared by all protocols supported by the
3375 # curl backend.
3377 # @url:                     URL of the image file
3379 # @readahead:               Size of the read-ahead cache; must be a multiple of
3380 #                           512 (defaults to 256 kB)
3382 # @timeout:                 Timeout for connections, in seconds (defaults to 5)
3384 # @username:                Username for authentication (defaults to none)
3386 # @password-secret:         ID of a QCryptoSecret object providing a password
3387 #                           for authentication (defaults to no password)
3389 # @proxy-username:          Username for proxy authentication (defaults to none)
3391 # @proxy-password-secret:   ID of a QCryptoSecret object providing a password
3392 #                           for proxy authentication (defaults to no password)
3394 # Since: 2.9
3396 { 'struct': 'BlockdevOptionsCurlBase',
3397   'data': { 'url': 'str',
3398             '*readahead': 'int',
3399             '*timeout': 'int',
3400             '*username': 'str',
3401             '*password-secret': 'str',
3402             '*proxy-username': 'str',
3403             '*proxy-password-secret': 'str' } }
3406 # @BlockdevOptionsCurlHttp:
3408 # Driver specific block device options for HTTP connections over the curl
3409 # backend.  URLs must start with "http://".
3411 # @cookie:      List of cookies to set; format is
3412 #               "name1=content1; name2=content2;" as explained by
3413 #               CURLOPT_COOKIE(3). Defaults to no cookies.
3415 # @cookie-secret: ID of a QCryptoSecret object providing the cookie data in a
3416 #                 secure way. See @cookie for the format. (since 2.10)
3418 # Since: 2.9
3420 { 'struct': 'BlockdevOptionsCurlHttp',
3421   'base': 'BlockdevOptionsCurlBase',
3422   'data': { '*cookie': 'str',
3423             '*cookie-secret': 'str'} }
3426 # @BlockdevOptionsCurlHttps:
3428 # Driver specific block device options for HTTPS connections over the curl
3429 # backend.  URLs must start with "https://".
3431 # @cookie:      List of cookies to set; format is
3432 #               "name1=content1; name2=content2;" as explained by
3433 #               CURLOPT_COOKIE(3). Defaults to no cookies.
3435 # @sslverify:   Whether to verify the SSL certificate's validity (defaults to
3436 #               true)
3438 # @cookie-secret: ID of a QCryptoSecret object providing the cookie data in a
3439 #                 secure way. See @cookie for the format. (since 2.10)
3441 # Since: 2.9
3443 { 'struct': 'BlockdevOptionsCurlHttps',
3444   'base': 'BlockdevOptionsCurlBase',
3445   'data': { '*cookie': 'str',
3446             '*sslverify': 'bool',
3447             '*cookie-secret': 'str'} }
3450 # @BlockdevOptionsCurlFtp:
3452 # Driver specific block device options for FTP connections over the curl
3453 # backend.  URLs must start with "ftp://".
3455 # Since: 2.9
3457 { 'struct': 'BlockdevOptionsCurlFtp',
3458   'base': 'BlockdevOptionsCurlBase',
3459   'data': { } }
3462 # @BlockdevOptionsCurlFtps:
3464 # Driver specific block device options for FTPS connections over the curl
3465 # backend.  URLs must start with "ftps://".
3467 # @sslverify:   Whether to verify the SSL certificate's validity (defaults to
3468 #               true)
3470 # Since: 2.9
3472 { 'struct': 'BlockdevOptionsCurlFtps',
3473   'base': 'BlockdevOptionsCurlBase',
3474   'data': { '*sslverify': 'bool' } }
3477 # @BlockdevOptionsNbd:
3479 # Driver specific block device options for NBD.
3481 # @server:      NBD server address
3483 # @export:      export name
3485 # @tls-creds:   TLS credentials ID
3487 # Since: 2.9
3489 { 'struct': 'BlockdevOptionsNbd',
3490   'data': { 'server': 'SocketAddress',
3491             '*export': 'str',
3492             '*tls-creds': 'str' } }
3495 # @BlockdevOptionsRaw:
3497 # Driver specific block device options for the raw driver.
3499 # @offset:      position where the block device starts
3500 # @size:        the assumed size of the device
3502 # Since: 2.9
3504 { 'struct': 'BlockdevOptionsRaw',
3505   'base': 'BlockdevOptionsGenericFormat',
3506   'data': { '*offset': 'int', '*size': 'int' } }
3509 # @BlockdevOptionsVxHS:
3511 # Driver specific block device options for VxHS
3513 # @vdisk-id:    UUID of VxHS volume
3514 # @server:      vxhs server IP, port
3515 # @tls-creds:   TLS credentials ID
3517 # Since: 2.10
3519 { 'struct': 'BlockdevOptionsVxHS',
3520   'data': { 'vdisk-id': 'str',
3521             'server': 'InetSocketAddressBase',
3522             '*tls-creds': 'str' } }
3525 # @BlockdevOptionsThrottle:
3527 # Driver specific block device options for the throttle driver
3529 # @throttle-group:   the name of the throttle-group object to use. It
3530 #                    must already exist.
3531 # @file:             reference to or definition of the data source block device
3532 # Since: 2.11
3534 { 'struct': 'BlockdevOptionsThrottle',
3535   'data': { 'throttle-group': 'str',
3536             'file' : 'BlockdevRef'
3537              } }
3539 # @BlockdevOptions:
3541 # Options for creating a block device.  Many options are available for all
3542 # block devices, independent of the block driver:
3544 # @driver:        block driver name
3545 # @node-name:     the node name of the new node (Since 2.0).
3546 #                 This option is required on the top level of blockdev-add.
3547 # @discard:       discard-related options (default: ignore)
3548 # @cache:         cache-related options
3549 # @read-only:     whether the block device should be read-only (default: false).
3550 #                 Note that some block drivers support only read-only access,
3551 #                 either generally or in certain configurations. In this case,
3552 #                 the default value does not work and the option must be
3553 #                 specified explicitly.
3554 # @detect-zeroes: detect and optimize zero writes (Since 2.1)
3555 #                 (default: off)
3556 # @force-share:   force share all permission on added nodes.
3557 #                 Requires read-only=true. (Since 2.10)
3559 # Remaining options are determined by the block driver.
3561 # Since: 2.9
3563 { 'union': 'BlockdevOptions',
3564   'base': { 'driver': 'BlockdevDriver',
3565             '*node-name': 'str',
3566             '*discard': 'BlockdevDiscardOptions',
3567             '*cache': 'BlockdevCacheOptions',
3568             '*read-only': 'bool',
3569             '*force-share': 'bool',
3570             '*detect-zeroes': 'BlockdevDetectZeroesOptions' },
3571   'discriminator': 'driver',
3572   'data': {
3573       'blkdebug':   'BlockdevOptionsBlkdebug',
3574       'blkverify':  'BlockdevOptionsBlkverify',
3575       'bochs':      'BlockdevOptionsGenericFormat',
3576       'cloop':      'BlockdevOptionsGenericFormat',
3577       'copy-on-read':'BlockdevOptionsGenericFormat',
3578       'dmg':        'BlockdevOptionsGenericFormat',
3579       'file':       'BlockdevOptionsFile',
3580       'ftp':        'BlockdevOptionsCurlFtp',
3581       'ftps':       'BlockdevOptionsCurlFtps',
3582       'gluster':    'BlockdevOptionsGluster',
3583       'host_cdrom': 'BlockdevOptionsFile',
3584       'host_device':'BlockdevOptionsFile',
3585       'http':       'BlockdevOptionsCurlHttp',
3586       'https':      'BlockdevOptionsCurlHttps',
3587       'iscsi':      'BlockdevOptionsIscsi',
3588       'luks':       'BlockdevOptionsLUKS',
3589       'nbd':        'BlockdevOptionsNbd',
3590       'nfs':        'BlockdevOptionsNfs',
3591       'null-aio':   'BlockdevOptionsNull',
3592       'null-co':    'BlockdevOptionsNull',
3593       'nvme':       'BlockdevOptionsNVMe',
3594       'parallels':  'BlockdevOptionsGenericFormat',
3595       'qcow2':      'BlockdevOptionsQcow2',
3596       'qcow':       'BlockdevOptionsQcow',
3597       'qed':        'BlockdevOptionsGenericCOWFormat',
3598       'quorum':     'BlockdevOptionsQuorum',
3599       'raw':        'BlockdevOptionsRaw',
3600       'rbd':        'BlockdevOptionsRbd',
3601       'replication':'BlockdevOptionsReplication',
3602       'sheepdog':   'BlockdevOptionsSheepdog',
3603       'ssh':        'BlockdevOptionsSsh',
3604       'throttle':   'BlockdevOptionsThrottle',
3605       'vdi':        'BlockdevOptionsGenericFormat',
3606       'vhdx':       'BlockdevOptionsGenericFormat',
3607       'vmdk':       'BlockdevOptionsGenericCOWFormat',
3608       'vpc':        'BlockdevOptionsGenericFormat',
3609       'vvfat':      'BlockdevOptionsVVFAT',
3610       'vxhs':       'BlockdevOptionsVxHS'
3611   } }
3614 # @BlockdevRef:
3616 # Reference to a block device.
3618 # @definition:      defines a new block device inline
3619 # @reference:       references the ID of an existing block device
3621 # Since: 2.9
3623 { 'alternate': 'BlockdevRef',
3624   'data': { 'definition': 'BlockdevOptions',
3625             'reference': 'str' } }
3628 # @BlockdevRefOrNull:
3630 # Reference to a block device.
3632 # @definition:      defines a new block device inline
3633 # @reference:       references the ID of an existing block device.
3634 #                   An empty string means that no block device should
3635 #                   be referenced.  Deprecated; use null instead.
3636 # @null:            No block device should be referenced (since 2.10)
3638 # Since: 2.9
3640 { 'alternate': 'BlockdevRefOrNull',
3641   'data': { 'definition': 'BlockdevOptions',
3642             'reference': 'str',
3643             'null': 'null' } }
3646 # @blockdev-add:
3648 # Creates a new block device. If the @id option is given at the top level, a
3649 # BlockBackend will be created; otherwise, @node-name is mandatory at the top
3650 # level and no BlockBackend will be created.
3652 # Since: 2.9
3654 # Example:
3656 # 1.
3657 # -> { "execute": "blockdev-add",
3658 #      "arguments": {
3659 #           "driver": "qcow2",
3660 #           "node-name": "test1",
3661 #           "file": {
3662 #               "driver": "file",
3663 #               "filename": "test.qcow2"
3664 #            }
3665 #       }
3666 #     }
3667 # <- { "return": {} }
3669 # 2.
3670 # -> { "execute": "blockdev-add",
3671 #      "arguments": {
3672 #           "driver": "qcow2",
3673 #           "node-name": "node0",
3674 #           "discard": "unmap",
3675 #           "cache": {
3676 #              "direct": true
3677 #            },
3678 #            "file": {
3679 #              "driver": "file",
3680 #              "filename": "/tmp/test.qcow2"
3681 #            },
3682 #            "backing": {
3683 #               "driver": "raw",
3684 #               "file": {
3685 #                  "driver": "file",
3686 #                  "filename": "/dev/fdset/4"
3687 #                }
3688 #            }
3689 #        }
3690 #      }
3692 # <- { "return": {} }
3695 { 'command': 'blockdev-add', 'data': 'BlockdevOptions', 'boxed': true }
3698 # @blockdev-del:
3700 # Deletes a block device that has been added using blockdev-add.
3701 # The command will fail if the node is attached to a device or is
3702 # otherwise being used.
3704 # @node-name: Name of the graph node to delete.
3706 # Since: 2.9
3708 # Example:
3710 # -> { "execute": "blockdev-add",
3711 #      "arguments": {
3712 #           "driver": "qcow2",
3713 #           "node-name": "node0",
3714 #           "file": {
3715 #               "driver": "file",
3716 #               "filename": "test.qcow2"
3717 #           }
3718 #      }
3719 #    }
3720 # <- { "return": {} }
3722 # -> { "execute": "blockdev-del",
3723 #      "arguments": { "node-name": "node0" }
3724 #    }
3725 # <- { "return": {} }
3728 { 'command': 'blockdev-del', 'data': { 'node-name': 'str' } }
3731 # @BlockdevCreateOptionsFile:
3733 # Driver specific image creation options for file.
3735 # @filename         Filename for the new image file
3736 # @size             Size of the virtual disk in bytes
3737 # @preallocation    Preallocation mode for the new image (default: off)
3738 # @nocow            Turn off copy-on-write (valid only on btrfs; default: off)
3740 # Since: 2.12
3742 { 'struct': 'BlockdevCreateOptionsFile',
3743   'data': { 'filename':         'str',
3744             'size':             'size',
3745             '*preallocation':   'PreallocMode',
3746             '*nocow':           'bool' } }
3749 # @BlockdevCreateOptionsGluster:
3751 # Driver specific image creation options for gluster.
3753 # @location         Where to store the new image file
3754 # @size             Size of the virtual disk in bytes
3755 # @preallocation    Preallocation mode for the new image (default: off)
3757 # Since: 2.12
3759 { 'struct': 'BlockdevCreateOptionsGluster',
3760   'data': { 'location':         'BlockdevOptionsGluster',
3761             'size':             'size',
3762             '*preallocation':   'PreallocMode' } }
3765 # @BlockdevCreateOptionsLUKS:
3767 # Driver specific image creation options for LUKS.
3769 # @file             Node to create the image format on
3770 # @size             Size of the virtual disk in bytes
3772 # Since: 2.12
3774 { 'struct': 'BlockdevCreateOptionsLUKS',
3775   'base': 'QCryptoBlockCreateOptionsLUKS',
3776   'data': { 'file':             'BlockdevRef',
3777             'size':             'size' } }
3780 # @BlockdevCreateOptionsNfs:
3782 # Driver specific image creation options for NFS.
3784 # @location         Where to store the new image file
3785 # @size             Size of the virtual disk in bytes
3787 # Since: 2.12
3789 { 'struct': 'BlockdevCreateOptionsNfs',
3790   'data': { 'location':         'BlockdevOptionsNfs',
3791             'size':             'size' } }
3794 # @BlockdevCreateOptionsParallels:
3796 # Driver specific image creation options for parallels.
3798 # @file             Node to create the image format on
3799 # @size             Size of the virtual disk in bytes
3800 # @cluster-size     Cluster size in bytes (default: 1 MB)
3802 # Since: 2.12
3804 { 'struct': 'BlockdevCreateOptionsParallels',
3805   'data': { 'file':             'BlockdevRef',
3806             'size':             'size',
3807             '*cluster-size':    'size' } }
3810 # @BlockdevCreateOptionsQcow:
3812 # Driver specific image creation options for qcow.
3814 # @file             Node to create the image format on
3815 # @size             Size of the virtual disk in bytes
3816 # @backing-file     File name of the backing file if a backing file
3817 #                   should be used
3818 # @encrypt          Encryption options if the image should be encrypted
3820 # Since: 2.12
3822 { 'struct': 'BlockdevCreateOptionsQcow',
3823   'data': { 'file':             'BlockdevRef',
3824             'size':             'size',
3825             '*backing-file':    'str',
3826             '*encrypt':         'QCryptoBlockCreateOptions' } }
3829 # @BlockdevQcow2Version:
3831 # @v2:  The original QCOW2 format as introduced in qemu 0.10 (version 2)
3832 # @v3:  The extended QCOW2 format as introduced in qemu 1.1 (version 3)
3834 # Since: 2.12
3836 { 'enum': 'BlockdevQcow2Version',
3837   'data': [ 'v2', 'v3' ] }
3841 # @BlockdevCreateOptionsQcow2:
3843 # Driver specific image creation options for qcow2.
3845 # @file             Node to create the image format on
3846 # @size             Size of the virtual disk in bytes
3847 # @version          Compatibility level (default: v3)
3848 # @backing-file     File name of the backing file if a backing file
3849 #                   should be used
3850 # @backing-fmt      Name of the block driver to use for the backing file
3851 # @encrypt          Encryption options if the image should be encrypted
3852 # @cluster-size     qcow2 cluster size in bytes (default: 65536)
3853 # @preallocation    Preallocation mode for the new image (default: off)
3854 # @lazy-refcounts   True if refcounts may be updated lazily (default: off)
3855 # @refcount-bits    Width of reference counts in bits (default: 16)
3857 # Since: 2.12
3859 { 'struct': 'BlockdevCreateOptionsQcow2',
3860   'data': { 'file':             'BlockdevRef',
3861             'size':             'size',
3862             '*version':         'BlockdevQcow2Version',
3863             '*backing-file':    'str',
3864             '*backing-fmt':     'BlockdevDriver',
3865             '*encrypt':         'QCryptoBlockCreateOptions',
3866             '*cluster-size':    'size',
3867             '*preallocation':   'PreallocMode',
3868             '*lazy-refcounts':  'bool',
3869             '*refcount-bits':   'int' } }
3872 # @BlockdevCreateOptionsQed:
3874 # Driver specific image creation options for qed.
3876 # @file             Node to create the image format on
3877 # @size             Size of the virtual disk in bytes
3878 # @backing-file     File name of the backing file if a backing file
3879 #                   should be used
3880 # @backing-fmt      Name of the block driver to use for the backing file
3881 # @cluster-size     Cluster size in bytes (default: 65536)
3882 # @table-size       L1/L2 table size (in clusters)
3884 # Since: 2.12
3886 { 'struct': 'BlockdevCreateOptionsQed',
3887   'data': { 'file':             'BlockdevRef',
3888             'size':             'size',
3889             '*backing-file':    'str',
3890             '*backing-fmt':     'BlockdevDriver',
3891             '*cluster-size':    'size',
3892             '*table-size':      'int' } }
3895 # @BlockdevCreateOptionsRbd:
3897 # Driver specific image creation options for rbd/Ceph.
3899 # @location         Where to store the new image file. This location cannot
3900 #                   point to a snapshot.
3901 # @size             Size of the virtual disk in bytes
3902 # @cluster-size     RBD object size
3904 # Since: 2.12
3906 { 'struct': 'BlockdevCreateOptionsRbd',
3907   'data': { 'location':         'BlockdevOptionsRbd',
3908             'size':             'size',
3909             '*cluster-size' :   'size' } }
3912 # @SheepdogRedundancyType:
3914 # @full             Create a fully replicated vdi with x copies
3915 # @erasure-coded    Create an erasure coded vdi with x data strips and
3916 #                   y parity strips
3918 # Since: 2.12
3920 { 'enum': 'SheepdogRedundancyType',
3921   'data': [ 'full', 'erasure-coded' ] }
3924 # @SheepdogRedundancyFull:
3926 # @copies           Number of copies to use (between 1 and 31)
3928 # Since: 2.12
3930 { 'struct': 'SheepdogRedundancyFull',
3931   'data': { 'copies': 'int' }}
3934 # @SheepdogRedundancyErasureCoded:
3936 # @data-strips      Number of data strips to use (one of {2,4,8,16})
3937 # @parity-strips    Number of parity strips to use (between 1 and 15)
3939 # Since: 2.12
3941 { 'struct': 'SheepdogRedundancyErasureCoded',
3942   'data': { 'data-strips': 'int',
3943             'parity-strips': 'int' }}
3946 # @SheepdogRedundancy:
3948 # Since: 2.12
3950 { 'union': 'SheepdogRedundancy',
3951   'base': { 'type': 'SheepdogRedundancyType' },
3952   'discriminator': 'type',
3953   'data': { 'full': 'SheepdogRedundancyFull',
3954             'erasure-coded': 'SheepdogRedundancyErasureCoded' } }
3957 # @BlockdevCreateOptionsSheepdog:
3959 # Driver specific image creation options for Sheepdog.
3961 # @location         Where to store the new image file
3962 # @size             Size of the virtual disk in bytes
3963 # @backing-file     File name of a base image
3964 # @preallocation    Preallocation mode (allowed values: off, full)
3965 # @redundancy       Redundancy of the image
3966 # @object-size      Object size of the image
3968 # Since: 2.12
3970 { 'struct': 'BlockdevCreateOptionsSheepdog',
3971   'data': { 'location':         'BlockdevOptionsSheepdog',
3972             'size':             'size',
3973             '*backing-file':    'str',
3974             '*preallocation':   'PreallocMode',
3975             '*redundancy':      'SheepdogRedundancy',
3976             '*object-size':     'size' } }
3979 # @BlockdevCreateOptionsSsh:
3981 # Driver specific image creation options for SSH.
3983 # @location         Where to store the new image file
3984 # @size             Size of the virtual disk in bytes
3986 # Since: 2.12
3988 { 'struct': 'BlockdevCreateOptionsSsh',
3989   'data': { 'location':         'BlockdevOptionsSsh',
3990             'size':             'size' } }
3993 # @BlockdevCreateOptionsVdi:
3995 # Driver specific image creation options for VDI.
3997 # @file             Node to create the image format on
3998 # @size             Size of the virtual disk in bytes
3999 # @preallocation    Preallocation mode for the new image (allowed values: off,
4000 #                   metadata; default: off)
4002 # Since: 2.12
4004 { 'struct': 'BlockdevCreateOptionsVdi',
4005   'data': { 'file':             'BlockdevRef',
4006             'size':             'size',
4007             '*preallocation':   'PreallocMode' } }
4010 # @BlockdevVhdxSubformat:
4012 # @dynamic: Growing image file
4013 # @fixed:   Preallocated fixed-size image file
4015 # Since: 2.12
4017 { 'enum': 'BlockdevVhdxSubformat',
4018   'data': [ 'dynamic', 'fixed' ] }
4021 # @BlockdevCreateOptionsVhdx:
4023 # Driver specific image creation options for vhdx.
4025 # @file             Node to create the image format on
4026 # @size             Size of the virtual disk in bytes
4027 # @log-size         Log size in bytes, must be a multiple of 1 MB
4028 #                   (default: 1 MB)
4029 # @block-size       Block size in bytes, must be a multiple of 1 MB and not
4030 #                   larger than 256 MB (default: automatically choose a block
4031 #                   size depending on the image size)
4032 # @subformat        vhdx subformat (default: dynamic)
4033 # @block-state-zero Force use of payload blocks of type 'ZERO'. Non-standard,
4034 #                   but default.  Do not set to 'off' when using 'qemu-img
4035 #                   convert' with subformat=dynamic.
4037 # Since: 2.12
4039 { 'struct': 'BlockdevCreateOptionsVhdx',
4040   'data': { 'file':                 'BlockdevRef',
4041             'size':                 'size',
4042             '*log-size':            'size',
4043             '*block-size':          'size',
4044             '*subformat':           'BlockdevVhdxSubformat',
4045             '*block-state-zero':    'bool' } }
4048 # @BlockdevVpcSubformat:
4050 # @dynamic: Growing image file
4051 # @fixed:   Preallocated fixed-size image file
4053 # Since: 2.12
4055 { 'enum': 'BlockdevVpcSubformat',
4056   'data': [ 'dynamic', 'fixed' ] }
4059 # @BlockdevCreateOptionsVpc:
4061 # Driver specific image creation options for vpc (VHD).
4063 # @file             Node to create the image format on
4064 # @size             Size of the virtual disk in bytes
4065 # @subformat        vhdx subformat (default: dynamic)
4066 # @force-size       Force use of the exact byte size instead of rounding to the
4067 #                   next size that can be represented in CHS geometry
4068 #                   (default: false)
4070 # Since: 2.12
4072 { 'struct': 'BlockdevCreateOptionsVpc',
4073   'data': { 'file':                 'BlockdevRef',
4074             'size':                 'size',
4075             '*subformat':           'BlockdevVpcSubformat',
4076             '*force-size':          'bool' } }
4079 # @BlockdevCreateNotSupported:
4081 # This is used for all drivers that don't support creating images.
4083 # Since: 2.12
4085 { 'struct': 'BlockdevCreateNotSupported', 'data': {}}
4088 # @BlockdevCreateOptions:
4090 # Options for creating an image format on a given node.
4092 # @driver           block driver to create the image format
4094 # Since: 2.12
4096 { 'union': 'BlockdevCreateOptions',
4097   'base': {
4098       'driver':         'BlockdevDriver' },
4099   'discriminator': 'driver',
4100   'data': {
4101       'blkdebug':       'BlockdevCreateNotSupported',
4102       'blkverify':      'BlockdevCreateNotSupported',
4103       'bochs':          'BlockdevCreateNotSupported',
4104       'cloop':          'BlockdevCreateNotSupported',
4105       'copy-on-read':   'BlockdevCreateNotSupported',
4106       'dmg':            'BlockdevCreateNotSupported',
4107       'file':           'BlockdevCreateOptionsFile',
4108       'ftp':            'BlockdevCreateNotSupported',
4109       'ftps':           'BlockdevCreateNotSupported',
4110       'gluster':        'BlockdevCreateOptionsGluster',
4111       'host_cdrom':     'BlockdevCreateNotSupported',
4112       'host_device':    'BlockdevCreateNotSupported',
4113       'http':           'BlockdevCreateNotSupported',
4114       'https':          'BlockdevCreateNotSupported',
4115       'iscsi':          'BlockdevCreateNotSupported',
4116       'luks':           'BlockdevCreateOptionsLUKS',
4117       'nbd':            'BlockdevCreateNotSupported',
4118       'nfs':            'BlockdevCreateOptionsNfs',
4119       'null-aio':       'BlockdevCreateNotSupported',
4120       'null-co':        'BlockdevCreateNotSupported',
4121       'nvme':           'BlockdevCreateNotSupported',
4122       'parallels':      'BlockdevCreateOptionsParallels',
4123       'qcow':           'BlockdevCreateOptionsQcow',
4124       'qcow2':          'BlockdevCreateOptionsQcow2',
4125       'qed':            'BlockdevCreateOptionsQed',
4126       'quorum':         'BlockdevCreateNotSupported',
4127       'raw':            'BlockdevCreateNotSupported',
4128       'rbd':            'BlockdevCreateOptionsRbd',
4129       'replication':    'BlockdevCreateNotSupported',
4130       'sheepdog':       'BlockdevCreateOptionsSheepdog',
4131       'ssh':            'BlockdevCreateOptionsSsh',
4132       'throttle':       'BlockdevCreateNotSupported',
4133       'vdi':            'BlockdevCreateOptionsVdi',
4134       'vhdx':           'BlockdevCreateOptionsVhdx',
4135       'vmdk':           'BlockdevCreateNotSupported',
4136       'vpc':            'BlockdevCreateOptionsVpc',
4137       'vvfat':          'BlockdevCreateNotSupported',
4138       'vxhs':           'BlockdevCreateNotSupported'
4139   } }
4142 # @blockdev-create:
4144 # Starts a job to create an image format on a given node. The job is
4145 # automatically finalized, but a manual job-dismiss is required.
4147 # @job-id:          Identifier for the newly created job.
4149 # @options:         Options for the image creation.
4151 # Since: 3.0
4153 { 'command': 'blockdev-create',
4154   'data': { 'job-id': 'str',
4155             'options': 'BlockdevCreateOptions' } }
4158 # @blockdev-open-tray:
4160 # Opens a block device's tray. If there is a block driver state tree inserted as
4161 # a medium, it will become inaccessible to the guest (but it will remain
4162 # associated to the block device, so closing the tray will make it accessible
4163 # again).
4165 # If the tray was already open before, this will be a no-op.
4167 # Once the tray opens, a DEVICE_TRAY_MOVED event is emitted. There are cases in
4168 # which no such event will be generated, these include:
4169 # - if the guest has locked the tray, @force is false and the guest does not
4170 #   respond to the eject request
4171 # - if the BlockBackend denoted by @device does not have a guest device attached
4172 #   to it
4173 # - if the guest device does not have an actual tray
4175 # @device: Block device name (deprecated, use @id instead)
4177 # @id:     The name or QOM path of the guest device (since: 2.8)
4179 # @force:  if false (the default), an eject request will be sent to
4180 #          the guest if it has locked the tray (and the tray will not be opened
4181 #          immediately); if true, the tray will be opened regardless of whether
4182 #          it is locked
4184 # Since: 2.5
4186 # Example:
4188 # -> { "execute": "blockdev-open-tray",
4189 #      "arguments": { "id": "ide0-1-0" } }
4191 # <- { "timestamp": { "seconds": 1418751016,
4192 #                     "microseconds": 716996 },
4193 #      "event": "DEVICE_TRAY_MOVED",
4194 #      "data": { "device": "ide1-cd0",
4195 #                "id": "ide0-1-0",
4196 #                "tray-open": true } }
4198 # <- { "return": {} }
4201 { 'command': 'blockdev-open-tray',
4202   'data': { '*device': 'str',
4203             '*id': 'str',
4204             '*force': 'bool' } }
4207 # @blockdev-close-tray:
4209 # Closes a block device's tray. If there is a block driver state tree associated
4210 # with the block device (which is currently ejected), that tree will be loaded
4211 # as the medium.
4213 # If the tray was already closed before, this will be a no-op.
4215 # @device:  Block device name (deprecated, use @id instead)
4217 # @id:      The name or QOM path of the guest device (since: 2.8)
4219 # Since: 2.5
4221 # Example:
4223 # -> { "execute": "blockdev-close-tray",
4224 #      "arguments": { "id": "ide0-1-0" } }
4226 # <- { "timestamp": { "seconds": 1418751345,
4227 #                     "microseconds": 272147 },
4228 #      "event": "DEVICE_TRAY_MOVED",
4229 #      "data": { "device": "ide1-cd0",
4230 #                "id": "ide0-1-0",
4231 #                "tray-open": false } }
4233 # <- { "return": {} }
4236 { 'command': 'blockdev-close-tray',
4237   'data': { '*device': 'str',
4238             '*id': 'str' } }
4241 # @blockdev-remove-medium:
4243 # Removes a medium (a block driver state tree) from a block device. That block
4244 # device's tray must currently be open (unless there is no attached guest
4245 # device).
4247 # If the tray is open and there is no medium inserted, this will be a no-op.
4249 # @id:     The name or QOM path of the guest device
4251 # Since: 2.12
4253 # Example:
4255 # -> { "execute": "blockdev-remove-medium",
4256 #      "arguments": { "id": "ide0-1-0" } }
4258 # <- { "error": { "class": "GenericError",
4259 #                 "desc": "Tray of device 'ide0-1-0' is not open" } }
4261 # -> { "execute": "blockdev-open-tray",
4262 #      "arguments": { "id": "ide0-1-0" } }
4264 # <- { "timestamp": { "seconds": 1418751627,
4265 #                     "microseconds": 549958 },
4266 #      "event": "DEVICE_TRAY_MOVED",
4267 #      "data": { "device": "ide1-cd0",
4268 #                "id": "ide0-1-0",
4269 #                "tray-open": true } }
4271 # <- { "return": {} }
4273 # -> { "execute": "blockdev-remove-medium",
4274 #      "arguments": { "id": "ide0-1-0" } }
4276 # <- { "return": {} }
4279 { 'command': 'blockdev-remove-medium',
4280   'data': { 'id': 'str' } }
4283 # @blockdev-insert-medium:
4285 # Inserts a medium (a block driver state tree) into a block device. That block
4286 # device's tray must currently be open (unless there is no attached guest
4287 # device) and there must be no medium inserted already.
4289 # @id:        The name or QOM path of the guest device
4291 # @node-name: name of a node in the block driver state graph
4293 # Since: 2.12
4295 # Example:
4297 # -> { "execute": "blockdev-add",
4298 #      "arguments": {
4299 #          "node-name": "node0",
4300 #          "driver": "raw",
4301 #          "file": { "driver": "file",
4302 #                    "filename": "fedora.iso" } } }
4303 # <- { "return": {} }
4305 # -> { "execute": "blockdev-insert-medium",
4306 #      "arguments": { "id": "ide0-1-0",
4307 #                     "node-name": "node0" } }
4309 # <- { "return": {} }
4312 { 'command': 'blockdev-insert-medium',
4313   'data': { 'id': 'str',
4314             'node-name': 'str'} }
4318 # @BlockdevChangeReadOnlyMode:
4320 # Specifies the new read-only mode of a block device subject to the
4321 # @blockdev-change-medium command.
4323 # @retain:      Retains the current read-only mode
4325 # @read-only:   Makes the device read-only
4327 # @read-write:  Makes the device writable
4329 # Since: 2.3
4332 { 'enum': 'BlockdevChangeReadOnlyMode',
4333   'data': ['retain', 'read-only', 'read-write'] }
4337 # @blockdev-change-medium:
4339 # Changes the medium inserted into a block device by ejecting the current medium
4340 # and loading a new image file which is inserted as the new medium (this command
4341 # combines blockdev-open-tray, blockdev-remove-medium, blockdev-insert-medium
4342 # and blockdev-close-tray).
4344 # @device:          Block device name (deprecated, use @id instead)
4346 # @id:              The name or QOM path of the guest device
4347 #                   (since: 2.8)
4349 # @filename:        filename of the new image to be loaded
4351 # @format:          format to open the new image with (defaults to
4352 #                   the probed format)
4354 # @read-only-mode:  change the read-only mode of the device; defaults
4355 #                   to 'retain'
4357 # Since: 2.5
4359 # Examples:
4361 # 1. Change a removable medium
4363 # -> { "execute": "blockdev-change-medium",
4364 #      "arguments": { "id": "ide0-1-0",
4365 #                     "filename": "/srv/images/Fedora-12-x86_64-DVD.iso",
4366 #                     "format": "raw" } }
4367 # <- { "return": {} }
4369 # 2. Load a read-only medium into a writable drive
4371 # -> { "execute": "blockdev-change-medium",
4372 #      "arguments": { "id": "floppyA",
4373 #                     "filename": "/srv/images/ro.img",
4374 #                     "format": "raw",
4375 #                     "read-only-mode": "retain" } }
4377 # <- { "error":
4378 #      { "class": "GenericError",
4379 #        "desc": "Could not open '/srv/images/ro.img': Permission denied" } }
4381 # -> { "execute": "blockdev-change-medium",
4382 #      "arguments": { "id": "floppyA",
4383 #                     "filename": "/srv/images/ro.img",
4384 #                     "format": "raw",
4385 #                     "read-only-mode": "read-only" } }
4387 # <- { "return": {} }
4390 { 'command': 'blockdev-change-medium',
4391   'data': { '*device': 'str',
4392             '*id': 'str',
4393             'filename': 'str',
4394             '*format': 'str',
4395             '*read-only-mode': 'BlockdevChangeReadOnlyMode' } }
4399 # @BlockErrorAction:
4401 # An enumeration of action that has been taken when a DISK I/O occurs
4403 # @ignore: error has been ignored
4405 # @report: error has been reported to the device
4407 # @stop: error caused VM to be stopped
4409 # Since: 2.1
4411 { 'enum': 'BlockErrorAction',
4412   'data': [ 'ignore', 'report', 'stop' ] }
4416 # @BLOCK_IMAGE_CORRUPTED:
4418 # Emitted when a disk image is being marked corrupt. The image can be
4419 # identified by its device or node name. The 'device' field is always
4420 # present for compatibility reasons, but it can be empty ("") if the
4421 # image does not have a device name associated.
4423 # @device: device name. This is always present for compatibility
4424 #          reasons, but it can be empty ("") if the image does not
4425 #          have a device name associated.
4427 # @node-name: node name (Since: 2.4)
4429 # @msg: informative message for human consumption, such as the kind of
4430 #       corruption being detected. It should not be parsed by machine as it is
4431 #       not guaranteed to be stable
4433 # @offset: if the corruption resulted from an image access, this is
4434 #          the host's access offset into the image
4436 # @size: if the corruption resulted from an image access, this is
4437 #        the access size
4439 # @fatal: if set, the image is marked corrupt and therefore unusable after this
4440 #        event and must be repaired (Since 2.2; before, every
4441 #        BLOCK_IMAGE_CORRUPTED event was fatal)
4443 # Note: If action is "stop", a STOP event will eventually follow the
4444 #       BLOCK_IO_ERROR event.
4446 # Example:
4448 # <- { "event": "BLOCK_IMAGE_CORRUPTED",
4449 #      "data": { "device": "ide0-hd0", "node-name": "node0",
4450 #                "msg": "Prevented active L1 table overwrite", "offset": 196608,
4451 #                "size": 65536 },
4452 #      "timestamp": { "seconds": 1378126126, "microseconds": 966463 } }
4454 # Since: 1.7
4456 { 'event': 'BLOCK_IMAGE_CORRUPTED',
4457   'data': { 'device'     : 'str',
4458             '*node-name' : 'str',
4459             'msg'        : 'str',
4460             '*offset'    : 'int',
4461             '*size'      : 'int',
4462             'fatal'      : 'bool' } }
4465 # @BLOCK_IO_ERROR:
4467 # Emitted when a disk I/O error occurs
4469 # @device: device name. This is always present for compatibility
4470 #          reasons, but it can be empty ("") if the image does not
4471 #          have a device name associated.
4473 # @node-name: node name. Note that errors may be reported for the root node
4474 #             that is directly attached to a guest device rather than for the
4475 #             node where the error occurred. The node name is not present if
4476 #             the drive is empty. (Since: 2.8)
4478 # @operation: I/O operation
4480 # @action: action that has been taken
4482 # @nospace: true if I/O error was caused due to a no-space
4483 #           condition. This key is only present if query-block's
4484 #           io-status is present, please see query-block documentation
4485 #           for more information (since: 2.2)
4487 # @reason: human readable string describing the error cause.
4488 #          (This field is a debugging aid for humans, it should not
4489 #           be parsed by applications) (since: 2.2)
4491 # Note: If action is "stop", a STOP event will eventually follow the
4492 # BLOCK_IO_ERROR event
4494 # Since: 0.13.0
4496 # Example:
4498 # <- { "event": "BLOCK_IO_ERROR",
4499 #      "data": { "device": "ide0-hd1",
4500 #                "node-name": "#block212",
4501 #                "operation": "write",
4502 #                "action": "stop" },
4503 #      "timestamp": { "seconds": 1265044230, "microseconds": 450486 } }
4506 { 'event': 'BLOCK_IO_ERROR',
4507   'data': { 'device': 'str', '*node-name': 'str',
4508             'operation': 'IoOperationType',
4509             'action': 'BlockErrorAction', '*nospace': 'bool',
4510             'reason': 'str' } }
4513 # @BLOCK_JOB_COMPLETED:
4515 # Emitted when a block job has completed
4517 # @type: job type
4519 # @device: The job identifier. Originally the device name but other
4520 #          values are allowed since QEMU 2.7
4522 # @len: maximum progress value
4524 # @offset: current progress value. On success this is equal to len.
4525 #          On failure this is less than len
4527 # @speed: rate limit, bytes per second
4529 # @error: error message. Only present on failure. This field
4530 #         contains a human-readable error message. There are no semantics
4531 #         other than that streaming has failed and clients should not try to
4532 #         interpret the error string
4534 # Since: 1.1
4536 # Example:
4538 # <- { "event": "BLOCK_JOB_COMPLETED",
4539 #      "data": { "type": "stream", "device": "virtio-disk0",
4540 #                "len": 10737418240, "offset": 10737418240,
4541 #                "speed": 0 },
4542 #      "timestamp": { "seconds": 1267061043, "microseconds": 959568 } }
4545 { 'event': 'BLOCK_JOB_COMPLETED',
4546   'data': { 'type'  : 'JobType',
4547             'device': 'str',
4548             'len'   : 'int',
4549             'offset': 'int',
4550             'speed' : 'int',
4551             '*error': 'str' } }
4554 # @BLOCK_JOB_CANCELLED:
4556 # Emitted when a block job has been cancelled
4558 # @type: job type
4560 # @device: The job identifier. Originally the device name but other
4561 #          values are allowed since QEMU 2.7
4563 # @len: maximum progress value
4565 # @offset: current progress value. On success this is equal to len.
4566 #          On failure this is less than len
4568 # @speed: rate limit, bytes per second
4570 # Since: 1.1
4572 # Example:
4574 # <- { "event": "BLOCK_JOB_CANCELLED",
4575 #      "data": { "type": "stream", "device": "virtio-disk0",
4576 #                "len": 10737418240, "offset": 134217728,
4577 #                "speed": 0 },
4578 #      "timestamp": { "seconds": 1267061043, "microseconds": 959568 } }
4581 { 'event': 'BLOCK_JOB_CANCELLED',
4582   'data': { 'type'  : 'JobType',
4583             'device': 'str',
4584             'len'   : 'int',
4585             'offset': 'int',
4586             'speed' : 'int' } }
4589 # @BLOCK_JOB_ERROR:
4591 # Emitted when a block job encounters an error
4593 # @device: The job identifier. Originally the device name but other
4594 #          values are allowed since QEMU 2.7
4596 # @operation: I/O operation
4598 # @action: action that has been taken
4600 # Since: 1.3
4602 # Example:
4604 # <- { "event": "BLOCK_JOB_ERROR",
4605 #      "data": { "device": "ide0-hd1",
4606 #                "operation": "write",
4607 #                "action": "stop" },
4608 #      "timestamp": { "seconds": 1265044230, "microseconds": 450486 } }
4611 { 'event': 'BLOCK_JOB_ERROR',
4612   'data': { 'device'   : 'str',
4613             'operation': 'IoOperationType',
4614             'action'   : 'BlockErrorAction' } }
4617 # @BLOCK_JOB_READY:
4619 # Emitted when a block job is ready to complete
4621 # @type: job type
4623 # @device: The job identifier. Originally the device name but other
4624 #          values are allowed since QEMU 2.7
4626 # @len: maximum progress value
4628 # @offset: current progress value. On success this is equal to len.
4629 #          On failure this is less than len
4631 # @speed: rate limit, bytes per second
4633 # Note: The "ready to complete" status is always reset by a @BLOCK_JOB_ERROR
4634 # event
4636 # Since: 1.3
4638 # Example:
4640 # <- { "event": "BLOCK_JOB_READY",
4641 #      "data": { "device": "drive0", "type": "mirror", "speed": 0,
4642 #                "len": 2097152, "offset": 2097152 }
4643 #      "timestamp": { "seconds": 1265044230, "microseconds": 450486 } }
4646 { 'event': 'BLOCK_JOB_READY',
4647   'data': { 'type'  : 'JobType',
4648             'device': 'str',
4649             'len'   : 'int',
4650             'offset': 'int',
4651             'speed' : 'int' } }
4654 # @BLOCK_JOB_PENDING:
4656 # Emitted when a block job is awaiting explicit authorization to finalize graph
4657 # changes via @block-job-finalize. If this job is part of a transaction, it will
4658 # not emit this event until the transaction has converged first.
4660 # @type: job type
4662 # @id: The job identifier.
4664 # Since: 2.12
4666 # Example:
4668 # <- { "event": "BLOCK_JOB_WAITING",
4669 #      "data": { "device": "drive0", "type": "mirror" },
4670 #      "timestamp": { "seconds": 1265044230, "microseconds": 450486 } }
4673 { 'event': 'BLOCK_JOB_PENDING',
4674   'data': { 'type'  : 'JobType',
4675             'id'    : 'str' } }
4678 # @PreallocMode:
4680 # Preallocation mode of QEMU image file
4682 # @off: no preallocation
4683 # @metadata: preallocate only for metadata
4684 # @falloc: like @full preallocation but allocate disk space by
4685 #          posix_fallocate() rather than writing zeros.
4686 # @full: preallocate all data by writing zeros to device to ensure disk
4687 #        space is really available. @full preallocation also sets up
4688 #        metadata correctly.
4690 # Since: 2.2
4692 { 'enum': 'PreallocMode',
4693   'data': [ 'off', 'metadata', 'falloc', 'full' ] }
4696 # @BLOCK_WRITE_THRESHOLD:
4698 # Emitted when writes on block device reaches or exceeds the
4699 # configured write threshold. For thin-provisioned devices, this
4700 # means the device should be extended to avoid pausing for
4701 # disk exhaustion.
4702 # The event is one shot. Once triggered, it needs to be
4703 # re-registered with another block-set-write-threshold command.
4705 # @node-name: graph node name on which the threshold was exceeded.
4707 # @amount-exceeded: amount of data which exceeded the threshold, in bytes.
4709 # @write-threshold: last configured threshold, in bytes.
4711 # Since: 2.3
4713 { 'event': 'BLOCK_WRITE_THRESHOLD',
4714   'data': { 'node-name': 'str',
4715             'amount-exceeded': 'uint64',
4716             'write-threshold': 'uint64' } }
4719 # @block-set-write-threshold:
4721 # Change the write threshold for a block drive. An event will be
4722 # delivered if a write to this block drive crosses the configured
4723 # threshold.  The threshold is an offset, thus must be
4724 # non-negative. Default is no write threshold. Setting the threshold
4725 # to zero disables it.
4727 # This is useful to transparently resize thin-provisioned drives without
4728 # the guest OS noticing.
4730 # @node-name: graph node name on which the threshold must be set.
4732 # @write-threshold: configured threshold for the block device, bytes.
4733 #                   Use 0 to disable the threshold.
4735 # Since: 2.3
4737 # Example:
4739 # -> { "execute": "block-set-write-threshold",
4740 #      "arguments": { "node-name": "mydev",
4741 #                     "write-threshold": 17179869184 } }
4742 # <- { "return": {} }
4745 { 'command': 'block-set-write-threshold',
4746   'data': { 'node-name': 'str', 'write-threshold': 'uint64' } }
4749 # @x-blockdev-change:
4751 # Dynamically reconfigure the block driver state graph. It can be used
4752 # to add, remove, insert or replace a graph node. Currently only the
4753 # Quorum driver implements this feature to add or remove its child. This
4754 # is useful to fix a broken quorum child.
4756 # If @node is specified, it will be inserted under @parent. @child
4757 # may not be specified in this case. If both @parent and @child are
4758 # specified but @node is not, @child will be detached from @parent.
4760 # @parent: the id or name of the parent node.
4762 # @child: the name of a child under the given parent node.
4764 # @node: the name of the node that will be added.
4766 # Note: this command is experimental, and its API is not stable. It
4767 # does not support all kinds of operations, all kinds of children, nor
4768 # all block drivers.
4770 # FIXME Removing children from a quorum node means introducing gaps in the
4771 # child indices. This cannot be represented in the 'children' list of
4772 # BlockdevOptionsQuorum, as returned by .bdrv_refresh_filename().
4774 # Warning: The data in a new quorum child MUST be consistent with that of
4775 # the rest of the array.
4777 # Since: 2.7
4779 # Example:
4781 # 1. Add a new node to a quorum
4782 # -> { "execute": "blockdev-add",
4783 #      "arguments": {
4784 #          "driver": "raw",
4785 #          "node-name": "new_node",
4786 #          "file": { "driver": "file",
4787 #                    "filename": "test.raw" } } }
4788 # <- { "return": {} }
4789 # -> { "execute": "x-blockdev-change",
4790 #      "arguments": { "parent": "disk1",
4791 #                     "node": "new_node" } }
4792 # <- { "return": {} }
4794 # 2. Delete a quorum's node
4795 # -> { "execute": "x-blockdev-change",
4796 #      "arguments": { "parent": "disk1",
4797 #                     "child": "children.1" } }
4798 # <- { "return": {} }
4801 { 'command': 'x-blockdev-change',
4802   'data' : { 'parent': 'str',
4803              '*child': 'str',
4804              '*node': 'str' } }
4807 # @x-blockdev-set-iothread:
4809 # Move @node and its children into the @iothread.  If @iothread is null then
4810 # move @node and its children into the main loop.
4812 # The node must not be attached to a BlockBackend.
4814 # @node-name: the name of the block driver node
4816 # @iothread: the name of the IOThread object or null for the main loop
4818 # @force: true if the node and its children should be moved when a BlockBackend
4819 #         is already attached
4821 # Note: this command is experimental and intended for test cases that need
4822 # control over IOThreads only.
4824 # Since: 2.12
4826 # Example:
4828 # 1. Move a node into an IOThread
4829 # -> { "execute": "x-blockdev-set-iothread",
4830 #      "arguments": { "node-name": "disk1",
4831 #                     "iothread": "iothread0" } }
4832 # <- { "return": {} }
4834 # 2. Move a node into the main loop
4835 # -> { "execute": "x-blockdev-set-iothread",
4836 #      "arguments": { "node-name": "disk1",
4837 #                     "iothread": null } }
4838 # <- { "return": {} }
4841 { 'command': 'x-blockdev-set-iothread',
4842   'data' : { 'node-name': 'str',
4843              'iothread': 'StrOrNull',
4844              '*force': 'bool' } }