]> git.proxmox.com Git - mirror_qemu.git/blame - qapi/block-core.json
iotests: Skip 181 and 201 without userfaultfd
[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##
1053# @BlockJobType:
1054#
1055# Type of a block job.
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##
1067{ 'enum': 'BlockJobType',
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
BC
1150#
1151# @len: the maximum progress value
1152#
1153# @busy: false if the job is known to be in a quiescent state, with
1154# no pending I/O. Since 1.3.
1155#
1156# @paused: whether the job is paused or, if @busy is true, will
1157# pause itself as soon as possible. Since 1.3.
1158#
1159# @offset: the current progress value
1160#
1161# @speed: the rate limit, bytes per second
1162#
1163# @io-status: the status of the job (since 1.3)
1164#
ef6dbf1e
HR
1165# @ready: true if the job may be completed (since 2.2)
1166#
58b295ba
JS
1167# @status: Current job state/status (since 2.12)
1168#
b40dacdc
JS
1169# @auto-finalize: Job will finalize itself when PENDING, moving to
1170# the CONCLUDED state. (since 2.12)
1171#
1172# @auto-dismiss: Job will dismiss itself when CONCLUDED, moving to the NULL
1173# state and disappearing from the query list. (since 2.12)
1174#
ab9ba614
JS
1175# @error: Error information if the job did not complete successfully.
1176# Not set if the job completed successfully. (since 2.12.1)
1177#
1ad166b6
BC
1178# Since: 1.1
1179##
895a2a80 1180{ 'struct': 'BlockJobInfo',
1ad166b6
BC
1181 'data': {'type': 'str', 'device': 'str', 'len': 'int',
1182 'offset': 'int', 'busy': 'bool', 'paused': 'bool', 'speed': 'int',
58b295ba 1183 'io-status': 'BlockDeviceIoStatus', 'ready': 'bool',
b40dacdc 1184 'status': 'BlockJobStatus',
ab9ba614
JS
1185 'auto-finalize': 'bool', 'auto-dismiss': 'bool',
1186 '*error': 'str' } }
1ad166b6
BC
1187
1188##
1189# @query-block-jobs:
1190#
1191# Return information about long-running block device operations.
1192#
1193# Returns: a list of @BlockJobInfo for each active block job
1194#
1195# Since: 1.1
1196##
1197{ 'command': 'query-block-jobs', 'returns': ['BlockJobInfo'] }
1198
1199##
1200# @block_passwd:
1201#
1202# This command sets the password of a block device that has not been open
1203# with a password and requires one.
1204#
c01c214b 1205# This command is now obsolete and will always return an error since 2.10
91f96b64 1206#
1ad166b6
BC
1207##
1208{ 'command': 'block_passwd', 'data': {'*device': 'str',
1209 '*node-name': 'str', 'password': 'str'} }
1210
1211##
5072f7b3 1212# @block_resize:
1ad166b6
BC
1213#
1214# Resize a block image while a guest is running.
1215#
1216# Either @device or @node-name must be set but not both.
1217#
1d8bda12 1218# @device: the name of the device to get the image resized
1ad166b6 1219#
1d8bda12 1220# @node-name: graph node name to get the image resized (Since 2.0)
1ad166b6
BC
1221#
1222# @size: new image size in bytes
1223#
1224# Returns: nothing on success
1225# If @device is not a valid block device, DeviceNotFound
1226#
1227# Since: 0.14.0
0dc869cf
MAL
1228#
1229# Example:
1230#
1231# -> { "execute": "block_resize",
1232# "arguments": { "device": "scratch", "size": 1073741824 } }
1233# <- { "return": {} }
1234#
1ad166b6
BC
1235##
1236{ 'command': 'block_resize', 'data': { '*device': 'str',
1237 '*node-name': 'str',
1238 'size': 'int' }}
1239
1240##
5072f7b3 1241# @NewImageMode:
1ad166b6
BC
1242#
1243# An enumeration that tells QEMU how to set the backing file path in
1244# a new image file.
1245#
1246# @existing: QEMU should look for an existing image file.
1247#
1248# @absolute-paths: QEMU should create a new image with absolute paths
1249# for the backing file. If there is no backing file available, the new
1250# image will not be backed either.
1251#
1252# Since: 1.1
1253##
1254{ 'enum': 'NewImageMode',
1255 'data': [ 'existing', 'absolute-paths' ] }
1256
1257##
5072f7b3 1258# @BlockdevSnapshotSync:
1ad166b6
BC
1259#
1260# Either @device or @node-name must be set but not both.
1261#
1d8bda12 1262# @device: the name of the device to generate the snapshot from.
1ad166b6 1263#
1d8bda12 1264# @node-name: graph node name to generate the snapshot from (Since 2.0)
1ad166b6 1265#
b4039d8d
MAL
1266# @snapshot-file: the target of the new image. If the file exists, or
1267# if it is a device, the snapshot will be created in the existing
1268# file/device. Otherwise, a new file will be created.
1ad166b6 1269#
1d8bda12 1270# @snapshot-node-name: the graph node name of the new image (Since 2.0)
1ad166b6 1271#
1d8bda12 1272# @format: the format of the snapshot image, default is 'qcow2'.
1ad166b6 1273#
1d8bda12 1274# @mode: whether and how QEMU should create a new image, default is
1ad166b6
BC
1275# 'absolute-paths'.
1276##
a911e6ae 1277{ 'struct': 'BlockdevSnapshotSync',
1ad166b6
BC
1278 'data': { '*device': 'str', '*node-name': 'str',
1279 'snapshot-file': 'str', '*snapshot-node-name': 'str',
1280 '*format': 'str', '*mode': 'NewImageMode' } }
1281
43de7e2d 1282##
5072f7b3 1283# @BlockdevSnapshot:
43de7e2d
AG
1284#
1285# @node: device or node name that will have a snapshot created.
1286#
1287# @overlay: reference to the existing block device that will become
1288# the overlay of @node, as part of creating the snapshot.
1289# It must not have a current backing file (this can be
4f7be280 1290# achieved by passing "backing": null to blockdev-add).
43de7e2d 1291#
5072f7b3 1292# Since: 2.5
43de7e2d
AG
1293##
1294{ 'struct': 'BlockdevSnapshot',
1295 'data': { 'node': 'str', 'overlay': 'str' } }
1296
1ad166b6 1297##
5072f7b3 1298# @DriveBackup:
1ad166b6 1299#
1d8bda12 1300# @job-id: identifier for the newly-created block job. If
70559d49
AG
1301# omitted, the device name will be used. (Since 2.7)
1302#
b7e4fa22 1303# @device: the device name or node-name of a root node which should be copied.
1ad166b6
BC
1304#
1305# @target: the target of the new image. If the file exists, or if it
1306# is a device, the existing file/device will be used as the new
1307# destination. If it does not exist, a new file will be created.
1308#
1d8bda12 1309# @format: the format of the new destination, default is to
1ad166b6
BC
1310# probe if @mode is 'existing', else the format of the source
1311#
1312# @sync: what parts of the disk image should be copied to the destination
d58d8453
JS
1313# (all the disk, only the sectors allocated in the topmost image, from a
1314# dirty bitmap, or only new I/O).
1ad166b6 1315#
1d8bda12 1316# @mode: whether and how QEMU should create a new image, default is
1ad166b6
BC
1317# 'absolute-paths'.
1318#
1d8bda12 1319# @speed: the maximum speed, in bytes per second
1ad166b6 1320#
1d8bda12 1321# @bitmap: the name of dirty bitmap if sync is "incremental".
4b80ab2b 1322# Must be present if sync is "incremental", must NOT be present
d58d8453
JS
1323# otherwise. (Since 2.4)
1324#
1d8bda12 1325# @compress: true to compress data, if the target format supports it.
6bed0280 1326# (default: false) (since 2.8)
13b9414b 1327#
1d8bda12 1328# @on-source-error: the action to take on an error on the source,
1ad166b6
BC
1329# default 'report'. 'stop' and 'enospc' can only be used
1330# if the block device supports io-status (see BlockInfo).
1331#
1d8bda12 1332# @on-target-error: the action to take on an error on the target,
1ad166b6
BC
1333# default 'report' (no limitations, since this applies to
1334# a different block device than @device).
1335#
b40dacdc
JS
1336# @auto-finalize: When false, this job will wait in a PENDING state after it has
1337# finished its work, waiting for @block-job-finalize.
1338# When true, this job will automatically perform its abort or
1339# commit actions.
1340# Defaults to true. (Since 2.12)
1341#
1342# @auto-dismiss: When false, this job will wait in a CONCLUDED state after it
1343# has completed ceased all work, and wait for @block-job-dismiss.
1344# When true, this job will automatically disappear from the query
1345# list without user intervention.
1346# Defaults to true. (Since 2.12)
1347#
5072f7b3
MAL
1348# Note: @on-source-error and @on-target-error only affect background
1349# I/O. If an error occurs during a guest write request, the device's
1350# rerror/werror actions will be used.
1ad166b6
BC
1351#
1352# Since: 1.6
1353##
895a2a80 1354{ 'struct': 'DriveBackup',
70559d49 1355 'data': { '*job-id': 'str', 'device': 'str', 'target': 'str',
b40dacdc
JS
1356 '*format': 'str', 'sync': 'MirrorSyncMode',
1357 '*mode': 'NewImageMode', '*speed': 'int',
1358 '*bitmap': 'str', '*compress': 'bool',
1ad166b6 1359 '*on-source-error': 'BlockdevOnError',
b40dacdc
JS
1360 '*on-target-error': 'BlockdevOnError',
1361 '*auto-finalize': 'bool', '*auto-dismiss': 'bool' } }
1ad166b6 1362
c29c1dd3 1363##
5072f7b3 1364# @BlockdevBackup:
c29c1dd3 1365#
1d8bda12 1366# @job-id: identifier for the newly-created block job. If
70559d49
AG
1367# omitted, the device name will be used. (Since 2.7)
1368#
cef34eeb 1369# @device: the device name or node-name of a root node which should be copied.
c29c1dd3 1370#
39d990ac 1371# @target: the device name or node-name of the backup target node.
c29c1dd3
FZ
1372#
1373# @sync: what parts of the disk image should be copied to the destination
1374# (all the disk, only the sectors allocated in the topmost image, or
1375# only new I/O).
1376#
1d8bda12 1377# @speed: the maximum speed, in bytes per second. The default is 0,
c29c1dd3
FZ
1378# for unlimited.
1379#
1d8bda12 1380# @compress: true to compress data, if the target format supports it.
6bed0280 1381# (default: false) (since 2.8)
3b7b1236 1382#
1d8bda12 1383# @on-source-error: the action to take on an error on the source,
c29c1dd3
FZ
1384# default 'report'. 'stop' and 'enospc' can only be used
1385# if the block device supports io-status (see BlockInfo).
1386#
1d8bda12 1387# @on-target-error: the action to take on an error on the target,
c29c1dd3
FZ
1388# default 'report' (no limitations, since this applies to
1389# a different block device than @device).
1390#
b40dacdc
JS
1391# @auto-finalize: When false, this job will wait in a PENDING state after it has
1392# finished its work, waiting for @block-job-finalize.
1393# When true, this job will automatically perform its abort or
1394# commit actions.
1395# Defaults to true. (Since 2.12)
1396#
1397# @auto-dismiss: When false, this job will wait in a CONCLUDED state after it
1398# has completed ceased all work, and wait for @block-job-dismiss.
1399# When true, this job will automatically disappear from the query
1400# list without user intervention.
1401# Defaults to true. (Since 2.12)
1402#
5072f7b3
MAL
1403# Note: @on-source-error and @on-target-error only affect background
1404# I/O. If an error occurs during a guest write request, the device's
1405# rerror/werror actions will be used.
c29c1dd3
FZ
1406#
1407# Since: 2.3
1408##
895a2a80 1409{ 'struct': 'BlockdevBackup',
70559d49 1410 'data': { '*job-id': 'str', 'device': 'str', 'target': 'str',
b40dacdc 1411 'sync': 'MirrorSyncMode', '*speed': 'int', '*compress': 'bool',
c29c1dd3 1412 '*on-source-error': 'BlockdevOnError',
b40dacdc
JS
1413 '*on-target-error': 'BlockdevOnError',
1414 '*auto-finalize': 'bool', '*auto-dismiss': 'bool' } }
c29c1dd3 1415
1ad166b6 1416##
5072f7b3 1417# @blockdev-snapshot-sync:
1ad166b6
BC
1418#
1419# Generates a synchronous snapshot of a block device.
1420#
a911e6ae 1421# For the arguments, see the documentation of BlockdevSnapshotSync.
1ad166b6
BC
1422#
1423# Returns: nothing on success
1424# If @device is not a valid block device, DeviceNotFound
1425#
5072f7b3 1426# Since: 0.14.0
b4039d8d
MAL
1427#
1428# Example:
1429#
1430# -> { "execute": "blockdev-snapshot-sync",
1431# "arguments": { "device": "ide-hd0",
1432# "snapshot-file":
1433# "/some/place/my-image",
1434# "format": "qcow2" } }
1435# <- { "return": {} }
1436#
1ad166b6
BC
1437##
1438{ 'command': 'blockdev-snapshot-sync',
a911e6ae 1439 'data': 'BlockdevSnapshotSync' }
1ad166b6 1440
43de7e2d
AG
1441
1442##
5072f7b3 1443# @blockdev-snapshot:
43de7e2d
AG
1444#
1445# Generates a snapshot of a block device.
1446#
3282eca4
MAL
1447# Create a snapshot, by installing 'node' as the backing image of
1448# 'overlay'. Additionally, if 'node' is associated with a block
1449# device, the block device changes to using 'overlay' as its new active
1450# image.
1451#
43de7e2d
AG
1452# For the arguments, see the documentation of BlockdevSnapshot.
1453#
5072f7b3 1454# Since: 2.5
3282eca4
MAL
1455#
1456# Example:
1457#
1458# -> { "execute": "blockdev-add",
244d04db
EB
1459# "arguments": { "driver": "qcow2",
1460# "node-name": "node1534",
1461# "file": { "driver": "file",
1462# "filename": "hd1.qcow2" },
4f7be280 1463# "backing": null } }
3282eca4
MAL
1464#
1465# <- { "return": {} }
1466#
1467# -> { "execute": "blockdev-snapshot",
1468# "arguments": { "node": "ide-hd0",
1469# "overlay": "node1534" } }
1470# <- { "return": {} }
1471#
43de7e2d
AG
1472##
1473{ 'command': 'blockdev-snapshot',
1474 'data': 'BlockdevSnapshot' }
1475
fa40e656 1476##
5072f7b3 1477# @change-backing-file:
fa40e656
JC
1478#
1479# Change the backing file in the image file metadata. This does not
1480# cause QEMU to reopen the image file to reparse the backing filename
1481# (it may, however, perform a reopen to change permissions from
1482# r/o -> r/w -> r/o, if needed). The new backing file string is written
1483# into the image file metadata, and the QEMU internal strings are
1484# updated.
1485#
1486# @image-node-name: The name of the block driver state node of the
280c4b3c
MAL
1487# image to modify. The "device" argument is used
1488# to verify "image-node-name" is in the chain
1489# described by "device".
fa40e656 1490#
7b5dca3f
KW
1491# @device: The device name or node-name of the root node that owns
1492# image-node-name.
fa40e656
JC
1493#
1494# @backing-file: The string to write as the backing file. This
1495# string is not validated, so care should be taken
1496# when specifying the string or the image chain may
1497# not be able to be reopened again.
1498#
280c4b3c
MAL
1499# Returns: Nothing on success
1500#
1501# If "device" does not exist or cannot be determined, DeviceNotFound
1502#
fa40e656
JC
1503# Since: 2.1
1504##
1505{ 'command': 'change-backing-file',
1506 'data': { 'device': 'str', 'image-node-name': 'str',
1507 'backing-file': 'str' } }
1508
1ad166b6 1509##
5072f7b3 1510# @block-commit:
1ad166b6
BC
1511#
1512# Live commit of data from overlay image nodes into backing nodes - i.e.,
1513# writes data between 'top' and 'base' into 'base'.
1514#
1d8bda12 1515# @job-id: identifier for the newly-created block job. If
fd62c609
AG
1516# omitted, the device name will be used. (Since 2.7)
1517#
1d13b167 1518# @device: the device name or node-name of a root node
1ad166b6 1519#
1d8bda12 1520# @base: The file name of the backing image to write data into.
f44fb58f 1521# If not specified, this is the deepest backing image.
1ad166b6 1522#
1d8bda12 1523# @top: The file name of the backing image within the image chain,
7676e2c5
JC
1524# which contains the topmost data to be committed down. If
1525# not specified, this is the active layer.
1ad166b6 1526#
1d8bda12 1527# @backing-file: The backing file string to write into the overlay
54e26900
JC
1528# image of 'top'. If 'top' is the active layer,
1529# specifying a backing file string is an error. This
1530# filename is not validated.
1531#
1532# If a pathname string is such that it cannot be
1533# resolved by QEMU, that means that subsequent QMP or
1534# HMP commands must use node-names for the image in
1535# question, as filename lookup methods will fail.
1536#
1537# If not specified, QEMU will automatically determine
1538# the backing file string to use, or error out if
1539# there is no obvious choice. Care should be taken
1540# when specifying the string, to specify a valid
1541# filename or protocol.
1542# (Since 2.1)
1543#
1ad166b6
BC
1544# If top == base, that is an error.
1545# If top == active, the job will not be completed by itself,
1546# user needs to complete the job with the block-job-complete
1547# command after getting the ready event. (Since 2.0)
1548#
1549# If the base image is smaller than top, then the base image
1550# will be resized to be the same size as top. If top is
1551# smaller than the base image, the base will not be
1552# truncated. If you want the base image size to match the
1553# size of the smaller top, you can safely truncate it
1554# yourself once the commit operation successfully completes.
1555#
1d8bda12 1556# @speed: the maximum speed, in bytes per second
1ad166b6 1557#
1d8bda12 1558# @filter-node-name: the node name that should be assigned to the
0db832f4
KW
1559# filter driver that the commit job inserts into the graph
1560# above @top. If this option is not given, a node name is
1561# autogenerated. (Since: 2.9)
1562#
1ad166b6
BC
1563# Returns: Nothing on success
1564# If commit or stream is already active on this device, DeviceInUse
1565# If @device does not exist, DeviceNotFound
1566# If image commit is not supported by this device, NotSupported
1567# If @base or @top is invalid, a generic error is returned
1568# If @speed is invalid, InvalidParameter
1569#
1570# Since: 1.3
1571#
f44fb58f
MAL
1572# Example:
1573#
1574# -> { "execute": "block-commit",
1575# "arguments": { "device": "virtio0",
1576# "top": "/tmp/snap1.qcow2" } }
1577# <- { "return": {} }
1578#
1ad166b6
BC
1579##
1580{ 'command': 'block-commit',
fd62c609 1581 'data': { '*job-id': 'str', 'device': 'str', '*base': 'str', '*top': 'str',
0db832f4
KW
1582 '*backing-file': 'str', '*speed': 'int',
1583 '*filter-node-name': 'str' } }
1ad166b6
BC
1584
1585##
5072f7b3 1586# @drive-backup:
1ad166b6
BC
1587#
1588# Start a point-in-time copy of a block device to a new destination. The
1589# status of ongoing drive-backup operations can be checked with
1590# query-block-jobs where the BlockJobInfo.type field has the value 'backup'.
1591# The operation can be stopped before it has completed using the
1592# block-job-cancel command.
1593#
1ad166b6 1594# Returns: nothing on success
b7e4fa22 1595# If @device is not a valid block device, GenericError
1ad166b6 1596#
5072f7b3 1597# Since: 1.6
b0336412
MAL
1598#
1599# Example:
1600#
1601# -> { "execute": "drive-backup",
1602# "arguments": { "device": "drive0",
1603# "sync": "full",
1604# "target": "backup.img" } }
1605# <- { "return": {} }
1606#
1ad166b6 1607##
81206a89
PB
1608{ 'command': 'drive-backup', 'boxed': true,
1609 'data': 'DriveBackup' }
1ad166b6 1610
c29c1dd3 1611##
5072f7b3 1612# @blockdev-backup:
c29c1dd3
FZ
1613#
1614# Start a point-in-time copy of a block device to a new destination. The
1615# status of ongoing blockdev-backup operations can be checked with
1616# query-block-jobs where the BlockJobInfo.type field has the value 'backup'.
1617# The operation can be stopped before it has completed using the
1618# block-job-cancel command.
1619#
dc7a4a9e
PB
1620# Returns: nothing on success
1621# If @device is not a valid block device, DeviceNotFound
1622#
5072f7b3 1623# Since: 2.3
1cf75113
MAL
1624#
1625# Example:
1626# -> { "execute": "blockdev-backup",
1627# "arguments": { "device": "src-id",
1628# "sync": "full",
1629# "target": "tgt-id" } }
1630# <- { "return": {} }
1631#
c29c1dd3 1632##
dc7a4a9e
PB
1633{ 'command': 'blockdev-backup', 'boxed': true,
1634 'data': 'BlockdevBackup' }
c29c1dd3
FZ
1635
1636
1ad166b6 1637##
5072f7b3 1638# @query-named-block-nodes:
1ad166b6
BC
1639#
1640# Get the named block driver list
1641#
1642# Returns: the list of BlockDeviceInfo
1643#
5072f7b3 1644# Since: 2.0
e1f34cb2
MAL
1645#
1646# Example:
1647#
1648# -> { "execute": "query-named-block-nodes" }
1649# <- { "return": [ { "ro":false,
1650# "drv":"qcow2",
1651# "encrypted":false,
1652# "file":"disks/test.qcow2",
1653# "node-name": "my-node",
1654# "backing_file_depth":1,
1655# "bps":1000000,
1656# "bps_rd":0,
1657# "bps_wr":0,
1658# "iops":1000000,
1659# "iops_rd":0,
1660# "iops_wr":0,
1661# "bps_max": 8000000,
1662# "bps_rd_max": 0,
1663# "bps_wr_max": 0,
1664# "iops_max": 0,
1665# "iops_rd_max": 0,
1666# "iops_wr_max": 0,
1667# "iops_size": 0,
1668# "write_threshold": 0,
1669# "image":{
1670# "filename":"disks/test.qcow2",
1671# "format":"qcow2",
1672# "virtual-size":2048000,
1673# "backing_file":"base.qcow2",
1674# "full-backing-filename":"disks/base.qcow2",
1675# "backing-filename-format":"qcow2",
1676# "snapshots":[
1677# {
1678# "id": "1",
1679# "name": "snapshot1",
1680# "vm-state-size": 0,
1681# "date-sec": 10000200,
1682# "date-nsec": 12,
1683# "vm-clock-sec": 206,
1684# "vm-clock-nsec": 30
1685# }
1686# ],
1687# "backing-image":{
1688# "filename":"disks/base.qcow2",
1689# "format":"qcow2",
1690# "virtual-size":2048000
1691# }
1692# } } ] }
1693#
1ad166b6
BC
1694##
1695{ 'command': 'query-named-block-nodes', 'returns': [ 'BlockDeviceInfo' ] }
1696
1697##
5072f7b3 1698# @drive-mirror:
1ad166b6 1699#
12a21b73
MAL
1700# Start mirroring a block device's writes to a new destination. target
1701# specifies the target of the new image. If the file exists, or if it
1702# is a device, it will be used as the new destination for writes. If
1703# it does not exist, a new file will be created. format specifies the
1704# format of the mirror image, default is to probe if mode='existing',
1705# else the format of the source.
1ad166b6 1706#
faecd40a 1707# Returns: nothing on success
0524e93a 1708# If @device is not a valid block device, GenericError
faecd40a 1709#
5072f7b3 1710# Since: 1.3
12a21b73
MAL
1711#
1712# Example:
1713#
1714# -> { "execute": "drive-mirror",
1715# "arguments": { "device": "ide-hd0",
1716# "target": "/some/place/my-image",
1717# "sync": "full",
1718# "format": "qcow2" } }
1719# <- { "return": {} }
1720#
faecd40a
EB
1721##
1722{ 'command': 'drive-mirror', 'boxed': true,
1723 'data': 'DriveMirror' }
1724
1725##
5072f7b3 1726# @DriveMirror:
faecd40a
EB
1727#
1728# A set of parameters describing drive mirror setup.
1729#
1d8bda12 1730# @job-id: identifier for the newly-created block job. If
71aa9867
AG
1731# omitted, the device name will be used. (Since 2.7)
1732#
0524e93a
KW
1733# @device: the device name or node-name of a root node whose writes should be
1734# mirrored.
1ad166b6
BC
1735#
1736# @target: the target of the new image. If the file exists, or if it
1737# is a device, the existing file/device will be used as the new
1738# destination. If it does not exist, a new file will be created.
1739#
1d8bda12 1740# @format: the format of the new destination, default is to
1ad166b6
BC
1741# probe if @mode is 'existing', else the format of the source
1742#
1d8bda12 1743# @node-name: the new block driver state node name in the graph
4c828dc6
BC
1744# (Since 2.1)
1745#
1d8bda12 1746# @replaces: with sync=full graph node name to be replaced by the new
09158f00
BC
1747# image when a whole image copy is done. This can be used to repair
1748# broken Quorum files. (Since 2.1)
1749#
1d8bda12 1750# @mode: whether and how QEMU should create a new image, default is
1ad166b6
BC
1751# 'absolute-paths'.
1752#
1d8bda12 1753# @speed: the maximum speed, in bytes per second
1ad166b6
BC
1754#
1755# @sync: what parts of the disk image should be copied to the destination
1756# (all the disk, only the sectors allocated in the topmost image, or
1757# only new I/O).
1758#
1d8bda12 1759# @granularity: granularity of the dirty bitmap, default is 64K
1ad166b6
BC
1760# if the image format doesn't have clusters, 4K if the clusters
1761# are smaller than that, else the cluster size. Must be a
1762# power of 2 between 512 and 64M (since 1.4).
1763#
1d8bda12 1764# @buf-size: maximum amount of data in flight from source to
1ad166b6
BC
1765# target (since 1.4).
1766#
1d8bda12 1767# @on-source-error: the action to take on an error on the source,
1ad166b6
BC
1768# default 'report'. 'stop' and 'enospc' can only be used
1769# if the block device supports io-status (see BlockInfo).
1770#
1d8bda12 1771# @on-target-error: the action to take on an error on the target,
1ad166b6
BC
1772# default 'report' (no limitations, since this applies to
1773# a different block device than @device).
1d8bda12 1774# @unmap: Whether to try to unmap target sectors where source has
0fc9f8ea
FZ
1775# only zero. If true, and target unallocated sectors will read as zero,
1776# target image sectors will be unmapped; otherwise, zeroes will be
1777# written. Both will result in identical contents.
1778# Default is true. (Since 2.4)
1ad166b6 1779#
5072f7b3 1780# Since: 1.3
1ad166b6 1781##
faecd40a 1782{ 'struct': 'DriveMirror',
71aa9867
AG
1783 'data': { '*job-id': 'str', 'device': 'str', 'target': 'str',
1784 '*format': 'str', '*node-name': 'str', '*replaces': 'str',
1ad166b6
BC
1785 'sync': 'MirrorSyncMode', '*mode': 'NewImageMode',
1786 '*speed': 'int', '*granularity': 'uint32',
1787 '*buf-size': 'int', '*on-source-error': 'BlockdevOnError',
0fc9f8ea
FZ
1788 '*on-target-error': 'BlockdevOnError',
1789 '*unmap': 'bool' } }
1ad166b6 1790
341ebc2f 1791##
5072f7b3 1792# @BlockDirtyBitmap:
341ebc2f
JS
1793#
1794# @node: name of device/node which the bitmap is tracking
1795#
1796# @name: name of the dirty bitmap
1797#
5072f7b3 1798# Since: 2.4
341ebc2f 1799##
895a2a80 1800{ 'struct': 'BlockDirtyBitmap',
341ebc2f
JS
1801 'data': { 'node': 'str', 'name': 'str' } }
1802
1803##
5072f7b3 1804# @BlockDirtyBitmapAdd:
341ebc2f
JS
1805#
1806# @node: name of device/node which the bitmap is tracking
1807#
1808# @name: name of the dirty bitmap
1809#
1d8bda12 1810# @granularity: the bitmap granularity, default is 64k for
341ebc2f
JS
1811# block-dirty-bitmap-add
1812#
fd5ae4cc
VSO
1813# @persistent: the bitmap is persistent, i.e. it will be saved to the
1814# corresponding block device image file on its close. For now only
1815# Qcow2 disks support persistent bitmaps. Default is false for
1816# block-dirty-bitmap-add. (Since: 2.10)
1817#
3e99da5e
VSO
1818# @autoload: ignored and deprecated since 2.12.
1819# Currently, all dirty tracking bitmaps are loaded from Qcow2 on
1820# open.
eb738bb5 1821#
5072f7b3 1822# Since: 2.4
341ebc2f 1823##
895a2a80 1824{ 'struct': 'BlockDirtyBitmapAdd',
fd5ae4cc 1825 'data': { 'node': 'str', 'name': 'str', '*granularity': 'uint32',
eb738bb5 1826 '*persistent': 'bool', '*autoload': 'bool' } }
341ebc2f
JS
1827
1828##
5072f7b3 1829# @block-dirty-bitmap-add:
341ebc2f 1830#
2258a5db 1831# Create a dirty bitmap with a name on the node, and start tracking the writes.
341ebc2f
JS
1832#
1833# Returns: nothing on success
1834# If @node is not a valid block device or node, DeviceNotFound
1835# If @name is already taken, GenericError with an explanation
1836#
5072f7b3 1837# Since: 2.4
2258a5db
MAL
1838#
1839# Example:
1840#
1841# -> { "execute": "block-dirty-bitmap-add",
1842# "arguments": { "node": "drive0", "name": "bitmap0" } }
1843# <- { "return": {} }
1844#
341ebc2f
JS
1845##
1846{ 'command': 'block-dirty-bitmap-add',
1847 'data': 'BlockDirtyBitmapAdd' }
1848
1849##
5072f7b3 1850# @block-dirty-bitmap-remove:
341ebc2f 1851#
4bbca422 1852# Stop write tracking and remove the dirty bitmap that was created
5c36c1af
VSO
1853# with block-dirty-bitmap-add. If the bitmap is persistent, remove it from its
1854# storage too.
341ebc2f
JS
1855#
1856# Returns: nothing on success
1857# If @node is not a valid block device or node, DeviceNotFound
1858# If @name is not found, GenericError with an explanation
9bd2b08f 1859# if @name is frozen by an operation, GenericError
341ebc2f 1860#
5072f7b3 1861# Since: 2.4
4bbca422
MAL
1862#
1863# Example:
1864#
1865# -> { "execute": "block-dirty-bitmap-remove",
1866# "arguments": { "node": "drive0", "name": "bitmap0" } }
1867# <- { "return": {} }
1868#
341ebc2f
JS
1869##
1870{ 'command': 'block-dirty-bitmap-remove',
1871 'data': 'BlockDirtyBitmap' }
1872
e74e6b78 1873##
5072f7b3 1874# @block-dirty-bitmap-clear:
e74e6b78 1875#
73dffdc8
MAL
1876# Clear (reset) a dirty bitmap on the device, so that an incremental
1877# backup from this point in time forward will only backup clusters
1878# modified after this clear operation.
e74e6b78
JS
1879#
1880# Returns: nothing on success
1881# If @node is not a valid block device, DeviceNotFound
1882# If @name is not found, GenericError with an explanation
1883#
5072f7b3 1884# Since: 2.4
73dffdc8
MAL
1885#
1886# Example:
1887#
1888# -> { "execute": "block-dirty-bitmap-clear",
1889# "arguments": { "node": "drive0", "name": "bitmap0" } }
1890# <- { "return": {} }
1891#
e74e6b78
JS
1892##
1893{ 'command': 'block-dirty-bitmap-clear',
1894 'data': 'BlockDirtyBitmap' }
1895
a3b52535
VSO
1896##
1897# @BlockDirtyBitmapSha256:
1898#
1899# SHA256 hash of dirty bitmap data
1900#
1901# @sha256: ASCII representation of SHA256 bitmap hash
1902#
1903# Since: 2.10
1904##
1905 { 'struct': 'BlockDirtyBitmapSha256',
1906 'data': {'sha256': 'str'} }
1907
1908##
1909# @x-debug-block-dirty-bitmap-sha256:
1910#
1911# Get bitmap SHA256
1912#
1913# Returns: BlockDirtyBitmapSha256 on success
1914# If @node is not a valid block device, DeviceNotFound
1915# If @name is not found or if hashing has failed, GenericError with an
1916# explanation
1917#
1918# Since: 2.10
1919##
1920 { 'command': 'x-debug-block-dirty-bitmap-sha256',
1921 'data': 'BlockDirtyBitmap', 'returns': 'BlockDirtyBitmapSha256' }
1922
df92562e 1923##
5072f7b3 1924# @blockdev-mirror:
df92562e
FZ
1925#
1926# Start mirroring a block device's writes to a new destination.
1927#
1d8bda12 1928# @job-id: identifier for the newly-created block job. If
71aa9867
AG
1929# omitted, the device name will be used. (Since 2.7)
1930#
07eec652
KW
1931# @device: The device name or node-name of a root node whose writes should be
1932# mirrored.
df92562e
FZ
1933#
1934# @target: the id or node-name of the block device to mirror to. This mustn't be
1935# attached to guest.
1936#
1d8bda12 1937# @replaces: with sync=full graph node name to be replaced by the new
df92562e
FZ
1938# image when a whole image copy is done. This can be used to repair
1939# broken Quorum files.
1940#
1d8bda12 1941# @speed: the maximum speed, in bytes per second
df92562e
FZ
1942#
1943# @sync: what parts of the disk image should be copied to the destination
1944# (all the disk, only the sectors allocated in the topmost image, or
1945# only new I/O).
1946#
1d8bda12 1947# @granularity: granularity of the dirty bitmap, default is 64K
df92562e
FZ
1948# if the image format doesn't have clusters, 4K if the clusters
1949# are smaller than that, else the cluster size. Must be a
1950# power of 2 between 512 and 64M
1951#
1d8bda12 1952# @buf-size: maximum amount of data in flight from source to
df92562e
FZ
1953# target
1954#
1d8bda12 1955# @on-source-error: the action to take on an error on the source,
df92562e
FZ
1956# default 'report'. 'stop' and 'enospc' can only be used
1957# if the block device supports io-status (see BlockInfo).
1958#
1d8bda12 1959# @on-target-error: the action to take on an error on the target,
df92562e
FZ
1960# default 'report' (no limitations, since this applies to
1961# a different block device than @device).
1962#
1d8bda12 1963# @filter-node-name: the node name that should be assigned to the
6cdbceb1
KW
1964# filter driver that the mirror job inserts into the graph
1965# above @device. If this option is not given, a node name is
1966# autogenerated. (Since: 2.9)
1967#
df92562e
FZ
1968# Returns: nothing on success.
1969#
5072f7b3 1970# Since: 2.6
f6235a25
MAL
1971#
1972# Example:
1973#
1974# -> { "execute": "blockdev-mirror",
1975# "arguments": { "device": "ide-hd0",
1976# "target": "target0",
1977# "sync": "full" } }
1978# <- { "return": {} }
1979#
df92562e
FZ
1980##
1981{ 'command': 'blockdev-mirror',
71aa9867 1982 'data': { '*job-id': 'str', 'device': 'str', 'target': 'str',
df92562e
FZ
1983 '*replaces': 'str',
1984 'sync': 'MirrorSyncMode',
1985 '*speed': 'int', '*granularity': 'uint32',
1986 '*buf-size': 'int', '*on-source-error': 'BlockdevOnError',
6cdbceb1
KW
1987 '*on-target-error': 'BlockdevOnError',
1988 '*filter-node-name': 'str' } }
df92562e 1989
1ad166b6
BC
1990##
1991# @block_set_io_throttle:
1992#
1993# Change I/O throttle limits for a block drive.
1994#
76f4afb4
AG
1995# Since QEMU 2.4, each device with I/O limits is member of a throttle
1996# group.
1997#
1998# If two or more devices are members of the same group, the limits
1999# will apply to the combined I/O of the whole group in a round-robin
2000# fashion. Therefore, setting new I/O limits to a device will affect
2001# the whole group.
2002#
2003# The name of the group can be specified using the 'group' parameter.
2004# If the parameter is unset, it is assumed to be the current group of
2005# that device. If it's not in any group yet, the name of the device
2006# will be used as the name for its group.
2007#
2008# The 'group' parameter can also be used to move a device to a
2009# different group. In this case the limits specified in the parameters
2010# will be applied to the new group only.
2011#
2012# I/O limits can be disabled by setting all of them to 0. In this case
2013# the device will be removed from its group and the rest of its
6b932c0a 2014# members will not be affected. The 'group' parameter is ignored.
76f4afb4 2015#
4dc9397b
EB
2016# Returns: Nothing on success
2017# If @device is not a valid block device, DeviceNotFound
2018#
2019# Since: 1.1
b4a0ac14
MAL
2020#
2021# Example:
2022#
2023# -> { "execute": "block_set_io_throttle",
dc15541d
SH
2024# "arguments": { "id": "virtio-blk-pci0/virtio-backend",
2025# "bps": 0,
2026# "bps_rd": 0,
2027# "bps_wr": 0,
2028# "iops": 512,
2029# "iops_rd": 0,
2030# "iops_wr": 0,
2031# "bps_max": 0,
2032# "bps_rd_max": 0,
2033# "bps_wr_max": 0,
2034# "iops_max": 0,
2035# "iops_rd_max": 0,
2036# "iops_wr_max": 0,
2037# "bps_max_length": 0,
2038# "iops_size": 0 } }
2039# <- { "return": {} }
2040#
2041# -> { "execute": "block_set_io_throttle",
b4a0ac14
MAL
2042# "arguments": { "id": "ide0-1-0",
2043# "bps": 1000000,
2044# "bps_rd": 0,
2045# "bps_wr": 0,
2046# "iops": 0,
2047# "iops_rd": 0,
2048# "iops_wr": 0,
2049# "bps_max": 8000000,
2050# "bps_rd_max": 0,
2051# "bps_wr_max": 0,
2052# "iops_max": 0,
2053# "iops_rd_max": 0,
2054# "iops_wr_max": 0,
2055# "bps_max_length": 60,
2056# "iops_size": 0 } }
2057# <- { "return": {} }
4dc9397b
EB
2058##
2059{ 'command': 'block_set_io_throttle', 'boxed': true,
2060 'data': 'BlockIOThrottle' }
2061
2062##
5072f7b3 2063# @BlockIOThrottle:
4dc9397b
EB
2064#
2065# A set of parameters describing block throttling.
2066#
1d8bda12 2067# @device: Block device name (deprecated, use @id instead)
7a9877a0 2068#
1d8bda12 2069# @id: The name or QOM path of the guest device (since: 2.8)
1ad166b6
BC
2070#
2071# @bps: total throughput limit in bytes per second
2072#
2073# @bps_rd: read throughput limit in bytes per second
2074#
2075# @bps_wr: write throughput limit in bytes per second
2076#
2077# @iops: total I/O operations per second
2078#
f5a845fd 2079# @iops_rd: read I/O operations per second
1ad166b6
BC
2080#
2081# @iops_wr: write I/O operations per second
2082#
1d8bda12 2083# @bps_max: total throughput limit during bursts,
dce13204 2084# in bytes (Since 1.7)
1ad166b6 2085#
1d8bda12 2086# @bps_rd_max: read throughput limit during bursts,
dce13204 2087# in bytes (Since 1.7)
1ad166b6 2088#
1d8bda12 2089# @bps_wr_max: write throughput limit during bursts,
dce13204 2090# in bytes (Since 1.7)
1ad166b6 2091#
1d8bda12 2092# @iops_max: total I/O operations per second during bursts,
dce13204 2093# in bytes (Since 1.7)
1ad166b6 2094#
1d8bda12 2095# @iops_rd_max: read I/O operations per second during bursts,
dce13204 2096# in bytes (Since 1.7)
1ad166b6 2097#
1d8bda12 2098# @iops_wr_max: write I/O operations per second during bursts,
dce13204
AG
2099# in bytes (Since 1.7)
2100#
1d8bda12 2101# @bps_max_length: maximum length of the @bps_max burst
dce13204
AG
2102# period, in seconds. It must only
2103# be set if @bps_max is set as well.
2104# Defaults to 1. (Since 2.6)
2105#
1d8bda12 2106# @bps_rd_max_length: maximum length of the @bps_rd_max
dce13204
AG
2107# burst period, in seconds. It must only
2108# be set if @bps_rd_max is set as well.
2109# Defaults to 1. (Since 2.6)
2110#
1d8bda12 2111# @bps_wr_max_length: maximum length of the @bps_wr_max
dce13204
AG
2112# burst period, in seconds. It must only
2113# be set if @bps_wr_max is set as well.
2114# Defaults to 1. (Since 2.6)
2115#
1d8bda12 2116# @iops_max_length: maximum length of the @iops burst
dce13204
AG
2117# period, in seconds. It must only
2118# be set if @iops_max is set as well.
2119# Defaults to 1. (Since 2.6)
2120#
1d8bda12 2121# @iops_rd_max_length: maximum length of the @iops_rd_max
dce13204
AG
2122# burst period, in seconds. It must only
2123# be set if @iops_rd_max is set as well.
2124# Defaults to 1. (Since 2.6)
2125#
1d8bda12 2126# @iops_wr_max_length: maximum length of the @iops_wr_max
dce13204
AG
2127# burst period, in seconds. It must only
2128# be set if @iops_wr_max is set as well.
2129# Defaults to 1. (Since 2.6)
1ad166b6 2130#
1d8bda12 2131# @iops_size: an I/O size in bytes (Since 1.7)
1ad166b6 2132#
1d8bda12 2133# @group: throttle group name (Since 2.4)
76f4afb4 2134#
1ad166b6
BC
2135# Since: 1.1
2136##
4dc9397b 2137{ 'struct': 'BlockIOThrottle',
7a9877a0
KW
2138 'data': { '*device': 'str', '*id': 'str', 'bps': 'int', 'bps_rd': 'int',
2139 'bps_wr': 'int', 'iops': 'int', 'iops_rd': 'int', 'iops_wr': 'int',
1ad166b6
BC
2140 '*bps_max': 'int', '*bps_rd_max': 'int',
2141 '*bps_wr_max': 'int', '*iops_max': 'int',
2142 '*iops_rd_max': 'int', '*iops_wr_max': 'int',
dce13204
AG
2143 '*bps_max_length': 'int', '*bps_rd_max_length': 'int',
2144 '*bps_wr_max_length': 'int', '*iops_max_length': 'int',
2145 '*iops_rd_max_length': 'int', '*iops_wr_max_length': 'int',
76f4afb4 2146 '*iops_size': 'int', '*group': 'str' } }
1ad166b6 2147
432d889e
MP
2148##
2149# @ThrottleLimits:
2150#
2151# Limit parameters for throttling.
2152# Since some limit combinations are illegal, limits should always be set in one
2153# transaction. All fields are optional. When setting limits, if a field is
2154# missing the current value is not changed.
2155#
2156# @iops-total: limit total I/O operations per second
2157# @iops-total-max: I/O operations burst
2158# @iops-total-max-length: length of the iops-total-max burst period, in seconds
2159# It must only be set if @iops-total-max is set as well.
2160# @iops-read: limit read operations per second
2161# @iops-read-max: I/O operations read burst
2162# @iops-read-max-length: length of the iops-read-max burst period, in seconds
2163# It must only be set if @iops-read-max is set as well.
2164# @iops-write: limit write operations per second
2165# @iops-write-max: I/O operations write burst
2166# @iops-write-max-length: length of the iops-write-max burst period, in seconds
2167# It must only be set if @iops-write-max is set as well.
2168# @bps-total: limit total bytes per second
2169# @bps-total-max: total bytes burst
2170# @bps-total-max-length: length of the bps-total-max burst period, in seconds.
2171# It must only be set if @bps-total-max is set as well.
2172# @bps-read: limit read bytes per second
2173# @bps-read-max: total bytes read burst
2174# @bps-read-max-length: length of the bps-read-max burst period, in seconds
2175# It must only be set if @bps-read-max is set as well.
2176# @bps-write: limit write bytes per second
2177# @bps-write-max: total bytes write burst
2178# @bps-write-max-length: length of the bps-write-max burst period, in seconds
2179# It must only be set if @bps-write-max is set as well.
2180# @iops-size: when limiting by iops max size of an I/O in bytes
2181#
2182# Since: 2.11
2183##
2184{ 'struct': 'ThrottleLimits',
2185 'data': { '*iops-total' : 'int', '*iops-total-max' : 'int',
2186 '*iops-total-max-length' : 'int', '*iops-read' : 'int',
2187 '*iops-read-max' : 'int', '*iops-read-max-length' : 'int',
2188 '*iops-write' : 'int', '*iops-write-max' : 'int',
2189 '*iops-write-max-length' : 'int', '*bps-total' : 'int',
2190 '*bps-total-max' : 'int', '*bps-total-max-length' : 'int',
2191 '*bps-read' : 'int', '*bps-read-max' : 'int',
2192 '*bps-read-max-length' : 'int', '*bps-write' : 'int',
2193 '*bps-write-max' : 'int', '*bps-write-max-length' : 'int',
2194 '*iops-size' : 'int' } }
2195
1ad166b6
BC
2196##
2197# @block-stream:
2198#
2199# Copy data from a backing file into a block device.
2200#
2201# The block streaming operation is performed in the background until the entire
2202# backing file has been copied. This command returns immediately once streaming
2203# has started. The status of ongoing block streaming operations can be checked
2204# with query-block-jobs. The operation can be stopped before it has completed
2205# using the block-job-cancel command.
2206#
554b6147
AG
2207# The node that receives the data is called the top image, can be located in
2208# any part of the chain (but always above the base image; see below) and can be
2209# specified using its device or node name. Earlier qemu versions only allowed
2210# 'device' to name the top level node; presence of the 'base-node' parameter
2211# during introspection can be used as a witness of the enhanced semantics
2212# of 'device'.
2213#
1ad166b6
BC
2214# If a base file is specified then sectors are not copied from that base file and
2215# its backing chain. When streaming completes the image file will have the base
2216# file as its backing file. This can be used to stream a subset of the backing
2217# file chain instead of flattening the entire image.
2218#
2219# On successful completion the image file is updated to drop the backing file
2220# and the BLOCK_JOB_COMPLETED event is emitted.
2221#
1d8bda12 2222# @job-id: identifier for the newly-created block job. If
2323322e
AG
2223# omitted, the device name will be used. (Since 2.7)
2224#
554b6147 2225# @device: the device or node name of the top image
1ad166b6 2226#
1d8bda12 2227# @base: the common backing file name.
312fe09c
AG
2228# It cannot be set if @base-node is also set.
2229#
1d8bda12 2230# @base-node: the node name of the backing file.
312fe09c 2231# It cannot be set if @base is also set. (Since 2.8)
1ad166b6 2232#
1d8bda12 2233# @backing-file: The backing file string to write into the top
554b6147 2234# image. This filename is not validated.
13d8cc51
JC
2235#
2236# If a pathname string is such that it cannot be
2237# resolved by QEMU, that means that subsequent QMP or
2238# HMP commands must use node-names for the image in
2239# question, as filename lookup methods will fail.
2240#
2241# If not specified, QEMU will automatically determine
2242# the backing file string to use, or error out if there
2243# is no obvious choice. Care should be taken when
2244# specifying the string, to specify a valid filename or
2245# protocol.
2246# (Since 2.1)
2247#
1d8bda12 2248# @speed: the maximum speed, in bytes per second
1ad166b6 2249#
1d8bda12 2250# @on-error: the action to take on an error (default report).
1ad166b6
BC
2251# 'stop' and 'enospc' can only be used if the block device
2252# supports io-status (see BlockInfo). Since 1.3.
2253#
49b37c23
MAL
2254# Returns: Nothing on success. If @device does not exist, DeviceNotFound.
2255#
1ad166b6 2256# Since: 1.1
49b37c23
MAL
2257#
2258# Example:
2259#
2260# -> { "execute": "block-stream",
2261# "arguments": { "device": "virtio0",
2262# "base": "/tmp/master.qcow2" } }
2263# <- { "return": {} }
2264#
1ad166b6
BC
2265##
2266{ 'command': 'block-stream',
2323322e 2267 'data': { '*job-id': 'str', 'device': 'str', '*base': 'str',
312fe09c 2268 '*base-node': 'str', '*backing-file': 'str', '*speed': 'int',
2323322e 2269 '*on-error': 'BlockdevOnError' } }
1ad166b6
BC
2270
2271##
2272# @block-job-set-speed:
2273#
2274# Set maximum speed for a background block operation.
2275#
2276# This command can only be issued when there is an active block job.
2277#
2278# Throttling can be disabled by setting the speed to 0.
2279#
6aae5be6
AG
2280# @device: The job identifier. This used to be a device name (hence
2281# the name of the parameter), but since QEMU 2.7 it can have
2282# other values.
1ad166b6
BC
2283#
2284# @speed: the maximum speed, in bytes per second, or 0 for unlimited.
2285# Defaults to 0.
2286#
2287# Returns: Nothing on success
2288# If no background operation is active on this device, DeviceNotActive
2289#
2290# Since: 1.1
2291##
2292{ 'command': 'block-job-set-speed',
2293 'data': { 'device': 'str', 'speed': 'int' } }
2294
2295##
2296# @block-job-cancel:
2297#
2298# Stop an active background block operation.
2299#
2300# This command returns immediately after marking the active background block
2301# operation for cancellation. It is an error to call this command if no
2302# operation is in progress.
2303#
2304# The operation will cancel as soon as possible and then emit the
2305# BLOCK_JOB_CANCELLED event. Before that happens the job is still visible when
2306# enumerated using query-block-jobs.
2307#
c117bb14
KC
2308# Note that if you issue 'block-job-cancel' after 'drive-mirror' has indicated
2309# (via the event BLOCK_JOB_READY) that the source and destination are
2310# synchronized, then the event triggered by this command changes to
2311# BLOCK_JOB_COMPLETED, to indicate that the mirroring has ended and the
2312# destination now has a point-in-time copy tied to the time of the cancellation.
2313#
1ad166b6
BC
2314# For streaming, the image file retains its backing file unless the streaming
2315# operation happens to complete just as it is being cancelled. A new streaming
2316# operation can be started at a later time to finish copying all data from the
2317# backing file.
2318#
6aae5be6
AG
2319# @device: The job identifier. This used to be a device name (hence
2320# the name of the parameter), but since QEMU 2.7 it can have
2321# other values.
1ad166b6 2322#
b76e4458
LL
2323# @force: If true, and the job has already emitted the event BLOCK_JOB_READY,
2324# abandon the job immediately (even if it is paused) instead of waiting
2325# for the destination to complete its final synchronization (since 1.3)
1ad166b6
BC
2326#
2327# Returns: Nothing on success
2328# If no background operation is active on this device, DeviceNotActive
2329#
2330# Since: 1.1
2331##
2332{ 'command': 'block-job-cancel', 'data': { 'device': 'str', '*force': 'bool' } }
2333
2334##
2335# @block-job-pause:
2336#
2337# Pause an active background block operation.
2338#
2339# This command returns immediately after marking the active background block
2340# operation for pausing. It is an error to call this command if no
2341# operation is in progress. Pausing an already paused job has no cumulative
2342# effect; a single block-job-resume command will resume the job.
2343#
2344# The operation will pause as soon as possible. No event is emitted when
2345# the operation is actually paused. Cancelling a paused job automatically
2346# resumes it.
2347#
6aae5be6
AG
2348# @device: The job identifier. This used to be a device name (hence
2349# the name of the parameter), but since QEMU 2.7 it can have
2350# other values.
1ad166b6
BC
2351#
2352# Returns: Nothing on success
2353# If no background operation is active on this device, DeviceNotActive
2354#
2355# Since: 1.3
2356##
2357{ 'command': 'block-job-pause', 'data': { 'device': 'str' } }
2358
2359##
2360# @block-job-resume:
2361#
2362# Resume an active background block operation.
2363#
2364# This command returns immediately after resuming a paused background block
2365# operation. It is an error to call this command if no operation is in
2366# progress. Resuming an already running job is not an error.
2367#
2368# This command also clears the error status of the job.
2369#
6aae5be6
AG
2370# @device: The job identifier. This used to be a device name (hence
2371# the name of the parameter), but since QEMU 2.7 it can have
2372# other values.
1ad166b6
BC
2373#
2374# Returns: Nothing on success
2375# If no background operation is active on this device, DeviceNotActive
2376#
2377# Since: 1.3
2378##
2379{ 'command': 'block-job-resume', 'data': { 'device': 'str' } }
2380
2381##
2382# @block-job-complete:
2383#
2384# Manually trigger completion of an active background block operation. This
2385# is supported for drive mirroring, where it also switches the device to
2386# write to the target path only. The ability to complete is signaled with
2387# a BLOCK_JOB_READY event.
2388#
2389# This command completes an active background block operation synchronously.
2390# The ordering of this command's return with the BLOCK_JOB_COMPLETED event
2391# is not defined. Note that if an I/O error occurs during the processing of
2392# this command: 1) the command itself will fail; 2) the error will be processed
2393# according to the rerror/werror arguments that were specified when starting
2394# the operation.
2395#
2396# A cancelled or paused job cannot be completed.
2397#
6aae5be6
AG
2398# @device: The job identifier. This used to be a device name (hence
2399# the name of the parameter), but since QEMU 2.7 it can have
2400# other values.
1ad166b6
BC
2401#
2402# Returns: Nothing on success
2403# If no background operation is active on this device, DeviceNotActive
2404#
2405# Since: 1.3
2406##
2407{ 'command': 'block-job-complete', 'data': { 'device': 'str' } }
2408
75f71059
JS
2409##
2410# @block-job-dismiss:
2411#
2412# For jobs that have already concluded, remove them from the block-job-query
2413# list. This command only needs to be run for jobs which were started with
2414# QEMU 2.12+ job lifetime management semantics.
2415#
2416# This command will refuse to operate on any job that has not yet reached
2417# its terminal state, BLOCK_JOB_STATUS_CONCLUDED. For jobs that make use of
2418# BLOCK_JOB_READY event, block-job-cancel or block-job-complete will still need
2419# to be used as appropriate.
2420#
2421# @id: The job identifier.
2422#
2423# Returns: Nothing on success
2424#
2425# Since: 2.12
2426##
2427{ 'command': 'block-job-dismiss', 'data': { 'id': 'str' } }
2428
11b61fbc
JS
2429##
2430# @block-job-finalize:
2431#
2432# Once a job that has manual=true reaches the pending state, it can be
2433# instructed to finalize any graph changes and do any necessary cleanup
2434# via this command.
2435# For jobs in a transaction, instructing one job to finalize will force
2436# ALL jobs in the transaction to finalize, so it is only necessary to instruct
2437# a single member job to finalize.
2438#
2439# @id: The job identifier.
2440#
2441# Returns: Nothing on success
2442#
2443# Since: 2.12
2444##
2445{ 'command': 'block-job-finalize', 'data': { 'id': 'str' } }
2446
1ad166b6 2447##
5072f7b3 2448# @BlockdevDiscardOptions:
1ad166b6
BC
2449#
2450# Determines how to handle discard requests.
2451#
2452# @ignore: Ignore the request
2453# @unmap: Forward as an unmap request
2454#
79b7a77e 2455# Since: 2.9
1ad166b6
BC
2456##
2457{ 'enum': 'BlockdevDiscardOptions',
2458 'data': [ 'ignore', 'unmap' ] }
2459
2460##
5072f7b3 2461# @BlockdevDetectZeroesOptions:
1ad166b6
BC
2462#
2463# Describes the operation mode for the automatic conversion of plain
2464# zero writes by the OS to driver specific optimized zero write commands.
2465#
2466# @off: Disabled (default)
2467# @on: Enabled
2468# @unmap: Enabled and even try to unmap blocks if possible. This requires
2469# also that @BlockdevDiscardOptions is set to unmap for this device.
2470#
2471# Since: 2.1
2472##
2473{ 'enum': 'BlockdevDetectZeroesOptions',
2474 'data': [ 'off', 'on', 'unmap' ] }
2475
2476##
5072f7b3 2477# @BlockdevAioOptions:
1ad166b6
BC
2478#
2479# Selects the AIO backend to handle I/O requests
2480#
2481# @threads: Use qemu's thread pool
2482# @native: Use native AIO backend (only Linux and Windows)
2483#
79b7a77e 2484# Since: 2.9
1ad166b6
BC
2485##
2486{ 'enum': 'BlockdevAioOptions',
2487 'data': [ 'threads', 'native' ] }
2488
2489##
5072f7b3 2490# @BlockdevCacheOptions:
1ad166b6
BC
2491#
2492# Includes cache-related options for block devices
2493#
1d8bda12 2494# @direct: enables use of O_DIRECT (bypass the host page cache;
1ad166b6 2495# default: false)
1d8bda12 2496# @no-flush: ignore any flush requests for the device (default:
1ad166b6
BC
2497# false)
2498#
79b7a77e 2499# Since: 2.9
1ad166b6 2500##
895a2a80 2501{ 'struct': 'BlockdevCacheOptions',
aaa436f9 2502 'data': { '*direct': 'bool',
1ad166b6
BC
2503 '*no-flush': 'bool' } }
2504
2505##
5072f7b3 2506# @BlockdevDriver:
1ad166b6
BC
2507#
2508# Drivers that are supported in block device operations.
2509#
da92c3ff 2510# @vxhs: Since 2.10
d8e7d87e 2511# @throttle: Since 2.11
d87ee3d7 2512# @nvme: Since 2.12
da92c3ff 2513#
79b7a77e 2514# Since: 2.9
1ad166b6
BC
2515##
2516{ 'enum': 'BlockdevDriver',
e32ccbc6 2517 'data': [ 'blkdebug', 'blkverify', 'bochs', 'cloop',
7edac2dd 2518 'dmg', 'file', 'ftp', 'ftps', 'gluster', 'host_cdrom',
31eb1202 2519 'host_device', 'http', 'https', 'iscsi', 'luks', 'nbd', 'nfs',
d87ee3d7 2520 'null-aio', 'null-co', 'nvme', 'parallels', 'qcow', 'qcow2', 'qed',
d282f34e 2521 'quorum', 'raw', 'rbd', 'replication', 'sheepdog', 'ssh',
d8e7d87e 2522 'throttle', 'vdi', 'vhdx', 'vmdk', 'vpc', 'vvfat', 'vxhs' ] }
1ad166b6 2523
1ad166b6 2524##
5072f7b3 2525# @BlockdevOptionsFile:
1ad166b6 2526#
68555285 2527# Driver specific block device options for the file backend.
1ad166b6
BC
2528#
2529# @filename: path to the image file
7c9e5276
PB
2530# @pr-manager: the id for the object that will handle persistent reservations
2531# for this device (default: none, forward the commands via SG_IO;
2532# since 2.11)
1d8bda12 2533# @aio: AIO backend (default: threads) (since: 2.8)
16b48d5d
FZ
2534# @locking: whether to enable file locking. If set to 'auto', only enable
2535# when Open File Descriptor (OFD) locking API is available
2536# (default: auto, since 2.10)
31be8a2a
SH
2537# @x-check-cache-dropped: whether to check that page cache was dropped on live
2538# migration. May cause noticeable delays if the image
2539# file is large, do not use in production.
2540# (default: off) (since: 2.13)
1ad166b6 2541#
79b7a77e 2542# Since: 2.9
1ad166b6 2543##
895a2a80 2544{ 'struct': 'BlockdevOptionsFile',
0a4279d9 2545 'data': { 'filename': 'str',
7c9e5276 2546 '*pr-manager': 'str',
16b48d5d 2547 '*locking': 'OnOffAuto',
31be8a2a
SH
2548 '*aio': 'BlockdevAioOptions',
2549 '*x-check-cache-dropped': 'bool' } }
1ad166b6 2550
e819ab22 2551##
5072f7b3 2552# @BlockdevOptionsNull:
e819ab22
FZ
2553#
2554# Driver specific block device options for the null backend.
2555#
1d8bda12
MA
2556# @size: size of the device in bytes.
2557# @latency-ns: emulated latency (in nanoseconds) in processing
e5e51dd3
FZ
2558# requests. Default to zero which completes requests immediately.
2559# (Since 2.4)
e819ab22 2560#
79b7a77e 2561# Since: 2.9
e819ab22 2562##
895a2a80 2563{ 'struct': 'BlockdevOptionsNull',
e5e51dd3 2564 'data': { '*size': 'int', '*latency-ns': 'uint64' } }
e819ab22 2565
d87ee3d7
FZ
2566##
2567# @BlockdevOptionsNVMe:
2568#
2569# Driver specific block device options for the NVMe backend.
2570#
2571# @device: controller address of the NVMe device.
2572# @namespace: namespace number of the device, starting from 1.
2573#
2574# Since: 2.12
2575##
2576{ 'struct': 'BlockdevOptionsNVMe',
2577 'data': { 'device': 'str', 'namespace': 'int' } }
2578
1ad166b6 2579##
5072f7b3 2580# @BlockdevOptionsVVFAT:
1ad166b6
BC
2581#
2582# Driver specific block device options for the vvfat protocol.
2583#
2584# @dir: directory to be exported as FAT image
1d8bda12
MA
2585# @fat-type: FAT type: 12, 16 or 32
2586# @floppy: whether to export a floppy image (true) or
1ad166b6 2587# partitioned hard disk (false; default)
1d8bda12 2588# @label: set the volume label, limited to 11 bytes. FAT16 and
d5941dda
WB
2589# FAT32 traditionally have some restrictions on labels, which are
2590# ignored by most operating systems. Defaults to "QEMU VVFAT".
2591# (since 2.4)
1d8bda12 2592# @rw: whether to allow write operations (default: false)
1ad166b6 2593#
79b7a77e 2594# Since: 2.9
1ad166b6 2595##
895a2a80 2596{ 'struct': 'BlockdevOptionsVVFAT',
1ad166b6 2597 'data': { 'dir': 'str', '*fat-type': 'int', '*floppy': 'bool',
d5941dda 2598 '*label': 'str', '*rw': 'bool' } }
1ad166b6
BC
2599
2600##
5072f7b3 2601# @BlockdevOptionsGenericFormat:
1ad166b6
BC
2602#
2603# Driver specific block device options for image format that have no option
2604# besides their data source.
2605#
2606# @file: reference to or definition of the data source block device
2607#
79b7a77e 2608# Since: 2.9
1ad166b6 2609##
895a2a80 2610{ 'struct': 'BlockdevOptionsGenericFormat',
1ad166b6
BC
2611 'data': { 'file': 'BlockdevRef' } }
2612
78368575 2613##
5072f7b3 2614# @BlockdevOptionsLUKS:
78368575
DB
2615#
2616# Driver specific block device options for LUKS.
2617#
1d8bda12 2618# @key-secret: the ID of a QCryptoSecret object providing
78368575
DB
2619# the decryption key (since 2.6). Mandatory except when
2620# doing a metadata-only probe of the image.
2621#
79b7a77e 2622# Since: 2.9
78368575
DB
2623##
2624{ 'struct': 'BlockdevOptionsLUKS',
2625 'base': 'BlockdevOptionsGenericFormat',
2626 'data': { '*key-secret': 'str' } }
2627
2628
1ad166b6 2629##
5072f7b3 2630# @BlockdevOptionsGenericCOWFormat:
1ad166b6
BC
2631#
2632# Driver specific block device options for image format that have no option
2633# besides their data source and an optional backing file.
2634#
1d8bda12 2635# @backing: reference to or definition of the backing file block
c42e8742
MA
2636# device, null disables the backing file entirely.
2637# Defaults to the backing file stored the image file.
1ad166b6 2638#
79b7a77e 2639# Since: 2.9
1ad166b6 2640##
895a2a80 2641{ 'struct': 'BlockdevOptionsGenericCOWFormat',
1ad166b6 2642 'base': 'BlockdevOptionsGenericFormat',
c42e8742 2643 'data': { '*backing': 'BlockdevRefOrNull' } }
1ad166b6 2644
f6585811 2645##
5072f7b3 2646# @Qcow2OverlapCheckMode:
f6585811
HR
2647#
2648# General overlap check modes.
2649#
2650# @none: Do not perform any checks
2651#
2652# @constant: Perform only checks which can be done in constant time and
2653# without reading anything from disk
2654#
2655# @cached: Perform only checks which can be done without reading anything
2656# from disk
2657#
2658# @all: Perform all available overlap checks
2659#
79b7a77e 2660# Since: 2.9
f6585811
HR
2661##
2662{ 'enum': 'Qcow2OverlapCheckMode',
2663 'data': [ 'none', 'constant', 'cached', 'all' ] }
2664
2665##
5072f7b3 2666# @Qcow2OverlapCheckFlags:
f6585811
HR
2667#
2668# Structure of flags for each metadata structure. Setting a field to 'true'
2669# makes qemu guard that structure against unintended overwriting. The default
2670# value is chosen according to the template given.
2671#
2672# @template: Specifies a template mode which can be adjusted using the other
2673# flags, defaults to 'cached'
2674#
79b7a77e 2675# Since: 2.9
f6585811 2676##
895a2a80 2677{ 'struct': 'Qcow2OverlapCheckFlags',
f6585811
HR
2678 'data': { '*template': 'Qcow2OverlapCheckMode',
2679 '*main-header': 'bool',
2680 '*active-l1': 'bool',
2681 '*active-l2': 'bool',
2682 '*refcount-table': 'bool',
2683 '*refcount-block': 'bool',
2684 '*snapshot-table': 'bool',
2685 '*inactive-l1': 'bool',
2686 '*inactive-l2': 'bool' } }
2687
2688##
5072f7b3 2689# @Qcow2OverlapChecks:
f6585811
HR
2690#
2691# Specifies which metadata structures should be guarded against unintended
2692# overwriting.
2693#
2694# @flags: set of flags for separate specification of each metadata structure
2695# type
2696#
2697# @mode: named mode which chooses a specific set of flags
2698#
79b7a77e 2699# Since: 2.9
f6585811 2700##
ab916fad 2701{ 'alternate': 'Qcow2OverlapChecks',
f6585811
HR
2702 'data': { 'flags': 'Qcow2OverlapCheckFlags',
2703 'mode': 'Qcow2OverlapCheckMode' } }
2704
d85f4222
DB
2705##
2706# @BlockdevQcowEncryptionFormat:
2707#
2708# @aes: AES-CBC with plain64 initialization vectors
2709#
2710# Since: 2.10
2711##
2712{ 'enum': 'BlockdevQcowEncryptionFormat',
2713 'data': [ 'aes' ] }
2714
2715##
2716# @BlockdevQcowEncryption:
2717#
2718# Since: 2.10
2719##
2720{ 'union': 'BlockdevQcowEncryption',
2721 'base': { 'format': 'BlockdevQcowEncryptionFormat' },
2722 'discriminator': 'format',
2723 'data': { 'aes': 'QCryptoBlockOptionsQCow' } }
2724
2725##
2726# @BlockdevOptionsQcow:
2727#
2728# Driver specific block device options for qcow.
2729#
2730# @encrypt: Image decryption options. Mandatory for
2731# encrypted images, except when doing a metadata-only
2732# probe of the image.
2733#
2734# Since: 2.10
2735##
2736{ 'struct': 'BlockdevOptionsQcow',
2737 'base': 'BlockdevOptionsGenericCOWFormat',
2738 'data': { '*encrypt': 'BlockdevQcowEncryption' } }
2739
2740
b25b387f
DB
2741
2742##
2743# @BlockdevQcow2EncryptionFormat:
2744# @aes: AES-CBC with plain64 initialization venctors
2745#
2746# Since: 2.10
2747##
2748{ 'enum': 'BlockdevQcow2EncryptionFormat',
4652b8f3 2749 'data': [ 'aes', 'luks' ] }
b25b387f
DB
2750
2751##
2752# @BlockdevQcow2Encryption:
2753#
2754# Since: 2.10
2755##
2756{ 'union': 'BlockdevQcow2Encryption',
2757 'base': { 'format': 'BlockdevQcow2EncryptionFormat' },
2758 'discriminator': 'format',
4652b8f3
DB
2759 'data': { 'aes': 'QCryptoBlockOptionsQCow',
2760 'luks': 'QCryptoBlockOptionsLUKS'} }
b25b387f 2761
1ad166b6 2762##
5072f7b3 2763# @BlockdevOptionsQcow2:
1ad166b6
BC
2764#
2765# Driver specific block device options for qcow2.
2766#
1d8bda12 2767# @lazy-refcounts: whether to enable the lazy refcounts
1ad166b6
BC
2768# feature (default is taken from the image file)
2769#
1d8bda12 2770# @pass-discard-request: whether discard requests to the qcow2
1ad166b6
BC
2771# device should be forwarded to the data source
2772#
1d8bda12 2773# @pass-discard-snapshot: whether discard requests for the data source
1ad166b6
BC
2774# should be issued when a snapshot operation (e.g.
2775# deleting a snapshot) frees clusters in the qcow2 file
2776#
1d8bda12 2777# @pass-discard-other: whether discard requests for the data source
1ad166b6
BC
2778# should be issued on other occasions where a cluster
2779# gets freed
2780#
1d8bda12 2781# @overlap-check: which overlap checks to perform for writes
f6585811
HR
2782# to the image, defaults to 'cached' (since 2.2)
2783#
1d8bda12 2784# @cache-size: the maximum total size of the L2 table and
f6585811
HR
2785# refcount block caches in bytes (since 2.2)
2786#
1d8bda12 2787# @l2-cache-size: the maximum size of the L2 table cache in
f6585811
HR
2788# bytes (since 2.2)
2789#
1221fe6f
AG
2790# @l2-cache-entry-size: the size of each entry in the L2 cache in
2791# bytes. It must be a power of two between 512
2792# and the cluster size. The default value is
2793# the cluster size (since 2.12)
2794#
1d8bda12 2795# @refcount-cache-size: the maximum size of the refcount block cache
f6585811
HR
2796# in bytes (since 2.2)
2797#
1d8bda12 2798# @cache-clean-interval: clean unused entries in the L2 and refcount
279621c0
AG
2799# caches. The interval is in seconds. The default value
2800# is 0 and it disables this feature (since 2.5)
b25b387f
DB
2801# @encrypt: Image decryption options. Mandatory for
2802# encrypted images, except when doing a metadata-only
2803# probe of the image. (since 2.10)
279621c0 2804#
79b7a77e 2805# Since: 2.9
1ad166b6 2806##
895a2a80 2807{ 'struct': 'BlockdevOptionsQcow2',
1ad166b6
BC
2808 'base': 'BlockdevOptionsGenericCOWFormat',
2809 'data': { '*lazy-refcounts': 'bool',
2810 '*pass-discard-request': 'bool',
2811 '*pass-discard-snapshot': 'bool',
f6585811
HR
2812 '*pass-discard-other': 'bool',
2813 '*overlap-check': 'Qcow2OverlapChecks',
2814 '*cache-size': 'int',
2815 '*l2-cache-size': 'int',
1221fe6f 2816 '*l2-cache-entry-size': 'int',
279621c0 2817 '*refcount-cache-size': 'int',
b25b387f
DB
2818 '*cache-clean-interval': 'int',
2819 '*encrypt': 'BlockdevQcow2Encryption' } }
b1de5f43 2820
ec2f5418
KW
2821##
2822# @SshHostKeyCheckMode:
2823#
2824# @none Don't check the host key at all
2825# @hash Compare the host key with a given hash
2826# @known_hosts Check the host key against the known_hosts file
2827#
2828# Since: 2.12
2829##
2830{ 'enum': 'SshHostKeyCheckMode',
2831 'data': [ 'none', 'hash', 'known_hosts' ] }
2832
2833##
2834# @SshHostKeyCheckHashType:
2835#
2836# @md5 The given hash is an md5 hash
2837# @sha1 The given hash is an sha1 hash
2838#
2839# Since: 2.12
2840##
2841{ 'enum': 'SshHostKeyCheckHashType',
2842 'data': [ 'md5', 'sha1' ] }
2843
2844##
2845# @SshHostKeyHash:
2846#
2847# @type The hash algorithm used for the hash
2848# @hash The expected hash value
2849#
2850# Since: 2.12
2851##
2852{ 'struct': 'SshHostKeyHash',
2853 'data': { 'type': 'SshHostKeyCheckHashType',
2854 'hash': 'str' }}
2855
2856##
2857# @SshHostKeyDummy:
2858#
2859# For those union branches that don't need additional fields.
2860#
2861# Since: 2.12
2862##
2863{ 'struct': 'SshHostKeyDummy',
2864 'data': {} }
2865
2866##
2867# @SshHostKeyCheck:
2868#
2869# Since: 2.12
2870##
2871{ 'union': 'SshHostKeyCheck',
2872 'base': { 'mode': 'SshHostKeyCheckMode' },
2873 'discriminator': 'mode',
2874 'data': { 'none': 'SshHostKeyDummy',
2875 'hash': 'SshHostKeyHash',
2876 'known_hosts': 'SshHostKeyDummy' } }
2877
ad0e90a6 2878##
5072f7b3 2879# @BlockdevOptionsSsh:
ad0e90a6
AA
2880#
2881# @server: host address
2882#
2883# @path: path to the image on the host
2884#
1d8bda12 2885# @user: user as which to connect, defaults to current
ad0e90a6
AA
2886# local user name
2887#
ec2f5418
KW
2888# @host-key-check: Defines how and what to check the host key against
2889# (default: known_hosts)
ad0e90a6 2890#
79b7a77e 2891# Since: 2.9
ad0e90a6
AA
2892##
2893{ 'struct': 'BlockdevOptionsSsh',
2894 'data': { 'server': 'InetSocketAddress',
2895 'path': 'str',
ec2f5418
KW
2896 '*user': 'str',
2897 '*host-key-check': 'SshHostKeyCheck' } }
ad0e90a6 2898
b1de5f43 2899
1ad166b6 2900##
5072f7b3 2901# @BlkdebugEvent:
1ad166b6
BC
2902#
2903# Trigger events supported by blkdebug.
a31939e6 2904#
46b732cd
PB
2905# @l1_shrink_write_table: write zeros to the l1 table to shrink image.
2906# (since 2.11)
2907#
2908# @l1_shrink_free_l2_clusters: discard the l2 tables. (since 2.11)
2909#
d855ebcd
EB
2910# @cor_write: a write due to copy-on-read (since 2.11)
2911#
79b7a77e 2912# Since: 2.9
1ad166b6 2913##
a31939e6 2914{ 'enum': 'BlkdebugEvent', 'prefix': 'BLKDBG',
5be5b776
EB
2915 'data': [ 'l1_update', 'l1_grow_alloc_table', 'l1_grow_write_table',
2916 'l1_grow_activate_table', 'l2_load', 'l2_update',
2917 'l2_update_compressed', 'l2_alloc_cow_read', 'l2_alloc_write',
1ad166b6
BC
2918 'read_aio', 'read_backing_aio', 'read_compressed', 'write_aio',
2919 'write_compressed', 'vmstate_load', 'vmstate_save', 'cow_read',
2920 'cow_write', 'reftable_load', 'reftable_grow', 'reftable_update',
2921 'refblock_load', 'refblock_update', 'refblock_update_part',
5be5b776
EB
2922 'refblock_alloc', 'refblock_alloc_hookup', 'refblock_alloc_write',
2923 'refblock_alloc_write_blocks', 'refblock_alloc_write_table',
2924 'refblock_alloc_switch_table', 'cluster_alloc',
1ad166b6 2925 'cluster_alloc_bytes', 'cluster_free', 'flush_to_os',
5be5b776
EB
2926 'flush_to_disk', 'pwritev_rmw_head', 'pwritev_rmw_after_head',
2927 'pwritev_rmw_tail', 'pwritev_rmw_after_tail', 'pwritev',
46b732cd 2928 'pwritev_zero', 'pwritev_done', 'empty_image_prepare',
d855ebcd
EB
2929 'l1_shrink_write_table', 'l1_shrink_free_l2_clusters',
2930 'cor_write'] }
1ad166b6
BC
2931
2932##
5072f7b3 2933# @BlkdebugInjectErrorOptions:
1ad166b6
BC
2934#
2935# Describes a single error injection for blkdebug.
2936#
2937# @event: trigger event
2938#
1d8bda12 2939# @state: the state identifier blkdebug needs to be in to
1ad166b6
BC
2940# actually trigger the event; defaults to "any"
2941#
1d8bda12 2942# @errno: error identifier (errno) to be returned; defaults to
1ad166b6
BC
2943# EIO
2944#
1d8bda12 2945# @sector: specifies the sector index which has to be affected
1ad166b6
BC
2946# in order to actually trigger the event; defaults to "any
2947# sector"
2948#
1d8bda12 2949# @once: disables further events after this one has been
1ad166b6
BC
2950# triggered; defaults to false
2951#
1d8bda12 2952# @immediately: fail immediately; defaults to false
1ad166b6 2953#
79b7a77e 2954# Since: 2.9
1ad166b6 2955##
895a2a80 2956{ 'struct': 'BlkdebugInjectErrorOptions',
1ad166b6
BC
2957 'data': { 'event': 'BlkdebugEvent',
2958 '*state': 'int',
2959 '*errno': 'int',
2960 '*sector': 'int',
2961 '*once': 'bool',
2962 '*immediately': 'bool' } }
2963
2964##
5072f7b3 2965# @BlkdebugSetStateOptions:
1ad166b6
BC
2966#
2967# Describes a single state-change event for blkdebug.
2968#
2969# @event: trigger event
2970#
1d8bda12 2971# @state: the current state identifier blkdebug needs to be in;
1ad166b6
BC
2972# defaults to "any"
2973#
2974# @new_state: the state identifier blkdebug is supposed to assume if
2975# this event is triggered
2976#
79b7a77e 2977# Since: 2.9
1ad166b6 2978##
895a2a80 2979{ 'struct': 'BlkdebugSetStateOptions',
1ad166b6
BC
2980 'data': { 'event': 'BlkdebugEvent',
2981 '*state': 'int',
2982 'new_state': 'int' } }
2983
2984##
5072f7b3 2985# @BlockdevOptionsBlkdebug:
1ad166b6
BC
2986#
2987# Driver specific block device options for blkdebug.
2988#
2989# @image: underlying raw block device (or image file)
2990#
1d8bda12 2991# @config: filename of the configuration file
1ad166b6 2992#
430b26a8
EB
2993# @align: required alignment for requests in bytes, must be
2994# positive power of 2, or 0 for default
2995#
2996# @max-transfer: maximum size for I/O transfers in bytes, must be
2997# positive multiple of @align and of the underlying
2998# file's request alignment (but need not be a power of
2999# 2), or 0 for default (since 2.10)
3000#
3001# @opt-write-zero: preferred alignment for write zero requests in bytes,
3002# must be positive multiple of @align and of the
3003# underlying file's request alignment (but need not be a
3004# power of 2), or 0 for default (since 2.10)
3005#
3006# @max-write-zero: maximum size for write zero requests in bytes, must be
3007# positive multiple of @align, of @opt-write-zero, and of
3008# the underlying file's request alignment (but need not
3009# be a power of 2), or 0 for default (since 2.10)
3010#
3011# @opt-discard: preferred alignment for discard requests in bytes, must
3012# be positive multiple of @align and of the underlying
3013# file's request alignment (but need not be a power of
3014# 2), or 0 for default (since 2.10)
3015#
3016# @max-discard: maximum size for discard requests in bytes, must be
3017# positive multiple of @align, of @opt-discard, and of
3018# the underlying file's request alignment (but need not
3019# be a power of 2), or 0 for default (since 2.10)
1ad166b6 3020#
1d8bda12 3021# @inject-error: array of error injection descriptions
1ad166b6 3022#
1d8bda12 3023# @set-state: array of state-change descriptions
1ad166b6 3024#
79b7a77e 3025# Since: 2.9
1ad166b6 3026##
895a2a80 3027{ 'struct': 'BlockdevOptionsBlkdebug',
1ad166b6
BC
3028 'data': { 'image': 'BlockdevRef',
3029 '*config': 'str',
430b26a8
EB
3030 '*align': 'int', '*max-transfer': 'int32',
3031 '*opt-write-zero': 'int32', '*max-write-zero': 'int32',
3032 '*opt-discard': 'int32', '*max-discard': 'int32',
1ad166b6
BC
3033 '*inject-error': ['BlkdebugInjectErrorOptions'],
3034 '*set-state': ['BlkdebugSetStateOptions'] } }
3035
3036##
5072f7b3 3037# @BlockdevOptionsBlkverify:
1ad166b6
BC
3038#
3039# Driver specific block device options for blkverify.
3040#
3041# @test: block device to be tested
3042#
3043# @raw: raw image used for verification
3044#
79b7a77e 3045# Since: 2.9
1ad166b6 3046##
895a2a80 3047{ 'struct': 'BlockdevOptionsBlkverify',
1ad166b6
BC
3048 'data': { 'test': 'BlockdevRef',
3049 'raw': 'BlockdevRef' } }
3050
62c6031f 3051##
5072f7b3 3052# @QuorumReadPattern:
62c6031f
LY
3053#
3054# An enumeration of quorum read patterns.
3055#
3056# @quorum: read all the children and do a quorum vote on reads
3057#
3058# @fifo: read only from the first child that has not failed
3059#
79b7a77e 3060# Since: 2.9
62c6031f
LY
3061##
3062{ 'enum': 'QuorumReadPattern', 'data': [ 'quorum', 'fifo' ] }
3063
1ad166b6 3064##
5072f7b3 3065# @BlockdevOptionsQuorum:
1ad166b6
BC
3066#
3067# Driver specific block device options for Quorum
3068#
1d8bda12 3069# @blkverify: true if the driver must print content mismatch
1ad166b6
BC
3070# set to false by default
3071#
3072# @children: the children block devices to use
3073#
3074# @vote-threshold: the vote limit under which a read will fail
3075#
1d8bda12 3076# @rewrite-corrupted: rewrite corrupted data when quorum is reached
cf29a570
BC
3077# (Since 2.1)
3078#
1d8bda12 3079# @read-pattern: choose read pattern and set to quorum by default
62c6031f
LY
3080# (Since 2.2)
3081#
79b7a77e 3082# Since: 2.9
1ad166b6 3083##
895a2a80 3084{ 'struct': 'BlockdevOptionsQuorum',
1ad166b6
BC
3085 'data': { '*blkverify': 'bool',
3086 'children': [ 'BlockdevRef' ],
62c6031f
LY
3087 'vote-threshold': 'int',
3088 '*rewrite-corrupted': 'bool',
3089 '*read-pattern': 'QuorumReadPattern' } }
1ad166b6 3090
7edac2dd 3091##
5072f7b3 3092# @BlockdevOptionsGluster:
7edac2dd
PKK
3093#
3094# Driver specific block device options for Gluster
3095#
3096# @volume: name of gluster volume where VM image resides
3097#
3098# @path: absolute path to image file in gluster volume
3099#
0a189ffb 3100# @server: gluster servers description
7edac2dd 3101#
1d8bda12 3102# @debug: libgfapi log level (default '4' which is Error)
4230e5d1 3103# (Since 2.8)
7edac2dd 3104#
1d8bda12 3105# @logfile: libgfapi log file (default /dev/stderr) (Since 2.8)
e9db8ff3 3106#
79b7a77e 3107# Since: 2.9
7edac2dd
PKK
3108##
3109{ 'struct': 'BlockdevOptionsGluster',
3110 'data': { 'volume': 'str',
3111 'path': 'str',
62cf396b 3112 'server': ['SocketAddress'],
1a417e46 3113 '*debug': 'int',
e9db8ff3 3114 '*logfile': 'str' } }
7edac2dd 3115
31eb1202
KW
3116##
3117# @IscsiTransport:
3118#
3119# An enumeration of libiscsi transport types
3120#
3121# Since: 2.9
3122##
3123{ 'enum': 'IscsiTransport',
3124 'data': [ 'tcp', 'iser' ] }
3125
3126##
3127# @IscsiHeaderDigest:
3128#
3129# An enumeration of header digests supported by libiscsi
3130#
3131# Since: 2.9
3132##
3133{ 'enum': 'IscsiHeaderDigest',
3134 'prefix': 'QAPI_ISCSI_HEADER_DIGEST',
3135 'data': [ 'crc32c', 'none', 'crc32c-none', 'none-crc32c' ] }
3136
3137##
3138# @BlockdevOptionsIscsi:
3139#
51654aa5 3140# @transport: The iscsi transport type
31eb1202 3141#
51654aa5 3142# @portal: The address of the iscsi portal
31eb1202 3143#
51654aa5 3144# @target: The target iqn name
31eb1202 3145#
1d8bda12 3146# @lun: LUN to connect to. Defaults to 0.
31eb1202 3147#
1d8bda12 3148# @user: User name to log in with. If omitted, no CHAP
31eb1202
KW
3149# authentication is performed.
3150#
1d8bda12 3151# @password-secret: The ID of a QCryptoSecret object providing
31eb1202
KW
3152# the password for the login. This option is required if
3153# @user is specified.
3154#
1d8bda12 3155# @initiator-name: The iqn name we want to identify to the target
31eb1202
KW
3156# as. If this option is not specified, an initiator name is
3157# generated automatically.
3158#
1d8bda12 3159# @header-digest: The desired header digest. Defaults to
31eb1202
KW
3160# none-crc32c.
3161#
1d8bda12 3162# @timeout: Timeout in seconds after which a request will
31eb1202
KW
3163# timeout. 0 means no timeout and is the default.
3164#
3165# Driver specific block device options for iscsi
3166#
3167# Since: 2.9
3168##
3169{ 'struct': 'BlockdevOptionsIscsi',
3170 'data': { 'transport': 'IscsiTransport',
3171 'portal': 'str',
3172 'target': 'str',
3173 '*lun': 'int',
3174 '*user': 'str',
3175 '*password-secret': 'str',
3176 '*initiator-name': 'str',
3177 '*header-digest': 'IscsiHeaderDigest',
3178 '*timeout': 'int' } }
3179
0a55679b 3180
8a47e8eb
JC
3181##
3182# @BlockdevOptionsRbd:
3183#
3184# @pool: Ceph pool name.
3185#
3186# @image: Image name in the Ceph pool.
3187#
1d8bda12 3188# @conf: path to Ceph configuration file. Values
8a47e8eb
JC
3189# in the configuration file will be overridden by
3190# options specified via QAPI.
3191#
1d8bda12 3192# @snapshot: Ceph snapshot name.
8a47e8eb 3193#
1d8bda12 3194# @user: Ceph id name.
8a47e8eb 3195#
1d8bda12 3196# @server: Monitor host address and port. This maps
0a55679b
JC
3197# to the "mon_host" Ceph option.
3198#
8a47e8eb
JC
3199# Since: 2.9
3200##
3201{ 'struct': 'BlockdevOptionsRbd',
3202 'data': { 'pool': 'str',
3203 'image': 'str',
3204 '*conf': 'str',
3205 '*snapshot': 'str',
3206 '*user': 'str',
577d8c9a 3207 '*server': ['InetSocketAddressBase'] } }
8a47e8eb 3208
d282f34e
MA
3209##
3210# @BlockdevOptionsSheepdog:
3211#
3212# Driver specific block device options for sheepdog
3213#
3214# @vdi: Virtual disk image name
d1c13688 3215# @server: The Sheepdog server to connect to
d282f34e
MA
3216# @snap-id: Snapshot ID
3217# @tag: Snapshot tag name
3218#
3219# Only one of @snap-id and @tag may be present.
3220#
3221# Since: 2.9
3222##
3223{ 'struct': 'BlockdevOptionsSheepdog',
62cf396b 3224 'data': { 'server': 'SocketAddress',
d282f34e
MA
3225 'vdi': 'str',
3226 '*snap-id': 'uint32',
3227 '*tag': 'str' } }
3228
190b9a8b 3229##
5072f7b3 3230# @ReplicationMode:
190b9a8b
CX
3231#
3232# An enumeration of replication modes.
3233#
3234# @primary: Primary mode, the vm's state will be sent to secondary QEMU.
3235#
3236# @secondary: Secondary mode, receive the vm's state from primary QEMU.
3237#
79b7a77e 3238# Since: 2.9
190b9a8b
CX
3239##
3240{ 'enum' : 'ReplicationMode', 'data' : [ 'primary', 'secondary' ] }
3241
82ac5543 3242##
5072f7b3 3243# @BlockdevOptionsReplication:
82ac5543
WC
3244#
3245# Driver specific block device options for replication
3246#
3247# @mode: the replication mode
3248#
1d8bda12 3249# @top-id: In secondary mode, node name or device ID of the root
f4f2539b
CX
3250# node who owns the replication node chain. Must not be given in
3251# primary mode.
82ac5543 3252#
79b7a77e 3253# Since: 2.9
82ac5543
WC
3254##
3255{ 'struct': 'BlockdevOptionsReplication',
3256 'base': 'BlockdevOptionsGenericFormat',
3257 'data': { 'mode': 'ReplicationMode',
3258 '*top-id': 'str' } }
3259
aa2623d8 3260##
5072f7b3 3261# @NFSTransport:
aa2623d8
AA
3262#
3263# An enumeration of NFS transport types
3264#
3265# @inet: TCP transport
3266#
79b7a77e 3267# Since: 2.9
aa2623d8
AA
3268##
3269{ 'enum': 'NFSTransport',
3270 'data': [ 'inet' ] }
3271
3272##
5072f7b3 3273# @NFSServer:
aa2623d8
AA
3274#
3275# Captures the address of the socket
3276#
3277# @type: transport type used for NFS (only TCP supported)
3278#
3279# @host: host address for NFS server
3280#
79b7a77e 3281# Since: 2.9
aa2623d8
AA
3282##
3283{ 'struct': 'NFSServer',
3284 'data': { 'type': 'NFSTransport',
3285 'host': 'str' } }
3286
3287##
5072f7b3 3288# @BlockdevOptionsNfs:
aa2623d8
AA
3289#
3290# Driver specific block device option for NFS
3291#
3292# @server: host address
3293#
3294# @path: path of the image on the host
3295#
1d8bda12 3296# @user: UID value to use when talking to the
aa2623d8
AA
3297# server (defaults to 65534 on Windows and getuid()
3298# on unix)
3299#
1d8bda12 3300# @group: GID value to use when talking to the
aa2623d8
AA
3301# server (defaults to 65534 on Windows and getgid()
3302# in unix)
3303#
1d8bda12 3304# @tcp-syn-count: number of SYNs during the session
aa2623d8
AA
3305# establishment (defaults to libnfs default)
3306#
1d8bda12 3307# @readahead-size: set the readahead size in bytes (defaults
aa2623d8
AA
3308# to libnfs default)
3309#
1d8bda12 3310# @page-cache-size: set the pagecache size in bytes (defaults
aa2623d8
AA
3311# to libnfs default)
3312#
1d8bda12 3313# @debug: set the NFS debug level (max 2) (defaults
aa2623d8
AA
3314# to libnfs default)
3315#
79b7a77e 3316# Since: 2.9
aa2623d8
AA
3317##
3318{ 'struct': 'BlockdevOptionsNfs',
3319 'data': { 'server': 'NFSServer',
3320 'path': 'str',
3321 '*user': 'int',
3322 '*group': 'int',
3323 '*tcp-syn-count': 'int',
3324 '*readahead-size': 'int',
3325 '*page-cache-size': 'int',
7103d916 3326 '*debug': 'int' } }
aa2623d8 3327
68555285 3328##
6b9d62db 3329# @BlockdevOptionsCurlBase:
68555285 3330#
6b9d62db
HR
3331# Driver specific block device options shared by all protocols supported by the
3332# curl backend.
68555285 3333#
6b9d62db
HR
3334# @url: URL of the image file
3335#
3336# @readahead: Size of the read-ahead cache; must be a multiple of
3337# 512 (defaults to 256 kB)
3338#
3339# @timeout: Timeout for connections, in seconds (defaults to 5)
3340#
3341# @username: Username for authentication (defaults to none)
3342#
3343# @password-secret: ID of a QCryptoSecret object providing a password
3344# for authentication (defaults to no password)
3345#
3346# @proxy-username: Username for proxy authentication (defaults to none)
3347#
3348# @proxy-password-secret: ID of a QCryptoSecret object providing a password
3349# for proxy authentication (defaults to no password)
3350#
3351# Since: 2.9
3352##
3353{ 'struct': 'BlockdevOptionsCurlBase',
3354 'data': { 'url': 'str',
3355 '*readahead': 'int',
3356 '*timeout': 'int',
3357 '*username': 'str',
3358 '*password-secret': 'str',
3359 '*proxy-username': 'str',
3360 '*proxy-password-secret': 'str' } }
3361
3362##
3363# @BlockdevOptionsCurlHttp:
3364#
3365# Driver specific block device options for HTTP connections over the curl
3366# backend. URLs must start with "http://".
3367#
3368# @cookie: List of cookies to set; format is
3369# "name1=content1; name2=content2;" as explained by
3370# CURLOPT_COOKIE(3). Defaults to no cookies.
3371#
327c8ebd
PK
3372# @cookie-secret: ID of a QCryptoSecret object providing the cookie data in a
3373# secure way. See @cookie for the format. (since 2.10)
3374#
6b9d62db
HR
3375# Since: 2.9
3376##
3377{ 'struct': 'BlockdevOptionsCurlHttp',
3378 'base': 'BlockdevOptionsCurlBase',
327c8ebd
PK
3379 'data': { '*cookie': 'str',
3380 '*cookie-secret': 'str'} }
6b9d62db
HR
3381
3382##
3383# @BlockdevOptionsCurlHttps:
3384#
3385# Driver specific block device options for HTTPS connections over the curl
3386# backend. URLs must start with "https://".
3387#
3388# @cookie: List of cookies to set; format is
3389# "name1=content1; name2=content2;" as explained by
3390# CURLOPT_COOKIE(3). Defaults to no cookies.
3391#
3392# @sslverify: Whether to verify the SSL certificate's validity (defaults to
3393# true)
3394#
327c8ebd
PK
3395# @cookie-secret: ID of a QCryptoSecret object providing the cookie data in a
3396# secure way. See @cookie for the format. (since 2.10)
3397#
6b9d62db
HR
3398# Since: 2.9
3399##
3400{ 'struct': 'BlockdevOptionsCurlHttps',
3401 'base': 'BlockdevOptionsCurlBase',
3402 'data': { '*cookie': 'str',
327c8ebd
PK
3403 '*sslverify': 'bool',
3404 '*cookie-secret': 'str'} }
6b9d62db
HR
3405
3406##
3407# @BlockdevOptionsCurlFtp:
3408#
3409# Driver specific block device options for FTP connections over the curl
3410# backend. URLs must start with "ftp://".
3411#
3412# Since: 2.9
3413##
3414{ 'struct': 'BlockdevOptionsCurlFtp',
3415 'base': 'BlockdevOptionsCurlBase',
3416 'data': { } }
3417
3418##
3419# @BlockdevOptionsCurlFtps:
3420#
3421# Driver specific block device options for FTPS connections over the curl
3422# backend. URLs must start with "ftps://".
3423#
3424# @sslverify: Whether to verify the SSL certificate's validity (defaults to
3425# true)
68555285 3426#
79b7a77e 3427# Since: 2.9
68555285 3428##
6b9d62db
HR
3429{ 'struct': 'BlockdevOptionsCurlFtps',
3430 'base': 'BlockdevOptionsCurlBase',
3431 'data': { '*sslverify': 'bool' } }
68555285 3432
6b02b1f0 3433##
5072f7b3 3434# @BlockdevOptionsNbd:
6b02b1f0
HR
3435#
3436# Driver specific block device options for NBD.
3437#
3438# @server: NBD server address
3439#
1d8bda12 3440# @export: export name
6b02b1f0 3441#
1d8bda12 3442# @tls-creds: TLS credentials ID
6b02b1f0 3443#
79b7a77e 3444# Since: 2.9
6b02b1f0
HR
3445##
3446{ 'struct': 'BlockdevOptionsNbd',
62cf396b 3447 'data': { 'server': 'SocketAddress',
6b02b1f0
HR
3448 '*export': 'str',
3449 '*tls-creds': 'str' } }
3450
2fdc7045 3451##
5072f7b3 3452# @BlockdevOptionsRaw:
2fdc7045
TG
3453#
3454# Driver specific block device options for the raw driver.
3455#
1d8bda12
MA
3456# @offset: position where the block device starts
3457# @size: the assumed size of the device
2fdc7045 3458#
79b7a77e 3459# Since: 2.9
2fdc7045
TG
3460##
3461{ 'struct': 'BlockdevOptionsRaw',
3462 'base': 'BlockdevOptionsGenericFormat',
3463 'data': { '*offset': 'int', '*size': 'int' } }
3464
da92c3ff
AM
3465##
3466# @BlockdevOptionsVxHS:
3467#
3468# Driver specific block device options for VxHS
3469#
3470# @vdisk-id: UUID of VxHS volume
3471# @server: vxhs server IP, port
3472# @tls-creds: TLS credentials ID
3473#
3474# Since: 2.10
3475##
3476{ 'struct': 'BlockdevOptionsVxHS',
3477 'data': { 'vdisk-id': 'str',
3478 'server': 'InetSocketAddressBase',
3479 '*tls-creds': 'str' } }
3480
1ad166b6 3481##
d8e7d87e
MP
3482# @BlockdevOptionsThrottle:
3483#
3484# Driver specific block device options for the throttle driver
3485#
3486# @throttle-group: the name of the throttle-group object to use. It
3487# must already exist.
3488# @file: reference to or definition of the data source block device
3489# Since: 2.11
3490##
3491{ 'struct': 'BlockdevOptionsThrottle',
3492 'data': { 'throttle-group': 'str',
3493 'file' : 'BlockdevRef'
3494 } }
3495##
5072f7b3 3496# @BlockdevOptions:
1ad166b6 3497#
3666a97f
EB
3498# Options for creating a block device. Many options are available for all
3499# block devices, independent of the block driver:
3500#
3501# @driver: block driver name
1d8bda12 3502# @node-name: the node name of the new node (Since 2.0).
9ec8873e 3503# This option is required on the top level of blockdev-add.
1d8bda12
MA
3504# @discard: discard-related options (default: ignore)
3505# @cache: cache-related options
398e6ad0
KW
3506# @read-only: whether the block device should be read-only (default: false).
3507# Note that some block drivers support only read-only access,
3508# either generally or in certain configurations. In this case,
3509# the default value does not work and the option must be
3510# specified explicitly.
1d8bda12 3511# @detect-zeroes: detect and optimize zero writes (Since 2.1)
3666a97f 3512# (default: off)
5a9347c6
FZ
3513# @force-share: force share all permission on added nodes.
3514# Requires read-only=true. (Since 2.10)
3666a97f
EB
3515#
3516# Remaining options are determined by the block driver.
1ad166b6 3517#
79b7a77e 3518# Since: 2.9
1ad166b6
BC
3519##
3520{ 'union': 'BlockdevOptions',
3666a97f 3521 'base': { 'driver': 'BlockdevDriver',
3666a97f
EB
3522 '*node-name': 'str',
3523 '*discard': 'BlockdevDiscardOptions',
3524 '*cache': 'BlockdevCacheOptions',
3666a97f 3525 '*read-only': 'bool',
5a9347c6 3526 '*force-share': 'bool',
3666a97f 3527 '*detect-zeroes': 'BlockdevDetectZeroesOptions' },
1ad166b6
BC
3528 'discriminator': 'driver',
3529 'data': {
db866be9
FZ
3530 'blkdebug': 'BlockdevOptionsBlkdebug',
3531 'blkverify': 'BlockdevOptionsBlkverify',
3532 'bochs': 'BlockdevOptionsGenericFormat',
3533 'cloop': 'BlockdevOptionsGenericFormat',
db866be9 3534 'dmg': 'BlockdevOptionsGenericFormat',
1ad166b6 3535 'file': 'BlockdevOptionsFile',
6b9d62db
HR
3536 'ftp': 'BlockdevOptionsCurlFtp',
3537 'ftps': 'BlockdevOptionsCurlFtps',
7edac2dd 3538 'gluster': 'BlockdevOptionsGluster',
1ad166b6 3539 'host_cdrom': 'BlockdevOptionsFile',
db866be9 3540 'host_device':'BlockdevOptionsFile',
6b9d62db
HR
3541 'http': 'BlockdevOptionsCurlHttp',
3542 'https': 'BlockdevOptionsCurlHttps',
31eb1202 3543 'iscsi': 'BlockdevOptionsIscsi',
78368575 3544 'luks': 'BlockdevOptionsLUKS',
6b02b1f0 3545 'nbd': 'BlockdevOptionsNbd',
aa2623d8 3546 'nfs': 'BlockdevOptionsNfs',
db866be9
FZ
3547 'null-aio': 'BlockdevOptionsNull',
3548 'null-co': 'BlockdevOptionsNull',
d87ee3d7 3549 'nvme': 'BlockdevOptionsNVMe',
1ad166b6 3550 'parallels': 'BlockdevOptionsGenericFormat',
1ad166b6 3551 'qcow2': 'BlockdevOptionsQcow2',
d85f4222 3552 'qcow': 'BlockdevOptionsQcow',
1ad166b6 3553 'qed': 'BlockdevOptionsGenericCOWFormat',
db866be9 3554 'quorum': 'BlockdevOptionsQuorum',
2fdc7045 3555 'raw': 'BlockdevOptionsRaw',
8a47e8eb 3556 'rbd': 'BlockdevOptionsRbd',
82ac5543 3557 'replication':'BlockdevOptionsReplication',
d282f34e 3558 'sheepdog': 'BlockdevOptionsSheepdog',
ad0e90a6 3559 'ssh': 'BlockdevOptionsSsh',
d8e7d87e 3560 'throttle': 'BlockdevOptionsThrottle',
1ad166b6
BC
3561 'vdi': 'BlockdevOptionsGenericFormat',
3562 'vhdx': 'BlockdevOptionsGenericFormat',
3563 'vmdk': 'BlockdevOptionsGenericCOWFormat',
3564 'vpc': 'BlockdevOptionsGenericFormat',
da92c3ff
AM
3565 'vvfat': 'BlockdevOptionsVVFAT',
3566 'vxhs': 'BlockdevOptionsVxHS'
1ad166b6
BC
3567 } }
3568
3569##
5072f7b3 3570# @BlockdevRef:
1ad166b6
BC
3571#
3572# Reference to a block device.
3573#
3574# @definition: defines a new block device inline
c42e8742 3575# @reference: references the ID of an existing block device
1ad166b6 3576#
79b7a77e 3577# Since: 2.9
1ad166b6 3578##
ab916fad 3579{ 'alternate': 'BlockdevRef',
1ad166b6
BC
3580 'data': { 'definition': 'BlockdevOptions',
3581 'reference': 'str' } }
3582
c42e8742
MA
3583##
3584# @BlockdevRefOrNull:
3585#
3586# Reference to a block device.
3587#
3588# @definition: defines a new block device inline
3589# @reference: references the ID of an existing block device.
3590# An empty string means that no block device should
3591# be referenced. Deprecated; use null instead.
3592# @null: No block device should be referenced (since 2.10)
3593#
3594# Since: 2.9
3595##
3596{ 'alternate': 'BlockdevRefOrNull',
3597 'data': { 'definition': 'BlockdevOptions',
3598 'reference': 'str',
3599 'null': 'null' } }
3600
1ad166b6
BC
3601##
3602# @blockdev-add:
3603#
be4b67bc
HR
3604# Creates a new block device. If the @id option is given at the top level, a
3605# BlockBackend will be created; otherwise, @node-name is mandatory at the top
3606# level and no BlockBackend will be created.
1ad166b6 3607#
79b7a77e 3608# Since: 2.9
b4749948
MAL
3609#
3610# Example:
3611#
3612# 1.
3613# -> { "execute": "blockdev-add",
3614# "arguments": {
b1660997
JC
3615# "driver": "qcow2",
3616# "node-name": "test1",
3617# "file": {
3618# "driver": "file",
3619# "filename": "test.qcow2"
3620# }
3621# }
3622# }
b4749948
MAL
3623# <- { "return": {} }
3624#
3625# 2.
3626# -> { "execute": "blockdev-add",
3627# "arguments": {
b1660997
JC
3628# "driver": "qcow2",
3629# "node-name": "node0",
3630# "discard": "unmap",
3631# "cache": {
3632# "direct": true
b4749948
MAL
3633# },
3634# "file": {
b1660997
JC
3635# "driver": "file",
3636# "filename": "/tmp/test.qcow2"
b4749948
MAL
3637# },
3638# "backing": {
b1660997
JC
3639# "driver": "raw",
3640# "file": {
3641# "driver": "file",
3642# "filename": "/dev/fdset/4"
b4749948
MAL
3643# }
3644# }
b4749948
MAL
3645# }
3646# }
3647#
3648# <- { "return": {} }
3649#
1ad166b6 3650##
0153d2f5 3651{ 'command': 'blockdev-add', 'data': 'BlockdevOptions', 'boxed': true }
1ad166b6 3652
81b936ae 3653##
79b7a77e 3654# @blockdev-del:
81b936ae
AG
3655#
3656# Deletes a block device that has been added using blockdev-add.
9ec8873e
KW
3657# The command will fail if the node is attached to a device or is
3658# otherwise being used.
81b936ae 3659#
7a305384
MAL
3660# @node-name: Name of the graph node to delete.
3661#
79b7a77e 3662# Since: 2.9
915a213f
MAL
3663#
3664# Example:
3665#
3666# -> { "execute": "blockdev-add",
3667# "arguments": {
b1660997
JC
3668# "driver": "qcow2",
3669# "node-name": "node0",
3670# "file": {
3671# "driver": "file",
3672# "filename": "test.qcow2"
3673# }
915a213f
MAL
3674# }
3675# }
3676# <- { "return": {} }
3677#
79b7a77e 3678# -> { "execute": "blockdev-del",
915a213f
MAL
3679# "arguments": { "node-name": "node0" }
3680# }
3681# <- { "return": {} }
3682#
81b936ae 3683##
79b7a77e 3684{ 'command': 'blockdev-del', 'data': { 'node-name': 'str' } }
81b936ae 3685
927f11e1
KW
3686##
3687# @BlockdevCreateOptionsFile:
3688#
3689# Driver specific image creation options for file.
3690#
3691# @filename Filename for the new image file
3692# @size Size of the virtual disk in bytes
3693# @preallocation Preallocation mode for the new image (default: off)
3694# @nocow Turn off copy-on-write (valid only on btrfs; default: off)
3695#
3696# Since: 2.12
3697##
3698{ 'struct': 'BlockdevCreateOptionsFile',
3699 'data': { 'filename': 'str',
3700 'size': 'size',
3701 '*preallocation': 'PreallocMode',
3702 '*nocow': 'bool' } }
3703
ab8bda76
KW
3704##
3705# @BlockdevCreateOptionsGluster:
3706#
3707# Driver specific image creation options for gluster.
3708#
3709# @location Where to store the new image file
3710# @size Size of the virtual disk in bytes
3711# @preallocation Preallocation mode for the new image (default: off)
3712#
3713# Since: 2.12
3714##
3715{ 'struct': 'BlockdevCreateOptionsGluster',
3716 'data': { 'location': 'BlockdevOptionsGluster',
3717 'size': 'size',
3718 '*preallocation': 'PreallocMode' } }
3719
1bedcaf1
KW
3720##
3721# @BlockdevCreateOptionsLUKS:
3722#
3723# Driver specific image creation options for LUKS.
3724#
3725# @file Node to create the image format on
3726# @size Size of the virtual disk in bytes
3727#
3728# Since: 2.12
3729##
3730{ 'struct': 'BlockdevCreateOptionsLUKS',
3731 'base': 'QCryptoBlockCreateOptionsLUKS',
3732 'data': { 'file': 'BlockdevRef',
3733 'size': 'size' } }
3734
a1a42af4
KW
3735##
3736# @BlockdevCreateOptionsNfs:
3737#
3738# Driver specific image creation options for NFS.
3739#
3740# @location Where to store the new image file
3741# @size Size of the virtual disk in bytes
3742#
3743# Since: 2.12
3744##
3745{ 'struct': 'BlockdevCreateOptionsNfs',
3746 'data': { 'location': 'BlockdevOptionsNfs',
3747 'size': 'size' } }
3748
1511b490
KW
3749##
3750# @BlockdevCreateOptionsParallels:
3751#
3752# Driver specific image creation options for parallels.
3753#
3754# @file Node to create the image format on
3755# @size Size of the virtual disk in bytes
3756# @cluster-size Cluster size in bytes (default: 1 MB)
3757#
3758# Since: 2.12
3759##
3760{ 'struct': 'BlockdevCreateOptionsParallels',
3761 'data': { 'file': 'BlockdevRef',
3762 'size': 'size',
3763 '*cluster-size': 'size' } }
3764
42a3e1ab
KW
3765##
3766# @BlockdevCreateOptionsQcow:
3767#
3768# Driver specific image creation options for qcow.
3769#
3770# @file Node to create the image format on
3771# @size Size of the virtual disk in bytes
3772# @backing-file File name of the backing file if a backing file
3773# should be used
3774# @encrypt Encryption options if the image should be encrypted
3775#
3776# Since: 2.12
3777##
3778{ 'struct': 'BlockdevCreateOptionsQcow',
3779 'data': { 'file': 'BlockdevRef',
3780 'size': 'size',
3781 '*backing-file': 'str',
3782 '*encrypt': 'QCryptoBlockCreateOptions' } }
3783
c2808aba
KW
3784##
3785# @BlockdevQcow2Version:
3786#
3787# @v2: The original QCOW2 format as introduced in qemu 0.10 (version 2)
3788# @v3: The extended QCOW2 format as introduced in qemu 1.1 (version 3)
3789#
3790# Since: 2.12
3791##
3792{ 'enum': 'BlockdevQcow2Version',
3793 'data': [ 'v2', 'v3' ] }
3794
3795
3796##
3797# @BlockdevCreateOptionsQcow2:
3798#
3799# Driver specific image creation options for qcow2.
3800#
3801# @file Node to create the image format on
3802# @size Size of the virtual disk in bytes
3803# @version Compatibility level (default: v3)
3804# @backing-file File name of the backing file if a backing file
3805# should be used
3806# @backing-fmt Name of the block driver to use for the backing file
3807# @encrypt Encryption options if the image should be encrypted
3808# @cluster-size qcow2 cluster size in bytes (default: 65536)
3809# @preallocation Preallocation mode for the new image (default: off)
3810# @lazy-refcounts True if refcounts may be updated lazily (default: off)
3811# @refcount-bits Width of reference counts in bits (default: 16)
3812#
3813# Since: 2.12
3814##
3815{ 'struct': 'BlockdevCreateOptionsQcow2',
3816 'data': { 'file': 'BlockdevRef',
3817 'size': 'size',
3818 '*version': 'BlockdevQcow2Version',
3819 '*backing-file': 'str',
3820 '*backing-fmt': 'BlockdevDriver',
3821 '*encrypt': 'QCryptoBlockCreateOptions',
3822 '*cluster-size': 'size',
3823 '*preallocation': 'PreallocMode',
3824 '*lazy-refcounts': 'bool',
3825 '*refcount-bits': 'int' } }
3826
959355a4
KW
3827##
3828# @BlockdevCreateOptionsQed:
3829#
3830# Driver specific image creation options for qed.
3831#
3832# @file Node to create the image format on
3833# @size Size of the virtual disk in bytes
3834# @backing-file File name of the backing file if a backing file
3835# should be used
3836# @backing-fmt Name of the block driver to use for the backing file
3837# @cluster-size Cluster size in bytes (default: 65536)
3838# @table-size L1/L2 table size (in clusters)
3839#
3840# Since: 2.12
3841##
3842{ 'struct': 'BlockdevCreateOptionsQed',
3843 'data': { 'file': 'BlockdevRef',
3844 'size': 'size',
3845 '*backing-file': 'str',
3846 '*backing-fmt': 'BlockdevDriver',
3847 '*cluster-size': 'size',
3848 '*table-size': 'int' } }
3849
1bebea37
KW
3850##
3851# @BlockdevCreateOptionsRbd:
3852#
3853# Driver specific image creation options for rbd/Ceph.
3854#
3855# @location Where to store the new image file. This location cannot
3856# point to a snapshot.
3857# @size Size of the virtual disk in bytes
3858# @cluster-size RBD object size
3859#
3860# Since: 2.12
3861##
3862{ 'struct': 'BlockdevCreateOptionsRbd',
3863 'data': { 'location': 'BlockdevOptionsRbd',
3864 'size': 'size',
3865 '*cluster-size' : 'size' } }
3866
a595e4bc
KW
3867##
3868# @SheepdogRedundancyType:
3869#
3870# @full Create a fully replicated vdi with x copies
3871# @erasure-coded Create an erasure coded vdi with x data strips and
3872# y parity strips
3873#
3874# Since: 2.12
3875##
3876{ 'enum': 'SheepdogRedundancyType',
3877 'data': [ 'full', 'erasure-coded' ] }
3878
3879##
3880# @SheepdogRedundancyFull:
3881#
3882# @copies Number of copies to use (between 1 and 31)
3883#
3884# Since: 2.12
3885##
3886{ 'struct': 'SheepdogRedundancyFull',
3887 'data': { 'copies': 'int' }}
3888
3889##
3890# @SheepdogRedundancyErasureCoded:
3891#
3892# @data-strips Number of data strips to use (one of {2,4,8,16})
3893# @parity-strips Number of parity strips to use (between 1 and 15)
3894#
3895# Since: 2.12
3896##
3897{ 'struct': 'SheepdogRedundancyErasureCoded',
3898 'data': { 'data-strips': 'int',
3899 'parity-strips': 'int' }}
3900
3901##
3902# @SheepdogRedundancy:
3903#
3904# Since: 2.12
3905##
3906{ 'union': 'SheepdogRedundancy',
3907 'base': { 'type': 'SheepdogRedundancyType' },
3908 'discriminator': 'type',
3909 'data': { 'full': 'SheepdogRedundancyFull',
3910 'erasure-coded': 'SheepdogRedundancyErasureCoded' } }
3911
63fd65a0
KW
3912##
3913# @BlockdevCreateOptionsSheepdog:
3914#
3915# Driver specific image creation options for Sheepdog.
3916#
3917# @location Where to store the new image file
3918# @size Size of the virtual disk in bytes
3919# @backing-file File name of a base image
3920# @preallocation Preallocation mode (allowed values: off, full)
3921# @redundancy Redundancy of the image
3922# @object-size Object size of the image
3923#
3924# Since: 2.12
3925##
3926{ 'struct': 'BlockdevCreateOptionsSheepdog',
3927 'data': { 'location': 'BlockdevOptionsSheepdog',
3928 'size': 'size',
3929 '*backing-file': 'str',
3930 '*preallocation': 'PreallocMode',
3931 '*redundancy': 'SheepdogRedundancy',
3932 '*object-size': 'size' } }
3933
4906da7e
KW
3934##
3935# @BlockdevCreateOptionsSsh:
3936#
3937# Driver specific image creation options for SSH.
3938#
3939# @location Where to store the new image file
3940# @size Size of the virtual disk in bytes
3941#
3942# Since: 2.12
3943##
3944{ 'struct': 'BlockdevCreateOptionsSsh',
3945 'data': { 'location': 'BlockdevOptionsSsh',
3946 'size': 'size' } }
3947
49858b50
HR
3948##
3949# @BlockdevCreateOptionsVdi:
3950#
3951# Driver specific image creation options for VDI.
3952#
3953# @file Node to create the image format on
3954# @size Size of the virtual disk in bytes
61fa6487
KW
3955# @preallocation Preallocation mode for the new image (allowed values: off,
3956# metadata; default: off)
49858b50
HR
3957#
3958# Since: 2.12
3959##
3960{ 'struct': 'BlockdevCreateOptionsVdi',
3961 'data': { 'file': 'BlockdevRef',
3962 'size': 'size',
61fa6487 3963 '*preallocation': 'PreallocMode' } }
49858b50 3964
09b68dab
KW
3965##
3966# @BlockdevVhdxSubformat:
3967#
3968# @dynamic: Growing image file
3969# @fixed: Preallocated fixed-size image file
3970#
3971# Since: 2.12
3972##
3973{ 'enum': 'BlockdevVhdxSubformat',
3974 'data': [ 'dynamic', 'fixed' ] }
3975
3976##
3977# @BlockdevCreateOptionsVhdx:
3978#
3979# Driver specific image creation options for vhdx.
3980#
3981# @file Node to create the image format on
3982# @size Size of the virtual disk in bytes
3983# @log-size Log size in bytes, must be a multiple of 1 MB
3984# (default: 1 MB)
3985# @block-size Block size in bytes, must be a multiple of 1 MB and not
3986# larger than 256 MB (default: automatically choose a block
3987# size depending on the image size)
3988# @subformat vhdx subformat (default: dynamic)
3989# @block-state-zero Force use of payload blocks of type 'ZERO'. Non-standard,
3990# but default. Do not set to 'off' when using 'qemu-img
3991# convert' with subformat=dynamic.
3992#
3993# Since: 2.12
3994##
3995{ 'struct': 'BlockdevCreateOptionsVhdx',
3996 'data': { 'file': 'BlockdevRef',
3997 'size': 'size',
3998 '*log-size': 'size',
3999 '*block-size': 'size',
4000 '*subformat': 'BlockdevVhdxSubformat',
4001 '*block-state-zero': 'bool' } }
4002
182c8835
KW
4003##
4004# @BlockdevVpcSubformat:
4005#
4006# @dynamic: Growing image file
4007# @fixed: Preallocated fixed-size image file
4008#
4009# Since: 2.12
4010##
4011{ 'enum': 'BlockdevVpcSubformat',
4012 'data': [ 'dynamic', 'fixed' ] }
4013
4014##
4015# @BlockdevCreateOptionsVpc:
4016#
4017# Driver specific image creation options for vpc (VHD).
4018#
4019# @file Node to create the image format on
4020# @size Size of the virtual disk in bytes
4021# @subformat vhdx subformat (default: dynamic)
4022# @force-size Force use of the exact byte size instead of rounding to the
4023# next size that can be represented in CHS geometry
4024# (default: false)
4025#
4026# Since: 2.12
4027##
4028{ 'struct': 'BlockdevCreateOptionsVpc',
4029 'data': { 'file': 'BlockdevRef',
4030 'size': 'size',
4031 '*subformat': 'BlockdevVpcSubformat',
4032 '*force-size': 'bool' } }
4033
53614689
KW
4034##
4035# @BlockdevCreateNotSupported:
4036#
4037# This is used for all drivers that don't support creating images.
4038#
4039# Since: 2.12
4040##
4041{ 'struct': 'BlockdevCreateNotSupported', 'data': {}}
4042
4043##
4044# @BlockdevCreateOptions:
4045#
4046# Options for creating an image format on a given node.
4047#
4048# @driver block driver to create the image format
4049#
4050# Since: 2.12
4051##
4052{ 'union': 'BlockdevCreateOptions',
4053 'base': {
4054 'driver': 'BlockdevDriver' },
4055 'discriminator': 'driver',
4056 'data': {
4057 'blkdebug': 'BlockdevCreateNotSupported',
4058 'blkverify': 'BlockdevCreateNotSupported',
4059 'bochs': 'BlockdevCreateNotSupported',
4060 'cloop': 'BlockdevCreateNotSupported',
4061 'dmg': 'BlockdevCreateNotSupported',
927f11e1 4062 'file': 'BlockdevCreateOptionsFile',
53614689
KW
4063 'ftp': 'BlockdevCreateNotSupported',
4064 'ftps': 'BlockdevCreateNotSupported',
ab8bda76 4065 'gluster': 'BlockdevCreateOptionsGluster',
53614689
KW
4066 'host_cdrom': 'BlockdevCreateNotSupported',
4067 'host_device': 'BlockdevCreateNotSupported',
4068 'http': 'BlockdevCreateNotSupported',
4069 'https': 'BlockdevCreateNotSupported',
4070 'iscsi': 'BlockdevCreateNotSupported',
1bedcaf1 4071 'luks': 'BlockdevCreateOptionsLUKS',
53614689 4072 'nbd': 'BlockdevCreateNotSupported',
a1a42af4 4073 'nfs': 'BlockdevCreateOptionsNfs',
53614689
KW
4074 'null-aio': 'BlockdevCreateNotSupported',
4075 'null-co': 'BlockdevCreateNotSupported',
4076 'nvme': 'BlockdevCreateNotSupported',
1511b490 4077 'parallels': 'BlockdevCreateOptionsParallels',
42a3e1ab 4078 'qcow': 'BlockdevCreateOptionsQcow',
c2808aba 4079 'qcow2': 'BlockdevCreateOptionsQcow2',
959355a4 4080 'qed': 'BlockdevCreateOptionsQed',
53614689
KW
4081 'quorum': 'BlockdevCreateNotSupported',
4082 'raw': 'BlockdevCreateNotSupported',
1bebea37 4083 'rbd': 'BlockdevCreateOptionsRbd',
53614689 4084 'replication': 'BlockdevCreateNotSupported',
63fd65a0 4085 'sheepdog': 'BlockdevCreateOptionsSheepdog',
4906da7e 4086 'ssh': 'BlockdevCreateOptionsSsh',
53614689 4087 'throttle': 'BlockdevCreateNotSupported',
e3810574 4088 'vdi': 'BlockdevCreateOptionsVdi',
09b68dab 4089 'vhdx': 'BlockdevCreateOptionsVhdx',
53614689 4090 'vmdk': 'BlockdevCreateNotSupported',
182c8835 4091 'vpc': 'BlockdevCreateOptionsVpc',
53614689
KW
4092 'vvfat': 'BlockdevCreateNotSupported',
4093 'vxhs': 'BlockdevCreateNotSupported'
4094 } }
4095
b0292b85
KW
4096##
4097# @x-blockdev-create:
4098#
4099# Create an image format on a given node.
4100# TODO Replace with something asynchronous (block job?)
4101#
4102# Since: 2.12
4103##
4104{ 'command': 'x-blockdev-create',
4105 'data': 'BlockdevCreateOptions',
4106 'boxed': true }
4107
7d8a9f71
HR
4108##
4109# @blockdev-open-tray:
4110#
4111# Opens a block device's tray. If there is a block driver state tree inserted as
4112# a medium, it will become inaccessible to the guest (but it will remain
4113# associated to the block device, so closing the tray will make it accessible
4114# again).
4115#
4116# If the tray was already open before, this will be a no-op.
4117#
4118# Once the tray opens, a DEVICE_TRAY_MOVED event is emitted. There are cases in
4119# which no such event will be generated, these include:
4120# - if the guest has locked the tray, @force is false and the guest does not
4121# respond to the eject request
4122# - if the BlockBackend denoted by @device does not have a guest device attached
4123# to it
12c7ec87 4124# - if the guest device does not have an actual tray
7d8a9f71 4125#
1d8bda12 4126# @device: Block device name (deprecated, use @id instead)
b33945cf 4127#
1d8bda12 4128# @id: The name or QOM path of the guest device (since: 2.8)
7d8a9f71 4129#
1d8bda12 4130# @force: if false (the default), an eject request will be sent to
7d8a9f71
HR
4131# the guest if it has locked the tray (and the tray will not be opened
4132# immediately); if true, the tray will be opened regardless of whether
4133# it is locked
4134#
4135# Since: 2.5
1133b1d6
MAL
4136#
4137# Example:
4138#
4139# -> { "execute": "blockdev-open-tray",
4140# "arguments": { "id": "ide0-1-0" } }
4141#
4142# <- { "timestamp": { "seconds": 1418751016,
4143# "microseconds": 716996 },
4144# "event": "DEVICE_TRAY_MOVED",
4145# "data": { "device": "ide1-cd0",
4146# "id": "ide0-1-0",
4147# "tray-open": true } }
4148#
4149# <- { "return": {} }
4150#
7d8a9f71
HR
4151##
4152{ 'command': 'blockdev-open-tray',
b33945cf
KW
4153 'data': { '*device': 'str',
4154 '*id': 'str',
7d8a9f71
HR
4155 '*force': 'bool' } }
4156
abaaf59d
HR
4157##
4158# @blockdev-close-tray:
4159#
4160# Closes a block device's tray. If there is a block driver state tree associated
4161# with the block device (which is currently ejected), that tree will be loaded
4162# as the medium.
4163#
4164# If the tray was already closed before, this will be a no-op.
4165#
1d8bda12 4166# @device: Block device name (deprecated, use @id instead)
b33945cf 4167#
1d8bda12 4168# @id: The name or QOM path of the guest device (since: 2.8)
abaaf59d
HR
4169#
4170# Since: 2.5
7f3c6f22
MAL
4171#
4172# Example:
4173#
4174# -> { "execute": "blockdev-close-tray",
4175# "arguments": { "id": "ide0-1-0" } }
4176#
4177# <- { "timestamp": { "seconds": 1418751345,
4178# "microseconds": 272147 },
4179# "event": "DEVICE_TRAY_MOVED",
4180# "data": { "device": "ide1-cd0",
4181# "id": "ide0-1-0",
4182# "tray-open": false } }
4183#
4184# <- { "return": {} }
4185#
abaaf59d
HR
4186##
4187{ 'command': 'blockdev-close-tray',
b33945cf
KW
4188 'data': { '*device': 'str',
4189 '*id': 'str' } }
abaaf59d 4190
2814f672 4191##
34ce1111 4192# @blockdev-remove-medium:
2814f672
HR
4193#
4194# Removes a medium (a block driver state tree) from a block device. That block
4195# device's tray must currently be open (unless there is no attached guest
4196# device).
4197#
4198# If the tray is open and there is no medium inserted, this will be a no-op.
4199#
34ce1111 4200# @id: The name or QOM path of the guest device
2814f672 4201#
34ce1111 4202# Since: 2.12
8e1c1429
MAL
4203#
4204# Example:
4205#
34ce1111 4206# -> { "execute": "blockdev-remove-medium",
8e1c1429
MAL
4207# "arguments": { "id": "ide0-1-0" } }
4208#
4209# <- { "error": { "class": "GenericError",
4210# "desc": "Tray of device 'ide0-1-0' is not open" } }
4211#
4212# -> { "execute": "blockdev-open-tray",
4213# "arguments": { "id": "ide0-1-0" } }
4214#
4215# <- { "timestamp": { "seconds": 1418751627,
4216# "microseconds": 549958 },
4217# "event": "DEVICE_TRAY_MOVED",
4218# "data": { "device": "ide1-cd0",
4219# "id": "ide0-1-0",
4220# "tray-open": true } }
4221#
4222# <- { "return": {} }
4223#
34ce1111 4224# -> { "execute": "blockdev-remove-medium",
244d04db 4225# "arguments": { "id": "ide0-1-0" } }
8e1c1429
MAL
4226#
4227# <- { "return": {} }
4228#
2814f672 4229##
34ce1111 4230{ 'command': 'blockdev-remove-medium',
82fcf66e 4231 'data': { 'id': 'str' } }
2814f672 4232
d1299882 4233##
34ce1111 4234# @blockdev-insert-medium:
d1299882
HR
4235#
4236# Inserts a medium (a block driver state tree) into a block device. That block
4237# device's tray must currently be open (unless there is no attached guest
4238# device) and there must be no medium inserted already.
4239#
34ce1111 4240# @id: The name or QOM path of the guest device
d1299882
HR
4241#
4242# @node-name: name of a node in the block driver state graph
4243#
34ce1111 4244# Since: 2.12
b480abf3
MAL
4245#
4246# Example:
4247#
4248# -> { "execute": "blockdev-add",
4249# "arguments": {
244d04db
EB
4250# "node-name": "node0",
4251# "driver": "raw",
4252# "file": { "driver": "file",
4253# "filename": "fedora.iso" } } }
b480abf3
MAL
4254# <- { "return": {} }
4255#
34ce1111 4256# -> { "execute": "blockdev-insert-medium",
b480abf3
MAL
4257# "arguments": { "id": "ide0-1-0",
4258# "node-name": "node0" } }
4259#
4260# <- { "return": {} }
4261#
d1299882 4262##
34ce1111 4263{ 'command': 'blockdev-insert-medium',
82fcf66e 4264 'data': { 'id': 'str',
d1299882
HR
4265 'node-name': 'str'} }
4266
a589569f 4267
39ff43d9
HR
4268##
4269# @BlockdevChangeReadOnlyMode:
4270#
4271# Specifies the new read-only mode of a block device subject to the
4272# @blockdev-change-medium command.
4273#
4274# @retain: Retains the current read-only mode
4275#
4276# @read-only: Makes the device read-only
4277#
4278# @read-write: Makes the device writable
4279#
4280# Since: 2.3
be3e83cb 4281#
39ff43d9
HR
4282##
4283{ 'enum': 'BlockdevChangeReadOnlyMode',
4284 'data': ['retain', 'read-only', 'read-write'] }
4285
4286
24fb4133
HR
4287##
4288# @blockdev-change-medium:
4289#
4290# Changes the medium inserted into a block device by ejecting the current medium
4291# and loading a new image file which is inserted as the new medium (this command
34ce1111
HR
4292# combines blockdev-open-tray, blockdev-remove-medium, blockdev-insert-medium
4293# and blockdev-close-tray).
24fb4133 4294#
1d8bda12 4295# @device: Block device name (deprecated, use @id instead)
70e2cb3b 4296#
1d8bda12 4297# @id: The name or QOM path of the guest device
70e2cb3b 4298# (since: 2.8)
24fb4133
HR
4299#
4300# @filename: filename of the new image to be loaded
4301#
1d8bda12 4302# @format: format to open the new image with (defaults to
24fb4133
HR
4303# the probed format)
4304#
1d8bda12 4305# @read-only-mode: change the read-only mode of the device; defaults
39ff43d9
HR
4306# to 'retain'
4307#
24fb4133 4308# Since: 2.5
be3e83cb
MAL
4309#
4310# Examples:
4311#
4312# 1. Change a removable medium
4313#
4314# -> { "execute": "blockdev-change-medium",
4315# "arguments": { "id": "ide0-1-0",
4316# "filename": "/srv/images/Fedora-12-x86_64-DVD.iso",
4317# "format": "raw" } }
4318# <- { "return": {} }
4319#
4320# 2. Load a read-only medium into a writable drive
4321#
4322# -> { "execute": "blockdev-change-medium",
4323# "arguments": { "id": "floppyA",
4324# "filename": "/srv/images/ro.img",
4325# "format": "raw",
4326# "read-only-mode": "retain" } }
4327#
4328# <- { "error":
4329# { "class": "GenericError",
4330# "desc": "Could not open '/srv/images/ro.img': Permission denied" } }
4331#
4332# -> { "execute": "blockdev-change-medium",
4333# "arguments": { "id": "floppyA",
4334# "filename": "/srv/images/ro.img",
4335# "format": "raw",
4336# "read-only-mode": "read-only" } }
4337#
4338# <- { "return": {} }
4339#
24fb4133
HR
4340##
4341{ 'command': 'blockdev-change-medium',
70e2cb3b
KW
4342 'data': { '*device': 'str',
4343 '*id': 'str',
24fb4133 4344 'filename': 'str',
39ff43d9
HR
4345 '*format': 'str',
4346 '*read-only-mode': 'BlockdevChangeReadOnlyMode' } }
24fb4133
HR
4347
4348
a589569f 4349##
5072f7b3 4350# @BlockErrorAction:
a589569f
WX
4351#
4352# An enumeration of action that has been taken when a DISK I/O occurs
4353#
4354# @ignore: error has been ignored
4355#
4356# @report: error has been reported to the device
4357#
4358# @stop: error caused VM to be stopped
4359#
4360# Since: 2.1
4361##
4362{ 'enum': 'BlockErrorAction',
4363 'data': [ 'ignore', 'report', 'stop' ] }
5a2d2cbd
WX
4364
4365
c120f0fa 4366##
5072f7b3 4367# @BLOCK_IMAGE_CORRUPTED:
c120f0fa 4368#
370d4eba
MAL
4369# Emitted when a disk image is being marked corrupt. The image can be
4370# identified by its device or node name. The 'device' field is always
4371# present for compatibility reasons, but it can be empty ("") if the
4372# image does not have a device name associated.
c120f0fa 4373#
dc881b44
AG
4374# @device: device name. This is always present for compatibility
4375# reasons, but it can be empty ("") if the image does not
4376# have a device name associated.
4377#
1d8bda12 4378# @node-name: node name (Since: 2.4)
c120f0fa
WX
4379#
4380# @msg: informative message for human consumption, such as the kind of
2f44a08b
WX
4381# corruption being detected. It should not be parsed by machine as it is
4382# not guaranteed to be stable
c120f0fa 4383#
1d8bda12 4384# @offset: if the corruption resulted from an image access, this is
0caef8f6 4385# the host's access offset into the image
c120f0fa 4386#
1d8bda12 4387# @size: if the corruption resulted from an image access, this is
c120f0fa
WX
4388# the access size
4389#
370d4eba 4390# @fatal: if set, the image is marked corrupt and therefore unusable after this
9bf040b9
HR
4391# event and must be repaired (Since 2.2; before, every
4392# BLOCK_IMAGE_CORRUPTED event was fatal)
4393#
07c9f583
MAL
4394# Note: If action is "stop", a STOP event will eventually follow the
4395# BLOCK_IO_ERROR event.
4396#
370d4eba
MAL
4397# Example:
4398#
4399# <- { "event": "BLOCK_IMAGE_CORRUPTED",
4400# "data": { "device": "ide0-hd0", "node-name": "node0",
4401# "msg": "Prevented active L1 table overwrite", "offset": 196608,
4402# "size": 65536 },
4403# "timestamp": { "seconds": 1378126126, "microseconds": 966463 } }
4404#
c120f0fa
WX
4405# Since: 1.7
4406##
4407{ 'event': 'BLOCK_IMAGE_CORRUPTED',
dc881b44
AG
4408 'data': { 'device' : 'str',
4409 '*node-name' : 'str',
4410 'msg' : 'str',
4411 '*offset' : 'int',
4412 '*size' : 'int',
4413 'fatal' : 'bool' } }
c120f0fa 4414
5a2d2cbd 4415##
5072f7b3 4416# @BLOCK_IO_ERROR:
5a2d2cbd
WX
4417#
4418# Emitted when a disk I/O error occurs
4419#
2bf7e10f
KW
4420# @device: device name. This is always present for compatibility
4421# reasons, but it can be empty ("") if the image does not
4422# have a device name associated.
4423#
4424# @node-name: node name. Note that errors may be reported for the root node
4425# that is directly attached to a guest device rather than for the
bfe1a14c
KW
4426# node where the error occurred. The node name is not present if
4427# the drive is empty. (Since: 2.8)
5a2d2cbd
WX
4428#
4429# @operation: I/O operation
4430#
4431# @action: action that has been taken
4432#
1d8bda12 4433# @nospace: true if I/O error was caused due to a no-space
c7c2ff0c
LC
4434# condition. This key is only present if query-block's
4435# io-status is present, please see query-block documentation
4436# for more information (since: 2.2)
4437#
624ff573
LC
4438# @reason: human readable string describing the error cause.
4439# (This field is a debugging aid for humans, it should not
4440# be parsed by applications) (since: 2.2)
4441#
5a2d2cbd
WX
4442# Note: If action is "stop", a STOP event will eventually follow the
4443# BLOCK_IO_ERROR event
4444#
4445# Since: 0.13.0
07c9f583
MAL
4446#
4447# Example:
4448#
4449# <- { "event": "BLOCK_IO_ERROR",
4450# "data": { "device": "ide0-hd1",
4451# "node-name": "#block212",
4452# "operation": "write",
4453# "action": "stop" },
4454# "timestamp": { "seconds": 1265044230, "microseconds": 450486 } }
4455#
5a2d2cbd
WX
4456##
4457{ 'event': 'BLOCK_IO_ERROR',
bfe1a14c
KW
4458 'data': { 'device': 'str', '*node-name': 'str',
4459 'operation': 'IoOperationType',
624ff573
LC
4460 'action': 'BlockErrorAction', '*nospace': 'bool',
4461 'reason': 'str' } }
5a2d2cbd 4462
bcada37b 4463##
5072f7b3 4464# @BLOCK_JOB_COMPLETED:
bcada37b
WX
4465#
4466# Emitted when a block job has completed
4467#
4468# @type: job type
4469#
6aae5be6
AG
4470# @device: The job identifier. Originally the device name but other
4471# values are allowed since QEMU 2.7
bcada37b
WX
4472#
4473# @len: maximum progress value
4474#
4475# @offset: current progress value. On success this is equal to len.
4476# On failure this is less than len
4477#
4478# @speed: rate limit, bytes per second
4479#
1d8bda12 4480# @error: error message. Only present on failure. This field
bcada37b
WX
4481# contains a human-readable error message. There are no semantics
4482# other than that streaming has failed and clients should not try to
4483# interpret the error string
4484#
4485# Since: 1.1
e21e65b2
MAL
4486#
4487# Example:
4488#
4489# <- { "event": "BLOCK_JOB_COMPLETED",
4490# "data": { "type": "stream", "device": "virtio-disk0",
4491# "len": 10737418240, "offset": 10737418240,
4492# "speed": 0 },
4493# "timestamp": { "seconds": 1267061043, "microseconds": 959568 } }
4494#
bcada37b
WX
4495##
4496{ 'event': 'BLOCK_JOB_COMPLETED',
4497 'data': { 'type' : 'BlockJobType',
4498 'device': 'str',
4499 'len' : 'int',
4500 'offset': 'int',
4501 'speed' : 'int',
4502 '*error': 'str' } }
4503
4504##
5072f7b3 4505# @BLOCK_JOB_CANCELLED:
bcada37b
WX
4506#
4507# Emitted when a block job has been cancelled
4508#
4509# @type: job type
4510#
6aae5be6
AG
4511# @device: The job identifier. Originally the device name but other
4512# values are allowed since QEMU 2.7
bcada37b
WX
4513#
4514# @len: maximum progress value
4515#
4516# @offset: current progress value. On success this is equal to len.
4517# On failure this is less than len
4518#
4519# @speed: rate limit, bytes per second
4520#
4521# Since: 1.1
e161df39
MAL
4522#
4523# Example:
4524#
4525# <- { "event": "BLOCK_JOB_CANCELLED",
4526# "data": { "type": "stream", "device": "virtio-disk0",
4527# "len": 10737418240, "offset": 134217728,
4528# "speed": 0 },
4529# "timestamp": { "seconds": 1267061043, "microseconds": 959568 } }
4530#
bcada37b
WX
4531##
4532{ 'event': 'BLOCK_JOB_CANCELLED',
4533 'data': { 'type' : 'BlockJobType',
4534 'device': 'str',
4535 'len' : 'int',
4536 'offset': 'int',
4537 'speed' : 'int' } }
4538
5a2d2cbd 4539##
5072f7b3 4540# @BLOCK_JOB_ERROR:
5a2d2cbd
WX
4541#
4542# Emitted when a block job encounters an error
4543#
6aae5be6
AG
4544# @device: The job identifier. Originally the device name but other
4545# values are allowed since QEMU 2.7
5a2d2cbd
WX
4546#
4547# @operation: I/O operation
4548#
4549# @action: action that has been taken
4550#
4551# Since: 1.3
af0e0910
MAL
4552#
4553# Example:
4554#
4555# <- { "event": "BLOCK_JOB_ERROR",
4556# "data": { "device": "ide0-hd1",
4557# "operation": "write",
4558# "action": "stop" },
4559# "timestamp": { "seconds": 1265044230, "microseconds": 450486 } }
4560#
5a2d2cbd
WX
4561##
4562{ 'event': 'BLOCK_JOB_ERROR',
4563 'data': { 'device' : 'str',
4564 'operation': 'IoOperationType',
823c6863 4565 'action' : 'BlockErrorAction' } }
bcada37b
WX
4566
4567##
5072f7b3 4568# @BLOCK_JOB_READY:
bcada37b
WX
4569#
4570# Emitted when a block job is ready to complete
4571#
518848a2
MA
4572# @type: job type
4573#
6aae5be6
AG
4574# @device: The job identifier. Originally the device name but other
4575# values are allowed since QEMU 2.7
bcada37b 4576#
518848a2
MA
4577# @len: maximum progress value
4578#
4579# @offset: current progress value. On success this is equal to len.
4580# On failure this is less than len
4581#
4582# @speed: rate limit, bytes per second
4583#
bcada37b
WX
4584# Note: The "ready to complete" status is always reset by a @BLOCK_JOB_ERROR
4585# event
4586#
4587# Since: 1.3
11a3dee1
MAL
4588#
4589# Example:
4590#
4591# <- { "event": "BLOCK_JOB_READY",
4592# "data": { "device": "drive0", "type": "mirror", "speed": 0,
4593# "len": 2097152, "offset": 2097152 }
4594# "timestamp": { "seconds": 1265044230, "microseconds": 450486 } }
4595#
bcada37b
WX
4596##
4597{ 'event': 'BLOCK_JOB_READY',
518848a2
MA
4598 'data': { 'type' : 'BlockJobType',
4599 'device': 'str',
4600 'len' : 'int',
4601 'offset': 'int',
4602 'speed' : 'int' } }
ffeaac9b 4603
5f241594
JS
4604##
4605# @BLOCK_JOB_PENDING:
4606#
4607# Emitted when a block job is awaiting explicit authorization to finalize graph
4608# changes via @block-job-finalize. If this job is part of a transaction, it will
4609# not emit this event until the transaction has converged first.
4610#
4611# @type: job type
4612#
4613# @id: The job identifier.
4614#
4615# Since: 2.12
4616#
4617# Example:
4618#
4619# <- { "event": "BLOCK_JOB_WAITING",
4620# "data": { "device": "drive0", "type": "mirror" },
4621# "timestamp": { "seconds": 1265044230, "microseconds": 450486 } }
4622#
4623##
4624{ 'event': 'BLOCK_JOB_PENDING',
4625 'data': { 'type' : 'BlockJobType',
4626 'id' : 'str' } }
4627
49687ace 4628##
5072f7b3 4629# @PreallocMode:
ffeaac9b
HT
4630#
4631# Preallocation mode of QEMU image file
4632#
4633# @off: no preallocation
4634# @metadata: preallocate only for metadata
4635# @falloc: like @full preallocation but allocate disk space by
4636# posix_fallocate() rather than writing zeros.
4637# @full: preallocate all data by writing zeros to device to ensure disk
4638# space is really available. @full preallocation also sets up
4639# metadata correctly.
4640#
5072f7b3 4641# Since: 2.2
ffeaac9b
HT
4642##
4643{ 'enum': 'PreallocMode',
4644 'data': [ 'off', 'metadata', 'falloc', 'full' ] }
e2462113
FR
4645
4646##
5072f7b3 4647# @BLOCK_WRITE_THRESHOLD:
e2462113
FR
4648#
4649# Emitted when writes on block device reaches or exceeds the
4650# configured write threshold. For thin-provisioned devices, this
4651# means the device should be extended to avoid pausing for
4652# disk exhaustion.
4653# The event is one shot. Once triggered, it needs to be
f85d66f4 4654# re-registered with another block-set-write-threshold command.
e2462113
FR
4655#
4656# @node-name: graph node name on which the threshold was exceeded.
4657#
4658# @amount-exceeded: amount of data which exceeded the threshold, in bytes.
4659#
4660# @write-threshold: last configured threshold, in bytes.
4661#
4662# Since: 2.3
4663##
4664{ 'event': 'BLOCK_WRITE_THRESHOLD',
4665 'data': { 'node-name': 'str',
4666 'amount-exceeded': 'uint64',
4667 'write-threshold': 'uint64' } }
4668
4669##
5072f7b3 4670# @block-set-write-threshold:
e2462113 4671#
e817862b
MAL
4672# Change the write threshold for a block drive. An event will be
4673# delivered if a write to this block drive crosses the configured
4674# threshold. The threshold is an offset, thus must be
4675# non-negative. Default is no write threshold. Setting the threshold
4676# to zero disables it.
4677#
e2462113
FR
4678# This is useful to transparently resize thin-provisioned drives without
4679# the guest OS noticing.
4680#
4681# @node-name: graph node name on which the threshold must be set.
4682#
4683# @write-threshold: configured threshold for the block device, bytes.
4684# Use 0 to disable the threshold.
4685#
e2462113 4686# Since: 2.3
e817862b
MAL
4687#
4688# Example:
4689#
4690# -> { "execute": "block-set-write-threshold",
4691# "arguments": { "node-name": "mydev",
4692# "write-threshold": 17179869184 } }
4693# <- { "return": {} }
4694#
e2462113
FR
4695##
4696{ 'command': 'block-set-write-threshold',
4697 'data': { 'node-name': 'str', 'write-threshold': 'uint64' } }
7f821597
WC
4698
4699##
5072f7b3 4700# @x-blockdev-change:
7f821597
WC
4701#
4702# Dynamically reconfigure the block driver state graph. It can be used
4703# to add, remove, insert or replace a graph node. Currently only the
4704# Quorum driver implements this feature to add or remove its child. This
4705# is useful to fix a broken quorum child.
4706#
4707# If @node is specified, it will be inserted under @parent. @child
4708# may not be specified in this case. If both @parent and @child are
4709# specified but @node is not, @child will be detached from @parent.
4710#
4711# @parent: the id or name of the parent node.
4712#
1d8bda12 4713# @child: the name of a child under the given parent node.
7f821597 4714#
1d8bda12 4715# @node: the name of the node that will be added.
7f821597
WC
4716#
4717# Note: this command is experimental, and its API is not stable. It
4718# does not support all kinds of operations, all kinds of children, nor
4719# all block drivers.
4720#
6b4738ce
KW
4721# FIXME Removing children from a quorum node means introducing gaps in the
4722# child indices. This cannot be represented in the 'children' list of
4723# BlockdevOptionsQuorum, as returned by .bdrv_refresh_filename().
4724#
7f821597
WC
4725# Warning: The data in a new quorum child MUST be consistent with that of
4726# the rest of the array.
4727#
4728# Since: 2.7
bd77ea2e
MAL
4729#
4730# Example:
4731#
4732# 1. Add a new node to a quorum
4733# -> { "execute": "blockdev-add",
4734# "arguments": {
244d04db
EB
4735# "driver": "raw",
4736# "node-name": "new_node",
4737# "file": { "driver": "file",
4738# "filename": "test.raw" } } }
bd77ea2e
MAL
4739# <- { "return": {} }
4740# -> { "execute": "x-blockdev-change",
4741# "arguments": { "parent": "disk1",
4742# "node": "new_node" } }
4743# <- { "return": {} }
4744#
4745# 2. Delete a quorum's node
4746# -> { "execute": "x-blockdev-change",
4747# "arguments": { "parent": "disk1",
4748# "child": "children.1" } }
4749# <- { "return": {} }
4750#
7f821597
WC
4751##
4752{ 'command': 'x-blockdev-change',
4753 'data' : { 'parent': 'str',
4754 '*child': 'str',
4755 '*node': 'str' } }
ca00bbb1
SH
4756
4757##
4758# @x-blockdev-set-iothread:
4759#
4760# Move @node and its children into the @iothread. If @iothread is null then
4761# move @node and its children into the main loop.
4762#
4763# The node must not be attached to a BlockBackend.
4764#
4765# @node-name: the name of the block driver node
4766#
4767# @iothread: the name of the IOThread object or null for the main loop
4768#
882e9b89
SH
4769# @force: true if the node and its children should be moved when a BlockBackend
4770# is already attached
4771#
ca00bbb1
SH
4772# Note: this command is experimental and intended for test cases that need
4773# control over IOThreads only.
4774#
4775# Since: 2.12
4776#
4777# Example:
4778#
4779# 1. Move a node into an IOThread
4780# -> { "execute": "x-blockdev-set-iothread",
4781# "arguments": { "node-name": "disk1",
4782# "iothread": "iothread0" } }
4783# <- { "return": {} }
4784#
4785# 2. Move a node into the main loop
4786# -> { "execute": "x-blockdev-set-iothread",
4787# "arguments": { "node-name": "disk1",
4788# "iothread": null } }
4789# <- { "return": {} }
4790#
4791##
4792{ 'command': 'x-blockdev-set-iothread',
4793 'data' : { 'node-name': 'str',
882e9b89
SH
4794 'iothread': 'StrOrNull',
4795 '*force': 'bool' } }