aboutsummaryrefslogtreecommitdiff
path: root/qapi/block.json
blob: 6a2fdc73f7b3ffb53f2481ba3ef1aa722040fe72 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
# -*- Mode: Python -*-

##
# = QAPI block definitions
##

# QAPI block core definitions
{ 'include': 'block-core.json' }

##
# == QAPI block definitions (vm unrelated)
##

##
# @BiosAtaTranslation:
#
# Policy that BIOS should use to interpret cylinder/head/sector
# addresses.  Note that Bochs BIOS and SeaBIOS will not actually
# translate logical CHS to physical; instead, they will use logical
# block addressing.
#
# @auto: If cylinder/heads/sizes are passed, choose between none and LBA
#        depending on the size of the disk.  If they are not passed,
#        choose none if QEMU can guess that the disk had 16 or fewer
#        heads, large if QEMU can guess that the disk had 131072 or
#        fewer tracks across all heads (i.e. cylinders*heads<131072),
#        otherwise LBA.
#
# @none: The physical disk geometry is equal to the logical geometry.
#
# @lba: Assume 63 sectors per track and one of 16, 32, 64, 128 or 255
#       heads (if fewer than 255 are enough to cover the whole disk
#       with 1024 cylinders/head).  The number of cylinders/head is
#       then computed based on the number of sectors and heads.
#
# @large: The number of cylinders per head is scaled down to 1024
#         by correspondingly scaling up the number of heads.
#
# @rechs: Same as @large, but first convert a 16-head geometry to
#         15-head, by proportionally scaling up the number of
#         cylinders/head.
#
# Since: 2.0
##
{ 'enum': 'BiosAtaTranslation',
  'data': ['auto', 'none', 'lba', 'large', 'rechs']}

##
# @FloppyDriveType:
#
# Type of Floppy drive to be emulated by the Floppy Disk Controller.
#
# @144:  1.44MB 3.5" drive
# @288:  2.88MB 3.5" drive
# @120:  1.2MB 5.25" drive
# @none: No drive connected
# @auto: Automatically determined by inserted media at boot
#
# Since: 2.6
##
{ 'enum': 'FloppyDriveType',
  'data': ['144', '288', '120', 'none', 'auto']}

##
# @BlockdevSnapshotInternal:
#
# @device: the device name or node-name of a root node to generate the snapshot
#          from
#
# @name: the name of the internal snapshot to be created
#
# Notes: In transaction, if @name is empty, or any snapshot matching @name
#        exists, the operation will fail. Only some image formats support it,
#        for example, qcow2, rbd, and sheepdog.
#
# Since: 1.7
##
{ 'struct': 'BlockdevSnapshotInternal',
  'data': { 'device': 'str', 'name': 'str' } }

##
# @blockdev-snapshot-internal-sync:
#
# Synchronously take an internal snapshot of a block device, when the
# format of the image used supports it. If the name is an empty
# string, or a snapshot with name already exists, the operation will
# fail.
#
# For the arguments, see the documentation of BlockdevSnapshotInternal.
#
# Returns: nothing on success
#
#          If @device is not a valid block device, GenericError
#
#          If any snapshot matching @name exists, or @name is empty,
#          GenericError
#
#          If the format of the image used does not support it,
#          BlockFormatFeatureNotSupported
#
# Since: 1.7
#
# Example:
#
# -> { "execute": "blockdev-snapshot-internal-sync",
#      "arguments": { "device": "ide-hd0",
#                     "name": "snapshot0" }
#    }
# <- { "return": {} }
#
##
{ 'command': 'blockdev-snapshot-internal-sync',
  'data': 'BlockdevSnapshotInternal' }

