]> git.proxmox.com Git - mirror_qemu.git/blame - qapi/block-core.json
iotests: Specify format for qemu-nbd
[mirror_qemu.git] / qapi / block-core.json
CommitLineData
5db15096
BC
1# -*- Mode: Python -*-
2#
3# QAPI block core definitions (vm unrelated)
4
5# QAPI common definitions
6{ 'include': 'common.json' }
1ad166b6
BC
7
8##
9# @SnapshotInfo
10#
11# @id: unique snapshot id
12#
13# @name: user chosen name
14#
15# @vm-state-size: size of the VM state
16#
17# @date-sec: UTC date of the snapshot in seconds
18#
19# @date-nsec: fractional part in nano seconds to be used with date-sec
20#
21# @vm-clock-sec: VM clock relative to boot in seconds
22#
23# @vm-clock-nsec: fractional part in nano seconds to be used with vm-clock-sec
24#
25# Since: 1.3
26#
27##
28
29{ 'type': 'SnapshotInfo',
30 'data': { 'id': 'str', 'name': 'str', 'vm-state-size': 'int',
31 'date-sec': 'int', 'date-nsec': 'int',
32 'vm-clock-sec': 'int', 'vm-clock-nsec': 'int' } }
33
34##
35# @ImageInfoSpecificQCow2:
36#
37# @compat: compatibility level
38#
39# @lazy-refcounts: #optional on or off; only valid for compat >= 1.1
40#
9009b196
HR
41# @corrupt: #optional true if the image has been marked corrupt; only valid for
42# compat >= 1.1 (since 2.2)
43#
1ad166b6
BC
44# Since: 1.7
45##
46{ 'type': 'ImageInfoSpecificQCow2',
47 'data': {
48 'compat': 'str',
9009b196
HR
49 '*lazy-refcounts': 'bool',
50 '*corrupt': 'bool'
1ad166b6
BC
51 } }
52
53##
54# @ImageInfoSpecificVmdk:
55#
56# @create-type: The create type of VMDK image
57#
58# @cid: Content id of image
59#
60# @parent-cid: Parent VMDK image's cid
61#
62# @extents: List of extent files
63#
64# Since: 1.7
65##
66{ 'type': 'ImageInfoSpecificVmdk',
67 'data': {
68 'create-type': 'str',
69 'cid': 'int',
70 'parent-cid': 'int',
71 'extents': ['ImageInfo']
72 } }
73
74##
75# @ImageInfoSpecific:
76#
77# A discriminated record of image format specific information structures.
78#
79# Since: 1.7
80##
81
82{ 'union': 'ImageInfoSpecific',
83 'data': {
84 'qcow2': 'ImageInfoSpecificQCow2',
85 'vmdk': 'ImageInfoSpecificVmdk'
86 } }
87
88##
89# @ImageInfo:
90#
91# Information about a QEMU image file
92#
93# @filename: name of the image file
94#
95# @format: format of the image file
96#
97# @virtual-size: maximum capacity in bytes of the image
98#
99# @actual-size: #optional actual size on disk in bytes of the image
100#
101# @dirty-flag: #optional true if image is not cleanly closed
102#
103# @cluster-size: #optional size of a cluster in bytes
104#
105# @encrypted: #optional true if the image is encrypted
106#
107# @compressed: #optional true if the image is compressed (Since 1.7)
108#
109# @backing-filename: #optional name of the backing file
110#
111# @full-backing-filename: #optional full path of the backing file
112#
113# @backing-filename-format: #optional the format of the backing file
114#
115# @snapshots: #optional list of VM snapshots
116#
117# @backing-image: #optional info of the backing image (since 1.6)
118#
119# @format-specific: #optional structure supplying additional format-specific
120# information (since 1.7)
121#
122# Since: 1.3
123#
124##
125
126{ 'type': 'ImageInfo',
127 'data': {'filename': 'str', 'format': 'str', '*dirty-flag': 'bool',
128 '*actual-size': 'int', 'virtual-size': 'int',
129 '*cluster-size': 'int', '*encrypted': 'bool', '*compressed': 'bool',
130 '*backing-filename': 'str', '*full-backing-filename': 'str',
131 '*backing-filename-format': 'str', '*snapshots': ['SnapshotInfo'],
132 '*backing-image': 'ImageInfo',
24bf10da 133 '*format-specific': 'ImageInfoSpecific' } }
1ad166b6
BC
134
135##
136# @ImageCheck:
137#
138# Information about a QEMU image file check
139#
140# @filename: name of the image file checked
141#
142# @format: format of the image file checked
143#
144# @check-errors: number of unexpected errors occurred during check
145#
146# @image-end-offset: #optional offset (in bytes) where the image ends, this
147# field is present if the driver for the image format
148# supports it
149#
150# @corruptions: #optional number of corruptions found during the check if any
151#
152# @leaks: #optional number of leaks found during the check if any
153#
154# @corruptions-fixed: #optional number of corruptions fixed during the check
155# if any
156#
157# @leaks-fixed: #optional number of leaks fixed during the check if any
158#
159# @total-clusters: #optional total number of clusters, this field is present
160# if the driver for the image format supports it
161#
162# @allocated-clusters: #optional total number of allocated clusters, this
163# field is present if the driver for the image format
164# supports it
165#
166# @fragmented-clusters: #optional total number of fragmented clusters, this
167# field is present if the driver for the image format
168# supports it
169#
170# @compressed-clusters: #optional total number of compressed clusters, this
171# field is present if the driver for the image format
172# supports it
173#
174# Since: 1.4
175#
176##
177
178{ 'type': 'ImageCheck',
179 'data': {'filename': 'str', 'format': 'str', 'check-errors': 'int',
180 '*image-end-offset': 'int', '*corruptions': 'int', '*leaks': 'int',
181 '*corruptions-fixed': 'int', '*leaks-fixed': 'int',
182 '*total-clusters': 'int', '*allocated-clusters': 'int',
183 '*fragmented-clusters': 'int', '*compressed-clusters': 'int' } }
184
9e193c5a
KW
185##
186# @BlockdevCacheInfo
187#
188# Cache mode information for a block device
189#
190# @writeback: true if writeback mode is enabled
191# @direct: true if the host page cache is bypassed (O_DIRECT)
192# @no-flush: true if flush requests are ignored for the device
193#
194# Since: 2.3
195##
196{ 'type': 'BlockdevCacheInfo',
197 'data': { 'writeback': 'bool',
198 'direct': 'bool',
199 'no-flush': 'bool' } }
200
1ad166b6
BC
201##
202# @BlockDeviceInfo:
203#
204# Information about the backing device for a block device.
205#
206# @file: the filename of the backing device
207#
208# @node-name: #optional the name of the block driver node (Since 2.0)
209#
210# @ro: true if the backing device was open read-only
211#
212# @drv: the name of the block format used to open the backing device. As of
213# 0.14.0 this can be: 'blkdebug', 'bochs', 'cloop', 'cow', 'dmg',
214# 'file', 'file', 'ftp', 'ftps', 'host_cdrom', 'host_device',
215# 'host_floppy', 'http', 'https', 'nbd', 'parallels', 'qcow',
216# 'qcow2', 'raw', 'tftp', 'vdi', 'vmdk', 'vpc', 'vvfat'
550830f9 217# 2.2: 'archipelago' added, 'cow' dropped
1ad166b6
BC
218#
219# @backing_file: #optional the name of the backing file (for copy-on-write)
220#
221# @backing_file_depth: number of files in the backing file chain (since: 1.2)
222#
223# @encrypted: true if the backing device is encrypted
224#
225# @encryption_key_missing: true if the backing device is encrypted but an
226# valid encryption key is missing
227#
228# @detect_zeroes: detect and optimize zero writes (Since 2.1)
229#
230# @bps: total throughput limit in bytes per second is specified
231#
232# @bps_rd: read throughput limit in bytes per second is specified
233#
234# @bps_wr: write throughput limit in bytes per second is specified
235#
236# @iops: total I/O operations per second is specified
237#
238# @iops_rd: read I/O operations per second is specified
239#
240# @iops_wr: write I/O operations per second is specified
241#
242# @image: the info of image used (since: 1.6)
243#
244# @bps_max: #optional total max in bytes (Since 1.7)
245#
246# @bps_rd_max: #optional read max in bytes (Since 1.7)
247#
248# @bps_wr_max: #optional write max in bytes (Since 1.7)
249#
250# @iops_max: #optional total I/O operations max (Since 1.7)
251#
252# @iops_rd_max: #optional read I/O operations max (Since 1.7)
253#
254# @iops_wr_max: #optional write I/O operations max (Since 1.7)
255#
256# @iops_size: #optional an I/O size in bytes (Since 1.7)
257#
9e193c5a
KW
258# @cache: the cache mode used for the block device (since: 2.3)
259#
1ad166b6
BC
260# Since: 0.14.0
261#
262##
263{ 'type': 'BlockDeviceInfo',
264 'data': { 'file': 'str', '*node-name': 'str', 'ro': 'bool', 'drv': 'str',
265 '*backing_file': 'str', 'backing_file_depth': 'int',
266 'encrypted': 'bool', 'encryption_key_missing': 'bool',
267 'detect_zeroes': 'BlockdevDetectZeroesOptions',
268 'bps': 'int', 'bps_rd': 'int', 'bps_wr': 'int',
269 'iops': 'int', 'iops_rd': 'int', 'iops_wr': 'int',
270 'image': 'ImageInfo',
271 '*bps_max': 'int', '*bps_rd_max': 'int',
272 '*bps_wr_max': 'int', '*iops_max': 'int',
273 '*iops_rd_max': 'int', '*iops_wr_max': 'int',
9e193c5a 274 '*iops_size': 'int', 'cache': 'BlockdevCacheInfo' } }
1ad166b6
BC
275
276##
277# @BlockDeviceIoStatus:
278#
279# An enumeration of block device I/O status.
280#
281# @ok: The last I/O operation has succeeded
282#
283# @failed: The last I/O operation has failed
284#
285# @nospace: The last I/O operation has failed due to a no-space condition
286#
287# Since: 1.0
288##
289{ 'enum': 'BlockDeviceIoStatus', 'data': [ 'ok', 'failed', 'nospace' ] }
290
291##
292# @BlockDeviceMapEntry:
293#
294# Entry in the metadata map of the device (returned by "qemu-img map")
295#
296# @start: Offset in the image of the first byte described by this entry
297# (in bytes)
298#
299# @length: Length of the range described by this entry (in bytes)
300#
301# @depth: Number of layers (0 = top image, 1 = top image's backing file, etc.)
302# before reaching one for which the range is allocated. The value is
303# in the range 0 to the depth of the image chain - 1.
304#
305# @zero: the sectors in this range read as zeros
306#
307# @data: reading the image will actually read data from a file (in particular,
308# if @offset is present this means that the sectors are not simply
309# preallocated, but contain actual data in raw format)
310#
311# @offset: if present, the image file stores the data for this range in
312# raw format at the given offset.
313#
314# Since 1.7
315##
316{ 'type': 'BlockDeviceMapEntry',
317 'data': { 'start': 'int', 'length': 'int', 'depth': 'int', 'zero': 'bool',
318 'data': 'bool', '*offset': 'int' } }
319
320##
321# @BlockDirtyInfo:
322#
323# Block dirty bitmap information.
324#
325# @count: number of dirty bytes according to the dirty bitmap
326#
327# @granularity: granularity of the dirty bitmap in bytes (since 1.4)
328#
329# Since: 1.3
330##
331{ 'type': 'BlockDirtyInfo',
332 'data': {'count': 'int', 'granularity': 'int'} }
333
334##
335# @BlockInfo:
336#
337# Block device information. This structure describes a virtual device and
338# the backing device associated with it.
339#
340# @device: The device name associated with the virtual device.
341#
342# @type: This field is returned only for compatibility reasons, it should
343# not be used (always returns 'unknown')
344#
345# @removable: True if the device supports removable media.
346#
347# @locked: True if the guest has locked this device from having its media
348# removed
349#
350# @tray_open: #optional True if the device has a tray and it is open
351# (only present if removable is true)
352#
353# @dirty-bitmaps: #optional dirty bitmaps information (only present if the
354# driver has one or more dirty bitmaps) (Since 2.0)
355#
356# @io-status: #optional @BlockDeviceIoStatus. Only present if the device
357# supports it and the VM is configured to stop on errors
c7c2ff0c 358# (supported device models: virtio-blk, ide, scsi-disk)
1ad166b6
BC
359#
360# @inserted: #optional @BlockDeviceInfo describing the device if media is
361# present
362#
363# Since: 0.14.0
364##
365{ 'type': 'BlockInfo',
366 'data': {'device': 'str', 'type': 'str', 'removable': 'bool',
367 'locked': 'bool', '*inserted': 'BlockDeviceInfo',
368 '*tray_open': 'bool', '*io-status': 'BlockDeviceIoStatus',
369 '*dirty-bitmaps': ['BlockDirtyInfo'] } }
370
371##
372# @query-block:
373#
374# Get a list of BlockInfo for all virtual block devices.
375#
376# Returns: a list of @BlockInfo describing each virtual block device
377#
378# Since: 0.14.0
379##
380{ 'command': 'query-block', 'returns': ['BlockInfo'] }
381
382##
383# @BlockDeviceStats:
384#
385# Statistics of a virtual block device or a block backing device.
386#
387# @rd_bytes: The number of bytes read by the device.
388#
389# @wr_bytes: The number of bytes written by the device.
390#
391# @rd_operations: The number of read operations performed by the device.
392#
393# @wr_operations: The number of write operations performed by the device.
394#
395# @flush_operations: The number of cache flush operations performed by the
396# device (since 0.15.0)
397#
398# @flush_total_time_ns: Total time spend on cache flushes in nano-seconds
399# (since 0.15.0).
400#
401# @wr_total_time_ns: Total time spend on writes in nano-seconds (since 0.15.0).
402#
403# @rd_total_time_ns: Total_time_spend on reads in nano-seconds (since 0.15.0).
404#
405# @wr_highest_offset: The offset after the greatest byte written to the
406# device. The intended use of this information is for
407# growable sparse files (like qcow2) that are used on top
408# of a physical device.
409#
f4564d53
PL
410# @rd_merged: Number of read requests that have been merged into another
411# request (Since 2.3).
412#
413# @wr_merged: Number of write requests that have been merged into another
414# request (Since 2.3).
415#
1ad166b6
BC
416# Since: 0.14.0
417##
418{ 'type': 'BlockDeviceStats',
419 'data': {'rd_bytes': 'int', 'wr_bytes': 'int', 'rd_operations': 'int',
420 'wr_operations': 'int', 'flush_operations': 'int',
421 'flush_total_time_ns': 'int', 'wr_total_time_ns': 'int',
f4564d53
PL
422 'rd_total_time_ns': 'int', 'wr_highest_offset': 'int',
423 'rd_merged': 'int', 'wr_merged': 'int' } }
1ad166b6
BC
424
425##
426# @BlockStats:
427#
428# Statistics of a virtual block device or a block backing device.
429#
430# @device: #optional If the stats are for a virtual block device, the name
431# corresponding to the virtual block device.
432#
a06e4355 433# @node-name: #optional The node name of the device. (Since 2.3)
4875a779 434#
1ad166b6
BC
435# @stats: A @BlockDeviceStats for the device.
436#
437# @parent: #optional This describes the file block device if it has one.
438#
439# @backing: #optional This describes the backing block device if it has one.
440# (Since 2.0)
441#
442# Since: 0.14.0
443##
444{ 'type': 'BlockStats',
4875a779
FZ
445 'data': {'*device': 'str', '*node-name': 'str',
446 'stats': 'BlockDeviceStats',
1ad166b6
BC
447 '*parent': 'BlockStats',
448 '*backing': 'BlockStats'} }
449
450##
451# @query-blockstats:
452#
453# Query the @BlockStats for all virtual block devices.
454#
f71eaa74
FZ
455# @query-nodes: #optional If true, the command will query all the block nodes
456# that have a node name, in a list which will include "parent"
457# information, but not "backing".
458# If false or omitted, the behavior is as before - query all the
459# device backends, recursively including their "parent" and
460# "backing". (Since 2.3)
461#
1ad166b6
BC
462# Returns: A list of @BlockStats for each virtual block devices.
463#
464# Since: 0.14.0
465##
f71eaa74
FZ
466{ 'command': 'query-blockstats',
467 'data': { '*query-nodes': 'bool' },
468 'returns': ['BlockStats'] }
1ad166b6
BC
469
470##
471# @BlockdevOnError:
472#
473# An enumeration of possible behaviors for errors on I/O operations.
474# The exact meaning depends on whether the I/O was initiated by a guest
475# or by a block job
476#
477# @report: for guest operations, report the error to the guest;
478# for jobs, cancel the job
479#
480# @ignore: ignore the error, only report a QMP event (BLOCK_IO_ERROR
481# or BLOCK_JOB_ERROR)
482#
483# @enospc: same as @stop on ENOSPC, same as @report otherwise.
484#
485# @stop: for guest operations, stop the virtual machine;
486# for jobs, pause the job
487#
488# Since: 1.3
489##
490{ 'enum': 'BlockdevOnError',
491 'data': ['report', 'ignore', 'enospc', 'stop'] }
492
493##
494# @MirrorSyncMode:
495#
496# An enumeration of possible behaviors for the initial synchronization
497# phase of storage mirroring.
498#
499# @top: copies data in the topmost image to the destination
500#
501# @full: copies data from all images to the destination
502#
503# @none: only copy data written from now on
504#
505# Since: 1.3
506##
507{ 'enum': 'MirrorSyncMode',
508 'data': ['top', 'full', 'none'] }
509
510##
511# @BlockJobType:
512#
513# Type of a block job.
514#
515# @commit: block commit job type, see "block-commit"
516#
517# @stream: block stream job type, see "block-stream"
518#
519# @mirror: drive mirror job type, see "drive-mirror"
520#
521# @backup: drive backup job type, see "drive-backup"
522#
523# Since: 1.7
524##
525{ 'enum': 'BlockJobType',
526 'data': ['commit', 'stream', 'mirror', 'backup'] }
527
528##
529# @BlockJobInfo:
530#
531# Information about a long-running block device operation.
532#
533# @type: the job type ('stream' for image streaming)
534#
535# @device: the block device name
536#
537# @len: the maximum progress value
538#
539# @busy: false if the job is known to be in a quiescent state, with
540# no pending I/O. Since 1.3.
541#
542# @paused: whether the job is paused or, if @busy is true, will
543# pause itself as soon as possible. Since 1.3.
544#
545# @offset: the current progress value
546#
547# @speed: the rate limit, bytes per second
548#
549# @io-status: the status of the job (since 1.3)
550#
ef6dbf1e
HR
551# @ready: true if the job may be completed (since 2.2)
552#
1ad166b6
BC
553# Since: 1.1
554##
555{ 'type': 'BlockJobInfo',
556 'data': {'type': 'str', 'device': 'str', 'len': 'int',
557 'offset': 'int', 'busy': 'bool', 'paused': 'bool', 'speed': 'int',
ef6dbf1e 558 'io-status': 'BlockDeviceIoStatus', 'ready': 'bool'} }
1ad166b6
BC
559
560##
561# @query-block-jobs:
562#
563# Return information about long-running block device operations.
564#
565# Returns: a list of @BlockJobInfo for each active block job
566#
567# Since: 1.1
568##
569{ 'command': 'query-block-jobs', 'returns': ['BlockJobInfo'] }
570
571##
572# @block_passwd:
573#
574# This command sets the password of a block device that has not been open
575# with a password and requires one.
576#
577# The two cases where this can happen are a block device is created through
578# QEMU's initial command line or a block device is changed through the legacy
579# @change interface.
580#
581# In the event that the block device is created through the initial command
582# line, the VM will start in the stopped state regardless of whether '-S' is
583# used. The intention is for a management tool to query the block devices to
584# determine which ones are encrypted, set the passwords with this command, and
585# then start the guest with the @cont command.
586#
587# Either @device or @node-name must be set but not both.
588#
589# @device: #optional the name of the block backend device to set the password on
590#
591# @node-name: #optional graph node name to set the password on (Since 2.0)
592#
593# @password: the password to use for the device
594#
595# Returns: nothing on success
596# If @device is not a valid block device, DeviceNotFound
597# If @device is not encrypted, DeviceNotEncrypted
598#
599# Notes: Not all block formats support encryption and some that do are not
600# able to validate that a password is correct. Disk corruption may
601# occur if an invalid password is specified.
602#
603# Since: 0.14.0
604##
605{ 'command': 'block_passwd', 'data': {'*device': 'str',
606 '*node-name': 'str', 'password': 'str'} }
607
608##
609# @block_resize
610#
611# Resize a block image while a guest is running.
612#
613# Either @device or @node-name must be set but not both.
614#
615# @device: #optional the name of the device to get the image resized
616#
617# @node-name: #optional graph node name to get the image resized (Since 2.0)
618#
619# @size: new image size in bytes
620#
621# Returns: nothing on success
622# If @device is not a valid block device, DeviceNotFound
623#
624# Since: 0.14.0
625##
626{ 'command': 'block_resize', 'data': { '*device': 'str',
627 '*node-name': 'str',
628 'size': 'int' }}
629
630##
631# @NewImageMode
632#
633# An enumeration that tells QEMU how to set the backing file path in
634# a new image file.
635#
636# @existing: QEMU should look for an existing image file.
637#
638# @absolute-paths: QEMU should create a new image with absolute paths
639# for the backing file. If there is no backing file available, the new
640# image will not be backed either.
641#
642# Since: 1.1
643##
644{ 'enum': 'NewImageMode',
645 'data': [ 'existing', 'absolute-paths' ] }
646
647##
648# @BlockdevSnapshot
649#
650# Either @device or @node-name must be set but not both.
651#
652# @device: #optional the name of the device to generate the snapshot from.
653#
654# @node-name: #optional graph node name to generate the snapshot from (Since 2.0)
655#
656# @snapshot-file: the target of the new image. A new file will be created.
657#
658# @snapshot-node-name: #optional the graph node name of the new image (Since 2.0)
659#
660# @format: #optional the format of the snapshot image, default is 'qcow2'.
661#
662# @mode: #optional whether and how QEMU should create a new image, default is
663# 'absolute-paths'.
664##
665{ 'type': 'BlockdevSnapshot',
666 'data': { '*device': 'str', '*node-name': 'str',
667 'snapshot-file': 'str', '*snapshot-node-name': 'str',
668 '*format': 'str', '*mode': 'NewImageMode' } }
669
670##
671# @DriveBackup
672#
673# @device: the name of the device which should be copied.
674#
675# @target: the target of the new image. If the file exists, or if it
676# is a device, the existing file/device will be used as the new
677# destination. If it does not exist, a new file will be created.
678#
679# @format: #optional the format of the new destination, default is to
680# probe if @mode is 'existing', else the format of the source
681#
682# @sync: what parts of the disk image should be copied to the destination
683# (all the disk, only the sectors allocated in the topmost image, or
684# only new I/O).
685#
686# @mode: #optional whether and how QEMU should create a new image, default is
687# 'absolute-paths'.
688#
689# @speed: #optional the maximum speed, in bytes per second
690#
691# @on-source-error: #optional the action to take on an error on the source,
692# default 'report'. 'stop' and 'enospc' can only be used
693# if the block device supports io-status (see BlockInfo).
694#
695# @on-target-error: #optional the action to take on an error on the target,
696# default 'report' (no limitations, since this applies to
697# a different block device than @device).
698#
699# Note that @on-source-error and @on-target-error only affect background I/O.
700# If an error occurs during a guest write request, the device's rerror/werror
701# actions will be used.
702#
703# Since: 1.6
704##
705{ 'type': 'DriveBackup',
706 'data': { 'device': 'str', 'target': 'str', '*format': 'str',
707 'sync': 'MirrorSyncMode', '*mode': 'NewImageMode',
708 '*speed': 'int',
709 '*on-source-error': 'BlockdevOnError',
710 '*on-target-error': 'BlockdevOnError' } }
711
c29c1dd3
FZ
712##
713# @BlockdevBackup
714#
715# @device: the name of the device which should be copied.
716#
717# @target: the name of the backup target device.
718#
719# @sync: what parts of the disk image should be copied to the destination
720# (all the disk, only the sectors allocated in the topmost image, or
721# only new I/O).
722#
723# @speed: #optional the maximum speed, in bytes per second. The default is 0,
724# for unlimited.
725#
726# @on-source-error: #optional the action to take on an error on the source,
727# default 'report'. 'stop' and 'enospc' can only be used
728# if the block device supports io-status (see BlockInfo).
729#
730# @on-target-error: #optional the action to take on an error on the target,
731# default 'report' (no limitations, since this applies to
732# a different block device than @device).
733#
734# Note that @on-source-error and @on-target-error only affect background I/O.
735# If an error occurs during a guest write request, the device's rerror/werror
736# actions will be used.
737#
738# Since: 2.3
739##
740{ 'type': 'BlockdevBackup',
741 'data': { 'device': 'str', 'target': 'str',
742 'sync': 'MirrorSyncMode',
743 '*speed': 'int',
744 '*on-source-error': 'BlockdevOnError',
745 '*on-target-error': 'BlockdevOnError' } }
746
1ad166b6
BC
747##
748# @blockdev-snapshot-sync
749#
750# Generates a synchronous snapshot of a block device.
751#
752# For the arguments, see the documentation of BlockdevSnapshot.
753#
754# Returns: nothing on success
755# If @device is not a valid block device, DeviceNotFound
756#
757# Since 0.14.0
758##
759{ 'command': 'blockdev-snapshot-sync',
760 'data': 'BlockdevSnapshot' }
761
fa40e656
JC
762##
763# @change-backing-file
764#
765# Change the backing file in the image file metadata. This does not
766# cause QEMU to reopen the image file to reparse the backing filename
767# (it may, however, perform a reopen to change permissions from
768# r/o -> r/w -> r/o, if needed). The new backing file string is written
769# into the image file metadata, and the QEMU internal strings are
770# updated.
771#
772# @image-node-name: The name of the block driver state node of the
773# image to modify.
774#
775# @device: The name of the device that owns image-node-name.
776#
777# @backing-file: The string to write as the backing file. This
778# string is not validated, so care should be taken
779# when specifying the string or the image chain may
780# not be able to be reopened again.
781#
782# Since: 2.1
783##
784{ 'command': 'change-backing-file',
785 'data': { 'device': 'str', 'image-node-name': 'str',
786 'backing-file': 'str' } }
787
1ad166b6
BC
788##
789# @block-commit
790#
791# Live commit of data from overlay image nodes into backing nodes - i.e.,
792# writes data between 'top' and 'base' into 'base'.
793#
794# @device: the name of the device
795#
796# @base: #optional The file name of the backing image to write data into.
797# If not specified, this is the deepest backing image
798#
7676e2c5
JC
799# @top: #optional The file name of the backing image within the image chain,
800# which contains the topmost data to be committed down. If
801# not specified, this is the active layer.
1ad166b6 802#
54e26900
JC
803# @backing-file: #optional The backing file string to write into the overlay
804# image of 'top'. If 'top' is the active layer,
805# specifying a backing file string is an error. This
806# filename is not validated.
807#
808# If a pathname string is such that it cannot be
809# resolved by QEMU, that means that subsequent QMP or
810# HMP commands must use node-names for the image in
811# question, as filename lookup methods will fail.
812#
813# If not specified, QEMU will automatically determine
814# the backing file string to use, or error out if
815# there is no obvious choice. Care should be taken
816# when specifying the string, to specify a valid
817# filename or protocol.
818# (Since 2.1)
819#
1ad166b6
BC
820# If top == base, that is an error.
821# If top == active, the job will not be completed by itself,
822# user needs to complete the job with the block-job-complete
823# command after getting the ready event. (Since 2.0)
824#
825# If the base image is smaller than top, then the base image
826# will be resized to be the same size as top. If top is
827# smaller than the base image, the base will not be
828# truncated. If you want the base image size to match the
829# size of the smaller top, you can safely truncate it
830# yourself once the commit operation successfully completes.
831#
1ad166b6
BC
832# @speed: #optional the maximum speed, in bytes per second
833#
834# Returns: Nothing on success
835# If commit or stream is already active on this device, DeviceInUse
836# If @device does not exist, DeviceNotFound
837# If image commit is not supported by this device, NotSupported
838# If @base or @top is invalid, a generic error is returned
839# If @speed is invalid, InvalidParameter
840#
841# Since: 1.3
842#
843##
844{ 'command': 'block-commit',
7676e2c5 845 'data': { 'device': 'str', '*base': 'str', '*top': 'str',
54e26900 846 '*backing-file': 'str', '*speed': 'int' } }
1ad166b6
BC
847
848##
849# @drive-backup
850#
851# Start a point-in-time copy of a block device to a new destination. The
852# status of ongoing drive-backup operations can be checked with
853# query-block-jobs where the BlockJobInfo.type field has the value 'backup'.
854# The operation can be stopped before it has completed using the
855# block-job-cancel command.
856#
857# For the arguments, see the documentation of DriveBackup.
858#
859# Returns: nothing on success
860# If @device is not a valid block device, DeviceNotFound
861#
862# Since 1.6
863##
864{ 'command': 'drive-backup', 'data': 'DriveBackup' }
865
c29c1dd3
FZ
866##
867# @blockdev-backup
868#
869# Start a point-in-time copy of a block device to a new destination. The
870# status of ongoing blockdev-backup operations can be checked with
871# query-block-jobs where the BlockJobInfo.type field has the value 'backup'.
872# The operation can be stopped before it has completed using the
873# block-job-cancel command.
874#
875# For the arguments, see the documentation of BlockdevBackup.
876#
877# Returns: Nothing on success.
878# If @device or @target is not a valid block device, DeviceNotFound.
879#
880# Since 2.3
881##
882{ 'command': 'blockdev-backup', 'data': 'BlockdevBackup' }
883
884
1ad166b6
BC
885##
886# @query-named-block-nodes
887#
888# Get the named block driver list
889#
890# Returns: the list of BlockDeviceInfo
891#
892# Since 2.0
893##
894{ 'command': 'query-named-block-nodes', 'returns': [ 'BlockDeviceInfo' ] }
895
896##
897# @drive-mirror
898#
899# Start mirroring a block device's writes to a new destination.
900#
901# @device: the name of the device whose writes should be mirrored.
902#
903# @target: the target of the new image. If the file exists, or if it
904# is a device, the existing file/device will be used as the new
905# destination. If it does not exist, a new file will be created.
906#
907# @format: #optional the format of the new destination, default is to
908# probe if @mode is 'existing', else the format of the source
909#
4c828dc6
BC
910# @node-name: #optional the new block driver state node name in the graph
911# (Since 2.1)
912#
09158f00
BC
913# @replaces: #optional with sync=full graph node name to be replaced by the new
914# image when a whole image copy is done. This can be used to repair
915# broken Quorum files. (Since 2.1)
916#
1ad166b6
BC
917# @mode: #optional whether and how QEMU should create a new image, default is
918# 'absolute-paths'.
919#
920# @speed: #optional the maximum speed, in bytes per second
921#
922# @sync: what parts of the disk image should be copied to the destination
923# (all the disk, only the sectors allocated in the topmost image, or
924# only new I/O).
925#
926# @granularity: #optional granularity of the dirty bitmap, default is 64K
927# if the image format doesn't have clusters, 4K if the clusters
928# are smaller than that, else the cluster size. Must be a
929# power of 2 between 512 and 64M (since 1.4).
930#
931# @buf-size: #optional maximum amount of data in flight from source to
932# target (since 1.4).
933#
934# @on-source-error: #optional the action to take on an error on the source,
935# default 'report'. 'stop' and 'enospc' can only be used
936# if the block device supports io-status (see BlockInfo).
937#
938# @on-target-error: #optional the action to take on an error on the target,
939# default 'report' (no limitations, since this applies to
940# a different block device than @device).
941#
942# Returns: nothing on success
943# If @device is not a valid block device, DeviceNotFound
944#
945# Since 1.3
946##
947{ 'command': 'drive-mirror',
948 'data': { 'device': 'str', 'target': 'str', '*format': 'str',
09158f00 949 '*node-name': 'str', '*replaces': 'str',
1ad166b6
BC
950 'sync': 'MirrorSyncMode', '*mode': 'NewImageMode',
951 '*speed': 'int', '*granularity': 'uint32',
952 '*buf-size': 'int', '*on-source-error': 'BlockdevOnError',
953 '*on-target-error': 'BlockdevOnError' } }
954
955##
956# @block_set_io_throttle:
957#
958# Change I/O throttle limits for a block drive.
959#
960# @device: The name of the device
961#
962# @bps: total throughput limit in bytes per second
963#
964# @bps_rd: read throughput limit in bytes per second
965#
966# @bps_wr: write throughput limit in bytes per second
967#
968# @iops: total I/O operations per second
969#
970# @ops_rd: read I/O operations per second
971#
972# @iops_wr: write I/O operations per second
973#
974# @bps_max: #optional total max in bytes (Since 1.7)
975#
976# @bps_rd_max: #optional read max in bytes (Since 1.7)
977#
978# @bps_wr_max: #optional write max in bytes (Since 1.7)
979#
980# @iops_max: #optional total I/O operations max (Since 1.7)
981#
982# @iops_rd_max: #optional read I/O operations max (Since 1.7)
983#
984# @iops_wr_max: #optional write I/O operations max (Since 1.7)
985#
986# @iops_size: #optional an I/O size in bytes (Since 1.7)
987#
988# Returns: Nothing on success
989# If @device is not a valid block device, DeviceNotFound
990#
991# Since: 1.1
992##
993{ 'command': 'block_set_io_throttle',
994 'data': { 'device': 'str', 'bps': 'int', 'bps_rd': 'int', 'bps_wr': 'int',
995 'iops': 'int', 'iops_rd': 'int', 'iops_wr': 'int',
996 '*bps_max': 'int', '*bps_rd_max': 'int',
997 '*bps_wr_max': 'int', '*iops_max': 'int',
998 '*iops_rd_max': 'int', '*iops_wr_max': 'int',
999 '*iops_size': 'int' } }
1000
1001##
1002# @block-stream:
1003#
1004# Copy data from a backing file into a block device.
1005#
1006# The block streaming operation is performed in the background until the entire
1007# backing file has been copied. This command returns immediately once streaming
1008# has started. The status of ongoing block streaming operations can be checked
1009# with query-block-jobs. The operation can be stopped before it has completed
1010# using the block-job-cancel command.
1011#
1012# If a base file is specified then sectors are not copied from that base file and
1013# its backing chain. When streaming completes the image file will have the base
1014# file as its backing file. This can be used to stream a subset of the backing
1015# file chain instead of flattening the entire image.
1016#
1017# On successful completion the image file is updated to drop the backing file
1018# and the BLOCK_JOB_COMPLETED event is emitted.
1019#
1020# @device: the device name
1021#
1022# @base: #optional the common backing file name
1023#
13d8cc51
JC
1024# @backing-file: #optional The backing file string to write into the active
1025# layer. This filename is not validated.
1026#
1027# If a pathname string is such that it cannot be
1028# resolved by QEMU, that means that subsequent QMP or
1029# HMP commands must use node-names for the image in
1030# question, as filename lookup methods will fail.
1031#
1032# If not specified, QEMU will automatically determine
1033# the backing file string to use, or error out if there
1034# is no obvious choice. Care should be taken when
1035# specifying the string, to specify a valid filename or
1036# protocol.
1037# (Since 2.1)
1038#
1ad166b6
BC
1039# @speed: #optional the maximum speed, in bytes per second
1040#
1041# @on-error: #optional the action to take on an error (default report).
1042# 'stop' and 'enospc' can only be used if the block device
1043# supports io-status (see BlockInfo). Since 1.3.
1044#
1045# Returns: Nothing on success
1046# If @device does not exist, DeviceNotFound
1047#
1048# Since: 1.1
1049##
1050{ 'command': 'block-stream',
13d8cc51
JC
1051 'data': { 'device': 'str', '*base': 'str', '*backing-file': 'str',
1052 '*speed': 'int', '*on-error': 'BlockdevOnError' } }
1ad166b6
BC
1053
1054##
1055# @block-job-set-speed:
1056#
1057# Set maximum speed for a background block operation.
1058#
1059# This command can only be issued when there is an active block job.
1060#
1061# Throttling can be disabled by setting the speed to 0.
1062#
1063# @device: the device name
1064#
1065# @speed: the maximum speed, in bytes per second, or 0 for unlimited.
1066# Defaults to 0.
1067#
1068# Returns: Nothing on success
1069# If no background operation is active on this device, DeviceNotActive
1070#
1071# Since: 1.1
1072##
1073{ 'command': 'block-job-set-speed',
1074 'data': { 'device': 'str', 'speed': 'int' } }
1075
1076##
1077# @block-job-cancel:
1078#
1079# Stop an active background block operation.
1080#
1081# This command returns immediately after marking the active background block
1082# operation for cancellation. It is an error to call this command if no
1083# operation is in progress.
1084#
1085# The operation will cancel as soon as possible and then emit the
1086# BLOCK_JOB_CANCELLED event. Before that happens the job is still visible when
1087# enumerated using query-block-jobs.
1088#
1089# For streaming, the image file retains its backing file unless the streaming
1090# operation happens to complete just as it is being cancelled. A new streaming
1091# operation can be started at a later time to finish copying all data from the
1092# backing file.
1093#
1094# @device: the device name
1095#
1096# @force: #optional whether to allow cancellation of a paused job (default
1097# false). Since 1.3.
1098#
1099# Returns: Nothing on success
1100# If no background operation is active on this device, DeviceNotActive
1101#
1102# Since: 1.1
1103##
1104{ 'command': 'block-job-cancel', 'data': { 'device': 'str', '*force': 'bool' } }
1105
1106##
1107# @block-job-pause:
1108#
1109# Pause an active background block operation.
1110#
1111# This command returns immediately after marking the active background block
1112# operation for pausing. It is an error to call this command if no
1113# operation is in progress. Pausing an already paused job has no cumulative
1114# effect; a single block-job-resume command will resume the job.
1115#
1116# The operation will pause as soon as possible. No event is emitted when
1117# the operation is actually paused. Cancelling a paused job automatically
1118# resumes it.
1119#
1120# @device: the device name
1121#
1122# Returns: Nothing on success
1123# If no background operation is active on this device, DeviceNotActive
1124#
1125# Since: 1.3
1126##
1127{ 'command': 'block-job-pause', 'data': { 'device': 'str' } }
1128
1129##
1130# @block-job-resume:
1131#
1132# Resume an active background block operation.
1133#
1134# This command returns immediately after resuming a paused background block
1135# operation. It is an error to call this command if no operation is in
1136# progress. Resuming an already running job is not an error.
1137#
1138# This command also clears the error status of the job.
1139#
1140# @device: the device name
1141#
1142# Returns: Nothing on success
1143# If no background operation is active on this device, DeviceNotActive
1144#
1145# Since: 1.3
1146##
1147{ 'command': 'block-job-resume', 'data': { 'device': 'str' } }
1148
1149##
1150# @block-job-complete:
1151#
1152# Manually trigger completion of an active background block operation. This
1153# is supported for drive mirroring, where it also switches the device to
1154# write to the target path only. The ability to complete is signaled with
1155# a BLOCK_JOB_READY event.
1156#
1157# This command completes an active background block operation synchronously.
1158# The ordering of this command's return with the BLOCK_JOB_COMPLETED event
1159# is not defined. Note that if an I/O error occurs during the processing of
1160# this command: 1) the command itself will fail; 2) the error will be processed
1161# according to the rerror/werror arguments that were specified when starting
1162# the operation.
1163#
1164# A cancelled or paused job cannot be completed.
1165#
1166# @device: the device name
1167#
1168# Returns: Nothing on success
1169# If no background operation is active on this device, DeviceNotActive
1170#
1171# Since: 1.3
1172##
1173{ 'command': 'block-job-complete', 'data': { 'device': 'str' } }
1174
1175##
1176# @BlockdevDiscardOptions
1177#
1178# Determines how to handle discard requests.
1179#
1180# @ignore: Ignore the request
1181# @unmap: Forward as an unmap request
1182#
1183# Since: 1.7
1184##
1185{ 'enum': 'BlockdevDiscardOptions',
1186 'data': [ 'ignore', 'unmap' ] }
1187
1188##
1189# @BlockdevDetectZeroesOptions
1190#
1191# Describes the operation mode for the automatic conversion of plain
1192# zero writes by the OS to driver specific optimized zero write commands.
1193#
1194# @off: Disabled (default)
1195# @on: Enabled
1196# @unmap: Enabled and even try to unmap blocks if possible. This requires
1197# also that @BlockdevDiscardOptions is set to unmap for this device.
1198#
1199# Since: 2.1
1200##
1201{ 'enum': 'BlockdevDetectZeroesOptions',
1202 'data': [ 'off', 'on', 'unmap' ] }
1203
1204##
1205# @BlockdevAioOptions
1206#
1207# Selects the AIO backend to handle I/O requests
1208#
1209# @threads: Use qemu's thread pool
1210# @native: Use native AIO backend (only Linux and Windows)
1211#
1212# Since: 1.7
1213##
1214{ 'enum': 'BlockdevAioOptions',
1215 'data': [ 'threads', 'native' ] }
1216
1217##
1218# @BlockdevCacheOptions
1219#
1220# Includes cache-related options for block devices
1221#
1222# @writeback: #optional enables writeback mode for any caches (default: true)
1223# @direct: #optional enables use of O_DIRECT (bypass the host page cache;
1224# default: false)
1225# @no-flush: #optional ignore any flush requests for the device (default:
1226# false)
1227#
1228# Since: 1.7
1229##
1230{ 'type': 'BlockdevCacheOptions',
1231 'data': { '*writeback': 'bool',
1232 '*direct': 'bool',
1233 '*no-flush': 'bool' } }
1234
1235##
1236# @BlockdevDriver
1237#
1238# Drivers that are supported in block device operations.
1239#
1240# @host_device, @host_cdrom, @host_floppy: Since 2.1
1241#
1242# Since: 2.0
1243##
1244{ 'enum': 'BlockdevDriver',
550830f9 1245 'data': [ 'archipelago', 'blkdebug', 'blkverify', 'bochs', 'cloop',
e8712cea
FZ
1246 'dmg', 'file', 'ftp', 'ftps', 'host_cdrom', 'host_device',
1247 'host_floppy', 'http', 'https', 'null-aio', 'null-co', 'parallels',
1248 'qcow', 'qcow2', 'qed', 'quorum', 'raw', 'tftp', 'vdi', 'vhdx',
1249 'vmdk', 'vpc', 'vvfat' ] }
1ad166b6
BC
1250
1251##
1252# @BlockdevOptionsBase
1253#
1254# Options that are available for all block devices, independent of the block
1255# driver.
1256#
1257# @driver: block driver name
1258# @id: #optional id by which the new block device can be referred to.
1259# This is a required option on the top level of blockdev-add, and
1260# currently not allowed on any other level.
1261# @node-name: #optional the name of a block driver state node (Since 2.0)
1262# @discard: #optional discard-related options (default: ignore)
1263# @cache: #optional cache-related options
1264# @aio: #optional AIO backend (default: threads)
1265# @rerror: #optional how to handle read errors on the device
1266# (default: report)
1267# @werror: #optional how to handle write errors on the device
1268# (default: enospc)
1269# @read-only: #optional whether the block device should be read-only
1270# (default: false)
1271# @detect-zeroes: #optional detect and optimize zero writes (Since 2.1)
1272# (default: off)
1273#
1274# Since: 1.7
1275##
1276{ 'type': 'BlockdevOptionsBase',
1277 'data': { 'driver': 'BlockdevDriver',
1278 '*id': 'str',
1279 '*node-name': 'str',
1280 '*discard': 'BlockdevDiscardOptions',
1281 '*cache': 'BlockdevCacheOptions',
1282 '*aio': 'BlockdevAioOptions',
1283 '*rerror': 'BlockdevOnError',
1284 '*werror': 'BlockdevOnError',
1285 '*read-only': 'bool',
1286 '*detect-zeroes': 'BlockdevDetectZeroesOptions' } }
1287
1288##
1289# @BlockdevOptionsFile
1290#
1291# Driver specific block device options for the file backend and similar
1292# protocols.
1293#
1294# @filename: path to the image file
1295#
1296# Since: 1.7
1297##
1298{ 'type': 'BlockdevOptionsFile',
1299 'data': { 'filename': 'str' } }
1300
e819ab22
FZ
1301##
1302# @BlockdevOptionsNull
1303#
1304# Driver specific block device options for the null backend.
1305#
1306# @size: #optional size of the device in bytes.
1307#
1308# Since: 2.2
1309##
1310{ 'type': 'BlockdevOptionsNull',
1311 'data': { '*size': 'int' } }
1312
1ad166b6
BC
1313##
1314# @BlockdevOptionsVVFAT
1315#
1316# Driver specific block device options for the vvfat protocol.
1317#
1318# @dir: directory to be exported as FAT image
1319# @fat-type: #optional FAT type: 12, 16 or 32
1320# @floppy: #optional whether to export a floppy image (true) or
1321# partitioned hard disk (false; default)
1322# @rw: #optional whether to allow write operations (default: false)
1323#
1324# Since: 1.7
1325##
1326{ 'type': 'BlockdevOptionsVVFAT',
1327 'data': { 'dir': 'str', '*fat-type': 'int', '*floppy': 'bool',
1328 '*rw': 'bool' } }
1329
1330##
1331# @BlockdevOptionsGenericFormat
1332#
1333# Driver specific block device options for image format that have no option
1334# besides their data source.
1335#
1336# @file: reference to or definition of the data source block device
1337#
1338# Since: 1.7
1339##
1340{ 'type': 'BlockdevOptionsGenericFormat',
1341 'data': { 'file': 'BlockdevRef' } }
1342
1343##
1344# @BlockdevOptionsGenericCOWFormat
1345#
1346# Driver specific block device options for image format that have no option
1347# besides their data source and an optional backing file.
1348#
1349# @backing: #optional reference to or definition of the backing file block
1350# device (if missing, taken from the image file content). It is
1351# allowed to pass an empty string here in order to disable the
1352# default backing file.
1353#
1354# Since: 1.7
1355##
1356{ 'type': 'BlockdevOptionsGenericCOWFormat',
1357 'base': 'BlockdevOptionsGenericFormat',
1358 'data': { '*backing': 'BlockdevRef' } }
1359
f6585811
HR
1360##
1361# @Qcow2OverlapCheckMode
1362#
1363# General overlap check modes.
1364#
1365# @none: Do not perform any checks
1366#
1367# @constant: Perform only checks which can be done in constant time and
1368# without reading anything from disk
1369#
1370# @cached: Perform only checks which can be done without reading anything
1371# from disk
1372#
1373# @all: Perform all available overlap checks
1374#
1375# Since: 2.2
1376##
1377{ 'enum': 'Qcow2OverlapCheckMode',
1378 'data': [ 'none', 'constant', 'cached', 'all' ] }
1379
1380##
1381# @Qcow2OverlapCheckFlags
1382#
1383# Structure of flags for each metadata structure. Setting a field to 'true'
1384# makes qemu guard that structure against unintended overwriting. The default
1385# value is chosen according to the template given.
1386#
1387# @template: Specifies a template mode which can be adjusted using the other
1388# flags, defaults to 'cached'
1389#
1390# Since: 2.2
1391##
1392{ 'type': 'Qcow2OverlapCheckFlags',
1393 'data': { '*template': 'Qcow2OverlapCheckMode',
1394 '*main-header': 'bool',
1395 '*active-l1': 'bool',
1396 '*active-l2': 'bool',
1397 '*refcount-table': 'bool',
1398 '*refcount-block': 'bool',
1399 '*snapshot-table': 'bool',
1400 '*inactive-l1': 'bool',
1401 '*inactive-l2': 'bool' } }
1402
1403##
1404# @Qcow2OverlapChecks
1405#
1406# Specifies which metadata structures should be guarded against unintended
1407# overwriting.
1408#
1409# @flags: set of flags for separate specification of each metadata structure
1410# type
1411#
1412# @mode: named mode which chooses a specific set of flags
1413#
1414# Since: 2.2
1415##
1416{ 'union': 'Qcow2OverlapChecks',
1417 'discriminator': {},
1418 'data': { 'flags': 'Qcow2OverlapCheckFlags',
1419 'mode': 'Qcow2OverlapCheckMode' } }
1420
1ad166b6
BC
1421##
1422# @BlockdevOptionsQcow2
1423#
1424# Driver specific block device options for qcow2.
1425#
1426# @lazy-refcounts: #optional whether to enable the lazy refcounts
1427# feature (default is taken from the image file)
1428#
1429# @pass-discard-request: #optional whether discard requests to the qcow2
1430# device should be forwarded to the data source
1431#
1432# @pass-discard-snapshot: #optional whether discard requests for the data source
1433# should be issued when a snapshot operation (e.g.
1434# deleting a snapshot) frees clusters in the qcow2 file
1435#
1436# @pass-discard-other: #optional whether discard requests for the data source
1437# should be issued on other occasions where a cluster
1438# gets freed
1439#
f6585811
HR
1440# @overlap-check: #optional which overlap checks to perform for writes
1441# to the image, defaults to 'cached' (since 2.2)
1442#
1443# @cache-size: #optional the maximum total size of the L2 table and
1444# refcount block caches in bytes (since 2.2)
1445#
1446# @l2-cache-size: #optional the maximum size of the L2 table cache in
1447# bytes (since 2.2)
1448#
1449# @refcount-cache-size: #optional the maximum size of the refcount block cache
1450# in bytes (since 2.2)
1451#
1ad166b6
BC
1452# Since: 1.7
1453##
1454{ 'type': 'BlockdevOptionsQcow2',
1455 'base': 'BlockdevOptionsGenericCOWFormat',
1456 'data': { '*lazy-refcounts': 'bool',
1457 '*pass-discard-request': 'bool',
1458 '*pass-discard-snapshot': 'bool',
f6585811
HR
1459 '*pass-discard-other': 'bool',
1460 '*overlap-check': 'Qcow2OverlapChecks',
1461 '*cache-size': 'int',
1462 '*l2-cache-size': 'int',
1463 '*refcount-cache-size': 'int' } }
1ad166b6 1464
b1de5f43
CN
1465
1466##
1467# @BlockdevOptionsArchipelago
1468#
1469# Driver specific block device options for Archipelago.
1470#
1471# @volume: Name of the Archipelago volume image
1472#
1473# @mport: #optional The port number on which mapperd is
1474# listening. This is optional
1475# and if not specified, QEMU will make Archipelago
1476# use the default port (1001).
1477#
1478# @vport: #optional The port number on which vlmcd is
1479# listening. This is optional
1480# and if not specified, QEMU will make Archipelago
1481# use the default port (501).
1482#
1483# @segment: #optional The name of the shared memory segment
1484# Archipelago stack is using. This is optional
1485# and if not specified, QEMU will make Archipelago
1486# use the default value, 'archipelago'.
1487# Since: 2.2
1488##
1489{ 'type': 'BlockdevOptionsArchipelago',
1490 'data': { 'volume': 'str',
1491 '*mport': 'int',
1492 '*vport': 'int',
1493 '*segment': 'str' } }
1494
1495
1ad166b6
BC
1496##
1497# @BlkdebugEvent
1498#
1499# Trigger events supported by blkdebug.
1500##
1501{ 'enum': 'BlkdebugEvent',
1502 'data': [ 'l1_update', 'l1_grow.alloc_table', 'l1_grow.write_table',
1503 'l1_grow.activate_table', 'l2_load', 'l2_update',
1504 'l2_update_compressed', 'l2_alloc.cow_read', 'l2_alloc.write',
1505 'read_aio', 'read_backing_aio', 'read_compressed', 'write_aio',
1506 'write_compressed', 'vmstate_load', 'vmstate_save', 'cow_read',
1507 'cow_write', 'reftable_load', 'reftable_grow', 'reftable_update',
1508 'refblock_load', 'refblock_update', 'refblock_update_part',
1509 'refblock_alloc', 'refblock_alloc.hookup', 'refblock_alloc.write',
1510 'refblock_alloc.write_blocks', 'refblock_alloc.write_table',
1511 'refblock_alloc.switch_table', 'cluster_alloc',
1512 'cluster_alloc_bytes', 'cluster_free', 'flush_to_os',
d21de4d9
HR
1513 'flush_to_disk', 'pwritev_rmw.head', 'pwritev_rmw.after_head',
1514 'pwritev_rmw.tail', 'pwritev_rmw.after_tail', 'pwritev',
1515 'pwritev_zero', 'pwritev_done', 'empty_image_prepare' ] }
1ad166b6
BC
1516
1517##
1518# @BlkdebugInjectErrorOptions
1519#
1520# Describes a single error injection for blkdebug.
1521#
1522# @event: trigger event
1523#
1524# @state: #optional the state identifier blkdebug needs to be in to
1525# actually trigger the event; defaults to "any"
1526#
1527# @errno: #optional error identifier (errno) to be returned; defaults to
1528# EIO
1529#
1530# @sector: #optional specifies the sector index which has to be affected
1531# in order to actually trigger the event; defaults to "any
1532# sector"
1533#
1534# @once: #optional disables further events after this one has been
1535# triggered; defaults to false
1536#
1537# @immediately: #optional fail immediately; defaults to false
1538#
1539# Since: 2.0
1540##
1541{ 'type': 'BlkdebugInjectErrorOptions',
1542 'data': { 'event': 'BlkdebugEvent',
1543 '*state': 'int',
1544 '*errno': 'int',
1545 '*sector': 'int',
1546 '*once': 'bool',
1547 '*immediately': 'bool' } }
1548
1549##
1550# @BlkdebugSetStateOptions
1551#
1552# Describes a single state-change event for blkdebug.
1553#
1554# @event: trigger event
1555#
1556# @state: #optional the current state identifier blkdebug needs to be in;
1557# defaults to "any"
1558#
1559# @new_state: the state identifier blkdebug is supposed to assume if
1560# this event is triggered
1561#
1562# Since: 2.0
1563##
1564{ 'type': 'BlkdebugSetStateOptions',
1565 'data': { 'event': 'BlkdebugEvent',
1566 '*state': 'int',
1567 'new_state': 'int' } }
1568
1569##
1570# @BlockdevOptionsBlkdebug
1571#
1572# Driver specific block device options for blkdebug.
1573#
1574# @image: underlying raw block device (or image file)
1575#
1576# @config: #optional filename of the configuration file
1577#
1578# @align: #optional required alignment for requests in bytes
1579#
1580# @inject-error: #optional array of error injection descriptions
1581#
1582# @set-state: #optional array of state-change descriptions
1583#
1584# Since: 2.0
1585##
1586{ 'type': 'BlockdevOptionsBlkdebug',
1587 'data': { 'image': 'BlockdevRef',
1588 '*config': 'str',
1589 '*align': 'int',
1590 '*inject-error': ['BlkdebugInjectErrorOptions'],
1591 '*set-state': ['BlkdebugSetStateOptions'] } }
1592
1593##
1594# @BlockdevOptionsBlkverify
1595#
1596# Driver specific block device options for blkverify.
1597#
1598# @test: block device to be tested
1599#
1600# @raw: raw image used for verification
1601#
1602# Since: 2.0
1603##
1604{ 'type': 'BlockdevOptionsBlkverify',
1605 'data': { 'test': 'BlockdevRef',
1606 'raw': 'BlockdevRef' } }
1607
62c6031f
LY
1608##
1609# @QuorumReadPattern
1610#
1611# An enumeration of quorum read patterns.
1612#
1613# @quorum: read all the children and do a quorum vote on reads
1614#
1615# @fifo: read only from the first child that has not failed
1616#
1617# Since: 2.2
1618##
1619{ 'enum': 'QuorumReadPattern', 'data': [ 'quorum', 'fifo' ] }
1620
1ad166b6
BC
1621##
1622# @BlockdevOptionsQuorum
1623#
1624# Driver specific block device options for Quorum
1625#
1626# @blkverify: #optional true if the driver must print content mismatch
1627# set to false by default
1628#
1629# @children: the children block devices to use
1630#
1631# @vote-threshold: the vote limit under which a read will fail
1632#
cf29a570
BC
1633# @rewrite-corrupted: #optional rewrite corrupted data when quorum is reached
1634# (Since 2.1)
1635#
62c6031f
LY
1636# @read-pattern: #optional choose read pattern and set to quorum by default
1637# (Since 2.2)
1638#
1ad166b6
BC
1639# Since: 2.0
1640##
1641{ 'type': 'BlockdevOptionsQuorum',
1642 'data': { '*blkverify': 'bool',
1643 'children': [ 'BlockdevRef' ],
62c6031f
LY
1644 'vote-threshold': 'int',
1645 '*rewrite-corrupted': 'bool',
1646 '*read-pattern': 'QuorumReadPattern' } }
1ad166b6
BC
1647
1648##
1649# @BlockdevOptions
1650#
1651# Options for creating a block device.
1652#
1653# Since: 1.7
1654##
1655{ 'union': 'BlockdevOptions',
1656 'base': 'BlockdevOptionsBase',
1657 'discriminator': 'driver',
1658 'data': {
b1de5f43 1659 'archipelago':'BlockdevOptionsArchipelago',
db866be9
FZ
1660 'blkdebug': 'BlockdevOptionsBlkdebug',
1661 'blkverify': 'BlockdevOptionsBlkverify',
1662 'bochs': 'BlockdevOptionsGenericFormat',
1663 'cloop': 'BlockdevOptionsGenericFormat',
db866be9 1664 'dmg': 'BlockdevOptionsGenericFormat',
1ad166b6 1665 'file': 'BlockdevOptionsFile',
db866be9
FZ
1666 'ftp': 'BlockdevOptionsFile',
1667 'ftps': 'BlockdevOptionsFile',
1668# TODO gluster: Wait for structured options
1ad166b6 1669 'host_cdrom': 'BlockdevOptionsFile',
db866be9 1670 'host_device':'BlockdevOptionsFile',
1ad166b6
BC
1671 'host_floppy':'BlockdevOptionsFile',
1672 'http': 'BlockdevOptionsFile',
1673 'https': 'BlockdevOptionsFile',
1ad166b6
BC
1674# TODO iscsi: Wait for structured options
1675# TODO nbd: Should take InetSocketAddress for 'host'?
1676# TODO nfs: Wait for structured options
db866be9
FZ
1677 'null-aio': 'BlockdevOptionsNull',
1678 'null-co': 'BlockdevOptionsNull',
1ad166b6 1679 'parallels': 'BlockdevOptionsGenericFormat',
1ad166b6 1680 'qcow2': 'BlockdevOptionsQcow2',
db866be9 1681 'qcow': 'BlockdevOptionsGenericCOWFormat',
1ad166b6 1682 'qed': 'BlockdevOptionsGenericCOWFormat',
db866be9 1683 'quorum': 'BlockdevOptionsQuorum',
1ad166b6 1684 'raw': 'BlockdevOptionsGenericFormat',
db866be9
FZ
1685# TODO rbd: Wait for structured options
1686# TODO sheepdog: Wait for structured options
1687# TODO ssh: Should take InetSocketAddress for 'host'?
1688 'tftp': 'BlockdevOptionsFile',
1ad166b6
BC
1689 'vdi': 'BlockdevOptionsGenericFormat',
1690 'vhdx': 'BlockdevOptionsGenericFormat',
1691 'vmdk': 'BlockdevOptionsGenericCOWFormat',
1692 'vpc': 'BlockdevOptionsGenericFormat',
db866be9 1693 'vvfat': 'BlockdevOptionsVVFAT'
1ad166b6
BC
1694 } }
1695
1696##
1697# @BlockdevRef
1698#
1699# Reference to a block device.
1700#
1701# @definition: defines a new block device inline
1702# @reference: references the ID of an existing block device. An
1703# empty string means that no block device should be
1704# referenced.
1705#
1706# Since: 1.7
1707##
1708{ 'union': 'BlockdevRef',
1709 'discriminator': {},
1710 'data': { 'definition': 'BlockdevOptions',
1711 'reference': 'str' } }
1712
1713##
1714# @blockdev-add:
1715#
1716# Creates a new block device.
1717#
1718# @options: block device options for the new device
1719#
1720# Since: 1.7
1721##
1722{ 'command': 'blockdev-add', 'data': { 'options': 'BlockdevOptions' } }
1723
a589569f
WX
1724
1725##
1726# @BlockErrorAction
1727#
1728# An enumeration of action that has been taken when a DISK I/O occurs
1729#
1730# @ignore: error has been ignored
1731#
1732# @report: error has been reported to the device
1733#
1734# @stop: error caused VM to be stopped
1735#
1736# Since: 2.1
1737##
1738{ 'enum': 'BlockErrorAction',
1739 'data': [ 'ignore', 'report', 'stop' ] }
5a2d2cbd
WX
1740
1741
c120f0fa
WX
1742##
1743# @BLOCK_IMAGE_CORRUPTED
1744#
9bf040b9 1745# Emitted when a corruption has been detected in a disk image
c120f0fa
WX
1746#
1747# @device: device name
1748#
1749# @msg: informative message for human consumption, such as the kind of
2f44a08b
WX
1750# corruption being detected. It should not be parsed by machine as it is
1751# not guaranteed to be stable
c120f0fa
WX
1752#
1753# @offset: #optional, if the corruption resulted from an image access, this is
1754# the access offset into the image
1755#
1756# @size: #optional, if the corruption resulted from an image access, this is
1757# the access size
1758#
9bf040b9
HR
1759# fatal: if set, the image is marked corrupt and therefore unusable after this
1760# event and must be repaired (Since 2.2; before, every
1761# BLOCK_IMAGE_CORRUPTED event was fatal)
1762#
c120f0fa
WX
1763# Since: 1.7
1764##
1765{ 'event': 'BLOCK_IMAGE_CORRUPTED',
1766 'data': { 'device' : 'str',
1767 'msg' : 'str',
1768 '*offset': 'int',
9bf040b9
HR
1769 '*size' : 'int',
1770 'fatal' : 'bool' } }
c120f0fa 1771
5a2d2cbd
WX
1772##
1773# @BLOCK_IO_ERROR
1774#
1775# Emitted when a disk I/O error occurs
1776#
1777# @device: device name
1778#
1779# @operation: I/O operation
1780#
1781# @action: action that has been taken
1782#
c7c2ff0c
LC
1783# @nospace: #optional true if I/O error was caused due to a no-space
1784# condition. This key is only present if query-block's
1785# io-status is present, please see query-block documentation
1786# for more information (since: 2.2)
1787#
624ff573
LC
1788# @reason: human readable string describing the error cause.
1789# (This field is a debugging aid for humans, it should not
1790# be parsed by applications) (since: 2.2)
1791#
5a2d2cbd
WX
1792# Note: If action is "stop", a STOP event will eventually follow the
1793# BLOCK_IO_ERROR event
1794#
1795# Since: 0.13.0
1796##
1797{ 'event': 'BLOCK_IO_ERROR',
1798 'data': { 'device': 'str', 'operation': 'IoOperationType',
624ff573
LC
1799 'action': 'BlockErrorAction', '*nospace': 'bool',
1800 'reason': 'str' } }
5a2d2cbd 1801
bcada37b
WX
1802##
1803# @BLOCK_JOB_COMPLETED
1804#
1805# Emitted when a block job has completed
1806#
1807# @type: job type
1808#
1809# @device: device name
1810#
1811# @len: maximum progress value
1812#
1813# @offset: current progress value. On success this is equal to len.
1814# On failure this is less than len
1815#
1816# @speed: rate limit, bytes per second
1817#
1818# @error: #optional, error message. Only present on failure. This field
1819# contains a human-readable error message. There are no semantics
1820# other than that streaming has failed and clients should not try to
1821# interpret the error string
1822#
1823# Since: 1.1
1824##
1825{ 'event': 'BLOCK_JOB_COMPLETED',
1826 'data': { 'type' : 'BlockJobType',
1827 'device': 'str',
1828 'len' : 'int',
1829 'offset': 'int',
1830 'speed' : 'int',
1831 '*error': 'str' } }
1832
1833##
1834# @BLOCK_JOB_CANCELLED
1835#
1836# Emitted when a block job has been cancelled
1837#
1838# @type: job type
1839#
1840# @device: device name
1841#
1842# @len: maximum progress value
1843#
1844# @offset: current progress value. On success this is equal to len.
1845# On failure this is less than len
1846#
1847# @speed: rate limit, bytes per second
1848#
1849# Since: 1.1
1850##
1851{ 'event': 'BLOCK_JOB_CANCELLED',
1852 'data': { 'type' : 'BlockJobType',
1853 'device': 'str',
1854 'len' : 'int',
1855 'offset': 'int',
1856 'speed' : 'int' } }
1857
5a2d2cbd
WX
1858##
1859# @BLOCK_JOB_ERROR
1860#
1861# Emitted when a block job encounters an error
1862#
1863# @device: device name
1864#
1865# @operation: I/O operation
1866#
1867# @action: action that has been taken
1868#
1869# Since: 1.3
1870##
1871{ 'event': 'BLOCK_JOB_ERROR',
1872 'data': { 'device' : 'str',
1873 'operation': 'IoOperationType',
823c6863 1874 'action' : 'BlockErrorAction' } }
bcada37b
WX
1875
1876##
1877# @BLOCK_JOB_READY
1878#
1879# Emitted when a block job is ready to complete
1880#
518848a2
MA
1881# @type: job type
1882#
bcada37b
WX
1883# @device: device name
1884#
518848a2
MA
1885# @len: maximum progress value
1886#
1887# @offset: current progress value. On success this is equal to len.
1888# On failure this is less than len
1889#
1890# @speed: rate limit, bytes per second
1891#
bcada37b
WX
1892# Note: The "ready to complete" status is always reset by a @BLOCK_JOB_ERROR
1893# event
1894#
1895# Since: 1.3
1896##
1897{ 'event': 'BLOCK_JOB_READY',
518848a2
MA
1898 'data': { 'type' : 'BlockJobType',
1899 'device': 'str',
1900 'len' : 'int',
1901 'offset': 'int',
1902 'speed' : 'int' } }
ffeaac9b
HT
1903
1904# @PreallocMode
1905#
1906# Preallocation mode of QEMU image file
1907#
1908# @off: no preallocation
1909# @metadata: preallocate only for metadata
1910# @falloc: like @full preallocation but allocate disk space by
1911# posix_fallocate() rather than writing zeros.
1912# @full: preallocate all data by writing zeros to device to ensure disk
1913# space is really available. @full preallocation also sets up
1914# metadata correctly.
1915#
1916# Since 2.2
1917##
1918{ 'enum': 'PreallocMode',
1919 'data': [ 'off', 'metadata', 'falloc', 'full' ] }