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