Skip warnings during DHCP port actions if no error is raised

With multiple concurrent DHCP operations, the server log may be
filled with warning traces about the inability to complete the
DHCP action correctly. These should be emitted only when reraising
the underlying exception, namely when the underlying error is
not an expected nor a handled one.

Related-bug: 1621345
Related-bug: 1620864

Change-Id: I1f00609f8181e3765238550f45e6e114d2df7e6e
This commit is contained in:
Armando Migliaccio
2016-09-14 11:25:43 -07:00
parent 181bdb374f
commit d6df96ddf2

View File

@@ -118,10 +118,14 @@ class DhcpRpcCallback(object):
pass
else:
ctxt.reraise = True
net_id = port['port']['network_id']
LOG.warning(_LW("Action %(action)s for network %(net_id)s "
"could not complete successfully: %(reason)s"),
{"action": action, "net_id": net_id, 'reason': e})
if ctxt.reraise:
net_id = port['port']['network_id']
LOG.warning(_LW("Action %(action)s for network %(net_id)s "
"could not complete successfully: "
"%(reason)s"),
{"action": action,
"net_id": net_id,
'reason': e})
def _group_by_network_id(self, res):
grouped = {}