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