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