Merge "Log the exception in linuxbridge_neutron_agent as exception"

This commit is contained in:
Jenkins 2015-10-28 03:30:21 +00:00 committed by Gerrit Code Review
commit 5e34292faa
2 changed files with 9 additions and 14 deletions

View File

@ -957,10 +957,8 @@ class LinuxBridgeNeutronAgentRPC(service.Service):
try: try:
devices_details_list = self.plugin_rpc.get_devices_details_list( devices_details_list = self.plugin_rpc.get_devices_details_list(
self.context, devices, self.agent_id) self.context, devices, self.agent_id)
except Exception as e: except Exception:
LOG.debug("Unable to get port details for " LOG.exception(_LE("Unable to get port details for %s"), devices)
"%(devices)s: %(e)s",
{'devices': devices, 'e': e})
# resync is needed # resync is needed
return True return True
@ -1017,9 +1015,9 @@ class LinuxBridgeNeutronAgentRPC(service.Service):
device, device,
self.agent_id, self.agent_id,
cfg.CONF.host) cfg.CONF.host)
except Exception as e: except Exception:
LOG.debug("port_removed failed for %(device)s: %(e)s", LOG.exception(_LE("Error occurred while removing port %s"),
{'device': device, 'e': e}) device)
resync = True resync = True
if details and details['exists']: if details and details['exists']:
LOG.info(_LI("Port %s updated."), device) LOG.info(_LI("Port %s updated."), device)

View File

@ -166,13 +166,10 @@ class TestLinuxBridgeAgent(base.BaseTestCase):
mock.patch.object(agent.sg_agent, mock.patch.object(agent.sg_agent,
"remove_devices_filter") as fn_rdf: "remove_devices_filter") as fn_rdf:
fn_udd.side_effect = Exception() fn_udd.side_effect = Exception()
with mock.patch.object(linuxbridge_neutron_agent.LOG, resync = agent.treat_devices_removed(devices)
'debug') as log: self.assertTrue(resync)
resync = agent.treat_devices_removed(devices) self.assertTrue(fn_udd.called)
self.assertEqual(2, log.call_count) self.assertTrue(fn_rdf.called)
self.assertTrue(resync)
self.assertTrue(fn_udd.called)
self.assertTrue(fn_rdf.called)
def _test_scan_devices(self, previous, updated, def _test_scan_devices(self, previous, updated,
fake_current, expected, sync): fake_current, expected, sync):