Pass more accurate error message to DeleteErrorException

Now we can get error messages like "Resource 595f6527-d84c-
4e14-a86f-c7be186a864c failed to delete and is in ERROR status",
and this has two problems:
1. It doesn't indicate which kind of resource, e.g., volume or server
2. For DeleteErrorException raised in volumes_client, the volume
   status is error_deleting, not ERROR.
So this is to pass full and accurate message to DeleteErrorException
to avoid the confusion.

Change-Id: I8cfd9f84b888b3380b6109e967b09f7fa74e4051
This commit is contained in:
zhufl 2019-06-13 11:44:24 +08:00
parent 77febec784
commit 0ded98ff65
2 changed files with 6 additions and 2 deletions

4
tempest/common/waiters.py Executable file → Normal file
View File

@ -121,7 +121,9 @@ def wait_for_server_termination(client, server_id, ignore_error=False):
'/'.join((server_status, str(task_state))),
time.time() - start_time)
if server_status == 'ERROR' and not ignore_error:
raise lib_exc.DeleteErrorException(resource_id=server_id)
raise lib_exc.DeleteErrorException(
"Server %s failed to delete and is in ERROR status" %
server_id)
if int(time.time()) - start_time >= client.build_timeout:
raise lib_exc.TimeoutException

View File

@ -212,7 +212,9 @@ class VolumesClient(base_client.BaseClient):
except lib_exc.NotFound:
return True
if volume["volume"]["status"] == "error_deleting":
raise lib_exc.DeleteErrorException(resource_id=id)
raise lib_exc.DeleteErrorException(
"Volume %s failed to delete and is in error_deleting status" %
volume['id'])
return False
@property