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