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