4 # == Block core (VM unrelated)
7 { 'include': 'common.json' }
8 { 'include': 'crypto.json' }
9 { 'include': 'job.json' }
10 { 'include': 'sockets.json' }
15 # @id: unique snapshot id
17 # @name: user chosen name
19 # @vm-state-size: size of the VM state
21 # @date-sec: UTC date of the snapshot in seconds
23 # @date-nsec: fractional part in nano seconds to be used with date-sec
25 # @vm-clock-sec: VM clock relative to boot in seconds
27 # @vm-clock-nsec: fractional part in nano seconds to be used with vm-clock-sec
32 { 'struct': 'SnapshotInfo',
33 'data': { 'id': 'str', 'name': 'str', 'vm-state-size': 'int',
34 'date-sec': 'int', 'date-nsec': 'int',
35 'vm-clock-sec': 'int', 'vm-clock-nsec': 'int' } }
38 # @ImageInfoSpecificQCow2EncryptionBase:
40 # @format: The encryption format
44 { 'struct': 'ImageInfoSpecificQCow2EncryptionBase',
45 'data': { 'format': 'BlockdevQcow2EncryptionFormat'}}
48 # @ImageInfoSpecificQCow2Encryption:
52 { 'union': 'ImageInfoSpecificQCow2Encryption',
53 'base': 'ImageInfoSpecificQCow2EncryptionBase',
54 'discriminator': 'format',
55 'data': { 'luks': 'QCryptoBlockInfoLUKS' } }
58 # @ImageInfoSpecificQCow2:
60 # @compat: compatibility level
62 # @data-file: the filename of the external data file that is stored in the
63 # image and used as a default for opening the image (since: 4.0)
65 # @data-file-raw: True if the external data file must stay valid as a
66 # standalone (read-only) raw image without looking at qcow2
67 # metadata (since: 4.0)
69 # @lazy-refcounts: on or off; only valid for compat >= 1.1
71 # @corrupt: true if the image has been marked corrupt; only valid for
72 # compat >= 1.1 (since 2.2)
74 # @refcount-bits: width of a refcount entry in bits (since 2.3)
76 # @encrypt: details about encryption parameters; only set if image
77 # is encrypted (since 2.10)
79 # @bitmaps: A list of qcow2 bitmap details (since 4.0)
81 # @compression-type: the image cluster compression method (since 5.1)
85 { 'struct': 'ImageInfoSpecificQCow2',
89 '*data-file-raw': 'bool',
90 '*lazy-refcounts': 'bool',
92 'refcount-bits': 'int',
93 '*encrypt': 'ImageInfoSpecificQCow2Encryption',
94 '*bitmaps': ['Qcow2BitmapInfo'],
95 'compression-type': 'Qcow2CompressionType'
99 # @ImageInfoSpecificVmdk:
101 # @create-type: The create type of VMDK image
103 # @cid: Content id of image
105 # @parent-cid: Parent VMDK image's cid
107 # @extents: List of extent files
111 { 'struct': 'ImageInfoSpecificVmdk',
113 'create-type': 'str',
116 'extents': ['ImageInfo']
120 # @ImageInfoSpecific:
122 # A discriminated record of image format specific information structures.
126 { 'union': 'ImageInfoSpecific',
128 'qcow2': 'ImageInfoSpecificQCow2',
129 'vmdk': 'ImageInfoSpecificVmdk',
130 # If we need to add block driver specific parameters for
131 # LUKS in future, then we'll subclass QCryptoBlockInfoLUKS
132 # to define a ImageInfoSpecificLUKS
133 'luks': 'QCryptoBlockInfoLUKS'
139 # Information about a QEMU image file
141 # @filename: name of the image file
143 # @format: format of the image file
145 # @virtual-size: maximum capacity in bytes of the image
147 # @actual-size: actual size on disk in bytes of the image
149 # @dirty-flag: true if image is not cleanly closed
151 # @cluster-size: size of a cluster in bytes
153 # @encrypted: true if the image is encrypted
155 # @compressed: true if the image is compressed (Since 1.7)
157 # @backing-filename: name of the backing file
159 # @full-backing-filename: full path of the backing file
161 # @backing-filename-format: the format of the backing file
163 # @snapshots: list of VM snapshots
165 # @backing-image: info of the backing image (since 1.6)
167 # @format-specific: structure supplying additional format-specific
168 # information (since 1.7)
173 { 'struct': 'ImageInfo',
174 'data': {'filename': 'str', 'format': 'str', '*dirty-flag': 'bool',
175 '*actual-size': 'int', 'virtual-size': 'int',
176 '*cluster-size': 'int', '*encrypted': 'bool', '*compressed': 'bool',
177 '*backing-filename': 'str', '*full-backing-filename': 'str',
178 '*backing-filename-format': 'str', '*snapshots': ['SnapshotInfo'],
179 '*backing-image': 'ImageInfo',
180 '*format-specific': 'ImageInfoSpecific' } }
185 # Information about a QEMU image file check
187 # @filename: name of the image file checked
189 # @format: format of the image file checked
191 # @check-errors: number of unexpected errors occurred during check
193 # @image-end-offset: offset (in bytes) where the image ends, this
194 # field is present if the driver for the image format
197 # @corruptions: number of corruptions found during the check if any
199 # @leaks: number of leaks found during the check if any
201 # @corruptions-fixed: number of corruptions fixed during the check
204 # @leaks-fixed: number of leaks fixed during the check if any
206 # @total-clusters: total number of clusters, this field is present
207 # if the driver for the image format supports it
209 # @allocated-clusters: total number of allocated clusters, this
210 # field is present if the driver for the image format
213 # @fragmented-clusters: total number of fragmented clusters, this
214 # field is present if the driver for the image format
217 # @compressed-clusters: total number of compressed clusters, this
218 # field is present if the driver for the image format
224 { 'struct': 'ImageCheck',
225 'data': {'filename': 'str', 'format': 'str', 'check-errors': 'int',
226 '*image-end-offset': 'int', '*corruptions': 'int', '*leaks': 'int',
227 '*corruptions-fixed': 'int', '*leaks-fixed': 'int',
228 '*total-clusters': 'int', '*allocated-clusters': 'int',
229 '*fragmented-clusters': 'int', '*compressed-clusters': 'int' } }
234 # Mapping information from a virtual block range to a host file range
236 # @start: the start byte of the mapped virtual range
238 # @length: the number of bytes of the mapped virtual range
240 # @data: whether the mapped range has data
242 # @zero: whether the virtual blocks are zeroed
244 # @depth: the depth of the mapping
246 # @offset: the offset in file that the virtual sectors are mapped to
248 # @filename: filename that is referred to by @offset
253 { 'struct': 'MapEntry',
254 'data': {'start': 'int', 'length': 'int', 'data': 'bool',
255 'zero': 'bool', 'depth': 'int', '*offset': 'int',
256 '*filename': 'str' } }
259 # @BlockdevCacheInfo:
261 # Cache mode information for a block device
263 # @writeback: true if writeback mode is enabled
264 # @direct: true if the host page cache is bypassed (O_DIRECT)
265 # @no-flush: true if flush requests are ignored for the device
269 { 'struct': 'BlockdevCacheInfo',
270 'data': { 'writeback': 'bool',
272 'no-flush': 'bool' } }
277 # Information about the backing device for a block device.
279 # @file: the filename of the backing device
281 # @node-name: the name of the block driver node (Since 2.0)
283 # @ro: true if the backing device was open read-only
285 # @drv: the name of the block format used to open the backing device. As of
286 # 0.14.0 this can be: 'blkdebug', 'bochs', 'cloop', 'cow', 'dmg',
287 # 'file', 'file', 'ftp', 'ftps', 'host_cdrom', 'host_device',
288 # 'http', 'https', 'luks', 'nbd', 'parallels', 'qcow',
289 # 'qcow2', 'raw', 'vdi', 'vmdk', 'vpc', 'vvfat'
290 # 2.2: 'archipelago' added, 'cow' dropped
291 # 2.3: 'host_floppy' deprecated
292 # 2.5: 'host_floppy' dropped
294 # 2.8: 'replication' added, 'tftp' dropped
295 # 2.9: 'archipelago' dropped
297 # @backing_file: the name of the backing file (for copy-on-write)
299 # @backing_file_depth: number of files in the backing file chain (since: 1.2)
301 # @encrypted: true if the backing device is encrypted
303 # @encryption_key_missing: always false
305 # @detect_zeroes: detect and optimize zero writes (Since 2.1)
307 # @bps: total throughput limit in bytes per second is specified
309 # @bps_rd: read throughput limit in bytes per second is specified
311 # @bps_wr: write throughput limit in bytes per second is specified
313 # @iops: total I/O operations per second is specified
315 # @iops_rd: read I/O operations per second is specified
317 # @iops_wr: write I/O operations per second is specified
319 # @image: the info of image used (since: 1.6)
321 # @bps_max: total throughput limit during bursts,
322 # in bytes (Since 1.7)
324 # @bps_rd_max: read throughput limit during bursts,
325 # in bytes (Since 1.7)
327 # @bps_wr_max: write throughput limit during bursts,
328 # in bytes (Since 1.7)
330 # @iops_max: total I/O operations per second during bursts,
331 # in bytes (Since 1.7)
333 # @iops_rd_max: read I/O operations per second during bursts,
334 # in bytes (Since 1.7)
336 # @iops_wr_max: write I/O operations per second during bursts,
337 # in bytes (Since 1.7)
339 # @bps_max_length: maximum length of the @bps_max burst
340 # period, in seconds. (Since 2.6)
342 # @bps_rd_max_length: maximum length of the @bps_rd_max
343 # burst period, in seconds. (Since 2.6)
345 # @bps_wr_max_length: maximum length of the @bps_wr_max
346 # burst period, in seconds. (Since 2.6)
348 # @iops_max_length: maximum length of the @iops burst
349 # period, in seconds. (Since 2.6)
351 # @iops_rd_max_length: maximum length of the @iops_rd_max
352 # burst period, in seconds. (Since 2.6)
354 # @iops_wr_max_length: maximum length of the @iops_wr_max
355 # burst period, in seconds. (Since 2.6)
357 # @iops_size: an I/O size in bytes (Since 1.7)
359 # @group: throttle group name (Since 2.4)
361 # @cache: the cache mode used for the block device (since: 2.3)
363 # @write_threshold: configured write threshold for the device.
364 # 0 if disabled. (Since 2.3)
366 # @dirty-bitmaps: dirty bitmaps information (only present if node
367 # has one or more dirty bitmaps) (Since 4.2)
370 # @deprecated: Member @encryption_key_missing is deprecated. It is
376 { 'struct': 'BlockDeviceInfo',
377 'data': { 'file': 'str', '*node-name': 'str', 'ro': 'bool', 'drv': 'str',
378 '*backing_file': 'str', 'backing_file_depth': 'int',
380 'encryption_key_missing': { 'type': 'bool',
381 'features': [ 'deprecated' ] },
382 'detect_zeroes': 'BlockdevDetectZeroesOptions',
383 'bps': 'int', 'bps_rd': 'int', 'bps_wr': 'int',
384 'iops': 'int', 'iops_rd': 'int', 'iops_wr': 'int',
385 'image': 'ImageInfo',
386 '*bps_max': 'int', '*bps_rd_max': 'int',
387 '*bps_wr_max': 'int', '*iops_max': 'int',
388 '*iops_rd_max': 'int', '*iops_wr_max': 'int',
389 '*bps_max_length': 'int', '*bps_rd_max_length': 'int',
390 '*bps_wr_max_length': 'int', '*iops_max_length': 'int',
391 '*iops_rd_max_length': 'int', '*iops_wr_max_length': 'int',
392 '*iops_size': 'int', '*group': 'str', 'cache': 'BlockdevCacheInfo',
393 'write_threshold': 'int', '*dirty-bitmaps': ['BlockDirtyInfo'] } }
396 # @BlockDeviceIoStatus:
398 # An enumeration of block device I/O status.
400 # @ok: The last I/O operation has succeeded
402 # @failed: The last I/O operation has failed
404 # @nospace: The last I/O operation has failed due to a no-space condition
408 { 'enum': 'BlockDeviceIoStatus', 'data': [ 'ok', 'failed', 'nospace' ] }
411 # @BlockDeviceMapEntry:
413 # Entry in the metadata map of the device (returned by "qemu-img map")
415 # @start: Offset in the image of the first byte described by this entry
418 # @length: Length of the range described by this entry (in bytes)
420 # @depth: Number of layers (0 = top image, 1 = top image's backing file, etc.)
421 # before reaching one for which the range is allocated. The value is
422 # in the range 0 to the depth of the image chain - 1.
424 # @zero: the sectors in this range read as zeros
426 # @data: reading the image will actually read data from a file (in particular,
427 # if @offset is present this means that the sectors are not simply
428 # preallocated, but contain actual data in raw format)
430 # @offset: if present, the image file stores the data for this range in
431 # raw format at the given offset.
435 { 'struct': 'BlockDeviceMapEntry',
436 'data': { 'start': 'int', 'length': 'int', 'depth': 'int', 'zero': 'bool',
437 'data': 'bool', '*offset': 'int' } }
440 # @DirtyBitmapStatus:
442 # An enumeration of possible states that a dirty bitmap can report to the user.
444 # @frozen: The bitmap is currently in-use by some operation and is immutable.
445 # If the bitmap was @active prior to the operation, new writes by the
446 # guest are being recorded in a temporary buffer, and will not be lost.
447 # Generally, bitmaps are cleared on successful use in an operation and
448 # the temporary buffer is committed into the bitmap. On failure, the
449 # temporary buffer is merged back into the bitmap without first
451 # Please refer to the documentation for each bitmap-using operation,
452 # See also @blockdev-backup, @drive-backup.
454 # @disabled: The bitmap is not currently recording new writes by the guest.
455 # This is requested explicitly via @block-dirty-bitmap-disable.
456 # It can still be cleared, deleted, or used for backup operations.
458 # @active: The bitmap is actively monitoring for new writes, and can be cleared,
459 # deleted, or used for backup operations.
461 # @locked: The bitmap is currently in-use by some operation and is immutable.
462 # If the bitmap was @active prior to the operation, it is still
463 # recording new writes. If the bitmap was @disabled, it is not
464 # recording new writes. (Since 2.12)
466 # @inconsistent: This is a persistent dirty bitmap that was marked in-use on
467 # disk, and is unusable by QEMU. It can only be deleted.
468 # Please rely on the inconsistent field in @BlockDirtyInfo
469 # instead, as the status field is deprecated. (Since 4.0)
473 { 'enum': 'DirtyBitmapStatus',
474 'data': ['active', 'disabled', 'frozen', 'locked', 'inconsistent'] }
479 # Block dirty bitmap information.
481 # @name: the name of the dirty bitmap (Since 2.4)
483 # @count: number of dirty bytes according to the dirty bitmap
485 # @granularity: granularity of the dirty bitmap in bytes (since 1.4)
487 # @status: current status of the dirty bitmap (since 2.4)
489 # @recording: true if the bitmap is recording new writes from the guest.
490 # Replaces `active` and `disabled` statuses. (since 4.0)
492 # @busy: true if the bitmap is in-use by some operation (NBD or jobs)
493 # and cannot be modified via QMP or used by another operation.
494 # Replaces `locked` and `frozen` statuses. (since 4.0)
496 # @persistent: true if the bitmap was stored on disk, is scheduled to be stored
497 # on disk, or both. (since 4.0)
499 # @inconsistent: true if this is a persistent bitmap that was improperly
500 # stored. Implies @persistent to be true; @recording and
501 # @busy to be false. This bitmap cannot be used. To remove
502 # it, use @block-dirty-bitmap-remove. (Since 4.0)
505 # @deprecated: Member @status is deprecated. Use @recording and
510 { 'struct': 'BlockDirtyInfo',
511 'data': {'*name': 'str', 'count': 'int', 'granularity': 'uint32',
512 'recording': 'bool', 'busy': 'bool',
513 'status': { 'type': 'DirtyBitmapStatus',
514 'features': [ 'deprecated' ] },
515 'persistent': 'bool', '*inconsistent': 'bool' } }
518 # @Qcow2BitmapInfoFlags:
520 # An enumeration of flags that a bitmap can report to the user.
522 # @in-use: This flag is set by any process actively modifying the qcow2 file,
523 # and cleared when the updated bitmap is flushed to the qcow2 image.
524 # The presence of this flag in an offline image means that the bitmap
525 # was not saved correctly after its last usage, and may contain
528 # @auto: The bitmap must reflect all changes of the virtual disk by any
529 # application that would write to this qcow2 file.
533 { 'enum': 'Qcow2BitmapInfoFlags',
534 'data': ['in-use', 'auto'] }
539 # Qcow2 bitmap information.
541 # @name: the name of the bitmap
543 # @granularity: granularity of the bitmap in bytes
545 # @flags: flags of the bitmap
549 { 'struct': 'Qcow2BitmapInfo',
550 'data': {'name': 'str', 'granularity': 'uint32',
551 'flags': ['Qcow2BitmapInfoFlags'] } }
554 # @BlockLatencyHistogramInfo:
556 # Block latency histogram.
558 # @boundaries: list of interval boundary values in nanoseconds, all greater
559 # than zero and in ascending order.
560 # For example, the list [10, 50, 100] produces the following
561 # histogram intervals: [0, 10), [10, 50), [50, 100), [100, +inf).
563 # @bins: list of io request counts corresponding to histogram intervals.
564 # len(@bins) = len(@boundaries) + 1
565 # For the example above, @bins may be something like [3, 1, 5, 2],
566 # and corresponding histogram looks like:
573 # | +------------------
578 { 'struct': 'BlockLatencyHistogramInfo',
579 'data': {'boundaries': ['uint64'], 'bins': ['uint64'] } }
584 # Block device information. This structure describes a virtual device and
585 # the backing device associated with it.
587 # @device: The device name associated with the virtual device.
589 # @qdev: The qdev ID, or if no ID is assigned, the QOM path of the block
590 # device. (since 2.10)
592 # @type: This field is returned only for compatibility reasons, it should
593 # not be used (always returns 'unknown')
595 # @removable: True if the device supports removable media.
597 # @locked: True if the guest has locked this device from having its media
600 # @tray_open: True if the device's tray is open
601 # (only present if it has a tray)
603 # @dirty-bitmaps: dirty bitmaps information (only present if the
604 # driver has one or more dirty bitmaps) (Since 2.0)
606 # @io-status: @BlockDeviceIoStatus. Only present if the device
607 # supports it and the VM is configured to stop on errors
608 # (supported device models: virtio-blk, IDE, SCSI except
611 # @inserted: @BlockDeviceInfo describing the device if media is
615 # @deprecated: Member @dirty-bitmaps is deprecated. Use @inserted
616 # member @dirty-bitmaps instead.
620 { 'struct': 'BlockInfo',
621 'data': {'device': 'str', '*qdev': 'str', 'type': 'str', 'removable': 'bool',
622 'locked': 'bool', '*inserted': 'BlockDeviceInfo',
623 '*tray_open': 'bool', '*io-status': 'BlockDeviceIoStatus',
624 '*dirty-bitmaps': { 'type': ['BlockDirtyInfo'],
625 'features': [ 'deprecated' ] } } }
630 # Image file size calculation information. This structure describes the size
631 # requirements for creating a new image file.
633 # The size requirements depend on the new image file format. File size always
634 # equals virtual disk size for the 'raw' format, even for sparse POSIX files.
635 # Compact formats such as 'qcow2' represent unallocated and zero regions
636 # efficiently so file size may be smaller than virtual disk size.
638 # The values are upper bounds that are guaranteed to fit the new image file.
639 # Subsequent modification, such as internal snapshot or further bitmap
640 # creation, may require additional space and is not covered here.
642 # @required: Size required for a new image file, in bytes, when copying just
643 # allocated guest-visible contents.
645 # @fully-allocated: Image file size, in bytes, once data has been written
646 # to all sectors, when copying just guest-visible contents.
648 # @bitmaps: Additional size required if all the top-level bitmap metadata
649 # in the source image were to be copied to the destination,
650 # present only when source and destination both support
651 # persistent bitmaps. (since 5.1)
655 { 'struct': 'BlockMeasureInfo',
656 'data': {'required': 'int', 'fully-allocated': 'int', '*bitmaps': 'int'} }
661 # Get a list of BlockInfo for all virtual block devices.
663 # Returns: a list of @BlockInfo describing each virtual block device. Filter
664 # nodes that were created implicitly are skipped over.
670 # -> { "execute": "query-block" }
675 # "device":"ide0-hd0",
682 # "file":"disks/test.qcow2",
683 # "backing_file_depth":1,
690 # "bps_max": 8000000,
697 # "detect_zeroes": "on",
698 # "write_threshold": 0,
700 # "filename":"disks/test.qcow2",
702 # "virtual-size":2048000,
703 # "backing_file":"base.qcow2",
704 # "full-backing-filename":"disks/base.qcow2",
705 # "backing-filename-format":"qcow2",
709 # "name": "snapshot1",
710 # "vm-state-size": 0,
711 # "date-sec": 10000200,
713 # "vm-clock-sec": 206,
714 # "vm-clock-nsec": 30
718 # "filename":"disks/base.qcow2",
720 # "virtual-size":2048000
724 # "qdev": "ide_disk",
729 # "device":"ide1-cd0",
732 # "qdev": "/machine/unattached/device[23]",
733 # "tray_open": false,
737 # "device":"floppy0",
740 # "qdev": "/machine/unattached/device[20]",
753 { 'command': 'query-block', 'returns': ['BlockInfo'] }
757 # @BlockDeviceTimedStats:
759 # Statistics of a block device during a given interval of time.
761 # @interval_length: Interval used for calculating the statistics,
764 # @min_rd_latency_ns: Minimum latency of read operations in the
765 # defined interval, in nanoseconds.
767 # @min_wr_latency_ns: Minimum latency of write operations in the
768 # defined interval, in nanoseconds.
770 # @min_flush_latency_ns: Minimum latency of flush operations in the
771 # defined interval, in nanoseconds.
773 # @max_rd_latency_ns: Maximum latency of read operations in the
774 # defined interval, in nanoseconds.
776 # @max_wr_latency_ns: Maximum latency of write operations in the
777 # defined interval, in nanoseconds.
779 # @max_flush_latency_ns: Maximum latency of flush operations in the
780 # defined interval, in nanoseconds.
782 # @avg_rd_latency_ns: Average latency of read operations in the
783 # defined interval, in nanoseconds.
785 # @avg_wr_latency_ns: Average latency of write operations in the
786 # defined interval, in nanoseconds.
788 # @avg_flush_latency_ns: Average latency of flush operations in the
789 # defined interval, in nanoseconds.
791 # @avg_rd_queue_depth: Average number of pending read operations
792 # in the defined interval.
794 # @avg_wr_queue_depth: Average number of pending write operations
795 # in the defined interval.
799 { 'struct': 'BlockDeviceTimedStats',
800 'data': { 'interval_length': 'int', 'min_rd_latency_ns': 'int',
801 'max_rd_latency_ns': 'int', 'avg_rd_latency_ns': 'int',
802 'min_wr_latency_ns': 'int', 'max_wr_latency_ns': 'int',
803 'avg_wr_latency_ns': 'int', 'min_flush_latency_ns': 'int',
804 'max_flush_latency_ns': 'int', 'avg_flush_latency_ns': 'int',
805 'avg_rd_queue_depth': 'number', 'avg_wr_queue_depth': 'number' } }
810 # Statistics of a virtual block device or a block backing device.
812 # @rd_bytes: The number of bytes read by the device.
814 # @wr_bytes: The number of bytes written by the device.
816 # @unmap_bytes: The number of bytes unmapped by the device (Since 4.2)
818 # @rd_operations: The number of read operations performed by the device.
820 # @wr_operations: The number of write operations performed by the device.
822 # @flush_operations: The number of cache flush operations performed by the
823 # device (since 0.15.0)
825 # @unmap_operations: The number of unmap operations performed by the device
828 # @rd_total_time_ns: Total time spent on reads in nanoseconds (since 0.15.0).
830 # @wr_total_time_ns: Total time spent on writes in nanoseconds (since 0.15.0).
832 # @flush_total_time_ns: Total time spent on cache flushes in nanoseconds
835 # @unmap_total_time_ns: Total time spent on unmap operations in nanoseconds
838 # @wr_highest_offset: The offset after the greatest byte written to the
839 # device. The intended use of this information is for
840 # growable sparse files (like qcow2) that are used on top
841 # of a physical device.
843 # @rd_merged: Number of read requests that have been merged into another
844 # request (Since 2.3).
846 # @wr_merged: Number of write requests that have been merged into another
847 # request (Since 2.3).
849 # @unmap_merged: Number of unmap requests that have been merged into another
850 # request (Since 4.2)
852 # @idle_time_ns: Time since the last I/O operation, in
853 # nanoseconds. If the field is absent it means that
854 # there haven't been any operations yet (Since 2.5).
856 # @failed_rd_operations: The number of failed read operations
857 # performed by the device (Since 2.5)
859 # @failed_wr_operations: The number of failed write operations
860 # performed by the device (Since 2.5)
862 # @failed_flush_operations: The number of failed flush operations
863 # performed by the device (Since 2.5)
865 # @failed_unmap_operations: The number of failed unmap operations performed
866 # by the device (Since 4.2)
868 # @invalid_rd_operations: The number of invalid read operations
869 # performed by the device (Since 2.5)
871 # @invalid_wr_operations: The number of invalid write operations
872 # performed by the device (Since 2.5)
874 # @invalid_flush_operations: The number of invalid flush operations
875 # performed by the device (Since 2.5)
877 # @invalid_unmap_operations: The number of invalid unmap operations performed
878 # by the device (Since 4.2)
880 # @account_invalid: Whether invalid operations are included in the
881 # last access statistics (Since 2.5)
883 # @account_failed: Whether failed operations are included in the
884 # latency and last access statistics (Since 2.5)
886 # @timed_stats: Statistics specific to the set of previously defined
887 # intervals of time (Since 2.5)
889 # @rd_latency_histogram: @BlockLatencyHistogramInfo. (Since 4.0)
891 # @wr_latency_histogram: @BlockLatencyHistogramInfo. (Since 4.0)
893 # @flush_latency_histogram: @BlockLatencyHistogramInfo. (Since 4.0)
897 { 'struct': 'BlockDeviceStats',
898 'data': {'rd_bytes': 'int', 'wr_bytes': 'int', 'unmap_bytes' : 'int',
899 'rd_operations': 'int', 'wr_operations': 'int',
900 'flush_operations': 'int', 'unmap_operations': 'int',
901 'rd_total_time_ns': 'int', 'wr_total_time_ns': 'int',
902 'flush_total_time_ns': 'int', 'unmap_total_time_ns': 'int',
903 'wr_highest_offset': 'int',
904 'rd_merged': 'int', 'wr_merged': 'int', 'unmap_merged': 'int',
905 '*idle_time_ns': 'int',
906 'failed_rd_operations': 'int', 'failed_wr_operations': 'int',
907 'failed_flush_operations': 'int', 'failed_unmap_operations': 'int',
908 'invalid_rd_operations': 'int', 'invalid_wr_operations': 'int',
909 'invalid_flush_operations': 'int', 'invalid_unmap_operations': 'int',
910 'account_invalid': 'bool', 'account_failed': 'bool',
911 'timed_stats': ['BlockDeviceTimedStats'],
912 '*rd_latency_histogram': 'BlockLatencyHistogramInfo',
913 '*wr_latency_histogram': 'BlockLatencyHistogramInfo',
914 '*flush_latency_histogram': 'BlockLatencyHistogramInfo' } }
917 # @BlockStatsSpecificFile:
919 # File driver statistics
921 # @discard-nb-ok: The number of successful discard operations performed by
924 # @discard-nb-failed: The number of failed discard operations performed by
927 # @discard-bytes-ok: The number of bytes discarded by the driver.
931 { 'struct': 'BlockStatsSpecificFile',
933 'discard-nb-ok': 'uint64',
934 'discard-nb-failed': 'uint64',
935 'discard-bytes-ok': 'uint64' } }
938 # @BlockStatsSpecific:
940 # Block driver specific statistics
944 { 'union': 'BlockStatsSpecific',
945 'base': { 'driver': 'BlockdevDriver' },
946 'discriminator': 'driver',
948 'file': 'BlockStatsSpecificFile',
949 'host_device': 'BlockStatsSpecificFile' } }
954 # Statistics of a virtual block device or a block backing device.
956 # @device: If the stats are for a virtual block device, the name
957 # corresponding to the virtual block device.
959 # @node-name: The node name of the device. (Since 2.3)
961 # @qdev: The qdev ID, or if no ID is assigned, the QOM path of the block
962 # device. (since 3.0)
964 # @stats: A @BlockDeviceStats for the device.
966 # @driver-specific: Optional driver-specific stats. (Since 4.2)
968 # @parent: This describes the file block device if it has one.
969 # Contains recursively the statistics of the underlying
970 # protocol (e.g. the host file for a qcow2 image). If there is
971 # no underlying protocol, this field is omitted
973 # @backing: This describes the backing block device if it has one.
978 { 'struct': 'BlockStats',
979 'data': {'*device': 'str', '*qdev': 'str', '*node-name': 'str',
980 'stats': 'BlockDeviceStats',
981 '*driver-specific': 'BlockStatsSpecific',
982 '*parent': 'BlockStats',
983 '*backing': 'BlockStats'} }
988 # Query the @BlockStats for all virtual block devices.
990 # @query-nodes: If true, the command will query all the block nodes
991 # that have a node name, in a list which will include "parent"
992 # information, but not "backing".
993 # If false or omitted, the behavior is as before - query all the
994 # device backends, recursively including their "parent" and
995 # "backing". Filter nodes that were created implicitly are
996 # skipped over in this mode. (Since 2.3)
998 # Returns: A list of @BlockStats for each virtual block devices.
1004 # -> { "execute": "query-blockstats" }
1008 # "device":"ide0-hd0",
1011 # "wr_highest_offset":3686448128,
1012 # "wr_bytes":9786368,
1013 # "wr_operations":751,
1014 # "rd_bytes":122567168,
1015 # "rd_operations":36772
1016 # "wr_total_times_ns":313253456
1017 # "rd_total_times_ns":3465673657
1018 # "flush_total_times_ns":49653
1019 # "flush_operations":61,
1022 # "idle_time_ns":2953431879,
1023 # "account_invalid":true,
1024 # "account_failed":false
1028 # "wr_highest_offset":2821110784,
1029 # "wr_bytes":9786368,
1030 # "wr_operations":692,
1031 # "rd_bytes":122739200,
1032 # "rd_operations":36604
1033 # "flush_operations":51,
1034 # "wr_total_times_ns":313253456
1035 # "rd_total_times_ns":3465673657
1036 # "flush_total_times_ns":49653,
1039 # "idle_time_ns":2953431879,
1040 # "account_invalid":true,
1041 # "account_failed":false
1043 # "qdev": "/machine/unattached/device[23]"
1046 # "device":"ide1-cd0",
1048 # "wr_highest_offset":0,
1050 # "wr_operations":0,
1053 # "flush_operations":0,
1054 # "wr_total_times_ns":0
1055 # "rd_total_times_ns":0
1056 # "flush_total_times_ns":0,
1059 # "account_invalid":false,
1060 # "account_failed":false
1062 # "qdev": "/machine/unattached/device[24]"
1065 # "device":"floppy0",
1067 # "wr_highest_offset":0,
1069 # "wr_operations":0,
1072 # "flush_operations":0,
1073 # "wr_total_times_ns":0
1074 # "rd_total_times_ns":0
1075 # "flush_total_times_ns":0,
1078 # "account_invalid":false,
1079 # "account_failed":false
1081 # "qdev": "/machine/unattached/device[16]"
1086 # "wr_highest_offset":0,
1088 # "wr_operations":0,
1091 # "flush_operations":0,
1092 # "wr_total_times_ns":0
1093 # "rd_total_times_ns":0
1094 # "flush_total_times_ns":0,
1097 # "account_invalid":false,
1098 # "account_failed":false
1105 { 'command': 'query-blockstats',
1106 'data': { '*query-nodes': 'bool' },
1107 'returns': ['BlockStats'] }
1112 # An enumeration of possible behaviors for errors on I/O operations.
1113 # The exact meaning depends on whether the I/O was initiated by a guest
1116 # @report: for guest operations, report the error to the guest;
1117 # for jobs, cancel the job
1119 # @ignore: ignore the error, only report a QMP event (BLOCK_IO_ERROR
1120 # or BLOCK_JOB_ERROR). The backup, mirror and commit block jobs retry
1121 # the failing request later and may still complete successfully. The
1122 # stream block job continues to stream and will complete with an
1125 # @enospc: same as @stop on ENOSPC, same as @report otherwise.
1127 # @stop: for guest operations, stop the virtual machine;
1128 # for jobs, pause the job
1130 # @auto: inherit the error handling policy of the backend (since: 2.7)
1134 { 'enum': 'BlockdevOnError',
1135 'data': ['report', 'ignore', 'enospc', 'stop', 'auto'] }
1140 # An enumeration of possible behaviors for the initial synchronization
1141 # phase of storage mirroring.
1143 # @top: copies data in the topmost image to the destination
1145 # @full: copies data from all images to the destination
1147 # @none: only copy data written from now on
1149 # @incremental: only copy data described by the dirty bitmap. (since: 2.4)
1151 # @bitmap: only copy data described by the dirty bitmap. (since: 4.2)
1152 # Behavior on completion is determined by the BitmapSyncMode.
1156 { 'enum': 'MirrorSyncMode',
1157 'data': ['top', 'full', 'none', 'incremental', 'bitmap'] }
1162 # An enumeration of possible behaviors for the synchronization of a bitmap
1163 # when used for data copy operations.
1165 # @on-success: The bitmap is only synced when the operation is successful.
1166 # This is the behavior always used for 'INCREMENTAL' backups.
1168 # @never: The bitmap is never synchronized with the operation, and is
1169 # treated solely as a read-only manifest of blocks to copy.
1171 # @always: The bitmap is always synchronized with the operation,
1172 # regardless of whether or not the operation was successful.
1176 { 'enum': 'BitmapSyncMode',
1177 'data': ['on-success', 'never', 'always'] }
1182 # An enumeration whose values tell the mirror block job when to
1183 # trigger writes to the target.
1185 # @background: copy data in background only.
1187 # @write-blocking: when data is written to the source, write it
1188 # (synchronously) to the target as well. In
1189 # addition, data is copied in background just like in
1194 { 'enum': 'MirrorCopyMode',
1195 'data': ['background', 'write-blocking'] }
1200 # Information about a long-running block device operation.
1202 # @type: the job type ('stream' for image streaming)
1204 # @device: The job identifier. Originally the device name but other
1205 # values are allowed since QEMU 2.7
1207 # @len: Estimated @offset value at the completion of the job. This value can
1208 # arbitrarily change while the job is running, in both directions.
1210 # @offset: Progress made until now. The unit is arbitrary and the value can
1211 # only meaningfully be used for the ratio of @offset to @len. The
1212 # value is monotonically increasing.
1214 # @busy: false if the job is known to be in a quiescent state, with
1215 # no pending I/O. Since 1.3.
1217 # @paused: whether the job is paused or, if @busy is true, will
1218 # pause itself as soon as possible. Since 1.3.
1220 # @speed: the rate limit, bytes per second
1222 # @io-status: the status of the job (since 1.3)
1224 # @ready: true if the job may be completed (since 2.2)
1226 # @status: Current job state/status (since 2.12)
1228 # @auto-finalize: Job will finalize itself when PENDING, moving to
1229 # the CONCLUDED state. (since 2.12)
1231 # @auto-dismiss: Job will dismiss itself when CONCLUDED, moving to the NULL
1232 # state and disappearing from the query list. (since 2.12)
1234 # @error: Error information if the job did not complete successfully.
1235 # Not set if the job completed successfully. (since 2.12.1)
1239 { 'struct': 'BlockJobInfo',
1240 'data': {'type': 'str', 'device': 'str', 'len': 'int',
1241 'offset': 'int', 'busy': 'bool', 'paused': 'bool', 'speed': 'int',
1242 'io-status': 'BlockDeviceIoStatus', 'ready': 'bool',
1243 'status': 'JobStatus',
1244 'auto-finalize': 'bool', 'auto-dismiss': 'bool',
1248 # @query-block-jobs:
1250 # Return information about long-running block device operations.
1252 # Returns: a list of @BlockJobInfo for each active block job
1256 { 'command': 'query-block-jobs', 'returns': ['BlockJobInfo'] }
1261 # This command sets the password of a block device that has not been open
1262 # with a password and requires one.
1264 # This command is now obsolete and will always return an error since 2.10
1267 { 'command': 'block_passwd',
1268 'data': { '*device': 'str',
1269 '*node-name': 'str',
1270 'password': 'str' } }
1275 # Resize a block image while a guest is running.
1277 # Either @device or @node-name must be set but not both.
1279 # @device: the name of the device to get the image resized
1281 # @node-name: graph node name to get the image resized (Since 2.0)
1283 # @size: new image size in bytes
1285 # Returns: - nothing on success
1286 # - If @device is not a valid block device, DeviceNotFound
1292 # -> { "execute": "block_resize",
1293 # "arguments": { "device": "scratch", "size": 1073741824 } }
1294 # <- { "return": {} }
1297 { 'command': 'block_resize',
1298 'data': { '*device': 'str',
1299 '*node-name': 'str',
1305 # An enumeration that tells QEMU how to set the backing file path in
1308 # @existing: QEMU should look for an existing image file.
1310 # @absolute-paths: QEMU should create a new image with absolute paths
1311 # for the backing file. If there is no backing file available, the new
1312 # image will not be backed either.
1316 { 'enum': 'NewImageMode',
1317 'data': [ 'existing', 'absolute-paths' ] }
1320 # @BlockdevSnapshotSync:
1322 # Either @device or @node-name must be set but not both.
1324 # @device: the name of the device to take a snapshot of.
1326 # @node-name: graph node name to generate the snapshot from (Since 2.0)
1328 # @snapshot-file: the target of the new overlay image. If the file
1329 # exists, or if it is a device, the overlay will be created in the
1330 # existing file/device. Otherwise, a new file will be created.
1332 # @snapshot-node-name: the graph node name of the new image (Since 2.0)
1334 # @format: the format of the overlay image, default is 'qcow2'.
1336 # @mode: whether and how QEMU should create a new image, default is
1339 { 'struct': 'BlockdevSnapshotSync',
1340 'data': { '*device': 'str', '*node-name': 'str',
1341 'snapshot-file': 'str', '*snapshot-node-name': 'str',
1342 '*format': 'str', '*mode': 'NewImageMode' } }
1345 # @BlockdevSnapshot:
1347 # @node: device or node name that will have a snapshot taken.
1349 # @overlay: reference to the existing block device that will become
1350 # the overlay of @node, as part of taking the snapshot.
1351 # It must not have a current backing file (this can be
1352 # achieved by passing "backing": null to blockdev-add).
1356 { 'struct': 'BlockdevSnapshot',
1357 'data': { 'node': 'str', 'overlay': 'str' } }
1362 # @job-id: identifier for the newly-created block job. If
1363 # omitted, the device name will be used. (Since 2.7)
1365 # @device: the device name or node-name of a root node which should be copied.
1367 # @sync: what parts of the disk image should be copied to the destination
1368 # (all the disk, only the sectors allocated in the topmost image, from a
1369 # dirty bitmap, or only new I/O).
1371 # @speed: the maximum speed, in bytes per second. The default is 0,
1374 # @bitmap: The name of a dirty bitmap to use.
1375 # Must be present if sync is "bitmap" or "incremental".
1376 # Can be present if sync is "full" or "top".
1377 # Must not be present otherwise.
1378 # (Since 2.4 (drive-backup), 3.1 (blockdev-backup))
1380 # @bitmap-mode: Specifies the type of data the bitmap should contain after
1381 # the operation concludes.
1382 # Must be present if a bitmap was provided,
1383 # Must NOT be present otherwise. (Since 4.2)
1385 # @compress: true to compress data, if the target format supports it.
1386 # (default: false) (since 2.8)
1388 # @on-source-error: the action to take on an error on the source,
1389 # default 'report'. 'stop' and 'enospc' can only be used
1390 # if the block device supports io-status (see BlockInfo).
1392 # @on-target-error: the action to take on an error on the target,
1393 # default 'report' (no limitations, since this applies to
1394 # a different block device than @device).
1396 # @auto-finalize: When false, this job will wait in a PENDING state after it has
1397 # finished its work, waiting for @block-job-finalize before
1398 # making any block graph changes.
1399 # When true, this job will automatically
1400 # perform its abort or commit actions.
1401 # Defaults to true. (Since 2.12)
1403 # @auto-dismiss: When false, this job will wait in a CONCLUDED state after it
1404 # has completely ceased all work, and awaits @block-job-dismiss.
1405 # When true, this job will automatically disappear from the query
1406 # list without user intervention.
1407 # Defaults to true. (Since 2.12)
1409 # @filter-node-name: the node name that should be assigned to the
1410 # filter driver that the backup job inserts into the graph
1411 # above node specified by @drive. If this option is not given,
1412 # a node name is autogenerated. (Since: 4.2)
1414 # Note: @on-source-error and @on-target-error only affect background
1415 # I/O. If an error occurs during a guest write request, the device's
1416 # rerror/werror actions will be used.
1420 { 'struct': 'BackupCommon',
1421 'data': { '*job-id': 'str', 'device': 'str',
1422 'sync': 'MirrorSyncMode', '*speed': 'int',
1423 '*bitmap': 'str', '*bitmap-mode': 'BitmapSyncMode',
1424 '*compress': 'bool',
1425 '*on-source-error': 'BlockdevOnError',
1426 '*on-target-error': 'BlockdevOnError',
1427 '*auto-finalize': 'bool', '*auto-dismiss': 'bool',
1428 '*filter-node-name': 'str' } }
1433 # @target: the target of the new image. If the file exists, or if it
1434 # is a device, the existing file/device will be used as the new
1435 # destination. If it does not exist, a new file will be created.
1437 # @format: the format of the new destination, default is to
1438 # probe if @mode is 'existing', else the format of the source
1440 # @mode: whether and how QEMU should create a new image, default is
1445 { 'struct': 'DriveBackup',
1446 'base': 'BackupCommon',
1447 'data': { 'target': 'str',
1449 '*mode': 'NewImageMode' } }
1454 # @target: the device name or node-name of the backup target node.
1458 { 'struct': 'BlockdevBackup',
1459 'base': 'BackupCommon',
1460 'data': { 'target': 'str' } }
1463 # @blockdev-snapshot-sync:
1465 # Takes a synchronous snapshot of a block device.
1467 # For the arguments, see the documentation of BlockdevSnapshotSync.
1469 # Returns: - nothing on success
1470 # - If @device is not a valid block device, DeviceNotFound
1476 # -> { "execute": "blockdev-snapshot-sync",
1477 # "arguments": { "device": "ide-hd0",
1479 # "/some/place/my-image",
1480 # "format": "qcow2" } }
1481 # <- { "return": {} }
1484 { 'command': 'blockdev-snapshot-sync',
1485 'data': 'BlockdevSnapshotSync' }
1489 # @blockdev-snapshot:
1491 # Takes a snapshot of a block device.
1493 # Take a snapshot, by installing 'node' as the backing image of
1494 # 'overlay'. Additionally, if 'node' is associated with a block
1495 # device, the block device changes to using 'overlay' as its new active
1498 # For the arguments, see the documentation of BlockdevSnapshot.
1501 # @allow-write-only-overlay: If present, the check whether this operation is safe
1502 # was relaxed so that it can be used to change
1503 # backing file of a destination of a blockdev-mirror.
1510 # -> { "execute": "blockdev-add",
1511 # "arguments": { "driver": "qcow2",
1512 # "node-name": "node1534",
1513 # "file": { "driver": "file",
1514 # "filename": "hd1.qcow2" },
1515 # "backing": null } }
1517 # <- { "return": {} }
1519 # -> { "execute": "blockdev-snapshot",
1520 # "arguments": { "node": "ide-hd0",
1521 # "overlay": "node1534" } }
1522 # <- { "return": {} }
1525 { 'command': 'blockdev-snapshot',
1526 'data': 'BlockdevSnapshot',
1527 'features': [ 'allow-write-only-overlay' ] }
1530 # @change-backing-file:
1532 # Change the backing file in the image file metadata. This does not
1533 # cause QEMU to reopen the image file to reparse the backing filename
1534 # (it may, however, perform a reopen to change permissions from
1535 # r/o -> r/w -> r/o, if needed). The new backing file string is written
1536 # into the image file metadata, and the QEMU internal strings are
1539 # @image-node-name: The name of the block driver state node of the
1540 # image to modify. The "device" argument is used
1541 # to verify "image-node-name" is in the chain
1542 # described by "device".
1544 # @device: The device name or node-name of the root node that owns
1547 # @backing-file: The string to write as the backing file. This
1548 # string is not validated, so care should be taken
1549 # when specifying the string or the image chain may
1550 # not be able to be reopened again.
1552 # Returns: - Nothing on success
1553 # - If "device" does not exist or cannot be determined, DeviceNotFound
1557 { 'command': 'change-backing-file',
1558 'data': { 'device': 'str', 'image-node-name': 'str',
1559 'backing-file': 'str' } }
1564 # Live commit of data from overlay image nodes into backing nodes - i.e.,
1565 # writes data between 'top' and 'base' into 'base'.
1567 # @job-id: identifier for the newly-created block job. If
1568 # omitted, the device name will be used. (Since 2.7)
1570 # @device: the device name or node-name of a root node
1572 # @base-node: The node name of the backing image to write data into.
1573 # If not specified, this is the deepest backing image.
1576 # @base: Same as @base-node, except that it is a file name rather than a node
1577 # name. This must be the exact filename string that was used to open the
1578 # node; other strings, even if addressing the same file, are not
1581 # @top-node: The node name of the backing image within the image chain
1582 # which contains the topmost data to be committed down. If
1583 # not specified, this is the active layer. (since: 3.1)
1585 # @top: Same as @top-node, except that it is a file name rather than a node
1586 # name. This must be the exact filename string that was used to open the
1587 # node; other strings, even if addressing the same file, are not
1590 # @backing-file: The backing file string to write into the overlay
1591 # image of 'top'. If 'top' is the active layer,
1592 # specifying a backing file string is an error. This
1593 # filename is not validated.
1595 # If a pathname string is such that it cannot be
1596 # resolved by QEMU, that means that subsequent QMP or
1597 # HMP commands must use node-names for the image in
1598 # question, as filename lookup methods will fail.
1600 # If not specified, QEMU will automatically determine
1601 # the backing file string to use, or error out if
1602 # there is no obvious choice. Care should be taken
1603 # when specifying the string, to specify a valid
1604 # filename or protocol.
1607 # If top == base, that is an error.
1608 # If top == active, the job will not be completed by itself,
1609 # user needs to complete the job with the block-job-complete
1610 # command after getting the ready event. (Since 2.0)
1612 # If the base image is smaller than top, then the base image
1613 # will be resized to be the same size as top. If top is
1614 # smaller than the base image, the base will not be
1615 # truncated. If you want the base image size to match the
1616 # size of the smaller top, you can safely truncate it
1617 # yourself once the commit operation successfully completes.
1619 # @speed: the maximum speed, in bytes per second
1621 # @on-error: the action to take on an error. 'ignore' means that the request
1622 # should be retried. (default: report; Since: 5.0)
1624 # @filter-node-name: the node name that should be assigned to the
1625 # filter driver that the commit job inserts into the graph
1626 # above @top. If this option is not given, a node name is
1627 # autogenerated. (Since: 2.9)
1629 # @auto-finalize: When false, this job will wait in a PENDING state after it has
1630 # finished its work, waiting for @block-job-finalize before
1631 # making any block graph changes.
1632 # When true, this job will automatically
1633 # perform its abort or commit actions.
1634 # Defaults to true. (Since 3.1)
1636 # @auto-dismiss: When false, this job will wait in a CONCLUDED state after it
1637 # has completely ceased all work, and awaits @block-job-dismiss.
1638 # When true, this job will automatically disappear from the query
1639 # list without user intervention.
1640 # Defaults to true. (Since 3.1)
1643 # @deprecated: Members @base and @top are deprecated. Use @base-node
1644 # and @top-node instead.
1646 # Returns: - Nothing on success
1647 # - If @device does not exist, DeviceNotFound
1648 # - Any other error returns a GenericError.
1654 # -> { "execute": "block-commit",
1655 # "arguments": { "device": "virtio0",
1656 # "top": "/tmp/snap1.qcow2" } }
1657 # <- { "return": {} }
1660 { 'command': 'block-commit',
1661 'data': { '*job-id': 'str', 'device': 'str', '*base-node': 'str',
1662 '*base': { 'type': 'str', 'features': [ 'deprecated' ] },
1664 '*top': { 'type': 'str', 'features': [ 'deprecated' ] },
1665 '*backing-file': 'str', '*speed': 'int',
1666 '*on-error': 'BlockdevOnError',
1667 '*filter-node-name': 'str',
1668 '*auto-finalize': 'bool', '*auto-dismiss': 'bool' } }
1673 # Start a point-in-time copy of a block device to a new destination. The
1674 # status of ongoing drive-backup operations can be checked with
1675 # query-block-jobs where the BlockJobInfo.type field has the value 'backup'.
1676 # The operation can be stopped before it has completed using the
1677 # block-job-cancel command.
1679 # Returns: - nothing on success
1680 # - If @device is not a valid block device, GenericError
1686 # -> { "execute": "drive-backup",
1687 # "arguments": { "device": "drive0",
1689 # "target": "backup.img" } }
1690 # <- { "return": {} }
1693 { 'command': 'drive-backup', 'boxed': true,
1694 'data': 'DriveBackup' }
1699 # Start a point-in-time copy of a block device to a new destination. The
1700 # status of ongoing blockdev-backup operations can be checked with
1701 # query-block-jobs where the BlockJobInfo.type field has the value 'backup'.
1702 # The operation can be stopped before it has completed using the
1703 # block-job-cancel command.
1705 # Returns: - nothing on success
1706 # - If @device is not a valid block device, DeviceNotFound
1711 # -> { "execute": "blockdev-backup",
1712 # "arguments": { "device": "src-id",
1714 # "target": "tgt-id" } }
1715 # <- { "return": {} }
1718 { 'command': 'blockdev-backup', 'boxed': true,
1719 'data': 'BlockdevBackup' }
1723 # @query-named-block-nodes:
1725 # Get the named block driver list
1727 # @flat: Omit the nested data about backing image ("backing-image" key) if true.
1728 # Default is false (Since 5.0)
1730 # Returns: the list of BlockDeviceInfo
1736 # -> { "execute": "query-named-block-nodes" }
1737 # <- { "return": [ { "ro":false,
1739 # "encrypted":false,
1740 # "file":"disks/test.qcow2",
1741 # "node-name": "my-node",
1742 # "backing_file_depth":1,
1749 # "bps_max": 8000000,
1756 # "write_threshold": 0,
1758 # "filename":"disks/test.qcow2",
1760 # "virtual-size":2048000,
1761 # "backing_file":"base.qcow2",
1762 # "full-backing-filename":"disks/base.qcow2",
1763 # "backing-filename-format":"qcow2",
1767 # "name": "snapshot1",
1768 # "vm-state-size": 0,
1769 # "date-sec": 10000200,
1771 # "vm-clock-sec": 206,
1772 # "vm-clock-nsec": 30
1776 # "filename":"disks/base.qcow2",
1778 # "virtual-size":2048000
1783 { 'command': 'query-named-block-nodes',
1784 'returns': [ 'BlockDeviceInfo' ],
1785 'data': { '*flat': 'bool' } }
1788 # @XDbgBlockGraphNodeType:
1790 # @block-backend: corresponds to BlockBackend
1792 # @block-job: corresonds to BlockJob
1794 # @block-driver: corresponds to BlockDriverState
1798 { 'enum': 'XDbgBlockGraphNodeType',
1799 'data': [ 'block-backend', 'block-job', 'block-driver' ] }
1802 # @XDbgBlockGraphNode:
1804 # @id: Block graph node identifier. This @id is generated only for
1805 # x-debug-query-block-graph and does not relate to any other identifiers in
1808 # @type: Type of graph node. Can be one of block-backend, block-job or
1809 # block-driver-state.
1811 # @name: Human readable name of the node. Corresponds to node-name for
1812 # block-driver-state nodes; is not guaranteed to be unique in the whole
1813 # graph (with block-jobs and block-backends).
1817 { 'struct': 'XDbgBlockGraphNode',
1818 'data': { 'id': 'uint64', 'type': 'XDbgBlockGraphNodeType', 'name': 'str' } }
1823 # Enum of base block permissions.
1825 # @consistent-read: A user that has the "permission" of consistent reads is
1826 # guaranteed that their view of the contents of the block
1827 # device is complete and self-consistent, representing the
1828 # contents of a disk at a specific point.
1829 # For most block devices (including their backing files) this
1830 # is true, but the property cannot be maintained in a few
1831 # situations like for intermediate nodes of a commit block
1834 # @write: This permission is required to change the visible disk contents.
1836 # @write-unchanged: This permission (which is weaker than BLK_PERM_WRITE) is
1837 # both enough and required for writes to the block node when
1838 # the caller promises that the visible disk content doesn't
1840 # As the BLK_PERM_WRITE permission is strictly stronger,
1841 # either is sufficient to perform an unchanging write.
1843 # @resize: This permission is required to change the size of a block node.
1845 # @graph-mod: This permission is required to change the node that this
1846 # BdrvChild points to.
1850 { 'enum': 'BlockPermission',
1851 'data': [ 'consistent-read', 'write', 'write-unchanged', 'resize',
1854 # @XDbgBlockGraphEdge:
1856 # Block Graph edge description for x-debug-query-block-graph.
1858 # @parent: parent id
1862 # @name: name of the relation (examples are 'file' and 'backing')
1864 # @perm: granted permissions for the parent operating on the child
1866 # @shared-perm: permissions that can still be granted to other users of the
1867 # child while it is still attached to this parent
1871 { 'struct': 'XDbgBlockGraphEdge',
1872 'data': { 'parent': 'uint64', 'child': 'uint64',
1873 'name': 'str', 'perm': [ 'BlockPermission' ],
1874 'shared-perm': [ 'BlockPermission' ] } }
1879 # Block Graph - list of nodes and list of edges.
1883 { 'struct': 'XDbgBlockGraph',
1884 'data': { 'nodes': ['XDbgBlockGraphNode'], 'edges': ['XDbgBlockGraphEdge'] } }
1887 # @x-debug-query-block-graph:
1889 # Get the block graph.
1893 { 'command': 'x-debug-query-block-graph', 'returns': 'XDbgBlockGraph' }
1898 # Start mirroring a block device's writes to a new destination. target
1899 # specifies the target of the new image. If the file exists, or if it
1900 # is a device, it will be used as the new destination for writes. If
1901 # it does not exist, a new file will be created. format specifies the
1902 # format of the mirror image, default is to probe if mode='existing',
1903 # else the format of the source.
1905 # Returns: - nothing on success
1906 # - If @device is not a valid block device, GenericError
1912 # -> { "execute": "drive-mirror",
1913 # "arguments": { "device": "ide-hd0",
1914 # "target": "/some/place/my-image",
1916 # "format": "qcow2" } }
1917 # <- { "return": {} }
1920 { 'command': 'drive-mirror', 'boxed': true,
1921 'data': 'DriveMirror' }
1926 # A set of parameters describing drive mirror setup.
1928 # @job-id: identifier for the newly-created block job. If
1929 # omitted, the device name will be used. (Since 2.7)
1931 # @device: the device name or node-name of a root node whose writes should be
1934 # @target: the target of the new image. If the file exists, or if it
1935 # is a device, the existing file/device will be used as the new
1936 # destination. If it does not exist, a new file will be created.
1938 # @format: the format of the new destination, default is to
1939 # probe if @mode is 'existing', else the format of the source
1941 # @node-name: the new block driver state node name in the graph
1944 # @replaces: with sync=full graph node name to be replaced by the new
1945 # image when a whole image copy is done. This can be used to repair
1946 # broken Quorum files. (Since 2.1)
1948 # @mode: whether and how QEMU should create a new image, default is
1951 # @speed: the maximum speed, in bytes per second
1953 # @sync: what parts of the disk image should be copied to the destination
1954 # (all the disk, only the sectors allocated in the topmost image, or
1957 # @granularity: granularity of the dirty bitmap, default is 64K
1958 # if the image format doesn't have clusters, 4K if the clusters
1959 # are smaller than that, else the cluster size. Must be a
1960 # power of 2 between 512 and 64M (since 1.4).
1962 # @buf-size: maximum amount of data in flight from source to
1963 # target (since 1.4).
1965 # @on-source-error: the action to take on an error on the source,
1966 # default 'report'. 'stop' and 'enospc' can only be used
1967 # if the block device supports io-status (see BlockInfo).
1969 # @on-target-error: the action to take on an error on the target,
1970 # default 'report' (no limitations, since this applies to
1971 # a different block device than @device).
1972 # @unmap: Whether to try to unmap target sectors where source has
1973 # only zero. If true, and target unallocated sectors will read as zero,
1974 # target image sectors will be unmapped; otherwise, zeroes will be
1975 # written. Both will result in identical contents.
1976 # Default is true. (Since 2.4)
1978 # @copy-mode: when to copy data to the destination; defaults to 'background'
1981 # @auto-finalize: When false, this job will wait in a PENDING state after it has
1982 # finished its work, waiting for @block-job-finalize before
1983 # making any block graph changes.
1984 # When true, this job will automatically
1985 # perform its abort or commit actions.
1986 # Defaults to true. (Since 3.1)
1988 # @auto-dismiss: When false, this job will wait in a CONCLUDED state after it
1989 # has completely ceased all work, and awaits @block-job-dismiss.
1990 # When true, this job will automatically disappear from the query
1991 # list without user intervention.
1992 # Defaults to true. (Since 3.1)
1995 { 'struct': 'DriveMirror',
1996 'data': { '*job-id': 'str', 'device': 'str', 'target': 'str',
1997 '*format': 'str', '*node-name': 'str', '*replaces': 'str',
1998 'sync': 'MirrorSyncMode', '*mode': 'NewImageMode',
1999 '*speed': 'int', '*granularity': 'uint32',
2000 '*buf-size': 'int', '*on-source-error': 'BlockdevOnError',
2001 '*on-target-error': 'BlockdevOnError',
2002 '*unmap': 'bool', '*copy-mode': 'MirrorCopyMode',
2003 '*auto-finalize': 'bool', '*auto-dismiss': 'bool' } }
2006 # @BlockDirtyBitmap:
2008 # @node: name of device/node which the bitmap is tracking
2010 # @name: name of the dirty bitmap
2014 { 'struct': 'BlockDirtyBitmap',
2015 'data': { 'node': 'str', 'name': 'str' } }
2018 # @BlockDirtyBitmapAdd:
2020 # @node: name of device/node which the bitmap is tracking
2022 # @name: name of the dirty bitmap (must be less than 1024 bytes)
2024 # @granularity: the bitmap granularity, default is 64k for
2025 # block-dirty-bitmap-add
2027 # @persistent: the bitmap is persistent, i.e. it will be saved to the
2028 # corresponding block device image file on its close. For now only
2029 # Qcow2 disks support persistent bitmaps. Default is false for
2030 # block-dirty-bitmap-add. (Since: 2.10)
2032 # @disabled: the bitmap is created in the disabled state, which means that
2033 # it will not track drive changes. The bitmap may be enabled with
2034 # block-dirty-bitmap-enable. Default is false. (Since: 4.0)
2038 { 'struct': 'BlockDirtyBitmapAdd',
2039 'data': { 'node': 'str', 'name': 'str', '*granularity': 'uint32',
2040 '*persistent': 'bool', '*disabled': 'bool' } }
2043 # @BlockDirtyBitmapMergeSource:
2045 # @local: name of the bitmap, attached to the same node as target bitmap.
2047 # @external: bitmap with specified node
2051 { 'alternate': 'BlockDirtyBitmapMergeSource',
2052 'data': { 'local': 'str',
2053 'external': 'BlockDirtyBitmap' } }
2056 # @BlockDirtyBitmapMerge:
2058 # @node: name of device/node which the @target bitmap is tracking
2060 # @target: name of the destination dirty bitmap
2062 # @bitmaps: name(s) of the source dirty bitmap(s) at @node and/or fully
2063 # specifed BlockDirtyBitmap elements. The latter are supported
2068 { 'struct': 'BlockDirtyBitmapMerge',
2069 'data': { 'node': 'str', 'target': 'str',
2070 'bitmaps': ['BlockDirtyBitmapMergeSource'] } }
2073 # @block-dirty-bitmap-add:
2075 # Create a dirty bitmap with a name on the node, and start tracking the writes.
2077 # Returns: - nothing on success
2078 # - If @node is not a valid block device or node, DeviceNotFound
2079 # - If @name is already taken, GenericError with an explanation
2085 # -> { "execute": "block-dirty-bitmap-add",
2086 # "arguments": { "node": "drive0", "name": "bitmap0" } }
2087 # <- { "return": {} }
2090 { 'command': 'block-dirty-bitmap-add',
2091 'data': 'BlockDirtyBitmapAdd' }
2094 # @block-dirty-bitmap-remove:
2096 # Stop write tracking and remove the dirty bitmap that was created
2097 # with block-dirty-bitmap-add. If the bitmap is persistent, remove it from its
2100 # Returns: - nothing on success
2101 # - If @node is not a valid block device or node, DeviceNotFound
2102 # - If @name is not found, GenericError with an explanation
2103 # - if @name is frozen by an operation, GenericError
2109 # -> { "execute": "block-dirty-bitmap-remove",
2110 # "arguments": { "node": "drive0", "name": "bitmap0" } }
2111 # <- { "return": {} }
2114 { 'command': 'block-dirty-bitmap-remove',
2115 'data': 'BlockDirtyBitmap' }
2118 # @block-dirty-bitmap-clear:
2120 # Clear (reset) a dirty bitmap on the device, so that an incremental
2121 # backup from this point in time forward will only backup clusters
2122 # modified after this clear operation.
2124 # Returns: - nothing on success
2125 # - If @node is not a valid block device, DeviceNotFound
2126 # - If @name is not found, GenericError with an explanation
2132 # -> { "execute": "block-dirty-bitmap-clear",
2133 # "arguments": { "node": "drive0", "name": "bitmap0" } }
2134 # <- { "return": {} }
2137 { 'command': 'block-dirty-bitmap-clear',
2138 'data': 'BlockDirtyBitmap' }
2141 # @block-dirty-bitmap-enable:
2143 # Enables a dirty bitmap so that it will begin tracking disk changes.
2145 # Returns: - nothing on success
2146 # - If @node is not a valid block device, DeviceNotFound
2147 # - If @name is not found, GenericError with an explanation
2153 # -> { "execute": "block-dirty-bitmap-enable",
2154 # "arguments": { "node": "drive0", "name": "bitmap0" } }
2155 # <- { "return": {} }
2158 { 'command': 'block-dirty-bitmap-enable',
2159 'data': 'BlockDirtyBitmap' }
2162 # @block-dirty-bitmap-disable:
2164 # Disables a dirty bitmap so that it will stop tracking disk changes.
2166 # Returns: - nothing on success
2167 # - If @node is not a valid block device, DeviceNotFound
2168 # - If @name is not found, GenericError with an explanation
2174 # -> { "execute": "block-dirty-bitmap-disable",
2175 # "arguments": { "node": "drive0", "name": "bitmap0" } }
2176 # <- { "return": {} }
2179 { 'command': 'block-dirty-bitmap-disable',
2180 'data': 'BlockDirtyBitmap' }
2183 # @block-dirty-bitmap-merge:
2185 # Merge dirty bitmaps listed in @bitmaps to the @target dirty bitmap.
2186 # Dirty bitmaps in @bitmaps will be unchanged, except if it also appears
2187 # as the @target bitmap. Any bits already set in @target will still be
2188 # set after the merge, i.e., this operation does not clear the target.
2189 # On error, @target is unchanged.
2191 # The resulting bitmap will count as dirty any clusters that were dirty in any
2192 # of the source bitmaps. This can be used to achieve backup checkpoints, or in
2193 # simpler usages, to copy bitmaps.
2195 # Returns: - nothing on success
2196 # - If @node is not a valid block device, DeviceNotFound
2197 # - If any bitmap in @bitmaps or @target is not found, GenericError
2198 # - If any of the bitmaps have different sizes or granularities,
2205 # -> { "execute": "block-dirty-bitmap-merge",
2206 # "arguments": { "node": "drive0", "target": "bitmap0",
2207 # "bitmaps": ["bitmap1"] } }
2208 # <- { "return": {} }
2211 { 'command': 'block-dirty-bitmap-merge',
2212 'data': 'BlockDirtyBitmapMerge' }
2215 # @BlockDirtyBitmapSha256:
2217 # SHA256 hash of dirty bitmap data
2219 # @sha256: ASCII representation of SHA256 bitmap hash
2223 { 'struct': 'BlockDirtyBitmapSha256',
2224 'data': {'sha256': 'str'} }
2227 # @x-debug-block-dirty-bitmap-sha256:
2229 # Get bitmap SHA256.
2231 # Returns: - BlockDirtyBitmapSha256 on success
2232 # - If @node is not a valid block device, DeviceNotFound
2233 # - If @name is not found or if hashing has failed, GenericError with an
2238 { 'command': 'x-debug-block-dirty-bitmap-sha256',
2239 'data': 'BlockDirtyBitmap', 'returns': 'BlockDirtyBitmapSha256' }
2244 # Start mirroring a block device's writes to a new destination.
2246 # @job-id: identifier for the newly-created block job. If
2247 # omitted, the device name will be used. (Since 2.7)
2249 # @device: The device name or node-name of a root node whose writes should be
2252 # @target: the id or node-name of the block device to mirror to. This mustn't be
2253 # attached to guest.
2255 # @replaces: with sync=full graph node name to be replaced by the new
2256 # image when a whole image copy is done. This can be used to repair
2257 # broken Quorum files.
2259 # @speed: the maximum speed, in bytes per second
2261 # @sync: what parts of the disk image should be copied to the destination
2262 # (all the disk, only the sectors allocated in the topmost image, or
2265 # @granularity: granularity of the dirty bitmap, default is 64K
2266 # if the image format doesn't have clusters, 4K if the clusters
2267 # are smaller than that, else the cluster size. Must be a
2268 # power of 2 between 512 and 64M
2270 # @buf-size: maximum amount of data in flight from source to
2273 # @on-source-error: the action to take on an error on the source,
2274 # default 'report'. 'stop' and 'enospc' can only be used
2275 # if the block device supports io-status (see BlockInfo).
2277 # @on-target-error: the action to take on an error on the target,
2278 # default 'report' (no limitations, since this applies to
2279 # a different block device than @device).
2281 # @filter-node-name: the node name that should be assigned to the
2282 # filter driver that the mirror job inserts into the graph
2283 # above @device. If this option is not given, a node name is
2284 # autogenerated. (Since: 2.9)
2286 # @copy-mode: when to copy data to the destination; defaults to 'background'
2289 # @auto-finalize: When false, this job will wait in a PENDING state after it has
2290 # finished its work, waiting for @block-job-finalize before
2291 # making any block graph changes.
2292 # When true, this job will automatically
2293 # perform its abort or commit actions.
2294 # Defaults to true. (Since 3.1)
2296 # @auto-dismiss: When false, this job will wait in a CONCLUDED state after it
2297 # has completely ceased all work, and awaits @block-job-dismiss.
2298 # When true, this job will automatically disappear from the query
2299 # list without user intervention.
2300 # Defaults to true. (Since 3.1)
2301 # Returns: nothing on success.
2307 # -> { "execute": "blockdev-mirror",
2308 # "arguments": { "device": "ide-hd0",
2309 # "target": "target0",
2310 # "sync": "full" } }
2311 # <- { "return": {} }
2314 { 'command': 'blockdev-mirror',
2315 'data': { '*job-id': 'str', 'device': 'str', 'target': 'str',
2317 'sync': 'MirrorSyncMode',
2318 '*speed': 'int', '*granularity': 'uint32',
2319 '*buf-size': 'int', '*on-source-error': 'BlockdevOnError',
2320 '*on-target-error': 'BlockdevOnError',
2321 '*filter-node-name': 'str',
2322 '*copy-mode': 'MirrorCopyMode',
2323 '*auto-finalize': 'bool', '*auto-dismiss': 'bool' } }
2328 # A set of parameters describing block throttling.
2330 # @device: Block device name
2332 # @id: The name or QOM path of the guest device (since: 2.8)
2334 # @bps: total throughput limit in bytes per second
2336 # @bps_rd: read throughput limit in bytes per second
2338 # @bps_wr: write throughput limit in bytes per second
2340 # @iops: total I/O operations per second
2342 # @iops_rd: read I/O operations per second
2344 # @iops_wr: write I/O operations per second
2346 # @bps_max: total throughput limit during bursts,
2347 # in bytes (Since 1.7)
2349 # @bps_rd_max: read throughput limit during bursts,
2350 # in bytes (Since 1.7)
2352 # @bps_wr_max: write throughput limit during bursts,
2353 # in bytes (Since 1.7)
2355 # @iops_max: total I/O operations per second during bursts,
2356 # in bytes (Since 1.7)
2358 # @iops_rd_max: read I/O operations per second during bursts,
2359 # in bytes (Since 1.7)
2361 # @iops_wr_max: write I/O operations per second during bursts,
2362 # in bytes (Since 1.7)
2364 # @bps_max_length: maximum length of the @bps_max burst
2365 # period, in seconds. It must only
2366 # be set if @bps_max is set as well.
2367 # Defaults to 1. (Since 2.6)
2369 # @bps_rd_max_length: maximum length of the @bps_rd_max
2370 # burst period, in seconds. It must only
2371 # be set if @bps_rd_max is set as well.
2372 # Defaults to 1. (Since 2.6)
2374 # @bps_wr_max_length: maximum length of the @bps_wr_max
2375 # burst period, in seconds. It must only
2376 # be set if @bps_wr_max is set as well.
2377 # Defaults to 1. (Since 2.6)
2379 # @iops_max_length: maximum length of the @iops burst
2380 # period, in seconds. It must only
2381 # be set if @iops_max is set as well.
2382 # Defaults to 1. (Since 2.6)
2384 # @iops_rd_max_length: maximum length of the @iops_rd_max
2385 # burst period, in seconds. It must only
2386 # be set if @iops_rd_max is set as well.
2387 # Defaults to 1. (Since 2.6)
2389 # @iops_wr_max_length: maximum length of the @iops_wr_max
2390 # burst period, in seconds. It must only
2391 # be set if @iops_wr_max is set as well.
2392 # Defaults to 1. (Since 2.6)
2394 # @iops_size: an I/O size in bytes (Since 1.7)
2396 # @group: throttle group name (Since 2.4)
2399 # @deprecated: Member @device is deprecated. Use @id instead.
2403 { 'struct': 'BlockIOThrottle',
2404 'data': { '*device': { 'type': 'str', 'features': [ 'deprecated' ] },
2405 '*id': 'str', 'bps': 'int', 'bps_rd': 'int',
2406 'bps_wr': 'int', 'iops': 'int', 'iops_rd': 'int', 'iops_wr': 'int',
2407 '*bps_max': 'int', '*bps_rd_max': 'int',
2408 '*bps_wr_max': 'int', '*iops_max': 'int',
2409 '*iops_rd_max': 'int', '*iops_wr_max': 'int',
2410 '*bps_max_length': 'int', '*bps_rd_max_length': 'int',
2411 '*bps_wr_max_length': 'int', '*iops_max_length': 'int',
2412 '*iops_rd_max_length': 'int', '*iops_wr_max_length': 'int',
2413 '*iops_size': 'int', '*group': 'str' } }
2418 # Limit parameters for throttling.
2419 # Since some limit combinations are illegal, limits should always be set in one
2420 # transaction. All fields are optional. When setting limits, if a field is
2421 # missing the current value is not changed.
2423 # @iops-total: limit total I/O operations per second
2424 # @iops-total-max: I/O operations burst
2425 # @iops-total-max-length: length of the iops-total-max burst period, in seconds
2426 # It must only be set if @iops-total-max is set as well.
2427 # @iops-read: limit read operations per second
2428 # @iops-read-max: I/O operations read burst
2429 # @iops-read-max-length: length of the iops-read-max burst period, in seconds
2430 # It must only be set if @iops-read-max is set as well.
2431 # @iops-write: limit write operations per second
2432 # @iops-write-max: I/O operations write burst
2433 # @iops-write-max-length: length of the iops-write-max burst period, in seconds
2434 # It must only be set if @iops-write-max is set as well.
2435 # @bps-total: limit total bytes per second
2436 # @bps-total-max: total bytes burst
2437 # @bps-total-max-length: length of the bps-total-max burst period, in seconds.
2438 # It must only be set if @bps-total-max is set as well.
2439 # @bps-read: limit read bytes per second
2440 # @bps-read-max: total bytes read burst
2441 # @bps-read-max-length: length of the bps-read-max burst period, in seconds
2442 # It must only be set if @bps-read-max is set as well.
2443 # @bps-write: limit write bytes per second
2444 # @bps-write-max: total bytes write burst
2445 # @bps-write-max-length: length of the bps-write-max burst period, in seconds
2446 # It must only be set if @bps-write-max is set as well.
2447 # @iops-size: when limiting by iops max size of an I/O in bytes
2451 { 'struct': 'ThrottleLimits',
2452 'data': { '*iops-total' : 'int', '*iops-total-max' : 'int',
2453 '*iops-total-max-length' : 'int', '*iops-read' : 'int',
2454 '*iops-read-max' : 'int', '*iops-read-max-length' : 'int',
2455 '*iops-write' : 'int', '*iops-write-max' : 'int',
2456 '*iops-write-max-length' : 'int', '*bps-total' : 'int',
2457 '*bps-total-max' : 'int', '*bps-total-max-length' : 'int',
2458 '*bps-read' : 'int', '*bps-read-max' : 'int',
2459 '*bps-read-max-length' : 'int', '*bps-write' : 'int',
2460 '*bps-write-max' : 'int', '*bps-write-max-length' : 'int',
2461 '*iops-size' : 'int' } }
2466 # Copy data from a backing file into a block device.
2468 # The block streaming operation is performed in the background until the entire
2469 # backing file has been copied. This command returns immediately once streaming
2470 # has started. The status of ongoing block streaming operations can be checked
2471 # with query-block-jobs. The operation can be stopped before it has completed
2472 # using the block-job-cancel command.
2474 # The node that receives the data is called the top image, can be located in
2475 # any part of the chain (but always above the base image; see below) and can be
2476 # specified using its device or node name. Earlier qemu versions only allowed
2477 # 'device' to name the top level node; presence of the 'base-node' parameter
2478 # during introspection can be used as a witness of the enhanced semantics
2481 # If a base file is specified then sectors are not copied from that base file and
2482 # its backing chain. When streaming completes the image file will have the base
2483 # file as its backing file. This can be used to stream a subset of the backing
2484 # file chain instead of flattening the entire image.
2486 # On successful completion the image file is updated to drop the backing file
2487 # and the BLOCK_JOB_COMPLETED event is emitted.
2489 # @job-id: identifier for the newly-created block job. If
2490 # omitted, the device name will be used. (Since 2.7)
2492 # @device: the device or node name of the top image
2494 # @base: the common backing file name.
2495 # It cannot be set if @base-node is also set.
2497 # @base-node: the node name of the backing file.
2498 # It cannot be set if @base is also set. (Since 2.8)
2500 # @backing-file: The backing file string to write into the top
2501 # image. This filename is not validated.
2503 # If a pathname string is such that it cannot be
2504 # resolved by QEMU, that means that subsequent QMP or
2505 # HMP commands must use node-names for the image in
2506 # question, as filename lookup methods will fail.
2508 # If not specified, QEMU will automatically determine
2509 # the backing file string to use, or error out if there
2510 # is no obvious choice. Care should be taken when
2511 # specifying the string, to specify a valid filename or
2515 # @speed: the maximum speed, in bytes per second
2517 # @on-error: the action to take on an error (default report).
2518 # 'stop' and 'enospc' can only be used if the block device
2519 # supports io-status (see BlockInfo). Since 1.3.
2521 # @auto-finalize: When false, this job will wait in a PENDING state after it has
2522 # finished its work, waiting for @block-job-finalize before
2523 # making any block graph changes.
2524 # When true, this job will automatically
2525 # perform its abort or commit actions.
2526 # Defaults to true. (Since 3.1)
2528 # @auto-dismiss: When false, this job will wait in a CONCLUDED state after it
2529 # has completely ceased all work, and awaits @block-job-dismiss.
2530 # When true, this job will automatically disappear from the query
2531 # list without user intervention.
2532 # Defaults to true. (Since 3.1)
2534 # Returns: - Nothing on success.
2535 # - If @device does not exist, DeviceNotFound.
2541 # -> { "execute": "block-stream",
2542 # "arguments": { "device": "virtio0",
2543 # "base": "/tmp/master.qcow2" } }
2544 # <- { "return": {} }
2547 { 'command': 'block-stream',
2548 'data': { '*job-id': 'str', 'device': 'str', '*base': 'str',
2549 '*base-node': 'str', '*backing-file': 'str', '*speed': 'int',
2550 '*on-error': 'BlockdevOnError',
2551 '*auto-finalize': 'bool', '*auto-dismiss': 'bool' } }
2554 # @block-job-set-speed:
2556 # Set maximum speed for a background block operation.
2558 # This command can only be issued when there is an active block job.
2560 # Throttling can be disabled by setting the speed to 0.
2562 # @device: The job identifier. This used to be a device name (hence
2563 # the name of the parameter), but since QEMU 2.7 it can have
2566 # @speed: the maximum speed, in bytes per second, or 0 for unlimited.
2569 # Returns: - Nothing on success
2570 # - If no background operation is active on this device, DeviceNotActive
2574 { 'command': 'block-job-set-speed',
2575 'data': { 'device': 'str', 'speed': 'int' } }
2578 # @block-job-cancel:
2580 # Stop an active background block operation.
2582 # This command returns immediately after marking the active background block
2583 # operation for cancellation. It is an error to call this command if no
2584 # operation is in progress.
2586 # The operation will cancel as soon as possible and then emit the
2587 # BLOCK_JOB_CANCELLED event. Before that happens the job is still visible when
2588 # enumerated using query-block-jobs.
2590 # Note that if you issue 'block-job-cancel' after 'drive-mirror' has indicated
2591 # (via the event BLOCK_JOB_READY) that the source and destination are
2592 # synchronized, then the event triggered by this command changes to
2593 # BLOCK_JOB_COMPLETED, to indicate that the mirroring has ended and the
2594 # destination now has a point-in-time copy tied to the time of the cancellation.
2596 # For streaming, the image file retains its backing file unless the streaming
2597 # operation happens to complete just as it is being cancelled. A new streaming
2598 # operation can be started at a later time to finish copying all data from the
2601 # @device: The job identifier. This used to be a device name (hence
2602 # the name of the parameter), but since QEMU 2.7 it can have
2605 # @force: If true, and the job has already emitted the event BLOCK_JOB_READY,
2606 # abandon the job immediately (even if it is paused) instead of waiting
2607 # for the destination to complete its final synchronization (since 1.3)
2609 # Returns: - Nothing on success
2610 # - If no background operation is active on this device, DeviceNotActive
2614 { 'command': 'block-job-cancel', 'data': { 'device': 'str', '*force': 'bool' } }
2619 # Pause an active background block operation.
2621 # This command returns immediately after marking the active background block
2622 # operation for pausing. It is an error to call this command if no
2623 # operation is in progress or if the job is already paused.
2625 # The operation will pause as soon as possible. No event is emitted when
2626 # the operation is actually paused. Cancelling a paused job automatically
2629 # @device: The job identifier. This used to be a device name (hence
2630 # the name of the parameter), but since QEMU 2.7 it can have
2633 # Returns: - Nothing on success
2634 # - If no background operation is active on this device, DeviceNotActive
2638 { 'command': 'block-job-pause', 'data': { 'device': 'str' } }
2641 # @block-job-resume:
2643 # Resume an active background block operation.
2645 # This command returns immediately after resuming a paused background block
2646 # operation. It is an error to call this command if no operation is in
2647 # progress or if the job is not paused.
2649 # This command also clears the error status of the job.
2651 # @device: The job identifier. This used to be a device name (hence
2652 # the name of the parameter), but since QEMU 2.7 it can have
2655 # Returns: - Nothing on success
2656 # - If no background operation is active on this device, DeviceNotActive
2660 { 'command': 'block-job-resume', 'data': { 'device': 'str' } }
2663 # @block-job-complete:
2665 # Manually trigger completion of an active background block operation. This
2666 # is supported for drive mirroring, where it also switches the device to
2667 # write to the target path only. The ability to complete is signaled with
2668 # a BLOCK_JOB_READY event.
2670 # This command completes an active background block operation synchronously.
2671 # The ordering of this command's return with the BLOCK_JOB_COMPLETED event
2672 # is not defined. Note that if an I/O error occurs during the processing of
2673 # this command: 1) the command itself will fail; 2) the error will be processed
2674 # according to the rerror/werror arguments that were specified when starting
2677 # A cancelled or paused job cannot be completed.
2679 # @device: The job identifier. This used to be a device name (hence
2680 # the name of the parameter), but since QEMU 2.7 it can have
2683 # Returns: - Nothing on success
2684 # - If no background operation is active on this device, DeviceNotActive
2688 { 'command': 'block-job-complete', 'data': { 'device': 'str' } }
2691 # @block-job-dismiss:
2693 # For jobs that have already concluded, remove them from the block-job-query
2694 # list. This command only needs to be run for jobs which were started with
2695 # QEMU 2.12+ job lifetime management semantics.
2697 # This command will refuse to operate on any job that has not yet reached
2698 # its terminal state, JOB_STATUS_CONCLUDED. For jobs that make use of the
2699 # BLOCK_JOB_READY event, block-job-cancel or block-job-complete will still need
2700 # to be used as appropriate.
2702 # @id: The job identifier.
2704 # Returns: Nothing on success
2708 { 'command': 'block-job-dismiss', 'data': { 'id': 'str' } }
2711 # @block-job-finalize:
2713 # Once a job that has manual=true reaches the pending state, it can be
2714 # instructed to finalize any graph changes and do any necessary cleanup
2716 # For jobs in a transaction, instructing one job to finalize will force
2717 # ALL jobs in the transaction to finalize, so it is only necessary to instruct
2718 # a single member job to finalize.
2720 # @id: The job identifier.
2722 # Returns: Nothing on success
2726 { 'command': 'block-job-finalize', 'data': { 'id': 'str' } }
2729 # @BlockdevDiscardOptions:
2731 # Determines how to handle discard requests.
2733 # @ignore: Ignore the request
2734 # @unmap: Forward as an unmap request
2738 { 'enum': 'BlockdevDiscardOptions',
2739 'data': [ 'ignore', 'unmap' ] }
2742 # @BlockdevDetectZeroesOptions:
2744 # Describes the operation mode for the automatic conversion of plain
2745 # zero writes by the OS to driver specific optimized zero write commands.
2747 # @off: Disabled (default)
2749 # @unmap: Enabled and even try to unmap blocks if possible. This requires
2750 # also that @BlockdevDiscardOptions is set to unmap for this device.
2754 { 'enum': 'BlockdevDetectZeroesOptions',
2755 'data': [ 'off', 'on', 'unmap' ] }
2758 # @BlockdevAioOptions:
2760 # Selects the AIO backend to handle I/O requests
2762 # @threads: Use qemu's thread pool
2763 # @native: Use native AIO backend (only Linux and Windows)
2764 # @io_uring: Use linux io_uring (since 5.0)
2768 { 'enum': 'BlockdevAioOptions',
2769 'data': [ 'threads', 'native',
2770 { 'name': 'io_uring', 'if': 'defined(CONFIG_LINUX_IO_URING)' } ] }
2773 # @BlockdevCacheOptions:
2775 # Includes cache-related options for block devices
2777 # @direct: enables use of O_DIRECT (bypass the host page cache;
2779 # @no-flush: ignore any flush requests for the device (default:
2784 { 'struct': 'BlockdevCacheOptions',
2785 'data': { '*direct': 'bool',
2786 '*no-flush': 'bool' } }
2791 # Drivers that are supported in block device operations.
2794 # @throttle: Since 2.11
2796 # @copy-on-read: Since 3.0
2797 # @blklogwrites: Since 3.0
2798 # @blkreplay: Since 4.2
2799 # @compress: Since 5.0
2803 { 'enum': 'BlockdevDriver',
2804 'data': [ 'blkdebug', 'blklogwrites', 'blkreplay', 'blkverify', 'bochs',
2805 'cloop', 'compress', 'copy-on-read', 'dmg', 'file', 'ftp', 'ftps',
2806 'gluster', 'host_cdrom', 'host_device', 'http', 'https', 'iscsi',
2807 'luks', 'nbd', 'nfs', 'null-aio', 'null-co', 'nvme', 'parallels',
2808 'qcow', 'qcow2', 'qed', 'quorum', 'raw', 'rbd',
2809 { 'name': 'replication', 'if': 'defined(CONFIG_REPLICATION)' },
2811 'ssh', 'throttle', 'vdi', 'vhdx', 'vmdk', 'vpc', 'vvfat', 'vxhs' ] }
2814 # @BlockdevOptionsFile:
2816 # Driver specific block device options for the file backend.
2818 # @filename: path to the image file
2819 # @pr-manager: the id for the object that will handle persistent reservations
2820 # for this device (default: none, forward the commands via SG_IO;
2822 # @aio: AIO backend (default: threads) (since: 2.8)
2823 # @locking: whether to enable file locking. If set to 'auto', only enable
2824 # when Open File Descriptor (OFD) locking API is available
2825 # (default: auto, since 2.10)
2826 # @drop-cache: invalidate page cache during live migration. This prevents
2827 # stale data on the migration destination with cache.direct=off.
2828 # Currently only supported on Linux hosts.
2829 # (default: on, since: 4.0)
2830 # @x-check-cache-dropped: whether to check that page cache was dropped on live
2831 # migration. May cause noticeable delays if the image
2832 # file is large, do not use in production.
2833 # (default: off) (since: 3.0)
2836 # @dynamic-auto-read-only: If present, enabled auto-read-only means that the
2837 # driver will open the image read-only at first,
2838 # dynamically reopen the image file read-write when
2839 # the first writer is attached to the node and reopen
2840 # read-only when the last writer is detached. This
2841 # allows giving QEMU write permissions only on demand
2842 # when an operation actually needs write access.
2846 { 'struct': 'BlockdevOptionsFile',
2847 'data': { 'filename': 'str',
2848 '*pr-manager': 'str',
2849 '*locking': 'OnOffAuto',
2850 '*aio': 'BlockdevAioOptions',
2851 '*drop-cache': {'type': 'bool',
2852 'if': 'defined(CONFIG_LINUX)'},
2853 '*x-check-cache-dropped': 'bool' },
2854 'features': [ { 'name': 'dynamic-auto-read-only',
2855 'if': 'defined(CONFIG_POSIX)' } ] }
2858 # @BlockdevOptionsNull:
2860 # Driver specific block device options for the null backend.
2862 # @size: size of the device in bytes.
2863 # @latency-ns: emulated latency (in nanoseconds) in processing
2864 # requests. Default to zero which completes requests immediately.
2866 # @read-zeroes: if true, reads from the device produce zeroes; if false, the
2867 # buffer is left unchanged. (default: false; since: 4.1)
2871 { 'struct': 'BlockdevOptionsNull',
2872 'data': { '*size': 'int', '*latency-ns': 'uint64', '*read-zeroes': 'bool' } }
2875 # @BlockdevOptionsNVMe:
2877 # Driver specific block device options for the NVMe backend.
2879 # @device: PCI controller address of the NVMe device in
2880 # format hhhh:bb:ss.f (host:bus:slot.function)
2881 # @namespace: namespace number of the device, starting from 1.
2883 # Note that the PCI @device must have been unbound from any host
2884 # kernel driver before instructing QEMU to add the blockdev.
2888 { 'struct': 'BlockdevOptionsNVMe',
2889 'data': { 'device': 'str', 'namespace': 'int' } }
2892 # @BlockdevOptionsVVFAT:
2894 # Driver specific block device options for the vvfat protocol.
2896 # @dir: directory to be exported as FAT image
2897 # @fat-type: FAT type: 12, 16 or 32
2898 # @floppy: whether to export a floppy image (true) or
2899 # partitioned hard disk (false; default)
2900 # @label: set the volume label, limited to 11 bytes. FAT16 and
2901 # FAT32 traditionally have some restrictions on labels, which are
2902 # ignored by most operating systems. Defaults to "QEMU VVFAT".
2904 # @rw: whether to allow write operations (default: false)
2908 { 'struct': 'BlockdevOptionsVVFAT',
2909 'data': { 'dir': 'str', '*fat-type': 'int', '*floppy': 'bool',
2910 '*label': 'str', '*rw': 'bool' } }
2913 # @BlockdevOptionsGenericFormat:
2915 # Driver specific block device options for image format that have no option
2916 # besides their data source.
2918 # @file: reference to or definition of the data source block device
2922 { 'struct': 'BlockdevOptionsGenericFormat',
2923 'data': { 'file': 'BlockdevRef' } }
2926 # @BlockdevOptionsLUKS:
2928 # Driver specific block device options for LUKS.
2930 # @key-secret: the ID of a QCryptoSecret object providing
2931 # the decryption key (since 2.6). Mandatory except when
2932 # doing a metadata-only probe of the image.
2936 { 'struct': 'BlockdevOptionsLUKS',
2937 'base': 'BlockdevOptionsGenericFormat',
2938 'data': { '*key-secret': 'str' } }
2942 # @BlockdevOptionsGenericCOWFormat:
2944 # Driver specific block device options for image format that have no option
2945 # besides their data source and an optional backing file.
2947 # @backing: reference to or definition of the backing file block
2948 # device, null disables the backing file entirely.
2949 # Defaults to the backing file stored the image file.
2953 { 'struct': 'BlockdevOptionsGenericCOWFormat',
2954 'base': 'BlockdevOptionsGenericFormat',
2955 'data': { '*backing': 'BlockdevRefOrNull' } }
2958 # @Qcow2OverlapCheckMode:
2960 # General overlap check modes.
2962 # @none: Do not perform any checks
2964 # @constant: Perform only checks which can be done in constant time and
2965 # without reading anything from disk
2967 # @cached: Perform only checks which can be done without reading anything
2970 # @all: Perform all available overlap checks
2974 { 'enum': 'Qcow2OverlapCheckMode',
2975 'data': [ 'none', 'constant', 'cached', 'all' ] }
2978 # @Qcow2OverlapCheckFlags:
2980 # Structure of flags for each metadata structure. Setting a field to 'true'
2981 # makes qemu guard that structure against unintended overwriting. The default
2982 # value is chosen according to the template given.
2984 # @template: Specifies a template mode which can be adjusted using the other
2985 # flags, defaults to 'cached'
2987 # @bitmap-directory: since 3.0
2991 { 'struct': 'Qcow2OverlapCheckFlags',
2992 'data': { '*template': 'Qcow2OverlapCheckMode',
2993 '*main-header': 'bool',
2994 '*active-l1': 'bool',
2995 '*active-l2': 'bool',
2996 '*refcount-table': 'bool',
2997 '*refcount-block': 'bool',
2998 '*snapshot-table': 'bool',
2999 '*inactive-l1': 'bool',
3000 '*inactive-l2': 'bool',
3001 '*bitmap-directory': 'bool' } }
3004 # @Qcow2OverlapChecks:
3006 # Specifies which metadata structures should be guarded against unintended
3009 # @flags: set of flags for separate specification of each metadata structure
3012 # @mode: named mode which chooses a specific set of flags
3016 { 'alternate': 'Qcow2OverlapChecks',
3017 'data': { 'flags': 'Qcow2OverlapCheckFlags',
3018 'mode': 'Qcow2OverlapCheckMode' } }
3021 # @BlockdevQcowEncryptionFormat:
3023 # @aes: AES-CBC with plain64 initialization vectors
3027 { 'enum': 'BlockdevQcowEncryptionFormat',
3031 # @BlockdevQcowEncryption:
3035 { 'union': 'BlockdevQcowEncryption',
3036 'base': { 'format': 'BlockdevQcowEncryptionFormat' },
3037 'discriminator': 'format',
3038 'data': { 'aes': 'QCryptoBlockOptionsQCow' } }
3041 # @BlockdevOptionsQcow:
3043 # Driver specific block device options for qcow.
3045 # @encrypt: Image decryption options. Mandatory for
3046 # encrypted images, except when doing a metadata-only
3047 # probe of the image.
3051 { 'struct': 'BlockdevOptionsQcow',
3052 'base': 'BlockdevOptionsGenericCOWFormat',
3053 'data': { '*encrypt': 'BlockdevQcowEncryption' } }
3058 # @BlockdevQcow2EncryptionFormat:
3059 # @aes: AES-CBC with plain64 initialization vectors
3063 { 'enum': 'BlockdevQcow2EncryptionFormat',
3064 'data': [ 'aes', 'luks' ] }
3067 # @BlockdevQcow2Encryption:
3071 { 'union': 'BlockdevQcow2Encryption',
3072 'base': { 'format': 'BlockdevQcow2EncryptionFormat' },
3073 'discriminator': 'format',
3074 'data': { 'aes': 'QCryptoBlockOptionsQCow',
3075 'luks': 'QCryptoBlockOptionsLUKS'} }
3078 # @BlockdevOptionsQcow2:
3080 # Driver specific block device options for qcow2.
3082 # @lazy-refcounts: whether to enable the lazy refcounts
3083 # feature (default is taken from the image file)
3085 # @pass-discard-request: whether discard requests to the qcow2
3086 # device should be forwarded to the data source
3088 # @pass-discard-snapshot: whether discard requests for the data source
3089 # should be issued when a snapshot operation (e.g.
3090 # deleting a snapshot) frees clusters in the qcow2 file
3092 # @pass-discard-other: whether discard requests for the data source
3093 # should be issued on other occasions where a cluster
3096 # @overlap-check: which overlap checks to perform for writes
3097 # to the image, defaults to 'cached' (since 2.2)
3099 # @cache-size: the maximum total size of the L2 table and
3100 # refcount block caches in bytes (since 2.2)
3102 # @l2-cache-size: the maximum size of the L2 table cache in
3105 # @l2-cache-entry-size: the size of each entry in the L2 cache in
3106 # bytes. It must be a power of two between 512
3107 # and the cluster size. The default value is
3108 # the cluster size (since 2.12)
3110 # @refcount-cache-size: the maximum size of the refcount block cache
3111 # in bytes (since 2.2)
3113 # @cache-clean-interval: clean unused entries in the L2 and refcount
3114 # caches. The interval is in seconds. The default value
3115 # is 600 on supporting platforms, and 0 on other
3116 # platforms. 0 disables this feature. (since 2.5)
3118 # @encrypt: Image decryption options. Mandatory for
3119 # encrypted images, except when doing a metadata-only
3120 # probe of the image. (since 2.10)
3122 # @data-file: reference to or definition of the external data file.
3123 # This may only be specified for images that require an
3124 # external data file. If it is not specified for such
3125 # an image, the data file name is loaded from the image
3130 { 'struct': 'BlockdevOptionsQcow2',
3131 'base': 'BlockdevOptionsGenericCOWFormat',
3132 'data': { '*lazy-refcounts': 'bool',
3133 '*pass-discard-request': 'bool',
3134 '*pass-discard-snapshot': 'bool',
3135 '*pass-discard-other': 'bool',
3136 '*overlap-check': 'Qcow2OverlapChecks',
3137 '*cache-size': 'int',
3138 '*l2-cache-size': 'int',
3139 '*l2-cache-entry-size': 'int',
3140 '*refcount-cache-size': 'int',
3141 '*cache-clean-interval': 'int',
3142 '*encrypt': 'BlockdevQcow2Encryption',
3143 '*data-file': 'BlockdevRef' } }
3146 # @SshHostKeyCheckMode:
3148 # @none: Don't check the host key at all
3149 # @hash: Compare the host key with a given hash
3150 # @known_hosts: Check the host key against the known_hosts file
3154 { 'enum': 'SshHostKeyCheckMode',
3155 'data': [ 'none', 'hash', 'known_hosts' ] }
3158 # @SshHostKeyCheckHashType:
3160 # @md5: The given hash is an md5 hash
3161 # @sha1: The given hash is an sha1 hash
3165 { 'enum': 'SshHostKeyCheckHashType',
3166 'data': [ 'md5', 'sha1' ] }
3171 # @type: The hash algorithm used for the hash
3172 # @hash: The expected hash value
3176 { 'struct': 'SshHostKeyHash',
3177 'data': { 'type': 'SshHostKeyCheckHashType',
3185 { 'union': 'SshHostKeyCheck',
3186 'base': { 'mode': 'SshHostKeyCheckMode' },
3187 'discriminator': 'mode',
3188 'data': { 'hash': 'SshHostKeyHash' } }
3191 # @BlockdevOptionsSsh:
3193 # @server: host address
3195 # @path: path to the image on the host
3197 # @user: user as which to connect, defaults to current
3200 # @host-key-check: Defines how and what to check the host key against
3201 # (default: known_hosts)
3205 { 'struct': 'BlockdevOptionsSsh',
3206 'data': { 'server': 'InetSocketAddress',
3209 '*host-key-check': 'SshHostKeyCheck' } }
3215 # Trigger events supported by blkdebug.
3217 # @l1_shrink_write_table: write zeros to the l1 table to shrink image.
3220 # @l1_shrink_free_l2_clusters: discard the l2 tables. (since 2.11)
3222 # @cor_write: a write due to copy-on-read (since 2.11)
3224 # @cluster_alloc_space: an allocation of file space for a cluster (since 4.1)
3226 # @none: triggers once at creation of the blkdebug node (since 4.1)
3230 { 'enum': 'BlkdebugEvent', 'prefix': 'BLKDBG',
3231 'data': [ 'l1_update', 'l1_grow_alloc_table', 'l1_grow_write_table',
3232 'l1_grow_activate_table', 'l2_load', 'l2_update',
3233 'l2_update_compressed', 'l2_alloc_cow_read', 'l2_alloc_write',
3234 'read_aio', 'read_backing_aio', 'read_compressed', 'write_aio',
3235 'write_compressed', 'vmstate_load', 'vmstate_save', 'cow_read',
3236 'cow_write', 'reftable_load', 'reftable_grow', 'reftable_update',
3237 'refblock_load', 'refblock_update', 'refblock_update_part',
3238 'refblock_alloc', 'refblock_alloc_hookup', 'refblock_alloc_write',
3239 'refblock_alloc_write_blocks', 'refblock_alloc_write_table',
3240 'refblock_alloc_switch_table', 'cluster_alloc',
3241 'cluster_alloc_bytes', 'cluster_free', 'flush_to_os',
3242 'flush_to_disk', 'pwritev_rmw_head', 'pwritev_rmw_after_head',
3243 'pwritev_rmw_tail', 'pwritev_rmw_after_tail', 'pwritev',
3244 'pwritev_zero', 'pwritev_done', 'empty_image_prepare',
3245 'l1_shrink_write_table', 'l1_shrink_free_l2_clusters',
3246 'cor_write', 'cluster_alloc_space', 'none'] }
3251 # Kinds of I/O that blkdebug can inject errors in.
3253 # @read: .bdrv_co_preadv()
3255 # @write: .bdrv_co_pwritev()
3257 # @write-zeroes: .bdrv_co_pwrite_zeroes()
3259 # @discard: .bdrv_co_pdiscard()
3261 # @flush: .bdrv_co_flush_to_disk()
3263 # @block-status: .bdrv_co_block_status()
3267 { 'enum': 'BlkdebugIOType', 'prefix': 'BLKDEBUG_IO_TYPE',
3268 'data': [ 'read', 'write', 'write-zeroes', 'discard', 'flush',
3272 # @BlkdebugInjectErrorOptions:
3274 # Describes a single error injection for blkdebug.
3276 # @event: trigger event
3278 # @state: the state identifier blkdebug needs to be in to
3279 # actually trigger the event; defaults to "any"
3281 # @iotype: the type of I/O operations on which this error should
3282 # be injected; defaults to "all read, write,
3283 # write-zeroes, discard, and flush operations"
3286 # @errno: error identifier (errno) to be returned; defaults to
3289 # @sector: specifies the sector index which has to be affected
3290 # in order to actually trigger the event; defaults to "any
3293 # @once: disables further events after this one has been
3294 # triggered; defaults to false
3296 # @immediately: fail immediately; defaults to false
3300 { 'struct': 'BlkdebugInjectErrorOptions',
3301 'data': { 'event': 'BlkdebugEvent',
3303 '*iotype': 'BlkdebugIOType',
3307 '*immediately': 'bool' } }
3310 # @BlkdebugSetStateOptions:
3312 # Describes a single state-change event for blkdebug.
3314 # @event: trigger event
3316 # @state: the current state identifier blkdebug needs to be in;
3319 # @new_state: the state identifier blkdebug is supposed to assume if
3320 # this event is triggered
3324 { 'struct': 'BlkdebugSetStateOptions',
3325 'data': { 'event': 'BlkdebugEvent',
3327 'new_state': 'int' } }
3330 # @BlockdevOptionsBlkdebug:
3332 # Driver specific block device options for blkdebug.
3334 # @image: underlying raw block device (or image file)
3336 # @config: filename of the configuration file
3338 # @align: required alignment for requests in bytes, must be
3339 # positive power of 2, or 0 for default
3341 # @max-transfer: maximum size for I/O transfers in bytes, must be
3342 # positive multiple of @align and of the underlying
3343 # file's request alignment (but need not be a power of
3344 # 2), or 0 for default (since 2.10)
3346 # @opt-write-zero: preferred alignment for write zero requests in bytes,
3347 # must be positive multiple of @align and of the
3348 # underlying file's request alignment (but need not be a
3349 # power of 2), or 0 for default (since 2.10)
3351 # @max-write-zero: maximum size for write zero requests in bytes, must be
3352 # positive multiple of @align, of @opt-write-zero, and of
3353 # the underlying file's request alignment (but need not
3354 # be a power of 2), or 0 for default (since 2.10)
3356 # @opt-discard: preferred alignment for discard requests in bytes, must
3357 # be positive multiple of @align and of the underlying
3358 # file's request alignment (but need not be a power of
3359 # 2), or 0 for default (since 2.10)
3361 # @max-discard: maximum size for discard requests in bytes, must be
3362 # positive multiple of @align, of @opt-discard, and of
3363 # the underlying file's request alignment (but need not
3364 # be a power of 2), or 0 for default (since 2.10)
3366 # @inject-error: array of error injection descriptions
3368 # @set-state: array of state-change descriptions
3370 # @take-child-perms: Permissions to take on @image in addition to what
3371 # is necessary anyway (which depends on how the
3372 # blkdebug node is used). Defaults to none.
3375 # @unshare-child-perms: Permissions not to share on @image in addition
3376 # to what cannot be shared anyway (which depends
3377 # on how the blkdebug node is used). Defaults
3378 # to none. (since 5.0)
3382 { 'struct': 'BlockdevOptionsBlkdebug',
3383 'data': { 'image': 'BlockdevRef',
3385 '*align': 'int', '*max-transfer': 'int32',
3386 '*opt-write-zero': 'int32', '*max-write-zero': 'int32',
3387 '*opt-discard': 'int32', '*max-discard': 'int32',
3388 '*inject-error': ['BlkdebugInjectErrorOptions'],
3389 '*set-state': ['BlkdebugSetStateOptions'],
3390 '*take-child-perms': ['BlockPermission'],
3391 '*unshare-child-perms': ['BlockPermission'] } }
3394 # @BlockdevOptionsBlklogwrites:
3396 # Driver specific block device options for blklogwrites.
3398 # @file: block device
3400 # @log: block device used to log writes to @file
3402 # @log-sector-size: sector size used in logging writes to @file, determines
3403 # granularity of offsets and sizes of writes (default: 512)
3405 # @log-append: append to an existing log (default: false)
3407 # @log-super-update-interval: interval of write requests after which the log
3408 # super block is updated to disk (default: 4096)
3412 { 'struct': 'BlockdevOptionsBlklogwrites',
3413 'data': { 'file': 'BlockdevRef',
3414 'log': 'BlockdevRef',
3415 '*log-sector-size': 'uint32',
3416 '*log-append': 'bool',
3417 '*log-super-update-interval': 'uint64' } }
3420 # @BlockdevOptionsBlkverify:
3422 # Driver specific block device options for blkverify.
3424 # @test: block device to be tested
3426 # @raw: raw image used for verification
3430 { 'struct': 'BlockdevOptionsBlkverify',
3431 'data': { 'test': 'BlockdevRef',
3432 'raw': 'BlockdevRef' } }
3435 # @BlockdevOptionsBlkreplay:
3437 # Driver specific block device options for blkreplay.
3439 # @image: disk image which should be controlled with blkreplay
3443 { 'struct': 'BlockdevOptionsBlkreplay',
3444 'data': { 'image': 'BlockdevRef' } }
3447 # @QuorumReadPattern:
3449 # An enumeration of quorum read patterns.
3451 # @quorum: read all the children and do a quorum vote on reads
3453 # @fifo: read only from the first child that has not failed
3457 { 'enum': 'QuorumReadPattern', 'data': [ 'quorum', 'fifo' ] }
3460 # @BlockdevOptionsQuorum:
3462 # Driver specific block device options for Quorum
3464 # @blkverify: true if the driver must print content mismatch
3465 # set to false by default
3467 # @children: the children block devices to use
3469 # @vote-threshold: the vote limit under which a read will fail
3471 # @rewrite-corrupted: rewrite corrupted data when quorum is reached
3474 # @read-pattern: choose read pattern and set to quorum by default
3479 { 'struct': 'BlockdevOptionsQuorum',
3480 'data': { '*blkverify': 'bool',
3481 'children': [ 'BlockdevRef' ],
3482 'vote-threshold': 'int',
3483 '*rewrite-corrupted': 'bool',
3484 '*read-pattern': 'QuorumReadPattern' } }
3487 # @BlockdevOptionsGluster:
3489 # Driver specific block device options for Gluster
3491 # @volume: name of gluster volume where VM image resides
3493 # @path: absolute path to image file in gluster volume
3495 # @server: gluster servers description
3497 # @debug: libgfapi log level (default '4' which is Error)
3500 # @logfile: libgfapi log file (default /dev/stderr) (Since 2.8)
3504 { 'struct': 'BlockdevOptionsGluster',
3505 'data': { 'volume': 'str',
3507 'server': ['SocketAddress'],
3509 '*logfile': 'str' } }
3514 # An enumeration of libiscsi transport types
3518 { 'enum': 'IscsiTransport',
3519 'data': [ 'tcp', 'iser' ] }
3522 # @IscsiHeaderDigest:
3524 # An enumeration of header digests supported by libiscsi
3528 { 'enum': 'IscsiHeaderDigest',
3529 'prefix': 'QAPI_ISCSI_HEADER_DIGEST',
3530 'data': [ 'crc32c', 'none', 'crc32c-none', 'none-crc32c' ] }
3533 # @BlockdevOptionsIscsi:
3535 # @transport: The iscsi transport type
3537 # @portal: The address of the iscsi portal
3539 # @target: The target iqn name
3541 # @lun: LUN to connect to. Defaults to 0.
3543 # @user: User name to log in with. If omitted, no CHAP
3544 # authentication is performed.
3546 # @password-secret: The ID of a QCryptoSecret object providing
3547 # the password for the login. This option is required if
3548 # @user is specified.
3550 # @initiator-name: The iqn name we want to identify to the target
3551 # as. If this option is not specified, an initiator name is
3552 # generated automatically.
3554 # @header-digest: The desired header digest. Defaults to
3557 # @timeout: Timeout in seconds after which a request will
3558 # timeout. 0 means no timeout and is the default.
3560 # Driver specific block device options for iscsi
3564 { 'struct': 'BlockdevOptionsIscsi',
3565 'data': { 'transport': 'IscsiTransport',
3570 '*password-secret': 'str',
3571 '*initiator-name': 'str',
3572 '*header-digest': 'IscsiHeaderDigest',
3573 '*timeout': 'int' } }
3581 { 'enum': 'RbdAuthMode',
3582 'data': [ 'cephx', 'none' ] }
3585 # @BlockdevOptionsRbd:
3587 # @pool: Ceph pool name.
3589 # @namespace: Rados namespace name in the Ceph pool. (Since 5.0)
3591 # @image: Image name in the Ceph pool.
3593 # @conf: path to Ceph configuration file. Values
3594 # in the configuration file will be overridden by
3595 # options specified via QAPI.
3597 # @snapshot: Ceph snapshot name.
3599 # @user: Ceph id name.
3601 # @auth-client-required: Acceptable authentication modes.
3602 # This maps to Ceph configuration option
3603 # "auth_client_required". (Since 3.0)
3605 # @key-secret: ID of a QCryptoSecret object providing a key
3606 # for cephx authentication.
3607 # This maps to Ceph configuration option
3608 # "key". (Since 3.0)
3610 # @server: Monitor host address and port. This maps
3611 # to the "mon_host" Ceph option.
3615 { 'struct': 'BlockdevOptionsRbd',
3616 'data': { 'pool': 'str',
3617 '*namespace': 'str',
3622 '*auth-client-required': ['RbdAuthMode'],
3623 '*key-secret': 'str',
3624 '*server': ['InetSocketAddressBase'] } }
3627 # @BlockdevOptionsSheepdog:
3629 # Driver specific block device options for sheepdog
3631 # @vdi: Virtual disk image name
3632 # @server: The Sheepdog server to connect to
3633 # @snap-id: Snapshot ID
3634 # @tag: Snapshot tag name
3636 # Only one of @snap-id and @tag may be present.
3640 { 'struct': 'BlockdevOptionsSheepdog',
3641 'data': { 'server': 'SocketAddress',
3643 '*snap-id': 'uint32',
3649 # An enumeration of replication modes.
3651 # @primary: Primary mode, the vm's state will be sent to secondary QEMU.
3653 # @secondary: Secondary mode, receive the vm's state from primary QEMU.
3657 { 'enum' : 'ReplicationMode', 'data' : [ 'primary', 'secondary' ],
3658 'if': 'defined(CONFIG_REPLICATION)' }
3661 # @BlockdevOptionsReplication:
3663 # Driver specific block device options for replication
3665 # @mode: the replication mode
3667 # @top-id: In secondary mode, node name or device ID of the root
3668 # node who owns the replication node chain. Must not be given in
3673 { 'struct': 'BlockdevOptionsReplication',
3674 'base': 'BlockdevOptionsGenericFormat',
3675 'data': { 'mode': 'ReplicationMode',
3677 'if': 'defined(CONFIG_REPLICATION)' }
3682 # An enumeration of NFS transport types
3684 # @inet: TCP transport
3688 { 'enum': 'NFSTransport',
3689 'data': [ 'inet' ] }
3694 # Captures the address of the socket
3696 # @type: transport type used for NFS (only TCP supported)
3698 # @host: host address for NFS server
3702 { 'struct': 'NFSServer',
3703 'data': { 'type': 'NFSTransport',
3707 # @BlockdevOptionsNfs:
3709 # Driver specific block device option for NFS
3711 # @server: host address
3713 # @path: path of the image on the host
3715 # @user: UID value to use when talking to the
3716 # server (defaults to 65534 on Windows and getuid()
3719 # @group: GID value to use when talking to the
3720 # server (defaults to 65534 on Windows and getgid()
3723 # @tcp-syn-count: number of SYNs during the session
3724 # establishment (defaults to libnfs default)
3726 # @readahead-size: set the readahead size in bytes (defaults
3727 # to libnfs default)
3729 # @page-cache-size: set the pagecache size in bytes (defaults
3730 # to libnfs default)
3732 # @debug: set the NFS debug level (max 2) (defaults
3733 # to libnfs default)
3737 { 'struct': 'BlockdevOptionsNfs',
3738 'data': { 'server': 'NFSServer',
3742 '*tcp-syn-count': 'int',
3743 '*readahead-size': 'int',
3744 '*page-cache-size': 'int',
3748 # @BlockdevOptionsCurlBase:
3750 # Driver specific block device options shared by all protocols supported by the
3753 # @url: URL of the image file
3755 # @readahead: Size of the read-ahead cache; must be a multiple of
3756 # 512 (defaults to 256 kB)
3758 # @timeout: Timeout for connections, in seconds (defaults to 5)
3760 # @username: Username for authentication (defaults to none)
3762 # @password-secret: ID of a QCryptoSecret object providing a password
3763 # for authentication (defaults to no password)
3765 # @proxy-username: Username for proxy authentication (defaults to none)
3767 # @proxy-password-secret: ID of a QCryptoSecret object providing a password
3768 # for proxy authentication (defaults to no password)
3772 { 'struct': 'BlockdevOptionsCurlBase',
3773 'data': { 'url': 'str',
3774 '*readahead': 'int',
3777 '*password-secret': 'str',
3778 '*proxy-username': 'str',
3779 '*proxy-password-secret': 'str' } }
3782 # @BlockdevOptionsCurlHttp:
3784 # Driver specific block device options for HTTP connections over the curl
3785 # backend. URLs must start with "http://".
3787 # @cookie: List of cookies to set; format is
3788 # "name1=content1; name2=content2;" as explained by
3789 # CURLOPT_COOKIE(3). Defaults to no cookies.
3791 # @cookie-secret: ID of a QCryptoSecret object providing the cookie data in a
3792 # secure way. See @cookie for the format. (since 2.10)
3796 { 'struct': 'BlockdevOptionsCurlHttp',
3797 'base': 'BlockdevOptionsCurlBase',
3798 'data': { '*cookie': 'str',
3799 '*cookie-secret': 'str'} }
3802 # @BlockdevOptionsCurlHttps:
3804 # Driver specific block device options for HTTPS connections over the curl
3805 # backend. URLs must start with "https://".
3807 # @cookie: List of cookies to set; format is
3808 # "name1=content1; name2=content2;" as explained by
3809 # CURLOPT_COOKIE(3). Defaults to no cookies.
3811 # @sslverify: Whether to verify the SSL certificate's validity (defaults to
3814 # @cookie-secret: ID of a QCryptoSecret object providing the cookie data in a
3815 # secure way. See @cookie for the format. (since 2.10)
3819 { 'struct': 'BlockdevOptionsCurlHttps',
3820 'base': 'BlockdevOptionsCurlBase',
3821 'data': { '*cookie': 'str',
3822 '*sslverify': 'bool',
3823 '*cookie-secret': 'str'} }
3826 # @BlockdevOptionsCurlFtp:
3828 # Driver specific block device options for FTP connections over the curl
3829 # backend. URLs must start with "ftp://".
3833 { 'struct': 'BlockdevOptionsCurlFtp',
3834 'base': 'BlockdevOptionsCurlBase',
3838 # @BlockdevOptionsCurlFtps:
3840 # Driver specific block device options for FTPS connections over the curl
3841 # backend. URLs must start with "ftps://".
3843 # @sslverify: Whether to verify the SSL certificate's validity (defaults to
3848 { 'struct': 'BlockdevOptionsCurlFtps',
3849 'base': 'BlockdevOptionsCurlBase',
3850 'data': { '*sslverify': 'bool' } }
3853 # @BlockdevOptionsNbd:
3855 # Driver specific block device options for NBD.
3857 # @server: NBD server address
3859 # @export: export name
3861 # @tls-creds: TLS credentials ID
3863 # @x-dirty-bitmap: A "qemu:dirty-bitmap:NAME" string to query in place of
3864 # traditional "base:allocation" block status (see
3865 # NBD_OPT_LIST_META_CONTEXT in the NBD protocol) (since 3.0)
3867 # @reconnect-delay: On an unexpected disconnect, the nbd client tries to
3868 # connect again until succeeding or encountering a serious
3869 # error. During the first @reconnect-delay seconds, all
3870 # requests are paused and will be rerun on a successful
3871 # reconnect. After that time, any delayed requests and all
3872 # future requests before a successful reconnect will
3873 # immediately fail. Default 0 (Since 4.2)
3877 { 'struct': 'BlockdevOptionsNbd',
3878 'data': { 'server': 'SocketAddress',
3880 '*tls-creds': 'str',
3881 '*x-dirty-bitmap': 'str',
3882 '*reconnect-delay': 'uint32' } }
3885 # @BlockdevOptionsRaw:
3887 # Driver specific block device options for the raw driver.
3889 # @offset: position where the block device starts
3890 # @size: the assumed size of the device
3894 { 'struct': 'BlockdevOptionsRaw',
3895 'base': 'BlockdevOptionsGenericFormat',
3896 'data': { '*offset': 'int', '*size': 'int' } }
3899 # @BlockdevOptionsVxHS:
3901 # Driver specific block device options for VxHS
3903 # @vdisk-id: UUID of VxHS volume
3904 # @server: vxhs server IP, port
3905 # @tls-creds: TLS credentials ID
3909 { 'struct': 'BlockdevOptionsVxHS',
3910 'data': { 'vdisk-id': 'str',
3911 'server': 'InetSocketAddressBase',
3912 '*tls-creds': 'str' } }
3915 # @BlockdevOptionsThrottle:
3917 # Driver specific block device options for the throttle driver
3919 # @throttle-group: the name of the throttle-group object to use. It
3920 # must already exist.
3921 # @file: reference to or definition of the data source block device
3924 { 'struct': 'BlockdevOptionsThrottle',
3925 'data': { 'throttle-group': 'str',
3926 'file' : 'BlockdevRef'
3931 # Options for creating a block device. Many options are available for all
3932 # block devices, independent of the block driver:
3934 # @driver: block driver name
3935 # @node-name: the node name of the new node (Since 2.0).
3936 # This option is required on the top level of blockdev-add.
3937 # Valid node names start with an alphabetic character and may
3938 # contain only alphanumeric characters, '-', '.' and '_'. Their
3939 # maximum length is 31 characters.
3940 # @discard: discard-related options (default: ignore)
3941 # @cache: cache-related options
3942 # @read-only: whether the block device should be read-only (default: false).
3943 # Note that some block drivers support only read-only access,
3944 # either generally or in certain configurations. In this case,
3945 # the default value does not work and the option must be
3946 # specified explicitly.
3947 # @auto-read-only: if true and @read-only is false, QEMU may automatically
3948 # decide not to open the image read-write as requested, but
3949 # fall back to read-only instead (and switch between the modes
3950 # later), e.g. depending on whether the image file is writable
3951 # or whether a writing user is attached to the node
3952 # (default: false, since 3.1)
3953 # @detect-zeroes: detect and optimize zero writes (Since 2.1)
3955 # @force-share: force share all permission on added nodes.
3956 # Requires read-only=true. (Since 2.10)
3958 # Remaining options are determined by the block driver.
3962 { 'union': 'BlockdevOptions',
3963 'base': { 'driver': 'BlockdevDriver',
3964 '*node-name': 'str',
3965 '*discard': 'BlockdevDiscardOptions',
3966 '*cache': 'BlockdevCacheOptions',
3967 '*read-only': 'bool',
3968 '*auto-read-only': 'bool',
3969 '*force-share': 'bool',
3970 '*detect-zeroes': 'BlockdevDetectZeroesOptions' },
3971 'discriminator': 'driver',
3973 'blkdebug': 'BlockdevOptionsBlkdebug',
3974 'blklogwrites':'BlockdevOptionsBlklogwrites',
3975 'blkverify': 'BlockdevOptionsBlkverify',
3976 'blkreplay': 'BlockdevOptionsBlkreplay',
3977 'bochs': 'BlockdevOptionsGenericFormat',
3978 'cloop': 'BlockdevOptionsGenericFormat',
3979 'compress': 'BlockdevOptionsGenericFormat',
3980 'copy-on-read':'BlockdevOptionsGenericFormat',
3981 'dmg': 'BlockdevOptionsGenericFormat',
3982 'file': 'BlockdevOptionsFile',
3983 'ftp': 'BlockdevOptionsCurlFtp',
3984 'ftps': 'BlockdevOptionsCurlFtps',
3985 'gluster': 'BlockdevOptionsGluster',
3986 'host_cdrom': 'BlockdevOptionsFile',
3987 'host_device':'BlockdevOptionsFile',
3988 'http': 'BlockdevOptionsCurlHttp',
3989 'https': 'BlockdevOptionsCurlHttps',
3990 'iscsi': 'BlockdevOptionsIscsi',
3991 'luks': 'BlockdevOptionsLUKS',
3992 'nbd': 'BlockdevOptionsNbd',
3993 'nfs': 'BlockdevOptionsNfs',
3994 'null-aio': 'BlockdevOptionsNull',
3995 'null-co': 'BlockdevOptionsNull',
3996 'nvme': 'BlockdevOptionsNVMe',
3997 'parallels': 'BlockdevOptionsGenericFormat',
3998 'qcow2': 'BlockdevOptionsQcow2',
3999 'qcow': 'BlockdevOptionsQcow',
4000 'qed': 'BlockdevOptionsGenericCOWFormat',
4001 'quorum': 'BlockdevOptionsQuorum',
4002 'raw': 'BlockdevOptionsRaw',
4003 'rbd': 'BlockdevOptionsRbd',
4004 'replication': { 'type': 'BlockdevOptionsReplication',
4005 'if': 'defined(CONFIG_REPLICATION)' },
4006 'sheepdog': 'BlockdevOptionsSheepdog',
4007 'ssh': 'BlockdevOptionsSsh',
4008 'throttle': 'BlockdevOptionsThrottle',
4009 'vdi': 'BlockdevOptionsGenericFormat',
4010 'vhdx': 'BlockdevOptionsGenericFormat',
4011 'vmdk': 'BlockdevOptionsGenericCOWFormat',
4012 'vpc': 'BlockdevOptionsGenericFormat',
4013 'vvfat': 'BlockdevOptionsVVFAT',
4014 'vxhs': 'BlockdevOptionsVxHS'
4020 # Reference to a block device.
4022 # @definition: defines a new block device inline
4023 # @reference: references the ID of an existing block device
4027 { 'alternate': 'BlockdevRef',
4028 'data': { 'definition': 'BlockdevOptions',
4029 'reference': 'str' } }
4032 # @BlockdevRefOrNull:
4034 # Reference to a block device.
4036 # @definition: defines a new block device inline
4037 # @reference: references the ID of an existing block device.
4038 # An empty string means that no block device should
4039 # be referenced. Deprecated; use null instead.
4040 # @null: No block device should be referenced (since 2.10)
4044 { 'alternate': 'BlockdevRefOrNull',
4045 'data': { 'definition': 'BlockdevOptions',
4052 # Creates a new block device. If the @id option is given at the top level, a
4053 # BlockBackend will be created; otherwise, @node-name is mandatory at the top
4054 # level and no BlockBackend will be created.
4061 # -> { "execute": "blockdev-add",
4063 # "driver": "qcow2",
4064 # "node-name": "test1",
4067 # "filename": "test.qcow2"
4071 # <- { "return": {} }
4074 # -> { "execute": "blockdev-add",
4076 # "driver": "qcow2",
4077 # "node-name": "node0",
4078 # "discard": "unmap",
4084 # "filename": "/tmp/test.qcow2"
4090 # "filename": "/dev/fdset/4"
4096 # <- { "return": {} }
4099 { 'command': 'blockdev-add', 'data': 'BlockdevOptions', 'boxed': true }
4102 # @x-blockdev-reopen:
4104 # Reopens a block device using the given set of options. Any option
4105 # not specified will be reset to its default value regardless of its
4106 # previous status. If an option cannot be changed or a particular
4107 # driver does not support reopening then the command will return an
4110 # The top-level @node-name option (from BlockdevOptions) must be
4111 # specified and is used to select the block device to be reopened.
4112 # Other @node-name options must be either omitted or set to the
4113 # current name of the appropriate node. This command won't change any
4114 # node name and any attempt to do it will result in an error.
4116 # In the case of options that refer to child nodes, the behavior of
4117 # this command depends on the value:
4119 # 1) A set of options (BlockdevOptions): the child is reopened with
4120 # the specified set of options.
4122 # 2) A reference to the current child: the child is reopened using
4123 # its existing set of options.
4125 # 3) A reference to a different node: the current child is replaced
4126 # with the specified one.
4128 # 4) NULL: the current child (if any) is detached.
4130 # Options (1) and (2) are supported in all cases, but at the moment
4131 # only @backing allows replacing or detaching an existing child.
4133 # Unlike with blockdev-add, the @backing option must always be present
4134 # unless the node being reopened does not have a backing file and its
4135 # image does not have a default backing file name as part of its
4140 { 'command': 'x-blockdev-reopen',
4141 'data': 'BlockdevOptions', 'boxed': true }
4146 # Deletes a block device that has been added using blockdev-add.
4147 # The command will fail if the node is attached to a device or is
4148 # otherwise being used.
4150 # @node-name: Name of the graph node to delete.
4156 # -> { "execute": "blockdev-add",
4158 # "driver": "qcow2",
4159 # "node-name": "node0",
4162 # "filename": "test.qcow2"
4166 # <- { "return": {} }
4168 # -> { "execute": "blockdev-del",
4169 # "arguments": { "node-name": "node0" }
4171 # <- { "return": {} }
4174 { 'command': 'blockdev-del', 'data': { 'node-name': 'str' } }
4177 # @BlockdevCreateOptionsFile:
4179 # Driver specific image creation options for file.
4181 # @filename: Filename for the new image file
4182 # @size: Size of the virtual disk in bytes
4183 # @preallocation: Preallocation mode for the new image (default: off;
4184 # allowed values: off,
4185 # falloc (if defined CONFIG_POSIX_FALLOCATE),
4186 # full (if defined CONFIG_POSIX))
4187 # @nocow: Turn off copy-on-write (valid only on btrfs; default: off)
4191 { 'struct': 'BlockdevCreateOptionsFile',
4192 'data': { 'filename': 'str',
4194 '*preallocation': 'PreallocMode',
4195 '*nocow': 'bool' } }
4198 # @BlockdevCreateOptionsGluster:
4200 # Driver specific image creation options for gluster.
4202 # @location: Where to store the new image file
4203 # @size: Size of the virtual disk in bytes
4204 # @preallocation: Preallocation mode for the new image (default: off;
4205 # allowed values: off,
4206 # falloc (if defined CONFIG_GLUSTERFS_FALLOCATE),
4207 # full (if defined CONFIG_GLUSTERFS_ZEROFILL))
4211 { 'struct': 'BlockdevCreateOptionsGluster',
4212 'data': { 'location': 'BlockdevOptionsGluster',
4214 '*preallocation': 'PreallocMode' } }
4217 # @BlockdevCreateOptionsLUKS:
4219 # Driver specific image creation options for LUKS.
4221 # @file: Node to create the image format on
4222 # @size: Size of the virtual disk in bytes
4223 # @preallocation: Preallocation mode for the new image
4225 # (default: off; allowed values: off, metadata, falloc, full)
4229 { 'struct': 'BlockdevCreateOptionsLUKS',
4230 'base': 'QCryptoBlockCreateOptionsLUKS',
4231 'data': { 'file': 'BlockdevRef',
4233 '*preallocation': 'PreallocMode' } }
4236 # @BlockdevCreateOptionsNfs:
4238 # Driver specific image creation options for NFS.
4240 # @location: Where to store the new image file
4241 # @size: Size of the virtual disk in bytes
4245 { 'struct': 'BlockdevCreateOptionsNfs',
4246 'data': { 'location': 'BlockdevOptionsNfs',
4250 # @BlockdevCreateOptionsParallels:
4252 # Driver specific image creation options for parallels.
4254 # @file: Node to create the image format on
4255 # @size: Size of the virtual disk in bytes
4256 # @cluster-size: Cluster size in bytes (default: 1 MB)
4260 { 'struct': 'BlockdevCreateOptionsParallels',
4261 'data': { 'file': 'BlockdevRef',
4263 '*cluster-size': 'size' } }
4266 # @BlockdevCreateOptionsQcow:
4268 # Driver specific image creation options for qcow.
4270 # @file: Node to create the image format on
4271 # @size: Size of the virtual disk in bytes
4272 # @backing-file: File name of the backing file if a backing file
4274 # @encrypt: Encryption options if the image should be encrypted
4278 { 'struct': 'BlockdevCreateOptionsQcow',
4279 'data': { 'file': 'BlockdevRef',
4281 '*backing-file': 'str',
4282 '*encrypt': 'QCryptoBlockCreateOptions' } }
4285 # @BlockdevQcow2Version:
4287 # @v2: The original QCOW2 format as introduced in qemu 0.10 (version 2)
4288 # @v3: The extended QCOW2 format as introduced in qemu 1.1 (version 3)
4292 { 'enum': 'BlockdevQcow2Version',
4293 'data': [ 'v2', 'v3' ] }
4297 # @Qcow2CompressionType:
4299 # Compression type used in qcow2 image file
4301 # @zlib: zlib compression, see <http://zlib.net/>
4302 # @zstd: zstd compression, see <http://github.com/facebook/zstd>
4306 { 'enum': 'Qcow2CompressionType',
4307 'data': [ 'zlib', { 'name': 'zstd', 'if': 'defined(CONFIG_ZSTD)' } ] }
4310 # @BlockdevCreateOptionsQcow2:
4312 # Driver specific image creation options for qcow2.
4314 # @file: Node to create the image format on
4315 # @data-file: Node to use as an external data file in which all guest
4316 # data is stored so that only metadata remains in the qcow2
4318 # @data-file-raw: True if the external data file must stay valid as a
4319 # standalone (read-only) raw image without looking at qcow2
4320 # metadata (default: false; since: 4.0)
4321 # @size: Size of the virtual disk in bytes
4322 # @version: Compatibility level (default: v3)
4323 # @backing-file: File name of the backing file if a backing file
4325 # @backing-fmt: Name of the block driver to use for the backing file
4326 # @encrypt: Encryption options if the image should be encrypted
4327 # @cluster-size: qcow2 cluster size in bytes (default: 65536)
4328 # @preallocation: Preallocation mode for the new image (default: off;
4329 # allowed values: off, falloc, full, metadata)
4330 # @lazy-refcounts: True if refcounts may be updated lazily (default: off)
4331 # @refcount-bits: Width of reference counts in bits (default: 16)
4332 # @compression-type: The image cluster compression method
4333 # (default: zlib, since 5.1)
4337 { 'struct': 'BlockdevCreateOptionsQcow2',
4338 'data': { 'file': 'BlockdevRef',
4339 '*data-file': 'BlockdevRef',
4340 '*data-file-raw': 'bool',
4342 '*version': 'BlockdevQcow2Version',
4343 '*backing-file': 'str',
4344 '*backing-fmt': 'BlockdevDriver',
4345 '*encrypt': 'QCryptoBlockCreateOptions',
4346 '*cluster-size': 'size',
4347 '*preallocation': 'PreallocMode',
4348 '*lazy-refcounts': 'bool',
4349 '*refcount-bits': 'int',
4350 '*compression-type':'Qcow2CompressionType' } }
4353 # @BlockdevCreateOptionsQed:
4355 # Driver specific image creation options for qed.
4357 # @file: Node to create the image format on
4358 # @size: Size of the virtual disk in bytes
4359 # @backing-file: File name of the backing file if a backing file
4361 # @backing-fmt: Name of the block driver to use for the backing file
4362 # @cluster-size: Cluster size in bytes (default: 65536)
4363 # @table-size: L1/L2 table size (in clusters)
4367 { 'struct': 'BlockdevCreateOptionsQed',
4368 'data': { 'file': 'BlockdevRef',
4370 '*backing-file': 'str',
4371 '*backing-fmt': 'BlockdevDriver',
4372 '*cluster-size': 'size',
4373 '*table-size': 'int' } }
4376 # @BlockdevCreateOptionsRbd:
4378 # Driver specific image creation options for rbd/Ceph.
4380 # @location: Where to store the new image file. This location cannot
4381 # point to a snapshot.
4382 # @size: Size of the virtual disk in bytes
4383 # @cluster-size: RBD object size
4387 { 'struct': 'BlockdevCreateOptionsRbd',
4388 'data': { 'location': 'BlockdevOptionsRbd',
4390 '*cluster-size' : 'size' } }
4393 # @BlockdevVmdkSubformat:
4395 # Subformat options for VMDK images
4397 # @monolithicSparse: Single file image with sparse cluster allocation
4399 # @monolithicFlat: Single flat data image and a descriptor file
4401 # @twoGbMaxExtentSparse: Data is split into 2GB (per virtual LBA) sparse extent
4402 # files, in addition to a descriptor file
4404 # @twoGbMaxExtentFlat: Data is split into 2GB (per virtual LBA) flat extent
4405 # files, in addition to a descriptor file
4407 # @streamOptimized: Single file image sparse cluster allocation, optimized
4408 # for streaming over network.
4412 { 'enum': 'BlockdevVmdkSubformat',
4413 'data': [ 'monolithicSparse', 'monolithicFlat', 'twoGbMaxExtentSparse',
4414 'twoGbMaxExtentFlat', 'streamOptimized'] }
4417 # @BlockdevVmdkAdapterType:
4419 # Adapter type info for VMDK images
4423 { 'enum': 'BlockdevVmdkAdapterType',
4424 'data': [ 'ide', 'buslogic', 'lsilogic', 'legacyESX'] }
4427 # @BlockdevCreateOptionsVmdk:
4429 # Driver specific image creation options for VMDK.
4431 # @file: Where to store the new image file. This refers to the image
4432 # file for monolithcSparse and streamOptimized format, or the
4433 # descriptor file for other formats.
4434 # @size: Size of the virtual disk in bytes
4435 # @extents: Where to store the data extents. Required for monolithcFlat,
4436 # twoGbMaxExtentSparse and twoGbMaxExtentFlat formats. For
4437 # monolithicFlat, only one entry is required; for
4438 # twoGbMaxExtent* formats, the number of entries required is
4439 # calculated as extent_number = virtual_size / 2GB. Providing
4440 # more extents than will be used is an error.
4441 # @subformat: The subformat of the VMDK image. Default: "monolithicSparse".
4442 # @backing-file: The path of backing file. Default: no backing file is used.
4443 # @adapter-type: The adapter type used to fill in the descriptor. Default: ide.
4444 # @hwversion: Hardware version. The meaningful options are "4" or "6".
4446 # @zeroed-grain: Whether to enable zeroed-grain feature for sparse subformats.
4451 { 'struct': 'BlockdevCreateOptionsVmdk',
4452 'data': { 'file': 'BlockdevRef',
4454 '*extents': ['BlockdevRef'],
4455 '*subformat': 'BlockdevVmdkSubformat',
4456 '*backing-file': 'str',
4457 '*adapter-type': 'BlockdevVmdkAdapterType',
4458 '*hwversion': 'str',
4459 '*zeroed-grain': 'bool' } }
4463 # @SheepdogRedundancyType:
4465 # @full: Create a fully replicated vdi with x copies
4466 # @erasure-coded: Create an erasure coded vdi with x data strips and
4471 { 'enum': 'SheepdogRedundancyType',
4472 'data': [ 'full', 'erasure-coded' ] }
4475 # @SheepdogRedundancyFull:
4477 # @copies: Number of copies to use (between 1 and 31)
4481 { 'struct': 'SheepdogRedundancyFull',
4482 'data': { 'copies': 'int' }}
4485 # @SheepdogRedundancyErasureCoded:
4487 # @data-strips: Number of data strips to use (one of {2,4,8,16})
4488 # @parity-strips: Number of parity strips to use (between 1 and 15)
4492 { 'struct': 'SheepdogRedundancyErasureCoded',
4493 'data': { 'data-strips': 'int',
4494 'parity-strips': 'int' }}
4497 # @SheepdogRedundancy:
4501 { 'union': 'SheepdogRedundancy',
4502 'base': { 'type': 'SheepdogRedundancyType' },
4503 'discriminator': 'type',
4504 'data': { 'full': 'SheepdogRedundancyFull',
4505 'erasure-coded': 'SheepdogRedundancyErasureCoded' } }
4508 # @BlockdevCreateOptionsSheepdog:
4510 # Driver specific image creation options for Sheepdog.
4512 # @location: Where to store the new image file
4513 # @size: Size of the virtual disk in bytes
4514 # @backing-file: File name of a base image
4515 # @preallocation: Preallocation mode for the new image (default: off;
4516 # allowed values: off, full)
4517 # @redundancy: Redundancy of the image
4518 # @object-size: Object size of the image
4522 { 'struct': 'BlockdevCreateOptionsSheepdog',
4523 'data': { 'location': 'BlockdevOptionsSheepdog',
4525 '*backing-file': 'str',
4526 '*preallocation': 'PreallocMode',
4527 '*redundancy': 'SheepdogRedundancy',
4528 '*object-size': 'size' } }
4531 # @BlockdevCreateOptionsSsh:
4533 # Driver specific image creation options for SSH.
4535 # @location: Where to store the new image file
4536 # @size: Size of the virtual disk in bytes
4540 { 'struct': 'BlockdevCreateOptionsSsh',
4541 'data': { 'location': 'BlockdevOptionsSsh',
4545 # @BlockdevCreateOptionsVdi:
4547 # Driver specific image creation options for VDI.
4549 # @file: Node to create the image format on
4550 # @size: Size of the virtual disk in bytes
4551 # @preallocation: Preallocation mode for the new image (default: off;
4552 # allowed values: off, metadata)
4556 { 'struct': 'BlockdevCreateOptionsVdi',
4557 'data': { 'file': 'BlockdevRef',
4559 '*preallocation': 'PreallocMode' } }
4562 # @BlockdevVhdxSubformat:
4564 # @dynamic: Growing image file
4565 # @fixed: Preallocated fixed-size image file
4569 { 'enum': 'BlockdevVhdxSubformat',
4570 'data': [ 'dynamic', 'fixed' ] }
4573 # @BlockdevCreateOptionsVhdx:
4575 # Driver specific image creation options for vhdx.
4577 # @file: Node to create the image format on
4578 # @size: Size of the virtual disk in bytes
4579 # @log-size: Log size in bytes, must be a multiple of 1 MB
4581 # @block-size: Block size in bytes, must be a multiple of 1 MB and not
4582 # larger than 256 MB (default: automatically choose a block
4583 # size depending on the image size)
4584 # @subformat: vhdx subformat (default: dynamic)
4585 # @block-state-zero: Force use of payload blocks of type 'ZERO'. Non-standard,
4586 # but default. Do not set to 'off' when using 'qemu-img
4587 # convert' with subformat=dynamic.
4591 { 'struct': 'BlockdevCreateOptionsVhdx',
4592 'data': { 'file': 'BlockdevRef',
4594 '*log-size': 'size',
4595 '*block-size': 'size',
4596 '*subformat': 'BlockdevVhdxSubformat',
4597 '*block-state-zero': 'bool' } }
4600 # @BlockdevVpcSubformat:
4602 # @dynamic: Growing image file
4603 # @fixed: Preallocated fixed-size image file
4607 { 'enum': 'BlockdevVpcSubformat',
4608 'data': [ 'dynamic', 'fixed' ] }
4611 # @BlockdevCreateOptionsVpc:
4613 # Driver specific image creation options for vpc (VHD).
4615 # @file: Node to create the image format on
4616 # @size: Size of the virtual disk in bytes
4617 # @subformat: vhdx subformat (default: dynamic)
4618 # @force-size: Force use of the exact byte size instead of rounding to the
4619 # next size that can be represented in CHS geometry
4624 { 'struct': 'BlockdevCreateOptionsVpc',
4625 'data': { 'file': 'BlockdevRef',
4627 '*subformat': 'BlockdevVpcSubformat',
4628 '*force-size': 'bool' } }
4631 # @BlockdevCreateOptions:
4633 # Options for creating an image format on a given node.
4635 # @driver: block driver to create the image format
4639 { 'union': 'BlockdevCreateOptions',
4641 'driver': 'BlockdevDriver' },
4642 'discriminator': 'driver',
4644 'file': 'BlockdevCreateOptionsFile',
4645 'gluster': 'BlockdevCreateOptionsGluster',
4646 'luks': 'BlockdevCreateOptionsLUKS',
4647 'nfs': 'BlockdevCreateOptionsNfs',
4648 'parallels': 'BlockdevCreateOptionsParallels',
4649 'qcow': 'BlockdevCreateOptionsQcow',
4650 'qcow2': 'BlockdevCreateOptionsQcow2',
4651 'qed': 'BlockdevCreateOptionsQed',
4652 'rbd': 'BlockdevCreateOptionsRbd',
4653 'sheepdog': 'BlockdevCreateOptionsSheepdog',
4654 'ssh': 'BlockdevCreateOptionsSsh',
4655 'vdi': 'BlockdevCreateOptionsVdi',
4656 'vhdx': 'BlockdevCreateOptionsVhdx',
4657 'vmdk': 'BlockdevCreateOptionsVmdk',
4658 'vpc': 'BlockdevCreateOptionsVpc'
4664 # Starts a job to create an image format on a given node. The job is
4665 # automatically finalized, but a manual job-dismiss is required.
4667 # @job-id: Identifier for the newly created job.
4669 # @options: Options for the image creation.
4673 { 'command': 'blockdev-create',
4674 'data': { 'job-id': 'str',
4675 'options': 'BlockdevCreateOptions' } }
4678 # @BlockErrorAction:
4680 # An enumeration of action that has been taken when a DISK I/O occurs
4682 # @ignore: error has been ignored
4684 # @report: error has been reported to the device
4686 # @stop: error caused VM to be stopped
4690 { 'enum': 'BlockErrorAction',
4691 'data': [ 'ignore', 'report', 'stop' ] }
4695 # @BLOCK_IMAGE_CORRUPTED:
4697 # Emitted when a disk image is being marked corrupt. The image can be
4698 # identified by its device or node name. The 'device' field is always
4699 # present for compatibility reasons, but it can be empty ("") if the
4700 # image does not have a device name associated.
4702 # @device: device name. This is always present for compatibility
4703 # reasons, but it can be empty ("") if the image does not
4704 # have a device name associated.
4706 # @node-name: node name (Since: 2.4)
4708 # @msg: informative message for human consumption, such as the kind of
4709 # corruption being detected. It should not be parsed by machine as it is
4710 # not guaranteed to be stable
4712 # @offset: if the corruption resulted from an image access, this is
4713 # the host's access offset into the image
4715 # @size: if the corruption resulted from an image access, this is
4718 # @fatal: if set, the image is marked corrupt and therefore unusable after this
4719 # event and must be repaired (Since 2.2; before, every
4720 # BLOCK_IMAGE_CORRUPTED event was fatal)
4722 # Note: If action is "stop", a STOP event will eventually follow the
4723 # BLOCK_IO_ERROR event.
4727 # <- { "event": "BLOCK_IMAGE_CORRUPTED",
4728 # "data": { "device": "ide0-hd0", "node-name": "node0",
4729 # "msg": "Prevented active L1 table overwrite", "offset": 196608,
4731 # "timestamp": { "seconds": 1378126126, "microseconds": 966463 } }
4735 { 'event': 'BLOCK_IMAGE_CORRUPTED',
4736 'data': { 'device' : 'str',
4737 '*node-name' : 'str',
4741 'fatal' : 'bool' } }
4746 # Emitted when a disk I/O error occurs
4748 # @device: device name. This is always present for compatibility
4749 # reasons, but it can be empty ("") if the image does not
4750 # have a device name associated.
4752 # @node-name: node name. Note that errors may be reported for the root node
4753 # that is directly attached to a guest device rather than for the
4754 # node where the error occurred. The node name is not present if
4755 # the drive is empty. (Since: 2.8)
4757 # @operation: I/O operation
4759 # @action: action that has been taken
4761 # @nospace: true if I/O error was caused due to a no-space
4762 # condition. This key is only present if query-block's
4763 # io-status is present, please see query-block documentation
4764 # for more information (since: 2.2)
4766 # @reason: human readable string describing the error cause.
4767 # (This field is a debugging aid for humans, it should not
4768 # be parsed by applications) (since: 2.2)
4770 # Note: If action is "stop", a STOP event will eventually follow the
4771 # BLOCK_IO_ERROR event
4777 # <- { "event": "BLOCK_IO_ERROR",
4778 # "data": { "device": "ide0-hd1",
4779 # "node-name": "#block212",
4780 # "operation": "write",
4781 # "action": "stop" },
4782 # "timestamp": { "seconds": 1265044230, "microseconds": 450486 } }
4785 { 'event': 'BLOCK_IO_ERROR',
4786 'data': { 'device': 'str', '*node-name': 'str',
4787 'operation': 'IoOperationType',
4788 'action': 'BlockErrorAction', '*nospace': 'bool',
4792 # @BLOCK_JOB_COMPLETED:
4794 # Emitted when a block job has completed
4798 # @device: The job identifier. Originally the device name but other
4799 # values are allowed since QEMU 2.7
4801 # @len: maximum progress value
4803 # @offset: current progress value. On success this is equal to len.
4804 # On failure this is less than len
4806 # @speed: rate limit, bytes per second
4808 # @error: error message. Only present on failure. This field
4809 # contains a human-readable error message. There are no semantics
4810 # other than that streaming has failed and clients should not try to
4811 # interpret the error string
4817 # <- { "event": "BLOCK_JOB_COMPLETED",
4818 # "data": { "type": "stream", "device": "virtio-disk0",
4819 # "len": 10737418240, "offset": 10737418240,
4821 # "timestamp": { "seconds": 1267061043, "microseconds": 959568 } }
4824 { 'event': 'BLOCK_JOB_COMPLETED',
4825 'data': { 'type' : 'JobType',
4833 # @BLOCK_JOB_CANCELLED:
4835 # Emitted when a block job has been cancelled
4839 # @device: The job identifier. Originally the device name but other
4840 # values are allowed since QEMU 2.7
4842 # @len: maximum progress value
4844 # @offset: current progress value. On success this is equal to len.
4845 # On failure this is less than len
4847 # @speed: rate limit, bytes per second
4853 # <- { "event": "BLOCK_JOB_CANCELLED",
4854 # "data": { "type": "stream", "device": "virtio-disk0",
4855 # "len": 10737418240, "offset": 134217728,
4857 # "timestamp": { "seconds": 1267061043, "microseconds": 959568 } }
4860 { 'event': 'BLOCK_JOB_CANCELLED',
4861 'data': { 'type' : 'JobType',
4870 # Emitted when a block job encounters an error
4872 # @device: The job identifier. Originally the device name but other
4873 # values are allowed since QEMU 2.7
4875 # @operation: I/O operation
4877 # @action: action that has been taken
4883 # <- { "event": "BLOCK_JOB_ERROR",
4884 # "data": { "device": "ide0-hd1",
4885 # "operation": "write",
4886 # "action": "stop" },
4887 # "timestamp": { "seconds": 1265044230, "microseconds": 450486 } }
4890 { 'event': 'BLOCK_JOB_ERROR',
4891 'data': { 'device' : 'str',
4892 'operation': 'IoOperationType',
4893 'action' : 'BlockErrorAction' } }
4898 # Emitted when a block job is ready to complete
4902 # @device: The job identifier. Originally the device name but other
4903 # values are allowed since QEMU 2.7
4905 # @len: maximum progress value
4907 # @offset: current progress value. On success this is equal to len.
4908 # On failure this is less than len
4910 # @speed: rate limit, bytes per second
4912 # Note: The "ready to complete" status is always reset by a @BLOCK_JOB_ERROR
4919 # <- { "event": "BLOCK_JOB_READY",
4920 # "data": { "device": "drive0", "type": "mirror", "speed": 0,
4921 # "len": 2097152, "offset": 2097152 }
4922 # "timestamp": { "seconds": 1265044230, "microseconds": 450486 } }
4925 { 'event': 'BLOCK_JOB_READY',
4926 'data': { 'type' : 'JobType',
4933 # @BLOCK_JOB_PENDING:
4935 # Emitted when a block job is awaiting explicit authorization to finalize graph
4936 # changes via @block-job-finalize. If this job is part of a transaction, it will
4937 # not emit this event until the transaction has converged first.
4941 # @id: The job identifier.
4947 # <- { "event": "BLOCK_JOB_WAITING",
4948 # "data": { "device": "drive0", "type": "mirror" },
4949 # "timestamp": { "seconds": 1265044230, "microseconds": 450486 } }
4952 { 'event': 'BLOCK_JOB_PENDING',
4953 'data': { 'type' : 'JobType',
4959 # Preallocation mode of QEMU image file
4961 # @off: no preallocation
4962 # @metadata: preallocate only for metadata
4963 # @falloc: like @full preallocation but allocate disk space by
4964 # posix_fallocate() rather than writing data.
4965 # @full: preallocate all data by writing it to the device to ensure
4966 # disk space is really available. This data may or may not be
4967 # zero, depending on the image format and storage.
4968 # @full preallocation also sets up metadata correctly.
4972 { 'enum': 'PreallocMode',
4973 'data': [ 'off', 'metadata', 'falloc', 'full' ] }
4976 # @BLOCK_WRITE_THRESHOLD:
4978 # Emitted when writes on block device reaches or exceeds the
4979 # configured write threshold. For thin-provisioned devices, this
4980 # means the device should be extended to avoid pausing for
4982 # The event is one shot. Once triggered, it needs to be
4983 # re-registered with another block-set-write-threshold command.
4985 # @node-name: graph node name on which the threshold was exceeded.
4987 # @amount-exceeded: amount of data which exceeded the threshold, in bytes.
4989 # @write-threshold: last configured threshold, in bytes.
4993 { 'event': 'BLOCK_WRITE_THRESHOLD',
4994 'data': { 'node-name': 'str',
4995 'amount-exceeded': 'uint64',
4996 'write-threshold': 'uint64' } }
4999 # @block-set-write-threshold:
5001 # Change the write threshold for a block drive. An event will be
5002 # delivered if a write to this block drive crosses the configured
5003 # threshold. The threshold is an offset, thus must be
5004 # non-negative. Default is no write threshold. Setting the threshold
5005 # to zero disables it.
5007 # This is useful to transparently resize thin-provisioned drives without
5008 # the guest OS noticing.
5010 # @node-name: graph node name on which the threshold must be set.
5012 # @write-threshold: configured threshold for the block device, bytes.
5013 # Use 0 to disable the threshold.
5019 # -> { "execute": "block-set-write-threshold",
5020 # "arguments": { "node-name": "mydev",
5021 # "write-threshold": 17179869184 } }
5022 # <- { "return": {} }
5025 { 'command': 'block-set-write-threshold',
5026 'data': { 'node-name': 'str', 'write-threshold': 'uint64' } }
5029 # @x-blockdev-change:
5031 # Dynamically reconfigure the block driver state graph. It can be used
5032 # to add, remove, insert or replace a graph node. Currently only the
5033 # Quorum driver implements this feature to add or remove its child. This
5034 # is useful to fix a broken quorum child.
5036 # If @node is specified, it will be inserted under @parent. @child
5037 # may not be specified in this case. If both @parent and @child are
5038 # specified but @node is not, @child will be detached from @parent.
5040 # @parent: the id or name of the parent node.
5042 # @child: the name of a child under the given parent node.
5044 # @node: the name of the node that will be added.
5046 # Note: this command is experimental, and its API is not stable. It
5047 # does not support all kinds of operations, all kinds of children, nor
5048 # all block drivers.
5050 # FIXME Removing children from a quorum node means introducing gaps in the
5051 # child indices. This cannot be represented in the 'children' list of
5052 # BlockdevOptionsQuorum, as returned by .bdrv_refresh_filename().
5054 # Warning: The data in a new quorum child MUST be consistent with that of
5055 # the rest of the array.
5061 # 1. Add a new node to a quorum
5062 # -> { "execute": "blockdev-add",
5065 # "node-name": "new_node",
5066 # "file": { "driver": "file",
5067 # "filename": "test.raw" } } }
5068 # <- { "return": {} }
5069 # -> { "execute": "x-blockdev-change",
5070 # "arguments": { "parent": "disk1",
5071 # "node": "new_node" } }
5072 # <- { "return": {} }
5074 # 2. Delete a quorum's node
5075 # -> { "execute": "x-blockdev-change",
5076 # "arguments": { "parent": "disk1",
5077 # "child": "children.1" } }
5078 # <- { "return": {} }
5081 { 'command': 'x-blockdev-change',
5082 'data' : { 'parent': 'str',
5087 # @x-blockdev-set-iothread:
5089 # Move @node and its children into the @iothread. If @iothread is null then
5090 # move @node and its children into the main loop.
5092 # The node must not be attached to a BlockBackend.
5094 # @node-name: the name of the block driver node
5096 # @iothread: the name of the IOThread object or null for the main loop
5098 # @force: true if the node and its children should be moved when a BlockBackend
5099 # is already attached
5101 # Note: this command is experimental and intended for test cases that need
5102 # control over IOThreads only.
5108 # 1. Move a node into an IOThread
5109 # -> { "execute": "x-blockdev-set-iothread",
5110 # "arguments": { "node-name": "disk1",
5111 # "iothread": "iothread0" } }
5112 # <- { "return": {} }
5114 # 2. Move a node into the main loop
5115 # -> { "execute": "x-blockdev-set-iothread",
5116 # "arguments": { "node-name": "disk1",
5117 # "iothread": null } }
5118 # <- { "return": {} }
5121 { 'command': 'x-blockdev-set-iothread',
5122 'data' : { 'node-name': 'str',
5123 'iothread': 'StrOrNull',
5124 '*force': 'bool' } }
5127 # @NbdServerOptions:
5129 # @addr: Address on which to listen.
5130 # @tls-creds: ID of the TLS credentials object (since 2.6).
5131 # @tls-authz: ID of the QAuthZ authorization object used to validate
5132 # the client's x509 distinguished name. This object is
5133 # is only resolved at time of use, so can be deleted and
5134 # recreated on the fly while the NBD server is active.
5135 # If missing, it will default to denying access (since 4.0).
5137 # Keep this type consistent with the nbd-server-start arguments. The only
5138 # intended difference is using SocketAddress instead of SocketAddressLegacy.
5142 { 'struct': 'NbdServerOptions',
5143 'data': { 'addr': 'SocketAddress',
5144 '*tls-creds': 'str',
5145 '*tls-authz': 'str'} }
5148 # @nbd-server-start:
5150 # Start an NBD server listening on the given host and port. Block
5151 # devices can then be exported using @nbd-server-add. The NBD
5152 # server will present them as named exports; for example, another
5153 # QEMU instance could refer to them as "nbd:HOST:PORT:exportname=NAME".
5155 # @addr: Address on which to listen.
5156 # @tls-creds: ID of the TLS credentials object (since 2.6).
5157 # @tls-authz: ID of the QAuthZ authorization object used to validate
5158 # the client's x509 distinguished name. This object is
5159 # is only resolved at time of use, so can be deleted and
5160 # recreated on the fly while the NBD server is active.
5161 # If missing, it will default to denying access (since 4.0).
5163 # Returns: error if the server is already running.
5165 # Keep this type consistent with the NbdServerOptions type. The only intended
5166 # difference is using SocketAddressLegacy instead of SocketAddress.
5170 { 'command': 'nbd-server-start',
5171 'data': { 'addr': 'SocketAddressLegacy',
5172 '*tls-creds': 'str',
5173 '*tls-authz': 'str'} }
5178 # An NBD block export.
5180 # @device: The device name or node name of the node to be exported
5182 # @name: Export name. If unspecified, the @device parameter is used as the
5183 # export name. (Since 2.12)
5185 # @description: Free-form description of the export, up to 4096 bytes.
5188 # @writable: Whether clients should be able to write to the device via the
5189 # NBD connection (default false).
5191 # @bitmap: Also export the dirty bitmap reachable from @device, so the
5192 # NBD client can use NBD_OPT_SET_META_CONTEXT with
5193 # "qemu:dirty-bitmap:NAME" to inspect the bitmap. (since 4.0)
5197 { 'struct': 'BlockExportNbd',
5198 'data': {'device': 'str', '*name': 'str', '*description': 'str',
5199 '*writable': 'bool', '*bitmap': 'str' } }
5204 # Export a block node to QEMU's embedded NBD server.
5206 # Returns: error if the server is not running, or export with the same name
5211 { 'command': 'nbd-server-add',
5212 'data': 'BlockExportNbd', 'boxed': true }
5215 # @NbdServerRemoveMode:
5217 # Mode for removing an NBD export.
5219 # @safe: Remove export if there are no existing connections, fail otherwise.
5221 # @hard: Drop all connections immediately and remove export.
5223 # Potential additional modes to be added in the future:
5225 # hide: Just hide export from new clients, leave existing connections as is.
5226 # Remove export after all clients are disconnected.
5228 # soft: Hide export from new clients, answer with ESHUTDOWN for all further
5229 # requests from existing clients.
5233 {'enum': 'NbdServerRemoveMode', 'data': ['safe', 'hard']}
5236 # @nbd-server-remove:
5238 # Remove NBD export by name.
5240 # @name: Export name.
5242 # @mode: Mode of command operation. See @NbdServerRemoveMode description.
5243 # Default is 'safe'.
5246 # - the server is not running
5247 # - export is not found
5248 # - mode is 'safe' and there are existing connections
5252 { 'command': 'nbd-server-remove',
5253 'data': {'name': 'str', '*mode': 'NbdServerRemoveMode'} }
5258 # Stop QEMU's embedded NBD server, and unregister all devices previously
5259 # added via @nbd-server-add.
5263 { 'command': 'nbd-server-stop' }
5268 # An enumeration of block export types
5274 { 'enum': 'BlockExportType',
5280 # Describes a block export, i.e. how single node should be exported on an
5281 # external interface.
5285 { 'union': 'BlockExport',
5286 'base': { 'type': 'BlockExportType' },
5287 'discriminator': 'type',
5289 'nbd': 'BlockExportNbd'
5295 # An enumeration of the quorum operation types
5297 # @read: read operation
5299 # @write: write operation
5301 # @flush: flush operation
5305 { 'enum': 'QuorumOpType',
5306 'data': [ 'read', 'write', 'flush' ] }
5311 # Emitted by the Quorum block driver if it fails to establish a quorum
5313 # @reference: device name if defined else node name
5315 # @sector-num: number of the first sector of the failed read operation
5317 # @sectors-count: failed read operation sector count
5319 # Note: This event is rate-limited.
5325 # <- { "event": "QUORUM_FAILURE",
5326 # "data": { "reference": "usr1", "sector-num": 345435, "sectors-count": 5 },
5327 # "timestamp": { "seconds": 1344522075, "microseconds": 745528 } }
5330 { 'event': 'QUORUM_FAILURE',
5331 'data': { 'reference': 'str', 'sector-num': 'int', 'sectors-count': 'int' } }
5334 # @QUORUM_REPORT_BAD:
5336 # Emitted to report a corruption of a Quorum file
5338 # @type: quorum operation type (Since 2.6)
5340 # @error: error message. Only present on failure. This field
5341 # contains a human-readable error message. There are no semantics other
5342 # than that the block layer reported an error and clients should not
5343 # try to interpret the error string.
5345 # @node-name: the graph node name of the block driver state
5347 # @sector-num: number of the first sector of the failed read operation
5349 # @sectors-count: failed read operation sector count
5351 # Note: This event is rate-limited.
5359 # { "event": "QUORUM_REPORT_BAD",
5360 # "data": { "node-name": "node0", "sector-num": 345435, "sectors-count": 5,
5362 # "timestamp": { "seconds": 1344522075, "microseconds": 745528 } }
5364 # 2. Flush operation
5366 # { "event": "QUORUM_REPORT_BAD",
5367 # "data": { "node-name": "node0", "sector-num": 0, "sectors-count": 2097120,
5368 # "type": "flush", "error": "Broken pipe" },
5369 # "timestamp": { "seconds": 1456406829, "microseconds": 291763 } }
5372 { 'event': 'QUORUM_REPORT_BAD',
5373 'data': { 'type': 'QuorumOpType', '*error': 'str', 'node-name': 'str',
5374 'sector-num': 'int', 'sectors-count': 'int' } }
5377 # @BlockdevSnapshotInternal:
5379 # @device: the device name or node-name of a root node to generate the snapshot
5382 # @name: the name of the internal snapshot to be created
5384 # Notes: In transaction, if @name is empty, or any snapshot matching @name
5385 # exists, the operation will fail. Only some image formats support it,
5386 # for example, qcow2, rbd, and sheepdog.
5390 { 'struct': 'BlockdevSnapshotInternal',
5391 'data': { 'device': 'str', 'name': 'str' } }
5394 # @blockdev-snapshot-internal-sync:
5396 # Synchronously take an internal snapshot of a block device, when the
5397 # format of the image used supports it. If the name is an empty
5398 # string, or a snapshot with name already exists, the operation will
5401 # For the arguments, see the documentation of BlockdevSnapshotInternal.
5403 # Returns: - nothing on success
5404 # - If @device is not a valid block device, GenericError
5405 # - If any snapshot matching @name exists, or @name is empty,
5407 # - If the format of the image used does not support it,
5408 # BlockFormatFeatureNotSupported
5414 # -> { "execute": "blockdev-snapshot-internal-sync",
5415 # "arguments": { "device": "ide-hd0",
5416 # "name": "snapshot0" }
5418 # <- { "return": {} }
5421 { 'command': 'blockdev-snapshot-internal-sync',
5422 'data': 'BlockdevSnapshotInternal' }
5425 # @blockdev-snapshot-delete-internal-sync:
5427 # Synchronously delete an internal snapshot of a block device, when the format
5428 # of the image used support it. The snapshot is identified by name or id or
5429 # both. One of the name or id is required. Return SnapshotInfo for the
5430 # successfully deleted snapshot.
5432 # @device: the device name or node-name of a root node to delete the snapshot
5435 # @id: optional the snapshot's ID to be deleted
5437 # @name: optional the snapshot's name to be deleted
5439 # Returns: - SnapshotInfo on success
5440 # - If @device is not a valid block device, GenericError
5441 # - If snapshot not found, GenericError
5442 # - If the format of the image used does not support it,
5443 # BlockFormatFeatureNotSupported
5444 # - If @id and @name are both not specified, GenericError
5450 # -> { "execute": "blockdev-snapshot-delete-internal-sync",
5451 # "arguments": { "device": "ide-hd0",
5452 # "name": "snapshot0" }
5456 # "name": "snapshot0",
5457 # "vm-state-size": 0,
5458 # "date-sec": 1000012,
5460 # "vm-clock-sec": 100,
5461 # "vm-clock-nsec": 20
5466 { 'command': 'blockdev-snapshot-delete-internal-sync',
5467 'data': { 'device': 'str', '*id': 'str', '*name': 'str'},
5468 'returns': 'SnapshotInfo' }