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