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