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