Don't use save_and_reraise_exception when we never reraise

Otherwise we get "Original exception being dropped" messages.

Closes-Bug: #1669244
Change-Id: Iecda4cce3f87c1a5a18cf365a3d6bdf5a8b4b514
This commit is contained in:
YAMAMOTO Takashi 2017-03-02 12:52:25 +09:00
parent 4ded53918f
commit 5bd08ce7f9
2 changed files with 12 additions and 17 deletions

View File

@ -23,7 +23,6 @@ from neutron_lib import constants
from neutron_lib import exceptions as n_exc
from neutron_lib.plugins import directory
from oslo_log import log as logging
from oslo_utils import excutils
from oslo_utils import uuidutils
import six
from sqlalchemy import orm
@ -437,11 +436,10 @@ class L3_NAT_dbonly_mixin(l3.RouterPluginBase,
resources.ROUTER_GATEWAY, events.BEFORE_DELETE, self,
**kwargs)
except exceptions.CallbackFailure as e:
with excutils.save_and_reraise_exception():
# NOTE(armax): preserve old check's behavior
if len(e.errors) == 1:
raise e.errors[0].error
raise l3.RouterInUse(router_id=router.id, reason=e)
# NOTE(armax): preserve old check's behavior
if len(e.errors) == 1:
raise e.errors[0].error
raise l3.RouterInUse(router_id=router.id, reason=e)
def _create_gw_port(self, context, router_id, router, new_network_id,
ext_ips):
@ -890,11 +888,10 @@ class L3_NAT_dbonly_mixin(l3.RouterPluginBase,
resources.ROUTER_INTERFACE,
events.BEFORE_DELETE, self, **kwargs)
except exceptions.CallbackFailure as e:
with excutils.save_and_reraise_exception():
# NOTE(armax): preserve old check's behavior
if len(e.errors) == 1:
raise e.errors[0].error
raise l3.RouterInUse(router_id=router_id, reason=e)
# NOTE(armax): preserve old check's behavior
if len(e.errors) == 1:
raise e.errors[0].error
raise l3.RouterInUse(router_id=router_id, reason=e)
for fip_db in fip_qry.filter_by(router_id=router_id):
if netaddr.IPAddress(fip_db['fixed_ip_address']) in subnet_cidr:
raise l3.RouterInterfaceInUseByFloatingIP(

View File

@ -115,12 +115,10 @@ class L3_NAT_with_dvr_db_mixin(l3_db.L3_NAT_db_mixin,
registry.notify(
resources.ROUTER, events.BEFORE_UPDATE, self, **kwargs)
except exceptions.CallbackFailure as e:
with excutils.save_and_reraise_exception():
# NOTE(armax): preserve old check's behavior
if len(e.errors) == 1:
raise e.errors[0].error
raise l3.RouterInUse(router_id=router_db['id'],
reason=e)
# NOTE(armax): preserve old check's behavior
if len(e.errors) == 1:
raise e.errors[0].error
raise l3.RouterInUse(router_id=router_db['id'], reason=e)
return True
def _handle_distributed_migration(self, resource, event, trigger, context,