From: Adalberto Medeiros Date: Tue, 13 Aug 2013 18:50:24 +0000 (-0400) Subject: Fix volume_glance_metadata deletion X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=8b35b1d714444a385a200e3e006ce3af84dae3c9;p=openstack-build%2Fcinder-build.git Fix volume_glance_metadata deletion If volume_glance_metadata does not exist for a certain volume, it returns an exception and does not delete volume from db. Avoid deleting it if it does not exist. Bug: 1209367 Change-Id: Ia607ec5ecfc115c1a593f14236ee93158938a8da --- diff --git a/cinder/volume/manager.py b/cinder/volume/manager.py index 1784837cf..3dfe561ca 100644 --- a/cinder/volume/manager.py +++ b/cinder/volume/manager.py @@ -258,7 +258,15 @@ class VolumeManager(manager.SchedulerDependentManager): reservations = None LOG.exception(_("Failed to update usages deleting volume")) - self.db.volume_glance_metadata_delete_by_volume(context, volume_id) + # Delete glance metadata if it exists + try: + self.db.volume_glance_metadata_delete_by_volume(context, volume_id) + LOG.debug(_("volume %s: glance metadata deleted"), + volume_ref['id']) + except exception.GlanceMetadataNotFound: + LOG.debug(_("no glance metadata found for volume %s"), + volume_ref['id']) + self.db.volume_destroy(context, volume_id) LOG.info(_("volume %s: deleted successfully"), volume_ref['id']) self._notify_about_volume_usage(context, volume_ref, "delete.end")