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