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