qapi: Require descriptions and tagged sections to be indented
[qemu/kevin.git] / qapi / transaction.json
blob45233ddd2a815c8b4e7e2f577a798b0f78191870
1 # -*- Mode: Python -*-
2 # vim: filetype=python
5 ##
6 # = Transactions
7 ##
9 { 'include': 'block-core.json' }
12 # @Abort:
14 # This action can be used to test transaction failure.
16 # Since: 1.6
18 { 'struct': 'Abort',
19   'data': { } }
22 # @ActionCompletionMode:
24 # An enumeration of Transactional completion modes.
26 # @individual: Do not attempt to cancel any other Actions if any
27 #     Actions fail after the Transaction request succeeds.  All
28 #     Actions that can complete successfully will do so without
29 #     waiting on others.  This is the default.
31 # @grouped: If any Action fails after the Transaction succeeds, cancel
32 #     all Actions.  Actions do not complete until all Actions are
33 #     ready to complete.  May be rejected by Actions that do not
34 #     support this completion mode.
36 # Since: 2.5
38 { 'enum': 'ActionCompletionMode',
39   'data': [ 'individual', 'grouped' ] }
42 # @TransactionActionKind:
44 # @abort: Since 1.6
46 # @block-dirty-bitmap-add: Since 2.5
48 # @block-dirty-bitmap-remove: Since 4.2
50 # @block-dirty-bitmap-clear: Since 2.5
52 # @block-dirty-bitmap-enable: Since 4.0
54 # @block-dirty-bitmap-disable: Since 4.0
56 # @block-dirty-bitmap-merge: Since 4.0
58 # @blockdev-backup: Since 2.3
60 # @blockdev-snapshot: Since 2.5
62 # @blockdev-snapshot-internal-sync: Since 1.7
64 # @blockdev-snapshot-sync: since 1.1
66 # @drive-backup: Since 1.6
68 # Features:
70 # @deprecated: Member @drive-backup is deprecated.  Use member
71 #     @blockdev-backup instead.
73 # Since: 1.1
75 { 'enum': 'TransactionActionKind',
76   'data': [ 'abort', 'block-dirty-bitmap-add', 'block-dirty-bitmap-remove',
77             'block-dirty-bitmap-clear', 'block-dirty-bitmap-enable',
78             'block-dirty-bitmap-disable', 'block-dirty-bitmap-merge',
79             'blockdev-backup', 'blockdev-snapshot',
80             'blockdev-snapshot-internal-sync', 'blockdev-snapshot-sync',
81             { 'name': 'drive-backup', 'features': [ 'deprecated' ] } ] }
84 # @AbortWrapper:
86 # Since: 1.6
88 { 'struct': 'AbortWrapper',
89   'data': { 'data': 'Abort' } }
92 # @BlockDirtyBitmapAddWrapper:
94 # Since: 2.5
96 { 'struct': 'BlockDirtyBitmapAddWrapper',
97   'data': { 'data': 'BlockDirtyBitmapAdd' } }
100 # @BlockDirtyBitmapWrapper:
102 # Since: 2.5
104 { 'struct': 'BlockDirtyBitmapWrapper',
105   'data': { 'data': 'BlockDirtyBitmap' } }
108 # @BlockDirtyBitmapMergeWrapper:
110 # Since: 4.0
112 { 'struct': 'BlockDirtyBitmapMergeWrapper',
113   'data': { 'data': 'BlockDirtyBitmapMerge' } }
116 # @BlockdevBackupWrapper:
118 # Since: 2.3
120 { 'struct': 'BlockdevBackupWrapper',
121   'data': { 'data': 'BlockdevBackup' } }
124 # @BlockdevSnapshotWrapper:
126 # Since: 2.5
128 { 'struct': 'BlockdevSnapshotWrapper',
129   'data': { 'data': 'BlockdevSnapshot' } }
132 # @BlockdevSnapshotInternalWrapper:
134 # Since: 1.7
136 { 'struct': 'BlockdevSnapshotInternalWrapper',
137   'data': { 'data': 'BlockdevSnapshotInternal' } }
140 # @BlockdevSnapshotSyncWrapper:
142 # Since: 1.1
144 { 'struct': 'BlockdevSnapshotSyncWrapper',
145   'data': { 'data': 'BlockdevSnapshotSync' } }
148 # @DriveBackupWrapper:
150 # Since: 1.6
152 { 'struct': 'DriveBackupWrapper',
153   'data': { 'data': 'DriveBackup' } }
156 # @TransactionAction:
158 # A discriminated record of operations that can be performed with
159 # @transaction.
161 # @type: the operation to be performed
163 # Since: 1.1
165 { 'union': 'TransactionAction',
166   'base': { 'type': 'TransactionActionKind' },
167   'discriminator': 'type',
168   'data': {
169        'abort': 'AbortWrapper',
170        'block-dirty-bitmap-add': 'BlockDirtyBitmapAddWrapper',
171        'block-dirty-bitmap-remove': 'BlockDirtyBitmapWrapper',
172        'block-dirty-bitmap-clear': 'BlockDirtyBitmapWrapper',
173        'block-dirty-bitmap-enable': 'BlockDirtyBitmapWrapper',
174        'block-dirty-bitmap-disable': 'BlockDirtyBitmapWrapper',
175        'block-dirty-bitmap-merge': 'BlockDirtyBitmapMergeWrapper',
176        'blockdev-backup': 'BlockdevBackupWrapper',
177        'blockdev-snapshot': 'BlockdevSnapshotWrapper',
178        'blockdev-snapshot-internal-sync': 'BlockdevSnapshotInternalWrapper',
179        'blockdev-snapshot-sync': 'BlockdevSnapshotSyncWrapper',
180        'drive-backup': 'DriveBackupWrapper'
181    } }
184 # @TransactionProperties:
186 # Optional arguments to modify the behavior of a Transaction.
188 # @completion-mode: Controls how jobs launched asynchronously by
189 #     Actions will complete or fail as a group.  See
190 #     @ActionCompletionMode for details.
192 # Since: 2.5
194 { 'struct': 'TransactionProperties',
195   'data': {
196        '*completion-mode': 'ActionCompletionMode'
197   }
201 # @transaction:
203 # Executes a number of transactionable QMP commands atomically.  If
204 # any operation fails, then the entire set of actions will be
205 # abandoned and the appropriate error returned.
207 # For external snapshots, the dictionary contains the device, the file
208 # to use for the new snapshot, and the format.  The default format, if
209 # not specified, is qcow2.
211 # Each new snapshot defaults to being created by QEMU (wiping any
212 # contents if the file already exists), but it is also possible to
213 # reuse an externally-created file.  In the latter case, you should
214 # ensure that the new image file has the same contents as the current
215 # one; QEMU cannot perform any meaningful check.  Typically this is
216 # achieved by using the current image file as the backing file for the
217 # new image.
219 # On failure, the original disks pre-snapshot attempt will be used.
221 # For internal snapshots, the dictionary contains the device and the
222 # snapshot's name.  If an internal snapshot matching name already
223 # exists, the request will be rejected.  Only some image formats
224 # support it, for example, qcow2, and rbd,
226 # On failure, qemu will try delete the newly created internal snapshot
227 # in the transaction.  When an I/O error occurs during deletion, the
228 # user needs to fix it later with qemu-img or other command.
230 # @actions: List of @TransactionAction; information needed for the
231 #     respective operations.
233 # @properties: structure of additional options to control the
234 #     execution of the transaction.  See @TransactionProperties for
235 #     additional detail.
237 # Returns: nothing on success
239 #     Errors depend on the operations of the transaction
241 # Note: The transaction aborts on the first failure.  Therefore, there
242 #     will be information on only one failed operation returned in an
243 #     error condition, and subsequent actions will not have been
244 #     attempted.
246 # Since: 1.1
248 # Example:
250 #     -> { "execute": "transaction",
251 #          "arguments": { "actions": [
252 #              { "type": "blockdev-snapshot-sync", "data" : { "device": "ide-hd0",
253 #                                          "snapshot-file": "/some/place/my-image",
254 #                                          "format": "qcow2" } },
255 #              { "type": "blockdev-snapshot-sync", "data" : { "node-name": "myfile",
256 #                                          "snapshot-file": "/some/place/my-image2",
257 #                                          "snapshot-node-name": "node3432",
258 #                                          "mode": "existing",
259 #                                          "format": "qcow2" } },
260 #              { "type": "blockdev-snapshot-sync", "data" : { "device": "ide-hd1",
261 #                                          "snapshot-file": "/some/place/my-image2",
262 #                                          "mode": "existing",
263 #                                          "format": "qcow2" } },
264 #              { "type": "blockdev-snapshot-internal-sync", "data" : {
265 #                                          "device": "ide-hd2",
266 #                                          "name": "snapshot0" } } ] } }
267 #     <- { "return": {} }
269 { 'command': 'transaction',
270   'data': { 'actions': [ 'TransactionAction' ],
271             '*properties': 'TransactionProperties'
272           }