From 195f1d492ac7e0f6a700f27958dd5c77e6c3eb29 Mon Sep 17 00:00:00 2001 From: Attila Fazekas Date: Thu, 24 Oct 2013 10:33:16 +0200 Subject: [PATCH] Early die if on image gets killed The Images reaches the 'killed' status only on an unrecoverable error, any further wait is in vain. The wait method will raise an exception on the killed state. Change-Id: I392674c872d7f2354a2a2d338e14630b211cf12b --- tempest/exceptions.py | 4 ++++ tempest/services/image/v1/json/image_client.py | 5 ++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/tempest/exceptions.py b/tempest/exceptions.py index 8d05fd84fd..67406b0296 100644 --- a/tempest/exceptions.py +++ b/tempest/exceptions.py @@ -81,6 +81,10 @@ class BuildErrorException(TempestException): message = "Server %(server_id)s failed to build and is in ERROR status" +class ImageKilledException(TempestException): + message = "Image %(image_id)s 'killed' while waiting for %(status)s" + + class AddImageException(TempestException): message = "Image %(image_id)s failed to become ACTIVE in the allotted time" diff --git a/tempest/services/image/v1/json/image_client.py b/tempest/services/image/v1/json/image_client.py index 1921d78715..41b9e81157 100644 --- a/tempest/services/image/v1/json/image_client.py +++ b/tempest/services/image/v1/json/image_client.py @@ -265,9 +265,12 @@ class ImageClientJSON(RestClient): LOG.info('Value transition from "%s" to "%s"' 'in %d second(s).', old_value, value, dtime) - if (value == status): + if value == status: return value + if value == 'killed': + raise exceptions.ImageKilledException(image_id=image_id, + status=value) if dtime > self.build_timeout: message = ('Time Limit Exceeded! (%ds)' 'while waiting for %s, '