xref: /openbmc/qemu/qapi/block.json (revision 3753c75d)
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 device name or node-name of a root node to generate the snapshot
62#          from
63#
64# @name: the name of the internal snapshot to be created
65#
66# Notes: In transaction, if @name is empty, or any snapshot matching @name
67#        exists, the operation will fail. Only some image formats support it,
68#        for example, qcow2, rbd, and sheepdog.
69#
70# Since: 1.7
71##
72{ 'struct': 'BlockdevSnapshotInternal',
73  'data': { 'device': 'str', 'name': 'str' } }
74
75##
76# @blockdev-snapshot-internal-sync:
77#
78# Synchronously take an internal snapshot of a block device, when the format
79# of the image used supports it.
80#
81# For the arguments, see the documentation of BlockdevSnapshotInternal.
82#
83# Returns: nothing on success
84#          If @device is not a valid block device, GenericError
85#          If any snapshot matching @name exists, or @name is empty,
86#          GenericError
87#          If the format of the image used does not support it,
88#          BlockFormatFeatureNotSupported
89#
90# Since: 1.7
91##
92{ 'command': 'blockdev-snapshot-internal-sync',
93  'data': 'BlockdevSnapshotInternal' }
94
95##
96# @blockdev-snapshot-delete-internal-sync:
97#
98# Synchronously delete an internal snapshot of a block device, when the format
99# of the image used support it. The snapshot is identified by name or id or
100# both. One of the name or id is required. Return SnapshotInfo for the
101# successfully deleted snapshot.
102#
103# @device: the device name or node-name of a root node to delete the snapshot
104#          from
105#
106# @id: optional the snapshot's ID to be deleted
107#
108# @name: optional the snapshot's name to be deleted
109#
110# Returns: SnapshotInfo on success
111#          If @device is not a valid block device, GenericError
112#          If snapshot not found, GenericError
113#          If the format of the image used does not support it,
114#          BlockFormatFeatureNotSupported
115#          If @id and @name are both not specified, GenericError
116#
117# Since: 1.7
118##
119{ 'command': 'blockdev-snapshot-delete-internal-sync',
120  'data': { 'device': 'str', '*id': 'str', '*name': 'str'},
121  'returns': 'SnapshotInfo' }
122
123##
124# @eject:
125#
126# Ejects a device from a removable drive.
127#
128# @device:  #optional Block device name (deprecated, use @id instead)
129#
130# @id:      #optional The name or QOM path of the guest device (since: 2.8)
131#
132# @force:   @optional If true, eject regardless of whether the drive is locked.
133#           If not specified, the default value is false.
134#
135# Returns:  Nothing on success
136#           If @device is not a valid block device, DeviceNotFound
137#
138# Notes:    Ejecting a device will no media results in success
139#
140# Since: 0.14.0
141##
142{ 'command': 'eject',
143  'data': { '*device': 'str',
144            '*id': 'str',
145            '*force': 'bool' } }
146
147##
148# @nbd-server-start:
149#
150# Start an NBD server listening on the given host and port.  Block
151# devices can then be exported using @nbd-server-add.  The NBD
152# server will present them as named exports; for example, another
153# QEMU instance could refer to them as "nbd:HOST:PORT:exportname=NAME".
154#
155# @addr: Address on which to listen.
156# @tls-creds: (optional) ID of the TLS credentials object. Since 2.6
157#
158# Returns: error if the server is already running.
159#
160# Since: 1.3.0
161##
162{ 'command': 'nbd-server-start',
163  'data': { 'addr': 'SocketAddress',
164            '*tls-creds': 'str'} }
165
166##
167# @nbd-server-add:
168#
169# Export a block node to QEMU's embedded NBD server.
170#
171# @device: The device name or node name of the node to be exported
172#
173# @writable: Whether clients should be able to write to the device via the
174#     NBD connection (default false). #optional
175#
176# Returns: error if the device is already marked for export.
177#
178# Since: 1.3.0
179##
180{ 'command': 'nbd-server-add', 'data': {'device': 'str', '*writable': 'bool'} }
181
182##
183# @nbd-server-stop:
184#
185# Stop QEMU's embedded NBD server, and unregister all devices previously
186# added via @nbd-server-add.
187#
188# Since: 1.3.0
189##
190{ 'command': 'nbd-server-stop' }
191
192##
193# @DEVICE_TRAY_MOVED:
194#
195# Emitted whenever the tray of a removable device is moved by the guest or by
196# HMP/QMP commands
197#
198# @device: Block device name. This is always present for compatibility
199#          reasons, but it can be empty ("") if the image does not
200#          have a device name associated.
201#
202# @id: The name or QOM path of the guest device (since 2.8)
203#
204# @tray-open: true if the tray has been opened or false if it has been closed
205#
206# Since: 1.1
207##
208{ 'event': 'DEVICE_TRAY_MOVED',
209  'data': { 'device': 'str', 'id': 'str', 'tray-open': 'bool' } }
210
211##
212# @QuorumOpType:
213#
214# An enumeration of the quorum operation types
215#
216# @read: read operation
217#
218# @write: write operation
219#
220# @flush: flush operation
221#
222# Since: 2.6
223##
224{ 'enum': 'QuorumOpType',
225  'data': [ 'read', 'write', 'flush' ] }
226