test-bdrv-drain: AIO_WAIT_WHILE() in job .commit/.abort
[qemu/ar7.git] / qapi / block-core.json
blobac3b48ee54e2aa444af7c7c088b1a39d02157334
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 # @qdev: The qdev ID, or if no ID is assigned, the QOM path of the block
870 #        device. (since 3.0)
872 # @stats:  A @BlockDeviceStats for the device.
874 # @parent: This describes the file block device if it has one.
875 #          Contains recursively the statistics of the underlying
876 #          protocol (e.g. the host file for a qcow2 image). If there is
877 #          no underlying protocol, this field is omitted
879 # @backing: This describes the backing block device if it has one.
880 #           (Since 2.0)
882 # Since: 0.14.0
884 { 'struct': 'BlockStats',
885   'data': {'*device': 'str', '*qdev': 'str', '*node-name': 'str',
886            'stats': 'BlockDeviceStats',
887            '*parent': 'BlockStats',
888            '*backing': 'BlockStats'} }
891 # @query-blockstats:
893 # Query the @BlockStats for all virtual block devices.
895 # @query-nodes: If true, the command will query all the block nodes
896 #               that have a node name, in a list which will include "parent"
897 #               information, but not "backing".
898 #               If false or omitted, the behavior is as before - query all the
899 #               device backends, recursively including their "parent" and
900 #               "backing". Filter nodes that were created implicitly are
901 #               skipped over in this mode. (Since 2.3)
903 # Returns: A list of @BlockStats for each virtual block devices.
905 # Since: 0.14.0
907 # Example:
909 # -> { "execute": "query-blockstats" }
910 # <- {
911 #       "return":[
912 #          {
913 #             "device":"ide0-hd0",
914 #             "parent":{
915 #                "stats":{
916 #                   "wr_highest_offset":3686448128,
917 #                   "wr_bytes":9786368,
918 #                   "wr_operations":751,
919 #                   "rd_bytes":122567168,
920 #                   "rd_operations":36772
921 #                   "wr_total_times_ns":313253456
922 #                   "rd_total_times_ns":3465673657
923 #                   "flush_total_times_ns":49653
924 #                   "flush_operations":61,
925 #                   "rd_merged":0,
926 #                   "wr_merged":0,
927 #                   "idle_time_ns":2953431879,
928 #                   "account_invalid":true,
929 #                   "account_failed":false
930 #                }
931 #             },
932 #             "stats":{
933 #                "wr_highest_offset":2821110784,
934 #                "wr_bytes":9786368,
935 #                "wr_operations":692,
936 #                "rd_bytes":122739200,
937 #                "rd_operations":36604
938 #                "flush_operations":51,
939 #                "wr_total_times_ns":313253456
940 #                "rd_total_times_ns":3465673657
941 #                "flush_total_times_ns":49653,
942 #                "rd_merged":0,
943 #                "wr_merged":0,
944 #                "idle_time_ns":2953431879,
945 #                "account_invalid":true,
946 #                "account_failed":false
947 #             },
948 #             "qdev": "/machine/unattached/device[23]"
949 #          },
950 #          {
951 #             "device":"ide1-cd0",
952 #             "stats":{
953 #                "wr_highest_offset":0,
954 #                "wr_bytes":0,
955 #                "wr_operations":0,
956 #                "rd_bytes":0,
957 #                "rd_operations":0
958 #                "flush_operations":0,
959 #                "wr_total_times_ns":0
960 #                "rd_total_times_ns":0
961 #                "flush_total_times_ns":0,
962 #                "rd_merged":0,
963 #                "wr_merged":0,
964 #                "account_invalid":false,
965 #                "account_failed":false
966 #             },
967 #             "qdev": "/machine/unattached/device[24]"
968 #          },
969 #          {
970 #             "device":"floppy0",
971 #             "stats":{
972 #                "wr_highest_offset":0,
973 #                "wr_bytes":0,
974 #                "wr_operations":0,
975 #                "rd_bytes":0,
976 #                "rd_operations":0
977 #                "flush_operations":0,
978 #                "wr_total_times_ns":0
979 #                "rd_total_times_ns":0
980 #                "flush_total_times_ns":0,
981 #                "rd_merged":0,
982 #                "wr_merged":0,
983 #                "account_invalid":false,
984 #                "account_failed":false
985 #             },
986 #             "qdev": "/machine/unattached/device[16]"
987 #          },
988 #          {
989 #             "device":"sd0",
990 #             "stats":{
991 #                "wr_highest_offset":0,
992 #                "wr_bytes":0,
993 #                "wr_operations":0,
994 #                "rd_bytes":0,
995 #                "rd_operations":0
996 #                "flush_operations":0,
997 #                "wr_total_times_ns":0
998 #                "rd_total_times_ns":0
999 #                "flush_total_times_ns":0,
1000 #                "rd_merged":0,
1001 #                "wr_merged":0,
1002 #                "account_invalid":false,
1003 #                "account_failed":false
1004 #             }
1005 #          }
1006 #       ]
1007 #    }
1010 { 'command': 'query-blockstats',
1011   'data': { '*query-nodes': 'bool' },
1012   'returns': ['BlockStats'] }
1015 # @BlockdevOnError:
1017 # An enumeration of possible behaviors for errors on I/O operations.
1018 # The exact meaning depends on whether the I/O was initiated by a guest
1019 # or by a block job
1021 # @report: for guest operations, report the error to the guest;
1022 #          for jobs, cancel the job
1024 # @ignore: ignore the error, only report a QMP event (BLOCK_IO_ERROR
1025 #          or BLOCK_JOB_ERROR)
1027 # @enospc: same as @stop on ENOSPC, same as @report otherwise.
1029 # @stop: for guest operations, stop the virtual machine;
1030 #        for jobs, pause the job
1032 # @auto: inherit the error handling policy of the backend (since: 2.7)
1034 # Since: 1.3
1036 { 'enum': 'BlockdevOnError',
1037   'data': ['report', 'ignore', 'enospc', 'stop', 'auto'] }
1040 # @MirrorSyncMode:
1042 # An enumeration of possible behaviors for the initial synchronization
1043 # phase of storage mirroring.
1045 # @top: copies data in the topmost image to the destination
1047 # @full: copies data from all images to the destination
1049 # @none: only copy data written from now on
1051 # @incremental: only copy data described by the dirty bitmap. Since: 2.4
1053 # Since: 1.3
1055 { 'enum': 'MirrorSyncMode',
1056   'data': ['top', 'full', 'none', 'incremental'] }
1059 # @MirrorCopyMode:
1061 # An enumeration whose values tell the mirror block job when to
1062 # trigger writes to the target.
1064 # @background: copy data in background only.
1066 # @write-blocking: when data is written to the source, write it
1067 #                  (synchronously) to the target as well.  In
1068 #                  addition, data is copied in background just like in
1069 #                  @background mode.
1071 # Since: 3.0
1073 { 'enum': 'MirrorCopyMode',
1074   'data': ['background', 'write-blocking'] }
1077 # @BlockJobInfo:
1079 # Information about a long-running block device operation.
1081 # @type: the job type ('stream' for image streaming)
1083 # @device: The job identifier. Originally the device name but other
1084 #          values are allowed since QEMU 2.7
1086 # @len: Estimated @offset value at the completion of the job. This value can
1087 #       arbitrarily change while the job is running, in both directions.
1089 # @offset: Progress made until now. The unit is arbitrary and the value can
1090 #          only meaningfully be used for the ratio of @offset to @len. The
1091 #          value is monotonically increasing.
1093 # @busy: false if the job is known to be in a quiescent state, with
1094 #        no pending I/O.  Since 1.3.
1096 # @paused: whether the job is paused or, if @busy is true, will
1097 #          pause itself as soon as possible.  Since 1.3.
1099 # @speed: the rate limit, bytes per second
1101 # @io-status: the status of the job (since 1.3)
1103 # @ready: true if the job may be completed (since 2.2)
1105 # @status: Current job state/status (since 2.12)
1107 # @auto-finalize: Job will finalize itself when PENDING, moving to
1108 #                 the CONCLUDED state. (since 2.12)
1110 # @auto-dismiss: Job will dismiss itself when CONCLUDED, moving to the NULL
1111 #                state and disappearing from the query list. (since 2.12)
1113 # @error: Error information if the job did not complete successfully.
1114 #         Not set if the job completed successfully. (since 2.12.1)
1116 # Since: 1.1
1118 { 'struct': 'BlockJobInfo',
1119   'data': {'type': 'str', 'device': 'str', 'len': 'int',
1120            'offset': 'int', 'busy': 'bool', 'paused': 'bool', 'speed': 'int',
1121            'io-status': 'BlockDeviceIoStatus', 'ready': 'bool',
1122            'status': 'JobStatus',
1123            'auto-finalize': 'bool', 'auto-dismiss': 'bool',
1124            '*error': 'str' } }
1127 # @query-block-jobs:
1129 # Return information about long-running block device operations.
1131 # Returns: a list of @BlockJobInfo for each active block job
1133 # Since: 1.1
1135 { 'command': 'query-block-jobs', 'returns': ['BlockJobInfo'] }
1138 # @block_passwd:
1140 # This command sets the password of a block device that has not been open
1141 # with a password and requires one.
1143 # This command is now obsolete and will always return an error since 2.10
1146 { 'command': 'block_passwd', 'data': {'*device': 'str',
1147                                       '*node-name': 'str', 'password': 'str'} }
1150 # @block_resize:
1152 # Resize a block image while a guest is running.
1154 # Either @device or @node-name must be set but not both.
1156 # @device: the name of the device to get the image resized
1158 # @node-name: graph node name to get the image resized (Since 2.0)
1160 # @size:  new image size in bytes
1162 # Returns: nothing on success
1163 #          If @device is not a valid block device, DeviceNotFound
1165 # Since: 0.14.0
1167 # Example:
1169 # -> { "execute": "block_resize",
1170 #      "arguments": { "device": "scratch", "size": 1073741824 } }
1171 # <- { "return": {} }
1174 { 'command': 'block_resize', 'data': { '*device': 'str',
1175                                        '*node-name': 'str',
1176                                        'size': 'int' }}
1179 # @NewImageMode:
1181 # An enumeration that tells QEMU how to set the backing file path in
1182 # a new image file.
1184 # @existing: QEMU should look for an existing image file.
1186 # @absolute-paths: QEMU should create a new image with absolute paths
1187 # for the backing file. If there is no backing file available, the new
1188 # image will not be backed either.
1190 # Since: 1.1
1192 { 'enum': 'NewImageMode',
1193   'data': [ 'existing', 'absolute-paths' ] }
1196 # @BlockdevSnapshotSync:
1198 # Either @device or @node-name must be set but not both.
1200 # @device: the name of the device to generate the snapshot from.
1202 # @node-name: graph node name to generate the snapshot from (Since 2.0)
1204 # @snapshot-file: the target of the new image. If the file exists, or
1205 # if it is a device, the snapshot will be created in the existing
1206 # file/device. Otherwise, a new file will be created.
1208 # @snapshot-node-name: the graph node name of the new image (Since 2.0)
1210 # @format: the format of the snapshot image, default is 'qcow2'.
1212 # @mode: whether and how QEMU should create a new image, default is
1213 #        'absolute-paths'.
1215 { 'struct': 'BlockdevSnapshotSync',
1216   'data': { '*device': 'str', '*node-name': 'str',
1217             'snapshot-file': 'str', '*snapshot-node-name': 'str',
1218             '*format': 'str', '*mode': 'NewImageMode' } }
1221 # @BlockdevSnapshot:
1223 # @node: device or node name that will have a snapshot created.
1225 # @overlay: reference to the existing block device that will become
1226 #           the overlay of @node, as part of creating the snapshot.
1227 #           It must not have a current backing file (this can be
1228 #           achieved by passing "backing": null to blockdev-add).
1230 # Since: 2.5
1232 { 'struct': 'BlockdevSnapshot',
1233   'data': { 'node': 'str', 'overlay': 'str' } }
1236 # @DriveBackup:
1238 # @job-id: identifier for the newly-created block job. If
1239 #          omitted, the device name will be used. (Since 2.7)
1241 # @device: the device name or node-name of a root node which should be copied.
1243 # @target: the target of the new image. If the file exists, or if it
1244 #          is a device, the existing file/device will be used as the new
1245 #          destination.  If it does not exist, a new file will be created.
1247 # @format: the format of the new destination, default is to
1248 #          probe if @mode is 'existing', else the format of the source
1250 # @sync: what parts of the disk image should be copied to the destination
1251 #        (all the disk, only the sectors allocated in the topmost image, from a
1252 #        dirty bitmap, or only new I/O).
1254 # @mode: whether and how QEMU should create a new image, default is
1255 #        'absolute-paths'.
1257 # @speed: the maximum speed, in bytes per second
1259 # @bitmap: the name of dirty bitmap if sync is "incremental".
1260 #          Must be present if sync is "incremental", must NOT be present
1261 #          otherwise. (Since 2.4)
1263 # @compress: true to compress data, if the target format supports it.
1264 #            (default: false) (since 2.8)
1266 # @on-source-error: the action to take on an error on the source,
1267 #                   default 'report'.  'stop' and 'enospc' can only be used
1268 #                   if the block device supports io-status (see BlockInfo).
1270 # @on-target-error: the action to take on an error on the target,
1271 #                   default 'report' (no limitations, since this applies to
1272 #                   a different block device than @device).
1274 # @auto-finalize: When false, this job will wait in a PENDING state after it has
1275 #                 finished its work, waiting for @block-job-finalize before
1276 #                 making any block graph changes.
1277 #                 When true, this job will automatically
1278 #                 perform its abort or commit actions.
1279 #                 Defaults to true. (Since 2.12)
1281 # @auto-dismiss: When false, this job will wait in a CONCLUDED state after it
1282 #                has completely ceased all work, and awaits @block-job-dismiss.
1283 #                When true, this job will automatically disappear from the query
1284 #                list without user intervention.
1285 #                Defaults to true. (Since 2.12)
1287 # Note: @on-source-error and @on-target-error only affect background
1288 # I/O.  If an error occurs during a guest write request, the device's
1289 # rerror/werror actions will be used.
1291 # Since: 1.6
1293 { 'struct': 'DriveBackup',
1294   'data': { '*job-id': 'str', 'device': 'str', 'target': 'str',
1295             '*format': 'str', 'sync': 'MirrorSyncMode',
1296             '*mode': 'NewImageMode', '*speed': 'int',
1297             '*bitmap': 'str', '*compress': 'bool',
1298             '*on-source-error': 'BlockdevOnError',
1299             '*on-target-error': 'BlockdevOnError',
1300             '*auto-finalize': 'bool', '*auto-dismiss': 'bool' } }
1303 # @BlockdevBackup:
1305 # @job-id: identifier for the newly-created block job. If
1306 #          omitted, the device name will be used. (Since 2.7)
1308 # @device: the device name or node-name of a root node which should be copied.
1310 # @target: the device name or node-name of the backup target node.
1312 # @sync: what parts of the disk image should be copied to the destination
1313 #        (all the disk, only the sectors allocated in the topmost image, or
1314 #        only new I/O).
1316 # @speed: the maximum speed, in bytes per second. The default is 0,
1317 #         for unlimited.
1319 # @compress: true to compress data, if the target format supports it.
1320 #            (default: false) (since 2.8)
1322 # @on-source-error: the action to take on an error on the source,
1323 #                   default 'report'.  'stop' and 'enospc' can only be used
1324 #                   if the block device supports io-status (see BlockInfo).
1326 # @on-target-error: the action to take on an error on the target,
1327 #                   default 'report' (no limitations, since this applies to
1328 #                   a different block device than @device).
1330 # @auto-finalize: When false, this job will wait in a PENDING state after it has
1331 #                 finished its work, waiting for @block-job-finalize before
1332 #                 making any block graph changes.
1333 #                 When true, this job will automatically
1334 #                 perform its abort or commit actions.
1335 #                 Defaults to true. (Since 2.12)
1337 # @auto-dismiss: When false, this job will wait in a CONCLUDED state after it
1338 #                has completely ceased all work, and awaits @block-job-dismiss.
1339 #                When true, this job will automatically disappear from the query
1340 #                list without user intervention.
1341 #                Defaults to true. (Since 2.12)
1343 # Note: @on-source-error and @on-target-error only affect background
1344 # I/O.  If an error occurs during a guest write request, the device's
1345 # rerror/werror actions will be used.
1347 # Since: 2.3
1349 { 'struct': 'BlockdevBackup',
1350   'data': { '*job-id': 'str', 'device': 'str', 'target': 'str',
1351             'sync': 'MirrorSyncMode', '*speed': 'int', '*compress': 'bool',
1352             '*on-source-error': 'BlockdevOnError',
1353             '*on-target-error': 'BlockdevOnError',
1354             '*auto-finalize': 'bool', '*auto-dismiss': 'bool' } }
1357 # @blockdev-snapshot-sync:
1359 # Generates a synchronous snapshot of a block device.
1361 # For the arguments, see the documentation of BlockdevSnapshotSync.
1363 # Returns: nothing on success
1364 #          If @device is not a valid block device, DeviceNotFound
1366 # Since: 0.14.0
1368 # Example:
1370 # -> { "execute": "blockdev-snapshot-sync",
1371 #      "arguments": { "device": "ide-hd0",
1372 #                     "snapshot-file":
1373 #                     "/some/place/my-image",
1374 #                     "format": "qcow2" } }
1375 # <- { "return": {} }
1378 { 'command': 'blockdev-snapshot-sync',
1379   'data': 'BlockdevSnapshotSync' }
1383 # @blockdev-snapshot:
1385 # Generates a snapshot of a block device.
1387 # Create a snapshot, by installing 'node' as the backing image of
1388 # 'overlay'. Additionally, if 'node' is associated with a block
1389 # device, the block device changes to using 'overlay' as its new active
1390 # image.
1392 # For the arguments, see the documentation of BlockdevSnapshot.
1394 # Since: 2.5
1396 # Example:
1398 # -> { "execute": "blockdev-add",
1399 #      "arguments": { "driver": "qcow2",
1400 #                     "node-name": "node1534",
1401 #                     "file": { "driver": "file",
1402 #                               "filename": "hd1.qcow2" },
1403 #                     "backing": null } }
1405 # <- { "return": {} }
1407 # -> { "execute": "blockdev-snapshot",
1408 #      "arguments": { "node": "ide-hd0",
1409 #                     "overlay": "node1534" } }
1410 # <- { "return": {} }
1413 { 'command': 'blockdev-snapshot',
1414   'data': 'BlockdevSnapshot' }
1417 # @change-backing-file:
1419 # Change the backing file in the image file metadata.  This does not
1420 # cause QEMU to reopen the image file to reparse the backing filename
1421 # (it may, however, perform a reopen to change permissions from
1422 # r/o -> r/w -> r/o, if needed). The new backing file string is written
1423 # into the image file metadata, and the QEMU internal strings are
1424 # updated.
1426 # @image-node-name: The name of the block driver state node of the
1427 #                   image to modify. The "device" argument is used
1428 #                   to verify "image-node-name" is in the chain
1429 #                   described by "device".
1431 # @device:          The device name or node-name of the root node that owns
1432 #                   image-node-name.
1434 # @backing-file:    The string to write as the backing file.  This
1435 #                   string is not validated, so care should be taken
1436 #                   when specifying the string or the image chain may
1437 #                   not be able to be reopened again.
1439 # Returns: Nothing on success
1441 #          If "device" does not exist or cannot be determined, DeviceNotFound
1443 # Since: 2.1
1445 { 'command': 'change-backing-file',
1446   'data': { 'device': 'str', 'image-node-name': 'str',
1447             'backing-file': 'str' } }
1450 # @block-commit:
1452 # Live commit of data from overlay image nodes into backing nodes - i.e.,
1453 # writes data between 'top' and 'base' into 'base'.
1455 # @job-id: identifier for the newly-created block job. If
1456 #          omitted, the device name will be used. (Since 2.7)
1458 # @device:  the device name or node-name of a root node
1460 # @base-node: The node name of the backing image to write data into.
1461 #             If not specified, this is the deepest backing image.
1462 #             (since: 3.1)
1464 # @base: Same as @base-node, except that it is a file name rather than a node
1465 #        name. This must be the exact filename string that was used to open the
1466 #        node; other strings, even if addressing the same file, are not
1467 #        accepted (deprecated, use @base-node instead)
1469 # @top-node: The node name of the backing image within the image chain
1470 #            which contains the topmost data to be committed down. If
1471 #            not specified, this is the active layer. (since: 3.1)
1473 # @top: Same as @top-node, except that it is a file name rather than a node
1474 #       name. This must be the exact filename string that was used to open the
1475 #       node; other strings, even if addressing the same file, are not
1476 #       accepted (deprecated, use @base-node instead)
1478 # @backing-file:  The backing file string to write into the overlay
1479 #                           image of 'top'.  If 'top' is the active layer,
1480 #                           specifying a backing file string is an error. This
1481 #                           filename is not validated.
1483 #                           If a pathname string is such that it cannot be
1484 #                           resolved by QEMU, that means that subsequent QMP or
1485 #                           HMP commands must use node-names for the image in
1486 #                           question, as filename lookup methods will fail.
1488 #                           If not specified, QEMU will automatically determine
1489 #                           the backing file string to use, or error out if
1490 #                           there is no obvious choice. Care should be taken
1491 #                           when specifying the string, to specify a valid
1492 #                           filename or protocol.
1493 #                           (Since 2.1)
1495 #                    If top == base, that is an error.
1496 #                    If top == active, the job will not be completed by itself,
1497 #                    user needs to complete the job with the block-job-complete
1498 #                    command after getting the ready event. (Since 2.0)
1500 #                    If the base image is smaller than top, then the base image
1501 #                    will be resized to be the same size as top.  If top is
1502 #                    smaller than the base image, the base will not be
1503 #                    truncated.  If you want the base image size to match the
1504 #                    size of the smaller top, you can safely truncate it
1505 #                    yourself once the commit operation successfully completes.
1507 # @speed:  the maximum speed, in bytes per second
1509 # @filter-node-name: the node name that should be assigned to the
1510 #                    filter driver that the commit job inserts into the graph
1511 #                    above @top. If this option is not given, a node name is
1512 #                    autogenerated. (Since: 2.9)
1514 # @auto-finalize: When false, this job will wait in a PENDING state after it has
1515 #                 finished its work, waiting for @block-job-finalize before
1516 #                 making any block graph changes.
1517 #                 When true, this job will automatically
1518 #                 perform its abort or commit actions.
1519 #                 Defaults to true. (Since 3.1)
1521 # @auto-dismiss: When false, this job will wait in a CONCLUDED state after it
1522 #                has completely ceased all work, and awaits @block-job-dismiss.
1523 #                When true, this job will automatically disappear from the query
1524 #                list without user intervention.
1525 #                Defaults to true. (Since 3.1)
1527 # Returns: Nothing on success
1528 #          If @device does not exist, DeviceNotFound
1529 #          Any other error returns a GenericError.
1531 # Since: 1.3
1533 # Example:
1535 # -> { "execute": "block-commit",
1536 #      "arguments": { "device": "virtio0",
1537 #                     "top": "/tmp/snap1.qcow2" } }
1538 # <- { "return": {} }
1541 { 'command': 'block-commit',
1542   'data': { '*job-id': 'str', 'device': 'str', '*base-node': 'str',
1543             '*base': 'str', '*top-node': 'str', '*top': 'str',
1544             '*backing-file': 'str', '*speed': 'int',
1545             '*filter-node-name': 'str',
1546             '*auto-finalize': 'bool', '*auto-dismiss': 'bool' } }
1549 # @drive-backup:
1551 # Start a point-in-time copy of a block device to a new destination.  The
1552 # status of ongoing drive-backup operations can be checked with
1553 # query-block-jobs where the BlockJobInfo.type field has the value 'backup'.
1554 # The operation can be stopped before it has completed using the
1555 # block-job-cancel command.
1557 # Returns: nothing on success
1558 #          If @device is not a valid block device, GenericError
1560 # Since: 1.6
1562 # Example:
1564 # -> { "execute": "drive-backup",
1565 #      "arguments": { "device": "drive0",
1566 #                     "sync": "full",
1567 #                     "target": "backup.img" } }
1568 # <- { "return": {} }
1571 { 'command': 'drive-backup', 'boxed': true,
1572   'data': 'DriveBackup' }
1575 # @blockdev-backup:
1577 # Start a point-in-time copy of a block device to a new destination.  The
1578 # status of ongoing blockdev-backup operations can be checked with
1579 # query-block-jobs where the BlockJobInfo.type field has the value 'backup'.
1580 # The operation can be stopped before it has completed using the
1581 # block-job-cancel command.
1583 # Returns: nothing on success
1584 #          If @device is not a valid block device, DeviceNotFound
1586 # Since: 2.3
1588 # Example:
1589 # -> { "execute": "blockdev-backup",
1590 #      "arguments": { "device": "src-id",
1591 #                     "sync": "full",
1592 #                     "target": "tgt-id" } }
1593 # <- { "return": {} }
1596 { 'command': 'blockdev-backup', 'boxed': true,
1597   'data': 'BlockdevBackup' }
1601 # @query-named-block-nodes:
1603 # Get the named block driver list
1605 # Returns: the list of BlockDeviceInfo
1607 # Since: 2.0
1609 # Example:
1611 # -> { "execute": "query-named-block-nodes" }
1612 # <- { "return": [ { "ro":false,
1613 #                    "drv":"qcow2",
1614 #                    "encrypted":false,
1615 #                    "file":"disks/test.qcow2",
1616 #                    "node-name": "my-node",
1617 #                    "backing_file_depth":1,
1618 #                    "bps":1000000,
1619 #                    "bps_rd":0,
1620 #                    "bps_wr":0,
1621 #                    "iops":1000000,
1622 #                    "iops_rd":0,
1623 #                    "iops_wr":0,
1624 #                    "bps_max": 8000000,
1625 #                    "bps_rd_max": 0,
1626 #                    "bps_wr_max": 0,
1627 #                    "iops_max": 0,
1628 #                    "iops_rd_max": 0,
1629 #                    "iops_wr_max": 0,
1630 #                    "iops_size": 0,
1631 #                    "write_threshold": 0,
1632 #                    "image":{
1633 #                       "filename":"disks/test.qcow2",
1634 #                       "format":"qcow2",
1635 #                       "virtual-size":2048000,
1636 #                       "backing_file":"base.qcow2",
1637 #                       "full-backing-filename":"disks/base.qcow2",
1638 #                       "backing-filename-format":"qcow2",
1639 #                       "snapshots":[
1640 #                          {
1641 #                             "id": "1",
1642 #                             "name": "snapshot1",
1643 #                             "vm-state-size": 0,
1644 #                             "date-sec": 10000200,
1645 #                             "date-nsec": 12,
1646 #                             "vm-clock-sec": 206,
1647 #                             "vm-clock-nsec": 30
1648 #                          }
1649 #                       ],
1650 #                       "backing-image":{
1651 #                           "filename":"disks/base.qcow2",
1652 #                           "format":"qcow2",
1653 #                           "virtual-size":2048000
1654 #                       }
1655 #                    } } ] }
1658 { 'command': 'query-named-block-nodes', 'returns': [ 'BlockDeviceInfo' ] }
1661 # @drive-mirror:
1663 # Start mirroring a block device's writes to a new destination. target
1664 # specifies the target of the new image. If the file exists, or if it
1665 # is a device, it will be used as the new destination for writes. If
1666 # it does not exist, a new file will be created. format specifies the
1667 # format of the mirror image, default is to probe if mode='existing',
1668 # else the format of the source.
1670 # Returns: nothing on success
1671 #          If @device is not a valid block device, GenericError
1673 # Since: 1.3
1675 # Example:
1677 # -> { "execute": "drive-mirror",
1678 #      "arguments": { "device": "ide-hd0",
1679 #                     "target": "/some/place/my-image",
1680 #                     "sync": "full",
1681 #                     "format": "qcow2" } }
1682 # <- { "return": {} }
1685 { 'command': 'drive-mirror', 'boxed': true,
1686   'data': 'DriveMirror' }
1689 # @DriveMirror:
1691 # A set of parameters describing drive mirror setup.
1693 # @job-id: identifier for the newly-created block job. If
1694 #          omitted, the device name will be used. (Since 2.7)
1696 # @device:  the device name or node-name of a root node whose writes should be
1697 #           mirrored.
1699 # @target: the target of the new image. If the file exists, or if it
1700 #          is a device, the existing file/device will be used as the new
1701 #          destination.  If it does not exist, a new file will be created.
1703 # @format: the format of the new destination, default is to
1704 #          probe if @mode is 'existing', else the format of the source
1706 # @node-name: the new block driver state node name in the graph
1707 #             (Since 2.1)
1709 # @replaces: with sync=full graph node name to be replaced by the new
1710 #            image when a whole image copy is done. This can be used to repair
1711 #            broken Quorum files. (Since 2.1)
1713 # @mode: whether and how QEMU should create a new image, default is
1714 #        'absolute-paths'.
1716 # @speed:  the maximum speed, in bytes per second
1718 # @sync: what parts of the disk image should be copied to the destination
1719 #        (all the disk, only the sectors allocated in the topmost image, or
1720 #        only new I/O).
1722 # @granularity: granularity of the dirty bitmap, default is 64K
1723 #               if the image format doesn't have clusters, 4K if the clusters
1724 #               are smaller than that, else the cluster size.  Must be a
1725 #               power of 2 between 512 and 64M (since 1.4).
1727 # @buf-size: maximum amount of data in flight from source to
1728 #            target (since 1.4).
1730 # @on-source-error: the action to take on an error on the source,
1731 #                   default 'report'.  'stop' and 'enospc' can only be used
1732 #                   if the block device supports io-status (see BlockInfo).
1734 # @on-target-error: the action to take on an error on the target,
1735 #                   default 'report' (no limitations, since this applies to
1736 #                   a different block device than @device).
1737 # @unmap: Whether to try to unmap target sectors where source has
1738 #         only zero. If true, and target unallocated sectors will read as zero,
1739 #         target image sectors will be unmapped; otherwise, zeroes will be
1740 #         written. Both will result in identical contents.
1741 #         Default is true. (Since 2.4)
1743 # @copy-mode: when to copy data to the destination; defaults to 'background'
1744 #             (Since: 3.0)
1746 # @auto-finalize: When false, this job will wait in a PENDING state after it has
1747 #                 finished its work, waiting for @block-job-finalize before
1748 #                 making any block graph changes.
1749 #                 When true, this job will automatically
1750 #                 perform its abort or commit actions.
1751 #                 Defaults to true. (Since 3.1)
1753 # @auto-dismiss: When false, this job will wait in a CONCLUDED state after it
1754 #                has completely ceased all work, and awaits @block-job-dismiss.
1755 #                When true, this job will automatically disappear from the query
1756 #                list without user intervention.
1757 #                Defaults to true. (Since 3.1)
1758 # Since: 1.3
1760 { 'struct': 'DriveMirror',
1761   'data': { '*job-id': 'str', 'device': 'str', 'target': 'str',
1762             '*format': 'str', '*node-name': 'str', '*replaces': 'str',
1763             'sync': 'MirrorSyncMode', '*mode': 'NewImageMode',
1764             '*speed': 'int', '*granularity': 'uint32',
1765             '*buf-size': 'int', '*on-source-error': 'BlockdevOnError',
1766             '*on-target-error': 'BlockdevOnError',
1767             '*unmap': 'bool', '*copy-mode': 'MirrorCopyMode',
1768             '*auto-finalize': 'bool', '*auto-dismiss': 'bool' } }
1771 # @BlockDirtyBitmap:
1773 # @node: name of device/node which the bitmap is tracking
1775 # @name: name of the dirty bitmap
1777 # Since: 2.4
1779 { 'struct': 'BlockDirtyBitmap',
1780   'data': { 'node': 'str', 'name': 'str' } }
1783 # @BlockDirtyBitmapAdd:
1785 # @node: name of device/node which the bitmap is tracking
1787 # @name: name of the dirty bitmap
1789 # @granularity: the bitmap granularity, default is 64k for
1790 #               block-dirty-bitmap-add
1792 # @persistent: the bitmap is persistent, i.e. it will be saved to the
1793 #              corresponding block device image file on its close. For now only
1794 #              Qcow2 disks support persistent bitmaps. Default is false for
1795 #              block-dirty-bitmap-add. (Since: 2.10)
1797 # @autoload: ignored and deprecated since 2.12.
1798 #            Currently, all dirty tracking bitmaps are loaded from Qcow2 on
1799 #            open.
1801 # @x-disabled: the bitmap is created in the disabled state, which means that
1802 #              it will not track drive changes. The bitmap may be enabled with
1803 #              x-block-dirty-bitmap-enable. Default is false. (Since: 3.0)
1805 # Since: 2.4
1807 { 'struct': 'BlockDirtyBitmapAdd',
1808   'data': { 'node': 'str', 'name': 'str', '*granularity': 'uint32',
1809             '*persistent': 'bool', '*autoload': 'bool', '*x-disabled': 'bool' } }
1812 # @BlockDirtyBitmapMerge:
1814 # @node: name of device/node which the bitmap is tracking
1816 # @dst_name: name of the destination dirty bitmap
1818 # @src_name: name of the source dirty bitmap
1820 # Since: 3.0
1822 { 'struct': 'BlockDirtyBitmapMerge',
1823   'data': { 'node': 'str', 'dst_name': 'str', 'src_name': 'str' } }
1826 # @block-dirty-bitmap-add:
1828 # Create a dirty bitmap with a name on the node, and start tracking the writes.
1830 # Returns: nothing on success
1831 #          If @node is not a valid block device or node, DeviceNotFound
1832 #          If @name is already taken, GenericError with an explanation
1834 # Since: 2.4
1836 # Example:
1838 # -> { "execute": "block-dirty-bitmap-add",
1839 #      "arguments": { "node": "drive0", "name": "bitmap0" } }
1840 # <- { "return": {} }
1843 { 'command': 'block-dirty-bitmap-add',
1844   'data': 'BlockDirtyBitmapAdd' }
1847 # @block-dirty-bitmap-remove:
1849 # Stop write tracking and remove the dirty bitmap that was created
1850 # with block-dirty-bitmap-add. If the bitmap is persistent, remove it from its
1851 # storage too.
1853 # Returns: nothing on success
1854 #          If @node is not a valid block device or node, DeviceNotFound
1855 #          If @name is not found, GenericError with an explanation
1856 #          if @name is frozen by an operation, GenericError
1858 # Since: 2.4
1860 # Example:
1862 # -> { "execute": "block-dirty-bitmap-remove",
1863 #      "arguments": { "node": "drive0", "name": "bitmap0" } }
1864 # <- { "return": {} }
1867 { 'command': 'block-dirty-bitmap-remove',
1868   'data': 'BlockDirtyBitmap' }
1871 # @block-dirty-bitmap-clear:
1873 # Clear (reset) a dirty bitmap on the device, so that an incremental
1874 # backup from this point in time forward will only backup clusters
1875 # modified after this clear operation.
1877 # Returns: nothing on success
1878 #          If @node is not a valid block device, DeviceNotFound
1879 #          If @name is not found, GenericError with an explanation
1881 # Since: 2.4
1883 # Example:
1885 # -> { "execute": "block-dirty-bitmap-clear",
1886 #      "arguments": { "node": "drive0", "name": "bitmap0" } }
1887 # <- { "return": {} }
1890 { 'command': 'block-dirty-bitmap-clear',
1891   'data': 'BlockDirtyBitmap' }
1894 # @x-block-dirty-bitmap-enable:
1896 # Enables a dirty bitmap so that it will begin tracking disk changes.
1898 # Returns: nothing on success
1899 #          If @node is not a valid block device, DeviceNotFound
1900 #          If @name is not found, GenericError with an explanation
1902 # Since: 3.0
1904 # Example:
1906 # -> { "execute": "x-block-dirty-bitmap-enable",
1907 #      "arguments": { "node": "drive0", "name": "bitmap0" } }
1908 # <- { "return": {} }
1911   { 'command': 'x-block-dirty-bitmap-enable',
1912     'data': 'BlockDirtyBitmap' }
1915 # @x-block-dirty-bitmap-disable:
1917 # Disables a dirty bitmap so that it will stop tracking disk changes.
1919 # Returns: nothing on success
1920 #          If @node is not a valid block device, DeviceNotFound
1921 #          If @name is not found, GenericError with an explanation
1923 # Since: 3.0
1925 # Example:
1927 # -> { "execute": "x-block-dirty-bitmap-disable",
1928 #      "arguments": { "node": "drive0", "name": "bitmap0" } }
1929 # <- { "return": {} }
1932     { 'command': 'x-block-dirty-bitmap-disable',
1933       'data': 'BlockDirtyBitmap' }
1936 # @x-block-dirty-bitmap-merge:
1938 # Merge @src_name dirty bitmap to @dst_name dirty bitmap. @src_name dirty
1939 # bitmap is unchanged. On error, @dst_name is unchanged.
1941 # Returns: nothing on success
1942 #          If @node is not a valid block device, DeviceNotFound
1943 #          If @dst_name or @src_name is not found, GenericError
1944 #          If bitmaps has different sizes or granularities, GenericError
1946 # Since: 3.0
1948 # Example:
1950 # -> { "execute": "x-block-dirty-bitmap-merge",
1951 #      "arguments": { "node": "drive0", "dst_name": "bitmap0",
1952 #                     "src_name": "bitmap1" } }
1953 # <- { "return": {} }
1956       { 'command': 'x-block-dirty-bitmap-merge',
1957         'data': 'BlockDirtyBitmapMerge' }
1960 # @BlockDirtyBitmapSha256:
1962 # SHA256 hash of dirty bitmap data
1964 # @sha256: ASCII representation of SHA256 bitmap hash
1966 # Since: 2.10
1968   { 'struct': 'BlockDirtyBitmapSha256',
1969     'data': {'sha256': 'str'} }
1972 # @x-debug-block-dirty-bitmap-sha256:
1974 # Get bitmap SHA256
1976 # Returns: BlockDirtyBitmapSha256 on success
1977 #          If @node is not a valid block device, DeviceNotFound
1978 #          If @name is not found or if hashing has failed, GenericError with an
1979 #          explanation
1981 # Since: 2.10
1983   { 'command': 'x-debug-block-dirty-bitmap-sha256',
1984     'data': 'BlockDirtyBitmap', 'returns': 'BlockDirtyBitmapSha256' }
1987 # @blockdev-mirror:
1989 # Start mirroring a block device's writes to a new destination.
1991 # @job-id: identifier for the newly-created block job. If
1992 #          omitted, the device name will be used. (Since 2.7)
1994 # @device: The device name or node-name of a root node whose writes should be
1995 #          mirrored.
1997 # @target: the id or node-name of the block device to mirror to. This mustn't be
1998 #          attached to guest.
2000 # @replaces: with sync=full graph node name to be replaced by the new
2001 #            image when a whole image copy is done. This can be used to repair
2002 #            broken Quorum files.
2004 # @speed:  the maximum speed, in bytes per second
2006 # @sync: what parts of the disk image should be copied to the destination
2007 #        (all the disk, only the sectors allocated in the topmost image, or
2008 #        only new I/O).
2010 # @granularity: granularity of the dirty bitmap, default is 64K
2011 #               if the image format doesn't have clusters, 4K if the clusters
2012 #               are smaller than that, else the cluster size.  Must be a
2013 #               power of 2 between 512 and 64M
2015 # @buf-size: maximum amount of data in flight from source to
2016 #            target
2018 # @on-source-error: the action to take on an error on the source,
2019 #                   default 'report'.  'stop' and 'enospc' can only be used
2020 #                   if the block device supports io-status (see BlockInfo).
2022 # @on-target-error: the action to take on an error on the target,
2023 #                   default 'report' (no limitations, since this applies to
2024 #                   a different block device than @device).
2026 # @filter-node-name: the node name that should be assigned to the
2027 #                    filter driver that the mirror job inserts into the graph
2028 #                    above @device. If this option is not given, a node name is
2029 #                    autogenerated. (Since: 2.9)
2031 # @copy-mode: when to copy data to the destination; defaults to 'background'
2032 #             (Since: 3.0)
2034 # @auto-finalize: When false, this job will wait in a PENDING state after it has
2035 #                 finished its work, waiting for @block-job-finalize before
2036 #                 making any block graph changes.
2037 #                 When true, this job will automatically
2038 #                 perform its abort or commit actions.
2039 #                 Defaults to true. (Since 3.1)
2041 # @auto-dismiss: When false, this job will wait in a CONCLUDED state after it
2042 #                has completely ceased all work, and awaits @block-job-dismiss.
2043 #                When true, this job will automatically disappear from the query
2044 #                list without user intervention.
2045 #                Defaults to true. (Since 3.1)
2046 # Returns: nothing on success.
2048 # Since: 2.6
2050 # Example:
2052 # -> { "execute": "blockdev-mirror",
2053 #      "arguments": { "device": "ide-hd0",
2054 #                     "target": "target0",
2055 #                     "sync": "full" } }
2056 # <- { "return": {} }
2059 { 'command': 'blockdev-mirror',
2060   'data': { '*job-id': 'str', 'device': 'str', 'target': 'str',
2061             '*replaces': 'str',
2062             'sync': 'MirrorSyncMode',
2063             '*speed': 'int', '*granularity': 'uint32',
2064             '*buf-size': 'int', '*on-source-error': 'BlockdevOnError',
2065             '*on-target-error': 'BlockdevOnError',
2066             '*filter-node-name': 'str',
2067             '*copy-mode': 'MirrorCopyMode',
2068             '*auto-finalize': 'bool', '*auto-dismiss': 'bool' } }
2071 # @block_set_io_throttle:
2073 # Change I/O throttle limits for a block drive.
2075 # Since QEMU 2.4, each device with I/O limits is member of a throttle
2076 # group.
2078 # If two or more devices are members of the same group, the limits
2079 # will apply to the combined I/O of the whole group in a round-robin
2080 # fashion. Therefore, setting new I/O limits to a device will affect
2081 # the whole group.
2083 # The name of the group can be specified using the 'group' parameter.
2084 # If the parameter is unset, it is assumed to be the current group of
2085 # that device. If it's not in any group yet, the name of the device
2086 # will be used as the name for its group.
2088 # The 'group' parameter can also be used to move a device to a
2089 # different group. In this case the limits specified in the parameters
2090 # will be applied to the new group only.
2092 # I/O limits can be disabled by setting all of them to 0. In this case
2093 # the device will be removed from its group and the rest of its
2094 # members will not be affected. The 'group' parameter is ignored.
2096 # Returns: Nothing on success
2097 #          If @device is not a valid block device, DeviceNotFound
2099 # Since: 1.1
2101 # Example:
2103 # -> { "execute": "block_set_io_throttle",
2104 #      "arguments": { "id": "virtio-blk-pci0/virtio-backend",
2105 #                     "bps": 0,
2106 #                     "bps_rd": 0,
2107 #                     "bps_wr": 0,
2108 #                     "iops": 512,
2109 #                     "iops_rd": 0,
2110 #                     "iops_wr": 0,
2111 #                     "bps_max": 0,
2112 #                     "bps_rd_max": 0,
2113 #                     "bps_wr_max": 0,
2114 #                     "iops_max": 0,
2115 #                     "iops_rd_max": 0,
2116 #                     "iops_wr_max": 0,
2117 #                     "bps_max_length": 0,
2118 #                     "iops_size": 0 } }
2119 # <- { "return": {} }
2121 # -> { "execute": "block_set_io_throttle",
2122 #      "arguments": { "id": "ide0-1-0",
2123 #                     "bps": 1000000,
2124 #                     "bps_rd": 0,
2125 #                     "bps_wr": 0,
2126 #                     "iops": 0,
2127 #                     "iops_rd": 0,
2128 #                     "iops_wr": 0,
2129 #                     "bps_max": 8000000,
2130 #                     "bps_rd_max": 0,
2131 #                     "bps_wr_max": 0,
2132 #                     "iops_max": 0,
2133 #                     "iops_rd_max": 0,
2134 #                     "iops_wr_max": 0,
2135 #                     "bps_max_length": 60,
2136 #                     "iops_size": 0 } }
2137 # <- { "return": {} }
2139 { 'command': 'block_set_io_throttle', 'boxed': true,
2140   'data': 'BlockIOThrottle' }
2143 # @BlockIOThrottle:
2145 # A set of parameters describing block throttling.
2147 # @device: Block device name (deprecated, use @id instead)
2149 # @id: The name or QOM path of the guest device (since: 2.8)
2151 # @bps: total throughput limit in bytes per second
2153 # @bps_rd: read throughput limit in bytes per second
2155 # @bps_wr: write throughput limit in bytes per second
2157 # @iops: total I/O operations per second
2159 # @iops_rd: read I/O operations per second
2161 # @iops_wr: write I/O operations per second
2163 # @bps_max: total throughput limit during bursts,
2164 #                     in bytes (Since 1.7)
2166 # @bps_rd_max: read throughput limit during bursts,
2167 #                        in bytes (Since 1.7)
2169 # @bps_wr_max: write throughput limit during bursts,
2170 #                        in bytes (Since 1.7)
2172 # @iops_max: total I/O operations per second during bursts,
2173 #                      in bytes (Since 1.7)
2175 # @iops_rd_max: read I/O operations per second during bursts,
2176 #                         in bytes (Since 1.7)
2178 # @iops_wr_max: write I/O operations per second during bursts,
2179 #                         in bytes (Since 1.7)
2181 # @bps_max_length: maximum length of the @bps_max burst
2182 #                            period, in seconds. It must only
2183 #                            be set if @bps_max is set as well.
2184 #                            Defaults to 1. (Since 2.6)
2186 # @bps_rd_max_length: maximum length of the @bps_rd_max
2187 #                               burst period, in seconds. It must only
2188 #                               be set if @bps_rd_max is set as well.
2189 #                               Defaults to 1. (Since 2.6)
2191 # @bps_wr_max_length: maximum length of the @bps_wr_max
2192 #                               burst period, in seconds. It must only
2193 #                               be set if @bps_wr_max is set as well.
2194 #                               Defaults to 1. (Since 2.6)
2196 # @iops_max_length: maximum length of the @iops burst
2197 #                             period, in seconds. It must only
2198 #                             be set if @iops_max is set as well.
2199 #                             Defaults to 1. (Since 2.6)
2201 # @iops_rd_max_length: maximum length of the @iops_rd_max
2202 #                                burst period, in seconds. It must only
2203 #                                be set if @iops_rd_max is set as well.
2204 #                                Defaults to 1. (Since 2.6)
2206 # @iops_wr_max_length: maximum length of the @iops_wr_max
2207 #                                burst period, in seconds. It must only
2208 #                                be set if @iops_wr_max is set as well.
2209 #                                Defaults to 1. (Since 2.6)
2211 # @iops_size: an I/O size in bytes (Since 1.7)
2213 # @group: throttle group name (Since 2.4)
2215 # Since: 1.1
2217 { 'struct': 'BlockIOThrottle',
2218   'data': { '*device': 'str', '*id': 'str', 'bps': 'int', 'bps_rd': 'int',
2219             'bps_wr': 'int', 'iops': 'int', 'iops_rd': 'int', 'iops_wr': 'int',
2220             '*bps_max': 'int', '*bps_rd_max': 'int',
2221             '*bps_wr_max': 'int', '*iops_max': 'int',
2222             '*iops_rd_max': 'int', '*iops_wr_max': 'int',
2223             '*bps_max_length': 'int', '*bps_rd_max_length': 'int',
2224             '*bps_wr_max_length': 'int', '*iops_max_length': 'int',
2225             '*iops_rd_max_length': 'int', '*iops_wr_max_length': 'int',
2226             '*iops_size': 'int', '*group': 'str' } }
2229 # @ThrottleLimits:
2231 # Limit parameters for throttling.
2232 # Since some limit combinations are illegal, limits should always be set in one
2233 # transaction. All fields are optional. When setting limits, if a field is
2234 # missing the current value is not changed.
2236 # @iops-total:             limit total I/O operations per second
2237 # @iops-total-max:         I/O operations burst
2238 # @iops-total-max-length:  length of the iops-total-max burst period, in seconds
2239 #                          It must only be set if @iops-total-max is set as well.
2240 # @iops-read:              limit read operations per second
2241 # @iops-read-max:          I/O operations read burst
2242 # @iops-read-max-length:   length of the iops-read-max burst period, in seconds
2243 #                          It must only be set if @iops-read-max is set as well.
2244 # @iops-write:             limit write operations per second
2245 # @iops-write-max:         I/O operations write burst
2246 # @iops-write-max-length:  length of the iops-write-max burst period, in seconds
2247 #                          It must only be set if @iops-write-max is set as well.
2248 # @bps-total:              limit total bytes per second
2249 # @bps-total-max:          total bytes burst
2250 # @bps-total-max-length:   length of the bps-total-max burst period, in seconds.
2251 #                          It must only be set if @bps-total-max is set as well.
2252 # @bps-read:               limit read bytes per second
2253 # @bps-read-max:           total bytes read burst
2254 # @bps-read-max-length:    length of the bps-read-max burst period, in seconds
2255 #                          It must only be set if @bps-read-max is set as well.
2256 # @bps-write:              limit write bytes per second
2257 # @bps-write-max:          total bytes write burst
2258 # @bps-write-max-length:   length of the bps-write-max burst period, in seconds
2259 #                          It must only be set if @bps-write-max is set as well.
2260 # @iops-size:              when limiting by iops max size of an I/O in bytes
2262 # Since: 2.11
2264 { 'struct': 'ThrottleLimits',
2265   'data': { '*iops-total' : 'int', '*iops-total-max' : 'int',
2266             '*iops-total-max-length' : 'int', '*iops-read' : 'int',
2267             '*iops-read-max' : 'int', '*iops-read-max-length' : 'int',
2268             '*iops-write' : 'int', '*iops-write-max' : 'int',
2269             '*iops-write-max-length' : 'int', '*bps-total' : 'int',
2270             '*bps-total-max' : 'int', '*bps-total-max-length' : 'int',
2271             '*bps-read' : 'int', '*bps-read-max' : 'int',
2272             '*bps-read-max-length' : 'int', '*bps-write' : 'int',
2273             '*bps-write-max' : 'int', '*bps-write-max-length' : 'int',
2274             '*iops-size' : 'int' } }
2277 # @block-stream:
2279 # Copy data from a backing file into a block device.
2281 # The block streaming operation is performed in the background until the entire
2282 # backing file has been copied.  This command returns immediately once streaming
2283 # has started.  The status of ongoing block streaming operations can be checked
2284 # with query-block-jobs.  The operation can be stopped before it has completed
2285 # using the block-job-cancel command.
2287 # The node that receives the data is called the top image, can be located in
2288 # any part of the chain (but always above the base image; see below) and can be
2289 # specified using its device or node name. Earlier qemu versions only allowed
2290 # 'device' to name the top level node; presence of the 'base-node' parameter
2291 # during introspection can be used as a witness of the enhanced semantics
2292 # of 'device'.
2294 # If a base file is specified then sectors are not copied from that base file and
2295 # its backing chain.  When streaming completes the image file will have the base
2296 # file as its backing file.  This can be used to stream a subset of the backing
2297 # file chain instead of flattening the entire image.
2299 # On successful completion the image file is updated to drop the backing file
2300 # and the BLOCK_JOB_COMPLETED event is emitted.
2302 # @job-id: identifier for the newly-created block job. If
2303 #          omitted, the device name will be used. (Since 2.7)
2305 # @device: the device or node name of the top image
2307 # @base:   the common backing file name.
2308 #                    It cannot be set if @base-node is also set.
2310 # @base-node: the node name of the backing file.
2311 #                       It cannot be set if @base is also set. (Since 2.8)
2313 # @backing-file: The backing file string to write into the top
2314 #                          image. This filename is not validated.
2316 #                          If a pathname string is such that it cannot be
2317 #                          resolved by QEMU, that means that subsequent QMP or
2318 #                          HMP commands must use node-names for the image in
2319 #                          question, as filename lookup methods will fail.
2321 #                          If not specified, QEMU will automatically determine
2322 #                          the backing file string to use, or error out if there
2323 #                          is no obvious choice.  Care should be taken when
2324 #                          specifying the string, to specify a valid filename or
2325 #                          protocol.
2326 #                          (Since 2.1)
2328 # @speed:  the maximum speed, in bytes per second
2330 # @on-error: the action to take on an error (default report).
2331 #            'stop' and 'enospc' can only be used if the block device
2332 #            supports io-status (see BlockInfo).  Since 1.3.
2334 # @auto-finalize: When false, this job will wait in a PENDING state after it has
2335 #                 finished its work, waiting for @block-job-finalize before
2336 #                 making any block graph changes.
2337 #                 When true, this job will automatically
2338 #                 perform its abort or commit actions.
2339 #                 Defaults to true. (Since 3.1)
2341 # @auto-dismiss: When false, this job will wait in a CONCLUDED state after it
2342 #                has completely ceased all work, and awaits @block-job-dismiss.
2343 #                When true, this job will automatically disappear from the query
2344 #                list without user intervention.
2345 #                Defaults to true. (Since 3.1)
2347 # Returns: Nothing on success. If @device does not exist, DeviceNotFound.
2349 # Since: 1.1
2351 # Example:
2353 # -> { "execute": "block-stream",
2354 #      "arguments": { "device": "virtio0",
2355 #                     "base": "/tmp/master.qcow2" } }
2356 # <- { "return": {} }
2359 { 'command': 'block-stream',
2360   'data': { '*job-id': 'str', 'device': 'str', '*base': 'str',
2361             '*base-node': 'str', '*backing-file': 'str', '*speed': 'int',
2362             '*on-error': 'BlockdevOnError',
2363             '*auto-finalize': 'bool', '*auto-dismiss': 'bool' } }
2366 # @block-job-set-speed:
2368 # Set maximum speed for a background block operation.
2370 # This command can only be issued when there is an active block job.
2372 # Throttling can be disabled by setting the speed to 0.
2374 # @device: The job identifier. This used to be a device name (hence
2375 #          the name of the parameter), but since QEMU 2.7 it can have
2376 #          other values.
2378 # @speed:  the maximum speed, in bytes per second, or 0 for unlimited.
2379 #          Defaults to 0.
2381 # Returns: Nothing on success
2382 #          If no background operation is active on this device, DeviceNotActive
2384 # Since: 1.1
2386 { 'command': 'block-job-set-speed',
2387   'data': { 'device': 'str', 'speed': 'int' } }
2390 # @block-job-cancel:
2392 # Stop an active background block operation.
2394 # This command returns immediately after marking the active background block
2395 # operation for cancellation.  It is an error to call this command if no
2396 # operation is in progress.
2398 # The operation will cancel as soon as possible and then emit the
2399 # BLOCK_JOB_CANCELLED event.  Before that happens the job is still visible when
2400 # enumerated using query-block-jobs.
2402 # Note that if you issue 'block-job-cancel' after 'drive-mirror' has indicated
2403 # (via the event BLOCK_JOB_READY) that the source and destination are
2404 # synchronized, then the event triggered by this command changes to
2405 # BLOCK_JOB_COMPLETED, to indicate that the mirroring has ended and the
2406 # destination now has a point-in-time copy tied to the time of the cancellation.
2408 # For streaming, the image file retains its backing file unless the streaming
2409 # operation happens to complete just as it is being cancelled.  A new streaming
2410 # operation can be started at a later time to finish copying all data from the
2411 # backing file.
2413 # @device: The job identifier. This used to be a device name (hence
2414 #          the name of the parameter), but since QEMU 2.7 it can have
2415 #          other values.
2417 # @force: If true, and the job has already emitted the event BLOCK_JOB_READY,
2418 #         abandon the job immediately (even if it is paused) instead of waiting
2419 #         for the destination to complete its final synchronization (since 1.3)
2421 # Returns: Nothing on success
2422 #          If no background operation is active on this device, DeviceNotActive
2424 # Since: 1.1
2426 { 'command': 'block-job-cancel', 'data': { 'device': 'str', '*force': 'bool' } }
2429 # @block-job-pause:
2431 # Pause an active background block operation.
2433 # This command returns immediately after marking the active background block
2434 # operation for pausing.  It is an error to call this command if no
2435 # operation is in progress or if the job is already paused.
2437 # The operation will pause as soon as possible.  No event is emitted when
2438 # the operation is actually paused.  Cancelling a paused job automatically
2439 # resumes it.
2441 # @device: The job identifier. This used to be a device name (hence
2442 #          the name of the parameter), but since QEMU 2.7 it can have
2443 #          other values.
2445 # Returns: Nothing on success
2446 #          If no background operation is active on this device, DeviceNotActive
2448 # Since: 1.3
2450 { 'command': 'block-job-pause', 'data': { 'device': 'str' } }
2453 # @block-job-resume:
2455 # Resume an active background block operation.
2457 # This command returns immediately after resuming a paused background block
2458 # operation.  It is an error to call this command if no operation is in
2459 # progress or if the job is not paused.
2461 # This command also clears the error status of the job.
2463 # @device: The job identifier. This used to be a device name (hence
2464 #          the name of the parameter), but since QEMU 2.7 it can have
2465 #          other values.
2467 # Returns: Nothing on success
2468 #          If no background operation is active on this device, DeviceNotActive
2470 # Since: 1.3
2472 { 'command': 'block-job-resume', 'data': { 'device': 'str' } }
2475 # @block-job-complete:
2477 # Manually trigger completion of an active background block operation.  This
2478 # is supported for drive mirroring, where it also switches the device to
2479 # write to the target path only.  The ability to complete is signaled with
2480 # a BLOCK_JOB_READY event.
2482 # This command completes an active background block operation synchronously.
2483 # The ordering of this command's return with the BLOCK_JOB_COMPLETED event
2484 # is not defined.  Note that if an I/O error occurs during the processing of
2485 # this command: 1) the command itself will fail; 2) the error will be processed
2486 # according to the rerror/werror arguments that were specified when starting
2487 # the operation.
2489 # A cancelled or paused job cannot be completed.
2491 # @device: The job identifier. This used to be a device name (hence
2492 #          the name of the parameter), but since QEMU 2.7 it can have
2493 #          other values.
2495 # Returns: Nothing on success
2496 #          If no background operation is active on this device, DeviceNotActive
2498 # Since: 1.3
2500 { 'command': 'block-job-complete', 'data': { 'device': 'str' } }
2503 # @block-job-dismiss:
2505 # For jobs that have already concluded, remove them from the block-job-query
2506 # list. This command only needs to be run for jobs which were started with
2507 # QEMU 2.12+ job lifetime management semantics.
2509 # This command will refuse to operate on any job that has not yet reached
2510 # its terminal state, JOB_STATUS_CONCLUDED. For jobs that make use of the
2511 # BLOCK_JOB_READY event, block-job-cancel or block-job-complete will still need
2512 # to be used as appropriate.
2514 # @id: The job identifier.
2516 # Returns: Nothing on success
2518 # Since: 2.12
2520 { 'command': 'block-job-dismiss', 'data': { 'id': 'str' } }
2523 # @block-job-finalize:
2525 # Once a job that has manual=true reaches the pending state, it can be
2526 # instructed to finalize any graph changes and do any necessary cleanup
2527 # via this command.
2528 # For jobs in a transaction, instructing one job to finalize will force
2529 # ALL jobs in the transaction to finalize, so it is only necessary to instruct
2530 # a single member job to finalize.
2532 # @id: The job identifier.
2534 # Returns: Nothing on success
2536 # Since: 2.12
2538 { 'command': 'block-job-finalize', 'data': { 'id': 'str' } }
2541 # @BlockdevDiscardOptions:
2543 # Determines how to handle discard requests.
2545 # @ignore:      Ignore the request
2546 # @unmap:       Forward as an unmap request
2548 # Since: 2.9
2550 { 'enum': 'BlockdevDiscardOptions',
2551   'data': [ 'ignore', 'unmap' ] }
2554 # @BlockdevDetectZeroesOptions:
2556 # Describes the operation mode for the automatic conversion of plain
2557 # zero writes by the OS to driver specific optimized zero write commands.
2559 # @off:      Disabled (default)
2560 # @on:       Enabled
2561 # @unmap:    Enabled and even try to unmap blocks if possible. This requires
2562 #            also that @BlockdevDiscardOptions is set to unmap for this device.
2564 # Since: 2.1
2566 { 'enum': 'BlockdevDetectZeroesOptions',
2567   'data': [ 'off', 'on', 'unmap' ] }
2570 # @BlockdevAioOptions:
2572 # Selects the AIO backend to handle I/O requests
2574 # @threads:     Use qemu's thread pool
2575 # @native:      Use native AIO backend (only Linux and Windows)
2577 # Since: 2.9
2579 { 'enum': 'BlockdevAioOptions',
2580   'data': [ 'threads', 'native' ] }
2583 # @BlockdevCacheOptions:
2585 # Includes cache-related options for block devices
2587 # @direct:      enables use of O_DIRECT (bypass the host page cache;
2588 #               default: false)
2589 # @no-flush:    ignore any flush requests for the device (default:
2590 #               false)
2592 # Since: 2.9
2594 { 'struct': 'BlockdevCacheOptions',
2595   'data': { '*direct': 'bool',
2596             '*no-flush': 'bool' } }
2599 # @BlockdevDriver:
2601 # Drivers that are supported in block device operations.
2603 # @vxhs: Since 2.10
2604 # @throttle: Since 2.11
2605 # @nvme: Since 2.12
2606 # @copy-on-read: Since 3.0
2607 # @blklogwrites: Since 3.0
2609 # Since: 2.9
2611 { 'enum': 'BlockdevDriver',
2612   'data': [ 'blkdebug', 'blklogwrites', 'blkverify', 'bochs', 'cloop',
2613             'copy-on-read', 'dmg', 'file', 'ftp', 'ftps', 'gluster',
2614             'host_cdrom', 'host_device', 'http', 'https', 'iscsi', 'luks',
2615             'nbd', 'nfs', 'null-aio', 'null-co', 'nvme', 'parallels', 'qcow',
2616             'qcow2', 'qed', 'quorum', 'raw', 'rbd', 'replication', 'sheepdog',
2617             'ssh', 'throttle', 'vdi', 'vhdx', 'vmdk', 'vpc', 'vvfat', 'vxhs' ] }
2620 # @BlockdevOptionsFile:
2622 # Driver specific block device options for the file backend.
2624 # @filename:    path to the image file
2625 # @pr-manager:  the id for the object that will handle persistent reservations
2626 #               for this device (default: none, forward the commands via SG_IO;
2627 #               since 2.11)
2628 # @aio:         AIO backend (default: threads) (since: 2.8)
2629 # @locking:     whether to enable file locking. If set to 'auto', only enable
2630 #               when Open File Descriptor (OFD) locking API is available
2631 #               (default: auto, since 2.10)
2632 # @x-check-cache-dropped: whether to check that page cache was dropped on live
2633 #                         migration.  May cause noticeable delays if the image
2634 #                         file is large, do not use in production.
2635 #                         (default: off) (since: 3.0)
2637 # Since: 2.9
2639 { 'struct': 'BlockdevOptionsFile',
2640   'data': { 'filename': 'str',
2641             '*pr-manager': 'str',
2642             '*locking': 'OnOffAuto',
2643             '*aio': 'BlockdevAioOptions',
2644             '*x-check-cache-dropped': 'bool' } }
2647 # @BlockdevOptionsNull:
2649 # Driver specific block device options for the null backend.
2651 # @size:    size of the device in bytes.
2652 # @latency-ns: emulated latency (in nanoseconds) in processing
2653 #              requests. Default to zero which completes requests immediately.
2654 #              (Since 2.4)
2656 # Since: 2.9
2658 { 'struct': 'BlockdevOptionsNull',
2659   'data': { '*size': 'int', '*latency-ns': 'uint64' } }
2662 # @BlockdevOptionsNVMe:
2664 # Driver specific block device options for the NVMe backend.
2666 # @device:    controller address of the NVMe device.
2667 # @namespace: namespace number of the device, starting from 1.
2669 # Since: 2.12
2671 { 'struct': 'BlockdevOptionsNVMe',
2672   'data': { 'device': 'str', 'namespace': 'int' } }
2675 # @BlockdevOptionsVVFAT:
2677 # Driver specific block device options for the vvfat protocol.
2679 # @dir:         directory to be exported as FAT image
2680 # @fat-type:    FAT type: 12, 16 or 32
2681 # @floppy:      whether to export a floppy image (true) or
2682 #               partitioned hard disk (false; default)
2683 # @label:       set the volume label, limited to 11 bytes. FAT16 and
2684 #               FAT32 traditionally have some restrictions on labels, which are
2685 #               ignored by most operating systems. Defaults to "QEMU VVFAT".
2686 #               (since 2.4)
2687 # @rw:          whether to allow write operations (default: false)
2689 # Since: 2.9
2691 { 'struct': 'BlockdevOptionsVVFAT',
2692   'data': { 'dir': 'str', '*fat-type': 'int', '*floppy': 'bool',
2693             '*label': 'str', '*rw': 'bool' } }
2696 # @BlockdevOptionsGenericFormat:
2698 # Driver specific block device options for image format that have no option
2699 # besides their data source.
2701 # @file:        reference to or definition of the data source block device
2703 # Since: 2.9
2705 { 'struct': 'BlockdevOptionsGenericFormat',
2706   'data': { 'file': 'BlockdevRef' } }
2709 # @BlockdevOptionsLUKS:
2711 # Driver specific block device options for LUKS.
2713 # @key-secret: the ID of a QCryptoSecret object providing
2714 #              the decryption key (since 2.6). Mandatory except when
2715 #              doing a metadata-only probe of the image.
2717 # Since: 2.9
2719 { 'struct': 'BlockdevOptionsLUKS',
2720   'base': 'BlockdevOptionsGenericFormat',
2721   'data': { '*key-secret': 'str' } }
2725 # @BlockdevOptionsGenericCOWFormat:
2727 # Driver specific block device options for image format that have no option
2728 # besides their data source and an optional backing file.
2730 # @backing:     reference to or definition of the backing file block
2731 #               device, null disables the backing file entirely.
2732 #               Defaults to the backing file stored the image file.
2734 # Since: 2.9
2736 { 'struct': 'BlockdevOptionsGenericCOWFormat',
2737   'base': 'BlockdevOptionsGenericFormat',
2738   'data': { '*backing': 'BlockdevRefOrNull' } }
2741 # @Qcow2OverlapCheckMode:
2743 # General overlap check modes.
2745 # @none:        Do not perform any checks
2747 # @constant:    Perform only checks which can be done in constant time and
2748 #               without reading anything from disk
2750 # @cached:      Perform only checks which can be done without reading anything
2751 #               from disk
2753 # @all:         Perform all available overlap checks
2755 # Since: 2.9
2757 { 'enum': 'Qcow2OverlapCheckMode',
2758   'data': [ 'none', 'constant', 'cached', 'all' ] }
2761 # @Qcow2OverlapCheckFlags:
2763 # Structure of flags for each metadata structure. Setting a field to 'true'
2764 # makes qemu guard that structure against unintended overwriting. The default
2765 # value is chosen according to the template given.
2767 # @template: Specifies a template mode which can be adjusted using the other
2768 #            flags, defaults to 'cached'
2770 # @bitmap-directory: since 3.0
2772 # Since: 2.9
2774 { 'struct': 'Qcow2OverlapCheckFlags',
2775   'data': { '*template':         'Qcow2OverlapCheckMode',
2776             '*main-header':      'bool',
2777             '*active-l1':        'bool',
2778             '*active-l2':        'bool',
2779             '*refcount-table':   'bool',
2780             '*refcount-block':   'bool',
2781             '*snapshot-table':   'bool',
2782             '*inactive-l1':      'bool',
2783             '*inactive-l2':      'bool',
2784             '*bitmap-directory': 'bool' } }
2787 # @Qcow2OverlapChecks:
2789 # Specifies which metadata structures should be guarded against unintended
2790 # overwriting.
2792 # @flags:   set of flags for separate specification of each metadata structure
2793 #           type
2795 # @mode:    named mode which chooses a specific set of flags
2797 # Since: 2.9
2799 { 'alternate': 'Qcow2OverlapChecks',
2800   'data': { 'flags': 'Qcow2OverlapCheckFlags',
2801             'mode':  'Qcow2OverlapCheckMode' } }
2804 # @BlockdevQcowEncryptionFormat:
2806 # @aes: AES-CBC with plain64 initialization vectors
2808 # Since: 2.10
2810 { 'enum': 'BlockdevQcowEncryptionFormat',
2811   'data': [ 'aes' ] }
2814 # @BlockdevQcowEncryption:
2816 # Since: 2.10
2818 { 'union': 'BlockdevQcowEncryption',
2819   'base': { 'format': 'BlockdevQcowEncryptionFormat' },
2820   'discriminator': 'format',
2821   'data': { 'aes': 'QCryptoBlockOptionsQCow' } }
2824 # @BlockdevOptionsQcow:
2826 # Driver specific block device options for qcow.
2828 # @encrypt:               Image decryption options. Mandatory for
2829 #                         encrypted images, except when doing a metadata-only
2830 #                         probe of the image.
2832 # Since: 2.10
2834 { 'struct': 'BlockdevOptionsQcow',
2835   'base': 'BlockdevOptionsGenericCOWFormat',
2836   'data': { '*encrypt': 'BlockdevQcowEncryption' } }
2841 # @BlockdevQcow2EncryptionFormat:
2842 # @aes: AES-CBC with plain64 initialization venctors
2844 # Since: 2.10
2846 { 'enum': 'BlockdevQcow2EncryptionFormat',
2847   'data': [ 'aes', 'luks' ] }
2850 # @BlockdevQcow2Encryption:
2852 # Since: 2.10
2854 { 'union': 'BlockdevQcow2Encryption',
2855   'base': { 'format': 'BlockdevQcow2EncryptionFormat' },
2856   'discriminator': 'format',
2857   'data': { 'aes': 'QCryptoBlockOptionsQCow',
2858             'luks': 'QCryptoBlockOptionsLUKS'} }
2861 # @BlockdevOptionsQcow2:
2863 # Driver specific block device options for qcow2.
2865 # @lazy-refcounts:        whether to enable the lazy refcounts
2866 #                         feature (default is taken from the image file)
2868 # @pass-discard-request:  whether discard requests to the qcow2
2869 #                         device should be forwarded to the data source
2871 # @pass-discard-snapshot: whether discard requests for the data source
2872 #                         should be issued when a snapshot operation (e.g.
2873 #                         deleting a snapshot) frees clusters in the qcow2 file
2875 # @pass-discard-other:    whether discard requests for the data source
2876 #                         should be issued on other occasions where a cluster
2877 #                         gets freed
2879 # @overlap-check:         which overlap checks to perform for writes
2880 #                         to the image, defaults to 'cached' (since 2.2)
2882 # @cache-size:            the maximum total size of the L2 table and
2883 #                         refcount block caches in bytes (since 2.2)
2885 # @l2-cache-size:         the maximum size of the L2 table cache in
2886 #                         bytes (since 2.2)
2888 # @l2-cache-entry-size:   the size of each entry in the L2 cache in
2889 #                         bytes. It must be a power of two between 512
2890 #                         and the cluster size. The default value is
2891 #                         the cluster size (since 2.12)
2893 # @refcount-cache-size:   the maximum size of the refcount block cache
2894 #                         in bytes (since 2.2)
2896 # @cache-clean-interval:  clean unused entries in the L2 and refcount
2897 #                         caches. The interval is in seconds. The default value
2898 #                         is 0 and it disables this feature (since 2.5)
2899 # @encrypt:               Image decryption options. Mandatory for
2900 #                         encrypted images, except when doing a metadata-only
2901 #                         probe of the image. (since 2.10)
2903 # Since: 2.9
2905 { 'struct': 'BlockdevOptionsQcow2',
2906   'base': 'BlockdevOptionsGenericCOWFormat',
2907   'data': { '*lazy-refcounts': 'bool',
2908             '*pass-discard-request': 'bool',
2909             '*pass-discard-snapshot': 'bool',
2910             '*pass-discard-other': 'bool',
2911             '*overlap-check': 'Qcow2OverlapChecks',
2912             '*cache-size': 'int',
2913             '*l2-cache-size': 'int',
2914             '*l2-cache-entry-size': 'int',
2915             '*refcount-cache-size': 'int',
2916             '*cache-clean-interval': 'int',
2917             '*encrypt': 'BlockdevQcow2Encryption' } }
2920 # @SshHostKeyCheckMode:
2922 # @none             Don't check the host key at all
2923 # @hash             Compare the host key with a given hash
2924 # @known_hosts      Check the host key against the known_hosts file
2926 # Since: 2.12
2928 { 'enum': 'SshHostKeyCheckMode',
2929   'data': [ 'none', 'hash', 'known_hosts' ] }
2932 # @SshHostKeyCheckHashType:
2934 # @md5              The given hash is an md5 hash
2935 # @sha1             The given hash is an sha1 hash
2937 # Since: 2.12
2939 { 'enum': 'SshHostKeyCheckHashType',
2940   'data': [ 'md5', 'sha1' ] }
2943 # @SshHostKeyHash:
2945 # @type             The hash algorithm used for the hash
2946 # @hash             The expected hash value
2948 # Since: 2.12
2950 { 'struct': 'SshHostKeyHash',
2951   'data': { 'type': 'SshHostKeyCheckHashType',
2952             'hash': 'str' }}
2955 # @SshHostKeyCheck:
2957 # Since: 2.12
2959 { 'union': 'SshHostKeyCheck',
2960   'base': { 'mode': 'SshHostKeyCheckMode' },
2961   'discriminator': 'mode',
2962   'data': { 'hash': 'SshHostKeyHash' } }
2965 # @BlockdevOptionsSsh:
2967 # @server:              host address
2969 # @path:                path to the image on the host
2971 # @user:                user as which to connect, defaults to current
2972 #                       local user name
2974 # @host-key-check:      Defines how and what to check the host key against
2975 #                       (default: known_hosts)
2977 # Since: 2.9
2979 { 'struct': 'BlockdevOptionsSsh',
2980   'data': { 'server': 'InetSocketAddress',
2981             'path': 'str',
2982             '*user': 'str',
2983             '*host-key-check': 'SshHostKeyCheck' } }
2987 # @BlkdebugEvent:
2989 # Trigger events supported by blkdebug.
2991 # @l1_shrink_write_table:      write zeros to the l1 table to shrink image.
2992 #                              (since 2.11)
2994 # @l1_shrink_free_l2_clusters: discard the l2 tables. (since 2.11)
2996 # @cor_write: a write due to copy-on-read (since 2.11)
2998 # Since: 2.9
3000 { 'enum': 'BlkdebugEvent', 'prefix': 'BLKDBG',
3001   'data': [ 'l1_update', 'l1_grow_alloc_table', 'l1_grow_write_table',
3002             'l1_grow_activate_table', 'l2_load', 'l2_update',
3003             'l2_update_compressed', 'l2_alloc_cow_read', 'l2_alloc_write',
3004             'read_aio', 'read_backing_aio', 'read_compressed', 'write_aio',
3005             'write_compressed', 'vmstate_load', 'vmstate_save', 'cow_read',
3006             'cow_write', 'reftable_load', 'reftable_grow', 'reftable_update',
3007             'refblock_load', 'refblock_update', 'refblock_update_part',
3008             'refblock_alloc', 'refblock_alloc_hookup', 'refblock_alloc_write',
3009             'refblock_alloc_write_blocks', 'refblock_alloc_write_table',
3010             'refblock_alloc_switch_table', 'cluster_alloc',
3011             'cluster_alloc_bytes', 'cluster_free', 'flush_to_os',
3012             'flush_to_disk', 'pwritev_rmw_head', 'pwritev_rmw_after_head',
3013             'pwritev_rmw_tail', 'pwritev_rmw_after_tail', 'pwritev',
3014             'pwritev_zero', 'pwritev_done', 'empty_image_prepare',
3015             'l1_shrink_write_table', 'l1_shrink_free_l2_clusters',
3016             'cor_write'] }
3019 # @BlkdebugInjectErrorOptions:
3021 # Describes a single error injection for blkdebug.
3023 # @event:       trigger event
3025 # @state:       the state identifier blkdebug needs to be in to
3026 #               actually trigger the event; defaults to "any"
3028 # @errno:       error identifier (errno) to be returned; defaults to
3029 #               EIO
3031 # @sector:      specifies the sector index which has to be affected
3032 #               in order to actually trigger the event; defaults to "any
3033 #               sector"
3035 # @once:        disables further events after this one has been
3036 #               triggered; defaults to false
3038 # @immediately: fail immediately; defaults to false
3040 # Since: 2.9
3042 { 'struct': 'BlkdebugInjectErrorOptions',
3043   'data': { 'event': 'BlkdebugEvent',
3044             '*state': 'int',
3045             '*errno': 'int',
3046             '*sector': 'int',
3047             '*once': 'bool',
3048             '*immediately': 'bool' } }
3051 # @BlkdebugSetStateOptions:
3053 # Describes a single state-change event for blkdebug.
3055 # @event:       trigger event
3057 # @state:       the current state identifier blkdebug needs to be in;
3058 #               defaults to "any"
3060 # @new_state:   the state identifier blkdebug is supposed to assume if
3061 #               this event is triggered
3063 # Since: 2.9
3065 { 'struct': 'BlkdebugSetStateOptions',
3066   'data': { 'event': 'BlkdebugEvent',
3067             '*state': 'int',
3068             'new_state': 'int' } }
3071 # @BlockdevOptionsBlkdebug:
3073 # Driver specific block device options for blkdebug.
3075 # @image:           underlying raw block device (or image file)
3077 # @config:          filename of the configuration file
3079 # @align:           required alignment for requests in bytes, must be
3080 #                   positive power of 2, or 0 for default
3082 # @max-transfer:    maximum size for I/O transfers in bytes, must be
3083 #                   positive multiple of @align and of the underlying
3084 #                   file's request alignment (but need not be a power of
3085 #                   2), or 0 for default (since 2.10)
3087 # @opt-write-zero:  preferred alignment for write zero requests in bytes,
3088 #                   must be positive multiple of @align and of the
3089 #                   underlying file's request alignment (but need not be a
3090 #                   power of 2), or 0 for default (since 2.10)
3092 # @max-write-zero:  maximum size for write zero requests in bytes, must be
3093 #                   positive multiple of @align, of @opt-write-zero, and of
3094 #                   the underlying file's request alignment (but need not
3095 #                   be a power of 2), or 0 for default (since 2.10)
3097 # @opt-discard:     preferred alignment for discard requests in bytes, must
3098 #                   be positive multiple of @align and of the underlying
3099 #                   file's request alignment (but need not be a power of
3100 #                   2), or 0 for default (since 2.10)
3102 # @max-discard:     maximum size for discard requests in bytes, must be
3103 #                   positive multiple of @align, of @opt-discard, and of
3104 #                   the underlying file's request alignment (but need not
3105 #                   be a power of 2), or 0 for default (since 2.10)
3107 # @inject-error:    array of error injection descriptions
3109 # @set-state:       array of state-change descriptions
3111 # Since: 2.9
3113 { 'struct': 'BlockdevOptionsBlkdebug',
3114   'data': { 'image': 'BlockdevRef',
3115             '*config': 'str',
3116             '*align': 'int', '*max-transfer': 'int32',
3117             '*opt-write-zero': 'int32', '*max-write-zero': 'int32',
3118             '*opt-discard': 'int32', '*max-discard': 'int32',
3119             '*inject-error': ['BlkdebugInjectErrorOptions'],
3120             '*set-state': ['BlkdebugSetStateOptions'] } }
3123 # @BlockdevOptionsBlklogwrites:
3125 # Driver specific block device options for blklogwrites.
3127 # @file:            block device
3129 # @log:             block device used to log writes to @file
3131 # @log-sector-size: sector size used in logging writes to @file, determines
3132 #                   granularity of offsets and sizes of writes (default: 512)
3134 # @log-append:      append to an existing log (default: false)
3136 # @log-super-update-interval: interval of write requests after which the log
3137 #                             super block is updated to disk (default: 4096)
3139 # Since: 3.0
3141 { 'struct': 'BlockdevOptionsBlklogwrites',
3142   'data': { 'file': 'BlockdevRef',
3143             'log': 'BlockdevRef',
3144             '*log-sector-size': 'uint32',
3145             '*log-append': 'bool',
3146             '*log-super-update-interval': 'uint64' } }
3149 # @BlockdevOptionsBlkverify:
3151 # Driver specific block device options for blkverify.
3153 # @test:    block device to be tested
3155 # @raw:     raw image used for verification
3157 # Since: 2.9
3159 { 'struct': 'BlockdevOptionsBlkverify',
3160   'data': { 'test': 'BlockdevRef',
3161             'raw': 'BlockdevRef' } }
3164 # @QuorumReadPattern:
3166 # An enumeration of quorum read patterns.
3168 # @quorum: read all the children and do a quorum vote on reads
3170 # @fifo: read only from the first child that has not failed
3172 # Since: 2.9
3174 { 'enum': 'QuorumReadPattern', 'data': [ 'quorum', 'fifo' ] }
3177 # @BlockdevOptionsQuorum:
3179 # Driver specific block device options for Quorum
3181 # @blkverify:      true if the driver must print content mismatch
3182 #                  set to false by default
3184 # @children:       the children block devices to use
3186 # @vote-threshold: the vote limit under which a read will fail
3188 # @rewrite-corrupted: rewrite corrupted data when quorum is reached
3189 #                     (Since 2.1)
3191 # @read-pattern: choose read pattern and set to quorum by default
3192 #                (Since 2.2)
3194 # Since: 2.9
3196 { 'struct': 'BlockdevOptionsQuorum',
3197   'data': { '*blkverify': 'bool',
3198             'children': [ 'BlockdevRef' ],
3199             'vote-threshold': 'int',
3200             '*rewrite-corrupted': 'bool',
3201             '*read-pattern': 'QuorumReadPattern' } }
3204 # @BlockdevOptionsGluster:
3206 # Driver specific block device options for Gluster
3208 # @volume:      name of gluster volume where VM image resides
3210 # @path:        absolute path to image file in gluster volume
3212 # @server:      gluster servers description
3214 # @debug:       libgfapi log level (default '4' which is Error)
3215 #               (Since 2.8)
3217 # @logfile:     libgfapi log file (default /dev/stderr) (Since 2.8)
3219 # Since: 2.9
3221 { 'struct': 'BlockdevOptionsGluster',
3222   'data': { 'volume': 'str',
3223             'path': 'str',
3224             'server': ['SocketAddress'],
3225             '*debug': 'int',
3226             '*logfile': 'str' } }
3229 # @IscsiTransport:
3231 # An enumeration of libiscsi transport types
3233 # Since: 2.9
3235 { 'enum': 'IscsiTransport',
3236   'data': [ 'tcp', 'iser' ] }
3239 # @IscsiHeaderDigest:
3241 # An enumeration of header digests supported by libiscsi
3243 # Since: 2.9
3245 { 'enum': 'IscsiHeaderDigest',
3246   'prefix': 'QAPI_ISCSI_HEADER_DIGEST',
3247   'data': [ 'crc32c', 'none', 'crc32c-none', 'none-crc32c' ] }
3250 # @BlockdevOptionsIscsi:
3252 # @transport:       The iscsi transport type
3254 # @portal:          The address of the iscsi portal
3256 # @target:          The target iqn name
3258 # @lun:             LUN to connect to. Defaults to 0.
3260 # @user:            User name to log in with. If omitted, no CHAP
3261 #                   authentication is performed.
3263 # @password-secret: The ID of a QCryptoSecret object providing
3264 #                   the password for the login. This option is required if
3265 #                   @user is specified.
3267 # @initiator-name:  The iqn name we want to identify to the target
3268 #                   as. If this option is not specified, an initiator name is
3269 #                   generated automatically.
3271 # @header-digest:   The desired header digest. Defaults to
3272 #                   none-crc32c.
3274 # @timeout:         Timeout in seconds after which a request will
3275 #                   timeout. 0 means no timeout and is the default.
3277 # Driver specific block device options for iscsi
3279 # Since: 2.9
3281 { 'struct': 'BlockdevOptionsIscsi',
3282   'data': { 'transport': 'IscsiTransport',
3283             'portal': 'str',
3284             'target': 'str',
3285             '*lun': 'int',
3286             '*user': 'str',
3287             '*password-secret': 'str',
3288             '*initiator-name': 'str',
3289             '*header-digest': 'IscsiHeaderDigest',
3290             '*timeout': 'int' } }
3294 # @RbdAuthMode:
3296 # Since: 3.0
3298 { 'enum': 'RbdAuthMode',
3299   'data': [ 'cephx', 'none' ] }
3302 # @BlockdevOptionsRbd:
3304 # @pool:               Ceph pool name.
3306 # @image:              Image name in the Ceph pool.
3308 # @conf:               path to Ceph configuration file.  Values
3309 #                      in the configuration file will be overridden by
3310 #                      options specified via QAPI.
3312 # @snapshot:           Ceph snapshot name.
3314 # @user:               Ceph id name.
3316 # @auth-client-required: Acceptable authentication modes.
3317 #                      This maps to Ceph configuration option
3318 #                      "auth_client_required".  (Since 3.0)
3320 # @key-secret:         ID of a QCryptoSecret object providing a key
3321 #                      for cephx authentication.
3322 #                      This maps to Ceph configuration option
3323 #                      "key".  (Since 3.0)
3325 # @server:             Monitor host address and port.  This maps
3326 #                      to the "mon_host" Ceph option.
3328 # Since: 2.9
3330 { 'struct': 'BlockdevOptionsRbd',
3331   'data': { 'pool': 'str',
3332             'image': 'str',
3333             '*conf': 'str',
3334             '*snapshot': 'str',
3335             '*user': 'str',
3336             '*auth-client-required': ['RbdAuthMode'],
3337             '*key-secret': 'str',
3338             '*server': ['InetSocketAddressBase'] } }
3341 # @BlockdevOptionsSheepdog:
3343 # Driver specific block device options for sheepdog
3345 # @vdi:         Virtual disk image name
3346 # @server:      The Sheepdog server to connect to
3347 # @snap-id:     Snapshot ID
3348 # @tag:         Snapshot tag name
3350 # Only one of @snap-id and @tag may be present.
3352 # Since: 2.9
3354 { 'struct': 'BlockdevOptionsSheepdog',
3355   'data': { 'server': 'SocketAddress',
3356             'vdi': 'str',
3357             '*snap-id': 'uint32',
3358             '*tag': 'str' } }
3361 # @ReplicationMode:
3363 # An enumeration of replication modes.
3365 # @primary: Primary mode, the vm's state will be sent to secondary QEMU.
3367 # @secondary: Secondary mode, receive the vm's state from primary QEMU.
3369 # Since: 2.9
3371 { 'enum' : 'ReplicationMode', 'data' : [ 'primary', 'secondary' ] }
3374 # @BlockdevOptionsReplication:
3376 # Driver specific block device options for replication
3378 # @mode: the replication mode
3380 # @top-id: In secondary mode, node name or device ID of the root
3381 #          node who owns the replication node chain. Must not be given in
3382 #          primary mode.
3384 # Since: 2.9
3386 { 'struct': 'BlockdevOptionsReplication',
3387   'base': 'BlockdevOptionsGenericFormat',
3388   'data': { 'mode': 'ReplicationMode',
3389             '*top-id': 'str' } }
3392 # @NFSTransport:
3394 # An enumeration of NFS transport types
3396 # @inet:        TCP transport
3398 # Since: 2.9
3400 { 'enum': 'NFSTransport',
3401   'data': [ 'inet' ] }
3404 # @NFSServer:
3406 # Captures the address of the socket
3408 # @type:        transport type used for NFS (only TCP supported)
3410 # @host:        host address for NFS server
3412 # Since: 2.9
3414 { 'struct': 'NFSServer',
3415   'data': { 'type': 'NFSTransport',
3416             'host': 'str' } }
3419 # @BlockdevOptionsNfs:
3421 # Driver specific block device option for NFS
3423 # @server:                  host address
3425 # @path:                    path of the image on the host
3427 # @user:                    UID value to use when talking to the
3428 #                           server (defaults to 65534 on Windows and getuid()
3429 #                           on unix)
3431 # @group:                   GID value to use when talking to the
3432 #                           server (defaults to 65534 on Windows and getgid()
3433 #                           in unix)
3435 # @tcp-syn-count:           number of SYNs during the session
3436 #                           establishment (defaults to libnfs default)
3438 # @readahead-size:          set the readahead size in bytes (defaults
3439 #                           to libnfs default)
3441 # @page-cache-size:         set the pagecache size in bytes (defaults
3442 #                           to libnfs default)
3444 # @debug:                   set the NFS debug level (max 2) (defaults
3445 #                           to libnfs default)
3447 # Since: 2.9
3449 { 'struct': 'BlockdevOptionsNfs',
3450   'data': { 'server': 'NFSServer',
3451             'path': 'str',
3452             '*user': 'int',
3453             '*group': 'int',
3454             '*tcp-syn-count': 'int',
3455             '*readahead-size': 'int',
3456             '*page-cache-size': 'int',
3457             '*debug': 'int' } }
3460 # @BlockdevOptionsCurlBase:
3462 # Driver specific block device options shared by all protocols supported by the
3463 # curl backend.
3465 # @url:                     URL of the image file
3467 # @readahead:               Size of the read-ahead cache; must be a multiple of
3468 #                           512 (defaults to 256 kB)
3470 # @timeout:                 Timeout for connections, in seconds (defaults to 5)
3472 # @username:                Username for authentication (defaults to none)
3474 # @password-secret:         ID of a QCryptoSecret object providing a password
3475 #                           for authentication (defaults to no password)
3477 # @proxy-username:          Username for proxy authentication (defaults to none)
3479 # @proxy-password-secret:   ID of a QCryptoSecret object providing a password
3480 #                           for proxy authentication (defaults to no password)
3482 # Since: 2.9
3484 { 'struct': 'BlockdevOptionsCurlBase',
3485   'data': { 'url': 'str',
3486             '*readahead': 'int',
3487             '*timeout': 'int',
3488             '*username': 'str',
3489             '*password-secret': 'str',
3490             '*proxy-username': 'str',
3491             '*proxy-password-secret': 'str' } }
3494 # @BlockdevOptionsCurlHttp:
3496 # Driver specific block device options for HTTP connections over the curl
3497 # backend.  URLs must start with "http://".
3499 # @cookie:      List of cookies to set; format is
3500 #               "name1=content1; name2=content2;" as explained by
3501 #               CURLOPT_COOKIE(3). Defaults to no cookies.
3503 # @cookie-secret: ID of a QCryptoSecret object providing the cookie data in a
3504 #                 secure way. See @cookie for the format. (since 2.10)
3506 # Since: 2.9
3508 { 'struct': 'BlockdevOptionsCurlHttp',
3509   'base': 'BlockdevOptionsCurlBase',
3510   'data': { '*cookie': 'str',
3511             '*cookie-secret': 'str'} }
3514 # @BlockdevOptionsCurlHttps:
3516 # Driver specific block device options for HTTPS connections over the curl
3517 # backend.  URLs must start with "https://".
3519 # @cookie:      List of cookies to set; format is
3520 #               "name1=content1; name2=content2;" as explained by
3521 #               CURLOPT_COOKIE(3). Defaults to no cookies.
3523 # @sslverify:   Whether to verify the SSL certificate's validity (defaults to
3524 #               true)
3526 # @cookie-secret: ID of a QCryptoSecret object providing the cookie data in a
3527 #                 secure way. See @cookie for the format. (since 2.10)
3529 # Since: 2.9
3531 { 'struct': 'BlockdevOptionsCurlHttps',
3532   'base': 'BlockdevOptionsCurlBase',
3533   'data': { '*cookie': 'str',
3534             '*sslverify': 'bool',
3535             '*cookie-secret': 'str'} }
3538 # @BlockdevOptionsCurlFtp:
3540 # Driver specific block device options for FTP connections over the curl
3541 # backend.  URLs must start with "ftp://".
3543 # Since: 2.9
3545 { 'struct': 'BlockdevOptionsCurlFtp',
3546   'base': 'BlockdevOptionsCurlBase',
3547   'data': { } }
3550 # @BlockdevOptionsCurlFtps:
3552 # Driver specific block device options for FTPS connections over the curl
3553 # backend.  URLs must start with "ftps://".
3555 # @sslverify:   Whether to verify the SSL certificate's validity (defaults to
3556 #               true)
3558 # Since: 2.9
3560 { 'struct': 'BlockdevOptionsCurlFtps',
3561   'base': 'BlockdevOptionsCurlBase',
3562   'data': { '*sslverify': 'bool' } }
3565 # @BlockdevOptionsNbd:
3567 # Driver specific block device options for NBD.
3569 # @server:      NBD server address
3571 # @export:      export name
3573 # @tls-creds:   TLS credentials ID
3575 # @x-dirty-bitmap: A "qemu:dirty-bitmap:NAME" string to query in place of
3576 #                  traditional "base:allocation" block status (see
3577 #                  NBD_OPT_LIST_META_CONTEXT in the NBD protocol) (since 3.0)
3579 # Since: 2.9
3581 { 'struct': 'BlockdevOptionsNbd',
3582   'data': { 'server': 'SocketAddress',
3583             '*export': 'str',
3584             '*tls-creds': 'str',
3585             '*x-dirty-bitmap': 'str' } }
3588 # @BlockdevOptionsRaw:
3590 # Driver specific block device options for the raw driver.
3592 # @offset:      position where the block device starts
3593 # @size:        the assumed size of the device
3595 # Since: 2.9
3597 { 'struct': 'BlockdevOptionsRaw',
3598   'base': 'BlockdevOptionsGenericFormat',
3599   'data': { '*offset': 'int', '*size': 'int' } }
3602 # @BlockdevOptionsVxHS:
3604 # Driver specific block device options for VxHS
3606 # @vdisk-id:    UUID of VxHS volume
3607 # @server:      vxhs server IP, port
3608 # @tls-creds:   TLS credentials ID
3610 # Since: 2.10
3612 { 'struct': 'BlockdevOptionsVxHS',
3613   'data': { 'vdisk-id': 'str',
3614             'server': 'InetSocketAddressBase',
3615             '*tls-creds': 'str' } }
3618 # @BlockdevOptionsThrottle:
3620 # Driver specific block device options for the throttle driver
3622 # @throttle-group:   the name of the throttle-group object to use. It
3623 #                    must already exist.
3624 # @file:             reference to or definition of the data source block device
3625 # Since: 2.11
3627 { 'struct': 'BlockdevOptionsThrottle',
3628   'data': { 'throttle-group': 'str',
3629             'file' : 'BlockdevRef'
3630              } }
3632 # @BlockdevOptions:
3634 # Options for creating a block device.  Many options are available for all
3635 # block devices, independent of the block driver:
3637 # @driver:        block driver name
3638 # @node-name:     the node name of the new node (Since 2.0).
3639 #                 This option is required on the top level of blockdev-add.
3640 #                 Valid node names start with an alphabetic character and may
3641 #                 contain only alphanumeric characters, '-', '.' and '_'. Their
3642 #                 maximum length is 31 characters.
3643 # @discard:       discard-related options (default: ignore)
3644 # @cache:         cache-related options
3645 # @read-only:     whether the block device should be read-only (default: false).
3646 #                 Note that some block drivers support only read-only access,
3647 #                 either generally or in certain configurations. In this case,
3648 #                 the default value does not work and the option must be
3649 #                 specified explicitly.
3650 # @detect-zeroes: detect and optimize zero writes (Since 2.1)
3651 #                 (default: off)
3652 # @force-share:   force share all permission on added nodes.
3653 #                 Requires read-only=true. (Since 2.10)
3655 # Remaining options are determined by the block driver.
3657 # Since: 2.9
3659 { 'union': 'BlockdevOptions',
3660   'base': { 'driver': 'BlockdevDriver',
3661             '*node-name': 'str',
3662             '*discard': 'BlockdevDiscardOptions',
3663             '*cache': 'BlockdevCacheOptions',
3664             '*read-only': 'bool',
3665             '*force-share': 'bool',
3666             '*detect-zeroes': 'BlockdevDetectZeroesOptions' },
3667   'discriminator': 'driver',
3668   'data': {
3669       'blkdebug':   'BlockdevOptionsBlkdebug',
3670       'blklogwrites':'BlockdevOptionsBlklogwrites',
3671       'blkverify':  'BlockdevOptionsBlkverify',
3672       'bochs':      'BlockdevOptionsGenericFormat',
3673       'cloop':      'BlockdevOptionsGenericFormat',
3674       'copy-on-read':'BlockdevOptionsGenericFormat',
3675       'dmg':        'BlockdevOptionsGenericFormat',
3676       'file':       'BlockdevOptionsFile',
3677       'ftp':        'BlockdevOptionsCurlFtp',
3678       'ftps':       'BlockdevOptionsCurlFtps',
3679       'gluster':    'BlockdevOptionsGluster',
3680       'host_cdrom': 'BlockdevOptionsFile',
3681       'host_device':'BlockdevOptionsFile',
3682       'http':       'BlockdevOptionsCurlHttp',
3683       'https':      'BlockdevOptionsCurlHttps',
3684       'iscsi':      'BlockdevOptionsIscsi',
3685       'luks':       'BlockdevOptionsLUKS',
3686       'nbd':        'BlockdevOptionsNbd',
3687       'nfs':        'BlockdevOptionsNfs',
3688       'null-aio':   'BlockdevOptionsNull',
3689       'null-co':    'BlockdevOptionsNull',
3690       'nvme':       'BlockdevOptionsNVMe',
3691       'parallels':  'BlockdevOptionsGenericFormat',
3692       'qcow2':      'BlockdevOptionsQcow2',
3693       'qcow':       'BlockdevOptionsQcow',
3694       'qed':        'BlockdevOptionsGenericCOWFormat',
3695       'quorum':     'BlockdevOptionsQuorum',
3696       'raw':        'BlockdevOptionsRaw',
3697       'rbd':        'BlockdevOptionsRbd',
3698       'replication':'BlockdevOptionsReplication',
3699       'sheepdog':   'BlockdevOptionsSheepdog',
3700       'ssh':        'BlockdevOptionsSsh',
3701       'throttle':   'BlockdevOptionsThrottle',
3702       'vdi':        'BlockdevOptionsGenericFormat',
3703       'vhdx':       'BlockdevOptionsGenericFormat',
3704       'vmdk':       'BlockdevOptionsGenericCOWFormat',
3705       'vpc':        'BlockdevOptionsGenericFormat',
3706       'vvfat':      'BlockdevOptionsVVFAT',
3707       'vxhs':       'BlockdevOptionsVxHS'
3708   } }
3711 # @BlockdevRef:
3713 # Reference to a block device.
3715 # @definition:      defines a new block device inline
3716 # @reference:       references the ID of an existing block device
3718 # Since: 2.9
3720 { 'alternate': 'BlockdevRef',
3721   'data': { 'definition': 'BlockdevOptions',
3722             'reference': 'str' } }
3725 # @BlockdevRefOrNull:
3727 # Reference to a block device.
3729 # @definition:      defines a new block device inline
3730 # @reference:       references the ID of an existing block device.
3731 #                   An empty string means that no block device should
3732 #                   be referenced.  Deprecated; use null instead.
3733 # @null:            No block device should be referenced (since 2.10)
3735 # Since: 2.9
3737 { 'alternate': 'BlockdevRefOrNull',
3738   'data': { 'definition': 'BlockdevOptions',
3739             'reference': 'str',
3740             'null': 'null' } }
3743 # @blockdev-add:
3745 # Creates a new block device. If the @id option is given at the top level, a
3746 # BlockBackend will be created; otherwise, @node-name is mandatory at the top
3747 # level and no BlockBackend will be created.
3749 # Since: 2.9
3751 # Example:
3753 # 1.
3754 # -> { "execute": "blockdev-add",
3755 #      "arguments": {
3756 #           "driver": "qcow2",
3757 #           "node-name": "test1",
3758 #           "file": {
3759 #               "driver": "file",
3760 #               "filename": "test.qcow2"
3761 #            }
3762 #       }
3763 #     }
3764 # <- { "return": {} }
3766 # 2.
3767 # -> { "execute": "blockdev-add",
3768 #      "arguments": {
3769 #           "driver": "qcow2",
3770 #           "node-name": "node0",
3771 #           "discard": "unmap",
3772 #           "cache": {
3773 #              "direct": true
3774 #            },
3775 #            "file": {
3776 #              "driver": "file",
3777 #              "filename": "/tmp/test.qcow2"
3778 #            },
3779 #            "backing": {
3780 #               "driver": "raw",
3781 #               "file": {
3782 #                  "driver": "file",
3783 #                  "filename": "/dev/fdset/4"
3784 #                }
3785 #            }
3786 #        }
3787 #      }
3789 # <- { "return": {} }
3792 { 'command': 'blockdev-add', 'data': 'BlockdevOptions', 'boxed': true }
3795 # @blockdev-del:
3797 # Deletes a block device that has been added using blockdev-add.
3798 # The command will fail if the node is attached to a device or is
3799 # otherwise being used.
3801 # @node-name: Name of the graph node to delete.
3803 # Since: 2.9
3805 # Example:
3807 # -> { "execute": "blockdev-add",
3808 #      "arguments": {
3809 #           "driver": "qcow2",
3810 #           "node-name": "node0",
3811 #           "file": {
3812 #               "driver": "file",
3813 #               "filename": "test.qcow2"
3814 #           }
3815 #      }
3816 #    }
3817 # <- { "return": {} }
3819 # -> { "execute": "blockdev-del",
3820 #      "arguments": { "node-name": "node0" }
3821 #    }
3822 # <- { "return": {} }
3825 { 'command': 'blockdev-del', 'data': { 'node-name': 'str' } }
3828 # @BlockdevCreateOptionsFile:
3830 # Driver specific image creation options for file.
3832 # @filename         Filename for the new image file
3833 # @size             Size of the virtual disk in bytes
3834 # @preallocation    Preallocation mode for the new image (default: off)
3835 # @nocow            Turn off copy-on-write (valid only on btrfs; default: off)
3837 # Since: 2.12
3839 { 'struct': 'BlockdevCreateOptionsFile',
3840   'data': { 'filename':         'str',
3841             'size':             'size',
3842             '*preallocation':   'PreallocMode',
3843             '*nocow':           'bool' } }
3846 # @BlockdevCreateOptionsGluster:
3848 # Driver specific image creation options for gluster.
3850 # @location         Where to store the new image file
3851 # @size             Size of the virtual disk in bytes
3852 # @preallocation    Preallocation mode for the new image (default: off)
3854 # Since: 2.12
3856 { 'struct': 'BlockdevCreateOptionsGluster',
3857   'data': { 'location':         'BlockdevOptionsGluster',
3858             'size':             'size',
3859             '*preallocation':   'PreallocMode' } }
3862 # @BlockdevCreateOptionsLUKS:
3864 # Driver specific image creation options for LUKS.
3866 # @file             Node to create the image format on
3867 # @size             Size of the virtual disk in bytes
3869 # Since: 2.12
3871 { 'struct': 'BlockdevCreateOptionsLUKS',
3872   'base': 'QCryptoBlockCreateOptionsLUKS',
3873   'data': { 'file':             'BlockdevRef',
3874             'size':             'size' } }
3877 # @BlockdevCreateOptionsNfs:
3879 # Driver specific image creation options for NFS.
3881 # @location         Where to store the new image file
3882 # @size             Size of the virtual disk in bytes
3884 # Since: 2.12
3886 { 'struct': 'BlockdevCreateOptionsNfs',
3887   'data': { 'location':         'BlockdevOptionsNfs',
3888             'size':             'size' } }
3891 # @BlockdevCreateOptionsParallels:
3893 # Driver specific image creation options for parallels.
3895 # @file             Node to create the image format on
3896 # @size             Size of the virtual disk in bytes
3897 # @cluster-size     Cluster size in bytes (default: 1 MB)
3899 # Since: 2.12
3901 { 'struct': 'BlockdevCreateOptionsParallels',
3902   'data': { 'file':             'BlockdevRef',
3903             'size':             'size',
3904             '*cluster-size':    'size' } }
3907 # @BlockdevCreateOptionsQcow:
3909 # Driver specific image creation options for qcow.
3911 # @file             Node to create the image format on
3912 # @size             Size of the virtual disk in bytes
3913 # @backing-file     File name of the backing file if a backing file
3914 #                   should be used
3915 # @encrypt          Encryption options if the image should be encrypted
3917 # Since: 2.12
3919 { 'struct': 'BlockdevCreateOptionsQcow',
3920   'data': { 'file':             'BlockdevRef',
3921             'size':             'size',
3922             '*backing-file':    'str',
3923             '*encrypt':         'QCryptoBlockCreateOptions' } }
3926 # @BlockdevQcow2Version:
3928 # @v2:  The original QCOW2 format as introduced in qemu 0.10 (version 2)
3929 # @v3:  The extended QCOW2 format as introduced in qemu 1.1 (version 3)
3931 # Since: 2.12
3933 { 'enum': 'BlockdevQcow2Version',
3934   'data': [ 'v2', 'v3' ] }
3938 # @BlockdevCreateOptionsQcow2:
3940 # Driver specific image creation options for qcow2.
3942 # @file             Node to create the image format on
3943 # @size             Size of the virtual disk in bytes
3944 # @version          Compatibility level (default: v3)
3945 # @backing-file     File name of the backing file if a backing file
3946 #                   should be used
3947 # @backing-fmt      Name of the block driver to use for the backing file
3948 # @encrypt          Encryption options if the image should be encrypted
3949 # @cluster-size     qcow2 cluster size in bytes (default: 65536)
3950 # @preallocation    Preallocation mode for the new image (default: off)
3951 # @lazy-refcounts   True if refcounts may be updated lazily (default: off)
3952 # @refcount-bits    Width of reference counts in bits (default: 16)
3954 # Since: 2.12
3956 { 'struct': 'BlockdevCreateOptionsQcow2',
3957   'data': { 'file':             'BlockdevRef',
3958             'size':             'size',
3959             '*version':         'BlockdevQcow2Version',
3960             '*backing-file':    'str',
3961             '*backing-fmt':     'BlockdevDriver',
3962             '*encrypt':         'QCryptoBlockCreateOptions',
3963             '*cluster-size':    'size',
3964             '*preallocation':   'PreallocMode',
3965             '*lazy-refcounts':  'bool',
3966             '*refcount-bits':   'int' } }
3969 # @BlockdevCreateOptionsQed:
3971 # Driver specific image creation options for qed.
3973 # @file             Node to create the image format on
3974 # @size             Size of the virtual disk in bytes
3975 # @backing-file     File name of the backing file if a backing file
3976 #                   should be used
3977 # @backing-fmt      Name of the block driver to use for the backing file
3978 # @cluster-size     Cluster size in bytes (default: 65536)
3979 # @table-size       L1/L2 table size (in clusters)
3981 # Since: 2.12
3983 { 'struct': 'BlockdevCreateOptionsQed',
3984   'data': { 'file':             'BlockdevRef',
3985             'size':             'size',
3986             '*backing-file':    'str',
3987             '*backing-fmt':     'BlockdevDriver',
3988             '*cluster-size':    'size',
3989             '*table-size':      'int' } }
3992 # @BlockdevCreateOptionsRbd:
3994 # Driver specific image creation options for rbd/Ceph.
3996 # @location         Where to store the new image file. This location cannot
3997 #                   point to a snapshot.
3998 # @size             Size of the virtual disk in bytes
3999 # @cluster-size     RBD object size
4001 # Since: 2.12
4003 { 'struct': 'BlockdevCreateOptionsRbd',
4004   'data': { 'location':         'BlockdevOptionsRbd',
4005             'size':             'size',
4006             '*cluster-size' :   'size' } }
4009 # @SheepdogRedundancyType:
4011 # @full             Create a fully replicated vdi with x copies
4012 # @erasure-coded    Create an erasure coded vdi with x data strips and
4013 #                   y parity strips
4015 # Since: 2.12
4017 { 'enum': 'SheepdogRedundancyType',
4018   'data': [ 'full', 'erasure-coded' ] }
4021 # @SheepdogRedundancyFull:
4023 # @copies           Number of copies to use (between 1 and 31)
4025 # Since: 2.12
4027 { 'struct': 'SheepdogRedundancyFull',
4028   'data': { 'copies': 'int' }}
4031 # @SheepdogRedundancyErasureCoded:
4033 # @data-strips      Number of data strips to use (one of {2,4,8,16})
4034 # @parity-strips    Number of parity strips to use (between 1 and 15)
4036 # Since: 2.12
4038 { 'struct': 'SheepdogRedundancyErasureCoded',
4039   'data': { 'data-strips': 'int',
4040             'parity-strips': 'int' }}
4043 # @SheepdogRedundancy:
4045 # Since: 2.12
4047 { 'union': 'SheepdogRedundancy',
4048   'base': { 'type': 'SheepdogRedundancyType' },
4049   'discriminator': 'type',
4050   'data': { 'full': 'SheepdogRedundancyFull',
4051             'erasure-coded': 'SheepdogRedundancyErasureCoded' } }
4054 # @BlockdevCreateOptionsSheepdog:
4056 # Driver specific image creation options for Sheepdog.
4058 # @location         Where to store the new image file
4059 # @size             Size of the virtual disk in bytes
4060 # @backing-file     File name of a base image
4061 # @preallocation    Preallocation mode (allowed values: off, full)
4062 # @redundancy       Redundancy of the image
4063 # @object-size      Object size of the image
4065 # Since: 2.12
4067 { 'struct': 'BlockdevCreateOptionsSheepdog',
4068   'data': { 'location':         'BlockdevOptionsSheepdog',
4069             'size':             'size',
4070             '*backing-file':    'str',
4071             '*preallocation':   'PreallocMode',
4072             '*redundancy':      'SheepdogRedundancy',
4073             '*object-size':     'size' } }
4076 # @BlockdevCreateOptionsSsh:
4078 # Driver specific image creation options for SSH.
4080 # @location         Where to store the new image file
4081 # @size             Size of the virtual disk in bytes
4083 # Since: 2.12
4085 { 'struct': 'BlockdevCreateOptionsSsh',
4086   'data': { 'location':         'BlockdevOptionsSsh',
4087             'size':             'size' } }
4090 # @BlockdevCreateOptionsVdi:
4092 # Driver specific image creation options for VDI.
4094 # @file             Node to create the image format on
4095 # @size             Size of the virtual disk in bytes
4096 # @preallocation    Preallocation mode for the new image (allowed values: off,
4097 #                   metadata; default: off)
4099 # Since: 2.12
4101 { 'struct': 'BlockdevCreateOptionsVdi',
4102   'data': { 'file':             'BlockdevRef',
4103             'size':             'size',
4104             '*preallocation':   'PreallocMode' } }
4107 # @BlockdevVhdxSubformat:
4109 # @dynamic: Growing image file
4110 # @fixed:   Preallocated fixed-size image file
4112 # Since: 2.12
4114 { 'enum': 'BlockdevVhdxSubformat',
4115   'data': [ 'dynamic', 'fixed' ] }
4118 # @BlockdevCreateOptionsVhdx:
4120 # Driver specific image creation options for vhdx.
4122 # @file             Node to create the image format on
4123 # @size             Size of the virtual disk in bytes
4124 # @log-size         Log size in bytes, must be a multiple of 1 MB
4125 #                   (default: 1 MB)
4126 # @block-size       Block size in bytes, must be a multiple of 1 MB and not
4127 #                   larger than 256 MB (default: automatically choose a block
4128 #                   size depending on the image size)
4129 # @subformat        vhdx subformat (default: dynamic)
4130 # @block-state-zero Force use of payload blocks of type 'ZERO'. Non-standard,
4131 #                   but default.  Do not set to 'off' when using 'qemu-img
4132 #                   convert' with subformat=dynamic.
4134 # Since: 2.12
4136 { 'struct': 'BlockdevCreateOptionsVhdx',
4137   'data': { 'file':                 'BlockdevRef',
4138             'size':                 'size',
4139             '*log-size':            'size',
4140             '*block-size':          'size',
4141             '*subformat':           'BlockdevVhdxSubformat',
4142             '*block-state-zero':    'bool' } }
4145 # @BlockdevVpcSubformat:
4147 # @dynamic: Growing image file
4148 # @fixed:   Preallocated fixed-size image file
4150 # Since: 2.12
4152 { 'enum': 'BlockdevVpcSubformat',
4153   'data': [ 'dynamic', 'fixed' ] }
4156 # @BlockdevCreateOptionsVpc:
4158 # Driver specific image creation options for vpc (VHD).
4160 # @file             Node to create the image format on
4161 # @size             Size of the virtual disk in bytes
4162 # @subformat        vhdx subformat (default: dynamic)
4163 # @force-size       Force use of the exact byte size instead of rounding to the
4164 #                   next size that can be represented in CHS geometry
4165 #                   (default: false)
4167 # Since: 2.12
4169 { 'struct': 'BlockdevCreateOptionsVpc',
4170   'data': { 'file':                 'BlockdevRef',
4171             'size':                 'size',
4172             '*subformat':           'BlockdevVpcSubformat',
4173             '*force-size':          'bool' } }
4176 # @BlockdevCreateOptions:
4178 # Options for creating an image format on a given node.
4180 # @driver           block driver to create the image format
4182 # Since: 2.12
4184 { 'union': 'BlockdevCreateOptions',
4185   'base': {
4186       'driver':         'BlockdevDriver' },
4187   'discriminator': 'driver',
4188   'data': {
4189       'file':           'BlockdevCreateOptionsFile',
4190       'gluster':        'BlockdevCreateOptionsGluster',
4191       'luks':           'BlockdevCreateOptionsLUKS',
4192       'nfs':            'BlockdevCreateOptionsNfs',
4193       'parallels':      'BlockdevCreateOptionsParallels',
4194       'qcow':           'BlockdevCreateOptionsQcow',
4195       'qcow2':          'BlockdevCreateOptionsQcow2',
4196       'qed':            'BlockdevCreateOptionsQed',
4197       'rbd':            'BlockdevCreateOptionsRbd',
4198       'sheepdog':       'BlockdevCreateOptionsSheepdog',
4199       'ssh':            'BlockdevCreateOptionsSsh',
4200       'vdi':            'BlockdevCreateOptionsVdi',
4201       'vhdx':           'BlockdevCreateOptionsVhdx',
4202       'vpc':            'BlockdevCreateOptionsVpc'
4203   } }
4206 # @blockdev-create:
4208 # Starts a job to create an image format on a given node. The job is
4209 # automatically finalized, but a manual job-dismiss is required.
4211 # @job-id:          Identifier for the newly created job.
4213 # @options:         Options for the image creation.
4215 # Since: 3.0
4217 { 'command': 'blockdev-create',
4218   'data': { 'job-id': 'str',
4219             'options': 'BlockdevCreateOptions' } }
4222 # @blockdev-open-tray:
4224 # Opens a block device's tray. If there is a block driver state tree inserted as
4225 # a medium, it will become inaccessible to the guest (but it will remain
4226 # associated to the block device, so closing the tray will make it accessible
4227 # again).
4229 # If the tray was already open before, this will be a no-op.
4231 # Once the tray opens, a DEVICE_TRAY_MOVED event is emitted. There are cases in
4232 # which no such event will be generated, these include:
4233 # - if the guest has locked the tray, @force is false and the guest does not
4234 #   respond to the eject request
4235 # - if the BlockBackend denoted by @device does not have a guest device attached
4236 #   to it
4237 # - if the guest device does not have an actual tray
4239 # @device: Block device name (deprecated, use @id instead)
4241 # @id:     The name or QOM path of the guest device (since: 2.8)
4243 # @force:  if false (the default), an eject request will be sent to
4244 #          the guest if it has locked the tray (and the tray will not be opened
4245 #          immediately); if true, the tray will be opened regardless of whether
4246 #          it is locked
4248 # Since: 2.5
4250 # Example:
4252 # -> { "execute": "blockdev-open-tray",
4253 #      "arguments": { "id": "ide0-1-0" } }
4255 # <- { "timestamp": { "seconds": 1418751016,
4256 #                     "microseconds": 716996 },
4257 #      "event": "DEVICE_TRAY_MOVED",
4258 #      "data": { "device": "ide1-cd0",
4259 #                "id": "ide0-1-0",
4260 #                "tray-open": true } }
4262 # <- { "return": {} }
4265 { 'command': 'blockdev-open-tray',
4266   'data': { '*device': 'str',
4267             '*id': 'str',
4268             '*force': 'bool' } }
4271 # @blockdev-close-tray:
4273 # Closes a block device's tray. If there is a block driver state tree associated
4274 # with the block device (which is currently ejected), that tree will be loaded
4275 # as the medium.
4277 # If the tray was already closed before, this will be a no-op.
4279 # @device:  Block device name (deprecated, use @id instead)
4281 # @id:      The name or QOM path of the guest device (since: 2.8)
4283 # Since: 2.5
4285 # Example:
4287 # -> { "execute": "blockdev-close-tray",
4288 #      "arguments": { "id": "ide0-1-0" } }
4290 # <- { "timestamp": { "seconds": 1418751345,
4291 #                     "microseconds": 272147 },
4292 #      "event": "DEVICE_TRAY_MOVED",
4293 #      "data": { "device": "ide1-cd0",
4294 #                "id": "ide0-1-0",
4295 #                "tray-open": false } }
4297 # <- { "return": {} }
4300 { 'command': 'blockdev-close-tray',
4301   'data': { '*device': 'str',
4302             '*id': 'str' } }
4305 # @blockdev-remove-medium:
4307 # Removes a medium (a block driver state tree) from a block device. That block
4308 # device's tray must currently be open (unless there is no attached guest
4309 # device).
4311 # If the tray is open and there is no medium inserted, this will be a no-op.
4313 # @id:     The name or QOM path of the guest device
4315 # Since: 2.12
4317 # Example:
4319 # -> { "execute": "blockdev-remove-medium",
4320 #      "arguments": { "id": "ide0-1-0" } }
4322 # <- { "error": { "class": "GenericError",
4323 #                 "desc": "Tray of device 'ide0-1-0' is not open" } }
4325 # -> { "execute": "blockdev-open-tray",
4326 #      "arguments": { "id": "ide0-1-0" } }
4328 # <- { "timestamp": { "seconds": 1418751627,
4329 #                     "microseconds": 549958 },
4330 #      "event": "DEVICE_TRAY_MOVED",
4331 #      "data": { "device": "ide1-cd0",
4332 #                "id": "ide0-1-0",
4333 #                "tray-open": true } }
4335 # <- { "return": {} }
4337 # -> { "execute": "blockdev-remove-medium",
4338 #      "arguments": { "id": "ide0-1-0" } }
4340 # <- { "return": {} }
4343 { 'command': 'blockdev-remove-medium',
4344   'data': { 'id': 'str' } }
4347 # @blockdev-insert-medium:
4349 # Inserts a medium (a block driver state tree) into a block device. That block
4350 # device's tray must currently be open (unless there is no attached guest
4351 # device) and there must be no medium inserted already.
4353 # @id:        The name or QOM path of the guest device
4355 # @node-name: name of a node in the block driver state graph
4357 # Since: 2.12
4359 # Example:
4361 # -> { "execute": "blockdev-add",
4362 #      "arguments": {
4363 #          "node-name": "node0",
4364 #          "driver": "raw",
4365 #          "file": { "driver": "file",
4366 #                    "filename": "fedora.iso" } } }
4367 # <- { "return": {} }
4369 # -> { "execute": "blockdev-insert-medium",
4370 #      "arguments": { "id": "ide0-1-0",
4371 #                     "node-name": "node0" } }
4373 # <- { "return": {} }
4376 { 'command': 'blockdev-insert-medium',
4377   'data': { 'id': 'str',
4378             'node-name': 'str'} }
4382 # @BlockdevChangeReadOnlyMode:
4384 # Specifies the new read-only mode of a block device subject to the
4385 # @blockdev-change-medium command.
4387 # @retain:      Retains the current read-only mode
4389 # @read-only:   Makes the device read-only
4391 # @read-write:  Makes the device writable
4393 # Since: 2.3
4396 { 'enum': 'BlockdevChangeReadOnlyMode',
4397   'data': ['retain', 'read-only', 'read-write'] }
4401 # @blockdev-change-medium:
4403 # Changes the medium inserted into a block device by ejecting the current medium
4404 # and loading a new image file which is inserted as the new medium (this command
4405 # combines blockdev-open-tray, blockdev-remove-medium, blockdev-insert-medium
4406 # and blockdev-close-tray).
4408 # @device:          Block device name (deprecated, use @id instead)
4410 # @id:              The name or QOM path of the guest device
4411 #                   (since: 2.8)
4413 # @filename:        filename of the new image to be loaded
4415 # @format:          format to open the new image with (defaults to
4416 #                   the probed format)
4418 # @read-only-mode:  change the read-only mode of the device; defaults
4419 #                   to 'retain'
4421 # Since: 2.5
4423 # Examples:
4425 # 1. Change a removable medium
4427 # -> { "execute": "blockdev-change-medium",
4428 #      "arguments": { "id": "ide0-1-0",
4429 #                     "filename": "/srv/images/Fedora-12-x86_64-DVD.iso",
4430 #                     "format": "raw" } }
4431 # <- { "return": {} }
4433 # 2. Load a read-only medium into a writable drive
4435 # -> { "execute": "blockdev-change-medium",
4436 #      "arguments": { "id": "floppyA",
4437 #                     "filename": "/srv/images/ro.img",
4438 #                     "format": "raw",
4439 #                     "read-only-mode": "retain" } }
4441 # <- { "error":
4442 #      { "class": "GenericError",
4443 #        "desc": "Could not open '/srv/images/ro.img': Permission denied" } }
4445 # -> { "execute": "blockdev-change-medium",
4446 #      "arguments": { "id": "floppyA",
4447 #                     "filename": "/srv/images/ro.img",
4448 #                     "format": "raw",
4449 #                     "read-only-mode": "read-only" } }
4451 # <- { "return": {} }
4454 { 'command': 'blockdev-change-medium',
4455   'data': { '*device': 'str',
4456             '*id': 'str',
4457             'filename': 'str',
4458             '*format': 'str',
4459             '*read-only-mode': 'BlockdevChangeReadOnlyMode' } }
4463 # @BlockErrorAction:
4465 # An enumeration of action that has been taken when a DISK I/O occurs
4467 # @ignore: error has been ignored
4469 # @report: error has been reported to the device
4471 # @stop: error caused VM to be stopped
4473 # Since: 2.1
4475 { 'enum': 'BlockErrorAction',
4476   'data': [ 'ignore', 'report', 'stop' ] }
4480 # @BLOCK_IMAGE_CORRUPTED:
4482 # Emitted when a disk image is being marked corrupt. The image can be
4483 # identified by its device or node name. The 'device' field is always
4484 # present for compatibility reasons, but it can be empty ("") if the
4485 # image does not have a device name associated.
4487 # @device: device name. This is always present for compatibility
4488 #          reasons, but it can be empty ("") if the image does not
4489 #          have a device name associated.
4491 # @node-name: node name (Since: 2.4)
4493 # @msg: informative message for human consumption, such as the kind of
4494 #       corruption being detected. It should not be parsed by machine as it is
4495 #       not guaranteed to be stable
4497 # @offset: if the corruption resulted from an image access, this is
4498 #          the host's access offset into the image
4500 # @size: if the corruption resulted from an image access, this is
4501 #        the access size
4503 # @fatal: if set, the image is marked corrupt and therefore unusable after this
4504 #        event and must be repaired (Since 2.2; before, every
4505 #        BLOCK_IMAGE_CORRUPTED event was fatal)
4507 # Note: If action is "stop", a STOP event will eventually follow the
4508 #       BLOCK_IO_ERROR event.
4510 # Example:
4512 # <- { "event": "BLOCK_IMAGE_CORRUPTED",
4513 #      "data": { "device": "ide0-hd0", "node-name": "node0",
4514 #                "msg": "Prevented active L1 table overwrite", "offset": 196608,
4515 #                "size": 65536 },
4516 #      "timestamp": { "seconds": 1378126126, "microseconds": 966463 } }
4518 # Since: 1.7
4520 { 'event': 'BLOCK_IMAGE_CORRUPTED',
4521   'data': { 'device'     : 'str',
4522             '*node-name' : 'str',
4523             'msg'        : 'str',
4524             '*offset'    : 'int',
4525             '*size'      : 'int',
4526             'fatal'      : 'bool' } }
4529 # @BLOCK_IO_ERROR:
4531 # Emitted when a disk I/O error occurs
4533 # @device: device name. This is always present for compatibility
4534 #          reasons, but it can be empty ("") if the image does not
4535 #          have a device name associated.
4537 # @node-name: node name. Note that errors may be reported for the root node
4538 #             that is directly attached to a guest device rather than for the
4539 #             node where the error occurred. The node name is not present if
4540 #             the drive is empty. (Since: 2.8)
4542 # @operation: I/O operation
4544 # @action: action that has been taken
4546 # @nospace: true if I/O error was caused due to a no-space
4547 #           condition. This key is only present if query-block's
4548 #           io-status is present, please see query-block documentation
4549 #           for more information (since: 2.2)
4551 # @reason: human readable string describing the error cause.
4552 #          (This field is a debugging aid for humans, it should not
4553 #           be parsed by applications) (since: 2.2)
4555 # Note: If action is "stop", a STOP event will eventually follow the
4556 # BLOCK_IO_ERROR event
4558 # Since: 0.13.0
4560 # Example:
4562 # <- { "event": "BLOCK_IO_ERROR",
4563 #      "data": { "device": "ide0-hd1",
4564 #                "node-name": "#block212",
4565 #                "operation": "write",
4566 #                "action": "stop" },
4567 #      "timestamp": { "seconds": 1265044230, "microseconds": 450486 } }
4570 { 'event': 'BLOCK_IO_ERROR',
4571   'data': { 'device': 'str', '*node-name': 'str',
4572             'operation': 'IoOperationType',
4573             'action': 'BlockErrorAction', '*nospace': 'bool',
4574             'reason': 'str' } }
4577 # @BLOCK_JOB_COMPLETED:
4579 # Emitted when a block job has completed
4581 # @type: job type
4583 # @device: The job identifier. Originally the device name but other
4584 #          values are allowed since QEMU 2.7
4586 # @len: maximum progress value
4588 # @offset: current progress value. On success this is equal to len.
4589 #          On failure this is less than len
4591 # @speed: rate limit, bytes per second
4593 # @error: error message. Only present on failure. This field
4594 #         contains a human-readable error message. There are no semantics
4595 #         other than that streaming has failed and clients should not try to
4596 #         interpret the error string
4598 # Since: 1.1
4600 # Example:
4602 # <- { "event": "BLOCK_JOB_COMPLETED",
4603 #      "data": { "type": "stream", "device": "virtio-disk0",
4604 #                "len": 10737418240, "offset": 10737418240,
4605 #                "speed": 0 },
4606 #      "timestamp": { "seconds": 1267061043, "microseconds": 959568 } }
4609 { 'event': 'BLOCK_JOB_COMPLETED',
4610   'data': { 'type'  : 'JobType',
4611             'device': 'str',
4612             'len'   : 'int',
4613             'offset': 'int',
4614             'speed' : 'int',
4615             '*error': 'str' } }
4618 # @BLOCK_JOB_CANCELLED:
4620 # Emitted when a block job has been cancelled
4622 # @type: job type
4624 # @device: The job identifier. Originally the device name but other
4625 #          values are allowed since QEMU 2.7
4627 # @len: maximum progress value
4629 # @offset: current progress value. On success this is equal to len.
4630 #          On failure this is less than len
4632 # @speed: rate limit, bytes per second
4634 # Since: 1.1
4636 # Example:
4638 # <- { "event": "BLOCK_JOB_CANCELLED",
4639 #      "data": { "type": "stream", "device": "virtio-disk0",
4640 #                "len": 10737418240, "offset": 134217728,
4641 #                "speed": 0 },
4642 #      "timestamp": { "seconds": 1267061043, "microseconds": 959568 } }
4645 { 'event': 'BLOCK_JOB_CANCELLED',
4646   'data': { 'type'  : 'JobType',
4647             'device': 'str',
4648             'len'   : 'int',
4649             'offset': 'int',
4650             'speed' : 'int' } }
4653 # @BLOCK_JOB_ERROR:
4655 # Emitted when a block job encounters an error
4657 # @device: The job identifier. Originally the device name but other
4658 #          values are allowed since QEMU 2.7
4660 # @operation: I/O operation
4662 # @action: action that has been taken
4664 # Since: 1.3
4666 # Example:
4668 # <- { "event": "BLOCK_JOB_ERROR",
4669 #      "data": { "device": "ide0-hd1",
4670 #                "operation": "write",
4671 #                "action": "stop" },
4672 #      "timestamp": { "seconds": 1265044230, "microseconds": 450486 } }
4675 { 'event': 'BLOCK_JOB_ERROR',
4676   'data': { 'device'   : 'str',
4677             'operation': 'IoOperationType',
4678             'action'   : 'BlockErrorAction' } }
4681 # @BLOCK_JOB_READY:
4683 # Emitted when a block job is ready to complete
4685 # @type: job type
4687 # @device: The job identifier. Originally the device name but other
4688 #          values are allowed since QEMU 2.7
4690 # @len: maximum progress value
4692 # @offset: current progress value. On success this is equal to len.
4693 #          On failure this is less than len
4695 # @speed: rate limit, bytes per second
4697 # Note: The "ready to complete" status is always reset by a @BLOCK_JOB_ERROR
4698 # event
4700 # Since: 1.3
4702 # Example:
4704 # <- { "event": "BLOCK_JOB_READY",
4705 #      "data": { "device": "drive0", "type": "mirror", "speed": 0,
4706 #                "len": 2097152, "offset": 2097152 }
4707 #      "timestamp": { "seconds": 1265044230, "microseconds": 450486 } }
4710 { 'event': 'BLOCK_JOB_READY',
4711   'data': { 'type'  : 'JobType',
4712             'device': 'str',
4713             'len'   : 'int',
4714             'offset': 'int',
4715             'speed' : 'int' } }
4718 # @BLOCK_JOB_PENDING:
4720 # Emitted when a block job is awaiting explicit authorization to finalize graph
4721 # changes via @block-job-finalize. If this job is part of a transaction, it will
4722 # not emit this event until the transaction has converged first.
4724 # @type: job type
4726 # @id: The job identifier.
4728 # Since: 2.12
4730 # Example:
4732 # <- { "event": "BLOCK_JOB_WAITING",
4733 #      "data": { "device": "drive0", "type": "mirror" },
4734 #      "timestamp": { "seconds": 1265044230, "microseconds": 450486 } }
4737 { 'event': 'BLOCK_JOB_PENDING',
4738   'data': { 'type'  : 'JobType',
4739             'id'    : 'str' } }
4742 # @PreallocMode:
4744 # Preallocation mode of QEMU image file
4746 # @off: no preallocation
4747 # @metadata: preallocate only for metadata
4748 # @falloc: like @full preallocation but allocate disk space by
4749 #          posix_fallocate() rather than writing zeros.
4750 # @full: preallocate all data by writing zeros to device to ensure disk
4751 #        space is really available. @full preallocation also sets up
4752 #        metadata correctly.
4754 # Since: 2.2
4756 { 'enum': 'PreallocMode',
4757   'data': [ 'off', 'metadata', 'falloc', 'full' ] }
4760 # @BLOCK_WRITE_THRESHOLD:
4762 # Emitted when writes on block device reaches or exceeds the
4763 # configured write threshold. For thin-provisioned devices, this
4764 # means the device should be extended to avoid pausing for
4765 # disk exhaustion.
4766 # The event is one shot. Once triggered, it needs to be
4767 # re-registered with another block-set-write-threshold command.
4769 # @node-name: graph node name on which the threshold was exceeded.
4771 # @amount-exceeded: amount of data which exceeded the threshold, in bytes.
4773 # @write-threshold: last configured threshold, in bytes.
4775 # Since: 2.3
4777 { 'event': 'BLOCK_WRITE_THRESHOLD',
4778   'data': { 'node-name': 'str',
4779             'amount-exceeded': 'uint64',
4780             'write-threshold': 'uint64' } }
4783 # @block-set-write-threshold:
4785 # Change the write threshold for a block drive. An event will be
4786 # delivered if a write to this block drive crosses the configured
4787 # threshold.  The threshold is an offset, thus must be
4788 # non-negative. Default is no write threshold. Setting the threshold
4789 # to zero disables it.
4791 # This is useful to transparently resize thin-provisioned drives without
4792 # the guest OS noticing.
4794 # @node-name: graph node name on which the threshold must be set.
4796 # @write-threshold: configured threshold for the block device, bytes.
4797 #                   Use 0 to disable the threshold.
4799 # Since: 2.3
4801 # Example:
4803 # -> { "execute": "block-set-write-threshold",
4804 #      "arguments": { "node-name": "mydev",
4805 #                     "write-threshold": 17179869184 } }
4806 # <- { "return": {} }
4809 { 'command': 'block-set-write-threshold',
4810   'data': { 'node-name': 'str', 'write-threshold': 'uint64' } }
4813 # @x-blockdev-change:
4815 # Dynamically reconfigure the block driver state graph. It can be used
4816 # to add, remove, insert or replace a graph node. Currently only the
4817 # Quorum driver implements this feature to add or remove its child. This
4818 # is useful to fix a broken quorum child.
4820 # If @node is specified, it will be inserted under @parent. @child
4821 # may not be specified in this case. If both @parent and @child are
4822 # specified but @node is not, @child will be detached from @parent.
4824 # @parent: the id or name of the parent node.
4826 # @child: the name of a child under the given parent node.
4828 # @node: the name of the node that will be added.
4830 # Note: this command is experimental, and its API is not stable. It
4831 # does not support all kinds of operations, all kinds of children, nor
4832 # all block drivers.
4834 # FIXME Removing children from a quorum node means introducing gaps in the
4835 # child indices. This cannot be represented in the 'children' list of
4836 # BlockdevOptionsQuorum, as returned by .bdrv_refresh_filename().
4838 # Warning: The data in a new quorum child MUST be consistent with that of
4839 # the rest of the array.
4841 # Since: 2.7
4843 # Example:
4845 # 1. Add a new node to a quorum
4846 # -> { "execute": "blockdev-add",
4847 #      "arguments": {
4848 #          "driver": "raw",
4849 #          "node-name": "new_node",
4850 #          "file": { "driver": "file",
4851 #                    "filename": "test.raw" } } }
4852 # <- { "return": {} }
4853 # -> { "execute": "x-blockdev-change",
4854 #      "arguments": { "parent": "disk1",
4855 #                     "node": "new_node" } }
4856 # <- { "return": {} }
4858 # 2. Delete a quorum's node
4859 # -> { "execute": "x-blockdev-change",
4860 #      "arguments": { "parent": "disk1",
4861 #                     "child": "children.1" } }
4862 # <- { "return": {} }
4865 { 'command': 'x-blockdev-change',
4866   'data' : { 'parent': 'str',
4867              '*child': 'str',
4868              '*node': 'str' } }
4871 # @x-blockdev-set-iothread:
4873 # Move @node and its children into the @iothread.  If @iothread is null then
4874 # move @node and its children into the main loop.
4876 # The node must not be attached to a BlockBackend.
4878 # @node-name: the name of the block driver node
4880 # @iothread: the name of the IOThread object or null for the main loop
4882 # @force: true if the node and its children should be moved when a BlockBackend
4883 #         is already attached
4885 # Note: this command is experimental and intended for test cases that need
4886 # control over IOThreads only.
4888 # Since: 2.12
4890 # Example:
4892 # 1. Move a node into an IOThread
4893 # -> { "execute": "x-blockdev-set-iothread",
4894 #      "arguments": { "node-name": "disk1",
4895 #                     "iothread": "iothread0" } }
4896 # <- { "return": {} }
4898 # 2. Move a node into the main loop
4899 # -> { "execute": "x-blockdev-set-iothread",
4900 #      "arguments": { "node-name": "disk1",
4901 #                     "iothread": null } }
4902 # <- { "return": {} }
4905 { 'command': 'x-blockdev-set-iothread',
4906   'data' : { 'node-name': 'str',
4907              'iothread': 'StrOrNull',
4908              '*force': 'bool' } }