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-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
60 { 'union': 'TransactionAction',
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'
76 # @TransactionProperties:
78 # Optional arguments to modify the behavior of a Transaction.
80 # @completion-mode: Controls how jobs launched asynchronously by
81 # Actions will complete or fail as a group.
82 # See @ActionCompletionMode for details.
86 { 'struct': 'TransactionProperties',
88 '*completion-mode': 'ActionCompletionMode'
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.
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
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.
110 # On failure, the original disks pre-snapshot attempt will be used.
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,
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.
121 # @actions: List of @TransactionAction;
122 # information needed for the respective operations.
124 # @properties: structure of additional options to control the
125 # execution of the transaction. See @TransactionProperties
126 # for additional detail.
128 # Returns: nothing on success
130 # Errors depend on the operations of the transaction
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.
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": {} }
160 { 'command': 'transaction',
161 'data': { 'actions': [ 'TransactionAction' ],
162 '*properties': 'TransactionProperties'