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