]>
Commit | Line | Data |
---|---|---|
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 | # - @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 | |
56 | # | |
57 | # Since: 1.1 | |
58 | ## | |
59 | { 'union': 'TransactionAction', | |
60 | 'data': { | |
61 | 'abort': 'Abort', | |
62 | 'block-dirty-bitmap-add': 'BlockDirtyBitmapAdd', | |
63 | 'block-dirty-bitmap-clear': 'BlockDirtyBitmap', | |
64 | 'x-block-dirty-bitmap-enable': 'BlockDirtyBitmap', | |
65 | 'x-block-dirty-bitmap-disable': 'BlockDirtyBitmap', | |
66 | 'blockdev-backup': 'BlockdevBackup', | |
67 | 'blockdev-snapshot': 'BlockdevSnapshot', | |
68 | 'blockdev-snapshot-internal-sync': 'BlockdevSnapshotInternal', | |
69 | 'blockdev-snapshot-sync': 'BlockdevSnapshotSync', | |
70 | 'drive-backup': 'DriveBackup' | |
71 | } } | |
72 | ||
73 | ## | |
74 | # @TransactionProperties: | |
75 | # | |
76 | # Optional arguments to modify the behavior of a Transaction. | |
77 | # | |
78 | # @completion-mode: Controls how jobs launched asynchronously by | |
79 | # Actions will complete or fail as a group. | |
80 | # See @ActionCompletionMode for details. | |
81 | # | |
82 | # Since: 2.5 | |
83 | ## | |
84 | { 'struct': 'TransactionProperties', | |
85 | 'data': { | |
86 | '*completion-mode': 'ActionCompletionMode' | |
87 | } | |
88 | } | |
89 | ||
90 | ## | |
91 | # @transaction: | |
92 | # | |
93 | # Executes a number of transactionable QMP commands atomically. If any | |
94 | # operation fails, then the entire set of actions will be abandoned and the | |
95 | # appropriate error returned. | |
96 | # | |
97 | # For external snapshots, the dictionary contains the device, the file to use for | |
98 | # the new snapshot, and the format. The default format, if not specified, is | |
99 | # qcow2. | |
100 | # | |
101 | # Each new snapshot defaults to being created by QEMU (wiping any | |
102 | # contents if the file already exists), but it is also possible to reuse | |
103 | # an externally-created file. In the latter case, you should ensure that | |
104 | # the new image file has the same contents as the current one; QEMU cannot | |
105 | # perform any meaningful check. Typically this is achieved by using the | |
106 | # current image file as the backing file for the new image. | |
107 | # | |
108 | # On failure, the original disks pre-snapshot attempt will be used. | |
109 | # | |
110 | # For internal snapshots, the dictionary contains the device and the snapshot's | |
111 | # name. If an internal snapshot matching name already exists, the request will | |
112 | # be rejected. Only some image formats support it, for example, qcow2, rbd, | |
113 | # and sheepdog. | |
114 | # | |
115 | # On failure, qemu will try delete the newly created internal snapshot in the | |
116 | # transaction. When an I/O error occurs during deletion, the user needs to fix | |
117 | # it later with qemu-img or other command. | |
118 | # | |
119 | # @actions: List of @TransactionAction; | |
120 | # information needed for the respective operations. | |
121 | # | |
122 | # @properties: structure of additional options to control the | |
123 | # execution of the transaction. See @TransactionProperties | |
124 | # for additional detail. | |
125 | # | |
126 | # Returns: nothing on success | |
127 | # | |
128 | # Errors depend on the operations of the transaction | |
129 | # | |
130 | # Note: The transaction aborts on the first failure. Therefore, there will be | |
131 | # information on only one failed operation returned in an error condition, and | |
132 | # subsequent actions will not have been attempted. | |
133 | # | |
134 | # Since: 1.1 | |
135 | # | |
136 | # Example: | |
137 | # | |
138 | # -> { "execute": "transaction", | |
139 | # "arguments": { "actions": [ | |
140 | # { "type": "blockdev-snapshot-sync", "data" : { "device": "ide-hd0", | |
141 | # "snapshot-file": "/some/place/my-image", | |
142 | # "format": "qcow2" } }, | |
143 | # { "type": "blockdev-snapshot-sync", "data" : { "node-name": "myfile", | |
144 | # "snapshot-file": "/some/place/my-image2", | |
145 | # "snapshot-node-name": "node3432", | |
146 | # "mode": "existing", | |
147 | # "format": "qcow2" } }, | |
148 | # { "type": "blockdev-snapshot-sync", "data" : { "device": "ide-hd1", | |
149 | # "snapshot-file": "/some/place/my-image2", | |
150 | # "mode": "existing", | |
151 | # "format": "qcow2" } }, | |
152 | # { "type": "blockdev-snapshot-internal-sync", "data" : { | |
153 | # "device": "ide-hd2", | |
154 | # "name": "snapshot0" } } ] } } | |
155 | # <- { "return": {} } | |
156 | # | |
157 | ## | |
158 | { 'command': 'transaction', | |
159 | 'data': { 'actions': [ 'TransactionAction' ], | |
160 | '*properties': 'TransactionProperties' | |
161 | } | |
162 | } |