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