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