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