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
This commit is contained in:
Attila Fazekas
2013-10-24 10:33:16 +02:00
parent ffe8afe6ee
commit 195f1d492a
2 changed files with 8 additions and 1 deletions

View File

@ -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"

View File

@ -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, '