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