From: Jay S. Bryant Date: Mon, 12 Aug 2013 16:46:06 +0000 (-0500) Subject: Fix handling ImageUnacceptable in create_volume X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=9404eb1591cd5133d8ed9d1675f809b221ff2cde;p=openstack-build%2Fcinder-build.git Fix handling ImageUnacceptable in create_volume In the create_volume flow ImageUnacceptable exceptions are not properly handled. _copy_image_to_volume can receive an ImageUnacceptable exception from copy_image_to_volume if fetch_to_raw is used. Currently the ImageUnacceptable exception is changed to a generic ImageCopyFailure exception which does not make the cause of the excpetion clear. This change adds handling and raising ImageUnacceptable exceptions in _copy_image_to_volume. It also adds the exception to no_reschedule_types as it doesn't make sense to keep retrying the copy if the image was found to be unacceptable. fixes bug 1209021 Change-Id: I9aacf23dfaaa1a4df0a869d1c9544c376488f01b --- diff --git a/cinder/volume/flows/create_volume.py b/cinder/volume/flows/create_volume.py index 702254553..af981f541 100644 --- a/cinder/volume/flows/create_volume.py +++ b/cinder/volume/flows/create_volume.py @@ -797,6 +797,7 @@ class OnFailureRescheduleTask(CinderTask): exception.VolumeNotFound, exception.SnapshotNotFound, exception.VolumeTypeNotFound, + exception.ImageUnacceptable, ] def _is_reschedulable(self, cause): @@ -1248,6 +1249,11 @@ class CreateVolumeFromSpecTask(CinderTask): {'volume_id': volume_id, 'error': ex.stderr, 'image_id': image_id}) raise exception.ImageCopyFailure(reason=ex.stderr) + except exception.ImageUnacceptable as ex: + LOG.error(_("Failed to copy image to volume: %(volume_id)s, " + "error: %(error)s") % {'volume_id': volume_id, + 'error': ex}) + raise exception.ImageUnacceptable(ex) except exception.CinderException as ex: LOG.error(_("Failed to copy image %(image_id)s to " "volume: %(volume_id)s, error: %(error)s") %