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