From 9404eb1591cd5133d8ed9d1675f809b221ff2cde Mon Sep 17 00:00:00 2001 From: "Jay S. Bryant" Date: Mon, 12 Aug 2013 11:46:06 -0500 Subject: [PATCH] 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 --- cinder/volume/flows/create_volume.py | 6 ++++++ 1 file changed, 6 insertions(+) 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") % -- 2.45.2