From 616098dcd36b20e01d38898b8942003df664e6ac Mon Sep 17 00:00:00 2001 From: Boris Pavlovic Date: Fri, 14 Jun 2013 17:53:53 +0400 Subject: Do not raise NEW exceptions Raising NEW exception is bad practice, because we lose TraceBack. So all places like: except SomeException as e: raise e should be replaced by except SomeException: raise If we are doing some other actions before reraising we should store information about exception then do all actions and then reraise it. This is caused by eventlet bug. It lost information about exception if it switch threads. fixes bug 1191730 Change-Id: Ia375ecef9f16bda65d5146d14ed4b37a988abb0c --- nova/api/openstack/compute/contrib/coverage_ext.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'nova/api') diff --git a/nova/api/openstack/compute/contrib/coverage_ext.py b/nova/api/openstack/compute/contrib/coverage_ext.py index 154699470..578e2e79d 100644 --- a/nova/api/openstack/compute/contrib/coverage_ext.py +++ b/nova/api/openstack/compute/contrib/coverage_ext.py @@ -134,11 +134,12 @@ class CoverageController(object): # doesn't resolve to 127.0.0.1. Currently backdoors only open on # loopback so this is for covering the common single host use case except socket.error as e: + exc_info = sys.exc_info() if 'ECONNREFUSED' in e and service['host'] == self.host: service['telnet'] = telnetlib.Telnet('127.0.0.1', service['port']) else: - raise e + raise exc_info[0], exc_info[1], exc_info[2] self.services.append(service) self._start_coverage_telnet(service['telnet'], service['service']) -- cgit