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