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