Raise exception when error_deleting

Tempest checks a volume delete by waiting for NotFound(404) on
show_volume(). Sometime a volume delete fails and the volume status
becomes error_deleting which means the delete is failed.
So Tempest doesn't need to wait anymore. This patch makes the check
raise an exception instead of waiting.

Closes-Bug: #1686429

Change-Id: I17a986be2eb05ef9b177d5248de02a3336f7d4bb
This commit is contained in:
Ken'ichi Ohmichi 2017-04-26 14:19:57 -07:00
parent 7db050e405
commit 4723fde77b
2 changed files with 17 additions and 1 deletions

View File

@ -0,0 +1,8 @@
---
upgrade:
- |
Tempest checks a volume delete by waiting for NotFound(404) on
show_volume(). Sometime a volume delete fails and the volume status
becomes error_deleting which means the delete is failed.
So Tempest doesn't need to wait anymore. A new release of Tempest
raises an exception DeleteErrorException instead of waiting.

View File

@ -187,10 +187,18 @@ class VolumesClient(rest_client.RestClient):
return rest_client.ResponseBody(resp, body)
def is_resource_deleted(self, id):
"""Check the specified resource is deleted or not.
:param id: A checked resource id
:raises lib_exc.DeleteErrorException: If the specified resource is on
the status the delete was failed.
"""
try:
self.show_volume(id)
volume = self.show_volume(id)
except lib_exc.NotFound:
return True
if volume["volume"]["status"] == "error_deleting":
raise lib_exc.DeleteErrorException(resource_id=id)
return False
@property