From 8b35b1d714444a385a200e3e006ce3af84dae3c9 Mon Sep 17 00:00:00 2001 From: Adalberto Medeiros Date: Tue, 13 Aug 2013 14:50:24 -0400 Subject: [PATCH] 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 --- cinder/volume/manager.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) 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") -- 2.45.2