transaction.json 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272
  1. # -*- Mode: Python -*-
  2. # vim: filetype=python
  3. #
  4. ##
  5. # = Transactions
  6. ##
  7. { 'include': 'block-core.json' }
  8. ##
  9. # @Abort:
  10. #
  11. # This action can be used to test transaction failure.
  12. #
  13. # Since: 1.6
  14. ##
  15. { 'struct': 'Abort',
  16. 'data': { } }
  17. ##
  18. # @ActionCompletionMode:
  19. #
  20. # An enumeration of Transactional completion modes.
  21. #
  22. # @individual: Do not attempt to cancel any other Actions if any
  23. # Actions fail after the Transaction request succeeds. All
  24. # Actions that can complete successfully will do so without
  25. # waiting on others. This is the default.
  26. #
  27. # @grouped: If any Action fails after the Transaction succeeds, cancel
  28. # all Actions. Actions do not complete until all Actions are
  29. # ready to complete. May be rejected by Actions that do not
  30. # support this completion mode.
  31. #
  32. # Since: 2.5
  33. ##
  34. { 'enum': 'ActionCompletionMode',
  35. 'data': [ 'individual', 'grouped' ] }
  36. ##
  37. # @TransactionActionKind:
  38. #
  39. # @abort: Since 1.6
  40. #
  41. # @block-dirty-bitmap-add: Since 2.5
  42. #
  43. # @block-dirty-bitmap-remove: Since 4.2
  44. #
  45. # @block-dirty-bitmap-clear: Since 2.5
  46. #
  47. # @block-dirty-bitmap-enable: Since 4.0
  48. #
  49. # @block-dirty-bitmap-disable: Since 4.0
  50. #
  51. # @block-dirty-bitmap-merge: Since 4.0
  52. #
  53. # @blockdev-backup: Since 2.3
  54. #
  55. # @blockdev-snapshot: Since 2.5
  56. #
  57. # @blockdev-snapshot-internal-sync: Since 1.7
  58. #
  59. # @blockdev-snapshot-sync: since 1.1
  60. #
  61. # @drive-backup: Since 1.6
  62. #
  63. # Features:
  64. #
  65. # @deprecated: Member @drive-backup is deprecated. Use member
  66. # @blockdev-backup instead.
  67. #
  68. # Since: 1.1
  69. ##
  70. { 'enum': 'TransactionActionKind',
  71. 'data': [ 'abort', 'block-dirty-bitmap-add', 'block-dirty-bitmap-remove',
  72. 'block-dirty-bitmap-clear', 'block-dirty-bitmap-enable',
  73. 'block-dirty-bitmap-disable', 'block-dirty-bitmap-merge',
  74. 'blockdev-backup', 'blockdev-snapshot',
  75. 'blockdev-snapshot-internal-sync', 'blockdev-snapshot-sync',
  76. { 'name': 'drive-backup', 'features': [ 'deprecated' ] } ] }
  77. ##
  78. # @AbortWrapper:
  79. #
  80. # Since: 1.6
  81. ##
  82. { 'struct': 'AbortWrapper',
  83. 'data': { 'data': 'Abort' } }
  84. ##
  85. # @BlockDirtyBitmapAddWrapper:
  86. #
  87. # Since: 2.5
  88. ##
  89. { 'struct': 'BlockDirtyBitmapAddWrapper',
  90. 'data': { 'data': 'BlockDirtyBitmapAdd' } }
  91. ##
  92. # @BlockDirtyBitmapWrapper:
  93. #
  94. # Since: 2.5
  95. ##
  96. { 'struct': 'BlockDirtyBitmapWrapper',
  97. 'data': { 'data': 'BlockDirtyBitmap' } }
  98. ##
  99. # @BlockDirtyBitmapMergeWrapper:
  100. #
  101. # Since: 4.0
  102. ##
  103. { 'struct': 'BlockDirtyBitmapMergeWrapper',
  104. 'data': { 'data': 'BlockDirtyBitmapMerge' } }
  105. ##
  106. # @BlockdevBackupWrapper:
  107. #
  108. # Since: 2.3
  109. ##
  110. { 'struct': 'BlockdevBackupWrapper',
  111. 'data': { 'data': 'BlockdevBackup' } }
  112. ##
  113. # @BlockdevSnapshotWrapper:
  114. #
  115. # Since: 2.5
  116. ##
  117. { 'struct': 'BlockdevSnapshotWrapper',
  118. 'data': { 'data': 'BlockdevSnapshot' } }
  119. ##
  120. # @BlockdevSnapshotInternalWrapper:
  121. #
  122. # Since: 1.7
  123. ##
  124. { 'struct': 'BlockdevSnapshotInternalWrapper',
  125. 'data': { 'data': 'BlockdevSnapshotInternal' } }
  126. ##
  127. # @BlockdevSnapshotSyncWrapper:
  128. #
  129. # Since: 1.1
  130. ##
  131. { 'struct': 'BlockdevSnapshotSyncWrapper',
  132. 'data': { 'data': 'BlockdevSnapshotSync' } }
  133. ##
  134. # @DriveBackupWrapper:
  135. #
  136. # Since: 1.6
  137. ##
  138. { 'struct': 'DriveBackupWrapper',
  139. 'data': { 'data': 'DriveBackup' } }
  140. ##
  141. # @TransactionAction:
  142. #
  143. # A discriminated record of operations that can be performed with
  144. # @transaction.
  145. #
  146. # @type: the operation to be performed
  147. #
  148. # Since: 1.1
  149. ##
  150. { 'union': 'TransactionAction',
  151. 'base': { 'type': 'TransactionActionKind' },
  152. 'discriminator': 'type',
  153. 'data': {
  154. 'abort': 'AbortWrapper',
  155. 'block-dirty-bitmap-add': 'BlockDirtyBitmapAddWrapper',
  156. 'block-dirty-bitmap-remove': 'BlockDirtyBitmapWrapper',
  157. 'block-dirty-bitmap-clear': 'BlockDirtyBitmapWrapper',
  158. 'block-dirty-bitmap-enable': 'BlockDirtyBitmapWrapper',
  159. 'block-dirty-bitmap-disable': 'BlockDirtyBitmapWrapper',
  160. 'block-dirty-bitmap-merge': 'BlockDirtyBitmapMergeWrapper',
  161. 'blockdev-backup': 'BlockdevBackupWrapper',
  162. 'blockdev-snapshot': 'BlockdevSnapshotWrapper',
  163. 'blockdev-snapshot-internal-sync': 'BlockdevSnapshotInternalWrapper',
  164. 'blockdev-snapshot-sync': 'BlockdevSnapshotSyncWrapper',
  165. 'drive-backup': 'DriveBackupWrapper'
  166. } }
  167. ##
  168. # @TransactionProperties:
  169. #
  170. # Optional arguments to modify the behavior of a Transaction.
  171. #
  172. # @completion-mode: Controls how jobs launched asynchronously by
  173. # Actions will complete or fail as a group. See
  174. # @ActionCompletionMode for details.
  175. #
  176. # Since: 2.5
  177. ##
  178. { 'struct': 'TransactionProperties',
  179. 'data': {
  180. '*completion-mode': 'ActionCompletionMode'
  181. }
  182. }
  183. ##
  184. # @transaction:
  185. #
  186. # Executes a number of transactionable QMP commands atomically. If
  187. # any operation fails, then the entire set of actions will be
  188. # abandoned and the appropriate error returned.
  189. #
  190. # For external snapshots, the dictionary contains the device, the file
  191. # to use for the new snapshot, and the format. The default format, if
  192. # not specified, is qcow2.
  193. #
  194. # Each new snapshot defaults to being created by QEMU (wiping any
  195. # contents if the file already exists), but it is also possible to
  196. # reuse an externally-created file. In the latter case, you should
  197. # ensure that the new image file has the same contents as the current
  198. # one; QEMU cannot perform any meaningful check. Typically this is
  199. # achieved by using the current image file as the backing file for the
  200. # new image.
  201. #
  202. # On failure, the original disks pre-snapshot attempt will be used.
  203. #
  204. # For internal snapshots, the dictionary contains the device and the
  205. # snapshot's name. If an internal snapshot matching name already
  206. # exists, the request will be rejected. Only some image formats
  207. # support it, for example, qcow2, and rbd,
  208. #
  209. # On failure, qemu will try delete the newly created internal snapshot
  210. # in the transaction. When an I/O error occurs during deletion, the
  211. # user needs to fix it later with qemu-img or other command.
  212. #
  213. # @actions: List of @TransactionAction; information needed for the
  214. # respective operations.
  215. #
  216. # @properties: structure of additional options to control the
  217. # execution of the transaction. See @TransactionProperties for
  218. # additional detail.
  219. #
  220. # Errors:
  221. # - Any errors from commands in the transaction
  222. #
  223. # .. note:: The transaction aborts on the first failure. Therefore,
  224. # there will be information on only one failed operation returned
  225. # in an error condition, and subsequent actions will not have been
  226. # attempted.
  227. #
  228. # Since: 1.1
  229. #
  230. # .. qmp-example::
  231. #
  232. # -> { "execute": "transaction",
  233. # "arguments": { "actions": [
  234. # { "type": "blockdev-snapshot-sync", "data" : { "device": "ide-hd0",
  235. # "snapshot-file": "/some/place/my-image",
  236. # "format": "qcow2" } },
  237. # { "type": "blockdev-snapshot-sync", "data" : { "node-name": "myfile",
  238. # "snapshot-file": "/some/place/my-image2",
  239. # "snapshot-node-name": "node3432",
  240. # "mode": "existing",
  241. # "format": "qcow2" } },
  242. # { "type": "blockdev-snapshot-sync", "data" : { "device": "ide-hd1",
  243. # "snapshot-file": "/some/place/my-image2",
  244. # "mode": "existing",
  245. # "format": "qcow2" } },
  246. # { "type": "blockdev-snapshot-internal-sync", "data" : {
  247. # "device": "ide-hd2",
  248. # "name": "snapshot0" } } ] } }
  249. # <- { "return": {} }
  250. ##
  251. { 'command': 'transaction',
  252. 'data': { 'actions': [ 'TransactionAction' ],
  253. '*properties': 'TransactionProperties'
  254. }
  255. }