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