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