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