spapr: move the interrupt presenters under machine_data
[qemu/ar7.git] / qapi / block-core.json
blob5f17d67d7140af414d0db83f9795a728dde98c74
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',
1147   'data': { '*device': 'str',
1148             '*node-name': 'str',
1149             'password': 'str' } }
1152 # @block_resize:
1154 # Resize a block image while a guest is running.
1156 # Either @device or @node-name must be set but not both.
1158 # @device: the name of the device to get the image resized
1160 # @node-name: graph node name to get the image resized (Since 2.0)
1162 # @size:  new image size in bytes
1164 # Returns: nothing on success
1165 #          If @device is not a valid block device, DeviceNotFound
1167 # Since: 0.14.0
1169 # Example:
1171 # -> { "execute": "block_resize",
1172 #      "arguments": { "device": "scratch", "size": 1073741824 } }
1173 # <- { "return": {} }
1176 { 'command': 'block_resize',
1177   'data': { '*device': 'str',
1178             '*node-name': 'str',
1179             'size': 'int' } }
1182 # @NewImageMode:
1184 # An enumeration that tells QEMU how to set the backing file path in
1185 # a new image file.
1187 # @existing: QEMU should look for an existing image file.
1189 # @absolute-paths: QEMU should create a new image with absolute paths
1190 # for the backing file. If there is no backing file available, the new
1191 # image will not be backed either.
1193 # Since: 1.1
1195 { 'enum': 'NewImageMode',
1196   'data': [ 'existing', 'absolute-paths' ] }
1199 # @BlockdevSnapshotSync:
1201 # Either @device or @node-name must be set but not both.
1203 # @device: the name of the device to generate the snapshot from.
1205 # @node-name: graph node name to generate the snapshot from (Since 2.0)
1207 # @snapshot-file: the target of the new image. If the file exists, or
1208 # if it is a device, the snapshot will be created in the existing
1209 # file/device. Otherwise, a new file will be created.
1211 # @snapshot-node-name: the graph node name of the new image (Since 2.0)
1213 # @format: the format of the snapshot image, default is 'qcow2'.
1215 # @mode: whether and how QEMU should create a new image, default is
1216 #        'absolute-paths'.
1218 { 'struct': 'BlockdevSnapshotSync',
1219   'data': { '*device': 'str', '*node-name': 'str',
1220             'snapshot-file': 'str', '*snapshot-node-name': 'str',
1221             '*format': 'str', '*mode': 'NewImageMode' } }
1224 # @BlockdevSnapshot:
1226 # @node: device or node name that will have a snapshot created.
1228 # @overlay: reference to the existing block device that will become
1229 #           the overlay of @node, as part of creating the snapshot.
1230 #           It must not have a current backing file (this can be
1231 #           achieved by passing "backing": null to blockdev-add).
1233 # Since: 2.5
1235 { 'struct': 'BlockdevSnapshot',
1236   'data': { 'node': 'str', 'overlay': 'str' } }
1239 # @DriveBackup:
1241 # @job-id: identifier for the newly-created block job. If
1242 #          omitted, the device name will be used. (Since 2.7)
1244 # @device: the device name or node-name of a root node which should be copied.
1246 # @target: the target of the new image. If the file exists, or if it
1247 #          is a device, the existing file/device will be used as the new
1248 #          destination.  If it does not exist, a new file will be created.
1250 # @format: the format of the new destination, default is to
1251 #          probe if @mode is 'existing', else the format of the source
1253 # @sync: what parts of the disk image should be copied to the destination
1254 #        (all the disk, only the sectors allocated in the topmost image, from a
1255 #        dirty bitmap, or only new I/O).
1257 # @mode: whether and how QEMU should create a new image, default is
1258 #        'absolute-paths'.
1260 # @speed: the maximum speed, in bytes per second
1262 # @bitmap: the name of dirty bitmap if sync is "incremental".
1263 #          Must be present if sync is "incremental", must NOT be present
1264 #          otherwise. (Since 2.4)
1266 # @compress: true to compress data, if the target format supports it.
1267 #            (default: false) (since 2.8)
1269 # @on-source-error: the action to take on an error on the source,
1270 #                   default 'report'.  'stop' and 'enospc' can only be used
1271 #                   if the block device supports io-status (see BlockInfo).
1273 # @on-target-error: the action to take on an error on the target,
1274 #                   default 'report' (no limitations, since this applies to
1275 #                   a different block device than @device).
1277 # @auto-finalize: When false, this job will wait in a PENDING state after it has
1278 #                 finished its work, waiting for @block-job-finalize before
1279 #                 making any block graph changes.
1280 #                 When true, this job will automatically
1281 #                 perform its abort or commit actions.
1282 #                 Defaults to true. (Since 2.12)
1284 # @auto-dismiss: When false, this job will wait in a CONCLUDED state after it
1285 #                has completely ceased all work, and awaits @block-job-dismiss.
1286 #                When true, this job will automatically disappear from the query
1287 #                list without user intervention.
1288 #                Defaults to true. (Since 2.12)
1290 # Note: @on-source-error and @on-target-error only affect background
1291 # I/O.  If an error occurs during a guest write request, the device's
1292 # rerror/werror actions will be used.
1294 # Since: 1.6
1296 { 'struct': 'DriveBackup',
1297   'data': { '*job-id': 'str', 'device': 'str', 'target': 'str',
1298             '*format': 'str', 'sync': 'MirrorSyncMode',
1299             '*mode': 'NewImageMode', '*speed': 'int',
1300             '*bitmap': 'str', '*compress': 'bool',
1301             '*on-source-error': 'BlockdevOnError',
1302             '*on-target-error': 'BlockdevOnError',
1303             '*auto-finalize': 'bool', '*auto-dismiss': 'bool' } }
1306 # @BlockdevBackup:
1308 # @job-id: identifier for the newly-created block job. If
1309 #          omitted, the device name will be used. (Since 2.7)
1311 # @device: the device name or node-name of a root node which should be copied.
1313 # @target: the device name or node-name of the backup target node.
1315 # @sync: what parts of the disk image should be copied to the destination
1316 #        (all the disk, only the sectors allocated in the topmost image, or
1317 #        only new I/O).
1319 # @speed: the maximum speed, in bytes per second. The default is 0,
1320 #         for unlimited.
1322 # @bitmap: the name of dirty bitmap if sync is "incremental".
1323 #          Must be present if sync is "incremental", must NOT be present
1324 #          otherwise. (Since 3.1)
1326 # @compress: true to compress data, if the target format supports it.
1327 #            (default: false) (since 2.8)
1329 # @on-source-error: the action to take on an error on the source,
1330 #                   default 'report'.  'stop' and 'enospc' can only be used
1331 #                   if the block device supports io-status (see BlockInfo).
1333 # @on-target-error: the action to take on an error on the target,
1334 #                   default 'report' (no limitations, since this applies to
1335 #                   a different block device than @device).
1337 # @auto-finalize: When false, this job will wait in a PENDING state after it has
1338 #                 finished its work, waiting for @block-job-finalize before
1339 #                 making any block graph changes.
1340 #                 When true, this job will automatically
1341 #                 perform its abort or commit actions.
1342 #                 Defaults to true. (Since 2.12)
1344 # @auto-dismiss: When false, this job will wait in a CONCLUDED state after it
1345 #                has completely ceased all work, and awaits @block-job-dismiss.
1346 #                When true, this job will automatically disappear from the query
1347 #                list without user intervention.
1348 #                Defaults to true. (Since 2.12)
1350 # Note: @on-source-error and @on-target-error only affect background
1351 # I/O.  If an error occurs during a guest write request, the device's
1352 # rerror/werror actions will be used.
1354 # Since: 2.3
1356 { 'struct': 'BlockdevBackup',
1357   'data': { '*job-id': 'str', 'device': 'str', 'target': 'str',
1358             'sync': 'MirrorSyncMode', '*speed': 'int',
1359             '*bitmap': 'str', '*compress': 'bool',
1360             '*on-source-error': 'BlockdevOnError',
1361             '*on-target-error': 'BlockdevOnError',
1362             '*auto-finalize': 'bool', '*auto-dismiss': 'bool' } }
1365 # @blockdev-snapshot-sync:
1367 # Generates a synchronous snapshot of a block device.
1369 # For the arguments, see the documentation of BlockdevSnapshotSync.
1371 # Returns: nothing on success
1372 #          If @device is not a valid block device, DeviceNotFound
1374 # Since: 0.14.0
1376 # Example:
1378 # -> { "execute": "blockdev-snapshot-sync",
1379 #      "arguments": { "device": "ide-hd0",
1380 #                     "snapshot-file":
1381 #                     "/some/place/my-image",
1382 #                     "format": "qcow2" } }
1383 # <- { "return": {} }
1386 { 'command': 'blockdev-snapshot-sync',
1387   'data': 'BlockdevSnapshotSync' }
1391 # @blockdev-snapshot:
1393 # Generates a snapshot of a block device.
1395 # Create a snapshot, by installing 'node' as the backing image of
1396 # 'overlay'. Additionally, if 'node' is associated with a block
1397 # device, the block device changes to using 'overlay' as its new active
1398 # image.
1400 # For the arguments, see the documentation of BlockdevSnapshot.
1402 # Since: 2.5
1404 # Example:
1406 # -> { "execute": "blockdev-add",
1407 #      "arguments": { "driver": "qcow2",
1408 #                     "node-name": "node1534",
1409 #                     "file": { "driver": "file",
1410 #                               "filename": "hd1.qcow2" },
1411 #                     "backing": null } }
1413 # <- { "return": {} }
1415 # -> { "execute": "blockdev-snapshot",
1416 #      "arguments": { "node": "ide-hd0",
1417 #                     "overlay": "node1534" } }
1418 # <- { "return": {} }
1421 { 'command': 'blockdev-snapshot',
1422   'data': 'BlockdevSnapshot' }
1425 # @change-backing-file:
1427 # Change the backing file in the image file metadata.  This does not
1428 # cause QEMU to reopen the image file to reparse the backing filename
1429 # (it may, however, perform a reopen to change permissions from
1430 # r/o -> r/w -> r/o, if needed). The new backing file string is written
1431 # into the image file metadata, and the QEMU internal strings are
1432 # updated.
1434 # @image-node-name: The name of the block driver state node of the
1435 #                   image to modify. The "device" argument is used
1436 #                   to verify "image-node-name" is in the chain
1437 #                   described by "device".
1439 # @device:          The device name or node-name of the root node that owns
1440 #                   image-node-name.
1442 # @backing-file:    The string to write as the backing file.  This
1443 #                   string is not validated, so care should be taken
1444 #                   when specifying the string or the image chain may
1445 #                   not be able to be reopened again.
1447 # Returns: Nothing on success
1449 #          If "device" does not exist or cannot be determined, DeviceNotFound
1451 # Since: 2.1
1453 { 'command': 'change-backing-file',
1454   'data': { 'device': 'str', 'image-node-name': 'str',
1455             'backing-file': 'str' } }
1458 # @block-commit:
1460 # Live commit of data from overlay image nodes into backing nodes - i.e.,
1461 # writes data between 'top' and 'base' into 'base'.
1463 # @job-id: identifier for the newly-created block job. If
1464 #          omitted, the device name will be used. (Since 2.7)
1466 # @device:  the device name or node-name of a root node
1468 # @base-node: The node name of the backing image to write data into.
1469 #             If not specified, this is the deepest backing image.
1470 #             (since: 3.1)
1472 # @base: Same as @base-node, except that it is a file name rather than a node
1473 #        name. This must be the exact filename string that was used to open the
1474 #        node; other strings, even if addressing the same file, are not
1475 #        accepted (deprecated, use @base-node instead)
1477 # @top-node: The node name of the backing image within the image chain
1478 #            which contains the topmost data to be committed down. If
1479 #            not specified, this is the active layer. (since: 3.1)
1481 # @top: Same as @top-node, except that it is a file name rather than a node
1482 #       name. This must be the exact filename string that was used to open the
1483 #       node; other strings, even if addressing the same file, are not
1484 #       accepted (deprecated, use @base-node instead)
1486 # @backing-file:  The backing file string to write into the overlay
1487 #                           image of 'top'.  If 'top' is the active layer,
1488 #                           specifying a backing file string is an error. This
1489 #                           filename is not validated.
1491 #                           If a pathname string is such that it cannot be
1492 #                           resolved by QEMU, that means that subsequent QMP or
1493 #                           HMP commands must use node-names for the image in
1494 #                           question, as filename lookup methods will fail.
1496 #                           If not specified, QEMU will automatically determine
1497 #                           the backing file string to use, or error out if
1498 #                           there is no obvious choice. Care should be taken
1499 #                           when specifying the string, to specify a valid
1500 #                           filename or protocol.
1501 #                           (Since 2.1)
1503 #                    If top == base, that is an error.
1504 #                    If top == active, the job will not be completed by itself,
1505 #                    user needs to complete the job with the block-job-complete
1506 #                    command after getting the ready event. (Since 2.0)
1508 #                    If the base image is smaller than top, then the base image
1509 #                    will be resized to be the same size as top.  If top is
1510 #                    smaller than the base image, the base will not be
1511 #                    truncated.  If you want the base image size to match the
1512 #                    size of the smaller top, you can safely truncate it
1513 #                    yourself once the commit operation successfully completes.
1515 # @speed:  the maximum speed, in bytes per second
1517 # @filter-node-name: the node name that should be assigned to the
1518 #                    filter driver that the commit job inserts into the graph
1519 #                    above @top. If this option is not given, a node name is
1520 #                    autogenerated. (Since: 2.9)
1522 # @auto-finalize: When false, this job will wait in a PENDING state after it has
1523 #                 finished its work, waiting for @block-job-finalize before
1524 #                 making any block graph changes.
1525 #                 When true, this job will automatically
1526 #                 perform its abort or commit actions.
1527 #                 Defaults to true. (Since 3.1)
1529 # @auto-dismiss: When false, this job will wait in a CONCLUDED state after it
1530 #                has completely ceased all work, and awaits @block-job-dismiss.
1531 #                When true, this job will automatically disappear from the query
1532 #                list without user intervention.
1533 #                Defaults to true. (Since 3.1)
1535 # Returns: Nothing on success
1536 #          If @device does not exist, DeviceNotFound
1537 #          Any other error returns a GenericError.
1539 # Since: 1.3
1541 # Example:
1543 # -> { "execute": "block-commit",
1544 #      "arguments": { "device": "virtio0",
1545 #                     "top": "/tmp/snap1.qcow2" } }
1546 # <- { "return": {} }
1549 { 'command': 'block-commit',
1550   'data': { '*job-id': 'str', 'device': 'str', '*base-node': 'str',
1551             '*base': 'str', '*top-node': 'str', '*top': 'str',
1552             '*backing-file': 'str', '*speed': 'int',
1553             '*filter-node-name': 'str',
1554             '*auto-finalize': 'bool', '*auto-dismiss': 'bool' } }
1557 # @drive-backup:
1559 # Start a point-in-time copy of a block device to a new destination.  The
1560 # status of ongoing drive-backup operations can be checked with
1561 # query-block-jobs where the BlockJobInfo.type field has the value 'backup'.
1562 # The operation can be stopped before it has completed using the
1563 # block-job-cancel command.
1565 # Returns: nothing on success
1566 #          If @device is not a valid block device, GenericError
1568 # Since: 1.6
1570 # Example:
1572 # -> { "execute": "drive-backup",
1573 #      "arguments": { "device": "drive0",
1574 #                     "sync": "full",
1575 #                     "target": "backup.img" } }
1576 # <- { "return": {} }
1579 { 'command': 'drive-backup', 'boxed': true,
1580   'data': 'DriveBackup' }
1583 # @blockdev-backup:
1585 # Start a point-in-time copy of a block device to a new destination.  The
1586 # status of ongoing blockdev-backup operations can be checked with
1587 # query-block-jobs where the BlockJobInfo.type field has the value 'backup'.
1588 # The operation can be stopped before it has completed using the
1589 # block-job-cancel command.
1591 # Returns: nothing on success
1592 #          If @device is not a valid block device, DeviceNotFound
1594 # Since: 2.3
1596 # Example:
1597 # -> { "execute": "blockdev-backup",
1598 #      "arguments": { "device": "src-id",
1599 #                     "sync": "full",
1600 #                     "target": "tgt-id" } }
1601 # <- { "return": {} }
1604 { 'command': 'blockdev-backup', 'boxed': true,
1605   'data': 'BlockdevBackup' }
1609 # @query-named-block-nodes:
1611 # Get the named block driver list
1613 # Returns: the list of BlockDeviceInfo
1615 # Since: 2.0
1617 # Example:
1619 # -> { "execute": "query-named-block-nodes" }
1620 # <- { "return": [ { "ro":false,
1621 #                    "drv":"qcow2",
1622 #                    "encrypted":false,
1623 #                    "file":"disks/test.qcow2",
1624 #                    "node-name": "my-node",
1625 #                    "backing_file_depth":1,
1626 #                    "bps":1000000,
1627 #                    "bps_rd":0,
1628 #                    "bps_wr":0,
1629 #                    "iops":1000000,
1630 #                    "iops_rd":0,
1631 #                    "iops_wr":0,
1632 #                    "bps_max": 8000000,
1633 #                    "bps_rd_max": 0,
1634 #                    "bps_wr_max": 0,
1635 #                    "iops_max": 0,
1636 #                    "iops_rd_max": 0,
1637 #                    "iops_wr_max": 0,
1638 #                    "iops_size": 0,
1639 #                    "write_threshold": 0,
1640 #                    "image":{
1641 #                       "filename":"disks/test.qcow2",
1642 #                       "format":"qcow2",
1643 #                       "virtual-size":2048000,
1644 #                       "backing_file":"base.qcow2",
1645 #                       "full-backing-filename":"disks/base.qcow2",
1646 #                       "backing-filename-format":"qcow2",
1647 #                       "snapshots":[
1648 #                          {
1649 #                             "id": "1",
1650 #                             "name": "snapshot1",
1651 #                             "vm-state-size": 0,
1652 #                             "date-sec": 10000200,
1653 #                             "date-nsec": 12,
1654 #                             "vm-clock-sec": 206,
1655 #                             "vm-clock-nsec": 30
1656 #                          }
1657 #                       ],
1658 #                       "backing-image":{
1659 #                           "filename":"disks/base.qcow2",
1660 #                           "format":"qcow2",
1661 #                           "virtual-size":2048000
1662 #                       }
1663 #                    } } ] }
1666 { 'command': 'query-named-block-nodes', 'returns': [ 'BlockDeviceInfo' ] }
1669 # @XDbgBlockGraphNodeType:
1671 # @block-backend: corresponds to BlockBackend
1673 # @block-job: corresonds to BlockJob
1675 # @block-driver: corresponds to BlockDriverState
1677 # Since: 4.0
1679 { 'enum': 'XDbgBlockGraphNodeType',
1680   'data': [ 'block-backend', 'block-job', 'block-driver' ] }
1683 # @XDbgBlockGraphNode:
1685 # @id: Block graph node identifier. This @id is generated only for
1686 #      x-debug-query-block-graph and does not relate to any other identifiers in
1687 #      Qemu.
1689 # @type: Type of graph node. Can be one of block-backend, block-job or
1690 #        block-driver-state.
1692 # @name: Human readable name of the node. Corresponds to node-name for
1693 #        block-driver-state nodes; is not guaranteed to be unique in the whole
1694 #        graph (with block-jobs and block-backends).
1696 # Since: 4.0
1698 { 'struct': 'XDbgBlockGraphNode',
1699   'data': { 'id': 'uint64', 'type': 'XDbgBlockGraphNodeType', 'name': 'str' } }
1702 # @BlockPermission:
1704 # Enum of base block permissions.
1706 # @consistent-read: A user that has the "permission" of consistent reads is
1707 #                   guaranteed that their view of the contents of the block
1708 #                   device is complete and self-consistent, representing the
1709 #                   contents of a disk at a specific point.
1710 #                   For most block devices (including their backing files) this
1711 #                   is true, but the property cannot be maintained in a few
1712 #                   situations like for intermediate nodes of a commit block
1713 #                   job.
1715 # @write: This permission is required to change the visible disk contents.
1717 # @write-unchanged: This permission (which is weaker than BLK_PERM_WRITE) is
1718 #                   both enough and required for writes to the block node when
1719 #                   the caller promises that the visible disk content doesn't
1720 #                   change.
1721 #                   As the BLK_PERM_WRITE permission is strictly stronger,
1722 #                   either is sufficient to perform an unchanging write.
1724 # @resize: This permission is required to change the size of a block node.
1726 # @graph-mod: This permission is required to change the node that this
1727 #             BdrvChild points to.
1729 # Since: 4.0
1731   { 'enum': 'BlockPermission',
1732     'data': [ 'consistent-read', 'write', 'write-unchanged', 'resize',
1733               'graph-mod' ] }
1735 # @XDbgBlockGraphEdge:
1737 # Block Graph edge description for x-debug-query-block-graph.
1739 # @parent: parent id
1741 # @child: child id
1743 # @name: name of the relation (examples are 'file' and 'backing')
1745 # @perm: granted permissions for the parent operating on the child
1747 # @shared-perm: permissions that can still be granted to other users of the
1748 #               child while it is still attached to this parent
1750 # Since: 4.0
1752 { 'struct': 'XDbgBlockGraphEdge',
1753   'data': { 'parent': 'uint64', 'child': 'uint64',
1754             'name': 'str', 'perm': [ 'BlockPermission' ],
1755             'shared-perm': [ 'BlockPermission' ] } }
1758 # @XDbgBlockGraph:
1760 # Block Graph - list of nodes and list of edges.
1762 # Since: 4.0
1764 { 'struct': 'XDbgBlockGraph',
1765   'data': { 'nodes': ['XDbgBlockGraphNode'], 'edges': ['XDbgBlockGraphEdge'] } }
1768 # @x-debug-query-block-graph:
1770 # Get the block graph.
1772 # Since: 4.0
1774 { 'command': 'x-debug-query-block-graph', 'returns': 'XDbgBlockGraph' }
1777 # @drive-mirror:
1779 # Start mirroring a block device's writes to a new destination. target
1780 # specifies the target of the new image. If the file exists, or if it
1781 # is a device, it will be used as the new destination for writes. If
1782 # it does not exist, a new file will be created. format specifies the
1783 # format of the mirror image, default is to probe if mode='existing',
1784 # else the format of the source.
1786 # Returns: nothing on success
1787 #          If @device is not a valid block device, GenericError
1789 # Since: 1.3
1791 # Example:
1793 # -> { "execute": "drive-mirror",
1794 #      "arguments": { "device": "ide-hd0",
1795 #                     "target": "/some/place/my-image",
1796 #                     "sync": "full",
1797 #                     "format": "qcow2" } }
1798 # <- { "return": {} }
1801 { 'command': 'drive-mirror', 'boxed': true,
1802   'data': 'DriveMirror' }
1805 # @DriveMirror:
1807 # A set of parameters describing drive mirror setup.
1809 # @job-id: identifier for the newly-created block job. If
1810 #          omitted, the device name will be used. (Since 2.7)
1812 # @device:  the device name or node-name of a root node whose writes should be
1813 #           mirrored.
1815 # @target: the target of the new image. If the file exists, or if it
1816 #          is a device, the existing file/device will be used as the new
1817 #          destination.  If it does not exist, a new file will be created.
1819 # @format: the format of the new destination, default is to
1820 #          probe if @mode is 'existing', else the format of the source
1822 # @node-name: the new block driver state node name in the graph
1823 #             (Since 2.1)
1825 # @replaces: with sync=full graph node name to be replaced by the new
1826 #            image when a whole image copy is done. This can be used to repair
1827 #            broken Quorum files. (Since 2.1)
1829 # @mode: whether and how QEMU should create a new image, default is
1830 #        'absolute-paths'.
1832 # @speed:  the maximum speed, in bytes per second
1834 # @sync: what parts of the disk image should be copied to the destination
1835 #        (all the disk, only the sectors allocated in the topmost image, or
1836 #        only new I/O).
1838 # @granularity: granularity of the dirty bitmap, default is 64K
1839 #               if the image format doesn't have clusters, 4K if the clusters
1840 #               are smaller than that, else the cluster size.  Must be a
1841 #               power of 2 between 512 and 64M (since 1.4).
1843 # @buf-size: maximum amount of data in flight from source to
1844 #            target (since 1.4).
1846 # @on-source-error: the action to take on an error on the source,
1847 #                   default 'report'.  'stop' and 'enospc' can only be used
1848 #                   if the block device supports io-status (see BlockInfo).
1850 # @on-target-error: the action to take on an error on the target,
1851 #                   default 'report' (no limitations, since this applies to
1852 #                   a different block device than @device).
1853 # @unmap: Whether to try to unmap target sectors where source has
1854 #         only zero. If true, and target unallocated sectors will read as zero,
1855 #         target image sectors will be unmapped; otherwise, zeroes will be
1856 #         written. Both will result in identical contents.
1857 #         Default is true. (Since 2.4)
1859 # @copy-mode: when to copy data to the destination; defaults to 'background'
1860 #             (Since: 3.0)
1862 # @auto-finalize: When false, this job will wait in a PENDING state after it has
1863 #                 finished its work, waiting for @block-job-finalize before
1864 #                 making any block graph changes.
1865 #                 When true, this job will automatically
1866 #                 perform its abort or commit actions.
1867 #                 Defaults to true. (Since 3.1)
1869 # @auto-dismiss: When false, this job will wait in a CONCLUDED state after it
1870 #                has completely ceased all work, and awaits @block-job-dismiss.
1871 #                When true, this job will automatically disappear from the query
1872 #                list without user intervention.
1873 #                Defaults to true. (Since 3.1)
1874 # Since: 1.3
1876 { 'struct': 'DriveMirror',
1877   'data': { '*job-id': 'str', 'device': 'str', 'target': 'str',
1878             '*format': 'str', '*node-name': 'str', '*replaces': 'str',
1879             'sync': 'MirrorSyncMode', '*mode': 'NewImageMode',
1880             '*speed': 'int', '*granularity': 'uint32',
1881             '*buf-size': 'int', '*on-source-error': 'BlockdevOnError',
1882             '*on-target-error': 'BlockdevOnError',
1883             '*unmap': 'bool', '*copy-mode': 'MirrorCopyMode',
1884             '*auto-finalize': 'bool', '*auto-dismiss': 'bool' } }
1887 # @BlockDirtyBitmap:
1889 # @node: name of device/node which the bitmap is tracking
1891 # @name: name of the dirty bitmap
1893 # Since: 2.4
1895 { 'struct': 'BlockDirtyBitmap',
1896   'data': { 'node': 'str', 'name': 'str' } }
1899 # @BlockDirtyBitmapAdd:
1901 # @node: name of device/node which the bitmap is tracking
1903 # @name: name of the dirty bitmap
1905 # @granularity: the bitmap granularity, default is 64k for
1906 #               block-dirty-bitmap-add
1908 # @persistent: the bitmap is persistent, i.e. it will be saved to the
1909 #              corresponding block device image file on its close. For now only
1910 #              Qcow2 disks support persistent bitmaps. Default is false for
1911 #              block-dirty-bitmap-add. (Since: 2.10)
1913 # @autoload: ignored and deprecated since 2.12.
1914 #            Currently, all dirty tracking bitmaps are loaded from Qcow2 on
1915 #            open.
1917 # @disabled: the bitmap is created in the disabled state, which means that
1918 #            it will not track drive changes. The bitmap may be enabled with
1919 #            block-dirty-bitmap-enable. Default is false. (Since: 4.0)
1921 # Since: 2.4
1923 { 'struct': 'BlockDirtyBitmapAdd',
1924   'data': { 'node': 'str', 'name': 'str', '*granularity': 'uint32',
1925             '*persistent': 'bool', '*autoload': 'bool', '*disabled': 'bool' } }
1928 # @BlockDirtyBitmapMerge:
1930 # @node: name of device/node which the bitmap is tracking
1932 # @target: name of the destination dirty bitmap
1934 # @bitmaps: name(s) of the source dirty bitmap(s)
1936 # Since: 4.0
1938 { 'struct': 'BlockDirtyBitmapMerge',
1939   'data': { 'node': 'str', 'target': 'str', 'bitmaps': ['str'] } }
1942 # @block-dirty-bitmap-add:
1944 # Create a dirty bitmap with a name on the node, and start tracking the writes.
1946 # Returns: nothing on success
1947 #          If @node is not a valid block device or node, DeviceNotFound
1948 #          If @name is already taken, GenericError with an explanation
1950 # Since: 2.4
1952 # Example:
1954 # -> { "execute": "block-dirty-bitmap-add",
1955 #      "arguments": { "node": "drive0", "name": "bitmap0" } }
1956 # <- { "return": {} }
1959 { 'command': 'block-dirty-bitmap-add',
1960   'data': 'BlockDirtyBitmapAdd' }
1963 # @block-dirty-bitmap-remove:
1965 # Stop write tracking and remove the dirty bitmap that was created
1966 # with block-dirty-bitmap-add. If the bitmap is persistent, remove it from its
1967 # storage too.
1969 # Returns: nothing on success
1970 #          If @node is not a valid block device or node, DeviceNotFound
1971 #          If @name is not found, GenericError with an explanation
1972 #          if @name is frozen by an operation, GenericError
1974 # Since: 2.4
1976 # Example:
1978 # -> { "execute": "block-dirty-bitmap-remove",
1979 #      "arguments": { "node": "drive0", "name": "bitmap0" } }
1980 # <- { "return": {} }
1983 { 'command': 'block-dirty-bitmap-remove',
1984   'data': 'BlockDirtyBitmap' }
1987 # @block-dirty-bitmap-clear:
1989 # Clear (reset) a dirty bitmap on the device, so that an incremental
1990 # backup from this point in time forward will only backup clusters
1991 # modified after this clear operation.
1993 # Returns: nothing on success
1994 #          If @node is not a valid block device, DeviceNotFound
1995 #          If @name is not found, GenericError with an explanation
1997 # Since: 2.4
1999 # Example:
2001 # -> { "execute": "block-dirty-bitmap-clear",
2002 #      "arguments": { "node": "drive0", "name": "bitmap0" } }
2003 # <- { "return": {} }
2006 { 'command': 'block-dirty-bitmap-clear',
2007   'data': 'BlockDirtyBitmap' }
2010 # @block-dirty-bitmap-enable:
2012 # Enables a dirty bitmap so that it will begin tracking disk changes.
2014 # Returns: nothing on success
2015 #          If @node is not a valid block device, DeviceNotFound
2016 #          If @name is not found, GenericError with an explanation
2018 # Since: 4.0
2020 # Example:
2022 # -> { "execute": "block-dirty-bitmap-enable",
2023 #      "arguments": { "node": "drive0", "name": "bitmap0" } }
2024 # <- { "return": {} }
2027   { 'command': 'block-dirty-bitmap-enable',
2028     'data': 'BlockDirtyBitmap' }
2031 # @block-dirty-bitmap-disable:
2033 # Disables a dirty bitmap so that it will stop tracking disk changes.
2035 # Returns: nothing on success
2036 #          If @node is not a valid block device, DeviceNotFound
2037 #          If @name is not found, GenericError with an explanation
2039 # Since: 4.0
2041 # Example:
2043 # -> { "execute": "block-dirty-bitmap-disable",
2044 #      "arguments": { "node": "drive0", "name": "bitmap0" } }
2045 # <- { "return": {} }
2048     { 'command': 'block-dirty-bitmap-disable',
2049       'data': 'BlockDirtyBitmap' }
2052 # @block-dirty-bitmap-merge:
2054 # Merge dirty bitmaps listed in @bitmaps to the @target dirty bitmap.
2055 # The @bitmaps dirty bitmaps are unchanged.
2056 # On error, @target is unchanged.
2058 # Returns: nothing on success
2059 #          If @node is not a valid block device, DeviceNotFound
2060 #          If any bitmap in @bitmaps or @target is not found, GenericError
2061 #          If any of the bitmaps have different sizes or granularities,
2062 #              GenericError
2064 # Since: 4.0
2066 # Example:
2068 # -> { "execute": "block-dirty-bitmap-merge",
2069 #      "arguments": { "node": "drive0", "target": "bitmap0",
2070 #                     "bitmaps": ["bitmap1"] } }
2071 # <- { "return": {} }
2074       { 'command': 'block-dirty-bitmap-merge',
2075         'data': 'BlockDirtyBitmapMerge' }
2078 # @BlockDirtyBitmapSha256:
2080 # SHA256 hash of dirty bitmap data
2082 # @sha256: ASCII representation of SHA256 bitmap hash
2084 # Since: 2.10
2086   { 'struct': 'BlockDirtyBitmapSha256',
2087     'data': {'sha256': 'str'} }
2090 # @x-debug-block-dirty-bitmap-sha256:
2092 # Get bitmap SHA256
2094 # Returns: BlockDirtyBitmapSha256 on success
2095 #          If @node is not a valid block device, DeviceNotFound
2096 #          If @name is not found or if hashing has failed, GenericError with an
2097 #          explanation
2099 # Since: 2.10
2101   { 'command': 'x-debug-block-dirty-bitmap-sha256',
2102     'data': 'BlockDirtyBitmap', 'returns': 'BlockDirtyBitmapSha256' }
2105 # @blockdev-mirror:
2107 # Start mirroring a block device's writes to a new destination.
2109 # @job-id: identifier for the newly-created block job. If
2110 #          omitted, the device name will be used. (Since 2.7)
2112 # @device: The device name or node-name of a root node whose writes should be
2113 #          mirrored.
2115 # @target: the id or node-name of the block device to mirror to. This mustn't be
2116 #          attached to guest.
2118 # @replaces: with sync=full graph node name to be replaced by the new
2119 #            image when a whole image copy is done. This can be used to repair
2120 #            broken Quorum files.
2122 # @speed:  the maximum speed, in bytes per second
2124 # @sync: what parts of the disk image should be copied to the destination
2125 #        (all the disk, only the sectors allocated in the topmost image, or
2126 #        only new I/O).
2128 # @granularity: granularity of the dirty bitmap, default is 64K
2129 #               if the image format doesn't have clusters, 4K if the clusters
2130 #               are smaller than that, else the cluster size.  Must be a
2131 #               power of 2 between 512 and 64M
2133 # @buf-size: maximum amount of data in flight from source to
2134 #            target
2136 # @on-source-error: the action to take on an error on the source,
2137 #                   default 'report'.  'stop' and 'enospc' can only be used
2138 #                   if the block device supports io-status (see BlockInfo).
2140 # @on-target-error: the action to take on an error on the target,
2141 #                   default 'report' (no limitations, since this applies to
2142 #                   a different block device than @device).
2144 # @filter-node-name: the node name that should be assigned to the
2145 #                    filter driver that the mirror job inserts into the graph
2146 #                    above @device. If this option is not given, a node name is
2147 #                    autogenerated. (Since: 2.9)
2149 # @copy-mode: when to copy data to the destination; defaults to 'background'
2150 #             (Since: 3.0)
2152 # @auto-finalize: When false, this job will wait in a PENDING state after it has
2153 #                 finished its work, waiting for @block-job-finalize before
2154 #                 making any block graph changes.
2155 #                 When true, this job will automatically
2156 #                 perform its abort or commit actions.
2157 #                 Defaults to true. (Since 3.1)
2159 # @auto-dismiss: When false, this job will wait in a CONCLUDED state after it
2160 #                has completely ceased all work, and awaits @block-job-dismiss.
2161 #                When true, this job will automatically disappear from the query
2162 #                list without user intervention.
2163 #                Defaults to true. (Since 3.1)
2164 # Returns: nothing on success.
2166 # Since: 2.6
2168 # Example:
2170 # -> { "execute": "blockdev-mirror",
2171 #      "arguments": { "device": "ide-hd0",
2172 #                     "target": "target0",
2173 #                     "sync": "full" } }
2174 # <- { "return": {} }
2177 { 'command': 'blockdev-mirror',
2178   'data': { '*job-id': 'str', 'device': 'str', 'target': 'str',
2179             '*replaces': 'str',
2180             'sync': 'MirrorSyncMode',
2181             '*speed': 'int', '*granularity': 'uint32',
2182             '*buf-size': 'int', '*on-source-error': 'BlockdevOnError',
2183             '*on-target-error': 'BlockdevOnError',
2184             '*filter-node-name': 'str',
2185             '*copy-mode': 'MirrorCopyMode',
2186             '*auto-finalize': 'bool', '*auto-dismiss': 'bool' } }
2189 # @block_set_io_throttle:
2191 # Change I/O throttle limits for a block drive.
2193 # Since QEMU 2.4, each device with I/O limits is member of a throttle
2194 # group.
2196 # If two or more devices are members of the same group, the limits
2197 # will apply to the combined I/O of the whole group in a round-robin
2198 # fashion. Therefore, setting new I/O limits to a device will affect
2199 # the whole group.
2201 # The name of the group can be specified using the 'group' parameter.
2202 # If the parameter is unset, it is assumed to be the current group of
2203 # that device. If it's not in any group yet, the name of the device
2204 # will be used as the name for its group.
2206 # The 'group' parameter can also be used to move a device to a
2207 # different group. In this case the limits specified in the parameters
2208 # will be applied to the new group only.
2210 # I/O limits can be disabled by setting all of them to 0. In this case
2211 # the device will be removed from its group and the rest of its
2212 # members will not be affected. The 'group' parameter is ignored.
2214 # Returns: Nothing on success
2215 #          If @device is not a valid block device, DeviceNotFound
2217 # Since: 1.1
2219 # Example:
2221 # -> { "execute": "block_set_io_throttle",
2222 #      "arguments": { "id": "virtio-blk-pci0/virtio-backend",
2223 #                     "bps": 0,
2224 #                     "bps_rd": 0,
2225 #                     "bps_wr": 0,
2226 #                     "iops": 512,
2227 #                     "iops_rd": 0,
2228 #                     "iops_wr": 0,
2229 #                     "bps_max": 0,
2230 #                     "bps_rd_max": 0,
2231 #                     "bps_wr_max": 0,
2232 #                     "iops_max": 0,
2233 #                     "iops_rd_max": 0,
2234 #                     "iops_wr_max": 0,
2235 #                     "bps_max_length": 0,
2236 #                     "iops_size": 0 } }
2237 # <- { "return": {} }
2239 # -> { "execute": "block_set_io_throttle",
2240 #      "arguments": { "id": "ide0-1-0",
2241 #                     "bps": 1000000,
2242 #                     "bps_rd": 0,
2243 #                     "bps_wr": 0,
2244 #                     "iops": 0,
2245 #                     "iops_rd": 0,
2246 #                     "iops_wr": 0,
2247 #                     "bps_max": 8000000,
2248 #                     "bps_rd_max": 0,
2249 #                     "bps_wr_max": 0,
2250 #                     "iops_max": 0,
2251 #                     "iops_rd_max": 0,
2252 #                     "iops_wr_max": 0,
2253 #                     "bps_max_length": 60,
2254 #                     "iops_size": 0 } }
2255 # <- { "return": {} }
2257 { 'command': 'block_set_io_throttle', 'boxed': true,
2258   'data': 'BlockIOThrottle' }
2261 # @BlockIOThrottle:
2263 # A set of parameters describing block throttling.
2265 # @device: Block device name (deprecated, use @id instead)
2267 # @id: The name or QOM path of the guest device (since: 2.8)
2269 # @bps: total throughput limit in bytes per second
2271 # @bps_rd: read throughput limit in bytes per second
2273 # @bps_wr: write throughput limit in bytes per second
2275 # @iops: total I/O operations per second
2277 # @iops_rd: read I/O operations per second
2279 # @iops_wr: write I/O operations per second
2281 # @bps_max: total throughput limit during bursts,
2282 #                     in bytes (Since 1.7)
2284 # @bps_rd_max: read throughput limit during bursts,
2285 #                        in bytes (Since 1.7)
2287 # @bps_wr_max: write throughput limit during bursts,
2288 #                        in bytes (Since 1.7)
2290 # @iops_max: total I/O operations per second during bursts,
2291 #                      in bytes (Since 1.7)
2293 # @iops_rd_max: read I/O operations per second during bursts,
2294 #                         in bytes (Since 1.7)
2296 # @iops_wr_max: write I/O operations per second during bursts,
2297 #                         in bytes (Since 1.7)
2299 # @bps_max_length: maximum length of the @bps_max burst
2300 #                            period, in seconds. It must only
2301 #                            be set if @bps_max is set as well.
2302 #                            Defaults to 1. (Since 2.6)
2304 # @bps_rd_max_length: maximum length of the @bps_rd_max
2305 #                               burst period, in seconds. It must only
2306 #                               be set if @bps_rd_max is set as well.
2307 #                               Defaults to 1. (Since 2.6)
2309 # @bps_wr_max_length: maximum length of the @bps_wr_max
2310 #                               burst period, in seconds. It must only
2311 #                               be set if @bps_wr_max is set as well.
2312 #                               Defaults to 1. (Since 2.6)
2314 # @iops_max_length: maximum length of the @iops burst
2315 #                             period, in seconds. It must only
2316 #                             be set if @iops_max is set as well.
2317 #                             Defaults to 1. (Since 2.6)
2319 # @iops_rd_max_length: maximum length of the @iops_rd_max
2320 #                                burst period, in seconds. It must only
2321 #                                be set if @iops_rd_max is set as well.
2322 #                                Defaults to 1. (Since 2.6)
2324 # @iops_wr_max_length: maximum length of the @iops_wr_max
2325 #                                burst period, in seconds. It must only
2326 #                                be set if @iops_wr_max is set as well.
2327 #                                Defaults to 1. (Since 2.6)
2329 # @iops_size: an I/O size in bytes (Since 1.7)
2331 # @group: throttle group name (Since 2.4)
2333 # Since: 1.1
2335 { 'struct': 'BlockIOThrottle',
2336   'data': { '*device': 'str', '*id': 'str', 'bps': 'int', 'bps_rd': 'int',
2337             'bps_wr': 'int', 'iops': 'int', 'iops_rd': 'int', 'iops_wr': 'int',
2338             '*bps_max': 'int', '*bps_rd_max': 'int',
2339             '*bps_wr_max': 'int', '*iops_max': 'int',
2340             '*iops_rd_max': 'int', '*iops_wr_max': 'int',
2341             '*bps_max_length': 'int', '*bps_rd_max_length': 'int',
2342             '*bps_wr_max_length': 'int', '*iops_max_length': 'int',
2343             '*iops_rd_max_length': 'int', '*iops_wr_max_length': 'int',
2344             '*iops_size': 'int', '*group': 'str' } }
2347 # @ThrottleLimits:
2349 # Limit parameters for throttling.
2350 # Since some limit combinations are illegal, limits should always be set in one
2351 # transaction. All fields are optional. When setting limits, if a field is
2352 # missing the current value is not changed.
2354 # @iops-total:             limit total I/O operations per second
2355 # @iops-total-max:         I/O operations burst
2356 # @iops-total-max-length:  length of the iops-total-max burst period, in seconds
2357 #                          It must only be set if @iops-total-max is set as well.
2358 # @iops-read:              limit read operations per second
2359 # @iops-read-max:          I/O operations read burst
2360 # @iops-read-max-length:   length of the iops-read-max burst period, in seconds
2361 #                          It must only be set if @iops-read-max is set as well.
2362 # @iops-write:             limit write operations per second
2363 # @iops-write-max:         I/O operations write burst
2364 # @iops-write-max-length:  length of the iops-write-max burst period, in seconds
2365 #                          It must only be set if @iops-write-max is set as well.
2366 # @bps-total:              limit total bytes per second
2367 # @bps-total-max:          total bytes burst
2368 # @bps-total-max-length:   length of the bps-total-max burst period, in seconds.
2369 #                          It must only be set if @bps-total-max is set as well.
2370 # @bps-read:               limit read bytes per second
2371 # @bps-read-max:           total bytes read burst
2372 # @bps-read-max-length:    length of the bps-read-max burst period, in seconds
2373 #                          It must only be set if @bps-read-max is set as well.
2374 # @bps-write:              limit write bytes per second
2375 # @bps-write-max:          total bytes write burst
2376 # @bps-write-max-length:   length of the bps-write-max burst period, in seconds
2377 #                          It must only be set if @bps-write-max is set as well.
2378 # @iops-size:              when limiting by iops max size of an I/O in bytes
2380 # Since: 2.11
2382 { 'struct': 'ThrottleLimits',
2383   'data': { '*iops-total' : 'int', '*iops-total-max' : 'int',
2384             '*iops-total-max-length' : 'int', '*iops-read' : 'int',
2385             '*iops-read-max' : 'int', '*iops-read-max-length' : 'int',
2386             '*iops-write' : 'int', '*iops-write-max' : 'int',
2387             '*iops-write-max-length' : 'int', '*bps-total' : 'int',
2388             '*bps-total-max' : 'int', '*bps-total-max-length' : 'int',
2389             '*bps-read' : 'int', '*bps-read-max' : 'int',
2390             '*bps-read-max-length' : 'int', '*bps-write' : 'int',
2391             '*bps-write-max' : 'int', '*bps-write-max-length' : 'int',
2392             '*iops-size' : 'int' } }
2395 # @block-stream:
2397 # Copy data from a backing file into a block device.
2399 # The block streaming operation is performed in the background until the entire
2400 # backing file has been copied.  This command returns immediately once streaming
2401 # has started.  The status of ongoing block streaming operations can be checked
2402 # with query-block-jobs.  The operation can be stopped before it has completed
2403 # using the block-job-cancel command.
2405 # The node that receives the data is called the top image, can be located in
2406 # any part of the chain (but always above the base image; see below) and can be
2407 # specified using its device or node name. Earlier qemu versions only allowed
2408 # 'device' to name the top level node; presence of the 'base-node' parameter
2409 # during introspection can be used as a witness of the enhanced semantics
2410 # of 'device'.
2412 # If a base file is specified then sectors are not copied from that base file and
2413 # its backing chain.  When streaming completes the image file will have the base
2414 # file as its backing file.  This can be used to stream a subset of the backing
2415 # file chain instead of flattening the entire image.
2417 # On successful completion the image file is updated to drop the backing file
2418 # and the BLOCK_JOB_COMPLETED event is emitted.
2420 # @job-id: identifier for the newly-created block job. If
2421 #          omitted, the device name will be used. (Since 2.7)
2423 # @device: the device or node name of the top image
2425 # @base:   the common backing file name.
2426 #                    It cannot be set if @base-node is also set.
2428 # @base-node: the node name of the backing file.
2429 #                       It cannot be set if @base is also set. (Since 2.8)
2431 # @backing-file: The backing file string to write into the top
2432 #                          image. This filename is not validated.
2434 #                          If a pathname string is such that it cannot be
2435 #                          resolved by QEMU, that means that subsequent QMP or
2436 #                          HMP commands must use node-names for the image in
2437 #                          question, as filename lookup methods will fail.
2439 #                          If not specified, QEMU will automatically determine
2440 #                          the backing file string to use, or error out if there
2441 #                          is no obvious choice.  Care should be taken when
2442 #                          specifying the string, to specify a valid filename or
2443 #                          protocol.
2444 #                          (Since 2.1)
2446 # @speed:  the maximum speed, in bytes per second
2448 # @on-error: the action to take on an error (default report).
2449 #            'stop' and 'enospc' can only be used if the block device
2450 #            supports io-status (see BlockInfo).  Since 1.3.
2452 # @auto-finalize: When false, this job will wait in a PENDING state after it has
2453 #                 finished its work, waiting for @block-job-finalize before
2454 #                 making any block graph changes.
2455 #                 When true, this job will automatically
2456 #                 perform its abort or commit actions.
2457 #                 Defaults to true. (Since 3.1)
2459 # @auto-dismiss: When false, this job will wait in a CONCLUDED state after it
2460 #                has completely ceased all work, and awaits @block-job-dismiss.
2461 #                When true, this job will automatically disappear from the query
2462 #                list without user intervention.
2463 #                Defaults to true. (Since 3.1)
2465 # Returns: Nothing on success. If @device does not exist, DeviceNotFound.
2467 # Since: 1.1
2469 # Example:
2471 # -> { "execute": "block-stream",
2472 #      "arguments": { "device": "virtio0",
2473 #                     "base": "/tmp/master.qcow2" } }
2474 # <- { "return": {} }
2477 { 'command': 'block-stream',
2478   'data': { '*job-id': 'str', 'device': 'str', '*base': 'str',
2479             '*base-node': 'str', '*backing-file': 'str', '*speed': 'int',
2480             '*on-error': 'BlockdevOnError',
2481             '*auto-finalize': 'bool', '*auto-dismiss': 'bool' } }
2484 # @block-job-set-speed:
2486 # Set maximum speed for a background block operation.
2488 # This command can only be issued when there is an active block job.
2490 # Throttling can be disabled by setting the speed to 0.
2492 # @device: The job identifier. This used to be a device name (hence
2493 #          the name of the parameter), but since QEMU 2.7 it can have
2494 #          other values.
2496 # @speed:  the maximum speed, in bytes per second, or 0 for unlimited.
2497 #          Defaults to 0.
2499 # Returns: Nothing on success
2500 #          If no background operation is active on this device, DeviceNotActive
2502 # Since: 1.1
2504 { 'command': 'block-job-set-speed',
2505   'data': { 'device': 'str', 'speed': 'int' } }
2508 # @block-job-cancel:
2510 # Stop an active background block operation.
2512 # This command returns immediately after marking the active background block
2513 # operation for cancellation.  It is an error to call this command if no
2514 # operation is in progress.
2516 # The operation will cancel as soon as possible and then emit the
2517 # BLOCK_JOB_CANCELLED event.  Before that happens the job is still visible when
2518 # enumerated using query-block-jobs.
2520 # Note that if you issue 'block-job-cancel' after 'drive-mirror' has indicated
2521 # (via the event BLOCK_JOB_READY) that the source and destination are
2522 # synchronized, then the event triggered by this command changes to
2523 # BLOCK_JOB_COMPLETED, to indicate that the mirroring has ended and the
2524 # destination now has a point-in-time copy tied to the time of the cancellation.
2526 # For streaming, the image file retains its backing file unless the streaming
2527 # operation happens to complete just as it is being cancelled.  A new streaming
2528 # operation can be started at a later time to finish copying all data from the
2529 # backing file.
2531 # @device: The job identifier. This used to be a device name (hence
2532 #          the name of the parameter), but since QEMU 2.7 it can have
2533 #          other values.
2535 # @force: If true, and the job has already emitted the event BLOCK_JOB_READY,
2536 #         abandon the job immediately (even if it is paused) instead of waiting
2537 #         for the destination to complete its final synchronization (since 1.3)
2539 # Returns: Nothing on success
2540 #          If no background operation is active on this device, DeviceNotActive
2542 # Since: 1.1
2544 { 'command': 'block-job-cancel', 'data': { 'device': 'str', '*force': 'bool' } }
2547 # @block-job-pause:
2549 # Pause an active background block operation.
2551 # This command returns immediately after marking the active background block
2552 # operation for pausing.  It is an error to call this command if no
2553 # operation is in progress or if the job is already paused.
2555 # The operation will pause as soon as possible.  No event is emitted when
2556 # the operation is actually paused.  Cancelling a paused job automatically
2557 # resumes it.
2559 # @device: The job identifier. This used to be a device name (hence
2560 #          the name of the parameter), but since QEMU 2.7 it can have
2561 #          other values.
2563 # Returns: Nothing on success
2564 #          If no background operation is active on this device, DeviceNotActive
2566 # Since: 1.3
2568 { 'command': 'block-job-pause', 'data': { 'device': 'str' } }
2571 # @block-job-resume:
2573 # Resume an active background block operation.
2575 # This command returns immediately after resuming a paused background block
2576 # operation.  It is an error to call this command if no operation is in
2577 # progress or if the job is not paused.
2579 # This command also clears the error status of the job.
2581 # @device: The job identifier. This used to be a device name (hence
2582 #          the name of the parameter), but since QEMU 2.7 it can have
2583 #          other values.
2585 # Returns: Nothing on success
2586 #          If no background operation is active on this device, DeviceNotActive
2588 # Since: 1.3
2590 { 'command': 'block-job-resume', 'data': { 'device': 'str' } }
2593 # @block-job-complete:
2595 # Manually trigger completion of an active background block operation.  This
2596 # is supported for drive mirroring, where it also switches the device to
2597 # write to the target path only.  The ability to complete is signaled with
2598 # a BLOCK_JOB_READY event.
2600 # This command completes an active background block operation synchronously.
2601 # The ordering of this command's return with the BLOCK_JOB_COMPLETED event
2602 # is not defined.  Note that if an I/O error occurs during the processing of
2603 # this command: 1) the command itself will fail; 2) the error will be processed
2604 # according to the rerror/werror arguments that were specified when starting
2605 # the operation.
2607 # A cancelled or paused job cannot be completed.
2609 # @device: The job identifier. This used to be a device name (hence
2610 #          the name of the parameter), but since QEMU 2.7 it can have
2611 #          other values.
2613 # Returns: Nothing on success
2614 #          If no background operation is active on this device, DeviceNotActive
2616 # Since: 1.3
2618 { 'command': 'block-job-complete', 'data': { 'device': 'str' } }
2621 # @block-job-dismiss:
2623 # For jobs that have already concluded, remove them from the block-job-query
2624 # list. This command only needs to be run for jobs which were started with
2625 # QEMU 2.12+ job lifetime management semantics.
2627 # This command will refuse to operate on any job that has not yet reached
2628 # its terminal state, JOB_STATUS_CONCLUDED. For jobs that make use of the
2629 # BLOCK_JOB_READY event, block-job-cancel or block-job-complete will still need
2630 # to be used as appropriate.
2632 # @id: The job identifier.
2634 # Returns: Nothing on success
2636 # Since: 2.12
2638 { 'command': 'block-job-dismiss', 'data': { 'id': 'str' } }
2641 # @block-job-finalize:
2643 # Once a job that has manual=true reaches the pending state, it can be
2644 # instructed to finalize any graph changes and do any necessary cleanup
2645 # via this command.
2646 # For jobs in a transaction, instructing one job to finalize will force
2647 # ALL jobs in the transaction to finalize, so it is only necessary to instruct
2648 # a single member job to finalize.
2650 # @id: The job identifier.
2652 # Returns: Nothing on success
2654 # Since: 2.12
2656 { 'command': 'block-job-finalize', 'data': { 'id': 'str' } }
2659 # @BlockdevDiscardOptions:
2661 # Determines how to handle discard requests.
2663 # @ignore:      Ignore the request
2664 # @unmap:       Forward as an unmap request
2666 # Since: 2.9
2668 { 'enum': 'BlockdevDiscardOptions',
2669   'data': [ 'ignore', 'unmap' ] }
2672 # @BlockdevDetectZeroesOptions:
2674 # Describes the operation mode for the automatic conversion of plain
2675 # zero writes by the OS to driver specific optimized zero write commands.
2677 # @off:      Disabled (default)
2678 # @on:       Enabled
2679 # @unmap:    Enabled and even try to unmap blocks if possible. This requires
2680 #            also that @BlockdevDiscardOptions is set to unmap for this device.
2682 # Since: 2.1
2684 { 'enum': 'BlockdevDetectZeroesOptions',
2685   'data': [ 'off', 'on', 'unmap' ] }
2688 # @BlockdevAioOptions:
2690 # Selects the AIO backend to handle I/O requests
2692 # @threads:     Use qemu's thread pool
2693 # @native:      Use native AIO backend (only Linux and Windows)
2695 # Since: 2.9
2697 { 'enum': 'BlockdevAioOptions',
2698   'data': [ 'threads', 'native' ] }
2701 # @BlockdevCacheOptions:
2703 # Includes cache-related options for block devices
2705 # @direct:      enables use of O_DIRECT (bypass the host page cache;
2706 #               default: false)
2707 # @no-flush:    ignore any flush requests for the device (default:
2708 #               false)
2710 # Since: 2.9
2712 { 'struct': 'BlockdevCacheOptions',
2713   'data': { '*direct': 'bool',
2714             '*no-flush': 'bool' } }
2717 # @BlockdevDriver:
2719 # Drivers that are supported in block device operations.
2721 # @vxhs: Since 2.10
2722 # @throttle: Since 2.11
2723 # @nvme: Since 2.12
2724 # @copy-on-read: Since 3.0
2725 # @blklogwrites: Since 3.0
2727 # Since: 2.9
2729 { 'enum': 'BlockdevDriver',
2730   'data': [ 'blkdebug', 'blklogwrites', 'blkverify', 'bochs', 'cloop',
2731             'copy-on-read', 'dmg', 'file', 'ftp', 'ftps', 'gluster',
2732             'host_cdrom', 'host_device', 'http', 'https', 'iscsi', 'luks',
2733             'nbd', 'nfs', 'null-aio', 'null-co', 'nvme', 'parallels', 'qcow',
2734             'qcow2', 'qed', 'quorum', 'raw', 'rbd',
2735             { 'name': 'replication', 'if': 'defined(CONFIG_REPLICATION)' },
2736             'sheepdog',
2737             'ssh', 'throttle', 'vdi', 'vhdx', 'vmdk', 'vpc', 'vvfat', 'vxhs' ] }
2740 # @BlockdevOptionsFile:
2742 # Driver specific block device options for the file backend.
2744 # @filename:    path to the image file
2745 # @pr-manager:  the id for the object that will handle persistent reservations
2746 #               for this device (default: none, forward the commands via SG_IO;
2747 #               since 2.11)
2748 # @aio:         AIO backend (default: threads) (since: 2.8)
2749 # @locking:     whether to enable file locking. If set to 'auto', only enable
2750 #               when Open File Descriptor (OFD) locking API is available
2751 #               (default: auto, since 2.10)
2752 # @x-check-cache-dropped: whether to check that page cache was dropped on live
2753 #                         migration.  May cause noticeable delays if the image
2754 #                         file is large, do not use in production.
2755 #                         (default: off) (since: 3.0)
2757 # Since: 2.9
2759 { 'struct': 'BlockdevOptionsFile',
2760   'data': { 'filename': 'str',
2761             '*pr-manager': 'str',
2762             '*locking': 'OnOffAuto',
2763             '*aio': 'BlockdevAioOptions',
2764             '*x-check-cache-dropped': 'bool' } }
2767 # @BlockdevOptionsNull:
2769 # Driver specific block device options for the null backend.
2771 # @size:    size of the device in bytes.
2772 # @latency-ns: emulated latency (in nanoseconds) in processing
2773 #              requests. Default to zero which completes requests immediately.
2774 #              (Since 2.4)
2776 # Since: 2.9
2778 { 'struct': 'BlockdevOptionsNull',
2779   'data': { '*size': 'int', '*latency-ns': 'uint64' } }
2782 # @BlockdevOptionsNVMe:
2784 # Driver specific block device options for the NVMe backend.
2786 # @device:    controller address of the NVMe device.
2787 # @namespace: namespace number of the device, starting from 1.
2789 # Since: 2.12
2791 { 'struct': 'BlockdevOptionsNVMe',
2792   'data': { 'device': 'str', 'namespace': 'int' } }
2795 # @BlockdevOptionsVVFAT:
2797 # Driver specific block device options for the vvfat protocol.
2799 # @dir:         directory to be exported as FAT image
2800 # @fat-type:    FAT type: 12, 16 or 32
2801 # @floppy:      whether to export a floppy image (true) or
2802 #               partitioned hard disk (false; default)
2803 # @label:       set the volume label, limited to 11 bytes. FAT16 and
2804 #               FAT32 traditionally have some restrictions on labels, which are
2805 #               ignored by most operating systems. Defaults to "QEMU VVFAT".
2806 #               (since 2.4)
2807 # @rw:          whether to allow write operations (default: false)
2809 # Since: 2.9
2811 { 'struct': 'BlockdevOptionsVVFAT',
2812   'data': { 'dir': 'str', '*fat-type': 'int', '*floppy': 'bool',
2813             '*label': 'str', '*rw': 'bool' } }
2816 # @BlockdevOptionsGenericFormat:
2818 # Driver specific block device options for image format that have no option
2819 # besides their data source.
2821 # @file:        reference to or definition of the data source block device
2823 # Since: 2.9
2825 { 'struct': 'BlockdevOptionsGenericFormat',
2826   'data': { 'file': 'BlockdevRef' } }
2829 # @BlockdevOptionsLUKS:
2831 # Driver specific block device options for LUKS.
2833 # @key-secret: the ID of a QCryptoSecret object providing
2834 #              the decryption key (since 2.6). Mandatory except when
2835 #              doing a metadata-only probe of the image.
2837 # Since: 2.9
2839 { 'struct': 'BlockdevOptionsLUKS',
2840   'base': 'BlockdevOptionsGenericFormat',
2841   'data': { '*key-secret': 'str' } }
2845 # @BlockdevOptionsGenericCOWFormat:
2847 # Driver specific block device options for image format that have no option
2848 # besides their data source and an optional backing file.
2850 # @backing:     reference to or definition of the backing file block
2851 #               device, null disables the backing file entirely.
2852 #               Defaults to the backing file stored the image file.
2854 # Since: 2.9
2856 { 'struct': 'BlockdevOptionsGenericCOWFormat',
2857   'base': 'BlockdevOptionsGenericFormat',
2858   'data': { '*backing': 'BlockdevRefOrNull' } }
2861 # @Qcow2OverlapCheckMode:
2863 # General overlap check modes.
2865 # @none:        Do not perform any checks
2867 # @constant:    Perform only checks which can be done in constant time and
2868 #               without reading anything from disk
2870 # @cached:      Perform only checks which can be done without reading anything
2871 #               from disk
2873 # @all:         Perform all available overlap checks
2875 # Since: 2.9
2877 { 'enum': 'Qcow2OverlapCheckMode',
2878   'data': [ 'none', 'constant', 'cached', 'all' ] }
2881 # @Qcow2OverlapCheckFlags:
2883 # Structure of flags for each metadata structure. Setting a field to 'true'
2884 # makes qemu guard that structure against unintended overwriting. The default
2885 # value is chosen according to the template given.
2887 # @template: Specifies a template mode which can be adjusted using the other
2888 #            flags, defaults to 'cached'
2890 # @bitmap-directory: since 3.0
2892 # Since: 2.9
2894 { 'struct': 'Qcow2OverlapCheckFlags',
2895   'data': { '*template':         'Qcow2OverlapCheckMode',
2896             '*main-header':      'bool',
2897             '*active-l1':        'bool',
2898             '*active-l2':        'bool',
2899             '*refcount-table':   'bool',
2900             '*refcount-block':   'bool',
2901             '*snapshot-table':   'bool',
2902             '*inactive-l1':      'bool',
2903             '*inactive-l2':      'bool',
2904             '*bitmap-directory': 'bool' } }
2907 # @Qcow2OverlapChecks:
2909 # Specifies which metadata structures should be guarded against unintended
2910 # overwriting.
2912 # @flags:   set of flags for separate specification of each metadata structure
2913 #           type
2915 # @mode:    named mode which chooses a specific set of flags
2917 # Since: 2.9
2919 { 'alternate': 'Qcow2OverlapChecks',
2920   'data': { 'flags': 'Qcow2OverlapCheckFlags',
2921             'mode':  'Qcow2OverlapCheckMode' } }
2924 # @BlockdevQcowEncryptionFormat:
2926 # @aes: AES-CBC with plain64 initialization vectors
2928 # Since: 2.10
2930 { 'enum': 'BlockdevQcowEncryptionFormat',
2931   'data': [ 'aes' ] }
2934 # @BlockdevQcowEncryption:
2936 # Since: 2.10
2938 { 'union': 'BlockdevQcowEncryption',
2939   'base': { 'format': 'BlockdevQcowEncryptionFormat' },
2940   'discriminator': 'format',
2941   'data': { 'aes': 'QCryptoBlockOptionsQCow' } }
2944 # @BlockdevOptionsQcow:
2946 # Driver specific block device options for qcow.
2948 # @encrypt:               Image decryption options. Mandatory for
2949 #                         encrypted images, except when doing a metadata-only
2950 #                         probe of the image.
2952 # Since: 2.10
2954 { 'struct': 'BlockdevOptionsQcow',
2955   'base': 'BlockdevOptionsGenericCOWFormat',
2956   'data': { '*encrypt': 'BlockdevQcowEncryption' } }
2961 # @BlockdevQcow2EncryptionFormat:
2962 # @aes: AES-CBC with plain64 initialization venctors
2964 # Since: 2.10
2966 { 'enum': 'BlockdevQcow2EncryptionFormat',
2967   'data': [ 'aes', 'luks' ] }
2970 # @BlockdevQcow2Encryption:
2972 # Since: 2.10
2974 { 'union': 'BlockdevQcow2Encryption',
2975   'base': { 'format': 'BlockdevQcow2EncryptionFormat' },
2976   'discriminator': 'format',
2977   'data': { 'aes': 'QCryptoBlockOptionsQCow',
2978             'luks': 'QCryptoBlockOptionsLUKS'} }
2981 # @BlockdevOptionsQcow2:
2983 # Driver specific block device options for qcow2.
2985 # @lazy-refcounts:        whether to enable the lazy refcounts
2986 #                         feature (default is taken from the image file)
2988 # @pass-discard-request:  whether discard requests to the qcow2
2989 #                         device should be forwarded to the data source
2991 # @pass-discard-snapshot: whether discard requests for the data source
2992 #                         should be issued when a snapshot operation (e.g.
2993 #                         deleting a snapshot) frees clusters in the qcow2 file
2995 # @pass-discard-other:    whether discard requests for the data source
2996 #                         should be issued on other occasions where a cluster
2997 #                         gets freed
2999 # @overlap-check:         which overlap checks to perform for writes
3000 #                         to the image, defaults to 'cached' (since 2.2)
3002 # @cache-size:            the maximum total size of the L2 table and
3003 #                         refcount block caches in bytes (since 2.2)
3005 # @l2-cache-size:         the maximum size of the L2 table cache in
3006 #                         bytes (since 2.2)
3008 # @l2-cache-entry-size:   the size of each entry in the L2 cache in
3009 #                         bytes. It must be a power of two between 512
3010 #                         and the cluster size. The default value is
3011 #                         the cluster size (since 2.12)
3013 # @refcount-cache-size:   the maximum size of the refcount block cache
3014 #                         in bytes (since 2.2)
3016 # @cache-clean-interval:  clean unused entries in the L2 and refcount
3017 #                         caches. The interval is in seconds. The default value
3018 #                         is 600 on supporting platforms, and 0 on other
3019 #                         platforms. 0 disables this feature. (since 2.5)
3021 # @encrypt:               Image decryption options. Mandatory for
3022 #                         encrypted images, except when doing a metadata-only
3023 #                         probe of the image. (since 2.10)
3025 # Since: 2.9
3027 { 'struct': 'BlockdevOptionsQcow2',
3028   'base': 'BlockdevOptionsGenericCOWFormat',
3029   'data': { '*lazy-refcounts': 'bool',
3030             '*pass-discard-request': 'bool',
3031             '*pass-discard-snapshot': 'bool',
3032             '*pass-discard-other': 'bool',
3033             '*overlap-check': 'Qcow2OverlapChecks',
3034             '*cache-size': 'int',
3035             '*l2-cache-size': 'int',
3036             '*l2-cache-entry-size': 'int',
3037             '*refcount-cache-size': 'int',
3038             '*cache-clean-interval': 'int',
3039             '*encrypt': 'BlockdevQcow2Encryption' } }
3042 # @SshHostKeyCheckMode:
3044 # @none             Don't check the host key at all
3045 # @hash             Compare the host key with a given hash
3046 # @known_hosts      Check the host key against the known_hosts file
3048 # Since: 2.12
3050 { 'enum': 'SshHostKeyCheckMode',
3051   'data': [ 'none', 'hash', 'known_hosts' ] }
3054 # @SshHostKeyCheckHashType:
3056 # @md5              The given hash is an md5 hash
3057 # @sha1             The given hash is an sha1 hash
3059 # Since: 2.12
3061 { 'enum': 'SshHostKeyCheckHashType',
3062   'data': [ 'md5', 'sha1' ] }
3065 # @SshHostKeyHash:
3067 # @type             The hash algorithm used for the hash
3068 # @hash             The expected hash value
3070 # Since: 2.12
3072 { 'struct': 'SshHostKeyHash',
3073   'data': { 'type': 'SshHostKeyCheckHashType',
3074             'hash': 'str' }}
3077 # @SshHostKeyCheck:
3079 # Since: 2.12
3081 { 'union': 'SshHostKeyCheck',
3082   'base': { 'mode': 'SshHostKeyCheckMode' },
3083   'discriminator': 'mode',
3084   'data': { 'hash': 'SshHostKeyHash' } }
3087 # @BlockdevOptionsSsh:
3089 # @server:              host address
3091 # @path:                path to the image on the host
3093 # @user:                user as which to connect, defaults to current
3094 #                       local user name
3096 # @host-key-check:      Defines how and what to check the host key against
3097 #                       (default: known_hosts)
3099 # Since: 2.9
3101 { 'struct': 'BlockdevOptionsSsh',
3102   'data': { 'server': 'InetSocketAddress',
3103             'path': 'str',
3104             '*user': 'str',
3105             '*host-key-check': 'SshHostKeyCheck' } }
3109 # @BlkdebugEvent:
3111 # Trigger events supported by blkdebug.
3113 # @l1_shrink_write_table:      write zeros to the l1 table to shrink image.
3114 #                              (since 2.11)
3116 # @l1_shrink_free_l2_clusters: discard the l2 tables. (since 2.11)
3118 # @cor_write: a write due to copy-on-read (since 2.11)
3120 # Since: 2.9
3122 { 'enum': 'BlkdebugEvent', 'prefix': 'BLKDBG',
3123   'data': [ 'l1_update', 'l1_grow_alloc_table', 'l1_grow_write_table',
3124             'l1_grow_activate_table', 'l2_load', 'l2_update',
3125             'l2_update_compressed', 'l2_alloc_cow_read', 'l2_alloc_write',
3126             'read_aio', 'read_backing_aio', 'read_compressed', 'write_aio',
3127             'write_compressed', 'vmstate_load', 'vmstate_save', 'cow_read',
3128             'cow_write', 'reftable_load', 'reftable_grow', 'reftable_update',
3129             'refblock_load', 'refblock_update', 'refblock_update_part',
3130             'refblock_alloc', 'refblock_alloc_hookup', 'refblock_alloc_write',
3131             'refblock_alloc_write_blocks', 'refblock_alloc_write_table',
3132             'refblock_alloc_switch_table', 'cluster_alloc',
3133             'cluster_alloc_bytes', 'cluster_free', 'flush_to_os',
3134             'flush_to_disk', 'pwritev_rmw_head', 'pwritev_rmw_after_head',
3135             'pwritev_rmw_tail', 'pwritev_rmw_after_tail', 'pwritev',
3136             'pwritev_zero', 'pwritev_done', 'empty_image_prepare',
3137             'l1_shrink_write_table', 'l1_shrink_free_l2_clusters',
3138             'cor_write'] }
3141 # @BlkdebugInjectErrorOptions:
3143 # Describes a single error injection for blkdebug.
3145 # @event:       trigger event
3147 # @state:       the state identifier blkdebug needs to be in to
3148 #               actually trigger the event; defaults to "any"
3150 # @errno:       error identifier (errno) to be returned; defaults to
3151 #               EIO
3153 # @sector:      specifies the sector index which has to be affected
3154 #               in order to actually trigger the event; defaults to "any
3155 #               sector"
3157 # @once:        disables further events after this one has been
3158 #               triggered; defaults to false
3160 # @immediately: fail immediately; defaults to false
3162 # Since: 2.9
3164 { 'struct': 'BlkdebugInjectErrorOptions',
3165   'data': { 'event': 'BlkdebugEvent',
3166             '*state': 'int',
3167             '*errno': 'int',
3168             '*sector': 'int',
3169             '*once': 'bool',
3170             '*immediately': 'bool' } }
3173 # @BlkdebugSetStateOptions:
3175 # Describes a single state-change event for blkdebug.
3177 # @event:       trigger event
3179 # @state:       the current state identifier blkdebug needs to be in;
3180 #               defaults to "any"
3182 # @new_state:   the state identifier blkdebug is supposed to assume if
3183 #               this event is triggered
3185 # Since: 2.9
3187 { 'struct': 'BlkdebugSetStateOptions',
3188   'data': { 'event': 'BlkdebugEvent',
3189             '*state': 'int',
3190             'new_state': 'int' } }
3193 # @BlockdevOptionsBlkdebug:
3195 # Driver specific block device options for blkdebug.
3197 # @image:           underlying raw block device (or image file)
3199 # @config:          filename of the configuration file
3201 # @align:           required alignment for requests in bytes, must be
3202 #                   positive power of 2, or 0 for default
3204 # @max-transfer:    maximum size for I/O transfers in bytes, must be
3205 #                   positive multiple of @align and of the underlying
3206 #                   file's request alignment (but need not be a power of
3207 #                   2), or 0 for default (since 2.10)
3209 # @opt-write-zero:  preferred alignment for write zero requests in bytes,
3210 #                   must be positive multiple of @align and of the
3211 #                   underlying file's request alignment (but need not be a
3212 #                   power of 2), or 0 for default (since 2.10)
3214 # @max-write-zero:  maximum size for write zero requests in bytes, must be
3215 #                   positive multiple of @align, of @opt-write-zero, and of
3216 #                   the underlying file's request alignment (but need not
3217 #                   be a power of 2), or 0 for default (since 2.10)
3219 # @opt-discard:     preferred alignment for discard requests in bytes, must
3220 #                   be positive multiple of @align and of the underlying
3221 #                   file's request alignment (but need not be a power of
3222 #                   2), or 0 for default (since 2.10)
3224 # @max-discard:     maximum size for discard requests in bytes, must be
3225 #                   positive multiple of @align, of @opt-discard, and of
3226 #                   the underlying file's request alignment (but need not
3227 #                   be a power of 2), or 0 for default (since 2.10)
3229 # @inject-error:    array of error injection descriptions
3231 # @set-state:       array of state-change descriptions
3233 # Since: 2.9
3235 { 'struct': 'BlockdevOptionsBlkdebug',
3236   'data': { 'image': 'BlockdevRef',
3237             '*config': 'str',
3238             '*align': 'int', '*max-transfer': 'int32',
3239             '*opt-write-zero': 'int32', '*max-write-zero': 'int32',
3240             '*opt-discard': 'int32', '*max-discard': 'int32',
3241             '*inject-error': ['BlkdebugInjectErrorOptions'],
3242             '*set-state': ['BlkdebugSetStateOptions'] } }
3245 # @BlockdevOptionsBlklogwrites:
3247 # Driver specific block device options for blklogwrites.
3249 # @file:            block device
3251 # @log:             block device used to log writes to @file
3253 # @log-sector-size: sector size used in logging writes to @file, determines
3254 #                   granularity of offsets and sizes of writes (default: 512)
3256 # @log-append:      append to an existing log (default: false)
3258 # @log-super-update-interval: interval of write requests after which the log
3259 #                             super block is updated to disk (default: 4096)
3261 # Since: 3.0
3263 { 'struct': 'BlockdevOptionsBlklogwrites',
3264   'data': { 'file': 'BlockdevRef',
3265             'log': 'BlockdevRef',
3266             '*log-sector-size': 'uint32',
3267             '*log-append': 'bool',
3268             '*log-super-update-interval': 'uint64' } }
3271 # @BlockdevOptionsBlkverify:
3273 # Driver specific block device options for blkverify.
3275 # @test:    block device to be tested
3277 # @raw:     raw image used for verification
3279 # Since: 2.9
3281 { 'struct': 'BlockdevOptionsBlkverify',
3282   'data': { 'test': 'BlockdevRef',
3283             'raw': 'BlockdevRef' } }
3286 # @QuorumReadPattern:
3288 # An enumeration of quorum read patterns.
3290 # @quorum: read all the children and do a quorum vote on reads
3292 # @fifo: read only from the first child that has not failed
3294 # Since: 2.9
3296 { 'enum': 'QuorumReadPattern', 'data': [ 'quorum', 'fifo' ] }
3299 # @BlockdevOptionsQuorum:
3301 # Driver specific block device options for Quorum
3303 # @blkverify:      true if the driver must print content mismatch
3304 #                  set to false by default
3306 # @children:       the children block devices to use
3308 # @vote-threshold: the vote limit under which a read will fail
3310 # @rewrite-corrupted: rewrite corrupted data when quorum is reached
3311 #                     (Since 2.1)
3313 # @read-pattern: choose read pattern and set to quorum by default
3314 #                (Since 2.2)
3316 # Since: 2.9
3318 { 'struct': 'BlockdevOptionsQuorum',
3319   'data': { '*blkverify': 'bool',
3320             'children': [ 'BlockdevRef' ],
3321             'vote-threshold': 'int',
3322             '*rewrite-corrupted': 'bool',
3323             '*read-pattern': 'QuorumReadPattern' } }
3326 # @BlockdevOptionsGluster:
3328 # Driver specific block device options for Gluster
3330 # @volume:      name of gluster volume where VM image resides
3332 # @path:        absolute path to image file in gluster volume
3334 # @server:      gluster servers description
3336 # @debug:       libgfapi log level (default '4' which is Error)
3337 #               (Since 2.8)
3339 # @logfile:     libgfapi log file (default /dev/stderr) (Since 2.8)
3341 # Since: 2.9
3343 { 'struct': 'BlockdevOptionsGluster',
3344   'data': { 'volume': 'str',
3345             'path': 'str',
3346             'server': ['SocketAddress'],
3347             '*debug': 'int',
3348             '*logfile': 'str' } }
3351 # @IscsiTransport:
3353 # An enumeration of libiscsi transport types
3355 # Since: 2.9
3357 { 'enum': 'IscsiTransport',
3358   'data': [ 'tcp', 'iser' ] }
3361 # @IscsiHeaderDigest:
3363 # An enumeration of header digests supported by libiscsi
3365 # Since: 2.9
3367 { 'enum': 'IscsiHeaderDigest',
3368   'prefix': 'QAPI_ISCSI_HEADER_DIGEST',
3369   'data': [ 'crc32c', 'none', 'crc32c-none', 'none-crc32c' ] }
3372 # @BlockdevOptionsIscsi:
3374 # @transport:       The iscsi transport type
3376 # @portal:          The address of the iscsi portal
3378 # @target:          The target iqn name
3380 # @lun:             LUN to connect to. Defaults to 0.
3382 # @user:            User name to log in with. If omitted, no CHAP
3383 #                   authentication is performed.
3385 # @password-secret: The ID of a QCryptoSecret object providing
3386 #                   the password for the login. This option is required if
3387 #                   @user is specified.
3389 # @initiator-name:  The iqn name we want to identify to the target
3390 #                   as. If this option is not specified, an initiator name is
3391 #                   generated automatically.
3393 # @header-digest:   The desired header digest. Defaults to
3394 #                   none-crc32c.
3396 # @timeout:         Timeout in seconds after which a request will
3397 #                   timeout. 0 means no timeout and is the default.
3399 # Driver specific block device options for iscsi
3401 # Since: 2.9
3403 { 'struct': 'BlockdevOptionsIscsi',
3404   'data': { 'transport': 'IscsiTransport',
3405             'portal': 'str',
3406             'target': 'str',
3407             '*lun': 'int',
3408             '*user': 'str',
3409             '*password-secret': 'str',
3410             '*initiator-name': 'str',
3411             '*header-digest': 'IscsiHeaderDigest',
3412             '*timeout': 'int' } }
3416 # @RbdAuthMode:
3418 # Since: 3.0
3420 { 'enum': 'RbdAuthMode',
3421   'data': [ 'cephx', 'none' ] }
3424 # @BlockdevOptionsRbd:
3426 # @pool:               Ceph pool name.
3428 # @image:              Image name in the Ceph pool.
3430 # @conf:               path to Ceph configuration file.  Values
3431 #                      in the configuration file will be overridden by
3432 #                      options specified via QAPI.
3434 # @snapshot:           Ceph snapshot name.
3436 # @user:               Ceph id name.
3438 # @auth-client-required: Acceptable authentication modes.
3439 #                      This maps to Ceph configuration option
3440 #                      "auth_client_required".  (Since 3.0)
3442 # @key-secret:         ID of a QCryptoSecret object providing a key
3443 #                      for cephx authentication.
3444 #                      This maps to Ceph configuration option
3445 #                      "key".  (Since 3.0)
3447 # @server:             Monitor host address and port.  This maps
3448 #                      to the "mon_host" Ceph option.
3450 # Since: 2.9
3452 { 'struct': 'BlockdevOptionsRbd',
3453   'data': { 'pool': 'str',
3454             'image': 'str',
3455             '*conf': 'str',
3456             '*snapshot': 'str',
3457             '*user': 'str',
3458             '*auth-client-required': ['RbdAuthMode'],
3459             '*key-secret': 'str',
3460             '*server': ['InetSocketAddressBase'] } }
3463 # @BlockdevOptionsSheepdog:
3465 # Driver specific block device options for sheepdog
3467 # @vdi:         Virtual disk image name
3468 # @server:      The Sheepdog server to connect to
3469 # @snap-id:     Snapshot ID
3470 # @tag:         Snapshot tag name
3472 # Only one of @snap-id and @tag may be present.
3474 # Since: 2.9
3476 { 'struct': 'BlockdevOptionsSheepdog',
3477   'data': { 'server': 'SocketAddress',
3478             'vdi': 'str',
3479             '*snap-id': 'uint32',
3480             '*tag': 'str' } }
3483 # @ReplicationMode:
3485 # An enumeration of replication modes.
3487 # @primary: Primary mode, the vm's state will be sent to secondary QEMU.
3489 # @secondary: Secondary mode, receive the vm's state from primary QEMU.
3491 # Since: 2.9
3493 { 'enum' : 'ReplicationMode', 'data' : [ 'primary', 'secondary' ],
3494   'if': 'defined(CONFIG_REPLICATION)' }
3497 # @BlockdevOptionsReplication:
3499 # Driver specific block device options for replication
3501 # @mode: the replication mode
3503 # @top-id: In secondary mode, node name or device ID of the root
3504 #          node who owns the replication node chain. Must not be given in
3505 #          primary mode.
3507 # Since: 2.9
3509 { 'struct': 'BlockdevOptionsReplication',
3510   'base': 'BlockdevOptionsGenericFormat',
3511   'data': { 'mode': 'ReplicationMode',
3512             '*top-id': 'str' },
3513   'if': 'defined(CONFIG_REPLICATION)' }
3516 # @NFSTransport:
3518 # An enumeration of NFS transport types
3520 # @inet:        TCP transport
3522 # Since: 2.9
3524 { 'enum': 'NFSTransport',
3525   'data': [ 'inet' ] }
3528 # @NFSServer:
3530 # Captures the address of the socket
3532 # @type:        transport type used for NFS (only TCP supported)
3534 # @host:        host address for NFS server
3536 # Since: 2.9
3538 { 'struct': 'NFSServer',
3539   'data': { 'type': 'NFSTransport',
3540             'host': 'str' } }
3543 # @BlockdevOptionsNfs:
3545 # Driver specific block device option for NFS
3547 # @server:                  host address
3549 # @path:                    path of the image on the host
3551 # @user:                    UID value to use when talking to the
3552 #                           server (defaults to 65534 on Windows and getuid()
3553 #                           on unix)
3555 # @group:                   GID value to use when talking to the
3556 #                           server (defaults to 65534 on Windows and getgid()
3557 #                           in unix)
3559 # @tcp-syn-count:           number of SYNs during the session
3560 #                           establishment (defaults to libnfs default)
3562 # @readahead-size:          set the readahead size in bytes (defaults
3563 #                           to libnfs default)
3565 # @page-cache-size:         set the pagecache size in bytes (defaults
3566 #                           to libnfs default)
3568 # @debug:                   set the NFS debug level (max 2) (defaults
3569 #                           to libnfs default)
3571 # Since: 2.9
3573 { 'struct': 'BlockdevOptionsNfs',
3574   'data': { 'server': 'NFSServer',
3575             'path': 'str',
3576             '*user': 'int',
3577             '*group': 'int',
3578             '*tcp-syn-count': 'int',
3579             '*readahead-size': 'int',
3580             '*page-cache-size': 'int',
3581             '*debug': 'int' } }
3584 # @BlockdevOptionsCurlBase:
3586 # Driver specific block device options shared by all protocols supported by the
3587 # curl backend.
3589 # @url:                     URL of the image file
3591 # @readahead:               Size of the read-ahead cache; must be a multiple of
3592 #                           512 (defaults to 256 kB)
3594 # @timeout:                 Timeout for connections, in seconds (defaults to 5)
3596 # @username:                Username for authentication (defaults to none)
3598 # @password-secret:         ID of a QCryptoSecret object providing a password
3599 #                           for authentication (defaults to no password)
3601 # @proxy-username:          Username for proxy authentication (defaults to none)
3603 # @proxy-password-secret:   ID of a QCryptoSecret object providing a password
3604 #                           for proxy authentication (defaults to no password)
3606 # Since: 2.9
3608 { 'struct': 'BlockdevOptionsCurlBase',
3609   'data': { 'url': 'str',
3610             '*readahead': 'int',
3611             '*timeout': 'int',
3612             '*username': 'str',
3613             '*password-secret': 'str',
3614             '*proxy-username': 'str',
3615             '*proxy-password-secret': 'str' } }
3618 # @BlockdevOptionsCurlHttp:
3620 # Driver specific block device options for HTTP connections over the curl
3621 # backend.  URLs must start with "http://".
3623 # @cookie:      List of cookies to set; format is
3624 #               "name1=content1; name2=content2;" as explained by
3625 #               CURLOPT_COOKIE(3). Defaults to no cookies.
3627 # @cookie-secret: ID of a QCryptoSecret object providing the cookie data in a
3628 #                 secure way. See @cookie for the format. (since 2.10)
3630 # Since: 2.9
3632 { 'struct': 'BlockdevOptionsCurlHttp',
3633   'base': 'BlockdevOptionsCurlBase',
3634   'data': { '*cookie': 'str',
3635             '*cookie-secret': 'str'} }
3638 # @BlockdevOptionsCurlHttps:
3640 # Driver specific block device options for HTTPS connections over the curl
3641 # backend.  URLs must start with "https://".
3643 # @cookie:      List of cookies to set; format is
3644 #               "name1=content1; name2=content2;" as explained by
3645 #               CURLOPT_COOKIE(3). Defaults to no cookies.
3647 # @sslverify:   Whether to verify the SSL certificate's validity (defaults to
3648 #               true)
3650 # @cookie-secret: ID of a QCryptoSecret object providing the cookie data in a
3651 #                 secure way. See @cookie for the format. (since 2.10)
3653 # Since: 2.9
3655 { 'struct': 'BlockdevOptionsCurlHttps',
3656   'base': 'BlockdevOptionsCurlBase',
3657   'data': { '*cookie': 'str',
3658             '*sslverify': 'bool',
3659             '*cookie-secret': 'str'} }
3662 # @BlockdevOptionsCurlFtp:
3664 # Driver specific block device options for FTP connections over the curl
3665 # backend.  URLs must start with "ftp://".
3667 # Since: 2.9
3669 { 'struct': 'BlockdevOptionsCurlFtp',
3670   'base': 'BlockdevOptionsCurlBase',
3671   'data': { } }
3674 # @BlockdevOptionsCurlFtps:
3676 # Driver specific block device options for FTPS connections over the curl
3677 # backend.  URLs must start with "ftps://".
3679 # @sslverify:   Whether to verify the SSL certificate's validity (defaults to
3680 #               true)
3682 # Since: 2.9
3684 { 'struct': 'BlockdevOptionsCurlFtps',
3685   'base': 'BlockdevOptionsCurlBase',
3686   'data': { '*sslverify': 'bool' } }
3689 # @BlockdevOptionsNbd:
3691 # Driver specific block device options for NBD.
3693 # @server:      NBD server address
3695 # @export:      export name
3697 # @tls-creds:   TLS credentials ID
3699 # @x-dirty-bitmap: A "qemu:dirty-bitmap:NAME" string to query in place of
3700 #                  traditional "base:allocation" block status (see
3701 #                  NBD_OPT_LIST_META_CONTEXT in the NBD protocol) (since 3.0)
3703 # Since: 2.9
3705 { 'struct': 'BlockdevOptionsNbd',
3706   'data': { 'server': 'SocketAddress',
3707             '*export': 'str',
3708             '*tls-creds': 'str',
3709             '*x-dirty-bitmap': 'str' } }
3712 # @BlockdevOptionsRaw:
3714 # Driver specific block device options for the raw driver.
3716 # @offset:      position where the block device starts
3717 # @size:        the assumed size of the device
3719 # Since: 2.9
3721 { 'struct': 'BlockdevOptionsRaw',
3722   'base': 'BlockdevOptionsGenericFormat',
3723   'data': { '*offset': 'int', '*size': 'int' } }
3726 # @BlockdevOptionsVxHS:
3728 # Driver specific block device options for VxHS
3730 # @vdisk-id:    UUID of VxHS volume
3731 # @server:      vxhs server IP, port
3732 # @tls-creds:   TLS credentials ID
3734 # Since: 2.10
3736 { 'struct': 'BlockdevOptionsVxHS',
3737   'data': { 'vdisk-id': 'str',
3738             'server': 'InetSocketAddressBase',
3739             '*tls-creds': 'str' } }
3742 # @BlockdevOptionsThrottle:
3744 # Driver specific block device options for the throttle driver
3746 # @throttle-group:   the name of the throttle-group object to use. It
3747 #                    must already exist.
3748 # @file:             reference to or definition of the data source block device
3749 # Since: 2.11
3751 { 'struct': 'BlockdevOptionsThrottle',
3752   'data': { 'throttle-group': 'str',
3753             'file' : 'BlockdevRef'
3754              } }
3756 # @BlockdevOptions:
3758 # Options for creating a block device.  Many options are available for all
3759 # block devices, independent of the block driver:
3761 # @driver:        block driver name
3762 # @node-name:     the node name of the new node (Since 2.0).
3763 #                 This option is required on the top level of blockdev-add.
3764 #                 Valid node names start with an alphabetic character and may
3765 #                 contain only alphanumeric characters, '-', '.' and '_'. Their
3766 #                 maximum length is 31 characters.
3767 # @discard:       discard-related options (default: ignore)
3768 # @cache:         cache-related options
3769 # @read-only:     whether the block device should be read-only (default: false).
3770 #                 Note that some block drivers support only read-only access,
3771 #                 either generally or in certain configurations. In this case,
3772 #                 the default value does not work and the option must be
3773 #                 specified explicitly.
3774 # @auto-read-only: if true and @read-only is false, QEMU may automatically
3775 #                  decide not to open the image read-write as requested, but
3776 #                  fall back to read-only instead (and switch between the modes
3777 #                  later), e.g. depending on whether the image file is writable
3778 #                  or whether a writing user is attached to the node
3779 #                  (default: false, since 3.1)
3780 # @detect-zeroes: detect and optimize zero writes (Since 2.1)
3781 #                 (default: off)
3782 # @force-share:   force share all permission on added nodes.
3783 #                 Requires read-only=true. (Since 2.10)
3785 # Remaining options are determined by the block driver.
3787 # Since: 2.9
3789 { 'union': 'BlockdevOptions',
3790   'base': { 'driver': 'BlockdevDriver',
3791             '*node-name': 'str',
3792             '*discard': 'BlockdevDiscardOptions',
3793             '*cache': 'BlockdevCacheOptions',
3794             '*read-only': 'bool',
3795             '*auto-read-only': 'bool',
3796             '*force-share': 'bool',
3797             '*detect-zeroes': 'BlockdevDetectZeroesOptions' },
3798   'discriminator': 'driver',
3799   'data': {
3800       'blkdebug':   'BlockdevOptionsBlkdebug',
3801       'blklogwrites':'BlockdevOptionsBlklogwrites',
3802       'blkverify':  'BlockdevOptionsBlkverify',
3803       'bochs':      'BlockdevOptionsGenericFormat',
3804       'cloop':      'BlockdevOptionsGenericFormat',
3805       'copy-on-read':'BlockdevOptionsGenericFormat',
3806       'dmg':        'BlockdevOptionsGenericFormat',
3807       'file':       'BlockdevOptionsFile',
3808       'ftp':        'BlockdevOptionsCurlFtp',
3809       'ftps':       'BlockdevOptionsCurlFtps',
3810       'gluster':    'BlockdevOptionsGluster',
3811       'host_cdrom': 'BlockdevOptionsFile',
3812       'host_device':'BlockdevOptionsFile',
3813       'http':       'BlockdevOptionsCurlHttp',
3814       'https':      'BlockdevOptionsCurlHttps',
3815       'iscsi':      'BlockdevOptionsIscsi',
3816       'luks':       'BlockdevOptionsLUKS',
3817       'nbd':        'BlockdevOptionsNbd',
3818       'nfs':        'BlockdevOptionsNfs',
3819       'null-aio':   'BlockdevOptionsNull',
3820       'null-co':    'BlockdevOptionsNull',
3821       'nvme':       'BlockdevOptionsNVMe',
3822       'parallels':  'BlockdevOptionsGenericFormat',
3823       'qcow2':      'BlockdevOptionsQcow2',
3824       'qcow':       'BlockdevOptionsQcow',
3825       'qed':        'BlockdevOptionsGenericCOWFormat',
3826       'quorum':     'BlockdevOptionsQuorum',
3827       'raw':        'BlockdevOptionsRaw',
3828       'rbd':        'BlockdevOptionsRbd',
3829       'replication': { 'type': 'BlockdevOptionsReplication',
3830                        'if': 'defined(CONFIG_REPLICATION)' },
3831       'sheepdog':   'BlockdevOptionsSheepdog',
3832       'ssh':        'BlockdevOptionsSsh',
3833       'throttle':   'BlockdevOptionsThrottle',
3834       'vdi':        'BlockdevOptionsGenericFormat',
3835       'vhdx':       'BlockdevOptionsGenericFormat',
3836       'vmdk':       'BlockdevOptionsGenericCOWFormat',
3837       'vpc':        'BlockdevOptionsGenericFormat',
3838       'vvfat':      'BlockdevOptionsVVFAT',
3839       'vxhs':       'BlockdevOptionsVxHS'
3840   } }
3843 # @BlockdevRef:
3845 # Reference to a block device.
3847 # @definition:      defines a new block device inline
3848 # @reference:       references the ID of an existing block device
3850 # Since: 2.9
3852 { 'alternate': 'BlockdevRef',
3853   'data': { 'definition': 'BlockdevOptions',
3854             'reference': 'str' } }
3857 # @BlockdevRefOrNull:
3859 # Reference to a block device.
3861 # @definition:      defines a new block device inline
3862 # @reference:       references the ID of an existing block device.
3863 #                   An empty string means that no block device should
3864 #                   be referenced.  Deprecated; use null instead.
3865 # @null:            No block device should be referenced (since 2.10)
3867 # Since: 2.9
3869 { 'alternate': 'BlockdevRefOrNull',
3870   'data': { 'definition': 'BlockdevOptions',
3871             'reference': 'str',
3872             'null': 'null' } }
3875 # @blockdev-add:
3877 # Creates a new block device. If the @id option is given at the top level, a
3878 # BlockBackend will be created; otherwise, @node-name is mandatory at the top
3879 # level and no BlockBackend will be created.
3881 # Since: 2.9
3883 # Example:
3885 # 1.
3886 # -> { "execute": "blockdev-add",
3887 #      "arguments": {
3888 #           "driver": "qcow2",
3889 #           "node-name": "test1",
3890 #           "file": {
3891 #               "driver": "file",
3892 #               "filename": "test.qcow2"
3893 #            }
3894 #       }
3895 #     }
3896 # <- { "return": {} }
3898 # 2.
3899 # -> { "execute": "blockdev-add",
3900 #      "arguments": {
3901 #           "driver": "qcow2",
3902 #           "node-name": "node0",
3903 #           "discard": "unmap",
3904 #           "cache": {
3905 #              "direct": true
3906 #            },
3907 #            "file": {
3908 #              "driver": "file",
3909 #              "filename": "/tmp/test.qcow2"
3910 #            },
3911 #            "backing": {
3912 #               "driver": "raw",
3913 #               "file": {
3914 #                  "driver": "file",
3915 #                  "filename": "/dev/fdset/4"
3916 #                }
3917 #            }
3918 #        }
3919 #      }
3921 # <- { "return": {} }
3924 { 'command': 'blockdev-add', 'data': 'BlockdevOptions', 'boxed': true }
3927 # @blockdev-del:
3929 # Deletes a block device that has been added using blockdev-add.
3930 # The command will fail if the node is attached to a device or is
3931 # otherwise being used.
3933 # @node-name: Name of the graph node to delete.
3935 # Since: 2.9
3937 # Example:
3939 # -> { "execute": "blockdev-add",
3940 #      "arguments": {
3941 #           "driver": "qcow2",
3942 #           "node-name": "node0",
3943 #           "file": {
3944 #               "driver": "file",
3945 #               "filename": "test.qcow2"
3946 #           }
3947 #      }
3948 #    }
3949 # <- { "return": {} }
3951 # -> { "execute": "blockdev-del",
3952 #      "arguments": { "node-name": "node0" }
3953 #    }
3954 # <- { "return": {} }
3957 { 'command': 'blockdev-del', 'data': { 'node-name': 'str' } }
3960 # @BlockdevCreateOptionsFile:
3962 # Driver specific image creation options for file.
3964 # @filename         Filename for the new image file
3965 # @size             Size of the virtual disk in bytes
3966 # @preallocation    Preallocation mode for the new image (default: off)
3967 # @nocow            Turn off copy-on-write (valid only on btrfs; default: off)
3969 # Since: 2.12
3971 { 'struct': 'BlockdevCreateOptionsFile',
3972   'data': { 'filename':         'str',
3973             'size':             'size',
3974             '*preallocation':   'PreallocMode',
3975             '*nocow':           'bool' } }
3978 # @BlockdevCreateOptionsGluster:
3980 # Driver specific image creation options for gluster.
3982 # @location         Where to store the new image file
3983 # @size             Size of the virtual disk in bytes
3984 # @preallocation    Preallocation mode for the new image (default: off)
3986 # Since: 2.12
3988 { 'struct': 'BlockdevCreateOptionsGluster',
3989   'data': { 'location':         'BlockdevOptionsGluster',
3990             'size':             'size',
3991             '*preallocation':   'PreallocMode' } }
3994 # @BlockdevCreateOptionsLUKS:
3996 # Driver specific image creation options for LUKS.
3998 # @file             Node to create the image format on
3999 # @size             Size of the virtual disk in bytes
4001 # Since: 2.12
4003 { 'struct': 'BlockdevCreateOptionsLUKS',
4004   'base': 'QCryptoBlockCreateOptionsLUKS',
4005   'data': { 'file':             'BlockdevRef',
4006             'size':             'size' } }
4009 # @BlockdevCreateOptionsNfs:
4011 # Driver specific image creation options for NFS.
4013 # @location         Where to store the new image file
4014 # @size             Size of the virtual disk in bytes
4016 # Since: 2.12
4018 { 'struct': 'BlockdevCreateOptionsNfs',
4019   'data': { 'location':         'BlockdevOptionsNfs',
4020             'size':             'size' } }
4023 # @BlockdevCreateOptionsParallels:
4025 # Driver specific image creation options for parallels.
4027 # @file             Node to create the image format on
4028 # @size             Size of the virtual disk in bytes
4029 # @cluster-size     Cluster size in bytes (default: 1 MB)
4031 # Since: 2.12
4033 { 'struct': 'BlockdevCreateOptionsParallels',
4034   'data': { 'file':             'BlockdevRef',
4035             'size':             'size',
4036             '*cluster-size':    'size' } }
4039 # @BlockdevCreateOptionsQcow:
4041 # Driver specific image creation options for qcow.
4043 # @file             Node to create the image format on
4044 # @size             Size of the virtual disk in bytes
4045 # @backing-file     File name of the backing file if a backing file
4046 #                   should be used
4047 # @encrypt          Encryption options if the image should be encrypted
4049 # Since: 2.12
4051 { 'struct': 'BlockdevCreateOptionsQcow',
4052   'data': { 'file':             'BlockdevRef',
4053             'size':             'size',
4054             '*backing-file':    'str',
4055             '*encrypt':         'QCryptoBlockCreateOptions' } }
4058 # @BlockdevQcow2Version:
4060 # @v2:  The original QCOW2 format as introduced in qemu 0.10 (version 2)
4061 # @v3:  The extended QCOW2 format as introduced in qemu 1.1 (version 3)
4063 # Since: 2.12
4065 { 'enum': 'BlockdevQcow2Version',
4066   'data': [ 'v2', 'v3' ] }
4070 # @BlockdevCreateOptionsQcow2:
4072 # Driver specific image creation options for qcow2.
4074 # @file             Node to create the image format on
4075 # @size             Size of the virtual disk in bytes
4076 # @version          Compatibility level (default: v3)
4077 # @backing-file     File name of the backing file if a backing file
4078 #                   should be used
4079 # @backing-fmt      Name of the block driver to use for the backing file
4080 # @encrypt          Encryption options if the image should be encrypted
4081 # @cluster-size     qcow2 cluster size in bytes (default: 65536)
4082 # @preallocation    Preallocation mode for the new image (default: off)
4083 # @lazy-refcounts   True if refcounts may be updated lazily (default: off)
4084 # @refcount-bits    Width of reference counts in bits (default: 16)
4086 # Since: 2.12
4088 { 'struct': 'BlockdevCreateOptionsQcow2',
4089   'data': { 'file':             'BlockdevRef',
4090             'size':             'size',
4091             '*version':         'BlockdevQcow2Version',
4092             '*backing-file':    'str',
4093             '*backing-fmt':     'BlockdevDriver',
4094             '*encrypt':         'QCryptoBlockCreateOptions',
4095             '*cluster-size':    'size',
4096             '*preallocation':   'PreallocMode',
4097             '*lazy-refcounts':  'bool',
4098             '*refcount-bits':   'int' } }
4101 # @BlockdevCreateOptionsQed:
4103 # Driver specific image creation options for qed.
4105 # @file             Node to create the image format on
4106 # @size             Size of the virtual disk in bytes
4107 # @backing-file     File name of the backing file if a backing file
4108 #                   should be used
4109 # @backing-fmt      Name of the block driver to use for the backing file
4110 # @cluster-size     Cluster size in bytes (default: 65536)
4111 # @table-size       L1/L2 table size (in clusters)
4113 # Since: 2.12
4115 { 'struct': 'BlockdevCreateOptionsQed',
4116   'data': { 'file':             'BlockdevRef',
4117             'size':             'size',
4118             '*backing-file':    'str',
4119             '*backing-fmt':     'BlockdevDriver',
4120             '*cluster-size':    'size',
4121             '*table-size':      'int' } }
4124 # @BlockdevCreateOptionsRbd:
4126 # Driver specific image creation options for rbd/Ceph.
4128 # @location         Where to store the new image file. This location cannot
4129 #                   point to a snapshot.
4130 # @size             Size of the virtual disk in bytes
4131 # @cluster-size     RBD object size
4133 # Since: 2.12
4135 { 'struct': 'BlockdevCreateOptionsRbd',
4136   'data': { 'location':         'BlockdevOptionsRbd',
4137             'size':             'size',
4138             '*cluster-size' :   'size' } }
4141 # @BlockdevVmdkSubformat:
4143 # Subformat options for VMDK images
4145 # @monolithicSparse:     Single file image with sparse cluster allocation
4147 # @monolithicFlat:       Single flat data image and a descriptor file
4149 # @twoGbMaxExtentSparse: Data is split into 2GB (per virtual LBA) sparse extent
4150 #                        files, in addition to a descriptor file
4152 # @twoGbMaxExtentFlat:   Data is split into 2GB (per virtual LBA) flat extent
4153 #                        files, in addition to a descriptor file
4155 # @streamOptimized:      Single file image sparse cluster allocation, optimized
4156 #                        for streaming over network.
4158 # Since: 4.0
4160 { 'enum': 'BlockdevVmdkSubformat',
4161   'data': [ 'monolithicSparse', 'monolithicFlat', 'twoGbMaxExtentSparse',
4162             'twoGbMaxExtentFlat', 'streamOptimized'] }
4165 # @BlockdevVmdkAdapterType:
4167 # Adapter type info for VMDK images
4169 # Since: 4.0
4171 { 'enum': 'BlockdevVmdkAdapterType',
4172   'data': [ 'ide', 'buslogic', 'lsilogic', 'legacyESX'] }
4175 # @BlockdevCreateOptionsVmdk:
4177 # Driver specific image creation options for VMDK.
4179 # @file         Where to store the new image file. This refers to the image
4180 #               file for monolithcSparse and streamOptimized format, or the
4181 #               descriptor file for other formats.
4182 # @size         Size of the virtual disk in bytes
4183 # @extents      Where to store the data extents. Required for monolithcFlat,
4184 #               twoGbMaxExtentSparse and twoGbMaxExtentFlat formats. For
4185 #               monolithicFlat, only one entry is required; for
4186 #               twoGbMaxExtent* formats, the number of entries required is
4187 #               calculated as extent_number = virtual_size / 2GB. Providing
4188 #               more extents than will be used is an error.
4189 # @subformat    The subformat of the VMDK image. Default: "monolithicSparse".
4190 # @backing-file The path of backing file. Default: no backing file is used.
4191 # @adapter-type The adapter type used to fill in the descriptor. Default: ide.
4192 # @hwversion    Hardware version. The meaningful options are "4" or "6".
4193 #               Default: "4".
4194 # @zeroed-grain Whether to enable zeroed-grain feature for sparse subformats.
4195 #               Default: false.
4197 # Since: 4.0
4199 { 'struct': 'BlockdevCreateOptionsVmdk',
4200   'data': { 'file':             'BlockdevRef',
4201             'size':             'size',
4202             '*extents':          ['BlockdevRef'],
4203             '*subformat':       'BlockdevVmdkSubformat',
4204             '*backing-file':    'str',
4205             '*adapter-type':    'BlockdevVmdkAdapterType',
4206             '*hwversion':       'str',
4207             '*zeroed-grain':    'bool' } }
4211 # @SheepdogRedundancyType:
4213 # @full             Create a fully replicated vdi with x copies
4214 # @erasure-coded    Create an erasure coded vdi with x data strips and
4215 #                   y parity strips
4217 # Since: 2.12
4219 { 'enum': 'SheepdogRedundancyType',
4220   'data': [ 'full', 'erasure-coded' ] }
4223 # @SheepdogRedundancyFull:
4225 # @copies           Number of copies to use (between 1 and 31)
4227 # Since: 2.12
4229 { 'struct': 'SheepdogRedundancyFull',
4230   'data': { 'copies': 'int' }}
4233 # @SheepdogRedundancyErasureCoded:
4235 # @data-strips      Number of data strips to use (one of {2,4,8,16})
4236 # @parity-strips    Number of parity strips to use (between 1 and 15)
4238 # Since: 2.12
4240 { 'struct': 'SheepdogRedundancyErasureCoded',
4241   'data': { 'data-strips': 'int',
4242             'parity-strips': 'int' }}
4245 # @SheepdogRedundancy:
4247 # Since: 2.12
4249 { 'union': 'SheepdogRedundancy',
4250   'base': { 'type': 'SheepdogRedundancyType' },
4251   'discriminator': 'type',
4252   'data': { 'full': 'SheepdogRedundancyFull',
4253             'erasure-coded': 'SheepdogRedundancyErasureCoded' } }
4256 # @BlockdevCreateOptionsSheepdog:
4258 # Driver specific image creation options for Sheepdog.
4260 # @location         Where to store the new image file
4261 # @size             Size of the virtual disk in bytes
4262 # @backing-file     File name of a base image
4263 # @preallocation    Preallocation mode (allowed values: off, full)
4264 # @redundancy       Redundancy of the image
4265 # @object-size      Object size of the image
4267 # Since: 2.12
4269 { 'struct': 'BlockdevCreateOptionsSheepdog',
4270   'data': { 'location':         'BlockdevOptionsSheepdog',
4271             'size':             'size',
4272             '*backing-file':    'str',
4273             '*preallocation':   'PreallocMode',
4274             '*redundancy':      'SheepdogRedundancy',
4275             '*object-size':     'size' } }
4278 # @BlockdevCreateOptionsSsh:
4280 # Driver specific image creation options for SSH.
4282 # @location         Where to store the new image file
4283 # @size             Size of the virtual disk in bytes
4285 # Since: 2.12
4287 { 'struct': 'BlockdevCreateOptionsSsh',
4288   'data': { 'location':         'BlockdevOptionsSsh',
4289             'size':             'size' } }
4292 # @BlockdevCreateOptionsVdi:
4294 # Driver specific image creation options for VDI.
4296 # @file             Node to create the image format on
4297 # @size             Size of the virtual disk in bytes
4298 # @preallocation    Preallocation mode for the new image (allowed values: off,
4299 #                   metadata; default: off)
4301 # Since: 2.12
4303 { 'struct': 'BlockdevCreateOptionsVdi',
4304   'data': { 'file':             'BlockdevRef',
4305             'size':             'size',
4306             '*preallocation':   'PreallocMode' } }
4309 # @BlockdevVhdxSubformat:
4311 # @dynamic: Growing image file
4312 # @fixed:   Preallocated fixed-size image file
4314 # Since: 2.12
4316 { 'enum': 'BlockdevVhdxSubformat',
4317   'data': [ 'dynamic', 'fixed' ] }
4320 # @BlockdevCreateOptionsVhdx:
4322 # Driver specific image creation options for vhdx.
4324 # @file             Node to create the image format on
4325 # @size             Size of the virtual disk in bytes
4326 # @log-size         Log size in bytes, must be a multiple of 1 MB
4327 #                   (default: 1 MB)
4328 # @block-size       Block size in bytes, must be a multiple of 1 MB and not
4329 #                   larger than 256 MB (default: automatically choose a block
4330 #                   size depending on the image size)
4331 # @subformat        vhdx subformat (default: dynamic)
4332 # @block-state-zero Force use of payload blocks of type 'ZERO'. Non-standard,
4333 #                   but default.  Do not set to 'off' when using 'qemu-img
4334 #                   convert' with subformat=dynamic.
4336 # Since: 2.12
4338 { 'struct': 'BlockdevCreateOptionsVhdx',
4339   'data': { 'file':                 'BlockdevRef',
4340             'size':                 'size',
4341             '*log-size':            'size',
4342             '*block-size':          'size',
4343             '*subformat':           'BlockdevVhdxSubformat',
4344             '*block-state-zero':    'bool' } }
4347 # @BlockdevVpcSubformat:
4349 # @dynamic: Growing image file
4350 # @fixed:   Preallocated fixed-size image file
4352 # Since: 2.12
4354 { 'enum': 'BlockdevVpcSubformat',
4355   'data': [ 'dynamic', 'fixed' ] }
4358 # @BlockdevCreateOptionsVpc:
4360 # Driver specific image creation options for vpc (VHD).
4362 # @file             Node to create the image format on
4363 # @size             Size of the virtual disk in bytes
4364 # @subformat        vhdx subformat (default: dynamic)
4365 # @force-size       Force use of the exact byte size instead of rounding to the
4366 #                   next size that can be represented in CHS geometry
4367 #                   (default: false)
4369 # Since: 2.12
4371 { 'struct': 'BlockdevCreateOptionsVpc',
4372   'data': { 'file':                 'BlockdevRef',
4373             'size':                 'size',
4374             '*subformat':           'BlockdevVpcSubformat',
4375             '*force-size':          'bool' } }
4378 # @BlockdevCreateOptions:
4380 # Options for creating an image format on a given node.
4382 # @driver           block driver to create the image format
4384 # Since: 2.12
4386 { 'union': 'BlockdevCreateOptions',
4387   'base': {
4388       'driver':         'BlockdevDriver' },
4389   'discriminator': 'driver',
4390   'data': {
4391       'file':           'BlockdevCreateOptionsFile',
4392       'gluster':        'BlockdevCreateOptionsGluster',
4393       'luks':           'BlockdevCreateOptionsLUKS',
4394       'nfs':            'BlockdevCreateOptionsNfs',
4395       'parallels':      'BlockdevCreateOptionsParallels',
4396       'qcow':           'BlockdevCreateOptionsQcow',
4397       'qcow2':          'BlockdevCreateOptionsQcow2',
4398       'qed':            'BlockdevCreateOptionsQed',
4399       'rbd':            'BlockdevCreateOptionsRbd',
4400       'sheepdog':       'BlockdevCreateOptionsSheepdog',
4401       'ssh':            'BlockdevCreateOptionsSsh',
4402       'vdi':            'BlockdevCreateOptionsVdi',
4403       'vhdx':           'BlockdevCreateOptionsVhdx',
4404       'vmdk':           'BlockdevCreateOptionsVmdk',
4405       'vpc':            'BlockdevCreateOptionsVpc'
4406   } }
4409 # @blockdev-create:
4411 # Starts a job to create an image format on a given node. The job is
4412 # automatically finalized, but a manual job-dismiss is required.
4414 # @job-id:          Identifier for the newly created job.
4416 # @options:         Options for the image creation.
4418 # Since: 3.0
4420 { 'command': 'blockdev-create',
4421   'data': { 'job-id': 'str',
4422             'options': 'BlockdevCreateOptions' } }
4425 # @blockdev-open-tray:
4427 # Opens a block device's tray. If there is a block driver state tree inserted as
4428 # a medium, it will become inaccessible to the guest (but it will remain
4429 # associated to the block device, so closing the tray will make it accessible
4430 # again).
4432 # If the tray was already open before, this will be a no-op.
4434 # Once the tray opens, a DEVICE_TRAY_MOVED event is emitted. There are cases in
4435 # which no such event will be generated, these include:
4436 # - if the guest has locked the tray, @force is false and the guest does not
4437 #   respond to the eject request
4438 # - if the BlockBackend denoted by @device does not have a guest device attached
4439 #   to it
4440 # - if the guest device does not have an actual tray
4442 # @device: Block device name (deprecated, use @id instead)
4444 # @id:     The name or QOM path of the guest device (since: 2.8)
4446 # @force:  if false (the default), an eject request will be sent to
4447 #          the guest if it has locked the tray (and the tray will not be opened
4448 #          immediately); if true, the tray will be opened regardless of whether
4449 #          it is locked
4451 # Since: 2.5
4453 # Example:
4455 # -> { "execute": "blockdev-open-tray",
4456 #      "arguments": { "id": "ide0-1-0" } }
4458 # <- { "timestamp": { "seconds": 1418751016,
4459 #                     "microseconds": 716996 },
4460 #      "event": "DEVICE_TRAY_MOVED",
4461 #      "data": { "device": "ide1-cd0",
4462 #                "id": "ide0-1-0",
4463 #                "tray-open": true } }
4465 # <- { "return": {} }
4468 { 'command': 'blockdev-open-tray',
4469   'data': { '*device': 'str',
4470             '*id': 'str',
4471             '*force': 'bool' } }
4474 # @blockdev-close-tray:
4476 # Closes a block device's tray. If there is a block driver state tree associated
4477 # with the block device (which is currently ejected), that tree will be loaded
4478 # as the medium.
4480 # If the tray was already closed before, this will be a no-op.
4482 # @device:  Block device name (deprecated, use @id instead)
4484 # @id:      The name or QOM path of the guest device (since: 2.8)
4486 # Since: 2.5
4488 # Example:
4490 # -> { "execute": "blockdev-close-tray",
4491 #      "arguments": { "id": "ide0-1-0" } }
4493 # <- { "timestamp": { "seconds": 1418751345,
4494 #                     "microseconds": 272147 },
4495 #      "event": "DEVICE_TRAY_MOVED",
4496 #      "data": { "device": "ide1-cd0",
4497 #                "id": "ide0-1-0",
4498 #                "tray-open": false } }
4500 # <- { "return": {} }
4503 { 'command': 'blockdev-close-tray',
4504   'data': { '*device': 'str',
4505             '*id': 'str' } }
4508 # @blockdev-remove-medium:
4510 # Removes a medium (a block driver state tree) from a block device. That block
4511 # device's tray must currently be open (unless there is no attached guest
4512 # device).
4514 # If the tray is open and there is no medium inserted, this will be a no-op.
4516 # @id:     The name or QOM path of the guest device
4518 # Since: 2.12
4520 # Example:
4522 # -> { "execute": "blockdev-remove-medium",
4523 #      "arguments": { "id": "ide0-1-0" } }
4525 # <- { "error": { "class": "GenericError",
4526 #                 "desc": "Tray of device 'ide0-1-0' is not open" } }
4528 # -> { "execute": "blockdev-open-tray",
4529 #      "arguments": { "id": "ide0-1-0" } }
4531 # <- { "timestamp": { "seconds": 1418751627,
4532 #                     "microseconds": 549958 },
4533 #      "event": "DEVICE_TRAY_MOVED",
4534 #      "data": { "device": "ide1-cd0",
4535 #                "id": "ide0-1-0",
4536 #                "tray-open": true } }
4538 # <- { "return": {} }
4540 # -> { "execute": "blockdev-remove-medium",
4541 #      "arguments": { "id": "ide0-1-0" } }
4543 # <- { "return": {} }
4546 { 'command': 'blockdev-remove-medium',
4547   'data': { 'id': 'str' } }
4550 # @blockdev-insert-medium:
4552 # Inserts a medium (a block driver state tree) into a block device. That block
4553 # device's tray must currently be open (unless there is no attached guest
4554 # device) and there must be no medium inserted already.
4556 # @id:        The name or QOM path of the guest device
4558 # @node-name: name of a node in the block driver state graph
4560 # Since: 2.12
4562 # Example:
4564 # -> { "execute": "blockdev-add",
4565 #      "arguments": {
4566 #          "node-name": "node0",
4567 #          "driver": "raw",
4568 #          "file": { "driver": "file",
4569 #                    "filename": "fedora.iso" } } }
4570 # <- { "return": {} }
4572 # -> { "execute": "blockdev-insert-medium",
4573 #      "arguments": { "id": "ide0-1-0",
4574 #                     "node-name": "node0" } }
4576 # <- { "return": {} }
4579 { 'command': 'blockdev-insert-medium',
4580   'data': { 'id': 'str',
4581             'node-name': 'str'} }
4585 # @BlockdevChangeReadOnlyMode:
4587 # Specifies the new read-only mode of a block device subject to the
4588 # @blockdev-change-medium command.
4590 # @retain:      Retains the current read-only mode
4592 # @read-only:   Makes the device read-only
4594 # @read-write:  Makes the device writable
4596 # Since: 2.3
4599 { 'enum': 'BlockdevChangeReadOnlyMode',
4600   'data': ['retain', 'read-only', 'read-write'] }
4604 # @blockdev-change-medium:
4606 # Changes the medium inserted into a block device by ejecting the current medium
4607 # and loading a new image file which is inserted as the new medium (this command
4608 # combines blockdev-open-tray, blockdev-remove-medium, blockdev-insert-medium
4609 # and blockdev-close-tray).
4611 # @device:          Block device name (deprecated, use @id instead)
4613 # @id:              The name or QOM path of the guest device
4614 #                   (since: 2.8)
4616 # @filename:        filename of the new image to be loaded
4618 # @format:          format to open the new image with (defaults to
4619 #                   the probed format)
4621 # @read-only-mode:  change the read-only mode of the device; defaults
4622 #                   to 'retain'
4624 # Since: 2.5
4626 # Examples:
4628 # 1. Change a removable medium
4630 # -> { "execute": "blockdev-change-medium",
4631 #      "arguments": { "id": "ide0-1-0",
4632 #                     "filename": "/srv/images/Fedora-12-x86_64-DVD.iso",
4633 #                     "format": "raw" } }
4634 # <- { "return": {} }
4636 # 2. Load a read-only medium into a writable drive
4638 # -> { "execute": "blockdev-change-medium",
4639 #      "arguments": { "id": "floppyA",
4640 #                     "filename": "/srv/images/ro.img",
4641 #                     "format": "raw",
4642 #                     "read-only-mode": "retain" } }
4644 # <- { "error":
4645 #      { "class": "GenericError",
4646 #        "desc": "Could not open '/srv/images/ro.img': Permission denied" } }
4648 # -> { "execute": "blockdev-change-medium",
4649 #      "arguments": { "id": "floppyA",
4650 #                     "filename": "/srv/images/ro.img",
4651 #                     "format": "raw",
4652 #                     "read-only-mode": "read-only" } }
4654 # <- { "return": {} }
4657 { 'command': 'blockdev-change-medium',
4658   'data': { '*device': 'str',
4659             '*id': 'str',
4660             'filename': 'str',
4661             '*format': 'str',
4662             '*read-only-mode': 'BlockdevChangeReadOnlyMode' } }
4666 # @BlockErrorAction:
4668 # An enumeration of action that has been taken when a DISK I/O occurs
4670 # @ignore: error has been ignored
4672 # @report: error has been reported to the device
4674 # @stop: error caused VM to be stopped
4676 # Since: 2.1
4678 { 'enum': 'BlockErrorAction',
4679   'data': [ 'ignore', 'report', 'stop' ] }
4683 # @BLOCK_IMAGE_CORRUPTED:
4685 # Emitted when a disk image is being marked corrupt. The image can be
4686 # identified by its device or node name. The 'device' field is always
4687 # present for compatibility reasons, but it can be empty ("") if the
4688 # image does not have a device name associated.
4690 # @device: device name. This is always present for compatibility
4691 #          reasons, but it can be empty ("") if the image does not
4692 #          have a device name associated.
4694 # @node-name: node name (Since: 2.4)
4696 # @msg: informative message for human consumption, such as the kind of
4697 #       corruption being detected. It should not be parsed by machine as it is
4698 #       not guaranteed to be stable
4700 # @offset: if the corruption resulted from an image access, this is
4701 #          the host's access offset into the image
4703 # @size: if the corruption resulted from an image access, this is
4704 #        the access size
4706 # @fatal: if set, the image is marked corrupt and therefore unusable after this
4707 #        event and must be repaired (Since 2.2; before, every
4708 #        BLOCK_IMAGE_CORRUPTED event was fatal)
4710 # Note: If action is "stop", a STOP event will eventually follow the
4711 #       BLOCK_IO_ERROR event.
4713 # Example:
4715 # <- { "event": "BLOCK_IMAGE_CORRUPTED",
4716 #      "data": { "device": "ide0-hd0", "node-name": "node0",
4717 #                "msg": "Prevented active L1 table overwrite", "offset": 196608,
4718 #                "size": 65536 },
4719 #      "timestamp": { "seconds": 1378126126, "microseconds": 966463 } }
4721 # Since: 1.7
4723 { 'event': 'BLOCK_IMAGE_CORRUPTED',
4724   'data': { 'device'     : 'str',
4725             '*node-name' : 'str',
4726             'msg'        : 'str',
4727             '*offset'    : 'int',
4728             '*size'      : 'int',
4729             'fatal'      : 'bool' } }
4732 # @BLOCK_IO_ERROR:
4734 # Emitted when a disk I/O error occurs
4736 # @device: device name. This is always present for compatibility
4737 #          reasons, but it can be empty ("") if the image does not
4738 #          have a device name associated.
4740 # @node-name: node name. Note that errors may be reported for the root node
4741 #             that is directly attached to a guest device rather than for the
4742 #             node where the error occurred. The node name is not present if
4743 #             the drive is empty. (Since: 2.8)
4745 # @operation: I/O operation
4747 # @action: action that has been taken
4749 # @nospace: true if I/O error was caused due to a no-space
4750 #           condition. This key is only present if query-block's
4751 #           io-status is present, please see query-block documentation
4752 #           for more information (since: 2.2)
4754 # @reason: human readable string describing the error cause.
4755 #          (This field is a debugging aid for humans, it should not
4756 #           be parsed by applications) (since: 2.2)
4758 # Note: If action is "stop", a STOP event will eventually follow the
4759 # BLOCK_IO_ERROR event
4761 # Since: 0.13.0
4763 # Example:
4765 # <- { "event": "BLOCK_IO_ERROR",
4766 #      "data": { "device": "ide0-hd1",
4767 #                "node-name": "#block212",
4768 #                "operation": "write",
4769 #                "action": "stop" },
4770 #      "timestamp": { "seconds": 1265044230, "microseconds": 450486 } }
4773 { 'event': 'BLOCK_IO_ERROR',
4774   'data': { 'device': 'str', '*node-name': 'str',
4775             'operation': 'IoOperationType',
4776             'action': 'BlockErrorAction', '*nospace': 'bool',
4777             'reason': 'str' } }
4780 # @BLOCK_JOB_COMPLETED:
4782 # Emitted when a block job has completed
4784 # @type: job type
4786 # @device: The job identifier. Originally the device name but other
4787 #          values are allowed since QEMU 2.7
4789 # @len: maximum progress value
4791 # @offset: current progress value. On success this is equal to len.
4792 #          On failure this is less than len
4794 # @speed: rate limit, bytes per second
4796 # @error: error message. Only present on failure. This field
4797 #         contains a human-readable error message. There are no semantics
4798 #         other than that streaming has failed and clients should not try to
4799 #         interpret the error string
4801 # Since: 1.1
4803 # Example:
4805 # <- { "event": "BLOCK_JOB_COMPLETED",
4806 #      "data": { "type": "stream", "device": "virtio-disk0",
4807 #                "len": 10737418240, "offset": 10737418240,
4808 #                "speed": 0 },
4809 #      "timestamp": { "seconds": 1267061043, "microseconds": 959568 } }
4812 { 'event': 'BLOCK_JOB_COMPLETED',
4813   'data': { 'type'  : 'JobType',
4814             'device': 'str',
4815             'len'   : 'int',
4816             'offset': 'int',
4817             'speed' : 'int',
4818             '*error': 'str' } }
4821 # @BLOCK_JOB_CANCELLED:
4823 # Emitted when a block job has been cancelled
4825 # @type: job type
4827 # @device: The job identifier. Originally the device name but other
4828 #          values are allowed since QEMU 2.7
4830 # @len: maximum progress value
4832 # @offset: current progress value. On success this is equal to len.
4833 #          On failure this is less than len
4835 # @speed: rate limit, bytes per second
4837 # Since: 1.1
4839 # Example:
4841 # <- { "event": "BLOCK_JOB_CANCELLED",
4842 #      "data": { "type": "stream", "device": "virtio-disk0",
4843 #                "len": 10737418240, "offset": 134217728,
4844 #                "speed": 0 },
4845 #      "timestamp": { "seconds": 1267061043, "microseconds": 959568 } }
4848 { 'event': 'BLOCK_JOB_CANCELLED',
4849   'data': { 'type'  : 'JobType',
4850             'device': 'str',
4851             'len'   : 'int',
4852             'offset': 'int',
4853             'speed' : 'int' } }
4856 # @BLOCK_JOB_ERROR:
4858 # Emitted when a block job encounters an error
4860 # @device: The job identifier. Originally the device name but other
4861 #          values are allowed since QEMU 2.7
4863 # @operation: I/O operation
4865 # @action: action that has been taken
4867 # Since: 1.3
4869 # Example:
4871 # <- { "event": "BLOCK_JOB_ERROR",
4872 #      "data": { "device": "ide0-hd1",
4873 #                "operation": "write",
4874 #                "action": "stop" },
4875 #      "timestamp": { "seconds": 1265044230, "microseconds": 450486 } }
4878 { 'event': 'BLOCK_JOB_ERROR',
4879   'data': { 'device'   : 'str',
4880             'operation': 'IoOperationType',
4881             'action'   : 'BlockErrorAction' } }
4884 # @BLOCK_JOB_READY:
4886 # Emitted when a block job is ready to complete
4888 # @type: job type
4890 # @device: The job identifier. Originally the device name but other
4891 #          values are allowed since QEMU 2.7
4893 # @len: maximum progress value
4895 # @offset: current progress value. On success this is equal to len.
4896 #          On failure this is less than len
4898 # @speed: rate limit, bytes per second
4900 # Note: The "ready to complete" status is always reset by a @BLOCK_JOB_ERROR
4901 # event
4903 # Since: 1.3
4905 # Example:
4907 # <- { "event": "BLOCK_JOB_READY",
4908 #      "data": { "device": "drive0", "type": "mirror", "speed": 0,
4909 #                "len": 2097152, "offset": 2097152 }
4910 #      "timestamp": { "seconds": 1265044230, "microseconds": 450486 } }
4913 { 'event': 'BLOCK_JOB_READY',
4914   'data': { 'type'  : 'JobType',
4915             'device': 'str',
4916             'len'   : 'int',
4917             'offset': 'int',
4918             'speed' : 'int' } }
4921 # @BLOCK_JOB_PENDING:
4923 # Emitted when a block job is awaiting explicit authorization to finalize graph
4924 # changes via @block-job-finalize. If this job is part of a transaction, it will
4925 # not emit this event until the transaction has converged first.
4927 # @type: job type
4929 # @id: The job identifier.
4931 # Since: 2.12
4933 # Example:
4935 # <- { "event": "BLOCK_JOB_WAITING",
4936 #      "data": { "device": "drive0", "type": "mirror" },
4937 #      "timestamp": { "seconds": 1265044230, "microseconds": 450486 } }
4940 { 'event': 'BLOCK_JOB_PENDING',
4941   'data': { 'type'  : 'JobType',
4942             'id'    : 'str' } }
4945 # @PreallocMode:
4947 # Preallocation mode of QEMU image file
4949 # @off: no preallocation
4950 # @metadata: preallocate only for metadata
4951 # @falloc: like @full preallocation but allocate disk space by
4952 #          posix_fallocate() rather than writing zeros.
4953 # @full: preallocate all data by writing zeros to device to ensure disk
4954 #        space is really available. @full preallocation also sets up
4955 #        metadata correctly.
4957 # Since: 2.2
4959 { 'enum': 'PreallocMode',
4960   'data': [ 'off', 'metadata', 'falloc', 'full' ] }
4963 # @BLOCK_WRITE_THRESHOLD:
4965 # Emitted when writes on block device reaches or exceeds the
4966 # configured write threshold. For thin-provisioned devices, this
4967 # means the device should be extended to avoid pausing for
4968 # disk exhaustion.
4969 # The event is one shot. Once triggered, it needs to be
4970 # re-registered with another block-set-write-threshold command.
4972 # @node-name: graph node name on which the threshold was exceeded.
4974 # @amount-exceeded: amount of data which exceeded the threshold, in bytes.
4976 # @write-threshold: last configured threshold, in bytes.
4978 # Since: 2.3
4980 { 'event': 'BLOCK_WRITE_THRESHOLD',
4981   'data': { 'node-name': 'str',
4982             'amount-exceeded': 'uint64',
4983             'write-threshold': 'uint64' } }
4986 # @block-set-write-threshold:
4988 # Change the write threshold for a block drive. An event will be
4989 # delivered if a write to this block drive crosses the configured
4990 # threshold.  The threshold is an offset, thus must be
4991 # non-negative. Default is no write threshold. Setting the threshold
4992 # to zero disables it.
4994 # This is useful to transparently resize thin-provisioned drives without
4995 # the guest OS noticing.
4997 # @node-name: graph node name on which the threshold must be set.
4999 # @write-threshold: configured threshold for the block device, bytes.
5000 #                   Use 0 to disable the threshold.
5002 # Since: 2.3
5004 # Example:
5006 # -> { "execute": "block-set-write-threshold",
5007 #      "arguments": { "node-name": "mydev",
5008 #                     "write-threshold": 17179869184 } }
5009 # <- { "return": {} }
5012 { 'command': 'block-set-write-threshold',
5013   'data': { 'node-name': 'str', 'write-threshold': 'uint64' } }
5016 # @x-blockdev-change:
5018 # Dynamically reconfigure the block driver state graph. It can be used
5019 # to add, remove, insert or replace a graph node. Currently only the
5020 # Quorum driver implements this feature to add or remove its child. This
5021 # is useful to fix a broken quorum child.
5023 # If @node is specified, it will be inserted under @parent. @child
5024 # may not be specified in this case. If both @parent and @child are
5025 # specified but @node is not, @child will be detached from @parent.
5027 # @parent: the id or name of the parent node.
5029 # @child: the name of a child under the given parent node.
5031 # @node: the name of the node that will be added.
5033 # Note: this command is experimental, and its API is not stable. It
5034 # does not support all kinds of operations, all kinds of children, nor
5035 # all block drivers.
5037 # FIXME Removing children from a quorum node means introducing gaps in the
5038 # child indices. This cannot be represented in the 'children' list of
5039 # BlockdevOptionsQuorum, as returned by .bdrv_refresh_filename().
5041 # Warning: The data in a new quorum child MUST be consistent with that of
5042 # the rest of the array.
5044 # Since: 2.7
5046 # Example:
5048 # 1. Add a new node to a quorum
5049 # -> { "execute": "blockdev-add",
5050 #      "arguments": {
5051 #          "driver": "raw",
5052 #          "node-name": "new_node",
5053 #          "file": { "driver": "file",
5054 #                    "filename": "test.raw" } } }
5055 # <- { "return": {} }
5056 # -> { "execute": "x-blockdev-change",
5057 #      "arguments": { "parent": "disk1",
5058 #                     "node": "new_node" } }
5059 # <- { "return": {} }
5061 # 2. Delete a quorum's node
5062 # -> { "execute": "x-blockdev-change",
5063 #      "arguments": { "parent": "disk1",
5064 #                     "child": "children.1" } }
5065 # <- { "return": {} }
5068 { 'command': 'x-blockdev-change',
5069   'data' : { 'parent': 'str',
5070              '*child': 'str',
5071              '*node': 'str' } }
5074 # @x-blockdev-set-iothread:
5076 # Move @node and its children into the @iothread.  If @iothread is null then
5077 # move @node and its children into the main loop.
5079 # The node must not be attached to a BlockBackend.
5081 # @node-name: the name of the block driver node
5083 # @iothread: the name of the IOThread object or null for the main loop
5085 # @force: true if the node and its children should be moved when a BlockBackend
5086 #         is already attached
5088 # Note: this command is experimental and intended for test cases that need
5089 # control over IOThreads only.
5091 # Since: 2.12
5093 # Example:
5095 # 1. Move a node into an IOThread
5096 # -> { "execute": "x-blockdev-set-iothread",
5097 #      "arguments": { "node-name": "disk1",
5098 #                     "iothread": "iothread0" } }
5099 # <- { "return": {} }
5101 # 2. Move a node into the main loop
5102 # -> { "execute": "x-blockdev-set-iothread",
5103 #      "arguments": { "node-name": "disk1",
5104 #                     "iothread": null } }
5105 # <- { "return": {} }
5108 { 'command': 'x-blockdev-set-iothread',
5109   'data' : { 'node-name': 'str',
5110              'iothread': 'StrOrNull',
5111              '*force': 'bool' } }