"neutron/scheduler",
"neutron/server",
"neutron/services",
+ #"neutron/plugins",
+ "neutron/plugins/bigswitch",
+ #"neutron/plugins/brocade",
"neutron/plugins/cisco",
+ "neutron/plugins/common",
+ #"neutron/plugins/embrane",
+ #"neutron/plugins/hyperv",
+ #"neutron/plugins/ibm",
+ "neutron/plugins/linuxbridge",
+ #"neutron/plugins/metaplugin",
+ #"neutron/plugins/midonet",
"neutron/plugins/ml2",
+ "neutron/plugins/mlnx",
+ #"neutron/plugins/nec",
+ #"neutron/plugins/nuage",
+ #"neutron/plugins/ofagent",
+ #"neutron/plugins/oneconvergence",
+ #"neutron/plugins/opencontrail",
"neutron/plugins/openvswitch",
- "neutron/plugins/linuxbridge",
- "neutron/plugins/vmware",
- "neutron/plugins/mlnx"]
+ #"neutron/plugins/plumgrid",
+ #"neutron/plugins/sriovnicagent",
+ "neutron/plugins/vmware"]
return any([dir in filename for dir in dirs])
from neutron.common import topics
from neutron import context as q_context
from neutron.extensions import securitygroup as ext_sg
+from neutron.i18n import _LE
from neutron.openstack.common import log
from neutron.plugins.bigswitch import config as pl_config
return utils.execute(full_args, root_helper=self.root_helper)
except Exception as e:
with excutils.save_and_reraise_exception() as ctxt:
- LOG.error(_("Unable to execute %(cmd)s. "
- "Exception: %(exception)s"),
+ LOG.error(_LE("Unable to execute %(cmd)s. "
+ "Exception: %(exception)s"),
{'cmd': full_args, 'exception': e})
if not check_error:
ctxt.reraise = False
consumers)
def port_update(self, context, **kwargs):
- LOG.debug(_("Port update received"))
+ LOG.debug("Port update received")
port = kwargs.get('port')
vif_port = self.int_br.get_vif_port_by_id(port['id'])
if not vif_port:
- LOG.debug(_("Port %s is not present on this host."), port['id'])
+ LOG.debug("Port %s is not present on this host.", port['id'])
return
- LOG.debug(_("Port %s found. Refreshing firewall."), port['id'])
+ LOG.debug("Port %s found. Refreshing firewall.", port['id'])
if ext_sg.SECURITYGROUPS in port:
self.sg_agent.refresh_firewall()
try:
port_info = self._update_ports(ports)
if port_info:
- LOG.debug(_("Agent loop has new device"))
+ LOG.debug("Agent loop has new device")
self._process_devices_filter(port_info)
ports = port_info['current']
except Exception:
- LOG.exception(_("Error in agent event loop"))
+ LOG.exception(_LE("Error in agent event loop"))
elapsed = max(time.time() - start, 0)
if (elapsed < self.polling_interval):
time.sleep(self.polling_interval - elapsed)
else:
- LOG.debug(_("Loop iteration exceeded interval "
- "(%(polling_interval)s vs. %(elapsed)s)!"),
+ LOG.debug("Loop iteration exceeded interval "
+ "(%(polling_interval)s vs. %(elapsed)s)!",
{'polling_interval': self.polling_interval,
'elapsed': elapsed})
else:
conhash = ConsistencyHash(hash_id=self.hash_id, hash=hash)
self.session.merge(conhash)
- LOG.debug(_("Consistency hash for group %(hash_id)s updated "
- "to %(hash)s"), {'hash_id': self.hash_id, 'hash': hash})
+ LOG.debug("Consistency hash for group %(hash_id)s updated "
+ "to %(hash)s", {'hash_id': self.hash_id, 'hash': hash})
# under the License.
from neutron.api.v2 import attributes
+from neutron.i18n import _LW
from neutron.openstack.common import log as logging
LOG = logging.getLogger(__name__)
# relational table generation until one of the functions is called.
from neutron.db import portbindings_db
if not attributes.is_attr_set(host):
- LOG.warning(_("No host_id in port request to track port location."))
+ LOG.warning(_LW("No host_id in port request to track port location."))
return
if port_id == '':
- LOG.warning(_("Received an empty port ID for host_id '%s'"), host)
+ LOG.warning(_LW("Received an empty port ID for host_id '%s'"), host)
return
if host == '':
- LOG.debug(_("Received an empty host_id for port '%s'"), port_id)
+ LOG.debug("Received an empty host_id for port '%s'", port_id)
return
- LOG.debug(_("Logging port %(port)s on host_id %(host)s"),
+ LOG.debug("Logging port %(port)s on host_id %(host)s",
{'port': port_id, 'host': host})
with context.session.begin(subtransactions=True):
location = portbindings_db.PortBindingPort(port_id=port_id, host=host)
from neutron.common import utils
from neutron.db import l3_db
from neutron.extensions import l3
+from neutron.i18n import _LE
from neutron.openstack.common import log as logging
from neutron.plugins.bigswitch import extensions
from neutron.plugins.bigswitch import plugin as cplugin
except servermanager.RemoteRestError as e:
with excutils.save_and_reraise_exception():
LOG.error(
- _("NeutronRestProxyV2: Unable to create remote "
- "floating IP: %s"), e)
+ _LE("NeutronRestProxyV2: Unable to create remote "
+ "floating IP: %s"), e)
# return created floating IP
return new_fl_ip
except exceptions.TooManyExternalNetworks:
# get_external_network can raise errors when multiple external
# networks are detected, which isn't supported by the Plugin
- LOG.error(_("NeutronRestProxyV2: too many external networks"))
+ LOG.error(_LE("NeutronRestProxyV2: too many external networks"))
def _get_tenant_default_router_rules(self, tenant):
rules = cfg.CONF.ROUTER.tenant_default_router_rule
from neutron.extensions import extra_dhcp_opt as edo_ext
from neutron.extensions import portbindings
from neutron import manager
+from neutron.i18n import _LE, _LI, _LW
from neutron.openstack.common import log as logging
from neutron.plugins.bigswitch import config as pl_config
from neutron.plugins.bigswitch.db import porttracker_db
def get_port_and_sgs(self, port_id):
"""Get port from database with security group info."""
- LOG.debug(_("get_port_and_sgs() called for port_id %s"), port_id)
+ LOG.debug("get_port_and_sgs() called for port_id %s", port_id)
session = db.get_session()
sg_binding_port = sg_db.SecurityGroupPortBinding.port_id
def _warn_on_state_status(self, resource):
if resource.get('admin_state_up', True) is False:
- LOG.warning(_("Setting admin_state_up=False is not supported "
- "in this plugin version. Ignoring setting for "
- "resource: %s"), resource)
+ LOG.warning(_LW("Setting admin_state_up=False is not supported "
+ "in this plugin version. Ignoring setting for "
+ "resource: %s"), resource)
if 'status' in resource:
if resource['status'] != const.NET_STATUS_ACTIVE:
- LOG.warning(_("Operational status is internally set by the "
- "plugin. Ignoring setting status=%s."),
+ LOG.warning(_LW("Operational status is internally set by the "
+ "plugin. Ignoring setting status=%s."),
resource['status'])
def _get_router_intf_details(self, context, intf_id, subnet_id):
cfg_vif_type = cfg.CONF.NOVA.vif_type.lower()
if cfg_vif_type not in (portbindings.VIF_TYPE_OVS,
portbindings.VIF_TYPE_IVS):
- LOG.warning(_("Unrecognized vif_type in configuration "
- "[%s]. Defaulting to ovs."),
+ LOG.warning(_LW("Unrecognized vif_type in configuration "
+ "[%s]. Defaulting to ovs."),
cfg_vif_type)
cfg_vif_type = portbindings.VIF_TYPE_OVS
# In ML2, the host_id is already populated
if (cfg.CONF.RESTPROXY.auto_sync_on_failure and
e.status == httplib.NOT_FOUND and
servermanager.NXNETWORK in e.reason):
- LOG.error(_("Iconsistency with backend controller "
- "triggering full synchronization."))
+ LOG.error(_LE("Iconsistency with backend controller "
+ "triggering full synchronization."))
# args depend on if we are operating in ML2 driver
# or as the full plugin
topoargs = self.servers.get_topo_function_args
# Any errors that don't result in a successful auto-sync
# require that the port be placed into the error state.
LOG.error(
- _("NeutronRestProxyV2: Unable to create port: %s"), e)
+ _LE("NeutronRestProxyV2: Unable to create port: %s"), e)
try:
self._set_port_status(port['id'], const.PORT_STATUS_ERROR)
except exceptions.PortNotFound:
def __init__(self):
super(NeutronRestProxyV2, self).__init__()
- LOG.info(_('NeutronRestProxy: Starting plugin. Version=%s'),
+ LOG.info(_LI('NeutronRestProxy: Starting plugin. Version=%s'),
version.version_string_with_vcs())
pl_config.register_config()
self.evpool = eventlet.GreenPool(cfg.CONF.RESTPROXY.thread_pool_size)
if cfg.CONF.RESTPROXY.sync_data:
self._send_all_data()
- LOG.debug(_("NeutronRestProxyV2: initialization done"))
+ LOG.debug("NeutronRestProxyV2: initialization done")
def _setup_rpc(self):
self.conn = n_rpc.create_connection(new=True)
:raises: RemoteRestError
"""
- LOG.debug(_("NeutronRestProxyV2: create_network() called"))
+ LOG.debug("NeutronRestProxyV2: create_network() called")
self._warn_on_state_status(network['network'])
:raises: exceptions.NetworkNotFound
:raises: RemoteRestError
"""
- LOG.debug(_("NeutronRestProxyV2.update_network() called"))
+ LOG.debug("NeutronRestProxyV2.update_network() called")
self._warn_on_state_status(network['network'])
:raises: exceptions.NetworkNotFound
:raises: RemoteRestError
"""
- LOG.debug(_("NeutronRestProxyV2: delete_network() called"))
+ LOG.debug("NeutronRestProxyV2: delete_network() called")
# Validate args
orig_net = super(NeutronRestProxyV2, self).get_network(context, net_id)
:raises: exceptions.StateInvalid
:raises: RemoteRestError
"""
- LOG.debug(_("NeutronRestProxyV2: create_port() called"))
+ LOG.debug("NeutronRestProxyV2: create_port() called")
# Update DB in new session so exceptions rollback changes
with context.session.begin(subtransactions=True):
:raises: exceptions.PortNotFound
:raises: RemoteRestError
"""
- LOG.debug(_("NeutronRestProxyV2: update_port() called"))
+ LOG.debug("NeutronRestProxyV2: update_port() called")
self._warn_on_state_status(port['port'])
:raises: exceptions.NetworkNotFound
:raises: RemoteRestError
"""
- LOG.debug(_("NeutronRestProxyV2: delete_port() called"))
+ LOG.debug("NeutronRestProxyV2: delete_port() called")
# if needed, check to see if this is a port owned by
# and l3-router. If so, we should prevent deletion.
@put_context_in_serverpool
def create_subnet(self, context, subnet):
- LOG.debug(_("NeutronRestProxyV2: create_subnet() called"))
+ LOG.debug("NeutronRestProxyV2: create_subnet() called")
self._warn_on_state_status(subnet['subnet'])
@put_context_in_serverpool
def update_subnet(self, context, id, subnet):
- LOG.debug(_("NeutronRestProxyV2: update_subnet() called"))
+ LOG.debug("NeutronRestProxyV2: update_subnet() called")
self._warn_on_state_status(subnet['subnet'])
@put_context_in_serverpool
def delete_subnet(self, context, id):
- LOG.debug(_("NeutronRestProxyV2: delete_subnet() called"))
+ LOG.debug("NeutronRestProxyV2: delete_subnet() called")
orig_subnet = super(NeutronRestProxyV2, self).get_subnet(context, id)
net_id = orig_subnet['network_id']
with context.session.begin(subtransactions=True):
payload = {'subnet': updated_subnet}
self._dhcp_agent_notifier.notify(context, payload,
'subnet.update.end')
- LOG.debug(_("Adding host route: "))
- LOG.debug(_("Destination:%(dst)s nexthop:%(next)s"),
+ LOG.debug("Adding host route: ")
+ LOG.debug("Destination:%(dst)s nexthop:%(next)s",
{'dst': destination, 'next': nexthop})
router_db,
r['router_rules'])
else:
- LOG.debug(_('No rules in router'))
+ LOG.debug('No rules in router')
router_db['router_rules'] = self._get_router_rules_by_router_id(
context, router_db['id'])
del_context = context.session.query(RouterRule)
del_context.filter_by(router_id=router['id']).delete()
context.session.expunge_all()
- LOG.debug(_('Updating router rules to %s'), rules)
+ LOG.debug('Updating router rules to %s', rules)
for rule in rules:
router_rule = RouterRule(
router_id=router['id'],
from oslo.utils import excutils
from neutron.common import exceptions
+from neutron.i18n import _LE, _LI, _LW
from neutron.openstack.common import log as logging
from neutron.plugins.bigswitch.db import consistency_db as cdb
body = self.rest_call('GET', CAPABILITIES_PATH)[2]
self.capabilities = jsonutils.loads(body)
except Exception:
- LOG.exception(_("Couldn't retrieve capabilities. "
- "Newer API calls won't be supported."))
- LOG.info(_("The following capabilities were received "
- "for %(server)s: %(cap)s"), {'server': self.server,
- 'cap': self.capabilities})
+ LOG.exception(_LE("Couldn't retrieve capabilities. "
+ "Newer API calls won't be supported."))
+ LOG.info(_LI("The following capabilities were received "
+ "for %(server)s: %(cap)s"), {'server': self.server,
+ 'cap': self.capabilities})
return self.capabilities
def rest_call(self, action, resource, data='', headers=None,
if self.auth:
headers['Authorization'] = self.auth
- LOG.debug(_("ServerProxy: server=%(server)s, port=%(port)d, "
- "ssl=%(ssl)r"),
+ LOG.debug("ServerProxy: server=%(server)s, port=%(port)d, "
+ "ssl=%(ssl)r",
{'server': self.server, 'port': self.port, 'ssl': self.ssl})
- LOG.debug(_("ServerProxy: resource=%(resource)s, data=%(data)r, "
- "headers=%(headers)r, action=%(action)s"),
+ LOG.debug("ServerProxy: resource=%(resource)s, data=%(data)r, "
+ "headers=%(headers)r, action=%(action)s",
{'resource': resource, 'data': data, 'headers': headers,
'action': action})
self.currentconn = HTTPSConnectionWithValidation(
self.server, self.port, timeout=timeout)
if self.currentconn is None:
- LOG.error(_('ServerProxy: Could not establish HTTPS '
- 'connection'))
+ LOG.error(_LE('ServerProxy: Could not establish HTTPS '
+ 'connection'))
return 0, None, None, None
self.currentconn.combined_cert = self.combined_cert
else:
self.currentconn = httplib.HTTPConnection(
self.server, self.port, timeout=timeout)
if self.currentconn is None:
- LOG.error(_('ServerProxy: Could not establish HTTP '
- 'connection'))
+ LOG.error(_LE('ServerProxy: Could not establish HTTP '
+ 'connection'))
return 0, None, None, None
try:
timeout=timeout, reconnect=True)
except (socket.timeout, socket.error) as e:
self.currentconn.close()
- LOG.error(_('ServerProxy: %(action)s failure, %(e)r'),
+ LOG.error(_LE('ServerProxy: %(action)s failure, %(e)r'),
{'action': action, 'e': e})
ret = 0, None, None, None
- LOG.debug(_("ServerProxy: status=%(status)d, reason=%(reason)r, "
- "ret=%(ret)s, data=%(data)r"), {'status': ret[0],
- 'reason': ret[1],
- 'ret': ret[2],
- 'data': ret[3]})
+ LOG.debug("ServerProxy: status=%(status)d, reason=%(reason)r, "
+ "ret=%(ret)s, data=%(data)r", {'status': ret[0],
+ 'reason': ret[1],
+ 'ret': ret[2],
+ 'data': ret[3]})
return ret
def __init__(self, timeout=False,
base_uri=BASE_URI, name='NeutronRestProxy'):
- LOG.debug(_("ServerPool: initializing"))
+ LOG.debug("ServerPool: initializing")
# 'servers' is the list of network controller REST end-points
# (used in order specified till one succeeds, and it is sticky
# till next failure). Use 'server_auth' to encode api-key
eventlet.spawn(self._consistency_watchdog,
cfg.CONF.RESTPROXY.consistency_interval)
ServerPool._instance = self
- LOG.debug(_("ServerPool: initialization done"))
+ LOG.debug("ServerPool: initialization done")
def set_context(self, context):
# this context needs to be local to the greenthread
'Error details: %(error)s') %
{'server': server, 'error': str(e)})
- LOG.warning(_("Storing to certificate for host %(server)s "
- "at %(path)s") % {'server': server,
- 'path': path})
+ LOG.warning(_LW("Storing to certificate for host %(server)s "
+ "at %(path)s"), {'server': server,
+ 'path': path})
self._file_put_contents(path, cert)
return cert
active_server.failed = False
return ret
else:
- LOG.error(_('ServerProxy: %(action)s failure for servers: '
- '%(server)r Response: %(response)s'),
+ LOG.error(_LE('ServerProxy: %(action)s failure for servers: '
+ '%(server)r Response: %(response)s'),
{'action': action,
'server': (active_server.server,
active_server.port),
'response': ret[3]})
- LOG.error(_("ServerProxy: Error details: status=%(status)d, "
- "reason=%(reason)r, ret=%(ret)s, data=%(data)r"),
+ LOG.error(_LE("ServerProxy: Error details: status=%(status)d, "
+ "reason=%(reason)r, ret=%(ret)s, data=%(data)r"),
{'status': ret[0], 'reason': ret[1], 'ret': ret[2],
'data': ret[3]})
active_server.failed = True
if action == 'DELETE':
hash_handler.put_hash('INCONSISTENT,INCONSISTENT')
# All servers failed, reset server list and try again next time
- LOG.error(_('ServerProxy: %(action)s failure for all servers: '
- '%(server)r'),
+ LOG.error(_LE('ServerProxy: %(action)s failure for all servers: '
+ '%(server)r'),
{'action': action,
'server': tuple((s.server,
s.port) for s in self.servers)})
LOG.error(errstr, resp[2])
raise RemoteRestError(reason=resp[2], status=resp[0])
if resp[0] in ignore_codes:
- LOG.warning(_("NeutronRestProxyV2: Received and ignored error "
- "code %(code)s on %(action)s action to resource "
- "%(resource)s"),
+ LOG.warning(_LW("NeutronRestProxyV2: Received and ignored error "
+ "code %(code)s on %(action)s action to resource "
+ "%(resource)s"),
{'code': resp[2], 'action': action,
'resource': resource})
return resp
device_id = port.get("device_id")
if not port["mac_address"] or not device_id:
# controller only cares about ports attached to devices
- LOG.warning(_("No device MAC attached to port %s. "
- "Skipping notification to controller."), port["id"])
+ LOG.warning(_LW("No device MAC attached to port %s. "
+ "Skipping notification to controller."),
+ port["id"])
return
data["attachment"] = {"id": device_id,
"mac": port["mac_address"]}
def _consistency_watchdog(self, polling_interval=60):
if 'consistency' not in self.get_capabilities():
- LOG.warning(_("Backend server(s) do not support automated "
- "consitency checks."))
+ LOG.warning(_LW("Backend server(s) do not support automated "
+ "consitency checks."))
return
if not polling_interval:
- LOG.warning(_("Consistency watchdog disabled by polling interval "
- "setting of %s."), polling_interval)
+ LOG.warning(_LW("Consistency watchdog disabled by polling "
+ "interval setting of %s."), polling_interval)
return
while True:
# If consistency is supported, all we have to do is make any
try:
self.rest_action('GET', HEALTH_PATH)
except Exception:
- LOG.exception(_("Encountered an error checking controller "
- "health."))
+ LOG.exception(_LE("Encountered an error checking controller "
+ "health."))
class HTTPSConnectionWithValidation(httplib.HTTPSConnection):