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