target-arm: reject switching to monitor mode
[qemu.git] / qapi / block-core.json
blob8f7089e05403804489491e8ef6c82b1e5b21eaf1
1 # -*- Mode: Python -*-
3 # QAPI block core definitions (vm unrelated)
5 # QAPI common definitions
6 { 'include': 'common.json' }
8 ##
9 # @SnapshotInfo
11 # @id: unique snapshot id
13 # @name: user chosen name
15 # @vm-state-size: size of the VM state
17 # @date-sec: UTC date of the snapshot in seconds
19 # @date-nsec: fractional part in nano seconds to be used with date-sec
21 # @vm-clock-sec: VM clock relative to boot in seconds
23 # @vm-clock-nsec: fractional part in nano seconds to be used with vm-clock-sec
25 # Since: 1.3
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' } }
35 # @ImageInfoSpecificQCow2:
37 # @compat: compatibility level
39 # @lazy-refcounts: #optional on or off; only valid for compat >= 1.1
41 # @corrupt: #optional true if the image has been marked corrupt; only valid for
42 #           compat >= 1.1 (since 2.2)
44 # Since: 1.7
46 { 'type': 'ImageInfoSpecificQCow2',
47   'data': {
48       'compat': 'str',
49       '*lazy-refcounts': 'bool',
50       '*corrupt': 'bool'
51   } }
54 # @ImageInfoSpecificVmdk:
56 # @create-type: The create type of VMDK image
58 # @cid: Content id of image
60 # @parent-cid: Parent VMDK image's cid
62 # @extents: List of extent files
64 # Since: 1.7
66 { 'type': 'ImageInfoSpecificVmdk',
67   'data': {
68       'create-type': 'str',
69       'cid': 'int',
70       'parent-cid': 'int',
71       'extents': ['ImageInfo']
72   } }
75 # @ImageInfoSpecific:
77 # A discriminated record of image format specific information structures.
79 # Since: 1.7
82 { 'union': 'ImageInfoSpecific',
83   'data': {
84       'qcow2': 'ImageInfoSpecificQCow2',
85       'vmdk': 'ImageInfoSpecificVmdk'
86   } }
89 # @ImageInfo:
91 # Information about a QEMU image file
93 # @filename: name of the image file
95 # @format: format of the image file
97 # @virtual-size: maximum capacity in bytes of the image
99 # @actual-size: #optional actual size on disk in bytes of the image
101 # @dirty-flag: #optional true if image is not cleanly closed
103 # @cluster-size: #optional size of a cluster in bytes
105 # @encrypted: #optional true if the image is encrypted
107 # @compressed: #optional true if the image is compressed (Since 1.7)
109 # @backing-filename: #optional name of the backing file
111 # @full-backing-filename: #optional full path of the backing file
113 # @backing-filename-format: #optional the format of the backing file
115 # @snapshots: #optional list of VM snapshots
117 # @backing-image: #optional info of the backing image (since 1.6)
119 # @format-specific: #optional structure supplying additional format-specific
120 # information (since 1.7)
122 # @nocow: #optional info of whether NOCOW flag is set or not. (since 2.2)
124 # Since: 1.3
128 { 'type': 'ImageInfo',
129   'data': {'filename': 'str', 'format': 'str', '*dirty-flag': 'bool',
130            '*actual-size': 'int', 'virtual-size': 'int',
131            '*cluster-size': 'int', '*encrypted': 'bool', '*compressed': 'bool',
132            '*backing-filename': 'str', '*full-backing-filename': 'str',
133            '*backing-filename-format': 'str', '*snapshots': ['SnapshotInfo'],
134            '*backing-image': 'ImageInfo',
135            '*format-specific': 'ImageInfoSpecific',
136            '*nocow': 'bool' } }
139 # @ImageCheck:
141 # Information about a QEMU image file check
143 # @filename: name of the image file checked
145 # @format: format of the image file checked
147 # @check-errors: number of unexpected errors occurred during check
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
153 # @corruptions: #optional number of corruptions found during the check if any
155 # @leaks: #optional number of leaks found during the check if any
157 # @corruptions-fixed: #optional number of corruptions fixed during the check
158 #                     if any
160 # @leaks-fixed: #optional number of leaks fixed during the check if any
162 # @total-clusters: #optional total number of clusters, this field is present
163 #                  if the driver for the image format supports it
165 # @allocated-clusters: #optional total number of allocated clusters, this
166 #                      field is present if the driver for the image format
167 #                      supports it
169 # @fragmented-clusters: #optional total number of fragmented clusters, this
170 #                       field is present if the driver for the image format
171 #                       supports it
173 # @compressed-clusters: #optional total number of compressed clusters, this
174 #                       field is present if the driver for the image format
175 #                       supports it
177 # Since: 1.4
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' } }
189 # @BlockDeviceInfo:
191 # Information about the backing device for a block device.
193 # @file: the filename of the backing device
195 # @node-name: #optional the name of the block driver node (Since 2.0)
197 # @ro: true if the backing device was open read-only
199 # @drv: the name of the block format used to open the backing device. As of
200 #       0.14.0 this can be: 'blkdebug', 'bochs', 'cloop', 'cow', 'dmg',
201 #       'file', 'file', 'ftp', 'ftps', 'host_cdrom', 'host_device',
202 #       'host_floppy', 'http', 'https', 'nbd', 'parallels', 'qcow',
203 #       'qcow2', 'raw', 'tftp', 'vdi', 'vmdk', 'vpc', 'vvfat'
204 #       2.2: 'archipelago' added, 'cow' dropped
206 # @backing_file: #optional the name of the backing file (for copy-on-write)
208 # @backing_file_depth: number of files in the backing file chain (since: 1.2)
210 # @encrypted: true if the backing device is encrypted
212 # @encryption_key_missing: true if the backing device is encrypted but an
213 #                          valid encryption key is missing
215 # @detect_zeroes: detect and optimize zero writes (Since 2.1)
217 # @bps: total throughput limit in bytes per second is specified
219 # @bps_rd: read throughput limit in bytes per second is specified
221 # @bps_wr: write throughput limit in bytes per second is specified
223 # @iops: total I/O operations per second is specified
225 # @iops_rd: read I/O operations per second is specified
227 # @iops_wr: write I/O operations per second is specified
229 # @image: the info of image used (since: 1.6)
231 # @bps_max: #optional total max in bytes (Since 1.7)
233 # @bps_rd_max: #optional read max in bytes (Since 1.7)
235 # @bps_wr_max: #optional write max in bytes (Since 1.7)
237 # @iops_max: #optional total I/O operations max (Since 1.7)
239 # @iops_rd_max: #optional read I/O operations max (Since 1.7)
241 # @iops_wr_max: #optional write I/O operations max (Since 1.7)
243 # @iops_size: #optional an I/O size in bytes (Since 1.7)
245 # Since: 0.14.0
248 { 'type': 'BlockDeviceInfo',
249   'data': { 'file': 'str', '*node-name': 'str', 'ro': 'bool', 'drv': 'str',
250             '*backing_file': 'str', 'backing_file_depth': 'int',
251             'encrypted': 'bool', 'encryption_key_missing': 'bool',
252             'detect_zeroes': 'BlockdevDetectZeroesOptions',
253             'bps': 'int', 'bps_rd': 'int', 'bps_wr': 'int',
254             'iops': 'int', 'iops_rd': 'int', 'iops_wr': 'int',
255             'image': 'ImageInfo',
256             '*bps_max': 'int', '*bps_rd_max': 'int',
257             '*bps_wr_max': 'int', '*iops_max': 'int',
258             '*iops_rd_max': 'int', '*iops_wr_max': 'int',
259             '*iops_size': 'int' } }
262 # @BlockDeviceIoStatus:
264 # An enumeration of block device I/O status.
266 # @ok: The last I/O operation has succeeded
268 # @failed: The last I/O operation has failed
270 # @nospace: The last I/O operation has failed due to a no-space condition
272 # Since: 1.0
274 { 'enum': 'BlockDeviceIoStatus', 'data': [ 'ok', 'failed', 'nospace' ] }
277 # @BlockDeviceMapEntry:
279 # Entry in the metadata map of the device (returned by "qemu-img map")
281 # @start: Offset in the image of the first byte described by this entry
282 #         (in bytes)
284 # @length: Length of the range described by this entry (in bytes)
286 # @depth: Number of layers (0 = top image, 1 = top image's backing file, etc.)
287 #         before reaching one for which the range is allocated.  The value is
288 #         in the range 0 to the depth of the image chain - 1.
290 # @zero: the sectors in this range read as zeros
292 # @data: reading the image will actually read data from a file (in particular,
293 #        if @offset is present this means that the sectors are not simply
294 #        preallocated, but contain actual data in raw format)
296 # @offset: if present, the image file stores the data for this range in
297 #          raw format at the given offset.
299 # Since 1.7
301 { 'type': 'BlockDeviceMapEntry',
302   'data': { 'start': 'int', 'length': 'int', 'depth': 'int', 'zero': 'bool',
303             'data': 'bool', '*offset': 'int' } }
306 # @BlockDirtyInfo:
308 # Block dirty bitmap information.
310 # @count: number of dirty bytes according to the dirty bitmap
312 # @granularity: granularity of the dirty bitmap in bytes (since 1.4)
314 # Since: 1.3
316 { 'type': 'BlockDirtyInfo',
317   'data': {'count': 'int', 'granularity': 'int'} }
320 # @BlockInfo:
322 # Block device information.  This structure describes a virtual device and
323 # the backing device associated with it.
325 # @device: The device name associated with the virtual device.
327 # @type: This field is returned only for compatibility reasons, it should
328 #        not be used (always returns 'unknown')
330 # @removable: True if the device supports removable media.
332 # @locked: True if the guest has locked this device from having its media
333 #          removed
335 # @tray_open: #optional True if the device has a tray and it is open
336 #             (only present if removable is true)
338 # @dirty-bitmaps: #optional dirty bitmaps information (only present if the
339 #                 driver has one or more dirty bitmaps) (Since 2.0)
341 # @io-status: #optional @BlockDeviceIoStatus. Only present if the device
342 #             supports it and the VM is configured to stop on errors
343 #             (supported device models: virtio-blk, ide, scsi-disk)
345 # @inserted: #optional @BlockDeviceInfo describing the device if media is
346 #            present
348 # Since:  0.14.0
350 { 'type': 'BlockInfo',
351   'data': {'device': 'str', 'type': 'str', 'removable': 'bool',
352            'locked': 'bool', '*inserted': 'BlockDeviceInfo',
353            '*tray_open': 'bool', '*io-status': 'BlockDeviceIoStatus',
354            '*dirty-bitmaps': ['BlockDirtyInfo'] } }
357 # @query-block:
359 # Get a list of BlockInfo for all virtual block devices.
361 # Returns: a list of @BlockInfo describing each virtual block device
363 # Since: 0.14.0
365 { 'command': 'query-block', 'returns': ['BlockInfo'] }
368 # @BlockDeviceStats:
370 # Statistics of a virtual block device or a block backing device.
372 # @rd_bytes:      The number of bytes read by the device.
374 # @wr_bytes:      The number of bytes written by the device.
376 # @rd_operations: The number of read operations performed by the device.
378 # @wr_operations: The number of write operations performed by the device.
380 # @flush_operations: The number of cache flush operations performed by the
381 #                    device (since 0.15.0)
383 # @flush_total_time_ns: Total time spend on cache flushes in nano-seconds
384 #                       (since 0.15.0).
386 # @wr_total_time_ns: Total time spend on writes in nano-seconds (since 0.15.0).
388 # @rd_total_time_ns: Total_time_spend on reads in nano-seconds (since 0.15.0).
390 # @wr_highest_offset: The offset after the greatest byte written to the
391 #                     device.  The intended use of this information is for
392 #                     growable sparse files (like qcow2) that are used on top
393 #                     of a physical device.
395 # Since: 0.14.0
397 { 'type': 'BlockDeviceStats',
398   'data': {'rd_bytes': 'int', 'wr_bytes': 'int', 'rd_operations': 'int',
399            'wr_operations': 'int', 'flush_operations': 'int',
400            'flush_total_time_ns': 'int', 'wr_total_time_ns': 'int',
401            'rd_total_time_ns': 'int', 'wr_highest_offset': 'int' } }
404 # @BlockStats:
406 # Statistics of a virtual block device or a block backing device.
408 # @device: #optional If the stats are for a virtual block device, the name
409 #          corresponding to the virtual block device.
411 # @stats:  A @BlockDeviceStats for the device.
413 # @parent: #optional This describes the file block device if it has one.
415 # @backing: #optional This describes the backing block device if it has one.
416 #           (Since 2.0)
418 # Since: 0.14.0
420 { 'type': 'BlockStats',
421   'data': {'*device': 'str', 'stats': 'BlockDeviceStats',
422            '*parent': 'BlockStats',
423            '*backing': 'BlockStats'} }
426 # @query-blockstats:
428 # Query the @BlockStats for all virtual block devices.
430 # Returns: A list of @BlockStats for each virtual block devices.
432 # Since: 0.14.0
434 { 'command': 'query-blockstats', 'returns': ['BlockStats'] }
437 # @BlockdevOnError:
439 # An enumeration of possible behaviors for errors on I/O operations.
440 # The exact meaning depends on whether the I/O was initiated by a guest
441 # or by a block job
443 # @report: for guest operations, report the error to the guest;
444 #          for jobs, cancel the job
446 # @ignore: ignore the error, only report a QMP event (BLOCK_IO_ERROR
447 #          or BLOCK_JOB_ERROR)
449 # @enospc: same as @stop on ENOSPC, same as @report otherwise.
451 # @stop: for guest operations, stop the virtual machine;
452 #        for jobs, pause the job
454 # Since: 1.3
456 { 'enum': 'BlockdevOnError',
457   'data': ['report', 'ignore', 'enospc', 'stop'] }
460 # @MirrorSyncMode:
462 # An enumeration of possible behaviors for the initial synchronization
463 # phase of storage mirroring.
465 # @top: copies data in the topmost image to the destination
467 # @full: copies data from all images to the destination
469 # @none: only copy data written from now on
471 # Since: 1.3
473 { 'enum': 'MirrorSyncMode',
474   'data': ['top', 'full', 'none'] }
477 # @BlockJobType:
479 # Type of a block job.
481 # @commit: block commit job type, see "block-commit"
483 # @stream: block stream job type, see "block-stream"
485 # @mirror: drive mirror job type, see "drive-mirror"
487 # @backup: drive backup job type, see "drive-backup"
489 # Since: 1.7
491 { 'enum': 'BlockJobType',
492   'data': ['commit', 'stream', 'mirror', 'backup'] }
495 # @BlockJobInfo:
497 # Information about a long-running block device operation.
499 # @type: the job type ('stream' for image streaming)
501 # @device: the block device name
503 # @len: the maximum progress value
505 # @busy: false if the job is known to be in a quiescent state, with
506 #        no pending I/O.  Since 1.3.
508 # @paused: whether the job is paused or, if @busy is true, will
509 #          pause itself as soon as possible.  Since 1.3.
511 # @offset: the current progress value
513 # @speed: the rate limit, bytes per second
515 # @io-status: the status of the job (since 1.3)
517 # Since: 1.1
519 { 'type': 'BlockJobInfo',
520   'data': {'type': 'str', 'device': 'str', 'len': 'int',
521            'offset': 'int', 'busy': 'bool', 'paused': 'bool', 'speed': 'int',
522            'io-status': 'BlockDeviceIoStatus'} }
525 # @query-block-jobs:
527 # Return information about long-running block device operations.
529 # Returns: a list of @BlockJobInfo for each active block job
531 # Since: 1.1
533 { 'command': 'query-block-jobs', 'returns': ['BlockJobInfo'] }
536 # @block_passwd:
538 # This command sets the password of a block device that has not been open
539 # with a password and requires one.
541 # The two cases where this can happen are a block device is created through
542 # QEMU's initial command line or a block device is changed through the legacy
543 # @change interface.
545 # In the event that the block device is created through the initial command
546 # line, the VM will start in the stopped state regardless of whether '-S' is
547 # used.  The intention is for a management tool to query the block devices to
548 # determine which ones are encrypted, set the passwords with this command, and
549 # then start the guest with the @cont command.
551 # Either @device or @node-name must be set but not both.
553 # @device: #optional the name of the block backend device to set the password on
555 # @node-name: #optional graph node name to set the password on (Since 2.0)
557 # @password: the password to use for the device
559 # Returns: nothing on success
560 #          If @device is not a valid block device, DeviceNotFound
561 #          If @device is not encrypted, DeviceNotEncrypted
563 # Notes:  Not all block formats support encryption and some that do are not
564 #         able to validate that a password is correct.  Disk corruption may
565 #         occur if an invalid password is specified.
567 # Since: 0.14.0
569 { 'command': 'block_passwd', 'data': {'*device': 'str',
570                                       '*node-name': 'str', 'password': 'str'} }
573 # @block_resize
575 # Resize a block image while a guest is running.
577 # Either @device or @node-name must be set but not both.
579 # @device: #optional the name of the device to get the image resized
581 # @node-name: #optional graph node name to get the image resized (Since 2.0)
583 # @size:  new image size in bytes
585 # Returns: nothing on success
586 #          If @device is not a valid block device, DeviceNotFound
588 # Since: 0.14.0
590 { 'command': 'block_resize', 'data': { '*device': 'str',
591                                        '*node-name': 'str',
592                                        'size': 'int' }}
595 # @NewImageMode
597 # An enumeration that tells QEMU how to set the backing file path in
598 # a new image file.
600 # @existing: QEMU should look for an existing image file.
602 # @absolute-paths: QEMU should create a new image with absolute paths
603 # for the backing file. If there is no backing file available, the new
604 # image will not be backed either.
606 # Since: 1.1
608 { 'enum': 'NewImageMode',
609   'data': [ 'existing', 'absolute-paths' ] }
612 # @BlockdevSnapshot
614 # Either @device or @node-name must be set but not both.
616 # @device: #optional the name of the device to generate the snapshot from.
618 # @node-name: #optional graph node name to generate the snapshot from (Since 2.0)
620 # @snapshot-file: the target of the new image. A new file will be created.
622 # @snapshot-node-name: #optional the graph node name of the new image (Since 2.0)
624 # @format: #optional the format of the snapshot image, default is 'qcow2'.
626 # @mode: #optional whether and how QEMU should create a new image, default is
627 #        'absolute-paths'.
629 { 'type': 'BlockdevSnapshot',
630   'data': { '*device': 'str', '*node-name': 'str',
631             'snapshot-file': 'str', '*snapshot-node-name': 'str',
632             '*format': 'str', '*mode': 'NewImageMode' } }
635 # @DriveBackup
637 # @device: the name of the device which should be copied.
639 # @target: the target of the new image. If the file exists, or if it
640 #          is a device, the existing file/device will be used as the new
641 #          destination.  If it does not exist, a new file will be created.
643 # @format: #optional the format of the new destination, default is to
644 #          probe if @mode is 'existing', else the format of the source
646 # @sync: what parts of the disk image should be copied to the destination
647 #        (all the disk, only the sectors allocated in the topmost image, or
648 #        only new I/O).
650 # @mode: #optional whether and how QEMU should create a new image, default is
651 #        'absolute-paths'.
653 # @speed: #optional the maximum speed, in bytes per second
655 # @on-source-error: #optional the action to take on an error on the source,
656 #                   default 'report'.  'stop' and 'enospc' can only be used
657 #                   if the block device supports io-status (see BlockInfo).
659 # @on-target-error: #optional the action to take on an error on the target,
660 #                   default 'report' (no limitations, since this applies to
661 #                   a different block device than @device).
663 # Note that @on-source-error and @on-target-error only affect background I/O.
664 # If an error occurs during a guest write request, the device's rerror/werror
665 # actions will be used.
667 # Since: 1.6
669 { 'type': 'DriveBackup',
670   'data': { 'device': 'str', 'target': 'str', '*format': 'str',
671             'sync': 'MirrorSyncMode', '*mode': 'NewImageMode',
672             '*speed': 'int',
673             '*on-source-error': 'BlockdevOnError',
674             '*on-target-error': 'BlockdevOnError' } }
677 # @blockdev-snapshot-sync
679 # Generates a synchronous snapshot of a block device.
681 # For the arguments, see the documentation of BlockdevSnapshot.
683 # Returns: nothing on success
684 #          If @device is not a valid block device, DeviceNotFound
686 # Since 0.14.0
688 { 'command': 'blockdev-snapshot-sync',
689   'data': 'BlockdevSnapshot' }
692 # @change-backing-file
694 # Change the backing file in the image file metadata.  This does not
695 # cause QEMU to reopen the image file to reparse the backing filename
696 # (it may, however, perform a reopen to change permissions from
697 # r/o -> r/w -> r/o, if needed). The new backing file string is written
698 # into the image file metadata, and the QEMU internal strings are
699 # updated.
701 # @image-node-name: The name of the block driver state node of the
702 #                   image to modify.
704 # @device:          The name of the device that owns image-node-name.
706 # @backing-file:    The string to write as the backing file.  This
707 #                   string is not validated, so care should be taken
708 #                   when specifying the string or the image chain may
709 #                   not be able to be reopened again.
711 # Since: 2.1
713 { 'command': 'change-backing-file',
714   'data': { 'device': 'str', 'image-node-name': 'str',
715             'backing-file': 'str' } }
718 # @block-commit
720 # Live commit of data from overlay image nodes into backing nodes - i.e.,
721 # writes data between 'top' and 'base' into 'base'.
723 # @device:  the name of the device
725 # @base:   #optional The file name of the backing image to write data into.
726 #                    If not specified, this is the deepest backing image
728 # @top:    #optional The file name of the backing image within the image chain,
729 #                    which contains the topmost data to be committed down. If
730 #                    not specified, this is the active layer.
732 # @backing-file:  #optional The backing file string to write into the overlay
733 #                           image of 'top'.  If 'top' is the active layer,
734 #                           specifying a backing file string is an error. This
735 #                           filename is not validated.
737 #                           If a pathname string is such that it cannot be
738 #                           resolved by QEMU, that means that subsequent QMP or
739 #                           HMP commands must use node-names for the image in
740 #                           question, as filename lookup methods will fail.
742 #                           If not specified, QEMU will automatically determine
743 #                           the backing file string to use, or error out if
744 #                           there is no obvious choice. Care should be taken
745 #                           when specifying the string, to specify a valid
746 #                           filename or protocol.
747 #                           (Since 2.1)
749 #                    If top == base, that is an error.
750 #                    If top == active, the job will not be completed by itself,
751 #                    user needs to complete the job with the block-job-complete
752 #                    command after getting the ready event. (Since 2.0)
754 #                    If the base image is smaller than top, then the base image
755 #                    will be resized to be the same size as top.  If top is
756 #                    smaller than the base image, the base will not be
757 #                    truncated.  If you want the base image size to match the
758 #                    size of the smaller top, you can safely truncate it
759 #                    yourself once the commit operation successfully completes.
761 # @speed:  #optional the maximum speed, in bytes per second
763 # Returns: Nothing on success
764 #          If commit or stream is already active on this device, DeviceInUse
765 #          If @device does not exist, DeviceNotFound
766 #          If image commit is not supported by this device, NotSupported
767 #          If @base or @top is invalid, a generic error is returned
768 #          If @speed is invalid, InvalidParameter
770 # Since: 1.3
773 { 'command': 'block-commit',
774   'data': { 'device': 'str', '*base': 'str', '*top': 'str',
775             '*backing-file': 'str', '*speed': 'int' } }
778 # @drive-backup
780 # Start a point-in-time copy of a block device to a new destination.  The
781 # status of ongoing drive-backup operations can be checked with
782 # query-block-jobs where the BlockJobInfo.type field has the value 'backup'.
783 # The operation can be stopped before it has completed using the
784 # block-job-cancel command.
786 # For the arguments, see the documentation of DriveBackup.
788 # Returns: nothing on success
789 #          If @device is not a valid block device, DeviceNotFound
791 # Since 1.6
793 { 'command': 'drive-backup', 'data': 'DriveBackup' }
796 # @query-named-block-nodes
798 # Get the named block driver list
800 # Returns: the list of BlockDeviceInfo
802 # Since 2.0
804 { 'command': 'query-named-block-nodes', 'returns': [ 'BlockDeviceInfo' ] }
807 # @drive-mirror
809 # Start mirroring a block device's writes to a new destination.
811 # @device:  the name of the device whose writes should be mirrored.
813 # @target: the target of the new image. If the file exists, or if it
814 #          is a device, the existing file/device will be used as the new
815 #          destination.  If it does not exist, a new file will be created.
817 # @format: #optional the format of the new destination, default is to
818 #          probe if @mode is 'existing', else the format of the source
820 # @node-name: #optional the new block driver state node name in the graph
821 #             (Since 2.1)
823 # @replaces: #optional with sync=full graph node name to be replaced by the new
824 #            image when a whole image copy is done. This can be used to repair
825 #            broken Quorum files. (Since 2.1)
827 # @mode: #optional whether and how QEMU should create a new image, default is
828 #        'absolute-paths'.
830 # @speed:  #optional the maximum speed, in bytes per second
832 # @sync: what parts of the disk image should be copied to the destination
833 #        (all the disk, only the sectors allocated in the topmost image, or
834 #        only new I/O).
836 # @granularity: #optional granularity of the dirty bitmap, default is 64K
837 #               if the image format doesn't have clusters, 4K if the clusters
838 #               are smaller than that, else the cluster size.  Must be a
839 #               power of 2 between 512 and 64M (since 1.4).
841 # @buf-size: #optional maximum amount of data in flight from source to
842 #            target (since 1.4).
844 # @on-source-error: #optional the action to take on an error on the source,
845 #                   default 'report'.  'stop' and 'enospc' can only be used
846 #                   if the block device supports io-status (see BlockInfo).
848 # @on-target-error: #optional the action to take on an error on the target,
849 #                   default 'report' (no limitations, since this applies to
850 #                   a different block device than @device).
852 # Returns: nothing on success
853 #          If @device is not a valid block device, DeviceNotFound
855 # Since 1.3
857 { 'command': 'drive-mirror',
858   'data': { 'device': 'str', 'target': 'str', '*format': 'str',
859             '*node-name': 'str', '*replaces': 'str',
860             'sync': 'MirrorSyncMode', '*mode': 'NewImageMode',
861             '*speed': 'int', '*granularity': 'uint32',
862             '*buf-size': 'int', '*on-source-error': 'BlockdevOnError',
863             '*on-target-error': 'BlockdevOnError' } }
866 # @block_set_io_throttle:
868 # Change I/O throttle limits for a block drive.
870 # @device: The name of the device
872 # @bps: total throughput limit in bytes per second
874 # @bps_rd: read throughput limit in bytes per second
876 # @bps_wr: write throughput limit in bytes per second
878 # @iops: total I/O operations per second
880 # @ops_rd: read I/O operations per second
882 # @iops_wr: write I/O operations per second
884 # @bps_max: #optional total max in bytes (Since 1.7)
886 # @bps_rd_max: #optional read max in bytes (Since 1.7)
888 # @bps_wr_max: #optional write max in bytes (Since 1.7)
890 # @iops_max: #optional total I/O operations max (Since 1.7)
892 # @iops_rd_max: #optional read I/O operations max (Since 1.7)
894 # @iops_wr_max: #optional write I/O operations max (Since 1.7)
896 # @iops_size: #optional an I/O size in bytes (Since 1.7)
898 # Returns: Nothing on success
899 #          If @device is not a valid block device, DeviceNotFound
901 # Since: 1.1
903 { 'command': 'block_set_io_throttle',
904   'data': { 'device': 'str', 'bps': 'int', 'bps_rd': 'int', 'bps_wr': 'int',
905             'iops': 'int', 'iops_rd': 'int', 'iops_wr': 'int',
906             '*bps_max': 'int', '*bps_rd_max': 'int',
907             '*bps_wr_max': 'int', '*iops_max': 'int',
908             '*iops_rd_max': 'int', '*iops_wr_max': 'int',
909             '*iops_size': 'int' } }
912 # @block-stream:
914 # Copy data from a backing file into a block device.
916 # The block streaming operation is performed in the background until the entire
917 # backing file has been copied.  This command returns immediately once streaming
918 # has started.  The status of ongoing block streaming operations can be checked
919 # with query-block-jobs.  The operation can be stopped before it has completed
920 # using the block-job-cancel command.
922 # If a base file is specified then sectors are not copied from that base file and
923 # its backing chain.  When streaming completes the image file will have the base
924 # file as its backing file.  This can be used to stream a subset of the backing
925 # file chain instead of flattening the entire image.
927 # On successful completion the image file is updated to drop the backing file
928 # and the BLOCK_JOB_COMPLETED event is emitted.
930 # @device: the device name
932 # @base:   #optional the common backing file name
934 # @backing-file: #optional The backing file string to write into the active
935 #                          layer. This filename is not validated.
937 #                          If a pathname string is such that it cannot be
938 #                          resolved by QEMU, that means that subsequent QMP or
939 #                          HMP commands must use node-names for the image in
940 #                          question, as filename lookup methods will fail.
942 #                          If not specified, QEMU will automatically determine
943 #                          the backing file string to use, or error out if there
944 #                          is no obvious choice.  Care should be taken when
945 #                          specifying the string, to specify a valid filename or
946 #                          protocol.
947 #                          (Since 2.1)
949 # @speed:  #optional the maximum speed, in bytes per second
951 # @on-error: #optional the action to take on an error (default report).
952 #            'stop' and 'enospc' can only be used if the block device
953 #            supports io-status (see BlockInfo).  Since 1.3.
955 # Returns: Nothing on success
956 #          If @device does not exist, DeviceNotFound
958 # Since: 1.1
960 { 'command': 'block-stream',
961   'data': { 'device': 'str', '*base': 'str', '*backing-file': 'str',
962             '*speed': 'int', '*on-error': 'BlockdevOnError' } }
965 # @block-job-set-speed:
967 # Set maximum speed for a background block operation.
969 # This command can only be issued when there is an active block job.
971 # Throttling can be disabled by setting the speed to 0.
973 # @device: the device name
975 # @speed:  the maximum speed, in bytes per second, or 0 for unlimited.
976 #          Defaults to 0.
978 # Returns: Nothing on success
979 #          If no background operation is active on this device, DeviceNotActive
981 # Since: 1.1
983 { 'command': 'block-job-set-speed',
984   'data': { 'device': 'str', 'speed': 'int' } }
987 # @block-job-cancel:
989 # Stop an active background block operation.
991 # This command returns immediately after marking the active background block
992 # operation for cancellation.  It is an error to call this command if no
993 # operation is in progress.
995 # The operation will cancel as soon as possible and then emit the
996 # BLOCK_JOB_CANCELLED event.  Before that happens the job is still visible when
997 # enumerated using query-block-jobs.
999 # For streaming, the image file retains its backing file unless the streaming
1000 # operation happens to complete just as it is being cancelled.  A new streaming
1001 # operation can be started at a later time to finish copying all data from the
1002 # backing file.
1004 # @device: the device name
1006 # @force: #optional whether to allow cancellation of a paused job (default
1007 #         false).  Since 1.3.
1009 # Returns: Nothing on success
1010 #          If no background operation is active on this device, DeviceNotActive
1012 # Since: 1.1
1014 { 'command': 'block-job-cancel', 'data': { 'device': 'str', '*force': 'bool' } }
1017 # @block-job-pause:
1019 # Pause an active background block operation.
1021 # This command returns immediately after marking the active background block
1022 # operation for pausing.  It is an error to call this command if no
1023 # operation is in progress.  Pausing an already paused job has no cumulative
1024 # effect; a single block-job-resume command will resume the job.
1026 # The operation will pause as soon as possible.  No event is emitted when
1027 # the operation is actually paused.  Cancelling a paused job automatically
1028 # resumes it.
1030 # @device: the device name
1032 # Returns: Nothing on success
1033 #          If no background operation is active on this device, DeviceNotActive
1035 # Since: 1.3
1037 { 'command': 'block-job-pause', 'data': { 'device': 'str' } }
1040 # @block-job-resume:
1042 # Resume an active background block operation.
1044 # This command returns immediately after resuming a paused background block
1045 # operation.  It is an error to call this command if no operation is in
1046 # progress.  Resuming an already running job is not an error.
1048 # This command also clears the error status of the job.
1050 # @device: the device name
1052 # Returns: Nothing on success
1053 #          If no background operation is active on this device, DeviceNotActive
1055 # Since: 1.3
1057 { 'command': 'block-job-resume', 'data': { 'device': 'str' } }
1060 # @block-job-complete:
1062 # Manually trigger completion of an active background block operation.  This
1063 # is supported for drive mirroring, where it also switches the device to
1064 # write to the target path only.  The ability to complete is signaled with
1065 # a BLOCK_JOB_READY event.
1067 # This command completes an active background block operation synchronously.
1068 # The ordering of this command's return with the BLOCK_JOB_COMPLETED event
1069 # is not defined.  Note that if an I/O error occurs during the processing of
1070 # this command: 1) the command itself will fail; 2) the error will be processed
1071 # according to the rerror/werror arguments that were specified when starting
1072 # the operation.
1074 # A cancelled or paused job cannot be completed.
1076 # @device: the device name
1078 # Returns: Nothing on success
1079 #          If no background operation is active on this device, DeviceNotActive
1081 # Since: 1.3
1083 { 'command': 'block-job-complete', 'data': { 'device': 'str' } }
1086 # @BlockdevDiscardOptions
1088 # Determines how to handle discard requests.
1090 # @ignore:      Ignore the request
1091 # @unmap:       Forward as an unmap request
1093 # Since: 1.7
1095 { 'enum': 'BlockdevDiscardOptions',
1096   'data': [ 'ignore', 'unmap' ] }
1099 # @BlockdevDetectZeroesOptions
1101 # Describes the operation mode for the automatic conversion of plain
1102 # zero writes by the OS to driver specific optimized zero write commands.
1104 # @off:      Disabled (default)
1105 # @on:       Enabled
1106 # @unmap:    Enabled and even try to unmap blocks if possible. This requires
1107 #            also that @BlockdevDiscardOptions is set to unmap for this device.
1109 # Since: 2.1
1111 { 'enum': 'BlockdevDetectZeroesOptions',
1112   'data': [ 'off', 'on', 'unmap' ] }
1115 # @BlockdevAioOptions
1117 # Selects the AIO backend to handle I/O requests
1119 # @threads:     Use qemu's thread pool
1120 # @native:      Use native AIO backend (only Linux and Windows)
1122 # Since: 1.7
1124 { 'enum': 'BlockdevAioOptions',
1125   'data': [ 'threads', 'native' ] }
1128 # @BlockdevCacheOptions
1130 # Includes cache-related options for block devices
1132 # @writeback:   #optional enables writeback mode for any caches (default: true)
1133 # @direct:      #optional enables use of O_DIRECT (bypass the host page cache;
1134 #               default: false)
1135 # @no-flush:    #optional ignore any flush requests for the device (default:
1136 #               false)
1138 # Since: 1.7
1140 { 'type': 'BlockdevCacheOptions',
1141   'data': { '*writeback': 'bool',
1142             '*direct': 'bool',
1143             '*no-flush': 'bool' } }
1146 # @BlockdevDriver
1148 # Drivers that are supported in block device operations.
1150 # @host_device, @host_cdrom, @host_floppy: Since 2.1
1152 # Since: 2.0
1154 { 'enum': 'BlockdevDriver',
1155   'data': [ 'archipelago', 'blkdebug', 'blkverify', 'bochs', 'cloop',
1156             'dmg', 'file', 'ftp', 'ftps', 'host_cdrom', 'host_device',
1157             'host_floppy', 'http', 'https', 'null-aio', 'null-co', 'parallels',
1158             'qcow', 'qcow2', 'qed', 'quorum', 'raw', 'tftp', 'vdi', 'vhdx',
1159             'vmdk', 'vpc', 'vvfat' ] }
1162 # @BlockdevOptionsBase
1164 # Options that are available for all block devices, independent of the block
1165 # driver.
1167 # @driver:        block driver name
1168 # @id:            #optional id by which the new block device can be referred to.
1169 #                 This is a required option on the top level of blockdev-add, and
1170 #                 currently not allowed on any other level.
1171 # @node-name:     #optional the name of a block driver state node (Since 2.0)
1172 # @discard:       #optional discard-related options (default: ignore)
1173 # @cache:         #optional cache-related options
1174 # @aio:           #optional AIO backend (default: threads)
1175 # @rerror:        #optional how to handle read errors on the device
1176 #                 (default: report)
1177 # @werror:        #optional how to handle write errors on the device
1178 #                 (default: enospc)
1179 # @read-only:     #optional whether the block device should be read-only
1180 #                 (default: false)
1181 # @detect-zeroes: #optional detect and optimize zero writes (Since 2.1)
1182 #                 (default: off)
1184 # Since: 1.7
1186 { 'type': 'BlockdevOptionsBase',
1187   'data': { 'driver': 'BlockdevDriver',
1188             '*id': 'str',
1189             '*node-name': 'str',
1190             '*discard': 'BlockdevDiscardOptions',
1191             '*cache': 'BlockdevCacheOptions',
1192             '*aio': 'BlockdevAioOptions',
1193             '*rerror': 'BlockdevOnError',
1194             '*werror': 'BlockdevOnError',
1195             '*read-only': 'bool',
1196             '*detect-zeroes': 'BlockdevDetectZeroesOptions' } }
1199 # @BlockdevOptionsFile
1201 # Driver specific block device options for the file backend and similar
1202 # protocols.
1204 # @filename:    path to the image file
1206 # Since: 1.7
1208 { 'type': 'BlockdevOptionsFile',
1209   'data': { 'filename': 'str' } }
1212 # @BlockdevOptionsNull
1214 # Driver specific block device options for the null backend.
1216 # @size:    #optional size of the device in bytes.
1218 # Since: 2.2
1220 { 'type': 'BlockdevOptionsNull',
1221   'data': { '*size': 'int' } }
1224 # @BlockdevOptionsVVFAT
1226 # Driver specific block device options for the vvfat protocol.
1228 # @dir:         directory to be exported as FAT image
1229 # @fat-type:    #optional FAT type: 12, 16 or 32
1230 # @floppy:      #optional whether to export a floppy image (true) or
1231 #               partitioned hard disk (false; default)
1232 # @rw:          #optional whether to allow write operations (default: false)
1234 # Since: 1.7
1236 { 'type': 'BlockdevOptionsVVFAT',
1237   'data': { 'dir': 'str', '*fat-type': 'int', '*floppy': 'bool',
1238             '*rw': 'bool' } }
1241 # @BlockdevOptionsGenericFormat
1243 # Driver specific block device options for image format that have no option
1244 # besides their data source.
1246 # @file:        reference to or definition of the data source block device
1248 # Since: 1.7
1250 { 'type': 'BlockdevOptionsGenericFormat',
1251   'data': { 'file': 'BlockdevRef' } }
1254 # @BlockdevOptionsGenericCOWFormat
1256 # Driver specific block device options for image format that have no option
1257 # besides their data source and an optional backing file.
1259 # @backing:     #optional reference to or definition of the backing file block
1260 #               device (if missing, taken from the image file content). It is
1261 #               allowed to pass an empty string here in order to disable the
1262 #               default backing file.
1264 # Since: 1.7
1266 { 'type': 'BlockdevOptionsGenericCOWFormat',
1267   'base': 'BlockdevOptionsGenericFormat',
1268   'data': { '*backing': 'BlockdevRef' } }
1271 # @Qcow2OverlapCheckMode
1273 # General overlap check modes.
1275 # @none:        Do not perform any checks
1277 # @constant:    Perform only checks which can be done in constant time and
1278 #               without reading anything from disk
1280 # @cached:      Perform only checks which can be done without reading anything
1281 #               from disk
1283 # @all:         Perform all available overlap checks
1285 # Since: 2.2
1287 { 'enum': 'Qcow2OverlapCheckMode',
1288   'data': [ 'none', 'constant', 'cached', 'all' ] }
1291 # @Qcow2OverlapCheckFlags
1293 # Structure of flags for each metadata structure. Setting a field to 'true'
1294 # makes qemu guard that structure against unintended overwriting. The default
1295 # value is chosen according to the template given.
1297 # @template: Specifies a template mode which can be adjusted using the other
1298 #            flags, defaults to 'cached'
1300 # Since: 2.2
1302 { 'type': 'Qcow2OverlapCheckFlags',
1303   'data': { '*template':       'Qcow2OverlapCheckMode',
1304             '*main-header':    'bool',
1305             '*active-l1':      'bool',
1306             '*active-l2':      'bool',
1307             '*refcount-table': 'bool',
1308             '*refcount-block': 'bool',
1309             '*snapshot-table': 'bool',
1310             '*inactive-l1':    'bool',
1311             '*inactive-l2':    'bool' } }
1314 # @Qcow2OverlapChecks
1316 # Specifies which metadata structures should be guarded against unintended
1317 # overwriting.
1319 # @flags:   set of flags for separate specification of each metadata structure
1320 #           type
1322 # @mode:    named mode which chooses a specific set of flags
1324 # Since: 2.2
1326 { 'union': 'Qcow2OverlapChecks',
1327   'discriminator': {},
1328   'data': { 'flags': 'Qcow2OverlapCheckFlags',
1329             'mode':  'Qcow2OverlapCheckMode' } }
1332 # @BlockdevOptionsQcow2
1334 # Driver specific block device options for qcow2.
1336 # @lazy-refcounts:        #optional whether to enable the lazy refcounts
1337 #                         feature (default is taken from the image file)
1339 # @pass-discard-request:  #optional whether discard requests to the qcow2
1340 #                         device should be forwarded to the data source
1342 # @pass-discard-snapshot: #optional whether discard requests for the data source
1343 #                         should be issued when a snapshot operation (e.g.
1344 #                         deleting a snapshot) frees clusters in the qcow2 file
1346 # @pass-discard-other:    #optional whether discard requests for the data source
1347 #                         should be issued on other occasions where a cluster
1348 #                         gets freed
1350 # @overlap-check:         #optional which overlap checks to perform for writes
1351 #                         to the image, defaults to 'cached' (since 2.2)
1353 # @cache-size:            #optional the maximum total size of the L2 table and
1354 #                         refcount block caches in bytes (since 2.2)
1356 # @l2-cache-size:         #optional the maximum size of the L2 table cache in
1357 #                         bytes (since 2.2)
1359 # @refcount-cache-size:   #optional the maximum size of the refcount block cache
1360 #                         in bytes (since 2.2)
1362 # Since: 1.7
1364 { 'type': 'BlockdevOptionsQcow2',
1365   'base': 'BlockdevOptionsGenericCOWFormat',
1366   'data': { '*lazy-refcounts': 'bool',
1367             '*pass-discard-request': 'bool',
1368             '*pass-discard-snapshot': 'bool',
1369             '*pass-discard-other': 'bool',
1370             '*overlap-check': 'Qcow2OverlapChecks',
1371             '*cache-size': 'int',
1372             '*l2-cache-size': 'int',
1373             '*refcount-cache-size': 'int' } }
1377 # @BlockdevOptionsArchipelago
1379 # Driver specific block device options for Archipelago.
1381 # @volume:              Name of the Archipelago volume image
1383 # @mport:               #optional The port number on which mapperd is
1384 #                       listening. This is optional
1385 #                       and if not specified, QEMU will make Archipelago
1386 #                       use the default port (1001).
1388 # @vport:               #optional The port number on which vlmcd is
1389 #                       listening. This is optional
1390 #                       and if not specified, QEMU will make Archipelago
1391 #                       use the default port (501).
1393 # @segment:             #optional The name of the shared memory segment
1394 #                       Archipelago stack is using. This is optional
1395 #                       and if not specified, QEMU will make Archipelago
1396 #                       use the default value, 'archipelago'.
1397 # Since: 2.2
1399 { 'type': 'BlockdevOptionsArchipelago',
1400   'data': { 'volume': 'str',
1401             '*mport': 'int',
1402             '*vport': 'int',
1403             '*segment': 'str' } }
1407 # @BlkdebugEvent
1409 # Trigger events supported by blkdebug.
1411 { 'enum': 'BlkdebugEvent',
1412   'data': [ 'l1_update', 'l1_grow.alloc_table', 'l1_grow.write_table',
1413             'l1_grow.activate_table', 'l2_load', 'l2_update',
1414             'l2_update_compressed', 'l2_alloc.cow_read', 'l2_alloc.write',
1415             'read_aio', 'read_backing_aio', 'read_compressed', 'write_aio',
1416             'write_compressed', 'vmstate_load', 'vmstate_save', 'cow_read',
1417             'cow_write', 'reftable_load', 'reftable_grow', 'reftable_update',
1418             'refblock_load', 'refblock_update', 'refblock_update_part',
1419             'refblock_alloc', 'refblock_alloc.hookup', 'refblock_alloc.write',
1420             'refblock_alloc.write_blocks', 'refblock_alloc.write_table',
1421             'refblock_alloc.switch_table', 'cluster_alloc',
1422             'cluster_alloc_bytes', 'cluster_free', 'flush_to_os',
1423             'flush_to_disk' ] }
1426 # @BlkdebugInjectErrorOptions
1428 # Describes a single error injection for blkdebug.
1430 # @event:       trigger event
1432 # @state:       #optional the state identifier blkdebug needs to be in to
1433 #               actually trigger the event; defaults to "any"
1435 # @errno:       #optional error identifier (errno) to be returned; defaults to
1436 #               EIO
1438 # @sector:      #optional specifies the sector index which has to be affected
1439 #               in order to actually trigger the event; defaults to "any
1440 #               sector"
1442 # @once:        #optional disables further events after this one has been
1443 #               triggered; defaults to false
1445 # @immediately: #optional fail immediately; defaults to false
1447 # Since: 2.0
1449 { 'type': 'BlkdebugInjectErrorOptions',
1450   'data': { 'event': 'BlkdebugEvent',
1451             '*state': 'int',
1452             '*errno': 'int',
1453             '*sector': 'int',
1454             '*once': 'bool',
1455             '*immediately': 'bool' } }
1458 # @BlkdebugSetStateOptions
1460 # Describes a single state-change event for blkdebug.
1462 # @event:       trigger event
1464 # @state:       #optional the current state identifier blkdebug needs to be in;
1465 #               defaults to "any"
1467 # @new_state:   the state identifier blkdebug is supposed to assume if
1468 #               this event is triggered
1470 # Since: 2.0
1472 { 'type': 'BlkdebugSetStateOptions',
1473   'data': { 'event': 'BlkdebugEvent',
1474             '*state': 'int',
1475             'new_state': 'int' } }
1478 # @BlockdevOptionsBlkdebug
1480 # Driver specific block device options for blkdebug.
1482 # @image:           underlying raw block device (or image file)
1484 # @config:          #optional filename of the configuration file
1486 # @align:           #optional required alignment for requests in bytes
1488 # @inject-error:    #optional array of error injection descriptions
1490 # @set-state:       #optional array of state-change descriptions
1492 # Since: 2.0
1494 { 'type': 'BlockdevOptionsBlkdebug',
1495   'data': { 'image': 'BlockdevRef',
1496             '*config': 'str',
1497             '*align': 'int',
1498             '*inject-error': ['BlkdebugInjectErrorOptions'],
1499             '*set-state': ['BlkdebugSetStateOptions'] } }
1502 # @BlockdevOptionsBlkverify
1504 # Driver specific block device options for blkverify.
1506 # @test:    block device to be tested
1508 # @raw:     raw image used for verification
1510 # Since: 2.0
1512 { 'type': 'BlockdevOptionsBlkverify',
1513   'data': { 'test': 'BlockdevRef',
1514             'raw': 'BlockdevRef' } }
1517 # @QuorumReadPattern
1519 # An enumeration of quorum read patterns.
1521 # @quorum: read all the children and do a quorum vote on reads
1523 # @fifo: read only from the first child that has not failed
1525 # Since: 2.2
1527 { 'enum': 'QuorumReadPattern', 'data': [ 'quorum', 'fifo' ] }
1530 # @BlockdevOptionsQuorum
1532 # Driver specific block device options for Quorum
1534 # @blkverify:      #optional true if the driver must print content mismatch
1535 #                  set to false by default
1537 # @children:       the children block devices to use
1539 # @vote-threshold: the vote limit under which a read will fail
1541 # @rewrite-corrupted: #optional rewrite corrupted data when quorum is reached
1542 #                     (Since 2.1)
1544 # @read-pattern: #optional choose read pattern and set to quorum by default
1545 #                (Since 2.2)
1547 # Since: 2.0
1549 { 'type': 'BlockdevOptionsQuorum',
1550   'data': { '*blkverify': 'bool',
1551             'children': [ 'BlockdevRef' ],
1552             'vote-threshold': 'int',
1553             '*rewrite-corrupted': 'bool',
1554             '*read-pattern': 'QuorumReadPattern' } }
1557 # @BlockdevOptions
1559 # Options for creating a block device.
1561 # Since: 1.7
1563 { 'union': 'BlockdevOptions',
1564   'base': 'BlockdevOptionsBase',
1565   'discriminator': 'driver',
1566   'data': {
1567       'archipelago':'BlockdevOptionsArchipelago',
1568       'blkdebug':   'BlockdevOptionsBlkdebug',
1569       'blkverify':  'BlockdevOptionsBlkverify',
1570       'bochs':      'BlockdevOptionsGenericFormat',
1571       'cloop':      'BlockdevOptionsGenericFormat',
1572       'dmg':        'BlockdevOptionsGenericFormat',
1573       'file':       'BlockdevOptionsFile',
1574       'ftp':        'BlockdevOptionsFile',
1575       'ftps':       'BlockdevOptionsFile',
1576 # TODO gluster: Wait for structured options
1577       'host_cdrom': 'BlockdevOptionsFile',
1578       'host_device':'BlockdevOptionsFile',
1579       'host_floppy':'BlockdevOptionsFile',
1580       'http':       'BlockdevOptionsFile',
1581       'https':      'BlockdevOptionsFile',
1582 # TODO iscsi: Wait for structured options
1583 # TODO nbd: Should take InetSocketAddress for 'host'?
1584 # TODO nfs: Wait for structured options
1585       'null-aio':   'BlockdevOptionsNull',
1586       'null-co':    'BlockdevOptionsNull',
1587       'parallels':  'BlockdevOptionsGenericFormat',
1588       'qcow2':      'BlockdevOptionsQcow2',
1589       'qcow':       'BlockdevOptionsGenericCOWFormat',
1590       'qed':        'BlockdevOptionsGenericCOWFormat',
1591       'quorum':     'BlockdevOptionsQuorum',
1592       'raw':        'BlockdevOptionsGenericFormat',
1593 # TODO rbd: Wait for structured options
1594 # TODO sheepdog: Wait for structured options
1595 # TODO ssh: Should take InetSocketAddress for 'host'?
1596       'tftp':       'BlockdevOptionsFile',
1597       'vdi':        'BlockdevOptionsGenericFormat',
1598       'vhdx':       'BlockdevOptionsGenericFormat',
1599       'vmdk':       'BlockdevOptionsGenericCOWFormat',
1600       'vpc':        'BlockdevOptionsGenericFormat',
1601       'vvfat':      'BlockdevOptionsVVFAT'
1602   } }
1605 # @BlockdevRef
1607 # Reference to a block device.
1609 # @definition:      defines a new block device inline
1610 # @reference:       references the ID of an existing block device. An
1611 #                   empty string means that no block device should be
1612 #                   referenced.
1614 # Since: 1.7
1616 { 'union': 'BlockdevRef',
1617   'discriminator': {},
1618   'data': { 'definition': 'BlockdevOptions',
1619             'reference': 'str' } }
1622 # @blockdev-add:
1624 # Creates a new block device.
1626 # @options: block device options for the new device
1628 # Since: 1.7
1630 { 'command': 'blockdev-add', 'data': { 'options': 'BlockdevOptions' } }
1634 # @BlockErrorAction
1636 # An enumeration of action that has been taken when a DISK I/O occurs
1638 # @ignore: error has been ignored
1640 # @report: error has been reported to the device
1642 # @stop: error caused VM to be stopped
1644 # Since: 2.1
1646 { 'enum': 'BlockErrorAction',
1647   'data': [ 'ignore', 'report', 'stop' ] }
1651 # @BLOCK_IMAGE_CORRUPTED
1653 # Emitted when a corruption has been detected in a disk image
1655 # @device: device name
1657 # @msg: informative message for human consumption, such as the kind of
1658 #       corruption being detected. It should not be parsed by machine as it is
1659 #       not guaranteed to be stable
1661 # @offset: #optional, if the corruption resulted from an image access, this is
1662 #          the access offset into the image
1664 # @size: #optional, if the corruption resulted from an image access, this is
1665 #        the access size
1667 # fatal: if set, the image is marked corrupt and therefore unusable after this
1668 #        event and must be repaired (Since 2.2; before, every
1669 #        BLOCK_IMAGE_CORRUPTED event was fatal)
1671 # Since: 1.7
1673 { 'event': 'BLOCK_IMAGE_CORRUPTED',
1674   'data': { 'device' : 'str',
1675             'msg'    : 'str',
1676             '*offset': 'int',
1677             '*size'  : 'int',
1678             'fatal'  : 'bool' } }
1681 # @BLOCK_IO_ERROR
1683 # Emitted when a disk I/O error occurs
1685 # @device: device name
1687 # @operation: I/O operation
1689 # @action: action that has been taken
1691 # @nospace: #optional true if I/O error was caused due to a no-space
1692 #           condition. This key is only present if query-block's
1693 #           io-status is present, please see query-block documentation
1694 #           for more information (since: 2.2)
1696 # @reason: human readable string describing the error cause.
1697 #          (This field is a debugging aid for humans, it should not
1698 #           be parsed by applications) (since: 2.2)
1700 # Note: If action is "stop", a STOP event will eventually follow the
1701 # BLOCK_IO_ERROR event
1703 # Since: 0.13.0
1705 { 'event': 'BLOCK_IO_ERROR',
1706   'data': { 'device': 'str', 'operation': 'IoOperationType',
1707             'action': 'BlockErrorAction', '*nospace': 'bool',
1708             'reason': 'str' } }
1711 # @BLOCK_JOB_COMPLETED
1713 # Emitted when a block job has completed
1715 # @type: job type
1717 # @device: device name
1719 # @len: maximum progress value
1721 # @offset: current progress value. On success this is equal to len.
1722 #          On failure this is less than len
1724 # @speed: rate limit, bytes per second
1726 # @error: #optional, error message. Only present on failure. This field
1727 #         contains a human-readable error message. There are no semantics
1728 #         other than that streaming has failed and clients should not try to
1729 #         interpret the error string
1731 # Since: 1.1
1733 { 'event': 'BLOCK_JOB_COMPLETED',
1734   'data': { 'type'  : 'BlockJobType',
1735             'device': 'str',
1736             'len'   : 'int',
1737             'offset': 'int',
1738             'speed' : 'int',
1739             '*error': 'str' } }
1742 # @BLOCK_JOB_CANCELLED
1744 # Emitted when a block job has been cancelled
1746 # @type: job type
1748 # @device: device name
1750 # @len: maximum progress value
1752 # @offset: current progress value. On success this is equal to len.
1753 #          On failure this is less than len
1755 # @speed: rate limit, bytes per second
1757 # Since: 1.1
1759 { 'event': 'BLOCK_JOB_CANCELLED',
1760   'data': { 'type'  : 'BlockJobType',
1761             'device': 'str',
1762             'len'   : 'int',
1763             'offset': 'int',
1764             'speed' : 'int' } }
1767 # @BLOCK_JOB_ERROR
1769 # Emitted when a block job encounters an error
1771 # @device: device name
1773 # @operation: I/O operation
1775 # @action: action that has been taken
1777 # Since: 1.3
1779 { 'event': 'BLOCK_JOB_ERROR',
1780   'data': { 'device'   : 'str',
1781             'operation': 'IoOperationType',
1782             'action'   : 'BlockErrorAction' } }
1785 # @BLOCK_JOB_READY
1787 # Emitted when a block job is ready to complete
1789 # @type: job type
1791 # @device: device name
1793 # @len: maximum progress value
1795 # @offset: current progress value. On success this is equal to len.
1796 #          On failure this is less than len
1798 # @speed: rate limit, bytes per second
1800 # Note: The "ready to complete" status is always reset by a @BLOCK_JOB_ERROR
1801 # event
1803 # Since: 1.3
1805 { 'event': 'BLOCK_JOB_READY',
1806   'data': { 'type'  : 'BlockJobType',
1807             'device': 'str',
1808             'len'   : 'int',
1809             'offset': 'int',
1810             'speed' : 'int' } }
1812 # @PreallocMode
1814 # Preallocation mode of QEMU image file
1816 # @off: no preallocation
1817 # @metadata: preallocate only for metadata
1818 # @falloc: like @full preallocation but allocate disk space by
1819 #          posix_fallocate() rather than writing zeros.
1820 # @full: preallocate all data by writing zeros to device to ensure disk
1821 #        space is really available. @full preallocation also sets up
1822 #        metadata correctly.
1824 # Since 2.2
1826 { 'enum': 'PreallocMode',
1827   'data': [ 'off', 'metadata', 'falloc', 'full' ] }