xref: /openbmc/qemu/qapi/block-core.json (revision af0e09106c57e732234eaf9bea5973437b3711d5)
15db15096SBenoît Canet# -*- Mode: Python -*-
2d3a48372SMarc-André Lureau
3d3a48372SMarc-André Lureau##
4d3a48372SMarc-André Lureau# == QAPI block core definitions (vm unrelated)
5d3a48372SMarc-André Lureau##
65db15096SBenoît Canet
75db15096SBenoît Canet# QAPI common definitions
85db15096SBenoît Canet{ 'include': 'common.json' }
91ad166b6SBenoît Canet
101ad166b6SBenoît Canet##
115072f7b3SMarc-André Lureau# @SnapshotInfo:
121ad166b6SBenoît Canet#
131ad166b6SBenoît Canet# @id: unique snapshot id
141ad166b6SBenoît Canet#
151ad166b6SBenoît Canet# @name: user chosen name
161ad166b6SBenoît Canet#
171ad166b6SBenoît Canet# @vm-state-size: size of the VM state
181ad166b6SBenoît Canet#
191ad166b6SBenoît Canet# @date-sec: UTC date of the snapshot in seconds
201ad166b6SBenoît Canet#
211ad166b6SBenoît Canet# @date-nsec: fractional part in nano seconds to be used with date-sec
221ad166b6SBenoît Canet#
231ad166b6SBenoît Canet# @vm-clock-sec: VM clock relative to boot in seconds
241ad166b6SBenoît Canet#
251ad166b6SBenoît Canet# @vm-clock-nsec: fractional part in nano seconds to be used with vm-clock-sec
261ad166b6SBenoît Canet#
271ad166b6SBenoît Canet# Since: 1.3
281ad166b6SBenoît Canet#
291ad166b6SBenoît Canet##
30895a2a80SEric Blake{ 'struct': 'SnapshotInfo',
311ad166b6SBenoît Canet  'data': { 'id': 'str', 'name': 'str', 'vm-state-size': 'int',
321ad166b6SBenoît Canet            'date-sec': 'int', 'date-nsec': 'int',
331ad166b6SBenoît Canet            'vm-clock-sec': 'int', 'vm-clock-nsec': 'int' } }
341ad166b6SBenoît Canet
351ad166b6SBenoît Canet##
361ad166b6SBenoît Canet# @ImageInfoSpecificQCow2:
371ad166b6SBenoît Canet#
381ad166b6SBenoît Canet# @compat: compatibility level
391ad166b6SBenoît Canet#
401ad166b6SBenoît Canet# @lazy-refcounts: #optional on or off; only valid for compat >= 1.1
411ad166b6SBenoît Canet#
429009b196SMax Reitz# @corrupt: #optional true if the image has been marked corrupt; only valid for
439009b196SMax Reitz#           compat >= 1.1 (since 2.2)
449009b196SMax Reitz#
450709c5a1SMax Reitz# @refcount-bits: width of a refcount entry in bits (since 2.3)
460709c5a1SMax Reitz#
471ad166b6SBenoît Canet# Since: 1.7
481ad166b6SBenoît Canet##
49895a2a80SEric Blake{ 'struct': 'ImageInfoSpecificQCow2',
501ad166b6SBenoît Canet  'data': {
511ad166b6SBenoît Canet      'compat': 'str',
529009b196SMax Reitz      '*lazy-refcounts': 'bool',
530709c5a1SMax Reitz      '*corrupt': 'bool',
540709c5a1SMax Reitz      'refcount-bits': 'int'
551ad166b6SBenoît Canet  } }
561ad166b6SBenoît Canet
571ad166b6SBenoît Canet##
581ad166b6SBenoît Canet# @ImageInfoSpecificVmdk:
591ad166b6SBenoît Canet#
601ad166b6SBenoît Canet# @create-type: The create type of VMDK image
611ad166b6SBenoît Canet#
621ad166b6SBenoît Canet# @cid: Content id of image
631ad166b6SBenoît Canet#
641ad166b6SBenoît Canet# @parent-cid: Parent VMDK image's cid
651ad166b6SBenoît Canet#
661ad166b6SBenoît Canet# @extents: List of extent files
671ad166b6SBenoît Canet#
681ad166b6SBenoît Canet# Since: 1.7
691ad166b6SBenoît Canet##
70895a2a80SEric Blake{ 'struct': 'ImageInfoSpecificVmdk',
711ad166b6SBenoît Canet  'data': {
721ad166b6SBenoît Canet      'create-type': 'str',
731ad166b6SBenoît Canet      'cid': 'int',
741ad166b6SBenoît Canet      'parent-cid': 'int',
751ad166b6SBenoît Canet      'extents': ['ImageInfo']
761ad166b6SBenoît Canet  } }
771ad166b6SBenoît Canet
781ad166b6SBenoît Canet##
791ad166b6SBenoît Canet# @ImageInfoSpecific:
801ad166b6SBenoît Canet#
811ad166b6SBenoît Canet# A discriminated record of image format specific information structures.
821ad166b6SBenoît Canet#
831ad166b6SBenoît Canet# Since: 1.7
841ad166b6SBenoît Canet##
851ad166b6SBenoît Canet{ 'union': 'ImageInfoSpecific',
861ad166b6SBenoît Canet  'data': {
871ad166b6SBenoît Canet      'qcow2': 'ImageInfoSpecificQCow2',
88c7c4cf49SDaniel P. Berrange      'vmdk': 'ImageInfoSpecificVmdk',
89c7c4cf49SDaniel P. Berrange      # If we need to add block driver specific parameters for
90c7c4cf49SDaniel P. Berrange      # LUKS in future, then we'll subclass QCryptoBlockInfoLUKS
91c7c4cf49SDaniel P. Berrange      # to define a ImageInfoSpecificLUKS
92c7c4cf49SDaniel P. Berrange      'luks': 'QCryptoBlockInfoLUKS'
931ad166b6SBenoît Canet  } }
941ad166b6SBenoît Canet
951ad166b6SBenoît Canet##
961ad166b6SBenoît Canet# @ImageInfo:
971ad166b6SBenoît Canet#
981ad166b6SBenoît Canet# Information about a QEMU image file
991ad166b6SBenoît Canet#
1001ad166b6SBenoît Canet# @filename: name of the image file
1011ad166b6SBenoît Canet#
1021ad166b6SBenoît Canet# @format: format of the image file
1031ad166b6SBenoît Canet#
1041ad166b6SBenoît Canet# @virtual-size: maximum capacity in bytes of the image
1051ad166b6SBenoît Canet#
1061ad166b6SBenoît Canet# @actual-size: #optional actual size on disk in bytes of the image
1071ad166b6SBenoît Canet#
1081ad166b6SBenoît Canet# @dirty-flag: #optional true if image is not cleanly closed
1091ad166b6SBenoît Canet#
1101ad166b6SBenoît Canet# @cluster-size: #optional size of a cluster in bytes
1111ad166b6SBenoît Canet#
1121ad166b6SBenoît Canet# @encrypted: #optional true if the image is encrypted
1131ad166b6SBenoît Canet#
1141ad166b6SBenoît Canet# @compressed: #optional true if the image is compressed (Since 1.7)
1151ad166b6SBenoît Canet#
1161ad166b6SBenoît Canet# @backing-filename: #optional name of the backing file
1171ad166b6SBenoît Canet#
1181ad166b6SBenoît Canet# @full-backing-filename: #optional full path of the backing file
1191ad166b6SBenoît Canet#
1201ad166b6SBenoît Canet# @backing-filename-format: #optional the format of the backing file
1211ad166b6SBenoît Canet#
1221ad166b6SBenoît Canet# @snapshots: #optional list of VM snapshots
1231ad166b6SBenoît Canet#
1241ad166b6SBenoît Canet# @backing-image: #optional info of the backing image (since 1.6)
1251ad166b6SBenoît Canet#
1261ad166b6SBenoît Canet# @format-specific: #optional structure supplying additional format-specific
1271ad166b6SBenoît Canet# information (since 1.7)
1281ad166b6SBenoît Canet#
1291ad166b6SBenoît Canet# Since: 1.3
1301ad166b6SBenoît Canet#
1311ad166b6SBenoît Canet##
132895a2a80SEric Blake{ 'struct': 'ImageInfo',
1331ad166b6SBenoît Canet  'data': {'filename': 'str', 'format': 'str', '*dirty-flag': 'bool',
1341ad166b6SBenoît Canet           '*actual-size': 'int', 'virtual-size': 'int',
1351ad166b6SBenoît Canet           '*cluster-size': 'int', '*encrypted': 'bool', '*compressed': 'bool',
1361ad166b6SBenoît Canet           '*backing-filename': 'str', '*full-backing-filename': 'str',
1371ad166b6SBenoît Canet           '*backing-filename-format': 'str', '*snapshots': ['SnapshotInfo'],
1381ad166b6SBenoît Canet           '*backing-image': 'ImageInfo',
13924bf10daSKevin Wolf           '*format-specific': 'ImageInfoSpecific' } }
1401ad166b6SBenoît Canet
1411ad166b6SBenoît Canet##
1421ad166b6SBenoît Canet# @ImageCheck:
1431ad166b6SBenoît Canet#
1441ad166b6SBenoît Canet# Information about a QEMU image file check
1451ad166b6SBenoît Canet#
1461ad166b6SBenoît Canet# @filename: name of the image file checked
1471ad166b6SBenoît Canet#
1481ad166b6SBenoît Canet# @format: format of the image file checked
1491ad166b6SBenoît Canet#
1501ad166b6SBenoît Canet# @check-errors: number of unexpected errors occurred during check
1511ad166b6SBenoît Canet#
1521ad166b6SBenoît Canet# @image-end-offset: #optional offset (in bytes) where the image ends, this
1531ad166b6SBenoît Canet#                    field is present if the driver for the image format
1541ad166b6SBenoît Canet#                    supports it
1551ad166b6SBenoît Canet#
1561ad166b6SBenoît Canet# @corruptions: #optional number of corruptions found during the check if any
1571ad166b6SBenoît Canet#
1581ad166b6SBenoît Canet# @leaks: #optional number of leaks found during the check if any
1591ad166b6SBenoît Canet#
1601ad166b6SBenoît Canet# @corruptions-fixed: #optional number of corruptions fixed during the check
1611ad166b6SBenoît Canet#                     if any
1621ad166b6SBenoît Canet#
1631ad166b6SBenoît Canet# @leaks-fixed: #optional number of leaks fixed during the check if any
1641ad166b6SBenoît Canet#
1651ad166b6SBenoît Canet# @total-clusters: #optional total number of clusters, this field is present
1661ad166b6SBenoît Canet#                  if the driver for the image format supports it
1671ad166b6SBenoît Canet#
1681ad166b6SBenoît Canet# @allocated-clusters: #optional total number of allocated clusters, this
1691ad166b6SBenoît Canet#                      field is present if the driver for the image format
1701ad166b6SBenoît Canet#                      supports it
1711ad166b6SBenoît Canet#
1721ad166b6SBenoît Canet# @fragmented-clusters: #optional total number of fragmented clusters, this
1731ad166b6SBenoît Canet#                       field is present if the driver for the image format
1741ad166b6SBenoît Canet#                       supports it
1751ad166b6SBenoît Canet#
1761ad166b6SBenoît Canet# @compressed-clusters: #optional total number of compressed clusters, this
1771ad166b6SBenoît Canet#                       field is present if the driver for the image format
1781ad166b6SBenoît Canet#                       supports it
1791ad166b6SBenoît Canet#
1801ad166b6SBenoît Canet# Since: 1.4
1811ad166b6SBenoît Canet#
1821ad166b6SBenoît Canet##
183895a2a80SEric Blake{ 'struct': 'ImageCheck',
1841ad166b6SBenoît Canet  'data': {'filename': 'str', 'format': 'str', 'check-errors': 'int',
1851ad166b6SBenoît Canet           '*image-end-offset': 'int', '*corruptions': 'int', '*leaks': 'int',
1861ad166b6SBenoît Canet           '*corruptions-fixed': 'int', '*leaks-fixed': 'int',
1871ad166b6SBenoît Canet           '*total-clusters': 'int', '*allocated-clusters': 'int',
1881ad166b6SBenoît Canet           '*fragmented-clusters': 'int', '*compressed-clusters': 'int' } }
1891ad166b6SBenoît Canet
1901ad166b6SBenoît Canet##
19116b0d555SFam Zheng# @MapEntry:
19216b0d555SFam Zheng#
19316b0d555SFam Zheng# Mapping information from a virtual block range to a host file range
19416b0d555SFam Zheng#
19516b0d555SFam Zheng# @start: the start byte of the mapped virtual range
19616b0d555SFam Zheng#
19716b0d555SFam Zheng# @length: the number of bytes of the mapped virtual range
19816b0d555SFam Zheng#
19916b0d555SFam Zheng# @data: whether the mapped range has data
20016b0d555SFam Zheng#
20116b0d555SFam Zheng# @zero: whether the virtual blocks are zeroed
20216b0d555SFam Zheng#
20316b0d555SFam Zheng# @depth: the depth of the mapping
20416b0d555SFam Zheng#
20516b0d555SFam Zheng# @offset: #optional the offset in file that the virtual sectors are mapped to
20616b0d555SFam Zheng#
20716b0d555SFam Zheng# @filename: #optional filename that is referred to by @offset
20816b0d555SFam Zheng#
20916b0d555SFam Zheng# Since: 2.6
21016b0d555SFam Zheng#
21116b0d555SFam Zheng##
21216b0d555SFam Zheng{ 'struct': 'MapEntry',
21316b0d555SFam Zheng  'data': {'start': 'int', 'length': 'int', 'data': 'bool',
21416b0d555SFam Zheng           'zero': 'bool', 'depth': 'int', '*offset': 'int',
21516b0d555SFam Zheng           '*filename': 'str' } }
21616b0d555SFam Zheng
21716b0d555SFam Zheng##
2185072f7b3SMarc-André Lureau# @BlockdevCacheInfo:
2199e193c5aSKevin Wolf#
2209e193c5aSKevin Wolf# Cache mode information for a block device
2219e193c5aSKevin Wolf#
2229e193c5aSKevin Wolf# @writeback:   true if writeback mode is enabled
2239e193c5aSKevin Wolf# @direct:      true if the host page cache is bypassed (O_DIRECT)
2249e193c5aSKevin Wolf# @no-flush:    true if flush requests are ignored for the device
2259e193c5aSKevin Wolf#
2269e193c5aSKevin Wolf# Since: 2.3
2279e193c5aSKevin Wolf##
228895a2a80SEric Blake{ 'struct': 'BlockdevCacheInfo',
2299e193c5aSKevin Wolf  'data': { 'writeback': 'bool',
2309e193c5aSKevin Wolf            'direct': 'bool',
2319e193c5aSKevin Wolf            'no-flush': 'bool' } }
2329e193c5aSKevin Wolf
2339e193c5aSKevin Wolf##
2341ad166b6SBenoît Canet# @BlockDeviceInfo:
2351ad166b6SBenoît Canet#
2361ad166b6SBenoît Canet# Information about the backing device for a block device.
2371ad166b6SBenoît Canet#
2381ad166b6SBenoît Canet# @file: the filename of the backing device
2391ad166b6SBenoît Canet#
2401ad166b6SBenoît Canet# @node-name: #optional the name of the block driver node (Since 2.0)
2411ad166b6SBenoît Canet#
2421ad166b6SBenoît Canet# @ro: true if the backing device was open read-only
2431ad166b6SBenoît Canet#
2441ad166b6SBenoît Canet# @drv: the name of the block format used to open the backing device. As of
2451ad166b6SBenoît Canet#       0.14.0 this can be: 'blkdebug', 'bochs', 'cloop', 'cow', 'dmg',
2461ad166b6SBenoît Canet#       'file', 'file', 'ftp', 'ftps', 'host_cdrom', 'host_device',
24778368575SDaniel P. Berrange#       'http', 'https', 'luks', 'nbd', 'parallels', 'qcow',
24823dce387SMax Reitz#       'qcow2', 'raw', 'vdi', 'vmdk', 'vpc', 'vvfat'
249550830f9SStefan Hajnoczi#       2.2: 'archipelago' added, 'cow' dropped
25092a539d2SMarkus Armbruster#       2.3: 'host_floppy' deprecated
251f709623bSMax Reitz#       2.5: 'host_floppy' dropped
25278368575SDaniel P. Berrange#       2.6: 'luks' added
25323dce387SMax Reitz#       2.8: 'replication' added, 'tftp' dropped
2541ad166b6SBenoît Canet#
2551ad166b6SBenoît Canet# @backing_file: #optional the name of the backing file (for copy-on-write)
2561ad166b6SBenoît Canet#
2571ad166b6SBenoît Canet# @backing_file_depth: number of files in the backing file chain (since: 1.2)
2581ad166b6SBenoît Canet#
2591ad166b6SBenoît Canet# @encrypted: true if the backing device is encrypted
2601ad166b6SBenoît Canet#
2611ad166b6SBenoît Canet# @encryption_key_missing: true if the backing device is encrypted but an
2621ad166b6SBenoît Canet#                          valid encryption key is missing
2631ad166b6SBenoît Canet#
2641ad166b6SBenoît Canet# @detect_zeroes: detect and optimize zero writes (Since 2.1)
2651ad166b6SBenoît Canet#
2661ad166b6SBenoît Canet# @bps: total throughput limit in bytes per second is specified
2671ad166b6SBenoît Canet#
2681ad166b6SBenoît Canet# @bps_rd: read throughput limit in bytes per second is specified
2691ad166b6SBenoît Canet#
2701ad166b6SBenoît Canet# @bps_wr: write throughput limit in bytes per second is specified
2711ad166b6SBenoît Canet#
2721ad166b6SBenoît Canet# @iops: total I/O operations per second is specified
2731ad166b6SBenoît Canet#
2741ad166b6SBenoît Canet# @iops_rd: read I/O operations per second is specified
2751ad166b6SBenoît Canet#
2761ad166b6SBenoît Canet# @iops_wr: write I/O operations per second is specified
2771ad166b6SBenoît Canet#
2781ad166b6SBenoît Canet# @image: the info of image used (since: 1.6)
2791ad166b6SBenoît Canet#
280398befdfSAlberto Garcia# @bps_max: #optional total throughput limit during bursts,
281398befdfSAlberto Garcia#                     in bytes (Since 1.7)
2821ad166b6SBenoît Canet#
283398befdfSAlberto Garcia# @bps_rd_max: #optional read throughput limit during bursts,
284398befdfSAlberto Garcia#                        in bytes (Since 1.7)
2851ad166b6SBenoît Canet#
286398befdfSAlberto Garcia# @bps_wr_max: #optional write throughput limit during bursts,
287398befdfSAlberto Garcia#                        in bytes (Since 1.7)
2881ad166b6SBenoît Canet#
289398befdfSAlberto Garcia# @iops_max: #optional total I/O operations per second during bursts,
290398befdfSAlberto Garcia#                      in bytes (Since 1.7)
2911ad166b6SBenoît Canet#
292398befdfSAlberto Garcia# @iops_rd_max: #optional read I/O operations per second during bursts,
293398befdfSAlberto Garcia#                         in bytes (Since 1.7)
2941ad166b6SBenoît Canet#
295398befdfSAlberto Garcia# @iops_wr_max: #optional write I/O operations per second during bursts,
296398befdfSAlberto Garcia#                         in bytes (Since 1.7)
297398befdfSAlberto Garcia#
298398befdfSAlberto Garcia# @bps_max_length: #optional maximum length of the @bps_max burst
299398befdfSAlberto Garcia#                            period, in seconds. (Since 2.6)
300398befdfSAlberto Garcia#
301398befdfSAlberto Garcia# @bps_rd_max_length: #optional maximum length of the @bps_rd_max
302398befdfSAlberto Garcia#                               burst period, in seconds. (Since 2.6)
303398befdfSAlberto Garcia#
304398befdfSAlberto Garcia# @bps_wr_max_length: #optional maximum length of the @bps_wr_max
305398befdfSAlberto Garcia#                               burst period, in seconds. (Since 2.6)
306398befdfSAlberto Garcia#
307398befdfSAlberto Garcia# @iops_max_length: #optional maximum length of the @iops burst
308398befdfSAlberto Garcia#                             period, in seconds. (Since 2.6)
309398befdfSAlberto Garcia#
310398befdfSAlberto Garcia# @iops_rd_max_length: #optional maximum length of the @iops_rd_max
311398befdfSAlberto Garcia#                                burst period, in seconds. (Since 2.6)
312398befdfSAlberto Garcia#
313398befdfSAlberto Garcia# @iops_wr_max_length: #optional maximum length of the @iops_wr_max
314398befdfSAlberto Garcia#                                burst period, in seconds. (Since 2.6)
3151ad166b6SBenoît Canet#
3161ad166b6SBenoît Canet# @iops_size: #optional an I/O size in bytes (Since 1.7)
3171ad166b6SBenoît Canet#
318b8fe1694SAlberto Garcia# @group: #optional throttle group name (Since 2.4)
319b8fe1694SAlberto Garcia#
3209e193c5aSKevin Wolf# @cache: the cache mode used for the block device (since: 2.3)
3219e193c5aSKevin Wolf#
322e2462113SFrancesco Romani# @write_threshold: configured write threshold for the device.
323e2462113SFrancesco Romani#                   0 if disabled. (Since 2.3)
324e2462113SFrancesco Romani#
3251ad166b6SBenoît Canet# Since: 0.14.0
3261ad166b6SBenoît Canet#
3271ad166b6SBenoît Canet##
328895a2a80SEric Blake{ 'struct': 'BlockDeviceInfo',
3291ad166b6SBenoît Canet  'data': { 'file': 'str', '*node-name': 'str', 'ro': 'bool', 'drv': 'str',
3301ad166b6SBenoît Canet            '*backing_file': 'str', 'backing_file_depth': 'int',
3311ad166b6SBenoît Canet            'encrypted': 'bool', 'encryption_key_missing': 'bool',
3321ad166b6SBenoît Canet            'detect_zeroes': 'BlockdevDetectZeroesOptions',
3331ad166b6SBenoît Canet            'bps': 'int', 'bps_rd': 'int', 'bps_wr': 'int',
3341ad166b6SBenoît Canet            'iops': 'int', 'iops_rd': 'int', 'iops_wr': 'int',
3351ad166b6SBenoît Canet            'image': 'ImageInfo',
3361ad166b6SBenoît Canet            '*bps_max': 'int', '*bps_rd_max': 'int',
3371ad166b6SBenoît Canet            '*bps_wr_max': 'int', '*iops_max': 'int',
3381ad166b6SBenoît Canet            '*iops_rd_max': 'int', '*iops_wr_max': 'int',
339398befdfSAlberto Garcia            '*bps_max_length': 'int', '*bps_rd_max_length': 'int',
340398befdfSAlberto Garcia            '*bps_wr_max_length': 'int', '*iops_max_length': 'int',
341398befdfSAlberto Garcia            '*iops_rd_max_length': 'int', '*iops_wr_max_length': 'int',
342b8fe1694SAlberto Garcia            '*iops_size': 'int', '*group': 'str', 'cache': 'BlockdevCacheInfo',
343e2462113SFrancesco Romani            'write_threshold': 'int' } }
3441ad166b6SBenoît Canet
3451ad166b6SBenoît Canet##
3461ad166b6SBenoît Canet# @BlockDeviceIoStatus:
3471ad166b6SBenoît Canet#
3481ad166b6SBenoît Canet# An enumeration of block device I/O status.
3491ad166b6SBenoît Canet#
3501ad166b6SBenoît Canet# @ok: The last I/O operation has succeeded
3511ad166b6SBenoît Canet#
3521ad166b6SBenoît Canet# @failed: The last I/O operation has failed
3531ad166b6SBenoît Canet#
3541ad166b6SBenoît Canet# @nospace: The last I/O operation has failed due to a no-space condition
3551ad166b6SBenoît Canet#
3561ad166b6SBenoît Canet# Since: 1.0
3571ad166b6SBenoît Canet##
3581ad166b6SBenoît Canet{ 'enum': 'BlockDeviceIoStatus', 'data': [ 'ok', 'failed', 'nospace' ] }
3591ad166b6SBenoît Canet
3601ad166b6SBenoît Canet##
3611ad166b6SBenoît Canet# @BlockDeviceMapEntry:
3621ad166b6SBenoît Canet#
3631ad166b6SBenoît Canet# Entry in the metadata map of the device (returned by "qemu-img map")
3641ad166b6SBenoît Canet#
3651ad166b6SBenoît Canet# @start: Offset in the image of the first byte described by this entry
3661ad166b6SBenoît Canet#         (in bytes)
3671ad166b6SBenoît Canet#
3681ad166b6SBenoît Canet# @length: Length of the range described by this entry (in bytes)
3691ad166b6SBenoît Canet#
3701ad166b6SBenoît Canet# @depth: Number of layers (0 = top image, 1 = top image's backing file, etc.)
3711ad166b6SBenoît Canet#         before reaching one for which the range is allocated.  The value is
3721ad166b6SBenoît Canet#         in the range 0 to the depth of the image chain - 1.
3731ad166b6SBenoît Canet#
3741ad166b6SBenoît Canet# @zero: the sectors in this range read as zeros
3751ad166b6SBenoît Canet#
3761ad166b6SBenoît Canet# @data: reading the image will actually read data from a file (in particular,
3771ad166b6SBenoît Canet#        if @offset is present this means that the sectors are not simply
3781ad166b6SBenoît Canet#        preallocated, but contain actual data in raw format)
3791ad166b6SBenoît Canet#
3801ad166b6SBenoît Canet# @offset: if present, the image file stores the data for this range in
3811ad166b6SBenoît Canet#          raw format at the given offset.
3821ad166b6SBenoît Canet#
3835072f7b3SMarc-André Lureau# Since: 1.7
3841ad166b6SBenoît Canet##
385895a2a80SEric Blake{ 'struct': 'BlockDeviceMapEntry',
3861ad166b6SBenoît Canet  'data': { 'start': 'int', 'length': 'int', 'depth': 'int', 'zero': 'bool',
3871ad166b6SBenoît Canet            'data': 'bool', '*offset': 'int' } }
3881ad166b6SBenoît Canet
3891ad166b6SBenoît Canet##
3909abe3bdcSJohn Snow# @DirtyBitmapStatus:
3919abe3bdcSJohn Snow#
3929abe3bdcSJohn Snow# An enumeration of possible states that a dirty bitmap can report to the user.
3939abe3bdcSJohn Snow#
3949abe3bdcSJohn Snow# @frozen: The bitmap is currently in-use by a backup operation or block job,
3959abe3bdcSJohn Snow#          and is immutable.
3969abe3bdcSJohn Snow#
3979abe3bdcSJohn Snow# @disabled: The bitmap is currently in-use by an internal operation and is
3989abe3bdcSJohn Snow#            read-only. It can still be deleted.
3999abe3bdcSJohn Snow#
4009abe3bdcSJohn Snow# @active: The bitmap is actively monitoring for new writes, and can be cleared,
4019abe3bdcSJohn Snow#          deleted, or used for backup operations.
4029abe3bdcSJohn Snow#
4039abe3bdcSJohn Snow# Since: 2.4
4049abe3bdcSJohn Snow##
4059abe3bdcSJohn Snow{ 'enum': 'DirtyBitmapStatus',
4069abe3bdcSJohn Snow  'data': ['active', 'disabled', 'frozen'] }
4079abe3bdcSJohn Snow
4089abe3bdcSJohn Snow##
4091ad166b6SBenoît Canet# @BlockDirtyInfo:
4101ad166b6SBenoît Canet#
4111ad166b6SBenoît Canet# Block dirty bitmap information.
4121ad166b6SBenoît Canet#
4130db6e54aSFam Zheng# @name: #optional the name of the dirty bitmap (Since 2.4)
4140db6e54aSFam Zheng#
4151ad166b6SBenoît Canet# @count: number of dirty bytes according to the dirty bitmap
4161ad166b6SBenoît Canet#
4171ad166b6SBenoît Canet# @granularity: granularity of the dirty bitmap in bytes (since 1.4)
4181ad166b6SBenoît Canet#
4199abe3bdcSJohn Snow# @status: current status of the dirty bitmap (since 2.4)
420a113534fSJohn Snow#
4211ad166b6SBenoît Canet# Since: 1.3
4221ad166b6SBenoît Canet##
423895a2a80SEric Blake{ 'struct': 'BlockDirtyInfo',
424a113534fSJohn Snow  'data': {'*name': 'str', 'count': 'int', 'granularity': 'uint32',
4259abe3bdcSJohn Snow           'status': 'DirtyBitmapStatus'} }
4261ad166b6SBenoît Canet
4271ad166b6SBenoît Canet##
4281ad166b6SBenoît Canet# @BlockInfo:
4291ad166b6SBenoît Canet#
4301ad166b6SBenoît Canet# Block device information.  This structure describes a virtual device and
4311ad166b6SBenoît Canet# the backing device associated with it.
4321ad166b6SBenoît Canet#
4331ad166b6SBenoît Canet# @device: The device name associated with the virtual device.
4341ad166b6SBenoît Canet#
4351ad166b6SBenoît Canet# @type: This field is returned only for compatibility reasons, it should
4361ad166b6SBenoît Canet#        not be used (always returns 'unknown')
4371ad166b6SBenoît Canet#
4381ad166b6SBenoît Canet# @removable: True if the device supports removable media.
4391ad166b6SBenoît Canet#
4401ad166b6SBenoît Canet# @locked: True if the guest has locked this device from having its media
4411ad166b6SBenoît Canet#          removed
4421ad166b6SBenoît Canet#
443327032ceSMax Reitz# @tray_open: #optional True if the device's tray is open
444327032ceSMax Reitz#             (only present if it has a tray)
4451ad166b6SBenoît Canet#
4461ad166b6SBenoît Canet# @dirty-bitmaps: #optional dirty bitmaps information (only present if the
4471ad166b6SBenoît Canet#                 driver has one or more dirty bitmaps) (Since 2.0)
4481ad166b6SBenoît Canet#
4491ad166b6SBenoît Canet# @io-status: #optional @BlockDeviceIoStatus. Only present if the device
4501ad166b6SBenoît Canet#             supports it and the VM is configured to stop on errors
451c7c2ff0cSLuiz Capitulino#             (supported device models: virtio-blk, ide, scsi-disk)
4521ad166b6SBenoît Canet#
4531ad166b6SBenoît Canet# @inserted: #optional @BlockDeviceInfo describing the device if media is
4541ad166b6SBenoît Canet#            present
4551ad166b6SBenoît Canet#
4561ad166b6SBenoît Canet# Since:  0.14.0
4571ad166b6SBenoît Canet##
458895a2a80SEric Blake{ 'struct': 'BlockInfo',
4591ad166b6SBenoît Canet  'data': {'device': 'str', 'type': 'str', 'removable': 'bool',
4601ad166b6SBenoît Canet           'locked': 'bool', '*inserted': 'BlockDeviceInfo',
4611ad166b6SBenoît Canet           '*tray_open': 'bool', '*io-status': 'BlockDeviceIoStatus',
4621ad166b6SBenoît Canet           '*dirty-bitmaps': ['BlockDirtyInfo'] } }
4631ad166b6SBenoît Canet
4641ad166b6SBenoît Canet##
4651ad166b6SBenoît Canet# @query-block:
4661ad166b6SBenoît Canet#
4671ad166b6SBenoît Canet# Get a list of BlockInfo for all virtual block devices.
4681ad166b6SBenoît Canet#
4691ad166b6SBenoît Canet# Returns: a list of @BlockInfo describing each virtual block device
4701ad166b6SBenoît Canet#
4711ad166b6SBenoît Canet# Since: 0.14.0
472978cceabSMarc-André Lureau#
473978cceabSMarc-André Lureau# Example:
474978cceabSMarc-André Lureau#
475978cceabSMarc-André Lureau# -> { "execute": "query-block" }
476978cceabSMarc-André Lureau# <- {
477978cceabSMarc-André Lureau#       "return":[
478978cceabSMarc-André Lureau#          {
479978cceabSMarc-André Lureau#             "io-status": "ok",
480978cceabSMarc-André Lureau#             "device":"ide0-hd0",
481978cceabSMarc-André Lureau#             "locked":false,
482978cceabSMarc-André Lureau#             "removable":false,
483978cceabSMarc-André Lureau#             "inserted":{
484978cceabSMarc-André Lureau#                "ro":false,
485978cceabSMarc-André Lureau#                "drv":"qcow2",
486978cceabSMarc-André Lureau#                "encrypted":false,
487978cceabSMarc-André Lureau#                "file":"disks/test.qcow2",
488978cceabSMarc-André Lureau#                "backing_file_depth":1,
489978cceabSMarc-André Lureau#                "bps":1000000,
490978cceabSMarc-André Lureau#                "bps_rd":0,
491978cceabSMarc-André Lureau#                "bps_wr":0,
492978cceabSMarc-André Lureau#                "iops":1000000,
493978cceabSMarc-André Lureau#                "iops_rd":0,
494978cceabSMarc-André Lureau#                "iops_wr":0,
495978cceabSMarc-André Lureau#                "bps_max": 8000000,
496978cceabSMarc-André Lureau#                "bps_rd_max": 0,
497978cceabSMarc-André Lureau#                "bps_wr_max": 0,
498978cceabSMarc-André Lureau#                "iops_max": 0,
499978cceabSMarc-André Lureau#                "iops_rd_max": 0,
500978cceabSMarc-André Lureau#                "iops_wr_max": 0,
501978cceabSMarc-André Lureau#                "iops_size": 0,
502978cceabSMarc-André Lureau#                "detect_zeroes": "on",
503978cceabSMarc-André Lureau#                "write_threshold": 0,
504978cceabSMarc-André Lureau#                "image":{
505978cceabSMarc-André Lureau#                   "filename":"disks/test.qcow2",
506978cceabSMarc-André Lureau#                   "format":"qcow2",
507978cceabSMarc-André Lureau#                   "virtual-size":2048000,
508978cceabSMarc-André Lureau#                   "backing_file":"base.qcow2",
509978cceabSMarc-André Lureau#                   "full-backing-filename":"disks/base.qcow2",
510978cceabSMarc-André Lureau#                   "backing-filename-format":"qcow2",
511978cceabSMarc-André Lureau#                   "snapshots":[
512978cceabSMarc-André Lureau#                      {
513978cceabSMarc-André Lureau#                         "id": "1",
514978cceabSMarc-André Lureau#                         "name": "snapshot1",
515978cceabSMarc-André Lureau#                         "vm-state-size": 0,
516978cceabSMarc-André Lureau#                         "date-sec": 10000200,
517978cceabSMarc-André Lureau#                         "date-nsec": 12,
518978cceabSMarc-André Lureau#                         "vm-clock-sec": 206,
519978cceabSMarc-André Lureau#                         "vm-clock-nsec": 30
520978cceabSMarc-André Lureau#                      }
521978cceabSMarc-André Lureau#                   ],
522978cceabSMarc-André Lureau#                   "backing-image":{
523978cceabSMarc-André Lureau#                       "filename":"disks/base.qcow2",
524978cceabSMarc-André Lureau#                       "format":"qcow2",
525978cceabSMarc-André Lureau#                       "virtual-size":2048000
526978cceabSMarc-André Lureau#                   }
527978cceabSMarc-André Lureau#                }
528978cceabSMarc-André Lureau#             },
529978cceabSMarc-André Lureau#             "type":"unknown"
530978cceabSMarc-André Lureau#          },
531978cceabSMarc-André Lureau#          {
532978cceabSMarc-André Lureau#             "io-status": "ok",
533978cceabSMarc-André Lureau#             "device":"ide1-cd0",
534978cceabSMarc-André Lureau#             "locked":false,
535978cceabSMarc-André Lureau#             "removable":true,
536978cceabSMarc-André Lureau#             "type":"unknown"
537978cceabSMarc-André Lureau#          },
538978cceabSMarc-André Lureau#          {
539978cceabSMarc-André Lureau#             "device":"floppy0",
540978cceabSMarc-André Lureau#             "locked":false,
541978cceabSMarc-André Lureau#             "removable":true,
542978cceabSMarc-André Lureau#             "type":"unknown"
543978cceabSMarc-André Lureau#          },
544978cceabSMarc-André Lureau#          {
545978cceabSMarc-André Lureau#             "device":"sd0",
546978cceabSMarc-André Lureau#             "locked":false,
547978cceabSMarc-André Lureau#             "removable":true,
548978cceabSMarc-André Lureau#             "type":"unknown"
549978cceabSMarc-André Lureau#          }
550978cceabSMarc-André Lureau#       ]
551978cceabSMarc-André Lureau#    }
552978cceabSMarc-André Lureau#
5531ad166b6SBenoît Canet##
5541ad166b6SBenoît Canet{ 'command': 'query-block', 'returns': ['BlockInfo'] }
5551ad166b6SBenoît Canet
556979e9b03SAlberto Garcia
557979e9b03SAlberto Garcia##
558979e9b03SAlberto Garcia# @BlockDeviceTimedStats:
559979e9b03SAlberto Garcia#
560979e9b03SAlberto Garcia# Statistics of a block device during a given interval of time.
561979e9b03SAlberto Garcia#
562979e9b03SAlberto Garcia# @interval_length: Interval used for calculating the statistics,
563979e9b03SAlberto Garcia#                   in seconds.
564979e9b03SAlberto Garcia#
565979e9b03SAlberto Garcia# @min_rd_latency_ns: Minimum latency of read operations in the
566979e9b03SAlberto Garcia#                     defined interval, in nanoseconds.
567979e9b03SAlberto Garcia#
568979e9b03SAlberto Garcia# @min_wr_latency_ns: Minimum latency of write operations in the
569979e9b03SAlberto Garcia#                     defined interval, in nanoseconds.
570979e9b03SAlberto Garcia#
571979e9b03SAlberto Garcia# @min_flush_latency_ns: Minimum latency of flush operations in the
572979e9b03SAlberto Garcia#                        defined interval, in nanoseconds.
573979e9b03SAlberto Garcia#
574979e9b03SAlberto Garcia# @max_rd_latency_ns: Maximum latency of read operations in the
575979e9b03SAlberto Garcia#                     defined interval, in nanoseconds.
576979e9b03SAlberto Garcia#
577979e9b03SAlberto Garcia# @max_wr_latency_ns: Maximum latency of write operations in the
578979e9b03SAlberto Garcia#                     defined interval, in nanoseconds.
579979e9b03SAlberto Garcia#
580979e9b03SAlberto Garcia# @max_flush_latency_ns: Maximum latency of flush operations in the
581979e9b03SAlberto Garcia#                        defined interval, in nanoseconds.
582979e9b03SAlberto Garcia#
583979e9b03SAlberto Garcia# @avg_rd_latency_ns: Average latency of read operations in the
584979e9b03SAlberto Garcia#                     defined interval, in nanoseconds.
585979e9b03SAlberto Garcia#
586979e9b03SAlberto Garcia# @avg_wr_latency_ns: Average latency of write operations in the
587979e9b03SAlberto Garcia#                     defined interval, in nanoseconds.
588979e9b03SAlberto Garcia#
589979e9b03SAlberto Garcia# @avg_flush_latency_ns: Average latency of flush operations in the
590979e9b03SAlberto Garcia#                        defined interval, in nanoseconds.
591979e9b03SAlberto Garcia#
59296e4dedaSAlberto Garcia# @avg_rd_queue_depth: Average number of pending read operations
59396e4dedaSAlberto Garcia#                      in the defined interval.
59496e4dedaSAlberto Garcia#
59596e4dedaSAlberto Garcia# @avg_wr_queue_depth: Average number of pending write operations
59696e4dedaSAlberto Garcia#                      in the defined interval.
59796e4dedaSAlberto Garcia#
598979e9b03SAlberto Garcia# Since: 2.5
599979e9b03SAlberto Garcia##
600979e9b03SAlberto Garcia{ 'struct': 'BlockDeviceTimedStats',
601979e9b03SAlberto Garcia  'data': { 'interval_length': 'int', 'min_rd_latency_ns': 'int',
602979e9b03SAlberto Garcia            'max_rd_latency_ns': 'int', 'avg_rd_latency_ns': 'int',
603979e9b03SAlberto Garcia            'min_wr_latency_ns': 'int', 'max_wr_latency_ns': 'int',
604979e9b03SAlberto Garcia            'avg_wr_latency_ns': 'int', 'min_flush_latency_ns': 'int',
60596e4dedaSAlberto Garcia            'max_flush_latency_ns': 'int', 'avg_flush_latency_ns': 'int',
60696e4dedaSAlberto Garcia            'avg_rd_queue_depth': 'number', 'avg_wr_queue_depth': 'number' } }
607979e9b03SAlberto Garcia
6081ad166b6SBenoît Canet##
6091ad166b6SBenoît Canet# @BlockDeviceStats:
6101ad166b6SBenoît Canet#
6111ad166b6SBenoît Canet# Statistics of a virtual block device or a block backing device.
6121ad166b6SBenoît Canet#
6131ad166b6SBenoît Canet# @rd_bytes:      The number of bytes read by the device.
6141ad166b6SBenoît Canet#
6151ad166b6SBenoît Canet# @wr_bytes:      The number of bytes written by the device.
6161ad166b6SBenoît Canet#
6171ad166b6SBenoît Canet# @rd_operations: The number of read operations performed by the device.
6181ad166b6SBenoît Canet#
6191ad166b6SBenoît Canet# @wr_operations: The number of write operations performed by the device.
6201ad166b6SBenoît Canet#
6211ad166b6SBenoît Canet# @flush_operations: The number of cache flush operations performed by the
6221ad166b6SBenoît Canet#                    device (since 0.15.0)
6231ad166b6SBenoît Canet#
6241ad166b6SBenoît Canet# @flush_total_time_ns: Total time spend on cache flushes in nano-seconds
6251ad166b6SBenoît Canet#                       (since 0.15.0).
6261ad166b6SBenoît Canet#
6271ad166b6SBenoît Canet# @wr_total_time_ns: Total time spend on writes in nano-seconds (since 0.15.0).
6281ad166b6SBenoît Canet#
6291ad166b6SBenoît Canet# @rd_total_time_ns: Total_time_spend on reads in nano-seconds (since 0.15.0).
6301ad166b6SBenoît Canet#
6311ad166b6SBenoît Canet# @wr_highest_offset: The offset after the greatest byte written to the
6321ad166b6SBenoît Canet#                     device.  The intended use of this information is for
6331ad166b6SBenoît Canet#                     growable sparse files (like qcow2) that are used on top
6341ad166b6SBenoît Canet#                     of a physical device.
6351ad166b6SBenoît Canet#
636f4564d53SPeter Lieven# @rd_merged: Number of read requests that have been merged into another
637f4564d53SPeter Lieven#             request (Since 2.3).
638f4564d53SPeter Lieven#
639f4564d53SPeter Lieven# @wr_merged: Number of write requests that have been merged into another
640f4564d53SPeter Lieven#             request (Since 2.3).
641f4564d53SPeter Lieven#
642cb38fffbSAlberto Garcia# @idle_time_ns: #optional Time since the last I/O operation, in
643cb38fffbSAlberto Garcia#                nanoseconds. If the field is absent it means that
644cb38fffbSAlberto Garcia#                there haven't been any operations yet (Since 2.5).
645cb38fffbSAlberto Garcia#
6467ee12dafSAlberto Garcia# @failed_rd_operations: The number of failed read operations
6477ee12dafSAlberto Garcia#                        performed by the device (Since 2.5)
6487ee12dafSAlberto Garcia#
6497ee12dafSAlberto Garcia# @failed_wr_operations: The number of failed write operations
6507ee12dafSAlberto Garcia#                        performed by the device (Since 2.5)
6517ee12dafSAlberto Garcia#
6527ee12dafSAlberto Garcia# @failed_flush_operations: The number of failed flush operations
6537ee12dafSAlberto Garcia#                           performed by the device (Since 2.5)
6547ee12dafSAlberto Garcia#
6557ee12dafSAlberto Garcia# @invalid_rd_operations: The number of invalid read operations
6567ee12dafSAlberto Garcia#                          performed by the device (Since 2.5)
6577ee12dafSAlberto Garcia#
6587ee12dafSAlberto Garcia# @invalid_wr_operations: The number of invalid write operations
6597ee12dafSAlberto Garcia#                         performed by the device (Since 2.5)
6607ee12dafSAlberto Garcia#
6617ee12dafSAlberto Garcia# @invalid_flush_operations: The number of invalid flush operations
6627ee12dafSAlberto Garcia#                            performed by the device (Since 2.5)
6637ee12dafSAlberto Garcia#
664362e9299SAlberto Garcia# @account_invalid: Whether invalid operations are included in the
665362e9299SAlberto Garcia#                   last access statistics (Since 2.5)
666362e9299SAlberto Garcia#
667362e9299SAlberto Garcia# @account_failed: Whether failed operations are included in the
668362e9299SAlberto Garcia#                  latency and last access statistics (Since 2.5)
669362e9299SAlberto Garcia#
670979e9b03SAlberto Garcia# @timed_stats: Statistics specific to the set of previously defined
671979e9b03SAlberto Garcia#               intervals of time (Since 2.5)
672979e9b03SAlberto Garcia#
6731ad166b6SBenoît Canet# Since: 0.14.0
6741ad166b6SBenoît Canet##
675895a2a80SEric Blake{ 'struct': 'BlockDeviceStats',
6761ad166b6SBenoît Canet  'data': {'rd_bytes': 'int', 'wr_bytes': 'int', 'rd_operations': 'int',
6771ad166b6SBenoît Canet           'wr_operations': 'int', 'flush_operations': 'int',
6781ad166b6SBenoît Canet           'flush_total_time_ns': 'int', 'wr_total_time_ns': 'int',
679f4564d53SPeter Lieven           'rd_total_time_ns': 'int', 'wr_highest_offset': 'int',
6807ee12dafSAlberto Garcia           'rd_merged': 'int', 'wr_merged': 'int', '*idle_time_ns': 'int',
6817ee12dafSAlberto Garcia           'failed_rd_operations': 'int', 'failed_wr_operations': 'int',
6827ee12dafSAlberto Garcia           'failed_flush_operations': 'int', 'invalid_rd_operations': 'int',
683362e9299SAlberto Garcia           'invalid_wr_operations': 'int', 'invalid_flush_operations': 'int',
684979e9b03SAlberto Garcia           'account_invalid': 'bool', 'account_failed': 'bool',
685979e9b03SAlberto Garcia           'timed_stats': ['BlockDeviceTimedStats'] } }
6861ad166b6SBenoît Canet
6871ad166b6SBenoît Canet##
6881ad166b6SBenoît Canet# @BlockStats:
6891ad166b6SBenoît Canet#
6901ad166b6SBenoît Canet# Statistics of a virtual block device or a block backing device.
6911ad166b6SBenoît Canet#
6921ad166b6SBenoît Canet# @device: #optional If the stats are for a virtual block device, the name
6931ad166b6SBenoît Canet#          corresponding to the virtual block device.
6941ad166b6SBenoît Canet#
695a06e4355SFam Zheng# @node-name: #optional The node name of the device. (Since 2.3)
6964875a779SFam Zheng#
6971ad166b6SBenoît Canet# @stats:  A @BlockDeviceStats for the device.
6981ad166b6SBenoît Canet#
6991ad166b6SBenoît Canet# @parent: #optional This describes the file block device if it has one.
700f2eaea18SMarc-André Lureau#          Contains recursively the statistics of the underlying
701f2eaea18SMarc-André Lureau#          protocol (e.g. the host file for a qcow2 image). If there is
702f2eaea18SMarc-André Lureau#          no underlying protocol, this field is omitted
7031ad166b6SBenoît Canet#
7041ad166b6SBenoît Canet# @backing: #optional This describes the backing block device if it has one.
7051ad166b6SBenoît Canet#           (Since 2.0)
7061ad166b6SBenoît Canet#
7071ad166b6SBenoît Canet# Since: 0.14.0
7081ad166b6SBenoît Canet##
709895a2a80SEric Blake{ 'struct': 'BlockStats',
7104875a779SFam Zheng  'data': {'*device': 'str', '*node-name': 'str',
7114875a779SFam Zheng           'stats': 'BlockDeviceStats',
7121ad166b6SBenoît Canet           '*parent': 'BlockStats',
7131ad166b6SBenoît Canet           '*backing': 'BlockStats'} }
7141ad166b6SBenoît Canet
7151ad166b6SBenoît Canet##
7161ad166b6SBenoît Canet# @query-blockstats:
7171ad166b6SBenoît Canet#
7181ad166b6SBenoît Canet# Query the @BlockStats for all virtual block devices.
7191ad166b6SBenoît Canet#
720f71eaa74SFam Zheng# @query-nodes: #optional If true, the command will query all the block nodes
721f71eaa74SFam Zheng#               that have a node name, in a list which will include "parent"
722f71eaa74SFam Zheng#               information, but not "backing".
723f71eaa74SFam Zheng#               If false or omitted, the behavior is as before - query all the
724f71eaa74SFam Zheng#               device backends, recursively including their "parent" and
725f71eaa74SFam Zheng#               "backing". (Since 2.3)
726f71eaa74SFam Zheng#
7271ad166b6SBenoît Canet# Returns: A list of @BlockStats for each virtual block devices.
7281ad166b6SBenoît Canet#
7291ad166b6SBenoît Canet# Since: 0.14.0
730f2eaea18SMarc-André Lureau#
731f2eaea18SMarc-André Lureau# Example:
732f2eaea18SMarc-André Lureau#
733f2eaea18SMarc-André Lureau# -> { "execute": "query-blockstats" }
734f2eaea18SMarc-André Lureau# <- {
735f2eaea18SMarc-André Lureau#       "return":[
736f2eaea18SMarc-André Lureau#          {
737f2eaea18SMarc-André Lureau#             "device":"ide0-hd0",
738f2eaea18SMarc-André Lureau#             "parent":{
739f2eaea18SMarc-André Lureau#                "stats":{
740f2eaea18SMarc-André Lureau#                   "wr_highest_offset":3686448128,
741f2eaea18SMarc-André Lureau#                   "wr_bytes":9786368,
742f2eaea18SMarc-André Lureau#                   "wr_operations":751,
743f2eaea18SMarc-André Lureau#                   "rd_bytes":122567168,
744f2eaea18SMarc-André Lureau#                   "rd_operations":36772
745f2eaea18SMarc-André Lureau#                   "wr_total_times_ns":313253456
746f2eaea18SMarc-André Lureau#                   "rd_total_times_ns":3465673657
747f2eaea18SMarc-André Lureau#                   "flush_total_times_ns":49653
748f2eaea18SMarc-André Lureau#                   "flush_operations":61,
749f2eaea18SMarc-André Lureau#                   "rd_merged":0,
750f2eaea18SMarc-André Lureau#                   "wr_merged":0,
751f2eaea18SMarc-André Lureau#                   "idle_time_ns":2953431879,
752f2eaea18SMarc-André Lureau#                   "account_invalid":true,
753f2eaea18SMarc-André Lureau#                   "account_failed":false
754f2eaea18SMarc-André Lureau#                }
755f2eaea18SMarc-André Lureau#             },
756f2eaea18SMarc-André Lureau#             "stats":{
757f2eaea18SMarc-André Lureau#                "wr_highest_offset":2821110784,
758f2eaea18SMarc-André Lureau#                "wr_bytes":9786368,
759f2eaea18SMarc-André Lureau#                "wr_operations":692,
760f2eaea18SMarc-André Lureau#                "rd_bytes":122739200,
761f2eaea18SMarc-André Lureau#                "rd_operations":36604
762f2eaea18SMarc-André Lureau#                "flush_operations":51,
763f2eaea18SMarc-André Lureau#                "wr_total_times_ns":313253456
764f2eaea18SMarc-André Lureau#                "rd_total_times_ns":3465673657
765f2eaea18SMarc-André Lureau#                "flush_total_times_ns":49653,
766f2eaea18SMarc-André Lureau#                "rd_merged":0,
767f2eaea18SMarc-André Lureau#                "wr_merged":0,
768f2eaea18SMarc-André Lureau#                "idle_time_ns":2953431879,
769f2eaea18SMarc-André Lureau#                "account_invalid":true,
770f2eaea18SMarc-André Lureau#                "account_failed":false
771f2eaea18SMarc-André Lureau#             }
772f2eaea18SMarc-André Lureau#          },
773f2eaea18SMarc-André Lureau#          {
774f2eaea18SMarc-André Lureau#             "device":"ide1-cd0",
775f2eaea18SMarc-André Lureau#             "stats":{
776f2eaea18SMarc-André Lureau#                "wr_highest_offset":0,
777f2eaea18SMarc-André Lureau#                "wr_bytes":0,
778f2eaea18SMarc-André Lureau#                "wr_operations":0,
779f2eaea18SMarc-André Lureau#                "rd_bytes":0,
780f2eaea18SMarc-André Lureau#                "rd_operations":0
781f2eaea18SMarc-André Lureau#                "flush_operations":0,
782f2eaea18SMarc-André Lureau#                "wr_total_times_ns":0
783f2eaea18SMarc-André Lureau#                "rd_total_times_ns":0
784f2eaea18SMarc-André Lureau#                "flush_total_times_ns":0,
785f2eaea18SMarc-André Lureau#                "rd_merged":0,
786f2eaea18SMarc-André Lureau#                "wr_merged":0,
787f2eaea18SMarc-André Lureau#                "account_invalid":false,
788f2eaea18SMarc-André Lureau#                "account_failed":false
789f2eaea18SMarc-André Lureau#             }
790f2eaea18SMarc-André Lureau#          },
791f2eaea18SMarc-André Lureau#          {
792f2eaea18SMarc-André Lureau#             "device":"floppy0",
793f2eaea18SMarc-André Lureau#             "stats":{
794f2eaea18SMarc-André Lureau#                "wr_highest_offset":0,
795f2eaea18SMarc-André Lureau#                "wr_bytes":0,
796f2eaea18SMarc-André Lureau#                "wr_operations":0,
797f2eaea18SMarc-André Lureau#                "rd_bytes":0,
798f2eaea18SMarc-André Lureau#                "rd_operations":0
799f2eaea18SMarc-André Lureau#                "flush_operations":0,
800f2eaea18SMarc-André Lureau#                "wr_total_times_ns":0
801f2eaea18SMarc-André Lureau#                "rd_total_times_ns":0
802f2eaea18SMarc-André Lureau#                "flush_total_times_ns":0,
803f2eaea18SMarc-André Lureau#                "rd_merged":0,
804f2eaea18SMarc-André Lureau#                "wr_merged":0,
805f2eaea18SMarc-André Lureau#                "account_invalid":false,
806f2eaea18SMarc-André Lureau#                "account_failed":false
807f2eaea18SMarc-André Lureau#             }
808f2eaea18SMarc-André Lureau#          },
809f2eaea18SMarc-André Lureau#          {
810f2eaea18SMarc-André Lureau#             "device":"sd0",
811f2eaea18SMarc-André Lureau#             "stats":{
812f2eaea18SMarc-André Lureau#                "wr_highest_offset":0,
813f2eaea18SMarc-André Lureau#                "wr_bytes":0,
814f2eaea18SMarc-André Lureau#                "wr_operations":0,
815f2eaea18SMarc-André Lureau#                "rd_bytes":0,
816f2eaea18SMarc-André Lureau#                "rd_operations":0
817f2eaea18SMarc-André Lureau#                "flush_operations":0,
818f2eaea18SMarc-André Lureau#                "wr_total_times_ns":0
819f2eaea18SMarc-André Lureau#                "rd_total_times_ns":0
820f2eaea18SMarc-André Lureau#                "flush_total_times_ns":0,
821f2eaea18SMarc-André Lureau#                "rd_merged":0,
822f2eaea18SMarc-André Lureau#                "wr_merged":0,
823f2eaea18SMarc-André Lureau#                "account_invalid":false,
824f2eaea18SMarc-André Lureau#                "account_failed":false
825f2eaea18SMarc-André Lureau#             }
826f2eaea18SMarc-André Lureau#          }
827f2eaea18SMarc-André Lureau#       ]
828f2eaea18SMarc-André Lureau#    }
829f2eaea18SMarc-André Lureau#
8301ad166b6SBenoît Canet##
831f71eaa74SFam Zheng{ 'command': 'query-blockstats',
832f71eaa74SFam Zheng  'data': { '*query-nodes': 'bool' },
833f71eaa74SFam Zheng  'returns': ['BlockStats'] }
8341ad166b6SBenoît Canet
8351ad166b6SBenoît Canet##
8361ad166b6SBenoît Canet# @BlockdevOnError:
8371ad166b6SBenoît Canet#
8381ad166b6SBenoît Canet# An enumeration of possible behaviors for errors on I/O operations.
8391ad166b6SBenoît Canet# The exact meaning depends on whether the I/O was initiated by a guest
8401ad166b6SBenoît Canet# or by a block job
8411ad166b6SBenoît Canet#
8421ad166b6SBenoît Canet# @report: for guest operations, report the error to the guest;
8431ad166b6SBenoît Canet#          for jobs, cancel the job
8441ad166b6SBenoît Canet#
8451ad166b6SBenoît Canet# @ignore: ignore the error, only report a QMP event (BLOCK_IO_ERROR
8461ad166b6SBenoît Canet#          or BLOCK_JOB_ERROR)
8471ad166b6SBenoît Canet#
8481ad166b6SBenoît Canet# @enospc: same as @stop on ENOSPC, same as @report otherwise.
8491ad166b6SBenoît Canet#
8501ad166b6SBenoît Canet# @stop: for guest operations, stop the virtual machine;
8511ad166b6SBenoît Canet#        for jobs, pause the job
8521ad166b6SBenoît Canet#
8538c398252SKevin Wolf# @auto: inherit the error handling policy of the backend (since: 2.7)
8548c398252SKevin Wolf#
8551ad166b6SBenoît Canet# Since: 1.3
8561ad166b6SBenoît Canet##
8571ad166b6SBenoît Canet{ 'enum': 'BlockdevOnError',
8588c398252SKevin Wolf  'data': ['report', 'ignore', 'enospc', 'stop', 'auto'] }
8591ad166b6SBenoît Canet
8601ad166b6SBenoît Canet##
8611ad166b6SBenoît Canet# @MirrorSyncMode:
8621ad166b6SBenoît Canet#
8631ad166b6SBenoît Canet# An enumeration of possible behaviors for the initial synchronization
8641ad166b6SBenoît Canet# phase of storage mirroring.
8651ad166b6SBenoît Canet#
8661ad166b6SBenoît Canet# @top: copies data in the topmost image to the destination
8671ad166b6SBenoît Canet#
8681ad166b6SBenoît Canet# @full: copies data from all images to the destination
8691ad166b6SBenoît Canet#
8701ad166b6SBenoît Canet# @none: only copy data written from now on
8711ad166b6SBenoît Canet#
8724b80ab2bSJohn Snow# @incremental: only copy data described by the dirty bitmap. Since: 2.4
873d58d8453SJohn Snow#
8741ad166b6SBenoît Canet# Since: 1.3
8751ad166b6SBenoît Canet##
8761ad166b6SBenoît Canet{ 'enum': 'MirrorSyncMode',
8774b80ab2bSJohn Snow  'data': ['top', 'full', 'none', 'incremental'] }
8781ad166b6SBenoît Canet
8791ad166b6SBenoît Canet##
8801ad166b6SBenoît Canet# @BlockJobType:
8811ad166b6SBenoît Canet#
8821ad166b6SBenoît Canet# Type of a block job.
8831ad166b6SBenoît Canet#
8841ad166b6SBenoît Canet# @commit: block commit job type, see "block-commit"
8851ad166b6SBenoît Canet#
8861ad166b6SBenoît Canet# @stream: block stream job type, see "block-stream"
8871ad166b6SBenoît Canet#
8881ad166b6SBenoît Canet# @mirror: drive mirror job type, see "drive-mirror"
8891ad166b6SBenoît Canet#
8901ad166b6SBenoît Canet# @backup: drive backup job type, see "drive-backup"
8911ad166b6SBenoît Canet#
8921ad166b6SBenoît Canet# Since: 1.7
8931ad166b6SBenoît Canet##
8941ad166b6SBenoît Canet{ 'enum': 'BlockJobType',
8951ad166b6SBenoît Canet  'data': ['commit', 'stream', 'mirror', 'backup'] }
8961ad166b6SBenoît Canet
8971ad166b6SBenoît Canet##
8981ad166b6SBenoît Canet# @BlockJobInfo:
8991ad166b6SBenoît Canet#
9001ad166b6SBenoît Canet# Information about a long-running block device operation.
9011ad166b6SBenoît Canet#
9021ad166b6SBenoît Canet# @type: the job type ('stream' for image streaming)
9031ad166b6SBenoît Canet#
9046aae5be6SAlberto Garcia# @device: The job identifier. Originally the device name but other
9056aae5be6SAlberto Garcia#          values are allowed since QEMU 2.7
9061ad166b6SBenoît Canet#
9071ad166b6SBenoît Canet# @len: the maximum progress value
9081ad166b6SBenoît Canet#
9091ad166b6SBenoît Canet# @busy: false if the job is known to be in a quiescent state, with
9101ad166b6SBenoît Canet#        no pending I/O.  Since 1.3.
9111ad166b6SBenoît Canet#
9121ad166b6SBenoît Canet# @paused: whether the job is paused or, if @busy is true, will
9131ad166b6SBenoît Canet#          pause itself as soon as possible.  Since 1.3.
9141ad166b6SBenoît Canet#
9151ad166b6SBenoît Canet# @offset: the current progress value
9161ad166b6SBenoît Canet#
9171ad166b6SBenoît Canet# @speed: the rate limit, bytes per second
9181ad166b6SBenoît Canet#
9191ad166b6SBenoît Canet# @io-status: the status of the job (since 1.3)
9201ad166b6SBenoît Canet#
921ef6dbf1eSMax Reitz# @ready: true if the job may be completed (since 2.2)
922ef6dbf1eSMax Reitz#
9231ad166b6SBenoît Canet# Since: 1.1
9241ad166b6SBenoît Canet##
925895a2a80SEric Blake{ 'struct': 'BlockJobInfo',
9261ad166b6SBenoît Canet  'data': {'type': 'str', 'device': 'str', 'len': 'int',
9271ad166b6SBenoît Canet           'offset': 'int', 'busy': 'bool', 'paused': 'bool', 'speed': 'int',
928ef6dbf1eSMax Reitz           'io-status': 'BlockDeviceIoStatus', 'ready': 'bool'} }
9291ad166b6SBenoît Canet
9301ad166b6SBenoît Canet##
9311ad166b6SBenoît Canet# @query-block-jobs:
9321ad166b6SBenoît Canet#
9331ad166b6SBenoît Canet# Return information about long-running block device operations.
9341ad166b6SBenoît Canet#
9351ad166b6SBenoît Canet# Returns: a list of @BlockJobInfo for each active block job
9361ad166b6SBenoît Canet#
9371ad166b6SBenoît Canet# Since: 1.1
9381ad166b6SBenoît Canet##
9391ad166b6SBenoît Canet{ 'command': 'query-block-jobs', 'returns': ['BlockJobInfo'] }
9401ad166b6SBenoît Canet
9411ad166b6SBenoît Canet##
9421ad166b6SBenoît Canet# @block_passwd:
9431ad166b6SBenoît Canet#
9441ad166b6SBenoît Canet# This command sets the password of a block device that has not been open
9451ad166b6SBenoît Canet# with a password and requires one.
9461ad166b6SBenoît Canet#
9471ad166b6SBenoît Canet# The two cases where this can happen are a block device is created through
9481ad166b6SBenoît Canet# QEMU's initial command line or a block device is changed through the legacy
9491ad166b6SBenoît Canet# @change interface.
9501ad166b6SBenoît Canet#
9511ad166b6SBenoît Canet# In the event that the block device is created through the initial command
9521ad166b6SBenoît Canet# line, the VM will start in the stopped state regardless of whether '-S' is
9531ad166b6SBenoît Canet# used.  The intention is for a management tool to query the block devices to
9541ad166b6SBenoît Canet# determine which ones are encrypted, set the passwords with this command, and
9551ad166b6SBenoît Canet# then start the guest with the @cont command.
9561ad166b6SBenoît Canet#
9571ad166b6SBenoît Canet# Either @device or @node-name must be set but not both.
9581ad166b6SBenoît Canet#
9591ad166b6SBenoît Canet# @device: #optional the name of the block backend device to set the password on
9601ad166b6SBenoît Canet#
9611ad166b6SBenoît Canet# @node-name: #optional graph node name to set the password on (Since 2.0)
9621ad166b6SBenoît Canet#
9631ad166b6SBenoît Canet# @password: the password to use for the device
9641ad166b6SBenoît Canet#
9651ad166b6SBenoît Canet# Returns: nothing on success
9661ad166b6SBenoît Canet#          If @device is not a valid block device, DeviceNotFound
9671ad166b6SBenoît Canet#          If @device is not encrypted, DeviceNotEncrypted
9681ad166b6SBenoît Canet#
9691ad166b6SBenoît Canet# Notes:  Not all block formats support encryption and some that do are not
9701ad166b6SBenoît Canet#         able to validate that a password is correct.  Disk corruption may
9711ad166b6SBenoît Canet#         occur if an invalid password is specified.
9721ad166b6SBenoît Canet#
9731ad166b6SBenoît Canet# Since: 0.14.0
97491f96b64SMarc-André Lureau#
97591f96b64SMarc-André Lureau# Example:
97691f96b64SMarc-André Lureau#
97791f96b64SMarc-André Lureau# -> { "execute": "block_passwd", "arguments": { "device": "ide0-hd0",
97891f96b64SMarc-André Lureau#                                                "password": "12345" } }
97991f96b64SMarc-André Lureau# <- { "return": {} }
98091f96b64SMarc-André Lureau#
9811ad166b6SBenoît Canet##
9821ad166b6SBenoît Canet{ 'command': 'block_passwd', 'data': {'*device': 'str',
9831ad166b6SBenoît Canet                                      '*node-name': 'str', 'password': 'str'} }
9841ad166b6SBenoît Canet
9851ad166b6SBenoît Canet##
9865072f7b3SMarc-André Lureau# @block_resize:
9871ad166b6SBenoît Canet#
9881ad166b6SBenoît Canet# Resize a block image while a guest is running.
9891ad166b6SBenoît Canet#
9901ad166b6SBenoît Canet# Either @device or @node-name must be set but not both.
9911ad166b6SBenoît Canet#
9921ad166b6SBenoît Canet# @device: #optional the name of the device to get the image resized
9931ad166b6SBenoît Canet#
9941ad166b6SBenoît Canet# @node-name: #optional graph node name to get the image resized (Since 2.0)
9951ad166b6SBenoît Canet#
9961ad166b6SBenoît Canet# @size:  new image size in bytes
9971ad166b6SBenoît Canet#
9981ad166b6SBenoît Canet# Returns: nothing on success
9991ad166b6SBenoît Canet#          If @device is not a valid block device, DeviceNotFound
10001ad166b6SBenoît Canet#
10011ad166b6SBenoît Canet# Since: 0.14.0
10020dc869cfSMarc-André Lureau#
10030dc869cfSMarc-André Lureau# Example:
10040dc869cfSMarc-André Lureau#
10050dc869cfSMarc-André Lureau# -> { "execute": "block_resize",
10060dc869cfSMarc-André Lureau#      "arguments": { "device": "scratch", "size": 1073741824 } }
10070dc869cfSMarc-André Lureau# <- { "return": {} }
10080dc869cfSMarc-André Lureau#
10091ad166b6SBenoît Canet##
10101ad166b6SBenoît Canet{ 'command': 'block_resize', 'data': { '*device': 'str',
10111ad166b6SBenoît Canet                                       '*node-name': 'str',
10121ad166b6SBenoît Canet                                       'size': 'int' }}
10131ad166b6SBenoît Canet
10141ad166b6SBenoît Canet##
10155072f7b3SMarc-André Lureau# @NewImageMode:
10161ad166b6SBenoît Canet#
10171ad166b6SBenoît Canet# An enumeration that tells QEMU how to set the backing file path in
10181ad166b6SBenoît Canet# a new image file.
10191ad166b6SBenoît Canet#
10201ad166b6SBenoît Canet# @existing: QEMU should look for an existing image file.
10211ad166b6SBenoît Canet#
10221ad166b6SBenoît Canet# @absolute-paths: QEMU should create a new image with absolute paths
10231ad166b6SBenoît Canet# for the backing file. If there is no backing file available, the new
10241ad166b6SBenoît Canet# image will not be backed either.
10251ad166b6SBenoît Canet#
10261ad166b6SBenoît Canet# Since: 1.1
10271ad166b6SBenoît Canet##
10281ad166b6SBenoît Canet{ 'enum': 'NewImageMode',
10291ad166b6SBenoît Canet  'data': [ 'existing', 'absolute-paths' ] }
10301ad166b6SBenoît Canet
10311ad166b6SBenoît Canet##
10325072f7b3SMarc-André Lureau# @BlockdevSnapshotSync:
10331ad166b6SBenoît Canet#
10341ad166b6SBenoît Canet# Either @device or @node-name must be set but not both.
10351ad166b6SBenoît Canet#
10361ad166b6SBenoît Canet# @device: #optional the name of the device to generate the snapshot from.
10371ad166b6SBenoît Canet#
10381ad166b6SBenoît Canet# @node-name: #optional graph node name to generate the snapshot from (Since 2.0)
10391ad166b6SBenoît Canet#
1040b4039d8dSMarc-André Lureau# @snapshot-file: the target of the new image. If the file exists, or
1041b4039d8dSMarc-André Lureau# if it is a device, the snapshot will be created in the existing
1042b4039d8dSMarc-André Lureau# file/device. Otherwise, a new file will be created.
10431ad166b6SBenoît Canet#
10441ad166b6SBenoît Canet# @snapshot-node-name: #optional the graph node name of the new image (Since 2.0)
10451ad166b6SBenoît Canet#
10461ad166b6SBenoît Canet# @format: #optional the format of the snapshot image, default is 'qcow2'.
10471ad166b6SBenoît Canet#
10481ad166b6SBenoît Canet# @mode: #optional whether and how QEMU should create a new image, default is
10491ad166b6SBenoît Canet#        'absolute-paths'.
10501ad166b6SBenoît Canet##
1051a911e6aeSAlberto Garcia{ 'struct': 'BlockdevSnapshotSync',
10521ad166b6SBenoît Canet  'data': { '*device': 'str', '*node-name': 'str',
10531ad166b6SBenoît Canet            'snapshot-file': 'str', '*snapshot-node-name': 'str',
10541ad166b6SBenoît Canet            '*format': 'str', '*mode': 'NewImageMode' } }
10551ad166b6SBenoît Canet
10561ad166b6SBenoît Canet##
10575072f7b3SMarc-André Lureau# @BlockdevSnapshot:
105843de7e2dSAlberto Garcia#
105943de7e2dSAlberto Garcia# @node: device or node name that will have a snapshot created.
106043de7e2dSAlberto Garcia#
106143de7e2dSAlberto Garcia# @overlay: reference to the existing block device that will become
106243de7e2dSAlberto Garcia#           the overlay of @node, as part of creating the snapshot.
106343de7e2dSAlberto Garcia#           It must not have a current backing file (this can be
106443de7e2dSAlberto Garcia#           achieved by passing "backing": "" to blockdev-add).
106543de7e2dSAlberto Garcia#
10665072f7b3SMarc-André Lureau# Since: 2.5
106743de7e2dSAlberto Garcia##
106843de7e2dSAlberto Garcia{ 'struct': 'BlockdevSnapshot',
106943de7e2dSAlberto Garcia  'data': { 'node': 'str', 'overlay': 'str' } }
107043de7e2dSAlberto Garcia
107143de7e2dSAlberto Garcia##
10725072f7b3SMarc-André Lureau# @DriveBackup:
10731ad166b6SBenoît Canet#
107470559d49SAlberto Garcia# @job-id: #optional identifier for the newly-created block job. If
107570559d49SAlberto Garcia#          omitted, the device name will be used. (Since 2.7)
107670559d49SAlberto Garcia#
1077b7e4fa22SKevin Wolf# @device: the device name or node-name of a root node which should be copied.
10781ad166b6SBenoît Canet#
10791ad166b6SBenoît Canet# @target: the target of the new image. If the file exists, or if it
10801ad166b6SBenoît Canet#          is a device, the existing file/device will be used as the new
10811ad166b6SBenoît Canet#          destination.  If it does not exist, a new file will be created.
10821ad166b6SBenoît Canet#
10831ad166b6SBenoît Canet# @format: #optional the format of the new destination, default is to
10841ad166b6SBenoît Canet#          probe if @mode is 'existing', else the format of the source
10851ad166b6SBenoît Canet#
10861ad166b6SBenoît Canet# @sync: what parts of the disk image should be copied to the destination
1087d58d8453SJohn Snow#        (all the disk, only the sectors allocated in the topmost image, from a
1088d58d8453SJohn Snow#        dirty bitmap, or only new I/O).
10891ad166b6SBenoît Canet#
10901ad166b6SBenoît Canet# @mode: #optional whether and how QEMU should create a new image, default is
10911ad166b6SBenoît Canet#        'absolute-paths'.
10921ad166b6SBenoît Canet#
10931ad166b6SBenoît Canet# @speed: #optional the maximum speed, in bytes per second
10941ad166b6SBenoît Canet#
10954b80ab2bSJohn Snow# @bitmap: #optional the name of dirty bitmap if sync is "incremental".
10964b80ab2bSJohn Snow#          Must be present if sync is "incremental", must NOT be present
1097d58d8453SJohn Snow#          otherwise. (Since 2.4)
1098d58d8453SJohn Snow#
109913b9414bSPavel Butsykin# @compress: #optional true to compress data, if the target format supports it.
11006bed0280SKevin Wolf#            (default: false) (since 2.8)
110113b9414bSPavel Butsykin#
11021ad166b6SBenoît Canet# @on-source-error: #optional the action to take on an error on the source,
11031ad166b6SBenoît Canet#                   default 'report'.  'stop' and 'enospc' can only be used
11041ad166b6SBenoît Canet#                   if the block device supports io-status (see BlockInfo).
11051ad166b6SBenoît Canet#
11061ad166b6SBenoît Canet# @on-target-error: #optional the action to take on an error on the target,
11071ad166b6SBenoît Canet#                   default 'report' (no limitations, since this applies to
11081ad166b6SBenoît Canet#                   a different block device than @device).
11091ad166b6SBenoît Canet#
11105072f7b3SMarc-André Lureau# Note: @on-source-error and @on-target-error only affect background
11115072f7b3SMarc-André Lureau# I/O.  If an error occurs during a guest write request, the device's
11125072f7b3SMarc-André Lureau# rerror/werror actions will be used.
11131ad166b6SBenoît Canet#
11141ad166b6SBenoît Canet# Since: 1.6
11151ad166b6SBenoît Canet##
1116895a2a80SEric Blake{ 'struct': 'DriveBackup',
111770559d49SAlberto Garcia  'data': { '*job-id': 'str', 'device': 'str', 'target': 'str',
111870559d49SAlberto Garcia            '*format': 'str', 'sync': 'MirrorSyncMode', '*mode': 'NewImageMode',
111913b9414bSPavel Butsykin            '*speed': 'int', '*bitmap': 'str', '*compress': 'bool',
11201ad166b6SBenoît Canet            '*on-source-error': 'BlockdevOnError',
11211ad166b6SBenoît Canet            '*on-target-error': 'BlockdevOnError' } }
11221ad166b6SBenoît Canet
11231ad166b6SBenoît Canet##
11245072f7b3SMarc-André Lureau# @BlockdevBackup:
1125c29c1dd3SFam Zheng#
112670559d49SAlberto Garcia# @job-id: #optional identifier for the newly-created block job. If
112770559d49SAlberto Garcia#          omitted, the device name will be used. (Since 2.7)
112870559d49SAlberto Garcia#
1129cef34eebSKevin Wolf# @device: the device name or node-name of a root node which should be copied.
1130c29c1dd3SFam Zheng#
113139d990acSKevin Wolf# @target: the device name or node-name of the backup target node.
1132c29c1dd3SFam Zheng#
1133c29c1dd3SFam Zheng# @sync: what parts of the disk image should be copied to the destination
1134c29c1dd3SFam Zheng#        (all the disk, only the sectors allocated in the topmost image, or
1135c29c1dd3SFam Zheng#        only new I/O).
1136c29c1dd3SFam Zheng#
1137c29c1dd3SFam Zheng# @speed: #optional the maximum speed, in bytes per second. The default is 0,
1138c29c1dd3SFam Zheng#         for unlimited.
1139c29c1dd3SFam Zheng#
11403b7b1236SPavel Butsykin# @compress: #optional true to compress data, if the target format supports it.
11416bed0280SKevin Wolf#            (default: false) (since 2.8)
11423b7b1236SPavel Butsykin#
1143c29c1dd3SFam Zheng# @on-source-error: #optional the action to take on an error on the source,
1144c29c1dd3SFam Zheng#                   default 'report'.  'stop' and 'enospc' can only be used
1145c29c1dd3SFam Zheng#                   if the block device supports io-status (see BlockInfo).
1146c29c1dd3SFam Zheng#
1147c29c1dd3SFam Zheng# @on-target-error: #optional the action to take on an error on the target,
1148c29c1dd3SFam Zheng#                   default 'report' (no limitations, since this applies to
1149c29c1dd3SFam Zheng#                   a different block device than @device).
1150c29c1dd3SFam Zheng#
11515072f7b3SMarc-André Lureau# Note: @on-source-error and @on-target-error only affect background
11525072f7b3SMarc-André Lureau# I/O.  If an error occurs during a guest write request, the device's
11535072f7b3SMarc-André Lureau# rerror/werror actions will be used.
1154c29c1dd3SFam Zheng#
1155c29c1dd3SFam Zheng# Since: 2.3
1156c29c1dd3SFam Zheng##
1157895a2a80SEric Blake{ 'struct': 'BlockdevBackup',
115870559d49SAlberto Garcia  'data': { '*job-id': 'str', 'device': 'str', 'target': 'str',
1159c29c1dd3SFam Zheng            'sync': 'MirrorSyncMode',
1160c29c1dd3SFam Zheng            '*speed': 'int',
11613b7b1236SPavel Butsykin            '*compress': 'bool',
1162c29c1dd3SFam Zheng            '*on-source-error': 'BlockdevOnError',
1163c29c1dd3SFam Zheng            '*on-target-error': 'BlockdevOnError' } }
1164c29c1dd3SFam Zheng
1165c29c1dd3SFam Zheng##
11665072f7b3SMarc-André Lureau# @blockdev-snapshot-sync:
11671ad166b6SBenoît Canet#
11681ad166b6SBenoît Canet# Generates a synchronous snapshot of a block device.
11691ad166b6SBenoît Canet#
1170a911e6aeSAlberto Garcia# For the arguments, see the documentation of BlockdevSnapshotSync.
11711ad166b6SBenoît Canet#
11721ad166b6SBenoît Canet# Returns: nothing on success
11731ad166b6SBenoît Canet#          If @device is not a valid block device, DeviceNotFound
11741ad166b6SBenoît Canet#
11755072f7b3SMarc-André Lureau# Since: 0.14.0
1176b4039d8dSMarc-André Lureau#
1177b4039d8dSMarc-André Lureau# Example:
1178b4039d8dSMarc-André Lureau#
1179b4039d8dSMarc-André Lureau# -> { "execute": "blockdev-snapshot-sync",
1180b4039d8dSMarc-André Lureau#      "arguments": { "device": "ide-hd0",
1181b4039d8dSMarc-André Lureau#                     "snapshot-file":
1182b4039d8dSMarc-André Lureau#                     "/some/place/my-image",
1183b4039d8dSMarc-André Lureau#                     "format": "qcow2" } }
1184b4039d8dSMarc-André Lureau# <- { "return": {} }
1185b4039d8dSMarc-André Lureau#
11861ad166b6SBenoît Canet##
11871ad166b6SBenoît Canet{ 'command': 'blockdev-snapshot-sync',
1188a911e6aeSAlberto Garcia  'data': 'BlockdevSnapshotSync' }
11891ad166b6SBenoît Canet
119043de7e2dSAlberto Garcia
119143de7e2dSAlberto Garcia##
11925072f7b3SMarc-André Lureau# @blockdev-snapshot:
119343de7e2dSAlberto Garcia#
119443de7e2dSAlberto Garcia# Generates a snapshot of a block device.
119543de7e2dSAlberto Garcia#
11963282eca4SMarc-André Lureau# Create a snapshot, by installing 'node' as the backing image of
11973282eca4SMarc-André Lureau# 'overlay'. Additionally, if 'node' is associated with a block
11983282eca4SMarc-André Lureau# device, the block device changes to using 'overlay' as its new active
11993282eca4SMarc-André Lureau# image.
12003282eca4SMarc-André Lureau#
120143de7e2dSAlberto Garcia# For the arguments, see the documentation of BlockdevSnapshot.
120243de7e2dSAlberto Garcia#
12035072f7b3SMarc-André Lureau# Since: 2.5
12043282eca4SMarc-André Lureau#
12053282eca4SMarc-André Lureau# Example:
12063282eca4SMarc-André Lureau#
12073282eca4SMarc-André Lureau# -> { "execute": "blockdev-add",
12083282eca4SMarc-André Lureau#      "arguments": { "options": { "driver": "qcow2",
12093282eca4SMarc-André Lureau#                                  "node-name": "node1534",
12103282eca4SMarc-André Lureau#                                  "file": { "driver": "file",
12113282eca4SMarc-André Lureau#                                            "filename": "hd1.qcow2" },
12123282eca4SMarc-André Lureau#                                  "backing": "" } } }
12133282eca4SMarc-André Lureau#
12143282eca4SMarc-André Lureau# <- { "return": {} }
12153282eca4SMarc-André Lureau#
12163282eca4SMarc-André Lureau# -> { "execute": "blockdev-snapshot",
12173282eca4SMarc-André Lureau#      "arguments": { "node": "ide-hd0",
12183282eca4SMarc-André Lureau#                     "overlay": "node1534" } }
12193282eca4SMarc-André Lureau# <- { "return": {} }
12203282eca4SMarc-André Lureau#
122143de7e2dSAlberto Garcia##
122243de7e2dSAlberto Garcia{ 'command': 'blockdev-snapshot',
122343de7e2dSAlberto Garcia  'data': 'BlockdevSnapshot' }
122443de7e2dSAlberto Garcia
12251ad166b6SBenoît Canet##
12265072f7b3SMarc-André Lureau# @change-backing-file:
1227fa40e656SJeff Cody#
1228fa40e656SJeff Cody# Change the backing file in the image file metadata.  This does not
1229fa40e656SJeff Cody# cause QEMU to reopen the image file to reparse the backing filename
1230fa40e656SJeff Cody# (it may, however, perform a reopen to change permissions from
1231fa40e656SJeff Cody# r/o -> r/w -> r/o, if needed). The new backing file string is written
1232fa40e656SJeff Cody# into the image file metadata, and the QEMU internal strings are
1233fa40e656SJeff Cody# updated.
1234fa40e656SJeff Cody#
1235fa40e656SJeff Cody# @image-node-name: The name of the block driver state node of the
1236280c4b3cSMarc-André Lureau#                   image to modify. The "device" argument is used
1237280c4b3cSMarc-André Lureau#                   to verify "image-node-name" is in the chain
1238280c4b3cSMarc-André Lureau#                   described by "device".
1239fa40e656SJeff Cody#
12407b5dca3fSKevin Wolf# @device:          The device name or node-name of the root node that owns
12417b5dca3fSKevin Wolf#                   image-node-name.
1242fa40e656SJeff Cody#
1243fa40e656SJeff Cody# @backing-file:    The string to write as the backing file.  This
1244fa40e656SJeff Cody#                   string is not validated, so care should be taken
1245fa40e656SJeff Cody#                   when specifying the string or the image chain may
1246fa40e656SJeff Cody#                   not be able to be reopened again.
1247fa40e656SJeff Cody#
1248280c4b3cSMarc-André Lureau# Returns: Nothing on success
1249280c4b3cSMarc-André Lureau#
1250280c4b3cSMarc-André Lureau#          If "device" does not exist or cannot be determined, DeviceNotFound
1251280c4b3cSMarc-André Lureau#
1252fa40e656SJeff Cody# Since: 2.1
1253fa40e656SJeff Cody##
1254fa40e656SJeff Cody{ 'command': 'change-backing-file',
1255fa40e656SJeff Cody  'data': { 'device': 'str', 'image-node-name': 'str',
1256fa40e656SJeff Cody            'backing-file': 'str' } }
1257fa40e656SJeff Cody
1258fa40e656SJeff Cody##
12595072f7b3SMarc-André Lureau# @block-commit:
12601ad166b6SBenoît Canet#
12611ad166b6SBenoît Canet# Live commit of data from overlay image nodes into backing nodes - i.e.,
12621ad166b6SBenoît Canet# writes data between 'top' and 'base' into 'base'.
12631ad166b6SBenoît Canet#
1264fd62c609SAlberto Garcia# @job-id: #optional identifier for the newly-created block job. If
1265fd62c609SAlberto Garcia#          omitted, the device name will be used. (Since 2.7)
1266fd62c609SAlberto Garcia#
12671d13b167SKevin Wolf# @device:  the device name or node-name of a root node
12681ad166b6SBenoît Canet#
12691ad166b6SBenoît Canet# @base:   #optional The file name of the backing image to write data into.
1270f44fb58fSMarc-André Lureau#                    If not specified, this is the deepest backing image.
12711ad166b6SBenoît Canet#
12727676e2c5SJeff Cody# @top:    #optional The file name of the backing image within the image chain,
12737676e2c5SJeff Cody#                    which contains the topmost data to be committed down. If
12747676e2c5SJeff Cody#                    not specified, this is the active layer.
12751ad166b6SBenoît Canet#
127654e26900SJeff Cody# @backing-file:  #optional The backing file string to write into the overlay
127754e26900SJeff Cody#                           image of 'top'.  If 'top' is the active layer,
127854e26900SJeff Cody#                           specifying a backing file string is an error. This
127954e26900SJeff Cody#                           filename is not validated.
128054e26900SJeff Cody#
128154e26900SJeff Cody#                           If a pathname string is such that it cannot be
128254e26900SJeff Cody#                           resolved by QEMU, that means that subsequent QMP or
128354e26900SJeff Cody#                           HMP commands must use node-names for the image in
128454e26900SJeff Cody#                           question, as filename lookup methods will fail.
128554e26900SJeff Cody#
128654e26900SJeff Cody#                           If not specified, QEMU will automatically determine
128754e26900SJeff Cody#                           the backing file string to use, or error out if
128854e26900SJeff Cody#                           there is no obvious choice. Care should be taken
128954e26900SJeff Cody#                           when specifying the string, to specify a valid
129054e26900SJeff Cody#                           filename or protocol.
129154e26900SJeff Cody#                           (Since 2.1)
129254e26900SJeff Cody#
12931ad166b6SBenoît Canet#                    If top == base, that is an error.
12941ad166b6SBenoît Canet#                    If top == active, the job will not be completed by itself,
12951ad166b6SBenoît Canet#                    user needs to complete the job with the block-job-complete
12961ad166b6SBenoît Canet#                    command after getting the ready event. (Since 2.0)
12971ad166b6SBenoît Canet#
12981ad166b6SBenoît Canet#                    If the base image is smaller than top, then the base image
12991ad166b6SBenoît Canet#                    will be resized to be the same size as top.  If top is
13001ad166b6SBenoît Canet#                    smaller than the base image, the base will not be
13011ad166b6SBenoît Canet#                    truncated.  If you want the base image size to match the
13021ad166b6SBenoît Canet#                    size of the smaller top, you can safely truncate it
13031ad166b6SBenoît Canet#                    yourself once the commit operation successfully completes.
13041ad166b6SBenoît Canet#
13051ad166b6SBenoît Canet# @speed:  #optional the maximum speed, in bytes per second
13061ad166b6SBenoît Canet#
13071ad166b6SBenoît Canet# Returns: Nothing on success
13081ad166b6SBenoît Canet#          If commit or stream is already active on this device, DeviceInUse
13091ad166b6SBenoît Canet#          If @device does not exist, DeviceNotFound
13101ad166b6SBenoît Canet#          If image commit is not supported by this device, NotSupported
13111ad166b6SBenoît Canet#          If @base or @top is invalid, a generic error is returned
13121ad166b6SBenoît Canet#          If @speed is invalid, InvalidParameter
13131ad166b6SBenoît Canet#
13141ad166b6SBenoît Canet# Since: 1.3
13151ad166b6SBenoît Canet#
1316f44fb58fSMarc-André Lureau# Example:
1317f44fb58fSMarc-André Lureau#
1318f44fb58fSMarc-André Lureau# -> { "execute": "block-commit",
1319f44fb58fSMarc-André Lureau#      "arguments": { "device": "virtio0",
1320f44fb58fSMarc-André Lureau#                     "top": "/tmp/snap1.qcow2" } }
1321f44fb58fSMarc-André Lureau# <- { "return": {} }
1322f44fb58fSMarc-André Lureau#
13231ad166b6SBenoît Canet##
13241ad166b6SBenoît Canet{ 'command': 'block-commit',
1325fd62c609SAlberto Garcia  'data': { '*job-id': 'str', 'device': 'str', '*base': 'str', '*top': 'str',
132654e26900SJeff Cody            '*backing-file': 'str', '*speed': 'int' } }
13271ad166b6SBenoît Canet
13281ad166b6SBenoît Canet##
13295072f7b3SMarc-André Lureau# @drive-backup:
13301ad166b6SBenoît Canet#
13311ad166b6SBenoît Canet# Start a point-in-time copy of a block device to a new destination.  The
13321ad166b6SBenoît Canet# status of ongoing drive-backup operations can be checked with
13331ad166b6SBenoît Canet# query-block-jobs where the BlockJobInfo.type field has the value 'backup'.
13341ad166b6SBenoît Canet# The operation can be stopped before it has completed using the
13351ad166b6SBenoît Canet# block-job-cancel command.
13361ad166b6SBenoît Canet#
13371ad166b6SBenoît Canet# For the arguments, see the documentation of DriveBackup.
13381ad166b6SBenoît Canet#
13391ad166b6SBenoît Canet# Returns: nothing on success
1340b7e4fa22SKevin Wolf#          If @device is not a valid block device, GenericError
13411ad166b6SBenoît Canet#
13425072f7b3SMarc-André Lureau# Since: 1.6
1343b0336412SMarc-André Lureau#
1344b0336412SMarc-André Lureau# Example:
1345b0336412SMarc-André Lureau#
1346b0336412SMarc-André Lureau# -> { "execute": "drive-backup",
1347b0336412SMarc-André Lureau#      "arguments": { "device": "drive0",
1348b0336412SMarc-André Lureau#                     "sync": "full",
1349b0336412SMarc-André Lureau#                     "target": "backup.img" } }
1350b0336412SMarc-André Lureau# <- { "return": {} }
1351b0336412SMarc-André Lureau#
13521ad166b6SBenoît Canet##
135381206a89SPavel Butsykin{ 'command': 'drive-backup', 'boxed': true,
135481206a89SPavel Butsykin  'data': 'DriveBackup' }
13551ad166b6SBenoît Canet
13561ad166b6SBenoît Canet##
13575072f7b3SMarc-André Lureau# @blockdev-backup:
1358c29c1dd3SFam Zheng#
1359c29c1dd3SFam Zheng# Start a point-in-time copy of a block device to a new destination.  The
1360c29c1dd3SFam Zheng# status of ongoing blockdev-backup operations can be checked with
1361c29c1dd3SFam Zheng# query-block-jobs where the BlockJobInfo.type field has the value 'backup'.
1362c29c1dd3SFam Zheng# The operation can be stopped before it has completed using the
1363c29c1dd3SFam Zheng# block-job-cancel command.
1364c29c1dd3SFam Zheng#
1365c29c1dd3SFam Zheng# For the arguments, see the documentation of BlockdevBackup.
1366c29c1dd3SFam Zheng#
1367dc7a4a9eSPavel Butsykin# Returns: nothing on success
1368dc7a4a9eSPavel Butsykin#          If @device is not a valid block device, DeviceNotFound
1369dc7a4a9eSPavel Butsykin#
13705072f7b3SMarc-André Lureau# Since: 2.3
13711cf75113SMarc-André Lureau#
13721cf75113SMarc-André Lureau# Example:
13731cf75113SMarc-André Lureau# -> { "execute": "blockdev-backup",
13741cf75113SMarc-André Lureau#      "arguments": { "device": "src-id",
13751cf75113SMarc-André Lureau#                     "sync": "full",
13761cf75113SMarc-André Lureau#                     "target": "tgt-id" } }
13771cf75113SMarc-André Lureau# <- { "return": {} }
13781cf75113SMarc-André Lureau#
1379c29c1dd3SFam Zheng##
1380dc7a4a9eSPavel Butsykin{ 'command': 'blockdev-backup', 'boxed': true,
1381dc7a4a9eSPavel Butsykin  'data': 'BlockdevBackup' }
1382c29c1dd3SFam Zheng
1383c29c1dd3SFam Zheng
1384c29c1dd3SFam Zheng##
13855072f7b3SMarc-André Lureau# @query-named-block-nodes:
13861ad166b6SBenoît Canet#
13871ad166b6SBenoît Canet# Get the named block driver list
13881ad166b6SBenoît Canet#
13891ad166b6SBenoît Canet# Returns: the list of BlockDeviceInfo
13901ad166b6SBenoît Canet#
13915072f7b3SMarc-André Lureau# Since: 2.0
1392e1f34cb2SMarc-André Lureau#
1393e1f34cb2SMarc-André Lureau# Example:
1394e1f34cb2SMarc-André Lureau#
1395e1f34cb2SMarc-André Lureau# -> { "execute": "query-named-block-nodes" }
1396e1f34cb2SMarc-André Lureau# <- { "return": [ { "ro":false,
1397e1f34cb2SMarc-André Lureau#                    "drv":"qcow2",
1398e1f34cb2SMarc-André Lureau#                    "encrypted":false,
1399e1f34cb2SMarc-André Lureau#                    "file":"disks/test.qcow2",
1400e1f34cb2SMarc-André Lureau#                    "node-name": "my-node",
1401e1f34cb2SMarc-André Lureau#                    "backing_file_depth":1,
1402e1f34cb2SMarc-André Lureau#                    "bps":1000000,
1403e1f34cb2SMarc-André Lureau#                    "bps_rd":0,
1404e1f34cb2SMarc-André Lureau#                    "bps_wr":0,
1405e1f34cb2SMarc-André Lureau#                    "iops":1000000,
1406e1f34cb2SMarc-André Lureau#                    "iops_rd":0,
1407e1f34cb2SMarc-André Lureau#                    "iops_wr":0,
1408e1f34cb2SMarc-André Lureau#                    "bps_max": 8000000,
1409e1f34cb2SMarc-André Lureau#                    "bps_rd_max": 0,
1410e1f34cb2SMarc-André Lureau#                    "bps_wr_max": 0,
1411e1f34cb2SMarc-André Lureau#                    "iops_max": 0,
1412e1f34cb2SMarc-André Lureau#                    "iops_rd_max": 0,
1413e1f34cb2SMarc-André Lureau#                    "iops_wr_max": 0,
1414e1f34cb2SMarc-André Lureau#                    "iops_size": 0,
1415e1f34cb2SMarc-André Lureau#                    "write_threshold": 0,
1416e1f34cb2SMarc-André Lureau#                    "image":{
1417e1f34cb2SMarc-André Lureau#                       "filename":"disks/test.qcow2",
1418e1f34cb2SMarc-André Lureau#                       "format":"qcow2",
1419e1f34cb2SMarc-André Lureau#                       "virtual-size":2048000,
1420e1f34cb2SMarc-André Lureau#                       "backing_file":"base.qcow2",
1421e1f34cb2SMarc-André Lureau#                       "full-backing-filename":"disks/base.qcow2",
1422e1f34cb2SMarc-André Lureau#                       "backing-filename-format":"qcow2",
1423e1f34cb2SMarc-André Lureau#                       "snapshots":[
1424e1f34cb2SMarc-André Lureau#                          {
1425e1f34cb2SMarc-André Lureau#                             "id": "1",
1426e1f34cb2SMarc-André Lureau#                             "name": "snapshot1",
1427e1f34cb2SMarc-André Lureau#                             "vm-state-size": 0,
1428e1f34cb2SMarc-André Lureau#                             "date-sec": 10000200,
1429e1f34cb2SMarc-André Lureau#                             "date-nsec": 12,
1430e1f34cb2SMarc-André Lureau#                             "vm-clock-sec": 206,
1431e1f34cb2SMarc-André Lureau#                             "vm-clock-nsec": 30
1432e1f34cb2SMarc-André Lureau#                          }
1433e1f34cb2SMarc-André Lureau#                       ],
1434e1f34cb2SMarc-André Lureau#                       "backing-image":{
1435e1f34cb2SMarc-André Lureau#                           "filename":"disks/base.qcow2",
1436e1f34cb2SMarc-André Lureau#                           "format":"qcow2",
1437e1f34cb2SMarc-André Lureau#                           "virtual-size":2048000
1438e1f34cb2SMarc-André Lureau#                       }
1439e1f34cb2SMarc-André Lureau#                    } } ] }
1440e1f34cb2SMarc-André Lureau#
14411ad166b6SBenoît Canet##
14421ad166b6SBenoît Canet{ 'command': 'query-named-block-nodes', 'returns': [ 'BlockDeviceInfo' ] }
14431ad166b6SBenoît Canet
14441ad166b6SBenoît Canet##
14455072f7b3SMarc-André Lureau# @drive-mirror:
14461ad166b6SBenoît Canet#
144712a21b73SMarc-André Lureau# Start mirroring a block device's writes to a new destination. target
144812a21b73SMarc-André Lureau# specifies the target of the new image. If the file exists, or if it
144912a21b73SMarc-André Lureau# is a device, it will be used as the new destination for writes. If
145012a21b73SMarc-André Lureau# it does not exist, a new file will be created. format specifies the
145112a21b73SMarc-André Lureau# format of the mirror image, default is to probe if mode='existing',
145212a21b73SMarc-André Lureau# else the format of the source.
14531ad166b6SBenoît Canet#
1454faecd40aSEric Blake# See DriveMirror for parameter descriptions
1455faecd40aSEric Blake#
1456faecd40aSEric Blake# Returns: nothing on success
14570524e93aSKevin Wolf#          If @device is not a valid block device, GenericError
1458faecd40aSEric Blake#
14595072f7b3SMarc-André Lureau# Since: 1.3
146012a21b73SMarc-André Lureau#
146112a21b73SMarc-André Lureau# Example:
146212a21b73SMarc-André Lureau#
146312a21b73SMarc-André Lureau# -> { "execute": "drive-mirror",
146412a21b73SMarc-André Lureau#      "arguments": { "device": "ide-hd0",
146512a21b73SMarc-André Lureau#                     "target": "/some/place/my-image",
146612a21b73SMarc-André Lureau#                     "sync": "full",
146712a21b73SMarc-André Lureau#                     "format": "qcow2" } }
146812a21b73SMarc-André Lureau# <- { "return": {} }
146912a21b73SMarc-André Lureau#
1470faecd40aSEric Blake##
1471faecd40aSEric Blake{ 'command': 'drive-mirror', 'boxed': true,
1472faecd40aSEric Blake  'data': 'DriveMirror' }
1473faecd40aSEric Blake
1474faecd40aSEric Blake##
14755072f7b3SMarc-André Lureau# @DriveMirror:
1476faecd40aSEric Blake#
1477faecd40aSEric Blake# A set of parameters describing drive mirror setup.
1478faecd40aSEric Blake#
147971aa9867SAlberto Garcia# @job-id: #optional identifier for the newly-created block job. If
148071aa9867SAlberto Garcia#          omitted, the device name will be used. (Since 2.7)
148171aa9867SAlberto Garcia#
14820524e93aSKevin Wolf# @device:  the device name or node-name of a root node whose writes should be
14830524e93aSKevin Wolf#           mirrored.
14841ad166b6SBenoît Canet#
14851ad166b6SBenoît Canet# @target: the target of the new image. If the file exists, or if it
14861ad166b6SBenoît Canet#          is a device, the existing file/device will be used as the new
14871ad166b6SBenoît Canet#          destination.  If it does not exist, a new file will be created.
14881ad166b6SBenoît Canet#
14891ad166b6SBenoît Canet# @format: #optional the format of the new destination, default is to
14901ad166b6SBenoît Canet#          probe if @mode is 'existing', else the format of the source
14911ad166b6SBenoît Canet#
14924c828dc6SBenoît Canet# @node-name: #optional the new block driver state node name in the graph
14934c828dc6SBenoît Canet#             (Since 2.1)
14944c828dc6SBenoît Canet#
149509158f00SBenoît Canet# @replaces: #optional with sync=full graph node name to be replaced by the new
149609158f00SBenoît Canet#            image when a whole image copy is done. This can be used to repair
149709158f00SBenoît Canet#            broken Quorum files. (Since 2.1)
149809158f00SBenoît Canet#
14991ad166b6SBenoît Canet# @mode: #optional whether and how QEMU should create a new image, default is
15001ad166b6SBenoît Canet#        'absolute-paths'.
15011ad166b6SBenoît Canet#
15021ad166b6SBenoît Canet# @speed:  #optional the maximum speed, in bytes per second
15031ad166b6SBenoît Canet#
15041ad166b6SBenoît Canet# @sync: what parts of the disk image should be copied to the destination
15051ad166b6SBenoît Canet#        (all the disk, only the sectors allocated in the topmost image, or
15061ad166b6SBenoît Canet#        only new I/O).
15071ad166b6SBenoît Canet#
15081ad166b6SBenoît Canet# @granularity: #optional granularity of the dirty bitmap, default is 64K
15091ad166b6SBenoît Canet#               if the image format doesn't have clusters, 4K if the clusters
15101ad166b6SBenoît Canet#               are smaller than that, else the cluster size.  Must be a
15111ad166b6SBenoît Canet#               power of 2 between 512 and 64M (since 1.4).
15121ad166b6SBenoît Canet#
15131ad166b6SBenoît Canet# @buf-size: #optional maximum amount of data in flight from source to
15141ad166b6SBenoît Canet#            target (since 1.4).
15151ad166b6SBenoît Canet#
15161ad166b6SBenoît Canet# @on-source-error: #optional the action to take on an error on the source,
15171ad166b6SBenoît Canet#                   default 'report'.  'stop' and 'enospc' can only be used
15181ad166b6SBenoît Canet#                   if the block device supports io-status (see BlockInfo).
15191ad166b6SBenoît Canet#
15201ad166b6SBenoît Canet# @on-target-error: #optional the action to take on an error on the target,
15211ad166b6SBenoît Canet#                   default 'report' (no limitations, since this applies to
15221ad166b6SBenoît Canet#                   a different block device than @device).
15230fc9f8eaSFam Zheng# @unmap: #optional Whether to try to unmap target sectors where source has
15240fc9f8eaSFam Zheng#         only zero. If true, and target unallocated sectors will read as zero,
15250fc9f8eaSFam Zheng#         target image sectors will be unmapped; otherwise, zeroes will be
15260fc9f8eaSFam Zheng#         written. Both will result in identical contents.
15270fc9f8eaSFam Zheng#         Default is true. (Since 2.4)
15281ad166b6SBenoît Canet#
15295072f7b3SMarc-André Lureau# Since: 1.3
15301ad166b6SBenoît Canet##
1531faecd40aSEric Blake{ 'struct': 'DriveMirror',
153271aa9867SAlberto Garcia  'data': { '*job-id': 'str', 'device': 'str', 'target': 'str',
153371aa9867SAlberto Garcia            '*format': 'str', '*node-name': 'str', '*replaces': 'str',
15341ad166b6SBenoît Canet            'sync': 'MirrorSyncMode', '*mode': 'NewImageMode',
15351ad166b6SBenoît Canet            '*speed': 'int', '*granularity': 'uint32',
15361ad166b6SBenoît Canet            '*buf-size': 'int', '*on-source-error': 'BlockdevOnError',
15370fc9f8eaSFam Zheng            '*on-target-error': 'BlockdevOnError',
15380fc9f8eaSFam Zheng            '*unmap': 'bool' } }
15391ad166b6SBenoît Canet
15401ad166b6SBenoît Canet##
15415072f7b3SMarc-André Lureau# @BlockDirtyBitmap:
1542341ebc2fSJohn Snow#
1543341ebc2fSJohn Snow# @node: name of device/node which the bitmap is tracking
1544341ebc2fSJohn Snow#
1545341ebc2fSJohn Snow# @name: name of the dirty bitmap
1546341ebc2fSJohn Snow#
15475072f7b3SMarc-André Lureau# Since: 2.4
1548341ebc2fSJohn Snow##
1549895a2a80SEric Blake{ 'struct': 'BlockDirtyBitmap',
1550341ebc2fSJohn Snow  'data': { 'node': 'str', 'name': 'str' } }
1551341ebc2fSJohn Snow
1552341ebc2fSJohn Snow##
15535072f7b3SMarc-André Lureau# @BlockDirtyBitmapAdd:
1554341ebc2fSJohn Snow#
1555341ebc2fSJohn Snow# @node: name of device/node which the bitmap is tracking
1556341ebc2fSJohn Snow#
1557341ebc2fSJohn Snow# @name: name of the dirty bitmap
1558341ebc2fSJohn Snow#
1559341ebc2fSJohn Snow# @granularity: #optional the bitmap granularity, default is 64k for
1560341ebc2fSJohn Snow#               block-dirty-bitmap-add
1561341ebc2fSJohn Snow#
15625072f7b3SMarc-André Lureau# Since: 2.4
1563341ebc2fSJohn Snow##
1564895a2a80SEric Blake{ 'struct': 'BlockDirtyBitmapAdd',
1565341ebc2fSJohn Snow  'data': { 'node': 'str', 'name': 'str', '*granularity': 'uint32' } }
1566341ebc2fSJohn Snow
1567341ebc2fSJohn Snow##
15685072f7b3SMarc-André Lureau# @block-dirty-bitmap-add:
1569341ebc2fSJohn Snow#
15702258a5dbSMarc-André Lureau# Create a dirty bitmap with a name on the node, and start tracking the writes.
1571341ebc2fSJohn Snow#
1572341ebc2fSJohn Snow# Returns: nothing on success
1573341ebc2fSJohn Snow#          If @node is not a valid block device or node, DeviceNotFound
1574341ebc2fSJohn Snow#          If @name is already taken, GenericError with an explanation
1575341ebc2fSJohn Snow#
15765072f7b3SMarc-André Lureau# Since: 2.4
15772258a5dbSMarc-André Lureau#
15782258a5dbSMarc-André Lureau# Example:
15792258a5dbSMarc-André Lureau#
15802258a5dbSMarc-André Lureau# -> { "execute": "block-dirty-bitmap-add",
15812258a5dbSMarc-André Lureau#      "arguments": { "node": "drive0", "name": "bitmap0" } }
15822258a5dbSMarc-André Lureau# <- { "return": {} }
15832258a5dbSMarc-André Lureau#
1584341ebc2fSJohn Snow##
1585341ebc2fSJohn Snow{ 'command': 'block-dirty-bitmap-add',
1586341ebc2fSJohn Snow  'data': 'BlockDirtyBitmapAdd' }
1587341ebc2fSJohn Snow
1588341ebc2fSJohn Snow##
15895072f7b3SMarc-André Lureau# @block-dirty-bitmap-remove:
1590341ebc2fSJohn Snow#
15914bbca422SMarc-André Lureau# Stop write tracking and remove the dirty bitmap that was created
15924bbca422SMarc-André Lureau# with block-dirty-bitmap-add.
1593341ebc2fSJohn Snow#
1594341ebc2fSJohn Snow# Returns: nothing on success
1595341ebc2fSJohn Snow#          If @node is not a valid block device or node, DeviceNotFound
1596341ebc2fSJohn Snow#          If @name is not found, GenericError with an explanation
15979bd2b08fSJohn Snow#          if @name is frozen by an operation, GenericError
1598341ebc2fSJohn Snow#
15995072f7b3SMarc-André Lureau# Since: 2.4
16004bbca422SMarc-André Lureau#
16014bbca422SMarc-André Lureau# Example:
16024bbca422SMarc-André Lureau#
16034bbca422SMarc-André Lureau# -> { "execute": "block-dirty-bitmap-remove",
16044bbca422SMarc-André Lureau#      "arguments": { "node": "drive0", "name": "bitmap0" } }
16054bbca422SMarc-André Lureau# <- { "return": {} }
16064bbca422SMarc-André Lureau#
1607341ebc2fSJohn Snow##
1608341ebc2fSJohn Snow{ 'command': 'block-dirty-bitmap-remove',
1609341ebc2fSJohn Snow  'data': 'BlockDirtyBitmap' }
1610341ebc2fSJohn Snow
1611341ebc2fSJohn Snow##
16125072f7b3SMarc-André Lureau# @block-dirty-bitmap-clear:
1613e74e6b78SJohn Snow#
161473dffdc8SMarc-André Lureau# Clear (reset) a dirty bitmap on the device, so that an incremental
161573dffdc8SMarc-André Lureau# backup from this point in time forward will only backup clusters
161673dffdc8SMarc-André Lureau# modified after this clear operation.
1617e74e6b78SJohn Snow#
1618e74e6b78SJohn Snow# Returns: nothing on success
1619e74e6b78SJohn Snow#          If @node is not a valid block device, DeviceNotFound
1620e74e6b78SJohn Snow#          If @name is not found, GenericError with an explanation
1621e74e6b78SJohn Snow#
16225072f7b3SMarc-André Lureau# Since: 2.4
162373dffdc8SMarc-André Lureau#
162473dffdc8SMarc-André Lureau# Example:
162573dffdc8SMarc-André Lureau#
162673dffdc8SMarc-André Lureau# -> { "execute": "block-dirty-bitmap-clear",
162773dffdc8SMarc-André Lureau#      "arguments": { "node": "drive0", "name": "bitmap0" } }
162873dffdc8SMarc-André Lureau# <- { "return": {} }
162973dffdc8SMarc-André Lureau#
1630e74e6b78SJohn Snow##
1631e74e6b78SJohn Snow{ 'command': 'block-dirty-bitmap-clear',
1632e74e6b78SJohn Snow  'data': 'BlockDirtyBitmap' }
1633e74e6b78SJohn Snow
1634e74e6b78SJohn Snow##
16355072f7b3SMarc-André Lureau# @blockdev-mirror:
1636df92562eSFam Zheng#
1637df92562eSFam Zheng# Start mirroring a block device's writes to a new destination.
1638df92562eSFam Zheng#
163971aa9867SAlberto Garcia# @job-id: #optional identifier for the newly-created block job. If
164071aa9867SAlberto Garcia#          omitted, the device name will be used. (Since 2.7)
164171aa9867SAlberto Garcia#
164207eec652SKevin Wolf# @device: The device name or node-name of a root node whose writes should be
164307eec652SKevin Wolf#          mirrored.
1644df92562eSFam Zheng#
1645df92562eSFam Zheng# @target: the id or node-name of the block device to mirror to. This mustn't be
1646df92562eSFam Zheng#          attached to guest.
1647df92562eSFam Zheng#
1648df92562eSFam Zheng# @replaces: #optional with sync=full graph node name to be replaced by the new
1649df92562eSFam Zheng#            image when a whole image copy is done. This can be used to repair
1650df92562eSFam Zheng#            broken Quorum files.
1651df92562eSFam Zheng#
1652df92562eSFam Zheng# @speed:  #optional the maximum speed, in bytes per second
1653df92562eSFam Zheng#
1654df92562eSFam Zheng# @sync: what parts of the disk image should be copied to the destination
1655df92562eSFam Zheng#        (all the disk, only the sectors allocated in the topmost image, or
1656df92562eSFam Zheng#        only new I/O).
1657df92562eSFam Zheng#
1658df92562eSFam Zheng# @granularity: #optional granularity of the dirty bitmap, default is 64K
1659df92562eSFam Zheng#               if the image format doesn't have clusters, 4K if the clusters
1660df92562eSFam Zheng#               are smaller than that, else the cluster size.  Must be a
1661df92562eSFam Zheng#               power of 2 between 512 and 64M
1662df92562eSFam Zheng#
1663df92562eSFam Zheng# @buf-size: #optional maximum amount of data in flight from source to
1664df92562eSFam Zheng#            target
1665df92562eSFam Zheng#
1666df92562eSFam Zheng# @on-source-error: #optional the action to take on an error on the source,
1667df92562eSFam Zheng#                   default 'report'.  'stop' and 'enospc' can only be used
1668df92562eSFam Zheng#                   if the block device supports io-status (see BlockInfo).
1669df92562eSFam Zheng#
1670df92562eSFam Zheng# @on-target-error: #optional the action to take on an error on the target,
1671df92562eSFam Zheng#                   default 'report' (no limitations, since this applies to
1672df92562eSFam Zheng#                   a different block device than @device).
1673df92562eSFam Zheng#
1674df92562eSFam Zheng# Returns: nothing on success.
1675df92562eSFam Zheng#
16765072f7b3SMarc-André Lureau# Since: 2.6
1677f6235a25SMarc-André Lureau#
1678f6235a25SMarc-André Lureau# Example:
1679f6235a25SMarc-André Lureau#
1680f6235a25SMarc-André Lureau# -> { "execute": "blockdev-mirror",
1681f6235a25SMarc-André Lureau#      "arguments": { "device": "ide-hd0",
1682f6235a25SMarc-André Lureau#                     "target": "target0",
1683f6235a25SMarc-André Lureau#                     "sync": "full" } }
1684f6235a25SMarc-André Lureau# <- { "return": {} }
1685f6235a25SMarc-André Lureau#
1686df92562eSFam Zheng##
1687df92562eSFam Zheng{ 'command': 'blockdev-mirror',
168871aa9867SAlberto Garcia  'data': { '*job-id': 'str', 'device': 'str', 'target': 'str',
1689df92562eSFam Zheng            '*replaces': 'str',
1690df92562eSFam Zheng            'sync': 'MirrorSyncMode',
1691df92562eSFam Zheng            '*speed': 'int', '*granularity': 'uint32',
1692df92562eSFam Zheng            '*buf-size': 'int', '*on-source-error': 'BlockdevOnError',
1693df92562eSFam Zheng            '*on-target-error': 'BlockdevOnError' } }
1694df92562eSFam Zheng
1695df92562eSFam Zheng##
16961ad166b6SBenoît Canet# @block_set_io_throttle:
16971ad166b6SBenoît Canet#
16981ad166b6SBenoît Canet# Change I/O throttle limits for a block drive.
16991ad166b6SBenoît Canet#
170076f4afb4SAlberto Garcia# Since QEMU 2.4, each device with I/O limits is member of a throttle
170176f4afb4SAlberto Garcia# group.
170276f4afb4SAlberto Garcia#
170376f4afb4SAlberto Garcia# If two or more devices are members of the same group, the limits
170476f4afb4SAlberto Garcia# will apply to the combined I/O of the whole group in a round-robin
170576f4afb4SAlberto Garcia# fashion. Therefore, setting new I/O limits to a device will affect
170676f4afb4SAlberto Garcia# the whole group.
170776f4afb4SAlberto Garcia#
170876f4afb4SAlberto Garcia# The name of the group can be specified using the 'group' parameter.
170976f4afb4SAlberto Garcia# If the parameter is unset, it is assumed to be the current group of
171076f4afb4SAlberto Garcia# that device. If it's not in any group yet, the name of the device
171176f4afb4SAlberto Garcia# will be used as the name for its group.
171276f4afb4SAlberto Garcia#
171376f4afb4SAlberto Garcia# The 'group' parameter can also be used to move a device to a
171476f4afb4SAlberto Garcia# different group. In this case the limits specified in the parameters
171576f4afb4SAlberto Garcia# will be applied to the new group only.
171676f4afb4SAlberto Garcia#
171776f4afb4SAlberto Garcia# I/O limits can be disabled by setting all of them to 0. In this case
171876f4afb4SAlberto Garcia# the device will be removed from its group and the rest of its
17196b932c0aSAlberto Garcia# members will not be affected. The 'group' parameter is ignored.
172076f4afb4SAlberto Garcia#
17214dc9397bSEric Blake# See BlockIOThrottle for parameter descriptions.
17224dc9397bSEric Blake#
17234dc9397bSEric Blake# Returns: Nothing on success
17244dc9397bSEric Blake#          If @device is not a valid block device, DeviceNotFound
17254dc9397bSEric Blake#
17264dc9397bSEric Blake# Since: 1.1
1727b4a0ac14SMarc-André Lureau#
1728b4a0ac14SMarc-André Lureau# Example:
1729b4a0ac14SMarc-André Lureau#
1730b4a0ac14SMarc-André Lureau# -> { "execute": "block_set_io_throttle",
1731b4a0ac14SMarc-André Lureau#      "arguments": { "id": "ide0-1-0",
1732b4a0ac14SMarc-André Lureau#                     "bps": 1000000,
1733b4a0ac14SMarc-André Lureau#                     "bps_rd": 0,
1734b4a0ac14SMarc-André Lureau#                     "bps_wr": 0,
1735b4a0ac14SMarc-André Lureau#                     "iops": 0,
1736b4a0ac14SMarc-André Lureau#                     "iops_rd": 0,
1737b4a0ac14SMarc-André Lureau#                     "iops_wr": 0,
1738b4a0ac14SMarc-André Lureau#                     "bps_max": 8000000,
1739b4a0ac14SMarc-André Lureau#                     "bps_rd_max": 0,
1740b4a0ac14SMarc-André Lureau#                     "bps_wr_max": 0,
1741b4a0ac14SMarc-André Lureau#                     "iops_max": 0,
1742b4a0ac14SMarc-André Lureau#                     "iops_rd_max": 0,
1743b4a0ac14SMarc-André Lureau#                     "iops_wr_max": 0,
1744b4a0ac14SMarc-André Lureau#                     "bps_max_length": 60,
1745b4a0ac14SMarc-André Lureau#                     "iops_size": 0 } }
1746b4a0ac14SMarc-André Lureau# <- { "return": {} }
17474dc9397bSEric Blake##
17484dc9397bSEric Blake{ 'command': 'block_set_io_throttle', 'boxed': true,
17494dc9397bSEric Blake  'data': 'BlockIOThrottle' }
17504dc9397bSEric Blake
17514dc9397bSEric Blake##
17525072f7b3SMarc-André Lureau# @BlockIOThrottle:
17534dc9397bSEric Blake#
17544dc9397bSEric Blake# A set of parameters describing block throttling.
17554dc9397bSEric Blake#
17567a9877a0SKevin Wolf# @device: #optional Block device name (deprecated, use @id instead)
17577a9877a0SKevin Wolf#
17587a9877a0SKevin Wolf# @id: #optional The name or QOM path of the guest device (since: 2.8)
17591ad166b6SBenoît Canet#
17601ad166b6SBenoît Canet# @bps: total throughput limit in bytes per second
17611ad166b6SBenoît Canet#
17621ad166b6SBenoît Canet# @bps_rd: read throughput limit in bytes per second
17631ad166b6SBenoît Canet#
17641ad166b6SBenoît Canet# @bps_wr: write throughput limit in bytes per second
17651ad166b6SBenoît Canet#
17661ad166b6SBenoît Canet# @iops: total I/O operations per second
17671ad166b6SBenoît Canet#
1768f5a845fdSAlberto Garcia# @iops_rd: read I/O operations per second
17691ad166b6SBenoît Canet#
17701ad166b6SBenoît Canet# @iops_wr: write I/O operations per second
17711ad166b6SBenoît Canet#
1772dce13204SAlberto Garcia# @bps_max: #optional total throughput limit during bursts,
1773dce13204SAlberto Garcia#                     in bytes (Since 1.7)
17741ad166b6SBenoît Canet#
1775dce13204SAlberto Garcia# @bps_rd_max: #optional read throughput limit during bursts,
1776dce13204SAlberto Garcia#                        in bytes (Since 1.7)
17771ad166b6SBenoît Canet#
1778dce13204SAlberto Garcia# @bps_wr_max: #optional write throughput limit during bursts,
1779dce13204SAlberto Garcia#                        in bytes (Since 1.7)
17801ad166b6SBenoît Canet#
1781dce13204SAlberto Garcia# @iops_max: #optional total I/O operations per second during bursts,
1782dce13204SAlberto Garcia#                      in bytes (Since 1.7)
17831ad166b6SBenoît Canet#
1784dce13204SAlberto Garcia# @iops_rd_max: #optional read I/O operations per second during bursts,
1785dce13204SAlberto Garcia#                         in bytes (Since 1.7)
17861ad166b6SBenoît Canet#
1787dce13204SAlberto Garcia# @iops_wr_max: #optional write I/O operations per second during bursts,
1788dce13204SAlberto Garcia#                         in bytes (Since 1.7)
1789dce13204SAlberto Garcia#
1790dce13204SAlberto Garcia# @bps_max_length: #optional maximum length of the @bps_max burst
1791dce13204SAlberto Garcia#                            period, in seconds. It must only
1792dce13204SAlberto Garcia#                            be set if @bps_max is set as well.
1793dce13204SAlberto Garcia#                            Defaults to 1. (Since 2.6)
1794dce13204SAlberto Garcia#
1795dce13204SAlberto Garcia# @bps_rd_max_length: #optional maximum length of the @bps_rd_max
1796dce13204SAlberto Garcia#                               burst period, in seconds. It must only
1797dce13204SAlberto Garcia#                               be set if @bps_rd_max is set as well.
1798dce13204SAlberto Garcia#                               Defaults to 1. (Since 2.6)
1799dce13204SAlberto Garcia#
1800dce13204SAlberto Garcia# @bps_wr_max_length: #optional maximum length of the @bps_wr_max
1801dce13204SAlberto Garcia#                               burst period, in seconds. It must only
1802dce13204SAlberto Garcia#                               be set if @bps_wr_max is set as well.
1803dce13204SAlberto Garcia#                               Defaults to 1. (Since 2.6)
1804dce13204SAlberto Garcia#
1805dce13204SAlberto Garcia# @iops_max_length: #optional maximum length of the @iops burst
1806dce13204SAlberto Garcia#                             period, in seconds. It must only
1807dce13204SAlberto Garcia#                             be set if @iops_max is set as well.
1808dce13204SAlberto Garcia#                             Defaults to 1. (Since 2.6)
1809dce13204SAlberto Garcia#
1810dce13204SAlberto Garcia# @iops_rd_max_length: #optional maximum length of the @iops_rd_max
1811dce13204SAlberto Garcia#                                burst period, in seconds. It must only
1812dce13204SAlberto Garcia#                                be set if @iops_rd_max is set as well.
1813dce13204SAlberto Garcia#                                Defaults to 1. (Since 2.6)
1814dce13204SAlberto Garcia#
1815dce13204SAlberto Garcia# @iops_wr_max_length: #optional maximum length of the @iops_wr_max
1816dce13204SAlberto Garcia#                                burst period, in seconds. It must only
1817dce13204SAlberto Garcia#                                be set if @iops_wr_max is set as well.
1818dce13204SAlberto Garcia#                                Defaults to 1. (Since 2.6)
18191ad166b6SBenoît Canet#
18201ad166b6SBenoît Canet# @iops_size: #optional an I/O size in bytes (Since 1.7)
18211ad166b6SBenoît Canet#
182276f4afb4SAlberto Garcia# @group: #optional throttle group name (Since 2.4)
182376f4afb4SAlberto Garcia#
18241ad166b6SBenoît Canet# Since: 1.1
18251ad166b6SBenoît Canet##
18264dc9397bSEric Blake{ 'struct': 'BlockIOThrottle',
18277a9877a0SKevin Wolf  'data': { '*device': 'str', '*id': 'str', 'bps': 'int', 'bps_rd': 'int',
18287a9877a0SKevin Wolf            'bps_wr': 'int', 'iops': 'int', 'iops_rd': 'int', 'iops_wr': 'int',
18291ad166b6SBenoît Canet            '*bps_max': 'int', '*bps_rd_max': 'int',
18301ad166b6SBenoît Canet            '*bps_wr_max': 'int', '*iops_max': 'int',
18311ad166b6SBenoît Canet            '*iops_rd_max': 'int', '*iops_wr_max': 'int',
1832dce13204SAlberto Garcia            '*bps_max_length': 'int', '*bps_rd_max_length': 'int',
1833dce13204SAlberto Garcia            '*bps_wr_max_length': 'int', '*iops_max_length': 'int',
1834dce13204SAlberto Garcia            '*iops_rd_max_length': 'int', '*iops_wr_max_length': 'int',
183576f4afb4SAlberto Garcia            '*iops_size': 'int', '*group': 'str' } }
18361ad166b6SBenoît Canet
18371ad166b6SBenoît Canet##
18381ad166b6SBenoît Canet# @block-stream:
18391ad166b6SBenoît Canet#
18401ad166b6SBenoît Canet# Copy data from a backing file into a block device.
18411ad166b6SBenoît Canet#
18421ad166b6SBenoît Canet# The block streaming operation is performed in the background until the entire
18431ad166b6SBenoît Canet# backing file has been copied.  This command returns immediately once streaming
18441ad166b6SBenoît Canet# has started.  The status of ongoing block streaming operations can be checked
18451ad166b6SBenoît Canet# with query-block-jobs.  The operation can be stopped before it has completed
18461ad166b6SBenoît Canet# using the block-job-cancel command.
18471ad166b6SBenoît Canet#
1848554b6147SAlberto Garcia# The node that receives the data is called the top image, can be located in
1849554b6147SAlberto Garcia# any part of the chain (but always above the base image; see below) and can be
1850554b6147SAlberto Garcia# specified using its device or node name. Earlier qemu versions only allowed
1851554b6147SAlberto Garcia# 'device' to name the top level node; presence of the 'base-node' parameter
1852554b6147SAlberto Garcia# during introspection can be used as a witness of the enhanced semantics
1853554b6147SAlberto Garcia# of 'device'.
1854554b6147SAlberto Garcia#
18551ad166b6SBenoît Canet# If a base file is specified then sectors are not copied from that base file and
18561ad166b6SBenoît Canet# its backing chain.  When streaming completes the image file will have the base
18571ad166b6SBenoît Canet# file as its backing file.  This can be used to stream a subset of the backing
18581ad166b6SBenoît Canet# file chain instead of flattening the entire image.
18591ad166b6SBenoît Canet#
18601ad166b6SBenoît Canet# On successful completion the image file is updated to drop the backing file
18611ad166b6SBenoît Canet# and the BLOCK_JOB_COMPLETED event is emitted.
18621ad166b6SBenoît Canet#
18632323322eSAlberto Garcia# @job-id: #optional identifier for the newly-created block job. If
18642323322eSAlberto Garcia#          omitted, the device name will be used. (Since 2.7)
18652323322eSAlberto Garcia#
1866554b6147SAlberto Garcia# @device: the device or node name of the top image
18671ad166b6SBenoît Canet#
1868312fe09cSAlberto Garcia# @base:   #optional the common backing file name.
1869312fe09cSAlberto Garcia#                    It cannot be set if @base-node is also set.
1870312fe09cSAlberto Garcia#
1871312fe09cSAlberto Garcia# @base-node: #optional the node name of the backing file.
1872312fe09cSAlberto Garcia#                       It cannot be set if @base is also set. (Since 2.8)
18731ad166b6SBenoît Canet#
1874554b6147SAlberto Garcia# @backing-file: #optional The backing file string to write into the top
1875554b6147SAlberto Garcia#                          image. This filename is not validated.
187613d8cc51SJeff Cody#
187713d8cc51SJeff Cody#                          If a pathname string is such that it cannot be
187813d8cc51SJeff Cody#                          resolved by QEMU, that means that subsequent QMP or
187913d8cc51SJeff Cody#                          HMP commands must use node-names for the image in
188013d8cc51SJeff Cody#                          question, as filename lookup methods will fail.
188113d8cc51SJeff Cody#
188213d8cc51SJeff Cody#                          If not specified, QEMU will automatically determine
188313d8cc51SJeff Cody#                          the backing file string to use, or error out if there
188413d8cc51SJeff Cody#                          is no obvious choice.  Care should be taken when
188513d8cc51SJeff Cody#                          specifying the string, to specify a valid filename or
188613d8cc51SJeff Cody#                          protocol.
188713d8cc51SJeff Cody#                          (Since 2.1)
188813d8cc51SJeff Cody#
18891ad166b6SBenoît Canet# @speed:  #optional the maximum speed, in bytes per second
18901ad166b6SBenoît Canet#
18911ad166b6SBenoît Canet# @on-error: #optional the action to take on an error (default report).
18921ad166b6SBenoît Canet#            'stop' and 'enospc' can only be used if the block device
18931ad166b6SBenoît Canet#            supports io-status (see BlockInfo).  Since 1.3.
18941ad166b6SBenoît Canet#
189549b37c23SMarc-André Lureau# Returns: Nothing on success. If @device does not exist, DeviceNotFound.
189649b37c23SMarc-André Lureau#
18971ad166b6SBenoît Canet# Since: 1.1
189849b37c23SMarc-André Lureau#
189949b37c23SMarc-André Lureau# Example:
190049b37c23SMarc-André Lureau#
190149b37c23SMarc-André Lureau# -> { "execute": "block-stream",
190249b37c23SMarc-André Lureau#      "arguments": { "device": "virtio0",
190349b37c23SMarc-André Lureau#                     "base": "/tmp/master.qcow2" } }
190449b37c23SMarc-André Lureau# <- { "return": {} }
190549b37c23SMarc-André Lureau#
19061ad166b6SBenoît Canet##
19071ad166b6SBenoît Canet{ 'command': 'block-stream',
19082323322eSAlberto Garcia  'data': { '*job-id': 'str', 'device': 'str', '*base': 'str',
1909312fe09cSAlberto Garcia            '*base-node': 'str', '*backing-file': 'str', '*speed': 'int',
19102323322eSAlberto Garcia            '*on-error': 'BlockdevOnError' } }
19111ad166b6SBenoît Canet
19121ad166b6SBenoît Canet##
19131ad166b6SBenoît Canet# @block-job-set-speed:
19141ad166b6SBenoît Canet#
19151ad166b6SBenoît Canet# Set maximum speed for a background block operation.
19161ad166b6SBenoît Canet#
19171ad166b6SBenoît Canet# This command can only be issued when there is an active block job.
19181ad166b6SBenoît Canet#
19191ad166b6SBenoît Canet# Throttling can be disabled by setting the speed to 0.
19201ad166b6SBenoît Canet#
19216aae5be6SAlberto Garcia# @device: The job identifier. This used to be a device name (hence
19226aae5be6SAlberto Garcia#          the name of the parameter), but since QEMU 2.7 it can have
19236aae5be6SAlberto Garcia#          other values.
19241ad166b6SBenoît Canet#
19251ad166b6SBenoît Canet# @speed:  the maximum speed, in bytes per second, or 0 for unlimited.
19261ad166b6SBenoît Canet#          Defaults to 0.
19271ad166b6SBenoît Canet#
19281ad166b6SBenoît Canet# Returns: Nothing on success
19291ad166b6SBenoît Canet#          If no background operation is active on this device, DeviceNotActive
19301ad166b6SBenoît Canet#
19311ad166b6SBenoît Canet# Since: 1.1
19321ad166b6SBenoît Canet##
19331ad166b6SBenoît Canet{ 'command': 'block-job-set-speed',
19341ad166b6SBenoît Canet  'data': { 'device': 'str', 'speed': 'int' } }
19351ad166b6SBenoît Canet
19361ad166b6SBenoît Canet##
19371ad166b6SBenoît Canet# @block-job-cancel:
19381ad166b6SBenoît Canet#
19391ad166b6SBenoît Canet# Stop an active background block operation.
19401ad166b6SBenoît Canet#
19411ad166b6SBenoît Canet# This command returns immediately after marking the active background block
19421ad166b6SBenoît Canet# operation for cancellation.  It is an error to call this command if no
19431ad166b6SBenoît Canet# operation is in progress.
19441ad166b6SBenoît Canet#
19451ad166b6SBenoît Canet# The operation will cancel as soon as possible and then emit the
19461ad166b6SBenoît Canet# BLOCK_JOB_CANCELLED event.  Before that happens the job is still visible when
19471ad166b6SBenoît Canet# enumerated using query-block-jobs.
19481ad166b6SBenoît Canet#
19491ad166b6SBenoît Canet# For streaming, the image file retains its backing file unless the streaming
19501ad166b6SBenoît Canet# operation happens to complete just as it is being cancelled.  A new streaming
19511ad166b6SBenoît Canet# operation can be started at a later time to finish copying all data from the
19521ad166b6SBenoît Canet# backing file.
19531ad166b6SBenoît Canet#
19546aae5be6SAlberto Garcia# @device: The job identifier. This used to be a device name (hence
19556aae5be6SAlberto Garcia#          the name of the parameter), but since QEMU 2.7 it can have
19566aae5be6SAlberto Garcia#          other values.
19571ad166b6SBenoît Canet#
19581ad166b6SBenoît Canet# @force: #optional whether to allow cancellation of a paused job (default
19591ad166b6SBenoît Canet#         false).  Since 1.3.
19601ad166b6SBenoît Canet#
19611ad166b6SBenoît Canet# Returns: Nothing on success
19621ad166b6SBenoît Canet#          If no background operation is active on this device, DeviceNotActive
19631ad166b6SBenoît Canet#
19641ad166b6SBenoît Canet# Since: 1.1
19651ad166b6SBenoît Canet##
19661ad166b6SBenoît Canet{ 'command': 'block-job-cancel', 'data': { 'device': 'str', '*force': 'bool' } }
19671ad166b6SBenoît Canet
19681ad166b6SBenoît Canet##
19691ad166b6SBenoît Canet# @block-job-pause:
19701ad166b6SBenoît Canet#
19711ad166b6SBenoît Canet# Pause an active background block operation.
19721ad166b6SBenoît Canet#
19731ad166b6SBenoît Canet# This command returns immediately after marking the active background block
19741ad166b6SBenoît Canet# operation for pausing.  It is an error to call this command if no
19751ad166b6SBenoît Canet# operation is in progress.  Pausing an already paused job has no cumulative
19761ad166b6SBenoît Canet# effect; a single block-job-resume command will resume the job.
19771ad166b6SBenoît Canet#
19781ad166b6SBenoît Canet# The operation will pause as soon as possible.  No event is emitted when
19791ad166b6SBenoît Canet# the operation is actually paused.  Cancelling a paused job automatically
19801ad166b6SBenoît Canet# resumes it.
19811ad166b6SBenoît Canet#
19826aae5be6SAlberto Garcia# @device: The job identifier. This used to be a device name (hence
19836aae5be6SAlberto Garcia#          the name of the parameter), but since QEMU 2.7 it can have
19846aae5be6SAlberto Garcia#          other values.
19851ad166b6SBenoît Canet#
19861ad166b6SBenoît Canet# Returns: Nothing on success
19871ad166b6SBenoît Canet#          If no background operation is active on this device, DeviceNotActive
19881ad166b6SBenoît Canet#
19891ad166b6SBenoît Canet# Since: 1.3
19901ad166b6SBenoît Canet##
19911ad166b6SBenoît Canet{ 'command': 'block-job-pause', 'data': { 'device': 'str' } }
19921ad166b6SBenoît Canet
19931ad166b6SBenoît Canet##
19941ad166b6SBenoît Canet# @block-job-resume:
19951ad166b6SBenoît Canet#
19961ad166b6SBenoît Canet# Resume an active background block operation.
19971ad166b6SBenoît Canet#
19981ad166b6SBenoît Canet# This command returns immediately after resuming a paused background block
19991ad166b6SBenoît Canet# operation.  It is an error to call this command if no operation is in
20001ad166b6SBenoît Canet# progress.  Resuming an already running job is not an error.
20011ad166b6SBenoît Canet#
20021ad166b6SBenoît Canet# This command also clears the error status of the job.
20031ad166b6SBenoît Canet#
20046aae5be6SAlberto Garcia# @device: The job identifier. This used to be a device name (hence
20056aae5be6SAlberto Garcia#          the name of the parameter), but since QEMU 2.7 it can have
20066aae5be6SAlberto Garcia#          other values.
20071ad166b6SBenoît Canet#
20081ad166b6SBenoît Canet# Returns: Nothing on success
20091ad166b6SBenoît Canet#          If no background operation is active on this device, DeviceNotActive
20101ad166b6SBenoît Canet#
20111ad166b6SBenoît Canet# Since: 1.3
20121ad166b6SBenoît Canet##
20131ad166b6SBenoît Canet{ 'command': 'block-job-resume', 'data': { 'device': 'str' } }
20141ad166b6SBenoît Canet
20151ad166b6SBenoît Canet##
20161ad166b6SBenoît Canet# @block-job-complete:
20171ad166b6SBenoît Canet#
20181ad166b6SBenoît Canet# Manually trigger completion of an active background block operation.  This
20191ad166b6SBenoît Canet# is supported for drive mirroring, where it also switches the device to
20201ad166b6SBenoît Canet# write to the target path only.  The ability to complete is signaled with
20211ad166b6SBenoît Canet# a BLOCK_JOB_READY event.
20221ad166b6SBenoît Canet#
20231ad166b6SBenoît Canet# This command completes an active background block operation synchronously.
20241ad166b6SBenoît Canet# The ordering of this command's return with the BLOCK_JOB_COMPLETED event
20251ad166b6SBenoît Canet# is not defined.  Note that if an I/O error occurs during the processing of
20261ad166b6SBenoît Canet# this command: 1) the command itself will fail; 2) the error will be processed
20271ad166b6SBenoît Canet# according to the rerror/werror arguments that were specified when starting
20281ad166b6SBenoît Canet# the operation.
20291ad166b6SBenoît Canet#
20301ad166b6SBenoît Canet# A cancelled or paused job cannot be completed.
20311ad166b6SBenoît Canet#
20326aae5be6SAlberto Garcia# @device: The job identifier. This used to be a device name (hence
20336aae5be6SAlberto Garcia#          the name of the parameter), but since QEMU 2.7 it can have
20346aae5be6SAlberto Garcia#          other values.
20351ad166b6SBenoît Canet#
20361ad166b6SBenoît Canet# Returns: Nothing on success
20371ad166b6SBenoît Canet#          If no background operation is active on this device, DeviceNotActive
20381ad166b6SBenoît Canet#
20391ad166b6SBenoît Canet# Since: 1.3
20401ad166b6SBenoît Canet##
20411ad166b6SBenoît Canet{ 'command': 'block-job-complete', 'data': { 'device': 'str' } }
20421ad166b6SBenoît Canet
20431ad166b6SBenoît Canet##
20445072f7b3SMarc-André Lureau# @BlockdevDiscardOptions:
20451ad166b6SBenoît Canet#
20461ad166b6SBenoît Canet# Determines how to handle discard requests.
20471ad166b6SBenoît Canet#
20481ad166b6SBenoît Canet# @ignore:      Ignore the request
20491ad166b6SBenoît Canet# @unmap:       Forward as an unmap request
20501ad166b6SBenoît Canet#
20511ad166b6SBenoît Canet# Since: 1.7
20521ad166b6SBenoît Canet##
20531ad166b6SBenoît Canet{ 'enum': 'BlockdevDiscardOptions',
20541ad166b6SBenoît Canet  'data': [ 'ignore', 'unmap' ] }
20551ad166b6SBenoît Canet
20561ad166b6SBenoît Canet##
20575072f7b3SMarc-André Lureau# @BlockdevDetectZeroesOptions:
20581ad166b6SBenoît Canet#
20591ad166b6SBenoît Canet# Describes the operation mode for the automatic conversion of plain
20601ad166b6SBenoît Canet# zero writes by the OS to driver specific optimized zero write commands.
20611ad166b6SBenoît Canet#
20621ad166b6SBenoît Canet# @off:      Disabled (default)
20631ad166b6SBenoît Canet# @on:       Enabled
20641ad166b6SBenoît Canet# @unmap:    Enabled and even try to unmap blocks if possible. This requires
20651ad166b6SBenoît Canet#            also that @BlockdevDiscardOptions is set to unmap for this device.
20661ad166b6SBenoît Canet#
20671ad166b6SBenoît Canet# Since: 2.1
20681ad166b6SBenoît Canet##
20691ad166b6SBenoît Canet{ 'enum': 'BlockdevDetectZeroesOptions',
20701ad166b6SBenoît Canet  'data': [ 'off', 'on', 'unmap' ] }
20711ad166b6SBenoît Canet
20721ad166b6SBenoît Canet##
20735072f7b3SMarc-André Lureau# @BlockdevAioOptions:
20741ad166b6SBenoît Canet#
20751ad166b6SBenoît Canet# Selects the AIO backend to handle I/O requests
20761ad166b6SBenoît Canet#
20771ad166b6SBenoît Canet# @threads:     Use qemu's thread pool
20781ad166b6SBenoît Canet# @native:      Use native AIO backend (only Linux and Windows)
20791ad166b6SBenoît Canet#
20801ad166b6SBenoît Canet# Since: 1.7
20811ad166b6SBenoît Canet##
20821ad166b6SBenoît Canet{ 'enum': 'BlockdevAioOptions',
20831ad166b6SBenoît Canet  'data': [ 'threads', 'native' ] }
20841ad166b6SBenoît Canet
20851ad166b6SBenoît Canet##
20865072f7b3SMarc-André Lureau# @BlockdevCacheOptions:
20871ad166b6SBenoît Canet#
20881ad166b6SBenoît Canet# Includes cache-related options for block devices
20891ad166b6SBenoît Canet#
20901ad166b6SBenoît Canet# @direct:      #optional enables use of O_DIRECT (bypass the host page cache;
20911ad166b6SBenoît Canet#               default: false)
20921ad166b6SBenoît Canet# @no-flush:    #optional ignore any flush requests for the device (default:
20931ad166b6SBenoît Canet#               false)
20941ad166b6SBenoît Canet#
20951ad166b6SBenoît Canet# Since: 1.7
20961ad166b6SBenoît Canet##
2097895a2a80SEric Blake{ 'struct': 'BlockdevCacheOptions',
2098aaa436f9SKevin Wolf  'data': { '*direct': 'bool',
20991ad166b6SBenoît Canet            '*no-flush': 'bool' } }
21001ad166b6SBenoît Canet
21011ad166b6SBenoît Canet##
21025072f7b3SMarc-André Lureau# @BlockdevDriver:
21031ad166b6SBenoît Canet#
21041ad166b6SBenoît Canet# Drivers that are supported in block device operations.
21051ad166b6SBenoît Canet#
21069f2a70e4SMarc-André Lureau# @host_device: Since 2.1
21079f2a70e4SMarc-André Lureau# @host_cdrom: Since 2.1
21080a189ffbSPrasanna Kumar Kalever# @gluster: Since 2.7
21099f2a70e4SMarc-André Lureau# @nbd: Since 2.8
21109f2a70e4SMarc-André Lureau# @nfs: Since 2.8
21119f2a70e4SMarc-André Lureau# @replication: Since 2.8
21129f2a70e4SMarc-André Lureau# @ssh: Since 2.8
21131ad166b6SBenoît Canet#
21141ad166b6SBenoît Canet# Since: 2.0
21151ad166b6SBenoît Canet##
21161ad166b6SBenoît Canet{ 'enum': 'BlockdevDriver',
2117550830f9SStefan Hajnoczi  'data': [ 'archipelago', 'blkdebug', 'blkverify', 'bochs', 'cloop',
21187edac2ddSPrasanna Kumar Kalever            'dmg', 'file', 'ftp', 'ftps', 'gluster', 'host_cdrom',
2119aa2623d8SAshijeet Acharya            'host_device', 'http', 'https', 'luks', 'nbd', 'nfs', 'null-aio',
21206b02b1f0SMax Reitz            'null-co', 'parallels', 'qcow', 'qcow2', 'qed', 'quorum', 'raw',
212123dce387SMax Reitz            'replication', 'ssh', 'vdi', 'vhdx', 'vmdk', 'vpc',
2122ad0e90a6SAshijeet Acharya            'vvfat' ] }
21231ad166b6SBenoît Canet
21241ad166b6SBenoît Canet##
21255072f7b3SMarc-André Lureau# @BlockdevOptionsFile:
21261ad166b6SBenoît Canet#
212768555285SKevin Wolf# Driver specific block device options for the file backend.
21281ad166b6SBenoît Canet#
21291ad166b6SBenoît Canet# @filename:    path to the image file
21300a4279d9SKevin Wolf# @aio:         #optional AIO backend (default: threads) (since: 2.8)
21311ad166b6SBenoît Canet#
21321ad166b6SBenoît Canet# Since: 1.7
21331ad166b6SBenoît Canet##
2134895a2a80SEric Blake{ 'struct': 'BlockdevOptionsFile',
21350a4279d9SKevin Wolf  'data': { 'filename': 'str',
21360a4279d9SKevin Wolf            '*aio': 'BlockdevAioOptions' } }
21371ad166b6SBenoît Canet
21381ad166b6SBenoît Canet##
21395072f7b3SMarc-André Lureau# @BlockdevOptionsNull:
2140e819ab22SFam Zheng#
2141e819ab22SFam Zheng# Driver specific block device options for the null backend.
2142e819ab22SFam Zheng#
2143e819ab22SFam Zheng# @size:    #optional size of the device in bytes.
2144e5e51dd3SFam Zheng# @latency-ns: #optional emulated latency (in nanoseconds) in processing
2145e5e51dd3SFam Zheng#              requests. Default to zero which completes requests immediately.
2146e5e51dd3SFam Zheng#              (Since 2.4)
2147e819ab22SFam Zheng#
2148e819ab22SFam Zheng# Since: 2.2
2149e819ab22SFam Zheng##
2150895a2a80SEric Blake{ 'struct': 'BlockdevOptionsNull',
2151e5e51dd3SFam Zheng  'data': { '*size': 'int', '*latency-ns': 'uint64' } }
2152e819ab22SFam Zheng
2153e819ab22SFam Zheng##
21545072f7b3SMarc-André Lureau# @BlockdevOptionsVVFAT:
21551ad166b6SBenoît Canet#
21561ad166b6SBenoît Canet# Driver specific block device options for the vvfat protocol.
21571ad166b6SBenoît Canet#
21581ad166b6SBenoît Canet# @dir:         directory to be exported as FAT image
21591ad166b6SBenoît Canet# @fat-type:    #optional FAT type: 12, 16 or 32
21601ad166b6SBenoît Canet# @floppy:      #optional whether to export a floppy image (true) or
21611ad166b6SBenoît Canet#               partitioned hard disk (false; default)
2162d5941ddaSWolfgang Bumiller# @label:       #optional set the volume label, limited to 11 bytes. FAT16 and
2163d5941ddaSWolfgang Bumiller#               FAT32 traditionally have some restrictions on labels, which are
2164d5941ddaSWolfgang Bumiller#               ignored by most operating systems. Defaults to "QEMU VVFAT".
2165d5941ddaSWolfgang Bumiller#               (since 2.4)
21661ad166b6SBenoît Canet# @rw:          #optional whether to allow write operations (default: false)
21671ad166b6SBenoît Canet#
21681ad166b6SBenoît Canet# Since: 1.7
21691ad166b6SBenoît Canet##
2170895a2a80SEric Blake{ 'struct': 'BlockdevOptionsVVFAT',
21711ad166b6SBenoît Canet  'data': { 'dir': 'str', '*fat-type': 'int', '*floppy': 'bool',
2172d5941ddaSWolfgang Bumiller            '*label': 'str', '*rw': 'bool' } }
21731ad166b6SBenoît Canet
21741ad166b6SBenoît Canet##
21755072f7b3SMarc-André Lureau# @BlockdevOptionsGenericFormat:
21761ad166b6SBenoît Canet#
21771ad166b6SBenoît Canet# Driver specific block device options for image format that have no option
21781ad166b6SBenoît Canet# besides their data source.
21791ad166b6SBenoît Canet#
21801ad166b6SBenoît Canet# @file:        reference to or definition of the data source block device
21811ad166b6SBenoît Canet#
21821ad166b6SBenoît Canet# Since: 1.7
21831ad166b6SBenoît Canet##
2184895a2a80SEric Blake{ 'struct': 'BlockdevOptionsGenericFormat',
21851ad166b6SBenoît Canet  'data': { 'file': 'BlockdevRef' } }
21861ad166b6SBenoît Canet
21871ad166b6SBenoît Canet##
21885072f7b3SMarc-André Lureau# @BlockdevOptionsLUKS:
218978368575SDaniel P. Berrange#
219078368575SDaniel P. Berrange# Driver specific block device options for LUKS.
219178368575SDaniel P. Berrange#
219278368575SDaniel P. Berrange# @key-secret: #optional the ID of a QCryptoSecret object providing
219378368575SDaniel P. Berrange#              the decryption key (since 2.6). Mandatory except when
219478368575SDaniel P. Berrange#              doing a metadata-only probe of the image.
219578368575SDaniel P. Berrange#
219678368575SDaniel P. Berrange# Since: 2.6
219778368575SDaniel P. Berrange##
219878368575SDaniel P. Berrange{ 'struct': 'BlockdevOptionsLUKS',
219978368575SDaniel P. Berrange  'base': 'BlockdevOptionsGenericFormat',
220078368575SDaniel P. Berrange  'data': { '*key-secret': 'str' } }
220178368575SDaniel P. Berrange
220278368575SDaniel P. Berrange
220378368575SDaniel P. Berrange##
22045072f7b3SMarc-André Lureau# @BlockdevOptionsGenericCOWFormat:
22051ad166b6SBenoît Canet#
22061ad166b6SBenoît Canet# Driver specific block device options for image format that have no option
22071ad166b6SBenoît Canet# besides their data source and an optional backing file.
22081ad166b6SBenoît Canet#
22091ad166b6SBenoît Canet# @backing:     #optional reference to or definition of the backing file block
22101ad166b6SBenoît Canet#               device (if missing, taken from the image file content). It is
22111ad166b6SBenoît Canet#               allowed to pass an empty string here in order to disable the
22121ad166b6SBenoît Canet#               default backing file.
22131ad166b6SBenoît Canet#
22141ad166b6SBenoît Canet# Since: 1.7
22151ad166b6SBenoît Canet##
2216895a2a80SEric Blake{ 'struct': 'BlockdevOptionsGenericCOWFormat',
22171ad166b6SBenoît Canet  'base': 'BlockdevOptionsGenericFormat',
22181ad166b6SBenoît Canet  'data': { '*backing': 'BlockdevRef' } }
22191ad166b6SBenoît Canet
22201ad166b6SBenoît Canet##
22215072f7b3SMarc-André Lureau# @Qcow2OverlapCheckMode:
2222f6585811SMax Reitz#
2223f6585811SMax Reitz# General overlap check modes.
2224f6585811SMax Reitz#
2225f6585811SMax Reitz# @none:        Do not perform any checks
2226f6585811SMax Reitz#
2227f6585811SMax Reitz# @constant:    Perform only checks which can be done in constant time and
2228f6585811SMax Reitz#               without reading anything from disk
2229f6585811SMax Reitz#
2230f6585811SMax Reitz# @cached:      Perform only checks which can be done without reading anything
2231f6585811SMax Reitz#               from disk
2232f6585811SMax Reitz#
2233f6585811SMax Reitz# @all:         Perform all available overlap checks
2234f6585811SMax Reitz#
2235f6585811SMax Reitz# Since: 2.2
2236f6585811SMax Reitz##
2237f6585811SMax Reitz{ 'enum': 'Qcow2OverlapCheckMode',
2238f6585811SMax Reitz  'data': [ 'none', 'constant', 'cached', 'all' ] }
2239f6585811SMax Reitz
2240f6585811SMax Reitz##
22415072f7b3SMarc-André Lureau# @Qcow2OverlapCheckFlags:
2242f6585811SMax Reitz#
2243f6585811SMax Reitz# Structure of flags for each metadata structure. Setting a field to 'true'
2244f6585811SMax Reitz# makes qemu guard that structure against unintended overwriting. The default
2245f6585811SMax Reitz# value is chosen according to the template given.
2246f6585811SMax Reitz#
2247f6585811SMax Reitz# @template: Specifies a template mode which can be adjusted using the other
2248f6585811SMax Reitz#            flags, defaults to 'cached'
2249f6585811SMax Reitz#
2250f6585811SMax Reitz# Since: 2.2
2251f6585811SMax Reitz##
2252895a2a80SEric Blake{ 'struct': 'Qcow2OverlapCheckFlags',
2253f6585811SMax Reitz  'data': { '*template':       'Qcow2OverlapCheckMode',
2254f6585811SMax Reitz            '*main-header':    'bool',
2255f6585811SMax Reitz            '*active-l1':      'bool',
2256f6585811SMax Reitz            '*active-l2':      'bool',
2257f6585811SMax Reitz            '*refcount-table': 'bool',
2258f6585811SMax Reitz            '*refcount-block': 'bool',
2259f6585811SMax Reitz            '*snapshot-table': 'bool',
2260f6585811SMax Reitz            '*inactive-l1':    'bool',
2261f6585811SMax Reitz            '*inactive-l2':    'bool' } }
2262f6585811SMax Reitz
2263f6585811SMax Reitz##
22645072f7b3SMarc-André Lureau# @Qcow2OverlapChecks:
2265f6585811SMax Reitz#
2266f6585811SMax Reitz# Specifies which metadata structures should be guarded against unintended
2267f6585811SMax Reitz# overwriting.
2268f6585811SMax Reitz#
2269f6585811SMax Reitz# @flags:   set of flags for separate specification of each metadata structure
2270f6585811SMax Reitz#           type
2271f6585811SMax Reitz#
2272f6585811SMax Reitz# @mode:    named mode which chooses a specific set of flags
2273f6585811SMax Reitz#
2274f6585811SMax Reitz# Since: 2.2
2275f6585811SMax Reitz##
2276ab916fadSEric Blake{ 'alternate': 'Qcow2OverlapChecks',
2277f6585811SMax Reitz  'data': { 'flags': 'Qcow2OverlapCheckFlags',
2278f6585811SMax Reitz            'mode':  'Qcow2OverlapCheckMode' } }
2279f6585811SMax Reitz
2280f6585811SMax Reitz##
22815072f7b3SMarc-André Lureau# @BlockdevOptionsQcow2:
22821ad166b6SBenoît Canet#
22831ad166b6SBenoît Canet# Driver specific block device options for qcow2.
22841ad166b6SBenoît Canet#
22851ad166b6SBenoît Canet# @lazy-refcounts:        #optional whether to enable the lazy refcounts
22861ad166b6SBenoît Canet#                         feature (default is taken from the image file)
22871ad166b6SBenoît Canet#
22881ad166b6SBenoît Canet# @pass-discard-request:  #optional whether discard requests to the qcow2
22891ad166b6SBenoît Canet#                         device should be forwarded to the data source
22901ad166b6SBenoît Canet#
22911ad166b6SBenoît Canet# @pass-discard-snapshot: #optional whether discard requests for the data source
22921ad166b6SBenoît Canet#                         should be issued when a snapshot operation (e.g.
22931ad166b6SBenoît Canet#                         deleting a snapshot) frees clusters in the qcow2 file
22941ad166b6SBenoît Canet#
22951ad166b6SBenoît Canet# @pass-discard-other:    #optional whether discard requests for the data source
22961ad166b6SBenoît Canet#                         should be issued on other occasions where a cluster
22971ad166b6SBenoît Canet#                         gets freed
22981ad166b6SBenoît Canet#
2299f6585811SMax Reitz# @overlap-check:         #optional which overlap checks to perform for writes
2300f6585811SMax Reitz#                         to the image, defaults to 'cached' (since 2.2)
2301f6585811SMax Reitz#
2302f6585811SMax Reitz# @cache-size:            #optional the maximum total size of the L2 table and
2303f6585811SMax Reitz#                         refcount block caches in bytes (since 2.2)
2304f6585811SMax Reitz#
2305f6585811SMax Reitz# @l2-cache-size:         #optional the maximum size of the L2 table cache in
2306f6585811SMax Reitz#                         bytes (since 2.2)
2307f6585811SMax Reitz#
2308f6585811SMax Reitz# @refcount-cache-size:   #optional the maximum size of the refcount block cache
2309f6585811SMax Reitz#                         in bytes (since 2.2)
2310f6585811SMax Reitz#
2311279621c0SAlberto Garcia# @cache-clean-interval:  #optional clean unused entries in the L2 and refcount
2312279621c0SAlberto Garcia#                         caches. The interval is in seconds. The default value
2313279621c0SAlberto Garcia#                         is 0 and it disables this feature (since 2.5)
2314279621c0SAlberto Garcia#
23151ad166b6SBenoît Canet# Since: 1.7
23161ad166b6SBenoît Canet##
2317895a2a80SEric Blake{ 'struct': 'BlockdevOptionsQcow2',
23181ad166b6SBenoît Canet  'base': 'BlockdevOptionsGenericCOWFormat',
23191ad166b6SBenoît Canet  'data': { '*lazy-refcounts': 'bool',
23201ad166b6SBenoît Canet            '*pass-discard-request': 'bool',
23211ad166b6SBenoît Canet            '*pass-discard-snapshot': 'bool',
2322f6585811SMax Reitz            '*pass-discard-other': 'bool',
2323f6585811SMax Reitz            '*overlap-check': 'Qcow2OverlapChecks',
2324f6585811SMax Reitz            '*cache-size': 'int',
2325f6585811SMax Reitz            '*l2-cache-size': 'int',
2326279621c0SAlberto Garcia            '*refcount-cache-size': 'int',
2327279621c0SAlberto Garcia            '*cache-clean-interval': 'int' } }
23281ad166b6SBenoît Canet
2329b1de5f43SChrysostomos Nanakos
2330b1de5f43SChrysostomos Nanakos##
23315072f7b3SMarc-André Lureau# @BlockdevOptionsArchipelago:
2332b1de5f43SChrysostomos Nanakos#
2333b1de5f43SChrysostomos Nanakos# Driver specific block device options for Archipelago.
2334b1de5f43SChrysostomos Nanakos#
2335b1de5f43SChrysostomos Nanakos# @volume:              Name of the Archipelago volume image
2336b1de5f43SChrysostomos Nanakos#
2337b1de5f43SChrysostomos Nanakos# @mport:               #optional The port number on which mapperd is
2338b1de5f43SChrysostomos Nanakos#                       listening. This is optional
2339b1de5f43SChrysostomos Nanakos#                       and if not specified, QEMU will make Archipelago
2340b1de5f43SChrysostomos Nanakos#                       use the default port (1001).
2341b1de5f43SChrysostomos Nanakos#
2342b1de5f43SChrysostomos Nanakos# @vport:               #optional The port number on which vlmcd is
2343b1de5f43SChrysostomos Nanakos#                       listening. This is optional
2344b1de5f43SChrysostomos Nanakos#                       and if not specified, QEMU will make Archipelago
2345b1de5f43SChrysostomos Nanakos#                       use the default port (501).
2346b1de5f43SChrysostomos Nanakos#
2347b1de5f43SChrysostomos Nanakos# @segment:             #optional The name of the shared memory segment
2348b1de5f43SChrysostomos Nanakos#                       Archipelago stack is using. This is optional
2349b1de5f43SChrysostomos Nanakos#                       and if not specified, QEMU will make Archipelago
2350b1de5f43SChrysostomos Nanakos#                       use the default value, 'archipelago'.
2351b1de5f43SChrysostomos Nanakos# Since: 2.2
2352b1de5f43SChrysostomos Nanakos##
2353895a2a80SEric Blake{ 'struct': 'BlockdevOptionsArchipelago',
2354b1de5f43SChrysostomos Nanakos  'data': { 'volume': 'str',
2355b1de5f43SChrysostomos Nanakos            '*mport': 'int',
2356b1de5f43SChrysostomos Nanakos            '*vport': 'int',
2357b1de5f43SChrysostomos Nanakos            '*segment': 'str' } }
2358b1de5f43SChrysostomos Nanakos
2359ad0e90a6SAshijeet Acharya##
23605072f7b3SMarc-André Lureau# @BlockdevOptionsSsh:
2361ad0e90a6SAshijeet Acharya#
2362ad0e90a6SAshijeet Acharya# @server:              host address
2363ad0e90a6SAshijeet Acharya#
2364ad0e90a6SAshijeet Acharya# @path:                path to the image on the host
2365ad0e90a6SAshijeet Acharya#
2366ad0e90a6SAshijeet Acharya# @user:                #optional user as which to connect, defaults to current
2367ad0e90a6SAshijeet Acharya#                       local user name
2368ad0e90a6SAshijeet Acharya#
2369ad0e90a6SAshijeet Acharya# TODO: Expose the host_key_check option in QMP
2370ad0e90a6SAshijeet Acharya#
23715072f7b3SMarc-André Lureau# Since: 2.8
2372ad0e90a6SAshijeet Acharya##
2373ad0e90a6SAshijeet Acharya{ 'struct': 'BlockdevOptionsSsh',
2374ad0e90a6SAshijeet Acharya  'data': { 'server': 'InetSocketAddress',
2375ad0e90a6SAshijeet Acharya            'path': 'str',
2376ad0e90a6SAshijeet Acharya            '*user': 'str' } }
2377ad0e90a6SAshijeet Acharya
2378b1de5f43SChrysostomos Nanakos
23791ad166b6SBenoît Canet##
23805072f7b3SMarc-André Lureau# @BlkdebugEvent:
23811ad166b6SBenoît Canet#
23821ad166b6SBenoît Canet# Trigger events supported by blkdebug.
2383a31939e6SEric Blake#
2384a31939e6SEric Blake# Since: 2.0
23851ad166b6SBenoît Canet##
2386a31939e6SEric Blake{ 'enum': 'BlkdebugEvent', 'prefix': 'BLKDBG',
23875be5b776SEric Blake  'data': [ 'l1_update', 'l1_grow_alloc_table', 'l1_grow_write_table',
23885be5b776SEric Blake            'l1_grow_activate_table', 'l2_load', 'l2_update',
23895be5b776SEric Blake            'l2_update_compressed', 'l2_alloc_cow_read', 'l2_alloc_write',
23901ad166b6SBenoît Canet            'read_aio', 'read_backing_aio', 'read_compressed', 'write_aio',
23911ad166b6SBenoît Canet            'write_compressed', 'vmstate_load', 'vmstate_save', 'cow_read',
23921ad166b6SBenoît Canet            'cow_write', 'reftable_load', 'reftable_grow', 'reftable_update',
23931ad166b6SBenoît Canet            'refblock_load', 'refblock_update', 'refblock_update_part',
23945be5b776SEric Blake            'refblock_alloc', 'refblock_alloc_hookup', 'refblock_alloc_write',
23955be5b776SEric Blake            'refblock_alloc_write_blocks', 'refblock_alloc_write_table',
23965be5b776SEric Blake            'refblock_alloc_switch_table', 'cluster_alloc',
23971ad166b6SBenoît Canet            'cluster_alloc_bytes', 'cluster_free', 'flush_to_os',
23985be5b776SEric Blake            'flush_to_disk', 'pwritev_rmw_head', 'pwritev_rmw_after_head',
23995be5b776SEric Blake            'pwritev_rmw_tail', 'pwritev_rmw_after_tail', 'pwritev',
2400d21de4d9SMax Reitz            'pwritev_zero', 'pwritev_done', 'empty_image_prepare' ] }
24011ad166b6SBenoît Canet
24021ad166b6SBenoît Canet##
24035072f7b3SMarc-André Lureau# @BlkdebugInjectErrorOptions:
24041ad166b6SBenoît Canet#
24051ad166b6SBenoît Canet# Describes a single error injection for blkdebug.
24061ad166b6SBenoît Canet#
24071ad166b6SBenoît Canet# @event:       trigger event
24081ad166b6SBenoît Canet#
24091ad166b6SBenoît Canet# @state:       #optional the state identifier blkdebug needs to be in to
24101ad166b6SBenoît Canet#               actually trigger the event; defaults to "any"
24111ad166b6SBenoît Canet#
24121ad166b6SBenoît Canet# @errno:       #optional error identifier (errno) to be returned; defaults to
24131ad166b6SBenoît Canet#               EIO
24141ad166b6SBenoît Canet#
24151ad166b6SBenoît Canet# @sector:      #optional specifies the sector index which has to be affected
24161ad166b6SBenoît Canet#               in order to actually trigger the event; defaults to "any
24171ad166b6SBenoît Canet#               sector"
24181ad166b6SBenoît Canet#
24191ad166b6SBenoît Canet# @once:        #optional disables further events after this one has been
24201ad166b6SBenoît Canet#               triggered; defaults to false
24211ad166b6SBenoît Canet#
24221ad166b6SBenoît Canet# @immediately: #optional fail immediately; defaults to false
24231ad166b6SBenoît Canet#
24241ad166b6SBenoît Canet# Since: 2.0
24251ad166b6SBenoît Canet##
2426895a2a80SEric Blake{ 'struct': 'BlkdebugInjectErrorOptions',
24271ad166b6SBenoît Canet  'data': { 'event': 'BlkdebugEvent',
24281ad166b6SBenoît Canet            '*state': 'int',
24291ad166b6SBenoît Canet            '*errno': 'int',
24301ad166b6SBenoît Canet            '*sector': 'int',
24311ad166b6SBenoît Canet            '*once': 'bool',
24321ad166b6SBenoît Canet            '*immediately': 'bool' } }
24331ad166b6SBenoît Canet
24341ad166b6SBenoît Canet##
24355072f7b3SMarc-André Lureau# @BlkdebugSetStateOptions:
24361ad166b6SBenoît Canet#
24371ad166b6SBenoît Canet# Describes a single state-change event for blkdebug.
24381ad166b6SBenoît Canet#
24391ad166b6SBenoît Canet# @event:       trigger event
24401ad166b6SBenoît Canet#
24411ad166b6SBenoît Canet# @state:       #optional the current state identifier blkdebug needs to be in;
24421ad166b6SBenoît Canet#               defaults to "any"
24431ad166b6SBenoît Canet#
24441ad166b6SBenoît Canet# @new_state:   the state identifier blkdebug is supposed to assume if
24451ad166b6SBenoît Canet#               this event is triggered
24461ad166b6SBenoît Canet#
24471ad166b6SBenoît Canet# Since: 2.0
24481ad166b6SBenoît Canet##
2449895a2a80SEric Blake{ 'struct': 'BlkdebugSetStateOptions',
24501ad166b6SBenoît Canet  'data': { 'event': 'BlkdebugEvent',
24511ad166b6SBenoît Canet            '*state': 'int',
24521ad166b6SBenoît Canet            'new_state': 'int' } }
24531ad166b6SBenoît Canet
24541ad166b6SBenoît Canet##
24555072f7b3SMarc-André Lureau# @BlockdevOptionsBlkdebug:
24561ad166b6SBenoît Canet#
24571ad166b6SBenoît Canet# Driver specific block device options for blkdebug.
24581ad166b6SBenoît Canet#
24591ad166b6SBenoît Canet# @image:           underlying raw block device (or image file)
24601ad166b6SBenoît Canet#
24611ad166b6SBenoît Canet# @config:          #optional filename of the configuration file
24621ad166b6SBenoît Canet#
2463835db3eeSEric Blake# @align:           #optional required alignment for requests in bytes,
2464835db3eeSEric Blake#                   must be power of 2, or 0 for default
24651ad166b6SBenoît Canet#
24661ad166b6SBenoît Canet# @inject-error:    #optional array of error injection descriptions
24671ad166b6SBenoît Canet#
24681ad166b6SBenoît Canet# @set-state:       #optional array of state-change descriptions
24691ad166b6SBenoît Canet#
24701ad166b6SBenoît Canet# Since: 2.0
24711ad166b6SBenoît Canet##
2472895a2a80SEric Blake{ 'struct': 'BlockdevOptionsBlkdebug',
24731ad166b6SBenoît Canet  'data': { 'image': 'BlockdevRef',
24741ad166b6SBenoît Canet            '*config': 'str',
24751ad166b6SBenoît Canet            '*align': 'int',
24761ad166b6SBenoît Canet            '*inject-error': ['BlkdebugInjectErrorOptions'],
24771ad166b6SBenoît Canet            '*set-state': ['BlkdebugSetStateOptions'] } }
24781ad166b6SBenoît Canet
24791ad166b6SBenoît Canet##
24805072f7b3SMarc-André Lureau# @BlockdevOptionsBlkverify:
24811ad166b6SBenoît Canet#
24821ad166b6SBenoît Canet# Driver specific block device options for blkverify.
24831ad166b6SBenoît Canet#
24841ad166b6SBenoît Canet# @test:    block device to be tested
24851ad166b6SBenoît Canet#
24861ad166b6SBenoît Canet# @raw:     raw image used for verification
24871ad166b6SBenoît Canet#
24881ad166b6SBenoît Canet# Since: 2.0
24891ad166b6SBenoît Canet##
2490895a2a80SEric Blake{ 'struct': 'BlockdevOptionsBlkverify',
24911ad166b6SBenoît Canet  'data': { 'test': 'BlockdevRef',
24921ad166b6SBenoît Canet            'raw': 'BlockdevRef' } }
24931ad166b6SBenoît Canet
24941ad166b6SBenoît Canet##
24955072f7b3SMarc-André Lureau# @QuorumReadPattern:
249662c6031fSLiu Yuan#
249762c6031fSLiu Yuan# An enumeration of quorum read patterns.
249862c6031fSLiu Yuan#
249962c6031fSLiu Yuan# @quorum: read all the children and do a quorum vote on reads
250062c6031fSLiu Yuan#
250162c6031fSLiu Yuan# @fifo: read only from the first child that has not failed
250262c6031fSLiu Yuan#
250362c6031fSLiu Yuan# Since: 2.2
250462c6031fSLiu Yuan##
250562c6031fSLiu Yuan{ 'enum': 'QuorumReadPattern', 'data': [ 'quorum', 'fifo' ] }
250662c6031fSLiu Yuan
250762c6031fSLiu Yuan##
25085072f7b3SMarc-André Lureau# @BlockdevOptionsQuorum:
25091ad166b6SBenoît Canet#
25101ad166b6SBenoît Canet# Driver specific block device options for Quorum
25111ad166b6SBenoît Canet#
25121ad166b6SBenoît Canet# @blkverify:      #optional true if the driver must print content mismatch
25131ad166b6SBenoît Canet#                  set to false by default
25141ad166b6SBenoît Canet#
25151ad166b6SBenoît Canet# @children:       the children block devices to use
25161ad166b6SBenoît Canet#
25171ad166b6SBenoît Canet# @vote-threshold: the vote limit under which a read will fail
25181ad166b6SBenoît Canet#
2519cf29a570SBenoît Canet# @rewrite-corrupted: #optional rewrite corrupted data when quorum is reached
2520cf29a570SBenoît Canet#                     (Since 2.1)
2521cf29a570SBenoît Canet#
252262c6031fSLiu Yuan# @read-pattern: #optional choose read pattern and set to quorum by default
252362c6031fSLiu Yuan#                (Since 2.2)
252462c6031fSLiu Yuan#
25251ad166b6SBenoît Canet# Since: 2.0
25261ad166b6SBenoît Canet##
2527895a2a80SEric Blake{ 'struct': 'BlockdevOptionsQuorum',
25281ad166b6SBenoît Canet  'data': { '*blkverify': 'bool',
25291ad166b6SBenoît Canet            'children': [ 'BlockdevRef' ],
253062c6031fSLiu Yuan            'vote-threshold': 'int',
253162c6031fSLiu Yuan            '*rewrite-corrupted': 'bool',
253262c6031fSLiu Yuan            '*read-pattern': 'QuorumReadPattern' } }
25331ad166b6SBenoît Canet
25341ad166b6SBenoît Canet##
25355072f7b3SMarc-André Lureau# @GlusterTransport:
25367edac2ddSPrasanna Kumar Kalever#
25377edac2ddSPrasanna Kumar Kalever# An enumeration of Gluster transport types
25387edac2ddSPrasanna Kumar Kalever#
25397edac2ddSPrasanna Kumar Kalever# @tcp:   TCP   - Transmission Control Protocol
25407edac2ddSPrasanna Kumar Kalever#
25417edac2ddSPrasanna Kumar Kalever# @unix:  UNIX  - Unix domain socket
25427edac2ddSPrasanna Kumar Kalever#
25437edac2ddSPrasanna Kumar Kalever# Since: 2.7
25447edac2ddSPrasanna Kumar Kalever##
25457edac2ddSPrasanna Kumar Kalever{ 'enum': 'GlusterTransport',
25467edac2ddSPrasanna Kumar Kalever  'data': [ 'unix', 'tcp' ] }
25477edac2ddSPrasanna Kumar Kalever
25487edac2ddSPrasanna Kumar Kalever
25497edac2ddSPrasanna Kumar Kalever##
25505072f7b3SMarc-André Lureau# @GlusterServer:
25517edac2ddSPrasanna Kumar Kalever#
25527edac2ddSPrasanna Kumar Kalever# Captures the address of a socket
25537edac2ddSPrasanna Kumar Kalever#
25547edac2ddSPrasanna Kumar Kalever# Details for connecting to a gluster server
25557edac2ddSPrasanna Kumar Kalever#
25567edac2ddSPrasanna Kumar Kalever# @type:       Transport type used for gluster connection
25577edac2ddSPrasanna Kumar Kalever#
2558c76d7aabSPrasanna Kumar Kalever# This is similar to SocketAddress, only distinction:
2559c76d7aabSPrasanna Kumar Kalever#
2560c76d7aabSPrasanna Kumar Kalever# 1. GlusterServer is a flat union, SocketAddress is a simple union.
2561c76d7aabSPrasanna Kumar Kalever#    A flat union is nicer than simple because it avoids nesting
2562c76d7aabSPrasanna Kumar Kalever#    (i.e. more {}) on the wire.
2563c76d7aabSPrasanna Kumar Kalever#
2564c76d7aabSPrasanna Kumar Kalever# 2. GlusterServer lacks case 'fd', since gluster doesn't let you
2565c76d7aabSPrasanna Kumar Kalever#    pass in a file descriptor.
2566c76d7aabSPrasanna Kumar Kalever#
2567c76d7aabSPrasanna Kumar Kalever# GlusterServer is actually not Gluster-specific, its a
2568c76d7aabSPrasanna Kumar Kalever# compatibility evolved into an alternate for SocketAddress.
2569c76d7aabSPrasanna Kumar Kalever#
25707edac2ddSPrasanna Kumar Kalever# Since: 2.7
25717edac2ddSPrasanna Kumar Kalever##
25727edac2ddSPrasanna Kumar Kalever{ 'union': 'GlusterServer',
25737edac2ddSPrasanna Kumar Kalever  'base': { 'type': 'GlusterTransport' },
25747edac2ddSPrasanna Kumar Kalever  'discriminator': 'type',
25757edac2ddSPrasanna Kumar Kalever  'data': { 'unix': 'UnixSocketAddress',
25767edac2ddSPrasanna Kumar Kalever            'tcp': 'InetSocketAddress' } }
25777edac2ddSPrasanna Kumar Kalever
25787edac2ddSPrasanna Kumar Kalever##
25795072f7b3SMarc-André Lureau# @BlockdevOptionsGluster:
25807edac2ddSPrasanna Kumar Kalever#
25817edac2ddSPrasanna Kumar Kalever# Driver specific block device options for Gluster
25827edac2ddSPrasanna Kumar Kalever#
25837edac2ddSPrasanna Kumar Kalever# @volume:      name of gluster volume where VM image resides
25847edac2ddSPrasanna Kumar Kalever#
25857edac2ddSPrasanna Kumar Kalever# @path:        absolute path to image file in gluster volume
25867edac2ddSPrasanna Kumar Kalever#
25870a189ffbSPrasanna Kumar Kalever# @server:      gluster servers description
25887edac2ddSPrasanna Kumar Kalever#
25891a417e46SPrasanna Kumar Kalever# @debug:       #optional libgfapi log level (default '4' which is Error)
25904230e5d1SEric Blake#               (Since 2.8)
25917edac2ddSPrasanna Kumar Kalever#
259205fce20dSJeff Cody# @logfile:     #optional libgfapi log file (default /dev/stderr) (Since 2.8)
2593e9db8ff3SPrasanna Kumar Kalever#
25947edac2ddSPrasanna Kumar Kalever# Since: 2.7
25957edac2ddSPrasanna Kumar Kalever##
25967edac2ddSPrasanna Kumar Kalever{ 'struct': 'BlockdevOptionsGluster',
25977edac2ddSPrasanna Kumar Kalever  'data': { 'volume': 'str',
25987edac2ddSPrasanna Kumar Kalever            'path': 'str',
25996c7189bbSPrasanna Kumar Kalever            'server': ['GlusterServer'],
26001a417e46SPrasanna Kumar Kalever            '*debug': 'int',
2601e9db8ff3SPrasanna Kumar Kalever            '*logfile': 'str' } }
26027edac2ddSPrasanna Kumar Kalever
26037edac2ddSPrasanna Kumar Kalever##
26045072f7b3SMarc-André Lureau# @ReplicationMode:
2605190b9a8bSChanglong Xie#
2606190b9a8bSChanglong Xie# An enumeration of replication modes.
2607190b9a8bSChanglong Xie#
2608190b9a8bSChanglong Xie# @primary: Primary mode, the vm's state will be sent to secondary QEMU.
2609190b9a8bSChanglong Xie#
2610190b9a8bSChanglong Xie# @secondary: Secondary mode, receive the vm's state from primary QEMU.
2611190b9a8bSChanglong Xie#
2612190b9a8bSChanglong Xie# Since: 2.8
2613190b9a8bSChanglong Xie##
2614190b9a8bSChanglong Xie{ 'enum' : 'ReplicationMode', 'data' : [ 'primary', 'secondary' ] }
2615190b9a8bSChanglong Xie
2616190b9a8bSChanglong Xie##
26175072f7b3SMarc-André Lureau# @BlockdevOptionsReplication:
261882ac5543SWen Congyang#
261982ac5543SWen Congyang# Driver specific block device options for replication
262082ac5543SWen Congyang#
262182ac5543SWen Congyang# @mode: the replication mode
262282ac5543SWen Congyang#
262382ac5543SWen Congyang# @top-id: #optional In secondary mode, node name or device ID of the root
2624f4f2539bSChanglong Xie#          node who owns the replication node chain. Must not be given in
2625f4f2539bSChanglong Xie#          primary mode.
262682ac5543SWen Congyang#
262782ac5543SWen Congyang# Since: 2.8
262882ac5543SWen Congyang##
262982ac5543SWen Congyang{ 'struct': 'BlockdevOptionsReplication',
263082ac5543SWen Congyang  'base': 'BlockdevOptionsGenericFormat',
263182ac5543SWen Congyang  'data': { 'mode': 'ReplicationMode',
263282ac5543SWen Congyang            '*top-id': 'str' } }
263382ac5543SWen Congyang
263482ac5543SWen Congyang##
26355072f7b3SMarc-André Lureau# @NFSTransport:
2636aa2623d8SAshijeet Acharya#
2637aa2623d8SAshijeet Acharya# An enumeration of NFS transport types
2638aa2623d8SAshijeet Acharya#
2639aa2623d8SAshijeet Acharya# @inet:        TCP transport
2640aa2623d8SAshijeet Acharya#
26415072f7b3SMarc-André Lureau# Since: 2.8
2642aa2623d8SAshijeet Acharya##
2643aa2623d8SAshijeet Acharya{ 'enum': 'NFSTransport',
2644aa2623d8SAshijeet Acharya  'data': [ 'inet' ] }
2645aa2623d8SAshijeet Acharya
2646aa2623d8SAshijeet Acharya##
26475072f7b3SMarc-André Lureau# @NFSServer:
2648aa2623d8SAshijeet Acharya#
2649aa2623d8SAshijeet Acharya# Captures the address of the socket
2650aa2623d8SAshijeet Acharya#
2651aa2623d8SAshijeet Acharya# @type:        transport type used for NFS (only TCP supported)
2652aa2623d8SAshijeet Acharya#
2653aa2623d8SAshijeet Acharya# @host:        host address for NFS server
2654aa2623d8SAshijeet Acharya#
26555072f7b3SMarc-André Lureau# Since: 2.8
2656aa2623d8SAshijeet Acharya##
2657aa2623d8SAshijeet Acharya{ 'struct': 'NFSServer',
2658aa2623d8SAshijeet Acharya  'data': { 'type': 'NFSTransport',
2659aa2623d8SAshijeet Acharya            'host': 'str' } }
2660aa2623d8SAshijeet Acharya
2661aa2623d8SAshijeet Acharya##
26625072f7b3SMarc-André Lureau# @BlockdevOptionsNfs:
2663aa2623d8SAshijeet Acharya#
2664aa2623d8SAshijeet Acharya# Driver specific block device option for NFS
2665aa2623d8SAshijeet Acharya#
2666aa2623d8SAshijeet Acharya# @server:                  host address
2667aa2623d8SAshijeet Acharya#
2668aa2623d8SAshijeet Acharya# @path:                    path of the image on the host
2669aa2623d8SAshijeet Acharya#
2670aa2623d8SAshijeet Acharya# @user:                    #optional UID value to use when talking to the
2671aa2623d8SAshijeet Acharya#                           server (defaults to 65534 on Windows and getuid()
2672aa2623d8SAshijeet Acharya#                           on unix)
2673aa2623d8SAshijeet Acharya#
2674aa2623d8SAshijeet Acharya# @group:                   #optional GID value to use when talking to the
2675aa2623d8SAshijeet Acharya#                           server (defaults to 65534 on Windows and getgid()
2676aa2623d8SAshijeet Acharya#                           in unix)
2677aa2623d8SAshijeet Acharya#
2678aa2623d8SAshijeet Acharya# @tcp-syn-count:           #optional number of SYNs during the session
2679aa2623d8SAshijeet Acharya#                           establishment (defaults to libnfs default)
2680aa2623d8SAshijeet Acharya#
2681aa2623d8SAshijeet Acharya# @readahead-size:          #optional set the readahead size in bytes (defaults
2682aa2623d8SAshijeet Acharya#                           to libnfs default)
2683aa2623d8SAshijeet Acharya#
2684aa2623d8SAshijeet Acharya# @page-cache-size:         #optional set the pagecache size in bytes (defaults
2685aa2623d8SAshijeet Acharya#                           to libnfs default)
2686aa2623d8SAshijeet Acharya#
26877103d916SPrasanna Kumar Kalever# @debug:                   #optional set the NFS debug level (max 2) (defaults
2688aa2623d8SAshijeet Acharya#                           to libnfs default)
2689aa2623d8SAshijeet Acharya#
26905072f7b3SMarc-André Lureau# Since: 2.8
2691aa2623d8SAshijeet Acharya##
2692aa2623d8SAshijeet Acharya{ 'struct': 'BlockdevOptionsNfs',
2693aa2623d8SAshijeet Acharya  'data': { 'server': 'NFSServer',
2694aa2623d8SAshijeet Acharya            'path': 'str',
2695aa2623d8SAshijeet Acharya            '*user': 'int',
2696aa2623d8SAshijeet Acharya            '*group': 'int',
2697aa2623d8SAshijeet Acharya            '*tcp-syn-count': 'int',
2698aa2623d8SAshijeet Acharya            '*readahead-size': 'int',
2699aa2623d8SAshijeet Acharya            '*page-cache-size': 'int',
27007103d916SPrasanna Kumar Kalever            '*debug': 'int' } }
2701aa2623d8SAshijeet Acharya
2702aa2623d8SAshijeet Acharya##
27035072f7b3SMarc-André Lureau# @BlockdevOptionsCurl:
270468555285SKevin Wolf#
270568555285SKevin Wolf# Driver specific block device options for the curl backend.
270668555285SKevin Wolf#
270768555285SKevin Wolf# @filename:    path to the image file
270868555285SKevin Wolf#
270968555285SKevin Wolf# Since: 1.7
271068555285SKevin Wolf##
271168555285SKevin Wolf{ 'struct': 'BlockdevOptionsCurl',
271268555285SKevin Wolf  'data': { 'filename': 'str' } }
271368555285SKevin Wolf
271468555285SKevin Wolf##
27155072f7b3SMarc-André Lureau# @BlockdevOptionsNbd:
27166b02b1f0SMax Reitz#
27176b02b1f0SMax Reitz# Driver specific block device options for NBD.
27186b02b1f0SMax Reitz#
27196b02b1f0SMax Reitz# @server:      NBD server address
27206b02b1f0SMax Reitz#
27216b02b1f0SMax Reitz# @export:      #optional export name
27226b02b1f0SMax Reitz#
27236b02b1f0SMax Reitz# @tls-creds:   #optional TLS credentials ID
27246b02b1f0SMax Reitz#
27256b02b1f0SMax Reitz# Since: 2.8
27266b02b1f0SMax Reitz##
27276b02b1f0SMax Reitz{ 'struct': 'BlockdevOptionsNbd',
27286b02b1f0SMax Reitz  'data': { 'server': 'SocketAddress',
27296b02b1f0SMax Reitz            '*export': 'str',
27306b02b1f0SMax Reitz            '*tls-creds': 'str' } }
27316b02b1f0SMax Reitz
27326b02b1f0SMax Reitz##
27335072f7b3SMarc-André Lureau# @BlockdevOptionsRaw:
27342fdc7045STomáš Golembiovský#
27352fdc7045STomáš Golembiovský# Driver specific block device options for the raw driver.
27362fdc7045STomáš Golembiovský#
27372fdc7045STomáš Golembiovský# @offset:      #optional position where the block device starts
27382fdc7045STomáš Golembiovský# @size:        #optional the assumed size of the device
27392fdc7045STomáš Golembiovský#
27402fdc7045STomáš Golembiovský# Since: 2.8
27412fdc7045STomáš Golembiovský##
27422fdc7045STomáš Golembiovský{ 'struct': 'BlockdevOptionsRaw',
27432fdc7045STomáš Golembiovský  'base': 'BlockdevOptionsGenericFormat',
27442fdc7045STomáš Golembiovský  'data': { '*offset': 'int', '*size': 'int' } }
27452fdc7045STomáš Golembiovský
27462fdc7045STomáš Golembiovský##
27475072f7b3SMarc-André Lureau# @BlockdevOptions:
27481ad166b6SBenoît Canet#
27493666a97fSEric Blake# Options for creating a block device.  Many options are available for all
27503666a97fSEric Blake# block devices, independent of the block driver:
27513666a97fSEric Blake#
27523666a97fSEric Blake# @driver:        block driver name
27539ec8873eSKevin Wolf# @node-name:     #optional the node name of the new node (Since 2.0).
27549ec8873eSKevin Wolf#                 This option is required on the top level of blockdev-add.
27553666a97fSEric Blake# @discard:       #optional discard-related options (default: ignore)
27563666a97fSEric Blake# @cache:         #optional cache-related options
27573666a97fSEric Blake# @read-only:     #optional whether the block device should be read-only
27583666a97fSEric Blake#                 (default: false)
27593666a97fSEric Blake# @detect-zeroes: #optional detect and optimize zero writes (Since 2.1)
27603666a97fSEric Blake#                 (default: off)
27613666a97fSEric Blake#
27623666a97fSEric Blake# Remaining options are determined by the block driver.
27631ad166b6SBenoît Canet#
27641ad166b6SBenoît Canet# Since: 1.7
27651ad166b6SBenoît Canet##
27661ad166b6SBenoît Canet{ 'union': 'BlockdevOptions',
27673666a97fSEric Blake  'base': { 'driver': 'BlockdevDriver',
27683666a97fSEric Blake            '*node-name': 'str',
27693666a97fSEric Blake            '*discard': 'BlockdevDiscardOptions',
27703666a97fSEric Blake            '*cache': 'BlockdevCacheOptions',
27713666a97fSEric Blake            '*read-only': 'bool',
27723666a97fSEric Blake            '*detect-zeroes': 'BlockdevDetectZeroesOptions' },
27731ad166b6SBenoît Canet  'discriminator': 'driver',
27741ad166b6SBenoît Canet  'data': {
2775b1de5f43SChrysostomos Nanakos      'archipelago':'BlockdevOptionsArchipelago',
27761ad166b6SBenoît Canet      'blkdebug':   'BlockdevOptionsBlkdebug',
27771ad166b6SBenoît Canet      'blkverify':  'BlockdevOptionsBlkverify',
27781ad166b6SBenoît Canet      'bochs':      'BlockdevOptionsGenericFormat',
27791ad166b6SBenoît Canet      'cloop':      'BlockdevOptionsGenericFormat',
27801ad166b6SBenoît Canet      'dmg':        'BlockdevOptionsGenericFormat',
2781db866be9SFam Zheng      'file':       'BlockdevOptionsFile',
278268555285SKevin Wolf      'ftp':        'BlockdevOptionsCurl',
278368555285SKevin Wolf      'ftps':       'BlockdevOptionsCurl',
27847edac2ddSPrasanna Kumar Kalever      'gluster':    'BlockdevOptionsGluster',
2785db866be9SFam Zheng      'host_cdrom': 'BlockdevOptionsFile',
2786db866be9SFam Zheng      'host_device':'BlockdevOptionsFile',
278768555285SKevin Wolf      'http':       'BlockdevOptionsCurl',
278868555285SKevin Wolf      'https':      'BlockdevOptionsCurl',
2789db866be9SFam Zheng# TODO iscsi: Wait for structured options
279078368575SDaniel P. Berrange      'luks':       'BlockdevOptionsLUKS',
27916b02b1f0SMax Reitz      'nbd':        'BlockdevOptionsNbd',
2792aa2623d8SAshijeet Acharya      'nfs':        'BlockdevOptionsNfs',
2793db866be9SFam Zheng      'null-aio':   'BlockdevOptionsNull',
2794db866be9SFam Zheng      'null-co':    'BlockdevOptionsNull',
27951ad166b6SBenoît Canet      'parallels':  'BlockdevOptionsGenericFormat',
27961ad166b6SBenoît Canet      'qcow2':      'BlockdevOptionsQcow2',
2797db866be9SFam Zheng      'qcow':       'BlockdevOptionsGenericCOWFormat',
27981ad166b6SBenoît Canet      'qed':        'BlockdevOptionsGenericCOWFormat',
2799db866be9SFam Zheng      'quorum':     'BlockdevOptionsQuorum',
28002fdc7045STomáš Golembiovský      'raw':        'BlockdevOptionsRaw',
2801db866be9SFam Zheng# TODO rbd: Wait for structured options
280282ac5543SWen Congyang      'replication':'BlockdevOptionsReplication',
2803db866be9SFam Zheng# TODO sheepdog: Wait for structured options
2804ad0e90a6SAshijeet Acharya      'ssh':        'BlockdevOptionsSsh',
28051ad166b6SBenoît Canet      'vdi':        'BlockdevOptionsGenericFormat',
28061ad166b6SBenoît Canet      'vhdx':       'BlockdevOptionsGenericFormat',
28071ad166b6SBenoît Canet      'vmdk':       'BlockdevOptionsGenericCOWFormat',
28081ad166b6SBenoît Canet      'vpc':        'BlockdevOptionsGenericFormat',
2809db866be9SFam Zheng      'vvfat':      'BlockdevOptionsVVFAT'
28101ad166b6SBenoît Canet  } }
28111ad166b6SBenoît Canet
28121ad166b6SBenoît Canet##
28135072f7b3SMarc-André Lureau# @BlockdevRef:
28141ad166b6SBenoît Canet#
28151ad166b6SBenoît Canet# Reference to a block device.
28161ad166b6SBenoît Canet#
28171ad166b6SBenoît Canet# @definition:      defines a new block device inline
28181ad166b6SBenoît Canet# @reference:       references the ID of an existing block device. An
28191ad166b6SBenoît Canet#                   empty string means that no block device should be
28201ad166b6SBenoît Canet#                   referenced.
28211ad166b6SBenoît Canet#
28221ad166b6SBenoît Canet# Since: 1.7
28231ad166b6SBenoît Canet##
2824ab916fadSEric Blake{ 'alternate': 'BlockdevRef',
28251ad166b6SBenoît Canet  'data': { 'definition': 'BlockdevOptions',
28261ad166b6SBenoît Canet            'reference': 'str' } }
28271ad166b6SBenoît Canet
28281ad166b6SBenoît Canet##
28291ad166b6SBenoît Canet# @blockdev-add:
28301ad166b6SBenoît Canet#
2831be4b67bcSMax Reitz# Creates a new block device. If the @id option is given at the top level, a
2832be4b67bcSMax Reitz# BlockBackend will be created; otherwise, @node-name is mandatory at the top
2833be4b67bcSMax Reitz# level and no BlockBackend will be created.
28341ad166b6SBenoît Canet#
28357a305384SMarc-André Lureau# For the arguments, see the documentation of BlockdevOptions.
28367a305384SMarc-André Lureau#
28377a305384SMarc-André Lureau# Note: This command is still a work in progress.  It doesn't support all
283881b936aeSAlberto Garcia# block drivers among other things.  Stay away from it unless you want
283981b936aeSAlberto Garcia# to help with its development.
2840da2cf4e8SMarkus Armbruster#
28411ad166b6SBenoît Canet# Since: 1.7
2842b4749948SMarc-André Lureau#
2843b4749948SMarc-André Lureau# Example:
2844b4749948SMarc-André Lureau#
2845b4749948SMarc-André Lureau# 1.
2846b4749948SMarc-André Lureau# -> { "execute": "blockdev-add",
2847b4749948SMarc-André Lureau#      "arguments": {
2848b4749948SMarc-André Lureau#          "options" : { "driver": "qcow2",
2849b4749948SMarc-André Lureau#                        "file": { "driver": "file",
2850b4749948SMarc-André Lureau#                                  "filename": "test.qcow2" } } } }
2851b4749948SMarc-André Lureau# <- { "return": {} }
2852b4749948SMarc-André Lureau#
2853b4749948SMarc-André Lureau# 2.
2854b4749948SMarc-André Lureau# -> { "execute": "blockdev-add",
2855b4749948SMarc-André Lureau#      "arguments": {
2856b4749948SMarc-André Lureau#          "options": {
2857b4749948SMarc-André Lureau#            "driver": "qcow2",
2858b4749948SMarc-André Lureau#            "node-name": "node0",
2859b4749948SMarc-André Lureau#            "discard": "unmap",
2860b4749948SMarc-André Lureau#            "cache": {
2861b4749948SMarc-André Lureau#                "direct": true,
2862b4749948SMarc-André Lureau#                "writeback": true
2863b4749948SMarc-André Lureau#            },
2864b4749948SMarc-André Lureau#            "file": {
2865b4749948SMarc-André Lureau#                "driver": "file",
2866b4749948SMarc-André Lureau#                "filename": "/tmp/test.qcow2"
2867b4749948SMarc-André Lureau#            },
2868b4749948SMarc-André Lureau#            "backing": {
2869b4749948SMarc-André Lureau#                "driver": "raw",
2870b4749948SMarc-André Lureau#                "file": {
2871b4749948SMarc-André Lureau#                    "driver": "file",
2872b4749948SMarc-André Lureau#                    "filename": "/dev/fdset/4"
2873b4749948SMarc-André Lureau#                }
2874b4749948SMarc-André Lureau#            }
2875b4749948SMarc-André Lureau#          }
2876b4749948SMarc-André Lureau#        }
2877b4749948SMarc-André Lureau#      }
2878b4749948SMarc-André Lureau#
2879b4749948SMarc-André Lureau# <- { "return": {} }
2880b4749948SMarc-André Lureau#
28811ad166b6SBenoît Canet##
28820153d2f5SKevin Wolf{ 'command': 'blockdev-add', 'data': 'BlockdevOptions', 'boxed': true }
28831ad166b6SBenoît Canet
28847d8a9f71SMax Reitz##
288581b936aeSAlberto Garcia# @x-blockdev-del:
288681b936aeSAlberto Garcia#
288781b936aeSAlberto Garcia# Deletes a block device that has been added using blockdev-add.
28889ec8873eSKevin Wolf# The command will fail if the node is attached to a device or is
28899ec8873eSKevin Wolf# otherwise being used.
289081b936aeSAlberto Garcia#
28917a305384SMarc-André Lureau# @node-name: Name of the graph node to delete.
28927a305384SMarc-André Lureau#
28937a305384SMarc-André Lureau# Note: This command is still a work in progress and is considered
289481b936aeSAlberto Garcia# experimental. Stay away from it unless you want to help with its
289581b936aeSAlberto Garcia# development.
289681b936aeSAlberto Garcia#
289781b936aeSAlberto Garcia# Since: 2.5
2898915a213fSMarc-André Lureau#
2899915a213fSMarc-André Lureau# Example:
2900915a213fSMarc-André Lureau#
2901915a213fSMarc-André Lureau# -> { "execute": "blockdev-add",
2902915a213fSMarc-André Lureau#      "arguments": {
2903915a213fSMarc-André Lureau#          "options": {
2904915a213fSMarc-André Lureau#              "driver": "qcow2",
2905915a213fSMarc-André Lureau#              "node-name": "node0",
2906915a213fSMarc-André Lureau#              "file": {
2907915a213fSMarc-André Lureau#                  "driver": "file",
2908915a213fSMarc-André Lureau#                  "filename": "test.qcow2"
2909915a213fSMarc-André Lureau#              }
2910915a213fSMarc-André Lureau#          }
2911915a213fSMarc-André Lureau#      }
2912915a213fSMarc-André Lureau#    }
2913915a213fSMarc-André Lureau# <- { "return": {} }
2914915a213fSMarc-André Lureau#
2915915a213fSMarc-André Lureau# -> { "execute": "x-blockdev-del",
2916915a213fSMarc-André Lureau#      "arguments": { "node-name": "node0" }
2917915a213fSMarc-André Lureau#    }
2918915a213fSMarc-André Lureau# <- { "return": {} }
2919915a213fSMarc-André Lureau#
292081b936aeSAlberto Garcia##
29219ec8873eSKevin Wolf{ 'command': 'x-blockdev-del', 'data': { 'node-name': 'str' } }
292281b936aeSAlberto Garcia
292381b936aeSAlberto Garcia##
29247d8a9f71SMax Reitz# @blockdev-open-tray:
29257d8a9f71SMax Reitz#
29267d8a9f71SMax Reitz# Opens a block device's tray. If there is a block driver state tree inserted as
29277d8a9f71SMax Reitz# a medium, it will become inaccessible to the guest (but it will remain
29287d8a9f71SMax Reitz# associated to the block device, so closing the tray will make it accessible
29297d8a9f71SMax Reitz# again).
29307d8a9f71SMax Reitz#
29317d8a9f71SMax Reitz# If the tray was already open before, this will be a no-op.
29327d8a9f71SMax Reitz#
29337d8a9f71SMax Reitz# Once the tray opens, a DEVICE_TRAY_MOVED event is emitted. There are cases in
29347d8a9f71SMax Reitz# which no such event will be generated, these include:
29357d8a9f71SMax Reitz# - if the guest has locked the tray, @force is false and the guest does not
29367d8a9f71SMax Reitz#   respond to the eject request
29377d8a9f71SMax Reitz# - if the BlockBackend denoted by @device does not have a guest device attached
29387d8a9f71SMax Reitz#   to it
293912c7ec87SMax Reitz# - if the guest device does not have an actual tray
29407d8a9f71SMax Reitz#
2941b33945cfSKevin Wolf# @device: #optional Block device name (deprecated, use @id instead)
2942b33945cfSKevin Wolf#
2943b33945cfSKevin Wolf# @id:     #optional The name or QOM path of the guest device (since: 2.8)
29447d8a9f71SMax Reitz#
29457d8a9f71SMax Reitz# @force:  #optional if false (the default), an eject request will be sent to
29467d8a9f71SMax Reitz#          the guest if it has locked the tray (and the tray will not be opened
29477d8a9f71SMax Reitz#          immediately); if true, the tray will be opened regardless of whether
29487d8a9f71SMax Reitz#          it is locked
29497d8a9f71SMax Reitz#
29507d8a9f71SMax Reitz# Since: 2.5
29511133b1d6SMarc-André Lureau#
29521133b1d6SMarc-André Lureau# Example:
29531133b1d6SMarc-André Lureau#
29541133b1d6SMarc-André Lureau# -> { "execute": "blockdev-open-tray",
29551133b1d6SMarc-André Lureau#      "arguments": { "id": "ide0-1-0" } }
29561133b1d6SMarc-André Lureau#
29571133b1d6SMarc-André Lureau# <- { "timestamp": { "seconds": 1418751016,
29581133b1d6SMarc-André Lureau#                     "microseconds": 716996 },
29591133b1d6SMarc-André Lureau#      "event": "DEVICE_TRAY_MOVED",
29601133b1d6SMarc-André Lureau#      "data": { "device": "ide1-cd0",
29611133b1d6SMarc-André Lureau#                "id": "ide0-1-0",
29621133b1d6SMarc-André Lureau#                "tray-open": true } }
29631133b1d6SMarc-André Lureau#
29641133b1d6SMarc-André Lureau# <- { "return": {} }
29651133b1d6SMarc-André Lureau#
29667d8a9f71SMax Reitz##
29677d8a9f71SMax Reitz{ 'command': 'blockdev-open-tray',
2968b33945cfSKevin Wolf  'data': { '*device': 'str',
2969b33945cfSKevin Wolf            '*id': 'str',
29707d8a9f71SMax Reitz            '*force': 'bool' } }
29717d8a9f71SMax Reitz
2972abaaf59dSMax Reitz##
2973abaaf59dSMax Reitz# @blockdev-close-tray:
2974abaaf59dSMax Reitz#
2975abaaf59dSMax Reitz# Closes a block device's tray. If there is a block driver state tree associated
2976abaaf59dSMax Reitz# with the block device (which is currently ejected), that tree will be loaded
2977abaaf59dSMax Reitz# as the medium.
2978abaaf59dSMax Reitz#
2979abaaf59dSMax Reitz# If the tray was already closed before, this will be a no-op.
2980abaaf59dSMax Reitz#
2981b33945cfSKevin Wolf# @device:  #optional Block device name (deprecated, use @id instead)
2982b33945cfSKevin Wolf#
2983b33945cfSKevin Wolf# @id:      #optional The name or QOM path of the guest device (since: 2.8)
2984abaaf59dSMax Reitz#
2985abaaf59dSMax Reitz# Since: 2.5
29867f3c6f22SMarc-André Lureau#
29877f3c6f22SMarc-André Lureau# Example:
29887f3c6f22SMarc-André Lureau#
29897f3c6f22SMarc-André Lureau# -> { "execute": "blockdev-close-tray",
29907f3c6f22SMarc-André Lureau#      "arguments": { "id": "ide0-1-0" } }
29917f3c6f22SMarc-André Lureau#
29927f3c6f22SMarc-André Lureau# <- { "timestamp": { "seconds": 1418751345,
29937f3c6f22SMarc-André Lureau#                     "microseconds": 272147 },
29947f3c6f22SMarc-André Lureau#      "event": "DEVICE_TRAY_MOVED",
29957f3c6f22SMarc-André Lureau#      "data": { "device": "ide1-cd0",
29967f3c6f22SMarc-André Lureau#                "id": "ide0-1-0",
29977f3c6f22SMarc-André Lureau#                "tray-open": false } }
29987f3c6f22SMarc-André Lureau#
29997f3c6f22SMarc-André Lureau# <- { "return": {} }
30007f3c6f22SMarc-André Lureau#
3001abaaf59dSMax Reitz##
3002abaaf59dSMax Reitz{ 'command': 'blockdev-close-tray',
3003b33945cfSKevin Wolf  'data': { '*device': 'str',
3004b33945cfSKevin Wolf            '*id': 'str' } }
3005abaaf59dSMax Reitz
30062814f672SMax Reitz##
30076e0abc25SMax Reitz# @x-blockdev-remove-medium:
30082814f672SMax Reitz#
30092814f672SMax Reitz# Removes a medium (a block driver state tree) from a block device. That block
30102814f672SMax Reitz# device's tray must currently be open (unless there is no attached guest
30112814f672SMax Reitz# device).
30122814f672SMax Reitz#
30132814f672SMax Reitz# If the tray is open and there is no medium inserted, this will be a no-op.
30142814f672SMax Reitz#
301500949babSKevin Wolf# @device: #optional Block device name (deprecated, use @id instead)
301600949babSKevin Wolf#
301700949babSKevin Wolf# @id:     #optional The name or QOM path of the guest device (since: 2.8)
30182814f672SMax Reitz#
30197a305384SMarc-André Lureau# Note: This command is still a work in progress and is considered experimental.
30207a305384SMarc-André Lureau# Stay away from it unless you want to help with its development.
30217a305384SMarc-André Lureau#
30222814f672SMax Reitz# Since: 2.5
30238e1c1429SMarc-André Lureau#
30248e1c1429SMarc-André Lureau# Example:
30258e1c1429SMarc-André Lureau#
30268e1c1429SMarc-André Lureau# -> { "execute": "x-blockdev-remove-medium",
30278e1c1429SMarc-André Lureau#      "arguments": { "id": "ide0-1-0" } }
30288e1c1429SMarc-André Lureau#
30298e1c1429SMarc-André Lureau# <- { "error": { "class": "GenericError",
30308e1c1429SMarc-André Lureau#                 "desc": "Tray of device 'ide0-1-0' is not open" } }
30318e1c1429SMarc-André Lureau#
30328e1c1429SMarc-André Lureau# -> { "execute": "blockdev-open-tray",
30338e1c1429SMarc-André Lureau#      "arguments": { "id": "ide0-1-0" } }
30348e1c1429SMarc-André Lureau#
30358e1c1429SMarc-André Lureau# <- { "timestamp": { "seconds": 1418751627,
30368e1c1429SMarc-André Lureau#                     "microseconds": 549958 },
30378e1c1429SMarc-André Lureau#      "event": "DEVICE_TRAY_MOVED",
30388e1c1429SMarc-André Lureau#      "data": { "device": "ide1-cd0",
30398e1c1429SMarc-André Lureau#                "id": "ide0-1-0",
30408e1c1429SMarc-André Lureau#                "tray-open": true } }
30418e1c1429SMarc-André Lureau#
30428e1c1429SMarc-André Lureau# <- { "return": {} }
30438e1c1429SMarc-André Lureau#
30448e1c1429SMarc-André Lureau# -> { "execute": "x-blockdev-remove-medium",
30458e1c1429SMarc-André Lureau#      "arguments": { "device": "ide0-1-0" } }
30468e1c1429SMarc-André Lureau#
30478e1c1429SMarc-André Lureau# <- { "return": {} }
30488e1c1429SMarc-André Lureau#
30492814f672SMax Reitz##
30506e0abc25SMax Reitz{ 'command': 'x-blockdev-remove-medium',
305100949babSKevin Wolf  'data': { '*device': 'str',
305200949babSKevin Wolf            '*id': 'str' } }
30532814f672SMax Reitz
3054d1299882SMax Reitz##
30556e0abc25SMax Reitz# @x-blockdev-insert-medium:
3056d1299882SMax Reitz#
3057d1299882SMax Reitz# Inserts a medium (a block driver state tree) into a block device. That block
3058d1299882SMax Reitz# device's tray must currently be open (unless there is no attached guest
3059d1299882SMax Reitz# device) and there must be no medium inserted already.
3060d1299882SMax Reitz#
3061716df217SKevin Wolf# @device:    #optional Block device name (deprecated, use @id instead)
3062716df217SKevin Wolf#
3063716df217SKevin Wolf# @id:        #optional The name or QOM path of the guest device (since: 2.8)
3064d1299882SMax Reitz#
3065d1299882SMax Reitz# @node-name: name of a node in the block driver state graph
3066d1299882SMax Reitz#
30677a305384SMarc-André Lureau# Note: This command is still a work in progress and is considered experimental.
30687a305384SMarc-André Lureau# Stay away from it unless you want to help with its development.
30697a305384SMarc-André Lureau#
3070d1299882SMax Reitz# Since: 2.5
3071b480abf3SMarc-André Lureau#
3072b480abf3SMarc-André Lureau# Example:
3073b480abf3SMarc-André Lureau#
3074b480abf3SMarc-André Lureau# -> { "execute": "blockdev-add",
3075b480abf3SMarc-André Lureau#      "arguments": {
3076b480abf3SMarc-André Lureau#          "options": { "node-name": "node0",
3077b480abf3SMarc-André Lureau#                       "driver": "raw",
3078b480abf3SMarc-André Lureau#                       "file": { "driver": "file",
3079b480abf3SMarc-André Lureau#                                 "filename": "fedora.iso" } } } }
3080b480abf3SMarc-André Lureau# <- { "return": {} }
3081b480abf3SMarc-André Lureau#
3082b480abf3SMarc-André Lureau# -> { "execute": "x-blockdev-insert-medium",
3083b480abf3SMarc-André Lureau#      "arguments": { "id": "ide0-1-0",
3084b480abf3SMarc-André Lureau#                     "node-name": "node0" } }
3085b480abf3SMarc-André Lureau#
3086b480abf3SMarc-André Lureau# <- { "return": {} }
3087b480abf3SMarc-André Lureau#
3088d1299882SMax Reitz##
30896e0abc25SMax Reitz{ 'command': 'x-blockdev-insert-medium',
3090716df217SKevin Wolf  'data': { '*device': 'str',
3091716df217SKevin Wolf            '*id': 'str',
3092d1299882SMax Reitz            'node-name': 'str'} }
3093d1299882SMax Reitz
3094a589569fSWenchao Xia
3095a589569fSWenchao Xia##
309639ff43d9SMax Reitz# @BlockdevChangeReadOnlyMode:
309739ff43d9SMax Reitz#
309839ff43d9SMax Reitz# Specifies the new read-only mode of a block device subject to the
309939ff43d9SMax Reitz# @blockdev-change-medium command.
310039ff43d9SMax Reitz#
310139ff43d9SMax Reitz# @retain:      Retains the current read-only mode
310239ff43d9SMax Reitz#
310339ff43d9SMax Reitz# @read-only:   Makes the device read-only
310439ff43d9SMax Reitz#
310539ff43d9SMax Reitz# @read-write:  Makes the device writable
310639ff43d9SMax Reitz#
310739ff43d9SMax Reitz# Since: 2.3
3108be3e83cbSMarc-André Lureau#
310939ff43d9SMax Reitz##
311039ff43d9SMax Reitz{ 'enum': 'BlockdevChangeReadOnlyMode',
311139ff43d9SMax Reitz  'data': ['retain', 'read-only', 'read-write'] }
311239ff43d9SMax Reitz
311339ff43d9SMax Reitz
311439ff43d9SMax Reitz##
311524fb4133SMax Reitz# @blockdev-change-medium:
311624fb4133SMax Reitz#
311724fb4133SMax Reitz# Changes the medium inserted into a block device by ejecting the current medium
311824fb4133SMax Reitz# and loading a new image file which is inserted as the new medium (this command
31196e0abc25SMax Reitz# combines blockdev-open-tray, x-blockdev-remove-medium,
31206e0abc25SMax Reitz# x-blockdev-insert-medium and blockdev-close-tray).
312124fb4133SMax Reitz#
312270e2cb3bSKevin Wolf# @device:          #optional Block device name (deprecated, use @id instead)
312370e2cb3bSKevin Wolf#
312470e2cb3bSKevin Wolf# @id:              #optional The name or QOM path of the guest device
312570e2cb3bSKevin Wolf#                   (since: 2.8)
312624fb4133SMax Reitz#
312724fb4133SMax Reitz# @filename:        filename of the new image to be loaded
312824fb4133SMax Reitz#
312924fb4133SMax Reitz# @format:          #optional, format to open the new image with (defaults to
313024fb4133SMax Reitz#                   the probed format)
313124fb4133SMax Reitz#
313239ff43d9SMax Reitz# @read-only-mode:  #optional, change the read-only mode of the device; defaults
313339ff43d9SMax Reitz#                   to 'retain'
313439ff43d9SMax Reitz#
313524fb4133SMax Reitz# Since: 2.5
3136be3e83cbSMarc-André Lureau#
3137be3e83cbSMarc-André Lureau# Examples:
3138be3e83cbSMarc-André Lureau#
3139be3e83cbSMarc-André Lureau# 1. Change a removable medium
3140be3e83cbSMarc-André Lureau#
3141be3e83cbSMarc-André Lureau# -> { "execute": "blockdev-change-medium",
3142be3e83cbSMarc-André Lureau#      "arguments": { "id": "ide0-1-0",
3143be3e83cbSMarc-André Lureau#                     "filename": "/srv/images/Fedora-12-x86_64-DVD.iso",
3144be3e83cbSMarc-André Lureau#                     "format": "raw" } }
3145be3e83cbSMarc-André Lureau# <- { "return": {} }
3146be3e83cbSMarc-André Lureau#
3147be3e83cbSMarc-André Lureau# 2. Load a read-only medium into a writable drive
3148be3e83cbSMarc-André Lureau#
3149be3e83cbSMarc-André Lureau# -> { "execute": "blockdev-change-medium",
3150be3e83cbSMarc-André Lureau#      "arguments": { "id": "floppyA",
3151be3e83cbSMarc-André Lureau#                     "filename": "/srv/images/ro.img",
3152be3e83cbSMarc-André Lureau#                     "format": "raw",
3153be3e83cbSMarc-André Lureau#                     "read-only-mode": "retain" } }
3154be3e83cbSMarc-André Lureau#
3155be3e83cbSMarc-André Lureau# <- { "error":
3156be3e83cbSMarc-André Lureau#      { "class": "GenericError",
3157be3e83cbSMarc-André Lureau#        "desc": "Could not open '/srv/images/ro.img': Permission denied" } }
3158be3e83cbSMarc-André Lureau#
3159be3e83cbSMarc-André Lureau# -> { "execute": "blockdev-change-medium",
3160be3e83cbSMarc-André Lureau#      "arguments": { "id": "floppyA",
3161be3e83cbSMarc-André Lureau#                     "filename": "/srv/images/ro.img",
3162be3e83cbSMarc-André Lureau#                     "format": "raw",
3163be3e83cbSMarc-André Lureau#                     "read-only-mode": "read-only" } }
3164be3e83cbSMarc-André Lureau#
3165be3e83cbSMarc-André Lureau# <- { "return": {} }
3166be3e83cbSMarc-André Lureau#
316724fb4133SMax Reitz##
316824fb4133SMax Reitz{ 'command': 'blockdev-change-medium',
316970e2cb3bSKevin Wolf  'data': { '*device': 'str',
317070e2cb3bSKevin Wolf            '*id': 'str',
317124fb4133SMax Reitz            'filename': 'str',
317239ff43d9SMax Reitz            '*format': 'str',
317339ff43d9SMax Reitz            '*read-only-mode': 'BlockdevChangeReadOnlyMode' } }
317424fb4133SMax Reitz
317524fb4133SMax Reitz
317624fb4133SMax Reitz##
31775072f7b3SMarc-André Lureau# @BlockErrorAction:
3178a589569fSWenchao Xia#
3179a589569fSWenchao Xia# An enumeration of action that has been taken when a DISK I/O occurs
3180a589569fSWenchao Xia#
3181a589569fSWenchao Xia# @ignore: error has been ignored
3182a589569fSWenchao Xia#
3183a589569fSWenchao Xia# @report: error has been reported to the device
3184a589569fSWenchao Xia#
3185a589569fSWenchao Xia# @stop: error caused VM to be stopped
3186a589569fSWenchao Xia#
3187a589569fSWenchao Xia# Since: 2.1
3188a589569fSWenchao Xia##
3189a589569fSWenchao Xia{ 'enum': 'BlockErrorAction',
3190a589569fSWenchao Xia  'data': [ 'ignore', 'report', 'stop' ] }
31915a2d2cbdSWenchao Xia
31925a2d2cbdSWenchao Xia
31935a2d2cbdSWenchao Xia##
31945072f7b3SMarc-André Lureau# @BLOCK_IMAGE_CORRUPTED:
3195c120f0faSWenchao Xia#
3196370d4ebaSMarc-André Lureau# Emitted when a disk image is being marked corrupt. The image can be
3197370d4ebaSMarc-André Lureau# identified by its device or node name. The 'device' field is always
3198370d4ebaSMarc-André Lureau# present for compatibility reasons, but it can be empty ("") if the
3199370d4ebaSMarc-André Lureau# image does not have a device name associated.
3200c120f0faSWenchao Xia#
3201dc881b44SAlberto Garcia# @device: device name. This is always present for compatibility
3202dc881b44SAlberto Garcia#          reasons, but it can be empty ("") if the image does not
3203dc881b44SAlberto Garcia#          have a device name associated.
3204dc881b44SAlberto Garcia#
3205dc881b44SAlberto Garcia# @node-name: #optional node name (Since: 2.4)
3206c120f0faSWenchao Xia#
3207c120f0faSWenchao Xia# @msg: informative message for human consumption, such as the kind of
32082f44a08bSWenchao Xia#       corruption being detected. It should not be parsed by machine as it is
32092f44a08bSWenchao Xia#       not guaranteed to be stable
3210c120f0faSWenchao Xia#
3211c120f0faSWenchao Xia# @offset: #optional, if the corruption resulted from an image access, this is
32120caef8f6SAlberto Garcia#          the host's access offset into the image
3213c120f0faSWenchao Xia#
3214c120f0faSWenchao Xia# @size: #optional, if the corruption resulted from an image access, this is
3215c120f0faSWenchao Xia#        the access size
3216c120f0faSWenchao Xia#
3217370d4ebaSMarc-André Lureau# @fatal: if set, the image is marked corrupt and therefore unusable after this
32189bf040b9SMax Reitz#        event and must be repaired (Since 2.2; before, every
32199bf040b9SMax Reitz#        BLOCK_IMAGE_CORRUPTED event was fatal)
32209bf040b9SMax Reitz#
322107c9f583SMarc-André Lureau# Note: If action is "stop", a STOP event will eventually follow the
322207c9f583SMarc-André Lureau#       BLOCK_IO_ERROR event.
322307c9f583SMarc-André Lureau#
3224370d4ebaSMarc-André Lureau# Example:
3225370d4ebaSMarc-André Lureau#
3226370d4ebaSMarc-André Lureau# <- { "event": "BLOCK_IMAGE_CORRUPTED",
3227370d4ebaSMarc-André Lureau#      "data": { "device": "ide0-hd0", "node-name": "node0",
3228370d4ebaSMarc-André Lureau#                "msg": "Prevented active L1 table overwrite", "offset": 196608,
3229370d4ebaSMarc-André Lureau#                "size": 65536 },
3230370d4ebaSMarc-André Lureau#      "timestamp": { "seconds": 1378126126, "microseconds": 966463 } }
3231370d4ebaSMarc-André Lureau#
3232c120f0faSWenchao Xia# Since: 1.7
3233c120f0faSWenchao Xia##
3234c120f0faSWenchao Xia{ 'event': 'BLOCK_IMAGE_CORRUPTED',
3235c120f0faSWenchao Xia  'data': { 'device'     : 'str',
3236dc881b44SAlberto Garcia            '*node-name' : 'str',
3237c120f0faSWenchao Xia            'msg'        : 'str',
3238c120f0faSWenchao Xia            '*offset'    : 'int',
32399bf040b9SMax Reitz            '*size'      : 'int',
32409bf040b9SMax Reitz            'fatal'      : 'bool' } }
3241c120f0faSWenchao Xia
3242c120f0faSWenchao Xia##
32435072f7b3SMarc-André Lureau# @BLOCK_IO_ERROR:
32445a2d2cbdSWenchao Xia#
32455a2d2cbdSWenchao Xia# Emitted when a disk I/O error occurs
32465a2d2cbdSWenchao Xia#
32472bf7e10fSKevin Wolf# @device: device name. This is always present for compatibility
32482bf7e10fSKevin Wolf#          reasons, but it can be empty ("") if the image does not
32492bf7e10fSKevin Wolf#          have a device name associated.
32502bf7e10fSKevin Wolf#
32512bf7e10fSKevin Wolf# @node-name: node name. Note that errors may be reported for the root node
32522bf7e10fSKevin Wolf#             that is directly attached to a guest device rather than for the
32532bf7e10fSKevin Wolf#             node where the error occurred. (Since: 2.8)
32545a2d2cbdSWenchao Xia#
32555a2d2cbdSWenchao Xia# @operation: I/O operation
32565a2d2cbdSWenchao Xia#
32575a2d2cbdSWenchao Xia# @action: action that has been taken
32585a2d2cbdSWenchao Xia#
3259c7c2ff0cSLuiz Capitulino# @nospace: #optional true if I/O error was caused due to a no-space
3260c7c2ff0cSLuiz Capitulino#           condition. This key is only present if query-block's
3261c7c2ff0cSLuiz Capitulino#           io-status is present, please see query-block documentation
3262c7c2ff0cSLuiz Capitulino#           for more information (since: 2.2)
3263c7c2ff0cSLuiz Capitulino#
3264624ff573SLuiz Capitulino# @reason: human readable string describing the error cause.
3265624ff573SLuiz Capitulino#          (This field is a debugging aid for humans, it should not
3266624ff573SLuiz Capitulino#           be parsed by applications) (since: 2.2)
3267624ff573SLuiz Capitulino#
32685a2d2cbdSWenchao Xia# Note: If action is "stop", a STOP event will eventually follow the
32695a2d2cbdSWenchao Xia# BLOCK_IO_ERROR event
32705a2d2cbdSWenchao Xia#
32715a2d2cbdSWenchao Xia# Since: 0.13.0
327207c9f583SMarc-André Lureau#
327307c9f583SMarc-André Lureau# Example:
327407c9f583SMarc-André Lureau#
327507c9f583SMarc-André Lureau# <- { "event": "BLOCK_IO_ERROR",
327607c9f583SMarc-André Lureau#      "data": { "device": "ide0-hd1",
327707c9f583SMarc-André Lureau#                "node-name": "#block212",
327807c9f583SMarc-André Lureau#                "operation": "write",
327907c9f583SMarc-André Lureau#                "action": "stop" },
328007c9f583SMarc-André Lureau#      "timestamp": { "seconds": 1265044230, "microseconds": 450486 } }
328107c9f583SMarc-André Lureau#
32825a2d2cbdSWenchao Xia##
32835a2d2cbdSWenchao Xia{ 'event': 'BLOCK_IO_ERROR',
32842bf7e10fSKevin Wolf  'data': { 'device': 'str', 'node-name': 'str', 'operation': 'IoOperationType',
3285624ff573SLuiz Capitulino            'action': 'BlockErrorAction', '*nospace': 'bool',
3286624ff573SLuiz Capitulino            'reason': 'str' } }
32875a2d2cbdSWenchao Xia
32885a2d2cbdSWenchao Xia##
32895072f7b3SMarc-André Lureau# @BLOCK_JOB_COMPLETED:
3290bcada37bSWenchao Xia#
3291bcada37bSWenchao Xia# Emitted when a block job has completed
3292bcada37bSWenchao Xia#
3293bcada37bSWenchao Xia# @type: job type
3294bcada37bSWenchao Xia#
32956aae5be6SAlberto Garcia# @device: The job identifier. Originally the device name but other
32966aae5be6SAlberto Garcia#          values are allowed since QEMU 2.7
3297bcada37bSWenchao Xia#
3298bcada37bSWenchao Xia# @len: maximum progress value
3299bcada37bSWenchao Xia#
3300bcada37bSWenchao Xia# @offset: current progress value. On success this is equal to len.
3301bcada37bSWenchao Xia#          On failure this is less than len
3302bcada37bSWenchao Xia#
3303bcada37bSWenchao Xia# @speed: rate limit, bytes per second
3304bcada37bSWenchao Xia#
3305bcada37bSWenchao Xia# @error: #optional, error message. Only present on failure. This field
3306bcada37bSWenchao Xia#         contains a human-readable error message. There are no semantics
3307bcada37bSWenchao Xia#         other than that streaming has failed and clients should not try to
3308bcada37bSWenchao Xia#         interpret the error string
3309bcada37bSWenchao Xia#
3310bcada37bSWenchao Xia# Since: 1.1
3311e21e65b2SMarc-André Lureau#
3312e21e65b2SMarc-André Lureau# Example:
3313e21e65b2SMarc-André Lureau#
3314e21e65b2SMarc-André Lureau# <- { "event": "BLOCK_JOB_COMPLETED",
3315e21e65b2SMarc-André Lureau#      "data": { "type": "stream", "device": "virtio-disk0",
3316e21e65b2SMarc-André Lureau#                "len": 10737418240, "offset": 10737418240,
3317e21e65b2SMarc-André Lureau#                "speed": 0 },
3318e21e65b2SMarc-André Lureau#      "timestamp": { "seconds": 1267061043, "microseconds": 959568 } }
3319e21e65b2SMarc-André Lureau#
3320bcada37bSWenchao Xia##
3321bcada37bSWenchao Xia{ 'event': 'BLOCK_JOB_COMPLETED',
3322bcada37bSWenchao Xia  'data': { 'type'  : 'BlockJobType',
3323bcada37bSWenchao Xia            'device': 'str',
3324bcada37bSWenchao Xia            'len'   : 'int',
3325bcada37bSWenchao Xia            'offset': 'int',
3326bcada37bSWenchao Xia            'speed' : 'int',
3327bcada37bSWenchao Xia            '*error': 'str' } }
3328bcada37bSWenchao Xia
3329bcada37bSWenchao Xia##
33305072f7b3SMarc-André Lureau# @BLOCK_JOB_CANCELLED:
3331bcada37bSWenchao Xia#
3332bcada37bSWenchao Xia# Emitted when a block job has been cancelled
3333bcada37bSWenchao Xia#
3334bcada37bSWenchao Xia# @type: job type
3335bcada37bSWenchao Xia#
33366aae5be6SAlberto Garcia# @device: The job identifier. Originally the device name but other
33376aae5be6SAlberto Garcia#          values are allowed since QEMU 2.7
3338bcada37bSWenchao Xia#
3339bcada37bSWenchao Xia# @len: maximum progress value
3340bcada37bSWenchao Xia#
3341bcada37bSWenchao Xia# @offset: current progress value. On success this is equal to len.
3342bcada37bSWenchao Xia#          On failure this is less than len
3343bcada37bSWenchao Xia#
3344bcada37bSWenchao Xia# @speed: rate limit, bytes per second
3345bcada37bSWenchao Xia#
3346bcada37bSWenchao Xia# Since: 1.1
3347e161df39SMarc-André Lureau#
3348e161df39SMarc-André Lureau# Example:
3349e161df39SMarc-André Lureau#
3350e161df39SMarc-André Lureau# <- { "event": "BLOCK_JOB_CANCELLED",
3351e161df39SMarc-André Lureau#      "data": { "type": "stream", "device": "virtio-disk0",
3352e161df39SMarc-André Lureau#                "len": 10737418240, "offset": 134217728,
3353e161df39SMarc-André Lureau#                "speed": 0 },
3354e161df39SMarc-André Lureau#      "timestamp": { "seconds": 1267061043, "microseconds": 959568 } }
3355e161df39SMarc-André Lureau#
3356bcada37bSWenchao Xia##
3357bcada37bSWenchao Xia{ 'event': 'BLOCK_JOB_CANCELLED',
3358bcada37bSWenchao Xia  'data': { 'type'  : 'BlockJobType',
3359bcada37bSWenchao Xia            'device': 'str',
3360bcada37bSWenchao Xia            'len'   : 'int',
3361bcada37bSWenchao Xia            'offset': 'int',
3362bcada37bSWenchao Xia            'speed' : 'int' } }
3363bcada37bSWenchao Xia
3364bcada37bSWenchao Xia##
33655072f7b3SMarc-André Lureau# @BLOCK_JOB_ERROR:
33665a2d2cbdSWenchao Xia#
33675a2d2cbdSWenchao Xia# Emitted when a block job encounters an error
33685a2d2cbdSWenchao Xia#
33696aae5be6SAlberto Garcia# @device: The job identifier. Originally the device name but other
33706aae5be6SAlberto Garcia#          values are allowed since QEMU 2.7
33715a2d2cbdSWenchao Xia#
33725a2d2cbdSWenchao Xia# @operation: I/O operation
33735a2d2cbdSWenchao Xia#
33745a2d2cbdSWenchao Xia# @action: action that has been taken
33755a2d2cbdSWenchao Xia#
33765a2d2cbdSWenchao Xia# Since: 1.3
3377*af0e0910SMarc-André Lureau#
3378*af0e0910SMarc-André Lureau# Example:
3379*af0e0910SMarc-André Lureau#
3380*af0e0910SMarc-André Lureau# <- { "event": "BLOCK_JOB_ERROR",
3381*af0e0910SMarc-André Lureau#      "data": { "device": "ide0-hd1",
3382*af0e0910SMarc-André Lureau#                "operation": "write",
3383*af0e0910SMarc-André Lureau#                "action": "stop" },
3384*af0e0910SMarc-André Lureau#      "timestamp": { "seconds": 1265044230, "microseconds": 450486 } }
3385*af0e0910SMarc-André Lureau#
33865a2d2cbdSWenchao Xia##
33875a2d2cbdSWenchao Xia{ 'event': 'BLOCK_JOB_ERROR',
33885a2d2cbdSWenchao Xia  'data': { 'device'   : 'str',
33895a2d2cbdSWenchao Xia            'operation': 'IoOperationType',
3390823c6863SMarkus Armbruster            'action'   : 'BlockErrorAction' } }
3391bcada37bSWenchao Xia
3392bcada37bSWenchao Xia##
33935072f7b3SMarc-André Lureau# @BLOCK_JOB_READY:
3394bcada37bSWenchao Xia#
3395bcada37bSWenchao Xia# Emitted when a block job is ready to complete
3396bcada37bSWenchao Xia#
3397518848a2SMarkus Armbruster# @type: job type
3398518848a2SMarkus Armbruster#
33996aae5be6SAlberto Garcia# @device: The job identifier. Originally the device name but other
34006aae5be6SAlberto Garcia#          values are allowed since QEMU 2.7
3401bcada37bSWenchao Xia#
3402518848a2SMarkus Armbruster# @len: maximum progress value
3403518848a2SMarkus Armbruster#
3404518848a2SMarkus Armbruster# @offset: current progress value. On success this is equal to len.
3405518848a2SMarkus Armbruster#          On failure this is less than len
3406518848a2SMarkus Armbruster#
3407518848a2SMarkus Armbruster# @speed: rate limit, bytes per second
3408518848a2SMarkus Armbruster#
3409bcada37bSWenchao Xia# Note: The "ready to complete" status is always reset by a @BLOCK_JOB_ERROR
3410bcada37bSWenchao Xia# event
3411bcada37bSWenchao Xia#
3412bcada37bSWenchao Xia# Since: 1.3
3413bcada37bSWenchao Xia##
3414bcada37bSWenchao Xia{ 'event': 'BLOCK_JOB_READY',
3415518848a2SMarkus Armbruster  'data': { 'type'  : 'BlockJobType',
3416518848a2SMarkus Armbruster            'device': 'str',
3417518848a2SMarkus Armbruster            'len'   : 'int',
3418518848a2SMarkus Armbruster            'offset': 'int',
3419518848a2SMarkus Armbruster            'speed' : 'int' } }
3420ffeaac9bSHu Tao
342149687aceSMarc-André Lureau##
34225072f7b3SMarc-André Lureau# @PreallocMode:
3423ffeaac9bSHu Tao#
3424ffeaac9bSHu Tao# Preallocation mode of QEMU image file
3425ffeaac9bSHu Tao#
3426ffeaac9bSHu Tao# @off: no preallocation
3427ffeaac9bSHu Tao# @metadata: preallocate only for metadata
3428ffeaac9bSHu Tao# @falloc: like @full preallocation but allocate disk space by
3429ffeaac9bSHu Tao#          posix_fallocate() rather than writing zeros.
3430ffeaac9bSHu Tao# @full: preallocate all data by writing zeros to device to ensure disk
3431ffeaac9bSHu Tao#        space is really available. @full preallocation also sets up
3432ffeaac9bSHu Tao#        metadata correctly.
3433ffeaac9bSHu Tao#
34345072f7b3SMarc-André Lureau# Since: 2.2
3435ffeaac9bSHu Tao##
3436ffeaac9bSHu Tao{ 'enum': 'PreallocMode',
3437ffeaac9bSHu Tao  'data': [ 'off', 'metadata', 'falloc', 'full' ] }
3438e2462113SFrancesco Romani
3439e2462113SFrancesco Romani##
34405072f7b3SMarc-André Lureau# @BLOCK_WRITE_THRESHOLD:
3441e2462113SFrancesco Romani#
3442e2462113SFrancesco Romani# Emitted when writes on block device reaches or exceeds the
3443e2462113SFrancesco Romani# configured write threshold. For thin-provisioned devices, this
3444e2462113SFrancesco Romani# means the device should be extended to avoid pausing for
3445e2462113SFrancesco Romani# disk exhaustion.
3446e2462113SFrancesco Romani# The event is one shot. Once triggered, it needs to be
3447e2462113SFrancesco Romani# re-registered with another block-set-threshold command.
3448e2462113SFrancesco Romani#
3449e2462113SFrancesco Romani# @node-name: graph node name on which the threshold was exceeded.
3450e2462113SFrancesco Romani#
3451e2462113SFrancesco Romani# @amount-exceeded: amount of data which exceeded the threshold, in bytes.
3452e2462113SFrancesco Romani#
3453e2462113SFrancesco Romani# @write-threshold: last configured threshold, in bytes.
3454e2462113SFrancesco Romani#
3455e2462113SFrancesco Romani# Since: 2.3
3456e2462113SFrancesco Romani##
3457e2462113SFrancesco Romani{ 'event': 'BLOCK_WRITE_THRESHOLD',
3458e2462113SFrancesco Romani  'data': { 'node-name': 'str',
3459e2462113SFrancesco Romani            'amount-exceeded': 'uint64',
3460e2462113SFrancesco Romani            'write-threshold': 'uint64' } }
3461e2462113SFrancesco Romani
3462e2462113SFrancesco Romani##
34635072f7b3SMarc-André Lureau# @block-set-write-threshold:
3464e2462113SFrancesco Romani#
3465e817862bSMarc-André Lureau# Change the write threshold for a block drive. An event will be
3466e817862bSMarc-André Lureau# delivered if a write to this block drive crosses the configured
3467e817862bSMarc-André Lureau# threshold.  The threshold is an offset, thus must be
3468e817862bSMarc-André Lureau# non-negative. Default is no write threshold. Setting the threshold
3469e817862bSMarc-André Lureau# to zero disables it.
3470e817862bSMarc-André Lureau#
3471e2462113SFrancesco Romani# This is useful to transparently resize thin-provisioned drives without
3472e2462113SFrancesco Romani# the guest OS noticing.
3473e2462113SFrancesco Romani#
3474e2462113SFrancesco Romani# @node-name: graph node name on which the threshold must be set.
3475e2462113SFrancesco Romani#
3476e2462113SFrancesco Romani# @write-threshold: configured threshold for the block device, bytes.
3477e2462113SFrancesco Romani#                   Use 0 to disable the threshold.
3478e2462113SFrancesco Romani#
3479e2462113SFrancesco Romani# Since: 2.3
3480e817862bSMarc-André Lureau#
3481e817862bSMarc-André Lureau# Example:
3482e817862bSMarc-André Lureau#
3483e817862bSMarc-André Lureau# -> { "execute": "block-set-write-threshold",
3484e817862bSMarc-André Lureau#      "arguments": { "node-name": "mydev",
3485e817862bSMarc-André Lureau#                     "write-threshold": 17179869184 } }
3486e817862bSMarc-André Lureau# <- { "return": {} }
3487e817862bSMarc-André Lureau#
3488e2462113SFrancesco Romani##
3489e2462113SFrancesco Romani{ 'command': 'block-set-write-threshold',
3490e2462113SFrancesco Romani  'data': { 'node-name': 'str', 'write-threshold': 'uint64' } }
34917f821597SWen Congyang
34927f821597SWen Congyang##
34935072f7b3SMarc-André Lureau# @x-blockdev-change:
34947f821597SWen Congyang#
34957f821597SWen Congyang# Dynamically reconfigure the block driver state graph. It can be used
34967f821597SWen Congyang# to add, remove, insert or replace a graph node. Currently only the
34977f821597SWen Congyang# Quorum driver implements this feature to add or remove its child. This
34987f821597SWen Congyang# is useful to fix a broken quorum child.
34997f821597SWen Congyang#
35007f821597SWen Congyang# If @node is specified, it will be inserted under @parent. @child
35017f821597SWen Congyang# may not be specified in this case. If both @parent and @child are
35027f821597SWen Congyang# specified but @node is not, @child will be detached from @parent.
35037f821597SWen Congyang#
35047f821597SWen Congyang# @parent: the id or name of the parent node.
35057f821597SWen Congyang#
35067f821597SWen Congyang# @child: #optional the name of a child under the given parent node.
35077f821597SWen Congyang#
35087f821597SWen Congyang# @node: #optional the name of the node that will be added.
35097f821597SWen Congyang#
35107f821597SWen Congyang# Note: this command is experimental, and its API is not stable. It
35117f821597SWen Congyang# does not support all kinds of operations, all kinds of children, nor
35127f821597SWen Congyang# all block drivers.
35137f821597SWen Congyang#
35147f821597SWen Congyang# Warning: The data in a new quorum child MUST be consistent with that of
35157f821597SWen Congyang# the rest of the array.
35167f821597SWen Congyang#
35177f821597SWen Congyang# Since: 2.7
3518bd77ea2eSMarc-André Lureau#
3519bd77ea2eSMarc-André Lureau# Example:
3520bd77ea2eSMarc-André Lureau#
3521bd77ea2eSMarc-André Lureau# 1. Add a new node to a quorum
3522bd77ea2eSMarc-André Lureau# -> { "execute": "blockdev-add",
3523bd77ea2eSMarc-André Lureau#      "arguments": {
3524bd77ea2eSMarc-André Lureau#          "options": { "driver": "raw",
3525bd77ea2eSMarc-André Lureau#                       "node-name": "new_node",
3526bd77ea2eSMarc-André Lureau#                        "file": { "driver": "file",
3527bd77ea2eSMarc-André Lureau#                                  "filename": "test.raw" } } } }
3528bd77ea2eSMarc-André Lureau# <- { "return": {} }
3529bd77ea2eSMarc-André Lureau# -> { "execute": "x-blockdev-change",
3530bd77ea2eSMarc-André Lureau#      "arguments": { "parent": "disk1",
3531bd77ea2eSMarc-André Lureau#                     "node": "new_node" } }
3532bd77ea2eSMarc-André Lureau# <- { "return": {} }
3533bd77ea2eSMarc-André Lureau#
3534bd77ea2eSMarc-André Lureau# 2. Delete a quorum's node
3535bd77ea2eSMarc-André Lureau# -> { "execute": "x-blockdev-change",
3536bd77ea2eSMarc-André Lureau#      "arguments": { "parent": "disk1",
3537bd77ea2eSMarc-André Lureau#                     "child": "children.1" } }
3538bd77ea2eSMarc-André Lureau# <- { "return": {} }
3539bd77ea2eSMarc-André Lureau#
35407f821597SWen Congyang##
35417f821597SWen Congyang{ 'command': 'x-blockdev-change',
35427f821597SWen Congyang  'data' : { 'parent': 'str',
35437f821597SWen Congyang             '*child': 'str',
35447f821597SWen Congyang             '*node': 'str' } }
3545