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