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