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