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