block/dirty-bitmap: add recording and busy properties
[qemu.git] / qapi / block-core.json
1 # -*- Mode: Python -*-
2
3 ##
4 # == Block core (VM unrelated)
5 ##
6
7 { 'include': 'common.json' }
8 { 'include': 'crypto.json' }
9 { 'include': 'job.json' }
10 { 'include': 'sockets.json' }
11
12 ##
13 # @SnapshotInfo:
14 #
15 # @id: unique snapshot id
16 #
17 # @name: user chosen name
18 #
19 # @vm-state-size: size of the VM state
20 #
21 # @date-sec: UTC date of the snapshot in seconds
22 #
23 # @date-nsec: fractional part in nano seconds to be used with date-sec
24 #
25 # @vm-clock-sec: VM clock relative to boot in seconds
26 #
27 # @vm-clock-nsec: fractional part in nano seconds to be used with vm-clock-sec
28 #
29 # Since: 1.3
30 #
31 ##
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' } }
36
37 ##
38 # @ImageInfoSpecificQCow2EncryptionBase:
39 #
40 # @format: The encryption format
41 #
42 # Since: 2.10
43 ##
44 { 'struct': 'ImageInfoSpecificQCow2EncryptionBase',
45   'data': { 'format': 'BlockdevQcow2EncryptionFormat'}}
46
47 ##
48 # @ImageInfoSpecificQCow2Encryption:
49 #
50 # Since: 2.10
51 ##
52 { 'union': 'ImageInfoSpecificQCow2Encryption',
53   'base': 'ImageInfoSpecificQCow2EncryptionBase',
54   'discriminator': 'format',
55   'data': { 'luks': 'QCryptoBlockInfoLUKS' } }
56
57 ##
58 # @ImageInfoSpecificQCow2:
59 #
60 # @compat: compatibility level
61 #
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)
64 #
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)
68 #
69 # @lazy-refcounts: on or off; only valid for compat >= 1.1
70 #
71 # @corrupt: true if the image has been marked corrupt; only valid for
72 #           compat >= 1.1 (since 2.2)
73 #
74 # @refcount-bits: width of a refcount entry in bits (since 2.3)
75 #
76 # @encrypt: details about encryption parameters; only set if image
77 #           is encrypted (since 2.10)
78 #
79 # @bitmaps: A list of qcow2 bitmap details (since 4.0)
80 #
81 # Since: 1.7
82 ##
83 { 'struct': 'ImageInfoSpecificQCow2',
84   'data': {
85       'compat': 'str',
86       '*data-file': 'str',
87       '*data-file-raw': 'bool',
88       '*lazy-refcounts': 'bool',
89       '*corrupt': 'bool',
90       'refcount-bits': 'int',
91       '*encrypt': 'ImageInfoSpecificQCow2Encryption',
92       '*bitmaps': ['Qcow2BitmapInfo']
93   } }
94
95 ##
96 # @ImageInfoSpecificVmdk:
97 #
98 # @create-type: The create type of VMDK image
99 #
100 # @cid: Content id of image
101 #
102 # @parent-cid: Parent VMDK image's cid
103 #
104 # @extents: List of extent files
105 #
106 # Since: 1.7
107 ##
108 { 'struct': 'ImageInfoSpecificVmdk',
109   'data': {
110       'create-type': 'str',
111       'cid': 'int',
112       'parent-cid': 'int',
113       'extents': ['ImageInfo']
114   } }
115
116 ##
117 # @ImageInfoSpecific:
118 #
119 # A discriminated record of image format specific information structures.
120 #
121 # Since: 1.7
122 ##
123 { 'union': 'ImageInfoSpecific',
124   'data': {
125       'qcow2': 'ImageInfoSpecificQCow2',
126       'vmdk': 'ImageInfoSpecificVmdk',
127       # If we need to add block driver specific parameters for
128       # LUKS in future, then we'll subclass QCryptoBlockInfoLUKS
129       # to define a ImageInfoSpecificLUKS
130       'luks': 'QCryptoBlockInfoLUKS'
131   } }
132
133 ##
134 # @ImageInfo:
135 #
136 # Information about a QEMU image file
137 #
138 # @filename: name of the image file
139 #
140 # @format: format of the image file
141 #
142 # @virtual-size: maximum capacity in bytes of the image
143 #
144 # @actual-size: actual size on disk in bytes of the image
145 #
146 # @dirty-flag: true if image is not cleanly closed
147 #
148 # @cluster-size: size of a cluster in bytes
149 #
150 # @encrypted: true if the image is encrypted
151 #
152 # @compressed: true if the image is compressed (Since 1.7)
153 #
154 # @backing-filename: name of the backing file
155 #
156 # @full-backing-filename: full path of the backing file
157 #
158 # @backing-filename-format: the format of the backing file
159 #
160 # @snapshots: list of VM snapshots
161 #
162 # @backing-image: info of the backing image (since 1.6)
163 #
164 # @format-specific: structure supplying additional format-specific
165 # information (since 1.7)
166 #
167 # Since: 1.3
168 #
169 ##
170 { 'struct': 'ImageInfo',
171   'data': {'filename': 'str', 'format': 'str', '*dirty-flag': 'bool',
172            '*actual-size': 'int', 'virtual-size': 'int',
173            '*cluster-size': 'int', '*encrypted': 'bool', '*compressed': 'bool',
174            '*backing-filename': 'str', '*full-backing-filename': 'str',
175            '*backing-filename-format': 'str', '*snapshots': ['SnapshotInfo'],
176            '*backing-image': 'ImageInfo',
177            '*format-specific': 'ImageInfoSpecific' } }
178
179 ##
180 # @ImageCheck:
181 #
182 # Information about a QEMU image file check
183 #
184 # @filename: name of the image file checked
185 #
186 # @format: format of the image file checked
187 #
188 # @check-errors: number of unexpected errors occurred during check
189 #
190 # @image-end-offset: offset (in bytes) where the image ends, this
191 #                    field is present if the driver for the image format
192 #                    supports it
193 #
194 # @corruptions: number of corruptions found during the check if any
195 #
196 # @leaks: number of leaks found during the check if any
197 #
198 # @corruptions-fixed: number of corruptions fixed during the check
199 #                     if any
200 #
201 # @leaks-fixed: number of leaks fixed during the check if any
202 #
203 # @total-clusters: total number of clusters, this field is present
204 #                  if the driver for the image format supports it
205 #
206 # @allocated-clusters: total number of allocated clusters, this
207 #                      field is present if the driver for the image format
208 #                      supports it
209 #
210 # @fragmented-clusters: total number of fragmented clusters, this
211 #                       field is present if the driver for the image format
212 #                       supports it
213 #
214 # @compressed-clusters: total number of compressed clusters, this
215 #                       field is present if the driver for the image format
216 #                       supports it
217 #
218 # Since: 1.4
219 #
220 ##
221 { 'struct': 'ImageCheck',
222   'data': {'filename': 'str', 'format': 'str', 'check-errors': 'int',
223            '*image-end-offset': 'int', '*corruptions': 'int', '*leaks': 'int',
224            '*corruptions-fixed': 'int', '*leaks-fixed': 'int',
225            '*total-clusters': 'int', '*allocated-clusters': 'int',
226            '*fragmented-clusters': 'int', '*compressed-clusters': 'int' } }
227
228 ##
229 # @MapEntry:
230 #
231 # Mapping information from a virtual block range to a host file range
232 #
233 # @start: the start byte of the mapped virtual range
234 #
235 # @length: the number of bytes of the mapped virtual range
236 #
237 # @data: whether the mapped range has data
238 #
239 # @zero: whether the virtual blocks are zeroed
240 #
241 # @depth: the depth of the mapping
242 #
243 # @offset: the offset in file that the virtual sectors are mapped to
244 #
245 # @filename: filename that is referred to by @offset
246 #
247 # Since: 2.6
248 #
249 ##
250 { 'struct': 'MapEntry',
251   'data': {'start': 'int', 'length': 'int', 'data': 'bool',
252            'zero': 'bool', 'depth': 'int', '*offset': 'int',
253            '*filename': 'str' } }
254
255 ##
256 # @BlockdevCacheInfo:
257 #
258 # Cache mode information for a block device
259 #
260 # @writeback:   true if writeback mode is enabled
261 # @direct:      true if the host page cache is bypassed (O_DIRECT)
262 # @no-flush:    true if flush requests are ignored for the device
263 #
264 # Since: 2.3
265 ##
266 { 'struct': 'BlockdevCacheInfo',
267   'data': { 'writeback': 'bool',
268             'direct': 'bool',
269             'no-flush': 'bool' } }
270
271 ##
272 # @BlockDeviceInfo:
273 #
274 # Information about the backing device for a block device.
275 #
276 # @file: the filename of the backing device
277 #
278 # @node-name: the name of the block driver node (Since 2.0)
279 #
280 # @ro: true if the backing device was open read-only
281 #
282 # @drv: the name of the block format used to open the backing device. As of
283 #       0.14.0 this can be: 'blkdebug', 'bochs', 'cloop', 'cow', 'dmg',
284 #       'file', 'file', 'ftp', 'ftps', 'host_cdrom', 'host_device',
285 #       'http', 'https', 'luks', 'nbd', 'parallels', 'qcow',
286 #       'qcow2', 'raw', 'vdi', 'vmdk', 'vpc', 'vvfat'
287 #       2.2: 'archipelago' added, 'cow' dropped
288 #       2.3: 'host_floppy' deprecated
289 #       2.5: 'host_floppy' dropped
290 #       2.6: 'luks' added
291 #       2.8: 'replication' added, 'tftp' dropped
292 #       2.9: 'archipelago' dropped
293 #
294 # @backing_file: the name of the backing file (for copy-on-write)
295 #
296 # @backing_file_depth: number of files in the backing file chain (since: 1.2)
297 #
298 # @encrypted: true if the backing device is encrypted
299 #
300 # @encryption_key_missing: Deprecated; always false
301 #
302 # @detect_zeroes: detect and optimize zero writes (Since 2.1)
303 #
304 # @bps: total throughput limit in bytes per second is specified
305 #
306 # @bps_rd: read throughput limit in bytes per second is specified
307 #
308 # @bps_wr: write throughput limit in bytes per second is specified
309 #
310 # @iops: total I/O operations per second is specified
311 #
312 # @iops_rd: read I/O operations per second is specified
313 #
314 # @iops_wr: write I/O operations per second is specified
315 #
316 # @image: the info of image used (since: 1.6)
317 #
318 # @bps_max: total throughput limit during bursts,
319 #                     in bytes (Since 1.7)
320 #
321 # @bps_rd_max: read throughput limit during bursts,
322 #                        in bytes (Since 1.7)
323 #
324 # @bps_wr_max: write throughput limit during bursts,
325 #                        in bytes (Since 1.7)
326 #
327 # @iops_max: total I/O operations per second during bursts,
328 #                      in bytes (Since 1.7)
329 #
330 # @iops_rd_max: read I/O operations per second during bursts,
331 #                         in bytes (Since 1.7)
332 #
333 # @iops_wr_max: write I/O operations per second during bursts,
334 #                         in bytes (Since 1.7)
335 #
336 # @bps_max_length: maximum length of the @bps_max burst
337 #                            period, in seconds. (Since 2.6)
338 #
339 # @bps_rd_max_length: maximum length of the @bps_rd_max
340 #                               burst period, in seconds. (Since 2.6)
341 #
342 # @bps_wr_max_length: maximum length of the @bps_wr_max
343 #                               burst period, in seconds. (Since 2.6)
344 #
345 # @iops_max_length: maximum length of the @iops burst
346 #                             period, in seconds. (Since 2.6)
347 #
348 # @iops_rd_max_length: maximum length of the @iops_rd_max
349 #                                burst period, in seconds. (Since 2.6)
350 #
351 # @iops_wr_max_length: maximum length of the @iops_wr_max
352 #                                burst period, in seconds. (Since 2.6)
353 #
354 # @iops_size: an I/O size in bytes (Since 1.7)
355 #
356 # @group: throttle group name (Since 2.4)
357 #
358 # @cache: the cache mode used for the block device (since: 2.3)
359 #
360 # @write_threshold: configured write threshold for the device.
361 #                   0 if disabled. (Since 2.3)
362 #
363 # Since: 0.14.0
364 #
365 ##
366 { 'struct': 'BlockDeviceInfo',
367   'data': { 'file': 'str', '*node-name': 'str', 'ro': 'bool', 'drv': 'str',
368             '*backing_file': 'str', 'backing_file_depth': 'int',
369             'encrypted': 'bool', 'encryption_key_missing': 'bool',
370             'detect_zeroes': 'BlockdevDetectZeroesOptions',
371             'bps': 'int', 'bps_rd': 'int', 'bps_wr': 'int',
372             'iops': 'int', 'iops_rd': 'int', 'iops_wr': 'int',
373             'image': 'ImageInfo',
374             '*bps_max': 'int', '*bps_rd_max': 'int',
375             '*bps_wr_max': 'int', '*iops_max': 'int',
376             '*iops_rd_max': 'int', '*iops_wr_max': 'int',
377             '*bps_max_length': 'int', '*bps_rd_max_length': 'int',
378             '*bps_wr_max_length': 'int', '*iops_max_length': 'int',
379             '*iops_rd_max_length': 'int', '*iops_wr_max_length': 'int',
380             '*iops_size': 'int', '*group': 'str', 'cache': 'BlockdevCacheInfo',
381             'write_threshold': 'int' } }
382
383 ##
384 # @BlockDeviceIoStatus:
385 #
386 # An enumeration of block device I/O status.
387 #
388 # @ok: The last I/O operation has succeeded
389 #
390 # @failed: The last I/O operation has failed
391 #
392 # @nospace: The last I/O operation has failed due to a no-space condition
393 #
394 # Since: 1.0
395 ##
396 { 'enum': 'BlockDeviceIoStatus', 'data': [ 'ok', 'failed', 'nospace' ] }
397
398 ##
399 # @BlockDeviceMapEntry:
400 #
401 # Entry in the metadata map of the device (returned by "qemu-img map")
402 #
403 # @start: Offset in the image of the first byte described by this entry
404 #         (in bytes)
405 #
406 # @length: Length of the range described by this entry (in bytes)
407 #
408 # @depth: Number of layers (0 = top image, 1 = top image's backing file, etc.)
409 #         before reaching one for which the range is allocated.  The value is
410 #         in the range 0 to the depth of the image chain - 1.
411 #
412 # @zero: the sectors in this range read as zeros
413 #
414 # @data: reading the image will actually read data from a file (in particular,
415 #        if @offset is present this means that the sectors are not simply
416 #        preallocated, but contain actual data in raw format)
417 #
418 # @offset: if present, the image file stores the data for this range in
419 #          raw format at the given offset.
420 #
421 # Since: 1.7
422 ##
423 { 'struct': 'BlockDeviceMapEntry',
424   'data': { 'start': 'int', 'length': 'int', 'depth': 'int', 'zero': 'bool',
425             'data': 'bool', '*offset': 'int' } }
426
427 ##
428 # @DirtyBitmapStatus:
429 #
430 # An enumeration of possible states that a dirty bitmap can report to the user.
431 #
432 # @frozen: The bitmap is currently in-use by some operation and is immutable.
433 #          If the bitmap was @active prior to the operation, new writes by the
434 #          guest are being recorded in a temporary buffer, and will not be lost.
435 #          Generally, bitmaps are cleared on successful use in an operation and
436 #          the temporary buffer is committed into the bitmap. On failure, the
437 #          temporary buffer is merged back into the bitmap without first
438 #          clearing it.
439 #          Please refer to the documentation for each bitmap-using operation,
440 #          See also @blockdev-backup, @drive-backup.
441 #
442 # @disabled: The bitmap is not currently recording new writes by the guest.
443 #            This is requested explicitly via @block-dirty-bitmap-disable.
444 #            It can still be cleared, deleted, or used for backup operations.
445 #
446 # @active: The bitmap is actively monitoring for new writes, and can be cleared,
447 #          deleted, or used for backup operations.
448 #
449 # @locked: The bitmap is currently in-use by some operation and is immutable.
450 #          If the bitmap was @active prior to the operation, it is still
451 #          recording new writes. If the bitmap was @disabled, it is not
452 #          recording new writes. (Since 2.12)
453 #
454 # Since: 2.4
455 ##
456 { 'enum': 'DirtyBitmapStatus',
457   'data': ['active', 'disabled', 'frozen', 'locked'] }
458
459 ##
460 # @BlockDirtyInfo:
461 #
462 # Block dirty bitmap information.
463 #
464 # @name: the name of the dirty bitmap (Since 2.4)
465 #
466 # @count: number of dirty bytes according to the dirty bitmap
467 #
468 # @granularity: granularity of the dirty bitmap in bytes (since 1.4)
469 #
470 # @status: Deprecated in favor of @recording and @locked. (since 2.4)
471 #
472 # @recording: true if the bitmap is recording new writes from the guest.
473 #             Replaces `active` and `disabled` statuses. (since 4.0)
474 #
475 # @busy: true if the bitmap is in-use by some operation (NBD or jobs)
476 #        and cannot be modified via QMP or used by another operation.
477 #        Replaces `locked` and `frozen` statuses. (since 4.0)
478 #
479 # @persistent: true if the bitmap will eventually be flushed to persistent
480 #              storage (since 4.0)
481 #
482 # Since: 1.3
483 ##
484 { 'struct': 'BlockDirtyInfo',
485   'data': {'*name': 'str', 'count': 'int', 'granularity': 'uint32',
486            'recording': 'bool', 'busy': 'bool',
487            'status': 'DirtyBitmapStatus', 'persistent': 'bool' } }
488
489 ##
490 # @Qcow2BitmapInfoFlags:
491 #
492 # An enumeration of flags that a bitmap can report to the user.
493 #
494 # @in-use: This flag is set by any process actively modifying the qcow2 file,
495 #          and cleared when the updated bitmap is flushed to the qcow2 image.
496 #          The presence of this flag in an offline image means that the bitmap
497 #          was not saved correctly after its last usage, and may contain
498 #          inconsistent data.
499 #
500 # @auto: The bitmap must reflect all changes of the virtual disk by any
501 #        application that would write to this qcow2 file.
502 #
503 # Since: 4.0
504 ##
505 { 'enum': 'Qcow2BitmapInfoFlags',
506   'data': ['in-use', 'auto'] }
507
508 ##
509 # @Qcow2BitmapInfo:
510 #
511 # Qcow2 bitmap information.
512 #
513 # @name: the name of the bitmap
514 #
515 # @granularity: granularity of the bitmap in bytes
516 #
517 # @flags: flags of the bitmap
518 #
519 # Since: 4.0
520 ##
521 { 'struct': 'Qcow2BitmapInfo',
522   'data': {'name': 'str', 'granularity': 'uint32',
523            'flags': ['Qcow2BitmapInfoFlags'] } }
524
525 ##
526 # @BlockLatencyHistogramInfo:
527 #
528 # Block latency histogram.
529 #
530 # @boundaries: list of interval boundary values in nanoseconds, all greater
531 #              than zero and in ascending order.
532 #              For example, the list [10, 50, 100] produces the following
533 #              histogram intervals: [0, 10), [10, 50), [50, 100), [100, +inf).
534 #
535 # @bins: list of io request counts corresponding to histogram intervals.
536 #        len(@bins) = len(@boundaries) + 1
537 #        For the example above, @bins may be something like [3, 1, 5, 2],
538 #        and corresponding histogram looks like:
539 #
540 #        5|           *
541 #        4|           *
542 #        3| *         *
543 #        2| *         *    *
544 #        1| *    *    *    *
545 #         +------------------
546 #             10   50   100
547 #
548 # Since: 2.12
549 ##
550 { 'struct': 'BlockLatencyHistogramInfo',
551   'data': {'boundaries': ['uint64'], 'bins': ['uint64'] } }
552
553 ##
554 # @x-block-latency-histogram-set:
555 #
556 # Manage read, write and flush latency histograms for the device.
557 #
558 # If only @device parameter is specified, remove all present latency histograms
559 # for the device. Otherwise, add/reset some of (or all) latency histograms.
560 #
561 # @device: device name to set latency histogram for.
562 #
563 # @boundaries: list of interval boundary values (see description in
564 #              BlockLatencyHistogramInfo definition). If specified, all
565 #              latency histograms are removed, and empty ones created for all
566 #              io types with intervals corresponding to @boundaries (except for
567 #              io types, for which specific boundaries are set through the
568 #              following parameters).
569 #
570 # @boundaries-read: list of interval boundary values for read latency
571 #                   histogram. If specified, old read latency histogram is
572 #                   removed, and empty one created with intervals
573 #                   corresponding to @boundaries-read. The parameter has higher
574 #                   priority then @boundaries.
575 #
576 # @boundaries-write: list of interval boundary values for write latency
577 #                    histogram.
578 #
579 # @boundaries-flush: list of interval boundary values for flush latency
580 #                    histogram.
581 #
582 # Returns: error if device is not found or any boundary arrays are invalid.
583 #
584 # Since: 2.12
585 #
586 # Example: set new histograms for all io types with intervals
587 # [0, 10), [10, 50), [50, 100), [100, +inf):
588 #
589 # -> { "execute": "block-latency-histogram-set",
590 #      "arguments": { "device": "drive0",
591 #                     "boundaries": [10, 50, 100] } }
592 # <- { "return": {} }
593 #
594 # Example: set new histogram only for write, other histograms will remain
595 # not changed (or not created):
596 #
597 # -> { "execute": "block-latency-histogram-set",
598 #      "arguments": { "device": "drive0",
599 #                     "boundaries-write": [10, 50, 100] } }
600 # <- { "return": {} }
601 #
602 # Example: set new histograms with the following intervals:
603 #   read, flush: [0, 10), [10, 50), [50, 100), [100, +inf)
604 #   write: [0, 1000), [1000, 5000), [5000, +inf)
605 #
606 # -> { "execute": "block-latency-histogram-set",
607 #      "arguments": { "device": "drive0",
608 #                     "boundaries": [10, 50, 100],
609 #                     "boundaries-write": [1000, 5000] } }
610 # <- { "return": {} }
611 #
612 # Example: remove all latency histograms:
613 #
614 # -> { "execute": "block-latency-histogram-set",
615 #      "arguments": { "device": "drive0" } }
616 # <- { "return": {} }
617 ##
618 { 'command': 'x-block-latency-histogram-set',
619   'data': {'device': 'str',
620            '*boundaries': ['uint64'],
621            '*boundaries-read': ['uint64'],
622            '*boundaries-write': ['uint64'],
623            '*boundaries-flush': ['uint64'] } }
624
625 ##
626 # @BlockInfo:
627 #
628 # Block device information.  This structure describes a virtual device and
629 # the backing device associated with it.
630 #
631 # @device: The device name associated with the virtual device.
632 #
633 # @qdev: The qdev ID, or if no ID is assigned, the QOM path of the block
634 #        device. (since 2.10)
635 #
636 # @type: This field is returned only for compatibility reasons, it should
637 #        not be used (always returns 'unknown')
638 #
639 # @removable: True if the device supports removable media.
640 #
641 # @locked: True if the guest has locked this device from having its media
642 #          removed
643 #
644 # @tray_open: True if the device's tray is open
645 #             (only present if it has a tray)
646 #
647 # @dirty-bitmaps: dirty bitmaps information (only present if the
648 #                 driver has one or more dirty bitmaps) (Since 2.0)
649 #
650 # @io-status: @BlockDeviceIoStatus. Only present if the device
651 #             supports it and the VM is configured to stop on errors
652 #             (supported device models: virtio-blk, IDE, SCSI except
653 #             scsi-generic)
654 #
655 # @inserted: @BlockDeviceInfo describing the device if media is
656 #            present
657 #
658 # Since:  0.14.0
659 ##
660 { 'struct': 'BlockInfo',
661   'data': {'device': 'str', '*qdev': 'str', 'type': 'str', 'removable': 'bool',
662            'locked': 'bool', '*inserted': 'BlockDeviceInfo',
663            '*tray_open': 'bool', '*io-status': 'BlockDeviceIoStatus',
664            '*dirty-bitmaps': ['BlockDirtyInfo'] } }
665
666 ##
667 # @BlockMeasureInfo:
668 #
669 # Image file size calculation information.  This structure describes the size
670 # requirements for creating a new image file.
671 #
672 # The size requirements depend on the new image file format.  File size always
673 # equals virtual disk size for the 'raw' format, even for sparse POSIX files.
674 # Compact formats such as 'qcow2' represent unallocated and zero regions
675 # efficiently so file size may be smaller than virtual disk size.
676 #
677 # The values are upper bounds that are guaranteed to fit the new image file.
678 # Subsequent modification, such as internal snapshot or bitmap creation, may
679 # require additional space and is not covered here.
680 #
681 # @required: Size required for a new image file, in bytes.
682 #
683 # @fully-allocated: Image file size, in bytes, once data has been written
684 #                   to all sectors.
685 #
686 # Since: 2.10
687 ##
688 { 'struct': 'BlockMeasureInfo',
689   'data': {'required': 'int', 'fully-allocated': 'int'} }
690
691 ##
692 # @query-block:
693 #
694 # Get a list of BlockInfo for all virtual block devices.
695 #
696 # Returns: a list of @BlockInfo describing each virtual block device. Filter
697 # nodes that were created implicitly are skipped over.
698 #
699 # Since: 0.14.0
700 #
701 # Example:
702 #
703 # -> { "execute": "query-block" }
704 # <- {
705 #       "return":[
706 #          {
707 #             "io-status": "ok",
708 #             "device":"ide0-hd0",
709 #             "locked":false,
710 #             "removable":false,
711 #             "inserted":{
712 #                "ro":false,
713 #                "drv":"qcow2",
714 #                "encrypted":false,
715 #                "file":"disks/test.qcow2",
716 #                "backing_file_depth":1,
717 #                "bps":1000000,
718 #                "bps_rd":0,
719 #                "bps_wr":0,
720 #                "iops":1000000,
721 #                "iops_rd":0,
722 #                "iops_wr":0,
723 #                "bps_max": 8000000,
724 #                "bps_rd_max": 0,
725 #                "bps_wr_max": 0,
726 #                "iops_max": 0,
727 #                "iops_rd_max": 0,
728 #                "iops_wr_max": 0,
729 #                "iops_size": 0,
730 #                "detect_zeroes": "on",
731 #                "write_threshold": 0,
732 #                "image":{
733 #                   "filename":"disks/test.qcow2",
734 #                   "format":"qcow2",
735 #                   "virtual-size":2048000,
736 #                   "backing_file":"base.qcow2",
737 #                   "full-backing-filename":"disks/base.qcow2",
738 #                   "backing-filename-format":"qcow2",
739 #                   "snapshots":[
740 #                      {
741 #                         "id": "1",
742 #                         "name": "snapshot1",
743 #                         "vm-state-size": 0,
744 #                         "date-sec": 10000200,
745 #                         "date-nsec": 12,
746 #                         "vm-clock-sec": 206,
747 #                         "vm-clock-nsec": 30
748 #                      }
749 #                   ],
750 #                   "backing-image":{
751 #                       "filename":"disks/base.qcow2",
752 #                       "format":"qcow2",
753 #                       "virtual-size":2048000
754 #                   }
755 #                }
756 #             },
757 #             "qdev": "ide_disk",
758 #             "type":"unknown"
759 #          },
760 #          {
761 #             "io-status": "ok",
762 #             "device":"ide1-cd0",
763 #             "locked":false,
764 #             "removable":true,
765 #             "qdev": "/machine/unattached/device[23]",
766 #             "tray_open": false,
767 #             "type":"unknown"
768 #          },
769 #          {
770 #             "device":"floppy0",
771 #             "locked":false,
772 #             "removable":true,
773 #             "qdev": "/machine/unattached/device[20]",
774 #             "type":"unknown"
775 #          },
776 #          {
777 #             "device":"sd0",
778 #             "locked":false,
779 #             "removable":true,
780 #             "type":"unknown"
781 #          }
782 #       ]
783 #    }
784 #
785 ##
786 { 'command': 'query-block', 'returns': ['BlockInfo'] }
787
788
789 ##
790 # @BlockDeviceTimedStats:
791 #
792 # Statistics of a block device during a given interval of time.
793 #
794 # @interval_length: Interval used for calculating the statistics,
795 #                   in seconds.
796 #
797 # @min_rd_latency_ns: Minimum latency of read operations in the
798 #                     defined interval, in nanoseconds.
799 #
800 # @min_wr_latency_ns: Minimum latency of write operations in the
801 #                     defined interval, in nanoseconds.
802 #
803 # @min_flush_latency_ns: Minimum latency of flush operations in the
804 #                        defined interval, in nanoseconds.
805 #
806 # @max_rd_latency_ns: Maximum latency of read operations in the
807 #                     defined interval, in nanoseconds.
808 #
809 # @max_wr_latency_ns: Maximum latency of write operations in the
810 #                     defined interval, in nanoseconds.
811 #
812 # @max_flush_latency_ns: Maximum latency of flush operations in the
813 #                        defined interval, in nanoseconds.
814 #
815 # @avg_rd_latency_ns: Average latency of read operations in the
816 #                     defined interval, in nanoseconds.
817 #
818 # @avg_wr_latency_ns: Average latency of write operations in the
819 #                     defined interval, in nanoseconds.
820 #
821 # @avg_flush_latency_ns: Average latency of flush operations in the
822 #                        defined interval, in nanoseconds.
823 #
824 # @avg_rd_queue_depth: Average number of pending read operations
825 #                      in the defined interval.
826 #
827 # @avg_wr_queue_depth: Average number of pending write operations
828 #                      in the defined interval.
829 #
830 # Since: 2.5
831 ##
832 { 'struct': 'BlockDeviceTimedStats',
833   'data': { 'interval_length': 'int', 'min_rd_latency_ns': 'int',
834             'max_rd_latency_ns': 'int', 'avg_rd_latency_ns': 'int',
835             'min_wr_latency_ns': 'int', 'max_wr_latency_ns': 'int',
836             'avg_wr_latency_ns': 'int', 'min_flush_latency_ns': 'int',
837             'max_flush_latency_ns': 'int', 'avg_flush_latency_ns': 'int',
838             'avg_rd_queue_depth': 'number', 'avg_wr_queue_depth': 'number' } }
839
840 ##
841 # @BlockDeviceStats:
842 #
843 # Statistics of a virtual block device or a block backing device.
844 #
845 # @rd_bytes:      The number of bytes read by the device.
846 #
847 # @wr_bytes:      The number of bytes written by the device.
848 #
849 # @rd_operations: The number of read operations performed by the device.
850 #
851 # @wr_operations: The number of write operations performed by the device.
852 #
853 # @flush_operations: The number of cache flush operations performed by the
854 #                    device (since 0.15.0)
855 #
856 # @flush_total_time_ns: Total time spend on cache flushes in nano-seconds
857 #                       (since 0.15.0).
858 #
859 # @wr_total_time_ns: Total time spend on writes in nano-seconds (since 0.15.0).
860 #
861 # @rd_total_time_ns: Total_time_spend on reads in nano-seconds (since 0.15.0).
862 #
863 # @wr_highest_offset: The offset after the greatest byte written to the
864 #                     device.  The intended use of this information is for
865 #                     growable sparse files (like qcow2) that are used on top
866 #                     of a physical device.
867 #
868 # @rd_merged: Number of read requests that have been merged into another
869 #             request (Since 2.3).
870 #
871 # @wr_merged: Number of write requests that have been merged into another
872 #             request (Since 2.3).
873 #
874 # @idle_time_ns: Time since the last I/O operation, in
875 #                nanoseconds. If the field is absent it means that
876 #                there haven't been any operations yet (Since 2.5).
877 #
878 # @failed_rd_operations: The number of failed read operations
879 #                        performed by the device (Since 2.5)
880 #
881 # @failed_wr_operations: The number of failed write operations
882 #                        performed by the device (Since 2.5)
883 #
884 # @failed_flush_operations: The number of failed flush operations
885 #                           performed by the device (Since 2.5)
886 #
887 # @invalid_rd_operations: The number of invalid read operations
888 #                          performed by the device (Since 2.5)
889 #
890 # @invalid_wr_operations: The number of invalid write operations
891 #                         performed by the device (Since 2.5)
892 #
893 # @invalid_flush_operations: The number of invalid flush operations
894 #                            performed by the device (Since 2.5)
895 #
896 # @account_invalid: Whether invalid operations are included in the
897 #                   last access statistics (Since 2.5)
898 #
899 # @account_failed: Whether failed operations are included in the
900 #                  latency and last access statistics (Since 2.5)
901 #
902 # @timed_stats: Statistics specific to the set of previously defined
903 #               intervals of time (Since 2.5)
904 #
905 # @x_rd_latency_histogram: @BlockLatencyHistogramInfo. (Since 2.12)
906 #
907 # @x_wr_latency_histogram: @BlockLatencyHistogramInfo. (Since 2.12)
908 #
909 # @x_flush_latency_histogram: @BlockLatencyHistogramInfo. (Since 2.12)
910 #
911 # Since: 0.14.0
912 ##
913 { 'struct': 'BlockDeviceStats',
914   'data': {'rd_bytes': 'int', 'wr_bytes': 'int', 'rd_operations': 'int',
915            'wr_operations': 'int', 'flush_operations': 'int',
916            'flush_total_time_ns': 'int', 'wr_total_time_ns': 'int',
917            'rd_total_time_ns': 'int', 'wr_highest_offset': 'int',
918            'rd_merged': 'int', 'wr_merged': 'int', '*idle_time_ns': 'int',
919            'failed_rd_operations': 'int', 'failed_wr_operations': 'int',
920            'failed_flush_operations': 'int', 'invalid_rd_operations': 'int',
921            'invalid_wr_operations': 'int', 'invalid_flush_operations': 'int',
922            'account_invalid': 'bool', 'account_failed': 'bool',
923            'timed_stats': ['BlockDeviceTimedStats'],
924            '*x_rd_latency_histogram': 'BlockLatencyHistogramInfo',
925            '*x_wr_latency_histogram': 'BlockLatencyHistogramInfo',
926            '*x_flush_latency_histogram': 'BlockLatencyHistogramInfo' } }
927
928 ##
929 # @BlockStats:
930 #
931 # Statistics of a virtual block device or a block backing device.
932 #
933 # @device: If the stats are for a virtual block device, the name
934 #          corresponding to the virtual block device.
935 #
936 # @node-name: The node name of the device. (Since 2.3)
937 #
938 # @qdev: The qdev ID, or if no ID is assigned, the QOM path of the block
939 #        device. (since 3.0)
940 #
941 # @stats:  A @BlockDeviceStats for the device.
942 #
943 # @parent: This describes the file block device if it has one.
944 #          Contains recursively the statistics of the underlying
945 #          protocol (e.g. the host file for a qcow2 image). If there is
946 #          no underlying protocol, this field is omitted
947 #
948 # @backing: This describes the backing block device if it has one.
949 #           (Since 2.0)
950 #
951 # Since: 0.14.0
952 ##
953 { 'struct': 'BlockStats',
954   'data': {'*device': 'str', '*qdev': 'str', '*node-name': 'str',
955            'stats': 'BlockDeviceStats',
956            '*parent': 'BlockStats',
957            '*backing': 'BlockStats'} }
958
959 ##
960 # @query-blockstats:
961 #
962 # Query the @BlockStats for all virtual block devices.
963 #
964 # @query-nodes: If true, the command will query all the block nodes
965 #               that have a node name, in a list which will include "parent"
966 #               information, but not "backing".
967 #               If false or omitted, the behavior is as before - query all the
968 #               device backends, recursively including their "parent" and
969 #               "backing". Filter nodes that were created implicitly are
970 #               skipped over in this mode. (Since 2.3)
971 #
972 # Returns: A list of @BlockStats for each virtual block devices.
973 #
974 # Since: 0.14.0
975 #
976 # Example:
977 #
978 # -> { "execute": "query-blockstats" }
979 # <- {
980 #       "return":[
981 #          {
982 #             "device":"ide0-hd0",
983 #             "parent":{
984 #                "stats":{
985 #                   "wr_highest_offset":3686448128,
986 #                   "wr_bytes":9786368,
987 #                   "wr_operations":751,
988 #                   "rd_bytes":122567168,
989 #                   "rd_operations":36772
990 #                   "wr_total_times_ns":313253456
991 #                   "rd_total_times_ns":3465673657
992 #                   "flush_total_times_ns":49653
993 #                   "flush_operations":61,
994 #                   "rd_merged":0,
995 #                   "wr_merged":0,
996 #                   "idle_time_ns":2953431879,
997 #                   "account_invalid":true,
998 #                   "account_failed":false
999 #                }
1000 #             },
1001 #             "stats":{
1002 #                "wr_highest_offset":2821110784,
1003 #                "wr_bytes":9786368,
1004 #                "wr_operations":692,
1005 #                "rd_bytes":122739200,
1006 #                "rd_operations":36604
1007 #                "flush_operations":51,
1008 #                "wr_total_times_ns":313253456
1009 #                "rd_total_times_ns":3465673657
1010 #                "flush_total_times_ns":49653,
1011 #                "rd_merged":0,
1012 #                "wr_merged":0,
1013 #                "idle_time_ns":2953431879,
1014 #                "account_invalid":true,
1015 #                "account_failed":false
1016 #             },
1017 #             "qdev": "/machine/unattached/device[23]"
1018 #          },
1019 #          {
1020 #             "device":"ide1-cd0",
1021 #             "stats":{
1022 #                "wr_highest_offset":0,
1023 #                "wr_bytes":0,
1024 #                "wr_operations":0,
1025 #                "rd_bytes":0,
1026 #                "rd_operations":0
1027 #                "flush_operations":0,
1028 #                "wr_total_times_ns":0
1029 #                "rd_total_times_ns":0
1030 #                "flush_total_times_ns":0,
1031 #                "rd_merged":0,
1032 #                "wr_merged":0,
1033 #                "account_invalid":false,
1034 #                "account_failed":false
1035 #             },
1036 #             "qdev": "/machine/unattached/device[24]"
1037 #          },
1038 #          {
1039 #             "device":"floppy0",
1040 #             "stats":{
1041 #                "wr_highest_offset":0,
1042 #                "wr_bytes":0,
1043 #                "wr_operations":0,
1044 #                "rd_bytes":0,
1045 #                "rd_operations":0
1046 #                "flush_operations":0,
1047 #                "wr_total_times_ns":0
1048 #                "rd_total_times_ns":0
1049 #                "flush_total_times_ns":0,
1050 #                "rd_merged":0,
1051 #                "wr_merged":0,
1052 #                "account_invalid":false,
1053 #                "account_failed":false
1054 #             },
1055 #             "qdev": "/machine/unattached/device[16]"
1056 #          },
1057 #          {
1058 #             "device":"sd0",
1059 #             "stats":{
1060 #                "wr_highest_offset":0,
1061 #                "wr_bytes":0,
1062 #                "wr_operations":0,
1063 #                "rd_bytes":0,
1064 #                "rd_operations":0
1065 #                "flush_operations":0,
1066 #                "wr_total_times_ns":0
1067 #                "rd_total_times_ns":0
1068 #                "flush_total_times_ns":0,
1069 #                "rd_merged":0,
1070 #                "wr_merged":0,
1071 #                "account_invalid":false,
1072 #                "account_failed":false
1073 #             }
1074 #          }
1075 #       ]
1076 #    }
1077 #
1078 ##
1079 { 'command': 'query-blockstats',
1080   'data': { '*query-nodes': 'bool' },
1081   'returns': ['BlockStats'] }
1082
1083 ##
1084 # @BlockdevOnError:
1085 #
1086 # An enumeration of possible behaviors for errors on I/O operations.
1087 # The exact meaning depends on whether the I/O was initiated by a guest
1088 # or by a block job
1089 #
1090 # @report: for guest operations, report the error to the guest;
1091 #          for jobs, cancel the job
1092 #
1093 # @ignore: ignore the error, only report a QMP event (BLOCK_IO_ERROR
1094 #          or BLOCK_JOB_ERROR)
1095 #
1096 # @enospc: same as @stop on ENOSPC, same as @report otherwise.
1097 #
1098 # @stop: for guest operations, stop the virtual machine;
1099 #        for jobs, pause the job
1100 #
1101 # @auto: inherit the error handling policy of the backend (since: 2.7)
1102 #
1103 # Since: 1.3
1104 ##
1105 { 'enum': 'BlockdevOnError',
1106   'data': ['report', 'ignore', 'enospc', 'stop', 'auto'] }
1107
1108 ##
1109 # @MirrorSyncMode:
1110 #
1111 # An enumeration of possible behaviors for the initial synchronization
1112 # phase of storage mirroring.
1113 #
1114 # @top: copies data in the topmost image to the destination
1115 #
1116 # @full: copies data from all images to the destination
1117 #
1118 # @none: only copy data written from now on
1119 #
1120 # @incremental: only copy data described by the dirty bitmap. Since: 2.4
1121 #
1122 # Since: 1.3
1123 ##
1124 { 'enum': 'MirrorSyncMode',
1125   'data': ['top', 'full', 'none', 'incremental'] }
1126
1127 ##
1128 # @MirrorCopyMode:
1129 #
1130 # An enumeration whose values tell the mirror block job when to
1131 # trigger writes to the target.
1132 #
1133 # @background: copy data in background only.
1134 #
1135 # @write-blocking: when data is written to the source, write it
1136 #                  (synchronously) to the target as well.  In
1137 #                  addition, data is copied in background just like in
1138 #                  @background mode.
1139 #
1140 # Since: 3.0
1141 ##
1142 { 'enum': 'MirrorCopyMode',
1143   'data': ['background', 'write-blocking'] }
1144
1145 ##
1146 # @BlockJobInfo:
1147 #
1148 # Information about a long-running block device operation.
1149 #
1150 # @type: the job type ('stream' for image streaming)
1151 #
1152 # @device: The job identifier. Originally the device name but other
1153 #          values are allowed since QEMU 2.7
1154 #
1155 # @len: Estimated @offset value at the completion of the job. This value can
1156 #       arbitrarily change while the job is running, in both directions.
1157 #
1158 # @offset: Progress made until now. The unit is arbitrary and the value can
1159 #          only meaningfully be used for the ratio of @offset to @len. The
1160 #          value is monotonically increasing.
1161 #
1162 # @busy: false if the job is known to be in a quiescent state, with
1163 #        no pending I/O.  Since 1.3.
1164 #
1165 # @paused: whether the job is paused or, if @busy is true, will
1166 #          pause itself as soon as possible.  Since 1.3.
1167 #
1168 # @speed: the rate limit, bytes per second
1169 #
1170 # @io-status: the status of the job (since 1.3)
1171 #
1172 # @ready: true if the job may be completed (since 2.2)
1173 #
1174 # @status: Current job state/status (since 2.12)
1175 #
1176 # @auto-finalize: Job will finalize itself when PENDING, moving to
1177 #                 the CONCLUDED state. (since 2.12)
1178 #
1179 # @auto-dismiss: Job will dismiss itself when CONCLUDED, moving to the NULL
1180 #                state and disappearing from the query list. (since 2.12)
1181 #
1182 # @error: Error information if the job did not complete successfully.
1183 #         Not set if the job completed successfully. (since 2.12.1)
1184 #
1185 # Since: 1.1
1186 ##
1187 { 'struct': 'BlockJobInfo',
1188   'data': {'type': 'str', 'device': 'str', 'len': 'int',
1189            'offset': 'int', 'busy': 'bool', 'paused': 'bool', 'speed': 'int',
1190            'io-status': 'BlockDeviceIoStatus', 'ready': 'bool',
1191            'status': 'JobStatus',
1192            'auto-finalize': 'bool', 'auto-dismiss': 'bool',
1193            '*error': 'str' } }
1194
1195 ##
1196 # @query-block-jobs:
1197 #
1198 # Return information about long-running block device operations.
1199 #
1200 # Returns: a list of @BlockJobInfo for each active block job
1201 #
1202 # Since: 1.1
1203 ##
1204 { 'command': 'query-block-jobs', 'returns': ['BlockJobInfo'] }
1205
1206 ##
1207 # @block_passwd:
1208 #
1209 # This command sets the password of a block device that has not been open
1210 # with a password and requires one.
1211 #
1212 # This command is now obsolete and will always return an error since 2.10
1213 #
1214 ##
1215 { 'command': 'block_passwd',
1216   'data': { '*device': 'str',
1217             '*node-name': 'str',
1218             'password': 'str' } }
1219
1220 ##
1221 # @block_resize:
1222 #
1223 # Resize a block image while a guest is running.
1224 #
1225 # Either @device or @node-name must be set but not both.
1226 #
1227 # @device: the name of the device to get the image resized
1228 #
1229 # @node-name: graph node name to get the image resized (Since 2.0)
1230 #
1231 # @size:  new image size in bytes
1232 #
1233 # Returns: nothing on success
1234 #          If @device is not a valid block device, DeviceNotFound
1235 #
1236 # Since: 0.14.0
1237 #
1238 # Example:
1239 #
1240 # -> { "execute": "block_resize",
1241 #      "arguments": { "device": "scratch", "size": 1073741824 } }
1242 # <- { "return": {} }
1243 #
1244 ##
1245 { 'command': 'block_resize',
1246   'data': { '*device': 'str',
1247             '*node-name': 'str',
1248             'size': 'int' } }
1249
1250 ##
1251 # @NewImageMode:
1252 #
1253 # An enumeration that tells QEMU how to set the backing file path in
1254 # a new image file.
1255 #
1256 # @existing: QEMU should look for an existing image file.
1257 #
1258 # @absolute-paths: QEMU should create a new image with absolute paths
1259 # for the backing file. If there is no backing file available, the new
1260 # image will not be backed either.
1261 #
1262 # Since: 1.1
1263 ##
1264 { 'enum': 'NewImageMode',
1265   'data': [ 'existing', 'absolute-paths' ] }
1266
1267 ##
1268 # @BlockdevSnapshotSync:
1269 #
1270 # Either @device or @node-name must be set but not both.
1271 #
1272 # @device: the name of the device to generate the snapshot from.
1273 #
1274 # @node-name: graph node name to generate the snapshot from (Since 2.0)
1275 #
1276 # @snapshot-file: the target of the new image. If the file exists, or
1277 # if it is a device, the snapshot will be created in the existing
1278 # file/device. Otherwise, a new file will be created.
1279 #
1280 # @snapshot-node-name: the graph node name of the new image (Since 2.0)
1281 #
1282 # @format: the format of the snapshot image, default is 'qcow2'.
1283 #
1284 # @mode: whether and how QEMU should create a new image, default is
1285 #        'absolute-paths'.
1286 ##
1287 { 'struct': 'BlockdevSnapshotSync',
1288   'data': { '*device': 'str', '*node-name': 'str',
1289             'snapshot-file': 'str', '*snapshot-node-name': 'str',
1290             '*format': 'str', '*mode': 'NewImageMode' } }
1291
1292 ##
1293 # @BlockdevSnapshot:
1294 #
1295 # @node: device or node name that will have a snapshot created.
1296 #
1297 # @overlay: reference to the existing block device that will become
1298 #           the overlay of @node, as part of creating the snapshot.
1299 #           It must not have a current backing file (this can be
1300 #           achieved by passing "backing": null to blockdev-add).
1301 #
1302 # Since: 2.5
1303 ##
1304 { 'struct': 'BlockdevSnapshot',
1305   'data': { 'node': 'str', 'overlay': 'str' } }
1306
1307 ##
1308 # @DriveBackup:
1309 #
1310 # @job-id: identifier for the newly-created block job. If
1311 #          omitted, the device name will be used. (Since 2.7)
1312 #
1313 # @device: the device name or node-name of a root node which should be copied.
1314 #
1315 # @target: the target of the new image. If the file exists, or if it
1316 #          is a device, the existing file/device will be used as the new
1317 #          destination.  If it does not exist, a new file will be created.
1318 #
1319 # @format: the format of the new destination, default is to
1320 #          probe if @mode is 'existing', else the format of the source
1321 #
1322 # @sync: what parts of the disk image should be copied to the destination
1323 #        (all the disk, only the sectors allocated in the topmost image, from a
1324 #        dirty bitmap, or only new I/O).
1325 #
1326 # @mode: whether and how QEMU should create a new image, default is
1327 #        'absolute-paths'.
1328 #
1329 # @speed: the maximum speed, in bytes per second
1330 #
1331 # @bitmap: the name of dirty bitmap if sync is "incremental".
1332 #          Must be present if sync is "incremental", must NOT be present
1333 #          otherwise. (Since 2.4)
1334 #
1335 # @compress: true to compress data, if the target format supports it.
1336 #            (default: false) (since 2.8)
1337 #
1338 # @on-source-error: the action to take on an error on the source,
1339 #                   default 'report'.  'stop' and 'enospc' can only be used
1340 #                   if the block device supports io-status (see BlockInfo).
1341 #
1342 # @on-target-error: the action to take on an error on the target,
1343 #                   default 'report' (no limitations, since this applies to
1344 #                   a different block device than @device).
1345 #
1346 # @auto-finalize: When false, this job will wait in a PENDING state after it has
1347 #                 finished its work, waiting for @block-job-finalize before
1348 #                 making any block graph changes.
1349 #                 When true, this job will automatically
1350 #                 perform its abort or commit actions.
1351 #                 Defaults to true. (Since 2.12)
1352 #
1353 # @auto-dismiss: When false, this job will wait in a CONCLUDED state after it
1354 #                has completely ceased all work, and awaits @block-job-dismiss.
1355 #                When true, this job will automatically disappear from the query
1356 #                list without user intervention.
1357 #                Defaults to true. (Since 2.12)
1358 #
1359 # Note: @on-source-error and @on-target-error only affect background
1360 # I/O.  If an error occurs during a guest write request, the device's
1361 # rerror/werror actions will be used.
1362 #
1363 # Since: 1.6
1364 ##
1365 { 'struct': 'DriveBackup',
1366   'data': { '*job-id': 'str', 'device': 'str', 'target': 'str',
1367             '*format': 'str', 'sync': 'MirrorSyncMode',
1368             '*mode': 'NewImageMode', '*speed': 'int',
1369             '*bitmap': 'str', '*compress': 'bool',
1370             '*on-source-error': 'BlockdevOnError',
1371             '*on-target-error': 'BlockdevOnError',
1372             '*auto-finalize': 'bool', '*auto-dismiss': 'bool' } }
1373
1374 ##
1375 # @BlockdevBackup:
1376 #
1377 # @job-id: identifier for the newly-created block job. If
1378 #          omitted, the device name will be used. (Since 2.7)
1379 #
1380 # @device: the device name or node-name of a root node which should be copied.
1381 #
1382 # @target: the device name or node-name of the backup target node.
1383 #
1384 # @sync: what parts of the disk image should be copied to the destination
1385 #        (all the disk, only the sectors allocated in the topmost image, or
1386 #        only new I/O).
1387 #
1388 # @speed: the maximum speed, in bytes per second. The default is 0,
1389 #         for unlimited.
1390 #
1391 # @bitmap: the name of dirty bitmap if sync is "incremental".
1392 #          Must be present if sync is "incremental", must NOT be present
1393 #          otherwise. (Since 3.1)
1394 #
1395 # @compress: true to compress data, if the target format supports it.
1396 #            (default: false) (since 2.8)
1397 #
1398 # @on-source-error: the action to take on an error on the source,
1399 #                   default 'report'.  'stop' and 'enospc' can only be used
1400 #                   if the block device supports io-status (see BlockInfo).
1401 #
1402 # @on-target-error: the action to take on an error on the target,
1403 #                   default 'report' (no limitations, since this applies to
1404 #                   a different block device than @device).
1405 #
1406 # @auto-finalize: When false, this job will wait in a PENDING state after it has
1407 #                 finished its work, waiting for @block-job-finalize before
1408 #                 making any block graph changes.
1409 #                 When true, this job will automatically
1410 #                 perform its abort or commit actions.
1411 #                 Defaults to true. (Since 2.12)
1412 #
1413 # @auto-dismiss: When false, this job will wait in a CONCLUDED state after it
1414 #                has completely ceased all work, and awaits @block-job-dismiss.
1415 #                When true, this job will automatically disappear from the query
1416 #                list without user intervention.
1417 #                Defaults to true. (Since 2.12)
1418 #
1419 # Note: @on-source-error and @on-target-error only affect background
1420 # I/O.  If an error occurs during a guest write request, the device's
1421 # rerror/werror actions will be used.
1422 #
1423 # Since: 2.3
1424 ##
1425 { 'struct': 'BlockdevBackup',
1426   'data': { '*job-id': 'str', 'device': 'str', 'target': 'str',
1427             'sync': 'MirrorSyncMode', '*speed': 'int',
1428             '*bitmap': 'str', '*compress': 'bool',
1429             '*on-source-error': 'BlockdevOnError',
1430             '*on-target-error': 'BlockdevOnError',
1431             '*auto-finalize': 'bool', '*auto-dismiss': 'bool' } }
1432
1433 ##
1434 # @blockdev-snapshot-sync:
1435 #
1436 # Generates a synchronous snapshot of a block device.
1437 #
1438 # For the arguments, see the documentation of BlockdevSnapshotSync.
1439 #
1440 # Returns: nothing on success
1441 #          If @device is not a valid block device, DeviceNotFound
1442 #
1443 # Since: 0.14.0
1444 #
1445 # Example:
1446 #
1447 # -> { "execute": "blockdev-snapshot-sync",
1448 #      "arguments": { "device": "ide-hd0",
1449 #                     "snapshot-file":
1450 #                     "/some/place/my-image",
1451 #                     "format": "qcow2" } }
1452 # <- { "return": {} }
1453 #
1454 ##
1455 { 'command': 'blockdev-snapshot-sync',
1456   'data': 'BlockdevSnapshotSync' }
1457
1458
1459 ##
1460 # @blockdev-snapshot:
1461 #
1462 # Generates a snapshot of a block device.
1463 #
1464 # Create a snapshot, by installing 'node' as the backing image of
1465 # 'overlay'. Additionally, if 'node' is associated with a block
1466 # device, the block device changes to using 'overlay' as its new active
1467 # image.
1468 #
1469 # For the arguments, see the documentation of BlockdevSnapshot.
1470 #
1471 # Since: 2.5
1472 #
1473 # Example:
1474 #
1475 # -> { "execute": "blockdev-add",
1476 #      "arguments": { "driver": "qcow2",
1477 #                     "node-name": "node1534",
1478 #                     "file": { "driver": "file",
1479 #                               "filename": "hd1.qcow2" },
1480 #                     "backing": null } }
1481 #
1482 # <- { "return": {} }
1483 #
1484 # -> { "execute": "blockdev-snapshot",
1485 #      "arguments": { "node": "ide-hd0",
1486 #                     "overlay": "node1534" } }
1487 # <- { "return": {} }
1488 #
1489 ##
1490 { 'command': 'blockdev-snapshot',
1491   'data': 'BlockdevSnapshot' }
1492
1493 ##
1494 # @change-backing-file:
1495 #
1496 # Change the backing file in the image file metadata.  This does not
1497 # cause QEMU to reopen the image file to reparse the backing filename
1498 # (it may, however, perform a reopen to change permissions from
1499 # r/o -> r/w -> r/o, if needed). The new backing file string is written
1500 # into the image file metadata, and the QEMU internal strings are
1501 # updated.
1502 #
1503 # @image-node-name: The name of the block driver state node of the
1504 #                   image to modify. The "device" argument is used
1505 #                   to verify "image-node-name" is in the chain
1506 #                   described by "device".
1507 #
1508 # @device:          The device name or node-name of the root node that owns
1509 #                   image-node-name.
1510 #
1511 # @backing-file:    The string to write as the backing file.  This
1512 #                   string is not validated, so care should be taken
1513 #                   when specifying the string or the image chain may
1514 #                   not be able to be reopened again.
1515 #
1516 # Returns: Nothing on success
1517 #
1518 #          If "device" does not exist or cannot be determined, DeviceNotFound
1519 #
1520 # Since: 2.1
1521 ##
1522 { 'command': 'change-backing-file',
1523   'data': { 'device': 'str', 'image-node-name': 'str',
1524             'backing-file': 'str' } }
1525
1526 ##
1527 # @block-commit:
1528 #
1529 # Live commit of data from overlay image nodes into backing nodes - i.e.,
1530 # writes data between 'top' and 'base' into 'base'.
1531 #
1532 # @job-id: identifier for the newly-created block job. If
1533 #          omitted, the device name will be used. (Since 2.7)
1534 #
1535 # @device:  the device name or node-name of a root node
1536 #
1537 # @base-node: The node name of the backing image to write data into.
1538 #             If not specified, this is the deepest backing image.
1539 #             (since: 3.1)
1540 #
1541 # @base: Same as @base-node, except that it is a file name rather than a node
1542 #        name. This must be the exact filename string that was used to open the
1543 #        node; other strings, even if addressing the same file, are not
1544 #        accepted (deprecated, use @base-node instead)
1545 #
1546 # @top-node: The node name of the backing image within the image chain
1547 #            which contains the topmost data to be committed down. If
1548 #            not specified, this is the active layer. (since: 3.1)
1549 #
1550 # @top: Same as @top-node, except that it is a file name rather than a node
1551 #       name. This must be the exact filename string that was used to open the
1552 #       node; other strings, even if addressing the same file, are not
1553 #       accepted (deprecated, use @base-node instead)
1554 #
1555 # @backing-file:  The backing file string to write into the overlay
1556 #                           image of 'top'.  If 'top' is the active layer,
1557 #                           specifying a backing file string is an error. This
1558 #                           filename is not validated.
1559 #
1560 #                           If a pathname string is such that it cannot be
1561 #                           resolved by QEMU, that means that subsequent QMP or
1562 #                           HMP commands must use node-names for the image in
1563 #                           question, as filename lookup methods will fail.
1564 #
1565 #                           If not specified, QEMU will automatically determine
1566 #                           the backing file string to use, or error out if
1567 #                           there is no obvious choice. Care should be taken
1568 #                           when specifying the string, to specify a valid
1569 #                           filename or protocol.
1570 #                           (Since 2.1)
1571 #
1572 #                    If top == base, that is an error.
1573 #                    If top == active, the job will not be completed by itself,
1574 #                    user needs to complete the job with the block-job-complete
1575 #                    command after getting the ready event. (Since 2.0)
1576 #
1577 #                    If the base image is smaller than top, then the base image
1578 #                    will be resized to be the same size as top.  If top is
1579 #                    smaller than the base image, the base will not be
1580 #                    truncated.  If you want the base image size to match the
1581 #                    size of the smaller top, you can safely truncate it
1582 #                    yourself once the commit operation successfully completes.
1583 #
1584 # @speed:  the maximum speed, in bytes per second
1585 #
1586 # @filter-node-name: the node name that should be assigned to the
1587 #                    filter driver that the commit job inserts into the graph
1588 #                    above @top. If this option is not given, a node name is
1589 #                    autogenerated. (Since: 2.9)
1590 #
1591 # @auto-finalize: When false, this job will wait in a PENDING state after it has
1592 #                 finished its work, waiting for @block-job-finalize before
1593 #                 making any block graph changes.
1594 #                 When true, this job will automatically
1595 #                 perform its abort or commit actions.
1596 #                 Defaults to true. (Since 3.1)
1597 #
1598 # @auto-dismiss: When false, this job will wait in a CONCLUDED state after it
1599 #                has completely ceased all work, and awaits @block-job-dismiss.
1600 #                When true, this job will automatically disappear from the query
1601 #                list without user intervention.
1602 #                Defaults to true. (Since 3.1)
1603 #
1604 # Returns: Nothing on success
1605 #          If @device does not exist, DeviceNotFound
1606 #          Any other error returns a GenericError.
1607 #
1608 # Since: 1.3
1609 #
1610 # Example:
1611 #
1612 # -> { "execute": "block-commit",
1613 #      "arguments": { "device": "virtio0",
1614 #                     "top": "/tmp/snap1.qcow2" } }
1615 # <- { "return": {} }
1616 #
1617 ##
1618 { 'command': 'block-commit',
1619   'data': { '*job-id': 'str', 'device': 'str', '*base-node': 'str',
1620             '*base': 'str', '*top-node': 'str', '*top': 'str',
1621             '*backing-file': 'str', '*speed': 'int',
1622             '*filter-node-name': 'str',
1623             '*auto-finalize': 'bool', '*auto-dismiss': 'bool' } }
1624
1625 ##
1626 # @drive-backup:
1627 #
1628 # Start a point-in-time copy of a block device to a new destination.  The
1629 # status of ongoing drive-backup operations can be checked with
1630 # query-block-jobs where the BlockJobInfo.type field has the value 'backup'.
1631 # The operation can be stopped before it has completed using the
1632 # block-job-cancel command.
1633 #
1634 # Returns: nothing on success
1635 #          If @device is not a valid block device, GenericError
1636 #
1637 # Since: 1.6
1638 #
1639 # Example:
1640 #
1641 # -> { "execute": "drive-backup",
1642 #      "arguments": { "device": "drive0",
1643 #                     "sync": "full",
1644 #                     "target": "backup.img" } }
1645 # <- { "return": {} }
1646 #
1647 ##
1648 { 'command': 'drive-backup', 'boxed': true,
1649   'data': 'DriveBackup' }
1650
1651 ##
1652 # @blockdev-backup:
1653 #
1654 # Start a point-in-time copy of a block device to a new destination.  The
1655 # status of ongoing blockdev-backup operations can be checked with
1656 # query-block-jobs where the BlockJobInfo.type field has the value 'backup'.
1657 # The operation can be stopped before it has completed using the
1658 # block-job-cancel command.
1659 #
1660 # Returns: nothing on success
1661 #          If @device is not a valid block device, DeviceNotFound
1662 #
1663 # Since: 2.3
1664 #
1665 # Example:
1666 # -> { "execute": "blockdev-backup",
1667 #      "arguments": { "device": "src-id",
1668 #                     "sync": "full",
1669 #                     "target": "tgt-id" } }
1670 # <- { "return": {} }
1671 #
1672 ##
1673 { 'command': 'blockdev-backup', 'boxed': true,
1674   'data': 'BlockdevBackup' }
1675
1676
1677 ##
1678 # @query-named-block-nodes:
1679 #
1680 # Get the named block driver list
1681 #
1682 # Returns: the list of BlockDeviceInfo
1683 #
1684 # Since: 2.0
1685 #
1686 # Example:
1687 #
1688 # -> { "execute": "query-named-block-nodes" }
1689 # <- { "return": [ { "ro":false,
1690 #                    "drv":"qcow2",
1691 #                    "encrypted":false,
1692 #                    "file":"disks/test.qcow2",
1693 #                    "node-name": "my-node",
1694 #                    "backing_file_depth":1,
1695 #                    "bps":1000000,
1696 #                    "bps_rd":0,
1697 #                    "bps_wr":0,
1698 #                    "iops":1000000,
1699 #                    "iops_rd":0,
1700 #                    "iops_wr":0,
1701 #                    "bps_max": 8000000,
1702 #                    "bps_rd_max": 0,
1703 #                    "bps_wr_max": 0,
1704 #                    "iops_max": 0,
1705 #                    "iops_rd_max": 0,
1706 #                    "iops_wr_max": 0,
1707 #                    "iops_size": 0,
1708 #                    "write_threshold": 0,
1709 #                    "image":{
1710 #                       "filename":"disks/test.qcow2",
1711 #                       "format":"qcow2",
1712 #                       "virtual-size":2048000,
1713 #                       "backing_file":"base.qcow2",
1714 #                       "full-backing-filename":"disks/base.qcow2",
1715 #                       "backing-filename-format":"qcow2",
1716 #                       "snapshots":[
1717 #                          {
1718 #                             "id": "1",
1719 #                             "name": "snapshot1",
1720 #                             "vm-state-size": 0,
1721 #                             "date-sec": 10000200,
1722 #                             "date-nsec": 12,
1723 #                             "vm-clock-sec": 206,
1724 #                             "vm-clock-nsec": 30
1725 #                          }
1726 #                       ],
1727 #                       "backing-image":{
1728 #                           "filename":"disks/base.qcow2",
1729 #                           "format":"qcow2",
1730 #                           "virtual-size":2048000
1731 #                       }
1732 #                    } } ] }
1733 #
1734 ##
1735 { 'command': 'query-named-block-nodes', 'returns': [ 'BlockDeviceInfo' ] }
1736
1737 ##
1738 # @XDbgBlockGraphNodeType:
1739 #
1740 # @block-backend: corresponds to BlockBackend
1741 #
1742 # @block-job: corresonds to BlockJob
1743 #
1744 # @block-driver: corresponds to BlockDriverState
1745 #
1746 # Since: 4.0
1747 ##
1748 { 'enum': 'XDbgBlockGraphNodeType',
1749   'data': [ 'block-backend', 'block-job', 'block-driver' ] }
1750
1751 ##
1752 # @XDbgBlockGraphNode:
1753 #
1754 # @id: Block graph node identifier. This @id is generated only for
1755 #      x-debug-query-block-graph and does not relate to any other identifiers in
1756 #      Qemu.
1757 #
1758 # @type: Type of graph node. Can be one of block-backend, block-job or
1759 #        block-driver-state.
1760 #
1761 # @name: Human readable name of the node. Corresponds to node-name for
1762 #        block-driver-state nodes; is not guaranteed to be unique in the whole
1763 #        graph (with block-jobs and block-backends).
1764 #
1765 # Since: 4.0
1766 ##
1767 { 'struct': 'XDbgBlockGraphNode',
1768   'data': { 'id': 'uint64', 'type': 'XDbgBlockGraphNodeType', 'name': 'str' } }
1769
1770 ##
1771 # @BlockPermission:
1772 #
1773 # Enum of base block permissions.
1774 #
1775 # @consistent-read: A user that has the "permission" of consistent reads is
1776 #                   guaranteed that their view of the contents of the block
1777 #                   device is complete and self-consistent, representing the
1778 #                   contents of a disk at a specific point.
1779 #                   For most block devices (including their backing files) this
1780 #                   is true, but the property cannot be maintained in a few
1781 #                   situations like for intermediate nodes of a commit block
1782 #                   job.
1783 #
1784 # @write: This permission is required to change the visible disk contents.
1785 #
1786 # @write-unchanged: This permission (which is weaker than BLK_PERM_WRITE) is
1787 #                   both enough and required for writes to the block node when
1788 #                   the caller promises that the visible disk content doesn't
1789 #                   change.
1790 #                   As the BLK_PERM_WRITE permission is strictly stronger,
1791 #                   either is sufficient to perform an unchanging write.
1792 #
1793 # @resize: This permission is required to change the size of a block node.
1794 #
1795 # @graph-mod: This permission is required to change the node that this
1796 #             BdrvChild points to.
1797 #
1798 # Since: 4.0
1799 ##
1800   { 'enum': 'BlockPermission',
1801     'data': [ 'consistent-read', 'write', 'write-unchanged', 'resize',
1802               'graph-mod' ] }
1803 ##
1804 # @XDbgBlockGraphEdge:
1805 #
1806 # Block Graph edge description for x-debug-query-block-graph.
1807 #
1808 # @parent: parent id
1809 #
1810 # @child: child id
1811 #
1812 # @name: name of the relation (examples are 'file' and 'backing')
1813 #
1814 # @perm: granted permissions for the parent operating on the child
1815 #
1816 # @shared-perm: permissions that can still be granted to other users of the
1817 #               child while it is still attached to this parent
1818 #
1819 # Since: 4.0
1820 ##
1821 { 'struct': 'XDbgBlockGraphEdge',
1822   'data': { 'parent': 'uint64', 'child': 'uint64',
1823             'name': 'str', 'perm': [ 'BlockPermission' ],
1824             'shared-perm': [ 'BlockPermission' ] } }
1825
1826 ##
1827 # @XDbgBlockGraph:
1828 #
1829 # Block Graph - list of nodes and list of edges.
1830 #
1831 # Since: 4.0
1832 ##
1833 { 'struct': 'XDbgBlockGraph',
1834   'data': { 'nodes': ['XDbgBlockGraphNode'], 'edges': ['XDbgBlockGraphEdge'] } }
1835
1836 ##
1837 # @x-debug-query-block-graph:
1838 #
1839 # Get the block graph.
1840 #
1841 # Since: 4.0
1842 ##
1843 { 'command': 'x-debug-query-block-graph', 'returns': 'XDbgBlockGraph' }
1844
1845 ##
1846 # @drive-mirror:
1847 #
1848 # Start mirroring a block device's writes to a new destination. target
1849 # specifies the target of the new image. If the file exists, or if it
1850 # is a device, it will be used as the new destination for writes. If
1851 # it does not exist, a new file will be created. format specifies the
1852 # format of the mirror image, default is to probe if mode='existing',
1853 # else the format of the source.
1854 #
1855 # Returns: nothing on success
1856 #          If @device is not a valid block device, GenericError
1857 #
1858 # Since: 1.3
1859 #
1860 # Example:
1861 #
1862 # -> { "execute": "drive-mirror",
1863 #      "arguments": { "device": "ide-hd0",
1864 #                     "target": "/some/place/my-image",
1865 #                     "sync": "full",
1866 #                     "format": "qcow2" } }
1867 # <- { "return": {} }
1868 #
1869 ##
1870 { 'command': 'drive-mirror', 'boxed': true,
1871   'data': 'DriveMirror' }
1872
1873 ##
1874 # @DriveMirror:
1875 #
1876 # A set of parameters describing drive mirror setup.
1877 #
1878 # @job-id: identifier for the newly-created block job. If
1879 #          omitted, the device name will be used. (Since 2.7)
1880 #
1881 # @device:  the device name or node-name of a root node whose writes should be
1882 #           mirrored.
1883 #
1884 # @target: the target of the new image. If the file exists, or if it
1885 #          is a device, the existing file/device will be used as the new
1886 #          destination.  If it does not exist, a new file will be created.
1887 #
1888 # @format: the format of the new destination, default is to
1889 #          probe if @mode is 'existing', else the format of the source
1890 #
1891 # @node-name: the new block driver state node name in the graph
1892 #             (Since 2.1)
1893 #
1894 # @replaces: with sync=full graph node name to be replaced by the new
1895 #            image when a whole image copy is done. This can be used to repair
1896 #            broken Quorum files. (Since 2.1)
1897 #
1898 # @mode: whether and how QEMU should create a new image, default is
1899 #        'absolute-paths'.
1900 #
1901 # @speed:  the maximum speed, in bytes per second
1902 #
1903 # @sync: what parts of the disk image should be copied to the destination
1904 #        (all the disk, only the sectors allocated in the topmost image, or
1905 #        only new I/O).
1906 #
1907 # @granularity: granularity of the dirty bitmap, default is 64K
1908 #               if the image format doesn't have clusters, 4K if the clusters
1909 #               are smaller than that, else the cluster size.  Must be a
1910 #               power of 2 between 512 and 64M (since 1.4).
1911 #
1912 # @buf-size: maximum amount of data in flight from source to
1913 #            target (since 1.4).
1914 #
1915 # @on-source-error: the action to take on an error on the source,
1916 #                   default 'report'.  'stop' and 'enospc' can only be used
1917 #                   if the block device supports io-status (see BlockInfo).
1918 #
1919 # @on-target-error: the action to take on an error on the target,
1920 #                   default 'report' (no limitations, since this applies to
1921 #                   a different block device than @device).
1922 # @unmap: Whether to try to unmap target sectors where source has
1923 #         only zero. If true, and target unallocated sectors will read as zero,
1924 #         target image sectors will be unmapped; otherwise, zeroes will be
1925 #         written. Both will result in identical contents.
1926 #         Default is true. (Since 2.4)
1927 #
1928 # @copy-mode: when to copy data to the destination; defaults to 'background'
1929 #             (Since: 3.0)
1930 #
1931 # @auto-finalize: When false, this job will wait in a PENDING state after it has
1932 #                 finished its work, waiting for @block-job-finalize before
1933 #                 making any block graph changes.
1934 #                 When true, this job will automatically
1935 #                 perform its abort or commit actions.
1936 #                 Defaults to true. (Since 3.1)
1937 #
1938 # @auto-dismiss: When false, this job will wait in a CONCLUDED state after it
1939 #                has completely ceased all work, and awaits @block-job-dismiss.
1940 #                When true, this job will automatically disappear from the query
1941 #                list without user intervention.
1942 #                Defaults to true. (Since 3.1)
1943 # Since: 1.3
1944 ##
1945 { 'struct': 'DriveMirror',
1946   'data': { '*job-id': 'str', 'device': 'str', 'target': 'str',
1947             '*format': 'str', '*node-name': 'str', '*replaces': 'str',
1948             'sync': 'MirrorSyncMode', '*mode': 'NewImageMode',
1949             '*speed': 'int', '*granularity': 'uint32',
1950             '*buf-size': 'int', '*on-source-error': 'BlockdevOnError',
1951             '*on-target-error': 'BlockdevOnError',
1952             '*unmap': 'bool', '*copy-mode': 'MirrorCopyMode',
1953             '*auto-finalize': 'bool', '*auto-dismiss': 'bool' } }
1954
1955 ##
1956 # @BlockDirtyBitmap:
1957 #
1958 # @node: name of device/node which the bitmap is tracking
1959 #
1960 # @name: name of the dirty bitmap
1961 #
1962 # Since: 2.4
1963 ##
1964 { 'struct': 'BlockDirtyBitmap',
1965   'data': { 'node': 'str', 'name': 'str' } }
1966
1967 ##
1968 # @BlockDirtyBitmapAdd:
1969 #
1970 # @node: name of device/node which the bitmap is tracking
1971 #
1972 # @name: name of the dirty bitmap
1973 #
1974 # @granularity: the bitmap granularity, default is 64k for
1975 #               block-dirty-bitmap-add
1976 #
1977 # @persistent: the bitmap is persistent, i.e. it will be saved to the
1978 #              corresponding block device image file on its close. For now only
1979 #              Qcow2 disks support persistent bitmaps. Default is false for
1980 #              block-dirty-bitmap-add. (Since: 2.10)
1981 #
1982 # @autoload: ignored and deprecated since 2.12.
1983 #            Currently, all dirty tracking bitmaps are loaded from Qcow2 on
1984 #            open.
1985 #
1986 # @disabled: the bitmap is created in the disabled state, which means that
1987 #            it will not track drive changes. The bitmap may be enabled with
1988 #            block-dirty-bitmap-enable. Default is false. (Since: 4.0)
1989 #
1990 # Since: 2.4
1991 ##
1992 { 'struct': 'BlockDirtyBitmapAdd',
1993   'data': { 'node': 'str', 'name': 'str', '*granularity': 'uint32',
1994             '*persistent': 'bool', '*autoload': 'bool', '*disabled': 'bool' } }
1995
1996 ##
1997 # @BlockDirtyBitmapMerge:
1998 #
1999 # @node: name of device/node which the bitmap is tracking
2000 #
2001 # @target: name of the destination dirty bitmap
2002 #
2003 # @bitmaps: name(s) of the source dirty bitmap(s)
2004 #
2005 # Since: 4.0
2006 ##
2007 { 'struct': 'BlockDirtyBitmapMerge',
2008   'data': { 'node': 'str', 'target': 'str', 'bitmaps': ['str'] } }
2009
2010 ##
2011 # @block-dirty-bitmap-add:
2012 #
2013 # Create a dirty bitmap with a name on the node, and start tracking the writes.
2014 #
2015 # Returns: nothing on success
2016 #          If @node is not a valid block device or node, DeviceNotFound
2017 #          If @name is already taken, GenericError with an explanation
2018 #
2019 # Since: 2.4
2020 #
2021 # Example:
2022 #
2023 # -> { "execute": "block-dirty-bitmap-add",
2024 #      "arguments": { "node": "drive0", "name": "bitmap0" } }
2025 # <- { "return": {} }
2026 #
2027 ##
2028 { 'command': 'block-dirty-bitmap-add',
2029   'data': 'BlockDirtyBitmapAdd' }
2030
2031 ##
2032 # @block-dirty-bitmap-remove:
2033 #
2034 # Stop write tracking and remove the dirty bitmap that was created
2035 # with block-dirty-bitmap-add. If the bitmap is persistent, remove it from its
2036 # storage too.
2037 #
2038 # Returns: nothing on success
2039 #          If @node is not a valid block device or node, DeviceNotFound
2040 #          If @name is not found, GenericError with an explanation
2041 #          if @name is frozen by an operation, GenericError
2042 #
2043 # Since: 2.4
2044 #
2045 # Example:
2046 #
2047 # -> { "execute": "block-dirty-bitmap-remove",
2048 #      "arguments": { "node": "drive0", "name": "bitmap0" } }
2049 # <- { "return": {} }
2050 #
2051 ##
2052 { 'command': 'block-dirty-bitmap-remove',
2053   'data': 'BlockDirtyBitmap' }
2054
2055 ##
2056 # @block-dirty-bitmap-clear:
2057 #
2058 # Clear (reset) a dirty bitmap on the device, so that an incremental
2059 # backup from this point in time forward will only backup clusters
2060 # modified after this clear operation.
2061 #
2062 # Returns: nothing on success
2063 #          If @node is not a valid block device, DeviceNotFound
2064 #          If @name is not found, GenericError with an explanation
2065 #
2066 # Since: 2.4
2067 #
2068 # Example:
2069 #
2070 # -> { "execute": "block-dirty-bitmap-clear",
2071 #      "arguments": { "node": "drive0", "name": "bitmap0" } }
2072 # <- { "return": {} }
2073 #
2074 ##
2075 { 'command': 'block-dirty-bitmap-clear',
2076   'data': 'BlockDirtyBitmap' }
2077
2078 ##
2079 # @block-dirty-bitmap-enable:
2080 #
2081 # Enables a dirty bitmap so that it will begin tracking disk changes.
2082 #
2083 # Returns: nothing on success
2084 #          If @node is not a valid block device, DeviceNotFound
2085 #          If @name is not found, GenericError with an explanation
2086 #
2087 # Since: 4.0
2088 #
2089 # Example:
2090 #
2091 # -> { "execute": "block-dirty-bitmap-enable",
2092 #      "arguments": { "node": "drive0", "name": "bitmap0" } }
2093 # <- { "return": {} }
2094 #
2095 ##
2096   { 'command': 'block-dirty-bitmap-enable',
2097     'data': 'BlockDirtyBitmap' }
2098
2099 ##
2100 # @block-dirty-bitmap-disable:
2101 #
2102 # Disables a dirty bitmap so that it will stop tracking disk changes.
2103 #
2104 # Returns: nothing on success
2105 #          If @node is not a valid block device, DeviceNotFound
2106 #          If @name is not found, GenericError with an explanation
2107 #
2108 # Since: 4.0
2109 #
2110 # Example:
2111 #
2112 # -> { "execute": "block-dirty-bitmap-disable",
2113 #      "arguments": { "node": "drive0", "name": "bitmap0" } }
2114 # <- { "return": {} }
2115 #
2116 ##
2117     { 'command': 'block-dirty-bitmap-disable',
2118       'data': 'BlockDirtyBitmap' }
2119
2120 ##
2121 # @block-dirty-bitmap-merge:
2122 #
2123 # Merge dirty bitmaps listed in @bitmaps to the @target dirty bitmap.
2124 # Dirty bitmaps in @bitmaps will be unchanged, except if it also appears
2125 # as the @target bitmap. Any bits already set in @target will still be
2126 # set after the merge, i.e., this operation does not clear the target.
2127 # On error, @target is unchanged.
2128 #
2129 # The resulting bitmap will count as dirty any clusters that were dirty in any
2130 # of the source bitmaps. This can be used to achieve backup checkpoints, or in
2131 # simpler usages, to copy bitmaps.
2132 #
2133 # Returns: nothing on success
2134 #          If @node is not a valid block device, DeviceNotFound
2135 #          If any bitmap in @bitmaps or @target is not found, GenericError
2136 #          If any of the bitmaps have different sizes or granularities,
2137 #              GenericError
2138 #
2139 # Since: 4.0
2140 #
2141 # Example:
2142 #
2143 # -> { "execute": "block-dirty-bitmap-merge",
2144 #      "arguments": { "node": "drive0", "target": "bitmap0",
2145 #                     "bitmaps": ["bitmap1"] } }
2146 # <- { "return": {} }
2147 #
2148 ##
2149       { 'command': 'block-dirty-bitmap-merge',
2150         'data': 'BlockDirtyBitmapMerge' }
2151
2152 ##
2153 # @BlockDirtyBitmapSha256:
2154 #
2155 # SHA256 hash of dirty bitmap data
2156 #
2157 # @sha256: ASCII representation of SHA256 bitmap hash
2158 #
2159 # Since: 2.10
2160 ##
2161   { 'struct': 'BlockDirtyBitmapSha256',
2162     'data': {'sha256': 'str'} }
2163
2164 ##
2165 # @x-debug-block-dirty-bitmap-sha256:
2166 #
2167 # Get bitmap SHA256.
2168 #
2169 # Returns: BlockDirtyBitmapSha256 on success
2170 #          If @node is not a valid block device, DeviceNotFound
2171 #          If @name is not found or if hashing has failed, GenericError with an
2172 #          explanation
2173 #
2174 # Since: 2.10
2175 ##
2176   { 'command': 'x-debug-block-dirty-bitmap-sha256',
2177     'data': 'BlockDirtyBitmap', 'returns': 'BlockDirtyBitmapSha256' }
2178
2179 ##
2180 # @blockdev-mirror:
2181 #
2182 # Start mirroring a block device's writes to a new destination.
2183 #
2184 # @job-id: identifier for the newly-created block job. If
2185 #          omitted, the device name will be used. (Since 2.7)
2186 #
2187 # @device: The device name or node-name of a root node whose writes should be
2188 #          mirrored.
2189 #
2190 # @target: the id or node-name of the block device to mirror to. This mustn't be
2191 #          attached to guest.
2192 #
2193 # @replaces: with sync=full graph node name to be replaced by the new
2194 #            image when a whole image copy is done. This can be used to repair
2195 #            broken Quorum files.
2196 #
2197 # @speed:  the maximum speed, in bytes per second
2198 #
2199 # @sync: what parts of the disk image should be copied to the destination
2200 #        (all the disk, only the sectors allocated in the topmost image, or
2201 #        only new I/O).
2202 #
2203 # @granularity: granularity of the dirty bitmap, default is 64K
2204 #               if the image format doesn't have clusters, 4K if the clusters
2205 #               are smaller than that, else the cluster size.  Must be a
2206 #               power of 2 between 512 and 64M
2207 #
2208 # @buf-size: maximum amount of data in flight from source to
2209 #            target
2210 #
2211 # @on-source-error: the action to take on an error on the source,
2212 #                   default 'report'.  'stop' and 'enospc' can only be used
2213 #                   if the block device supports io-status (see BlockInfo).
2214 #
2215 # @on-target-error: the action to take on an error on the target,
2216 #                   default 'report' (no limitations, since this applies to
2217 #                   a different block device than @device).
2218 #
2219 # @filter-node-name: the node name that should be assigned to the
2220 #                    filter driver that the mirror job inserts into the graph
2221 #                    above @device. If this option is not given, a node name is
2222 #                    autogenerated. (Since: 2.9)
2223 #
2224 # @copy-mode: when to copy data to the destination; defaults to 'background'
2225 #             (Since: 3.0)
2226 #
2227 # @auto-finalize: When false, this job will wait in a PENDING state after it has
2228 #                 finished its work, waiting for @block-job-finalize before
2229 #                 making any block graph changes.
2230 #                 When true, this job will automatically
2231 #                 perform its abort or commit actions.
2232 #                 Defaults to true. (Since 3.1)
2233 #
2234 # @auto-dismiss: When false, this job will wait in a CONCLUDED state after it
2235 #                has completely ceased all work, and awaits @block-job-dismiss.
2236 #                When true, this job will automatically disappear from the query
2237 #                list without user intervention.
2238 #                Defaults to true. (Since 3.1)
2239 # Returns: nothing on success.
2240 #
2241 # Since: 2.6
2242 #
2243 # Example:
2244 #
2245 # -> { "execute": "blockdev-mirror",
2246 #      "arguments": { "device": "ide-hd0",
2247 #                     "target": "target0",
2248 #                     "sync": "full" } }
2249 # <- { "return": {} }
2250 #
2251 ##
2252 { 'command': 'blockdev-mirror',
2253   'data': { '*job-id': 'str', 'device': 'str', 'target': 'str',
2254             '*replaces': 'str',
2255             'sync': 'MirrorSyncMode',
2256             '*speed': 'int', '*granularity': 'uint32',
2257             '*buf-size': 'int', '*on-source-error': 'BlockdevOnError',
2258             '*on-target-error': 'BlockdevOnError',
2259             '*filter-node-name': 'str',
2260             '*copy-mode': 'MirrorCopyMode',
2261             '*auto-finalize': 'bool', '*auto-dismiss': 'bool' } }
2262
2263 ##
2264 # @block_set_io_throttle:
2265 #
2266 # Change I/O throttle limits for a block drive.
2267 #
2268 # Since QEMU 2.4, each device with I/O limits is member of a throttle
2269 # group.
2270 #
2271 # If two or more devices are members of the same group, the limits
2272 # will apply to the combined I/O of the whole group in a round-robin
2273 # fashion. Therefore, setting new I/O limits to a device will affect
2274 # the whole group.
2275 #
2276 # The name of the group can be specified using the 'group' parameter.
2277 # If the parameter is unset, it is assumed to be the current group of
2278 # that device. If it's not in any group yet, the name of the device
2279 # will be used as the name for its group.
2280 #
2281 # The 'group' parameter can also be used to move a device to a
2282 # different group. In this case the limits specified in the parameters
2283 # will be applied to the new group only.
2284 #
2285 # I/O limits can be disabled by setting all of them to 0. In this case
2286 # the device will be removed from its group and the rest of its
2287 # members will not be affected. The 'group' parameter is ignored.
2288 #
2289 # Returns: Nothing on success
2290 #          If @device is not a valid block device, DeviceNotFound
2291 #
2292 # Since: 1.1
2293 #
2294 # Example:
2295 #
2296 # -> { "execute": "block_set_io_throttle",
2297 #      "arguments": { "id": "virtio-blk-pci0/virtio-backend",
2298 #                     "bps": 0,
2299 #                     "bps_rd": 0,
2300 #                     "bps_wr": 0,
2301 #                     "iops": 512,
2302 #                     "iops_rd": 0,
2303 #                     "iops_wr": 0,
2304 #                     "bps_max": 0,
2305 #                     "bps_rd_max": 0,
2306 #                     "bps_wr_max": 0,
2307 #                     "iops_max": 0,
2308 #                     "iops_rd_max": 0,
2309 #                     "iops_wr_max": 0,
2310 #                     "bps_max_length": 0,
2311 #                     "iops_size": 0 } }
2312 # <- { "return": {} }
2313 #
2314 # -> { "execute": "block_set_io_throttle",
2315 #      "arguments": { "id": "ide0-1-0",
2316 #                     "bps": 1000000,
2317 #                     "bps_rd": 0,
2318 #                     "bps_wr": 0,
2319 #                     "iops": 0,
2320 #                     "iops_rd": 0,
2321 #                     "iops_wr": 0,
2322 #                     "bps_max": 8000000,
2323 #                     "bps_rd_max": 0,
2324 #                     "bps_wr_max": 0,
2325 #                     "iops_max": 0,
2326 #                     "iops_rd_max": 0,
2327 #                     "iops_wr_max": 0,
2328 #                     "bps_max_length": 60,
2329 #                     "iops_size": 0 } }
2330 # <- { "return": {} }
2331 ##
2332 { 'command': 'block_set_io_throttle', 'boxed': true,
2333   'data': 'BlockIOThrottle' }
2334
2335 ##
2336 # @BlockIOThrottle:
2337 #
2338 # A set of parameters describing block throttling.
2339 #
2340 # @device: Block device name (deprecated, use @id instead)
2341 #
2342 # @id: The name or QOM path of the guest device (since: 2.8)
2343 #
2344 # @bps: total throughput limit in bytes per second
2345 #
2346 # @bps_rd: read throughput limit in bytes per second
2347 #
2348 # @bps_wr: write throughput limit in bytes per second
2349 #
2350 # @iops: total I/O operations per second
2351 #
2352 # @iops_rd: read I/O operations per second
2353 #
2354 # @iops_wr: write I/O operations per second
2355 #
2356 # @bps_max: total throughput limit during bursts,
2357 #                     in bytes (Since 1.7)
2358 #
2359 # @bps_rd_max: read throughput limit during bursts,
2360 #                        in bytes (Since 1.7)
2361 #
2362 # @bps_wr_max: write throughput limit during bursts,
2363 #                        in bytes (Since 1.7)
2364 #
2365 # @iops_max: total I/O operations per second during bursts,
2366 #                      in bytes (Since 1.7)
2367 #
2368 # @iops_rd_max: read I/O operations per second during bursts,
2369 #                         in bytes (Since 1.7)
2370 #
2371 # @iops_wr_max: write I/O operations per second during bursts,
2372 #                         in bytes (Since 1.7)
2373 #
2374 # @bps_max_length: maximum length of the @bps_max burst
2375 #                            period, in seconds. It must only
2376 #                            be set if @bps_max is set as well.
2377 #                            Defaults to 1. (Since 2.6)
2378 #
2379 # @bps_rd_max_length: maximum length of the @bps_rd_max
2380 #                               burst period, in seconds. It must only
2381 #                               be set if @bps_rd_max is set as well.
2382 #                               Defaults to 1. (Since 2.6)
2383 #
2384 # @bps_wr_max_length: maximum length of the @bps_wr_max
2385 #                               burst period, in seconds. It must only
2386 #                               be set if @bps_wr_max is set as well.
2387 #                               Defaults to 1. (Since 2.6)
2388 #
2389 # @iops_max_length: maximum length of the @iops burst
2390 #                             period, in seconds. It must only
2391 #                             be set if @iops_max is set as well.
2392 #                             Defaults to 1. (Since 2.6)
2393 #
2394 # @iops_rd_max_length: maximum length of the @iops_rd_max
2395 #                                burst period, in seconds. It must only
2396 #                                be set if @iops_rd_max is set as well.
2397 #                                Defaults to 1. (Since 2.6)
2398 #
2399 # @iops_wr_max_length: maximum length of the @iops_wr_max
2400 #                                burst period, in seconds. It must only
2401 #                                be set if @iops_wr_max is set as well.
2402 #                                Defaults to 1. (Since 2.6)
2403 #
2404 # @iops_size: an I/O size in bytes (Since 1.7)
2405 #
2406 # @group: throttle group name (Since 2.4)
2407 #
2408 # Since: 1.1
2409 ##
2410 { 'struct': 'BlockIOThrottle',
2411   'data': { '*device': 'str', '*id': 'str', 'bps': 'int', 'bps_rd': 'int',
2412             'bps_wr': 'int', 'iops': 'int', 'iops_rd': 'int', 'iops_wr': 'int',
2413             '*bps_max': 'int', '*bps_rd_max': 'int',
2414             '*bps_wr_max': 'int', '*iops_max': 'int',
2415             '*iops_rd_max': 'int', '*iops_wr_max': 'int',
2416             '*bps_max_length': 'int', '*bps_rd_max_length': 'int',
2417             '*bps_wr_max_length': 'int', '*iops_max_length': 'int',
2418             '*iops_rd_max_length': 'int', '*iops_wr_max_length': 'int',
2419             '*iops_size': 'int', '*group': 'str' } }
2420
2421 ##
2422 # @ThrottleLimits:
2423 #
2424 # Limit parameters for throttling.
2425 # Since some limit combinations are illegal, limits should always be set in one
2426 # transaction. All fields are optional. When setting limits, if a field is
2427 # missing the current value is not changed.
2428 #
2429 # @iops-total:             limit total I/O operations per second
2430 # @iops-total-max:         I/O operations burst
2431 # @iops-total-max-length:  length of the iops-total-max burst period, in seconds
2432 #                          It must only be set if @iops-total-max is set as well.
2433 # @iops-read:              limit read operations per second
2434 # @iops-read-max:          I/O operations read burst
2435 # @iops-read-max-length:   length of the iops-read-max burst period, in seconds
2436 #                          It must only be set if @iops-read-max is set as well.
2437 # @iops-write:             limit write operations per second
2438 # @iops-write-max:         I/O operations write burst
2439 # @iops-write-max-length:  length of the iops-write-max burst period, in seconds
2440 #                          It must only be set if @iops-write-max is set as well.
2441 # @bps-total:              limit total bytes per second
2442 # @bps-total-max:          total bytes burst
2443 # @bps-total-max-length:   length of the bps-total-max burst period, in seconds.
2444 #                          It must only be set if @bps-total-max is set as well.
2445 # @bps-read:               limit read bytes per second
2446 # @bps-read-max:           total bytes read burst
2447 # @bps-read-max-length:    length of the bps-read-max burst period, in seconds
2448 #                          It must only be set if @bps-read-max is set as well.
2449 # @bps-write:              limit write bytes per second
2450 # @bps-write-max:          total bytes write burst
2451 # @bps-write-max-length:   length of the bps-write-max burst period, in seconds
2452 #                          It must only be set if @bps-write-max is set as well.
2453 # @iops-size:              when limiting by iops max size of an I/O in bytes
2454 #
2455 # Since: 2.11
2456 ##
2457 { 'struct': 'ThrottleLimits',
2458   'data': { '*iops-total' : 'int', '*iops-total-max' : 'int',
2459             '*iops-total-max-length' : 'int', '*iops-read' : 'int',
2460             '*iops-read-max' : 'int', '*iops-read-max-length' : 'int',
2461             '*iops-write' : 'int', '*iops-write-max' : 'int',
2462             '*iops-write-max-length' : 'int', '*bps-total' : 'int',
2463             '*bps-total-max' : 'int', '*bps-total-max-length' : 'int',
2464             '*bps-read' : 'int', '*bps-read-max' : 'int',
2465             '*bps-read-max-length' : 'int', '*bps-write' : 'int',
2466             '*bps-write-max' : 'int', '*bps-write-max-length' : 'int',
2467             '*iops-size' : 'int' } }
2468
2469 ##
2470 # @block-stream:
2471 #
2472 # Copy data from a backing file into a block device.
2473 #
2474 # The block streaming operation is performed in the background until the entire
2475 # backing file has been copied.  This command returns immediately once streaming
2476 # has started.  The status of ongoing block streaming operations can be checked
2477 # with query-block-jobs.  The operation can be stopped before it has completed
2478 # using the block-job-cancel command.
2479 #
2480 # The node that receives the data is called the top image, can be located in
2481 # any part of the chain (but always above the base image; see below) and can be
2482 # specified using its device or node name. Earlier qemu versions only allowed
2483 # 'device' to name the top level node; presence of the 'base-node' parameter
2484 # during introspection can be used as a witness of the enhanced semantics
2485 # of 'device'.
2486 #
2487 # If a base file is specified then sectors are not copied from that base file and
2488 # its backing chain.  When streaming completes the image file will have the base
2489 # file as its backing file.  This can be used to stream a subset of the backing
2490 # file chain instead of flattening the entire image.
2491 #
2492 # On successful completion the image file is updated to drop the backing file
2493 # and the BLOCK_JOB_COMPLETED event is emitted.
2494 #
2495 # @job-id: identifier for the newly-created block job. If
2496 #          omitted, the device name will be used. (Since 2.7)
2497 #
2498 # @device: the device or node name of the top image
2499 #
2500 # @base:   the common backing file name.
2501 #                    It cannot be set if @base-node is also set.
2502 #
2503 # @base-node: the node name of the backing file.
2504 #                       It cannot be set if @base is also set. (Since 2.8)
2505 #
2506 # @backing-file: The backing file string to write into the top
2507 #                          image. This filename is not validated.
2508 #
2509 #                          If a pathname string is such that it cannot be
2510 #                          resolved by QEMU, that means that subsequent QMP or
2511 #                          HMP commands must use node-names for the image in
2512 #                          question, as filename lookup methods will fail.
2513 #
2514 #                          If not specified, QEMU will automatically determine
2515 #                          the backing file string to use, or error out if there
2516 #                          is no obvious choice.  Care should be taken when
2517 #                          specifying the string, to specify a valid filename or
2518 #                          protocol.
2519 #                          (Since 2.1)
2520 #
2521 # @speed:  the maximum speed, in bytes per second
2522 #
2523 # @on-error: the action to take on an error (default report).
2524 #            'stop' and 'enospc' can only be used if the block device
2525 #            supports io-status (see BlockInfo).  Since 1.3.
2526 #
2527 # @auto-finalize: When false, this job will wait in a PENDING state after it has
2528 #                 finished its work, waiting for @block-job-finalize before
2529 #                 making any block graph changes.
2530 #                 When true, this job will automatically
2531 #                 perform its abort or commit actions.
2532 #                 Defaults to true. (Since 3.1)
2533 #
2534 # @auto-dismiss: When false, this job will wait in a CONCLUDED state after it
2535 #                has completely ceased all work, and awaits @block-job-dismiss.
2536 #                When true, this job will automatically disappear from the query
2537 #                list without user intervention.
2538 #                Defaults to true. (Since 3.1)
2539 #
2540 # Returns: Nothing on success. If @device does not exist, DeviceNotFound.
2541 #
2542 # Since: 1.1
2543 #
2544 # Example:
2545 #
2546 # -> { "execute": "block-stream",
2547 #      "arguments": { "device": "virtio0",
2548 #                     "base": "/tmp/master.qcow2" } }
2549 # <- { "return": {} }
2550 #
2551 ##
2552 { 'command': 'block-stream',
2553   'data': { '*job-id': 'str', 'device': 'str', '*base': 'str',
2554             '*base-node': 'str', '*backing-file': 'str', '*speed': 'int',
2555             '*on-error': 'BlockdevOnError',
2556             '*auto-finalize': 'bool', '*auto-dismiss': 'bool' } }
2557
2558 ##
2559 # @block-job-set-speed:
2560 #
2561 # Set maximum speed for a background block operation.
2562 #
2563 # This command can only be issued when there is an active block job.
2564 #
2565 # Throttling can be disabled by setting the speed to 0.
2566 #
2567 # @device: The job identifier. This used to be a device name (hence
2568 #          the name of the parameter), but since QEMU 2.7 it can have
2569 #          other values.
2570 #
2571 # @speed:  the maximum speed, in bytes per second, or 0 for unlimited.
2572 #          Defaults to 0.
2573 #
2574 # Returns: Nothing on success
2575 #          If no background operation is active on this device, DeviceNotActive
2576 #
2577 # Since: 1.1
2578 ##
2579 { 'command': 'block-job-set-speed',
2580   'data': { 'device': 'str', 'speed': 'int' } }
2581
2582 ##
2583 # @block-job-cancel:
2584 #
2585 # Stop an active background block operation.
2586 #
2587 # This command returns immediately after marking the active background block
2588 # operation for cancellation.  It is an error to call this command if no
2589 # operation is in progress.
2590 #
2591 # The operation will cancel as soon as possible and then emit the
2592 # BLOCK_JOB_CANCELLED event.  Before that happens the job is still visible when
2593 # enumerated using query-block-jobs.
2594 #
2595 # Note that if you issue 'block-job-cancel' after 'drive-mirror' has indicated
2596 # (via the event BLOCK_JOB_READY) that the source and destination are
2597 # synchronized, then the event triggered by this command changes to
2598 # BLOCK_JOB_COMPLETED, to indicate that the mirroring has ended and the
2599 # destination now has a point-in-time copy tied to the time of the cancellation.
2600 #
2601 # For streaming, the image file retains its backing file unless the streaming
2602 # operation happens to complete just as it is being cancelled.  A new streaming
2603 # operation can be started at a later time to finish copying all data from the
2604 # backing file.
2605 #
2606 # @device: The job identifier. This used to be a device name (hence
2607 #          the name of the parameter), but since QEMU 2.7 it can have
2608 #          other values.
2609 #
2610 # @force: If true, and the job has already emitted the event BLOCK_JOB_READY,
2611 #         abandon the job immediately (even if it is paused) instead of waiting
2612 #         for the destination to complete its final synchronization (since 1.3)
2613 #
2614 # Returns: Nothing on success
2615 #          If no background operation is active on this device, DeviceNotActive
2616 #
2617 # Since: 1.1
2618 ##
2619 { 'command': 'block-job-cancel', 'data': { 'device': 'str', '*force': 'bool' } }
2620
2621 ##
2622 # @block-job-pause:
2623 #
2624 # Pause an active background block operation.
2625 #
2626 # This command returns immediately after marking the active background block
2627 # operation for pausing.  It is an error to call this command if no
2628 # operation is in progress or if the job is already paused.
2629 #
2630 # The operation will pause as soon as possible.  No event is emitted when
2631 # the operation is actually paused.  Cancelling a paused job automatically
2632 # resumes it.
2633 #
2634 # @device: The job identifier. This used to be a device name (hence
2635 #          the name of the parameter), but since QEMU 2.7 it can have
2636 #          other values.
2637 #
2638 # Returns: Nothing on success
2639 #          If no background operation is active on this device, DeviceNotActive
2640 #
2641 # Since: 1.3
2642 ##
2643 { 'command': 'block-job-pause', 'data': { 'device': 'str' } }
2644
2645 ##
2646 # @block-job-resume:
2647 #
2648 # Resume an active background block operation.
2649 #
2650 # This command returns immediately after resuming a paused background block
2651 # operation.  It is an error to call this command if no operation is in
2652 # progress or if the job is not paused.
2653 #
2654 # This command also clears the error status of the job.
2655 #
2656 # @device: The job identifier. This used to be a device name (hence
2657 #          the name of the parameter), but since QEMU 2.7 it can have
2658 #          other values.
2659 #
2660 # Returns: Nothing on success
2661 #          If no background operation is active on this device, DeviceNotActive
2662 #
2663 # Since: 1.3
2664 ##
2665 { 'command': 'block-job-resume', 'data': { 'device': 'str' } }
2666
2667 ##
2668 # @block-job-complete:
2669 #
2670 # Manually trigger completion of an active background block operation.  This
2671 # is supported for drive mirroring, where it also switches the device to
2672 # write to the target path only.  The ability to complete is signaled with
2673 # a BLOCK_JOB_READY event.
2674 #
2675 # This command completes an active background block operation synchronously.
2676 # The ordering of this command's return with the BLOCK_JOB_COMPLETED event
2677 # is not defined.  Note that if an I/O error occurs during the processing of
2678 # this command: 1) the command itself will fail; 2) the error will be processed
2679 # according to the rerror/werror arguments that were specified when starting
2680 # the operation.
2681 #
2682 # A cancelled or paused job cannot be completed.
2683 #
2684 # @device: The job identifier. This used to be a device name (hence
2685 #          the name of the parameter), but since QEMU 2.7 it can have
2686 #          other values.
2687 #
2688 # Returns: Nothing on success
2689 #          If no background operation is active on this device, DeviceNotActive
2690 #
2691 # Since: 1.3
2692 ##
2693 { 'command': 'block-job-complete', 'data': { 'device': 'str' } }
2694
2695 ##
2696 # @block-job-dismiss:
2697 #
2698 # For jobs that have already concluded, remove them from the block-job-query
2699 # list. This command only needs to be run for jobs which were started with
2700 # QEMU 2.12+ job lifetime management semantics.
2701 #
2702 # This command will refuse to operate on any job that has not yet reached
2703 # its terminal state, JOB_STATUS_CONCLUDED. For jobs that make use of the
2704 # BLOCK_JOB_READY event, block-job-cancel or block-job-complete will still need
2705 # to be used as appropriate.
2706 #
2707 # @id: The job identifier.
2708 #
2709 # Returns: Nothing on success
2710 #
2711 # Since: 2.12
2712 ##
2713 { 'command': 'block-job-dismiss', 'data': { 'id': 'str' } }
2714
2715 ##
2716 # @block-job-finalize:
2717 #
2718 # Once a job that has manual=true reaches the pending state, it can be
2719 # instructed to finalize any graph changes and do any necessary cleanup
2720 # via this command.
2721 # For jobs in a transaction, instructing one job to finalize will force
2722 # ALL jobs in the transaction to finalize, so it is only necessary to instruct
2723 # a single member job to finalize.
2724 #
2725 # @id: The job identifier.
2726 #
2727 # Returns: Nothing on success
2728 #
2729 # Since: 2.12
2730 ##
2731 { 'command': 'block-job-finalize', 'data': { 'id': 'str' } }
2732
2733 ##
2734 # @BlockdevDiscardOptions:
2735 #
2736 # Determines how to handle discard requests.
2737 #
2738 # @ignore:      Ignore the request
2739 # @unmap:       Forward as an unmap request
2740 #
2741 # Since: 2.9
2742 ##
2743 { 'enum': 'BlockdevDiscardOptions',
2744   'data': [ 'ignore', 'unmap' ] }
2745
2746 ##
2747 # @BlockdevDetectZeroesOptions:
2748 #
2749 # Describes the operation mode for the automatic conversion of plain
2750 # zero writes by the OS to driver specific optimized zero write commands.
2751 #
2752 # @off:      Disabled (default)
2753 # @on:       Enabled
2754 # @unmap:    Enabled and even try to unmap blocks if possible. This requires
2755 #            also that @BlockdevDiscardOptions is set to unmap for this device.
2756 #
2757 # Since: 2.1
2758 ##
2759 { 'enum': 'BlockdevDetectZeroesOptions',
2760   'data': [ 'off', 'on', 'unmap' ] }
2761
2762 ##
2763 # @BlockdevAioOptions:
2764 #
2765 # Selects the AIO backend to handle I/O requests
2766 #
2767 # @threads:     Use qemu's thread pool
2768 # @native:      Use native AIO backend (only Linux and Windows)
2769 #
2770 # Since: 2.9
2771 ##
2772 { 'enum': 'BlockdevAioOptions',
2773   'data': [ 'threads', 'native' ] }
2774
2775 ##
2776 # @BlockdevCacheOptions:
2777 #
2778 # Includes cache-related options for block devices
2779 #
2780 # @direct:      enables use of O_DIRECT (bypass the host page cache;
2781 #               default: false)
2782 # @no-flush:    ignore any flush requests for the device (default:
2783 #               false)
2784 #
2785 # Since: 2.9
2786 ##
2787 { 'struct': 'BlockdevCacheOptions',
2788   'data': { '*direct': 'bool',
2789             '*no-flush': 'bool' } }
2790
2791 ##
2792 # @BlockdevDriver:
2793 #
2794 # Drivers that are supported in block device operations.
2795 #
2796 # @vxhs: Since 2.10
2797 # @throttle: Since 2.11
2798 # @nvme: Since 2.12
2799 # @copy-on-read: Since 3.0
2800 # @blklogwrites: Since 3.0
2801 #
2802 # Since: 2.9
2803 ##
2804 { 'enum': 'BlockdevDriver',
2805   'data': [ 'blkdebug', 'blklogwrites', 'blkverify', 'bochs', 'cloop',
2806             'copy-on-read', 'dmg', 'file', 'ftp', 'ftps', 'gluster',
2807             'host_cdrom', 'host_device', 'http', 'https', 'iscsi', 'luks',
2808             'nbd', 'nfs', 'null-aio', 'null-co', 'nvme', 'parallels', 'qcow',
2809             'qcow2', 'qed', 'quorum', 'raw', 'rbd',
2810             { 'name': 'replication', 'if': 'defined(CONFIG_REPLICATION)' },
2811             'sheepdog',
2812             'ssh', 'throttle', 'vdi', 'vhdx', 'vmdk', 'vpc', 'vvfat', 'vxhs' ] }
2813
2814 ##
2815 # @BlockdevOptionsFile:
2816 #
2817 # Driver specific block device options for the file backend.
2818 #
2819 # @filename:    path to the image file
2820 # @pr-manager:  the id for the object that will handle persistent reservations
2821 #               for this device (default: none, forward the commands via SG_IO;
2822 #               since 2.11)
2823 # @aio:         AIO backend (default: threads) (since: 2.8)
2824 # @locking:     whether to enable file locking. If set to 'auto', only enable
2825 #               when Open File Descriptor (OFD) locking API is available
2826 #               (default: auto, since 2.10)
2827 # @x-check-cache-dropped: whether to check that page cache was dropped on live
2828 #                         migration.  May cause noticeable delays if the image
2829 #                         file is large, do not use in production.
2830 #                         (default: off) (since: 3.0)
2831 #
2832 # Since: 2.9
2833 ##
2834 { 'struct': 'BlockdevOptionsFile',
2835   'data': { 'filename': 'str',
2836             '*pr-manager': 'str',
2837             '*locking': 'OnOffAuto',
2838             '*aio': 'BlockdevAioOptions',
2839             '*x-check-cache-dropped': 'bool' } }
2840
2841 ##
2842 # @BlockdevOptionsNull:
2843 #
2844 # Driver specific block device options for the null backend.
2845 #
2846 # @size:    size of the device in bytes.
2847 # @latency-ns: emulated latency (in nanoseconds) in processing
2848 #              requests. Default to zero which completes requests immediately.
2849 #              (Since 2.4)
2850 #
2851 # Since: 2.9
2852 ##
2853 { 'struct': 'BlockdevOptionsNull',
2854   'data': { '*size': 'int', '*latency-ns': 'uint64' } }
2855
2856 ##
2857 # @BlockdevOptionsNVMe:
2858 #
2859 # Driver specific block device options for the NVMe backend.
2860 #
2861 # @device:    controller address of the NVMe device.
2862 # @namespace: namespace number of the device, starting from 1.
2863 #
2864 # Since: 2.12
2865 ##
2866 { 'struct': 'BlockdevOptionsNVMe',
2867   'data': { 'device': 'str', 'namespace': 'int' } }
2868
2869 ##
2870 # @BlockdevOptionsVVFAT:
2871 #
2872 # Driver specific block device options for the vvfat protocol.
2873 #
2874 # @dir:         directory to be exported as FAT image
2875 # @fat-type:    FAT type: 12, 16 or 32
2876 # @floppy:      whether to export a floppy image (true) or
2877 #               partitioned hard disk (false; default)
2878 # @label:       set the volume label, limited to 11 bytes. FAT16 and
2879 #               FAT32 traditionally have some restrictions on labels, which are
2880 #               ignored by most operating systems. Defaults to "QEMU VVFAT".
2881 #               (since 2.4)
2882 # @rw:          whether to allow write operations (default: false)
2883 #
2884 # Since: 2.9
2885 ##
2886 { 'struct': 'BlockdevOptionsVVFAT',
2887   'data': { 'dir': 'str', '*fat-type': 'int', '*floppy': 'bool',
2888             '*label': 'str', '*rw': 'bool' } }
2889
2890 ##
2891 # @BlockdevOptionsGenericFormat:
2892 #
2893 # Driver specific block device options for image format that have no option
2894 # besides their data source.
2895 #
2896 # @file:        reference to or definition of the data source block device
2897 #
2898 # Since: 2.9
2899 ##
2900 { 'struct': 'BlockdevOptionsGenericFormat',
2901   'data': { 'file': 'BlockdevRef' } }
2902
2903 ##
2904 # @BlockdevOptionsLUKS:
2905 #
2906 # Driver specific block device options for LUKS.
2907 #
2908 # @key-secret: the ID of a QCryptoSecret object providing
2909 #              the decryption key (since 2.6). Mandatory except when
2910 #              doing a metadata-only probe of the image.
2911 #
2912 # Since: 2.9
2913 ##
2914 { 'struct': 'BlockdevOptionsLUKS',
2915   'base': 'BlockdevOptionsGenericFormat',
2916   'data': { '*key-secret': 'str' } }
2917
2918
2919 ##
2920 # @BlockdevOptionsGenericCOWFormat:
2921 #
2922 # Driver specific block device options for image format that have no option
2923 # besides their data source and an optional backing file.
2924 #
2925 # @backing:     reference to or definition of the backing file block
2926 #               device, null disables the backing file entirely.
2927 #               Defaults to the backing file stored the image file.
2928 #
2929 # Since: 2.9
2930 ##
2931 { 'struct': 'BlockdevOptionsGenericCOWFormat',
2932   'base': 'BlockdevOptionsGenericFormat',
2933   'data': { '*backing': 'BlockdevRefOrNull' } }
2934
2935 ##
2936 # @Qcow2OverlapCheckMode:
2937 #
2938 # General overlap check modes.
2939 #
2940 # @none:        Do not perform any checks
2941 #
2942 # @constant:    Perform only checks which can be done in constant time and
2943 #               without reading anything from disk
2944 #
2945 # @cached:      Perform only checks which can be done without reading anything
2946 #               from disk
2947 #
2948 # @all:         Perform all available overlap checks
2949 #
2950 # Since: 2.9
2951 ##
2952 { 'enum': 'Qcow2OverlapCheckMode',
2953   'data': [ 'none', 'constant', 'cached', 'all' ] }
2954
2955 ##
2956 # @Qcow2OverlapCheckFlags:
2957 #
2958 # Structure of flags for each metadata structure. Setting a field to 'true'
2959 # makes qemu guard that structure against unintended overwriting. The default
2960 # value is chosen according to the template given.
2961 #
2962 # @template: Specifies a template mode which can be adjusted using the other
2963 #            flags, defaults to 'cached'
2964 #
2965 # @bitmap-directory: since 3.0
2966 #
2967 # Since: 2.9
2968 ##
2969 { 'struct': 'Qcow2OverlapCheckFlags',
2970   'data': { '*template':         'Qcow2OverlapCheckMode',
2971             '*main-header':      'bool',
2972             '*active-l1':        'bool',
2973             '*active-l2':        'bool',
2974             '*refcount-table':   'bool',
2975             '*refcount-block':   'bool',
2976             '*snapshot-table':   'bool',
2977             '*inactive-l1':      'bool',
2978             '*inactive-l2':      'bool',
2979             '*bitmap-directory': 'bool' } }
2980
2981 ##
2982 # @Qcow2OverlapChecks:
2983 #
2984 # Specifies which metadata structures should be guarded against unintended
2985 # overwriting.
2986 #
2987 # @flags:   set of flags for separate specification of each metadata structure
2988 #           type
2989 #
2990 # @mode:    named mode which chooses a specific set of flags
2991 #
2992 # Since: 2.9
2993 ##
2994 { 'alternate': 'Qcow2OverlapChecks',
2995   'data': { 'flags': 'Qcow2OverlapCheckFlags',
2996             'mode':  'Qcow2OverlapCheckMode' } }
2997
2998 ##
2999 # @BlockdevQcowEncryptionFormat:
3000 #
3001 # @aes: AES-CBC with plain64 initialization vectors
3002 #
3003 # Since: 2.10
3004 ##
3005 { 'enum': 'BlockdevQcowEncryptionFormat',
3006   'data': [ 'aes' ] }
3007
3008 ##
3009 # @BlockdevQcowEncryption:
3010 #
3011 # Since: 2.10
3012 ##
3013 { 'union': 'BlockdevQcowEncryption',
3014   'base': { 'format': 'BlockdevQcowEncryptionFormat' },
3015   'discriminator': 'format',
3016   'data': { 'aes': 'QCryptoBlockOptionsQCow' } }
3017
3018 ##
3019 # @BlockdevOptionsQcow:
3020 #
3021 # Driver specific block device options for qcow.
3022 #
3023 # @encrypt:               Image decryption options. Mandatory for
3024 #                         encrypted images, except when doing a metadata-only
3025 #                         probe of the image.
3026 #
3027 # Since: 2.10
3028 ##
3029 { 'struct': 'BlockdevOptionsQcow',
3030   'base': 'BlockdevOptionsGenericCOWFormat',
3031   'data': { '*encrypt': 'BlockdevQcowEncryption' } }
3032
3033
3034
3035 ##
3036 # @BlockdevQcow2EncryptionFormat:
3037 # @aes: AES-CBC with plain64 initialization vectors
3038 #
3039 # Since: 2.10
3040 ##
3041 { 'enum': 'BlockdevQcow2EncryptionFormat',
3042   'data': [ 'aes', 'luks' ] }
3043
3044 ##
3045 # @BlockdevQcow2Encryption:
3046 #
3047 # Since: 2.10
3048 ##
3049 { 'union': 'BlockdevQcow2Encryption',
3050   'base': { 'format': 'BlockdevQcow2EncryptionFormat' },
3051   'discriminator': 'format',
3052   'data': { 'aes': 'QCryptoBlockOptionsQCow',
3053             'luks': 'QCryptoBlockOptionsLUKS'} }
3054
3055 ##
3056 # @BlockdevOptionsQcow2:
3057 #
3058 # Driver specific block device options for qcow2.
3059 #
3060 # @lazy-refcounts:        whether to enable the lazy refcounts
3061 #                         feature (default is taken from the image file)
3062 #
3063 # @pass-discard-request:  whether discard requests to the qcow2
3064 #                         device should be forwarded to the data source
3065 #
3066 # @pass-discard-snapshot: whether discard requests for the data source
3067 #                         should be issued when a snapshot operation (e.g.
3068 #                         deleting a snapshot) frees clusters in the qcow2 file
3069 #
3070 # @pass-discard-other:    whether discard requests for the data source
3071 #                         should be issued on other occasions where a cluster
3072 #                         gets freed
3073 #
3074 # @overlap-check:         which overlap checks to perform for writes
3075 #                         to the image, defaults to 'cached' (since 2.2)
3076 #
3077 # @cache-size:            the maximum total size of the L2 table and
3078 #                         refcount block caches in bytes (since 2.2)
3079 #
3080 # @l2-cache-size:         the maximum size of the L2 table cache in
3081 #                         bytes (since 2.2)
3082 #
3083 # @l2-cache-entry-size:   the size of each entry in the L2 cache in
3084 #                         bytes. It must be a power of two between 512
3085 #                         and the cluster size. The default value is
3086 #                         the cluster size (since 2.12)
3087 #
3088 # @refcount-cache-size:   the maximum size of the refcount block cache
3089 #                         in bytes (since 2.2)
3090 #
3091 # @cache-clean-interval:  clean unused entries in the L2 and refcount
3092 #                         caches. The interval is in seconds. The default value
3093 #                         is 600 on supporting platforms, and 0 on other
3094 #                         platforms. 0 disables this feature. (since 2.5)
3095 #
3096 # @encrypt:               Image decryption options. Mandatory for
3097 #                         encrypted images, except when doing a metadata-only
3098 #                         probe of the image. (since 2.10)
3099 #
3100 # @data-file:             reference to or definition of the external data file.
3101 #                         This may only be specified for images that require an
3102 #                         external data file. If it is not specified for such
3103 #                         an image, the data file name is loaded from the image
3104 #                         file. (since 4.0)
3105 #
3106 # Since: 2.9
3107 ##
3108 { 'struct': 'BlockdevOptionsQcow2',
3109   'base': 'BlockdevOptionsGenericCOWFormat',
3110   'data': { '*lazy-refcounts': 'bool',
3111             '*pass-discard-request': 'bool',
3112             '*pass-discard-snapshot': 'bool',
3113             '*pass-discard-other': 'bool',
3114             '*overlap-check': 'Qcow2OverlapChecks',
3115             '*cache-size': 'int',
3116             '*l2-cache-size': 'int',
3117             '*l2-cache-entry-size': 'int',
3118             '*refcount-cache-size': 'int',
3119             '*cache-clean-interval': 'int',
3120             '*encrypt': 'BlockdevQcow2Encryption',
3121             '*data-file': 'BlockdevRef' } }
3122
3123 ##
3124 # @SshHostKeyCheckMode:
3125 #
3126 # @none             Don't check the host key at all
3127 # @hash             Compare the host key with a given hash
3128 # @known_hosts      Check the host key against the known_hosts file
3129 #
3130 # Since: 2.12
3131 ##
3132 { 'enum': 'SshHostKeyCheckMode',
3133   'data': [ 'none', 'hash', 'known_hosts' ] }
3134
3135 ##
3136 # @SshHostKeyCheckHashType:
3137 #
3138 # @md5              The given hash is an md5 hash
3139 # @sha1             The given hash is an sha1 hash
3140 #
3141 # Since: 2.12
3142 ##
3143 { 'enum': 'SshHostKeyCheckHashType',
3144   'data': [ 'md5', 'sha1' ] }
3145
3146 ##
3147 # @SshHostKeyHash:
3148 #
3149 # @type             The hash algorithm used for the hash
3150 # @hash             The expected hash value
3151 #
3152 # Since: 2.12
3153 ##
3154 { 'struct': 'SshHostKeyHash',
3155   'data': { 'type': 'SshHostKeyCheckHashType',
3156             'hash': 'str' }}
3157
3158 ##
3159 # @SshHostKeyCheck:
3160 #
3161 # Since: 2.12
3162 ##
3163 { 'union': 'SshHostKeyCheck',
3164   'base': { 'mode': 'SshHostKeyCheckMode' },
3165   'discriminator': 'mode',
3166   'data': { 'hash': 'SshHostKeyHash' } }
3167
3168 ##
3169 # @BlockdevOptionsSsh:
3170 #
3171 # @server:              host address
3172 #
3173 # @path:                path to the image on the host
3174 #
3175 # @user:                user as which to connect, defaults to current
3176 #                       local user name
3177 #
3178 # @host-key-check:      Defines how and what to check the host key against
3179 #                       (default: known_hosts)
3180 #
3181 # Since: 2.9
3182 ##
3183 { 'struct': 'BlockdevOptionsSsh',
3184   'data': { 'server': 'InetSocketAddress',
3185             'path': 'str',
3186             '*user': 'str',
3187             '*host-key-check': 'SshHostKeyCheck' } }
3188
3189
3190 ##
3191 # @BlkdebugEvent:
3192 #
3193 # Trigger events supported by blkdebug.
3194 #
3195 # @l1_shrink_write_table:      write zeros to the l1 table to shrink image.
3196 #                              (since 2.11)
3197 #
3198 # @l1_shrink_free_l2_clusters: discard the l2 tables. (since 2.11)
3199 #
3200 # @cor_write: a write due to copy-on-read (since 2.11)
3201 #
3202 # Since: 2.9
3203 ##
3204 { 'enum': 'BlkdebugEvent', 'prefix': 'BLKDBG',
3205   'data': [ 'l1_update', 'l1_grow_alloc_table', 'l1_grow_write_table',
3206             'l1_grow_activate_table', 'l2_load', 'l2_update',
3207             'l2_update_compressed', 'l2_alloc_cow_read', 'l2_alloc_write',
3208             'read_aio', 'read_backing_aio', 'read_compressed', 'write_aio',
3209             'write_compressed', 'vmstate_load', 'vmstate_save', 'cow_read',
3210             'cow_write', 'reftable_load', 'reftable_grow', 'reftable_update',
3211             'refblock_load', 'refblock_update', 'refblock_update_part',
3212             'refblock_alloc', 'refblock_alloc_hookup', 'refblock_alloc_write',
3213             'refblock_alloc_write_blocks', 'refblock_alloc_write_table',
3214             'refblock_alloc_switch_table', 'cluster_alloc',
3215             'cluster_alloc_bytes', 'cluster_free', 'flush_to_os',
3216             'flush_to_disk', 'pwritev_rmw_head', 'pwritev_rmw_after_head',
3217             'pwritev_rmw_tail', 'pwritev_rmw_after_tail', 'pwritev',
3218             'pwritev_zero', 'pwritev_done', 'empty_image_prepare',
3219             'l1_shrink_write_table', 'l1_shrink_free_l2_clusters',
3220             'cor_write'] }
3221
3222 ##
3223 # @BlkdebugInjectErrorOptions:
3224 #
3225 # Describes a single error injection for blkdebug.
3226 #
3227 # @event:       trigger event
3228 #
3229 # @state:       the state identifier blkdebug needs to be in to
3230 #               actually trigger the event; defaults to "any"
3231 #
3232 # @errno:       error identifier (errno) to be returned; defaults to
3233 #               EIO
3234 #
3235 # @sector:      specifies the sector index which has to be affected
3236 #               in order to actually trigger the event; defaults to "any
3237 #               sector"
3238 #
3239 # @once:        disables further events after this one has been
3240 #               triggered; defaults to false
3241 #
3242 # @immediately: fail immediately; defaults to false
3243 #
3244 # Since: 2.9
3245 ##
3246 { 'struct': 'BlkdebugInjectErrorOptions',
3247   'data': { 'event': 'BlkdebugEvent',
3248             '*state': 'int',
3249             '*errno': 'int',
3250             '*sector': 'int',
3251             '*once': 'bool',
3252             '*immediately': 'bool' } }
3253
3254 ##
3255 # @BlkdebugSetStateOptions:
3256 #
3257 # Describes a single state-change event for blkdebug.
3258 #
3259 # @event:       trigger event
3260 #
3261 # @state:       the current state identifier blkdebug needs to be in;
3262 #               defaults to "any"
3263 #
3264 # @new_state:   the state identifier blkdebug is supposed to assume if
3265 #               this event is triggered
3266 #
3267 # Since: 2.9
3268 ##
3269 { 'struct': 'BlkdebugSetStateOptions',
3270   'data': { 'event': 'BlkdebugEvent',
3271             '*state': 'int',
3272             'new_state': 'int' } }
3273
3274 ##
3275 # @BlockdevOptionsBlkdebug:
3276 #
3277 # Driver specific block device options for blkdebug.
3278 #
3279 # @image:           underlying raw block device (or image file)
3280 #
3281 # @config:          filename of the configuration file
3282 #
3283 # @align:           required alignment for requests in bytes, must be
3284 #                   positive power of 2, or 0 for default
3285 #
3286 # @max-transfer:    maximum size for I/O transfers in bytes, must be
3287 #                   positive multiple of @align and of the underlying
3288 #                   file's request alignment (but need not be a power of
3289 #                   2), or 0 for default (since 2.10)
3290 #
3291 # @opt-write-zero:  preferred alignment for write zero requests in bytes,
3292 #                   must be positive multiple of @align and of the
3293 #                   underlying file's request alignment (but need not be a
3294 #                   power of 2), or 0 for default (since 2.10)
3295 #
3296 # @max-write-zero:  maximum size for write zero requests in bytes, must be
3297 #                   positive multiple of @align, of @opt-write-zero, and of
3298 #                   the underlying file's request alignment (but need not
3299 #                   be a power of 2), or 0 for default (since 2.10)
3300 #
3301 # @opt-discard:     preferred alignment for discard requests in bytes, must
3302 #                   be positive multiple of @align and of the underlying
3303 #                   file's request alignment (but need not be a power of
3304 #                   2), or 0 for default (since 2.10)
3305 #
3306 # @max-discard:     maximum size for discard requests in bytes, must be
3307 #                   positive multiple of @align, of @opt-discard, and of
3308 #                   the underlying file's request alignment (but need not
3309 #                   be a power of 2), or 0 for default (since 2.10)
3310 #
3311 # @inject-error:    array of error injection descriptions
3312 #
3313 # @set-state:       array of state-change descriptions
3314 #
3315 # Since: 2.9
3316 ##
3317 { 'struct': 'BlockdevOptionsBlkdebug',
3318   'data': { 'image': 'BlockdevRef',
3319             '*config': 'str',
3320             '*align': 'int', '*max-transfer': 'int32',
3321             '*opt-write-zero': 'int32', '*max-write-zero': 'int32',
3322             '*opt-discard': 'int32', '*max-discard': 'int32',
3323             '*inject-error': ['BlkdebugInjectErrorOptions'],
3324             '*set-state': ['BlkdebugSetStateOptions'] } }
3325
3326 ##
3327 # @BlockdevOptionsBlklogwrites:
3328 #
3329 # Driver specific block device options for blklogwrites.
3330 #
3331 # @file:            block device
3332 #
3333 # @log:             block device used to log writes to @file
3334 #
3335 # @log-sector-size: sector size used in logging writes to @file, determines
3336 #                   granularity of offsets and sizes of writes (default: 512)
3337 #
3338 # @log-append:      append to an existing log (default: false)
3339 #
3340 # @log-super-update-interval: interval of write requests after which the log
3341 #                             super block is updated to disk (default: 4096)
3342 #
3343 # Since: 3.0
3344 ##
3345 { 'struct': 'BlockdevOptionsBlklogwrites',
3346   'data': { 'file': 'BlockdevRef',
3347             'log': 'BlockdevRef',
3348             '*log-sector-size': 'uint32',
3349             '*log-append': 'bool',
3350             '*log-super-update-interval': 'uint64' } }
3351
3352 ##
3353 # @BlockdevOptionsBlkverify:
3354 #
3355 # Driver specific block device options for blkverify.
3356 #
3357 # @test:    block device to be tested
3358 #
3359 # @raw:     raw image used for verification
3360 #
3361 # Since: 2.9
3362 ##
3363 { 'struct': 'BlockdevOptionsBlkverify',
3364   'data': { 'test': 'BlockdevRef',
3365             'raw': 'BlockdevRef' } }
3366
3367 ##
3368 # @QuorumReadPattern:
3369 #
3370 # An enumeration of quorum read patterns.
3371 #
3372 # @quorum: read all the children and do a quorum vote on reads
3373 #
3374 # @fifo: read only from the first child that has not failed
3375 #
3376 # Since: 2.9
3377 ##
3378 { 'enum': 'QuorumReadPattern', 'data': [ 'quorum', 'fifo' ] }
3379
3380 ##
3381 # @BlockdevOptionsQuorum:
3382 #
3383 # Driver specific block device options for Quorum
3384 #
3385 # @blkverify:      true if the driver must print content mismatch
3386 #                  set to false by default
3387 #
3388 # @children:       the children block devices to use
3389 #
3390 # @vote-threshold: the vote limit under which a read will fail
3391 #
3392 # @rewrite-corrupted: rewrite corrupted data when quorum is reached
3393 #                     (Since 2.1)
3394 #
3395 # @read-pattern: choose read pattern and set to quorum by default
3396 #                (Since 2.2)
3397 #
3398 # Since: 2.9
3399 ##
3400 { 'struct': 'BlockdevOptionsQuorum',
3401   'data': { '*blkverify': 'bool',
3402             'children': [ 'BlockdevRef' ],
3403             'vote-threshold': 'int',
3404             '*rewrite-corrupted': 'bool',
3405             '*read-pattern': 'QuorumReadPattern' } }
3406
3407 ##
3408 # @BlockdevOptionsGluster:
3409 #
3410 # Driver specific block device options for Gluster
3411 #
3412 # @volume:      name of gluster volume where VM image resides
3413 #
3414 # @path:        absolute path to image file in gluster volume
3415 #
3416 # @server:      gluster servers description
3417 #
3418 # @debug:       libgfapi log level (default '4' which is Error)
3419 #               (Since 2.8)
3420 #
3421 # @logfile:     libgfapi log file (default /dev/stderr) (Since 2.8)
3422 #
3423 # Since: 2.9
3424 ##
3425 { 'struct': 'BlockdevOptionsGluster',
3426   'data': { 'volume': 'str',
3427             'path': 'str',
3428             'server': ['SocketAddress'],
3429             '*debug': 'int',
3430             '*logfile': 'str' } }
3431
3432 ##
3433 # @IscsiTransport:
3434 #
3435 # An enumeration of libiscsi transport types
3436 #
3437 # Since: 2.9
3438 ##
3439 { 'enum': 'IscsiTransport',
3440   'data': [ 'tcp', 'iser' ] }
3441
3442 ##
3443 # @IscsiHeaderDigest:
3444 #
3445 # An enumeration of header digests supported by libiscsi
3446 #
3447 # Since: 2.9
3448 ##
3449 { 'enum': 'IscsiHeaderDigest',
3450   'prefix': 'QAPI_ISCSI_HEADER_DIGEST',
3451   'data': [ 'crc32c', 'none', 'crc32c-none', 'none-crc32c' ] }
3452
3453 ##
3454 # @BlockdevOptionsIscsi:
3455 #
3456 # @transport:       The iscsi transport type
3457 #
3458 # @portal:          The address of the iscsi portal
3459 #
3460 # @target:          The target iqn name
3461 #
3462 # @lun:             LUN to connect to. Defaults to 0.
3463 #
3464 # @user:            User name to log in with. If omitted, no CHAP
3465 #                   authentication is performed.
3466 #
3467 # @password-secret: The ID of a QCryptoSecret object providing
3468 #                   the password for the login. This option is required if
3469 #                   @user is specified.
3470 #
3471 # @initiator-name:  The iqn name we want to identify to the target
3472 #                   as. If this option is not specified, an initiator name is
3473 #                   generated automatically.
3474 #
3475 # @header-digest:   The desired header digest. Defaults to
3476 #                   none-crc32c.
3477 #
3478 # @timeout:         Timeout in seconds after which a request will
3479 #                   timeout. 0 means no timeout and is the default.
3480 #
3481 # Driver specific block device options for iscsi
3482 #
3483 # Since: 2.9
3484 ##
3485 { 'struct': 'BlockdevOptionsIscsi',
3486   'data': { 'transport': 'IscsiTransport',
3487             'portal': 'str',
3488             'target': 'str',
3489             '*lun': 'int',
3490             '*user': 'str',
3491             '*password-secret': 'str',
3492             '*initiator-name': 'str',
3493             '*header-digest': 'IscsiHeaderDigest',
3494             '*timeout': 'int' } }
3495
3496
3497 ##
3498 # @RbdAuthMode:
3499 #
3500 # Since: 3.0
3501 ##
3502 { 'enum': 'RbdAuthMode',
3503   'data': [ 'cephx', 'none' ] }
3504
3505 ##
3506 # @BlockdevOptionsRbd:
3507 #
3508 # @pool:               Ceph pool name.
3509 #
3510 # @image:              Image name in the Ceph pool.
3511 #
3512 # @conf:               path to Ceph configuration file.  Values
3513 #                      in the configuration file will be overridden by
3514 #                      options specified via QAPI.
3515 #
3516 # @snapshot:           Ceph snapshot name.
3517 #
3518 # @user:               Ceph id name.
3519 #
3520 # @auth-client-required: Acceptable authentication modes.
3521 #                      This maps to Ceph configuration option
3522 #                      "auth_client_required".  (Since 3.0)
3523 #
3524 # @key-secret:         ID of a QCryptoSecret object providing a key
3525 #                      for cephx authentication.
3526 #                      This maps to Ceph configuration option
3527 #                      "key".  (Since 3.0)
3528 #
3529 # @server:             Monitor host address and port.  This maps
3530 #                      to the "mon_host" Ceph option.
3531 #
3532 # Since: 2.9
3533 ##
3534 { 'struct': 'BlockdevOptionsRbd',
3535   'data': { 'pool': 'str',
3536             'image': 'str',
3537             '*conf': 'str',
3538             '*snapshot': 'str',
3539             '*user': 'str',
3540             '*auth-client-required': ['RbdAuthMode'],
3541             '*key-secret': 'str',
3542             '*server': ['InetSocketAddressBase'] } }
3543
3544 ##
3545 # @BlockdevOptionsSheepdog:
3546 #
3547 # Driver specific block device options for sheepdog
3548 #
3549 # @vdi:         Virtual disk image name
3550 # @server:      The Sheepdog server to connect to
3551 # @snap-id:     Snapshot ID
3552 # @tag:         Snapshot tag name
3553 #
3554 # Only one of @snap-id and @tag may be present.
3555 #
3556 # Since: 2.9
3557 ##
3558 { 'struct': 'BlockdevOptionsSheepdog',
3559   'data': { 'server': 'SocketAddress',
3560             'vdi': 'str',
3561             '*snap-id': 'uint32',
3562             '*tag': 'str' } }
3563
3564 ##
3565 # @ReplicationMode:
3566 #
3567 # An enumeration of replication modes.
3568 #
3569 # @primary: Primary mode, the vm's state will be sent to secondary QEMU.
3570 #
3571 # @secondary: Secondary mode, receive the vm's state from primary QEMU.
3572 #
3573 # Since: 2.9
3574 ##
3575 { 'enum' : 'ReplicationMode', 'data' : [ 'primary', 'secondary' ],
3576   'if': 'defined(CONFIG_REPLICATION)' }
3577
3578 ##
3579 # @BlockdevOptionsReplication:
3580 #
3581 # Driver specific block device options for replication
3582 #
3583 # @mode: the replication mode
3584 #
3585 # @top-id: In secondary mode, node name or device ID of the root
3586 #          node who owns the replication node chain. Must not be given in
3587 #          primary mode.
3588 #
3589 # Since: 2.9
3590 ##
3591 { 'struct': 'BlockdevOptionsReplication',
3592   'base': 'BlockdevOptionsGenericFormat',
3593   'data': { 'mode': 'ReplicationMode',
3594             '*top-id': 'str' },
3595   'if': 'defined(CONFIG_REPLICATION)' }
3596
3597 ##
3598 # @NFSTransport:
3599 #
3600 # An enumeration of NFS transport types
3601 #
3602 # @inet:        TCP transport
3603 #
3604 # Since: 2.9
3605 ##
3606 { 'enum': 'NFSTransport',
3607   'data': [ 'inet' ] }
3608
3609 ##
3610 # @NFSServer:
3611 #
3612 # Captures the address of the socket
3613 #
3614 # @type:        transport type used for NFS (only TCP supported)
3615 #
3616 # @host:        host address for NFS server
3617 #
3618 # Since: 2.9
3619 ##
3620 { 'struct': 'NFSServer',
3621   'data': { 'type': 'NFSTransport',
3622             'host': 'str' } }
3623
3624 ##
3625 # @BlockdevOptionsNfs:
3626 #
3627 # Driver specific block device option for NFS
3628 #
3629 # @server:                  host address
3630 #
3631 # @path:                    path of the image on the host
3632 #
3633 # @user:                    UID value to use when talking to the
3634 #                           server (defaults to 65534 on Windows and getuid()
3635 #                           on unix)
3636 #
3637 # @group:                   GID value to use when talking to the
3638 #                           server (defaults to 65534 on Windows and getgid()
3639 #                           in unix)
3640 #
3641 # @tcp-syn-count:           number of SYNs during the session
3642 #                           establishment (defaults to libnfs default)
3643 #
3644 # @readahead-size:          set the readahead size in bytes (defaults
3645 #                           to libnfs default)
3646 #
3647 # @page-cache-size:         set the pagecache size in bytes (defaults
3648 #                           to libnfs default)
3649 #
3650 # @debug:                   set the NFS debug level (max 2) (defaults
3651 #                           to libnfs default)
3652 #
3653 # Since: 2.9
3654 ##
3655 { 'struct': 'BlockdevOptionsNfs',
3656   'data': { 'server': 'NFSServer',
3657             'path': 'str',
3658             '*user': 'int',
3659             '*group': 'int',
3660             '*tcp-syn-count': 'int',
3661             '*readahead-size': 'int',
3662             '*page-cache-size': 'int',
3663             '*debug': 'int' } }
3664
3665 ##
3666 # @BlockdevOptionsCurlBase:
3667 #
3668 # Driver specific block device options shared by all protocols supported by the
3669 # curl backend.
3670 #
3671 # @url:                     URL of the image file
3672 #
3673 # @readahead:               Size of the read-ahead cache; must be a multiple of
3674 #                           512 (defaults to 256 kB)
3675 #
3676 # @timeout:                 Timeout for connections, in seconds (defaults to 5)
3677 #
3678 # @username:                Username for authentication (defaults to none)
3679 #
3680 # @password-secret:         ID of a QCryptoSecret object providing a password
3681 #                           for authentication (defaults to no password)
3682 #
3683 # @proxy-username:          Username for proxy authentication (defaults to none)
3684 #
3685 # @proxy-password-secret:   ID of a QCryptoSecret object providing a password
3686 #                           for proxy authentication (defaults to no password)
3687 #
3688 # Since: 2.9
3689 ##
3690 { 'struct': 'BlockdevOptionsCurlBase',
3691   'data': { 'url': 'str',
3692             '*readahead': 'int',
3693             '*timeout': 'int',
3694             '*username': 'str',
3695             '*password-secret': 'str',
3696             '*proxy-username': 'str',
3697             '*proxy-password-secret': 'str' } }
3698
3699 ##
3700 # @BlockdevOptionsCurlHttp:
3701 #
3702 # Driver specific block device options for HTTP connections over the curl
3703 # backend.  URLs must start with "http://".
3704 #
3705 # @cookie:      List of cookies to set; format is
3706 #               "name1=content1; name2=content2;" as explained by
3707 #               CURLOPT_COOKIE(3). Defaults to no cookies.
3708 #
3709 # @cookie-secret: ID of a QCryptoSecret object providing the cookie data in a
3710 #                 secure way. See @cookie for the format. (since 2.10)
3711 #
3712 # Since: 2.9
3713 ##
3714 { 'struct': 'BlockdevOptionsCurlHttp',
3715   'base': 'BlockdevOptionsCurlBase',
3716   'data': { '*cookie': 'str',
3717             '*cookie-secret': 'str'} }
3718
3719 ##
3720 # @BlockdevOptionsCurlHttps:
3721 #
3722 # Driver specific block device options for HTTPS connections over the curl
3723 # backend.  URLs must start with "https://".
3724 #
3725 # @cookie:      List of cookies to set; format is
3726 #               "name1=content1; name2=content2;" as explained by
3727 #               CURLOPT_COOKIE(3). Defaults to no cookies.
3728 #
3729 # @sslverify:   Whether to verify the SSL certificate's validity (defaults to
3730 #               true)
3731 #
3732 # @cookie-secret: ID of a QCryptoSecret object providing the cookie data in a
3733 #                 secure way. See @cookie for the format. (since 2.10)
3734 #
3735 # Since: 2.9
3736 ##
3737 { 'struct': 'BlockdevOptionsCurlHttps',
3738   'base': 'BlockdevOptionsCurlBase',
3739   'data': { '*cookie': 'str',
3740             '*sslverify': 'bool',
3741             '*cookie-secret': 'str'} }
3742
3743 ##
3744 # @BlockdevOptionsCurlFtp:
3745 #
3746 # Driver specific block device options for FTP connections over the curl
3747 # backend.  URLs must start with "ftp://".
3748 #
3749 # Since: 2.9
3750 ##
3751 { 'struct': 'BlockdevOptionsCurlFtp',
3752   'base': 'BlockdevOptionsCurlBase',
3753   'data': { } }
3754
3755 ##
3756 # @BlockdevOptionsCurlFtps:
3757 #
3758 # Driver specific block device options for FTPS connections over the curl
3759 # backend.  URLs must start with "ftps://".
3760 #
3761 # @sslverify:   Whether to verify the SSL certificate's validity (defaults to
3762 #               true)
3763 #
3764 # Since: 2.9
3765 ##
3766 { 'struct': 'BlockdevOptionsCurlFtps',
3767   'base': 'BlockdevOptionsCurlBase',
3768   'data': { '*sslverify': 'bool' } }
3769
3770 ##
3771 # @BlockdevOptionsNbd:
3772 #
3773 # Driver specific block device options for NBD.
3774 #
3775 # @server:      NBD server address
3776 #
3777 # @export:      export name
3778 #
3779 # @tls-creds:   TLS credentials ID
3780 #
3781 # @x-dirty-bitmap: A "qemu:dirty-bitmap:NAME" string to query in place of
3782 #                  traditional "base:allocation" block status (see
3783 #                  NBD_OPT_LIST_META_CONTEXT in the NBD protocol) (since 3.0)
3784 #
3785 # Since: 2.9
3786 ##
3787 { 'struct': 'BlockdevOptionsNbd',
3788   'data': { 'server': 'SocketAddress',
3789             '*export': 'str',
3790             '*tls-creds': 'str',
3791             '*x-dirty-bitmap': 'str' } }
3792
3793 ##
3794 # @BlockdevOptionsRaw:
3795 #
3796 # Driver specific block device options for the raw driver.
3797 #
3798 # @offset:      position where the block device starts
3799 # @size:        the assumed size of the device
3800 #
3801 # Since: 2.9
3802 ##
3803 { 'struct': 'BlockdevOptionsRaw',
3804   'base': 'BlockdevOptionsGenericFormat',
3805   'data': { '*offset': 'int', '*size': 'int' } }
3806
3807 ##
3808 # @BlockdevOptionsVxHS:
3809 #
3810 # Driver specific block device options for VxHS
3811 #
3812 # @vdisk-id:    UUID of VxHS volume
3813 # @server:      vxhs server IP, port
3814 # @tls-creds:   TLS credentials ID
3815 #
3816 # Since: 2.10
3817 ##
3818 { 'struct': 'BlockdevOptionsVxHS',
3819   'data': { 'vdisk-id': 'str',
3820             'server': 'InetSocketAddressBase',
3821             '*tls-creds': 'str' } }
3822
3823 ##
3824 # @BlockdevOptionsThrottle:
3825 #
3826 # Driver specific block device options for the throttle driver
3827 #
3828 # @throttle-group:   the name of the throttle-group object to use. It
3829 #                    must already exist.
3830 # @file:             reference to or definition of the data source block device
3831 # Since: 2.11
3832 ##
3833 { 'struct': 'BlockdevOptionsThrottle',
3834   'data': { 'throttle-group': 'str',
3835             'file' : 'BlockdevRef'
3836              } }
3837 ##
3838 # @BlockdevOptions:
3839 #
3840 # Options for creating a block device.  Many options are available for all
3841 # block devices, independent of the block driver:
3842 #
3843 # @driver:        block driver name
3844 # @node-name:     the node name of the new node (Since 2.0).
3845 #                 This option is required on the top level of blockdev-add.
3846 #                 Valid node names start with an alphabetic character and may
3847 #                 contain only alphanumeric characters, '-', '.' and '_'. Their
3848 #                 maximum length is 31 characters.
3849 # @discard:       discard-related options (default: ignore)
3850 # @cache:         cache-related options
3851 # @read-only:     whether the block device should be read-only (default: false).
3852 #                 Note that some block drivers support only read-only access,
3853 #                 either generally or in certain configurations. In this case,
3854 #                 the default value does not work and the option must be
3855 #                 specified explicitly.
3856 # @auto-read-only: if true and @read-only is false, QEMU may automatically
3857 #                  decide not to open the image read-write as requested, but
3858 #                  fall back to read-only instead (and switch between the modes
3859 #                  later), e.g. depending on whether the image file is writable
3860 #                  or whether a writing user is attached to the node
3861 #                  (default: false, since 3.1)
3862 # @detect-zeroes: detect and optimize zero writes (Since 2.1)
3863 #                 (default: off)
3864 # @force-share:   force share all permission on added nodes.
3865 #                 Requires read-only=true. (Since 2.10)
3866 #
3867 # Remaining options are determined by the block driver.
3868 #
3869 # Since: 2.9
3870 ##
3871 { 'union': 'BlockdevOptions',
3872   'base': { 'driver': 'BlockdevDriver',
3873             '*node-name': 'str',
3874             '*discard': 'BlockdevDiscardOptions',
3875             '*cache': 'BlockdevCacheOptions',
3876             '*read-only': 'bool',
3877             '*auto-read-only': 'bool',
3878             '*force-share': 'bool',
3879             '*detect-zeroes': 'BlockdevDetectZeroesOptions' },
3880   'discriminator': 'driver',
3881   'data': {
3882       'blkdebug':   'BlockdevOptionsBlkdebug',
3883       'blklogwrites':'BlockdevOptionsBlklogwrites',
3884       'blkverify':  'BlockdevOptionsBlkverify',
3885       'bochs':      'BlockdevOptionsGenericFormat',
3886       'cloop':      'BlockdevOptionsGenericFormat',
3887       'copy-on-read':'BlockdevOptionsGenericFormat',
3888       'dmg':        'BlockdevOptionsGenericFormat',
3889       'file':       'BlockdevOptionsFile',
3890       'ftp':        'BlockdevOptionsCurlFtp',
3891       'ftps':       'BlockdevOptionsCurlFtps',
3892       'gluster':    'BlockdevOptionsGluster',
3893       'host_cdrom': 'BlockdevOptionsFile',
3894       'host_device':'BlockdevOptionsFile',
3895       'http':       'BlockdevOptionsCurlHttp',
3896       'https':      'BlockdevOptionsCurlHttps',
3897       'iscsi':      'BlockdevOptionsIscsi',
3898       'luks':       'BlockdevOptionsLUKS',
3899       'nbd':        'BlockdevOptionsNbd',
3900       'nfs':        'BlockdevOptionsNfs',
3901       'null-aio':   'BlockdevOptionsNull',
3902       'null-co':    'BlockdevOptionsNull',
3903       'nvme':       'BlockdevOptionsNVMe',
3904       'parallels':  'BlockdevOptionsGenericFormat',
3905       'qcow2':      'BlockdevOptionsQcow2',
3906       'qcow':       'BlockdevOptionsQcow',
3907       'qed':        'BlockdevOptionsGenericCOWFormat',
3908       'quorum':     'BlockdevOptionsQuorum',
3909       'raw':        'BlockdevOptionsRaw',
3910       'rbd':        'BlockdevOptionsRbd',
3911       'replication': { 'type': 'BlockdevOptionsReplication',
3912                        'if': 'defined(CONFIG_REPLICATION)' },
3913       'sheepdog':   'BlockdevOptionsSheepdog',
3914       'ssh':        'BlockdevOptionsSsh',
3915       'throttle':   'BlockdevOptionsThrottle',
3916       'vdi':        'BlockdevOptionsGenericFormat',
3917       'vhdx':       'BlockdevOptionsGenericFormat',
3918       'vmdk':       'BlockdevOptionsGenericCOWFormat',
3919       'vpc':        'BlockdevOptionsGenericFormat',
3920       'vvfat':      'BlockdevOptionsVVFAT',
3921       'vxhs':       'BlockdevOptionsVxHS'
3922   } }
3923
3924 ##
3925 # @BlockdevRef:
3926 #
3927 # Reference to a block device.
3928 #
3929 # @definition:      defines a new block device inline
3930 # @reference:       references the ID of an existing block device
3931 #
3932 # Since: 2.9
3933 ##
3934 { 'alternate': 'BlockdevRef',
3935   'data': { 'definition': 'BlockdevOptions',
3936             'reference': 'str' } }
3937
3938 ##
3939 # @BlockdevRefOrNull:
3940 #
3941 # Reference to a block device.
3942 #
3943 # @definition:      defines a new block device inline
3944 # @reference:       references the ID of an existing block device.
3945 #                   An empty string means that no block device should
3946 #                   be referenced.  Deprecated; use null instead.
3947 # @null:            No block device should be referenced (since 2.10)
3948 #
3949 # Since: 2.9
3950 ##
3951 { 'alternate': 'BlockdevRefOrNull',
3952   'data': { 'definition': 'BlockdevOptions',
3953             'reference': 'str',
3954             'null': 'null' } }
3955
3956 ##
3957 # @blockdev-add:
3958 #
3959 # Creates a new block device. If the @id option is given at the top level, a
3960 # BlockBackend will be created; otherwise, @node-name is mandatory at the top
3961 # level and no BlockBackend will be created.
3962 #
3963 # Since: 2.9
3964 #
3965 # Example:
3966 #
3967 # 1.
3968 # -> { "execute": "blockdev-add",
3969 #      "arguments": {
3970 #           "driver": "qcow2",
3971 #           "node-name": "test1",
3972 #           "file": {
3973 #               "driver": "file",
3974 #               "filename": "test.qcow2"
3975 #            }
3976 #       }
3977 #     }
3978 # <- { "return": {} }
3979 #
3980 # 2.
3981 # -> { "execute": "blockdev-add",
3982 #      "arguments": {
3983 #           "driver": "qcow2",
3984 #           "node-name": "node0",
3985 #           "discard": "unmap",
3986 #           "cache": {
3987 #              "direct": true
3988 #            },
3989 #            "file": {
3990 #              "driver": "file",
3991 #              "filename": "/tmp/test.qcow2"
3992 #            },
3993 #            "backing": {
3994 #               "driver": "raw",
3995 #               "file": {
3996 #                  "driver": "file",
3997 #                  "filename": "/dev/fdset/4"
3998 #                }
3999 #            }
4000 #        }
4001 #      }
4002 #
4003 # <- { "return": {} }
4004 #
4005 ##
4006 { 'command': 'blockdev-add', 'data': 'BlockdevOptions', 'boxed': true }
4007
4008 ##
4009 # @blockdev-del:
4010 #
4011 # Deletes a block device that has been added using blockdev-add.
4012 # The command will fail if the node is attached to a device or is
4013 # otherwise being used.
4014 #
4015 # @node-name: Name of the graph node to delete.
4016 #
4017 # Since: 2.9
4018 #
4019 # Example:
4020 #
4021 # -> { "execute": "blockdev-add",
4022 #      "arguments": {
4023 #           "driver": "qcow2",
4024 #           "node-name": "node0",
4025 #           "file": {
4026 #               "driver": "file",
4027 #               "filename": "test.qcow2"
4028 #           }
4029 #      }
4030 #    }
4031 # <- { "return": {} }
4032 #
4033 # -> { "execute": "blockdev-del",
4034 #      "arguments": { "node-name": "node0" }
4035 #    }
4036 # <- { "return": {} }
4037 #
4038 ##
4039 { 'command': 'blockdev-del', 'data': { 'node-name': 'str' } }
4040
4041 ##
4042 # @BlockdevCreateOptionsFile:
4043 #
4044 # Driver specific image creation options for file.
4045 #
4046 # @filename         Filename for the new image file
4047 # @size             Size of the virtual disk in bytes
4048 # @preallocation    Preallocation mode for the new image (default: off)
4049 # @nocow            Turn off copy-on-write (valid only on btrfs; default: off)
4050 #
4051 # Since: 2.12
4052 ##
4053 { 'struct': 'BlockdevCreateOptionsFile',
4054   'data': { 'filename':         'str',
4055             'size':             'size',
4056             '*preallocation':   'PreallocMode',
4057             '*nocow':           'bool' } }
4058
4059 ##
4060 # @BlockdevCreateOptionsGluster:
4061 #
4062 # Driver specific image creation options for gluster.
4063 #
4064 # @location         Where to store the new image file
4065 # @size             Size of the virtual disk in bytes
4066 # @preallocation    Preallocation mode for the new image (default: off)
4067 #
4068 # Since: 2.12
4069 ##
4070 { 'struct': 'BlockdevCreateOptionsGluster',
4071   'data': { 'location':         'BlockdevOptionsGluster',
4072             'size':             'size',
4073             '*preallocation':   'PreallocMode' } }
4074
4075 ##
4076 # @BlockdevCreateOptionsLUKS:
4077 #
4078 # Driver specific image creation options for LUKS.
4079 #
4080 # @file             Node to create the image format on
4081 # @size             Size of the virtual disk in bytes
4082 #
4083 # Since: 2.12
4084 ##
4085 { 'struct': 'BlockdevCreateOptionsLUKS',
4086   'base': 'QCryptoBlockCreateOptionsLUKS',
4087   'data': { 'file':             'BlockdevRef',
4088             'size':             'size' } }
4089
4090 ##
4091 # @BlockdevCreateOptionsNfs:
4092 #
4093 # Driver specific image creation options for NFS.
4094 #
4095 # @location         Where to store the new image file
4096 # @size             Size of the virtual disk in bytes
4097 #
4098 # Since: 2.12
4099 ##
4100 { 'struct': 'BlockdevCreateOptionsNfs',
4101   'data': { 'location':         'BlockdevOptionsNfs',
4102             'size':             'size' } }
4103
4104 ##
4105 # @BlockdevCreateOptionsParallels:
4106 #
4107 # Driver specific image creation options for parallels.
4108 #
4109 # @file             Node to create the image format on
4110 # @size             Size of the virtual disk in bytes
4111 # @cluster-size     Cluster size in bytes (default: 1 MB)
4112 #
4113 # Since: 2.12
4114 ##
4115 { 'struct': 'BlockdevCreateOptionsParallels',
4116   'data': { 'file':             'BlockdevRef',
4117             'size':             'size',
4118             '*cluster-size':    'size' } }
4119
4120 ##
4121 # @BlockdevCreateOptionsQcow:
4122 #
4123 # Driver specific image creation options for qcow.
4124 #
4125 # @file             Node to create the image format on
4126 # @size             Size of the virtual disk in bytes
4127 # @backing-file     File name of the backing file if a backing file
4128 #                   should be used
4129 # @encrypt          Encryption options if the image should be encrypted
4130 #
4131 # Since: 2.12
4132 ##
4133 { 'struct': 'BlockdevCreateOptionsQcow',
4134   'data': { 'file':             'BlockdevRef',
4135             'size':             'size',
4136             '*backing-file':    'str',
4137             '*encrypt':         'QCryptoBlockCreateOptions' } }
4138
4139 ##
4140 # @BlockdevQcow2Version:
4141 #
4142 # @v2:  The original QCOW2 format as introduced in qemu 0.10 (version 2)
4143 # @v3:  The extended QCOW2 format as introduced in qemu 1.1 (version 3)
4144 #
4145 # Since: 2.12
4146 ##
4147 { 'enum': 'BlockdevQcow2Version',
4148   'data': [ 'v2', 'v3' ] }
4149
4150
4151 ##
4152 # @BlockdevCreateOptionsQcow2:
4153 #
4154 # Driver specific image creation options for qcow2.
4155 #
4156 # @file             Node to create the image format on
4157 # @data-file        Node to use as an external data file in which all guest
4158 #                   data is stored so that only metadata remains in the qcow2
4159 #                   file (since: 4.0)
4160 # @data-file-raw    True if the external data file must stay valid as a
4161 #                   standalone (read-only) raw image without looking at qcow2
4162 #                   metadata (default: false; since: 4.0)
4163 # @size             Size of the virtual disk in bytes
4164 # @version          Compatibility level (default: v3)
4165 # @backing-file     File name of the backing file if a backing file
4166 #                   should be used
4167 # @backing-fmt      Name of the block driver to use for the backing file
4168 # @encrypt          Encryption options if the image should be encrypted
4169 # @cluster-size     qcow2 cluster size in bytes (default: 65536)
4170 # @preallocation    Preallocation mode for the new image (default: off)
4171 # @lazy-refcounts   True if refcounts may be updated lazily (default: off)
4172 # @refcount-bits    Width of reference counts in bits (default: 16)
4173 #
4174 # Since: 2.12
4175 ##
4176 { 'struct': 'BlockdevCreateOptionsQcow2',
4177   'data': { 'file':             'BlockdevRef',
4178             '*data-file':       'BlockdevRef',
4179             '*data-file-raw':   'bool',
4180             'size':             'size',
4181             '*version':         'BlockdevQcow2Version',
4182             '*backing-file':    'str',
4183             '*backing-fmt':     'BlockdevDriver',
4184             '*encrypt':         'QCryptoBlockCreateOptions',
4185             '*cluster-size':    'size',
4186             '*preallocation':   'PreallocMode',
4187             '*lazy-refcounts':  'bool',
4188             '*refcount-bits':   'int' } }
4189
4190 ##
4191 # @BlockdevCreateOptionsQed:
4192 #
4193 # Driver specific image creation options for qed.
4194 #
4195 # @file             Node to create the image format on
4196 # @size             Size of the virtual disk in bytes
4197 # @backing-file     File name of the backing file if a backing file
4198 #                   should be used
4199 # @backing-fmt      Name of the block driver to use for the backing file
4200 # @cluster-size     Cluster size in bytes (default: 65536)
4201 # @table-size       L1/L2 table size (in clusters)
4202 #
4203 # Since: 2.12
4204 ##
4205 { 'struct': 'BlockdevCreateOptionsQed',
4206   'data': { 'file':             'BlockdevRef',
4207             'size':             'size',
4208             '*backing-file':    'str',
4209             '*backing-fmt':     'BlockdevDriver',
4210             '*cluster-size':    'size',
4211             '*table-size':      'int' } }
4212
4213 ##
4214 # @BlockdevCreateOptionsRbd:
4215 #
4216 # Driver specific image creation options for rbd/Ceph.
4217 #
4218 # @location         Where to store the new image file. This location cannot
4219 #                   point to a snapshot.
4220 # @size             Size of the virtual disk in bytes
4221 # @cluster-size     RBD object size
4222 #
4223 # Since: 2.12
4224 ##
4225 { 'struct': 'BlockdevCreateOptionsRbd',
4226   'data': { 'location':         'BlockdevOptionsRbd',
4227             'size':             'size',
4228             '*cluster-size' :   'size' } }
4229
4230 ##
4231 # @BlockdevVmdkSubformat:
4232 #
4233 # Subformat options for VMDK images
4234 #
4235 # @monolithicSparse:     Single file image with sparse cluster allocation
4236 #
4237 # @monolithicFlat:       Single flat data image and a descriptor file
4238 #
4239 # @twoGbMaxExtentSparse: Data is split into 2GB (per virtual LBA) sparse extent
4240 #                        files, in addition to a descriptor file
4241 #
4242 # @twoGbMaxExtentFlat:   Data is split into 2GB (per virtual LBA) flat extent
4243 #                        files, in addition to a descriptor file
4244 #
4245 # @streamOptimized:      Single file image sparse cluster allocation, optimized
4246 #                        for streaming over network.
4247 #
4248 # Since: 4.0
4249 ##
4250 { 'enum': 'BlockdevVmdkSubformat',
4251   'data': [ 'monolithicSparse', 'monolithicFlat', 'twoGbMaxExtentSparse',
4252             'twoGbMaxExtentFlat', 'streamOptimized'] }
4253
4254 ##
4255 # @BlockdevVmdkAdapterType:
4256 #
4257 # Adapter type info for VMDK images
4258 #
4259 # Since: 4.0
4260 ##
4261 { 'enum': 'BlockdevVmdkAdapterType',
4262   'data': [ 'ide', 'buslogic', 'lsilogic', 'legacyESX'] }
4263
4264 ##
4265 # @BlockdevCreateOptionsVmdk:
4266 #
4267 # Driver specific image creation options for VMDK.
4268 #
4269 # @file         Where to store the new image file. This refers to the image
4270 #               file for monolithcSparse and streamOptimized format, or the
4271 #               descriptor file for other formats.
4272 # @size         Size of the virtual disk in bytes
4273 # @extents      Where to store the data extents. Required for monolithcFlat,
4274 #               twoGbMaxExtentSparse and twoGbMaxExtentFlat formats. For
4275 #               monolithicFlat, only one entry is required; for
4276 #               twoGbMaxExtent* formats, the number of entries required is
4277 #               calculated as extent_number = virtual_size / 2GB. Providing
4278 #               more extents than will be used is an error.
4279 # @subformat    The subformat of the VMDK image. Default: "monolithicSparse".
4280 # @backing-file The path of backing file. Default: no backing file is used.
4281 # @adapter-type The adapter type used to fill in the descriptor. Default: ide.
4282 # @hwversion    Hardware version. The meaningful options are "4" or "6".
4283 #               Default: "4".
4284 # @zeroed-grain Whether to enable zeroed-grain feature for sparse subformats.
4285 #               Default: false.
4286 #
4287 # Since: 4.0
4288 ##
4289 { 'struct': 'BlockdevCreateOptionsVmdk',
4290   'data': { 'file':             'BlockdevRef',
4291             'size':             'size',
4292             '*extents':          ['BlockdevRef'],
4293             '*subformat':       'BlockdevVmdkSubformat',
4294             '*backing-file':    'str',
4295             '*adapter-type':    'BlockdevVmdkAdapterType',
4296             '*hwversion':       'str',
4297             '*zeroed-grain':    'bool' } }
4298
4299
4300 ##
4301 # @SheepdogRedundancyType:
4302 #
4303 # @full             Create a fully replicated vdi with x copies
4304 # @erasure-coded    Create an erasure coded vdi with x data strips and
4305 #                   y parity strips
4306 #
4307 # Since: 2.12
4308 ##
4309 { 'enum': 'SheepdogRedundancyType',
4310   'data': [ 'full', 'erasure-coded' ] }
4311
4312 ##
4313 # @SheepdogRedundancyFull:
4314 #
4315 # @copies           Number of copies to use (between 1 and 31)
4316 #
4317 # Since: 2.12
4318 ##
4319 { 'struct': 'SheepdogRedundancyFull',
4320   'data': { 'copies': 'int' }}
4321
4322 ##
4323 # @SheepdogRedundancyErasureCoded:
4324 #
4325 # @data-strips      Number of data strips to use (one of {2,4,8,16})
4326 # @parity-strips    Number of parity strips to use (between 1 and 15)
4327 #
4328 # Since: 2.12
4329 ##
4330 { 'struct': 'SheepdogRedundancyErasureCoded',
4331   'data': { 'data-strips': 'int',
4332             'parity-strips': 'int' }}
4333
4334 ##
4335 # @SheepdogRedundancy:
4336 #
4337 # Since: 2.12
4338 ##
4339 { 'union': 'SheepdogRedundancy',
4340   'base': { 'type': 'SheepdogRedundancyType' },
4341   'discriminator': 'type',
4342   'data': { 'full': 'SheepdogRedundancyFull',
4343             'erasure-coded': 'SheepdogRedundancyErasureCoded' } }
4344
4345 ##
4346 # @BlockdevCreateOptionsSheepdog:
4347 #
4348 # Driver specific image creation options for Sheepdog.
4349 #
4350 # @location         Where to store the new image file
4351 # @size             Size of the virtual disk in bytes
4352 # @backing-file     File name of a base image
4353 # @preallocation    Preallocation mode (allowed values: off, full)
4354 # @redundancy       Redundancy of the image
4355 # @object-size      Object size of the image
4356 #
4357 # Since: 2.12
4358 ##
4359 { 'struct': 'BlockdevCreateOptionsSheepdog',
4360   'data': { 'location':         'BlockdevOptionsSheepdog',
4361             'size':             'size',
4362             '*backing-file':    'str',
4363             '*preallocation':   'PreallocMode',
4364             '*redundancy':      'SheepdogRedundancy',
4365             '*object-size':     'size' } }
4366
4367 ##
4368 # @BlockdevCreateOptionsSsh:
4369 #
4370 # Driver specific image creation options for SSH.
4371 #
4372 # @location         Where to store the new image file
4373 # @size             Size of the virtual disk in bytes
4374 #
4375 # Since: 2.12
4376 ##
4377 { 'struct': 'BlockdevCreateOptionsSsh',
4378   'data': { 'location':         'BlockdevOptionsSsh',
4379             'size':             'size' } }
4380
4381 ##
4382 # @BlockdevCreateOptionsVdi:
4383 #
4384 # Driver specific image creation options for VDI.
4385 #
4386 # @file             Node to create the image format on
4387 # @size             Size of the virtual disk in bytes
4388 # @preallocation    Preallocation mode for the new image (allowed values: off,
4389 #                   metadata; default: off)
4390 #
4391 # Since: 2.12
4392 ##
4393 { 'struct': 'BlockdevCreateOptionsVdi',
4394   'data': { 'file':             'BlockdevRef',
4395             'size':             'size',
4396             '*preallocation':   'PreallocMode' } }
4397
4398 ##
4399 # @BlockdevVhdxSubformat:
4400 #
4401 # @dynamic: Growing image file
4402 # @fixed:   Preallocated fixed-size image file
4403 #
4404 # Since: 2.12
4405 ##
4406 { 'enum': 'BlockdevVhdxSubformat',
4407   'data': [ 'dynamic', 'fixed' ] }
4408
4409 ##
4410 # @BlockdevCreateOptionsVhdx:
4411 #
4412 # Driver specific image creation options for vhdx.
4413 #
4414 # @file             Node to create the image format on
4415 # @size             Size of the virtual disk in bytes
4416 # @log-size         Log size in bytes, must be a multiple of 1 MB
4417 #                   (default: 1 MB)
4418 # @block-size       Block size in bytes, must be a multiple of 1 MB and not
4419 #                   larger than 256 MB (default: automatically choose a block
4420 #                   size depending on the image size)
4421 # @subformat        vhdx subformat (default: dynamic)
4422 # @block-state-zero Force use of payload blocks of type 'ZERO'. Non-standard,
4423 #                   but default.  Do not set to 'off' when using 'qemu-img
4424 #                   convert' with subformat=dynamic.
4425 #
4426 # Since: 2.12
4427 ##
4428 { 'struct': 'BlockdevCreateOptionsVhdx',
4429   'data': { 'file':                 'BlockdevRef',
4430             'size':                 'size',
4431             '*log-size':            'size',
4432             '*block-size':          'size',
4433             '*subformat':           'BlockdevVhdxSubformat',
4434             '*block-state-zero':    'bool' } }
4435
4436 ##
4437 # @BlockdevVpcSubformat:
4438 #
4439 # @dynamic: Growing image file
4440 # @fixed:   Preallocated fixed-size image file
4441 #
4442 # Since: 2.12
4443 ##
4444 { 'enum': 'BlockdevVpcSubformat',
4445   'data': [ 'dynamic', 'fixed' ] }
4446
4447 ##
4448 # @BlockdevCreateOptionsVpc:
4449 #
4450 # Driver specific image creation options for vpc (VHD).
4451 #
4452 # @file             Node to create the image format on
4453 # @size             Size of the virtual disk in bytes
4454 # @subformat        vhdx subformat (default: dynamic)
4455 # @force-size       Force use of the exact byte size instead of rounding to the
4456 #                   next size that can be represented in CHS geometry
4457 #                   (default: false)
4458 #
4459 # Since: 2.12
4460 ##
4461 { 'struct': 'BlockdevCreateOptionsVpc',
4462   'data': { 'file':                 'BlockdevRef',
4463             'size':                 'size',
4464             '*subformat':           'BlockdevVpcSubformat',
4465             '*force-size':          'bool' } }
4466
4467 ##
4468 # @BlockdevCreateOptions:
4469 #
4470 # Options for creating an image format on a given node.
4471 #
4472 # @driver           block driver to create the image format
4473 #
4474 # Since: 2.12
4475 ##
4476 { 'union': 'BlockdevCreateOptions',
4477   'base': {
4478       'driver':         'BlockdevDriver' },
4479   'discriminator': 'driver',
4480   'data': {
4481       'file':           'BlockdevCreateOptionsFile',
4482       'gluster':        'BlockdevCreateOptionsGluster',
4483       'luks':           'BlockdevCreateOptionsLUKS',
4484       'nfs':            'BlockdevCreateOptionsNfs',
4485       'parallels':      'BlockdevCreateOptionsParallels',
4486       'qcow':           'BlockdevCreateOptionsQcow',
4487       'qcow2':          'BlockdevCreateOptionsQcow2',
4488       'qed':            'BlockdevCreateOptionsQed',
4489       'rbd':            'BlockdevCreateOptionsRbd',
4490       'sheepdog':       'BlockdevCreateOptionsSheepdog',
4491       'ssh':            'BlockdevCreateOptionsSsh',
4492       'vdi':            'BlockdevCreateOptionsVdi',
4493       'vhdx':           'BlockdevCreateOptionsVhdx',
4494       'vmdk':           'BlockdevCreateOptionsVmdk',
4495       'vpc':            'BlockdevCreateOptionsVpc'
4496   } }
4497
4498 ##
4499 # @blockdev-create:
4500 #
4501 # Starts a job to create an image format on a given node. The job is
4502 # automatically finalized, but a manual job-dismiss is required.
4503 #
4504 # @job-id:          Identifier for the newly created job.
4505 #
4506 # @options:         Options for the image creation.
4507 #
4508 # Since: 3.0
4509 ##
4510 { 'command': 'blockdev-create',
4511   'data': { 'job-id': 'str',
4512             'options': 'BlockdevCreateOptions' } }
4513
4514 ##
4515 # @blockdev-open-tray:
4516 #
4517 # Opens a block device's tray. If there is a block driver state tree inserted as
4518 # a medium, it will become inaccessible to the guest (but it will remain
4519 # associated to the block device, so closing the tray will make it accessible
4520 # again).
4521 #
4522 # If the tray was already open before, this will be a no-op.
4523 #
4524 # Once the tray opens, a DEVICE_TRAY_MOVED event is emitted. There are cases in
4525 # which no such event will be generated, these include:
4526 # - if the guest has locked the tray, @force is false and the guest does not
4527 #   respond to the eject request
4528 # - if the BlockBackend denoted by @device does not have a guest device attached
4529 #   to it
4530 # - if the guest device does not have an actual tray
4531 #
4532 # @device: Block device name (deprecated, use @id instead)
4533 #
4534 # @id:     The name or QOM path of the guest device (since: 2.8)
4535 #
4536 # @force:  if false (the default), an eject request will be sent to
4537 #          the guest if it has locked the tray (and the tray will not be opened
4538 #          immediately); if true, the tray will be opened regardless of whether
4539 #          it is locked
4540 #
4541 # Since: 2.5
4542 #
4543 # Example:
4544 #
4545 # -> { "execute": "blockdev-open-tray",
4546 #      "arguments": { "id": "ide0-1-0" } }
4547 #
4548 # <- { "timestamp": { "seconds": 1418751016,
4549 #                     "microseconds": 716996 },
4550 #      "event": "DEVICE_TRAY_MOVED",
4551 #      "data": { "device": "ide1-cd0",
4552 #                "id": "ide0-1-0",
4553 #                "tray-open": true } }
4554 #
4555 # <- { "return": {} }
4556 #
4557 ##
4558 { 'command': 'blockdev-open-tray',
4559   'data': { '*device': 'str',
4560             '*id': 'str',
4561             '*force': 'bool' } }
4562
4563 ##
4564 # @blockdev-close-tray:
4565 #
4566 # Closes a block device's tray. If there is a block driver state tree associated
4567 # with the block device (which is currently ejected), that tree will be loaded
4568 # as the medium.
4569 #
4570 # If the tray was already closed before, this will be a no-op.
4571 #
4572 # @device:  Block device name (deprecated, use @id instead)
4573 #
4574 # @id:      The name or QOM path of the guest device (since: 2.8)
4575 #
4576 # Since: 2.5
4577 #
4578 # Example:
4579 #
4580 # -> { "execute": "blockdev-close-tray",
4581 #      "arguments": { "id": "ide0-1-0" } }
4582 #
4583 # <- { "timestamp": { "seconds": 1418751345,
4584 #                     "microseconds": 272147 },
4585 #      "event": "DEVICE_TRAY_MOVED",
4586 #      "data": { "device": "ide1-cd0",
4587 #                "id": "ide0-1-0",
4588 #                "tray-open": false } }
4589 #
4590 # <- { "return": {} }
4591 #
4592 ##
4593 { 'command': 'blockdev-close-tray',
4594   'data': { '*device': 'str',
4595             '*id': 'str' } }
4596
4597 ##
4598 # @blockdev-remove-medium:
4599 #
4600 # Removes a medium (a block driver state tree) from a block device. That block
4601 # device's tray must currently be open (unless there is no attached guest
4602 # device).
4603 #
4604 # If the tray is open and there is no medium inserted, this will be a no-op.
4605 #
4606 # @id:     The name or QOM path of the guest device
4607 #
4608 # Since: 2.12
4609 #
4610 # Example:
4611 #
4612 # -> { "execute": "blockdev-remove-medium",
4613 #      "arguments": { "id": "ide0-1-0" } }
4614 #
4615 # <- { "error": { "class": "GenericError",
4616 #                 "desc": "Tray of device 'ide0-1-0' is not open" } }
4617 #
4618 # -> { "execute": "blockdev-open-tray",
4619 #      "arguments": { "id": "ide0-1-0" } }
4620 #
4621 # <- { "timestamp": { "seconds": 1418751627,
4622 #                     "microseconds": 549958 },
4623 #      "event": "DEVICE_TRAY_MOVED",
4624 #      "data": { "device": "ide1-cd0",
4625 #                "id": "ide0-1-0",
4626 #                "tray-open": true } }
4627 #
4628 # <- { "return": {} }
4629 #
4630 # -> { "execute": "blockdev-remove-medium",
4631 #      "arguments": { "id": "ide0-1-0" } }
4632 #
4633 # <- { "return": {} }
4634 #
4635 ##
4636 { 'command': 'blockdev-remove-medium',
4637   'data': { 'id': 'str' } }
4638
4639 ##
4640 # @blockdev-insert-medium:
4641 #
4642 # Inserts a medium (a block driver state tree) into a block device. That block
4643 # device's tray must currently be open (unless there is no attached guest
4644 # device) and there must be no medium inserted already.
4645 #
4646 # @id:        The name or QOM path of the guest device
4647 #
4648 # @node-name: name of a node in the block driver state graph
4649 #
4650 # Since: 2.12
4651 #
4652 # Example:
4653 #
4654 # -> { "execute": "blockdev-add",
4655 #      "arguments": {
4656 #          "node-name": "node0",
4657 #          "driver": "raw",
4658 #          "file": { "driver": "file",
4659 #                    "filename": "fedora.iso" } } }
4660 # <- { "return": {} }
4661 #
4662 # -> { "execute": "blockdev-insert-medium",
4663 #      "arguments": { "id": "ide0-1-0",
4664 #                     "node-name": "node0" } }
4665 #
4666 # <- { "return": {} }
4667 #
4668 ##
4669 { 'command': 'blockdev-insert-medium',
4670   'data': { 'id': 'str',
4671             'node-name': 'str'} }
4672
4673
4674 ##
4675 # @BlockdevChangeReadOnlyMode:
4676 #
4677 # Specifies the new read-only mode of a block device subject to the
4678 # @blockdev-change-medium command.
4679 #
4680 # @retain:      Retains the current read-only mode
4681 #
4682 # @read-only:   Makes the device read-only
4683 #
4684 # @read-write:  Makes the device writable
4685 #
4686 # Since: 2.3
4687 #
4688 ##
4689 { 'enum': 'BlockdevChangeReadOnlyMode',
4690   'data': ['retain', 'read-only', 'read-write'] }
4691
4692
4693 ##
4694 # @blockdev-change-medium:
4695 #
4696 # Changes the medium inserted into a block device by ejecting the current medium
4697 # and loading a new image file which is inserted as the new medium (this command
4698 # combines blockdev-open-tray, blockdev-remove-medium, blockdev-insert-medium
4699 # and blockdev-close-tray).
4700 #
4701 # @device:          Block device name (deprecated, use @id instead)
4702 #
4703 # @id:              The name or QOM path of the guest device
4704 #                   (since: 2.8)
4705 #
4706 # @filename:        filename of the new image to be loaded
4707 #
4708 # @format:          format to open the new image with (defaults to
4709 #                   the probed format)
4710 #
4711 # @read-only-mode:  change the read-only mode of the device; defaults
4712 #                   to 'retain'
4713 #
4714 # Since: 2.5
4715 #
4716 # Examples:
4717 #
4718 # 1. Change a removable medium
4719 #
4720 # -> { "execute": "blockdev-change-medium",
4721 #      "arguments": { "id": "ide0-1-0",
4722 #                     "filename": "/srv/images/Fedora-12-x86_64-DVD.iso",
4723 #                     "format": "raw" } }
4724 # <- { "return": {} }
4725 #
4726 # 2. Load a read-only medium into a writable drive
4727 #
4728 # -> { "execute": "blockdev-change-medium",
4729 #      "arguments": { "id": "floppyA",
4730 #                     "filename": "/srv/images/ro.img",
4731 #                     "format": "raw",
4732 #                     "read-only-mode": "retain" } }
4733 #
4734 # <- { "error":
4735 #      { "class": "GenericError",
4736 #        "desc": "Could not open '/srv/images/ro.img': Permission denied" } }
4737 #
4738 # -> { "execute": "blockdev-change-medium",
4739 #      "arguments": { "id": "floppyA",
4740 #                     "filename": "/srv/images/ro.img",
4741 #                     "format": "raw",
4742 #                     "read-only-mode": "read-only" } }
4743 #
4744 # <- { "return": {} }
4745 #
4746 ##
4747 { 'command': 'blockdev-change-medium',
4748   'data': { '*device': 'str',
4749             '*id': 'str',
4750             'filename': 'str',
4751             '*format': 'str',
4752             '*read-only-mode': 'BlockdevChangeReadOnlyMode' } }
4753
4754
4755 ##
4756 # @BlockErrorAction:
4757 #
4758 # An enumeration of action that has been taken when a DISK I/O occurs
4759 #
4760 # @ignore: error has been ignored
4761 #
4762 # @report: error has been reported to the device
4763 #
4764 # @stop: error caused VM to be stopped
4765 #
4766 # Since: 2.1
4767 ##
4768 { 'enum': 'BlockErrorAction',
4769   'data': [ 'ignore', 'report', 'stop' ] }
4770
4771
4772 ##
4773 # @BLOCK_IMAGE_CORRUPTED:
4774 #
4775 # Emitted when a disk image is being marked corrupt. The image can be
4776 # identified by its device or node name. The 'device' field is always
4777 # present for compatibility reasons, but it can be empty ("") if the
4778 # image does not have a device name associated.
4779 #
4780 # @device: device name. This is always present for compatibility
4781 #          reasons, but it can be empty ("") if the image does not
4782 #          have a device name associated.
4783 #
4784 # @node-name: node name (Since: 2.4)
4785 #
4786 # @msg: informative message for human consumption, such as the kind of
4787 #       corruption being detected. It should not be parsed by machine as it is
4788 #       not guaranteed to be stable
4789 #
4790 # @offset: if the corruption resulted from an image access, this is
4791 #          the host's access offset into the image
4792 #
4793 # @size: if the corruption resulted from an image access, this is
4794 #        the access size
4795 #
4796 # @fatal: if set, the image is marked corrupt and therefore unusable after this
4797 #        event and must be repaired (Since 2.2; before, every
4798 #        BLOCK_IMAGE_CORRUPTED event was fatal)
4799 #
4800 # Note: If action is "stop", a STOP event will eventually follow the
4801 #       BLOCK_IO_ERROR event.
4802 #
4803 # Example:
4804 #
4805 # <- { "event": "BLOCK_IMAGE_CORRUPTED",
4806 #      "data": { "device": "ide0-hd0", "node-name": "node0",
4807 #                "msg": "Prevented active L1 table overwrite", "offset": 196608,
4808 #                "size": 65536 },
4809 #      "timestamp": { "seconds": 1378126126, "microseconds": 966463 } }
4810 #
4811 # Since: 1.7
4812 ##
4813 { 'event': 'BLOCK_IMAGE_CORRUPTED',
4814   'data': { 'device'     : 'str',
4815             '*node-name' : 'str',
4816             'msg'        : 'str',
4817             '*offset'    : 'int',
4818             '*size'      : 'int',
4819             'fatal'      : 'bool' } }
4820
4821 ##
4822 # @BLOCK_IO_ERROR:
4823 #
4824 # Emitted when a disk I/O error occurs
4825 #
4826 # @device: device name. This is always present for compatibility
4827 #          reasons, but it can be empty ("") if the image does not
4828 #          have a device name associated.
4829 #
4830 # @node-name: node name. Note that errors may be reported for the root node
4831 #             that is directly attached to a guest device rather than for the
4832 #             node where the error occurred. The node name is not present if
4833 #             the drive is empty. (Since: 2.8)
4834 #
4835 # @operation: I/O operation
4836 #
4837 # @action: action that has been taken
4838 #
4839 # @nospace: true if I/O error was caused due to a no-space
4840 #           condition. This key is only present if query-block's
4841 #           io-status is present, please see query-block documentation
4842 #           for more information (since: 2.2)
4843 #
4844 # @reason: human readable string describing the error cause.
4845 #          (This field is a debugging aid for humans, it should not
4846 #           be parsed by applications) (since: 2.2)
4847 #
4848 # Note: If action is "stop", a STOP event will eventually follow the
4849 # BLOCK_IO_ERROR event
4850 #
4851 # Since: 0.13.0
4852 #
4853 # Example:
4854 #
4855 # <- { "event": "BLOCK_IO_ERROR",
4856 #      "data": { "device": "ide0-hd1",
4857 #                "node-name": "#block212",
4858 #                "operation": "write",
4859 #                "action": "stop" },
4860 #      "timestamp": { "seconds": 1265044230, "microseconds": 450486 } }
4861 #
4862 ##
4863 { 'event': 'BLOCK_IO_ERROR',
4864   'data': { 'device': 'str', '*node-name': 'str',
4865             'operation': 'IoOperationType',
4866             'action': 'BlockErrorAction', '*nospace': 'bool',
4867             'reason': 'str' } }
4868
4869 ##
4870 # @BLOCK_JOB_COMPLETED:
4871 #
4872 # Emitted when a block job has completed
4873 #
4874 # @type: job type
4875 #
4876 # @device: The job identifier. Originally the device name but other
4877 #          values are allowed since QEMU 2.7
4878 #
4879 # @len: maximum progress value
4880 #
4881 # @offset: current progress value. On success this is equal to len.
4882 #          On failure this is less than len
4883 #
4884 # @speed: rate limit, bytes per second
4885 #
4886 # @error: error message. Only present on failure. This field
4887 #         contains a human-readable error message. There are no semantics
4888 #         other than that streaming has failed and clients should not try to
4889 #         interpret the error string
4890 #
4891 # Since: 1.1
4892 #
4893 # Example:
4894 #
4895 # <- { "event": "BLOCK_JOB_COMPLETED",
4896 #      "data": { "type": "stream", "device": "virtio-disk0",
4897 #                "len": 10737418240, "offset": 10737418240,
4898 #                "speed": 0 },
4899 #      "timestamp": { "seconds": 1267061043, "microseconds": 959568 } }
4900 #
4901 ##
4902 { 'event': 'BLOCK_JOB_COMPLETED',
4903   'data': { 'type'  : 'JobType',
4904             'device': 'str',
4905             'len'   : 'int',
4906             'offset': 'int',
4907             'speed' : 'int',
4908             '*error': 'str' } }
4909
4910 ##
4911 # @BLOCK_JOB_CANCELLED:
4912 #
4913 # Emitted when a block job has been cancelled
4914 #
4915 # @type: job type
4916 #
4917 # @device: The job identifier. Originally the device name but other
4918 #          values are allowed since QEMU 2.7
4919 #
4920 # @len: maximum progress value
4921 #
4922 # @offset: current progress value. On success this is equal to len.
4923 #          On failure this is less than len
4924 #
4925 # @speed: rate limit, bytes per second
4926 #
4927 # Since: 1.1
4928 #
4929 # Example:
4930 #
4931 # <- { "event": "BLOCK_JOB_CANCELLED",
4932 #      "data": { "type": "stream", "device": "virtio-disk0",
4933 #                "len": 10737418240, "offset": 134217728,
4934 #                "speed": 0 },
4935 #      "timestamp": { "seconds": 1267061043, "microseconds": 959568 } }
4936 #
4937 ##
4938 { 'event': 'BLOCK_JOB_CANCELLED',
4939   'data': { 'type'  : 'JobType',
4940             'device': 'str',
4941             'len'   : 'int',
4942             'offset': 'int',
4943             'speed' : 'int' } }
4944
4945 ##
4946 # @BLOCK_JOB_ERROR:
4947 #
4948 # Emitted when a block job encounters an error
4949 #
4950 # @device: The job identifier. Originally the device name but other
4951 #          values are allowed since QEMU 2.7
4952 #
4953 # @operation: I/O operation
4954 #
4955 # @action: action that has been taken
4956 #
4957 # Since: 1.3
4958 #
4959 # Example:
4960 #
4961 # <- { "event": "BLOCK_JOB_ERROR",
4962 #      "data": { "device": "ide0-hd1",
4963 #                "operation": "write",
4964 #                "action": "stop" },
4965 #      "timestamp": { "seconds": 1265044230, "microseconds": 450486 } }
4966 #
4967 ##
4968 { 'event': 'BLOCK_JOB_ERROR',
4969   'data': { 'device'   : 'str',
4970             'operation': 'IoOperationType',
4971             'action'   : 'BlockErrorAction' } }
4972
4973 ##
4974 # @BLOCK_JOB_READY:
4975 #
4976 # Emitted when a block job is ready to complete
4977 #
4978 # @type: job type
4979 #
4980 # @device: The job identifier. Originally the device name but other
4981 #          values are allowed since QEMU 2.7
4982 #
4983 # @len: maximum progress value
4984 #
4985 # @offset: current progress value. On success this is equal to len.
4986 #          On failure this is less than len
4987 #
4988 # @speed: rate limit, bytes per second
4989 #
4990 # Note: The "ready to complete" status is always reset by a @BLOCK_JOB_ERROR
4991 # event
4992 #
4993 # Since: 1.3
4994 #
4995 # Example:
4996 #
4997 # <- { "event": "BLOCK_JOB_READY",
4998 #      "data": { "device": "drive0", "type": "mirror", "speed": 0,
4999 #                "len": 2097152, "offset": 2097152 }
5000 #      "timestamp": { "seconds": 1265044230, "microseconds": 450486 } }
5001 #
5002 ##
5003 { 'event': 'BLOCK_JOB_READY',
5004   'data': { 'type'  : 'JobType',
5005             'device': 'str',
5006             'len'   : 'int',
5007             'offset': 'int',
5008             'speed' : 'int' } }
5009
5010 ##
5011 # @BLOCK_JOB_PENDING:
5012 #
5013 # Emitted when a block job is awaiting explicit authorization to finalize graph
5014 # changes via @block-job-finalize. If this job is part of a transaction, it will
5015 # not emit this event until the transaction has converged first.
5016 #
5017 # @type: job type
5018 #
5019 # @id: The job identifier.
5020 #
5021 # Since: 2.12
5022 #
5023 # Example:
5024 #
5025 # <- { "event": "BLOCK_JOB_WAITING",
5026 #      "data": { "device": "drive0", "type": "mirror" },
5027 #      "timestamp": { "seconds": 1265044230, "microseconds": 450486 } }
5028 #
5029 ##
5030 { 'event': 'BLOCK_JOB_PENDING',
5031   'data': { 'type'  : 'JobType',
5032             'id'    : 'str' } }
5033
5034 ##
5035 # @PreallocMode:
5036 #
5037 # Preallocation mode of QEMU image file
5038 #
5039 # @off: no preallocation
5040 # @metadata: preallocate only for metadata
5041 # @falloc: like @full preallocation but allocate disk space by
5042 #          posix_fallocate() rather than writing zeros.
5043 # @full: preallocate all data by writing zeros to device to ensure disk
5044 #        space is really available. @full preallocation also sets up
5045 #        metadata correctly.
5046 #
5047 # Since: 2.2
5048 ##
5049 { 'enum': 'PreallocMode',
5050   'data': [ 'off', 'metadata', 'falloc', 'full' ] }
5051
5052 ##
5053 # @BLOCK_WRITE_THRESHOLD:
5054 #
5055 # Emitted when writes on block device reaches or exceeds the
5056 # configured write threshold. For thin-provisioned devices, this
5057 # means the device should be extended to avoid pausing for
5058 # disk exhaustion.
5059 # The event is one shot. Once triggered, it needs to be
5060 # re-registered with another block-set-write-threshold command.
5061 #
5062 # @node-name: graph node name on which the threshold was exceeded.
5063 #
5064 # @amount-exceeded: amount of data which exceeded the threshold, in bytes.
5065 #
5066 # @write-threshold: last configured threshold, in bytes.
5067 #
5068 # Since: 2.3
5069 ##
5070 { 'event': 'BLOCK_WRITE_THRESHOLD',
5071   'data': { 'node-name': 'str',
5072             'amount-exceeded': 'uint64',
5073             'write-threshold': 'uint64' } }
5074
5075 ##
5076 # @block-set-write-threshold:
5077 #
5078 # Change the write threshold for a block drive. An event will be
5079 # delivered if a write to this block drive crosses the configured
5080 # threshold.  The threshold is an offset, thus must be
5081 # non-negative. Default is no write threshold. Setting the threshold
5082 # to zero disables it.
5083 #
5084 # This is useful to transparently resize thin-provisioned drives without
5085 # the guest OS noticing.
5086 #
5087 # @node-name: graph node name on which the threshold must be set.
5088 #
5089 # @write-threshold: configured threshold for the block device, bytes.
5090 #                   Use 0 to disable the threshold.
5091 #
5092 # Since: 2.3
5093 #
5094 # Example:
5095 #
5096 # -> { "execute": "block-set-write-threshold",
5097 #      "arguments": { "node-name": "mydev",
5098 #                     "write-threshold": 17179869184 } }
5099 # <- { "return": {} }
5100 #
5101 ##
5102 { 'command': 'block-set-write-threshold',
5103   'data': { 'node-name': 'str', 'write-threshold': 'uint64' } }
5104
5105 ##
5106 # @x-blockdev-change:
5107 #
5108 # Dynamically reconfigure the block driver state graph. It can be used
5109 # to add, remove, insert or replace a graph node. Currently only the
5110 # Quorum driver implements this feature to add or remove its child. This
5111 # is useful to fix a broken quorum child.
5112 #
5113 # If @node is specified, it will be inserted under @parent. @child
5114 # may not be specified in this case. If both @parent and @child are
5115 # specified but @node is not, @child will be detached from @parent.
5116 #
5117 # @parent: the id or name of the parent node.
5118 #
5119 # @child: the name of a child under the given parent node.
5120 #
5121 # @node: the name of the node that will be added.
5122 #
5123 # Note: this command is experimental, and its API is not stable. It
5124 # does not support all kinds of operations, all kinds of children, nor
5125 # all block drivers.
5126 #
5127 # FIXME Removing children from a quorum node means introducing gaps in the
5128 # child indices. This cannot be represented in the 'children' list of
5129 # BlockdevOptionsQuorum, as returned by .bdrv_refresh_filename().
5130 #
5131 # Warning: The data in a new quorum child MUST be consistent with that of
5132 # the rest of the array.
5133 #
5134 # Since: 2.7
5135 #
5136 # Example:
5137 #
5138 # 1. Add a new node to a quorum
5139 # -> { "execute": "blockdev-add",
5140 #      "arguments": {
5141 #          "driver": "raw",
5142 #          "node-name": "new_node",
5143 #          "file": { "driver": "file",
5144 #                    "filename": "test.raw" } } }
5145 # <- { "return": {} }
5146 # -> { "execute": "x-blockdev-change",
5147 #      "arguments": { "parent": "disk1",
5148 #                     "node": "new_node" } }
5149 # <- { "return": {} }
5150 #
5151 # 2. Delete a quorum's node
5152 # -> { "execute": "x-blockdev-change",
5153 #      "arguments": { "parent": "disk1",
5154 #                     "child": "children.1" } }
5155 # <- { "return": {} }
5156 #
5157 ##
5158 { 'command': 'x-blockdev-change',
5159   'data' : { 'parent': 'str',
5160              '*child': 'str',
5161              '*node': 'str' } }
5162
5163 ##
5164 # @x-blockdev-set-iothread:
5165 #
5166 # Move @node and its children into the @iothread.  If @iothread is null then
5167 # move @node and its children into the main loop.
5168 #
5169 # The node must not be attached to a BlockBackend.
5170 #
5171 # @node-name: the name of the block driver node
5172 #
5173 # @iothread: the name of the IOThread object or null for the main loop
5174 #
5175 # @force: true if the node and its children should be moved when a BlockBackend
5176 #         is already attached
5177 #
5178 # Note: this command is experimental and intended for test cases that need
5179 # control over IOThreads only.
5180 #
5181 # Since: 2.12
5182 #
5183 # Example:
5184 #
5185 # 1. Move a node into an IOThread
5186 # -> { "execute": "x-blockdev-set-iothread",
5187 #      "arguments": { "node-name": "disk1",
5188 #                     "iothread": "iothread0" } }
5189 # <- { "return": {} }
5190 #
5191 # 2. Move a node into the main loop
5192 # -> { "execute": "x-blockdev-set-iothread",
5193 #      "arguments": { "node-name": "disk1",
5194 #                     "iothread": null } }
5195 # <- { "return": {} }
5196 #
5197 ##
5198 { 'command': 'x-blockdev-set-iothread',
5199   'data' : { 'node-name': 'str',
5200              'iothread': 'StrOrNull',
5201              '*force': 'bool' } }
This page took 0.317143 seconds and 4 git commands to generate.