summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJustin SB <justin@fathomdb.com>2011-04-09 11:57:14 -0700
committerJustin SB <justin@fathomdb.com>2011-04-09 11:57:14 -0700
commita572b49e376cd6da4265c2807eaed8f0a2daf954 (patch)
treefb81cdf644082e6e1666cdae1cfcafe35a3e5b85
parent1617d27020e45ab587ef75a8e74d76dfe82df861 (diff)
Remove the XML definition when we destroy a machine
-rw-r--r--nova/virt/libvirt_conn.py12
1 files changed, 10 insertions, 2 deletions
diff --git a/nova/virt/libvirt_conn.py b/nova/virt/libvirt_conn.py
index b949e6c92..1ad6f8b32 100644
--- a/nova/virt/libvirt_conn.py
+++ b/nova/virt/libvirt_conn.py
@@ -309,10 +309,18 @@ class LibvirtConnection(driver.ComputeDriver):
return infos
def destroy(self, instance, cleanup=True):
+ name = instance['name']
try:
- virt_dom = self._conn.lookupByName(instance['name'])
+ virt_dom = self._conn.lookupByName(name)
virt_dom.destroy()
- except Exception as _err:
+ # NOTE(justinsb): We remove the domain definition. We probably
+ # would do better to keep it if cleanup=False (e.g. volumes?)
+ # (e.g. #2 - not losing machines on failure)
+ virt_dom.undefine()
+ except Exception as e:
+ # TODO(justinsb): We really should check the error is 'not found'
+ LOG.warn(_("Ignoring error destroying domain %(name)s: %(e)s") %
+ locals())
pass
# If the instance is already terminated, we're still happy