diff options
Diffstat (limited to 'nova/volume/cinder.py')
-rw-r--r-- | nova/volume/cinder.py | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/nova/volume/cinder.py b/nova/volume/cinder.py index c5de961d28..01efcfec19 100644 --- a/nova/volume/cinder.py +++ b/nova/volume/cinder.py @@ -888,19 +888,23 @@ class API(object): @retrying.retry(stop_max_attempt_number=5, retry_on_exception=lambda e: (isinstance(e, cinder_exception.ClientException) and - e.code == 500)) + e.code in (500, 504))) def attachment_delete(self, context, attachment_id): try: cinderclient( context, '3.44', skip_version_check=True).attachments.delete( attachment_id) except cinder_exception.ClientException as ex: - with excutils.save_and_reraise_exception(): - LOG.error('Delete attachment failed for attachment ' - '%(id)s. Error: %(msg)s Code: %(code)s', - {'id': attachment_id, - 'msg': str(ex), - 'code': getattr(ex, 'code', None)}) + if ex.code == 404: + LOG.warning('Attachment %(id)s does not exist. Ignoring.', + {'id': attachment_id}) + else: + with excutils.save_and_reraise_exception(): + LOG.error('Delete attachment failed for attachment ' + '%(id)s. Error: %(msg)s Code: %(code)s', + {'id': attachment_id, + 'msg': str(ex), + 'code': getattr(ex, 'code', None)}) @translate_attachment_exception def attachment_complete(self, context, attachment_id): @@ -924,3 +928,9 @@ class API(object): {'id': attachment_id, 'msg': str(ex), 'code': getattr(ex, 'code', None)}) + + @translate_volume_exception + def reimage_volume(self, context, volume_id, image_id, + reimage_reserved=False): + cinderclient(context, '3.68').volumes.reimage( + volume_id, image_id, reimage_reserved) |