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