Skip to content

Instantly share code, notes, and snippets.

@vishvananda
Created September 23, 2012 05:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vishvananda/3769012 to your computer and use it in GitHub Desktop.
Save vishvananda/3769012 to your computer and use it in GitHub Desktop.
diff --git a/nova/compute/api.py b/nova/compute/api.py
index 42e9e50..0b2d2d5 100644
--- a/nova/compute/api.py
+++ b/nova/compute/api.py
@@ -1284,8 +1284,7 @@ class API(base.Base):
m[attr] = val
volume_id = m.get('volume_id')
- snapshot_id = m.get('snapshot_id')
- if snapshot_id and volume_id:
+ if volume_id:
# create snapshot based on volume_id
volume = self.volume_api.get(context, volume_id)
# NOTE(yamahata): Should we wait for snapshot creation?
diff --git a/nova/compute/manager.py b/nova/compute/manager.py
index 8ef6733..88a81b4 100644
--- a/nova/compute/manager.py
+++ b/nova/compute/manager.py
@@ -877,8 +877,12 @@ class ComputeManager(manager.SchedulerDependentManager):
LOG.debug(_("terminating bdm %s") % bdm,
instance_uuid=instance_uuid)
if bdm['volume_id'] and bdm['delete_on_termination']:
- volume = self.volume_api.get(context, bdm['volume_id'])
- self.volume_api.delete(context, volume)
+ try:
+ volume = self.volume_api.get(context, bdm['volume_id'])
+ self.volume_api.delete(context, volume)
+ except Exception as exc:
+ LOG.warn(_("Ignoring volume delete failure due to %s")
+ % exc, instance_uuid=instance_uuid)
# NOTE(vish): bdms will be deleted on instance destroy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment