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