summaryrefslogtreecommitdiff
path: root/nova/tests/functional/test_servers.py
diff options
context:
space:
mode:
authorLee Yarwood <lyarwood@redhat.com>2021-03-31 11:00:57 +0100
committerLee Yarwood <lyarwood@redhat.com>2021-04-01 19:28:34 +0100
commitbf89a23d91f01a29ba9b19bd0accf8de8c05f2f7 (patch)
tree4dd70334ba5426becea8f7440c999d2b6d22cced /nova/tests/functional/test_servers.py
parentdb333070b61caef62ea5b68e5bf75f92d879db74 (diff)
downloadnova-bf89a23d91f01a29ba9b19bd0accf8de8c05f2f7.tar.gz
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
Diffstat (limited to 'nova/tests/functional/test_servers.py')
-rw-r--r--nova/tests/functional/test_servers.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/nova/tests/functional/test_servers.py b/nova/tests/functional/test_servers.py
index b3b155ff34..e189d86a71 100644
--- a/nova/tests/functional/test_servers.py
+++ b/nova/tests/functional/test_servers.py
@@ -7181,9 +7181,9 @@ class ServerMoveWithPortResourceRequestTest(
self._assert_pci_request_pf_device_name(server, 'host2-ens2')
# recover source compute
+ self.compute1 = self.restart_compute_service(self.compute1)
self.admin_api.put_service(
self.compute1_service_id, {'forced_down': 'false'})
- self.compute1 = self.restart_compute_service(self.compute1)
# check that source allocation is cleaned up and the dest allocation
# and the port bindings are not touched.
@@ -7226,9 +7226,9 @@ class ServerMoveWithPortResourceRequestTest(
qos_normal_port, qos_sriov_port, self.flavor_with_group_policy)
# recover source compute
+ self.compute1 = self.restart_compute_service(self.compute1)
self.admin_api.put_service(
self.compute1_service_id, {'forced_down': 'false'})
- self.compute1 = self.restart_compute_service(self.compute1)
# check again that even after source host recovery the source
# allocation is intact