##
# @blockdev-snapshot-delete-internal-sync:
#
# Synchronously delete an internal snapshot of a block device, when the format
# of the image used support it. The snapshot is identified by name or id or
# both. One of the name or id is required. Return SnapshotInfo for the
# successfully deleted snapshot.
#
# @device: the device name or node-name of a root node to delete the snapshot
#          from
#
# @id: optional the snapshot's ID to be deleted
#
# @name: optional the snapshot's name to be deleted
#
# Returns: SnapshotInfo on success
#          If @device is not a valid block device, GenericError
#          If snapshot not found, GenericError
#          If the format of the image used does not support it,
#          BlockFormatFeatureNotSupported
#          If @id and @name are both not specified, GenericError
#
# Since: 1.7
#
# Example:
#
# -> { "execute": "blockdev-snapshot-delete-internal-sync",
#      "arguments": { "device": "ide-hd0",
#                     "name": "snapshot0" }
#    }
# <- { "return": {
#                    "id": "1",
#                    "name": "snapshot0",
#                    "vm-state-size": 0,
#                    "date-sec": 1000012,
#                    "date-nsec": 10,
#                    "vm-clock-sec": 100,
#                    "vm-clock-nsec": 20
#      }
#    }
#
##
{ 'command': 'blockdev-snapshot-delete-internal-sync',
  'data': { 'device': 'str', '*id': 'str', '*name': 'str'},
  'returns': 'SnapshotInfo' }

##
# @eject:
#
# Ejects a device from a removable drive.
#
# @device:  Block device name (deprecated, use @id instead)
#
# @id:      The name or QOM path of the guest device (since: 2.8)
#
# @force:   If true, eject regardless of whether the drive is locked.
#           If not specified, the default value is false.
#
# Returns:  Nothing on success
#
#           If @device is not a valid block device, DeviceNotFound
#
# Notes:    Ejecting a device with no media results in success
#
# Since: 0.14.0
#
# Example:
#
# -> { "execute": "eject", "arguments": { "device": "ide1-0-1" } }
# <- { "return": {} }
##
{ 'command': 'eject',
  'data': { '*device': 'str',
            '*id': 'str',
            '*force': 'bool' } }

##
# @nbd-server-start:
#
# Start an NBD server listening on the given host and port.  Block
# devices can then be exported using @nbd-server-add.  The NBD
# server will present them as named exports; for example, another
# QEMU instance could refer to them as "nbd:HOST:PORT:exportname=NAME".
#
# @addr: Address on which to listen.
# @tls-creds: (optional) ID of the TLS credentials object. Since 2.6
#
# Returns: error if the server is already running.
#
# Since: 1.3.0
##
{ 'command': 'nbd-server-start',
  'data': { 'addr': 'SocketAddressLegacy',
            '*tls-creds': 'str'} }

##
# @nbd-server-add:
#
# Export a block node to QEMU's embedded NBD server.
#
# @device: The device name or node name of the node to be exported
#
# @writable: Whether clients should be able to write to the device via the
#     NBD connection (default false).
#
# Returns: error if the device is already marked for export.
#
# Since: 1.3.0
##
{ 'command': 'nbd-server-add', 'data': {'device': 'str', '*writable': 'bool'} }

##
# @nbd-server-stop:
#
# Stop QEMU's embedded NBD server, and unregister all devices previously
# added via @nbd-server-add.
#
# Since: 1.3.0
##
{ 'command': 'nbd-server-stop' }

##
# @DEVICE_TRAY_MOVED:
#
# Emitted whenever the tray of a removable device is moved by the guest or by
# HMP/QMP commands
#
# @device: Block device name. This is always present for compatibility
#          reasons, but it can be empty ("") if the image does not
#          have a device name associated.
#
# @id: The name or QOM path of the guest device (since 2.8)
#
# @tray-open: true if the tray has been opened or false if it has been closed
#
# Since: 1.1
#
# Example:
#
# <- { "event": "DEVICE_TRAY_MOVED",
#      "data": { "device": "ide1-cd0",
#                "id": "/machine/unattached/device[22]",
#                "tray-open": true
#      },
#      "timestamp": { "seconds": 1265044230, "microseconds": 450486 } }
#
##
{ 'event': 'DEVICE_TRAY_MOVED',
  'data': { 'device': 'str', 'id': 'str', 'tray-open': 'bool' } }

##
# @QuorumOpType:
#
# An enumeration of the quorum operation types
#
# @read: read operation
#
# @write: write operation
#
# @flush: flush operation
#
# Since: 2.6
##
{ 'enum': 'QuorumOpType',
  'data': [ 'read', 'write', 'flush' ] }