xref: /openbmc/qemu/qapi/block-core.json (revision 681b86ac506bf994a92f17e5a8dedb278aab6ede)
15db15096SBenoît Canet# -*- Mode: Python -*-
2d3a48372SMarc-André Lureau
3d3a48372SMarc-André Lureau##
4f5cf31c5SMarkus Armbruster# == Block core (VM unrelated)
5d3a48372SMarc-André Lureau##
65db15096SBenoît Canet
75db15096SBenoît Canet{ 'include': 'common.json' }
82031c133SMarkus Armbruster{ 'include': 'crypto.json' }
9bf42508fSKevin Wolf{ 'include': 'job.json' }
10a2ff5a48SMarkus Armbruster{ 'include': 'sockets.json' }
111ad166b6SBenoît Canet
121ad166b6SBenoît Canet##
135072f7b3SMarc-André Lureau# @SnapshotInfo:
141ad166b6SBenoît Canet#
151ad166b6SBenoît Canet# @id: unique snapshot id
161ad166b6SBenoît Canet#
171ad166b6SBenoît Canet# @name: user chosen name
181ad166b6SBenoît Canet#
191ad166b6SBenoît Canet# @vm-state-size: size of the VM state
201ad166b6SBenoît Canet#
211ad166b6SBenoît Canet# @date-sec: UTC date of the snapshot in seconds
221ad166b6SBenoît Canet#
231ad166b6SBenoît Canet# @date-nsec: fractional part in nano seconds to be used with date-sec
241ad166b6SBenoît Canet#
251ad166b6SBenoît Canet# @vm-clock-sec: VM clock relative to boot in seconds
261ad166b6SBenoît Canet#
271ad166b6SBenoît Canet# @vm-clock-nsec: fractional part in nano seconds to be used with vm-clock-sec
281ad166b6SBenoît Canet#
291ad166b6SBenoît Canet# Since: 1.3
301ad166b6SBenoît Canet#
311ad166b6SBenoît Canet##
32895a2a80SEric Blake{ 'struct': 'SnapshotInfo',
331ad166b6SBenoît Canet  'data': { 'id': 'str', 'name': 'str', 'vm-state-size': 'int',
341ad166b6SBenoît Canet            'date-sec': 'int', 'date-nsec': 'int',
351ad166b6SBenoît Canet            'vm-clock-sec': 'int', 'vm-clock-nsec': 'int' } }
361ad166b6SBenoît Canet
371ad166b6SBenoît Canet##
380a12f6f8SDaniel P. Berrange# @ImageInfoSpecificQCow2EncryptionBase:
390a12f6f8SDaniel P. Berrange#
400a12f6f8SDaniel P. Berrange# @format: The encryption format
410a12f6f8SDaniel P. Berrange#
420a12f6f8SDaniel P. Berrange# Since: 2.10
430a12f6f8SDaniel P. Berrange##
440a12f6f8SDaniel P. Berrange{ 'struct': 'ImageInfoSpecificQCow2EncryptionBase',
450a12f6f8SDaniel P. Berrange  'data': { 'format': 'BlockdevQcow2EncryptionFormat'}}
460a12f6f8SDaniel P. Berrange
470a12f6f8SDaniel P. Berrange##
480a12f6f8SDaniel P. Berrange# @ImageInfoSpecificQCow2Encryption:
490a12f6f8SDaniel P. Berrange#
500a12f6f8SDaniel P. Berrange# Since: 2.10
510a12f6f8SDaniel P. Berrange##
520a12f6f8SDaniel P. Berrange{ 'union': 'ImageInfoSpecificQCow2Encryption',
530a12f6f8SDaniel P. Berrange  'base': 'ImageInfoSpecificQCow2EncryptionBase',
540a12f6f8SDaniel P. Berrange  'discriminator': 'format',
5529cd0403SAnton Nefedov  'data': { 'luks': 'QCryptoBlockInfoLUKS' } }
560a12f6f8SDaniel P. Berrange
570a12f6f8SDaniel P. Berrange##
581ad166b6SBenoît Canet# @ImageInfoSpecificQCow2:
591ad166b6SBenoît Canet#
601ad166b6SBenoît Canet# @compat: compatibility level
611ad166b6SBenoît Canet#
629b890bdcSKevin Wolf# @data-file: the filename of the external data file that is stored in the
639b890bdcSKevin Wolf#             image and used as a default for opening the image (since: 4.0)
649b890bdcSKevin Wolf#
656c3944dcSKevin Wolf# @data-file-raw: True if the external data file must stay valid as a
666c3944dcSKevin Wolf#                 standalone (read-only) raw image without looking at qcow2
676c3944dcSKevin Wolf#                 metadata (since: 4.0)
686c3944dcSKevin Wolf#
691d8bda12SMarkus Armbruster# @lazy-refcounts: on or off; only valid for compat >= 1.1
701ad166b6SBenoît Canet#
711d8bda12SMarkus Armbruster# @corrupt: true if the image has been marked corrupt; only valid for
729009b196SMax Reitz#           compat >= 1.1 (since 2.2)
739009b196SMax Reitz#
740709c5a1SMax Reitz# @refcount-bits: width of a refcount entry in bits (since 2.3)
750709c5a1SMax Reitz#
760a12f6f8SDaniel P. Berrange# @encrypt: details about encryption parameters; only set if image
770a12f6f8SDaniel P. Berrange#           is encrypted (since 2.10)
780a12f6f8SDaniel P. Berrange#
79b8968c87SAndrey Shinkevich# @bitmaps: A list of qcow2 bitmap details (since 4.0)
80b8968c87SAndrey Shinkevich#
811ad166b6SBenoît Canet# Since: 1.7
821ad166b6SBenoît Canet##
83895a2a80SEric Blake{ 'struct': 'ImageInfoSpecificQCow2',
841ad166b6SBenoît Canet  'data': {
851ad166b6SBenoît Canet      'compat': 'str',
869b890bdcSKevin Wolf      '*data-file': 'str',
876c3944dcSKevin Wolf      '*data-file-raw': 'bool',
889009b196SMax Reitz      '*lazy-refcounts': 'bool',
890709c5a1SMax Reitz      '*corrupt': 'bool',
900a12f6f8SDaniel P. Berrange      'refcount-bits': 'int',
91b8968c87SAndrey Shinkevich      '*encrypt': 'ImageInfoSpecificQCow2Encryption',
92b8968c87SAndrey Shinkevich      '*bitmaps': ['Qcow2BitmapInfo']
931ad166b6SBenoît Canet  } }
941ad166b6SBenoît Canet
951ad166b6SBenoît Canet##
961ad166b6SBenoît Canet# @ImageInfoSpecificVmdk:
971ad166b6SBenoît Canet#
981ad166b6SBenoît Canet# @create-type: The create type of VMDK image
991ad166b6SBenoît Canet#
1001ad166b6SBenoît Canet# @cid: Content id of image
1011ad166b6SBenoît Canet#
1021ad166b6SBenoît Canet# @parent-cid: Parent VMDK image's cid
1031ad166b6SBenoît Canet#
1041ad166b6SBenoît Canet# @extents: List of extent files
1051ad166b6SBenoît Canet#
1061ad166b6SBenoît Canet# Since: 1.7
1071ad166b6SBenoît Canet##
108895a2a80SEric Blake{ 'struct': 'ImageInfoSpecificVmdk',
1091ad166b6SBenoît Canet  'data': {
1101ad166b6SBenoît Canet      'create-type': 'str',
1111ad166b6SBenoît Canet      'cid': 'int',
1121ad166b6SBenoît Canet      'parent-cid': 'int',
1131ad166b6SBenoît Canet      'extents': ['ImageInfo']
1141ad166b6SBenoît Canet  } }
1151ad166b6SBenoît Canet
1161ad166b6SBenoît Canet##
1171ad166b6SBenoît Canet# @ImageInfoSpecific:
1181ad166b6SBenoît Canet#
1191ad166b6SBenoît Canet# A discriminated record of image format specific information structures.
1201ad166b6SBenoît Canet#
1211ad166b6SBenoît Canet# Since: 1.7
1221ad166b6SBenoît Canet##
1231ad166b6SBenoît Canet{ 'union': 'ImageInfoSpecific',
1241ad166b6SBenoît Canet  'data': {
1251ad166b6SBenoît Canet      'qcow2': 'ImageInfoSpecificQCow2',
126c7c4cf49SDaniel P. Berrange      'vmdk': 'ImageInfoSpecificVmdk',
127c7c4cf49SDaniel P. Berrange      # If we need to add block driver specific parameters for
128c7c4cf49SDaniel P. Berrange      # LUKS in future, then we'll subclass QCryptoBlockInfoLUKS
129c7c4cf49SDaniel P. Berrange      # to define a ImageInfoSpecificLUKS
130c7c4cf49SDaniel P. Berrange      'luks': 'QCryptoBlockInfoLUKS'
1311ad166b6SBenoît Canet  } }
1321ad166b6SBenoît Canet
1331ad166b6SBenoît Canet##
1341ad166b6SBenoît Canet# @ImageInfo:
1351ad166b6SBenoît Canet#
1361ad166b6SBenoît Canet# Information about a QEMU image file
1371ad166b6SBenoît Canet#
1381ad166b6SBenoît Canet# @filename: name of the image file
1391ad166b6SBenoît Canet#
1401ad166b6SBenoît Canet# @format: format of the image file
1411ad166b6SBenoît Canet#
1421ad166b6SBenoît Canet# @virtual-size: maximum capacity in bytes of the image
1431ad166b6SBenoît Canet#
1441d8bda12SMarkus Armbruster# @actual-size: actual size on disk in bytes of the image
1451ad166b6SBenoît Canet#
1461d8bda12SMarkus Armbruster# @dirty-flag: true if image is not cleanly closed
1471ad166b6SBenoît Canet#
1481d8bda12SMarkus Armbruster# @cluster-size: size of a cluster in bytes
1491ad166b6SBenoît Canet#
1501d8bda12SMarkus Armbruster# @encrypted: true if the image is encrypted
1511ad166b6SBenoît Canet#
1521d8bda12SMarkus Armbruster# @compressed: true if the image is compressed (Since 1.7)
1531ad166b6SBenoît Canet#
1541d8bda12SMarkus Armbruster# @backing-filename: name of the backing file
1551ad166b6SBenoît Canet#
1561d8bda12SMarkus Armbruster# @full-backing-filename: full path of the backing file
1571ad166b6SBenoît Canet#
1581d8bda12SMarkus Armbruster# @backing-filename-format: the format of the backing file
1591ad166b6SBenoît Canet#
1601d8bda12SMarkus Armbruster# @snapshots: list of VM snapshots
1611ad166b6SBenoît Canet#
1621d8bda12SMarkus Armbruster# @backing-image: info of the backing image (since 1.6)
1631ad166b6SBenoît Canet#
1641d8bda12SMarkus Armbruster# @format-specific: structure supplying additional format-specific
1651ad166b6SBenoît Canet# information (since 1.7)
1661ad166b6SBenoît Canet#
1671ad166b6SBenoît Canet# Since: 1.3
1681ad166b6SBenoît Canet#
1691ad166b6SBenoît Canet##
170895a2a80SEric Blake{ 'struct': 'ImageInfo',
1711ad166b6SBenoît Canet  'data': {'filename': 'str', 'format': 'str', '*dirty-flag': 'bool',
1721ad166b6SBenoît Canet           '*actual-size': 'int', 'virtual-size': 'int',
1731ad166b6SBenoît Canet           '*cluster-size': 'int', '*encrypted': 'bool', '*compressed': 'bool',
1741ad166b6SBenoît Canet           '*backing-filename': 'str', '*full-backing-filename': 'str',
1751ad166b6SBenoît Canet           '*backing-filename-format': 'str', '*snapshots': ['SnapshotInfo'],
1761ad166b6SBenoît Canet           '*backing-image': 'ImageInfo',
17724bf10daSKevin Wolf           '*format-specific': 'ImageInfoSpecific' } }
1781ad166b6SBenoît Canet
1791ad166b6SBenoît Canet##
1801ad166b6SBenoît Canet# @ImageCheck:
1811ad166b6SBenoît Canet#
1821ad166b6SBenoît Canet# Information about a QEMU image file check
1831ad166b6SBenoît Canet#
1841ad166b6SBenoît Canet# @filename: name of the image file checked
1851ad166b6SBenoît Canet#
1861ad166b6SBenoît Canet# @format: format of the image file checked
1871ad166b6SBenoît Canet#
1881ad166b6SBenoît Canet# @check-errors: number of unexpected errors occurred during check
1891ad166b6SBenoît Canet#
1901d8bda12SMarkus Armbruster# @image-end-offset: offset (in bytes) where the image ends, this
1911ad166b6SBenoît Canet#                    field is present if the driver for the image format
1921ad166b6SBenoît Canet#                    supports it
1931ad166b6SBenoît Canet#
1941d8bda12SMarkus Armbruster# @corruptions: number of corruptions found during the check if any
1951ad166b6SBenoît Canet#
1961d8bda12SMarkus Armbruster# @leaks: number of leaks found during the check if any
1971ad166b6SBenoît Canet#
1981d8bda12SMarkus Armbruster# @corruptions-fixed: number of corruptions fixed during the check
1991ad166b6SBenoît Canet#                     if any
2001ad166b6SBenoît Canet#
2011d8bda12SMarkus Armbruster# @leaks-fixed: number of leaks fixed during the check if any
2021ad166b6SBenoît Canet#
2031d8bda12SMarkus Armbruster# @total-clusters: total number of clusters, this field is present
2041ad166b6SBenoît Canet#                  if the driver for the image format supports it
2051ad166b6SBenoît Canet#
2061d8bda12SMarkus Armbruster# @allocated-clusters: total number of allocated clusters, this
2071ad166b6SBenoît Canet#                      field is present if the driver for the image format
2081ad166b6SBenoît Canet#                      supports it
2091ad166b6SBenoît Canet#
2101d8bda12SMarkus Armbruster# @fragmented-clusters: total number of fragmented clusters, this
2111ad166b6SBenoît Canet#                       field is present if the driver for the image format
2121ad166b6SBenoît Canet#                       supports it
2131ad166b6SBenoît Canet#
2141d8bda12SMarkus Armbruster# @compressed-clusters: total number of compressed clusters, this
2151ad166b6SBenoît Canet#                       field is present if the driver for the image format
2161ad166b6SBenoît Canet#                       supports it
2171ad166b6SBenoît Canet#
2181ad166b6SBenoît Canet# Since: 1.4
2191ad166b6SBenoît Canet#
2201ad166b6SBenoît Canet##
221895a2a80SEric Blake{ 'struct': 'ImageCheck',
2221ad166b6SBenoît Canet  'data': {'filename': 'str', 'format': 'str', 'check-errors': 'int',
2231ad166b6SBenoît Canet           '*image-end-offset': 'int', '*corruptions': 'int', '*leaks': 'int',
2241ad166b6SBenoît Canet           '*corruptions-fixed': 'int', '*leaks-fixed': 'int',
2251ad166b6SBenoît Canet           '*total-clusters': 'int', '*allocated-clusters': 'int',
2261ad166b6SBenoît Canet           '*fragmented-clusters': 'int', '*compressed-clusters': 'int' } }
2271ad166b6SBenoît Canet
2281ad166b6SBenoît Canet##
22916b0d555SFam Zheng# @MapEntry:
23016b0d555SFam Zheng#
23116b0d555SFam Zheng# Mapping information from a virtual block range to a host file range
23216b0d555SFam Zheng#
23316b0d555SFam Zheng# @start: the start byte of the mapped virtual range
23416b0d555SFam Zheng#
23516b0d555SFam Zheng# @length: the number of bytes of the mapped virtual range
23616b0d555SFam Zheng#
23716b0d555SFam Zheng# @data: whether the mapped range has data
23816b0d555SFam Zheng#
23916b0d555SFam Zheng# @zero: whether the virtual blocks are zeroed
24016b0d555SFam Zheng#
24116b0d555SFam Zheng# @depth: the depth of the mapping
24216b0d555SFam Zheng#
2431d8bda12SMarkus Armbruster# @offset: the offset in file that the virtual sectors are mapped to
24416b0d555SFam Zheng#
2451d8bda12SMarkus Armbruster# @filename: filename that is referred to by @offset
24616b0d555SFam Zheng#
24716b0d555SFam Zheng# Since: 2.6
24816b0d555SFam Zheng#
24916b0d555SFam Zheng##
25016b0d555SFam Zheng{ 'struct': 'MapEntry',
25116b0d555SFam Zheng  'data': {'start': 'int', 'length': 'int', 'data': 'bool',
25216b0d555SFam Zheng           'zero': 'bool', 'depth': 'int', '*offset': 'int',
25316b0d555SFam Zheng           '*filename': 'str' } }
25416b0d555SFam Zheng
25516b0d555SFam Zheng##
2565072f7b3SMarc-André Lureau# @BlockdevCacheInfo:
2579e193c5aSKevin Wolf#
2589e193c5aSKevin Wolf# Cache mode information for a block device
2599e193c5aSKevin Wolf#
2609e193c5aSKevin Wolf# @writeback:   true if writeback mode is enabled
2619e193c5aSKevin Wolf# @direct:      true if the host page cache is bypassed (O_DIRECT)
2629e193c5aSKevin Wolf# @no-flush:    true if flush requests are ignored for the device
2639e193c5aSKevin Wolf#
2649e193c5aSKevin Wolf# Since: 2.3
2659e193c5aSKevin Wolf##
266895a2a80SEric Blake{ 'struct': 'BlockdevCacheInfo',
2679e193c5aSKevin Wolf  'data': { 'writeback': 'bool',
2689e193c5aSKevin Wolf            'direct': 'bool',
2699e193c5aSKevin Wolf            'no-flush': 'bool' } }
2709e193c5aSKevin Wolf
2719e193c5aSKevin Wolf##
2721ad166b6SBenoît Canet# @BlockDeviceInfo:
2731ad166b6SBenoît Canet#
2741ad166b6SBenoît Canet# Information about the backing device for a block device.
2751ad166b6SBenoît Canet#
2761ad166b6SBenoît Canet# @file: the filename of the backing device
2771ad166b6SBenoît Canet#
2781d8bda12SMarkus Armbruster# @node-name: the name of the block driver node (Since 2.0)
2791ad166b6SBenoît Canet#
2801ad166b6SBenoît Canet# @ro: true if the backing device was open read-only
2811ad166b6SBenoît Canet#
2821ad166b6SBenoît Canet# @drv: the name of the block format used to open the backing device. As of
2831ad166b6SBenoît Canet#       0.14.0 this can be: 'blkdebug', 'bochs', 'cloop', 'cow', 'dmg',
2841ad166b6SBenoît Canet#       'file', 'file', 'ftp', 'ftps', 'host_cdrom', 'host_device',
28578368575SDaniel P. Berrange#       'http', 'https', 'luks', 'nbd', 'parallels', 'qcow',
28623dce387SMax Reitz#       'qcow2', 'raw', 'vdi', 'vmdk', 'vpc', 'vvfat'
287550830f9SStefan Hajnoczi#       2.2: 'archipelago' added, 'cow' dropped
28892a539d2SMarkus Armbruster#       2.3: 'host_floppy' deprecated
289f709623bSMax Reitz#       2.5: 'host_floppy' dropped
29078368575SDaniel P. Berrange#       2.6: 'luks' added
29123dce387SMax Reitz#       2.8: 'replication' added, 'tftp' dropped
292e32ccbc6SEric Blake#       2.9: 'archipelago' dropped
2931ad166b6SBenoît Canet#
2941d8bda12SMarkus Armbruster# @backing_file: the name of the backing file (for copy-on-write)
2951ad166b6SBenoît Canet#
2961ad166b6SBenoît Canet# @backing_file_depth: number of files in the backing file chain (since: 1.2)
2971ad166b6SBenoît Canet#
2981ad166b6SBenoît Canet# @encrypted: true if the backing device is encrypted
2991ad166b6SBenoît Canet#
300c01c214bSDaniel P. Berrange# @encryption_key_missing: Deprecated; always false
3011ad166b6SBenoît Canet#
3021ad166b6SBenoît Canet# @detect_zeroes: detect and optimize zero writes (Since 2.1)
3031ad166b6SBenoît Canet#
3041ad166b6SBenoît Canet# @bps: total throughput limit in bytes per second is specified
3051ad166b6SBenoît Canet#
3061ad166b6SBenoît Canet# @bps_rd: read throughput limit in bytes per second is specified
3071ad166b6SBenoît Canet#
3081ad166b6SBenoît Canet# @bps_wr: write throughput limit in bytes per second is specified
3091ad166b6SBenoît Canet#
3101ad166b6SBenoît Canet# @iops: total I/O operations per second is specified
3111ad166b6SBenoît Canet#
3121ad166b6SBenoît Canet# @iops_rd: read I/O operations per second is specified
3131ad166b6SBenoît Canet#
3141ad166b6SBenoît Canet# @iops_wr: write I/O operations per second is specified
3151ad166b6SBenoît Canet#
3161ad166b6SBenoît Canet# @image: the info of image used (since: 1.6)
3171ad166b6SBenoît Canet#
3181d8bda12SMarkus Armbruster# @bps_max: total throughput limit during bursts,
319398befdfSAlberto Garcia#                     in bytes (Since 1.7)
3201ad166b6SBenoît Canet#
3211d8bda12SMarkus Armbruster# @bps_rd_max: read throughput limit during bursts,
322398befdfSAlberto Garcia#                        in bytes (Since 1.7)
3231ad166b6SBenoît Canet#
3241d8bda12SMarkus Armbruster# @bps_wr_max: write throughput limit during bursts,
325398befdfSAlberto Garcia#                        in bytes (Since 1.7)
3261ad166b6SBenoît Canet#
3271d8bda12SMarkus Armbruster# @iops_max: total I/O operations per second during bursts,
328398befdfSAlberto Garcia#                      in bytes (Since 1.7)
3291ad166b6SBenoît Canet#
3301d8bda12SMarkus Armbruster# @iops_rd_max: read I/O operations per second during bursts,
331398befdfSAlberto Garcia#                         in bytes (Since 1.7)
3321ad166b6SBenoît Canet#
3331d8bda12SMarkus Armbruster# @iops_wr_max: write I/O operations per second during bursts,
334398befdfSAlberto Garcia#                         in bytes (Since 1.7)
335398befdfSAlberto Garcia#
3361d8bda12SMarkus Armbruster# @bps_max_length: maximum length of the @bps_max burst
337398befdfSAlberto Garcia#                            period, in seconds. (Since 2.6)
338398befdfSAlberto Garcia#
3391d8bda12SMarkus Armbruster# @bps_rd_max_length: maximum length of the @bps_rd_max
340398befdfSAlberto Garcia#                               burst period, in seconds. (Since 2.6)
341398befdfSAlberto Garcia#
3421d8bda12SMarkus Armbruster# @bps_wr_max_length: maximum length of the @bps_wr_max
343398befdfSAlberto Garcia#                               burst period, in seconds. (Since 2.6)
344398befdfSAlberto Garcia#
3451d8bda12SMarkus Armbruster# @iops_max_length: maximum length of the @iops burst
346398befdfSAlberto Garcia#                             period, in seconds. (Since 2.6)
347398befdfSAlberto Garcia#
3481d8bda12SMarkus Armbruster# @iops_rd_max_length: maximum length of the @iops_rd_max
349398befdfSAlberto Garcia#                                burst period, in seconds. (Since 2.6)
350398befdfSAlberto Garcia#
3511d8bda12SMarkus Armbruster# @iops_wr_max_length: maximum length of the @iops_wr_max
352398befdfSAlberto Garcia#                                burst period, in seconds. (Since 2.6)
3531ad166b6SBenoît Canet#
3541d8bda12SMarkus Armbruster# @iops_size: an I/O size in bytes (Since 1.7)
3551ad166b6SBenoît Canet#
3561d8bda12SMarkus Armbruster# @group: throttle group name (Since 2.4)
357b8fe1694SAlberto Garcia#
3589e193c5aSKevin Wolf# @cache: the cache mode used for the block device (since: 2.3)
3599e193c5aSKevin Wolf#
360e2462113SFrancesco Romani# @write_threshold: configured write threshold for the device.
361e2462113SFrancesco Romani#                   0 if disabled. (Since 2.3)
362e2462113SFrancesco Romani#
3631ad166b6SBenoît Canet# Since: 0.14.0
3641ad166b6SBenoît Canet#
3651ad166b6SBenoît Canet##
366895a2a80SEric Blake{ 'struct': 'BlockDeviceInfo',
3671ad166b6SBenoît Canet  'data': { 'file': 'str', '*node-name': 'str', 'ro': 'bool', 'drv': 'str',
3681ad166b6SBenoît Canet            '*backing_file': 'str', 'backing_file_depth': 'int',
3691ad166b6SBenoît Canet            'encrypted': 'bool', 'encryption_key_missing': 'bool',
3701ad166b6SBenoît Canet            'detect_zeroes': 'BlockdevDetectZeroesOptions',
3711ad166b6SBenoît Canet            'bps': 'int', 'bps_rd': 'int', 'bps_wr': 'int',
3721ad166b6SBenoît Canet            'iops': 'int', 'iops_rd': 'int', 'iops_wr': 'int',
3731ad166b6SBenoît Canet            'image': 'ImageInfo',
3741ad166b6SBenoît Canet            '*bps_max': 'int', '*bps_rd_max': 'int',
3751ad166b6SBenoît Canet            '*bps_wr_max': 'int', '*iops_max': 'int',
3761ad166b6SBenoît Canet            '*iops_rd_max': 'int', '*iops_wr_max': 'int',
377398befdfSAlberto Garcia            '*bps_max_length': 'int', '*bps_rd_max_length': 'int',
378398befdfSAlberto Garcia            '*bps_wr_max_length': 'int', '*iops_max_length': 'int',
379398befdfSAlberto Garcia            '*iops_rd_max_length': 'int', '*iops_wr_max_length': 'int',
380b8fe1694SAlberto Garcia            '*iops_size': 'int', '*group': 'str', 'cache': 'BlockdevCacheInfo',
381e2462113SFrancesco Romani            'write_threshold': 'int' } }
3821ad166b6SBenoît Canet
3831ad166b6SBenoît Canet##
3841ad166b6SBenoît Canet# @BlockDeviceIoStatus:
3851ad166b6SBenoît Canet#
3861ad166b6SBenoît Canet# An enumeration of block device I/O status.
3871ad166b6SBenoît Canet#
3881ad166b6SBenoît Canet# @ok: The last I/O operation has succeeded
3891ad166b6SBenoît Canet#
3901ad166b6SBenoît Canet# @failed: The last I/O operation has failed
3911ad166b6SBenoît Canet#
3921ad166b6SBenoît Canet# @nospace: The last I/O operation has failed due to a no-space condition
3931ad166b6SBenoît Canet#
3941ad166b6SBenoît Canet# Since: 1.0
3951ad166b6SBenoît Canet##
3961ad166b6SBenoît Canet{ 'enum': 'BlockDeviceIoStatus', 'data': [ 'ok', 'failed', 'nospace' ] }
3971ad166b6SBenoît Canet
3981ad166b6SBenoît Canet##
3991ad166b6SBenoît Canet# @BlockDeviceMapEntry:
4001ad166b6SBenoît Canet#
4011ad166b6SBenoît Canet# Entry in the metadata map of the device (returned by "qemu-img map")
4021ad166b6SBenoît Canet#
4031ad166b6SBenoît Canet# @start: Offset in the image of the first byte described by this entry
4041ad166b6SBenoît Canet#         (in bytes)
4051ad166b6SBenoît Canet#
4061ad166b6SBenoît Canet# @length: Length of the range described by this entry (in bytes)
4071ad166b6SBenoît Canet#
4081ad166b6SBenoît Canet# @depth: Number of layers (0 = top image, 1 = top image's backing file, etc.)
4091ad166b6SBenoît Canet#         before reaching one for which the range is allocated.  The value is
4101ad166b6SBenoît Canet#         in the range 0 to the depth of the image chain - 1.
4111ad166b6SBenoît Canet#
4121ad166b6SBenoît Canet# @zero: the sectors in this range read as zeros
4131ad166b6SBenoît Canet#
4141ad166b6SBenoît Canet# @data: reading the image will actually read data from a file (in particular,
4151ad166b6SBenoît Canet#        if @offset is present this means that the sectors are not simply
4161ad166b6SBenoît Canet#        preallocated, but contain actual data in raw format)
4171ad166b6SBenoît Canet#
4181ad166b6SBenoît Canet# @offset: if present, the image file stores the data for this range in
4191ad166b6SBenoît Canet#          raw format at the given offset.
4201ad166b6SBenoît Canet#
4215072f7b3SMarc-André Lureau# Since: 1.7
4221ad166b6SBenoît Canet##
423895a2a80SEric Blake{ 'struct': 'BlockDeviceMapEntry',
4241ad166b6SBenoît Canet  'data': { 'start': 'int', 'length': 'int', 'depth': 'int', 'zero': 'bool',
4251ad166b6SBenoît Canet            'data': 'bool', '*offset': 'int' } }
4261ad166b6SBenoît Canet
4271ad166b6SBenoît Canet##
4289abe3bdcSJohn Snow# @DirtyBitmapStatus:
4299abe3bdcSJohn Snow#
4309abe3bdcSJohn Snow# An enumeration of possible states that a dirty bitmap can report to the user.
4319abe3bdcSJohn Snow#
43273ab5d60SJohn Snow# @frozen: The bitmap is currently in-use by some operation and is immutable.
43373ab5d60SJohn Snow#          If the bitmap was @active prior to the operation, new writes by the
43473ab5d60SJohn Snow#          guest are being recorded in a temporary buffer, and will not be lost.
43573ab5d60SJohn Snow#          Generally, bitmaps are cleared on successful use in an operation and
43673ab5d60SJohn Snow#          the temporary buffer is committed into the bitmap. On failure, the
43773ab5d60SJohn Snow#          temporary buffer is merged back into the bitmap without first
43873ab5d60SJohn Snow#          clearing it.
43973ab5d60SJohn Snow#          Please refer to the documentation for each bitmap-using operation,
44073ab5d60SJohn Snow#          See also @blockdev-backup, @drive-backup.
4419abe3bdcSJohn Snow#
44273ab5d60SJohn Snow# @disabled: The bitmap is not currently recording new writes by the guest.
44373ab5d60SJohn Snow#            This is requested explicitly via @block-dirty-bitmap-disable.
44473ab5d60SJohn Snow#            It can still be cleared, deleted, or used for backup operations.
4459abe3bdcSJohn Snow#
4469abe3bdcSJohn Snow# @active: The bitmap is actively monitoring for new writes, and can be cleared,
4479abe3bdcSJohn Snow#          deleted, or used for backup operations.
4489abe3bdcSJohn Snow#
44973ab5d60SJohn Snow# @locked: The bitmap is currently in-use by some operation and is immutable.
45073ab5d60SJohn Snow#          If the bitmap was @active prior to the operation, it is still
45173ab5d60SJohn Snow#          recording new writes. If the bitmap was @disabled, it is not
45273ab5d60SJohn Snow#          recording new writes. (Since 2.12)
4534f43e953SVladimir Sementsov-Ogievskiy#
4540064cfefSJohn Snow# @inconsistent: This is a persistent dirty bitmap that was marked in-use on
4550064cfefSJohn Snow#                disk, and is unusable by QEMU. It can only be deleted.
4560064cfefSJohn Snow#                Please rely on the inconsistent field in @BlockDirtyInfo
4570064cfefSJohn Snow#                instead, as the status field is deprecated. (Since 4.0)
4580064cfefSJohn Snow#
4599abe3bdcSJohn Snow# Since: 2.4
4609abe3bdcSJohn Snow##
4619abe3bdcSJohn Snow{ 'enum': 'DirtyBitmapStatus',
4620064cfefSJohn Snow  'data': ['active', 'disabled', 'frozen', 'locked', 'inconsistent'] }
4639abe3bdcSJohn Snow
4649abe3bdcSJohn Snow##
4651ad166b6SBenoît Canet# @BlockDirtyInfo:
4661ad166b6SBenoît Canet#
4671ad166b6SBenoît Canet# Block dirty bitmap information.
4681ad166b6SBenoît Canet#
4691d8bda12SMarkus Armbruster# @name: the name of the dirty bitmap (Since 2.4)
4700db6e54aSFam Zheng#
4711ad166b6SBenoît Canet# @count: number of dirty bytes according to the dirty bitmap
4721ad166b6SBenoît Canet#
4731ad166b6SBenoît Canet# @granularity: granularity of the dirty bitmap in bytes (since 1.4)
4741ad166b6SBenoît Canet#
4754db6ceb0SJohn Snow# @status: Deprecated in favor of @recording and @locked. (since 2.4)
476a113534fSJohn Snow#
4774db6ceb0SJohn Snow# @recording: true if the bitmap is recording new writes from the guest.
4784db6ceb0SJohn Snow#             Replaces `active` and `disabled` statuses. (since 4.0)
4794db6ceb0SJohn Snow#
4804db6ceb0SJohn Snow# @busy: true if the bitmap is in-use by some operation (NBD or jobs)
4814db6ceb0SJohn Snow#        and cannot be modified via QMP or used by another operation.
4824db6ceb0SJohn Snow#        Replaces `locked` and `frozen` statuses. (since 4.0)
4831ad166b6SBenoît Canet#
484b0f45559SJohn Snow# @persistent: true if the bitmap was stored on disk, is scheduled to be stored
485b0f45559SJohn Snow#              on disk, or both. (since 4.0)
486b0f45559SJohn Snow#
487b0f45559SJohn Snow# @inconsistent: true if this is a persistent bitmap that was improperly
488b0f45559SJohn Snow#                stored. Implies @persistent to be true; @recording and
489b0f45559SJohn Snow#                @busy to be false. This bitmap cannot be used. To remove
490b0f45559SJohn Snow#                it, use @block-dirty-bitmap-remove. (Since 4.0)
491f67cf661SEric Blake#
4921ad166b6SBenoît Canet# Since: 1.3
4931ad166b6SBenoît Canet##
494895a2a80SEric Blake{ 'struct': 'BlockDirtyInfo',
495a113534fSJohn Snow  'data': {'*name': 'str', 'count': 'int', 'granularity': 'uint32',
496b0f45559SJohn Snow           'recording': 'bool', 'busy': 'bool', 'status': 'DirtyBitmapStatus',
497b0f45559SJohn Snow           'persistent': 'bool', '*inconsistent': 'bool' } }
4981ad166b6SBenoît Canet
4991ad166b6SBenoît Canet##
500b8968c87SAndrey Shinkevich# @Qcow2BitmapInfoFlags:
501b8968c87SAndrey Shinkevich#
502b8968c87SAndrey Shinkevich# An enumeration of flags that a bitmap can report to the user.
503b8968c87SAndrey Shinkevich#
504b8968c87SAndrey Shinkevich# @in-use: This flag is set by any process actively modifying the qcow2 file,
505b8968c87SAndrey Shinkevich#          and cleared when the updated bitmap is flushed to the qcow2 image.
506b8968c87SAndrey Shinkevich#          The presence of this flag in an offline image means that the bitmap
507b8968c87SAndrey Shinkevich#          was not saved correctly after its last usage, and may contain
508b8968c87SAndrey Shinkevich#          inconsistent data.
509b8968c87SAndrey Shinkevich#
510b8968c87SAndrey Shinkevich# @auto: The bitmap must reflect all changes of the virtual disk by any
511b8968c87SAndrey Shinkevich#        application that would write to this qcow2 file.
512b8968c87SAndrey Shinkevich#
513b8968c87SAndrey Shinkevich# Since: 4.0
514b8968c87SAndrey Shinkevich##
515b8968c87SAndrey Shinkevich{ 'enum': 'Qcow2BitmapInfoFlags',
516b8968c87SAndrey Shinkevich  'data': ['in-use', 'auto'] }
517b8968c87SAndrey Shinkevich
518b8968c87SAndrey Shinkevich##
519b8968c87SAndrey Shinkevich# @Qcow2BitmapInfo:
520b8968c87SAndrey Shinkevich#
521b8968c87SAndrey Shinkevich# Qcow2 bitmap information.
522b8968c87SAndrey Shinkevich#
523b8968c87SAndrey Shinkevich# @name: the name of the bitmap
524b8968c87SAndrey Shinkevich#
525b8968c87SAndrey Shinkevich# @granularity: granularity of the bitmap in bytes
526b8968c87SAndrey Shinkevich#
527b8968c87SAndrey Shinkevich# @flags: flags of the bitmap
528b8968c87SAndrey Shinkevich#
529b8968c87SAndrey Shinkevich# Since: 4.0
530b8968c87SAndrey Shinkevich##
531b8968c87SAndrey Shinkevich{ 'struct': 'Qcow2BitmapInfo',
532b8968c87SAndrey Shinkevich  'data': {'name': 'str', 'granularity': 'uint32',
533b8968c87SAndrey Shinkevich           'flags': ['Qcow2BitmapInfoFlags'] } }
534b8968c87SAndrey Shinkevich
535b8968c87SAndrey Shinkevich##
5367e5c776dSVladimir Sementsov-Ogievskiy# @BlockLatencyHistogramInfo:
5377e5c776dSVladimir Sementsov-Ogievskiy#
5387e5c776dSVladimir Sementsov-Ogievskiy# Block latency histogram.
5397e5c776dSVladimir Sementsov-Ogievskiy#
5407e5c776dSVladimir Sementsov-Ogievskiy# @boundaries: list of interval boundary values in nanoseconds, all greater
5417e5c776dSVladimir Sementsov-Ogievskiy#              than zero and in ascending order.
5427e5c776dSVladimir Sementsov-Ogievskiy#              For example, the list [10, 50, 100] produces the following
5437e5c776dSVladimir Sementsov-Ogievskiy#              histogram intervals: [0, 10), [10, 50), [50, 100), [100, +inf).
5447e5c776dSVladimir Sementsov-Ogievskiy#
5457e5c776dSVladimir Sementsov-Ogievskiy# @bins: list of io request counts corresponding to histogram intervals.
5467e5c776dSVladimir Sementsov-Ogievskiy#        len(@bins) = len(@boundaries) + 1
5477e5c776dSVladimir Sementsov-Ogievskiy#        For the example above, @bins may be something like [3, 1, 5, 2],
5487e5c776dSVladimir Sementsov-Ogievskiy#        and corresponding histogram looks like:
5497e5c776dSVladimir Sementsov-Ogievskiy#
5507e5c776dSVladimir Sementsov-Ogievskiy#        5|           *
5517e5c776dSVladimir Sementsov-Ogievskiy#        4|           *
5527e5c776dSVladimir Sementsov-Ogievskiy#        3| *         *
5537e5c776dSVladimir Sementsov-Ogievskiy#        2| *         *    *
5547e5c776dSVladimir Sementsov-Ogievskiy#        1| *    *    *    *
5557e5c776dSVladimir Sementsov-Ogievskiy#         +------------------
5567e5c776dSVladimir Sementsov-Ogievskiy#             10   50   100
5577e5c776dSVladimir Sementsov-Ogievskiy#
558cb8aac37SVladimir Sementsov-Ogievskiy# Since: 4.0
5597e5c776dSVladimir Sementsov-Ogievskiy##
5607e5c776dSVladimir Sementsov-Ogievskiy{ 'struct': 'BlockLatencyHistogramInfo',
5617e5c776dSVladimir Sementsov-Ogievskiy  'data': {'boundaries': ['uint64'], 'bins': ['uint64'] } }
5627e5c776dSVladimir Sementsov-Ogievskiy
5637e5c776dSVladimir Sementsov-Ogievskiy##
564cb8aac37SVladimir Sementsov-Ogievskiy# @block-latency-histogram-set:
5657e5c776dSVladimir Sementsov-Ogievskiy#
5667e5c776dSVladimir Sementsov-Ogievskiy# Manage read, write and flush latency histograms for the device.
5677e5c776dSVladimir Sementsov-Ogievskiy#
5681f46ab2eSVladimir Sementsov-Ogievskiy# If only @id parameter is specified, remove all present latency histograms
5697e5c776dSVladimir Sementsov-Ogievskiy# for the device. Otherwise, add/reset some of (or all) latency histograms.
5707e5c776dSVladimir Sementsov-Ogievskiy#
571af0a2265SVladimir Sementsov-Ogievskiy# @id: The name or QOM path of the guest device.
5727e5c776dSVladimir Sementsov-Ogievskiy#
5737e5c776dSVladimir Sementsov-Ogievskiy# @boundaries: list of interval boundary values (see description in
5747e5c776dSVladimir Sementsov-Ogievskiy#              BlockLatencyHistogramInfo definition). If specified, all
5757e5c776dSVladimir Sementsov-Ogievskiy#              latency histograms are removed, and empty ones created for all
5767e5c776dSVladimir Sementsov-Ogievskiy#              io types with intervals corresponding to @boundaries (except for
5777e5c776dSVladimir Sementsov-Ogievskiy#              io types, for which specific boundaries are set through the
5787e5c776dSVladimir Sementsov-Ogievskiy#              following parameters).
5797e5c776dSVladimir Sementsov-Ogievskiy#
5807e5c776dSVladimir Sementsov-Ogievskiy# @boundaries-read: list of interval boundary values for read latency
5817e5c776dSVladimir Sementsov-Ogievskiy#                   histogram. If specified, old read latency histogram is
5827e5c776dSVladimir Sementsov-Ogievskiy#                   removed, and empty one created with intervals
5837e5c776dSVladimir Sementsov-Ogievskiy#                   corresponding to @boundaries-read. The parameter has higher
5847e5c776dSVladimir Sementsov-Ogievskiy#                   priority then @boundaries.
5857e5c776dSVladimir Sementsov-Ogievskiy#
5867e5c776dSVladimir Sementsov-Ogievskiy# @boundaries-write: list of interval boundary values for write latency
5877e5c776dSVladimir Sementsov-Ogievskiy#                    histogram.
5887e5c776dSVladimir Sementsov-Ogievskiy#
5897e5c776dSVladimir Sementsov-Ogievskiy# @boundaries-flush: list of interval boundary values for flush latency
5907e5c776dSVladimir Sementsov-Ogievskiy#                    histogram.
5917e5c776dSVladimir Sementsov-Ogievskiy#
5927e5c776dSVladimir Sementsov-Ogievskiy# Returns: error if device is not found or any boundary arrays are invalid.
5937e5c776dSVladimir Sementsov-Ogievskiy#
594cb8aac37SVladimir Sementsov-Ogievskiy# Since: 4.0
5957e5c776dSVladimir Sementsov-Ogievskiy#
5967e5c776dSVladimir Sementsov-Ogievskiy# Example: set new histograms for all io types with intervals
5977e5c776dSVladimir Sementsov-Ogievskiy# [0, 10), [10, 50), [50, 100), [100, +inf):
5987e5c776dSVladimir Sementsov-Ogievskiy#
5997e5c776dSVladimir Sementsov-Ogievskiy# -> { "execute": "block-latency-histogram-set",
6001f46ab2eSVladimir Sementsov-Ogievskiy#      "arguments": { "id": "drive0",
6017e5c776dSVladimir Sementsov-Ogievskiy#                     "boundaries": [10, 50, 100] } }
6027e5c776dSVladimir Sementsov-Ogievskiy# <- { "return": {} }
6037e5c776dSVladimir Sementsov-Ogievskiy#
6047e5c776dSVladimir Sementsov-Ogievskiy# Example: set new histogram only for write, other histograms will remain
6057e5c776dSVladimir Sementsov-Ogievskiy# not changed (or not created):
6067e5c776dSVladimir Sementsov-Ogievskiy#
6077e5c776dSVladimir Sementsov-Ogievskiy# -> { "execute": "block-latency-histogram-set",
6081f46ab2eSVladimir Sementsov-Ogievskiy#      "arguments": { "id": "drive0",
6097e5c776dSVladimir Sementsov-Ogievskiy#                     "boundaries-write": [10, 50, 100] } }
6107e5c776dSVladimir Sementsov-Ogievskiy# <- { "return": {} }
6117e5c776dSVladimir Sementsov-Ogievskiy#
6127e5c776dSVladimir Sementsov-Ogievskiy# Example: set new histograms with the following intervals:
6137e5c776dSVladimir Sementsov-Ogievskiy#   read, flush: [0, 10), [10, 50), [50, 100), [100, +inf)
6147e5c776dSVladimir Sementsov-Ogievskiy#   write: [0, 1000), [1000, 5000), [5000, +inf)
6157e5c776dSVladimir Sementsov-Ogievskiy#
6167e5c776dSVladimir Sementsov-Ogievskiy# -> { "execute": "block-latency-histogram-set",
6171f46ab2eSVladimir Sementsov-Ogievskiy#      "arguments": { "id": "drive0",
6187e5c776dSVladimir Sementsov-Ogievskiy#                     "boundaries": [10, 50, 100],
6197e5c776dSVladimir Sementsov-Ogievskiy#                     "boundaries-write": [1000, 5000] } }
6207e5c776dSVladimir Sementsov-Ogievskiy# <- { "return": {} }
6217e5c776dSVladimir Sementsov-Ogievskiy#
6227e5c776dSVladimir Sementsov-Ogievskiy# Example: remove all latency histograms:
6237e5c776dSVladimir Sementsov-Ogievskiy#
6247e5c776dSVladimir Sementsov-Ogievskiy# -> { "execute": "block-latency-histogram-set",
6251f46ab2eSVladimir Sementsov-Ogievskiy#      "arguments": { "id": "drive0" } }
6267e5c776dSVladimir Sementsov-Ogievskiy# <- { "return": {} }
6277e5c776dSVladimir Sementsov-Ogievskiy##
628cb8aac37SVladimir Sementsov-Ogievskiy{ 'command': 'block-latency-histogram-set',
629af0a2265SVladimir Sementsov-Ogievskiy  'data': {'id': 'str',
6307e5c776dSVladimir Sementsov-Ogievskiy           '*boundaries': ['uint64'],
6317e5c776dSVladimir Sementsov-Ogievskiy           '*boundaries-read': ['uint64'],
6327e5c776dSVladimir Sementsov-Ogievskiy           '*boundaries-write': ['uint64'],
6337e5c776dSVladimir Sementsov-Ogievskiy           '*boundaries-flush': ['uint64'] } }
6347e5c776dSVladimir Sementsov-Ogievskiy
6357e5c776dSVladimir Sementsov-Ogievskiy##
6361ad166b6SBenoît Canet# @BlockInfo:
6371ad166b6SBenoît Canet#
6381ad166b6SBenoît Canet# Block device information.  This structure describes a virtual device and
6391ad166b6SBenoît Canet# the backing device associated with it.
6401ad166b6SBenoît Canet#
6411ad166b6SBenoît Canet# @device: The device name associated with the virtual device.
6421ad166b6SBenoît Canet#
64346eade7bSKevin Wolf# @qdev: The qdev ID, or if no ID is assigned, the QOM path of the block
64446eade7bSKevin Wolf#        device. (since 2.10)
64546eade7bSKevin Wolf#
6461ad166b6SBenoît Canet# @type: This field is returned only for compatibility reasons, it should
6471ad166b6SBenoît Canet#        not be used (always returns 'unknown')
6481ad166b6SBenoît Canet#
6491ad166b6SBenoît Canet# @removable: True if the device supports removable media.
6501ad166b6SBenoît Canet#
6511ad166b6SBenoît Canet# @locked: True if the guest has locked this device from having its media
6521ad166b6SBenoît Canet#          removed
6531ad166b6SBenoît Canet#
6541d8bda12SMarkus Armbruster# @tray_open: True if the device's tray is open
655327032ceSMax Reitz#             (only present if it has a tray)
6561ad166b6SBenoît Canet#
6571d8bda12SMarkus Armbruster# @dirty-bitmaps: dirty bitmaps information (only present if the
6581ad166b6SBenoît Canet#                 driver has one or more dirty bitmaps) (Since 2.0)
6591ad166b6SBenoît Canet#
6601d8bda12SMarkus Armbruster# @io-status: @BlockDeviceIoStatus. Only present if the device
6611ad166b6SBenoît Canet#             supports it and the VM is configured to stop on errors
662f6f55affSMarkus Armbruster#             (supported device models: virtio-blk, IDE, SCSI except
663f6f55affSMarkus Armbruster#             scsi-generic)
6641ad166b6SBenoît Canet#
6651d8bda12SMarkus Armbruster# @inserted: @BlockDeviceInfo describing the device if media is
6661ad166b6SBenoît Canet#            present
6671ad166b6SBenoît Canet#
6681ad166b6SBenoît Canet# Since:  0.14.0
6691ad166b6SBenoît Canet##
670895a2a80SEric Blake{ 'struct': 'BlockInfo',
67146eade7bSKevin Wolf  'data': {'device': 'str', '*qdev': 'str', 'type': 'str', 'removable': 'bool',
6721ad166b6SBenoît Canet           'locked': 'bool', '*inserted': 'BlockDeviceInfo',
6731ad166b6SBenoît Canet           '*tray_open': 'bool', '*io-status': 'BlockDeviceIoStatus',
6741ad166b6SBenoît Canet           '*dirty-bitmaps': ['BlockDirtyInfo'] } }
6751ad166b6SBenoît Canet
6761ad166b6SBenoît Canet##
67790880ff1SStefan Hajnoczi# @BlockMeasureInfo:
67890880ff1SStefan Hajnoczi#
67990880ff1SStefan Hajnoczi# Image file size calculation information.  This structure describes the size
68090880ff1SStefan Hajnoczi# requirements for creating a new image file.
68190880ff1SStefan Hajnoczi#
68290880ff1SStefan Hajnoczi# The size requirements depend on the new image file format.  File size always
68390880ff1SStefan Hajnoczi# equals virtual disk size for the 'raw' format, even for sparse POSIX files.
68490880ff1SStefan Hajnoczi# Compact formats such as 'qcow2' represent unallocated and zero regions
68590880ff1SStefan Hajnoczi# efficiently so file size may be smaller than virtual disk size.
68690880ff1SStefan Hajnoczi#
68790880ff1SStefan Hajnoczi# The values are upper bounds that are guaranteed to fit the new image file.
68890880ff1SStefan Hajnoczi# Subsequent modification, such as internal snapshot or bitmap creation, may
68990880ff1SStefan Hajnoczi# require additional space and is not covered here.
69090880ff1SStefan Hajnoczi#
69190880ff1SStefan Hajnoczi# @required: Size required for a new image file, in bytes.
69290880ff1SStefan Hajnoczi#
69390880ff1SStefan Hajnoczi# @fully-allocated: Image file size, in bytes, once data has been written
69490880ff1SStefan Hajnoczi#                   to all sectors.
69590880ff1SStefan Hajnoczi#
69690880ff1SStefan Hajnoczi# Since: 2.10
69790880ff1SStefan Hajnoczi##
69890880ff1SStefan Hajnoczi{ 'struct': 'BlockMeasureInfo',
69990880ff1SStefan Hajnoczi  'data': {'required': 'int', 'fully-allocated': 'int'} }
70090880ff1SStefan Hajnoczi
70190880ff1SStefan Hajnoczi##
7021ad166b6SBenoît Canet# @query-block:
7031ad166b6SBenoît Canet#
7041ad166b6SBenoît Canet# Get a list of BlockInfo for all virtual block devices.
7051ad166b6SBenoît Canet#
706d3c8c674SKevin Wolf# Returns: a list of @BlockInfo describing each virtual block device. Filter
707d3c8c674SKevin Wolf# nodes that were created implicitly are skipped over.
7081ad166b6SBenoît Canet#
7091ad166b6SBenoît Canet# Since: 0.14.0
710978cceabSMarc-André Lureau#
711978cceabSMarc-André Lureau# Example:
712978cceabSMarc-André Lureau#
713978cceabSMarc-André Lureau# -> { "execute": "query-block" }
714978cceabSMarc-André Lureau# <- {
715978cceabSMarc-André Lureau#       "return":[
716978cceabSMarc-André Lureau#          {
717978cceabSMarc-André Lureau#             "io-status": "ok",
718978cceabSMarc-André Lureau#             "device":"ide0-hd0",
719978cceabSMarc-André Lureau#             "locked":false,
720978cceabSMarc-André Lureau#             "removable":false,
721978cceabSMarc-André Lureau#             "inserted":{
722978cceabSMarc-André Lureau#                "ro":false,
723978cceabSMarc-André Lureau#                "drv":"qcow2",
724978cceabSMarc-André Lureau#                "encrypted":false,
725978cceabSMarc-André Lureau#                "file":"disks/test.qcow2",
726978cceabSMarc-André Lureau#                "backing_file_depth":1,
727978cceabSMarc-André Lureau#                "bps":1000000,
728978cceabSMarc-André Lureau#                "bps_rd":0,
729978cceabSMarc-André Lureau#                "bps_wr":0,
730978cceabSMarc-André Lureau#                "iops":1000000,
731978cceabSMarc-André Lureau#                "iops_rd":0,
732978cceabSMarc-André Lureau#                "iops_wr":0,
733978cceabSMarc-André Lureau#                "bps_max": 8000000,
734978cceabSMarc-André Lureau#                "bps_rd_max": 0,
735978cceabSMarc-André Lureau#                "bps_wr_max": 0,
736978cceabSMarc-André Lureau#                "iops_max": 0,
737978cceabSMarc-André Lureau#                "iops_rd_max": 0,
738978cceabSMarc-André Lureau#                "iops_wr_max": 0,
739978cceabSMarc-André Lureau#                "iops_size": 0,
740978cceabSMarc-André Lureau#                "detect_zeroes": "on",
741978cceabSMarc-André Lureau#                "write_threshold": 0,
742978cceabSMarc-André Lureau#                "image":{
743978cceabSMarc-André Lureau#                   "filename":"disks/test.qcow2",
744978cceabSMarc-André Lureau#                   "format":"qcow2",
745978cceabSMarc-André Lureau#                   "virtual-size":2048000,
746978cceabSMarc-André Lureau#                   "backing_file":"base.qcow2",
747978cceabSMarc-André Lureau#                   "full-backing-filename":"disks/base.qcow2",
748978cceabSMarc-André Lureau#                   "backing-filename-format":"qcow2",
749978cceabSMarc-André Lureau#                   "snapshots":[
750978cceabSMarc-André Lureau#                      {
751978cceabSMarc-André Lureau#                         "id": "1",
752978cceabSMarc-André Lureau#                         "name": "snapshot1",
753978cceabSMarc-André Lureau#                         "vm-state-size": 0,
754978cceabSMarc-André Lureau#                         "date-sec": 10000200,
755978cceabSMarc-André Lureau#                         "date-nsec": 12,
756978cceabSMarc-André Lureau#                         "vm-clock-sec": 206,
757978cceabSMarc-André Lureau#                         "vm-clock-nsec": 30
758978cceabSMarc-André Lureau#                      }
759978cceabSMarc-André Lureau#                   ],
760978cceabSMarc-André Lureau#                   "backing-image":{
761978cceabSMarc-André Lureau#                       "filename":"disks/base.qcow2",
762978cceabSMarc-André Lureau#                       "format":"qcow2",
763978cceabSMarc-André Lureau#                       "virtual-size":2048000
764978cceabSMarc-André Lureau#                   }
765978cceabSMarc-André Lureau#                }
766978cceabSMarc-André Lureau#             },
76746eade7bSKevin Wolf#             "qdev": "ide_disk",
768978cceabSMarc-André Lureau#             "type":"unknown"
769978cceabSMarc-André Lureau#          },
770978cceabSMarc-André Lureau#          {
771978cceabSMarc-André Lureau#             "io-status": "ok",
772978cceabSMarc-André Lureau#             "device":"ide1-cd0",
773978cceabSMarc-André Lureau#             "locked":false,
774978cceabSMarc-André Lureau#             "removable":true,
77546eade7bSKevin Wolf#             "qdev": "/machine/unattached/device[23]",
77646eade7bSKevin Wolf#             "tray_open": false,
777978cceabSMarc-André Lureau#             "type":"unknown"
778978cceabSMarc-André Lureau#          },
779978cceabSMarc-André Lureau#          {
780978cceabSMarc-André Lureau#             "device":"floppy0",
781978cceabSMarc-André Lureau#             "locked":false,
782978cceabSMarc-André Lureau#             "removable":true,
78346eade7bSKevin Wolf#             "qdev": "/machine/unattached/device[20]",
784978cceabSMarc-André Lureau#             "type":"unknown"
785978cceabSMarc-André Lureau#          },
786978cceabSMarc-André Lureau#          {
787978cceabSMarc-André Lureau#             "device":"sd0",
788978cceabSMarc-André Lureau#             "locked":false,
789978cceabSMarc-André Lureau#             "removable":true,
790978cceabSMarc-André Lureau#             "type":"unknown"
791978cceabSMarc-André Lureau#          }
792978cceabSMarc-André Lureau#       ]
793978cceabSMarc-André Lureau#    }
794978cceabSMarc-André Lureau#
7951ad166b6SBenoît Canet##
7961ad166b6SBenoît Canet{ 'command': 'query-block', 'returns': ['BlockInfo'] }
7971ad166b6SBenoît Canet
798979e9b03SAlberto Garcia
799979e9b03SAlberto Garcia##
800979e9b03SAlberto Garcia# @BlockDeviceTimedStats:
801979e9b03SAlberto Garcia#
802979e9b03SAlberto Garcia# Statistics of a block device during a given interval of time.
803979e9b03SAlberto Garcia#
804979e9b03SAlberto Garcia# @interval_length: Interval used for calculating the statistics,
805979e9b03SAlberto Garcia#                   in seconds.
806979e9b03SAlberto Garcia#
807979e9b03SAlberto Garcia# @min_rd_latency_ns: Minimum latency of read operations in the
808979e9b03SAlberto Garcia#                     defined interval, in nanoseconds.
809979e9b03SAlberto Garcia#
810979e9b03SAlberto Garcia# @min_wr_latency_ns: Minimum latency of write operations in the
811979e9b03SAlberto Garcia#                     defined interval, in nanoseconds.
812979e9b03SAlberto Garcia#
813979e9b03SAlberto Garcia# @min_flush_latency_ns: Minimum latency of flush operations in the
814979e9b03SAlberto Garcia#                        defined interval, in nanoseconds.
815979e9b03SAlberto Garcia#
816979e9b03SAlberto Garcia# @max_rd_latency_ns: Maximum latency of read operations in the
817979e9b03SAlberto Garcia#                     defined interval, in nanoseconds.
818979e9b03SAlberto Garcia#
819979e9b03SAlberto Garcia# @max_wr_latency_ns: Maximum latency of write operations in the
820979e9b03SAlberto Garcia#                     defined interval, in nanoseconds.
821979e9b03SAlberto Garcia#
822979e9b03SAlberto Garcia# @max_flush_latency_ns: Maximum latency of flush operations in the
823979e9b03SAlberto Garcia#                        defined interval, in nanoseconds.
824979e9b03SAlberto Garcia#
825979e9b03SAlberto Garcia# @avg_rd_latency_ns: Average latency of read operations in the
826979e9b03SAlberto Garcia#                     defined interval, in nanoseconds.
827979e9b03SAlberto Garcia#
828979e9b03SAlberto Garcia# @avg_wr_latency_ns: Average latency of write operations in the
829979e9b03SAlberto Garcia#                     defined interval, in nanoseconds.
830979e9b03SAlberto Garcia#
831979e9b03SAlberto Garcia# @avg_flush_latency_ns: Average latency of flush operations in the
832979e9b03SAlberto Garcia#                        defined interval, in nanoseconds.
833979e9b03SAlberto Garcia#
83496e4dedaSAlberto Garcia# @avg_rd_queue_depth: Average number of pending read operations
83596e4dedaSAlberto Garcia#                      in the defined interval.
83696e4dedaSAlberto Garcia#
83796e4dedaSAlberto Garcia# @avg_wr_queue_depth: Average number of pending write operations
83896e4dedaSAlberto Garcia#                      in the defined interval.
83996e4dedaSAlberto Garcia#
840979e9b03SAlberto Garcia# Since: 2.5
841979e9b03SAlberto Garcia##
842979e9b03SAlberto Garcia{ 'struct': 'BlockDeviceTimedStats',
843979e9b03SAlberto Garcia  'data': { 'interval_length': 'int', 'min_rd_latency_ns': 'int',
844979e9b03SAlberto Garcia            'max_rd_latency_ns': 'int', 'avg_rd_latency_ns': 'int',
845979e9b03SAlberto Garcia            'min_wr_latency_ns': 'int', 'max_wr_latency_ns': 'int',
846979e9b03SAlberto Garcia            'avg_wr_latency_ns': 'int', 'min_flush_latency_ns': 'int',
84796e4dedaSAlberto Garcia            'max_flush_latency_ns': 'int', 'avg_flush_latency_ns': 'int',
84896e4dedaSAlberto Garcia            'avg_rd_queue_depth': 'number', 'avg_wr_queue_depth': 'number' } }
849979e9b03SAlberto Garcia
8501ad166b6SBenoît Canet##
8511ad166b6SBenoît Canet# @BlockDeviceStats:
8521ad166b6SBenoît Canet#
8531ad166b6SBenoît Canet# Statistics of a virtual block device or a block backing device.
8541ad166b6SBenoît Canet#
8551ad166b6SBenoît Canet# @rd_bytes:      The number of bytes read by the device.
8561ad166b6SBenoît Canet#
8571ad166b6SBenoît Canet# @wr_bytes:      The number of bytes written by the device.
8581ad166b6SBenoît Canet#
8591ad166b6SBenoît Canet# @rd_operations: The number of read operations performed by the device.
8601ad166b6SBenoît Canet#
8611ad166b6SBenoît Canet# @wr_operations: The number of write operations performed by the device.
8621ad166b6SBenoît Canet#
8631ad166b6SBenoît Canet# @flush_operations: The number of cache flush operations performed by the
8641ad166b6SBenoît Canet#                    device (since 0.15.0)
8651ad166b6SBenoît Canet#
8661ad166b6SBenoît Canet# @flush_total_time_ns: Total time spend on cache flushes in nano-seconds
8671ad166b6SBenoît Canet#                       (since 0.15.0).
8681ad166b6SBenoît Canet#
8691ad166b6SBenoît Canet# @wr_total_time_ns: Total time spend on writes in nano-seconds (since 0.15.0).
8701ad166b6SBenoît Canet#
8711ad166b6SBenoît Canet# @rd_total_time_ns: Total_time_spend on reads in nano-seconds (since 0.15.0).
8721ad166b6SBenoît Canet#
8731ad166b6SBenoît Canet# @wr_highest_offset: The offset after the greatest byte written to the
8741ad166b6SBenoît Canet#                     device.  The intended use of this information is for
8751ad166b6SBenoît Canet#                     growable sparse files (like qcow2) that are used on top
8761ad166b6SBenoît Canet#                     of a physical device.
8771ad166b6SBenoît Canet#
878f4564d53SPeter Lieven# @rd_merged: Number of read requests that have been merged into another
879f4564d53SPeter Lieven#             request (Since 2.3).
880f4564d53SPeter Lieven#
881f4564d53SPeter Lieven# @wr_merged: Number of write requests that have been merged into another
882f4564d53SPeter Lieven#             request (Since 2.3).
883f4564d53SPeter Lieven#
8841d8bda12SMarkus Armbruster# @idle_time_ns: Time since the last I/O operation, in
885cb38fffbSAlberto Garcia#                nanoseconds. If the field is absent it means that
886cb38fffbSAlberto Garcia#                there haven't been any operations yet (Since 2.5).
887cb38fffbSAlberto Garcia#
8887ee12dafSAlberto Garcia# @failed_rd_operations: The number of failed read operations
8897ee12dafSAlberto Garcia#                        performed by the device (Since 2.5)
8907ee12dafSAlberto Garcia#
8917ee12dafSAlberto Garcia# @failed_wr_operations: The number of failed write operations
8927ee12dafSAlberto Garcia#                        performed by the device (Since 2.5)
8937ee12dafSAlberto Garcia#
8947ee12dafSAlberto Garcia# @failed_flush_operations: The number of failed flush operations
8957ee12dafSAlberto Garcia#                           performed by the device (Since 2.5)
8967ee12dafSAlberto Garcia#
8977ee12dafSAlberto Garcia# @invalid_rd_operations: The number of invalid read operations
8987ee12dafSAlberto Garcia#                          performed by the device (Since 2.5)
8997ee12dafSAlberto Garcia#
9007ee12dafSAlberto Garcia# @invalid_wr_operations: The number of invalid write operations
9017ee12dafSAlberto Garcia#                         performed by the device (Since 2.5)
9027ee12dafSAlberto Garcia#
9037ee12dafSAlberto Garcia# @invalid_flush_operations: The number of invalid flush operations
9047ee12dafSAlberto Garcia#                            performed by the device (Since 2.5)
9057ee12dafSAlberto Garcia#
906362e9299SAlberto Garcia# @account_invalid: Whether invalid operations are included in the
907362e9299SAlberto Garcia#                   last access statistics (Since 2.5)
908362e9299SAlberto Garcia#
909362e9299SAlberto Garcia# @account_failed: Whether failed operations are included in the
910362e9299SAlberto Garcia#                  latency and last access statistics (Since 2.5)
911362e9299SAlberto Garcia#
912979e9b03SAlberto Garcia# @timed_stats: Statistics specific to the set of previously defined
913979e9b03SAlberto Garcia#               intervals of time (Since 2.5)
914979e9b03SAlberto Garcia#
915cb8aac37SVladimir Sementsov-Ogievskiy# @rd_latency_histogram: @BlockLatencyHistogramInfo. (Since 4.0)
9167e5c776dSVladimir Sementsov-Ogievskiy#
917cb8aac37SVladimir Sementsov-Ogievskiy# @wr_latency_histogram: @BlockLatencyHistogramInfo. (Since 4.0)
9187e5c776dSVladimir Sementsov-Ogievskiy#
919cb8aac37SVladimir Sementsov-Ogievskiy# @flush_latency_histogram: @BlockLatencyHistogramInfo. (Since 4.0)
9207e5c776dSVladimir Sementsov-Ogievskiy#
9211ad166b6SBenoît Canet# Since: 0.14.0
9221ad166b6SBenoît Canet##
923895a2a80SEric Blake{ 'struct': 'BlockDeviceStats',
9241ad166b6SBenoît Canet  'data': {'rd_bytes': 'int', 'wr_bytes': 'int', 'rd_operations': 'int',
9251ad166b6SBenoît Canet           'wr_operations': 'int', 'flush_operations': 'int',
9261ad166b6SBenoît Canet           'flush_total_time_ns': 'int', 'wr_total_time_ns': 'int',
927f4564d53SPeter Lieven           'rd_total_time_ns': 'int', 'wr_highest_offset': 'int',
9287ee12dafSAlberto Garcia           'rd_merged': 'int', 'wr_merged': 'int', '*idle_time_ns': 'int',
9297ee12dafSAlberto Garcia           'failed_rd_operations': 'int', 'failed_wr_operations': 'int',
9307ee12dafSAlberto Garcia           'failed_flush_operations': 'int', 'invalid_rd_operations': 'int',
931362e9299SAlberto Garcia           'invalid_wr_operations': 'int', 'invalid_flush_operations': 'int',
932979e9b03SAlberto Garcia           'account_invalid': 'bool', 'account_failed': 'bool',
9337e5c776dSVladimir Sementsov-Ogievskiy           'timed_stats': ['BlockDeviceTimedStats'],
934cb8aac37SVladimir Sementsov-Ogievskiy           '*rd_latency_histogram': 'BlockLatencyHistogramInfo',
935cb8aac37SVladimir Sementsov-Ogievskiy           '*wr_latency_histogram': 'BlockLatencyHistogramInfo',
936cb8aac37SVladimir Sementsov-Ogievskiy           '*flush_latency_histogram': 'BlockLatencyHistogramInfo' } }
9371ad166b6SBenoît Canet
9381ad166b6SBenoît Canet##
9391ad166b6SBenoît Canet# @BlockStats:
9401ad166b6SBenoît Canet#
9411ad166b6SBenoît Canet# Statistics of a virtual block device or a block backing device.
9421ad166b6SBenoît Canet#
9431d8bda12SMarkus Armbruster# @device: If the stats are for a virtual block device, the name
9441ad166b6SBenoît Canet#          corresponding to the virtual block device.
9451ad166b6SBenoît Canet#
9461d8bda12SMarkus Armbruster# @node-name: The node name of the device. (Since 2.3)
9474875a779SFam Zheng#
9485a9cb5a9SKevin Wolf# @qdev: The qdev ID, or if no ID is assigned, the QOM path of the block
9495a9cb5a9SKevin Wolf#        device. (since 3.0)
9505a9cb5a9SKevin Wolf#
9511ad166b6SBenoît Canet# @stats:  A @BlockDeviceStats for the device.
9521ad166b6SBenoît Canet#
9531d8bda12SMarkus Armbruster# @parent: This describes the file block device if it has one.
954f2eaea18SMarc-André Lureau#          Contains recursively the statistics of the underlying
955f2eaea18SMarc-André Lureau#          protocol (e.g. the host file for a qcow2 image). If there is
956f2eaea18SMarc-André Lureau#          no underlying protocol, this field is omitted
9571ad166b6SBenoît Canet#
9581d8bda12SMarkus Armbruster# @backing: This describes the backing block device if it has one.
9591ad166b6SBenoît Canet#           (Since 2.0)
9601ad166b6SBenoît Canet#
9611ad166b6SBenoît Canet# Since: 0.14.0
9621ad166b6SBenoît Canet##
963895a2a80SEric Blake{ 'struct': 'BlockStats',
9645a9cb5a9SKevin Wolf  'data': {'*device': 'str', '*qdev': 'str', '*node-name': 'str',
9654875a779SFam Zheng           'stats': 'BlockDeviceStats',
9661ad166b6SBenoît Canet           '*parent': 'BlockStats',
9671ad166b6SBenoît Canet           '*backing': 'BlockStats'} }
9681ad166b6SBenoît Canet
9691ad166b6SBenoît Canet##
9701ad166b6SBenoît Canet# @query-blockstats:
9711ad166b6SBenoît Canet#
9721ad166b6SBenoît Canet# Query the @BlockStats for all virtual block devices.
9731ad166b6SBenoît Canet#
9741d8bda12SMarkus Armbruster# @query-nodes: If true, the command will query all the block nodes
975f71eaa74SFam Zheng#               that have a node name, in a list which will include "parent"
976f71eaa74SFam Zheng#               information, but not "backing".
977f71eaa74SFam Zheng#               If false or omitted, the behavior is as before - query all the
978f71eaa74SFam Zheng#               device backends, recursively including their "parent" and
979d3c8c674SKevin Wolf#               "backing". Filter nodes that were created implicitly are
980d3c8c674SKevin Wolf#               skipped over in this mode. (Since 2.3)
981f71eaa74SFam Zheng#
9821ad166b6SBenoît Canet# Returns: A list of @BlockStats for each virtual block devices.
9831ad166b6SBenoît Canet#
9841ad166b6SBenoît Canet# Since: 0.14.0
985f2eaea18SMarc-André Lureau#
986f2eaea18SMarc-André Lureau# Example:
987f2eaea18SMarc-André Lureau#
988f2eaea18SMarc-André Lureau# -> { "execute": "query-blockstats" }
989f2eaea18SMarc-André Lureau# <- {
990f2eaea18SMarc-André Lureau#       "return":[
991f2eaea18SMarc-André Lureau#          {
992f2eaea18SMarc-André Lureau#             "device":"ide0-hd0",
993f2eaea18SMarc-André Lureau#             "parent":{
994f2eaea18SMarc-André Lureau#                "stats":{
995f2eaea18SMarc-André Lureau#                   "wr_highest_offset":3686448128,
996f2eaea18SMarc-André Lureau#                   "wr_bytes":9786368,
997f2eaea18SMarc-André Lureau#                   "wr_operations":751,
998f2eaea18SMarc-André Lureau#                   "rd_bytes":122567168,
999f2eaea18SMarc-André Lureau#                   "rd_operations":36772
1000f2eaea18SMarc-André Lureau#                   "wr_total_times_ns":313253456
1001f2eaea18SMarc-André Lureau#                   "rd_total_times_ns":3465673657
1002f2eaea18SMarc-André Lureau#                   "flush_total_times_ns":49653
1003f2eaea18SMarc-André Lureau#                   "flush_operations":61,
1004f2eaea18SMarc-André Lureau#                   "rd_merged":0,
1005f2eaea18SMarc-André Lureau#                   "wr_merged":0,
1006f2eaea18SMarc-André Lureau#                   "idle_time_ns":2953431879,
1007f2eaea18SMarc-André Lureau#                   "account_invalid":true,
1008f2eaea18SMarc-André Lureau#                   "account_failed":false
1009f2eaea18SMarc-André Lureau#                }
1010f2eaea18SMarc-André Lureau#             },
1011f2eaea18SMarc-André Lureau#             "stats":{
1012f2eaea18SMarc-André Lureau#                "wr_highest_offset":2821110784,
1013f2eaea18SMarc-André Lureau#                "wr_bytes":9786368,
1014f2eaea18SMarc-André Lureau#                "wr_operations":692,
1015f2eaea18SMarc-André Lureau#                "rd_bytes":122739200,
1016f2eaea18SMarc-André Lureau#                "rd_operations":36604
1017f2eaea18SMarc-André Lureau#                "flush_operations":51,
1018f2eaea18SMarc-André Lureau#                "wr_total_times_ns":313253456
1019f2eaea18SMarc-André Lureau#                "rd_total_times_ns":3465673657
1020f2eaea18SMarc-André Lureau#                "flush_total_times_ns":49653,
1021f2eaea18SMarc-André Lureau#                "rd_merged":0,
1022f2eaea18SMarc-André Lureau#                "wr_merged":0,
1023f2eaea18SMarc-André Lureau#                "idle_time_ns":2953431879,
1024f2eaea18SMarc-André Lureau#                "account_invalid":true,
1025f2eaea18SMarc-André Lureau#                "account_failed":false
10265a9cb5a9SKevin Wolf#             },
10275a9cb5a9SKevin Wolf#             "qdev": "/machine/unattached/device[23]"
1028f2eaea18SMarc-André Lureau#          },
1029f2eaea18SMarc-André Lureau#          {
1030f2eaea18SMarc-André Lureau#             "device":"ide1-cd0",
1031f2eaea18SMarc-André Lureau#             "stats":{
1032f2eaea18SMarc-André Lureau#                "wr_highest_offset":0,
1033f2eaea18SMarc-André Lureau#                "wr_bytes":0,
1034f2eaea18SMarc-André Lureau#                "wr_operations":0,
1035f2eaea18SMarc-André Lureau#                "rd_bytes":0,
1036f2eaea18SMarc-André Lureau#                "rd_operations":0
1037f2eaea18SMarc-André Lureau#                "flush_operations":0,
1038f2eaea18SMarc-André Lureau#                "wr_total_times_ns":0
1039f2eaea18SMarc-André Lureau#                "rd_total_times_ns":0
1040f2eaea18SMarc-André Lureau#                "flush_total_times_ns":0,
1041f2eaea18SMarc-André Lureau#                "rd_merged":0,
1042f2eaea18SMarc-André Lureau#                "wr_merged":0,
1043f2eaea18SMarc-André Lureau#                "account_invalid":false,
1044f2eaea18SMarc-André Lureau#                "account_failed":false
10455a9cb5a9SKevin Wolf#             },
10465a9cb5a9SKevin Wolf#             "qdev": "/machine/unattached/device[24]"
1047f2eaea18SMarc-André Lureau#          },
1048f2eaea18SMarc-André Lureau#          {
1049f2eaea18SMarc-André Lureau#             "device":"floppy0",
1050f2eaea18SMarc-André Lureau#             "stats":{
1051f2eaea18SMarc-André Lureau#                "wr_highest_offset":0,
1052f2eaea18SMarc-André Lureau#                "wr_bytes":0,
1053f2eaea18SMarc-André Lureau#                "wr_operations":0,
1054f2eaea18SMarc-André Lureau#                "rd_bytes":0,
1055f2eaea18SMarc-André Lureau#                "rd_operations":0
1056f2eaea18SMarc-André Lureau#                "flush_operations":0,
1057f2eaea18SMarc-André Lureau#                "wr_total_times_ns":0
1058f2eaea18SMarc-André Lureau#                "rd_total_times_ns":0
1059f2eaea18SMarc-André Lureau#                "flush_total_times_ns":0,
1060f2eaea18SMarc-André Lureau#                "rd_merged":0,
1061f2eaea18SMarc-André Lureau#                "wr_merged":0,
1062f2eaea18SMarc-André Lureau#                "account_invalid":false,
1063f2eaea18SMarc-André Lureau#                "account_failed":false
10645a9cb5a9SKevin Wolf#             },
10655a9cb5a9SKevin Wolf#             "qdev": "/machine/unattached/device[16]"
1066f2eaea18SMarc-André Lureau#          },
1067f2eaea18SMarc-André Lureau#          {
1068f2eaea18SMarc-André Lureau#             "device":"sd0",
1069f2eaea18SMarc-André Lureau#             "stats":{
1070f2eaea18SMarc-André Lureau#                "wr_highest_offset":0,
1071f2eaea18SMarc-André Lureau#                "wr_bytes":0,
1072f2eaea18SMarc-André Lureau#                "wr_operations":0,
1073f2eaea18SMarc-André Lureau#                "rd_bytes":0,
1074f2eaea18SMarc-André Lureau#                "rd_operations":0
1075f2eaea18SMarc-André Lureau#                "flush_operations":0,
1076f2eaea18SMarc-André Lureau#                "wr_total_times_ns":0
1077f2eaea18SMarc-André Lureau#                "rd_total_times_ns":0
1078f2eaea18SMarc-André Lureau#                "flush_total_times_ns":0,
1079f2eaea18SMarc-André Lureau#                "rd_merged":0,
1080f2eaea18SMarc-André Lureau#                "wr_merged":0,
1081f2eaea18SMarc-André Lureau#                "account_invalid":false,
1082f2eaea18SMarc-André Lureau#                "account_failed":false
1083f2eaea18SMarc-André Lureau#             }
1084f2eaea18SMarc-André Lureau#          }
1085f2eaea18SMarc-André Lureau#       ]
1086f2eaea18SMarc-André Lureau#    }
1087f2eaea18SMarc-André Lureau#
10881ad166b6SBenoît Canet##
1089f71eaa74SFam Zheng{ 'command': 'query-blockstats',
1090f71eaa74SFam Zheng  'data': { '*query-nodes': 'bool' },
1091f71eaa74SFam Zheng  'returns': ['BlockStats'] }
10921ad166b6SBenoît Canet
10931ad166b6SBenoît Canet##
10941ad166b6SBenoît Canet# @BlockdevOnError:
10951ad166b6SBenoît Canet#
10961ad166b6SBenoît Canet# An enumeration of possible behaviors for errors on I/O operations.
10971ad166b6SBenoît Canet# The exact meaning depends on whether the I/O was initiated by a guest
10981ad166b6SBenoît Canet# or by a block job
10991ad166b6SBenoît Canet#
11001ad166b6SBenoît Canet# @report: for guest operations, report the error to the guest;
11011ad166b6SBenoît Canet#          for jobs, cancel the job
11021ad166b6SBenoît Canet#
11031ad166b6SBenoît Canet# @ignore: ignore the error, only report a QMP event (BLOCK_IO_ERROR
11041ad166b6SBenoît Canet#          or BLOCK_JOB_ERROR)
11051ad166b6SBenoît Canet#
11061ad166b6SBenoît Canet# @enospc: same as @stop on ENOSPC, same as @report otherwise.
11071ad166b6SBenoît Canet#
11081ad166b6SBenoît Canet# @stop: for guest operations, stop the virtual machine;
11091ad166b6SBenoît Canet#        for jobs, pause the job
11101ad166b6SBenoît Canet#
11118c398252SKevin Wolf# @auto: inherit the error handling policy of the backend (since: 2.7)
11128c398252SKevin Wolf#
11131ad166b6SBenoît Canet# Since: 1.3
11141ad166b6SBenoît Canet##
11151ad166b6SBenoît Canet{ 'enum': 'BlockdevOnError',
11168c398252SKevin Wolf  'data': ['report', 'ignore', 'enospc', 'stop', 'auto'] }
11171ad166b6SBenoît Canet
11181ad166b6SBenoît Canet##
11191ad166b6SBenoît Canet# @MirrorSyncMode:
11201ad166b6SBenoît Canet#
11211ad166b6SBenoît Canet# An enumeration of possible behaviors for the initial synchronization
11221ad166b6SBenoît Canet# phase of storage mirroring.
11231ad166b6SBenoît Canet#
11241ad166b6SBenoît Canet# @top: copies data in the topmost image to the destination
11251ad166b6SBenoît Canet#
11261ad166b6SBenoît Canet# @full: copies data from all images to the destination
11271ad166b6SBenoît Canet#
11281ad166b6SBenoît Canet# @none: only copy data written from now on
11291ad166b6SBenoît Canet#
11304b80ab2bSJohn Snow# @incremental: only copy data described by the dirty bitmap. Since: 2.4
1131d58d8453SJohn Snow#
11321ad166b6SBenoît Canet# Since: 1.3
11331ad166b6SBenoît Canet##
11341ad166b6SBenoît Canet{ 'enum': 'MirrorSyncMode',
11354b80ab2bSJohn Snow  'data': ['top', 'full', 'none', 'incremental'] }
11361ad166b6SBenoît Canet
11371ad166b6SBenoît Canet##
1138d06107adSMax Reitz# @MirrorCopyMode:
1139d06107adSMax Reitz#
1140d06107adSMax Reitz# An enumeration whose values tell the mirror block job when to
1141d06107adSMax Reitz# trigger writes to the target.
1142d06107adSMax Reitz#
1143d06107adSMax Reitz# @background: copy data in background only.
1144d06107adSMax Reitz#
1145d06107adSMax Reitz# @write-blocking: when data is written to the source, write it
1146d06107adSMax Reitz#                  (synchronously) to the target as well.  In
1147d06107adSMax Reitz#                  addition, data is copied in background just like in
1148d06107adSMax Reitz#                  @background mode.
1149d06107adSMax Reitz#
1150d06107adSMax Reitz# Since: 3.0
1151d06107adSMax Reitz##
1152d06107adSMax Reitz{ 'enum': 'MirrorCopyMode',
1153d06107adSMax Reitz  'data': ['background', 'write-blocking'] }
1154d06107adSMax Reitz
1155d06107adSMax Reitz##
11561ad166b6SBenoît Canet# @BlockJobInfo:
11571ad166b6SBenoît Canet#
11581ad166b6SBenoît Canet# Information about a long-running block device operation.
11591ad166b6SBenoît Canet#
11601ad166b6SBenoît Canet# @type: the job type ('stream' for image streaming)
11611ad166b6SBenoît Canet#
11626aae5be6SAlberto Garcia# @device: The job identifier. Originally the device name but other
11636aae5be6SAlberto Garcia#          values are allowed since QEMU 2.7
11641ad166b6SBenoît Canet#
1165a81e0a82SKevin Wolf# @len: Estimated @offset value at the completion of the job. This value can
1166a81e0a82SKevin Wolf#       arbitrarily change while the job is running, in both directions.
1167a81e0a82SKevin Wolf#
1168a81e0a82SKevin Wolf# @offset: Progress made until now. The unit is arbitrary and the value can
1169a81e0a82SKevin Wolf#          only meaningfully be used for the ratio of @offset to @len. The
1170a81e0a82SKevin Wolf#          value is monotonically increasing.
11711ad166b6SBenoît Canet#
11721ad166b6SBenoît Canet# @busy: false if the job is known to be in a quiescent state, with
11731ad166b6SBenoît Canet#        no pending I/O.  Since 1.3.
11741ad166b6SBenoît Canet#
11751ad166b6SBenoît Canet# @paused: whether the job is paused or, if @busy is true, will
11761ad166b6SBenoît Canet#          pause itself as soon as possible.  Since 1.3.
11771ad166b6SBenoît Canet#
11781ad166b6SBenoît Canet# @speed: the rate limit, bytes per second
11791ad166b6SBenoît Canet#
11801ad166b6SBenoît Canet# @io-status: the status of the job (since 1.3)
11811ad166b6SBenoît Canet#
1182ef6dbf1eSMax Reitz# @ready: true if the job may be completed (since 2.2)
1183ef6dbf1eSMax Reitz#
118458b295baSJohn Snow# @status: Current job state/status (since 2.12)
118558b295baSJohn Snow#
1186b40dacdcSJohn Snow# @auto-finalize: Job will finalize itself when PENDING, moving to
1187b40dacdcSJohn Snow#                 the CONCLUDED state. (since 2.12)
1188b40dacdcSJohn Snow#
1189b40dacdcSJohn Snow# @auto-dismiss: Job will dismiss itself when CONCLUDED, moving to the NULL
1190b40dacdcSJohn Snow#                state and disappearing from the query list. (since 2.12)
1191b40dacdcSJohn Snow#
1192ab9ba614SJohn Snow# @error: Error information if the job did not complete successfully.
1193ab9ba614SJohn Snow#         Not set if the job completed successfully. (since 2.12.1)
1194ab9ba614SJohn Snow#
11951ad166b6SBenoît Canet# Since: 1.1
11961ad166b6SBenoît Canet##
1197895a2a80SEric Blake{ 'struct': 'BlockJobInfo',
11981ad166b6SBenoît Canet  'data': {'type': 'str', 'device': 'str', 'len': 'int',
11991ad166b6SBenoît Canet           'offset': 'int', 'busy': 'bool', 'paused': 'bool', 'speed': 'int',
120058b295baSJohn Snow           'io-status': 'BlockDeviceIoStatus', 'ready': 'bool',
1201a50c2ab8SKevin Wolf           'status': 'JobStatus',
1202ab9ba614SJohn Snow           'auto-finalize': 'bool', 'auto-dismiss': 'bool',
1203ab9ba614SJohn Snow           '*error': 'str' } }
12041ad166b6SBenoît Canet
12051ad166b6SBenoît Canet##
12061ad166b6SBenoît Canet# @query-block-jobs:
12071ad166b6SBenoît Canet#
12081ad166b6SBenoît Canet# Return information about long-running block device operations.
12091ad166b6SBenoît Canet#
12101ad166b6SBenoît Canet# Returns: a list of @BlockJobInfo for each active block job
12111ad166b6SBenoît Canet#
12121ad166b6SBenoît Canet# Since: 1.1
12131ad166b6SBenoît Canet##
12141ad166b6SBenoît Canet{ 'command': 'query-block-jobs', 'returns': ['BlockJobInfo'] }
12151ad166b6SBenoît Canet
12161ad166b6SBenoît Canet##
12171ad166b6SBenoît Canet# @block_passwd:
12181ad166b6SBenoît Canet#
12191ad166b6SBenoît Canet# This command sets the password of a block device that has not been open
12201ad166b6SBenoît Canet# with a password and requires one.
12211ad166b6SBenoît Canet#
1222c01c214bSDaniel P. Berrange# This command is now obsolete and will always return an error since 2.10
122391f96b64SMarc-André Lureau#
12241ad166b6SBenoît Canet##
1225b0ddeba2SMarc-André Lureau{ 'command': 'block_passwd',
1226b0ddeba2SMarc-André Lureau  'data': { '*device': 'str',
1227b0ddeba2SMarc-André Lureau            '*node-name': 'str',
1228b0ddeba2SMarc-André Lureau            'password': 'str' } }
12291ad166b6SBenoît Canet
12301ad166b6SBenoît Canet##
12315072f7b3SMarc-André Lureau# @block_resize:
12321ad166b6SBenoît Canet#
12331ad166b6SBenoît Canet# Resize a block image while a guest is running.
12341ad166b6SBenoît Canet#
12351ad166b6SBenoît Canet# Either @device or @node-name must be set but not both.
12361ad166b6SBenoît Canet#
12371d8bda12SMarkus Armbruster# @device: the name of the device to get the image resized
12381ad166b6SBenoît Canet#
12391d8bda12SMarkus Armbruster# @node-name: graph node name to get the image resized (Since 2.0)
12401ad166b6SBenoît Canet#
12411ad166b6SBenoît Canet# @size:  new image size in bytes
12421ad166b6SBenoît Canet#
12431ad166b6SBenoît Canet# Returns: nothing on success
12441ad166b6SBenoît Canet#          If @device is not a valid block device, DeviceNotFound
12451ad166b6SBenoît Canet#
12461ad166b6SBenoît Canet# Since: 0.14.0
12470dc869cfSMarc-André Lureau#
12480dc869cfSMarc-André Lureau# Example:
12490dc869cfSMarc-André Lureau#
12500dc869cfSMarc-André Lureau# -> { "execute": "block_resize",
12510dc869cfSMarc-André Lureau#      "arguments": { "device": "scratch", "size": 1073741824 } }
12520dc869cfSMarc-André Lureau# <- { "return": {} }
12530dc869cfSMarc-André Lureau#
12541ad166b6SBenoît Canet##
1255b0ddeba2SMarc-André Lureau{ 'command': 'block_resize',
1256b0ddeba2SMarc-André Lureau  'data': { '*device': 'str',
12571ad166b6SBenoît Canet            '*node-name': 'str',
12581ad166b6SBenoît Canet            'size': 'int' } }
12591ad166b6SBenoît Canet
12601ad166b6SBenoît Canet##
12615072f7b3SMarc-André Lureau# @NewImageMode:
12621ad166b6SBenoît Canet#
12631ad166b6SBenoît Canet# An enumeration that tells QEMU how to set the backing file path in
12641ad166b6SBenoît Canet# a new image file.
12651ad166b6SBenoît Canet#
12661ad166b6SBenoît Canet# @existing: QEMU should look for an existing image file.
12671ad166b6SBenoît Canet#
12681ad166b6SBenoît Canet# @absolute-paths: QEMU should create a new image with absolute paths
12691ad166b6SBenoît Canet# for the backing file. If there is no backing file available, the new
12701ad166b6SBenoît Canet# image will not be backed either.
12711ad166b6SBenoît Canet#
12721ad166b6SBenoît Canet# Since: 1.1
12731ad166b6SBenoît Canet##
12741ad166b6SBenoît Canet{ 'enum': 'NewImageMode',
12751ad166b6SBenoît Canet  'data': [ 'existing', 'absolute-paths' ] }
12761ad166b6SBenoît Canet
12771ad166b6SBenoît Canet##
12785072f7b3SMarc-André Lureau# @BlockdevSnapshotSync:
12791ad166b6SBenoît Canet#
12801ad166b6SBenoît Canet# Either @device or @node-name must be set but not both.
12811ad166b6SBenoît Canet#
1282*681b86acSMax Reitz# @device: the name of the device to take a snapshot of.
12831ad166b6SBenoît Canet#
12841d8bda12SMarkus Armbruster# @node-name: graph node name to generate the snapshot from (Since 2.0)
12851ad166b6SBenoît Canet#
1286*681b86acSMax Reitz# @snapshot-file: the target of the new overlay image. If the file
1287*681b86acSMax Reitz# exists, or if it is a device, the overlay will be created in the
1288*681b86acSMax Reitz# existing file/device. Otherwise, a new file will be created.
12891ad166b6SBenoît Canet#
12901d8bda12SMarkus Armbruster# @snapshot-node-name: the graph node name of the new image (Since 2.0)
12911ad166b6SBenoît Canet#
1292*681b86acSMax Reitz# @format: the format of the overlay image, default is 'qcow2'.
12931ad166b6SBenoît Canet#
12941d8bda12SMarkus Armbruster# @mode: whether and how QEMU should create a new image, default is
12951ad166b6SBenoît Canet#        'absolute-paths'.
12961ad166b6SBenoît Canet##
1297a911e6aeSAlberto Garcia{ 'struct': 'BlockdevSnapshotSync',
12981ad166b6SBenoît Canet  'data': { '*device': 'str', '*node-name': 'str',
12991ad166b6SBenoît Canet            'snapshot-file': 'str', '*snapshot-node-name': 'str',
13001ad166b6SBenoît Canet            '*format': 'str', '*mode': 'NewImageMode' } }
13011ad166b6SBenoît Canet
13021ad166b6SBenoît Canet##
13035072f7b3SMarc-André Lureau# @BlockdevSnapshot:
130443de7e2dSAlberto Garcia#
1305*681b86acSMax Reitz# @node: device or node name that will have a snapshot taken.
130643de7e2dSAlberto Garcia#
130743de7e2dSAlberto Garcia# @overlay: reference to the existing block device that will become
1308*681b86acSMax Reitz#           the overlay of @node, as part of taking the snapshot.
130943de7e2dSAlberto Garcia#           It must not have a current backing file (this can be
13104f7be280SMax Reitz#           achieved by passing "backing": null to blockdev-add).
131143de7e2dSAlberto Garcia#
13125072f7b3SMarc-André Lureau# Since: 2.5
131343de7e2dSAlberto Garcia##
131443de7e2dSAlberto Garcia{ 'struct': 'BlockdevSnapshot',
131543de7e2dSAlberto Garcia  'data': { 'node': 'str', 'overlay': 'str' } }
131643de7e2dSAlberto Garcia
131743de7e2dSAlberto Garcia##
13185072f7b3SMarc-André Lureau# @DriveBackup:
13191ad166b6SBenoît Canet#
13201d8bda12SMarkus Armbruster# @job-id: identifier for the newly-created block job. If
132170559d49SAlberto Garcia#          omitted, the device name will be used. (Since 2.7)
132270559d49SAlberto Garcia#
1323b7e4fa22SKevin Wolf# @device: the device name or node-name of a root node which should be copied.
13241ad166b6SBenoît Canet#
13251ad166b6SBenoît Canet# @target: the target of the new image. If the file exists, or if it
13261ad166b6SBenoît Canet#          is a device, the existing file/device will be used as the new
13271ad166b6SBenoît Canet#          destination.  If it does not exist, a new file will be created.
13281ad166b6SBenoît Canet#
13291d8bda12SMarkus Armbruster# @format: the format of the new destination, default is to
13301ad166b6SBenoît Canet#          probe if @mode is 'existing', else the format of the source
13311ad166b6SBenoît Canet#
13321ad166b6SBenoît Canet# @sync: what parts of the disk image should be copied to the destination
1333d58d8453SJohn Snow#        (all the disk, only the sectors allocated in the topmost image, from a
1334d58d8453SJohn Snow#        dirty bitmap, or only new I/O).
13351ad166b6SBenoît Canet#
13361d8bda12SMarkus Armbruster# @mode: whether and how QEMU should create a new image, default is
13371ad166b6SBenoît Canet#        'absolute-paths'.
13381ad166b6SBenoît Canet#
13391d8bda12SMarkus Armbruster# @speed: the maximum speed, in bytes per second
13401ad166b6SBenoît Canet#
13411d8bda12SMarkus Armbruster# @bitmap: the name of dirty bitmap if sync is "incremental".
13424b80ab2bSJohn Snow#          Must be present if sync is "incremental", must NOT be present
1343d58d8453SJohn Snow#          otherwise. (Since 2.4)
1344d58d8453SJohn Snow#
13451d8bda12SMarkus Armbruster# @compress: true to compress data, if the target format supports it.
13466bed0280SKevin Wolf#            (default: false) (since 2.8)
134713b9414bSPavel Butsykin#
13481d8bda12SMarkus Armbruster# @on-source-error: the action to take on an error on the source,
13491ad166b6SBenoît Canet#                   default 'report'.  'stop' and 'enospc' can only be used
13501ad166b6SBenoît Canet#                   if the block device supports io-status (see BlockInfo).
13511ad166b6SBenoît Canet#
13521d8bda12SMarkus Armbruster# @on-target-error: the action to take on an error on the target,
13531ad166b6SBenoît Canet#                   default 'report' (no limitations, since this applies to
13541ad166b6SBenoît Canet#                   a different block device than @device).
13551ad166b6SBenoît Canet#
1356b40dacdcSJohn Snow# @auto-finalize: When false, this job will wait in a PENDING state after it has
1357dfaff2c3SJohn Snow#                 finished its work, waiting for @block-job-finalize before
1358dfaff2c3SJohn Snow#                 making any block graph changes.
1359dfaff2c3SJohn Snow#                 When true, this job will automatically
1360dfaff2c3SJohn Snow#                 perform its abort or commit actions.
1361b40dacdcSJohn Snow#                 Defaults to true. (Since 2.12)
1362b40dacdcSJohn Snow#
1363b40dacdcSJohn Snow# @auto-dismiss: When false, this job will wait in a CONCLUDED state after it
1364dfaff2c3SJohn Snow#                has completely ceased all work, and awaits @block-job-dismiss.
1365b40dacdcSJohn Snow#                When true, this job will automatically disappear from the query
1366b40dacdcSJohn Snow#                list without user intervention.
1367b40dacdcSJohn Snow#                Defaults to true. (Since 2.12)
1368b40dacdcSJohn Snow#
13695072f7b3SMarc-André Lureau# Note: @on-source-error and @on-target-error only affect background
13705072f7b3SMarc-André Lureau# I/O.  If an error occurs during a guest write request, the device's
13715072f7b3SMarc-André Lureau# rerror/werror actions will be used.
13721ad166b6SBenoît Canet#
13731ad166b6SBenoît Canet# Since: 1.6
13741ad166b6SBenoît Canet##
1375895a2a80SEric Blake{ 'struct': 'DriveBackup',
137670559d49SAlberto Garcia  'data': { '*job-id': 'str', 'device': 'str', 'target': 'str',
1377b40dacdcSJohn Snow            '*format': 'str', 'sync': 'MirrorSyncMode',
1378b40dacdcSJohn Snow            '*mode': 'NewImageMode', '*speed': 'int',
1379b40dacdcSJohn Snow            '*bitmap': 'str', '*compress': 'bool',
13801ad166b6SBenoît Canet            '*on-source-error': 'BlockdevOnError',
1381b40dacdcSJohn Snow            '*on-target-error': 'BlockdevOnError',
1382b40dacdcSJohn Snow            '*auto-finalize': 'bool', '*auto-dismiss': 'bool' } }
13831ad166b6SBenoît Canet
13841ad166b6SBenoît Canet##
13855072f7b3SMarc-André Lureau# @BlockdevBackup:
1386c29c1dd3SFam Zheng#
13871d8bda12SMarkus Armbruster# @job-id: identifier for the newly-created block job. If
138870559d49SAlberto Garcia#          omitted, the device name will be used. (Since 2.7)
138970559d49SAlberto Garcia#
1390cef34eebSKevin Wolf# @device: the device name or node-name of a root node which should be copied.
1391c29c1dd3SFam Zheng#
139239d990acSKevin Wolf# @target: the device name or node-name of the backup target node.
1393c29c1dd3SFam Zheng#
1394c29c1dd3SFam Zheng# @sync: what parts of the disk image should be copied to the destination
1395c29c1dd3SFam Zheng#        (all the disk, only the sectors allocated in the topmost image, or
1396c29c1dd3SFam Zheng#        only new I/O).
1397c29c1dd3SFam Zheng#
13981d8bda12SMarkus Armbruster# @speed: the maximum speed, in bytes per second. The default is 0,
1399c29c1dd3SFam Zheng#         for unlimited.
1400c29c1dd3SFam Zheng#
1401945c1ee0SJohn Snow# @bitmap: the name of dirty bitmap if sync is "incremental".
1402945c1ee0SJohn Snow#          Must be present if sync is "incremental", must NOT be present
1403945c1ee0SJohn Snow#          otherwise. (Since 3.1)
1404945c1ee0SJohn Snow#
14051d8bda12SMarkus Armbruster# @compress: true to compress data, if the target format supports it.
14066bed0280SKevin Wolf#            (default: false) (since 2.8)
14073b7b1236SPavel Butsykin#
14081d8bda12SMarkus Armbruster# @on-source-error: the action to take on an error on the source,
1409c29c1dd3SFam Zheng#                   default 'report'.  'stop' and 'enospc' can only be used
1410c29c1dd3SFam Zheng#                   if the block device supports io-status (see BlockInfo).
1411c29c1dd3SFam Zheng#
14121d8bda12SMarkus Armbruster# @on-target-error: the action to take on an error on the target,
1413c29c1dd3SFam Zheng#                   default 'report' (no limitations, since this applies to
1414c29c1dd3SFam Zheng#                   a different block device than @device).
1415c29c1dd3SFam Zheng#
1416b40dacdcSJohn Snow# @auto-finalize: When false, this job will wait in a PENDING state after it has
1417dfaff2c3SJohn Snow#                 finished its work, waiting for @block-job-finalize before
1418dfaff2c3SJohn Snow#                 making any block graph changes.
1419dfaff2c3SJohn Snow#                 When true, this job will automatically
1420dfaff2c3SJohn Snow#                 perform its abort or commit actions.
1421b40dacdcSJohn Snow#                 Defaults to true. (Since 2.12)
1422b40dacdcSJohn Snow#
1423b40dacdcSJohn Snow# @auto-dismiss: When false, this job will wait in a CONCLUDED state after it
1424dfaff2c3SJohn Snow#                has completely ceased all work, and awaits @block-job-dismiss.
1425b40dacdcSJohn Snow#                When true, this job will automatically disappear from the query
1426b40dacdcSJohn Snow#                list without user intervention.
1427b40dacdcSJohn Snow#                Defaults to true. (Since 2.12)
1428b40dacdcSJohn Snow#
14295072f7b3SMarc-André Lureau# Note: @on-source-error and @on-target-error only affect background
14305072f7b3SMarc-André Lureau# I/O.  If an error occurs during a guest write request, the device's
14315072f7b3SMarc-André Lureau# rerror/werror actions will be used.
1432c29c1dd3SFam Zheng#
1433c29c1dd3SFam Zheng# Since: 2.3
1434c29c1dd3SFam Zheng##
1435895a2a80SEric Blake{ 'struct': 'BlockdevBackup',
143670559d49SAlberto Garcia  'data': { '*job-id': 'str', 'device': 'str', 'target': 'str',
1437945c1ee0SJohn Snow            'sync': 'MirrorSyncMode', '*speed': 'int',
1438945c1ee0SJohn Snow            '*bitmap': 'str', '*compress': 'bool',
1439c29c1dd3SFam Zheng            '*on-source-error': 'BlockdevOnError',
1440b40dacdcSJohn Snow            '*on-target-error': 'BlockdevOnError',
1441b40dacdcSJohn Snow            '*auto-finalize': 'bool', '*auto-dismiss': 'bool' } }
1442c29c1dd3SFam Zheng
1443c29c1dd3SFam Zheng##
14445072f7b3SMarc-André Lureau# @blockdev-snapshot-sync:
14451ad166b6SBenoît Canet#
1446*681b86acSMax Reitz# Takes a synchronous snapshot of a block device.
14471ad166b6SBenoît Canet#
1448a911e6aeSAlberto Garcia# For the arguments, see the documentation of BlockdevSnapshotSync.
14491ad166b6SBenoît Canet#
14501ad166b6SBenoît Canet# Returns: nothing on success
14511ad166b6SBenoît Canet#          If @device is not a valid block device, DeviceNotFound
14521ad166b6SBenoît Canet#
14535072f7b3SMarc-André Lureau# Since: 0.14.0
1454b4039d8dSMarc-André Lureau#
1455b4039d8dSMarc-André Lureau# Example:
1456b4039d8dSMarc-André Lureau#
1457b4039d8dSMarc-André Lureau# -> { "execute": "blockdev-snapshot-sync",
1458b4039d8dSMarc-André Lureau#      "arguments": { "device": "ide-hd0",
1459b4039d8dSMarc-André Lureau#                     "snapshot-file":
1460b4039d8dSMarc-André Lureau#                     "/some/place/my-image",
1461b4039d8dSMarc-André Lureau#                     "format": "qcow2" } }
1462b4039d8dSMarc-André Lureau# <- { "return": {} }
1463b4039d8dSMarc-André Lureau#
14641ad166b6SBenoît Canet##
14651ad166b6SBenoît Canet{ 'command': 'blockdev-snapshot-sync',
1466a911e6aeSAlberto Garcia  'data': 'BlockdevSnapshotSync' }
14671ad166b6SBenoît Canet
146843de7e2dSAlberto Garcia
146943de7e2dSAlberto Garcia##
14705072f7b3SMarc-André Lureau# @blockdev-snapshot:
147143de7e2dSAlberto Garcia#
1472*681b86acSMax Reitz# Takes a snapshot of a block device.
147343de7e2dSAlberto Garcia#
1474*681b86acSMax Reitz# Take a snapshot, by installing 'node' as the backing image of
14753282eca4SMarc-André Lureau# 'overlay'. Additionally, if 'node' is associated with a block
14763282eca4SMarc-André Lureau# device, the block device changes to using 'overlay' as its new active
14773282eca4SMarc-André Lureau# image.
14783282eca4SMarc-André Lureau#
147943de7e2dSAlberto Garcia# For the arguments, see the documentation of BlockdevSnapshot.
148043de7e2dSAlberto Garcia#
14815072f7b3SMarc-André Lureau# Since: 2.5
14823282eca4SMarc-André Lureau#
14833282eca4SMarc-André Lureau# Example:
14843282eca4SMarc-André Lureau#
14853282eca4SMarc-André Lureau# -> { "execute": "blockdev-add",
1486244d04dbSEric Blake#      "arguments": { "driver": "qcow2",
14873282eca4SMarc-André Lureau#                     "node-name": "node1534",
14883282eca4SMarc-André Lureau#                     "file": { "driver": "file",
14893282eca4SMarc-André Lureau#                               "filename": "hd1.qcow2" },
14904f7be280SMax Reitz#                     "backing": null } }
14913282eca4SMarc-André Lureau#
14923282eca4SMarc-André Lureau# <- { "return": {} }
14933282eca4SMarc-André Lureau#
14943282eca4SMarc-André Lureau# -> { "execute": "blockdev-snapshot",
14953282eca4SMarc-André Lureau#      "arguments": { "node": "ide-hd0",
14963282eca4SMarc-André Lureau#                     "overlay": "node1534" } }
14973282eca4SMarc-André Lureau# <- { "return": {} }
14983282eca4SMarc-André Lureau#
149943de7e2dSAlberto Garcia##
150043de7e2dSAlberto Garcia{ 'command': 'blockdev-snapshot',
150143de7e2dSAlberto Garcia  'data': 'BlockdevSnapshot' }
150243de7e2dSAlberto Garcia
15031ad166b6SBenoît Canet##
15045072f7b3SMarc-André Lureau# @change-backing-file:
1505fa40e656SJeff Cody#
1506fa40e656SJeff Cody# Change the backing file in the image file metadata.  This does not
1507fa40e656SJeff Cody# cause QEMU to reopen the image file to reparse the backing filename
1508fa40e656SJeff Cody# (it may, however, perform a reopen to change permissions from
1509fa40e656SJeff Cody# r/o -> r/w -> r/o, if needed). The new backing file string is written
1510fa40e656SJeff Cody# into the image file metadata, and the QEMU internal strings are
1511fa40e656SJeff Cody# updated.
1512fa40e656SJeff Cody#
1513fa40e656SJeff Cody# @image-node-name: The name of the block driver state node of the
1514280c4b3cSMarc-André Lureau#                   image to modify. The "device" argument is used
1515280c4b3cSMarc-André Lureau#                   to verify "image-node-name" is in the chain
1516280c4b3cSMarc-André Lureau#                   described by "device".
1517fa40e656SJeff Cody#
15187b5dca3fSKevin Wolf# @device:          The device name or node-name of the root node that owns
15197b5dca3fSKevin Wolf#                   image-node-name.
1520fa40e656SJeff Cody#
1521fa40e656SJeff Cody# @backing-file:    The string to write as the backing file.  This
1522fa40e656SJeff Cody#                   string is not validated, so care should be taken
1523fa40e656SJeff Cody#                   when specifying the string or the image chain may
1524fa40e656SJeff Cody#                   not be able to be reopened again.
1525fa40e656SJeff Cody#
1526280c4b3cSMarc-André Lureau# Returns: Nothing on success
1527280c4b3cSMarc-André Lureau#
1528280c4b3cSMarc-André Lureau#          If "device" does not exist or cannot be determined, DeviceNotFound
1529280c4b3cSMarc-André Lureau#
1530fa40e656SJeff Cody# Since: 2.1
1531fa40e656SJeff Cody##
1532fa40e656SJeff Cody{ 'command': 'change-backing-file',
1533fa40e656SJeff Cody  'data': { 'device': 'str', 'image-node-name': 'str',
1534fa40e656SJeff Cody            'backing-file': 'str' } }
1535fa40e656SJeff Cody
1536fa40e656SJeff Cody##
15375072f7b3SMarc-André Lureau# @block-commit:
15381ad166b6SBenoît Canet#
15391ad166b6SBenoît Canet# Live commit of data from overlay image nodes into backing nodes - i.e.,
15401ad166b6SBenoît Canet# writes data between 'top' and 'base' into 'base'.
15411ad166b6SBenoît Canet#
15421d8bda12SMarkus Armbruster# @job-id: identifier for the newly-created block job. If
1543fd62c609SAlberto Garcia#          omitted, the device name will be used. (Since 2.7)
1544fd62c609SAlberto Garcia#
15451d13b167SKevin Wolf# @device:  the device name or node-name of a root node
15461ad166b6SBenoît Canet#
15473c605f40SKevin Wolf# @base-node: The node name of the backing image to write data into.
1548f44fb58fSMarc-André Lureau#             If not specified, this is the deepest backing image.
15493c605f40SKevin Wolf#             (since: 3.1)
15501ad166b6SBenoît Canet#
15513c605f40SKevin Wolf# @base: Same as @base-node, except that it is a file name rather than a node
15523c605f40SKevin Wolf#        name. This must be the exact filename string that was used to open the
15533c605f40SKevin Wolf#        node; other strings, even if addressing the same file, are not
15543c605f40SKevin Wolf#        accepted (deprecated, use @base-node instead)
15553c605f40SKevin Wolf#
15563c605f40SKevin Wolf# @top-node: The node name of the backing image within the image chain
15577676e2c5SJeff Cody#            which contains the topmost data to be committed down. If
15583c605f40SKevin Wolf#            not specified, this is the active layer. (since: 3.1)
15593c605f40SKevin Wolf#
15603c605f40SKevin Wolf# @top: Same as @top-node, except that it is a file name rather than a node
15613c605f40SKevin Wolf#       name. This must be the exact filename string that was used to open the
15623c605f40SKevin Wolf#       node; other strings, even if addressing the same file, are not
15633c605f40SKevin Wolf#       accepted (deprecated, use @base-node instead)
15641ad166b6SBenoît Canet#
15651d8bda12SMarkus Armbruster# @backing-file:  The backing file string to write into the overlay
156654e26900SJeff Cody#                           image of 'top'.  If 'top' is the active layer,
156754e26900SJeff Cody#                           specifying a backing file string is an error. This
156854e26900SJeff Cody#                           filename is not validated.
156954e26900SJeff Cody#
157054e26900SJeff Cody#                           If a pathname string is such that it cannot be
157154e26900SJeff Cody#                           resolved by QEMU, that means that subsequent QMP or
157254e26900SJeff Cody#                           HMP commands must use node-names for the image in
157354e26900SJeff Cody#                           question, as filename lookup methods will fail.
157454e26900SJeff Cody#
157554e26900SJeff Cody#                           If not specified, QEMU will automatically determine
157654e26900SJeff Cody#                           the backing file string to use, or error out if
157754e26900SJeff Cody#                           there is no obvious choice. Care should be taken
157854e26900SJeff Cody#                           when specifying the string, to specify a valid
157954e26900SJeff Cody#                           filename or protocol.
158054e26900SJeff Cody#                           (Since 2.1)
158154e26900SJeff Cody#
15821ad166b6SBenoît Canet#                    If top == base, that is an error.
15831ad166b6SBenoît Canet#                    If top == active, the job will not be completed by itself,
15841ad166b6SBenoît Canet#                    user needs to complete the job with the block-job-complete
15851ad166b6SBenoît Canet#                    command after getting the ready event. (Since 2.0)
15861ad166b6SBenoît Canet#
15871ad166b6SBenoît Canet#                    If the base image is smaller than top, then the base image
15881ad166b6SBenoît Canet#                    will be resized to be the same size as top.  If top is
15891ad166b6SBenoît Canet#                    smaller than the base image, the base will not be
15901ad166b6SBenoît Canet#                    truncated.  If you want the base image size to match the
15911ad166b6SBenoît Canet#                    size of the smaller top, you can safely truncate it
15921ad166b6SBenoît Canet#                    yourself once the commit operation successfully completes.
15931ad166b6SBenoît Canet#
15941d8bda12SMarkus Armbruster# @speed:  the maximum speed, in bytes per second
15951ad166b6SBenoît Canet#
15961d8bda12SMarkus Armbruster# @filter-node-name: the node name that should be assigned to the
15970db832f4SKevin Wolf#                    filter driver that the commit job inserts into the graph
15980db832f4SKevin Wolf#                    above @top. If this option is not given, a node name is
15990db832f4SKevin Wolf#                    autogenerated. (Since: 2.9)
16000db832f4SKevin Wolf#
160196fbf534SJohn Snow# @auto-finalize: When false, this job will wait in a PENDING state after it has
160296fbf534SJohn Snow#                 finished its work, waiting for @block-job-finalize before
160396fbf534SJohn Snow#                 making any block graph changes.
160496fbf534SJohn Snow#                 When true, this job will automatically
160596fbf534SJohn Snow#                 perform its abort or commit actions.
160696fbf534SJohn Snow#                 Defaults to true. (Since 3.1)
160796fbf534SJohn Snow#
160896fbf534SJohn Snow# @auto-dismiss: When false, this job will wait in a CONCLUDED state after it
160996fbf534SJohn Snow#                has completely ceased all work, and awaits @block-job-dismiss.
161096fbf534SJohn Snow#                When true, this job will automatically disappear from the query
161196fbf534SJohn Snow#                list without user intervention.
161296fbf534SJohn Snow#                Defaults to true. (Since 3.1)
161396fbf534SJohn Snow#
16141ad166b6SBenoît Canet# Returns: Nothing on success
16151ad166b6SBenoît Canet#          If @device does not exist, DeviceNotFound
1616b5fc2d30SPeter Krempa#          Any other error returns a GenericError.
16171ad166b6SBenoît Canet#
16181ad166b6SBenoît Canet# Since: 1.3
16191ad166b6SBenoît Canet#
1620f44fb58fSMarc-André Lureau# Example:
1621f44fb58fSMarc-André Lureau#
1622f44fb58fSMarc-André Lureau# -> { "execute": "block-commit",
1623f44fb58fSMarc-André Lureau#      "arguments": { "device": "virtio0",
1624f44fb58fSMarc-André Lureau#                     "top": "/tmp/snap1.qcow2" } }
1625f44fb58fSMarc-André Lureau# <- { "return": {} }
1626f44fb58fSMarc-André Lureau#
16271ad166b6SBenoît Canet##
16281ad166b6SBenoît Canet{ 'command': 'block-commit',
16293c605f40SKevin Wolf  'data': { '*job-id': 'str', 'device': 'str', '*base-node': 'str',
16303c605f40SKevin Wolf            '*base': 'str', '*top-node': 'str', '*top': 'str',
16310db832f4SKevin Wolf            '*backing-file': 'str', '*speed': 'int',
163296fbf534SJohn Snow            '*filter-node-name': 'str',
163396fbf534SJohn Snow            '*auto-finalize': 'bool', '*auto-dismiss': 'bool' } }
16341ad166b6SBenoît Canet
16351ad166b6SBenoît Canet##
16365072f7b3SMarc-André Lureau# @drive-backup:
16371ad166b6SBenoît Canet#
16381ad166b6SBenoît Canet# Start a point-in-time copy of a block device to a new destination.  The
16391ad166b6SBenoît Canet# status of ongoing drive-backup operations can be checked with
16401ad166b6SBenoît Canet# query-block-jobs where the BlockJobInfo.type field has the value 'backup'.
16411ad166b6SBenoît Canet# The operation can be stopped before it has completed using the
16421ad166b6SBenoît Canet# block-job-cancel command.
16431ad166b6SBenoît Canet#
16441ad166b6SBenoît Canet# Returns: nothing on success
1645b7e4fa22SKevin Wolf#          If @device is not a valid block device, GenericError
16461ad166b6SBenoît Canet#
16475072f7b3SMarc-André Lureau# Since: 1.6
1648b0336412SMarc-André Lureau#
1649b0336412SMarc-André Lureau# Example:
1650b0336412SMarc-André Lureau#
1651b0336412SMarc-André Lureau# -> { "execute": "drive-backup",
1652b0336412SMarc-André Lureau#      "arguments": { "device": "drive0",
1653b0336412SMarc-André Lureau#                     "sync": "full",
1654b0336412SMarc-André Lureau#                     "target": "backup.img" } }
1655b0336412SMarc-André Lureau# <- { "return": {} }
1656b0336412SMarc-André Lureau#
16571ad166b6SBenoît Canet##
165881206a89SPavel Butsykin{ 'command': 'drive-backup', 'boxed': true,
165981206a89SPavel Butsykin  'data': 'DriveBackup' }
16601ad166b6SBenoît Canet
16611ad166b6SBenoît Canet##
16625072f7b3SMarc-André Lureau# @blockdev-backup:
1663c29c1dd3SFam Zheng#
1664c29c1dd3SFam Zheng# Start a point-in-time copy of a block device to a new destination.  The
1665c29c1dd3SFam Zheng# status of ongoing blockdev-backup operations can be checked with
1666c29c1dd3SFam Zheng# query-block-jobs where the BlockJobInfo.type field has the value 'backup'.
1667c29c1dd3SFam Zheng# The operation can be stopped before it has completed using the
1668c29c1dd3SFam Zheng# block-job-cancel command.
1669c29c1dd3SFam Zheng#
1670dc7a4a9eSPavel Butsykin# Returns: nothing on success
1671dc7a4a9eSPavel Butsykin#          If @device is not a valid block device, DeviceNotFound
1672dc7a4a9eSPavel Butsykin#
16735072f7b3SMarc-André Lureau# Since: 2.3
16741cf75113SMarc-André Lureau#
16751cf75113SMarc-André Lureau# Example:
16761cf75113SMarc-André Lureau# -> { "execute": "blockdev-backup",
16771cf75113SMarc-André Lureau#      "arguments": { "device": "src-id",
16781cf75113SMarc-André Lureau#                     "sync": "full",
16791cf75113SMarc-André Lureau#                     "target": "tgt-id" } }
16801cf75113SMarc-André Lureau# <- { "return": {} }
16811cf75113SMarc-André Lureau#
1682c29c1dd3SFam Zheng##
1683dc7a4a9eSPavel Butsykin{ 'command': 'blockdev-backup', 'boxed': true,
1684dc7a4a9eSPavel Butsykin  'data': 'BlockdevBackup' }
1685c29c1dd3SFam Zheng
1686c29c1dd3SFam Zheng
1687c29c1dd3SFam Zheng##
16885072f7b3SMarc-André Lureau# @query-named-block-nodes:
16891ad166b6SBenoît Canet#
16901ad166b6SBenoît Canet# Get the named block driver list
16911ad166b6SBenoît Canet#
16921ad166b6SBenoît Canet# Returns: the list of BlockDeviceInfo
16931ad166b6SBenoît Canet#
16945072f7b3SMarc-André Lureau# Since: 2.0
1695e1f34cb2SMarc-André Lureau#
1696e1f34cb2SMarc-André Lureau# Example:
1697e1f34cb2SMarc-André Lureau#
1698e1f34cb2SMarc-André Lureau# -> { "execute": "query-named-block-nodes" }
1699e1f34cb2SMarc-André Lureau# <- { "return": [ { "ro":false,
1700e1f34cb2SMarc-André Lureau#                    "drv":"qcow2",
1701e1f34cb2SMarc-André Lureau#                    "encrypted":false,
1702e1f34cb2SMarc-André Lureau#                    "file":"disks/test.qcow2",
1703e1f34cb2SMarc-André Lureau#                    "node-name": "my-node",
1704e1f34cb2SMarc-André Lureau#                    "backing_file_depth":1,
1705e1f34cb2SMarc-André Lureau#                    "bps":1000000,
1706e1f34cb2SMarc-André Lureau#                    "bps_rd":0,
1707e1f34cb2SMarc-André Lureau#                    "bps_wr":0,
1708e1f34cb2SMarc-André Lureau#                    "iops":1000000,
1709e1f34cb2SMarc-André Lureau#                    "iops_rd":0,
1710e1f34cb2SMarc-André Lureau#                    "iops_wr":0,
1711e1f34cb2SMarc-André Lureau#                    "bps_max": 8000000,
1712e1f34cb2SMarc-André Lureau#                    "bps_rd_max": 0,
1713e1f34cb2SMarc-André Lureau#                    "bps_wr_max": 0,
1714e1f34cb2SMarc-André Lureau#                    "iops_max": 0,
1715e1f34cb2SMarc-André Lureau#                    "iops_rd_max": 0,
1716e1f34cb2SMarc-André Lureau#                    "iops_wr_max": 0,
1717e1f34cb2SMarc-André Lureau#                    "iops_size": 0,
1718e1f34cb2SMarc-André Lureau#                    "write_threshold": 0,
1719e1f34cb2SMarc-André Lureau#                    "image":{
1720e1f34cb2SMarc-André Lureau#                       "filename":"disks/test.qcow2",
1721e1f34cb2SMarc-André Lureau#                       "format":"qcow2",
1722e1f34cb2SMarc-André Lureau#                       "virtual-size":2048000,
1723e1f34cb2SMarc-André Lureau#                       "backing_file":"base.qcow2",
1724e1f34cb2SMarc-André Lureau#                       "full-backing-filename":"disks/base.qcow2",
1725e1f34cb2SMarc-André Lureau#                       "backing-filename-format":"qcow2",
1726e1f34cb2SMarc-André Lureau#                       "snapshots":[
1727e1f34cb2SMarc-André Lureau#                          {
1728e1f34cb2SMarc-André Lureau#                             "id": "1",
1729e1f34cb2SMarc-André Lureau#                             "name": "snapshot1",
1730e1f34cb2SMarc-André Lureau#                             "vm-state-size": 0,
1731e1f34cb2SMarc-André Lureau#                             "date-sec": 10000200,
1732e1f34cb2SMarc-André Lureau#                             "date-nsec": 12,
1733e1f34cb2SMarc-André Lureau#                             "vm-clock-sec": 206,
1734e1f34cb2SMarc-André Lureau#                             "vm-clock-nsec": 30
1735e1f34cb2SMarc-André Lureau#                          }
1736e1f34cb2SMarc-André Lureau#                       ],
1737e1f34cb2SMarc-André Lureau#                       "backing-image":{
1738e1f34cb2SMarc-André Lureau#                           "filename":"disks/base.qcow2",
1739e1f34cb2SMarc-André Lureau#                           "format":"qcow2",
1740e1f34cb2SMarc-André Lureau#                           "virtual-size":2048000
1741e1f34cb2SMarc-André Lureau#                       }
1742e1f34cb2SMarc-André Lureau#                    } } ] }
1743e1f34cb2SMarc-André Lureau#
17441ad166b6SBenoît Canet##
17451ad166b6SBenoît Canet{ 'command': 'query-named-block-nodes', 'returns': [ 'BlockDeviceInfo' ] }
17461ad166b6SBenoît Canet
17471ad166b6SBenoît Canet##
17485d3b4e99SVladimir Sementsov-Ogievskiy# @XDbgBlockGraphNodeType:
17495d3b4e99SVladimir Sementsov-Ogievskiy#
17505d3b4e99SVladimir Sementsov-Ogievskiy# @block-backend: corresponds to BlockBackend
17515d3b4e99SVladimir Sementsov-Ogievskiy#
17525d3b4e99SVladimir Sementsov-Ogievskiy# @block-job: corresonds to BlockJob
17535d3b4e99SVladimir Sementsov-Ogievskiy#
17545d3b4e99SVladimir Sementsov-Ogievskiy# @block-driver: corresponds to BlockDriverState
17555d3b4e99SVladimir Sementsov-Ogievskiy#
17565d3b4e99SVladimir Sementsov-Ogievskiy# Since: 4.0
17575d3b4e99SVladimir Sementsov-Ogievskiy##
17585d3b4e99SVladimir Sementsov-Ogievskiy{ 'enum': 'XDbgBlockGraphNodeType',
17595d3b4e99SVladimir Sementsov-Ogievskiy  'data': [ 'block-backend', 'block-job', 'block-driver' ] }
17605d3b4e99SVladimir Sementsov-Ogievskiy
17615d3b4e99SVladimir Sementsov-Ogievskiy##
17625d3b4e99SVladimir Sementsov-Ogievskiy# @XDbgBlockGraphNode:
17635d3b4e99SVladimir Sementsov-Ogievskiy#
17645d3b4e99SVladimir Sementsov-Ogievskiy# @id: Block graph node identifier. This @id is generated only for
17655d3b4e99SVladimir Sementsov-Ogievskiy#      x-debug-query-block-graph and does not relate to any other identifiers in
17665d3b4e99SVladimir Sementsov-Ogievskiy#      Qemu.
17675d3b4e99SVladimir Sementsov-Ogievskiy#
17685d3b4e99SVladimir Sementsov-Ogievskiy# @type: Type of graph node. Can be one of block-backend, block-job or
17695d3b4e99SVladimir Sementsov-Ogievskiy#        block-driver-state.
17705d3b4e99SVladimir Sementsov-Ogievskiy#
17715d3b4e99SVladimir Sementsov-Ogievskiy# @name: Human readable name of the node. Corresponds to node-name for
17725d3b4e99SVladimir Sementsov-Ogievskiy#        block-driver-state nodes; is not guaranteed to be unique in the whole
17735d3b4e99SVladimir Sementsov-Ogievskiy#        graph (with block-jobs and block-backends).
17745d3b4e99SVladimir Sementsov-Ogievskiy#
17755d3b4e99SVladimir Sementsov-Ogievskiy# Since: 4.0
17765d3b4e99SVladimir Sementsov-Ogievskiy##
17775d3b4e99SVladimir Sementsov-Ogievskiy{ 'struct': 'XDbgBlockGraphNode',
17785d3b4e99SVladimir Sementsov-Ogievskiy  'data': { 'id': 'uint64', 'type': 'XDbgBlockGraphNodeType', 'name': 'str' } }
17795d3b4e99SVladimir Sementsov-Ogievskiy
17805d3b4e99SVladimir Sementsov-Ogievskiy##
17815d3b4e99SVladimir Sementsov-Ogievskiy# @BlockPermission:
17825d3b4e99SVladimir Sementsov-Ogievskiy#
17835d3b4e99SVladimir Sementsov-Ogievskiy# Enum of base block permissions.
17845d3b4e99SVladimir Sementsov-Ogievskiy#
17855d3b4e99SVladimir Sementsov-Ogievskiy# @consistent-read: A user that has the "permission" of consistent reads is
17865d3b4e99SVladimir Sementsov-Ogievskiy#                   guaranteed that their view of the contents of the block
17875d3b4e99SVladimir Sementsov-Ogievskiy#                   device is complete and self-consistent, representing the
17885d3b4e99SVladimir Sementsov-Ogievskiy#                   contents of a disk at a specific point.
17895d3b4e99SVladimir Sementsov-Ogievskiy#                   For most block devices (including their backing files) this
17905d3b4e99SVladimir Sementsov-Ogievskiy#                   is true, but the property cannot be maintained in a few
17915d3b4e99SVladimir Sementsov-Ogievskiy#                   situations like for intermediate nodes of a commit block
17925d3b4e99SVladimir Sementsov-Ogievskiy#                   job.
17935d3b4e99SVladimir Sementsov-Ogievskiy#
17945d3b4e99SVladimir Sementsov-Ogievskiy# @write: This permission is required to change the visible disk contents.
17955d3b4e99SVladimir Sementsov-Ogievskiy#
17965d3b4e99SVladimir Sementsov-Ogievskiy# @write-unchanged: This permission (which is weaker than BLK_PERM_WRITE) is
17975d3b4e99SVladimir Sementsov-Ogievskiy#                   both enough and required for writes to the block node when
17985d3b4e99SVladimir Sementsov-Ogievskiy#                   the caller promises that the visible disk content doesn't
17995d3b4e99SVladimir Sementsov-Ogievskiy#                   change.
18005d3b4e99SVladimir Sementsov-Ogievskiy#                   As the BLK_PERM_WRITE permission is strictly stronger,
18015d3b4e99SVladimir Sementsov-Ogievskiy#                   either is sufficient to perform an unchanging write.
18025d3b4e99SVladimir Sementsov-Ogievskiy#
18035d3b4e99SVladimir Sementsov-Ogievskiy# @resize: This permission is required to change the size of a block node.
18045d3b4e99SVladimir Sementsov-Ogievskiy#
18055d3b4e99SVladimir Sementsov-Ogievskiy# @graph-mod: This permission is required to change the node that this
18065d3b4e99SVladimir Sementsov-Ogievskiy#             BdrvChild points to.
18075d3b4e99SVladimir Sementsov-Ogievskiy#
18085d3b4e99SVladimir Sementsov-Ogievskiy# Since: 4.0
18095d3b4e99SVladimir Sementsov-Ogievskiy##
18105d3b4e99SVladimir Sementsov-Ogievskiy  { 'enum': 'BlockPermission',
18115d3b4e99SVladimir Sementsov-Ogievskiy    'data': [ 'consistent-read', 'write', 'write-unchanged', 'resize',
18125d3b4e99SVladimir Sementsov-Ogievskiy              'graph-mod' ] }
18135d3b4e99SVladimir Sementsov-Ogievskiy##
18145d3b4e99SVladimir Sementsov-Ogievskiy# @XDbgBlockGraphEdge:
18155d3b4e99SVladimir Sementsov-Ogievskiy#
18165d3b4e99SVladimir Sementsov-Ogievskiy# Block Graph edge description for x-debug-query-block-graph.
18175d3b4e99SVladimir Sementsov-Ogievskiy#
18185d3b4e99SVladimir Sementsov-Ogievskiy# @parent: parent id
18195d3b4e99SVladimir Sementsov-Ogievskiy#
18205d3b4e99SVladimir Sementsov-Ogievskiy# @child: child id
18215d3b4e99SVladimir Sementsov-Ogievskiy#
18225d3b4e99SVladimir Sementsov-Ogievskiy# @name: name of the relation (examples are 'file' and 'backing')
18235d3b4e99SVladimir Sementsov-Ogievskiy#
18245d3b4e99SVladimir Sementsov-Ogievskiy# @perm: granted permissions for the parent operating on the child
18255d3b4e99SVladimir Sementsov-Ogievskiy#
18265d3b4e99SVladimir Sementsov-Ogievskiy# @shared-perm: permissions that can still be granted to other users of the
18275d3b4e99SVladimir Sementsov-Ogievskiy#               child while it is still attached to this parent
18285d3b4e99SVladimir Sementsov-Ogievskiy#
18295d3b4e99SVladimir Sementsov-Ogievskiy# Since: 4.0
18305d3b4e99SVladimir Sementsov-Ogievskiy##
18315d3b4e99SVladimir Sementsov-Ogievskiy{ 'struct': 'XDbgBlockGraphEdge',
18325d3b4e99SVladimir Sementsov-Ogievskiy  'data': { 'parent': 'uint64', 'child': 'uint64',
18335d3b4e99SVladimir Sementsov-Ogievskiy            'name': 'str', 'perm': [ 'BlockPermission' ],
18345d3b4e99SVladimir Sementsov-Ogievskiy            'shared-perm': [ 'BlockPermission' ] } }
18355d3b4e99SVladimir Sementsov-Ogievskiy
18365d3b4e99SVladimir Sementsov-Ogievskiy##
18375d3b4e99SVladimir Sementsov-Ogievskiy# @XDbgBlockGraph:
18385d3b4e99SVladimir Sementsov-Ogievskiy#
18395d3b4e99SVladimir Sementsov-Ogievskiy# Block Graph - list of nodes and list of edges.
18405d3b4e99SVladimir Sementsov-Ogievskiy#
18415d3b4e99SVladimir Sementsov-Ogievskiy# Since: 4.0
18425d3b4e99SVladimir Sementsov-Ogievskiy##
18435d3b4e99SVladimir Sementsov-Ogievskiy{ 'struct': 'XDbgBlockGraph',
18445d3b4e99SVladimir Sementsov-Ogievskiy  'data': { 'nodes': ['XDbgBlockGraphNode'], 'edges': ['XDbgBlockGraphEdge'] } }
18455d3b4e99SVladimir Sementsov-Ogievskiy
18465d3b4e99SVladimir Sementsov-Ogievskiy##
18475d3b4e99SVladimir Sementsov-Ogievskiy# @x-debug-query-block-graph:
18485d3b4e99SVladimir Sementsov-Ogievskiy#
18495d3b4e99SVladimir Sementsov-Ogievskiy# Get the block graph.
18505d3b4e99SVladimir Sementsov-Ogievskiy#
18515d3b4e99SVladimir Sementsov-Ogievskiy# Since: 4.0
18525d3b4e99SVladimir Sementsov-Ogievskiy##
18535d3b4e99SVladimir Sementsov-Ogievskiy{ 'command': 'x-debug-query-block-graph', 'returns': 'XDbgBlockGraph' }
18545d3b4e99SVladimir Sementsov-Ogievskiy
18555d3b4e99SVladimir Sementsov-Ogievskiy##
18565072f7b3SMarc-André Lureau# @drive-mirror:
18571ad166b6SBenoît Canet#
185812a21b73SMarc-André Lureau# Start mirroring a block device's writes to a new destination. target
185912a21b73SMarc-André Lureau# specifies the target of the new image. If the file exists, or if it
186012a21b73SMarc-André Lureau# is a device, it will be used as the new destination for writes. If
186112a21b73SMarc-André Lureau# it does not exist, a new file will be created. format specifies the
186212a21b73SMarc-André Lureau# format of the mirror image, default is to probe if mode='existing',
186312a21b73SMarc-André Lureau# else the format of the source.
18641ad166b6SBenoît Canet#
1865faecd40aSEric Blake# Returns: nothing on success
18660524e93aSKevin Wolf#          If @device is not a valid block device, GenericError
1867faecd40aSEric Blake#
18685072f7b3SMarc-André Lureau# Since: 1.3
186912a21b73SMarc-André Lureau#
187012a21b73SMarc-André Lureau# Example:
187112a21b73SMarc-André Lureau#
187212a21b73SMarc-André Lureau# -> { "execute": "drive-mirror",
187312a21b73SMarc-André Lureau#      "arguments": { "device": "ide-hd0",
187412a21b73SMarc-André Lureau#                     "target": "/some/place/my-image",
187512a21b73SMarc-André Lureau#                     "sync": "full",
187612a21b73SMarc-André Lureau#                     "format": "qcow2" } }
187712a21b73SMarc-André Lureau# <- { "return": {} }
187812a21b73SMarc-André Lureau#
1879faecd40aSEric Blake##
1880faecd40aSEric Blake{ 'command': 'drive-mirror', 'boxed': true,
1881faecd40aSEric Blake  'data': 'DriveMirror' }
1882faecd40aSEric Blake
1883faecd40aSEric Blake##
18845072f7b3SMarc-André Lureau# @DriveMirror:
1885faecd40aSEric Blake#
1886faecd40aSEric Blake# A set of parameters describing drive mirror setup.
1887faecd40aSEric Blake#
18881d8bda12SMarkus Armbruster# @job-id: identifier for the newly-created block job. If
188971aa9867SAlberto Garcia#          omitted, the device name will be used. (Since 2.7)
189071aa9867SAlberto Garcia#
18910524e93aSKevin Wolf# @device:  the device name or node-name of a root node whose writes should be
18920524e93aSKevin Wolf#           mirrored.
18931ad166b6SBenoît Canet#
18941ad166b6SBenoît Canet# @target: the target of the new image. If the file exists, or if it
18951ad166b6SBenoît Canet#          is a device, the existing file/device will be used as the new
18961ad166b6SBenoît Canet#          destination.  If it does not exist, a new file will be created.
18971ad166b6SBenoît Canet#
18981d8bda12SMarkus Armbruster# @format: the format of the new destination, default is to
18991ad166b6SBenoît Canet#          probe if @mode is 'existing', else the format of the source
19001ad166b6SBenoît Canet#
19011d8bda12SMarkus Armbruster# @node-name: the new block driver state node name in the graph
19024c828dc6SBenoît Canet#             (Since 2.1)
19034c828dc6SBenoît Canet#
19041d8bda12SMarkus Armbruster# @replaces: with sync=full graph node name to be replaced by the new
190509158f00SBenoît Canet#            image when a whole image copy is done. This can be used to repair
190609158f00SBenoît Canet#            broken Quorum files. (Since 2.1)
190709158f00SBenoît Canet#
19081d8bda12SMarkus Armbruster# @mode: whether and how QEMU should create a new image, default is
19091ad166b6SBenoît Canet#        'absolute-paths'.
19101ad166b6SBenoît Canet#
19111d8bda12SMarkus Armbruster# @speed:  the maximum speed, in bytes per second
19121ad166b6SBenoît Canet#
19131ad166b6SBenoît Canet# @sync: what parts of the disk image should be copied to the destination
19141ad166b6SBenoît Canet#        (all the disk, only the sectors allocated in the topmost image, or
19151ad166b6SBenoît Canet#        only new I/O).
19161ad166b6SBenoît Canet#
19171d8bda12SMarkus Armbruster# @granularity: granularity of the dirty bitmap, default is 64K
19181ad166b6SBenoît Canet#               if the image format doesn't have clusters, 4K if the clusters
19191ad166b6SBenoît Canet#               are smaller than that, else the cluster size.  Must be a
19201ad166b6SBenoît Canet#               power of 2 between 512 and 64M (since 1.4).
19211ad166b6SBenoît Canet#
19221d8bda12SMarkus Armbruster# @buf-size: maximum amount of data in flight from source to
19231ad166b6SBenoît Canet#            target (since 1.4).
19241ad166b6SBenoît Canet#
19251d8bda12SMarkus Armbruster# @on-source-error: the action to take on an error on the source,
19261ad166b6SBenoît Canet#                   default 'report'.  'stop' and 'enospc' can only be used
19271ad166b6SBenoît Canet#                   if the block device supports io-status (see BlockInfo).
19281ad166b6SBenoît Canet#
19291d8bda12SMarkus Armbruster# @on-target-error: the action to take on an error on the target,
19301ad166b6SBenoît Canet#                   default 'report' (no limitations, since this applies to
19311ad166b6SBenoît Canet#                   a different block device than @device).
19321d8bda12SMarkus Armbruster# @unmap: Whether to try to unmap target sectors where source has
19330fc9f8eaSFam Zheng#         only zero. If true, and target unallocated sectors will read as zero,
19340fc9f8eaSFam Zheng#         target image sectors will be unmapped; otherwise, zeroes will be
19350fc9f8eaSFam Zheng#         written. Both will result in identical contents.
19360fc9f8eaSFam Zheng#         Default is true. (Since 2.4)
19371ad166b6SBenoît Canet#
1938481debaaSMax Reitz# @copy-mode: when to copy data to the destination; defaults to 'background'
1939481debaaSMax Reitz#             (Since: 3.0)
1940481debaaSMax Reitz#
1941a6b58adeSJohn Snow# @auto-finalize: When false, this job will wait in a PENDING state after it has
1942a6b58adeSJohn Snow#                 finished its work, waiting for @block-job-finalize before
1943a6b58adeSJohn Snow#                 making any block graph changes.
1944a6b58adeSJohn Snow#                 When true, this job will automatically
1945a6b58adeSJohn Snow#                 perform its abort or commit actions.
1946a6b58adeSJohn Snow#                 Defaults to true. (Since 3.1)
1947a6b58adeSJohn Snow#
1948a6b58adeSJohn Snow# @auto-dismiss: When false, this job will wait in a CONCLUDED state after it
1949a6b58adeSJohn Snow#                has completely ceased all work, and awaits @block-job-dismiss.
1950a6b58adeSJohn Snow#                When true, this job will automatically disappear from the query
1951a6b58adeSJohn Snow#                list without user intervention.
1952a6b58adeSJohn Snow#                Defaults to true. (Since 3.1)
19535072f7b3SMarc-André Lureau# Since: 1.3
19541ad166b6SBenoît Canet##
1955faecd40aSEric Blake{ 'struct': 'DriveMirror',
195671aa9867SAlberto Garcia  'data': { '*job-id': 'str', 'device': 'str', 'target': 'str',
195771aa9867SAlberto Garcia            '*format': 'str', '*node-name': 'str', '*replaces': 'str',
19581ad166b6SBenoît Canet            'sync': 'MirrorSyncMode', '*mode': 'NewImageMode',
19591ad166b6SBenoît Canet            '*speed': 'int', '*granularity': 'uint32',
19601ad166b6SBenoît Canet            '*buf-size': 'int', '*on-source-error': 'BlockdevOnError',
19610fc9f8eaSFam Zheng            '*on-target-error': 'BlockdevOnError',
1962a6b58adeSJohn Snow            '*unmap': 'bool', '*copy-mode': 'MirrorCopyMode',
1963a6b58adeSJohn Snow            '*auto-finalize': 'bool', '*auto-dismiss': 'bool' } }
19641ad166b6SBenoît Canet
19651ad166b6SBenoît Canet##
19665072f7b3SMarc-André Lureau# @BlockDirtyBitmap:
1967341ebc2fSJohn Snow#
1968341ebc2fSJohn Snow# @node: name of device/node which the bitmap is tracking
1969341ebc2fSJohn Snow#
1970341ebc2fSJohn Snow# @name: name of the dirty bitmap
1971341ebc2fSJohn Snow#
19725072f7b3SMarc-André Lureau# Since: 2.4
1973341ebc2fSJohn Snow##
1974895a2a80SEric Blake{ 'struct': 'BlockDirtyBitmap',
1975341ebc2fSJohn Snow  'data': { 'node': 'str', 'name': 'str' } }
1976341ebc2fSJohn Snow
1977341ebc2fSJohn Snow##
19785072f7b3SMarc-André Lureau# @BlockDirtyBitmapAdd:
1979341ebc2fSJohn Snow#
1980341ebc2fSJohn Snow# @node: name of device/node which the bitmap is tracking
1981341ebc2fSJohn Snow#
1982341ebc2fSJohn Snow# @name: name of the dirty bitmap
1983341ebc2fSJohn Snow#
19841d8bda12SMarkus Armbruster# @granularity: the bitmap granularity, default is 64k for
1985341ebc2fSJohn Snow#               block-dirty-bitmap-add
1986341ebc2fSJohn Snow#
1987fd5ae4ccSVladimir Sementsov-Ogievskiy# @persistent: the bitmap is persistent, i.e. it will be saved to the
1988fd5ae4ccSVladimir Sementsov-Ogievskiy#              corresponding block device image file on its close. For now only
1989fd5ae4ccSVladimir Sementsov-Ogievskiy#              Qcow2 disks support persistent bitmaps. Default is false for
1990fd5ae4ccSVladimir Sementsov-Ogievskiy#              block-dirty-bitmap-add. (Since: 2.10)
1991fd5ae4ccSVladimir Sementsov-Ogievskiy#
19923e99da5eSVladimir Sementsov-Ogievskiy# @autoload: ignored and deprecated since 2.12.
19933e99da5eSVladimir Sementsov-Ogievskiy#            Currently, all dirty tracking bitmaps are loaded from Qcow2 on
19943e99da5eSVladimir Sementsov-Ogievskiy#            open.
1995eb738bb5SVladimir Sementsov-Ogievskiy#
19960e2b7f09SJohn Snow# @disabled: the bitmap is created in the disabled state, which means that
1997a6e2ca5fSVladimir Sementsov-Ogievskiy#            it will not track drive changes. The bitmap may be enabled with
19980e2b7f09SJohn Snow#            block-dirty-bitmap-enable. Default is false. (Since: 4.0)
1999a6e2ca5fSVladimir Sementsov-Ogievskiy#
20005072f7b3SMarc-André Lureau# Since: 2.4
2001341ebc2fSJohn Snow##
2002895a2a80SEric Blake{ 'struct': 'BlockDirtyBitmapAdd',
2003fd5ae4ccSVladimir Sementsov-Ogievskiy  'data': { 'node': 'str', 'name': 'str', '*granularity': 'uint32',
20040e2b7f09SJohn Snow            '*persistent': 'bool', '*autoload': 'bool', '*disabled': 'bool' } }
2005341ebc2fSJohn Snow
2006341ebc2fSJohn Snow##
2007eff0829bSVladimir Sementsov-Ogievskiy# @BlockDirtyBitmapMergeSource:
2008eff0829bSVladimir Sementsov-Ogievskiy#
2009eff0829bSVladimir Sementsov-Ogievskiy# @local: name of the bitmap, attached to the same node as target bitmap.
2010eff0829bSVladimir Sementsov-Ogievskiy#
2011eff0829bSVladimir Sementsov-Ogievskiy# @external: bitmap with specified node
2012eff0829bSVladimir Sementsov-Ogievskiy#
2013eff0829bSVladimir Sementsov-Ogievskiy# Since: 4.1
2014eff0829bSVladimir Sementsov-Ogievskiy##
2015eff0829bSVladimir Sementsov-Ogievskiy{ 'alternate': 'BlockDirtyBitmapMergeSource',
2016eff0829bSVladimir Sementsov-Ogievskiy  'data': { 'local': 'str',
2017eff0829bSVladimir Sementsov-Ogievskiy            'external': 'BlockDirtyBitmap' } }
2018eff0829bSVladimir Sementsov-Ogievskiy
2019eff0829bSVladimir Sementsov-Ogievskiy##
2020b598e531SVladimir Sementsov-Ogievskiy# @BlockDirtyBitmapMerge:
2021b598e531SVladimir Sementsov-Ogievskiy#
2022eff0829bSVladimir Sementsov-Ogievskiy# @node: name of device/node which the @target bitmap is tracking
2023b598e531SVladimir Sementsov-Ogievskiy#
2024360d4e4eSJohn Snow# @target: name of the destination dirty bitmap
2025b598e531SVladimir Sementsov-Ogievskiy#
2026eff0829bSVladimir Sementsov-Ogievskiy# @bitmaps: name(s) of the source dirty bitmap(s) at @node and/or fully
2027eff0829bSVladimir Sementsov-Ogievskiy#           specifed BlockDirtyBitmap elements. The latter are supported
2028eff0829bSVladimir Sementsov-Ogievskiy#           since 4.1.
2029b598e531SVladimir Sementsov-Ogievskiy#
20300e2b7f09SJohn Snow# Since: 4.0
2031b598e531SVladimir Sementsov-Ogievskiy##
2032b598e531SVladimir Sementsov-Ogievskiy{ 'struct': 'BlockDirtyBitmapMerge',
2033eff0829bSVladimir Sementsov-Ogievskiy  'data': { 'node': 'str', 'target': 'str',
2034eff0829bSVladimir Sementsov-Ogievskiy            'bitmaps': ['BlockDirtyBitmapMergeSource'] } }
2035b598e531SVladimir Sementsov-Ogievskiy
2036b598e531SVladimir Sementsov-Ogievskiy##
20375072f7b3SMarc-André Lureau# @block-dirty-bitmap-add:
2038341ebc2fSJohn Snow#
20392258a5dbSMarc-André Lureau# Create a dirty bitmap with a name on the node, and start tracking the writes.
2040341ebc2fSJohn Snow#
2041341ebc2fSJohn Snow# Returns: nothing on success
2042341ebc2fSJohn Snow#          If @node is not a valid block device or node, DeviceNotFound
2043341ebc2fSJohn Snow#          If @name is already taken, GenericError with an explanation
2044341ebc2fSJohn Snow#
20455072f7b3SMarc-André Lureau# Since: 2.4
20462258a5dbSMarc-André Lureau#
20472258a5dbSMarc-André Lureau# Example:
20482258a5dbSMarc-André Lureau#
20492258a5dbSMarc-André Lureau# -> { "execute": "block-dirty-bitmap-add",
20502258a5dbSMarc-André Lureau#      "arguments": { "node": "drive0", "name": "bitmap0" } }
20512258a5dbSMarc-André Lureau# <- { "return": {} }
20522258a5dbSMarc-André Lureau#
2053341ebc2fSJohn Snow##
2054341ebc2fSJohn Snow{ 'command': 'block-dirty-bitmap-add',
2055341ebc2fSJohn Snow  'data': 'BlockDirtyBitmapAdd' }
2056341ebc2fSJohn Snow
2057341ebc2fSJohn Snow##
20585072f7b3SMarc-André Lureau# @block-dirty-bitmap-remove:
2059341ebc2fSJohn Snow#
20604bbca422SMarc-André Lureau# Stop write tracking and remove the dirty bitmap that was created
20615c36c1afSVladimir Sementsov-Ogievskiy# with block-dirty-bitmap-add. If the bitmap is persistent, remove it from its
20625c36c1afSVladimir Sementsov-Ogievskiy# storage too.
2063341ebc2fSJohn Snow#
2064341ebc2fSJohn Snow# Returns: nothing on success
2065341ebc2fSJohn Snow#          If @node is not a valid block device or node, DeviceNotFound
2066341ebc2fSJohn Snow#          If @name is not found, GenericError with an explanation
20679bd2b08fSJohn Snow#          if @name is frozen by an operation, GenericError
2068341ebc2fSJohn Snow#
20695072f7b3SMarc-André Lureau# Since: 2.4
20704bbca422SMarc-André Lureau#
20714bbca422SMarc-André Lureau# Example:
20724bbca422SMarc-André Lureau#
20734bbca422SMarc-André Lureau# -> { "execute": "block-dirty-bitmap-remove",
20744bbca422SMarc-André Lureau#      "arguments": { "node": "drive0", "name": "bitmap0" } }
20754bbca422SMarc-André Lureau# <- { "return": {} }
20764bbca422SMarc-André Lureau#
2077341ebc2fSJohn Snow##
2078341ebc2fSJohn Snow{ 'command': 'block-dirty-bitmap-remove',
2079341ebc2fSJohn Snow  'data': 'BlockDirtyBitmap' }
2080341ebc2fSJohn Snow
2081341ebc2fSJohn Snow##
20825072f7b3SMarc-André Lureau# @block-dirty-bitmap-clear:
2083e74e6b78SJohn Snow#
208473dffdc8SMarc-André Lureau# Clear (reset) a dirty bitmap on the device, so that an incremental
208573dffdc8SMarc-André Lureau# backup from this point in time forward will only backup clusters
208673dffdc8SMarc-André Lureau# modified after this clear operation.
2087e74e6b78SJohn Snow#
2088e74e6b78SJohn Snow# Returns: nothing on success
2089e74e6b78SJohn Snow#          If @node is not a valid block device, DeviceNotFound
2090e74e6b78SJohn Snow#          If @name is not found, GenericError with an explanation
2091e74e6b78SJohn Snow#
20925072f7b3SMarc-André Lureau# Since: 2.4
209373dffdc8SMarc-André Lureau#
209473dffdc8SMarc-André Lureau# Example:
209573dffdc8SMarc-André Lureau#
209673dffdc8SMarc-André Lureau# -> { "execute": "block-dirty-bitmap-clear",
209773dffdc8SMarc-André Lureau#      "arguments": { "node": "drive0", "name": "bitmap0" } }
209873dffdc8SMarc-André Lureau# <- { "return": {} }
209973dffdc8SMarc-André Lureau#
2100e74e6b78SJohn Snow##
2101e74e6b78SJohn Snow{ 'command': 'block-dirty-bitmap-clear',
2102e74e6b78SJohn Snow  'data': 'BlockDirtyBitmap' }
2103e74e6b78SJohn Snow
2104e74e6b78SJohn Snow##
21050e2b7f09SJohn Snow# @block-dirty-bitmap-enable:
21065c5d2e50SVladimir Sementsov-Ogievskiy#
21075c5d2e50SVladimir Sementsov-Ogievskiy# Enables a dirty bitmap so that it will begin tracking disk changes.
21085c5d2e50SVladimir Sementsov-Ogievskiy#
21095c5d2e50SVladimir Sementsov-Ogievskiy# Returns: nothing on success
21105c5d2e50SVladimir Sementsov-Ogievskiy#          If @node is not a valid block device, DeviceNotFound
21115c5d2e50SVladimir Sementsov-Ogievskiy#          If @name is not found, GenericError with an explanation
21125c5d2e50SVladimir Sementsov-Ogievskiy#
21130e2b7f09SJohn Snow# Since: 4.0
21145c5d2e50SVladimir Sementsov-Ogievskiy#
21155c5d2e50SVladimir Sementsov-Ogievskiy# Example:
21165c5d2e50SVladimir Sementsov-Ogievskiy#
21170e2b7f09SJohn Snow# -> { "execute": "block-dirty-bitmap-enable",
21185c5d2e50SVladimir Sementsov-Ogievskiy#      "arguments": { "node": "drive0", "name": "bitmap0" } }
21195c5d2e50SVladimir Sementsov-Ogievskiy# <- { "return": {} }
21205c5d2e50SVladimir Sementsov-Ogievskiy#
21215c5d2e50SVladimir Sementsov-Ogievskiy##
21220e2b7f09SJohn Snow  { 'command': 'block-dirty-bitmap-enable',
21235c5d2e50SVladimir Sementsov-Ogievskiy    'data': 'BlockDirtyBitmap' }
21245c5d2e50SVladimir Sementsov-Ogievskiy
21255c5d2e50SVladimir Sementsov-Ogievskiy##
21260e2b7f09SJohn Snow# @block-dirty-bitmap-disable:
21275c5d2e50SVladimir Sementsov-Ogievskiy#
21285c5d2e50SVladimir Sementsov-Ogievskiy# Disables a dirty bitmap so that it will stop tracking disk changes.
21295c5d2e50SVladimir Sementsov-Ogievskiy#
21305c5d2e50SVladimir Sementsov-Ogievskiy# Returns: nothing on success
21315c5d2e50SVladimir Sementsov-Ogievskiy#          If @node is not a valid block device, DeviceNotFound
21325c5d2e50SVladimir Sementsov-Ogievskiy#          If @name is not found, GenericError with an explanation
21335c5d2e50SVladimir Sementsov-Ogievskiy#
21340e2b7f09SJohn Snow# Since: 4.0
21355c5d2e50SVladimir Sementsov-Ogievskiy#
21365c5d2e50SVladimir Sementsov-Ogievskiy# Example:
21375c5d2e50SVladimir Sementsov-Ogievskiy#
21380e2b7f09SJohn Snow# -> { "execute": "block-dirty-bitmap-disable",
21395c5d2e50SVladimir Sementsov-Ogievskiy#      "arguments": { "node": "drive0", "name": "bitmap0" } }
21405c5d2e50SVladimir Sementsov-Ogievskiy# <- { "return": {} }
21415c5d2e50SVladimir Sementsov-Ogievskiy#
21425c5d2e50SVladimir Sementsov-Ogievskiy##
21430e2b7f09SJohn Snow    { 'command': 'block-dirty-bitmap-disable',
21445c5d2e50SVladimir Sementsov-Ogievskiy      'data': 'BlockDirtyBitmap' }
21455c5d2e50SVladimir Sementsov-Ogievskiy
21465c5d2e50SVladimir Sementsov-Ogievskiy##
21470e2b7f09SJohn Snow# @block-dirty-bitmap-merge:
2148b598e531SVladimir Sementsov-Ogievskiy#
2149360d4e4eSJohn Snow# Merge dirty bitmaps listed in @bitmaps to the @target dirty bitmap.
215073ab5d60SJohn Snow# Dirty bitmaps in @bitmaps will be unchanged, except if it also appears
215173ab5d60SJohn Snow# as the @target bitmap. Any bits already set in @target will still be
215273ab5d60SJohn Snow# set after the merge, i.e., this operation does not clear the target.
2153360d4e4eSJohn Snow# On error, @target is unchanged.
2154b598e531SVladimir Sementsov-Ogievskiy#
215573ab5d60SJohn Snow# The resulting bitmap will count as dirty any clusters that were dirty in any
215673ab5d60SJohn Snow# of the source bitmaps. This can be used to achieve backup checkpoints, or in
215773ab5d60SJohn Snow# simpler usages, to copy bitmaps.
215873ab5d60SJohn Snow#
2159b598e531SVladimir Sementsov-Ogievskiy# Returns: nothing on success
2160b598e531SVladimir Sementsov-Ogievskiy#          If @node is not a valid block device, DeviceNotFound
2161360d4e4eSJohn Snow#          If any bitmap in @bitmaps or @target is not found, GenericError
2162360d4e4eSJohn Snow#          If any of the bitmaps have different sizes or granularities,
2163360d4e4eSJohn Snow#              GenericError
2164b598e531SVladimir Sementsov-Ogievskiy#
21650e2b7f09SJohn Snow# Since: 4.0
2166b598e531SVladimir Sementsov-Ogievskiy#
2167b598e531SVladimir Sementsov-Ogievskiy# Example:
2168b598e531SVladimir Sementsov-Ogievskiy#
21690e2b7f09SJohn Snow# -> { "execute": "block-dirty-bitmap-merge",
2170360d4e4eSJohn Snow#      "arguments": { "node": "drive0", "target": "bitmap0",
2171360d4e4eSJohn Snow#                     "bitmaps": ["bitmap1"] } }
2172b598e531SVladimir Sementsov-Ogievskiy# <- { "return": {} }
2173b598e531SVladimir Sementsov-Ogievskiy#
2174b598e531SVladimir Sementsov-Ogievskiy##
21750e2b7f09SJohn Snow      { 'command': 'block-dirty-bitmap-merge',
2176b598e531SVladimir Sementsov-Ogievskiy        'data': 'BlockDirtyBitmapMerge' }
2177b598e531SVladimir Sementsov-Ogievskiy
2178b598e531SVladimir Sementsov-Ogievskiy##
2179a3b52535SVladimir Sementsov-Ogievskiy# @BlockDirtyBitmapSha256:
2180a3b52535SVladimir Sementsov-Ogievskiy#
2181a3b52535SVladimir Sementsov-Ogievskiy# SHA256 hash of dirty bitmap data
2182a3b52535SVladimir Sementsov-Ogievskiy#
2183a3b52535SVladimir Sementsov-Ogievskiy# @sha256: ASCII representation of SHA256 bitmap hash
2184a3b52535SVladimir Sementsov-Ogievskiy#
2185a3b52535SVladimir Sementsov-Ogievskiy# Since: 2.10
2186a3b52535SVladimir Sementsov-Ogievskiy##
2187a3b52535SVladimir Sementsov-Ogievskiy  { 'struct': 'BlockDirtyBitmapSha256',
2188a3b52535SVladimir Sementsov-Ogievskiy    'data': {'sha256': 'str'} }
2189a3b52535SVladimir Sementsov-Ogievskiy
2190a3b52535SVladimir Sementsov-Ogievskiy##
2191a3b52535SVladimir Sementsov-Ogievskiy# @x-debug-block-dirty-bitmap-sha256:
2192a3b52535SVladimir Sementsov-Ogievskiy#
219373ab5d60SJohn Snow# Get bitmap SHA256.
2194a3b52535SVladimir Sementsov-Ogievskiy#
2195a3b52535SVladimir Sementsov-Ogievskiy# Returns: BlockDirtyBitmapSha256 on success
2196a3b52535SVladimir Sementsov-Ogievskiy#          If @node is not a valid block device, DeviceNotFound
2197a3b52535SVladimir Sementsov-Ogievskiy#          If @name is not found or if hashing has failed, GenericError with an
2198a3b52535SVladimir Sementsov-Ogievskiy#          explanation
2199a3b52535SVladimir Sementsov-Ogievskiy#
2200a3b52535SVladimir Sementsov-Ogievskiy# Since: 2.10
2201a3b52535SVladimir Sementsov-Ogievskiy##
2202a3b52535SVladimir Sementsov-Ogievskiy  { 'command': 'x-debug-block-dirty-bitmap-sha256',
2203a3b52535SVladimir Sementsov-Ogievskiy    'data': 'BlockDirtyBitmap', 'returns': 'BlockDirtyBitmapSha256' }
2204a3b52535SVladimir Sementsov-Ogievskiy
2205a3b52535SVladimir Sementsov-Ogievskiy##
22065072f7b3SMarc-André Lureau# @blockdev-mirror:
2207df92562eSFam Zheng#
2208df92562eSFam Zheng# Start mirroring a block device's writes to a new destination.
2209df92562eSFam Zheng#
22101d8bda12SMarkus Armbruster# @job-id: identifier for the newly-created block job. If
221171aa9867SAlberto Garcia#          omitted, the device name will be used. (Since 2.7)
221271aa9867SAlberto Garcia#
221307eec652SKevin Wolf# @device: The device name or node-name of a root node whose writes should be
221407eec652SKevin Wolf#          mirrored.
2215df92562eSFam Zheng#
2216df92562eSFam Zheng# @target: the id or node-name of the block device to mirror to. This mustn't be
2217df92562eSFam Zheng#          attached to guest.
2218df92562eSFam Zheng#
22191d8bda12SMarkus Armbruster# @replaces: with sync=full graph node name to be replaced by the new
2220df92562eSFam Zheng#            image when a whole image copy is done. This can be used to repair
2221df92562eSFam Zheng#            broken Quorum files.
2222df92562eSFam Zheng#
22231d8bda12SMarkus Armbruster# @speed:  the maximum speed, in bytes per second
2224df92562eSFam Zheng#
2225df92562eSFam Zheng# @sync: what parts of the disk image should be copied to the destination
2226df92562eSFam Zheng#        (all the disk, only the sectors allocated in the topmost image, or
2227df92562eSFam Zheng#        only new I/O).
2228df92562eSFam Zheng#
22291d8bda12SMarkus Armbruster# @granularity: granularity of the dirty bitmap, default is 64K
2230df92562eSFam Zheng#               if the image format doesn't have clusters, 4K if the clusters
2231df92562eSFam Zheng#               are smaller than that, else the cluster size.  Must be a
2232df92562eSFam Zheng#               power of 2 between 512 and 64M
2233df92562eSFam Zheng#
22341d8bda12SMarkus Armbruster# @buf-size: maximum amount of data in flight from source to
2235df92562eSFam Zheng#            target
2236df92562eSFam Zheng#
22371d8bda12SMarkus Armbruster# @on-source-error: the action to take on an error on the source,
2238df92562eSFam Zheng#                   default 'report'.  'stop' and 'enospc' can only be used
2239df92562eSFam Zheng#                   if the block device supports io-status (see BlockInfo).
2240df92562eSFam Zheng#
22411d8bda12SMarkus Armbruster# @on-target-error: the action to take on an error on the target,
2242df92562eSFam Zheng#                   default 'report' (no limitations, since this applies to
2243df92562eSFam Zheng#                   a different block device than @device).
2244df92562eSFam Zheng#
22451d8bda12SMarkus Armbruster# @filter-node-name: the node name that should be assigned to the
22466cdbceb1SKevin Wolf#                    filter driver that the mirror job inserts into the graph
22476cdbceb1SKevin Wolf#                    above @device. If this option is not given, a node name is
22486cdbceb1SKevin Wolf#                    autogenerated. (Since: 2.9)
22496cdbceb1SKevin Wolf#
2250481debaaSMax Reitz# @copy-mode: when to copy data to the destination; defaults to 'background'
2251481debaaSMax Reitz#             (Since: 3.0)
2252481debaaSMax Reitz#
2253a6b58adeSJohn Snow# @auto-finalize: When false, this job will wait in a PENDING state after it has
2254a6b58adeSJohn Snow#                 finished its work, waiting for @block-job-finalize before
2255a6b58adeSJohn Snow#                 making any block graph changes.
2256a6b58adeSJohn Snow#                 When true, this job will automatically
2257a6b58adeSJohn Snow#                 perform its abort or commit actions.
2258a6b58adeSJohn Snow#                 Defaults to true. (Since 3.1)
2259a6b58adeSJohn Snow#
2260a6b58adeSJohn Snow# @auto-dismiss: When false, this job will wait in a CONCLUDED state after it
2261a6b58adeSJohn Snow#                has completely ceased all work, and awaits @block-job-dismiss.
2262a6b58adeSJohn Snow#                When true, this job will automatically disappear from the query
2263a6b58adeSJohn Snow#                list without user intervention.
2264a6b58adeSJohn Snow#                Defaults to true. (Since 3.1)
2265df92562eSFam Zheng# Returns: nothing on success.
2266df92562eSFam Zheng#
22675072f7b3SMarc-André Lureau# Since: 2.6
2268f6235a25SMarc-André Lureau#
2269f6235a25SMarc-André Lureau# Example:
2270f6235a25SMarc-André Lureau#
2271f6235a25SMarc-André Lureau# -> { "execute": "blockdev-mirror",
2272f6235a25SMarc-André Lureau#      "arguments": { "device": "ide-hd0",
2273f6235a25SMarc-André Lureau#                     "target": "target0",
2274f6235a25SMarc-André Lureau#                     "sync": "full" } }
2275f6235a25SMarc-André Lureau# <- { "return": {} }
2276f6235a25SMarc-André Lureau#
2277df92562eSFam Zheng##
2278df92562eSFam Zheng{ 'command': 'blockdev-mirror',
227971aa9867SAlberto Garcia  'data': { '*job-id': 'str', 'device': 'str', 'target': 'str',
2280df92562eSFam Zheng            '*replaces': 'str',
2281df92562eSFam Zheng            'sync': 'MirrorSyncMode',
2282df92562eSFam Zheng            '*speed': 'int', '*granularity': 'uint32',
2283df92562eSFam Zheng            '*buf-size': 'int', '*on-source-error': 'BlockdevOnError',
22846cdbceb1SKevin Wolf            '*on-target-error': 'BlockdevOnError',
2285481debaaSMax Reitz            '*filter-node-name': 'str',
2286a6b58adeSJohn Snow            '*copy-mode': 'MirrorCopyMode',
2287a6b58adeSJohn Snow            '*auto-finalize': 'bool', '*auto-dismiss': 'bool' } }
2288df92562eSFam Zheng
2289df92562eSFam Zheng##
22901ad166b6SBenoît Canet# @block_set_io_throttle:
22911ad166b6SBenoît Canet#
22921ad166b6SBenoît Canet# Change I/O throttle limits for a block drive.
22931ad166b6SBenoît Canet#
229476f4afb4SAlberto Garcia# Since QEMU 2.4, each device with I/O limits is member of a throttle
229576f4afb4SAlberto Garcia# group.
229676f4afb4SAlberto Garcia#
229776f4afb4SAlberto Garcia# If two or more devices are members of the same group, the limits
229876f4afb4SAlberto Garcia# will apply to the combined I/O of the whole group in a round-robin
229976f4afb4SAlberto Garcia# fashion. Therefore, setting new I/O limits to a device will affect
230076f4afb4SAlberto Garcia# the whole group.
230176f4afb4SAlberto Garcia#
230276f4afb4SAlberto Garcia# The name of the group can be specified using the 'group' parameter.
230376f4afb4SAlberto Garcia# If the parameter is unset, it is assumed to be the current group of
230476f4afb4SAlberto Garcia# that device. If it's not in any group yet, the name of the device
230576f4afb4SAlberto Garcia# will be used as the name for its group.
230676f4afb4SAlberto Garcia#
230776f4afb4SAlberto Garcia# The 'group' parameter can also be used to move a device to a
230876f4afb4SAlberto Garcia# different group. In this case the limits specified in the parameters
230976f4afb4SAlberto Garcia# will be applied to the new group only.
231076f4afb4SAlberto Garcia#
231176f4afb4SAlberto Garcia# I/O limits can be disabled by setting all of them to 0. In this case
231276f4afb4SAlberto Garcia# the device will be removed from its group and the rest of its
23136b932c0aSAlberto Garcia# members will not be affected. The 'group' parameter is ignored.
231476f4afb4SAlberto Garcia#
23154dc9397bSEric Blake# Returns: Nothing on success
23164dc9397bSEric Blake#          If @device is not a valid block device, DeviceNotFound
23174dc9397bSEric Blake#
23184dc9397bSEric Blake# Since: 1.1
2319b4a0ac14SMarc-André Lureau#
2320b4a0ac14SMarc-André Lureau# Example:
2321b4a0ac14SMarc-André Lureau#
2322b4a0ac14SMarc-André Lureau# -> { "execute": "block_set_io_throttle",
2323dc15541dSStefan Hajnoczi#      "arguments": { "id": "virtio-blk-pci0/virtio-backend",
2324dc15541dSStefan Hajnoczi#                     "bps": 0,
2325dc15541dSStefan Hajnoczi#                     "bps_rd": 0,
2326dc15541dSStefan Hajnoczi#                     "bps_wr": 0,
2327dc15541dSStefan Hajnoczi#                     "iops": 512,
2328dc15541dSStefan Hajnoczi#                     "iops_rd": 0,
2329dc15541dSStefan Hajnoczi#                     "iops_wr": 0,
2330dc15541dSStefan Hajnoczi#                     "bps_max": 0,
2331dc15541dSStefan Hajnoczi#                     "bps_rd_max": 0,
2332dc15541dSStefan Hajnoczi#                     "bps_wr_max": 0,
2333dc15541dSStefan Hajnoczi#                     "iops_max": 0,
2334dc15541dSStefan Hajnoczi#                     "iops_rd_max": 0,
2335dc15541dSStefan Hajnoczi#                     "iops_wr_max": 0,
2336dc15541dSStefan Hajnoczi#                     "bps_max_length": 0,
2337dc15541dSStefan Hajnoczi#                     "iops_size": 0 } }
2338dc15541dSStefan Hajnoczi# <- { "return": {} }
2339dc15541dSStefan Hajnoczi#
2340dc15541dSStefan Hajnoczi# -> { "execute": "block_set_io_throttle",
2341b4a0ac14SMarc-André Lureau#      "arguments": { "id": "ide0-1-0",
2342b4a0ac14SMarc-André Lureau#                     "bps": 1000000,
2343b4a0ac14SMarc-André Lureau#                     "bps_rd": 0,
2344b4a0ac14SMarc-André Lureau#                     "bps_wr": 0,
2345b4a0ac14SMarc-André Lureau#                     "iops": 0,
2346b4a0ac14SMarc-André Lureau#                     "iops_rd": 0,
2347b4a0ac14SMarc-André Lureau#                     "iops_wr": 0,
2348b4a0ac14SMarc-André Lureau#                     "bps_max": 8000000,
2349b4a0ac14SMarc-André Lureau#                     "bps_rd_max": 0,
2350b4a0ac14SMarc-André Lureau#                     "bps_wr_max": 0,
2351b4a0ac14SMarc-André Lureau#                     "iops_max": 0,
2352b4a0ac14SMarc-André Lureau#                     "iops_rd_max": 0,
2353b4a0ac14SMarc-André Lureau#                     "iops_wr_max": 0,
2354b4a0ac14SMarc-André Lureau#                     "bps_max_length": 60,
2355b4a0ac14SMarc-André Lureau#                     "iops_size": 0 } }
2356b4a0ac14SMarc-André Lureau# <- { "return": {} }
23574dc9397bSEric Blake##
23584dc9397bSEric Blake{ 'command': 'block_set_io_throttle', 'boxed': true,
23594dc9397bSEric Blake  'data': 'BlockIOThrottle' }
23604dc9397bSEric Blake
23614dc9397bSEric Blake##
23625072f7b3SMarc-André Lureau# @BlockIOThrottle:
23634dc9397bSEric Blake#
23644dc9397bSEric Blake# A set of parameters describing block throttling.
23654dc9397bSEric Blake#
23661d8bda12SMarkus Armbruster# @device: Block device name (deprecated, use @id instead)
23677a9877a0SKevin Wolf#
23681d8bda12SMarkus Armbruster# @id: The name or QOM path of the guest device (since: 2.8)
23691ad166b6SBenoît Canet#
23701ad166b6SBenoît Canet# @bps: total throughput limit in bytes per second
23711ad166b6SBenoît Canet#
23721ad166b6SBenoît Canet# @bps_rd: read throughput limit in bytes per second
23731ad166b6SBenoît Canet#
23741ad166b6SBenoît Canet# @bps_wr: write throughput limit in bytes per second
23751ad166b6SBenoît Canet#
23761ad166b6SBenoît Canet# @iops: total I/O operations per second
23771ad166b6SBenoît Canet#
2378f5a845fdSAlberto Garcia# @iops_rd: read I/O operations per second
23791ad166b6SBenoît Canet#
23801ad166b6SBenoît Canet# @iops_wr: write I/O operations per second
23811ad166b6SBenoît Canet#
23821d8bda12SMarkus Armbruster# @bps_max: total throughput limit during bursts,
2383dce13204SAlberto Garcia#                     in bytes (Since 1.7)
23841ad166b6SBenoît Canet#
23851d8bda12SMarkus Armbruster# @bps_rd_max: read throughput limit during bursts,
2386dce13204SAlberto Garcia#                        in bytes (Since 1.7)
23871ad166b6SBenoît Canet#
23881d8bda12SMarkus Armbruster# @bps_wr_max: write throughput limit during bursts,
2389dce13204SAlberto Garcia#                        in bytes (Since 1.7)
23901ad166b6SBenoît Canet#
23911d8bda12SMarkus Armbruster# @iops_max: total I/O operations per second during bursts,
2392dce13204SAlberto Garcia#                      in bytes (Since 1.7)
23931ad166b6SBenoît Canet#
23941d8bda12SMarkus Armbruster# @iops_rd_max: read I/O operations per second during bursts,
2395dce13204SAlberto Garcia#                         in bytes (Since 1.7)
23961ad166b6SBenoît Canet#
23971d8bda12SMarkus Armbruster# @iops_wr_max: write I/O operations per second during bursts,
2398dce13204SAlberto Garcia#                         in bytes (Since 1.7)
2399dce13204SAlberto Garcia#
24001d8bda12SMarkus Armbruster# @bps_max_length: maximum length of the @bps_max burst
2401dce13204SAlberto Garcia#                            period, in seconds. It must only
2402dce13204SAlberto Garcia#                            be set if @bps_max is set as well.
2403dce13204SAlberto Garcia#                            Defaults to 1. (Since 2.6)
2404dce13204SAlberto Garcia#
24051d8bda12SMarkus Armbruster# @bps_rd_max_length: maximum length of the @bps_rd_max
2406dce13204SAlberto Garcia#                               burst period, in seconds. It must only
2407dce13204SAlberto Garcia#                               be set if @bps_rd_max is set as well.
2408dce13204SAlberto Garcia#                               Defaults to 1. (Since 2.6)
2409dce13204SAlberto Garcia#
24101d8bda12SMarkus Armbruster# @bps_wr_max_length: maximum length of the @bps_wr_max
2411dce13204SAlberto Garcia#                               burst period, in seconds. It must only
2412dce13204SAlberto Garcia#                               be set if @bps_wr_max is set as well.
2413dce13204SAlberto Garcia#                               Defaults to 1. (Since 2.6)
2414dce13204SAlberto Garcia#
24151d8bda12SMarkus Armbruster# @iops_max_length: maximum length of the @iops burst
2416dce13204SAlberto Garcia#                             period, in seconds. It must only
2417dce13204SAlberto Garcia#                             be set if @iops_max is set as well.
2418dce13204SAlberto Garcia#                             Defaults to 1. (Since 2.6)
2419dce13204SAlberto Garcia#
24201d8bda12SMarkus Armbruster# @iops_rd_max_length: maximum length of the @iops_rd_max
2421dce13204SAlberto Garcia#                                burst period, in seconds. It must only
2422dce13204SAlberto Garcia#                                be set if @iops_rd_max is set as well.
2423dce13204SAlberto Garcia#                                Defaults to 1. (Since 2.6)
2424dce13204SAlberto Garcia#
24251d8bda12SMarkus Armbruster# @iops_wr_max_length: maximum length of the @iops_wr_max
2426dce13204SAlberto Garcia#                                burst period, in seconds. It must only
2427dce13204SAlberto Garcia#                                be set if @iops_wr_max is set as well.
2428dce13204SAlberto Garcia#                                Defaults to 1. (Since 2.6)
24291ad166b6SBenoît Canet#
24301d8bda12SMarkus Armbruster# @iops_size: an I/O size in bytes (Since 1.7)
24311ad166b6SBenoît Canet#
24321d8bda12SMarkus Armbruster# @group: throttle group name (Since 2.4)
243376f4afb4SAlberto Garcia#
24341ad166b6SBenoît Canet# Since: 1.1
24351ad166b6SBenoît Canet##
24364dc9397bSEric Blake{ 'struct': 'BlockIOThrottle',
24377a9877a0SKevin Wolf  'data': { '*device': 'str', '*id': 'str', 'bps': 'int', 'bps_rd': 'int',
24387a9877a0SKevin Wolf            'bps_wr': 'int', 'iops': 'int', 'iops_rd': 'int', 'iops_wr': 'int',
24391ad166b6SBenoît Canet            '*bps_max': 'int', '*bps_rd_max': 'int',
24401ad166b6SBenoît Canet            '*bps_wr_max': 'int', '*iops_max': 'int',
24411ad166b6SBenoît Canet            '*iops_rd_max': 'int', '*iops_wr_max': 'int',
2442dce13204SAlberto Garcia            '*bps_max_length': 'int', '*bps_rd_max_length': 'int',
2443dce13204SAlberto Garcia            '*bps_wr_max_length': 'int', '*iops_max_length': 'int',
2444dce13204SAlberto Garcia            '*iops_rd_max_length': 'int', '*iops_wr_max_length': 'int',
244576f4afb4SAlberto Garcia            '*iops_size': 'int', '*group': 'str' } }
24461ad166b6SBenoît Canet
24471ad166b6SBenoît Canet##
2448432d889eSManos Pitsidianakis# @ThrottleLimits:
2449432d889eSManos Pitsidianakis#
2450432d889eSManos Pitsidianakis# Limit parameters for throttling.
2451432d889eSManos Pitsidianakis# Since some limit combinations are illegal, limits should always be set in one
2452432d889eSManos Pitsidianakis# transaction. All fields are optional. When setting limits, if a field is
2453432d889eSManos Pitsidianakis# missing the current value is not changed.
2454432d889eSManos Pitsidianakis#
2455432d889eSManos Pitsidianakis# @iops-total:             limit total I/O operations per second
2456432d889eSManos Pitsidianakis# @iops-total-max:         I/O operations burst
2457432d889eSManos Pitsidianakis# @iops-total-max-length:  length of the iops-total-max burst period, in seconds
2458432d889eSManos Pitsidianakis#                          It must only be set if @iops-total-max is set as well.
2459432d889eSManos Pitsidianakis# @iops-read:              limit read operations per second
2460432d889eSManos Pitsidianakis# @iops-read-max:          I/O operations read burst
2461432d889eSManos Pitsidianakis# @iops-read-max-length:   length of the iops-read-max burst period, in seconds
2462432d889eSManos Pitsidianakis#                          It must only be set if @iops-read-max is set as well.
2463432d889eSManos Pitsidianakis# @iops-write:             limit write operations per second
2464432d889eSManos Pitsidianakis# @iops-write-max:         I/O operations write burst
2465432d889eSManos Pitsidianakis# @iops-write-max-length:  length of the iops-write-max burst period, in seconds
2466432d889eSManos Pitsidianakis#                          It must only be set if @iops-write-max is set as well.
2467432d889eSManos Pitsidianakis# @bps-total:              limit total bytes per second
2468432d889eSManos Pitsidianakis# @bps-total-max:          total bytes burst
2469432d889eSManos Pitsidianakis# @bps-total-max-length:   length of the bps-total-max burst period, in seconds.
2470432d889eSManos Pitsidianakis#                          It must only be set if @bps-total-max is set as well.
2471432d889eSManos Pitsidianakis# @bps-read:               limit read bytes per second
2472432d889eSManos Pitsidianakis# @bps-read-max:           total bytes read burst
2473432d889eSManos Pitsidianakis# @bps-read-max-length:    length of the bps-read-max burst period, in seconds
2474432d889eSManos Pitsidianakis#                          It must only be set if @bps-read-max is set as well.
2475432d889eSManos Pitsidianakis# @bps-write:              limit write bytes per second
2476432d889eSManos Pitsidianakis# @bps-write-max:          total bytes write burst
2477432d889eSManos Pitsidianakis# @bps-write-max-length:   length of the bps-write-max burst period, in seconds
2478432d889eSManos Pitsidianakis#                          It must only be set if @bps-write-max is set as well.
2479432d889eSManos Pitsidianakis# @iops-size:              when limiting by iops max size of an I/O in bytes
2480432d889eSManos Pitsidianakis#
2481432d889eSManos Pitsidianakis# Since: 2.11
2482432d889eSManos Pitsidianakis##
2483432d889eSManos Pitsidianakis{ 'struct': 'ThrottleLimits',
2484432d889eSManos Pitsidianakis  'data': { '*iops-total' : 'int', '*iops-total-max' : 'int',
2485432d889eSManos Pitsidianakis            '*iops-total-max-length' : 'int', '*iops-read' : 'int',
2486432d889eSManos Pitsidianakis            '*iops-read-max' : 'int', '*iops-read-max-length' : 'int',
2487432d889eSManos Pitsidianakis            '*iops-write' : 'int', '*iops-write-max' : 'int',
2488432d889eSManos Pitsidianakis            '*iops-write-max-length' : 'int', '*bps-total' : 'int',
2489432d889eSManos Pitsidianakis            '*bps-total-max' : 'int', '*bps-total-max-length' : 'int',
2490432d889eSManos Pitsidianakis            '*bps-read' : 'int', '*bps-read-max' : 'int',
2491432d889eSManos Pitsidianakis            '*bps-read-max-length' : 'int', '*bps-write' : 'int',
2492432d889eSManos Pitsidianakis            '*bps-write-max' : 'int', '*bps-write-max-length' : 'int',
2493432d889eSManos Pitsidianakis            '*iops-size' : 'int' } }
2494432d889eSManos Pitsidianakis
2495432d889eSManos Pitsidianakis##
24961ad166b6SBenoît Canet# @block-stream:
24971ad166b6SBenoît Canet#
24981ad166b6SBenoît Canet# Copy data from a backing file into a block device.
24991ad166b6SBenoît Canet#
25001ad166b6SBenoît Canet# The block streaming operation is performed in the background until the entire
25011ad166b6SBenoît Canet# backing file has been copied.  This command returns immediately once streaming
25021ad166b6SBenoît Canet# has started.  The status of ongoing block streaming operations can be checked
25031ad166b6SBenoît Canet# with query-block-jobs.  The operation can be stopped before it has completed
25041ad166b6SBenoît Canet# using the block-job-cancel command.
25051ad166b6SBenoît Canet#
2506554b6147SAlberto Garcia# The node that receives the data is called the top image, can be located in
2507554b6147SAlberto Garcia# any part of the chain (but always above the base image; see below) and can be
2508554b6147SAlberto Garcia# specified using its device or node name. Earlier qemu versions only allowed
2509554b6147SAlberto Garcia# 'device' to name the top level node; presence of the 'base-node' parameter
2510554b6147SAlberto Garcia# during introspection can be used as a witness of the enhanced semantics
2511554b6147SAlberto Garcia# of 'device'.
2512554b6147SAlberto Garcia#
25131ad166b6SBenoît Canet# If a base file is specified then sectors are not copied from that base file and
25141ad166b6SBenoît Canet# its backing chain.  When streaming completes the image file will have the base
25151ad166b6SBenoît Canet# file as its backing file.  This can be used to stream a subset of the backing
25161ad166b6SBenoît Canet# file chain instead of flattening the entire image.
25171ad166b6SBenoît Canet#
25181ad166b6SBenoît Canet# On successful completion the image file is updated to drop the backing file
25191ad166b6SBenoît Canet# and the BLOCK_JOB_COMPLETED event is emitted.
25201ad166b6SBenoît Canet#
25211d8bda12SMarkus Armbruster# @job-id: identifier for the newly-created block job. If
25222323322eSAlberto Garcia#          omitted, the device name will be used. (Since 2.7)
25232323322eSAlberto Garcia#
2524554b6147SAlberto Garcia# @device: the device or node name of the top image
25251ad166b6SBenoît Canet#
25261d8bda12SMarkus Armbruster# @base:   the common backing file name.
2527312fe09cSAlberto Garcia#                    It cannot be set if @base-node is also set.
2528312fe09cSAlberto Garcia#
25291d8bda12SMarkus Armbruster# @base-node: the node name of the backing file.
2530312fe09cSAlberto Garcia#                       It cannot be set if @base is also set. (Since 2.8)
25311ad166b6SBenoît Canet#
25321d8bda12SMarkus Armbruster# @backing-file: The backing file string to write into the top
2533554b6147SAlberto Garcia#                          image. This filename is not validated.
253413d8cc51SJeff Cody#
253513d8cc51SJeff Cody#                          If a pathname string is such that it cannot be
253613d8cc51SJeff Cody#                          resolved by QEMU, that means that subsequent QMP or
253713d8cc51SJeff Cody#                          HMP commands must use node-names for the image in
253813d8cc51SJeff Cody#                          question, as filename lookup methods will fail.
253913d8cc51SJeff Cody#
254013d8cc51SJeff Cody#                          If not specified, QEMU will automatically determine
254113d8cc51SJeff Cody#                          the backing file string to use, or error out if there
254213d8cc51SJeff Cody#                          is no obvious choice.  Care should be taken when
254313d8cc51SJeff Cody#                          specifying the string, to specify a valid filename or
254413d8cc51SJeff Cody#                          protocol.
254513d8cc51SJeff Cody#                          (Since 2.1)
254613d8cc51SJeff Cody#
25471d8bda12SMarkus Armbruster# @speed:  the maximum speed, in bytes per second
25481ad166b6SBenoît Canet#
25491d8bda12SMarkus Armbruster# @on-error: the action to take on an error (default report).
25501ad166b6SBenoît Canet#            'stop' and 'enospc' can only be used if the block device
25511ad166b6SBenoît Canet#            supports io-status (see BlockInfo).  Since 1.3.
25521ad166b6SBenoît Canet#
2553241ca1abSJohn Snow# @auto-finalize: When false, this job will wait in a PENDING state after it has
2554241ca1abSJohn Snow#                 finished its work, waiting for @block-job-finalize before
2555241ca1abSJohn Snow#                 making any block graph changes.
2556241ca1abSJohn Snow#                 When true, this job will automatically
2557241ca1abSJohn Snow#                 perform its abort or commit actions.
2558241ca1abSJohn Snow#                 Defaults to true. (Since 3.1)
2559241ca1abSJohn Snow#
2560241ca1abSJohn Snow# @auto-dismiss: When false, this job will wait in a CONCLUDED state after it
2561241ca1abSJohn Snow#                has completely ceased all work, and awaits @block-job-dismiss.
2562241ca1abSJohn Snow#                When true, this job will automatically disappear from the query
2563241ca1abSJohn Snow#                list without user intervention.
2564241ca1abSJohn Snow#                Defaults to true. (Since 3.1)
2565241ca1abSJohn Snow#
256649b37c23SMarc-André Lureau# Returns: Nothing on success. If @device does not exist, DeviceNotFound.
256749b37c23SMarc-André Lureau#
25681ad166b6SBenoît Canet# Since: 1.1
256949b37c23SMarc-André Lureau#
257049b37c23SMarc-André Lureau# Example:
257149b37c23SMarc-André Lureau#
257249b37c23SMarc-André Lureau# -> { "execute": "block-stream",
257349b37c23SMarc-André Lureau#      "arguments": { "device": "virtio0",
257449b37c23SMarc-André Lureau#                     "base": "/tmp/master.qcow2" } }
257549b37c23SMarc-André Lureau# <- { "return": {} }
257649b37c23SMarc-André Lureau#
25771ad166b6SBenoît Canet##
25781ad166b6SBenoît Canet{ 'command': 'block-stream',
25792323322eSAlberto Garcia  'data': { '*job-id': 'str', 'device': 'str', '*base': 'str',
2580312fe09cSAlberto Garcia            '*base-node': 'str', '*backing-file': 'str', '*speed': 'int',
2581241ca1abSJohn Snow            '*on-error': 'BlockdevOnError',
2582241ca1abSJohn Snow            '*auto-finalize': 'bool', '*auto-dismiss': 'bool' } }
25831ad166b6SBenoît Canet
25841ad166b6SBenoît Canet##
25851ad166b6SBenoît Canet# @block-job-set-speed:
25861ad166b6SBenoît Canet#
25871ad166b6SBenoît Canet# Set maximum speed for a background block operation.
25881ad166b6SBenoît Canet#
25891ad166b6SBenoît Canet# This command can only be issued when there is an active block job.
25901ad166b6SBenoît Canet#
25911ad166b6SBenoît Canet# Throttling can be disabled by setting the speed to 0.
25921ad166b6SBenoît Canet#
25936aae5be6SAlberto Garcia# @device: The job identifier. This used to be a device name (hence
25946aae5be6SAlberto Garcia#          the name of the parameter), but since QEMU 2.7 it can have
25956aae5be6SAlberto Garcia#          other values.
25961ad166b6SBenoît Canet#
25971ad166b6SBenoît Canet# @speed:  the maximum speed, in bytes per second, or 0 for unlimited.
25981ad166b6SBenoît Canet#          Defaults to 0.
25991ad166b6SBenoît Canet#
26001ad166b6SBenoît Canet# Returns: Nothing on success
26011ad166b6SBenoît Canet#          If no background operation is active on this device, DeviceNotActive
26021ad166b6SBenoît Canet#
26031ad166b6SBenoît Canet# Since: 1.1
26041ad166b6SBenoît Canet##
26051ad166b6SBenoît Canet{ 'command': 'block-job-set-speed',
26061ad166b6SBenoît Canet  'data': { 'device': 'str', 'speed': 'int' } }
26071ad166b6SBenoît Canet
26081ad166b6SBenoît Canet##
26091ad166b6SBenoît Canet# @block-job-cancel:
26101ad166b6SBenoît Canet#
26111ad166b6SBenoît Canet# Stop an active background block operation.
26121ad166b6SBenoît Canet#
26131ad166b6SBenoît Canet# This command returns immediately after marking the active background block
26141ad166b6SBenoît Canet# operation for cancellation.  It is an error to call this command if no
26151ad166b6SBenoît Canet# operation is in progress.
26161ad166b6SBenoît Canet#
26171ad166b6SBenoît Canet# The operation will cancel as soon as possible and then emit the
26181ad166b6SBenoît Canet# BLOCK_JOB_CANCELLED event.  Before that happens the job is still visible when
26191ad166b6SBenoît Canet# enumerated using query-block-jobs.
26201ad166b6SBenoît Canet#
2621c117bb14SKashyap Chamarthy# Note that if you issue 'block-job-cancel' after 'drive-mirror' has indicated
2622c117bb14SKashyap Chamarthy# (via the event BLOCK_JOB_READY) that the source and destination are
2623c117bb14SKashyap Chamarthy# synchronized, then the event triggered by this command changes to
2624c117bb14SKashyap Chamarthy# BLOCK_JOB_COMPLETED, to indicate that the mirroring has ended and the
2625c117bb14SKashyap Chamarthy# destination now has a point-in-time copy tied to the time of the cancellation.
2626c117bb14SKashyap Chamarthy#
26271ad166b6SBenoît Canet# For streaming, the image file retains its backing file unless the streaming
26281ad166b6SBenoît Canet# operation happens to complete just as it is being cancelled.  A new streaming
26291ad166b6SBenoît Canet# operation can be started at a later time to finish copying all data from the
26301ad166b6SBenoît Canet# backing file.
26311ad166b6SBenoît Canet#
26326aae5be6SAlberto Garcia# @device: The job identifier. This used to be a device name (hence
26336aae5be6SAlberto Garcia#          the name of the parameter), but since QEMU 2.7 it can have
26346aae5be6SAlberto Garcia#          other values.
26351ad166b6SBenoît Canet#
2636b76e4458SLiang Li# @force: If true, and the job has already emitted the event BLOCK_JOB_READY,
2637b76e4458SLiang Li#         abandon the job immediately (even if it is paused) instead of waiting
2638b76e4458SLiang Li#         for the destination to complete its final synchronization (since 1.3)
26391ad166b6SBenoît Canet#
26401ad166b6SBenoît Canet# Returns: Nothing on success
26411ad166b6SBenoît Canet#          If no background operation is active on this device, DeviceNotActive
26421ad166b6SBenoît Canet#
26431ad166b6SBenoît Canet# Since: 1.1
26441ad166b6SBenoît Canet##
26451ad166b6SBenoît Canet{ 'command': 'block-job-cancel', 'data': { 'device': 'str', '*force': 'bool' } }
26461ad166b6SBenoît Canet
26471ad166b6SBenoît Canet##
26481ad166b6SBenoît Canet# @block-job-pause:
26491ad166b6SBenoît Canet#
26501ad166b6SBenoît Canet# Pause an active background block operation.
26511ad166b6SBenoît Canet#
26521ad166b6SBenoît Canet# This command returns immediately after marking the active background block
26531ad166b6SBenoît Canet# operation for pausing.  It is an error to call this command if no
2654cd44d96bSKevin Wolf# operation is in progress or if the job is already paused.
26551ad166b6SBenoît Canet#
26561ad166b6SBenoît Canet# The operation will pause as soon as possible.  No event is emitted when
26571ad166b6SBenoît Canet# the operation is actually paused.  Cancelling a paused job automatically
26581ad166b6SBenoît Canet# resumes it.
26591ad166b6SBenoît Canet#
26606aae5be6SAlberto Garcia# @device: The job identifier. This used to be a device name (hence
26616aae5be6SAlberto Garcia#          the name of the parameter), but since QEMU 2.7 it can have
26626aae5be6SAlberto Garcia#          other values.
26631ad166b6SBenoît Canet#
26641ad166b6SBenoît Canet# Returns: Nothing on success
26651ad166b6SBenoît Canet#          If no background operation is active on this device, DeviceNotActive
26661ad166b6SBenoît Canet#
26671ad166b6SBenoît Canet# Since: 1.3
26681ad166b6SBenoît Canet##
26691ad166b6SBenoît Canet{ 'command': 'block-job-pause', 'data': { 'device': 'str' } }
26701ad166b6SBenoît Canet
26711ad166b6SBenoît Canet##
26721ad166b6SBenoît Canet# @block-job-resume:
26731ad166b6SBenoît Canet#
26741ad166b6SBenoît Canet# Resume an active background block operation.
26751ad166b6SBenoît Canet#
26761ad166b6SBenoît Canet# This command returns immediately after resuming a paused background block
26771ad166b6SBenoît Canet# operation.  It is an error to call this command if no operation is in
2678cd44d96bSKevin Wolf# progress or if the job is not paused.
26791ad166b6SBenoît Canet#
26801ad166b6SBenoît Canet# This command also clears the error status of the job.
26811ad166b6SBenoît Canet#
26826aae5be6SAlberto Garcia# @device: The job identifier. This used to be a device name (hence
26836aae5be6SAlberto Garcia#          the name of the parameter), but since QEMU 2.7 it can have
26846aae5be6SAlberto Garcia#          other values.
26851ad166b6SBenoît Canet#
26861ad166b6SBenoît Canet# Returns: Nothing on success
26871ad166b6SBenoît Canet#          If no background operation is active on this device, DeviceNotActive
26881ad166b6SBenoît Canet#
26891ad166b6SBenoît Canet# Since: 1.3
26901ad166b6SBenoît Canet##
26911ad166b6SBenoît Canet{ 'command': 'block-job-resume', 'data': { 'device': 'str' } }
26921ad166b6SBenoît Canet
26931ad166b6SBenoît Canet##
26941ad166b6SBenoît Canet# @block-job-complete:
26951ad166b6SBenoît Canet#
26961ad166b6SBenoît Canet# Manually trigger completion of an active background block operation.  This
26971ad166b6SBenoît Canet# is supported for drive mirroring, where it also switches the device to
26981ad166b6SBenoît Canet# write to the target path only.  The ability to complete is signaled with
26991ad166b6SBenoît Canet# a BLOCK_JOB_READY event.
27001ad166b6SBenoît Canet#
27011ad166b6SBenoît Canet# This command completes an active background block operation synchronously.
27021ad166b6SBenoît Canet# The ordering of this command's return with the BLOCK_JOB_COMPLETED event
27031ad166b6SBenoît Canet# is not defined.  Note that if an I/O error occurs during the processing of
27041ad166b6SBenoît Canet# this command: 1) the command itself will fail; 2) the error will be processed
27051ad166b6SBenoît Canet# according to the rerror/werror arguments that were specified when starting
27061ad166b6SBenoît Canet# the operation.
27071ad166b6SBenoît Canet#
27081ad166b6SBenoît Canet# A cancelled or paused job cannot be completed.
27091ad166b6SBenoît Canet#
27106aae5be6SAlberto Garcia# @device: The job identifier. This used to be a device name (hence
27116aae5be6SAlberto Garcia#          the name of the parameter), but since QEMU 2.7 it can have
27126aae5be6SAlberto Garcia#          other values.
27131ad166b6SBenoît Canet#
27141ad166b6SBenoît Canet# Returns: Nothing on success
27151ad166b6SBenoît Canet#          If no background operation is active on this device, DeviceNotActive
27161ad166b6SBenoît Canet#
27171ad166b6SBenoît Canet# Since: 1.3
27181ad166b6SBenoît Canet##
27191ad166b6SBenoît Canet{ 'command': 'block-job-complete', 'data': { 'device': 'str' } }
27201ad166b6SBenoît Canet
27211ad166b6SBenoît Canet##
272275f71059SJohn Snow# @block-job-dismiss:
272375f71059SJohn Snow#
272475f71059SJohn Snow# For jobs that have already concluded, remove them from the block-job-query
272575f71059SJohn Snow# list. This command only needs to be run for jobs which were started with
272675f71059SJohn Snow# QEMU 2.12+ job lifetime management semantics.
272775f71059SJohn Snow#
272875f71059SJohn Snow# This command will refuse to operate on any job that has not yet reached
2729a50c2ab8SKevin Wolf# its terminal state, JOB_STATUS_CONCLUDED. For jobs that make use of the
273075f71059SJohn Snow# BLOCK_JOB_READY event, block-job-cancel or block-job-complete will still need
273175f71059SJohn Snow# to be used as appropriate.
273275f71059SJohn Snow#
273375f71059SJohn Snow# @id: The job identifier.
273475f71059SJohn Snow#
273575f71059SJohn Snow# Returns: Nothing on success
273675f71059SJohn Snow#
273775f71059SJohn Snow# Since: 2.12
273875f71059SJohn Snow##
273975f71059SJohn Snow{ 'command': 'block-job-dismiss', 'data': { 'id': 'str' } }
274075f71059SJohn Snow
274175f71059SJohn Snow##
274211b61fbcSJohn Snow# @block-job-finalize:
274311b61fbcSJohn Snow#
274411b61fbcSJohn Snow# Once a job that has manual=true reaches the pending state, it can be
274511b61fbcSJohn Snow# instructed to finalize any graph changes and do any necessary cleanup
274611b61fbcSJohn Snow# via this command.
274711b61fbcSJohn Snow# For jobs in a transaction, instructing one job to finalize will force
274811b61fbcSJohn Snow# ALL jobs in the transaction to finalize, so it is only necessary to instruct
274911b61fbcSJohn Snow# a single member job to finalize.
275011b61fbcSJohn Snow#
275111b61fbcSJohn Snow# @id: The job identifier.
275211b61fbcSJohn Snow#
275311b61fbcSJohn Snow# Returns: Nothing on success
275411b61fbcSJohn Snow#
275511b61fbcSJohn Snow# Since: 2.12
275611b61fbcSJohn Snow##
275711b61fbcSJohn Snow{ 'command': 'block-job-finalize', 'data': { 'id': 'str' } }
275811b61fbcSJohn Snow
275911b61fbcSJohn Snow##
27605072f7b3SMarc-André Lureau# @BlockdevDiscardOptions:
27611ad166b6SBenoît Canet#
27621ad166b6SBenoît Canet# Determines how to handle discard requests.
27631ad166b6SBenoît Canet#
27641ad166b6SBenoît Canet# @ignore:      Ignore the request
27651ad166b6SBenoît Canet# @unmap:       Forward as an unmap request
27661ad166b6SBenoît Canet#
276779b7a77eSMarkus Armbruster# Since: 2.9
27681ad166b6SBenoît Canet##
27691ad166b6SBenoît Canet{ 'enum': 'BlockdevDiscardOptions',
27701ad166b6SBenoît Canet  'data': [ 'ignore', 'unmap' ] }
27711ad166b6SBenoît Canet
27721ad166b6SBenoît Canet##
27735072f7b3SMarc-André Lureau# @BlockdevDetectZeroesOptions:
27741ad166b6SBenoît Canet#
27751ad166b6SBenoît Canet# Describes the operation mode for the automatic conversion of plain
27761ad166b6SBenoît Canet# zero writes by the OS to driver specific optimized zero write commands.
27771ad166b6SBenoît Canet#
27781ad166b6SBenoît Canet# @off:      Disabled (default)
27791ad166b6SBenoît Canet# @on:       Enabled
27801ad166b6SBenoît Canet# @unmap:    Enabled and even try to unmap blocks if possible. This requires
27811ad166b6SBenoît Canet#            also that @BlockdevDiscardOptions is set to unmap for this device.
27821ad166b6SBenoît Canet#
27831ad166b6SBenoît Canet# Since: 2.1
27841ad166b6SBenoît Canet##
27851ad166b6SBenoît Canet{ 'enum': 'BlockdevDetectZeroesOptions',
27861ad166b6SBenoît Canet  'data': [ 'off', 'on', 'unmap' ] }
27871ad166b6SBenoît Canet
27881ad166b6SBenoît Canet##
27895072f7b3SMarc-André Lureau# @BlockdevAioOptions:
27901ad166b6SBenoît Canet#
27911ad166b6SBenoît Canet# Selects the AIO backend to handle I/O requests
27921ad166b6SBenoît Canet#
27931ad166b6SBenoît Canet# @threads:     Use qemu's thread pool
27941ad166b6SBenoît Canet# @native:      Use native AIO backend (only Linux and Windows)
27951ad166b6SBenoît Canet#
279679b7a77eSMarkus Armbruster# Since: 2.9
27971ad166b6SBenoît Canet##
27981ad166b6SBenoît Canet{ 'enum': 'BlockdevAioOptions',
27991ad166b6SBenoît Canet  'data': [ 'threads', 'native' ] }
28001ad166b6SBenoît Canet
28011ad166b6SBenoît Canet##
28025072f7b3SMarc-André Lureau# @BlockdevCacheOptions:
28031ad166b6SBenoît Canet#
28041ad166b6SBenoît Canet# Includes cache-related options for block devices
28051ad166b6SBenoît Canet#
28061d8bda12SMarkus Armbruster# @direct:      enables use of O_DIRECT (bypass the host page cache;
28071ad166b6SBenoît Canet#               default: false)
28081d8bda12SMarkus Armbruster# @no-flush:    ignore any flush requests for the device (default:
28091ad166b6SBenoît Canet#               false)
28101ad166b6SBenoît Canet#
281179b7a77eSMarkus Armbruster# Since: 2.9
28121ad166b6SBenoît Canet##
2813895a2a80SEric Blake{ 'struct': 'BlockdevCacheOptions',
2814aaa436f9SKevin Wolf  'data': { '*direct': 'bool',
28151ad166b6SBenoît Canet            '*no-flush': 'bool' } }
28161ad166b6SBenoît Canet
28171ad166b6SBenoît Canet##
28185072f7b3SMarc-André Lureau# @BlockdevDriver:
28191ad166b6SBenoît Canet#
28201ad166b6SBenoît Canet# Drivers that are supported in block device operations.
28211ad166b6SBenoît Canet#
2822da92c3ffSAshish Mittal# @vxhs: Since 2.10
2823d8e7d87eSManos Pitsidianakis# @throttle: Since 2.11
2824d87ee3d7SFam Zheng# @nvme: Since 2.12
282551f63ec7SPeter Maydell# @copy-on-read: Since 3.0
2826bfcc224eSAapo Vienamo# @blklogwrites: Since 3.0
2827da92c3ffSAshish Mittal#
282879b7a77eSMarkus Armbruster# Since: 2.9
28291ad166b6SBenoît Canet##
28301ad166b6SBenoît Canet{ 'enum': 'BlockdevDriver',
2831bfcc224eSAapo Vienamo  'data': [ 'blkdebug', 'blklogwrites', 'blkverify', 'bochs', 'cloop',
2832bfcc224eSAapo Vienamo            'copy-on-read', 'dmg', 'file', 'ftp', 'ftps', 'gluster',
2833bfcc224eSAapo Vienamo            'host_cdrom', 'host_device', 'http', 'https', 'iscsi', 'luks',
2834bfcc224eSAapo Vienamo            'nbd', 'nfs', 'null-aio', 'null-co', 'nvme', 'parallels', 'qcow',
2835335d10cdSMarc-André Lureau            'qcow2', 'qed', 'quorum', 'raw', 'rbd',
2836335d10cdSMarc-André Lureau            { 'name': 'replication', 'if': 'defined(CONFIG_REPLICATION)' },
2837335d10cdSMarc-André Lureau            'sheepdog',
2838bfcc224eSAapo Vienamo            'ssh', 'throttle', 'vdi', 'vhdx', 'vmdk', 'vpc', 'vvfat', 'vxhs' ] }
28391ad166b6SBenoît Canet
28401ad166b6SBenoît Canet##
28415072f7b3SMarc-André Lureau# @BlockdevOptionsFile:
28421ad166b6SBenoît Canet#
284368555285SKevin Wolf# Driver specific block device options for the file backend.
28441ad166b6SBenoît Canet#
28451ad166b6SBenoît Canet# @filename:    path to the image file
28467c9e5276SPaolo Bonzini# @pr-manager:  the id for the object that will handle persistent reservations
28477c9e5276SPaolo Bonzini#               for this device (default: none, forward the commands via SG_IO;
28487c9e5276SPaolo Bonzini#               since 2.11)
28491d8bda12SMarkus Armbruster# @aio:         AIO backend (default: threads) (since: 2.8)
285016b48d5dSFam Zheng# @locking:     whether to enable file locking. If set to 'auto', only enable
285116b48d5dSFam Zheng#               when Open File Descriptor (OFD) locking API is available
285216b48d5dSFam Zheng#               (default: auto, since 2.10)
2853f357fcd8SStefan Hajnoczi# @drop-cache:  invalidate page cache during live migration.  This prevents
2854f357fcd8SStefan Hajnoczi#               stale data on the migration destination with cache.direct=off.
2855f357fcd8SStefan Hajnoczi#               Currently only supported on Linux hosts.
2856f357fcd8SStefan Hajnoczi#               (default: on, since: 4.0)
285731be8a2aSStefan Hajnoczi# @x-check-cache-dropped: whether to check that page cache was dropped on live
285831be8a2aSStefan Hajnoczi#                         migration.  May cause noticeable delays if the image
285931be8a2aSStefan Hajnoczi#                         file is large, do not use in production.
286051f63ec7SPeter Maydell#                         (default: off) (since: 3.0)
28611ad166b6SBenoît Canet#
2862c9d40709SKevin Wolf# Features:
2863c9d40709SKevin Wolf# @dynamic-auto-read-only: If present, enabled auto-read-only means that the
2864c9d40709SKevin Wolf#                          driver will open the image read-only at first,
2865c9d40709SKevin Wolf#                          dynamically reopen the image file read-write when
2866c9d40709SKevin Wolf#                          the first writer is attached to the node and reopen
2867c9d40709SKevin Wolf#                          read-only when the last writer is detached. This
2868c9d40709SKevin Wolf#                          allows giving QEMU write permissions only on demand
2869c9d40709SKevin Wolf#                          when an operation actually needs write access.
2870c9d40709SKevin Wolf#
287179b7a77eSMarkus Armbruster# Since: 2.9
28721ad166b6SBenoît Canet##
2873895a2a80SEric Blake{ 'struct': 'BlockdevOptionsFile',
28740a4279d9SKevin Wolf  'data': { 'filename': 'str',
28757c9e5276SPaolo Bonzini            '*pr-manager': 'str',
287616b48d5dSFam Zheng            '*locking': 'OnOffAuto',
287731be8a2aSStefan Hajnoczi            '*aio': 'BlockdevAioOptions',
2878f357fcd8SStefan Hajnoczi	    '*drop-cache': {'type': 'bool',
2879f357fcd8SStefan Hajnoczi	                    'if': 'defined(CONFIG_LINUX)'},
2880c9d40709SKevin Wolf            '*x-check-cache-dropped': 'bool' },
2881c9d40709SKevin Wolf  'features': [ { 'name': 'dynamic-auto-read-only',
2882c9d40709SKevin Wolf                  'if': 'defined(CONFIG_POSIX)' } ] }
28831ad166b6SBenoît Canet
28841ad166b6SBenoît Canet##
28855072f7b3SMarc-André Lureau# @BlockdevOptionsNull:
2886e819ab22SFam Zheng#
2887e819ab22SFam Zheng# Driver specific block device options for the null backend.
2888e819ab22SFam Zheng#
28891d8bda12SMarkus Armbruster# @size:    size of the device in bytes.
28901d8bda12SMarkus Armbruster# @latency-ns: emulated latency (in nanoseconds) in processing
2891e5e51dd3SFam Zheng#              requests. Default to zero which completes requests immediately.
2892e5e51dd3SFam Zheng#              (Since 2.4)
2893e819ab22SFam Zheng#
289479b7a77eSMarkus Armbruster# Since: 2.9
2895e819ab22SFam Zheng##
2896895a2a80SEric Blake{ 'struct': 'BlockdevOptionsNull',
2897e5e51dd3SFam Zheng  'data': { '*size': 'int', '*latency-ns': 'uint64' } }
2898e819ab22SFam Zheng
2899e819ab22SFam Zheng##
2900d87ee3d7SFam Zheng# @BlockdevOptionsNVMe:
2901d87ee3d7SFam Zheng#
2902d87ee3d7SFam Zheng# Driver specific block device options for the NVMe backend.
2903d87ee3d7SFam Zheng#
2904d87ee3d7SFam Zheng# @device:    controller address of the NVMe device.
2905d87ee3d7SFam Zheng# @namespace: namespace number of the device, starting from 1.
2906d87ee3d7SFam Zheng#
2907d87ee3d7SFam Zheng# Since: 2.12
2908d87ee3d7SFam Zheng##
2909d87ee3d7SFam Zheng{ 'struct': 'BlockdevOptionsNVMe',
2910d87ee3d7SFam Zheng  'data': { 'device': 'str', 'namespace': 'int' } }
2911d87ee3d7SFam Zheng
2912d87ee3d7SFam Zheng##
29135072f7b3SMarc-André Lureau# @BlockdevOptionsVVFAT:
29141ad166b6SBenoît Canet#
29151ad166b6SBenoît Canet# Driver specific block device options for the vvfat protocol.
29161ad166b6SBenoît Canet#
29171ad166b6SBenoît Canet# @dir:         directory to be exported as FAT image
29181d8bda12SMarkus Armbruster# @fat-type:    FAT type: 12, 16 or 32
29191d8bda12SMarkus Armbruster# @floppy:      whether to export a floppy image (true) or
29201ad166b6SBenoît Canet#               partitioned hard disk (false; default)
29211d8bda12SMarkus Armbruster# @label:       set the volume label, limited to 11 bytes. FAT16 and
2922d5941ddaSWolfgang Bumiller#               FAT32 traditionally have some restrictions on labels, which are
2923d5941ddaSWolfgang Bumiller#               ignored by most operating systems. Defaults to "QEMU VVFAT".
2924d5941ddaSWolfgang Bumiller#               (since 2.4)
29251d8bda12SMarkus Armbruster# @rw:          whether to allow write operations (default: false)
29261ad166b6SBenoît Canet#
292779b7a77eSMarkus Armbruster# Since: 2.9
29281ad166b6SBenoît Canet##
2929895a2a80SEric Blake{ 'struct': 'BlockdevOptionsVVFAT',
29301ad166b6SBenoît Canet  'data': { 'dir': 'str', '*fat-type': 'int', '*floppy': 'bool',
2931d5941ddaSWolfgang Bumiller            '*label': 'str', '*rw': 'bool' } }
29321ad166b6SBenoît Canet
29331ad166b6SBenoît Canet##
29345072f7b3SMarc-André Lureau# @BlockdevOptionsGenericFormat:
29351ad166b6SBenoît Canet#
29361ad166b6SBenoît Canet# Driver specific block device options for image format that have no option
29371ad166b6SBenoît Canet# besides their data source.
29381ad166b6SBenoît Canet#
29391ad166b6SBenoît Canet# @file:        reference to or definition of the data source block device
29401ad166b6SBenoît Canet#
294179b7a77eSMarkus Armbruster# Since: 2.9
29421ad166b6SBenoît Canet##
2943895a2a80SEric Blake{ 'struct': 'BlockdevOptionsGenericFormat',
29441ad166b6SBenoît Canet  'data': { 'file': 'BlockdevRef' } }
29451ad166b6SBenoît Canet
29461ad166b6SBenoît Canet##
29475072f7b3SMarc-André Lureau# @BlockdevOptionsLUKS:
294878368575SDaniel P. Berrange#
294978368575SDaniel P. Berrange# Driver specific block device options for LUKS.
295078368575SDaniel P. Berrange#
29511d8bda12SMarkus Armbruster# @key-secret: the ID of a QCryptoSecret object providing
295278368575SDaniel P. Berrange#              the decryption key (since 2.6). Mandatory except when
295378368575SDaniel P. Berrange#              doing a metadata-only probe of the image.
295478368575SDaniel P. Berrange#
295579b7a77eSMarkus Armbruster# Since: 2.9
295678368575SDaniel P. Berrange##
295778368575SDaniel P. Berrange{ 'struct': 'BlockdevOptionsLUKS',
295878368575SDaniel P. Berrange  'base': 'BlockdevOptionsGenericFormat',
295978368575SDaniel P. Berrange  'data': { '*key-secret': 'str' } }
296078368575SDaniel P. Berrange
296178368575SDaniel P. Berrange
296278368575SDaniel P. Berrange##
29635072f7b3SMarc-André Lureau# @BlockdevOptionsGenericCOWFormat:
29641ad166b6SBenoît Canet#
29651ad166b6SBenoît Canet# Driver specific block device options for image format that have no option
29661ad166b6SBenoît Canet# besides their data source and an optional backing file.
29671ad166b6SBenoît Canet#
29681d8bda12SMarkus Armbruster# @backing:     reference to or definition of the backing file block
2969c42e8742SMarkus Armbruster#               device, null disables the backing file entirely.
2970c42e8742SMarkus Armbruster#               Defaults to the backing file stored the image file.
29711ad166b6SBenoît Canet#
297279b7a77eSMarkus Armbruster# Since: 2.9
29731ad166b6SBenoît Canet##
2974895a2a80SEric Blake{ 'struct': 'BlockdevOptionsGenericCOWFormat',
29751ad166b6SBenoît Canet  'base': 'BlockdevOptionsGenericFormat',
2976c42e8742SMarkus Armbruster  'data': { '*backing': 'BlockdevRefOrNull' } }
29771ad166b6SBenoît Canet
29781ad166b6SBenoît Canet##
29795072f7b3SMarc-André Lureau# @Qcow2OverlapCheckMode:
2980f6585811SMax Reitz#
2981f6585811SMax Reitz# General overlap check modes.
2982f6585811SMax Reitz#
2983f6585811SMax Reitz# @none:        Do not perform any checks
2984f6585811SMax Reitz#
2985f6585811SMax Reitz# @constant:    Perform only checks which can be done in constant time and
2986f6585811SMax Reitz#               without reading anything from disk
2987f6585811SMax Reitz#
2988f6585811SMax Reitz# @cached:      Perform only checks which can be done without reading anything
2989f6585811SMax Reitz#               from disk
2990f6585811SMax Reitz#
2991f6585811SMax Reitz# @all:         Perform all available overlap checks
2992f6585811SMax Reitz#
299379b7a77eSMarkus Armbruster# Since: 2.9
2994f6585811SMax Reitz##
2995f6585811SMax Reitz{ 'enum': 'Qcow2OverlapCheckMode',
2996f6585811SMax Reitz  'data': [ 'none', 'constant', 'cached', 'all' ] }
2997f6585811SMax Reitz
2998f6585811SMax Reitz##
29995072f7b3SMarc-André Lureau# @Qcow2OverlapCheckFlags:
3000f6585811SMax Reitz#
3001f6585811SMax Reitz# Structure of flags for each metadata structure. Setting a field to 'true'
3002f6585811SMax Reitz# makes qemu guard that structure against unintended overwriting. The default
3003f6585811SMax Reitz# value is chosen according to the template given.
3004f6585811SMax Reitz#
3005f6585811SMax Reitz# @template: Specifies a template mode which can be adjusted using the other
3006f6585811SMax Reitz#            flags, defaults to 'cached'
3007f6585811SMax Reitz#
30080e4e4318SVladimir Sementsov-Ogievskiy# @bitmap-directory: since 3.0
30090e4e4318SVladimir Sementsov-Ogievskiy#
301079b7a77eSMarkus Armbruster# Since: 2.9
3011f6585811SMax Reitz##
3012895a2a80SEric Blake{ 'struct': 'Qcow2OverlapCheckFlags',
3013f6585811SMax Reitz  'data': { '*template':         'Qcow2OverlapCheckMode',
3014f6585811SMax Reitz            '*main-header':      'bool',
3015f6585811SMax Reitz            '*active-l1':        'bool',
3016f6585811SMax Reitz            '*active-l2':        'bool',
3017f6585811SMax Reitz            '*refcount-table':   'bool',
3018f6585811SMax Reitz            '*refcount-block':   'bool',
3019f6585811SMax Reitz            '*snapshot-table':   'bool',
3020f6585811SMax Reitz            '*inactive-l1':      'bool',
30210e4e4318SVladimir Sementsov-Ogievskiy            '*inactive-l2':      'bool',
30220e4e4318SVladimir Sementsov-Ogievskiy            '*bitmap-directory': 'bool' } }
3023f6585811SMax Reitz
3024f6585811SMax Reitz##
30255072f7b3SMarc-André Lureau# @Qcow2OverlapChecks:
3026f6585811SMax Reitz#
3027f6585811SMax Reitz# Specifies which metadata structures should be guarded against unintended
3028f6585811SMax Reitz# overwriting.
3029f6585811SMax Reitz#
3030f6585811SMax Reitz# @flags:   set of flags for separate specification of each metadata structure
3031f6585811SMax Reitz#           type
3032f6585811SMax Reitz#
3033f6585811SMax Reitz# @mode:    named mode which chooses a specific set of flags
3034f6585811SMax Reitz#
303579b7a77eSMarkus Armbruster# Since: 2.9
3036f6585811SMax Reitz##
3037ab916fadSEric Blake{ 'alternate': 'Qcow2OverlapChecks',
3038f6585811SMax Reitz  'data': { 'flags': 'Qcow2OverlapCheckFlags',
3039f6585811SMax Reitz            'mode':  'Qcow2OverlapCheckMode' } }
3040f6585811SMax Reitz
3041f6585811SMax Reitz##
3042d85f4222SDaniel P. Berrange# @BlockdevQcowEncryptionFormat:
3043d85f4222SDaniel P. Berrange#
3044d85f4222SDaniel P. Berrange# @aes: AES-CBC with plain64 initialization vectors
3045d85f4222SDaniel P. Berrange#
3046d85f4222SDaniel P. Berrange# Since: 2.10
3047d85f4222SDaniel P. Berrange##
3048d85f4222SDaniel P. Berrange{ 'enum': 'BlockdevQcowEncryptionFormat',
3049d85f4222SDaniel P. Berrange  'data': [ 'aes' ] }
3050d85f4222SDaniel P. Berrange
3051d85f4222SDaniel P. Berrange##
3052d85f4222SDaniel P. Berrange# @BlockdevQcowEncryption:
3053d85f4222SDaniel P. Berrange#
3054d85f4222SDaniel P. Berrange# Since: 2.10
3055d85f4222SDaniel P. Berrange##
3056d85f4222SDaniel P. Berrange{ 'union': 'BlockdevQcowEncryption',
3057d85f4222SDaniel P. Berrange  'base': { 'format': 'BlockdevQcowEncryptionFormat' },
3058d85f4222SDaniel P. Berrange  'discriminator': 'format',
3059d85f4222SDaniel P. Berrange  'data': { 'aes': 'QCryptoBlockOptionsQCow' } }
3060d85f4222SDaniel P. Berrange
3061d85f4222SDaniel P. Berrange##
3062d85f4222SDaniel P. Berrange# @BlockdevOptionsQcow:
3063d85f4222SDaniel P. Berrange#
3064d85f4222SDaniel P. Berrange# Driver specific block device options for qcow.
3065d85f4222SDaniel P. Berrange#
3066d85f4222SDaniel P. Berrange# @encrypt:               Image decryption options. Mandatory for
3067d85f4222SDaniel P. Berrange#                         encrypted images, except when doing a metadata-only
3068d85f4222SDaniel P. Berrange#                         probe of the image.
3069d85f4222SDaniel P. Berrange#
3070d85f4222SDaniel P. Berrange# Since: 2.10
3071d85f4222SDaniel P. Berrange##
3072d85f4222SDaniel P. Berrange{ 'struct': 'BlockdevOptionsQcow',
3073d85f4222SDaniel P. Berrange  'base': 'BlockdevOptionsGenericCOWFormat',
3074d85f4222SDaniel P. Berrange  'data': { '*encrypt': 'BlockdevQcowEncryption' } }
3075d85f4222SDaniel P. Berrange
3076d85f4222SDaniel P. Berrange
3077b25b387fSDaniel P. Berrange
3078b25b387fSDaniel P. Berrange##
3079b25b387fSDaniel P. Berrange# @BlockdevQcow2EncryptionFormat:
308058823a0bSEric Blake# @aes: AES-CBC with plain64 initialization vectors
3081b25b387fSDaniel P. Berrange#
3082b25b387fSDaniel P. Berrange# Since: 2.10
3083b25b387fSDaniel P. Berrange##
3084b25b387fSDaniel P. Berrange{ 'enum': 'BlockdevQcow2EncryptionFormat',
30854652b8f3SDaniel P. Berrange  'data': [ 'aes', 'luks' ] }
3086b25b387fSDaniel P. Berrange
3087b25b387fSDaniel P. Berrange##
3088b25b387fSDaniel P. Berrange# @BlockdevQcow2Encryption:
3089b25b387fSDaniel P. Berrange#
3090b25b387fSDaniel P. Berrange# Since: 2.10
3091b25b387fSDaniel P. Berrange##
3092b25b387fSDaniel P. Berrange{ 'union': 'BlockdevQcow2Encryption',
3093b25b387fSDaniel P. Berrange  'base': { 'format': 'BlockdevQcow2EncryptionFormat' },
3094b25b387fSDaniel P. Berrange  'discriminator': 'format',
30954652b8f3SDaniel P. Berrange  'data': { 'aes': 'QCryptoBlockOptionsQCow',
30964652b8f3SDaniel P. Berrange            'luks': 'QCryptoBlockOptionsLUKS'} }
3097b25b387fSDaniel P. Berrange
3098d85f4222SDaniel P. Berrange##
30995072f7b3SMarc-André Lureau# @BlockdevOptionsQcow2:
31001ad166b6SBenoît Canet#
31011ad166b6SBenoît Canet# Driver specific block device options for qcow2.
31021ad166b6SBenoît Canet#
31031d8bda12SMarkus Armbruster# @lazy-refcounts:        whether to enable the lazy refcounts
31041ad166b6SBenoît Canet#                         feature (default is taken from the image file)
31051ad166b6SBenoît Canet#
31061d8bda12SMarkus Armbruster# @pass-discard-request:  whether discard requests to the qcow2
31071ad166b6SBenoît Canet#                         device should be forwarded to the data source
31081ad166b6SBenoît Canet#
31091d8bda12SMarkus Armbruster# @pass-discard-snapshot: whether discard requests for the data source
31101ad166b6SBenoît Canet#                         should be issued when a snapshot operation (e.g.
31111ad166b6SBenoît Canet#                         deleting a snapshot) frees clusters in the qcow2 file
31121ad166b6SBenoît Canet#
31131d8bda12SMarkus Armbruster# @pass-discard-other:    whether discard requests for the data source
31141ad166b6SBenoît Canet#                         should be issued on other occasions where a cluster
31151ad166b6SBenoît Canet#                         gets freed
31161ad166b6SBenoît Canet#
31171d8bda12SMarkus Armbruster# @overlap-check:         which overlap checks to perform for writes
3118f6585811SMax Reitz#                         to the image, defaults to 'cached' (since 2.2)
3119f6585811SMax Reitz#
31201d8bda12SMarkus Armbruster# @cache-size:            the maximum total size of the L2 table and
3121f6585811SMax Reitz#                         refcount block caches in bytes (since 2.2)
3122f6585811SMax Reitz#
31231d8bda12SMarkus Armbruster# @l2-cache-size:         the maximum size of the L2 table cache in
3124f6585811SMax Reitz#                         bytes (since 2.2)
3125f6585811SMax Reitz#
31261221fe6fSAlberto Garcia# @l2-cache-entry-size:   the size of each entry in the L2 cache in
31271221fe6fSAlberto Garcia#                         bytes. It must be a power of two between 512
31281221fe6fSAlberto Garcia#                         and the cluster size. The default value is
31291221fe6fSAlberto Garcia#                         the cluster size (since 2.12)
31301221fe6fSAlberto Garcia#
31311d8bda12SMarkus Armbruster# @refcount-cache-size:   the maximum size of the refcount block cache
3132f6585811SMax Reitz#                         in bytes (since 2.2)
3133f6585811SMax Reitz#
31341d8bda12SMarkus Armbruster# @cache-clean-interval:  clean unused entries in the L2 and refcount
3135279621c0SAlberto Garcia#                         caches. The interval is in seconds. The default value
3136e3a7b455SLeonid Bloch#                         is 600 on supporting platforms, and 0 on other
3137e3a7b455SLeonid Bloch#                         platforms. 0 disables this feature. (since 2.5)
3138e957b50bSLeonid Bloch#
3139b25b387fSDaniel P. Berrange# @encrypt:               Image decryption options. Mandatory for
3140b25b387fSDaniel P. Berrange#                         encrypted images, except when doing a metadata-only
3141b25b387fSDaniel P. Berrange#                         probe of the image. (since 2.10)
3142279621c0SAlberto Garcia#
31430e8c08beSKevin Wolf# @data-file:             reference to or definition of the external data file.
31440e8c08beSKevin Wolf#                         This may only be specified for images that require an
31459b890bdcSKevin Wolf#                         external data file. If it is not specified for such
31469b890bdcSKevin Wolf#                         an image, the data file name is loaded from the image
31479b890bdcSKevin Wolf#                         file. (since 4.0)
31480e8c08beSKevin Wolf#
314979b7a77eSMarkus Armbruster# Since: 2.9
31501ad166b6SBenoît Canet##
3151895a2a80SEric Blake{ 'struct': 'BlockdevOptionsQcow2',
31521ad166b6SBenoît Canet  'base': 'BlockdevOptionsGenericCOWFormat',
31531ad166b6SBenoît Canet  'data': { '*lazy-refcounts': 'bool',
31541ad166b6SBenoît Canet            '*pass-discard-request': 'bool',
31551ad166b6SBenoît Canet            '*pass-discard-snapshot': 'bool',
3156f6585811SMax Reitz            '*pass-discard-other': 'bool',
3157f6585811SMax Reitz            '*overlap-check': 'Qcow2OverlapChecks',
3158f6585811SMax Reitz            '*cache-size': 'int',
3159f6585811SMax Reitz            '*l2-cache-size': 'int',
31601221fe6fSAlberto Garcia            '*l2-cache-entry-size': 'int',
3161279621c0SAlberto Garcia            '*refcount-cache-size': 'int',
3162b25b387fSDaniel P. Berrange            '*cache-clean-interval': 'int',
31630e8c08beSKevin Wolf            '*encrypt': 'BlockdevQcow2Encryption',
31640e8c08beSKevin Wolf            '*data-file': 'BlockdevRef' } }
3165b1de5f43SChrysostomos Nanakos
3166b1de5f43SChrysostomos Nanakos##
3167ec2f5418SKevin Wolf# @SshHostKeyCheckMode:
3168ec2f5418SKevin Wolf#
3169ec2f5418SKevin Wolf# @none             Don't check the host key at all
3170ec2f5418SKevin Wolf# @hash             Compare the host key with a given hash
3171ec2f5418SKevin Wolf# @known_hosts      Check the host key against the known_hosts file
3172ec2f5418SKevin Wolf#
3173ec2f5418SKevin Wolf# Since: 2.12
3174ec2f5418SKevin Wolf##
3175ec2f5418SKevin Wolf{ 'enum': 'SshHostKeyCheckMode',
3176ec2f5418SKevin Wolf  'data': [ 'none', 'hash', 'known_hosts' ] }
3177ec2f5418SKevin Wolf
3178ec2f5418SKevin Wolf##
3179ec2f5418SKevin Wolf# @SshHostKeyCheckHashType:
3180ec2f5418SKevin Wolf#
3181ec2f5418SKevin Wolf# @md5              The given hash is an md5 hash
3182ec2f5418SKevin Wolf# @sha1             The given hash is an sha1 hash
3183ec2f5418SKevin Wolf#
3184ec2f5418SKevin Wolf# Since: 2.12
3185ec2f5418SKevin Wolf##
3186ec2f5418SKevin Wolf{ 'enum': 'SshHostKeyCheckHashType',
3187ec2f5418SKevin Wolf  'data': [ 'md5', 'sha1' ] }
3188ec2f5418SKevin Wolf
3189ec2f5418SKevin Wolf##
3190ec2f5418SKevin Wolf# @SshHostKeyHash:
3191ec2f5418SKevin Wolf#
3192ec2f5418SKevin Wolf# @type             The hash algorithm used for the hash
3193ec2f5418SKevin Wolf# @hash             The expected hash value
3194ec2f5418SKevin Wolf#
3195ec2f5418SKevin Wolf# Since: 2.12
3196ec2f5418SKevin Wolf##
3197ec2f5418SKevin Wolf{ 'struct': 'SshHostKeyHash',
3198ec2f5418SKevin Wolf  'data': { 'type': 'SshHostKeyCheckHashType',
3199ec2f5418SKevin Wolf            'hash': 'str' }}
3200ec2f5418SKevin Wolf
3201ec2f5418SKevin Wolf##
3202ec2f5418SKevin Wolf# @SshHostKeyCheck:
3203ec2f5418SKevin Wolf#
3204ec2f5418SKevin Wolf# Since: 2.12
3205ec2f5418SKevin Wolf##
3206ec2f5418SKevin Wolf{ 'union': 'SshHostKeyCheck',
3207ec2f5418SKevin Wolf  'base': { 'mode': 'SshHostKeyCheckMode' },
3208ec2f5418SKevin Wolf  'discriminator': 'mode',
320929cd0403SAnton Nefedov  'data': { 'hash': 'SshHostKeyHash' } }
3210ec2f5418SKevin Wolf
3211ec2f5418SKevin Wolf##
32125072f7b3SMarc-André Lureau# @BlockdevOptionsSsh:
3213ad0e90a6SAshijeet Acharya#
3214ad0e90a6SAshijeet Acharya# @server:              host address
3215ad0e90a6SAshijeet Acharya#
3216ad0e90a6SAshijeet Acharya# @path:                path to the image on the host
3217ad0e90a6SAshijeet Acharya#
32181d8bda12SMarkus Armbruster# @user:                user as which to connect, defaults to current
3219ad0e90a6SAshijeet Acharya#                       local user name
3220ad0e90a6SAshijeet Acharya#
3221ec2f5418SKevin Wolf# @host-key-check:      Defines how and what to check the host key against
3222ec2f5418SKevin Wolf#                       (default: known_hosts)
3223ad0e90a6SAshijeet Acharya#
322479b7a77eSMarkus Armbruster# Since: 2.9
3225ad0e90a6SAshijeet Acharya##
3226ad0e90a6SAshijeet Acharya{ 'struct': 'BlockdevOptionsSsh',
3227ad0e90a6SAshijeet Acharya  'data': { 'server': 'InetSocketAddress',
3228ad0e90a6SAshijeet Acharya            'path': 'str',
3229ec2f5418SKevin Wolf            '*user': 'str',
3230ec2f5418SKevin Wolf            '*host-key-check': 'SshHostKeyCheck' } }
3231ad0e90a6SAshijeet Acharya
3232b1de5f43SChrysostomos Nanakos
32331ad166b6SBenoît Canet##
32345072f7b3SMarc-André Lureau# @BlkdebugEvent:
32351ad166b6SBenoît Canet#
32361ad166b6SBenoît Canet# Trigger events supported by blkdebug.
3237a31939e6SEric Blake#
323846b732cdSPavel Butsykin# @l1_shrink_write_table:      write zeros to the l1 table to shrink image.
323946b732cdSPavel Butsykin#                              (since 2.11)
324046b732cdSPavel Butsykin#
324146b732cdSPavel Butsykin# @l1_shrink_free_l2_clusters: discard the l2 tables. (since 2.11)
324246b732cdSPavel Butsykin#
3243d855ebcdSEric Blake# @cor_write: a write due to copy-on-read (since 2.11)
3244d855ebcdSEric Blake#
3245c8bb23cbSAnton Nefedov# @cluster_alloc_space: an allocation of file space for a cluster (since 4.1)
3246c8bb23cbSAnton Nefedov#
324779b7a77eSMarkus Armbruster# Since: 2.9
32481ad166b6SBenoît Canet##
3249a31939e6SEric Blake{ 'enum': 'BlkdebugEvent', 'prefix': 'BLKDBG',
32505be5b776SEric Blake  'data': [ 'l1_update', 'l1_grow_alloc_table', 'l1_grow_write_table',
32515be5b776SEric Blake            'l1_grow_activate_table', 'l2_load', 'l2_update',
32525be5b776SEric Blake            'l2_update_compressed', 'l2_alloc_cow_read', 'l2_alloc_write',
32531ad166b6SBenoît Canet            'read_aio', 'read_backing_aio', 'read_compressed', 'write_aio',
32541ad166b6SBenoît Canet            'write_compressed', 'vmstate_load', 'vmstate_save', 'cow_read',
32551ad166b6SBenoît Canet            'cow_write', 'reftable_load', 'reftable_grow', 'reftable_update',
32561ad166b6SBenoît Canet            'refblock_load', 'refblock_update', 'refblock_update_part',
32575be5b776SEric Blake            'refblock_alloc', 'refblock_alloc_hookup', 'refblock_alloc_write',
32585be5b776SEric Blake            'refblock_alloc_write_blocks', 'refblock_alloc_write_table',
32595be5b776SEric Blake            'refblock_alloc_switch_table', 'cluster_alloc',
32601ad166b6SBenoît Canet            'cluster_alloc_bytes', 'cluster_free', 'flush_to_os',
32615be5b776SEric Blake            'flush_to_disk', 'pwritev_rmw_head', 'pwritev_rmw_after_head',
32625be5b776SEric Blake            'pwritev_rmw_tail', 'pwritev_rmw_after_tail', 'pwritev',
326346b732cdSPavel Butsykin            'pwritev_zero', 'pwritev_done', 'empty_image_prepare',
3264d855ebcdSEric Blake            'l1_shrink_write_table', 'l1_shrink_free_l2_clusters',
3265c8bb23cbSAnton Nefedov            'cor_write', 'cluster_alloc_space'] }
32661ad166b6SBenoît Canet
32671ad166b6SBenoît Canet##
32685072f7b3SMarc-André Lureau# @BlkdebugInjectErrorOptions:
32691ad166b6SBenoît Canet#
32701ad166b6SBenoît Canet# Describes a single error injection for blkdebug.
32711ad166b6SBenoît Canet#
32721ad166b6SBenoît Canet# @event:       trigger event
32731ad166b6SBenoît Canet#
32741d8bda12SMarkus Armbruster# @state:       the state identifier blkdebug needs to be in to
32751ad166b6SBenoît Canet#               actually trigger the event; defaults to "any"
32761ad166b6SBenoît Canet#
32771d8bda12SMarkus Armbruster# @errno:       error identifier (errno) to be returned; defaults to
32781ad166b6SBenoît Canet#               EIO
32791ad166b6SBenoît Canet#
32801d8bda12SMarkus Armbruster# @sector:      specifies the sector index which has to be affected
32811ad166b6SBenoît Canet#               in order to actually trigger the event; defaults to "any
32821ad166b6SBenoît Canet#               sector"
32831ad166b6SBenoît Canet#
32841d8bda12SMarkus Armbruster# @once:        disables further events after this one has been
32851ad166b6SBenoît Canet#               triggered; defaults to false
32861ad166b6SBenoît Canet#
32871d8bda12SMarkus Armbruster# @immediately: fail immediately; defaults to false
32881ad166b6SBenoît Canet#
328979b7a77eSMarkus Armbruster# Since: 2.9
32901ad166b6SBenoît Canet##
3291895a2a80SEric Blake{ 'struct': 'BlkdebugInjectErrorOptions',
32921ad166b6SBenoît Canet  'data': { 'event': 'BlkdebugEvent',
32931ad166b6SBenoît Canet            '*state': 'int',
32941ad166b6SBenoît Canet            '*errno': 'int',
32951ad166b6SBenoît Canet            '*sector': 'int',
32961ad166b6SBenoît Canet            '*once': 'bool',
32971ad166b6SBenoît Canet            '*immediately': 'bool' } }
32981ad166b6SBenoît Canet
32991ad166b6SBenoît Canet##
33005072f7b3SMarc-André Lureau# @BlkdebugSetStateOptions:
33011ad166b6SBenoît Canet#
33021ad166b6SBenoît Canet# Describes a single state-change event for blkdebug.
33031ad166b6SBenoît Canet#
33041ad166b6SBenoît Canet# @event:       trigger event
33051ad166b6SBenoît Canet#
33061d8bda12SMarkus Armbruster# @state:       the current state identifier blkdebug needs to be in;
33071ad166b6SBenoît Canet#               defaults to "any"
33081ad166b6SBenoît Canet#
33091ad166b6SBenoît Canet# @new_state:   the state identifier blkdebug is supposed to assume if
33101ad166b6SBenoît Canet#               this event is triggered
33111ad166b6SBenoît Canet#
331279b7a77eSMarkus Armbruster# Since: 2.9
33131ad166b6SBenoît Canet##
3314895a2a80SEric Blake{ 'struct': 'BlkdebugSetStateOptions',
33151ad166b6SBenoît Canet  'data': { 'event': 'BlkdebugEvent',
33161ad166b6SBenoît Canet            '*state': 'int',
33171ad166b6SBenoît Canet            'new_state': 'int' } }
33181ad166b6SBenoît Canet
33191ad166b6SBenoît Canet##
33205072f7b3SMarc-André Lureau# @BlockdevOptionsBlkdebug:
33211ad166b6SBenoît Canet#
33221ad166b6SBenoît Canet# Driver specific block device options for blkdebug.
33231ad166b6SBenoît Canet#
33241ad166b6SBenoît Canet# @image:           underlying raw block device (or image file)
33251ad166b6SBenoît Canet#
33261d8bda12SMarkus Armbruster# @config:          filename of the configuration file
33271ad166b6SBenoît Canet#
3328430b26a8SEric Blake# @align:           required alignment for requests in bytes, must be
3329430b26a8SEric Blake#                   positive power of 2, or 0 for default
3330430b26a8SEric Blake#
3331430b26a8SEric Blake# @max-transfer:    maximum size for I/O transfers in bytes, must be
3332430b26a8SEric Blake#                   positive multiple of @align and of the underlying
3333430b26a8SEric Blake#                   file's request alignment (but need not be a power of
3334430b26a8SEric Blake#                   2), or 0 for default (since 2.10)
3335430b26a8SEric Blake#
3336430b26a8SEric Blake# @opt-write-zero:  preferred alignment for write zero requests in bytes,
3337430b26a8SEric Blake#                   must be positive multiple of @align and of the
3338430b26a8SEric Blake#                   underlying file's request alignment (but need not be a
3339430b26a8SEric Blake#                   power of 2), or 0 for default (since 2.10)
3340430b26a8SEric Blake#
3341430b26a8SEric Blake# @max-write-zero:  maximum size for write zero requests in bytes, must be
3342430b26a8SEric Blake#                   positive multiple of @align, of @opt-write-zero, and of
3343430b26a8SEric Blake#                   the underlying file's request alignment (but need not
3344430b26a8SEric Blake#                   be a power of 2), or 0 for default (since 2.10)
3345430b26a8SEric Blake#
3346430b26a8SEric Blake# @opt-discard:     preferred alignment for discard requests in bytes, must
3347430b26a8SEric Blake#                   be positive multiple of @align and of the underlying
3348430b26a8SEric Blake#                   file's request alignment (but need not be a power of
3349430b26a8SEric Blake#                   2), or 0 for default (since 2.10)
3350430b26a8SEric Blake#
3351430b26a8SEric Blake# @max-discard:     maximum size for discard requests in bytes, must be
3352430b26a8SEric Blake#                   positive multiple of @align, of @opt-discard, and of
3353430b26a8SEric Blake#                   the underlying file's request alignment (but need not
3354430b26a8SEric Blake#                   be a power of 2), or 0 for default (since 2.10)
33551ad166b6SBenoît Canet#
33561d8bda12SMarkus Armbruster# @inject-error:    array of error injection descriptions
33571ad166b6SBenoît Canet#
33581d8bda12SMarkus Armbruster# @set-state:       array of state-change descriptions
33591ad166b6SBenoît Canet#
336079b7a77eSMarkus Armbruster# Since: 2.9
33611ad166b6SBenoît Canet##
3362895a2a80SEric Blake{ 'struct': 'BlockdevOptionsBlkdebug',
33631ad166b6SBenoît Canet  'data': { 'image': 'BlockdevRef',
33641ad166b6SBenoît Canet            '*config': 'str',
3365430b26a8SEric Blake            '*align': 'int', '*max-transfer': 'int32',
3366430b26a8SEric Blake            '*opt-write-zero': 'int32', '*max-write-zero': 'int32',
3367430b26a8SEric Blake            '*opt-discard': 'int32', '*max-discard': 'int32',
33681ad166b6SBenoît Canet            '*inject-error': ['BlkdebugInjectErrorOptions'],
33691ad166b6SBenoît Canet            '*set-state': ['BlkdebugSetStateOptions'] } }
33701ad166b6SBenoît Canet
33711ad166b6SBenoît Canet##
3372bfcc224eSAapo Vienamo# @BlockdevOptionsBlklogwrites:
3373bfcc224eSAapo Vienamo#
3374bfcc224eSAapo Vienamo# Driver specific block device options for blklogwrites.
3375bfcc224eSAapo Vienamo#
3376bfcc224eSAapo Vienamo# @file:            block device
3377bfcc224eSAapo Vienamo#
3378bfcc224eSAapo Vienamo# @log:             block device used to log writes to @file
3379bfcc224eSAapo Vienamo#
3380bfcc224eSAapo Vienamo# @log-sector-size: sector size used in logging writes to @file, determines
3381bfcc224eSAapo Vienamo#                   granularity of offsets and sizes of writes (default: 512)
3382bfcc224eSAapo Vienamo#
33837769eaa5SAri Sundholm# @log-append:      append to an existing log (default: false)
33847769eaa5SAri Sundholm#
33851dce698eSAri Sundholm# @log-super-update-interval: interval of write requests after which the log
33861dce698eSAri Sundholm#                             super block is updated to disk (default: 4096)
33871dce698eSAri Sundholm#
3388bfcc224eSAapo Vienamo# Since: 3.0
3389bfcc224eSAapo Vienamo##
3390bfcc224eSAapo Vienamo{ 'struct': 'BlockdevOptionsBlklogwrites',
3391bfcc224eSAapo Vienamo  'data': { 'file': 'BlockdevRef',
3392bfcc224eSAapo Vienamo            'log': 'BlockdevRef',
33930878b3c1SAri Sundholm            '*log-sector-size': 'uint32',
33941dce698eSAri Sundholm            '*log-append': 'bool',
33951dce698eSAri Sundholm            '*log-super-update-interval': 'uint64' } }
3396bfcc224eSAapo Vienamo
3397bfcc224eSAapo Vienamo##
33985072f7b3SMarc-André Lureau# @BlockdevOptionsBlkverify:
33991ad166b6SBenoît Canet#
34001ad166b6SBenoît Canet# Driver specific block device options for blkverify.
34011ad166b6SBenoît Canet#
34021ad166b6SBenoît Canet# @test:    block device to be tested
34031ad166b6SBenoît Canet#
34041ad166b6SBenoît Canet# @raw:     raw image used for verification
34051ad166b6SBenoît Canet#
340679b7a77eSMarkus Armbruster# Since: 2.9
34071ad166b6SBenoît Canet##
3408895a2a80SEric Blake{ 'struct': 'BlockdevOptionsBlkverify',
34091ad166b6SBenoît Canet  'data': { 'test': 'BlockdevRef',
34101ad166b6SBenoît Canet            'raw': 'BlockdevRef' } }
34111ad166b6SBenoît Canet
34121ad166b6SBenoît Canet##
34135072f7b3SMarc-André Lureau# @QuorumReadPattern:
341462c6031fSLiu Yuan#
341562c6031fSLiu Yuan# An enumeration of quorum read patterns.
341662c6031fSLiu Yuan#
341762c6031fSLiu Yuan# @quorum: read all the children and do a quorum vote on reads
341862c6031fSLiu Yuan#
341962c6031fSLiu Yuan# @fifo: read only from the first child that has not failed
342062c6031fSLiu Yuan#
342179b7a77eSMarkus Armbruster# Since: 2.9
342262c6031fSLiu Yuan##
342362c6031fSLiu Yuan{ 'enum': 'QuorumReadPattern', 'data': [ 'quorum', 'fifo' ] }
342462c6031fSLiu Yuan
342562c6031fSLiu Yuan##
34265072f7b3SMarc-André Lureau# @BlockdevOptionsQuorum:
34271ad166b6SBenoît Canet#
34281ad166b6SBenoît Canet# Driver specific block device options for Quorum
34291ad166b6SBenoît Canet#
34301d8bda12SMarkus Armbruster# @blkverify:      true if the driver must print content mismatch
34311ad166b6SBenoît Canet#                  set to false by default
34321ad166b6SBenoît Canet#
34331ad166b6SBenoît Canet# @children:       the children block devices to use
34341ad166b6SBenoît Canet#
34351ad166b6SBenoît Canet# @vote-threshold: the vote limit under which a read will fail
34361ad166b6SBenoît Canet#
34371d8bda12SMarkus Armbruster# @rewrite-corrupted: rewrite corrupted data when quorum is reached
3438cf29a570SBenoît Canet#                     (Since 2.1)
3439cf29a570SBenoît Canet#
34401d8bda12SMarkus Armbruster# @read-pattern: choose read pattern and set to quorum by default
344162c6031fSLiu Yuan#                (Since 2.2)
344262c6031fSLiu Yuan#
344379b7a77eSMarkus Armbruster# Since: 2.9
34441ad166b6SBenoît Canet##
3445895a2a80SEric Blake{ 'struct': 'BlockdevOptionsQuorum',
34461ad166b6SBenoît Canet  'data': { '*blkverify': 'bool',
34471ad166b6SBenoît Canet            'children': [ 'BlockdevRef' ],
344862c6031fSLiu Yuan            'vote-threshold': 'int',
344962c6031fSLiu Yuan            '*rewrite-corrupted': 'bool',
345062c6031fSLiu Yuan            '*read-pattern': 'QuorumReadPattern' } }
34511ad166b6SBenoît Canet
34521ad166b6SBenoît Canet##
34535072f7b3SMarc-André Lureau# @BlockdevOptionsGluster:
34547edac2ddSPrasanna Kumar Kalever#
34557edac2ddSPrasanna Kumar Kalever# Driver specific block device options for Gluster
34567edac2ddSPrasanna Kumar Kalever#
34577edac2ddSPrasanna Kumar Kalever# @volume:      name of gluster volume where VM image resides
34587edac2ddSPrasanna Kumar Kalever#
34597edac2ddSPrasanna Kumar Kalever# @path:        absolute path to image file in gluster volume
34607edac2ddSPrasanna Kumar Kalever#
34610a189ffbSPrasanna Kumar Kalever# @server:      gluster servers description
34627edac2ddSPrasanna Kumar Kalever#
34631d8bda12SMarkus Armbruster# @debug:       libgfapi log level (default '4' which is Error)
34644230e5d1SEric Blake#               (Since 2.8)
34657edac2ddSPrasanna Kumar Kalever#
34661d8bda12SMarkus Armbruster# @logfile:     libgfapi log file (default /dev/stderr) (Since 2.8)
3467e9db8ff3SPrasanna Kumar Kalever#
346879b7a77eSMarkus Armbruster# Since: 2.9
34697edac2ddSPrasanna Kumar Kalever##
34707edac2ddSPrasanna Kumar Kalever{ 'struct': 'BlockdevOptionsGluster',
34717edac2ddSPrasanna Kumar Kalever  'data': { 'volume': 'str',
34727edac2ddSPrasanna Kumar Kalever            'path': 'str',
347362cf396bSMarkus Armbruster            'server': ['SocketAddress'],
34741a417e46SPrasanna Kumar Kalever            '*debug': 'int',
3475e9db8ff3SPrasanna Kumar Kalever            '*logfile': 'str' } }
34767edac2ddSPrasanna Kumar Kalever
34777edac2ddSPrasanna Kumar Kalever##
347831eb1202SKevin Wolf# @IscsiTransport:
347931eb1202SKevin Wolf#
348031eb1202SKevin Wolf# An enumeration of libiscsi transport types
348131eb1202SKevin Wolf#
348231eb1202SKevin Wolf# Since: 2.9
348331eb1202SKevin Wolf##
348431eb1202SKevin Wolf{ 'enum': 'IscsiTransport',
348531eb1202SKevin Wolf  'data': [ 'tcp', 'iser' ] }
348631eb1202SKevin Wolf
348731eb1202SKevin Wolf##
348831eb1202SKevin Wolf# @IscsiHeaderDigest:
348931eb1202SKevin Wolf#
349031eb1202SKevin Wolf# An enumeration of header digests supported by libiscsi
349131eb1202SKevin Wolf#
349231eb1202SKevin Wolf# Since: 2.9
349331eb1202SKevin Wolf##
349431eb1202SKevin Wolf{ 'enum': 'IscsiHeaderDigest',
349531eb1202SKevin Wolf  'prefix': 'QAPI_ISCSI_HEADER_DIGEST',
349631eb1202SKevin Wolf  'data': [ 'crc32c', 'none', 'crc32c-none', 'none-crc32c' ] }
349731eb1202SKevin Wolf
349831eb1202SKevin Wolf##
349931eb1202SKevin Wolf# @BlockdevOptionsIscsi:
350031eb1202SKevin Wolf#
350151654aa5SJeff Cody# @transport:       The iscsi transport type
350231eb1202SKevin Wolf#
350351654aa5SJeff Cody# @portal:          The address of the iscsi portal
350431eb1202SKevin Wolf#
350551654aa5SJeff Cody# @target:          The target iqn name
350631eb1202SKevin Wolf#
35071d8bda12SMarkus Armbruster# @lun:             LUN to connect to. Defaults to 0.
350831eb1202SKevin Wolf#
35091d8bda12SMarkus Armbruster# @user:            User name to log in with. If omitted, no CHAP
351031eb1202SKevin Wolf#                   authentication is performed.
351131eb1202SKevin Wolf#
35121d8bda12SMarkus Armbruster# @password-secret: The ID of a QCryptoSecret object providing
351331eb1202SKevin Wolf#                   the password for the login. This option is required if
351431eb1202SKevin Wolf#                   @user is specified.
351531eb1202SKevin Wolf#
35161d8bda12SMarkus Armbruster# @initiator-name:  The iqn name we want to identify to the target
351731eb1202SKevin Wolf#                   as. If this option is not specified, an initiator name is
351831eb1202SKevin Wolf#                   generated automatically.
351931eb1202SKevin Wolf#
35201d8bda12SMarkus Armbruster# @header-digest:   The desired header digest. Defaults to
352131eb1202SKevin Wolf#                   none-crc32c.
352231eb1202SKevin Wolf#
35231d8bda12SMarkus Armbruster# @timeout:         Timeout in seconds after which a request will
352431eb1202SKevin Wolf#                   timeout. 0 means no timeout and is the default.
352531eb1202SKevin Wolf#
352631eb1202SKevin Wolf# Driver specific block device options for iscsi
352731eb1202SKevin Wolf#
352831eb1202SKevin Wolf# Since: 2.9
352931eb1202SKevin Wolf##
353031eb1202SKevin Wolf{ 'struct': 'BlockdevOptionsIscsi',
353131eb1202SKevin Wolf  'data': { 'transport': 'IscsiTransport',
353231eb1202SKevin Wolf            'portal': 'str',
353331eb1202SKevin Wolf            'target': 'str',
353431eb1202SKevin Wolf            '*lun': 'int',
353531eb1202SKevin Wolf            '*user': 'str',
353631eb1202SKevin Wolf            '*password-secret': 'str',
353731eb1202SKevin Wolf            '*initiator-name': 'str',
353831eb1202SKevin Wolf            '*header-digest': 'IscsiHeaderDigest',
353931eb1202SKevin Wolf            '*timeout': 'int' } }
354031eb1202SKevin Wolf
35410a55679bSJeff Cody
35420a55679bSJeff Cody##
3543a3699de4SMarkus Armbruster# @RbdAuthMode:
3544a3699de4SMarkus Armbruster#
3545a3699de4SMarkus Armbruster# Since: 3.0
3546a3699de4SMarkus Armbruster##
3547a3699de4SMarkus Armbruster{ 'enum': 'RbdAuthMode',
3548a3699de4SMarkus Armbruster  'data': [ 'cephx', 'none' ] }
3549a3699de4SMarkus Armbruster
3550a3699de4SMarkus Armbruster##
35518a47e8ebSJeff Cody# @BlockdevOptionsRbd:
35528a47e8ebSJeff Cody#
35538a47e8ebSJeff Cody# @pool:               Ceph pool name.
35548a47e8ebSJeff Cody#
35558a47e8ebSJeff Cody# @image:              Image name in the Ceph pool.
35568a47e8ebSJeff Cody#
35571d8bda12SMarkus Armbruster# @conf:               path to Ceph configuration file.  Values
35588a47e8ebSJeff Cody#                      in the configuration file will be overridden by
35598a47e8ebSJeff Cody#                      options specified via QAPI.
35608a47e8ebSJeff Cody#
35611d8bda12SMarkus Armbruster# @snapshot:           Ceph snapshot name.
35628a47e8ebSJeff Cody#
35631d8bda12SMarkus Armbruster# @user:               Ceph id name.
35648a47e8ebSJeff Cody#
3565a3699de4SMarkus Armbruster# @auth-client-required: Acceptable authentication modes.
3566a3699de4SMarkus Armbruster#                      This maps to Ceph configuration option
3567a3699de4SMarkus Armbruster#                      "auth_client_required".  (Since 3.0)
3568a3699de4SMarkus Armbruster#
3569d083f954SMarkus Armbruster# @key-secret:         ID of a QCryptoSecret object providing a key
3570d083f954SMarkus Armbruster#                      for cephx authentication.
3571d083f954SMarkus Armbruster#                      This maps to Ceph configuration option
3572d083f954SMarkus Armbruster#                      "key".  (Since 3.0)
3573d083f954SMarkus Armbruster#
35741d8bda12SMarkus Armbruster# @server:             Monitor host address and port.  This maps
35750a55679bSJeff Cody#                      to the "mon_host" Ceph option.
35760a55679bSJeff Cody#
35778a47e8ebSJeff Cody# Since: 2.9
35788a47e8ebSJeff Cody##
35798a47e8ebSJeff Cody{ 'struct': 'BlockdevOptionsRbd',
35808a47e8ebSJeff Cody  'data': { 'pool': 'str',
35818a47e8ebSJeff Cody            'image': 'str',
35828a47e8ebSJeff Cody            '*conf': 'str',
35838a47e8ebSJeff Cody            '*snapshot': 'str',
35848a47e8ebSJeff Cody            '*user': 'str',
3585a3699de4SMarkus Armbruster            '*auth-client-required': ['RbdAuthMode'],
3586d083f954SMarkus Armbruster            '*key-secret': 'str',
3587577d8c9aSMarkus Armbruster            '*server': ['InetSocketAddressBase'] } }
35888a47e8ebSJeff Cody
358931eb1202SKevin Wolf##
3590d282f34eSMarkus Armbruster# @BlockdevOptionsSheepdog:
3591d282f34eSMarkus Armbruster#
3592d282f34eSMarkus Armbruster# Driver specific block device options for sheepdog
3593d282f34eSMarkus Armbruster#
3594d282f34eSMarkus Armbruster# @vdi:         Virtual disk image name
3595d1c13688SMarkus Armbruster# @server:      The Sheepdog server to connect to
3596d282f34eSMarkus Armbruster# @snap-id:     Snapshot ID
3597d282f34eSMarkus Armbruster# @tag:         Snapshot tag name
3598d282f34eSMarkus Armbruster#
3599d282f34eSMarkus Armbruster# Only one of @snap-id and @tag may be present.
3600d282f34eSMarkus Armbruster#
3601d282f34eSMarkus Armbruster# Since: 2.9
3602d282f34eSMarkus Armbruster##
3603d282f34eSMarkus Armbruster{ 'struct': 'BlockdevOptionsSheepdog',
360462cf396bSMarkus Armbruster  'data': { 'server': 'SocketAddress',
3605d282f34eSMarkus Armbruster            'vdi': 'str',
3606d282f34eSMarkus Armbruster            '*snap-id': 'uint32',
3607d282f34eSMarkus Armbruster            '*tag': 'str' } }
3608d282f34eSMarkus Armbruster
3609d282f34eSMarkus Armbruster##
36105072f7b3SMarc-André Lureau# @ReplicationMode:
3611190b9a8bSChanglong Xie#
3612190b9a8bSChanglong Xie# An enumeration of replication modes.
3613190b9a8bSChanglong Xie#
3614190b9a8bSChanglong Xie# @primary: Primary mode, the vm's state will be sent to secondary QEMU.
3615190b9a8bSChanglong Xie#
3616190b9a8bSChanglong Xie# @secondary: Secondary mode, receive the vm's state from primary QEMU.
3617190b9a8bSChanglong Xie#
361879b7a77eSMarkus Armbruster# Since: 2.9
3619190b9a8bSChanglong Xie##
3620335d10cdSMarc-André Lureau{ 'enum' : 'ReplicationMode', 'data' : [ 'primary', 'secondary' ],
3621335d10cdSMarc-André Lureau  'if': 'defined(CONFIG_REPLICATION)' }
3622190b9a8bSChanglong Xie
3623190b9a8bSChanglong Xie##
36245072f7b3SMarc-André Lureau# @BlockdevOptionsReplication:
362582ac5543SWen Congyang#
362682ac5543SWen Congyang# Driver specific block device options for replication
362782ac5543SWen Congyang#
362882ac5543SWen Congyang# @mode: the replication mode
362982ac5543SWen Congyang#
36301d8bda12SMarkus Armbruster# @top-id: In secondary mode, node name or device ID of the root
3631f4f2539bSChanglong Xie#          node who owns the replication node chain. Must not be given in
3632f4f2539bSChanglong Xie#          primary mode.
363382ac5543SWen Congyang#
363479b7a77eSMarkus Armbruster# Since: 2.9
363582ac5543SWen Congyang##
363682ac5543SWen Congyang{ 'struct': 'BlockdevOptionsReplication',
363782ac5543SWen Congyang  'base': 'BlockdevOptionsGenericFormat',
363882ac5543SWen Congyang  'data': { 'mode': 'ReplicationMode',
3639335d10cdSMarc-André Lureau            '*top-id': 'str' },
3640335d10cdSMarc-André Lureau  'if': 'defined(CONFIG_REPLICATION)' }
364182ac5543SWen Congyang
364282ac5543SWen Congyang##
36435072f7b3SMarc-André Lureau# @NFSTransport:
3644aa2623d8SAshijeet Acharya#
3645aa2623d8SAshijeet Acharya# An enumeration of NFS transport types
3646aa2623d8SAshijeet Acharya#
3647aa2623d8SAshijeet Acharya# @inet:        TCP transport
3648aa2623d8SAshijeet Acharya#
364979b7a77eSMarkus Armbruster# Since: 2.9
3650aa2623d8SAshijeet Acharya##
3651aa2623d8SAshijeet Acharya{ 'enum': 'NFSTransport',
3652aa2623d8SAshijeet Acharya  'data': [ 'inet' ] }
3653aa2623d8SAshijeet Acharya
3654aa2623d8SAshijeet Acharya##
36555072f7b3SMarc-André Lureau# @NFSServer:
3656aa2623d8SAshijeet Acharya#
3657aa2623d8SAshijeet Acharya# Captures the address of the socket
3658aa2623d8SAshijeet Acharya#
3659aa2623d8SAshijeet Acharya# @type:        transport type used for NFS (only TCP supported)
3660aa2623d8SAshijeet Acharya#
3661aa2623d8SAshijeet Acharya# @host:        host address for NFS server
3662aa2623d8SAshijeet Acharya#
366379b7a77eSMarkus Armbruster# Since: 2.9
3664aa2623d8SAshijeet Acharya##
3665aa2623d8SAshijeet Acharya{ 'struct': 'NFSServer',
3666aa2623d8SAshijeet Acharya  'data': { 'type': 'NFSTransport',
3667aa2623d8SAshijeet Acharya            'host': 'str' } }
3668aa2623d8SAshijeet Acharya
3669aa2623d8SAshijeet Acharya##
36705072f7b3SMarc-André Lureau# @BlockdevOptionsNfs:
3671aa2623d8SAshijeet Acharya#
3672aa2623d8SAshijeet Acharya# Driver specific block device option for NFS
3673aa2623d8SAshijeet Acharya#
3674aa2623d8SAshijeet Acharya# @server:                  host address
3675aa2623d8SAshijeet Acharya#
3676aa2623d8SAshijeet Acharya# @path:                    path of the image on the host
3677aa2623d8SAshijeet Acharya#
36781d8bda12SMarkus Armbruster# @user:                    UID value to use when talking to the
3679aa2623d8SAshijeet Acharya#                           server (defaults to 65534 on Windows and getuid()
3680aa2623d8SAshijeet Acharya#                           on unix)
3681aa2623d8SAshijeet Acharya#
36821d8bda12SMarkus Armbruster# @group:                   GID value to use when talking to the
3683aa2623d8SAshijeet Acharya#                           server (defaults to 65534 on Windows and getgid()
3684aa2623d8SAshijeet Acharya#                           in unix)
3685aa2623d8SAshijeet Acharya#
36861d8bda12SMarkus Armbruster# @tcp-syn-count:           number of SYNs during the session
3687aa2623d8SAshijeet Acharya#                           establishment (defaults to libnfs default)
3688aa2623d8SAshijeet Acharya#
36891d8bda12SMarkus Armbruster# @readahead-size:          set the readahead size in bytes (defaults
3690aa2623d8SAshijeet Acharya#                           to libnfs default)
3691aa2623d8SAshijeet Acharya#
36921d8bda12SMarkus Armbruster# @page-cache-size:         set the pagecache size in bytes (defaults
3693aa2623d8SAshijeet Acharya#                           to libnfs default)
3694aa2623d8SAshijeet Acharya#
36951d8bda12SMarkus Armbruster# @debug:                   set the NFS debug level (max 2) (defaults
3696aa2623d8SAshijeet Acharya#                           to libnfs default)
3697aa2623d8SAshijeet Acharya#
369879b7a77eSMarkus Armbruster# Since: 2.9
3699aa2623d8SAshijeet Acharya##
3700aa2623d8SAshijeet Acharya{ 'struct': 'BlockdevOptionsNfs',
3701aa2623d8SAshijeet Acharya  'data': { 'server': 'NFSServer',
3702aa2623d8SAshijeet Acharya            'path': 'str',
3703aa2623d8SAshijeet Acharya            '*user': 'int',
3704aa2623d8SAshijeet Acharya            '*group': 'int',
3705aa2623d8SAshijeet Acharya            '*tcp-syn-count': 'int',
3706aa2623d8SAshijeet Acharya            '*readahead-size': 'int',
3707aa2623d8SAshijeet Acharya            '*page-cache-size': 'int',
37087103d916SPrasanna Kumar Kalever            '*debug': 'int' } }
3709aa2623d8SAshijeet Acharya
3710aa2623d8SAshijeet Acharya##
37116b9d62dbSMax Reitz# @BlockdevOptionsCurlBase:
371268555285SKevin Wolf#
37136b9d62dbSMax Reitz# Driver specific block device options shared by all protocols supported by the
37146b9d62dbSMax Reitz# curl backend.
371568555285SKevin Wolf#
37166b9d62dbSMax Reitz# @url:                     URL of the image file
37176b9d62dbSMax Reitz#
37186b9d62dbSMax Reitz# @readahead:               Size of the read-ahead cache; must be a multiple of
37196b9d62dbSMax Reitz#                           512 (defaults to 256 kB)
37206b9d62dbSMax Reitz#
37216b9d62dbSMax Reitz# @timeout:                 Timeout for connections, in seconds (defaults to 5)
37226b9d62dbSMax Reitz#
37236b9d62dbSMax Reitz# @username:                Username for authentication (defaults to none)
37246b9d62dbSMax Reitz#
37256b9d62dbSMax Reitz# @password-secret:         ID of a QCryptoSecret object providing a password
37266b9d62dbSMax Reitz#                           for authentication (defaults to no password)
37276b9d62dbSMax Reitz#
37286b9d62dbSMax Reitz# @proxy-username:          Username for proxy authentication (defaults to none)
37296b9d62dbSMax Reitz#
37306b9d62dbSMax Reitz# @proxy-password-secret:   ID of a QCryptoSecret object providing a password
37316b9d62dbSMax Reitz#                           for proxy authentication (defaults to no password)
373268555285SKevin Wolf#
373379b7a77eSMarkus Armbruster# Since: 2.9
373468555285SKevin Wolf##
37356b9d62dbSMax Reitz{ 'struct': 'BlockdevOptionsCurlBase',
37366b9d62dbSMax Reitz  'data': { 'url': 'str',
37376b9d62dbSMax Reitz            '*readahead': 'int',
37386b9d62dbSMax Reitz            '*timeout': 'int',
37396b9d62dbSMax Reitz            '*username': 'str',
37406b9d62dbSMax Reitz            '*password-secret': 'str',
37416b9d62dbSMax Reitz            '*proxy-username': 'str',
37426b9d62dbSMax Reitz            '*proxy-password-secret': 'str' } }
37436b9d62dbSMax Reitz
37446b9d62dbSMax Reitz##
37456b9d62dbSMax Reitz# @BlockdevOptionsCurlHttp:
37466b9d62dbSMax Reitz#
37476b9d62dbSMax Reitz# Driver specific block device options for HTTP connections over the curl
37486b9d62dbSMax Reitz# backend.  URLs must start with "http://".
37496b9d62dbSMax Reitz#
37506b9d62dbSMax Reitz# @cookie:      List of cookies to set; format is
37516b9d62dbSMax Reitz#               "name1=content1; name2=content2;" as explained by
37526b9d62dbSMax Reitz#               CURLOPT_COOKIE(3). Defaults to no cookies.
37536b9d62dbSMax Reitz#
3754327c8ebdSPeter Krempa# @cookie-secret: ID of a QCryptoSecret object providing the cookie data in a
3755327c8ebdSPeter Krempa#                 secure way. See @cookie for the format. (since 2.10)
3756327c8ebdSPeter Krempa#
37576b9d62dbSMax Reitz# Since: 2.9
37586b9d62dbSMax Reitz##
37596b9d62dbSMax Reitz{ 'struct': 'BlockdevOptionsCurlHttp',
37606b9d62dbSMax Reitz  'base': 'BlockdevOptionsCurlBase',
3761327c8ebdSPeter Krempa  'data': { '*cookie': 'str',
3762327c8ebdSPeter Krempa            '*cookie-secret': 'str'} }
37636b9d62dbSMax Reitz
37646b9d62dbSMax Reitz##
37656b9d62dbSMax Reitz# @BlockdevOptionsCurlHttps:
37666b9d62dbSMax Reitz#
37676b9d62dbSMax Reitz# Driver specific block device options for HTTPS connections over the curl
37686b9d62dbSMax Reitz# backend.  URLs must start with "https://".
37696b9d62dbSMax Reitz#
37706b9d62dbSMax Reitz# @cookie:      List of cookies to set; format is
37716b9d62dbSMax Reitz#               "name1=content1; name2=content2;" as explained by
37726b9d62dbSMax Reitz#               CURLOPT_COOKIE(3). Defaults to no cookies.
37736b9d62dbSMax Reitz#
37746b9d62dbSMax Reitz# @sslverify:   Whether to verify the SSL certificate's validity (defaults to
37756b9d62dbSMax Reitz#               true)
37766b9d62dbSMax Reitz#
3777327c8ebdSPeter Krempa# @cookie-secret: ID of a QCryptoSecret object providing the cookie data in a
3778327c8ebdSPeter Krempa#                 secure way. See @cookie for the format. (since 2.10)
3779327c8ebdSPeter Krempa#
37806b9d62dbSMax Reitz# Since: 2.9
37816b9d62dbSMax Reitz##
37826b9d62dbSMax Reitz{ 'struct': 'BlockdevOptionsCurlHttps',
37836b9d62dbSMax Reitz  'base': 'BlockdevOptionsCurlBase',
37846b9d62dbSMax Reitz  'data': { '*cookie': 'str',
3785327c8ebdSPeter Krempa            '*sslverify': 'bool',
3786327c8ebdSPeter Krempa            '*cookie-secret': 'str'} }
37876b9d62dbSMax Reitz
37886b9d62dbSMax Reitz##
37896b9d62dbSMax Reitz# @BlockdevOptionsCurlFtp:
37906b9d62dbSMax Reitz#
37916b9d62dbSMax Reitz# Driver specific block device options for FTP connections over the curl
37926b9d62dbSMax Reitz# backend.  URLs must start with "ftp://".
37936b9d62dbSMax Reitz#
37946b9d62dbSMax Reitz# Since: 2.9
37956b9d62dbSMax Reitz##
37966b9d62dbSMax Reitz{ 'struct': 'BlockdevOptionsCurlFtp',
37976b9d62dbSMax Reitz  'base': 'BlockdevOptionsCurlBase',
37986b9d62dbSMax Reitz  'data': { } }
37996b9d62dbSMax Reitz
38006b9d62dbSMax Reitz##
38016b9d62dbSMax Reitz# @BlockdevOptionsCurlFtps:
38026b9d62dbSMax Reitz#
38036b9d62dbSMax Reitz# Driver specific block device options for FTPS connections over the curl
38046b9d62dbSMax Reitz# backend.  URLs must start with "ftps://".
38056b9d62dbSMax Reitz#
38066b9d62dbSMax Reitz# @sslverify:   Whether to verify the SSL certificate's validity (defaults to
38076b9d62dbSMax Reitz#               true)
38086b9d62dbSMax Reitz#
38096b9d62dbSMax Reitz# Since: 2.9
38106b9d62dbSMax Reitz##
38116b9d62dbSMax Reitz{ 'struct': 'BlockdevOptionsCurlFtps',
38126b9d62dbSMax Reitz  'base': 'BlockdevOptionsCurlBase',
38136b9d62dbSMax Reitz  'data': { '*sslverify': 'bool' } }
381468555285SKevin Wolf
381568555285SKevin Wolf##
38165072f7b3SMarc-André Lureau# @BlockdevOptionsNbd:
38176b02b1f0SMax Reitz#
38186b02b1f0SMax Reitz# Driver specific block device options for NBD.
38196b02b1f0SMax Reitz#
38206b02b1f0SMax Reitz# @server:      NBD server address
38216b02b1f0SMax Reitz#
38221d8bda12SMarkus Armbruster# @export:      export name
38236b02b1f0SMax Reitz#
38241d8bda12SMarkus Armbruster# @tls-creds:   TLS credentials ID
38256b02b1f0SMax Reitz#
3826216ee365SEric Blake# @x-dirty-bitmap: A "qemu:dirty-bitmap:NAME" string to query in place of
3827216ee365SEric Blake#                  traditional "base:allocation" block status (see
3828216ee365SEric Blake#                  NBD_OPT_LIST_META_CONTEXT in the NBD protocol) (since 3.0)
3829216ee365SEric Blake#
383079b7a77eSMarkus Armbruster# Since: 2.9
38316b02b1f0SMax Reitz##
38326b02b1f0SMax Reitz{ 'struct': 'BlockdevOptionsNbd',
383362cf396bSMarkus Armbruster  'data': { 'server': 'SocketAddress',
38346b02b1f0SMax Reitz            '*export': 'str',
3835216ee365SEric Blake            '*tls-creds': 'str',
3836216ee365SEric Blake            '*x-dirty-bitmap': 'str' } }
38376b02b1f0SMax Reitz
38386b02b1f0SMax Reitz##
38395072f7b3SMarc-André Lureau# @BlockdevOptionsRaw:
38402fdc7045STomáš Golembiovský#
38412fdc7045STomáš Golembiovský# Driver specific block device options for the raw driver.
38422fdc7045STomáš Golembiovský#
38431d8bda12SMarkus Armbruster# @offset:      position where the block device starts
38441d8bda12SMarkus Armbruster# @size:        the assumed size of the device
38452fdc7045STomáš Golembiovský#
384679b7a77eSMarkus Armbruster# Since: 2.9
38472fdc7045STomáš Golembiovský##
38482fdc7045STomáš Golembiovský{ 'struct': 'BlockdevOptionsRaw',
38492fdc7045STomáš Golembiovský  'base': 'BlockdevOptionsGenericFormat',
38502fdc7045STomáš Golembiovský  'data': { '*offset': 'int', '*size': 'int' } }
38512fdc7045STomáš Golembiovský
38522fdc7045STomáš Golembiovský##
3853da92c3ffSAshish Mittal# @BlockdevOptionsVxHS:
3854da92c3ffSAshish Mittal#
3855da92c3ffSAshish Mittal# Driver specific block device options for VxHS
3856da92c3ffSAshish Mittal#
3857da92c3ffSAshish Mittal# @vdisk-id:    UUID of VxHS volume
3858da92c3ffSAshish Mittal# @server:      vxhs server IP, port
3859da92c3ffSAshish Mittal# @tls-creds:   TLS credentials ID
3860da92c3ffSAshish Mittal#
3861da92c3ffSAshish Mittal# Since: 2.10
3862da92c3ffSAshish Mittal##
3863da92c3ffSAshish Mittal{ 'struct': 'BlockdevOptionsVxHS',
3864da92c3ffSAshish Mittal  'data': { 'vdisk-id': 'str',
3865da92c3ffSAshish Mittal            'server': 'InetSocketAddressBase',
3866da92c3ffSAshish Mittal            '*tls-creds': 'str' } }
3867da92c3ffSAshish Mittal
3868da92c3ffSAshish Mittal##
3869d8e7d87eSManos Pitsidianakis# @BlockdevOptionsThrottle:
3870d8e7d87eSManos Pitsidianakis#
3871d8e7d87eSManos Pitsidianakis# Driver specific block device options for the throttle driver
3872d8e7d87eSManos Pitsidianakis#
3873d8e7d87eSManos Pitsidianakis# @throttle-group:   the name of the throttle-group object to use. It
3874d8e7d87eSManos Pitsidianakis#                    must already exist.
3875d8e7d87eSManos Pitsidianakis# @file:             reference to or definition of the data source block device
3876d8e7d87eSManos Pitsidianakis# Since: 2.11
3877d8e7d87eSManos Pitsidianakis##
3878d8e7d87eSManos Pitsidianakis{ 'struct': 'BlockdevOptionsThrottle',
3879d8e7d87eSManos Pitsidianakis  'data': { 'throttle-group': 'str',
3880d8e7d87eSManos Pitsidianakis            'file' : 'BlockdevRef'
3881d8e7d87eSManos Pitsidianakis             } }
3882d8e7d87eSManos Pitsidianakis##
38835072f7b3SMarc-André Lureau# @BlockdevOptions:
38841ad166b6SBenoît Canet#
38853666a97fSEric Blake# Options for creating a block device.  Many options are available for all
38863666a97fSEric Blake# block devices, independent of the block driver:
38873666a97fSEric Blake#
38883666a97fSEric Blake# @driver:        block driver name
38891d8bda12SMarkus Armbruster# @node-name:     the node name of the new node (Since 2.0).
38909ec8873eSKevin Wolf#                 This option is required on the top level of blockdev-add.
3891dbfdf6cbSKevin Wolf#                 Valid node names start with an alphabetic character and may
3892dbfdf6cbSKevin Wolf#                 contain only alphanumeric characters, '-', '.' and '_'. Their
3893dbfdf6cbSKevin Wolf#                 maximum length is 31 characters.
38941d8bda12SMarkus Armbruster# @discard:       discard-related options (default: ignore)
38951d8bda12SMarkus Armbruster# @cache:         cache-related options
3896398e6ad0SKevin Wolf# @read-only:     whether the block device should be read-only (default: false).
3897398e6ad0SKevin Wolf#                 Note that some block drivers support only read-only access,
3898398e6ad0SKevin Wolf#                 either generally or in certain configurations. In this case,
3899398e6ad0SKevin Wolf#                 the default value does not work and the option must be
3900398e6ad0SKevin Wolf#                 specified explicitly.
3901e35bdc12SKevin Wolf# @auto-read-only: if true and @read-only is false, QEMU may automatically
3902e35bdc12SKevin Wolf#                  decide not to open the image read-write as requested, but
3903e35bdc12SKevin Wolf#                  fall back to read-only instead (and switch between the modes
3904e35bdc12SKevin Wolf#                  later), e.g. depending on whether the image file is writable
3905e35bdc12SKevin Wolf#                  or whether a writing user is attached to the node
3906e35bdc12SKevin Wolf#                  (default: false, since 3.1)
39071d8bda12SMarkus Armbruster# @detect-zeroes: detect and optimize zero writes (Since 2.1)
39083666a97fSEric Blake#                 (default: off)
39095a9347c6SFam Zheng# @force-share:   force share all permission on added nodes.
39105a9347c6SFam Zheng#                 Requires read-only=true. (Since 2.10)
39113666a97fSEric Blake#
39123666a97fSEric Blake# Remaining options are determined by the block driver.
39131ad166b6SBenoît Canet#
391479b7a77eSMarkus Armbruster# Since: 2.9
39151ad166b6SBenoît Canet##
39161ad166b6SBenoît Canet{ 'union': 'BlockdevOptions',
39173666a97fSEric Blake  'base': { 'driver': 'BlockdevDriver',
39183666a97fSEric Blake            '*node-name': 'str',
39193666a97fSEric Blake            '*discard': 'BlockdevDiscardOptions',
39203666a97fSEric Blake            '*cache': 'BlockdevCacheOptions',
39213666a97fSEric Blake            '*read-only': 'bool',
3922e35bdc12SKevin Wolf            '*auto-read-only': 'bool',
39235a9347c6SFam Zheng            '*force-share': 'bool',
39243666a97fSEric Blake            '*detect-zeroes': 'BlockdevDetectZeroesOptions' },
39251ad166b6SBenoît Canet  'discriminator': 'driver',
39261ad166b6SBenoît Canet  'data': {
39271ad166b6SBenoît Canet      'blkdebug':   'BlockdevOptionsBlkdebug',
3928bfcc224eSAapo Vienamo      'blklogwrites':'BlockdevOptionsBlklogwrites',
39291ad166b6SBenoît Canet      'blkverify':  'BlockdevOptionsBlkverify',
39301ad166b6SBenoît Canet      'bochs':      'BlockdevOptionsGenericFormat',
39311ad166b6SBenoît Canet      'cloop':      'BlockdevOptionsGenericFormat',
39326c6f24fdSMax Reitz      'copy-on-read':'BlockdevOptionsGenericFormat',
39331ad166b6SBenoît Canet      'dmg':        'BlockdevOptionsGenericFormat',
3934db866be9SFam Zheng      'file':       'BlockdevOptionsFile',
39356b9d62dbSMax Reitz      'ftp':        'BlockdevOptionsCurlFtp',
39366b9d62dbSMax Reitz      'ftps':       'BlockdevOptionsCurlFtps',
39377edac2ddSPrasanna Kumar Kalever      'gluster':    'BlockdevOptionsGluster',
3938db866be9SFam Zheng      'host_cdrom': 'BlockdevOptionsFile',
3939db866be9SFam Zheng      'host_device':'BlockdevOptionsFile',
39406b9d62dbSMax Reitz      'http':       'BlockdevOptionsCurlHttp',
39416b9d62dbSMax Reitz      'https':      'BlockdevOptionsCurlHttps',
394231eb1202SKevin Wolf      'iscsi':      'BlockdevOptionsIscsi',
394378368575SDaniel P. Berrange      'luks':       'BlockdevOptionsLUKS',
39446b02b1f0SMax Reitz      'nbd':        'BlockdevOptionsNbd',
3945aa2623d8SAshijeet Acharya      'nfs':        'BlockdevOptionsNfs',
3946db866be9SFam Zheng      'null-aio':   'BlockdevOptionsNull',
3947db866be9SFam Zheng      'null-co':    'BlockdevOptionsNull',
3948d87ee3d7SFam Zheng      'nvme':       'BlockdevOptionsNVMe',
39491ad166b6SBenoît Canet      'parallels':  'BlockdevOptionsGenericFormat',
39501ad166b6SBenoît Canet      'qcow2':      'BlockdevOptionsQcow2',
3951d85f4222SDaniel P. Berrange      'qcow':       'BlockdevOptionsQcow',
39521ad166b6SBenoît Canet      'qed':        'BlockdevOptionsGenericCOWFormat',
3953db866be9SFam Zheng      'quorum':     'BlockdevOptionsQuorum',
39542fdc7045STomáš Golembiovský      'raw':        'BlockdevOptionsRaw',
39558a47e8ebSJeff Cody      'rbd':        'BlockdevOptionsRbd',
3956335d10cdSMarc-André Lureau      'replication': { 'type': 'BlockdevOptionsReplication',
3957335d10cdSMarc-André Lureau                       'if': 'defined(CONFIG_REPLICATION)' },
3958d282f34eSMarkus Armbruster      'sheepdog':   'BlockdevOptionsSheepdog',
3959ad0e90a6SAshijeet Acharya      'ssh':        'BlockdevOptionsSsh',
3960d8e7d87eSManos Pitsidianakis      'throttle':   'BlockdevOptionsThrottle',
39611ad166b6SBenoît Canet      'vdi':        'BlockdevOptionsGenericFormat',
39621ad166b6SBenoît Canet      'vhdx':       'BlockdevOptionsGenericFormat',
39631ad166b6SBenoît Canet      'vmdk':       'BlockdevOptionsGenericCOWFormat',
39641ad166b6SBenoît Canet      'vpc':        'BlockdevOptionsGenericFormat',
3965da92c3ffSAshish Mittal      'vvfat':      'BlockdevOptionsVVFAT',
3966da92c3ffSAshish Mittal      'vxhs':       'BlockdevOptionsVxHS'
39671ad166b6SBenoît Canet  } }
39681ad166b6SBenoît Canet
39691ad166b6SBenoît Canet##
39705072f7b3SMarc-André Lureau# @BlockdevRef:
39711ad166b6SBenoît Canet#
39721ad166b6SBenoît Canet# Reference to a block device.
39731ad166b6SBenoît Canet#
39741ad166b6SBenoît Canet# @definition:      defines a new block device inline
3975c42e8742SMarkus Armbruster# @reference:       references the ID of an existing block device
39761ad166b6SBenoît Canet#
397779b7a77eSMarkus Armbruster# Since: 2.9
39781ad166b6SBenoît Canet##
3979ab916fadSEric Blake{ 'alternate': 'BlockdevRef',
39801ad166b6SBenoît Canet  'data': { 'definition': 'BlockdevOptions',
39811ad166b6SBenoît Canet            'reference': 'str' } }
39821ad166b6SBenoît Canet
39831ad166b6SBenoît Canet##
3984c42e8742SMarkus Armbruster# @BlockdevRefOrNull:
3985c42e8742SMarkus Armbruster#
3986c42e8742SMarkus Armbruster# Reference to a block device.
3987c42e8742SMarkus Armbruster#
3988c42e8742SMarkus Armbruster# @definition:      defines a new block device inline
3989c42e8742SMarkus Armbruster# @reference:       references the ID of an existing block device.
3990c42e8742SMarkus Armbruster#                   An empty string means that no block device should
3991c42e8742SMarkus Armbruster#                   be referenced.  Deprecated; use null instead.
3992c42e8742SMarkus Armbruster# @null:            No block device should be referenced (since 2.10)
3993c42e8742SMarkus Armbruster#
3994c42e8742SMarkus Armbruster# Since: 2.9
3995c42e8742SMarkus Armbruster##
3996c42e8742SMarkus Armbruster{ 'alternate': 'BlockdevRefOrNull',
3997c42e8742SMarkus Armbruster  'data': { 'definition': 'BlockdevOptions',
3998c42e8742SMarkus Armbruster            'reference': 'str',
3999c42e8742SMarkus Armbruster            'null': 'null' } }
4000c42e8742SMarkus Armbruster
4001c42e8742SMarkus Armbruster##
40021ad166b6SBenoît Canet# @blockdev-add:
40031ad166b6SBenoît Canet#
4004be4b67bcSMax Reitz# Creates a new block device. If the @id option is given at the top level, a
4005be4b67bcSMax Reitz# BlockBackend will be created; otherwise, @node-name is mandatory at the top
4006be4b67bcSMax Reitz# level and no BlockBackend will be created.
40071ad166b6SBenoît Canet#
400879b7a77eSMarkus Armbruster# Since: 2.9
4009b4749948SMarc-André Lureau#
4010b4749948SMarc-André Lureau# Example:
4011b4749948SMarc-André Lureau#
4012b4749948SMarc-André Lureau# 1.
4013b4749948SMarc-André Lureau# -> { "execute": "blockdev-add",
4014b4749948SMarc-André Lureau#      "arguments": {
4015b1660997SJeff Cody#           "driver": "qcow2",
4016b1660997SJeff Cody#           "node-name": "test1",
4017b1660997SJeff Cody#           "file": {
4018b1660997SJeff Cody#               "driver": "file",
4019b1660997SJeff Cody#               "filename": "test.qcow2"
4020b1660997SJeff Cody#            }
4021b1660997SJeff Cody#       }
4022b1660997SJeff Cody#     }
4023b4749948SMarc-André Lureau# <- { "return": {} }
4024b4749948SMarc-André Lureau#
4025b4749948SMarc-André Lureau# 2.
4026b4749948SMarc-André Lureau# -> { "execute": "blockdev-add",
4027b4749948SMarc-André Lureau#      "arguments": {
4028b4749948SMarc-André Lureau#           "driver": "qcow2",
4029b4749948SMarc-André Lureau#           "node-name": "node0",
4030b4749948SMarc-André Lureau#           "discard": "unmap",
4031b4749948SMarc-André Lureau#           "cache": {
4032b1660997SJeff Cody#              "direct": true
4033b4749948SMarc-André Lureau#            },
4034b4749948SMarc-André Lureau#            "file": {
4035b4749948SMarc-André Lureau#              "driver": "file",
4036b4749948SMarc-André Lureau#              "filename": "/tmp/test.qcow2"
4037b4749948SMarc-André Lureau#            },
4038b4749948SMarc-André Lureau#            "backing": {
4039b4749948SMarc-André Lureau#               "driver": "raw",
4040b4749948SMarc-André Lureau#               "file": {
4041b4749948SMarc-André Lureau#                  "driver": "file",
4042b4749948SMarc-André Lureau#                  "filename": "/dev/fdset/4"
4043b4749948SMarc-André Lureau#                }
4044b4749948SMarc-André Lureau#            }
4045b4749948SMarc-André Lureau#        }
4046b4749948SMarc-André Lureau#      }
4047b4749948SMarc-André Lureau#
4048b4749948SMarc-André Lureau# <- { "return": {} }
4049b4749948SMarc-André Lureau#
40501ad166b6SBenoît Canet##
40510153d2f5SKevin Wolf{ 'command': 'blockdev-add', 'data': 'BlockdevOptions', 'boxed': true }
40521ad166b6SBenoît Canet
40537d8a9f71SMax Reitz##
40541479c730SAlberto Garcia# @x-blockdev-reopen:
40551479c730SAlberto Garcia#
40561479c730SAlberto Garcia# Reopens a block device using the given set of options. Any option
40571479c730SAlberto Garcia# not specified will be reset to its default value regardless of its
40581479c730SAlberto Garcia# previous status. If an option cannot be changed or a particular
40591479c730SAlberto Garcia# driver does not support reopening then the command will return an
40601479c730SAlberto Garcia# error.
40611479c730SAlberto Garcia#
40621479c730SAlberto Garcia# The top-level @node-name option (from BlockdevOptions) must be
40631479c730SAlberto Garcia# specified and is used to select the block device to be reopened.
40641479c730SAlberto Garcia# Other @node-name options must be either omitted or set to the
40651479c730SAlberto Garcia# current name of the appropriate node. This command won't change any
40661479c730SAlberto Garcia# node name and any attempt to do it will result in an error.
40671479c730SAlberto Garcia#
40681479c730SAlberto Garcia# In the case of options that refer to child nodes, the behavior of
40691479c730SAlberto Garcia# this command depends on the value:
40701479c730SAlberto Garcia#
40711479c730SAlberto Garcia#  1) A set of options (BlockdevOptions): the child is reopened with
40721479c730SAlberto Garcia#     the specified set of options.
40731479c730SAlberto Garcia#
40741479c730SAlberto Garcia#  2) A reference to the current child: the child is reopened using
40751479c730SAlberto Garcia#     its existing set of options.
40761479c730SAlberto Garcia#
40771479c730SAlberto Garcia#  3) A reference to a different node: the current child is replaced
40781479c730SAlberto Garcia#     with the specified one.
40791479c730SAlberto Garcia#
40801479c730SAlberto Garcia#  4) NULL: the current child (if any) is detached.
40811479c730SAlberto Garcia#
40821479c730SAlberto Garcia# Options (1) and (2) are supported in all cases, but at the moment
40831479c730SAlberto Garcia# only @backing allows replacing or detaching an existing child.
40841479c730SAlberto Garcia#
40851479c730SAlberto Garcia# Unlike with blockdev-add, the @backing option must always be present
40861479c730SAlberto Garcia# unless the node being reopened does not have a backing file and its
40871479c730SAlberto Garcia# image does not have a default backing file name as part of its
40881479c730SAlberto Garcia# metadata.
40891479c730SAlberto Garcia#
40901479c730SAlberto Garcia# Since: 4.0
40911479c730SAlberto Garcia##
40921479c730SAlberto Garcia{ 'command': 'x-blockdev-reopen',
40931479c730SAlberto Garcia  'data': 'BlockdevOptions', 'boxed': true }
40941479c730SAlberto Garcia
40951479c730SAlberto Garcia##
409679b7a77eSMarkus Armbruster# @blockdev-del:
409781b936aeSAlberto Garcia#
409881b936aeSAlberto Garcia# Deletes a block device that has been added using blockdev-add.
40999ec8873eSKevin Wolf# The command will fail if the node is attached to a device or is
41009ec8873eSKevin Wolf# otherwise being used.
410181b936aeSAlberto Garcia#
41027a305384SMarc-André Lureau# @node-name: Name of the graph node to delete.
41037a305384SMarc-André Lureau#
410479b7a77eSMarkus Armbruster# Since: 2.9
4105915a213fSMarc-André Lureau#
4106915a213fSMarc-André Lureau# Example:
4107915a213fSMarc-André Lureau#
4108915a213fSMarc-André Lureau# -> { "execute": "blockdev-add",
4109915a213fSMarc-André Lureau#      "arguments": {
4110915a213fSMarc-André Lureau#           "driver": "qcow2",
4111915a213fSMarc-André Lureau#           "node-name": "node0",
4112915a213fSMarc-André Lureau#           "file": {
4113915a213fSMarc-André Lureau#               "driver": "file",
4114915a213fSMarc-André Lureau#               "filename": "test.qcow2"
4115915a213fSMarc-André Lureau#           }
4116915a213fSMarc-André Lureau#      }
4117915a213fSMarc-André Lureau#    }
4118915a213fSMarc-André Lureau# <- { "return": {} }
4119915a213fSMarc-André Lureau#
412079b7a77eSMarkus Armbruster# -> { "execute": "blockdev-del",
4121915a213fSMarc-André Lureau#      "arguments": { "node-name": "node0" }
4122915a213fSMarc-André Lureau#    }
4123915a213fSMarc-André Lureau# <- { "return": {} }
4124915a213fSMarc-André Lureau#
412581b936aeSAlberto Garcia##
412679b7a77eSMarkus Armbruster{ 'command': 'blockdev-del', 'data': { 'node-name': 'str' } }
412781b936aeSAlberto Garcia
412881b936aeSAlberto Garcia##
4129927f11e1SKevin Wolf# @BlockdevCreateOptionsFile:
4130927f11e1SKevin Wolf#
4131927f11e1SKevin Wolf# Driver specific image creation options for file.
4132927f11e1SKevin Wolf#
4133927f11e1SKevin Wolf# @filename         Filename for the new image file
4134927f11e1SKevin Wolf# @size             Size of the virtual disk in bytes
413564c7580cSStefano Garzarella# @preallocation    Preallocation mode for the new image (default: off;
413664c7580cSStefano Garzarella#                   allowed values: off,
413764c7580cSStefano Garzarella#                   falloc (if defined CONFIG_POSIX_FALLOCATE),
413864c7580cSStefano Garzarella#                   full (if defined CONFIG_POSIX))
4139927f11e1SKevin Wolf# @nocow            Turn off copy-on-write (valid only on btrfs; default: off)
4140927f11e1SKevin Wolf#
4141927f11e1SKevin Wolf# Since: 2.12
4142927f11e1SKevin Wolf##
4143927f11e1SKevin Wolf{ 'struct': 'BlockdevCreateOptionsFile',
4144927f11e1SKevin Wolf  'data': { 'filename':         'str',
4145927f11e1SKevin Wolf            'size':             'size',
4146927f11e1SKevin Wolf            '*preallocation':   'PreallocMode',
4147927f11e1SKevin Wolf            '*nocow':           'bool' } }
4148927f11e1SKevin Wolf
4149927f11e1SKevin Wolf##
4150ab8bda76SKevin Wolf# @BlockdevCreateOptionsGluster:
4151ab8bda76SKevin Wolf#
4152ab8bda76SKevin Wolf# Driver specific image creation options for gluster.
4153ab8bda76SKevin Wolf#
4154ab8bda76SKevin Wolf# @location         Where to store the new image file
4155ab8bda76SKevin Wolf# @size             Size of the virtual disk in bytes
415664c7580cSStefano Garzarella# @preallocation    Preallocation mode for the new image (default: off;
415764c7580cSStefano Garzarella#                   allowed values: off,
415864c7580cSStefano Garzarella#                   falloc (if defined CONFIG_GLUSTERFS_FALLOCATE),
415964c7580cSStefano Garzarella#                   full (if defined CONFIG_GLUSTERFS_ZEROFILL))
4160ab8bda76SKevin Wolf#
4161ab8bda76SKevin Wolf# Since: 2.12
4162ab8bda76SKevin Wolf##
4163ab8bda76SKevin Wolf{ 'struct': 'BlockdevCreateOptionsGluster',
4164ab8bda76SKevin Wolf  'data': { 'location':         'BlockdevOptionsGluster',
4165ab8bda76SKevin Wolf            'size':             'size',
4166ab8bda76SKevin Wolf            '*preallocation':   'PreallocMode' } }
4167ab8bda76SKevin Wolf
4168ab8bda76SKevin Wolf##
41691bedcaf1SKevin Wolf# @BlockdevCreateOptionsLUKS:
41701bedcaf1SKevin Wolf#
41711bedcaf1SKevin Wolf# Driver specific image creation options for LUKS.
41721bedcaf1SKevin Wolf#
41731bedcaf1SKevin Wolf# @file             Node to create the image format on
41741bedcaf1SKevin Wolf# @size             Size of the virtual disk in bytes
41751bedcaf1SKevin Wolf#
41761bedcaf1SKevin Wolf# Since: 2.12
41771bedcaf1SKevin Wolf##
41781bedcaf1SKevin Wolf{ 'struct': 'BlockdevCreateOptionsLUKS',
41791bedcaf1SKevin Wolf  'base': 'QCryptoBlockCreateOptionsLUKS',
41801bedcaf1SKevin Wolf  'data': { 'file':             'BlockdevRef',
41811bedcaf1SKevin Wolf            'size':             'size' } }
41821bedcaf1SKevin Wolf
41831bedcaf1SKevin Wolf##
4184a1a42af4SKevin Wolf# @BlockdevCreateOptionsNfs:
4185a1a42af4SKevin Wolf#
4186a1a42af4SKevin Wolf# Driver specific image creation options for NFS.
4187a1a42af4SKevin Wolf#
4188a1a42af4SKevin Wolf# @location         Where to store the new image file
4189a1a42af4SKevin Wolf# @size             Size of the virtual disk in bytes
4190a1a42af4SKevin Wolf#
4191a1a42af4SKevin Wolf# Since: 2.12
4192a1a42af4SKevin Wolf##
4193a1a42af4SKevin Wolf{ 'struct': 'BlockdevCreateOptionsNfs',
4194a1a42af4SKevin Wolf  'data': { 'location':         'BlockdevOptionsNfs',
4195a1a42af4SKevin Wolf            'size':             'size' } }
4196a1a42af4SKevin Wolf
4197a1a42af4SKevin Wolf##
41981511b490SKevin Wolf# @BlockdevCreateOptionsParallels:
41991511b490SKevin Wolf#
42001511b490SKevin Wolf# Driver specific image creation options for parallels.
42011511b490SKevin Wolf#
42021511b490SKevin Wolf# @file             Node to create the image format on
42031511b490SKevin Wolf# @size             Size of the virtual disk in bytes
42041511b490SKevin Wolf# @cluster-size     Cluster size in bytes (default: 1 MB)
42051511b490SKevin Wolf#
42061511b490SKevin Wolf# Since: 2.12
42071511b490SKevin Wolf##
42081511b490SKevin Wolf{ 'struct': 'BlockdevCreateOptionsParallels',
42091511b490SKevin Wolf  'data': { 'file':             'BlockdevRef',
42101511b490SKevin Wolf            'size':             'size',
42111511b490SKevin Wolf            '*cluster-size':    'size' } }
42121511b490SKevin Wolf
42131511b490SKevin Wolf##
421442a3e1abSKevin Wolf# @BlockdevCreateOptionsQcow:
421542a3e1abSKevin Wolf#
421642a3e1abSKevin Wolf# Driver specific image creation options for qcow.
421742a3e1abSKevin Wolf#
421842a3e1abSKevin Wolf# @file             Node to create the image format on
421942a3e1abSKevin Wolf# @size             Size of the virtual disk in bytes
422042a3e1abSKevin Wolf# @backing-file     File name of the backing file if a backing file
422142a3e1abSKevin Wolf#                   should be used
422242a3e1abSKevin Wolf# @encrypt          Encryption options if the image should be encrypted
422342a3e1abSKevin Wolf#
422442a3e1abSKevin Wolf# Since: 2.12
422542a3e1abSKevin Wolf##
422642a3e1abSKevin Wolf{ 'struct': 'BlockdevCreateOptionsQcow',
422742a3e1abSKevin Wolf  'data': { 'file':             'BlockdevRef',
422842a3e1abSKevin Wolf            'size':             'size',
422942a3e1abSKevin Wolf            '*backing-file':    'str',
423042a3e1abSKevin Wolf            '*encrypt':         'QCryptoBlockCreateOptions' } }
423142a3e1abSKevin Wolf
423242a3e1abSKevin Wolf##
4233c2808abaSKevin Wolf# @BlockdevQcow2Version:
4234c2808abaSKevin Wolf#
4235c2808abaSKevin Wolf# @v2:  The original QCOW2 format as introduced in qemu 0.10 (version 2)
4236c2808abaSKevin Wolf# @v3:  The extended QCOW2 format as introduced in qemu 1.1 (version 3)
4237c2808abaSKevin Wolf#
4238c2808abaSKevin Wolf# Since: 2.12
4239c2808abaSKevin Wolf##
4240c2808abaSKevin Wolf{ 'enum': 'BlockdevQcow2Version',
4241c2808abaSKevin Wolf  'data': [ 'v2', 'v3' ] }
4242c2808abaSKevin Wolf
4243c2808abaSKevin Wolf
4244c2808abaSKevin Wolf##
4245c2808abaSKevin Wolf# @BlockdevCreateOptionsQcow2:
4246c2808abaSKevin Wolf#
4247c2808abaSKevin Wolf# Driver specific image creation options for qcow2.
4248c2808abaSKevin Wolf#
4249c2808abaSKevin Wolf# @file             Node to create the image format on
4250dcc98687SKevin Wolf# @data-file        Node to use as an external data file in which all guest
4251dcc98687SKevin Wolf#                   data is stored so that only metadata remains in the qcow2
4252dcc98687SKevin Wolf#                   file (since: 4.0)
42536c3944dcSKevin Wolf# @data-file-raw    True if the external data file must stay valid as a
42546c3944dcSKevin Wolf#                   standalone (read-only) raw image without looking at qcow2
42556c3944dcSKevin Wolf#                   metadata (default: false; since: 4.0)
4256c2808abaSKevin Wolf# @size             Size of the virtual disk in bytes
4257c2808abaSKevin Wolf# @version          Compatibility level (default: v3)
4258c2808abaSKevin Wolf# @backing-file     File name of the backing file if a backing file
4259c2808abaSKevin Wolf#                   should be used
4260c2808abaSKevin Wolf# @backing-fmt      Name of the block driver to use for the backing file
4261c2808abaSKevin Wolf# @encrypt          Encryption options if the image should be encrypted
4262c2808abaSKevin Wolf# @cluster-size     qcow2 cluster size in bytes (default: 65536)
426364c7580cSStefano Garzarella# @preallocation    Preallocation mode for the new image (default: off;
426464c7580cSStefano Garzarella#                   allowed values: off, falloc, full, metadata)
4265c2808abaSKevin Wolf# @lazy-refcounts   True if refcounts may be updated lazily (default: off)
4266c2808abaSKevin Wolf# @refcount-bits    Width of reference counts in bits (default: 16)
4267c2808abaSKevin Wolf#
4268c2808abaSKevin Wolf# Since: 2.12
4269c2808abaSKevin Wolf##
4270c2808abaSKevin Wolf{ 'struct': 'BlockdevCreateOptionsQcow2',
4271c2808abaSKevin Wolf  'data': { 'file':             'BlockdevRef',
4272dcc98687SKevin Wolf            '*data-file':       'BlockdevRef',
42736c3944dcSKevin Wolf            '*data-file-raw':   'bool',
4274c2808abaSKevin Wolf            'size':             'size',
4275c2808abaSKevin Wolf            '*version':         'BlockdevQcow2Version',
4276c2808abaSKevin Wolf            '*backing-file':    'str',
4277c2808abaSKevin Wolf            '*backing-fmt':     'BlockdevDriver',
4278c2808abaSKevin Wolf            '*encrypt':         'QCryptoBlockCreateOptions',
4279c2808abaSKevin Wolf            '*cluster-size':    'size',
4280c2808abaSKevin Wolf            '*preallocation':   'PreallocMode',
4281c2808abaSKevin Wolf            '*lazy-refcounts':  'bool',
4282c2808abaSKevin Wolf            '*refcount-bits':   'int' } }
4283c2808abaSKevin Wolf
4284c2808abaSKevin Wolf##
4285959355a4SKevin Wolf# @BlockdevCreateOptionsQed:
4286959355a4SKevin Wolf#
4287959355a4SKevin Wolf# Driver specific image creation options for qed.
4288959355a4SKevin Wolf#
4289959355a4SKevin Wolf# @file             Node to create the image format on
4290959355a4SKevin Wolf# @size             Size of the virtual disk in bytes
4291959355a4SKevin Wolf# @backing-file     File name of the backing file if a backing file
4292959355a4SKevin Wolf#                   should be used
4293959355a4SKevin Wolf# @backing-fmt      Name of the block driver to use for the backing file
4294959355a4SKevin Wolf# @cluster-size     Cluster size in bytes (default: 65536)
4295959355a4SKevin Wolf# @table-size       L1/L2 table size (in clusters)
4296959355a4SKevin Wolf#
4297959355a4SKevin Wolf# Since: 2.12
4298959355a4SKevin Wolf##
4299959355a4SKevin Wolf{ 'struct': 'BlockdevCreateOptionsQed',
4300959355a4SKevin Wolf  'data': { 'file':             'BlockdevRef',
4301959355a4SKevin Wolf            'size':             'size',
4302959355a4SKevin Wolf            '*backing-file':    'str',
4303959355a4SKevin Wolf            '*backing-fmt':     'BlockdevDriver',
4304959355a4SKevin Wolf            '*cluster-size':    'size',
4305959355a4SKevin Wolf            '*table-size':      'int' } }
4306959355a4SKevin Wolf
4307959355a4SKevin Wolf##
43081bebea37SKevin Wolf# @BlockdevCreateOptionsRbd:
43091bebea37SKevin Wolf#
43101bebea37SKevin Wolf# Driver specific image creation options for rbd/Ceph.
43111bebea37SKevin Wolf#
43121bebea37SKevin Wolf# @location         Where to store the new image file. This location cannot
43131bebea37SKevin Wolf#                   point to a snapshot.
43141bebea37SKevin Wolf# @size             Size of the virtual disk in bytes
43151bebea37SKevin Wolf# @cluster-size     RBD object size
43161bebea37SKevin Wolf#
43171bebea37SKevin Wolf# Since: 2.12
43181bebea37SKevin Wolf##
43191bebea37SKevin Wolf{ 'struct': 'BlockdevCreateOptionsRbd',
43201bebea37SKevin Wolf  'data': { 'location':         'BlockdevOptionsRbd',
43211bebea37SKevin Wolf            'size':             'size',
43221bebea37SKevin Wolf            '*cluster-size' :   'size' } }
43231bebea37SKevin Wolf
43241bebea37SKevin Wolf##
43253015372dSFam Zheng# @BlockdevVmdkSubformat:
43263015372dSFam Zheng#
43273015372dSFam Zheng# Subformat options for VMDK images
43283015372dSFam Zheng#
43293015372dSFam Zheng# @monolithicSparse:     Single file image with sparse cluster allocation
43303015372dSFam Zheng#
43313015372dSFam Zheng# @monolithicFlat:       Single flat data image and a descriptor file
43323015372dSFam Zheng#
43333015372dSFam Zheng# @twoGbMaxExtentSparse: Data is split into 2GB (per virtual LBA) sparse extent
43343015372dSFam Zheng#                        files, in addition to a descriptor file
43353015372dSFam Zheng#
43363015372dSFam Zheng# @twoGbMaxExtentFlat:   Data is split into 2GB (per virtual LBA) flat extent
43373015372dSFam Zheng#                        files, in addition to a descriptor file
43383015372dSFam Zheng#
43393015372dSFam Zheng# @streamOptimized:      Single file image sparse cluster allocation, optimized
43403015372dSFam Zheng#                        for streaming over network.
43413015372dSFam Zheng#
43423015372dSFam Zheng# Since: 4.0
43433015372dSFam Zheng##
43443015372dSFam Zheng{ 'enum': 'BlockdevVmdkSubformat',
43453015372dSFam Zheng  'data': [ 'monolithicSparse', 'monolithicFlat', 'twoGbMaxExtentSparse',
43463015372dSFam Zheng            'twoGbMaxExtentFlat', 'streamOptimized'] }
43473015372dSFam Zheng
43483015372dSFam Zheng##
43493015372dSFam Zheng# @BlockdevVmdkAdapterType:
43503015372dSFam Zheng#
43513015372dSFam Zheng# Adapter type info for VMDK images
43523015372dSFam Zheng#
43533015372dSFam Zheng# Since: 4.0
43543015372dSFam Zheng##
43553015372dSFam Zheng{ 'enum': 'BlockdevVmdkAdapterType',
43563015372dSFam Zheng  'data': [ 'ide', 'buslogic', 'lsilogic', 'legacyESX'] }
43573015372dSFam Zheng
43583015372dSFam Zheng##
43593015372dSFam Zheng# @BlockdevCreateOptionsVmdk:
43603015372dSFam Zheng#
43613015372dSFam Zheng# Driver specific image creation options for VMDK.
43623015372dSFam Zheng#
43633015372dSFam Zheng# @file         Where to store the new image file. This refers to the image
43643015372dSFam Zheng#               file for monolithcSparse and streamOptimized format, or the
43653015372dSFam Zheng#               descriptor file for other formats.
43663015372dSFam Zheng# @size         Size of the virtual disk in bytes
43673015372dSFam Zheng# @extents      Where to store the data extents. Required for monolithcFlat,
43683015372dSFam Zheng#               twoGbMaxExtentSparse and twoGbMaxExtentFlat formats. For
43693015372dSFam Zheng#               monolithicFlat, only one entry is required; for
43703015372dSFam Zheng#               twoGbMaxExtent* formats, the number of entries required is
43714a960eceSKevin Wolf#               calculated as extent_number = virtual_size / 2GB. Providing
43724a960eceSKevin Wolf#               more extents than will be used is an error.
43733015372dSFam Zheng# @subformat    The subformat of the VMDK image. Default: "monolithicSparse".
43743015372dSFam Zheng# @backing-file The path of backing file. Default: no backing file is used.
43753015372dSFam Zheng# @adapter-type The adapter type used to fill in the descriptor. Default: ide.
43763015372dSFam Zheng# @hwversion    Hardware version. The meaningful options are "4" or "6".
43773015372dSFam Zheng#               Default: "4".
43783015372dSFam Zheng# @zeroed-grain Whether to enable zeroed-grain feature for sparse subformats.
43793015372dSFam Zheng#               Default: false.
43803015372dSFam Zheng#
43813015372dSFam Zheng# Since: 4.0
43823015372dSFam Zheng##
43833015372dSFam Zheng{ 'struct': 'BlockdevCreateOptionsVmdk',
43843015372dSFam Zheng  'data': { 'file':             'BlockdevRef',
43853015372dSFam Zheng            'size':             'size',
43863015372dSFam Zheng            '*extents':          ['BlockdevRef'],
43873015372dSFam Zheng            '*subformat':       'BlockdevVmdkSubformat',
43883015372dSFam Zheng            '*backing-file':    'str',
43893015372dSFam Zheng            '*adapter-type':    'BlockdevVmdkAdapterType',
43903015372dSFam Zheng            '*hwversion':       'str',
43913015372dSFam Zheng            '*zeroed-grain':    'bool' } }
43923015372dSFam Zheng
43933015372dSFam Zheng
43943015372dSFam Zheng##
4395a595e4bcSKevin Wolf# @SheepdogRedundancyType:
4396a595e4bcSKevin Wolf#
4397a595e4bcSKevin Wolf# @full             Create a fully replicated vdi with x copies
4398a595e4bcSKevin Wolf# @erasure-coded    Create an erasure coded vdi with x data strips and
4399a595e4bcSKevin Wolf#                   y parity strips
4400a595e4bcSKevin Wolf#
4401a595e4bcSKevin Wolf# Since: 2.12
4402a595e4bcSKevin Wolf##
4403a595e4bcSKevin Wolf{ 'enum': 'SheepdogRedundancyType',
4404a595e4bcSKevin Wolf  'data': [ 'full', 'erasure-coded' ] }
4405a595e4bcSKevin Wolf
4406a595e4bcSKevin Wolf##
4407a595e4bcSKevin Wolf# @SheepdogRedundancyFull:
4408a595e4bcSKevin Wolf#
4409a595e4bcSKevin Wolf# @copies           Number of copies to use (between 1 and 31)
4410a595e4bcSKevin Wolf#
4411a595e4bcSKevin Wolf# Since: 2.12
4412a595e4bcSKevin Wolf##
4413a595e4bcSKevin Wolf{ 'struct': 'SheepdogRedundancyFull',
4414a595e4bcSKevin Wolf  'data': { 'copies': 'int' }}
4415a595e4bcSKevin Wolf
4416a595e4bcSKevin Wolf##
4417a595e4bcSKevin Wolf# @SheepdogRedundancyErasureCoded:
4418a595e4bcSKevin Wolf#
4419a595e4bcSKevin Wolf# @data-strips      Number of data strips to use (one of {2,4,8,16})
4420a595e4bcSKevin Wolf# @parity-strips    Number of parity strips to use (between 1 and 15)
4421a595e4bcSKevin Wolf#
4422a595e4bcSKevin Wolf# Since: 2.12
4423a595e4bcSKevin Wolf##
4424a595e4bcSKevin Wolf{ 'struct': 'SheepdogRedundancyErasureCoded',
4425a595e4bcSKevin Wolf  'data': { 'data-strips': 'int',
4426a595e4bcSKevin Wolf            'parity-strips': 'int' }}
4427a595e4bcSKevin Wolf
4428a595e4bcSKevin Wolf##
4429a595e4bcSKevin Wolf# @SheepdogRedundancy:
4430a595e4bcSKevin Wolf#
4431a595e4bcSKevin Wolf# Since: 2.12
4432a595e4bcSKevin Wolf##
4433a595e4bcSKevin Wolf{ 'union': 'SheepdogRedundancy',
4434a595e4bcSKevin Wolf  'base': { 'type': 'SheepdogRedundancyType' },
4435a595e4bcSKevin Wolf  'discriminator': 'type',
4436a595e4bcSKevin Wolf  'data': { 'full': 'SheepdogRedundancyFull',
4437a595e4bcSKevin Wolf            'erasure-coded': 'SheepdogRedundancyErasureCoded' } }
4438a595e4bcSKevin Wolf
4439a595e4bcSKevin Wolf##
444063fd65a0SKevin Wolf# @BlockdevCreateOptionsSheepdog:
444163fd65a0SKevin Wolf#
444263fd65a0SKevin Wolf# Driver specific image creation options for Sheepdog.
444363fd65a0SKevin Wolf#
444463fd65a0SKevin Wolf# @location         Where to store the new image file
444563fd65a0SKevin Wolf# @size             Size of the virtual disk in bytes
444663fd65a0SKevin Wolf# @backing-file     File name of a base image
444764c7580cSStefano Garzarella# @preallocation    Preallocation mode for the new image (default: off;
444864c7580cSStefano Garzarella#                   allowed values: off, full)
444963fd65a0SKevin Wolf# @redundancy       Redundancy of the image
445063fd65a0SKevin Wolf# @object-size      Object size of the image
445163fd65a0SKevin Wolf#
445263fd65a0SKevin Wolf# Since: 2.12
445363fd65a0SKevin Wolf##
445463fd65a0SKevin Wolf{ 'struct': 'BlockdevCreateOptionsSheepdog',
445563fd65a0SKevin Wolf  'data': { 'location':         'BlockdevOptionsSheepdog',
445663fd65a0SKevin Wolf            'size':             'size',
445763fd65a0SKevin Wolf            '*backing-file':    'str',
445863fd65a0SKevin Wolf            '*preallocation':   'PreallocMode',
445963fd65a0SKevin Wolf            '*redundancy':      'SheepdogRedundancy',
446063fd65a0SKevin Wolf            '*object-size':     'size' } }
446163fd65a0SKevin Wolf
446263fd65a0SKevin Wolf##
44634906da7eSKevin Wolf# @BlockdevCreateOptionsSsh:
44644906da7eSKevin Wolf#
44654906da7eSKevin Wolf# Driver specific image creation options for SSH.
44664906da7eSKevin Wolf#
44674906da7eSKevin Wolf# @location         Where to store the new image file
44684906da7eSKevin Wolf# @size             Size of the virtual disk in bytes
44694906da7eSKevin Wolf#
44704906da7eSKevin Wolf# Since: 2.12
44714906da7eSKevin Wolf##
44724906da7eSKevin Wolf{ 'struct': 'BlockdevCreateOptionsSsh',
44734906da7eSKevin Wolf  'data': { 'location':         'BlockdevOptionsSsh',
44744906da7eSKevin Wolf            'size':             'size' } }
44754906da7eSKevin Wolf
44764906da7eSKevin Wolf##
447749858b50SMax Reitz# @BlockdevCreateOptionsVdi:
447849858b50SMax Reitz#
447949858b50SMax Reitz# Driver specific image creation options for VDI.
448049858b50SMax Reitz#
448149858b50SMax Reitz# @file             Node to create the image format on
448249858b50SMax Reitz# @size             Size of the virtual disk in bytes
448364c7580cSStefano Garzarella# @preallocation    Preallocation mode for the new image (default: off;
448464c7580cSStefano Garzarella#                   allowed values: off, metadata)
448549858b50SMax Reitz#
448649858b50SMax Reitz# Since: 2.12
448749858b50SMax Reitz##
448849858b50SMax Reitz{ 'struct': 'BlockdevCreateOptionsVdi',
448949858b50SMax Reitz  'data': { 'file':             'BlockdevRef',
449049858b50SMax Reitz            'size':             'size',
449161fa6487SKevin Wolf            '*preallocation':   'PreallocMode' } }
449249858b50SMax Reitz
449349858b50SMax Reitz##
449409b68dabSKevin Wolf# @BlockdevVhdxSubformat:
449509b68dabSKevin Wolf#
449609b68dabSKevin Wolf# @dynamic: Growing image file
449709b68dabSKevin Wolf# @fixed:   Preallocated fixed-size image file
449809b68dabSKevin Wolf#
449909b68dabSKevin Wolf# Since: 2.12
450009b68dabSKevin Wolf##
450109b68dabSKevin Wolf{ 'enum': 'BlockdevVhdxSubformat',
450209b68dabSKevin Wolf  'data': [ 'dynamic', 'fixed' ] }
450309b68dabSKevin Wolf
450409b68dabSKevin Wolf##
450509b68dabSKevin Wolf# @BlockdevCreateOptionsVhdx:
450609b68dabSKevin Wolf#
450709b68dabSKevin Wolf# Driver specific image creation options for vhdx.
450809b68dabSKevin Wolf#
450909b68dabSKevin Wolf# @file             Node to create the image format on
451009b68dabSKevin Wolf# @size             Size of the virtual disk in bytes
451109b68dabSKevin Wolf# @log-size         Log size in bytes, must be a multiple of 1 MB
451209b68dabSKevin Wolf#                   (default: 1 MB)
451309b68dabSKevin Wolf# @block-size       Block size in bytes, must be a multiple of 1 MB and not
451409b68dabSKevin Wolf#                   larger than 256 MB (default: automatically choose a block
451509b68dabSKevin Wolf#                   size depending on the image size)
451609b68dabSKevin Wolf# @subformat        vhdx subformat (default: dynamic)
451709b68dabSKevin Wolf# @block-state-zero Force use of payload blocks of type 'ZERO'. Non-standard,
451809b68dabSKevin Wolf#                   but default.  Do not set to 'off' when using 'qemu-img
451909b68dabSKevin Wolf#                   convert' with subformat=dynamic.
452009b68dabSKevin Wolf#
452109b68dabSKevin Wolf# Since: 2.12
452209b68dabSKevin Wolf##
452309b68dabSKevin Wolf{ 'struct': 'BlockdevCreateOptionsVhdx',
452409b68dabSKevin Wolf  'data': { 'file':                 'BlockdevRef',
452509b68dabSKevin Wolf            'size':                 'size',
452609b68dabSKevin Wolf            '*log-size':            'size',
452709b68dabSKevin Wolf            '*block-size':          'size',
452809b68dabSKevin Wolf            '*subformat':           'BlockdevVhdxSubformat',
452909b68dabSKevin Wolf            '*block-state-zero':    'bool' } }
453009b68dabSKevin Wolf
453109b68dabSKevin Wolf##
4532182c8835SKevin Wolf# @BlockdevVpcSubformat:
4533182c8835SKevin Wolf#
4534182c8835SKevin Wolf# @dynamic: Growing image file
4535182c8835SKevin Wolf# @fixed:   Preallocated fixed-size image file
4536182c8835SKevin Wolf#
4537182c8835SKevin Wolf# Since: 2.12
4538182c8835SKevin Wolf##
4539182c8835SKevin Wolf{ 'enum': 'BlockdevVpcSubformat',
4540182c8835SKevin Wolf  'data': [ 'dynamic', 'fixed' ] }
4541182c8835SKevin Wolf
4542182c8835SKevin Wolf##
4543182c8835SKevin Wolf# @BlockdevCreateOptionsVpc:
4544182c8835SKevin Wolf#
4545182c8835SKevin Wolf# Driver specific image creation options for vpc (VHD).
4546182c8835SKevin Wolf#
4547182c8835SKevin Wolf# @file             Node to create the image format on
4548182c8835SKevin Wolf# @size             Size of the virtual disk in bytes
4549182c8835SKevin Wolf# @subformat        vhdx subformat (default: dynamic)
4550182c8835SKevin Wolf# @force-size       Force use of the exact byte size instead of rounding to the
4551182c8835SKevin Wolf#                   next size that can be represented in CHS geometry
4552182c8835SKevin Wolf#                   (default: false)
4553182c8835SKevin Wolf#
4554182c8835SKevin Wolf# Since: 2.12
4555182c8835SKevin Wolf##
4556182c8835SKevin Wolf{ 'struct': 'BlockdevCreateOptionsVpc',
4557182c8835SKevin Wolf  'data': { 'file':                 'BlockdevRef',
4558182c8835SKevin Wolf            'size':                 'size',
4559182c8835SKevin Wolf            '*subformat':           'BlockdevVpcSubformat',
4560182c8835SKevin Wolf            '*force-size':          'bool' } }
4561182c8835SKevin Wolf
4562182c8835SKevin Wolf##
456353614689SKevin Wolf# @BlockdevCreateOptions:
456453614689SKevin Wolf#
456553614689SKevin Wolf# Options for creating an image format on a given node.
456653614689SKevin Wolf#
456753614689SKevin Wolf# @driver           block driver to create the image format
456853614689SKevin Wolf#
456953614689SKevin Wolf# Since: 2.12
457053614689SKevin Wolf##
457153614689SKevin Wolf{ 'union': 'BlockdevCreateOptions',
457253614689SKevin Wolf  'base': {
457353614689SKevin Wolf      'driver':         'BlockdevDriver' },
457453614689SKevin Wolf  'discriminator': 'driver',
457553614689SKevin Wolf  'data': {
4576927f11e1SKevin Wolf      'file':           'BlockdevCreateOptionsFile',
4577ab8bda76SKevin Wolf      'gluster':        'BlockdevCreateOptionsGluster',
45781bedcaf1SKevin Wolf      'luks':           'BlockdevCreateOptionsLUKS',
4579a1a42af4SKevin Wolf      'nfs':            'BlockdevCreateOptionsNfs',
45801511b490SKevin Wolf      'parallels':      'BlockdevCreateOptionsParallels',
458142a3e1abSKevin Wolf      'qcow':           'BlockdevCreateOptionsQcow',
4582c2808abaSKevin Wolf      'qcow2':          'BlockdevCreateOptionsQcow2',
4583959355a4SKevin Wolf      'qed':            'BlockdevCreateOptionsQed',
45841bebea37SKevin Wolf      'rbd':            'BlockdevCreateOptionsRbd',
458563fd65a0SKevin Wolf      'sheepdog':       'BlockdevCreateOptionsSheepdog',
45864906da7eSKevin Wolf      'ssh':            'BlockdevCreateOptionsSsh',
4587e3810574SMax Reitz      'vdi':            'BlockdevCreateOptionsVdi',
458809b68dabSKevin Wolf      'vhdx':           'BlockdevCreateOptionsVhdx',
45893015372dSFam Zheng      'vmdk':           'BlockdevCreateOptionsVmdk',
459029cd0403SAnton Nefedov      'vpc':            'BlockdevCreateOptionsVpc'
459153614689SKevin Wolf  } }
459253614689SKevin Wolf
459353614689SKevin Wolf##
45943fb588a0SKevin Wolf# @blockdev-create:
4595b0292b85SKevin Wolf#
4596e5ab4347SKevin Wolf# Starts a job to create an image format on a given node. The job is
4597e5ab4347SKevin Wolf# automatically finalized, but a manual job-dismiss is required.
4598b0292b85SKevin Wolf#
4599e5ab4347SKevin Wolf# @job-id:          Identifier for the newly created job.
4600e5ab4347SKevin Wolf#
4601e5ab4347SKevin Wolf# @options:         Options for the image creation.
4602e5ab4347SKevin Wolf#
4603e5ab4347SKevin Wolf# Since: 3.0
4604b0292b85SKevin Wolf##
46053fb588a0SKevin Wolf{ 'command': 'blockdev-create',
4606e5ab4347SKevin Wolf  'data': { 'job-id': 'str',
4607e5ab4347SKevin Wolf            'options': 'BlockdevCreateOptions' } }
4608b0292b85SKevin Wolf
4609b0292b85SKevin Wolf##
46107d8a9f71SMax Reitz# @blockdev-open-tray:
46117d8a9f71SMax Reitz#
46127d8a9f71SMax Reitz# Opens a block device's tray. If there is a block driver state tree inserted as
46137d8a9f71SMax Reitz# a medium, it will become inaccessible to the guest (but it will remain
46147d8a9f71SMax Reitz# associated to the block device, so closing the tray will make it accessible
46157d8a9f71SMax Reitz# again).
46167d8a9f71SMax Reitz#
46177d8a9f71SMax Reitz# If the tray was already open before, this will be a no-op.
46187d8a9f71SMax Reitz#
46197d8a9f71SMax Reitz# Once the tray opens, a DEVICE_TRAY_MOVED event is emitted. There are cases in
46207d8a9f71SMax Reitz# which no such event will be generated, these include:
46217d8a9f71SMax Reitz# - if the guest has locked the tray, @force is false and the guest does not
46227d8a9f71SMax Reitz#   respond to the eject request
46237d8a9f71SMax Reitz# - if the BlockBackend denoted by @device does not have a guest device attached
46247d8a9f71SMax Reitz#   to it
462512c7ec87SMax Reitz# - if the guest device does not have an actual tray
46267d8a9f71SMax Reitz#
46271d8bda12SMarkus Armbruster# @device: Block device name (deprecated, use @id instead)
4628b33945cfSKevin Wolf#
46291d8bda12SMarkus Armbruster# @id:     The name or QOM path of the guest device (since: 2.8)
46307d8a9f71SMax Reitz#
46311d8bda12SMarkus Armbruster# @force:  if false (the default), an eject request will be sent to
46327d8a9f71SMax Reitz#          the guest if it has locked the tray (and the tray will not be opened
46337d8a9f71SMax Reitz#          immediately); if true, the tray will be opened regardless of whether
46347d8a9f71SMax Reitz#          it is locked
46357d8a9f71SMax Reitz#
46367d8a9f71SMax Reitz# Since: 2.5
46371133b1d6SMarc-André Lureau#
46381133b1d6SMarc-André Lureau# Example:
46391133b1d6SMarc-André Lureau#
46401133b1d6SMarc-André Lureau# -> { "execute": "blockdev-open-tray",
46411133b1d6SMarc-André Lureau#      "arguments": { "id": "ide0-1-0" } }
46421133b1d6SMarc-André Lureau#
46431133b1d6SMarc-André Lureau# <- { "timestamp": { "seconds": 1418751016,
46441133b1d6SMarc-André Lureau#                     "microseconds": 716996 },
46451133b1d6SMarc-André Lureau#      "event": "DEVICE_TRAY_MOVED",
46461133b1d6SMarc-André Lureau#      "data": { "device": "ide1-cd0",
46471133b1d6SMarc-André Lureau#                "id": "ide0-1-0",
46481133b1d6SMarc-André Lureau#                "tray-open": true } }
46491133b1d6SMarc-André Lureau#
46501133b1d6SMarc-André Lureau# <- { "return": {} }
46511133b1d6SMarc-André Lureau#
46527d8a9f71SMax Reitz##
46537d8a9f71SMax Reitz{ 'command': 'blockdev-open-tray',
4654b33945cfSKevin Wolf  'data': { '*device': 'str',
4655b33945cfSKevin Wolf            '*id': 'str',
46567d8a9f71SMax Reitz            '*force': 'bool' } }
46577d8a9f71SMax Reitz
4658abaaf59dSMax Reitz##
4659abaaf59dSMax Reitz# @blockdev-close-tray:
4660abaaf59dSMax Reitz#
4661abaaf59dSMax Reitz# Closes a block device's tray. If there is a block driver state tree associated
4662abaaf59dSMax Reitz# with the block device (which is currently ejected), that tree will be loaded
4663abaaf59dSMax Reitz# as the medium.
4664abaaf59dSMax Reitz#
4665abaaf59dSMax Reitz# If the tray was already closed before, this will be a no-op.
4666abaaf59dSMax Reitz#
46671d8bda12SMarkus Armbruster# @device:  Block device name (deprecated, use @id instead)
4668b33945cfSKevin Wolf#
46691d8bda12SMarkus Armbruster# @id:      The name or QOM path of the guest device (since: 2.8)
4670abaaf59dSMax Reitz#
4671abaaf59dSMax Reitz# Since: 2.5
46727f3c6f22SMarc-André Lureau#
46737f3c6f22SMarc-André Lureau# Example:
46747f3c6f22SMarc-André Lureau#
46757f3c6f22SMarc-André Lureau# -> { "execute": "blockdev-close-tray",
46767f3c6f22SMarc-André Lureau#      "arguments": { "id": "ide0-1-0" } }
46777f3c6f22SMarc-André Lureau#
46787f3c6f22SMarc-André Lureau# <- { "timestamp": { "seconds": 1418751345,
46797f3c6f22SMarc-André Lureau#                     "microseconds": 272147 },
46807f3c6f22SMarc-André Lureau#      "event": "DEVICE_TRAY_MOVED",
46817f3c6f22SMarc-André Lureau#      "data": { "device": "ide1-cd0",
46827f3c6f22SMarc-André Lureau#                "id": "ide0-1-0",
46837f3c6f22SMarc-André Lureau#                "tray-open": false } }
46847f3c6f22SMarc-André Lureau#
46857f3c6f22SMarc-André Lureau# <- { "return": {} }
46867f3c6f22SMarc-André Lureau#
4687abaaf59dSMax Reitz##
4688abaaf59dSMax Reitz{ 'command': 'blockdev-close-tray',
4689b33945cfSKevin Wolf  'data': { '*device': 'str',
4690b33945cfSKevin Wolf            '*id': 'str' } }
4691abaaf59dSMax Reitz
46922814f672SMax Reitz##
469334ce1111SMax Reitz# @blockdev-remove-medium:
46942814f672SMax Reitz#
46952814f672SMax Reitz# Removes a medium (a block driver state tree) from a block device. That block
46962814f672SMax Reitz# device's tray must currently be open (unless there is no attached guest
46972814f672SMax Reitz# device).
46982814f672SMax Reitz#
46992814f672SMax Reitz# If the tray is open and there is no medium inserted, this will be a no-op.
47002814f672SMax Reitz#
470134ce1111SMax Reitz# @id:     The name or QOM path of the guest device
470200949babSKevin Wolf#
470334ce1111SMax Reitz# Since: 2.12
47048e1c1429SMarc-André Lureau#
47058e1c1429SMarc-André Lureau# Example:
47068e1c1429SMarc-André Lureau#
470734ce1111SMax Reitz# -> { "execute": "blockdev-remove-medium",
47088e1c1429SMarc-André Lureau#      "arguments": { "id": "ide0-1-0" } }
47098e1c1429SMarc-André Lureau#
47108e1c1429SMarc-André Lureau# <- { "error": { "class": "GenericError",
47118e1c1429SMarc-André Lureau#                 "desc": "Tray of device 'ide0-1-0' is not open" } }
47128e1c1429SMarc-André Lureau#
47138e1c1429SMarc-André Lureau# -> { "execute": "blockdev-open-tray",
47148e1c1429SMarc-André Lureau#      "arguments": { "id": "ide0-1-0" } }
47158e1c1429SMarc-André Lureau#
47168e1c1429SMarc-André Lureau# <- { "timestamp": { "seconds": 1418751627,
47178e1c1429SMarc-André Lureau#                     "microseconds": 549958 },
47188e1c1429SMarc-André Lureau#      "event": "DEVICE_TRAY_MOVED",
47198e1c1429SMarc-André Lureau#      "data": { "device": "ide1-cd0",
47208e1c1429SMarc-André Lureau#                "id": "ide0-1-0",
47218e1c1429SMarc-André Lureau#                "tray-open": true } }
47228e1c1429SMarc-André Lureau#
47238e1c1429SMarc-André Lureau# <- { "return": {} }
47248e1c1429SMarc-André Lureau#
472534ce1111SMax Reitz# -> { "execute": "blockdev-remove-medium",
4726244d04dbSEric Blake#      "arguments": { "id": "ide0-1-0" } }
47278e1c1429SMarc-André Lureau#
47288e1c1429SMarc-André Lureau# <- { "return": {} }
47298e1c1429SMarc-André Lureau#
47302814f672SMax Reitz##
473134ce1111SMax Reitz{ 'command': 'blockdev-remove-medium',
473282fcf66eSMax Reitz  'data': { 'id': 'str' } }
47332814f672SMax Reitz
4734d1299882SMax Reitz##
473534ce1111SMax Reitz# @blockdev-insert-medium:
4736d1299882SMax Reitz#
4737d1299882SMax Reitz# Inserts a medium (a block driver state tree) into a block device. That block
4738d1299882SMax Reitz# device's tray must currently be open (unless there is no attached guest
4739d1299882SMax Reitz# device) and there must be no medium inserted already.
4740d1299882SMax Reitz#
474134ce1111SMax Reitz# @id:        The name or QOM path of the guest device
4742d1299882SMax Reitz#
4743d1299882SMax Reitz# @node-name: name of a node in the block driver state graph
4744d1299882SMax Reitz#
474534ce1111SMax Reitz# Since: 2.12
4746b480abf3SMarc-André Lureau#
4747b480abf3SMarc-André Lureau# Example:
4748b480abf3SMarc-André Lureau#
4749b480abf3SMarc-André Lureau# -> { "execute": "blockdev-add",
4750b480abf3SMarc-André Lureau#      "arguments": {
4751244d04dbSEric Blake#          "node-name": "node0",
4752b480abf3SMarc-André Lureau#          "driver": "raw",
4753b480abf3SMarc-André Lureau#          "file": { "driver": "file",
4754244d04dbSEric Blake#                    "filename": "fedora.iso" } } }
4755b480abf3SMarc-André Lureau# <- { "return": {} }
4756b480abf3SMarc-André Lureau#
475734ce1111SMax Reitz# -> { "execute": "blockdev-insert-medium",
4758b480abf3SMarc-André Lureau#      "arguments": { "id": "ide0-1-0",
4759b480abf3SMarc-André Lureau#                     "node-name": "node0" } }
4760b480abf3SMarc-André Lureau#
4761b480abf3SMarc-André Lureau# <- { "return": {} }
4762b480abf3SMarc-André Lureau#
4763d1299882SMax Reitz##
476434ce1111SMax Reitz{ 'command': 'blockdev-insert-medium',
476582fcf66eSMax Reitz  'data': { 'id': 'str',
4766d1299882SMax Reitz            'node-name': 'str'} }
4767d1299882SMax Reitz
4768a589569fSWenchao Xia
4769a589569fSWenchao Xia##
477039ff43d9SMax Reitz# @BlockdevChangeReadOnlyMode:
477139ff43d9SMax Reitz#
477239ff43d9SMax Reitz# Specifies the new read-only mode of a block device subject to the
477339ff43d9SMax Reitz# @blockdev-change-medium command.
477439ff43d9SMax Reitz#
477539ff43d9SMax Reitz# @retain:      Retains the current read-only mode
477639ff43d9SMax Reitz#
477739ff43d9SMax Reitz# @read-only:   Makes the device read-only
477839ff43d9SMax Reitz#
477939ff43d9SMax Reitz# @read-write:  Makes the device writable
478039ff43d9SMax Reitz#
478139ff43d9SMax Reitz# Since: 2.3
4782be3e83cbSMarc-André Lureau#
478339ff43d9SMax Reitz##
478439ff43d9SMax Reitz{ 'enum': 'BlockdevChangeReadOnlyMode',
478539ff43d9SMax Reitz  'data': ['retain', 'read-only', 'read-write'] }
478639ff43d9SMax Reitz
478739ff43d9SMax Reitz
478839ff43d9SMax Reitz##
478924fb4133SMax Reitz# @blockdev-change-medium:
479024fb4133SMax Reitz#
479124fb4133SMax Reitz# Changes the medium inserted into a block device by ejecting the current medium
479224fb4133SMax Reitz# and loading a new image file which is inserted as the new medium (this command
479334ce1111SMax Reitz# combines blockdev-open-tray, blockdev-remove-medium, blockdev-insert-medium
479434ce1111SMax Reitz# and blockdev-close-tray).
479524fb4133SMax Reitz#
47961d8bda12SMarkus Armbruster# @device:          Block device name (deprecated, use @id instead)
479770e2cb3bSKevin Wolf#
47981d8bda12SMarkus Armbruster# @id:              The name or QOM path of the guest device
479970e2cb3bSKevin Wolf#                   (since: 2.8)
480024fb4133SMax Reitz#
480124fb4133SMax Reitz# @filename:        filename of the new image to be loaded
480224fb4133SMax Reitz#
48031d8bda12SMarkus Armbruster# @format:          format to open the new image with (defaults to
480424fb4133SMax Reitz#                   the probed format)
480524fb4133SMax Reitz#
48061d8bda12SMarkus Armbruster# @read-only-mode:  change the read-only mode of the device; defaults
480739ff43d9SMax Reitz#                   to 'retain'
480839ff43d9SMax Reitz#
480924fb4133SMax Reitz# Since: 2.5
4810be3e83cbSMarc-André Lureau#
4811be3e83cbSMarc-André Lureau# Examples:
4812be3e83cbSMarc-André Lureau#
4813be3e83cbSMarc-André Lureau# 1. Change a removable medium
4814be3e83cbSMarc-André Lureau#
4815be3e83cbSMarc-André Lureau# -> { "execute": "blockdev-change-medium",
4816be3e83cbSMarc-André Lureau#      "arguments": { "id": "ide0-1-0",
4817be3e83cbSMarc-André Lureau#                     "filename": "/srv/images/Fedora-12-x86_64-DVD.iso",
4818be3e83cbSMarc-André Lureau#                     "format": "raw" } }
4819be3e83cbSMarc-André Lureau# <- { "return": {} }
4820be3e83cbSMarc-André Lureau#
4821be3e83cbSMarc-André Lureau# 2. Load a read-only medium into a writable drive
4822be3e83cbSMarc-André Lureau#
4823be3e83cbSMarc-André Lureau# -> { "execute": "blockdev-change-medium",
4824be3e83cbSMarc-André Lureau#      "arguments": { "id": "floppyA",
4825be3e83cbSMarc-André Lureau#                     "filename": "/srv/images/ro.img",
4826be3e83cbSMarc-André Lureau#                     "format": "raw",
4827be3e83cbSMarc-André Lureau#                     "read-only-mode": "retain" } }
4828be3e83cbSMarc-André Lureau#
4829be3e83cbSMarc-André Lureau# <- { "error":
4830be3e83cbSMarc-André Lureau#      { "class": "GenericError",
4831be3e83cbSMarc-André Lureau#        "desc": "Could not open '/srv/images/ro.img': Permission denied" } }
4832be3e83cbSMarc-André Lureau#
4833be3e83cbSMarc-André Lureau# -> { "execute": "blockdev-change-medium",
4834be3e83cbSMarc-André Lureau#      "arguments": { "id": "floppyA",
4835be3e83cbSMarc-André Lureau#                     "filename": "/srv/images/ro.img",
4836be3e83cbSMarc-André Lureau#                     "format": "raw",
4837be3e83cbSMarc-André Lureau#                     "read-only-mode": "read-only" } }
4838be3e83cbSMarc-André Lureau#
4839be3e83cbSMarc-André Lureau# <- { "return": {} }
4840be3e83cbSMarc-André Lureau#
484124fb4133SMax Reitz##
484224fb4133SMax Reitz{ 'command': 'blockdev-change-medium',
484370e2cb3bSKevin Wolf  'data': { '*device': 'str',
484470e2cb3bSKevin Wolf            '*id': 'str',
484524fb4133SMax Reitz            'filename': 'str',
484639ff43d9SMax Reitz            '*format': 'str',
484739ff43d9SMax Reitz            '*read-only-mode': 'BlockdevChangeReadOnlyMode' } }
484824fb4133SMax Reitz
484924fb4133SMax Reitz
485024fb4133SMax Reitz##
48515072f7b3SMarc-André Lureau# @BlockErrorAction:
4852a589569fSWenchao Xia#
4853a589569fSWenchao Xia# An enumeration of action that has been taken when a DISK I/O occurs
4854a589569fSWenchao Xia#
4855a589569fSWenchao Xia# @ignore: error has been ignored
4856a589569fSWenchao Xia#
4857a589569fSWenchao Xia# @report: error has been reported to the device
4858a589569fSWenchao Xia#
4859a589569fSWenchao Xia# @stop: error caused VM to be stopped
4860a589569fSWenchao Xia#
4861a589569fSWenchao Xia# Since: 2.1
4862a589569fSWenchao Xia##
4863a589569fSWenchao Xia{ 'enum': 'BlockErrorAction',
4864a589569fSWenchao Xia  'data': [ 'ignore', 'report', 'stop' ] }
48655a2d2cbdSWenchao Xia
48665a2d2cbdSWenchao Xia
48675a2d2cbdSWenchao Xia##
48685072f7b3SMarc-André Lureau# @BLOCK_IMAGE_CORRUPTED:
4869c120f0faSWenchao Xia#
4870370d4ebaSMarc-André Lureau# Emitted when a disk image is being marked corrupt. The image can be
4871370d4ebaSMarc-André Lureau# identified by its device or node name. The 'device' field is always
4872370d4ebaSMarc-André Lureau# present for compatibility reasons, but it can be empty ("") if the
4873370d4ebaSMarc-André Lureau# image does not have a device name associated.
4874c120f0faSWenchao Xia#
4875dc881b44SAlberto Garcia# @device: device name. This is always present for compatibility
4876dc881b44SAlberto Garcia#          reasons, but it can be empty ("") if the image does not
4877dc881b44SAlberto Garcia#          have a device name associated.
4878dc881b44SAlberto Garcia#
48791d8bda12SMarkus Armbruster# @node-name: node name (Since: 2.4)
4880c120f0faSWenchao Xia#
4881c120f0faSWenchao Xia# @msg: informative message for human consumption, such as the kind of
48822f44a08bSWenchao Xia#       corruption being detected. It should not be parsed by machine as it is
48832f44a08bSWenchao Xia#       not guaranteed to be stable
4884c120f0faSWenchao Xia#
48851d8bda12SMarkus Armbruster# @offset: if the corruption resulted from an image access, this is
48860caef8f6SAlberto Garcia#          the host's access offset into the image
4887c120f0faSWenchao Xia#
48881d8bda12SMarkus Armbruster# @size: if the corruption resulted from an image access, this is
4889c120f0faSWenchao Xia#        the access size
4890c120f0faSWenchao Xia#
4891370d4ebaSMarc-André Lureau# @fatal: if set, the image is marked corrupt and therefore unusable after this
48929bf040b9SMax Reitz#        event and must be repaired (Since 2.2; before, every
48939bf040b9SMax Reitz#        BLOCK_IMAGE_CORRUPTED event was fatal)
48949bf040b9SMax Reitz#
489507c9f583SMarc-André Lureau# Note: If action is "stop", a STOP event will eventually follow the
489607c9f583SMarc-André Lureau#       BLOCK_IO_ERROR event.
489707c9f583SMarc-André Lureau#
4898370d4ebaSMarc-André Lureau# Example:
4899370d4ebaSMarc-André Lureau#
4900370d4ebaSMarc-André Lureau# <- { "event": "BLOCK_IMAGE_CORRUPTED",
4901370d4ebaSMarc-André Lureau#      "data": { "device": "ide0-hd0", "node-name": "node0",
4902370d4ebaSMarc-André Lureau#                "msg": "Prevented active L1 table overwrite", "offset": 196608,
4903370d4ebaSMarc-André Lureau#                "size": 65536 },
4904370d4ebaSMarc-André Lureau#      "timestamp": { "seconds": 1378126126, "microseconds": 966463 } }
4905370d4ebaSMarc-André Lureau#
4906c120f0faSWenchao Xia# Since: 1.7
4907c120f0faSWenchao Xia##
4908c120f0faSWenchao Xia{ 'event': 'BLOCK_IMAGE_CORRUPTED',
4909c120f0faSWenchao Xia  'data': { 'device'     : 'str',
4910dc881b44SAlberto Garcia            '*node-name' : 'str',
4911c120f0faSWenchao Xia            'msg'        : 'str',
4912c120f0faSWenchao Xia            '*offset'    : 'int',
49139bf040b9SMax Reitz            '*size'      : 'int',
49149bf040b9SMax Reitz            'fatal'      : 'bool' } }
4915c120f0faSWenchao Xia
4916c120f0faSWenchao Xia##
49175072f7b3SMarc-André Lureau# @BLOCK_IO_ERROR:
49185a2d2cbdSWenchao Xia#
49195a2d2cbdSWenchao Xia# Emitted when a disk I/O error occurs
49205a2d2cbdSWenchao Xia#
49212bf7e10fSKevin Wolf# @device: device name. This is always present for compatibility
49222bf7e10fSKevin Wolf#          reasons, but it can be empty ("") if the image does not
49232bf7e10fSKevin Wolf#          have a device name associated.
49242bf7e10fSKevin Wolf#
49252bf7e10fSKevin Wolf# @node-name: node name. Note that errors may be reported for the root node
49262bf7e10fSKevin Wolf#             that is directly attached to a guest device rather than for the
4927bfe1a14cSKevin Wolf#             node where the error occurred. The node name is not present if
4928bfe1a14cSKevin Wolf#             the drive is empty. (Since: 2.8)
49295a2d2cbdSWenchao Xia#
49305a2d2cbdSWenchao Xia# @operation: I/O operation
49315a2d2cbdSWenchao Xia#
49325a2d2cbdSWenchao Xia# @action: action that has been taken
49335a2d2cbdSWenchao Xia#
49341d8bda12SMarkus Armbruster# @nospace: true if I/O error was caused due to a no-space
4935c7c2ff0cSLuiz Capitulino#           condition. This key is only present if query-block's
4936c7c2ff0cSLuiz Capitulino#           io-status is present, please see query-block documentation
4937c7c2ff0cSLuiz Capitulino#           for more information (since: 2.2)
4938c7c2ff0cSLuiz Capitulino#
4939624ff573SLuiz Capitulino# @reason: human readable string describing the error cause.
4940624ff573SLuiz Capitulino#          (This field is a debugging aid for humans, it should not
4941624ff573SLuiz Capitulino#           be parsed by applications) (since: 2.2)
4942624ff573SLuiz Capitulino#
49435a2d2cbdSWenchao Xia# Note: If action is "stop", a STOP event will eventually follow the
49445a2d2cbdSWenchao Xia# BLOCK_IO_ERROR event
49455a2d2cbdSWenchao Xia#
49465a2d2cbdSWenchao Xia# Since: 0.13.0
494707c9f583SMarc-André Lureau#
494807c9f583SMarc-André Lureau# Example:
494907c9f583SMarc-André Lureau#
495007c9f583SMarc-André Lureau# <- { "event": "BLOCK_IO_ERROR",
495107c9f583SMarc-André Lureau#      "data": { "device": "ide0-hd1",
495207c9f583SMarc-André Lureau#                "node-name": "#block212",
495307c9f583SMarc-André Lureau#                "operation": "write",
495407c9f583SMarc-André Lureau#                "action": "stop" },
495507c9f583SMarc-André Lureau#      "timestamp": { "seconds": 1265044230, "microseconds": 450486 } }
495607c9f583SMarc-André Lureau#
49575a2d2cbdSWenchao Xia##
49585a2d2cbdSWenchao Xia{ 'event': 'BLOCK_IO_ERROR',
4959bfe1a14cSKevin Wolf  'data': { 'device': 'str', '*node-name': 'str',
4960bfe1a14cSKevin Wolf            'operation': 'IoOperationType',
4961624ff573SLuiz Capitulino            'action': 'BlockErrorAction', '*nospace': 'bool',
4962624ff573SLuiz Capitulino            'reason': 'str' } }
49635a2d2cbdSWenchao Xia
49645a2d2cbdSWenchao Xia##
49655072f7b3SMarc-André Lureau# @BLOCK_JOB_COMPLETED:
4966bcada37bSWenchao Xia#
4967bcada37bSWenchao Xia# Emitted when a block job has completed
4968bcada37bSWenchao Xia#
4969bcada37bSWenchao Xia# @type: job type
4970bcada37bSWenchao Xia#
49716aae5be6SAlberto Garcia# @device: The job identifier. Originally the device name but other
49726aae5be6SAlberto Garcia#          values are allowed since QEMU 2.7
4973bcada37bSWenchao Xia#
4974bcada37bSWenchao Xia# @len: maximum progress value
4975bcada37bSWenchao Xia#
4976bcada37bSWenchao Xia# @offset: current progress value. On success this is equal to len.
4977bcada37bSWenchao Xia#          On failure this is less than len
4978bcada37bSWenchao Xia#
4979bcada37bSWenchao Xia# @speed: rate limit, bytes per second
4980bcada37bSWenchao Xia#
49811d8bda12SMarkus Armbruster# @error: error message. Only present on failure. This field
4982bcada37bSWenchao Xia#         contains a human-readable error message. There are no semantics
4983bcada37bSWenchao Xia#         other than that streaming has failed and clients should not try to
4984bcada37bSWenchao Xia#         interpret the error string
4985bcada37bSWenchao Xia#
4986bcada37bSWenchao Xia# Since: 1.1
4987e21e65b2SMarc-André Lureau#
4988e21e65b2SMarc-André Lureau# Example:
4989e21e65b2SMarc-André Lureau#
4990e21e65b2SMarc-André Lureau# <- { "event": "BLOCK_JOB_COMPLETED",
4991e21e65b2SMarc-André Lureau#      "data": { "type": "stream", "device": "virtio-disk0",
4992e21e65b2SMarc-André Lureau#                "len": 10737418240, "offset": 10737418240,
4993e21e65b2SMarc-André Lureau#                "speed": 0 },
4994e21e65b2SMarc-André Lureau#      "timestamp": { "seconds": 1267061043, "microseconds": 959568 } }
4995e21e65b2SMarc-André Lureau#
4996bcada37bSWenchao Xia##
4997bcada37bSWenchao Xia{ 'event': 'BLOCK_JOB_COMPLETED',
49988e4c8700SKevin Wolf  'data': { 'type'  : 'JobType',
4999bcada37bSWenchao Xia            'device': 'str',
5000bcada37bSWenchao Xia            'len'   : 'int',
5001bcada37bSWenchao Xia            'offset': 'int',
5002bcada37bSWenchao Xia            'speed' : 'int',
5003bcada37bSWenchao Xia            '*error': 'str' } }
5004bcada37bSWenchao Xia
5005bcada37bSWenchao Xia##
50065072f7b3SMarc-André Lureau# @BLOCK_JOB_CANCELLED:
5007bcada37bSWenchao Xia#
5008bcada37bSWenchao Xia# Emitted when a block job has been cancelled
5009bcada37bSWenchao Xia#
5010bcada37bSWenchao Xia# @type: job type
5011bcada37bSWenchao Xia#
50126aae5be6SAlberto Garcia# @device: The job identifier. Originally the device name but other
50136aae5be6SAlberto Garcia#          values are allowed since QEMU 2.7
5014bcada37bSWenchao Xia#
5015bcada37bSWenchao Xia# @len: maximum progress value
5016bcada37bSWenchao Xia#
5017bcada37bSWenchao Xia# @offset: current progress value. On success this is equal to len.
5018bcada37bSWenchao Xia#          On failure this is less than len
5019bcada37bSWenchao Xia#
5020bcada37bSWenchao Xia# @speed: rate limit, bytes per second
5021bcada37bSWenchao Xia#
5022bcada37bSWenchao Xia# Since: 1.1
5023e161df39SMarc-André Lureau#
5024e161df39SMarc-André Lureau# Example:
5025e161df39SMarc-André Lureau#
5026e161df39SMarc-André Lureau# <- { "event": "BLOCK_JOB_CANCELLED",
5027e161df39SMarc-André Lureau#      "data": { "type": "stream", "device": "virtio-disk0",
5028e161df39SMarc-André Lureau#                "len": 10737418240, "offset": 134217728,
5029e161df39SMarc-André Lureau#                "speed": 0 },
5030e161df39SMarc-André Lureau#      "timestamp": { "seconds": 1267061043, "microseconds": 959568 } }
5031e161df39SMarc-André Lureau#
5032bcada37bSWenchao Xia##
5033bcada37bSWenchao Xia{ 'event': 'BLOCK_JOB_CANCELLED',
50348e4c8700SKevin Wolf  'data': { 'type'  : 'JobType',
5035bcada37bSWenchao Xia            'device': 'str',
5036bcada37bSWenchao Xia            'len'   : 'int',
5037bcada37bSWenchao Xia            'offset': 'int',
5038bcada37bSWenchao Xia            'speed' : 'int' } }
5039bcada37bSWenchao Xia
5040bcada37bSWenchao Xia##
50415072f7b3SMarc-André Lureau# @BLOCK_JOB_ERROR:
50425a2d2cbdSWenchao Xia#
50435a2d2cbdSWenchao Xia# Emitted when a block job encounters an error
50445a2d2cbdSWenchao Xia#
50456aae5be6SAlberto Garcia# @device: The job identifier. Originally the device name but other
50466aae5be6SAlberto Garcia#          values are allowed since QEMU 2.7
50475a2d2cbdSWenchao Xia#
50485a2d2cbdSWenchao Xia# @operation: I/O operation
50495a2d2cbdSWenchao Xia#
50505a2d2cbdSWenchao Xia# @action: action that has been taken
50515a2d2cbdSWenchao Xia#
50525a2d2cbdSWenchao Xia# Since: 1.3
5053af0e0910SMarc-André Lureau#
5054af0e0910SMarc-André Lureau# Example:
5055af0e0910SMarc-André Lureau#
5056af0e0910SMarc-André Lureau# <- { "event": "BLOCK_JOB_ERROR",
5057af0e0910SMarc-André Lureau#      "data": { "device": "ide0-hd1",
5058af0e0910SMarc-André Lureau#                "operation": "write",
5059af0e0910SMarc-André Lureau#                "action": "stop" },
5060af0e0910SMarc-André Lureau#      "timestamp": { "seconds": 1265044230, "microseconds": 450486 } }
5061af0e0910SMarc-André Lureau#
50625a2d2cbdSWenchao Xia##
50635a2d2cbdSWenchao Xia{ 'event': 'BLOCK_JOB_ERROR',
50645a2d2cbdSWenchao Xia  'data': { 'device'   : 'str',
50655a2d2cbdSWenchao Xia            'operation': 'IoOperationType',
5066823c6863SMarkus Armbruster            'action'   : 'BlockErrorAction' } }
5067bcada37bSWenchao Xia
5068bcada37bSWenchao Xia##
50695072f7b3SMarc-André Lureau# @BLOCK_JOB_READY:
5070bcada37bSWenchao Xia#
5071bcada37bSWenchao Xia# Emitted when a block job is ready to complete
5072bcada37bSWenchao Xia#
5073518848a2SMarkus Armbruster# @type: job type
5074518848a2SMarkus Armbruster#
50756aae5be6SAlberto Garcia# @device: The job identifier. Originally the device name but other
50766aae5be6SAlberto Garcia#          values are allowed since QEMU 2.7
5077bcada37bSWenchao Xia#
5078518848a2SMarkus Armbruster# @len: maximum progress value
5079518848a2SMarkus Armbruster#
5080518848a2SMarkus Armbruster# @offset: current progress value. On success this is equal to len.
5081518848a2SMarkus Armbruster#          On failure this is less than len
5082518848a2SMarkus Armbruster#
5083518848a2SMarkus Armbruster# @speed: rate limit, bytes per second
5084518848a2SMarkus Armbruster#
5085bcada37bSWenchao Xia# Note: The "ready to complete" status is always reset by a @BLOCK_JOB_ERROR
5086bcada37bSWenchao Xia# event
5087bcada37bSWenchao Xia#
5088bcada37bSWenchao Xia# Since: 1.3
508911a3dee1SMarc-André Lureau#
509011a3dee1SMarc-André Lureau# Example:
509111a3dee1SMarc-André Lureau#
509211a3dee1SMarc-André Lureau# <- { "event": "BLOCK_JOB_READY",
509311a3dee1SMarc-André Lureau#      "data": { "device": "drive0", "type": "mirror", "speed": 0,
509411a3dee1SMarc-André Lureau#                "len": 2097152, "offset": 2097152 }
509511a3dee1SMarc-André Lureau#      "timestamp": { "seconds": 1265044230, "microseconds": 450486 } }
509611a3dee1SMarc-André Lureau#
5097bcada37bSWenchao Xia##
5098bcada37bSWenchao Xia{ 'event': 'BLOCK_JOB_READY',
50998e4c8700SKevin Wolf  'data': { 'type'  : 'JobType',
5100518848a2SMarkus Armbruster            'device': 'str',
5101518848a2SMarkus Armbruster            'len'   : 'int',
5102518848a2SMarkus Armbruster            'offset': 'int',
5103518848a2SMarkus Armbruster            'speed' : 'int' } }
5104ffeaac9bSHu Tao
510549687aceSMarc-André Lureau##
51065f241594SJohn Snow# @BLOCK_JOB_PENDING:
51075f241594SJohn Snow#
51085f241594SJohn Snow# Emitted when a block job is awaiting explicit authorization to finalize graph
51095f241594SJohn Snow# changes via @block-job-finalize. If this job is part of a transaction, it will
51105f241594SJohn Snow# not emit this event until the transaction has converged first.
51115f241594SJohn Snow#
51125f241594SJohn Snow# @type: job type
51135f241594SJohn Snow#
51145f241594SJohn Snow# @id: The job identifier.
51155f241594SJohn Snow#
51165f241594SJohn Snow# Since: 2.12
51175f241594SJohn Snow#
51185f241594SJohn Snow# Example:
51195f241594SJohn Snow#
51205f241594SJohn Snow# <- { "event": "BLOCK_JOB_WAITING",
51215f241594SJohn Snow#      "data": { "device": "drive0", "type": "mirror" },
51225f241594SJohn Snow#      "timestamp": { "seconds": 1265044230, "microseconds": 450486 } }
51235f241594SJohn Snow#
51245f241594SJohn Snow##
51255f241594SJohn Snow{ 'event': 'BLOCK_JOB_PENDING',
51268e4c8700SKevin Wolf  'data': { 'type'  : 'JobType',
51275f241594SJohn Snow            'id'    : 'str' } }
51285f241594SJohn Snow
51295f241594SJohn Snow##
51305072f7b3SMarc-André Lureau# @PreallocMode:
5131ffeaac9bSHu Tao#
5132ffeaac9bSHu Tao# Preallocation mode of QEMU image file
5133ffeaac9bSHu Tao#
5134ffeaac9bSHu Tao# @off: no preallocation
5135ffeaac9bSHu Tao# @metadata: preallocate only for metadata
5136ffeaac9bSHu Tao# @falloc: like @full preallocation but allocate disk space by
5137ffeaac9bSHu Tao#          posix_fallocate() rather than writing zeros.
5138ffeaac9bSHu Tao# @full: preallocate all data by writing zeros to device to ensure disk
5139ffeaac9bSHu Tao#        space is really available. @full preallocation also sets up
5140ffeaac9bSHu Tao#        metadata correctly.
5141ffeaac9bSHu Tao#
51425072f7b3SMarc-André Lureau# Since: 2.2
5143ffeaac9bSHu Tao##
5144ffeaac9bSHu Tao{ 'enum': 'PreallocMode',
5145ffeaac9bSHu Tao  'data': [ 'off', 'metadata', 'falloc', 'full' ] }
5146e2462113SFrancesco Romani
5147e2462113SFrancesco Romani##
51485072f7b3SMarc-André Lureau# @BLOCK_WRITE_THRESHOLD:
5149e2462113SFrancesco Romani#
5150e2462113SFrancesco Romani# Emitted when writes on block device reaches or exceeds the
5151e2462113SFrancesco Romani# configured write threshold. For thin-provisioned devices, this
5152e2462113SFrancesco Romani# means the device should be extended to avoid pausing for
5153e2462113SFrancesco Romani# disk exhaustion.
5154e2462113SFrancesco Romani# The event is one shot. Once triggered, it needs to be
5155f85d66f4SEric Blake# re-registered with another block-set-write-threshold command.
5156e2462113SFrancesco Romani#
5157e2462113SFrancesco Romani# @node-name: graph node name on which the threshold was exceeded.
5158e2462113SFrancesco Romani#
5159e2462113SFrancesco Romani# @amount-exceeded: amount of data which exceeded the threshold, in bytes.
5160e2462113SFrancesco Romani#
5161e2462113SFrancesco Romani# @write-threshold: last configured threshold, in bytes.
5162e2462113SFrancesco Romani#
5163e2462113SFrancesco Romani# Since: 2.3
5164e2462113SFrancesco Romani##
5165e2462113SFrancesco Romani{ 'event': 'BLOCK_WRITE_THRESHOLD',
5166e2462113SFrancesco Romani  'data': { 'node-name': 'str',
5167e2462113SFrancesco Romani            'amount-exceeded': 'uint64',
5168e2462113SFrancesco Romani            'write-threshold': 'uint64' } }
5169e2462113SFrancesco Romani
5170e2462113SFrancesco Romani##
51715072f7b3SMarc-André Lureau# @block-set-write-threshold:
5172e2462113SFrancesco Romani#
5173e817862bSMarc-André Lureau# Change the write threshold for a block drive. An event will be
5174e817862bSMarc-André Lureau# delivered if a write to this block drive crosses the configured
5175e817862bSMarc-André Lureau# threshold.  The threshold is an offset, thus must be
5176e817862bSMarc-André Lureau# non-negative. Default is no write threshold. Setting the threshold
5177e817862bSMarc-André Lureau# to zero disables it.
5178e817862bSMarc-André Lureau#
5179e2462113SFrancesco Romani# This is useful to transparently resize thin-provisioned drives without
5180e2462113SFrancesco Romani# the guest OS noticing.
5181e2462113SFrancesco Romani#
5182e2462113SFrancesco Romani# @node-name: graph node name on which the threshold must be set.
5183e2462113SFrancesco Romani#
5184e2462113SFrancesco Romani# @write-threshold: configured threshold for the block device, bytes.
5185e2462113SFrancesco Romani#                   Use 0 to disable the threshold.
5186e2462113SFrancesco Romani#
5187e2462113SFrancesco Romani# Since: 2.3
5188e817862bSMarc-André Lureau#
5189e817862bSMarc-André Lureau# Example:
5190e817862bSMarc-André Lureau#
5191e817862bSMarc-André Lureau# -> { "execute": "block-set-write-threshold",
5192e817862bSMarc-André Lureau#      "arguments": { "node-name": "mydev",
5193e817862bSMarc-André Lureau#                     "write-threshold": 17179869184 } }
5194e817862bSMarc-André Lureau# <- { "return": {} }
5195e817862bSMarc-André Lureau#
5196e2462113SFrancesco Romani##
5197e2462113SFrancesco Romani{ 'command': 'block-set-write-threshold',
5198e2462113SFrancesco Romani  'data': { 'node-name': 'str', 'write-threshold': 'uint64' } }
51997f821597SWen Congyang
52007f821597SWen Congyang##
52015072f7b3SMarc-André Lureau# @x-blockdev-change:
52027f821597SWen Congyang#
52037f821597SWen Congyang# Dynamically reconfigure the block driver state graph. It can be used
52047f821597SWen Congyang# to add, remove, insert or replace a graph node. Currently only the
52057f821597SWen Congyang# Quorum driver implements this feature to add or remove its child. This
52067f821597SWen Congyang# is useful to fix a broken quorum child.
52077f821597SWen Congyang#
52087f821597SWen Congyang# If @node is specified, it will be inserted under @parent. @child
52097f821597SWen Congyang# may not be specified in this case. If both @parent and @child are
52107f821597SWen Congyang# specified but @node is not, @child will be detached from @parent.
52117f821597SWen Congyang#
52127f821597SWen Congyang# @parent: the id or name of the parent node.
52137f821597SWen Congyang#
52141d8bda12SMarkus Armbruster# @child: the name of a child under the given parent node.
52157f821597SWen Congyang#
52161d8bda12SMarkus Armbruster# @node: the name of the node that will be added.
52177f821597SWen Congyang#
52187f821597SWen Congyang# Note: this command is experimental, and its API is not stable. It
52197f821597SWen Congyang# does not support all kinds of operations, all kinds of children, nor
52207f821597SWen Congyang# all block drivers.
52217f821597SWen Congyang#
52226b4738ceSKevin Wolf# FIXME Removing children from a quorum node means introducing gaps in the
52236b4738ceSKevin Wolf# child indices. This cannot be represented in the 'children' list of
52246b4738ceSKevin Wolf# BlockdevOptionsQuorum, as returned by .bdrv_refresh_filename().
52256b4738ceSKevin Wolf#
52267f821597SWen Congyang# Warning: The data in a new quorum child MUST be consistent with that of
52277f821597SWen Congyang# the rest of the array.
52287f821597SWen Congyang#
52297f821597SWen Congyang# Since: 2.7
5230bd77ea2eSMarc-André Lureau#
5231bd77ea2eSMarc-André Lureau# Example:
5232bd77ea2eSMarc-André Lureau#
5233bd77ea2eSMarc-André Lureau# 1. Add a new node to a quorum
5234bd77ea2eSMarc-André Lureau# -> { "execute": "blockdev-add",
5235bd77ea2eSMarc-André Lureau#      "arguments": {
5236244d04dbSEric Blake#          "driver": "raw",
5237bd77ea2eSMarc-André Lureau#          "node-name": "new_node",
5238bd77ea2eSMarc-André Lureau#          "file": { "driver": "file",
5239244d04dbSEric Blake#                    "filename": "test.raw" } } }
5240bd77ea2eSMarc-André Lureau# <- { "return": {} }
5241bd77ea2eSMarc-André Lureau# -> { "execute": "x-blockdev-change",
5242bd77ea2eSMarc-André Lureau#      "arguments": { "parent": "disk1",
5243bd77ea2eSMarc-André Lureau#                     "node": "new_node" } }
5244bd77ea2eSMarc-André Lureau# <- { "return": {} }
5245bd77ea2eSMarc-André Lureau#
5246bd77ea2eSMarc-André Lureau# 2. Delete a quorum's node
5247bd77ea2eSMarc-André Lureau# -> { "execute": "x-blockdev-change",
5248bd77ea2eSMarc-André Lureau#      "arguments": { "parent": "disk1",
5249bd77ea2eSMarc-André Lureau#                     "child": "children.1" } }
5250bd77ea2eSMarc-André Lureau# <- { "return": {} }
5251bd77ea2eSMarc-André Lureau#
52527f821597SWen Congyang##
52537f821597SWen Congyang{ 'command': 'x-blockdev-change',
52547f821597SWen Congyang  'data' : { 'parent': 'str',
52557f821597SWen Congyang             '*child': 'str',
52567f821597SWen Congyang             '*node': 'str' } }
5257ca00bbb1SStefan Hajnoczi
5258ca00bbb1SStefan Hajnoczi##
5259ca00bbb1SStefan Hajnoczi# @x-blockdev-set-iothread:
5260ca00bbb1SStefan Hajnoczi#
5261ca00bbb1SStefan Hajnoczi# Move @node and its children into the @iothread.  If @iothread is null then
5262ca00bbb1SStefan Hajnoczi# move @node and its children into the main loop.
5263ca00bbb1SStefan Hajnoczi#
5264ca00bbb1SStefan Hajnoczi# The node must not be attached to a BlockBackend.
5265ca00bbb1SStefan Hajnoczi#
5266ca00bbb1SStefan Hajnoczi# @node-name: the name of the block driver node
5267ca00bbb1SStefan Hajnoczi#
5268ca00bbb1SStefan Hajnoczi# @iothread: the name of the IOThread object or null for the main loop
5269ca00bbb1SStefan Hajnoczi#
5270882e9b89SStefan Hajnoczi# @force: true if the node and its children should be moved when a BlockBackend
5271882e9b89SStefan Hajnoczi#         is already attached
5272882e9b89SStefan Hajnoczi#
5273ca00bbb1SStefan Hajnoczi# Note: this command is experimental and intended for test cases that need
5274ca00bbb1SStefan Hajnoczi# control over IOThreads only.
5275ca00bbb1SStefan Hajnoczi#
5276ca00bbb1SStefan Hajnoczi# Since: 2.12
5277ca00bbb1SStefan Hajnoczi#
5278ca00bbb1SStefan Hajnoczi# Example:
5279ca00bbb1SStefan Hajnoczi#
5280ca00bbb1SStefan Hajnoczi# 1. Move a node into an IOThread
5281ca00bbb1SStefan Hajnoczi# -> { "execute": "x-blockdev-set-iothread",
5282ca00bbb1SStefan Hajnoczi#      "arguments": { "node-name": "disk1",
5283ca00bbb1SStefan Hajnoczi#                     "iothread": "iothread0" } }
5284ca00bbb1SStefan Hajnoczi# <- { "return": {} }
5285ca00bbb1SStefan Hajnoczi#
5286ca00bbb1SStefan Hajnoczi# 2. Move a node into the main loop
5287ca00bbb1SStefan Hajnoczi# -> { "execute": "x-blockdev-set-iothread",
5288ca00bbb1SStefan Hajnoczi#      "arguments": { "node-name": "disk1",
5289ca00bbb1SStefan Hajnoczi#                     "iothread": null } }
5290ca00bbb1SStefan Hajnoczi# <- { "return": {} }
5291ca00bbb1SStefan Hajnoczi#
5292ca00bbb1SStefan Hajnoczi##
5293ca00bbb1SStefan Hajnoczi{ 'command': 'x-blockdev-set-iothread',
5294ca00bbb1SStefan Hajnoczi  'data' : { 'node-name': 'str',
5295882e9b89SStefan Hajnoczi             'iothread': 'StrOrNull',
5296882e9b89SStefan Hajnoczi             '*force': 'bool' } }
5297