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