diff --git a/releasenotes/notes/raise-exception-when-error-deleting-on-volume-18d0d0c5886212dd.yaml b/releasenotes/notes/raise-exception-when-error-deleting-on-volume-18d0d0c5886212dd.yaml new file mode 100644 index 0000000000..194dbc1733 --- /dev/null +++ b/releasenotes/notes/raise-exception-when-error-deleting-on-volume-18d0d0c5886212dd.yaml @@ -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. diff --git a/tempest/lib/services/volume/v2/volumes_client.py b/tempest/lib/services/volume/v2/volumes_client.py index 8b5c96f5ef..3e3ba35af3 100644 --- a/tempest/lib/services/volume/v2/volumes_client.py +++ b/tempest/lib/services/volume/v2/volumes_client.py @@ -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