| 1 | # -*- Mode: Python -*- |
| 2 | # vim: filetype=python |
| 3 | # |
| 4 | |
| 5 | ## |
| 6 | # ************ |
| 7 | # Yank feature |
| 8 | # ************ |
| 9 | ## |
| 10 | |
| 11 | ## |
| 12 | # @YankInstanceType: |
| 13 | # |
| 14 | # An enumeration of yank instance types. See `YankInstance` for more |
| 15 | # information. |
| 16 | # |
| 17 | # Since: 6.0 |
| 18 | ## |
| 19 | { 'enum': 'YankInstanceType', |
| 20 | 'data': [ 'block-node', 'chardev', 'migration' ] } |
| 21 | |
| 22 | ## |
| 23 | # @YankInstanceBlockNode: |
| 24 | # |
| 25 | # Specifies which block graph node to yank. See `YankInstance` for |
| 26 | # more information. |
| 27 | # |
| 28 | # @node-name: the name of the block graph node |
| 29 | # |
| 30 | # Since: 6.0 |
| 31 | ## |
| 32 | { 'struct': 'YankInstanceBlockNode', |
| 33 | 'data': { 'node-name': 'str' } } |
| 34 | |
| 35 | ## |
| 36 | # @YankInstanceChardev: |
| 37 | # |
| 38 | # Specifies which character device to yank. See `YankInstance` for |
| 39 | # more information. |
| 40 | # |
| 41 | # @id: the chardev's ID |
| 42 | # |
| 43 | # Since: 6.0 |
| 44 | ## |
| 45 | { 'struct': 'YankInstanceChardev', |
| 46 | 'data': { 'id': 'str' } } |
| 47 | |
| 48 | ## |
| 49 | # @YankInstance: |
| 50 | # |
| 51 | # A yank instance can be yanked with the `yank` qmp command to recover |
| 52 | # from a hanging QEMU. |
| 53 | # |
| 54 | # @type: yank instance type |
| 55 | # |
| 56 | # Currently implemented yank instances: |
| 57 | # |
| 58 | # - nbd block device: Yanking it will shut down the connection to the |
| 59 | # nbd server without attempting to reconnect. |
| 60 | # - socket chardev: Yanking it will shut down the connected socket. |
| 61 | # - migration: Yanking it will shut down all migration connections. |
| 62 | # Unlike `migrate_cancel`, it will not notify the migration process, |
| 63 | # so migration will go into @failed state, instead of @cancelled |
| 64 | # state. `yank` should be used to recover from hangs. |
| 65 | # |
| 66 | # Since: 6.0 |
| 67 | ## |
| 68 | { 'union': 'YankInstance', |
| 69 | 'base': { 'type': 'YankInstanceType' }, |
| 70 | 'discriminator': 'type', |
| 71 | 'data': { |
| 72 | 'block-node': 'YankInstanceBlockNode', |
| 73 | 'chardev': 'YankInstanceChardev' } } |
| 74 | |
| 75 | ## |
| 76 | # @yank: |
| 77 | # |
| 78 | # Try to recover from hanging QEMU by yanking the specified instances. |
| 79 | # See `YankInstance` for more information. |
| 80 | # |
| 81 | # @instances: the instances to be yanked |
| 82 | # |
| 83 | # Errors: |
| 84 | # - If any of the YankInstances doesn't exist, DeviceNotFound |
| 85 | # |
| 86 | # .. qmp-example:: |
| 87 | # |
| 88 | # -> { "execute": "yank", |
| 89 | # "arguments": { |
| 90 | # "instances": [ |
| 91 | # { "type": "block-node", |
| 92 | # "node-name": "nbd0" } |
| 93 | # ] } } |
| 94 | # <- { "return": {} } |
| 95 | # |
| 96 | # Since: 6.0 |
| 97 | ## |
| 98 | { 'command': 'yank', |
| 99 | 'data': { 'instances': ['YankInstance'] }, |
| 100 | 'allow-oob': true } |
| 101 | |
| 102 | ## |
| 103 | # @query-yank: |
| 104 | # |
| 105 | # Query yank instances. See `YankInstance` for more information. |
| 106 | # |
| 107 | # TODO: This line is a hack to separate the example from the body |
| 108 | # |
| 109 | # .. qmp-example:: |
| 110 | # |
| 111 | # -> { "execute": "query-yank" } |
| 112 | # <- { "return": [ |
| 113 | # { "type": "block-node", |
| 114 | # "node-name": "nbd0" } |
| 115 | # ] } |
| 116 | # |
| 117 | # Since: 6.0 |
| 118 | ## |
| 119 | { 'command': 'query-yank', |
| 120 | 'returns': ['YankInstance'], |
| 121 | 'allow-oob': true } |