Update i18n translation for neutron.api log msg's
Validate that hacking rules apply to directory neutron/api Change-Id: Idd54964dbb3a48505c20117c79ce57913a7f1c12 Partial-bug: #1320867
This commit is contained in:
parent
ee74e03db0
commit
8065c5ef56
@ -20,6 +20,7 @@ from webob import exc
|
|||||||
|
|
||||||
from neutron.common import constants
|
from neutron.common import constants
|
||||||
from neutron.common import exceptions
|
from neutron.common import exceptions
|
||||||
|
from neutron.openstack.common.gettextutils import _LW
|
||||||
from neutron.openstack.common import log as logging
|
from neutron.openstack.common import log as logging
|
||||||
|
|
||||||
|
|
||||||
@ -98,7 +99,7 @@ def _get_pagination_max_limit():
|
|||||||
if max_limit == 0:
|
if max_limit == 0:
|
||||||
raise ValueError()
|
raise ValueError()
|
||||||
except ValueError:
|
except ValueError:
|
||||||
LOG.warn(_("Invalid value for pagination_max_limit: %s. It "
|
LOG.warn(_LW("Invalid value for pagination_max_limit: %s. It "
|
||||||
"should be an integer greater to 0"),
|
"should be an integer greater to 0"),
|
||||||
cfg.CONF.pagination_max_limit)
|
cfg.CONF.pagination_max_limit)
|
||||||
return max_limit
|
return max_limit
|
||||||
|
@ -28,6 +28,7 @@ import webob.exc
|
|||||||
from neutron.common import exceptions
|
from neutron.common import exceptions
|
||||||
import neutron.extensions
|
import neutron.extensions
|
||||||
from neutron import manager
|
from neutron import manager
|
||||||
|
from neutron.openstack.common.gettextutils import _LE, _LI, _LW
|
||||||
from neutron.openstack.common import log as logging
|
from neutron.openstack.common import log as logging
|
||||||
from neutron import policy
|
from neutron import policy
|
||||||
from neutron import wsgi
|
from neutron import wsgi
|
||||||
@ -279,7 +280,7 @@ class ExtensionMiddleware(wsgi.Middleware):
|
|||||||
(resource.parent["collection_name"],
|
(resource.parent["collection_name"],
|
||||||
resource.parent["member_name"]))
|
resource.parent["member_name"]))
|
||||||
|
|
||||||
LOG.debug(_('Extended resource: %s'),
|
LOG.debug('Extended resource: %s',
|
||||||
resource.collection)
|
resource.collection)
|
||||||
for action, method in resource.collection_actions.iteritems():
|
for action, method in resource.collection_actions.iteritems():
|
||||||
conditions = dict(method=[method])
|
conditions = dict(method=[method])
|
||||||
@ -301,7 +302,7 @@ class ExtensionMiddleware(wsgi.Middleware):
|
|||||||
action_controllers = self._action_ext_controllers(application,
|
action_controllers = self._action_ext_controllers(application,
|
||||||
self.ext_mgr, mapper)
|
self.ext_mgr, mapper)
|
||||||
for action in self.ext_mgr.get_actions():
|
for action in self.ext_mgr.get_actions():
|
||||||
LOG.debug(_('Extended action: %s'), action.action_name)
|
LOG.debug('Extended action: %s', action.action_name)
|
||||||
controller = action_controllers[action.collection]
|
controller = action_controllers[action.collection]
|
||||||
controller.add_action(action.action_name, action.handler)
|
controller.add_action(action.action_name, action.handler)
|
||||||
|
|
||||||
@ -309,7 +310,7 @@ class ExtensionMiddleware(wsgi.Middleware):
|
|||||||
req_controllers = self._request_ext_controllers(application,
|
req_controllers = self._request_ext_controllers(application,
|
||||||
self.ext_mgr, mapper)
|
self.ext_mgr, mapper)
|
||||||
for request_ext in self.ext_mgr.get_request_extensions():
|
for request_ext in self.ext_mgr.get_request_extensions():
|
||||||
LOG.debug(_('Extended request: %s'), request_ext.key)
|
LOG.debug('Extended request: %s', request_ext.key)
|
||||||
controller = req_controllers[request_ext.key]
|
controller = req_controllers[request_ext.key]
|
||||||
controller.add_handler(request_ext.handler)
|
controller.add_handler(request_ext.handler)
|
||||||
|
|
||||||
@ -399,7 +400,7 @@ class ExtensionManager(object):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, path):
|
def __init__(self, path):
|
||||||
LOG.info(_('Initializing extension manager.'))
|
LOG.info(_LI('Initializing extension manager.'))
|
||||||
self.path = path
|
self.path = path
|
||||||
self.extensions = {}
|
self.extensions = {}
|
||||||
self._load_all_extensions()
|
self._load_all_extensions()
|
||||||
@ -479,7 +480,7 @@ class ExtensionManager(object):
|
|||||||
else:
|
else:
|
||||||
attr_map[resource] = resource_attrs
|
attr_map[resource] = resource_attrs
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
LOG.exception(_("Error fetching extended attributes for "
|
LOG.exception(_LE("Error fetching extended attributes for "
|
||||||
"extension '%s'"), ext.get_name())
|
"extension '%s'"), ext.get_name())
|
||||||
processed_exts.add(ext_name)
|
processed_exts.add(ext_name)
|
||||||
del exts_to_process[ext_name]
|
del exts_to_process[ext_name]
|
||||||
@ -488,7 +489,7 @@ class ExtensionManager(object):
|
|||||||
break
|
break
|
||||||
if exts_to_process:
|
if exts_to_process:
|
||||||
# NOTE(salv-orlando): Consider whether this error should be fatal
|
# NOTE(salv-orlando): Consider whether this error should be fatal
|
||||||
LOG.error(_("It was impossible to process the following "
|
LOG.error(_LE("It was impossible to process the following "
|
||||||
"extensions: %s because of missing requirements."),
|
"extensions: %s because of missing requirements."),
|
||||||
','.join(exts_to_process.keys()))
|
','.join(exts_to_process.keys()))
|
||||||
|
|
||||||
@ -499,13 +500,13 @@ class ExtensionManager(object):
|
|||||||
def _check_extension(self, extension):
|
def _check_extension(self, extension):
|
||||||
"""Checks for required methods in extension objects."""
|
"""Checks for required methods in extension objects."""
|
||||||
try:
|
try:
|
||||||
LOG.debug(_('Ext name: %s'), extension.get_name())
|
LOG.debug('Ext name: %s', extension.get_name())
|
||||||
LOG.debug(_('Ext alias: %s'), extension.get_alias())
|
LOG.debug('Ext alias: %s', extension.get_alias())
|
||||||
LOG.debug(_('Ext description: %s'), extension.get_description())
|
LOG.debug('Ext description: %s', extension.get_description())
|
||||||
LOG.debug(_('Ext namespace: %s'), extension.get_namespace())
|
LOG.debug('Ext namespace: %s', extension.get_namespace())
|
||||||
LOG.debug(_('Ext updated: %s'), extension.get_updated())
|
LOG.debug('Ext updated: %s', extension.get_updated())
|
||||||
except AttributeError as ex:
|
except AttributeError as ex:
|
||||||
LOG.exception(_("Exception loading extension: %s"), unicode(ex))
|
LOG.exception(_LE("Exception loading extension: %s"), unicode(ex))
|
||||||
return False
|
return False
|
||||||
return True
|
return True
|
||||||
|
|
||||||
@ -523,7 +524,7 @@ class ExtensionManager(object):
|
|||||||
if os.path.exists(path):
|
if os.path.exists(path):
|
||||||
self._load_all_extensions_from_path(path)
|
self._load_all_extensions_from_path(path)
|
||||||
else:
|
else:
|
||||||
LOG.error(_("Extension path '%s' doesn't exist!"), path)
|
LOG.error(_LE("Extension path '%s' doesn't exist!"), path)
|
||||||
|
|
||||||
def _load_all_extensions_from_path(self, path):
|
def _load_all_extensions_from_path(self, path):
|
||||||
# Sorting the extension list makes the order in which they
|
# Sorting the extension list makes the order in which they
|
||||||
@ -531,7 +532,7 @@ class ExtensionManager(object):
|
|||||||
# Neutron Servers
|
# Neutron Servers
|
||||||
for f in sorted(os.listdir(path)):
|
for f in sorted(os.listdir(path)):
|
||||||
try:
|
try:
|
||||||
LOG.debug(_('Loading extension file: %s'), f)
|
LOG.debug('Loading extension file: %s', f)
|
||||||
mod_name, file_ext = os.path.splitext(os.path.split(f)[-1])
|
mod_name, file_ext = os.path.splitext(os.path.split(f)[-1])
|
||||||
ext_path = os.path.join(path, f)
|
ext_path = os.path.join(path, f)
|
||||||
if file_ext.lower() == '.py' and not mod_name.startswith('_'):
|
if file_ext.lower() == '.py' and not mod_name.startswith('_'):
|
||||||
@ -539,7 +540,7 @@ class ExtensionManager(object):
|
|||||||
ext_name = mod_name[0].upper() + mod_name[1:]
|
ext_name = mod_name[0].upper() + mod_name[1:]
|
||||||
new_ext_class = getattr(mod, ext_name, None)
|
new_ext_class = getattr(mod, ext_name, None)
|
||||||
if not new_ext_class:
|
if not new_ext_class:
|
||||||
LOG.warn(_('Did not find expected name '
|
LOG.warn(_LW('Did not find expected name '
|
||||||
'"%(ext_name)s" in %(file)s'),
|
'"%(ext_name)s" in %(file)s'),
|
||||||
{'ext_name': ext_name,
|
{'ext_name': ext_name,
|
||||||
'file': ext_path})
|
'file': ext_path})
|
||||||
@ -547,8 +548,9 @@ class ExtensionManager(object):
|
|||||||
new_ext = new_ext_class()
|
new_ext = new_ext_class()
|
||||||
self.add_extension(new_ext)
|
self.add_extension(new_ext)
|
||||||
except Exception as exception:
|
except Exception as exception:
|
||||||
LOG.warn(_("Extension file %(f)s wasn't loaded due to "
|
LOG.warn(_LW("Extension file %(f)s wasn't loaded due to "
|
||||||
"%(exception)s"), {'f': f, 'exception': exception})
|
"%(exception)s"),
|
||||||
|
{'f': f, 'exception': exception})
|
||||||
|
|
||||||
def add_extension(self, ext):
|
def add_extension(self, ext):
|
||||||
# Do nothing if the extension doesn't check out
|
# Do nothing if the extension doesn't check out
|
||||||
@ -556,7 +558,7 @@ class ExtensionManager(object):
|
|||||||
return
|
return
|
||||||
|
|
||||||
alias = ext.get_alias()
|
alias = ext.get_alias()
|
||||||
LOG.info(_('Loaded extension: %s'), alias)
|
LOG.info(_LI('Loaded extension: %s'), alias)
|
||||||
|
|
||||||
if alias in self.extensions:
|
if alias in self.extensions:
|
||||||
raise exceptions.DuplicatedExtension(alias=alias)
|
raise exceptions.DuplicatedExtension(alias=alias)
|
||||||
@ -587,7 +589,8 @@ class PluginAwareExtensionManager(ExtensionManager):
|
|||||||
alias in plugin.supported_extension_aliases)
|
alias in plugin.supported_extension_aliases)
|
||||||
for plugin in self.plugins.values())
|
for plugin in self.plugins.values())
|
||||||
if not supports_extension:
|
if not supports_extension:
|
||||||
LOG.warn(_("Extension %s not supported by any of loaded plugins"),
|
LOG.warn(_LW("Extension %s not supported by any of loaded "
|
||||||
|
"plugins"),
|
||||||
alias)
|
alias)
|
||||||
return supports_extension
|
return supports_extension
|
||||||
|
|
||||||
@ -598,7 +601,7 @@ class PluginAwareExtensionManager(ExtensionManager):
|
|||||||
for plugin in self.plugins.values():
|
for plugin in self.plugins.values():
|
||||||
if isinstance(plugin, extension.get_plugin_interface()):
|
if isinstance(plugin, extension.get_plugin_interface()):
|
||||||
return True
|
return True
|
||||||
LOG.warn(_("Loaded plugins do not implement extension %s interface"),
|
LOG.warn(_LW("Loaded plugins do not implement extension %s interface"),
|
||||||
extension.get_alias())
|
extension.get_alias())
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
@ -18,6 +18,7 @@ from neutron.common import rpc as n_rpc
|
|||||||
from neutron.common import topics
|
from neutron.common import topics
|
||||||
from neutron.common import utils
|
from neutron.common import utils
|
||||||
from neutron import manager
|
from neutron import manager
|
||||||
|
from neutron.openstack.common.gettextutils import _LE, _LW
|
||||||
from neutron.openstack.common import log as logging
|
from neutron.openstack.common import log as logging
|
||||||
|
|
||||||
|
|
||||||
@ -62,7 +63,7 @@ class DhcpAgentNotifyAPI(n_rpc.RpcProxy):
|
|||||||
context, 'network_create_end',
|
context, 'network_create_end',
|
||||||
{'network': {'id': network['id']}}, agent['host'])
|
{'network': {'id': network['id']}}, agent['host'])
|
||||||
elif not existing_agents:
|
elif not existing_agents:
|
||||||
LOG.warn(_('Unable to schedule network %s: no agents available; '
|
LOG.warn(_LW('Unable to schedule network %s: no agents available; '
|
||||||
'will retry on subsequent port creation events.'),
|
'will retry on subsequent port creation events.'),
|
||||||
network['id'])
|
network['id'])
|
||||||
return new_agents + existing_agents
|
return new_agents + existing_agents
|
||||||
@ -75,10 +76,10 @@ class DhcpAgentNotifyAPI(n_rpc.RpcProxy):
|
|||||||
len_enabled_agents = len(enabled_agents)
|
len_enabled_agents = len(enabled_agents)
|
||||||
len_active_agents = len(active_agents)
|
len_active_agents = len(active_agents)
|
||||||
if len_active_agents < len_enabled_agents:
|
if len_active_agents < len_enabled_agents:
|
||||||
LOG.warn(_("Only %(active)d of %(total)d DHCP agents associated "
|
LOG.warn(_LW("Only %(active)d of %(total)d DHCP agents associated "
|
||||||
"with network '%(net_id)s' are marked as active, so "
|
"with network '%(net_id)s' are marked as active, so "
|
||||||
" notifications may be sent to inactive agents.")
|
"notifications may be sent to inactive agents."),
|
||||||
% {'active': len_active_agents,
|
{'active': len_active_agents,
|
||||||
'total': len_enabled_agents,
|
'total': len_enabled_agents,
|
||||||
'net_id': network_id})
|
'net_id': network_id})
|
||||||
if not enabled_agents:
|
if not enabled_agents:
|
||||||
@ -87,10 +88,10 @@ class DhcpAgentNotifyAPI(n_rpc.RpcProxy):
|
|||||||
notification_required = (
|
notification_required = (
|
||||||
num_ports > 0 and len(network['subnets']) >= 1)
|
num_ports > 0 and len(network['subnets']) >= 1)
|
||||||
if notification_required:
|
if notification_required:
|
||||||
LOG.error(_("Will not send event %(method)s for network "
|
LOG.error(_LE("Will not send event %(method)s for network "
|
||||||
"%(net_id)s: no agent available. Payload: "
|
"%(net_id)s: no agent available. Payload: "
|
||||||
"%(payload)s")
|
"%(payload)s"),
|
||||||
% {'method': method,
|
{'method': method,
|
||||||
'net_id': network_id,
|
'net_id': network_id,
|
||||||
'payload': payload})
|
'payload': payload})
|
||||||
return enabled_agents
|
return enabled_agents
|
||||||
|
@ -20,6 +20,7 @@ from neutron.common import rpc as n_rpc
|
|||||||
from neutron.common import topics
|
from neutron.common import topics
|
||||||
from neutron.common import utils
|
from neutron.common import utils
|
||||||
from neutron import manager
|
from neutron import manager
|
||||||
|
from neutron.openstack.common.gettextutils import _LE
|
||||||
from neutron.openstack.common import log as logging
|
from neutron.openstack.common import log as logging
|
||||||
from neutron.plugins.common import constants as service_constants
|
from neutron.plugins.common import constants as service_constants
|
||||||
|
|
||||||
@ -37,8 +38,8 @@ class L3AgentNotifyAPI(n_rpc.RpcProxy):
|
|||||||
|
|
||||||
def _notification_host(self, context, method, payload, host):
|
def _notification_host(self, context, method, payload, host):
|
||||||
"""Notify the agent that is hosting the router."""
|
"""Notify the agent that is hosting the router."""
|
||||||
LOG.debug(_('Nofity agent at %(host)s the message '
|
LOG.debug('Nofity agent at %(host)s the message '
|
||||||
'%(method)s'), {'host': host,
|
'%(method)s', {'host': host,
|
||||||
'method': method})
|
'method': method})
|
||||||
self.cast(
|
self.cast(
|
||||||
context, self.make_msg(method,
|
context, self.make_msg(method,
|
||||||
@ -59,8 +60,8 @@ class L3AgentNotifyAPI(n_rpc.RpcProxy):
|
|||||||
if shuffle_agents:
|
if shuffle_agents:
|
||||||
random.shuffle(l3_agents)
|
random.shuffle(l3_agents)
|
||||||
for l3_agent in l3_agents:
|
for l3_agent in l3_agents:
|
||||||
LOG.debug(_('Notify agent at %(topic)s.%(host)s the message '
|
LOG.debug('Notify agent at %(topic)s.%(host)s the message '
|
||||||
'%(method)s'),
|
'%(method)s',
|
||||||
{'topic': l3_agent.topic,
|
{'topic': l3_agent.topic,
|
||||||
'host': l3_agent.host,
|
'host': l3_agent.host,
|
||||||
'method': method})
|
'method': method})
|
||||||
@ -102,7 +103,7 @@ class L3AgentNotifyAPI(n_rpc.RpcProxy):
|
|||||||
plugin = manager.NeutronManager.get_service_plugins().get(
|
plugin = manager.NeutronManager.get_service_plugins().get(
|
||||||
service_constants.L3_ROUTER_NAT)
|
service_constants.L3_ROUTER_NAT)
|
||||||
if not plugin:
|
if not plugin:
|
||||||
LOG.error(_('No plugin for L3 routing registered. Cannot notify '
|
LOG.error(_LE('No plugin for L3 routing registered. Cannot notify '
|
||||||
'agents with the message %s'), method)
|
'agents with the message %s'), method)
|
||||||
return
|
return
|
||||||
if utils.is_extension_supported(
|
if utils.is_extension_supported(
|
||||||
@ -120,8 +121,8 @@ class L3AgentNotifyAPI(n_rpc.RpcProxy):
|
|||||||
|
|
||||||
def _notification_fanout(self, context, method, router_id):
|
def _notification_fanout(self, context, method, router_id):
|
||||||
"""Fanout the deleted router to all L3 agents."""
|
"""Fanout the deleted router to all L3 agents."""
|
||||||
LOG.debug(_('Fanout notify agent at %(topic)s the message '
|
LOG.debug('Fanout notify agent at %(topic)s the message '
|
||||||
'%(method)s on router %(router_id)s'),
|
'%(method)s on router %(router_id)s',
|
||||||
{'topic': topics.L3_AGENT,
|
{'topic': topics.L3_AGENT,
|
||||||
'method': method,
|
'method': method,
|
||||||
'router_id': router_id})
|
'router_id': router_id})
|
||||||
|
@ -44,8 +44,8 @@ class MeteringAgentNotifyAPI(n_rpc.RpcProxy):
|
|||||||
admin_state_up=True,
|
admin_state_up=True,
|
||||||
active=True)
|
active=True)
|
||||||
for l3_agent in l3_agents:
|
for l3_agent in l3_agents:
|
||||||
LOG.debug(_('Notify metering agent at %(topic)s.%(host)s '
|
LOG.debug('Notify metering agent at %(topic)s.%(host)s '
|
||||||
'the message %(method)s'),
|
'the message %(method)s',
|
||||||
{'topic': self.topic,
|
{'topic': self.topic,
|
||||||
'host': l3_agent.host,
|
'host': l3_agent.host,
|
||||||
'method': method})
|
'method': method})
|
||||||
@ -59,8 +59,8 @@ class MeteringAgentNotifyAPI(n_rpc.RpcProxy):
|
|||||||
topic='%s.%s' % (self.topic, host))
|
topic='%s.%s' % (self.topic, host))
|
||||||
|
|
||||||
def _notification_fanout(self, context, method, router_id):
|
def _notification_fanout(self, context, method, router_id):
|
||||||
LOG.debug(_('Fanout notify metering agent at %(topic)s the message '
|
LOG.debug('Fanout notify metering agent at %(topic)s the message '
|
||||||
'%(method)s on router %(router_id)s'),
|
'%(method)s on router %(router_id)s',
|
||||||
{'topic': self.topic,
|
{'topic': self.topic,
|
||||||
'method': method,
|
'method': method,
|
||||||
'router_id': router_id})
|
'router_id': router_id})
|
||||||
|
@ -24,6 +24,7 @@ from neutron.common import utils
|
|||||||
from neutron.extensions import portbindings
|
from neutron.extensions import portbindings
|
||||||
from neutron import manager
|
from neutron import manager
|
||||||
from neutron.openstack.common import excutils
|
from neutron.openstack.common import excutils
|
||||||
|
from neutron.openstack.common.gettextutils import _LW
|
||||||
from neutron.openstack.common import log as logging
|
from neutron.openstack.common import log as logging
|
||||||
|
|
||||||
|
|
||||||
@ -79,9 +80,9 @@ class DhcpRpcCallback(n_rpc.RpcCallback):
|
|||||||
else:
|
else:
|
||||||
ctxt.reraise = True
|
ctxt.reraise = True
|
||||||
net_id = port['port']['network_id']
|
net_id = port['port']['network_id']
|
||||||
LOG.warn(_("Action %(action)s for network %(net_id)s "
|
LOG.warn(_LW("Action %(action)s for network %(net_id)s "
|
||||||
"could not complete successfully: %(reason)s")
|
"could not complete successfully: %(reason)s"),
|
||||||
% {"action": action, "net_id": net_id, 'reason': e})
|
{"action": action, "net_id": net_id, 'reason': e})
|
||||||
|
|
||||||
def get_active_networks(self, context, **kwargs):
|
def get_active_networks(self, context, **kwargs):
|
||||||
"""Retrieve and return a list of the active network ids."""
|
"""Retrieve and return a list of the active network ids."""
|
||||||
@ -89,14 +90,14 @@ class DhcpRpcCallback(n_rpc.RpcCallback):
|
|||||||
# left so that neutron-dhcp-agents will still continue to work if
|
# left so that neutron-dhcp-agents will still continue to work if
|
||||||
# neutron-server is upgraded and not the agent.
|
# neutron-server is upgraded and not the agent.
|
||||||
host = kwargs.get('host')
|
host = kwargs.get('host')
|
||||||
LOG.debug(_('get_active_networks requested from %s'), host)
|
LOG.debug('get_active_networks requested from %s', host)
|
||||||
nets = self._get_active_networks(context, **kwargs)
|
nets = self._get_active_networks(context, **kwargs)
|
||||||
return [net['id'] for net in nets]
|
return [net['id'] for net in nets]
|
||||||
|
|
||||||
def get_active_networks_info(self, context, **kwargs):
|
def get_active_networks_info(self, context, **kwargs):
|
||||||
"""Returns all the networks/subnets/ports in system."""
|
"""Returns all the networks/subnets/ports in system."""
|
||||||
host = kwargs.get('host')
|
host = kwargs.get('host')
|
||||||
LOG.debug(_('get_active_networks_info from %s'), host)
|
LOG.debug('get_active_networks_info from %s', host)
|
||||||
networks = self._get_active_networks(context, **kwargs)
|
networks = self._get_active_networks(context, **kwargs)
|
||||||
plugin = manager.NeutronManager.get_plugin()
|
plugin = manager.NeutronManager.get_plugin()
|
||||||
filters = {'network_id': [network['id'] for network in networks]}
|
filters = {'network_id': [network['id'] for network in networks]}
|
||||||
@ -116,14 +117,14 @@ class DhcpRpcCallback(n_rpc.RpcCallback):
|
|||||||
"""Retrieve and return a extended information about a network."""
|
"""Retrieve and return a extended information about a network."""
|
||||||
network_id = kwargs.get('network_id')
|
network_id = kwargs.get('network_id')
|
||||||
host = kwargs.get('host')
|
host = kwargs.get('host')
|
||||||
LOG.debug(_('Network %(network_id)s requested from '
|
LOG.debug('Network %(network_id)s requested from '
|
||||||
'%(host)s'), {'network_id': network_id,
|
'%(host)s', {'network_id': network_id,
|
||||||
'host': host})
|
'host': host})
|
||||||
plugin = manager.NeutronManager.get_plugin()
|
plugin = manager.NeutronManager.get_plugin()
|
||||||
try:
|
try:
|
||||||
network = plugin.get_network(context, network_id)
|
network = plugin.get_network(context, network_id)
|
||||||
except n_exc.NetworkNotFound:
|
except n_exc.NetworkNotFound:
|
||||||
LOG.warn(_("Network %s could not be found, it might have "
|
LOG.warn(_LW("Network %s could not be found, it might have "
|
||||||
"been deleted concurrently."), network_id)
|
"been deleted concurrently."), network_id)
|
||||||
return
|
return
|
||||||
filters = dict(network_id=[network_id])
|
filters = dict(network_id=[network_id])
|
||||||
@ -145,8 +146,8 @@ class DhcpRpcCallback(n_rpc.RpcCallback):
|
|||||||
# There could be more than one dhcp server per network, so create
|
# There could be more than one dhcp server per network, so create
|
||||||
# a device id that combines host and network ids
|
# a device id that combines host and network ids
|
||||||
|
|
||||||
LOG.debug(_('Port %(device_id)s for %(network_id)s requested from '
|
LOG.debug('Port %(device_id)s for %(network_id)s requested from '
|
||||||
'%(host)s'), {'device_id': device_id,
|
'%(host)s', {'device_id': device_id,
|
||||||
'network_id': network_id,
|
'network_id': network_id,
|
||||||
'host': host})
|
'host': host})
|
||||||
plugin = manager.NeutronManager.get_plugin()
|
plugin = manager.NeutronManager.get_plugin()
|
||||||
@ -179,15 +180,15 @@ class DhcpRpcCallback(n_rpc.RpcCallback):
|
|||||||
|
|
||||||
if retval is None:
|
if retval is None:
|
||||||
# No previous port exists, so create a new one.
|
# No previous port exists, so create a new one.
|
||||||
LOG.debug(_('DHCP port %(device_id)s on network %(network_id)s '
|
LOG.debug('DHCP port %(device_id)s on network %(network_id)s '
|
||||||
'does not exist on %(host)s'),
|
'does not exist on %(host)s',
|
||||||
{'device_id': device_id,
|
{'device_id': device_id,
|
||||||
'network_id': network_id,
|
'network_id': network_id,
|
||||||
'host': host})
|
'host': host})
|
||||||
try:
|
try:
|
||||||
network = plugin.get_network(context, network_id)
|
network = plugin.get_network(context, network_id)
|
||||||
except n_exc.NetworkNotFound:
|
except n_exc.NetworkNotFound:
|
||||||
LOG.warn(_("Network %s could not be found, it might have "
|
LOG.warn(_LW("Network %s could not be found, it might have "
|
||||||
"been deleted concurrently."), network_id)
|
"been deleted concurrently."), network_id)
|
||||||
return
|
return
|
||||||
|
|
||||||
@ -219,8 +220,8 @@ class DhcpRpcCallback(n_rpc.RpcCallback):
|
|||||||
network_id = kwargs.get('network_id')
|
network_id = kwargs.get('network_id')
|
||||||
device_id = kwargs.get('device_id')
|
device_id = kwargs.get('device_id')
|
||||||
|
|
||||||
LOG.debug(_('DHCP port deletion for %(network_id)s request from '
|
LOG.debug('DHCP port deletion for %(network_id)s request from '
|
||||||
'%(host)s'),
|
'%(host)s',
|
||||||
{'network_id': network_id, 'host': host})
|
{'network_id': network_id, 'host': host})
|
||||||
plugin = manager.NeutronManager.get_plugin()
|
plugin = manager.NeutronManager.get_plugin()
|
||||||
plugin.delete_ports_by_device_id(context, device_id, network_id)
|
plugin.delete_ports_by_device_id(context, device_id, network_id)
|
||||||
@ -232,8 +233,8 @@ class DhcpRpcCallback(n_rpc.RpcCallback):
|
|||||||
device_id = kwargs.get('device_id')
|
device_id = kwargs.get('device_id')
|
||||||
subnet_id = kwargs.get('subnet_id')
|
subnet_id = kwargs.get('subnet_id')
|
||||||
|
|
||||||
LOG.debug(_('DHCP port remove fixed_ip for %(subnet_id)s request '
|
LOG.debug('DHCP port remove fixed_ip for %(subnet_id)s request '
|
||||||
'from %(host)s'),
|
'from %(host)s',
|
||||||
{'subnet_id': subnet_id, 'host': host})
|
{'subnet_id': subnet_id, 'host': host})
|
||||||
plugin = manager.NeutronManager.get_plugin()
|
plugin = manager.NeutronManager.get_plugin()
|
||||||
filters = dict(network_id=[network_id], device_id=[device_id])
|
filters = dict(network_id=[network_id], device_id=[device_id])
|
||||||
@ -256,7 +257,7 @@ class DhcpRpcCallback(n_rpc.RpcCallback):
|
|||||||
# neutron-server is upgraded and not the agent.
|
# neutron-server is upgraded and not the agent.
|
||||||
host = kwargs.get('host')
|
host = kwargs.get('host')
|
||||||
|
|
||||||
LOG.warning(_('Updating lease expiration is now deprecated. Issued '
|
LOG.warning(_LW('Updating lease expiration is now deprecated. Issued '
|
||||||
'from host %s.'), host)
|
'from host %s.'), host)
|
||||||
|
|
||||||
def create_dhcp_port(self, context, **kwargs):
|
def create_dhcp_port(self, context, **kwargs):
|
||||||
@ -267,8 +268,8 @@ class DhcpRpcCallback(n_rpc.RpcCallback):
|
|||||||
"""
|
"""
|
||||||
host = kwargs.get('host')
|
host = kwargs.get('host')
|
||||||
port = kwargs.get('port')
|
port = kwargs.get('port')
|
||||||
LOG.debug(_('Create dhcp port %(port)s '
|
LOG.debug('Create dhcp port %(port)s '
|
||||||
'from %(host)s.'),
|
'from %(host)s.',
|
||||||
{'port': port,
|
{'port': port,
|
||||||
'host': host})
|
'host': host})
|
||||||
|
|
||||||
@ -284,8 +285,8 @@ class DhcpRpcCallback(n_rpc.RpcCallback):
|
|||||||
host = kwargs.get('host')
|
host = kwargs.get('host')
|
||||||
port = kwargs.get('port')
|
port = kwargs.get('port')
|
||||||
port['id'] = kwargs.get('port_id')
|
port['id'] = kwargs.get('port_id')
|
||||||
LOG.debug(_('Update dhcp port %(port)s '
|
LOG.debug('Update dhcp port %(port)s '
|
||||||
'from %(host)s.'),
|
'from %(host)s.',
|
||||||
{'port': port,
|
{'port': port,
|
||||||
'host': host})
|
'host': host})
|
||||||
plugin = manager.NeutronManager.get_plugin()
|
plugin = manager.NeutronManager.get_plugin()
|
||||||
|
@ -24,6 +24,7 @@ from neutron import context as neutron_context
|
|||||||
from neutron.extensions import l3
|
from neutron.extensions import l3
|
||||||
from neutron.extensions import portbindings
|
from neutron.extensions import portbindings
|
||||||
from neutron import manager
|
from neutron import manager
|
||||||
|
from neutron.openstack.common.gettextutils import _LE
|
||||||
from neutron.openstack.common import log as logging
|
from neutron.openstack.common import log as logging
|
||||||
from neutron.plugins.common import constants as plugin_constants
|
from neutron.plugins.common import constants as plugin_constants
|
||||||
|
|
||||||
@ -67,7 +68,7 @@ class L3RpcCallback(n_rpc.RpcCallback):
|
|||||||
context = neutron_context.get_admin_context()
|
context = neutron_context.get_admin_context()
|
||||||
if not self.l3plugin:
|
if not self.l3plugin:
|
||||||
routers = {}
|
routers = {}
|
||||||
LOG.error(_('No plugin for L3 routing registered! Will reply '
|
LOG.error(_LE('No plugin for L3 routing registered! Will reply '
|
||||||
'to l3 agent with empty router dictionary.'))
|
'to l3 agent with empty router dictionary.'))
|
||||||
elif utils.is_extension_supported(
|
elif utils.is_extension_supported(
|
||||||
self.l3plugin, constants.L3_AGENT_SCHEDULER_EXT_ALIAS):
|
self.l3plugin, constants.L3_AGENT_SCHEDULER_EXT_ALIAS):
|
||||||
@ -81,13 +82,13 @@ class L3RpcCallback(n_rpc.RpcCallback):
|
|||||||
if utils.is_extension_supported(
|
if utils.is_extension_supported(
|
||||||
self.plugin, constants.PORT_BINDING_EXT_ALIAS):
|
self.plugin, constants.PORT_BINDING_EXT_ALIAS):
|
||||||
self._ensure_host_set_on_ports(context, host, routers)
|
self._ensure_host_set_on_ports(context, host, routers)
|
||||||
LOG.debug(_("Routers returned to l3 agent:\n %s"),
|
LOG.debug("Routers returned to l3 agent:\n %s",
|
||||||
jsonutils.dumps(routers, indent=5))
|
jsonutils.dumps(routers, indent=5))
|
||||||
return routers
|
return routers
|
||||||
|
|
||||||
def _ensure_host_set_on_ports(self, context, host, routers):
|
def _ensure_host_set_on_ports(self, context, host, routers):
|
||||||
for router in routers:
|
for router in routers:
|
||||||
LOG.debug(_("Checking router: %(id)s for host: %(host)s"),
|
LOG.debug("Checking router: %(id)s for host: %(host)s",
|
||||||
{'id': router['id'], 'host': host})
|
{'id': router['id'], 'host': host})
|
||||||
if router.get('gw_port') and router.get('distributed'):
|
if router.get('gw_port') and router.get('distributed'):
|
||||||
self._ensure_host_set_on_port(context,
|
self._ensure_host_set_on_port(context,
|
||||||
@ -147,7 +148,7 @@ class L3RpcCallback(n_rpc.RpcCallback):
|
|||||||
"""
|
"""
|
||||||
context = neutron_context.get_admin_context()
|
context = neutron_context.get_admin_context()
|
||||||
net_id = self.plugin.get_external_network_id(context)
|
net_id = self.plugin.get_external_network_id(context)
|
||||||
LOG.debug(_("External network ID returned to l3 agent: %s"),
|
LOG.debug("External network ID returned to l3 agent: %s",
|
||||||
net_id)
|
net_id)
|
||||||
return net_id
|
return net_id
|
||||||
|
|
||||||
@ -159,15 +160,15 @@ class L3RpcCallback(n_rpc.RpcCallback):
|
|||||||
"""Update operational status for a floating IP."""
|
"""Update operational status for a floating IP."""
|
||||||
with context.session.begin(subtransactions=True):
|
with context.session.begin(subtransactions=True):
|
||||||
for (floatingip_id, status) in fip_statuses.iteritems():
|
for (floatingip_id, status) in fip_statuses.iteritems():
|
||||||
LOG.debug(_("New status for floating IP %(floatingip_id)s: "
|
LOG.debug("New status for floating IP %(floatingip_id)s: "
|
||||||
"%(status)s"), {'floatingip_id': floatingip_id,
|
"%(status)s", {'floatingip_id': floatingip_id,
|
||||||
'status': status})
|
'status': status})
|
||||||
try:
|
try:
|
||||||
self.l3plugin.update_floatingip_status(context,
|
self.l3plugin.update_floatingip_status(context,
|
||||||
floatingip_id,
|
floatingip_id,
|
||||||
status)
|
status)
|
||||||
except l3.FloatingIPNotFound:
|
except l3.FloatingIPNotFound:
|
||||||
LOG.debug(_("Floating IP: %s no longer present."),
|
LOG.debug("Floating IP: %s no longer present.",
|
||||||
floatingip_id)
|
floatingip_id)
|
||||||
# Find all floating IPs known to have been the given router
|
# Find all floating IPs known to have been the given router
|
||||||
# for which an update was not received. Set them DOWN mercilessly
|
# for which an update was not received. Set them DOWN mercilessly
|
||||||
|
@ -27,6 +27,7 @@ from neutron.common import constants as const
|
|||||||
from neutron.common import exceptions
|
from neutron.common import exceptions
|
||||||
from neutron.common import rpc as n_rpc
|
from neutron.common import rpc as n_rpc
|
||||||
from neutron.openstack.common import excutils
|
from neutron.openstack.common import excutils
|
||||||
|
from neutron.openstack.common.gettextutils import _LE, _LI
|
||||||
from neutron.openstack.common import log as logging
|
from neutron.openstack.common import log as logging
|
||||||
from neutron.openstack.common import policy as common_policy
|
from neutron.openstack.common import policy as common_policy
|
||||||
from neutron import policy
|
from neutron import policy
|
||||||
@ -89,7 +90,7 @@ class Controller(object):
|
|||||||
_("Native pagination depend on native sorting")
|
_("Native pagination depend on native sorting")
|
||||||
)
|
)
|
||||||
if not self._allow_sorting:
|
if not self._allow_sorting:
|
||||||
LOG.info(_("Allow sorting is enabled because native "
|
LOG.info(_LI("Allow sorting is enabled because native "
|
||||||
"pagination requires native sorting"))
|
"pagination requires native sorting"))
|
||||||
self._allow_sorting = True
|
self._allow_sorting = True
|
||||||
|
|
||||||
@ -360,7 +361,7 @@ class Controller(object):
|
|||||||
obj_deleter(request.context, obj['id'], **kwargs)
|
obj_deleter(request.context, obj['id'], **kwargs)
|
||||||
except Exception:
|
except Exception:
|
||||||
# broad catch as our only purpose is to log the exception
|
# broad catch as our only purpose is to log the exception
|
||||||
LOG.exception(_("Unable to undo add for "
|
LOG.exception(_LE("Unable to undo add for "
|
||||||
"%(resource)s %(id)s"),
|
"%(resource)s %(id)s"),
|
||||||
{'resource': self._resource,
|
{'resource': self._resource,
|
||||||
'id': obj['id']})
|
'id': obj['id']})
|
||||||
@ -581,7 +582,7 @@ class Controller(object):
|
|||||||
if not body:
|
if not body:
|
||||||
raise webob.exc.HTTPBadRequest(_("Resource body required"))
|
raise webob.exc.HTTPBadRequest(_("Resource body required"))
|
||||||
|
|
||||||
LOG.debug(_("Request body: %(body)s"), {'body': body})
|
LOG.debug("Request body: %(body)s", {'body': body})
|
||||||
if collection in body:
|
if collection in body:
|
||||||
if not allow_bulk:
|
if not allow_bulk:
|
||||||
raise webob.exc.HTTPBadRequest(_("Bulk operation "
|
raise webob.exc.HTTPBadRequest(_("Bulk operation "
|
||||||
|
@ -26,6 +26,7 @@ import webob.exc
|
|||||||
|
|
||||||
from neutron.common import exceptions
|
from neutron.common import exceptions
|
||||||
from neutron.openstack.common import gettextutils
|
from neutron.openstack.common import gettextutils
|
||||||
|
from neutron.openstack.common.gettextutils import _LE, _LI
|
||||||
from neutron.openstack.common import log as logging
|
from neutron.openstack.common import log as logging
|
||||||
from neutron.openstack.common import policy as common_policy
|
from neutron.openstack.common import policy as common_policy
|
||||||
from neutron import wsgi
|
from neutron import wsgi
|
||||||
@ -90,10 +91,10 @@ def Resource(controller, faults=None, deserializers=None, serializers=None):
|
|||||||
else:
|
else:
|
||||||
mapped_exc = webob.exc.HTTPInternalServerError
|
mapped_exc = webob.exc.HTTPInternalServerError
|
||||||
if 400 <= mapped_exc.code < 500:
|
if 400 <= mapped_exc.code < 500:
|
||||||
LOG.info(_('%(action)s failed (client error): %(exc)s'),
|
LOG.info(_LI('%(action)s failed (client error): %(exc)s'),
|
||||||
{'action': action, 'exc': e})
|
{'action': action, 'exc': e})
|
||||||
else:
|
else:
|
||||||
LOG.exception(_('%s failed'), action)
|
LOG.exception(_LE('%s failed'), action)
|
||||||
e = translate(e, language)
|
e = translate(e, language)
|
||||||
body = serializer.serialize(
|
body = serializer.serialize(
|
||||||
{'NeutronError': get_exception_data(e)})
|
{'NeutronError': get_exception_data(e)})
|
||||||
@ -101,7 +102,7 @@ def Resource(controller, faults=None, deserializers=None, serializers=None):
|
|||||||
raise mapped_exc(**kwargs)
|
raise mapped_exc(**kwargs)
|
||||||
except webob.exc.HTTPException as e:
|
except webob.exc.HTTPException as e:
|
||||||
type_, value, tb = sys.exc_info()
|
type_, value, tb = sys.exc_info()
|
||||||
LOG.exception(_('%s failed'), action)
|
LOG.exception(_LE('%s failed'), action)
|
||||||
translate(e, language)
|
translate(e, language)
|
||||||
value.body = serializer.serialize(
|
value.body = serializer.serialize(
|
||||||
{'NeutronError': get_exception_data(e)})
|
{'NeutronError': get_exception_data(e)})
|
||||||
@ -121,7 +122,7 @@ def Resource(controller, faults=None, deserializers=None, serializers=None):
|
|||||||
raise webob.exc.HTTPNotImplemented(**kwargs)
|
raise webob.exc.HTTPNotImplemented(**kwargs)
|
||||||
except Exception:
|
except Exception:
|
||||||
# NOTE(jkoelker) Everything else is 500
|
# NOTE(jkoelker) Everything else is 500
|
||||||
LOG.exception(_('%s failed'), action)
|
LOG.exception(_LE('%s failed'), action)
|
||||||
# Do not expose details of 500 error to clients.
|
# Do not expose details of 500 error to clients.
|
||||||
msg = _('Request Failed: internal server error while '
|
msg = _('Request Failed: internal server error while '
|
||||||
'processing your request.')
|
'processing your request.')
|
||||||
|
@ -45,6 +45,7 @@ def _directory_to_check_translation(filename):
|
|||||||
# do it on a directory by directory basis. The last patch of the
|
# do it on a directory by directory basis. The last patch of the
|
||||||
# series will remove this and the entire code base will be validated.
|
# series will remove this and the entire code base will be validated.
|
||||||
dirs = ["neutron/agent",
|
dirs = ["neutron/agent",
|
||||||
|
"neutron/api",
|
||||||
"neutron/cmd",
|
"neutron/cmd",
|
||||||
"neutron/db",
|
"neutron/db",
|
||||||
"neutron/extensions"]
|
"neutron/extensions"]
|
||||||
|
Loading…
Reference in New Issue
Block a user