]> git.proxmox.com Git - mirror_qemu.git/blame - qapi/block-core.json
block: Accept device model name for x-blockdev-insert-medium
[mirror_qemu.git] / qapi / block-core.json
CommitLineData
5db15096
BC
1# -*- Mode: Python -*-
2#
3# QAPI block core definitions (vm unrelated)
4
5# QAPI common definitions
6{ 'include': 'common.json' }
1ad166b6
BC
7
8##
9# @SnapshotInfo
10#
11# @id: unique snapshot id
12#
13# @name: user chosen name
14#
15# @vm-state-size: size of the VM state
16#
17# @date-sec: UTC date of the snapshot in seconds
18#
19# @date-nsec: fractional part in nano seconds to be used with date-sec
20#
21# @vm-clock-sec: VM clock relative to boot in seconds
22#
23# @vm-clock-nsec: fractional part in nano seconds to be used with vm-clock-sec
24#
25# Since: 1.3
26#
27##
28
895a2a80 29{ 'struct': 'SnapshotInfo',
1ad166b6
BC
30 'data': { 'id': 'str', 'name': 'str', 'vm-state-size': 'int',
31 'date-sec': 'int', 'date-nsec': 'int',
32 'vm-clock-sec': 'int', 'vm-clock-nsec': 'int' } }
33
34##
35# @ImageInfoSpecificQCow2:
36#
37# @compat: compatibility level
38#
39# @lazy-refcounts: #optional on or off; only valid for compat >= 1.1
40#
9009b196
HR
41# @corrupt: #optional true if the image has been marked corrupt; only valid for
42# compat >= 1.1 (since 2.2)
43#
0709c5a1
HR
44# @refcount-bits: width of a refcount entry in bits (since 2.3)
45#
1ad166b6
BC
46# Since: 1.7
47##
895a2a80 48{ 'struct': 'ImageInfoSpecificQCow2',
1ad166b6
BC
49 'data': {
50 'compat': 'str',
9009b196 51 '*lazy-refcounts': 'bool',
0709c5a1
HR
52 '*corrupt': 'bool',
53 'refcount-bits': 'int'
1ad166b6
BC
54 } }
55
56##
57# @ImageInfoSpecificVmdk:
58#
59# @create-type: The create type of VMDK image
60#
61# @cid: Content id of image
62#
63# @parent-cid: Parent VMDK image's cid
64#
65# @extents: List of extent files
66#
67# Since: 1.7
68##
895a2a80 69{ 'struct': 'ImageInfoSpecificVmdk',
1ad166b6
BC
70 'data': {
71 'create-type': 'str',
72 'cid': 'int',
73 'parent-cid': 'int',
74 'extents': ['ImageInfo']
75 } }
76
77##
78# @ImageInfoSpecific:
79#
80# A discriminated record of image format specific information structures.
81#
82# Since: 1.7
83##
84
85{ 'union': 'ImageInfoSpecific',
86 'data': {
87 'qcow2': 'ImageInfoSpecificQCow2',
c7c4cf49
DB
88 'vmdk': 'ImageInfoSpecificVmdk',
89 # If we need to add block driver specific parameters for
90 # LUKS in future, then we'll subclass QCryptoBlockInfoLUKS
91 # to define a ImageInfoSpecificLUKS
92 'luks': 'QCryptoBlockInfoLUKS'
1ad166b6
BC
93 } }
94
95##
96# @ImageInfo:
97#
98# Information about a QEMU image file
99#
100# @filename: name of the image file
101#
102# @format: format of the image file
103#
104# @virtual-size: maximum capacity in bytes of the image
105#
106# @actual-size: #optional actual size on disk in bytes of the image
107#
108# @dirty-flag: #optional true if image is not cleanly closed
109#
110# @cluster-size: #optional size of a cluster in bytes
111#
112# @encrypted: #optional true if the image is encrypted
113#
114# @compressed: #optional true if the image is compressed (Since 1.7)
115#
116# @backing-filename: #optional name of the backing file
117#
118# @full-backing-filename: #optional full path of the backing file
119#
120# @backing-filename-format: #optional the format of the backing file
121#
122# @snapshots: #optional list of VM snapshots
123#
124# @backing-image: #optional info of the backing image (since 1.6)
125#
126# @format-specific: #optional structure supplying additional format-specific
127# information (since 1.7)
128#
129# Since: 1.3
130#
131##
132
895a2a80 133{ 'struct': 'ImageInfo',
1ad166b6
BC
134 'data': {'filename': 'str', 'format': 'str', '*dirty-flag': 'bool',
135 '*actual-size': 'int', 'virtual-size': 'int',
136 '*cluster-size': 'int', '*encrypted': 'bool', '*compressed': 'bool',
137 '*backing-filename': 'str', '*full-backing-filename': 'str',
138 '*backing-filename-format': 'str', '*snapshots': ['SnapshotInfo'],
139 '*backing-image': 'ImageInfo',
24bf10da 140 '*format-specific': 'ImageInfoSpecific' } }
1ad166b6
BC
141
142##
143# @ImageCheck:
144#
145# Information about a QEMU image file check
146#
147# @filename: name of the image file checked
148#
149# @format: format of the image file checked
150#
151# @check-errors: number of unexpected errors occurred during check
152#
153# @image-end-offset: #optional offset (in bytes) where the image ends, this
154# field is present if the driver for the image format
155# supports it
156#
157# @corruptions: #optional number of corruptions found during the check if any
158#
159# @leaks: #optional number of leaks found during the check if any
160#
161# @corruptions-fixed: #optional number of corruptions fixed during the check
162# if any
163#
164# @leaks-fixed: #optional number of leaks fixed during the check if any
165#
166# @total-clusters: #optional total number of clusters, this field is present
167# if the driver for the image format supports it
168#
169# @allocated-clusters: #optional total number of allocated clusters, this
170# field is present if the driver for the image format
171# supports it
172#
173# @fragmented-clusters: #optional total number of fragmented clusters, this
174# field is present if the driver for the image format
175# supports it
176#
177# @compressed-clusters: #optional total number of compressed clusters, this
178# field is present if the driver for the image format
179# supports it
180#
181# Since: 1.4
182#
183##
184
895a2a80 185{ 'struct': 'ImageCheck',
1ad166b6
BC
186 'data': {'filename': 'str', 'format': 'str', 'check-errors': 'int',
187 '*image-end-offset': 'int', '*corruptions': 'int', '*leaks': 'int',
188 '*corruptions-fixed': 'int', '*leaks-fixed': 'int',
189 '*total-clusters': 'int', '*allocated-clusters': 'int',
190 '*fragmented-clusters': 'int', '*compressed-clusters': 'int' } }
191
16b0d555
FZ
192##
193# @MapEntry:
194#
195# Mapping information from a virtual block range to a host file range
196#
197# @start: the start byte of the mapped virtual range
198#
199# @length: the number of bytes of the mapped virtual range
200#
201# @data: whether the mapped range has data
202#
203# @zero: whether the virtual blocks are zeroed
204#
205# @depth: the depth of the mapping
206#
207# @offset: #optional the offset in file that the virtual sectors are mapped to
208#
209# @filename: #optional filename that is referred to by @offset
210#
211# Since: 2.6
212#
213##
214{ 'struct': 'MapEntry',
215 'data': {'start': 'int', 'length': 'int', 'data': 'bool',
216 'zero': 'bool', 'depth': 'int', '*offset': 'int',
217 '*filename': 'str' } }
218
9e193c5a
KW
219##
220# @BlockdevCacheInfo
221#
222# Cache mode information for a block device
223#
224# @writeback: true if writeback mode is enabled
225# @direct: true if the host page cache is bypassed (O_DIRECT)
226# @no-flush: true if flush requests are ignored for the device
227#
228# Since: 2.3
229##
895a2a80 230{ 'struct': 'BlockdevCacheInfo',
9e193c5a
KW
231 'data': { 'writeback': 'bool',
232 'direct': 'bool',
233 'no-flush': 'bool' } }
234
1ad166b6
BC
235##
236# @BlockDeviceInfo:
237#
238# Information about the backing device for a block device.
239#
240# @file: the filename of the backing device
241#
242# @node-name: #optional the name of the block driver node (Since 2.0)
243#
244# @ro: true if the backing device was open read-only
245#
246# @drv: the name of the block format used to open the backing device. As of
247# 0.14.0 this can be: 'blkdebug', 'bochs', 'cloop', 'cow', 'dmg',
248# 'file', 'file', 'ftp', 'ftps', 'host_cdrom', 'host_device',
78368575 249# 'http', 'https', 'luks', 'nbd', 'parallels', 'qcow',
1ad166b6 250# 'qcow2', 'raw', 'tftp', 'vdi', 'vmdk', 'vpc', 'vvfat'
550830f9 251# 2.2: 'archipelago' added, 'cow' dropped
92a539d2 252# 2.3: 'host_floppy' deprecated
f709623b 253# 2.5: 'host_floppy' dropped
78368575 254# 2.6: 'luks' added
82ac5543 255# 2.8: 'replication' added
1ad166b6
BC
256#
257# @backing_file: #optional the name of the backing file (for copy-on-write)
258#
259# @backing_file_depth: number of files in the backing file chain (since: 1.2)
260#
261# @encrypted: true if the backing device is encrypted
262#
263# @encryption_key_missing: true if the backing device is encrypted but an
264# valid encryption key is missing
265#
266# @detect_zeroes: detect and optimize zero writes (Since 2.1)
267#
268# @bps: total throughput limit in bytes per second is specified
269#
270# @bps_rd: read throughput limit in bytes per second is specified
271#
272# @bps_wr: write throughput limit in bytes per second is specified
273#
274# @iops: total I/O operations per second is specified
275#
276# @iops_rd: read I/O operations per second is specified
277#
278# @iops_wr: write I/O operations per second is specified
279#
280# @image: the info of image used (since: 1.6)
281#
398befdf
AG
282# @bps_max: #optional total throughput limit during bursts,
283# in bytes (Since 1.7)
1ad166b6 284#
398befdf
AG
285# @bps_rd_max: #optional read throughput limit during bursts,
286# in bytes (Since 1.7)
1ad166b6 287#
398befdf
AG
288# @bps_wr_max: #optional write throughput limit during bursts,
289# in bytes (Since 1.7)
1ad166b6 290#
398befdf
AG
291# @iops_max: #optional total I/O operations per second during bursts,
292# in bytes (Since 1.7)
1ad166b6 293#
398befdf
AG
294# @iops_rd_max: #optional read I/O operations per second during bursts,
295# in bytes (Since 1.7)
1ad166b6 296#
398befdf
AG
297# @iops_wr_max: #optional write I/O operations per second during bursts,
298# in bytes (Since 1.7)
299#
300# @bps_max_length: #optional maximum length of the @bps_max burst
301# period, in seconds. (Since 2.6)
302#
303# @bps_rd_max_length: #optional maximum length of the @bps_rd_max
304# burst period, in seconds. (Since 2.6)
305#
306# @bps_wr_max_length: #optional maximum length of the @bps_wr_max
307# burst period, in seconds. (Since 2.6)
308#
309# @iops_max_length: #optional maximum length of the @iops burst
310# period, in seconds. (Since 2.6)
311#
312# @iops_rd_max_length: #optional maximum length of the @iops_rd_max
313# burst period, in seconds. (Since 2.6)
314#
315# @iops_wr_max_length: #optional maximum length of the @iops_wr_max
316# burst period, in seconds. (Since 2.6)
1ad166b6
BC
317#
318# @iops_size: #optional an I/O size in bytes (Since 1.7)
319#
b8fe1694
AG
320# @group: #optional throttle group name (Since 2.4)
321#
9e193c5a
KW
322# @cache: the cache mode used for the block device (since: 2.3)
323#
e2462113
FR
324# @write_threshold: configured write threshold for the device.
325# 0 if disabled. (Since 2.3)
326#
1ad166b6
BC
327# Since: 0.14.0
328#
329##
895a2a80 330{ 'struct': 'BlockDeviceInfo',
1ad166b6
BC
331 'data': { 'file': 'str', '*node-name': 'str', 'ro': 'bool', 'drv': 'str',
332 '*backing_file': 'str', 'backing_file_depth': 'int',
333 'encrypted': 'bool', 'encryption_key_missing': 'bool',
334 'detect_zeroes': 'BlockdevDetectZeroesOptions',
335 'bps': 'int', 'bps_rd': 'int', 'bps_wr': 'int',
336 'iops': 'int', 'iops_rd': 'int', 'iops_wr': 'int',
337 'image': 'ImageInfo',
338 '*bps_max': 'int', '*bps_rd_max': 'int',
339 '*bps_wr_max': 'int', '*iops_max': 'int',
340 '*iops_rd_max': 'int', '*iops_wr_max': 'int',
398befdf
AG
341 '*bps_max_length': 'int', '*bps_rd_max_length': 'int',
342 '*bps_wr_max_length': 'int', '*iops_max_length': 'int',
343 '*iops_rd_max_length': 'int', '*iops_wr_max_length': 'int',
b8fe1694 344 '*iops_size': 'int', '*group': 'str', 'cache': 'BlockdevCacheInfo',
e2462113 345 'write_threshold': 'int' } }
1ad166b6
BC
346
347##
348# @BlockDeviceIoStatus:
349#
350# An enumeration of block device I/O status.
351#
352# @ok: The last I/O operation has succeeded
353#
354# @failed: The last I/O operation has failed
355#
356# @nospace: The last I/O operation has failed due to a no-space condition
357#
358# Since: 1.0
359##
360{ 'enum': 'BlockDeviceIoStatus', 'data': [ 'ok', 'failed', 'nospace' ] }
361
362##
363# @BlockDeviceMapEntry:
364#
365# Entry in the metadata map of the device (returned by "qemu-img map")
366#
367# @start: Offset in the image of the first byte described by this entry
368# (in bytes)
369#
370# @length: Length of the range described by this entry (in bytes)
371#
372# @depth: Number of layers (0 = top image, 1 = top image's backing file, etc.)
373# before reaching one for which the range is allocated. The value is
374# in the range 0 to the depth of the image chain - 1.
375#
376# @zero: the sectors in this range read as zeros
377#
378# @data: reading the image will actually read data from a file (in particular,
379# if @offset is present this means that the sectors are not simply
380# preallocated, but contain actual data in raw format)
381#
382# @offset: if present, the image file stores the data for this range in
383# raw format at the given offset.
384#
385# Since 1.7
386##
895a2a80 387{ 'struct': 'BlockDeviceMapEntry',
1ad166b6
BC
388 'data': { 'start': 'int', 'length': 'int', 'depth': 'int', 'zero': 'bool',
389 'data': 'bool', '*offset': 'int' } }
390
9abe3bdc
JS
391##
392# @DirtyBitmapStatus:
393#
394# An enumeration of possible states that a dirty bitmap can report to the user.
395#
396# @frozen: The bitmap is currently in-use by a backup operation or block job,
397# and is immutable.
398#
399# @disabled: The bitmap is currently in-use by an internal operation and is
400# read-only. It can still be deleted.
401#
402# @active: The bitmap is actively monitoring for new writes, and can be cleared,
403# deleted, or used for backup operations.
404#
405# Since: 2.4
406##
407{ 'enum': 'DirtyBitmapStatus',
408 'data': ['active', 'disabled', 'frozen'] }
409
1ad166b6
BC
410##
411# @BlockDirtyInfo:
412#
413# Block dirty bitmap information.
414#
0db6e54a
FZ
415# @name: #optional the name of the dirty bitmap (Since 2.4)
416#
1ad166b6
BC
417# @count: number of dirty bytes according to the dirty bitmap
418#
419# @granularity: granularity of the dirty bitmap in bytes (since 1.4)
420#
9abe3bdc 421# @status: current status of the dirty bitmap (since 2.4)
a113534f 422#
1ad166b6
BC
423# Since: 1.3
424##
895a2a80 425{ 'struct': 'BlockDirtyInfo',
a113534f 426 'data': {'*name': 'str', 'count': 'int', 'granularity': 'uint32',
9abe3bdc 427 'status': 'DirtyBitmapStatus'} }
1ad166b6
BC
428
429##
430# @BlockInfo:
431#
432# Block device information. This structure describes a virtual device and
433# the backing device associated with it.
434#
435# @device: The device name associated with the virtual device.
436#
437# @type: This field is returned only for compatibility reasons, it should
438# not be used (always returns 'unknown')
439#
440# @removable: True if the device supports removable media.
441#
442# @locked: True if the guest has locked this device from having its media
443# removed
444#
327032ce
HR
445# @tray_open: #optional True if the device's tray is open
446# (only present if it has a tray)
1ad166b6
BC
447#
448# @dirty-bitmaps: #optional dirty bitmaps information (only present if the
449# driver has one or more dirty bitmaps) (Since 2.0)
450#
451# @io-status: #optional @BlockDeviceIoStatus. Only present if the device
452# supports it and the VM is configured to stop on errors
c7c2ff0c 453# (supported device models: virtio-blk, ide, scsi-disk)
1ad166b6
BC
454#
455# @inserted: #optional @BlockDeviceInfo describing the device if media is
456# present
457#
458# Since: 0.14.0
459##
895a2a80 460{ 'struct': 'BlockInfo',
1ad166b6
BC
461 'data': {'device': 'str', 'type': 'str', 'removable': 'bool',
462 'locked': 'bool', '*inserted': 'BlockDeviceInfo',
463 '*tray_open': 'bool', '*io-status': 'BlockDeviceIoStatus',
464 '*dirty-bitmaps': ['BlockDirtyInfo'] } }
465
466##
467# @query-block:
468#
469# Get a list of BlockInfo for all virtual block devices.
470#
471# Returns: a list of @BlockInfo describing each virtual block device
472#
473# Since: 0.14.0
474##
475{ 'command': 'query-block', 'returns': ['BlockInfo'] }
476
979e9b03
AG
477
478##
479# @BlockDeviceTimedStats:
480#
481# Statistics of a block device during a given interval of time.
482#
483# @interval_length: Interval used for calculating the statistics,
484# in seconds.
485#
486# @min_rd_latency_ns: Minimum latency of read operations in the
487# defined interval, in nanoseconds.
488#
489# @min_wr_latency_ns: Minimum latency of write operations in the
490# defined interval, in nanoseconds.
491#
492# @min_flush_latency_ns: Minimum latency of flush operations in the
493# defined interval, in nanoseconds.
494#
495# @max_rd_latency_ns: Maximum latency of read operations in the
496# defined interval, in nanoseconds.
497#
498# @max_wr_latency_ns: Maximum latency of write operations in the
499# defined interval, in nanoseconds.
500#
501# @max_flush_latency_ns: Maximum latency of flush operations in the
502# defined interval, in nanoseconds.
503#
504# @avg_rd_latency_ns: Average latency of read operations in the
505# defined interval, in nanoseconds.
506#
507# @avg_wr_latency_ns: Average latency of write operations in the
508# defined interval, in nanoseconds.
509#
510# @avg_flush_latency_ns: Average latency of flush operations in the
511# defined interval, in nanoseconds.
512#
96e4deda
AG
513# @avg_rd_queue_depth: Average number of pending read operations
514# in the defined interval.
515#
516# @avg_wr_queue_depth: Average number of pending write operations
517# in the defined interval.
518#
979e9b03
AG
519# Since: 2.5
520##
521
522{ 'struct': 'BlockDeviceTimedStats',
523 'data': { 'interval_length': 'int', 'min_rd_latency_ns': 'int',
524 'max_rd_latency_ns': 'int', 'avg_rd_latency_ns': 'int',
525 'min_wr_latency_ns': 'int', 'max_wr_latency_ns': 'int',
526 'avg_wr_latency_ns': 'int', 'min_flush_latency_ns': 'int',
96e4deda
AG
527 'max_flush_latency_ns': 'int', 'avg_flush_latency_ns': 'int',
528 'avg_rd_queue_depth': 'number', 'avg_wr_queue_depth': 'number' } }
979e9b03 529
1ad166b6
BC
530##
531# @BlockDeviceStats:
532#
533# Statistics of a virtual block device or a block backing device.
534#
535# @rd_bytes: The number of bytes read by the device.
536#
537# @wr_bytes: The number of bytes written by the device.
538#
539# @rd_operations: The number of read operations performed by the device.
540#
541# @wr_operations: The number of write operations performed by the device.
542#
543# @flush_operations: The number of cache flush operations performed by the
544# device (since 0.15.0)
545#
546# @flush_total_time_ns: Total time spend on cache flushes in nano-seconds
547# (since 0.15.0).
548#
549# @wr_total_time_ns: Total time spend on writes in nano-seconds (since 0.15.0).
550#
551# @rd_total_time_ns: Total_time_spend on reads in nano-seconds (since 0.15.0).
552#
553# @wr_highest_offset: The offset after the greatest byte written to the
554# device. The intended use of this information is for
555# growable sparse files (like qcow2) that are used on top
556# of a physical device.
557#
f4564d53
PL
558# @rd_merged: Number of read requests that have been merged into another
559# request (Since 2.3).
560#
561# @wr_merged: Number of write requests that have been merged into another
562# request (Since 2.3).
563#
cb38fffb
AG
564# @idle_time_ns: #optional Time since the last I/O operation, in
565# nanoseconds. If the field is absent it means that
566# there haven't been any operations yet (Since 2.5).
567#
7ee12daf
AG
568# @failed_rd_operations: The number of failed read operations
569# performed by the device (Since 2.5)
570#
571# @failed_wr_operations: The number of failed write operations
572# performed by the device (Since 2.5)
573#
574# @failed_flush_operations: The number of failed flush operations
575# performed by the device (Since 2.5)
576#
577# @invalid_rd_operations: The number of invalid read operations
578# performed by the device (Since 2.5)
579#
580# @invalid_wr_operations: The number of invalid write operations
581# performed by the device (Since 2.5)
582#
583# @invalid_flush_operations: The number of invalid flush operations
584# performed by the device (Since 2.5)
585#
362e9299
AG
586# @account_invalid: Whether invalid operations are included in the
587# last access statistics (Since 2.5)
588#
589# @account_failed: Whether failed operations are included in the
590# latency and last access statistics (Since 2.5)
591#
979e9b03
AG
592# @timed_stats: Statistics specific to the set of previously defined
593# intervals of time (Since 2.5)
594#
1ad166b6
BC
595# Since: 0.14.0
596##
895a2a80 597{ 'struct': 'BlockDeviceStats',
1ad166b6
BC
598 'data': {'rd_bytes': 'int', 'wr_bytes': 'int', 'rd_operations': 'int',
599 'wr_operations': 'int', 'flush_operations': 'int',
600 'flush_total_time_ns': 'int', 'wr_total_time_ns': 'int',
f4564d53 601 'rd_total_time_ns': 'int', 'wr_highest_offset': 'int',
7ee12daf
AG
602 'rd_merged': 'int', 'wr_merged': 'int', '*idle_time_ns': 'int',
603 'failed_rd_operations': 'int', 'failed_wr_operations': 'int',
604 'failed_flush_operations': 'int', 'invalid_rd_operations': 'int',
362e9299 605 'invalid_wr_operations': 'int', 'invalid_flush_operations': 'int',
979e9b03
AG
606 'account_invalid': 'bool', 'account_failed': 'bool',
607 'timed_stats': ['BlockDeviceTimedStats'] } }
1ad166b6
BC
608
609##
610# @BlockStats:
611#
612# Statistics of a virtual block device or a block backing device.
613#
614# @device: #optional If the stats are for a virtual block device, the name
615# corresponding to the virtual block device.
616#
a06e4355 617# @node-name: #optional The node name of the device. (Since 2.3)
4875a779 618#
1ad166b6
BC
619# @stats: A @BlockDeviceStats for the device.
620#
621# @parent: #optional This describes the file block device if it has one.
622#
623# @backing: #optional This describes the backing block device if it has one.
624# (Since 2.0)
625#
626# Since: 0.14.0
627##
895a2a80 628{ 'struct': 'BlockStats',
4875a779
FZ
629 'data': {'*device': 'str', '*node-name': 'str',
630 'stats': 'BlockDeviceStats',
1ad166b6
BC
631 '*parent': 'BlockStats',
632 '*backing': 'BlockStats'} }
633
634##
635# @query-blockstats:
636#
637# Query the @BlockStats for all virtual block devices.
638#
f71eaa74
FZ
639# @query-nodes: #optional If true, the command will query all the block nodes
640# that have a node name, in a list which will include "parent"
641# information, but not "backing".
642# If false or omitted, the behavior is as before - query all the
643# device backends, recursively including their "parent" and
644# "backing". (Since 2.3)
645#
1ad166b6
BC
646# Returns: A list of @BlockStats for each virtual block devices.
647#
648# Since: 0.14.0
649##
f71eaa74
FZ
650{ 'command': 'query-blockstats',
651 'data': { '*query-nodes': 'bool' },
652 'returns': ['BlockStats'] }
1ad166b6
BC
653
654##
655# @BlockdevOnError:
656#
657# An enumeration of possible behaviors for errors on I/O operations.
658# The exact meaning depends on whether the I/O was initiated by a guest
659# or by a block job
660#
661# @report: for guest operations, report the error to the guest;
662# for jobs, cancel the job
663#
664# @ignore: ignore the error, only report a QMP event (BLOCK_IO_ERROR
665# or BLOCK_JOB_ERROR)
666#
667# @enospc: same as @stop on ENOSPC, same as @report otherwise.
668#
669# @stop: for guest operations, stop the virtual machine;
670# for jobs, pause the job
671#
8c398252
KW
672# @auto: inherit the error handling policy of the backend (since: 2.7)
673#
1ad166b6
BC
674# Since: 1.3
675##
676{ 'enum': 'BlockdevOnError',
8c398252 677 'data': ['report', 'ignore', 'enospc', 'stop', 'auto'] }
1ad166b6
BC
678
679##
680# @MirrorSyncMode:
681#
682# An enumeration of possible behaviors for the initial synchronization
683# phase of storage mirroring.
684#
685# @top: copies data in the topmost image to the destination
686#
687# @full: copies data from all images to the destination
688#
689# @none: only copy data written from now on
690#
4b80ab2b 691# @incremental: only copy data described by the dirty bitmap. Since: 2.4
d58d8453 692#
1ad166b6
BC
693# Since: 1.3
694##
695{ 'enum': 'MirrorSyncMode',
4b80ab2b 696 'data': ['top', 'full', 'none', 'incremental'] }
1ad166b6
BC
697
698##
699# @BlockJobType:
700#
701# Type of a block job.
702#
703# @commit: block commit job type, see "block-commit"
704#
705# @stream: block stream job type, see "block-stream"
706#
707# @mirror: drive mirror job type, see "drive-mirror"
708#
709# @backup: drive backup job type, see "drive-backup"
710#
711# Since: 1.7
712##
713{ 'enum': 'BlockJobType',
714 'data': ['commit', 'stream', 'mirror', 'backup'] }
715
716##
717# @BlockJobInfo:
718#
719# Information about a long-running block device operation.
720#
721# @type: the job type ('stream' for image streaming)
722#
6aae5be6
AG
723# @device: The job identifier. Originally the device name but other
724# values are allowed since QEMU 2.7
1ad166b6
BC
725#
726# @len: the maximum progress value
727#
728# @busy: false if the job is known to be in a quiescent state, with
729# no pending I/O. Since 1.3.
730#
731# @paused: whether the job is paused or, if @busy is true, will
732# pause itself as soon as possible. Since 1.3.
733#
734# @offset: the current progress value
735#
736# @speed: the rate limit, bytes per second
737#
738# @io-status: the status of the job (since 1.3)
739#
ef6dbf1e
HR
740# @ready: true if the job may be completed (since 2.2)
741#
1ad166b6
BC
742# Since: 1.1
743##
895a2a80 744{ 'struct': 'BlockJobInfo',
1ad166b6
BC
745 'data': {'type': 'str', 'device': 'str', 'len': 'int',
746 'offset': 'int', 'busy': 'bool', 'paused': 'bool', 'speed': 'int',
ef6dbf1e 747 'io-status': 'BlockDeviceIoStatus', 'ready': 'bool'} }
1ad166b6
BC
748
749##
750# @query-block-jobs:
751#
752# Return information about long-running block device operations.
753#
754# Returns: a list of @BlockJobInfo for each active block job
755#
756# Since: 1.1
757##
758{ 'command': 'query-block-jobs', 'returns': ['BlockJobInfo'] }
759
760##
761# @block_passwd:
762#
763# This command sets the password of a block device that has not been open
764# with a password and requires one.
765#
766# The two cases where this can happen are a block device is created through
767# QEMU's initial command line or a block device is changed through the legacy
768# @change interface.
769#
770# In the event that the block device is created through the initial command
771# line, the VM will start in the stopped state regardless of whether '-S' is
772# used. The intention is for a management tool to query the block devices to
773# determine which ones are encrypted, set the passwords with this command, and
774# then start the guest with the @cont command.
775#
776# Either @device or @node-name must be set but not both.
777#
778# @device: #optional the name of the block backend device to set the password on
779#
780# @node-name: #optional graph node name to set the password on (Since 2.0)
781#
782# @password: the password to use for the device
783#
784# Returns: nothing on success
785# If @device is not a valid block device, DeviceNotFound
786# If @device is not encrypted, DeviceNotEncrypted
787#
788# Notes: Not all block formats support encryption and some that do are not
789# able to validate that a password is correct. Disk corruption may
790# occur if an invalid password is specified.
791#
792# Since: 0.14.0
793##
794{ 'command': 'block_passwd', 'data': {'*device': 'str',
795 '*node-name': 'str', 'password': 'str'} }
796
797##
798# @block_resize
799#
800# Resize a block image while a guest is running.
801#
802# Either @device or @node-name must be set but not both.
803#
804# @device: #optional the name of the device to get the image resized
805#
806# @node-name: #optional graph node name to get the image resized (Since 2.0)
807#
808# @size: new image size in bytes
809#
810# Returns: nothing on success
811# If @device is not a valid block device, DeviceNotFound
812#
813# Since: 0.14.0
814##
815{ 'command': 'block_resize', 'data': { '*device': 'str',
816 '*node-name': 'str',
817 'size': 'int' }}
818
819##
820# @NewImageMode
821#
822# An enumeration that tells QEMU how to set the backing file path in
823# a new image file.
824#
825# @existing: QEMU should look for an existing image file.
826#
827# @absolute-paths: QEMU should create a new image with absolute paths
828# for the backing file. If there is no backing file available, the new
829# image will not be backed either.
830#
831# Since: 1.1
832##
833{ 'enum': 'NewImageMode',
834 'data': [ 'existing', 'absolute-paths' ] }
835
836##
a911e6ae 837# @BlockdevSnapshotSync
1ad166b6
BC
838#
839# Either @device or @node-name must be set but not both.
840#
841# @device: #optional the name of the device to generate the snapshot from.
842#
843# @node-name: #optional graph node name to generate the snapshot from (Since 2.0)
844#
845# @snapshot-file: the target of the new image. A new file will be created.
846#
847# @snapshot-node-name: #optional the graph node name of the new image (Since 2.0)
848#
849# @format: #optional the format of the snapshot image, default is 'qcow2'.
850#
851# @mode: #optional whether and how QEMU should create a new image, default is
852# 'absolute-paths'.
853##
a911e6ae 854{ 'struct': 'BlockdevSnapshotSync',
1ad166b6
BC
855 'data': { '*device': 'str', '*node-name': 'str',
856 'snapshot-file': 'str', '*snapshot-node-name': 'str',
857 '*format': 'str', '*mode': 'NewImageMode' } }
858
43de7e2d
AG
859##
860# @BlockdevSnapshot
861#
862# @node: device or node name that will have a snapshot created.
863#
864# @overlay: reference to the existing block device that will become
865# the overlay of @node, as part of creating the snapshot.
866# It must not have a current backing file (this can be
867# achieved by passing "backing": "" to blockdev-add).
868#
869# Since 2.5
870##
871{ 'struct': 'BlockdevSnapshot',
872 'data': { 'node': 'str', 'overlay': 'str' } }
873
1ad166b6
BC
874##
875# @DriveBackup
876#
70559d49
AG
877# @job-id: #optional identifier for the newly-created block job. If
878# omitted, the device name will be used. (Since 2.7)
879#
b7e4fa22 880# @device: the device name or node-name of a root node which should be copied.
1ad166b6
BC
881#
882# @target: the target of the new image. If the file exists, or if it
883# is a device, the existing file/device will be used as the new
884# destination. If it does not exist, a new file will be created.
885#
886# @format: #optional the format of the new destination, default is to
887# probe if @mode is 'existing', else the format of the source
888#
889# @sync: what parts of the disk image should be copied to the destination
d58d8453
JS
890# (all the disk, only the sectors allocated in the topmost image, from a
891# dirty bitmap, or only new I/O).
1ad166b6
BC
892#
893# @mode: #optional whether and how QEMU should create a new image, default is
894# 'absolute-paths'.
895#
896# @speed: #optional the maximum speed, in bytes per second
897#
4b80ab2b
JS
898# @bitmap: #optional the name of dirty bitmap if sync is "incremental".
899# Must be present if sync is "incremental", must NOT be present
d58d8453
JS
900# otherwise. (Since 2.4)
901#
13b9414b 902# @compress: #optional true to compress data, if the target format supports it.
6bed0280 903# (default: false) (since 2.8)
13b9414b 904#
1ad166b6
BC
905# @on-source-error: #optional the action to take on an error on the source,
906# default 'report'. 'stop' and 'enospc' can only be used
907# if the block device supports io-status (see BlockInfo).
908#
909# @on-target-error: #optional the action to take on an error on the target,
910# default 'report' (no limitations, since this applies to
911# a different block device than @device).
912#
913# Note that @on-source-error and @on-target-error only affect background I/O.
914# If an error occurs during a guest write request, the device's rerror/werror
915# actions will be used.
916#
917# Since: 1.6
918##
895a2a80 919{ 'struct': 'DriveBackup',
70559d49
AG
920 'data': { '*job-id': 'str', 'device': 'str', 'target': 'str',
921 '*format': 'str', 'sync': 'MirrorSyncMode', '*mode': 'NewImageMode',
13b9414b 922 '*speed': 'int', '*bitmap': 'str', '*compress': 'bool',
1ad166b6
BC
923 '*on-source-error': 'BlockdevOnError',
924 '*on-target-error': 'BlockdevOnError' } }
925
c29c1dd3
FZ
926##
927# @BlockdevBackup
928#
70559d49
AG
929# @job-id: #optional identifier for the newly-created block job. If
930# omitted, the device name will be used. (Since 2.7)
931#
cef34eeb 932# @device: the device name or node-name of a root node which should be copied.
c29c1dd3 933#
39d990ac 934# @target: the device name or node-name of the backup target node.
c29c1dd3
FZ
935#
936# @sync: what parts of the disk image should be copied to the destination
937# (all the disk, only the sectors allocated in the topmost image, or
938# only new I/O).
939#
940# @speed: #optional the maximum speed, in bytes per second. The default is 0,
941# for unlimited.
942#
3b7b1236 943# @compress: #optional true to compress data, if the target format supports it.
6bed0280 944# (default: false) (since 2.8)
3b7b1236 945#
c29c1dd3
FZ
946# @on-source-error: #optional the action to take on an error on the source,
947# default 'report'. 'stop' and 'enospc' can only be used
948# if the block device supports io-status (see BlockInfo).
949#
950# @on-target-error: #optional the action to take on an error on the target,
951# default 'report' (no limitations, since this applies to
952# a different block device than @device).
953#
954# Note that @on-source-error and @on-target-error only affect background I/O.
955# If an error occurs during a guest write request, the device's rerror/werror
956# actions will be used.
957#
958# Since: 2.3
959##
895a2a80 960{ 'struct': 'BlockdevBackup',
70559d49 961 'data': { '*job-id': 'str', 'device': 'str', 'target': 'str',
c29c1dd3
FZ
962 'sync': 'MirrorSyncMode',
963 '*speed': 'int',
3b7b1236 964 '*compress': 'bool',
c29c1dd3
FZ
965 '*on-source-error': 'BlockdevOnError',
966 '*on-target-error': 'BlockdevOnError' } }
967
1ad166b6
BC
968##
969# @blockdev-snapshot-sync
970#
971# Generates a synchronous snapshot of a block device.
972#
a911e6ae 973# For the arguments, see the documentation of BlockdevSnapshotSync.
1ad166b6
BC
974#
975# Returns: nothing on success
976# If @device is not a valid block device, DeviceNotFound
977#
978# Since 0.14.0
979##
980{ 'command': 'blockdev-snapshot-sync',
a911e6ae 981 'data': 'BlockdevSnapshotSync' }
1ad166b6 982
43de7e2d
AG
983
984##
985# @blockdev-snapshot
986#
987# Generates a snapshot of a block device.
988#
989# For the arguments, see the documentation of BlockdevSnapshot.
990#
991# Since 2.5
992##
993{ 'command': 'blockdev-snapshot',
994 'data': 'BlockdevSnapshot' }
995
fa40e656
JC
996##
997# @change-backing-file
998#
999# Change the backing file in the image file metadata. This does not
1000# cause QEMU to reopen the image file to reparse the backing filename
1001# (it may, however, perform a reopen to change permissions from
1002# r/o -> r/w -> r/o, if needed). The new backing file string is written
1003# into the image file metadata, and the QEMU internal strings are
1004# updated.
1005#
1006# @image-node-name: The name of the block driver state node of the
1007# image to modify.
1008#
7b5dca3f
KW
1009# @device: The device name or node-name of the root node that owns
1010# image-node-name.
fa40e656
JC
1011#
1012# @backing-file: The string to write as the backing file. This
1013# string is not validated, so care should be taken
1014# when specifying the string or the image chain may
1015# not be able to be reopened again.
1016#
1017# Since: 2.1
1018##
1019{ 'command': 'change-backing-file',
1020 'data': { 'device': 'str', 'image-node-name': 'str',
1021 'backing-file': 'str' } }
1022
1ad166b6
BC
1023##
1024# @block-commit
1025#
1026# Live commit of data from overlay image nodes into backing nodes - i.e.,
1027# writes data between 'top' and 'base' into 'base'.
1028#
fd62c609
AG
1029# @job-id: #optional identifier for the newly-created block job. If
1030# omitted, the device name will be used. (Since 2.7)
1031#
1d13b167 1032# @device: the device name or node-name of a root node
1ad166b6
BC
1033#
1034# @base: #optional The file name of the backing image to write data into.
1035# If not specified, this is the deepest backing image
1036#
7676e2c5
JC
1037# @top: #optional The file name of the backing image within the image chain,
1038# which contains the topmost data to be committed down. If
1039# not specified, this is the active layer.
1ad166b6 1040#
54e26900
JC
1041# @backing-file: #optional The backing file string to write into the overlay
1042# image of 'top'. If 'top' is the active layer,
1043# specifying a backing file string is an error. This
1044# filename is not validated.
1045#
1046# If a pathname string is such that it cannot be
1047# resolved by QEMU, that means that subsequent QMP or
1048# HMP commands must use node-names for the image in
1049# question, as filename lookup methods will fail.
1050#
1051# If not specified, QEMU will automatically determine
1052# the backing file string to use, or error out if
1053# there is no obvious choice. Care should be taken
1054# when specifying the string, to specify a valid
1055# filename or protocol.
1056# (Since 2.1)
1057#
1ad166b6
BC
1058# If top == base, that is an error.
1059# If top == active, the job will not be completed by itself,
1060# user needs to complete the job with the block-job-complete
1061# command after getting the ready event. (Since 2.0)
1062#
1063# If the base image is smaller than top, then the base image
1064# will be resized to be the same size as top. If top is
1065# smaller than the base image, the base will not be
1066# truncated. If you want the base image size to match the
1067# size of the smaller top, you can safely truncate it
1068# yourself once the commit operation successfully completes.
1069#
1ad166b6
BC
1070# @speed: #optional the maximum speed, in bytes per second
1071#
1072# Returns: Nothing on success
1073# If commit or stream is already active on this device, DeviceInUse
1074# If @device does not exist, DeviceNotFound
1075# If image commit is not supported by this device, NotSupported
1076# If @base or @top is invalid, a generic error is returned
1077# If @speed is invalid, InvalidParameter
1078#
1079# Since: 1.3
1080#
1081##
1082{ 'command': 'block-commit',
fd62c609 1083 'data': { '*job-id': 'str', 'device': 'str', '*base': 'str', '*top': 'str',
54e26900 1084 '*backing-file': 'str', '*speed': 'int' } }
1ad166b6
BC
1085
1086##
1087# @drive-backup
1088#
1089# Start a point-in-time copy of a block device to a new destination. The
1090# status of ongoing drive-backup operations can be checked with
1091# query-block-jobs where the BlockJobInfo.type field has the value 'backup'.
1092# The operation can be stopped before it has completed using the
1093# block-job-cancel command.
1094#
1095# For the arguments, see the documentation of DriveBackup.
1096#
1097# Returns: nothing on success
b7e4fa22 1098# If @device is not a valid block device, GenericError
1ad166b6
BC
1099#
1100# Since 1.6
1101##
81206a89
PB
1102{ 'command': 'drive-backup', 'boxed': true,
1103 'data': 'DriveBackup' }
1ad166b6 1104
c29c1dd3
FZ
1105##
1106# @blockdev-backup
1107#
1108# Start a point-in-time copy of a block device to a new destination. The
1109# status of ongoing blockdev-backup operations can be checked with
1110# query-block-jobs where the BlockJobInfo.type field has the value 'backup'.
1111# The operation can be stopped before it has completed using the
1112# block-job-cancel command.
1113#
1114# For the arguments, see the documentation of BlockdevBackup.
1115#
dc7a4a9e
PB
1116# Returns: nothing on success
1117# If @device is not a valid block device, DeviceNotFound
1118#
c29c1dd3
FZ
1119# Since 2.3
1120##
dc7a4a9e
PB
1121{ 'command': 'blockdev-backup', 'boxed': true,
1122 'data': 'BlockdevBackup' }
c29c1dd3
FZ
1123
1124
1ad166b6
BC
1125##
1126# @query-named-block-nodes
1127#
1128# Get the named block driver list
1129#
1130# Returns: the list of BlockDeviceInfo
1131#
1132# Since 2.0
1133##
1134{ 'command': 'query-named-block-nodes', 'returns': [ 'BlockDeviceInfo' ] }
1135
1136##
1137# @drive-mirror
1138#
1139# Start mirroring a block device's writes to a new destination.
1140#
faecd40a
EB
1141# See DriveMirror for parameter descriptions
1142#
1143# Returns: nothing on success
0524e93a 1144# If @device is not a valid block device, GenericError
faecd40a
EB
1145#
1146# Since 1.3
1147##
1148{ 'command': 'drive-mirror', 'boxed': true,
1149 'data': 'DriveMirror' }
1150
1151##
1152# DriveMirror
1153#
1154# A set of parameters describing drive mirror setup.
1155#
71aa9867
AG
1156# @job-id: #optional identifier for the newly-created block job. If
1157# omitted, the device name will be used. (Since 2.7)
1158#
0524e93a
KW
1159# @device: the device name or node-name of a root node whose writes should be
1160# mirrored.
1ad166b6
BC
1161#
1162# @target: the target of the new image. If the file exists, or if it
1163# is a device, the existing file/device will be used as the new
1164# destination. If it does not exist, a new file will be created.
1165#
1166# @format: #optional the format of the new destination, default is to
1167# probe if @mode is 'existing', else the format of the source
1168#
4c828dc6
BC
1169# @node-name: #optional the new block driver state node name in the graph
1170# (Since 2.1)
1171#
09158f00
BC
1172# @replaces: #optional with sync=full graph node name to be replaced by the new
1173# image when a whole image copy is done. This can be used to repair
1174# broken Quorum files. (Since 2.1)
1175#
1ad166b6
BC
1176# @mode: #optional whether and how QEMU should create a new image, default is
1177# 'absolute-paths'.
1178#
1179# @speed: #optional the maximum speed, in bytes per second
1180#
1181# @sync: what parts of the disk image should be copied to the destination
1182# (all the disk, only the sectors allocated in the topmost image, or
1183# only new I/O).
1184#
1185# @granularity: #optional granularity of the dirty bitmap, default is 64K
1186# if the image format doesn't have clusters, 4K if the clusters
1187# are smaller than that, else the cluster size. Must be a
1188# power of 2 between 512 and 64M (since 1.4).
1189#
1190# @buf-size: #optional maximum amount of data in flight from source to
1191# target (since 1.4).
1192#
1193# @on-source-error: #optional the action to take on an error on the source,
1194# default 'report'. 'stop' and 'enospc' can only be used
1195# if the block device supports io-status (see BlockInfo).
1196#
1197# @on-target-error: #optional the action to take on an error on the target,
1198# default 'report' (no limitations, since this applies to
1199# a different block device than @device).
0fc9f8ea
FZ
1200# @unmap: #optional Whether to try to unmap target sectors where source has
1201# only zero. If true, and target unallocated sectors will read as zero,
1202# target image sectors will be unmapped; otherwise, zeroes will be
1203# written. Both will result in identical contents.
1204# Default is true. (Since 2.4)
1ad166b6 1205#
1ad166b6
BC
1206# Since 1.3
1207##
faecd40a 1208{ 'struct': 'DriveMirror',
71aa9867
AG
1209 'data': { '*job-id': 'str', 'device': 'str', 'target': 'str',
1210 '*format': 'str', '*node-name': 'str', '*replaces': 'str',
1ad166b6
BC
1211 'sync': 'MirrorSyncMode', '*mode': 'NewImageMode',
1212 '*speed': 'int', '*granularity': 'uint32',
1213 '*buf-size': 'int', '*on-source-error': 'BlockdevOnError',
0fc9f8ea
FZ
1214 '*on-target-error': 'BlockdevOnError',
1215 '*unmap': 'bool' } }
1ad166b6 1216
341ebc2f
JS
1217##
1218# @BlockDirtyBitmap
1219#
1220# @node: name of device/node which the bitmap is tracking
1221#
1222# @name: name of the dirty bitmap
1223#
1224# Since 2.4
1225##
895a2a80 1226{ 'struct': 'BlockDirtyBitmap',
341ebc2f
JS
1227 'data': { 'node': 'str', 'name': 'str' } }
1228
1229##
1230# @BlockDirtyBitmapAdd
1231#
1232# @node: name of device/node which the bitmap is tracking
1233#
1234# @name: name of the dirty bitmap
1235#
1236# @granularity: #optional the bitmap granularity, default is 64k for
1237# block-dirty-bitmap-add
1238#
1239# Since 2.4
1240##
895a2a80 1241{ 'struct': 'BlockDirtyBitmapAdd',
341ebc2f
JS
1242 'data': { 'node': 'str', 'name': 'str', '*granularity': 'uint32' } }
1243
1244##
1245# @block-dirty-bitmap-add
1246#
1247# Create a dirty bitmap with a name on the node
1248#
1249# Returns: nothing on success
1250# If @node is not a valid block device or node, DeviceNotFound
1251# If @name is already taken, GenericError with an explanation
1252#
1253# Since 2.4
1254##
1255{ 'command': 'block-dirty-bitmap-add',
1256 'data': 'BlockDirtyBitmapAdd' }
1257
1258##
1259# @block-dirty-bitmap-remove
1260#
1261# Remove a dirty bitmap on the node
1262#
1263# Returns: nothing on success
1264# If @node is not a valid block device or node, DeviceNotFound
1265# If @name is not found, GenericError with an explanation
9bd2b08f 1266# if @name is frozen by an operation, GenericError
341ebc2f
JS
1267#
1268# Since 2.4
1269##
1270{ 'command': 'block-dirty-bitmap-remove',
1271 'data': 'BlockDirtyBitmap' }
1272
e74e6b78
JS
1273##
1274# @block-dirty-bitmap-clear
1275#
1276# Clear (reset) a dirty bitmap on the device
1277#
1278# Returns: nothing on success
1279# If @node is not a valid block device, DeviceNotFound
1280# If @name is not found, GenericError with an explanation
1281#
1282# Since 2.4
1283##
1284{ 'command': 'block-dirty-bitmap-clear',
1285 'data': 'BlockDirtyBitmap' }
1286
df92562e
FZ
1287##
1288# @blockdev-mirror
1289#
1290# Start mirroring a block device's writes to a new destination.
1291#
71aa9867
AG
1292# @job-id: #optional identifier for the newly-created block job. If
1293# omitted, the device name will be used. (Since 2.7)
1294#
07eec652
KW
1295# @device: The device name or node-name of a root node whose writes should be
1296# mirrored.
df92562e
FZ
1297#
1298# @target: the id or node-name of the block device to mirror to. This mustn't be
1299# attached to guest.
1300#
1301# @replaces: #optional with sync=full graph node name to be replaced by the new
1302# image when a whole image copy is done. This can be used to repair
1303# broken Quorum files.
1304#
1305# @speed: #optional the maximum speed, in bytes per second
1306#
1307# @sync: what parts of the disk image should be copied to the destination
1308# (all the disk, only the sectors allocated in the topmost image, or
1309# only new I/O).
1310#
1311# @granularity: #optional granularity of the dirty bitmap, default is 64K
1312# if the image format doesn't have clusters, 4K if the clusters
1313# are smaller than that, else the cluster size. Must be a
1314# power of 2 between 512 and 64M
1315#
1316# @buf-size: #optional maximum amount of data in flight from source to
1317# target
1318#
1319# @on-source-error: #optional the action to take on an error on the source,
1320# default 'report'. 'stop' and 'enospc' can only be used
1321# if the block device supports io-status (see BlockInfo).
1322#
1323# @on-target-error: #optional the action to take on an error on the target,
1324# default 'report' (no limitations, since this applies to
1325# a different block device than @device).
1326#
1327# Returns: nothing on success.
1328#
1329# Since 2.6
1330##
1331{ 'command': 'blockdev-mirror',
71aa9867 1332 'data': { '*job-id': 'str', 'device': 'str', 'target': 'str',
df92562e
FZ
1333 '*replaces': 'str',
1334 'sync': 'MirrorSyncMode',
1335 '*speed': 'int', '*granularity': 'uint32',
1336 '*buf-size': 'int', '*on-source-error': 'BlockdevOnError',
1337 '*on-target-error': 'BlockdevOnError' } }
1338
1ad166b6
BC
1339##
1340# @block_set_io_throttle:
1341#
1342# Change I/O throttle limits for a block drive.
1343#
76f4afb4
AG
1344# Since QEMU 2.4, each device with I/O limits is member of a throttle
1345# group.
1346#
1347# If two or more devices are members of the same group, the limits
1348# will apply to the combined I/O of the whole group in a round-robin
1349# fashion. Therefore, setting new I/O limits to a device will affect
1350# the whole group.
1351#
1352# The name of the group can be specified using the 'group' parameter.
1353# If the parameter is unset, it is assumed to be the current group of
1354# that device. If it's not in any group yet, the name of the device
1355# will be used as the name for its group.
1356#
1357# The 'group' parameter can also be used to move a device to a
1358# different group. In this case the limits specified in the parameters
1359# will be applied to the new group only.
1360#
1361# I/O limits can be disabled by setting all of them to 0. In this case
1362# the device will be removed from its group and the rest of its
6b932c0a 1363# members will not be affected. The 'group' parameter is ignored.
76f4afb4 1364#
4dc9397b
EB
1365# See BlockIOThrottle for parameter descriptions.
1366#
1367# Returns: Nothing on success
1368# If @device is not a valid block device, DeviceNotFound
1369#
1370# Since: 1.1
1371##
1372{ 'command': 'block_set_io_throttle', 'boxed': true,
1373 'data': 'BlockIOThrottle' }
1374
1375##
1376# BlockIOThrottle
1377#
1378# A set of parameters describing block throttling.
1379#
1ad166b6
BC
1380# @device: The name of the device
1381#
1382# @bps: total throughput limit in bytes per second
1383#
1384# @bps_rd: read throughput limit in bytes per second
1385#
1386# @bps_wr: write throughput limit in bytes per second
1387#
1388# @iops: total I/O operations per second
1389#
f5a845fd 1390# @iops_rd: read I/O operations per second
1ad166b6
BC
1391#
1392# @iops_wr: write I/O operations per second
1393#
dce13204
AG
1394# @bps_max: #optional total throughput limit during bursts,
1395# in bytes (Since 1.7)
1ad166b6 1396#
dce13204
AG
1397# @bps_rd_max: #optional read throughput limit during bursts,
1398# in bytes (Since 1.7)
1ad166b6 1399#
dce13204
AG
1400# @bps_wr_max: #optional write throughput limit during bursts,
1401# in bytes (Since 1.7)
1ad166b6 1402#
dce13204
AG
1403# @iops_max: #optional total I/O operations per second during bursts,
1404# in bytes (Since 1.7)
1ad166b6 1405#
dce13204
AG
1406# @iops_rd_max: #optional read I/O operations per second during bursts,
1407# in bytes (Since 1.7)
1ad166b6 1408#
dce13204
AG
1409# @iops_wr_max: #optional write I/O operations per second during bursts,
1410# in bytes (Since 1.7)
1411#
1412# @bps_max_length: #optional maximum length of the @bps_max burst
1413# period, in seconds. It must only
1414# be set if @bps_max is set as well.
1415# Defaults to 1. (Since 2.6)
1416#
1417# @bps_rd_max_length: #optional maximum length of the @bps_rd_max
1418# burst period, in seconds. It must only
1419# be set if @bps_rd_max is set as well.
1420# Defaults to 1. (Since 2.6)
1421#
1422# @bps_wr_max_length: #optional maximum length of the @bps_wr_max
1423# burst period, in seconds. It must only
1424# be set if @bps_wr_max is set as well.
1425# Defaults to 1. (Since 2.6)
1426#
1427# @iops_max_length: #optional maximum length of the @iops burst
1428# period, in seconds. It must only
1429# be set if @iops_max is set as well.
1430# Defaults to 1. (Since 2.6)
1431#
1432# @iops_rd_max_length: #optional maximum length of the @iops_rd_max
1433# burst period, in seconds. It must only
1434# be set if @iops_rd_max is set as well.
1435# Defaults to 1. (Since 2.6)
1436#
1437# @iops_wr_max_length: #optional maximum length of the @iops_wr_max
1438# burst period, in seconds. It must only
1439# be set if @iops_wr_max is set as well.
1440# Defaults to 1. (Since 2.6)
1ad166b6
BC
1441#
1442# @iops_size: #optional an I/O size in bytes (Since 1.7)
1443#
76f4afb4
AG
1444# @group: #optional throttle group name (Since 2.4)
1445#
1ad166b6
BC
1446# Since: 1.1
1447##
4dc9397b 1448{ 'struct': 'BlockIOThrottle',
1ad166b6
BC
1449 'data': { 'device': 'str', 'bps': 'int', 'bps_rd': 'int', 'bps_wr': 'int',
1450 'iops': 'int', 'iops_rd': 'int', 'iops_wr': 'int',
1451 '*bps_max': 'int', '*bps_rd_max': 'int',
1452 '*bps_wr_max': 'int', '*iops_max': 'int',
1453 '*iops_rd_max': 'int', '*iops_wr_max': 'int',
dce13204
AG
1454 '*bps_max_length': 'int', '*bps_rd_max_length': 'int',
1455 '*bps_wr_max_length': 'int', '*iops_max_length': 'int',
1456 '*iops_rd_max_length': 'int', '*iops_wr_max_length': 'int',
76f4afb4 1457 '*iops_size': 'int', '*group': 'str' } }
1ad166b6
BC
1458
1459##
1460# @block-stream:
1461#
1462# Copy data from a backing file into a block device.
1463#
1464# The block streaming operation is performed in the background until the entire
1465# backing file has been copied. This command returns immediately once streaming
1466# has started. The status of ongoing block streaming operations can be checked
1467# with query-block-jobs. The operation can be stopped before it has completed
1468# using the block-job-cancel command.
1469#
1470# If a base file is specified then sectors are not copied from that base file and
1471# its backing chain. When streaming completes the image file will have the base
1472# file as its backing file. This can be used to stream a subset of the backing
1473# file chain instead of flattening the entire image.
1474#
1475# On successful completion the image file is updated to drop the backing file
1476# and the BLOCK_JOB_COMPLETED event is emitted.
1477#
2323322e
AG
1478# @job-id: #optional identifier for the newly-created block job. If
1479# omitted, the device name will be used. (Since 2.7)
1480#
b6c1bae5 1481# @device: the device name or node-name of a root node
1ad166b6
BC
1482#
1483# @base: #optional the common backing file name
1484#
13d8cc51
JC
1485# @backing-file: #optional The backing file string to write into the active
1486# layer. This filename is not validated.
1487#
1488# If a pathname string is such that it cannot be
1489# resolved by QEMU, that means that subsequent QMP or
1490# HMP commands must use node-names for the image in
1491# question, as filename lookup methods will fail.
1492#
1493# If not specified, QEMU will automatically determine
1494# the backing file string to use, or error out if there
1495# is no obvious choice. Care should be taken when
1496# specifying the string, to specify a valid filename or
1497# protocol.
1498# (Since 2.1)
1499#
1ad166b6
BC
1500# @speed: #optional the maximum speed, in bytes per second
1501#
1502# @on-error: #optional the action to take on an error (default report).
1503# 'stop' and 'enospc' can only be used if the block device
1504# supports io-status (see BlockInfo). Since 1.3.
1505#
1ad166b6
BC
1506# Since: 1.1
1507##
1508{ 'command': 'block-stream',
2323322e
AG
1509 'data': { '*job-id': 'str', 'device': 'str', '*base': 'str',
1510 '*backing-file': 'str', '*speed': 'int',
1511 '*on-error': 'BlockdevOnError' } }
1ad166b6
BC
1512
1513##
1514# @block-job-set-speed:
1515#
1516# Set maximum speed for a background block operation.
1517#
1518# This command can only be issued when there is an active block job.
1519#
1520# Throttling can be disabled by setting the speed to 0.
1521#
6aae5be6
AG
1522# @device: The job identifier. This used to be a device name (hence
1523# the name of the parameter), but since QEMU 2.7 it can have
1524# other values.
1ad166b6
BC
1525#
1526# @speed: the maximum speed, in bytes per second, or 0 for unlimited.
1527# Defaults to 0.
1528#
1529# Returns: Nothing on success
1530# If no background operation is active on this device, DeviceNotActive
1531#
1532# Since: 1.1
1533##
1534{ 'command': 'block-job-set-speed',
1535 'data': { 'device': 'str', 'speed': 'int' } }
1536
1537##
1538# @block-job-cancel:
1539#
1540# Stop an active background block operation.
1541#
1542# This command returns immediately after marking the active background block
1543# operation for cancellation. It is an error to call this command if no
1544# operation is in progress.
1545#
1546# The operation will cancel as soon as possible and then emit the
1547# BLOCK_JOB_CANCELLED event. Before that happens the job is still visible when
1548# enumerated using query-block-jobs.
1549#
1550# For streaming, the image file retains its backing file unless the streaming
1551# operation happens to complete just as it is being cancelled. A new streaming
1552# operation can be started at a later time to finish copying all data from the
1553# backing file.
1554#
6aae5be6
AG
1555# @device: The job identifier. This used to be a device name (hence
1556# the name of the parameter), but since QEMU 2.7 it can have
1557# other values.
1ad166b6
BC
1558#
1559# @force: #optional whether to allow cancellation of a paused job (default
1560# false). Since 1.3.
1561#
1562# Returns: Nothing on success
1563# If no background operation is active on this device, DeviceNotActive
1564#
1565# Since: 1.1
1566##
1567{ 'command': 'block-job-cancel', 'data': { 'device': 'str', '*force': 'bool' } }
1568
1569##
1570# @block-job-pause:
1571#
1572# Pause an active background block operation.
1573#
1574# This command returns immediately after marking the active background block
1575# operation for pausing. It is an error to call this command if no
1576# operation is in progress. Pausing an already paused job has no cumulative
1577# effect; a single block-job-resume command will resume the job.
1578#
1579# The operation will pause as soon as possible. No event is emitted when
1580# the operation is actually paused. Cancelling a paused job automatically
1581# resumes it.
1582#
6aae5be6
AG
1583# @device: The job identifier. This used to be a device name (hence
1584# the name of the parameter), but since QEMU 2.7 it can have
1585# other values.
1ad166b6
BC
1586#
1587# Returns: Nothing on success
1588# If no background operation is active on this device, DeviceNotActive
1589#
1590# Since: 1.3
1591##
1592{ 'command': 'block-job-pause', 'data': { 'device': 'str' } }
1593
1594##
1595# @block-job-resume:
1596#
1597# Resume an active background block operation.
1598#
1599# This command returns immediately after resuming a paused background block
1600# operation. It is an error to call this command if no operation is in
1601# progress. Resuming an already running job is not an error.
1602#
1603# This command also clears the error status of the job.
1604#
6aae5be6
AG
1605# @device: The job identifier. This used to be a device name (hence
1606# the name of the parameter), but since QEMU 2.7 it can have
1607# other values.
1ad166b6
BC
1608#
1609# Returns: Nothing on success
1610# If no background operation is active on this device, DeviceNotActive
1611#
1612# Since: 1.3
1613##
1614{ 'command': 'block-job-resume', 'data': { 'device': 'str' } }
1615
1616##
1617# @block-job-complete:
1618#
1619# Manually trigger completion of an active background block operation. This
1620# is supported for drive mirroring, where it also switches the device to
1621# write to the target path only. The ability to complete is signaled with
1622# a BLOCK_JOB_READY event.
1623#
1624# This command completes an active background block operation synchronously.
1625# The ordering of this command's return with the BLOCK_JOB_COMPLETED event
1626# is not defined. Note that if an I/O error occurs during the processing of
1627# this command: 1) the command itself will fail; 2) the error will be processed
1628# according to the rerror/werror arguments that were specified when starting
1629# the operation.
1630#
1631# A cancelled or paused job cannot be completed.
1632#
6aae5be6
AG
1633# @device: The job identifier. This used to be a device name (hence
1634# the name of the parameter), but since QEMU 2.7 it can have
1635# other values.
1ad166b6
BC
1636#
1637# Returns: Nothing on success
1638# If no background operation is active on this device, DeviceNotActive
1639#
1640# Since: 1.3
1641##
1642{ 'command': 'block-job-complete', 'data': { 'device': 'str' } }
1643
1644##
1645# @BlockdevDiscardOptions
1646#
1647# Determines how to handle discard requests.
1648#
1649# @ignore: Ignore the request
1650# @unmap: Forward as an unmap request
1651#
1652# Since: 1.7
1653##
1654{ 'enum': 'BlockdevDiscardOptions',
1655 'data': [ 'ignore', 'unmap' ] }
1656
1657##
1658# @BlockdevDetectZeroesOptions
1659#
1660# Describes the operation mode for the automatic conversion of plain
1661# zero writes by the OS to driver specific optimized zero write commands.
1662#
1663# @off: Disabled (default)
1664# @on: Enabled
1665# @unmap: Enabled and even try to unmap blocks if possible. This requires
1666# also that @BlockdevDiscardOptions is set to unmap for this device.
1667#
1668# Since: 2.1
1669##
1670{ 'enum': 'BlockdevDetectZeroesOptions',
1671 'data': [ 'off', 'on', 'unmap' ] }
1672
1673##
1674# @BlockdevAioOptions
1675#
1676# Selects the AIO backend to handle I/O requests
1677#
1678# @threads: Use qemu's thread pool
1679# @native: Use native AIO backend (only Linux and Windows)
1680#
1681# Since: 1.7
1682##
1683{ 'enum': 'BlockdevAioOptions',
1684 'data': [ 'threads', 'native' ] }
1685
1686##
1687# @BlockdevCacheOptions
1688#
1689# Includes cache-related options for block devices
1690#
1ad166b6
BC
1691# @direct: #optional enables use of O_DIRECT (bypass the host page cache;
1692# default: false)
1693# @no-flush: #optional ignore any flush requests for the device (default:
1694# false)
1695#
1696# Since: 1.7
1697##
895a2a80 1698{ 'struct': 'BlockdevCacheOptions',
aaa436f9 1699 'data': { '*direct': 'bool',
1ad166b6
BC
1700 '*no-flush': 'bool' } }
1701
1702##
1703# @BlockdevDriver
1704#
1705# Drivers that are supported in block device operations.
1706#
f709623b 1707# @host_device, @host_cdrom: Since 2.1
0a189ffb 1708# @gluster: Since 2.7
1ad166b6
BC
1709#
1710# Since: 2.0
1711##
1712{ 'enum': 'BlockdevDriver',
550830f9 1713 'data': [ 'archipelago', 'blkdebug', 'blkverify', 'bochs', 'cloop',
7edac2dd
PKK
1714 'dmg', 'file', 'ftp', 'ftps', 'gluster', 'host_cdrom',
1715 'host_device', 'http', 'https', 'luks', 'null-aio', 'null-co',
82ac5543
WC
1716 'parallels', 'qcow', 'qcow2', 'qed', 'quorum', 'raw',
1717 'replication', 'tftp', 'vdi', 'vhdx', 'vmdk', 'vpc', 'vvfat' ] }
1ad166b6 1718
1ad166b6
BC
1719##
1720# @BlockdevOptionsFile
1721#
1722# Driver specific block device options for the file backend and similar
1723# protocols.
1724#
1725# @filename: path to the image file
1726#
1727# Since: 1.7
1728##
895a2a80 1729{ 'struct': 'BlockdevOptionsFile',
1ad166b6
BC
1730 'data': { 'filename': 'str' } }
1731
e819ab22
FZ
1732##
1733# @BlockdevOptionsNull
1734#
1735# Driver specific block device options for the null backend.
1736#
1737# @size: #optional size of the device in bytes.
e5e51dd3
FZ
1738# @latency-ns: #optional emulated latency (in nanoseconds) in processing
1739# requests. Default to zero which completes requests immediately.
1740# (Since 2.4)
e819ab22
FZ
1741#
1742# Since: 2.2
1743##
895a2a80 1744{ 'struct': 'BlockdevOptionsNull',
e5e51dd3 1745 'data': { '*size': 'int', '*latency-ns': 'uint64' } }
e819ab22 1746
1ad166b6
BC
1747##
1748# @BlockdevOptionsVVFAT
1749#
1750# Driver specific block device options for the vvfat protocol.
1751#
1752# @dir: directory to be exported as FAT image
1753# @fat-type: #optional FAT type: 12, 16 or 32
1754# @floppy: #optional whether to export a floppy image (true) or
1755# partitioned hard disk (false; default)
d5941dda
WB
1756# @label: #optional set the volume label, limited to 11 bytes. FAT16 and
1757# FAT32 traditionally have some restrictions on labels, which are
1758# ignored by most operating systems. Defaults to "QEMU VVFAT".
1759# (since 2.4)
1ad166b6
BC
1760# @rw: #optional whether to allow write operations (default: false)
1761#
1762# Since: 1.7
1763##
895a2a80 1764{ 'struct': 'BlockdevOptionsVVFAT',
1ad166b6 1765 'data': { 'dir': 'str', '*fat-type': 'int', '*floppy': 'bool',
d5941dda 1766 '*label': 'str', '*rw': 'bool' } }
1ad166b6
BC
1767
1768##
1769# @BlockdevOptionsGenericFormat
1770#
1771# Driver specific block device options for image format that have no option
1772# besides their data source.
1773#
1774# @file: reference to or definition of the data source block device
1775#
1776# Since: 1.7
1777##
895a2a80 1778{ 'struct': 'BlockdevOptionsGenericFormat',
1ad166b6
BC
1779 'data': { 'file': 'BlockdevRef' } }
1780
78368575
DB
1781##
1782# @BlockdevOptionsLUKS
1783#
1784# Driver specific block device options for LUKS.
1785#
1786# @key-secret: #optional the ID of a QCryptoSecret object providing
1787# the decryption key (since 2.6). Mandatory except when
1788# doing a metadata-only probe of the image.
1789#
1790# Since: 2.6
1791##
1792{ 'struct': 'BlockdevOptionsLUKS',
1793 'base': 'BlockdevOptionsGenericFormat',
1794 'data': { '*key-secret': 'str' } }
1795
1796
1ad166b6
BC
1797##
1798# @BlockdevOptionsGenericCOWFormat
1799#
1800# Driver specific block device options for image format that have no option
1801# besides their data source and an optional backing file.
1802#
1803# @backing: #optional reference to or definition of the backing file block
1804# device (if missing, taken from the image file content). It is
1805# allowed to pass an empty string here in order to disable the
1806# default backing file.
1807#
1808# Since: 1.7
1809##
895a2a80 1810{ 'struct': 'BlockdevOptionsGenericCOWFormat',
1ad166b6
BC
1811 'base': 'BlockdevOptionsGenericFormat',
1812 'data': { '*backing': 'BlockdevRef' } }
1813
f6585811
HR
1814##
1815# @Qcow2OverlapCheckMode
1816#
1817# General overlap check modes.
1818#
1819# @none: Do not perform any checks
1820#
1821# @constant: Perform only checks which can be done in constant time and
1822# without reading anything from disk
1823#
1824# @cached: Perform only checks which can be done without reading anything
1825# from disk
1826#
1827# @all: Perform all available overlap checks
1828#
1829# Since: 2.2
1830##
1831{ 'enum': 'Qcow2OverlapCheckMode',
1832 'data': [ 'none', 'constant', 'cached', 'all' ] }
1833
1834##
1835# @Qcow2OverlapCheckFlags
1836#
1837# Structure of flags for each metadata structure. Setting a field to 'true'
1838# makes qemu guard that structure against unintended overwriting. The default
1839# value is chosen according to the template given.
1840#
1841# @template: Specifies a template mode which can be adjusted using the other
1842# flags, defaults to 'cached'
1843#
1844# Since: 2.2
1845##
895a2a80 1846{ 'struct': 'Qcow2OverlapCheckFlags',
f6585811
HR
1847 'data': { '*template': 'Qcow2OverlapCheckMode',
1848 '*main-header': 'bool',
1849 '*active-l1': 'bool',
1850 '*active-l2': 'bool',
1851 '*refcount-table': 'bool',
1852 '*refcount-block': 'bool',
1853 '*snapshot-table': 'bool',
1854 '*inactive-l1': 'bool',
1855 '*inactive-l2': 'bool' } }
1856
1857##
1858# @Qcow2OverlapChecks
1859#
1860# Specifies which metadata structures should be guarded against unintended
1861# overwriting.
1862#
1863# @flags: set of flags for separate specification of each metadata structure
1864# type
1865#
1866# @mode: named mode which chooses a specific set of flags
1867#
1868# Since: 2.2
1869##
ab916fad 1870{ 'alternate': 'Qcow2OverlapChecks',
f6585811
HR
1871 'data': { 'flags': 'Qcow2OverlapCheckFlags',
1872 'mode': 'Qcow2OverlapCheckMode' } }
1873
1ad166b6
BC
1874##
1875# @BlockdevOptionsQcow2
1876#
1877# Driver specific block device options for qcow2.
1878#
1879# @lazy-refcounts: #optional whether to enable the lazy refcounts
1880# feature (default is taken from the image file)
1881#
1882# @pass-discard-request: #optional whether discard requests to the qcow2
1883# device should be forwarded to the data source
1884#
1885# @pass-discard-snapshot: #optional whether discard requests for the data source
1886# should be issued when a snapshot operation (e.g.
1887# deleting a snapshot) frees clusters in the qcow2 file
1888#
1889# @pass-discard-other: #optional whether discard requests for the data source
1890# should be issued on other occasions where a cluster
1891# gets freed
1892#
f6585811
HR
1893# @overlap-check: #optional which overlap checks to perform for writes
1894# to the image, defaults to 'cached' (since 2.2)
1895#
1896# @cache-size: #optional the maximum total size of the L2 table and
1897# refcount block caches in bytes (since 2.2)
1898#
1899# @l2-cache-size: #optional the maximum size of the L2 table cache in
1900# bytes (since 2.2)
1901#
1902# @refcount-cache-size: #optional the maximum size of the refcount block cache
1903# in bytes (since 2.2)
1904#
279621c0
AG
1905# @cache-clean-interval: #optional clean unused entries in the L2 and refcount
1906# caches. The interval is in seconds. The default value
1907# is 0 and it disables this feature (since 2.5)
1908#
1ad166b6
BC
1909# Since: 1.7
1910##
895a2a80 1911{ 'struct': 'BlockdevOptionsQcow2',
1ad166b6
BC
1912 'base': 'BlockdevOptionsGenericCOWFormat',
1913 'data': { '*lazy-refcounts': 'bool',
1914 '*pass-discard-request': 'bool',
1915 '*pass-discard-snapshot': 'bool',
f6585811
HR
1916 '*pass-discard-other': 'bool',
1917 '*overlap-check': 'Qcow2OverlapChecks',
1918 '*cache-size': 'int',
1919 '*l2-cache-size': 'int',
279621c0
AG
1920 '*refcount-cache-size': 'int',
1921 '*cache-clean-interval': 'int' } }
1ad166b6 1922
b1de5f43
CN
1923
1924##
1925# @BlockdevOptionsArchipelago
1926#
1927# Driver specific block device options for Archipelago.
1928#
1929# @volume: Name of the Archipelago volume image
1930#
1931# @mport: #optional The port number on which mapperd is
1932# listening. This is optional
1933# and if not specified, QEMU will make Archipelago
1934# use the default port (1001).
1935#
1936# @vport: #optional The port number on which vlmcd is
1937# listening. This is optional
1938# and if not specified, QEMU will make Archipelago
1939# use the default port (501).
1940#
1941# @segment: #optional The name of the shared memory segment
1942# Archipelago stack is using. This is optional
1943# and if not specified, QEMU will make Archipelago
1944# use the default value, 'archipelago'.
1945# Since: 2.2
1946##
895a2a80 1947{ 'struct': 'BlockdevOptionsArchipelago',
b1de5f43
CN
1948 'data': { 'volume': 'str',
1949 '*mport': 'int',
1950 '*vport': 'int',
1951 '*segment': 'str' } }
1952
1953
1ad166b6
BC
1954##
1955# @BlkdebugEvent
1956#
1957# Trigger events supported by blkdebug.
a31939e6
EB
1958#
1959# Since: 2.0
1ad166b6 1960##
a31939e6 1961{ 'enum': 'BlkdebugEvent', 'prefix': 'BLKDBG',
5be5b776
EB
1962 'data': [ 'l1_update', 'l1_grow_alloc_table', 'l1_grow_write_table',
1963 'l1_grow_activate_table', 'l2_load', 'l2_update',
1964 'l2_update_compressed', 'l2_alloc_cow_read', 'l2_alloc_write',
1ad166b6
BC
1965 'read_aio', 'read_backing_aio', 'read_compressed', 'write_aio',
1966 'write_compressed', 'vmstate_load', 'vmstate_save', 'cow_read',
1967 'cow_write', 'reftable_load', 'reftable_grow', 'reftable_update',
1968 'refblock_load', 'refblock_update', 'refblock_update_part',
5be5b776
EB
1969 'refblock_alloc', 'refblock_alloc_hookup', 'refblock_alloc_write',
1970 'refblock_alloc_write_blocks', 'refblock_alloc_write_table',
1971 'refblock_alloc_switch_table', 'cluster_alloc',
1ad166b6 1972 'cluster_alloc_bytes', 'cluster_free', 'flush_to_os',
5be5b776
EB
1973 'flush_to_disk', 'pwritev_rmw_head', 'pwritev_rmw_after_head',
1974 'pwritev_rmw_tail', 'pwritev_rmw_after_tail', 'pwritev',
d21de4d9 1975 'pwritev_zero', 'pwritev_done', 'empty_image_prepare' ] }
1ad166b6
BC
1976
1977##
1978# @BlkdebugInjectErrorOptions
1979#
1980# Describes a single error injection for blkdebug.
1981#
1982# @event: trigger event
1983#
1984# @state: #optional the state identifier blkdebug needs to be in to
1985# actually trigger the event; defaults to "any"
1986#
1987# @errno: #optional error identifier (errno) to be returned; defaults to
1988# EIO
1989#
1990# @sector: #optional specifies the sector index which has to be affected
1991# in order to actually trigger the event; defaults to "any
1992# sector"
1993#
1994# @once: #optional disables further events after this one has been
1995# triggered; defaults to false
1996#
1997# @immediately: #optional fail immediately; defaults to false
1998#
1999# Since: 2.0
2000##
895a2a80 2001{ 'struct': 'BlkdebugInjectErrorOptions',
1ad166b6
BC
2002 'data': { 'event': 'BlkdebugEvent',
2003 '*state': 'int',
2004 '*errno': 'int',
2005 '*sector': 'int',
2006 '*once': 'bool',
2007 '*immediately': 'bool' } }
2008
2009##
2010# @BlkdebugSetStateOptions
2011#
2012# Describes a single state-change event for blkdebug.
2013#
2014# @event: trigger event
2015#
2016# @state: #optional the current state identifier blkdebug needs to be in;
2017# defaults to "any"
2018#
2019# @new_state: the state identifier blkdebug is supposed to assume if
2020# this event is triggered
2021#
2022# Since: 2.0
2023##
895a2a80 2024{ 'struct': 'BlkdebugSetStateOptions',
1ad166b6
BC
2025 'data': { 'event': 'BlkdebugEvent',
2026 '*state': 'int',
2027 'new_state': 'int' } }
2028
2029##
2030# @BlockdevOptionsBlkdebug
2031#
2032# Driver specific block device options for blkdebug.
2033#
2034# @image: underlying raw block device (or image file)
2035#
2036# @config: #optional filename of the configuration file
2037#
835db3ee
EB
2038# @align: #optional required alignment for requests in bytes,
2039# must be power of 2, or 0 for default
1ad166b6
BC
2040#
2041# @inject-error: #optional array of error injection descriptions
2042#
2043# @set-state: #optional array of state-change descriptions
2044#
2045# Since: 2.0
2046##
895a2a80 2047{ 'struct': 'BlockdevOptionsBlkdebug',
1ad166b6
BC
2048 'data': { 'image': 'BlockdevRef',
2049 '*config': 'str',
2050 '*align': 'int',
2051 '*inject-error': ['BlkdebugInjectErrorOptions'],
2052 '*set-state': ['BlkdebugSetStateOptions'] } }
2053
2054##
2055# @BlockdevOptionsBlkverify
2056#
2057# Driver specific block device options for blkverify.
2058#
2059# @test: block device to be tested
2060#
2061# @raw: raw image used for verification
2062#
2063# Since: 2.0
2064##
895a2a80 2065{ 'struct': 'BlockdevOptionsBlkverify',
1ad166b6
BC
2066 'data': { 'test': 'BlockdevRef',
2067 'raw': 'BlockdevRef' } }
2068
62c6031f
LY
2069##
2070# @QuorumReadPattern
2071#
2072# An enumeration of quorum read patterns.
2073#
2074# @quorum: read all the children and do a quorum vote on reads
2075#
2076# @fifo: read only from the first child that has not failed
2077#
2078# Since: 2.2
2079##
2080{ 'enum': 'QuorumReadPattern', 'data': [ 'quorum', 'fifo' ] }
2081
1ad166b6
BC
2082##
2083# @BlockdevOptionsQuorum
2084#
2085# Driver specific block device options for Quorum
2086#
2087# @blkverify: #optional true if the driver must print content mismatch
2088# set to false by default
2089#
2090# @children: the children block devices to use
2091#
2092# @vote-threshold: the vote limit under which a read will fail
2093#
cf29a570
BC
2094# @rewrite-corrupted: #optional rewrite corrupted data when quorum is reached
2095# (Since 2.1)
2096#
62c6031f
LY
2097# @read-pattern: #optional choose read pattern and set to quorum by default
2098# (Since 2.2)
2099#
1ad166b6
BC
2100# Since: 2.0
2101##
895a2a80 2102{ 'struct': 'BlockdevOptionsQuorum',
1ad166b6
BC
2103 'data': { '*blkverify': 'bool',
2104 'children': [ 'BlockdevRef' ],
62c6031f
LY
2105 'vote-threshold': 'int',
2106 '*rewrite-corrupted': 'bool',
2107 '*read-pattern': 'QuorumReadPattern' } }
1ad166b6 2108
7edac2dd
PKK
2109##
2110# @GlusterTransport
2111#
2112# An enumeration of Gluster transport types
2113#
2114# @tcp: TCP - Transmission Control Protocol
2115#
2116# @unix: UNIX - Unix domain socket
2117#
2118# Since: 2.7
2119##
2120{ 'enum': 'GlusterTransport',
2121 'data': [ 'unix', 'tcp' ] }
2122
2123
2124##
2125# @GlusterServer
2126#
2127# Captures the address of a socket
2128#
2129# Details for connecting to a gluster server
2130#
2131# @type: Transport type used for gluster connection
2132#
2133# @unix: socket file
2134#
2135# @tcp: host address and port number
2136#
c76d7aab
PKK
2137# This is similar to SocketAddress, only distinction:
2138#
2139# 1. GlusterServer is a flat union, SocketAddress is a simple union.
2140# A flat union is nicer than simple because it avoids nesting
2141# (i.e. more {}) on the wire.
2142#
2143# 2. GlusterServer lacks case 'fd', since gluster doesn't let you
2144# pass in a file descriptor.
2145#
2146# GlusterServer is actually not Gluster-specific, its a
2147# compatibility evolved into an alternate for SocketAddress.
2148#
7edac2dd
PKK
2149# Since: 2.7
2150##
2151{ 'union': 'GlusterServer',
2152 'base': { 'type': 'GlusterTransport' },
2153 'discriminator': 'type',
2154 'data': { 'unix': 'UnixSocketAddress',
2155 'tcp': 'InetSocketAddress' } }
2156
2157##
2158# @BlockdevOptionsGluster
2159#
2160# Driver specific block device options for Gluster
2161#
2162# @volume: name of gluster volume where VM image resides
2163#
2164# @path: absolute path to image file in gluster volume
2165#
0a189ffb 2166# @server: gluster servers description
7edac2dd
PKK
2167#
2168# @debug-level: #optional libgfapi log level (default '4' which is Error)
2169#
e9db8ff3
PKK
2170# @logfile: #optional libgfapi log file (default /dev/stderr)
2171#
7edac2dd
PKK
2172# Since: 2.7
2173##
2174{ 'struct': 'BlockdevOptionsGluster',
2175 'data': { 'volume': 'str',
2176 'path': 'str',
6c7189bb 2177 'server': ['GlusterServer'],
e9db8ff3
PKK
2178 '*debug-level': 'int',
2179 '*logfile': 'str' } }
7edac2dd 2180
190b9a8b
CX
2181##
2182# @ReplicationMode
2183#
2184# An enumeration of replication modes.
2185#
2186# @primary: Primary mode, the vm's state will be sent to secondary QEMU.
2187#
2188# @secondary: Secondary mode, receive the vm's state from primary QEMU.
2189#
2190# Since: 2.8
2191##
2192{ 'enum' : 'ReplicationMode', 'data' : [ 'primary', 'secondary' ] }
2193
82ac5543
WC
2194##
2195# @BlockdevOptionsReplication
2196#
2197# Driver specific block device options for replication
2198#
2199# @mode: the replication mode
2200#
2201# @top-id: #optional In secondary mode, node name or device ID of the root
2202# node who owns the replication node chain. Ignored in primary mode.
2203#
2204# Since: 2.8
2205##
2206{ 'struct': 'BlockdevOptionsReplication',
2207 'base': 'BlockdevOptionsGenericFormat',
2208 'data': { 'mode': 'ReplicationMode',
2209 '*top-id': 'str' } }
2210
1ad166b6
BC
2211##
2212# @BlockdevOptions
2213#
3666a97f
EB
2214# Options for creating a block device. Many options are available for all
2215# block devices, independent of the block driver:
2216#
2217# @driver: block driver name
2218# @id: #optional id by which the new block device can be referred to.
2219# This option is only allowed on the top level of blockdev-add.
2220# A BlockBackend will be created by blockdev-add if and only if
2221# this option is given.
2222# @node-name: #optional the name of a block driver state node (Since 2.0).
2223# This option is required on the top level of blockdev-add if
2224# the @id option is not given there.
2225# @discard: #optional discard-related options (default: ignore)
2226# @cache: #optional cache-related options
2227# @aio: #optional AIO backend (default: threads)
3666a97f
EB
2228# @read-only: #optional whether the block device should be read-only
2229# (default: false)
3666a97f
EB
2230# @detect-zeroes: #optional detect and optimize zero writes (Since 2.1)
2231# (default: off)
2232#
2233# Remaining options are determined by the block driver.
1ad166b6
BC
2234#
2235# Since: 1.7
2236##
2237{ 'union': 'BlockdevOptions',
3666a97f 2238 'base': { 'driver': 'BlockdevDriver',
35fedb7b 2239# TODO 'id' is a BB-level option, remove it
3666a97f
EB
2240 '*id': 'str',
2241 '*node-name': 'str',
2242 '*discard': 'BlockdevDiscardOptions',
2243 '*cache': 'BlockdevCacheOptions',
2244 '*aio': 'BlockdevAioOptions',
3666a97f 2245 '*read-only': 'bool',
3666a97f 2246 '*detect-zeroes': 'BlockdevDetectZeroesOptions' },
1ad166b6
BC
2247 'discriminator': 'driver',
2248 'data': {
b1de5f43 2249 'archipelago':'BlockdevOptionsArchipelago',
db866be9
FZ
2250 'blkdebug': 'BlockdevOptionsBlkdebug',
2251 'blkverify': 'BlockdevOptionsBlkverify',
2252 'bochs': 'BlockdevOptionsGenericFormat',
2253 'cloop': 'BlockdevOptionsGenericFormat',
db866be9 2254 'dmg': 'BlockdevOptionsGenericFormat',
1ad166b6 2255 'file': 'BlockdevOptionsFile',
db866be9
FZ
2256 'ftp': 'BlockdevOptionsFile',
2257 'ftps': 'BlockdevOptionsFile',
7edac2dd 2258 'gluster': 'BlockdevOptionsGluster',
1ad166b6 2259 'host_cdrom': 'BlockdevOptionsFile',
db866be9 2260 'host_device':'BlockdevOptionsFile',
1ad166b6
BC
2261 'http': 'BlockdevOptionsFile',
2262 'https': 'BlockdevOptionsFile',
1ad166b6 2263# TODO iscsi: Wait for structured options
78368575 2264 'luks': 'BlockdevOptionsLUKS',
1ad166b6
BC
2265# TODO nbd: Should take InetSocketAddress for 'host'?
2266# TODO nfs: Wait for structured options
db866be9
FZ
2267 'null-aio': 'BlockdevOptionsNull',
2268 'null-co': 'BlockdevOptionsNull',
1ad166b6 2269 'parallels': 'BlockdevOptionsGenericFormat',
1ad166b6 2270 'qcow2': 'BlockdevOptionsQcow2',
db866be9 2271 'qcow': 'BlockdevOptionsGenericCOWFormat',
1ad166b6 2272 'qed': 'BlockdevOptionsGenericCOWFormat',
db866be9 2273 'quorum': 'BlockdevOptionsQuorum',
1ad166b6 2274 'raw': 'BlockdevOptionsGenericFormat',
db866be9 2275# TODO rbd: Wait for structured options
82ac5543 2276 'replication':'BlockdevOptionsReplication',
db866be9
FZ
2277# TODO sheepdog: Wait for structured options
2278# TODO ssh: Should take InetSocketAddress for 'host'?
2279 'tftp': 'BlockdevOptionsFile',
1ad166b6
BC
2280 'vdi': 'BlockdevOptionsGenericFormat',
2281 'vhdx': 'BlockdevOptionsGenericFormat',
2282 'vmdk': 'BlockdevOptionsGenericCOWFormat',
2283 'vpc': 'BlockdevOptionsGenericFormat',
db866be9 2284 'vvfat': 'BlockdevOptionsVVFAT'
1ad166b6
BC
2285 } }
2286
2287##
2288# @BlockdevRef
2289#
2290# Reference to a block device.
2291#
2292# @definition: defines a new block device inline
2293# @reference: references the ID of an existing block device. An
2294# empty string means that no block device should be
2295# referenced.
2296#
2297# Since: 1.7
2298##
ab916fad 2299{ 'alternate': 'BlockdevRef',
1ad166b6
BC
2300 'data': { 'definition': 'BlockdevOptions',
2301 'reference': 'str' } }
2302
2303##
2304# @blockdev-add:
2305#
be4b67bc
HR
2306# Creates a new block device. If the @id option is given at the top level, a
2307# BlockBackend will be created; otherwise, @node-name is mandatory at the top
2308# level and no BlockBackend will be created.
1ad166b6 2309#
da2cf4e8 2310# This command is still a work in progress. It doesn't support all
81b936ae
AG
2311# block drivers among other things. Stay away from it unless you want
2312# to help with its development.
da2cf4e8 2313#
1ad166b6
BC
2314# @options: block device options for the new device
2315#
2316# Since: 1.7
2317##
2318{ 'command': 'blockdev-add', 'data': { 'options': 'BlockdevOptions' } }
2319
81b936ae
AG
2320##
2321# @x-blockdev-del:
2322#
2323# Deletes a block device that has been added using blockdev-add.
2324# The selected device can be either a block backend or a graph node.
2325#
2326# In the former case the backend will be destroyed, along with its
2327# inserted medium if there's any. The command will fail if the backend
2328# or its medium are in use.
2329#
2330# In the latter case the node will be destroyed. The command will fail
2331# if the node is attached to a block backend or is otherwise being
2332# used.
2333#
2334# One of @id or @node-name must be specified, but not both.
2335#
2336# This command is still a work in progress and is considered
2337# experimental. Stay away from it unless you want to help with its
2338# development.
2339#
2340# @id: #optional Name of the block backend device to delete.
2341#
2342# @node-name: #optional Name of the graph node to delete.
2343#
2344# Since: 2.5
2345##
2346{ 'command': 'x-blockdev-del', 'data': { '*id': 'str', '*node-name': 'str' } }
2347
7d8a9f71
HR
2348##
2349# @blockdev-open-tray:
2350#
2351# Opens a block device's tray. If there is a block driver state tree inserted as
2352# a medium, it will become inaccessible to the guest (but it will remain
2353# associated to the block device, so closing the tray will make it accessible
2354# again).
2355#
2356# If the tray was already open before, this will be a no-op.
2357#
2358# Once the tray opens, a DEVICE_TRAY_MOVED event is emitted. There are cases in
2359# which no such event will be generated, these include:
2360# - if the guest has locked the tray, @force is false and the guest does not
2361# respond to the eject request
2362# - if the BlockBackend denoted by @device does not have a guest device attached
2363# to it
12c7ec87 2364# - if the guest device does not have an actual tray
7d8a9f71 2365#
b33945cf
KW
2366# @device: #optional Block device name (deprecated, use @id instead)
2367#
2368# @id: #optional The name or QOM path of the guest device (since: 2.8)
7d8a9f71
HR
2369#
2370# @force: #optional if false (the default), an eject request will be sent to
2371# the guest if it has locked the tray (and the tray will not be opened
2372# immediately); if true, the tray will be opened regardless of whether
2373# it is locked
2374#
2375# Since: 2.5
2376##
2377{ 'command': 'blockdev-open-tray',
b33945cf
KW
2378 'data': { '*device': 'str',
2379 '*id': 'str',
7d8a9f71
HR
2380 '*force': 'bool' } }
2381
abaaf59d
HR
2382##
2383# @blockdev-close-tray:
2384#
2385# Closes a block device's tray. If there is a block driver state tree associated
2386# with the block device (which is currently ejected), that tree will be loaded
2387# as the medium.
2388#
2389# If the tray was already closed before, this will be a no-op.
2390#
b33945cf
KW
2391# @device: #optional Block device name (deprecated, use @id instead)
2392#
2393# @id: #optional The name or QOM path of the guest device (since: 2.8)
abaaf59d
HR
2394#
2395# Since: 2.5
2396##
2397{ 'command': 'blockdev-close-tray',
b33945cf
KW
2398 'data': { '*device': 'str',
2399 '*id': 'str' } }
abaaf59d 2400
2814f672 2401##
6e0abc25 2402# @x-blockdev-remove-medium:
2814f672
HR
2403#
2404# Removes a medium (a block driver state tree) from a block device. That block
2405# device's tray must currently be open (unless there is no attached guest
2406# device).
2407#
2408# If the tray is open and there is no medium inserted, this will be a no-op.
2409#
6e0abc25
HR
2410# This command is still a work in progress and is considered experimental.
2411# Stay away from it unless you want to help with its development.
2412#
2814f672
HR
2413# @device: block device name
2414#
2415# Since: 2.5
2416##
6e0abc25 2417{ 'command': 'x-blockdev-remove-medium',
2814f672
HR
2418 'data': { 'device': 'str' } }
2419
d1299882 2420##
6e0abc25 2421# @x-blockdev-insert-medium:
d1299882
HR
2422#
2423# Inserts a medium (a block driver state tree) into a block device. That block
2424# device's tray must currently be open (unless there is no attached guest
2425# device) and there must be no medium inserted already.
2426#
6e0abc25
HR
2427# This command is still a work in progress and is considered experimental.
2428# Stay away from it unless you want to help with its development.
2429#
716df217
KW
2430# @device: #optional Block device name (deprecated, use @id instead)
2431#
2432# @id: #optional The name or QOM path of the guest device (since: 2.8)
d1299882
HR
2433#
2434# @node-name: name of a node in the block driver state graph
2435#
2436# Since: 2.5
2437##
6e0abc25 2438{ 'command': 'x-blockdev-insert-medium',
716df217
KW
2439 'data': { '*device': 'str',
2440 '*id': 'str',
d1299882
HR
2441 'node-name': 'str'} }
2442
a589569f 2443
39ff43d9
HR
2444##
2445# @BlockdevChangeReadOnlyMode:
2446#
2447# Specifies the new read-only mode of a block device subject to the
2448# @blockdev-change-medium command.
2449#
2450# @retain: Retains the current read-only mode
2451#
2452# @read-only: Makes the device read-only
2453#
2454# @read-write: Makes the device writable
2455#
2456# Since: 2.3
2457##
2458{ 'enum': 'BlockdevChangeReadOnlyMode',
2459 'data': ['retain', 'read-only', 'read-write'] }
2460
2461
24fb4133
HR
2462##
2463# @blockdev-change-medium:
2464#
2465# Changes the medium inserted into a block device by ejecting the current medium
2466# and loading a new image file which is inserted as the new medium (this command
6e0abc25
HR
2467# combines blockdev-open-tray, x-blockdev-remove-medium,
2468# x-blockdev-insert-medium and blockdev-close-tray).
24fb4133
HR
2469#
2470# @device: block device name
2471#
2472# @filename: filename of the new image to be loaded
2473#
2474# @format: #optional, format to open the new image with (defaults to
2475# the probed format)
2476#
39ff43d9
HR
2477# @read-only-mode: #optional, change the read-only mode of the device; defaults
2478# to 'retain'
2479#
24fb4133
HR
2480# Since: 2.5
2481##
2482{ 'command': 'blockdev-change-medium',
2483 'data': { 'device': 'str',
2484 'filename': 'str',
39ff43d9
HR
2485 '*format': 'str',
2486 '*read-only-mode': 'BlockdevChangeReadOnlyMode' } }
24fb4133
HR
2487
2488
a589569f
WX
2489##
2490# @BlockErrorAction
2491#
2492# An enumeration of action that has been taken when a DISK I/O occurs
2493#
2494# @ignore: error has been ignored
2495#
2496# @report: error has been reported to the device
2497#
2498# @stop: error caused VM to be stopped
2499#
2500# Since: 2.1
2501##
2502{ 'enum': 'BlockErrorAction',
2503 'data': [ 'ignore', 'report', 'stop' ] }
5a2d2cbd
WX
2504
2505
c120f0fa
WX
2506##
2507# @BLOCK_IMAGE_CORRUPTED
2508#
9bf040b9 2509# Emitted when a corruption has been detected in a disk image
c120f0fa 2510#
dc881b44
AG
2511# @device: device name. This is always present for compatibility
2512# reasons, but it can be empty ("") if the image does not
2513# have a device name associated.
2514#
2515# @node-name: #optional node name (Since: 2.4)
c120f0fa
WX
2516#
2517# @msg: informative message for human consumption, such as the kind of
2f44a08b
WX
2518# corruption being detected. It should not be parsed by machine as it is
2519# not guaranteed to be stable
c120f0fa
WX
2520#
2521# @offset: #optional, if the corruption resulted from an image access, this is
0caef8f6 2522# the host's access offset into the image
c120f0fa
WX
2523#
2524# @size: #optional, if the corruption resulted from an image access, this is
2525# the access size
2526#
9bf040b9
HR
2527# fatal: if set, the image is marked corrupt and therefore unusable after this
2528# event and must be repaired (Since 2.2; before, every
2529# BLOCK_IMAGE_CORRUPTED event was fatal)
2530#
c120f0fa
WX
2531# Since: 1.7
2532##
2533{ 'event': 'BLOCK_IMAGE_CORRUPTED',
dc881b44
AG
2534 'data': { 'device' : 'str',
2535 '*node-name' : 'str',
2536 'msg' : 'str',
2537 '*offset' : 'int',
2538 '*size' : 'int',
2539 'fatal' : 'bool' } }
c120f0fa 2540
5a2d2cbd
WX
2541##
2542# @BLOCK_IO_ERROR
2543#
2544# Emitted when a disk I/O error occurs
2545#
2546# @device: device name
2547#
2548# @operation: I/O operation
2549#
2550# @action: action that has been taken
2551#
c7c2ff0c
LC
2552# @nospace: #optional true if I/O error was caused due to a no-space
2553# condition. This key is only present if query-block's
2554# io-status is present, please see query-block documentation
2555# for more information (since: 2.2)
2556#
624ff573
LC
2557# @reason: human readable string describing the error cause.
2558# (This field is a debugging aid for humans, it should not
2559# be parsed by applications) (since: 2.2)
2560#
5a2d2cbd
WX
2561# Note: If action is "stop", a STOP event will eventually follow the
2562# BLOCK_IO_ERROR event
2563#
2564# Since: 0.13.0
2565##
2566{ 'event': 'BLOCK_IO_ERROR',
2567 'data': { 'device': 'str', 'operation': 'IoOperationType',
624ff573
LC
2568 'action': 'BlockErrorAction', '*nospace': 'bool',
2569 'reason': 'str' } }
5a2d2cbd 2570
bcada37b
WX
2571##
2572# @BLOCK_JOB_COMPLETED
2573#
2574# Emitted when a block job has completed
2575#
2576# @type: job type
2577#
6aae5be6
AG
2578# @device: The job identifier. Originally the device name but other
2579# values are allowed since QEMU 2.7
bcada37b
WX
2580#
2581# @len: maximum progress value
2582#
2583# @offset: current progress value. On success this is equal to len.
2584# On failure this is less than len
2585#
2586# @speed: rate limit, bytes per second
2587#
2588# @error: #optional, error message. Only present on failure. This field
2589# contains a human-readable error message. There are no semantics
2590# other than that streaming has failed and clients should not try to
2591# interpret the error string
2592#
2593# Since: 1.1
2594##
2595{ 'event': 'BLOCK_JOB_COMPLETED',
2596 'data': { 'type' : 'BlockJobType',
2597 'device': 'str',
2598 'len' : 'int',
2599 'offset': 'int',
2600 'speed' : 'int',
2601 '*error': 'str' } }
2602
2603##
2604# @BLOCK_JOB_CANCELLED
2605#
2606# Emitted when a block job has been cancelled
2607#
2608# @type: job type
2609#
6aae5be6
AG
2610# @device: The job identifier. Originally the device name but other
2611# values are allowed since QEMU 2.7
bcada37b
WX
2612#
2613# @len: maximum progress value
2614#
2615# @offset: current progress value. On success this is equal to len.
2616# On failure this is less than len
2617#
2618# @speed: rate limit, bytes per second
2619#
2620# Since: 1.1
2621##
2622{ 'event': 'BLOCK_JOB_CANCELLED',
2623 'data': { 'type' : 'BlockJobType',
2624 'device': 'str',
2625 'len' : 'int',
2626 'offset': 'int',
2627 'speed' : 'int' } }
2628
5a2d2cbd
WX
2629##
2630# @BLOCK_JOB_ERROR
2631#
2632# Emitted when a block job encounters an error
2633#
6aae5be6
AG
2634# @device: The job identifier. Originally the device name but other
2635# values are allowed since QEMU 2.7
5a2d2cbd
WX
2636#
2637# @operation: I/O operation
2638#
2639# @action: action that has been taken
2640#
2641# Since: 1.3
2642##
2643{ 'event': 'BLOCK_JOB_ERROR',
2644 'data': { 'device' : 'str',
2645 'operation': 'IoOperationType',
823c6863 2646 'action' : 'BlockErrorAction' } }
bcada37b
WX
2647
2648##
2649# @BLOCK_JOB_READY
2650#
2651# Emitted when a block job is ready to complete
2652#
518848a2
MA
2653# @type: job type
2654#
6aae5be6
AG
2655# @device: The job identifier. Originally the device name but other
2656# values are allowed since QEMU 2.7
bcada37b 2657#
518848a2
MA
2658# @len: maximum progress value
2659#
2660# @offset: current progress value. On success this is equal to len.
2661# On failure this is less than len
2662#
2663# @speed: rate limit, bytes per second
2664#
bcada37b
WX
2665# Note: The "ready to complete" status is always reset by a @BLOCK_JOB_ERROR
2666# event
2667#
2668# Since: 1.3
2669##
2670{ 'event': 'BLOCK_JOB_READY',
518848a2
MA
2671 'data': { 'type' : 'BlockJobType',
2672 'device': 'str',
2673 'len' : 'int',
2674 'offset': 'int',
2675 'speed' : 'int' } }
ffeaac9b
HT
2676
2677# @PreallocMode
2678#
2679# Preallocation mode of QEMU image file
2680#
2681# @off: no preallocation
2682# @metadata: preallocate only for metadata
2683# @falloc: like @full preallocation but allocate disk space by
2684# posix_fallocate() rather than writing zeros.
2685# @full: preallocate all data by writing zeros to device to ensure disk
2686# space is really available. @full preallocation also sets up
2687# metadata correctly.
2688#
2689# Since 2.2
2690##
2691{ 'enum': 'PreallocMode',
2692 'data': [ 'off', 'metadata', 'falloc', 'full' ] }
e2462113
FR
2693
2694##
2695# @BLOCK_WRITE_THRESHOLD
2696#
2697# Emitted when writes on block device reaches or exceeds the
2698# configured write threshold. For thin-provisioned devices, this
2699# means the device should be extended to avoid pausing for
2700# disk exhaustion.
2701# The event is one shot. Once triggered, it needs to be
2702# re-registered with another block-set-threshold command.
2703#
2704# @node-name: graph node name on which the threshold was exceeded.
2705#
2706# @amount-exceeded: amount of data which exceeded the threshold, in bytes.
2707#
2708# @write-threshold: last configured threshold, in bytes.
2709#
2710# Since: 2.3
2711##
2712{ 'event': 'BLOCK_WRITE_THRESHOLD',
2713 'data': { 'node-name': 'str',
2714 'amount-exceeded': 'uint64',
2715 'write-threshold': 'uint64' } }
2716
2717##
2718# @block-set-write-threshold
2719#
2720# Change the write threshold for a block drive. An event will be delivered
2721# if a write to this block drive crosses the configured threshold.
2722# This is useful to transparently resize thin-provisioned drives without
2723# the guest OS noticing.
2724#
2725# @node-name: graph node name on which the threshold must be set.
2726#
2727# @write-threshold: configured threshold for the block device, bytes.
2728# Use 0 to disable the threshold.
2729#
e2462113
FR
2730# Since: 2.3
2731##
2732{ 'command': 'block-set-write-threshold',
2733 'data': { 'node-name': 'str', 'write-threshold': 'uint64' } }
7f821597
WC
2734
2735##
2736# @x-blockdev-change
2737#
2738# Dynamically reconfigure the block driver state graph. It can be used
2739# to add, remove, insert or replace a graph node. Currently only the
2740# Quorum driver implements this feature to add or remove its child. This
2741# is useful to fix a broken quorum child.
2742#
2743# If @node is specified, it will be inserted under @parent. @child
2744# may not be specified in this case. If both @parent and @child are
2745# specified but @node is not, @child will be detached from @parent.
2746#
2747# @parent: the id or name of the parent node.
2748#
2749# @child: #optional the name of a child under the given parent node.
2750#
2751# @node: #optional the name of the node that will be added.
2752#
2753# Note: this command is experimental, and its API is not stable. It
2754# does not support all kinds of operations, all kinds of children, nor
2755# all block drivers.
2756#
2757# Warning: The data in a new quorum child MUST be consistent with that of
2758# the rest of the array.
2759#
2760# Since: 2.7
2761##
2762{ 'command': 'x-blockdev-change',
2763 'data' : { 'parent': 'str',
2764 '*child': 'str',
2765 '*node': 'str' } }