From 4723fde77b6a3d001586eea2e2528fb44b53fac6 Mon Sep 17 00:00:00 2001 From: Ken'ichi Ohmichi Date: Wed, 26 Apr 2017 14:19:57 -0700 Subject: [PATCH] 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 --- ...when-error-deleting-on-volume-18d0d0c5886212dd.yaml | 8 ++++++++ tempest/lib/services/volume/v2/volumes_client.py | 10 +++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 releasenotes/notes/raise-exception-when-error-deleting-on-volume-18d0d0c5886212dd.yaml 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