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
This commit is contained in:
Inessa Vasilevskaya 2017-04-04 19:14:12 +03:00 committed by Akihiro Motoki
parent c65e541b6e
commit 7322bd6efb
157 changed files with 1270 additions and 1391 deletions

View File

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

View File

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

View File

@ -27,7 +27,7 @@ from oslo_log import log as logging
import six
import tenacity
from neutron._i18n import _, _LE, _LI, _LW
from neutron._i18n import _
from neutron.agent.common import ip_lib
from neutron.agent.common import utils
from neutron.agent.ovsdb import api as ovsdb_api
@ -298,8 +298,8 @@ class OVSBridge(BaseOVS):
"in 1 second. Attempt: %s/10", i)
time.sleep(1)
continue
LOG.error(_LE("Unable to execute %(cmd)s. Exception: "
"%(exception)s"),
LOG.error("Unable to execute %(cmd)s. Exception: "
"%(exception)s",
{'cmd': full_args, 'exception': e})
break
@ -320,7 +320,7 @@ class OVSBridge(BaseOVS):
try:
ofport = self._get_port_val(port_name, "ofport")
except tenacity.RetryError:
LOG.exception(_LE("Timed out retrieving ofport on port %s."),
LOG.exception("Timed out retrieving ofport on port %s.",
port_name)
return ofport
@ -330,7 +330,7 @@ class OVSBridge(BaseOVS):
try:
port_external_ids = self._get_port_val(port_name, "external_ids")
except tenacity.RetryError:
LOG.exception(_LE("Timed out retrieving external_ids on port %s."),
LOG.exception("Timed out retrieving external_ids on port %s.",
port_name)
return port_external_ids
@ -526,10 +526,10 @@ class OVSBridge(BaseOVS):
if_exists=True)
for result in results:
if result['ofport'] == UNASSIGNED_OFPORT:
LOG.warning(_LW("Found not yet ready openvswitch port: %s"),
LOG.warning("Found not yet ready openvswitch port: %s",
result['name'])
elif result['ofport'] == INVALID_OFPORT:
LOG.warning(_LW("Found failed openvswitch port: %s"),
LOG.warning("Found failed openvswitch port: %s",
result['name'])
elif 'attached-mac' in result['external_ids']:
port_id = self.portid_from_external_ids(result['external_ids'])
@ -569,8 +569,8 @@ class OVSBridge(BaseOVS):
for port_id in port_ids:
result[port_id] = None
if port_id not in by_id:
LOG.info(_LI("Port %(port_id)s not present in bridge "
"%(br_name)s"),
LOG.info("Port %(port_id)s not present in bridge "
"%(br_name)s",
{'port_id': port_id, 'br_name': self.br_name})
continue
pinfo = by_id[port_id]
@ -584,8 +584,8 @@ class OVSBridge(BaseOVS):
@staticmethod
def _check_ofport(port_id, port_info):
if port_info['ofport'] in [UNASSIGNED_OFPORT, INVALID_OFPORT]:
LOG.warning(_LW("ofport: %(ofport)s for VIF: %(vif)s "
"is not a positive integer"),
LOG.warning("ofport: %(ofport)s for VIF: %(vif)s "
"is not a positive integer",
{'ofport': port_info['ofport'], 'vif': port_id})
return False
return True
@ -602,7 +602,7 @@ class OVSBridge(BaseOVS):
continue
mac = port['external_ids'].get('attached-mac')
return VifPort(port['name'], port['ofport'], port_id, mac, self)
LOG.info(_LI("Port %(port_id)s not present in bridge %(br_name)s"),
LOG.info("Port %(port_id)s not present in bridge %(br_name)s",
{'port_id': port_id, 'br_name': self.br_name})
def delete_ports(self, all_ports=False):
@ -837,7 +837,7 @@ class DeferredOVSBridge(object):
if exc_type is None:
self.apply_flows()
else:
LOG.exception(_LE("OVS flows could not be applied on bridge %s"),
LOG.exception("OVS flows could not be applied on bridge %s",
self.br.br_name)

View File

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

View File

@ -29,7 +29,7 @@ from oslo_utils import fileutils
from oslo_utils import importutils
import six
from neutron._i18n import _, _LE, _LI, _LW
from neutron._i18n import _
from neutron.agent.linux import dhcp
from neutron.agent.linux import external_process
from neutron.agent.metadata import driver as metadata_driver
@ -120,7 +120,7 @@ class DhcpAgent(manager.Manager):
def after_start(self):
self.run()
LOG.info(_LI("DHCP agent started"))
LOG.info("DHCP agent started")
def run(self):
"""Activate the DHCP agent."""
@ -164,7 +164,7 @@ class DhcpAgent(manager.Manager):
or isinstance(e, exceptions.NetworkNotFound)):
LOG.debug("Network %s has been deleted.", network.id)
else:
LOG.exception(_LE('Unable to %(action)s dhcp for %(net_id)s.'),
LOG.exception('Unable to %(action)s dhcp for %(net_id)s.',
{'net_id': network.id, 'action': action})
def schedule_resync(self, reason, network_id=None):
@ -179,21 +179,21 @@ class DhcpAgent(manager.Manager):
or 'None' is one of the networks, sync all of the networks.
"""
only_nets = set([] if (not networks or None in networks) else networks)
LOG.info(_LI('Synchronizing state'))
LOG.info('Synchronizing state')
pool = eventlet.GreenPool(self.conf.num_sync_threads)
known_network_ids = set(self.cache.get_network_ids())
try:
active_networks = self.plugin_rpc.get_active_networks_info()
LOG.info(_LI('All active networks have been fetched through RPC.'))
LOG.info('All active networks have been fetched through RPC.')
active_network_ids = set(network.id for network in active_networks)
for deleted_id in known_network_ids - active_network_ids:
try:
self.disable_dhcp_helper(deleted_id)
except Exception as e:
self.schedule_resync(e, deleted_id)
LOG.exception(_LE('Unable to sync network state on '
'deleted network %s'), deleted_id)
LOG.exception('Unable to sync network state on '
'deleted network %s', deleted_id)
for network in active_networks:
if (not only_nets or # specifically resync all
@ -204,7 +204,7 @@ class DhcpAgent(manager.Manager):
# we notify all ports in case some were created while the agent
# was down
self.dhcp_ready_ports |= set(self.cache.get_port_ids(only_nets))
LOG.info(_LI('Synchronizing state complete'))
LOG.info('Synchronizing state complete')
except Exception as e:
if only_nets:
@ -212,7 +212,7 @@ class DhcpAgent(manager.Manager):
self.schedule_resync(e, network_id)
else:
self.schedule_resync(e)
LOG.exception(_LE('Unable to sync network state.'))
LOG.exception('Unable to sync network state.')
def _dhcp_ready_ports_loop(self):
"""Notifies the server of any ports that had reservations setup."""
@ -226,12 +226,12 @@ class DhcpAgent(manager.Manager):
self.plugin_rpc.dhcp_ready_on_ports(ports_to_send)
continue
except oslo_messaging.MessagingTimeout:
LOG.error(_LE("Timeout notifying server of ports ready. "
"Retrying..."))
LOG.error("Timeout notifying server of ports ready. "
"Retrying...")
except Exception:
LOG.exception(_LE("Failure notifying DHCP server of "
"ready DHCP ports. Will retry on next "
"iteration."))
LOG.exception("Failure notifying DHCP server of "
"ready DHCP ports. Will retry on next "
"iteration.")
self.dhcp_ready_ports |= ports_to_send
def start_ready_ports_loop(self):
@ -267,7 +267,7 @@ class DhcpAgent(manager.Manager):
return network
except Exception as e:
self.schedule_resync(e, network_id)
LOG.exception(_LE('Network %s info call failed.'), network_id)
LOG.exception('Network %s info call failed.', network_id)
def enable_dhcp_helper(self, network_id):
"""Enable DHCP for a network that meets enabling criteria."""
@ -279,12 +279,12 @@ class DhcpAgent(manager.Manager):
def safe_configure_dhcp_for_network(self, network):
try:
network_id = network.get('id')
LOG.info(_LI('Starting network %s dhcp configuration'), network_id)
LOG.info('Starting network %s dhcp configuration', network_id)
self.configure_dhcp_for_network(network)
LOG.info(_LI('Finished network %s dhcp configuration'), network_id)
LOG.info('Finished network %s dhcp configuration', network_id)
except (exceptions.NetworkNotFound, RuntimeError):
LOG.warning(_LW('Network %s may have been deleted and '
'its resources may have already been disposed.'),
LOG.warning('Network %s may have been deleted and '
'its resources may have already been disposed.',
network.id)
def configure_dhcp_for_network(self, network):
@ -411,7 +411,7 @@ class DhcpAgent(manager.Manager):
network = self.cache.get_network_by_id(updated_port.network_id)
if not network:
return
LOG.info(_LI("Trigger reload_allocations for port %s"),
LOG.info("Trigger reload_allocations for port %s",
updated_port)
driver_action = 'reload_allocations'
if self._is_port_on_this_agent(updated_port):
@ -498,10 +498,10 @@ class DhcpAgent(manager.Manager):
if router_ports:
# Multiple router ports should not be allowed
if len(router_ports) > 1:
LOG.warning(_LW("%(port_num)d router ports found on the "
"metadata access network. Only the port "
"%(port_id)s, for router %(router_id)s "
"will be considered"),
LOG.warning("%(port_num)d router ports found on the "
"metadata access network. Only the port "
"%(port_id)s, for router %(router_id)s "
"will be considered",
{'port_num': len(router_ports),
'port_id': router_ports[0].id,
'router_id': router_ports[0].device_id})
@ -733,18 +733,18 @@ class DhcpAgentWithStateReport(DhcpAgent):
agent_status = self.state_rpc.report_state(
ctx, self.agent_state, True)
if agent_status == n_const.AGENT_REVIVED:
LOG.info(_LI("Agent has just been revived. "
"Scheduling full sync"))
LOG.info("Agent has just been revived. "
"Scheduling full sync")
self.schedule_resync("Agent has just been revived")
except AttributeError:
# This means the server does not support report_state
LOG.warning(_LW("Neutron server does not support state report. "
"State report for this agent will be disabled."))
LOG.warning("Neutron server does not support state report. "
"State report for this agent will be disabled.")
self.heartbeat.stop()
self.run()
return
except Exception:
LOG.exception(_LE("Failed reporting state!"))
LOG.exception("Failed reporting state!")
return
if self.agent_state.pop('start_flag', None):
self.run()
@ -753,7 +753,7 @@ class DhcpAgentWithStateReport(DhcpAgent):
"""Handle the agent_updated notification event."""
self.schedule_resync(_("Agent updated: %(payload)s") %
{"payload": payload})
LOG.info(_LI("agent_updated by server side %s!"), payload)
LOG.info("agent_updated by server side %s!", payload)
def after_start(self):
LOG.info(_LI("DHCP agent started"))
LOG.info("DHCP agent started")

View File

@ -20,7 +20,6 @@ from neutron_lib.utils import helpers
from oslo_config import cfg
from oslo_log import log as logging
from neutron._i18n import _LE, _LW
from neutron.agent.l2 import l2_agent_extension
from neutron.agent.linux import bridge_lib
from neutron.conf.agent import l2_ext_fdb_population
@ -73,9 +72,9 @@ class FdbPopulationAgentExtension(
try:
_stdout = bridge_lib.FdbInterface.show(device)
except RuntimeError as e:
LOG.warning(_LW(
LOG.warning(
'Unable to find FDB Interface %(device)s. '
'Exception: %(e)s'), {'device': device, 'e': e})
'Exception: %(e)s', {'device': device, 'e': e})
continue
self.device_to_macs[device] = _stdout.split()[::3]
@ -94,10 +93,10 @@ class FdbPopulationAgentExtension(
try:
bridge_lib.FdbInterface.add(mac, device)
except RuntimeError as e:
LOG.warning(_LW(
LOG.warning(
'Unable to add mac %(mac)s '
'to FDB Interface %(device)s. '
'Exception: %(e)s'),
'Exception: %(e)s',
{'mac': mac, 'device': device, 'e': e})
return
self.device_to_macs[device].append(mac)
@ -105,19 +104,19 @@ class FdbPopulationAgentExtension(
def delete_port(self, devices, port_id):
mac = self.portid_to_mac.get(port_id)
if mac is None:
LOG.warning(_LW('Port Id %(port_id)s does not have a rule for '
'devices %(devices)s in FDB table'),
{'port_id': port_id, 'devices': devices})
LOG.warning('Port Id %(port_id)s does not have a rule for '
'devices %(devices)s in FDB table',
{'port_id': port_id, 'devices': devices})
return
for device in devices:
if mac in self.device_to_macs[device]:
try:
bridge_lib.FdbInterface.delete(mac, device)
except RuntimeError as e:
LOG.warning(_LW(
LOG.warning(
'Unable to delete mac %(mac)s '
'from FDB Interface %(device)s. '
'Exception: %(e)s'),
'Exception: %(e)s',
{'mac': mac, 'device': device, 'e': e})
return
self.device_to_macs[device].remove(mac)
@ -129,17 +128,17 @@ class FdbPopulationAgentExtension(
valid_driver_types = (linux_bridge_constants.EXTENSION_DRIVER_TYPE,
ovs_constants.EXTENSION_DRIVER_TYPE)
if driver_type not in valid_driver_types:
LOG.error(_LE('FDB extension is only supported for OVS and '
'linux bridge agent, currently uses '
'%(driver_type)s'), {'driver_type': driver_type})
LOG.error('FDB extension is only supported for OVS and '
'linux bridge agent, currently uses '
'%(driver_type)s', {'driver_type': driver_type})
sys.exit(1)
self.device_mappings = helpers.parse_mappings(
cfg.CONF.FDB.shared_physical_device_mappings, unique_keys=False)
devices = self._get_devices()
if not devices:
LOG.error(_LE('Invalid configuration provided for FDB extension: '
'no physical devices'))
LOG.error('Invalid configuration provided for FDB extension: '
'no physical devices')
sys.exit(1)
self.fdb_tracker = self.FdbTableTracker(devices)

View File

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

View File

@ -12,7 +12,6 @@
from oslo_log import log
from neutron._i18n import _LE
from neutron.agent import agent_extensions_manager as agent_ext_manager
from neutron.conf.agent import agent_extensions_manager as agent_ext_mgr_config
@ -43,8 +42,8 @@ class L2AgentExtensionsManager(agent_ext_manager.AgentExtensionsManager):
extension.obj.handle_port(context, data)
else:
LOG.error(
_LE("Agent Extension '%(name)s' does not "
"implement method handle_port"),
"Agent Extension '%(name)s' does not "
"implement method handle_port",
{'name': extension.name}
)
@ -55,7 +54,7 @@ class L2AgentExtensionsManager(agent_ext_manager.AgentExtensionsManager):
extension.obj.delete_port(context, data)
else:
LOG.error(
_LE("Agent Extension '%(name)s' does not "
"implement method delete_port"),
"Agent Extension '%(name)s' does not "
"implement method delete_port",
{'name': extension.name}
)

View File

@ -33,7 +33,7 @@ from oslo_utils import excutils
from oslo_utils import timeutils
from osprofiler import profiler
from neutron._i18n import _, _LE, _LI, _LW
from neutron._i18n import _
from neutron.agent.common import utils as common_utils
from neutron.agent.l3 import dvr
from neutron.agent.l3 import dvr_edge_ha_router
@ -221,20 +221,20 @@ class L3NATAgent(ha.AgentMixin,
self.neutron_service_plugins = (
self.plugin_rpc.get_service_plugin_list(self.context))
except oslo_messaging.RemoteError as e:
LOG.warning(_LW('l3-agent cannot check service plugins '
'enabled at the neutron server when '
'startup due to RPC error. It happens '
'when the server does not support this '
'RPC API. If the error is '
'UnsupportedVersion you can ignore this '
'warning. Detail message: %s'), e)
LOG.warning('l3-agent cannot check service plugins '
'enabled at the neutron server when '
'startup due to RPC error. It happens '
'when the server does not support this '
'RPC API. If the error is '
'UnsupportedVersion you can ignore this '
'warning. Detail message: %s', e)
self.neutron_service_plugins = None
except oslo_messaging.MessagingTimeout as e:
LOG.warning(_LW('l3-agent cannot contact neutron server '
'to retrieve service plugins enabled. '
'Check connectivity to neutron server. '
'Retrying... '
'Detailed message: %(msg)s.'), {'msg': e})
LOG.warning('l3-agent cannot contact neutron server '
'to retrieve service plugins enabled. '
'Check connectivity to neutron server. '
'Retrying... '
'Detailed message: %(msg)s.', {'msg': e})
continue
break
@ -272,15 +272,15 @@ class L3NATAgent(ha.AgentMixin,
The actual values are not verified for correctness.
"""
if not self.conf.interface_driver:
msg = _LE('An interface driver must be specified')
msg = 'An interface driver must be specified'
LOG.error(msg)
raise SystemExit(1)
if self.conf.ipv6_gateway:
# ipv6_gateway configured. Check for valid v6 link-local address.
try:
msg = _LE("%s used in config as ipv6_gateway is not a valid "
"IPv6 link-local address."),
msg = ("%s used in config as ipv6_gateway is not a valid "
"IPv6 link-local address.")
ip_addr = netaddr.IPAddress(self.conf.ipv6_gateway)
if ip_addr.version != 6 or not ip_addr.is_link_local():
LOG.error(msg, self.conf.ipv6_gateway)
@ -361,13 +361,13 @@ class L3NATAgent(ha.AgentMixin,
except Exception:
with excutils.save_and_reraise_exception():
del self.router_info[router_id]
LOG.exception(_LE('Error while initializing router %s'),
LOG.exception('Error while initializing router %s',
router_id)
self.namespaces_manager.ensure_router_cleanup(router_id)
try:
ri.delete()
except Exception:
LOG.exception(_LE('Error while deleting router %s'),
LOG.exception('Error while deleting router %s',
router_id)
def _safe_router_removed(self, router_id):
@ -377,7 +377,7 @@ class L3NATAgent(ha.AgentMixin,
self._router_removed(router_id)
self.l3_ext_manager.delete_router(self.context, router_id)
except Exception:
LOG.exception(_LE('Error while deleting router %s'), router_id)
LOG.exception('Error while deleting router %s', router_id)
return False
else:
return True
@ -385,8 +385,8 @@ class L3NATAgent(ha.AgentMixin,
def _router_removed(self, router_id):
ri = self.router_info.get(router_id)
if ri is None:
LOG.warning(_LW("Info for router %s was not found. "
"Performing router cleanup"), router_id)
LOG.warning("Info for router %s was not found. "
"Performing router cleanup", router_id)
self.namespaces_manager.ensure_router_cleanup(router_id)
return
@ -451,7 +451,7 @@ class L3NATAgent(ha.AgentMixin,
def _process_router_if_compatible(self, router):
if (self.conf.external_network_bridge and
not ip_lib.device_exists(self.conf.external_network_bridge)):
LOG.error(_LE("The external network bridge '%s' does not exist"),
LOG.error("The external network bridge '%s' does not exist",
self.conf.external_network_bridge)
return
@ -513,7 +513,7 @@ class L3NATAgent(ha.AgentMixin,
routers = self.plugin_rpc.get_routers(self.context,
[update.id])
except Exception:
msg = _LE("Failed to fetch router information for '%s'")
msg = "Failed to fetch router information for '%s'"
LOG.exception(msg, update.id)
self._resync_router(update)
continue
@ -540,12 +540,12 @@ class L3NATAgent(ha.AgentMixin,
log_verbose_exc(e.msg, router)
# Was the router previously handled by this agent?
if router['id'] in self.router_info:
LOG.error(_LE("Removing incompatible router '%s'"),
LOG.error("Removing incompatible router '%s'",
router['id'])
self._safe_router_removed(router['id'])
except Exception:
log_verbose_exc(
_LE("Failed to process compatible router: %s") % update.id,
"Failed to process compatible router: %s" % update.id,
router)
self._resync_router(update)
continue
@ -632,20 +632,20 @@ class L3NATAgent(ha.AgentMixin,
self.sync_routers_chunk_size = max(
self.sync_routers_chunk_size / 2,
SYNC_ROUTERS_MIN_CHUNK_SIZE)
LOG.error(_LE('Server failed to return info for routers in '
'required time, decreasing chunk size to: %s'),
LOG.error('Server failed to return info for routers in '
'required time, decreasing chunk size to: %s',
self.sync_routers_chunk_size)
else:
LOG.error(_LE('Server failed to return info for routers in '
'required time even with min chunk size: %s. '
'It might be under very high load or '
'just inoperable'),
LOG.error('Server failed to return info for routers in '
'required time even with min chunk size: %s. '
'It might be under very high load or '
'just inoperable',
self.sync_routers_chunk_size)
raise
except oslo_messaging.MessagingException:
failed_routers = chunk or router_ids
LOG.exception(_LE("Failed synchronizing routers '%s' "
"due to RPC error"), failed_routers)
LOG.exception("Failed synchronizing routers '%s' "
"due to RPC error", failed_routers)
raise n_exc.AbortSyncRouters()
self.fullsync = False
@ -679,7 +679,7 @@ class L3NATAgent(ha.AgentMixin,
# can have L3NATAgentWithStateReport as its base class instead of
# L3NATAgent.
eventlet.spawn_n(self._process_routers_loop)
LOG.info(_LI("L3 agent started"))
LOG.info("L3 agent started")
def create_pd_router_update(self):
router_id = None
@ -741,22 +741,22 @@ class L3NATAgentWithStateReport(L3NATAgent):
self.agent_state,
True)
if agent_status == l3_constants.AGENT_REVIVED:
LOG.info(_LI('Agent has just been revived. '
'Doing a full sync.'))
LOG.info('Agent has just been revived. '
'Doing a full sync.')
self.fullsync = True
self.agent_state.pop('start_flag', None)
except AttributeError:
# This means the server does not support report_state
LOG.warning(_LW("Neutron server does not support state report. "
"State report for this agent will be disabled."))
LOG.warning("Neutron server does not support state report. "
"State report for this agent will be disabled.")
self.heartbeat.stop()
return
except Exception:
LOG.exception(_LE("Failed reporting state!"))
LOG.exception("Failed reporting state!")
def after_start(self):
eventlet.spawn_n(self._process_routers_loop)
LOG.info(_LI("L3 agent started"))
LOG.info("L3 agent started")
# Do the report state before we do the first full sync.
self._report_state()
@ -765,4 +765,4 @@ class L3NATAgentWithStateReport(L3NATAgent):
def agent_updated(self, context, payload):
"""Handle the agent_updated notification event."""
self.fullsync = True
LOG.info(_LI("agent_updated by server side %s!"), payload)
LOG.info("agent_updated by server side %s!", payload)

View File

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

View File

@ -20,7 +20,7 @@ from oslo_concurrency import lockutils
from oslo_log import log as logging
from oslo_utils import excutils
from neutron._i18n import _, _LE, _LW
from neutron._i18n import _
from neutron.agent.l3 import fip_rule_priority_allocator as frpa
from neutron.agent.l3 import link_local_allocator as lla
from neutron.agent.l3 import namespaces
@ -117,8 +117,8 @@ class FipNamespace(namespaces.Namespace):
yield
except Exception:
with excutils.save_and_reraise_exception():
LOG.error(_LE('DVR: FIP namespace config failure '
'for interface %s'), interface_name)
LOG.error('DVR: FIP namespace config failure '
'for interface %s', interface_name)
def create_or_update_gateway_port(self, agent_gateway_port):
interface_name = self.get_ext_device_name(agent_gateway_port['id'])
@ -147,8 +147,8 @@ class FipNamespace(namespaces.Namespace):
with excutils.save_and_reraise_exception():
self.unsubscribe(agent_gateway_port['network_id'])
self.delete()
LOG.exception(_LE('DVR: Gateway update in '
'FIP namespace failed'))
LOG.exception('DVR: Gateway update in '
'FIP namespace failed')
def _create_gateway_port(self, ex_gw_port, interface_name):
"""Create namespace, request port creationg from Plugin,
@ -296,8 +296,8 @@ class FipNamespace(namespaces.Namespace):
with excutils.save_and_reraise_exception():
self.unsubscribe(self.agent_gateway_port['network_id'])
self.agent_gateway_port = None
LOG.exception(_LE('DVR: Gateway setup in FIP namespace '
'failed'))
LOG.exception('DVR: Gateway setup in FIP namespace '
'failed')
# Now add the filter match rule for the table.
ip_rule = ip_lib.IPRule(namespace=self.get_name())
@ -328,10 +328,10 @@ class FipNamespace(namespaces.Namespace):
# throw exceptions. Unsubscribe this external network so that
# the next call will trigger the interface to be plugged.
if not ipd.exists():
LOG.warning(_LW('DVR: FIP gateway port with interface '
'name: %(device)s does not exist in the given '
'namespace: %(ns)s'), {'device': interface_name,
'ns': ns_name})
LOG.warning('DVR: FIP gateway port with interface '
'name: %(device)s does not exist in the given '
'namespace: %(ns)s', {'device': interface_name,
'ns': ns_name})
msg = _('DVR: Gateway update route in FIP namespace failed, retry '
'should be attempted on next call')
raise n_exc.FloatingIpSetupException(msg)

View File

@ -22,7 +22,6 @@ from oslo_log import log as logging
from oslo_utils import excutils
import six
from neutron._i18n import _LE, _LW
from neutron.agent.l3 import dvr_fip_ns
from neutron.agent.l3 import dvr_router_base
from neutron.agent.linux import ip_lib
@ -239,16 +238,16 @@ class DvrLocalRouter(dvr_router_base.DvrRouterBase):
return True
else:
if operation == 'add':
LOG.warning(_LW("Device %s does not exist so ARP entry "
"cannot be updated, will cache "
"information to be applied later "
"when the device exists"),
LOG.warning("Device %s does not exist so ARP entry "
"cannot be updated, will cache "
"information to be applied later "
"when the device exists",
device)
self._cache_arp_entry(ip, mac, subnet_id, operation)
return False
except Exception:
with excutils.save_and_reraise_exception():
LOG.exception(_LE("DVR: Failed updating arp entry"))
LOG.exception("DVR: Failed updating arp entry")
def _set_subnet_arp_info(self, subnet_id):
"""Set ARP info retrieved from Plugin for existing ports."""
@ -356,10 +355,10 @@ class DvrLocalRouter(dvr_router_base.DvrRouterBase):
priority=snat_idx)
except Exception:
if is_add:
exc = _LE('DVR: error adding redirection logic')
exc = 'DVR: error adding redirection logic'
else:
exc = _LE('DVR: snat remove failed to clear the rule '
'and device')
exc = ('DVR: snat remove failed to clear the rule '
'and device')
LOG.exception(exc)
def _snat_redirect_add(self, gateway, sn_port, sn_int):

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -15,7 +15,6 @@
from oslo_log import log
from neutron._i18n import _LE
from neutron.agent import agent_extensions_manager as agent_ext_manager
from neutron.conf.agent import agent_extensions_manager as agent_ext_mgr_config
@ -43,8 +42,8 @@ class L3AgentExtensionsManager(agent_ext_manager.AgentExtensionsManager):
extension.obj.add_router(context, data)
else:
LOG.error(
_LE("Agent Extension '%(name)s' does not "
"implement method add_router"),
"Agent Extension '%(name)s' does not "
"implement method add_router",
{'name': extension.name}
)
@ -55,8 +54,8 @@ class L3AgentExtensionsManager(agent_ext_manager.AgentExtensionsManager):
extension.obj.update_router(context, data)
else:
LOG.error(
_LE("Agent Extension '%(name)s' does not "
"implement method update_router"),
"Agent Extension '%(name)s' does not "
"implement method update_router",
{'name': extension.name}
)
@ -67,7 +66,7 @@ class L3AgentExtensionsManager(agent_ext_manager.AgentExtensionsManager):
extension.obj.delete_router(context, data)
else:
LOG.error(
_LE("Agent Extension '%(name)s' does not "
"implement method delete_router"),
"Agent Extension '%(name)s' does not "
"implement method delete_router",
{'name': extension.name}
)

View File

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

View File

@ -18,7 +18,6 @@ import functools
from oslo_log import log as logging
from oslo_utils import excutils
from neutron._i18n import _LE, _LW
from neutron.agent.linux import ip_lib
LOG = logging.getLogger(__name__)
@ -65,8 +64,8 @@ def check_ns_existence(f):
@functools.wraps(f)
def wrapped(self, *args, **kwargs):
if not self.exists():
LOG.warning(_LW('Namespace %(name)s does not exist. Skipping '
'%(func)s'),
LOG.warning('Namespace %(name)s does not exist. Skipping '
'%(func)s',
{'name': self.name, 'func': f.__name__})
return
try:
@ -111,7 +110,7 @@ class Namespace(object):
try:
self.ip_wrapper_root.netns.delete(self.name)
except RuntimeError:
msg = _LE('Failed trying to delete namespace: %s')
msg = 'Failed trying to delete namespace: %s'
LOG.exception(msg, self.name)
def exists(self):

View File

@ -19,7 +19,7 @@ from neutron_lib import constants as lib_constants
from neutron_lib.utils import helpers
from oslo_log import log as logging
from neutron._i18n import _, _LE, _LW
from neutron._i18n import _
from neutron.agent.l3 import namespaces
from neutron.agent.linux import ip_lib
from neutron.agent.linux import iptables_manager
@ -298,8 +298,8 @@ class RouterInfo(object):
except RuntimeError:
# any exception occurred here should cause the floating IP
# to be set in error state
LOG.warning(_LW("Unable to configure IP address for "
"floating IP: %s"), fip['id'])
LOG.warning("Unable to configure IP address for "
"floating IP: %s", fip['id'])
def add_floating_ip(self, fip, interface_name, device):
raise NotImplementedError()
@ -882,7 +882,7 @@ class RouterInfo(object):
except n_exc.FloatingIpSetupException:
# All floating IPs must be put in error state
LOG.exception(_LE("Failed to process floating IPs."))
LOG.exception("Failed to process floating IPs.")
fip_statuses = self.put_fips_in_error_state()
finally:
self.update_fip_statuses(fip_statuses)
@ -908,7 +908,7 @@ class RouterInfo(object):
except (n_exc.FloatingIpSetupException,
n_exc.IpTablesApplyException):
# All floating IPs must be put in error state
LOG.exception(_LE("Failed to process floating IPs."))
LOG.exception("Failed to process floating IPs.")
fip_statuses = self.put_fips_in_error_state()
finally:
self.update_fip_statuses(fip_statuses)
@ -1102,8 +1102,8 @@ class RouterInfo(object):
self.agent.pd.sync_router(self.router['id'])
self._process_external_on_delete()
else:
LOG.warning(_LW("Can't gracefully delete the router %s: "
"no router namespace found."), self.router['id'])
LOG.warning("Can't gracefully delete the router %s: "
"no router namespace found.", self.router['id'])
@common_utils.exception_logger()
def process(self):

View File

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

View File

@ -25,7 +25,7 @@ import sys
from debtcollector import removals
from oslo_log import log as logging
from neutron._i18n import _, _LE, _LI
from neutron._i18n import _
from neutron.common import exceptions
LOG = logging.getLogger(__name__)
@ -113,7 +113,7 @@ def drop_privileges(user=None, group=None):
if user is not None:
setuid(user)
LOG.info(_LI("Process runs with uid/gid: %(uid)s/%(gid)s"),
LOG.info("Process runs with uid/gid: %(uid)s/%(gid)s",
{'uid': os.getuid(), 'gid': os.getgid()})
@ -126,7 +126,7 @@ class Pidfile(object):
self.fd = os.open(pidfile, os.O_CREAT | os.O_RDWR)
fcntl.flock(self.fd, fcntl.LOCK_EX | fcntl.LOCK_NB)
except IOError:
LOG.exception(_LE("Error while handling pidfile: %s"), pidfile)
LOG.exception("Error while handling pidfile: %s", pidfile)
sys.exit(1)
def __str__(self):
@ -191,7 +191,7 @@ class Daemon(object):
if pid > 0:
os._exit(0)
except OSError:
LOG.exception(_LE('Fork failed'))
LOG.exception('Fork failed')
sys.exit(1)
def daemonize(self):
@ -244,8 +244,8 @@ class Daemon(object):
if self.pidfile is not None and self.pidfile.is_running():
self.pidfile.unlock()
LOG.error(_LE('Pidfile %s already exist. Daemon already '
'running?'), self.pidfile)
LOG.error('Pidfile %s already exist. Daemon already '
'running?', self.pidfile)
sys.exit(1)
# Start the daemon

View File

@ -32,7 +32,7 @@ from oslo_utils import fileutils
from oslo_utils import uuidutils
import six
from neutron._i18n import _, _LI, _LW, _LE
from neutron._i18n import _
from neutron.agent.common import utils as agent_common_utils
from neutron.agent.linux import external_process
from neutron.agent.linux import ip_lib
@ -238,7 +238,7 @@ class DhcpLocalProcess(DhcpBase):
try:
self.device_manager.destroy(self.network, self.interface_name)
except RuntimeError:
LOG.warning(_LW('Failed trying to delete interface: %s'),
LOG.warning('Failed trying to delete interface: %s',
self.interface_name)
ns_ip = ip_lib.IPWrapper(namespace=self.network.namespace)
@ -248,7 +248,7 @@ class DhcpLocalProcess(DhcpBase):
try:
ns_ip.netns.delete(self.network.namespace)
except RuntimeError:
LOG.warning(_LW('Failed trying to delete namespace: %s'),
LOG.warning('Failed trying to delete namespace: %s',
self.network.namespace)
def _get_value_from_conf_file(self, kind, converter=None):
@ -421,8 +421,7 @@ class Dnsmasq(DhcpLocalProcess):
if not os.path.exists(log_dir):
os.makedirs(log_dir)
except OSError:
LOG.error(_LE('Error while create dnsmasq log dir: %s'),
log_dir)
LOG.error('Error while create dnsmasq log dir: %s', log_dir)
else:
log_filename = os.path.join(log_dir, 'dhcp_dns_log')
cmd.append('--log-queries')
@ -460,8 +459,8 @@ class Dnsmasq(DhcpLocalProcess):
if self._IS_DHCP_RELEASE6_SUPPORTED is None:
self._IS_DHCP_RELEASE6_SUPPORTED = checks.dhcp_release6_supported()
if not self._IS_DHCP_RELEASE6_SUPPORTED:
LOG.warning(_LW("dhcp_release6 is not present on this system, "
"will not call it again."))
LOG.warning("dhcp_release6 is not present on this system, "
"will not call it again.")
return self._IS_DHCP_RELEASE6_SUPPORTED
def _release_lease(self, mac_address, ip, client_id=None,
@ -483,8 +482,8 @@ class Dnsmasq(DhcpLocalProcess):
except RuntimeError as e:
# when failed to release single lease there's
# no need to propagate error further
LOG.warning(_LW('DHCP release failed for %(cmd)s. '
'Reason: %(e)s'), {'cmd': cmd, 'e': e})
LOG.warning('DHCP release failed for %(cmd)s. '
'Reason: %(e)s', {'cmd': cmd, 'e': e})
def _output_config_files(self):
self._output_hosts_file()
@ -798,9 +797,9 @@ class Dnsmasq(DhcpLocalProcess):
server_id = l.strip().split()[1]
continue
else:
LOG.warning(_LW('Multiple DUID entries in %s '
'lease file, dnsmasq is possibly '
'not functioning properly'),
LOG.warning('Multiple DUID entries in %s '
'lease file, dnsmasq is possibly '
'not functioning properly',
filename)
continue
parts = l.strip().split()
@ -969,9 +968,9 @@ class Dnsmasq(DhcpLocalProcess):
self._format_option(opt_ip_version, port.id,
opt.opt_name, opt.opt_value))
else:
LOG.info(_LI("Cannot apply dhcp option %(opt)s "
"because it's ip_version %(version)d "
"is not in port's address IP versions"),
LOG.info("Cannot apply dhcp option %(opt)s "
"because it's ip_version %(version)d "
"is not in port's address IP versions",
{'opt': opt.opt_name,
'version': opt_ip_version})
@ -1269,8 +1268,8 @@ class DeviceManager(object):
'device_id': device_id}})
except oslo_messaging.RemoteError as e:
if e.exc_type == 'DhcpPortInUse':
LOG.info(_LI("Skipping DHCP port %s as it is "
"already in use"), port.id)
LOG.info("Skipping DHCP port %s as it is "
"already in use", port.id)
continue
raise
if port:
@ -1374,8 +1373,8 @@ class DeviceManager(object):
try:
self.unplug(d.name, network)
except Exception:
LOG.exception(_LE("Exception during stale "
"dhcp device cleanup"))
LOG.exception("Exception during stale "
"dhcp device cleanup")
def plug(self, network, port, interface_name):
"""Plug device settings for the network's DHCP on this host."""
@ -1424,8 +1423,8 @@ class DeviceManager(object):
self.plug(network, port, interface_name)
except Exception:
with excutils.save_and_reraise_exception():
LOG.exception(_LE('Unable to plug DHCP port for '
'network %s. Releasing port.'),
LOG.exception('Unable to plug DHCP port for '
'network %s. Releasing port.',
network.id)
self.plugin.release_dhcp_port(network.id, port.device_id)

View File

@ -24,7 +24,7 @@ from oslo_utils import fileutils
import psutil
import six
from neutron._i18n import _, _LW, _LE
from neutron._i18n import _
from neutron.agent.linux import ip_lib
from neutron.agent.linux import utils
@ -237,9 +237,9 @@ class ProcessMonitor(object):
pm = self._monitored_processes.get(service_id)
if pm and not pm.active:
LOG.error(_LE("%(service)s for %(resource_type)s "
"with uuid %(uuid)s not found. "
"The process should not have died"),
LOG.error("%(service)s for %(resource_type)s "
"with uuid %(uuid)s not found. "
"The process should not have died",
{'service': service_id.service,
'resource_type': self._resource_type,
'uuid': service_id.uuid})
@ -257,14 +257,14 @@ class ProcessMonitor(object):
action_function(service_id)
def _respawn_action(self, service_id):
LOG.warning(_LW("Respawning %(service)s for uuid %(uuid)s"),
LOG.warning("Respawning %(service)s for uuid %(uuid)s",
{'service': service_id.service,
'uuid': service_id.uuid})
self._monitored_processes[service_id].enable()
def _exit_action(self, service_id):
LOG.error(_LE("Exiting agent as programmed in check_child_processes_"
"actions"))
LOG.error("Exiting agent as programmed in check_child_processes_"
"actions")
self._exit_handler(service_id.uuid, service_id.service)
def _exit_handler(self, uuid, service):
@ -274,7 +274,7 @@ class ProcessMonitor(object):
check_child_processes_actions, and one of our external processes die
unexpectedly.
"""
LOG.error(_LE("Exiting agent because of a malfunction with the "
"%(service)s process identified by uuid %(uuid)s"),
LOG.error("Exiting agent because of a malfunction with the "
"%(service)s process identified by uuid %(uuid)s",
{'service': service, 'uuid': uuid})
raise SystemExit(1)

View File

@ -22,7 +22,7 @@ from oslo_config import cfg
from oslo_log import log as logging
import six
from neutron._i18n import _, _LE, _LI, _LW
from neutron._i18n import _
from neutron.agent.common import ovs_lib
from neutron.agent.linux import ip_lib
from neutron.agent.linux import utils
@ -265,12 +265,12 @@ class LinuxInterfaceDriver(object):
self.plug_new(network_id, port_id, device_name, mac_address,
bridge, namespace, prefix, mtu)
else:
LOG.info(_LI("Device %s already exists"), device_name)
LOG.info("Device %s already exists", device_name)
if mtu:
self.set_mtu(
device_name, mtu, namespace=namespace, prefix=prefix)
else:
LOG.warning(_LW("No MTU configured for port %s"), port_id)
LOG.warning("No MTU configured for port %s", port_id)
@abc.abstractmethod
def unplug(self, device_name, bridge=None, namespace=None, prefix=None):
@ -296,7 +296,7 @@ class LinuxInterfaceDriver(object):
def set_mtu(self, device_name, mtu, namespace=None, prefix=None):
"""Set MTU on the interface."""
if not self._mtu_update_warn_logged:
LOG.warning(_LW("Interface driver cannot update MTU for ports"))
LOG.warning("Interface driver cannot update MTU for ports")
self._mtu_update_warn_logged = True
@ -367,7 +367,7 @@ class OVSInterfaceDriver(LinuxInterfaceDriver):
ns_dev.link.set_address(mac_address)
break
except RuntimeError as e:
LOG.warning(_LW("Got error trying to set mac, retrying: %s"),
LOG.warning("Got error trying to set mac, retrying: %s",
str(e))
time.sleep(1)
else:
@ -386,7 +386,7 @@ class OVSInterfaceDriver(LinuxInterfaceDriver):
if mtu:
self.set_mtu(device_name, mtu, namespace=namespace, prefix=prefix)
else:
LOG.warning(_LW("No MTU configured for port %s"), port_id)
LOG.warning("No MTU configured for port %s", port_id)
ns_dev.link.set_up()
if self.conf.ovs_use_veth:
@ -408,7 +408,7 @@ class OVSInterfaceDriver(LinuxInterfaceDriver):
device.link.delete()
LOG.debug("Unplugged interface '%s'", device_name)
except RuntimeError:
LOG.error(_LE("Failed unplugging interface '%s'"),
LOG.error("Failed unplugging interface '%s'",
device_name)
def set_mtu(self, device_name, mtu, namespace=None, prefix=None):
@ -458,7 +458,7 @@ class IVSInterfaceDriver(LinuxInterfaceDriver):
ns_dev.link.set_mtu(mtu)
root_dev.link.set_mtu(mtu)
else:
LOG.warning(_LW("No MTU configured for port %s"), port_id)
LOG.warning("No MTU configured for port %s", port_id)
if namespace:
namespace_obj = ip.ensure_namespace(namespace)
@ -477,7 +477,7 @@ class IVSInterfaceDriver(LinuxInterfaceDriver):
device.link.delete()
LOG.debug("Unplugged interface '%s'", device_name)
except RuntimeError:
LOG.error(_LE("Failed unplugging interface '%s'"),
LOG.error("Failed unplugging interface '%s'",
device_name)
@ -503,7 +503,7 @@ class BridgeInterfaceDriver(LinuxInterfaceDriver):
if mtu:
self.set_mtu(device_name, mtu, namespace=namespace, prefix=prefix)
else:
LOG.warning(_LW("No MTU configured for port %s"), port_id)
LOG.warning("No MTU configured for port %s", port_id)
root_veth.link.set_up()
ns_veth.link.set_up()
@ -515,7 +515,7 @@ class BridgeInterfaceDriver(LinuxInterfaceDriver):
device.link.delete()
LOG.debug("Unplugged interface '%s'", device_name)
except RuntimeError:
LOG.error(_LE("Failed unplugging interface '%s'"),
LOG.error("Failed unplugging interface '%s'",
device_name)
def set_mtu(self, device_name, mtu, namespace=None, prefix=None):

View File

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

View File

@ -27,7 +27,7 @@ from oslo_log import log as logging
from oslo_utils import excutils
import six
from neutron._i18n import _, _LE, _LW
from neutron._i18n import _
from neutron.agent.common import utils
from neutron.common import exceptions as n_exc
from neutron.common import utils as common_utils
@ -326,8 +326,8 @@ class IPDevice(SubProcessBase):
extra_ok_codes=[1])
except RuntimeError:
LOG.exception(_LE("Failed deleting ingress connection state of"
" floatingip %s"), ip_str)
LOG.exception("Failed deleting ingress connection state of"
" floatingip %s", ip_str)
# Delete conntrack state for egress traffic
try:
@ -335,8 +335,8 @@ class IPDevice(SubProcessBase):
check_exit_code=True,
extra_ok_codes=[1])
except RuntimeError:
LOG.exception(_LE("Failed deleting egress connection state of"
" floatingip %s"), ip_str)
LOG.exception("Failed deleting egress connection state of"
" floatingip %s", ip_str)
def disable_ipv6(self):
sysctl_name = re.sub(r'\.', '/', self.name)
@ -1100,8 +1100,8 @@ def _arping(ns_name, iface_name, address, count, log_exception):
'ns': ns_name,
'err': exc})
if not exists:
LOG.warning(_LW("Interface %s might have been deleted "
"concurrently"), iface_name)
LOG.warning("Interface %s might have been deleted "
"concurrently", iface_name)
return
@ -1160,7 +1160,7 @@ def sysctl(cmd, namespace=None, log_fail_as_error=True):
log_fail_as_error=log_fail_as_error)
except RuntimeError as rte:
LOG.warning(
_LW("Setting %(cmd)s in namespace %(ns)s failed: %(err)s."),
"Setting %(cmd)s in namespace %(ns)s failed: %(err)s.",
{'cmd': cmd,
'ns': namespace,
'err': rte})
@ -1207,9 +1207,9 @@ def set_ip_nonlocal_bind_for_namespace(namespace):
log_fail_as_error=False)
if failed:
LOG.warning(
_LW("%s will not be set to 0 in the root namespace in order to "
"not break DVR, which requires this value be set to 1. This "
"may introduce a race between moving a floating IP to a "
"different network node, and the peer side getting a "
"populated ARP cache for a given floating IP address."),
"%s will not be set to 0 in the root namespace in order to "
"not break DVR, which requires this value be set to 1. This "
"may introduce a race between moving a floating IP to a "
"different network node, and the peer side getting a "
"populated ARP cache for a given floating IP address.",
IP_NONLOCAL_BIND)

View File

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

View File

@ -16,7 +16,6 @@
from oslo_log import log as logging
from oslo_utils import excutils
from neutron._i18n import _LE
from neutron.agent.linux import async_process
from neutron.agent.linux import ip_lib
@ -41,7 +40,7 @@ class IPMonitorEvent(object):
first_word = route[0]
except IndexError:
with excutils.save_and_reraise_exception():
LOG.error(_LE('Unable to parse route "%s"'), line)
LOG.error('Unable to parse route "%s"', line)
added = (first_word != 'Deleted')
if not added:
@ -52,7 +51,7 @@ class IPMonitorEvent(object):
cidr = route[3]
except IndexError:
with excutils.save_and_reraise_exception():
LOG.error(_LE('Unable to parse route "%s"'), line)
LOG.error('Unable to parse route "%s"', line)
return cls(line, added, interface, cidr)

View File

@ -21,7 +21,6 @@ from oslo_config import cfg
from oslo_log import log as logging
from oslo_utils import netutils
from neutron._i18n import _LI
from neutron.agent import firewall
from neutron.agent.linux import ip_conntrack
from neutron.agent.linux import ipset_manager
@ -160,8 +159,8 @@ class IptablesFirewallDriver(firewall.FirewallDriver):
def update_port_filter(self, port):
LOG.debug("Updating device (%s) filter", port['device'])
if port['device'] not in self.ports:
LOG.info(_LI('Attempted to update port filter which is not '
'filtered %s'), port['device'])
LOG.info('Attempted to update port filter which is not '
'filtered %s', port['device'])
return
self._remove_chains()
self._set_ports(port)
@ -171,8 +170,8 @@ class IptablesFirewallDriver(firewall.FirewallDriver):
def remove_port_filter(self, port):
LOG.debug("Removing device (%s) filter", port['device'])
if port['device'] not in self.ports:
LOG.info(_LI('Attempted to remove port filter which is not '
'filtered %r'), port)
LOG.info('Attempted to remove port filter which is not '
'filtered %r', port)
return
self._remove_chains()
self._remove_conntrack_entries_from_port_deleted(port)

View File

@ -30,7 +30,7 @@ from oslo_config import cfg
from oslo_log import log as logging
from oslo_utils import excutils
from neutron._i18n import _, _LE, _LW
from neutron._i18n import _
from neutron.agent.linux import ip_lib
from neutron.agent.linux import iptables_comments as ic
from neutron.agent.linux import utils as linux_utils
@ -247,8 +247,8 @@ class IptablesTable(object):
top, self.wrap_name,
comment=comment)))
except ValueError:
LOG.warning(_LW('Tried to remove rule that was not there:'
' %(chain)r %(rule)r %(wrap)r %(top)r'),
LOG.warning('Tried to remove rule that was not there:'
' %(chain)r %(rule)r %(wrap)r %(top)r',
{'chain': chain, 'rule': rule,
'top': top, 'wrap': wrap})
@ -533,8 +533,8 @@ class IptablesManager(object):
commands[log_start:log_end],
log_start + 1)
)
LOG.error(_LE("IPTablesManager.apply failed to apply the "
"following set of iptables rules:\n%s"),
LOG.error("IPTablesManager.apply failed to apply the "
"following set of iptables rules:\n%s",
'\n'.join(log_lines))
LOG.debug("IPTablesManager.apply completed with success. %d iptables "
"commands were issued", len(all_commands))
@ -636,9 +636,9 @@ class IptablesManager(object):
def _weed_out_duplicates(line):
if line in seen_lines:
thing = 'chain' if line.startswith(':') else 'rule'
LOG.warning(_LW("Duplicate iptables %(thing)s detected. This "
"may indicate a bug in the iptables "
"%(thing)s generation code. Line: %(line)s"),
LOG.warning("Duplicate iptables %(thing)s detected. This "
"may indicate a bug in the iptables "
"%(thing)s generation code. Line: %(line)s",
{'thing': thing, 'line': line})
return False
seen_lines.add(line)
@ -675,8 +675,8 @@ class IptablesManager(object):
"""Return the sum of the traffic counters of all rules of a chain."""
cmd_tables = self._get_traffic_counters_cmd_tables(chain, wrap)
if not cmd_tables:
LOG.warning(_LW('Attempted to get traffic counters of chain %s '
'which does not exist'), chain)
LOG.warning('Attempted to get traffic counters of chain %s '
'which does not exist', chain)
return
name = get_chain_name(chain, wrap)

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -27,7 +27,7 @@ import six
import six.moves.urllib.parse as urlparse
import webob
from neutron._i18n import _, _LE, _LW
from neutron._i18n import _
from neutron.agent.linux import utils as agent_utils
from neutron.agent import rpc as agent_rpc
from neutron.common import cache_utils as cache
@ -92,7 +92,7 @@ class MetadataProxyHandler(object):
return webob.exc.HTTPNotFound()
except Exception:
LOG.exception(_LE("Unexpected error."))
LOG.exception("Unexpected error.")
msg = _('An unknown error has occurred. '
'Please try your request again.')
explanation = six.text_type(msg)
@ -198,10 +198,10 @@ class MetadataProxyHandler(object):
LOG.debug(str(resp))
return req.response
elif resp.status == 403:
LOG.warning(_LW(
LOG.warning(
'The remote metadata server responded with Forbidden. This '
'response usually occurs when shared secrets do not match.'
))
)
return webob.exc.HTTPForbidden()
elif resp.status == 400:
return webob.exc.HTTPBadRequest()
@ -262,12 +262,12 @@ class UnixDomainMetadataProxy(object):
use_call=self.agent_state.get('start_flag'))
except AttributeError:
# This means the server does not support report_state
LOG.warning(_LW('Neutron server does not support state report.'
' State report for this agent will be disabled.'))
LOG.warning('Neutron server does not support state report.'
' State report for this agent will be disabled.')
self.heartbeat.stop()
return
except Exception:
LOG.exception(_LE("Failed reporting state!"))
LOG.exception("Failed reporting state!")
return
self.agent_state.pop('start_flag', None)

View File

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

View File

@ -21,7 +21,6 @@ from oslo_config import cfg
from oslo_log import log as logging
import oslo_messaging
from neutron._i18n import _LI, _LW
from neutron.agent import firewall
from neutron.api.rpc.handlers import securitygroups_rpc
from neutron.conf.agent import securitygroups_rpc as sc_cfg
@ -44,9 +43,9 @@ def _disable_extension(extension, aliases):
def disable_security_group_extension_by_config(aliases):
if not is_firewall_enabled():
LOG.info(_LI('Disabled security-group extension.'))
LOG.info('Disabled security-group extension.')
_disable_extension('security-group', aliases)
LOG.info(_LI('Disabled allowed-address-pairs extension.'))
LOG.info('Disabled allowed-address-pairs extension.')
_disable_extension('allowed-address-pairs', aliases)
@ -91,10 +90,10 @@ class SecurityGroupAgentRpc(object):
self.plugin_rpc.security_group_info_for_devices(
self.context, devices=[])
except oslo_messaging.UnsupportedVersion:
LOG.warning(_LW('security_group_info_for_devices rpc call not '
'supported by the server, falling back to old '
'security_group_rules_for_devices which scales '
'worse.'))
LOG.warning('security_group_info_for_devices rpc call not '
'supported by the server, falling back to old '
'security_group_rules_for_devices which scales '
'worse.')
return False
return True
@ -103,8 +102,8 @@ class SecurityGroupAgentRpc(object):
def decorated_function(self, *args, **kwargs):
if (isinstance(self.firewall, firewall.NoopFirewallDriver) or
not is_firewall_enabled()):
LOG.info(_LI("Skipping method %s as firewall is disabled "
"or configured as NoopFirewallDriver."),
LOG.info("Skipping method %s as firewall is disabled "
"or configured as NoopFirewallDriver.",
func.__name__)
else:
return func(self, # pylint: disable=not-callable
@ -115,7 +114,7 @@ class SecurityGroupAgentRpc(object):
def prepare_devices_filter(self, device_ids):
if not device_ids:
return
LOG.info(_LI("Preparing filters for devices %s"), device_ids)
LOG.info("Preparing filters for devices %s", device_ids)
self._apply_port_filter(device_ids)
def _apply_port_filter(self, device_ids, update_filter=False):
@ -155,16 +154,16 @@ class SecurityGroupAgentRpc(object):
remote_sg_id, member_ips)
def security_groups_rule_updated(self, security_groups):
LOG.info(_LI("Security group "
"rule updated %r"), security_groups)
LOG.info("Security group "
"rule updated %r", security_groups)
self._security_group_updated(
security_groups,
'security_groups',
'sg_rule')
def security_groups_member_updated(self, security_groups):
LOG.info(_LI("Security group "
"member updated %r"), security_groups)
LOG.info("Security group "
"member updated %r", security_groups)
self._security_group_updated(
security_groups,
'security_group_source_groups',
@ -188,7 +187,7 @@ class SecurityGroupAgentRpc(object):
self.refresh_firewall(devices)
def security_groups_provider_updated(self, port_ids_to_update):
LOG.info(_LI("Provider rule updated"))
LOG.info("Provider rule updated")
if port_ids_to_update is None:
# Update all devices
if self.defer_refresh_firewall:
@ -211,7 +210,7 @@ class SecurityGroupAgentRpc(object):
def remove_devices_filter(self, device_ids):
if not device_ids:
return
LOG.info(_LI("Remove device filter for %r"), device_ids)
LOG.info("Remove device filter for %r", device_ids)
with self.firewall.defer_apply():
for device_id in device_ids:
device = self.firewall.ports.get(device_id)
@ -222,11 +221,11 @@ class SecurityGroupAgentRpc(object):
@skip_if_noopfirewall_or_firewall_disabled
def refresh_firewall(self, device_ids=None):
LOG.info(_LI("Refresh firewall rules"))
LOG.info("Refresh firewall rules")
if not device_ids:
device_ids = self.firewall.ports.keys()
if not device_ids:
LOG.info(_LI("No ports here to refresh firewall"))
LOG.info("No ports here to refresh firewall")
return
self._apply_port_filter(device_ids, update_filter=True)

View File

@ -17,8 +17,6 @@ import netifaces
from oslo_log import log as logging
from neutron._i18n import _LE
LOG = logging.getLogger(__name__)
OPTS = []
@ -38,7 +36,7 @@ class IPWrapper(object):
try:
return [IPDevice(iface) for iface in netifaces.interfaces()]
except (OSError, MemoryError):
LOG.error(_LE("Failed to get network interfaces."))
LOG.error("Failed to get network interfaces.")
return []
@ -52,11 +50,11 @@ class IPDevice(object):
try:
device_addresses = netifaces.ifaddresses(self.name)
except ValueError:
LOG.error(_LE("The device does not exist on the system: %s."),
LOG.error("The device does not exist on the system: %s.",
self.name)
return
except OSError:
LOG.error(_LE("Failed to get interface addresses: %s."),
LOG.error("Failed to get interface addresses: %s.",
self.name)
return
return device_addresses

View File

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

View File

@ -26,7 +26,7 @@ import routes
import webob.dec
import webob.exc
from neutron._i18n import _, _LE, _LI, _LW
from neutron._i18n import _
from neutron.common import exceptions
from neutron import extensions as core_extensions
from neutron.plugins.common import constants as const
@ -283,7 +283,7 @@ class ExtensionManager(object):
"""
def __init__(self, path):
LOG.info(_LI('Initializing extension manager.'))
LOG.info('Initializing extension manager.')
self.path = path
self.extensions = {}
self._load_all_extensions()
@ -359,10 +359,10 @@ class ExtensionManager(object):
break
if exts_to_process:
unloadable_extensions = set(exts_to_process.keys())
LOG.error(_LE("Unable to process extensions (%s) because "
"the configured plugins do not satisfy "
"their requirements. Some features will not "
"work as expected."),
LOG.error("Unable to process extensions (%s) because "
"the configured plugins do not satisfy "
"their requirements. Some features will not "
"work as expected.",
', '.join(unloadable_extensions))
self._check_faulty_extensions(unloadable_extensions)
# Extending extensions' attributes map.
@ -398,7 +398,7 @@ class ExtensionManager(object):
'desc': extension.get_description(),
'updated': extension.get_updated()})
except AttributeError:
LOG.exception(_LE("Exception loading extension"))
LOG.exception("Exception loading extension")
return False
return isinstance(extension, api_extensions.ExtensionDescriptor)
@ -417,7 +417,7 @@ class ExtensionManager(object):
if os.path.exists(path):
self._load_all_extensions_from_path(path)
else:
LOG.error(_LE("Extension path '%s' doesn't exist!"), path)
LOG.error("Extension path '%s' doesn't exist!", path)
def _load_all_extensions_from_path(self, path):
# Sorting the extension list makes the order in which they
@ -433,16 +433,16 @@ class ExtensionManager(object):
ext_name = mod_name.capitalize()
new_ext_class = getattr(mod, ext_name, None)
if not new_ext_class:
LOG.warning(_LW('Did not find expected name '
'"%(ext_name)s" in %(file)s'),
LOG.warning('Did not find expected name '
'"%(ext_name)s" in %(file)s',
{'ext_name': ext_name,
'file': ext_path})
continue
new_ext = new_ext_class()
self.add_extension(new_ext)
except Exception as exception:
LOG.warning(_LW("Extension file %(f)s wasn't loaded due to "
"%(exception)s"),
LOG.warning("Extension file %(f)s wasn't loaded due to "
"%(exception)s",
{'f': f, 'exception': exception})
def add_extension(self, ext):
@ -451,7 +451,7 @@ class ExtensionManager(object):
return
alias = ext.get_alias()
LOG.info(_LI('Loaded extension: %s'), alias)
LOG.info('Loaded extension: %s', alias)
if alias in self.extensions:
raise exceptions.DuplicatedExtension(alias=alias)
@ -485,9 +485,8 @@ class PluginAwareExtensionManager(ExtensionManager):
alias = extension.get_alias()
supports_extension = alias in self.get_supported_extension_aliases()
if not supports_extension:
LOG.info(_LI("Extension %s not supported by any of loaded "
"plugins"),
alias)
LOG.info("Extension %s not supported by any of loaded "
"plugins", alias)
return supports_extension
def _plugins_implement_interface(self, extension):
@ -496,8 +495,8 @@ class PluginAwareExtensionManager(ExtensionManager):
for plugin in self.plugins.values():
if isinstance(plugin, extension.get_plugin_interface()):
return True
LOG.warning(_LW("Loaded plugins do not implement extension "
"%s interface"),
LOG.warning("Loaded plugins do not implement extension "
"%s interface",
extension.get_alias())
return False

View File

@ -22,7 +22,6 @@ from oslo_config import cfg
from oslo_log import log as logging
import oslo_messaging
from neutron._i18n import _LE, _LW
from neutron.common import constants as n_const
from neutron.common import rpc as n_rpc
from neutron.common import topics
@ -105,9 +104,9 @@ class DhcpAgentNotifyAPI(object):
context, 'network_create_end',
{'network': {'id': network['id']}}, agent['host'])
elif not existing_agents:
LOG.warning(_LW('Unable to schedule network %s: no agents '
'available; will retry on subsequent port '
'and subnet creation events.'),
LOG.warning('Unable to schedule network %s: no agents '
'available; will retry on subsequent port '
'and subnet creation events.',
network['id'])
return new_agents + existing_agents
@ -123,10 +122,10 @@ class DhcpAgentNotifyAPI(object):
len_enabled_agents = len(enabled_agents)
len_active_agents = len(active_agents)
if len_active_agents < len_enabled_agents:
LOG.warning(_LW("Only %(active)d of %(total)d DHCP agents "
"associated with network '%(net_id)s' "
"are marked as active, so notifications "
"may be sent to inactive agents."),
LOG.warning("Only %(active)d of %(total)d DHCP agents "
"associated with network '%(net_id)s' "
"are marked as active, so notifications "
"may be sent to inactive agents.",
{'active': len_active_agents,
'total': len_enabled_agents,
'net_id': network_id})
@ -136,9 +135,9 @@ class DhcpAgentNotifyAPI(object):
notification_required = (
num_ports > 0 and len(network['subnets']) >= 1)
if notification_required:
LOG.error(_LE("Will not send event %(method)s for network "
"%(net_id)s: no agent available. Payload: "
"%(payload)s"),
LOG.error("Will not send event %(method)s for network "
"%(net_id)s: no agent available. Payload: "
"%(payload)s",
{'method': method,
'net_id': network_id,
'payload': payload})

View File

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

View File

@ -17,8 +17,6 @@ from oslo_log import log as logging
import oslo_messaging
from oslo_utils import excutils
from neutron._i18n import _LW
LOG = logging.getLogger(__name__)
@ -42,8 +40,8 @@ def _call_with_retry(max_attempts):
with excutils.save_and_reraise_exception(
reraise=False) as ctxt:
LOG.warning(
_LW('Failed to execute %(action)s. %(attempt)d out'
' of %(max_attempts)d'),
'Failed to execute %(action)s. %(attempt)d out'
' of %(max_attempts)d',
{'attempt': attempt,
'max_attempts': max_attempts,
'action': action})

View File

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

View File

@ -19,7 +19,6 @@ from neutron_lib.utils import net
from oslo_log import log as logging
import oslo_messaging
from neutron._i18n import _LW
from neutron.api.rpc.handlers import resources_rpc
from neutron.callbacks import events
from neutron.callbacks import registry
@ -192,9 +191,9 @@ class SecurityGroupAgentRpcCallbackMixin(object):
sg_agent = None
def _security_groups_agent_not_set(self):
LOG.warning(_LW("Security group agent binding currently not set. "
"This should be set by the end of the init "
"process."))
LOG.warning("Security group agent binding currently not set. "
"This should be set by the end of the init "
"process.")
def security_groups_rule_updated(self, context, **kwargs):
"""Callback for security group rule update.

View File

@ -26,7 +26,7 @@ from oslo_policy import policy as oslo_policy
from oslo_utils import excutils
import webob.exc
from neutron._i18n import _, _LE, _LI
from neutron._i18n import _
from neutron.api import api_common
from neutron.api.v2 import resource as wsgi_resource
from neutron.common import constants as n_const
@ -125,8 +125,8 @@ class Controller(object):
_("Native pagination depend on native sorting")
)
if not self._allow_sorting:
LOG.info(_LI("Allow sorting is enabled because native "
"pagination requires native sorting"))
LOG.info("Allow sorting is enabled because native "
"pagination requires native sorting")
self._allow_sorting = True
self.parent = parent
if parent:
@ -419,8 +419,8 @@ class Controller(object):
except Exception:
# broad catch as our only purpose is to log the
# exception
LOG.exception(_LE("Unable to undo add for "
"%(resource)s %(id)s"),
LOG.exception("Unable to undo add for "
"%(resource)s %(id)s",
{'resource': self._resource,
'id': obj['id']})
# TODO(salvatore-orlando): The object being processed when the

View File

@ -21,7 +21,6 @@ from oslo_log import log as logging
import webob.dec
import webob.exc
from neutron._i18n import _LE, _LI
from neutron.api import api_common
from neutron.common import utils
from neutron import wsgi
@ -101,16 +100,15 @@ def Resource(controller, faults=None, deserializers=None, serializers=None,
mapped_exc = api_common.convert_exception_to_http_exc(e, faults,
language)
if hasattr(mapped_exc, 'code') and 400 <= mapped_exc.code < 500:
LOG.info(_LI('%(action)s failed (client error): %(exc)s'),
LOG.info('%(action)s failed (client error): %(exc)s',
{'action': action, 'exc': mapped_exc})
else:
LOG.exception(
_LE('%(action)s failed: %(details)s'),
{
'action': action,
'details': utils.extract_exc_details(e),
}
)
LOG.exception('%(action)s failed: %(details)s',
{
'action': action,
'details': utils.extract_exc_details(e),
}
)
raise mapped_exc
status = action_status.get(action, 200)

View File

@ -16,7 +16,6 @@
from oslo_config import cfg
from oslo_log import log as logging
from neutron._i18n import _LE, _LI
from neutron.agent.linux import utils
from neutron.common import config
from neutron.conf.agent import cmd as command
@ -43,7 +42,7 @@ def remove_iptables_reference(ipset):
if ipset in iptables_save:
cmd = ['iptables'] if 'IPv4' in ipset else ['ip6tables']
LOG.info(_LI("Removing iptables rule for IPset: %s"), ipset)
LOG.info("Removing iptables rule for IPset: %s", ipset)
for rule in iptables_save.splitlines():
if '--match-set %s ' % ipset in rule and rule.startswith('-A'):
# change to delete
@ -52,8 +51,8 @@ def remove_iptables_reference(ipset):
try:
utils.execute(cmd + params, run_as_root=True)
except Exception:
LOG.exception(_LE('Error, unable to remove iptables rule '
'for IPset: %s'), ipset)
LOG.exception('Error, unable to remove iptables rule '
'for IPset: %s', ipset)
def destroy_ipset(conf, ipset):
@ -62,17 +61,17 @@ def destroy_ipset(conf, ipset):
if conf.force:
remove_iptables_reference(ipset)
LOG.info(_LI("Destroying IPset: %s"), ipset)
LOG.info("Destroying IPset: %s", ipset)
cmd = ['ipset', 'destroy', ipset]
try:
utils.execute(cmd, run_as_root=True)
except Exception:
LOG.exception(_LE('Error, unable to destroy IPset: %s'), ipset)
LOG.exception('Error, unable to destroy IPset: %s', ipset)
def cleanup_ipsets(conf):
# Identify ipsets for destruction.
LOG.info(_LI("Destroying IPsets with prefix: %s"), conf.prefix)
LOG.info("Destroying IPsets with prefix: %s", conf.prefix)
cmd = ['ipset', '-L', '-n']
ipsets = utils.execute(cmd, run_as_root=True)
@ -80,7 +79,7 @@ def cleanup_ipsets(conf):
if conf.allsets or ipset.startswith(conf.prefix):
destroy_ipset(conf, ipset)
LOG.info(_LI("IPset cleanup completed successfully"))
LOG.info("IPset cleanup completed successfully")
def main():

View File

@ -16,7 +16,6 @@ from neutron_lib.utils import helpers
from oslo_config import cfg
from oslo_log import log as logging
from neutron._i18n import _LE, _LI
from neutron.common import config
from neutron.plugins.ml2.drivers.linuxbridge.agent \
import linuxbridge_neutron_agent
@ -30,17 +29,17 @@ def remove_empty_bridges():
interface_mappings = helpers.parse_mappings(
cfg.CONF.LINUX_BRIDGE.physical_interface_mappings)
except ValueError as e:
LOG.error(_LE("Parsing physical_interface_mappings failed: %s."), e)
LOG.error("Parsing physical_interface_mappings failed: %s.", e)
sys.exit(1)
LOG.info(_LI("Interface mappings: %s."), interface_mappings)
LOG.info("Interface mappings: %s.", interface_mappings)
try:
bridge_mappings = helpers.parse_mappings(
cfg.CONF.LINUX_BRIDGE.bridge_mappings)
except ValueError as e:
LOG.error(_LE("Parsing bridge_mappings failed: %s."), e)
LOG.error("Parsing bridge_mappings failed: %s.", e)
sys.exit(1)
LOG.info(_LI("Bridge mappings: %s."), bridge_mappings)
LOG.info("Bridge mappings: %s.", bridge_mappings)
lb_manager = linuxbridge_neutron_agent.LinuxBridgeManager(
bridge_mappings, interface_mappings)
@ -52,10 +51,10 @@ def remove_empty_bridges():
try:
lb_manager.delete_bridge(bridge_name)
LOG.info(_LI("Linux bridge %s deleted"), bridge_name)
LOG.info("Linux bridge %s deleted", bridge_name)
except RuntimeError:
LOG.exception(_LE("Linux bridge %s delete failed"), bridge_name)
LOG.info(_LI("Linux bridge cleanup completed successfully"))
LOG.exception("Linux bridge %s delete failed", bridge_name)
LOG.info("Linux bridge cleanup completed successfully")
def main():

View File

@ -23,7 +23,6 @@ from oslo_config import cfg
from oslo_log import log as logging
from oslo_utils import importutils
from neutron._i18n import _LE, _LW
from neutron.agent.common import ovs_lib
from neutron.agent.l3 import dvr_fip_ns
from neutron.agent.l3 import dvr_snat_ns
@ -197,7 +196,7 @@ def _kill_listen_processes(namespace, force=False):
# implementation in the right module. Ideally, netns_cleanup wouldn't
# kill any processes as the responsible module should've killed them
# before cleaning up the namespace
LOG.warning(_LW("Killing (%(signal)d) [%(pid)s] %(cmdline)s"),
LOG.warning("Killing (%(signal)d) [%(pid)s] %(cmdline)s",
{'signal': kill_signal,
'pid': pid,
'cmdline': ' '.join(utils.get_cmdline_from_pid(pid))[:80]
@ -205,8 +204,8 @@ def _kill_listen_processes(namespace, force=False):
try:
utils.kill_process(pid, kill_signal, run_as_root=True)
except Exception as ex:
LOG.error(_LE('An error occurred while killing '
'[%(pid)s]: %(msg)s'), {'pid': pid, 'msg': ex})
LOG.error('An error occurred while killing '
'[%(pid)s]: %(msg)s', {'pid': pid, 'msg': ex})
return len(pids)
@ -246,14 +245,14 @@ def destroy_namespace(conf, namespace, force=False):
# This is unlikely since, at this point, we have SIGKILLed
# all remaining processes but if there are still some, log
# the error and continue with the cleanup
LOG.error(_LE('Not all processes were killed in %s'),
LOG.error('Not all processes were killed in %s',
namespace)
for device in ip.get_devices():
unplug_device(conf, device)
ip.garbage_collect_namespace()
except Exception:
LOG.exception(_LE('Error unable to destroy namespace: %s'), namespace)
LOG.exception('Error unable to destroy namespace: %s', namespace)
def cleanup_network_namespaces(conf):

View File

@ -16,7 +16,6 @@
from oslo_config import cfg
from oslo_log import log as logging
from neutron._i18n import _LI
from neutron.agent.common import ovs_lib
from neutron.agent.linux import interface
from neutron.agent.linux import ip_lib
@ -73,7 +72,7 @@ def delete_neutron_ports(ports):
device = ip_lib.IPDevice(port)
if device.exists():
device.link.delete()
LOG.info(_LI("Deleting port: %s"), port)
LOG.info("Deleting port: %s", port)
def main():
@ -103,7 +102,7 @@ def main():
ports = collect_neutron_ports(available_configuration_bridges)
for bridge in bridges:
LOG.info(_LI("Cleaning bridge: %s"), bridge)
LOG.info("Cleaning bridge: %s", bridge)
ovs = ovs_lib.OVSBridge(bridge)
if conf.ovs_all_ports:
port_names = ovs.get_port_name_list()
@ -115,4 +114,4 @@ def main():
# Remove remaining ports created by Neutron (usually veth pair)
delete_neutron_ports(ports)
LOG.info(_LI("OVS cleanup completed successfully"))
LOG.info("OVS cleanup completed successfully")

View File

@ -23,7 +23,6 @@ from oslo_config import cfg
from oslo_log import log as logging
from oslo_utils import uuidutils
from neutron._i18n import _LE
from neutron.agent.common import ovs_lib
from neutron.agent.l3 import ha_router
from neutron.agent.l3 import namespaces
@ -104,8 +103,8 @@ def ofctl_arg_supported(cmd, **kwargs):
"command %s. Exception: %s", full_args, e)
return False
except Exception:
LOG.exception(_LE("Unexpected exception while checking supported"
" feature via command: %s"), full_args)
LOG.exception("Unexpected exception while checking supported"
" feature via command: %s", full_args)
return False
else:
return True
@ -157,8 +156,8 @@ def _vf_management_support(required_caps):
LOG.debug("ip link command does not support "
"vf capability '%(cap)s'", {'cap': cap})
except ip_link_support.UnsupportedIpLinkCommand:
LOG.exception(_LE("Unexpected exception while checking supported "
"ip link command"))
LOG.exception("Unexpected exception while checking supported "
"ip link command")
return False
return is_supported
@ -362,11 +361,11 @@ def ovsdb_native_supported():
ovs.get_bridges()
return True
except ImportError as ex:
LOG.error(_LE("Failed to import required modules. Ensure that the "
"python-openvswitch package is installed. Error: %s"),
LOG.error("Failed to import required modules. Ensure that the "
"python-openvswitch package is installed. Error: %s",
ex)
except Exception:
LOG.exception(_LE("Unexpected exception occurred."))
LOG.exception("Unexpected exception occurred.")
return False

View File

@ -18,7 +18,7 @@ import sys
from oslo_config import cfg
from oslo_log import log as logging
from neutron._i18n import _, _LE, _LW
from neutron._i18n import _
from neutron.agent import dhcp_agent
from neutron.cmd.sanity import checks
from neutron.common import config
@ -52,52 +52,52 @@ class BoolOptCallback(cfg.BoolOpt):
def check_ovs_vxlan():
result = checks.ovs_vxlan_supported()
if not result:
LOG.error(_LE('Check for Open vSwitch VXLAN support failed. '
'Please ensure that the version of openvswitch '
'being used has VXLAN support.'))
LOG.error('Check for Open vSwitch VXLAN support failed. '
'Please ensure that the version of openvswitch '
'being used has VXLAN support.')
return result
def check_ovs_geneve():
result = checks.ovs_geneve_supported()
if not result:
LOG.error(_LE('Check for Open vSwitch Geneve support failed. '
'Please ensure that the version of openvswitch '
'and kernel being used has Geneve support.'))
LOG.error('Check for Open vSwitch Geneve support failed. '
'Please ensure that the version of openvswitch '
'and kernel being used has Geneve support.')
return result
def check_iproute2_vxlan():
result = checks.iproute2_vxlan_supported()
if not result:
LOG.error(_LE('Check for iproute2 VXLAN support failed. Please ensure '
'that the iproute2 has VXLAN support.'))
LOG.error('Check for iproute2 VXLAN support failed. Please ensure '
'that the iproute2 has VXLAN support.')
return result
def check_ovs_patch():
result = checks.patch_supported()
if not result:
LOG.error(_LE('Check for Open vSwitch patch port support failed. '
'Please ensure that the version of openvswitch '
'being used has patch port support or disable features '
'requiring patch ports (gre/vxlan, etc.).'))
LOG.error('Check for Open vSwitch patch port support failed. '
'Please ensure that the version of openvswitch '
'being used has patch port support or disable features '
'requiring patch ports (gre/vxlan, etc.).')
return result
def check_read_netns():
required = checks.netns_read_requires_helper()
if not required and cfg.CONF.AGENT.use_helper_for_ns_read:
LOG.warning(_LW("The user that is executing neutron can read the "
"namespaces without using the root_helper. Disable "
"the use_helper_for_ns_read option to avoid a "
"performance impact."))
LOG.warning("The user that is executing neutron can read the "
"namespaces without using the root_helper. Disable "
"the use_helper_for_ns_read option to avoid a "
"performance impact.")
# Don't fail because nothing is actually broken. Just not optimal.
result = True
elif required and not cfg.CONF.AGENT.use_helper_for_ns_read:
LOG.error(_LE("The user that is executing neutron does not have "
"permissions to read the namespaces. Enable the "
"use_helper_for_ns_read configuration option."))
LOG.error("The user that is executing neutron does not have "
"permissions to read the namespaces. Enable the "
"use_helper_for_ns_read configuration option.")
result = False
else:
# everything is configured appropriately
@ -112,8 +112,8 @@ def check_read_netns():
def check_dnsmasq_version():
result = checks.dnsmasq_version_supported()
if not result:
LOG.error(_LE('The installed version of dnsmasq is too old. '
'Please update to at least version %s.'),
LOG.error('The installed version of dnsmasq is too old. '
'Please update to at least version %s.',
checks.get_minimal_dnsmasq_version_supported())
return result
@ -121,17 +121,17 @@ def check_dnsmasq_version():
def check_keepalived_ipv6_support():
result = checks.keepalived_ipv6_supported()
if not result:
LOG.error(_LE('The installed version of keepalived does not support '
'IPv6. Please update to at least version 1.2.10 for '
'IPv6 support.'))
LOG.error('The installed version of keepalived does not support '
'IPv6. Please update to at least version 1.2.10 for '
'IPv6 support.')
return result
def check_dibbler_version():
result = checks.dibbler_version_supported()
if not result:
LOG.error(_LE('The installed version of dibbler-client is too old. '
'Please update to at least version %s.'),
LOG.error('The installed version of dibbler-client is too old. '
'Please update to at least version %s.',
checks.get_minimal_dibbler_version_supported())
return result
@ -139,56 +139,56 @@ def check_dibbler_version():
def check_nova_notify():
result = checks.nova_notify_supported()
if not result:
LOG.error(_LE('Nova notifications are enabled, but novaclient is not '
'installed. Either disable nova notifications or '
'install python-novaclient.'))
LOG.error('Nova notifications are enabled, but novaclient is not '
'installed. Either disable nova notifications or '
'install python-novaclient.')
return result
def check_arp_responder():
result = checks.arp_responder_supported()
if not result:
LOG.error(_LE('Check for Open vSwitch ARP responder support failed. '
'Please ensure that the version of openvswitch '
'being used has ARP flows support.'))
LOG.error('Check for Open vSwitch ARP responder support failed. '
'Please ensure that the version of openvswitch '
'being used has ARP flows support.')
return result
def check_arp_header_match():
result = checks.arp_header_match_supported()
if not result:
LOG.error(_LE('Check for Open vSwitch support of ARP header matching '
'failed. ARP spoofing suppression will not work. A '
'newer version of OVS is required.'))
LOG.error('Check for Open vSwitch support of ARP header matching '
'failed. ARP spoofing suppression will not work. A '
'newer version of OVS is required.')
return result
def check_icmpv6_header_match():
result = checks.icmpv6_header_match_supported()
if not result:
LOG.error(_LE('Check for Open vSwitch support of ICMPv6 header '
'matching failed. ICMPv6 Neighbor Advt spoofing (part '
'of arp spoofing) suppression will not work. A newer '
'version of OVS is required.'))
LOG.error('Check for Open vSwitch support of ICMPv6 header '
'matching failed. ICMPv6 Neighbor Advt spoofing (part '
'of arp spoofing) suppression will not work. A newer '
'version of OVS is required.')
return result
def check_vf_management():
result = checks.vf_management_supported()
if not result:
LOG.error(_LE('Check for VF management support failed. '
'Please ensure that the version of ip link '
'being used has VF support.'))
LOG.error('Check for VF management support failed. '
'Please ensure that the version of ip link '
'being used has VF support.')
return result
def check_vf_extended_management():
result = checks.vf_extended_management_supported()
if not result:
LOG.error(_LE('Check for VF extended management support failed. '
'Please ensure that the version of ip link '
'being used has VF extended support: version '
'"iproute2-ss140804", git tag "v3.16.0"'))
LOG.error('Check for VF extended management support failed. '
'Please ensure that the version of ip link '
'being used has VF extended support: version '
'"iproute2-ss140804", git tag "v3.16.0"')
return result
@ -196,67 +196,67 @@ def check_ovsdb_native():
cfg.CONF.set_override('ovsdb_interface', 'native', group='OVS')
result = checks.ovsdb_native_supported()
if not result:
LOG.error(_LE('Check for native OVSDB support failed.'))
LOG.error('Check for native OVSDB support failed.')
return result
def check_ovs_conntrack():
result = checks.ovs_conntrack_supported()
if not result:
LOG.error(_LE('Check for Open vSwitch support of conntrack support '
'failed. OVS/CT firewall will not work. A newer '
'version of OVS (2.5+) and linux kernel (4.3+) are '
'required. See '
'https://github.com/openvswitch/ovs/blob/master/FAQ.md '
'for more information.'))
LOG.error('Check for Open vSwitch support of conntrack support '
'failed. OVS/CT firewall will not work. A newer '
'version of OVS (2.5+) and linux kernel (4.3+) are '
'required. See '
'https://github.com/openvswitch/ovs/blob/master/FAQ.md '
'for more information.')
return result
def check_ebtables():
result = checks.ebtables_supported()
if not result:
LOG.error(_LE('Cannot run ebtables. Please ensure that it '
'is installed.'))
LOG.error('Cannot run ebtables. Please ensure that it '
'is installed.')
return result
def check_ipset():
result = checks.ipset_supported()
if not result:
LOG.error(_LE('Cannot run ipset. Please ensure that it '
'is installed.'))
LOG.error('Cannot run ipset. Please ensure that it '
'is installed.')
return result
def check_ip6tables():
result = checks.ip6tables_supported()
if not result:
LOG.error(_LE('Cannot run ip6tables. Please ensure that it '
'is installed.'))
LOG.error('Cannot run ip6tables. Please ensure that it '
'is installed.')
return result
def check_conntrack():
result = checks.conntrack_supported()
if not result:
LOG.error(_LE('Cannot run conntrack. Please ensure that it '
'is installed.'))
LOG.error('Cannot run conntrack. Please ensure that it '
'is installed.')
return result
def check_dhcp_release6():
result = checks.dhcp_release6_supported()
if not result:
LOG.error(_LE('No dhcp_release6 tool detected. The installed version '
'of dnsmasq does not support releasing IPv6 leases. '
'Please update to at least version %s if you need this '
'feature. If you do not use IPv6 stateful subnets you '
'can continue to use this version of dnsmasq, as '
'other IPv6 address assignment mechanisms besides '
'stateful DHCPv6 should continue to work without '
'the dhcp_release6 utility. '
'Current version of dnsmasq is ok if other checks '
'pass.'),
LOG.error('No dhcp_release6 tool detected. The installed version '
'of dnsmasq does not support releasing IPv6 leases. '
'Please update to at least version %s if you need this '
'feature. If you do not use IPv6 stateful subnets you '
'can continue to use this version of dnsmasq, as '
'other IPv6 address assignment mechanisms besides '
'stateful DHCPv6 should continue to work without '
'the dhcp_release6 utility. '
'Current version of dnsmasq is ok if other checks '
'pass.',
checks.get_dnsmasq_version_with_dhcp_release6())
return result
@ -264,19 +264,19 @@ def check_dhcp_release6():
def check_bridge_firewalling_enabled():
result = checks.bridge_firewalling_enabled()
if not result:
LOG.error(_LE('Bridge firewalling is not enabled. It may be the case '
'that bridge and/or br_netfilter kernel modules are not '
'loaded. Alternatively, corresponding sysctl settings '
'may be overridden to disable it by default.'))
LOG.error('Bridge firewalling is not enabled. It may be the case '
'that bridge and/or br_netfilter kernel modules are not '
'loaded. Alternatively, corresponding sysctl settings '
'may be overridden to disable it by default.')
return result
def check_ip_nonlocal_bind():
result = checks.ip_nonlocal_bind()
if not result:
LOG.error(_LE('This kernel does not isolate ip_nonlocal_bind kernel '
'option in namespaces. Please update to kernel '
'version > 3.19.'))
LOG.error('This kernel does not isolate ip_nonlocal_bind kernel '
'option in namespaces. Please update to kernel '
'version > 3.19.')
return result

View File

@ -27,7 +27,7 @@ import oslo_messaging
from oslo_middleware import cors
from oslo_service import wsgi
from neutron._i18n import _, _LI
from neutron._i18n import _
from neutron.conf import common as common_config
from neutron import policy
from neutron import version
@ -97,8 +97,8 @@ def setup_logging():
logging.set_defaults(default_log_levels=logging.get_default_log_levels() +
EXTRA_LOG_LEVEL_DEFAULTS)
logging.setup(cfg.CONF, product_name)
LOG.info(_LI("Logging enabled!"))
LOG.info(_LI("%(prog)s version %(version)s"),
LOG.info("Logging enabled!")
LOG.info("%(prog)s version %(version)s",
{'prog': sys.argv[0],
'version': version.version_info.release_string()})
LOG.debug("command line: %s", " ".join(sys.argv))

View File

@ -23,8 +23,6 @@ import netaddr
from neutron_lib import constants as const
from oslo_log import log
from neutron._i18n import _LI
LOG = log.getLogger(__name__)
_IS_IPV6_ENABLED = None
@ -45,10 +43,10 @@ def is_enabled_and_bind_by_default():
else:
_IS_IPV6_ENABLED = False
if not _IS_IPV6_ENABLED:
LOG.info(_LI("IPv6 not present or configured not to bind to new "
"interfaces on this system. Please ensure IPv6 is "
"enabled and /proc/sys/net/ipv6/conf/default/"
"disable_ipv6 is set to 0 to enable IPv6."))
LOG.info("IPv6 not present or configured not to bind to new "
"interfaces on this system. Please ensure IPv6 is "
"enabled and /proc/sys/net/ipv6/conf/default/"
"disable_ipv6 is set to 0 to enable IPv6.")
return _IS_IPV6_ENABLED

View File

@ -17,8 +17,6 @@ import osprofiler.initializer
from osprofiler import opts as profiler_opts
import osprofiler.web
from neutron._i18n import _LI
CONF = cfg.CONF
profiler_opts.set_defaults(CONF)
@ -41,11 +39,11 @@ def setup(name, host='0.0.0.0'): # nosec
service=name,
host=host
)
LOG.info(_LI("OSProfiler is enabled.\n"
"Traces provided from the profiler "
"can only be subscribed to using the same HMAC keys that "
"are configured in Neutron's configuration file "
"under the [profiler] section.\n To disable OSprofiler "
"set in /etc/neutron/neutron.conf:\n"
"[profiler]\n"
"enabled=false"))
LOG.info("OSProfiler is enabled.\n"
"Traces provided from the profiler "
"can only be subscribed to using the same HMAC keys that "
"are configured in Neutron's configuration file "
"under the [profiler] section.\n To disable OSprofiler "
"set in /etc/neutron/neutron.conf:\n"
"[profiler]\n"
"enabled=false")

View File

@ -29,7 +29,6 @@ from oslo_service import service
from oslo_utils import excutils
from osprofiler import profiler
from neutron._i18n import _LE, _LW
from neutron.common import exceptions
@ -168,19 +167,19 @@ class _BackingOffContextWrapper(_ContextWrapper):
min(self._METHOD_TIMEOUTS[scoped_method],
TRANSPORT.conf.rpc_response_timeout)
)
LOG.error(_LE("Timeout in RPC method %(method)s. Waiting for "
"%(wait)s seconds before next attempt. If the "
"server is not down, consider increasing the "
"rpc_response_timeout option as Neutron "
"server(s) may be overloaded and unable to "
"respond quickly enough."),
LOG.error("Timeout in RPC method %(method)s. Waiting for "
"%(wait)s seconds before next attempt. If the "
"server is not down, consider increasing the "
"rpc_response_timeout option as Neutron "
"server(s) may be overloaded and unable to "
"respond quickly enough.",
{'wait': int(round(wait)), 'method': scoped_method})
new_timeout = min(
self._original_context.timeout * 2, self.get_max_timeout())
if new_timeout > self._METHOD_TIMEOUTS[scoped_method]:
LOG.warning(_LW("Increasing timeout for %(method)s calls "
"to %(new)s seconds. Restart the agent to "
"restore it to the default value."),
LOG.warning("Increasing timeout for %(method)s calls "
"to %(new)s seconds. Restart the agent to "
"restore it to the default value.",
{'method': scoped_method, 'new': new_timeout})
self._METHOD_TIMEOUTS[scoped_method] = new_timeout
time.sleep(wait)

View File

@ -49,7 +49,7 @@ import six
from stevedore import driver
import neutron
from neutron._i18n import _, _LE
from neutron._i18n import _
from neutron.db import api as db_api
TIME_FORMAT = "%Y-%m-%dT%H:%M:%SZ"
@ -307,7 +307,7 @@ def load_class_by_alias_or_classname(namespace, name):
"""
if not name:
LOG.error(_LE("Alias or class name is not set"))
LOG.error("Alias or class name is not set")
raise ImportError(_("Class not found."))
try:
# Try to resolve class by alias
@ -320,9 +320,9 @@ def load_class_by_alias_or_classname(namespace, name):
try:
class_to_load = importutils.import_class(name)
except (ImportError, ValueError):
LOG.error(_LE("Error loading class by alias"),
LOG.error("Error loading class by alias",
exc_info=e1_info)
LOG.error(_LE("Error loading class by class name"),
LOG.error("Error loading class by class name",
exc_info=True)
raise ImportError(_("Class not found."))
return class_to_load
@ -636,7 +636,7 @@ def create_object_with_dependency(creator, dep_getter, dep_creator,
try:
dep_deleter(dependency)
except Exception:
LOG.exception(_LE("Failed cleaning up dependency %s"),
LOG.exception("Failed cleaning up dependency %s",
dep_id)
return result, dependency
@ -743,7 +743,7 @@ def attach_exc_details(e, msg, args=_NO_ARGS_MARKER):
def extract_exc_details(e):
for attr in ('_error_context_msg', '_error_context_args'):
if not hasattr(e, attr):
return _LE('No details.')
return u'No details.'
details = e._error_context_msg
args = e._error_context_args
if args is _NO_ARGS_MARKER:

View File

@ -22,7 +22,6 @@ from oslo_log import log as logging
from oslo_utils import excutils
from sqlalchemy.ext import associationproxy
from neutron._i18n import _LE
LOG = logging.getLogger(__name__)
@ -67,9 +66,9 @@ def safe_creation(context, create_fn, delete_fn, create_bindings,
try:
delete_fn(obj['id'])
except Exception as e:
LOG.error(_LE("Cannot clean up created object %(obj)s. "
"Exception: %(exc)s"), {'obj': obj['id'],
'exc': e})
LOG.error("Cannot clean up created object %(obj)s. "
"Exception: %(exc)s", {'obj': obj['id'],
'exc': e})
return obj, value

View File

@ -33,7 +33,7 @@ from oslo_utils import timeutils
from sqlalchemy.orm import exc
from sqlalchemy import sql
from neutron._i18n import _, _LE, _LI, _LW
from neutron._i18n import _
from neutron.agent.common import utils
from neutron.api.rpc.callbacks import version_manager
from neutron.common import constants as n_const
@ -163,7 +163,7 @@ class AgentDbMixin(ext_agent.AgentPluginBase, AgentAvailabilityZoneMixin):
return
if utils.is_agent_down(agent.heartbeat_timestamp):
LOG.warning(_LW('%(agent_type)s agent %(agent_id)s is not active'),
LOG.warning('%(agent_type)s agent %(agent_id)s is not active',
{'agent_type': agent_type, 'agent_id': agent.id})
return agent
@ -193,8 +193,8 @@ class AgentDbMixin(ext_agent.AgentPluginBase, AgentAvailabilityZoneMixin):
conf = jsonutils.loads(json_value)
except Exception:
if json_value or not ignore_missing:
msg = _LW('Dictionary %(dict_name)s for agent %(agent_type)s '
'on host %(host)s is invalid.')
msg = ('Dictionary %(dict_name)s for agent %(agent_type)s '
'on host %(host)s is invalid.')
LOG.warning(msg, {'dict_name': dict_name,
'agent_type': agent_db.agent_type,
'host': agent_db.host})
@ -271,8 +271,8 @@ class AgentDbMixin(ext_agent.AgentPluginBase, AgentAvailabilityZoneMixin):
(agent['agent_type'],
agent['heartbeat_timestamp'],
agent['host']) for agent in dead_agents])
LOG.warning(_LW("Agent healthcheck: found %(count)s dead agents "
"out of %(total)s:\n%(data)s"),
LOG.warning("Agent healthcheck: found %(count)s dead agents "
"out of %(total)s:\n%(data)s",
{'count': len(dead_agents),
'total': len(agents),
'data': data})
@ -314,8 +314,8 @@ class AgentDbMixin(ext_agent.AgentPluginBase, AgentAvailabilityZoneMixin):
def _log_heartbeat(self, state, agent_db, agent_conf):
if agent_conf.get('log_agent_heartbeats'):
delta = timeutils.utcnow() - agent_db.heartbeat_timestamp
LOG.info(_LI("Heartbeat received from %(type)s agent on "
"host %(host)s, uuid %(uuid)s after %(delta)s"),
LOG.info("Heartbeat received from %(type)s agent on "
"host %(host)s, uuid %(uuid)s after %(delta)s",
{'type': agent_db.agent_type,
'host': agent_db.host,
'uuid': state.get('uuid'),
@ -492,10 +492,10 @@ class AgentExtRpcCallback(object):
'serv_time': (datetime.datetime.isoformat
(time_server_now)),
'diff': diff}
LOG.error(_LE("Message received from the host: %(host)s "
"during the registration of %(agent_name)s has "
"a timestamp: %(agent_time)s. This differs from "
"the current server timestamp: %(serv_time)s by "
"%(diff)s seconds, which is more than the "
"threshold agent down"
"time: %(threshold)s."), log_dict)
LOG.error("Message received from the host: %(host)s "
"during the registration of %(agent_name)s has "
"a timestamp: %(agent_time)s. This differs from "
"the current server timestamp: %(serv_time)s by "
"%(diff)s seconds, which is more than the "
"threshold agent down"
"time: %(threshold)s.", log_dict)

View File

@ -26,7 +26,7 @@ from oslo_utils import timeutils
from sqlalchemy import orm
from sqlalchemy.orm import exc
from neutron._i18n import _, _LE, _LI, _LW
from neutron._i18n import _
from neutron.agent.common import utils as agent_utils
from neutron.common import constants as n_const
from neutron.common import utils
@ -130,10 +130,10 @@ class AgentSchedulerDbMixin(agents_db.AgentDbMixin):
tdelta = timeutils.utcnow() - getattr(self, '_clock_jump_canary',
timeutils.utcnow())
if tdelta.total_seconds() > cfg.CONF.agent_down_time:
LOG.warning(_LW("Time since last %s agent reschedule check has "
"exceeded the interval between checks. Waiting "
"before check to allow agents to send a heartbeat "
"in case there was a clock adjustment."),
LOG.warning("Time since last %s agent reschedule check has "
"exceeded the interval between checks. Waiting "
"before check to allow agents to send a heartbeat "
"in case there was a clock adjustment.",
agent_type)
time.sleep(agent_dead_limit)
self._clock_jump_canary = timeutils.utcnow()
@ -176,10 +176,10 @@ class AgentSchedulerDbMixin(agents_db.AgentDbMixin):
agents_back_online.add(binding_agent_id)
continue
LOG.warning(_LW(
LOG.warning(
"Rescheduling %(resource_name)s %(resource)s from agent "
"%(agent)s because the agent did not report to the server "
"in the last %(dead_time)s seconds."),
"in the last %(dead_time)s seconds.",
{'resource_name': resource_name,
'resource': binding_resource_id,
'agent': binding_agent_id,
@ -189,15 +189,15 @@ class AgentSchedulerDbMixin(agents_db.AgentDbMixin):
except (rescheduling_failed, oslo_messaging.RemoteError):
# Catch individual rescheduling errors here
# so one broken one doesn't stop the iteration.
LOG.exception(_LE("Failed to reschedule %(resource_name)s "
"%(resource)s"),
LOG.exception("Failed to reschedule %(resource_name)s "
"%(resource)s",
{'resource_name': resource_name,
'resource': binding_resource_id})
except Exception:
# we want to be thorough and catch whatever is raised
# to avoid loop abortion
LOG.exception(_LE("Exception encountered during %(resource_name)s "
"rescheduling."),
LOG.exception("Exception encountered during %(resource_name)s "
"rescheduling.",
{'resource_name': resource_name})
@ -211,8 +211,8 @@ class DhcpAgentSchedulerDbMixin(dhcpagentscheduler
def add_periodic_dhcp_agent_status_check(self):
if not cfg.CONF.allow_automatic_dhcp_failover:
LOG.info(_LI("Skipping periodic DHCP agent status check because "
"automatic network rescheduling is disabled."))
LOG.info("Skipping periodic DHCP agent status check because "
"automatic network rescheduling is disabled.")
return
self.add_agent_status_check_worker(
@ -249,23 +249,23 @@ class DhcpAgentSchedulerDbMixin(dhcpagentscheduler
return agent_expected_up > timeutils.utcnow()
def _schedule_network(self, context, network_id, dhcp_notifier):
LOG.info(_LI("Scheduling unhosted network %s"), network_id)
LOG.info("Scheduling unhosted network %s", network_id)
try:
# TODO(enikanorov): have to issue redundant db query
# to satisfy scheduling interface
network = self.get_network(context, network_id)
agents = self.schedule_network(context, network)
if not agents:
LOG.info(_LI("Failed to schedule network %s, "
"no eligible agents or it might be "
"already scheduled by another server"),
LOG.info("Failed to schedule network %s, "
"no eligible agents or it might be "
"already scheduled by another server",
network_id)
return
if not dhcp_notifier:
return
for agent in agents:
LOG.info(_LI("Adding network %(net)s to agent "
"%(agent)s on host %(host)s"),
LOG.info("Adding network %(net)s to agent "
"%(agent)s on host %(host)s",
{'net': network_id,
'agent': agent.id,
'host': agent.host})
@ -275,7 +275,7 @@ class DhcpAgentSchedulerDbMixin(dhcpagentscheduler
# catching any exception during scheduling
# so if _schedule_network is invoked in the loop it could
# continue in any case
LOG.exception(_LE("Failed to schedule network %s"), network_id)
LOG.exception("Failed to schedule network %s", network_id)
def _filter_bindings(self, context, bindings):
"""Skip bindings for which the agent is dead, but starting up."""
@ -332,14 +332,14 @@ class DhcpAgentSchedulerDbMixin(dhcpagentscheduler
active_agents = [agent for agent in agents if
self.is_eligible_agent(context, True, agent)]
if not active_agents:
LOG.warning(_LW("No DHCP agents available, "
"skipping rescheduling"))
LOG.warning("No DHCP agents available, "
"skipping rescheduling")
return
for binding in dead_bindings:
LOG.warning(_LW("Removing network %(network)s from agent "
"%(agent)s because the agent did not report "
"to the server in the last %(dead_time)s "
"seconds."),
LOG.warning("Removing network %(network)s from agent "
"%(agent)s because the agent did not report "
"to the server in the last %(dead_time)s "
"seconds.",
{'network': binding.network_id,
'agent': binding.dhcp_agent_id,
'dead_time': agent_dead_limit})
@ -362,9 +362,9 @@ class DhcpAgentSchedulerDbMixin(dhcpagentscheduler
saved_binding)
# still continue and allow concurrent scheduling attempt
except Exception:
LOG.exception(_LE("Unexpected exception occurred while "
"removing network %(net)s from agent "
"%(agent)s"),
LOG.exception("Unexpected exception occurred while "
"removing network %(net)s from agent "
"%(agent)s",
saved_binding)
if cfg.CONF.network_auto_schedule:
@ -373,8 +373,8 @@ class DhcpAgentSchedulerDbMixin(dhcpagentscheduler
except Exception:
# we want to be thorough and catch whatever is raised
# to avoid loop abortion
LOG.exception(_LE("Exception encountered during network "
"rescheduling"))
LOG.exception("Exception encountered during network "
"rescheduling")
def get_dhcp_agents_hosting_networks(
self, context, network_ids, active=None, admin_state_up=None,

View File

@ -35,7 +35,6 @@ from sqlalchemy import exc as sql_exc
from sqlalchemy import orm
from sqlalchemy.orm import exc
from neutron._i18n import _LE
from neutron.objects import exceptions as obj_exc
@ -148,8 +147,8 @@ def retry_if_session_inactive(context_var_name='context'):
# functions
ctx_arg_index = p_util.getargspec(f).args.index(context_var_name)
except ValueError:
raise RuntimeError(_LE("Could not find position of var %s")
% context_var_name)
raise RuntimeError("Could not find position of var %s" %
context_var_name)
f_with_retry = retry_db_errors(f)
@six.wraps(f)

View File

@ -37,7 +37,7 @@ from sqlalchemy import and_
from sqlalchemy import exc as sql_exc
from sqlalchemy import not_
from neutron._i18n import _, _LE, _LI
from neutron._i18n import _
from neutron.api.rpc.agentnotifiers import l3_rpc_agent_api
from neutron.common import constants as n_const
from neutron.common import exceptions as n_exc
@ -356,8 +356,8 @@ class NeutronDbPluginV2(db_base_plugin_common.DbBasePluginCommon,
objects.append(obj_creator(context, item))
except Exception:
with excutils.save_and_reraise_exception():
LOG.error(_LE("An exception occurred while creating "
"the %(resource)s:%(item)s"),
LOG.error("An exception occurred while creating "
"the %(resource)s:%(item)s",
{'resource': resource, 'item': item})
return objects
@ -968,9 +968,9 @@ class NeutronDbPluginV2(db_base_plugin_common.DbBasePluginCommon,
def _ensure_no_user_ports_on_subnet(self, context, id):
alloc = self._subnet_get_user_allocation(context, id)
if alloc:
LOG.info(_LI("Found port (%(port_id)s, %(ip)s) having IP "
"allocation on subnet "
"%(subnet)s, cannot delete"),
LOG.info("Found port (%(port_id)s, %(ip)s) having IP "
"allocation on subnet "
"%(subnet)s, cannot delete",
{'ip': alloc.ip_address,
'port_id': alloc.port_id,
'subnet': id})

View File

@ -18,7 +18,7 @@ from neutron_lib import exceptions as n_exc
from oslo_config import cfg
from oslo_log import log as logging
from neutron._i18n import _, _LE
from neutron._i18n import _
from neutron.common import utils
from neutron.db import _resource_extend as resource_extend
from neutron.extensions import dns
@ -59,8 +59,8 @@ class DNSDbMixin(object):
cfg.CONF.external_dns_driver)
return self._dns_driver
except ImportError:
LOG.exception(_LE("ImportError exception occurred while loading "
"the external DNS service driver"))
LOG.exception("ImportError exception occurred while loading "
"the external DNS service driver")
raise dns.ExternalDNSDriverNotFound(
driver=cfg.CONF.external_dns_driver)
@ -210,10 +210,10 @@ class DNSDbMixin(object):
self.dns_driver.delete_record_set(context, dns_domain, dns_name,
records)
except (dns.DNSDomainNotFound, dns.DuplicateRecordSet) as e:
LOG.exception(_LE("Error deleting Floating IP data from external "
"DNS service. Name: '%(name)s'. Domain: "
"'%(domain)s'. IP addresses '%(ips)s'. DNS "
"service driver message '%(message)s'"),
LOG.exception("Error deleting Floating IP data from external "
"DNS service. Name: '%(name)s'. Domain: "
"'%(domain)s'. IP addresses '%(ips)s'. DNS "
"service driver message '%(message)s'",
{"name": dns_name,
"domain": dns_domain,
"message": e.msg,
@ -241,10 +241,10 @@ class DNSDbMixin(object):
self.dns_driver.create_record_set(context, dns_domain, dns_name,
records)
except (dns.DNSDomainNotFound, dns.DuplicateRecordSet) as e:
LOG.exception(_LE("Error publishing floating IP data in external "
"DNS service. Name: '%(name)s'. Domain: "
"'%(domain)s'. DNS service driver message "
"'%(message)s'"),
LOG.exception("Error publishing floating IP data in external "
"DNS service. Name: '%(name)s'. Domain: "
"'%(domain)s'. DNS service driver message "
"'%(message)s'",
{"name": dns_name,
"domain": dns_domain,
"message": e.msg})

View File

@ -27,7 +27,7 @@ from oslo_log import helpers as log_helpers
from oslo_log import log as logging
from sqlalchemy import or_
from neutron._i18n import _, _LE
from neutron._i18n import _
from neutron.common import utils
from neutron.db import api as db_api
from neutron.db import models_v2
@ -120,7 +120,7 @@ class DVRDbMixin(ext_dvr.DVRMacAddressPluginBase):
try:
return self._create_dvr_mac_address_retry(context, host, base_mac)
except exceptions.NeutronDbObjectDuplicateEntry:
LOG.error(_LE("MAC generation error after %s attempts"),
LOG.error("MAC generation error after %s attempts",
db_api.MAX_RETRIES)
raise ext_dvr.MacAddressGenerationFailure(host=host)
@ -200,8 +200,8 @@ class DVRDbMixin(ext_dvr.DVRMacAddressPluginBase):
internal_gateway_ports = self.plugin.get_ports(
context, filters=filter)
if not internal_gateway_ports:
LOG.error(_LE("Could not retrieve gateway port "
"for subnet %s"), subnet_info)
LOG.error("Could not retrieve gateway port "
"for subnet %s", subnet_info)
return {}
internal_port = internal_gateway_ports[0]
subnet_info['gateway_mac'] = internal_port['mac_address']

View File

@ -28,7 +28,7 @@ from oslo_log import log as logging
from sqlalchemy import and_, or_
from sqlalchemy.orm import exc as orm_exc
from neutron._i18n import _, _LI
from neutron._i18n import _
from neutron.common import constants
from neutron.common import exceptions as n_exc
from neutron.common import ipv6_utils
@ -72,8 +72,8 @@ class IpamBackendMixin(db_base_plugin_common.DbBasePluginCommon):
ip_range_pools.append(netaddr.IPRange(ip_pool['start'],
ip_pool['end']))
except netaddr.AddrFormatError:
LOG.info(_LI("Found invalid IP address in pool: "
"%(start)s - %(end)s:"),
LOG.info("Found invalid IP address in pool: "
"%(start)s - %(end)s:",
{'start': ip_pool['start'],
'end': ip_pool['end']})
raise n_exc.InvalidAllocationPool(pool=ip_pool)
@ -241,14 +241,14 @@ class IpamBackendMixin(db_base_plugin_common.DbBasePluginCommon):
if ((netaddr.IPSet([subnet.cidr]) & new_subnet_ipset) and
subnet.cidr != constants.PROVISIONAL_IPV6_PD_PREFIX):
# don't give out details of the overlapping subnet
err_msg = (_("Requested subnet with cidr: %(cidr)s for "
"network: %(network_id)s overlaps with another "
"subnet") %
err_msg = ("Requested subnet with cidr: %(cidr)s for "
"network: %(network_id)s overlaps with another "
"subnet" %
{'cidr': new_subnet_cidr,
'network_id': network.id})
LOG.info(_LI("Validation for CIDR: %(new_cidr)s failed - "
"overlaps with subnet %(subnet_id)s "
"(CIDR: %(cidr)s)"),
LOG.info("Validation for CIDR: %(new_cidr)s failed - "
"overlaps with subnet %(subnet_id)s "
"(CIDR: %(cidr)s)",
{'new_cidr': new_subnet_cidr,
'subnet_id': subnet.id,
'cidr': subnet.cidr})
@ -284,12 +284,12 @@ class IpamBackendMixin(db_base_plugin_common.DbBasePluginCommon):
end_ip = netaddr.IPAddress(ip_pool.last, ip_pool.version)
if (start_ip.version != subnet.version or
end_ip.version != subnet.version):
LOG.info(_LI("Specified IP addresses do not match "
"the subnet IP version"))
LOG.info("Specified IP addresses do not match "
"the subnet IP version")
raise n_exc.InvalidAllocationPool(pool=ip_pool)
if start_ip < subnet_first_ip or end_ip > subnet_last_ip:
LOG.info(_LI("Found pool larger than subnet "
"CIDR:%(start)s - %(end)s"),
LOG.info("Found pool larger than subnet "
"CIDR:%(start)s - %(end)s",
{'start': start_ip, 'end': end_ip})
raise n_exc.OutOfBoundsAllocationPool(
pool=ip_pool,
@ -309,8 +309,8 @@ class IpamBackendMixin(db_base_plugin_common.DbBasePluginCommon):
if ip_sets[l_cursor] & ip_sets[r_cursor]:
l_range = ip_ranges[l_cursor]
r_range = ip_ranges[r_cursor]
LOG.info(_LI("Found overlapping ranges: %(l_range)s and "
"%(r_range)s"),
LOG.info("Found overlapping ranges: %(l_range)s and "
"%(r_range)s",
{'l_range': l_range, 'r_range': r_range})
raise n_exc.OverlappingAllocationPools(
pool_1=l_range,

View File

@ -24,7 +24,6 @@ from oslo_log import log as logging
from oslo_utils import excutils
from sqlalchemy import and_
from neutron._i18n import _LE, _LW
from neutron.common import constants as n_const
from neutron.common import ipv6_utils
from neutron.db import api as db_api
@ -55,7 +54,7 @@ class IpamPluggableBackend(ipam_backend_mixin.IpamBackendMixin):
try:
func(*args, **kwargs)
except Exception as e:
LOG.warning(_LW("Revert failed with: %s"), e)
LOG.warning("Revert failed with: %s", e)
def _ipam_deallocate_ips(self, context, ipam_driver, port, ips,
revert_on_fail=True):
@ -92,8 +91,8 @@ class IpamPluggableBackend(ipam_backend_mixin.IpamBackendMixin):
elif not revert_on_fail and ips:
addresses = ', '.join(self._get_failed_ips(ips,
deallocated))
LOG.error(_LE("IP deallocation failed on "
"external system for %s"), addresses)
LOG.error("IP deallocation failed on "
"external system for %s", addresses)
return deallocated
def _ipam_allocate_ips(self, context, ipam_driver, port, ips,
@ -146,8 +145,8 @@ class IpamPluggableBackend(ipam_backend_mixin.IpamBackendMixin):
elif not revert_on_fail and ips:
addresses = ', '.join(self._get_failed_ips(ips,
allocated))
LOG.error(_LE("IP allocation failed on "
"external system for %s"), addresses)
LOG.error("IP allocation failed on "
"external system for %s", addresses)
return allocated

View File

@ -22,7 +22,7 @@ from oslo_log import log as logging
import oslo_messaging
from sqlalchemy import or_
from neutron._i18n import _, _LI
from neutron._i18n import _
from neutron.agent.common import utils as agent_utils
from neutron.common import constants as l_consts
from neutron.common import utils as n_utils
@ -66,8 +66,8 @@ class L3AgentSchedulerDbMixin(l3agentscheduler.L3AgentSchedulerPluginBase,
def add_periodic_l3_agent_status_check(self):
if not cfg.CONF.allow_automatic_l3agent_failover:
LOG.info(_LI("Skipping period L3 agent status check because "
"automatic router rescheduling is disabled."))
LOG.info("Skipping period L3 agent status check because "
"automatic router rescheduling is disabled.")
return
self.add_agent_status_check_worker(
@ -322,8 +322,8 @@ class L3AgentSchedulerDbMixin(l3agentscheduler.L3AgentSchedulerPluginBase,
agent = self._get_agent_by_type_and_host(
context, constants.AGENT_TYPE_L3, host)
if not agentschedulers_db.services_available(agent.admin_state_up):
LOG.info(_LI("Agent has its services disabled. Returning "
"no active routers. Agent: %s"), agent)
LOG.info("Agent has its services disabled. Returning "
"no active routers. Agent: %s", agent)
return []
scheduled_router_ids = self._get_router_ids_for_agent(
context, agent, router_ids)

View File

@ -35,7 +35,7 @@ import six
from sqlalchemy import orm
from sqlalchemy.orm import exc
from neutron._i18n import _, _LE, _LI, _LW
from neutron._i18n import _
from neutron.api.rpc.agentnotifiers import l3_rpc_agent_api
from neutron.common import constants as n_const
from neutron.common import ipv6_utils
@ -145,21 +145,21 @@ class L3_NAT_dbonly_mixin(l3.RouterPluginBase,
try:
self._fix_or_kill_floating_port(context, port_id)
except Exception:
LOG.exception(_LE("Error cleaning up floating IP port: %s"),
LOG.exception("Error cleaning up floating IP port: %s",
port_id)
def _fix_or_kill_floating_port(self, context, port_id):
fip = (context.session.query(l3_models.FloatingIP).
filter_by(floating_port_id=port_id).first())
if fip:
LOG.warning(_LW("Found incorrect device_id on floating port "
"%(pid)s, correcting to %(fip)s."),
LOG.warning("Found incorrect device_id on floating port "
"%(pid)s, correcting to %(fip)s.",
{'pid': port_id, 'fip': fip.id})
self._core_plugin.update_port(
context, port_id, {'port': {'device_id': fip.id}})
else:
LOG.warning(_LW("Found floating IP port %s without floating IP, "
"deleting."), port_id)
LOG.warning("Found floating IP port %s without floating IP, "
"deleting.", port_id)
self._core_plugin.delete_port(
context, port_id, l3_port_check=False)
@ -1616,8 +1616,8 @@ class L3_NAT_dbonly_mixin(l3.RouterPluginBase,
if not fixed_ips:
# Skip ports without IPs, which can occur if a subnet
# attached to a router is deleted
LOG.info(_LI("Skipping port %s as no IP is configure on "
"it"),
LOG.info("Skipping port %s as no IP is configure on "
"it",
port['id'])
continue
yield port

View File

@ -29,7 +29,7 @@ from oslo_log import log as logging
from oslo_utils import excutils
import six
from neutron._i18n import _, _LE, _LI, _LW
from neutron._i18n import _
from neutron.common import constants as l3_const
from neutron.common import utils as n_utils
from neutron.db import api as db_api
@ -227,8 +227,8 @@ class DVRResourceOperationHandler(object):
port_type=const.DEVICE_OWNER_DVR_INTERFACE
)
)
LOG.info(_LI('SNAT interface port list does not exist,'
' so create one: %s'), port_list)
LOG.info('SNAT interface port list does not exist,'
' so create one: %s', port_list)
for intf in int_ports:
if intf.fixed_ips:
# Passing the subnet for the port to make sure the IP's
@ -431,8 +431,8 @@ class DVRResourceOperationHandler(object):
try:
revert()
except Exception:
LOG.exception(_LE("Failed to revert change "
"to router port %s."),
LOG.exception("Failed to revert change "
"to router port %s.",
port['id'])
LOG.debug("CSNAT port updated for IPv6 subnet: %s", updated_port)
@ -544,7 +544,7 @@ class DVRResourceOperationHandler(object):
for p in c_snat_ports:
if subnet_id is None or not p['fixed_ips']:
if not p['fixed_ips']:
LOG.info(_LI("CSNAT port has no IPs: %s"), p)
LOG.info("CSNAT port has no IPs: %s", p)
self.l3plugin._core_plugin.delete_port(context,
p['id'],
l3_port_check=False)
@ -847,8 +847,8 @@ class _DVRAgentInterfaceMixin(object):
f_port = self._get_agent_gw_ports_exist_for_network(
context, network_id, host, l3_agent_db['id'])
if not f_port:
LOG.info(_LI('Agent Gateway port does not exist,'
' so create one: %s'), f_port)
LOG.info('Agent Gateway port does not exist,'
' so create one: %s', f_port)
port_data = {'tenant_id': '',
'network_id': network_id,
'device_id': l3_agent_db['id'],
@ -1010,8 +1010,8 @@ class L3_NAT_with_dvr_db_mixin(_DVRAgentInterfaceMixin,
# using admin context as router may belong to admin tenant
router = self._get_router(context.elevated(), router_id)
except l3.RouterNotFound:
LOG.warning(_LW("Router %s was not found. "
"Skipping agent notification."),
LOG.warning("Router %s was not found. "
"Skipping agent notification.",
router_id)
return

View File

@ -35,7 +35,7 @@ import sqlalchemy as sa
from sqlalchemy import exc as sql_exc
from sqlalchemy import orm
from neutron._i18n import _, _LE, _LI, _LW
from neutron._i18n import _
from neutron.common import constants as n_const
from neutron.common import utils as n_utils
from neutron.db import _utils as db_utils
@ -166,8 +166,8 @@ class L3_HA_NAT_db_mixin(l3_dvr_db.L3_NAT_with_dvr_db_mixin,
return allocation.vr_id
except db_exc.DBDuplicateEntry:
LOG.info(_LI("Attempt %(count)s to allocate a VRID in the "
"network %(network)s for the router %(router)s"),
LOG.info("Attempt %(count)s to allocate a VRID in the "
"network %(network)s for the router %(router)s",
{'count': count, 'network': network_id,
'router': router_id})
@ -255,9 +255,9 @@ class L3_HA_NAT_db_mixin(l3_dvr_db.L3_NAT_with_dvr_db_mixin,
max_agents = cfg.CONF.max_l3_agents_per_router
if max_agents:
if max_agents > num_agents:
LOG.info(_LI("Number of active agents lower than "
"max_l3_agents_per_router. L3 agents "
"available: %s"), num_agents)
LOG.info("Number of active agents lower than "
"max_l3_agents_per_router. L3 agents "
"available: %s", num_agents)
else:
num_agents = max_agents
@ -414,9 +414,9 @@ class L3_HA_NAT_db_mixin(l3_dvr_db.L3_NAT_with_dvr_db_mixin,
with excutils.save_and_reraise_exception() as ctx:
if isinstance(e, l3_ha.NoVRIDAvailable):
ctx.reraise = False
LOG.warning(_LW("No more VRIDs for router: %s"), e)
LOG.warning("No more VRIDs for router: %s", e)
else:
LOG.exception(_LE("Failed to schedule HA router %s."),
LOG.exception("Failed to schedule HA router %s.",
router_id)
router['status'] = self._update_router_db(
context, router_id,
@ -502,15 +502,15 @@ class L3_HA_NAT_db_mixin(l3_dvr_db.L3_NAT_with_dvr_db_mixin,
LOG.debug(
"HA network for tenant %s was already deleted.", tenant_id)
except sa.exc.InvalidRequestError:
LOG.info(_LI("HA network %s can not be deleted."), net_id)
LOG.info("HA network %s can not be deleted.", net_id)
except n_exc.NetworkInUse:
# network is still in use, this is normal so we don't
# log anything
pass
else:
LOG.info(_LI("HA network %(network)s was deleted as "
"no HA routers are present in tenant "
"%(tenant)s."),
LOG.info("HA network %(network)s was deleted as "
"no HA routers are present in tenant "
"%(tenant)s.",
{'network': net_id, 'tenant': tenant_id})
@registry.receives(resources.ROUTER, [events.PRECOMMIT_DELETE])
@ -622,8 +622,8 @@ class L3_HA_NAT_db_mixin(l3_dvr_db.L3_NAT_with_dvr_db_mixin,
port = binding.port
if not port:
# Filter the HA router has no ha port here
LOG.info(_LI("HA router %s is missing HA router port "
"bindings. Skipping it."),
LOG.info("HA router %s is missing HA router port "
"bindings. Skipping it.",
binding.router_id)
routers_dict.pop(binding.router_id)
continue

View File

@ -18,7 +18,6 @@ from neutron_lib.plugins import directory
from oslo_log import log as logging
import oslo_messaging
from neutron._i18n import _LE
from neutron.common import utils
LOG = logging.getLogger(__name__)
@ -44,7 +43,7 @@ class MeteringRpcCallbacks(object):
else:
agents = l3_plugin.get_l3_agents(context, filters={'host': [host]})
if not agents:
LOG.error(_LE('Unable to find agent %s.'), host)
LOG.error('Unable to find agent %s.', host)
return
routers = l3_plugin.list_routers_on_l3_agent(context, agents[0].id)

View File

@ -17,7 +17,6 @@ from neutron_lib.callbacks import registry
from neutron_lib.callbacks import resources
from oslo_log import log as logging
from neutron._i18n import _LE
from neutron.db import api as db_api
from neutron.db import models_v2
from neutron.objects import provisioning_blocks as pb_obj
@ -122,7 +121,7 @@ def provisioning_complete(context, object_id, object_type, entity):
# this can't be called in a transaction to avoid REPEATABLE READ
# tricking us into thinking there are remaining provisioning components
if context.session.is_active:
raise RuntimeError(_LE("Must not be called in a transaction"))
raise RuntimeError("Must not be called in a transaction")
standard_attr_id = _get_standard_attr_id(context, object_id,
object_type)
if not standard_attr_id:
@ -162,10 +161,10 @@ def is_object_blocked(context, object_id, object_type):
def _get_standard_attr_id(context, object_id, object_type):
model = _RESOURCE_TO_MODEL_MAP.get(object_type)
if not model:
raise RuntimeError(_LE("Could not find model for %s. If you are "
"adding provisioning blocks for a new resource "
"you must call add_model_for_resource during "
"initialization for your type.") % object_type)
raise RuntimeError("Could not find model for %s. If you are "
"adding provisioning blocks for a new resource "
"you must call add_model_for_resource during "
"initialization for your type." % object_type)
obj = (context.session.query(model).enable_eagerloads(False).
filter_by(id=object_id).first())
if not obj:

View File

@ -16,7 +16,6 @@ from neutron_lib.callbacks import resources
from oslo_log import log as logging
from oslo_utils import uuidutils
from neutron._i18n import _LI
from neutron.db import api as db_api
from neutron.db.models import segment as segments_model
from neutron.objects import base as base_obj
@ -55,8 +54,8 @@ def add_network_segment(context, network_id, segment, segment_index=0,
context=context,
segment=netseg_obj)
segment['id'] = netseg_obj.id
LOG.info(_LI("Added segment %(id)s of type %(network_type)s for network "
"%(network_id)s"),
LOG.info("Added segment %(id)s of type %(network_type)s for network "
"%(network_id)s",
{'id': netseg_obj.id,
'network_type': netseg_obj.network_type,
'network_id': netseg_obj.network_id})

View File

@ -21,7 +21,7 @@ from sqlalchemy.ext.associationproxy import association_proxy
from sqlalchemy.ext import declarative
from sqlalchemy.orm import session as se
from neutron._i18n import _, _LE
from neutron._i18n import _
from neutron.db import sqlalchemytypes
@ -178,9 +178,9 @@ def get_standard_attr_resource_model_map():
for subclass in HasStandardAttributes.__subclasses__():
for resource in subclass.get_api_collections():
if resource in rs_map:
raise RuntimeError(_LE("Model %(sub)s tried to register for "
"API resource %(res)s which conflicts "
"with model %(other)s.") %
raise RuntimeError("Model %(sub)s tried to register for "
"API resource %(res)s which conflicts "
"with model %(other)s." %
dict(sub=subclass, other=rs_map[resource],
res=resource))
rs_map[resource] = subclass
@ -206,8 +206,8 @@ def get_tag_resource_parent_map():
@event.listens_for(se.Session, 'after_bulk_delete')
def throw_exception_on_bulk_delete_of_listened_for_objects(delete_context):
if hasattr(delete_context.mapper.class_, 'revises_on_change'):
raise RuntimeError(_LE("%s may not be deleted in bulk because it "
"bumps the revision of other resources via "
"SQLAlchemy event handlers, which are not "
"compatible with bulk deletes.") %
raise RuntimeError("%s may not be deleted in bulk because it "
"bumps the revision of other resources via "
"SQLAlchemy event handlers, which are not "
"compatible with bulk deletes." %
delete_context.mapper.class_)

View File

@ -18,7 +18,7 @@ from neutronclient.common import utils
from neutronclient.neutron import v2_0 as client
from neutronclient.neutron.v2_0 import port
from neutron._i18n import _, _LI
from neutron._i18n import _
class ProbeCommand(client.NeutronCommand):
@ -84,7 +84,7 @@ class ClearProbe(ProbeCommand):
def take_action(self, parsed_args):
debug_agent = self.get_debug_agent()
cleared_probes_count = debug_agent.clear_probes()
self.log.info(_LI('%d probe(s) deleted'), cleared_probes_count)
self.log.info('%d probe(s) deleted', cleared_probes_count)
class ExecProbe(ProbeCommand):

View File

@ -21,7 +21,6 @@ from neutron_lib.api.definitions import portbindings
from neutron_lib import constants
from oslo_log import log as logging
from neutron._i18n import _LW
from neutron.agent.linux import dhcp
from neutron.agent.linux import ip_lib
@ -108,7 +107,7 @@ class NeutronDebugAgent(object):
try:
ip.netns.delete(namespace)
except Exception:
LOG.warning(_LW('Failed to delete namespace %s'), namespace)
LOG.warning('Failed to delete namespace %s', namespace)
else:
self.driver.unplug(self.driver.get_device_name(port),
bridge=bridge)

View File

@ -19,7 +19,6 @@ from oslo_config import cfg
from oslo_utils import importutils
from neutron._i18n import _
from neutron._i18n import _LW
from neutron.agent.common import utils
from neutron.agent.linux import interface
from neutron.conf.agent import common as config
@ -81,9 +80,9 @@ class NeutronDebugShell(shell.NeutronShell):
self.debug_agent = debug_agent.NeutronDebugAgent(cfg.CONF,
client,
driver)
self.log.warning(_LW('This tool is deprecated and will be removed '
'in the future to be replaced with a more '
'powerful troubleshooting toolkit.'))
self.log.warning('This tool is deprecated and will be removed '
'in the future to be replaced with a more '
'powerful troubleshooting toolkit.')
def main(argv=None):

View File

@ -24,7 +24,7 @@ from oslo_log import log as logging
import six
import webob.exc
from neutron._i18n import _, _LE
from neutron._i18n import _
from neutron.api import extensions
from neutron.api.v2 import base
from neutron.api.v2 import resource
@ -47,8 +47,8 @@ class RouterSchedulerController(wsgi.Controller):
def get_plugin(self):
plugin = directory.get_plugin(plugin_constants.L3)
if not plugin:
LOG.error(_LE('No plugin for L3 routing registered to handle '
'router scheduling'))
LOG.error('No plugin for L3 routing registered to handle '
'router scheduling')
msg = _('The resource could not be found.')
raise webob.exc.HTTPNotFound(msg)
return plugin
@ -89,8 +89,8 @@ class L3AgentsHostingRouterController(wsgi.Controller):
def get_plugin(self):
plugin = directory.get_plugin(plugin_constants.L3)
if not plugin:
LOG.error(_LE('No plugin for L3 routing registered to handle '
'router scheduling'))
LOG.error('No plugin for L3 routing registered to handle '
'router scheduling')
msg = _('The resource could not be found.')
raise webob.exc.HTTPNotFound(msg)
return plugin

View File

@ -20,7 +20,7 @@ from neutron_lib import exceptions
from oslo_config import cfg
from oslo_log import log as logging
from neutron._i18n import _, _LI
from neutron._i18n import _
LOG = logging.getLogger(__name__)
@ -45,7 +45,7 @@ def disable_extension_by_config(aliases):
if not cfg.CONF.vlan_transparent:
if 'vlan-transparent' in aliases:
aliases.remove('vlan-transparent')
LOG.info(_LI('Disabled vlantransparent extension.'))
LOG.info('Disabled vlantransparent extension.')
def get_vlan_transparent(network):

View File

@ -23,7 +23,7 @@ from oslo_db import exception as db_exc
from oslo_log import log
from oslo_utils import uuidutils
from neutron._i18n import _, _LE
from neutron._i18n import _
from neutron.ipam import driver as ipam_base
from neutron.ipam.drivers.neutrondb_ipam import db_api as ipam_db_api
from neutron.ipam import exceptions as ipam_exc
@ -90,9 +90,8 @@ class NeutronDbSubnet(ipam_base.Subnet):
ipam_subnet = ipam_db_api.IpamSubnetManager.load_by_neutron_subnet_id(
ctx, neutron_subnet_id)
if not ipam_subnet:
LOG.error(_LE("IPAM subnet referenced to "
"Neutron subnet %s does not exist"),
neutron_subnet_id)
LOG.error("IPAM subnet referenced to "
"Neutron subnet %s does not exist", neutron_subnet_id)
raise n_exc.SubnetNotFound(subnet_id=neutron_subnet_id)
pools = []
for pool in ipam_subnet.allocation_pools:
@ -316,9 +315,8 @@ class NeutronDbPool(subnet_alloc.SubnetAllocator):
count = ipam_db_api.IpamSubnetManager.delete(self._context,
subnet_id)
if count < 1:
LOG.error(_LE("IPAM subnet referenced to "
"Neutron subnet %s does not exist"),
subnet_id)
LOG.error("IPAM subnet referenced to "
"Neutron subnet %s does not exist", subnet_id)
raise n_exc.SubnetNotFound(subnet_id=subnet_id)
def needs_rollback(self):

View File

@ -25,7 +25,7 @@ from oslo_utils import excutils
from osprofiler import profiler
import six
from neutron._i18n import _, _LE, _LI
from neutron._i18n import _
from neutron.common import utils
from neutron.plugins.common import constants
@ -126,7 +126,7 @@ class NeutronManager(object):
# intentionally to allow v2 plugins to be monitored
# for performance metrics.
plugin_provider = cfg.CONF.core_plugin
LOG.info(_LI("Loading core plugin: %s"), plugin_provider)
LOG.info("Loading core plugin: %s", plugin_provider)
# NOTE(armax): keep hold of the actual plugin object
plugin = self._get_plugin_instance(CORE_PLUGINS_NAMESPACE,
plugin_provider)
@ -159,7 +159,7 @@ class NeutronManager(object):
plugin_provider)
except ImportError:
with excutils.save_and_reraise_exception():
LOG.error(_LE("Plugin '%s' not found."), plugin_provider)
LOG.error("Plugin '%s' not found.", plugin_provider)
def _get_plugin_instance(self, namespace, plugin_provider):
plugin_class = self.load_class_for_provider(namespace, plugin_provider)
@ -174,7 +174,7 @@ class NeutronManager(object):
if ext_alias in constants.EXT_TO_SERVICE_MAPPING:
service_type = constants.EXT_TO_SERVICE_MAPPING[ext_alias]
directory.add_plugin(service_type, plugin)
LOG.info(_LI("Service %s is supported by the core plugin"),
LOG.info("Service %s is supported by the core plugin",
service_type)
def _get_default_service_plugins(self):
@ -194,7 +194,7 @@ class NeutronManager(object):
if provider == '':
continue
LOG.info(_LI("Loading Plugin: %s"), provider)
LOG.info("Loading Plugin: %s", provider)
plugin_inst = self._get_plugin_instance('neutron.service_plugins',
provider)

View File

@ -29,7 +29,6 @@ from oslo_log import log as logging
from oslo_utils import uuidutils
from sqlalchemy.orm import attributes as sql_attr
from neutron._i18n import _LE, _LI, _LW
from neutron.notifiers import batch_notifier
@ -162,8 +161,8 @@ class Notifier(object):
def _can_notify(self, port):
if not port.id:
LOG.warning(_LW("Port ID not set! Nova will not be notified of "
"port status change."))
LOG.warning("Port ID not set! Nova will not be notified of "
"port status change.")
return False
# If there is no device_id set there is nothing we can do here.
@ -248,11 +247,11 @@ class Notifier(object):
LOG.debug("Nova returned NotFound for event: %s",
batched_events)
except Exception:
LOG.exception(_LE("Failed to notify nova on events: %s"),
LOG.exception("Failed to notify nova on events: %s",
batched_events)
else:
if not isinstance(response, list):
LOG.error(_LE("Error response returned from nova: %s"),
LOG.error("Error response returned from nova: %s",
response)
return
response_error = False
@ -263,10 +262,10 @@ class Notifier(object):
response_error = True
continue
if code != 200:
LOG.warning(_LW("Nova event: %s returned with failed "
"status"), event)
LOG.warning("Nova event: %s returned with failed "
"status", event)
else:
LOG.info(_LI("Nova event response: %s"), event)
LOG.info("Nova event response: %s", event)
if response_error:
LOG.error(_LE("Error response returned from nova: %s"),
LOG.error("Error response returned from nova: %s",
response)

View File

@ -16,7 +16,6 @@ from oslo_log import log as logging
import pecan
from pecan import request
from neutron._i18n import _LW
from neutron import manager
from neutron.pecan_wsgi.controllers import utils
@ -85,8 +84,8 @@ class ItemController(utils.NeutronPecanController):
collection_path)
if not controller:
if collection not in self._member_actions:
LOG.warning(_LW("No controller found for: %s - returning"
"response code 404"), collection)
LOG.warning("No controller found for: %s - returning"
"response code 404", collection)
pecan.abort(404)
# collection is a member action, so we create a new controller
# for it.

View File

@ -20,7 +20,6 @@ import pecan
from pecan import request
import six.moves.urllib.parse as urlparse
from neutron._i18n import _LW
from neutron.api.v2 import attributes
from neutron.api.views import versions as versions_view
from neutron import manager
@ -120,8 +119,8 @@ class V2Controller(object):
controller = manager.NeutronManager.get_controller_for_resource(
collection)
if not controller:
LOG.warning(_LW("No controller found for: %s - returning response "
"code 404"), collection)
LOG.warning("No controller found for: %s - returning response "
"code 404", collection)
pecan.abort(404)
# Store resource and collection names in pecan request context so that
# hooks can leverage them if necessary. The following code uses

View File

@ -17,7 +17,6 @@ import oslo_i18n
from oslo_log import log as logging
from pecan import hooks
from neutron._i18n import _LE, _LI
from neutron.api import api_common
from neutron.api.v2 import base as v2base
@ -34,8 +33,8 @@ class ExceptionTranslationHook(hooks.PecanHook):
exc = api_common.convert_exception_to_http_exc(e, v2base.FAULT_MAP,
language)
if hasattr(exc, 'code') and 400 <= exc.code < 500:
LOG.info(_LI('%(action)s failed (client error): %(exc)s'),
LOG.info('%(action)s failed (client error): %(exc)s',
{'action': state.request.method, 'exc': exc})
else:
LOG.exception(_LE('%s failed.'), state.request.method)
LOG.exception('%s failed.', state.request.method)
return exc

View File

@ -32,7 +32,7 @@ from oslo_utils import encodeutils
from oslo_utils import excutils
import webob.exc
from neutron._i18n import _, _LE, _LI
from neutron._i18n import _
from neutron.api.v2 import attributes
from neutron.common import exceptions as n_exc
from neutron.plugins.common import constants as p_const
@ -201,7 +201,7 @@ def delete_port_on_error(core_plugin, context, port_id):
except exceptions.PortNotFound:
LOG.debug("Port %s not found", port_id)
except Exception:
LOG.exception(_LE("Failed to delete port: %s"), port_id)
LOG.exception("Failed to delete port: %s", port_id)
@contextlib.contextmanager
@ -214,7 +214,7 @@ def update_port_on_error(core_plugin, context, port_id, revert_value):
core_plugin.update_port(context, port_id,
{'port': revert_value})
except Exception:
LOG.exception(_LE("Failed to update port: %s"), port_id)
LOG.exception("Failed to update port: %s", port_id)
def get_interface_name(name, prefix='', max_len=n_const.DEVICE_NAME_MAX_LEN):
@ -240,9 +240,9 @@ def get_interface_name(name, prefix='', max_len=n_const.DEVICE_NAME_MAX_LEN):
new_name = ('%(prefix)s%(truncated)s%(hash)s' %
{'prefix': prefix, 'truncated': name[0:namelen],
'hash': hashed_name.hexdigest()[0:INTERFACE_HASH_LEN]})
LOG.info(_LI("The requested interface name %(requested_name)s exceeds the "
"%(limit)d character limitation. It was shortened to "
"%(new_name)s to fit."),
LOG.info("The requested interface name %(requested_name)s exceeds the "
"%(limit)d character limitation. It was shortened to "
"%(new_name)s to fit.",
{'requested_name': requested_name,
'limit': max_len, 'new_name': new_name})
return new_name

View File

@ -27,7 +27,7 @@ import six
from sqlalchemy import or_
from sqlalchemy.orm import exc
from neutron._i18n import _, _LE
from neutron._i18n import _
from neutron.db import api as db_api
from neutron.db.models import securitygroup as sg_models
from neutron.db import models_v2
@ -166,7 +166,7 @@ def get_port(context, port_id):
except exc.NoResultFound:
return
except exc.MultipleResultsFound:
LOG.error(_LE("Multiple ports have port_id starting with %s"),
LOG.error("Multiple ports have port_id starting with %s",
port_id)
return
@ -251,7 +251,7 @@ def get_port_binding_host(context, port_id):
{'port_id': port_id})
return
except exc.MultipleResultsFound:
LOG.error(_LE("Multiple ports have port_id starting with %s"),
LOG.error("Multiple ports have port_id starting with %s",
port_id)
return
return query.host
@ -312,7 +312,7 @@ def partial_port_ids_to_full_ids(context, partial_ids):
if len(matching) < 1:
LOG.info("No ports have port_id starting with %s", partial_id)
elif len(matching) > 1:
LOG.error(_LE("Multiple ports have port_id starting with %s"),
LOG.error("Multiple ports have port_id starting with %s",
partial_id)
return result

View File

@ -20,7 +20,6 @@ from oslo_log import log
from oslo_serialization import jsonutils
import sqlalchemy
from neutron._i18n import _LW
from neutron.db import segments_db
from neutron.plugins.ml2 import driver_api as api
@ -245,7 +244,7 @@ class PortContext(MechanismDriverContext, api.PortContext):
segment = segments_db.get_segment_by_id(self._plugin_context,
segment_id)
if not segment:
LOG.warning(_LW("Could not expand segment %s"), segment_id)
LOG.warning("Could not expand segment %s", segment_id)
return segment
@property

View File

@ -31,7 +31,6 @@ from oslo_service import service
from oslo_utils import excutils
from osprofiler import profiler
from neutron._i18n import _LE, _LI
from neutron.agent.l2 import l2_agent_extensions_manager as ext_manager
from neutron.agent import rpc as agent_rpc
from neutron.agent import securitygroups_rpc as agent_sg_rpc
@ -72,9 +71,9 @@ class CommonAgentLoop(service.Service):
def _validate_manager_class(self):
if not isinstance(self.mgr,
amb.CommonAgentManagerBase):
LOG.error(_LE("Manager class must inherit from "
"CommonAgentManagerBase to ensure CommonAgent "
"works properly."))
LOG.error("Manager class must inherit from "
"CommonAgentManagerBase to ensure CommonAgent "
"works properly.")
sys.exit(1)
def start(self):
@ -112,7 +111,7 @@ class CommonAgentLoop(service.Service):
self.daemon_loop()
def stop(self, graceful=True):
LOG.info(_LI("Stopping %s agent."), self.agent_type)
LOG.info("Stopping %s agent.", self.agent_type)
if graceful and self.quitting_rpc_timeout:
self.set_rpc_timeout(self.quitting_rpc_timeout)
super(CommonAgentLoop, self).stop(graceful)
@ -128,22 +127,22 @@ class CommonAgentLoop(service.Service):
self.agent_state,
True)
if agent_status == n_const.AGENT_REVIVED:
LOG.info(_LI('%s Agent has just been revived. '
'Doing a full sync.'),
LOG.info('%s Agent has just been revived. '
'Doing a full sync.',
self.agent_type)
self.fullsync = True
# we only want to update resource versions on startup
self.agent_state.pop('resource_versions', None)
self.agent_state.pop('start_flag', None)
except Exception:
LOG.exception(_LE("Failed reporting state!"))
LOG.exception("Failed reporting state!")
def _validate_rpc_endpoints(self):
if not isinstance(self.endpoints[0],
amb.CommonAgentManagerRpcCallBackBase):
LOG.error(_LE("RPC Callback class must inherit from "
"CommonAgentManagerRpcCallBackBase to ensure "
"CommonAgent works properly."))
LOG.error("RPC Callback class must inherit from "
"CommonAgentManagerRpcCallBackBase to ensure "
"CommonAgent works properly.")
sys.exit(1)
def setup_rpc(self):
@ -153,7 +152,7 @@ class CommonAgentLoop(service.Service):
self.context, self.sg_plugin_rpc, defer_refresh_firewall=True)
self.agent_id = self.mgr.get_agent_id()
LOG.info(_LI("RPC agent_id: %s"), self.agent_id)
LOG.info("RPC agent_id: %s", self.agent_id)
self.topic = topics.AGENT
self.state_rpc = agent_rpc.PluginReportStateAPI(topics.REPORTS)
@ -217,7 +216,7 @@ class CommonAgentLoop(service.Service):
devices_details_list = self.plugin_rpc.get_devices_details_list(
self.context, devices, self.agent_id, host=cfg.CONF.host)
except Exception:
LOG.exception(_LE("Unable to get port details for %s"), devices)
LOG.exception("Unable to get port details for %s", devices)
# resync is needed
return True
@ -234,7 +233,7 @@ class CommonAgentLoop(service.Service):
LOG.debug("Port %s added", device)
if 'port_id' in device_details:
LOG.info(_LI("Port %(device)s updated. Details: %(details)s"),
LOG.info("Port %(device)s updated. Details: %(details)s",
{'device': device, 'details': device_details})
self.mgr.setup_arp_spoofing_protection(device,
device_details)
@ -312,7 +311,7 @@ class CommonAgentLoop(service.Service):
context=self.context,
device_details=device_details)
else:
LOG.info(_LI("Device %s not defined on plugin"), device)
LOG.info("Device %s not defined on plugin", device)
@contextlib.contextmanager
def _ignore_missing_device_exceptions(self, device):
@ -328,7 +327,7 @@ class CommonAgentLoop(service.Service):
resync = False
self.sg_agent.remove_devices_filter(devices)
for device in devices:
LOG.info(_LI("Attachment %s removed"), device)
LOG.info("Attachment %s removed", device)
details = None
try:
details = self.plugin_rpc.update_device_down(self.context,
@ -336,11 +335,11 @@ class CommonAgentLoop(service.Service):
self.agent_id,
cfg.CONF.host)
except Exception:
LOG.exception(_LE("Error occurred while removing port %s"),
LOG.exception("Error occurred while removing port %s",
device)
resync = True
if details and details['exists']:
LOG.info(_LI("Port %s updated."), device)
LOG.info("Port %s updated.", device)
else:
LOG.debug("Device %s not defined on plugin", device)
port_id = self._clean_network_ports(device)
@ -429,7 +428,7 @@ class CommonAgentLoop(service.Service):
or device_info.get('removed'))
def daemon_loop(self):
LOG.info(_LI("%s Agent RPC Daemon Started!"), self.agent_type)
LOG.info("%s Agent RPC Daemon Started!", self.agent_type)
device_info = None
sync = True
@ -441,7 +440,7 @@ class CommonAgentLoop(service.Service):
self.fullsync = False
if sync:
LOG.info(_LI("%s Agent out of sync with plugin!"),
LOG.info("%s Agent out of sync with plugin!",
self.agent_type)
device_info = self.scan_devices(previous=device_info, sync=sync)
@ -453,7 +452,7 @@ class CommonAgentLoop(service.Service):
try:
sync = self.process_network_devices(device_info)
except Exception:
LOG.exception(_LE("Error in agent loop. Devices info: %s"),
LOG.exception("Error in agent loop. Devices info: %s",
device_info)
sync = True

View File

@ -21,7 +21,6 @@ from oslo_config import cfg
from oslo_db import exception as db_exc
from oslo_log import log
from neutron._i18n import _LE
from neutron.common import exceptions as exc
from neutron.db import api as db_api
from neutron.objects import base as base_obj
@ -43,7 +42,7 @@ class BaseTypeDriver(api.ML2TypeDriver):
cfg.CONF.ml2.physical_network_mtus, unique_values=False
)
except Exception as e:
LOG.error(_LE("Failed to parse physical_network_mtus: %s"), e)
LOG.error("Failed to parse physical_network_mtus: %s", e)
self.physnet_mtus = []
def get_mtu(self, physical_network=None):

View File

@ -22,7 +22,7 @@ from neutron_lib.plugins.ml2 import api
from oslo_config import cfg
from oslo_log import log as logging
from neutron._i18n import _, _LW
from neutron._i18n import _
from neutron.conf.plugins.ml2.drivers import l2pop as config
from neutron.db import api as db_api
from neutron.db import l3_hamode_db
@ -264,7 +264,7 @@ class L2populationMechanismDriver(api.MechanismDriver):
port_context = context._plugin_context
agent = l2pop_db.get_agent_by_host(session, agent_host)
if not agent:
LOG.warning(_LW("Unable to retrieve active L2 agent on host %s"),
LOG.warning("Unable to retrieve active L2 agent on host %s",
agent_host)
return
@ -319,7 +319,7 @@ class L2populationMechanismDriver(api.MechanismDriver):
agent = l2pop_db.get_agent_by_host(session,
agent_host)
if not agent:
LOG.warning(_LW("Unable to retrieve active L2 agent on host %s"),
LOG.warning("Unable to retrieve active L2 agent on host %s",
agent_host)
return
if not self._validate_segment(segment, port['id'], agent):

View File

@ -19,7 +19,6 @@ from oslo_concurrency import lockutils
from oslo_log import log as logging
import tenacity
from neutron._i18n import _LI
from neutron.agent.linux import ip_lib
LOG = logging.getLogger(__name__)
@ -31,8 +30,8 @@ def setup_arp_spoofing_protection(vif, port_details):
if not port_details.get('port_security_enabled', True):
# clear any previous entries related to this port
delete_arp_spoofing_protection([vif])
LOG.info(_LI("Skipping ARP spoofing rules for port '%s' because "
"it has port security disabled"), vif)
LOG.info("Skipping ARP spoofing rules for port '%s' because "
"it has port security disabled", vif)
return
if net.is_port_trusted(port_details):
# clear any previous entries related to this port
@ -100,7 +99,7 @@ def delete_unreferenced_arp_protection(current_vifs):
devname = line.split(SPOOF_CHAIN_PREFIX, 1)[1].split(',')[0]
if devname not in current_vifs:
to_delete.append(devname)
LOG.info(_LI("Clearing orphaned ARP spoofing entries for devices %s"),
LOG.info("Clearing orphaned ARP spoofing entries for devices %s",
to_delete)
_delete_arp_spoofing_protection(to_delete, current_rules)

View File

@ -16,7 +16,6 @@
from neutron_lib import constants as n_const
from oslo_log import log
from neutron._i18n import _LW
from neutron.plugins.ml2.drivers.linuxbridge.agent.common import constants
LOG = log.getLogger(__name__)
@ -25,8 +24,8 @@ LOG = log.getLogger(__name__)
def get_tap_device_name(interface_id):
"""Convert port ID into device name format expected by linux bridge."""
if not interface_id:
LOG.warning(_LW("Invalid Interface ID, will lead to incorrect "
"tap device name"))
LOG.warning("Invalid Interface ID, will lead to incorrect "
"tap device name")
tap_device_name = (n_const.TAP_DEVICE_PREFIX +
interface_id[:constants.RESOURCE_ID_LENGTH])
return tap_device_name

View File

@ -16,7 +16,6 @@ from oslo_config import cfg
from oslo_log import helpers as log_helpers
from oslo_log import log
from neutron._i18n import _LI
from neutron.agent.l2.extensions import qos_linux as qos
from neutron.agent.linux import iptables_manager
from neutron.agent.linux import tc_lib
@ -41,7 +40,7 @@ class QosLinuxbridgeAgentDriver(qos.QosLinuxAgentDriver):
const.EGRESS_DIRECTION: "o"}
def initialize(self):
LOG.info(_LI("Initializing Linux bridge QoS extension"))
LOG.info("Initializing Linux bridge QoS extension")
self.iptables_manager = iptables_manager.IptablesManager(use_ipv6=True)
self.tbf_latency = cfg.CONF.QOS.tbf_latency

View File

@ -31,7 +31,6 @@ from oslo_service import service
from oslo_utils import excutils
from six import moves
from neutron._i18n import _LE, _LI, _LW
from neutron.agent.linux import bridge_lib
from neutron.agent.linux import ip_lib
from neutron.api.rpc.handlers import securitygroups_rpc as sg_rpc
@ -85,16 +84,16 @@ class LinuxBridgeManager(amb.CommonAgentManagerBase):
def validate_interface_mappings(self):
for physnet, interface in self.interface_mappings.items():
if not ip_lib.device_exists(interface):
LOG.error(_LE("Interface %(intf)s for physical network %(net)s"
" does not exist. Agent terminated!"),
LOG.error("Interface %(intf)s for physical network %(net)s"
" does not exist. Agent terminated!",
{'intf': interface, 'net': physnet})
sys.exit(1)
def validate_bridge_mappings(self):
for physnet, bridge in self.bridge_mappings.items():
if not ip_lib.device_exists(bridge):
LOG.error(_LE("Bridge %(brq)s for physical network %(net)s"
" does not exist. Agent terminated!"),
LOG.error("Bridge %(brq)s for physical network %(net)s"
" does not exist. Agent terminated!",
{'brq': bridge, 'net': physnet})
sys.exit(1)
@ -133,10 +132,10 @@ class LinuxBridgeManager(amb.CommonAgentManagerBase):
if not ip_addr.version == group_net.version:
raise ValueError()
except (netaddr.core.AddrFormatError, ValueError):
LOG.error(_LE("Invalid VXLAN Group: %(group)s, must be an address "
"or network (in CIDR notation) in a multicast "
"range of the same address family as local_ip: "
"%(ip)s"),
LOG.error("Invalid VXLAN Group: %(group)s, must be an address "
"or network (in CIDR notation) in a multicast "
"range of the same address family as local_ip: "
"%(ip)s",
{'group': cfg.CONF.VXLAN.vxlan_group,
'ip': self.local_ip})
sys.exit(1)
@ -145,10 +144,10 @@ class LinuxBridgeManager(amb.CommonAgentManagerBase):
"""Return the device with local_ip on the host."""
device = self.ip.get_device_by_ip(self.local_ip)
if not device:
LOG.error(_LE("Tunneling cannot be enabled without the local_ip "
"bound to an interface on the host. Please "
"configure local_ip %s on the host interface to "
"be used for tunneling and restart the agent."),
LOG.error("Tunneling cannot be enabled without the local_ip "
"bound to an interface on the host. Please "
"configure local_ip %s on the host interface to "
"be used for tunneling and restart the agent.",
self.local_ip)
sys.exit(1)
return device
@ -161,16 +160,16 @@ class LinuxBridgeManager(amb.CommonAgentManagerBase):
@staticmethod
def get_bridge_name(network_id):
if not network_id:
LOG.warning(_LW("Invalid Network ID, will lead to incorrect "
"bridge name"))
LOG.warning("Invalid Network ID, will lead to incorrect "
"bridge name")
bridge_name = BRIDGE_NAME_PREFIX + \
network_id[:lconst.RESOURCE_ID_LENGTH]
return bridge_name
def get_subinterface_name(self, physical_interface, vlan_id):
if not vlan_id:
LOG.warning(_LW("Invalid VLAN ID, will lead to incorrect "
"subinterface name"))
LOG.warning("Invalid VLAN ID, will lead to incorrect "
"subinterface name")
vlan_postfix = '.%s' % vlan_id
# For the vlan subinterface name prefix we use:
@ -206,8 +205,8 @@ class LinuxBridgeManager(amb.CommonAgentManagerBase):
if 0 <= int(segmentation_id) <= p_const.MAX_VXLAN_VNI:
return VXLAN_INTERFACE_PREFIX + str(segmentation_id)
else:
LOG.warning(_LW("Invalid Segmentation ID: %s, will lead to "
"incorrect vxlan device name"), segmentation_id)
LOG.warning("Invalid Segmentation ID: %s, will lead to "
"incorrect vxlan device name", segmentation_id)
@staticmethod
def _match_multicast_range(segmentation_id):
@ -252,8 +251,8 @@ class LinuxBridgeManager(amb.CommonAgentManagerBase):
"""Create a vxlan and bridge unless they already exist."""
interface = self.ensure_vxlan(segmentation_id)
if not interface:
LOG.error(_LE("Failed creating vxlan interface for "
"%(segmentation_id)s"),
LOG.error("Failed creating vxlan interface for "
"%(segmentation_id)s",
{segmentation_id: segmentation_id})
return
bridge_name = self.get_bridge_name(network_id)
@ -304,9 +303,9 @@ class LinuxBridgeManager(amb.CommonAgentManagerBase):
with excutils.save_and_reraise_exception() as ctxt:
if ip_lib.vlan_in_use(vlan_id):
ctxt.reraise = False
LOG.error(_LE("Unable to create VLAN interface for "
"VLAN ID %s because it is in use by "
"another interface."), vlan_id)
LOG.error("Unable to create VLAN interface for "
"VLAN ID %s because it is in use by "
"another interface.", vlan_id)
return
int_vlan.disable_ipv6()
int_vlan.link.set_up()
@ -341,9 +340,9 @@ class LinuxBridgeManager(amb.CommonAgentManagerBase):
# to avoid excessive lookups and a possible race condition.
if ip_lib.vxlan_in_use(segmentation_id):
ctxt.reraise = False
LOG.error(_LE("Unable to create VXLAN interface for "
"VNI %s because it is in use by another "
"interface."), segmentation_id)
LOG.error("Unable to create VXLAN interface for "
"VNI %s because it is in use by another "
"interface.", segmentation_id)
return None
int_vxlan.disable_ipv6()
int_vxlan.link.set_up()
@ -445,8 +444,8 @@ class LinuxBridgeManager(amb.CommonAgentManagerBase):
bridge_device.addif(interface)
except Exception as e:
LOG.error(_LE("Unable to add %(interface)s to %(bridge_name)s"
"! Exception: %(e)s"),
LOG.error("Unable to add %(interface)s to %(bridge_name)s"
"! Exception: %(e)s",
{'interface': interface, 'bridge_name': bridge_name,
'e': e})
return
@ -458,7 +457,7 @@ class LinuxBridgeManager(amb.CommonAgentManagerBase):
segmentation_id):
if network_type == p_const.TYPE_VXLAN:
if self.vxlan_mode == lconst.VXLAN_NONE:
LOG.error(_LE("Unable to add vxlan interface for network %s"),
LOG.error("Unable to add vxlan interface for network %s",
network_id)
return
return self.ensure_vxlan_bridge(network_id, segmentation_id)
@ -467,8 +466,8 @@ class LinuxBridgeManager(amb.CommonAgentManagerBase):
physical_bridge = self.get_existing_bridge_name(physical_network)
physical_interface = self.interface_mappings.get(physical_network)
if not physical_bridge and not physical_interface:
LOG.error(_LE("No bridge or interface mappings"
" for physical network %s"),
LOG.error("No bridge or interface mappings"
" for physical network %s",
physical_network)
return
if network_type == p_const.TYPE_FLAT:
@ -479,9 +478,9 @@ class LinuxBridgeManager(amb.CommonAgentManagerBase):
physical_interface,
segmentation_id)
else:
LOG.error(_LE("Unknown network_type %(network_type)s for network "
"%(network_id)s."), {network_type: network_type,
network_id: network_id})
LOG.error("Unknown network_type %(network_type)s for network "
"%(network_id)s.", {network_type: network_type,
network_id: network_id})
def add_tap_interface(self, network_id, network_type, physical_network,
segmentation_id, tap_device_name, device_owner, mtu):
@ -664,8 +663,8 @@ class LinuxBridgeManager(amb.CommonAgentManagerBase):
return False
if not ip_lib.iproute_arg_supported(
['bridge', 'fdb'], 'append'):
LOG.warning(_LW('Option "%(option)s" must be supported by command '
'"%(command)s" to enable %(mode)s mode'),
LOG.warning('Option "%(option)s" must be supported by command '
'"%(command)s" to enable %(mode)s mode',
{'option': 'append',
'command': 'bridge fdb',
'mode': 'VXLAN UCAST'})
@ -679,7 +678,7 @@ class LinuxBridgeManager(amb.CommonAgentManagerBase):
test_iface = self.ensure_vxlan(seg_id)
break
else:
LOG.error(_LE('No valid Segmentation ID to perform UCAST test.'))
LOG.error('No valid Segmentation ID to perform UCAST test.')
return False
try:
@ -694,14 +693,14 @@ class LinuxBridgeManager(amb.CommonAgentManagerBase):
def vxlan_mcast_supported(self):
if not cfg.CONF.VXLAN.vxlan_group:
LOG.warning(_LW('VXLAN muticast group(s) must be provided in '
'vxlan_group option to enable VXLAN MCAST mode'))
LOG.warning('VXLAN muticast group(s) must be provided in '
'vxlan_group option to enable VXLAN MCAST mode')
return False
if not ip_lib.iproute_arg_supported(
['ip', 'link', 'add', 'type', 'vxlan'],
'proxy'):
LOG.warning(_LW('Option "%(option)s" must be supported by command '
'"%(command)s" to enable %(mode)s mode'),
LOG.warning('Option "%(option)s" must be supported by command '
'"%(command)s" to enable %(mode)s mode',
{'option': 'proxy',
'command': 'ip link add type vxlan',
'mode': 'VXLAN MCAST'})
@ -776,8 +775,8 @@ class LinuxBridgeManager(amb.CommonAgentManagerBase):
if mac:
break
else:
LOG.error(_LE("Unable to obtain MAC address for unique ID. "
"Agent terminated!"))
LOG.error("Unable to obtain MAC address for unique ID. "
"Agent terminated!")
sys.exit(1)
return 'lb%s' % mac.replace(":", "")
@ -844,8 +843,8 @@ class LinuxBridgeRpcCallbacks(
if network_id in self.network_map:
phynet = self.network_map[network_id].physical_network
if phynet and phynet in self.agent.mgr.bridge_mappings:
LOG.info(_LI("Physical network %s is defined in "
"bridge_mappings and cannot be deleted."),
LOG.info("Physical network %s is defined in "
"bridge_mappings and cannot be deleted.",
network_id)
return
@ -960,19 +959,19 @@ def main():
interface_mappings = helpers.parse_mappings(
cfg.CONF.LINUX_BRIDGE.physical_interface_mappings)
except ValueError as e:
LOG.error(_LE("Parsing physical_interface_mappings failed: %s. "
"Agent terminated!"), e)
LOG.error("Parsing physical_interface_mappings failed: %s. "
"Agent terminated!", e)
sys.exit(1)
LOG.info(_LI("Interface mappings: %s"), interface_mappings)
LOG.info("Interface mappings: %s", interface_mappings)
try:
bridge_mappings = helpers.parse_mappings(
cfg.CONF.LINUX_BRIDGE.bridge_mappings)
except ValueError as e:
LOG.error(_LE("Parsing bridge_mappings failed: %s. "
"Agent terminated!"), e)
LOG.error("Parsing bridge_mappings failed: %s. "
"Agent terminated!", e)
sys.exit(1)
LOG.info(_LI("Bridge mappings: %s"), bridge_mappings)
LOG.info("Bridge mappings: %s", bridge_mappings)
manager = LinuxBridgeManager(bridge_mappings, interface_mappings)
linuxbridge_capabilities.register()
@ -983,6 +982,6 @@ def main():
constants.AGENT_TYPE_LINUXBRIDGE,
LB_AGENT_BINARY)
setup_profiler.setup("neutron-linuxbridge-agent", cfg.CONF.host)
LOG.info(_LI("Agent initialized successfully, now running... "))
LOG.info("Agent initialized successfully, now running... ")
launcher = service.launch(cfg.CONF, agent)
launcher.wait()

Some files were not shown because too many files have changed in this diff Show More