diff --git a/nova/notifications.py b/nova/notifications.py index bed06acf6..16a49dcf6 100644 --- a/nova/notifications.py +++ b/nova/notifications.py @@ -26,6 +26,7 @@ from nova import db from nova.image import glance from nova import network from nova.network import model as network_model +from nova.openstack.common import excutils from nova.openstack.common import log from nova.openstack.common.notifier import api as notifier_api from nova.openstack.common import timeutils @@ -225,10 +226,14 @@ def bandwidth_usage(instance_ref, audit_start, nw_info = network.API().get_instance_nw_info(admin_context, instance_ref) except Exception: - LOG.exception(_('Failed to get nw_info'), instance=instance_ref) - if ignore_missing_network_data: - return - raise + try: + with excutils.save_and_reraise_exception(): + LOG.exception(_('Failed to get nw_info'), + instance=instance_ref) + except Exception: + if ignore_missing_network_data: + return + raise macs = [vif['address'] for vif in nw_info] uuids = [instance_ref["uuid"]] diff --git a/nova/scheduler/scheduler_options.py b/nova/scheduler/scheduler_options.py index 75b68e557..f7aa91155 100644 --- a/nova/scheduler/scheduler_options.py +++ b/nova/scheduler/scheduler_options.py @@ -28,6 +28,7 @@ import os from oslo.config import cfg +from nova.openstack.common import excutils from nova.openstack.common import log as logging from nova.openstack.common import timeutils @@ -66,9 +67,9 @@ class SchedulerOptions(object): try: return os.path.getmtime(filename) except os.error, e: - LOG.exception(_("Could not stat scheduler options file " - "%(filename)s: '%(e)s'"), locals()) - raise + with excutils.save_and_reraise_exception(): + LOG.exception(_("Could not stat scheduler options file " + "%(filename)s: '%(e)s'"), locals()) def _load_file(self, handle): """Decode the JSON file. Broken out for testing.""" diff --git a/nova/wsgi.py b/nova/wsgi.py index b9e204b90..72e464919 100644 --- a/nova/wsgi.py +++ b/nova/wsgi.py @@ -34,6 +34,7 @@ import webob.dec import webob.exc from nova import exception +from nova.openstack.common import excutils from nova.openstack.common import log as logging wsgi_opts = [ @@ -175,9 +176,9 @@ class Server(object): CONF.tcp_keepidle) except Exception: - LOG.error(_("Failed to start %(name)s on %(host)s" - ":%(port)s with SSL support") % self.__dict__) - raise + with excutils.save_and_reraise_exception(): + LOG.error(_("Failed to start %(name)s on %(host)s" + ":%(port)s with SSL support") % self.__dict__) wsgi_kwargs = { 'func': eventlet.wsgi.server,