nova/nova/api
Lee Yarwood bf89a23d91 api: Reject requests to force up computes when `done` evacuation records exist
When evacuating an instance the evacuation migration record moves from a
state of `accepted` to `pre-migrating` and eventually `done` once the
instance has been rebuilt on the new compute host. At present the
migration record remains in this state until the original compute host
is restarted and the service cleans up any leftovers of the instance
before it is moved to a state of `completed`.

Bug #1922053 details a use case where an operator might unintentionally
forget to ensure the compute service is restarted before forcing the
service up leaving evacuation migration records stuck as `done`.

This could become an issue in the future if the instance is moved back
to this compute before the service is restarted. Any future restart
invoking the cleanup logic and potentially damaging the running
instance.

This change aims to address this by blocking requests to force up
computes associated to `done` evacuation records. Forcing operators to
restart the service allowing them to move to a `completed` state before
the service can be forced up again.

To allow this to be backportable these requests are rejected with a 400
BadRequest return code from the API. A TODO is left to move this to a
409 Conflict during the Xena release under a new microversion.

Finally, some additional functional tests have been updated to ensure
they restart the source compute service of an evacuation before
attempting to force up the service, ensuring any migration records are
marked as completed.

Closes-Bug: #1922053
Change-Id: I95882ea28564a31a6b4f8b665de462774d84edfc
2021-04-01 19:28:34 +01:00
..
metadata Remove six.text_type (1/2) 2020-12-13 11:25:31 +00:00
openstack api: Reject requests to force up computes when `done` evacuation records exist 2021-04-01 19:28:34 +01:00
validation libvirt: Wire up 'os_secure_boot' property 2021-03-09 15:56:18 +00:00
__init__.py
auth.py Stop using NoAuthMiddleware in tests 2019-10-14 11:43:52 -05:00
compute_req_id.py Migrate to oslo request_id middleware - mv 2.46 2017-05-27 10:11:44 +00:00
wsgi.py trivial: Remove remaining '_LE' instances 2020-05-18 16:52:20 +01:00