From a70a38fc8c23461a08ecadb113d2c54eb4e5bbc4 Mon Sep 17 00:00:00 2001 From: Angus Lees Date: Mon, 22 Dec 2014 15:41:01 +1100 Subject: [PATCH] brocade: Use lazy logging interpolation 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 brocade l3_router_plugin via a pylint test. Other occurrences are addressed elsewhere. Change-Id: Ia2d51e8ecbc7af81390577ec69c5ce18523b65f3 Partial-Bug: #1404788 --- .../l3_router/brocade/l3_router_plugin.py | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/neutron/services/l3_router/brocade/l3_router_plugin.py b/neutron/services/l3_router/brocade/l3_router_plugin.py index b7c73e770..e3d09658f 100644 --- a/neutron/services/l3_router/brocade/l3_router_plugin.py +++ b/neutron/services/l3_router/brocade/l3_router_plugin.py @@ -142,10 +142,10 @@ class BrocadeSVIPlugin(router.L3RouterPlugin): LOG.debug("Allocated cidr %(cidr)s from the pool, " "network_id %(net_id)s " "bnet %(bnet)s " - "vlan %(vlan_id)d " % ({'cidr': gateway_ip_cidr, - 'net_id': network_id, - 'bnet': bnet, - 'vlan_id': int(vlan_id)})) + "vlan %(vlan_id)d ", {'cidr': gateway_ip_cidr, + 'net_id': network_id, + 'bnet': bnet, + 'vlan_id': int(vlan_id)}) port_filters = {'network_id': [network_id], 'device_owner': [DEVICE_OWNER_ROUTER_INTF]} port_count = self._core_plugin.get_ports_count(context, @@ -206,10 +206,11 @@ class BrocadeSVIPlugin(router.L3RouterPlugin): LOG.debug("remove_router_interface removed cidr %(cidr)s" " from the pool," " network_id %(net_id)s bnet %(bnet)s" - " vlan %(vlan_id)d" % - ({'cidr': gateway_ip_cidr, - 'net_id': network_id, - 'bnet': bnet, 'vlan_id': int(vlan_id)})) + " vlan %(vlan_id)d", + {'cidr': gateway_ip_cidr, + 'net_id': network_id, + 'bnet': bnet, + 'vlan_id': int(vlan_id)}) switch = self._switch self._driver.delete_svi(switch['address'], switch['username'], -- 2.45.2