summaryrefslogtreecommitdiff
path: root/api-ref/source/servers-admin-action.inc
blob: 03a40d38ce57d0df29c170d975a97315736d69c1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
.. -*- rst -*-

==========================================================
 Servers - run an administrative action (servers, action)
==========================================================

Enables administrators to perform an action on a server. Specify the
action in the request body.

You can inject network information into, migrate, live-migrate,
reset networking on, reset the state of a server,
and evacuate a server from a failed host to a new host.


Inject Network Information (injectNetworkInfo Action)
=====================================================

.. rest_method:: POST /servers/{server_id}/action

Injects network information into a server.

Specify the ``injectNetworkInfo`` action in the request body.

Policy defaults enable only users with the administrative role to
perform this operation. Cloud providers can change these permissions
through the ``policy.json`` file.

.. warning:: There is very limited support on this API, For more information,
             see `nova virt support matrix
             <https://docs.openstack.org/nova/latest/user/support-matrix.html>`__

Normal response codes: 202

Error response codes: unauthorized(401), forbidden(403), itemNotFound(404), conflict(409)

Request
-------

.. rest_parameters:: parameters.yaml

  - server_id: server_id_path
  - injectNetworkInfo: injectNetworkInfo

**Example Inject Network Information (injectNetworkInfo Action)**

.. literalinclude:: ../../doc/api_samples/os-admin-actions/admin-actions-inject-network-info.json
   :language: javascript

Response
--------

If successful, this method does not return content in the response body.


Migrate Server (migrate Action)
===============================

.. rest_method:: POST /servers/{server_id}/action

Migrates a server to a host.

Specify the ``migrate`` action in the request body.

Up to microversion 2.55, the scheduler chooses the host.
Starting from microversion 2.56, the ``host`` parameter is available
to specify the destination host. If you specify ``null`` or don't specify
this parameter, the scheduler chooses a host.

**Asynchronous Postconditions**

A successfully migrated server shows a ``VERIFY_RESIZE`` status and ``finished``
migration status. If the cloud has configured the `resize_confirm_window`_
option of the Compute service to a positive value, the Compute service
automatically confirms the migrate operation after the configured interval.

.. _resize_confirm_window: https://docs.openstack.org/nova/latest/configuration/config.html#DEFAULT.resize_confirm_window

Policy defaults enable only users with the administrative role to
perform this operation. Cloud providers can change these permissions
through the ``policy.json`` file.

Normal response codes: 202

Error response codes: badRequest(400), unauthorized(401), forbidden(403)
itemNotFound(404), conflict(409)

Request
-------

.. rest_parameters:: parameters.yaml

  - server_id: server_id_path
  - migrate: migrate
  - host: host_migration_2_56

**Example Migrate Server (migrate Action) (v2.1)**

.. literalinclude:: ../../doc/api_samples/os-migrate-server/migrate-server.json
   :language: javascript

**Example Migrate Server (migrate Action) (v2.56)**

.. literalinclude:: ../../doc/api_samples/os-migrate-server/v2.56/migrate-server.json
   :language: javascript

Response
--------

If successful, this method does not return content in the response body.


Live-Migrate Server (os-migrateLive Action)
===========================================

.. rest_method:: POST /servers/{server_id}/action

Live-migrates a server to a new host without rebooting.

Specify the ``os-migrateLive`` action in the request body.

Use the ``host`` parameter to specify the destination host. If
this param is ``null``, the scheduler chooses a host. If a scheduled host
is not suitable to do migration, the scheduler tries up to
``migrate_max_retries`` rescheduling attempts.

Starting from API version 2.25, the ``block_migration`` parameter could be
to ``auto`` so that nova can decide value of block_migration during live
migration.

Policy defaults enable only users with the administrative role to
perform this operation. Cloud providers can change these permissions
through the ``policy.json`` file.

Starting from REST API version 2.34 pre-live-migration checks are done
asynchronously, results of these checks are available in ``instance-actions``.
Nova responds immediately, and no pre-live-migration checks are returned.
The instance will not immediately change state to ``ERROR``, if a failure of
the live-migration checks occurs.

Starting from API version 2.68, the ``force`` parameter is no longer accepted
as this could not be meaningfully supported by servers with complex resource
allocations.

Normal response codes: 202

Error response codes: badRequest(400), unauthorized(401), forbidden(403)
itemNotFound(404), conflict(409)

Request
-------

.. rest_parameters:: parameters.yaml

  - server_id: server_id_path
  - os-migrateLive: os-migrateLive
  - host: host_migration
  - block_migration: block_migration
  - block_migration: block_migration_2_25
  - disk_over_commit: disk_over_commit
  - force: force_live_migrate

**Example Live-Migrate Server (os-migrateLive Action)**

.. literalinclude:: ../../doc/api_samples/os-migrate-server/v2.30/live-migrate-server.json
   :language: javascript

Response
--------

If successful, this method does not return content in the response body.


Reset Networking On A Server (resetNetwork Action) (DEPRECATED)
===============================================================

.. rest_method:: POST /servers/{server_id}/action

Resets networking on a server.

.. warning::

   This action was only supported by the XenAPI virt driver, which was
   deprecated in the 20.0.0 (Train) release and removed in the 22.0.0
   (Victoria) release.  This action should be avoided in new applications. It
   was removed in the 23.0.0 (Wallaby) release.

Specify the ``resetNetwork`` action in the request body.

Policy defaults enable only users with the administrative role to
perform this operation. Cloud providers can change these permissions
through the ``policy.json`` file.

Normal response codes: 202

Error response codes: unauthorized(401), forbidden(403), itemNotFound(404),
conflict(409), gone(410)

Request
-------

.. rest_parameters:: parameters.yaml

  - server_id: server_id_path
  - resetNetwork: resetNetwork

**Example Reset Networking On A Server (resetNetwork Action)**

.. literalinclude:: ../../doc/api_samples/os-admin-actions/admin-actions-reset-network.json
   :language: javascript

Response
--------

If successful, this method does not return content in the response body.

.. _os-resetState:

Reset Server State (os-resetState Action)
=========================================

.. rest_method:: POST /servers/{server_id}/action

Resets the state of a server.

Specify the ``os-resetState`` action and the ``state`` in the request body.

Policy defaults enable only users with the administrative role to
perform this operation. Cloud providers can change these permissions
through the ``policy.json`` file.

Normal response codes: 202

Error response codes: unauthorized(401), forbidden(403), itemNotFound(404)

Request
-------

.. rest_parameters:: parameters.yaml

  - server_id: server_id_path
  - os-resetState: os-resetState
  - os-resetState.state: os-resetState_state

**Example Reset Server State (os-resetState Action)**

.. literalinclude:: ../../doc/api_samples/os-admin-actions/admin-actions-reset-server-state.json
   :language: javascript

Response
--------

If successful, this method does not return content in the response body.