hw/arm/allwinner-h3: add EMAC ethernet device
[qemu/ar7.git] / qapi / block-core.json
blob9758fc48d230049b4cfc8d94f2d5d718570a3c38
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 # @data-file: the filename of the external data file that is stored in the
63 #             image and used as a default for opening the image (since: 4.0)
65 # @data-file-raw: True if the external data file must stay valid as a
66 #                 standalone (read-only) raw image without looking at qcow2
67 #                 metadata (since: 4.0)
69 # @lazy-refcounts: on or off; only valid for compat >= 1.1
71 # @corrupt: true if the image has been marked corrupt; only valid for
72 #           compat >= 1.1 (since 2.2)
74 # @refcount-bits: width of a refcount entry in bits (since 2.3)
76 # @encrypt: details about encryption parameters; only set if image
77 #           is encrypted (since 2.10)
79 # @bitmaps: A list of qcow2 bitmap details (since 4.0)
81 # Since: 1.7
83 { 'struct': 'ImageInfoSpecificQCow2',
84   'data': {
85       'compat': 'str',
86       '*data-file': 'str',
87       '*data-file-raw': 'bool',
88       '*lazy-refcounts': 'bool',
89       '*corrupt': 'bool',
90       'refcount-bits': 'int',
91       '*encrypt': 'ImageInfoSpecificQCow2Encryption',
92       '*bitmaps': ['Qcow2BitmapInfo']
93   } }
96 # @ImageInfoSpecificVmdk:
98 # @create-type: The create type of VMDK image
100 # @cid: Content id of image
102 # @parent-cid: Parent VMDK image's cid
104 # @extents: List of extent files
106 # Since: 1.7
108 { 'struct': 'ImageInfoSpecificVmdk',
109   'data': {
110       'create-type': 'str',
111       'cid': 'int',
112       'parent-cid': 'int',
113       'extents': ['ImageInfo']
114   } }
117 # @ImageInfoSpecific:
119 # A discriminated record of image format specific information structures.
121 # Since: 1.7
123 { 'union': 'ImageInfoSpecific',
124   'data': {
125       'qcow2': 'ImageInfoSpecificQCow2',
126       'vmdk': 'ImageInfoSpecificVmdk',
127       # If we need to add block driver specific parameters for
128       # LUKS in future, then we'll subclass QCryptoBlockInfoLUKS
129       # to define a ImageInfoSpecificLUKS
130       'luks': 'QCryptoBlockInfoLUKS'
131   } }
134 # @ImageInfo:
136 # Information about a QEMU image file
138 # @filename: name of the image file
140 # @format: format of the image file
142 # @virtual-size: maximum capacity in bytes of the image
144 # @actual-size: actual size on disk in bytes of the image
146 # @dirty-flag: true if image is not cleanly closed
148 # @cluster-size: size of a cluster in bytes
150 # @encrypted: true if the image is encrypted
152 # @compressed: true if the image is compressed (Since 1.7)
154 # @backing-filename: name of the backing file
156 # @full-backing-filename: full path of the backing file
158 # @backing-filename-format: the format of the backing file
160 # @snapshots: list of VM snapshots
162 # @backing-image: info of the backing image (since 1.6)
164 # @format-specific: structure supplying additional format-specific
165 #                   information (since 1.7)
167 # Since: 1.3
170 { 'struct': 'ImageInfo',
171   'data': {'filename': 'str', 'format': 'str', '*dirty-flag': 'bool',
172            '*actual-size': 'int', 'virtual-size': 'int',
173            '*cluster-size': 'int', '*encrypted': 'bool', '*compressed': 'bool',
174            '*backing-filename': 'str', '*full-backing-filename': 'str',
175            '*backing-filename-format': 'str', '*snapshots': ['SnapshotInfo'],
176            '*backing-image': 'ImageInfo',
177            '*format-specific': 'ImageInfoSpecific' } }
180 # @ImageCheck:
182 # Information about a QEMU image file check
184 # @filename: name of the image file checked
186 # @format: format of the image file checked
188 # @check-errors: number of unexpected errors occurred during check
190 # @image-end-offset: offset (in bytes) where the image ends, this
191 #                    field is present if the driver for the image format
192 #                    supports it
194 # @corruptions: number of corruptions found during the check if any
196 # @leaks: number of leaks found during the check if any
198 # @corruptions-fixed: number of corruptions fixed during the check
199 #                     if any
201 # @leaks-fixed: number of leaks fixed during the check if any
203 # @total-clusters: total number of clusters, this field is present
204 #                  if the driver for the image format supports it
206 # @allocated-clusters: total number of allocated clusters, this
207 #                      field is present if the driver for the image format
208 #                      supports it
210 # @fragmented-clusters: total number of fragmented clusters, this
211 #                       field is present if the driver for the image format
212 #                       supports it
214 # @compressed-clusters: total number of compressed clusters, this
215 #                       field is present if the driver for the image format
216 #                       supports it
218 # Since: 1.4
221 { 'struct': 'ImageCheck',
222   'data': {'filename': 'str', 'format': 'str', 'check-errors': 'int',
223            '*image-end-offset': 'int', '*corruptions': 'int', '*leaks': 'int',
224            '*corruptions-fixed': 'int', '*leaks-fixed': 'int',
225            '*total-clusters': 'int', '*allocated-clusters': 'int',
226            '*fragmented-clusters': 'int', '*compressed-clusters': 'int' } }
229 # @MapEntry:
231 # Mapping information from a virtual block range to a host file range
233 # @start: the start byte of the mapped virtual range
235 # @length: the number of bytes of the mapped virtual range
237 # @data: whether the mapped range has data
239 # @zero: whether the virtual blocks are zeroed
241 # @depth: the depth of the mapping
243 # @offset: the offset in file that the virtual sectors are mapped to
245 # @filename: filename that is referred to by @offset
247 # Since: 2.6
250 { 'struct': 'MapEntry',
251   'data': {'start': 'int', 'length': 'int', 'data': 'bool',
252            'zero': 'bool', 'depth': 'int', '*offset': 'int',
253            '*filename': 'str' } }
256 # @BlockdevCacheInfo:
258 # Cache mode information for a block device
260 # @writeback:   true if writeback mode is enabled
261 # @direct:      true if the host page cache is bypassed (O_DIRECT)
262 # @no-flush:    true if flush requests are ignored for the device
264 # Since: 2.3
266 { 'struct': 'BlockdevCacheInfo',
267   'data': { 'writeback': 'bool',
268             'direct': 'bool',
269             'no-flush': 'bool' } }
272 # @BlockDeviceInfo:
274 # Information about the backing device for a block device.
276 # @file: the filename of the backing device
278 # @node-name: the name of the block driver node (Since 2.0)
280 # @ro: true if the backing device was open read-only
282 # @drv: the name of the block format used to open the backing device. As of
283 #       0.14.0 this can be: 'blkdebug', 'bochs', 'cloop', 'cow', 'dmg',
284 #       'file', 'file', 'ftp', 'ftps', 'host_cdrom', 'host_device',
285 #       'http', 'https', 'luks', 'nbd', 'parallels', 'qcow',
286 #       'qcow2', 'raw', 'vdi', 'vmdk', 'vpc', 'vvfat'
287 #       2.2: 'archipelago' added, 'cow' dropped
288 #       2.3: 'host_floppy' deprecated
289 #       2.5: 'host_floppy' dropped
290 #       2.6: 'luks' added
291 #       2.8: 'replication' added, 'tftp' dropped
292 #       2.9: 'archipelago' dropped
294 # @backing_file: the name of the backing file (for copy-on-write)
296 # @backing_file_depth: number of files in the backing file chain (since: 1.2)
298 # @encrypted: true if the backing device is encrypted
300 # @encryption_key_missing: Deprecated; always false
302 # @detect_zeroes: detect and optimize zero writes (Since 2.1)
304 # @bps: total throughput limit in bytes per second is specified
306 # @bps_rd: read throughput limit in bytes per second is specified
308 # @bps_wr: write throughput limit in bytes per second is specified
310 # @iops: total I/O operations per second is specified
312 # @iops_rd: read I/O operations per second is specified
314 # @iops_wr: write I/O operations per second is specified
316 # @image: the info of image used (since: 1.6)
318 # @bps_max: total throughput limit during bursts,
319 #                     in bytes (Since 1.7)
321 # @bps_rd_max: read throughput limit during bursts,
322 #                        in bytes (Since 1.7)
324 # @bps_wr_max: write throughput limit during bursts,
325 #                        in bytes (Since 1.7)
327 # @iops_max: total I/O operations per second during bursts,
328 #                      in bytes (Since 1.7)
330 # @iops_rd_max: read I/O operations per second during bursts,
331 #                         in bytes (Since 1.7)
333 # @iops_wr_max: write I/O operations per second during bursts,
334 #                         in bytes (Since 1.7)
336 # @bps_max_length: maximum length of the @bps_max burst
337 #                            period, in seconds. (Since 2.6)
339 # @bps_rd_max_length: maximum length of the @bps_rd_max
340 #                               burst period, in seconds. (Since 2.6)
342 # @bps_wr_max_length: maximum length of the @bps_wr_max
343 #                               burst period, in seconds. (Since 2.6)
345 # @iops_max_length: maximum length of the @iops burst
346 #                             period, in seconds. (Since 2.6)
348 # @iops_rd_max_length: maximum length of the @iops_rd_max
349 #                                burst period, in seconds. (Since 2.6)
351 # @iops_wr_max_length: maximum length of the @iops_wr_max
352 #                                burst period, in seconds. (Since 2.6)
354 # @iops_size: an I/O size in bytes (Since 1.7)
356 # @group: throttle group name (Since 2.4)
358 # @cache: the cache mode used for the block device (since: 2.3)
360 # @write_threshold: configured write threshold for the device.
361 #                   0 if disabled. (Since 2.3)
363 # @dirty-bitmaps: dirty bitmaps information (only present if node
364 #                 has one or more dirty bitmaps) (Since 4.2)
366 # Since: 0.14.0
369 { 'struct': 'BlockDeviceInfo',
370   'data': { 'file': 'str', '*node-name': 'str', 'ro': 'bool', 'drv': 'str',
371             '*backing_file': 'str', 'backing_file_depth': 'int',
372             'encrypted': 'bool', 'encryption_key_missing': 'bool',
373             'detect_zeroes': 'BlockdevDetectZeroesOptions',
374             'bps': 'int', 'bps_rd': 'int', 'bps_wr': 'int',
375             'iops': 'int', 'iops_rd': 'int', 'iops_wr': 'int',
376             'image': 'ImageInfo',
377             '*bps_max': 'int', '*bps_rd_max': 'int',
378             '*bps_wr_max': 'int', '*iops_max': 'int',
379             '*iops_rd_max': 'int', '*iops_wr_max': 'int',
380             '*bps_max_length': 'int', '*bps_rd_max_length': 'int',
381             '*bps_wr_max_length': 'int', '*iops_max_length': 'int',
382             '*iops_rd_max_length': 'int', '*iops_wr_max_length': 'int',
383             '*iops_size': 'int', '*group': 'str', 'cache': 'BlockdevCacheInfo',
384             'write_threshold': 'int', '*dirty-bitmaps': ['BlockDirtyInfo'] } }
387 # @BlockDeviceIoStatus:
389 # An enumeration of block device I/O status.
391 # @ok: The last I/O operation has succeeded
393 # @failed: The last I/O operation has failed
395 # @nospace: The last I/O operation has failed due to a no-space condition
397 # Since: 1.0
399 { 'enum': 'BlockDeviceIoStatus', 'data': [ 'ok', 'failed', 'nospace' ] }
402 # @BlockDeviceMapEntry:
404 # Entry in the metadata map of the device (returned by "qemu-img map")
406 # @start: Offset in the image of the first byte described by this entry
407 #         (in bytes)
409 # @length: Length of the range described by this entry (in bytes)
411 # @depth: Number of layers (0 = top image, 1 = top image's backing file, etc.)
412 #         before reaching one for which the range is allocated.  The value is
413 #         in the range 0 to the depth of the image chain - 1.
415 # @zero: the sectors in this range read as zeros
417 # @data: reading the image will actually read data from a file (in particular,
418 #        if @offset is present this means that the sectors are not simply
419 #        preallocated, but contain actual data in raw format)
421 # @offset: if present, the image file stores the data for this range in
422 #          raw format at the given offset.
424 # Since: 1.7
426 { 'struct': 'BlockDeviceMapEntry',
427   'data': { 'start': 'int', 'length': 'int', 'depth': 'int', 'zero': 'bool',
428             'data': 'bool', '*offset': 'int' } }
431 # @DirtyBitmapStatus:
433 # An enumeration of possible states that a dirty bitmap can report to the user.
435 # @frozen: The bitmap is currently in-use by some operation and is immutable.
436 #          If the bitmap was @active prior to the operation, new writes by the
437 #          guest are being recorded in a temporary buffer, and will not be lost.
438 #          Generally, bitmaps are cleared on successful use in an operation and
439 #          the temporary buffer is committed into the bitmap. On failure, the
440 #          temporary buffer is merged back into the bitmap without first
441 #          clearing it.
442 #          Please refer to the documentation for each bitmap-using operation,
443 #          See also @blockdev-backup, @drive-backup.
445 # @disabled: The bitmap is not currently recording new writes by the guest.
446 #            This is requested explicitly via @block-dirty-bitmap-disable.
447 #            It can still be cleared, deleted, or used for backup operations.
449 # @active: The bitmap is actively monitoring for new writes, and can be cleared,
450 #          deleted, or used for backup operations.
452 # @locked: The bitmap is currently in-use by some operation and is immutable.
453 #          If the bitmap was @active prior to the operation, it is still
454 #          recording new writes. If the bitmap was @disabled, it is not
455 #          recording new writes. (Since 2.12)
457 # @inconsistent: This is a persistent dirty bitmap that was marked in-use on
458 #                disk, and is unusable by QEMU. It can only be deleted.
459 #                Please rely on the inconsistent field in @BlockDirtyInfo
460 #                instead, as the status field is deprecated. (Since 4.0)
462 # Since: 2.4
464 { 'enum': 'DirtyBitmapStatus',
465   'data': ['active', 'disabled', 'frozen', 'locked', 'inconsistent'] }
468 # @BlockDirtyInfo:
470 # Block dirty bitmap information.
472 # @name: the name of the dirty bitmap (Since 2.4)
474 # @count: number of dirty bytes according to the dirty bitmap
476 # @granularity: granularity of the dirty bitmap in bytes (since 1.4)
478 # @status: Deprecated in favor of @recording and @locked. (since 2.4)
480 # @recording: true if the bitmap is recording new writes from the guest.
481 #             Replaces `active` and `disabled` statuses. (since 4.0)
483 # @busy: true if the bitmap is in-use by some operation (NBD or jobs)
484 #        and cannot be modified via QMP or used by another operation.
485 #        Replaces `locked` and `frozen` statuses. (since 4.0)
487 # @persistent: true if the bitmap was stored on disk, is scheduled to be stored
488 #              on disk, or both. (since 4.0)
490 # @inconsistent: true if this is a persistent bitmap that was improperly
491 #                stored. Implies @persistent to be true; @recording and
492 #                @busy to be false. This bitmap cannot be used. To remove
493 #                it, use @block-dirty-bitmap-remove. (Since 4.0)
495 # Since: 1.3
497 { 'struct': 'BlockDirtyInfo',
498   'data': {'*name': 'str', 'count': 'int', 'granularity': 'uint32',
499            'recording': 'bool', 'busy': 'bool', 'status': 'DirtyBitmapStatus',
500            'persistent': 'bool', '*inconsistent': 'bool' } }
503 # @Qcow2BitmapInfoFlags:
505 # An enumeration of flags that a bitmap can report to the user.
507 # @in-use: This flag is set by any process actively modifying the qcow2 file,
508 #          and cleared when the updated bitmap is flushed to the qcow2 image.
509 #          The presence of this flag in an offline image means that the bitmap
510 #          was not saved correctly after its last usage, and may contain
511 #          inconsistent data.
513 # @auto: The bitmap must reflect all changes of the virtual disk by any
514 #        application that would write to this qcow2 file.
516 # Since: 4.0
518 { 'enum': 'Qcow2BitmapInfoFlags',
519   'data': ['in-use', 'auto'] }
522 # @Qcow2BitmapInfo:
524 # Qcow2 bitmap information.
526 # @name: the name of the bitmap
528 # @granularity: granularity of the bitmap in bytes
530 # @flags: flags of the bitmap
532 # Since: 4.0
534 { 'struct': 'Qcow2BitmapInfo',
535   'data': {'name': 'str', 'granularity': 'uint32',
536            'flags': ['Qcow2BitmapInfoFlags'] } }
539 # @BlockLatencyHistogramInfo:
541 # Block latency histogram.
543 # @boundaries: list of interval boundary values in nanoseconds, all greater
544 #              than zero and in ascending order.
545 #              For example, the list [10, 50, 100] produces the following
546 #              histogram intervals: [0, 10), [10, 50), [50, 100), [100, +inf).
548 # @bins: list of io request counts corresponding to histogram intervals.
549 #        len(@bins) = len(@boundaries) + 1
550 #        For the example above, @bins may be something like [3, 1, 5, 2],
551 #        and corresponding histogram looks like:
553 # |      5|           *
554 # |      4|           *
555 # |      3| *         *
556 # |      2| *         *    *
557 # |      1| *    *    *    *
558 # |       +------------------
559 # |           10   50   100
561 # Since: 4.0
563 { 'struct': 'BlockLatencyHistogramInfo',
564   'data': {'boundaries': ['uint64'], 'bins': ['uint64'] } }
567 # @BlockInfo:
569 # Block device information.  This structure describes a virtual device and
570 # the backing device associated with it.
572 # @device: The device name associated with the virtual device.
574 # @qdev: The qdev ID, or if no ID is assigned, the QOM path of the block
575 #        device. (since 2.10)
577 # @type: This field is returned only for compatibility reasons, it should
578 #        not be used (always returns 'unknown')
580 # @removable: True if the device supports removable media.
582 # @locked: True if the guest has locked this device from having its media
583 #          removed
585 # @tray_open: True if the device's tray is open
586 #             (only present if it has a tray)
588 # @dirty-bitmaps: dirty bitmaps information (only present if the
589 #                 driver has one or more dirty bitmaps) (Since 2.0)
590 #                 Deprecated in 4.2; see BlockDeviceInfo instead.
592 # @io-status: @BlockDeviceIoStatus. Only present if the device
593 #             supports it and the VM is configured to stop on errors
594 #             (supported device models: virtio-blk, IDE, SCSI except
595 #             scsi-generic)
597 # @inserted: @BlockDeviceInfo describing the device if media is
598 #            present
600 # Since:  0.14.0
602 { 'struct': 'BlockInfo',
603   'data': {'device': 'str', '*qdev': 'str', 'type': 'str', 'removable': 'bool',
604            'locked': 'bool', '*inserted': 'BlockDeviceInfo',
605            '*tray_open': 'bool', '*io-status': 'BlockDeviceIoStatus',
606            '*dirty-bitmaps': ['BlockDirtyInfo'] } }
609 # @BlockMeasureInfo:
611 # Image file size calculation information.  This structure describes the size
612 # requirements for creating a new image file.
614 # The size requirements depend on the new image file format.  File size always
615 # equals virtual disk size for the 'raw' format, even for sparse POSIX files.
616 # Compact formats such as 'qcow2' represent unallocated and zero regions
617 # efficiently so file size may be smaller than virtual disk size.
619 # The values are upper bounds that are guaranteed to fit the new image file.
620 # Subsequent modification, such as internal snapshot or bitmap creation, may
621 # require additional space and is not covered here.
623 # @required: Size required for a new image file, in bytes.
625 # @fully-allocated: Image file size, in bytes, once data has been written
626 #                   to all sectors.
628 # Since: 2.10
630 { 'struct': 'BlockMeasureInfo',
631   'data': {'required': 'int', 'fully-allocated': 'int'} }
634 # @query-block:
636 # Get a list of BlockInfo for all virtual block devices.
638 # Returns: a list of @BlockInfo describing each virtual block device. Filter
639 #          nodes that were created implicitly are skipped over.
641 # Since: 0.14.0
643 # Example:
645 # -> { "execute": "query-block" }
646 # <- {
647 #       "return":[
648 #          {
649 #             "io-status": "ok",
650 #             "device":"ide0-hd0",
651 #             "locked":false,
652 #             "removable":false,
653 #             "inserted":{
654 #                "ro":false,
655 #                "drv":"qcow2",
656 #                "encrypted":false,
657 #                "file":"disks/test.qcow2",
658 #                "backing_file_depth":1,
659 #                "bps":1000000,
660 #                "bps_rd":0,
661 #                "bps_wr":0,
662 #                "iops":1000000,
663 #                "iops_rd":0,
664 #                "iops_wr":0,
665 #                "bps_max": 8000000,
666 #                "bps_rd_max": 0,
667 #                "bps_wr_max": 0,
668 #                "iops_max": 0,
669 #                "iops_rd_max": 0,
670 #                "iops_wr_max": 0,
671 #                "iops_size": 0,
672 #                "detect_zeroes": "on",
673 #                "write_threshold": 0,
674 #                "image":{
675 #                   "filename":"disks/test.qcow2",
676 #                   "format":"qcow2",
677 #                   "virtual-size":2048000,
678 #                   "backing_file":"base.qcow2",
679 #                   "full-backing-filename":"disks/base.qcow2",
680 #                   "backing-filename-format":"qcow2",
681 #                   "snapshots":[
682 #                      {
683 #                         "id": "1",
684 #                         "name": "snapshot1",
685 #                         "vm-state-size": 0,
686 #                         "date-sec": 10000200,
687 #                         "date-nsec": 12,
688 #                         "vm-clock-sec": 206,
689 #                         "vm-clock-nsec": 30
690 #                      }
691 #                   ],
692 #                   "backing-image":{
693 #                       "filename":"disks/base.qcow2",
694 #                       "format":"qcow2",
695 #                       "virtual-size":2048000
696 #                   }
697 #                }
698 #             },
699 #             "qdev": "ide_disk",
700 #             "type":"unknown"
701 #          },
702 #          {
703 #             "io-status": "ok",
704 #             "device":"ide1-cd0",
705 #             "locked":false,
706 #             "removable":true,
707 #             "qdev": "/machine/unattached/device[23]",
708 #             "tray_open": false,
709 #             "type":"unknown"
710 #          },
711 #          {
712 #             "device":"floppy0",
713 #             "locked":false,
714 #             "removable":true,
715 #             "qdev": "/machine/unattached/device[20]",
716 #             "type":"unknown"
717 #          },
718 #          {
719 #             "device":"sd0",
720 #             "locked":false,
721 #             "removable":true,
722 #             "type":"unknown"
723 #          }
724 #       ]
725 #    }
728 { 'command': 'query-block', 'returns': ['BlockInfo'] }
732 # @BlockDeviceTimedStats:
734 # Statistics of a block device during a given interval of time.
736 # @interval_length: Interval used for calculating the statistics,
737 #                   in seconds.
739 # @min_rd_latency_ns: Minimum latency of read operations in the
740 #                     defined interval, in nanoseconds.
742 # @min_wr_latency_ns: Minimum latency of write operations in the
743 #                     defined interval, in nanoseconds.
745 # @min_flush_latency_ns: Minimum latency of flush operations in the
746 #                        defined interval, in nanoseconds.
748 # @max_rd_latency_ns: Maximum latency of read operations in the
749 #                     defined interval, in nanoseconds.
751 # @max_wr_latency_ns: Maximum latency of write operations in the
752 #                     defined interval, in nanoseconds.
754 # @max_flush_latency_ns: Maximum latency of flush operations in the
755 #                        defined interval, in nanoseconds.
757 # @avg_rd_latency_ns: Average latency of read operations in the
758 #                     defined interval, in nanoseconds.
760 # @avg_wr_latency_ns: Average latency of write operations in the
761 #                     defined interval, in nanoseconds.
763 # @avg_flush_latency_ns: Average latency of flush operations in the
764 #                        defined interval, in nanoseconds.
766 # @avg_rd_queue_depth: Average number of pending read operations
767 #                      in the defined interval.
769 # @avg_wr_queue_depth: Average number of pending write operations
770 #                      in the defined interval.
772 # Since: 2.5
774 { 'struct': 'BlockDeviceTimedStats',
775   'data': { 'interval_length': 'int', 'min_rd_latency_ns': 'int',
776             'max_rd_latency_ns': 'int', 'avg_rd_latency_ns': 'int',
777             'min_wr_latency_ns': 'int', 'max_wr_latency_ns': 'int',
778             'avg_wr_latency_ns': 'int', 'min_flush_latency_ns': 'int',
779             'max_flush_latency_ns': 'int', 'avg_flush_latency_ns': 'int',
780             'avg_rd_queue_depth': 'number', 'avg_wr_queue_depth': 'number' } }
783 # @BlockDeviceStats:
785 # Statistics of a virtual block device or a block backing device.
787 # @rd_bytes:      The number of bytes read by the device.
789 # @wr_bytes:      The number of bytes written by the device.
791 # @unmap_bytes: The number of bytes unmapped by the device (Since 4.2)
793 # @rd_operations: The number of read operations performed by the device.
795 # @wr_operations: The number of write operations performed by the device.
797 # @flush_operations: The number of cache flush operations performed by the
798 #                    device (since 0.15.0)
800 # @unmap_operations: The number of unmap operations performed by the device
801 #                    (Since 4.2)
803 # @rd_total_time_ns: Total time spent on reads in nanoseconds (since 0.15.0).
805 # @wr_total_time_ns: Total time spent on writes in nanoseconds (since 0.15.0).
807 # @flush_total_time_ns: Total time spent on cache flushes in nanoseconds
808 #                       (since 0.15.0).
810 # @unmap_total_time_ns: Total time spent on unmap operations in nanoseconds
811 #                       (Since 4.2)
813 # @wr_highest_offset: The offset after the greatest byte written to the
814 #                     device.  The intended use of this information is for
815 #                     growable sparse files (like qcow2) that are used on top
816 #                     of a physical device.
818 # @rd_merged: Number of read requests that have been merged into another
819 #             request (Since 2.3).
821 # @wr_merged: Number of write requests that have been merged into another
822 #             request (Since 2.3).
824 # @unmap_merged: Number of unmap requests that have been merged into another
825 #                request (Since 4.2)
827 # @idle_time_ns: Time since the last I/O operation, in
828 #                nanoseconds. If the field is absent it means that
829 #                there haven't been any operations yet (Since 2.5).
831 # @failed_rd_operations: The number of failed read operations
832 #                        performed by the device (Since 2.5)
834 # @failed_wr_operations: The number of failed write operations
835 #                        performed by the device (Since 2.5)
837 # @failed_flush_operations: The number of failed flush operations
838 #                           performed by the device (Since 2.5)
840 # @failed_unmap_operations: The number of failed unmap operations performed
841 #                           by the device (Since 4.2)
843 # @invalid_rd_operations: The number of invalid read operations
844 #                          performed by the device (Since 2.5)
846 # @invalid_wr_operations: The number of invalid write operations
847 #                         performed by the device (Since 2.5)
849 # @invalid_flush_operations: The number of invalid flush operations
850 #                            performed by the device (Since 2.5)
852 # @invalid_unmap_operations: The number of invalid unmap operations performed
853 #                            by the device (Since 4.2)
855 # @account_invalid: Whether invalid operations are included in the
856 #                   last access statistics (Since 2.5)
858 # @account_failed: Whether failed operations are included in the
859 #                  latency and last access statistics (Since 2.5)
861 # @timed_stats: Statistics specific to the set of previously defined
862 #               intervals of time (Since 2.5)
864 # @rd_latency_histogram: @BlockLatencyHistogramInfo. (Since 4.0)
866 # @wr_latency_histogram: @BlockLatencyHistogramInfo. (Since 4.0)
868 # @flush_latency_histogram: @BlockLatencyHistogramInfo. (Since 4.0)
870 # Since: 0.14.0
872 { 'struct': 'BlockDeviceStats',
873   'data': {'rd_bytes': 'int', 'wr_bytes': 'int', 'unmap_bytes' : 'int',
874            'rd_operations': 'int', 'wr_operations': 'int',
875            'flush_operations': 'int', 'unmap_operations': 'int',
876            'rd_total_time_ns': 'int', 'wr_total_time_ns': 'int',
877            'flush_total_time_ns': 'int', 'unmap_total_time_ns': 'int',
878            'wr_highest_offset': 'int',
879            'rd_merged': 'int', 'wr_merged': 'int', 'unmap_merged': 'int',
880            '*idle_time_ns': 'int',
881            'failed_rd_operations': 'int', 'failed_wr_operations': 'int',
882            'failed_flush_operations': 'int', 'failed_unmap_operations': 'int',
883            'invalid_rd_operations': 'int', 'invalid_wr_operations': 'int',
884            'invalid_flush_operations': 'int', 'invalid_unmap_operations': 'int',
885            'account_invalid': 'bool', 'account_failed': 'bool',
886            'timed_stats': ['BlockDeviceTimedStats'],
887            '*rd_latency_histogram': 'BlockLatencyHistogramInfo',
888            '*wr_latency_histogram': 'BlockLatencyHistogramInfo',
889            '*flush_latency_histogram': 'BlockLatencyHistogramInfo' } }
892 # @BlockStatsSpecificFile:
894 # File driver statistics
896 # @discard-nb-ok: The number of successful discard operations performed by
897 #                 the driver.
899 # @discard-nb-failed: The number of failed discard operations performed by
900 #                     the driver.
902 # @discard-bytes-ok: The number of bytes discarded by the driver.
904 # Since: 4.2
906 { 'struct': 'BlockStatsSpecificFile',
907   'data': {
908       'discard-nb-ok': 'uint64',
909       'discard-nb-failed': 'uint64',
910       'discard-bytes-ok': 'uint64' } }
913 # @BlockStatsSpecific:
915 # Block driver specific statistics
917 # Since: 4.2
919 { 'union': 'BlockStatsSpecific',
920   'base': { 'driver': 'BlockdevDriver' },
921   'discriminator': 'driver',
922   'data': {
923       'file': 'BlockStatsSpecificFile',
924       'host_device': 'BlockStatsSpecificFile' } }
927 # @BlockStats:
929 # Statistics of a virtual block device or a block backing device.
931 # @device: If the stats are for a virtual block device, the name
932 #          corresponding to the virtual block device.
934 # @node-name: The node name of the device. (Since 2.3)
936 # @qdev: The qdev ID, or if no ID is assigned, the QOM path of the block
937 #        device. (since 3.0)
939 # @stats:  A @BlockDeviceStats for the device.
941 # @driver-specific: Optional driver-specific stats. (Since 4.2)
943 # @parent: This describes the file block device if it has one.
944 #          Contains recursively the statistics of the underlying
945 #          protocol (e.g. the host file for a qcow2 image). If there is
946 #          no underlying protocol, this field is omitted
948 # @backing: This describes the backing block device if it has one.
949 #           (Since 2.0)
951 # Since: 0.14.0
953 { 'struct': 'BlockStats',
954   'data': {'*device': 'str', '*qdev': 'str', '*node-name': 'str',
955            'stats': 'BlockDeviceStats',
956            '*driver-specific': 'BlockStatsSpecific',
957            '*parent': 'BlockStats',
958            '*backing': 'BlockStats'} }
961 # @query-blockstats:
963 # Query the @BlockStats for all virtual block devices.
965 # @query-nodes: If true, the command will query all the block nodes
966 #               that have a node name, in a list which will include "parent"
967 #               information, but not "backing".
968 #               If false or omitted, the behavior is as before - query all the
969 #               device backends, recursively including their "parent" and
970 #               "backing". Filter nodes that were created implicitly are
971 #               skipped over in this mode. (Since 2.3)
973 # Returns: A list of @BlockStats for each virtual block devices.
975 # Since: 0.14.0
977 # Example:
979 # -> { "execute": "query-blockstats" }
980 # <- {
981 #       "return":[
982 #          {
983 #             "device":"ide0-hd0",
984 #             "parent":{
985 #                "stats":{
986 #                   "wr_highest_offset":3686448128,
987 #                   "wr_bytes":9786368,
988 #                   "wr_operations":751,
989 #                   "rd_bytes":122567168,
990 #                   "rd_operations":36772
991 #                   "wr_total_times_ns":313253456
992 #                   "rd_total_times_ns":3465673657
993 #                   "flush_total_times_ns":49653
994 #                   "flush_operations":61,
995 #                   "rd_merged":0,
996 #                   "wr_merged":0,
997 #                   "idle_time_ns":2953431879,
998 #                   "account_invalid":true,
999 #                   "account_failed":false
1000 #                }
1001 #             },
1002 #             "stats":{
1003 #                "wr_highest_offset":2821110784,
1004 #                "wr_bytes":9786368,
1005 #                "wr_operations":692,
1006 #                "rd_bytes":122739200,
1007 #                "rd_operations":36604
1008 #                "flush_operations":51,
1009 #                "wr_total_times_ns":313253456
1010 #                "rd_total_times_ns":3465673657
1011 #                "flush_total_times_ns":49653,
1012 #                "rd_merged":0,
1013 #                "wr_merged":0,
1014 #                "idle_time_ns":2953431879,
1015 #                "account_invalid":true,
1016 #                "account_failed":false
1017 #             },
1018 #             "qdev": "/machine/unattached/device[23]"
1019 #          },
1020 #          {
1021 #             "device":"ide1-cd0",
1022 #             "stats":{
1023 #                "wr_highest_offset":0,
1024 #                "wr_bytes":0,
1025 #                "wr_operations":0,
1026 #                "rd_bytes":0,
1027 #                "rd_operations":0
1028 #                "flush_operations":0,
1029 #                "wr_total_times_ns":0
1030 #                "rd_total_times_ns":0
1031 #                "flush_total_times_ns":0,
1032 #                "rd_merged":0,
1033 #                "wr_merged":0,
1034 #                "account_invalid":false,
1035 #                "account_failed":false
1036 #             },
1037 #             "qdev": "/machine/unattached/device[24]"
1038 #          },
1039 #          {
1040 #             "device":"floppy0",
1041 #             "stats":{
1042 #                "wr_highest_offset":0,
1043 #                "wr_bytes":0,
1044 #                "wr_operations":0,
1045 #                "rd_bytes":0,
1046 #                "rd_operations":0
1047 #                "flush_operations":0,
1048 #                "wr_total_times_ns":0
1049 #                "rd_total_times_ns":0
1050 #                "flush_total_times_ns":0,
1051 #                "rd_merged":0,
1052 #                "wr_merged":0,
1053 #                "account_invalid":false,
1054 #                "account_failed":false
1055 #             },
1056 #             "qdev": "/machine/unattached/device[16]"
1057 #          },
1058 #          {
1059 #             "device":"sd0",
1060 #             "stats":{
1061 #                "wr_highest_offset":0,
1062 #                "wr_bytes":0,
1063 #                "wr_operations":0,
1064 #                "rd_bytes":0,
1065 #                "rd_operations":0
1066 #                "flush_operations":0,
1067 #                "wr_total_times_ns":0
1068 #                "rd_total_times_ns":0
1069 #                "flush_total_times_ns":0,
1070 #                "rd_merged":0,
1071 #                "wr_merged":0,
1072 #                "account_invalid":false,
1073 #                "account_failed":false
1074 #             }
1075 #          }
1076 #       ]
1077 #    }
1080 { 'command': 'query-blockstats',
1081   'data': { '*query-nodes': 'bool' },
1082   'returns': ['BlockStats'] }
1085 # @BlockdevOnError:
1087 # An enumeration of possible behaviors for errors on I/O operations.
1088 # The exact meaning depends on whether the I/O was initiated by a guest
1089 # or by a block job
1091 # @report: for guest operations, report the error to the guest;
1092 #          for jobs, cancel the job
1094 # @ignore: ignore the error, only report a QMP event (BLOCK_IO_ERROR
1095 #          or BLOCK_JOB_ERROR). The backup, mirror and commit block jobs retry
1096 #          the failing request later and may still complete successfully. The
1097 #          stream block job continues to stream and will complete with an
1098 #          error.
1100 # @enospc: same as @stop on ENOSPC, same as @report otherwise.
1102 # @stop: for guest operations, stop the virtual machine;
1103 #        for jobs, pause the job
1105 # @auto: inherit the error handling policy of the backend (since: 2.7)
1107 # Since: 1.3
1109 { 'enum': 'BlockdevOnError',
1110   'data': ['report', 'ignore', 'enospc', 'stop', 'auto'] }
1113 # @MirrorSyncMode:
1115 # An enumeration of possible behaviors for the initial synchronization
1116 # phase of storage mirroring.
1118 # @top: copies data in the topmost image to the destination
1120 # @full: copies data from all images to the destination
1122 # @none: only copy data written from now on
1124 # @incremental: only copy data described by the dirty bitmap. (since: 2.4)
1126 # @bitmap: only copy data described by the dirty bitmap. (since: 4.2)
1127 #          Behavior on completion is determined by the BitmapSyncMode.
1129 # Since: 1.3
1131 { 'enum': 'MirrorSyncMode',
1132   'data': ['top', 'full', 'none', 'incremental', 'bitmap'] }
1135 # @BitmapSyncMode:
1137 # An enumeration of possible behaviors for the synchronization of a bitmap
1138 # when used for data copy operations.
1140 # @on-success: The bitmap is only synced when the operation is successful.
1141 #              This is the behavior always used for 'INCREMENTAL' backups.
1143 # @never: The bitmap is never synchronized with the operation, and is
1144 #         treated solely as a read-only manifest of blocks to copy.
1146 # @always: The bitmap is always synchronized with the operation,
1147 #          regardless of whether or not the operation was successful.
1149 # Since: 4.2
1151 { 'enum': 'BitmapSyncMode',
1152   'data': ['on-success', 'never', 'always'] }
1155 # @MirrorCopyMode:
1157 # An enumeration whose values tell the mirror block job when to
1158 # trigger writes to the target.
1160 # @background: copy data in background only.
1162 # @write-blocking: when data is written to the source, write it
1163 #                  (synchronously) to the target as well.  In
1164 #                  addition, data is copied in background just like in
1165 #                  @background mode.
1167 # Since: 3.0
1169 { 'enum': 'MirrorCopyMode',
1170   'data': ['background', 'write-blocking'] }
1173 # @BlockJobInfo:
1175 # Information about a long-running block device operation.
1177 # @type: the job type ('stream' for image streaming)
1179 # @device: The job identifier. Originally the device name but other
1180 #          values are allowed since QEMU 2.7
1182 # @len: Estimated @offset value at the completion of the job. This value can
1183 #       arbitrarily change while the job is running, in both directions.
1185 # @offset: Progress made until now. The unit is arbitrary and the value can
1186 #          only meaningfully be used for the ratio of @offset to @len. The
1187 #          value is monotonically increasing.
1189 # @busy: false if the job is known to be in a quiescent state, with
1190 #        no pending I/O.  Since 1.3.
1192 # @paused: whether the job is paused or, if @busy is true, will
1193 #          pause itself as soon as possible.  Since 1.3.
1195 # @speed: the rate limit, bytes per second
1197 # @io-status: the status of the job (since 1.3)
1199 # @ready: true if the job may be completed (since 2.2)
1201 # @status: Current job state/status (since 2.12)
1203 # @auto-finalize: Job will finalize itself when PENDING, moving to
1204 #                 the CONCLUDED state. (since 2.12)
1206 # @auto-dismiss: Job will dismiss itself when CONCLUDED, moving to the NULL
1207 #                state and disappearing from the query list. (since 2.12)
1209 # @error: Error information if the job did not complete successfully.
1210 #         Not set if the job completed successfully. (since 2.12.1)
1212 # Since: 1.1
1214 { 'struct': 'BlockJobInfo',
1215   'data': {'type': 'str', 'device': 'str', 'len': 'int',
1216            'offset': 'int', 'busy': 'bool', 'paused': 'bool', 'speed': 'int',
1217            'io-status': 'BlockDeviceIoStatus', 'ready': 'bool',
1218            'status': 'JobStatus',
1219            'auto-finalize': 'bool', 'auto-dismiss': 'bool',
1220            '*error': 'str' } }
1223 # @query-block-jobs:
1225 # Return information about long-running block device operations.
1227 # Returns: a list of @BlockJobInfo for each active block job
1229 # Since: 1.1
1231 { 'command': 'query-block-jobs', 'returns': ['BlockJobInfo'] }
1234 # @block_passwd:
1236 # This command sets the password of a block device that has not been open
1237 # with a password and requires one.
1239 # This command is now obsolete and will always return an error since 2.10
1242 { 'command': 'block_passwd',
1243   'data': { '*device': 'str',
1244             '*node-name': 'str',
1245             'password': 'str' } }
1248 # @block_resize:
1250 # Resize a block image while a guest is running.
1252 # Either @device or @node-name must be set but not both.
1254 # @device: the name of the device to get the image resized
1256 # @node-name: graph node name to get the image resized (Since 2.0)
1258 # @size:  new image size in bytes
1260 # Returns: - nothing on success
1261 #          - If @device is not a valid block device, DeviceNotFound
1263 # Since: 0.14.0
1265 # Example:
1267 # -> { "execute": "block_resize",
1268 #      "arguments": { "device": "scratch", "size": 1073741824 } }
1269 # <- { "return": {} }
1272 { 'command': 'block_resize',
1273   'data': { '*device': 'str',
1274             '*node-name': 'str',
1275             'size': 'int' } }
1278 # @NewImageMode:
1280 # An enumeration that tells QEMU how to set the backing file path in
1281 # a new image file.
1283 # @existing: QEMU should look for an existing image file.
1285 # @absolute-paths: QEMU should create a new image with absolute paths
1286 #                  for the backing file. If there is no backing file available, the new
1287 #                  image will not be backed either.
1289 # Since: 1.1
1291 { 'enum': 'NewImageMode',
1292   'data': [ 'existing', 'absolute-paths' ] }
1295 # @BlockdevSnapshotSync:
1297 # Either @device or @node-name must be set but not both.
1299 # @device: the name of the device to take a snapshot of.
1301 # @node-name: graph node name to generate the snapshot from (Since 2.0)
1303 # @snapshot-file: the target of the new overlay image. If the file
1304 #                 exists, or if it is a device, the overlay will be created in the
1305 #                 existing file/device. Otherwise, a new file will be created.
1307 # @snapshot-node-name: the graph node name of the new image (Since 2.0)
1309 # @format: the format of the overlay image, default is 'qcow2'.
1311 # @mode: whether and how QEMU should create a new image, default is
1312 #        'absolute-paths'.
1314 { 'struct': 'BlockdevSnapshotSync',
1315   'data': { '*device': 'str', '*node-name': 'str',
1316             'snapshot-file': 'str', '*snapshot-node-name': 'str',
1317             '*format': 'str', '*mode': 'NewImageMode' } }
1320 # @BlockdevSnapshot:
1322 # @node: device or node name that will have a snapshot taken.
1324 # @overlay: reference to the existing block device that will become
1325 #           the overlay of @node, as part of taking the snapshot.
1326 #           It must not have a current backing file (this can be
1327 #           achieved by passing "backing": null to blockdev-add).
1329 # Since: 2.5
1331 { 'struct': 'BlockdevSnapshot',
1332   'data': { 'node': 'str', 'overlay': 'str' } }
1335 # @BackupCommon:
1337 # @job-id: identifier for the newly-created block job. If
1338 #          omitted, the device name will be used. (Since 2.7)
1340 # @device: the device name or node-name of a root node which should be copied.
1342 # @sync: what parts of the disk image should be copied to the destination
1343 #        (all the disk, only the sectors allocated in the topmost image, from a
1344 #        dirty bitmap, or only new I/O).
1346 # @speed: the maximum speed, in bytes per second. The default is 0,
1347 #         for unlimited.
1349 # @bitmap: The name of a dirty bitmap to use.
1350 #          Must be present if sync is "bitmap" or "incremental".
1351 #          Can be present if sync is "full" or "top".
1352 #          Must not be present otherwise.
1353 #          (Since 2.4 (drive-backup), 3.1 (blockdev-backup))
1355 # @bitmap-mode: Specifies the type of data the bitmap should contain after
1356 #               the operation concludes.
1357 #               Must be present if a bitmap was provided,
1358 #               Must NOT be present otherwise. (Since 4.2)
1360 # @compress: true to compress data, if the target format supports it.
1361 #            (default: false) (since 2.8)
1363 # @on-source-error: the action to take on an error on the source,
1364 #                   default 'report'.  'stop' and 'enospc' can only be used
1365 #                   if the block device supports io-status (see BlockInfo).
1367 # @on-target-error: the action to take on an error on the target,
1368 #                   default 'report' (no limitations, since this applies to
1369 #                   a different block device than @device).
1371 # @auto-finalize: When false, this job will wait in a PENDING state after it has
1372 #                 finished its work, waiting for @block-job-finalize before
1373 #                 making any block graph changes.
1374 #                 When true, this job will automatically
1375 #                 perform its abort or commit actions.
1376 #                 Defaults to true. (Since 2.12)
1378 # @auto-dismiss: When false, this job will wait in a CONCLUDED state after it
1379 #                has completely ceased all work, and awaits @block-job-dismiss.
1380 #                When true, this job will automatically disappear from the query
1381 #                list without user intervention.
1382 #                Defaults to true. (Since 2.12)
1384 # @filter-node-name: the node name that should be assigned to the
1385 #                    filter driver that the backup job inserts into the graph
1386 #                    above node specified by @drive. If this option is not given,
1387 #                    a node name is autogenerated. (Since: 4.2)
1389 # Note: @on-source-error and @on-target-error only affect background
1390 #       I/O.  If an error occurs during a guest write request, the device's
1391 #       rerror/werror actions will be used.
1393 # Since: 4.2
1395 { 'struct': 'BackupCommon',
1396   'data': { '*job-id': 'str', 'device': 'str',
1397             'sync': 'MirrorSyncMode', '*speed': 'int',
1398             '*bitmap': 'str', '*bitmap-mode': 'BitmapSyncMode',
1399             '*compress': 'bool',
1400             '*on-source-error': 'BlockdevOnError',
1401             '*on-target-error': 'BlockdevOnError',
1402             '*auto-finalize': 'bool', '*auto-dismiss': 'bool',
1403             '*filter-node-name': 'str' } }
1406 # @DriveBackup:
1408 # @target: the target of the new image. If the file exists, or if it
1409 #          is a device, the existing file/device will be used as the new
1410 #          destination.  If it does not exist, a new file will be created.
1412 # @format: the format of the new destination, default is to
1413 #          probe if @mode is 'existing', else the format of the source
1415 # @mode: whether and how QEMU should create a new image, default is
1416 #        'absolute-paths'.
1418 # Since: 1.6
1420 { 'struct': 'DriveBackup',
1421   'base': 'BackupCommon',
1422   'data': { 'target': 'str',
1423             '*format': 'str',
1424             '*mode': 'NewImageMode' } }
1427 # @BlockdevBackup:
1429 # @target: the device name or node-name of the backup target node.
1431 # Since: 2.3
1433 { 'struct': 'BlockdevBackup',
1434   'base': 'BackupCommon',
1435   'data': { 'target': 'str' } }
1438 # @blockdev-snapshot-sync:
1440 # Takes a synchronous snapshot of a block device.
1442 # For the arguments, see the documentation of BlockdevSnapshotSync.
1444 # Returns: - nothing on success
1445 #          - If @device is not a valid block device, DeviceNotFound
1447 # Since: 0.14.0
1449 # Example:
1451 # -> { "execute": "blockdev-snapshot-sync",
1452 #      "arguments": { "device": "ide-hd0",
1453 #                     "snapshot-file":
1454 #                     "/some/place/my-image",
1455 #                     "format": "qcow2" } }
1456 # <- { "return": {} }
1459 { 'command': 'blockdev-snapshot-sync',
1460   'data': 'BlockdevSnapshotSync' }
1464 # @blockdev-snapshot:
1466 # Takes a snapshot of a block device.
1468 # Take a snapshot, by installing 'node' as the backing image of
1469 # 'overlay'. Additionally, if 'node' is associated with a block
1470 # device, the block device changes to using 'overlay' as its new active
1471 # image.
1473 # For the arguments, see the documentation of BlockdevSnapshot.
1475 # Since: 2.5
1477 # Example:
1479 # -> { "execute": "blockdev-add",
1480 #      "arguments": { "driver": "qcow2",
1481 #                     "node-name": "node1534",
1482 #                     "file": { "driver": "file",
1483 #                               "filename": "hd1.qcow2" },
1484 #                     "backing": null } }
1486 # <- { "return": {} }
1488 # -> { "execute": "blockdev-snapshot",
1489 #      "arguments": { "node": "ide-hd0",
1490 #                     "overlay": "node1534" } }
1491 # <- { "return": {} }
1494 { 'command': 'blockdev-snapshot',
1495   'data': 'BlockdevSnapshot' }
1498 # @change-backing-file:
1500 # Change the backing file in the image file metadata.  This does not
1501 # cause QEMU to reopen the image file to reparse the backing filename
1502 # (it may, however, perform a reopen to change permissions from
1503 # r/o -> r/w -> r/o, if needed). The new backing file string is written
1504 # into the image file metadata, and the QEMU internal strings are
1505 # updated.
1507 # @image-node-name: The name of the block driver state node of the
1508 #                   image to modify. The "device" argument is used
1509 #                   to verify "image-node-name" is in the chain
1510 #                   described by "device".
1512 # @device: The device name or node-name of the root node that owns
1513 #          image-node-name.
1515 # @backing-file: The string to write as the backing file.  This
1516 #                string is not validated, so care should be taken
1517 #                when specifying the string or the image chain may
1518 #                not be able to be reopened again.
1520 # Returns: - Nothing on success
1521 #          - If "device" does not exist or cannot be determined, DeviceNotFound
1523 # Since: 2.1
1525 { 'command': 'change-backing-file',
1526   'data': { 'device': 'str', 'image-node-name': 'str',
1527             'backing-file': 'str' } }
1530 # @block-commit:
1532 # Live commit of data from overlay image nodes into backing nodes - i.e.,
1533 # writes data between 'top' and 'base' into 'base'.
1535 # @job-id: identifier for the newly-created block job. If
1536 #          omitted, the device name will be used. (Since 2.7)
1538 # @device: the device name or node-name of a root node
1540 # @base-node: The node name of the backing image to write data into.
1541 #             If not specified, this is the deepest backing image.
1542 #             (since: 3.1)
1544 # @base: Same as @base-node, except that it is a file name rather than a node
1545 #        name. This must be the exact filename string that was used to open the
1546 #        node; other strings, even if addressing the same file, are not
1547 #        accepted (deprecated, use @base-node instead)
1549 # @top-node: The node name of the backing image within the image chain
1550 #            which contains the topmost data to be committed down. If
1551 #            not specified, this is the active layer. (since: 3.1)
1553 # @top: Same as @top-node, except that it is a file name rather than a node
1554 #       name. This must be the exact filename string that was used to open the
1555 #       node; other strings, even if addressing the same file, are not
1556 #       accepted (deprecated, use @base-node instead)
1558 # @backing-file: The backing file string to write into the overlay
1559 #                image of 'top'.  If 'top' is the active layer,
1560 #                specifying a backing file string is an error. This
1561 #                filename is not validated.
1563 #                If a pathname string is such that it cannot be
1564 #                resolved by QEMU, that means that subsequent QMP or
1565 #                HMP commands must use node-names for the image in
1566 #                question, as filename lookup methods will fail.
1568 #                If not specified, QEMU will automatically determine
1569 #                the backing file string to use, or error out if
1570 #                there is no obvious choice. Care should be taken
1571 #                when specifying the string, to specify a valid
1572 #                filename or protocol.
1573 #                (Since 2.1)
1575 #                If top == base, that is an error.
1576 #                If top == active, the job will not be completed by itself,
1577 #                user needs to complete the job with the block-job-complete
1578 #                command after getting the ready event. (Since 2.0)
1580 #                If the base image is smaller than top, then the base image
1581 #                will be resized to be the same size as top.  If top is
1582 #                smaller than the base image, the base will not be
1583 #                truncated.  If you want the base image size to match the
1584 #                size of the smaller top, you can safely truncate it
1585 #                yourself once the commit operation successfully completes.
1587 # @speed: the maximum speed, in bytes per second
1589 # @on-error: the action to take on an error. 'ignore' means that the request
1590 #            should be retried. (default: report; Since: 5.0)
1592 # @filter-node-name: the node name that should be assigned to the
1593 #                    filter driver that the commit job inserts into the graph
1594 #                    above @top. If this option is not given, a node name is
1595 #                    autogenerated. (Since: 2.9)
1597 # @auto-finalize: When false, this job will wait in a PENDING state after it has
1598 #                 finished its work, waiting for @block-job-finalize before
1599 #                 making any block graph changes.
1600 #                 When true, this job will automatically
1601 #                 perform its abort or commit actions.
1602 #                 Defaults to true. (Since 3.1)
1604 # @auto-dismiss: When false, this job will wait in a CONCLUDED state after it
1605 #                has completely ceased all work, and awaits @block-job-dismiss.
1606 #                When true, this job will automatically disappear from the query
1607 #                list without user intervention.
1608 #                Defaults to true. (Since 3.1)
1610 # Returns: - Nothing on success
1611 #          - If @device does not exist, DeviceNotFound
1612 #          - Any other error returns a GenericError.
1614 # Since: 1.3
1616 # Example:
1618 # -> { "execute": "block-commit",
1619 #      "arguments": { "device": "virtio0",
1620 #                     "top": "/tmp/snap1.qcow2" } }
1621 # <- { "return": {} }
1624 { 'command': 'block-commit',
1625   'data': { '*job-id': 'str', 'device': 'str', '*base-node': 'str',
1626             '*base': 'str', '*top-node': 'str', '*top': 'str',
1627             '*backing-file': 'str', '*speed': 'int',
1628             '*on-error': 'BlockdevOnError',
1629             '*filter-node-name': 'str',
1630             '*auto-finalize': 'bool', '*auto-dismiss': 'bool' } }
1633 # @drive-backup:
1635 # Start a point-in-time copy of a block device to a new destination.  The
1636 # status of ongoing drive-backup operations can be checked with
1637 # query-block-jobs where the BlockJobInfo.type field has the value 'backup'.
1638 # The operation can be stopped before it has completed using the
1639 # block-job-cancel command.
1641 # Returns: - nothing on success
1642 #          - If @device is not a valid block device, GenericError
1644 # Since: 1.6
1646 # Example:
1648 # -> { "execute": "drive-backup",
1649 #      "arguments": { "device": "drive0",
1650 #                     "sync": "full",
1651 #                     "target": "backup.img" } }
1652 # <- { "return": {} }
1655 { 'command': 'drive-backup', 'boxed': true,
1656   'data': 'DriveBackup' }
1659 # @blockdev-backup:
1661 # Start a point-in-time copy of a block device to a new destination.  The
1662 # status of ongoing blockdev-backup operations can be checked with
1663 # query-block-jobs where the BlockJobInfo.type field has the value 'backup'.
1664 # The operation can be stopped before it has completed using the
1665 # block-job-cancel command.
1667 # Returns: - nothing on success
1668 #          - If @device is not a valid block device, DeviceNotFound
1670 # Since: 2.3
1672 # Example:
1673 # -> { "execute": "blockdev-backup",
1674 #      "arguments": { "device": "src-id",
1675 #                     "sync": "full",
1676 #                     "target": "tgt-id" } }
1677 # <- { "return": {} }
1680 { 'command': 'blockdev-backup', 'boxed': true,
1681   'data': 'BlockdevBackup' }
1685 # @query-named-block-nodes:
1687 # Get the named block driver list
1689 # @flat: Omit the nested data about backing image ("backing-image" key) if true.
1690 #        Default is false (Since 5.0)
1692 # Returns: the list of BlockDeviceInfo
1694 # Since: 2.0
1696 # Example:
1698 # -> { "execute": "query-named-block-nodes" }
1699 # <- { "return": [ { "ro":false,
1700 #                    "drv":"qcow2",
1701 #                    "encrypted":false,
1702 #                    "file":"disks/test.qcow2",
1703 #                    "node-name": "my-node",
1704 #                    "backing_file_depth":1,
1705 #                    "bps":1000000,
1706 #                    "bps_rd":0,
1707 #                    "bps_wr":0,
1708 #                    "iops":1000000,
1709 #                    "iops_rd":0,
1710 #                    "iops_wr":0,
1711 #                    "bps_max": 8000000,
1712 #                    "bps_rd_max": 0,
1713 #                    "bps_wr_max": 0,
1714 #                    "iops_max": 0,
1715 #                    "iops_rd_max": 0,
1716 #                    "iops_wr_max": 0,
1717 #                    "iops_size": 0,
1718 #                    "write_threshold": 0,
1719 #                    "image":{
1720 #                       "filename":"disks/test.qcow2",
1721 #                       "format":"qcow2",
1722 #                       "virtual-size":2048000,
1723 #                       "backing_file":"base.qcow2",
1724 #                       "full-backing-filename":"disks/base.qcow2",
1725 #                       "backing-filename-format":"qcow2",
1726 #                       "snapshots":[
1727 #                          {
1728 #                             "id": "1",
1729 #                             "name": "snapshot1",
1730 #                             "vm-state-size": 0,
1731 #                             "date-sec": 10000200,
1732 #                             "date-nsec": 12,
1733 #                             "vm-clock-sec": 206,
1734 #                             "vm-clock-nsec": 30
1735 #                          }
1736 #                       ],
1737 #                       "backing-image":{
1738 #                           "filename":"disks/base.qcow2",
1739 #                           "format":"qcow2",
1740 #                           "virtual-size":2048000
1741 #                       }
1742 #                    } } ] }
1745 { 'command': 'query-named-block-nodes',
1746   'returns': [ 'BlockDeviceInfo' ],
1747   'data': { '*flat': 'bool' } }
1750 # @XDbgBlockGraphNodeType:
1752 # @block-backend: corresponds to BlockBackend
1754 # @block-job: corresonds to BlockJob
1756 # @block-driver: corresponds to BlockDriverState
1758 # Since: 4.0
1760 { 'enum': 'XDbgBlockGraphNodeType',
1761   'data': [ 'block-backend', 'block-job', 'block-driver' ] }
1764 # @XDbgBlockGraphNode:
1766 # @id: Block graph node identifier. This @id is generated only for
1767 #      x-debug-query-block-graph and does not relate to any other identifiers in
1768 #      Qemu.
1770 # @type: Type of graph node. Can be one of block-backend, block-job or
1771 #        block-driver-state.
1773 # @name: Human readable name of the node. Corresponds to node-name for
1774 #        block-driver-state nodes; is not guaranteed to be unique in the whole
1775 #        graph (with block-jobs and block-backends).
1777 # Since: 4.0
1779 { 'struct': 'XDbgBlockGraphNode',
1780   'data': { 'id': 'uint64', 'type': 'XDbgBlockGraphNodeType', 'name': 'str' } }
1783 # @BlockPermission:
1785 # Enum of base block permissions.
1787 # @consistent-read: A user that has the "permission" of consistent reads is
1788 #                   guaranteed that their view of the contents of the block
1789 #                   device is complete and self-consistent, representing the
1790 #                   contents of a disk at a specific point.
1791 #                   For most block devices (including their backing files) this
1792 #                   is true, but the property cannot be maintained in a few
1793 #                   situations like for intermediate nodes of a commit block
1794 #                   job.
1796 # @write: This permission is required to change the visible disk contents.
1798 # @write-unchanged: This permission (which is weaker than BLK_PERM_WRITE) is
1799 #                   both enough and required for writes to the block node when
1800 #                   the caller promises that the visible disk content doesn't
1801 #                   change.
1802 #                   As the BLK_PERM_WRITE permission is strictly stronger,
1803 #                   either is sufficient to perform an unchanging write.
1805 # @resize: This permission is required to change the size of a block node.
1807 # @graph-mod: This permission is required to change the node that this
1808 #             BdrvChild points to.
1810 # Since: 4.0
1812   { 'enum': 'BlockPermission',
1813     'data': [ 'consistent-read', 'write', 'write-unchanged', 'resize',
1814               'graph-mod' ] }
1816 # @XDbgBlockGraphEdge:
1818 # Block Graph edge description for x-debug-query-block-graph.
1820 # @parent: parent id
1822 # @child: child id
1824 # @name: name of the relation (examples are 'file' and 'backing')
1826 # @perm: granted permissions for the parent operating on the child
1828 # @shared-perm: permissions that can still be granted to other users of the
1829 #               child while it is still attached to this parent
1831 # Since: 4.0
1833 { 'struct': 'XDbgBlockGraphEdge',
1834   'data': { 'parent': 'uint64', 'child': 'uint64',
1835             'name': 'str', 'perm': [ 'BlockPermission' ],
1836             'shared-perm': [ 'BlockPermission' ] } }
1839 # @XDbgBlockGraph:
1841 # Block Graph - list of nodes and list of edges.
1843 # Since: 4.0
1845 { 'struct': 'XDbgBlockGraph',
1846   'data': { 'nodes': ['XDbgBlockGraphNode'], 'edges': ['XDbgBlockGraphEdge'] } }
1849 # @x-debug-query-block-graph:
1851 # Get the block graph.
1853 # Since: 4.0
1855 { 'command': 'x-debug-query-block-graph', 'returns': 'XDbgBlockGraph' }
1858 # @drive-mirror:
1860 # Start mirroring a block device's writes to a new destination. target
1861 # specifies the target of the new image. If the file exists, or if it
1862 # is a device, it will be used as the new destination for writes. If
1863 # it does not exist, a new file will be created. format specifies the
1864 # format of the mirror image, default is to probe if mode='existing',
1865 # else the format of the source.
1867 # Returns: - nothing on success
1868 #          - If @device is not a valid block device, GenericError
1870 # Since: 1.3
1872 # Example:
1874 # -> { "execute": "drive-mirror",
1875 #      "arguments": { "device": "ide-hd0",
1876 #                     "target": "/some/place/my-image",
1877 #                     "sync": "full",
1878 #                     "format": "qcow2" } }
1879 # <- { "return": {} }
1882 { 'command': 'drive-mirror', 'boxed': true,
1883   'data': 'DriveMirror' }
1886 # @DriveMirror:
1888 # A set of parameters describing drive mirror setup.
1890 # @job-id: identifier for the newly-created block job. If
1891 #          omitted, the device name will be used. (Since 2.7)
1893 # @device:  the device name or node-name of a root node whose writes should be
1894 #           mirrored.
1896 # @target: the target of the new image. If the file exists, or if it
1897 #          is a device, the existing file/device will be used as the new
1898 #          destination.  If it does not exist, a new file will be created.
1900 # @format: the format of the new destination, default is to
1901 #          probe if @mode is 'existing', else the format of the source
1903 # @node-name: the new block driver state node name in the graph
1904 #             (Since 2.1)
1906 # @replaces: with sync=full graph node name to be replaced by the new
1907 #            image when a whole image copy is done. This can be used to repair
1908 #            broken Quorum files. (Since 2.1)
1910 # @mode: whether and how QEMU should create a new image, default is
1911 #        'absolute-paths'.
1913 # @speed:  the maximum speed, in bytes per second
1915 # @sync: what parts of the disk image should be copied to the destination
1916 #        (all the disk, only the sectors allocated in the topmost image, or
1917 #        only new I/O).
1919 # @granularity: granularity of the dirty bitmap, default is 64K
1920 #               if the image format doesn't have clusters, 4K if the clusters
1921 #               are smaller than that, else the cluster size.  Must be a
1922 #               power of 2 between 512 and 64M (since 1.4).
1924 # @buf-size: maximum amount of data in flight from source to
1925 #            target (since 1.4).
1927 # @on-source-error: the action to take on an error on the source,
1928 #                   default 'report'.  'stop' and 'enospc' can only be used
1929 #                   if the block device supports io-status (see BlockInfo).
1931 # @on-target-error: the action to take on an error on the target,
1932 #                   default 'report' (no limitations, since this applies to
1933 #                   a different block device than @device).
1934 # @unmap: Whether to try to unmap target sectors where source has
1935 #         only zero. If true, and target unallocated sectors will read as zero,
1936 #         target image sectors will be unmapped; otherwise, zeroes will be
1937 #         written. Both will result in identical contents.
1938 #         Default is true. (Since 2.4)
1940 # @copy-mode: when to copy data to the destination; defaults to 'background'
1941 #             (Since: 3.0)
1943 # @auto-finalize: When false, this job will wait in a PENDING state after it has
1944 #                 finished its work, waiting for @block-job-finalize before
1945 #                 making any block graph changes.
1946 #                 When true, this job will automatically
1947 #                 perform its abort or commit actions.
1948 #                 Defaults to true. (Since 3.1)
1950 # @auto-dismiss: When false, this job will wait in a CONCLUDED state after it
1951 #                has completely ceased all work, and awaits @block-job-dismiss.
1952 #                When true, this job will automatically disappear from the query
1953 #                list without user intervention.
1954 #                Defaults to true. (Since 3.1)
1955 # Since: 1.3
1957 { 'struct': 'DriveMirror',
1958   'data': { '*job-id': 'str', 'device': 'str', 'target': 'str',
1959             '*format': 'str', '*node-name': 'str', '*replaces': 'str',
1960             'sync': 'MirrorSyncMode', '*mode': 'NewImageMode',
1961             '*speed': 'int', '*granularity': 'uint32',
1962             '*buf-size': 'int', '*on-source-error': 'BlockdevOnError',
1963             '*on-target-error': 'BlockdevOnError',
1964             '*unmap': 'bool', '*copy-mode': 'MirrorCopyMode',
1965             '*auto-finalize': 'bool', '*auto-dismiss': 'bool' } }
1968 # @BlockDirtyBitmap:
1970 # @node: name of device/node which the bitmap is tracking
1972 # @name: name of the dirty bitmap
1974 # Since: 2.4
1976 { 'struct': 'BlockDirtyBitmap',
1977   'data': { 'node': 'str', 'name': 'str' } }
1980 # @BlockDirtyBitmapAdd:
1982 # @node: name of device/node which the bitmap is tracking
1984 # @name: name of the dirty bitmap (must be less than 1024 bytes)
1986 # @granularity: the bitmap granularity, default is 64k for
1987 #               block-dirty-bitmap-add
1989 # @persistent: the bitmap is persistent, i.e. it will be saved to the
1990 #              corresponding block device image file on its close. For now only
1991 #              Qcow2 disks support persistent bitmaps. Default is false for
1992 #              block-dirty-bitmap-add. (Since: 2.10)
1994 # @disabled: the bitmap is created in the disabled state, which means that
1995 #            it will not track drive changes. The bitmap may be enabled with
1996 #            block-dirty-bitmap-enable. Default is false. (Since: 4.0)
1998 # Since: 2.4
2000 { 'struct': 'BlockDirtyBitmapAdd',
2001   'data': { 'node': 'str', 'name': 'str', '*granularity': 'uint32',
2002             '*persistent': 'bool', '*disabled': 'bool' } }
2005 # @BlockDirtyBitmapMergeSource:
2007 # @local: name of the bitmap, attached to the same node as target bitmap.
2009 # @external: bitmap with specified node
2011 # Since: 4.1
2013 { 'alternate': 'BlockDirtyBitmapMergeSource',
2014   'data': { 'local': 'str',
2015             'external': 'BlockDirtyBitmap' } }
2018 # @BlockDirtyBitmapMerge:
2020 # @node: name of device/node which the @target bitmap is tracking
2022 # @target: name of the destination dirty bitmap
2024 # @bitmaps: name(s) of the source dirty bitmap(s) at @node and/or fully
2025 #           specifed BlockDirtyBitmap elements. The latter are supported
2026 #           since 4.1.
2028 # Since: 4.0
2030 { 'struct': 'BlockDirtyBitmapMerge',
2031   'data': { 'node': 'str', 'target': 'str',
2032             'bitmaps': ['BlockDirtyBitmapMergeSource'] } }
2035 # @block-dirty-bitmap-add:
2037 # Create a dirty bitmap with a name on the node, and start tracking the writes.
2039 # Returns: - nothing on success
2040 #          - If @node is not a valid block device or node, DeviceNotFound
2041 #          - If @name is already taken, GenericError with an explanation
2043 # Since: 2.4
2045 # Example:
2047 # -> { "execute": "block-dirty-bitmap-add",
2048 #      "arguments": { "node": "drive0", "name": "bitmap0" } }
2049 # <- { "return": {} }
2052 { 'command': 'block-dirty-bitmap-add',
2053   'data': 'BlockDirtyBitmapAdd' }
2056 # @block-dirty-bitmap-remove:
2058 # Stop write tracking and remove the dirty bitmap that was created
2059 # with block-dirty-bitmap-add. If the bitmap is persistent, remove it from its
2060 # storage too.
2062 # Returns: - nothing on success
2063 #          - If @node is not a valid block device or node, DeviceNotFound
2064 #          - If @name is not found, GenericError with an explanation
2065 #          - if @name is frozen by an operation, GenericError
2067 # Since: 2.4
2069 # Example:
2071 # -> { "execute": "block-dirty-bitmap-remove",
2072 #      "arguments": { "node": "drive0", "name": "bitmap0" } }
2073 # <- { "return": {} }
2076 { 'command': 'block-dirty-bitmap-remove',
2077   'data': 'BlockDirtyBitmap' }
2080 # @block-dirty-bitmap-clear:
2082 # Clear (reset) a dirty bitmap on the device, so that an incremental
2083 # backup from this point in time forward will only backup clusters
2084 # modified after this clear operation.
2086 # Returns: - nothing on success
2087 #          - If @node is not a valid block device, DeviceNotFound
2088 #          - If @name is not found, GenericError with an explanation
2090 # Since: 2.4
2092 # Example:
2094 # -> { "execute": "block-dirty-bitmap-clear",
2095 #      "arguments": { "node": "drive0", "name": "bitmap0" } }
2096 # <- { "return": {} }
2099 { 'command': 'block-dirty-bitmap-clear',
2100   'data': 'BlockDirtyBitmap' }
2103 # @block-dirty-bitmap-enable:
2105 # Enables a dirty bitmap so that it will begin tracking disk changes.
2107 # Returns: - nothing on success
2108 #          - If @node is not a valid block device, DeviceNotFound
2109 #          - If @name is not found, GenericError with an explanation
2111 # Since: 4.0
2113 # Example:
2115 # -> { "execute": "block-dirty-bitmap-enable",
2116 #      "arguments": { "node": "drive0", "name": "bitmap0" } }
2117 # <- { "return": {} }
2120   { 'command': 'block-dirty-bitmap-enable',
2121     'data': 'BlockDirtyBitmap' }
2124 # @block-dirty-bitmap-disable:
2126 # Disables a dirty bitmap so that it will stop tracking disk changes.
2128 # Returns: - nothing on success
2129 #          - If @node is not a valid block device, DeviceNotFound
2130 #          - If @name is not found, GenericError with an explanation
2132 # Since: 4.0
2134 # Example:
2136 # -> { "execute": "block-dirty-bitmap-disable",
2137 #      "arguments": { "node": "drive0", "name": "bitmap0" } }
2138 # <- { "return": {} }
2141     { 'command': 'block-dirty-bitmap-disable',
2142       'data': 'BlockDirtyBitmap' }
2145 # @block-dirty-bitmap-merge:
2147 # Merge dirty bitmaps listed in @bitmaps to the @target dirty bitmap.
2148 # Dirty bitmaps in @bitmaps will be unchanged, except if it also appears
2149 # as the @target bitmap. Any bits already set in @target will still be
2150 # set after the merge, i.e., this operation does not clear the target.
2151 # On error, @target is unchanged.
2153 # The resulting bitmap will count as dirty any clusters that were dirty in any
2154 # of the source bitmaps. This can be used to achieve backup checkpoints, or in
2155 # simpler usages, to copy bitmaps.
2157 # Returns: - nothing on success
2158 #          - If @node is not a valid block device, DeviceNotFound
2159 #          - If any bitmap in @bitmaps or @target is not found, GenericError
2160 #          - If any of the bitmaps have different sizes or granularities,
2161 #            GenericError
2163 # Since: 4.0
2165 # Example:
2167 # -> { "execute": "block-dirty-bitmap-merge",
2168 #      "arguments": { "node": "drive0", "target": "bitmap0",
2169 #                     "bitmaps": ["bitmap1"] } }
2170 # <- { "return": {} }
2173       { 'command': 'block-dirty-bitmap-merge',
2174         'data': 'BlockDirtyBitmapMerge' }
2177 # @BlockDirtyBitmapSha256:
2179 # SHA256 hash of dirty bitmap data
2181 # @sha256: ASCII representation of SHA256 bitmap hash
2183 # Since: 2.10
2185   { 'struct': 'BlockDirtyBitmapSha256',
2186     'data': {'sha256': 'str'} }
2189 # @x-debug-block-dirty-bitmap-sha256:
2191 # Get bitmap SHA256.
2193 # Returns: - BlockDirtyBitmapSha256 on success
2194 #          - If @node is not a valid block device, DeviceNotFound
2195 #          - If @name is not found or if hashing has failed, GenericError with an
2196 #            explanation
2198 # Since: 2.10
2200   { 'command': 'x-debug-block-dirty-bitmap-sha256',
2201     'data': 'BlockDirtyBitmap', 'returns': 'BlockDirtyBitmapSha256' }
2204 # @blockdev-mirror:
2206 # Start mirroring a block device's writes to a new destination.
2208 # @job-id: identifier for the newly-created block job. If
2209 #          omitted, the device name will be used. (Since 2.7)
2211 # @device: The device name or node-name of a root node whose writes should be
2212 #          mirrored.
2214 # @target: the id or node-name of the block device to mirror to. This mustn't be
2215 #          attached to guest.
2217 # @replaces: with sync=full graph node name to be replaced by the new
2218 #            image when a whole image copy is done. This can be used to repair
2219 #            broken Quorum files.
2221 # @speed:  the maximum speed, in bytes per second
2223 # @sync: what parts of the disk image should be copied to the destination
2224 #        (all the disk, only the sectors allocated in the topmost image, or
2225 #        only new I/O).
2227 # @granularity: granularity of the dirty bitmap, default is 64K
2228 #               if the image format doesn't have clusters, 4K if the clusters
2229 #               are smaller than that, else the cluster size.  Must be a
2230 #               power of 2 between 512 and 64M
2232 # @buf-size: maximum amount of data in flight from source to
2233 #            target
2235 # @on-source-error: the action to take on an error on the source,
2236 #                   default 'report'.  'stop' and 'enospc' can only be used
2237 #                   if the block device supports io-status (see BlockInfo).
2239 # @on-target-error: the action to take on an error on the target,
2240 #                   default 'report' (no limitations, since this applies to
2241 #                   a different block device than @device).
2243 # @filter-node-name: the node name that should be assigned to the
2244 #                    filter driver that the mirror job inserts into the graph
2245 #                    above @device. If this option is not given, a node name is
2246 #                    autogenerated. (Since: 2.9)
2248 # @copy-mode: when to copy data to the destination; defaults to 'background'
2249 #             (Since: 3.0)
2251 # @auto-finalize: When false, this job will wait in a PENDING state after it has
2252 #                 finished its work, waiting for @block-job-finalize before
2253 #                 making any block graph changes.
2254 #                 When true, this job will automatically
2255 #                 perform its abort or commit actions.
2256 #                 Defaults to true. (Since 3.1)
2258 # @auto-dismiss: When false, this job will wait in a CONCLUDED state after it
2259 #                has completely ceased all work, and awaits @block-job-dismiss.
2260 #                When true, this job will automatically disappear from the query
2261 #                list without user intervention.
2262 #                Defaults to true. (Since 3.1)
2263 # Returns: nothing on success.
2265 # Since: 2.6
2267 # Example:
2269 # -> { "execute": "blockdev-mirror",
2270 #      "arguments": { "device": "ide-hd0",
2271 #                     "target": "target0",
2272 #                     "sync": "full" } }
2273 # <- { "return": {} }
2276 { 'command': 'blockdev-mirror',
2277   'data': { '*job-id': 'str', 'device': 'str', 'target': 'str',
2278             '*replaces': 'str',
2279             'sync': 'MirrorSyncMode',
2280             '*speed': 'int', '*granularity': 'uint32',
2281             '*buf-size': 'int', '*on-source-error': 'BlockdevOnError',
2282             '*on-target-error': 'BlockdevOnError',
2283             '*filter-node-name': 'str',
2284             '*copy-mode': 'MirrorCopyMode',
2285             '*auto-finalize': 'bool', '*auto-dismiss': 'bool' } }
2288 # @BlockIOThrottle:
2290 # A set of parameters describing block throttling.
2292 # @device: Block device name (deprecated, use @id instead)
2294 # @id: The name or QOM path of the guest device (since: 2.8)
2296 # @bps: total throughput limit in bytes per second
2298 # @bps_rd: read throughput limit in bytes per second
2300 # @bps_wr: write throughput limit in bytes per second
2302 # @iops: total I/O operations per second
2304 # @iops_rd: read I/O operations per second
2306 # @iops_wr: write I/O operations per second
2308 # @bps_max: total throughput limit during bursts,
2309 #           in bytes (Since 1.7)
2311 # @bps_rd_max: read throughput limit during bursts,
2312 #              in bytes (Since 1.7)
2314 # @bps_wr_max: write throughput limit during bursts,
2315 #              in bytes (Since 1.7)
2317 # @iops_max: total I/O operations per second during bursts,
2318 #            in bytes (Since 1.7)
2320 # @iops_rd_max: read I/O operations per second during bursts,
2321 #               in bytes (Since 1.7)
2323 # @iops_wr_max: write I/O operations per second during bursts,
2324 #               in bytes (Since 1.7)
2326 # @bps_max_length: maximum length of the @bps_max burst
2327 #                  period, in seconds. It must only
2328 #                  be set if @bps_max is set as well.
2329 #                  Defaults to 1. (Since 2.6)
2331 # @bps_rd_max_length: maximum length of the @bps_rd_max
2332 #                     burst period, in seconds. It must only
2333 #                     be set if @bps_rd_max is set as well.
2334 #                     Defaults to 1. (Since 2.6)
2336 # @bps_wr_max_length: maximum length of the @bps_wr_max
2337 #                     burst period, in seconds. It must only
2338 #                     be set if @bps_wr_max is set as well.
2339 #                     Defaults to 1. (Since 2.6)
2341 # @iops_max_length: maximum length of the @iops burst
2342 #                   period, in seconds. It must only
2343 #                   be set if @iops_max is set as well.
2344 #                   Defaults to 1. (Since 2.6)
2346 # @iops_rd_max_length: maximum length of the @iops_rd_max
2347 #                      burst period, in seconds. It must only
2348 #                      be set if @iops_rd_max is set as well.
2349 #                      Defaults to 1. (Since 2.6)
2351 # @iops_wr_max_length: maximum length of the @iops_wr_max
2352 #                      burst period, in seconds. It must only
2353 #                      be set if @iops_wr_max is set as well.
2354 #                      Defaults to 1. (Since 2.6)
2356 # @iops_size: an I/O size in bytes (Since 1.7)
2358 # @group: throttle group name (Since 2.4)
2360 # Since: 1.1
2362 { 'struct': 'BlockIOThrottle',
2363   'data': { '*device': 'str', '*id': 'str', 'bps': 'int', 'bps_rd': 'int',
2364             'bps_wr': 'int', 'iops': 'int', 'iops_rd': 'int', 'iops_wr': 'int',
2365             '*bps_max': 'int', '*bps_rd_max': 'int',
2366             '*bps_wr_max': 'int', '*iops_max': 'int',
2367             '*iops_rd_max': 'int', '*iops_wr_max': 'int',
2368             '*bps_max_length': 'int', '*bps_rd_max_length': 'int',
2369             '*bps_wr_max_length': 'int', '*iops_max_length': 'int',
2370             '*iops_rd_max_length': 'int', '*iops_wr_max_length': 'int',
2371             '*iops_size': 'int', '*group': 'str' } }
2374 # @ThrottleLimits:
2376 # Limit parameters for throttling.
2377 # Since some limit combinations are illegal, limits should always be set in one
2378 # transaction. All fields are optional. When setting limits, if a field is
2379 # missing the current value is not changed.
2381 # @iops-total: limit total I/O operations per second
2382 # @iops-total-max: I/O operations burst
2383 # @iops-total-max-length: length of the iops-total-max burst period, in seconds
2384 #                         It must only be set if @iops-total-max is set as well.
2385 # @iops-read: limit read operations per second
2386 # @iops-read-max: I/O operations read burst
2387 # @iops-read-max-length: length of the iops-read-max burst period, in seconds
2388 #                        It must only be set if @iops-read-max is set as well.
2389 # @iops-write: limit write operations per second
2390 # @iops-write-max: I/O operations write burst
2391 # @iops-write-max-length: length of the iops-write-max burst period, in seconds
2392 #                         It must only be set if @iops-write-max is set as well.
2393 # @bps-total: limit total bytes per second
2394 # @bps-total-max: total bytes burst
2395 # @bps-total-max-length: length of the bps-total-max burst period, in seconds.
2396 #                        It must only be set if @bps-total-max is set as well.
2397 # @bps-read: limit read bytes per second
2398 # @bps-read-max: total bytes read burst
2399 # @bps-read-max-length: length of the bps-read-max burst period, in seconds
2400 #                       It must only be set if @bps-read-max is set as well.
2401 # @bps-write: limit write bytes per second
2402 # @bps-write-max: total bytes write burst
2403 # @bps-write-max-length: length of the bps-write-max burst period, in seconds
2404 #                        It must only be set if @bps-write-max is set as well.
2405 # @iops-size: when limiting by iops max size of an I/O in bytes
2407 # Since: 2.11
2409 { 'struct': 'ThrottleLimits',
2410   'data': { '*iops-total' : 'int', '*iops-total-max' : 'int',
2411             '*iops-total-max-length' : 'int', '*iops-read' : 'int',
2412             '*iops-read-max' : 'int', '*iops-read-max-length' : 'int',
2413             '*iops-write' : 'int', '*iops-write-max' : 'int',
2414             '*iops-write-max-length' : 'int', '*bps-total' : 'int',
2415             '*bps-total-max' : 'int', '*bps-total-max-length' : 'int',
2416             '*bps-read' : 'int', '*bps-read-max' : 'int',
2417             '*bps-read-max-length' : 'int', '*bps-write' : 'int',
2418             '*bps-write-max' : 'int', '*bps-write-max-length' : 'int',
2419             '*iops-size' : 'int' } }
2422 # @block-stream:
2424 # Copy data from a backing file into a block device.
2426 # The block streaming operation is performed in the background until the entire
2427 # backing file has been copied.  This command returns immediately once streaming
2428 # has started.  The status of ongoing block streaming operations can be checked
2429 # with query-block-jobs.  The operation can be stopped before it has completed
2430 # using the block-job-cancel command.
2432 # The node that receives the data is called the top image, can be located in
2433 # any part of the chain (but always above the base image; see below) and can be
2434 # specified using its device or node name. Earlier qemu versions only allowed
2435 # 'device' to name the top level node; presence of the 'base-node' parameter
2436 # during introspection can be used as a witness of the enhanced semantics
2437 # of 'device'.
2439 # If a base file is specified then sectors are not copied from that base file and
2440 # its backing chain.  When streaming completes the image file will have the base
2441 # file as its backing file.  This can be used to stream a subset of the backing
2442 # file chain instead of flattening the entire image.
2444 # On successful completion the image file is updated to drop the backing file
2445 # and the BLOCK_JOB_COMPLETED event is emitted.
2447 # @job-id: identifier for the newly-created block job. If
2448 #          omitted, the device name will be used. (Since 2.7)
2450 # @device: the device or node name of the top image
2452 # @base: the common backing file name.
2453 #        It cannot be set if @base-node is also set.
2455 # @base-node: the node name of the backing file.
2456 #             It cannot be set if @base is also set. (Since 2.8)
2458 # @backing-file: The backing file string to write into the top
2459 #                image. This filename is not validated.
2461 #                If a pathname string is such that it cannot be
2462 #                resolved by QEMU, that means that subsequent QMP or
2463 #                HMP commands must use node-names for the image in
2464 #                question, as filename lookup methods will fail.
2466 #                If not specified, QEMU will automatically determine
2467 #                the backing file string to use, or error out if there
2468 #                is no obvious choice.  Care should be taken when
2469 #                specifying the string, to specify a valid filename or
2470 #                protocol.
2471 #                (Since 2.1)
2473 # @speed: the maximum speed, in bytes per second
2475 # @on-error: the action to take on an error (default report).
2476 #            'stop' and 'enospc' can only be used if the block device
2477 #            supports io-status (see BlockInfo).  Since 1.3.
2479 # @auto-finalize: When false, this job will wait in a PENDING state after it has
2480 #                 finished its work, waiting for @block-job-finalize before
2481 #                 making any block graph changes.
2482 #                 When true, this job will automatically
2483 #                 perform its abort or commit actions.
2484 #                 Defaults to true. (Since 3.1)
2486 # @auto-dismiss: When false, this job will wait in a CONCLUDED state after it
2487 #                has completely ceased all work, and awaits @block-job-dismiss.
2488 #                When true, this job will automatically disappear from the query
2489 #                list without user intervention.
2490 #                Defaults to true. (Since 3.1)
2492 # Returns: - Nothing on success.
2493 #          - If @device does not exist, DeviceNotFound.
2495 # Since: 1.1
2497 # Example:
2499 # -> { "execute": "block-stream",
2500 #      "arguments": { "device": "virtio0",
2501 #                     "base": "/tmp/master.qcow2" } }
2502 # <- { "return": {} }
2505 { 'command': 'block-stream',
2506   'data': { '*job-id': 'str', 'device': 'str', '*base': 'str',
2507             '*base-node': 'str', '*backing-file': 'str', '*speed': 'int',
2508             '*on-error': 'BlockdevOnError',
2509             '*auto-finalize': 'bool', '*auto-dismiss': 'bool' } }
2512 # @block-job-set-speed:
2514 # Set maximum speed for a background block operation.
2516 # This command can only be issued when there is an active block job.
2518 # Throttling can be disabled by setting the speed to 0.
2520 # @device: The job identifier. This used to be a device name (hence
2521 #          the name of the parameter), but since QEMU 2.7 it can have
2522 #          other values.
2524 # @speed: the maximum speed, in bytes per second, or 0 for unlimited.
2525 #         Defaults to 0.
2527 # Returns: - Nothing on success
2528 #          - If no background operation is active on this device, DeviceNotActive
2530 # Since: 1.1
2532 { 'command': 'block-job-set-speed',
2533   'data': { 'device': 'str', 'speed': 'int' } }
2536 # @block-job-cancel:
2538 # Stop an active background block operation.
2540 # This command returns immediately after marking the active background block
2541 # operation for cancellation.  It is an error to call this command if no
2542 # operation is in progress.
2544 # The operation will cancel as soon as possible and then emit the
2545 # BLOCK_JOB_CANCELLED event.  Before that happens the job is still visible when
2546 # enumerated using query-block-jobs.
2548 # Note that if you issue 'block-job-cancel' after 'drive-mirror' has indicated
2549 # (via the event BLOCK_JOB_READY) that the source and destination are
2550 # synchronized, then the event triggered by this command changes to
2551 # BLOCK_JOB_COMPLETED, to indicate that the mirroring has ended and the
2552 # destination now has a point-in-time copy tied to the time of the cancellation.
2554 # For streaming, the image file retains its backing file unless the streaming
2555 # operation happens to complete just as it is being cancelled.  A new streaming
2556 # operation can be started at a later time to finish copying all data from the
2557 # backing file.
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 # @force: If true, and the job has already emitted the event BLOCK_JOB_READY,
2564 #         abandon the job immediately (even if it is paused) instead of waiting
2565 #         for the destination to complete its final synchronization (since 1.3)
2567 # Returns: - Nothing on success
2568 #          - If no background operation is active on this device, DeviceNotActive
2570 # Since: 1.1
2572 { 'command': 'block-job-cancel', 'data': { 'device': 'str', '*force': 'bool' } }
2575 # @block-job-pause:
2577 # Pause an active background block operation.
2579 # This command returns immediately after marking the active background block
2580 # operation for pausing.  It is an error to call this command if no
2581 # operation is in progress or if the job is already paused.
2583 # The operation will pause as soon as possible.  No event is emitted when
2584 # the operation is actually paused.  Cancelling a paused job automatically
2585 # resumes it.
2587 # @device: The job identifier. This used to be a device name (hence
2588 #          the name of the parameter), but since QEMU 2.7 it can have
2589 #          other values.
2591 # Returns: - Nothing on success
2592 #          - If no background operation is active on this device, DeviceNotActive
2594 # Since: 1.3
2596 { 'command': 'block-job-pause', 'data': { 'device': 'str' } }
2599 # @block-job-resume:
2601 # Resume an active background block operation.
2603 # This command returns immediately after resuming a paused background block
2604 # operation.  It is an error to call this command if no operation is in
2605 # progress or if the job is not paused.
2607 # This command also clears the error status of the job.
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-resume', 'data': { 'device': 'str' } }
2621 # @block-job-complete:
2623 # Manually trigger completion of an active background block operation.  This
2624 # is supported for drive mirroring, where it also switches the device to
2625 # write to the target path only.  The ability to complete is signaled with
2626 # a BLOCK_JOB_READY event.
2628 # This command completes an active background block operation synchronously.
2629 # The ordering of this command's return with the BLOCK_JOB_COMPLETED event
2630 # is not defined.  Note that if an I/O error occurs during the processing of
2631 # this command: 1) the command itself will fail; 2) the error will be processed
2632 # according to the rerror/werror arguments that were specified when starting
2633 # the operation.
2635 # A cancelled or paused job cannot be completed.
2637 # @device: The job identifier. This used to be a device name (hence
2638 #          the name of the parameter), but since QEMU 2.7 it can have
2639 #          other values.
2641 # Returns: - Nothing on success
2642 #          - If no background operation is active on this device, DeviceNotActive
2644 # Since: 1.3
2646 { 'command': 'block-job-complete', 'data': { 'device': 'str' } }
2649 # @block-job-dismiss:
2651 # For jobs that have already concluded, remove them from the block-job-query
2652 # list. This command only needs to be run for jobs which were started with
2653 # QEMU 2.12+ job lifetime management semantics.
2655 # This command will refuse to operate on any job that has not yet reached
2656 # its terminal state, JOB_STATUS_CONCLUDED. For jobs that make use of the
2657 # BLOCK_JOB_READY event, block-job-cancel or block-job-complete will still need
2658 # to be used as appropriate.
2660 # @id: The job identifier.
2662 # Returns: Nothing on success
2664 # Since: 2.12
2666 { 'command': 'block-job-dismiss', 'data': { 'id': 'str' } }
2669 # @block-job-finalize:
2671 # Once a job that has manual=true reaches the pending state, it can be
2672 # instructed to finalize any graph changes and do any necessary cleanup
2673 # via this command.
2674 # For jobs in a transaction, instructing one job to finalize will force
2675 # ALL jobs in the transaction to finalize, so it is only necessary to instruct
2676 # a single member job to finalize.
2678 # @id: The job identifier.
2680 # Returns: Nothing on success
2682 # Since: 2.12
2684 { 'command': 'block-job-finalize', 'data': { 'id': 'str' } }
2687 # @BlockdevDiscardOptions:
2689 # Determines how to handle discard requests.
2691 # @ignore: Ignore the request
2692 # @unmap: Forward as an unmap request
2694 # Since: 2.9
2696 { 'enum': 'BlockdevDiscardOptions',
2697   'data': [ 'ignore', 'unmap' ] }
2700 # @BlockdevDetectZeroesOptions:
2702 # Describes the operation mode for the automatic conversion of plain
2703 # zero writes by the OS to driver specific optimized zero write commands.
2705 # @off: Disabled (default)
2706 # @on: Enabled
2707 # @unmap: Enabled and even try to unmap blocks if possible. This requires
2708 #         also that @BlockdevDiscardOptions is set to unmap for this device.
2710 # Since: 2.1
2712 { 'enum': 'BlockdevDetectZeroesOptions',
2713   'data': [ 'off', 'on', 'unmap' ] }
2716 # @BlockdevAioOptions:
2718 # Selects the AIO backend to handle I/O requests
2720 # @threads: Use qemu's thread pool
2721 # @native: Use native AIO backend (only Linux and Windows)
2722 # @io_uring: Use linux io_uring (since 5.0)
2724 # Since: 2.9
2726 { 'enum': 'BlockdevAioOptions',
2727   'data': [ 'threads', 'native',
2728             { 'name': 'io_uring', 'if': 'defined(CONFIG_LINUX_IO_URING)' } ] }
2731 # @BlockdevCacheOptions:
2733 # Includes cache-related options for block devices
2735 # @direct: enables use of O_DIRECT (bypass the host page cache;
2736 #          default: false)
2737 # @no-flush: ignore any flush requests for the device (default:
2738 #            false)
2740 # Since: 2.9
2742 { 'struct': 'BlockdevCacheOptions',
2743   'data': { '*direct': 'bool',
2744             '*no-flush': 'bool' } }
2747 # @BlockdevDriver:
2749 # Drivers that are supported in block device operations.
2751 # @vxhs: Since 2.10
2752 # @throttle: Since 2.11
2753 # @nvme: Since 2.12
2754 # @copy-on-read: Since 3.0
2755 # @blklogwrites: Since 3.0
2756 # @blkreplay: Since 4.2
2757 # @compress: Since 5.0
2759 # Since: 2.9
2761 { 'enum': 'BlockdevDriver',
2762   'data': [ 'blkdebug', 'blklogwrites', 'blkreplay', 'blkverify', 'bochs',
2763             'cloop', 'compress', 'copy-on-read', 'dmg', 'file', 'ftp', 'ftps',
2764             'gluster', 'host_cdrom', 'host_device', 'http', 'https', 'iscsi',
2765             'luks', 'nbd', 'nfs', 'null-aio', 'null-co', 'nvme', 'parallels',
2766             'qcow', 'qcow2', 'qed', 'quorum', 'raw', 'rbd',
2767             { 'name': 'replication', 'if': 'defined(CONFIG_REPLICATION)' },
2768             'sheepdog',
2769             'ssh', 'throttle', 'vdi', 'vhdx', 'vmdk', 'vpc', 'vvfat', 'vxhs' ] }
2772 # @BlockdevOptionsFile:
2774 # Driver specific block device options for the file backend.
2776 # @filename: path to the image file
2777 # @pr-manager: the id for the object that will handle persistent reservations
2778 #              for this device (default: none, forward the commands via SG_IO;
2779 #              since 2.11)
2780 # @aio: AIO backend (default: threads) (since: 2.8)
2781 # @locking: whether to enable file locking. If set to 'auto', only enable
2782 #           when Open File Descriptor (OFD) locking API is available
2783 #           (default: auto, since 2.10)
2784 # @drop-cache: invalidate page cache during live migration.  This prevents
2785 #              stale data on the migration destination with cache.direct=off.
2786 #              Currently only supported on Linux hosts.
2787 #              (default: on, since: 4.0)
2788 # @x-check-cache-dropped: whether to check that page cache was dropped on live
2789 #                         migration.  May cause noticeable delays if the image
2790 #                         file is large, do not use in production.
2791 #                         (default: off) (since: 3.0)
2793 # Features:
2794 # @dynamic-auto-read-only: If present, enabled auto-read-only means that the
2795 #                          driver will open the image read-only at first,
2796 #                          dynamically reopen the image file read-write when
2797 #                          the first writer is attached to the node and reopen
2798 #                          read-only when the last writer is detached. This
2799 #                          allows giving QEMU write permissions only on demand
2800 #                          when an operation actually needs write access.
2802 # Since: 2.9
2804 { 'struct': 'BlockdevOptionsFile',
2805   'data': { 'filename': 'str',
2806             '*pr-manager': 'str',
2807             '*locking': 'OnOffAuto',
2808             '*aio': 'BlockdevAioOptions',
2809             '*drop-cache': {'type': 'bool',
2810                             'if': 'defined(CONFIG_LINUX)'},
2811             '*x-check-cache-dropped': 'bool' },
2812   'features': [ { 'name': 'dynamic-auto-read-only',
2813                   'if': 'defined(CONFIG_POSIX)' } ] }
2816 # @BlockdevOptionsNull:
2818 # Driver specific block device options for the null backend.
2820 # @size: size of the device in bytes.
2821 # @latency-ns: emulated latency (in nanoseconds) in processing
2822 #              requests. Default to zero which completes requests immediately.
2823 #              (Since 2.4)
2824 # @read-zeroes: if true, reads from the device produce zeroes; if false, the
2825 #               buffer is left unchanged. (default: false; since: 4.1)
2827 # Since: 2.9
2829 { 'struct': 'BlockdevOptionsNull',
2830   'data': { '*size': 'int', '*latency-ns': 'uint64', '*read-zeroes': 'bool' } }
2833 # @BlockdevOptionsNVMe:
2835 # Driver specific block device options for the NVMe backend.
2837 # @device: PCI controller address of the NVMe device in
2838 #          format hhhh:bb:ss.f (host:bus:slot.function)
2839 # @namespace: namespace number of the device, starting from 1.
2841 # Note that the PCI @device must have been unbound from any host
2842 # kernel driver before instructing QEMU to add the blockdev.
2844 # Since: 2.12
2846 { 'struct': 'BlockdevOptionsNVMe',
2847   'data': { 'device': 'str', 'namespace': 'int' } }
2850 # @BlockdevOptionsVVFAT:
2852 # Driver specific block device options for the vvfat protocol.
2854 # @dir: directory to be exported as FAT image
2855 # @fat-type: FAT type: 12, 16 or 32
2856 # @floppy: whether to export a floppy image (true) or
2857 #          partitioned hard disk (false; default)
2858 # @label: set the volume label, limited to 11 bytes. FAT16 and
2859 #         FAT32 traditionally have some restrictions on labels, which are
2860 #         ignored by most operating systems. Defaults to "QEMU VVFAT".
2861 #         (since 2.4)
2862 # @rw: whether to allow write operations (default: false)
2864 # Since: 2.9
2866 { 'struct': 'BlockdevOptionsVVFAT',
2867   'data': { 'dir': 'str', '*fat-type': 'int', '*floppy': 'bool',
2868             '*label': 'str', '*rw': 'bool' } }
2871 # @BlockdevOptionsGenericFormat:
2873 # Driver specific block device options for image format that have no option
2874 # besides their data source.
2876 # @file: reference to or definition of the data source block device
2878 # Since: 2.9
2880 { 'struct': 'BlockdevOptionsGenericFormat',
2881   'data': { 'file': 'BlockdevRef' } }
2884 # @BlockdevOptionsLUKS:
2886 # Driver specific block device options for LUKS.
2888 # @key-secret: the ID of a QCryptoSecret object providing
2889 #              the decryption key (since 2.6). Mandatory except when
2890 #              doing a metadata-only probe of the image.
2892 # Since: 2.9
2894 { 'struct': 'BlockdevOptionsLUKS',
2895   'base': 'BlockdevOptionsGenericFormat',
2896   'data': { '*key-secret': 'str' } }
2900 # @BlockdevOptionsGenericCOWFormat:
2902 # Driver specific block device options for image format that have no option
2903 # besides their data source and an optional backing file.
2905 # @backing: reference to or definition of the backing file block
2906 #           device, null disables the backing file entirely.
2907 #           Defaults to the backing file stored the image file.
2909 # Since: 2.9
2911 { 'struct': 'BlockdevOptionsGenericCOWFormat',
2912   'base': 'BlockdevOptionsGenericFormat',
2913   'data': { '*backing': 'BlockdevRefOrNull' } }
2916 # @Qcow2OverlapCheckMode:
2918 # General overlap check modes.
2920 # @none: Do not perform any checks
2922 # @constant: Perform only checks which can be done in constant time and
2923 #            without reading anything from disk
2925 # @cached: Perform only checks which can be done without reading anything
2926 #          from disk
2928 # @all: Perform all available overlap checks
2930 # Since: 2.9
2932 { 'enum': 'Qcow2OverlapCheckMode',
2933   'data': [ 'none', 'constant', 'cached', 'all' ] }
2936 # @Qcow2OverlapCheckFlags:
2938 # Structure of flags for each metadata structure. Setting a field to 'true'
2939 # makes qemu guard that structure against unintended overwriting. The default
2940 # value is chosen according to the template given.
2942 # @template: Specifies a template mode which can be adjusted using the other
2943 #            flags, defaults to 'cached'
2945 # @bitmap-directory: since 3.0
2947 # Since: 2.9
2949 { 'struct': 'Qcow2OverlapCheckFlags',
2950   'data': { '*template':         'Qcow2OverlapCheckMode',
2951             '*main-header':      'bool',
2952             '*active-l1':        'bool',
2953             '*active-l2':        'bool',
2954             '*refcount-table':   'bool',
2955             '*refcount-block':   'bool',
2956             '*snapshot-table':   'bool',
2957             '*inactive-l1':      'bool',
2958             '*inactive-l2':      'bool',
2959             '*bitmap-directory': 'bool' } }
2962 # @Qcow2OverlapChecks:
2964 # Specifies which metadata structures should be guarded against unintended
2965 # overwriting.
2967 # @flags: set of flags for separate specification of each metadata structure
2968 #         type
2970 # @mode: named mode which chooses a specific set of flags
2972 # Since: 2.9
2974 { 'alternate': 'Qcow2OverlapChecks',
2975   'data': { 'flags': 'Qcow2OverlapCheckFlags',
2976             'mode':  'Qcow2OverlapCheckMode' } }
2979 # @BlockdevQcowEncryptionFormat:
2981 # @aes: AES-CBC with plain64 initialization vectors
2983 # Since: 2.10
2985 { 'enum': 'BlockdevQcowEncryptionFormat',
2986   'data': [ 'aes' ] }
2989 # @BlockdevQcowEncryption:
2991 # Since: 2.10
2993 { 'union': 'BlockdevQcowEncryption',
2994   'base': { 'format': 'BlockdevQcowEncryptionFormat' },
2995   'discriminator': 'format',
2996   'data': { 'aes': 'QCryptoBlockOptionsQCow' } }
2999 # @BlockdevOptionsQcow:
3001 # Driver specific block device options for qcow.
3003 # @encrypt: Image decryption options. Mandatory for
3004 #           encrypted images, except when doing a metadata-only
3005 #           probe of the image.
3007 # Since: 2.10
3009 { 'struct': 'BlockdevOptionsQcow',
3010   'base': 'BlockdevOptionsGenericCOWFormat',
3011   'data': { '*encrypt': 'BlockdevQcowEncryption' } }
3016 # @BlockdevQcow2EncryptionFormat:
3017 # @aes: AES-CBC with plain64 initialization vectors
3019 # Since: 2.10
3021 { 'enum': 'BlockdevQcow2EncryptionFormat',
3022   'data': [ 'aes', 'luks' ] }
3025 # @BlockdevQcow2Encryption:
3027 # Since: 2.10
3029 { 'union': 'BlockdevQcow2Encryption',
3030   'base': { 'format': 'BlockdevQcow2EncryptionFormat' },
3031   'discriminator': 'format',
3032   'data': { 'aes': 'QCryptoBlockOptionsQCow',
3033             'luks': 'QCryptoBlockOptionsLUKS'} }
3036 # @BlockdevOptionsQcow2:
3038 # Driver specific block device options for qcow2.
3040 # @lazy-refcounts: whether to enable the lazy refcounts
3041 #                  feature (default is taken from the image file)
3043 # @pass-discard-request: whether discard requests to the qcow2
3044 #                        device should be forwarded to the data source
3046 # @pass-discard-snapshot: whether discard requests for the data source
3047 #                         should be issued when a snapshot operation (e.g.
3048 #                         deleting a snapshot) frees clusters in the qcow2 file
3050 # @pass-discard-other: whether discard requests for the data source
3051 #                      should be issued on other occasions where a cluster
3052 #                      gets freed
3054 # @overlap-check: which overlap checks to perform for writes
3055 #                 to the image, defaults to 'cached' (since 2.2)
3057 # @cache-size: the maximum total size of the L2 table and
3058 #              refcount block caches in bytes (since 2.2)
3060 # @l2-cache-size: the maximum size of the L2 table cache in
3061 #                 bytes (since 2.2)
3063 # @l2-cache-entry-size: the size of each entry in the L2 cache in
3064 #                       bytes. It must be a power of two between 512
3065 #                       and the cluster size. The default value is
3066 #                       the cluster size (since 2.12)
3068 # @refcount-cache-size: the maximum size of the refcount block cache
3069 #                       in bytes (since 2.2)
3071 # @cache-clean-interval: clean unused entries in the L2 and refcount
3072 #                        caches. The interval is in seconds. The default value
3073 #                        is 600 on supporting platforms, and 0 on other
3074 #                        platforms. 0 disables this feature. (since 2.5)
3076 # @encrypt: Image decryption options. Mandatory for
3077 #           encrypted images, except when doing a metadata-only
3078 #           probe of the image. (since 2.10)
3080 # @data-file: reference to or definition of the external data file.
3081 #             This may only be specified for images that require an
3082 #             external data file. If it is not specified for such
3083 #             an image, the data file name is loaded from the image
3084 #             file. (since 4.0)
3086 # Since: 2.9
3088 { 'struct': 'BlockdevOptionsQcow2',
3089   'base': 'BlockdevOptionsGenericCOWFormat',
3090   'data': { '*lazy-refcounts': 'bool',
3091             '*pass-discard-request': 'bool',
3092             '*pass-discard-snapshot': 'bool',
3093             '*pass-discard-other': 'bool',
3094             '*overlap-check': 'Qcow2OverlapChecks',
3095             '*cache-size': 'int',
3096             '*l2-cache-size': 'int',
3097             '*l2-cache-entry-size': 'int',
3098             '*refcount-cache-size': 'int',
3099             '*cache-clean-interval': 'int',
3100             '*encrypt': 'BlockdevQcow2Encryption',
3101             '*data-file': 'BlockdevRef' } }
3104 # @SshHostKeyCheckMode:
3106 # @none: Don't check the host key at all
3107 # @hash: Compare the host key with a given hash
3108 # @known_hosts: Check the host key against the known_hosts file
3110 # Since: 2.12
3112 { 'enum': 'SshHostKeyCheckMode',
3113   'data': [ 'none', 'hash', 'known_hosts' ] }
3116 # @SshHostKeyCheckHashType:
3118 # @md5: The given hash is an md5 hash
3119 # @sha1: The given hash is an sha1 hash
3121 # Since: 2.12
3123 { 'enum': 'SshHostKeyCheckHashType',
3124   'data': [ 'md5', 'sha1' ] }
3127 # @SshHostKeyHash:
3129 # @type: The hash algorithm used for the hash
3130 # @hash: The expected hash value
3132 # Since: 2.12
3134 { 'struct': 'SshHostKeyHash',
3135   'data': { 'type': 'SshHostKeyCheckHashType',
3136             'hash': 'str' }}
3139 # @SshHostKeyCheck:
3141 # Since: 2.12
3143 { 'union': 'SshHostKeyCheck',
3144   'base': { 'mode': 'SshHostKeyCheckMode' },
3145   'discriminator': 'mode',
3146   'data': { 'hash': 'SshHostKeyHash' } }
3149 # @BlockdevOptionsSsh:
3151 # @server:              host address
3153 # @path:                path to the image on the host
3155 # @user:                user as which to connect, defaults to current
3156 #                       local user name
3158 # @host-key-check:      Defines how and what to check the host key against
3159 #                       (default: known_hosts)
3161 # Since: 2.9
3163 { 'struct': 'BlockdevOptionsSsh',
3164   'data': { 'server': 'InetSocketAddress',
3165             'path': 'str',
3166             '*user': 'str',
3167             '*host-key-check': 'SshHostKeyCheck' } }
3171 # @BlkdebugEvent:
3173 # Trigger events supported by blkdebug.
3175 # @l1_shrink_write_table: write zeros to the l1 table to shrink image.
3176 #                         (since 2.11)
3178 # @l1_shrink_free_l2_clusters: discard the l2 tables. (since 2.11)
3180 # @cor_write: a write due to copy-on-read (since 2.11)
3182 # @cluster_alloc_space: an allocation of file space for a cluster (since 4.1)
3184 # @none: triggers once at creation of the blkdebug node (since 4.1)
3186 # Since: 2.9
3188 { 'enum': 'BlkdebugEvent', 'prefix': 'BLKDBG',
3189   'data': [ 'l1_update', 'l1_grow_alloc_table', 'l1_grow_write_table',
3190             'l1_grow_activate_table', 'l2_load', 'l2_update',
3191             'l2_update_compressed', 'l2_alloc_cow_read', 'l2_alloc_write',
3192             'read_aio', 'read_backing_aio', 'read_compressed', 'write_aio',
3193             'write_compressed', 'vmstate_load', 'vmstate_save', 'cow_read',
3194             'cow_write', 'reftable_load', 'reftable_grow', 'reftable_update',
3195             'refblock_load', 'refblock_update', 'refblock_update_part',
3196             'refblock_alloc', 'refblock_alloc_hookup', 'refblock_alloc_write',
3197             'refblock_alloc_write_blocks', 'refblock_alloc_write_table',
3198             'refblock_alloc_switch_table', 'cluster_alloc',
3199             'cluster_alloc_bytes', 'cluster_free', 'flush_to_os',
3200             'flush_to_disk', 'pwritev_rmw_head', 'pwritev_rmw_after_head',
3201             'pwritev_rmw_tail', 'pwritev_rmw_after_tail', 'pwritev',
3202             'pwritev_zero', 'pwritev_done', 'empty_image_prepare',
3203             'l1_shrink_write_table', 'l1_shrink_free_l2_clusters',
3204             'cor_write', 'cluster_alloc_space', 'none'] }
3207 # @BlkdebugIOType:
3209 # Kinds of I/O that blkdebug can inject errors in.
3211 # @read: .bdrv_co_preadv()
3213 # @write: .bdrv_co_pwritev()
3215 # @write-zeroes: .bdrv_co_pwrite_zeroes()
3217 # @discard: .bdrv_co_pdiscard()
3219 # @flush: .bdrv_co_flush_to_disk()
3221 # @block-status: .bdrv_co_block_status()
3223 # Since: 4.1
3225 { 'enum': 'BlkdebugIOType', 'prefix': 'BLKDEBUG_IO_TYPE',
3226   'data': [ 'read', 'write', 'write-zeroes', 'discard', 'flush',
3227             'block-status' ] }
3230 # @BlkdebugInjectErrorOptions:
3232 # Describes a single error injection for blkdebug.
3234 # @event: trigger event
3236 # @state: the state identifier blkdebug needs to be in to
3237 #         actually trigger the event; defaults to "any"
3239 # @iotype: the type of I/O operations on which this error should
3240 #          be injected; defaults to "all read, write,
3241 #          write-zeroes, discard, and flush operations"
3242 #          (since: 4.1)
3244 # @errno: error identifier (errno) to be returned; defaults to
3245 #         EIO
3247 # @sector: specifies the sector index which has to be affected
3248 #          in order to actually trigger the event; defaults to "any
3249 #          sector"
3251 # @once: disables further events after this one has been
3252 #        triggered; defaults to false
3254 # @immediately: fail immediately; defaults to false
3256 # Since: 2.9
3258 { 'struct': 'BlkdebugInjectErrorOptions',
3259   'data': { 'event': 'BlkdebugEvent',
3260             '*state': 'int',
3261             '*iotype': 'BlkdebugIOType',
3262             '*errno': 'int',
3263             '*sector': 'int',
3264             '*once': 'bool',
3265             '*immediately': 'bool' } }
3268 # @BlkdebugSetStateOptions:
3270 # Describes a single state-change event for blkdebug.
3272 # @event: trigger event
3274 # @state: the current state identifier blkdebug needs to be in;
3275 #         defaults to "any"
3277 # @new_state: the state identifier blkdebug is supposed to assume if
3278 #             this event is triggered
3280 # Since: 2.9
3282 { 'struct': 'BlkdebugSetStateOptions',
3283   'data': { 'event': 'BlkdebugEvent',
3284             '*state': 'int',
3285             'new_state': 'int' } }
3288 # @BlockdevOptionsBlkdebug:
3290 # Driver specific block device options for blkdebug.
3292 # @image: underlying raw block device (or image file)
3294 # @config: filename of the configuration file
3296 # @align: required alignment for requests in bytes, must be
3297 #         positive power of 2, or 0 for default
3299 # @max-transfer: maximum size for I/O transfers in bytes, must be
3300 #                positive multiple of @align and of the underlying
3301 #                file's request alignment (but need not be a power of
3302 #                2), or 0 for default (since 2.10)
3304 # @opt-write-zero: preferred alignment for write zero requests in bytes,
3305 #                  must be positive multiple of @align and of the
3306 #                  underlying file's request alignment (but need not be a
3307 #                  power of 2), or 0 for default (since 2.10)
3309 # @max-write-zero: maximum size for write zero requests in bytes, must be
3310 #                  positive multiple of @align, of @opt-write-zero, and of
3311 #                  the underlying file's request alignment (but need not
3312 #                  be a power of 2), or 0 for default (since 2.10)
3314 # @opt-discard: preferred alignment for discard requests in bytes, must
3315 #               be positive multiple of @align and of the underlying
3316 #               file's request alignment (but need not be a power of
3317 #               2), or 0 for default (since 2.10)
3319 # @max-discard: maximum size for discard requests in bytes, must be
3320 #               positive multiple of @align, of @opt-discard, and of
3321 #               the underlying file's request alignment (but need not
3322 #               be a power of 2), or 0 for default (since 2.10)
3324 # @inject-error: array of error injection descriptions
3326 # @set-state: array of state-change descriptions
3328 # @take-child-perms: Permissions to take on @image in addition to what
3329 #                    is necessary anyway (which depends on how the
3330 #                    blkdebug node is used).  Defaults to none.
3331 #                    (since 5.0)
3333 # @unshare-child-perms: Permissions not to share on @image in addition
3334 #                       to what cannot be shared anyway (which depends
3335 #                       on how the blkdebug node is used).  Defaults
3336 #                       to none.  (since 5.0)
3338 # Since: 2.9
3340 { 'struct': 'BlockdevOptionsBlkdebug',
3341   'data': { 'image': 'BlockdevRef',
3342             '*config': 'str',
3343             '*align': 'int', '*max-transfer': 'int32',
3344             '*opt-write-zero': 'int32', '*max-write-zero': 'int32',
3345             '*opt-discard': 'int32', '*max-discard': 'int32',
3346             '*inject-error': ['BlkdebugInjectErrorOptions'],
3347             '*set-state': ['BlkdebugSetStateOptions'],
3348             '*take-child-perms': ['BlockPermission'],
3349             '*unshare-child-perms': ['BlockPermission'] } }
3352 # @BlockdevOptionsBlklogwrites:
3354 # Driver specific block device options for blklogwrites.
3356 # @file: block device
3358 # @log: block device used to log writes to @file
3360 # @log-sector-size: sector size used in logging writes to @file, determines
3361 #                   granularity of offsets and sizes of writes (default: 512)
3363 # @log-append: append to an existing log (default: false)
3365 # @log-super-update-interval: interval of write requests after which the log
3366 #                             super block is updated to disk (default: 4096)
3368 # Since: 3.0
3370 { 'struct': 'BlockdevOptionsBlklogwrites',
3371   'data': { 'file': 'BlockdevRef',
3372             'log': 'BlockdevRef',
3373             '*log-sector-size': 'uint32',
3374             '*log-append': 'bool',
3375             '*log-super-update-interval': 'uint64' } }
3378 # @BlockdevOptionsBlkverify:
3380 # Driver specific block device options for blkverify.
3382 # @test: block device to be tested
3384 # @raw: raw image used for verification
3386 # Since: 2.9
3388 { 'struct': 'BlockdevOptionsBlkverify',
3389   'data': { 'test': 'BlockdevRef',
3390             'raw': 'BlockdevRef' } }
3393 # @BlockdevOptionsBlkreplay:
3395 # Driver specific block device options for blkreplay.
3397 # @image: disk image which should be controlled with blkreplay
3399 # Since: 4.2
3401 { 'struct': 'BlockdevOptionsBlkreplay',
3402   'data': { 'image': 'BlockdevRef' } }
3405 # @QuorumReadPattern:
3407 # An enumeration of quorum read patterns.
3409 # @quorum: read all the children and do a quorum vote on reads
3411 # @fifo: read only from the first child that has not failed
3413 # Since: 2.9
3415 { 'enum': 'QuorumReadPattern', 'data': [ 'quorum', 'fifo' ] }
3418 # @BlockdevOptionsQuorum:
3420 # Driver specific block device options for Quorum
3422 # @blkverify: true if the driver must print content mismatch
3423 #                  set to false by default
3425 # @children: the children block devices to use
3427 # @vote-threshold: the vote limit under which a read will fail
3429 # @rewrite-corrupted: rewrite corrupted data when quorum is reached
3430 #                     (Since 2.1)
3432 # @read-pattern: choose read pattern and set to quorum by default
3433 #                (Since 2.2)
3435 # Since: 2.9
3437 { 'struct': 'BlockdevOptionsQuorum',
3438   'data': { '*blkverify': 'bool',
3439             'children': [ 'BlockdevRef' ],
3440             'vote-threshold': 'int',
3441             '*rewrite-corrupted': 'bool',
3442             '*read-pattern': 'QuorumReadPattern' } }
3445 # @BlockdevOptionsGluster:
3447 # Driver specific block device options for Gluster
3449 # @volume: name of gluster volume where VM image resides
3451 # @path: absolute path to image file in gluster volume
3453 # @server: gluster servers description
3455 # @debug: libgfapi log level (default '4' which is Error)
3456 #         (Since 2.8)
3458 # @logfile: libgfapi log file (default /dev/stderr) (Since 2.8)
3460 # Since: 2.9
3462 { 'struct': 'BlockdevOptionsGluster',
3463   'data': { 'volume': 'str',
3464             'path': 'str',
3465             'server': ['SocketAddress'],
3466             '*debug': 'int',
3467             '*logfile': 'str' } }
3470 # @IscsiTransport:
3472 # An enumeration of libiscsi transport types
3474 # Since: 2.9
3476 { 'enum': 'IscsiTransport',
3477   'data': [ 'tcp', 'iser' ] }
3480 # @IscsiHeaderDigest:
3482 # An enumeration of header digests supported by libiscsi
3484 # Since: 2.9
3486 { 'enum': 'IscsiHeaderDigest',
3487   'prefix': 'QAPI_ISCSI_HEADER_DIGEST',
3488   'data': [ 'crc32c', 'none', 'crc32c-none', 'none-crc32c' ] }
3491 # @BlockdevOptionsIscsi:
3493 # @transport: The iscsi transport type
3495 # @portal: The address of the iscsi portal
3497 # @target: The target iqn name
3499 # @lun: LUN to connect to. Defaults to 0.
3501 # @user: User name to log in with. If omitted, no CHAP
3502 #        authentication is performed.
3504 # @password-secret: The ID of a QCryptoSecret object providing
3505 #                   the password for the login. This option is required if
3506 #                   @user is specified.
3508 # @initiator-name: The iqn name we want to identify to the target
3509 #                  as. If this option is not specified, an initiator name is
3510 #                  generated automatically.
3512 # @header-digest: The desired header digest. Defaults to
3513 #                 none-crc32c.
3515 # @timeout: Timeout in seconds after which a request will
3516 #           timeout. 0 means no timeout and is the default.
3518 # Driver specific block device options for iscsi
3520 # Since: 2.9
3522 { 'struct': 'BlockdevOptionsIscsi',
3523   'data': { 'transport': 'IscsiTransport',
3524             'portal': 'str',
3525             'target': 'str',
3526             '*lun': 'int',
3527             '*user': 'str',
3528             '*password-secret': 'str',
3529             '*initiator-name': 'str',
3530             '*header-digest': 'IscsiHeaderDigest',
3531             '*timeout': 'int' } }
3535 # @RbdAuthMode:
3537 # Since: 3.0
3539 { 'enum': 'RbdAuthMode',
3540   'data': [ 'cephx', 'none' ] }
3543 # @BlockdevOptionsRbd:
3545 # @pool: Ceph pool name.
3547 # @namespace: Rados namespace name in the Ceph pool. (Since 5.0)
3549 # @image: Image name in the Ceph pool.
3551 # @conf: path to Ceph configuration file.  Values
3552 #        in the configuration file will be overridden by
3553 #        options specified via QAPI.
3555 # @snapshot: Ceph snapshot name.
3557 # @user: Ceph id name.
3559 # @auth-client-required: Acceptable authentication modes.
3560 #                        This maps to Ceph configuration option
3561 #                        "auth_client_required".  (Since 3.0)
3563 # @key-secret: ID of a QCryptoSecret object providing a key
3564 #              for cephx authentication.
3565 #              This maps to Ceph configuration option
3566 #              "key".  (Since 3.0)
3568 # @server: Monitor host address and port.  This maps
3569 #          to the "mon_host" Ceph option.
3571 # Since: 2.9
3573 { 'struct': 'BlockdevOptionsRbd',
3574   'data': { 'pool': 'str',
3575             '*namespace': 'str',
3576             'image': 'str',
3577             '*conf': 'str',
3578             '*snapshot': 'str',
3579             '*user': 'str',
3580             '*auth-client-required': ['RbdAuthMode'],
3581             '*key-secret': 'str',
3582             '*server': ['InetSocketAddressBase'] } }
3585 # @BlockdevOptionsSheepdog:
3587 # Driver specific block device options for sheepdog
3589 # @vdi: Virtual disk image name
3590 # @server: The Sheepdog server to connect to
3591 # @snap-id: Snapshot ID
3592 # @tag: Snapshot tag name
3594 # Only one of @snap-id and @tag may be present.
3596 # Since: 2.9
3598 { 'struct': 'BlockdevOptionsSheepdog',
3599   'data': { 'server': 'SocketAddress',
3600             'vdi': 'str',
3601             '*snap-id': 'uint32',
3602             '*tag': 'str' } }
3605 # @ReplicationMode:
3607 # An enumeration of replication modes.
3609 # @primary: Primary mode, the vm's state will be sent to secondary QEMU.
3611 # @secondary: Secondary mode, receive the vm's state from primary QEMU.
3613 # Since: 2.9
3615 { 'enum' : 'ReplicationMode', 'data' : [ 'primary', 'secondary' ],
3616   'if': 'defined(CONFIG_REPLICATION)' }
3619 # @BlockdevOptionsReplication:
3621 # Driver specific block device options for replication
3623 # @mode: the replication mode
3625 # @top-id: In secondary mode, node name or device ID of the root
3626 #          node who owns the replication node chain. Must not be given in
3627 #          primary mode.
3629 # Since: 2.9
3631 { 'struct': 'BlockdevOptionsReplication',
3632   'base': 'BlockdevOptionsGenericFormat',
3633   'data': { 'mode': 'ReplicationMode',
3634             '*top-id': 'str' },
3635   'if': 'defined(CONFIG_REPLICATION)' }
3638 # @NFSTransport:
3640 # An enumeration of NFS transport types
3642 # @inet: TCP transport
3644 # Since: 2.9
3646 { 'enum': 'NFSTransport',
3647   'data': [ 'inet' ] }
3650 # @NFSServer:
3652 # Captures the address of the socket
3654 # @type: transport type used for NFS (only TCP supported)
3656 # @host: host address for NFS server
3658 # Since: 2.9
3660 { 'struct': 'NFSServer',
3661   'data': { 'type': 'NFSTransport',
3662             'host': 'str' } }
3665 # @BlockdevOptionsNfs:
3667 # Driver specific block device option for NFS
3669 # @server: host address
3671 # @path: path of the image on the host
3673 # @user: UID value to use when talking to the
3674 #        server (defaults to 65534 on Windows and getuid()
3675 #        on unix)
3677 # @group: GID value to use when talking to the
3678 #         server (defaults to 65534 on Windows and getgid()
3679 #         in unix)
3681 # @tcp-syn-count: number of SYNs during the session
3682 #                 establishment (defaults to libnfs default)
3684 # @readahead-size: set the readahead size in bytes (defaults
3685 #                  to libnfs default)
3687 # @page-cache-size: set the pagecache size in bytes (defaults
3688 #                   to libnfs default)
3690 # @debug: set the NFS debug level (max 2) (defaults
3691 #         to libnfs default)
3693 # Since: 2.9
3695 { 'struct': 'BlockdevOptionsNfs',
3696   'data': { 'server': 'NFSServer',
3697             'path': 'str',
3698             '*user': 'int',
3699             '*group': 'int',
3700             '*tcp-syn-count': 'int',
3701             '*readahead-size': 'int',
3702             '*page-cache-size': 'int',
3703             '*debug': 'int' } }
3706 # @BlockdevOptionsCurlBase:
3708 # Driver specific block device options shared by all protocols supported by the
3709 # curl backend.
3711 # @url: URL of the image file
3713 # @readahead: Size of the read-ahead cache; must be a multiple of
3714 #             512 (defaults to 256 kB)
3716 # @timeout: Timeout for connections, in seconds (defaults to 5)
3718 # @username: Username for authentication (defaults to none)
3720 # @password-secret: ID of a QCryptoSecret object providing a password
3721 #                   for authentication (defaults to no password)
3723 # @proxy-username: Username for proxy authentication (defaults to none)
3725 # @proxy-password-secret: ID of a QCryptoSecret object providing a password
3726 #                         for proxy authentication (defaults to no password)
3728 # Since: 2.9
3730 { 'struct': 'BlockdevOptionsCurlBase',
3731   'data': { 'url': 'str',
3732             '*readahead': 'int',
3733             '*timeout': 'int',
3734             '*username': 'str',
3735             '*password-secret': 'str',
3736             '*proxy-username': 'str',
3737             '*proxy-password-secret': 'str' } }
3740 # @BlockdevOptionsCurlHttp:
3742 # Driver specific block device options for HTTP connections over the curl
3743 # backend.  URLs must start with "http://".
3745 # @cookie: List of cookies to set; format is
3746 #          "name1=content1; name2=content2;" as explained by
3747 #          CURLOPT_COOKIE(3). Defaults to no cookies.
3749 # @cookie-secret: ID of a QCryptoSecret object providing the cookie data in a
3750 #                 secure way. See @cookie for the format. (since 2.10)
3752 # Since: 2.9
3754 { 'struct': 'BlockdevOptionsCurlHttp',
3755   'base': 'BlockdevOptionsCurlBase',
3756   'data': { '*cookie': 'str',
3757             '*cookie-secret': 'str'} }
3760 # @BlockdevOptionsCurlHttps:
3762 # Driver specific block device options for HTTPS connections over the curl
3763 # backend.  URLs must start with "https://".
3765 # @cookie: List of cookies to set; format is
3766 #          "name1=content1; name2=content2;" as explained by
3767 #          CURLOPT_COOKIE(3). Defaults to no cookies.
3769 # @sslverify: Whether to verify the SSL certificate's validity (defaults to
3770 #             true)
3772 # @cookie-secret: ID of a QCryptoSecret object providing the cookie data in a
3773 #                 secure way. See @cookie for the format. (since 2.10)
3775 # Since: 2.9
3777 { 'struct': 'BlockdevOptionsCurlHttps',
3778   'base': 'BlockdevOptionsCurlBase',
3779   'data': { '*cookie': 'str',
3780             '*sslverify': 'bool',
3781             '*cookie-secret': 'str'} }
3784 # @BlockdevOptionsCurlFtp:
3786 # Driver specific block device options for FTP connections over the curl
3787 # backend.  URLs must start with "ftp://".
3789 # Since: 2.9
3791 { 'struct': 'BlockdevOptionsCurlFtp',
3792   'base': 'BlockdevOptionsCurlBase',
3793   'data': { } }
3796 # @BlockdevOptionsCurlFtps:
3798 # Driver specific block device options for FTPS connections over the curl
3799 # backend.  URLs must start with "ftps://".
3801 # @sslverify: Whether to verify the SSL certificate's validity (defaults to
3802 #             true)
3804 # Since: 2.9
3806 { 'struct': 'BlockdevOptionsCurlFtps',
3807   'base': 'BlockdevOptionsCurlBase',
3808   'data': { '*sslverify': 'bool' } }
3811 # @BlockdevOptionsNbd:
3813 # Driver specific block device options for NBD.
3815 # @server: NBD server address
3817 # @export: export name
3819 # @tls-creds: TLS credentials ID
3821 # @x-dirty-bitmap: A "qemu:dirty-bitmap:NAME" string to query in place of
3822 #                  traditional "base:allocation" block status (see
3823 #                  NBD_OPT_LIST_META_CONTEXT in the NBD protocol) (since 3.0)
3825 # @reconnect-delay: On an unexpected disconnect, the nbd client tries to
3826 #                   connect again until succeeding or encountering a serious
3827 #                   error.  During the first @reconnect-delay seconds, all
3828 #                   requests are paused and will be rerun on a successful
3829 #                   reconnect. After that time, any delayed requests and all
3830 #                   future requests before a successful reconnect will
3831 #                   immediately fail. Default 0 (Since 4.2)
3833 # Since: 2.9
3835 { 'struct': 'BlockdevOptionsNbd',
3836   'data': { 'server': 'SocketAddress',
3837             '*export': 'str',
3838             '*tls-creds': 'str',
3839             '*x-dirty-bitmap': 'str',
3840             '*reconnect-delay': 'uint32' } }
3843 # @BlockdevOptionsRaw:
3845 # Driver specific block device options for the raw driver.
3847 # @offset: position where the block device starts
3848 # @size: the assumed size of the device
3850 # Since: 2.9
3852 { 'struct': 'BlockdevOptionsRaw',
3853   'base': 'BlockdevOptionsGenericFormat',
3854   'data': { '*offset': 'int', '*size': 'int' } }
3857 # @BlockdevOptionsVxHS:
3859 # Driver specific block device options for VxHS
3861 # @vdisk-id: UUID of VxHS volume
3862 # @server: vxhs server IP, port
3863 # @tls-creds: TLS credentials ID
3865 # Since: 2.10
3867 { 'struct': 'BlockdevOptionsVxHS',
3868   'data': { 'vdisk-id': 'str',
3869             'server': 'InetSocketAddressBase',
3870             '*tls-creds': 'str' } }
3873 # @BlockdevOptionsThrottle:
3875 # Driver specific block device options for the throttle driver
3877 # @throttle-group: the name of the throttle-group object to use. It
3878 #                  must already exist.
3879 # @file: reference to or definition of the data source block device
3880 # Since: 2.11
3882 { 'struct': 'BlockdevOptionsThrottle',
3883   'data': { 'throttle-group': 'str',
3884             'file' : 'BlockdevRef'
3885              } }
3887 # @BlockdevOptions:
3889 # Options for creating a block device.  Many options are available for all
3890 # block devices, independent of the block driver:
3892 # @driver: block driver name
3893 # @node-name: the node name of the new node (Since 2.0).
3894 #             This option is required on the top level of blockdev-add.
3895 #             Valid node names start with an alphabetic character and may
3896 #             contain only alphanumeric characters, '-', '.' and '_'. Their
3897 #             maximum length is 31 characters.
3898 # @discard: discard-related options (default: ignore)
3899 # @cache: cache-related options
3900 # @read-only: whether the block device should be read-only (default: false).
3901 #             Note that some block drivers support only read-only access,
3902 #             either generally or in certain configurations. In this case,
3903 #             the default value does not work and the option must be
3904 #             specified explicitly.
3905 # @auto-read-only: if true and @read-only is false, QEMU may automatically
3906 #                  decide not to open the image read-write as requested, but
3907 #                  fall back to read-only instead (and switch between the modes
3908 #                  later), e.g. depending on whether the image file is writable
3909 #                  or whether a writing user is attached to the node
3910 #                  (default: false, since 3.1)
3911 # @detect-zeroes: detect and optimize zero writes (Since 2.1)
3912 #                 (default: off)
3913 # @force-share: force share all permission on added nodes.
3914 #               Requires read-only=true. (Since 2.10)
3916 # Remaining options are determined by the block driver.
3918 # Since: 2.9
3920 { 'union': 'BlockdevOptions',
3921   'base': { 'driver': 'BlockdevDriver',
3922             '*node-name': 'str',
3923             '*discard': 'BlockdevDiscardOptions',
3924             '*cache': 'BlockdevCacheOptions',
3925             '*read-only': 'bool',
3926             '*auto-read-only': 'bool',
3927             '*force-share': 'bool',
3928             '*detect-zeroes': 'BlockdevDetectZeroesOptions' },
3929   'discriminator': 'driver',
3930   'data': {
3931       'blkdebug':   'BlockdevOptionsBlkdebug',
3932       'blklogwrites':'BlockdevOptionsBlklogwrites',
3933       'blkverify':  'BlockdevOptionsBlkverify',
3934       'blkreplay':  'BlockdevOptionsBlkreplay',
3935       'bochs':      'BlockdevOptionsGenericFormat',
3936       'cloop':      'BlockdevOptionsGenericFormat',
3937       'compress':   'BlockdevOptionsGenericFormat',
3938       'copy-on-read':'BlockdevOptionsGenericFormat',
3939       'dmg':        'BlockdevOptionsGenericFormat',
3940       'file':       'BlockdevOptionsFile',
3941       'ftp':        'BlockdevOptionsCurlFtp',
3942       'ftps':       'BlockdevOptionsCurlFtps',
3943       'gluster':    'BlockdevOptionsGluster',
3944       'host_cdrom': 'BlockdevOptionsFile',
3945       'host_device':'BlockdevOptionsFile',
3946       'http':       'BlockdevOptionsCurlHttp',
3947       'https':      'BlockdevOptionsCurlHttps',
3948       'iscsi':      'BlockdevOptionsIscsi',
3949       'luks':       'BlockdevOptionsLUKS',
3950       'nbd':        'BlockdevOptionsNbd',
3951       'nfs':        'BlockdevOptionsNfs',
3952       'null-aio':   'BlockdevOptionsNull',
3953       'null-co':    'BlockdevOptionsNull',
3954       'nvme':       'BlockdevOptionsNVMe',
3955       'parallels':  'BlockdevOptionsGenericFormat',
3956       'qcow2':      'BlockdevOptionsQcow2',
3957       'qcow':       'BlockdevOptionsQcow',
3958       'qed':        'BlockdevOptionsGenericCOWFormat',
3959       'quorum':     'BlockdevOptionsQuorum',
3960       'raw':        'BlockdevOptionsRaw',
3961       'rbd':        'BlockdevOptionsRbd',
3962       'replication': { 'type': 'BlockdevOptionsReplication',
3963                        'if': 'defined(CONFIG_REPLICATION)' },
3964       'sheepdog':   'BlockdevOptionsSheepdog',
3965       'ssh':        'BlockdevOptionsSsh',
3966       'throttle':   'BlockdevOptionsThrottle',
3967       'vdi':        'BlockdevOptionsGenericFormat',
3968       'vhdx':       'BlockdevOptionsGenericFormat',
3969       'vmdk':       'BlockdevOptionsGenericCOWFormat',
3970       'vpc':        'BlockdevOptionsGenericFormat',
3971       'vvfat':      'BlockdevOptionsVVFAT',
3972       'vxhs':       'BlockdevOptionsVxHS'
3973   } }
3976 # @BlockdevRef:
3978 # Reference to a block device.
3980 # @definition: defines a new block device inline
3981 # @reference: references the ID of an existing block device
3983 # Since: 2.9
3985 { 'alternate': 'BlockdevRef',
3986   'data': { 'definition': 'BlockdevOptions',
3987             'reference': 'str' } }
3990 # @BlockdevRefOrNull:
3992 # Reference to a block device.
3994 # @definition: defines a new block device inline
3995 # @reference: references the ID of an existing block device.
3996 #             An empty string means that no block device should
3997 #             be referenced.  Deprecated; use null instead.
3998 # @null: No block device should be referenced (since 2.10)
4000 # Since: 2.9
4002 { 'alternate': 'BlockdevRefOrNull',
4003   'data': { 'definition': 'BlockdevOptions',
4004             'reference': 'str',
4005             'null': 'null' } }
4008 # @blockdev-add:
4010 # Creates a new block device. If the @id option is given at the top level, a
4011 # BlockBackend will be created; otherwise, @node-name is mandatory at the top
4012 # level and no BlockBackend will be created.
4014 # Since: 2.9
4016 # Example:
4018 # 1.
4019 # -> { "execute": "blockdev-add",
4020 #      "arguments": {
4021 #           "driver": "qcow2",
4022 #           "node-name": "test1",
4023 #           "file": {
4024 #               "driver": "file",
4025 #               "filename": "test.qcow2"
4026 #            }
4027 #       }
4028 #     }
4029 # <- { "return": {} }
4031 # 2.
4032 # -> { "execute": "blockdev-add",
4033 #      "arguments": {
4034 #           "driver": "qcow2",
4035 #           "node-name": "node0",
4036 #           "discard": "unmap",
4037 #           "cache": {
4038 #              "direct": true
4039 #            },
4040 #            "file": {
4041 #              "driver": "file",
4042 #              "filename": "/tmp/test.qcow2"
4043 #            },
4044 #            "backing": {
4045 #               "driver": "raw",
4046 #               "file": {
4047 #                  "driver": "file",
4048 #                  "filename": "/dev/fdset/4"
4049 #                }
4050 #            }
4051 #        }
4052 #      }
4054 # <- { "return": {} }
4057 { 'command': 'blockdev-add', 'data': 'BlockdevOptions', 'boxed': true }
4060 # @x-blockdev-reopen:
4062 # Reopens a block device using the given set of options. Any option
4063 # not specified will be reset to its default value regardless of its
4064 # previous status. If an option cannot be changed or a particular
4065 # driver does not support reopening then the command will return an
4066 # error.
4068 # The top-level @node-name option (from BlockdevOptions) must be
4069 # specified and is used to select the block device to be reopened.
4070 # Other @node-name options must be either omitted or set to the
4071 # current name of the appropriate node. This command won't change any
4072 # node name and any attempt to do it will result in an error.
4074 # In the case of options that refer to child nodes, the behavior of
4075 # this command depends on the value:
4077 #  1) A set of options (BlockdevOptions): the child is reopened with
4078 #     the specified set of options.
4080 #  2) A reference to the current child: the child is reopened using
4081 #     its existing set of options.
4083 #  3) A reference to a different node: the current child is replaced
4084 #     with the specified one.
4086 #  4) NULL: the current child (if any) is detached.
4088 # Options (1) and (2) are supported in all cases, but at the moment
4089 # only @backing allows replacing or detaching an existing child.
4091 # Unlike with blockdev-add, the @backing option must always be present
4092 # unless the node being reopened does not have a backing file and its
4093 # image does not have a default backing file name as part of its
4094 # metadata.
4096 # Since: 4.0
4098 { 'command': 'x-blockdev-reopen',
4099   'data': 'BlockdevOptions', 'boxed': true }
4102 # @blockdev-del:
4104 # Deletes a block device that has been added using blockdev-add.
4105 # The command will fail if the node is attached to a device or is
4106 # otherwise being used.
4108 # @node-name: Name of the graph node to delete.
4110 # Since: 2.9
4112 # Example:
4114 # -> { "execute": "blockdev-add",
4115 #      "arguments": {
4116 #           "driver": "qcow2",
4117 #           "node-name": "node0",
4118 #           "file": {
4119 #               "driver": "file",
4120 #               "filename": "test.qcow2"
4121 #           }
4122 #      }
4123 #    }
4124 # <- { "return": {} }
4126 # -> { "execute": "blockdev-del",
4127 #      "arguments": { "node-name": "node0" }
4128 #    }
4129 # <- { "return": {} }
4132 { 'command': 'blockdev-del', 'data': { 'node-name': 'str' } }
4135 # @BlockdevCreateOptionsFile:
4137 # Driver specific image creation options for file.
4139 # @filename: Filename for the new image file
4140 # @size: Size of the virtual disk in bytes
4141 # @preallocation: Preallocation mode for the new image (default: off;
4142 #                 allowed values: off,
4143 #                 falloc (if defined CONFIG_POSIX_FALLOCATE),
4144 #                 full (if defined CONFIG_POSIX))
4145 # @nocow: Turn off copy-on-write (valid only on btrfs; default: off)
4147 # Since: 2.12
4149 { 'struct': 'BlockdevCreateOptionsFile',
4150   'data': { 'filename':         'str',
4151             'size':             'size',
4152             '*preallocation':   'PreallocMode',
4153             '*nocow':           'bool' } }
4156 # @BlockdevCreateOptionsGluster:
4158 # Driver specific image creation options for gluster.
4160 # @location: Where to store the new image file
4161 # @size: Size of the virtual disk in bytes
4162 # @preallocation: Preallocation mode for the new image (default: off;
4163 #                 allowed values: off,
4164 #                 falloc (if defined CONFIG_GLUSTERFS_FALLOCATE),
4165 #                 full (if defined CONFIG_GLUSTERFS_ZEROFILL))
4167 # Since: 2.12
4169 { 'struct': 'BlockdevCreateOptionsGluster',
4170   'data': { 'location':         'BlockdevOptionsGluster',
4171             'size':             'size',
4172             '*preallocation':   'PreallocMode' } }
4175 # @BlockdevCreateOptionsLUKS:
4177 # Driver specific image creation options for LUKS.
4179 # @file: Node to create the image format on
4180 # @size: Size of the virtual disk in bytes
4181 # @preallocation: Preallocation mode for the new image
4182 #                 (since: 4.2)
4183 #                 (default: off; allowed values: off, metadata, falloc, full)
4185 # Since: 2.12
4187 { 'struct': 'BlockdevCreateOptionsLUKS',
4188   'base': 'QCryptoBlockCreateOptionsLUKS',
4189   'data': { 'file':             'BlockdevRef',
4190             'size':             'size',
4191             '*preallocation':   'PreallocMode' } }
4194 # @BlockdevCreateOptionsNfs:
4196 # Driver specific image creation options for NFS.
4198 # @location: Where to store the new image file
4199 # @size: Size of the virtual disk in bytes
4201 # Since: 2.12
4203 { 'struct': 'BlockdevCreateOptionsNfs',
4204   'data': { 'location':         'BlockdevOptionsNfs',
4205             'size':             'size' } }
4208 # @BlockdevCreateOptionsParallels:
4210 # Driver specific image creation options for parallels.
4212 # @file: Node to create the image format on
4213 # @size: Size of the virtual disk in bytes
4214 # @cluster-size: Cluster size in bytes (default: 1 MB)
4216 # Since: 2.12
4218 { 'struct': 'BlockdevCreateOptionsParallels',
4219   'data': { 'file':             'BlockdevRef',
4220             'size':             'size',
4221             '*cluster-size':    'size' } }
4224 # @BlockdevCreateOptionsQcow:
4226 # Driver specific image creation options for qcow.
4228 # @file: Node to create the image format on
4229 # @size: Size of the virtual disk in bytes
4230 # @backing-file: File name of the backing file if a backing file
4231 #                should be used
4232 # @encrypt: Encryption options if the image should be encrypted
4234 # Since: 2.12
4236 { 'struct': 'BlockdevCreateOptionsQcow',
4237   'data': { 'file':             'BlockdevRef',
4238             'size':             'size',
4239             '*backing-file':    'str',
4240             '*encrypt':         'QCryptoBlockCreateOptions' } }
4243 # @BlockdevQcow2Version:
4245 # @v2:  The original QCOW2 format as introduced in qemu 0.10 (version 2)
4246 # @v3:  The extended QCOW2 format as introduced in qemu 1.1 (version 3)
4248 # Since: 2.12
4250 { 'enum': 'BlockdevQcow2Version',
4251   'data': [ 'v2', 'v3' ] }
4255 # @BlockdevCreateOptionsQcow2:
4257 # Driver specific image creation options for qcow2.
4259 # @file: Node to create the image format on
4260 # @data-file: Node to use as an external data file in which all guest
4261 #             data is stored so that only metadata remains in the qcow2
4262 #             file (since: 4.0)
4263 # @data-file-raw: True if the external data file must stay valid as a
4264 #                 standalone (read-only) raw image without looking at qcow2
4265 #                 metadata (default: false; since: 4.0)
4266 # @size: Size of the virtual disk in bytes
4267 # @version: Compatibility level (default: v3)
4268 # @backing-file: File name of the backing file if a backing file
4269 #                should be used
4270 # @backing-fmt: Name of the block driver to use for the backing file
4271 # @encrypt: Encryption options if the image should be encrypted
4272 # @cluster-size: qcow2 cluster size in bytes (default: 65536)
4273 # @preallocation: Preallocation mode for the new image (default: off;
4274 #                 allowed values: off, falloc, full, metadata)
4275 # @lazy-refcounts: True if refcounts may be updated lazily (default: off)
4276 # @refcount-bits: Width of reference counts in bits (default: 16)
4278 # Since: 2.12
4280 { 'struct': 'BlockdevCreateOptionsQcow2',
4281   'data': { 'file':             'BlockdevRef',
4282             '*data-file':       'BlockdevRef',
4283             '*data-file-raw':   'bool',
4284             'size':             'size',
4285             '*version':         'BlockdevQcow2Version',
4286             '*backing-file':    'str',
4287             '*backing-fmt':     'BlockdevDriver',
4288             '*encrypt':         'QCryptoBlockCreateOptions',
4289             '*cluster-size':    'size',
4290             '*preallocation':   'PreallocMode',
4291             '*lazy-refcounts':  'bool',
4292             '*refcount-bits':   'int' } }
4295 # @BlockdevCreateOptionsQed:
4297 # Driver specific image creation options for qed.
4299 # @file: Node to create the image format on
4300 # @size: Size of the virtual disk in bytes
4301 # @backing-file: File name of the backing file if a backing file
4302 #                should be used
4303 # @backing-fmt: Name of the block driver to use for the backing file
4304 # @cluster-size: Cluster size in bytes (default: 65536)
4305 # @table-size: L1/L2 table size (in clusters)
4307 # Since: 2.12
4309 { 'struct': 'BlockdevCreateOptionsQed',
4310   'data': { 'file':             'BlockdevRef',
4311             'size':             'size',
4312             '*backing-file':    'str',
4313             '*backing-fmt':     'BlockdevDriver',
4314             '*cluster-size':    'size',
4315             '*table-size':      'int' } }
4318 # @BlockdevCreateOptionsRbd:
4320 # Driver specific image creation options for rbd/Ceph.
4322 # @location: Where to store the new image file. This location cannot
4323 #            point to a snapshot.
4324 # @size: Size of the virtual disk in bytes
4325 # @cluster-size: RBD object size
4327 # Since: 2.12
4329 { 'struct': 'BlockdevCreateOptionsRbd',
4330   'data': { 'location':         'BlockdevOptionsRbd',
4331             'size':             'size',
4332             '*cluster-size' :   'size' } }
4335 # @BlockdevVmdkSubformat:
4337 # Subformat options for VMDK images
4339 # @monolithicSparse:     Single file image with sparse cluster allocation
4341 # @monolithicFlat:       Single flat data image and a descriptor file
4343 # @twoGbMaxExtentSparse: Data is split into 2GB (per virtual LBA) sparse extent
4344 #                        files, in addition to a descriptor file
4346 # @twoGbMaxExtentFlat:   Data is split into 2GB (per virtual LBA) flat extent
4347 #                        files, in addition to a descriptor file
4349 # @streamOptimized:      Single file image sparse cluster allocation, optimized
4350 #                        for streaming over network.
4352 # Since: 4.0
4354 { 'enum': 'BlockdevVmdkSubformat',
4355   'data': [ 'monolithicSparse', 'monolithicFlat', 'twoGbMaxExtentSparse',
4356             'twoGbMaxExtentFlat', 'streamOptimized'] }
4359 # @BlockdevVmdkAdapterType:
4361 # Adapter type info for VMDK images
4363 # Since: 4.0
4365 { 'enum': 'BlockdevVmdkAdapterType',
4366   'data': [ 'ide', 'buslogic', 'lsilogic', 'legacyESX'] }
4369 # @BlockdevCreateOptionsVmdk:
4371 # Driver specific image creation options for VMDK.
4373 # @file: Where to store the new image file. This refers to the image
4374 #        file for monolithcSparse and streamOptimized format, or the
4375 #        descriptor file for other formats.
4376 # @size: Size of the virtual disk in bytes
4377 # @extents: Where to store the data extents. Required for monolithcFlat,
4378 #           twoGbMaxExtentSparse and twoGbMaxExtentFlat formats. For
4379 #           monolithicFlat, only one entry is required; for
4380 #           twoGbMaxExtent* formats, the number of entries required is
4381 #           calculated as extent_number = virtual_size / 2GB. Providing
4382 #           more extents than will be used is an error.
4383 # @subformat: The subformat of the VMDK image. Default: "monolithicSparse".
4384 # @backing-file: The path of backing file. Default: no backing file is used.
4385 # @adapter-type: The adapter type used to fill in the descriptor. Default: ide.
4386 # @hwversion: Hardware version. The meaningful options are "4" or "6".
4387 #             Default: "4".
4388 # @zeroed-grain: Whether to enable zeroed-grain feature for sparse subformats.
4389 #                Default: false.
4391 # Since: 4.0
4393 { 'struct': 'BlockdevCreateOptionsVmdk',
4394   'data': { 'file':             'BlockdevRef',
4395             'size':             'size',
4396             '*extents':          ['BlockdevRef'],
4397             '*subformat':       'BlockdevVmdkSubformat',
4398             '*backing-file':    'str',
4399             '*adapter-type':    'BlockdevVmdkAdapterType',
4400             '*hwversion':       'str',
4401             '*zeroed-grain':    'bool' } }
4405 # @SheepdogRedundancyType:
4407 # @full: Create a fully replicated vdi with x copies
4408 # @erasure-coded: Create an erasure coded vdi with x data strips and
4409 #                 y parity strips
4411 # Since: 2.12
4413 { 'enum': 'SheepdogRedundancyType',
4414   'data': [ 'full', 'erasure-coded' ] }
4417 # @SheepdogRedundancyFull:
4419 # @copies: Number of copies to use (between 1 and 31)
4421 # Since: 2.12
4423 { 'struct': 'SheepdogRedundancyFull',
4424   'data': { 'copies': 'int' }}
4427 # @SheepdogRedundancyErasureCoded:
4429 # @data-strips: Number of data strips to use (one of {2,4,8,16})
4430 # @parity-strips: Number of parity strips to use (between 1 and 15)
4432 # Since: 2.12
4434 { 'struct': 'SheepdogRedundancyErasureCoded',
4435   'data': { 'data-strips': 'int',
4436             'parity-strips': 'int' }}
4439 # @SheepdogRedundancy:
4441 # Since: 2.12
4443 { 'union': 'SheepdogRedundancy',
4444   'base': { 'type': 'SheepdogRedundancyType' },
4445   'discriminator': 'type',
4446   'data': { 'full': 'SheepdogRedundancyFull',
4447             'erasure-coded': 'SheepdogRedundancyErasureCoded' } }
4450 # @BlockdevCreateOptionsSheepdog:
4452 # Driver specific image creation options for Sheepdog.
4454 # @location: Where to store the new image file
4455 # @size: Size of the virtual disk in bytes
4456 # @backing-file: File name of a base image
4457 # @preallocation: Preallocation mode for the new image (default: off;
4458 #                 allowed values: off, full)
4459 # @redundancy: Redundancy of the image
4460 # @object-size: Object size of the image
4462 # Since: 2.12
4464 { 'struct': 'BlockdevCreateOptionsSheepdog',
4465   'data': { 'location':         'BlockdevOptionsSheepdog',
4466             'size':             'size',
4467             '*backing-file':    'str',
4468             '*preallocation':   'PreallocMode',
4469             '*redundancy':      'SheepdogRedundancy',
4470             '*object-size':     'size' } }
4473 # @BlockdevCreateOptionsSsh:
4475 # Driver specific image creation options for SSH.
4477 # @location: Where to store the new image file
4478 # @size: Size of the virtual disk in bytes
4480 # Since: 2.12
4482 { 'struct': 'BlockdevCreateOptionsSsh',
4483   'data': { 'location':         'BlockdevOptionsSsh',
4484             'size':             'size' } }
4487 # @BlockdevCreateOptionsVdi:
4489 # Driver specific image creation options for VDI.
4491 # @file: Node to create the image format on
4492 # @size: Size of the virtual disk in bytes
4493 # @preallocation: Preallocation mode for the new image (default: off;
4494 #                 allowed values: off, metadata)
4496 # Since: 2.12
4498 { 'struct': 'BlockdevCreateOptionsVdi',
4499   'data': { 'file':             'BlockdevRef',
4500             'size':             'size',
4501             '*preallocation':   'PreallocMode' } }
4504 # @BlockdevVhdxSubformat:
4506 # @dynamic: Growing image file
4507 # @fixed:   Preallocated fixed-size image file
4509 # Since: 2.12
4511 { 'enum': 'BlockdevVhdxSubformat',
4512   'data': [ 'dynamic', 'fixed' ] }
4515 # @BlockdevCreateOptionsVhdx:
4517 # Driver specific image creation options for vhdx.
4519 # @file: Node to create the image format on
4520 # @size: Size of the virtual disk in bytes
4521 # @log-size: Log size in bytes, must be a multiple of 1 MB
4522 #            (default: 1 MB)
4523 # @block-size: Block size in bytes, must be a multiple of 1 MB and not
4524 #              larger than 256 MB (default: automatically choose a block
4525 #              size depending on the image size)
4526 # @subformat: vhdx subformat (default: dynamic)
4527 # @block-state-zero: Force use of payload blocks of type 'ZERO'. Non-standard,
4528 #                    but default.  Do not set to 'off' when using 'qemu-img
4529 #                    convert' with subformat=dynamic.
4531 # Since: 2.12
4533 { 'struct': 'BlockdevCreateOptionsVhdx',
4534   'data': { 'file':                 'BlockdevRef',
4535             'size':                 'size',
4536             '*log-size':            'size',
4537             '*block-size':          'size',
4538             '*subformat':           'BlockdevVhdxSubformat',
4539             '*block-state-zero':    'bool' } }
4542 # @BlockdevVpcSubformat:
4544 # @dynamic: Growing image file
4545 # @fixed:   Preallocated fixed-size image file
4547 # Since: 2.12
4549 { 'enum': 'BlockdevVpcSubformat',
4550   'data': [ 'dynamic', 'fixed' ] }
4553 # @BlockdevCreateOptionsVpc:
4555 # Driver specific image creation options for vpc (VHD).
4557 # @file: Node to create the image format on
4558 # @size: Size of the virtual disk in bytes
4559 # @subformat: vhdx subformat (default: dynamic)
4560 # @force-size: Force use of the exact byte size instead of rounding to the
4561 #              next size that can be represented in CHS geometry
4562 #              (default: false)
4564 # Since: 2.12
4566 { 'struct': 'BlockdevCreateOptionsVpc',
4567   'data': { 'file':                 'BlockdevRef',
4568             'size':                 'size',
4569             '*subformat':           'BlockdevVpcSubformat',
4570             '*force-size':          'bool' } }
4573 # @BlockdevCreateOptions:
4575 # Options for creating an image format on a given node.
4577 # @driver: block driver to create the image format
4579 # Since: 2.12
4581 { 'union': 'BlockdevCreateOptions',
4582   'base': {
4583       'driver':         'BlockdevDriver' },
4584   'discriminator': 'driver',
4585   'data': {
4586       'file':           'BlockdevCreateOptionsFile',
4587       'gluster':        'BlockdevCreateOptionsGluster',
4588       'luks':           'BlockdevCreateOptionsLUKS',
4589       'nfs':            'BlockdevCreateOptionsNfs',
4590       'parallels':      'BlockdevCreateOptionsParallels',
4591       'qcow':           'BlockdevCreateOptionsQcow',
4592       'qcow2':          'BlockdevCreateOptionsQcow2',
4593       'qed':            'BlockdevCreateOptionsQed',
4594       'rbd':            'BlockdevCreateOptionsRbd',
4595       'sheepdog':       'BlockdevCreateOptionsSheepdog',
4596       'ssh':            'BlockdevCreateOptionsSsh',
4597       'vdi':            'BlockdevCreateOptionsVdi',
4598       'vhdx':           'BlockdevCreateOptionsVhdx',
4599       'vmdk':           'BlockdevCreateOptionsVmdk',
4600       'vpc':            'BlockdevCreateOptionsVpc'
4601   } }
4604 # @blockdev-create:
4606 # Starts a job to create an image format on a given node. The job is
4607 # automatically finalized, but a manual job-dismiss is required.
4609 # @job-id:          Identifier for the newly created job.
4611 # @options:         Options for the image creation.
4613 # Since: 3.0
4615 { 'command': 'blockdev-create',
4616   'data': { 'job-id': 'str',
4617             'options': 'BlockdevCreateOptions' } }
4620 # @BlockErrorAction:
4622 # An enumeration of action that has been taken when a DISK I/O occurs
4624 # @ignore: error has been ignored
4626 # @report: error has been reported to the device
4628 # @stop: error caused VM to be stopped
4630 # Since: 2.1
4632 { 'enum': 'BlockErrorAction',
4633   'data': [ 'ignore', 'report', 'stop' ] }
4637 # @BLOCK_IMAGE_CORRUPTED:
4639 # Emitted when a disk image is being marked corrupt. The image can be
4640 # identified by its device or node name. The 'device' field is always
4641 # present for compatibility reasons, but it can be empty ("") if the
4642 # image does not have a device name associated.
4644 # @device: device name. This is always present for compatibility
4645 #          reasons, but it can be empty ("") if the image does not
4646 #          have a device name associated.
4648 # @node-name: node name (Since: 2.4)
4650 # @msg: informative message for human consumption, such as the kind of
4651 #       corruption being detected. It should not be parsed by machine as it is
4652 #       not guaranteed to be stable
4654 # @offset: if the corruption resulted from an image access, this is
4655 #          the host's access offset into the image
4657 # @size: if the corruption resulted from an image access, this is
4658 #        the access size
4660 # @fatal: if set, the image is marked corrupt and therefore unusable after this
4661 #         event and must be repaired (Since 2.2; before, every
4662 #         BLOCK_IMAGE_CORRUPTED event was fatal)
4664 # Note: If action is "stop", a STOP event will eventually follow the
4665 #       BLOCK_IO_ERROR event.
4667 # Example:
4669 # <- { "event": "BLOCK_IMAGE_CORRUPTED",
4670 #      "data": { "device": "ide0-hd0", "node-name": "node0",
4671 #                "msg": "Prevented active L1 table overwrite", "offset": 196608,
4672 #                "size": 65536 },
4673 #      "timestamp": { "seconds": 1378126126, "microseconds": 966463 } }
4675 # Since: 1.7
4677 { 'event': 'BLOCK_IMAGE_CORRUPTED',
4678   'data': { 'device'     : 'str',
4679             '*node-name' : 'str',
4680             'msg'        : 'str',
4681             '*offset'    : 'int',
4682             '*size'      : 'int',
4683             'fatal'      : 'bool' } }
4686 # @BLOCK_IO_ERROR:
4688 # Emitted when a disk I/O error occurs
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. Note that errors may be reported for the root node
4695 #             that is directly attached to a guest device rather than for the
4696 #             node where the error occurred. The node name is not present if
4697 #             the drive is empty. (Since: 2.8)
4699 # @operation: I/O operation
4701 # @action: action that has been taken
4703 # @nospace: true if I/O error was caused due to a no-space
4704 #           condition. This key is only present if query-block's
4705 #           io-status is present, please see query-block documentation
4706 #           for more information (since: 2.2)
4708 # @reason: human readable string describing the error cause.
4709 #          (This field is a debugging aid for humans, it should not
4710 #          be parsed by applications) (since: 2.2)
4712 # Note: If action is "stop", a STOP event will eventually follow the
4713 #       BLOCK_IO_ERROR event
4715 # Since: 0.13.0
4717 # Example:
4719 # <- { "event": "BLOCK_IO_ERROR",
4720 #      "data": { "device": "ide0-hd1",
4721 #                "node-name": "#block212",
4722 #                "operation": "write",
4723 #                "action": "stop" },
4724 #      "timestamp": { "seconds": 1265044230, "microseconds": 450486 } }
4727 { 'event': 'BLOCK_IO_ERROR',
4728   'data': { 'device': 'str', '*node-name': 'str',
4729             'operation': 'IoOperationType',
4730             'action': 'BlockErrorAction', '*nospace': 'bool',
4731             'reason': 'str' } }
4734 # @BLOCK_JOB_COMPLETED:
4736 # Emitted when a block job has completed
4738 # @type: job type
4740 # @device: The job identifier. Originally the device name but other
4741 #          values are allowed since QEMU 2.7
4743 # @len: maximum progress value
4745 # @offset: current progress value. On success this is equal to len.
4746 #          On failure this is less than len
4748 # @speed: rate limit, bytes per second
4750 # @error: error message. Only present on failure. This field
4751 #         contains a human-readable error message. There are no semantics
4752 #         other than that streaming has failed and clients should not try to
4753 #         interpret the error string
4755 # Since: 1.1
4757 # Example:
4759 # <- { "event": "BLOCK_JOB_COMPLETED",
4760 #      "data": { "type": "stream", "device": "virtio-disk0",
4761 #                "len": 10737418240, "offset": 10737418240,
4762 #                "speed": 0 },
4763 #      "timestamp": { "seconds": 1267061043, "microseconds": 959568 } }
4766 { 'event': 'BLOCK_JOB_COMPLETED',
4767   'data': { 'type'  : 'JobType',
4768             'device': 'str',
4769             'len'   : 'int',
4770             'offset': 'int',
4771             'speed' : 'int',
4772             '*error': 'str' } }
4775 # @BLOCK_JOB_CANCELLED:
4777 # Emitted when a block job has been cancelled
4779 # @type: job type
4781 # @device: The job identifier. Originally the device name but other
4782 #          values are allowed since QEMU 2.7
4784 # @len: maximum progress value
4786 # @offset: current progress value. On success this is equal to len.
4787 #          On failure this is less than len
4789 # @speed: rate limit, bytes per second
4791 # Since: 1.1
4793 # Example:
4795 # <- { "event": "BLOCK_JOB_CANCELLED",
4796 #      "data": { "type": "stream", "device": "virtio-disk0",
4797 #                "len": 10737418240, "offset": 134217728,
4798 #                "speed": 0 },
4799 #      "timestamp": { "seconds": 1267061043, "microseconds": 959568 } }
4802 { 'event': 'BLOCK_JOB_CANCELLED',
4803   'data': { 'type'  : 'JobType',
4804             'device': 'str',
4805             'len'   : 'int',
4806             'offset': 'int',
4807             'speed' : 'int' } }
4810 # @BLOCK_JOB_ERROR:
4812 # Emitted when a block job encounters an error
4814 # @device: The job identifier. Originally the device name but other
4815 #          values are allowed since QEMU 2.7
4817 # @operation: I/O operation
4819 # @action: action that has been taken
4821 # Since: 1.3
4823 # Example:
4825 # <- { "event": "BLOCK_JOB_ERROR",
4826 #      "data": { "device": "ide0-hd1",
4827 #                "operation": "write",
4828 #                "action": "stop" },
4829 #      "timestamp": { "seconds": 1265044230, "microseconds": 450486 } }
4832 { 'event': 'BLOCK_JOB_ERROR',
4833   'data': { 'device'   : 'str',
4834             'operation': 'IoOperationType',
4835             'action'   : 'BlockErrorAction' } }
4838 # @BLOCK_JOB_READY:
4840 # Emitted when a block job is ready to complete
4842 # @type: job type
4844 # @device: The job identifier. Originally the device name but other
4845 #          values are allowed since QEMU 2.7
4847 # @len: maximum progress value
4849 # @offset: current progress value. On success this is equal to len.
4850 #          On failure this is less than len
4852 # @speed: rate limit, bytes per second
4854 # Note: The "ready to complete" status is always reset by a @BLOCK_JOB_ERROR
4855 #       event
4857 # Since: 1.3
4859 # Example:
4861 # <- { "event": "BLOCK_JOB_READY",
4862 #      "data": { "device": "drive0", "type": "mirror", "speed": 0,
4863 #                "len": 2097152, "offset": 2097152 }
4864 #      "timestamp": { "seconds": 1265044230, "microseconds": 450486 } }
4867 { 'event': 'BLOCK_JOB_READY',
4868   'data': { 'type'  : 'JobType',
4869             'device': 'str',
4870             'len'   : 'int',
4871             'offset': 'int',
4872             'speed' : 'int' } }
4875 # @BLOCK_JOB_PENDING:
4877 # Emitted when a block job is awaiting explicit authorization to finalize graph
4878 # changes via @block-job-finalize. If this job is part of a transaction, it will
4879 # not emit this event until the transaction has converged first.
4881 # @type: job type
4883 # @id: The job identifier.
4885 # Since: 2.12
4887 # Example:
4889 # <- { "event": "BLOCK_JOB_WAITING",
4890 #      "data": { "device": "drive0", "type": "mirror" },
4891 #      "timestamp": { "seconds": 1265044230, "microseconds": 450486 } }
4894 { 'event': 'BLOCK_JOB_PENDING',
4895   'data': { 'type'  : 'JobType',
4896             'id'    : 'str' } }
4899 # @PreallocMode:
4901 # Preallocation mode of QEMU image file
4903 # @off: no preallocation
4904 # @metadata: preallocate only for metadata
4905 # @falloc: like @full preallocation but allocate disk space by
4906 #          posix_fallocate() rather than writing data.
4907 # @full: preallocate all data by writing it to the device to ensure
4908 #        disk space is really available. This data may or may not be
4909 #        zero, depending on the image format and storage.
4910 #        @full preallocation also sets up metadata correctly.
4912 # Since: 2.2
4914 { 'enum': 'PreallocMode',
4915   'data': [ 'off', 'metadata', 'falloc', 'full' ] }
4918 # @BLOCK_WRITE_THRESHOLD:
4920 # Emitted when writes on block device reaches or exceeds the
4921 # configured write threshold. For thin-provisioned devices, this
4922 # means the device should be extended to avoid pausing for
4923 # disk exhaustion.
4924 # The event is one shot. Once triggered, it needs to be
4925 # re-registered with another block-set-write-threshold command.
4927 # @node-name: graph node name on which the threshold was exceeded.
4929 # @amount-exceeded: amount of data which exceeded the threshold, in bytes.
4931 # @write-threshold: last configured threshold, in bytes.
4933 # Since: 2.3
4935 { 'event': 'BLOCK_WRITE_THRESHOLD',
4936   'data': { 'node-name': 'str',
4937             'amount-exceeded': 'uint64',
4938             'write-threshold': 'uint64' } }
4941 # @block-set-write-threshold:
4943 # Change the write threshold for a block drive. An event will be
4944 # delivered if a write to this block drive crosses the configured
4945 # threshold.  The threshold is an offset, thus must be
4946 # non-negative. Default is no write threshold. Setting the threshold
4947 # to zero disables it.
4949 # This is useful to transparently resize thin-provisioned drives without
4950 # the guest OS noticing.
4952 # @node-name: graph node name on which the threshold must be set.
4954 # @write-threshold: configured threshold for the block device, bytes.
4955 #                   Use 0 to disable the threshold.
4957 # Since: 2.3
4959 # Example:
4961 # -> { "execute": "block-set-write-threshold",
4962 #      "arguments": { "node-name": "mydev",
4963 #                     "write-threshold": 17179869184 } }
4964 # <- { "return": {} }
4967 { 'command': 'block-set-write-threshold',
4968   'data': { 'node-name': 'str', 'write-threshold': 'uint64' } }
4971 # @x-blockdev-change:
4973 # Dynamically reconfigure the block driver state graph. It can be used
4974 # to add, remove, insert or replace a graph node. Currently only the
4975 # Quorum driver implements this feature to add or remove its child. This
4976 # is useful to fix a broken quorum child.
4978 # If @node is specified, it will be inserted under @parent. @child
4979 # may not be specified in this case. If both @parent and @child are
4980 # specified but @node is not, @child will be detached from @parent.
4982 # @parent: the id or name of the parent node.
4984 # @child: the name of a child under the given parent node.
4986 # @node: the name of the node that will be added.
4988 # Note: this command is experimental, and its API is not stable. It
4989 #       does not support all kinds of operations, all kinds of children, nor
4990 #       all block drivers.
4992 #       FIXME Removing children from a quorum node means introducing gaps in the
4993 #       child indices. This cannot be represented in the 'children' list of
4994 #       BlockdevOptionsQuorum, as returned by .bdrv_refresh_filename().
4996 #       Warning: The data in a new quorum child MUST be consistent with that of
4997 #       the rest of the array.
4999 # Since: 2.7
5001 # Example:
5003 # 1. Add a new node to a quorum
5004 # -> { "execute": "blockdev-add",
5005 #      "arguments": {
5006 #          "driver": "raw",
5007 #          "node-name": "new_node",
5008 #          "file": { "driver": "file",
5009 #                    "filename": "test.raw" } } }
5010 # <- { "return": {} }
5011 # -> { "execute": "x-blockdev-change",
5012 #      "arguments": { "parent": "disk1",
5013 #                     "node": "new_node" } }
5014 # <- { "return": {} }
5016 # 2. Delete a quorum's node
5017 # -> { "execute": "x-blockdev-change",
5018 #      "arguments": { "parent": "disk1",
5019 #                     "child": "children.1" } }
5020 # <- { "return": {} }
5023 { 'command': 'x-blockdev-change',
5024   'data' : { 'parent': 'str',
5025              '*child': 'str',
5026              '*node': 'str' } }
5029 # @x-blockdev-set-iothread:
5031 # Move @node and its children into the @iothread.  If @iothread is null then
5032 # move @node and its children into the main loop.
5034 # The node must not be attached to a BlockBackend.
5036 # @node-name: the name of the block driver node
5038 # @iothread: the name of the IOThread object or null for the main loop
5040 # @force: true if the node and its children should be moved when a BlockBackend
5041 #         is already attached
5043 # Note: this command is experimental and intended for test cases that need
5044 #       control over IOThreads only.
5046 # Since: 2.12
5048 # Example:
5050 # 1. Move a node into an IOThread
5051 # -> { "execute": "x-blockdev-set-iothread",
5052 #      "arguments": { "node-name": "disk1",
5053 #                     "iothread": "iothread0" } }
5054 # <- { "return": {} }
5056 # 2. Move a node into the main loop
5057 # -> { "execute": "x-blockdev-set-iothread",
5058 #      "arguments": { "node-name": "disk1",
5059 #                     "iothread": null } }
5060 # <- { "return": {} }
5063 { 'command': 'x-blockdev-set-iothread',
5064   'data' : { 'node-name': 'str',
5065              'iothread': 'StrOrNull',
5066              '*force': 'bool' } }
5069 # @NbdServerOptions:
5071 # @addr: Address on which to listen.
5072 # @tls-creds: ID of the TLS credentials object (since 2.6).
5073 # @tls-authz: ID of the QAuthZ authorization object used to validate
5074 #             the client's x509 distinguished name. This object is
5075 #             is only resolved at time of use, so can be deleted and
5076 #             recreated on the fly while the NBD server is active.
5077 #             If missing, it will default to denying access (since 4.0).
5079 # Keep this type consistent with the nbd-server-start arguments. The only
5080 # intended difference is using SocketAddress instead of SocketAddressLegacy.
5082 # Since: 4.2
5084 { 'struct': 'NbdServerOptions',
5085   'data': { 'addr': 'SocketAddress',
5086             '*tls-creds': 'str',
5087             '*tls-authz': 'str'} }
5090 # @nbd-server-start:
5092 # Start an NBD server listening on the given host and port.  Block
5093 # devices can then be exported using @nbd-server-add.  The NBD
5094 # server will present them as named exports; for example, another
5095 # QEMU instance could refer to them as "nbd:HOST:PORT:exportname=NAME".
5097 # @addr: Address on which to listen.
5098 # @tls-creds: ID of the TLS credentials object (since 2.6).
5099 # @tls-authz: ID of the QAuthZ authorization object used to validate
5100 #             the client's x509 distinguished name. This object is
5101 #             is only resolved at time of use, so can be deleted and
5102 #             recreated on the fly while the NBD server is active.
5103 #             If missing, it will default to denying access (since 4.0).
5105 # Returns: error if the server is already running.
5107 # Keep this type consistent with the NbdServerOptions type. The only intended
5108 # difference is using SocketAddressLegacy instead of SocketAddress.
5110 # Since: 1.3.0
5112 { 'command': 'nbd-server-start',
5113   'data': { 'addr': 'SocketAddressLegacy',
5114             '*tls-creds': 'str',
5115             '*tls-authz': 'str'} }
5118 # @BlockExportNbd:
5120 # An NBD block export.
5122 # @device: The device name or node name of the node to be exported
5124 # @name: Export name. If unspecified, the @device parameter is used as the
5125 #        export name. (Since 2.12)
5127 # @description: Free-form description of the export, up to 4096 bytes.
5128 #               (Since 5.0)
5130 # @writable: Whether clients should be able to write to the device via the
5131 #            NBD connection (default false).
5133 # @bitmap: Also export the dirty bitmap reachable from @device, so the
5134 #          NBD client can use NBD_OPT_SET_META_CONTEXT with
5135 #          "qemu:dirty-bitmap:NAME" to inspect the bitmap. (since 4.0)
5137 # Since: 5.0
5139 { 'struct': 'BlockExportNbd',
5140   'data': {'device': 'str', '*name': 'str', '*description': 'str',
5141            '*writable': 'bool', '*bitmap': 'str' } }
5144 # @nbd-server-add:
5146 # Export a block node to QEMU's embedded NBD server.
5148 # Returns: error if the server is not running, or export with the same name
5149 #          already exists.
5151 # Since: 1.3.0
5153 { 'command': 'nbd-server-add',
5154   'data': 'BlockExportNbd', 'boxed': true }
5157 # @NbdServerRemoveMode:
5159 # Mode for removing an NBD export.
5161 # @safe: Remove export if there are no existing connections, fail otherwise.
5163 # @hard: Drop all connections immediately and remove export.
5165 # Potential additional modes to be added in the future:
5167 # hide: Just hide export from new clients, leave existing connections as is.
5168 # Remove export after all clients are disconnected.
5170 # soft: Hide export from new clients, answer with ESHUTDOWN for all further
5171 # requests from existing clients.
5173 # Since: 2.12
5175 {'enum': 'NbdServerRemoveMode', 'data': ['safe', 'hard']}
5178 # @nbd-server-remove:
5180 # Remove NBD export by name.
5182 # @name: Export name.
5184 # @mode: Mode of command operation. See @NbdServerRemoveMode description.
5185 #        Default is 'safe'.
5187 # Returns: error if
5188 #            - the server is not running
5189 #            - export is not found
5190 #            - mode is 'safe' and there are existing connections
5192 # Since: 2.12
5194 { 'command': 'nbd-server-remove',
5195   'data': {'name': 'str', '*mode': 'NbdServerRemoveMode'} }
5198 # @nbd-server-stop:
5200 # Stop QEMU's embedded NBD server, and unregister all devices previously
5201 # added via @nbd-server-add.
5203 # Since: 1.3.0
5205 { 'command': 'nbd-server-stop' }
5208 # @BlockExportType:
5210 # An enumeration of block export types
5212 # @nbd: NBD export
5214 # Since: 4.2
5216 { 'enum': 'BlockExportType',
5217   'data': [ 'nbd' ] }
5220 # @BlockExport:
5222 # Describes a block export, i.e. how single node should be exported on an
5223 # external interface.
5225 # Since: 4.2
5227 { 'union': 'BlockExport',
5228   'base': { 'type': 'BlockExportType' },
5229   'discriminator': 'type',
5230   'data': {
5231       'nbd': 'BlockExportNbd'
5232    } }
5235 # @QuorumOpType:
5237 # An enumeration of the quorum operation types
5239 # @read: read operation
5241 # @write: write operation
5243 # @flush: flush operation
5245 # Since: 2.6
5247 { 'enum': 'QuorumOpType',
5248   'data': [ 'read', 'write', 'flush' ] }
5251 # @QUORUM_FAILURE:
5253 # Emitted by the Quorum block driver if it fails to establish a quorum
5255 # @reference: device name if defined else node name
5257 # @sector-num: number of the first sector of the failed read operation
5259 # @sectors-count: failed read operation sector count
5261 # Note: This event is rate-limited.
5263 # Since: 2.0
5265 # Example:
5267 # <- { "event": "QUORUM_FAILURE",
5268 #      "data": { "reference": "usr1", "sector-num": 345435, "sectors-count": 5 },
5269 #      "timestamp": { "seconds": 1344522075, "microseconds": 745528 } }
5272 { 'event': 'QUORUM_FAILURE',
5273   'data': { 'reference': 'str', 'sector-num': 'int', 'sectors-count': 'int' } }
5276 # @QUORUM_REPORT_BAD:
5278 # Emitted to report a corruption of a Quorum file
5280 # @type: quorum operation type (Since 2.6)
5282 # @error: error message. Only present on failure. This field
5283 #         contains a human-readable error message. There are no semantics other
5284 #         than that the block layer reported an error and clients should not
5285 #         try to interpret the error string.
5287 # @node-name: the graph node name of the block driver state
5289 # @sector-num: number of the first sector of the failed read operation
5291 # @sectors-count: failed read operation sector count
5293 # Note: This event is rate-limited.
5295 # Since: 2.0
5297 # Example:
5299 # 1. Read operation
5301 # { "event": "QUORUM_REPORT_BAD",
5302 #      "data": { "node-name": "node0", "sector-num": 345435, "sectors-count": 5,
5303 #                "type": "read" },
5304 #      "timestamp": { "seconds": 1344522075, "microseconds": 745528 } }
5306 # 2. Flush operation
5308 # { "event": "QUORUM_REPORT_BAD",
5309 #      "data": { "node-name": "node0", "sector-num": 0, "sectors-count": 2097120,
5310 #                "type": "flush", "error": "Broken pipe" },
5311 #      "timestamp": { "seconds": 1456406829, "microseconds": 291763 } }
5314 { 'event': 'QUORUM_REPORT_BAD',
5315   'data': { 'type': 'QuorumOpType', '*error': 'str', 'node-name': 'str',
5316             'sector-num': 'int', 'sectors-count': 'int' } }
5319 # @BlockdevSnapshotInternal:
5321 # @device: the device name or node-name of a root node to generate the snapshot
5322 #          from
5324 # @name: the name of the internal snapshot to be created
5326 # Notes: In transaction, if @name is empty, or any snapshot matching @name
5327 #        exists, the operation will fail. Only some image formats support it,
5328 #        for example, qcow2, rbd, and sheepdog.
5330 # Since: 1.7
5332 { 'struct': 'BlockdevSnapshotInternal',
5333   'data': { 'device': 'str', 'name': 'str' } }
5336 # @blockdev-snapshot-internal-sync:
5338 # Synchronously take an internal snapshot of a block device, when the
5339 # format of the image used supports it. If the name is an empty
5340 # string, or a snapshot with name already exists, the operation will
5341 # fail.
5343 # For the arguments, see the documentation of BlockdevSnapshotInternal.
5345 # Returns: - nothing on success
5346 #          - If @device is not a valid block device, GenericError
5347 #          - If any snapshot matching @name exists, or @name is empty,
5348 #            GenericError
5349 #          - If the format of the image used does not support it,
5350 #            BlockFormatFeatureNotSupported
5352 # Since: 1.7
5354 # Example:
5356 # -> { "execute": "blockdev-snapshot-internal-sync",
5357 #      "arguments": { "device": "ide-hd0",
5358 #                     "name": "snapshot0" }
5359 #    }
5360 # <- { "return": {} }
5363 { 'command': 'blockdev-snapshot-internal-sync',
5364   'data': 'BlockdevSnapshotInternal' }
5367 # @blockdev-snapshot-delete-internal-sync:
5369 # Synchronously delete an internal snapshot of a block device, when the format
5370 # of the image used support it. The snapshot is identified by name or id or
5371 # both. One of the name or id is required. Return SnapshotInfo for the
5372 # successfully deleted snapshot.
5374 # @device: the device name or node-name of a root node to delete the snapshot
5375 #          from
5377 # @id: optional the snapshot's ID to be deleted
5379 # @name: optional the snapshot's name to be deleted
5381 # Returns: - SnapshotInfo on success
5382 #          - If @device is not a valid block device, GenericError
5383 #          - If snapshot not found, GenericError
5384 #          - If the format of the image used does not support it,
5385 #            BlockFormatFeatureNotSupported
5386 #          - If @id and @name are both not specified, GenericError
5388 # Since: 1.7
5390 # Example:
5392 # -> { "execute": "blockdev-snapshot-delete-internal-sync",
5393 #      "arguments": { "device": "ide-hd0",
5394 #                     "name": "snapshot0" }
5395 #    }
5396 # <- { "return": {
5397 #                    "id": "1",
5398 #                    "name": "snapshot0",
5399 #                    "vm-state-size": 0,
5400 #                    "date-sec": 1000012,
5401 #                    "date-nsec": 10,
5402 #                    "vm-clock-sec": 100,
5403 #                    "vm-clock-nsec": 20
5404 #      }
5405 #    }
5408 { 'command': 'blockdev-snapshot-delete-internal-sync',
5409   'data': { 'device': 'str', '*id': 'str', '*name': 'str'},
5410   'returns': 'SnapshotInfo' }