diff options
| author | Justin Santa Barbara <justin@fathomdb.com> | 2011-02-15 18:19:52 +0000 |
|---|---|---|
| committer | Tarmac <> | 2011-02-15 18:19:52 +0000 |
| commit | d66553956ee72dba4490a7d1ad7085e4d9a43391 (patch) | |
| tree | 1fa55e1d2dd7007a86ecf479a8eb7809a49f181d /nova | |
| parent | 7e80b2086481a68123454d910ed99cb419f6a1f4 (diff) | |
| parent | 645f4733081dfe03554cc30221ccc1a8b359d1ea (diff) | |
| download | nova-d66553956ee72dba4490a7d1ad7085e4d9a43391.tar.gz nova-d66553956ee72dba4490a7d1ad7085e4d9a43391.tar.xz nova-d66553956ee72dba4490a7d1ad7085e4d9a43391.zip | |
When re-throwing an exception, use "raise", not "raise e". This way we don't lose the stack trace.
Diffstat (limited to 'nova')
| -rw-r--r-- | nova/compute/api.py | 8 | ||||
| -rw-r--r-- | nova/volume/manager.py | 8 |
2 files changed, 8 insertions, 8 deletions
diff --git a/nova/compute/api.py b/nova/compute/api.py index 740dd3935..495ae93bf 100644 --- a/nova/compute/api.py +++ b/nova/compute/api.py @@ -67,10 +67,10 @@ class API(base.Base): """Get the network topic for an instance.""" try: instance = self.get(context, instance_id) - except exception.NotFound as e: + except exception.NotFound: LOG.warning(_("Instance %d was not found in get_network_topic"), instance_id) - raise e + raise host = instance['host'] if not host: @@ -293,10 +293,10 @@ class API(base.Base): LOG.debug(_("Going to try to terminate %s"), instance_id) try: instance = self.get(context, instance_id) - except exception.NotFound as e: + except exception.NotFound: LOG.warning(_("Instance %d was not found during terminate"), instance_id) - raise e + raise if (instance['state_description'] == 'terminating'): LOG.warning(_("Instance %d is already being terminated"), diff --git a/nova/volume/manager.py b/nova/volume/manager.py index 6e70ec881..d2f02e4e0 100644 --- a/nova/volume/manager.py +++ b/nova/volume/manager.py @@ -111,10 +111,10 @@ class VolumeManager(manager.Manager): LOG.debug(_("volume %s: creating export"), volume_ref['name']) self.driver.create_export(context, volume_ref) - except Exception as e: + except Exception: self.db.volume_update(context, volume_ref['id'], {'status': 'error'}) - raise e + raise now = datetime.datetime.utcnow() self.db.volume_update(context, @@ -137,11 +137,11 @@ class VolumeManager(manager.Manager): self.driver.remove_export(context, volume_ref) LOG.debug(_("volume %s: deleting"), volume_ref['name']) self.driver.delete_volume(volume_ref) - except Exception as e: + except Exception: self.db.volume_update(context, volume_ref['id'], {'status': 'error_deleting'}) - raise e + raise self.db.volume_destroy(context, volume_id) LOG.debug(_("volume %s: deleted successfully"), volume_ref['name']) |
