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