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