summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsreeteja <msreetej@in.ibm.com>2017-08-18 12:52:18 +0200
committersreeteja <msreetej@in.ibm.com>2017-08-21 10:14:22 +0200
commit5c0ee00415dd97cf5ef27ee9837a33ce0b8f4937 (patch)
tree7862bcf8518875f84106c077c0afc75615688367
parentea4830f7e62cc04b7673128beb1f539019f145ac (diff)
Drop i18n support for log messages.
Starting with the Pike series, OpenStack no longer supports log translation. This got discussed on the ML with: http://lists.openstack.org/pipermail/openstack-dev/2017-March/thread.html#113365 This change drops all LE, LW and LI translation helper usage. Neutron commit here, which dropped the translation marker we imported: https://github.com/openstack/neutron/commit/7322bd6 Change-Id: I37404141ecb87ea71c456133a15e485e69b08e38
Notes
Notes (review): Code-Review+2: Markus Zoeller (markus_z) <mzoeller@linux.vnet.ibm.com> Workflow+1: Markus Zoeller (markus_z) <mzoeller@linux.vnet.ibm.com> Verified+2: Jenkins Submitted-by: Jenkins Submitted-at: Mon, 21 Aug 2017 08:31:34 +0000 Reviewed-on: https://review.openstack.org/495165 Project: openstack/networking-dpm Branch: refs/heads/master
-rw-r--r--networking_dpm/ml2/dpm_neutron_agent.py82
-rw-r--r--networking_dpm/ml2/mech_dpm.py17
-rw-r--r--tox.ini2
3 files changed, 47 insertions, 54 deletions
diff --git a/networking_dpm/ml2/dpm_neutron_agent.py b/networking_dpm/ml2/dpm_neutron_agent.py
index 026f5c6..955f79c 100644
--- a/networking_dpm/ml2/dpm_neutron_agent.py
+++ b/networking_dpm/ml2/dpm_neutron_agent.py
@@ -27,9 +27,6 @@ from networking_dpm.conf import config
27from networking_dpm.ml2 import constants as const 27from networking_dpm.ml2 import constants as const
28from networking_dpm.ml2.mech_dpm import AGENT_TYPE_DPM 28from networking_dpm.ml2.mech_dpm import AGENT_TYPE_DPM
29 29
30from neutron._i18n import _LE
31from neutron._i18n import _LI
32from neutron._i18n import _LW
33from neutron.api.rpc.handlers import securitygroups_rpc as sg_rpc 30from neutron.api.rpc.handlers import securitygroups_rpc as sg_rpc
34from neutron.common import config as common_config 31from neutron.common import config as common_config
35from neutron.common import topics 32from neutron.common import topics
@@ -75,11 +72,9 @@ class PhysicalNetworkMapping(object):
75 'port': int(port) 72 'port': int(port)
76 }) 73 })
77 except zhmcclient.NotFound: 74 except zhmcclient.NotFound:
78 LOG.error( 75 LOG.error("No vswitch object for adapter/port combination "
79 _LE("No vswitch object for adapter/port combination " 76 "%(adapt)s/%(port)s found. Agent terminated!",
80 "%(adapt)s/%(port)s found. Agent terminated!"), 77 {'adapt': adapter_id, 'port': port})
81 {'adapt': adapter_id, 'port': port}
82 )
83 sys.exit(1) 78 sys.exit(1)
84 79
85 def _add_vswitch(self, physnet, adapter_id, port): 80 def _add_vswitch(self, physnet, adapter_id, port):
@@ -87,10 +82,10 @@ class PhysicalNetworkMapping(object):
87 self._vswitches.append(vswitch) 82 self._vswitches.append(vswitch)
88 if self._physnet_mapping.get(physnet): 83 if self._physnet_mapping.get(physnet):
89 # TODO(andreas_s): Lift this restriction 84 # TODO(andreas_s): Lift this restriction
90 LOG.error(_LE("Multiple vswitches for physical network " 85 LOG.error("Multiple vswitches for physical network "
91 "%(net)s defined but only a single vswitch " 86 "%(net)s defined but only a single vswitch "
92 "definition per physical network is supported." 87 "definition per physical network is supported."
93 "Agent terminated!"), 88 "Agent terminated!",
94 {'net': physnet}) 89 {'net': physnet})
95 sys.exit(1) 90 sys.exit(1)
96 self._physnet_mapping[physnet] = [vswitch.get_property('object-id')] 91 self._physnet_mapping[physnet] = [vswitch.get_property('object-id')]
@@ -101,9 +96,9 @@ class PhysicalNetworkMapping(object):
101 # whole list of items is retrieved 96 # whole list of items is retrieved
102 return self._cpc.adapters.find(**{'object-id': adapter_id}) 97 return self._cpc.adapters.find(**{'object-id': adapter_id})
103 except zhmcclient.NotFound: 98 except zhmcclient.NotFound:
104 LOG.error(_LE("Configured adapter %s could not be " 99 LOG.error("Configured adapter %s could not be "
105 "found. Please update the agent " 100 "found. Please update the agent "
106 "configuration. Agent terminated!"), 101 "configuration. Agent terminated!",
107 adapter_id) 102 adapter_id)
108 sys.exit(1) 103 sys.exit(1)
109 104
@@ -111,10 +106,10 @@ class PhysicalNetworkMapping(object):
111 def _validate_adapter_type(adapter): 106 def _validate_adapter_type(adapter):
112 adapt_type = adapter.get_property('type') 107 adapt_type = adapter.get_property('type')
113 if adapt_type not in ['osd', 'hipersockets']: 108 if adapt_type not in ['osd', 'hipersockets']:
114 LOG.error(_LE("Configured adapter %s is not an OSA " 109 LOG.error("Configured adapter %s is not an OSA "
115 "or a hipersockets adapter. Please update " 110 "or a hipersockets adapter. Please update "
116 "the agent configuration. Agent " 111 "the agent configuration. Agent "
117 "terminated!"), adapter) 112 "terminated!", adapter)
118 sys.exit(1) 113 sys.exit(1)
119 114
120 @staticmethod 115 @staticmethod
@@ -124,11 +119,10 @@ class PhysicalNetworkMapping(object):
124 # whole list of items is retrieved 119 # whole list of items is retrieved
125 adapter.ports.find(**{'element-id': port}) 120 adapter.ports.find(**{'element-id': port})
126 except zhmcclient.NotFound: 121 except zhmcclient.NotFound:
127 LOG.error(_LE("Configured port %(port)s for adapter " 122 LOG.error("Configured port %(port)s for adapter "
128 "%(adapt)s does not exist. Please update " 123 "%(adapt)s does not exist. Please update "
129 "the agent configuration. Agent " 124 "the agent configuration. Agent "
130 "terminated!"), {'adapt': adapter, 125 "terminated!", {'adapt': adapter, 'port': port})
131 'port': port})
132 sys.exit(1) 126 sys.exit(1)
133 127
134 @staticmethod 128 @staticmethod
@@ -260,8 +254,8 @@ class DPMManager(amb.CommonAgentManagerBase):
260 LOG.debug("NIC %s got deleted concurrently." 254 LOG.debug("NIC %s got deleted concurrently."
261 "Continuing...", nic) 255 "Continuing...", nic)
262 else: 256 else:
263 LOG.warning(_LW("NIC %(nic)s will be reported as " 257 LOG.warning("NIC %(nic)s will be reported as "
264 "'DOWN' due to error: %(err)s"), 258 "'DOWN' due to error: %(err)s",
265 {'nic': nic, 'err': http_error}) 259 {'nic': nic, 'err': http_error})
266 return macs 260 return macs
267 261
@@ -278,16 +272,16 @@ class DPMManager(amb.CommonAgentManagerBase):
278 devices = devices.union( 272 devices = devices.union(
279 self._filter_agent_managed_nic_macs(nics)) 273 self._filter_agent_managed_nic_macs(nics))
280 except zhmcclient.ConnectionError as con_err: 274 except zhmcclient.ConnectionError as con_err:
281 LOG.error(_LE( 275 LOG.error(
282 "%(message)s, %(details)s. Lost connection to HMC of " 276 "%(message)s, %(details)s. Lost connection to HMC of "
283 "CPC %(cpc)s. All NICs of this CPC and its corresponding " 277 "CPC %(cpc)s. All NICs of this CPC and its corresponding "
284 "Neutron ports wil be reported as 'DOWN'."), 278 "Neutron ports wil be reported as 'DOWN'.",
285 {"cpc": self.cpc, "message": con_err, 279 {"cpc": self.cpc, "message": con_err,
286 "details": con_err.details}) 280 "details": con_err.details})
287 281
288 except zhmcclient.HTTPError as http_error: 282 except zhmcclient.HTTPError as http_error:
289 if http_error.http_status == const.HTTP_STATUS_NOT_FOUND: 283 if http_error.http_status == const.HTTP_STATUS_NOT_FOUND:
290 LOG.error(_LE( 284 LOG.error(
291 "An unrecoverable error occurred: %(err)s " 285 "An unrecoverable error occurred: %(err)s "
292 "DPM vSwitch object %(vswitch)s is " 286 "DPM vSwitch object %(vswitch)s is "
293 "not available anymore. This can happen if " 287 "not available anymore. This can happen if "
@@ -296,16 +290,16 @@ class DPMManager(amb.CommonAgentManagerBase):
296 "hipersockets network got deleted. Please " 290 "hipersockets network got deleted. Please "
297 "check the physical_network_adapter_mappings " 291 "check the physical_network_adapter_mappings "
298 "configuration and start the " 292 "configuration and start the "
299 "agent again. Agent terminated!"), 293 "agent again. Agent terminated!",
300 {'vswitch': vswitch, 'err': http_error}) 294 {'vswitch': vswitch, 'err': http_error})
301 # Need to exit with sys.exit, as calling code catches 295 # Need to exit with sys.exit, as calling code catches
302 # exceptions 296 # exceptions
303 sys.exit(1) 297 sys.exit(1)
304 298
305 LOG.warning(_LW("An error occurred while retrieving the " 299 LOG.warning("An error occurred while retrieving the "
306 "connected nics of vswitch %(vswitch)s: " 300 "connected nics of vswitch %(vswitch)s: "
307 "%(err)s. All NICs of this vswitch will " 301 "%(err)s. All NICs of this vswitch will "
308 "be reported as 'DOWN'."), 302 "be reported as 'DOWN'.",
309 {'vswitch': vswitch, 'err': http_error}) 303 {'vswitch': vswitch, 'err': http_error})
310 return devices 304 return devices
311 305
@@ -343,11 +337,11 @@ def _validate_firewall_driver():
343 supported_fw_drivers = ['neutron.agent.firewall.NoopFirewallDriver', 337 supported_fw_drivers = ['neutron.agent.firewall.NoopFirewallDriver',
344 'noop'] 338 'noop']
345 if fw_driver not in supported_fw_drivers: 339 if fw_driver not in supported_fw_drivers:
346 LOG.error(_LE('Unsupported configuration option for "SECURITYGROUP.' 340 LOG.error('Unsupported configuration option for "SECURITYGROUP.'
347 'firewall_driver"! Only the NoopFirewallDriver is ' 341 'firewall_driver"! Only the NoopFirewallDriver is '
348 'supported by DPM agent, but "%s" is configured. ' 342 'supported by DPM agent, but "%s" is configured. '
349 'Set the firewall_driver to "noop" and start the ' 343 'Set the firewall_driver to "noop" and start the '
350 'agent again. Agent terminated!'), 344 'agent again. Agent terminated!',
351 fw_driver) 345 fw_driver)
352 sys.exit(1) 346 sys.exit(1)
353 347
@@ -357,9 +351,9 @@ def _get_cpc(client, cpc_oid):
357 cpc = client.cpcs.find(**{'object-id': cpc_oid}) 351 cpc = client.cpcs.find(**{'object-id': cpc_oid})
358 if cpc.dpm_enabled: 352 if cpc.dpm_enabled:
359 return cpc 353 return cpc
360 LOG.error(_LE("CPC %s not in DPM mode.") % cpc_oid) 354 LOG.error("CPC %s not in DPM mode." % cpc_oid)
361 except zhmcclient.NotFound: 355 except zhmcclient.NotFound:
362 LOG.error(_LE("Could not find CPC with object-id %s") % cpc_oid) 356 LOG.error("Could not find CPC with object-id %s" % cpc_oid)
363 sys.exit(1) 357 sys.exit(1)
364 358
365 359
@@ -371,8 +365,8 @@ def setup_logging():
371 logging.set_defaults(default_log_levels=logging.get_default_log_levels() + 365 logging.set_defaults(default_log_levels=logging.get_default_log_levels() +
372 ["zhmcclient=WARNING"]) 366 ["zhmcclient=WARNING"])
373 logging.setup(CONF, 'neutron') 367 logging.setup(CONF, 'neutron')
374 LOG.info(_LI("Logging enabled!")) 368 LOG.info("Logging enabled!")
375 LOG.info(_LI("%(prog)s"), {'prog': sys.argv[0]}) 369 LOG.info("%(prog)s", {'prog': sys.argv[0]})
376 LOG.debug("command line: %s", " ".join(sys.argv)) 370 LOG.debug("command line: %s", " ".join(sys.argv))
377 371
378 372
@@ -399,5 +393,5 @@ def main():
399 quitting_rpc_timeout, 393 quitting_rpc_timeout,
400 AGENT_TYPE_DPM, 394 AGENT_TYPE_DPM,
401 DPM_AGENT_BINARY) 395 DPM_AGENT_BINARY)
402 LOG.info(_LI("Agent initialized successfully, now running... ")) 396 LOG.info("Agent initialized successfully, now running... ")
403 service.launch(CONF, agent).wait() 397 service.launch(CONF, agent).wait()
diff --git a/networking_dpm/ml2/mech_dpm.py b/networking_dpm/ml2/mech_dpm.py
index 2ba5cf9..7794b2f 100644
--- a/networking_dpm/ml2/mech_dpm.py
+++ b/networking_dpm/ml2/mech_dpm.py
@@ -17,7 +17,6 @@
17from neutron_lib.api.definitions import portbindings 17from neutron_lib.api.definitions import portbindings
18from oslo_log import log 18from oslo_log import log
19 19
20from neutron._i18n import _LW
21from neutron.plugins.common import constants as p_constants 20from neutron.plugins.common import constants as p_constants
22from neutron.plugins.ml2 import driver_api as api 21from neutron.plugins.ml2 import driver_api as api
23from neutron.plugins.ml2.drivers import mech_agent 22from neutron.plugins.ml2.drivers import mech_agent
@@ -64,16 +63,16 @@ class DPMMechanismDriver(mech_agent.SimpleAgentMechanismDriverBase):
64 63
65 object_ids = self.get_mappings(agent)[physnet] 64 object_ids = self.get_mappings(agent)[physnet]
66 if not object_ids: 65 if not object_ids:
67 LOG.warning(_LW("No Object-IDs found in agents %(agent)s mapping " 66 LOG.warning("No Object-IDs found in agents %(agent)s mapping "
68 "for physical network %(net)s."), {'agent': agent, 67 "for physical network %(net)s.", {'agent': agent,
69 'net': physnet}) 68 'net': physnet})
70 return False 69 return False
71 if len(object_ids) > 1: 70 if len(object_ids) > 1:
72 LOG.warning(_LW("More than one Object-ID for physical network " 71 LOG.warning("More than one Object-ID for physical network "
73 "%(net)s on agent %(agent)s found but only a " 72 "%(net)s on agent %(agent)s found but only a "
74 "single Object-ID is supported. Therefore the " 73 "single Object-ID is supported. Therefore the "
75 "first one is being chosen!"), {'agent': agent, 74 "first one is being chosen!", {'agent': agent,
76 'net': physnet}) 75 'net': physnet})
77 # TODO(andreas_s): In the first release only a single adapter/vswitch 76 # TODO(andreas_s): In the first release only a single adapter/vswitch
78 # per physical network is supported 77 # per physical network is supported
79 object_id = object_ids[0] 78 object_id = object_ids[0]
diff --git a/tox.ini b/tox.ini
index b38bcab..9bab07b 100644
--- a/tox.ini
+++ b/tox.ini
@@ -44,7 +44,7 @@ commands = oslo_debug_helper {posargs}
44# N530 direct neutron imports not allowed 44# N530 direct neutron imports not allowed
45 45
46show-source = True 46show-source = True
47ignore = E123,E125,N530 47ignore = E123,E125,N530,N537
48builtins = _ 48builtins = _
49exclude=.venv,.git,.tox,dist,doc,*lib/python*,*egg,build,.tmp 49exclude=.venv,.git,.tox,dist,doc,*lib/python*,*egg,build,.tmp
50 50