From 07d54c27a32e66884495b00ec7c19d679cdb823f Mon Sep 17 00:00:00 2001 From: Johannes Erdfelt Date: Thu, 19 Apr 2012 15:06:27 +0000 Subject: Be more tolerant of deleting failed builds Fixes bug 985705 If an instance fails to build, the xen server may not have an instance. This can cause _get_opaque_vm_ref to unnecessarily raise an exception and add an instance fault that is misleading. Change-Id: I068d0af284a5671f429b2d8b13a25b629ede59bd --- nova/virt/xenapi/vmops.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'nova') diff --git a/nova/virt/xenapi/vmops.py b/nova/virt/xenapi/vmops.py index 84da93e73..6883e9c8c 100644 --- a/nova/virt/xenapi/vmops.py +++ b/nova/virt/xenapi/vmops.py @@ -1109,7 +1109,10 @@ class VMOps(object): """ LOG.info(_("Destroying VM"), instance=instance) - vm_ref = self._get_vm_opaque_ref(instance) + # We don't use _get_vm_opaque_ref because the instance may + # truly not exist because of a failure during build. A valid + # vm_ref is checked correctly where necessary. + vm_ref = VMHelper.lookup(self._session, instance['name']) rescue_vm_ref = VMHelper.lookup(self._session, "%s-rescue" % instance.name) -- cgit