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