8 { 'include': 'block.json' }
13 # This action can be used to test transaction failure.
21 # @ActionCompletionMode:
23 # An enumeration of Transactional completion modes.
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.
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
37 { 'enum': 'ActionCompletionMode',
38 'data': [ 'individual', 'grouped' ] }
43 # A discriminated record of operations that can be performed with
44 # @transaction. Action @type can be:
47 # - @block-dirty-bitmap-add: since 2.5
48 # - @block-dirty-bitmap-remove: since 4.2
49 # - @block-dirty-bitmap-clear: since 2.5
50 # - @block-dirty-bitmap-enable: since 4.0
51 # - @block-dirty-bitmap-disable: since 4.0
52 # - @block-dirty-bitmap-merge: since 4.0
53 # - @blockdev-backup: since 2.3
54 # - @blockdev-snapshot: since 2.5
55 # - @blockdev-snapshot-internal-sync: since 1.7
56 # - @blockdev-snapshot-sync: since 1.1
57 # - @drive-backup: since 1.6
61 { 'union': 'TransactionAction',
64 'block-dirty-bitmap-add': 'BlockDirtyBitmapAdd',
65 'block-dirty-bitmap-remove': 'BlockDirtyBitmap',
66 'block-dirty-bitmap-clear': 'BlockDirtyBitmap',
67 'block-dirty-bitmap-enable': 'BlockDirtyBitmap',
68 'block-dirty-bitmap-disable': 'BlockDirtyBitmap',
69 'block-dirty-bitmap-merge': 'BlockDirtyBitmapMerge',
70 'blockdev-backup': 'BlockdevBackup',
71 'blockdev-snapshot': 'BlockdevSnapshot',
72 'blockdev-snapshot-internal-sync': 'BlockdevSnapshotInternal',
73 'blockdev-snapshot-sync': 'BlockdevSnapshotSync',
74 'drive-backup': 'DriveBackup'
78 # @TransactionProperties:
80 # Optional arguments to modify the behavior of a Transaction.
82 # @completion-mode: Controls how jobs launched asynchronously by
83 # Actions will complete or fail as a group.
84 # See @ActionCompletionMode for details.
88 { 'struct': 'TransactionProperties',
90 '*completion-mode': 'ActionCompletionMode'
97 # Executes a number of transactionable QMP commands atomically. If any
98 # operation fails, then the entire set of actions will be abandoned and the
99 # appropriate error returned.
101 # For external snapshots, the dictionary contains the device, the file to use for
102 # the new snapshot, and the format. The default format, if not specified, is
105 # Each new snapshot defaults to being created by QEMU (wiping any
106 # contents if the file already exists), but it is also possible to reuse
107 # an externally-created file. In the latter case, you should ensure that
108 # the new image file has the same contents as the current one; QEMU cannot
109 # perform any meaningful check. Typically this is achieved by using the
110 # current image file as the backing file for the new image.
112 # On failure, the original disks pre-snapshot attempt will be used.
114 # For internal snapshots, the dictionary contains the device and the snapshot's
115 # name. If an internal snapshot matching name already exists, the request will
116 # be rejected. Only some image formats support it, for example, qcow2, rbd,
119 # On failure, qemu will try delete the newly created internal snapshot in the
120 # transaction. When an I/O error occurs during deletion, the user needs to fix
121 # it later with qemu-img or other command.
123 # @actions: List of @TransactionAction;
124 # information needed for the respective operations.
126 # @properties: structure of additional options to control the
127 # execution of the transaction. See @TransactionProperties
128 # for additional detail.
130 # Returns: nothing on success
132 # Errors depend on the operations of the transaction
134 # Note: The transaction aborts on the first failure. Therefore, there will be
135 # information on only one failed operation returned in an error condition, and
136 # subsequent actions will not have been attempted.
142 # -> { "execute": "transaction",
143 # "arguments": { "actions": [
144 # { "type": "blockdev-snapshot-sync", "data" : { "device": "ide-hd0",
145 # "snapshot-file": "/some/place/my-image",
146 # "format": "qcow2" } },
147 # { "type": "blockdev-snapshot-sync", "data" : { "node-name": "myfile",
148 # "snapshot-file": "/some/place/my-image2",
149 # "snapshot-node-name": "node3432",
150 # "mode": "existing",
151 # "format": "qcow2" } },
152 # { "type": "blockdev-snapshot-sync", "data" : { "device": "ide-hd1",
153 # "snapshot-file": "/some/place/my-image2",
154 # "mode": "existing",
155 # "format": "qcow2" } },
156 # { "type": "blockdev-snapshot-internal-sync", "data" : {
157 # "device": "ide-hd2",
158 # "name": "snapshot0" } } ] } }
159 # <- { "return": {} }
162 { 'command': 'transaction',
163 'data': { 'actions': [ 'TransactionAction' ],
164 '*properties': 'TransactionProperties'