1# -*- Mode: Python -*- 2# 3 4## 5# = Transactions 6## 7 8{ 'include': 'block.json' } 9 10## 11# @Abort: 12# 13# This action can be used to test transaction failure. 14# 15# Since: 1.6 16## 17{ 'struct': 'Abort', 18 'data': { } } 19 20## 21# @ActionCompletionMode: 22# 23# An enumeration of Transactional completion modes. 24# 25# @individual: Do not attempt to cancel any other Actions if any Actions fail 26# after the Transaction request succeeds. All Actions that 27# can complete successfully will do so without waiting on others. 28# This is the default. 29# 30# @grouped: If any Action fails after the Transaction succeeds, cancel all 31# Actions. Actions do not complete until all Actions are ready to 32# complete. May be rejected by Actions that do not support this 33# completion mode. 34# 35# Since: 2.5 36## 37{ 'enum': 'ActionCompletionMode', 38 'data': [ 'individual', 'grouped' ] } 39 40## 41# @TransactionAction: 42# 43# A discriminated record of operations that can be performed with 44# @transaction. Action @type can be: 45# 46# - @abort: since 1.6 47# - @block-dirty-bitmap-add: since 2.5 48# - @block-dirty-bitmap-clear: since 2.5 49# - @x-block-dirty-bitmap-enable: since 3.0 50# - @x-block-dirty-bitmap-disable: since 3.0 51# - @x-block-dirty-bitmap-merge: since 3.1 52# - @blockdev-backup: since 2.3 53# - @blockdev-snapshot: since 2.5 54# - @blockdev-snapshot-internal-sync: since 1.7 55# - @blockdev-snapshot-sync: since 1.1 56# - @drive-backup: since 1.6 57# 58# Since: 1.1 59## 60{ 'union': 'TransactionAction', 61 'data': { 62 'abort': 'Abort', 63 'block-dirty-bitmap-add': 'BlockDirtyBitmapAdd', 64 'block-dirty-bitmap-clear': 'BlockDirtyBitmap', 65 'x-block-dirty-bitmap-enable': 'BlockDirtyBitmap', 66 'x-block-dirty-bitmap-disable': 'BlockDirtyBitmap', 67 'x-block-dirty-bitmap-merge': 'BlockDirtyBitmapMerge', 68 'blockdev-backup': 'BlockdevBackup', 69 'blockdev-snapshot': 'BlockdevSnapshot', 70 'blockdev-snapshot-internal-sync': 'BlockdevSnapshotInternal', 71 'blockdev-snapshot-sync': 'BlockdevSnapshotSync', 72 'drive-backup': 'DriveBackup' 73 } } 74 75## 76# @TransactionProperties: 77# 78# Optional arguments to modify the behavior of a Transaction. 79# 80# @completion-mode: Controls how jobs launched asynchronously by 81# Actions will complete or fail as a group. 82# See @ActionCompletionMode for details. 83# 84# Since: 2.5 85## 86{ 'struct': 'TransactionProperties', 87 'data': { 88 '*completion-mode': 'ActionCompletionMode' 89 } 90} 91 92## 93# @transaction: 94# 95# Executes a number of transactionable QMP commands atomically. If any 96# operation fails, then the entire set of actions will be abandoned and the 97# appropriate error returned. 98# 99# For external snapshots, the dictionary contains the device, the file to use for 100# the new snapshot, and the format. The default format, if not specified, is 101# qcow2. 102# 103# Each new snapshot defaults to being created by QEMU (wiping any 104# contents if the file already exists), but it is also possible to reuse 105# an externally-created file. In the latter case, you should ensure that 106# the new image file has the same contents as the current one; QEMU cannot 107# perform any meaningful check. Typically this is achieved by using the 108# current image file as the backing file for the new image. 109# 110# On failure, the original disks pre-snapshot attempt will be used. 111# 112# For internal snapshots, the dictionary contains the device and the snapshot's 113# name. If an internal snapshot matching name already exists, the request will 114# be rejected. Only some image formats support it, for example, qcow2, rbd, 115# and sheepdog. 116# 117# On failure, qemu will try delete the newly created internal snapshot in the 118# transaction. When an I/O error occurs during deletion, the user needs to fix 119# it later with qemu-img or other command. 120# 121# @actions: List of @TransactionAction; 122# information needed for the respective operations. 123# 124# @properties: structure of additional options to control the 125# execution of the transaction. See @TransactionProperties 126# for additional detail. 127# 128# Returns: nothing on success 129# 130# Errors depend on the operations of the transaction 131# 132# Note: The transaction aborts on the first failure. Therefore, there will be 133# information on only one failed operation returned in an error condition, and 134# subsequent actions will not have been attempted. 135# 136# Since: 1.1 137# 138# Example: 139# 140# -> { "execute": "transaction", 141# "arguments": { "actions": [ 142# { "type": "blockdev-snapshot-sync", "data" : { "device": "ide-hd0", 143# "snapshot-file": "/some/place/my-image", 144# "format": "qcow2" } }, 145# { "type": "blockdev-snapshot-sync", "data" : { "node-name": "myfile", 146# "snapshot-file": "/some/place/my-image2", 147# "snapshot-node-name": "node3432", 148# "mode": "existing", 149# "format": "qcow2" } }, 150# { "type": "blockdev-snapshot-sync", "data" : { "device": "ide-hd1", 151# "snapshot-file": "/some/place/my-image2", 152# "mode": "existing", 153# "format": "qcow2" } }, 154# { "type": "blockdev-snapshot-internal-sync", "data" : { 155# "device": "ide-hd2", 156# "name": "snapshot0" } } ] } } 157# <- { "return": {} } 158# 159## 160{ 'command': 'transaction', 161 'data': { 'actions': [ 'TransactionAction' ], 162 '*properties': 'TransactionProperties' 163 } 164} 165