]> git.proxmox.com Git - mirror_qemu.git/blame - qapi/block-core.json
block/rbd: Add luks-any encryption opening option
[mirror_qemu.git] / qapi / block-core.json
CommitLineData
5db15096 1# -*- Mode: Python -*-
f7160f32 2# vim: filetype=python
d3a48372
MAL
3
4##
f5cf31c5 5# == Block core (VM unrelated)
d3a48372 6##
5db15096 7
5db15096 8{ 'include': 'common.json' }
2031c133 9{ 'include': 'crypto.json' }
bf42508f 10{ 'include': 'job.json' }
a2ff5a48 11{ 'include': 'sockets.json' }
1ad166b6
BC
12
13##
5072f7b3 14# @SnapshotInfo:
1ad166b6
BC
15#
16# @id: unique snapshot id
17#
18# @name: user chosen name
19#
20# @vm-state-size: size of the VM state
21#
22# @date-sec: UTC date of the snapshot in seconds
23#
24# @date-nsec: fractional part in nano seconds to be used with date-sec
25#
26# @vm-clock-sec: VM clock relative to boot in seconds
27#
28# @vm-clock-nsec: fractional part in nano seconds to be used with vm-clock-sec
29#
b39847a5
PD
30# @icount: Current instruction count. Appears when execution record/replay
31# is enabled. Used for "time-traveling" to match the moment
e3b09ad2
PD
32# in the recorded execution with the snapshots. This counter may
33# be obtained through @query-replay command (since 5.2)
b39847a5 34#
1ad166b6
BC
35# Since: 1.3
36#
37##
895a2a80 38{ 'struct': 'SnapshotInfo',
1ad166b6
BC
39 'data': { 'id': 'str', 'name': 'str', 'vm-state-size': 'int',
40 'date-sec': 'int', 'date-nsec': 'int',
b39847a5
PD
41 'vm-clock-sec': 'int', 'vm-clock-nsec': 'int',
42 '*icount': 'int' } }
1ad166b6 43
0a12f6f8
DB
44##
45# @ImageInfoSpecificQCow2EncryptionBase:
46#
47# @format: The encryption format
48#
49# Since: 2.10
50##
51{ 'struct': 'ImageInfoSpecificQCow2EncryptionBase',
52 'data': { 'format': 'BlockdevQcow2EncryptionFormat'}}
53
54##
55# @ImageInfoSpecificQCow2Encryption:
56#
57# Since: 2.10
58##
59{ 'union': 'ImageInfoSpecificQCow2Encryption',
60 'base': 'ImageInfoSpecificQCow2EncryptionBase',
61 'discriminator': 'format',
29cd0403 62 'data': { 'luks': 'QCryptoBlockInfoLUKS' } }
0a12f6f8 63
1ad166b6
BC
64##
65# @ImageInfoSpecificQCow2:
66#
67# @compat: compatibility level
68#
9b890bdc
KW
69# @data-file: the filename of the external data file that is stored in the
70# image and used as a default for opening the image (since: 4.0)
71#
6c3944dc
KW
72# @data-file-raw: True if the external data file must stay valid as a
73# standalone (read-only) raw image without looking at qcow2
74# metadata (since: 4.0)
75#
7be20252
AG
76# @extended-l2: true if the image has extended L2 entries; only valid for
77# compat >= 1.1 (since 5.2)
78#
1d8bda12 79# @lazy-refcounts: on or off; only valid for compat >= 1.1
1ad166b6 80#
1d8bda12 81# @corrupt: true if the image has been marked corrupt; only valid for
9009b196
HR
82# compat >= 1.1 (since 2.2)
83#
0709c5a1
HR
84# @refcount-bits: width of a refcount entry in bits (since 2.3)
85#
0a12f6f8
DB
86# @encrypt: details about encryption parameters; only set if image
87# is encrypted (since 2.10)
88#
b8968c87
AS
89# @bitmaps: A list of qcow2 bitmap details (since 4.0)
90#
572ad978
DP
91# @compression-type: the image cluster compression method (since 5.1)
92#
1ad166b6
BC
93# Since: 1.7
94##
895a2a80 95{ 'struct': 'ImageInfoSpecificQCow2',
1ad166b6
BC
96 'data': {
97 'compat': 'str',
9b890bdc 98 '*data-file': 'str',
6c3944dc 99 '*data-file-raw': 'bool',
7be20252 100 '*extended-l2': 'bool',
9009b196 101 '*lazy-refcounts': 'bool',
0709c5a1 102 '*corrupt': 'bool',
0a12f6f8 103 'refcount-bits': 'int',
b8968c87 104 '*encrypt': 'ImageInfoSpecificQCow2Encryption',
572ad978
DP
105 '*bitmaps': ['Qcow2BitmapInfo'],
106 'compression-type': 'Qcow2CompressionType'
1ad166b6
BC
107 } }
108
109##
110# @ImageInfoSpecificVmdk:
111#
112# @create-type: The create type of VMDK image
113#
114# @cid: Content id of image
115#
116# @parent-cid: Parent VMDK image's cid
117#
118# @extents: List of extent files
119#
120# Since: 1.7
121##
895a2a80 122{ 'struct': 'ImageInfoSpecificVmdk',
1ad166b6
BC
123 'data': {
124 'create-type': 'str',
125 'cid': 'int',
126 'parent-cid': 'int',
456e7517
HR
127 'extents': ['VmdkExtentInfo']
128 } }
129
130##
131# @VmdkExtentInfo:
132#
133# Information about a VMDK extent file
134#
135# @filename: Name of the extent file
136#
137# @format: Extent type (e.g. FLAT or SPARSE)
138#
139# @virtual-size: Number of bytes covered by this extent
140#
141# @cluster-size: Cluster size in bytes (for non-flat extents)
142#
143# @compressed: Whether this extent contains compressed data
144#
145# Since: 8.0
146##
147{ 'struct': 'VmdkExtentInfo',
148 'data': {
149 'filename': 'str',
150 'format': 'str',
151 'virtual-size': 'int',
152 '*cluster-size': 'int',
153 '*compressed': 'bool'
1ad166b6
BC
154 } }
155
42e4ac9e
OO
156##
157# @ImageInfoSpecificRbd:
158#
159# @encryption-format: Image encryption format
160#
161# Since: 6.1
162##
163{ 'struct': 'ImageInfoSpecificRbd',
164 'data': {
165 '*encryption-format': 'RbdImageEncryptionFormat'
166 } }
167
7f36a50a
HR
168##
169# @ImageInfoSpecificFile:
170#
171# @extent-size-hint: Extent size hint (if available)
172#
173# Since: 8.0
174##
175{ 'struct': 'ImageInfoSpecificFile',
176 'data': {
177 '*extent-size-hint': 'size'
178 } }
179
0db4f503
MA
180##
181# @ImageInfoSpecificKind:
182#
183# @luks: Since 2.7
184# @rbd: Since 6.1
7f36a50a 185# @file: Since 8.0
0db4f503
MA
186#
187# Since: 1.7
188##
189{ 'enum': 'ImageInfoSpecificKind',
7f36a50a 190 'data': [ 'qcow2', 'vmdk', 'luks', 'rbd', 'file' ] }
0db4f503
MA
191
192##
193# @ImageInfoSpecificQCow2Wrapper:
194#
195# Since: 1.7
196##
197{ 'struct': 'ImageInfoSpecificQCow2Wrapper',
198 'data': { 'data': 'ImageInfoSpecificQCow2' } }
199
200##
201# @ImageInfoSpecificVmdkWrapper:
202#
203# Since: 6.1
204##
205{ 'struct': 'ImageInfoSpecificVmdkWrapper',
206 'data': { 'data': 'ImageInfoSpecificVmdk' } }
207
208##
209# @ImageInfoSpecificLUKSWrapper:
210#
211# Since: 2.7
212##
213{ 'struct': 'ImageInfoSpecificLUKSWrapper',
214 'data': { 'data': 'QCryptoBlockInfoLUKS' } }
215# If we need to add block driver specific parameters for
216# LUKS in future, then we'll subclass QCryptoBlockInfoLUKS
217# to define a ImageInfoSpecificLUKS
218
219##
220# @ImageInfoSpecificRbdWrapper:
221#
222# Since: 6.1
223##
224{ 'struct': 'ImageInfoSpecificRbdWrapper',
225 'data': { 'data': 'ImageInfoSpecificRbd' } }
226
7f36a50a
HR
227##
228# @ImageInfoSpecificFileWrapper:
229#
230# Since: 8.0
231##
232{ 'struct': 'ImageInfoSpecificFileWrapper',
233 'data': { 'data': 'ImageInfoSpecificFile' } }
234
1ad166b6
BC
235##
236# @ImageInfoSpecific:
237#
238# A discriminated record of image format specific information structures.
239#
240# Since: 1.7
241##
1ad166b6 242{ 'union': 'ImageInfoSpecific',
0db4f503
MA
243 'base': { 'type': 'ImageInfoSpecificKind' },
244 'discriminator': 'type',
1ad166b6 245 'data': {
0db4f503
MA
246 'qcow2': 'ImageInfoSpecificQCow2Wrapper',
247 'vmdk': 'ImageInfoSpecificVmdkWrapper',
248 'luks': 'ImageInfoSpecificLUKSWrapper',
7f36a50a
HR
249 'rbd': 'ImageInfoSpecificRbdWrapper',
250 'file': 'ImageInfoSpecificFileWrapper'
1ad166b6
BC
251 } }
252
253##
a2085f89 254# @BlockNodeInfo:
1ad166b6
BC
255#
256# Information about a QEMU image file
257#
258# @filename: name of the image file
259#
260# @format: format of the image file
261#
262# @virtual-size: maximum capacity in bytes of the image
263#
1d8bda12 264# @actual-size: actual size on disk in bytes of the image
1ad166b6 265#
1d8bda12 266# @dirty-flag: true if image is not cleanly closed
1ad166b6 267#
1d8bda12 268# @cluster-size: size of a cluster in bytes
1ad166b6 269#
1d8bda12 270# @encrypted: true if the image is encrypted
1ad166b6 271#
1d8bda12 272# @compressed: true if the image is compressed (Since 1.7)
1ad166b6 273#
1d8bda12 274# @backing-filename: name of the backing file
1ad166b6 275#
1d8bda12 276# @full-backing-filename: full path of the backing file
1ad166b6 277#
1d8bda12 278# @backing-filename-format: the format of the backing file
1ad166b6 279#
1d8bda12 280# @snapshots: list of VM snapshots
1ad166b6 281#
1d8bda12 282# @format-specific: structure supplying additional format-specific
26ec4e53 283# information (since 1.7)
1ad166b6 284#
a2085f89 285# Since: 8.0
1ad166b6 286##
a2085f89 287{ 'struct': 'BlockNodeInfo',
1ad166b6
BC
288 'data': {'filename': 'str', 'format': 'str', '*dirty-flag': 'bool',
289 '*actual-size': 'int', 'virtual-size': 'int',
290 '*cluster-size': 'int', '*encrypted': 'bool', '*compressed': 'bool',
291 '*backing-filename': 'str', '*full-backing-filename': 'str',
292 '*backing-filename-format': 'str', '*snapshots': ['SnapshotInfo'],
24bf10da 293 '*format-specific': 'ImageInfoSpecific' } }
1ad166b6 294
a2085f89
HR
295##
296# @ImageInfo:
297#
298# Information about a QEMU image file, and potentially its backing image
299#
300# @backing-image: info of the backing image
301#
302# Since: 1.3
303##
304{ 'struct': 'ImageInfo',
305 'base': 'BlockNodeInfo',
306 'data': {
307 '*backing-image': 'ImageInfo'
308 } }
309
6cab3399
HR
310##
311# @BlockChildInfo:
312#
313# Information about all nodes in the block graph starting at some node,
314# annotated with information about that node in relation to its parent.
315#
316# @name: Child name of the root node in the BlockGraphInfo struct, in its role
317# as the child of some undescribed parent node
318#
319# @info: Block graph information starting at this node
320#
321# Since: 8.0
322##
323{ 'struct': 'BlockChildInfo',
324 'data': {
325 'name': 'str',
326 'info': 'BlockGraphInfo'
327 } }
328
329##
330# @BlockGraphInfo:
331#
332# Information about all nodes in a block (sub)graph in the form of BlockNodeInfo
333# data.
334# The base BlockNodeInfo struct contains the information for the (sub)graph's
335# root node.
336#
337# @children: Array of links to this node's child nodes' information
338#
339# Since: 8.0
340##
341{ 'struct': 'BlockGraphInfo',
342 'base': 'BlockNodeInfo',
343 'data': { 'children': ['BlockChildInfo'] } }
344
1ad166b6
BC
345##
346# @ImageCheck:
347#
348# Information about a QEMU image file check
349#
350# @filename: name of the image file checked
351#
352# @format: format of the image file checked
353#
354# @check-errors: number of unexpected errors occurred during check
355#
1d8bda12 356# @image-end-offset: offset (in bytes) where the image ends, this
1ad166b6
BC
357# field is present if the driver for the image format
358# supports it
359#
1d8bda12 360# @corruptions: number of corruptions found during the check if any
1ad166b6 361#
1d8bda12 362# @leaks: number of leaks found during the check if any
1ad166b6 363#
1d8bda12 364# @corruptions-fixed: number of corruptions fixed during the check
1ad166b6
BC
365# if any
366#
1d8bda12 367# @leaks-fixed: number of leaks fixed during the check if any
1ad166b6 368#
1d8bda12 369# @total-clusters: total number of clusters, this field is present
1ad166b6
BC
370# if the driver for the image format supports it
371#
1d8bda12 372# @allocated-clusters: total number of allocated clusters, this
1ad166b6
BC
373# field is present if the driver for the image format
374# supports it
375#
1d8bda12 376# @fragmented-clusters: total number of fragmented clusters, this
1ad166b6
BC
377# field is present if the driver for the image format
378# supports it
379#
1d8bda12 380# @compressed-clusters: total number of compressed clusters, this
1ad166b6
BC
381# field is present if the driver for the image format
382# supports it
383#
384# Since: 1.4
1ad166b6 385##
895a2a80 386{ 'struct': 'ImageCheck',
1ad166b6
BC
387 'data': {'filename': 'str', 'format': 'str', 'check-errors': 'int',
388 '*image-end-offset': 'int', '*corruptions': 'int', '*leaks': 'int',
389 '*corruptions-fixed': 'int', '*leaks-fixed': 'int',
390 '*total-clusters': 'int', '*allocated-clusters': 'int',
391 '*fragmented-clusters': 'int', '*compressed-clusters': 'int' } }
392
16b0d555
FZ
393##
394# @MapEntry:
395#
396# Mapping information from a virtual block range to a host file range
397#
ffb515fa
HR
398# @start: virtual (guest) offset of the first byte described by this
399# entry
16b0d555
FZ
400#
401# @length: the number of bytes of the mapped virtual range
402#
ffb515fa
HR
403# @data: reading the image will actually read data from a file (in
404# particular, if @offset is present this means that the sectors
405# are not simply preallocated, but contain actual data in raw
406# format)
16b0d555 407#
ffb515fa 408# @zero: whether the virtual blocks read as zeroes
16b0d555 409#
ffb515fa
HR
410# @depth: number of layers (0 = top image, 1 = top image's backing
411# file, ..., n - 1 = bottom image (where n is the number of
412# images in the chain)) before reaching one for which the
413# range is allocated
16b0d555 414#
8417e137
EB
415# @present: true if this layer provides the data, false if adding a backing
416# layer could impact this region (since 6.1)
417#
ffb515fa
HR
418# @offset: if present, the image file stores the data for this range
419# in raw format at the given (host) offset
16b0d555 420#
1d8bda12 421# @filename: filename that is referred to by @offset
16b0d555
FZ
422#
423# Since: 2.6
16b0d555
FZ
424##
425{ 'struct': 'MapEntry',
426 'data': {'start': 'int', 'length': 'int', 'data': 'bool',
8417e137
EB
427 'zero': 'bool', 'depth': 'int', 'present': 'bool',
428 '*offset': 'int', '*filename': 'str' } }
16b0d555 429
9e193c5a 430##
5072f7b3 431# @BlockdevCacheInfo:
9e193c5a
KW
432#
433# Cache mode information for a block device
434#
c0ac533b
AB
435# @writeback: true if writeback mode is enabled
436# @direct: true if the host page cache is bypassed (O_DIRECT)
437# @no-flush: true if flush requests are ignored for the device
9e193c5a
KW
438#
439# Since: 2.3
440##
895a2a80 441{ 'struct': 'BlockdevCacheInfo',
9e193c5a
KW
442 'data': { 'writeback': 'bool',
443 'direct': 'bool',
444 'no-flush': 'bool' } }
445
1ad166b6
BC
446##
447# @BlockDeviceInfo:
448#
449# Information about the backing device for a block device.
450#
451# @file: the filename of the backing device
452#
1d8bda12 453# @node-name: the name of the block driver node (Since 2.0)
1ad166b6
BC
454#
455# @ro: true if the backing device was open read-only
456#
457# @drv: the name of the block format used to open the backing device. As of
9bc6e893 458# 0.14 this can be: 'blkdebug', 'bochs', 'cloop', 'cow', 'dmg',
1ad166b6 459# 'file', 'file', 'ftp', 'ftps', 'host_cdrom', 'host_device',
78368575 460# 'http', 'https', 'luks', 'nbd', 'parallels', 'qcow',
23dce387 461# 'qcow2', 'raw', 'vdi', 'vmdk', 'vpc', 'vvfat'
550830f9 462# 2.2: 'archipelago' added, 'cow' dropped
92a539d2 463# 2.3: 'host_floppy' deprecated
f709623b 464# 2.5: 'host_floppy' dropped
78368575 465# 2.6: 'luks' added
23dce387 466# 2.8: 'replication' added, 'tftp' dropped
e32ccbc6 467# 2.9: 'archipelago' dropped
1ad166b6 468#
1d8bda12 469# @backing_file: the name of the backing file (for copy-on-write)
1ad166b6
BC
470#
471# @backing_file_depth: number of files in the backing file chain (since: 1.2)
472#
473# @encrypted: true if the backing device is encrypted
474#
1ad166b6
BC
475# @detect_zeroes: detect and optimize zero writes (Since 2.1)
476#
477# @bps: total throughput limit in bytes per second is specified
478#
479# @bps_rd: read throughput limit in bytes per second is specified
480#
481# @bps_wr: write throughput limit in bytes per second is specified
482#
483# @iops: total I/O operations per second is specified
484#
485# @iops_rd: read I/O operations per second is specified
486#
487# @iops_wr: write I/O operations per second is specified
488#
489# @image: the info of image used (since: 1.6)
490#
1d8bda12 491# @bps_max: total throughput limit during bursts,
398befdf 492# in bytes (Since 1.7)
1ad166b6 493#
1d8bda12 494# @bps_rd_max: read throughput limit during bursts,
398befdf 495# in bytes (Since 1.7)
1ad166b6 496#
1d8bda12 497# @bps_wr_max: write throughput limit during bursts,
398befdf 498# in bytes (Since 1.7)
1ad166b6 499#
1d8bda12 500# @iops_max: total I/O operations per second during bursts,
398befdf 501# in bytes (Since 1.7)
1ad166b6 502#
1d8bda12 503# @iops_rd_max: read I/O operations per second during bursts,
398befdf 504# in bytes (Since 1.7)
1ad166b6 505#
1d8bda12 506# @iops_wr_max: write I/O operations per second during bursts,
398befdf
AG
507# in bytes (Since 1.7)
508#
1d8bda12 509# @bps_max_length: maximum length of the @bps_max burst
398befdf
AG
510# period, in seconds. (Since 2.6)
511#
1d8bda12 512# @bps_rd_max_length: maximum length of the @bps_rd_max
398befdf
AG
513# burst period, in seconds. (Since 2.6)
514#
1d8bda12 515# @bps_wr_max_length: maximum length of the @bps_wr_max
398befdf
AG
516# burst period, in seconds. (Since 2.6)
517#
1d8bda12 518# @iops_max_length: maximum length of the @iops burst
398befdf
AG
519# period, in seconds. (Since 2.6)
520#
1d8bda12 521# @iops_rd_max_length: maximum length of the @iops_rd_max
398befdf
AG
522# burst period, in seconds. (Since 2.6)
523#
1d8bda12 524# @iops_wr_max_length: maximum length of the @iops_wr_max
398befdf 525# burst period, in seconds. (Since 2.6)
1ad166b6 526#
1d8bda12 527# @iops_size: an I/O size in bytes (Since 1.7)
1ad166b6 528#
1d8bda12 529# @group: throttle group name (Since 2.4)
b8fe1694 530#
9e193c5a
KW
531# @cache: the cache mode used for the block device (since: 2.3)
532#
e2462113
FR
533# @write_threshold: configured write threshold for the device.
534# 0 if disabled. (Since 2.3)
535#
590a63d5
VSO
536# @dirty-bitmaps: dirty bitmaps information (only present if node
537# has one or more dirty bitmaps) (Since 4.2)
538#
9bc6e893 539# Since: 0.14
1ad166b6 540##
895a2a80 541{ 'struct': 'BlockDeviceInfo',
1ad166b6
BC
542 'data': { 'file': 'str', '*node-name': 'str', 'ro': 'bool', 'drv': 'str',
543 '*backing_file': 'str', 'backing_file_depth': 'int',
df4097ae 544 'encrypted': 'bool',
1ad166b6
BC
545 'detect_zeroes': 'BlockdevDetectZeroesOptions',
546 'bps': 'int', 'bps_rd': 'int', 'bps_wr': 'int',
547 'iops': 'int', 'iops_rd': 'int', 'iops_wr': 'int',
548 'image': 'ImageInfo',
549 '*bps_max': 'int', '*bps_rd_max': 'int',
550 '*bps_wr_max': 'int', '*iops_max': 'int',
551 '*iops_rd_max': 'int', '*iops_wr_max': 'int',
398befdf
AG
552 '*bps_max_length': 'int', '*bps_rd_max_length': 'int',
553 '*bps_wr_max_length': 'int', '*iops_max_length': 'int',
554 '*iops_rd_max_length': 'int', '*iops_wr_max_length': 'int',
b8fe1694 555 '*iops_size': 'int', '*group': 'str', 'cache': 'BlockdevCacheInfo',
590a63d5 556 'write_threshold': 'int', '*dirty-bitmaps': ['BlockDirtyInfo'] } }
1ad166b6
BC
557
558##
559# @BlockDeviceIoStatus:
560#
561# An enumeration of block device I/O status.
562#
563# @ok: The last I/O operation has succeeded
564#
565# @failed: The last I/O operation has failed
566#
567# @nospace: The last I/O operation has failed due to a no-space condition
568#
569# Since: 1.0
570##
571{ 'enum': 'BlockDeviceIoStatus', 'data': [ 'ok', 'failed', 'nospace' ] }
572
1ad166b6
BC
573##
574# @BlockDirtyInfo:
575#
576# Block dirty bitmap information.
577#
1d8bda12 578# @name: the name of the dirty bitmap (Since 2.4)
0db6e54a 579#
1ad166b6
BC
580# @count: number of dirty bytes according to the dirty bitmap
581#
582# @granularity: granularity of the dirty bitmap in bytes (since 1.4)
583#
4db6ceb0 584# @recording: true if the bitmap is recording new writes from the guest.
450e0f28 585# Replaces ``active`` and ``disabled`` statuses. (since 4.0)
4db6ceb0
JS
586#
587# @busy: true if the bitmap is in-use by some operation (NBD or jobs)
588# and cannot be modified via QMP or used by another operation.
450e0f28 589# Replaces ``locked`` and ``frozen`` statuses. (since 4.0)
a113534f 590#
b0f45559
JS
591# @persistent: true if the bitmap was stored on disk, is scheduled to be stored
592# on disk, or both. (since 4.0)
a113534f 593#
b0f45559
JS
594# @inconsistent: true if this is a persistent bitmap that was improperly
595# stored. Implies @persistent to be true; @recording and
596# @busy to be false. This bitmap cannot be used. To remove
597# it, use @block-dirty-bitmap-remove. (Since 4.0)
f67cf661 598#
1ad166b6
BC
599# Since: 1.3
600##
895a2a80 601{ 'struct': 'BlockDirtyInfo',
a113534f 602 'data': {'*name': 'str', 'count': 'int', 'granularity': 'uint32',
df4097ae 603 'recording': 'bool', 'busy': 'bool',
b0f45559 604 'persistent': 'bool', '*inconsistent': 'bool' } }
1ad166b6 605
b8968c87
AS
606##
607# @Qcow2BitmapInfoFlags:
608#
609# An enumeration of flags that a bitmap can report to the user.
610#
611# @in-use: This flag is set by any process actively modifying the qcow2 file,
612# and cleared when the updated bitmap is flushed to the qcow2 image.
613# The presence of this flag in an offline image means that the bitmap
614# was not saved correctly after its last usage, and may contain
615# inconsistent data.
616#
617# @auto: The bitmap must reflect all changes of the virtual disk by any
618# application that would write to this qcow2 file.
619#
620# Since: 4.0
621##
622{ 'enum': 'Qcow2BitmapInfoFlags',
623 'data': ['in-use', 'auto'] }
624
625##
626# @Qcow2BitmapInfo:
627#
628# Qcow2 bitmap information.
629#
630# @name: the name of the bitmap
631#
632# @granularity: granularity of the bitmap in bytes
633#
634# @flags: flags of the bitmap
635#
636# Since: 4.0
637##
638{ 'struct': 'Qcow2BitmapInfo',
639 'data': {'name': 'str', 'granularity': 'uint32',
640 'flags': ['Qcow2BitmapInfoFlags'] } }
641
7e5c776d
VSO
642##
643# @BlockLatencyHistogramInfo:
644#
645# Block latency histogram.
646#
647# @boundaries: list of interval boundary values in nanoseconds, all greater
648# than zero and in ascending order.
649# For example, the list [10, 50, 100] produces the following
650# histogram intervals: [0, 10), [10, 50), [50, 100), [100, +inf).
651#
652# @bins: list of io request counts corresponding to histogram intervals.
653# len(@bins) = len(@boundaries) + 1
654# For the example above, @bins may be something like [3, 1, 5, 2],
655# and corresponding histogram looks like:
656#
a0fcff38
PM
657# ::
658#
659# 5| *
660# 4| *
661# 3| * *
662# 2| * * *
663# 1| * * * *
664# +------------------
665# 10 50 100
7e5c776d 666#
cb8aac37 667# Since: 4.0
7e5c776d
VSO
668##
669{ 'struct': 'BlockLatencyHistogramInfo',
670 'data': {'boundaries': ['uint64'], 'bins': ['uint64'] } }
671
1ad166b6
BC
672##
673# @BlockInfo:
674#
675# Block device information. This structure describes a virtual device and
676# the backing device associated with it.
677#
678# @device: The device name associated with the virtual device.
679#
46eade7b
KW
680# @qdev: The qdev ID, or if no ID is assigned, the QOM path of the block
681# device. (since 2.10)
682#
1ad166b6
BC
683# @type: This field is returned only for compatibility reasons, it should
684# not be used (always returns 'unknown')
685#
686# @removable: True if the device supports removable media.
687#
688# @locked: True if the guest has locked this device from having its media
689# removed
690#
1d8bda12 691# @tray_open: True if the device's tray is open
327032ce 692# (only present if it has a tray)
1ad166b6 693#
1d8bda12 694# @io-status: @BlockDeviceIoStatus. Only present if the device
1ad166b6 695# supports it and the VM is configured to stop on errors
f6f55aff
MA
696# (supported device models: virtio-blk, IDE, SCSI except
697# scsi-generic)
1ad166b6 698#
1d8bda12 699# @inserted: @BlockDeviceInfo describing the device if media is
1ad166b6
BC
700# present
701#
23e46452 702# Since: 0.14
1ad166b6 703##
895a2a80 704{ 'struct': 'BlockInfo',
46eade7b 705 'data': {'device': 'str', '*qdev': 'str', 'type': 'str', 'removable': 'bool',
1ad166b6 706 'locked': 'bool', '*inserted': 'BlockDeviceInfo',
e67d8e29 707 '*tray_open': 'bool', '*io-status': 'BlockDeviceIoStatus' } }
1ad166b6 708
90880ff1
SH
709##
710# @BlockMeasureInfo:
711#
712# Image file size calculation information. This structure describes the size
713# requirements for creating a new image file.
714#
715# The size requirements depend on the new image file format. File size always
716# equals virtual disk size for the 'raw' format, even for sparse POSIX files.
717# Compact formats such as 'qcow2' represent unallocated and zero regions
718# efficiently so file size may be smaller than virtual disk size.
719#
720# The values are upper bounds that are guaranteed to fit the new image file.
5d72c68b
EB
721# Subsequent modification, such as internal snapshot or further bitmap
722# creation, may require additional space and is not covered here.
90880ff1 723#
5d72c68b
EB
724# @required: Size required for a new image file, in bytes, when copying just
725# allocated guest-visible contents.
90880ff1
SH
726#
727# @fully-allocated: Image file size, in bytes, once data has been written
5d72c68b
EB
728# to all sectors, when copying just guest-visible contents.
729#
730# @bitmaps: Additional size required if all the top-level bitmap metadata
731# in the source image were to be copied to the destination,
732# present only when source and destination both support
733# persistent bitmaps. (since 5.1)
90880ff1
SH
734#
735# Since: 2.10
736##
737{ 'struct': 'BlockMeasureInfo',
5d72c68b 738 'data': {'required': 'int', 'fully-allocated': 'int', '*bitmaps': 'int'} }
90880ff1 739
1ad166b6
BC
740##
741# @query-block:
742#
743# Get a list of BlockInfo for all virtual block devices.
744#
d3c8c674 745# Returns: a list of @BlockInfo describing each virtual block device. Filter
26ec4e53 746# nodes that were created implicitly are skipped over.
1ad166b6 747#
9bc6e893 748# Since: 0.14
978cceab
MAL
749#
750# Example:
751#
752# -> { "execute": "query-block" }
753# <- {
754# "return":[
755# {
756# "io-status": "ok",
757# "device":"ide0-hd0",
758# "locked":false,
759# "removable":false,
760# "inserted":{
761# "ro":false,
762# "drv":"qcow2",
763# "encrypted":false,
764# "file":"disks/test.qcow2",
765# "backing_file_depth":1,
766# "bps":1000000,
767# "bps_rd":0,
768# "bps_wr":0,
769# "iops":1000000,
770# "iops_rd":0,
771# "iops_wr":0,
772# "bps_max": 8000000,
773# "bps_rd_max": 0,
774# "bps_wr_max": 0,
775# "iops_max": 0,
776# "iops_rd_max": 0,
777# "iops_wr_max": 0,
778# "iops_size": 0,
779# "detect_zeroes": "on",
780# "write_threshold": 0,
781# "image":{
782# "filename":"disks/test.qcow2",
783# "format":"qcow2",
784# "virtual-size":2048000,
785# "backing_file":"base.qcow2",
786# "full-backing-filename":"disks/base.qcow2",
787# "backing-filename-format":"qcow2",
788# "snapshots":[
789# {
790# "id": "1",
791# "name": "snapshot1",
792# "vm-state-size": 0,
793# "date-sec": 10000200,
794# "date-nsec": 12,
795# "vm-clock-sec": 206,
796# "vm-clock-nsec": 30
797# }
798# ],
799# "backing-image":{
800# "filename":"disks/base.qcow2",
801# "format":"qcow2",
802# "virtual-size":2048000
803# }
804# }
805# },
46eade7b 806# "qdev": "ide_disk",
978cceab
MAL
807# "type":"unknown"
808# },
809# {
810# "io-status": "ok",
811# "device":"ide1-cd0",
812# "locked":false,
813# "removable":true,
46eade7b
KW
814# "qdev": "/machine/unattached/device[23]",
815# "tray_open": false,
978cceab
MAL
816# "type":"unknown"
817# },
818# {
819# "device":"floppy0",
820# "locked":false,
821# "removable":true,
46eade7b 822# "qdev": "/machine/unattached/device[20]",
978cceab
MAL
823# "type":"unknown"
824# },
825# {
826# "device":"sd0",
827# "locked":false,
828# "removable":true,
829# "type":"unknown"
830# }
831# ]
832# }
833#
1ad166b6 834##
f55ba801
PB
835{ 'command': 'query-block', 'returns': ['BlockInfo'],
836 'allow-preconfig': true }
1ad166b6 837
979e9b03
AG
838##
839# @BlockDeviceTimedStats:
840#
841# Statistics of a block device during a given interval of time.
842#
843# @interval_length: Interval used for calculating the statistics,
844# in seconds.
845#
846# @min_rd_latency_ns: Minimum latency of read operations in the
847# defined interval, in nanoseconds.
848#
849# @min_wr_latency_ns: Minimum latency of write operations in the
850# defined interval, in nanoseconds.
851#
852# @min_flush_latency_ns: Minimum latency of flush operations in the
853# defined interval, in nanoseconds.
854#
855# @max_rd_latency_ns: Maximum latency of read operations in the
856# defined interval, in nanoseconds.
857#
858# @max_wr_latency_ns: Maximum latency of write operations in the
859# defined interval, in nanoseconds.
860#
861# @max_flush_latency_ns: Maximum latency of flush operations in the
862# defined interval, in nanoseconds.
863#
864# @avg_rd_latency_ns: Average latency of read operations in the
865# defined interval, in nanoseconds.
866#
867# @avg_wr_latency_ns: Average latency of write operations in the
868# defined interval, in nanoseconds.
869#
870# @avg_flush_latency_ns: Average latency of flush operations in the
871# defined interval, in nanoseconds.
872#
96e4deda
AG
873# @avg_rd_queue_depth: Average number of pending read operations
874# in the defined interval.
875#
876# @avg_wr_queue_depth: Average number of pending write operations
877# in the defined interval.
878#
979e9b03
AG
879# Since: 2.5
880##
979e9b03
AG
881{ 'struct': 'BlockDeviceTimedStats',
882 'data': { 'interval_length': 'int', 'min_rd_latency_ns': 'int',
883 'max_rd_latency_ns': 'int', 'avg_rd_latency_ns': 'int',
884 'min_wr_latency_ns': 'int', 'max_wr_latency_ns': 'int',
885 'avg_wr_latency_ns': 'int', 'min_flush_latency_ns': 'int',
96e4deda
AG
886 'max_flush_latency_ns': 'int', 'avg_flush_latency_ns': 'int',
887 'avg_rd_queue_depth': 'number', 'avg_wr_queue_depth': 'number' } }
979e9b03 888
1ad166b6
BC
889##
890# @BlockDeviceStats:
891#
892# Statistics of a virtual block device or a block backing device.
893#
23e46452 894# @rd_bytes: The number of bytes read by the device.
1ad166b6 895#
23e46452 896# @wr_bytes: The number of bytes written by the device.
1ad166b6 897#
159f85dd
AN
898# @unmap_bytes: The number of bytes unmapped by the device (Since 4.2)
899#
1ad166b6
BC
900# @rd_operations: The number of read operations performed by the device.
901#
902# @wr_operations: The number of write operations performed by the device.
903#
904# @flush_operations: The number of cache flush operations performed by the
9bc6e893 905# device (since 0.15)
1ad166b6 906#
159f85dd
AN
907# @unmap_operations: The number of unmap operations performed by the device
908# (Since 4.2)
909#
9bc6e893 910# @rd_total_time_ns: Total time spent on reads in nanoseconds (since 0.15).
1ad166b6 911#
9bc6e893 912# @wr_total_time_ns: Total time spent on writes in nanoseconds (since 0.15).
1ad166b6 913#
329d27e3 914# @flush_total_time_ns: Total time spent on cache flushes in nanoseconds
9bc6e893 915# (since 0.15).
1ad166b6 916#
159f85dd
AN
917# @unmap_total_time_ns: Total time spent on unmap operations in nanoseconds
918# (Since 4.2)
919#
1ad166b6
BC
920# @wr_highest_offset: The offset after the greatest byte written to the
921# device. The intended use of this information is for
922# growable sparse files (like qcow2) that are used on top
923# of a physical device.
924#
f4564d53
PL
925# @rd_merged: Number of read requests that have been merged into another
926# request (Since 2.3).
927#
928# @wr_merged: Number of write requests that have been merged into another
929# request (Since 2.3).
930#
159f85dd
AN
931# @unmap_merged: Number of unmap requests that have been merged into another
932# request (Since 4.2)
933#
1d8bda12 934# @idle_time_ns: Time since the last I/O operation, in
cb38fffb
AG
935# nanoseconds. If the field is absent it means that
936# there haven't been any operations yet (Since 2.5).
937#
7ee12daf
AG
938# @failed_rd_operations: The number of failed read operations
939# performed by the device (Since 2.5)
940#
941# @failed_wr_operations: The number of failed write operations
942# performed by the device (Since 2.5)
943#
944# @failed_flush_operations: The number of failed flush operations
945# performed by the device (Since 2.5)
946#
159f85dd
AN
947# @failed_unmap_operations: The number of failed unmap operations performed
948# by the device (Since 4.2)
949#
7ee12daf
AG
950# @invalid_rd_operations: The number of invalid read operations
951# performed by the device (Since 2.5)
952#
953# @invalid_wr_operations: The number of invalid write operations
954# performed by the device (Since 2.5)
955#
956# @invalid_flush_operations: The number of invalid flush operations
957# performed by the device (Since 2.5)
958#
159f85dd
AN
959# @invalid_unmap_operations: The number of invalid unmap operations performed
960# by the device (Since 4.2)
961#
362e9299
AG
962# @account_invalid: Whether invalid operations are included in the
963# last access statistics (Since 2.5)
964#
965# @account_failed: Whether failed operations are included in the
966# latency and last access statistics (Since 2.5)
967#
979e9b03
AG
968# @timed_stats: Statistics specific to the set of previously defined
969# intervals of time (Since 2.5)
970#
cb8aac37 971# @rd_latency_histogram: @BlockLatencyHistogramInfo. (Since 4.0)
7e5c776d 972#
cb8aac37 973# @wr_latency_histogram: @BlockLatencyHistogramInfo. (Since 4.0)
7e5c776d 974#
cb8aac37 975# @flush_latency_histogram: @BlockLatencyHistogramInfo. (Since 4.0)
7e5c776d 976#
9bc6e893 977# Since: 0.14
1ad166b6 978##
895a2a80 979{ 'struct': 'BlockDeviceStats',
159f85dd 980 'data': {'rd_bytes': 'int', 'wr_bytes': 'int', 'unmap_bytes' : 'int',
329d27e3 981 'rd_operations': 'int', 'wr_operations': 'int',
159f85dd 982 'flush_operations': 'int', 'unmap_operations': 'int',
329d27e3 983 'rd_total_time_ns': 'int', 'wr_total_time_ns': 'int',
159f85dd 984 'flush_total_time_ns': 'int', 'unmap_total_time_ns': 'int',
329d27e3 985 'wr_highest_offset': 'int',
159f85dd 986 'rd_merged': 'int', 'wr_merged': 'int', 'unmap_merged': 'int',
329d27e3 987 '*idle_time_ns': 'int',
7ee12daf 988 'failed_rd_operations': 'int', 'failed_wr_operations': 'int',
159f85dd 989 'failed_flush_operations': 'int', 'failed_unmap_operations': 'int',
329d27e3 990 'invalid_rd_operations': 'int', 'invalid_wr_operations': 'int',
159f85dd 991 'invalid_flush_operations': 'int', 'invalid_unmap_operations': 'int',
979e9b03 992 'account_invalid': 'bool', 'account_failed': 'bool',
7e5c776d 993 'timed_stats': ['BlockDeviceTimedStats'],
cb8aac37
VSO
994 '*rd_latency_histogram': 'BlockLatencyHistogramInfo',
995 '*wr_latency_histogram': 'BlockLatencyHistogramInfo',
996 '*flush_latency_histogram': 'BlockLatencyHistogramInfo' } }
1ad166b6 997
d9245599
AN
998##
999# @BlockStatsSpecificFile:
1000#
1001# File driver statistics
1002#
1003# @discard-nb-ok: The number of successful discard operations performed by
1004# the driver.
1005#
1006# @discard-nb-failed: The number of failed discard operations performed by
1007# the driver.
1008#
1009# @discard-bytes-ok: The number of bytes discarded by the driver.
1010#
1011# Since: 4.2
1012##
1013{ 'struct': 'BlockStatsSpecificFile',
1014 'data': {
1015 'discard-nb-ok': 'uint64',
1016 'discard-nb-failed': 'uint64',
1017 'discard-bytes-ok': 'uint64' } }
1018
f25e7ab2
PMD
1019##
1020# @BlockStatsSpecificNvme:
1021#
1022# NVMe driver statistics
1023#
1024# @completion-errors: The number of completion errors.
1025#
1026# @aligned-accesses: The number of aligned accesses performed by
1027# the driver.
1028#
1029# @unaligned-accesses: The number of unaligned accesses performed by
1030# the driver.
1031#
1032# Since: 5.2
1033##
1034{ 'struct': 'BlockStatsSpecificNvme',
1035 'data': {
1036 'completion-errors': 'uint64',
1037 'aligned-accesses': 'uint64',
1038 'unaligned-accesses': 'uint64' } }
1039
d9245599
AN
1040##
1041# @BlockStatsSpecific:
1042#
1043# Block driver specific statistics
1044#
1045# Since: 4.2
1046##
1047{ 'union': 'BlockStatsSpecific',
1048 'base': { 'driver': 'BlockdevDriver' },
1049 'discriminator': 'driver',
1050 'data': {
1051 'file': 'BlockStatsSpecificFile',
14176c8d 1052 'host_device': { 'type': 'BlockStatsSpecificFile',
8a9f1e1d 1053 'if': 'HAVE_HOST_BLOCK_DEVICE' },
f25e7ab2 1054 'nvme': 'BlockStatsSpecificNvme' } }
d9245599 1055
1ad166b6
BC
1056##
1057# @BlockStats:
1058#
1059# Statistics of a virtual block device or a block backing device.
1060#
1d8bda12 1061# @device: If the stats are for a virtual block device, the name
1ad166b6
BC
1062# corresponding to the virtual block device.
1063#
1d8bda12 1064# @node-name: The node name of the device. (Since 2.3)
4875a779 1065#
5a9cb5a9
KW
1066# @qdev: The qdev ID, or if no ID is assigned, the QOM path of the block
1067# device. (since 3.0)
1068#
23e46452 1069# @stats: A @BlockDeviceStats for the device.
1ad166b6 1070#
d9245599
AN
1071# @driver-specific: Optional driver-specific stats. (Since 4.2)
1072#
1d8bda12 1073# @parent: This describes the file block device if it has one.
f2eaea18
MAL
1074# Contains recursively the statistics of the underlying
1075# protocol (e.g. the host file for a qcow2 image). If there is
1076# no underlying protocol, this field is omitted
1ad166b6 1077#
1d8bda12 1078# @backing: This describes the backing block device if it has one.
1ad166b6
BC
1079# (Since 2.0)
1080#
9bc6e893 1081# Since: 0.14
1ad166b6 1082##
895a2a80 1083{ 'struct': 'BlockStats',
5a9cb5a9 1084 'data': {'*device': 'str', '*qdev': 'str', '*node-name': 'str',
4875a779 1085 'stats': 'BlockDeviceStats',
d9245599 1086 '*driver-specific': 'BlockStatsSpecific',
1ad166b6
BC
1087 '*parent': 'BlockStats',
1088 '*backing': 'BlockStats'} }
1089
1090##
1091# @query-blockstats:
1092#
1093# Query the @BlockStats for all virtual block devices.
1094#
1d8bda12 1095# @query-nodes: If true, the command will query all the block nodes
f71eaa74
FZ
1096# that have a node name, in a list which will include "parent"
1097# information, but not "backing".
1098# If false or omitted, the behavior is as before - query all the
1099# device backends, recursively including their "parent" and
d3c8c674
KW
1100# "backing". Filter nodes that were created implicitly are
1101# skipped over in this mode. (Since 2.3)
f71eaa74 1102#
1ad166b6
BC
1103# Returns: A list of @BlockStats for each virtual block devices.
1104#
9bc6e893 1105# Since: 0.14
f2eaea18
MAL
1106#
1107# Example:
1108#
1109# -> { "execute": "query-blockstats" }
1110# <- {
1111# "return":[
1112# {
1113# "device":"ide0-hd0",
1114# "parent":{
1115# "stats":{
1116# "wr_highest_offset":3686448128,
1117# "wr_bytes":9786368,
1118# "wr_operations":751,
1119# "rd_bytes":122567168,
1120# "rd_operations":36772
1121# "wr_total_times_ns":313253456
1122# "rd_total_times_ns":3465673657
1123# "flush_total_times_ns":49653
1124# "flush_operations":61,
1125# "rd_merged":0,
1126# "wr_merged":0,
1127# "idle_time_ns":2953431879,
1128# "account_invalid":true,
1129# "account_failed":false
1130# }
1131# },
1132# "stats":{
1133# "wr_highest_offset":2821110784,
1134# "wr_bytes":9786368,
1135# "wr_operations":692,
1136# "rd_bytes":122739200,
1137# "rd_operations":36604
1138# "flush_operations":51,
1139# "wr_total_times_ns":313253456
1140# "rd_total_times_ns":3465673657
1141# "flush_total_times_ns":49653,
1142# "rd_merged":0,
1143# "wr_merged":0,
1144# "idle_time_ns":2953431879,
1145# "account_invalid":true,
1146# "account_failed":false
5a9cb5a9
KW
1147# },
1148# "qdev": "/machine/unattached/device[23]"
f2eaea18
MAL
1149# },
1150# {
1151# "device":"ide1-cd0",
1152# "stats":{
1153# "wr_highest_offset":0,
1154# "wr_bytes":0,
1155# "wr_operations":0,
1156# "rd_bytes":0,
1157# "rd_operations":0
1158# "flush_operations":0,
1159# "wr_total_times_ns":0
1160# "rd_total_times_ns":0
1161# "flush_total_times_ns":0,
1162# "rd_merged":0,
1163# "wr_merged":0,
1164# "account_invalid":false,
1165# "account_failed":false
5a9cb5a9
KW
1166# },
1167# "qdev": "/machine/unattached/device[24]"
f2eaea18
MAL
1168# },
1169# {
1170# "device":"floppy0",
1171# "stats":{
1172# "wr_highest_offset":0,
1173# "wr_bytes":0,
1174# "wr_operations":0,
1175# "rd_bytes":0,
1176# "rd_operations":0
1177# "flush_operations":0,
1178# "wr_total_times_ns":0
1179# "rd_total_times_ns":0
1180# "flush_total_times_ns":0,
1181# "rd_merged":0,
1182# "wr_merged":0,
1183# "account_invalid":false,
1184# "account_failed":false
5a9cb5a9
KW
1185# },
1186# "qdev": "/machine/unattached/device[16]"
f2eaea18
MAL
1187# },
1188# {
1189# "device":"sd0",
1190# "stats":{
1191# "wr_highest_offset":0,
1192# "wr_bytes":0,
1193# "wr_operations":0,
1194# "rd_bytes":0,
1195# "rd_operations":0
1196# "flush_operations":0,
1197# "wr_total_times_ns":0
1198# "rd_total_times_ns":0
1199# "flush_total_times_ns":0,
1200# "rd_merged":0,
1201# "wr_merged":0,
1202# "account_invalid":false,
1203# "account_failed":false
1204# }
1205# }
1206# ]
1207# }
1208#
1ad166b6 1209##
f71eaa74
FZ
1210{ 'command': 'query-blockstats',
1211 'data': { '*query-nodes': 'bool' },
f55ba801
PB
1212 'returns': ['BlockStats'],
1213 'allow-preconfig': true }
1ad166b6
BC
1214
1215##
1216# @BlockdevOnError:
1217#
1218# An enumeration of possible behaviors for errors on I/O operations.
1219# The exact meaning depends on whether the I/O was initiated by a guest
1220# or by a block job
1221#
1222# @report: for guest operations, report the error to the guest;
1223# for jobs, cancel the job
1224#
1225# @ignore: ignore the error, only report a QMP event (BLOCK_IO_ERROR
248e3ffb
KW
1226# or BLOCK_JOB_ERROR). The backup, mirror and commit block jobs retry
1227# the failing request later and may still complete successfully. The
1228# stream block job continues to stream and will complete with an
1229# error.
1ad166b6
BC
1230#
1231# @enospc: same as @stop on ENOSPC, same as @report otherwise.
1232#
1233# @stop: for guest operations, stop the virtual machine;
1234# for jobs, pause the job
1235#
8c398252
KW
1236# @auto: inherit the error handling policy of the backend (since: 2.7)
1237#
1ad166b6
BC
1238# Since: 1.3
1239##
1240{ 'enum': 'BlockdevOnError',
8c398252 1241 'data': ['report', 'ignore', 'enospc', 'stop', 'auto'] }
1ad166b6
BC
1242
1243##
1244# @MirrorSyncMode:
1245#
1246# An enumeration of possible behaviors for the initial synchronization
1247# phase of storage mirroring.
1248#
1249# @top: copies data in the topmost image to the destination
1250#
1251# @full: copies data from all images to the destination
1252#
1253# @none: only copy data written from now on
1254#
c8b56501
JS
1255# @incremental: only copy data described by the dirty bitmap. (since: 2.4)
1256#
1257# @bitmap: only copy data described by the dirty bitmap. (since: 4.2)
1258# Behavior on completion is determined by the BitmapSyncMode.
d58d8453 1259#
1ad166b6
BC
1260# Since: 1.3
1261##
1262{ 'enum': 'MirrorSyncMode',
c8b56501 1263 'data': ['top', 'full', 'none', 'incremental', 'bitmap'] }
1ad166b6 1264
00a463b1
JS
1265##
1266# @BitmapSyncMode:
1267#
1268# An enumeration of possible behaviors for the synchronization of a bitmap
1269# when used for data copy operations.
1270#
1271# @on-success: The bitmap is only synced when the operation is successful.
1272# This is the behavior always used for 'INCREMENTAL' backups.
1273#
cf0cd293
JS
1274# @never: The bitmap is never synchronized with the operation, and is
1275# treated solely as a read-only manifest of blocks to copy.
1276#
c23909e5
JS
1277# @always: The bitmap is always synchronized with the operation,
1278# regardless of whether or not the operation was successful.
1279#
00a463b1
JS
1280# Since: 4.2
1281##
1282{ 'enum': 'BitmapSyncMode',
c23909e5 1283 'data': ['on-success', 'never', 'always'] }
00a463b1 1284
d06107ad
HR
1285##
1286# @MirrorCopyMode:
1287#
1288# An enumeration whose values tell the mirror block job when to
1289# trigger writes to the target.
1290#
1291# @background: copy data in background only.
1292#
1293# @write-blocking: when data is written to the source, write it
1294# (synchronously) to the target as well. In
1295# addition, data is copied in background just like in
1296# @background mode.
1297#
1298# Since: 3.0
1299##
1300{ 'enum': 'MirrorCopyMode',
1301 'data': ['background', 'write-blocking'] }
1302
1ad166b6
BC
1303##
1304# @BlockJobInfo:
1305#
1306# Information about a long-running block device operation.
1307#
1308# @type: the job type ('stream' for image streaming)
1309#
6aae5be6
AG
1310# @device: The job identifier. Originally the device name but other
1311# values are allowed since QEMU 2.7
1ad166b6 1312#
a81e0a82
KW
1313# @len: Estimated @offset value at the completion of the job. This value can
1314# arbitrarily change while the job is running, in both directions.
1315#
1316# @offset: Progress made until now. The unit is arbitrary and the value can
1317# only meaningfully be used for the ratio of @offset to @len. The
1318# value is monotonically increasing.
1ad166b6
BC
1319#
1320# @busy: false if the job is known to be in a quiescent state, with
1321# no pending I/O. Since 1.3.
1322#
1323# @paused: whether the job is paused or, if @busy is true, will
1324# pause itself as soon as possible. Since 1.3.
1325#
1ad166b6
BC
1326# @speed: the rate limit, bytes per second
1327#
1328# @io-status: the status of the job (since 1.3)
1329#
ef6dbf1e
HR
1330# @ready: true if the job may be completed (since 2.2)
1331#
58b295ba
JS
1332# @status: Current job state/status (since 2.12)
1333#
b40dacdc
JS
1334# @auto-finalize: Job will finalize itself when PENDING, moving to
1335# the CONCLUDED state. (since 2.12)
1336#
1337# @auto-dismiss: Job will dismiss itself when CONCLUDED, moving to the NULL
1338# state and disappearing from the query list. (since 2.12)
1339#
ab9ba614
JS
1340# @error: Error information if the job did not complete successfully.
1341# Not set if the job completed successfully. (since 2.12.1)
1342#
1ad166b6
BC
1343# Since: 1.1
1344##
895a2a80 1345{ 'struct': 'BlockJobInfo',
1ad166b6
BC
1346 'data': {'type': 'str', 'device': 'str', 'len': 'int',
1347 'offset': 'int', 'busy': 'bool', 'paused': 'bool', 'speed': 'int',
58b295ba 1348 'io-status': 'BlockDeviceIoStatus', 'ready': 'bool',
a50c2ab8 1349 'status': 'JobStatus',
ab9ba614
JS
1350 'auto-finalize': 'bool', 'auto-dismiss': 'bool',
1351 '*error': 'str' } }
1ad166b6
BC
1352
1353##
1354# @query-block-jobs:
1355#
1356# Return information about long-running block device operations.
1357#
1358# Returns: a list of @BlockJobInfo for each active block job
1359#
1360# Since: 1.1
1361##
f55ba801
PB
1362{ 'command': 'query-block-jobs', 'returns': ['BlockJobInfo'],
1363 'allow-preconfig': true }
1ad166b6 1364
1ad166b6 1365##
5072f7b3 1366# @block_resize:
1ad166b6
BC
1367#
1368# Resize a block image while a guest is running.
1369#
1370# Either @device or @node-name must be set but not both.
1371#
1d8bda12 1372# @device: the name of the device to get the image resized
1ad166b6 1373#
1d8bda12 1374# @node-name: graph node name to get the image resized (Since 2.0)
1ad166b6 1375#
23e46452 1376# @size: new image size in bytes
1ad166b6 1377#
e050e426
PM
1378# Returns: - nothing on success
1379# - If @device is not a valid block device, DeviceNotFound
1ad166b6 1380#
9bc6e893 1381# Since: 0.14
0dc869cf
MAL
1382#
1383# Example:
1384#
1385# -> { "execute": "block_resize",
1386# "arguments": { "device": "scratch", "size": 1073741824 } }
1387# <- { "return": {} }
1388#
1ad166b6 1389##
b0ddeba2
MAL
1390{ 'command': 'block_resize',
1391 'data': { '*device': 'str',
1392 '*node-name': 'str',
eb94b81a 1393 'size': 'int' },
f55ba801
PB
1394 'coroutine': true,
1395 'allow-preconfig': true }
1ad166b6
BC
1396
1397##
5072f7b3 1398# @NewImageMode:
1ad166b6
BC
1399#
1400# An enumeration that tells QEMU how to set the backing file path in
1401# a new image file.
1402#
1403# @existing: QEMU should look for an existing image file.
1404#
1405# @absolute-paths: QEMU should create a new image with absolute paths
26ec4e53
PM
1406# for the backing file. If there is no backing file available, the new
1407# image will not be backed either.
1ad166b6
BC
1408#
1409# Since: 1.1
1410##
1411{ 'enum': 'NewImageMode',
1412 'data': [ 'existing', 'absolute-paths' ] }
1413
1414##
5072f7b3 1415# @BlockdevSnapshotSync:
1ad166b6
BC
1416#
1417# Either @device or @node-name must be set but not both.
1418#
681b86ac 1419# @device: the name of the device to take a snapshot of.
1ad166b6 1420#
1d8bda12 1421# @node-name: graph node name to generate the snapshot from (Since 2.0)
1ad166b6 1422#
681b86ac 1423# @snapshot-file: the target of the new overlay image. If the file
26ec4e53
PM
1424# exists, or if it is a device, the overlay will be created in the
1425# existing file/device. Otherwise, a new file will be created.
1ad166b6 1426#
1d8bda12 1427# @snapshot-node-name: the graph node name of the new image (Since 2.0)
1ad166b6 1428#
681b86ac 1429# @format: the format of the overlay image, default is 'qcow2'.
1ad166b6 1430#
1d8bda12 1431# @mode: whether and how QEMU should create a new image, default is
1ad166b6
BC
1432# 'absolute-paths'.
1433##
a911e6ae 1434{ 'struct': 'BlockdevSnapshotSync',
1ad166b6
BC
1435 'data': { '*device': 'str', '*node-name': 'str',
1436 'snapshot-file': 'str', '*snapshot-node-name': 'str',
1437 '*format': 'str', '*mode': 'NewImageMode' } }
1438
43de7e2d 1439##
5072f7b3 1440# @BlockdevSnapshot:
43de7e2d 1441#
681b86ac 1442# @node: device or node name that will have a snapshot taken.
43de7e2d
AG
1443#
1444# @overlay: reference to the existing block device that will become
681b86ac 1445# the overlay of @node, as part of taking the snapshot.
43de7e2d 1446# It must not have a current backing file (this can be
4f7be280 1447# achieved by passing "backing": null to blockdev-add).
43de7e2d 1448#
5072f7b3 1449# Since: 2.5
43de7e2d
AG
1450##
1451{ 'struct': 'BlockdevSnapshot',
1452 'data': { 'node': 'str', 'overlay': 'str' } }
1453
86c6a3b6
VSO
1454##
1455# @BackupPerf:
1456#
1457# Optional parameters for backup. These parameters don't affect
1458# functionality, but may significantly affect performance.
1459#
6a30f663 1460# @use-copy-range: Use copy offloading. Default false.
86c6a3b6 1461#
2c59fd83
VSO
1462# @max-workers: Maximum number of parallel requests for the sustained background
1463# copying process. Doesn't influence copy-before-write operations.
1464# Default 64.
1465#
1466# @max-chunk: Maximum request length for the sustained background copying
1467# process. Doesn't influence copy-before-write operations.
1468# 0 means unlimited. If max-chunk is non-zero then it should not be
1469# less than job cluster size which is calculated as maximum of
1470# target image cluster size and 64k. Default 0.
1471#
86c6a3b6
VSO
1472# Since: 6.0
1473##
1474{ 'struct': 'BackupPerf',
2c59fd83
VSO
1475 'data': { '*use-copy-range': 'bool',
1476 '*max-workers': 'int', '*max-chunk': 'int64' } }
86c6a3b6 1477
1ad166b6 1478##
3c95037a 1479# @BackupCommon:
1ad166b6 1480#
1d8bda12 1481# @job-id: identifier for the newly-created block job. If
70559d49
AG
1482# omitted, the device name will be used. (Since 2.7)
1483#
b7e4fa22 1484# @device: the device name or node-name of a root node which should be copied.
1ad166b6 1485#
1ad166b6 1486# @sync: what parts of the disk image should be copied to the destination
d58d8453
JS
1487# (all the disk, only the sectors allocated in the topmost image, from a
1488# dirty bitmap, or only new I/O).
1ad166b6 1489#
3c95037a
JS
1490# @speed: the maximum speed, in bytes per second. The default is 0,
1491# for unlimited.
1ad166b6 1492#
1a2b8b40 1493# @bitmap: The name of a dirty bitmap to use.
c8b56501 1494# Must be present if sync is "bitmap" or "incremental".
1a2b8b40 1495# Can be present if sync is "full" or "top".
c8b56501
JS
1496# Must not be present otherwise.
1497# (Since 2.4 (drive-backup), 3.1 (blockdev-backup))
1498#
1499# @bitmap-mode: Specifies the type of data the bitmap should contain after
1a2b8b40
JS
1500# the operation concludes.
1501# Must be present if a bitmap was provided,
c8b56501 1502# Must NOT be present otherwise. (Since 4.2)
d58d8453 1503#
1d8bda12 1504# @compress: true to compress data, if the target format supports it.
6bed0280 1505# (default: false) (since 2.8)
13b9414b 1506#
1d8bda12 1507# @on-source-error: the action to take on an error on the source,
1ad166b6
BC
1508# default 'report'. 'stop' and 'enospc' can only be used
1509# if the block device supports io-status (see BlockInfo).
1510#
1d8bda12 1511# @on-target-error: the action to take on an error on the target,
1ad166b6
BC
1512# default 'report' (no limitations, since this applies to
1513# a different block device than @device).
1514#
b40dacdc 1515# @auto-finalize: When false, this job will wait in a PENDING state after it has
dfaff2c3
JS
1516# finished its work, waiting for @block-job-finalize before
1517# making any block graph changes.
1518# When true, this job will automatically
1519# perform its abort or commit actions.
b40dacdc
JS
1520# Defaults to true. (Since 2.12)
1521#
1522# @auto-dismiss: When false, this job will wait in a CONCLUDED state after it
dfaff2c3 1523# has completely ceased all work, and awaits @block-job-dismiss.
b40dacdc
JS
1524# When true, this job will automatically disappear from the query
1525# list without user intervention.
1526# Defaults to true. (Since 2.12)
1527#
00e30f05
VSO
1528# @filter-node-name: the node name that should be assigned to the
1529# filter driver that the backup job inserts into the graph
1530# above node specified by @drive. If this option is not given,
1531# a node name is autogenerated. (Since: 4.2)
1532#
86c6a3b6
VSO
1533# @x-perf: Performance options. (Since 6.0)
1534#
9fb49daa
MA
1535# Features:
1536# @unstable: Member @x-perf is experimental.
1537#
5072f7b3 1538# Note: @on-source-error and @on-target-error only affect background
26ec4e53
PM
1539# I/O. If an error occurs during a guest write request, the device's
1540# rerror/werror actions will be used.
1ad166b6 1541#
3c95037a 1542# Since: 4.2
1ad166b6 1543##
3c95037a
JS
1544{ 'struct': 'BackupCommon',
1545 'data': { '*job-id': 'str', 'device': 'str',
1546 'sync': 'MirrorSyncMode', '*speed': 'int',
c8b56501
JS
1547 '*bitmap': 'str', '*bitmap-mode': 'BitmapSyncMode',
1548 '*compress': 'bool',
1ad166b6 1549 '*on-source-error': 'BlockdevOnError',
b40dacdc 1550 '*on-target-error': 'BlockdevOnError',
00e30f05 1551 '*auto-finalize': 'bool', '*auto-dismiss': 'bool',
9fb49daa
MA
1552 '*filter-node-name': 'str',
1553 '*x-perf': { 'type': 'BackupPerf',
1554 'features': [ 'unstable' ] } } }
1ad166b6 1555
c29c1dd3 1556##
3c95037a 1557# @DriveBackup:
3b7b1236 1558#
3c95037a
JS
1559# @target: the target of the new image. If the file exists, or if it
1560# is a device, the existing file/device will be used as the new
1561# destination. If it does not exist, a new file will be created.
c29c1dd3 1562#
3c95037a
JS
1563# @format: the format of the new destination, default is to
1564# probe if @mode is 'existing', else the format of the source
c29c1dd3 1565#
3c95037a
JS
1566# @mode: whether and how QEMU should create a new image, default is
1567# 'absolute-paths'.
b40dacdc 1568#
3c95037a
JS
1569# Since: 1.6
1570##
1571{ 'struct': 'DriveBackup',
1572 'base': 'BackupCommon',
1573 'data': { 'target': 'str',
1574 '*format': 'str',
1575 '*mode': 'NewImageMode' } }
1576
1577##
1578# @BlockdevBackup:
b40dacdc 1579#
3c95037a 1580# @target: the device name or node-name of the backup target node.
c29c1dd3
FZ
1581#
1582# Since: 2.3
1583##
895a2a80 1584{ 'struct': 'BlockdevBackup',
3c95037a
JS
1585 'base': 'BackupCommon',
1586 'data': { 'target': 'str' } }
c29c1dd3 1587
1ad166b6 1588##
5072f7b3 1589# @blockdev-snapshot-sync:
1ad166b6 1590#
681b86ac 1591# Takes a synchronous snapshot of a block device.
1ad166b6 1592#
a911e6ae 1593# For the arguments, see the documentation of BlockdevSnapshotSync.
1ad166b6 1594#
e050e426
PM
1595# Returns: - nothing on success
1596# - If @device is not a valid block device, DeviceNotFound
1ad166b6 1597#
9bc6e893 1598# Since: 0.14
b4039d8d
MAL
1599#
1600# Example:
1601#
1602# -> { "execute": "blockdev-snapshot-sync",
1603# "arguments": { "device": "ide-hd0",
1604# "snapshot-file":
1605# "/some/place/my-image",
1606# "format": "qcow2" } }
1607# <- { "return": {} }
1608#
1ad166b6
BC
1609##
1610{ 'command': 'blockdev-snapshot-sync',
f55ba801
PB
1611 'data': 'BlockdevSnapshotSync',
1612 'allow-preconfig': true }
1ad166b6 1613
43de7e2d 1614##
5072f7b3 1615# @blockdev-snapshot:
43de7e2d 1616#
681b86ac 1617# Takes a snapshot of a block device.
43de7e2d 1618#
681b86ac 1619# Take a snapshot, by installing 'node' as the backing image of
3282eca4
MAL
1620# 'overlay'. Additionally, if 'node' is associated with a block
1621# device, the block device changes to using 'overlay' as its new active
1622# image.
1623#
43de7e2d
AG
1624# For the arguments, see the documentation of BlockdevSnapshot.
1625#
c6bdc312
PK
1626# Features:
1627# @allow-write-only-overlay: If present, the check whether this operation is safe
1628# was relaxed so that it can be used to change
1629# backing file of a destination of a blockdev-mirror.
1630# (since 5.0)
1631#
5072f7b3 1632# Since: 2.5
3282eca4
MAL
1633#
1634# Example:
1635#
1636# -> { "execute": "blockdev-add",
244d04db
EB
1637# "arguments": { "driver": "qcow2",
1638# "node-name": "node1534",
34f58df5
MA
1639# "file": { "driver": "file",
1640# "filename": "hd1.qcow2" },
4f7be280 1641# "backing": null } }
3282eca4
MAL
1642#
1643# <- { "return": {} }
1644#
1645# -> { "execute": "blockdev-snapshot",
1646# "arguments": { "node": "ide-hd0",
1647# "overlay": "node1534" } }
1648# <- { "return": {} }
1649#
43de7e2d
AG
1650##
1651{ 'command': 'blockdev-snapshot',
c6bdc312 1652 'data': 'BlockdevSnapshot',
f55ba801
PB
1653 'features': [ 'allow-write-only-overlay' ],
1654 'allow-preconfig': true }
43de7e2d 1655
fa40e656 1656##
5072f7b3 1657# @change-backing-file:
fa40e656
JC
1658#
1659# Change the backing file in the image file metadata. This does not
1660# cause QEMU to reopen the image file to reparse the backing filename
1661# (it may, however, perform a reopen to change permissions from
1662# r/o -> r/w -> r/o, if needed). The new backing file string is written
1663# into the image file metadata, and the QEMU internal strings are
1664# updated.
1665#
1666# @image-node-name: The name of the block driver state node of the
280c4b3c
MAL
1667# image to modify. The "device" argument is used
1668# to verify "image-node-name" is in the chain
1669# described by "device".
fa40e656 1670#
26ec4e53
PM
1671# @device: The device name or node-name of the root node that owns
1672# image-node-name.
fa40e656 1673#
26ec4e53
PM
1674# @backing-file: The string to write as the backing file. This
1675# string is not validated, so care should be taken
1676# when specifying the string or the image chain may
1677# not be able to be reopened again.
fa40e656 1678#
e050e426
PM
1679# Returns: - Nothing on success
1680# - If "device" does not exist or cannot be determined, DeviceNotFound
280c4b3c 1681#
fa40e656
JC
1682# Since: 2.1
1683##
1684{ 'command': 'change-backing-file',
1685 'data': { 'device': 'str', 'image-node-name': 'str',
f55ba801
PB
1686 'backing-file': 'str' },
1687 'allow-preconfig': true }
fa40e656 1688
1ad166b6 1689##
5072f7b3 1690# @block-commit:
1ad166b6
BC
1691#
1692# Live commit of data from overlay image nodes into backing nodes - i.e.,
1693# writes data between 'top' and 'base' into 'base'.
1694#
05ea385a
HR
1695# If top == base, that is an error.
1696# If top has no overlays on top of it, or if it is in use by a writer,
1697# the job will not be completed by itself. The user needs to complete
1698# the job with the block-job-complete command after getting the ready
1699# event. (Since 2.0)
1700#
1701# If the base image is smaller than top, then the base image will be
1702# resized to be the same size as top. If top is smaller than the base
1703# image, the base will not be truncated. If you want the base image
1704# size to match the size of the smaller top, you can safely truncate
1705# it yourself once the commit operation successfully completes.
1706#
1d8bda12 1707# @job-id: identifier for the newly-created block job. If
fd62c609
AG
1708# omitted, the device name will be used. (Since 2.7)
1709#
26ec4e53 1710# @device: the device name or node-name of a root node
1ad166b6 1711#
3c605f40
KW
1712# @base-node: The node name of the backing image to write data into.
1713# If not specified, this is the deepest backing image.
1714# (since: 3.1)
1ad166b6 1715#
3c605f40
KW
1716# @base: Same as @base-node, except that it is a file name rather than a node
1717# name. This must be the exact filename string that was used to open the
1718# node; other strings, even if addressing the same file, are not
df4097ae 1719# accepted
3c605f40
KW
1720#
1721# @top-node: The node name of the backing image within the image chain
1722# which contains the topmost data to be committed down. If
1723# not specified, this is the active layer. (since: 3.1)
1724#
1725# @top: Same as @top-node, except that it is a file name rather than a node
1726# name. This must be the exact filename string that was used to open the
1727# node; other strings, even if addressing the same file, are not
df4097ae 1728# accepted
1ad166b6 1729#
26ec4e53 1730# @backing-file: The backing file string to write into the overlay
05ea385a
HR
1731# image of 'top'. If 'top' does not have an overlay
1732# image, or if 'top' is in use by a writer, specifying
1733# a backing file string is an error.
26ec4e53 1734#
05ea385a
HR
1735# This filename is not validated. If a pathname string
1736# is such that it cannot be resolved by QEMU, that
1737# means that subsequent QMP or HMP commands must use
1738# node-names for the image in question, as filename
1739# lookup methods will fail.
26ec4e53
PM
1740#
1741# If not specified, QEMU will automatically determine
1742# the backing file string to use, or error out if
1743# there is no obvious choice. Care should be taken
1744# when specifying the string, to specify a valid
1745# filename or protocol.
1746# (Since 2.1)
1747#
26ec4e53 1748# @speed: the maximum speed, in bytes per second
1ad166b6 1749#
8faad1c7
KW
1750# @on-error: the action to take on an error. 'ignore' means that the request
1751# should be retried. (default: report; Since: 5.0)
1752#
1d8bda12 1753# @filter-node-name: the node name that should be assigned to the
0db832f4
KW
1754# filter driver that the commit job inserts into the graph
1755# above @top. If this option is not given, a node name is
1756# autogenerated. (Since: 2.9)
1757#
96fbf534
JS
1758# @auto-finalize: When false, this job will wait in a PENDING state after it has
1759# finished its work, waiting for @block-job-finalize before
1760# making any block graph changes.
1761# When true, this job will automatically
1762# perform its abort or commit actions.
1763# Defaults to true. (Since 3.1)
1764#
1765# @auto-dismiss: When false, this job will wait in a CONCLUDED state after it
1766# has completely ceased all work, and awaits @block-job-dismiss.
1767# When true, this job will automatically disappear from the query
1768# list without user intervention.
1769# Defaults to true. (Since 3.1)
1770#
df4097ae
MA
1771# Features:
1772# @deprecated: Members @base and @top are deprecated. Use @base-node
b2f1c13c 1773# and @top-node instead.
df4097ae 1774#
e050e426
PM
1775# Returns: - Nothing on success
1776# - If @device does not exist, DeviceNotFound
1777# - Any other error returns a GenericError.
1ad166b6
BC
1778#
1779# Since: 1.3
1780#
f44fb58f
MAL
1781# Example:
1782#
1783# -> { "execute": "block-commit",
1784# "arguments": { "device": "virtio0",
1785# "top": "/tmp/snap1.qcow2" } }
1786# <- { "return": {} }
1787#
1ad166b6
BC
1788##
1789{ 'command': 'block-commit',
3c605f40 1790 'data': { '*job-id': 'str', 'device': 'str', '*base-node': 'str',
df4097ae
MA
1791 '*base': { 'type': 'str', 'features': [ 'deprecated' ] },
1792 '*top-node': 'str',
1793 '*top': { 'type': 'str', 'features': [ 'deprecated' ] },
0db832f4 1794 '*backing-file': 'str', '*speed': 'int',
8faad1c7 1795 '*on-error': 'BlockdevOnError',
96fbf534 1796 '*filter-node-name': 'str',
f55ba801
PB
1797 '*auto-finalize': 'bool', '*auto-dismiss': 'bool' },
1798 'allow-preconfig': true }
1ad166b6
BC
1799
1800##
5072f7b3 1801# @drive-backup:
1ad166b6
BC
1802#
1803# Start a point-in-time copy of a block device to a new destination. The
1804# status of ongoing drive-backup operations can be checked with
1805# query-block-jobs where the BlockJobInfo.type field has the value 'backup'.
1806# The operation can be stopped before it has completed using the
1807# block-job-cancel command.
1808#
1084159b
VSO
1809# Features:
1810# @deprecated: This command is deprecated. Use @blockdev-backup instead.
1811#
e050e426
PM
1812# Returns: - nothing on success
1813# - If @device is not a valid block device, GenericError
1ad166b6 1814#
5072f7b3 1815# Since: 1.6
b0336412
MAL
1816#
1817# Example:
1818#
1819# -> { "execute": "drive-backup",
1820# "arguments": { "device": "drive0",
1821# "sync": "full",
1822# "target": "backup.img" } }
1823# <- { "return": {} }
1824#
1ad166b6 1825##
81206a89 1826{ 'command': 'drive-backup', 'boxed': true,
f55ba801
PB
1827 'data': 'DriveBackup', 'features': ['deprecated'],
1828 'allow-preconfig': true }
1ad166b6 1829
c29c1dd3 1830##
5072f7b3 1831# @blockdev-backup:
c29c1dd3
FZ
1832#
1833# Start a point-in-time copy of a block device to a new destination. The
1834# status of ongoing blockdev-backup operations can be checked with
1835# query-block-jobs where the BlockJobInfo.type field has the value 'backup'.
1836# The operation can be stopped before it has completed using the
1837# block-job-cancel command.
1838#
e050e426
PM
1839# Returns: - nothing on success
1840# - If @device is not a valid block device, DeviceNotFound
dc7a4a9e 1841#
5072f7b3 1842# Since: 2.3
1cf75113
MAL
1843#
1844# Example:
4ae65a52 1845#
1cf75113
MAL
1846# -> { "execute": "blockdev-backup",
1847# "arguments": { "device": "src-id",
1848# "sync": "full",
1849# "target": "tgt-id" } }
1850# <- { "return": {} }
1851#
c29c1dd3 1852##
dc7a4a9e 1853{ 'command': 'blockdev-backup', 'boxed': true,
f55ba801
PB
1854 'data': 'BlockdevBackup',
1855 'allow-preconfig': true }
c29c1dd3 1856
1ad166b6 1857##
5072f7b3 1858# @query-named-block-nodes:
1ad166b6
BC
1859#
1860# Get the named block driver list
1861#
facda544
PK
1862# @flat: Omit the nested data about backing image ("backing-image" key) if true.
1863# Default is false (Since 5.0)
1864#
1ad166b6
BC
1865# Returns: the list of BlockDeviceInfo
1866#
5072f7b3 1867# Since: 2.0
e1f34cb2
MAL
1868#
1869# Example:
1870#
1871# -> { "execute": "query-named-block-nodes" }
1872# <- { "return": [ { "ro":false,
1873# "drv":"qcow2",
1874# "encrypted":false,
1875# "file":"disks/test.qcow2",
1876# "node-name": "my-node",
1877# "backing_file_depth":1,
016b8359 1878# "detect_zeroes":"off",
e1f34cb2
MAL
1879# "bps":1000000,
1880# "bps_rd":0,
1881# "bps_wr":0,
1882# "iops":1000000,
1883# "iops_rd":0,
1884# "iops_wr":0,
1885# "bps_max": 8000000,
1886# "bps_rd_max": 0,
1887# "bps_wr_max": 0,
1888# "iops_max": 0,
1889# "iops_rd_max": 0,
1890# "iops_wr_max": 0,
1891# "iops_size": 0,
1892# "write_threshold": 0,
1893# "image":{
1894# "filename":"disks/test.qcow2",
1895# "format":"qcow2",
1896# "virtual-size":2048000,
1897# "backing_file":"base.qcow2",
1898# "full-backing-filename":"disks/base.qcow2",
1899# "backing-filename-format":"qcow2",
1900# "snapshots":[
1901# {
1902# "id": "1",
1903# "name": "snapshot1",
1904# "vm-state-size": 0,
1905# "date-sec": 10000200,
1906# "date-nsec": 12,
1907# "vm-clock-sec": 206,
1908# "vm-clock-nsec": 30
1909# }
1910# ],
1911# "backing-image":{
1912# "filename":"disks/base.qcow2",
1913# "format":"qcow2",
1914# "virtual-size":2048000
1915# }
1916# } } ] }
1917#
1ad166b6 1918##
facda544
PK
1919{ 'command': 'query-named-block-nodes',
1920 'returns': [ 'BlockDeviceInfo' ],
f55ba801
PB
1921 'data': { '*flat': 'bool' },
1922 'allow-preconfig': true }
1ad166b6 1923
5d3b4e99
VSO
1924##
1925# @XDbgBlockGraphNodeType:
1926#
1927# @block-backend: corresponds to BlockBackend
1928#
2400e50c 1929# @block-job: corresponds to BlockJob
5d3b4e99
VSO
1930#
1931# @block-driver: corresponds to BlockDriverState
1932#
1933# Since: 4.0
1934##
1935{ 'enum': 'XDbgBlockGraphNodeType',
1936 'data': [ 'block-backend', 'block-job', 'block-driver' ] }
1937
1938##
1939# @XDbgBlockGraphNode:
1940#
1941# @id: Block graph node identifier. This @id is generated only for
1942# x-debug-query-block-graph and does not relate to any other identifiers in
1943# Qemu.
1944#
1945# @type: Type of graph node. Can be one of block-backend, block-job or
1946# block-driver-state.
1947#
1948# @name: Human readable name of the node. Corresponds to node-name for
1949# block-driver-state nodes; is not guaranteed to be unique in the whole
1950# graph (with block-jobs and block-backends).
1951#
1952# Since: 4.0
1953##
1954{ 'struct': 'XDbgBlockGraphNode',
1955 'data': { 'id': 'uint64', 'type': 'XDbgBlockGraphNodeType', 'name': 'str' } }
1956
1957##
1958# @BlockPermission:
1959#
1960# Enum of base block permissions.
1961#
1962# @consistent-read: A user that has the "permission" of consistent reads is
1963# guaranteed that their view of the contents of the block
1964# device is complete and self-consistent, representing the
1965# contents of a disk at a specific point.
1966# For most block devices (including their backing files) this
1967# is true, but the property cannot be maintained in a few
1968# situations like for intermediate nodes of a commit block
1969# job.
1970#
1971# @write: This permission is required to change the visible disk contents.
1972#
1973# @write-unchanged: This permission (which is weaker than BLK_PERM_WRITE) is
1974# both enough and required for writes to the block node when
1975# the caller promises that the visible disk content doesn't
1976# change.
1977# As the BLK_PERM_WRITE permission is strictly stronger,
1978# either is sufficient to perform an unchanging write.
1979#
1980# @resize: This permission is required to change the size of a block node.
1981#
5d3b4e99
VSO
1982# Since: 4.0
1983##
fbeed197 1984{ 'enum': 'BlockPermission',
64631f36
VSO
1985 'data': [ 'consistent-read', 'write', 'write-unchanged', 'resize' ] }
1986
5d3b4e99
VSO
1987##
1988# @XDbgBlockGraphEdge:
1989#
1990# Block Graph edge description for x-debug-query-block-graph.
1991#
1992# @parent: parent id
1993#
1994# @child: child id
1995#
1996# @name: name of the relation (examples are 'file' and 'backing')
1997#
1998# @perm: granted permissions for the parent operating on the child
1999#
2000# @shared-perm: permissions that can still be granted to other users of the
2001# child while it is still attached to this parent
2002#
2003# Since: 4.0
2004##
2005{ 'struct': 'XDbgBlockGraphEdge',
2006 'data': { 'parent': 'uint64', 'child': 'uint64',
2007 'name': 'str', 'perm': [ 'BlockPermission' ],
2008 'shared-perm': [ 'BlockPermission' ] } }
2009
2010##
2011# @XDbgBlockGraph:
2012#
2013# Block Graph - list of nodes and list of edges.
2014#
2015# Since: 4.0
2016##
2017{ 'struct': 'XDbgBlockGraph',
2018 'data': { 'nodes': ['XDbgBlockGraphNode'], 'edges': ['XDbgBlockGraphEdge'] } }
2019
2020##
2021# @x-debug-query-block-graph:
2022#
2023# Get the block graph.
2024#
9fb49daa
MA
2025# Features:
2026# @unstable: This command is meant for debugging.
2027#
5d3b4e99
VSO
2028# Since: 4.0
2029##
9fb49daa 2030{ 'command': 'x-debug-query-block-graph', 'returns': 'XDbgBlockGraph',
f55ba801
PB
2031 'features': [ 'unstable' ],
2032 'allow-preconfig': true }
5d3b4e99 2033
1ad166b6 2034##
5072f7b3 2035# @drive-mirror:
1ad166b6 2036#
12a21b73
MAL
2037# Start mirroring a block device's writes to a new destination. target
2038# specifies the target of the new image. If the file exists, or if it
2039# is a device, it will be used as the new destination for writes. If
2040# it does not exist, a new file will be created. format specifies the
2041# format of the mirror image, default is to probe if mode='existing',
2042# else the format of the source.
1ad166b6 2043#
e050e426
PM
2044# Returns: - nothing on success
2045# - If @device is not a valid block device, GenericError
faecd40a 2046#
5072f7b3 2047# Since: 1.3
12a21b73
MAL
2048#
2049# Example:
2050#
2051# -> { "execute": "drive-mirror",
2052# "arguments": { "device": "ide-hd0",
2053# "target": "/some/place/my-image",
2054# "sync": "full",
2055# "format": "qcow2" } }
2056# <- { "return": {} }
2057#
faecd40a
EB
2058##
2059{ 'command': 'drive-mirror', 'boxed': true,
f55ba801
PB
2060 'data': 'DriveMirror',
2061 'allow-preconfig': true }
faecd40a
EB
2062
2063##
5072f7b3 2064# @DriveMirror:
faecd40a
EB
2065#
2066# A set of parameters describing drive mirror setup.
2067#
1d8bda12 2068# @job-id: identifier for the newly-created block job. If
71aa9867
AG
2069# omitted, the device name will be used. (Since 2.7)
2070#
23e46452
AB
2071# @device: the device name or node-name of a root node whose writes should be
2072# mirrored.
1ad166b6
BC
2073#
2074# @target: the target of the new image. If the file exists, or if it
2075# is a device, the existing file/device will be used as the new
2076# destination. If it does not exist, a new file will be created.
2077#
1d8bda12 2078# @format: the format of the new destination, default is to
1ad166b6
BC
2079# probe if @mode is 'existing', else the format of the source
2080#
1d8bda12 2081# @node-name: the new block driver state node name in the graph
4c828dc6
BC
2082# (Since 2.1)
2083#
1d8bda12 2084# @replaces: with sync=full graph node name to be replaced by the new
09158f00 2085# image when a whole image copy is done. This can be used to repair
3f072a7f
HR
2086# broken Quorum files. By default, @device is replaced, although
2087# implicitly created filters on it are kept. (Since 2.1)
09158f00 2088#
1d8bda12 2089# @mode: whether and how QEMU should create a new image, default is
1ad166b6
BC
2090# 'absolute-paths'.
2091#
23e46452 2092# @speed: the maximum speed, in bytes per second
1ad166b6
BC
2093#
2094# @sync: what parts of the disk image should be copied to the destination
2095# (all the disk, only the sectors allocated in the topmost image, or
2096# only new I/O).
2097#
1d8bda12 2098# @granularity: granularity of the dirty bitmap, default is 64K
1ad166b6
BC
2099# if the image format doesn't have clusters, 4K if the clusters
2100# are smaller than that, else the cluster size. Must be a
2101# power of 2 between 512 and 64M (since 1.4).
2102#
1d8bda12 2103# @buf-size: maximum amount of data in flight from source to
1ad166b6
BC
2104# target (since 1.4).
2105#
1d8bda12 2106# @on-source-error: the action to take on an error on the source,
1ad166b6
BC
2107# default 'report'. 'stop' and 'enospc' can only be used
2108# if the block device supports io-status (see BlockInfo).
2109#
1d8bda12 2110# @on-target-error: the action to take on an error on the target,
1ad166b6
BC
2111# default 'report' (no limitations, since this applies to
2112# a different block device than @device).
4ae65a52 2113#
1d8bda12 2114# @unmap: Whether to try to unmap target sectors where source has
0fc9f8ea
FZ
2115# only zero. If true, and target unallocated sectors will read as zero,
2116# target image sectors will be unmapped; otherwise, zeroes will be
2117# written. Both will result in identical contents.
2118# Default is true. (Since 2.4)
1ad166b6 2119#
481debaa
HR
2120# @copy-mode: when to copy data to the destination; defaults to 'background'
2121# (Since: 3.0)
2122#
a6b58ade
JS
2123# @auto-finalize: When false, this job will wait in a PENDING state after it has
2124# finished its work, waiting for @block-job-finalize before
2125# making any block graph changes.
2126# When true, this job will automatically
2127# perform its abort or commit actions.
2128# Defaults to true. (Since 3.1)
2129#
2130# @auto-dismiss: When false, this job will wait in a CONCLUDED state after it
2131# has completely ceased all work, and awaits @block-job-dismiss.
2132# When true, this job will automatically disappear from the query
2133# list without user intervention.
2134# Defaults to true. (Since 3.1)
4ae65a52 2135#
5072f7b3 2136# Since: 1.3
1ad166b6 2137##
faecd40a 2138{ 'struct': 'DriveMirror',
71aa9867
AG
2139 'data': { '*job-id': 'str', 'device': 'str', 'target': 'str',
2140 '*format': 'str', '*node-name': 'str', '*replaces': 'str',
1ad166b6
BC
2141 'sync': 'MirrorSyncMode', '*mode': 'NewImageMode',
2142 '*speed': 'int', '*granularity': 'uint32',
2143 '*buf-size': 'int', '*on-source-error': 'BlockdevOnError',
0fc9f8ea 2144 '*on-target-error': 'BlockdevOnError',
a6b58ade
JS
2145 '*unmap': 'bool', '*copy-mode': 'MirrorCopyMode',
2146 '*auto-finalize': 'bool', '*auto-dismiss': 'bool' } }
1ad166b6 2147
341ebc2f 2148##
5072f7b3 2149# @BlockDirtyBitmap:
341ebc2f
JS
2150#
2151# @node: name of device/node which the bitmap is tracking
2152#
2153# @name: name of the dirty bitmap
2154#
5072f7b3 2155# Since: 2.4
341ebc2f 2156##
895a2a80 2157{ 'struct': 'BlockDirtyBitmap',
341ebc2f
JS
2158 'data': { 'node': 'str', 'name': 'str' } }
2159
2160##
5072f7b3 2161# @BlockDirtyBitmapAdd:
341ebc2f
JS
2162#
2163# @node: name of device/node which the bitmap is tracking
2164#
cf7c49cf 2165# @name: name of the dirty bitmap (must be less than 1024 bytes)
341ebc2f 2166#
1d8bda12 2167# @granularity: the bitmap granularity, default is 64k for
341ebc2f
JS
2168# block-dirty-bitmap-add
2169#
fd5ae4cc
VSO
2170# @persistent: the bitmap is persistent, i.e. it will be saved to the
2171# corresponding block device image file on its close. For now only
2172# Qcow2 disks support persistent bitmaps. Default is false for
2173# block-dirty-bitmap-add. (Since: 2.10)
2174#
0e2b7f09
JS
2175# @disabled: the bitmap is created in the disabled state, which means that
2176# it will not track drive changes. The bitmap may be enabled with
2177# block-dirty-bitmap-enable. Default is false. (Since: 4.0)
a6e2ca5f 2178#
5072f7b3 2179# Since: 2.4
341ebc2f 2180##
895a2a80 2181{ 'struct': 'BlockDirtyBitmapAdd',
fd5ae4cc 2182 'data': { 'node': 'str', 'name': 'str', '*granularity': 'uint32',
3264ffce 2183 '*persistent': 'bool', '*disabled': 'bool' } }
341ebc2f 2184
eff0829b 2185##
1466ef6c 2186# @BlockDirtyBitmapOrStr:
eff0829b
VSO
2187#
2188# @local: name of the bitmap, attached to the same node as target bitmap.
2189#
2190# @external: bitmap with specified node
2191#
2192# Since: 4.1
2193##
1466ef6c 2194{ 'alternate': 'BlockDirtyBitmapOrStr',
eff0829b
VSO
2195 'data': { 'local': 'str',
2196 'external': 'BlockDirtyBitmap' } }
2197
b598e531
VSO
2198##
2199# @BlockDirtyBitmapMerge:
2200#
eff0829b 2201# @node: name of device/node which the @target bitmap is tracking
b598e531 2202#
360d4e4e 2203# @target: name of the destination dirty bitmap
b598e531 2204#
eff0829b 2205# @bitmaps: name(s) of the source dirty bitmap(s) at @node and/or fully
2400e50c 2206# specified BlockDirtyBitmap elements. The latter are supported
eff0829b 2207# since 4.1.
b598e531 2208#
0e2b7f09 2209# Since: 4.0
b598e531
VSO
2210##
2211{ 'struct': 'BlockDirtyBitmapMerge',
eff0829b 2212 'data': { 'node': 'str', 'target': 'str',
1466ef6c 2213 'bitmaps': ['BlockDirtyBitmapOrStr'] } }
b598e531 2214
341ebc2f 2215##
5072f7b3 2216# @block-dirty-bitmap-add:
341ebc2f 2217#
2258a5db 2218# Create a dirty bitmap with a name on the node, and start tracking the writes.
341ebc2f 2219#
e050e426
PM
2220# Returns: - nothing on success
2221# - If @node is not a valid block device or node, DeviceNotFound
2222# - If @name is already taken, GenericError with an explanation
341ebc2f 2223#
5072f7b3 2224# Since: 2.4
2258a5db
MAL
2225#
2226# Example:
2227#
2228# -> { "execute": "block-dirty-bitmap-add",
2229# "arguments": { "node": "drive0", "name": "bitmap0" } }
2230# <- { "return": {} }
2231#
341ebc2f
JS
2232##
2233{ 'command': 'block-dirty-bitmap-add',
f55ba801
PB
2234 'data': 'BlockDirtyBitmapAdd',
2235 'allow-preconfig': true }
341ebc2f
JS
2236
2237##
5072f7b3 2238# @block-dirty-bitmap-remove:
341ebc2f 2239#
4bbca422 2240# Stop write tracking and remove the dirty bitmap that was created
5c36c1af
VSO
2241# with block-dirty-bitmap-add. If the bitmap is persistent, remove it from its
2242# storage too.
341ebc2f 2243#
e050e426
PM
2244# Returns: - nothing on success
2245# - If @node is not a valid block device or node, DeviceNotFound
2246# - If @name is not found, GenericError with an explanation
2247# - if @name is frozen by an operation, GenericError
341ebc2f 2248#
5072f7b3 2249# Since: 2.4
4bbca422
MAL
2250#
2251# Example:
2252#
2253# -> { "execute": "block-dirty-bitmap-remove",
2254# "arguments": { "node": "drive0", "name": "bitmap0" } }
2255# <- { "return": {} }
2256#
341ebc2f
JS
2257##
2258{ 'command': 'block-dirty-bitmap-remove',
f55ba801
PB
2259 'data': 'BlockDirtyBitmap',
2260 'allow-preconfig': true }
341ebc2f 2261
e74e6b78 2262##
5072f7b3 2263# @block-dirty-bitmap-clear:
e74e6b78 2264#
73dffdc8
MAL
2265# Clear (reset) a dirty bitmap on the device, so that an incremental
2266# backup from this point in time forward will only backup clusters
2267# modified after this clear operation.
e74e6b78 2268#
e050e426
PM
2269# Returns: - nothing on success
2270# - If @node is not a valid block device, DeviceNotFound
2271# - If @name is not found, GenericError with an explanation
e74e6b78 2272#
5072f7b3 2273# Since: 2.4
73dffdc8
MAL
2274#
2275# Example:
2276#
2277# -> { "execute": "block-dirty-bitmap-clear",
2278# "arguments": { "node": "drive0", "name": "bitmap0" } }
2279# <- { "return": {} }
2280#
e74e6b78
JS
2281##
2282{ 'command': 'block-dirty-bitmap-clear',
f55ba801
PB
2283 'data': 'BlockDirtyBitmap',
2284 'allow-preconfig': true }
e74e6b78 2285
5c5d2e50 2286##
0e2b7f09 2287# @block-dirty-bitmap-enable:
5c5d2e50
VSO
2288#
2289# Enables a dirty bitmap so that it will begin tracking disk changes.
2290#
e050e426
PM
2291# Returns: - nothing on success
2292# - If @node is not a valid block device, DeviceNotFound
2293# - If @name is not found, GenericError with an explanation
5c5d2e50 2294#
0e2b7f09 2295# Since: 4.0
5c5d2e50
VSO
2296#
2297# Example:
2298#
0e2b7f09 2299# -> { "execute": "block-dirty-bitmap-enable",
5c5d2e50
VSO
2300# "arguments": { "node": "drive0", "name": "bitmap0" } }
2301# <- { "return": {} }
2302#
2303##
fbeed197 2304{ 'command': 'block-dirty-bitmap-enable',
f55ba801
PB
2305 'data': 'BlockDirtyBitmap',
2306 'allow-preconfig': true }
5c5d2e50
VSO
2307
2308##
0e2b7f09 2309# @block-dirty-bitmap-disable:
5c5d2e50
VSO
2310#
2311# Disables a dirty bitmap so that it will stop tracking disk changes.
2312#
e050e426
PM
2313# Returns: - nothing on success
2314# - If @node is not a valid block device, DeviceNotFound
2315# - If @name is not found, GenericError with an explanation
5c5d2e50 2316#
0e2b7f09 2317# Since: 4.0
5c5d2e50
VSO
2318#
2319# Example:
2320#
0e2b7f09 2321# -> { "execute": "block-dirty-bitmap-disable",
5c5d2e50
VSO
2322# "arguments": { "node": "drive0", "name": "bitmap0" } }
2323# <- { "return": {} }
2324#
2325##
fbeed197 2326{ 'command': 'block-dirty-bitmap-disable',
f55ba801
PB
2327 'data': 'BlockDirtyBitmap',
2328 'allow-preconfig': true }
5c5d2e50 2329
b598e531 2330##
0e2b7f09 2331# @block-dirty-bitmap-merge:
b598e531 2332#
360d4e4e 2333# Merge dirty bitmaps listed in @bitmaps to the @target dirty bitmap.
73ab5d60
JS
2334# Dirty bitmaps in @bitmaps will be unchanged, except if it also appears
2335# as the @target bitmap. Any bits already set in @target will still be
2336# set after the merge, i.e., this operation does not clear the target.
360d4e4e 2337# On error, @target is unchanged.
b598e531 2338#
73ab5d60
JS
2339# The resulting bitmap will count as dirty any clusters that were dirty in any
2340# of the source bitmaps. This can be used to achieve backup checkpoints, or in
2341# simpler usages, to copy bitmaps.
2342#
e050e426
PM
2343# Returns: - nothing on success
2344# - If @node is not a valid block device, DeviceNotFound
2345# - If any bitmap in @bitmaps or @target is not found, GenericError
2346# - If any of the bitmaps have different sizes or granularities,
2347# GenericError
b598e531 2348#
0e2b7f09 2349# Since: 4.0
b598e531
VSO
2350#
2351# Example:
2352#
0e2b7f09 2353# -> { "execute": "block-dirty-bitmap-merge",
360d4e4e
JS
2354# "arguments": { "node": "drive0", "target": "bitmap0",
2355# "bitmaps": ["bitmap1"] } }
b598e531
VSO
2356# <- { "return": {} }
2357#
2358##
fbeed197 2359{ 'command': 'block-dirty-bitmap-merge',
f55ba801
PB
2360 'data': 'BlockDirtyBitmapMerge',
2361 'allow-preconfig': true }
b598e531 2362
a3b52535
VSO
2363##
2364# @BlockDirtyBitmapSha256:
2365#
2366# SHA256 hash of dirty bitmap data
2367#
2368# @sha256: ASCII representation of SHA256 bitmap hash
2369#
2370# Since: 2.10
2371##
fbeed197
MA
2372{ 'struct': 'BlockDirtyBitmapSha256',
2373 'data': {'sha256': 'str'} }
a3b52535
VSO
2374
2375##
2376# @x-debug-block-dirty-bitmap-sha256:
2377#
73ab5d60 2378# Get bitmap SHA256.
a3b52535 2379#
9fb49daa
MA
2380# Features:
2381# @unstable: This command is meant for debugging.
2382#
e050e426
PM
2383# Returns: - BlockDirtyBitmapSha256 on success
2384# - If @node is not a valid block device, DeviceNotFound
2385# - If @name is not found or if hashing has failed, GenericError with an
2386# explanation
a3b52535
VSO
2387#
2388# Since: 2.10
2389##
fbeed197 2390{ 'command': 'x-debug-block-dirty-bitmap-sha256',
9fb49daa 2391 'data': 'BlockDirtyBitmap', 'returns': 'BlockDirtyBitmapSha256',
f55ba801
PB
2392 'features': [ 'unstable' ],
2393 'allow-preconfig': true }
a3b52535 2394
df92562e 2395##
5072f7b3 2396# @blockdev-mirror:
df92562e
FZ
2397#
2398# Start mirroring a block device's writes to a new destination.
2399#
1d8bda12 2400# @job-id: identifier for the newly-created block job. If
71aa9867
AG
2401# omitted, the device name will be used. (Since 2.7)
2402#
07eec652
KW
2403# @device: The device name or node-name of a root node whose writes should be
2404# mirrored.
df92562e
FZ
2405#
2406# @target: the id or node-name of the block device to mirror to. This mustn't be
2407# attached to guest.
2408#
1d8bda12 2409# @replaces: with sync=full graph node name to be replaced by the new
df92562e 2410# image when a whole image copy is done. This can be used to repair
3f072a7f
HR
2411# broken Quorum files. By default, @device is replaced, although
2412# implicitly created filters on it are kept.
df92562e 2413#
23e46452 2414# @speed: the maximum speed, in bytes per second
df92562e
FZ
2415#
2416# @sync: what parts of the disk image should be copied to the destination
2417# (all the disk, only the sectors allocated in the topmost image, or
2418# only new I/O).
2419#
1d8bda12 2420# @granularity: granularity of the dirty bitmap, default is 64K
df92562e
FZ
2421# if the image format doesn't have clusters, 4K if the clusters
2422# are smaller than that, else the cluster size. Must be a
2423# power of 2 between 512 and 64M
2424#
1d8bda12 2425# @buf-size: maximum amount of data in flight from source to
df92562e
FZ
2426# target
2427#
1d8bda12 2428# @on-source-error: the action to take on an error on the source,
df92562e
FZ
2429# default 'report'. 'stop' and 'enospc' can only be used
2430# if the block device supports io-status (see BlockInfo).
2431#
1d8bda12 2432# @on-target-error: the action to take on an error on the target,
df92562e
FZ
2433# default 'report' (no limitations, since this applies to
2434# a different block device than @device).
2435#
1d8bda12 2436# @filter-node-name: the node name that should be assigned to the
6cdbceb1
KW
2437# filter driver that the mirror job inserts into the graph
2438# above @device. If this option is not given, a node name is
2439# autogenerated. (Since: 2.9)
2440#
481debaa
HR
2441# @copy-mode: when to copy data to the destination; defaults to 'background'
2442# (Since: 3.0)
2443#
a6b58ade
JS
2444# @auto-finalize: When false, this job will wait in a PENDING state after it has
2445# finished its work, waiting for @block-job-finalize before
2446# making any block graph changes.
2447# When true, this job will automatically
2448# perform its abort or commit actions.
2449# Defaults to true. (Since 3.1)
2450#
2451# @auto-dismiss: When false, this job will wait in a CONCLUDED state after it
2452# has completely ceased all work, and awaits @block-job-dismiss.
2453# When true, this job will automatically disappear from the query
2454# list without user intervention.
2455# Defaults to true. (Since 3.1)
4ae65a52 2456#
df92562e
FZ
2457# Returns: nothing on success.
2458#
5072f7b3 2459# Since: 2.6
f6235a25
MAL
2460#
2461# Example:
2462#
2463# -> { "execute": "blockdev-mirror",
2464# "arguments": { "device": "ide-hd0",
2465# "target": "target0",
2466# "sync": "full" } }
2467# <- { "return": {} }
2468#
df92562e
FZ
2469##
2470{ 'command': 'blockdev-mirror',
71aa9867 2471 'data': { '*job-id': 'str', 'device': 'str', 'target': 'str',
df92562e
FZ
2472 '*replaces': 'str',
2473 'sync': 'MirrorSyncMode',
2474 '*speed': 'int', '*granularity': 'uint32',
2475 '*buf-size': 'int', '*on-source-error': 'BlockdevOnError',
6cdbceb1 2476 '*on-target-error': 'BlockdevOnError',
481debaa 2477 '*filter-node-name': 'str',
a6b58ade 2478 '*copy-mode': 'MirrorCopyMode',
f55ba801
PB
2479 '*auto-finalize': 'bool', '*auto-dismiss': 'bool' },
2480 'allow-preconfig': true }
df92562e 2481
4dc9397b 2482##
5072f7b3 2483# @BlockIOThrottle:
4dc9397b
EB
2484#
2485# A set of parameters describing block throttling.
2486#
df4097ae 2487# @device: Block device name
7a9877a0 2488#
1d8bda12 2489# @id: The name or QOM path of the guest device (since: 2.8)
1ad166b6
BC
2490#
2491# @bps: total throughput limit in bytes per second
2492#
2493# @bps_rd: read throughput limit in bytes per second
2494#
2495# @bps_wr: write throughput limit in bytes per second
2496#
2497# @iops: total I/O operations per second
2498#
f5a845fd 2499# @iops_rd: read I/O operations per second
1ad166b6
BC
2500#
2501# @iops_wr: write I/O operations per second
2502#
1d8bda12 2503# @bps_max: total throughput limit during bursts,
26ec4e53 2504# in bytes (Since 1.7)
1ad166b6 2505#
1d8bda12 2506# @bps_rd_max: read throughput limit during bursts,
26ec4e53 2507# in bytes (Since 1.7)
1ad166b6 2508#
1d8bda12 2509# @bps_wr_max: write throughput limit during bursts,
26ec4e53 2510# in bytes (Since 1.7)
1ad166b6 2511#
1d8bda12 2512# @iops_max: total I/O operations per second during bursts,
26ec4e53 2513# in bytes (Since 1.7)
1ad166b6 2514#
1d8bda12 2515# @iops_rd_max: read I/O operations per second during bursts,
26ec4e53 2516# in bytes (Since 1.7)
1ad166b6 2517#
1d8bda12 2518# @iops_wr_max: write I/O operations per second during bursts,
26ec4e53 2519# in bytes (Since 1.7)
dce13204 2520#
1d8bda12 2521# @bps_max_length: maximum length of the @bps_max burst
26ec4e53
PM
2522# period, in seconds. It must only
2523# be set if @bps_max is set as well.
2524# Defaults to 1. (Since 2.6)
dce13204 2525#
1d8bda12 2526# @bps_rd_max_length: maximum length of the @bps_rd_max
26ec4e53
PM
2527# burst period, in seconds. It must only
2528# be set if @bps_rd_max is set as well.
2529# Defaults to 1. (Since 2.6)
dce13204 2530#
1d8bda12 2531# @bps_wr_max_length: maximum length of the @bps_wr_max
26ec4e53
PM
2532# burst period, in seconds. It must only
2533# be set if @bps_wr_max is set as well.
2534# Defaults to 1. (Since 2.6)
dce13204 2535#
1d8bda12 2536# @iops_max_length: maximum length of the @iops burst
26ec4e53
PM
2537# period, in seconds. It must only
2538# be set if @iops_max is set as well.
2539# Defaults to 1. (Since 2.6)
dce13204 2540#
1d8bda12 2541# @iops_rd_max_length: maximum length of the @iops_rd_max
26ec4e53
PM
2542# burst period, in seconds. It must only
2543# be set if @iops_rd_max is set as well.
2544# Defaults to 1. (Since 2.6)
dce13204 2545#
1d8bda12 2546# @iops_wr_max_length: maximum length of the @iops_wr_max
26ec4e53
PM
2547# burst period, in seconds. It must only
2548# be set if @iops_wr_max is set as well.
2549# Defaults to 1. (Since 2.6)
1ad166b6 2550#
1d8bda12 2551# @iops_size: an I/O size in bytes (Since 1.7)
1ad166b6 2552#
1d8bda12 2553# @group: throttle group name (Since 2.4)
76f4afb4 2554#
df4097ae
MA
2555# Features:
2556# @deprecated: Member @device is deprecated. Use @id instead.
2557#
1ad166b6
BC
2558# Since: 1.1
2559##
4dc9397b 2560{ 'struct': 'BlockIOThrottle',
df4097ae
MA
2561 'data': { '*device': { 'type': 'str', 'features': [ 'deprecated' ] },
2562 '*id': 'str', 'bps': 'int', 'bps_rd': 'int',
7a9877a0 2563 'bps_wr': 'int', 'iops': 'int', 'iops_rd': 'int', 'iops_wr': 'int',
1ad166b6
BC
2564 '*bps_max': 'int', '*bps_rd_max': 'int',
2565 '*bps_wr_max': 'int', '*iops_max': 'int',
2566 '*iops_rd_max': 'int', '*iops_wr_max': 'int',
dce13204
AG
2567 '*bps_max_length': 'int', '*bps_rd_max_length': 'int',
2568 '*bps_wr_max_length': 'int', '*iops_max_length': 'int',
2569 '*iops_rd_max_length': 'int', '*iops_wr_max_length': 'int',
76f4afb4 2570 '*iops_size': 'int', '*group': 'str' } }
1ad166b6 2571
432d889e
MP
2572##
2573# @ThrottleLimits:
2574#
2575# Limit parameters for throttling.
2576# Since some limit combinations are illegal, limits should always be set in one
2577# transaction. All fields are optional. When setting limits, if a field is
2578# missing the current value is not changed.
2579#
26ec4e53
PM
2580# @iops-total: limit total I/O operations per second
2581# @iops-total-max: I/O operations burst
2582# @iops-total-max-length: length of the iops-total-max burst period, in seconds
2583# It must only be set if @iops-total-max is set as well.
2584# @iops-read: limit read operations per second
2585# @iops-read-max: I/O operations read burst
2586# @iops-read-max-length: length of the iops-read-max burst period, in seconds
2587# It must only be set if @iops-read-max is set as well.
2588# @iops-write: limit write operations per second
2589# @iops-write-max: I/O operations write burst
2590# @iops-write-max-length: length of the iops-write-max burst period, in seconds
2591# It must only be set if @iops-write-max is set as well.
2592# @bps-total: limit total bytes per second
2593# @bps-total-max: total bytes burst
2594# @bps-total-max-length: length of the bps-total-max burst period, in seconds.
2595# It must only be set if @bps-total-max is set as well.
2596# @bps-read: limit read bytes per second
2597# @bps-read-max: total bytes read burst
2598# @bps-read-max-length: length of the bps-read-max burst period, in seconds
2599# It must only be set if @bps-read-max is set as well.
2600# @bps-write: limit write bytes per second
2601# @bps-write-max: total bytes write burst
2602# @bps-write-max-length: length of the bps-write-max burst period, in seconds
2603# It must only be set if @bps-write-max is set as well.
2604# @iops-size: when limiting by iops max size of an I/O in bytes
432d889e
MP
2605#
2606# Since: 2.11
2607##
2608{ 'struct': 'ThrottleLimits',
2609 'data': { '*iops-total' : 'int', '*iops-total-max' : 'int',
2610 '*iops-total-max-length' : 'int', '*iops-read' : 'int',
2611 '*iops-read-max' : 'int', '*iops-read-max-length' : 'int',
2612 '*iops-write' : 'int', '*iops-write-max' : 'int',
2613 '*iops-write-max-length' : 'int', '*bps-total' : 'int',
2614 '*bps-total-max' : 'int', '*bps-total-max-length' : 'int',
2615 '*bps-read' : 'int', '*bps-read-max' : 'int',
2616 '*bps-read-max-length' : 'int', '*bps-write' : 'int',
2617 '*bps-write-max' : 'int', '*bps-write-max-length' : 'int',
2618 '*iops-size' : 'int' } }
2619
381bd744
KW
2620##
2621# @ThrottleGroupProperties:
2622#
2623# Properties for throttle-group objects.
2624#
381bd744
KW
2625# @limits: limits to apply for this throttle group
2626#
9fb49daa
MA
2627# Features:
2628# @unstable: All members starting with x- are aliases for the same key
2629# without x- in the @limits object. This is not a stable
2630# interface and may be removed or changed incompatibly in
2631# the future. Use @limits for a supported stable
2632# interface.
2633#
381bd744
KW
2634# Since: 2.11
2635##
2636{ 'struct': 'ThrottleGroupProperties',
2637 'data': { '*limits': 'ThrottleLimits',
9fb49daa
MA
2638 '*x-iops-total': { 'type': 'int',
2639 'features': [ 'unstable' ] },
2640 '*x-iops-total-max': { 'type': 'int',
2641 'features': [ 'unstable' ] },
2642 '*x-iops-total-max-length': { 'type': 'int',
2643 'features': [ 'unstable' ] },
2644 '*x-iops-read': { 'type': 'int',
2645 'features': [ 'unstable' ] },
2646 '*x-iops-read-max': { 'type': 'int',
2647 'features': [ 'unstable' ] },
2648 '*x-iops-read-max-length': { 'type': 'int',
2649 'features': [ 'unstable' ] },
2650 '*x-iops-write': { 'type': 'int',
2651 'features': [ 'unstable' ] },
2652 '*x-iops-write-max': { 'type': 'int',
2653 'features': [ 'unstable' ] },
2654 '*x-iops-write-max-length': { 'type': 'int',
2655 'features': [ 'unstable' ] },
2656 '*x-bps-total': { 'type': 'int',
2657 'features': [ 'unstable' ] },
2658 '*x-bps-total-max': { 'type': 'int',
2659 'features': [ 'unstable' ] },
2660 '*x-bps-total-max-length': { 'type': 'int',
2661 'features': [ 'unstable' ] },
2662 '*x-bps-read': { 'type': 'int',
2663 'features': [ 'unstable' ] },
2664 '*x-bps-read-max': { 'type': 'int',
2665 'features': [ 'unstable' ] },
2666 '*x-bps-read-max-length': { 'type': 'int',
2667 'features': [ 'unstable' ] },
2668 '*x-bps-write': { 'type': 'int',
2669 'features': [ 'unstable' ] },
2670 '*x-bps-write-max': { 'type': 'int',
2671 'features': [ 'unstable' ] },
2672 '*x-bps-write-max-length': { 'type': 'int',
2673 'features': [ 'unstable' ] },
2674 '*x-iops-size': { 'type': 'int',
2675 'features': [ 'unstable' ] } } }
381bd744 2676
1ad166b6
BC
2677##
2678# @block-stream:
2679#
2680# Copy data from a backing file into a block device.
2681#
2682# The block streaming operation is performed in the background until the entire
2683# backing file has been copied. This command returns immediately once streaming
2684# has started. The status of ongoing block streaming operations can be checked
2685# with query-block-jobs. The operation can be stopped before it has completed
2686# using the block-job-cancel command.
2687#
554b6147
AG
2688# The node that receives the data is called the top image, can be located in
2689# any part of the chain (but always above the base image; see below) and can be
2690# specified using its device or node name. Earlier qemu versions only allowed
2691# 'device' to name the top level node; presence of the 'base-node' parameter
2692# during introspection can be used as a witness of the enhanced semantics
2693# of 'device'.
2694#
1ad166b6 2695# If a base file is specified then sectors are not copied from that base file and
67acfd21
HR
2696# its backing chain. This can be used to stream a subset of the backing file
2697# chain instead of flattening the entire image.
2698# When streaming completes the image file will have the base file as its backing
2699# file, unless that node was changed while the job was running. In that case,
2700# base's parent's backing (or filtered, whichever exists) child (i.e., base at
2701# the beginning of the job) will be the new backing file.
1ad166b6
BC
2702#
2703# On successful completion the image file is updated to drop the backing file
2704# and the BLOCK_JOB_COMPLETED event is emitted.
2705#
67acfd21
HR
2706# In case @device is a filter node, block-stream modifies the first non-filter
2707# overlay node below it to point to the new backing node instead of modifying
2708# @device itself.
2709#
1d8bda12 2710# @job-id: identifier for the newly-created block job. If
2323322e
AG
2711# omitted, the device name will be used. (Since 2.7)
2712#
554b6147 2713# @device: the device or node name of the top image
1ad166b6 2714#
26ec4e53 2715# @base: the common backing file name.
7f4a396d 2716# It cannot be set if @base-node or @bottom is also set.
312fe09c 2717#
1d8bda12 2718# @base-node: the node name of the backing file.
7f4a396d
VSO
2719# It cannot be set if @base or @bottom is also set. (Since 2.8)
2720#
2721# @bottom: the last node in the chain that should be streamed into
2722# top. It cannot be set if @base or @base-node is also set.
2723# It cannot be filter node. (Since 6.0)
1ad166b6 2724#
1d8bda12 2725# @backing-file: The backing file string to write into the top
26ec4e53 2726# image. This filename is not validated.
13d8cc51 2727#
26ec4e53
PM
2728# If a pathname string is such that it cannot be
2729# resolved by QEMU, that means that subsequent QMP or
2730# HMP commands must use node-names for the image in
2731# question, as filename lookup methods will fail.
13d8cc51 2732#
26ec4e53
PM
2733# If not specified, QEMU will automatically determine
2734# the backing file string to use, or error out if there
2735# is no obvious choice. Care should be taken when
2736# specifying the string, to specify a valid filename or
2737# protocol.
2738# (Since 2.1)
13d8cc51 2739#
26ec4e53 2740# @speed: the maximum speed, in bytes per second
1ad166b6 2741#
1d8bda12 2742# @on-error: the action to take on an error (default report).
1ad166b6
BC
2743# 'stop' and 'enospc' can only be used if the block device
2744# supports io-status (see BlockInfo). Since 1.3.
2745#
880747a8
AS
2746# @filter-node-name: the node name that should be assigned to the
2747# filter driver that the stream job inserts into the graph
2748# above @device. If this option is not given, a node name is
2749# autogenerated. (Since: 6.0)
2750#
241ca1ab
JS
2751# @auto-finalize: When false, this job will wait in a PENDING state after it has
2752# finished its work, waiting for @block-job-finalize before
2753# making any block graph changes.
2754# When true, this job will automatically
2755# perform its abort or commit actions.
2756# Defaults to true. (Since 3.1)
2757#
2758# @auto-dismiss: When false, this job will wait in a CONCLUDED state after it
2759# has completely ceased all work, and awaits @block-job-dismiss.
2760# When true, this job will automatically disappear from the query
2761# list without user intervention.
2762# Defaults to true. (Since 3.1)
2763#
e050e426
PM
2764# Returns: - Nothing on success.
2765# - If @device does not exist, DeviceNotFound.
49b37c23 2766#
1ad166b6 2767# Since: 1.1
49b37c23
MAL
2768#
2769# Example:
2770#
2771# -> { "execute": "block-stream",
2772# "arguments": { "device": "virtio0",
2773# "base": "/tmp/master.qcow2" } }
2774# <- { "return": {} }
2775#
1ad166b6
BC
2776##
2777{ 'command': 'block-stream',
2323322e 2778 'data': { '*job-id': 'str', 'device': 'str', '*base': 'str',
7f4a396d
VSO
2779 '*base-node': 'str', '*backing-file': 'str', '*bottom': 'str',
2780 '*speed': 'int', '*on-error': 'BlockdevOnError',
880747a8 2781 '*filter-node-name': 'str',
f55ba801
PB
2782 '*auto-finalize': 'bool', '*auto-dismiss': 'bool' },
2783 'allow-preconfig': true }
1ad166b6
BC
2784
2785##
2786# @block-job-set-speed:
2787#
2788# Set maximum speed for a background block operation.
2789#
2790# This command can only be issued when there is an active block job.
2791#
2792# Throttling can be disabled by setting the speed to 0.
2793#
6aae5be6
AG
2794# @device: The job identifier. This used to be a device name (hence
2795# the name of the parameter), but since QEMU 2.7 it can have
2796# other values.
1ad166b6 2797#
26ec4e53
PM
2798# @speed: the maximum speed, in bytes per second, or 0 for unlimited.
2799# Defaults to 0.
1ad166b6 2800#
e050e426
PM
2801# Returns: - Nothing on success
2802# - If no background operation is active on this device, DeviceNotActive
1ad166b6
BC
2803#
2804# Since: 1.1
2805##
2806{ 'command': 'block-job-set-speed',
f55ba801
PB
2807 'data': { 'device': 'str', 'speed': 'int' },
2808 'allow-preconfig': true }
1ad166b6
BC
2809
2810##
2811# @block-job-cancel:
2812#
2813# Stop an active background block operation.
2814#
2815# This command returns immediately after marking the active background block
2816# operation for cancellation. It is an error to call this command if no
2817# operation is in progress.
2818#
2819# The operation will cancel as soon as possible and then emit the
2820# BLOCK_JOB_CANCELLED event. Before that happens the job is still visible when
2821# enumerated using query-block-jobs.
2822#
c117bb14
KC
2823# Note that if you issue 'block-job-cancel' after 'drive-mirror' has indicated
2824# (via the event BLOCK_JOB_READY) that the source and destination are
2825# synchronized, then the event triggered by this command changes to
2826# BLOCK_JOB_COMPLETED, to indicate that the mirroring has ended and the
2827# destination now has a point-in-time copy tied to the time of the cancellation.
2828#
1ad166b6
BC
2829# For streaming, the image file retains its backing file unless the streaming
2830# operation happens to complete just as it is being cancelled. A new streaming
2831# operation can be started at a later time to finish copying all data from the
2832# backing file.
2833#
6aae5be6
AG
2834# @device: The job identifier. This used to be a device name (hence
2835# the name of the parameter), but since QEMU 2.7 it can have
2836# other values.
1ad166b6 2837#
b76e4458
LL
2838# @force: If true, and the job has already emitted the event BLOCK_JOB_READY,
2839# abandon the job immediately (even if it is paused) instead of waiting
2840# for the destination to complete its final synchronization (since 1.3)
1ad166b6 2841#
e050e426
PM
2842# Returns: - Nothing on success
2843# - If no background operation is active on this device, DeviceNotActive
1ad166b6
BC
2844#
2845# Since: 1.1
2846##
f55ba801
PB
2847{ 'command': 'block-job-cancel', 'data': { 'device': 'str', '*force': 'bool' },
2848 'allow-preconfig': true }
1ad166b6
BC
2849
2850##
2851# @block-job-pause:
2852#
2853# Pause an active background block operation.
2854#
2855# This command returns immediately after marking the active background block
2856# operation for pausing. It is an error to call this command if no
cd44d96b 2857# operation is in progress or if the job is already paused.
1ad166b6
BC
2858#
2859# The operation will pause as soon as possible. No event is emitted when
2860# the operation is actually paused. Cancelling a paused job automatically
2861# resumes it.
2862#
6aae5be6
AG
2863# @device: The job identifier. This used to be a device name (hence
2864# the name of the parameter), but since QEMU 2.7 it can have
2865# other values.
1ad166b6 2866#
e050e426
PM
2867# Returns: - Nothing on success
2868# - If no background operation is active on this device, DeviceNotActive
1ad166b6
BC
2869#
2870# Since: 1.3
2871##
f55ba801
PB
2872{ 'command': 'block-job-pause', 'data': { 'device': 'str' },
2873 'allow-preconfig': true }
1ad166b6
BC
2874
2875##
2876# @block-job-resume:
2877#
2878# Resume an active background block operation.
2879#
2880# This command returns immediately after resuming a paused background block
2881# operation. It is an error to call this command if no operation is in
cd44d96b 2882# progress or if the job is not paused.
1ad166b6
BC
2883#
2884# This command also clears the error status of the job.
2885#
6aae5be6
AG
2886# @device: The job identifier. This used to be a device name (hence
2887# the name of the parameter), but since QEMU 2.7 it can have
2888# other values.
1ad166b6 2889#
e050e426
PM
2890# Returns: - Nothing on success
2891# - If no background operation is active on this device, DeviceNotActive
1ad166b6
BC
2892#
2893# Since: 1.3
2894##
f55ba801
PB
2895{ 'command': 'block-job-resume', 'data': { 'device': 'str' },
2896 'allow-preconfig': true }
1ad166b6
BC
2897
2898##
2899# @block-job-complete:
2900#
2901# Manually trigger completion of an active background block operation. This
2902# is supported for drive mirroring, where it also switches the device to
2903# write to the target path only. The ability to complete is signaled with
2904# a BLOCK_JOB_READY event.
2905#
2906# This command completes an active background block operation synchronously.
2907# The ordering of this command's return with the BLOCK_JOB_COMPLETED event
2908# is not defined. Note that if an I/O error occurs during the processing of
2909# this command: 1) the command itself will fail; 2) the error will be processed
2910# according to the rerror/werror arguments that were specified when starting
2911# the operation.
2912#
2913# A cancelled or paused job cannot be completed.
2914#
6aae5be6
AG
2915# @device: The job identifier. This used to be a device name (hence
2916# the name of the parameter), but since QEMU 2.7 it can have
2917# other values.
1ad166b6 2918#
e050e426
PM
2919# Returns: - Nothing on success
2920# - If no background operation is active on this device, DeviceNotActive
1ad166b6
BC
2921#
2922# Since: 1.3
2923##
f55ba801
PB
2924{ 'command': 'block-job-complete', 'data': { 'device': 'str' },
2925 'allow-preconfig': true }
1ad166b6 2926
75f71059
JS
2927##
2928# @block-job-dismiss:
2929#
2930# For jobs that have already concluded, remove them from the block-job-query
2931# list. This command only needs to be run for jobs which were started with
2932# QEMU 2.12+ job lifetime management semantics.
2933#
2934# This command will refuse to operate on any job that has not yet reached
a50c2ab8 2935# its terminal state, JOB_STATUS_CONCLUDED. For jobs that make use of the
75f71059
JS
2936# BLOCK_JOB_READY event, block-job-cancel or block-job-complete will still need
2937# to be used as appropriate.
2938#
2939# @id: The job identifier.
2940#
2941# Returns: Nothing on success
2942#
2943# Since: 2.12
2944##
f55ba801
PB
2945{ 'command': 'block-job-dismiss', 'data': { 'id': 'str' },
2946 'allow-preconfig': true }
75f71059 2947
11b61fbc
JS
2948##
2949# @block-job-finalize:
2950#
2951# Once a job that has manual=true reaches the pending state, it can be
2952# instructed to finalize any graph changes and do any necessary cleanup
2953# via this command.
2954# For jobs in a transaction, instructing one job to finalize will force
2955# ALL jobs in the transaction to finalize, so it is only necessary to instruct
2956# a single member job to finalize.
2957#
2958# @id: The job identifier.
2959#
2960# Returns: Nothing on success
2961#
2962# Since: 2.12
2963##
f55ba801
PB
2964{ 'command': 'block-job-finalize', 'data': { 'id': 'str' },
2965 'allow-preconfig': true }
11b61fbc 2966
1ad166b6 2967##
5072f7b3 2968# @BlockdevDiscardOptions:
1ad166b6
BC
2969#
2970# Determines how to handle discard requests.
2971#
26ec4e53
PM
2972# @ignore: Ignore the request
2973# @unmap: Forward as an unmap request
1ad166b6 2974#
79b7a77e 2975# Since: 2.9
1ad166b6
BC
2976##
2977{ 'enum': 'BlockdevDiscardOptions',
2978 'data': [ 'ignore', 'unmap' ] }
2979
2980##
5072f7b3 2981# @BlockdevDetectZeroesOptions:
1ad166b6
BC
2982#
2983# Describes the operation mode for the automatic conversion of plain
2984# zero writes by the OS to driver specific optimized zero write commands.
2985#
26ec4e53
PM
2986# @off: Disabled (default)
2987# @on: Enabled
2988# @unmap: Enabled and even try to unmap blocks if possible. This requires
2989# also that @BlockdevDiscardOptions is set to unmap for this device.
1ad166b6
BC
2990#
2991# Since: 2.1
2992##
2993{ 'enum': 'BlockdevDetectZeroesOptions',
2994 'data': [ 'off', 'on', 'unmap' ] }
2995
2996##
5072f7b3 2997# @BlockdevAioOptions:
1ad166b6
BC
2998#
2999# Selects the AIO backend to handle I/O requests
3000#
26ec4e53
PM
3001# @threads: Use qemu's thread pool
3002# @native: Use native AIO backend (only Linux and Windows)
3003# @io_uring: Use linux io_uring (since 5.0)
1ad166b6 3004#
79b7a77e 3005# Since: 2.9
1ad166b6
BC
3006##
3007{ 'enum': 'BlockdevAioOptions',
f14beaec 3008 'data': [ 'threads', 'native',
8a9f1e1d 3009 { 'name': 'io_uring', 'if': 'CONFIG_LINUX_IO_URING' } ] }
1ad166b6
BC
3010
3011##
5072f7b3 3012# @BlockdevCacheOptions:
1ad166b6
BC
3013#
3014# Includes cache-related options for block devices
3015#
26ec4e53
PM
3016# @direct: enables use of O_DIRECT (bypass the host page cache;
3017# default: false)
3018# @no-flush: ignore any flush requests for the device (default:
3019# false)
1ad166b6 3020#
79b7a77e 3021# Since: 2.9
1ad166b6 3022##
895a2a80 3023{ 'struct': 'BlockdevCacheOptions',
aaa436f9 3024 'data': { '*direct': 'bool',
1ad166b6
BC
3025 '*no-flush': 'bool' } }
3026
3027##
5072f7b3 3028# @BlockdevDriver:
1ad166b6
BC
3029#
3030# Drivers that are supported in block device operations.
3031#
d8e7d87e 3032# @throttle: Since 2.11
d87ee3d7 3033# @nvme: Since 2.12
51f63ec7 3034# @copy-on-read: Since 3.0
bfcc224e 3035# @blklogwrites: Since 3.0
35e32d9e 3036# @blkreplay: Since 4.2
f41388e0 3037# @compress: Since 5.0
783b2825 3038# @copy-before-write: Since 6.2
1c14eaab 3039# @snapshot-access: Since 7.0
da92c3ff 3040#
79b7a77e 3041# Since: 2.9
1ad166b6
BC
3042##
3043{ 'enum': 'BlockdevDriver',
35e32d9e 3044 'data': [ 'blkdebug', 'blklogwrites', 'blkreplay', 'blkverify', 'bochs',
783b2825 3045 'cloop', 'compress', 'copy-before-write', 'copy-on-read', 'dmg',
1c14eaab 3046 'file', 'snapshot-access', 'ftp', 'ftps', 'gluster',
8a9f1e1d
MAL
3047 {'name': 'host_cdrom', 'if': 'HAVE_HOST_BLOCK_DEVICE' },
3048 {'name': 'host_device', 'if': 'HAVE_HOST_BLOCK_DEVICE' },
fd66dbd4
SH
3049 'http', 'https',
3050 { 'name': 'io_uring', 'if': 'CONFIG_BLKIO' },
3051 'iscsi',
3052 'luks', 'nbd', 'nfs', 'null-aio', 'null-co', 'nvme',
3053 { 'name': 'nvme-io_uring', 'if': 'CONFIG_BLKIO' },
3054 'parallels', 'preallocate', 'qcow', 'qcow2', 'qed', 'quorum',
3055 'raw', 'rbd',
8a9f1e1d 3056 { 'name': 'replication', 'if': 'CONFIG_REPLICATION' },
fd66dbd4 3057 'ssh', 'throttle', 'vdi', 'vhdx',
03d9e4c0 3058 { 'name': 'virtio-blk-vfio-pci', 'if': 'CONFIG_BLKIO' },
fd66dbd4
SH
3059 { 'name': 'virtio-blk-vhost-user', 'if': 'CONFIG_BLKIO' },
3060 { 'name': 'virtio-blk-vhost-vdpa', 'if': 'CONFIG_BLKIO' },
3061 'vmdk', 'vpc', 'vvfat' ] }
1ad166b6 3062
1ad166b6 3063##
5072f7b3 3064# @BlockdevOptionsFile:
1ad166b6 3065#
68555285 3066# Driver specific block device options for the file backend.
1ad166b6 3067#
26ec4e53
PM
3068# @filename: path to the image file
3069# @pr-manager: the id for the object that will handle persistent reservations
3070# for this device (default: none, forward the commands via SG_IO;
3071# since 2.11)
3072# @aio: AIO backend (default: threads) (since: 2.8)
684960d4
SG
3073# @aio-max-batch: maximum number of requests to batch together into a single
3074# submission in the AIO backend. The smallest value between
3075# this and the aio-max-batch value of the IOThread object is
3076# chosen.
3077# 0 means that the AIO backend will handle it automatically.
3078# (default: 0, since 6.2)
26ec4e53
PM
3079# @locking: whether to enable file locking. If set to 'auto', only enable
3080# when Open File Descriptor (OFD) locking API is available
3081# (default: auto, since 2.10)
3082# @drop-cache: invalidate page cache during live migration. This prevents
3083# stale data on the migration destination with cache.direct=off.
3084# Currently only supported on Linux hosts.
3085# (default: on, since: 4.0)
31be8a2a
SH
3086# @x-check-cache-dropped: whether to check that page cache was dropped on live
3087# migration. May cause noticeable delays if the image
3088# file is large, do not use in production.
51f63ec7 3089# (default: off) (since: 3.0)
1ad166b6 3090#
c9d40709
KW
3091# Features:
3092# @dynamic-auto-read-only: If present, enabled auto-read-only means that the
3093# driver will open the image read-only at first,
3094# dynamically reopen the image file read-write when
3095# the first writer is attached to the node and reopen
3096# read-only when the last writer is detached. This
3097# allows giving QEMU write permissions only on demand
3098# when an operation actually needs write access.
9fb49daa 3099# @unstable: Member x-check-cache-dropped is meant for debugging.
c9d40709 3100#
79b7a77e 3101# Since: 2.9
1ad166b6 3102##
895a2a80 3103{ 'struct': 'BlockdevOptionsFile',
0a4279d9 3104 'data': { 'filename': 'str',
7c9e5276 3105 '*pr-manager': 'str',
16b48d5d 3106 '*locking': 'OnOffAuto',
31be8a2a 3107 '*aio': 'BlockdevAioOptions',
684960d4 3108 '*aio-max-batch': 'int',
dbb28bc8 3109 '*drop-cache': {'type': 'bool',
8a9f1e1d 3110 'if': 'CONFIG_LINUX'},
9fb49daa
MA
3111 '*x-check-cache-dropped': { 'type': 'bool',
3112 'features': [ 'unstable' ] } },
c9d40709 3113 'features': [ { 'name': 'dynamic-auto-read-only',
8a9f1e1d 3114 'if': 'CONFIG_POSIX' } ] }
1ad166b6 3115
e819ab22 3116##
5072f7b3 3117# @BlockdevOptionsNull:
e819ab22
FZ
3118#
3119# Driver specific block device options for the null backend.
3120#
26ec4e53 3121# @size: size of the device in bytes.
1d8bda12 3122# @latency-ns: emulated latency (in nanoseconds) in processing
e5e51dd3
FZ
3123# requests. Default to zero which completes requests immediately.
3124# (Since 2.4)
128b05f7
KW
3125# @read-zeroes: if true, reads from the device produce zeroes; if false, the
3126# buffer is left unchanged. (default: false; since: 4.1)
e819ab22 3127#
79b7a77e 3128# Since: 2.9
e819ab22 3129##
895a2a80 3130{ 'struct': 'BlockdevOptionsNull',
128b05f7 3131 'data': { '*size': 'int', '*latency-ns': 'uint64', '*read-zeroes': 'bool' } }
e819ab22 3132
d87ee3d7
FZ
3133##
3134# @BlockdevOptionsNVMe:
3135#
3136# Driver specific block device options for the NVMe backend.
3137#
26ec4e53
PM
3138# @device: PCI controller address of the NVMe device in
3139# format hhhh:bb:ss.f (host:bus:slot.function)
d87ee3d7
FZ
3140# @namespace: namespace number of the device, starting from 1.
3141#
ecaf647f
DB
3142# Note that the PCI @device must have been unbound from any host
3143# kernel driver before instructing QEMU to add the blockdev.
3144#
d87ee3d7
FZ
3145# Since: 2.12
3146##
3147{ 'struct': 'BlockdevOptionsNVMe',
3148 'data': { 'device': 'str', 'namespace': 'int' } }
3149
1ad166b6 3150##
5072f7b3 3151# @BlockdevOptionsVVFAT:
1ad166b6
BC
3152#
3153# Driver specific block device options for the vvfat protocol.
3154#
26ec4e53
PM
3155# @dir: directory to be exported as FAT image
3156# @fat-type: FAT type: 12, 16 or 32
3157# @floppy: whether to export a floppy image (true) or
3158# partitioned hard disk (false; default)
3159# @label: set the volume label, limited to 11 bytes. FAT16 and
3160# FAT32 traditionally have some restrictions on labels, which are
3161# ignored by most operating systems. Defaults to "QEMU VVFAT".
3162# (since 2.4)
3163# @rw: whether to allow write operations (default: false)
1ad166b6 3164#
79b7a77e 3165# Since: 2.9
1ad166b6 3166##
895a2a80 3167{ 'struct': 'BlockdevOptionsVVFAT',
1ad166b6 3168 'data': { 'dir': 'str', '*fat-type': 'int', '*floppy': 'bool',
d5941dda 3169 '*label': 'str', '*rw': 'bool' } }
1ad166b6
BC
3170
3171##
5072f7b3 3172# @BlockdevOptionsGenericFormat:
1ad166b6
BC
3173#
3174# Driver specific block device options for image format that have no option
3175# besides their data source.
3176#
26ec4e53 3177# @file: reference to or definition of the data source block device
1ad166b6 3178#
79b7a77e 3179# Since: 2.9
1ad166b6 3180##
895a2a80 3181{ 'struct': 'BlockdevOptionsGenericFormat',
1ad166b6
BC
3182 'data': { 'file': 'BlockdevRef' } }
3183
78368575 3184##
5072f7b3 3185# @BlockdevOptionsLUKS:
78368575
DB
3186#
3187# Driver specific block device options for LUKS.
3188#
1d8bda12 3189# @key-secret: the ID of a QCryptoSecret object providing
78368575
DB
3190# the decryption key (since 2.6). Mandatory except when
3191# doing a metadata-only probe of the image.
3192#
79b7a77e 3193# Since: 2.9
78368575
DB
3194##
3195{ 'struct': 'BlockdevOptionsLUKS',
3196 'base': 'BlockdevOptionsGenericFormat',
3197 'data': { '*key-secret': 'str' } }
3198
1ad166b6 3199##
5072f7b3 3200# @BlockdevOptionsGenericCOWFormat:
1ad166b6
BC
3201#
3202# Driver specific block device options for image format that have no option
3203# besides their data source and an optional backing file.
3204#
26ec4e53
PM
3205# @backing: reference to or definition of the backing file block
3206# device, null disables the backing file entirely.
3207# Defaults to the backing file stored the image file.
1ad166b6 3208#
79b7a77e 3209# Since: 2.9
1ad166b6 3210##
895a2a80 3211{ 'struct': 'BlockdevOptionsGenericCOWFormat',
1ad166b6 3212 'base': 'BlockdevOptionsGenericFormat',
c42e8742 3213 'data': { '*backing': 'BlockdevRefOrNull' } }
1ad166b6 3214
f6585811 3215##
5072f7b3 3216# @Qcow2OverlapCheckMode:
f6585811
HR
3217#
3218# General overlap check modes.
3219#
26ec4e53 3220# @none: Do not perform any checks
f6585811 3221#
26ec4e53
PM
3222# @constant: Perform only checks which can be done in constant time and
3223# without reading anything from disk
f6585811 3224#
26ec4e53
PM
3225# @cached: Perform only checks which can be done without reading anything
3226# from disk
f6585811 3227#
26ec4e53 3228# @all: Perform all available overlap checks
f6585811 3229#
79b7a77e 3230# Since: 2.9
f6585811
HR
3231##
3232{ 'enum': 'Qcow2OverlapCheckMode',
3233 'data': [ 'none', 'constant', 'cached', 'all' ] }
3234
3235##
5072f7b3 3236# @Qcow2OverlapCheckFlags:
f6585811
HR
3237#
3238# Structure of flags for each metadata structure. Setting a field to 'true'
3239# makes qemu guard that structure against unintended overwriting. The default
3240# value is chosen according to the template given.
3241#
3242# @template: Specifies a template mode which can be adjusted using the other
3243# flags, defaults to 'cached'
3244#
0e4e4318
VSO
3245# @bitmap-directory: since 3.0
3246#
79b7a77e 3247# Since: 2.9
f6585811 3248##
895a2a80 3249{ 'struct': 'Qcow2OverlapCheckFlags',
0e4e4318
VSO
3250 'data': { '*template': 'Qcow2OverlapCheckMode',
3251 '*main-header': 'bool',
3252 '*active-l1': 'bool',
3253 '*active-l2': 'bool',
3254 '*refcount-table': 'bool',
3255 '*refcount-block': 'bool',
3256 '*snapshot-table': 'bool',
3257 '*inactive-l1': 'bool',
3258 '*inactive-l2': 'bool',
3259 '*bitmap-directory': 'bool' } }
f6585811
HR
3260
3261##
5072f7b3 3262# @Qcow2OverlapChecks:
f6585811
HR
3263#
3264# Specifies which metadata structures should be guarded against unintended
3265# overwriting.
3266#
26ec4e53
PM
3267# @flags: set of flags for separate specification of each metadata structure
3268# type
f6585811 3269#
26ec4e53 3270# @mode: named mode which chooses a specific set of flags
f6585811 3271#
79b7a77e 3272# Since: 2.9
f6585811 3273##
ab916fad 3274{ 'alternate': 'Qcow2OverlapChecks',
f6585811
HR
3275 'data': { 'flags': 'Qcow2OverlapCheckFlags',
3276 'mode': 'Qcow2OverlapCheckMode' } }
3277
d85f4222
DB
3278##
3279# @BlockdevQcowEncryptionFormat:
3280#
3281# @aes: AES-CBC with plain64 initialization vectors
3282#
3283# Since: 2.10
3284##
3285{ 'enum': 'BlockdevQcowEncryptionFormat',
3286 'data': [ 'aes' ] }
3287
3288##
3289# @BlockdevQcowEncryption:
3290#
3291# Since: 2.10
3292##
3293{ 'union': 'BlockdevQcowEncryption',
3294 'base': { 'format': 'BlockdevQcowEncryptionFormat' },
3295 'discriminator': 'format',
3296 'data': { 'aes': 'QCryptoBlockOptionsQCow' } }
3297
3298##
3299# @BlockdevOptionsQcow:
3300#
3301# Driver specific block device options for qcow.
3302#
26ec4e53
PM
3303# @encrypt: Image decryption options. Mandatory for
3304# encrypted images, except when doing a metadata-only
3305# probe of the image.
d85f4222
DB
3306#
3307# Since: 2.10
3308##
3309{ 'struct': 'BlockdevOptionsQcow',
3310 'base': 'BlockdevOptionsGenericCOWFormat',
3311 'data': { '*encrypt': 'BlockdevQcowEncryption' } }
3312
b25b387f
DB
3313##
3314# @BlockdevQcow2EncryptionFormat:
a9e2eb06 3315#
58823a0b 3316# @aes: AES-CBC with plain64 initialization vectors
b25b387f
DB
3317#
3318# Since: 2.10
3319##
3320{ 'enum': 'BlockdevQcow2EncryptionFormat',
4652b8f3 3321 'data': [ 'aes', 'luks' ] }
b25b387f
DB
3322
3323##
3324# @BlockdevQcow2Encryption:
3325#
3326# Since: 2.10
3327##
3328{ 'union': 'BlockdevQcow2Encryption',
3329 'base': { 'format': 'BlockdevQcow2EncryptionFormat' },
3330 'discriminator': 'format',
4652b8f3
DB
3331 'data': { 'aes': 'QCryptoBlockOptionsQCow',
3332 'luks': 'QCryptoBlockOptionsLUKS'} }
b25b387f 3333
33fa2222
VSO
3334##
3335# @BlockdevOptionsPreallocate:
3336#
3337# Filter driver intended to be inserted between format and protocol node
3338# and do preallocation in protocol node on write.
3339#
3340# @prealloc-align: on preallocation, align file length to this number,
3341# default 1048576 (1M)
3342#
3343# @prealloc-size: how much to preallocate, default 134217728 (128M)
3344#
3345# Since: 6.0
3346##
3347{ 'struct': 'BlockdevOptionsPreallocate',
3348 'base': 'BlockdevOptionsGenericFormat',
3349 'data': { '*prealloc-align': 'int', '*prealloc-size': 'int' } }
3350
1ad166b6 3351##
5072f7b3 3352# @BlockdevOptionsQcow2:
1ad166b6
BC
3353#
3354# Driver specific block device options for qcow2.
3355#
26ec4e53
PM
3356# @lazy-refcounts: whether to enable the lazy refcounts
3357# feature (default is taken from the image file)
1ad166b6 3358#
26ec4e53
PM
3359# @pass-discard-request: whether discard requests to the qcow2
3360# device should be forwarded to the data source
1ad166b6 3361#
1d8bda12 3362# @pass-discard-snapshot: whether discard requests for the data source
1ad166b6
BC
3363# should be issued when a snapshot operation (e.g.
3364# deleting a snapshot) frees clusters in the qcow2 file
3365#
26ec4e53
PM
3366# @pass-discard-other: whether discard requests for the data source
3367# should be issued on other occasions where a cluster
3368# gets freed
1ad166b6 3369#
26ec4e53
PM
3370# @overlap-check: which overlap checks to perform for writes
3371# to the image, defaults to 'cached' (since 2.2)
f6585811 3372#
26ec4e53
PM
3373# @cache-size: the maximum total size of the L2 table and
3374# refcount block caches in bytes (since 2.2)
f6585811 3375#
26ec4e53
PM
3376# @l2-cache-size: the maximum size of the L2 table cache in
3377# bytes (since 2.2)
f6585811 3378#
26ec4e53
PM
3379# @l2-cache-entry-size: the size of each entry in the L2 cache in
3380# bytes. It must be a power of two between 512
3381# and the cluster size. The default value is
3382# the cluster size (since 2.12)
1221fe6f 3383#
26ec4e53
PM
3384# @refcount-cache-size: the maximum size of the refcount block cache
3385# in bytes (since 2.2)
f6585811 3386#
26ec4e53
PM
3387# @cache-clean-interval: clean unused entries in the L2 and refcount
3388# caches. The interval is in seconds. The default value
3389# is 600 on supporting platforms, and 0 on other
3390# platforms. 0 disables this feature. (since 2.5)
e957b50b 3391#
26ec4e53
PM
3392# @encrypt: Image decryption options. Mandatory for
3393# encrypted images, except when doing a metadata-only
3394# probe of the image. (since 2.10)
279621c0 3395#
26ec4e53
PM
3396# @data-file: reference to or definition of the external data file.
3397# This may only be specified for images that require an
3398# external data file. If it is not specified for such
3399# an image, the data file name is loaded from the image
3400# file. (since 4.0)
0e8c08be 3401#
79b7a77e 3402# Since: 2.9
1ad166b6 3403##
895a2a80 3404{ 'struct': 'BlockdevOptionsQcow2',
1ad166b6
BC
3405 'base': 'BlockdevOptionsGenericCOWFormat',
3406 'data': { '*lazy-refcounts': 'bool',
3407 '*pass-discard-request': 'bool',
3408 '*pass-discard-snapshot': 'bool',
f6585811
HR
3409 '*pass-discard-other': 'bool',
3410 '*overlap-check': 'Qcow2OverlapChecks',
3411 '*cache-size': 'int',
3412 '*l2-cache-size': 'int',
1221fe6f 3413 '*l2-cache-entry-size': 'int',
279621c0 3414 '*refcount-cache-size': 'int',
b25b387f 3415 '*cache-clean-interval': 'int',
0e8c08be
KW
3416 '*encrypt': 'BlockdevQcow2Encryption',
3417 '*data-file': 'BlockdevRef' } }
b1de5f43 3418
ec2f5418
KW
3419##
3420# @SshHostKeyCheckMode:
3421#
f5627506
PM
3422# @none: Don't check the host key at all
3423# @hash: Compare the host key with a given hash
3424# @known_hosts: Check the host key against the known_hosts file
ec2f5418
KW
3425#
3426# Since: 2.12
3427##
3428{ 'enum': 'SshHostKeyCheckMode',
3429 'data': [ 'none', 'hash', 'known_hosts' ] }
3430
3431##
3432# @SshHostKeyCheckHashType:
3433#
f5627506
PM
3434# @md5: The given hash is an md5 hash
3435# @sha1: The given hash is an sha1 hash
bf783261 3436# @sha256: The given hash is an sha256 hash
ec2f5418
KW
3437#
3438# Since: 2.12
3439##
3440{ 'enum': 'SshHostKeyCheckHashType',
bf783261 3441 'data': [ 'md5', 'sha1', 'sha256' ] }
ec2f5418
KW
3442
3443##
3444# @SshHostKeyHash:
3445#
f5627506
PM
3446# @type: The hash algorithm used for the hash
3447# @hash: The expected hash value
ec2f5418
KW
3448#
3449# Since: 2.12
3450##
3451{ 'struct': 'SshHostKeyHash',
3452 'data': { 'type': 'SshHostKeyCheckHashType',
3453 'hash': 'str' }}
3454
ec2f5418
KW
3455##
3456# @SshHostKeyCheck:
3457#
3458# Since: 2.12
3459##
3460{ 'union': 'SshHostKeyCheck',
3461 'base': { 'mode': 'SshHostKeyCheckMode' },
3462 'discriminator': 'mode',
29cd0403 3463 'data': { 'hash': 'SshHostKeyHash' } }
ec2f5418 3464
ad0e90a6 3465##
5072f7b3 3466# @BlockdevOptionsSsh:
ad0e90a6 3467#
c0ac533b 3468# @server: host address
ad0e90a6 3469#
c0ac533b 3470# @path: path to the image on the host
ad0e90a6 3471#
c0ac533b 3472# @user: user as which to connect, defaults to current local user name
ad0e90a6 3473#
c0ac533b
AB
3474# @host-key-check: Defines how and what to check the host key against
3475# (default: known_hosts)
ad0e90a6 3476#
79b7a77e 3477# Since: 2.9
ad0e90a6
AA
3478##
3479{ 'struct': 'BlockdevOptionsSsh',
3480 'data': { 'server': 'InetSocketAddress',
3481 'path': 'str',
ec2f5418
KW
3482 '*user': 'str',
3483 '*host-key-check': 'SshHostKeyCheck' } }
ad0e90a6 3484
1ad166b6 3485##
5072f7b3 3486# @BlkdebugEvent:
1ad166b6
BC
3487#
3488# Trigger events supported by blkdebug.
a31939e6 3489#
26ec4e53
PM
3490# @l1_shrink_write_table: write zeros to the l1 table to shrink image.
3491# (since 2.11)
46b732cd
PB
3492#
3493# @l1_shrink_free_l2_clusters: discard the l2 tables. (since 2.11)
3494#
d855ebcd
EB
3495# @cor_write: a write due to copy-on-read (since 2.11)
3496#
c8bb23cb
AN
3497# @cluster_alloc_space: an allocation of file space for a cluster (since 4.1)
3498#
f8cec157
HR
3499# @none: triggers once at creation of the blkdebug node (since 4.1)
3500#
79b7a77e 3501# Since: 2.9
1ad166b6 3502##
a31939e6 3503{ 'enum': 'BlkdebugEvent', 'prefix': 'BLKDBG',
5be5b776
EB
3504 'data': [ 'l1_update', 'l1_grow_alloc_table', 'l1_grow_write_table',
3505 'l1_grow_activate_table', 'l2_load', 'l2_update',
3506 'l2_update_compressed', 'l2_alloc_cow_read', 'l2_alloc_write',
1ad166b6
BC
3507 'read_aio', 'read_backing_aio', 'read_compressed', 'write_aio',
3508 'write_compressed', 'vmstate_load', 'vmstate_save', 'cow_read',
3509 'cow_write', 'reftable_load', 'reftable_grow', 'reftable_update',
3510 'refblock_load', 'refblock_update', 'refblock_update_part',
5be5b776
EB
3511 'refblock_alloc', 'refblock_alloc_hookup', 'refblock_alloc_write',
3512 'refblock_alloc_write_blocks', 'refblock_alloc_write_table',
3513 'refblock_alloc_switch_table', 'cluster_alloc',
1ad166b6 3514 'cluster_alloc_bytes', 'cluster_free', 'flush_to_os',
5be5b776
EB
3515 'flush_to_disk', 'pwritev_rmw_head', 'pwritev_rmw_after_head',
3516 'pwritev_rmw_tail', 'pwritev_rmw_after_tail', 'pwritev',
46b732cd 3517 'pwritev_zero', 'pwritev_done', 'empty_image_prepare',
d855ebcd 3518 'l1_shrink_write_table', 'l1_shrink_free_l2_clusters',
f8cec157 3519 'cor_write', 'cluster_alloc_space', 'none'] }
1ad166b6 3520
16789db3
HR
3521##
3522# @BlkdebugIOType:
3523#
3524# Kinds of I/O that blkdebug can inject errors in.
3525#
3526# @read: .bdrv_co_preadv()
3527#
3528# @write: .bdrv_co_pwritev()
3529#
3530# @write-zeroes: .bdrv_co_pwrite_zeroes()
3531#
3532# @discard: .bdrv_co_pdiscard()
3533#
3534# @flush: .bdrv_co_flush_to_disk()
3535#
1adb0b5e
HR
3536# @block-status: .bdrv_co_block_status()
3537#
16789db3
HR
3538# Since: 4.1
3539##
3540{ 'enum': 'BlkdebugIOType', 'prefix': 'BLKDEBUG_IO_TYPE',
1adb0b5e
HR
3541 'data': [ 'read', 'write', 'write-zeroes', 'discard', 'flush',
3542 'block-status' ] }
16789db3 3543
1ad166b6 3544##
5072f7b3 3545# @BlkdebugInjectErrorOptions:
1ad166b6
BC
3546#
3547# Describes a single error injection for blkdebug.
3548#
26ec4e53 3549# @event: trigger event
1ad166b6 3550#
26ec4e53
PM
3551# @state: the state identifier blkdebug needs to be in to
3552# actually trigger the event; defaults to "any"
1ad166b6 3553#
26ec4e53
PM
3554# @iotype: the type of I/O operations on which this error should
3555# be injected; defaults to "all read, write,
3556# write-zeroes, discard, and flush operations"
3557# (since: 4.1)
16789db3 3558#
26ec4e53
PM
3559# @errno: error identifier (errno) to be returned; defaults to
3560# EIO
1ad166b6 3561#
26ec4e53
PM
3562# @sector: specifies the sector index which has to be affected
3563# in order to actually trigger the event; defaults to "any
3564# sector"
1ad166b6 3565#
26ec4e53
PM
3566# @once: disables further events after this one has been
3567# triggered; defaults to false
1ad166b6 3568#
1d8bda12 3569# @immediately: fail immediately; defaults to false
1ad166b6 3570#
79b7a77e 3571# Since: 2.9
1ad166b6 3572##
895a2a80 3573{ 'struct': 'BlkdebugInjectErrorOptions',
1ad166b6
BC
3574 'data': { 'event': 'BlkdebugEvent',
3575 '*state': 'int',
16789db3 3576 '*iotype': 'BlkdebugIOType',
1ad166b6
BC
3577 '*errno': 'int',
3578 '*sector': 'int',
3579 '*once': 'bool',
3580 '*immediately': 'bool' } }
3581
3582##
5072f7b3 3583# @BlkdebugSetStateOptions:
1ad166b6
BC
3584#
3585# Describes a single state-change event for blkdebug.
3586#
26ec4e53 3587# @event: trigger event
1ad166b6 3588#
26ec4e53
PM
3589# @state: the current state identifier blkdebug needs to be in;
3590# defaults to "any"
1ad166b6 3591#
26ec4e53
PM
3592# @new_state: the state identifier blkdebug is supposed to assume if
3593# this event is triggered
1ad166b6 3594#
79b7a77e 3595# Since: 2.9
1ad166b6 3596##
895a2a80 3597{ 'struct': 'BlkdebugSetStateOptions',
1ad166b6
BC
3598 'data': { 'event': 'BlkdebugEvent',
3599 '*state': 'int',
3600 'new_state': 'int' } }
3601
3602##
5072f7b3 3603# @BlockdevOptionsBlkdebug:
1ad166b6
BC
3604#
3605# Driver specific block device options for blkdebug.
3606#
26ec4e53 3607# @image: underlying raw block device (or image file)
1ad166b6 3608#
26ec4e53 3609# @config: filename of the configuration file
1ad166b6 3610#
26ec4e53
PM
3611# @align: required alignment for requests in bytes, must be
3612# positive power of 2, or 0 for default
430b26a8 3613#
26ec4e53
PM
3614# @max-transfer: maximum size for I/O transfers in bytes, must be
3615# positive multiple of @align and of the underlying
3616# file's request alignment (but need not be a power of
3617# 2), or 0 for default (since 2.10)
430b26a8 3618#
26ec4e53
PM
3619# @opt-write-zero: preferred alignment for write zero requests in bytes,
3620# must be positive multiple of @align and of the
3621# underlying file's request alignment (but need not be a
3622# power of 2), or 0 for default (since 2.10)
430b26a8 3623#
26ec4e53
PM
3624# @max-write-zero: maximum size for write zero requests in bytes, must be
3625# positive multiple of @align, of @opt-write-zero, and of
3626# the underlying file's request alignment (but need not
3627# be a power of 2), or 0 for default (since 2.10)
430b26a8 3628#
26ec4e53
PM
3629# @opt-discard: preferred alignment for discard requests in bytes, must
3630# be positive multiple of @align and of the underlying
3631# file's request alignment (but need not be a power of
3632# 2), or 0 for default (since 2.10)
430b26a8 3633#
26ec4e53
PM
3634# @max-discard: maximum size for discard requests in bytes, must be
3635# positive multiple of @align, of @opt-discard, and of
3636# the underlying file's request alignment (but need not
3637# be a power of 2), or 0 for default (since 2.10)
1ad166b6 3638#
26ec4e53 3639# @inject-error: array of error injection descriptions
1ad166b6 3640#
26ec4e53 3641# @set-state: array of state-change descriptions
1ad166b6 3642#
69c6449f
HR
3643# @take-child-perms: Permissions to take on @image in addition to what
3644# is necessary anyway (which depends on how the
3645# blkdebug node is used). Defaults to none.
3646# (since 5.0)
3647#
3648# @unshare-child-perms: Permissions not to share on @image in addition
3649# to what cannot be shared anyway (which depends
3650# on how the blkdebug node is used). Defaults
3651# to none. (since 5.0)
3652#
79b7a77e 3653# Since: 2.9
1ad166b6 3654##
895a2a80 3655{ 'struct': 'BlockdevOptionsBlkdebug',
1ad166b6
BC
3656 'data': { 'image': 'BlockdevRef',
3657 '*config': 'str',
430b26a8
EB
3658 '*align': 'int', '*max-transfer': 'int32',
3659 '*opt-write-zero': 'int32', '*max-write-zero': 'int32',
3660 '*opt-discard': 'int32', '*max-discard': 'int32',
1ad166b6 3661 '*inject-error': ['BlkdebugInjectErrorOptions'],
69c6449f
HR
3662 '*set-state': ['BlkdebugSetStateOptions'],
3663 '*take-child-perms': ['BlockPermission'],
3664 '*unshare-child-perms': ['BlockPermission'] } }
1ad166b6 3665
bfcc224e
AV
3666##
3667# @BlockdevOptionsBlklogwrites:
3668#
3669# Driver specific block device options for blklogwrites.
3670#
26ec4e53 3671# @file: block device
bfcc224e 3672#
26ec4e53 3673# @log: block device used to log writes to @file
bfcc224e
AV
3674#
3675# @log-sector-size: sector size used in logging writes to @file, determines
3676# granularity of offsets and sizes of writes (default: 512)
3677#
26ec4e53 3678# @log-append: append to an existing log (default: false)
7769eaa5 3679#
1dce698e
AS
3680# @log-super-update-interval: interval of write requests after which the log
3681# super block is updated to disk (default: 4096)
3682#
bfcc224e
AV
3683# Since: 3.0
3684##
3685{ 'struct': 'BlockdevOptionsBlklogwrites',
3686 'data': { 'file': 'BlockdevRef',
3687 'log': 'BlockdevRef',
0878b3c1 3688 '*log-sector-size': 'uint32',
1dce698e
AS
3689 '*log-append': 'bool',
3690 '*log-super-update-interval': 'uint64' } }
bfcc224e 3691
1ad166b6 3692##
5072f7b3 3693# @BlockdevOptionsBlkverify:
1ad166b6
BC
3694#
3695# Driver specific block device options for blkverify.
3696#
26ec4e53 3697# @test: block device to be tested
1ad166b6 3698#
26ec4e53 3699# @raw: raw image used for verification
1ad166b6 3700#
79b7a77e 3701# Since: 2.9
1ad166b6 3702##
895a2a80 3703{ 'struct': 'BlockdevOptionsBlkverify',
1ad166b6
BC
3704 'data': { 'test': 'BlockdevRef',
3705 'raw': 'BlockdevRef' } }
3706
35e32d9e
PD
3707##
3708# @BlockdevOptionsBlkreplay:
3709#
3710# Driver specific block device options for blkreplay.
3711#
26ec4e53 3712# @image: disk image which should be controlled with blkreplay
35e32d9e
PD
3713#
3714# Since: 4.2
3715##
3716{ 'struct': 'BlockdevOptionsBlkreplay',
3717 'data': { 'image': 'BlockdevRef' } }
3718
62c6031f 3719##
5072f7b3 3720# @QuorumReadPattern:
62c6031f
LY
3721#
3722# An enumeration of quorum read patterns.
3723#
3724# @quorum: read all the children and do a quorum vote on reads
3725#
3726# @fifo: read only from the first child that has not failed
3727#
79b7a77e 3728# Since: 2.9
62c6031f
LY
3729##
3730{ 'enum': 'QuorumReadPattern', 'data': [ 'quorum', 'fifo' ] }
3731
1ad166b6 3732##
5072f7b3 3733# @BlockdevOptionsQuorum:
1ad166b6
BC
3734#
3735# Driver specific block device options for Quorum
3736#
26ec4e53 3737# @blkverify: true if the driver must print content mismatch
1ad166b6
BC
3738# set to false by default
3739#
26ec4e53 3740# @children: the children block devices to use
1ad166b6
BC
3741#
3742# @vote-threshold: the vote limit under which a read will fail
3743#
1d8bda12 3744# @rewrite-corrupted: rewrite corrupted data when quorum is reached
cf29a570
BC
3745# (Since 2.1)
3746#
1d8bda12 3747# @read-pattern: choose read pattern and set to quorum by default
62c6031f
LY
3748# (Since 2.2)
3749#
79b7a77e 3750# Since: 2.9
1ad166b6 3751##
895a2a80 3752{ 'struct': 'BlockdevOptionsQuorum',
1ad166b6
BC
3753 'data': { '*blkverify': 'bool',
3754 'children': [ 'BlockdevRef' ],
62c6031f
LY
3755 'vote-threshold': 'int',
3756 '*rewrite-corrupted': 'bool',
3757 '*read-pattern': 'QuorumReadPattern' } }
1ad166b6 3758
7edac2dd 3759##
5072f7b3 3760# @BlockdevOptionsGluster:
7edac2dd
PKK
3761#
3762# Driver specific block device options for Gluster
3763#
26ec4e53 3764# @volume: name of gluster volume where VM image resides
7edac2dd 3765#
26ec4e53 3766# @path: absolute path to image file in gluster volume
7edac2dd 3767#
26ec4e53 3768# @server: gluster servers description
7edac2dd 3769#
26ec4e53
PM
3770# @debug: libgfapi log level (default '4' which is Error)
3771# (Since 2.8)
7edac2dd 3772#
26ec4e53 3773# @logfile: libgfapi log file (default /dev/stderr) (Since 2.8)
e9db8ff3 3774#
79b7a77e 3775# Since: 2.9
7edac2dd
PKK
3776##
3777{ 'struct': 'BlockdevOptionsGluster',
3778 'data': { 'volume': 'str',
3779 'path': 'str',
62cf396b 3780 'server': ['SocketAddress'],
1a417e46 3781 '*debug': 'int',
e9db8ff3 3782 '*logfile': 'str' } }
7edac2dd 3783
fd66dbd4
SH
3784##
3785# @BlockdevOptionsIoUring:
3786#
3787# Driver specific block device options for the io_uring backend.
3788#
3789# @filename: path to the image file
3790#
3791# Since: 7.2
3792##
3793{ 'struct': 'BlockdevOptionsIoUring',
3794 'data': { 'filename': 'str' },
3795 'if': 'CONFIG_BLKIO' }
3796
3797##
3798# @BlockdevOptionsNvmeIoUring:
3799#
3800# Driver specific block device options for the nvme-io_uring backend.
3801#
c7853265 3802# @path: path to the NVMe namespace's character device (e.g. /dev/ng0n1).
fd66dbd4
SH
3803#
3804# Since: 7.2
3805##
3806{ 'struct': 'BlockdevOptionsNvmeIoUring',
6c32fc0d 3807 'data': { 'path': 'str' },
fd66dbd4
SH
3808 'if': 'CONFIG_BLKIO' }
3809
03d9e4c0
AF
3810##
3811# @BlockdevOptionsVirtioBlkVfioPci:
3812#
3813# Driver specific block device options for the virtio-blk-vfio-pci backend.
3814#
3815# @path: path to the PCI device's sysfs directory (e.g.
3816# /sys/bus/pci/devices/0000:00:01.0).
3817#
3818# Since: 7.2
3819##
3820{ 'struct': 'BlockdevOptionsVirtioBlkVfioPci',
3821 'data': { 'path': 'str' },
3822 'if': 'CONFIG_BLKIO' }
3823
fd66dbd4
SH
3824##
3825# @BlockdevOptionsVirtioBlkVhostUser:
3826#
3827# Driver specific block device options for the virtio-blk-vhost-user backend.
3828#
3829# @path: path to the vhost-user UNIX domain socket.
3830#
3831# Since: 7.2
3832##
3833{ 'struct': 'BlockdevOptionsVirtioBlkVhostUser',
3834 'data': { 'path': 'str' },
3835 'if': 'CONFIG_BLKIO' }
3836
3837##
3838# @BlockdevOptionsVirtioBlkVhostVdpa:
3839#
3840# Driver specific block device options for the virtio-blk-vhost-vdpa backend.
3841#
3842# @path: path to the vhost-vdpa character device.
3843#
3844# Since: 7.2
3845##
3846{ 'struct': 'BlockdevOptionsVirtioBlkVhostVdpa',
3847 'data': { 'path': 'str' },
3848 'if': 'CONFIG_BLKIO' }
3849
31eb1202
KW
3850##
3851# @IscsiTransport:
3852#
3853# An enumeration of libiscsi transport types
3854#
3855# Since: 2.9
3856##
3857{ 'enum': 'IscsiTransport',
3858 'data': [ 'tcp', 'iser' ] }
3859
3860##
3861# @IscsiHeaderDigest:
3862#
3863# An enumeration of header digests supported by libiscsi
3864#
3865# Since: 2.9
3866##
3867{ 'enum': 'IscsiHeaderDigest',
3868 'prefix': 'QAPI_ISCSI_HEADER_DIGEST',
3869 'data': [ 'crc32c', 'none', 'crc32c-none', 'none-crc32c' ] }
3870
3871##
3872# @BlockdevOptionsIscsi:
3873#
26ec4e53 3874# @transport: The iscsi transport type
31eb1202 3875#
26ec4e53 3876# @portal: The address of the iscsi portal
31eb1202 3877#
26ec4e53 3878# @target: The target iqn name
31eb1202 3879#
26ec4e53 3880# @lun: LUN to connect to. Defaults to 0.
31eb1202 3881#
26ec4e53
PM
3882# @user: User name to log in with. If omitted, no CHAP
3883# authentication is performed.
31eb1202 3884#
1d8bda12 3885# @password-secret: The ID of a QCryptoSecret object providing
31eb1202
KW
3886# the password for the login. This option is required if
3887# @user is specified.
3888#
26ec4e53
PM
3889# @initiator-name: The iqn name we want to identify to the target
3890# as. If this option is not specified, an initiator name is
3891# generated automatically.
31eb1202 3892#
26ec4e53
PM
3893# @header-digest: The desired header digest. Defaults to
3894# none-crc32c.
31eb1202 3895#
26ec4e53
PM
3896# @timeout: Timeout in seconds after which a request will
3897# timeout. 0 means no timeout and is the default.
31eb1202
KW
3898#
3899# Driver specific block device options for iscsi
3900#
3901# Since: 2.9
3902##
3903{ 'struct': 'BlockdevOptionsIscsi',
3904 'data': { 'transport': 'IscsiTransport',
3905 'portal': 'str',
3906 'target': 'str',
3907 '*lun': 'int',
3908 '*user': 'str',
3909 '*password-secret': 'str',
3910 '*initiator-name': 'str',
3911 '*header-digest': 'IscsiHeaderDigest',
3912 '*timeout': 'int' } }
3913
a3699de4
MA
3914##
3915# @RbdAuthMode:
3916#
3917# Since: 3.0
3918##
3919{ 'enum': 'RbdAuthMode',
3920 'data': [ 'cephx', 'none' ] }
3921
42e4ac9e
OO
3922##
3923# @RbdImageEncryptionFormat:
3924#
b8f218ef
OO
3925# @luks-any: Used for opening either luks or luks2 (Since 8.0)
3926#
42e4ac9e
OO
3927# Since: 6.1
3928##
3929{ 'enum': 'RbdImageEncryptionFormat',
b8f218ef 3930 'data': [ 'luks', 'luks2', 'luks-any' ] }
42e4ac9e
OO
3931
3932##
3933# @RbdEncryptionOptionsLUKSBase:
3934#
3935# @key-secret: ID of a QCryptoSecret object providing a passphrase
3936# for unlocking the encryption
3937#
3938# Since: 6.1
3939##
3940{ 'struct': 'RbdEncryptionOptionsLUKSBase',
3941 'data': { 'key-secret': 'str' } }
3942
3943##
3944# @RbdEncryptionCreateOptionsLUKSBase:
3945#
3946# @cipher-alg: The encryption algorithm
3947#
3948# Since: 6.1
3949##
3950{ 'struct': 'RbdEncryptionCreateOptionsLUKSBase',
3951 'base': 'RbdEncryptionOptionsLUKSBase',
3952 'data': { '*cipher-alg': 'QCryptoCipherAlgorithm' } }
3953
3954##
3955# @RbdEncryptionOptionsLUKS:
3956#
3957# Since: 6.1
3958##
3959{ 'struct': 'RbdEncryptionOptionsLUKS',
3960 'base': 'RbdEncryptionOptionsLUKSBase',
3961 'data': { } }
3962
3963##
3964# @RbdEncryptionOptionsLUKS2:
3965#
3966# Since: 6.1
3967##
3968{ 'struct': 'RbdEncryptionOptionsLUKS2',
3969 'base': 'RbdEncryptionOptionsLUKSBase',
3970 'data': { } }
3971
b8f218ef
OO
3972##
3973# @RbdEncryptionOptionsLUKSAny:
3974#
3975# Since: 8.0
3976##
3977{ 'struct': 'RbdEncryptionOptionsLUKSAny',
3978 'base': 'RbdEncryptionOptionsLUKSBase',
3979 'data': { } }
3980
42e4ac9e
OO
3981##
3982# @RbdEncryptionCreateOptionsLUKS:
3983#
3984# Since: 6.1
3985##
3986{ 'struct': 'RbdEncryptionCreateOptionsLUKS',
3987 'base': 'RbdEncryptionCreateOptionsLUKSBase',
3988 'data': { } }
3989
3990##
3991# @RbdEncryptionCreateOptionsLUKS2:
3992#
3993# Since: 6.1
3994##
3995{ 'struct': 'RbdEncryptionCreateOptionsLUKS2',
3996 'base': 'RbdEncryptionCreateOptionsLUKSBase',
3997 'data': { } }
3998
3999##
4000# @RbdEncryptionOptions:
4001#
4002# Since: 6.1
4003##
4004{ 'union': 'RbdEncryptionOptions',
4005 'base': { 'format': 'RbdImageEncryptionFormat' },
4006 'discriminator': 'format',
4007 'data': { 'luks': 'RbdEncryptionOptionsLUKS',
b8f218ef
OO
4008 'luks2': 'RbdEncryptionOptionsLUKS2',
4009 'luks-any': 'RbdEncryptionOptionsLUKSAny'} }
42e4ac9e
OO
4010
4011##
4012# @RbdEncryptionCreateOptions:
4013#
4014# Since: 6.1
4015##
4016{ 'union': 'RbdEncryptionCreateOptions',
4017 'base': { 'format': 'RbdImageEncryptionFormat' },
4018 'discriminator': 'format',
4019 'data': { 'luks': 'RbdEncryptionCreateOptionsLUKS',
4020 'luks2': 'RbdEncryptionCreateOptionsLUKS2' } }
4021
8a47e8eb
JC
4022##
4023# @BlockdevOptionsRbd:
4024#
26ec4e53 4025# @pool: Ceph pool name.
8a47e8eb 4026#
19ae9ae0
FF
4027# @namespace: Rados namespace name in the Ceph pool. (Since 5.0)
4028#
26ec4e53 4029# @image: Image name in the Ceph pool.
8a47e8eb 4030#
26ec4e53
PM
4031# @conf: path to Ceph configuration file. Values
4032# in the configuration file will be overridden by
4033# options specified via QAPI.
8a47e8eb 4034#
26ec4e53 4035# @snapshot: Ceph snapshot name.
8a47e8eb 4036#
42e4ac9e
OO
4037# @encrypt: Image encryption options. (Since 6.1)
4038#
26ec4e53 4039# @user: Ceph id name.
8a47e8eb 4040#
a3699de4 4041# @auth-client-required: Acceptable authentication modes.
26ec4e53
PM
4042# This maps to Ceph configuration option
4043# "auth_client_required". (Since 3.0)
a3699de4 4044#
26ec4e53
PM
4045# @key-secret: ID of a QCryptoSecret object providing a key
4046# for cephx authentication.
4047# This maps to Ceph configuration option
4048# "key". (Since 3.0)
d083f954 4049#
26ec4e53
PM
4050# @server: Monitor host address and port. This maps
4051# to the "mon_host" Ceph option.
0a55679b 4052#
8a47e8eb
JC
4053# Since: 2.9
4054##
4055{ 'struct': 'BlockdevOptionsRbd',
4056 'data': { 'pool': 'str',
19ae9ae0 4057 '*namespace': 'str',
8a47e8eb
JC
4058 'image': 'str',
4059 '*conf': 'str',
4060 '*snapshot': 'str',
42e4ac9e 4061 '*encrypt': 'RbdEncryptionOptions',
8a47e8eb 4062 '*user': 'str',
a3699de4 4063 '*auth-client-required': ['RbdAuthMode'],
d083f954 4064 '*key-secret': 'str',
577d8c9a 4065 '*server': ['InetSocketAddressBase'] } }
8a47e8eb 4066
190b9a8b 4067##
5072f7b3 4068# @ReplicationMode:
190b9a8b
CX
4069#
4070# An enumeration of replication modes.
4071#
4072# @primary: Primary mode, the vm's state will be sent to secondary QEMU.
4073#
4074# @secondary: Secondary mode, receive the vm's state from primary QEMU.
4075#
79b7a77e 4076# Since: 2.9
190b9a8b 4077##
335d10cd 4078{ 'enum' : 'ReplicationMode', 'data' : [ 'primary', 'secondary' ],
8a9f1e1d 4079 'if': 'CONFIG_REPLICATION' }
190b9a8b 4080
82ac5543 4081##
5072f7b3 4082# @BlockdevOptionsReplication:
82ac5543
WC
4083#
4084# Driver specific block device options for replication
4085#
4086# @mode: the replication mode
4087#
1d8bda12 4088# @top-id: In secondary mode, node name or device ID of the root
f4f2539b
CX
4089# node who owns the replication node chain. Must not be given in
4090# primary mode.
82ac5543 4091#
79b7a77e 4092# Since: 2.9
82ac5543
WC
4093##
4094{ 'struct': 'BlockdevOptionsReplication',
4095 'base': 'BlockdevOptionsGenericFormat',
4096 'data': { 'mode': 'ReplicationMode',
335d10cd 4097 '*top-id': 'str' },
8a9f1e1d 4098 'if': 'CONFIG_REPLICATION' }
82ac5543 4099
aa2623d8 4100##
5072f7b3 4101# @NFSTransport:
aa2623d8
AA
4102#
4103# An enumeration of NFS transport types
4104#
26ec4e53 4105# @inet: TCP transport
aa2623d8 4106#
79b7a77e 4107# Since: 2.9
aa2623d8
AA
4108##
4109{ 'enum': 'NFSTransport',
4110 'data': [ 'inet' ] }
4111
4112##
5072f7b3 4113# @NFSServer:
aa2623d8
AA
4114#
4115# Captures the address of the socket
4116#
26ec4e53 4117# @type: transport type used for NFS (only TCP supported)
aa2623d8 4118#
26ec4e53 4119# @host: host address for NFS server
aa2623d8 4120#
79b7a77e 4121# Since: 2.9
aa2623d8
AA
4122##
4123{ 'struct': 'NFSServer',
4124 'data': { 'type': 'NFSTransport',
4125 'host': 'str' } }
4126
4127##
5072f7b3 4128# @BlockdevOptionsNfs:
aa2623d8
AA
4129#
4130# Driver specific block device option for NFS
4131#
26ec4e53 4132# @server: host address
aa2623d8 4133#
26ec4e53 4134# @path: path of the image on the host
aa2623d8 4135#
26ec4e53
PM
4136# @user: UID value to use when talking to the
4137# server (defaults to 65534 on Windows and getuid()
4138# on unix)
aa2623d8 4139#
26ec4e53
PM
4140# @group: GID value to use when talking to the
4141# server (defaults to 65534 on Windows and getgid()
4142# in unix)
aa2623d8 4143#
26ec4e53
PM
4144# @tcp-syn-count: number of SYNs during the session
4145# establishment (defaults to libnfs default)
aa2623d8 4146#
26ec4e53
PM
4147# @readahead-size: set the readahead size in bytes (defaults
4148# to libnfs default)
aa2623d8 4149#
26ec4e53
PM
4150# @page-cache-size: set the pagecache size in bytes (defaults
4151# to libnfs default)
aa2623d8 4152#
26ec4e53
PM
4153# @debug: set the NFS debug level (max 2) (defaults
4154# to libnfs default)
aa2623d8 4155#
79b7a77e 4156# Since: 2.9
aa2623d8
AA
4157##
4158{ 'struct': 'BlockdevOptionsNfs',
4159 'data': { 'server': 'NFSServer',
4160 'path': 'str',
4161 '*user': 'int',
4162 '*group': 'int',
4163 '*tcp-syn-count': 'int',
4164 '*readahead-size': 'int',
4165 '*page-cache-size': 'int',
7103d916 4166 '*debug': 'int' } }
aa2623d8 4167
68555285 4168##
6b9d62db 4169# @BlockdevOptionsCurlBase:
68555285 4170#
6b9d62db
HR
4171# Driver specific block device options shared by all protocols supported by the
4172# curl backend.
68555285 4173#
26ec4e53 4174# @url: URL of the image file
6b9d62db 4175#
26ec4e53
PM
4176# @readahead: Size of the read-ahead cache; must be a multiple of
4177# 512 (defaults to 256 kB)
6b9d62db 4178#
26ec4e53 4179# @timeout: Timeout for connections, in seconds (defaults to 5)
6b9d62db 4180#
26ec4e53 4181# @username: Username for authentication (defaults to none)
6b9d62db 4182#
26ec4e53
PM
4183# @password-secret: ID of a QCryptoSecret object providing a password
4184# for authentication (defaults to no password)
6b9d62db 4185#
26ec4e53 4186# @proxy-username: Username for proxy authentication (defaults to none)
6b9d62db 4187#
26ec4e53
PM
4188# @proxy-password-secret: ID of a QCryptoSecret object providing a password
4189# for proxy authentication (defaults to no password)
6b9d62db
HR
4190#
4191# Since: 2.9
4192##
4193{ 'struct': 'BlockdevOptionsCurlBase',
4194 'data': { 'url': 'str',
4195 '*readahead': 'int',
4196 '*timeout': 'int',
4197 '*username': 'str',
4198 '*password-secret': 'str',
4199 '*proxy-username': 'str',
4200 '*proxy-password-secret': 'str' } }
4201
4202##
4203# @BlockdevOptionsCurlHttp:
4204#
4205# Driver specific block device options for HTTP connections over the curl
4206# backend. URLs must start with "http://".
4207#
26ec4e53
PM
4208# @cookie: List of cookies to set; format is
4209# "name1=content1; name2=content2;" as explained by
4210# CURLOPT_COOKIE(3). Defaults to no cookies.
6b9d62db 4211#
327c8ebd
PK
4212# @cookie-secret: ID of a QCryptoSecret object providing the cookie data in a
4213# secure way. See @cookie for the format. (since 2.10)
4214#
6b9d62db
HR
4215# Since: 2.9
4216##
4217{ 'struct': 'BlockdevOptionsCurlHttp',
4218 'base': 'BlockdevOptionsCurlBase',
327c8ebd
PK
4219 'data': { '*cookie': 'str',
4220 '*cookie-secret': 'str'} }
6b9d62db
HR
4221
4222##
4223# @BlockdevOptionsCurlHttps:
4224#
4225# Driver specific block device options for HTTPS connections over the curl
4226# backend. URLs must start with "https://".
4227#
26ec4e53
PM
4228# @cookie: List of cookies to set; format is
4229# "name1=content1; name2=content2;" as explained by
4230# CURLOPT_COOKIE(3). Defaults to no cookies.
6b9d62db 4231#
26ec4e53
PM
4232# @sslverify: Whether to verify the SSL certificate's validity (defaults to
4233# true)
6b9d62db 4234#
327c8ebd
PK
4235# @cookie-secret: ID of a QCryptoSecret object providing the cookie data in a
4236# secure way. See @cookie for the format. (since 2.10)
4237#
6b9d62db
HR
4238# Since: 2.9
4239##
4240{ 'struct': 'BlockdevOptionsCurlHttps',
4241 'base': 'BlockdevOptionsCurlBase',
4242 'data': { '*cookie': 'str',
327c8ebd
PK
4243 '*sslverify': 'bool',
4244 '*cookie-secret': 'str'} }
6b9d62db
HR
4245
4246##
4247# @BlockdevOptionsCurlFtp:
4248#
4249# Driver specific block device options for FTP connections over the curl
4250# backend. URLs must start with "ftp://".
4251#
4252# Since: 2.9
4253##
4254{ 'struct': 'BlockdevOptionsCurlFtp',
4255 'base': 'BlockdevOptionsCurlBase',
4256 'data': { } }
4257
4258##
4259# @BlockdevOptionsCurlFtps:
4260#
4261# Driver specific block device options for FTPS connections over the curl
4262# backend. URLs must start with "ftps://".
4263#
26ec4e53
PM
4264# @sslverify: Whether to verify the SSL certificate's validity (defaults to
4265# true)
68555285 4266#
79b7a77e 4267# Since: 2.9
68555285 4268##
6b9d62db
HR
4269{ 'struct': 'BlockdevOptionsCurlFtps',
4270 'base': 'BlockdevOptionsCurlBase',
4271 'data': { '*sslverify': 'bool' } }
68555285 4272
6b02b1f0 4273##
5072f7b3 4274# @BlockdevOptionsNbd:
6b02b1f0
HR
4275#
4276# Driver specific block device options for NBD.
4277#
26ec4e53 4278# @server: NBD server address
6b02b1f0 4279#
26ec4e53 4280# @export: export name
6b02b1f0 4281#
26ec4e53 4282# @tls-creds: TLS credentials ID
6b02b1f0 4283#
a0cd6d29
DB
4284# @tls-hostname: TLS hostname override for certificate validation (Since 7.0)
4285#
dbc7b014
EB
4286# @x-dirty-bitmap: A metadata context name such as "qemu:dirty-bitmap:NAME"
4287# or "qemu:allocation-depth" to query in place of the
216ee365 4288# traditional "base:allocation" block status (see
dbc7b014
EB
4289# NBD_OPT_LIST_META_CONTEXT in the NBD protocol; and
4290# yes, naming this option x-context would have made
4291# more sense) (since 3.0)
216ee365 4292#
b172ae2e
VSO
4293# @reconnect-delay: On an unexpected disconnect, the nbd client tries to
4294# connect again until succeeding or encountering a serious
4295# error. During the first @reconnect-delay seconds, all
4296# requests are paused and will be rerun on a successful
4297# reconnect. After that time, any delayed requests and all
4298# future requests before a successful reconnect will
4299# immediately fail. Default 0 (Since 4.2)
4300#
be16b8bf
VSO
4301# @open-timeout: In seconds. If zero, the nbd driver tries the connection
4302# only once, and fails to open if the connection fails.
4303# If non-zero, the nbd driver will repeat connection attempts
4304# until successful or until @open-timeout seconds have elapsed.
4305# Default 0 (Since 7.0)
4306#
9fb49daa
MA
4307# Features:
4308# @unstable: Member @x-dirty-bitmap is experimental.
4309#
79b7a77e 4310# Since: 2.9
6b02b1f0
HR
4311##
4312{ 'struct': 'BlockdevOptionsNbd',
62cf396b 4313 'data': { 'server': 'SocketAddress',
6b02b1f0 4314 '*export': 'str',
216ee365 4315 '*tls-creds': 'str',
a0cd6d29 4316 '*tls-hostname': 'str',
9fb49daa 4317 '*x-dirty-bitmap': { 'type': 'str', 'features': [ 'unstable' ] },
be16b8bf
VSO
4318 '*reconnect-delay': 'uint32',
4319 '*open-timeout': 'uint32' } }
6b02b1f0 4320
2fdc7045 4321##
5072f7b3 4322# @BlockdevOptionsRaw:
2fdc7045
TG
4323#
4324# Driver specific block device options for the raw driver.
4325#
26ec4e53
PM
4326# @offset: position where the block device starts
4327# @size: the assumed size of the device
2fdc7045 4328#
79b7a77e 4329# Since: 2.9
2fdc7045
TG
4330##
4331{ 'struct': 'BlockdevOptionsRaw',
4332 'base': 'BlockdevOptionsGenericFormat',
4333 'data': { '*offset': 'int', '*size': 'int' } }
4334
1ad166b6 4335##
d8e7d87e
MP
4336# @BlockdevOptionsThrottle:
4337#
4338# Driver specific block device options for the throttle driver
4339#
26ec4e53
PM
4340# @throttle-group: the name of the throttle-group object to use. It
4341# must already exist.
4342# @file: reference to or definition of the data source block device
4ae65a52 4343#
d8e7d87e
MP
4344# Since: 2.11
4345##
4346{ 'struct': 'BlockdevOptionsThrottle',
4347 'data': { 'throttle-group': 'str',
4348 'file' : 'BlockdevRef'
4349 } }
e4c8fddd
AS
4350
4351##
4352# @BlockdevOptionsCor:
4353#
4354# Driver specific block device options for the copy-on-read driver.
4355#
4356# @bottom: The name of a non-filter node (allocation-bearing layer) that
4357# limits the COR operations in the backing chain (inclusive), so
4358# that no data below this node will be copied by this filter.
4359# If option is absent, the limit is not applied, so that data
4360# from all backing layers may be copied.
4361#
4362# Since: 6.0
4363##
4364{ 'struct': 'BlockdevOptionsCor',
4365 'base': 'BlockdevOptionsGenericFormat',
4366 'data': { '*bottom': 'str' } }
4367
f1bb39a8
VSO
4368##
4369# @OnCbwError:
4370#
4371# An enumeration of possible behaviors for copy-before-write operation
4372# failures.
4373#
4374# @break-guest-write: report the error to the guest. This way, the guest
4375# will not be able to overwrite areas that cannot be
4376# backed up, so the backup process remains valid.
4377#
4378# @break-snapshot: continue guest write. Doing so will make the provided
4379# snapshot state invalid and any backup or export
4380# process based on it will finally fail.
4381#
4382# Since: 7.1
4383##
4384{ 'enum': 'OnCbwError',
4385 'data': [ 'break-guest-write', 'break-snapshot' ] }
4386
783b2825
VSO
4387##
4388# @BlockdevOptionsCbw:
4389#
4390# Driver specific block device options for the copy-before-write driver,
4391# which does so called copy-before-write operations: when data is
4392# written to the filter, the filter first reads corresponding blocks
4393# from its file child and copies them to @target child. After successfully
4394# copying, the write request is propagated to file child. If copying
4395# fails, the original write request is failed too and no data is written
4396# to file child.
4397#
4398# @target: The target for copy-before-write operations.
4399#
5f3a3cd7
VSO
4400# @bitmap: If specified, copy-before-write filter will do
4401# copy-before-write operations only for dirty regions of the
4402# bitmap. Bitmap size must be equal to length of file and
4403# target child of the filter. Note also, that bitmap is used
4404# only to initialize internal bitmap of the process, so further
4405# modifications (or removing) of specified bitmap doesn't
4406# influence the filter. (Since 7.0)
4407#
f1bb39a8
VSO
4408# @on-cbw-error: Behavior on failure of copy-before-write operation.
4409# Default is @break-guest-write. (Since 7.1)
4410#
6db7fd1c
VSO
4411# @cbw-timeout: Zero means no limit. Non-zero sets the timeout in seconds
4412# for copy-before-write operation. When a timeout occurs,
4413# the respective copy-before-write operation will fail, and
4414# the @on-cbw-error parameter will decide how this failure
4415# is handled. Default 0. (Since 7.1)
4416#
783b2825
VSO
4417# Since: 6.2
4418##
4419{ 'struct': 'BlockdevOptionsCbw',
4420 'base': 'BlockdevOptionsGenericFormat',
f1bb39a8 4421 'data': { 'target': 'BlockdevRef', '*bitmap': 'BlockDirtyBitmap',
6db7fd1c 4422 '*on-cbw-error': 'OnCbwError', '*cbw-timeout': 'uint32' } }
783b2825 4423
d8e7d87e 4424##
5072f7b3 4425# @BlockdevOptions:
1ad166b6 4426#
3666a97f
EB
4427# Options for creating a block device. Many options are available for all
4428# block devices, independent of the block driver:
4429#
26ec4e53
PM
4430# @driver: block driver name
4431# @node-name: the node name of the new node (Since 2.0).
4432# This option is required on the top level of blockdev-add.
4433# Valid node names start with an alphabetic character and may
4434# contain only alphanumeric characters, '-', '.' and '_'. Their
4435# maximum length is 31 characters.
4436# @discard: discard-related options (default: ignore)
4437# @cache: cache-related options
4438# @read-only: whether the block device should be read-only (default: false).
4439# Note that some block drivers support only read-only access,
4440# either generally or in certain configurations. In this case,
4441# the default value does not work and the option must be
4442# specified explicitly.
e35bdc12
KW
4443# @auto-read-only: if true and @read-only is false, QEMU may automatically
4444# decide not to open the image read-write as requested, but
4445# fall back to read-only instead (and switch between the modes
4446# later), e.g. depending on whether the image file is writable
4447# or whether a writing user is attached to the node
4448# (default: false, since 3.1)
1d8bda12 4449# @detect-zeroes: detect and optimize zero writes (Since 2.1)
3666a97f 4450# (default: off)
26ec4e53
PM
4451# @force-share: force share all permission on added nodes.
4452# Requires read-only=true. (Since 2.10)
3666a97f
EB
4453#
4454# Remaining options are determined by the block driver.
1ad166b6 4455#
79b7a77e 4456# Since: 2.9
1ad166b6
BC
4457##
4458{ 'union': 'BlockdevOptions',
3666a97f 4459 'base': { 'driver': 'BlockdevDriver',
3666a97f
EB
4460 '*node-name': 'str',
4461 '*discard': 'BlockdevDiscardOptions',
4462 '*cache': 'BlockdevCacheOptions',
3666a97f 4463 '*read-only': 'bool',
e35bdc12 4464 '*auto-read-only': 'bool',
5a9347c6 4465 '*force-share': 'bool',
3666a97f 4466 '*detect-zeroes': 'BlockdevDetectZeroesOptions' },
1ad166b6
BC
4467 'discriminator': 'driver',
4468 'data': {
db866be9 4469 'blkdebug': 'BlockdevOptionsBlkdebug',
bfcc224e 4470 'blklogwrites':'BlockdevOptionsBlklogwrites',
db866be9 4471 'blkverify': 'BlockdevOptionsBlkverify',
35e32d9e 4472 'blkreplay': 'BlockdevOptionsBlkreplay',
db866be9
FZ
4473 'bochs': 'BlockdevOptionsGenericFormat',
4474 'cloop': 'BlockdevOptionsGenericFormat',
f41388e0 4475 'compress': 'BlockdevOptionsGenericFormat',
783b2825 4476 'copy-before-write':'BlockdevOptionsCbw',
e4c8fddd 4477 'copy-on-read':'BlockdevOptionsCor',
db866be9 4478 'dmg': 'BlockdevOptionsGenericFormat',
1ad166b6 4479 'file': 'BlockdevOptionsFile',
6b9d62db
HR
4480 'ftp': 'BlockdevOptionsCurlFtp',
4481 'ftps': 'BlockdevOptionsCurlFtps',
7edac2dd 4482 'gluster': 'BlockdevOptionsGluster',
14176c8d 4483 'host_cdrom': { 'type': 'BlockdevOptionsFile',
8a9f1e1d 4484 'if': 'HAVE_HOST_BLOCK_DEVICE' },
14176c8d 4485 'host_device': { 'type': 'BlockdevOptionsFile',
8a9f1e1d 4486 'if': 'HAVE_HOST_BLOCK_DEVICE' },
6b9d62db
HR
4487 'http': 'BlockdevOptionsCurlHttp',
4488 'https': 'BlockdevOptionsCurlHttps',
fd66dbd4
SH
4489 'io_uring': { 'type': 'BlockdevOptionsIoUring',
4490 'if': 'CONFIG_BLKIO' },
31eb1202 4491 'iscsi': 'BlockdevOptionsIscsi',
78368575 4492 'luks': 'BlockdevOptionsLUKS',
6b02b1f0 4493 'nbd': 'BlockdevOptionsNbd',
aa2623d8 4494 'nfs': 'BlockdevOptionsNfs',
db866be9
FZ
4495 'null-aio': 'BlockdevOptionsNull',
4496 'null-co': 'BlockdevOptionsNull',
d87ee3d7 4497 'nvme': 'BlockdevOptionsNVMe',
fd66dbd4
SH
4498 'nvme-io_uring': { 'type': 'BlockdevOptionsNvmeIoUring',
4499 'if': 'CONFIG_BLKIO' },
1ad166b6 4500 'parallels': 'BlockdevOptionsGenericFormat',
33fa2222 4501 'preallocate':'BlockdevOptionsPreallocate',
1ad166b6 4502 'qcow2': 'BlockdevOptionsQcow2',
d85f4222 4503 'qcow': 'BlockdevOptionsQcow',
1ad166b6 4504 'qed': 'BlockdevOptionsGenericCOWFormat',
db866be9 4505 'quorum': 'BlockdevOptionsQuorum',
2fdc7045 4506 'raw': 'BlockdevOptionsRaw',
8a47e8eb 4507 'rbd': 'BlockdevOptionsRbd',
335d10cd 4508 'replication': { 'type': 'BlockdevOptionsReplication',
8a9f1e1d 4509 'if': 'CONFIG_REPLICATION' },
1c14eaab 4510 'snapshot-access': 'BlockdevOptionsGenericFormat',
ad0e90a6 4511 'ssh': 'BlockdevOptionsSsh',
d8e7d87e 4512 'throttle': 'BlockdevOptionsThrottle',
1ad166b6
BC
4513 'vdi': 'BlockdevOptionsGenericFormat',
4514 'vhdx': 'BlockdevOptionsGenericFormat',
03d9e4c0
AF
4515 'virtio-blk-vfio-pci':
4516 { 'type': 'BlockdevOptionsVirtioBlkVfioPci',
4517 'if': 'CONFIG_BLKIO' },
fd66dbd4
SH
4518 'virtio-blk-vhost-user':
4519 { 'type': 'BlockdevOptionsVirtioBlkVhostUser',
4520 'if': 'CONFIG_BLKIO' },
4521 'virtio-blk-vhost-vdpa':
4522 { 'type': 'BlockdevOptionsVirtioBlkVhostVdpa',
4523 'if': 'CONFIG_BLKIO' },
1ad166b6
BC
4524 'vmdk': 'BlockdevOptionsGenericCOWFormat',
4525 'vpc': 'BlockdevOptionsGenericFormat',
a0846452 4526 'vvfat': 'BlockdevOptionsVVFAT'
1ad166b6
BC
4527 } }
4528
4529##
5072f7b3 4530# @BlockdevRef:
1ad166b6
BC
4531#
4532# Reference to a block device.
4533#
26ec4e53
PM
4534# @definition: defines a new block device inline
4535# @reference: references the ID of an existing block device
1ad166b6 4536#
79b7a77e 4537# Since: 2.9
1ad166b6 4538##
ab916fad 4539{ 'alternate': 'BlockdevRef',
1ad166b6
BC
4540 'data': { 'definition': 'BlockdevOptions',
4541 'reference': 'str' } }
4542
c42e8742
MA
4543##
4544# @BlockdevRefOrNull:
4545#
4546# Reference to a block device.
4547#
26ec4e53
PM
4548# @definition: defines a new block device inline
4549# @reference: references the ID of an existing block device.
4550# An empty string means that no block device should
4551# be referenced. Deprecated; use null instead.
4552# @null: No block device should be referenced (since 2.10)
c42e8742
MA
4553#
4554# Since: 2.9
4555##
4556{ 'alternate': 'BlockdevRefOrNull',
4557 'data': { 'definition': 'BlockdevOptions',
4558 'reference': 'str',
4559 'null': 'null' } }
4560
1ad166b6
BC
4561##
4562# @blockdev-add:
4563#
e947e9c8 4564# Creates a new block device.
1ad166b6 4565#
79b7a77e 4566# Since: 2.9
b4749948
MAL
4567#
4568# Example:
4569#
4570# 1.
4571# -> { "execute": "blockdev-add",
4572# "arguments": {
b1660997
JC
4573# "driver": "qcow2",
4574# "node-name": "test1",
34f58df5 4575# "file": {
b1660997
JC
4576# "driver": "file",
4577# "filename": "test.qcow2"
4578# }
4579# }
4580# }
b4749948
MAL
4581# <- { "return": {} }
4582#
4583# 2.
4584# -> { "execute": "blockdev-add",
4585# "arguments": {
b1660997
JC
4586# "driver": "qcow2",
4587# "node-name": "node0",
4588# "discard": "unmap",
4589# "cache": {
4590# "direct": true
b4749948 4591# },
34f58df5 4592# "file": {
b1660997
JC
4593# "driver": "file",
4594# "filename": "/tmp/test.qcow2"
b4749948
MAL
4595# },
4596# "backing": {
b1660997
JC
4597# "driver": "raw",
4598# "file": {
4599# "driver": "file",
4600# "filename": "/dev/fdset/4"
b4749948
MAL
4601# }
4602# }
b4749948
MAL
4603# }
4604# }
4605#
4606# <- { "return": {} }
4607#
1ad166b6 4608##
f55ba801
PB
4609{ 'command': 'blockdev-add', 'data': 'BlockdevOptions', 'boxed': true,
4610 'allow-preconfig': true }
1ad166b6 4611
1479c730 4612##
e60edf69 4613# @blockdev-reopen:
1479c730 4614#
3908b7a8
AG
4615# Reopens one or more block devices using the given set of options.
4616# Any option not specified will be reset to its default value regardless
4617# of its previous status. If an option cannot be changed or a particular
1479c730 4618# driver does not support reopening then the command will return an
3908b7a8
AG
4619# error. All devices in the list are reopened in one transaction, so
4620# if one of them fails then the whole transaction is cancelled.
1479c730 4621#
3908b7a8
AG
4622# The command receives a list of block devices to reopen. For each one
4623# of them, the top-level @node-name option (from BlockdevOptions) must be
1479c730
AG
4624# specified and is used to select the block device to be reopened.
4625# Other @node-name options must be either omitted or set to the
4626# current name of the appropriate node. This command won't change any
4627# node name and any attempt to do it will result in an error.
4628#
4629# In the case of options that refer to child nodes, the behavior of
4630# this command depends on the value:
4631#
4632# 1) A set of options (BlockdevOptions): the child is reopened with
4633# the specified set of options.
4634#
4635# 2) A reference to the current child: the child is reopened using
4636# its existing set of options.
4637#
4638# 3) A reference to a different node: the current child is replaced
4639# with the specified one.
4640#
4641# 4) NULL: the current child (if any) is detached.
4642#
3908b7a8
AG
4643# Options (1) and (2) are supported in all cases. Option (3) is
4644# supported for @file and @backing, and option (4) for @backing only.
1479c730
AG
4645#
4646# Unlike with blockdev-add, the @backing option must always be present
4647# unless the node being reopened does not have a backing file and its
4648# image does not have a default backing file name as part of its
4649# metadata.
4650#
e60edf69 4651# Since: 6.1
1479c730 4652##
e60edf69 4653{ 'command': 'blockdev-reopen',
f55ba801
PB
4654 'data': { 'options': ['BlockdevOptions'] },
4655 'allow-preconfig': true }
1479c730 4656
81b936ae 4657##
79b7a77e 4658# @blockdev-del:
81b936ae
AG
4659#
4660# Deletes a block device that has been added using blockdev-add.
9ec8873e
KW
4661# The command will fail if the node is attached to a device or is
4662# otherwise being used.
81b936ae 4663#
7a305384
MAL
4664# @node-name: Name of the graph node to delete.
4665#
79b7a77e 4666# Since: 2.9
915a213f
MAL
4667#
4668# Example:
4669#
4670# -> { "execute": "blockdev-add",
4671# "arguments": {
b1660997
JC
4672# "driver": "qcow2",
4673# "node-name": "node0",
34f58df5 4674# "file": {
b1660997
JC
4675# "driver": "file",
4676# "filename": "test.qcow2"
4677# }
915a213f
MAL
4678# }
4679# }
4680# <- { "return": {} }
4681#
79b7a77e 4682# -> { "execute": "blockdev-del",
915a213f
MAL
4683# "arguments": { "node-name": "node0" }
4684# }
4685# <- { "return": {} }
4686#
81b936ae 4687##
f55ba801
PB
4688{ 'command': 'blockdev-del', 'data': { 'node-name': 'str' },
4689 'allow-preconfig': true }
81b936ae 4690
927f11e1
KW
4691##
4692# @BlockdevCreateOptionsFile:
4693#
4694# Driver specific image creation options for file.
4695#
f5627506
PM
4696# @filename: Filename for the new image file
4697# @size: Size of the virtual disk in bytes
4698# @preallocation: Preallocation mode for the new image (default: off;
4699# allowed values: off,
8a9f1e1d
MAL
4700# falloc (if CONFIG_POSIX_FALLOCATE),
4701# full (if CONFIG_POSIX))
f5627506 4702# @nocow: Turn off copy-on-write (valid only on btrfs; default: off)
ffa244c8
KW
4703# @extent-size-hint: Extent size hint to add to the image file; 0 for not
4704# adding an extent size hint (default: 1 MB, since 5.1)
927f11e1
KW
4705#
4706# Since: 2.12
4707##
4708{ 'struct': 'BlockdevCreateOptionsFile',
ffa244c8
KW
4709 'data': { 'filename': 'str',
4710 'size': 'size',
4711 '*preallocation': 'PreallocMode',
4712 '*nocow': 'bool',
4713 '*extent-size-hint': 'size'} }
927f11e1 4714
ab8bda76
KW
4715##
4716# @BlockdevCreateOptionsGluster:
4717#
4718# Driver specific image creation options for gluster.
4719#
f5627506
PM
4720# @location: Where to store the new image file
4721# @size: Size of the virtual disk in bytes
4722# @preallocation: Preallocation mode for the new image (default: off;
4723# allowed values: off,
8a9f1e1d
MAL
4724# falloc (if CONFIG_GLUSTERFS_FALLOCATE),
4725# full (if CONFIG_GLUSTERFS_ZEROFILL))
ab8bda76
KW
4726#
4727# Since: 2.12
4728##
4729{ 'struct': 'BlockdevCreateOptionsGluster',
4730 'data': { 'location': 'BlockdevOptionsGluster',
4731 'size': 'size',
4732 '*preallocation': 'PreallocMode' } }
4733
1bedcaf1
KW
4734##
4735# @BlockdevCreateOptionsLUKS:
4736#
4737# Driver specific image creation options for LUKS.
4738#
f5627506
PM
4739# @file: Node to create the image format on
4740# @size: Size of the virtual disk in bytes
4741# @preallocation: Preallocation mode for the new image
4742# (since: 4.2)
4743# (default: off; allowed values: off, metadata, falloc, full)
1bedcaf1
KW
4744#
4745# Since: 2.12
4746##
4747{ 'struct': 'BlockdevCreateOptionsLUKS',
4748 'base': 'QCryptoBlockCreateOptionsLUKS',
4749 'data': { 'file': 'BlockdevRef',
672de729
ML
4750 'size': 'size',
4751 '*preallocation': 'PreallocMode' } }
1bedcaf1 4752
a1a42af4
KW
4753##
4754# @BlockdevCreateOptionsNfs:
4755#
4756# Driver specific image creation options for NFS.
4757#
f5627506
PM
4758# @location: Where to store the new image file
4759# @size: Size of the virtual disk in bytes
a1a42af4
KW
4760#
4761# Since: 2.12
4762##
4763{ 'struct': 'BlockdevCreateOptionsNfs',
4764 'data': { 'location': 'BlockdevOptionsNfs',
4765 'size': 'size' } }
4766
1511b490
KW
4767##
4768# @BlockdevCreateOptionsParallels:
4769#
4770# Driver specific image creation options for parallels.
4771#
f5627506
PM
4772# @file: Node to create the image format on
4773# @size: Size of the virtual disk in bytes
4774# @cluster-size: Cluster size in bytes (default: 1 MB)
1511b490
KW
4775#
4776# Since: 2.12
4777##
4778{ 'struct': 'BlockdevCreateOptionsParallels',
4779 'data': { 'file': 'BlockdevRef',
4780 'size': 'size',
4781 '*cluster-size': 'size' } }
4782
42a3e1ab
KW
4783##
4784# @BlockdevCreateOptionsQcow:
4785#
4786# Driver specific image creation options for qcow.
4787#
f5627506
PM
4788# @file: Node to create the image format on
4789# @size: Size of the virtual disk in bytes
4790# @backing-file: File name of the backing file if a backing file
4791# should be used
4792# @encrypt: Encryption options if the image should be encrypted
42a3e1ab
KW
4793#
4794# Since: 2.12
4795##
4796{ 'struct': 'BlockdevCreateOptionsQcow',
4797 'data': { 'file': 'BlockdevRef',
4798 'size': 'size',
4799 '*backing-file': 'str',
4800 '*encrypt': 'QCryptoBlockCreateOptions' } }
4801
c2808aba
KW
4802##
4803# @BlockdevQcow2Version:
4804#
23e46452
AB
4805# @v2: The original QCOW2 format as introduced in qemu 0.10 (version 2)
4806# @v3: The extended QCOW2 format as introduced in qemu 1.1 (version 3)
c2808aba
KW
4807#
4808# Since: 2.12
4809##
4810{ 'enum': 'BlockdevQcow2Version',
4811 'data': [ 'v2', 'v3' ] }
4812
572ad978
DP
4813##
4814# @Qcow2CompressionType:
4815#
4816# Compression type used in qcow2 image file
4817#
4818# @zlib: zlib compression, see <http://zlib.net/>
d298ac10 4819# @zstd: zstd compression, see <http://github.com/facebook/zstd>
572ad978
DP
4820#
4821# Since: 5.1
4822##
4823{ 'enum': 'Qcow2CompressionType',
8a9f1e1d 4824 'data': [ 'zlib', { 'name': 'zstd', 'if': 'CONFIG_ZSTD' } ] }
572ad978 4825
c2808aba
KW
4826##
4827# @BlockdevCreateOptionsQcow2:
4828#
4829# Driver specific image creation options for qcow2.
4830#
f5627506
PM
4831# @file: Node to create the image format on
4832# @data-file: Node to use as an external data file in which all guest
4833# data is stored so that only metadata remains in the qcow2
4834# file (since: 4.0)
4835# @data-file-raw: True if the external data file must stay valid as a
4836# standalone (read-only) raw image without looking at qcow2
4837# metadata (default: false; since: 4.0)
826bd069
PM
4838# @extended-l2: True to make the image have extended L2 entries
4839# (default: false; since 5.2)
f5627506
PM
4840# @size: Size of the virtual disk in bytes
4841# @version: Compatibility level (default: v3)
4842# @backing-file: File name of the backing file if a backing file
4843# should be used
4844# @backing-fmt: Name of the block driver to use for the backing file
4845# @encrypt: Encryption options if the image should be encrypted
4846# @cluster-size: qcow2 cluster size in bytes (default: 65536)
4847# @preallocation: Preallocation mode for the new image (default: off;
4848# allowed values: off, falloc, full, metadata)
4849# @lazy-refcounts: True if refcounts may be updated lazily (default: off)
4850# @refcount-bits: Width of reference counts in bits (default: 16)
572ad978
DP
4851# @compression-type: The image cluster compression method
4852# (default: zlib, since 5.1)
c2808aba
KW
4853#
4854# Since: 2.12
4855##
4856{ 'struct': 'BlockdevCreateOptionsQcow2',
4857 'data': { 'file': 'BlockdevRef',
dcc98687 4858 '*data-file': 'BlockdevRef',
6c3944dc 4859 '*data-file-raw': 'bool',
7be20252 4860 '*extended-l2': 'bool',
c2808aba
KW
4861 'size': 'size',
4862 '*version': 'BlockdevQcow2Version',
4863 '*backing-file': 'str',
4864 '*backing-fmt': 'BlockdevDriver',
4865 '*encrypt': 'QCryptoBlockCreateOptions',
4866 '*cluster-size': 'size',
4867 '*preallocation': 'PreallocMode',
4868 '*lazy-refcounts': 'bool',
572ad978
DP
4869 '*refcount-bits': 'int',
4870 '*compression-type':'Qcow2CompressionType' } }
c2808aba 4871
959355a4
KW
4872##
4873# @BlockdevCreateOptionsQed:
4874#
4875# Driver specific image creation options for qed.
4876#
f5627506
PM
4877# @file: Node to create the image format on
4878# @size: Size of the virtual disk in bytes
4879# @backing-file: File name of the backing file if a backing file
4880# should be used
4881# @backing-fmt: Name of the block driver to use for the backing file
4882# @cluster-size: Cluster size in bytes (default: 65536)
4883# @table-size: L1/L2 table size (in clusters)
959355a4
KW
4884#
4885# Since: 2.12
4886##
4887{ 'struct': 'BlockdevCreateOptionsQed',
4888 'data': { 'file': 'BlockdevRef',
4889 'size': 'size',
4890 '*backing-file': 'str',
4891 '*backing-fmt': 'BlockdevDriver',
4892 '*cluster-size': 'size',
4893 '*table-size': 'int' } }
4894
1bebea37
KW
4895##
4896# @BlockdevCreateOptionsRbd:
4897#
4898# Driver specific image creation options for rbd/Ceph.
4899#
f5627506
PM
4900# @location: Where to store the new image file. This location cannot
4901# point to a snapshot.
4902# @size: Size of the virtual disk in bytes
4903# @cluster-size: RBD object size
42e4ac9e 4904# @encrypt: Image encryption options. (Since 6.1)
1bebea37
KW
4905#
4906# Since: 2.12
4907##
4908{ 'struct': 'BlockdevCreateOptionsRbd',
4909 'data': { 'location': 'BlockdevOptionsRbd',
4910 'size': 'size',
42e4ac9e
OO
4911 '*cluster-size' : 'size',
4912 '*encrypt' : 'RbdEncryptionCreateOptions' } }
1bebea37 4913
3015372d
FZ
4914##
4915# @BlockdevVmdkSubformat:
4916#
4917# Subformat options for VMDK images
4918#
c0ac533b 4919# @monolithicSparse: Single file image with sparse cluster allocation
3015372d 4920#
c0ac533b 4921# @monolithicFlat: Single flat data image and a descriptor file
3015372d
FZ
4922#
4923# @twoGbMaxExtentSparse: Data is split into 2GB (per virtual LBA) sparse extent
4924# files, in addition to a descriptor file
4925#
c0ac533b
AB
4926# @twoGbMaxExtentFlat: Data is split into 2GB (per virtual LBA) flat extent
4927# files, in addition to a descriptor file
3015372d 4928#
c0ac533b
AB
4929# @streamOptimized: Single file image sparse cluster allocation, optimized
4930# for streaming over network.
3015372d
FZ
4931#
4932# Since: 4.0
4933##
4934{ 'enum': 'BlockdevVmdkSubformat',
4935 'data': [ 'monolithicSparse', 'monolithicFlat', 'twoGbMaxExtentSparse',
4936 'twoGbMaxExtentFlat', 'streamOptimized'] }
4937
4938##
4939# @BlockdevVmdkAdapterType:
4940#
4941# Adapter type info for VMDK images
4942#
4943# Since: 4.0
4944##
4945{ 'enum': 'BlockdevVmdkAdapterType',
4946 'data': [ 'ide', 'buslogic', 'lsilogic', 'legacyESX'] }
4947
4948##
4949# @BlockdevCreateOptionsVmdk:
4950#
4951# Driver specific image creation options for VMDK.
4952#
f5627506
PM
4953# @file: Where to store the new image file. This refers to the image
4954# file for monolithcSparse and streamOptimized format, or the
4955# descriptor file for other formats.
4956# @size: Size of the virtual disk in bytes
4957# @extents: Where to store the data extents. Required for monolithcFlat,
4958# twoGbMaxExtentSparse and twoGbMaxExtentFlat formats. For
4959# monolithicFlat, only one entry is required; for
4960# twoGbMaxExtent* formats, the number of entries required is
4961# calculated as extent_number = virtual_size / 2GB. Providing
4962# more extents than will be used is an error.
4963# @subformat: The subformat of the VMDK image. Default: "monolithicSparse".
4964# @backing-file: The path of backing file. Default: no backing file is used.
4965# @adapter-type: The adapter type used to fill in the descriptor. Default: ide.
4966# @hwversion: Hardware version. The meaningful options are "4" or "6".
4967# Default: "4".
f3d43dfd
TW
4968# @toolsversion: VMware guest tools version.
4969# Default: "2147483647" (Since 6.2)
f5627506
PM
4970# @zeroed-grain: Whether to enable zeroed-grain feature for sparse subformats.
4971# Default: false.
3015372d
FZ
4972#
4973# Since: 4.0
4974##
4975{ 'struct': 'BlockdevCreateOptionsVmdk',
4976 'data': { 'file': 'BlockdevRef',
4977 'size': 'size',
4978 '*extents': ['BlockdevRef'],
4979 '*subformat': 'BlockdevVmdkSubformat',
4980 '*backing-file': 'str',
4981 '*adapter-type': 'BlockdevVmdkAdapterType',
4982 '*hwversion': 'str',
f3d43dfd 4983 '*toolsversion': 'str',
3015372d
FZ
4984 '*zeroed-grain': 'bool' } }
4985
4906da7e
KW
4986##
4987# @BlockdevCreateOptionsSsh:
4988#
4989# Driver specific image creation options for SSH.
4990#
f5627506
PM
4991# @location: Where to store the new image file
4992# @size: Size of the virtual disk in bytes
4906da7e
KW
4993#
4994# Since: 2.12
4995##
4996{ 'struct': 'BlockdevCreateOptionsSsh',
4997 'data': { 'location': 'BlockdevOptionsSsh',
4998 'size': 'size' } }
4999
49858b50
HR
5000##
5001# @BlockdevCreateOptionsVdi:
5002#
5003# Driver specific image creation options for VDI.
5004#
f5627506
PM
5005# @file: Node to create the image format on
5006# @size: Size of the virtual disk in bytes
5007# @preallocation: Preallocation mode for the new image (default: off;
5008# allowed values: off, metadata)
49858b50
HR
5009#
5010# Since: 2.12
5011##
5012{ 'struct': 'BlockdevCreateOptionsVdi',
5013 'data': { 'file': 'BlockdevRef',
5014 'size': 'size',
61fa6487 5015 '*preallocation': 'PreallocMode' } }
49858b50 5016
09b68dab
KW
5017##
5018# @BlockdevVhdxSubformat:
5019#
5020# @dynamic: Growing image file
c0ac533b 5021# @fixed: Preallocated fixed-size image file
09b68dab
KW
5022#
5023# Since: 2.12
5024##
5025{ 'enum': 'BlockdevVhdxSubformat',
5026 'data': [ 'dynamic', 'fixed' ] }
5027
5028##
5029# @BlockdevCreateOptionsVhdx:
5030#
5031# Driver specific image creation options for vhdx.
5032#
f5627506
PM
5033# @file: Node to create the image format on
5034# @size: Size of the virtual disk in bytes
5035# @log-size: Log size in bytes, must be a multiple of 1 MB
5036# (default: 1 MB)
5037# @block-size: Block size in bytes, must be a multiple of 1 MB and not
5038# larger than 256 MB (default: automatically choose a block
5039# size depending on the image size)
5040# @subformat: vhdx subformat (default: dynamic)
5041# @block-state-zero: Force use of payload blocks of type 'ZERO'. Non-standard,
5042# but default. Do not set to 'off' when using 'qemu-img
5043# convert' with subformat=dynamic.
09b68dab
KW
5044#
5045# Since: 2.12
5046##
5047{ 'struct': 'BlockdevCreateOptionsVhdx',
5048 'data': { 'file': 'BlockdevRef',
5049 'size': 'size',
5050 '*log-size': 'size',
5051 '*block-size': 'size',
5052 '*subformat': 'BlockdevVhdxSubformat',
5053 '*block-state-zero': 'bool' } }
5054
182c8835
KW
5055##
5056# @BlockdevVpcSubformat:
5057#
5058# @dynamic: Growing image file
c0ac533b 5059# @fixed: Preallocated fixed-size image file
182c8835
KW
5060#
5061# Since: 2.12
5062##
5063{ 'enum': 'BlockdevVpcSubformat',
5064 'data': [ 'dynamic', 'fixed' ] }
5065
5066##
5067# @BlockdevCreateOptionsVpc:
5068#
5069# Driver specific image creation options for vpc (VHD).
5070#
f5627506
PM
5071# @file: Node to create the image format on
5072# @size: Size of the virtual disk in bytes
5073# @subformat: vhdx subformat (default: dynamic)
5074# @force-size: Force use of the exact byte size instead of rounding to the
5075# next size that can be represented in CHS geometry
5076# (default: false)
182c8835
KW
5077#
5078# Since: 2.12
5079##
5080{ 'struct': 'BlockdevCreateOptionsVpc',
5081 'data': { 'file': 'BlockdevRef',
5082 'size': 'size',
5083 '*subformat': 'BlockdevVpcSubformat',
5084 '*force-size': 'bool' } }
5085
53614689
KW
5086##
5087# @BlockdevCreateOptions:
5088#
5089# Options for creating an image format on a given node.
5090#
f5627506 5091# @driver: block driver to create the image format
53614689
KW
5092#
5093# Since: 2.12
5094##
5095{ 'union': 'BlockdevCreateOptions',
5096 'base': {
5097 'driver': 'BlockdevDriver' },
5098 'discriminator': 'driver',
5099 'data': {
927f11e1 5100 'file': 'BlockdevCreateOptionsFile',
ab8bda76 5101 'gluster': 'BlockdevCreateOptionsGluster',
1bedcaf1 5102 'luks': 'BlockdevCreateOptionsLUKS',
a1a42af4 5103 'nfs': 'BlockdevCreateOptionsNfs',
1511b490 5104 'parallels': 'BlockdevCreateOptionsParallels',
42a3e1ab 5105 'qcow': 'BlockdevCreateOptionsQcow',
c2808aba 5106 'qcow2': 'BlockdevCreateOptionsQcow2',
959355a4 5107 'qed': 'BlockdevCreateOptionsQed',
1bebea37 5108 'rbd': 'BlockdevCreateOptionsRbd',
4906da7e 5109 'ssh': 'BlockdevCreateOptionsSsh',
e3810574 5110 'vdi': 'BlockdevCreateOptionsVdi',
09b68dab 5111 'vhdx': 'BlockdevCreateOptionsVhdx',
3015372d 5112 'vmdk': 'BlockdevCreateOptionsVmdk',
29cd0403 5113 'vpc': 'BlockdevCreateOptionsVpc'
53614689
KW
5114 } }
5115
b0292b85 5116##
3fb588a0 5117# @blockdev-create:
b0292b85 5118#
e5ab4347
KW
5119# Starts a job to create an image format on a given node. The job is
5120# automatically finalized, but a manual job-dismiss is required.
b0292b85 5121#
c0ac533b 5122# @job-id: Identifier for the newly created job.
e5ab4347 5123#
c0ac533b 5124# @options: Options for the image creation.
e5ab4347
KW
5125#
5126# Since: 3.0
b0292b85 5127##
3fb588a0 5128{ 'command': 'blockdev-create',
e5ab4347 5129 'data': { 'job-id': 'str',
f55ba801
PB
5130 'options': 'BlockdevCreateOptions' },
5131 'allow-preconfig': true }
b0292b85 5132
30da9dd8
ML
5133##
5134# @BlockdevAmendOptionsLUKS:
5135#
5136# Driver specific image amend options for LUKS.
5137#
5138# Since: 5.1
5139##
5140{ 'struct': 'BlockdevAmendOptionsLUKS',
5141 'base': 'QCryptoBlockAmendOptionsLUKS',
5142 'data': { }
5143}
5144
8ea1613d
ML
5145##
5146# @BlockdevAmendOptionsQcow2:
5147#
5148# Driver specific image amend options for qcow2.
5149# For now, only encryption options can be amended
5150#
5151# @encrypt Encryption options to be amended
5152#
5153# Since: 5.1
5154##
5155{ 'struct': 'BlockdevAmendOptionsQcow2',
5156 'data': { '*encrypt': 'QCryptoBlockAmendOptions' } }
5157
ced914d0
ML
5158##
5159# @BlockdevAmendOptions:
5160#
5161# Options for amending an image format
5162#
23e46452 5163# @driver: Block driver of the node to amend.
ced914d0
ML
5164#
5165# Since: 5.1
5166##
5167{ 'union': 'BlockdevAmendOptions',
5168 'base': {
5169 'driver': 'BlockdevDriver' },
5170 'discriminator': 'driver',
5171 'data': {
8ea1613d
ML
5172 'luks': 'BlockdevAmendOptionsLUKS',
5173 'qcow2': 'BlockdevAmendOptionsQcow2' } }
ced914d0
ML
5174
5175##
5176# @x-blockdev-amend:
5177#
5178# Starts a job to amend format specific options of an existing open block device
5179# The job is automatically finalized, but a manual job-dismiss is required.
5180#
c0ac533b 5181# @job-id: Identifier for the newly created job.
ced914d0 5182#
c0ac533b 5183# @node-name: Name of the block node to work on
ced914d0 5184#
c0ac533b 5185# @options: Options (driver specific)
ced914d0 5186#
c0ac533b
AB
5187# @force: Allow unsafe operations, format specific
5188# For luks that allows erase of the last active keyslot
5189# (permanent loss of data),
5190# and replacement of an active keyslot
5191# (possible loss of data if IO error happens)
ced914d0 5192#
9fb49daa
MA
5193# Features:
5194# @unstable: This command is experimental.
5195#
ced914d0
ML
5196# Since: 5.1
5197##
5198{ 'command': 'x-blockdev-amend',
5199 'data': { 'job-id': 'str',
5200 'node-name': 'str',
5201 'options': 'BlockdevAmendOptions',
9fb49daa 5202 '*force': 'bool' },
f55ba801
PB
5203 'features': [ 'unstable' ],
5204 'allow-preconfig': true }
ced914d0 5205
a589569f 5206##
5072f7b3 5207# @BlockErrorAction:
a589569f
WX
5208#
5209# An enumeration of action that has been taken when a DISK I/O occurs
5210#
5211# @ignore: error has been ignored
5212#
5213# @report: error has been reported to the device
5214#
5215# @stop: error caused VM to be stopped
5216#
5217# Since: 2.1
5218##
5219{ 'enum': 'BlockErrorAction',
5220 'data': [ 'ignore', 'report', 'stop' ] }
5a2d2cbd 5221
c120f0fa 5222##
5072f7b3 5223# @BLOCK_IMAGE_CORRUPTED:
c120f0fa 5224#
370d4eba
MAL
5225# Emitted when a disk image is being marked corrupt. The image can be
5226# identified by its device or node name. The 'device' field is always
5227# present for compatibility reasons, but it can be empty ("") if the
5228# image does not have a device name associated.
c120f0fa 5229#
dc881b44
AG
5230# @device: device name. This is always present for compatibility
5231# reasons, but it can be empty ("") if the image does not
5232# have a device name associated.
5233#
1d8bda12 5234# @node-name: node name (Since: 2.4)
c120f0fa
WX
5235#
5236# @msg: informative message for human consumption, such as the kind of
2f44a08b
WX
5237# corruption being detected. It should not be parsed by machine as it is
5238# not guaranteed to be stable
c120f0fa 5239#
1d8bda12 5240# @offset: if the corruption resulted from an image access, this is
0caef8f6 5241# the host's access offset into the image
c120f0fa 5242#
1d8bda12 5243# @size: if the corruption resulted from an image access, this is
c120f0fa
WX
5244# the access size
5245#
370d4eba 5246# @fatal: if set, the image is marked corrupt and therefore unusable after this
26ec4e53
PM
5247# event and must be repaired (Since 2.2; before, every
5248# BLOCK_IMAGE_CORRUPTED event was fatal)
9bf040b9 5249#
07c9f583
MAL
5250# Note: If action is "stop", a STOP event will eventually follow the
5251# BLOCK_IO_ERROR event.
5252#
370d4eba
MAL
5253# Example:
5254#
5255# <- { "event": "BLOCK_IMAGE_CORRUPTED",
abbf0473
VT
5256# "data": { "device": "", "node-name": "drive", "fatal": false,
5257# "msg": "L2 table offset 0x2a2a2a00 unaligned (L1 index: 0)" },
5258# "timestamp": { "seconds": 1648243240, "microseconds": 906060 } }
370d4eba 5259#
c120f0fa
WX
5260# Since: 1.7
5261##
5262{ 'event': 'BLOCK_IMAGE_CORRUPTED',
dc881b44
AG
5263 'data': { 'device' : 'str',
5264 '*node-name' : 'str',
5265 'msg' : 'str',
5266 '*offset' : 'int',
5267 '*size' : 'int',
5268 'fatal' : 'bool' } }
c120f0fa 5269
5a2d2cbd 5270##
5072f7b3 5271# @BLOCK_IO_ERROR:
5a2d2cbd
WX
5272#
5273# Emitted when a disk I/O error occurs
5274#
2bf7e10f
KW
5275# @device: device name. This is always present for compatibility
5276# reasons, but it can be empty ("") if the image does not
5277# have a device name associated.
5278#
5279# @node-name: node name. Note that errors may be reported for the root node
5280# that is directly attached to a guest device rather than for the
bfe1a14c
KW
5281# node where the error occurred. The node name is not present if
5282# the drive is empty. (Since: 2.8)
5a2d2cbd
WX
5283#
5284# @operation: I/O operation
5285#
5286# @action: action that has been taken
5287#
1d8bda12 5288# @nospace: true if I/O error was caused due to a no-space
c7c2ff0c
LC
5289# condition. This key is only present if query-block's
5290# io-status is present, please see query-block documentation
5291# for more information (since: 2.2)
5292#
624ff573
LC
5293# @reason: human readable string describing the error cause.
5294# (This field is a debugging aid for humans, it should not
26ec4e53 5295# be parsed by applications) (since: 2.2)
624ff573 5296#
5a2d2cbd 5297# Note: If action is "stop", a STOP event will eventually follow the
26ec4e53 5298# BLOCK_IO_ERROR event
5a2d2cbd 5299#
9bc6e893 5300# Since: 0.13
07c9f583
MAL
5301#
5302# Example:
5303#
5304# <- { "event": "BLOCK_IO_ERROR",
5305# "data": { "device": "ide0-hd1",
5306# "node-name": "#block212",
5307# "operation": "write",
39e8bb22
VT
5308# "action": "stop",
5309# "reason": "No space left on device" },
07c9f583
MAL
5310# "timestamp": { "seconds": 1265044230, "microseconds": 450486 } }
5311#
5a2d2cbd
WX
5312##
5313{ 'event': 'BLOCK_IO_ERROR',
bfe1a14c
KW
5314 'data': { 'device': 'str', '*node-name': 'str',
5315 'operation': 'IoOperationType',
624ff573
LC
5316 'action': 'BlockErrorAction', '*nospace': 'bool',
5317 'reason': 'str' } }
5a2d2cbd 5318
bcada37b 5319##
5072f7b3 5320# @BLOCK_JOB_COMPLETED:
bcada37b
WX
5321#
5322# Emitted when a block job has completed
5323#
5324# @type: job type
5325#
6aae5be6
AG
5326# @device: The job identifier. Originally the device name but other
5327# values are allowed since QEMU 2.7
bcada37b
WX
5328#
5329# @len: maximum progress value
5330#
5331# @offset: current progress value. On success this is equal to len.
5332# On failure this is less than len
5333#
5334# @speed: rate limit, bytes per second
5335#
1d8bda12 5336# @error: error message. Only present on failure. This field
bcada37b
WX
5337# contains a human-readable error message. There are no semantics
5338# other than that streaming has failed and clients should not try to
5339# interpret the error string
5340#
5341# Since: 1.1
e21e65b2
MAL
5342#
5343# Example:
5344#
5345# <- { "event": "BLOCK_JOB_COMPLETED",
5346# "data": { "type": "stream", "device": "virtio-disk0",
5347# "len": 10737418240, "offset": 10737418240,
5348# "speed": 0 },
5349# "timestamp": { "seconds": 1267061043, "microseconds": 959568 } }
5350#
bcada37b
WX
5351##
5352{ 'event': 'BLOCK_JOB_COMPLETED',
8e4c8700 5353 'data': { 'type' : 'JobType',
bcada37b
WX
5354 'device': 'str',
5355 'len' : 'int',
5356 'offset': 'int',
5357 'speed' : 'int',
5358 '*error': 'str' } }
5359
5360##
5072f7b3 5361# @BLOCK_JOB_CANCELLED:
bcada37b
WX
5362#
5363# Emitted when a block job has been cancelled
5364#
5365# @type: job type
5366#
6aae5be6
AG
5367# @device: The job identifier. Originally the device name but other
5368# values are allowed since QEMU 2.7
bcada37b
WX
5369#
5370# @len: maximum progress value
5371#
5372# @offset: current progress value. On success this is equal to len.
5373# On failure this is less than len
5374#
5375# @speed: rate limit, bytes per second
5376#
5377# Since: 1.1
e161df39
MAL
5378#
5379# Example:
5380#
5381# <- { "event": "BLOCK_JOB_CANCELLED",
5382# "data": { "type": "stream", "device": "virtio-disk0",
5383# "len": 10737418240, "offset": 134217728,
5384# "speed": 0 },
5385# "timestamp": { "seconds": 1267061043, "microseconds": 959568 } }
5386#
bcada37b
WX
5387##
5388{ 'event': 'BLOCK_JOB_CANCELLED',
8e4c8700 5389 'data': { 'type' : 'JobType',
bcada37b
WX
5390 'device': 'str',
5391 'len' : 'int',
5392 'offset': 'int',
5393 'speed' : 'int' } }
5394
5a2d2cbd 5395##
5072f7b3 5396# @BLOCK_JOB_ERROR:
5a2d2cbd
WX
5397#
5398# Emitted when a block job encounters an error
5399#
6aae5be6
AG
5400# @device: The job identifier. Originally the device name but other
5401# values are allowed since QEMU 2.7
5a2d2cbd
WX
5402#
5403# @operation: I/O operation
5404#
5405# @action: action that has been taken
5406#
5407# Since: 1.3
af0e0910
MAL
5408#
5409# Example:
5410#
5411# <- { "event": "BLOCK_JOB_ERROR",
5412# "data": { "device": "ide0-hd1",
5413# "operation": "write",
5414# "action": "stop" },
5415# "timestamp": { "seconds": 1265044230, "microseconds": 450486 } }
5416#
5a2d2cbd
WX
5417##
5418{ 'event': 'BLOCK_JOB_ERROR',
5419 'data': { 'device' : 'str',
5420 'operation': 'IoOperationType',
823c6863 5421 'action' : 'BlockErrorAction' } }
bcada37b
WX
5422
5423##
5072f7b3 5424# @BLOCK_JOB_READY:
bcada37b
WX
5425#
5426# Emitted when a block job is ready to complete
5427#
518848a2
MA
5428# @type: job type
5429#
6aae5be6
AG
5430# @device: The job identifier. Originally the device name but other
5431# values are allowed since QEMU 2.7
bcada37b 5432#
518848a2
MA
5433# @len: maximum progress value
5434#
5435# @offset: current progress value. On success this is equal to len.
5436# On failure this is less than len
5437#
5438# @speed: rate limit, bytes per second
5439#
bcada37b 5440# Note: The "ready to complete" status is always reset by a @BLOCK_JOB_ERROR
26ec4e53 5441# event
bcada37b
WX
5442#
5443# Since: 1.3
11a3dee1
MAL
5444#
5445# Example:
5446#
5447# <- { "event": "BLOCK_JOB_READY",
5448# "data": { "device": "drive0", "type": "mirror", "speed": 0,
ccc9ddbc 5449# "len": 2097152, "offset": 2097152 },
11a3dee1
MAL
5450# "timestamp": { "seconds": 1265044230, "microseconds": 450486 } }
5451#
bcada37b
WX
5452##
5453{ 'event': 'BLOCK_JOB_READY',
8e4c8700 5454 'data': { 'type' : 'JobType',
518848a2
MA
5455 'device': 'str',
5456 'len' : 'int',
5457 'offset': 'int',
5458 'speed' : 'int' } }
ffeaac9b 5459
5f241594
JS
5460##
5461# @BLOCK_JOB_PENDING:
5462#
5463# Emitted when a block job is awaiting explicit authorization to finalize graph
5464# changes via @block-job-finalize. If this job is part of a transaction, it will
5465# not emit this event until the transaction has converged first.
5466#
5467# @type: job type
5468#
5469# @id: The job identifier.
5470#
5471# Since: 2.12
5472#
5473# Example:
5474#
2c29d9b0
VT
5475# <- { "event": "BLOCK_JOB_PENDING",
5476# "data": { "type": "mirror", "id": "backup_1" },
5f241594
JS
5477# "timestamp": { "seconds": 1265044230, "microseconds": 450486 } }
5478#
5479##
5480{ 'event': 'BLOCK_JOB_PENDING',
8e4c8700 5481 'data': { 'type' : 'JobType',
5f241594
JS
5482 'id' : 'str' } }
5483
49687ace 5484##
5072f7b3 5485# @PreallocMode:
ffeaac9b
HT
5486#
5487# Preallocation mode of QEMU image file
5488#
5489# @off: no preallocation
5490# @metadata: preallocate only for metadata
5491# @falloc: like @full preallocation but allocate disk space by
fa27c478
HR
5492# posix_fallocate() rather than writing data.
5493# @full: preallocate all data by writing it to the device to ensure
5494# disk space is really available. This data may or may not be
5495# zero, depending on the image format and storage.
5496# @full preallocation also sets up metadata correctly.
ffeaac9b 5497#
5072f7b3 5498# Since: 2.2
ffeaac9b
HT
5499##
5500{ 'enum': 'PreallocMode',
5501 'data': [ 'off', 'metadata', 'falloc', 'full' ] }
e2462113
FR
5502
5503##
5072f7b3 5504# @BLOCK_WRITE_THRESHOLD:
e2462113
FR
5505#
5506# Emitted when writes on block device reaches or exceeds the
5507# configured write threshold. For thin-provisioned devices, this
5508# means the device should be extended to avoid pausing for
5509# disk exhaustion.
5510# The event is one shot. Once triggered, it needs to be
f85d66f4 5511# re-registered with another block-set-write-threshold command.
e2462113
FR
5512#
5513# @node-name: graph node name on which the threshold was exceeded.
5514#
5515# @amount-exceeded: amount of data which exceeded the threshold, in bytes.
5516#
5517# @write-threshold: last configured threshold, in bytes.
5518#
5519# Since: 2.3
5520##
5521{ 'event': 'BLOCK_WRITE_THRESHOLD',
5522 'data': { 'node-name': 'str',
5523 'amount-exceeded': 'uint64',
5524 'write-threshold': 'uint64' } }
5525
5526##
5072f7b3 5527# @block-set-write-threshold:
e2462113 5528#
e817862b
MAL
5529# Change the write threshold for a block drive. An event will be
5530# delivered if a write to this block drive crosses the configured
5531# threshold. The threshold is an offset, thus must be
5532# non-negative. Default is no write threshold. Setting the threshold
5533# to zero disables it.
5534#
e2462113
FR
5535# This is useful to transparently resize thin-provisioned drives without
5536# the guest OS noticing.
5537#
5538# @node-name: graph node name on which the threshold must be set.
5539#
5540# @write-threshold: configured threshold for the block device, bytes.
5541# Use 0 to disable the threshold.
5542#
e2462113 5543# Since: 2.3
e817862b
MAL
5544#
5545# Example:
5546#
5547# -> { "execute": "block-set-write-threshold",
5548# "arguments": { "node-name": "mydev",
5549# "write-threshold": 17179869184 } }
5550# <- { "return": {} }
5551#
e2462113
FR
5552##
5553{ 'command': 'block-set-write-threshold',
f55ba801
PB
5554 'data': { 'node-name': 'str', 'write-threshold': 'uint64' },
5555 'allow-preconfig': true }
7f821597
WC
5556
5557##
5072f7b3 5558# @x-blockdev-change:
7f821597
WC
5559#
5560# Dynamically reconfigure the block driver state graph. It can be used
5561# to add, remove, insert or replace a graph node. Currently only the
5562# Quorum driver implements this feature to add or remove its child. This
5563# is useful to fix a broken quorum child.
5564#
5565# If @node is specified, it will be inserted under @parent. @child
5566# may not be specified in this case. If both @parent and @child are
5567# specified but @node is not, @child will be detached from @parent.
5568#
5569# @parent: the id or name of the parent node.
5570#
1d8bda12 5571# @child: the name of a child under the given parent node.
7f821597 5572#
1d8bda12 5573# @node: the name of the node that will be added.
7f821597 5574#
9fb49daa
MA
5575# Features:
5576# @unstable: This command is experimental, and its API is not stable. It
5577# does not support all kinds of operations, all kinds of
5578# children, nor all block drivers.
7f821597 5579#
9fb49daa
MA
5580# FIXME Removing children from a quorum node means introducing
5581# gaps in the child indices. This cannot be represented in the
5582# 'children' list of BlockdevOptionsQuorum, as returned by
5583# .bdrv_refresh_filename().
6b4738ce 5584#
9fb49daa
MA
5585# Warning: The data in a new quorum child MUST be consistent
5586# with that of the rest of the array.
7f821597
WC
5587#
5588# Since: 2.7
bd77ea2e
MAL
5589#
5590# Example:
5591#
5592# 1. Add a new node to a quorum
5593# -> { "execute": "blockdev-add",
5594# "arguments": {
244d04db
EB
5595# "driver": "raw",
5596# "node-name": "new_node",
5597# "file": { "driver": "file",
5598# "filename": "test.raw" } } }
bd77ea2e
MAL
5599# <- { "return": {} }
5600# -> { "execute": "x-blockdev-change",
5601# "arguments": { "parent": "disk1",
5602# "node": "new_node" } }
5603# <- { "return": {} }
5604#
5605# 2. Delete a quorum's node
5606# -> { "execute": "x-blockdev-change",
5607# "arguments": { "parent": "disk1",
5608# "child": "children.1" } }
5609# <- { "return": {} }
5610#
7f821597
WC
5611##
5612{ 'command': 'x-blockdev-change',
5613 'data' : { 'parent': 'str',
5614 '*child': 'str',
9fb49daa 5615 '*node': 'str' },
f55ba801
PB
5616 'features': [ 'unstable' ],
5617 'allow-preconfig': true }
ca00bbb1
SH
5618
5619##
5620# @x-blockdev-set-iothread:
5621#
5622# Move @node and its children into the @iothread. If @iothread is null then
5623# move @node and its children into the main loop.
5624#
5625# The node must not be attached to a BlockBackend.
5626#
5627# @node-name: the name of the block driver node
5628#
5629# @iothread: the name of the IOThread object or null for the main loop
5630#
882e9b89
SH
5631# @force: true if the node and its children should be moved when a BlockBackend
5632# is already attached
5633#
9fb49daa
MA
5634# Features:
5635# @unstable: This command is experimental and intended for test cases that
5636# need control over IOThreads only.
ca00bbb1
SH
5637#
5638# Since: 2.12
5639#
5640# Example:
5641#
5642# 1. Move a node into an IOThread
5643# -> { "execute": "x-blockdev-set-iothread",
5644# "arguments": { "node-name": "disk1",
5645# "iothread": "iothread0" } }
5646# <- { "return": {} }
5647#
5648# 2. Move a node into the main loop
5649# -> { "execute": "x-blockdev-set-iothread",
5650# "arguments": { "node-name": "disk1",
5651# "iothread": null } }
5652# <- { "return": {} }
5653#
5654##
5655{ 'command': 'x-blockdev-set-iothread',
5656 'data' : { 'node-name': 'str',
882e9b89 5657 'iothread': 'StrOrNull',
9fb49daa 5658 '*force': 'bool' },
f55ba801
PB
5659 'features': [ 'unstable' ],
5660 'allow-preconfig': true }
b3cf1ec0 5661
b3cf1ec0
KW
5662##
5663# @QuorumOpType:
5664#
5665# An enumeration of the quorum operation types
5666#
5667# @read: read operation
5668#
5669# @write: write operation
5670#
5671# @flush: flush operation
5672#
5673# Since: 2.6
5674##
5675{ 'enum': 'QuorumOpType',
5676 'data': [ 'read', 'write', 'flush' ] }
5677
5678##
5679# @QUORUM_FAILURE:
5680#
5681# Emitted by the Quorum block driver if it fails to establish a quorum
5682#
5683# @reference: device name if defined else node name
5684#
5685# @sector-num: number of the first sector of the failed read operation
5686#
5687# @sectors-count: failed read operation sector count
5688#
5689# Note: This event is rate-limited.
5690#
5691# Since: 2.0
5692#
5693# Example:
5694#
5695# <- { "event": "QUORUM_FAILURE",
5696# "data": { "reference": "usr1", "sector-num": 345435, "sectors-count": 5 },
5697# "timestamp": { "seconds": 1344522075, "microseconds": 745528 } }
5698#
5699##
5700{ 'event': 'QUORUM_FAILURE',
5701 'data': { 'reference': 'str', 'sector-num': 'int', 'sectors-count': 'int' } }
5702
5703##
5704# @QUORUM_REPORT_BAD:
5705#
5706# Emitted to report a corruption of a Quorum file
5707#
5708# @type: quorum operation type (Since 2.6)
5709#
5710# @error: error message. Only present on failure. This field
5711# contains a human-readable error message. There are no semantics other
5712# than that the block layer reported an error and clients should not
5713# try to interpret the error string.
5714#
5715# @node-name: the graph node name of the block driver state
5716#
5717# @sector-num: number of the first sector of the failed read operation
5718#
5719# @sectors-count: failed read operation sector count
5720#
5721# Note: This event is rate-limited.
5722#
5723# Since: 2.0
5724#
5725# Example:
5726#
5727# 1. Read operation
5728#
5729# { "event": "QUORUM_REPORT_BAD",
5730# "data": { "node-name": "node0", "sector-num": 345435, "sectors-count": 5,
5731# "type": "read" },
5732# "timestamp": { "seconds": 1344522075, "microseconds": 745528 } }
5733#
5734# 2. Flush operation
5735#
5736# { "event": "QUORUM_REPORT_BAD",
5737# "data": { "node-name": "node0", "sector-num": 0, "sectors-count": 2097120,
5738# "type": "flush", "error": "Broken pipe" },
5739# "timestamp": { "seconds": 1456406829, "microseconds": 291763 } }
5740#
5741##
5742{ 'event': 'QUORUM_REPORT_BAD',
5743 'data': { 'type': 'QuorumOpType', '*error': 'str', 'node-name': 'str',
5744 'sector-num': 'int', 'sectors-count': 'int' } }
5745
5746##
5747# @BlockdevSnapshotInternal:
5748#
5749# @device: the device name or node-name of a root node to generate the snapshot
5750# from
5751#
5752# @name: the name of the internal snapshot to be created
5753#
5754# Notes: In transaction, if @name is empty, or any snapshot matching @name
5755# exists, the operation will fail. Only some image formats support it,
09ec8517 5756# for example, qcow2, and rbd.
b3cf1ec0
KW
5757#
5758# Since: 1.7
5759##
5760{ 'struct': 'BlockdevSnapshotInternal',
5761 'data': { 'device': 'str', 'name': 'str' } }
5762
5763##
5764# @blockdev-snapshot-internal-sync:
5765#
5766# Synchronously take an internal snapshot of a block device, when the
5767# format of the image used supports it. If the name is an empty
5768# string, or a snapshot with name already exists, the operation will
5769# fail.
5770#
5771# For the arguments, see the documentation of BlockdevSnapshotInternal.
5772#
5773# Returns: - nothing on success
5774# - If @device is not a valid block device, GenericError
5775# - If any snapshot matching @name exists, or @name is empty,
5776# GenericError
5777# - If the format of the image used does not support it,
5778# BlockFormatFeatureNotSupported
5779#
5780# Since: 1.7
5781#
5782# Example:
5783#
5784# -> { "execute": "blockdev-snapshot-internal-sync",
5785# "arguments": { "device": "ide-hd0",
5786# "name": "snapshot0" }
5787# }
5788# <- { "return": {} }
5789#
5790##
5791{ 'command': 'blockdev-snapshot-internal-sync',
f55ba801
PB
5792 'data': 'BlockdevSnapshotInternal',
5793 'allow-preconfig': true }
b3cf1ec0
KW
5794
5795##
5796# @blockdev-snapshot-delete-internal-sync:
5797#
5798# Synchronously delete an internal snapshot of a block device, when the format
5799# of the image used support it. The snapshot is identified by name or id or
5800# both. One of the name or id is required. Return SnapshotInfo for the
5801# successfully deleted snapshot.
5802#
5803# @device: the device name or node-name of a root node to delete the snapshot
5804# from
5805#
5806# @id: optional the snapshot's ID to be deleted
5807#
5808# @name: optional the snapshot's name to be deleted
5809#
5810# Returns: - SnapshotInfo on success
5811# - If @device is not a valid block device, GenericError
5812# - If snapshot not found, GenericError
5813# - If the format of the image used does not support it,
5814# BlockFormatFeatureNotSupported
5815# - If @id and @name are both not specified, GenericError
5816#
5817# Since: 1.7
5818#
5819# Example:
5820#
5821# -> { "execute": "blockdev-snapshot-delete-internal-sync",
5822# "arguments": { "device": "ide-hd0",
5823# "name": "snapshot0" }
5824# }
5825# <- { "return": {
5826# "id": "1",
5827# "name": "snapshot0",
5828# "vm-state-size": 0,
5829# "date-sec": 1000012,
5830# "date-nsec": 10,
5831# "vm-clock-sec": 100,
b39847a5
PD
5832# "vm-clock-nsec": 20,
5833# "icount": 220414
b3cf1ec0
KW
5834# }
5835# }
5836#
5837##
5838{ 'command': 'blockdev-snapshot-delete-internal-sync',
5839 'data': { 'device': 'str', '*id': 'str', '*name': 'str'},
f55ba801
PB
5840 'returns': 'SnapshotInfo',
5841 'allow-preconfig': true }
456e7517
HR
5842
5843##
5844# @DummyBlockCoreForceArrays:
5845#
c04d0ab0 5846# Not used by QMP; hack to let us use BlockGraphInfoList internally
456e7517
HR
5847#
5848# Since: 8.0
5849##
5850{ 'struct': 'DummyBlockCoreForceArrays',
c04d0ab0 5851 'data': { 'unused-block-graph-info': ['BlockGraphInfo'] } }