]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
ovs_dvr: Use lazy logging interpolation
authorAngus Lees <gus@inodes.org>
Mon, 22 Dec 2014 04:41:28 +0000 (15:41 +1100)
committerAngus Lees <gus@inodes.org>
Wed, 31 Dec 2014 03:26:52 +0000 (03:26 +0000)
There are a small number of examples of "eager" interpolation in
neutron:
  logging.debug("foo %s" % arg)

These should be converted to perform the interpolation lazily within
the logging function, since if the severity is below the logging level
then the interpolation can be skipped entirely.

This change addresses all such examples found in ovs agent via a pylint
test.  Other occurrences are addressed elsewhere.

Change-Id: Ie215f33818cc5c16e570ace4c750df5371d27e09
Partial-Bug: #1404788

neutron/plugins/openvswitch/agent/ovs_dvr_neutron_agent.py

index cd53e2a586e6d7ef347a8fe9f9e4876e8b958721..a4e2446ccf202c3a490269c09b1621ee4aa4ab4b 100644 (file)
@@ -337,8 +337,9 @@ class OVSDVRNeutronAgent(dvr_rpc.DVRAgentRpcApiMixin):
                 LOG.error(_LE("DVR: Unable to retrieve subnet information "
                               "for subnet_id %s"), subnet_uuid)
                 return
-            LOG.debug("get_subnet_for_dvr for subnet %s returned with %s" %
-                      (subnet_uuid, subnet_info))
+            LOG.debug("get_subnet_for_dvr for subnet %(uuid)s "
+                      "returned with %(info)s",
+                      {"uuid": subnet_uuid, "info": subnet_info})
             ldm = LocalDVRSubnetMapping(subnet_info)
             self.local_dvr_map[subnet_uuid] = ldm