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