Merge "Refactor reraise of exception by l2 gateway agent"

stable/ocata
Jenkins 8 years ago committed by Gerrit Code Review
commit e5cb347301

@ -24,6 +24,7 @@ import ssl
import time
from oslo.serialization import jsonutils
from oslo_utils import excutils
from networking_l2gw.services.l2gateway.common import constants as n_const
@ -63,13 +64,15 @@ class OVSDBConnection(object):
self.socket.connect((str(gw_config.ovsdb_ip),
int(gw_config.ovsdb_port)))
break
except Exception as ex:
except socket.error:
LOG.warning(OVSDB_UNREACHABLE_MSG, gw_config.ovsdb_ip)
if retryCount == conf.max_connection_retries:
# Retried for max_connection_retries times.
# Give up and return so that it can be tried in
# the next periodic interval.
raise ex
with excutils.save_and_reraise_exception(reraise=True):
LOG.exception(_LE("Socket error in connecting to "
"the OVSDB server"))
else:
time.sleep(1)
retryCount += 1

@ -27,6 +27,7 @@ from networking_l2gw.services.l2gateway.agent.ovsdb import connection
from networking_l2gw.services.l2gateway.common import constants as n_const
from oslo.config import cfg
from oslo_utils import excutils
LOG = logging.getLogger(__name__)
@ -100,10 +101,12 @@ class OVSDBManager(base_agent_manager.BaseAgentManager):
True,
self.plugin_rpc)
except Exception:
# Log a warning and continue so that it can retried
# in the next iteration
LOG.warning(_LW("OVSDB server %s is not reachable"),
gateway.ovsdb_ip)
with excutils.save_and_reraise_exception(reraise=False
):
# Log a warning and continue so that it can retried
# in the next iteration
LOG.warning(_LW("OVSDB server %s is not "
"reachable"), gateway.ovsdb_ip)
gateway.ovsdb_fd = ovsdb_fd
eventlet.greenthread.spawn_n(ovsdb_fd.
set_monitor_response_handler)

Loading…
Cancel
Save