char: i.MX: Add support for "TX complete" interrupt
[qemu/ar7.git] / qapi / block-core.json
blob5b0ad1a8b7dfd3f015e34ee414cf7d870b87c1b5
1 # -*- Mode: Python -*-
3 ##
4 # == Block core (VM unrelated)
5 ##
7 { 'include': 'common.json' }
8 { 'include': 'crypto.json' }
9 { 'include': 'sockets.json' }
12 # @SnapshotInfo:
14 # @id: unique snapshot id
16 # @name: user chosen name
18 # @vm-state-size: size of the VM state
20 # @date-sec: UTC date of the snapshot in seconds
22 # @date-nsec: fractional part in nano seconds to be used with date-sec
24 # @vm-clock-sec: VM clock relative to boot in seconds
26 # @vm-clock-nsec: fractional part in nano seconds to be used with vm-clock-sec
28 # Since: 1.3
31 { 'struct': 'SnapshotInfo',
32   'data': { 'id': 'str', 'name': 'str', 'vm-state-size': 'int',
33             'date-sec': 'int', 'date-nsec': 'int',
34             'vm-clock-sec': 'int', 'vm-clock-nsec': 'int' } }
37 # @ImageInfoSpecificQCow2EncryptionBase:
39 # @format: The encryption format
41 # Since: 2.10
43 { 'struct': 'ImageInfoSpecificQCow2EncryptionBase',
44   'data': { 'format': 'BlockdevQcow2EncryptionFormat'}}
47 # @ImageInfoSpecificQCow2Encryption:
49 # Since: 2.10
51 { 'union': 'ImageInfoSpecificQCow2Encryption',
52   'base': 'ImageInfoSpecificQCow2EncryptionBase',
53   'discriminator': 'format',
54   'data': { 'aes': 'QCryptoBlockInfoQCow',
55             'luks': 'QCryptoBlockInfoLUKS' } }
58 # @ImageInfoSpecificQCow2:
60 # @compat: compatibility level
62 # @lazy-refcounts: on or off; only valid for compat >= 1.1
64 # @corrupt: true if the image has been marked corrupt; only valid for
65 #           compat >= 1.1 (since 2.2)
67 # @refcount-bits: width of a refcount entry in bits (since 2.3)
69 # @encrypt: details about encryption parameters; only set if image
70 #           is encrypted (since 2.10)
72 # Since: 1.7
74 { 'struct': 'ImageInfoSpecificQCow2',
75   'data': {
76       'compat': 'str',
77       '*lazy-refcounts': 'bool',
78       '*corrupt': 'bool',
79       'refcount-bits': 'int',
80       '*encrypt': 'ImageInfoSpecificQCow2Encryption'
81   } }
84 # @ImageInfoSpecificVmdk:
86 # @create-type: The create type of VMDK image
88 # @cid: Content id of image
90 # @parent-cid: Parent VMDK image's cid
92 # @extents: List of extent files
94 # Since: 1.7
96 { 'struct': 'ImageInfoSpecificVmdk',
97   'data': {
98       'create-type': 'str',
99       'cid': 'int',
100       'parent-cid': 'int',
101       'extents': ['ImageInfo']
102   } }
105 # @ImageInfoSpecific:
107 # A discriminated record of image format specific information structures.
109 # Since: 1.7
111 { 'union': 'ImageInfoSpecific',
112   'data': {
113       'qcow2': 'ImageInfoSpecificQCow2',
114       'vmdk': 'ImageInfoSpecificVmdk',
115       # If we need to add block driver specific parameters for
116       # LUKS in future, then we'll subclass QCryptoBlockInfoLUKS
117       # to define a ImageInfoSpecificLUKS
118       'luks': 'QCryptoBlockInfoLUKS'
119   } }
122 # @ImageInfo:
124 # Information about a QEMU image file
126 # @filename: name of the image file
128 # @format: format of the image file
130 # @virtual-size: maximum capacity in bytes of the image
132 # @actual-size: actual size on disk in bytes of the image
134 # @dirty-flag: true if image is not cleanly closed
136 # @cluster-size: size of a cluster in bytes
138 # @encrypted: true if the image is encrypted
140 # @compressed: true if the image is compressed (Since 1.7)
142 # @backing-filename: name of the backing file
144 # @full-backing-filename: full path of the backing file
146 # @backing-filename-format: the format of the backing file
148 # @snapshots: list of VM snapshots
150 # @backing-image: info of the backing image (since 1.6)
152 # @format-specific: structure supplying additional format-specific
153 # information (since 1.7)
155 # Since: 1.3
158 { 'struct': 'ImageInfo',
159   'data': {'filename': 'str', 'format': 'str', '*dirty-flag': 'bool',
160            '*actual-size': 'int', 'virtual-size': 'int',
161            '*cluster-size': 'int', '*encrypted': 'bool', '*compressed': 'bool',
162            '*backing-filename': 'str', '*full-backing-filename': 'str',
163            '*backing-filename-format': 'str', '*snapshots': ['SnapshotInfo'],
164            '*backing-image': 'ImageInfo',
165            '*format-specific': 'ImageInfoSpecific' } }
168 # @ImageCheck:
170 # Information about a QEMU image file check
172 # @filename: name of the image file checked
174 # @format: format of the image file checked
176 # @check-errors: number of unexpected errors occurred during check
178 # @image-end-offset: offset (in bytes) where the image ends, this
179 #                    field is present if the driver for the image format
180 #                    supports it
182 # @corruptions: number of corruptions found during the check if any
184 # @leaks: number of leaks found during the check if any
186 # @corruptions-fixed: number of corruptions fixed during the check
187 #                     if any
189 # @leaks-fixed: number of leaks fixed during the check if any
191 # @total-clusters: total number of clusters, this field is present
192 #                  if the driver for the image format supports it
194 # @allocated-clusters: total number of allocated clusters, this
195 #                      field is present if the driver for the image format
196 #                      supports it
198 # @fragmented-clusters: total number of fragmented clusters, this
199 #                       field is present if the driver for the image format
200 #                       supports it
202 # @compressed-clusters: total number of compressed clusters, this
203 #                       field is present if the driver for the image format
204 #                       supports it
206 # Since: 1.4
209 { 'struct': 'ImageCheck',
210   'data': {'filename': 'str', 'format': 'str', 'check-errors': 'int',
211            '*image-end-offset': 'int', '*corruptions': 'int', '*leaks': 'int',
212            '*corruptions-fixed': 'int', '*leaks-fixed': 'int',
213            '*total-clusters': 'int', '*allocated-clusters': 'int',
214            '*fragmented-clusters': 'int', '*compressed-clusters': 'int' } }
217 # @MapEntry:
219 # Mapping information from a virtual block range to a host file range
221 # @start: the start byte of the mapped virtual range
223 # @length: the number of bytes of the mapped virtual range
225 # @data: whether the mapped range has data
227 # @zero: whether the virtual blocks are zeroed
229 # @depth: the depth of the mapping
231 # @offset: the offset in file that the virtual sectors are mapped to
233 # @filename: filename that is referred to by @offset
235 # Since: 2.6
238 { 'struct': 'MapEntry',
239   'data': {'start': 'int', 'length': 'int', 'data': 'bool',
240            'zero': 'bool', 'depth': 'int', '*offset': 'int',
241            '*filename': 'str' } }
244 # @BlockdevCacheInfo:
246 # Cache mode information for a block device
248 # @writeback:   true if writeback mode is enabled
249 # @direct:      true if the host page cache is bypassed (O_DIRECT)
250 # @no-flush:    true if flush requests are ignored for the device
252 # Since: 2.3
254 { 'struct': 'BlockdevCacheInfo',
255   'data': { 'writeback': 'bool',
256             'direct': 'bool',
257             'no-flush': 'bool' } }
260 # @BlockDeviceInfo:
262 # Information about the backing device for a block device.
264 # @file: the filename of the backing device
266 # @node-name: the name of the block driver node (Since 2.0)
268 # @ro: true if the backing device was open read-only
270 # @drv: the name of the block format used to open the backing device. As of
271 #       0.14.0 this can be: 'blkdebug', 'bochs', 'cloop', 'cow', 'dmg',
272 #       'file', 'file', 'ftp', 'ftps', 'host_cdrom', 'host_device',
273 #       'http', 'https', 'luks', 'nbd', 'parallels', 'qcow',
274 #       'qcow2', 'raw', 'vdi', 'vmdk', 'vpc', 'vvfat'
275 #       2.2: 'archipelago' added, 'cow' dropped
276 #       2.3: 'host_floppy' deprecated
277 #       2.5: 'host_floppy' dropped
278 #       2.6: 'luks' added
279 #       2.8: 'replication' added, 'tftp' dropped
280 #       2.9: 'archipelago' dropped
282 # @backing_file: the name of the backing file (for copy-on-write)
284 # @backing_file_depth: number of files in the backing file chain (since: 1.2)
286 # @encrypted: true if the backing device is encrypted
288 # @encryption_key_missing: Deprecated; always false
290 # @detect_zeroes: detect and optimize zero writes (Since 2.1)
292 # @bps: total throughput limit in bytes per second is specified
294 # @bps_rd: read throughput limit in bytes per second is specified
296 # @bps_wr: write throughput limit in bytes per second is specified
298 # @iops: total I/O operations per second is specified
300 # @iops_rd: read I/O operations per second is specified
302 # @iops_wr: write I/O operations per second is specified
304 # @image: the info of image used (since: 1.6)
306 # @bps_max: total throughput limit during bursts,
307 #                     in bytes (Since 1.7)
309 # @bps_rd_max: read throughput limit during bursts,
310 #                        in bytes (Since 1.7)
312 # @bps_wr_max: write throughput limit during bursts,
313 #                        in bytes (Since 1.7)
315 # @iops_max: total I/O operations per second during bursts,
316 #                      in bytes (Since 1.7)
318 # @iops_rd_max: read I/O operations per second during bursts,
319 #                         in bytes (Since 1.7)
321 # @iops_wr_max: write I/O operations per second during bursts,
322 #                         in bytes (Since 1.7)
324 # @bps_max_length: maximum length of the @bps_max burst
325 #                            period, in seconds. (Since 2.6)
327 # @bps_rd_max_length: maximum length of the @bps_rd_max
328 #                               burst period, in seconds. (Since 2.6)
330 # @bps_wr_max_length: maximum length of the @bps_wr_max
331 #                               burst period, in seconds. (Since 2.6)
333 # @iops_max_length: maximum length of the @iops burst
334 #                             period, in seconds. (Since 2.6)
336 # @iops_rd_max_length: maximum length of the @iops_rd_max
337 #                                burst period, in seconds. (Since 2.6)
339 # @iops_wr_max_length: maximum length of the @iops_wr_max
340 #                                burst period, in seconds. (Since 2.6)
342 # @iops_size: an I/O size in bytes (Since 1.7)
344 # @group: throttle group name (Since 2.4)
346 # @cache: the cache mode used for the block device (since: 2.3)
348 # @write_threshold: configured write threshold for the device.
349 #                   0 if disabled. (Since 2.3)
351 # Since: 0.14.0
354 { 'struct': 'BlockDeviceInfo',
355   'data': { 'file': 'str', '*node-name': 'str', 'ro': 'bool', 'drv': 'str',
356             '*backing_file': 'str', 'backing_file_depth': 'int',
357             'encrypted': 'bool', 'encryption_key_missing': 'bool',
358             'detect_zeroes': 'BlockdevDetectZeroesOptions',
359             'bps': 'int', 'bps_rd': 'int', 'bps_wr': 'int',
360             'iops': 'int', 'iops_rd': 'int', 'iops_wr': 'int',
361             'image': 'ImageInfo',
362             '*bps_max': 'int', '*bps_rd_max': 'int',
363             '*bps_wr_max': 'int', '*iops_max': 'int',
364             '*iops_rd_max': 'int', '*iops_wr_max': 'int',
365             '*bps_max_length': 'int', '*bps_rd_max_length': 'int',
366             '*bps_wr_max_length': 'int', '*iops_max_length': 'int',
367             '*iops_rd_max_length': 'int', '*iops_wr_max_length': 'int',
368             '*iops_size': 'int', '*group': 'str', 'cache': 'BlockdevCacheInfo',
369             'write_threshold': 'int' } }
372 # @BlockDeviceIoStatus:
374 # An enumeration of block device I/O status.
376 # @ok: The last I/O operation has succeeded
378 # @failed: The last I/O operation has failed
380 # @nospace: The last I/O operation has failed due to a no-space condition
382 # Since: 1.0
384 { 'enum': 'BlockDeviceIoStatus', 'data': [ 'ok', 'failed', 'nospace' ] }
387 # @BlockDeviceMapEntry:
389 # Entry in the metadata map of the device (returned by "qemu-img map")
391 # @start: Offset in the image of the first byte described by this entry
392 #         (in bytes)
394 # @length: Length of the range described by this entry (in bytes)
396 # @depth: Number of layers (0 = top image, 1 = top image's backing file, etc.)
397 #         before reaching one for which the range is allocated.  The value is
398 #         in the range 0 to the depth of the image chain - 1.
400 # @zero: the sectors in this range read as zeros
402 # @data: reading the image will actually read data from a file (in particular,
403 #        if @offset is present this means that the sectors are not simply
404 #        preallocated, but contain actual data in raw format)
406 # @offset: if present, the image file stores the data for this range in
407 #          raw format at the given offset.
409 # Since: 1.7
411 { 'struct': 'BlockDeviceMapEntry',
412   'data': { 'start': 'int', 'length': 'int', 'depth': 'int', 'zero': 'bool',
413             'data': 'bool', '*offset': 'int' } }
416 # @DirtyBitmapStatus:
418 # An enumeration of possible states that a dirty bitmap can report to the user.
420 # @frozen: The bitmap is currently in-use by a backup operation or block job,
421 #          and is immutable.
423 # @disabled: The bitmap is currently in-use by an internal operation and is
424 #            read-only. It can still be deleted.
426 # @active: The bitmap is actively monitoring for new writes, and can be cleared,
427 #          deleted, or used for backup operations.
429 # @locked: The bitmap is currently in-use by some operation and can not be
430 #          cleared, deleted, or used for backup operations. (Since 2.12)
432 # Since: 2.4
434 { 'enum': 'DirtyBitmapStatus',
435   'data': ['active', 'disabled', 'frozen', 'locked'] }
438 # @BlockDirtyInfo:
440 # Block dirty bitmap information.
442 # @name: the name of the dirty bitmap (Since 2.4)
444 # @count: number of dirty bytes according to the dirty bitmap
446 # @granularity: granularity of the dirty bitmap in bytes (since 1.4)
448 # @status: current status of the dirty bitmap (since 2.4)
450 # Since: 1.3
452 { 'struct': 'BlockDirtyInfo',
453   'data': {'*name': 'str', 'count': 'int', 'granularity': 'uint32',
454            'status': 'DirtyBitmapStatus'} }
457 # @BlockInfo:
459 # Block device information.  This structure describes a virtual device and
460 # the backing device associated with it.
462 # @device: The device name associated with the virtual device.
464 # @qdev: The qdev ID, or if no ID is assigned, the QOM path of the block
465 #        device. (since 2.10)
467 # @type: This field is returned only for compatibility reasons, it should
468 #        not be used (always returns 'unknown')
470 # @removable: True if the device supports removable media.
472 # @locked: True if the guest has locked this device from having its media
473 #          removed
475 # @tray_open: True if the device's tray is open
476 #             (only present if it has a tray)
478 # @dirty-bitmaps: dirty bitmaps information (only present if the
479 #                 driver has one or more dirty bitmaps) (Since 2.0)
481 # @io-status: @BlockDeviceIoStatus. Only present if the device
482 #             supports it and the VM is configured to stop on errors
483 #             (supported device models: virtio-blk, IDE, SCSI except
484 #             scsi-generic)
486 # @inserted: @BlockDeviceInfo describing the device if media is
487 #            present
489 # Since:  0.14.0
491 { 'struct': 'BlockInfo',
492   'data': {'device': 'str', '*qdev': 'str', 'type': 'str', 'removable': 'bool',
493            'locked': 'bool', '*inserted': 'BlockDeviceInfo',
494            '*tray_open': 'bool', '*io-status': 'BlockDeviceIoStatus',
495            '*dirty-bitmaps': ['BlockDirtyInfo'] } }
498 # @BlockMeasureInfo:
500 # Image file size calculation information.  This structure describes the size
501 # requirements for creating a new image file.
503 # The size requirements depend on the new image file format.  File size always
504 # equals virtual disk size for the 'raw' format, even for sparse POSIX files.
505 # Compact formats such as 'qcow2' represent unallocated and zero regions
506 # efficiently so file size may be smaller than virtual disk size.
508 # The values are upper bounds that are guaranteed to fit the new image file.
509 # Subsequent modification, such as internal snapshot or bitmap creation, may
510 # require additional space and is not covered here.
512 # @required: Size required for a new image file, in bytes.
514 # @fully-allocated: Image file size, in bytes, once data has been written
515 #                   to all sectors.
517 # Since: 2.10
519 { 'struct': 'BlockMeasureInfo',
520   'data': {'required': 'int', 'fully-allocated': 'int'} }
523 # @query-block:
525 # Get a list of BlockInfo for all virtual block devices.
527 # Returns: a list of @BlockInfo describing each virtual block device. Filter
528 # nodes that were created implicitly are skipped over.
530 # Since: 0.14.0
532 # Example:
534 # -> { "execute": "query-block" }
535 # <- {
536 #       "return":[
537 #          {
538 #             "io-status": "ok",
539 #             "device":"ide0-hd0",
540 #             "locked":false,
541 #             "removable":false,
542 #             "inserted":{
543 #                "ro":false,
544 #                "drv":"qcow2",
545 #                "encrypted":false,
546 #                "file":"disks/test.qcow2",
547 #                "backing_file_depth":1,
548 #                "bps":1000000,
549 #                "bps_rd":0,
550 #                "bps_wr":0,
551 #                "iops":1000000,
552 #                "iops_rd":0,
553 #                "iops_wr":0,
554 #                "bps_max": 8000000,
555 #                "bps_rd_max": 0,
556 #                "bps_wr_max": 0,
557 #                "iops_max": 0,
558 #                "iops_rd_max": 0,
559 #                "iops_wr_max": 0,
560 #                "iops_size": 0,
561 #                "detect_zeroes": "on",
562 #                "write_threshold": 0,
563 #                "image":{
564 #                   "filename":"disks/test.qcow2",
565 #                   "format":"qcow2",
566 #                   "virtual-size":2048000,
567 #                   "backing_file":"base.qcow2",
568 #                   "full-backing-filename":"disks/base.qcow2",
569 #                   "backing-filename-format":"qcow2",
570 #                   "snapshots":[
571 #                      {
572 #                         "id": "1",
573 #                         "name": "snapshot1",
574 #                         "vm-state-size": 0,
575 #                         "date-sec": 10000200,
576 #                         "date-nsec": 12,
577 #                         "vm-clock-sec": 206,
578 #                         "vm-clock-nsec": 30
579 #                      }
580 #                   ],
581 #                   "backing-image":{
582 #                       "filename":"disks/base.qcow2",
583 #                       "format":"qcow2",
584 #                       "virtual-size":2048000
585 #                   }
586 #                }
587 #             },
588 #             "qdev": "ide_disk",
589 #             "type":"unknown"
590 #          },
591 #          {
592 #             "io-status": "ok",
593 #             "device":"ide1-cd0",
594 #             "locked":false,
595 #             "removable":true,
596 #             "qdev": "/machine/unattached/device[23]",
597 #             "tray_open": false,
598 #             "type":"unknown"
599 #          },
600 #          {
601 #             "device":"floppy0",
602 #             "locked":false,
603 #             "removable":true,
604 #             "qdev": "/machine/unattached/device[20]",
605 #             "type":"unknown"
606 #          },
607 #          {
608 #             "device":"sd0",
609 #             "locked":false,
610 #             "removable":true,
611 #             "type":"unknown"
612 #          }
613 #       ]
614 #    }
617 { 'command': 'query-block', 'returns': ['BlockInfo'] }
621 # @BlockDeviceTimedStats:
623 # Statistics of a block device during a given interval of time.
625 # @interval_length: Interval used for calculating the statistics,
626 #                   in seconds.
628 # @min_rd_latency_ns: Minimum latency of read operations in the
629 #                     defined interval, in nanoseconds.
631 # @min_wr_latency_ns: Minimum latency of write operations in the
632 #                     defined interval, in nanoseconds.
634 # @min_flush_latency_ns: Minimum latency of flush operations in the
635 #                        defined interval, in nanoseconds.
637 # @max_rd_latency_ns: Maximum latency of read operations in the
638 #                     defined interval, in nanoseconds.
640 # @max_wr_latency_ns: Maximum latency of write operations in the
641 #                     defined interval, in nanoseconds.
643 # @max_flush_latency_ns: Maximum latency of flush operations in the
644 #                        defined interval, in nanoseconds.
646 # @avg_rd_latency_ns: Average latency of read operations in the
647 #                     defined interval, in nanoseconds.
649 # @avg_wr_latency_ns: Average latency of write operations in the
650 #                     defined interval, in nanoseconds.
652 # @avg_flush_latency_ns: Average latency of flush operations in the
653 #                        defined interval, in nanoseconds.
655 # @avg_rd_queue_depth: Average number of pending read operations
656 #                      in the defined interval.
658 # @avg_wr_queue_depth: Average number of pending write operations
659 #                      in the defined interval.
661 # Since: 2.5
663 { 'struct': 'BlockDeviceTimedStats',
664   'data': { 'interval_length': 'int', 'min_rd_latency_ns': 'int',
665             'max_rd_latency_ns': 'int', 'avg_rd_latency_ns': 'int',
666             'min_wr_latency_ns': 'int', 'max_wr_latency_ns': 'int',
667             'avg_wr_latency_ns': 'int', 'min_flush_latency_ns': 'int',
668             'max_flush_latency_ns': 'int', 'avg_flush_latency_ns': 'int',
669             'avg_rd_queue_depth': 'number', 'avg_wr_queue_depth': 'number' } }
672 # @BlockDeviceStats:
674 # Statistics of a virtual block device or a block backing device.
676 # @rd_bytes:      The number of bytes read by the device.
678 # @wr_bytes:      The number of bytes written by the device.
680 # @rd_operations: The number of read operations performed by the device.
682 # @wr_operations: The number of write operations performed by the device.
684 # @flush_operations: The number of cache flush operations performed by the
685 #                    device (since 0.15.0)
687 # @flush_total_time_ns: Total time spend on cache flushes in nano-seconds
688 #                       (since 0.15.0).
690 # @wr_total_time_ns: Total time spend on writes in nano-seconds (since 0.15.0).
692 # @rd_total_time_ns: Total_time_spend on reads in nano-seconds (since 0.15.0).
694 # @wr_highest_offset: The offset after the greatest byte written to the
695 #                     device.  The intended use of this information is for
696 #                     growable sparse files (like qcow2) that are used on top
697 #                     of a physical device.
699 # @rd_merged: Number of read requests that have been merged into another
700 #             request (Since 2.3).
702 # @wr_merged: Number of write requests that have been merged into another
703 #             request (Since 2.3).
705 # @idle_time_ns: Time since the last I/O operation, in
706 #                nanoseconds. If the field is absent it means that
707 #                there haven't been any operations yet (Since 2.5).
709 # @failed_rd_operations: The number of failed read operations
710 #                        performed by the device (Since 2.5)
712 # @failed_wr_operations: The number of failed write operations
713 #                        performed by the device (Since 2.5)
715 # @failed_flush_operations: The number of failed flush operations
716 #                           performed by the device (Since 2.5)
718 # @invalid_rd_operations: The number of invalid read operations
719 #                          performed by the device (Since 2.5)
721 # @invalid_wr_operations: The number of invalid write operations
722 #                         performed by the device (Since 2.5)
724 # @invalid_flush_operations: The number of invalid flush operations
725 #                            performed by the device (Since 2.5)
727 # @account_invalid: Whether invalid operations are included in the
728 #                   last access statistics (Since 2.5)
730 # @account_failed: Whether failed operations are included in the
731 #                  latency and last access statistics (Since 2.5)
733 # @timed_stats: Statistics specific to the set of previously defined
734 #               intervals of time (Since 2.5)
736 # Since: 0.14.0
738 { 'struct': 'BlockDeviceStats',
739   'data': {'rd_bytes': 'int', 'wr_bytes': 'int', 'rd_operations': 'int',
740            'wr_operations': 'int', 'flush_operations': 'int',
741            'flush_total_time_ns': 'int', 'wr_total_time_ns': 'int',
742            'rd_total_time_ns': 'int', 'wr_highest_offset': 'int',
743            'rd_merged': 'int', 'wr_merged': 'int', '*idle_time_ns': 'int',
744            'failed_rd_operations': 'int', 'failed_wr_operations': 'int',
745            'failed_flush_operations': 'int', 'invalid_rd_operations': 'int',
746            'invalid_wr_operations': 'int', 'invalid_flush_operations': 'int',
747            'account_invalid': 'bool', 'account_failed': 'bool',
748            'timed_stats': ['BlockDeviceTimedStats'] } }
751 # @BlockStats:
753 # Statistics of a virtual block device or a block backing device.
755 # @device: If the stats are for a virtual block device, the name
756 #          corresponding to the virtual block device.
758 # @node-name: The node name of the device. (Since 2.3)
760 # @stats:  A @BlockDeviceStats for the device.
762 # @parent: This describes the file block device if it has one.
763 #          Contains recursively the statistics of the underlying
764 #          protocol (e.g. the host file for a qcow2 image). If there is
765 #          no underlying protocol, this field is omitted
767 # @backing: This describes the backing block device if it has one.
768 #           (Since 2.0)
770 # Since: 0.14.0
772 { 'struct': 'BlockStats',
773   'data': {'*device': 'str', '*node-name': 'str',
774            'stats': 'BlockDeviceStats',
775            '*parent': 'BlockStats',
776            '*backing': 'BlockStats'} }
779 # @query-blockstats:
781 # Query the @BlockStats for all virtual block devices.
783 # @query-nodes: If true, the command will query all the block nodes
784 #               that have a node name, in a list which will include "parent"
785 #               information, but not "backing".
786 #               If false or omitted, the behavior is as before - query all the
787 #               device backends, recursively including their "parent" and
788 #               "backing". Filter nodes that were created implicitly are
789 #               skipped over in this mode. (Since 2.3)
791 # Returns: A list of @BlockStats for each virtual block devices.
793 # Since: 0.14.0
795 # Example:
797 # -> { "execute": "query-blockstats" }
798 # <- {
799 #       "return":[
800 #          {
801 #             "device":"ide0-hd0",
802 #             "parent":{
803 #                "stats":{
804 #                   "wr_highest_offset":3686448128,
805 #                   "wr_bytes":9786368,
806 #                   "wr_operations":751,
807 #                   "rd_bytes":122567168,
808 #                   "rd_operations":36772
809 #                   "wr_total_times_ns":313253456
810 #                   "rd_total_times_ns":3465673657
811 #                   "flush_total_times_ns":49653
812 #                   "flush_operations":61,
813 #                   "rd_merged":0,
814 #                   "wr_merged":0,
815 #                   "idle_time_ns":2953431879,
816 #                   "account_invalid":true,
817 #                   "account_failed":false
818 #                }
819 #             },
820 #             "stats":{
821 #                "wr_highest_offset":2821110784,
822 #                "wr_bytes":9786368,
823 #                "wr_operations":692,
824 #                "rd_bytes":122739200,
825 #                "rd_operations":36604
826 #                "flush_operations":51,
827 #                "wr_total_times_ns":313253456
828 #                "rd_total_times_ns":3465673657
829 #                "flush_total_times_ns":49653,
830 #                "rd_merged":0,
831 #                "wr_merged":0,
832 #                "idle_time_ns":2953431879,
833 #                "account_invalid":true,
834 #                "account_failed":false
835 #             }
836 #          },
837 #          {
838 #             "device":"ide1-cd0",
839 #             "stats":{
840 #                "wr_highest_offset":0,
841 #                "wr_bytes":0,
842 #                "wr_operations":0,
843 #                "rd_bytes":0,
844 #                "rd_operations":0
845 #                "flush_operations":0,
846 #                "wr_total_times_ns":0
847 #                "rd_total_times_ns":0
848 #                "flush_total_times_ns":0,
849 #                "rd_merged":0,
850 #                "wr_merged":0,
851 #                "account_invalid":false,
852 #                "account_failed":false
853 #             }
854 #          },
855 #          {
856 #             "device":"floppy0",
857 #             "stats":{
858 #                "wr_highest_offset":0,
859 #                "wr_bytes":0,
860 #                "wr_operations":0,
861 #                "rd_bytes":0,
862 #                "rd_operations":0
863 #                "flush_operations":0,
864 #                "wr_total_times_ns":0
865 #                "rd_total_times_ns":0
866 #                "flush_total_times_ns":0,
867 #                "rd_merged":0,
868 #                "wr_merged":0,
869 #                "account_invalid":false,
870 #                "account_failed":false
871 #             }
872 #          },
873 #          {
874 #             "device":"sd0",
875 #             "stats":{
876 #                "wr_highest_offset":0,
877 #                "wr_bytes":0,
878 #                "wr_operations":0,
879 #                "rd_bytes":0,
880 #                "rd_operations":0
881 #                "flush_operations":0,
882 #                "wr_total_times_ns":0
883 #                "rd_total_times_ns":0
884 #                "flush_total_times_ns":0,
885 #                "rd_merged":0,
886 #                "wr_merged":0,
887 #                "account_invalid":false,
888 #                "account_failed":false
889 #             }
890 #          }
891 #       ]
892 #    }
895 { 'command': 'query-blockstats',
896   'data': { '*query-nodes': 'bool' },
897   'returns': ['BlockStats'] }
900 # @BlockdevOnError:
902 # An enumeration of possible behaviors for errors on I/O operations.
903 # The exact meaning depends on whether the I/O was initiated by a guest
904 # or by a block job
906 # @report: for guest operations, report the error to the guest;
907 #          for jobs, cancel the job
909 # @ignore: ignore the error, only report a QMP event (BLOCK_IO_ERROR
910 #          or BLOCK_JOB_ERROR)
912 # @enospc: same as @stop on ENOSPC, same as @report otherwise.
914 # @stop: for guest operations, stop the virtual machine;
915 #        for jobs, pause the job
917 # @auto: inherit the error handling policy of the backend (since: 2.7)
919 # Since: 1.3
921 { 'enum': 'BlockdevOnError',
922   'data': ['report', 'ignore', 'enospc', 'stop', 'auto'] }
925 # @MirrorSyncMode:
927 # An enumeration of possible behaviors for the initial synchronization
928 # phase of storage mirroring.
930 # @top: copies data in the topmost image to the destination
932 # @full: copies data from all images to the destination
934 # @none: only copy data written from now on
936 # @incremental: only copy data described by the dirty bitmap. Since: 2.4
938 # Since: 1.3
940 { 'enum': 'MirrorSyncMode',
941   'data': ['top', 'full', 'none', 'incremental'] }
944 # @BlockJobType:
946 # Type of a block job.
948 # @commit: block commit job type, see "block-commit"
950 # @stream: block stream job type, see "block-stream"
952 # @mirror: drive mirror job type, see "drive-mirror"
954 # @backup: drive backup job type, see "drive-backup"
956 # Since: 1.7
958 { 'enum': 'BlockJobType',
959   'data': ['commit', 'stream', 'mirror', 'backup'] }
962 # @BlockJobVerb:
964 # Represents command verbs that can be applied to a blockjob.
966 # @cancel: see @block-job-cancel
968 # @pause: see @block-job-pause
970 # @resume: see @block-job-resume
972 # @set-speed: see @block-job-set-speed
974 # @complete: see @block-job-complete
976 # @dismiss: see @block-job-dismiss
978 # @finalize: see @block-job-finalize
980 # Since: 2.12
982 { 'enum': 'BlockJobVerb',
983   'data': ['cancel', 'pause', 'resume', 'set-speed', 'complete', 'dismiss',
984            'finalize' ] }
987 # @BlockJobStatus:
989 # Indicates the present state of a given blockjob in its lifetime.
991 # @undefined: Erroneous, default state. Should not ever be visible.
993 # @created: The job has been created, but not yet started.
995 # @running: The job is currently running.
997 # @paused: The job is running, but paused. The pause may be requested by
998 #          either the QMP user or by internal processes.
1000 # @ready: The job is running, but is ready for the user to signal completion.
1001 #         This is used for long-running jobs like mirror that are designed to
1002 #         run indefinitely.
1004 # @standby: The job is ready, but paused. This is nearly identical to @paused.
1005 #           The job may return to @ready or otherwise be canceled.
1007 # @waiting: The job is waiting for other jobs in the transaction to converge
1008 #           to the waiting state. This status will likely not be visible for
1009 #           the last job in a transaction.
1011 # @pending: The job has finished its work, but has finalization steps that it
1012 #           needs to make prior to completing. These changes may require
1013 #           manual intervention by the management process if manual was set
1014 #           to true. These changes may still fail.
1016 # @aborting: The job is in the process of being aborted, and will finish with
1017 #            an error. The job will afterwards report that it is @concluded.
1018 #            This status may not be visible to the management process.
1020 # @concluded: The job has finished all work. If manual was set to true, the job
1021 #             will remain in the query list until it is dismissed.
1023 # @null: The job is in the process of being dismantled. This state should not
1024 #        ever be visible externally.
1026 # Since: 2.12
1028 { 'enum': 'BlockJobStatus',
1029   'data': ['undefined', 'created', 'running', 'paused', 'ready', 'standby',
1030            'waiting', 'pending', 'aborting', 'concluded', 'null' ] }
1033 # @BlockJobInfo:
1035 # Information about a long-running block device operation.
1037 # @type: the job type ('stream' for image streaming)
1039 # @device: The job identifier. Originally the device name but other
1040 #          values are allowed since QEMU 2.7
1042 # @len: the maximum progress value
1044 # @busy: false if the job is known to be in a quiescent state, with
1045 #        no pending I/O.  Since 1.3.
1047 # @paused: whether the job is paused or, if @busy is true, will
1048 #          pause itself as soon as possible.  Since 1.3.
1050 # @offset: the current progress value
1052 # @speed: the rate limit, bytes per second
1054 # @io-status: the status of the job (since 1.3)
1056 # @ready: true if the job may be completed (since 2.2)
1058 # @status: Current job state/status (since 2.12)
1060 # @auto-finalize: Job will finalize itself when PENDING, moving to
1061 #                 the CONCLUDED state. (since 2.12)
1063 # @auto-dismiss: Job will dismiss itself when CONCLUDED, moving to the NULL
1064 #                state and disappearing from the query list. (since 2.12)
1066 # Since: 1.1
1068 { 'struct': 'BlockJobInfo',
1069   'data': {'type': 'str', 'device': 'str', 'len': 'int',
1070            'offset': 'int', 'busy': 'bool', 'paused': 'bool', 'speed': 'int',
1071            'io-status': 'BlockDeviceIoStatus', 'ready': 'bool',
1072            'status': 'BlockJobStatus',
1073            'auto-finalize': 'bool', 'auto-dismiss': 'bool' } }
1076 # @query-block-jobs:
1078 # Return information about long-running block device operations.
1080 # Returns: a list of @BlockJobInfo for each active block job
1082 # Since: 1.1
1084 { 'command': 'query-block-jobs', 'returns': ['BlockJobInfo'] }
1087 # @block_passwd:
1089 # This command sets the password of a block device that has not been open
1090 # with a password and requires one.
1092 # This command is now obsolete and will always return an error since 2.10
1095 { 'command': 'block_passwd', 'data': {'*device': 'str',
1096                                       '*node-name': 'str', 'password': 'str'} }
1099 # @block_resize:
1101 # Resize a block image while a guest is running.
1103 # Either @device or @node-name must be set but not both.
1105 # @device: the name of the device to get the image resized
1107 # @node-name: graph node name to get the image resized (Since 2.0)
1109 # @size:  new image size in bytes
1111 # Returns: nothing on success
1112 #          If @device is not a valid block device, DeviceNotFound
1114 # Since: 0.14.0
1116 # Example:
1118 # -> { "execute": "block_resize",
1119 #      "arguments": { "device": "scratch", "size": 1073741824 } }
1120 # <- { "return": {} }
1123 { 'command': 'block_resize', 'data': { '*device': 'str',
1124                                        '*node-name': 'str',
1125                                        'size': 'int' }}
1128 # @NewImageMode:
1130 # An enumeration that tells QEMU how to set the backing file path in
1131 # a new image file.
1133 # @existing: QEMU should look for an existing image file.
1135 # @absolute-paths: QEMU should create a new image with absolute paths
1136 # for the backing file. If there is no backing file available, the new
1137 # image will not be backed either.
1139 # Since: 1.1
1141 { 'enum': 'NewImageMode',
1142   'data': [ 'existing', 'absolute-paths' ] }
1145 # @BlockdevSnapshotSync:
1147 # Either @device or @node-name must be set but not both.
1149 # @device: the name of the device to generate the snapshot from.
1151 # @node-name: graph node name to generate the snapshot from (Since 2.0)
1153 # @snapshot-file: the target of the new image. If the file exists, or
1154 # if it is a device, the snapshot will be created in the existing
1155 # file/device. Otherwise, a new file will be created.
1157 # @snapshot-node-name: the graph node name of the new image (Since 2.0)
1159 # @format: the format of the snapshot image, default is 'qcow2'.
1161 # @mode: whether and how QEMU should create a new image, default is
1162 #        'absolute-paths'.
1164 { 'struct': 'BlockdevSnapshotSync',
1165   'data': { '*device': 'str', '*node-name': 'str',
1166             'snapshot-file': 'str', '*snapshot-node-name': 'str',
1167             '*format': 'str', '*mode': 'NewImageMode' } }
1170 # @BlockdevSnapshot:
1172 # @node: device or node name that will have a snapshot created.
1174 # @overlay: reference to the existing block device that will become
1175 #           the overlay of @node, as part of creating the snapshot.
1176 #           It must not have a current backing file (this can be
1177 #           achieved by passing "backing": "" to blockdev-add).
1179 # Since: 2.5
1181 { 'struct': 'BlockdevSnapshot',
1182   'data': { 'node': 'str', 'overlay': 'str' } }
1185 # @DriveBackup:
1187 # @job-id: identifier for the newly-created block job. If
1188 #          omitted, the device name will be used. (Since 2.7)
1190 # @device: the device name or node-name of a root node which should be copied.
1192 # @target: the target of the new image. If the file exists, or if it
1193 #          is a device, the existing file/device will be used as the new
1194 #          destination.  If it does not exist, a new file will be created.
1196 # @format: the format of the new destination, default is to
1197 #          probe if @mode is 'existing', else the format of the source
1199 # @sync: what parts of the disk image should be copied to the destination
1200 #        (all the disk, only the sectors allocated in the topmost image, from a
1201 #        dirty bitmap, or only new I/O).
1203 # @mode: whether and how QEMU should create a new image, default is
1204 #        'absolute-paths'.
1206 # @speed: the maximum speed, in bytes per second
1208 # @bitmap: the name of dirty bitmap if sync is "incremental".
1209 #          Must be present if sync is "incremental", must NOT be present
1210 #          otherwise. (Since 2.4)
1212 # @compress: true to compress data, if the target format supports it.
1213 #            (default: false) (since 2.8)
1215 # @on-source-error: the action to take on an error on the source,
1216 #                   default 'report'.  'stop' and 'enospc' can only be used
1217 #                   if the block device supports io-status (see BlockInfo).
1219 # @on-target-error: the action to take on an error on the target,
1220 #                   default 'report' (no limitations, since this applies to
1221 #                   a different block device than @device).
1223 # @auto-finalize: When false, this job will wait in a PENDING state after it has
1224 #                 finished its work, waiting for @block-job-finalize.
1225 #                 When true, this job will automatically perform its abort or
1226 #                 commit actions.
1227 #                 Defaults to true. (Since 2.12)
1229 # @auto-dismiss: When false, this job will wait in a CONCLUDED state after it
1230 #                has completed ceased all work, and wait for @block-job-dismiss.
1231 #                When true, this job will automatically disappear from the query
1232 #                list without user intervention.
1233 #                Defaults to true. (Since 2.12)
1235 # Note: @on-source-error and @on-target-error only affect background
1236 # I/O.  If an error occurs during a guest write request, the device's
1237 # rerror/werror actions will be used.
1239 # Since: 1.6
1241 { 'struct': 'DriveBackup',
1242   'data': { '*job-id': 'str', 'device': 'str', 'target': 'str',
1243             '*format': 'str', 'sync': 'MirrorSyncMode',
1244             '*mode': 'NewImageMode', '*speed': 'int',
1245             '*bitmap': 'str', '*compress': 'bool',
1246             '*on-source-error': 'BlockdevOnError',
1247             '*on-target-error': 'BlockdevOnError',
1248             '*auto-finalize': 'bool', '*auto-dismiss': 'bool' } }
1251 # @BlockdevBackup:
1253 # @job-id: identifier for the newly-created block job. If
1254 #          omitted, the device name will be used. (Since 2.7)
1256 # @device: the device name or node-name of a root node which should be copied.
1258 # @target: the device name or node-name of the backup target node.
1260 # @sync: what parts of the disk image should be copied to the destination
1261 #        (all the disk, only the sectors allocated in the topmost image, or
1262 #        only new I/O).
1264 # @speed: the maximum speed, in bytes per second. The default is 0,
1265 #         for unlimited.
1267 # @compress: true to compress data, if the target format supports it.
1268 #            (default: false) (since 2.8)
1270 # @on-source-error: the action to take on an error on the source,
1271 #                   default 'report'.  'stop' and 'enospc' can only be used
1272 #                   if the block device supports io-status (see BlockInfo).
1274 # @on-target-error: the action to take on an error on the target,
1275 #                   default 'report' (no limitations, since this applies to
1276 #                   a different block device than @device).
1278 # @auto-finalize: When false, this job will wait in a PENDING state after it has
1279 #                 finished its work, waiting for @block-job-finalize.
1280 #                 When true, this job will automatically perform its abort or
1281 #                 commit actions.
1282 #                 Defaults to true. (Since 2.12)
1284 # @auto-dismiss: When false, this job will wait in a CONCLUDED state after it
1285 #                has completed ceased all work, and wait for @block-job-dismiss.
1286 #                When true, this job will automatically disappear from the query
1287 #                list without user intervention.
1288 #                Defaults to true. (Since 2.12)
1290 # Note: @on-source-error and @on-target-error only affect background
1291 # I/O.  If an error occurs during a guest write request, the device's
1292 # rerror/werror actions will be used.
1294 # Since: 2.3
1296 { 'struct': 'BlockdevBackup',
1297   'data': { '*job-id': 'str', 'device': 'str', 'target': 'str',
1298             'sync': 'MirrorSyncMode', '*speed': 'int', '*compress': 'bool',
1299             '*on-source-error': 'BlockdevOnError',
1300             '*on-target-error': 'BlockdevOnError',
1301             '*auto-finalize': 'bool', '*auto-dismiss': 'bool' } }
1304 # @blockdev-snapshot-sync:
1306 # Generates a synchronous snapshot of a block device.
1308 # For the arguments, see the documentation of BlockdevSnapshotSync.
1310 # Returns: nothing on success
1311 #          If @device is not a valid block device, DeviceNotFound
1313 # Since: 0.14.0
1315 # Example:
1317 # -> { "execute": "blockdev-snapshot-sync",
1318 #      "arguments": { "device": "ide-hd0",
1319 #                     "snapshot-file":
1320 #                     "/some/place/my-image",
1321 #                     "format": "qcow2" } }
1322 # <- { "return": {} }
1325 { 'command': 'blockdev-snapshot-sync',
1326   'data': 'BlockdevSnapshotSync' }
1330 # @blockdev-snapshot:
1332 # Generates a snapshot of a block device.
1334 # Create a snapshot, by installing 'node' as the backing image of
1335 # 'overlay'. Additionally, if 'node' is associated with a block
1336 # device, the block device changes to using 'overlay' as its new active
1337 # image.
1339 # For the arguments, see the documentation of BlockdevSnapshot.
1341 # Since: 2.5
1343 # Example:
1345 # -> { "execute": "blockdev-add",
1346 #      "arguments": { "driver": "qcow2",
1347 #                     "node-name": "node1534",
1348 #                     "file": { "driver": "file",
1349 #                               "filename": "hd1.qcow2" },
1350 #                     "backing": "" } }
1352 # <- { "return": {} }
1354 # -> { "execute": "blockdev-snapshot",
1355 #      "arguments": { "node": "ide-hd0",
1356 #                     "overlay": "node1534" } }
1357 # <- { "return": {} }
1360 { 'command': 'blockdev-snapshot',
1361   'data': 'BlockdevSnapshot' }
1364 # @change-backing-file:
1366 # Change the backing file in the image file metadata.  This does not
1367 # cause QEMU to reopen the image file to reparse the backing filename
1368 # (it may, however, perform a reopen to change permissions from
1369 # r/o -> r/w -> r/o, if needed). The new backing file string is written
1370 # into the image file metadata, and the QEMU internal strings are
1371 # updated.
1373 # @image-node-name: The name of the block driver state node of the
1374 #                   image to modify. The "device" argument is used
1375 #                   to verify "image-node-name" is in the chain
1376 #                   described by "device".
1378 # @device:          The device name or node-name of the root node that owns
1379 #                   image-node-name.
1381 # @backing-file:    The string to write as the backing file.  This
1382 #                   string is not validated, so care should be taken
1383 #                   when specifying the string or the image chain may
1384 #                   not be able to be reopened again.
1386 # Returns: Nothing on success
1388 #          If "device" does not exist or cannot be determined, DeviceNotFound
1390 # Since: 2.1
1392 { 'command': 'change-backing-file',
1393   'data': { 'device': 'str', 'image-node-name': 'str',
1394             'backing-file': 'str' } }
1397 # @block-commit:
1399 # Live commit of data from overlay image nodes into backing nodes - i.e.,
1400 # writes data between 'top' and 'base' into 'base'.
1402 # @job-id: identifier for the newly-created block job. If
1403 #          omitted, the device name will be used. (Since 2.7)
1405 # @device:  the device name or node-name of a root node
1407 # @base:   The file name of the backing image to write data into.
1408 #                    If not specified, this is the deepest backing image.
1410 # @top:    The file name of the backing image within the image chain,
1411 #                    which contains the topmost data to be committed down. If
1412 #                    not specified, this is the active layer.
1414 # @backing-file:  The backing file string to write into the overlay
1415 #                           image of 'top'.  If 'top' is the active layer,
1416 #                           specifying a backing file string is an error. This
1417 #                           filename is not validated.
1419 #                           If a pathname string is such that it cannot be
1420 #                           resolved by QEMU, that means that subsequent QMP or
1421 #                           HMP commands must use node-names for the image in
1422 #                           question, as filename lookup methods will fail.
1424 #                           If not specified, QEMU will automatically determine
1425 #                           the backing file string to use, or error out if
1426 #                           there is no obvious choice. Care should be taken
1427 #                           when specifying the string, to specify a valid
1428 #                           filename or protocol.
1429 #                           (Since 2.1)
1431 #                    If top == base, that is an error.
1432 #                    If top == active, the job will not be completed by itself,
1433 #                    user needs to complete the job with the block-job-complete
1434 #                    command after getting the ready event. (Since 2.0)
1436 #                    If the base image is smaller than top, then the base image
1437 #                    will be resized to be the same size as top.  If top is
1438 #                    smaller than the base image, the base will not be
1439 #                    truncated.  If you want the base image size to match the
1440 #                    size of the smaller top, you can safely truncate it
1441 #                    yourself once the commit operation successfully completes.
1443 # @speed:  the maximum speed, in bytes per second
1445 # @filter-node-name: the node name that should be assigned to the
1446 #                    filter driver that the commit job inserts into the graph
1447 #                    above @top. If this option is not given, a node name is
1448 #                    autogenerated. (Since: 2.9)
1450 # Returns: Nothing on success
1451 #          If commit or stream is already active on this device, DeviceInUse
1452 #          If @device does not exist, DeviceNotFound
1453 #          If image commit is not supported by this device, NotSupported
1454 #          If @base or @top is invalid, a generic error is returned
1455 #          If @speed is invalid, InvalidParameter
1457 # Since: 1.3
1459 # Example:
1461 # -> { "execute": "block-commit",
1462 #      "arguments": { "device": "virtio0",
1463 #                     "top": "/tmp/snap1.qcow2" } }
1464 # <- { "return": {} }
1467 { 'command': 'block-commit',
1468   'data': { '*job-id': 'str', 'device': 'str', '*base': 'str', '*top': 'str',
1469             '*backing-file': 'str', '*speed': 'int',
1470             '*filter-node-name': 'str' } }
1473 # @drive-backup:
1475 # Start a point-in-time copy of a block device to a new destination.  The
1476 # status of ongoing drive-backup operations can be checked with
1477 # query-block-jobs where the BlockJobInfo.type field has the value 'backup'.
1478 # The operation can be stopped before it has completed using the
1479 # block-job-cancel command.
1481 # Returns: nothing on success
1482 #          If @device is not a valid block device, GenericError
1484 # Since: 1.6
1486 # Example:
1488 # -> { "execute": "drive-backup",
1489 #      "arguments": { "device": "drive0",
1490 #                     "sync": "full",
1491 #                     "target": "backup.img" } }
1492 # <- { "return": {} }
1495 { 'command': 'drive-backup', 'boxed': true,
1496   'data': 'DriveBackup' }
1499 # @blockdev-backup:
1501 # Start a point-in-time copy of a block device to a new destination.  The
1502 # status of ongoing blockdev-backup operations can be checked with
1503 # query-block-jobs where the BlockJobInfo.type field has the value 'backup'.
1504 # The operation can be stopped before it has completed using the
1505 # block-job-cancel command.
1507 # Returns: nothing on success
1508 #          If @device is not a valid block device, DeviceNotFound
1510 # Since: 2.3
1512 # Example:
1513 # -> { "execute": "blockdev-backup",
1514 #      "arguments": { "device": "src-id",
1515 #                     "sync": "full",
1516 #                     "target": "tgt-id" } }
1517 # <- { "return": {} }
1520 { 'command': 'blockdev-backup', 'boxed': true,
1521   'data': 'BlockdevBackup' }
1525 # @query-named-block-nodes:
1527 # Get the named block driver list
1529 # Returns: the list of BlockDeviceInfo
1531 # Since: 2.0
1533 # Example:
1535 # -> { "execute": "query-named-block-nodes" }
1536 # <- { "return": [ { "ro":false,
1537 #                    "drv":"qcow2",
1538 #                    "encrypted":false,
1539 #                    "file":"disks/test.qcow2",
1540 #                    "node-name": "my-node",
1541 #                    "backing_file_depth":1,
1542 #                    "bps":1000000,
1543 #                    "bps_rd":0,
1544 #                    "bps_wr":0,
1545 #                    "iops":1000000,
1546 #                    "iops_rd":0,
1547 #                    "iops_wr":0,
1548 #                    "bps_max": 8000000,
1549 #                    "bps_rd_max": 0,
1550 #                    "bps_wr_max": 0,
1551 #                    "iops_max": 0,
1552 #                    "iops_rd_max": 0,
1553 #                    "iops_wr_max": 0,
1554 #                    "iops_size": 0,
1555 #                    "write_threshold": 0,
1556 #                    "image":{
1557 #                       "filename":"disks/test.qcow2",
1558 #                       "format":"qcow2",
1559 #                       "virtual-size":2048000,
1560 #                       "backing_file":"base.qcow2",
1561 #                       "full-backing-filename":"disks/base.qcow2",
1562 #                       "backing-filename-format":"qcow2",
1563 #                       "snapshots":[
1564 #                          {
1565 #                             "id": "1",
1566 #                             "name": "snapshot1",
1567 #                             "vm-state-size": 0,
1568 #                             "date-sec": 10000200,
1569 #                             "date-nsec": 12,
1570 #                             "vm-clock-sec": 206,
1571 #                             "vm-clock-nsec": 30
1572 #                          }
1573 #                       ],
1574 #                       "backing-image":{
1575 #                           "filename":"disks/base.qcow2",
1576 #                           "format":"qcow2",
1577 #                           "virtual-size":2048000
1578 #                       }
1579 #                    } } ] }
1582 { 'command': 'query-named-block-nodes', 'returns': [ 'BlockDeviceInfo' ] }
1585 # @drive-mirror:
1587 # Start mirroring a block device's writes to a new destination. target
1588 # specifies the target of the new image. If the file exists, or if it
1589 # is a device, it will be used as the new destination for writes. If
1590 # it does not exist, a new file will be created. format specifies the
1591 # format of the mirror image, default is to probe if mode='existing',
1592 # else the format of the source.
1594 # Returns: nothing on success
1595 #          If @device is not a valid block device, GenericError
1597 # Since: 1.3
1599 # Example:
1601 # -> { "execute": "drive-mirror",
1602 #      "arguments": { "device": "ide-hd0",
1603 #                     "target": "/some/place/my-image",
1604 #                     "sync": "full",
1605 #                     "format": "qcow2" } }
1606 # <- { "return": {} }
1609 { 'command': 'drive-mirror', 'boxed': true,
1610   'data': 'DriveMirror' }
1613 # @DriveMirror:
1615 # A set of parameters describing drive mirror setup.
1617 # @job-id: identifier for the newly-created block job. If
1618 #          omitted, the device name will be used. (Since 2.7)
1620 # @device:  the device name or node-name of a root node whose writes should be
1621 #           mirrored.
1623 # @target: the target of the new image. If the file exists, or if it
1624 #          is a device, the existing file/device will be used as the new
1625 #          destination.  If it does not exist, a new file will be created.
1627 # @format: the format of the new destination, default is to
1628 #          probe if @mode is 'existing', else the format of the source
1630 # @node-name: the new block driver state node name in the graph
1631 #             (Since 2.1)
1633 # @replaces: with sync=full graph node name to be replaced by the new
1634 #            image when a whole image copy is done. This can be used to repair
1635 #            broken Quorum files. (Since 2.1)
1637 # @mode: whether and how QEMU should create a new image, default is
1638 #        'absolute-paths'.
1640 # @speed:  the maximum speed, in bytes per second
1642 # @sync: what parts of the disk image should be copied to the destination
1643 #        (all the disk, only the sectors allocated in the topmost image, or
1644 #        only new I/O).
1646 # @granularity: granularity of the dirty bitmap, default is 64K
1647 #               if the image format doesn't have clusters, 4K if the clusters
1648 #               are smaller than that, else the cluster size.  Must be a
1649 #               power of 2 between 512 and 64M (since 1.4).
1651 # @buf-size: maximum amount of data in flight from source to
1652 #            target (since 1.4).
1654 # @on-source-error: the action to take on an error on the source,
1655 #                   default 'report'.  'stop' and 'enospc' can only be used
1656 #                   if the block device supports io-status (see BlockInfo).
1658 # @on-target-error: the action to take on an error on the target,
1659 #                   default 'report' (no limitations, since this applies to
1660 #                   a different block device than @device).
1661 # @unmap: Whether to try to unmap target sectors where source has
1662 #         only zero. If true, and target unallocated sectors will read as zero,
1663 #         target image sectors will be unmapped; otherwise, zeroes will be
1664 #         written. Both will result in identical contents.
1665 #         Default is true. (Since 2.4)
1667 # Since: 1.3
1669 { 'struct': 'DriveMirror',
1670   'data': { '*job-id': 'str', 'device': 'str', 'target': 'str',
1671             '*format': 'str', '*node-name': 'str', '*replaces': 'str',
1672             'sync': 'MirrorSyncMode', '*mode': 'NewImageMode',
1673             '*speed': 'int', '*granularity': 'uint32',
1674             '*buf-size': 'int', '*on-source-error': 'BlockdevOnError',
1675             '*on-target-error': 'BlockdevOnError',
1676             '*unmap': 'bool' } }
1679 # @BlockDirtyBitmap:
1681 # @node: name of device/node which the bitmap is tracking
1683 # @name: name of the dirty bitmap
1685 # Since: 2.4
1687 { 'struct': 'BlockDirtyBitmap',
1688   'data': { 'node': 'str', 'name': 'str' } }
1691 # @BlockDirtyBitmapAdd:
1693 # @node: name of device/node which the bitmap is tracking
1695 # @name: name of the dirty bitmap
1697 # @granularity: the bitmap granularity, default is 64k for
1698 #               block-dirty-bitmap-add
1700 # @persistent: the bitmap is persistent, i.e. it will be saved to the
1701 #              corresponding block device image file on its close. For now only
1702 #              Qcow2 disks support persistent bitmaps. Default is false for
1703 #              block-dirty-bitmap-add. (Since: 2.10)
1705 # @autoload: ignored and deprecated since 2.12.
1706 #            Currently, all dirty tracking bitmaps are loaded from Qcow2 on
1707 #            open.
1709 # Since: 2.4
1711 { 'struct': 'BlockDirtyBitmapAdd',
1712   'data': { 'node': 'str', 'name': 'str', '*granularity': 'uint32',
1713             '*persistent': 'bool', '*autoload': 'bool' } }
1716 # @block-dirty-bitmap-add:
1718 # Create a dirty bitmap with a name on the node, and start tracking the writes.
1720 # Returns: nothing on success
1721 #          If @node is not a valid block device or node, DeviceNotFound
1722 #          If @name is already taken, GenericError with an explanation
1724 # Since: 2.4
1726 # Example:
1728 # -> { "execute": "block-dirty-bitmap-add",
1729 #      "arguments": { "node": "drive0", "name": "bitmap0" } }
1730 # <- { "return": {} }
1733 { 'command': 'block-dirty-bitmap-add',
1734   'data': 'BlockDirtyBitmapAdd' }
1737 # @block-dirty-bitmap-remove:
1739 # Stop write tracking and remove the dirty bitmap that was created
1740 # with block-dirty-bitmap-add. If the bitmap is persistent, remove it from its
1741 # storage too.
1743 # Returns: nothing on success
1744 #          If @node is not a valid block device or node, DeviceNotFound
1745 #          If @name is not found, GenericError with an explanation
1746 #          if @name is frozen by an operation, GenericError
1748 # Since: 2.4
1750 # Example:
1752 # -> { "execute": "block-dirty-bitmap-remove",
1753 #      "arguments": { "node": "drive0", "name": "bitmap0" } }
1754 # <- { "return": {} }
1757 { 'command': 'block-dirty-bitmap-remove',
1758   'data': 'BlockDirtyBitmap' }
1761 # @block-dirty-bitmap-clear:
1763 # Clear (reset) a dirty bitmap on the device, so that an incremental
1764 # backup from this point in time forward will only backup clusters
1765 # modified after this clear operation.
1767 # Returns: nothing on success
1768 #          If @node is not a valid block device, DeviceNotFound
1769 #          If @name is not found, GenericError with an explanation
1771 # Since: 2.4
1773 # Example:
1775 # -> { "execute": "block-dirty-bitmap-clear",
1776 #      "arguments": { "node": "drive0", "name": "bitmap0" } }
1777 # <- { "return": {} }
1780 { 'command': 'block-dirty-bitmap-clear',
1781   'data': 'BlockDirtyBitmap' }
1784 # @BlockDirtyBitmapSha256:
1786 # SHA256 hash of dirty bitmap data
1788 # @sha256: ASCII representation of SHA256 bitmap hash
1790 # Since: 2.10
1792   { 'struct': 'BlockDirtyBitmapSha256',
1793     'data': {'sha256': 'str'} }
1796 # @x-debug-block-dirty-bitmap-sha256:
1798 # Get bitmap SHA256
1800 # Returns: BlockDirtyBitmapSha256 on success
1801 #          If @node is not a valid block device, DeviceNotFound
1802 #          If @name is not found or if hashing has failed, GenericError with an
1803 #          explanation
1805 # Since: 2.10
1807   { 'command': 'x-debug-block-dirty-bitmap-sha256',
1808     'data': 'BlockDirtyBitmap', 'returns': 'BlockDirtyBitmapSha256' }
1811 # @blockdev-mirror:
1813 # Start mirroring a block device's writes to a new destination.
1815 # @job-id: identifier for the newly-created block job. If
1816 #          omitted, the device name will be used. (Since 2.7)
1818 # @device: The device name or node-name of a root node whose writes should be
1819 #          mirrored.
1821 # @target: the id or node-name of the block device to mirror to. This mustn't be
1822 #          attached to guest.
1824 # @replaces: with sync=full graph node name to be replaced by the new
1825 #            image when a whole image copy is done. This can be used to repair
1826 #            broken Quorum files.
1828 # @speed:  the maximum speed, in bytes per second
1830 # @sync: what parts of the disk image should be copied to the destination
1831 #        (all the disk, only the sectors allocated in the topmost image, or
1832 #        only new I/O).
1834 # @granularity: granularity of the dirty bitmap, default is 64K
1835 #               if the image format doesn't have clusters, 4K if the clusters
1836 #               are smaller than that, else the cluster size.  Must be a
1837 #               power of 2 between 512 and 64M
1839 # @buf-size: maximum amount of data in flight from source to
1840 #            target
1842 # @on-source-error: the action to take on an error on the source,
1843 #                   default 'report'.  'stop' and 'enospc' can only be used
1844 #                   if the block device supports io-status (see BlockInfo).
1846 # @on-target-error: the action to take on an error on the target,
1847 #                   default 'report' (no limitations, since this applies to
1848 #                   a different block device than @device).
1850 # @filter-node-name: the node name that should be assigned to the
1851 #                    filter driver that the mirror job inserts into the graph
1852 #                    above @device. If this option is not given, a node name is
1853 #                    autogenerated. (Since: 2.9)
1855 # Returns: nothing on success.
1857 # Since: 2.6
1859 # Example:
1861 # -> { "execute": "blockdev-mirror",
1862 #      "arguments": { "device": "ide-hd0",
1863 #                     "target": "target0",
1864 #                     "sync": "full" } }
1865 # <- { "return": {} }
1868 { 'command': 'blockdev-mirror',
1869   'data': { '*job-id': 'str', 'device': 'str', 'target': 'str',
1870             '*replaces': 'str',
1871             'sync': 'MirrorSyncMode',
1872             '*speed': 'int', '*granularity': 'uint32',
1873             '*buf-size': 'int', '*on-source-error': 'BlockdevOnError',
1874             '*on-target-error': 'BlockdevOnError',
1875             '*filter-node-name': 'str' } }
1878 # @block_set_io_throttle:
1880 # Change I/O throttle limits for a block drive.
1882 # Since QEMU 2.4, each device with I/O limits is member of a throttle
1883 # group.
1885 # If two or more devices are members of the same group, the limits
1886 # will apply to the combined I/O of the whole group in a round-robin
1887 # fashion. Therefore, setting new I/O limits to a device will affect
1888 # the whole group.
1890 # The name of the group can be specified using the 'group' parameter.
1891 # If the parameter is unset, it is assumed to be the current group of
1892 # that device. If it's not in any group yet, the name of the device
1893 # will be used as the name for its group.
1895 # The 'group' parameter can also be used to move a device to a
1896 # different group. In this case the limits specified in the parameters
1897 # will be applied to the new group only.
1899 # I/O limits can be disabled by setting all of them to 0. In this case
1900 # the device will be removed from its group and the rest of its
1901 # members will not be affected. The 'group' parameter is ignored.
1903 # Returns: Nothing on success
1904 #          If @device is not a valid block device, DeviceNotFound
1906 # Since: 1.1
1908 # Example:
1910 # -> { "execute": "block_set_io_throttle",
1911 #      "arguments": { "id": "virtio-blk-pci0/virtio-backend",
1912 #                     "bps": 0,
1913 #                     "bps_rd": 0,
1914 #                     "bps_wr": 0,
1915 #                     "iops": 512,
1916 #                     "iops_rd": 0,
1917 #                     "iops_wr": 0,
1918 #                     "bps_max": 0,
1919 #                     "bps_rd_max": 0,
1920 #                     "bps_wr_max": 0,
1921 #                     "iops_max": 0,
1922 #                     "iops_rd_max": 0,
1923 #                     "iops_wr_max": 0,
1924 #                     "bps_max_length": 0,
1925 #                     "iops_size": 0 } }
1926 # <- { "return": {} }
1928 # -> { "execute": "block_set_io_throttle",
1929 #      "arguments": { "id": "ide0-1-0",
1930 #                     "bps": 1000000,
1931 #                     "bps_rd": 0,
1932 #                     "bps_wr": 0,
1933 #                     "iops": 0,
1934 #                     "iops_rd": 0,
1935 #                     "iops_wr": 0,
1936 #                     "bps_max": 8000000,
1937 #                     "bps_rd_max": 0,
1938 #                     "bps_wr_max": 0,
1939 #                     "iops_max": 0,
1940 #                     "iops_rd_max": 0,
1941 #                     "iops_wr_max": 0,
1942 #                     "bps_max_length": 60,
1943 #                     "iops_size": 0 } }
1944 # <- { "return": {} }
1946 { 'command': 'block_set_io_throttle', 'boxed': true,
1947   'data': 'BlockIOThrottle' }
1950 # @BlockIOThrottle:
1952 # A set of parameters describing block throttling.
1954 # @device: Block device name (deprecated, use @id instead)
1956 # @id: The name or QOM path of the guest device (since: 2.8)
1958 # @bps: total throughput limit in bytes per second
1960 # @bps_rd: read throughput limit in bytes per second
1962 # @bps_wr: write throughput limit in bytes per second
1964 # @iops: total I/O operations per second
1966 # @iops_rd: read I/O operations per second
1968 # @iops_wr: write I/O operations per second
1970 # @bps_max: total throughput limit during bursts,
1971 #                     in bytes (Since 1.7)
1973 # @bps_rd_max: read throughput limit during bursts,
1974 #                        in bytes (Since 1.7)
1976 # @bps_wr_max: write throughput limit during bursts,
1977 #                        in bytes (Since 1.7)
1979 # @iops_max: total I/O operations per second during bursts,
1980 #                      in bytes (Since 1.7)
1982 # @iops_rd_max: read I/O operations per second during bursts,
1983 #                         in bytes (Since 1.7)
1985 # @iops_wr_max: write I/O operations per second during bursts,
1986 #                         in bytes (Since 1.7)
1988 # @bps_max_length: maximum length of the @bps_max burst
1989 #                            period, in seconds. It must only
1990 #                            be set if @bps_max is set as well.
1991 #                            Defaults to 1. (Since 2.6)
1993 # @bps_rd_max_length: maximum length of the @bps_rd_max
1994 #                               burst period, in seconds. It must only
1995 #                               be set if @bps_rd_max is set as well.
1996 #                               Defaults to 1. (Since 2.6)
1998 # @bps_wr_max_length: maximum length of the @bps_wr_max
1999 #                               burst period, in seconds. It must only
2000 #                               be set if @bps_wr_max is set as well.
2001 #                               Defaults to 1. (Since 2.6)
2003 # @iops_max_length: maximum length of the @iops burst
2004 #                             period, in seconds. It must only
2005 #                             be set if @iops_max is set as well.
2006 #                             Defaults to 1. (Since 2.6)
2008 # @iops_rd_max_length: maximum length of the @iops_rd_max
2009 #                                burst period, in seconds. It must only
2010 #                                be set if @iops_rd_max is set as well.
2011 #                                Defaults to 1. (Since 2.6)
2013 # @iops_wr_max_length: maximum length of the @iops_wr_max
2014 #                                burst period, in seconds. It must only
2015 #                                be set if @iops_wr_max is set as well.
2016 #                                Defaults to 1. (Since 2.6)
2018 # @iops_size: an I/O size in bytes (Since 1.7)
2020 # @group: throttle group name (Since 2.4)
2022 # Since: 1.1
2024 { 'struct': 'BlockIOThrottle',
2025   'data': { '*device': 'str', '*id': 'str', 'bps': 'int', 'bps_rd': 'int',
2026             'bps_wr': 'int', 'iops': 'int', 'iops_rd': 'int', 'iops_wr': 'int',
2027             '*bps_max': 'int', '*bps_rd_max': 'int',
2028             '*bps_wr_max': 'int', '*iops_max': 'int',
2029             '*iops_rd_max': 'int', '*iops_wr_max': 'int',
2030             '*bps_max_length': 'int', '*bps_rd_max_length': 'int',
2031             '*bps_wr_max_length': 'int', '*iops_max_length': 'int',
2032             '*iops_rd_max_length': 'int', '*iops_wr_max_length': 'int',
2033             '*iops_size': 'int', '*group': 'str' } }
2036 # @ThrottleLimits:
2038 # Limit parameters for throttling.
2039 # Since some limit combinations are illegal, limits should always be set in one
2040 # transaction. All fields are optional. When setting limits, if a field is
2041 # missing the current value is not changed.
2043 # @iops-total:             limit total I/O operations per second
2044 # @iops-total-max:         I/O operations burst
2045 # @iops-total-max-length:  length of the iops-total-max burst period, in seconds
2046 #                          It must only be set if @iops-total-max is set as well.
2047 # @iops-read:              limit read operations per second
2048 # @iops-read-max:          I/O operations read burst
2049 # @iops-read-max-length:   length of the iops-read-max burst period, in seconds
2050 #                          It must only be set if @iops-read-max is set as well.
2051 # @iops-write:             limit write operations per second
2052 # @iops-write-max:         I/O operations write burst
2053 # @iops-write-max-length:  length of the iops-write-max burst period, in seconds
2054 #                          It must only be set if @iops-write-max is set as well.
2055 # @bps-total:              limit total bytes per second
2056 # @bps-total-max:          total bytes burst
2057 # @bps-total-max-length:   length of the bps-total-max burst period, in seconds.
2058 #                          It must only be set if @bps-total-max is set as well.
2059 # @bps-read:               limit read bytes per second
2060 # @bps-read-max:           total bytes read burst
2061 # @bps-read-max-length:    length of the bps-read-max burst period, in seconds
2062 #                          It must only be set if @bps-read-max is set as well.
2063 # @bps-write:              limit write bytes per second
2064 # @bps-write-max:          total bytes write burst
2065 # @bps-write-max-length:   length of the bps-write-max burst period, in seconds
2066 #                          It must only be set if @bps-write-max is set as well.
2067 # @iops-size:              when limiting by iops max size of an I/O in bytes
2069 # Since: 2.11
2071 { 'struct': 'ThrottleLimits',
2072   'data': { '*iops-total' : 'int', '*iops-total-max' : 'int',
2073             '*iops-total-max-length' : 'int', '*iops-read' : 'int',
2074             '*iops-read-max' : 'int', '*iops-read-max-length' : 'int',
2075             '*iops-write' : 'int', '*iops-write-max' : 'int',
2076             '*iops-write-max-length' : 'int', '*bps-total' : 'int',
2077             '*bps-total-max' : 'int', '*bps-total-max-length' : 'int',
2078             '*bps-read' : 'int', '*bps-read-max' : 'int',
2079             '*bps-read-max-length' : 'int', '*bps-write' : 'int',
2080             '*bps-write-max' : 'int', '*bps-write-max-length' : 'int',
2081             '*iops-size' : 'int' } }
2084 # @block-stream:
2086 # Copy data from a backing file into a block device.
2088 # The block streaming operation is performed in the background until the entire
2089 # backing file has been copied.  This command returns immediately once streaming
2090 # has started.  The status of ongoing block streaming operations can be checked
2091 # with query-block-jobs.  The operation can be stopped before it has completed
2092 # using the block-job-cancel command.
2094 # The node that receives the data is called the top image, can be located in
2095 # any part of the chain (but always above the base image; see below) and can be
2096 # specified using its device or node name. Earlier qemu versions only allowed
2097 # 'device' to name the top level node; presence of the 'base-node' parameter
2098 # during introspection can be used as a witness of the enhanced semantics
2099 # of 'device'.
2101 # If a base file is specified then sectors are not copied from that base file and
2102 # its backing chain.  When streaming completes the image file will have the base
2103 # file as its backing file.  This can be used to stream a subset of the backing
2104 # file chain instead of flattening the entire image.
2106 # On successful completion the image file is updated to drop the backing file
2107 # and the BLOCK_JOB_COMPLETED event is emitted.
2109 # @job-id: identifier for the newly-created block job. If
2110 #          omitted, the device name will be used. (Since 2.7)
2112 # @device: the device or node name of the top image
2114 # @base:   the common backing file name.
2115 #                    It cannot be set if @base-node is also set.
2117 # @base-node: the node name of the backing file.
2118 #                       It cannot be set if @base is also set. (Since 2.8)
2120 # @backing-file: The backing file string to write into the top
2121 #                          image. This filename is not validated.
2123 #                          If a pathname string is such that it cannot be
2124 #                          resolved by QEMU, that means that subsequent QMP or
2125 #                          HMP commands must use node-names for the image in
2126 #                          question, as filename lookup methods will fail.
2128 #                          If not specified, QEMU will automatically determine
2129 #                          the backing file string to use, or error out if there
2130 #                          is no obvious choice.  Care should be taken when
2131 #                          specifying the string, to specify a valid filename or
2132 #                          protocol.
2133 #                          (Since 2.1)
2135 # @speed:  the maximum speed, in bytes per second
2137 # @on-error: the action to take on an error (default report).
2138 #            'stop' and 'enospc' can only be used if the block device
2139 #            supports io-status (see BlockInfo).  Since 1.3.
2141 # Returns: Nothing on success. If @device does not exist, DeviceNotFound.
2143 # Since: 1.1
2145 # Example:
2147 # -> { "execute": "block-stream",
2148 #      "arguments": { "device": "virtio0",
2149 #                     "base": "/tmp/master.qcow2" } }
2150 # <- { "return": {} }
2153 { 'command': 'block-stream',
2154   'data': { '*job-id': 'str', 'device': 'str', '*base': 'str',
2155             '*base-node': 'str', '*backing-file': 'str', '*speed': 'int',
2156             '*on-error': 'BlockdevOnError' } }
2159 # @block-job-set-speed:
2161 # Set maximum speed for a background block operation.
2163 # This command can only be issued when there is an active block job.
2165 # Throttling can be disabled by setting the speed to 0.
2167 # @device: The job identifier. This used to be a device name (hence
2168 #          the name of the parameter), but since QEMU 2.7 it can have
2169 #          other values.
2171 # @speed:  the maximum speed, in bytes per second, or 0 for unlimited.
2172 #          Defaults to 0.
2174 # Returns: Nothing on success
2175 #          If no background operation is active on this device, DeviceNotActive
2177 # Since: 1.1
2179 { 'command': 'block-job-set-speed',
2180   'data': { 'device': 'str', 'speed': 'int' } }
2183 # @block-job-cancel:
2185 # Stop an active background block operation.
2187 # This command returns immediately after marking the active background block
2188 # operation for cancellation.  It is an error to call this command if no
2189 # operation is in progress.
2191 # The operation will cancel as soon as possible and then emit the
2192 # BLOCK_JOB_CANCELLED event.  Before that happens the job is still visible when
2193 # enumerated using query-block-jobs.
2195 # Note that if you issue 'block-job-cancel' after 'drive-mirror' has indicated
2196 # (via the event BLOCK_JOB_READY) that the source and destination are
2197 # synchronized, then the event triggered by this command changes to
2198 # BLOCK_JOB_COMPLETED, to indicate that the mirroring has ended and the
2199 # destination now has a point-in-time copy tied to the time of the cancellation.
2201 # For streaming, the image file retains its backing file unless the streaming
2202 # operation happens to complete just as it is being cancelled.  A new streaming
2203 # operation can be started at a later time to finish copying all data from the
2204 # backing file.
2206 # @device: The job identifier. This used to be a device name (hence
2207 #          the name of the parameter), but since QEMU 2.7 it can have
2208 #          other values.
2210 # @force: If true, and the job has already emitted the event BLOCK_JOB_READY,
2211 #         abandon the job immediately (even if it is paused) instead of waiting
2212 #         for the destination to complete its final synchronization (since 1.3)
2214 # Returns: Nothing on success
2215 #          If no background operation is active on this device, DeviceNotActive
2217 # Since: 1.1
2219 { 'command': 'block-job-cancel', 'data': { 'device': 'str', '*force': 'bool' } }
2222 # @block-job-pause:
2224 # Pause an active background block operation.
2226 # This command returns immediately after marking the active background block
2227 # operation for pausing.  It is an error to call this command if no
2228 # operation is in progress.  Pausing an already paused job has no cumulative
2229 # effect; a single block-job-resume command will resume the job.
2231 # The operation will pause as soon as possible.  No event is emitted when
2232 # the operation is actually paused.  Cancelling a paused job automatically
2233 # resumes it.
2235 # @device: The job identifier. This used to be a device name (hence
2236 #          the name of the parameter), but since QEMU 2.7 it can have
2237 #          other values.
2239 # Returns: Nothing on success
2240 #          If no background operation is active on this device, DeviceNotActive
2242 # Since: 1.3
2244 { 'command': 'block-job-pause', 'data': { 'device': 'str' } }
2247 # @block-job-resume:
2249 # Resume an active background block operation.
2251 # This command returns immediately after resuming a paused background block
2252 # operation.  It is an error to call this command if no operation is in
2253 # progress.  Resuming an already running job is not an error.
2255 # This command also clears the error status of the job.
2257 # @device: The job identifier. This used to be a device name (hence
2258 #          the name of the parameter), but since QEMU 2.7 it can have
2259 #          other values.
2261 # Returns: Nothing on success
2262 #          If no background operation is active on this device, DeviceNotActive
2264 # Since: 1.3
2266 { 'command': 'block-job-resume', 'data': { 'device': 'str' } }
2269 # @block-job-complete:
2271 # Manually trigger completion of an active background block operation.  This
2272 # is supported for drive mirroring, where it also switches the device to
2273 # write to the target path only.  The ability to complete is signaled with
2274 # a BLOCK_JOB_READY event.
2276 # This command completes an active background block operation synchronously.
2277 # The ordering of this command's return with the BLOCK_JOB_COMPLETED event
2278 # is not defined.  Note that if an I/O error occurs during the processing of
2279 # this command: 1) the command itself will fail; 2) the error will be processed
2280 # according to the rerror/werror arguments that were specified when starting
2281 # the operation.
2283 # A cancelled or paused job cannot be completed.
2285 # @device: The job identifier. This used to be a device name (hence
2286 #          the name of the parameter), but since QEMU 2.7 it can have
2287 #          other values.
2289 # Returns: Nothing on success
2290 #          If no background operation is active on this device, DeviceNotActive
2292 # Since: 1.3
2294 { 'command': 'block-job-complete', 'data': { 'device': 'str' } }
2297 # @block-job-dismiss:
2299 # For jobs that have already concluded, remove them from the block-job-query
2300 # list. This command only needs to be run for jobs which were started with
2301 # QEMU 2.12+ job lifetime management semantics.
2303 # This command will refuse to operate on any job that has not yet reached
2304 # its terminal state, BLOCK_JOB_STATUS_CONCLUDED. For jobs that make use of
2305 # BLOCK_JOB_READY event, block-job-cancel or block-job-complete will still need
2306 # to be used as appropriate.
2308 # @id: The job identifier.
2310 # Returns: Nothing on success
2312 # Since: 2.12
2314 { 'command': 'block-job-dismiss', 'data': { 'id': 'str' } }
2317 # @block-job-finalize:
2319 # Once a job that has manual=true reaches the pending state, it can be
2320 # instructed to finalize any graph changes and do any necessary cleanup
2321 # via this command.
2322 # For jobs in a transaction, instructing one job to finalize will force
2323 # ALL jobs in the transaction to finalize, so it is only necessary to instruct
2324 # a single member job to finalize.
2326 # @id: The job identifier.
2328 # Returns: Nothing on success
2330 # Since: 2.12
2332 { 'command': 'block-job-finalize', 'data': { 'id': 'str' } }
2335 # @BlockdevDiscardOptions:
2337 # Determines how to handle discard requests.
2339 # @ignore:      Ignore the request
2340 # @unmap:       Forward as an unmap request
2342 # Since: 2.9
2344 { 'enum': 'BlockdevDiscardOptions',
2345   'data': [ 'ignore', 'unmap' ] }
2348 # @BlockdevDetectZeroesOptions:
2350 # Describes the operation mode for the automatic conversion of plain
2351 # zero writes by the OS to driver specific optimized zero write commands.
2353 # @off:      Disabled (default)
2354 # @on:       Enabled
2355 # @unmap:    Enabled and even try to unmap blocks if possible. This requires
2356 #            also that @BlockdevDiscardOptions is set to unmap for this device.
2358 # Since: 2.1
2360 { 'enum': 'BlockdevDetectZeroesOptions',
2361   'data': [ 'off', 'on', 'unmap' ] }
2364 # @BlockdevAioOptions:
2366 # Selects the AIO backend to handle I/O requests
2368 # @threads:     Use qemu's thread pool
2369 # @native:      Use native AIO backend (only Linux and Windows)
2371 # Since: 2.9
2373 { 'enum': 'BlockdevAioOptions',
2374   'data': [ 'threads', 'native' ] }
2377 # @BlockdevCacheOptions:
2379 # Includes cache-related options for block devices
2381 # @direct:      enables use of O_DIRECT (bypass the host page cache;
2382 #               default: false)
2383 # @no-flush:    ignore any flush requests for the device (default:
2384 #               false)
2386 # Since: 2.9
2388 { 'struct': 'BlockdevCacheOptions',
2389   'data': { '*direct': 'bool',
2390             '*no-flush': 'bool' } }
2393 # @BlockdevDriver:
2395 # Drivers that are supported in block device operations.
2397 # @vxhs: Since 2.10
2398 # @throttle: Since 2.11
2399 # @nvme: Since 2.12
2401 # Since: 2.9
2403 { 'enum': 'BlockdevDriver',
2404   'data': [ 'blkdebug', 'blkverify', 'bochs', 'cloop',
2405             'dmg', 'file', 'ftp', 'ftps', 'gluster', 'host_cdrom',
2406             'host_device', 'http', 'https', 'iscsi', 'luks', 'nbd', 'nfs',
2407             'null-aio', 'null-co', 'nvme', 'parallels', 'qcow', 'qcow2', 'qed',
2408             'quorum', 'raw', 'rbd', 'replication', 'sheepdog', 'ssh',
2409             'throttle', 'vdi', 'vhdx', 'vmdk', 'vpc', 'vvfat', 'vxhs' ] }
2412 # @BlockdevOptionsFile:
2414 # Driver specific block device options for the file backend.
2416 # @filename:    path to the image file
2417 # @pr-manager:  the id for the object that will handle persistent reservations
2418 #               for this device (default: none, forward the commands via SG_IO;
2419 #               since 2.11)
2420 # @aio:         AIO backend (default: threads) (since: 2.8)
2421 # @locking:     whether to enable file locking. If set to 'auto', only enable
2422 #               when Open File Descriptor (OFD) locking API is available
2423 #               (default: auto, since 2.10)
2425 # Since: 2.9
2427 { 'struct': 'BlockdevOptionsFile',
2428   'data': { 'filename': 'str',
2429             '*pr-manager': 'str',
2430             '*locking': 'OnOffAuto',
2431             '*aio': 'BlockdevAioOptions' } }
2434 # @BlockdevOptionsNull:
2436 # Driver specific block device options for the null backend.
2438 # @size:    size of the device in bytes.
2439 # @latency-ns: emulated latency (in nanoseconds) in processing
2440 #              requests. Default to zero which completes requests immediately.
2441 #              (Since 2.4)
2443 # Since: 2.9
2445 { 'struct': 'BlockdevOptionsNull',
2446   'data': { '*size': 'int', '*latency-ns': 'uint64' } }
2449 # @BlockdevOptionsNVMe:
2451 # Driver specific block device options for the NVMe backend.
2453 # @device:    controller address of the NVMe device.
2454 # @namespace: namespace number of the device, starting from 1.
2456 # Since: 2.12
2458 { 'struct': 'BlockdevOptionsNVMe',
2459   'data': { 'device': 'str', 'namespace': 'int' } }
2462 # @BlockdevOptionsVVFAT:
2464 # Driver specific block device options for the vvfat protocol.
2466 # @dir:         directory to be exported as FAT image
2467 # @fat-type:    FAT type: 12, 16 or 32
2468 # @floppy:      whether to export a floppy image (true) or
2469 #               partitioned hard disk (false; default)
2470 # @label:       set the volume label, limited to 11 bytes. FAT16 and
2471 #               FAT32 traditionally have some restrictions on labels, which are
2472 #               ignored by most operating systems. Defaults to "QEMU VVFAT".
2473 #               (since 2.4)
2474 # @rw:          whether to allow write operations (default: false)
2476 # Since: 2.9
2478 { 'struct': 'BlockdevOptionsVVFAT',
2479   'data': { 'dir': 'str', '*fat-type': 'int', '*floppy': 'bool',
2480             '*label': 'str', '*rw': 'bool' } }
2483 # @BlockdevOptionsGenericFormat:
2485 # Driver specific block device options for image format that have no option
2486 # besides their data source.
2488 # @file:        reference to or definition of the data source block device
2490 # Since: 2.9
2492 { 'struct': 'BlockdevOptionsGenericFormat',
2493   'data': { 'file': 'BlockdevRef' } }
2496 # @BlockdevOptionsLUKS:
2498 # Driver specific block device options for LUKS.
2500 # @key-secret: the ID of a QCryptoSecret object providing
2501 #              the decryption key (since 2.6). Mandatory except when
2502 #              doing a metadata-only probe of the image.
2504 # Since: 2.9
2506 { 'struct': 'BlockdevOptionsLUKS',
2507   'base': 'BlockdevOptionsGenericFormat',
2508   'data': { '*key-secret': 'str' } }
2512 # @BlockdevOptionsGenericCOWFormat:
2514 # Driver specific block device options for image format that have no option
2515 # besides their data source and an optional backing file.
2517 # @backing:     reference to or definition of the backing file block
2518 #               device, null disables the backing file entirely.
2519 #               Defaults to the backing file stored the image file.
2521 # Since: 2.9
2523 { 'struct': 'BlockdevOptionsGenericCOWFormat',
2524   'base': 'BlockdevOptionsGenericFormat',
2525   'data': { '*backing': 'BlockdevRefOrNull' } }
2528 # @Qcow2OverlapCheckMode:
2530 # General overlap check modes.
2532 # @none:        Do not perform any checks
2534 # @constant:    Perform only checks which can be done in constant time and
2535 #               without reading anything from disk
2537 # @cached:      Perform only checks which can be done without reading anything
2538 #               from disk
2540 # @all:         Perform all available overlap checks
2542 # Since: 2.9
2544 { 'enum': 'Qcow2OverlapCheckMode',
2545   'data': [ 'none', 'constant', 'cached', 'all' ] }
2548 # @Qcow2OverlapCheckFlags:
2550 # Structure of flags for each metadata structure. Setting a field to 'true'
2551 # makes qemu guard that structure against unintended overwriting. The default
2552 # value is chosen according to the template given.
2554 # @template: Specifies a template mode which can be adjusted using the other
2555 #            flags, defaults to 'cached'
2557 # Since: 2.9
2559 { 'struct': 'Qcow2OverlapCheckFlags',
2560   'data': { '*template':       'Qcow2OverlapCheckMode',
2561             '*main-header':    'bool',
2562             '*active-l1':      'bool',
2563             '*active-l2':      'bool',
2564             '*refcount-table': 'bool',
2565             '*refcount-block': 'bool',
2566             '*snapshot-table': 'bool',
2567             '*inactive-l1':    'bool',
2568             '*inactive-l2':    'bool' } }
2571 # @Qcow2OverlapChecks:
2573 # Specifies which metadata structures should be guarded against unintended
2574 # overwriting.
2576 # @flags:   set of flags for separate specification of each metadata structure
2577 #           type
2579 # @mode:    named mode which chooses a specific set of flags
2581 # Since: 2.9
2583 { 'alternate': 'Qcow2OverlapChecks',
2584   'data': { 'flags': 'Qcow2OverlapCheckFlags',
2585             'mode':  'Qcow2OverlapCheckMode' } }
2588 # @BlockdevQcowEncryptionFormat:
2590 # @aes: AES-CBC with plain64 initialization vectors
2592 # Since: 2.10
2594 { 'enum': 'BlockdevQcowEncryptionFormat',
2595   'data': [ 'aes' ] }
2598 # @BlockdevQcowEncryption:
2600 # Since: 2.10
2602 { 'union': 'BlockdevQcowEncryption',
2603   'base': { 'format': 'BlockdevQcowEncryptionFormat' },
2604   'discriminator': 'format',
2605   'data': { 'aes': 'QCryptoBlockOptionsQCow' } }
2608 # @BlockdevOptionsQcow:
2610 # Driver specific block device options for qcow.
2612 # @encrypt:               Image decryption options. Mandatory for
2613 #                         encrypted images, except when doing a metadata-only
2614 #                         probe of the image.
2616 # Since: 2.10
2618 { 'struct': 'BlockdevOptionsQcow',
2619   'base': 'BlockdevOptionsGenericCOWFormat',
2620   'data': { '*encrypt': 'BlockdevQcowEncryption' } }
2625 # @BlockdevQcow2EncryptionFormat:
2626 # @aes: AES-CBC with plain64 initialization venctors
2628 # Since: 2.10
2630 { 'enum': 'BlockdevQcow2EncryptionFormat',
2631   'data': [ 'aes', 'luks' ] }
2634 # @BlockdevQcow2Encryption:
2636 # Since: 2.10
2638 { 'union': 'BlockdevQcow2Encryption',
2639   'base': { 'format': 'BlockdevQcow2EncryptionFormat' },
2640   'discriminator': 'format',
2641   'data': { 'aes': 'QCryptoBlockOptionsQCow',
2642             'luks': 'QCryptoBlockOptionsLUKS'} }
2645 # @BlockdevOptionsQcow2:
2647 # Driver specific block device options for qcow2.
2649 # @lazy-refcounts:        whether to enable the lazy refcounts
2650 #                         feature (default is taken from the image file)
2652 # @pass-discard-request:  whether discard requests to the qcow2
2653 #                         device should be forwarded to the data source
2655 # @pass-discard-snapshot: whether discard requests for the data source
2656 #                         should be issued when a snapshot operation (e.g.
2657 #                         deleting a snapshot) frees clusters in the qcow2 file
2659 # @pass-discard-other:    whether discard requests for the data source
2660 #                         should be issued on other occasions where a cluster
2661 #                         gets freed
2663 # @overlap-check:         which overlap checks to perform for writes
2664 #                         to the image, defaults to 'cached' (since 2.2)
2666 # @cache-size:            the maximum total size of the L2 table and
2667 #                         refcount block caches in bytes (since 2.2)
2669 # @l2-cache-size:         the maximum size of the L2 table cache in
2670 #                         bytes (since 2.2)
2672 # @l2-cache-entry-size:   the size of each entry in the L2 cache in
2673 #                         bytes. It must be a power of two between 512
2674 #                         and the cluster size. The default value is
2675 #                         the cluster size (since 2.12)
2677 # @refcount-cache-size:   the maximum size of the refcount block cache
2678 #                         in bytes (since 2.2)
2680 # @cache-clean-interval:  clean unused entries in the L2 and refcount
2681 #                         caches. The interval is in seconds. The default value
2682 #                         is 0 and it disables this feature (since 2.5)
2683 # @encrypt:               Image decryption options. Mandatory for
2684 #                         encrypted images, except when doing a metadata-only
2685 #                         probe of the image. (since 2.10)
2687 # Since: 2.9
2689 { 'struct': 'BlockdevOptionsQcow2',
2690   'base': 'BlockdevOptionsGenericCOWFormat',
2691   'data': { '*lazy-refcounts': 'bool',
2692             '*pass-discard-request': 'bool',
2693             '*pass-discard-snapshot': 'bool',
2694             '*pass-discard-other': 'bool',
2695             '*overlap-check': 'Qcow2OverlapChecks',
2696             '*cache-size': 'int',
2697             '*l2-cache-size': 'int',
2698             '*l2-cache-entry-size': 'int',
2699             '*refcount-cache-size': 'int',
2700             '*cache-clean-interval': 'int',
2701             '*encrypt': 'BlockdevQcow2Encryption' } }
2704 # @SshHostKeyCheckMode:
2706 # @none             Don't check the host key at all
2707 # @hash             Compare the host key with a given hash
2708 # @known_hosts      Check the host key against the known_hosts file
2710 # Since: 2.12
2712 { 'enum': 'SshHostKeyCheckMode',
2713   'data': [ 'none', 'hash', 'known_hosts' ] }
2716 # @SshHostKeyCheckHashType:
2718 # @md5              The given hash is an md5 hash
2719 # @sha1             The given hash is an sha1 hash
2721 # Since: 2.12
2723 { 'enum': 'SshHostKeyCheckHashType',
2724   'data': [ 'md5', 'sha1' ] }
2727 # @SshHostKeyHash:
2729 # @type             The hash algorithm used for the hash
2730 # @hash             The expected hash value
2732 # Since: 2.12
2734 { 'struct': 'SshHostKeyHash',
2735   'data': { 'type': 'SshHostKeyCheckHashType',
2736             'hash': 'str' }}
2739 # @SshHostKeyDummy:
2741 # For those union branches that don't need additional fields.
2743 # Since: 2.12
2745 { 'struct': 'SshHostKeyDummy',
2746   'data': {} }
2749 # @SshHostKeyCheck:
2751 # Since: 2.12
2753 { 'union': 'SshHostKeyCheck',
2754   'base': { 'mode': 'SshHostKeyCheckMode' },
2755   'discriminator': 'mode',
2756   'data': { 'none': 'SshHostKeyDummy',
2757             'hash': 'SshHostKeyHash',
2758             'known_hosts': 'SshHostKeyDummy' } }
2761 # @BlockdevOptionsSsh:
2763 # @server:              host address
2765 # @path:                path to the image on the host
2767 # @user:                user as which to connect, defaults to current
2768 #                       local user name
2770 # @host-key-check:      Defines how and what to check the host key against
2771 #                       (default: known_hosts)
2773 # Since: 2.9
2775 { 'struct': 'BlockdevOptionsSsh',
2776   'data': { 'server': 'InetSocketAddress',
2777             'path': 'str',
2778             '*user': 'str',
2779             '*host-key-check': 'SshHostKeyCheck' } }
2783 # @BlkdebugEvent:
2785 # Trigger events supported by blkdebug.
2787 # @l1_shrink_write_table:      write zeros to the l1 table to shrink image.
2788 #                              (since 2.11)
2790 # @l1_shrink_free_l2_clusters: discard the l2 tables. (since 2.11)
2792 # @cor_write: a write due to copy-on-read (since 2.11)
2794 # Since: 2.9
2796 { 'enum': 'BlkdebugEvent', 'prefix': 'BLKDBG',
2797   'data': [ 'l1_update', 'l1_grow_alloc_table', 'l1_grow_write_table',
2798             'l1_grow_activate_table', 'l2_load', 'l2_update',
2799             'l2_update_compressed', 'l2_alloc_cow_read', 'l2_alloc_write',
2800             'read_aio', 'read_backing_aio', 'read_compressed', 'write_aio',
2801             'write_compressed', 'vmstate_load', 'vmstate_save', 'cow_read',
2802             'cow_write', 'reftable_load', 'reftable_grow', 'reftable_update',
2803             'refblock_load', 'refblock_update', 'refblock_update_part',
2804             'refblock_alloc', 'refblock_alloc_hookup', 'refblock_alloc_write',
2805             'refblock_alloc_write_blocks', 'refblock_alloc_write_table',
2806             'refblock_alloc_switch_table', 'cluster_alloc',
2807             'cluster_alloc_bytes', 'cluster_free', 'flush_to_os',
2808             'flush_to_disk', 'pwritev_rmw_head', 'pwritev_rmw_after_head',
2809             'pwritev_rmw_tail', 'pwritev_rmw_after_tail', 'pwritev',
2810             'pwritev_zero', 'pwritev_done', 'empty_image_prepare',
2811             'l1_shrink_write_table', 'l1_shrink_free_l2_clusters',
2812             'cor_write'] }
2815 # @BlkdebugInjectErrorOptions:
2817 # Describes a single error injection for blkdebug.
2819 # @event:       trigger event
2821 # @state:       the state identifier blkdebug needs to be in to
2822 #               actually trigger the event; defaults to "any"
2824 # @errno:       error identifier (errno) to be returned; defaults to
2825 #               EIO
2827 # @sector:      specifies the sector index which has to be affected
2828 #               in order to actually trigger the event; defaults to "any
2829 #               sector"
2831 # @once:        disables further events after this one has been
2832 #               triggered; defaults to false
2834 # @immediately: fail immediately; defaults to false
2836 # Since: 2.9
2838 { 'struct': 'BlkdebugInjectErrorOptions',
2839   'data': { 'event': 'BlkdebugEvent',
2840             '*state': 'int',
2841             '*errno': 'int',
2842             '*sector': 'int',
2843             '*once': 'bool',
2844             '*immediately': 'bool' } }
2847 # @BlkdebugSetStateOptions:
2849 # Describes a single state-change event for blkdebug.
2851 # @event:       trigger event
2853 # @state:       the current state identifier blkdebug needs to be in;
2854 #               defaults to "any"
2856 # @new_state:   the state identifier blkdebug is supposed to assume if
2857 #               this event is triggered
2859 # Since: 2.9
2861 { 'struct': 'BlkdebugSetStateOptions',
2862   'data': { 'event': 'BlkdebugEvent',
2863             '*state': 'int',
2864             'new_state': 'int' } }
2867 # @BlockdevOptionsBlkdebug:
2869 # Driver specific block device options for blkdebug.
2871 # @image:           underlying raw block device (or image file)
2873 # @config:          filename of the configuration file
2875 # @align:           required alignment for requests in bytes, must be
2876 #                   positive power of 2, or 0 for default
2878 # @max-transfer:    maximum size for I/O transfers in bytes, must be
2879 #                   positive multiple of @align and of the underlying
2880 #                   file's request alignment (but need not be a power of
2881 #                   2), or 0 for default (since 2.10)
2883 # @opt-write-zero:  preferred alignment for write zero requests in bytes,
2884 #                   must be positive multiple of @align and of the
2885 #                   underlying file's request alignment (but need not be a
2886 #                   power of 2), or 0 for default (since 2.10)
2888 # @max-write-zero:  maximum size for write zero requests in bytes, must be
2889 #                   positive multiple of @align, of @opt-write-zero, and of
2890 #                   the underlying file's request alignment (but need not
2891 #                   be a power of 2), or 0 for default (since 2.10)
2893 # @opt-discard:     preferred alignment for discard requests in bytes, must
2894 #                   be positive multiple of @align and of the underlying
2895 #                   file's request alignment (but need not be a power of
2896 #                   2), or 0 for default (since 2.10)
2898 # @max-discard:     maximum size for discard requests in bytes, must be
2899 #                   positive multiple of @align, of @opt-discard, and of
2900 #                   the underlying file's request alignment (but need not
2901 #                   be a power of 2), or 0 for default (since 2.10)
2903 # @inject-error:    array of error injection descriptions
2905 # @set-state:       array of state-change descriptions
2907 # Since: 2.9
2909 { 'struct': 'BlockdevOptionsBlkdebug',
2910   'data': { 'image': 'BlockdevRef',
2911             '*config': 'str',
2912             '*align': 'int', '*max-transfer': 'int32',
2913             '*opt-write-zero': 'int32', '*max-write-zero': 'int32',
2914             '*opt-discard': 'int32', '*max-discard': 'int32',
2915             '*inject-error': ['BlkdebugInjectErrorOptions'],
2916             '*set-state': ['BlkdebugSetStateOptions'] } }
2919 # @BlockdevOptionsBlkverify:
2921 # Driver specific block device options for blkverify.
2923 # @test:    block device to be tested
2925 # @raw:     raw image used for verification
2927 # Since: 2.9
2929 { 'struct': 'BlockdevOptionsBlkverify',
2930   'data': { 'test': 'BlockdevRef',
2931             'raw': 'BlockdevRef' } }
2934 # @QuorumReadPattern:
2936 # An enumeration of quorum read patterns.
2938 # @quorum: read all the children and do a quorum vote on reads
2940 # @fifo: read only from the first child that has not failed
2942 # Since: 2.9
2944 { 'enum': 'QuorumReadPattern', 'data': [ 'quorum', 'fifo' ] }
2947 # @BlockdevOptionsQuorum:
2949 # Driver specific block device options for Quorum
2951 # @blkverify:      true if the driver must print content mismatch
2952 #                  set to false by default
2954 # @children:       the children block devices to use
2956 # @vote-threshold: the vote limit under which a read will fail
2958 # @rewrite-corrupted: rewrite corrupted data when quorum is reached
2959 #                     (Since 2.1)
2961 # @read-pattern: choose read pattern and set to quorum by default
2962 #                (Since 2.2)
2964 # Since: 2.9
2966 { 'struct': 'BlockdevOptionsQuorum',
2967   'data': { '*blkverify': 'bool',
2968             'children': [ 'BlockdevRef' ],
2969             'vote-threshold': 'int',
2970             '*rewrite-corrupted': 'bool',
2971             '*read-pattern': 'QuorumReadPattern' } }
2974 # @BlockdevOptionsGluster:
2976 # Driver specific block device options for Gluster
2978 # @volume:      name of gluster volume where VM image resides
2980 # @path:        absolute path to image file in gluster volume
2982 # @server:      gluster servers description
2984 # @debug:       libgfapi log level (default '4' which is Error)
2985 #               (Since 2.8)
2987 # @logfile:     libgfapi log file (default /dev/stderr) (Since 2.8)
2989 # Since: 2.9
2991 { 'struct': 'BlockdevOptionsGluster',
2992   'data': { 'volume': 'str',
2993             'path': 'str',
2994             'server': ['SocketAddress'],
2995             '*debug': 'int',
2996             '*logfile': 'str' } }
2999 # @IscsiTransport:
3001 # An enumeration of libiscsi transport types
3003 # Since: 2.9
3005 { 'enum': 'IscsiTransport',
3006   'data': [ 'tcp', 'iser' ] }
3009 # @IscsiHeaderDigest:
3011 # An enumeration of header digests supported by libiscsi
3013 # Since: 2.9
3015 { 'enum': 'IscsiHeaderDigest',
3016   'prefix': 'QAPI_ISCSI_HEADER_DIGEST',
3017   'data': [ 'crc32c', 'none', 'crc32c-none', 'none-crc32c' ] }
3020 # @BlockdevOptionsIscsi:
3022 # @transport:       The iscsi transport type
3024 # @portal:          The address of the iscsi portal
3026 # @target:          The target iqn name
3028 # @lun:             LUN to connect to. Defaults to 0.
3030 # @user:            User name to log in with. If omitted, no CHAP
3031 #                   authentication is performed.
3033 # @password-secret: The ID of a QCryptoSecret object providing
3034 #                   the password for the login. This option is required if
3035 #                   @user is specified.
3037 # @initiator-name:  The iqn name we want to identify to the target
3038 #                   as. If this option is not specified, an initiator name is
3039 #                   generated automatically.
3041 # @header-digest:   The desired header digest. Defaults to
3042 #                   none-crc32c.
3044 # @timeout:         Timeout in seconds after which a request will
3045 #                   timeout. 0 means no timeout and is the default.
3047 # Driver specific block device options for iscsi
3049 # Since: 2.9
3051 { 'struct': 'BlockdevOptionsIscsi',
3052   'data': { 'transport': 'IscsiTransport',
3053             'portal': 'str',
3054             'target': 'str',
3055             '*lun': 'int',
3056             '*user': 'str',
3057             '*password-secret': 'str',
3058             '*initiator-name': 'str',
3059             '*header-digest': 'IscsiHeaderDigest',
3060             '*timeout': 'int' } }
3064 # @BlockdevOptionsRbd:
3066 # @pool:               Ceph pool name.
3068 # @image:              Image name in the Ceph pool.
3070 # @conf:               path to Ceph configuration file.  Values
3071 #                      in the configuration file will be overridden by
3072 #                      options specified via QAPI.
3074 # @snapshot:           Ceph snapshot name.
3076 # @user:               Ceph id name.
3078 # @server:             Monitor host address and port.  This maps
3079 #                      to the "mon_host" Ceph option.
3081 # Since: 2.9
3083 { 'struct': 'BlockdevOptionsRbd',
3084   'data': { 'pool': 'str',
3085             'image': 'str',
3086             '*conf': 'str',
3087             '*snapshot': 'str',
3088             '*user': 'str',
3089             '*server': ['InetSocketAddressBase'] } }
3092 # @BlockdevOptionsSheepdog:
3094 # Driver specific block device options for sheepdog
3096 # @vdi:         Virtual disk image name
3097 # @server:      The Sheepdog server to connect to
3098 # @snap-id:     Snapshot ID
3099 # @tag:         Snapshot tag name
3101 # Only one of @snap-id and @tag may be present.
3103 # Since: 2.9
3105 { 'struct': 'BlockdevOptionsSheepdog',
3106   'data': { 'server': 'SocketAddress',
3107             'vdi': 'str',
3108             '*snap-id': 'uint32',
3109             '*tag': 'str' } }
3112 # @ReplicationMode:
3114 # An enumeration of replication modes.
3116 # @primary: Primary mode, the vm's state will be sent to secondary QEMU.
3118 # @secondary: Secondary mode, receive the vm's state from primary QEMU.
3120 # Since: 2.9
3122 { 'enum' : 'ReplicationMode', 'data' : [ 'primary', 'secondary' ] }
3125 # @BlockdevOptionsReplication:
3127 # Driver specific block device options for replication
3129 # @mode: the replication mode
3131 # @top-id: In secondary mode, node name or device ID of the root
3132 #          node who owns the replication node chain. Must not be given in
3133 #          primary mode.
3135 # Since: 2.9
3137 { 'struct': 'BlockdevOptionsReplication',
3138   'base': 'BlockdevOptionsGenericFormat',
3139   'data': { 'mode': 'ReplicationMode',
3140             '*top-id': 'str' } }
3143 # @NFSTransport:
3145 # An enumeration of NFS transport types
3147 # @inet:        TCP transport
3149 # Since: 2.9
3151 { 'enum': 'NFSTransport',
3152   'data': [ 'inet' ] }
3155 # @NFSServer:
3157 # Captures the address of the socket
3159 # @type:        transport type used for NFS (only TCP supported)
3161 # @host:        host address for NFS server
3163 # Since: 2.9
3165 { 'struct': 'NFSServer',
3166   'data': { 'type': 'NFSTransport',
3167             'host': 'str' } }
3170 # @BlockdevOptionsNfs:
3172 # Driver specific block device option for NFS
3174 # @server:                  host address
3176 # @path:                    path of the image on the host
3178 # @user:                    UID value to use when talking to the
3179 #                           server (defaults to 65534 on Windows and getuid()
3180 #                           on unix)
3182 # @group:                   GID value to use when talking to the
3183 #                           server (defaults to 65534 on Windows and getgid()
3184 #                           in unix)
3186 # @tcp-syn-count:           number of SYNs during the session
3187 #                           establishment (defaults to libnfs default)
3189 # @readahead-size:          set the readahead size in bytes (defaults
3190 #                           to libnfs default)
3192 # @page-cache-size:         set the pagecache size in bytes (defaults
3193 #                           to libnfs default)
3195 # @debug:                   set the NFS debug level (max 2) (defaults
3196 #                           to libnfs default)
3198 # Since: 2.9
3200 { 'struct': 'BlockdevOptionsNfs',
3201   'data': { 'server': 'NFSServer',
3202             'path': 'str',
3203             '*user': 'int',
3204             '*group': 'int',
3205             '*tcp-syn-count': 'int',
3206             '*readahead-size': 'int',
3207             '*page-cache-size': 'int',
3208             '*debug': 'int' } }
3211 # @BlockdevOptionsCurlBase:
3213 # Driver specific block device options shared by all protocols supported by the
3214 # curl backend.
3216 # @url:                     URL of the image file
3218 # @readahead:               Size of the read-ahead cache; must be a multiple of
3219 #                           512 (defaults to 256 kB)
3221 # @timeout:                 Timeout for connections, in seconds (defaults to 5)
3223 # @username:                Username for authentication (defaults to none)
3225 # @password-secret:         ID of a QCryptoSecret object providing a password
3226 #                           for authentication (defaults to no password)
3228 # @proxy-username:          Username for proxy authentication (defaults to none)
3230 # @proxy-password-secret:   ID of a QCryptoSecret object providing a password
3231 #                           for proxy authentication (defaults to no password)
3233 # Since: 2.9
3235 { 'struct': 'BlockdevOptionsCurlBase',
3236   'data': { 'url': 'str',
3237             '*readahead': 'int',
3238             '*timeout': 'int',
3239             '*username': 'str',
3240             '*password-secret': 'str',
3241             '*proxy-username': 'str',
3242             '*proxy-password-secret': 'str' } }
3245 # @BlockdevOptionsCurlHttp:
3247 # Driver specific block device options for HTTP connections over the curl
3248 # backend.  URLs must start with "http://".
3250 # @cookie:      List of cookies to set; format is
3251 #               "name1=content1; name2=content2;" as explained by
3252 #               CURLOPT_COOKIE(3). Defaults to no cookies.
3254 # @cookie-secret: ID of a QCryptoSecret object providing the cookie data in a
3255 #                 secure way. See @cookie for the format. (since 2.10)
3257 # Since: 2.9
3259 { 'struct': 'BlockdevOptionsCurlHttp',
3260   'base': 'BlockdevOptionsCurlBase',
3261   'data': { '*cookie': 'str',
3262             '*cookie-secret': 'str'} }
3265 # @BlockdevOptionsCurlHttps:
3267 # Driver specific block device options for HTTPS connections over the curl
3268 # backend.  URLs must start with "https://".
3270 # @cookie:      List of cookies to set; format is
3271 #               "name1=content1; name2=content2;" as explained by
3272 #               CURLOPT_COOKIE(3). Defaults to no cookies.
3274 # @sslverify:   Whether to verify the SSL certificate's validity (defaults to
3275 #               true)
3277 # @cookie-secret: ID of a QCryptoSecret object providing the cookie data in a
3278 #                 secure way. See @cookie for the format. (since 2.10)
3280 # Since: 2.9
3282 { 'struct': 'BlockdevOptionsCurlHttps',
3283   'base': 'BlockdevOptionsCurlBase',
3284   'data': { '*cookie': 'str',
3285             '*sslverify': 'bool',
3286             '*cookie-secret': 'str'} }
3289 # @BlockdevOptionsCurlFtp:
3291 # Driver specific block device options for FTP connections over the curl
3292 # backend.  URLs must start with "ftp://".
3294 # Since: 2.9
3296 { 'struct': 'BlockdevOptionsCurlFtp',
3297   'base': 'BlockdevOptionsCurlBase',
3298   'data': { } }
3301 # @BlockdevOptionsCurlFtps:
3303 # Driver specific block device options for FTPS connections over the curl
3304 # backend.  URLs must start with "ftps://".
3306 # @sslverify:   Whether to verify the SSL certificate's validity (defaults to
3307 #               true)
3309 # Since: 2.9
3311 { 'struct': 'BlockdevOptionsCurlFtps',
3312   'base': 'BlockdevOptionsCurlBase',
3313   'data': { '*sslverify': 'bool' } }
3316 # @BlockdevOptionsNbd:
3318 # Driver specific block device options for NBD.
3320 # @server:      NBD server address
3322 # @export:      export name
3324 # @tls-creds:   TLS credentials ID
3326 # Since: 2.9
3328 { 'struct': 'BlockdevOptionsNbd',
3329   'data': { 'server': 'SocketAddress',
3330             '*export': 'str',
3331             '*tls-creds': 'str' } }
3334 # @BlockdevOptionsRaw:
3336 # Driver specific block device options for the raw driver.
3338 # @offset:      position where the block device starts
3339 # @size:        the assumed size of the device
3341 # Since: 2.9
3343 { 'struct': 'BlockdevOptionsRaw',
3344   'base': 'BlockdevOptionsGenericFormat',
3345   'data': { '*offset': 'int', '*size': 'int' } }
3348 # @BlockdevOptionsVxHS:
3350 # Driver specific block device options for VxHS
3352 # @vdisk-id:    UUID of VxHS volume
3353 # @server:      vxhs server IP, port
3354 # @tls-creds:   TLS credentials ID
3356 # Since: 2.10
3358 { 'struct': 'BlockdevOptionsVxHS',
3359   'data': { 'vdisk-id': 'str',
3360             'server': 'InetSocketAddressBase',
3361             '*tls-creds': 'str' } }
3364 # @BlockdevOptionsThrottle:
3366 # Driver specific block device options for the throttle driver
3368 # @throttle-group:   the name of the throttle-group object to use. It
3369 #                    must already exist.
3370 # @file:             reference to or definition of the data source block device
3371 # Since: 2.11
3373 { 'struct': 'BlockdevOptionsThrottle',
3374   'data': { 'throttle-group': 'str',
3375             'file' : 'BlockdevRef'
3376              } }
3378 # @BlockdevOptions:
3380 # Options for creating a block device.  Many options are available for all
3381 # block devices, independent of the block driver:
3383 # @driver:        block driver name
3384 # @node-name:     the node name of the new node (Since 2.0).
3385 #                 This option is required on the top level of blockdev-add.
3386 # @discard:       discard-related options (default: ignore)
3387 # @cache:         cache-related options
3388 # @read-only:     whether the block device should be read-only (default: false).
3389 #                 Note that some block drivers support only read-only access,
3390 #                 either generally or in certain configurations. In this case,
3391 #                 the default value does not work and the option must be
3392 #                 specified explicitly.
3393 # @detect-zeroes: detect and optimize zero writes (Since 2.1)
3394 #                 (default: off)
3395 # @force-share:   force share all permission on added nodes.
3396 #                 Requires read-only=true. (Since 2.10)
3398 # Remaining options are determined by the block driver.
3400 # Since: 2.9
3402 { 'union': 'BlockdevOptions',
3403   'base': { 'driver': 'BlockdevDriver',
3404             '*node-name': 'str',
3405             '*discard': 'BlockdevDiscardOptions',
3406             '*cache': 'BlockdevCacheOptions',
3407             '*read-only': 'bool',
3408             '*force-share': 'bool',
3409             '*detect-zeroes': 'BlockdevDetectZeroesOptions' },
3410   'discriminator': 'driver',
3411   'data': {
3412       'blkdebug':   'BlockdevOptionsBlkdebug',
3413       'blkverify':  'BlockdevOptionsBlkverify',
3414       'bochs':      'BlockdevOptionsGenericFormat',
3415       'cloop':      'BlockdevOptionsGenericFormat',
3416       'dmg':        'BlockdevOptionsGenericFormat',
3417       'file':       'BlockdevOptionsFile',
3418       'ftp':        'BlockdevOptionsCurlFtp',
3419       'ftps':       'BlockdevOptionsCurlFtps',
3420       'gluster':    'BlockdevOptionsGluster',
3421       'host_cdrom': 'BlockdevOptionsFile',
3422       'host_device':'BlockdevOptionsFile',
3423       'http':       'BlockdevOptionsCurlHttp',
3424       'https':      'BlockdevOptionsCurlHttps',
3425       'iscsi':      'BlockdevOptionsIscsi',
3426       'luks':       'BlockdevOptionsLUKS',
3427       'nbd':        'BlockdevOptionsNbd',
3428       'nfs':        'BlockdevOptionsNfs',
3429       'null-aio':   'BlockdevOptionsNull',
3430       'null-co':    'BlockdevOptionsNull',
3431       'nvme':       'BlockdevOptionsNVMe',
3432       'parallels':  'BlockdevOptionsGenericFormat',
3433       'qcow2':      'BlockdevOptionsQcow2',
3434       'qcow':       'BlockdevOptionsQcow',
3435       'qed':        'BlockdevOptionsGenericCOWFormat',
3436       'quorum':     'BlockdevOptionsQuorum',
3437       'raw':        'BlockdevOptionsRaw',
3438       'rbd':        'BlockdevOptionsRbd',
3439       'replication':'BlockdevOptionsReplication',
3440       'sheepdog':   'BlockdevOptionsSheepdog',
3441       'ssh':        'BlockdevOptionsSsh',
3442       'throttle':   'BlockdevOptionsThrottle',
3443       'vdi':        'BlockdevOptionsGenericFormat',
3444       'vhdx':       'BlockdevOptionsGenericFormat',
3445       'vmdk':       'BlockdevOptionsGenericCOWFormat',
3446       'vpc':        'BlockdevOptionsGenericFormat',
3447       'vvfat':      'BlockdevOptionsVVFAT',
3448       'vxhs':       'BlockdevOptionsVxHS'
3449   } }
3452 # @BlockdevRef:
3454 # Reference to a block device.
3456 # @definition:      defines a new block device inline
3457 # @reference:       references the ID of an existing block device
3459 # Since: 2.9
3461 { 'alternate': 'BlockdevRef',
3462   'data': { 'definition': 'BlockdevOptions',
3463             'reference': 'str' } }
3466 # @BlockdevRefOrNull:
3468 # Reference to a block device.
3470 # @definition:      defines a new block device inline
3471 # @reference:       references the ID of an existing block device.
3472 #                   An empty string means that no block device should
3473 #                   be referenced.  Deprecated; use null instead.
3474 # @null:            No block device should be referenced (since 2.10)
3476 # Since: 2.9
3478 { 'alternate': 'BlockdevRefOrNull',
3479   'data': { 'definition': 'BlockdevOptions',
3480             'reference': 'str',
3481             'null': 'null' } }
3484 # @blockdev-add:
3486 # Creates a new block device. If the @id option is given at the top level, a
3487 # BlockBackend will be created; otherwise, @node-name is mandatory at the top
3488 # level and no BlockBackend will be created.
3490 # Since: 2.9
3492 # Example:
3494 # 1.
3495 # -> { "execute": "blockdev-add",
3496 #      "arguments": {
3497 #           "driver": "qcow2",
3498 #           "node-name": "test1",
3499 #           "file": {
3500 #               "driver": "file",
3501 #               "filename": "test.qcow2"
3502 #            }
3503 #       }
3504 #     }
3505 # <- { "return": {} }
3507 # 2.
3508 # -> { "execute": "blockdev-add",
3509 #      "arguments": {
3510 #           "driver": "qcow2",
3511 #           "node-name": "node0",
3512 #           "discard": "unmap",
3513 #           "cache": {
3514 #              "direct": true
3515 #            },
3516 #            "file": {
3517 #              "driver": "file",
3518 #              "filename": "/tmp/test.qcow2"
3519 #            },
3520 #            "backing": {
3521 #               "driver": "raw",
3522 #               "file": {
3523 #                  "driver": "file",
3524 #                  "filename": "/dev/fdset/4"
3525 #                }
3526 #            }
3527 #        }
3528 #      }
3530 # <- { "return": {} }
3533 { 'command': 'blockdev-add', 'data': 'BlockdevOptions', 'boxed': true }
3536 # @blockdev-del:
3538 # Deletes a block device that has been added using blockdev-add.
3539 # The command will fail if the node is attached to a device or is
3540 # otherwise being used.
3542 # @node-name: Name of the graph node to delete.
3544 # Since: 2.9
3546 # Example:
3548 # -> { "execute": "blockdev-add",
3549 #      "arguments": {
3550 #           "driver": "qcow2",
3551 #           "node-name": "node0",
3552 #           "file": {
3553 #               "driver": "file",
3554 #               "filename": "test.qcow2"
3555 #           }
3556 #      }
3557 #    }
3558 # <- { "return": {} }
3560 # -> { "execute": "blockdev-del",
3561 #      "arguments": { "node-name": "node0" }
3562 #    }
3563 # <- { "return": {} }
3566 { 'command': 'blockdev-del', 'data': { 'node-name': 'str' } }
3569 # @BlockdevCreateOptionsFile:
3571 # Driver specific image creation options for file.
3573 # @filename         Filename for the new image file
3574 # @size             Size of the virtual disk in bytes
3575 # @preallocation    Preallocation mode for the new image (default: off)
3576 # @nocow            Turn off copy-on-write (valid only on btrfs; default: off)
3578 # Since: 2.12
3580 { 'struct': 'BlockdevCreateOptionsFile',
3581   'data': { 'filename':         'str',
3582             'size':             'size',
3583             '*preallocation':   'PreallocMode',
3584             '*nocow':           'bool' } }
3587 # @BlockdevCreateOptionsGluster:
3589 # Driver specific image creation options for gluster.
3591 # @location         Where to store the new image file
3592 # @size             Size of the virtual disk in bytes
3593 # @preallocation    Preallocation mode for the new image (default: off)
3595 # Since: 2.12
3597 { 'struct': 'BlockdevCreateOptionsGluster',
3598   'data': { 'location':         'BlockdevOptionsGluster',
3599             'size':             'size',
3600             '*preallocation':   'PreallocMode' } }
3603 # @BlockdevCreateOptionsLUKS:
3605 # Driver specific image creation options for LUKS.
3607 # @file             Node to create the image format on
3608 # @size             Size of the virtual disk in bytes
3610 # Since: 2.12
3612 { 'struct': 'BlockdevCreateOptionsLUKS',
3613   'base': 'QCryptoBlockCreateOptionsLUKS',
3614   'data': { 'file':             'BlockdevRef',
3615             'size':             'size' } }
3618 # @BlockdevCreateOptionsNfs:
3620 # Driver specific image creation options for NFS.
3622 # @location         Where to store the new image file
3623 # @size             Size of the virtual disk in bytes
3625 # Since: 2.12
3627 { 'struct': 'BlockdevCreateOptionsNfs',
3628   'data': { 'location':         'BlockdevOptionsNfs',
3629             'size':             'size' } }
3632 # @BlockdevCreateOptionsParallels:
3634 # Driver specific image creation options for parallels.
3636 # @file             Node to create the image format on
3637 # @size             Size of the virtual disk in bytes
3638 # @cluster-size     Cluster size in bytes (default: 1 MB)
3640 # Since: 2.12
3642 { 'struct': 'BlockdevCreateOptionsParallels',
3643   'data': { 'file':             'BlockdevRef',
3644             'size':             'size',
3645             '*cluster-size':    'size' } }
3648 # @BlockdevCreateOptionsQcow:
3650 # Driver specific image creation options for qcow.
3652 # @file             Node to create the image format on
3653 # @size             Size of the virtual disk in bytes
3654 # @backing-file     File name of the backing file if a backing file
3655 #                   should be used
3656 # @encrypt          Encryption options if the image should be encrypted
3658 # Since: 2.12
3660 { 'struct': 'BlockdevCreateOptionsQcow',
3661   'data': { 'file':             'BlockdevRef',
3662             'size':             'size',
3663             '*backing-file':    'str',
3664             '*encrypt':         'QCryptoBlockCreateOptions' } }
3667 # @BlockdevQcow2Version:
3669 # @v2:  The original QCOW2 format as introduced in qemu 0.10 (version 2)
3670 # @v3:  The extended QCOW2 format as introduced in qemu 1.1 (version 3)
3672 # Since: 2.12
3674 { 'enum': 'BlockdevQcow2Version',
3675   'data': [ 'v2', 'v3' ] }
3679 # @BlockdevCreateOptionsQcow2:
3681 # Driver specific image creation options for qcow2.
3683 # @file             Node to create the image format on
3684 # @size             Size of the virtual disk in bytes
3685 # @version          Compatibility level (default: v3)
3686 # @backing-file     File name of the backing file if a backing file
3687 #                   should be used
3688 # @backing-fmt      Name of the block driver to use for the backing file
3689 # @encrypt          Encryption options if the image should be encrypted
3690 # @cluster-size     qcow2 cluster size in bytes (default: 65536)
3691 # @preallocation    Preallocation mode for the new image (default: off)
3692 # @lazy-refcounts   True if refcounts may be updated lazily (default: off)
3693 # @refcount-bits    Width of reference counts in bits (default: 16)
3695 # Since: 2.12
3697 { 'struct': 'BlockdevCreateOptionsQcow2',
3698   'data': { 'file':             'BlockdevRef',
3699             'size':             'size',
3700             '*version':         'BlockdevQcow2Version',
3701             '*backing-file':    'str',
3702             '*backing-fmt':     'BlockdevDriver',
3703             '*encrypt':         'QCryptoBlockCreateOptions',
3704             '*cluster-size':    'size',
3705             '*preallocation':   'PreallocMode',
3706             '*lazy-refcounts':  'bool',
3707             '*refcount-bits':   'int' } }
3710 # @BlockdevCreateOptionsQed:
3712 # Driver specific image creation options for qed.
3714 # @file             Node to create the image format on
3715 # @size             Size of the virtual disk in bytes
3716 # @backing-file     File name of the backing file if a backing file
3717 #                   should be used
3718 # @backing-fmt      Name of the block driver to use for the backing file
3719 # @cluster-size     Cluster size in bytes (default: 65536)
3720 # @table-size       L1/L2 table size (in clusters)
3722 # Since: 2.12
3724 { 'struct': 'BlockdevCreateOptionsQed',
3725   'data': { 'file':             'BlockdevRef',
3726             'size':             'size',
3727             '*backing-file':    'str',
3728             '*backing-fmt':     'BlockdevDriver',
3729             '*cluster-size':    'size',
3730             '*table-size':      'int' } }
3733 # @BlockdevCreateOptionsRbd:
3735 # Driver specific image creation options for rbd/Ceph.
3737 # @location         Where to store the new image file. This location cannot
3738 #                   point to a snapshot.
3739 # @size             Size of the virtual disk in bytes
3740 # @cluster-size     RBD object size
3742 # Since: 2.12
3744 { 'struct': 'BlockdevCreateOptionsRbd',
3745   'data': { 'location':         'BlockdevOptionsRbd',
3746             'size':             'size',
3747             '*cluster-size' :   'size' } }
3750 # @SheepdogRedundancyType:
3752 # @full             Create a fully replicated vdi with x copies
3753 # @erasure-coded    Create an erasure coded vdi with x data strips and
3754 #                   y parity strips
3756 # Since: 2.12
3758 { 'enum': 'SheepdogRedundancyType',
3759   'data': [ 'full', 'erasure-coded' ] }
3762 # @SheepdogRedundancyFull:
3764 # @copies           Number of copies to use (between 1 and 31)
3766 # Since: 2.12
3768 { 'struct': 'SheepdogRedundancyFull',
3769   'data': { 'copies': 'int' }}
3772 # @SheepdogRedundancyErasureCoded:
3774 # @data-strips      Number of data strips to use (one of {2,4,8,16})
3775 # @parity-strips    Number of parity strips to use (between 1 and 15)
3777 # Since: 2.12
3779 { 'struct': 'SheepdogRedundancyErasureCoded',
3780   'data': { 'data-strips': 'int',
3781             'parity-strips': 'int' }}
3784 # @SheepdogRedundancy:
3786 # Since: 2.12
3788 { 'union': 'SheepdogRedundancy',
3789   'base': { 'type': 'SheepdogRedundancyType' },
3790   'discriminator': 'type',
3791   'data': { 'full': 'SheepdogRedundancyFull',
3792             'erasure-coded': 'SheepdogRedundancyErasureCoded' } }
3795 # @BlockdevCreateOptionsSheepdog:
3797 # Driver specific image creation options for Sheepdog.
3799 # @location         Where to store the new image file
3800 # @size             Size of the virtual disk in bytes
3801 # @backing-file     File name of a base image
3802 # @preallocation    Preallocation mode (allowed values: off, full)
3803 # @redundancy       Redundancy of the image
3804 # @object-size      Object size of the image
3806 # Since: 2.12
3808 { 'struct': 'BlockdevCreateOptionsSheepdog',
3809   'data': { 'location':         'BlockdevOptionsSheepdog',
3810             'size':             'size',
3811             '*backing-file':    'str',
3812             '*preallocation':   'PreallocMode',
3813             '*redundancy':      'SheepdogRedundancy',
3814             '*object-size':     'size' } }
3817 # @BlockdevCreateOptionsSsh:
3819 # Driver specific image creation options for SSH.
3821 # @location         Where to store the new image file
3822 # @size             Size of the virtual disk in bytes
3824 # Since: 2.12
3826 { 'struct': 'BlockdevCreateOptionsSsh',
3827   'data': { 'location':         'BlockdevOptionsSsh',
3828             'size':             'size' } }
3831 # @BlockdevCreateOptionsVdi:
3833 # Driver specific image creation options for VDI.
3835 # @file             Node to create the image format on
3836 # @size             Size of the virtual disk in bytes
3837 # @static           Whether to create a statically (true) or
3838 #                   dynamically (false) allocated image
3839 #                   (default: false, i.e. dynamic)
3841 # Since: 2.12
3843 { 'struct': 'BlockdevCreateOptionsVdi',
3844   'data': { 'file':             'BlockdevRef',
3845             'size':             'size',
3846             '*static':          'bool' } }
3849 # @BlockdevVhdxSubformat:
3851 # @dynamic: Growing image file
3852 # @fixed:   Preallocated fixed-size image file
3854 # Since: 2.12
3856 { 'enum': 'BlockdevVhdxSubformat',
3857   'data': [ 'dynamic', 'fixed' ] }
3860 # @BlockdevCreateOptionsVhdx:
3862 # Driver specific image creation options for vhdx.
3864 # @file             Node to create the image format on
3865 # @size             Size of the virtual disk in bytes
3866 # @log-size         Log size in bytes, must be a multiple of 1 MB
3867 #                   (default: 1 MB)
3868 # @block-size       Block size in bytes, must be a multiple of 1 MB and not
3869 #                   larger than 256 MB (default: automatically choose a block
3870 #                   size depending on the image size)
3871 # @subformat        vhdx subformat (default: dynamic)
3872 # @block-state-zero Force use of payload blocks of type 'ZERO'. Non-standard,
3873 #                   but default.  Do not set to 'off' when using 'qemu-img
3874 #                   convert' with subformat=dynamic.
3876 # Since: 2.12
3878 { 'struct': 'BlockdevCreateOptionsVhdx',
3879   'data': { 'file':                 'BlockdevRef',
3880             'size':                 'size',
3881             '*log-size':            'size',
3882             '*block-size':          'size',
3883             '*subformat':           'BlockdevVhdxSubformat',
3884             '*block-state-zero':    'bool' } }
3887 # @BlockdevVpcSubformat:
3889 # @dynamic: Growing image file
3890 # @fixed:   Preallocated fixed-size image file
3892 # Since: 2.12
3894 { 'enum': 'BlockdevVpcSubformat',
3895   'data': [ 'dynamic', 'fixed' ] }
3898 # @BlockdevCreateOptionsVpc:
3900 # Driver specific image creation options for vpc (VHD).
3902 # @file             Node to create the image format on
3903 # @size             Size of the virtual disk in bytes
3904 # @subformat        vhdx subformat (default: dynamic)
3905 # @force-size       Force use of the exact byte size instead of rounding to the
3906 #                   next size that can be represented in CHS geometry
3907 #                   (default: false)
3909 # Since: 2.12
3911 { 'struct': 'BlockdevCreateOptionsVpc',
3912   'data': { 'file':                 'BlockdevRef',
3913             'size':                 'size',
3914             '*subformat':           'BlockdevVpcSubformat',
3915             '*force-size':          'bool' } }
3918 # @BlockdevCreateNotSupported:
3920 # This is used for all drivers that don't support creating images.
3922 # Since: 2.12
3924 { 'struct': 'BlockdevCreateNotSupported', 'data': {}}
3927 # @BlockdevCreateOptions:
3929 # Options for creating an image format on a given node.
3931 # @driver           block driver to create the image format
3933 # Since: 2.12
3935 { 'union': 'BlockdevCreateOptions',
3936   'base': {
3937       'driver':         'BlockdevDriver' },
3938   'discriminator': 'driver',
3939   'data': {
3940       'blkdebug':       'BlockdevCreateNotSupported',
3941       'blkverify':      'BlockdevCreateNotSupported',
3942       'bochs':          'BlockdevCreateNotSupported',
3943       'cloop':          'BlockdevCreateNotSupported',
3944       'dmg':            'BlockdevCreateNotSupported',
3945       'file':           'BlockdevCreateOptionsFile',
3946       'ftp':            'BlockdevCreateNotSupported',
3947       'ftps':           'BlockdevCreateNotSupported',
3948       'gluster':        'BlockdevCreateOptionsGluster',
3949       'host_cdrom':     'BlockdevCreateNotSupported',
3950       'host_device':    'BlockdevCreateNotSupported',
3951       'http':           'BlockdevCreateNotSupported',
3952       'https':          'BlockdevCreateNotSupported',
3953       'iscsi':          'BlockdevCreateNotSupported',
3954       'luks':           'BlockdevCreateOptionsLUKS',
3955       'nbd':            'BlockdevCreateNotSupported',
3956       'nfs':            'BlockdevCreateOptionsNfs',
3957       'null-aio':       'BlockdevCreateNotSupported',
3958       'null-co':        'BlockdevCreateNotSupported',
3959       'nvme':           'BlockdevCreateNotSupported',
3960       'parallels':      'BlockdevCreateOptionsParallels',
3961       'qcow':           'BlockdevCreateOptionsQcow',
3962       'qcow2':          'BlockdevCreateOptionsQcow2',
3963       'qed':            'BlockdevCreateOptionsQed',
3964       'quorum':         'BlockdevCreateNotSupported',
3965       'raw':            'BlockdevCreateNotSupported',
3966       'rbd':            'BlockdevCreateOptionsRbd',
3967       'replication':    'BlockdevCreateNotSupported',
3968       'sheepdog':       'BlockdevCreateOptionsSheepdog',
3969       'ssh':            'BlockdevCreateOptionsSsh',
3970       'throttle':       'BlockdevCreateNotSupported',
3971       'vdi':            'BlockdevCreateOptionsVdi',
3972       'vhdx':           'BlockdevCreateOptionsVhdx',
3973       'vmdk':           'BlockdevCreateNotSupported',
3974       'vpc':            'BlockdevCreateOptionsVpc',
3975       'vvfat':          'BlockdevCreateNotSupported',
3976       'vxhs':           'BlockdevCreateNotSupported'
3977   } }
3980 # @x-blockdev-create:
3982 # Create an image format on a given node.
3983 # TODO Replace with something asynchronous (block job?)
3985 # Since: 2.12
3987 { 'command': 'x-blockdev-create',
3988   'data': 'BlockdevCreateOptions',
3989   'boxed': true }
3992 # @blockdev-open-tray:
3994 # Opens a block device's tray. If there is a block driver state tree inserted as
3995 # a medium, it will become inaccessible to the guest (but it will remain
3996 # associated to the block device, so closing the tray will make it accessible
3997 # again).
3999 # If the tray was already open before, this will be a no-op.
4001 # Once the tray opens, a DEVICE_TRAY_MOVED event is emitted. There are cases in
4002 # which no such event will be generated, these include:
4003 # - if the guest has locked the tray, @force is false and the guest does not
4004 #   respond to the eject request
4005 # - if the BlockBackend denoted by @device does not have a guest device attached
4006 #   to it
4007 # - if the guest device does not have an actual tray
4009 # @device: Block device name (deprecated, use @id instead)
4011 # @id:     The name or QOM path of the guest device (since: 2.8)
4013 # @force:  if false (the default), an eject request will be sent to
4014 #          the guest if it has locked the tray (and the tray will not be opened
4015 #          immediately); if true, the tray will be opened regardless of whether
4016 #          it is locked
4018 # Since: 2.5
4020 # Example:
4022 # -> { "execute": "blockdev-open-tray",
4023 #      "arguments": { "id": "ide0-1-0" } }
4025 # <- { "timestamp": { "seconds": 1418751016,
4026 #                     "microseconds": 716996 },
4027 #      "event": "DEVICE_TRAY_MOVED",
4028 #      "data": { "device": "ide1-cd0",
4029 #                "id": "ide0-1-0",
4030 #                "tray-open": true } }
4032 # <- { "return": {} }
4035 { 'command': 'blockdev-open-tray',
4036   'data': { '*device': 'str',
4037             '*id': 'str',
4038             '*force': 'bool' } }
4041 # @blockdev-close-tray:
4043 # Closes a block device's tray. If there is a block driver state tree associated
4044 # with the block device (which is currently ejected), that tree will be loaded
4045 # as the medium.
4047 # If the tray was already closed before, this will be a no-op.
4049 # @device:  Block device name (deprecated, use @id instead)
4051 # @id:      The name or QOM path of the guest device (since: 2.8)
4053 # Since: 2.5
4055 # Example:
4057 # -> { "execute": "blockdev-close-tray",
4058 #      "arguments": { "id": "ide0-1-0" } }
4060 # <- { "timestamp": { "seconds": 1418751345,
4061 #                     "microseconds": 272147 },
4062 #      "event": "DEVICE_TRAY_MOVED",
4063 #      "data": { "device": "ide1-cd0",
4064 #                "id": "ide0-1-0",
4065 #                "tray-open": false } }
4067 # <- { "return": {} }
4070 { 'command': 'blockdev-close-tray',
4071   'data': { '*device': 'str',
4072             '*id': 'str' } }
4075 # @blockdev-remove-medium:
4077 # Removes a medium (a block driver state tree) from a block device. That block
4078 # device's tray must currently be open (unless there is no attached guest
4079 # device).
4081 # If the tray is open and there is no medium inserted, this will be a no-op.
4083 # @id:     The name or QOM path of the guest device
4085 # Since: 2.12
4087 # Example:
4089 # -> { "execute": "blockdev-remove-medium",
4090 #      "arguments": { "id": "ide0-1-0" } }
4092 # <- { "error": { "class": "GenericError",
4093 #                 "desc": "Tray of device 'ide0-1-0' is not open" } }
4095 # -> { "execute": "blockdev-open-tray",
4096 #      "arguments": { "id": "ide0-1-0" } }
4098 # <- { "timestamp": { "seconds": 1418751627,
4099 #                     "microseconds": 549958 },
4100 #      "event": "DEVICE_TRAY_MOVED",
4101 #      "data": { "device": "ide1-cd0",
4102 #                "id": "ide0-1-0",
4103 #                "tray-open": true } }
4105 # <- { "return": {} }
4107 # -> { "execute": "blockdev-remove-medium",
4108 #      "arguments": { "id": "ide0-1-0" } }
4110 # <- { "return": {} }
4113 { 'command': 'blockdev-remove-medium',
4114   'data': { 'id': 'str' } }
4117 # @blockdev-insert-medium:
4119 # Inserts a medium (a block driver state tree) into a block device. That block
4120 # device's tray must currently be open (unless there is no attached guest
4121 # device) and there must be no medium inserted already.
4123 # @id:        The name or QOM path of the guest device
4125 # @node-name: name of a node in the block driver state graph
4127 # Since: 2.12
4129 # Example:
4131 # -> { "execute": "blockdev-add",
4132 #      "arguments": {
4133 #          "node-name": "node0",
4134 #          "driver": "raw",
4135 #          "file": { "driver": "file",
4136 #                    "filename": "fedora.iso" } } }
4137 # <- { "return": {} }
4139 # -> { "execute": "blockdev-insert-medium",
4140 #      "arguments": { "id": "ide0-1-0",
4141 #                     "node-name": "node0" } }
4143 # <- { "return": {} }
4146 { 'command': 'blockdev-insert-medium',
4147   'data': { 'id': 'str',
4148             'node-name': 'str'} }
4152 # @BlockdevChangeReadOnlyMode:
4154 # Specifies the new read-only mode of a block device subject to the
4155 # @blockdev-change-medium command.
4157 # @retain:      Retains the current read-only mode
4159 # @read-only:   Makes the device read-only
4161 # @read-write:  Makes the device writable
4163 # Since: 2.3
4166 { 'enum': 'BlockdevChangeReadOnlyMode',
4167   'data': ['retain', 'read-only', 'read-write'] }
4171 # @blockdev-change-medium:
4173 # Changes the medium inserted into a block device by ejecting the current medium
4174 # and loading a new image file which is inserted as the new medium (this command
4175 # combines blockdev-open-tray, blockdev-remove-medium, blockdev-insert-medium
4176 # and blockdev-close-tray).
4178 # @device:          Block device name (deprecated, use @id instead)
4180 # @id:              The name or QOM path of the guest device
4181 #                   (since: 2.8)
4183 # @filename:        filename of the new image to be loaded
4185 # @format:          format to open the new image with (defaults to
4186 #                   the probed format)
4188 # @read-only-mode:  change the read-only mode of the device; defaults
4189 #                   to 'retain'
4191 # Since: 2.5
4193 # Examples:
4195 # 1. Change a removable medium
4197 # -> { "execute": "blockdev-change-medium",
4198 #      "arguments": { "id": "ide0-1-0",
4199 #                     "filename": "/srv/images/Fedora-12-x86_64-DVD.iso",
4200 #                     "format": "raw" } }
4201 # <- { "return": {} }
4203 # 2. Load a read-only medium into a writable drive
4205 # -> { "execute": "blockdev-change-medium",
4206 #      "arguments": { "id": "floppyA",
4207 #                     "filename": "/srv/images/ro.img",
4208 #                     "format": "raw",
4209 #                     "read-only-mode": "retain" } }
4211 # <- { "error":
4212 #      { "class": "GenericError",
4213 #        "desc": "Could not open '/srv/images/ro.img': Permission denied" } }
4215 # -> { "execute": "blockdev-change-medium",
4216 #      "arguments": { "id": "floppyA",
4217 #                     "filename": "/srv/images/ro.img",
4218 #                     "format": "raw",
4219 #                     "read-only-mode": "read-only" } }
4221 # <- { "return": {} }
4224 { 'command': 'blockdev-change-medium',
4225   'data': { '*device': 'str',
4226             '*id': 'str',
4227             'filename': 'str',
4228             '*format': 'str',
4229             '*read-only-mode': 'BlockdevChangeReadOnlyMode' } }
4233 # @BlockErrorAction:
4235 # An enumeration of action that has been taken when a DISK I/O occurs
4237 # @ignore: error has been ignored
4239 # @report: error has been reported to the device
4241 # @stop: error caused VM to be stopped
4243 # Since: 2.1
4245 { 'enum': 'BlockErrorAction',
4246   'data': [ 'ignore', 'report', 'stop' ] }
4250 # @BLOCK_IMAGE_CORRUPTED:
4252 # Emitted when a disk image is being marked corrupt. The image can be
4253 # identified by its device or node name. The 'device' field is always
4254 # present for compatibility reasons, but it can be empty ("") if the
4255 # image does not have a device name associated.
4257 # @device: device name. This is always present for compatibility
4258 #          reasons, but it can be empty ("") if the image does not
4259 #          have a device name associated.
4261 # @node-name: node name (Since: 2.4)
4263 # @msg: informative message for human consumption, such as the kind of
4264 #       corruption being detected. It should not be parsed by machine as it is
4265 #       not guaranteed to be stable
4267 # @offset: if the corruption resulted from an image access, this is
4268 #          the host's access offset into the image
4270 # @size: if the corruption resulted from an image access, this is
4271 #        the access size
4273 # @fatal: if set, the image is marked corrupt and therefore unusable after this
4274 #        event and must be repaired (Since 2.2; before, every
4275 #        BLOCK_IMAGE_CORRUPTED event was fatal)
4277 # Note: If action is "stop", a STOP event will eventually follow the
4278 #       BLOCK_IO_ERROR event.
4280 # Example:
4282 # <- { "event": "BLOCK_IMAGE_CORRUPTED",
4283 #      "data": { "device": "ide0-hd0", "node-name": "node0",
4284 #                "msg": "Prevented active L1 table overwrite", "offset": 196608,
4285 #                "size": 65536 },
4286 #      "timestamp": { "seconds": 1378126126, "microseconds": 966463 } }
4288 # Since: 1.7
4290 { 'event': 'BLOCK_IMAGE_CORRUPTED',
4291   'data': { 'device'     : 'str',
4292             '*node-name' : 'str',
4293             'msg'        : 'str',
4294             '*offset'    : 'int',
4295             '*size'      : 'int',
4296             'fatal'      : 'bool' } }
4299 # @BLOCK_IO_ERROR:
4301 # Emitted when a disk I/O error occurs
4303 # @device: device name. This is always present for compatibility
4304 #          reasons, but it can be empty ("") if the image does not
4305 #          have a device name associated.
4307 # @node-name: node name. Note that errors may be reported for the root node
4308 #             that is directly attached to a guest device rather than for the
4309 #             node where the error occurred. The node name is not present if
4310 #             the drive is empty. (Since: 2.8)
4312 # @operation: I/O operation
4314 # @action: action that has been taken
4316 # @nospace: true if I/O error was caused due to a no-space
4317 #           condition. This key is only present if query-block's
4318 #           io-status is present, please see query-block documentation
4319 #           for more information (since: 2.2)
4321 # @reason: human readable string describing the error cause.
4322 #          (This field is a debugging aid for humans, it should not
4323 #           be parsed by applications) (since: 2.2)
4325 # Note: If action is "stop", a STOP event will eventually follow the
4326 # BLOCK_IO_ERROR event
4328 # Since: 0.13.0
4330 # Example:
4332 # <- { "event": "BLOCK_IO_ERROR",
4333 #      "data": { "device": "ide0-hd1",
4334 #                "node-name": "#block212",
4335 #                "operation": "write",
4336 #                "action": "stop" },
4337 #      "timestamp": { "seconds": 1265044230, "microseconds": 450486 } }
4340 { 'event': 'BLOCK_IO_ERROR',
4341   'data': { 'device': 'str', '*node-name': 'str',
4342             'operation': 'IoOperationType',
4343             'action': 'BlockErrorAction', '*nospace': 'bool',
4344             'reason': 'str' } }
4347 # @BLOCK_JOB_COMPLETED:
4349 # Emitted when a block job has completed
4351 # @type: job type
4353 # @device: The job identifier. Originally the device name but other
4354 #          values are allowed since QEMU 2.7
4356 # @len: maximum progress value
4358 # @offset: current progress value. On success this is equal to len.
4359 #          On failure this is less than len
4361 # @speed: rate limit, bytes per second
4363 # @error: error message. Only present on failure. This field
4364 #         contains a human-readable error message. There are no semantics
4365 #         other than that streaming has failed and clients should not try to
4366 #         interpret the error string
4368 # Since: 1.1
4370 # Example:
4372 # <- { "event": "BLOCK_JOB_COMPLETED",
4373 #      "data": { "type": "stream", "device": "virtio-disk0",
4374 #                "len": 10737418240, "offset": 10737418240,
4375 #                "speed": 0 },
4376 #      "timestamp": { "seconds": 1267061043, "microseconds": 959568 } }
4379 { 'event': 'BLOCK_JOB_COMPLETED',
4380   'data': { 'type'  : 'BlockJobType',
4381             'device': 'str',
4382             'len'   : 'int',
4383             'offset': 'int',
4384             'speed' : 'int',
4385             '*error': 'str' } }
4388 # @BLOCK_JOB_CANCELLED:
4390 # Emitted when a block job has been cancelled
4392 # @type: job type
4394 # @device: The job identifier. Originally the device name but other
4395 #          values are allowed since QEMU 2.7
4397 # @len: maximum progress value
4399 # @offset: current progress value. On success this is equal to len.
4400 #          On failure this is less than len
4402 # @speed: rate limit, bytes per second
4404 # Since: 1.1
4406 # Example:
4408 # <- { "event": "BLOCK_JOB_CANCELLED",
4409 #      "data": { "type": "stream", "device": "virtio-disk0",
4410 #                "len": 10737418240, "offset": 134217728,
4411 #                "speed": 0 },
4412 #      "timestamp": { "seconds": 1267061043, "microseconds": 959568 } }
4415 { 'event': 'BLOCK_JOB_CANCELLED',
4416   'data': { 'type'  : 'BlockJobType',
4417             'device': 'str',
4418             'len'   : 'int',
4419             'offset': 'int',
4420             'speed' : 'int' } }
4423 # @BLOCK_JOB_ERROR:
4425 # Emitted when a block job encounters an error
4427 # @device: The job identifier. Originally the device name but other
4428 #          values are allowed since QEMU 2.7
4430 # @operation: I/O operation
4432 # @action: action that has been taken
4434 # Since: 1.3
4436 # Example:
4438 # <- { "event": "BLOCK_JOB_ERROR",
4439 #      "data": { "device": "ide0-hd1",
4440 #                "operation": "write",
4441 #                "action": "stop" },
4442 #      "timestamp": { "seconds": 1265044230, "microseconds": 450486 } }
4445 { 'event': 'BLOCK_JOB_ERROR',
4446   'data': { 'device'   : 'str',
4447             'operation': 'IoOperationType',
4448             'action'   : 'BlockErrorAction' } }
4451 # @BLOCK_JOB_READY:
4453 # Emitted when a block job is ready to complete
4455 # @type: job type
4457 # @device: The job identifier. Originally the device name but other
4458 #          values are allowed since QEMU 2.7
4460 # @len: maximum progress value
4462 # @offset: current progress value. On success this is equal to len.
4463 #          On failure this is less than len
4465 # @speed: rate limit, bytes per second
4467 # Note: The "ready to complete" status is always reset by a @BLOCK_JOB_ERROR
4468 # event
4470 # Since: 1.3
4472 # Example:
4474 # <- { "event": "BLOCK_JOB_READY",
4475 #      "data": { "device": "drive0", "type": "mirror", "speed": 0,
4476 #                "len": 2097152, "offset": 2097152 }
4477 #      "timestamp": { "seconds": 1265044230, "microseconds": 450486 } }
4480 { 'event': 'BLOCK_JOB_READY',
4481   'data': { 'type'  : 'BlockJobType',
4482             'device': 'str',
4483             'len'   : 'int',
4484             'offset': 'int',
4485             'speed' : 'int' } }
4488 # @BLOCK_JOB_PENDING:
4490 # Emitted when a block job is awaiting explicit authorization to finalize graph
4491 # changes via @block-job-finalize. If this job is part of a transaction, it will
4492 # not emit this event until the transaction has converged first.
4494 # @type: job type
4496 # @id: The job identifier.
4498 # Since: 2.12
4500 # Example:
4502 # <- { "event": "BLOCK_JOB_WAITING",
4503 #      "data": { "device": "drive0", "type": "mirror" },
4504 #      "timestamp": { "seconds": 1265044230, "microseconds": 450486 } }
4507 { 'event': 'BLOCK_JOB_PENDING',
4508   'data': { 'type'  : 'BlockJobType',
4509             'id'    : 'str' } }
4512 # @PreallocMode:
4514 # Preallocation mode of QEMU image file
4516 # @off: no preallocation
4517 # @metadata: preallocate only for metadata
4518 # @falloc: like @full preallocation but allocate disk space by
4519 #          posix_fallocate() rather than writing zeros.
4520 # @full: preallocate all data by writing zeros to device to ensure disk
4521 #        space is really available. @full preallocation also sets up
4522 #        metadata correctly.
4524 # Since: 2.2
4526 { 'enum': 'PreallocMode',
4527   'data': [ 'off', 'metadata', 'falloc', 'full' ] }
4530 # @BLOCK_WRITE_THRESHOLD:
4532 # Emitted when writes on block device reaches or exceeds the
4533 # configured write threshold. For thin-provisioned devices, this
4534 # means the device should be extended to avoid pausing for
4535 # disk exhaustion.
4536 # The event is one shot. Once triggered, it needs to be
4537 # re-registered with another block-set-write-threshold command.
4539 # @node-name: graph node name on which the threshold was exceeded.
4541 # @amount-exceeded: amount of data which exceeded the threshold, in bytes.
4543 # @write-threshold: last configured threshold, in bytes.
4545 # Since: 2.3
4547 { 'event': 'BLOCK_WRITE_THRESHOLD',
4548   'data': { 'node-name': 'str',
4549             'amount-exceeded': 'uint64',
4550             'write-threshold': 'uint64' } }
4553 # @block-set-write-threshold:
4555 # Change the write threshold for a block drive. An event will be
4556 # delivered if a write to this block drive crosses the configured
4557 # threshold.  The threshold is an offset, thus must be
4558 # non-negative. Default is no write threshold. Setting the threshold
4559 # to zero disables it.
4561 # This is useful to transparently resize thin-provisioned drives without
4562 # the guest OS noticing.
4564 # @node-name: graph node name on which the threshold must be set.
4566 # @write-threshold: configured threshold for the block device, bytes.
4567 #                   Use 0 to disable the threshold.
4569 # Since: 2.3
4571 # Example:
4573 # -> { "execute": "block-set-write-threshold",
4574 #      "arguments": { "node-name": "mydev",
4575 #                     "write-threshold": 17179869184 } }
4576 # <- { "return": {} }
4579 { 'command': 'block-set-write-threshold',
4580   'data': { 'node-name': 'str', 'write-threshold': 'uint64' } }
4583 # @x-blockdev-change:
4585 # Dynamically reconfigure the block driver state graph. It can be used
4586 # to add, remove, insert or replace a graph node. Currently only the
4587 # Quorum driver implements this feature to add or remove its child. This
4588 # is useful to fix a broken quorum child.
4590 # If @node is specified, it will be inserted under @parent. @child
4591 # may not be specified in this case. If both @parent and @child are
4592 # specified but @node is not, @child will be detached from @parent.
4594 # @parent: the id or name of the parent node.
4596 # @child: the name of a child under the given parent node.
4598 # @node: the name of the node that will be added.
4600 # Note: this command is experimental, and its API is not stable. It
4601 # does not support all kinds of operations, all kinds of children, nor
4602 # all block drivers.
4604 # FIXME Removing children from a quorum node means introducing gaps in the
4605 # child indices. This cannot be represented in the 'children' list of
4606 # BlockdevOptionsQuorum, as returned by .bdrv_refresh_filename().
4608 # Warning: The data in a new quorum child MUST be consistent with that of
4609 # the rest of the array.
4611 # Since: 2.7
4613 # Example:
4615 # 1. Add a new node to a quorum
4616 # -> { "execute": "blockdev-add",
4617 #      "arguments": {
4618 #          "driver": "raw",
4619 #          "node-name": "new_node",
4620 #          "file": { "driver": "file",
4621 #                    "filename": "test.raw" } } }
4622 # <- { "return": {} }
4623 # -> { "execute": "x-blockdev-change",
4624 #      "arguments": { "parent": "disk1",
4625 #                     "node": "new_node" } }
4626 # <- { "return": {} }
4628 # 2. Delete a quorum's node
4629 # -> { "execute": "x-blockdev-change",
4630 #      "arguments": { "parent": "disk1",
4631 #                     "child": "children.1" } }
4632 # <- { "return": {} }
4635 { 'command': 'x-blockdev-change',
4636   'data' : { 'parent': 'str',
4637              '*child': 'str',
4638              '*node': 'str' } }
4641 # @x-blockdev-set-iothread:
4643 # Move @node and its children into the @iothread.  If @iothread is null then
4644 # move @node and its children into the main loop.
4646 # The node must not be attached to a BlockBackend.
4648 # @node-name: the name of the block driver node
4650 # @iothread: the name of the IOThread object or null for the main loop
4652 # @force: true if the node and its children should be moved when a BlockBackend
4653 #         is already attached
4655 # Note: this command is experimental and intended for test cases that need
4656 # control over IOThreads only.
4658 # Since: 2.12
4660 # Example:
4662 # 1. Move a node into an IOThread
4663 # -> { "execute": "x-blockdev-set-iothread",
4664 #      "arguments": { "node-name": "disk1",
4665 #                     "iothread": "iothread0" } }
4666 # <- { "return": {} }
4668 # 2. Move a node into the main loop
4669 # -> { "execute": "x-blockdev-set-iothread",
4670 #      "arguments": { "node-name": "disk1",
4671 #                     "iothread": null } }
4672 # <- { "return": {} }
4675 { 'command': 'x-blockdev-set-iothread',
4676   'data' : { 'node-name': 'str',
4677              'iothread': 'StrOrNull',
4678              '*force': 'bool' } }