Revert "block: Remove dead deprecation warning code"
[qemu.git] / qapi / block-core.json
blob62a92fa4f4de36984990f088973732ae74417361
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': { 'luks': 'QCryptoBlockInfoLUKS' } }
58 # @ImageInfoSpecificQCow2:
60 # @compat: compatibility level
62 # @lazy-refcounts: on or off; only valid for compat >= 1.1
64 # @corrupt: true if the image has been marked corrupt; only valid for
65 #           compat >= 1.1 (since 2.2)
67 # @refcount-bits: width of a refcount entry in bits (since 2.3)
69 # @encrypt: details about encryption parameters; only set if image
70 #           is encrypted (since 2.10)
72 # Since: 1.7
74 { 'struct': 'ImageInfoSpecificQCow2',
75   'data': {
76       'compat': 'str',
77       '*lazy-refcounts': 'bool',
78       '*corrupt': 'bool',
79       'refcount-bits': 'int',
80       '*encrypt': 'ImageInfoSpecificQCow2Encryption'
81   } }
84 # @ImageInfoSpecificVmdk:
86 # @create-type: The create type of VMDK image
88 # @cid: Content id of image
90 # @parent-cid: Parent VMDK image's cid
92 # @extents: List of extent files
94 # Since: 1.7
96 { 'struct': 'ImageInfoSpecificVmdk',
97   'data': {
98       'create-type': 'str',
99       'cid': 'int',
100       'parent-cid': 'int',
101       'extents': ['ImageInfo']
102   } }
105 # @ImageInfoSpecific:
107 # A discriminated record of image format specific information structures.
109 # Since: 1.7
111 { 'union': 'ImageInfoSpecific',
112   'data': {
113       'qcow2': 'ImageInfoSpecificQCow2',
114       'vmdk': 'ImageInfoSpecificVmdk',
115       # If we need to add block driver specific parameters for
116       # LUKS in future, then we'll subclass QCryptoBlockInfoLUKS
117       # to define a ImageInfoSpecificLUKS
118       'luks': 'QCryptoBlockInfoLUKS'
119   } }
122 # @ImageInfo:
124 # Information about a QEMU image file
126 # @filename: name of the image file
128 # @format: format of the image file
130 # @virtual-size: maximum capacity in bytes of the image
132 # @actual-size: actual size on disk in bytes of the image
134 # @dirty-flag: true if image is not cleanly closed
136 # @cluster-size: size of a cluster in bytes
138 # @encrypted: true if the image is encrypted
140 # @compressed: true if the image is compressed (Since 1.7)
142 # @backing-filename: name of the backing file
144 # @full-backing-filename: full path of the backing file
146 # @backing-filename-format: the format of the backing file
148 # @snapshots: list of VM snapshots
150 # @backing-image: info of the backing image (since 1.6)
152 # @format-specific: structure supplying additional format-specific
153 # information (since 1.7)
155 # Since: 1.3
158 { 'struct': 'ImageInfo',
159   'data': {'filename': 'str', 'format': 'str', '*dirty-flag': 'bool',
160            '*actual-size': 'int', 'virtual-size': 'int',
161            '*cluster-size': 'int', '*encrypted': 'bool', '*compressed': 'bool',
162            '*backing-filename': 'str', '*full-backing-filename': 'str',
163            '*backing-filename-format': 'str', '*snapshots': ['SnapshotInfo'],
164            '*backing-image': 'ImageInfo',
165            '*format-specific': 'ImageInfoSpecific' } }
168 # @ImageCheck:
170 # Information about a QEMU image file check
172 # @filename: name of the image file checked
174 # @format: format of the image file checked
176 # @check-errors: number of unexpected errors occurred during check
178 # @image-end-offset: offset (in bytes) where the image ends, this
179 #                    field is present if the driver for the image format
180 #                    supports it
182 # @corruptions: number of corruptions found during the check if any
184 # @leaks: number of leaks found during the check if any
186 # @corruptions-fixed: number of corruptions fixed during the check
187 #                     if any
189 # @leaks-fixed: number of leaks fixed during the check if any
191 # @total-clusters: total number of clusters, this field is present
192 #                  if the driver for the image format supports it
194 # @allocated-clusters: total number of allocated clusters, this
195 #                      field is present if the driver for the image format
196 #                      supports it
198 # @fragmented-clusters: total number of fragmented clusters, this
199 #                       field is present if the driver for the image format
200 #                       supports it
202 # @compressed-clusters: total number of compressed clusters, this
203 #                       field is present if the driver for the image format
204 #                       supports it
206 # Since: 1.4
209 { 'struct': 'ImageCheck',
210   'data': {'filename': 'str', 'format': 'str', 'check-errors': 'int',
211            '*image-end-offset': 'int', '*corruptions': 'int', '*leaks': 'int',
212            '*corruptions-fixed': 'int', '*leaks-fixed': 'int',
213            '*total-clusters': 'int', '*allocated-clusters': 'int',
214            '*fragmented-clusters': 'int', '*compressed-clusters': 'int' } }
217 # @MapEntry:
219 # Mapping information from a virtual block range to a host file range
221 # @start: the start byte of the mapped virtual range
223 # @length: the number of bytes of the mapped virtual range
225 # @data: whether the mapped range has data
227 # @zero: whether the virtual blocks are zeroed
229 # @depth: the depth of the mapping
231 # @offset: the offset in file that the virtual sectors are mapped to
233 # @filename: filename that is referred to by @offset
235 # Since: 2.6
238 { 'struct': 'MapEntry',
239   'data': {'start': 'int', 'length': 'int', 'data': 'bool',
240            'zero': 'bool', 'depth': 'int', '*offset': 'int',
241            '*filename': 'str' } }
244 # @BlockdevCacheInfo:
246 # Cache mode information for a block device
248 # @writeback:   true if writeback mode is enabled
249 # @direct:      true if the host page cache is bypassed (O_DIRECT)
250 # @no-flush:    true if flush requests are ignored for the device
252 # Since: 2.3
254 { 'struct': 'BlockdevCacheInfo',
255   'data': { 'writeback': 'bool',
256             'direct': 'bool',
257             'no-flush': 'bool' } }
260 # @BlockDeviceInfo:
262 # Information about the backing device for a block device.
264 # @file: the filename of the backing device
266 # @node-name: the name of the block driver node (Since 2.0)
268 # @ro: true if the backing device was open read-only
270 # @drv: the name of the block format used to open the backing device. As of
271 #       0.14.0 this can be: 'blkdebug', 'bochs', 'cloop', 'cow', 'dmg',
272 #       'file', 'file', 'ftp', 'ftps', 'host_cdrom', 'host_device',
273 #       'http', 'https', 'luks', 'nbd', 'parallels', 'qcow',
274 #       'qcow2', 'raw', 'vdi', 'vmdk', 'vpc', 'vvfat'
275 #       2.2: 'archipelago' added, 'cow' dropped
276 #       2.3: 'host_floppy' deprecated
277 #       2.5: 'host_floppy' dropped
278 #       2.6: 'luks' added
279 #       2.8: 'replication' added, 'tftp' dropped
280 #       2.9: 'archipelago' dropped
282 # @backing_file: the name of the backing file (for copy-on-write)
284 # @backing_file_depth: number of files in the backing file chain (since: 1.2)
286 # @encrypted: true if the backing device is encrypted
288 # @encryption_key_missing: Deprecated; always false
290 # @detect_zeroes: detect and optimize zero writes (Since 2.1)
292 # @bps: total throughput limit in bytes per second is specified
294 # @bps_rd: read throughput limit in bytes per second is specified
296 # @bps_wr: write throughput limit in bytes per second is specified
298 # @iops: total I/O operations per second is specified
300 # @iops_rd: read I/O operations per second is specified
302 # @iops_wr: write I/O operations per second is specified
304 # @image: the info of image used (since: 1.6)
306 # @bps_max: total throughput limit during bursts,
307 #                     in bytes (Since 1.7)
309 # @bps_rd_max: read throughput limit during bursts,
310 #                        in bytes (Since 1.7)
312 # @bps_wr_max: write throughput limit during bursts,
313 #                        in bytes (Since 1.7)
315 # @iops_max: total I/O operations per second during bursts,
316 #                      in bytes (Since 1.7)
318 # @iops_rd_max: read I/O operations per second during bursts,
319 #                         in bytes (Since 1.7)
321 # @iops_wr_max: write I/O operations per second during bursts,
322 #                         in bytes (Since 1.7)
324 # @bps_max_length: maximum length of the @bps_max burst
325 #                            period, in seconds. (Since 2.6)
327 # @bps_rd_max_length: maximum length of the @bps_rd_max
328 #                               burst period, in seconds. (Since 2.6)
330 # @bps_wr_max_length: maximum length of the @bps_wr_max
331 #                               burst period, in seconds. (Since 2.6)
333 # @iops_max_length: maximum length of the @iops burst
334 #                             period, in seconds. (Since 2.6)
336 # @iops_rd_max_length: maximum length of the @iops_rd_max
337 #                                burst period, in seconds. (Since 2.6)
339 # @iops_wr_max_length: maximum length of the @iops_wr_max
340 #                                burst period, in seconds. (Since 2.6)
342 # @iops_size: an I/O size in bytes (Since 1.7)
344 # @group: throttle group name (Since 2.4)
346 # @cache: the cache mode used for the block device (since: 2.3)
348 # @write_threshold: configured write threshold for the device.
349 #                   0 if disabled. (Since 2.3)
351 # Since: 0.14.0
354 { 'struct': 'BlockDeviceInfo',
355   'data': { 'file': 'str', '*node-name': 'str', 'ro': 'bool', 'drv': 'str',
356             '*backing_file': 'str', 'backing_file_depth': 'int',
357             'encrypted': 'bool', 'encryption_key_missing': 'bool',
358             'detect_zeroes': 'BlockdevDetectZeroesOptions',
359             'bps': 'int', 'bps_rd': 'int', 'bps_wr': 'int',
360             'iops': 'int', 'iops_rd': 'int', 'iops_wr': 'int',
361             'image': 'ImageInfo',
362             '*bps_max': 'int', '*bps_rd_max': 'int',
363             '*bps_wr_max': 'int', '*iops_max': 'int',
364             '*iops_rd_max': 'int', '*iops_wr_max': 'int',
365             '*bps_max_length': 'int', '*bps_rd_max_length': 'int',
366             '*bps_wr_max_length': 'int', '*iops_max_length': 'int',
367             '*iops_rd_max_length': 'int', '*iops_wr_max_length': 'int',
368             '*iops_size': 'int', '*group': 'str', 'cache': 'BlockdevCacheInfo',
369             'write_threshold': 'int' } }
372 # @BlockDeviceIoStatus:
374 # An enumeration of block device I/O status.
376 # @ok: The last I/O operation has succeeded
378 # @failed: The last I/O operation has failed
380 # @nospace: The last I/O operation has failed due to a no-space condition
382 # Since: 1.0
384 { 'enum': 'BlockDeviceIoStatus', 'data': [ 'ok', 'failed', 'nospace' ] }
387 # @BlockDeviceMapEntry:
389 # Entry in the metadata map of the device (returned by "qemu-img map")
391 # @start: Offset in the image of the first byte described by this entry
392 #         (in bytes)
394 # @length: Length of the range described by this entry (in bytes)
396 # @depth: Number of layers (0 = top image, 1 = top image's backing file, etc.)
397 #         before reaching one for which the range is allocated.  The value is
398 #         in the range 0 to the depth of the image chain - 1.
400 # @zero: the sectors in this range read as zeros
402 # @data: reading the image will actually read data from a file (in particular,
403 #        if @offset is present this means that the sectors are not simply
404 #        preallocated, but contain actual data in raw format)
406 # @offset: if present, the image file stores the data for this range in
407 #          raw format at the given offset.
409 # Since: 1.7
411 { 'struct': 'BlockDeviceMapEntry',
412   'data': { 'start': 'int', 'length': 'int', 'depth': 'int', 'zero': 'bool',
413             'data': 'bool', '*offset': 'int' } }
416 # @DirtyBitmapStatus:
418 # An enumeration of possible states that a dirty bitmap can report to the user.
420 # @frozen: The bitmap is currently in-use by a backup operation or block job,
421 #          and is immutable.
423 # @disabled: The bitmap is currently in-use by an internal operation and is
424 #            read-only. It can still be deleted.
426 # @active: The bitmap is actively monitoring for new writes, and can be cleared,
427 #          deleted, or used for backup operations.
429 # @locked: The bitmap is currently in-use by some operation and can not be
430 #          cleared, deleted, or used for backup operations. (Since 2.12)
432 # Since: 2.4
434 { 'enum': 'DirtyBitmapStatus',
435   'data': ['active', 'disabled', 'frozen', 'locked'] }
438 # @BlockDirtyInfo:
440 # Block dirty bitmap information.
442 # @name: the name of the dirty bitmap (Since 2.4)
444 # @count: number of dirty bytes according to the dirty bitmap
446 # @granularity: granularity of the dirty bitmap in bytes (since 1.4)
448 # @status: current status of the dirty bitmap (since 2.4)
450 # Since: 1.3
452 { 'struct': 'BlockDirtyInfo',
453   'data': {'*name': 'str', 'count': 'int', 'granularity': 'uint32',
454            'status': 'DirtyBitmapStatus'} }
457 # @BlockLatencyHistogramInfo:
459 # Block latency histogram.
461 # @boundaries: list of interval boundary values in nanoseconds, all greater
462 #              than zero and in ascending order.
463 #              For example, the list [10, 50, 100] produces the following
464 #              histogram intervals: [0, 10), [10, 50), [50, 100), [100, +inf).
466 # @bins: list of io request counts corresponding to histogram intervals.
467 #        len(@bins) = len(@boundaries) + 1
468 #        For the example above, @bins may be something like [3, 1, 5, 2],
469 #        and corresponding histogram looks like:
471 #        5|           *
472 #        4|           *
473 #        3| *         *
474 #        2| *         *    *
475 #        1| *    *    *    *
476 #         +------------------
477 #             10   50   100
479 # Since: 2.12
481 { 'struct': 'BlockLatencyHistogramInfo',
482   'data': {'boundaries': ['uint64'], 'bins': ['uint64'] } }
485 # @x-block-latency-histogram-set:
487 # Manage read, write and flush latency histograms for the device.
489 # If only @device parameter is specified, remove all present latency histograms
490 # for the device. Otherwise, add/reset some of (or all) latency histograms.
492 # @device: device name to set latency histogram for.
494 # @boundaries: list of interval boundary values (see description in
495 #              BlockLatencyHistogramInfo definition). If specified, all
496 #              latency histograms are removed, and empty ones created for all
497 #              io types with intervals corresponding to @boundaries (except for
498 #              io types, for which specific boundaries are set through the
499 #              following parameters).
501 # @boundaries-read: list of interval boundary values for read latency
502 #                   histogram. If specified, old read latency histogram is
503 #                   removed, and empty one created with intervals
504 #                   corresponding to @boundaries-read. The parameter has higher
505 #                   priority then @boundaries.
507 # @boundaries-write: list of interval boundary values for write latency
508 #                    histogram.
510 # @boundaries-flush: list of interval boundary values for flush latency
511 #                    histogram.
513 # Returns: error if device is not found or any boundary arrays are invalid.
515 # Since: 2.12
517 # Example: set new histograms for all io types with intervals
518 # [0, 10), [10, 50), [50, 100), [100, +inf):
520 # -> { "execute": "block-latency-histogram-set",
521 #      "arguments": { "device": "drive0",
522 #                     "boundaries": [10, 50, 100] } }
523 # <- { "return": {} }
525 # Example: set new histogram only for write, other histograms will remain
526 # not changed (or not created):
528 # -> { "execute": "block-latency-histogram-set",
529 #      "arguments": { "device": "drive0",
530 #                     "boundaries-write": [10, 50, 100] } }
531 # <- { "return": {} }
533 # Example: set new histograms with the following intervals:
534 #   read, flush: [0, 10), [10, 50), [50, 100), [100, +inf)
535 #   write: [0, 1000), [1000, 5000), [5000, +inf)
537 # -> { "execute": "block-latency-histogram-set",
538 #      "arguments": { "device": "drive0",
539 #                     "boundaries": [10, 50, 100],
540 #                     "boundaries-write": [1000, 5000] } }
541 # <- { "return": {} }
543 # Example: remove all latency histograms:
545 # -> { "execute": "block-latency-histogram-set",
546 #      "arguments": { "device": "drive0" } }
547 # <- { "return": {} }
549 { 'command': 'x-block-latency-histogram-set',
550   'data': {'device': 'str',
551            '*boundaries': ['uint64'],
552            '*boundaries-read': ['uint64'],
553            '*boundaries-write': ['uint64'],
554            '*boundaries-flush': ['uint64'] } }
557 # @BlockInfo:
559 # Block device information.  This structure describes a virtual device and
560 # the backing device associated with it.
562 # @device: The device name associated with the virtual device.
564 # @qdev: The qdev ID, or if no ID is assigned, the QOM path of the block
565 #        device. (since 2.10)
567 # @type: This field is returned only for compatibility reasons, it should
568 #        not be used (always returns 'unknown')
570 # @removable: True if the device supports removable media.
572 # @locked: True if the guest has locked this device from having its media
573 #          removed
575 # @tray_open: True if the device's tray is open
576 #             (only present if it has a tray)
578 # @dirty-bitmaps: dirty bitmaps information (only present if the
579 #                 driver has one or more dirty bitmaps) (Since 2.0)
581 # @io-status: @BlockDeviceIoStatus. Only present if the device
582 #             supports it and the VM is configured to stop on errors
583 #             (supported device models: virtio-blk, IDE, SCSI except
584 #             scsi-generic)
586 # @inserted: @BlockDeviceInfo describing the device if media is
587 #            present
589 # Since:  0.14.0
591 { 'struct': 'BlockInfo',
592   'data': {'device': 'str', '*qdev': 'str', 'type': 'str', 'removable': 'bool',
593            'locked': 'bool', '*inserted': 'BlockDeviceInfo',
594            '*tray_open': 'bool', '*io-status': 'BlockDeviceIoStatus',
595            '*dirty-bitmaps': ['BlockDirtyInfo'] } }
598 # @BlockMeasureInfo:
600 # Image file size calculation information.  This structure describes the size
601 # requirements for creating a new image file.
603 # The size requirements depend on the new image file format.  File size always
604 # equals virtual disk size for the 'raw' format, even for sparse POSIX files.
605 # Compact formats such as 'qcow2' represent unallocated and zero regions
606 # efficiently so file size may be smaller than virtual disk size.
608 # The values are upper bounds that are guaranteed to fit the new image file.
609 # Subsequent modification, such as internal snapshot or bitmap creation, may
610 # require additional space and is not covered here.
612 # @required: Size required for a new image file, in bytes.
614 # @fully-allocated: Image file size, in bytes, once data has been written
615 #                   to all sectors.
617 # Since: 2.10
619 { 'struct': 'BlockMeasureInfo',
620   'data': {'required': 'int', 'fully-allocated': 'int'} }
623 # @query-block:
625 # Get a list of BlockInfo for all virtual block devices.
627 # Returns: a list of @BlockInfo describing each virtual block device. Filter
628 # nodes that were created implicitly are skipped over.
630 # Since: 0.14.0
632 # Example:
634 # -> { "execute": "query-block" }
635 # <- {
636 #       "return":[
637 #          {
638 #             "io-status": "ok",
639 #             "device":"ide0-hd0",
640 #             "locked":false,
641 #             "removable":false,
642 #             "inserted":{
643 #                "ro":false,
644 #                "drv":"qcow2",
645 #                "encrypted":false,
646 #                "file":"disks/test.qcow2",
647 #                "backing_file_depth":1,
648 #                "bps":1000000,
649 #                "bps_rd":0,
650 #                "bps_wr":0,
651 #                "iops":1000000,
652 #                "iops_rd":0,
653 #                "iops_wr":0,
654 #                "bps_max": 8000000,
655 #                "bps_rd_max": 0,
656 #                "bps_wr_max": 0,
657 #                "iops_max": 0,
658 #                "iops_rd_max": 0,
659 #                "iops_wr_max": 0,
660 #                "iops_size": 0,
661 #                "detect_zeroes": "on",
662 #                "write_threshold": 0,
663 #                "image":{
664 #                   "filename":"disks/test.qcow2",
665 #                   "format":"qcow2",
666 #                   "virtual-size":2048000,
667 #                   "backing_file":"base.qcow2",
668 #                   "full-backing-filename":"disks/base.qcow2",
669 #                   "backing-filename-format":"qcow2",
670 #                   "snapshots":[
671 #                      {
672 #                         "id": "1",
673 #                         "name": "snapshot1",
674 #                         "vm-state-size": 0,
675 #                         "date-sec": 10000200,
676 #                         "date-nsec": 12,
677 #                         "vm-clock-sec": 206,
678 #                         "vm-clock-nsec": 30
679 #                      }
680 #                   ],
681 #                   "backing-image":{
682 #                       "filename":"disks/base.qcow2",
683 #                       "format":"qcow2",
684 #                       "virtual-size":2048000
685 #                   }
686 #                }
687 #             },
688 #             "qdev": "ide_disk",
689 #             "type":"unknown"
690 #          },
691 #          {
692 #             "io-status": "ok",
693 #             "device":"ide1-cd0",
694 #             "locked":false,
695 #             "removable":true,
696 #             "qdev": "/machine/unattached/device[23]",
697 #             "tray_open": false,
698 #             "type":"unknown"
699 #          },
700 #          {
701 #             "device":"floppy0",
702 #             "locked":false,
703 #             "removable":true,
704 #             "qdev": "/machine/unattached/device[20]",
705 #             "type":"unknown"
706 #          },
707 #          {
708 #             "device":"sd0",
709 #             "locked":false,
710 #             "removable":true,
711 #             "type":"unknown"
712 #          }
713 #       ]
714 #    }
717 { 'command': 'query-block', 'returns': ['BlockInfo'] }
721 # @BlockDeviceTimedStats:
723 # Statistics of a block device during a given interval of time.
725 # @interval_length: Interval used for calculating the statistics,
726 #                   in seconds.
728 # @min_rd_latency_ns: Minimum latency of read operations in the
729 #                     defined interval, in nanoseconds.
731 # @min_wr_latency_ns: Minimum latency of write operations in the
732 #                     defined interval, in nanoseconds.
734 # @min_flush_latency_ns: Minimum latency of flush operations in the
735 #                        defined interval, in nanoseconds.
737 # @max_rd_latency_ns: Maximum latency of read operations in the
738 #                     defined interval, in nanoseconds.
740 # @max_wr_latency_ns: Maximum latency of write operations in the
741 #                     defined interval, in nanoseconds.
743 # @max_flush_latency_ns: Maximum latency of flush operations in the
744 #                        defined interval, in nanoseconds.
746 # @avg_rd_latency_ns: Average latency of read operations in the
747 #                     defined interval, in nanoseconds.
749 # @avg_wr_latency_ns: Average latency of write operations in the
750 #                     defined interval, in nanoseconds.
752 # @avg_flush_latency_ns: Average latency of flush operations in the
753 #                        defined interval, in nanoseconds.
755 # @avg_rd_queue_depth: Average number of pending read operations
756 #                      in the defined interval.
758 # @avg_wr_queue_depth: Average number of pending write operations
759 #                      in the defined interval.
761 # Since: 2.5
763 { 'struct': 'BlockDeviceTimedStats',
764   'data': { 'interval_length': 'int', 'min_rd_latency_ns': 'int',
765             'max_rd_latency_ns': 'int', 'avg_rd_latency_ns': 'int',
766             'min_wr_latency_ns': 'int', 'max_wr_latency_ns': 'int',
767             'avg_wr_latency_ns': 'int', 'min_flush_latency_ns': 'int',
768             'max_flush_latency_ns': 'int', 'avg_flush_latency_ns': 'int',
769             'avg_rd_queue_depth': 'number', 'avg_wr_queue_depth': 'number' } }
772 # @BlockDeviceStats:
774 # Statistics of a virtual block device or a block backing device.
776 # @rd_bytes:      The number of bytes read by the device.
778 # @wr_bytes:      The number of bytes written by the device.
780 # @rd_operations: The number of read operations performed by the device.
782 # @wr_operations: The number of write operations performed by the device.
784 # @flush_operations: The number of cache flush operations performed by the
785 #                    device (since 0.15.0)
787 # @flush_total_time_ns: Total time spend on cache flushes in nano-seconds
788 #                       (since 0.15.0).
790 # @wr_total_time_ns: Total time spend on writes in nano-seconds (since 0.15.0).
792 # @rd_total_time_ns: Total_time_spend on reads in nano-seconds (since 0.15.0).
794 # @wr_highest_offset: The offset after the greatest byte written to the
795 #                     device.  The intended use of this information is for
796 #                     growable sparse files (like qcow2) that are used on top
797 #                     of a physical device.
799 # @rd_merged: Number of read requests that have been merged into another
800 #             request (Since 2.3).
802 # @wr_merged: Number of write requests that have been merged into another
803 #             request (Since 2.3).
805 # @idle_time_ns: Time since the last I/O operation, in
806 #                nanoseconds. If the field is absent it means that
807 #                there haven't been any operations yet (Since 2.5).
809 # @failed_rd_operations: The number of failed read operations
810 #                        performed by the device (Since 2.5)
812 # @failed_wr_operations: The number of failed write operations
813 #                        performed by the device (Since 2.5)
815 # @failed_flush_operations: The number of failed flush operations
816 #                           performed by the device (Since 2.5)
818 # @invalid_rd_operations: The number of invalid read operations
819 #                          performed by the device (Since 2.5)
821 # @invalid_wr_operations: The number of invalid write operations
822 #                         performed by the device (Since 2.5)
824 # @invalid_flush_operations: The number of invalid flush operations
825 #                            performed by the device (Since 2.5)
827 # @account_invalid: Whether invalid operations are included in the
828 #                   last access statistics (Since 2.5)
830 # @account_failed: Whether failed operations are included in the
831 #                  latency and last access statistics (Since 2.5)
833 # @timed_stats: Statistics specific to the set of previously defined
834 #               intervals of time (Since 2.5)
836 # @x_rd_latency_histogram: @BlockLatencyHistogramInfo. (Since 2.12)
838 # @x_wr_latency_histogram: @BlockLatencyHistogramInfo. (Since 2.12)
840 # @x_flush_latency_histogram: @BlockLatencyHistogramInfo. (Since 2.12)
842 # Since: 0.14.0
844 { 'struct': 'BlockDeviceStats',
845   'data': {'rd_bytes': 'int', 'wr_bytes': 'int', 'rd_operations': 'int',
846            'wr_operations': 'int', 'flush_operations': 'int',
847            'flush_total_time_ns': 'int', 'wr_total_time_ns': 'int',
848            'rd_total_time_ns': 'int', 'wr_highest_offset': 'int',
849            'rd_merged': 'int', 'wr_merged': 'int', '*idle_time_ns': 'int',
850            'failed_rd_operations': 'int', 'failed_wr_operations': 'int',
851            'failed_flush_operations': 'int', 'invalid_rd_operations': 'int',
852            'invalid_wr_operations': 'int', 'invalid_flush_operations': 'int',
853            'account_invalid': 'bool', 'account_failed': 'bool',
854            'timed_stats': ['BlockDeviceTimedStats'],
855            '*x_rd_latency_histogram': 'BlockLatencyHistogramInfo',
856            '*x_wr_latency_histogram': 'BlockLatencyHistogramInfo',
857            '*x_flush_latency_histogram': 'BlockLatencyHistogramInfo' } }
860 # @BlockStats:
862 # Statistics of a virtual block device or a block backing device.
864 # @device: If the stats are for a virtual block device, the name
865 #          corresponding to the virtual block device.
867 # @node-name: The node name of the device. (Since 2.3)
869 # @stats:  A @BlockDeviceStats for the device.
871 # @parent: This describes the file block device if it has one.
872 #          Contains recursively the statistics of the underlying
873 #          protocol (e.g. the host file for a qcow2 image). If there is
874 #          no underlying protocol, this field is omitted
876 # @backing: This describes the backing block device if it has one.
877 #           (Since 2.0)
879 # Since: 0.14.0
881 { 'struct': 'BlockStats',
882   'data': {'*device': 'str', '*node-name': 'str',
883            'stats': 'BlockDeviceStats',
884            '*parent': 'BlockStats',
885            '*backing': 'BlockStats'} }
888 # @query-blockstats:
890 # Query the @BlockStats for all virtual block devices.
892 # @query-nodes: If true, the command will query all the block nodes
893 #               that have a node name, in a list which will include "parent"
894 #               information, but not "backing".
895 #               If false or omitted, the behavior is as before - query all the
896 #               device backends, recursively including their "parent" and
897 #               "backing". Filter nodes that were created implicitly are
898 #               skipped over in this mode. (Since 2.3)
900 # Returns: A list of @BlockStats for each virtual block devices.
902 # Since: 0.14.0
904 # Example:
906 # -> { "execute": "query-blockstats" }
907 # <- {
908 #       "return":[
909 #          {
910 #             "device":"ide0-hd0",
911 #             "parent":{
912 #                "stats":{
913 #                   "wr_highest_offset":3686448128,
914 #                   "wr_bytes":9786368,
915 #                   "wr_operations":751,
916 #                   "rd_bytes":122567168,
917 #                   "rd_operations":36772
918 #                   "wr_total_times_ns":313253456
919 #                   "rd_total_times_ns":3465673657
920 #                   "flush_total_times_ns":49653
921 #                   "flush_operations":61,
922 #                   "rd_merged":0,
923 #                   "wr_merged":0,
924 #                   "idle_time_ns":2953431879,
925 #                   "account_invalid":true,
926 #                   "account_failed":false
927 #                }
928 #             },
929 #             "stats":{
930 #                "wr_highest_offset":2821110784,
931 #                "wr_bytes":9786368,
932 #                "wr_operations":692,
933 #                "rd_bytes":122739200,
934 #                "rd_operations":36604
935 #                "flush_operations":51,
936 #                "wr_total_times_ns":313253456
937 #                "rd_total_times_ns":3465673657
938 #                "flush_total_times_ns":49653,
939 #                "rd_merged":0,
940 #                "wr_merged":0,
941 #                "idle_time_ns":2953431879,
942 #                "account_invalid":true,
943 #                "account_failed":false
944 #             }
945 #          },
946 #          {
947 #             "device":"ide1-cd0",
948 #             "stats":{
949 #                "wr_highest_offset":0,
950 #                "wr_bytes":0,
951 #                "wr_operations":0,
952 #                "rd_bytes":0,
953 #                "rd_operations":0
954 #                "flush_operations":0,
955 #                "wr_total_times_ns":0
956 #                "rd_total_times_ns":0
957 #                "flush_total_times_ns":0,
958 #                "rd_merged":0,
959 #                "wr_merged":0,
960 #                "account_invalid":false,
961 #                "account_failed":false
962 #             }
963 #          },
964 #          {
965 #             "device":"floppy0",
966 #             "stats":{
967 #                "wr_highest_offset":0,
968 #                "wr_bytes":0,
969 #                "wr_operations":0,
970 #                "rd_bytes":0,
971 #                "rd_operations":0
972 #                "flush_operations":0,
973 #                "wr_total_times_ns":0
974 #                "rd_total_times_ns":0
975 #                "flush_total_times_ns":0,
976 #                "rd_merged":0,
977 #                "wr_merged":0,
978 #                "account_invalid":false,
979 #                "account_failed":false
980 #             }
981 #          },
982 #          {
983 #             "device":"sd0",
984 #             "stats":{
985 #                "wr_highest_offset":0,
986 #                "wr_bytes":0,
987 #                "wr_operations":0,
988 #                "rd_bytes":0,
989 #                "rd_operations":0
990 #                "flush_operations":0,
991 #                "wr_total_times_ns":0
992 #                "rd_total_times_ns":0
993 #                "flush_total_times_ns":0,
994 #                "rd_merged":0,
995 #                "wr_merged":0,
996 #                "account_invalid":false,
997 #                "account_failed":false
998 #             }
999 #          }
1000 #       ]
1001 #    }
1004 { 'command': 'query-blockstats',
1005   'data': { '*query-nodes': 'bool' },
1006   'returns': ['BlockStats'] }
1009 # @BlockdevOnError:
1011 # An enumeration of possible behaviors for errors on I/O operations.
1012 # The exact meaning depends on whether the I/O was initiated by a guest
1013 # or by a block job
1015 # @report: for guest operations, report the error to the guest;
1016 #          for jobs, cancel the job
1018 # @ignore: ignore the error, only report a QMP event (BLOCK_IO_ERROR
1019 #          or BLOCK_JOB_ERROR)
1021 # @enospc: same as @stop on ENOSPC, same as @report otherwise.
1023 # @stop: for guest operations, stop the virtual machine;
1024 #        for jobs, pause the job
1026 # @auto: inherit the error handling policy of the backend (since: 2.7)
1028 # Since: 1.3
1030 { 'enum': 'BlockdevOnError',
1031   'data': ['report', 'ignore', 'enospc', 'stop', 'auto'] }
1034 # @MirrorSyncMode:
1036 # An enumeration of possible behaviors for the initial synchronization
1037 # phase of storage mirroring.
1039 # @top: copies data in the topmost image to the destination
1041 # @full: copies data from all images to the destination
1043 # @none: only copy data written from now on
1045 # @incremental: only copy data described by the dirty bitmap. Since: 2.4
1047 # Since: 1.3
1049 { 'enum': 'MirrorSyncMode',
1050   'data': ['top', 'full', 'none', 'incremental'] }
1053 # @MirrorCopyMode:
1055 # An enumeration whose values tell the mirror block job when to
1056 # trigger writes to the target.
1058 # @background: copy data in background only.
1060 # @write-blocking: when data is written to the source, write it
1061 #                  (synchronously) to the target as well.  In
1062 #                  addition, data is copied in background just like in
1063 #                  @background mode.
1065 # Since: 3.0
1067 { 'enum': 'MirrorCopyMode',
1068   'data': ['background', 'write-blocking'] }
1071 # @BlockJobInfo:
1073 # Information about a long-running block device operation.
1075 # @type: the job type ('stream' for image streaming)
1077 # @device: The job identifier. Originally the device name but other
1078 #          values are allowed since QEMU 2.7
1080 # @len: Estimated @offset value at the completion of the job. This value can
1081 #       arbitrarily change while the job is running, in both directions.
1083 # @offset: Progress made until now. The unit is arbitrary and the value can
1084 #          only meaningfully be used for the ratio of @offset to @len. The
1085 #          value is monotonically increasing.
1087 # @busy: false if the job is known to be in a quiescent state, with
1088 #        no pending I/O.  Since 1.3.
1090 # @paused: whether the job is paused or, if @busy is true, will
1091 #          pause itself as soon as possible.  Since 1.3.
1093 # @speed: the rate limit, bytes per second
1095 # @io-status: the status of the job (since 1.3)
1097 # @ready: true if the job may be completed (since 2.2)
1099 # @status: Current job state/status (since 2.12)
1101 # @auto-finalize: Job will finalize itself when PENDING, moving to
1102 #                 the CONCLUDED state. (since 2.12)
1104 # @auto-dismiss: Job will dismiss itself when CONCLUDED, moving to the NULL
1105 #                state and disappearing from the query list. (since 2.12)
1107 # @error: Error information if the job did not complete successfully.
1108 #         Not set if the job completed successfully. (since 2.12.1)
1110 # Since: 1.1
1112 { 'struct': 'BlockJobInfo',
1113   'data': {'type': 'str', 'device': 'str', 'len': 'int',
1114            'offset': 'int', 'busy': 'bool', 'paused': 'bool', 'speed': 'int',
1115            'io-status': 'BlockDeviceIoStatus', 'ready': 'bool',
1116            'status': 'JobStatus',
1117            'auto-finalize': 'bool', 'auto-dismiss': 'bool',
1118            '*error': 'str' } }
1121 # @query-block-jobs:
1123 # Return information about long-running block device operations.
1125 # Returns: a list of @BlockJobInfo for each active block job
1127 # Since: 1.1
1129 { 'command': 'query-block-jobs', 'returns': ['BlockJobInfo'] }
1132 # @block_passwd:
1134 # This command sets the password of a block device that has not been open
1135 # with a password and requires one.
1137 # This command is now obsolete and will always return an error since 2.10
1140 { 'command': 'block_passwd', 'data': {'*device': 'str',
1141                                       '*node-name': 'str', 'password': 'str'} }
1144 # @block_resize:
1146 # Resize a block image while a guest is running.
1148 # Either @device or @node-name must be set but not both.
1150 # @device: the name of the device to get the image resized
1152 # @node-name: graph node name to get the image resized (Since 2.0)
1154 # @size:  new image size in bytes
1156 # Returns: nothing on success
1157 #          If @device is not a valid block device, DeviceNotFound
1159 # Since: 0.14.0
1161 # Example:
1163 # -> { "execute": "block_resize",
1164 #      "arguments": { "device": "scratch", "size": 1073741824 } }
1165 # <- { "return": {} }
1168 { 'command': 'block_resize', 'data': { '*device': 'str',
1169                                        '*node-name': 'str',
1170                                        'size': 'int' }}
1173 # @NewImageMode:
1175 # An enumeration that tells QEMU how to set the backing file path in
1176 # a new image file.
1178 # @existing: QEMU should look for an existing image file.
1180 # @absolute-paths: QEMU should create a new image with absolute paths
1181 # for the backing file. If there is no backing file available, the new
1182 # image will not be backed either.
1184 # Since: 1.1
1186 { 'enum': 'NewImageMode',
1187   'data': [ 'existing', 'absolute-paths' ] }
1190 # @BlockdevSnapshotSync:
1192 # Either @device or @node-name must be set but not both.
1194 # @device: the name of the device to generate the snapshot from.
1196 # @node-name: graph node name to generate the snapshot from (Since 2.0)
1198 # @snapshot-file: the target of the new image. If the file exists, or
1199 # if it is a device, the snapshot will be created in the existing
1200 # file/device. Otherwise, a new file will be created.
1202 # @snapshot-node-name: the graph node name of the new image (Since 2.0)
1204 # @format: the format of the snapshot image, default is 'qcow2'.
1206 # @mode: whether and how QEMU should create a new image, default is
1207 #        'absolute-paths'.
1209 { 'struct': 'BlockdevSnapshotSync',
1210   'data': { '*device': 'str', '*node-name': 'str',
1211             'snapshot-file': 'str', '*snapshot-node-name': 'str',
1212             '*format': 'str', '*mode': 'NewImageMode' } }
1215 # @BlockdevSnapshot:
1217 # @node: device or node name that will have a snapshot created.
1219 # @overlay: reference to the existing block device that will become
1220 #           the overlay of @node, as part of creating the snapshot.
1221 #           It must not have a current backing file (this can be
1222 #           achieved by passing "backing": null to blockdev-add).
1224 # Since: 2.5
1226 { 'struct': 'BlockdevSnapshot',
1227   'data': { 'node': 'str', 'overlay': 'str' } }
1230 # @DriveBackup:
1232 # @job-id: identifier for the newly-created block job. If
1233 #          omitted, the device name will be used. (Since 2.7)
1235 # @device: the device name or node-name of a root node which should be copied.
1237 # @target: the target of the new image. If the file exists, or if it
1238 #          is a device, the existing file/device will be used as the new
1239 #          destination.  If it does not exist, a new file will be created.
1241 # @format: the format of the new destination, default is to
1242 #          probe if @mode is 'existing', else the format of the source
1244 # @sync: what parts of the disk image should be copied to the destination
1245 #        (all the disk, only the sectors allocated in the topmost image, from a
1246 #        dirty bitmap, or only new I/O).
1248 # @mode: whether and how QEMU should create a new image, default is
1249 #        'absolute-paths'.
1251 # @speed: the maximum speed, in bytes per second
1253 # @bitmap: the name of dirty bitmap if sync is "incremental".
1254 #          Must be present if sync is "incremental", must NOT be present
1255 #          otherwise. (Since 2.4)
1257 # @compress: true to compress data, if the target format supports it.
1258 #            (default: false) (since 2.8)
1260 # @on-source-error: the action to take on an error on the source,
1261 #                   default 'report'.  'stop' and 'enospc' can only be used
1262 #                   if the block device supports io-status (see BlockInfo).
1264 # @on-target-error: the action to take on an error on the target,
1265 #                   default 'report' (no limitations, since this applies to
1266 #                   a different block device than @device).
1268 # @auto-finalize: When false, this job will wait in a PENDING state after it has
1269 #                 finished its work, waiting for @block-job-finalize.
1270 #                 When true, this job will automatically perform its abort or
1271 #                 commit actions.
1272 #                 Defaults to true. (Since 2.12)
1274 # @auto-dismiss: When false, this job will wait in a CONCLUDED state after it
1275 #                has completed ceased all work, and wait for @block-job-dismiss.
1276 #                When true, this job will automatically disappear from the query
1277 #                list without user intervention.
1278 #                Defaults to true. (Since 2.12)
1280 # Note: @on-source-error and @on-target-error only affect background
1281 # I/O.  If an error occurs during a guest write request, the device's
1282 # rerror/werror actions will be used.
1284 # Since: 1.6
1286 { 'struct': 'DriveBackup',
1287   'data': { '*job-id': 'str', 'device': 'str', 'target': 'str',
1288             '*format': 'str', 'sync': 'MirrorSyncMode',
1289             '*mode': 'NewImageMode', '*speed': 'int',
1290             '*bitmap': 'str', '*compress': 'bool',
1291             '*on-source-error': 'BlockdevOnError',
1292             '*on-target-error': 'BlockdevOnError',
1293             '*auto-finalize': 'bool', '*auto-dismiss': 'bool' } }
1296 # @BlockdevBackup:
1298 # @job-id: identifier for the newly-created block job. If
1299 #          omitted, the device name will be used. (Since 2.7)
1301 # @device: the device name or node-name of a root node which should be copied.
1303 # @target: the device name or node-name of the backup target node.
1305 # @sync: what parts of the disk image should be copied to the destination
1306 #        (all the disk, only the sectors allocated in the topmost image, or
1307 #        only new I/O).
1309 # @speed: the maximum speed, in bytes per second. The default is 0,
1310 #         for unlimited.
1312 # @compress: true to compress data, if the target format supports it.
1313 #            (default: false) (since 2.8)
1315 # @on-source-error: the action to take on an error on the source,
1316 #                   default 'report'.  'stop' and 'enospc' can only be used
1317 #                   if the block device supports io-status (see BlockInfo).
1319 # @on-target-error: the action to take on an error on the target,
1320 #                   default 'report' (no limitations, since this applies to
1321 #                   a different block device than @device).
1323 # @auto-finalize: When false, this job will wait in a PENDING state after it has
1324 #                 finished its work, waiting for @block-job-finalize.
1325 #                 When true, this job will automatically perform its abort or
1326 #                 commit actions.
1327 #                 Defaults to true. (Since 2.12)
1329 # @auto-dismiss: When false, this job will wait in a CONCLUDED state after it
1330 #                has completed ceased all work, and wait for @block-job-dismiss.
1331 #                When true, this job will automatically disappear from the query
1332 #                list without user intervention.
1333 #                Defaults to true. (Since 2.12)
1335 # Note: @on-source-error and @on-target-error only affect background
1336 # I/O.  If an error occurs during a guest write request, the device's
1337 # rerror/werror actions will be used.
1339 # Since: 2.3
1341 { 'struct': 'BlockdevBackup',
1342   'data': { '*job-id': 'str', 'device': 'str', 'target': 'str',
1343             'sync': 'MirrorSyncMode', '*speed': 'int', '*compress': 'bool',
1344             '*on-source-error': 'BlockdevOnError',
1345             '*on-target-error': 'BlockdevOnError',
1346             '*auto-finalize': 'bool', '*auto-dismiss': 'bool' } }
1349 # @blockdev-snapshot-sync:
1351 # Generates a synchronous snapshot of a block device.
1353 # For the arguments, see the documentation of BlockdevSnapshotSync.
1355 # Returns: nothing on success
1356 #          If @device is not a valid block device, DeviceNotFound
1358 # Since: 0.14.0
1360 # Example:
1362 # -> { "execute": "blockdev-snapshot-sync",
1363 #      "arguments": { "device": "ide-hd0",
1364 #                     "snapshot-file":
1365 #                     "/some/place/my-image",
1366 #                     "format": "qcow2" } }
1367 # <- { "return": {} }
1370 { 'command': 'blockdev-snapshot-sync',
1371   'data': 'BlockdevSnapshotSync' }
1375 # @blockdev-snapshot:
1377 # Generates a snapshot of a block device.
1379 # Create a snapshot, by installing 'node' as the backing image of
1380 # 'overlay'. Additionally, if 'node' is associated with a block
1381 # device, the block device changes to using 'overlay' as its new active
1382 # image.
1384 # For the arguments, see the documentation of BlockdevSnapshot.
1386 # Since: 2.5
1388 # Example:
1390 # -> { "execute": "blockdev-add",
1391 #      "arguments": { "driver": "qcow2",
1392 #                     "node-name": "node1534",
1393 #                     "file": { "driver": "file",
1394 #                               "filename": "hd1.qcow2" },
1395 #                     "backing": null } }
1397 # <- { "return": {} }
1399 # -> { "execute": "blockdev-snapshot",
1400 #      "arguments": { "node": "ide-hd0",
1401 #                     "overlay": "node1534" } }
1402 # <- { "return": {} }
1405 { 'command': 'blockdev-snapshot',
1406   'data': 'BlockdevSnapshot' }
1409 # @change-backing-file:
1411 # Change the backing file in the image file metadata.  This does not
1412 # cause QEMU to reopen the image file to reparse the backing filename
1413 # (it may, however, perform a reopen to change permissions from
1414 # r/o -> r/w -> r/o, if needed). The new backing file string is written
1415 # into the image file metadata, and the QEMU internal strings are
1416 # updated.
1418 # @image-node-name: The name of the block driver state node of the
1419 #                   image to modify. The "device" argument is used
1420 #                   to verify "image-node-name" is in the chain
1421 #                   described by "device".
1423 # @device:          The device name or node-name of the root node that owns
1424 #                   image-node-name.
1426 # @backing-file:    The string to write as the backing file.  This
1427 #                   string is not validated, so care should be taken
1428 #                   when specifying the string or the image chain may
1429 #                   not be able to be reopened again.
1431 # Returns: Nothing on success
1433 #          If "device" does not exist or cannot be determined, DeviceNotFound
1435 # Since: 2.1
1437 { 'command': 'change-backing-file',
1438   'data': { 'device': 'str', 'image-node-name': 'str',
1439             'backing-file': 'str' } }
1442 # @block-commit:
1444 # Live commit of data from overlay image nodes into backing nodes - i.e.,
1445 # writes data between 'top' and 'base' into 'base'.
1447 # @job-id: identifier for the newly-created block job. If
1448 #          omitted, the device name will be used. (Since 2.7)
1450 # @device:  the device name or node-name of a root node
1452 # @base:   The file name of the backing image to write data into.
1453 #                    If not specified, this is the deepest backing image.
1455 # @top:    The file name of the backing image within the image chain,
1456 #                    which contains the topmost data to be committed down. If
1457 #                    not specified, this is the active layer.
1459 # @backing-file:  The backing file string to write into the overlay
1460 #                           image of 'top'.  If 'top' is the active layer,
1461 #                           specifying a backing file string is an error. This
1462 #                           filename is not validated.
1464 #                           If a pathname string is such that it cannot be
1465 #                           resolved by QEMU, that means that subsequent QMP or
1466 #                           HMP commands must use node-names for the image in
1467 #                           question, as filename lookup methods will fail.
1469 #                           If not specified, QEMU will automatically determine
1470 #                           the backing file string to use, or error out if
1471 #                           there is no obvious choice. Care should be taken
1472 #                           when specifying the string, to specify a valid
1473 #                           filename or protocol.
1474 #                           (Since 2.1)
1476 #                    If top == base, that is an error.
1477 #                    If top == active, the job will not be completed by itself,
1478 #                    user needs to complete the job with the block-job-complete
1479 #                    command after getting the ready event. (Since 2.0)
1481 #                    If the base image is smaller than top, then the base image
1482 #                    will be resized to be the same size as top.  If top is
1483 #                    smaller than the base image, the base will not be
1484 #                    truncated.  If you want the base image size to match the
1485 #                    size of the smaller top, you can safely truncate it
1486 #                    yourself once the commit operation successfully completes.
1488 # @speed:  the maximum speed, in bytes per second
1490 # @filter-node-name: the node name that should be assigned to the
1491 #                    filter driver that the commit job inserts into the graph
1492 #                    above @top. If this option is not given, a node name is
1493 #                    autogenerated. (Since: 2.9)
1495 # Returns: Nothing on success
1496 #          If commit or stream is already active on this device, DeviceInUse
1497 #          If @device does not exist, DeviceNotFound
1498 #          If image commit is not supported by this device, NotSupported
1499 #          If @base or @top is invalid, a generic error is returned
1500 #          If @speed is invalid, InvalidParameter
1502 # Since: 1.3
1504 # Example:
1506 # -> { "execute": "block-commit",
1507 #      "arguments": { "device": "virtio0",
1508 #                     "top": "/tmp/snap1.qcow2" } }
1509 # <- { "return": {} }
1512 { 'command': 'block-commit',
1513   'data': { '*job-id': 'str', 'device': 'str', '*base': 'str', '*top': 'str',
1514             '*backing-file': 'str', '*speed': 'int',
1515             '*filter-node-name': 'str' } }
1518 # @drive-backup:
1520 # Start a point-in-time copy of a block device to a new destination.  The
1521 # status of ongoing drive-backup operations can be checked with
1522 # query-block-jobs where the BlockJobInfo.type field has the value 'backup'.
1523 # The operation can be stopped before it has completed using the
1524 # block-job-cancel command.
1526 # Returns: nothing on success
1527 #          If @device is not a valid block device, GenericError
1529 # Since: 1.6
1531 # Example:
1533 # -> { "execute": "drive-backup",
1534 #      "arguments": { "device": "drive0",
1535 #                     "sync": "full",
1536 #                     "target": "backup.img" } }
1537 # <- { "return": {} }
1540 { 'command': 'drive-backup', 'boxed': true,
1541   'data': 'DriveBackup' }
1544 # @blockdev-backup:
1546 # Start a point-in-time copy of a block device to a new destination.  The
1547 # status of ongoing blockdev-backup operations can be checked with
1548 # query-block-jobs where the BlockJobInfo.type field has the value 'backup'.
1549 # The operation can be stopped before it has completed using the
1550 # block-job-cancel command.
1552 # Returns: nothing on success
1553 #          If @device is not a valid block device, DeviceNotFound
1555 # Since: 2.3
1557 # Example:
1558 # -> { "execute": "blockdev-backup",
1559 #      "arguments": { "device": "src-id",
1560 #                     "sync": "full",
1561 #                     "target": "tgt-id" } }
1562 # <- { "return": {} }
1565 { 'command': 'blockdev-backup', 'boxed': true,
1566   'data': 'BlockdevBackup' }
1570 # @query-named-block-nodes:
1572 # Get the named block driver list
1574 # Returns: the list of BlockDeviceInfo
1576 # Since: 2.0
1578 # Example:
1580 # -> { "execute": "query-named-block-nodes" }
1581 # <- { "return": [ { "ro":false,
1582 #                    "drv":"qcow2",
1583 #                    "encrypted":false,
1584 #                    "file":"disks/test.qcow2",
1585 #                    "node-name": "my-node",
1586 #                    "backing_file_depth":1,
1587 #                    "bps":1000000,
1588 #                    "bps_rd":0,
1589 #                    "bps_wr":0,
1590 #                    "iops":1000000,
1591 #                    "iops_rd":0,
1592 #                    "iops_wr":0,
1593 #                    "bps_max": 8000000,
1594 #                    "bps_rd_max": 0,
1595 #                    "bps_wr_max": 0,
1596 #                    "iops_max": 0,
1597 #                    "iops_rd_max": 0,
1598 #                    "iops_wr_max": 0,
1599 #                    "iops_size": 0,
1600 #                    "write_threshold": 0,
1601 #                    "image":{
1602 #                       "filename":"disks/test.qcow2",
1603 #                       "format":"qcow2",
1604 #                       "virtual-size":2048000,
1605 #                       "backing_file":"base.qcow2",
1606 #                       "full-backing-filename":"disks/base.qcow2",
1607 #                       "backing-filename-format":"qcow2",
1608 #                       "snapshots":[
1609 #                          {
1610 #                             "id": "1",
1611 #                             "name": "snapshot1",
1612 #                             "vm-state-size": 0,
1613 #                             "date-sec": 10000200,
1614 #                             "date-nsec": 12,
1615 #                             "vm-clock-sec": 206,
1616 #                             "vm-clock-nsec": 30
1617 #                          }
1618 #                       ],
1619 #                       "backing-image":{
1620 #                           "filename":"disks/base.qcow2",
1621 #                           "format":"qcow2",
1622 #                           "virtual-size":2048000
1623 #                       }
1624 #                    } } ] }
1627 { 'command': 'query-named-block-nodes', 'returns': [ 'BlockDeviceInfo' ] }
1630 # @drive-mirror:
1632 # Start mirroring a block device's writes to a new destination. target
1633 # specifies the target of the new image. If the file exists, or if it
1634 # is a device, it will be used as the new destination for writes. If
1635 # it does not exist, a new file will be created. format specifies the
1636 # format of the mirror image, default is to probe if mode='existing',
1637 # else the format of the source.
1639 # Returns: nothing on success
1640 #          If @device is not a valid block device, GenericError
1642 # Since: 1.3
1644 # Example:
1646 # -> { "execute": "drive-mirror",
1647 #      "arguments": { "device": "ide-hd0",
1648 #                     "target": "/some/place/my-image",
1649 #                     "sync": "full",
1650 #                     "format": "qcow2" } }
1651 # <- { "return": {} }
1654 { 'command': 'drive-mirror', 'boxed': true,
1655   'data': 'DriveMirror' }
1658 # @DriveMirror:
1660 # A set of parameters describing drive mirror setup.
1662 # @job-id: identifier for the newly-created block job. If
1663 #          omitted, the device name will be used. (Since 2.7)
1665 # @device:  the device name or node-name of a root node whose writes should be
1666 #           mirrored.
1668 # @target: the target of the new image. If the file exists, or if it
1669 #          is a device, the existing file/device will be used as the new
1670 #          destination.  If it does not exist, a new file will be created.
1672 # @format: the format of the new destination, default is to
1673 #          probe if @mode is 'existing', else the format of the source
1675 # @node-name: the new block driver state node name in the graph
1676 #             (Since 2.1)
1678 # @replaces: with sync=full graph node name to be replaced by the new
1679 #            image when a whole image copy is done. This can be used to repair
1680 #            broken Quorum files. (Since 2.1)
1682 # @mode: whether and how QEMU should create a new image, default is
1683 #        'absolute-paths'.
1685 # @speed:  the maximum speed, in bytes per second
1687 # @sync: what parts of the disk image should be copied to the destination
1688 #        (all the disk, only the sectors allocated in the topmost image, or
1689 #        only new I/O).
1691 # @granularity: granularity of the dirty bitmap, default is 64K
1692 #               if the image format doesn't have clusters, 4K if the clusters
1693 #               are smaller than that, else the cluster size.  Must be a
1694 #               power of 2 between 512 and 64M (since 1.4).
1696 # @buf-size: maximum amount of data in flight from source to
1697 #            target (since 1.4).
1699 # @on-source-error: the action to take on an error on the source,
1700 #                   default 'report'.  'stop' and 'enospc' can only be used
1701 #                   if the block device supports io-status (see BlockInfo).
1703 # @on-target-error: the action to take on an error on the target,
1704 #                   default 'report' (no limitations, since this applies to
1705 #                   a different block device than @device).
1706 # @unmap: Whether to try to unmap target sectors where source has
1707 #         only zero. If true, and target unallocated sectors will read as zero,
1708 #         target image sectors will be unmapped; otherwise, zeroes will be
1709 #         written. Both will result in identical contents.
1710 #         Default is true. (Since 2.4)
1712 # @copy-mode: when to copy data to the destination; defaults to 'background'
1713 #             (Since: 3.0)
1715 # Since: 1.3
1717 { 'struct': 'DriveMirror',
1718   'data': { '*job-id': 'str', 'device': 'str', 'target': 'str',
1719             '*format': 'str', '*node-name': 'str', '*replaces': 'str',
1720             'sync': 'MirrorSyncMode', '*mode': 'NewImageMode',
1721             '*speed': 'int', '*granularity': 'uint32',
1722             '*buf-size': 'int', '*on-source-error': 'BlockdevOnError',
1723             '*on-target-error': 'BlockdevOnError',
1724             '*unmap': 'bool', '*copy-mode': 'MirrorCopyMode' } }
1727 # @BlockDirtyBitmap:
1729 # @node: name of device/node which the bitmap is tracking
1731 # @name: name of the dirty bitmap
1733 # Since: 2.4
1735 { 'struct': 'BlockDirtyBitmap',
1736   'data': { 'node': 'str', 'name': 'str' } }
1739 # @BlockDirtyBitmapAdd:
1741 # @node: name of device/node which the bitmap is tracking
1743 # @name: name of the dirty bitmap
1745 # @granularity: the bitmap granularity, default is 64k for
1746 #               block-dirty-bitmap-add
1748 # @persistent: the bitmap is persistent, i.e. it will be saved to the
1749 #              corresponding block device image file on its close. For now only
1750 #              Qcow2 disks support persistent bitmaps. Default is false for
1751 #              block-dirty-bitmap-add. (Since: 2.10)
1753 # @autoload: ignored and deprecated since 2.12.
1754 #            Currently, all dirty tracking bitmaps are loaded from Qcow2 on
1755 #            open.
1757 # @x-disabled: the bitmap is created in the disabled state, which means that
1758 #              it will not track drive changes. The bitmap may be enabled with
1759 #              x-block-dirty-bitmap-enable. Default is false. (Since: 3.0)
1761 # Since: 2.4
1763 { 'struct': 'BlockDirtyBitmapAdd',
1764   'data': { 'node': 'str', 'name': 'str', '*granularity': 'uint32',
1765             '*persistent': 'bool', '*autoload': 'bool', '*x-disabled': 'bool' } }
1768 # @BlockDirtyBitmapMerge:
1770 # @node: name of device/node which the bitmap is tracking
1772 # @dst_name: name of the destination dirty bitmap
1774 # @src_name: name of the source dirty bitmap
1776 # Since: 3.0
1778 { 'struct': 'BlockDirtyBitmapMerge',
1779   'data': { 'node': 'str', 'dst_name': 'str', 'src_name': 'str' } }
1782 # @block-dirty-bitmap-add:
1784 # Create a dirty bitmap with a name on the node, and start tracking the writes.
1786 # Returns: nothing on success
1787 #          If @node is not a valid block device or node, DeviceNotFound
1788 #          If @name is already taken, GenericError with an explanation
1790 # Since: 2.4
1792 # Example:
1794 # -> { "execute": "block-dirty-bitmap-add",
1795 #      "arguments": { "node": "drive0", "name": "bitmap0" } }
1796 # <- { "return": {} }
1799 { 'command': 'block-dirty-bitmap-add',
1800   'data': 'BlockDirtyBitmapAdd' }
1803 # @block-dirty-bitmap-remove:
1805 # Stop write tracking and remove the dirty bitmap that was created
1806 # with block-dirty-bitmap-add. If the bitmap is persistent, remove it from its
1807 # storage too.
1809 # Returns: nothing on success
1810 #          If @node is not a valid block device or node, DeviceNotFound
1811 #          If @name is not found, GenericError with an explanation
1812 #          if @name is frozen by an operation, GenericError
1814 # Since: 2.4
1816 # Example:
1818 # -> { "execute": "block-dirty-bitmap-remove",
1819 #      "arguments": { "node": "drive0", "name": "bitmap0" } }
1820 # <- { "return": {} }
1823 { 'command': 'block-dirty-bitmap-remove',
1824   'data': 'BlockDirtyBitmap' }
1827 # @block-dirty-bitmap-clear:
1829 # Clear (reset) a dirty bitmap on the device, so that an incremental
1830 # backup from this point in time forward will only backup clusters
1831 # modified after this clear operation.
1833 # Returns: nothing on success
1834 #          If @node is not a valid block device, DeviceNotFound
1835 #          If @name is not found, GenericError with an explanation
1837 # Since: 2.4
1839 # Example:
1841 # -> { "execute": "block-dirty-bitmap-clear",
1842 #      "arguments": { "node": "drive0", "name": "bitmap0" } }
1843 # <- { "return": {} }
1846 { 'command': 'block-dirty-bitmap-clear',
1847   'data': 'BlockDirtyBitmap' }
1850 # @x-block-dirty-bitmap-enable:
1852 # Enables a dirty bitmap so that it will begin tracking disk changes.
1854 # Returns: nothing on success
1855 #          If @node is not a valid block device, DeviceNotFound
1856 #          If @name is not found, GenericError with an explanation
1858 # Since: 3.0
1860 # Example:
1862 # -> { "execute": "x-block-dirty-bitmap-enable",
1863 #      "arguments": { "node": "drive0", "name": "bitmap0" } }
1864 # <- { "return": {} }
1867   { 'command': 'x-block-dirty-bitmap-enable',
1868     'data': 'BlockDirtyBitmap' }
1871 # @x-block-dirty-bitmap-disable:
1873 # Disables a dirty bitmap so that it will stop tracking disk changes.
1875 # Returns: nothing on success
1876 #          If @node is not a valid block device, DeviceNotFound
1877 #          If @name is not found, GenericError with an explanation
1879 # Since: 3.0
1881 # Example:
1883 # -> { "execute": "x-block-dirty-bitmap-disable",
1884 #      "arguments": { "node": "drive0", "name": "bitmap0" } }
1885 # <- { "return": {} }
1888     { 'command': 'x-block-dirty-bitmap-disable',
1889       'data': 'BlockDirtyBitmap' }
1892 # @x-block-dirty-bitmap-merge:
1894 # Merge @src_name dirty bitmap to @dst_name dirty bitmap. @src_name dirty
1895 # bitmap is unchanged. On error, @dst_name is unchanged.
1897 # Returns: nothing on success
1898 #          If @node is not a valid block device, DeviceNotFound
1899 #          If @dst_name or @src_name is not found, GenericError
1900 #          If bitmaps has different sizes or granularities, GenericError
1902 # Since: 3.0
1904 # Example:
1906 # -> { "execute": "x-block-dirty-bitmap-merge",
1907 #      "arguments": { "node": "drive0", "dst_name": "bitmap0",
1908 #                     "src_name": "bitmap1" } }
1909 # <- { "return": {} }
1912       { 'command': 'x-block-dirty-bitmap-merge',
1913         'data': 'BlockDirtyBitmapMerge' }
1916 # @BlockDirtyBitmapSha256:
1918 # SHA256 hash of dirty bitmap data
1920 # @sha256: ASCII representation of SHA256 bitmap hash
1922 # Since: 2.10
1924   { 'struct': 'BlockDirtyBitmapSha256',
1925     'data': {'sha256': 'str'} }
1928 # @x-debug-block-dirty-bitmap-sha256:
1930 # Get bitmap SHA256
1932 # Returns: BlockDirtyBitmapSha256 on success
1933 #          If @node is not a valid block device, DeviceNotFound
1934 #          If @name is not found or if hashing has failed, GenericError with an
1935 #          explanation
1937 # Since: 2.10
1939   { 'command': 'x-debug-block-dirty-bitmap-sha256',
1940     'data': 'BlockDirtyBitmap', 'returns': 'BlockDirtyBitmapSha256' }
1943 # @blockdev-mirror:
1945 # Start mirroring a block device's writes to a new destination.
1947 # @job-id: identifier for the newly-created block job. If
1948 #          omitted, the device name will be used. (Since 2.7)
1950 # @device: The device name or node-name of a root node whose writes should be
1951 #          mirrored.
1953 # @target: the id or node-name of the block device to mirror to. This mustn't be
1954 #          attached to guest.
1956 # @replaces: with sync=full graph node name to be replaced by the new
1957 #            image when a whole image copy is done. This can be used to repair
1958 #            broken Quorum files.
1960 # @speed:  the maximum speed, in bytes per second
1962 # @sync: what parts of the disk image should be copied to the destination
1963 #        (all the disk, only the sectors allocated in the topmost image, or
1964 #        only new I/O).
1966 # @granularity: granularity of the dirty bitmap, default is 64K
1967 #               if the image format doesn't have clusters, 4K if the clusters
1968 #               are smaller than that, else the cluster size.  Must be a
1969 #               power of 2 between 512 and 64M
1971 # @buf-size: maximum amount of data in flight from source to
1972 #            target
1974 # @on-source-error: the action to take on an error on the source,
1975 #                   default 'report'.  'stop' and 'enospc' can only be used
1976 #                   if the block device supports io-status (see BlockInfo).
1978 # @on-target-error: the action to take on an error on the target,
1979 #                   default 'report' (no limitations, since this applies to
1980 #                   a different block device than @device).
1982 # @filter-node-name: the node name that should be assigned to the
1983 #                    filter driver that the mirror job inserts into the graph
1984 #                    above @device. If this option is not given, a node name is
1985 #                    autogenerated. (Since: 2.9)
1987 # @copy-mode: when to copy data to the destination; defaults to 'background'
1988 #             (Since: 3.0)
1990 # Returns: nothing on success.
1992 # Since: 2.6
1994 # Example:
1996 # -> { "execute": "blockdev-mirror",
1997 #      "arguments": { "device": "ide-hd0",
1998 #                     "target": "target0",
1999 #                     "sync": "full" } }
2000 # <- { "return": {} }
2003 { 'command': 'blockdev-mirror',
2004   'data': { '*job-id': 'str', 'device': 'str', 'target': 'str',
2005             '*replaces': 'str',
2006             'sync': 'MirrorSyncMode',
2007             '*speed': 'int', '*granularity': 'uint32',
2008             '*buf-size': 'int', '*on-source-error': 'BlockdevOnError',
2009             '*on-target-error': 'BlockdevOnError',
2010             '*filter-node-name': 'str',
2011             '*copy-mode': 'MirrorCopyMode' } }
2014 # @block_set_io_throttle:
2016 # Change I/O throttle limits for a block drive.
2018 # Since QEMU 2.4, each device with I/O limits is member of a throttle
2019 # group.
2021 # If two or more devices are members of the same group, the limits
2022 # will apply to the combined I/O of the whole group in a round-robin
2023 # fashion. Therefore, setting new I/O limits to a device will affect
2024 # the whole group.
2026 # The name of the group can be specified using the 'group' parameter.
2027 # If the parameter is unset, it is assumed to be the current group of
2028 # that device. If it's not in any group yet, the name of the device
2029 # will be used as the name for its group.
2031 # The 'group' parameter can also be used to move a device to a
2032 # different group. In this case the limits specified in the parameters
2033 # will be applied to the new group only.
2035 # I/O limits can be disabled by setting all of them to 0. In this case
2036 # the device will be removed from its group and the rest of its
2037 # members will not be affected. The 'group' parameter is ignored.
2039 # Returns: Nothing on success
2040 #          If @device is not a valid block device, DeviceNotFound
2042 # Since: 1.1
2044 # Example:
2046 # -> { "execute": "block_set_io_throttle",
2047 #      "arguments": { "id": "virtio-blk-pci0/virtio-backend",
2048 #                     "bps": 0,
2049 #                     "bps_rd": 0,
2050 #                     "bps_wr": 0,
2051 #                     "iops": 512,
2052 #                     "iops_rd": 0,
2053 #                     "iops_wr": 0,
2054 #                     "bps_max": 0,
2055 #                     "bps_rd_max": 0,
2056 #                     "bps_wr_max": 0,
2057 #                     "iops_max": 0,
2058 #                     "iops_rd_max": 0,
2059 #                     "iops_wr_max": 0,
2060 #                     "bps_max_length": 0,
2061 #                     "iops_size": 0 } }
2062 # <- { "return": {} }
2064 # -> { "execute": "block_set_io_throttle",
2065 #      "arguments": { "id": "ide0-1-0",
2066 #                     "bps": 1000000,
2067 #                     "bps_rd": 0,
2068 #                     "bps_wr": 0,
2069 #                     "iops": 0,
2070 #                     "iops_rd": 0,
2071 #                     "iops_wr": 0,
2072 #                     "bps_max": 8000000,
2073 #                     "bps_rd_max": 0,
2074 #                     "bps_wr_max": 0,
2075 #                     "iops_max": 0,
2076 #                     "iops_rd_max": 0,
2077 #                     "iops_wr_max": 0,
2078 #                     "bps_max_length": 60,
2079 #                     "iops_size": 0 } }
2080 # <- { "return": {} }
2082 { 'command': 'block_set_io_throttle', 'boxed': true,
2083   'data': 'BlockIOThrottle' }
2086 # @BlockIOThrottle:
2088 # A set of parameters describing block throttling.
2090 # @device: Block device name (deprecated, use @id instead)
2092 # @id: The name or QOM path of the guest device (since: 2.8)
2094 # @bps: total throughput limit in bytes per second
2096 # @bps_rd: read throughput limit in bytes per second
2098 # @bps_wr: write throughput limit in bytes per second
2100 # @iops: total I/O operations per second
2102 # @iops_rd: read I/O operations per second
2104 # @iops_wr: write I/O operations per second
2106 # @bps_max: total throughput limit during bursts,
2107 #                     in bytes (Since 1.7)
2109 # @bps_rd_max: read throughput limit during bursts,
2110 #                        in bytes (Since 1.7)
2112 # @bps_wr_max: write throughput limit during bursts,
2113 #                        in bytes (Since 1.7)
2115 # @iops_max: total I/O operations per second during bursts,
2116 #                      in bytes (Since 1.7)
2118 # @iops_rd_max: read I/O operations per second during bursts,
2119 #                         in bytes (Since 1.7)
2121 # @iops_wr_max: write I/O operations per second during bursts,
2122 #                         in bytes (Since 1.7)
2124 # @bps_max_length: maximum length of the @bps_max burst
2125 #                            period, in seconds. It must only
2126 #                            be set if @bps_max is set as well.
2127 #                            Defaults to 1. (Since 2.6)
2129 # @bps_rd_max_length: maximum length of the @bps_rd_max
2130 #                               burst period, in seconds. It must only
2131 #                               be set if @bps_rd_max is set as well.
2132 #                               Defaults to 1. (Since 2.6)
2134 # @bps_wr_max_length: maximum length of the @bps_wr_max
2135 #                               burst period, in seconds. It must only
2136 #                               be set if @bps_wr_max is set as well.
2137 #                               Defaults to 1. (Since 2.6)
2139 # @iops_max_length: maximum length of the @iops burst
2140 #                             period, in seconds. It must only
2141 #                             be set if @iops_max is set as well.
2142 #                             Defaults to 1. (Since 2.6)
2144 # @iops_rd_max_length: maximum length of the @iops_rd_max
2145 #                                burst period, in seconds. It must only
2146 #                                be set if @iops_rd_max is set as well.
2147 #                                Defaults to 1. (Since 2.6)
2149 # @iops_wr_max_length: maximum length of the @iops_wr_max
2150 #                                burst period, in seconds. It must only
2151 #                                be set if @iops_wr_max is set as well.
2152 #                                Defaults to 1. (Since 2.6)
2154 # @iops_size: an I/O size in bytes (Since 1.7)
2156 # @group: throttle group name (Since 2.4)
2158 # Since: 1.1
2160 { 'struct': 'BlockIOThrottle',
2161   'data': { '*device': 'str', '*id': 'str', 'bps': 'int', 'bps_rd': 'int',
2162             'bps_wr': 'int', 'iops': 'int', 'iops_rd': 'int', 'iops_wr': 'int',
2163             '*bps_max': 'int', '*bps_rd_max': 'int',
2164             '*bps_wr_max': 'int', '*iops_max': 'int',
2165             '*iops_rd_max': 'int', '*iops_wr_max': 'int',
2166             '*bps_max_length': 'int', '*bps_rd_max_length': 'int',
2167             '*bps_wr_max_length': 'int', '*iops_max_length': 'int',
2168             '*iops_rd_max_length': 'int', '*iops_wr_max_length': 'int',
2169             '*iops_size': 'int', '*group': 'str' } }
2172 # @ThrottleLimits:
2174 # Limit parameters for throttling.
2175 # Since some limit combinations are illegal, limits should always be set in one
2176 # transaction. All fields are optional. When setting limits, if a field is
2177 # missing the current value is not changed.
2179 # @iops-total:             limit total I/O operations per second
2180 # @iops-total-max:         I/O operations burst
2181 # @iops-total-max-length:  length of the iops-total-max burst period, in seconds
2182 #                          It must only be set if @iops-total-max is set as well.
2183 # @iops-read:              limit read operations per second
2184 # @iops-read-max:          I/O operations read burst
2185 # @iops-read-max-length:   length of the iops-read-max burst period, in seconds
2186 #                          It must only be set if @iops-read-max is set as well.
2187 # @iops-write:             limit write operations per second
2188 # @iops-write-max:         I/O operations write burst
2189 # @iops-write-max-length:  length of the iops-write-max burst period, in seconds
2190 #                          It must only be set if @iops-write-max is set as well.
2191 # @bps-total:              limit total bytes per second
2192 # @bps-total-max:          total bytes burst
2193 # @bps-total-max-length:   length of the bps-total-max burst period, in seconds.
2194 #                          It must only be set if @bps-total-max is set as well.
2195 # @bps-read:               limit read bytes per second
2196 # @bps-read-max:           total bytes read burst
2197 # @bps-read-max-length:    length of the bps-read-max burst period, in seconds
2198 #                          It must only be set if @bps-read-max is set as well.
2199 # @bps-write:              limit write bytes per second
2200 # @bps-write-max:          total bytes write burst
2201 # @bps-write-max-length:   length of the bps-write-max burst period, in seconds
2202 #                          It must only be set if @bps-write-max is set as well.
2203 # @iops-size:              when limiting by iops max size of an I/O in bytes
2205 # Since: 2.11
2207 { 'struct': 'ThrottleLimits',
2208   'data': { '*iops-total' : 'int', '*iops-total-max' : 'int',
2209             '*iops-total-max-length' : 'int', '*iops-read' : 'int',
2210             '*iops-read-max' : 'int', '*iops-read-max-length' : 'int',
2211             '*iops-write' : 'int', '*iops-write-max' : 'int',
2212             '*iops-write-max-length' : 'int', '*bps-total' : 'int',
2213             '*bps-total-max' : 'int', '*bps-total-max-length' : 'int',
2214             '*bps-read' : 'int', '*bps-read-max' : 'int',
2215             '*bps-read-max-length' : 'int', '*bps-write' : 'int',
2216             '*bps-write-max' : 'int', '*bps-write-max-length' : 'int',
2217             '*iops-size' : 'int' } }
2220 # @block-stream:
2222 # Copy data from a backing file into a block device.
2224 # The block streaming operation is performed in the background until the entire
2225 # backing file has been copied.  This command returns immediately once streaming
2226 # has started.  The status of ongoing block streaming operations can be checked
2227 # with query-block-jobs.  The operation can be stopped before it has completed
2228 # using the block-job-cancel command.
2230 # The node that receives the data is called the top image, can be located in
2231 # any part of the chain (but always above the base image; see below) and can be
2232 # specified using its device or node name. Earlier qemu versions only allowed
2233 # 'device' to name the top level node; presence of the 'base-node' parameter
2234 # during introspection can be used as a witness of the enhanced semantics
2235 # of 'device'.
2237 # If a base file is specified then sectors are not copied from that base file and
2238 # its backing chain.  When streaming completes the image file will have the base
2239 # file as its backing file.  This can be used to stream a subset of the backing
2240 # file chain instead of flattening the entire image.
2242 # On successful completion the image file is updated to drop the backing file
2243 # and the BLOCK_JOB_COMPLETED event is emitted.
2245 # @job-id: identifier for the newly-created block job. If
2246 #          omitted, the device name will be used. (Since 2.7)
2248 # @device: the device or node name of the top image
2250 # @base:   the common backing file name.
2251 #                    It cannot be set if @base-node is also set.
2253 # @base-node: the node name of the backing file.
2254 #                       It cannot be set if @base is also set. (Since 2.8)
2256 # @backing-file: The backing file string to write into the top
2257 #                          image. This filename is not validated.
2259 #                          If a pathname string is such that it cannot be
2260 #                          resolved by QEMU, that means that subsequent QMP or
2261 #                          HMP commands must use node-names for the image in
2262 #                          question, as filename lookup methods will fail.
2264 #                          If not specified, QEMU will automatically determine
2265 #                          the backing file string to use, or error out if there
2266 #                          is no obvious choice.  Care should be taken when
2267 #                          specifying the string, to specify a valid filename or
2268 #                          protocol.
2269 #                          (Since 2.1)
2271 # @speed:  the maximum speed, in bytes per second
2273 # @on-error: the action to take on an error (default report).
2274 #            'stop' and 'enospc' can only be used if the block device
2275 #            supports io-status (see BlockInfo).  Since 1.3.
2277 # Returns: Nothing on success. If @device does not exist, DeviceNotFound.
2279 # Since: 1.1
2281 # Example:
2283 # -> { "execute": "block-stream",
2284 #      "arguments": { "device": "virtio0",
2285 #                     "base": "/tmp/master.qcow2" } }
2286 # <- { "return": {} }
2289 { 'command': 'block-stream',
2290   'data': { '*job-id': 'str', 'device': 'str', '*base': 'str',
2291             '*base-node': 'str', '*backing-file': 'str', '*speed': 'int',
2292             '*on-error': 'BlockdevOnError' } }
2295 # @block-job-set-speed:
2297 # Set maximum speed for a background block operation.
2299 # This command can only be issued when there is an active block job.
2301 # Throttling can be disabled by setting the speed to 0.
2303 # @device: The job identifier. This used to be a device name (hence
2304 #          the name of the parameter), but since QEMU 2.7 it can have
2305 #          other values.
2307 # @speed:  the maximum speed, in bytes per second, or 0 for unlimited.
2308 #          Defaults to 0.
2310 # Returns: Nothing on success
2311 #          If no background operation is active on this device, DeviceNotActive
2313 # Since: 1.1
2315 { 'command': 'block-job-set-speed',
2316   'data': { 'device': 'str', 'speed': 'int' } }
2319 # @block-job-cancel:
2321 # Stop an active background block operation.
2323 # This command returns immediately after marking the active background block
2324 # operation for cancellation.  It is an error to call this command if no
2325 # operation is in progress.
2327 # The operation will cancel as soon as possible and then emit the
2328 # BLOCK_JOB_CANCELLED event.  Before that happens the job is still visible when
2329 # enumerated using query-block-jobs.
2331 # Note that if you issue 'block-job-cancel' after 'drive-mirror' has indicated
2332 # (via the event BLOCK_JOB_READY) that the source and destination are
2333 # synchronized, then the event triggered by this command changes to
2334 # BLOCK_JOB_COMPLETED, to indicate that the mirroring has ended and the
2335 # destination now has a point-in-time copy tied to the time of the cancellation.
2337 # For streaming, the image file retains its backing file unless the streaming
2338 # operation happens to complete just as it is being cancelled.  A new streaming
2339 # operation can be started at a later time to finish copying all data from the
2340 # backing file.
2342 # @device: The job identifier. This used to be a device name (hence
2343 #          the name of the parameter), but since QEMU 2.7 it can have
2344 #          other values.
2346 # @force: If true, and the job has already emitted the event BLOCK_JOB_READY,
2347 #         abandon the job immediately (even if it is paused) instead of waiting
2348 #         for the destination to complete its final synchronization (since 1.3)
2350 # Returns: Nothing on success
2351 #          If no background operation is active on this device, DeviceNotActive
2353 # Since: 1.1
2355 { 'command': 'block-job-cancel', 'data': { 'device': 'str', '*force': 'bool' } }
2358 # @block-job-pause:
2360 # Pause an active background block operation.
2362 # This command returns immediately after marking the active background block
2363 # operation for pausing.  It is an error to call this command if no
2364 # operation is in progress or if the job is already paused.
2366 # The operation will pause as soon as possible.  No event is emitted when
2367 # the operation is actually paused.  Cancelling a paused job automatically
2368 # resumes it.
2370 # @device: The job identifier. This used to be a device name (hence
2371 #          the name of the parameter), but since QEMU 2.7 it can have
2372 #          other values.
2374 # Returns: Nothing on success
2375 #          If no background operation is active on this device, DeviceNotActive
2377 # Since: 1.3
2379 { 'command': 'block-job-pause', 'data': { 'device': 'str' } }
2382 # @block-job-resume:
2384 # Resume an active background block operation.
2386 # This command returns immediately after resuming a paused background block
2387 # operation.  It is an error to call this command if no operation is in
2388 # progress or if the job is not paused.
2390 # This command also clears the error status of the job.
2392 # @device: The job identifier. This used to be a device name (hence
2393 #          the name of the parameter), but since QEMU 2.7 it can have
2394 #          other values.
2396 # Returns: Nothing on success
2397 #          If no background operation is active on this device, DeviceNotActive
2399 # Since: 1.3
2401 { 'command': 'block-job-resume', 'data': { 'device': 'str' } }
2404 # @block-job-complete:
2406 # Manually trigger completion of an active background block operation.  This
2407 # is supported for drive mirroring, where it also switches the device to
2408 # write to the target path only.  The ability to complete is signaled with
2409 # a BLOCK_JOB_READY event.
2411 # This command completes an active background block operation synchronously.
2412 # The ordering of this command's return with the BLOCK_JOB_COMPLETED event
2413 # is not defined.  Note that if an I/O error occurs during the processing of
2414 # this command: 1) the command itself will fail; 2) the error will be processed
2415 # according to the rerror/werror arguments that were specified when starting
2416 # the operation.
2418 # A cancelled or paused job cannot be completed.
2420 # @device: The job identifier. This used to be a device name (hence
2421 #          the name of the parameter), but since QEMU 2.7 it can have
2422 #          other values.
2424 # Returns: Nothing on success
2425 #          If no background operation is active on this device, DeviceNotActive
2427 # Since: 1.3
2429 { 'command': 'block-job-complete', 'data': { 'device': 'str' } }
2432 # @block-job-dismiss:
2434 # For jobs that have already concluded, remove them from the block-job-query
2435 # list. This command only needs to be run for jobs which were started with
2436 # QEMU 2.12+ job lifetime management semantics.
2438 # This command will refuse to operate on any job that has not yet reached
2439 # its terminal state, JOB_STATUS_CONCLUDED. For jobs that make use of the
2440 # BLOCK_JOB_READY event, block-job-cancel or block-job-complete will still need
2441 # to be used as appropriate.
2443 # @id: The job identifier.
2445 # Returns: Nothing on success
2447 # Since: 2.12
2449 { 'command': 'block-job-dismiss', 'data': { 'id': 'str' } }
2452 # @block-job-finalize:
2454 # Once a job that has manual=true reaches the pending state, it can be
2455 # instructed to finalize any graph changes and do any necessary cleanup
2456 # via this command.
2457 # For jobs in a transaction, instructing one job to finalize will force
2458 # ALL jobs in the transaction to finalize, so it is only necessary to instruct
2459 # a single member job to finalize.
2461 # @id: The job identifier.
2463 # Returns: Nothing on success
2465 # Since: 2.12
2467 { 'command': 'block-job-finalize', 'data': { 'id': 'str' } }
2470 # @BlockdevDiscardOptions:
2472 # Determines how to handle discard requests.
2474 # @ignore:      Ignore the request
2475 # @unmap:       Forward as an unmap request
2477 # Since: 2.9
2479 { 'enum': 'BlockdevDiscardOptions',
2480   'data': [ 'ignore', 'unmap' ] }
2483 # @BlockdevDetectZeroesOptions:
2485 # Describes the operation mode for the automatic conversion of plain
2486 # zero writes by the OS to driver specific optimized zero write commands.
2488 # @off:      Disabled (default)
2489 # @on:       Enabled
2490 # @unmap:    Enabled and even try to unmap blocks if possible. This requires
2491 #            also that @BlockdevDiscardOptions is set to unmap for this device.
2493 # Since: 2.1
2495 { 'enum': 'BlockdevDetectZeroesOptions',
2496   'data': [ 'off', 'on', 'unmap' ] }
2499 # @BlockdevAioOptions:
2501 # Selects the AIO backend to handle I/O requests
2503 # @threads:     Use qemu's thread pool
2504 # @native:      Use native AIO backend (only Linux and Windows)
2506 # Since: 2.9
2508 { 'enum': 'BlockdevAioOptions',
2509   'data': [ 'threads', 'native' ] }
2512 # @BlockdevCacheOptions:
2514 # Includes cache-related options for block devices
2516 # @direct:      enables use of O_DIRECT (bypass the host page cache;
2517 #               default: false)
2518 # @no-flush:    ignore any flush requests for the device (default:
2519 #               false)
2521 # Since: 2.9
2523 { 'struct': 'BlockdevCacheOptions',
2524   'data': { '*direct': 'bool',
2525             '*no-flush': 'bool' } }
2528 # @BlockdevDriver:
2530 # Drivers that are supported in block device operations.
2532 # @vxhs: Since 2.10
2533 # @throttle: Since 2.11
2534 # @nvme: Since 2.12
2535 # @copy-on-read: Since 3.0
2536 # @blklogwrites: Since 3.0
2538 # Since: 2.9
2540 { 'enum': 'BlockdevDriver',
2541   'data': [ 'blkdebug', 'blklogwrites', 'blkverify', 'bochs', 'cloop',
2542             'copy-on-read', 'dmg', 'file', 'ftp', 'ftps', 'gluster',
2543             'host_cdrom', 'host_device', 'http', 'https', 'iscsi', 'luks',
2544             'nbd', 'nfs', 'null-aio', 'null-co', 'nvme', 'parallels', 'qcow',
2545             'qcow2', 'qed', 'quorum', 'raw', 'rbd', 'replication', 'sheepdog',
2546             'ssh', '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 # @SshHostKeyCheck:
2883 # Since: 2.12
2885 { 'union': 'SshHostKeyCheck',
2886   'base': { 'mode': 'SshHostKeyCheckMode' },
2887   'discriminator': 'mode',
2888   'data': { 'hash': 'SshHostKeyHash' } }
2891 # @BlockdevOptionsSsh:
2893 # @server:              host address
2895 # @path:                path to the image on the host
2897 # @user:                user as which to connect, defaults to current
2898 #                       local user name
2900 # @host-key-check:      Defines how and what to check the host key against
2901 #                       (default: known_hosts)
2903 # Since: 2.9
2905 { 'struct': 'BlockdevOptionsSsh',
2906   'data': { 'server': 'InetSocketAddress',
2907             'path': 'str',
2908             '*user': 'str',
2909             '*host-key-check': 'SshHostKeyCheck' } }
2913 # @BlkdebugEvent:
2915 # Trigger events supported by blkdebug.
2917 # @l1_shrink_write_table:      write zeros to the l1 table to shrink image.
2918 #                              (since 2.11)
2920 # @l1_shrink_free_l2_clusters: discard the l2 tables. (since 2.11)
2922 # @cor_write: a write due to copy-on-read (since 2.11)
2924 # Since: 2.9
2926 { 'enum': 'BlkdebugEvent', 'prefix': 'BLKDBG',
2927   'data': [ 'l1_update', 'l1_grow_alloc_table', 'l1_grow_write_table',
2928             'l1_grow_activate_table', 'l2_load', 'l2_update',
2929             'l2_update_compressed', 'l2_alloc_cow_read', 'l2_alloc_write',
2930             'read_aio', 'read_backing_aio', 'read_compressed', 'write_aio',
2931             'write_compressed', 'vmstate_load', 'vmstate_save', 'cow_read',
2932             'cow_write', 'reftable_load', 'reftable_grow', 'reftable_update',
2933             'refblock_load', 'refblock_update', 'refblock_update_part',
2934             'refblock_alloc', 'refblock_alloc_hookup', 'refblock_alloc_write',
2935             'refblock_alloc_write_blocks', 'refblock_alloc_write_table',
2936             'refblock_alloc_switch_table', 'cluster_alloc',
2937             'cluster_alloc_bytes', 'cluster_free', 'flush_to_os',
2938             'flush_to_disk', 'pwritev_rmw_head', 'pwritev_rmw_after_head',
2939             'pwritev_rmw_tail', 'pwritev_rmw_after_tail', 'pwritev',
2940             'pwritev_zero', 'pwritev_done', 'empty_image_prepare',
2941             'l1_shrink_write_table', 'l1_shrink_free_l2_clusters',
2942             'cor_write'] }
2945 # @BlkdebugInjectErrorOptions:
2947 # Describes a single error injection for blkdebug.
2949 # @event:       trigger event
2951 # @state:       the state identifier blkdebug needs to be in to
2952 #               actually trigger the event; defaults to "any"
2954 # @errno:       error identifier (errno) to be returned; defaults to
2955 #               EIO
2957 # @sector:      specifies the sector index which has to be affected
2958 #               in order to actually trigger the event; defaults to "any
2959 #               sector"
2961 # @once:        disables further events after this one has been
2962 #               triggered; defaults to false
2964 # @immediately: fail immediately; defaults to false
2966 # Since: 2.9
2968 { 'struct': 'BlkdebugInjectErrorOptions',
2969   'data': { 'event': 'BlkdebugEvent',
2970             '*state': 'int',
2971             '*errno': 'int',
2972             '*sector': 'int',
2973             '*once': 'bool',
2974             '*immediately': 'bool' } }
2977 # @BlkdebugSetStateOptions:
2979 # Describes a single state-change event for blkdebug.
2981 # @event:       trigger event
2983 # @state:       the current state identifier blkdebug needs to be in;
2984 #               defaults to "any"
2986 # @new_state:   the state identifier blkdebug is supposed to assume if
2987 #               this event is triggered
2989 # Since: 2.9
2991 { 'struct': 'BlkdebugSetStateOptions',
2992   'data': { 'event': 'BlkdebugEvent',
2993             '*state': 'int',
2994             'new_state': 'int' } }
2997 # @BlockdevOptionsBlkdebug:
2999 # Driver specific block device options for blkdebug.
3001 # @image:           underlying raw block device (or image file)
3003 # @config:          filename of the configuration file
3005 # @align:           required alignment for requests in bytes, must be
3006 #                   positive power of 2, or 0 for default
3008 # @max-transfer:    maximum size for I/O transfers in bytes, must be
3009 #                   positive multiple of @align and of the underlying
3010 #                   file's request alignment (but need not be a power of
3011 #                   2), or 0 for default (since 2.10)
3013 # @opt-write-zero:  preferred alignment for write zero requests in bytes,
3014 #                   must be positive multiple of @align and of the
3015 #                   underlying file's request alignment (but need not be a
3016 #                   power of 2), or 0 for default (since 2.10)
3018 # @max-write-zero:  maximum size for write zero requests in bytes, must be
3019 #                   positive multiple of @align, of @opt-write-zero, and of
3020 #                   the underlying file's request alignment (but need not
3021 #                   be a power of 2), or 0 for default (since 2.10)
3023 # @opt-discard:     preferred alignment for discard requests in bytes, must
3024 #                   be positive multiple of @align and of the underlying
3025 #                   file's request alignment (but need not be a power of
3026 #                   2), or 0 for default (since 2.10)
3028 # @max-discard:     maximum size for discard requests in bytes, must be
3029 #                   positive multiple of @align, of @opt-discard, and of
3030 #                   the underlying file's request alignment (but need not
3031 #                   be a power of 2), or 0 for default (since 2.10)
3033 # @inject-error:    array of error injection descriptions
3035 # @set-state:       array of state-change descriptions
3037 # Since: 2.9
3039 { 'struct': 'BlockdevOptionsBlkdebug',
3040   'data': { 'image': 'BlockdevRef',
3041             '*config': 'str',
3042             '*align': 'int', '*max-transfer': 'int32',
3043             '*opt-write-zero': 'int32', '*max-write-zero': 'int32',
3044             '*opt-discard': 'int32', '*max-discard': 'int32',
3045             '*inject-error': ['BlkdebugInjectErrorOptions'],
3046             '*set-state': ['BlkdebugSetStateOptions'] } }
3049 # @BlockdevOptionsBlklogwrites:
3051 # Driver specific block device options for blklogwrites.
3053 # @file:            block device
3055 # @log:             block device used to log writes to @file
3057 # @log-sector-size: sector size used in logging writes to @file, determines
3058 #                   granularity of offsets and sizes of writes (default: 512)
3060 # @log-append:      append to an existing log (default: false)
3062 # @log-super-update-interval: interval of write requests after which the log
3063 #                             super block is updated to disk (default: 4096)
3065 # Since: 3.0
3067 { 'struct': 'BlockdevOptionsBlklogwrites',
3068   'data': { 'file': 'BlockdevRef',
3069             'log': 'BlockdevRef',
3070             '*log-sector-size': 'uint32',
3071             '*log-append': 'bool',
3072             '*log-super-update-interval': 'uint64' } }
3075 # @BlockdevOptionsBlkverify:
3077 # Driver specific block device options for blkverify.
3079 # @test:    block device to be tested
3081 # @raw:     raw image used for verification
3083 # Since: 2.9
3085 { 'struct': 'BlockdevOptionsBlkverify',
3086   'data': { 'test': 'BlockdevRef',
3087             'raw': 'BlockdevRef' } }
3090 # @QuorumReadPattern:
3092 # An enumeration of quorum read patterns.
3094 # @quorum: read all the children and do a quorum vote on reads
3096 # @fifo: read only from the first child that has not failed
3098 # Since: 2.9
3100 { 'enum': 'QuorumReadPattern', 'data': [ 'quorum', 'fifo' ] }
3103 # @BlockdevOptionsQuorum:
3105 # Driver specific block device options for Quorum
3107 # @blkverify:      true if the driver must print content mismatch
3108 #                  set to false by default
3110 # @children:       the children block devices to use
3112 # @vote-threshold: the vote limit under which a read will fail
3114 # @rewrite-corrupted: rewrite corrupted data when quorum is reached
3115 #                     (Since 2.1)
3117 # @read-pattern: choose read pattern and set to quorum by default
3118 #                (Since 2.2)
3120 # Since: 2.9
3122 { 'struct': 'BlockdevOptionsQuorum',
3123   'data': { '*blkverify': 'bool',
3124             'children': [ 'BlockdevRef' ],
3125             'vote-threshold': 'int',
3126             '*rewrite-corrupted': 'bool',
3127             '*read-pattern': 'QuorumReadPattern' } }
3130 # @BlockdevOptionsGluster:
3132 # Driver specific block device options for Gluster
3134 # @volume:      name of gluster volume where VM image resides
3136 # @path:        absolute path to image file in gluster volume
3138 # @server:      gluster servers description
3140 # @debug:       libgfapi log level (default '4' which is Error)
3141 #               (Since 2.8)
3143 # @logfile:     libgfapi log file (default /dev/stderr) (Since 2.8)
3145 # Since: 2.9
3147 { 'struct': 'BlockdevOptionsGluster',
3148   'data': { 'volume': 'str',
3149             'path': 'str',
3150             'server': ['SocketAddress'],
3151             '*debug': 'int',
3152             '*logfile': 'str' } }
3155 # @IscsiTransport:
3157 # An enumeration of libiscsi transport types
3159 # Since: 2.9
3161 { 'enum': 'IscsiTransport',
3162   'data': [ 'tcp', 'iser' ] }
3165 # @IscsiHeaderDigest:
3167 # An enumeration of header digests supported by libiscsi
3169 # Since: 2.9
3171 { 'enum': 'IscsiHeaderDigest',
3172   'prefix': 'QAPI_ISCSI_HEADER_DIGEST',
3173   'data': [ 'crc32c', 'none', 'crc32c-none', 'none-crc32c' ] }
3176 # @BlockdevOptionsIscsi:
3178 # @transport:       The iscsi transport type
3180 # @portal:          The address of the iscsi portal
3182 # @target:          The target iqn name
3184 # @lun:             LUN to connect to. Defaults to 0.
3186 # @user:            User name to log in with. If omitted, no CHAP
3187 #                   authentication is performed.
3189 # @password-secret: The ID of a QCryptoSecret object providing
3190 #                   the password for the login. This option is required if
3191 #                   @user is specified.
3193 # @initiator-name:  The iqn name we want to identify to the target
3194 #                   as. If this option is not specified, an initiator name is
3195 #                   generated automatically.
3197 # @header-digest:   The desired header digest. Defaults to
3198 #                   none-crc32c.
3200 # @timeout:         Timeout in seconds after which a request will
3201 #                   timeout. 0 means no timeout and is the default.
3203 # Driver specific block device options for iscsi
3205 # Since: 2.9
3207 { 'struct': 'BlockdevOptionsIscsi',
3208   'data': { 'transport': 'IscsiTransport',
3209             'portal': 'str',
3210             'target': 'str',
3211             '*lun': 'int',
3212             '*user': 'str',
3213             '*password-secret': 'str',
3214             '*initiator-name': 'str',
3215             '*header-digest': 'IscsiHeaderDigest',
3216             '*timeout': 'int' } }
3220 # @RbdAuthMode:
3222 # Since: 3.0
3224 { 'enum': 'RbdAuthMode',
3225   'data': [ 'cephx', 'none' ] }
3228 # @BlockdevOptionsRbd:
3230 # @pool:               Ceph pool name.
3232 # @image:              Image name in the Ceph pool.
3234 # @conf:               path to Ceph configuration file.  Values
3235 #                      in the configuration file will be overridden by
3236 #                      options specified via QAPI.
3238 # @snapshot:           Ceph snapshot name.
3240 # @user:               Ceph id name.
3242 # @auth-client-required: Acceptable authentication modes.
3243 #                      This maps to Ceph configuration option
3244 #                      "auth_client_required".  (Since 3.0)
3246 # @key-secret:         ID of a QCryptoSecret object providing a key
3247 #                      for cephx authentication.
3248 #                      This maps to Ceph configuration option
3249 #                      "key".  (Since 3.0)
3251 # @server:             Monitor host address and port.  This maps
3252 #                      to the "mon_host" Ceph option.
3254 # Since: 2.9
3256 { 'struct': 'BlockdevOptionsRbd',
3257   'data': { 'pool': 'str',
3258             'image': 'str',
3259             '*conf': 'str',
3260             '*snapshot': 'str',
3261             '*user': 'str',
3262             '*auth-client-required': ['RbdAuthMode'],
3263             '*key-secret': 'str',
3264             '*server': ['InetSocketAddressBase'] } }
3267 # @BlockdevOptionsSheepdog:
3269 # Driver specific block device options for sheepdog
3271 # @vdi:         Virtual disk image name
3272 # @server:      The Sheepdog server to connect to
3273 # @snap-id:     Snapshot ID
3274 # @tag:         Snapshot tag name
3276 # Only one of @snap-id and @tag may be present.
3278 # Since: 2.9
3280 { 'struct': 'BlockdevOptionsSheepdog',
3281   'data': { 'server': 'SocketAddress',
3282             'vdi': 'str',
3283             '*snap-id': 'uint32',
3284             '*tag': 'str' } }
3287 # @ReplicationMode:
3289 # An enumeration of replication modes.
3291 # @primary: Primary mode, the vm's state will be sent to secondary QEMU.
3293 # @secondary: Secondary mode, receive the vm's state from primary QEMU.
3295 # Since: 2.9
3297 { 'enum' : 'ReplicationMode', 'data' : [ 'primary', 'secondary' ] }
3300 # @BlockdevOptionsReplication:
3302 # Driver specific block device options for replication
3304 # @mode: the replication mode
3306 # @top-id: In secondary mode, node name or device ID of the root
3307 #          node who owns the replication node chain. Must not be given in
3308 #          primary mode.
3310 # Since: 2.9
3312 { 'struct': 'BlockdevOptionsReplication',
3313   'base': 'BlockdevOptionsGenericFormat',
3314   'data': { 'mode': 'ReplicationMode',
3315             '*top-id': 'str' } }
3318 # @NFSTransport:
3320 # An enumeration of NFS transport types
3322 # @inet:        TCP transport
3324 # Since: 2.9
3326 { 'enum': 'NFSTransport',
3327   'data': [ 'inet' ] }
3330 # @NFSServer:
3332 # Captures the address of the socket
3334 # @type:        transport type used for NFS (only TCP supported)
3336 # @host:        host address for NFS server
3338 # Since: 2.9
3340 { 'struct': 'NFSServer',
3341   'data': { 'type': 'NFSTransport',
3342             'host': 'str' } }
3345 # @BlockdevOptionsNfs:
3347 # Driver specific block device option for NFS
3349 # @server:                  host address
3351 # @path:                    path of the image on the host
3353 # @user:                    UID value to use when talking to the
3354 #                           server (defaults to 65534 on Windows and getuid()
3355 #                           on unix)
3357 # @group:                   GID value to use when talking to the
3358 #                           server (defaults to 65534 on Windows and getgid()
3359 #                           in unix)
3361 # @tcp-syn-count:           number of SYNs during the session
3362 #                           establishment (defaults to libnfs default)
3364 # @readahead-size:          set the readahead size in bytes (defaults
3365 #                           to libnfs default)
3367 # @page-cache-size:         set the pagecache size in bytes (defaults
3368 #                           to libnfs default)
3370 # @debug:                   set the NFS debug level (max 2) (defaults
3371 #                           to libnfs default)
3373 # Since: 2.9
3375 { 'struct': 'BlockdevOptionsNfs',
3376   'data': { 'server': 'NFSServer',
3377             'path': 'str',
3378             '*user': 'int',
3379             '*group': 'int',
3380             '*tcp-syn-count': 'int',
3381             '*readahead-size': 'int',
3382             '*page-cache-size': 'int',
3383             '*debug': 'int' } }
3386 # @BlockdevOptionsCurlBase:
3388 # Driver specific block device options shared by all protocols supported by the
3389 # curl backend.
3391 # @url:                     URL of the image file
3393 # @readahead:               Size of the read-ahead cache; must be a multiple of
3394 #                           512 (defaults to 256 kB)
3396 # @timeout:                 Timeout for connections, in seconds (defaults to 5)
3398 # @username:                Username for authentication (defaults to none)
3400 # @password-secret:         ID of a QCryptoSecret object providing a password
3401 #                           for authentication (defaults to no password)
3403 # @proxy-username:          Username for proxy authentication (defaults to none)
3405 # @proxy-password-secret:   ID of a QCryptoSecret object providing a password
3406 #                           for proxy authentication (defaults to no password)
3408 # Since: 2.9
3410 { 'struct': 'BlockdevOptionsCurlBase',
3411   'data': { 'url': 'str',
3412             '*readahead': 'int',
3413             '*timeout': 'int',
3414             '*username': 'str',
3415             '*password-secret': 'str',
3416             '*proxy-username': 'str',
3417             '*proxy-password-secret': 'str' } }
3420 # @BlockdevOptionsCurlHttp:
3422 # Driver specific block device options for HTTP connections over the curl
3423 # backend.  URLs must start with "http://".
3425 # @cookie:      List of cookies to set; format is
3426 #               "name1=content1; name2=content2;" as explained by
3427 #               CURLOPT_COOKIE(3). Defaults to no cookies.
3429 # @cookie-secret: ID of a QCryptoSecret object providing the cookie data in a
3430 #                 secure way. See @cookie for the format. (since 2.10)
3432 # Since: 2.9
3434 { 'struct': 'BlockdevOptionsCurlHttp',
3435   'base': 'BlockdevOptionsCurlBase',
3436   'data': { '*cookie': 'str',
3437             '*cookie-secret': 'str'} }
3440 # @BlockdevOptionsCurlHttps:
3442 # Driver specific block device options for HTTPS connections over the curl
3443 # backend.  URLs must start with "https://".
3445 # @cookie:      List of cookies to set; format is
3446 #               "name1=content1; name2=content2;" as explained by
3447 #               CURLOPT_COOKIE(3). Defaults to no cookies.
3449 # @sslverify:   Whether to verify the SSL certificate's validity (defaults to
3450 #               true)
3452 # @cookie-secret: ID of a QCryptoSecret object providing the cookie data in a
3453 #                 secure way. See @cookie for the format. (since 2.10)
3455 # Since: 2.9
3457 { 'struct': 'BlockdevOptionsCurlHttps',
3458   'base': 'BlockdevOptionsCurlBase',
3459   'data': { '*cookie': 'str',
3460             '*sslverify': 'bool',
3461             '*cookie-secret': 'str'} }
3464 # @BlockdevOptionsCurlFtp:
3466 # Driver specific block device options for FTP connections over the curl
3467 # backend.  URLs must start with "ftp://".
3469 # Since: 2.9
3471 { 'struct': 'BlockdevOptionsCurlFtp',
3472   'base': 'BlockdevOptionsCurlBase',
3473   'data': { } }
3476 # @BlockdevOptionsCurlFtps:
3478 # Driver specific block device options for FTPS connections over the curl
3479 # backend.  URLs must start with "ftps://".
3481 # @sslverify:   Whether to verify the SSL certificate's validity (defaults to
3482 #               true)
3484 # Since: 2.9
3486 { 'struct': 'BlockdevOptionsCurlFtps',
3487   'base': 'BlockdevOptionsCurlBase',
3488   'data': { '*sslverify': 'bool' } }
3491 # @BlockdevOptionsNbd:
3493 # Driver specific block device options for NBD.
3495 # @server:      NBD server address
3497 # @export:      export name
3499 # @tls-creds:   TLS credentials ID
3501 # @x-dirty-bitmap: A "qemu:dirty-bitmap:NAME" string to query in place of
3502 #                  traditional "base:allocation" block status (see
3503 #                  NBD_OPT_LIST_META_CONTEXT in the NBD protocol) (since 3.0)
3505 # Since: 2.9
3507 { 'struct': 'BlockdevOptionsNbd',
3508   'data': { 'server': 'SocketAddress',
3509             '*export': 'str',
3510             '*tls-creds': 'str',
3511             '*x-dirty-bitmap': 'str' } }
3514 # @BlockdevOptionsRaw:
3516 # Driver specific block device options for the raw driver.
3518 # @offset:      position where the block device starts
3519 # @size:        the assumed size of the device
3521 # Since: 2.9
3523 { 'struct': 'BlockdevOptionsRaw',
3524   'base': 'BlockdevOptionsGenericFormat',
3525   'data': { '*offset': 'int', '*size': 'int' } }
3528 # @BlockdevOptionsVxHS:
3530 # Driver specific block device options for VxHS
3532 # @vdisk-id:    UUID of VxHS volume
3533 # @server:      vxhs server IP, port
3534 # @tls-creds:   TLS credentials ID
3536 # Since: 2.10
3538 { 'struct': 'BlockdevOptionsVxHS',
3539   'data': { 'vdisk-id': 'str',
3540             'server': 'InetSocketAddressBase',
3541             '*tls-creds': 'str' } }
3544 # @BlockdevOptionsThrottle:
3546 # Driver specific block device options for the throttle driver
3548 # @throttle-group:   the name of the throttle-group object to use. It
3549 #                    must already exist.
3550 # @file:             reference to or definition of the data source block device
3551 # Since: 2.11
3553 { 'struct': 'BlockdevOptionsThrottle',
3554   'data': { 'throttle-group': 'str',
3555             'file' : 'BlockdevRef'
3556              } }
3558 # @BlockdevOptions:
3560 # Options for creating a block device.  Many options are available for all
3561 # block devices, independent of the block driver:
3563 # @driver:        block driver name
3564 # @node-name:     the node name of the new node (Since 2.0).
3565 #                 This option is required on the top level of blockdev-add.
3566 # @discard:       discard-related options (default: ignore)
3567 # @cache:         cache-related options
3568 # @read-only:     whether the block device should be read-only (default: false).
3569 #                 Note that some block drivers support only read-only access,
3570 #                 either generally or in certain configurations. In this case,
3571 #                 the default value does not work and the option must be
3572 #                 specified explicitly.
3573 # @detect-zeroes: detect and optimize zero writes (Since 2.1)
3574 #                 (default: off)
3575 # @force-share:   force share all permission on added nodes.
3576 #                 Requires read-only=true. (Since 2.10)
3578 # Remaining options are determined by the block driver.
3580 # Since: 2.9
3582 { 'union': 'BlockdevOptions',
3583   'base': { 'driver': 'BlockdevDriver',
3584             '*node-name': 'str',
3585             '*discard': 'BlockdevDiscardOptions',
3586             '*cache': 'BlockdevCacheOptions',
3587             '*read-only': 'bool',
3588             '*force-share': 'bool',
3589             '*detect-zeroes': 'BlockdevDetectZeroesOptions' },
3590   'discriminator': 'driver',
3591   'data': {
3592       'blkdebug':   'BlockdevOptionsBlkdebug',
3593       'blklogwrites':'BlockdevOptionsBlklogwrites',
3594       'blkverify':  'BlockdevOptionsBlkverify',
3595       'bochs':      'BlockdevOptionsGenericFormat',
3596       'cloop':      'BlockdevOptionsGenericFormat',
3597       'copy-on-read':'BlockdevOptionsGenericFormat',
3598       'dmg':        'BlockdevOptionsGenericFormat',
3599       'file':       'BlockdevOptionsFile',
3600       'ftp':        'BlockdevOptionsCurlFtp',
3601       'ftps':       'BlockdevOptionsCurlFtps',
3602       'gluster':    'BlockdevOptionsGluster',
3603       'host_cdrom': 'BlockdevOptionsFile',
3604       'host_device':'BlockdevOptionsFile',
3605       'http':       'BlockdevOptionsCurlHttp',
3606       'https':      'BlockdevOptionsCurlHttps',
3607       'iscsi':      'BlockdevOptionsIscsi',
3608       'luks':       'BlockdevOptionsLUKS',
3609       'nbd':        'BlockdevOptionsNbd',
3610       'nfs':        'BlockdevOptionsNfs',
3611       'null-aio':   'BlockdevOptionsNull',
3612       'null-co':    'BlockdevOptionsNull',
3613       'nvme':       'BlockdevOptionsNVMe',
3614       'parallels':  'BlockdevOptionsGenericFormat',
3615       'qcow2':      'BlockdevOptionsQcow2',
3616       'qcow':       'BlockdevOptionsQcow',
3617       'qed':        'BlockdevOptionsGenericCOWFormat',
3618       'quorum':     'BlockdevOptionsQuorum',
3619       'raw':        'BlockdevOptionsRaw',
3620       'rbd':        'BlockdevOptionsRbd',
3621       'replication':'BlockdevOptionsReplication',
3622       'sheepdog':   'BlockdevOptionsSheepdog',
3623       'ssh':        'BlockdevOptionsSsh',
3624       'throttle':   'BlockdevOptionsThrottle',
3625       'vdi':        'BlockdevOptionsGenericFormat',
3626       'vhdx':       'BlockdevOptionsGenericFormat',
3627       'vmdk':       'BlockdevOptionsGenericCOWFormat',
3628       'vpc':        'BlockdevOptionsGenericFormat',
3629       'vvfat':      'BlockdevOptionsVVFAT',
3630       'vxhs':       'BlockdevOptionsVxHS'
3631   } }
3634 # @BlockdevRef:
3636 # Reference to a block device.
3638 # @definition:      defines a new block device inline
3639 # @reference:       references the ID of an existing block device
3641 # Since: 2.9
3643 { 'alternate': 'BlockdevRef',
3644   'data': { 'definition': 'BlockdevOptions',
3645             'reference': 'str' } }
3648 # @BlockdevRefOrNull:
3650 # Reference to a block device.
3652 # @definition:      defines a new block device inline
3653 # @reference:       references the ID of an existing block device.
3654 #                   An empty string means that no block device should
3655 #                   be referenced.  Deprecated; use null instead.
3656 # @null:            No block device should be referenced (since 2.10)
3658 # Since: 2.9
3660 { 'alternate': 'BlockdevRefOrNull',
3661   'data': { 'definition': 'BlockdevOptions',
3662             'reference': 'str',
3663             'null': 'null' } }
3666 # @blockdev-add:
3668 # Creates a new block device. If the @id option is given at the top level, a
3669 # BlockBackend will be created; otherwise, @node-name is mandatory at the top
3670 # level and no BlockBackend will be created.
3672 # Since: 2.9
3674 # Example:
3676 # 1.
3677 # -> { "execute": "blockdev-add",
3678 #      "arguments": {
3679 #           "driver": "qcow2",
3680 #           "node-name": "test1",
3681 #           "file": {
3682 #               "driver": "file",
3683 #               "filename": "test.qcow2"
3684 #            }
3685 #       }
3686 #     }
3687 # <- { "return": {} }
3689 # 2.
3690 # -> { "execute": "blockdev-add",
3691 #      "arguments": {
3692 #           "driver": "qcow2",
3693 #           "node-name": "node0",
3694 #           "discard": "unmap",
3695 #           "cache": {
3696 #              "direct": true
3697 #            },
3698 #            "file": {
3699 #              "driver": "file",
3700 #              "filename": "/tmp/test.qcow2"
3701 #            },
3702 #            "backing": {
3703 #               "driver": "raw",
3704 #               "file": {
3705 #                  "driver": "file",
3706 #                  "filename": "/dev/fdset/4"
3707 #                }
3708 #            }
3709 #        }
3710 #      }
3712 # <- { "return": {} }
3715 { 'command': 'blockdev-add', 'data': 'BlockdevOptions', 'boxed': true }
3718 # @blockdev-del:
3720 # Deletes a block device that has been added using blockdev-add.
3721 # The command will fail if the node is attached to a device or is
3722 # otherwise being used.
3724 # @node-name: Name of the graph node to delete.
3726 # Since: 2.9
3728 # Example:
3730 # -> { "execute": "blockdev-add",
3731 #      "arguments": {
3732 #           "driver": "qcow2",
3733 #           "node-name": "node0",
3734 #           "file": {
3735 #               "driver": "file",
3736 #               "filename": "test.qcow2"
3737 #           }
3738 #      }
3739 #    }
3740 # <- { "return": {} }
3742 # -> { "execute": "blockdev-del",
3743 #      "arguments": { "node-name": "node0" }
3744 #    }
3745 # <- { "return": {} }
3748 { 'command': 'blockdev-del', 'data': { 'node-name': 'str' } }
3751 # @BlockdevCreateOptionsFile:
3753 # Driver specific image creation options for file.
3755 # @filename         Filename for the new image file
3756 # @size             Size of the virtual disk in bytes
3757 # @preallocation    Preallocation mode for the new image (default: off)
3758 # @nocow            Turn off copy-on-write (valid only on btrfs; default: off)
3760 # Since: 2.12
3762 { 'struct': 'BlockdevCreateOptionsFile',
3763   'data': { 'filename':         'str',
3764             'size':             'size',
3765             '*preallocation':   'PreallocMode',
3766             '*nocow':           'bool' } }
3769 # @BlockdevCreateOptionsGluster:
3771 # Driver specific image creation options for gluster.
3773 # @location         Where to store the new image file
3774 # @size             Size of the virtual disk in bytes
3775 # @preallocation    Preallocation mode for the new image (default: off)
3777 # Since: 2.12
3779 { 'struct': 'BlockdevCreateOptionsGluster',
3780   'data': { 'location':         'BlockdevOptionsGluster',
3781             'size':             'size',
3782             '*preallocation':   'PreallocMode' } }
3785 # @BlockdevCreateOptionsLUKS:
3787 # Driver specific image creation options for LUKS.
3789 # @file             Node to create the image format on
3790 # @size             Size of the virtual disk in bytes
3792 # Since: 2.12
3794 { 'struct': 'BlockdevCreateOptionsLUKS',
3795   'base': 'QCryptoBlockCreateOptionsLUKS',
3796   'data': { 'file':             'BlockdevRef',
3797             'size':             'size' } }
3800 # @BlockdevCreateOptionsNfs:
3802 # Driver specific image creation options for NFS.
3804 # @location         Where to store the new image file
3805 # @size             Size of the virtual disk in bytes
3807 # Since: 2.12
3809 { 'struct': 'BlockdevCreateOptionsNfs',
3810   'data': { 'location':         'BlockdevOptionsNfs',
3811             'size':             'size' } }
3814 # @BlockdevCreateOptionsParallels:
3816 # Driver specific image creation options for parallels.
3818 # @file             Node to create the image format on
3819 # @size             Size of the virtual disk in bytes
3820 # @cluster-size     Cluster size in bytes (default: 1 MB)
3822 # Since: 2.12
3824 { 'struct': 'BlockdevCreateOptionsParallels',
3825   'data': { 'file':             'BlockdevRef',
3826             'size':             'size',
3827             '*cluster-size':    'size' } }
3830 # @BlockdevCreateOptionsQcow:
3832 # Driver specific image creation options for qcow.
3834 # @file             Node to create the image format on
3835 # @size             Size of the virtual disk in bytes
3836 # @backing-file     File name of the backing file if a backing file
3837 #                   should be used
3838 # @encrypt          Encryption options if the image should be encrypted
3840 # Since: 2.12
3842 { 'struct': 'BlockdevCreateOptionsQcow',
3843   'data': { 'file':             'BlockdevRef',
3844             'size':             'size',
3845             '*backing-file':    'str',
3846             '*encrypt':         'QCryptoBlockCreateOptions' } }
3849 # @BlockdevQcow2Version:
3851 # @v2:  The original QCOW2 format as introduced in qemu 0.10 (version 2)
3852 # @v3:  The extended QCOW2 format as introduced in qemu 1.1 (version 3)
3854 # Since: 2.12
3856 { 'enum': 'BlockdevQcow2Version',
3857   'data': [ 'v2', 'v3' ] }
3861 # @BlockdevCreateOptionsQcow2:
3863 # Driver specific image creation options for qcow2.
3865 # @file             Node to create the image format on
3866 # @size             Size of the virtual disk in bytes
3867 # @version          Compatibility level (default: v3)
3868 # @backing-file     File name of the backing file if a backing file
3869 #                   should be used
3870 # @backing-fmt      Name of the block driver to use for the backing file
3871 # @encrypt          Encryption options if the image should be encrypted
3872 # @cluster-size     qcow2 cluster size in bytes (default: 65536)
3873 # @preallocation    Preallocation mode for the new image (default: off)
3874 # @lazy-refcounts   True if refcounts may be updated lazily (default: off)
3875 # @refcount-bits    Width of reference counts in bits (default: 16)
3877 # Since: 2.12
3879 { 'struct': 'BlockdevCreateOptionsQcow2',
3880   'data': { 'file':             'BlockdevRef',
3881             'size':             'size',
3882             '*version':         'BlockdevQcow2Version',
3883             '*backing-file':    'str',
3884             '*backing-fmt':     'BlockdevDriver',
3885             '*encrypt':         'QCryptoBlockCreateOptions',
3886             '*cluster-size':    'size',
3887             '*preallocation':   'PreallocMode',
3888             '*lazy-refcounts':  'bool',
3889             '*refcount-bits':   'int' } }
3892 # @BlockdevCreateOptionsQed:
3894 # Driver specific image creation options for qed.
3896 # @file             Node to create the image format on
3897 # @size             Size of the virtual disk in bytes
3898 # @backing-file     File name of the backing file if a backing file
3899 #                   should be used
3900 # @backing-fmt      Name of the block driver to use for the backing file
3901 # @cluster-size     Cluster size in bytes (default: 65536)
3902 # @table-size       L1/L2 table size (in clusters)
3904 # Since: 2.12
3906 { 'struct': 'BlockdevCreateOptionsQed',
3907   'data': { 'file':             'BlockdevRef',
3908             'size':             'size',
3909             '*backing-file':    'str',
3910             '*backing-fmt':     'BlockdevDriver',
3911             '*cluster-size':    'size',
3912             '*table-size':      'int' } }
3915 # @BlockdevCreateOptionsRbd:
3917 # Driver specific image creation options for rbd/Ceph.
3919 # @location         Where to store the new image file. This location cannot
3920 #                   point to a snapshot.
3921 # @size             Size of the virtual disk in bytes
3922 # @cluster-size     RBD object size
3924 # Since: 2.12
3926 { 'struct': 'BlockdevCreateOptionsRbd',
3927   'data': { 'location':         'BlockdevOptionsRbd',
3928             'size':             'size',
3929             '*cluster-size' :   'size' } }
3932 # @SheepdogRedundancyType:
3934 # @full             Create a fully replicated vdi with x copies
3935 # @erasure-coded    Create an erasure coded vdi with x data strips and
3936 #                   y parity strips
3938 # Since: 2.12
3940 { 'enum': 'SheepdogRedundancyType',
3941   'data': [ 'full', 'erasure-coded' ] }
3944 # @SheepdogRedundancyFull:
3946 # @copies           Number of copies to use (between 1 and 31)
3948 # Since: 2.12
3950 { 'struct': 'SheepdogRedundancyFull',
3951   'data': { 'copies': 'int' }}
3954 # @SheepdogRedundancyErasureCoded:
3956 # @data-strips      Number of data strips to use (one of {2,4,8,16})
3957 # @parity-strips    Number of parity strips to use (between 1 and 15)
3959 # Since: 2.12
3961 { 'struct': 'SheepdogRedundancyErasureCoded',
3962   'data': { 'data-strips': 'int',
3963             'parity-strips': 'int' }}
3966 # @SheepdogRedundancy:
3968 # Since: 2.12
3970 { 'union': 'SheepdogRedundancy',
3971   'base': { 'type': 'SheepdogRedundancyType' },
3972   'discriminator': 'type',
3973   'data': { 'full': 'SheepdogRedundancyFull',
3974             'erasure-coded': 'SheepdogRedundancyErasureCoded' } }
3977 # @BlockdevCreateOptionsSheepdog:
3979 # Driver specific image creation options for Sheepdog.
3981 # @location         Where to store the new image file
3982 # @size             Size of the virtual disk in bytes
3983 # @backing-file     File name of a base image
3984 # @preallocation    Preallocation mode (allowed values: off, full)
3985 # @redundancy       Redundancy of the image
3986 # @object-size      Object size of the image
3988 # Since: 2.12
3990 { 'struct': 'BlockdevCreateOptionsSheepdog',
3991   'data': { 'location':         'BlockdevOptionsSheepdog',
3992             'size':             'size',
3993             '*backing-file':    'str',
3994             '*preallocation':   'PreallocMode',
3995             '*redundancy':      'SheepdogRedundancy',
3996             '*object-size':     'size' } }
3999 # @BlockdevCreateOptionsSsh:
4001 # Driver specific image creation options for SSH.
4003 # @location         Where to store the new image file
4004 # @size             Size of the virtual disk in bytes
4006 # Since: 2.12
4008 { 'struct': 'BlockdevCreateOptionsSsh',
4009   'data': { 'location':         'BlockdevOptionsSsh',
4010             'size':             'size' } }
4013 # @BlockdevCreateOptionsVdi:
4015 # Driver specific image creation options for VDI.
4017 # @file             Node to create the image format on
4018 # @size             Size of the virtual disk in bytes
4019 # @preallocation    Preallocation mode for the new image (allowed values: off,
4020 #                   metadata; default: off)
4022 # Since: 2.12
4024 { 'struct': 'BlockdevCreateOptionsVdi',
4025   'data': { 'file':             'BlockdevRef',
4026             'size':             'size',
4027             '*preallocation':   'PreallocMode' } }
4030 # @BlockdevVhdxSubformat:
4032 # @dynamic: Growing image file
4033 # @fixed:   Preallocated fixed-size image file
4035 # Since: 2.12
4037 { 'enum': 'BlockdevVhdxSubformat',
4038   'data': [ 'dynamic', 'fixed' ] }
4041 # @BlockdevCreateOptionsVhdx:
4043 # Driver specific image creation options for vhdx.
4045 # @file             Node to create the image format on
4046 # @size             Size of the virtual disk in bytes
4047 # @log-size         Log size in bytes, must be a multiple of 1 MB
4048 #                   (default: 1 MB)
4049 # @block-size       Block size in bytes, must be a multiple of 1 MB and not
4050 #                   larger than 256 MB (default: automatically choose a block
4051 #                   size depending on the image size)
4052 # @subformat        vhdx subformat (default: dynamic)
4053 # @block-state-zero Force use of payload blocks of type 'ZERO'. Non-standard,
4054 #                   but default.  Do not set to 'off' when using 'qemu-img
4055 #                   convert' with subformat=dynamic.
4057 # Since: 2.12
4059 { 'struct': 'BlockdevCreateOptionsVhdx',
4060   'data': { 'file':                 'BlockdevRef',
4061             'size':                 'size',
4062             '*log-size':            'size',
4063             '*block-size':          'size',
4064             '*subformat':           'BlockdevVhdxSubformat',
4065             '*block-state-zero':    'bool' } }
4068 # @BlockdevVpcSubformat:
4070 # @dynamic: Growing image file
4071 # @fixed:   Preallocated fixed-size image file
4073 # Since: 2.12
4075 { 'enum': 'BlockdevVpcSubformat',
4076   'data': [ 'dynamic', 'fixed' ] }
4079 # @BlockdevCreateOptionsVpc:
4081 # Driver specific image creation options for vpc (VHD).
4083 # @file             Node to create the image format on
4084 # @size             Size of the virtual disk in bytes
4085 # @subformat        vhdx subformat (default: dynamic)
4086 # @force-size       Force use of the exact byte size instead of rounding to the
4087 #                   next size that can be represented in CHS geometry
4088 #                   (default: false)
4090 # Since: 2.12
4092 { 'struct': 'BlockdevCreateOptionsVpc',
4093   'data': { 'file':                 'BlockdevRef',
4094             'size':                 'size',
4095             '*subformat':           'BlockdevVpcSubformat',
4096             '*force-size':          'bool' } }
4099 # @BlockdevCreateOptions:
4101 # Options for creating an image format on a given node.
4103 # @driver           block driver to create the image format
4105 # Since: 2.12
4107 { 'union': 'BlockdevCreateOptions',
4108   'base': {
4109       'driver':         'BlockdevDriver' },
4110   'discriminator': 'driver',
4111   'data': {
4112       'file':           'BlockdevCreateOptionsFile',
4113       'gluster':        'BlockdevCreateOptionsGluster',
4114       'luks':           'BlockdevCreateOptionsLUKS',
4115       'nfs':            'BlockdevCreateOptionsNfs',
4116       'parallels':      'BlockdevCreateOptionsParallels',
4117       'qcow':           'BlockdevCreateOptionsQcow',
4118       'qcow2':          'BlockdevCreateOptionsQcow2',
4119       'qed':            'BlockdevCreateOptionsQed',
4120       'rbd':            'BlockdevCreateOptionsRbd',
4121       'sheepdog':       'BlockdevCreateOptionsSheepdog',
4122       'ssh':            'BlockdevCreateOptionsSsh',
4123       'vdi':            'BlockdevCreateOptionsVdi',
4124       'vhdx':           'BlockdevCreateOptionsVhdx',
4125       'vpc':            'BlockdevCreateOptionsVpc'
4126   } }
4129 # @blockdev-create:
4131 # Starts a job to create an image format on a given node. The job is
4132 # automatically finalized, but a manual job-dismiss is required.
4134 # @job-id:          Identifier for the newly created job.
4136 # @options:         Options for the image creation.
4138 # Since: 3.0
4140 { 'command': 'blockdev-create',
4141   'data': { 'job-id': 'str',
4142             'options': 'BlockdevCreateOptions' } }
4145 # @blockdev-open-tray:
4147 # Opens a block device's tray. If there is a block driver state tree inserted as
4148 # a medium, it will become inaccessible to the guest (but it will remain
4149 # associated to the block device, so closing the tray will make it accessible
4150 # again).
4152 # If the tray was already open before, this will be a no-op.
4154 # Once the tray opens, a DEVICE_TRAY_MOVED event is emitted. There are cases in
4155 # which no such event will be generated, these include:
4156 # - if the guest has locked the tray, @force is false and the guest does not
4157 #   respond to the eject request
4158 # - if the BlockBackend denoted by @device does not have a guest device attached
4159 #   to it
4160 # - if the guest device does not have an actual tray
4162 # @device: Block device name (deprecated, use @id instead)
4164 # @id:     The name or QOM path of the guest device (since: 2.8)
4166 # @force:  if false (the default), an eject request will be sent to
4167 #          the guest if it has locked the tray (and the tray will not be opened
4168 #          immediately); if true, the tray will be opened regardless of whether
4169 #          it is locked
4171 # Since: 2.5
4173 # Example:
4175 # -> { "execute": "blockdev-open-tray",
4176 #      "arguments": { "id": "ide0-1-0" } }
4178 # <- { "timestamp": { "seconds": 1418751016,
4179 #                     "microseconds": 716996 },
4180 #      "event": "DEVICE_TRAY_MOVED",
4181 #      "data": { "device": "ide1-cd0",
4182 #                "id": "ide0-1-0",
4183 #                "tray-open": true } }
4185 # <- { "return": {} }
4188 { 'command': 'blockdev-open-tray',
4189   'data': { '*device': 'str',
4190             '*id': 'str',
4191             '*force': 'bool' } }
4194 # @blockdev-close-tray:
4196 # Closes a block device's tray. If there is a block driver state tree associated
4197 # with the block device (which is currently ejected), that tree will be loaded
4198 # as the medium.
4200 # If the tray was already closed before, this will be a no-op.
4202 # @device:  Block device name (deprecated, use @id instead)
4204 # @id:      The name or QOM path of the guest device (since: 2.8)
4206 # Since: 2.5
4208 # Example:
4210 # -> { "execute": "blockdev-close-tray",
4211 #      "arguments": { "id": "ide0-1-0" } }
4213 # <- { "timestamp": { "seconds": 1418751345,
4214 #                     "microseconds": 272147 },
4215 #      "event": "DEVICE_TRAY_MOVED",
4216 #      "data": { "device": "ide1-cd0",
4217 #                "id": "ide0-1-0",
4218 #                "tray-open": false } }
4220 # <- { "return": {} }
4223 { 'command': 'blockdev-close-tray',
4224   'data': { '*device': 'str',
4225             '*id': 'str' } }
4228 # @blockdev-remove-medium:
4230 # Removes a medium (a block driver state tree) from a block device. That block
4231 # device's tray must currently be open (unless there is no attached guest
4232 # device).
4234 # If the tray is open and there is no medium inserted, this will be a no-op.
4236 # @id:     The name or QOM path of the guest device
4238 # Since: 2.12
4240 # Example:
4242 # -> { "execute": "blockdev-remove-medium",
4243 #      "arguments": { "id": "ide0-1-0" } }
4245 # <- { "error": { "class": "GenericError",
4246 #                 "desc": "Tray of device 'ide0-1-0' is not open" } }
4248 # -> { "execute": "blockdev-open-tray",
4249 #      "arguments": { "id": "ide0-1-0" } }
4251 # <- { "timestamp": { "seconds": 1418751627,
4252 #                     "microseconds": 549958 },
4253 #      "event": "DEVICE_TRAY_MOVED",
4254 #      "data": { "device": "ide1-cd0",
4255 #                "id": "ide0-1-0",
4256 #                "tray-open": true } }
4258 # <- { "return": {} }
4260 # -> { "execute": "blockdev-remove-medium",
4261 #      "arguments": { "id": "ide0-1-0" } }
4263 # <- { "return": {} }
4266 { 'command': 'blockdev-remove-medium',
4267   'data': { 'id': 'str' } }
4270 # @blockdev-insert-medium:
4272 # Inserts a medium (a block driver state tree) into a block device. That block
4273 # device's tray must currently be open (unless there is no attached guest
4274 # device) and there must be no medium inserted already.
4276 # @id:        The name or QOM path of the guest device
4278 # @node-name: name of a node in the block driver state graph
4280 # Since: 2.12
4282 # Example:
4284 # -> { "execute": "blockdev-add",
4285 #      "arguments": {
4286 #          "node-name": "node0",
4287 #          "driver": "raw",
4288 #          "file": { "driver": "file",
4289 #                    "filename": "fedora.iso" } } }
4290 # <- { "return": {} }
4292 # -> { "execute": "blockdev-insert-medium",
4293 #      "arguments": { "id": "ide0-1-0",
4294 #                     "node-name": "node0" } }
4296 # <- { "return": {} }
4299 { 'command': 'blockdev-insert-medium',
4300   'data': { 'id': 'str',
4301             'node-name': 'str'} }
4305 # @BlockdevChangeReadOnlyMode:
4307 # Specifies the new read-only mode of a block device subject to the
4308 # @blockdev-change-medium command.
4310 # @retain:      Retains the current read-only mode
4312 # @read-only:   Makes the device read-only
4314 # @read-write:  Makes the device writable
4316 # Since: 2.3
4319 { 'enum': 'BlockdevChangeReadOnlyMode',
4320   'data': ['retain', 'read-only', 'read-write'] }
4324 # @blockdev-change-medium:
4326 # Changes the medium inserted into a block device by ejecting the current medium
4327 # and loading a new image file which is inserted as the new medium (this command
4328 # combines blockdev-open-tray, blockdev-remove-medium, blockdev-insert-medium
4329 # and blockdev-close-tray).
4331 # @device:          Block device name (deprecated, use @id instead)
4333 # @id:              The name or QOM path of the guest device
4334 #                   (since: 2.8)
4336 # @filename:        filename of the new image to be loaded
4338 # @format:          format to open the new image with (defaults to
4339 #                   the probed format)
4341 # @read-only-mode:  change the read-only mode of the device; defaults
4342 #                   to 'retain'
4344 # Since: 2.5
4346 # Examples:
4348 # 1. Change a removable medium
4350 # -> { "execute": "blockdev-change-medium",
4351 #      "arguments": { "id": "ide0-1-0",
4352 #                     "filename": "/srv/images/Fedora-12-x86_64-DVD.iso",
4353 #                     "format": "raw" } }
4354 # <- { "return": {} }
4356 # 2. Load a read-only medium into a writable drive
4358 # -> { "execute": "blockdev-change-medium",
4359 #      "arguments": { "id": "floppyA",
4360 #                     "filename": "/srv/images/ro.img",
4361 #                     "format": "raw",
4362 #                     "read-only-mode": "retain" } }
4364 # <- { "error":
4365 #      { "class": "GenericError",
4366 #        "desc": "Could not open '/srv/images/ro.img': Permission denied" } }
4368 # -> { "execute": "blockdev-change-medium",
4369 #      "arguments": { "id": "floppyA",
4370 #                     "filename": "/srv/images/ro.img",
4371 #                     "format": "raw",
4372 #                     "read-only-mode": "read-only" } }
4374 # <- { "return": {} }
4377 { 'command': 'blockdev-change-medium',
4378   'data': { '*device': 'str',
4379             '*id': 'str',
4380             'filename': 'str',
4381             '*format': 'str',
4382             '*read-only-mode': 'BlockdevChangeReadOnlyMode' } }
4386 # @BlockErrorAction:
4388 # An enumeration of action that has been taken when a DISK I/O occurs
4390 # @ignore: error has been ignored
4392 # @report: error has been reported to the device
4394 # @stop: error caused VM to be stopped
4396 # Since: 2.1
4398 { 'enum': 'BlockErrorAction',
4399   'data': [ 'ignore', 'report', 'stop' ] }
4403 # @BLOCK_IMAGE_CORRUPTED:
4405 # Emitted when a disk image is being marked corrupt. The image can be
4406 # identified by its device or node name. The 'device' field is always
4407 # present for compatibility reasons, but it can be empty ("") if the
4408 # image does not have a device name associated.
4410 # @device: device name. This is always present for compatibility
4411 #          reasons, but it can be empty ("") if the image does not
4412 #          have a device name associated.
4414 # @node-name: node name (Since: 2.4)
4416 # @msg: informative message for human consumption, such as the kind of
4417 #       corruption being detected. It should not be parsed by machine as it is
4418 #       not guaranteed to be stable
4420 # @offset: if the corruption resulted from an image access, this is
4421 #          the host's access offset into the image
4423 # @size: if the corruption resulted from an image access, this is
4424 #        the access size
4426 # @fatal: if set, the image is marked corrupt and therefore unusable after this
4427 #        event and must be repaired (Since 2.2; before, every
4428 #        BLOCK_IMAGE_CORRUPTED event was fatal)
4430 # Note: If action is "stop", a STOP event will eventually follow the
4431 #       BLOCK_IO_ERROR event.
4433 # Example:
4435 # <- { "event": "BLOCK_IMAGE_CORRUPTED",
4436 #      "data": { "device": "ide0-hd0", "node-name": "node0",
4437 #                "msg": "Prevented active L1 table overwrite", "offset": 196608,
4438 #                "size": 65536 },
4439 #      "timestamp": { "seconds": 1378126126, "microseconds": 966463 } }
4441 # Since: 1.7
4443 { 'event': 'BLOCK_IMAGE_CORRUPTED',
4444   'data': { 'device'     : 'str',
4445             '*node-name' : 'str',
4446             'msg'        : 'str',
4447             '*offset'    : 'int',
4448             '*size'      : 'int',
4449             'fatal'      : 'bool' } }
4452 # @BLOCK_IO_ERROR:
4454 # Emitted when a disk I/O error occurs
4456 # @device: device name. This is always present for compatibility
4457 #          reasons, but it can be empty ("") if the image does not
4458 #          have a device name associated.
4460 # @node-name: node name. Note that errors may be reported for the root node
4461 #             that is directly attached to a guest device rather than for the
4462 #             node where the error occurred. The node name is not present if
4463 #             the drive is empty. (Since: 2.8)
4465 # @operation: I/O operation
4467 # @action: action that has been taken
4469 # @nospace: true if I/O error was caused due to a no-space
4470 #           condition. This key is only present if query-block's
4471 #           io-status is present, please see query-block documentation
4472 #           for more information (since: 2.2)
4474 # @reason: human readable string describing the error cause.
4475 #          (This field is a debugging aid for humans, it should not
4476 #           be parsed by applications) (since: 2.2)
4478 # Note: If action is "stop", a STOP event will eventually follow the
4479 # BLOCK_IO_ERROR event
4481 # Since: 0.13.0
4483 # Example:
4485 # <- { "event": "BLOCK_IO_ERROR",
4486 #      "data": { "device": "ide0-hd1",
4487 #                "node-name": "#block212",
4488 #                "operation": "write",
4489 #                "action": "stop" },
4490 #      "timestamp": { "seconds": 1265044230, "microseconds": 450486 } }
4493 { 'event': 'BLOCK_IO_ERROR',
4494   'data': { 'device': 'str', '*node-name': 'str',
4495             'operation': 'IoOperationType',
4496             'action': 'BlockErrorAction', '*nospace': 'bool',
4497             'reason': 'str' } }
4500 # @BLOCK_JOB_COMPLETED:
4502 # Emitted when a block job has completed
4504 # @type: job type
4506 # @device: The job identifier. Originally the device name but other
4507 #          values are allowed since QEMU 2.7
4509 # @len: maximum progress value
4511 # @offset: current progress value. On success this is equal to len.
4512 #          On failure this is less than len
4514 # @speed: rate limit, bytes per second
4516 # @error: error message. Only present on failure. This field
4517 #         contains a human-readable error message. There are no semantics
4518 #         other than that streaming has failed and clients should not try to
4519 #         interpret the error string
4521 # Since: 1.1
4523 # Example:
4525 # <- { "event": "BLOCK_JOB_COMPLETED",
4526 #      "data": { "type": "stream", "device": "virtio-disk0",
4527 #                "len": 10737418240, "offset": 10737418240,
4528 #                "speed": 0 },
4529 #      "timestamp": { "seconds": 1267061043, "microseconds": 959568 } }
4532 { 'event': 'BLOCK_JOB_COMPLETED',
4533   'data': { 'type'  : 'JobType',
4534             'device': 'str',
4535             'len'   : 'int',
4536             'offset': 'int',
4537             'speed' : 'int',
4538             '*error': 'str' } }
4541 # @BLOCK_JOB_CANCELLED:
4543 # Emitted when a block job has been cancelled
4545 # @type: job type
4547 # @device: The job identifier. Originally the device name but other
4548 #          values are allowed since QEMU 2.7
4550 # @len: maximum progress value
4552 # @offset: current progress value. On success this is equal to len.
4553 #          On failure this is less than len
4555 # @speed: rate limit, bytes per second
4557 # Since: 1.1
4559 # Example:
4561 # <- { "event": "BLOCK_JOB_CANCELLED",
4562 #      "data": { "type": "stream", "device": "virtio-disk0",
4563 #                "len": 10737418240, "offset": 134217728,
4564 #                "speed": 0 },
4565 #      "timestamp": { "seconds": 1267061043, "microseconds": 959568 } }
4568 { 'event': 'BLOCK_JOB_CANCELLED',
4569   'data': { 'type'  : 'JobType',
4570             'device': 'str',
4571             'len'   : 'int',
4572             'offset': 'int',
4573             'speed' : 'int' } }
4576 # @BLOCK_JOB_ERROR:
4578 # Emitted when a block job encounters an error
4580 # @device: The job identifier. Originally the device name but other
4581 #          values are allowed since QEMU 2.7
4583 # @operation: I/O operation
4585 # @action: action that has been taken
4587 # Since: 1.3
4589 # Example:
4591 # <- { "event": "BLOCK_JOB_ERROR",
4592 #      "data": { "device": "ide0-hd1",
4593 #                "operation": "write",
4594 #                "action": "stop" },
4595 #      "timestamp": { "seconds": 1265044230, "microseconds": 450486 } }
4598 { 'event': 'BLOCK_JOB_ERROR',
4599   'data': { 'device'   : 'str',
4600             'operation': 'IoOperationType',
4601             'action'   : 'BlockErrorAction' } }
4604 # @BLOCK_JOB_READY:
4606 # Emitted when a block job is ready to complete
4608 # @type: job type
4610 # @device: The job identifier. Originally the device name but other
4611 #          values are allowed since QEMU 2.7
4613 # @len: maximum progress value
4615 # @offset: current progress value. On success this is equal to len.
4616 #          On failure this is less than len
4618 # @speed: rate limit, bytes per second
4620 # Note: The "ready to complete" status is always reset by a @BLOCK_JOB_ERROR
4621 # event
4623 # Since: 1.3
4625 # Example:
4627 # <- { "event": "BLOCK_JOB_READY",
4628 #      "data": { "device": "drive0", "type": "mirror", "speed": 0,
4629 #                "len": 2097152, "offset": 2097152 }
4630 #      "timestamp": { "seconds": 1265044230, "microseconds": 450486 } }
4633 { 'event': 'BLOCK_JOB_READY',
4634   'data': { 'type'  : 'JobType',
4635             'device': 'str',
4636             'len'   : 'int',
4637             'offset': 'int',
4638             'speed' : 'int' } }
4641 # @BLOCK_JOB_PENDING:
4643 # Emitted when a block job is awaiting explicit authorization to finalize graph
4644 # changes via @block-job-finalize. If this job is part of a transaction, it will
4645 # not emit this event until the transaction has converged first.
4647 # @type: job type
4649 # @id: The job identifier.
4651 # Since: 2.12
4653 # Example:
4655 # <- { "event": "BLOCK_JOB_WAITING",
4656 #      "data": { "device": "drive0", "type": "mirror" },
4657 #      "timestamp": { "seconds": 1265044230, "microseconds": 450486 } }
4660 { 'event': 'BLOCK_JOB_PENDING',
4661   'data': { 'type'  : 'JobType',
4662             'id'    : 'str' } }
4665 # @PreallocMode:
4667 # Preallocation mode of QEMU image file
4669 # @off: no preallocation
4670 # @metadata: preallocate only for metadata
4671 # @falloc: like @full preallocation but allocate disk space by
4672 #          posix_fallocate() rather than writing zeros.
4673 # @full: preallocate all data by writing zeros to device to ensure disk
4674 #        space is really available. @full preallocation also sets up
4675 #        metadata correctly.
4677 # Since: 2.2
4679 { 'enum': 'PreallocMode',
4680   'data': [ 'off', 'metadata', 'falloc', 'full' ] }
4683 # @BLOCK_WRITE_THRESHOLD:
4685 # Emitted when writes on block device reaches or exceeds the
4686 # configured write threshold. For thin-provisioned devices, this
4687 # means the device should be extended to avoid pausing for
4688 # disk exhaustion.
4689 # The event is one shot. Once triggered, it needs to be
4690 # re-registered with another block-set-write-threshold command.
4692 # @node-name: graph node name on which the threshold was exceeded.
4694 # @amount-exceeded: amount of data which exceeded the threshold, in bytes.
4696 # @write-threshold: last configured threshold, in bytes.
4698 # Since: 2.3
4700 { 'event': 'BLOCK_WRITE_THRESHOLD',
4701   'data': { 'node-name': 'str',
4702             'amount-exceeded': 'uint64',
4703             'write-threshold': 'uint64' } }
4706 # @block-set-write-threshold:
4708 # Change the write threshold for a block drive. An event will be
4709 # delivered if a write to this block drive crosses the configured
4710 # threshold.  The threshold is an offset, thus must be
4711 # non-negative. Default is no write threshold. Setting the threshold
4712 # to zero disables it.
4714 # This is useful to transparently resize thin-provisioned drives without
4715 # the guest OS noticing.
4717 # @node-name: graph node name on which the threshold must be set.
4719 # @write-threshold: configured threshold for the block device, bytes.
4720 #                   Use 0 to disable the threshold.
4722 # Since: 2.3
4724 # Example:
4726 # -> { "execute": "block-set-write-threshold",
4727 #      "arguments": { "node-name": "mydev",
4728 #                     "write-threshold": 17179869184 } }
4729 # <- { "return": {} }
4732 { 'command': 'block-set-write-threshold',
4733   'data': { 'node-name': 'str', 'write-threshold': 'uint64' } }
4736 # @x-blockdev-change:
4738 # Dynamically reconfigure the block driver state graph. It can be used
4739 # to add, remove, insert or replace a graph node. Currently only the
4740 # Quorum driver implements this feature to add or remove its child. This
4741 # is useful to fix a broken quorum child.
4743 # If @node is specified, it will be inserted under @parent. @child
4744 # may not be specified in this case. If both @parent and @child are
4745 # specified but @node is not, @child will be detached from @parent.
4747 # @parent: the id or name of the parent node.
4749 # @child: the name of a child under the given parent node.
4751 # @node: the name of the node that will be added.
4753 # Note: this command is experimental, and its API is not stable. It
4754 # does not support all kinds of operations, all kinds of children, nor
4755 # all block drivers.
4757 # FIXME Removing children from a quorum node means introducing gaps in the
4758 # child indices. This cannot be represented in the 'children' list of
4759 # BlockdevOptionsQuorum, as returned by .bdrv_refresh_filename().
4761 # Warning: The data in a new quorum child MUST be consistent with that of
4762 # the rest of the array.
4764 # Since: 2.7
4766 # Example:
4768 # 1. Add a new node to a quorum
4769 # -> { "execute": "blockdev-add",
4770 #      "arguments": {
4771 #          "driver": "raw",
4772 #          "node-name": "new_node",
4773 #          "file": { "driver": "file",
4774 #                    "filename": "test.raw" } } }
4775 # <- { "return": {} }
4776 # -> { "execute": "x-blockdev-change",
4777 #      "arguments": { "parent": "disk1",
4778 #                     "node": "new_node" } }
4779 # <- { "return": {} }
4781 # 2. Delete a quorum's node
4782 # -> { "execute": "x-blockdev-change",
4783 #      "arguments": { "parent": "disk1",
4784 #                     "child": "children.1" } }
4785 # <- { "return": {} }
4788 { 'command': 'x-blockdev-change',
4789   'data' : { 'parent': 'str',
4790              '*child': 'str',
4791              '*node': 'str' } }
4794 # @x-blockdev-set-iothread:
4796 # Move @node and its children into the @iothread.  If @iothread is null then
4797 # move @node and its children into the main loop.
4799 # The node must not be attached to a BlockBackend.
4801 # @node-name: the name of the block driver node
4803 # @iothread: the name of the IOThread object or null for the main loop
4805 # @force: true if the node and its children should be moved when a BlockBackend
4806 #         is already attached
4808 # Note: this command is experimental and intended for test cases that need
4809 # control over IOThreads only.
4811 # Since: 2.12
4813 # Example:
4815 # 1. Move a node into an IOThread
4816 # -> { "execute": "x-blockdev-set-iothread",
4817 #      "arguments": { "node-name": "disk1",
4818 #                     "iothread": "iothread0" } }
4819 # <- { "return": {} }
4821 # 2. Move a node into the main loop
4822 # -> { "execute": "x-blockdev-set-iothread",
4823 #      "arguments": { "node-name": "disk1",
4824 #                     "iothread": null } }
4825 # <- { "return": {} }
4828 { 'command': 'x-blockdev-set-iothread',
4829   'data' : { 'node-name': 'str',
4830              'iothread': 'StrOrNull',
4831              '*force': 'bool' } }