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