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