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