Merge "Fix error that instance could not be found"

This commit is contained in:
Zuul 2020-10-22 03:21:37 +00:00 committed by Gerrit Code Review
commit 3a19818d9e
1 changed files with 7 additions and 1 deletions

View File

@ -124,12 +124,18 @@ def wait_for_server_termination(client, server_id, ignore_error=False):
raise lib_exc.DeleteErrorException(
"Server %s failed to delete and is in ERROR status" %
server_id)
if server_status == 'SOFT_DELETED':
# Soft-deleted instances need to be forcibly deleted to
# prevent some test cases from failing.
LOG.debug("Automatically force-deleting soft-deleted server %s",
server_id)
client.force_delete_server(server_id)
try:
client.force_delete_server(server_id)
except lib_exc.NotFound:
# The instance may have been deleted so ignore
# NotFound exception
return
if int(time.time()) - start_time >= client.build_timeout:
raise lib_exc.TimeoutException