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