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