Added an AddImageException to exceptions.py and modified images_client to use this exception rather than BuildErrorException.
Fixes bug 999256.
exceptions.py:
class AddImageException(TempestException):
message = "Image %(image_id) failed to become ACTIVE in the allotted time."
images_client.py:
In wait_for_image_resp_code and wait_for_image_status, changed:
raise exceptions.BuildErrorException
to:
raise exceptions.TimeoutException
In wait_for_image_status, changed:
raise exceptions.BuildErrorExcption
to:
raise exceptions.AddImageException(image_id=image_id)
Replaced TimeoutException with AddImageException and replaced AddImageException with TimeoutException.
Change-Id: Ic78f1d24151361c9886480822087931b61b3603c
diff --git a/tempest/exceptions.py b/tempest/exceptions.py
index 29ddeeb..837dac1 100644
--- a/tempest/exceptions.py
+++ b/tempest/exceptions.py
@@ -47,6 +47,10 @@
message = "Server %(server_id)s failed to build and is in ERROR status"
+class AddImageException(TempestException):
+ message = "Image %(image_id) failed to become ACTIVE in the allotted time"
+
+
class VolumeBuildErrorException(TempestException):
message = "Volume %(volume_id)s failed to build and is in ERROR status"
diff --git a/tempest/services/nova/json/images_client.py b/tempest/services/nova/json/images_client.py
index c9a0370..87cb403 100644
--- a/tempest/services/nova/json/images_client.py
+++ b/tempest/services/nova/json/images_client.py
@@ -81,7 +81,7 @@
resp, body = self.get("images/%s" % str(image_id))
if int(time.time()) - start >= self.build_timeout:
- raise exceptions.BuildErrorException
+ raise exceptions.TimeoutException
def wait_for_image_status(self, image_id, status):
"""Waits for an image to reach a given status."""
@@ -93,10 +93,10 @@
resp, image = self.get_image(image_id)
if image['status'] == 'ERROR':
- raise exceptions.TimeoutException
+ raise exceptions.AddImageException(image_id=image_id)
if int(time.time()) - start >= self.build_timeout:
- raise exceptions.BuildErrorException
+ raise exceptions.TimeoutException
def list_image_metadata(self, image_id):
"""Lists all metadata items for an image"""