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