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