OSDN Git Service

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