From: Kevin Benton Date: Fri, 4 Sep 2015 00:43:37 +0000 (-0700) Subject: Don't log deadlock or retry exceptions in L3 DB X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=2d65cccba29220e46b490871210014b94f086984;p=openstack-build%2Fneutron-build.git Don't log deadlock or retry exceptions in L3 DB We don't want to log exceptions in the l3 DB that will be retried by the DB retry decorator because it will look like a failure in the log when it actually ends up being retried. Change-Id: I024fc2db9022809194178c227d994bc6ed33c78b Closes-Bug: #1494886 --- diff --git a/neutron/db/l3_db.py b/neutron/db/l3_db.py index 07173791e..60ab661b9 100644 --- a/neutron/db/l3_db.py +++ b/neutron/db/l3_db.py @@ -13,6 +13,7 @@ # under the License. import netaddr +from oslo_db import exception as db_exc from oslo_log import log as logging from oslo_utils import uuidutils import sqlalchemy as sa @@ -179,10 +180,13 @@ class L3_NAT_dbonly_mixin(l3.RouterPluginBase): if gw_info: self._update_router_gw_info(context, router_db['id'], gw_info, router=router_db) - except Exception: + except Exception as e: with excutils.save_and_reraise_exception(): - LOG.exception(_LE("An exception occurred while creating " - "the router: %s"), router) + # NOTE(kevinbenton): db errors will be retried by the decorator + # at the API layer so it's not a complete failure scenario. + if not isinstance(e, (db_exc.DBDeadlock, db_exc.RetryRequest)): + LOG.exception(_LE("An exception occurred while creating " + "the router: %s"), router) self.delete_router(context, router_db.id) return self._make_router_dict(router_db)