From 321780625993aa685c629995ecccc8bbb64ae4e7 Mon Sep 17 00:00:00 2001 From: Matt Odden Date: Fri, 9 Nov 2012 00:06:58 +0000 Subject: powervm: failed spawn should raise exception fixes bug #1065295 On a failed spawn instance, we should run our cleanup on the host and then re-raise the exception to inform ComputeManager of a failure Change-Id: Ia9ce8360117e94d10d53278d4c9a16931dea70f2 --- nova/virt/powervm/operator.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'nova/virt') diff --git a/nova/virt/powervm/operator.py b/nova/virt/powervm/operator.py index 09ad662b3..6ed7535a7 100644 --- a/nova/virt/powervm/operator.py +++ b/nova/virt/powervm/operator.py @@ -26,7 +26,9 @@ from nova import flags from nova import utils from nova.compute import power_state +from nova.openstack.common import excutils from nova.openstack.common import log as logging + from nova.virt import images from nova.virt.powervm import command from nova.virt.powervm import common @@ -264,7 +266,13 @@ class PowerVMOperator(object): time.sleep(1) except exception.PowerVMImageCreationFailed: - self._cleanup(instance['name']) + with excutils.save_and_reraise_exception(): + # log errors in cleanup + try: + self._cleanup(instance['name']) + except Exception: + LOG.exception(_('Error while attempting to ' + 'clean up failed instance launch.')) def destroy(self, instance_name): """Destroy (shutdown and delete) the specified instance. -- cgit