Updated Image Not Created Error Thrown
When image creation fails in this instance, we get a
delete image error. The error is occuring where the image isn't even
created in the first place. This patch makes it so the error will be
that the image is never created, instead of failure of deletion.
It will make the stacktrace easier to understand in the case that
someone runs into this error in the future.
Change-Id: I2f38685d36855fe23dea6624a9c9aef04a5158f9
diff --git a/tempest/api/volume/test_volumes_actions.py b/tempest/api/volume/test_volumes_actions.py
index 9c67579..faae05d 100644
--- a/tempest/api/volume/test_volumes_actions.py
+++ b/tempest/api/volume/test_volumes_actions.py
@@ -17,6 +17,7 @@
from tempest.common.utils import data_utils
from tempest.common import waiters
from tempest import config
+from tempest.lib import exceptions
from tempest import test
import testtools
@@ -122,11 +123,19 @@
self.volume['id'], image_name=image_name,
disk_format=CONF.volume.disk_format)['os-volume_upload_image']
image_id = body["image_id"]
- self.addCleanup(self.image_client.delete_image, image_id)
+ self.addCleanup(self._cleanup_image, image_id)
self.image_client.wait_for_image_status(image_id, 'active')
waiters.wait_for_volume_status(self.client,
self.volume['id'], 'available')
+ def _cleanup_image(self, image_id):
+ # Ignores the image deletion
+ # in the case that image wasn't created in the first place
+ try:
+ self.image_client.delete_image(image_id)
+ except exceptions.NotFound:
+ pass
+
@test.idempotent_id('92c4ef64-51b2-40c0-9f7e-4749fbaaba33')
def test_reserve_unreserve_volume(self):
# Mark volume as reserved.