Browse Source

Make code follow log translation guideline

Since Pike log messages should not be translated.
This patch removes calls to i18n _LC, _LI, _LE, _LW from
logging logic throughout the code. Translators definition
from neutron._i18n is removed as well.
This patch also removes log translation verification from
ignore directive in tox.ini.

Change-Id: If9aa76fcf121c0e61a7c08088006c5873faee56e
tags/12.0.0.0b1
Inessa Vasilevskaya 2 years ago
parent
commit
7322bd6efb
100 changed files with 709 additions and 783 deletions
  1. 0
    10
      neutron/_i18n.py
  2. 2
    3
      neutron/agent/agent_extensions_manager.py
  3. 13
    13
      neutron/agent/common/ovs_lib.py
  4. 1
    2
      neutron/agent/common/utils.py
  5. 31
    31
      neutron/agent/dhcp/agent.py
  6. 14
    15
      neutron/agent/l2/extensions/fdb_population.py
  7. 5
    6
      neutron/agent/l2/extensions/qos.py
  8. 4
    5
      neutron/agent/l2/l2_agent_extensions_manager.py
  9. 41
    41
      neutron/agent/l3/agent.py
  10. 2
    3
      neutron/agent/l3/dvr_edge_router.py
  11. 11
    11
      neutron/agent/l3/dvr_fip_ns.py
  12. 8
    9
      neutron/agent/l3/dvr_local_router.py
  13. 5
    6
      neutron/agent/l3/dvr_router_base.py
  14. 3
    4
      neutron/agent/l3/ha.py
  15. 3
    4
      neutron/agent/l3/ha_router.py
  16. 2
    3
      neutron/agent/l3/item_allocator.py
  17. 3
    3
      neutron/agent/l3/keepalived_state_change.py
  18. 6
    7
      neutron/agent/l3/l3_agent_extensions_manager.py
  19. 3
    4
      neutron/agent/l3/namespace_manager.py
  20. 3
    4
      neutron/agent/l3/namespaces.py
  21. 7
    7
      neutron/agent/l3/router_info.py
  22. 6
    6
      neutron/agent/linux/async_process.py
  23. 6
    6
      neutron/agent/linux/daemon.py
  24. 20
    21
      neutron/agent/linux/dhcp.py
  25. 9
    9
      neutron/agent/linux/external_process.py
  26. 11
    11
      neutron/agent/linux/interface.py
  27. 1
    3
      neutron/agent/linux/ip_conntrack.py
  28. 13
    13
      neutron/agent/linux/ip_lib.py
  29. 2
    2
      neutron/agent/linux/ip_link_support.py
  30. 2
    3
      neutron/agent/linux/ip_monitor.py
  31. 4
    5
      neutron/agent/linux/iptables_firewall.py
  32. 10
    10
      neutron/agent/linux/iptables_manager.py
  33. 3
    3
      neutron/agent/linux/keepalived.py
  34. 2
    3
      neutron/agent/linux/openvswitch_firewall/firewall.py
  35. 1
    2
      neutron/agent/linux/ovsdb_monitor.py
  36. 3
    3
      neutron/agent/linux/pd.py
  37. 3
    3
      neutron/agent/linux/utils.py
  38. 1
    2
      neutron/agent/linux/xenapi_root_helper.py
  39. 7
    7
      neutron/agent/metadata/agent.py
  40. 4
    5
      neutron/agent/ovsdb/impl_vsctl.py
  41. 17
    18
      neutron/agent/securitygroups_rpc.py
  42. 3
    5
      neutron/agent/windows/ip_lib.py
  43. 3
    3
      neutron/api/api_common.py
  44. 17
    18
      neutron/api/extensions.py
  45. 10
    11
      neutron/api/rpc/agentnotifiers/dhcp_rpc_agent_api.py
  46. 2
    3
      neutron/api/rpc/agentnotifiers/l3_rpc_agent_api.py
  47. 2
    4
      neutron/api/rpc/agentnotifiers/utils.py
  48. 4
    4
      neutron/api/rpc/handlers/dhcp_rpc.py
  49. 3
    4
      neutron/api/rpc/handlers/securitygroups_rpc.py
  50. 5
    5
      neutron/api/v2/base.py
  51. 7
    9
      neutron/api/v2/resource.py
  52. 7
    8
      neutron/cmd/ipset_cleanup.py
  53. 7
    8
      neutron/cmd/linuxbridge_cleanup.py
  54. 5
    6
      neutron/cmd/netns_cleanup.py
  55. 3
    4
      neutron/cmd/ovs_cleanup.py
  56. 7
    8
      neutron/cmd/sanity/checks.py
  57. 79
    79
      neutron/cmd/sanity_check.py
  58. 3
    3
      neutron/common/config.py
  59. 4
    6
      neutron/common/ipv6_utils.py
  60. 8
    10
      neutron/common/profiler.py
  61. 9
    10
      neutron/common/rpc.py
  62. 6
    6
      neutron/common/utils.py
  63. 3
    4
      neutron/db/_utils.py
  64. 15
    15
      neutron/db/agents_db.py
  65. 31
    31
      neutron/db/agentschedulers_db.py
  66. 2
    3
      neutron/db/api.py
  67. 6
    6
      neutron/db/db_base_plugin_v2.py
  68. 11
    11
      neutron/db/dns_db.py
  69. 4
    4
      neutron/db/dvr_mac_db.py
  70. 15
    15
      neutron/db/ipam_backend_mixin.py
  71. 5
    6
      neutron/db/ipam_pluggable_backend.py
  72. 5
    5
      neutron/db/l3_agentschedulers_db.py
  73. 8
    8
      neutron/db/l3_db.py
  74. 10
    10
      neutron/db/l3_dvr_db.py
  75. 14
    14
      neutron/db/l3_hamode_db.py
  76. 1
    2
      neutron/db/metering/metering_rpc.py
  77. 5
    6
      neutron/db/provisioning_blocks.py
  78. 2
    3
      neutron/db/segments_db.py
  79. 8
    8
      neutron/db/standard_attr.py
  80. 2
    2
      neutron/debug/commands.py
  81. 1
    2
      neutron/debug/debug_agent.py
  82. 3
    4
      neutron/debug/shell.py
  83. 5
    5
      neutron/extensions/l3agentscheduler.py
  84. 2
    2
      neutron/extensions/vlantransparent.py
  85. 5
    7
      neutron/ipam/drivers/neutrondb_ipam/driver.py
  86. 5
    5
      neutron/manager.py
  87. 8
    9
      neutron/notifiers/nova.py
  88. 2
    3
      neutron/pecan_wsgi/controllers/resource.py
  89. 2
    3
      neutron/pecan_wsgi/controllers/root.py
  90. 2
    3
      neutron/pecan_wsgi/hooks/translation.py
  91. 6
    6
      neutron/plugins/common/utils.py
  92. 4
    4
      neutron/plugins/ml2/db.py
  93. 1
    2
      neutron/plugins/ml2/driver_context.py
  94. 20
    21
      neutron/plugins/ml2/drivers/agent/_common_agent.py
  95. 1
    2
      neutron/plugins/ml2/drivers/helpers.py
  96. 3
    3
      neutron/plugins/ml2/drivers/l2pop/mech_driver.py
  97. 3
    4
      neutron/plugins/ml2/drivers/linuxbridge/agent/arp_protect.py
  98. 2
    3
      neutron/plugins/ml2/drivers/linuxbridge/agent/common/utils.py
  99. 1
    2
      neutron/plugins/ml2/drivers/linuxbridge/agent/extension_drivers/qos_driver.py
  100. 0
    0
      neutron/plugins/ml2/drivers/linuxbridge/agent/linuxbridge_neutron_agent.py

+ 0
- 10
neutron/_i18n.py View File

@@ -27,16 +27,6 @@ _C = _translators.contextual_form
27 27
 # The plural translation function using the name "_P"
28 28
 _P = _translators.plural_form
29 29
 
30
-# Translators for log levels.
31
-#
32
-# The abbreviated names are meant to reflect the usual use of a short
33
-# name like '_'. The "L" is for "log" and the other letter comes from
34
-# the level.
35
-_LI = _translators.log_info
36
-_LW = _translators.log_warning
37
-_LE = _translators.log_error
38
-_LC = _translators.log_critical
39
-
40 30
 
41 31
 def get_available_languages():
42 32
     return oslo_i18n.get_available_languages(DOMAIN)

+ 2
- 3
neutron/agent/agent_extensions_manager.py View File

@@ -13,7 +13,6 @@
13 13
 from oslo_log import log
14 14
 import stevedore
15 15
 
16
-from neutron._i18n import _LI
17 16
 from neutron.conf.agent import agent_extensions_manager as agent_ext_mgr_config
18 17
 
19 18
 LOG = log.getLogger(__name__)
@@ -28,7 +27,7 @@ class AgentExtensionsManager(stevedore.named.NamedExtensionManager):
28 27
         super(AgentExtensionsManager, self).__init__(
29 28
             namespace, conf.agent.extensions,
30 29
             invoke_on_load=True, name_order=True)
31
-        LOG.info(_LI("Loaded agent extensions: %s"), self.names())
30
+        LOG.info("Loaded agent extensions: %s", self.names())
32 31
 
33 32
     def initialize(self, connection, driver_type, agent_api=None):
34 33
         """Initialize enabled agent extensions.
@@ -44,7 +43,7 @@ class AgentExtensionsManager(stevedore.named.NamedExtensionManager):
44 43
         """
45 44
         # Initialize each agent extension in the list.
46 45
         for extension in self:
47
-            LOG.info(_LI("Initializing agent extension '%s'"), extension.name)
46
+            LOG.info("Initializing agent extension '%s'", extension.name)
48 47
             # If the agent has provided an agent_api object, this object will
49 48
             # be passed to all interested extensions.  This object must be
50 49
             # consumed by each such extension before the extension's

+ 13
- 13
neutron/agent/common/ovs_lib.py View File

@@ -27,7 +27,7 @@ from oslo_log import log as logging
27 27
 import six
28 28
 import tenacity
29 29
 
30
-from neutron._i18n import _, _LE, _LI, _LW
30
+from neutron._i18n import _
31 31
 from neutron.agent.common import ip_lib
32 32
 from neutron.agent.common import utils
33 33
 from neutron.agent.ovsdb import api as ovsdb_api
@@ -298,8 +298,8 @@ class OVSBridge(BaseOVS):
298 298
                               "in 1 second. Attempt: %s/10", i)
299 299
                     time.sleep(1)
300 300
                     continue
