c0e831fd2958a6c1b09343a6948d4f566fe3fe54
[sdk/emulator/qemu.git] / qapi / block.json
1 # -*- Mode: Python -*-
2 #
3 # QAPI block definitions (vm related)
4
5 # QAPI block core definitions
6 { 'include': 'block-core.json' }
7
8 ##
9 # @BiosAtaTranslation:
10 #
11 # Policy that BIOS should use to interpret cylinder/head/sector
12 # addresses.  Note that Bochs BIOS and SeaBIOS will not actually
13 # translate logical CHS to physical; instead, they will use logical
14 # block addressing.
15 #
16 # @auto: If cylinder/heads/sizes are passed, choose between none and LBA
17 #        depending on the size of the disk.  If they are not passed,
18 #        choose none if QEMU can guess that the disk had 16 or fewer
19 #        heads, large if QEMU can guess that the disk had 131072 or
20 #        fewer tracks across all heads (i.e. cylinders*heads<131072),
21 #        otherwise LBA.
22 #
23 # @none: The physical disk geometry is equal to the logical geometry.
24 #
25 # @lba: Assume 63 sectors per track and one of 16, 32, 64, 128 or 255
26 #       heads (if fewer than 255 are enough to cover the whole disk
27 #       with 1024 cylinders/head).  The number of cylinders/head is
28 #       then computed based on the number of sectors and heads.
29 #
30 # @large: The number of cylinders per head is scaled down to 1024
31 #         by correspondingly scaling up the number of heads.
32 #
33 # @rechs: Same as @large, but first convert a 16-head geometry to
34 #         15-head, by proportionally scaling up the number of
35 #         cylinders/head.
36 #
37 # Since: 2.0
38 ##
39 { 'enum': 'BiosAtaTranslation',
40   'data': ['auto', 'none', 'lba', 'large', 'rechs']}
41
42 ##
43 # @FloppyDriveType
44 #
45 # Type of Floppy drive to be emulated by the Floppy Disk Controller.
46 #
47 # @144:  1.44MB 3.5" drive
48 # @288:  2.88MB 3.5" drive
49 # @120:  1.2MB 5.25" drive
50 # @none: No drive connected
51 # @auto: Automatically determined by inserted media at boot
52 #
53 # Since: 2.6
54 ##
55 { 'enum': 'FloppyDriveType',
56   'data': ['144', '288', '120', 'none', 'auto']}
57
58 ##
59 # @BlockdevSnapshotInternal
60 #
61 # @device: the name of the device to generate the snapshot from
62 #
63 # @name: the name of the internal snapshot to be created
64 #
65 # Notes: In transaction, if @name is empty, or any snapshot matching @name
66 #        exists, the operation will fail. Only some image formats support it,
67 #        for example, qcow2, rbd, and sheepdog.
68 #
69 # Since: 1.7
70 ##
71 { 'struct': 'BlockdevSnapshotInternal',
72   'data': { 'device': 'str', 'name': 'str' } }
73
74 ##
75 # @blockdev-snapshot-internal-sync
76 #
77 # Synchronously take an internal snapshot of a block device, when the format
78 # of the image used supports it.
79 #
80 # For the arguments, see the documentation of BlockdevSnapshotInternal.
81 #
82 # Returns: nothing on success
83 #          If @device is not a valid block device, DeviceNotFound
84 #          If any snapshot matching @name exists, or @name is empty,
85 #          GenericError
86 #          If the format of the image used does not support it,
87 #          BlockFormatFeatureNotSupported
88 #
89 # Since 1.7
90 ##
91 { 'command': 'blockdev-snapshot-internal-sync',
92   'data': 'BlockdevSnapshotInternal' }
93
94 ##
95 # @blockdev-snapshot-delete-internal-sync
96 #
97 # Synchronously delete an internal snapshot of a block device, when the format
98 # of the image used support it. The snapshot is identified by name or id or
99 # both. One of the name or id is required. Return SnapshotInfo for the
100 # successfully deleted snapshot.
101 #
102 # @device: the device name or node-name of a root node to delete the snapshot
103 #          from
104 #
105 # @id: optional the snapshot's ID to be deleted
106 #
107 # @name: optional the snapshot's name to be deleted
108 #
109 # Returns: SnapshotInfo on success
110 #          If @device is not a valid block device, GenericError
111 #          If snapshot not found, GenericError
112 #          If the format of the image used does not support it,
113 #          BlockFormatFeatureNotSupported
114 #          If @id and @name are both not specified, GenericError
115 #
116 # Since 1.7
117 ##
118 { 'command': 'blockdev-snapshot-delete-internal-sync',
119   'data': { 'device': 'str', '*id': 'str', '*name': 'str'},
120   'returns': 'SnapshotInfo' }
121
122 ##
123 # @eject:
124 #
125 # Ejects a device from a removable drive.
126 #
127 # @device:  The name of the device
128 #
129 # @force:   @optional If true, eject regardless of whether the drive is locked.
130 #           If not specified, the default value is false.
131 #
132 # Returns:  Nothing on success
133 #           If @device is not a valid block device, DeviceNotFound
134 #
135 # Notes:    Ejecting a device will no media results in success
136 #
137 # Since: 0.14.0
138 ##
139 { 'command': 'eject', 'data': {'device': 'str', '*force': 'bool'} }
140
141 ##
142 # @nbd-server-start:
143 #
144 # Start an NBD server listening on the given host and port.  Block
145 # devices can then be exported using @nbd-server-add.  The NBD
146 # server will present them as named exports; for example, another
147 # QEMU instance could refer to them as "nbd:HOST:PORT:exportname=NAME".
148 #
149 # @addr: Address on which to listen.
150 # @tls-creds: (optional) ID of the TLS credentials object. Since 2.6
151 #
152 # Returns: error if the server is already running.
153 #
154 # Since: 1.3.0
155 ##
156 { 'command': 'nbd-server-start',
157   'data': { 'addr': 'SocketAddress',
158             '*tls-creds': 'str'} }
159
160 ##
161 # @nbd-server-add:
162 #
163 # Export a device to QEMU's embedded NBD server.
164 #
165 # @device: Block device to be exported
166 #
167 # @writable: Whether clients should be able to write to the device via the
168 #     NBD connection (default false). #optional
169 #
170 # Returns: error if the device is already marked for export.
171 #
172 # Since: 1.3.0
173 ##
174 { 'command': 'nbd-server-add', 'data': {'device': 'str', '*writable': 'bool'} }
175
176 ##
177 # @nbd-server-stop:
178 #
179 # Stop QEMU's embedded NBD server, and unregister all devices previously
180 # added via @nbd-server-add.
181 #
182 # Since: 1.3.0
183 ##
184 { 'command': 'nbd-server-stop' }
185
186 ##
187 # @DEVICE_TRAY_MOVED
188 #
189 # Emitted whenever the tray of a removable device is moved by the guest or by
190 # HMP/QMP commands
191 #
192 # @device: device name
193 #
194 # @tray-open: true if the tray has been opened or false if it has been closed
195 #
196 # Since: 1.1
197 ##
198 { 'event': 'DEVICE_TRAY_MOVED',
199   'data': { 'device': 'str', 'tray-open': 'bool' } }
200
201 ##
202 # @QuorumOpType
203 #
204 # An enumeration of the quorum operation types
205 #
206 # @read: read operation
207 #
208 # @write: write operation
209 #
210 # @flush: flush operation
211 #
212 # Since: 2.6
213 ##
214 { 'enum': 'QuorumOpType',
215   'data': [ 'read', 'write', 'flush' ] }