9 { 'include': 'block-core.json' }
14 # This action can be used to test transaction failure.
22 # @ActionCompletionMode:
24 # An enumeration of Transactional completion modes.
26 # @individual: Do not attempt to cancel any other Actions if any Actions fail
27 # after the Transaction request succeeds. All Actions that
28 # can complete successfully will do so without waiting on others.
29 # This is the default.
31 # @grouped: If any Action fails after the Transaction succeeds, cancel all
32 # Actions. Actions do not complete until all Actions are ready to
33 # complete. May be rejected by Actions that do not support this
38 { 'enum': 'ActionCompletionMode',
39 'data': [ 'individual', 'grouped' ] }
42 # @TransactionActionKind:
45 # @block-dirty-bitmap-add: Since 2.5
46 # @block-dirty-bitmap-remove: Since 4.2
47 # @block-dirty-bitmap-clear: Since 2.5
48 # @block-dirty-bitmap-enable: Since 4.0
49 # @block-dirty-bitmap-disable: Since 4.0
50 # @block-dirty-bitmap-merge: Since 4.0
51 # @blockdev-backup: Since 2.3
52 # @blockdev-snapshot: Since 2.5
53 # @blockdev-snapshot-internal-sync: Since 1.7
54 # @blockdev-snapshot-sync: since 1.1
55 # @drive-backup: Since 1.6
59 { 'enum': 'TransactionActionKind',
60 'data': [ 'abort', 'block-dirty-bitmap-add', 'block-dirty-bitmap-remove',
61 'block-dirty-bitmap-clear', 'block-dirty-bitmap-enable',
62 'block-dirty-bitmap-disable', 'block-dirty-bitmap-merge',
63 'blockdev-backup', 'blockdev-snapshot',
64 'blockdev-snapshot-internal-sync', 'blockdev-snapshot-sync',
72 { 'struct': 'AbortWrapper',
73 'data': { 'data': 'Abort' } }
76 # @BlockDirtyBitmapAddWrapper:
80 { 'struct': 'BlockDirtyBitmapAddWrapper',
81 'data': { 'data': 'BlockDirtyBitmapAdd' } }
84 # @BlockDirtyBitmapWrapper:
88 { 'struct': 'BlockDirtyBitmapWrapper',
89 'data': { 'data': 'BlockDirtyBitmap' } }
92 # @BlockDirtyBitmapMergeWrapper:
96 { 'struct': 'BlockDirtyBitmapMergeWrapper',
97 'data': { 'data': 'BlockDirtyBitmapMerge' } }
100 # @BlockdevBackupWrapper:
104 { 'struct': 'BlockdevBackupWrapper',
105 'data': { 'data': 'BlockdevBackup' } }
108 # @BlockdevSnapshotWrapper:
112 { 'struct': 'BlockdevSnapshotWrapper',
113 'data': { 'data': 'BlockdevSnapshot' } }
116 # @BlockdevSnapshotInternalWrapper:
120 { 'struct': 'BlockdevSnapshotInternalWrapper',
121 'data': { 'data': 'BlockdevSnapshotInternal' } }
124 # @BlockdevSnapshotSyncWrapper:
128 { 'struct': 'BlockdevSnapshotSyncWrapper',
129 'data': { 'data': 'BlockdevSnapshotSync' } }
132 # @DriveBackupWrapper:
136 { 'struct': 'DriveBackupWrapper',
137 'data': { 'data': 'DriveBackup' } }
140 # @TransactionAction:
142 # A discriminated record of operations that can be performed with
147 { 'union': 'TransactionAction',
148 'base': { 'type': 'TransactionActionKind' },
149 'discriminator': 'type',
151 'abort': 'AbortWrapper',
152 'block-dirty-bitmap-add': 'BlockDirtyBitmapAddWrapper',
153 'block-dirty-bitmap-remove': 'BlockDirtyBitmapWrapper',
154 'block-dirty-bitmap-clear': 'BlockDirtyBitmapWrapper',
155 'block-dirty-bitmap-enable': 'BlockDirtyBitmapWrapper',
156 'block-dirty-bitmap-disable': 'BlockDirtyBitmapWrapper',
157 'block-dirty-bitmap-merge': 'BlockDirtyBitmapMergeWrapper',
158 'blockdev-backup': 'BlockdevBackupWrapper',
159 'blockdev-snapshot': 'BlockdevSnapshotWrapper',
160 'blockdev-snapshot-internal-sync': 'BlockdevSnapshotInternalWrapper',
161 'blockdev-snapshot-sync': 'BlockdevSnapshotSyncWrapper',
162 'drive-backup': 'DriveBackupWrapper'
166 # @TransactionProperties:
168 # Optional arguments to modify the behavior of a Transaction.
170 # @completion-mode: Controls how jobs launched asynchronously by
171 # Actions will complete or fail as a group.
172 # See @ActionCompletionMode for details.
176 { 'struct': 'TransactionProperties',
178 '*completion-mode': 'ActionCompletionMode'
185 # Executes a number of transactionable QMP commands atomically. If any
186 # operation fails, then the entire set of actions will be abandoned and the
187 # appropriate error returned.
189 # For external snapshots, the dictionary contains the device, the file to use for
190 # the new snapshot, and the format. The default format, if not specified, is
193 # Each new snapshot defaults to being created by QEMU (wiping any
194 # contents if the file already exists), but it is also possible to reuse
195 # an externally-created file. In the latter case, you should ensure that
196 # the new image file has the same contents as the current one; QEMU cannot
197 # perform any meaningful check. Typically this is achieved by using the
198 # current image file as the backing file for the new image.
200 # On failure, the original disks pre-snapshot attempt will be used.
202 # For internal snapshots, the dictionary contains the device and the
203 # snapshot's name. If an internal snapshot matching name already exists,
204 # the request will be rejected. Only some image formats support it, for
205 # example, qcow2, and rbd,
207 # On failure, qemu will try delete the newly created internal snapshot in the
208 # transaction. When an I/O error occurs during deletion, the user needs to fix
209 # it later with qemu-img or other command.
211 # @actions: List of @TransactionAction;
212 # information needed for the respective operations.
214 # @properties: structure of additional options to control the
215 # execution of the transaction. See @TransactionProperties
216 # for additional detail.
218 # Returns: nothing on success
220 # Errors depend on the operations of the transaction
222 # Note: The transaction aborts on the first failure. Therefore, there will be
223 # information on only one failed operation returned in an error condition, and
224 # subsequent actions will not have been attempted.
230 # -> { "execute": "transaction",
231 # "arguments": { "actions": [
232 # { "type": "blockdev-snapshot-sync", "data" : { "device": "ide-hd0",
233 # "snapshot-file": "/some/place/my-image",
234 # "format": "qcow2" } },
235 # { "type": "blockdev-snapshot-sync", "data" : { "node-name": "myfile",
236 # "snapshot-file": "/some/place/my-image2",
237 # "snapshot-node-name": "node3432",
238 # "mode": "existing",
239 # "format": "qcow2" } },
240 # { "type": "blockdev-snapshot-sync", "data" : { "device": "ide-hd1",
241 # "snapshot-file": "/some/place/my-image2",
242 # "mode": "existing",
243 # "format": "qcow2" } },
244 # { "type": "blockdev-snapshot-internal-sync", "data" : {
245 # "device": "ide-hd2",
246 # "name": "snapshot0" } } ] } }
247 # <- { "return": {} }
250 { 'command': 'transaction',
251 'data': { 'actions': [ 'TransactionAction' ],
252 '*properties': 'TransactionProperties'