301
-                LOG.error(_LE("Unable to execute %(cmd)s. Exception: "
302
-                              "%(exception)s"),
301
+                LOG.error("Unable to execute %(cmd)s. Exception: "
302
+                          "%(exception)s",
303 303
                           {'cmd': full_args, 'exception': e})
304 304
                 break
305 305
 
@@ -320,7 +320,7 @@ class OVSBridge(BaseOVS):
320 320
         try:
321 321
             ofport = self._get_port_val(port_name, "ofport")
322 322
         except tenacity.RetryError:
323
-            LOG.exception(_LE("Timed out retrieving ofport on port %s."),
323
+            LOG.exception("Timed out retrieving ofport on port %s.",
324 324
                           port_name)
325 325
         return ofport
326 326
 
@@ -330,7 +330,7 @@ class OVSBridge(BaseOVS):
330 330
         try:
331 331
             port_external_ids = self._get_port_val(port_name, "external_ids")
332 332
         except tenacity.RetryError:
333
-            LOG.exception(_LE("Timed out retrieving external_ids on port %s."),
333
+            LOG.exception("Timed out retrieving external_ids on port %s.",
334 334
                           port_name)
335 335
         return port_external_ids
336 336
 
@@ -526,10 +526,10 @@ class OVSBridge(BaseOVS):
526 526
             if_exists=True)
527 527
         for result in results:
528 528
             if result['ofport'] == UNASSIGNED_OFPORT:
529
-                LOG.warning(_LW("Found not yet ready openvswitch port: %s"),
529
+                LOG.warning("Found not yet ready openvswitch port: %s",
530 530
                             result['name'])
531 531
             elif result['ofport'] == INVALID_OFPORT:
532
-                LOG.warning(_LW("Found failed openvswitch port: %s"),
532
+                LOG.warning("Found failed openvswitch port: %s",
533 533
                             result['name'])
534 534
             elif 'attached-mac' in result['external_ids']:
535 535
                 port_id = self.portid_from_external_ids(result['external_ids'])
@@ -569,8 +569,8 @@ class OVSBridge(BaseOVS):
569 569
         for port_id in port_ids:
570 570
             result[port_id] = None
571 571
             if port_id not in by_id:
572
-                LOG.info(_LI("Port %(port_id)s not present in bridge "
573
-                             "%(br_name)s"),
572
+                LOG.info("Port %(port_id)s not present in bridge "
573
+                         "%(br_name)s",
574 574
                          {'port_id': port_id, 'br_name': self.br_name})
575 575
                 continue
576 576
             pinfo = by_id[port_id]
@@ -584,8 +584,8 @@ class OVSBridge(BaseOVS):
584 584
     @staticmethod
585 585
     def _check_ofport(port_id, port_info):
586 586
         if port_info['ofport'] in [UNASSIGNED_OFPORT, INVALID_OFPORT]:
587
-            LOG.warning(_LW("ofport: %(ofport)s for VIF: %(vif)s "
588
-                            "is not a positive integer"),
587
+            LOG.warning("ofport: %(ofport)s for VIF: %(vif)s "
588
+                        "is not a positive integer",
589 589
                         {'ofport': port_info['ofport'], 'vif': port_id})
590 590
             return False
591 591
         return True
@@ -602,7 +602,7 @@ class OVSBridge(BaseOVS):
602 602
                 continue
603 603
             mac = port['external_ids'].get('attached-mac')
604 604
             return VifPort(port['name'], port['ofport'], port_id, mac, self)
605
-        LOG.info(_LI("Port %(port_id)s not present in bridge %(br_name)s"),
605
+        LOG.info("Port %(port_id)s not present in bridge %(br_name)s",
606 606
                  {'port_id': port_id, 'br_name': self.br_name})
607 607
 
608 608
     def delete_ports(self, all_ports=False):
@@ -837,7 +837,7 @@ class DeferredOVSBridge(object):
837 837
         if exc_type is None:
838 838
             self.apply_flows()
839 839
         else:
840
-            LOG.exception(_LE("OVS flows could not be applied on bridge %s"),
840
+            LOG.exception("OVS flows could not be applied on bridge %s",
841 841
                           self.br.br_name)
842 842
 
843 843
 

+ 1
- 2
neutron/agent/common/utils.py View File

@@ -19,7 +19,6 @@ from oslo_config import cfg
19 19
 from oslo_log import log as logging
20 20
 from oslo_utils import timeutils
21 21
 
22
-from neutron._i18n import _LE
23 22
 from neutron.common import utils as neutron_utils
24 23
 from neutron.conf.agent import common as config
25 24
 from neutron.conf.agent.database import agents_db
@@ -53,7 +52,7 @@ def load_interface_driver(conf):
53 52
                 INTERFACE_NAMESPACE, conf.interface_driver)
54 53
         return loaded_class(conf)
55 54
     except ImportError:
56
-        LOG.error(_LE("Error loading interface driver '%s'"),
55
+        LOG.error("Error loading interface driver '%s'",
57 56
                   conf.interface_driver)
58 57
         raise SystemExit(1)
59 58
 

+ 31
- 31
neutron/agent/dhcp/agent.py View File

@@ -29,7 +29,7 @@ from oslo_utils import fileutils
29 29
 from oslo_utils import importutils
30 30
 import six
31 31
 
32
-from neutron._i18n import _, _LE, _LI, _LW
32
+from neutron._i18n import _
33 33
 from neutron.agent.linux import dhcp
34 34
 from neutron.agent.linux import external_process
35 35
 from neutron.agent.metadata import driver as metadata_driver
@@ -120,7 +120,7 @@ class DhcpAgent(manager.Manager):
120 120
 
121 121
     def after_start(self):
122 122
         self.run()
123
-        LOG.info(_LI("DHCP agent started"))
123
+        LOG.info("DHCP agent started")
124 124
 
125 125
     def run(self):
126 126
         """Activate the DHCP agent."""
@@ -164,7 +164,7 @@ class DhcpAgent(manager.Manager):
164 164
                 or isinstance(e, exceptions.NetworkNotFound)):
165 165
                 LOG.debug("Network %s has been deleted.", network.id)
166 166
             else:
167
-                LOG.exception(_LE('Unable to %(action)s dhcp for %(net_id)s.'),
167
+                LOG.exception('Unable to %(action)s dhcp for %(net_id)s.',
168 168
                               {'net_id': network.id, 'action': action})
169 169
 
170 170
     def schedule_resync(self, reason, network_id=None):
@@ -179,21 +179,21 @@ class DhcpAgent(manager.Manager):
179 179
         or 'None' is one of the networks, sync all of the networks.
180 180
         """
181 181
         only_nets = set([] if (not networks or None in networks) else networks)
182
-        LOG.info(_LI('Synchronizing state'))
182
+        LOG.info('Synchronizing state')
183 183
         pool = eventlet.GreenPool(self.conf.num_sync_threads)
184 184
         known_network_ids = set(self.cache.get_network_ids())
185 185
 
186 186
         try:
187 187
             active_networks = self.plugin_rpc.get_active_networks_info()
188
-            LOG.info(_LI('All active networks have been fetched through RPC.'))
188
+            LOG.info('All active networks have been fetched through RPC.')
189 189
             active_network_ids = set(network.id for network in active_networks)
190 190
             for deleted_id in known_network_ids - active_network_ids:
191 191
                 try:
192 192
                     self.disable_dhcp_helper(deleted_id)
193 193
                 except Exception as e:
194 194
                     self.schedule_resync(e, deleted_id)
195
-                    LOG.exception(_LE('Unable to sync network state on '
196
-                                      'deleted network %s'), deleted_id)
195
+                    LOG.exception('Unable to sync network state on '
196
+                                  'deleted network %s', deleted_id)
197 197
 
198 198
             for network in active_networks:
199 199
                 if (not only_nets or  # specifically resync all
@@ -204,7 +204,7 @@ class DhcpAgent(manager.Manager):
204 204
             # we notify all ports in case some were created while the agent
205 205
             # was down
206 206
             self.dhcp_ready_ports |= set(self.cache.get_port_ids(only_nets))
207
-            LOG.info(_LI('Synchronizing state complete'))
207
+            LOG.info('Synchronizing state complete')
208 208
 
209 209
         except Exception as e:
210 210
             if only_nets:
@@ -212,7 +212,7 @@ class DhcpAgent(manager.Manager):
212 212
                     self.schedule_resync(e, network_id)
213 213
             else:
214 214
                 self.schedule_resync(e)
215
-            LOG.exception(_LE('Unable to sync network state.'))
215
+            LOG.exception('Unable to sync network state.')
216 216
 
217 217
     def _dhcp_ready_ports_loop(self):
218 218
         """Notifies the server of any ports that had reservations setup."""
@@ -226,12 +226,12 @@ class DhcpAgent(manager.Manager):
226 226
                     self.plugin_rpc.dhcp_ready_on_ports(ports_to_send)
227 227
                     continue
228 228
                 except oslo_messaging.MessagingTimeout:
229
-                    LOG.error(_LE("Timeout notifying server of ports ready. "
230
-                                  "Retrying..."))
229
+                    LOG.error("Timeout notifying server of ports ready. "
230
+                              "Retrying...")
231 231
                 except Exception:
232
-                    LOG.exception(_LE("Failure notifying DHCP server of "
233
-                                      "ready DHCP ports. Will retry on next "
234
-                                      "iteration."))
232
+                    LOG.exception("Failure notifying DHCP server of "
233
+                                  "ready DHCP ports. Will retry on next "
234
+                                  "iteration.")
235 235
                 self.dhcp_ready_ports |= ports_to_send
236 236
 
237 237
     def start_ready_ports_loop(self):
@@ -267,7 +267,7 @@ class DhcpAgent(manager.Manager):
267 267
             return network
268 268
         except Exception as e:
269 269
             self.schedule_resync(e, network_id)
270
-            LOG.exception(_LE('Network %s info call failed.'), network_id)
270
+            LOG.exception('Network %s info call failed.', network_id)
271 271
 
272 272
     def enable_dhcp_helper(self, network_id):
273 273
         """Enable DHCP for a network that meets enabling criteria."""
@@ -279,12 +279,12 @@ class DhcpAgent(manager.Manager):
279 279
     def safe_configure_dhcp_for_network(self, network):
280 280
         try:
281 281
             network_id = network.get('id')
282
-            LOG.info(_LI('Starting network %s dhcp configuration'), network_id)
282
+            LOG.info('Starting network %s dhcp configuration', network_id)
283 283
             self.configure_dhcp_for_network(network)
284
-            LOG.info(_LI('Finished network %s dhcp configuration'), network_id)
284
+            LOG.info('Finished network %s dhcp configuration', network_id)
285 285
         except (exceptions.NetworkNotFound, RuntimeError):
286
-            LOG.warning(_LW('Network %s may have been deleted and '
287
-                            'its resources may have already been disposed.'),
286
+            LOG.warning('Network %s may have been deleted and '
287
+                        'its resources may have already been disposed.',
288 288
                         network.id)
289 289
 
290 290
     def configure_dhcp_for_network(self, network):
@@ -411,7 +411,7 @@ class DhcpAgent(manager.Manager):
411 411
             network = self.cache.get_network_by_id(updated_port.network_id)
412 412
             if not network:
413 413
                 return
414
-            LOG.info(_LI("Trigger reload_allocations for port %s"),
414
+            LOG.info("Trigger reload_allocations for port %s",
415 415
                      updated_port)
416 416
             driver_action = 'reload_allocations'
417 417
             if self._is_port_on_this_agent(updated_port):
@@ -498,10 +498,10 @@ class DhcpAgent(manager.Manager):
498 498
             if router_ports:
499 499
                 # Multiple router ports should not be allowed
500 500
                 if len(router_ports) > 1:
501
-                    LOG.warning(_LW("%(port_num)d router ports found on the "
502
-                                    "metadata access network. Only the port "
503
-                                    "%(port_id)s, for router %(router_id)s "
504
-                                    "will be considered"),
501
+                    LOG.warning("%(port_num)d router ports found on the "
502
+                                "metadata access network. Only the port "
503
+                                "%(port_id)s, for router %(router_id)s "
504
+                                "will be considered",
505 505
                                 {'port_num': len(router_ports),
506 506
                                  'port_id': router_ports[0].id,
507 507
                                  'router_id': router_ports[0].device_id})
@@ -733,18 +733,18 @@ class DhcpAgentWithStateReport(DhcpAgent):
733 733
             agent_status = self.state_rpc.report_state(
734 734
                 ctx, self.agent_state, True)
735 735
             if agent_status == n_const.AGENT_REVIVED:
736
-                LOG.info(_LI("Agent has just been revived. "
737
-                             "Scheduling full sync"))
736
+                LOG.info("Agent has just been revived. "
737
+                         "Scheduling full sync")
738 738
                 self.schedule_resync("Agent has just been revived")
739 739
         except AttributeError:
740 740
             # This means the server does not support report_state
741
-            LOG.warning(_LW("Neutron server does not support state report. "
742
-                            "State report for this agent will be disabled."))
741
+            LOG.warning("Neutron server does not support state report. "
742
+                        "State report for this agent will be disabled.")
743 743
             self.heartbeat.stop()
744 744
             self.run()
745 745
             return
746 746
         except Exception:
747
-            LOG.exception(_LE("Failed reporting state!"))
747
+            LOG.exception("Failed reporting state!")
748 748
             return
749 749
         if self.agent_state.pop('start_flag', None):
750 750
             self.run()
@@ -753,7 +753,7 @@ class DhcpAgentWithStateReport(DhcpAgent):
753 753
         """Handle the agent_updated notification event."""
754 754
         self.schedule_resync(_("Agent updated: %(payload)s") %
755 755
                              {"payload": payload})
756
-        LOG.info(_LI("agent_updated by server side %s!"), payload)
756
+        LOG.info("agent_updated by server side %s!", payload)
757 757
 
758 758
     def after_start(self):
759
-        LOG.info(_LI("DHCP agent started"))
759
+        LOG.info("DHCP agent started")

+ 14
- 15
neutron/agent/l2/extensions/fdb_population.py View File

@@ -20,7 +20,6 @@ from neutron_lib.utils import helpers
20 20
 from oslo_config import cfg
21 21
 from oslo_log import log as logging
22 22
 
23
-from neutron._i18n import _LE, _LW
24 23
 from neutron.agent.l2 import l2_agent_extension
25 24
 from neutron.agent.linux import bridge_lib
26 25
 from neutron.conf.agent import l2_ext_fdb_population
@@ -73,9 +72,9 @@ class FdbPopulationAgentExtension(
73 72
                 try:
74 73
                     _stdout = bridge_lib.FdbInterface.show(device)
75 74
                 except RuntimeError as e:
76
-                    LOG.warning(_LW(
75
+                    LOG.warning(
77 76
                         'Unable to find FDB Interface %(device)s. '
78
-                        'Exception: %(e)s'), {'device': device, 'e': e})
77
+                        'Exception: %(e)s', {'device': device, 'e': e})
79 78
                     continue
80 79
                 self.device_to_macs[device] = _stdout.split()[::3]
81 80
 
@@ -94,10 +93,10 @@ class FdbPopulationAgentExtension(
94 93
             try:
95 94
                 bridge_lib.FdbInterface.add(mac, device)
96 95
             except RuntimeError as e:
97
-                LOG.warning(_LW(
96
+                LOG.warning(
98 97
                     'Unable to add mac %(mac)s '
99 98
                     'to FDB Interface %(device)s. '
100
-                    'Exception: %(e)s'),
99
+                    'Exception: %(e)s',
101 100
                     {'mac': mac, 'device': device, 'e': e})
102 101
                 return
103 102
             self.device_to_macs[device].append(mac)
@@ -105,19 +104,19 @@ class FdbPopulationAgentExtension(
105 104
         def delete_port(self, devices, port_id):
106 105
             mac = self.portid_to_mac.get(port_id)
107 106
             if mac is None:
108
-                LOG.warning(_LW('Port Id %(port_id)s does not have a rule for '
109
-                    'devices %(devices)s in FDB table'),
110
-                    {'port_id': port_id, 'devices': devices})
107
+                LOG.warning('Port Id %(port_id)s does not have a rule for '
108
+                            'devices %(devices)s in FDB table',
109
+                            {'port_id': port_id, 'devices': devices})
111 110
                 return
112 111
             for device in devices:
113 112
                 if mac in self.device_to_macs[device]:
114 113
                     try:
115 114
                         bridge_lib.FdbInterface.delete(mac, device)
116 115
                     except RuntimeError as e:
117
-                        LOG.warning(_LW(
116
+                        LOG.warning(
118 117
                             'Unable to delete mac %(mac)s '
119 118
                             'from FDB Interface %(device)s. '
120
-                            'Exception: %(e)s'),
119
+                            'Exception: %(e)s',
121 120
                             {'mac': mac, 'device': device, 'e': e})
122 121
                         return
123 122
                     self.device_to_macs[device].remove(mac)
@@ -129,17 +128,17 @@ class FdbPopulationAgentExtension(
129 128
         valid_driver_types = (linux_bridge_constants.EXTENSION_DRIVER_TYPE,
130 129
                               ovs_constants.EXTENSION_DRIVER_TYPE)
131 130
         if driver_type not in valid_driver_types:
132
-            LOG.error(_LE('FDB extension is only supported for OVS and '
133
-                          'linux bridge agent, currently uses '
134
-                          '%(driver_type)s'), {'driver_type': driver_type})
131
+            LOG.error('FDB extension is only supported for OVS and '
132
+                      'linux bridge agent, currently uses '
133
+                      '%(driver_type)s', {'driver_type': driver_type})
135 134
             sys.exit(1)
136 135
 
137 136
         self.device_mappings = helpers.parse_mappings(
138 137
             cfg.CONF.FDB.shared_physical_device_mappings, unique_keys=False)
139 138
         devices = self._get_devices()
140 139
         if not devices:
141
-            LOG.error(_LE('Invalid configuration provided for FDB extension: '
142
-                          'no physical devices'))
140
+            LOG.error('Invalid configuration provided for FDB extension: '
141
+                      'no physical devices')
143 142
             sys.exit(1)
144 143
         self.fdb_tracker = self.FdbTableTracker(devices)
145 144
 

+ 5
- 6
neutron/agent/l2/extensions/qos.py View File

@@ -20,7 +20,6 @@ from oslo_concurrency import lockutils
20 20
 from oslo_log import log as logging
21 21
 import six
22 22
 
23
-from neutron._i18n import _LW, _LI
24 23
 from neutron.agent.l2 import l2_agent_extension
25 24
 from neutron.api.rpc.callbacks.consumer import registry
26 25
 from neutron.api.rpc.callbacks import events
@@ -107,8 +106,8 @@ class QosAgentDriver(object):
107 106
             if rule_type in self.SUPPORTED_RULES:
108 107
                 yield rule
109 108
             else:
110
-                LOG.warning(_LW('Unsupported QoS rule type for %(rule_id)s: '
111
-                                '%(rule_type)s; skipping'),
109
+                LOG.warning('Unsupported QoS rule type for %(rule_id)s: '
110
+                            '%(rule_type)s; skipping',
112 111
                             {'rule_id': rule.id, 'rule_type': rule_type})
113 112
 
114 113
     def _handle_rule_delete(self, port, rule_type, ingress=False):
@@ -261,9 +260,9 @@ class QosAgentExtension(l2_agent_extension.L2AgentExtension):
261 260
         qos_policy = self.resource_rpc.pull(
262 261
             context, resources.QOS_POLICY, qos_policy_id)
263 262
         if qos_policy is None:
264
-            LOG.info(_LI("QoS policy %(qos_policy_id)s applied to port "
265
-                         "%(port_id)s is not available on server, "
266
-                         "it has been deleted. Skipping."),
263
+            LOG.info("QoS policy %(qos_policy_id)s applied to port "
264
+                     "%(port_id)s is not available on server, "
265
+                     "it has been deleted. Skipping.",
267 266
                      {'qos_policy_id': qos_policy_id, 'port_id': port_id})
268 267
             self._process_reset_port(port)
269 268
         else:

+ 4
- 5
neutron/agent/l2/l2_agent_extensions_manager.py View File

@@ -12,7 +12,6 @@
12 12
 
13 13
 from oslo_log import log
14 14
 
15
-from neutron._i18n import _LE
16 15
 from neutron.agent import agent_extensions_manager as agent_ext_manager
17 16
 from neutron.conf.agent import agent_extensions_manager as agent_ext_mgr_config
18 17
 
@@ -43,8 +42,8 @@ class L2AgentExtensionsManager(agent_ext_manager.AgentExtensionsManager):
43 42
                 extension.obj.handle_port(context, data)
44 43
             else:
45 44
                 LOG.error(
46
-                    _LE("Agent Extension '%(name)s' does not "
47
-                        "implement method handle_port"),
45
+                    "Agent Extension '%(name)s' does not "
46
+                    "implement method handle_port",
48 47
                     {'name': extension.name}
49 48
                 )
50 49
 
@@ -55,7 +54,7 @@ class L2AgentExtensionsManager(agent_ext_manager.AgentExtensionsManager):
55 54
                 extension.obj.delete_port(context, data)
56 55
             else:
57 56
                 LOG.error(
58
-                    _LE("Agent Extension '%(name)s' does not "
59
-                        "implement method delete_port"),
57
+                    "Agent Extension '%(name)s' does not "
58
+                    "implement method delete_port",
60 59
                     {'name': extension.name}
61 60
                 )

+ 41
- 41
neutron/agent/l3/agent.py View File

@@ -33,7 +33,7 @@ from oslo_utils import excutils
33 33
 from oslo_utils import timeutils
34 34
 from osprofiler import profiler
35 35
 
36
-from neutron._i18n import _, _LE, _LI, _LW
36
+from neutron._i18n import _
37 37
 from neutron.agent.common import utils as common_utils
38 38
 from neutron.agent.l3 import dvr
39 39
 from neutron.agent.l3 import dvr_edge_ha_router
@@ -221,20 +221,20 @@ class L3NATAgent(ha.AgentMixin,
221 221
                 self.neutron_service_plugins = (
222 222
                     self.plugin_rpc.get_service_plugin_list(self.context))
223 223
             except oslo_messaging.RemoteError as e:
224
-                LOG.warning(_LW('l3-agent cannot check service plugins '
225
-                                'enabled at the neutron server when '
226
-                                'startup due to RPC error. It happens '
227
-                                'when the server does not support this '
228
-                                'RPC API. If the error is '
229
-                                'UnsupportedVersion you can ignore this '
230
-                                'warning. Detail message: %s'), e)
224
+                LOG.warning('l3-agent cannot check service plugins '
225
+                            'enabled at the neutron server when '
226
+                            'startup due to RPC error. It happens '
227
+                            'when the server does not support this '
228
+                            'RPC API. If the error is '
229
+                            'UnsupportedVersion you can ignore this '
230
+                            'warning. Detail message: %s', e)
231 231
                 self.neutron_service_plugins = None
232 232
             except oslo_messaging.MessagingTimeout as e:
233
-                LOG.warning(_LW('l3-agent cannot contact neutron server '
234
-                                'to retrieve service plugins enabled. '
235
-                                'Check connectivity to neutron server. '
236
-                                'Retrying... '
237
-                                'Detailed message: %(msg)s.'), {'msg': e})
233
+                LOG.warning('l3-agent cannot contact neutron server '
234
+                            'to retrieve service plugins enabled. '
235
+                            'Check connectivity to neutron server. '
236
+                            'Retrying... '
237
+                            'Detailed message: %(msg)s.', {'msg': e})
238 238
                 continue
239 239
             break
240 240
 
@@ -272,15 +272,15 @@ class L3NATAgent(ha.AgentMixin,
272 272
         The actual values are not verified for correctness.
273 273
         """
274 274
         if not self.conf.interface_driver:
275
-            msg = _LE('An interface driver must be specified')
275
+            msg = 'An interface driver must be specified'
276 276
             LOG.error(msg)
277 277
             raise SystemExit(1)
278 278
 
279 279
         if self.conf.ipv6_gateway:
280 280
             # ipv6_gateway configured. Check for valid v6 link-local address.
281 281
             try:
282
-                msg = _LE("%s used in config as ipv6_gateway is not a valid "
283
-                          "IPv6 link-local address."),
282
+                msg = ("%s used in config as ipv6_gateway is not a valid "
283
+                       "IPv6 link-local address.")
284 284
                 ip_addr = netaddr.IPAddress(self.conf.ipv6_gateway)
285 285
                 if ip_addr.version != 6 or not ip_addr.is_link_local():
286 286
                     LOG.error(msg, self.conf.ipv6_gateway)
@@ -361,13 +361,13 @@ class L3NATAgent(ha.AgentMixin,
361 361
         except Exception:
362 362
             with excutils.save_and_reraise_exception():
363 363
                 del self.router_info[router_id]
364
-                LOG.exception(_LE('Error while initializing router %s'),
364
+                LOG.exception('Error while initializing router %s',
365 365
                               router_id)
366 366
                 self.namespaces_manager.ensure_router_cleanup(router_id)
367 367
                 try:
368 368
                     ri.delete()
369 369
                 except Exception:
370
-                    LOG.exception(_LE('Error while deleting router %s'),
370
+                    LOG.exception('Error while deleting router %s',
371 371
                                   router_id)
372 372
 
373 373
     def _safe_router_removed(self, router_id):
@@ -377,7 +377,7 @@ class L3NATAgent(ha.AgentMixin,
377 377
             self._router_removed(router_id)
378 378
             self.l3_ext_manager.delete_router(self.context, router_id)
379 379
         except Exception:
380
-            LOG.exception(_LE('Error while deleting router %s'), router_id)
380
+            LOG.exception('Error while deleting router %s', router_id)
381 381
             return False
382 382
         else:
383 383
             return True
@@ -385,8 +385,8 @@ class L3NATAgent(ha.AgentMixin,
385 385
     def _router_removed(self, router_id):
386 386
         ri = self.router_info.get(router_id)
387 387
         if ri is None:
388
-            LOG.warning(_LW("Info for router %s was not found. "
389
-                            "Performing router cleanup"), router_id)
388
+            LOG.warning("Info for router %s was not found. "
389
+                        "Performing router cleanup", router_id)
390 390
             self.namespaces_manager.ensure_router_cleanup(router_id)
391 391
             return
392 392
 
@@ -451,7 +451,7 @@ class L3NATAgent(ha.AgentMixin,
451 451
     def _process_router_if_compatible(self, router):
452 452
         if (self.conf.external_network_bridge and
453 453
             not ip_lib.device_exists(self.conf.external_network_bridge)):
454
-            LOG.error(_LE("The external network bridge '%s' does not exist"),
454
+            LOG.error("The external network bridge '%s' does not exist",
455 455
                       self.conf.external_network_bridge)
456 456
             return
457 457
 
@@ -513,7 +513,7 @@ class L3NATAgent(ha.AgentMixin,
513 513
                     routers = self.plugin_rpc.get_routers(self.context,
514 514
                                                           [update.id])
515 515
                 except Exception:
516
-                    msg = _LE("Failed to fetch router information for '%s'")
516
+                    msg = "Failed to fetch router information for '%s'"
517 517
                     LOG.exception(msg, update.id)
518 518
                     self._resync_router(update)
519 519
                     continue
@@ -540,12 +540,12 @@ class L3NATAgent(ha.AgentMixin,
540 540
                 log_verbose_exc(e.msg, router)
541 541
                 # Was the router previously handled by this agent?
542 542
                 if router['id'] in self.router_info:
543
-                    LOG.error(_LE("Removing incompatible router '%s'"),
543
+                    LOG.error("Removing incompatible router '%s'",
544 544
                               router['id'])
545 545
                     self._safe_router_removed(router['id'])
546 546
             except Exception:
547 547
                 log_verbose_exc(
548
-                    _LE("Failed to process compatible router: %s") % update.id,
548
+                    "Failed to process compatible router: %s" % update.id,
549 549
                     router)
550 550
                 self._resync_router(update)
551 551
                 continue
@@ -632,20 +632,20 @@ class L3NATAgent(ha.AgentMixin,
632 632
                 self.sync_routers_chunk_size = max(
633 633
                     self.sync_routers_chunk_size / 2,
634 634
                     SYNC_ROUTERS_MIN_CHUNK_SIZE)
635
-                LOG.error(_LE('Server failed to return info for routers in '
636
-                              'required time, decreasing chunk size to: %s'),
635
+                LOG.error('Server failed to return info for routers in '
636
+                          'required time, decreasing chunk size to: %s',
637 637
                           self.sync_routers_chunk_size)
638 638
             else:
639
-                LOG.error(_LE('Server failed to return info for routers in '
640
-                              'required time even with min chunk size: %s. '
641
-                              'It might be under very high load or '
642
-                              'just inoperable'),
639
+                LOG.error('Server failed to return info for routers in '
640
+                          'required time even with min chunk size: %s. '
641
+                          'It might be under very high load or '
642
+                          'just inoperable',
643 643
                           self.sync_routers_chunk_size)
644 644
             raise
645 645
         except oslo_messaging.MessagingException:
646 646
             failed_routers = chunk or router_ids
647
-            LOG.exception(_LE("Failed synchronizing routers '%s' "
648
-                              "due to RPC error"), failed_routers)
647
+            LOG.exception("Failed synchronizing routers '%s' "
648
+                          "due to RPC error", failed_routers)
649 649
             raise n_exc.AbortSyncRouters()
650 650
 
651 651
         self.fullsync = False
@@ -679,7 +679,7 @@ class L3NATAgent(ha.AgentMixin,
679 679
         # can have L3NATAgentWithStateReport as its base class instead of
680 680
         # L3NATAgent.
681 681
         eventlet.spawn_n(self._process_routers_loop)
682
-        LOG.info(_LI("L3 agent started"))
682
+        LOG.info("L3 agent started")
683 683
 
684 684
     def create_pd_router_update(self):
685 685
         router_id = None
@@ -741,22 +741,22 @@ class L3NATAgentWithStateReport(L3NATAgent):
741 741
                                                        self.agent_state,
742 742
                                                        True)
743 743
             if agent_status == l3_constants.AGENT_REVIVED:
744
-                LOG.info(_LI('Agent has just been revived. '
745
-                             'Doing a full sync.'))
744
+                LOG.info('Agent has just been revived. '
745
+                         'Doing a full sync.')
746 746
                 self.fullsync = True
747 747
             self.agent_state.pop('start_flag', None)
748 748
         except AttributeError:
749 749
             # This means the server does not support report_state
750
-            LOG.warning(_LW("Neutron server does not support state report. "
751
-                            "State report for this agent will be disabled."))
750
+            LOG.warning("Neutron server does not support state report. "
751
+                        "State report for this agent will be disabled.")
752 752
             self.heartbeat.stop()
753 753
             return
754 754
         except Exception:
755
-            LOG.exception(_LE("Failed reporting state!"))
755
+            LOG.exception("Failed reporting state!")
756 756
 
757 757
     def after_start(self):
758 758
         eventlet.spawn_n(self._process_routers_loop)
759
-        LOG.info(_LI("L3 agent started"))
759
+        LOG.info("L3 agent started")
760 760
         # Do the report state before we do the first full sync.
761 761
         self._report_state()
762 762
 
@@ -765,4 +765,4 @@ class L3NATAgentWithStateReport(L3NATAgent):
765 765
     def agent_updated(self, context, payload):
766 766
         """Handle the agent_updated notification event."""
767 767
         self.fullsync = True
768
-        LOG.info(_LI("agent_updated by server side %s!"), payload)
768
+        LOG.info("agent_updated by server side %s!", payload)

+ 2
- 3
neutron/agent/l3/dvr_edge_router.py View File

@@ -15,7 +15,6 @@
15 15
 from neutron_lib import constants as lib_constants
16 16
 from oslo_log import log as logging
17 17
 
18
-from neutron._i18n import _LE
19 18
 from neutron.agent.l3 import dvr_local_router
20 19
 from neutron.agent.l3 import dvr_snat_ns
21 20
 from neutron.agent.l3 import router_info as router
@@ -211,8 +210,8 @@ class DvrEdgeRouter(dvr_local_router.DvrLocalRouter):
211 210
                 super(DvrEdgeRouter, self)._update_routing_table(
212 211
                     operation, route, namespace=ns_name)
213 212
             else:
214
-                LOG.error(_LE("The SNAT namespace %s does not exist for "
215
-                              "the router."), ns_name)
213
+                LOG.error("The SNAT namespace %s does not exist for "
214
+                          "the router.", ns_name)
216 215
         super(DvrEdgeRouter, self).update_routing_table(operation, route)
217 216
 
218 217
     def delete(self):

+ 11
- 11
neutron/agent/l3/dvr_fip_ns.py View File

@@ -20,7 +20,7 @@ from oslo_concurrency import lockutils
20 20
 from oslo_log import log as logging
21 21
 from oslo_utils import excutils
22 22
 
23
-from neutron._i18n import _, _LE, _LW
23
+from neutron._i18n import _
24 24
 from neutron.agent.l3 import fip_rule_priority_allocator as frpa
25 25
 from neutron.agent.l3 import link_local_allocator as lla
26 26
 from neutron.agent.l3 import namespaces
@@ -117,8 +117,8 @@ class FipNamespace(namespaces.Namespace):
117 117
                 yield
118 118
             except Exception:
119 119
                 with excutils.save_and_reraise_exception():
120
-                    LOG.error(_LE('DVR: FIP namespace config failure '
121
-                                  'for interface %s'), interface_name)
120
+                    LOG.error('DVR: FIP namespace config failure '
121
+                              'for interface %s', interface_name)
122 122
 
123 123
     def create_or_update_gateway_port(self, agent_gateway_port):
124 124
         interface_name = self.get_ext_device_name(agent_gateway_port['id'])
@@ -147,8 +147,8 @@ class FipNamespace(namespaces.Namespace):
147 147
                     with excutils.save_and_reraise_exception():
148 148
                         self.unsubscribe(agent_gateway_port['network_id'])
149 149
                         self.delete()
150
-                        LOG.exception(_LE('DVR: Gateway update in '
151
-                                          'FIP namespace failed'))
150
+                        LOG.exception('DVR: Gateway update in '
151
+                                      'FIP namespace failed')
152 152
 
153 153
     def _create_gateway_port(self, ex_gw_port, interface_name):
154 154
         """Create namespace, request port creationg from Plugin,
@@ -296,8 +296,8 @@ class FipNamespace(namespaces.Namespace):
296 296
             with excutils.save_and_reraise_exception():
297 297
                 self.unsubscribe(self.agent_gateway_port['network_id'])
298 298
                 self.agent_gateway_port = None
299
-                LOG.exception(_LE('DVR: Gateway setup in FIP namespace '
300
-                                  'failed'))
299
+                LOG.exception('DVR: Gateway setup in FIP namespace '
300
+                              'failed')
301 301
 
302 302
         # Now add the filter match rule for the table.
303 303
         ip_rule = ip_lib.IPRule(namespace=self.get_name())
@@ -328,10 +328,10 @@ class FipNamespace(namespaces.Namespace):
328 328
         # throw exceptions.  Unsubscribe this external network so that
329 329
         # the next call will trigger the interface to be plugged.
330 330
         if not ipd.exists():
331
-            LOG.warning(_LW('DVR: FIP gateway port with interface '
332
-                            'name: %(device)s does not exist in the given '
333
-                            'namespace: %(ns)s'), {'device': interface_name,
334
-                                                   'ns': ns_name})
331
+            LOG.warning('DVR: FIP gateway port with interface '
332
+                        'name: %(device)s does not exist in the given '
333
+                        'namespace: %(ns)s', {'device': interface_name,
334
+                                              'ns': ns_name})
335 335
             msg = _('DVR: Gateway update route in FIP namespace failed, retry '
336 336
                     'should be attempted on next call')
337 337
             raise n_exc.FloatingIpSetupException(msg)

+ 8
- 9
neutron/agent/l3/dvr_local_router.py View File

@@ -22,7 +22,6 @@ from oslo_log import log as logging
22 22
 from oslo_utils import excutils
23 23
 import six
24 24
 
25
-from neutron._i18n import _LE, _LW
26 25
 from neutron.agent.l3 import dvr_fip_ns
27 26
 from neutron.agent.l3 import dvr_router_base
28 27
 from neutron.agent.linux import ip_lib
@@ -239,16 +238,16 @@ class DvrLocalRouter(dvr_router_base.DvrRouterBase):
239 238
                 return True
240 239
             else:
241 240
                 if operation == 'add':
242
-                    LOG.warning(_LW("Device %s does not exist so ARP entry "
243
-                                    "cannot be updated, will cache "
244
-                                    "information to be applied later "
245
-                                    "when the device exists"),
241
+                    LOG.warning("Device %s does not exist so ARP entry "
242
+                                "cannot be updated, will cache "
243
+                                "information to be applied later "
244
+                                "when the device exists",
246 245
                                 device)
247 246
                     self._cache_arp_entry(ip, mac, subnet_id, operation)
248 247
                 return False
249 248
         except Exception:
250 249
             with excutils.save_and_reraise_exception():
251
-                LOG.exception(_LE("DVR: Failed updating arp entry"))
250
+                LOG.exception("DVR: Failed updating arp entry")
252 251
 
253 252
     def _set_subnet_arp_info(self, subnet_id):
254 253
         """Set ARP info retrieved from Plugin for existing ports."""
@@ -356,10 +355,10 @@ class DvrLocalRouter(dvr_router_base.DvrRouterBase):
356 355
                                                priority=snat_idx)
357 356
         except Exception:
358 357
             if is_add:
359
-                exc = _LE('DVR: error adding redirection logic')
358
+                exc = 'DVR: error adding redirection logic'
360 359
             else:
361
-                exc = _LE('DVR: snat remove failed to clear the rule '
362
-                          'and device')
360
+                exc = ('DVR: snat remove failed to clear the rule '
361
+                       'and device')
363 362
             LOG.exception(exc)
364 363
 
365 364
     def _snat_redirect_add(self, gateway, sn_port, sn_int):

+ 5
- 6
neutron/agent/l3/dvr_router_base.py View File

@@ -12,7 +12,6 @@
12 12
 
13 13
 from oslo_log import log as logging
14 14
 
15
-from neutron._i18n import _LE
16 15
 from neutron.agent.l3 import router_info as router
17 16
 from neutron.common import constants as l3_constants
18 17
 
@@ -47,8 +46,8 @@ class DvrRouterBase(router.RouterInfo):
47 46
                 if ip['subnet_id'] in subnet_ids:
48 47
                     return p
49 48
 
50
-        LOG.error(_LE('DVR: SNAT port not found in the list '
51
-                      '%(snat_list)s for the given router '
52
-                      'internal port %(int_p)s'), {
53
-                          'snat_list': snat_ports,
54
-                          'int_p': int_port})
49
+        LOG.error('DVR: SNAT port not found in the list '
50
+                  '%(snat_list)s for the given router '
51
+                  'internal port %(int_p)s', {
52
+                      'snat_list': snat_ports,
53
+                      'int_p': int_port})

+ 3
- 4
neutron/agent/l3/ha.py View File

@@ -20,7 +20,6 @@ from oslo_log import log as logging
20 20
 from oslo_utils import fileutils
21 21
 import webob
22 22
 
23
-from neutron._i18n import _LI
24 23
 from neutron.agent.linux import utils as agent_utils
25 24
 from neutron.common import constants
26 25
 from neutron.notifiers import batch_notifier
@@ -88,8 +87,8 @@ class AgentMixin(object):
88 87
         try:
89 88
             return self.router_info[router_id]
90 89
         except KeyError:
91
-            LOG.info(_LI('Router %s is not managed by this agent. It was '
92
-                         'possibly deleted concurrently.'), router_id)
90
+            LOG.info('Router %s is not managed by this agent. It was '
91
+                     'possibly deleted concurrently.', router_id)
93 92
 
94 93
     def check_ha_state_for_router(self, router_id, current_state):
95 94
         ri = self._get_router_info(router_id)
@@ -110,7 +109,7 @@ class AgentMixin(object):
110 109
         return self.conf.ha_vrrp_advert_int
111 110
 
112 111
     def enqueue_state_change(self, router_id, state):
113
-        LOG.info(_LI('Router %(router_id)s transitioned to %(state)s'),
112
+        LOG.info('Router %(router_id)s transitioned to %(state)s',
114 113
                  {'router_id': router_id,
115 114
                   'state': state})
116 115
 

+ 3
- 4
neutron/agent/l3/ha_router.py View File

@@ -21,7 +21,6 @@ from neutron_lib.api.definitions import portbindings
21 21
 from neutron_lib import constants as n_consts
22 22
 from oslo_log import log as logging
23 23
 
24
-from neutron._i18n import _, _LE
25 24
 from neutron.agent.l3 import namespaces
26 25
 from neutron.agent.l3 import router_info as router
27 26
 from neutron.agent.linux import external_process
@@ -93,7 +92,7 @@ class HaRouter(router.RouterInfo):
93 92
             with open(ha_state_path, 'w') as f:
94 93
                 f.write(new_state)
95 94
         except (OSError, IOError):
96
-            LOG.error(_LE('Error while writing HA state for %s'),
95
+            LOG.error('Error while writing HA state for %s',
97 96
                       self.router_id)
98 97
 
99 98
     @property
@@ -112,8 +111,8 @@ class HaRouter(router.RouterInfo):
112 111
     def initialize(self, process_monitor):
113 112
         ha_port = self.router.get(n_consts.HA_INTERFACE_KEY)
114 113
         if not ha_port:
115
-            msg = _("Unable to process HA router %s without "
116
-                    "HA port") % self.router_id
114
+            msg = ("Unable to process HA router %s without HA port" %
115
+                   self.router_id)
117 116
             LOG.exception(msg)
118 117
             raise Exception(msg)
119 118
         super(HaRouter, self).initialize(process_monitor)

+ 2
- 3
neutron/agent/l3/item_allocator.py View File

@@ -16,7 +16,6 @@ import os
16 16
 
17 17
 from oslo_log import log as logging
18 18
 
19
-from neutron._i18n import _LW
20 19
 
21 20
 LOG = logging.getLogger(__name__)
22 21
 
@@ -55,8 +54,8 @@ class ItemAllocator(object):
55 54
                 self.remembered[key] = self.ItemClass(saved_value)
56 55
             except ValueError:
57 56
                 read_error = True
58
-                LOG.warning(_LW("Invalid line in %(file)s, "
59
-                                "ignoring: %(line)s"),
57
+                LOG.warning("Invalid line in %(file)s, "
58
+                            "ignoring: %(line)s",
60 59
                             {'file': state_file, 'line': line})
61 60
 
62 61
         self.pool.difference_update(self.remembered.values())

+ 3
- 3
neutron/agent/l3/keepalived_state_change.py View File

@@ -21,7 +21,7 @@ import netaddr
21 21
 from oslo_config import cfg
22 22
 from oslo_log import log as logging
23 23
 
24
-from neutron._i18n import _, _LE
24
+from neutron._i18n import _
25 25
 from neutron.agent.l3 import ha
26 26
 from neutron.agent.linux import daemon
27 27
 from neutron.agent.linux import ip_lib
@@ -86,8 +86,8 @@ class MonitorDaemon(daemon.Daemon):
86 86
                 # Remove this code once new keepalived versions are available.
87 87
                 self.send_garp(event)
88 88
         except Exception:
89
-            LOG.exception(_LE(
90
-                'Failed to process or handle event for line %s'), iterable)
89
+            LOG.exception('Failed to process or handle event for line %s',
90
+                          iterable)
91 91
 
92 92
     def write_state_change(self, state):
93 93
         with open(os.path.join(

+ 6
- 7
neutron/agent/l3/l3_agent_extensions_manager.py View File

@@ -15,7 +15,6 @@
15 15
 
16 16
 from oslo_log import log
17 17
 
18
-from neutron._i18n import _LE
19 18
 from neutron.agent import agent_extensions_manager as agent_ext_manager
20 19
 from neutron.conf.agent import agent_extensions_manager as agent_ext_mgr_config
21 20
 
@@ -43,8 +42,8 @@ class L3AgentExtensionsManager(agent_ext_manager.AgentExtensionsManager):
43 42
                 extension.obj.add_router(context, data)
44 43
             else:
45 44
                 LOG.error(
46
-                    _LE("Agent Extension '%(name)s' does not "
47
-                        "implement method add_router"),
45
+                    "Agent Extension '%(name)s' does not "
46
+                    "implement method add_router",
48 47
                     {'name': extension.name}
49 48
                 )
50 49
 
@@ -55,8 +54,8 @@ class L3AgentExtensionsManager(agent_ext_manager.AgentExtensionsManager):
55 54
                 extension.obj.update_router(context, data)
56 55
             else:
57 56
                 LOG.error(
58
-                    _LE("Agent Extension '%(name)s' does not "
59
-                        "implement method update_router"),
57
+                    "Agent Extension '%(name)s' does not "
58
+                    "implement method update_router",
60 59
                     {'name': extension.name}
61 60
                 )
62 61
 
@@ -67,7 +66,7 @@ class L3AgentExtensionsManager(agent_ext_manager.AgentExtensionsManager):
67 66
                 extension.obj.delete_router(context, data)
68 67
             else:
69 68
                 LOG.error(
70
-                    _LE("Agent Extension '%(name)s' does not "
71
-                        "implement method delete_router"),
69
+                    "Agent Extension '%(name)s' does not "
70
+                    "implement method delete_router",
72 71
                     {'name': extension.name}
73 72
                 )

+ 3
- 4
neutron/agent/l3/namespace_manager.py View File

@@ -12,7 +12,6 @@
12 12
 
13 13
 from oslo_log import log as logging
14 14
 
15
-from neutron._i18n import _LE
16 15
 from neutron.agent.l3 import dvr_fip_ns
17 16
 from neutron.agent.l3 import dvr_snat_ns
18 17
 from neutron.agent.l3 import namespaces
@@ -119,8 +118,8 @@ class NamespaceManager(object):
119 118
             namespaces = root_ip.get_namespaces()
120 119
             return set(ns for ns in namespaces if self.is_managed(ns))
121 120
         except RuntimeError:
122
-            LOG.exception(_LE('RuntimeError in obtaining namespace list for '
123
-                              'namespace cleanup.'))
121
+            LOG.exception('RuntimeError in obtaining namespace list for '
122
+                          'namespace cleanup.')
124 123
             return set()
125 124
 
126 125
     def ensure_router_cleanup(self, router_id):
@@ -144,4 +143,4 @@ class NamespaceManager(object):
144 143
                     self.process_monitor, ns_id, self.agent_conf, ns.name)
145 144
             ns.delete()
146 145
         except RuntimeError:
147
-            LOG.exception(_LE('Failed to destroy stale namespace %s'), ns)
146
+            LOG.exception('Failed to destroy stale namespace %s', ns)

+ 3
- 4
neutron/agent/l3/namespaces.py View File

@@ -18,7 +18,6 @@ import functools
18 18
 from oslo_log import log as logging
19 19
 from oslo_utils import excutils
20 20
 
21
-from neutron._i18n import _LE, _LW
22 21
 from neutron.agent.linux import ip_lib
23 22
 
24 23
 LOG = logging.getLogger(__name__)
@@ -65,8 +64,8 @@ def check_ns_existence(f):
65 64
     @functools.wraps(f)
66 65
     def wrapped(self, *args, **kwargs):
67 66
         if not self.exists():
68
-            LOG.warning(_LW('Namespace %(name)s does not exist. Skipping '
69
-                            '%(func)s'),
67
+            LOG.warning('Namespace %(name)s does not exist. Skipping '
68
+                        '%(func)s',
70 69
                         {'name': self.name, 'func': f.__name__})
71 70
             return
72 71
         try:
@@ -111,7 +110,7 @@ class Namespace(object):
111 110
         try:
112 111
             self.ip_wrapper_root.netns.delete(self.name)
113 112
         except RuntimeError:
114
-            msg = _LE('Failed trying to delete namespace: %s')
113
+            msg = 'Failed trying to delete namespace: %s'
115 114
             LOG.exception(msg, self.name)
116 115
 
117 116
     def exists(self):

+ 7
- 7
neutron/agent/l3/router_info.py View File

@@ -19,7 +19,7 @@ from neutron_lib import constants as lib_constants
19 19
 from neutron_lib.utils import helpers
20 20
 from oslo_log import log as logging
21 21
 
22
-from neutron._i18n import _, _LE, _LW
22
+from neutron._i18n import _
23 23
 from neutron.agent.l3 import namespaces
24 24
 from neutron.agent.linux import ip_lib
25 25
 from neutron.agent.linux import iptables_manager
@@ -298,8 +298,8 @@ class RouterInfo(object):
298 298
         except RuntimeError:
299 299
             # any exception occurred here should cause the floating IP
300 300
             # to be set in error state
301
-            LOG.warning(_LW("Unable to configure IP address for "
302
-                            "floating IP: %s"), fip['id'])
301
+            LOG.warning("Unable to configure IP address for "
302
+                        "floating IP: %s", fip['id'])
303 303
 
304 304
     def add_floating_ip(self, fip, interface_name, device):
305 305
         raise NotImplementedError()
@@ -882,7 +882,7 @@ class RouterInfo(object):
882 882
 
883 883
         except n_exc.FloatingIpSetupException:
884 884
             # All floating IPs must be put in error state
885
-            LOG.exception(_LE("Failed to process floating IPs."))
885
+            LOG.exception("Failed to process floating IPs.")
886 886
             fip_statuses = self.put_fips_in_error_state()
887 887
         finally:
888 888
             self.update_fip_statuses(fip_statuses)
@@ -908,7 +908,7 @@ class RouterInfo(object):
908 908
         except (n_exc.FloatingIpSetupException,
909 909
                 n_exc.IpTablesApplyException):
910 910
                 # All floating IPs must be put in error state
911
-                LOG.exception(_LE("Failed to process floating IPs."))
911
+                LOG.exception("Failed to process floating IPs.")
912 912
                 fip_statuses = self.put_fips_in_error_state()
913 913
         finally:
914 914
             self.update_fip_statuses(fip_statuses)
@@ -1102,8 +1102,8 @@ class RouterInfo(object):
1102 1102
             self.agent.pd.sync_router(self.router['id'])
1103 1103
             self._process_external_on_delete()
1104 1104
         else:
1105
-            LOG.warning(_LW("Can't gracefully delete the router %s: "
1106
-                            "no router namespace found."), self.router['id'])
1105
+            LOG.warning("Can't gracefully delete the router %s: "
1106
+                        "no router namespace found.", self.router['id'])
1107 1107
 
1108 1108
     @common_utils.exception_logger()
1109 1109
     def process(self):

+ 6
- 6
neutron/agent/linux/async_process.py View File

@@ -20,7 +20,7 @@ import eventlet.queue
20 20
 from neutron_lib.utils import helpers
21 21
 from oslo_log import log as logging
22 22
 
23
-from neutron._i18n import _, _LE
23
+from neutron._i18n import _
24 24
 from neutron.agent.linux import ip_lib
25 25
 from neutron.agent.linux import utils
26 26
 from neutron.common import utils as common_utils
@@ -182,7 +182,7 @@ class AsyncProcess(object):
182 182
             # root and need to be killed via the same helper.
183 183
             utils.kill_process(pid, kill_signal, self.run_as_root)
184 184
         except Exception:
185
-            LOG.exception(_LE('An error occurred while killing [%s].'),
185
+            LOG.exception('An error occurred while killing [%s].',
186 186
                           self.cmd)
187 187
             return False
188 188
 
@@ -211,8 +211,8 @@ class AsyncProcess(object):
211 211
                 if not output and output != "":
212 212
                     break
213 213
             except Exception:
214
-                LOG.exception(_LE('An error occurred while communicating '
215
-                                  'with async process [%s].'), self.cmd)
214
+                LOG.exception('An error occurred while communicating '
215
+                              'with async process [%s].', self.cmd)
216 216
                 break
217 217
             # Ensure that watching a process with lots of output does
218 218
             # not block execution of other greenthreads.
@@ -242,11 +242,11 @@ class AsyncProcess(object):
242 242
     def _read_stderr(self):
243 243
         data = self._read(self._process.stderr, self._stderr_lines)
244 244
         if self.log_output:
245
-            LOG.error(_LE('Error received from [%(cmd)s]: %(err)s'),
245
+            LOG.error('Error received from [%(cmd)s]: %(err)s',
246 246
                       {'cmd': self.cmd,
247 247
                        'err': data})
248 248
         if self.die_on_error:
249
-            LOG.error(_LE("Process [%(cmd)s] dies due to the error: %(err)s"),
249
+            LOG.error("Process [%(cmd)s] dies due to the error: %(err)s",
250 250
                       {'cmd': self.cmd,
251 251
                        'err': data})
252 252
             # the callback caller will use None to indicate the need to bail

+ 6
- 6
neutron/agent/linux/daemon.py View File

@@ -25,7 +25,7 @@ import sys
25 25
 from debtcollector import removals
26 26
 from oslo_log import log as logging
27 27
 
28
-from neutron._i18n import _, _LE, _LI
28
+from neutron._i18n import _
29 29
 from neutron.common import exceptions
30 30
 
31 31
 LOG = logging.getLogger(__name__)
@@ -113,7 +113,7 @@ def drop_privileges(user=None, group=None):
113 113
     if user is not None:
114 114
         setuid(user)
115 115
 
116
-    LOG.info(_LI("Process runs with uid/gid: %(uid)s/%(gid)s"),
116
+    LOG.info("Process runs with uid/gid: %(uid)s/%(gid)s",
117 117
              {'uid': os.getuid(), 'gid': os.getgid()})
118 118
 
119 119
 
@@ -126,7 +126,7 @@ class Pidfile(object):
126 126
             self.fd = os.open(pidfile, os.O_CREAT | os.O_RDWR)
127 127
             fcntl.flock(self.fd, fcntl.LOCK_EX | fcntl.LOCK_NB)
128 128
         except IOError:
129
-            LOG.exception(_LE("Error while handling pidfile: %s"), pidfile)
129
+            LOG.exception("Error while handling pidfile: %s", pidfile)
130 130
             sys.exit(1)
131 131
 
132 132
     def __str__(self):
@@ -191,7 +191,7 @@ class Daemon(object):
191 191
             if pid > 0:
192 192
                 os._exit(0)
193 193
         except OSError:
194
-            LOG.exception(_LE('Fork failed'))
194
+            LOG.exception('Fork failed')
195 195
             sys.exit(1)
196 196
 
197 197
     def daemonize(self):
@@ -244,8 +244,8 @@ class Daemon(object):
244 244
 
245 245
         if self.pidfile is not None and self.pidfile.is_running():
246 246
             self.pidfile.unlock()
247
-            LOG.error(_LE('Pidfile %s already exist. Daemon already '
248
-                          'running?'), self.pidfile)
247
+            LOG.error('Pidfile %s already exist. Daemon already '
248
+                      'running?', self.pidfile)
249 249
             sys.exit(1)
250 250
 
251 251
         # Start the daemon

+ 20
- 21
neutron/agent/linux/dhcp.py View File

@@ -32,7 +32,7 @@ from oslo_utils import fileutils
32 32
 from oslo_utils import uuidutils
33 33
 import six
34 34
 
35
-from neutron._i18n import _, _LI, _LW, _LE
35
+from neutron._i18n import _
36 36
 from neutron.agent.common import utils as agent_common_utils
37 37
 from neutron.agent.linux import external_process
38 38
 from neutron.agent.linux import ip_lib
@@ -238,7 +238,7 @@ class DhcpLocalProcess(DhcpBase):
238 238
         try:
239 239
             self.device_manager.destroy(self.network, self.interface_name)
240 240
         except RuntimeError:
241
-            LOG.warning(_LW('Failed trying to delete interface: %s'),
241
+            LOG.warning('Failed trying to delete interface: %s',
242 242
                         self.interface_name)
243 243
 
244 244
         ns_ip = ip_lib.IPWrapper(namespace=self.network.namespace)
@@ -248,7 +248,7 @@ class DhcpLocalProcess(DhcpBase):
248 248
         try:
249 249
             ns_ip.netns.delete(self.network.namespace)
250 250
         except RuntimeError:
251
-            LOG.warning(_LW('Failed trying to delete namespace: %s'),
251
+            LOG.warning('Failed trying to delete namespace: %s',
252 252
                         self.network.namespace)
253 253
 
254 254
     def _get_value_from_conf_file(self, kind, converter=None):
@@ -421,8 +421,7 @@ class Dnsmasq(DhcpLocalProcess):
421 421
                 if not os.path.exists(log_dir):
422 422
                     os.makedirs(log_dir)
423 423
             except OSError:
424
-                LOG.error(_LE('Error while create dnsmasq log dir: %s'),
425
-                    log_dir)
424
+                LOG.error('Error while create dnsmasq log dir: %s', log_dir)
426 425
             else:
427 426
                 log_filename = os.path.join(log_dir, 'dhcp_dns_log')
428 427
                 cmd.append('--log-queries')
@@ -460,8 +459,8 @@ class Dnsmasq(DhcpLocalProcess):
460 459
         if self._IS_DHCP_RELEASE6_SUPPORTED is None:
461 460
             self._IS_DHCP_RELEASE6_SUPPORTED = checks.dhcp_release6_supported()
462 461
             if not self._IS_DHCP_RELEASE6_SUPPORTED:
463
-                LOG.warning(_LW("dhcp_release6 is not present on this system, "
464
-                                "will not call it again."))
462
+                LOG.warning("dhcp_release6 is not present on this system, "
463
+                            "will not call it again.")
465 464
         return self._IS_DHCP_RELEASE6_SUPPORTED
466 465
 
467 466
     def _release_lease(self, mac_address, ip, client_id=None,
@@ -483,8 +482,8 @@ class Dnsmasq(DhcpLocalProcess):
483 482
         except RuntimeError as e:
484 483
             # when failed to release single lease there's
485 484
             # no need to propagate error further
486
-            LOG.warning(_LW('DHCP release failed for %(cmd)s. '
487
-                            'Reason: %(e)s'), {'cmd': cmd, 'e': e})
485
+            LOG.warning('DHCP release failed for %(cmd)s. '
486
+                        'Reason: %(e)s', {'cmd': cmd, 'e': e})
488 487
 
489 488
     def _output_config_files(self):
490 489
         self._output_hosts_file()
@@ -798,9 +797,9 @@ class Dnsmasq(DhcpLocalProcess):
798 797
                             server_id = l.strip().split()[1]
799 798
                             continue
800 799
                         else:
801
-                            LOG.warning(_LW('Multiple DUID entries in %s '
802
-                                            'lease file, dnsmasq is possibly '
803
-                                            'not functioning properly'),
800
+                            LOG.warning('Multiple DUID entries in %s '
801
+                                        'lease file, dnsmasq is possibly '
802
+                                        'not functioning properly',
804 803
                                         filename)
805 804
                             continue
806 805
                     parts = l.strip().split()
@@ -969,9 +968,9 @@ class Dnsmasq(DhcpLocalProcess):
969 968
                             self._format_option(opt_ip_version, port.id,
970 969
                                                 opt.opt_name, opt.opt_value))
971 970
                     else:
972
-                        LOG.info(_LI("Cannot apply dhcp option %(opt)s "
973
-                                     "because it's ip_version %(version)d "
974
-                                     "is not in port's address IP versions"),
971
+                        LOG.info("Cannot apply dhcp option %(opt)s "
972
+                                 "because it's ip_version %(version)d "
973
+                                 "is not in port's address IP versions",
975 974
                                  {'opt': opt.opt_name,
976 975
                                   'version': opt_ip_version})
977 976
 
@@ -1269,8 +1268,8 @@ class DeviceManager(object):
1269 1268
                                            'device_id': device_id}})
1270 1269
                 except oslo_messaging.RemoteError as e:
1271 1270
                     if e.exc_type == 'DhcpPortInUse':
1272
-                        LOG.info(_LI("Skipping DHCP port %s as it is "
1273
-                                     "already in use"), port.id)
1271
+                        LOG.info("Skipping DHCP port %s as it is "
1272
+                                 "already in use", port.id)
1274 1273
                         continue
1275 1274
                     raise
1276 1275
                 if port:
@@ -1374,8 +1373,8 @@ class DeviceManager(object):
1374 1373
                 try:
1375 1374
                     self.unplug(d.name, network)
1376 1375
                 except Exception:
1377
-                    LOG.exception(_LE("Exception during stale "
1378
-                                      "dhcp device cleanup"))
1376
+                    LOG.exception("Exception during stale "
1377
+                                  "dhcp device cleanup")
1379 1378
 
1380 1379
     def plug(self, network, port, interface_name):
1381 1380
         """Plug device settings for the network's DHCP on this host."""
@@ -1424,8 +1423,8 @@ class DeviceManager(object):
1424 1423
                 self.plug(network, port, interface_name)
1425 1424
             except Exception:
1426 1425
                 with excutils.save_and_reraise_exception():
1427
-                    LOG.exception(_LE('Unable to plug DHCP port for '
1428
-                                      'network %s. Releasing port.'),
1426
+                    LOG.exception('Unable to plug DHCP port for '
1427
+                                  'network %s. Releasing port.',
1429 1428
                                   network.id)
1430 1429
                     self.plugin.release_dhcp_port(network.id, port.device_id)
1431 1430
 

+ 9
- 9
neutron/agent/linux/external_process.py View File

@@ -24,7 +24,7 @@ from oslo_utils import fileutils
24 24
 import psutil
25 25
 import six
26 26
 
27
-from neutron._i18n import _, _LW, _LE
27
+from neutron._i18n import _
28 28
 from neutron.agent.linux import ip_lib
29 29
 from neutron.agent.linux import utils
30 30
 
@@ -237,9 +237,9 @@ class ProcessMonitor(object):
237 237
             pm = self._monitored_processes.get(service_id)
238 238
 
239 239
             if pm and not pm.active:
240
-                LOG.error(_LE("%(service)s for %(resource_type)s "
241
-                              "with uuid %(uuid)s not found. "
242
-                              "The process should not have died"),
240
+                LOG.error("%(service)s for %(resource_type)s "
241
+                          "with uuid %(uuid)s not found. "
242
+                          "The process should not have died",
243 243
                           {'service': service_id.service,
244 244
                            'resource_type': self._resource_type,
245 245
                            'uuid': service_id.uuid})
@@ -257,14 +257,14 @@ class ProcessMonitor(object):
257 257
         action_function(service_id)
258 258
 
259 259
     def _respawn_action(self, service_id):
260
-        LOG.warning(_LW("Respawning %(service)s for uuid %(uuid)s"),
260
+        LOG.warning("Respawning %(service)s for uuid %(uuid)s",
261 261
                     {'service': service_id.service,
262 262
                      'uuid': service_id.uuid})
263 263
         self._monitored_processes[service_id].enable()
264 264
 
265 265
     def _exit_action(self, service_id):
266
-        LOG.error(_LE("Exiting agent as programmed in check_child_processes_"
267
-                      "actions"))
266
+        LOG.error("Exiting agent as programmed in check_child_processes_"
267
+                  "actions")
268 268
         self._exit_handler(service_id.uuid, service_id.service)
269 269
 
270 270
     def _exit_handler(self, uuid, service):
@@ -274,7 +274,7 @@ class ProcessMonitor(object):
274 274
         check_child_processes_actions, and one of our external processes die
275 275
         unexpectedly.
276 276
         """
277
-        LOG.error(_LE("Exiting agent because of a malfunction with the "
278
-                      "%(service)s process identified by uuid %(uuid)s"),
277
+        LOG.error("Exiting agent because of a malfunction with the "
278
+                  "%(service)s process identified by uuid %(uuid)s",
279 279
                   {'service': service, 'uuid': uuid})
280 280
         raise SystemExit(1)

+ 11
- 11
neutron/agent/linux/interface.py View File

@@ -22,7 +22,7 @@ from oslo_config import cfg
22 22
 from oslo_log import log as logging
23 23
 import six
24 24
 
25
-from neutron._i18n import _, _LE, _LI, _LW
25
+from neutron._i18n import _
26 26
 from neutron.agent.common import ovs_lib
27 27
 from neutron.agent.linux import ip_lib
28 28
 from neutron.agent.linux import utils
@@ -265,12 +265,12 @@ class LinuxInterfaceDriver(object):
265 265
             self.plug_new(network_id, port_id, device_name, mac_address,
266 266
                           bridge, namespace, prefix, mtu)
267 267
         else:
268
-            LOG.info(_LI("Device %s already exists"), device_name)
268
+            LOG.info("Device %s already exists", device_name)
269 269
             if mtu:
270 270
                 self.set_mtu(
271 271
                     device_name, mtu, namespace=namespace, prefix=prefix)
272 272
             else:
273
-                LOG.warning(_LW("No MTU configured for port %s"), port_id)
273
+                LOG.warning("No MTU configured for port %s", port_id)
274 274
 
275 275
     @abc.abstractmethod
276 276
     def unplug(self, device_name, bridge=None, namespace=None, prefix=None):
@@ -296,7 +296,7 @@ class LinuxInterfaceDriver(object):
296 296
     def set_mtu(self, device_name, mtu, namespace=None, prefix=None):
297 297
         """Set MTU on the interface."""
298 298
         if not self._mtu_update_warn_logged:
299
-            LOG.warning(_LW("Interface driver cannot update MTU for ports"))
299
+            LOG.warning("Interface driver cannot update MTU for ports")
300 300
             self._mtu_update_warn_logged = True
301 301
 
302 302
 
@@ -367,7 +367,7 @@ class OVSInterfaceDriver(LinuxInterfaceDriver):
367 367
                 ns_dev.link.set_address(mac_address)
368 368
                 break
369 369
             except RuntimeError as e:
370
-                LOG.warning(_LW("Got error trying to set mac, retrying: %s"),
370
+                LOG.warning("Got error trying to set mac, retrying: %s",
371 371
                             str(e))
372 372
                 time.sleep(1)
373 373
         else:
@@ -386,7 +386,7 @@ class OVSInterfaceDriver(LinuxInterfaceDriver):
386 386
         if mtu:
387 387
             self.set_mtu(device_name, mtu, namespace=namespace, prefix=prefix)
388 388
         else:
389
-            LOG.warning(_LW("No MTU configured for port %s"), port_id)
389
+            LOG.warning("No MTU configured for port %s", port_id)
390 390
 
391 391
         ns_dev.link.set_up()
392 392
         if self.conf.ovs_use_veth:
@@ -408,7 +408,7 @@ class OVSInterfaceDriver(LinuxInterfaceDriver):
408 408
                 device.link.delete()
409 409
                 LOG.debug("Unplugged interface '%s'", device_name)
410 410
         except RuntimeError:
411
-            LOG.error(_LE("Failed unplugging interface '%s'"),
411
+            LOG.error("Failed unplugging interface '%s'",
412 412
                       device_name)
413 413
 
414 414
     def set_mtu(self, device_name, mtu, namespace=None, prefix=None):
@@ -458,7 +458,7 @@ class IVSInterfaceDriver(LinuxInterfaceDriver):
458 458
             ns_dev.link.set_mtu(mtu)
459 459
             root_dev.link.set_mtu(mtu)
460 460
         else:
461
-            LOG.warning(_LW("No MTU configured for port %s"), port_id)
461
+            LOG.warning("No MTU configured for port %s", port_id)
462 462
 
463 463
         if namespace:
464 464
             namespace_obj = ip.ensure_namespace(namespace)
@@ -477,7 +477,7 @@ class IVSInterfaceDriver(LinuxInterfaceDriver):
477 477
             device.link.delete()
478 478
             LOG.debug("Unplugged interface '%s'", device_name)
479 479
         except RuntimeError:
480
-            LOG.error(_LE("Failed unplugging interface '%s'"),
480
+            LOG.error("Failed unplugging interface '%s'",
481 481
                       device_name)
482 482
 
483 483
 
@@ -503,7 +503,7 @@ class BridgeInterfaceDriver(LinuxInterfaceDriver):
503 503
         if mtu:
504 504
             self.set_mtu(device_name, mtu, namespace=namespace, prefix=prefix)
505 505
         else:
506
-            LOG.warning(_LW("No MTU configured for port %s"), port_id)
506
+            LOG.warning("No MTU configured for port %s", port_id)
507 507
 
508 508
         root_veth.link.set_up()
509 509
         ns_veth.link.set_up()
@@ -515,7 +515,7 @@ class BridgeInterfaceDriver(LinuxInterfaceDriver):
515 515
             device.link.delete()
516 516
             LOG.debug("Unplugged interface '%s'", device_name)
517 517
         except RuntimeError:
518
-            LOG.error(_LE("Failed unplugging interface '%s'"),
518
+            LOG.error("Failed unplugging interface '%s'",
519 519
                       device_name)
520 520
 
521 521
     def set_mtu(self, device_name, mtu, namespace=None, prefix=None):

+ 1
- 3
neutron/agent/linux/ip_conntrack.py View File

@@ -17,7 +17,6 @@ import netaddr
17 17
 from oslo_concurrency import lockutils
18 18
 from oslo_log import log as logging
19 19
 
20
-from neutron._i18n import _LE
21 20
 from neutron.agent.linux import utils as linux_utils
22 21
 from neutron.common import constants as n_const
23 22
 from neutron.common import exceptions as n_exc
@@ -107,8 +106,7 @@ class IpConntrackManager(object):
107 106
                              check_exit_code=True,
108 107
                              extra_ok_codes=[1])
109 108
             except RuntimeError:
110
-                LOG.exception(
111
-                    _LE("Failed execute conntrack command %s"), cmd)
109
+                LOG.exception("Failed execute conntrack command %s", cmd)
112 110
 
113 111
     def delete_conntrack_state_by_rule(self, device_info_list, rule):
114 112
         self._delete_conntrack_state(device_info_list, rule)

+ 13
- 13
neutron/agent/linux/ip_lib.py View File

@@ -27,7 +27,7 @@ from oslo_log import log as logging
27 27
 from oslo_utils import excutils
28 28
 import six
29 29
 
30
-from neutron._i18n import _, _LE, _LW
30
+from neutron._i18n import _
31 31
 from neutron.agent.common import utils
32 32
 from neutron.common import exceptions as n_exc
33 33
 from neutron.common import utils as common_utils
@@ -326,8 +326,8 @@ class IPDevice(SubProcessBase):
326 326
                                      extra_ok_codes=[1])
327 327
 
328 328
         except RuntimeError:
329
-            LOG.exception(_LE("Failed deleting ingress connection state of"
330
-                              " floatingip %s"), ip_str)
329
+            LOG.exception("Failed deleting ingress connection state of"
330
+                          " floatingip %s", ip_str)
331 331
 
332 332
         # Delete conntrack state for egress traffic
333 333
         try:
@@ -335,8 +335,8 @@ class IPDevice(SubProcessBase):
335 335
                                      check_exit_code=True,
336 336
                                      extra_ok_codes=[1])
337 337
         except RuntimeError:
338
-            LOG.exception(_LE("Failed deleting egress connection state of"
339
-                              " floatingip %s"), ip_str)
338
+            LOG.exception("Failed deleting egress connection state of"
339
+                          " floatingip %s", ip_str)
340 340
 
341 341
     def disable_ipv6(self):
342 342
         sysctl_name = re.sub(r'\.', '/', self.name)
@@ -1100,8 +1100,8 @@ def _arping(ns_name, iface_name, address, count, log_exception):
1100 1100
                                     'ns': ns_name,
1101 1101
                                     'err': exc})
1102 1102
                 if not exists:
1103
-                    LOG.warning(_LW("Interface %s might have been deleted "
1104
-                                    "concurrently"), iface_name)
1103
+                    LOG.warning("Interface %s might have been deleted "
1104
+                                "concurrently", iface_name)
1105 1105
                     return
1106 1106
 
1107 1107
 
@@ -1160,7 +1160,7 @@ def sysctl(cmd, namespace=None, log_fail_as_error=True):
1160 1160
                                  log_fail_as_error=log_fail_as_error)
1161 1161
     except RuntimeError as rte:
1162 1162
         LOG.warning(
1163
-            _LW("Setting %(cmd)s in namespace %(ns)s failed: %(err)s."),
1163
+            "Setting %(cmd)s in namespace %(ns)s failed: %(err)s.",
1164 1164
             {'cmd': cmd,
1165 1165
              'ns': namespace,
1166 1166
              'err': rte})
@@ -1207,9 +1207,9 @@ def set_ip_nonlocal_bind_for_namespace(namespace):
1207 1207
                                   log_fail_as_error=False)
1208 1208
     if failed:
1209 1209
         LOG.warning(
1210
-            _LW("%s will not be set to 0 in the root namespace in order to "
1211
-                "not break DVR, which requires this value be set to 1. This "
1212
-                "may introduce a race between moving a floating IP to a "
1213
-                "different network node, and the peer side getting a "
1214
-                "populated ARP cache for a given floating IP address."),
1210
+            "%s will not be set to 0 in the root namespace in order to "
1211
+            "not break DVR, which requires this value be set to 1. This "
1212
+            "may introduce a race between moving a floating IP to a "
1213
+            "different network node, and the peer side getting a "
1214
+            "populated ARP cache for a given floating IP address.",
1215 1215
             IP_NONLOCAL_BIND)

+ 2
- 2
neutron/agent/linux/ip_link_support.py View File

@@ -18,7 +18,7 @@ import re
18 18
 from neutron_lib import exceptions as n_exc
19 19
 from oslo_log import log as logging
20 20
 
21
-from neutron._i18n import _, _LE
21
+from neutron._i18n import _
22 22
 from neutron.agent.linux import utils
23 23
 
24 24
 
@@ -103,6 +103,6 @@ class IpLinkSupport(object):
103 103
                 return_stderr=True,
104 104
                 log_fail_as_error=False)
105 105
         except Exception as e:
106
-            LOG.exception(_LE("Failed executing ip command"))
106
+            LOG.exception("Failed executing ip command")
107 107
             raise UnsupportedIpLinkCommand(reason=e)
108 108
         return _stdout or _stderr

+ 2
- 3
neutron/agent/linux/ip_monitor.py View File

@@ -16,7 +16,6 @@
16 16
 from oslo_log import log as logging
17 17
 from oslo_utils import excutils
18 18
 
19
-from neutron._i18n import _LE
20 19
 from neutron.agent.linux import async_process
21 20
 from neutron.agent.linux import ip_lib
22 21
 
@@ -41,7 +40,7 @@ class IPMonitorEvent(object):
41 40
             first_word = route[0]
42 41
         except IndexError:
43 42
             with excutils.save_and_reraise_exception():
44
-                LOG.error(_LE('Unable to parse route "%s"'), line)
43
+                LOG.error('Unable to parse route "%s"', line)
45 44
 
46 45
         added = (first_word != 'Deleted')
47 46
         if not added:
@@ -52,7 +51,7 @@ class IPMonitorEvent(object):
52 51
             cidr = route[3]
53 52
         except IndexError:
54 53
             with excutils.save_and_reraise_exception():
55
-                LOG.error(_LE('Unable to parse route "%s"'), line)
54
+                LOG.error('Unable to parse route "%s"', line)
56 55
 
57 56
         return cls(line, added, interface, cidr)
58 57
 

+ 4
- 5
neutron/agent/linux/iptables_firewall.py View File

@@ -21,7 +21,6 @@ from oslo_config import cfg
21 21
 from oslo_log import log as logging
22 22
 from oslo_utils import netutils
23 23
 
24
-from neutron._i18n import _LI
25 24
 from neutron.agent import firewall
26 25
 from neutron.agent.linux import ip_conntrack
27 26
 from neutron.agent.linux import ipset_manager
@@ -160,8 +159,8 @@ class IptablesFirewallDriver(firewall.FirewallDriver):
160 159
     def update_port_filter(self, port):
161 160
         LOG.debug("Updating device (%s) filter", port['device'])
162 161
         if port['device'] not in self.ports:
163
-            LOG.info(_LI('Attempted to update port filter which is not '
164
-                         'filtered %s'), port['device'])
162
+            LOG.info('Attempted to update port filter which is not '
163
+                     'filtered %s', port['device'])
165 164
             return
166 165
         self._remove_chains()
167 166
         self._set_ports(port)
@@ -171,8 +170,8 @@ class IptablesFirewallDriver(firewall.FirewallDriver):
171 170
     def remove_port_filter(self, port):
172 171
         LOG.debug("Removing device (%s) filter", port['device'])
173 172
         if port['device'] not in self.ports:
174
-            LOG.info(_LI('Attempted to remove port filter which is not '
175
-                         'filtered %r'), port)
173
+            LOG.info('Attempted to remove port filter which is not '
174
+                     'filtered %r', port)
176 175
             return
177 176
         self._remove_chains()
178 177
         self._remove_conntrack_entries_from_port_deleted(port)

+ 10
- 10
neutron/agent/linux/iptables_manager.py View File

@@ -30,7 +30,7 @@ from oslo_config import cfg
30 30
 from oslo_log import log as logging
31 31
 from oslo_utils import excutils
32 32
 
33
-from neutron._i18n import _, _LE, _LW
33
+from neutron._i18n import _
34 34
 from neutron.agent.linux import ip_lib
35 35
 from neutron.agent.linux import iptables_comments as ic
36 36
 from neutron.agent.linux import utils as linux_utils
@@ -247,8 +247,8 @@ class IptablesTable(object):
247 247
                                                           top, self.wrap_name,
248 248
                                                           comment=comment)))
249 249
         except ValueError:
250
-            LOG.warning(_LW('Tried to remove rule that was not there:'
251
-                            ' %(chain)r %(rule)r %(wrap)r %(top)r'),
250
+            LOG.warning('Tried to remove rule that was not there:'
251
+                        ' %(chain)r %(rule)r %(wrap)r %(top)r',
252 252
                         {'chain': chain, 'rule': rule,
253 253
                          'top': top, 'wrap': wrap})
254 254
 
@@ -533,8 +533,8 @@ class IptablesManager(object):
533 533
                                      commands[log_start:log_end],
534 534
                                      log_start + 1)
535 535
                                  )
536
-                    LOG.error(_LE("IPTablesManager.apply failed to apply the "
537
-                                  "following set of iptables rules:\n%s"),
536
+                    LOG.error("IPTablesManager.apply failed to apply the "
537
+                              "following set of iptables rules:\n%s",
538 538
                               '\n'.join(log_lines))
539 539
         LOG.debug("IPTablesManager.apply completed with success. %d iptables "
540 540
                   "commands were issued", len(all_commands))
@@ -636,9 +636,9 @@ class IptablesManager(object):
636 636
         def _weed_out_duplicates(line):
637 637
             if line in seen_lines:
638 638
                 thing = 'chain' if line.startswith(':') else 'rule'
639
-                LOG.warning(_LW("Duplicate iptables %(thing)s detected. This "
640
-                                "may indicate a bug in the iptables "
641
-                                "%(thing)s generation code. Line: %(line)s"),
639
+                LOG.warning("Duplicate iptables %(thing)s detected. This "
640
+                            "may indicate a bug in the iptables "
641
+                            "%(thing)s generation code. Line: %(line)s",
642 642
                             {'thing': thing, 'line': line})
643 643
                 return False
644 644
             seen_lines.add(line)
@@ -675,8 +675,8 @@ class IptablesManager(object):
675 675
         """Return the sum of the traffic counters of all rules of a chain."""
676 676
         cmd_tables = self._get_traffic_counters_cmd_tables(chain, wrap)
677 677
         if not cmd_tables:
678
-            LOG.warning(_LW('Attempted to get traffic counters of chain %s '
679
-                            'which does not exist'), chain)
678
+            LOG.warning('Attempted to get traffic counters of chain %s '
679
+                        'which does not exist', chain)
680 680
             return
681 681
 
682 682
         name = get_chain_name(chain, wrap)

+ 3
- 3
neutron/agent/linux/keepalived.py View File

@@ -23,7 +23,7 @@ from oslo_config import cfg
23 23
 from oslo_log import log as logging
24 24
 from oslo_utils import fileutils
25 25
 
26
-from neutron._i18n import _, _LE
26
+from neutron._i18n import _
27 27
 from neutron.agent.linux import external_process
28 28
 from neutron.common import constants
29 29
 from neutron.common import utils
@@ -406,8 +406,8 @@ class KeepalivedManager(object):
406 406
             os.remove(pid_file)
407 407
         except OSError as e:
408 408
             if e.errno != errno.ENOENT:
409
-                LOG.error(_LE("Could not delete file %s, keepalived can "
410
-                              "refuse to start."), pid_file)
409
+                LOG.error("Could not delete file %s, keepalived can "
410
+                          "refuse to start.", pid_file)
411 411
 
412 412
     def get_vrrp_pid_file_name(self, base_pid_file):
413 413
         return '%s-vrrp' % base_pid_file

+ 2
- 3
neutron/agent/linux/openvswitch_firewall/firewall.py View File

@@ -20,7 +20,6 @@ from neutron_lib import constants as lib_const
20 20
 from oslo_log import log as logging
21 21
 from oslo_utils import netutils
22 22
 
23
-from neutron._i18n import _LE
24 23
 from neutron.agent import firewall
25 24
 from neutron.agent.linux.openvswitch_firewall import constants as ovsfw_consts
26 25
 from neutron.agent.linux.openvswitch_firewall import exceptions
@@ -463,8 +462,8 @@ class OVSFirewallDriver(firewall.FirewallDriver):
463 462
         # allow_address_pair MACs will be updated in
464 463
         # self.get_or_create_ofport(port)
465 464
         if old_of_port:
466
-            LOG.error(_LE("Initializing port %s that was already "
467
-                          "initialized."),
465
+            LOG.error("Initializing port %s that was already "
466
+                      "initialized.",
468 467
                       port['device'])
469 468
             self.delete_all_port_flows(old_of_port)
470 469
         of_port = self.get_or_create_ofport(port)

+ 1
- 2
neutron/agent/linux/ovsdb_monitor.py View File

@@ -15,7 +15,6 @@
15 15
 from oslo_log import log as logging
16 16
 from oslo_serialization import jsonutils
17 17
 
18
-from neutron._i18n import _LE
19 18
 from neutron.agent.linux import async_process
20 19
 from neutron.agent.ovsdb import api as ovsdb
21 20
 from neutron.agent.ovsdb.native import helpers
@@ -81,7 +80,7 @@ class SimpleInterfaceMonitor(OvsdbMonitor):
81 80
         temporary if respawn_interval is set.
82 81
         """
83 82
         if not self.is_active():
84
-            LOG.error(_LE("Interface monitor is not active"))
83
+            LOG.error("Interface monitor is not active")
85 84
         else:
86 85
             self.process_events()
87 86
         return bool(self.new_events['added'] or self.new_events['removed'])

+ 3
- 3
neutron/agent/linux/pd.py View File

@@ -27,7 +27,7 @@ from oslo_utils import netutils
27 27
 import six
28 28
 from stevedore import driver
29 29
 
30
-from neutron._i18n import _, _LE
30
+from neutron._i18n import _
31 31
 from neutron.common import constants as l3_constants
32 32
 from neutron.common import utils
33 33
 
@@ -392,8 +392,8 @@ def update_router(resource, event, l3_agent, **kwargs):
392 392
     updated_router = kwargs['router']
393 393
     router = l3_agent.pd.routers.get(updated_router.router_id)
394 394
     if not router:
395
-        LOG.exception(_LE("Router to be updated is not in internal routers "
396
-                          "list: %s"), updated_router.router_id)
395
+        LOG.exception("Router to be updated is not in internal routers "
396
+                      "list: %s", updated_router.router_id)
397 397
     else:
398 398
         router['ns_name'] = updated_router.get_gw_ns_name()
399 399
 

+ 3
- 3
neutron/agent/linux/utils.py View File

@@ -33,7 +33,7 @@ from oslo_utils import excutils
33 33
 from oslo_utils import fileutils
34 34
 from six.moves import http_client as httplib
35 35
 
36
-from neutron._i18n import _, _LE
36
+from neutron._i18n import _
37 37
 from neutron.agent.linux import xenapi_root_helper
38 38
 from neutron.common import utils
39 39
 from neutron.conf.agent import common as config
@@ -111,7 +111,7 @@ def execute_rootwrap_daemon(cmd, process_input, addl_env):
111 111
         return client.execute(cmd, process_input)
112 112
     except Exception:
113 113
         with excutils.save_and_reraise_exception():
114
-            LOG.error(_LE("Rootwrap error running command: %s"), cmd)
114
+            LOG.error("Rootwrap error running command: %s", cmd)
115 115
 
116 116
 
117 117
 def execute(cmd, process_input=None, addl_env=None,
@@ -249,7 +249,7 @@ def get_value_from_file(filename, converter=None):
249 249
             try:
250 250
                 return converter(f.read()) if converter else f.read()
251 251
             except ValueError:
252
-                LOG.error(_LE('Unable to convert value in %s'), filename)
252
+                LOG.error('Unable to convert value in %s', filename)
253 253
     except IOError:
254 254
         LOG.debug('Unable to access %s', filename)
255 255
 

+ 1
- 2
neutron/agent/linux/xenapi_root_helper.py View File

@@ -29,7 +29,6 @@ from oslo_log import log as logging
29 29
 from oslo_rootwrap import cmd as oslo_rootwrap_cmd
30 30
 from oslo_serialization import jsonutils
31 31
 
32
-from neutron._i18n import _LE
33 32
 from neutron.conf.agent import xenapi_conf
34 33
 
35 34
 
@@ -88,6 +87,6 @@ class XenAPIClient(object):
88 87
             err = result['err']
89 88
             return returncode, out, err
90 89
         except XenAPI.Failure as failure:
91
-            LOG.exception(_LE('Failed to execute command: %s'), cmd)
90
+            LOG.exception('Failed to execute command: %s', cmd)
92 91
             returncode = self._get_return_code(failure.details)
93 92
             return returncode, out, err

+ 7
- 7
neutron/agent/metadata/agent.py View File

@@ -27,7 +27,7 @@ import six
27 27
 import six.moves.urllib.parse as urlparse
28 28
 import webob
29 29
 
30
-from neutron._i18n import _, _LE, _LW
30
+from neutron._i18n import _
31 31
 from neutron.agent.linux import utils as agent_utils
32 32
 from neutron.agent import rpc as agent_rpc
33 33
 from neutron.common import cache_utils as cache
@@ -92,7 +92,7 @@ class MetadataProxyHandler(object):
92 92
                 return webob.exc.HTTPNotFound()
93 93
 
94 94
         except Exception:
95
-            LOG.exception(_LE("Unexpected error."))
95
+            LOG.exception("Unexpected error.")
96 96
             msg = _('An unknown error has occurred. '
97 97
                     'Please try your request again.')
98 98
             explanation = six.text_type(msg)
@@ -198,10 +198,10 @@ class MetadataProxyHandler(object):
198 198
             LOG.debug(str(resp))
199 199
             return req.response
200 200
         elif resp.status == 403:
201
-            LOG.warning(_LW(
201
+            LOG.warning(
202 202
                 'The remote metadata server responded with Forbidden. This '
203 203
                 'response usually occurs when shared secrets do not match.'
204
-            ))
204
+            )
205 205
             return webob.exc.HTTPForbidden()
206 206
         elif resp.status == 400:
207 207
             return webob.exc.HTTPBadRequest()
@@ -262,12 +262,12 @@ class UnixDomainMetadataProxy(object):
262 262
                 use_call=self.agent_state.get('start_flag'))
263 263
         except AttributeError:
264 264
             # This means the server does not support report_state
265
-            LOG.warning(_LW('Neutron server does not support state report.'
266
-                            ' State report for this agent will be disabled.'))
265
+            LOG.warning('Neutron server does not support state report.'
266
+                        ' State report for this agent will be disabled.')
267 267
             self.heartbeat.stop()
268 268
             return
269 269
         except Exception:
270
-            LOG.exception(_LE("Failed reporting state!"))
270
+            LOG.exception("Failed reporting state!")
271 271
             return
272 272
         self.agent_state.pop('start_flag', None)
273 273
 

+ 4
- 5
neutron/agent/ovsdb/impl_vsctl.py View File

@@ -22,7 +22,6 @@ from oslo_utils import excutils
22 22
 from oslo_utils import uuidutils
23 23
 import six
24 24
 
25
-from neutron._i18n import _LE
26 25
 from neutron.agent.common import utils
27 26
 from neutron.agent.ovsdb import api as ovsdb
28 27
 
@@ -70,8 +69,8 @@ class Transaction(ovsdb.Transaction):
70 69
         except Exception as e:
71 70
             with excutils.save_and_reraise_exception() as ctxt:
72 71
                 if self.log_errors:
73
-                    LOG.error(_LE("Unable to execute %(cmd)s. "
74
-                                  "Exception: %(exception)s"),
72
+                    LOG.error("Unable to execute %(cmd)s. "
73
+                              "Exception: %(exception)s",
75 74
                               {'cmd': full_args, 'exception': e})
76 75
                 if not self.check_error:
77 76
                     ctxt.reraise = False
@@ -130,8 +129,8 @@ class DbCommand(BaseCommand):
130 129
             # This shouldn't happen, but if it does and we check_errors
131 130
             # log and raise.
132 131
             with excutils.save_and_reraise_exception():
133
-                LOG.error(_LE("Could not parse: %(raw_result)s. "
134
-                              "Exception: %(exception)s"),
132
+                LOG.error("Could not parse: %(raw_result)s. "
133
+                          "Exception: %(exception)s",
135 134
                           {'raw_result': raw_result, 'exception': e})
136 135
 
137 136
         headings = json['headings']

+ 17
- 18
neutron/agent/securitygroups_rpc.py View File

@@ -21,7 +21,6 @@ from oslo_config import cfg
21 21
 from oslo_log import log as logging
22 22
 import oslo_messaging
23 23
 
24
-from neutron._i18n import _LI, _LW
25 24
 from neutron.agent import firewall
26 25
 from neutron.api.rpc.handlers import securitygroups_rpc
27 26
 from neutron.conf.agent import securitygroups_rpc as sc_cfg
@@ -44,9 +43,9 @@ def _disable_extension(extension, aliases):
44 43
 
45 44
 def disable_security_group_extension_by_config(aliases):
46 45
     if not is_firewall_enabled():
47
-        LOG.info(_LI('Disabled security-group extension.'))
46
+        LOG.info('Disabled security-group extension.')
48 47
         _disable_extension('security-group', aliases)
49
-        LOG.info(_LI('Disabled allowed-address-pairs extension.'))
48
+        LOG.info('Disabled allowed-address-pairs extension.')
50 49
         _disable_extension('allowed-address-pairs', aliases)
51 50
 
52 51
 
@@ -91,10 +90,10 @@ class SecurityGroupAgentRpc(object):
91 90
             self.plugin_rpc.security_group_info_for_devices(
92 91
                 self.context, devices=[])
93 92
         except oslo_messaging.UnsupportedVersion:
94
-            LOG.warning(_LW('security_group_info_for_devices rpc call not '
95
-                            'supported by the server, falling back to old '
96
-                            'security_group_rules_for_devices which scales '
97
-                            'worse.'))
93
+            LOG.warning('security_group_info_for_devices rpc call not '
94
+                        'supported by the server, falling back to old '
95
+                        'security_group_rules_for_devices which scales '
96
+                        'worse.')
98 97
             return False
99 98
         return True
100 99
 
@@ -103,8 +102,8 @@ class SecurityGroupAgentRpc(object):
103 102
         def decorated_function(self, *args, **kwargs):
104 103
             if (isinstance(self.firewall, firewall.NoopFirewallDriver) or
105 104
                 not is_firewall_enabled()):
106
-                LOG.info(_LI("Skipping method %s as firewall is disabled "
107
-                         "or configured as NoopFirewallDriver."),
105
+                LOG.info("Skipping method %s as firewall is disabled "
106
+                         "or configured as NoopFirewallDriver.",
108 107
                          func.__name__)
109 108
             else:
110 109
                 return func(self,  # pylint: disable=not-callable
@@ -115,7 +114,7 @@ class SecurityGroupAgentRpc(object):
115 114
     def prepare_devices_filter(self, device_ids):
116 115
         if not device_ids:
117 116
             return
118
-        LOG.info(_LI("Preparing filters for devices %s"), device_ids)
117
+        LOG.info("Preparing filters for devices %s", device_ids)
119 118
         self._apply_port_filter(device_ids)
120 119
 
121 120
     def _apply_port_filter(self, device_ids, update_filter=False):
@@ -155,16 +154,16 @@ class SecurityGroupAgentRpc(object):
155 154
                 remote_sg_id, member_ips)
156 155
 
157 156
     def security_groups_rule_updated(self, security_groups):
158
-        LOG.info(_LI("Security group "
159
-                 "rule updated %r"), security_groups)
157
+        LOG.info("Security group "
158
+                 "rule updated %r", security_groups)
160 159
         self._security_group_updated(
161 160
             security_groups,
162 161
             'security_groups',
163 162
             'sg_rule')
164 163
 
165 164
     def security_groups_member_updated(self, security_groups):
166
-        LOG.info(_LI("Security group "
167
-                 "member updated %r"), security_groups)
165
+        LOG.info("Security group "
166
+                 "member updated %r", security_groups)
168 167
         self._security_group_updated(
169 168
             security_groups,
170 169
             'security_group_source_groups',
@@ -188,7 +187,7 @@ class SecurityGroupAgentRpc(object):
188 187
                 self.refresh_firewall(devices)
189 188
 
190 189
     def security_groups_provider_updated(self, port_ids_to_update):
191
-        LOG.info(_LI("Provider rule updated"))
190
+        LOG.info("Provider rule updated")
192 191
         if port_ids_to_update is None:
193 192
             # Update all devices
194 193
             if self.defer_refresh_firewall:
@@ -211,7 +210,7 @@ class SecurityGroupAgentRpc(object):
211 210
     def remove_devices_filter(self, device_ids):
212 211
         if not device_ids:
213 212
             return
214
-        LOG.info(_LI("Remove device filter for %r"), device_ids)
213
+        LOG.info("Remove device filter for %r", device_ids)
215 214
         with self.firewall.defer_apply():
216 215
             for device_id in device_ids:
217 216
                 device = self.firewall.ports.get(device_id)
@@ -222,11 +221,11 @@ class SecurityGroupAgentRpc(object):
222 221
 
223 222
     @skip_if_noopfirewall_or_firewall_disabled
224 223
     def refresh_firewall(self, device_ids=None):
225
-        LOG.info(_LI("Refresh firewall rules"))
224
+        LOG.info("Refresh firewall rules")
226 225
         if not device_ids:
227 226
             device_ids = self.firewall.ports.keys()
228 227
             if not device_ids:
229
-                LOG.info(_LI("No ports here to refresh firewall"))
228
+                LOG.info("No ports here to refresh firewall")
230 229
                 return
231 230
         self._apply_port_filter(device_ids, update_filter=True)
232 231
 

+ 3
- 5
neutron/agent/windows/ip_lib.py View File

@@ -17,8 +17,6 @@ import netifaces
17 17
 
18 18
 from oslo_log import log as logging
19 19
 
20
-from neutron._i18n import _LE
21
-
22 20
 LOG = logging.getLogger(__name__)
23 21
 
24 22
 OPTS = []
@@ -38,7 +36,7 @@ class IPWrapper(object):
38 36
         try:
39 37
             return [IPDevice(iface) for iface in netifaces.interfaces()]
40 38
         except (OSError, MemoryError):
41
-            LOG.error(_LE("Failed to get network interfaces."))
39
+            LOG.error("Failed to get network interfaces.")
42 40
             return []
43 41
 
44 42
 
@@ -52,11 +50,11 @@ class IPDevice(object):
52 50
         try:
53 51
             device_addresses = netifaces.ifaddresses(self.name)
54 52
         except ValueError:
55
-            LOG.error(_LE("The device does not exist on the system: %s."),
53
+            LOG.error("The device does not exist on the system: %s.",
56 54
                       self.name)
57 55
             return
58 56
         except OSError:
59
-            LOG.error(_LE("Failed to get interface addresses: %s."),
57
+            LOG.error("Failed to get interface addresses: %s.",
60 58
                       self.name)
61 59
             return
62 60
         return device_addresses

+ 3
- 3
neutron/api/api_common.py View File

@@ -24,7 +24,7 @@ from oslo_serialization import jsonutils
24 24
 from six.moves.urllib import parse
25 25
 from webob import exc
26 26
 
27
-from neutron._i18n import _, _LW
27
+from neutron._i18n import _
28 28
 from neutron.api import extensions
29 29
 from neutron.common import constants
30 30
 from neutron import wsgi
@@ -153,8 +153,8 @@ def _get_pagination_max_limit():
153 153
             if max_limit == 0:
154 154
                 raise ValueError()
155 155
         except ValueError:
156
-            LOG.warning(_LW("Invalid value for pagination_max_limit: %s. It "
157
-                            "should be an integer greater to 0"),
156
+            LOG.warning("Invalid value for pagination_max_limit: %s. It "
157
+                        "should be an integer greater to 0",
158 158
                         cfg.CONF.pagination_max_limit)
159 159
     return max_limit
160 160
 

+ 17
- 18
neutron/api/extensions.py View File

@@ -26,7 +26,7 @@ import routes
26 26
 import webob.dec
27 27
 import webob.exc
28 28
 
29
-from neutron._i18n import _, _LE, _LI, _LW
29
+from neutron._i18n import _
30 30
 from neutron.common import exceptions
31 31
 from neutron import extensions as core_extensions
32 32
 from neutron.plugins.common import constants as const
@@ -283,7 +283,7 @@ class ExtensionManager(object):
283 283
     """
284 284
 
285 285
     def __init__(self, path):
286
-        LOG.info(_LI('Initializing extension manager.'))
286
+        LOG.info('Initializing extension manager.')
287 287
         self.path = path
288 288
         self.extensions = {}
289 289
         self._load_all_extensions()
@@ -359,10 +359,10 @@ class ExtensionManager(object):
359 359
                 break
360 360
         if exts_to_process:
361 361
             unloadable_extensions = set(exts_to_process.keys())
362
-            LOG.error(_LE("Unable to process extensions (%s) because "
363
-                          "the configured plugins do not satisfy "
364
-                          "their requirements. Some features will not "
365
-                          "work as expected."),
362
+            LOG.error("Unable to process extensions (%s) because "
363
+                      "the configured plugins do not satisfy "
364
+                      "their requirements. Some features will not "
365
+                      "work as expected.",
366 366
                       ', '.join(unloadable_extensions))
367 367
             self._check_faulty_extensions(unloadable_extensions)
368 368
         # Extending extensions' attributes map.
@@ -398,7 +398,7 @@ class ExtensionManager(object):
398 398
                        'desc': extension.get_description(),
399 399
                        'updated': extension.get_updated()})
400 400
         except AttributeError:
401
-            LOG.exception(_LE("Exception loading extension"))
401
+            LOG.exception("Exception loading extension")
402 402
             return False
403 403
         return isinstance(extension, api_extensions.ExtensionDescriptor)
404 404
 
@@ -417,7 +417,7 @@ class ExtensionManager(object):
417 417
             if os.path.exists(path):
418 418
                 self._load_all_extensions_from_path(path)
419 419
             else:
420
-                LOG.error(_LE("Extension path '%s' doesn't exist!"), path)
420
+                LOG.error("Extension path '%s' doesn't exist!", path)
421 421
 
422 422
     def _load_all_extensions_from_path(self, path):
423 423
         # Sorting the extension list makes the order in which they
@@ -433,16 +433,16 @@ class ExtensionManager(object):
433 433
                     ext_name = mod_name.capitalize()
434 434
                     new_ext_class = getattr(mod, ext_name, None)
435 435
                     if not new_ext_class:
436
-                        LOG.warning(_LW('Did not find expected name '
437
-                                        '"%(ext_name)s" in %(file)s'),
436
+                        LOG.warning('Did not find expected name '
437
+                                    '"%(ext_name)s" in %(file)s',
438 438
                                     {'ext_name': ext_name,
439 439
                                      'file': ext_path})
440 440
                         continue
441 441
                     new_ext = new_ext_class()
442 442
                     self.add_extension(new_ext)
443 443
             except Exception as exception:
444
-                LOG.warning(_LW("Extension file %(f)s wasn't loaded due to "
445
-                                "%(exception)s"),
444
+                LOG.warning("Extension file %(f)s wasn't loaded due to "
445
+                            "%(exception)s",
446 446
                             {'f': f, 'exception': exception})
447 447
 
448 448
     def add_extension(self, ext):
@@ -451,7 +451,7 @@ class ExtensionManager(object):
451 451
             return
452 452
 
453 453
         alias = ext.get_alias()
454
-        LOG.info(_LI('Loaded extension: %s'), alias)
454
+        LOG.info('Loaded extension: %s', alias)
455 455
 
456 456
         if alias in self.extensions:
457 457
             raise exceptions.DuplicatedExtension(alias=alias)
@@ -485,9 +485,8 @@ class PluginAwareExtensionManager(ExtensionManager):
485 485
         alias = extension.get_alias()
486 486
         supports_extension = alias in self.get_supported_extension_aliases()
487 487
         if not supports_extension:
488
-            LOG.info(_LI("Extension %s not supported by any of loaded "
489
-                         "plugins"),
490
-                    alias)
488
+            LOG.info("Extension %s not supported by any of loaded "
489
+                     "plugins", alias)
491 490
         return supports_extension
492 491
 
493 492
     def _plugins_implement_interface(self, extension):
@@ -496,8 +495,8 @@ class PluginAwareExtensionManager(ExtensionManager):
496 495
         for plugin in self.plugins.values():
497 496
             if isinstance(plugin, extension.get_plugin_interface()):
498 497
                 return True
499
-        LOG.warning(_LW("Loaded plugins do not implement extension "
500
-                        "%s interface"),
498
+        LOG.warning("Loaded plugins do not implement extension "
499
+                    "%s interface",
501 500
                     extension.get_alias())
502 501
         return False
503 502
 

+ 10
- 11
neutron/api/rpc/agentnotifiers/dhcp_rpc_agent_api.py View File

@@ -22,7 +22,6 @@ from oslo_config import cfg
22 22
 from oslo_log import log as logging
23 23
 import oslo_messaging
24 24
 
25
-from neutron._i18n import _LE, _LW
26 25
 from neutron.common import constants as n_const
27 26
 from neutron.common import rpc as n_rpc
28 27
 from neutron.common import topics
@@ -105,9 +104,9 @@ class DhcpAgentNotifyAPI(object):
105 104
                     context, 'network_create_end',
106 105
                     {'network': {'id': network['id']}}, agent['host'])
107 106
         elif not existing_agents:
108
-            LOG.warning(_LW('Unable to schedule network %s: no agents '
109
-                            'available; will retry on subsequent port '
110
-                            'and subnet creation events.'),
107
+            LOG.warning('Unable to schedule network %s: no agents '
108
+                        'available; will retry on subsequent port '
109
+                        'and subnet creation events.',
111 110
                         network['id'])
112 111
         return new_agents + existing_agents
113 112
 
@@ -123,10 +122,10 @@ class DhcpAgentNotifyAPI(object):
123 122
         len_enabled_agents = len(enabled_agents)
124 123
         len_active_agents = len(active_agents)
125 124
         if len_active_agents < len_enabled_agents:
126
-            LOG.warning(_LW("Only %(active)d of %(total)d DHCP agents "
127
-                            "associated with network '%(net_id)s' "
128
-                            "are marked as active, so notifications "
129
-                            "may be sent to inactive agents."),
125
+            LOG.warning("Only %(active)d of %(total)d DHCP agents "
126
+                        "associated with network '%(net_id)s' "
127
+                        "are marked as active, so notifications "
128
+                        "may be sent to inactive agents.",
130 129
                         {'active': len_active_agents,
131 130
                          'total': len_enabled_agents,
132 131
                          'net_id': network_id})
@@ -136,9 +135,9 @@ class DhcpAgentNotifyAPI(object):
136 135
             notification_required = (
137 136
                 num_ports > 0 and len(network['subnets']) >= 1)
138 137
             if notification_required:
139
-                LOG.error(_LE("Will not send event %(method)s for network "
140
-                              "%(net_id)s: no agent available. Payload: "
141
-                              "%(payload)s"),
138
+                LOG.error("Will not send event %(method)s for network "
139
+                          "%(net_id)s: no agent available. Payload: "
140
+                          "%(payload)s",
142 141
                           {'method': method,
143 142
                            'net_id': network_id,
144 143
                            'payload': payload})

+ 2
- 3
neutron/api/rpc/agentnotifiers/l3_rpc_agent_api.py View File

@@ -21,7 +21,6 @@ from neutron_lib.plugins import directory
21 21
 from oslo_log import log as logging
22 22
 import oslo_messaging
23 23
 
24
-from neutron._i18n import _LE
25 24
 from neutron.api.rpc.agentnotifiers import utils as ag_utils
26 25
 from neutron.common import rpc as n_rpc
27 26
 from neutron.common import topics
@@ -88,8 +87,8 @@ class L3AgentNotifyAPI(object):
88 87
         """Notify all the agents that are hosting the routers."""
89 88
         plugin = directory.get_plugin(plugin_constants.L3)
90 89
         if not plugin:
91
-            LOG.error(_LE('No plugin for L3 routing registered. Cannot notify '
92
-                          'agents with the message %s'), method)
90
+            LOG.error('No plugin for L3 routing registered. Cannot notify '
91
+                      'agents with the message %s', method)
93 92
             return
94 93
         if utils.is_extension_supported(
95 94
                 plugin, constants.L3_AGENT_SCHEDULER_EXT_ALIAS):

+ 2
- 4
neutron/api/rpc/agentnotifiers/utils.py View File

@@ -17,8 +17,6 @@ from oslo_log import log as logging
17 17
 import oslo_messaging
18 18
 from oslo_utils import excutils
19 19
 
20
-from neutron._i18n import _LW
21
-
22 20
 LOG = logging.getLogger(__name__)
23 21
 
24 22
 
@@ -42,8 +40,8 @@ def _call_with_retry(max_attempts):
42 40
                     with excutils.save_and_reraise_exception(
43 41
                             reraise=False) as ctxt:
44 42
                         LOG.warning(
45
-                            _LW('Failed to execute %(action)s. %(attempt)d out'
46
-                                ' of %(max_attempts)d'),
43
+                            'Failed to execute %(action)s. %(attempt)d out'
44
+                            ' of %(max_attempts)d',
47 45
                             {'attempt': attempt,
48 46
                              'max_attempts': max_attempts,
49 47
                              'action': action})

+ 4
- 4
neutron/api/rpc/handlers/dhcp_rpc.py View File

@@ -28,7 +28,7 @@ from oslo_log import log as logging
28 28
 import oslo_messaging
29 29
 from oslo_utils import excutils
30 30
 
31
-from neutron._i18n import _, _LW
31
+from neutron._i18n import _
32 32
 from neutron.common import constants as n_const
33 33
 from neutron.common import exceptions as n_exc
34 34
 from neutron.common import utils
@@ -120,9 +120,9 @@ class DhcpRpcCallback(object):
120 120
                         ctxt.reraise = True
121 121
                 if ctxt.reraise:
122 122
                     net_id = port['port']['network_id']
123
-                    LOG.warning(_LW("Action %(action)s for network %(net_id)s "
124
-                                    "could not complete successfully: "
125
-                                    "%(reason)s"),
123
+                    LOG.warning("Action %(action)s for network %(net_id)s "
124
+                                "could not complete successfully: "
125
+                                "%(reason)s",
126 126
                                 {"action": action,
127 127
                                  "net_id": net_id,
128 128
                                  'reason': e})

+ 3
- 4
neutron/api/rpc/handlers/securitygroups_rpc.py View File