]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Log the exception in linuxbridge_neutron_agent as exception
authorHong Hui Xiao <xiaohhui@cn.ibm.com>
Wed, 21 Oct 2015 14:35:53 +0000 (10:35 -0400)
committerHong Hui Xiao <xiaohhui@cn.ibm.com>
Tue, 27 Oct 2015 09:09:23 +0000 (09:09 +0000)
The log here should be logged as exception. 1) It is more readable.
2) It keeps consistent with the action of its sibling module,
ovs_neutron_agent.

Change-Id: Idf11a617369cbee0dc23c8e56ae9475bb41dcc02
Closes-bug: #1508270

neutron/plugins/ml2/drivers/linuxbridge/agent/linuxbridge_neutron_agent.py
neutron/tests/unit/plugins/ml2/drivers/linuxbridge/agent/test_linuxbridge_neutron_agent.py

index 504a5f97c2e2b17d1963441ed7d8d15d4bef7322..4223e9ecfd48aab3c88e86fc74eb1398165ce8b6 100644 (file)
@@ -963,10 +963,8 @@ class LinuxBridgeNeutronAgentRPC(service.Service):
         try:
             devices_details_list = self.plugin_rpc.get_devices_details_list(
                 self.context, devices, self.agent_id)
-        except Exception as e:
-            LOG.debug("Unable to get port details for "
-                      "%(devices)s: %(e)s",
-                      {'devices': devices, 'e': e})
+        except Exception:
+            LOG.exception(_LE("Unable to get port details for %s"), devices)
             # resync is needed
             return True
 
@@ -1023,9 +1021,9 @@ class LinuxBridgeNeutronAgentRPC(service.Service):
                                                              device,
                                                              self.agent_id,
                                                              cfg.CONF.host)
-            except Exception as e:
-                LOG.debug("port_removed failed for %(device)s: %(e)s",
-                          {'device': device, 'e': e})
+            except Exception:
+                LOG.exception(_LE("Error occurred while removing port %s"),
+                              device)
                 resync = True
             if details and details['exists']:
                 LOG.info(_LI("Port %s updated."), device)
index d5eea954ee00ed1437ce037606dea084aa4973ac..2ba4f40709162e349a92e1fb9ae3ad3160c9c714 100644 (file)
@@ -166,13 +166,10 @@ class TestLinuxBridgeAgent(base.BaseTestCase):
                 mock.patch.object(agent.sg_agent,
                                   "remove_devices_filter") as fn_rdf:
             fn_udd.side_effect = Exception()
-            with mock.patch.object(linuxbridge_neutron_agent.LOG,
-                                   'debug') as log:
-                resync = agent.treat_devices_removed(devices)
-                self.assertEqual(2, log.call_count)
-                self.assertTrue(resync)
-                self.assertTrue(fn_udd.called)
-                self.assertTrue(fn_rdf.called)
+            resync = agent.treat_devices_removed(devices)
+            self.assertTrue(resync)
+            self.assertTrue(fn_udd.called)
+            self.assertTrue(fn_rdf.called)
 
     def _test_scan_devices(self, previous, updated,
                            fake_current, expected, sync):