block/crypto: implement blockdev-amend
[qemu/ar7.git] / qapi / block-core.json
blobcd679ad43574c65341a406bf37c18139c15bb6b4
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 # @compression-type: the image cluster compression method (since 5.1)
83 # Since: 1.7
85 { 'struct': 'ImageInfoSpecificQCow2',
86   'data': {
87       'compat': 'str',
88       '*data-file': 'str',
89       '*data-file-raw': 'bool',
90       '*lazy-refcounts': 'bool',
91       '*corrupt': 'bool',
92       'refcount-bits': 'int',
93       '*encrypt': 'ImageInfoSpecificQCow2Encryption',
94       '*bitmaps': ['Qcow2BitmapInfo'],
95       'compression-type': 'Qcow2CompressionType'
96   } }
99 # @ImageInfoSpecificVmdk:
101 # @create-type: The create type of VMDK image
103 # @cid: Content id of image
105 # @parent-cid: Parent VMDK image's cid
107 # @extents: List of extent files
109 # Since: 1.7
111 { 'struct': 'ImageInfoSpecificVmdk',
112   'data': {
113       'create-type': 'str',
114       'cid': 'int',
115       'parent-cid': 'int',
116       'extents': ['ImageInfo']
117   } }
120 # @ImageInfoSpecific:
122 # A discriminated record of image format specific information structures.
124 # Since: 1.7
126 { 'union': 'ImageInfoSpecific',
127   'data': {
128       'qcow2': 'ImageInfoSpecificQCow2',
129       'vmdk': 'ImageInfoSpecificVmdk',
130       # If we need to add block driver specific parameters for
131       # LUKS in future, then we'll subclass QCryptoBlockInfoLUKS
132       # to define a ImageInfoSpecificLUKS
133       'luks': 'QCryptoBlockInfoLUKS'
134   } }
137 # @ImageInfo:
139 # Information about a QEMU image file
141 # @filename: name of the image file
143 # @format: format of the image file
145 # @virtual-size: maximum capacity in bytes of the image
147 # @actual-size: actual size on disk in bytes of the image
149 # @dirty-flag: true if image is not cleanly closed
151 # @cluster-size: size of a cluster in bytes
153 # @encrypted: true if the image is encrypted
155 # @compressed: true if the image is compressed (Since 1.7)
157 # @backing-filename: name of the backing file
159 # @full-backing-filename: full path of the backing file
161 # @backing-filename-format: the format of the backing file
163 # @snapshots: list of VM snapshots
165 # @backing-image: info of the backing image (since 1.6)
167 # @format-specific: structure supplying additional format-specific
168 #                   information (since 1.7)
170 # Since: 1.3
173 { 'struct': 'ImageInfo',
174   'data': {'filename': 'str', 'format': 'str', '*dirty-flag': 'bool',
175            '*actual-size': 'int', 'virtual-size': 'int',
176            '*cluster-size': 'int', '*encrypted': 'bool', '*compressed': 'bool',
177            '*backing-filename': 'str', '*full-backing-filename': 'str',
178            '*backing-filename-format': 'str', '*snapshots': ['SnapshotInfo'],
179            '*backing-image': 'ImageInfo',
180            '*format-specific': 'ImageInfoSpecific' } }
183 # @ImageCheck:
185 # Information about a QEMU image file check
187 # @filename: name of the image file checked
189 # @format: format of the image file checked
191 # @check-errors: number of unexpected errors occurred during check
193 # @image-end-offset: offset (in bytes) where the image ends, this
194 #                    field is present if the driver for the image format
195 #                    supports it
197 # @corruptions: number of corruptions found during the check if any
199 # @leaks: number of leaks found during the check if any
201 # @corruptions-fixed: number of corruptions fixed during the check
202 #                     if any
204 # @leaks-fixed: number of leaks fixed during the check if any
206 # @total-clusters: total number of clusters, this field is present
207 #                  if the driver for the image format supports it
209 # @allocated-clusters: total number of allocated clusters, this
210 #                      field is present if the driver for the image format
211 #                      supports it
213 # @fragmented-clusters: total number of fragmented clusters, this
214 #                       field is present if the driver for the image format
215 #                       supports it
217 # @compressed-clusters: total number of compressed clusters, this
218 #                       field is present if the driver for the image format
219 #                       supports it
221 # Since: 1.4
224 { 'struct': 'ImageCheck',
225   'data': {'filename': 'str', 'format': 'str', 'check-errors': 'int',
226            '*image-end-offset': 'int', '*corruptions': 'int', '*leaks': 'int',
227            '*corruptions-fixed': 'int', '*leaks-fixed': 'int',
228            '*total-clusters': 'int', '*allocated-clusters': 'int',
229            '*fragmented-clusters': 'int', '*compressed-clusters': 'int' } }
232 # @MapEntry:
234 # Mapping information from a virtual block range to a host file range
236 # @start: the start byte of the mapped virtual range
238 # @length: the number of bytes of the mapped virtual range
240 # @data: whether the mapped range has data
242 # @zero: whether the virtual blocks are zeroed
244 # @depth: the depth of the mapping
246 # @offset: the offset in file that the virtual sectors are mapped to
248 # @filename: filename that is referred to by @offset
250 # Since: 2.6
253 { 'struct': 'MapEntry',
254   'data': {'start': 'int', 'length': 'int', 'data': 'bool',
255            'zero': 'bool', 'depth': 'int', '*offset': 'int',
256            '*filename': 'str' } }
259 # @BlockdevCacheInfo:
261 # Cache mode information for a block device
263 # @writeback:   true if writeback mode is enabled
264 # @direct:      true if the host page cache is bypassed (O_DIRECT)
265 # @no-flush:    true if flush requests are ignored for the device
267 # Since: 2.3
269 { 'struct': 'BlockdevCacheInfo',
270   'data': { 'writeback': 'bool',
271             'direct': 'bool',
272             'no-flush': 'bool' } }
275 # @BlockDeviceInfo:
277 # Information about the backing device for a block device.
279 # @file: the filename of the backing device
281 # @node-name: the name of the block driver node (Since 2.0)
283 # @ro: true if the backing device was open read-only
285 # @drv: the name of the block format used to open the backing device. As of
286 #       0.14.0 this can be: 'blkdebug', 'bochs', 'cloop', 'cow', 'dmg',
287 #       'file', 'file', 'ftp', 'ftps', 'host_cdrom', 'host_device',
288 #       'http', 'https', 'luks', 'nbd', 'parallels', 'qcow',
289 #       'qcow2', 'raw', 'vdi', 'vmdk', 'vpc', 'vvfat'
290 #       2.2: 'archipelago' added, 'cow' dropped
291 #       2.3: 'host_floppy' deprecated
292 #       2.5: 'host_floppy' dropped
293 #       2.6: 'luks' added
294 #       2.8: 'replication' added, 'tftp' dropped
295 #       2.9: 'archipelago' dropped
297 # @backing_file: the name of the backing file (for copy-on-write)
299 # @backing_file_depth: number of files in the backing file chain (since: 1.2)
301 # @encrypted: true if the backing device is encrypted
303 # @encryption_key_missing: always false
305 # @detect_zeroes: detect and optimize zero writes (Since 2.1)
307 # @bps: total throughput limit in bytes per second is specified
309 # @bps_rd: read throughput limit in bytes per second is specified
311 # @bps_wr: write throughput limit in bytes per second is specified
313 # @iops: total I/O operations per second is specified
315 # @iops_rd: read I/O operations per second is specified
317 # @iops_wr: write I/O operations per second is specified
319 # @image: the info of image used (since: 1.6)
321 # @bps_max: total throughput limit during bursts,
322 #                     in bytes (Since 1.7)
324 # @bps_rd_max: read throughput limit during bursts,
325 #                        in bytes (Since 1.7)
327 # @bps_wr_max: write throughput limit during bursts,
328 #                        in bytes (Since 1.7)
330 # @iops_max: total I/O operations per second during bursts,
331 #                      in bytes (Since 1.7)
333 # @iops_rd_max: read I/O operations per second during bursts,
334 #                         in bytes (Since 1.7)
336 # @iops_wr_max: write I/O operations per second during bursts,
337 #                         in bytes (Since 1.7)
339 # @bps_max_length: maximum length of the @bps_max burst
340 #                            period, in seconds. (Since 2.6)
342 # @bps_rd_max_length: maximum length of the @bps_rd_max
343 #                               burst period, in seconds. (Since 2.6)
345 # @bps_wr_max_length: maximum length of the @bps_wr_max
346 #                               burst period, in seconds. (Since 2.6)
348 # @iops_max_length: maximum length of the @iops burst
349 #                             period, in seconds. (Since 2.6)
351 # @iops_rd_max_length: maximum length of the @iops_rd_max
352 #                                burst period, in seconds. (Since 2.6)
354 # @iops_wr_max_length: maximum length of the @iops_wr_max
355 #                                burst period, in seconds. (Since 2.6)
357 # @iops_size: an I/O size in bytes (Since 1.7)
359 # @group: throttle group name (Since 2.4)
361 # @cache: the cache mode used for the block device (since: 2.3)
363 # @write_threshold: configured write threshold for the device.
364 #                   0 if disabled. (Since 2.3)
366 # @dirty-bitmaps: dirty bitmaps information (only present if node
367 #                 has one or more dirty bitmaps) (Since 4.2)
369 # Features:
370 # @deprecated: Member @encryption_key_missing is deprecated.  It is
371 #     always false.
373 # Since: 0.14.0
376 { 'struct': 'BlockDeviceInfo',
377   'data': { 'file': 'str', '*node-name': 'str', 'ro': 'bool', 'drv': 'str',
378             '*backing_file': 'str', 'backing_file_depth': 'int',
379             'encrypted': 'bool',
380             'encryption_key_missing': { 'type': 'bool',
381                                         'features': [ 'deprecated' ] },
382             'detect_zeroes': 'BlockdevDetectZeroesOptions',
383             'bps': 'int', 'bps_rd': 'int', 'bps_wr': 'int',
384             'iops': 'int', 'iops_rd': 'int', 'iops_wr': 'int',
385             'image': 'ImageInfo',
386             '*bps_max': 'int', '*bps_rd_max': 'int',
387             '*bps_wr_max': 'int', '*iops_max': 'int',
388             '*iops_rd_max': 'int', '*iops_wr_max': 'int',
389             '*bps_max_length': 'int', '*bps_rd_max_length': 'int',
390             '*bps_wr_max_length': 'int', '*iops_max_length': 'int',
391             '*iops_rd_max_length': 'int', '*iops_wr_max_length': 'int',
392             '*iops_size': 'int', '*group': 'str', 'cache': 'BlockdevCacheInfo',
393             'write_threshold': 'int', '*dirty-bitmaps': ['BlockDirtyInfo'] } }
396 # @BlockDeviceIoStatus:
398 # An enumeration of block device I/O status.
400 # @ok: The last I/O operation has succeeded
402 # @failed: The last I/O operation has failed
404 # @nospace: The last I/O operation has failed due to a no-space condition
406 # Since: 1.0
408 { 'enum': 'BlockDeviceIoStatus', 'data': [ 'ok', 'failed', 'nospace' ] }
411 # @BlockDeviceMapEntry:
413 # Entry in the metadata map of the device (returned by "qemu-img map")
415 # @start: Offset in the image of the first byte described by this entry
416 #         (in bytes)
418 # @length: Length of the range described by this entry (in bytes)
420 # @depth: Number of layers (0 = top image, 1 = top image's backing file, etc.)
421 #         before reaching one for which the range is allocated.  The value is
422 #         in the range 0 to the depth of the image chain - 1.
424 # @zero: the sectors in this range read as zeros
426 # @data: reading the image will actually read data from a file (in particular,
427 #        if @offset is present this means that the sectors are not simply
428 #        preallocated, but contain actual data in raw format)
430 # @offset: if present, the image file stores the data for this range in
431 #          raw format at the given offset.
433 # Since: 1.7
435 { 'struct': 'BlockDeviceMapEntry',
436   'data': { 'start': 'int', 'length': 'int', 'depth': 'int', 'zero': 'bool',
437             'data': 'bool', '*offset': 'int' } }
440 # @DirtyBitmapStatus:
442 # An enumeration of possible states that a dirty bitmap can report to the user.
444 # @frozen: The bitmap is currently in-use by some operation and is immutable.
445 #          If the bitmap was @active prior to the operation, new writes by the
446 #          guest are being recorded in a temporary buffer, and will not be lost.
447 #          Generally, bitmaps are cleared on successful use in an operation and
448 #          the temporary buffer is committed into the bitmap. On failure, the
449 #          temporary buffer is merged back into the bitmap without first
450 #          clearing it.
451 #          Please refer to the documentation for each bitmap-using operation,
452 #          See also @blockdev-backup, @drive-backup.
454 # @disabled: The bitmap is not currently recording new writes by the guest.
455 #            This is requested explicitly via @block-dirty-bitmap-disable.
456 #            It can still be cleared, deleted, or used for backup operations.
458 # @active: The bitmap is actively monitoring for new writes, and can be cleared,
459 #          deleted, or used for backup operations.
461 # @locked: The bitmap is currently in-use by some operation and is immutable.
462 #          If the bitmap was @active prior to the operation, it is still
463 #          recording new writes. If the bitmap was @disabled, it is not
464 #          recording new writes. (Since 2.12)
466 # @inconsistent: This is a persistent dirty bitmap that was marked in-use on
467 #                disk, and is unusable by QEMU. It can only be deleted.
468 #                Please rely on the inconsistent field in @BlockDirtyInfo
469 #                instead, as the status field is deprecated. (Since 4.0)
471 # Since: 2.4
473 { 'enum': 'DirtyBitmapStatus',
474   'data': ['active', 'disabled', 'frozen', 'locked', 'inconsistent'] }
477 # @BlockDirtyInfo:
479 # Block dirty bitmap information.
481 # @name: the name of the dirty bitmap (Since 2.4)
483 # @count: number of dirty bytes according to the dirty bitmap
485 # @granularity: granularity of the dirty bitmap in bytes (since 1.4)
487 # @status: current status of the dirty bitmap (since 2.4)
489 # @recording: true if the bitmap is recording new writes from the guest.
490 #             Replaces `active` and `disabled` statuses. (since 4.0)
492 # @busy: true if the bitmap is in-use by some operation (NBD or jobs)
493 #        and cannot be modified via QMP or used by another operation.
494 #        Replaces `locked` and `frozen` statuses. (since 4.0)
496 # @persistent: true if the bitmap was stored on disk, is scheduled to be stored
497 #              on disk, or both. (since 4.0)
499 # @inconsistent: true if this is a persistent bitmap that was improperly
500 #                stored. Implies @persistent to be true; @recording and
501 #                @busy to be false. This bitmap cannot be used. To remove
502 #                it, use @block-dirty-bitmap-remove. (Since 4.0)
504 # Features:
505 # @deprecated: Member @status is deprecated.  Use @recording and
506 #     @locked instead.
508 # Since: 1.3
510 { 'struct': 'BlockDirtyInfo',
511   'data': {'*name': 'str', 'count': 'int', 'granularity': 'uint32',
512            'recording': 'bool', 'busy': 'bool',
513            'status': { 'type': 'DirtyBitmapStatus',
514                        'features': [ 'deprecated' ] },
515            'persistent': 'bool', '*inconsistent': 'bool' } }
518 # @Qcow2BitmapInfoFlags:
520 # An enumeration of flags that a bitmap can report to the user.
522 # @in-use: This flag is set by any process actively modifying the qcow2 file,
523 #          and cleared when the updated bitmap is flushed to the qcow2 image.
524 #          The presence of this flag in an offline image means that the bitmap
525 #          was not saved correctly after its last usage, and may contain
526 #          inconsistent data.
528 # @auto: The bitmap must reflect all changes of the virtual disk by any
529 #        application that would write to this qcow2 file.
531 # Since: 4.0
533 { 'enum': 'Qcow2BitmapInfoFlags',
534   'data': ['in-use', 'auto'] }
537 # @Qcow2BitmapInfo:
539 # Qcow2 bitmap information.
541 # @name: the name of the bitmap
543 # @granularity: granularity of the bitmap in bytes
545 # @flags: flags of the bitmap
547 # Since: 4.0
549 { 'struct': 'Qcow2BitmapInfo',
550   'data': {'name': 'str', 'granularity': 'uint32',
551            'flags': ['Qcow2BitmapInfoFlags'] } }
554 # @BlockLatencyHistogramInfo:
556 # Block latency histogram.
558 # @boundaries: list of interval boundary values in nanoseconds, all greater
559 #              than zero and in ascending order.
560 #              For example, the list [10, 50, 100] produces the following
561 #              histogram intervals: [0, 10), [10, 50), [50, 100), [100, +inf).
563 # @bins: list of io request counts corresponding to histogram intervals.
564 #        len(@bins) = len(@boundaries) + 1
565 #        For the example above, @bins may be something like [3, 1, 5, 2],
566 #        and corresponding histogram looks like:
568 # |      5|           *
569 # |      4|           *
570 # |      3| *         *
571 # |      2| *         *    *
572 # |      1| *    *    *    *
573 # |       +------------------
574 # |           10   50   100
576 # Since: 4.0
578 { 'struct': 'BlockLatencyHistogramInfo',
579   'data': {'boundaries': ['uint64'], 'bins': ['uint64'] } }
582 # @BlockInfo:
584 # Block device information.  This structure describes a virtual device and
585 # the backing device associated with it.
587 # @device: The device name associated with the virtual device.
589 # @qdev: The qdev ID, or if no ID is assigned, the QOM path of the block
590 #        device. (since 2.10)
592 # @type: This field is returned only for compatibility reasons, it should
593 #        not be used (always returns 'unknown')
595 # @removable: True if the device supports removable media.
597 # @locked: True if the guest has locked this device from having its media
598 #          removed
600 # @tray_open: True if the device's tray is open
601 #             (only present if it has a tray)
603 # @dirty-bitmaps: dirty bitmaps information (only present if the
604 #                 driver has one or more dirty bitmaps) (Since 2.0)
606 # @io-status: @BlockDeviceIoStatus. Only present if the device
607 #             supports it and the VM is configured to stop on errors
608 #             (supported device models: virtio-blk, IDE, SCSI except
609 #             scsi-generic)
611 # @inserted: @BlockDeviceInfo describing the device if media is
612 #            present
614 # Features:
615 # @deprecated: Member @dirty-bitmaps is deprecated.  Use @inserted
616 #     member @dirty-bitmaps instead.
618 # Since:  0.14.0
620 { 'struct': 'BlockInfo',
621   'data': {'device': 'str', '*qdev': 'str', 'type': 'str', 'removable': 'bool',
622            'locked': 'bool', '*inserted': 'BlockDeviceInfo',
623            '*tray_open': 'bool', '*io-status': 'BlockDeviceIoStatus',
624            '*dirty-bitmaps': { 'type': ['BlockDirtyInfo'],
625                                'features': [ 'deprecated' ] } } }
628 # @BlockMeasureInfo:
630 # Image file size calculation information.  This structure describes the size
631 # requirements for creating a new image file.
633 # The size requirements depend on the new image file format.  File size always
634 # equals virtual disk size for the 'raw' format, even for sparse POSIX files.
635 # Compact formats such as 'qcow2' represent unallocated and zero regions
636 # efficiently so file size may be smaller than virtual disk size.
638 # The values are upper bounds that are guaranteed to fit the new image file.
639 # Subsequent modification, such as internal snapshot or further bitmap
640 # creation, may require additional space and is not covered here.
642 # @required: Size required for a new image file, in bytes, when copying just
643 #            allocated guest-visible contents.
645 # @fully-allocated: Image file size, in bytes, once data has been written
646 #                   to all sectors, when copying just guest-visible contents.
648 # @bitmaps: Additional size required if all the top-level bitmap metadata
649 #           in the source image were to be copied to the destination,
650 #           present only when source and destination both support
651 #           persistent bitmaps. (since 5.1)
653 # Since: 2.10
655 { 'struct': 'BlockMeasureInfo',
656   'data': {'required': 'int', 'fully-allocated': 'int', '*bitmaps': 'int'} }
659 # @query-block:
661 # Get a list of BlockInfo for all virtual block devices.
663 # Returns: a list of @BlockInfo describing each virtual block device. Filter
664 #          nodes that were created implicitly are skipped over.
666 # Since: 0.14.0
668 # Example:
670 # -> { "execute": "query-block" }
671 # <- {
672 #       "return":[
673 #          {
674 #             "io-status": "ok",
675 #             "device":"ide0-hd0",
676 #             "locked":false,
677 #             "removable":false,
678 #             "inserted":{
679 #                "ro":false,
680 #                "drv":"qcow2",
681 #                "encrypted":false,
682 #                "file":"disks/test.qcow2",
683 #                "backing_file_depth":1,
684 #                "bps":1000000,
685 #                "bps_rd":0,
686 #                "bps_wr":0,
687 #                "iops":1000000,
688 #                "iops_rd":0,
689 #                "iops_wr":0,
690 #                "bps_max": 8000000,
691 #                "bps_rd_max": 0,
692 #                "bps_wr_max": 0,
693 #                "iops_max": 0,
694 #                "iops_rd_max": 0,
695 #                "iops_wr_max": 0,
696 #                "iops_size": 0,
697 #                "detect_zeroes": "on",
698 #                "write_threshold": 0,
699 #                "image":{
700 #                   "filename":"disks/test.qcow2",
701 #                   "format":"qcow2",
702 #                   "virtual-size":2048000,
703 #                   "backing_file":"base.qcow2",
704 #                   "full-backing-filename":"disks/base.qcow2",
705 #                   "backing-filename-format":"qcow2",
706 #                   "snapshots":[
707 #                      {
708 #                         "id": "1",
709 #                         "name": "snapshot1",
710 #                         "vm-state-size": 0,
711 #                         "date-sec": 10000200,
712 #                         "date-nsec": 12,
713 #                         "vm-clock-sec": 206,
714 #                         "vm-clock-nsec": 30
715 #                      }
716 #                   ],
717 #                   "backing-image":{
718 #                       "filename":"disks/base.qcow2",
719 #                       "format":"qcow2",
720 #                       "virtual-size":2048000
721 #                   }
722 #                }
723 #             },
724 #             "qdev": "ide_disk",
725 #             "type":"unknown"
726 #          },
727 #          {
728 #             "io-status": "ok",
729 #             "device":"ide1-cd0",
730 #             "locked":false,
731 #             "removable":true,
732 #             "qdev": "/machine/unattached/device[23]",
733 #             "tray_open": false,
734 #             "type":"unknown"
735 #          },
736 #          {
737 #             "device":"floppy0",
738 #             "locked":false,
739 #             "removable":true,
740 #             "qdev": "/machine/unattached/device[20]",
741 #             "type":"unknown"
742 #          },
743 #          {
744 #             "device":"sd0",
745 #             "locked":false,
746 #             "removable":true,
747 #             "type":"unknown"
748 #          }
749 #       ]
750 #    }
753 { 'command': 'query-block', 'returns': ['BlockInfo'] }
757 # @BlockDeviceTimedStats:
759 # Statistics of a block device during a given interval of time.
761 # @interval_length: Interval used for calculating the statistics,
762 #                   in seconds.
764 # @min_rd_latency_ns: Minimum latency of read operations in the
765 #                     defined interval, in nanoseconds.
767 # @min_wr_latency_ns: Minimum latency of write operations in the
768 #                     defined interval, in nanoseconds.
770 # @min_flush_latency_ns: Minimum latency of flush operations in the
771 #                        defined interval, in nanoseconds.
773 # @max_rd_latency_ns: Maximum latency of read operations in the
774 #                     defined interval, in nanoseconds.
776 # @max_wr_latency_ns: Maximum latency of write operations in the
777 #                     defined interval, in nanoseconds.
779 # @max_flush_latency_ns: Maximum latency of flush operations in the
780 #                        defined interval, in nanoseconds.
782 # @avg_rd_latency_ns: Average latency of read operations in the
783 #                     defined interval, in nanoseconds.
785 # @avg_wr_latency_ns: Average latency of write operations in the
786 #                     defined interval, in nanoseconds.
788 # @avg_flush_latency_ns: Average latency of flush operations in the
789 #                        defined interval, in nanoseconds.
791 # @avg_rd_queue_depth: Average number of pending read operations
792 #                      in the defined interval.
794 # @avg_wr_queue_depth: Average number of pending write operations
795 #                      in the defined interval.
797 # Since: 2.5
799 { 'struct': 'BlockDeviceTimedStats',
800   'data': { 'interval_length': 'int', 'min_rd_latency_ns': 'int',
801             'max_rd_latency_ns': 'int', 'avg_rd_latency_ns': 'int',
802             'min_wr_latency_ns': 'int', 'max_wr_latency_ns': 'int',
803             'avg_wr_latency_ns': 'int', 'min_flush_latency_ns': 'int',
804             'max_flush_latency_ns': 'int', 'avg_flush_latency_ns': 'int',
805             'avg_rd_queue_depth': 'number', 'avg_wr_queue_depth': 'number' } }
808 # @BlockDeviceStats:
810 # Statistics of a virtual block device or a block backing device.
812 # @rd_bytes:      The number of bytes read by the device.
814 # @wr_bytes:      The number of bytes written by the device.
816 # @unmap_bytes: The number of bytes unmapped by the device (Since 4.2)
818 # @rd_operations: The number of read operations performed by the device.
820 # @wr_operations: The number of write operations performed by the device.
822 # @flush_operations: The number of cache flush operations performed by the
823 #                    device (since 0.15.0)
825 # @unmap_operations: The number of unmap operations performed by the device
826 #                    (Since 4.2)
828 # @rd_total_time_ns: Total time spent on reads in nanoseconds (since 0.15.0).
830 # @wr_total_time_ns: Total time spent on writes in nanoseconds (since 0.15.0).
832 # @flush_total_time_ns: Total time spent on cache flushes in nanoseconds
833 #                       (since 0.15.0).
835 # @unmap_total_time_ns: Total time spent on unmap operations in nanoseconds
836 #                       (Since 4.2)
838 # @wr_highest_offset: The offset after the greatest byte written to the
839 #                     device.  The intended use of this information is for
840 #                     growable sparse files (like qcow2) that are used on top
841 #                     of a physical device.
843 # @rd_merged: Number of read requests that have been merged into another
844 #             request (Since 2.3).
846 # @wr_merged: Number of write requests that have been merged into another
847 #             request (Since 2.3).
849 # @unmap_merged: Number of unmap requests that have been merged into another
850 #                request (Since 4.2)
852 # @idle_time_ns: Time since the last I/O operation, in
853 #                nanoseconds. If the field is absent it means that
854 #                there haven't been any operations yet (Since 2.5).
856 # @failed_rd_operations: The number of failed read operations
857 #                        performed by the device (Since 2.5)
859 # @failed_wr_operations: The number of failed write operations
860 #                        performed by the device (Since 2.5)
862 # @failed_flush_operations: The number of failed flush operations
863 #                           performed by the device (Since 2.5)
865 # @failed_unmap_operations: The number of failed unmap operations performed
866 #                           by the device (Since 4.2)
868 # @invalid_rd_operations: The number of invalid read operations
869 #                          performed by the device (Since 2.5)
871 # @invalid_wr_operations: The number of invalid write operations
872 #                         performed by the device (Since 2.5)
874 # @invalid_flush_operations: The number of invalid flush operations
875 #                            performed by the device (Since 2.5)
877 # @invalid_unmap_operations: The number of invalid unmap operations performed
878 #                            by the device (Since 4.2)
880 # @account_invalid: Whether invalid operations are included in the
881 #                   last access statistics (Since 2.5)
883 # @account_failed: Whether failed operations are included in the
884 #                  latency and last access statistics (Since 2.5)
886 # @timed_stats: Statistics specific to the set of previously defined
887 #               intervals of time (Since 2.5)
889 # @rd_latency_histogram: @BlockLatencyHistogramInfo. (Since 4.0)
891 # @wr_latency_histogram: @BlockLatencyHistogramInfo. (Since 4.0)
893 # @flush_latency_histogram: @BlockLatencyHistogramInfo. (Since 4.0)
895 # Since: 0.14.0
897 { 'struct': 'BlockDeviceStats',
898   'data': {'rd_bytes': 'int', 'wr_bytes': 'int', 'unmap_bytes' : 'int',
899            'rd_operations': 'int', 'wr_operations': 'int',
900            'flush_operations': 'int', 'unmap_operations': 'int',
901            'rd_total_time_ns': 'int', 'wr_total_time_ns': 'int',
902            'flush_total_time_ns': 'int', 'unmap_total_time_ns': 'int',
903            'wr_highest_offset': 'int',
904            'rd_merged': 'int', 'wr_merged': 'int', 'unmap_merged': 'int',
905            '*idle_time_ns': 'int',
906            'failed_rd_operations': 'int', 'failed_wr_operations': 'int',
907            'failed_flush_operations': 'int', 'failed_unmap_operations': 'int',
908            'invalid_rd_operations': 'int', 'invalid_wr_operations': 'int',
909            'invalid_flush_operations': 'int', 'invalid_unmap_operations': 'int',
910            'account_invalid': 'bool', 'account_failed': 'bool',
911            'timed_stats': ['BlockDeviceTimedStats'],
912            '*rd_latency_histogram': 'BlockLatencyHistogramInfo',
913            '*wr_latency_histogram': 'BlockLatencyHistogramInfo',
914            '*flush_latency_histogram': 'BlockLatencyHistogramInfo' } }
917 # @BlockStatsSpecificFile:
919 # File driver statistics
921 # @discard-nb-ok: The number of successful discard operations performed by
922 #                 the driver.
924 # @discard-nb-failed: The number of failed discard operations performed by
925 #                     the driver.
927 # @discard-bytes-ok: The number of bytes discarded by the driver.
929 # Since: 4.2
931 { 'struct': 'BlockStatsSpecificFile',
932   'data': {
933       'discard-nb-ok': 'uint64',
934       'discard-nb-failed': 'uint64',
935       'discard-bytes-ok': 'uint64' } }
938 # @BlockStatsSpecific:
940 # Block driver specific statistics
942 # Since: 4.2
944 { 'union': 'BlockStatsSpecific',
945   'base': { 'driver': 'BlockdevDriver' },
946   'discriminator': 'driver',
947   'data': {
948       'file': 'BlockStatsSpecificFile',
949       'host_device': 'BlockStatsSpecificFile' } }
952 # @BlockStats:
954 # Statistics of a virtual block device or a block backing device.
956 # @device: If the stats are for a virtual block device, the name
957 #          corresponding to the virtual block device.
959 # @node-name: The node name of the device. (Since 2.3)
961 # @qdev: The qdev ID, or if no ID is assigned, the QOM path of the block
962 #        device. (since 3.0)
964 # @stats:  A @BlockDeviceStats for the device.
966 # @driver-specific: Optional driver-specific stats. (Since 4.2)
968 # @parent: This describes the file block device if it has one.
969 #          Contains recursively the statistics of the underlying
970 #          protocol (e.g. the host file for a qcow2 image). If there is
971 #          no underlying protocol, this field is omitted
973 # @backing: This describes the backing block device if it has one.
974 #           (Since 2.0)
976 # Since: 0.14.0
978 { 'struct': 'BlockStats',
979   'data': {'*device': 'str', '*qdev': 'str', '*node-name': 'str',
980            'stats': 'BlockDeviceStats',
981            '*driver-specific': 'BlockStatsSpecific',
982            '*parent': 'BlockStats',
983            '*backing': 'BlockStats'} }
986 # @query-blockstats:
988 # Query the @BlockStats for all virtual block devices.
990 # @query-nodes: If true, the command will query all the block nodes
991 #               that have a node name, in a list which will include "parent"
992 #               information, but not "backing".
993 #               If false or omitted, the behavior is as before - query all the
994 #               device backends, recursively including their "parent" and
995 #               "backing". Filter nodes that were created implicitly are
996 #               skipped over in this mode. (Since 2.3)
998 # Returns: A list of @BlockStats for each virtual block devices.
1000 # Since: 0.14.0
1002 # Example:
1004 # -> { "execute": "query-blockstats" }
1005 # <- {
1006 #       "return":[
1007 #          {
1008 #             "device":"ide0-hd0",
1009 #             "parent":{
1010 #                "stats":{
1011 #                   "wr_highest_offset":3686448128,
1012 #                   "wr_bytes":9786368,
1013 #                   "wr_operations":751,
1014 #                   "rd_bytes":122567168,
1015 #                   "rd_operations":36772
1016 #                   "wr_total_times_ns":313253456
1017 #                   "rd_total_times_ns":3465673657
1018 #                   "flush_total_times_ns":49653
1019 #                   "flush_operations":61,
1020 #                   "rd_merged":0,
1021 #                   "wr_merged":0,
1022 #                   "idle_time_ns":2953431879,
1023 #                   "account_invalid":true,
1024 #                   "account_failed":false
1025 #                }
1026 #             },
1027 #             "stats":{
1028 #                "wr_highest_offset":2821110784,
1029 #                "wr_bytes":9786368,
1030 #                "wr_operations":692,
1031 #                "rd_bytes":122739200,
1032 #                "rd_operations":36604
1033 #                "flush_operations":51,
1034 #                "wr_total_times_ns":313253456
1035 #                "rd_total_times_ns":3465673657
1036 #                "flush_total_times_ns":49653,
1037 #                "rd_merged":0,
1038 #                "wr_merged":0,
1039 #                "idle_time_ns":2953431879,
1040 #                "account_invalid":true,
1041 #                "account_failed":false
1042 #             },
1043 #             "qdev": "/machine/unattached/device[23]"
1044 #          },
1045 #          {
1046 #             "device":"ide1-cd0",
1047 #             "stats":{
1048 #                "wr_highest_offset":0,
1049 #                "wr_bytes":0,
1050 #                "wr_operations":0,
1051 #                "rd_bytes":0,
1052 #                "rd_operations":0
1053 #                "flush_operations":0,
1054 #                "wr_total_times_ns":0
1055 #                "rd_total_times_ns":0
1056 #                "flush_total_times_ns":0,
1057 #                "rd_merged":0,
1058 #                "wr_merged":0,
1059 #                "account_invalid":false,
1060 #                "account_failed":false
1061 #             },
1062 #             "qdev": "/machine/unattached/device[24]"
1063 #          },
1064 #          {
1065 #             "device":"floppy0",
1066 #             "stats":{
1067 #                "wr_highest_offset":0,
1068 #                "wr_bytes":0,
1069 #                "wr_operations":0,
1070 #                "rd_bytes":0,
1071 #                "rd_operations":0
1072 #                "flush_operations":0,
1073 #                "wr_total_times_ns":0
1074 #                "rd_total_times_ns":0
1075 #                "flush_total_times_ns":0,
1076 #                "rd_merged":0,
1077 #                "wr_merged":0,
1078 #                "account_invalid":false,
1079 #                "account_failed":false
1080 #             },
1081 #             "qdev": "/machine/unattached/device[16]"
1082 #          },
1083 #          {
1084 #             "device":"sd0",
1085 #             "stats":{
1086 #                "wr_highest_offset":0,
1087 #                "wr_bytes":0,
1088 #                "wr_operations":0,
1089 #                "rd_bytes":0,
1090 #                "rd_operations":0
1091 #                "flush_operations":0,
1092 #                "wr_total_times_ns":0
1093 #                "rd_total_times_ns":0
1094 #                "flush_total_times_ns":0,
1095 #                "rd_merged":0,
1096 #                "wr_merged":0,
1097 #                "account_invalid":false,
1098 #                "account_failed":false
1099 #             }
1100 #          }
1101 #       ]
1102 #    }
1105 { 'command': 'query-blockstats',
1106   'data': { '*query-nodes': 'bool' },
1107   'returns': ['BlockStats'] }
1110 # @BlockdevOnError:
1112 # An enumeration of possible behaviors for errors on I/O operations.
1113 # The exact meaning depends on whether the I/O was initiated by a guest
1114 # or by a block job
1116 # @report: for guest operations, report the error to the guest;
1117 #          for jobs, cancel the job
1119 # @ignore: ignore the error, only report a QMP event (BLOCK_IO_ERROR
1120 #          or BLOCK_JOB_ERROR). The backup, mirror and commit block jobs retry
1121 #          the failing request later and may still complete successfully. The
1122 #          stream block job continues to stream and will complete with an
1123 #          error.
1125 # @enospc: same as @stop on ENOSPC, same as @report otherwise.
1127 # @stop: for guest operations, stop the virtual machine;
1128 #        for jobs, pause the job
1130 # @auto: inherit the error handling policy of the backend (since: 2.7)
1132 # Since: 1.3
1134 { 'enum': 'BlockdevOnError',
1135   'data': ['report', 'ignore', 'enospc', 'stop', 'auto'] }
1138 # @MirrorSyncMode:
1140 # An enumeration of possible behaviors for the initial synchronization
1141 # phase of storage mirroring.
1143 # @top: copies data in the topmost image to the destination
1145 # @full: copies data from all images to the destination
1147 # @none: only copy data written from now on
1149 # @incremental: only copy data described by the dirty bitmap. (since: 2.4)
1151 # @bitmap: only copy data described by the dirty bitmap. (since: 4.2)
1152 #          Behavior on completion is determined by the BitmapSyncMode.
1154 # Since: 1.3
1156 { 'enum': 'MirrorSyncMode',
1157   'data': ['top', 'full', 'none', 'incremental', 'bitmap'] }
1160 # @BitmapSyncMode:
1162 # An enumeration of possible behaviors for the synchronization of a bitmap
1163 # when used for data copy operations.
1165 # @on-success: The bitmap is only synced when the operation is successful.
1166 #              This is the behavior always used for 'INCREMENTAL' backups.
1168 # @never: The bitmap is never synchronized with the operation, and is
1169 #         treated solely as a read-only manifest of blocks to copy.
1171 # @always: The bitmap is always synchronized with the operation,
1172 #          regardless of whether or not the operation was successful.
1174 # Since: 4.2
1176 { 'enum': 'BitmapSyncMode',
1177   'data': ['on-success', 'never', 'always'] }
1180 # @MirrorCopyMode:
1182 # An enumeration whose values tell the mirror block job when to
1183 # trigger writes to the target.
1185 # @background: copy data in background only.
1187 # @write-blocking: when data is written to the source, write it
1188 #                  (synchronously) to the target as well.  In
1189 #                  addition, data is copied in background just like in
1190 #                  @background mode.
1192 # Since: 3.0
1194 { 'enum': 'MirrorCopyMode',
1195   'data': ['background', 'write-blocking'] }
1198 # @BlockJobInfo:
1200 # Information about a long-running block device operation.
1202 # @type: the job type ('stream' for image streaming)
1204 # @device: The job identifier. Originally the device name but other
1205 #          values are allowed since QEMU 2.7
1207 # @len: Estimated @offset value at the completion of the job. This value can
1208 #       arbitrarily change while the job is running, in both directions.
1210 # @offset: Progress made until now. The unit is arbitrary and the value can
1211 #          only meaningfully be used for the ratio of @offset to @len. The
1212 #          value is monotonically increasing.
1214 # @busy: false if the job is known to be in a quiescent state, with
1215 #        no pending I/O.  Since 1.3.
1217 # @paused: whether the job is paused or, if @busy is true, will
1218 #          pause itself as soon as possible.  Since 1.3.
1220 # @speed: the rate limit, bytes per second
1222 # @io-status: the status of the job (since 1.3)
1224 # @ready: true if the job may be completed (since 2.2)
1226 # @status: Current job state/status (since 2.12)
1228 # @auto-finalize: Job will finalize itself when PENDING, moving to
1229 #                 the CONCLUDED state. (since 2.12)
1231 # @auto-dismiss: Job will dismiss itself when CONCLUDED, moving to the NULL
1232 #                state and disappearing from the query list. (since 2.12)
1234 # @error: Error information if the job did not complete successfully.
1235 #         Not set if the job completed successfully. (since 2.12.1)
1237 # Since: 1.1
1239 { 'struct': 'BlockJobInfo',
1240   'data': {'type': 'str', 'device': 'str', 'len': 'int',
1241            'offset': 'int', 'busy': 'bool', 'paused': 'bool', 'speed': 'int',
1242            'io-status': 'BlockDeviceIoStatus', 'ready': 'bool',
1243            'status': 'JobStatus',
1244            'auto-finalize': 'bool', 'auto-dismiss': 'bool',
1245            '*error': 'str' } }
1248 # @query-block-jobs:
1250 # Return information about long-running block device operations.
1252 # Returns: a list of @BlockJobInfo for each active block job
1254 # Since: 1.1
1256 { 'command': 'query-block-jobs', 'returns': ['BlockJobInfo'] }
1259 # @block_passwd:
1261 # This command sets the password of a block device that has not been open
1262 # with a password and requires one.
1264 # This command is now obsolete and will always return an error since 2.10
1267 { 'command': 'block_passwd',
1268   'data': { '*device': 'str',
1269             '*node-name': 'str',
1270             'password': 'str' } }
1273 # @block_resize:
1275 # Resize a block image while a guest is running.
1277 # Either @device or @node-name must be set but not both.
1279 # @device: the name of the device to get the image resized
1281 # @node-name: graph node name to get the image resized (Since 2.0)
1283 # @size:  new image size in bytes
1285 # Returns: - nothing on success
1286 #          - If @device is not a valid block device, DeviceNotFound
1288 # Since: 0.14.0
1290 # Example:
1292 # -> { "execute": "block_resize",
1293 #      "arguments": { "device": "scratch", "size": 1073741824 } }
1294 # <- { "return": {} }
1297 { 'command': 'block_resize',
1298   'data': { '*device': 'str',
1299             '*node-name': 'str',
1300             'size': 'int' } }
1303 # @NewImageMode:
1305 # An enumeration that tells QEMU how to set the backing file path in
1306 # a new image file.
1308 # @existing: QEMU should look for an existing image file.
1310 # @absolute-paths: QEMU should create a new image with absolute paths
1311 #                  for the backing file. If there is no backing file available, the new
1312 #                  image will not be backed either.
1314 # Since: 1.1
1316 { 'enum': 'NewImageMode',
1317   'data': [ 'existing', 'absolute-paths' ] }
1320 # @BlockdevSnapshotSync:
1322 # Either @device or @node-name must be set but not both.
1324 # @device: the name of the device to take a snapshot of.
1326 # @node-name: graph node name to generate the snapshot from (Since 2.0)
1328 # @snapshot-file: the target of the new overlay image. If the file
1329 #                 exists, or if it is a device, the overlay will be created in the
1330 #                 existing file/device. Otherwise, a new file will be created.
1332 # @snapshot-node-name: the graph node name of the new image (Since 2.0)
1334 # @format: the format of the overlay image, default is 'qcow2'.
1336 # @mode: whether and how QEMU should create a new image, default is
1337 #        'absolute-paths'.
1339 { 'struct': 'BlockdevSnapshotSync',
1340   'data': { '*device': 'str', '*node-name': 'str',
1341             'snapshot-file': 'str', '*snapshot-node-name': 'str',
1342             '*format': 'str', '*mode': 'NewImageMode' } }
1345 # @BlockdevSnapshot:
1347 # @node: device or node name that will have a snapshot taken.
1349 # @overlay: reference to the existing block device that will become
1350 #           the overlay of @node, as part of taking the snapshot.
1351 #           It must not have a current backing file (this can be
1352 #           achieved by passing "backing": null to blockdev-add).
1354 # Since: 2.5
1356 { 'struct': 'BlockdevSnapshot',
1357   'data': { 'node': 'str', 'overlay': 'str' } }
1360 # @BackupCommon:
1362 # @job-id: identifier for the newly-created block job. If
1363 #          omitted, the device name will be used. (Since 2.7)
1365 # @device: the device name or node-name of a root node which should be copied.
1367 # @sync: what parts of the disk image should be copied to the destination
1368 #        (all the disk, only the sectors allocated in the topmost image, from a
1369 #        dirty bitmap, or only new I/O).
1371 # @speed: the maximum speed, in bytes per second. The default is 0,
1372 #         for unlimited.
1374 # @bitmap: The name of a dirty bitmap to use.
1375 #          Must be present if sync is "bitmap" or "incremental".
1376 #          Can be present if sync is "full" or "top".
1377 #          Must not be present otherwise.
1378 #          (Since 2.4 (drive-backup), 3.1 (blockdev-backup))
1380 # @bitmap-mode: Specifies the type of data the bitmap should contain after
1381 #               the operation concludes.
1382 #               Must be present if a bitmap was provided,
1383 #               Must NOT be present otherwise. (Since 4.2)
1385 # @compress: true to compress data, if the target format supports it.
1386 #            (default: false) (since 2.8)
1388 # @on-source-error: the action to take on an error on the source,
1389 #                   default 'report'.  'stop' and 'enospc' can only be used
1390 #                   if the block device supports io-status (see BlockInfo).
1392 # @on-target-error: the action to take on an error on the target,
1393 #                   default 'report' (no limitations, since this applies to
1394 #                   a different block device than @device).
1396 # @auto-finalize: When false, this job will wait in a PENDING state after it has
1397 #                 finished its work, waiting for @block-job-finalize before
1398 #                 making any block graph changes.
1399 #                 When true, this job will automatically
1400 #                 perform its abort or commit actions.
1401 #                 Defaults to true. (Since 2.12)
1403 # @auto-dismiss: When false, this job will wait in a CONCLUDED state after it
1404 #                has completely ceased all work, and awaits @block-job-dismiss.
1405 #                When true, this job will automatically disappear from the query
1406 #                list without user intervention.
1407 #                Defaults to true. (Since 2.12)
1409 # @filter-node-name: the node name that should be assigned to the
1410 #                    filter driver that the backup job inserts into the graph
1411 #                    above node specified by @drive. If this option is not given,
1412 #                    a node name is autogenerated. (Since: 4.2)
1414 # Note: @on-source-error and @on-target-error only affect background
1415 #       I/O.  If an error occurs during a guest write request, the device's
1416 #       rerror/werror actions will be used.
1418 # Since: 4.2
1420 { 'struct': 'BackupCommon',
1421   'data': { '*job-id': 'str', 'device': 'str',
1422             'sync': 'MirrorSyncMode', '*speed': 'int',
1423             '*bitmap': 'str', '*bitmap-mode': 'BitmapSyncMode',
1424             '*compress': 'bool',
1425             '*on-source-error': 'BlockdevOnError',
1426             '*on-target-error': 'BlockdevOnError',
1427             '*auto-finalize': 'bool', '*auto-dismiss': 'bool',
1428             '*filter-node-name': 'str' } }
1431 # @DriveBackup:
1433 # @target: the target of the new image. If the file exists, or if it
1434 #          is a device, the existing file/device will be used as the new
1435 #          destination.  If it does not exist, a new file will be created.
1437 # @format: the format of the new destination, default is to
1438 #          probe if @mode is 'existing', else the format of the source
1440 # @mode: whether and how QEMU should create a new image, default is
1441 #        'absolute-paths'.
1443 # Since: 1.6
1445 { 'struct': 'DriveBackup',
1446   'base': 'BackupCommon',
1447   'data': { 'target': 'str',
1448             '*format': 'str',
1449             '*mode': 'NewImageMode' } }
1452 # @BlockdevBackup:
1454 # @target: the device name or node-name of the backup target node.
1456 # Since: 2.3
1458 { 'struct': 'BlockdevBackup',
1459   'base': 'BackupCommon',
1460   'data': { 'target': 'str' } }
1463 # @blockdev-snapshot-sync:
1465 # Takes a synchronous snapshot of a block device.
1467 # For the arguments, see the documentation of BlockdevSnapshotSync.
1469 # Returns: - nothing on success
1470 #          - If @device is not a valid block device, DeviceNotFound
1472 # Since: 0.14.0
1474 # Example:
1476 # -> { "execute": "blockdev-snapshot-sync",
1477 #      "arguments": { "device": "ide-hd0",
1478 #                     "snapshot-file":
1479 #                     "/some/place/my-image",
1480 #                     "format": "qcow2" } }
1481 # <- { "return": {} }
1484 { 'command': 'blockdev-snapshot-sync',
1485   'data': 'BlockdevSnapshotSync' }
1489 # @blockdev-snapshot:
1491 # Takes a snapshot of a block device.
1493 # Take a snapshot, by installing 'node' as the backing image of
1494 # 'overlay'. Additionally, if 'node' is associated with a block
1495 # device, the block device changes to using 'overlay' as its new active
1496 # image.
1498 # For the arguments, see the documentation of BlockdevSnapshot.
1500 # Features:
1501 # @allow-write-only-overlay: If present, the check whether this operation is safe
1502 #                            was relaxed so that it can be used to change
1503 #                            backing file of a destination of a blockdev-mirror.
1504 #                            (since 5.0)
1506 # Since: 2.5
1508 # Example:
1510 # -> { "execute": "blockdev-add",
1511 #      "arguments": { "driver": "qcow2",
1512 #                     "node-name": "node1534",
1513 #                     "file": { "driver": "file",
1514 #                               "filename": "hd1.qcow2" },
1515 #                     "backing": null } }
1517 # <- { "return": {} }
1519 # -> { "execute": "blockdev-snapshot",
1520 #      "arguments": { "node": "ide-hd0",
1521 #                     "overlay": "node1534" } }
1522 # <- { "return": {} }
1525 { 'command': 'blockdev-snapshot',
1526   'data': 'BlockdevSnapshot',
1527   'features': [ 'allow-write-only-overlay' ] }
1530 # @change-backing-file:
1532 # Change the backing file in the image file metadata.  This does not
1533 # cause QEMU to reopen the image file to reparse the backing filename
1534 # (it may, however, perform a reopen to change permissions from
1535 # r/o -> r/w -> r/o, if needed). The new backing file string is written
1536 # into the image file metadata, and the QEMU internal strings are
1537 # updated.
1539 # @image-node-name: The name of the block driver state node of the
1540 #                   image to modify. The "device" argument is used
1541 #                   to verify "image-node-name" is in the chain
1542 #                   described by "device".
1544 # @device: The device name or node-name of the root node that owns
1545 #          image-node-name.
1547 # @backing-file: The string to write as the backing file.  This
1548 #                string is not validated, so care should be taken
1549 #                when specifying the string or the image chain may
1550 #                not be able to be reopened again.
1552 # Returns: - Nothing on success
1553 #          - If "device" does not exist or cannot be determined, DeviceNotFound
1555 # Since: 2.1
1557 { 'command': 'change-backing-file',
1558   'data': { 'device': 'str', 'image-node-name': 'str',
1559             'backing-file': 'str' } }
1562 # @block-commit:
1564 # Live commit of data from overlay image nodes into backing nodes - i.e.,
1565 # writes data between 'top' and 'base' into 'base'.
1567 # @job-id: identifier for the newly-created block job. If
1568 #          omitted, the device name will be used. (Since 2.7)
1570 # @device: the device name or node-name of a root node
1572 # @base-node: The node name of the backing image to write data into.
1573 #             If not specified, this is the deepest backing image.
1574 #             (since: 3.1)
1576 # @base: Same as @base-node, except that it is a file name rather than a node
1577 #        name. This must be the exact filename string that was used to open the
1578 #        node; other strings, even if addressing the same file, are not
1579 #        accepted
1581 # @top-node: The node name of the backing image within the image chain
1582 #            which contains the topmost data to be committed down. If
1583 #            not specified, this is the active layer. (since: 3.1)
1585 # @top: Same as @top-node, except that it is a file name rather than a node
1586 #       name. This must be the exact filename string that was used to open the
1587 #       node; other strings, even if addressing the same file, are not
1588 #       accepted
1590 # @backing-file: The backing file string to write into the overlay
1591 #                image of 'top'.  If 'top' is the active layer,
1592 #                specifying a backing file string is an error. This
1593 #                filename is not validated.
1595 #                If a pathname string is such that it cannot be
1596 #                resolved by QEMU, that means that subsequent QMP or
1597 #                HMP commands must use node-names for the image in
1598 #                question, as filename lookup methods will fail.
1600 #                If not specified, QEMU will automatically determine
1601 #                the backing file string to use, or error out if
1602 #                there is no obvious choice. Care should be taken
1603 #                when specifying the string, to specify a valid
1604 #                filename or protocol.
1605 #                (Since 2.1)
1607 #                If top == base, that is an error.
1608 #                If top == active, the job will not be completed by itself,
1609 #                user needs to complete the job with the block-job-complete
1610 #                command after getting the ready event. (Since 2.0)
1612 #                If the base image is smaller than top, then the base image
1613 #                will be resized to be the same size as top.  If top is
1614 #                smaller than the base image, the base will not be
1615 #                truncated.  If you want the base image size to match the
1616 #                size of the smaller top, you can safely truncate it
1617 #                yourself once the commit operation successfully completes.
1619 # @speed: the maximum speed, in bytes per second
1621 # @on-error: the action to take on an error. 'ignore' means that the request
1622 #            should be retried. (default: report; Since: 5.0)
1624 # @filter-node-name: the node name that should be assigned to the
1625 #                    filter driver that the commit job inserts into the graph
1626 #                    above @top. If this option is not given, a node name is
1627 #                    autogenerated. (Since: 2.9)
1629 # @auto-finalize: When false, this job will wait in a PENDING state after it has
1630 #                 finished its work, waiting for @block-job-finalize before
1631 #                 making any block graph changes.
1632 #                 When true, this job will automatically
1633 #                 perform its abort or commit actions.
1634 #                 Defaults to true. (Since 3.1)
1636 # @auto-dismiss: When false, this job will wait in a CONCLUDED state after it
1637 #                has completely ceased all work, and awaits @block-job-dismiss.
1638 #                When true, this job will automatically disappear from the query
1639 #                list without user intervention.
1640 #                Defaults to true. (Since 3.1)
1642 # Features:
1643 # @deprecated: Members @base and @top are deprecated.  Use @base-node
1644 #     and @top-node instead.
1646 # Returns: - Nothing on success
1647 #          - If @device does not exist, DeviceNotFound
1648 #          - Any other error returns a GenericError.
1650 # Since: 1.3
1652 # Example:
1654 # -> { "execute": "block-commit",
1655 #      "arguments": { "device": "virtio0",
1656 #                     "top": "/tmp/snap1.qcow2" } }
1657 # <- { "return": {} }
1660 { 'command': 'block-commit',
1661   'data': { '*job-id': 'str', 'device': 'str', '*base-node': 'str',
1662             '*base': { 'type': 'str', 'features': [ 'deprecated' ] },
1663             '*top-node': 'str',
1664             '*top': { 'type': 'str', 'features': [ 'deprecated' ] },
1665             '*backing-file': 'str', '*speed': 'int',
1666             '*on-error': 'BlockdevOnError',
1667             '*filter-node-name': 'str',
1668             '*auto-finalize': 'bool', '*auto-dismiss': 'bool' } }
1671 # @drive-backup:
1673 # Start a point-in-time copy of a block device to a new destination.  The
1674 # status of ongoing drive-backup operations can be checked with
1675 # query-block-jobs where the BlockJobInfo.type field has the value 'backup'.
1676 # The operation can be stopped before it has completed using the
1677 # block-job-cancel command.
1679 # Returns: - nothing on success
1680 #          - If @device is not a valid block device, GenericError
1682 # Since: 1.6
1684 # Example:
1686 # -> { "execute": "drive-backup",
1687 #      "arguments": { "device": "drive0",
1688 #                     "sync": "full",
1689 #                     "target": "backup.img" } }
1690 # <- { "return": {} }
1693 { 'command': 'drive-backup', 'boxed': true,
1694   'data': 'DriveBackup' }
1697 # @blockdev-backup:
1699 # Start a point-in-time copy of a block device to a new destination.  The
1700 # status of ongoing blockdev-backup operations can be checked with
1701 # query-block-jobs where the BlockJobInfo.type field has the value 'backup'.
1702 # The operation can be stopped before it has completed using the
1703 # block-job-cancel command.
1705 # Returns: - nothing on success
1706 #          - If @device is not a valid block device, DeviceNotFound
1708 # Since: 2.3
1710 # Example:
1711 # -> { "execute": "blockdev-backup",
1712 #      "arguments": { "device": "src-id",
1713 #                     "sync": "full",
1714 #                     "target": "tgt-id" } }
1715 # <- { "return": {} }
1718 { 'command': 'blockdev-backup', 'boxed': true,
1719   'data': 'BlockdevBackup' }
1723 # @query-named-block-nodes:
1725 # Get the named block driver list
1727 # @flat: Omit the nested data about backing image ("backing-image" key) if true.
1728 #        Default is false (Since 5.0)
1730 # Returns: the list of BlockDeviceInfo
1732 # Since: 2.0
1734 # Example:
1736 # -> { "execute": "query-named-block-nodes" }
1737 # <- { "return": [ { "ro":false,
1738 #                    "drv":"qcow2",
1739 #                    "encrypted":false,
1740 #                    "file":"disks/test.qcow2",
1741 #                    "node-name": "my-node",
1742 #                    "backing_file_depth":1,
1743 #                    "bps":1000000,
1744 #                    "bps_rd":0,
1745 #                    "bps_wr":0,
1746 #                    "iops":1000000,
1747 #                    "iops_rd":0,
1748 #                    "iops_wr":0,
1749 #                    "bps_max": 8000000,
1750 #                    "bps_rd_max": 0,
1751 #                    "bps_wr_max": 0,
1752 #                    "iops_max": 0,
1753 #                    "iops_rd_max": 0,
1754 #                    "iops_wr_max": 0,
1755 #                    "iops_size": 0,
1756 #                    "write_threshold": 0,
1757 #                    "image":{
1758 #                       "filename":"disks/test.qcow2",
1759 #                       "format":"qcow2",
1760 #                       "virtual-size":2048000,
1761 #                       "backing_file":"base.qcow2",
1762 #                       "full-backing-filename":"disks/base.qcow2",
1763 #                       "backing-filename-format":"qcow2",
1764 #                       "snapshots":[
1765 #                          {
1766 #                             "id": "1",
1767 #                             "name": "snapshot1",
1768 #                             "vm-state-size": 0,
1769 #                             "date-sec": 10000200,
1770 #                             "date-nsec": 12,
1771 #                             "vm-clock-sec": 206,
1772 #                             "vm-clock-nsec": 30
1773 #                          }
1774 #                       ],
1775 #                       "backing-image":{
1776 #                           "filename":"disks/base.qcow2",
1777 #                           "format":"qcow2",
1778 #                           "virtual-size":2048000
1779 #                       }
1780 #                    } } ] }
1783 { 'command': 'query-named-block-nodes',
1784   'returns': [ 'BlockDeviceInfo' ],
1785   'data': { '*flat': 'bool' } }
1788 # @XDbgBlockGraphNodeType:
1790 # @block-backend: corresponds to BlockBackend
1792 # @block-job: corresonds to BlockJob
1794 # @block-driver: corresponds to BlockDriverState
1796 # Since: 4.0
1798 { 'enum': 'XDbgBlockGraphNodeType',
1799   'data': [ 'block-backend', 'block-job', 'block-driver' ] }
1802 # @XDbgBlockGraphNode:
1804 # @id: Block graph node identifier. This @id is generated only for
1805 #      x-debug-query-block-graph and does not relate to any other identifiers in
1806 #      Qemu.
1808 # @type: Type of graph node. Can be one of block-backend, block-job or
1809 #        block-driver-state.
1811 # @name: Human readable name of the node. Corresponds to node-name for
1812 #        block-driver-state nodes; is not guaranteed to be unique in the whole
1813 #        graph (with block-jobs and block-backends).
1815 # Since: 4.0
1817 { 'struct': 'XDbgBlockGraphNode',
1818   'data': { 'id': 'uint64', 'type': 'XDbgBlockGraphNodeType', 'name': 'str' } }
1821 # @BlockPermission:
1823 # Enum of base block permissions.
1825 # @consistent-read: A user that has the "permission" of consistent reads is
1826 #                   guaranteed that their view of the contents of the block
1827 #                   device is complete and self-consistent, representing the
1828 #                   contents of a disk at a specific point.
1829 #                   For most block devices (including their backing files) this
1830 #                   is true, but the property cannot be maintained in a few
1831 #                   situations like for intermediate nodes of a commit block
1832 #                   job.
1834 # @write: This permission is required to change the visible disk contents.
1836 # @write-unchanged: This permission (which is weaker than BLK_PERM_WRITE) is
1837 #                   both enough and required for writes to the block node when
1838 #                   the caller promises that the visible disk content doesn't
1839 #                   change.
1840 #                   As the BLK_PERM_WRITE permission is strictly stronger,
1841 #                   either is sufficient to perform an unchanging write.
1843 # @resize: This permission is required to change the size of a block node.
1845 # @graph-mod: This permission is required to change the node that this
1846 #             BdrvChild points to.
1848 # Since: 4.0
1850   { 'enum': 'BlockPermission',
1851     'data': [ 'consistent-read', 'write', 'write-unchanged', 'resize',
1852               'graph-mod' ] }
1854 # @XDbgBlockGraphEdge:
1856 # Block Graph edge description for x-debug-query-block-graph.
1858 # @parent: parent id
1860 # @child: child id
1862 # @name: name of the relation (examples are 'file' and 'backing')
1864 # @perm: granted permissions for the parent operating on the child
1866 # @shared-perm: permissions that can still be granted to other users of the
1867 #               child while it is still attached to this parent
1869 # Since: 4.0
1871 { 'struct': 'XDbgBlockGraphEdge',
1872   'data': { 'parent': 'uint64', 'child': 'uint64',
1873             'name': 'str', 'perm': [ 'BlockPermission' ],
1874             'shared-perm': [ 'BlockPermission' ] } }
1877 # @XDbgBlockGraph:
1879 # Block Graph - list of nodes and list of edges.
1881 # Since: 4.0
1883 { 'struct': 'XDbgBlockGraph',
1884   'data': { 'nodes': ['XDbgBlockGraphNode'], 'edges': ['XDbgBlockGraphEdge'] } }
1887 # @x-debug-query-block-graph:
1889 # Get the block graph.
1891 # Since: 4.0
1893 { 'command': 'x-debug-query-block-graph', 'returns': 'XDbgBlockGraph' }
1896 # @drive-mirror:
1898 # Start mirroring a block device's writes to a new destination. target
1899 # specifies the target of the new image. If the file exists, or if it
1900 # is a device, it will be used as the new destination for writes. If
1901 # it does not exist, a new file will be created. format specifies the
1902 # format of the mirror image, default is to probe if mode='existing',
1903 # else the format of the source.
1905 # Returns: - nothing on success
1906 #          - If @device is not a valid block device, GenericError
1908 # Since: 1.3
1910 # Example:
1912 # -> { "execute": "drive-mirror",
1913 #      "arguments": { "device": "ide-hd0",
1914 #                     "target": "/some/place/my-image",
1915 #                     "sync": "full",
1916 #                     "format": "qcow2" } }
1917 # <- { "return": {} }
1920 { 'command': 'drive-mirror', 'boxed': true,
1921   'data': 'DriveMirror' }
1924 # @DriveMirror:
1926 # A set of parameters describing drive mirror setup.
1928 # @job-id: identifier for the newly-created block job. If
1929 #          omitted, the device name will be used. (Since 2.7)
1931 # @device:  the device name or node-name of a root node whose writes should be
1932 #           mirrored.
1934 # @target: the target of the new image. If the file exists, or if it
1935 #          is a device, the existing file/device will be used as the new
1936 #          destination.  If it does not exist, a new file will be created.
1938 # @format: the format of the new destination, default is to
1939 #          probe if @mode is 'existing', else the format of the source
1941 # @node-name: the new block driver state node name in the graph
1942 #             (Since 2.1)
1944 # @replaces: with sync=full graph node name to be replaced by the new
1945 #            image when a whole image copy is done. This can be used to repair
1946 #            broken Quorum files. (Since 2.1)
1948 # @mode: whether and how QEMU should create a new image, default is
1949 #        'absolute-paths'.
1951 # @speed:  the maximum speed, in bytes per second
1953 # @sync: what parts of the disk image should be copied to the destination
1954 #        (all the disk, only the sectors allocated in the topmost image, or
1955 #        only new I/O).
1957 # @granularity: granularity of the dirty bitmap, default is 64K
1958 #               if the image format doesn't have clusters, 4K if the clusters
1959 #               are smaller than that, else the cluster size.  Must be a
1960 #               power of 2 between 512 and 64M (since 1.4).
1962 # @buf-size: maximum amount of data in flight from source to
1963 #            target (since 1.4).
1965 # @on-source-error: the action to take on an error on the source,
1966 #                   default 'report'.  'stop' and 'enospc' can only be used
1967 #                   if the block device supports io-status (see BlockInfo).
1969 # @on-target-error: the action to take on an error on the target,
1970 #                   default 'report' (no limitations, since this applies to
1971 #                   a different block device than @device).
1972 # @unmap: Whether to try to unmap target sectors where source has
1973 #         only zero. If true, and target unallocated sectors will read as zero,
1974 #         target image sectors will be unmapped; otherwise, zeroes will be
1975 #         written. Both will result in identical contents.
1976 #         Default is true. (Since 2.4)
1978 # @copy-mode: when to copy data to the destination; defaults to 'background'
1979 #             (Since: 3.0)
1981 # @auto-finalize: When false, this job will wait in a PENDING state after it has
1982 #                 finished its work, waiting for @block-job-finalize before
1983 #                 making any block graph changes.
1984 #                 When true, this job will automatically
1985 #                 perform its abort or commit actions.
1986 #                 Defaults to true. (Since 3.1)
1988 # @auto-dismiss: When false, this job will wait in a CONCLUDED state after it
1989 #                has completely ceased all work, and awaits @block-job-dismiss.
1990 #                When true, this job will automatically disappear from the query
1991 #                list without user intervention.
1992 #                Defaults to true. (Since 3.1)
1993 # Since: 1.3
1995 { 'struct': 'DriveMirror',
1996   'data': { '*job-id': 'str', 'device': 'str', 'target': 'str',
1997             '*format': 'str', '*node-name': 'str', '*replaces': 'str',
1998             'sync': 'MirrorSyncMode', '*mode': 'NewImageMode',
1999             '*speed': 'int', '*granularity': 'uint32',
2000             '*buf-size': 'int', '*on-source-error': 'BlockdevOnError',
2001             '*on-target-error': 'BlockdevOnError',
2002             '*unmap': 'bool', '*copy-mode': 'MirrorCopyMode',
2003             '*auto-finalize': 'bool', '*auto-dismiss': 'bool' } }
2006 # @BlockDirtyBitmap:
2008 # @node: name of device/node which the bitmap is tracking
2010 # @name: name of the dirty bitmap
2012 # Since: 2.4
2014 { 'struct': 'BlockDirtyBitmap',
2015   'data': { 'node': 'str', 'name': 'str' } }
2018 # @BlockDirtyBitmapAdd:
2020 # @node: name of device/node which the bitmap is tracking
2022 # @name: name of the dirty bitmap (must be less than 1024 bytes)
2024 # @granularity: the bitmap granularity, default is 64k for
2025 #               block-dirty-bitmap-add
2027 # @persistent: the bitmap is persistent, i.e. it will be saved to the
2028 #              corresponding block device image file on its close. For now only
2029 #              Qcow2 disks support persistent bitmaps. Default is false for
2030 #              block-dirty-bitmap-add. (Since: 2.10)
2032 # @disabled: the bitmap is created in the disabled state, which means that
2033 #            it will not track drive changes. The bitmap may be enabled with
2034 #            block-dirty-bitmap-enable. Default is false. (Since: 4.0)
2036 # Since: 2.4
2038 { 'struct': 'BlockDirtyBitmapAdd',
2039   'data': { 'node': 'str', 'name': 'str', '*granularity': 'uint32',
2040             '*persistent': 'bool', '*disabled': 'bool' } }
2043 # @BlockDirtyBitmapMergeSource:
2045 # @local: name of the bitmap, attached to the same node as target bitmap.
2047 # @external: bitmap with specified node
2049 # Since: 4.1
2051 { 'alternate': 'BlockDirtyBitmapMergeSource',
2052   'data': { 'local': 'str',
2053             'external': 'BlockDirtyBitmap' } }
2056 # @BlockDirtyBitmapMerge:
2058 # @node: name of device/node which the @target bitmap is tracking
2060 # @target: name of the destination dirty bitmap
2062 # @bitmaps: name(s) of the source dirty bitmap(s) at @node and/or fully
2063 #           specifed BlockDirtyBitmap elements. The latter are supported
2064 #           since 4.1.
2066 # Since: 4.0
2068 { 'struct': 'BlockDirtyBitmapMerge',
2069   'data': { 'node': 'str', 'target': 'str',
2070             'bitmaps': ['BlockDirtyBitmapMergeSource'] } }
2073 # @block-dirty-bitmap-add:
2075 # Create a dirty bitmap with a name on the node, and start tracking the writes.
2077 # Returns: - nothing on success
2078 #          - If @node is not a valid block device or node, DeviceNotFound
2079 #          - If @name is already taken, GenericError with an explanation
2081 # Since: 2.4
2083 # Example:
2085 # -> { "execute": "block-dirty-bitmap-add",
2086 #      "arguments": { "node": "drive0", "name": "bitmap0" } }
2087 # <- { "return": {} }
2090 { 'command': 'block-dirty-bitmap-add',
2091   'data': 'BlockDirtyBitmapAdd' }
2094 # @block-dirty-bitmap-remove:
2096 # Stop write tracking and remove the dirty bitmap that was created
2097 # with block-dirty-bitmap-add. If the bitmap is persistent, remove it from its
2098 # storage too.
2100 # Returns: - nothing on success
2101 #          - If @node is not a valid block device or node, DeviceNotFound
2102 #          - If @name is not found, GenericError with an explanation
2103 #          - if @name is frozen by an operation, GenericError
2105 # Since: 2.4
2107 # Example:
2109 # -> { "execute": "block-dirty-bitmap-remove",
2110 #      "arguments": { "node": "drive0", "name": "bitmap0" } }
2111 # <- { "return": {} }
2114 { 'command': 'block-dirty-bitmap-remove',
2115   'data': 'BlockDirtyBitmap' }
2118 # @block-dirty-bitmap-clear:
2120 # Clear (reset) a dirty bitmap on the device, so that an incremental
2121 # backup from this point in time forward will only backup clusters
2122 # modified after this clear operation.
2124 # Returns: - nothing on success
2125 #          - If @node is not a valid block device, DeviceNotFound
2126 #          - If @name is not found, GenericError with an explanation
2128 # Since: 2.4
2130 # Example:
2132 # -> { "execute": "block-dirty-bitmap-clear",
2133 #      "arguments": { "node": "drive0", "name": "bitmap0" } }
2134 # <- { "return": {} }
2137 { 'command': 'block-dirty-bitmap-clear',
2138   'data': 'BlockDirtyBitmap' }
2141 # @block-dirty-bitmap-enable:
2143 # Enables a dirty bitmap so that it will begin tracking disk changes.
2145 # Returns: - nothing on success
2146 #          - If @node is not a valid block device, DeviceNotFound
2147 #          - If @name is not found, GenericError with an explanation
2149 # Since: 4.0
2151 # Example:
2153 # -> { "execute": "block-dirty-bitmap-enable",
2154 #      "arguments": { "node": "drive0", "name": "bitmap0" } }
2155 # <- { "return": {} }
2158   { 'command': 'block-dirty-bitmap-enable',
2159     'data': 'BlockDirtyBitmap' }
2162 # @block-dirty-bitmap-disable:
2164 # Disables a dirty bitmap so that it will stop tracking disk changes.
2166 # Returns: - nothing on success
2167 #          - If @node is not a valid block device, DeviceNotFound
2168 #          - If @name is not found, GenericError with an explanation
2170 # Since: 4.0
2172 # Example:
2174 # -> { "execute": "block-dirty-bitmap-disable",
2175 #      "arguments": { "node": "drive0", "name": "bitmap0" } }
2176 # <- { "return": {} }
2179     { 'command': 'block-dirty-bitmap-disable',
2180       'data': 'BlockDirtyBitmap' }
2183 # @block-dirty-bitmap-merge:
2185 # Merge dirty bitmaps listed in @bitmaps to the @target dirty bitmap.
2186 # Dirty bitmaps in @bitmaps will be unchanged, except if it also appears
2187 # as the @target bitmap. Any bits already set in @target will still be
2188 # set after the merge, i.e., this operation does not clear the target.
2189 # On error, @target is unchanged.
2191 # The resulting bitmap will count as dirty any clusters that were dirty in any
2192 # of the source bitmaps. This can be used to achieve backup checkpoints, or in
2193 # simpler usages, to copy bitmaps.
2195 # Returns: - nothing on success
2196 #          - If @node is not a valid block device, DeviceNotFound
2197 #          - If any bitmap in @bitmaps or @target is not found, GenericError
2198 #          - If any of the bitmaps have different sizes or granularities,
2199 #            GenericError
2201 # Since: 4.0
2203 # Example:
2205 # -> { "execute": "block-dirty-bitmap-merge",
2206 #      "arguments": { "node": "drive0", "target": "bitmap0",
2207 #                     "bitmaps": ["bitmap1"] } }
2208 # <- { "return": {} }
2211       { 'command': 'block-dirty-bitmap-merge',
2212         'data': 'BlockDirtyBitmapMerge' }
2215 # @BlockDirtyBitmapSha256:
2217 # SHA256 hash of dirty bitmap data
2219 # @sha256: ASCII representation of SHA256 bitmap hash
2221 # Since: 2.10
2223   { 'struct': 'BlockDirtyBitmapSha256',
2224     'data': {'sha256': 'str'} }
2227 # @x-debug-block-dirty-bitmap-sha256:
2229 # Get bitmap SHA256.
2231 # Returns: - BlockDirtyBitmapSha256 on success
2232 #          - If @node is not a valid block device, DeviceNotFound
2233 #          - If @name is not found or if hashing has failed, GenericError with an
2234 #            explanation
2236 # Since: 2.10
2238   { 'command': 'x-debug-block-dirty-bitmap-sha256',
2239     'data': 'BlockDirtyBitmap', 'returns': 'BlockDirtyBitmapSha256' }
2242 # @blockdev-mirror:
2244 # Start mirroring a block device's writes to a new destination.
2246 # @job-id: identifier for the newly-created block job. If
2247 #          omitted, the device name will be used. (Since 2.7)
2249 # @device: The device name or node-name of a root node whose writes should be
2250 #          mirrored.
2252 # @target: the id or node-name of the block device to mirror to. This mustn't be
2253 #          attached to guest.
2255 # @replaces: with sync=full graph node name to be replaced by the new
2256 #            image when a whole image copy is done. This can be used to repair
2257 #            broken Quorum files.
2259 # @speed:  the maximum speed, in bytes per second
2261 # @sync: what parts of the disk image should be copied to the destination
2262 #        (all the disk, only the sectors allocated in the topmost image, or
2263 #        only new I/O).
2265 # @granularity: granularity of the dirty bitmap, default is 64K
2266 #               if the image format doesn't have clusters, 4K if the clusters
2267 #               are smaller than that, else the cluster size.  Must be a
2268 #               power of 2 between 512 and 64M
2270 # @buf-size: maximum amount of data in flight from source to
2271 #            target
2273 # @on-source-error: the action to take on an error on the source,
2274 #                   default 'report'.  'stop' and 'enospc' can only be used
2275 #                   if the block device supports io-status (see BlockInfo).
2277 # @on-target-error: the action to take on an error on the target,
2278 #                   default 'report' (no limitations, since this applies to
2279 #                   a different block device than @device).
2281 # @filter-node-name: the node name that should be assigned to the
2282 #                    filter driver that the mirror job inserts into the graph
2283 #                    above @device. If this option is not given, a node name is
2284 #                    autogenerated. (Since: 2.9)
2286 # @copy-mode: when to copy data to the destination; defaults to 'background'
2287 #             (Since: 3.0)
2289 # @auto-finalize: When false, this job will wait in a PENDING state after it has
2290 #                 finished its work, waiting for @block-job-finalize before
2291 #                 making any block graph changes.
2292 #                 When true, this job will automatically
2293 #                 perform its abort or commit actions.
2294 #                 Defaults to true. (Since 3.1)
2296 # @auto-dismiss: When false, this job will wait in a CONCLUDED state after it
2297 #                has completely ceased all work, and awaits @block-job-dismiss.
2298 #                When true, this job will automatically disappear from the query
2299 #                list without user intervention.
2300 #                Defaults to true. (Since 3.1)
2301 # Returns: nothing on success.
2303 # Since: 2.6
2305 # Example:
2307 # -> { "execute": "blockdev-mirror",
2308 #      "arguments": { "device": "ide-hd0",
2309 #                     "target": "target0",
2310 #                     "sync": "full" } }
2311 # <- { "return": {} }
2314 { 'command': 'blockdev-mirror',
2315   'data': { '*job-id': 'str', 'device': 'str', 'target': 'str',
2316             '*replaces': 'str',
2317             'sync': 'MirrorSyncMode',
2318             '*speed': 'int', '*granularity': 'uint32',
2319             '*buf-size': 'int', '*on-source-error': 'BlockdevOnError',
2320             '*on-target-error': 'BlockdevOnError',
2321             '*filter-node-name': 'str',
2322             '*copy-mode': 'MirrorCopyMode',
2323             '*auto-finalize': 'bool', '*auto-dismiss': 'bool' } }
2326 # @BlockIOThrottle:
2328 # A set of parameters describing block throttling.
2330 # @device: Block device name
2332 # @id: The name or QOM path of the guest device (since: 2.8)
2334 # @bps: total throughput limit in bytes per second
2336 # @bps_rd: read throughput limit in bytes per second
2338 # @bps_wr: write throughput limit in bytes per second
2340 # @iops: total I/O operations per second
2342 # @iops_rd: read I/O operations per second
2344 # @iops_wr: write I/O operations per second
2346 # @bps_max: total throughput limit during bursts,
2347 #           in bytes (Since 1.7)
2349 # @bps_rd_max: read throughput limit during bursts,
2350 #              in bytes (Since 1.7)
2352 # @bps_wr_max: write throughput limit during bursts,
2353 #              in bytes (Since 1.7)
2355 # @iops_max: total I/O operations per second during bursts,
2356 #            in bytes (Since 1.7)
2358 # @iops_rd_max: read I/O operations per second during bursts,
2359 #               in bytes (Since 1.7)
2361 # @iops_wr_max: write I/O operations per second during bursts,
2362 #               in bytes (Since 1.7)
2364 # @bps_max_length: maximum length of the @bps_max burst
2365 #                  period, in seconds. It must only
2366 #                  be set if @bps_max is set as well.
2367 #                  Defaults to 1. (Since 2.6)
2369 # @bps_rd_max_length: maximum length of the @bps_rd_max
2370 #                     burst period, in seconds. It must only
2371 #                     be set if @bps_rd_max is set as well.
2372 #                     Defaults to 1. (Since 2.6)
2374 # @bps_wr_max_length: maximum length of the @bps_wr_max
2375 #                     burst period, in seconds. It must only
2376 #                     be set if @bps_wr_max is set as well.
2377 #                     Defaults to 1. (Since 2.6)
2379 # @iops_max_length: maximum length of the @iops burst
2380 #                   period, in seconds. It must only
2381 #                   be set if @iops_max is set as well.
2382 #                   Defaults to 1. (Since 2.6)
2384 # @iops_rd_max_length: maximum length of the @iops_rd_max
2385 #                      burst period, in seconds. It must only
2386 #                      be set if @iops_rd_max is set as well.
2387 #                      Defaults to 1. (Since 2.6)
2389 # @iops_wr_max_length: maximum length of the @iops_wr_max
2390 #                      burst period, in seconds. It must only
2391 #                      be set if @iops_wr_max is set as well.
2392 #                      Defaults to 1. (Since 2.6)
2394 # @iops_size: an I/O size in bytes (Since 1.7)
2396 # @group: throttle group name (Since 2.4)
2398 # Features:
2399 # @deprecated: Member @device is deprecated.  Use @id instead.
2401 # Since: 1.1
2403 { 'struct': 'BlockIOThrottle',
2404   'data': { '*device': { 'type': 'str', 'features': [ 'deprecated' ] },
2405             '*id': 'str', 'bps': 'int', 'bps_rd': 'int',
2406             'bps_wr': 'int', 'iops': 'int', 'iops_rd': 'int', 'iops_wr': 'int',
2407             '*bps_max': 'int', '*bps_rd_max': 'int',
2408             '*bps_wr_max': 'int', '*iops_max': 'int',
2409             '*iops_rd_max': 'int', '*iops_wr_max': 'int',
2410             '*bps_max_length': 'int', '*bps_rd_max_length': 'int',
2411             '*bps_wr_max_length': 'int', '*iops_max_length': 'int',
2412             '*iops_rd_max_length': 'int', '*iops_wr_max_length': 'int',
2413             '*iops_size': 'int', '*group': 'str' } }
2416 # @ThrottleLimits:
2418 # Limit parameters for throttling.
2419 # Since some limit combinations are illegal, limits should always be set in one
2420 # transaction. All fields are optional. When setting limits, if a field is
2421 # missing the current value is not changed.
2423 # @iops-total: limit total I/O operations per second
2424 # @iops-total-max: I/O operations burst
2425 # @iops-total-max-length: length of the iops-total-max burst period, in seconds
2426 #                         It must only be set if @iops-total-max is set as well.
2427 # @iops-read: limit read operations per second
2428 # @iops-read-max: I/O operations read burst
2429 # @iops-read-max-length: length of the iops-read-max burst period, in seconds
2430 #                        It must only be set if @iops-read-max is set as well.
2431 # @iops-write: limit write operations per second
2432 # @iops-write-max: I/O operations write burst
2433 # @iops-write-max-length: length of the iops-write-max burst period, in seconds
2434 #                         It must only be set if @iops-write-max is set as well.
2435 # @bps-total: limit total bytes per second
2436 # @bps-total-max: total bytes burst
2437 # @bps-total-max-length: length of the bps-total-max burst period, in seconds.
2438 #                        It must only be set if @bps-total-max is set as well.
2439 # @bps-read: limit read bytes per second
2440 # @bps-read-max: total bytes read burst
2441 # @bps-read-max-length: length of the bps-read-max burst period, in seconds
2442 #                       It must only be set if @bps-read-max is set as well.
2443 # @bps-write: limit write bytes per second
2444 # @bps-write-max: total bytes write burst
2445 # @bps-write-max-length: length of the bps-write-max burst period, in seconds
2446 #                        It must only be set if @bps-write-max is set as well.
2447 # @iops-size: when limiting by iops max size of an I/O in bytes
2449 # Since: 2.11
2451 { 'struct': 'ThrottleLimits',
2452   'data': { '*iops-total' : 'int', '*iops-total-max' : 'int',
2453             '*iops-total-max-length' : 'int', '*iops-read' : 'int',
2454             '*iops-read-max' : 'int', '*iops-read-max-length' : 'int',
2455             '*iops-write' : 'int', '*iops-write-max' : 'int',
2456             '*iops-write-max-length' : 'int', '*bps-total' : 'int',
2457             '*bps-total-max' : 'int', '*bps-total-max-length' : 'int',
2458             '*bps-read' : 'int', '*bps-read-max' : 'int',
2459             '*bps-read-max-length' : 'int', '*bps-write' : 'int',
2460             '*bps-write-max' : 'int', '*bps-write-max-length' : 'int',
2461             '*iops-size' : 'int' } }
2464 # @block-stream:
2466 # Copy data from a backing file into a block device.
2468 # The block streaming operation is performed in the background until the entire
2469 # backing file has been copied.  This command returns immediately once streaming
2470 # has started.  The status of ongoing block streaming operations can be checked
2471 # with query-block-jobs.  The operation can be stopped before it has completed
2472 # using the block-job-cancel command.
2474 # The node that receives the data is called the top image, can be located in
2475 # any part of the chain (but always above the base image; see below) and can be
2476 # specified using its device or node name. Earlier qemu versions only allowed
2477 # 'device' to name the top level node; presence of the 'base-node' parameter
2478 # during introspection can be used as a witness of the enhanced semantics
2479 # of 'device'.
2481 # If a base file is specified then sectors are not copied from that base file and
2482 # its backing chain.  When streaming completes the image file will have the base
2483 # file as its backing file.  This can be used to stream a subset of the backing
2484 # file chain instead of flattening the entire image.
2486 # On successful completion the image file is updated to drop the backing file
2487 # and the BLOCK_JOB_COMPLETED event is emitted.
2489 # @job-id: identifier for the newly-created block job. If
2490 #          omitted, the device name will be used. (Since 2.7)
2492 # @device: the device or node name of the top image
2494 # @base: the common backing file name.
2495 #        It cannot be set if @base-node is also set.
2497 # @base-node: the node name of the backing file.
2498 #             It cannot be set if @base is also set. (Since 2.8)
2500 # @backing-file: The backing file string to write into the top
2501 #                image. This filename is not validated.
2503 #                If a pathname string is such that it cannot be
2504 #                resolved by QEMU, that means that subsequent QMP or
2505 #                HMP commands must use node-names for the image in
2506 #                question, as filename lookup methods will fail.
2508 #                If not specified, QEMU will automatically determine
2509 #                the backing file string to use, or error out if there
2510 #                is no obvious choice.  Care should be taken when
2511 #                specifying the string, to specify a valid filename or
2512 #                protocol.
2513 #                (Since 2.1)
2515 # @speed: the maximum speed, in bytes per second
2517 # @on-error: the action to take on an error (default report).
2518 #            'stop' and 'enospc' can only be used if the block device
2519 #            supports io-status (see BlockInfo).  Since 1.3.
2521 # @auto-finalize: When false, this job will wait in a PENDING state after it has
2522 #                 finished its work, waiting for @block-job-finalize before
2523 #                 making any block graph changes.
2524 #                 When true, this job will automatically
2525 #                 perform its abort or commit actions.
2526 #                 Defaults to true. (Since 3.1)
2528 # @auto-dismiss: When false, this job will wait in a CONCLUDED state after it
2529 #                has completely ceased all work, and awaits @block-job-dismiss.
2530 #                When true, this job will automatically disappear from the query
2531 #                list without user intervention.
2532 #                Defaults to true. (Since 3.1)
2534 # Returns: - Nothing on success.
2535 #          - If @device does not exist, DeviceNotFound.
2537 # Since: 1.1
2539 # Example:
2541 # -> { "execute": "block-stream",
2542 #      "arguments": { "device": "virtio0",
2543 #                     "base": "/tmp/master.qcow2" } }
2544 # <- { "return": {} }
2547 { 'command': 'block-stream',
2548   'data': { '*job-id': 'str', 'device': 'str', '*base': 'str',
2549             '*base-node': 'str', '*backing-file': 'str', '*speed': 'int',
2550             '*on-error': 'BlockdevOnError',
2551             '*auto-finalize': 'bool', '*auto-dismiss': 'bool' } }
2554 # @block-job-set-speed:
2556 # Set maximum speed for a background block operation.
2558 # This command can only be issued when there is an active block job.
2560 # Throttling can be disabled by setting the speed to 0.
2562 # @device: The job identifier. This used to be a device name (hence
2563 #          the name of the parameter), but since QEMU 2.7 it can have
2564 #          other values.
2566 # @speed: the maximum speed, in bytes per second, or 0 for unlimited.
2567 #         Defaults to 0.
2569 # Returns: - Nothing on success
2570 #          - If no background operation is active on this device, DeviceNotActive
2572 # Since: 1.1
2574 { 'command': 'block-job-set-speed',
2575   'data': { 'device': 'str', 'speed': 'int' } }
2578 # @block-job-cancel:
2580 # Stop an active background block operation.
2582 # This command returns immediately after marking the active background block
2583 # operation for cancellation.  It is an error to call this command if no
2584 # operation is in progress.
2586 # The operation will cancel as soon as possible and then emit the
2587 # BLOCK_JOB_CANCELLED event.  Before that happens the job is still visible when
2588 # enumerated using query-block-jobs.
2590 # Note that if you issue 'block-job-cancel' after 'drive-mirror' has indicated
2591 # (via the event BLOCK_JOB_READY) that the source and destination are
2592 # synchronized, then the event triggered by this command changes to
2593 # BLOCK_JOB_COMPLETED, to indicate that the mirroring has ended and the
2594 # destination now has a point-in-time copy tied to the time of the cancellation.
2596 # For streaming, the image file retains its backing file unless the streaming
2597 # operation happens to complete just as it is being cancelled.  A new streaming
2598 # operation can be started at a later time to finish copying all data from the
2599 # backing file.
2601 # @device: The job identifier. This used to be a device name (hence
2602 #          the name of the parameter), but since QEMU 2.7 it can have
2603 #          other values.
2605 # @force: If true, and the job has already emitted the event BLOCK_JOB_READY,
2606 #         abandon the job immediately (even if it is paused) instead of waiting
2607 #         for the destination to complete its final synchronization (since 1.3)
2609 # Returns: - Nothing on success
2610 #          - If no background operation is active on this device, DeviceNotActive
2612 # Since: 1.1
2614 { 'command': 'block-job-cancel', 'data': { 'device': 'str', '*force': 'bool' } }
2617 # @block-job-pause:
2619 # Pause an active background block operation.
2621 # This command returns immediately after marking the active background block
2622 # operation for pausing.  It is an error to call this command if no
2623 # operation is in progress or if the job is already paused.
2625 # The operation will pause as soon as possible.  No event is emitted when
2626 # the operation is actually paused.  Cancelling a paused job automatically
2627 # resumes it.
2629 # @device: The job identifier. This used to be a device name (hence
2630 #          the name of the parameter), but since QEMU 2.7 it can have
2631 #          other values.
2633 # Returns: - Nothing on success
2634 #          - If no background operation is active on this device, DeviceNotActive
2636 # Since: 1.3
2638 { 'command': 'block-job-pause', 'data': { 'device': 'str' } }
2641 # @block-job-resume:
2643 # Resume an active background block operation.
2645 # This command returns immediately after resuming a paused background block
2646 # operation.  It is an error to call this command if no operation is in
2647 # progress or if the job is not paused.
2649 # This command also clears the error status of the job.
2651 # @device: The job identifier. This used to be a device name (hence
2652 #          the name of the parameter), but since QEMU 2.7 it can have
2653 #          other values.
2655 # Returns: - Nothing on success
2656 #          - If no background operation is active on this device, DeviceNotActive
2658 # Since: 1.3
2660 { 'command': 'block-job-resume', 'data': { 'device': 'str' } }
2663 # @block-job-complete:
2665 # Manually trigger completion of an active background block operation.  This
2666 # is supported for drive mirroring, where it also switches the device to
2667 # write to the target path only.  The ability to complete is signaled with
2668 # a BLOCK_JOB_READY event.
2670 # This command completes an active background block operation synchronously.
2671 # The ordering of this command's return with the BLOCK_JOB_COMPLETED event
2672 # is not defined.  Note that if an I/O error occurs during the processing of
2673 # this command: 1) the command itself will fail; 2) the error will be processed
2674 # according to the rerror/werror arguments that were specified when starting
2675 # the operation.
2677 # A cancelled or paused job cannot be completed.
2679 # @device: The job identifier. This used to be a device name (hence
2680 #          the name of the parameter), but since QEMU 2.7 it can have
2681 #          other values.
2683 # Returns: - Nothing on success
2684 #          - If no background operation is active on this device, DeviceNotActive
2686 # Since: 1.3
2688 { 'command': 'block-job-complete', 'data': { 'device': 'str' } }
2691 # @block-job-dismiss:
2693 # For jobs that have already concluded, remove them from the block-job-query
2694 # list. This command only needs to be run for jobs which were started with
2695 # QEMU 2.12+ job lifetime management semantics.
2697 # This command will refuse to operate on any job that has not yet reached
2698 # its terminal state, JOB_STATUS_CONCLUDED. For jobs that make use of the
2699 # BLOCK_JOB_READY event, block-job-cancel or block-job-complete will still need
2700 # to be used as appropriate.
2702 # @id: The job identifier.
2704 # Returns: Nothing on success
2706 # Since: 2.12
2708 { 'command': 'block-job-dismiss', 'data': { 'id': 'str' } }
2711 # @block-job-finalize:
2713 # Once a job that has manual=true reaches the pending state, it can be
2714 # instructed to finalize any graph changes and do any necessary cleanup
2715 # via this command.
2716 # For jobs in a transaction, instructing one job to finalize will force
2717 # ALL jobs in the transaction to finalize, so it is only necessary to instruct
2718 # a single member job to finalize.
2720 # @id: The job identifier.
2722 # Returns: Nothing on success
2724 # Since: 2.12
2726 { 'command': 'block-job-finalize', 'data': { 'id': 'str' } }
2729 # @BlockdevDiscardOptions:
2731 # Determines how to handle discard requests.
2733 # @ignore: Ignore the request
2734 # @unmap: Forward as an unmap request
2736 # Since: 2.9
2738 { 'enum': 'BlockdevDiscardOptions',
2739   'data': [ 'ignore', 'unmap' ] }
2742 # @BlockdevDetectZeroesOptions:
2744 # Describes the operation mode for the automatic conversion of plain
2745 # zero writes by the OS to driver specific optimized zero write commands.
2747 # @off: Disabled (default)
2748 # @on: Enabled
2749 # @unmap: Enabled and even try to unmap blocks if possible. This requires
2750 #         also that @BlockdevDiscardOptions is set to unmap for this device.
2752 # Since: 2.1
2754 { 'enum': 'BlockdevDetectZeroesOptions',
2755   'data': [ 'off', 'on', 'unmap' ] }
2758 # @BlockdevAioOptions:
2760 # Selects the AIO backend to handle I/O requests
2762 # @threads: Use qemu's thread pool
2763 # @native: Use native AIO backend (only Linux and Windows)
2764 # @io_uring: Use linux io_uring (since 5.0)
2766 # Since: 2.9
2768 { 'enum': 'BlockdevAioOptions',
2769   'data': [ 'threads', 'native',
2770             { 'name': 'io_uring', 'if': 'defined(CONFIG_LINUX_IO_URING)' } ] }
2773 # @BlockdevCacheOptions:
2775 # Includes cache-related options for block devices
2777 # @direct: enables use of O_DIRECT (bypass the host page cache;
2778 #          default: false)
2779 # @no-flush: ignore any flush requests for the device (default:
2780 #            false)
2782 # Since: 2.9
2784 { 'struct': 'BlockdevCacheOptions',
2785   'data': { '*direct': 'bool',
2786             '*no-flush': 'bool' } }
2789 # @BlockdevDriver:
2791 # Drivers that are supported in block device operations.
2793 # @vxhs: Since 2.10
2794 # @throttle: Since 2.11
2795 # @nvme: Since 2.12
2796 # @copy-on-read: Since 3.0
2797 # @blklogwrites: Since 3.0
2798 # @blkreplay: Since 4.2
2799 # @compress: Since 5.0
2801 # Since: 2.9
2803 { 'enum': 'BlockdevDriver',
2804   'data': [ 'blkdebug', 'blklogwrites', 'blkreplay', 'blkverify', 'bochs',
2805             'cloop', 'compress', 'copy-on-read', 'dmg', 'file', 'ftp', 'ftps',
2806             'gluster', 'host_cdrom', 'host_device', 'http', 'https', 'iscsi',
2807             'luks', 'nbd', 'nfs', 'null-aio', 'null-co', 'nvme', 'parallels',
2808             'qcow', 'qcow2', 'qed', 'quorum', 'raw', 'rbd',
2809             { 'name': 'replication', 'if': 'defined(CONFIG_REPLICATION)' },
2810             'sheepdog',
2811             'ssh', 'throttle', 'vdi', 'vhdx', 'vmdk', 'vpc', 'vvfat', 'vxhs' ] }
2814 # @BlockdevOptionsFile:
2816 # Driver specific block device options for the file backend.
2818 # @filename: path to the image file
2819 # @pr-manager: the id for the object that will handle persistent reservations
2820 #              for this device (default: none, forward the commands via SG_IO;
2821 #              since 2.11)
2822 # @aio: AIO backend (default: threads) (since: 2.8)
2823 # @locking: whether to enable file locking. If set to 'auto', only enable
2824 #           when Open File Descriptor (OFD) locking API is available
2825 #           (default: auto, since 2.10)
2826 # @drop-cache: invalidate page cache during live migration.  This prevents
2827 #              stale data on the migration destination with cache.direct=off.
2828 #              Currently only supported on Linux hosts.
2829 #              (default: on, since: 4.0)
2830 # @x-check-cache-dropped: whether to check that page cache was dropped on live
2831 #                         migration.  May cause noticeable delays if the image
2832 #                         file is large, do not use in production.
2833 #                         (default: off) (since: 3.0)
2835 # Features:
2836 # @dynamic-auto-read-only: If present, enabled auto-read-only means that the
2837 #                          driver will open the image read-only at first,
2838 #                          dynamically reopen the image file read-write when
2839 #                          the first writer is attached to the node and reopen
2840 #                          read-only when the last writer is detached. This
2841 #                          allows giving QEMU write permissions only on demand
2842 #                          when an operation actually needs write access.
2844 # Since: 2.9
2846 { 'struct': 'BlockdevOptionsFile',
2847   'data': { 'filename': 'str',
2848             '*pr-manager': 'str',
2849             '*locking': 'OnOffAuto',
2850             '*aio': 'BlockdevAioOptions',
2851             '*drop-cache': {'type': 'bool',
2852                             'if': 'defined(CONFIG_LINUX)'},
2853             '*x-check-cache-dropped': 'bool' },
2854   'features': [ { 'name': 'dynamic-auto-read-only',
2855                   'if': 'defined(CONFIG_POSIX)' } ] }
2858 # @BlockdevOptionsNull:
2860 # Driver specific block device options for the null backend.
2862 # @size: size of the device in bytes.
2863 # @latency-ns: emulated latency (in nanoseconds) in processing
2864 #              requests. Default to zero which completes requests immediately.
2865 #              (Since 2.4)
2866 # @read-zeroes: if true, reads from the device produce zeroes; if false, the
2867 #               buffer is left unchanged. (default: false; since: 4.1)
2869 # Since: 2.9
2871 { 'struct': 'BlockdevOptionsNull',
2872   'data': { '*size': 'int', '*latency-ns': 'uint64', '*read-zeroes': 'bool' } }
2875 # @BlockdevOptionsNVMe:
2877 # Driver specific block device options for the NVMe backend.
2879 # @device: PCI controller address of the NVMe device in
2880 #          format hhhh:bb:ss.f (host:bus:slot.function)
2881 # @namespace: namespace number of the device, starting from 1.
2883 # Note that the PCI @device must have been unbound from any host
2884 # kernel driver before instructing QEMU to add the blockdev.
2886 # Since: 2.12
2888 { 'struct': 'BlockdevOptionsNVMe',
2889   'data': { 'device': 'str', 'namespace': 'int' } }
2892 # @BlockdevOptionsVVFAT:
2894 # Driver specific block device options for the vvfat protocol.
2896 # @dir: directory to be exported as FAT image
2897 # @fat-type: FAT type: 12, 16 or 32
2898 # @floppy: whether to export a floppy image (true) or
2899 #          partitioned hard disk (false; default)
2900 # @label: set the volume label, limited to 11 bytes. FAT16 and
2901 #         FAT32 traditionally have some restrictions on labels, which are
2902 #         ignored by most operating systems. Defaults to "QEMU VVFAT".
2903 #         (since 2.4)
2904 # @rw: whether to allow write operations (default: false)
2906 # Since: 2.9
2908 { 'struct': 'BlockdevOptionsVVFAT',
2909   'data': { 'dir': 'str', '*fat-type': 'int', '*floppy': 'bool',
2910             '*label': 'str', '*rw': 'bool' } }
2913 # @BlockdevOptionsGenericFormat:
2915 # Driver specific block device options for image format that have no option
2916 # besides their data source.
2918 # @file: reference to or definition of the data source block device
2920 # Since: 2.9
2922 { 'struct': 'BlockdevOptionsGenericFormat',
2923   'data': { 'file': 'BlockdevRef' } }
2926 # @BlockdevOptionsLUKS:
2928 # Driver specific block device options for LUKS.
2930 # @key-secret: the ID of a QCryptoSecret object providing
2931 #              the decryption key (since 2.6). Mandatory except when
2932 #              doing a metadata-only probe of the image.
2934 # Since: 2.9
2936 { 'struct': 'BlockdevOptionsLUKS',
2937   'base': 'BlockdevOptionsGenericFormat',
2938   'data': { '*key-secret': 'str' } }
2942 # @BlockdevOptionsGenericCOWFormat:
2944 # Driver specific block device options for image format that have no option
2945 # besides their data source and an optional backing file.
2947 # @backing: reference to or definition of the backing file block
2948 #           device, null disables the backing file entirely.
2949 #           Defaults to the backing file stored the image file.
2951 # Since: 2.9
2953 { 'struct': 'BlockdevOptionsGenericCOWFormat',
2954   'base': 'BlockdevOptionsGenericFormat',
2955   'data': { '*backing': 'BlockdevRefOrNull' } }
2958 # @Qcow2OverlapCheckMode:
2960 # General overlap check modes.
2962 # @none: Do not perform any checks
2964 # @constant: Perform only checks which can be done in constant time and
2965 #            without reading anything from disk
2967 # @cached: Perform only checks which can be done without reading anything
2968 #          from disk
2970 # @all: Perform all available overlap checks
2972 # Since: 2.9
2974 { 'enum': 'Qcow2OverlapCheckMode',
2975   'data': [ 'none', 'constant', 'cached', 'all' ] }
2978 # @Qcow2OverlapCheckFlags:
2980 # Structure of flags for each metadata structure. Setting a field to 'true'
2981 # makes qemu guard that structure against unintended overwriting. The default
2982 # value is chosen according to the template given.
2984 # @template: Specifies a template mode which can be adjusted using the other
2985 #            flags, defaults to 'cached'
2987 # @bitmap-directory: since 3.0
2989 # Since: 2.9
2991 { 'struct': 'Qcow2OverlapCheckFlags',
2992   'data': { '*template':         'Qcow2OverlapCheckMode',
2993             '*main-header':      'bool',
2994             '*active-l1':        'bool',
2995             '*active-l2':        'bool',
2996             '*refcount-table':   'bool',
2997             '*refcount-block':   'bool',
2998             '*snapshot-table':   'bool',
2999             '*inactive-l1':      'bool',
3000             '*inactive-l2':      'bool',
3001             '*bitmap-directory': 'bool' } }
3004 # @Qcow2OverlapChecks:
3006 # Specifies which metadata structures should be guarded against unintended
3007 # overwriting.
3009 # @flags: set of flags for separate specification of each metadata structure
3010 #         type
3012 # @mode: named mode which chooses a specific set of flags
3014 # Since: 2.9
3016 { 'alternate': 'Qcow2OverlapChecks',
3017   'data': { 'flags': 'Qcow2OverlapCheckFlags',
3018             'mode':  'Qcow2OverlapCheckMode' } }
3021 # @BlockdevQcowEncryptionFormat:
3023 # @aes: AES-CBC with plain64 initialization vectors
3025 # Since: 2.10
3027 { 'enum': 'BlockdevQcowEncryptionFormat',
3028   'data': [ 'aes' ] }
3031 # @BlockdevQcowEncryption:
3033 # Since: 2.10
3035 { 'union': 'BlockdevQcowEncryption',
3036   'base': { 'format': 'BlockdevQcowEncryptionFormat' },
3037   'discriminator': 'format',
3038   'data': { 'aes': 'QCryptoBlockOptionsQCow' } }
3041 # @BlockdevOptionsQcow:
3043 # Driver specific block device options for qcow.
3045 # @encrypt: Image decryption options. Mandatory for
3046 #           encrypted images, except when doing a metadata-only
3047 #           probe of the image.
3049 # Since: 2.10
3051 { 'struct': 'BlockdevOptionsQcow',
3052   'base': 'BlockdevOptionsGenericCOWFormat',
3053   'data': { '*encrypt': 'BlockdevQcowEncryption' } }
3058 # @BlockdevQcow2EncryptionFormat:
3059 # @aes: AES-CBC with plain64 initialization vectors
3061 # Since: 2.10
3063 { 'enum': 'BlockdevQcow2EncryptionFormat',
3064   'data': [ 'aes', 'luks' ] }
3067 # @BlockdevQcow2Encryption:
3069 # Since: 2.10
3071 { 'union': 'BlockdevQcow2Encryption',
3072   'base': { 'format': 'BlockdevQcow2EncryptionFormat' },
3073   'discriminator': 'format',
3074   'data': { 'aes': 'QCryptoBlockOptionsQCow',
3075             'luks': 'QCryptoBlockOptionsLUKS'} }
3078 # @BlockdevOptionsQcow2:
3080 # Driver specific block device options for qcow2.
3082 # @lazy-refcounts: whether to enable the lazy refcounts
3083 #                  feature (default is taken from the image file)
3085 # @pass-discard-request: whether discard requests to the qcow2
3086 #                        device should be forwarded to the data source
3088 # @pass-discard-snapshot: whether discard requests for the data source
3089 #                         should be issued when a snapshot operation (e.g.
3090 #                         deleting a snapshot) frees clusters in the qcow2 file
3092 # @pass-discard-other: whether discard requests for the data source
3093 #                      should be issued on other occasions where a cluster
3094 #                      gets freed
3096 # @overlap-check: which overlap checks to perform for writes
3097 #                 to the image, defaults to 'cached' (since 2.2)
3099 # @cache-size: the maximum total size of the L2 table and
3100 #              refcount block caches in bytes (since 2.2)
3102 # @l2-cache-size: the maximum size of the L2 table cache in
3103 #                 bytes (since 2.2)
3105 # @l2-cache-entry-size: the size of each entry in the L2 cache in
3106 #                       bytes. It must be a power of two between 512
3107 #                       and the cluster size. The default value is
3108 #                       the cluster size (since 2.12)
3110 # @refcount-cache-size: the maximum size of the refcount block cache
3111 #                       in bytes (since 2.2)
3113 # @cache-clean-interval: clean unused entries in the L2 and refcount
3114 #                        caches. The interval is in seconds. The default value
3115 #                        is 600 on supporting platforms, and 0 on other
3116 #                        platforms. 0 disables this feature. (since 2.5)
3118 # @encrypt: Image decryption options. Mandatory for
3119 #           encrypted images, except when doing a metadata-only
3120 #           probe of the image. (since 2.10)
3122 # @data-file: reference to or definition of the external data file.
3123 #             This may only be specified for images that require an
3124 #             external data file. If it is not specified for such
3125 #             an image, the data file name is loaded from the image
3126 #             file. (since 4.0)
3128 # Since: 2.9
3130 { 'struct': 'BlockdevOptionsQcow2',
3131   'base': 'BlockdevOptionsGenericCOWFormat',
3132   'data': { '*lazy-refcounts': 'bool',
3133             '*pass-discard-request': 'bool',
3134             '*pass-discard-snapshot': 'bool',
3135             '*pass-discard-other': 'bool',
3136             '*overlap-check': 'Qcow2OverlapChecks',
3137             '*cache-size': 'int',
3138             '*l2-cache-size': 'int',
3139             '*l2-cache-entry-size': 'int',
3140             '*refcount-cache-size': 'int',
3141             '*cache-clean-interval': 'int',
3142             '*encrypt': 'BlockdevQcow2Encryption',
3143             '*data-file': 'BlockdevRef' } }
3146 # @SshHostKeyCheckMode:
3148 # @none: Don't check the host key at all
3149 # @hash: Compare the host key with a given hash
3150 # @known_hosts: Check the host key against the known_hosts file
3152 # Since: 2.12
3154 { 'enum': 'SshHostKeyCheckMode',
3155   'data': [ 'none', 'hash', 'known_hosts' ] }
3158 # @SshHostKeyCheckHashType:
3160 # @md5: The given hash is an md5 hash
3161 # @sha1: The given hash is an sha1 hash
3163 # Since: 2.12
3165 { 'enum': 'SshHostKeyCheckHashType',
3166   'data': [ 'md5', 'sha1' ] }
3169 # @SshHostKeyHash:
3171 # @type: The hash algorithm used for the hash
3172 # @hash: The expected hash value
3174 # Since: 2.12
3176 { 'struct': 'SshHostKeyHash',
3177   'data': { 'type': 'SshHostKeyCheckHashType',
3178             'hash': 'str' }}
3181 # @SshHostKeyCheck:
3183 # Since: 2.12
3185 { 'union': 'SshHostKeyCheck',
3186   'base': { 'mode': 'SshHostKeyCheckMode' },
3187   'discriminator': 'mode',
3188   'data': { 'hash': 'SshHostKeyHash' } }
3191 # @BlockdevOptionsSsh:
3193 # @server:              host address
3195 # @path:                path to the image on the host
3197 # @user:                user as which to connect, defaults to current
3198 #                       local user name
3200 # @host-key-check:      Defines how and what to check the host key against
3201 #                       (default: known_hosts)
3203 # Since: 2.9
3205 { 'struct': 'BlockdevOptionsSsh',
3206   'data': { 'server': 'InetSocketAddress',
3207             'path': 'str',
3208             '*user': 'str',
3209             '*host-key-check': 'SshHostKeyCheck' } }
3213 # @BlkdebugEvent:
3215 # Trigger events supported by blkdebug.
3217 # @l1_shrink_write_table: write zeros to the l1 table to shrink image.
3218 #                         (since 2.11)
3220 # @l1_shrink_free_l2_clusters: discard the l2 tables. (since 2.11)
3222 # @cor_write: a write due to copy-on-read (since 2.11)
3224 # @cluster_alloc_space: an allocation of file space for a cluster (since 4.1)
3226 # @none: triggers once at creation of the blkdebug node (since 4.1)
3228 # Since: 2.9
3230 { 'enum': 'BlkdebugEvent', 'prefix': 'BLKDBG',
3231   'data': [ 'l1_update', 'l1_grow_alloc_table', 'l1_grow_write_table',
3232             'l1_grow_activate_table', 'l2_load', 'l2_update',
3233             'l2_update_compressed', 'l2_alloc_cow_read', 'l2_alloc_write',
3234             'read_aio', 'read_backing_aio', 'read_compressed', 'write_aio',
3235             'write_compressed', 'vmstate_load', 'vmstate_save', 'cow_read',
3236             'cow_write', 'reftable_load', 'reftable_grow', 'reftable_update',
3237             'refblock_load', 'refblock_update', 'refblock_update_part',
3238             'refblock_alloc', 'refblock_alloc_hookup', 'refblock_alloc_write',
3239             'refblock_alloc_write_blocks', 'refblock_alloc_write_table',
3240             'refblock_alloc_switch_table', 'cluster_alloc',
3241             'cluster_alloc_bytes', 'cluster_free', 'flush_to_os',
3242             'flush_to_disk', 'pwritev_rmw_head', 'pwritev_rmw_after_head',
3243             'pwritev_rmw_tail', 'pwritev_rmw_after_tail', 'pwritev',
3244             'pwritev_zero', 'pwritev_done', 'empty_image_prepare',
3245             'l1_shrink_write_table', 'l1_shrink_free_l2_clusters',
3246             'cor_write', 'cluster_alloc_space', 'none'] }
3249 # @BlkdebugIOType:
3251 # Kinds of I/O that blkdebug can inject errors in.
3253 # @read: .bdrv_co_preadv()
3255 # @write: .bdrv_co_pwritev()
3257 # @write-zeroes: .bdrv_co_pwrite_zeroes()
3259 # @discard: .bdrv_co_pdiscard()
3261 # @flush: .bdrv_co_flush_to_disk()
3263 # @block-status: .bdrv_co_block_status()
3265 # Since: 4.1
3267 { 'enum': 'BlkdebugIOType', 'prefix': 'BLKDEBUG_IO_TYPE',
3268   'data': [ 'read', 'write', 'write-zeroes', 'discard', 'flush',
3269             'block-status' ] }
3272 # @BlkdebugInjectErrorOptions:
3274 # Describes a single error injection for blkdebug.
3276 # @event: trigger event
3278 # @state: the state identifier blkdebug needs to be in to
3279 #         actually trigger the event; defaults to "any"
3281 # @iotype: the type of I/O operations on which this error should
3282 #          be injected; defaults to "all read, write,
3283 #          write-zeroes, discard, and flush operations"
3284 #          (since: 4.1)
3286 # @errno: error identifier (errno) to be returned; defaults to
3287 #         EIO
3289 # @sector: specifies the sector index which has to be affected
3290 #          in order to actually trigger the event; defaults to "any
3291 #          sector"
3293 # @once: disables further events after this one has been
3294 #        triggered; defaults to false
3296 # @immediately: fail immediately; defaults to false
3298 # Since: 2.9
3300 { 'struct': 'BlkdebugInjectErrorOptions',
3301   'data': { 'event': 'BlkdebugEvent',
3302             '*state': 'int',
3303             '*iotype': 'BlkdebugIOType',
3304             '*errno': 'int',
3305             '*sector': 'int',
3306             '*once': 'bool',
3307             '*immediately': 'bool' } }
3310 # @BlkdebugSetStateOptions:
3312 # Describes a single state-change event for blkdebug.
3314 # @event: trigger event
3316 # @state: the current state identifier blkdebug needs to be in;
3317 #         defaults to "any"
3319 # @new_state: the state identifier blkdebug is supposed to assume if
3320 #             this event is triggered
3322 # Since: 2.9
3324 { 'struct': 'BlkdebugSetStateOptions',
3325   'data': { 'event': 'BlkdebugEvent',
3326             '*state': 'int',
3327             'new_state': 'int' } }
3330 # @BlockdevOptionsBlkdebug:
3332 # Driver specific block device options for blkdebug.
3334 # @image: underlying raw block device (or image file)
3336 # @config: filename of the configuration file
3338 # @align: required alignment for requests in bytes, must be
3339 #         positive power of 2, or 0 for default
3341 # @max-transfer: maximum size for I/O transfers in bytes, must be
3342 #                positive multiple of @align and of the underlying
3343 #                file's request alignment (but need not be a power of
3344 #                2), or 0 for default (since 2.10)
3346 # @opt-write-zero: preferred alignment for write zero requests in bytes,
3347 #                  must be positive multiple of @align and of the
3348 #                  underlying file's request alignment (but need not be a
3349 #                  power of 2), or 0 for default (since 2.10)
3351 # @max-write-zero: maximum size for write zero requests in bytes, must be
3352 #                  positive multiple of @align, of @opt-write-zero, and of
3353 #                  the underlying file's request alignment (but need not
3354 #                  be a power of 2), or 0 for default (since 2.10)
3356 # @opt-discard: preferred alignment for discard requests in bytes, must
3357 #               be positive multiple of @align and of the underlying
3358 #               file's request alignment (but need not be a power of
3359 #               2), or 0 for default (since 2.10)
3361 # @max-discard: maximum size for discard requests in bytes, must be
3362 #               positive multiple of @align, of @opt-discard, and of
3363 #               the underlying file's request alignment (but need not
3364 #               be a power of 2), or 0 for default (since 2.10)
3366 # @inject-error: array of error injection descriptions
3368 # @set-state: array of state-change descriptions
3370 # @take-child-perms: Permissions to take on @image in addition to what
3371 #                    is necessary anyway (which depends on how the
3372 #                    blkdebug node is used).  Defaults to none.
3373 #                    (since 5.0)
3375 # @unshare-child-perms: Permissions not to share on @image in addition
3376 #                       to what cannot be shared anyway (which depends
3377 #                       on how the blkdebug node is used).  Defaults
3378 #                       to none.  (since 5.0)
3380 # Since: 2.9
3382 { 'struct': 'BlockdevOptionsBlkdebug',
3383   'data': { 'image': 'BlockdevRef',
3384             '*config': 'str',
3385             '*align': 'int', '*max-transfer': 'int32',
3386             '*opt-write-zero': 'int32', '*max-write-zero': 'int32',
3387             '*opt-discard': 'int32', '*max-discard': 'int32',
3388             '*inject-error': ['BlkdebugInjectErrorOptions'],
3389             '*set-state': ['BlkdebugSetStateOptions'],
3390             '*take-child-perms': ['BlockPermission'],
3391             '*unshare-child-perms': ['BlockPermission'] } }
3394 # @BlockdevOptionsBlklogwrites:
3396 # Driver specific block device options for blklogwrites.
3398 # @file: block device
3400 # @log: block device used to log writes to @file
3402 # @log-sector-size: sector size used in logging writes to @file, determines
3403 #                   granularity of offsets and sizes of writes (default: 512)
3405 # @log-append: append to an existing log (default: false)
3407 # @log-super-update-interval: interval of write requests after which the log
3408 #                             super block is updated to disk (default: 4096)
3410 # Since: 3.0
3412 { 'struct': 'BlockdevOptionsBlklogwrites',
3413   'data': { 'file': 'BlockdevRef',
3414             'log': 'BlockdevRef',
3415             '*log-sector-size': 'uint32',
3416             '*log-append': 'bool',
3417             '*log-super-update-interval': 'uint64' } }
3420 # @BlockdevOptionsBlkverify:
3422 # Driver specific block device options for blkverify.
3424 # @test: block device to be tested
3426 # @raw: raw image used for verification
3428 # Since: 2.9
3430 { 'struct': 'BlockdevOptionsBlkverify',
3431   'data': { 'test': 'BlockdevRef',
3432             'raw': 'BlockdevRef' } }
3435 # @BlockdevOptionsBlkreplay:
3437 # Driver specific block device options for blkreplay.
3439 # @image: disk image which should be controlled with blkreplay
3441 # Since: 4.2
3443 { 'struct': 'BlockdevOptionsBlkreplay',
3444   'data': { 'image': 'BlockdevRef' } }
3447 # @QuorumReadPattern:
3449 # An enumeration of quorum read patterns.
3451 # @quorum: read all the children and do a quorum vote on reads
3453 # @fifo: read only from the first child that has not failed
3455 # Since: 2.9
3457 { 'enum': 'QuorumReadPattern', 'data': [ 'quorum', 'fifo' ] }
3460 # @BlockdevOptionsQuorum:
3462 # Driver specific block device options for Quorum
3464 # @blkverify: true if the driver must print content mismatch
3465 #                  set to false by default
3467 # @children: the children block devices to use
3469 # @vote-threshold: the vote limit under which a read will fail
3471 # @rewrite-corrupted: rewrite corrupted data when quorum is reached
3472 #                     (Since 2.1)
3474 # @read-pattern: choose read pattern and set to quorum by default
3475 #                (Since 2.2)
3477 # Since: 2.9
3479 { 'struct': 'BlockdevOptionsQuorum',
3480   'data': { '*blkverify': 'bool',
3481             'children': [ 'BlockdevRef' ],
3482             'vote-threshold': 'int',
3483             '*rewrite-corrupted': 'bool',
3484             '*read-pattern': 'QuorumReadPattern' } }
3487 # @BlockdevOptionsGluster:
3489 # Driver specific block device options for Gluster
3491 # @volume: name of gluster volume where VM image resides
3493 # @path: absolute path to image file in gluster volume
3495 # @server: gluster servers description
3497 # @debug: libgfapi log level (default '4' which is Error)
3498 #         (Since 2.8)
3500 # @logfile: libgfapi log file (default /dev/stderr) (Since 2.8)
3502 # Since: 2.9
3504 { 'struct': 'BlockdevOptionsGluster',
3505   'data': { 'volume': 'str',
3506             'path': 'str',
3507             'server': ['SocketAddress'],
3508             '*debug': 'int',
3509             '*logfile': 'str' } }
3512 # @IscsiTransport:
3514 # An enumeration of libiscsi transport types
3516 # Since: 2.9
3518 { 'enum': 'IscsiTransport',
3519   'data': [ 'tcp', 'iser' ] }
3522 # @IscsiHeaderDigest:
3524 # An enumeration of header digests supported by libiscsi
3526 # Since: 2.9
3528 { 'enum': 'IscsiHeaderDigest',
3529   'prefix': 'QAPI_ISCSI_HEADER_DIGEST',
3530   'data': [ 'crc32c', 'none', 'crc32c-none', 'none-crc32c' ] }
3533 # @BlockdevOptionsIscsi:
3535 # @transport: The iscsi transport type
3537 # @portal: The address of the iscsi portal
3539 # @target: The target iqn name
3541 # @lun: LUN to connect to. Defaults to 0.
3543 # @user: User name to log in with. If omitted, no CHAP
3544 #        authentication is performed.
3546 # @password-secret: The ID of a QCryptoSecret object providing
3547 #                   the password for the login. This option is required if
3548 #                   @user is specified.
3550 # @initiator-name: The iqn name we want to identify to the target
3551 #                  as. If this option is not specified, an initiator name is
3552 #                  generated automatically.
3554 # @header-digest: The desired header digest. Defaults to
3555 #                 none-crc32c.
3557 # @timeout: Timeout in seconds after which a request will
3558 #           timeout. 0 means no timeout and is the default.
3560 # Driver specific block device options for iscsi
3562 # Since: 2.9
3564 { 'struct': 'BlockdevOptionsIscsi',
3565   'data': { 'transport': 'IscsiTransport',
3566             'portal': 'str',
3567             'target': 'str',
3568             '*lun': 'int',
3569             '*user': 'str',
3570             '*password-secret': 'str',
3571             '*initiator-name': 'str',
3572             '*header-digest': 'IscsiHeaderDigest',
3573             '*timeout': 'int' } }
3577 # @RbdAuthMode:
3579 # Since: 3.0
3581 { 'enum': 'RbdAuthMode',
3582   'data': [ 'cephx', 'none' ] }
3585 # @BlockdevOptionsRbd:
3587 # @pool: Ceph pool name.
3589 # @namespace: Rados namespace name in the Ceph pool. (Since 5.0)
3591 # @image: Image name in the Ceph pool.
3593 # @conf: path to Ceph configuration file.  Values
3594 #        in the configuration file will be overridden by
3595 #        options specified via QAPI.
3597 # @snapshot: Ceph snapshot name.
3599 # @user: Ceph id name.
3601 # @auth-client-required: Acceptable authentication modes.
3602 #                        This maps to Ceph configuration option
3603 #                        "auth_client_required".  (Since 3.0)
3605 # @key-secret: ID of a QCryptoSecret object providing a key
3606 #              for cephx authentication.
3607 #              This maps to Ceph configuration option
3608 #              "key".  (Since 3.0)
3610 # @server: Monitor host address and port.  This maps
3611 #          to the "mon_host" Ceph option.
3613 # Since: 2.9
3615 { 'struct': 'BlockdevOptionsRbd',
3616   'data': { 'pool': 'str',
3617             '*namespace': 'str',
3618             'image': 'str',
3619             '*conf': 'str',
3620             '*snapshot': 'str',
3621             '*user': 'str',
3622             '*auth-client-required': ['RbdAuthMode'],
3623             '*key-secret': 'str',
3624             '*server': ['InetSocketAddressBase'] } }
3627 # @BlockdevOptionsSheepdog:
3629 # Driver specific block device options for sheepdog
3631 # @vdi: Virtual disk image name
3632 # @server: The Sheepdog server to connect to
3633 # @snap-id: Snapshot ID
3634 # @tag: Snapshot tag name
3636 # Only one of @snap-id and @tag may be present.
3638 # Since: 2.9
3640 { 'struct': 'BlockdevOptionsSheepdog',
3641   'data': { 'server': 'SocketAddress',
3642             'vdi': 'str',
3643             '*snap-id': 'uint32',
3644             '*tag': 'str' } }
3647 # @ReplicationMode:
3649 # An enumeration of replication modes.
3651 # @primary: Primary mode, the vm's state will be sent to secondary QEMU.
3653 # @secondary: Secondary mode, receive the vm's state from primary QEMU.
3655 # Since: 2.9
3657 { 'enum' : 'ReplicationMode', 'data' : [ 'primary', 'secondary' ],
3658   'if': 'defined(CONFIG_REPLICATION)' }
3661 # @BlockdevOptionsReplication:
3663 # Driver specific block device options for replication
3665 # @mode: the replication mode
3667 # @top-id: In secondary mode, node name or device ID of the root
3668 #          node who owns the replication node chain. Must not be given in
3669 #          primary mode.
3671 # Since: 2.9
3673 { 'struct': 'BlockdevOptionsReplication',
3674   'base': 'BlockdevOptionsGenericFormat',
3675   'data': { 'mode': 'ReplicationMode',
3676             '*top-id': 'str' },
3677   'if': 'defined(CONFIG_REPLICATION)' }
3680 # @NFSTransport:
3682 # An enumeration of NFS transport types
3684 # @inet: TCP transport
3686 # Since: 2.9
3688 { 'enum': 'NFSTransport',
3689   'data': [ 'inet' ] }
3692 # @NFSServer:
3694 # Captures the address of the socket
3696 # @type: transport type used for NFS (only TCP supported)
3698 # @host: host address for NFS server
3700 # Since: 2.9
3702 { 'struct': 'NFSServer',
3703   'data': { 'type': 'NFSTransport',
3704             'host': 'str' } }
3707 # @BlockdevOptionsNfs:
3709 # Driver specific block device option for NFS
3711 # @server: host address
3713 # @path: path of the image on the host
3715 # @user: UID value to use when talking to the
3716 #        server (defaults to 65534 on Windows and getuid()
3717 #        on unix)
3719 # @group: GID value to use when talking to the
3720 #         server (defaults to 65534 on Windows and getgid()
3721 #         in unix)
3723 # @tcp-syn-count: number of SYNs during the session
3724 #                 establishment (defaults to libnfs default)
3726 # @readahead-size: set the readahead size in bytes (defaults
3727 #                  to libnfs default)
3729 # @page-cache-size: set the pagecache size in bytes (defaults
3730 #                   to libnfs default)
3732 # @debug: set the NFS debug level (max 2) (defaults
3733 #         to libnfs default)
3735 # Since: 2.9
3737 { 'struct': 'BlockdevOptionsNfs',
3738   'data': { 'server': 'NFSServer',
3739             'path': 'str',
3740             '*user': 'int',
3741             '*group': 'int',
3742             '*tcp-syn-count': 'int',
3743             '*readahead-size': 'int',
3744             '*page-cache-size': 'int',
3745             '*debug': 'int' } }
3748 # @BlockdevOptionsCurlBase:
3750 # Driver specific block device options shared by all protocols supported by the
3751 # curl backend.
3753 # @url: URL of the image file
3755 # @readahead: Size of the read-ahead cache; must be a multiple of
3756 #             512 (defaults to 256 kB)
3758 # @timeout: Timeout for connections, in seconds (defaults to 5)
3760 # @username: Username for authentication (defaults to none)
3762 # @password-secret: ID of a QCryptoSecret object providing a password
3763 #                   for authentication (defaults to no password)
3765 # @proxy-username: Username for proxy authentication (defaults to none)
3767 # @proxy-password-secret: ID of a QCryptoSecret object providing a password
3768 #                         for proxy authentication (defaults to no password)
3770 # Since: 2.9
3772 { 'struct': 'BlockdevOptionsCurlBase',
3773   'data': { 'url': 'str',
3774             '*readahead': 'int',
3775             '*timeout': 'int',
3776             '*username': 'str',
3777             '*password-secret': 'str',
3778             '*proxy-username': 'str',
3779             '*proxy-password-secret': 'str' } }
3782 # @BlockdevOptionsCurlHttp:
3784 # Driver specific block device options for HTTP connections over the curl
3785 # backend.  URLs must start with "http://".
3787 # @cookie: List of cookies to set; format is
3788 #          "name1=content1; name2=content2;" as explained by
3789 #          CURLOPT_COOKIE(3). Defaults to no cookies.
3791 # @cookie-secret: ID of a QCryptoSecret object providing the cookie data in a
3792 #                 secure way. See @cookie for the format. (since 2.10)
3794 # Since: 2.9
3796 { 'struct': 'BlockdevOptionsCurlHttp',
3797   'base': 'BlockdevOptionsCurlBase',
3798   'data': { '*cookie': 'str',
3799             '*cookie-secret': 'str'} }
3802 # @BlockdevOptionsCurlHttps:
3804 # Driver specific block device options for HTTPS connections over the curl
3805 # backend.  URLs must start with "https://".
3807 # @cookie: List of cookies to set; format is
3808 #          "name1=content1; name2=content2;" as explained by
3809 #          CURLOPT_COOKIE(3). Defaults to no cookies.
3811 # @sslverify: Whether to verify the SSL certificate's validity (defaults to
3812 #             true)
3814 # @cookie-secret: ID of a QCryptoSecret object providing the cookie data in a
3815 #                 secure way. See @cookie for the format. (since 2.10)
3817 # Since: 2.9
3819 { 'struct': 'BlockdevOptionsCurlHttps',
3820   'base': 'BlockdevOptionsCurlBase',
3821   'data': { '*cookie': 'str',
3822             '*sslverify': 'bool',
3823             '*cookie-secret': 'str'} }
3826 # @BlockdevOptionsCurlFtp:
3828 # Driver specific block device options for FTP connections over the curl
3829 # backend.  URLs must start with "ftp://".
3831 # Since: 2.9
3833 { 'struct': 'BlockdevOptionsCurlFtp',
3834   'base': 'BlockdevOptionsCurlBase',
3835   'data': { } }
3838 # @BlockdevOptionsCurlFtps:
3840 # Driver specific block device options for FTPS connections over the curl
3841 # backend.  URLs must start with "ftps://".
3843 # @sslverify: Whether to verify the SSL certificate's validity (defaults to
3844 #             true)
3846 # Since: 2.9
3848 { 'struct': 'BlockdevOptionsCurlFtps',
3849   'base': 'BlockdevOptionsCurlBase',
3850   'data': { '*sslverify': 'bool' } }
3853 # @BlockdevOptionsNbd:
3855 # Driver specific block device options for NBD.
3857 # @server: NBD server address
3859 # @export: export name
3861 # @tls-creds: TLS credentials ID
3863 # @x-dirty-bitmap: A "qemu:dirty-bitmap:NAME" string to query in place of
3864 #                  traditional "base:allocation" block status (see
3865 #                  NBD_OPT_LIST_META_CONTEXT in the NBD protocol) (since 3.0)
3867 # @reconnect-delay: On an unexpected disconnect, the nbd client tries to
3868 #                   connect again until succeeding or encountering a serious
3869 #                   error.  During the first @reconnect-delay seconds, all
3870 #                   requests are paused and will be rerun on a successful
3871 #                   reconnect. After that time, any delayed requests and all
3872 #                   future requests before a successful reconnect will
3873 #                   immediately fail. Default 0 (Since 4.2)
3875 # Since: 2.9
3877 { 'struct': 'BlockdevOptionsNbd',
3878   'data': { 'server': 'SocketAddress',
3879             '*export': 'str',
3880             '*tls-creds': 'str',
3881             '*x-dirty-bitmap': 'str',
3882             '*reconnect-delay': 'uint32' } }
3885 # @BlockdevOptionsRaw:
3887 # Driver specific block device options for the raw driver.
3889 # @offset: position where the block device starts
3890 # @size: the assumed size of the device
3892 # Since: 2.9
3894 { 'struct': 'BlockdevOptionsRaw',
3895   'base': 'BlockdevOptionsGenericFormat',
3896   'data': { '*offset': 'int', '*size': 'int' } }
3899 # @BlockdevOptionsVxHS:
3901 # Driver specific block device options for VxHS
3903 # @vdisk-id: UUID of VxHS volume
3904 # @server: vxhs server IP, port
3905 # @tls-creds: TLS credentials ID
3907 # Since: 2.10
3909 { 'struct': 'BlockdevOptionsVxHS',
3910   'data': { 'vdisk-id': 'str',
3911             'server': 'InetSocketAddressBase',
3912             '*tls-creds': 'str' } }
3915 # @BlockdevOptionsThrottle:
3917 # Driver specific block device options for the throttle driver
3919 # @throttle-group: the name of the throttle-group object to use. It
3920 #                  must already exist.
3921 # @file: reference to or definition of the data source block device
3922 # Since: 2.11
3924 { 'struct': 'BlockdevOptionsThrottle',
3925   'data': { 'throttle-group': 'str',
3926             'file' : 'BlockdevRef'
3927              } }
3929 # @BlockdevOptions:
3931 # Options for creating a block device.  Many options are available for all
3932 # block devices, independent of the block driver:
3934 # @driver: block driver name
3935 # @node-name: the node name of the new node (Since 2.0).
3936 #             This option is required on the top level of blockdev-add.
3937 #             Valid node names start with an alphabetic character and may
3938 #             contain only alphanumeric characters, '-', '.' and '_'. Their
3939 #             maximum length is 31 characters.
3940 # @discard: discard-related options (default: ignore)
3941 # @cache: cache-related options
3942 # @read-only: whether the block device should be read-only (default: false).
3943 #             Note that some block drivers support only read-only access,
3944 #             either generally or in certain configurations. In this case,
3945 #             the default value does not work and the option must be
3946 #             specified explicitly.
3947 # @auto-read-only: if true and @read-only is false, QEMU may automatically
3948 #                  decide not to open the image read-write as requested, but
3949 #                  fall back to read-only instead (and switch between the modes
3950 #                  later), e.g. depending on whether the image file is writable
3951 #                  or whether a writing user is attached to the node
3952 #                  (default: false, since 3.1)
3953 # @detect-zeroes: detect and optimize zero writes (Since 2.1)
3954 #                 (default: off)
3955 # @force-share: force share all permission on added nodes.
3956 #               Requires read-only=true. (Since 2.10)
3958 # Remaining options are determined by the block driver.
3960 # Since: 2.9
3962 { 'union': 'BlockdevOptions',
3963   'base': { 'driver': 'BlockdevDriver',
3964             '*node-name': 'str',
3965             '*discard': 'BlockdevDiscardOptions',
3966             '*cache': 'BlockdevCacheOptions',
3967             '*read-only': 'bool',
3968             '*auto-read-only': 'bool',
3969             '*force-share': 'bool',
3970             '*detect-zeroes': 'BlockdevDetectZeroesOptions' },
3971   'discriminator': 'driver',
3972   'data': {
3973       'blkdebug':   'BlockdevOptionsBlkdebug',
3974       'blklogwrites':'BlockdevOptionsBlklogwrites',
3975       'blkverify':  'BlockdevOptionsBlkverify',
3976       'blkreplay':  'BlockdevOptionsBlkreplay',
3977       'bochs':      'BlockdevOptionsGenericFormat',
3978       'cloop':      'BlockdevOptionsGenericFormat',
3979       'compress':   'BlockdevOptionsGenericFormat',
3980       'copy-on-read':'BlockdevOptionsGenericFormat',
3981       'dmg':        'BlockdevOptionsGenericFormat',
3982       'file':       'BlockdevOptionsFile',
3983       'ftp':        'BlockdevOptionsCurlFtp',
3984       'ftps':       'BlockdevOptionsCurlFtps',
3985       'gluster':    'BlockdevOptionsGluster',
3986       'host_cdrom': 'BlockdevOptionsFile',
3987       'host_device':'BlockdevOptionsFile',
3988       'http':       'BlockdevOptionsCurlHttp',
3989       'https':      'BlockdevOptionsCurlHttps',
3990       'iscsi':      'BlockdevOptionsIscsi',
3991       'luks':       'BlockdevOptionsLUKS',
3992       'nbd':        'BlockdevOptionsNbd',
3993       'nfs':        'BlockdevOptionsNfs',
3994       'null-aio':   'BlockdevOptionsNull',
3995       'null-co':    'BlockdevOptionsNull',
3996       'nvme':       'BlockdevOptionsNVMe',
3997       'parallels':  'BlockdevOptionsGenericFormat',
3998       'qcow2':      'BlockdevOptionsQcow2',
3999       'qcow':       'BlockdevOptionsQcow',
4000       'qed':        'BlockdevOptionsGenericCOWFormat',
4001       'quorum':     'BlockdevOptionsQuorum',
4002       'raw':        'BlockdevOptionsRaw',
4003       'rbd':        'BlockdevOptionsRbd',
4004       'replication': { 'type': 'BlockdevOptionsReplication',
4005                        'if': 'defined(CONFIG_REPLICATION)' },
4006       'sheepdog':   'BlockdevOptionsSheepdog',
4007       'ssh':        'BlockdevOptionsSsh',
4008       'throttle':   'BlockdevOptionsThrottle',
4009       'vdi':        'BlockdevOptionsGenericFormat',
4010       'vhdx':       'BlockdevOptionsGenericFormat',
4011       'vmdk':       'BlockdevOptionsGenericCOWFormat',
4012       'vpc':        'BlockdevOptionsGenericFormat',
4013       'vvfat':      'BlockdevOptionsVVFAT',
4014       'vxhs':       'BlockdevOptionsVxHS'
4015   } }
4018 # @BlockdevRef:
4020 # Reference to a block device.
4022 # @definition: defines a new block device inline
4023 # @reference: references the ID of an existing block device
4025 # Since: 2.9
4027 { 'alternate': 'BlockdevRef',
4028   'data': { 'definition': 'BlockdevOptions',
4029             'reference': 'str' } }
4032 # @BlockdevRefOrNull:
4034 # Reference to a block device.
4036 # @definition: defines a new block device inline
4037 # @reference: references the ID of an existing block device.
4038 #             An empty string means that no block device should
4039 #             be referenced.  Deprecated; use null instead.
4040 # @null: No block device should be referenced (since 2.10)
4042 # Since: 2.9
4044 { 'alternate': 'BlockdevRefOrNull',
4045   'data': { 'definition': 'BlockdevOptions',
4046             'reference': 'str',
4047             'null': 'null' } }
4050 # @blockdev-add:
4052 # Creates a new block device. If the @id option is given at the top level, a
4053 # BlockBackend will be created; otherwise, @node-name is mandatory at the top
4054 # level and no BlockBackend will be created.
4056 # Since: 2.9
4058 # Example:
4060 # 1.
4061 # -> { "execute": "blockdev-add",
4062 #      "arguments": {
4063 #           "driver": "qcow2",
4064 #           "node-name": "test1",
4065 #           "file": {
4066 #               "driver": "file",
4067 #               "filename": "test.qcow2"
4068 #            }
4069 #       }
4070 #     }
4071 # <- { "return": {} }
4073 # 2.
4074 # -> { "execute": "blockdev-add",
4075 #      "arguments": {
4076 #           "driver": "qcow2",
4077 #           "node-name": "node0",
4078 #           "discard": "unmap",
4079 #           "cache": {
4080 #              "direct": true
4081 #            },
4082 #            "file": {
4083 #              "driver": "file",
4084 #              "filename": "/tmp/test.qcow2"
4085 #            },
4086 #            "backing": {
4087 #               "driver": "raw",
4088 #               "file": {
4089 #                  "driver": "file",
4090 #                  "filename": "/dev/fdset/4"
4091 #                }
4092 #            }
4093 #        }
4094 #      }
4096 # <- { "return": {} }
4099 { 'command': 'blockdev-add', 'data': 'BlockdevOptions', 'boxed': true }
4102 # @x-blockdev-reopen:
4104 # Reopens a block device using the given set of options. Any option
4105 # not specified will be reset to its default value regardless of its
4106 # previous status. If an option cannot be changed or a particular
4107 # driver does not support reopening then the command will return an
4108 # error.
4110 # The top-level @node-name option (from BlockdevOptions) must be
4111 # specified and is used to select the block device to be reopened.
4112 # Other @node-name options must be either omitted or set to the
4113 # current name of the appropriate node. This command won't change any
4114 # node name and any attempt to do it will result in an error.
4116 # In the case of options that refer to child nodes, the behavior of
4117 # this command depends on the value:
4119 #  1) A set of options (BlockdevOptions): the child is reopened with
4120 #     the specified set of options.
4122 #  2) A reference to the current child: the child is reopened using
4123 #     its existing set of options.
4125 #  3) A reference to a different node: the current child is replaced
4126 #     with the specified one.
4128 #  4) NULL: the current child (if any) is detached.
4130 # Options (1) and (2) are supported in all cases, but at the moment
4131 # only @backing allows replacing or detaching an existing child.
4133 # Unlike with blockdev-add, the @backing option must always be present
4134 # unless the node being reopened does not have a backing file and its
4135 # image does not have a default backing file name as part of its
4136 # metadata.
4138 # Since: 4.0
4140 { 'command': 'x-blockdev-reopen',
4141   'data': 'BlockdevOptions', 'boxed': true }
4144 # @blockdev-del:
4146 # Deletes a block device that has been added using blockdev-add.
4147 # The command will fail if the node is attached to a device or is
4148 # otherwise being used.
4150 # @node-name: Name of the graph node to delete.
4152 # Since: 2.9
4154 # Example:
4156 # -> { "execute": "blockdev-add",
4157 #      "arguments": {
4158 #           "driver": "qcow2",
4159 #           "node-name": "node0",
4160 #           "file": {
4161 #               "driver": "file",
4162 #               "filename": "test.qcow2"
4163 #           }
4164 #      }
4165 #    }
4166 # <- { "return": {} }
4168 # -> { "execute": "blockdev-del",
4169 #      "arguments": { "node-name": "node0" }
4170 #    }
4171 # <- { "return": {} }
4174 { 'command': 'blockdev-del', 'data': { 'node-name': 'str' } }
4177 # @BlockdevCreateOptionsFile:
4179 # Driver specific image creation options for file.
4181 # @filename: Filename for the new image file
4182 # @size: Size of the virtual disk in bytes
4183 # @preallocation: Preallocation mode for the new image (default: off;
4184 #                 allowed values: off,
4185 #                 falloc (if defined CONFIG_POSIX_FALLOCATE),
4186 #                 full (if defined CONFIG_POSIX))
4187 # @nocow: Turn off copy-on-write (valid only on btrfs; default: off)
4189 # Since: 2.12
4191 { 'struct': 'BlockdevCreateOptionsFile',
4192   'data': { 'filename':         'str',
4193             'size':             'size',
4194             '*preallocation':   'PreallocMode',
4195             '*nocow':           'bool' } }
4198 # @BlockdevCreateOptionsGluster:
4200 # Driver specific image creation options for gluster.
4202 # @location: Where to store the new image file
4203 # @size: Size of the virtual disk in bytes
4204 # @preallocation: Preallocation mode for the new image (default: off;
4205 #                 allowed values: off,
4206 #                 falloc (if defined CONFIG_GLUSTERFS_FALLOCATE),
4207 #                 full (if defined CONFIG_GLUSTERFS_ZEROFILL))
4209 # Since: 2.12
4211 { 'struct': 'BlockdevCreateOptionsGluster',
4212   'data': { 'location':         'BlockdevOptionsGluster',
4213             'size':             'size',
4214             '*preallocation':   'PreallocMode' } }
4217 # @BlockdevCreateOptionsLUKS:
4219 # Driver specific image creation options for LUKS.
4221 # @file: Node to create the image format on
4222 # @size: Size of the virtual disk in bytes
4223 # @preallocation: Preallocation mode for the new image
4224 #                 (since: 4.2)
4225 #                 (default: off; allowed values: off, metadata, falloc, full)
4227 # Since: 2.12
4229 { 'struct': 'BlockdevCreateOptionsLUKS',
4230   'base': 'QCryptoBlockCreateOptionsLUKS',
4231   'data': { 'file':             'BlockdevRef',
4232             'size':             'size',
4233             '*preallocation':   'PreallocMode' } }
4236 # @BlockdevCreateOptionsNfs:
4238 # Driver specific image creation options for NFS.
4240 # @location: Where to store the new image file
4241 # @size: Size of the virtual disk in bytes
4243 # Since: 2.12
4245 { 'struct': 'BlockdevCreateOptionsNfs',
4246   'data': { 'location':         'BlockdevOptionsNfs',
4247             'size':             'size' } }
4250 # @BlockdevCreateOptionsParallels:
4252 # Driver specific image creation options for parallels.
4254 # @file: Node to create the image format on
4255 # @size: Size of the virtual disk in bytes
4256 # @cluster-size: Cluster size in bytes (default: 1 MB)
4258 # Since: 2.12
4260 { 'struct': 'BlockdevCreateOptionsParallels',
4261   'data': { 'file':             'BlockdevRef',
4262             'size':             'size',
4263             '*cluster-size':    'size' } }
4266 # @BlockdevCreateOptionsQcow:
4268 # Driver specific image creation options for qcow.
4270 # @file: Node to create the image format on
4271 # @size: Size of the virtual disk in bytes
4272 # @backing-file: File name of the backing file if a backing file
4273 #                should be used
4274 # @encrypt: Encryption options if the image should be encrypted
4276 # Since: 2.12
4278 { 'struct': 'BlockdevCreateOptionsQcow',
4279   'data': { 'file':             'BlockdevRef',
4280             'size':             'size',
4281             '*backing-file':    'str',
4282             '*encrypt':         'QCryptoBlockCreateOptions' } }
4285 # @BlockdevQcow2Version:
4287 # @v2:  The original QCOW2 format as introduced in qemu 0.10 (version 2)
4288 # @v3:  The extended QCOW2 format as introduced in qemu 1.1 (version 3)
4290 # Since: 2.12
4292 { 'enum': 'BlockdevQcow2Version',
4293   'data': [ 'v2', 'v3' ] }
4297 # @Qcow2CompressionType:
4299 # Compression type used in qcow2 image file
4301 # @zlib: zlib compression, see <http://zlib.net/>
4302 # @zstd: zstd compression, see <http://github.com/facebook/zstd>
4304 # Since: 5.1
4306 { 'enum': 'Qcow2CompressionType',
4307   'data': [ 'zlib', { 'name': 'zstd', 'if': 'defined(CONFIG_ZSTD)' } ] }
4310 # @BlockdevCreateOptionsQcow2:
4312 # Driver specific image creation options for qcow2.
4314 # @file: Node to create the image format on
4315 # @data-file: Node to use as an external data file in which all guest
4316 #             data is stored so that only metadata remains in the qcow2
4317 #             file (since: 4.0)
4318 # @data-file-raw: True if the external data file must stay valid as a
4319 #                 standalone (read-only) raw image without looking at qcow2
4320 #                 metadata (default: false; since: 4.0)
4321 # @size: Size of the virtual disk in bytes
4322 # @version: Compatibility level (default: v3)
4323 # @backing-file: File name of the backing file if a backing file
4324 #                should be used
4325 # @backing-fmt: Name of the block driver to use for the backing file
4326 # @encrypt: Encryption options if the image should be encrypted
4327 # @cluster-size: qcow2 cluster size in bytes (default: 65536)
4328 # @preallocation: Preallocation mode for the new image (default: off;
4329 #                 allowed values: off, falloc, full, metadata)
4330 # @lazy-refcounts: True if refcounts may be updated lazily (default: off)
4331 # @refcount-bits: Width of reference counts in bits (default: 16)
4332 # @compression-type: The image cluster compression method
4333 #                    (default: zlib, since 5.1)
4335 # Since: 2.12
4337 { 'struct': 'BlockdevCreateOptionsQcow2',
4338   'data': { 'file':             'BlockdevRef',
4339             '*data-file':       'BlockdevRef',
4340             '*data-file-raw':   'bool',
4341             'size':             'size',
4342             '*version':         'BlockdevQcow2Version',
4343             '*backing-file':    'str',
4344             '*backing-fmt':     'BlockdevDriver',
4345             '*encrypt':         'QCryptoBlockCreateOptions',
4346             '*cluster-size':    'size',
4347             '*preallocation':   'PreallocMode',
4348             '*lazy-refcounts':  'bool',
4349             '*refcount-bits':   'int',
4350             '*compression-type':'Qcow2CompressionType' } }
4353 # @BlockdevCreateOptionsQed:
4355 # Driver specific image creation options for qed.
4357 # @file: Node to create the image format on
4358 # @size: Size of the virtual disk in bytes
4359 # @backing-file: File name of the backing file if a backing file
4360 #                should be used
4361 # @backing-fmt: Name of the block driver to use for the backing file
4362 # @cluster-size: Cluster size in bytes (default: 65536)
4363 # @table-size: L1/L2 table size (in clusters)
4365 # Since: 2.12
4367 { 'struct': 'BlockdevCreateOptionsQed',
4368   'data': { 'file':             'BlockdevRef',
4369             'size':             'size',
4370             '*backing-file':    'str',
4371             '*backing-fmt':     'BlockdevDriver',
4372             '*cluster-size':    'size',
4373             '*table-size':      'int' } }
4376 # @BlockdevCreateOptionsRbd:
4378 # Driver specific image creation options for rbd/Ceph.
4380 # @location: Where to store the new image file. This location cannot
4381 #            point to a snapshot.
4382 # @size: Size of the virtual disk in bytes
4383 # @cluster-size: RBD object size
4385 # Since: 2.12
4387 { 'struct': 'BlockdevCreateOptionsRbd',
4388   'data': { 'location':         'BlockdevOptionsRbd',
4389             'size':             'size',
4390             '*cluster-size' :   'size' } }
4393 # @BlockdevVmdkSubformat:
4395 # Subformat options for VMDK images
4397 # @monolithicSparse:     Single file image with sparse cluster allocation
4399 # @monolithicFlat:       Single flat data image and a descriptor file
4401 # @twoGbMaxExtentSparse: Data is split into 2GB (per virtual LBA) sparse extent
4402 #                        files, in addition to a descriptor file
4404 # @twoGbMaxExtentFlat:   Data is split into 2GB (per virtual LBA) flat extent
4405 #                        files, in addition to a descriptor file
4407 # @streamOptimized:      Single file image sparse cluster allocation, optimized
4408 #                        for streaming over network.
4410 # Since: 4.0
4412 { 'enum': 'BlockdevVmdkSubformat',
4413   'data': [ 'monolithicSparse', 'monolithicFlat', 'twoGbMaxExtentSparse',
4414             'twoGbMaxExtentFlat', 'streamOptimized'] }
4417 # @BlockdevVmdkAdapterType:
4419 # Adapter type info for VMDK images
4421 # Since: 4.0
4423 { 'enum': 'BlockdevVmdkAdapterType',
4424   'data': [ 'ide', 'buslogic', 'lsilogic', 'legacyESX'] }
4427 # @BlockdevCreateOptionsVmdk:
4429 # Driver specific image creation options for VMDK.
4431 # @file: Where to store the new image file. This refers to the image
4432 #        file for monolithcSparse and streamOptimized format, or the
4433 #        descriptor file for other formats.
4434 # @size: Size of the virtual disk in bytes
4435 # @extents: Where to store the data extents. Required for monolithcFlat,
4436 #           twoGbMaxExtentSparse and twoGbMaxExtentFlat formats. For
4437 #           monolithicFlat, only one entry is required; for
4438 #           twoGbMaxExtent* formats, the number of entries required is
4439 #           calculated as extent_number = virtual_size / 2GB. Providing
4440 #           more extents than will be used is an error.
4441 # @subformat: The subformat of the VMDK image. Default: "monolithicSparse".
4442 # @backing-file: The path of backing file. Default: no backing file is used.
4443 # @adapter-type: The adapter type used to fill in the descriptor. Default: ide.
4444 # @hwversion: Hardware version. The meaningful options are "4" or "6".
4445 #             Default: "4".
4446 # @zeroed-grain: Whether to enable zeroed-grain feature for sparse subformats.
4447 #                Default: false.
4449 # Since: 4.0
4451 { 'struct': 'BlockdevCreateOptionsVmdk',
4452   'data': { 'file':             'BlockdevRef',
4453             'size':             'size',
4454             '*extents':          ['BlockdevRef'],
4455             '*subformat':       'BlockdevVmdkSubformat',
4456             '*backing-file':    'str',
4457             '*adapter-type':    'BlockdevVmdkAdapterType',
4458             '*hwversion':       'str',
4459             '*zeroed-grain':    'bool' } }
4463 # @SheepdogRedundancyType:
4465 # @full: Create a fully replicated vdi with x copies
4466 # @erasure-coded: Create an erasure coded vdi with x data strips and
4467 #                 y parity strips
4469 # Since: 2.12
4471 { 'enum': 'SheepdogRedundancyType',
4472   'data': [ 'full', 'erasure-coded' ] }
4475 # @SheepdogRedundancyFull:
4477 # @copies: Number of copies to use (between 1 and 31)
4479 # Since: 2.12
4481 { 'struct': 'SheepdogRedundancyFull',
4482   'data': { 'copies': 'int' }}
4485 # @SheepdogRedundancyErasureCoded:
4487 # @data-strips: Number of data strips to use (one of {2,4,8,16})
4488 # @parity-strips: Number of parity strips to use (between 1 and 15)
4490 # Since: 2.12
4492 { 'struct': 'SheepdogRedundancyErasureCoded',
4493   'data': { 'data-strips': 'int',
4494             'parity-strips': 'int' }}
4497 # @SheepdogRedundancy:
4499 # Since: 2.12
4501 { 'union': 'SheepdogRedundancy',
4502   'base': { 'type': 'SheepdogRedundancyType' },
4503   'discriminator': 'type',
4504   'data': { 'full': 'SheepdogRedundancyFull',
4505             'erasure-coded': 'SheepdogRedundancyErasureCoded' } }
4508 # @BlockdevCreateOptionsSheepdog:
4510 # Driver specific image creation options for Sheepdog.
4512 # @location: Where to store the new image file
4513 # @size: Size of the virtual disk in bytes
4514 # @backing-file: File name of a base image
4515 # @preallocation: Preallocation mode for the new image (default: off;
4516 #                 allowed values: off, full)
4517 # @redundancy: Redundancy of the image
4518 # @object-size: Object size of the image
4520 # Since: 2.12
4522 { 'struct': 'BlockdevCreateOptionsSheepdog',
4523   'data': { 'location':         'BlockdevOptionsSheepdog',
4524             'size':             'size',
4525             '*backing-file':    'str',
4526             '*preallocation':   'PreallocMode',
4527             '*redundancy':      'SheepdogRedundancy',
4528             '*object-size':     'size' } }
4531 # @BlockdevCreateOptionsSsh:
4533 # Driver specific image creation options for SSH.
4535 # @location: Where to store the new image file
4536 # @size: Size of the virtual disk in bytes
4538 # Since: 2.12
4540 { 'struct': 'BlockdevCreateOptionsSsh',
4541   'data': { 'location':         'BlockdevOptionsSsh',
4542             'size':             'size' } }
4545 # @BlockdevCreateOptionsVdi:
4547 # Driver specific image creation options for VDI.
4549 # @file: Node to create the image format on
4550 # @size: Size of the virtual disk in bytes
4551 # @preallocation: Preallocation mode for the new image (default: off;
4552 #                 allowed values: off, metadata)
4554 # Since: 2.12
4556 { 'struct': 'BlockdevCreateOptionsVdi',
4557   'data': { 'file':             'BlockdevRef',
4558             'size':             'size',
4559             '*preallocation':   'PreallocMode' } }
4562 # @BlockdevVhdxSubformat:
4564 # @dynamic: Growing image file
4565 # @fixed:   Preallocated fixed-size image file
4567 # Since: 2.12
4569 { 'enum': 'BlockdevVhdxSubformat',
4570   'data': [ 'dynamic', 'fixed' ] }
4573 # @BlockdevCreateOptionsVhdx:
4575 # Driver specific image creation options for vhdx.
4577 # @file: Node to create the image format on
4578 # @size: Size of the virtual disk in bytes
4579 # @log-size: Log size in bytes, must be a multiple of 1 MB
4580 #            (default: 1 MB)
4581 # @block-size: Block size in bytes, must be a multiple of 1 MB and not
4582 #              larger than 256 MB (default: automatically choose a block
4583 #              size depending on the image size)
4584 # @subformat: vhdx subformat (default: dynamic)
4585 # @block-state-zero: Force use of payload blocks of type 'ZERO'. Non-standard,
4586 #                    but default.  Do not set to 'off' when using 'qemu-img
4587 #                    convert' with subformat=dynamic.
4589 # Since: 2.12
4591 { 'struct': 'BlockdevCreateOptionsVhdx',
4592   'data': { 'file':                 'BlockdevRef',
4593             'size':                 'size',
4594             '*log-size':            'size',
4595             '*block-size':          'size',
4596             '*subformat':           'BlockdevVhdxSubformat',
4597             '*block-state-zero':    'bool' } }
4600 # @BlockdevVpcSubformat:
4602 # @dynamic: Growing image file
4603 # @fixed:   Preallocated fixed-size image file
4605 # Since: 2.12
4607 { 'enum': 'BlockdevVpcSubformat',
4608   'data': [ 'dynamic', 'fixed' ] }
4611 # @BlockdevCreateOptionsVpc:
4613 # Driver specific image creation options for vpc (VHD).
4615 # @file: Node to create the image format on
4616 # @size: Size of the virtual disk in bytes
4617 # @subformat: vhdx subformat (default: dynamic)
4618 # @force-size: Force use of the exact byte size instead of rounding to the
4619 #              next size that can be represented in CHS geometry
4620 #              (default: false)
4622 # Since: 2.12
4624 { 'struct': 'BlockdevCreateOptionsVpc',
4625   'data': { 'file':                 'BlockdevRef',
4626             'size':                 'size',
4627             '*subformat':           'BlockdevVpcSubformat',
4628             '*force-size':          'bool' } }
4631 # @BlockdevCreateOptions:
4633 # Options for creating an image format on a given node.
4635 # @driver: block driver to create the image format
4637 # Since: 2.12
4639 { 'union': 'BlockdevCreateOptions',
4640   'base': {
4641       'driver':         'BlockdevDriver' },
4642   'discriminator': 'driver',
4643   'data': {
4644       'file':           'BlockdevCreateOptionsFile',
4645       'gluster':        'BlockdevCreateOptionsGluster',
4646       'luks':           'BlockdevCreateOptionsLUKS',
4647       'nfs':            'BlockdevCreateOptionsNfs',
4648       'parallels':      'BlockdevCreateOptionsParallels',
4649       'qcow':           'BlockdevCreateOptionsQcow',
4650       'qcow2':          'BlockdevCreateOptionsQcow2',
4651       'qed':            'BlockdevCreateOptionsQed',
4652       'rbd':            'BlockdevCreateOptionsRbd',
4653       'sheepdog':       'BlockdevCreateOptionsSheepdog',
4654       'ssh':            'BlockdevCreateOptionsSsh',
4655       'vdi':            'BlockdevCreateOptionsVdi',
4656       'vhdx':           'BlockdevCreateOptionsVhdx',
4657       'vmdk':           'BlockdevCreateOptionsVmdk',
4658       'vpc':            'BlockdevCreateOptionsVpc'
4659   } }
4662 # @blockdev-create:
4664 # Starts a job to create an image format on a given node. The job is
4665 # automatically finalized, but a manual job-dismiss is required.
4667 # @job-id:          Identifier for the newly created job.
4669 # @options:         Options for the image creation.
4671 # Since: 3.0
4673 { 'command': 'blockdev-create',
4674   'data': { 'job-id': 'str',
4675             'options': 'BlockdevCreateOptions' } }
4678 # @BlockdevAmendOptionsLUKS:
4680 # Driver specific image amend options for LUKS.
4682 # Since: 5.1
4684 { 'struct': 'BlockdevAmendOptionsLUKS',
4685   'base': 'QCryptoBlockAmendOptionsLUKS',
4686   'data': { }
4690 # @BlockdevAmendOptions:
4692 # Options for amending an image format
4694 # @driver:          Block driver of the node to amend.
4696 # Since: 5.1
4698 { 'union': 'BlockdevAmendOptions',
4699   'base': {
4700       'driver':         'BlockdevDriver' },
4701   'discriminator': 'driver',
4702   'data': {
4703       'luks':           'BlockdevAmendOptionsLUKS' } }
4706 # @x-blockdev-amend:
4708 # Starts a job to amend format specific options of an existing open block device
4709 # The job is automatically finalized, but a manual job-dismiss is required.
4711 # @job-id:          Identifier for the newly created job.
4713 # @node-name:       Name of the block node to work on
4715 # @options:         Options (driver specific)
4717 # @force:           Allow unsafe operations, format specific
4718 #                   For luks that allows erase of the last active keyslot
4719 #                   (permanent loss of data),
4720 #                   and replacement of an active keyslot
4721 #                   (possible loss of data if IO error happens)
4723 # Since: 5.1
4725 { 'command': 'x-blockdev-amend',
4726   'data': { 'job-id': 'str',
4727             'node-name': 'str',
4728             'options': 'BlockdevAmendOptions',
4729             '*force': 'bool' } }
4732 # @BlockErrorAction:
4734 # An enumeration of action that has been taken when a DISK I/O occurs
4736 # @ignore: error has been ignored
4738 # @report: error has been reported to the device
4740 # @stop: error caused VM to be stopped
4742 # Since: 2.1
4744 { 'enum': 'BlockErrorAction',
4745   'data': [ 'ignore', 'report', 'stop' ] }
4749 # @BLOCK_IMAGE_CORRUPTED:
4751 # Emitted when a disk image is being marked corrupt. The image can be
4752 # identified by its device or node name. The 'device' field is always
4753 # present for compatibility reasons, but it can be empty ("") if the
4754 # image does not have a device name associated.
4756 # @device: device name. This is always present for compatibility
4757 #          reasons, but it can be empty ("") if the image does not
4758 #          have a device name associated.
4760 # @node-name: node name (Since: 2.4)
4762 # @msg: informative message for human consumption, such as the kind of
4763 #       corruption being detected. It should not be parsed by machine as it is
4764 #       not guaranteed to be stable
4766 # @offset: if the corruption resulted from an image access, this is
4767 #          the host's access offset into the image
4769 # @size: if the corruption resulted from an image access, this is
4770 #        the access size
4772 # @fatal: if set, the image is marked corrupt and therefore unusable after this
4773 #         event and must be repaired (Since 2.2; before, every
4774 #         BLOCK_IMAGE_CORRUPTED event was fatal)
4776 # Note: If action is "stop", a STOP event will eventually follow the
4777 #       BLOCK_IO_ERROR event.
4779 # Example:
4781 # <- { "event": "BLOCK_IMAGE_CORRUPTED",
4782 #      "data": { "device": "ide0-hd0", "node-name": "node0",
4783 #                "msg": "Prevented active L1 table overwrite", "offset": 196608,
4784 #                "size": 65536 },
4785 #      "timestamp": { "seconds": 1378126126, "microseconds": 966463 } }
4787 # Since: 1.7
4789 { 'event': 'BLOCK_IMAGE_CORRUPTED',
4790   'data': { 'device'     : 'str',
4791             '*node-name' : 'str',
4792             'msg'        : 'str',
4793             '*offset'    : 'int',
4794             '*size'      : 'int',
4795             'fatal'      : 'bool' } }
4798 # @BLOCK_IO_ERROR:
4800 # Emitted when a disk I/O error occurs
4802 # @device: device name. This is always present for compatibility
4803 #          reasons, but it can be empty ("") if the image does not
4804 #          have a device name associated.
4806 # @node-name: node name. Note that errors may be reported for the root node
4807 #             that is directly attached to a guest device rather than for the
4808 #             node where the error occurred. The node name is not present if
4809 #             the drive is empty. (Since: 2.8)
4811 # @operation: I/O operation
4813 # @action: action that has been taken
4815 # @nospace: true if I/O error was caused due to a no-space
4816 #           condition. This key is only present if query-block's
4817 #           io-status is present, please see query-block documentation
4818 #           for more information (since: 2.2)
4820 # @reason: human readable string describing the error cause.
4821 #          (This field is a debugging aid for humans, it should not
4822 #          be parsed by applications) (since: 2.2)
4824 # Note: If action is "stop", a STOP event will eventually follow the
4825 #       BLOCK_IO_ERROR event
4827 # Since: 0.13.0
4829 # Example:
4831 # <- { "event": "BLOCK_IO_ERROR",
4832 #      "data": { "device": "ide0-hd1",
4833 #                "node-name": "#block212",
4834 #                "operation": "write",
4835 #                "action": "stop" },
4836 #      "timestamp": { "seconds": 1265044230, "microseconds": 450486 } }
4839 { 'event': 'BLOCK_IO_ERROR',
4840   'data': { 'device': 'str', '*node-name': 'str',
4841             'operation': 'IoOperationType',
4842             'action': 'BlockErrorAction', '*nospace': 'bool',
4843             'reason': 'str' } }
4846 # @BLOCK_JOB_COMPLETED:
4848 # Emitted when a block job has completed
4850 # @type: job type
4852 # @device: The job identifier. Originally the device name but other
4853 #          values are allowed since QEMU 2.7
4855 # @len: maximum progress value
4857 # @offset: current progress value. On success this is equal to len.
4858 #          On failure this is less than len
4860 # @speed: rate limit, bytes per second
4862 # @error: error message. Only present on failure. This field
4863 #         contains a human-readable error message. There are no semantics
4864 #         other than that streaming has failed and clients should not try to
4865 #         interpret the error string
4867 # Since: 1.1
4869 # Example:
4871 # <- { "event": "BLOCK_JOB_COMPLETED",
4872 #      "data": { "type": "stream", "device": "virtio-disk0",
4873 #                "len": 10737418240, "offset": 10737418240,
4874 #                "speed": 0 },
4875 #      "timestamp": { "seconds": 1267061043, "microseconds": 959568 } }
4878 { 'event': 'BLOCK_JOB_COMPLETED',
4879   'data': { 'type'  : 'JobType',
4880             'device': 'str',
4881             'len'   : 'int',
4882             'offset': 'int',
4883             'speed' : 'int',
4884             '*error': 'str' } }
4887 # @BLOCK_JOB_CANCELLED:
4889 # Emitted when a block job has been cancelled
4891 # @type: job type
4893 # @device: The job identifier. Originally the device name but other
4894 #          values are allowed since QEMU 2.7
4896 # @len: maximum progress value
4898 # @offset: current progress value. On success this is equal to len.
4899 #          On failure this is less than len
4901 # @speed: rate limit, bytes per second
4903 # Since: 1.1
4905 # Example:
4907 # <- { "event": "BLOCK_JOB_CANCELLED",
4908 #      "data": { "type": "stream", "device": "virtio-disk0",
4909 #                "len": 10737418240, "offset": 134217728,
4910 #                "speed": 0 },
4911 #      "timestamp": { "seconds": 1267061043, "microseconds": 959568 } }
4914 { 'event': 'BLOCK_JOB_CANCELLED',
4915   'data': { 'type'  : 'JobType',
4916             'device': 'str',
4917             'len'   : 'int',
4918             'offset': 'int',
4919             'speed' : 'int' } }
4922 # @BLOCK_JOB_ERROR:
4924 # Emitted when a block job encounters an error
4926 # @device: The job identifier. Originally the device name but other
4927 #          values are allowed since QEMU 2.7
4929 # @operation: I/O operation
4931 # @action: action that has been taken
4933 # Since: 1.3
4935 # Example:
4937 # <- { "event": "BLOCK_JOB_ERROR",
4938 #      "data": { "device": "ide0-hd1",
4939 #                "operation": "write",
4940 #                "action": "stop" },
4941 #      "timestamp": { "seconds": 1265044230, "microseconds": 450486 } }
4944 { 'event': 'BLOCK_JOB_ERROR',
4945   'data': { 'device'   : 'str',
4946             'operation': 'IoOperationType',
4947             'action'   : 'BlockErrorAction' } }
4950 # @BLOCK_JOB_READY:
4952 # Emitted when a block job is ready to complete
4954 # @type: job type
4956 # @device: The job identifier. Originally the device name but other
4957 #          values are allowed since QEMU 2.7
4959 # @len: maximum progress value
4961 # @offset: current progress value. On success this is equal to len.
4962 #          On failure this is less than len
4964 # @speed: rate limit, bytes per second
4966 # Note: The "ready to complete" status is always reset by a @BLOCK_JOB_ERROR
4967 #       event
4969 # Since: 1.3
4971 # Example:
4973 # <- { "event": "BLOCK_JOB_READY",
4974 #      "data": { "device": "drive0", "type": "mirror", "speed": 0,
4975 #                "len": 2097152, "offset": 2097152 }
4976 #      "timestamp": { "seconds": 1265044230, "microseconds": 450486 } }
4979 { 'event': 'BLOCK_JOB_READY',
4980   'data': { 'type'  : 'JobType',
4981             'device': 'str',
4982             'len'   : 'int',
4983             'offset': 'int',
4984             'speed' : 'int' } }
4987 # @BLOCK_JOB_PENDING:
4989 # Emitted when a block job is awaiting explicit authorization to finalize graph
4990 # changes via @block-job-finalize. If this job is part of a transaction, it will
4991 # not emit this event until the transaction has converged first.
4993 # @type: job type
4995 # @id: The job identifier.
4997 # Since: 2.12
4999 # Example:
5001 # <- { "event": "BLOCK_JOB_WAITING",
5002 #      "data": { "device": "drive0", "type": "mirror" },
5003 #      "timestamp": { "seconds": 1265044230, "microseconds": 450486 } }
5006 { 'event': 'BLOCK_JOB_PENDING',
5007   'data': { 'type'  : 'JobType',
5008             'id'    : 'str' } }
5011 # @PreallocMode:
5013 # Preallocation mode of QEMU image file
5015 # @off: no preallocation
5016 # @metadata: preallocate only for metadata
5017 # @falloc: like @full preallocation but allocate disk space by
5018 #          posix_fallocate() rather than writing data.
5019 # @full: preallocate all data by writing it to the device to ensure
5020 #        disk space is really available. This data may or may not be
5021 #        zero, depending on the image format and storage.
5022 #        @full preallocation also sets up metadata correctly.
5024 # Since: 2.2
5026 { 'enum': 'PreallocMode',
5027   'data': [ 'off', 'metadata', 'falloc', 'full' ] }
5030 # @BLOCK_WRITE_THRESHOLD:
5032 # Emitted when writes on block device reaches or exceeds the
5033 # configured write threshold. For thin-provisioned devices, this
5034 # means the device should be extended to avoid pausing for
5035 # disk exhaustion.
5036 # The event is one shot. Once triggered, it needs to be
5037 # re-registered with another block-set-write-threshold command.
5039 # @node-name: graph node name on which the threshold was exceeded.
5041 # @amount-exceeded: amount of data which exceeded the threshold, in bytes.
5043 # @write-threshold: last configured threshold, in bytes.
5045 # Since: 2.3
5047 { 'event': 'BLOCK_WRITE_THRESHOLD',
5048   'data': { 'node-name': 'str',
5049             'amount-exceeded': 'uint64',
5050             'write-threshold': 'uint64' } }
5053 # @block-set-write-threshold:
5055 # Change the write threshold for a block drive. An event will be
5056 # delivered if a write to this block drive crosses the configured
5057 # threshold.  The threshold is an offset, thus must be
5058 # non-negative. Default is no write threshold. Setting the threshold
5059 # to zero disables it.
5061 # This is useful to transparently resize thin-provisioned drives without
5062 # the guest OS noticing.
5064 # @node-name: graph node name on which the threshold must be set.
5066 # @write-threshold: configured threshold for the block device, bytes.
5067 #                   Use 0 to disable the threshold.
5069 # Since: 2.3
5071 # Example:
5073 # -> { "execute": "block-set-write-threshold",
5074 #      "arguments": { "node-name": "mydev",
5075 #                     "write-threshold": 17179869184 } }
5076 # <- { "return": {} }
5079 { 'command': 'block-set-write-threshold',
5080   'data': { 'node-name': 'str', 'write-threshold': 'uint64' } }
5083 # @x-blockdev-change:
5085 # Dynamically reconfigure the block driver state graph. It can be used
5086 # to add, remove, insert or replace a graph node. Currently only the
5087 # Quorum driver implements this feature to add or remove its child. This
5088 # is useful to fix a broken quorum child.
5090 # If @node is specified, it will be inserted under @parent. @child
5091 # may not be specified in this case. If both @parent and @child are
5092 # specified but @node is not, @child will be detached from @parent.
5094 # @parent: the id or name of the parent node.
5096 # @child: the name of a child under the given parent node.
5098 # @node: the name of the node that will be added.
5100 # Note: this command is experimental, and its API is not stable. It
5101 #       does not support all kinds of operations, all kinds of children, nor
5102 #       all block drivers.
5104 #       FIXME Removing children from a quorum node means introducing gaps in the
5105 #       child indices. This cannot be represented in the 'children' list of
5106 #       BlockdevOptionsQuorum, as returned by .bdrv_refresh_filename().
5108 #       Warning: The data in a new quorum child MUST be consistent with that of
5109 #       the rest of the array.
5111 # Since: 2.7
5113 # Example:
5115 # 1. Add a new node to a quorum
5116 # -> { "execute": "blockdev-add",
5117 #      "arguments": {
5118 #          "driver": "raw",
5119 #          "node-name": "new_node",
5120 #          "file": { "driver": "file",
5121 #                    "filename": "test.raw" } } }
5122 # <- { "return": {} }
5123 # -> { "execute": "x-blockdev-change",
5124 #      "arguments": { "parent": "disk1",
5125 #                     "node": "new_node" } }
5126 # <- { "return": {} }
5128 # 2. Delete a quorum's node
5129 # -> { "execute": "x-blockdev-change",
5130 #      "arguments": { "parent": "disk1",
5131 #                     "child": "children.1" } }
5132 # <- { "return": {} }
5135 { 'command': 'x-blockdev-change',
5136   'data' : { 'parent': 'str',
5137              '*child': 'str',
5138              '*node': 'str' } }
5141 # @x-blockdev-set-iothread:
5143 # Move @node and its children into the @iothread.  If @iothread is null then
5144 # move @node and its children into the main loop.
5146 # The node must not be attached to a BlockBackend.
5148 # @node-name: the name of the block driver node
5150 # @iothread: the name of the IOThread object or null for the main loop
5152 # @force: true if the node and its children should be moved when a BlockBackend
5153 #         is already attached
5155 # Note: this command is experimental and intended for test cases that need
5156 #       control over IOThreads only.
5158 # Since: 2.12
5160 # Example:
5162 # 1. Move a node into an IOThread
5163 # -> { "execute": "x-blockdev-set-iothread",
5164 #      "arguments": { "node-name": "disk1",
5165 #                     "iothread": "iothread0" } }
5166 # <- { "return": {} }
5168 # 2. Move a node into the main loop
5169 # -> { "execute": "x-blockdev-set-iothread",
5170 #      "arguments": { "node-name": "disk1",
5171 #                     "iothread": null } }
5172 # <- { "return": {} }
5175 { 'command': 'x-blockdev-set-iothread',
5176   'data' : { 'node-name': 'str',
5177              'iothread': 'StrOrNull',
5178              '*force': 'bool' } }
5181 # @NbdServerOptions:
5183 # @addr: Address on which to listen.
5184 # @tls-creds: ID of the TLS credentials object (since 2.6).
5185 # @tls-authz: ID of the QAuthZ authorization object used to validate
5186 #             the client's x509 distinguished name. This object is
5187 #             is only resolved at time of use, so can be deleted and
5188 #             recreated on the fly while the NBD server is active.
5189 #             If missing, it will default to denying access (since 4.0).
5191 # Keep this type consistent with the nbd-server-start arguments. The only
5192 # intended difference is using SocketAddress instead of SocketAddressLegacy.
5194 # Since: 4.2
5196 { 'struct': 'NbdServerOptions',
5197   'data': { 'addr': 'SocketAddress',
5198             '*tls-creds': 'str',
5199             '*tls-authz': 'str'} }
5202 # @nbd-server-start:
5204 # Start an NBD server listening on the given host and port.  Block
5205 # devices can then be exported using @nbd-server-add.  The NBD
5206 # server will present them as named exports; for example, another
5207 # QEMU instance could refer to them as "nbd:HOST:PORT:exportname=NAME".
5209 # @addr: Address on which to listen.
5210 # @tls-creds: ID of the TLS credentials object (since 2.6).
5211 # @tls-authz: ID of the QAuthZ authorization object used to validate
5212 #             the client's x509 distinguished name. This object is
5213 #             is only resolved at time of use, so can be deleted and
5214 #             recreated on the fly while the NBD server is active.
5215 #             If missing, it will default to denying access (since 4.0).
5217 # Returns: error if the server is already running.
5219 # Keep this type consistent with the NbdServerOptions type. The only intended
5220 # difference is using SocketAddressLegacy instead of SocketAddress.
5222 # Since: 1.3.0
5224 { 'command': 'nbd-server-start',
5225   'data': { 'addr': 'SocketAddressLegacy',
5226             '*tls-creds': 'str',
5227             '*tls-authz': 'str'} }
5230 # @BlockExportNbd:
5232 # An NBD block export.
5234 # @device: The device name or node name of the node to be exported
5236 # @name: Export name. If unspecified, the @device parameter is used as the
5237 #        export name. (Since 2.12)
5239 # @description: Free-form description of the export, up to 4096 bytes.
5240 #               (Since 5.0)
5242 # @writable: Whether clients should be able to write to the device via the
5243 #            NBD connection (default false).
5245 # @bitmap: Also export the dirty bitmap reachable from @device, so the
5246 #          NBD client can use NBD_OPT_SET_META_CONTEXT with
5247 #          "qemu:dirty-bitmap:NAME" to inspect the bitmap. (since 4.0)
5249 # Since: 5.0
5251 { 'struct': 'BlockExportNbd',
5252   'data': {'device': 'str', '*name': 'str', '*description': 'str',
5253            '*writable': 'bool', '*bitmap': 'str' } }
5256 # @nbd-server-add:
5258 # Export a block node to QEMU's embedded NBD server.
5260 # Returns: error if the server is not running, or export with the same name
5261 #          already exists.
5263 # Since: 1.3.0
5265 { 'command': 'nbd-server-add',
5266   'data': 'BlockExportNbd', 'boxed': true }
5269 # @NbdServerRemoveMode:
5271 # Mode for removing an NBD export.
5273 # @safe: Remove export if there are no existing connections, fail otherwise.
5275 # @hard: Drop all connections immediately and remove export.
5277 # Potential additional modes to be added in the future:
5279 # hide: Just hide export from new clients, leave existing connections as is.
5280 # Remove export after all clients are disconnected.
5282 # soft: Hide export from new clients, answer with ESHUTDOWN for all further
5283 # requests from existing clients.
5285 # Since: 2.12
5287 {'enum': 'NbdServerRemoveMode', 'data': ['safe', 'hard']}
5290 # @nbd-server-remove:
5292 # Remove NBD export by name.
5294 # @name: Export name.
5296 # @mode: Mode of command operation. See @NbdServerRemoveMode description.
5297 #        Default is 'safe'.
5299 # Returns: error if
5300 #            - the server is not running
5301 #            - export is not found
5302 #            - mode is 'safe' and there are existing connections
5304 # Since: 2.12
5306 { 'command': 'nbd-server-remove',
5307   'data': {'name': 'str', '*mode': 'NbdServerRemoveMode'} }
5310 # @nbd-server-stop:
5312 # Stop QEMU's embedded NBD server, and unregister all devices previously
5313 # added via @nbd-server-add.
5315 # Since: 1.3.0
5317 { 'command': 'nbd-server-stop' }
5320 # @BlockExportType:
5322 # An enumeration of block export types
5324 # @nbd: NBD export
5326 # Since: 4.2
5328 { 'enum': 'BlockExportType',
5329   'data': [ 'nbd' ] }
5332 # @BlockExport:
5334 # Describes a block export, i.e. how single node should be exported on an
5335 # external interface.
5337 # Since: 4.2
5339 { 'union': 'BlockExport',
5340   'base': { 'type': 'BlockExportType' },
5341   'discriminator': 'type',
5342   'data': {
5343       'nbd': 'BlockExportNbd'
5344    } }
5347 # @QuorumOpType:
5349 # An enumeration of the quorum operation types
5351 # @read: read operation
5353 # @write: write operation
5355 # @flush: flush operation
5357 # Since: 2.6
5359 { 'enum': 'QuorumOpType',
5360   'data': [ 'read', 'write', 'flush' ] }
5363 # @QUORUM_FAILURE:
5365 # Emitted by the Quorum block driver if it fails to establish a quorum
5367 # @reference: device name if defined else node name
5369 # @sector-num: number of the first sector of the failed read operation
5371 # @sectors-count: failed read operation sector count
5373 # Note: This event is rate-limited.
5375 # Since: 2.0
5377 # Example:
5379 # <- { "event": "QUORUM_FAILURE",
5380 #      "data": { "reference": "usr1", "sector-num": 345435, "sectors-count": 5 },
5381 #      "timestamp": { "seconds": 1344522075, "microseconds": 745528 } }
5384 { 'event': 'QUORUM_FAILURE',
5385   'data': { 'reference': 'str', 'sector-num': 'int', 'sectors-count': 'int' } }
5388 # @QUORUM_REPORT_BAD:
5390 # Emitted to report a corruption of a Quorum file
5392 # @type: quorum operation type (Since 2.6)
5394 # @error: error message. Only present on failure. This field
5395 #         contains a human-readable error message. There are no semantics other
5396 #         than that the block layer reported an error and clients should not
5397 #         try to interpret the error string.
5399 # @node-name: the graph node name of the block driver state
5401 # @sector-num: number of the first sector of the failed read operation
5403 # @sectors-count: failed read operation sector count
5405 # Note: This event is rate-limited.
5407 # Since: 2.0
5409 # Example:
5411 # 1. Read operation
5413 # { "event": "QUORUM_REPORT_BAD",
5414 #      "data": { "node-name": "node0", "sector-num": 345435, "sectors-count": 5,
5415 #                "type": "read" },
5416 #      "timestamp": { "seconds": 1344522075, "microseconds": 745528 } }
5418 # 2. Flush operation
5420 # { "event": "QUORUM_REPORT_BAD",
5421 #      "data": { "node-name": "node0", "sector-num": 0, "sectors-count": 2097120,
5422 #                "type": "flush", "error": "Broken pipe" },
5423 #      "timestamp": { "seconds": 1456406829, "microseconds": 291763 } }
5426 { 'event': 'QUORUM_REPORT_BAD',
5427   'data': { 'type': 'QuorumOpType', '*error': 'str', 'node-name': 'str',
5428             'sector-num': 'int', 'sectors-count': 'int' } }
5431 # @BlockdevSnapshotInternal:
5433 # @device: the device name or node-name of a root node to generate the snapshot
5434 #          from
5436 # @name: the name of the internal snapshot to be created
5438 # Notes: In transaction, if @name is empty, or any snapshot matching @name
5439 #        exists, the operation will fail. Only some image formats support it,
5440 #        for example, qcow2, rbd, and sheepdog.
5442 # Since: 1.7
5444 { 'struct': 'BlockdevSnapshotInternal',
5445   'data': { 'device': 'str', 'name': 'str' } }
5448 # @blockdev-snapshot-internal-sync:
5450 # Synchronously take an internal snapshot of a block device, when the
5451 # format of the image used supports it. If the name is an empty
5452 # string, or a snapshot with name already exists, the operation will
5453 # fail.
5455 # For the arguments, see the documentation of BlockdevSnapshotInternal.
5457 # Returns: - nothing on success
5458 #          - If @device is not a valid block device, GenericError
5459 #          - If any snapshot matching @name exists, or @name is empty,
5460 #            GenericError
5461 #          - If the format of the image used does not support it,
5462 #            BlockFormatFeatureNotSupported
5464 # Since: 1.7
5466 # Example:
5468 # -> { "execute": "blockdev-snapshot-internal-sync",
5469 #      "arguments": { "device": "ide-hd0",
5470 #                     "name": "snapshot0" }
5471 #    }
5472 # <- { "return": {} }
5475 { 'command': 'blockdev-snapshot-internal-sync',
5476   'data': 'BlockdevSnapshotInternal' }
5479 # @blockdev-snapshot-delete-internal-sync:
5481 # Synchronously delete an internal snapshot of a block device, when the format
5482 # of the image used support it. The snapshot is identified by name or id or
5483 # both. One of the name or id is required. Return SnapshotInfo for the
5484 # successfully deleted snapshot.
5486 # @device: the device name or node-name of a root node to delete the snapshot
5487 #          from
5489 # @id: optional the snapshot's ID to be deleted
5491 # @name: optional the snapshot's name to be deleted
5493 # Returns: - SnapshotInfo on success
5494 #          - If @device is not a valid block device, GenericError
5495 #          - If snapshot not found, GenericError
5496 #          - If the format of the image used does not support it,
5497 #            BlockFormatFeatureNotSupported
5498 #          - If @id and @name are both not specified, GenericError
5500 # Since: 1.7
5502 # Example:
5504 # -> { "execute": "blockdev-snapshot-delete-internal-sync",
5505 #      "arguments": { "device": "ide-hd0",
5506 #                     "name": "snapshot0" }
5507 #    }
5508 # <- { "return": {
5509 #                    "id": "1",
5510 #                    "name": "snapshot0",
5511 #                    "vm-state-size": 0,
5512 #                    "date-sec": 1000012,
5513 #                    "date-nsec": 10,
5514 #                    "vm-clock-sec": 100,
5515 #                    "vm-clock-nsec": 20
5516 #      }
5517 #    }
5520 { 'command': 'blockdev-snapshot-delete-internal-sync',
5521   'data': { 'device': 'str', '*id': 'str', '*name': 'str'},
5522   'returns': 'SnapshotInfo' }