Remove locals() from strings substitutions
Fixes bug 1168988 Change-Id: Ifd1e7a027f16062ff35e777cf2d953f652a806a7
This commit is contained in:
parent
d04b3deafa
commit
c117074a4b
@ -190,6 +190,8 @@ Example::
|
||||
msg = _("The server with id %(s_id)s has no key %(m_key)s")
|
||||
LOG.error(msg % {"s_id": "1234", "m_key": "imageId"})
|
||||
|
||||
Please do not use locals() for string substitutions.
|
||||
|
||||
|
||||
Creating Unit Tests
|
||||
-------------------
|
||||
|
@ -466,7 +466,8 @@ class L3NATAgent(manager.Manager):
|
||||
interface_name):
|
||||
rules = [('POSTROUTING', '! -i %(interface_name)s '
|
||||
'! -o %(interface_name)s -m conntrack ! '
|
||||
'--ctstate DNAT -j ACCEPT' % locals())]
|
||||
'--ctstate DNAT -j ACCEPT' %
|
||||
{'interface_name': interface_name})]
|
||||
for cidr in internal_cidrs:
|
||||
rules.extend(self.internal_network_nat_rules(ex_gw_ip, cidr))
|
||||
return rules
|
||||
|
@ -54,7 +54,10 @@ class OVSBridge:
|
||||
name = 'name\s*:\s"(?P<port_name>[^"]*)"'
|
||||
port = 'ofport\s*:\s(?P<ofport>-?\d+)'
|
||||
_re = ('%(external)s:\s{ ( %(mac)s,? | %(iface)s,? | . )* }'
|
||||
' \s+ %(name)s \s+ %(port)s' % locals())
|
||||
' \s+ %(name)s \s+ %(port)s' % {'external': external,
|
||||
'mac': mac,
|
||||
'iface': iface, 'name': name,
|
||||
'port': port})
|
||||
return re.compile(_re, re.M | re.X)
|
||||
|
||||
def run_vsctl(self, args):
|
||||
@ -285,9 +288,8 @@ def get_bridge_for_iface(root_helper, iface):
|
||||
args = ["ovs-vsctl", "--timeout=2", "iface-to-br", iface]
|
||||
try:
|
||||
return utils.execute(args, root_helper=root_helper).strip()
|
||||
except Exception, e:
|
||||
LOG.exception(_("Interface %(iface)s not found. Exception: %(e)s"),
|
||||
locals())
|
||||
except Exception:
|
||||
LOG.exception(_("Interface %s not found."), iface)
|
||||
return None
|
||||
|
||||
|
||||
|
@ -526,7 +526,7 @@ class ExtensionManager(object):
|
||||
self.add_extension(new_ext)
|
||||
except Exception as exception:
|
||||
LOG.warn(_("Extension file %(f)s wasn't loaded due to "
|
||||
"%(exception)s"), locals())
|
||||
"%(exception)s"), {'f': f, 'exception': exception})
|
||||
|
||||
def add_extension(self, ext):
|
||||
# Do nothing if the extension doesn't check out
|
||||
|
@ -41,7 +41,7 @@ def _verify_dict_keys(expected_keys, target_dict, strict=True):
|
||||
if not isinstance(target_dict, dict):
|
||||
msg = (_("Invalid input. '%(target_dict)s' must be a dictionary "
|
||||
"with keys: %(expected_keys)s") %
|
||||
dict(target_dict=target_dict, expected_keys=expected_keys))
|
||||
{'target_dict': target_dict, 'expected_keys': expected_keys})
|
||||
return msg
|
||||
|
||||
expected_keys = set(expected_keys)
|
||||
@ -52,7 +52,9 @@ def _verify_dict_keys(expected_keys, target_dict, strict=True):
|
||||
if not predicate(provided_keys):
|
||||
msg = (_("Validation of dictionary's keys failed."
|
||||
"Expected keys: %(expected_keys)s "
|
||||
"Provided keys: %(provided_keys)s") % locals())
|
||||
"Provided keys: %(provided_keys)s") %
|
||||
{'expected_keys': expected_keys,
|
||||
'provided_keys': provided_keys})
|
||||
return msg
|
||||
|
||||
|
||||
@ -63,7 +65,7 @@ def is_attr_set(attribute):
|
||||
def _validate_values(data, valid_values=None):
|
||||
if data not in valid_values:
|
||||
msg = (_("'%(data)s' is not in %(valid_values)s") %
|
||||
dict(data=data, valid_values=valid_values))
|
||||
{'data': data, 'valid_values': valid_values})
|
||||
LOG.debug(msg)
|
||||
return msg
|
||||
|
||||
@ -76,7 +78,7 @@ def _validate_string(data, max_len=None):
|
||||
|
||||
if max_len is not None and len(data) > max_len:
|
||||
msg = (_("'%(data)s' exceeds maximum length of %(max_len)s") %
|
||||
dict(data=data, max_len=max_len))
|
||||
{'data': data, 'max_len': max_len})
|
||||
LOG.debug(msg)
|
||||
return msg
|
||||
|
||||
@ -86,9 +88,9 @@ def _validate_range(data, valid_values=None):
|
||||
max_value = valid_values[1]
|
||||
if not min_value <= data <= max_value:
|
||||
msg = _("'%(data)s' is not in range %(min_value)s through "
|
||||
"%(max_value)s") % dict(data=data,
|
||||
min_value=min_value,
|
||||
max_value=max_value)
|
||||
"%(max_value)s") % {'data': data,
|
||||
'min_value': min_value,
|
||||
'max_value': max_value}
|
||||
LOG.debug(msg)
|
||||
return msg
|
||||
|
||||
|
@ -134,8 +134,10 @@ def load_paste_app(app_name):
|
||||
try:
|
||||
app = deploy.loadapp("config:%s" % config_path, name=app_name)
|
||||
except (LookupError, ImportError):
|
||||
msg = _("Unable to load %(app_name)s from "
|
||||
"configuration file %(config_path)s.") % locals()
|
||||
msg = (_("Unable to load %(app_name)s from "
|
||||
"configuration file %(config_path)s.") %
|
||||
{'app_name': app_name,
|
||||
'config_path': config_path})
|
||||
LOG.exception(msg)
|
||||
raise RuntimeError(msg)
|
||||
return app
|
||||
|
@ -141,10 +141,11 @@ def parse_mappings(mapping_list, unique_values=True):
|
||||
raise ValueError(_("Missing value in mapping: '%s'") % mapping)
|
||||
if key in mappings:
|
||||
raise ValueError(_("Key %(key)s in mapping: '%(mapping)s' not "
|
||||
"unique") % locals())
|
||||
"unique") % {'key': key, 'mapping': mapping})
|
||||
if unique_values and value in mappings.itervalues():
|
||||
raise ValueError(_("Value %(value)s in mapping: '%(mapping)s' "
|
||||
"not unique") % locals())
|
||||
"not unique") % {'value': value,
|
||||
'mapping': mapping})
|
||||
mappings[key] = value
|
||||
return mappings
|
||||
|
||||
|
@ -206,7 +206,8 @@ def retry_registration(remaining, reconnect_interval, base=BASE):
|
||||
remaining -= 1
|
||||
LOG.info(_("Unable to connect to database, %(remaining)s attempts "
|
||||
"left. Retrying in %(reconnect_interval)s seconds"),
|
||||
locals())
|
||||
{'remaining': remaining,
|
||||
'reconnect_interval': reconnect_interval})
|
||||
time.sleep(reconnect_interval)
|
||||
if register_models(base):
|
||||
break
|
||||
|
@ -259,7 +259,9 @@ class QuantumDbPluginV2(quantum_plugin_base_v2.QuantumPluginBaseV2):
|
||||
if QuantumDbPluginV2._check_unique_mac(context, network_id,
|
||||
mac_address):
|
||||
LOG.debug(_("Generated mac for network %(network_id)s "
|
||||
"is %(mac_address)s"), locals())
|
||||
"is %(mac_address)s"),
|
||||
{'network_id': network_id,
|
||||
'mac_address': mac_address})
|
||||
return mac_address
|
||||
else:
|
||||
LOG.debug(_("Generated mac %(mac_address)s exists. Remaining "
|
||||
@ -298,7 +300,10 @@ class QuantumDbPluginV2(quantum_plugin_base_v2.QuantumPluginBaseV2):
|
||||
else:
|
||||
LOG.debug(_("Hold allocated IP %(ip_address)s "
|
||||
"(%(network_id)s/%(subnet_id)s/%(port_id)s)"),
|
||||
locals())
|
||||
{'ip_address': ip_address,
|
||||
'network_id': network_id,
|
||||
'subnet_id': subnet_id,
|
||||
'port_id': port_id})
|
||||
allocated.port_id = None
|
||||
|
||||
@staticmethod
|
||||
@ -429,17 +434,21 @@ class QuantumDbPluginV2(quantum_plugin_base_v2.QuantumPluginBaseV2):
|
||||
except exc.NoResultFound:
|
||||
LOG.debug(_("No fixed IP found that matches the network "
|
||||
"%(network_id)s and ip address %(ip_address)s."),
|
||||
locals())
|
||||
{'network_id': network_id,
|
||||
'ip_address': ip_address})
|
||||
|
||||
@staticmethod
|
||||
def _delete_ip_allocation(context, network_id, subnet_id, ip_address):
|
||||
|
||||
# Delete the IP address from the IPAllocate table
|
||||
LOG.debug(_("Delete allocated IP %(ip_address)s "
|
||||
"(%(network_id)s/%(subnet_id)s)"), locals())
|
||||
"(%(network_id)s/%(subnet_id)s)"),
|
||||
{'ip_address': ip_address,
|
||||
'network_id': network_id,
|
||||
'subnet_id': subnet_id})
|
||||
alloc_qry = context.session.query(
|
||||
models_v2.IPAllocation).with_lockmode('update')
|
||||
allocated = alloc_qry.filter_by(network_id=network_id,
|
||||
alloc_qry.filter_by(network_id=network_id,
|
||||
ip_address=ip_address,
|
||||
subnet_id=subnet_id).delete()
|
||||
|
||||
@ -806,7 +815,8 @@ class QuantumDbPluginV2(quantum_plugin_base_v2.QuantumPluginBaseV2):
|
||||
l_range = ip_ranges[l_cursor]
|
||||
r_range = ip_ranges[r_cursor]
|
||||
LOG.error(_("Found overlapping ranges: %(l_range)s and "
|
||||
"%(r_range)s"), locals())
|
||||
"%(r_range)s"),
|
||||
{'l_range': l_range, 'r_range': r_range})
|
||||
raise q_exc.OverlappingAllocationPools(
|
||||
pool_1=l_range,
|
||||
pool_2=r_range,
|
||||
@ -934,7 +944,8 @@ class QuantumDbPluginV2(quantum_plugin_base_v2.QuantumPluginBaseV2):
|
||||
context.session.commit()
|
||||
except Exception as e:
|
||||
LOG.exception(_("An exception occured while creating "
|
||||
"the %(resource)s:%(item)s"), locals())
|
||||
"the %(resource)s:%(item)s"),
|
||||
{'resource': resource, 'item': item})
|
||||
context.session.rollback()
|
||||
raise e
|
||||
return objects
|
||||
@ -1029,8 +1040,11 @@ class QuantumDbPluginV2(quantum_plugin_base_v2.QuantumPluginBaseV2):
|
||||
"""Check IP field of a subnet match specified ip version."""
|
||||
ip = netaddr.IPNetwork(addr)
|
||||
if ip.version != ip_version:
|
||||
data = {'name': name,
|
||||
'addr': addr,
|
||||
'ip_version': ip_version}
|
||||
msg = _("%(name)s '%(addr)s' does not match "
|
||||
"the ip_version '%(ip_version)s'") % locals()
|
||||
"the ip_version '%(ip_version)s'") % data
|
||||
raise q_exc.InvalidInput(error_message=msg)
|
||||
|
||||
def _validate_subnet(self, s):
|
||||
@ -1313,7 +1327,10 @@ class QuantumDbPluginV2(quantum_plugin_base_v2.QuantumPluginBaseV2):
|
||||
subnet_id = ip['subnet_id']
|
||||
LOG.debug(_("Allocated IP %(ip_address)s "
|
||||
"(%(network_id)s/%(subnet_id)s/%(port_id)s)"),
|
||||
locals())
|
||||
{'ip_address': ip_address,
|
||||
'network_id': network_id,
|
||||
'subnet_id': subnet_id,
|
||||
'port_id': port_id})
|
||||
allocated = models_v2.IPAllocation(
|
||||
network_id=network_id,
|
||||
port_id=port_id,
|
||||
@ -1384,8 +1401,8 @@ class QuantumDbPluginV2(quantum_plugin_base_v2.QuantumPluginBaseV2):
|
||||
QuantumDbPluginV2._delete_ip_allocation(
|
||||
context, a['network_id'],
|
||||
a['subnet_id'], a['ip_address'])
|
||||
msg_dict = dict(address=a['ip_address'],
|
||||
subnet_id=a['subnet_id'])
|
||||
msg_dict = {'address': a['ip_address'],
|
||||
'subnet_id': a['subnet_id']}
|
||||
msg = _("%(address)s (%(subnet_id)s) is not "
|
||||
"recycled") % msg_dict
|
||||
LOG.debug(msg)
|
||||
|
@ -109,7 +109,10 @@ class DhcpRpcCallbackMixin(object):
|
||||
if retval is None:
|
||||
# No previous port exists, so create a new one.
|
||||
LOG.debug(_('DHCP port %(device_id)s on network %(network_id)s '
|
||||
'does not exist on %(host)s'), locals())
|
||||
'does not exist on %(host)s'),
|
||||
{'device_id': device_id,
|
||||
'network_id': network_id,
|
||||
'host': host})
|
||||
|
||||
network = plugin.get_network(context, network_id)
|
||||
|
||||
@ -139,7 +142,8 @@ class DhcpRpcCallbackMixin(object):
|
||||
device_id = kwargs.get('device_id')
|
||||
|
||||
LOG.debug(_('DHCP port deletion for %(network_id)s request from '
|
||||
'%(host)s'), locals())
|
||||
'%(host)s'),
|
||||
{'network_id': network_id, 'host': host})
|
||||
plugin = manager.QuantumManager.get_plugin()
|
||||
filters = dict(network_id=[network_id], device_id=[device_id])
|
||||
ports = plugin.get_ports(context, filters=filters)
|
||||
@ -155,7 +159,8 @@ class DhcpRpcCallbackMixin(object):
|
||||
subnet_id = kwargs.get('subnet_id')
|
||||
|
||||
LOG.debug(_('DHCP port remove fixed_ip for %(subnet_id)s request '
|
||||
'from %(host)s'), locals())
|
||||
'from %(host)s'),
|
||||
{'subnet_id': subnet_id, 'host': host})
|
||||
plugin = manager.QuantumManager.get_plugin()
|
||||
filters = dict(network_id=[network_id], device_id=[device_id])
|
||||
ports = plugin.get_ports(context, filters=filters)
|
||||
@ -178,7 +183,10 @@ class DhcpRpcCallbackMixin(object):
|
||||
lease_remaining = kwargs.get('lease_remaining')
|
||||
|
||||
LOG.debug(_('Updating lease expiration for %(ip_address)s on network '
|
||||
'%(network_id)s from %(host)s.'), locals())
|
||||
'%(network_id)s from %(host)s.'),
|
||||
{'ip_address': ip_address,
|
||||
'network_id': network_id,
|
||||
'host': host})
|
||||
plugin = manager.QuantumManager.get_plugin()
|
||||
|
||||
plugin.update_fixed_ip_lease_expiration(context, network_id,
|
||||
|
@ -303,9 +303,13 @@ class L3_NAT_db_mixin(l3.RouterPluginBase):
|
||||
match1 = netaddr.all_matching_cidrs(new_ipnet, [cidr])
|
||||
match2 = netaddr.all_matching_cidrs(ipnet, [subnet_cidr])
|
||||
if match1 or match2:
|
||||
data = {'subnet_cidr': subnet_cidr,
|
||||
'subnet_id': subnet_id,
|
||||
'cidr': cidr,
|
||||
'sub_id': sub_id}
|
||||
msg = (_("Cidr %(subnet_cidr)s of subnet "
|
||||
"%(subnet_id)s overlaps with cidr %(cidr)s "
|
||||
"of subnet %(sub_id)s") % locals())
|
||||
"of subnet %(sub_id)s") % data)
|
||||
raise q_exc.BadRequest(resource='router', msg=msg)
|
||||
except exc.NoResultFound:
|
||||
pass
|
||||
@ -516,14 +520,16 @@ class L3_NAT_db_mixin(l3.RouterPluginBase):
|
||||
port_id = fip['port_id']
|
||||
if 'id' in fip:
|
||||
floatingip_id = fip['id']
|
||||
msg = _('Port %(port_id)s is associated with a different '
|
||||
data = {'port_id': port_id,
|
||||
'floatingip_id': floatingip_id}
|
||||
msg = (_('Port %(port_id)s is associated with a different '
|
||||
'tenant than Floating IP %(floatingip_id)s and '
|
||||
'therefore cannot be bound.')
|
||||
'therefore cannot be bound.') % data)
|
||||
else:
|
||||
msg = _('Cannnot create floating IP and bind it to '
|
||||
'Port %(port_id)s, since that port is owned by a '
|
||||
'different tenant.')
|
||||
raise q_exc.BadRequest(resource='floatingip', msg=msg % locals())
|
||||
msg = (_('Cannnot create floating IP and bind it to '
|
||||
'Port %s, since that port is owned by a '
|
||||
'different tenant.') % port_id)
|
||||
raise q_exc.BadRequest(resource='floatingip', msg=msg)
|
||||
|
||||
internal_subnet_id = None
|
||||
if 'fixed_ip_address' in fip and fip['fixed_ip_address']:
|
||||
@ -558,7 +564,7 @@ class L3_NAT_db_mixin(l3.RouterPluginBase):
|
||||
# ip enabled gateway with support for this floating IP network
|
||||
try:
|
||||
port_qry = context.elevated().session.query(models_v2.Port)
|
||||
ports = port_qry.filter_by(
|
||||
port_qry.filter_by(
|
||||
network_id=floating_network_id,
|
||||
device_id=router_id,
|
||||
device_owner=DEVICE_OWNER_ROUTER_GW).one()
|
||||
|
@ -100,19 +100,22 @@ def _validate_service_defs(data, valid_values=None):
|
||||
except KeyError:
|
||||
msg = (_("Required attributes missing in service "
|
||||
"definition: %s") % svc_def)
|
||||
LOG.error(_("%(f_name)s: %(msg)s"), locals())
|
||||
LOG.error(_("%(f_name)s: %(msg)s"),
|
||||
{'f_name': f_name, 'msg': msg})
|
||||
return msg
|
||||
# Validate 'service' attribute
|
||||
if svc_name not in constants.ALLOWED_SERVICES:
|
||||
msg = (_("Service name '%s' unspecified "
|
||||
"or invalid") % svc_name)
|
||||
LOG.error(_("%(f_name)s: %(msg)s"), locals())
|
||||
LOG.error(_("%(f_name)s: %(msg)s"),
|
||||
{'f_name': f_name, 'msg': msg})
|
||||
return msg
|
||||
# Validate 'plugin' attribute
|
||||
if not plugin_name:
|
||||
msg = (_("Plugin name not specified in "
|
||||
"service definition %s") % svc_def)
|
||||
LOG.error(_("%(f_name)s: %(msg)s"), locals())
|
||||
LOG.error(_("%(f_name)s: %(msg)s"),
|
||||
{'f_name': f_name, 'msg': msg})
|
||||
return msg
|
||||
# TODO(salvatore-orlando): This code will need to change when
|
||||
# multiple plugins for each adv service will be supported
|
||||
@ -120,11 +123,13 @@ def _validate_service_defs(data, valid_values=None):
|
||||
svc_name)
|
||||
if not svc_plugin:
|
||||
msg = _("No plugin for service '%s'") % svc_name
|
||||
LOG.error(_("%(f_name)s: %(msg)s"), locals())
|
||||
LOG.error(_("%(f_name)s: %(msg)s"),
|
||||
{'f_name': f_name, 'msg': msg})
|
||||
return msg
|
||||
if svc_plugin.get_plugin_name() != plugin_name:
|
||||
msg = _("Plugin name '%s' is not correct ") % plugin_name
|
||||
LOG.error(_("%(f_name)s: %(msg)s"), locals())
|
||||
LOG.error(_("%(f_name)s: %(msg)s"),
|
||||
{'f_name': f_name, 'msg': msg})
|
||||
return msg
|
||||
# Validate 'driver' attribute (just check it's a string)
|
||||
# FIXME(salvatore-orlando): This should be a list
|
||||
@ -140,14 +145,16 @@ def _validate_service_defs(data, valid_values=None):
|
||||
if svc_def_copy:
|
||||
msg = (_("Unparseable attributes found in "
|
||||
"service definition %s") % svc_def)
|
||||
LOG.error(_("%(f_name)s: %(msg)s"), locals())
|
||||
LOG.error(_("%(f_name)s: %(msg)s"),
|
||||
{'f_name': f_name, 'msg': msg})
|
||||
return msg
|
||||
except TypeError:
|
||||
LOG.exception(_("Exception while parsing service "
|
||||
"definition:%s"), svc_def)
|
||||
msg = (_("Was expecting a dict for service definition, found "
|
||||
"the following: %s") % svc_def)
|
||||
LOG.error(_("%(f_name)s: %(msg)s"), locals())
|
||||
LOG.error(_("%(f_name)s: %(msg)s"),
|
||||
{'f_name': f_name, 'msg': msg})
|
||||
return msg
|
||||
except TypeError:
|
||||
return (_("%s: provided data are not iterable") %
|
||||
|
@ -163,7 +163,8 @@ class ServerProxy(object):
|
||||
{'server': self.server, 'port': self.port, 'ssl': self.ssl,
|
||||
'action': action})
|
||||
LOG.debug(_("ServerProxy: resource=%(resource)s, data=%(data)r, "
|
||||
"headers=%(headers)r"), locals())
|
||||
"headers=%(headers)r"),
|
||||
{'resource': resource, 'data': data, 'headers': headers})
|
||||
|
||||
conn = None
|
||||
if self.ssl:
|
||||
@ -194,7 +195,8 @@ class ServerProxy(object):
|
||||
pass
|
||||
ret = (response.status, response.reason, respstr, respdata)
|
||||
except (socket.timeout, socket.error) as e:
|
||||
LOG.error(_('ServerProxy: %(action)s failure, %(e)r'), locals())
|
||||
LOG.error(_('ServerProxy: %(action)s failure, %(e)r'),
|
||||
{'action': action, 'e': e})
|
||||
ret = 0, None, None, None
|
||||
conn.close()
|
||||
LOG.debug(_("ServerProxy: status=%(status)d, reason=%(reason)r, "
|
||||
|
@ -125,7 +125,7 @@ class BridgeRpcCallbacks(dhcp_rpc_base.DhcpRpcCallbackMixin,
|
||||
agent_id = kwargs.get('agent_id')
|
||||
device = kwargs.get('device')
|
||||
LOG.debug(_("Device %(device)s details requested from %(agent_id)s"),
|
||||
locals())
|
||||
{'device': device, 'agent_id': agent_id})
|
||||
port = brocade_db.get_port(rpc_context, device[self.TAP_PREFIX_LEN:])
|
||||
if port:
|
||||
entry = {'device': device,
|
||||
|
@ -125,7 +125,9 @@ class VirtualPhysicalSwitchModelV2(quantum_plugin_base_v2.QuantumPluginBaseV2):
|
||||
if plugin_key not in self._plugins:
|
||||
LOG.info(_("No %s Plugin loaded"), plugin_key)
|
||||
LOG.info(_("%(plugin_key)s: %(function_name)s with args %(args)s "
|
||||
"ignored"), locals())
|
||||
"ignored"),
|
||||
{'plugin_key': plugin_key, 'function_name': function_name,
|
||||
'args': args})
|
||||
return
|
||||
|
||||
device_params = {const.DEVICE_IP: []}
|
||||
|
@ -126,8 +126,9 @@ class ExtensionsTestApp(wsgi.Router):
|
||||
def _delete_port(self, network_id, port_id):
|
||||
"""Delete port."""
|
||||
LOG.debug("Deleting port for network %s - START", network_id)
|
||||
data = {'network_id': network_id, 'port_id': port_id}
|
||||
port_path = ("/tenants/tt/networks/%(network_id)s/ports/%(port_id)s" %
|
||||
locals())
|
||||
data)
|
||||
port_req = self.create_request(port_path, None,
|
||||
self.contenttype, 'DELETE')
|
||||
port_req.get_response(self.api)
|
||||
|
@ -123,25 +123,31 @@ class HyperVUtils(object):
|
||||
err_sum_desc = job.ErrorSummaryDescription
|
||||
err_desc = job.ErrorDescription
|
||||
err_code = job.ErrorCode
|
||||
data = {'job_state': job_state,
|
||||
'err_sum_desc': err_sum_desc,
|
||||
'err_desc': err_desc,
|
||||
'err_code': err_code}
|
||||
raise HyperVException(
|
||||
msg=_("WMI job failed with status %(job_state)d. "
|
||||
"Error details: %(err_sum_desc)s - %(err_desc)s - "
|
||||
"Error code: %(err_code)d") % locals())
|
||||
"Error code: %(err_code)d") % data)
|
||||
else:
|
||||
(error, ret_val) = job.GetError()
|
||||
if not ret_val and error:
|
||||
data = {'job_state': job_state,
|
||||
'error': error}
|
||||
raise HyperVException(
|
||||
msg=_("WMI job failed with status %(job_state)d. "
|
||||
"Error details: %(error)s") % locals())
|
||||
"Error details: %(error)s") % data)
|
||||
else:
|
||||
raise HyperVException(
|
||||
msg=_("WMI job failed with status %(job_state)d. "
|
||||
"No error description available") % locals())
|
||||
msg=_("WMI job failed with status %d. "
|
||||
"No error description available") % job_state)
|
||||
|
||||
desc = job.Description
|
||||
elap = job.ElapsedTime
|
||||
LOG.debug(_("WMI job succeeded: %(desc)s, Elapsed=%(elap)s") %
|
||||
locals())
|
||||
{'desc': desc, 'elap': elap})
|
||||
|
||||
def _create_switch_port(self, vswitch_name, switch_port_name):
|
||||
"""Creates a switch port."""
|
||||
@ -170,18 +176,24 @@ class HyperVUtils(object):
|
||||
(ret_val, ) = switch_svc.DisconnectSwitchPort(
|
||||
SwitchPort=switch_port_path)
|
||||
if ret_val != 0:
|
||||
data = {'switch_port_name': switch_port_name,
|
||||
'vswitch_name': vswitch_name,
|
||||
'ret_val': ret_val}
|
||||
raise HyperVException(
|
||||
msg=_('Failed to disconnect port %(switch_port_name)s '
|
||||
'from switch %(vswitch_name)s '
|
||||
'with error %(ret_val)s') % locals())
|
||||
'with error %(ret_val)s') % data)
|
||||
if delete_port:
|
||||
(ret_val, ) = switch_svc.DeleteSwitchPort(
|
||||
SwitchPort=switch_port_path)
|
||||
if ret_val != 0:
|
||||
data = {'switch_port_name': switch_port_name,
|
||||
'vswitch_name': vswitch_name,
|
||||
'ret_val': ret_val}
|
||||
raise HyperVException(
|
||||
msg=_('Failed to delete port %(switch_port_name)s '
|
||||
'from switch %(vswitch_name)s '
|
||||
'with error %(ret_val)s') % locals())
|
||||
'with error %(ret_val)s') % data)
|
||||
|
||||
def _get_vswitch(self, vswitch_name):
|
||||
vswitch = self._conn.Msvm_VirtualSwitch(ElementName=vswitch_name)
|
||||
|
@ -78,7 +78,8 @@ class HyperVPluginDB(object):
|
||||
physical_network=physical_network)
|
||||
LOG.debug(_("Reserving specific vlan %(vlan_id)s on physical "
|
||||
"network %(physical_network)s from pool"),
|
||||
locals())
|
||||
{'vlan_id': vlan_id,
|
||||
'physical_network': physical_network})
|
||||
alloc.allocated = True
|
||||
except exc.NoResultFound:
|
||||
raise q_exc.NoNetworkAvailable()
|
||||
@ -134,11 +135,13 @@ class HyperVPluginDB(object):
|
||||
#session.delete(alloc)
|
||||
LOG.debug(_("Releasing vlan %(vlan_id)s on physical network "
|
||||
"%(physical_network)s"),
|
||||
locals())
|
||||
{'vlan_id': vlan_id,
|
||||
'physical_network': physical_network})
|
||||
except exc.NoResultFound:
|
||||
LOG.warning(_("vlan_id %(vlan_id)s on physical network "
|
||||
"%(physical_network)s not found"),
|
||||
locals())
|
||||
{'vlan_id': vlan_id,
|
||||
'physical_network': physical_network})
|
||||
|
||||
def _add_missing_allocatable_vlans(self, session, vlan_ids,
|
||||
physical_network):
|
||||
|
@ -174,8 +174,8 @@ class HyperVQuantumPlugin(db_base_plugin_v2.QuantumDbPluginV2,
|
||||
constants.TYPE_VLAN,
|
||||
constants.TYPE_NONE]:
|
||||
msg = _(
|
||||
"Invalid tenant_network_type: %(tenant_network_type)s. "
|
||||
"Agent terminated!") % locals()
|
||||
"Invalid tenant_network_type: %s. "
|
||||
"Agent terminated!") % tenant_network_type
|
||||
raise q_exc.InvalidInput(error_message=msg)
|
||||
self._tenant_network_type = tenant_network_type
|
||||
|
||||
|
@ -51,7 +51,7 @@ class HyperVRpcCallbacks(
|
||||
agent_id = kwargs.get('agent_id')
|
||||
device = kwargs.get('device')
|
||||
LOG.debug(_("Device %(device)s details requested from %(agent_id)s"),
|
||||
locals())
|
||||
{'device': device, 'agent_id': agent_id})
|
||||
port = self._db.get_port(device)
|
||||
if port:
|
||||
binding = self._db.get_network_binding(None, port['network_id'])
|
||||
@ -75,7 +75,7 @@ class HyperVRpcCallbacks(
|
||||
agent_id = kwargs.get('agent_id')
|
||||
device = kwargs.get('device')
|
||||
LOG.debug(_("Device %(device)s no longer exists on %(agent_id)s"),
|
||||
locals())
|
||||
{'device': device, 'agent_id': agent_id})
|
||||
port = self._db.get_port(device)
|
||||
if port:
|
||||
entry = {'device': device,
|
||||
|
@ -169,7 +169,8 @@ class LinuxBridgeManager:
|
||||
LOG.debug(_("Creating subinterface %(interface)s for "
|
||||
"VLAN %(vlan_id)s on interface "
|
||||
"%(physical_interface)s"),
|
||||
locals())
|
||||
{'interface': interface, 'vlan_id': vlan_id,
|
||||
'physical_interface': physical_interface})
|
||||
if utils.execute(['ip', 'link', 'add', 'link',
|
||||
physical_interface,
|
||||
'name', interface, 'type', 'vlan', 'id',
|
||||
@ -216,7 +217,8 @@ class LinuxBridgeManager:
|
||||
"""
|
||||
if not self.device_exists(bridge_name):
|
||||
LOG.debug(_("Starting bridge %(bridge_name)s for subinterface "
|
||||
"%(interface)s"), locals())
|
||||
"%(interface)s"),
|
||||
{'bridge_name': bridge_name, 'interface': interface})
|
||||
if utils.execute(['brctl', 'addbr', bridge_name],
|
||||
root_helper=self.root_helper):
|
||||
return
|
||||
@ -231,7 +233,7 @@ class LinuxBridgeManager:
|
||||
return
|
||||
LOG.debug(_("Done starting bridge %(bridge_name)s for "
|
||||
"subinterface %(interface)s"),
|
||||
locals())
|
||||
{'bridge_name': bridge_name, 'interface': interface})
|
||||
|
||||
if not interface:
|
||||
return
|
||||
@ -246,7 +248,9 @@ class LinuxBridgeManager:
|
||||
root_helper=self.root_helper)
|
||||
except Exception as e:
|
||||
LOG.error(_("Unable to add %(interface)s to %(bridge_name)s! "
|
||||
"Exception: %(e)s"), locals())
|
||||
"Exception: %(e)s"),
|
||||
{'interface': interface, 'bridge_name': bridge_name,
|
||||
'e': e})
|
||||
return
|
||||
|
||||
def ensure_physical_in_bridge(self, network_id,
|
||||
@ -289,15 +293,19 @@ class LinuxBridgeManager:
|
||||
# Check if device needs to be added to bridge
|
||||
tap_device_in_bridge = self.get_bridge_for_tap_device(tap_device_name)
|
||||
if not tap_device_in_bridge:
|
||||
data = {'tap_device_name': tap_device_name,
|
||||
'bridge_name': bridge_name}
|
||||
msg = _("Adding device %(tap_device_name)s to bridge "
|
||||
"%(bridge_name)s") % locals()
|
||||
"%(bridge_name)s") % data
|
||||
LOG.debug(msg)
|
||||
if utils.execute(['brctl', 'addif', bridge_name, tap_device_name],
|
||||
root_helper=self.root_helper):
|
||||
return False
|
||||
else:
|
||||
data = {'tap_device_name': tap_device_name,
|
||||
'bridge_name': bridge_name}
|
||||
msg = _("%(tap_device_name)s already exists on bridge "
|
||||
"%(bridge_name)s") % locals()
|
||||
"%(bridge_name)s") % data
|
||||
LOG.debug(msg)
|
||||
return True
|
||||
|
||||
@ -343,16 +351,22 @@ class LinuxBridgeManager:
|
||||
if not self.is_device_on_bridge(interface_name):
|
||||
return True
|
||||
LOG.debug(_("Removing device %(interface_name)s from bridge "
|
||||
"%(bridge_name)s"), locals())
|
||||
"%(bridge_name)s"),
|
||||
{'interface_name': interface_name,
|
||||
'bridge_name': bridge_name})
|
||||
if utils.execute(['brctl', 'delif', bridge_name, interface_name],
|
||||
root_helper=self.root_helper):
|
||||
return False
|
||||
LOG.debug(_("Done removing device %(interface_name)s from bridge "
|
||||
"%(bridge_name)s"), locals())
|
||||
"%(bridge_name)s"),
|
||||
{'interface_name': interface_name,
|
||||
'bridge_name': bridge_name})
|
||||
return True
|
||||
else:
|
||||
LOG.debug(_("Cannot remove device %(interface_name)s bridge "
|
||||
"%(bridge_name)s does not exist"), locals())
|
||||
"%(bridge_name)s does not exist"),
|
||||
{'interface_name': interface_name,
|
||||
'bridge_name': bridge_name})
|
||||
return False
|
||||
|
||||
def delete_vlan(self, interface):
|
||||
@ -550,12 +564,13 @@ class LinuxBridgeQuantumAgentRPC(sg_rpc.SecurityGroupAgentRpcMixin):
|
||||
self.agent_id)
|
||||
except Exception as e:
|
||||
LOG.debug(_("Unable to get port details for "
|
||||
"%(device)s: %(e)s"), locals())
|
||||
"%(device)s: %(e)s"),
|
||||
{'device': device, 'e': e})
|
||||
resync = True
|
||||
continue
|
||||
if 'port_id' in details:
|
||||
LOG.info(_("Port %(device)s updated. Details: %(details)s"),
|
||||
locals())
|
||||
{'device': device, 'details': details})
|
||||
if details['admin_state_up']:
|
||||
# create the networking for the port
|
||||
self.br_mgr.add_interface(details['network_id'],
|
||||
@ -580,7 +595,7 @@ class LinuxBridgeQuantumAgentRPC(sg_rpc.SecurityGroupAgentRpcMixin):
|
||||
self.agent_id)
|
||||
except Exception as e:
|
||||
LOG.debug(_("port_removed failed for %(device)s: %(e)s"),
|
||||
locals())
|
||||
{'device': device, 'e': e})
|
||||
resync = True
|
||||
if details['exists']:
|
||||
LOG.info(_("Port %s updated."), device)
|
||||
|
@ -138,11 +138,15 @@ def reserve_specific_network(session, physical_network, vlan_id):
|
||||
raise q_exc.VlanIdInUse(vlan_id=vlan_id,
|
||||
physical_network=physical_network)
|
||||
LOG.debug(_("Reserving specific vlan %(vlan_id)s on physical "
|
||||
"network %(physical_network)s from pool"), locals())
|
||||
"network %(physical_network)s from pool"),
|
||||
{'vlan_id': vlan_id,
|
||||
'physical_network': physical_network})
|
||||
state.allocated = True
|
||||
except exc.NoResultFound:
|
||||
LOG.debug(_("Reserving specific vlan %(vlan_id)s on physical "
|
||||
"network %(physical_network)s outside pool"), locals())
|
||||
"network %(physical_network)s outside pool"),
|
||||
{'vlan_id': vlan_id,
|
||||
'physical_network': physical_network})
|
||||
state = l2network_models_v2.NetworkState(physical_network, vlan_id)
|
||||
state.allocated = True
|
||||
session.add(state)
|
||||
@ -165,14 +169,19 @@ def release_network(session, physical_network, vlan_id, network_vlan_ranges):
|
||||
if inside:
|
||||
LOG.debug(_("Releasing vlan %(vlan_id)s on physical network "
|
||||
"%(physical_network)s to pool"),
|
||||
locals())
|
||||
{'vlan_id': vlan_id,
|
||||
'physical_network': physical_network})
|
||||
else:
|
||||
LOG.debug(_("Releasing vlan %(vlan_id)s on physical network "
|
||||
"%(physical_network)s outside pool"), locals())
|
||||
"%(physical_network)s outside pool"),
|
||||
{'vlan_id': vlan_id,
|
||||
'physical_network': physical_network})
|
||||
session.delete(state)
|
||||
except exc.NoResultFound:
|
||||
LOG.warning(_("vlan_id %(vlan_id)s on physical network "
|
||||
"%(physical_network)s not found"), locals())
|
||||
"%(physical_network)s not found"),
|
||||
{'vlan_id': vlan_id,
|
||||
'physical_network': physical_network})
|
||||
|
||||
|
||||
def add_network_binding(session, network_id, physical_network, vlan_id):
|
||||
|
@ -80,7 +80,7 @@ class LinuxBridgeRpcCallbacks(dhcp_rpc_base.DhcpRpcCallbackMixin,
|
||||
agent_id = kwargs.get('agent_id')
|
||||
device = kwargs.get('device')
|
||||
LOG.debug(_("Device %(device)s details requested from %(agent_id)s"),
|
||||
locals())
|
||||
{'device': device, 'agent_id': agent_id})
|
||||
port = self.get_port_from_device(device)
|
||||
if port:
|
||||
binding = db.get_network_binding(db_api.get_session(),
|
||||
@ -106,7 +106,7 @@ class LinuxBridgeRpcCallbacks(dhcp_rpc_base.DhcpRpcCallbackMixin,
|
||||
agent_id = kwargs.get('agent_id')
|
||||
device = kwargs.get('device')
|
||||
LOG.debug(_("Device %(device)s no longer exists on %(agent_id)s"),
|
||||
locals())
|
||||
{'device': device, 'agent_id': agent_id})
|
||||
port = self.get_port_from_device(device)
|
||||
if port:
|
||||
entry = {'device': device,
|
||||
@ -125,7 +125,7 @@ class LinuxBridgeRpcCallbacks(dhcp_rpc_base.DhcpRpcCallbackMixin,
|
||||
agent_id = kwargs.get('agent_id')
|
||||
device = kwargs.get('device')
|
||||
LOG.debug(_("Device %(device)s up %(agent_id)s"),
|
||||
locals())
|
||||
{'device': device, 'agent_id': agent_id})
|
||||
port = self.get_port_from_device(device)
|
||||
if port:
|
||||
if port['status'] != q_const.PORT_STATUS_ACTIVE:
|
||||
@ -262,7 +262,7 @@ class LinuxBridgePluginV2(db_base_plugin_v2.QuantumDbPluginV2,
|
||||
LOG.error(_("Invalid network VLAN range: "
|
||||
"'%(entry)s' - %(ex)s. "
|
||||
"Service terminated!"),
|
||||
locals())
|
||||
{'entry': entry, 'ex': ex})
|
||||
sys.exit(1)
|
||||
else:
|
||||
self._add_network(entry)
|
||||
|
@ -121,7 +121,8 @@ class NVPApiHelper(client_eventlet.NvpApiClientEventlet):
|
||||
|
||||
if response is None:
|
||||
# Timeout.
|
||||
LOG.error(_('Request timed out: %(method)s to %(url)s'), locals())
|
||||
LOG.error(_('Request timed out: %(method)s to %(url)s'),
|
||||
{'method': method, 'url': url})
|
||||
raise RequestTimeout()
|
||||
|
||||
status = response.status
|
||||
|
@ -769,7 +769,8 @@ class NvpPluginV2(db_base_plugin_v2.QuantumDbPluginV2,
|
||||
LOG.debug(_("Looking for nova zone: %s"), novazone_id)
|
||||
for x in self.clusters:
|
||||
LOG.debug(_("Looking for nova zone %(novazone_id)s in "
|
||||
"cluster: %(x)s"), locals())
|
||||
"cluster: %(x)s"),
|
||||
{'novazone_id': novazone_id, 'x': x})
|
||||
if x.zone == str(novazone_id):
|
||||
self.novazone_cluster_map[x.zone] = x
|
||||
return x
|
||||
@ -912,7 +913,8 @@ class NvpPluginV2(db_base_plugin_v2.QuantumDbPluginV2,
|
||||
for c in self.clusters:
|
||||
networks.extend(nvplib.get_all_networks(c, tenant_id, networks))
|
||||
LOG.debug(_("get_all_networks() completed for tenant "
|
||||
"%(tenant_id)s: %(networks)s"), locals())
|
||||
"%(tenant_id)s: %(networks)s"),
|
||||
{'tenant_id': tenant_id, 'networks': networks})
|
||||
return networks
|
||||
|
||||
def create_network(self, context, network):
|
||||
@ -1072,7 +1074,8 @@ class NvpPluginV2(db_base_plugin_v2.QuantumDbPluginV2,
|
||||
break
|
||||
LOG.debug(_("Current network status:%(nvp_net_status)s; "
|
||||
"Status in Quantum DB:%(quantum_status)s"),
|
||||
locals())
|
||||
{'nvp_net_status': nvp_net_status,
|
||||
'quantum_status': quantum_status})
|
||||
if nvp_net_status != network.status:
|
||||
# update the network status
|
||||
network.status = nvp_net_status
|
||||
@ -1760,8 +1763,9 @@ class NvpPluginV2(db_base_plugin_v2.QuantumDbPluginV2,
|
||||
else:
|
||||
raise nvp_exc.NvpPluginException(
|
||||
err_msg=(_("The port %(port_id)s, connected to the router "
|
||||
"%(router_id)s was not found on the NVP backend.")
|
||||
% locals()))
|
||||
"%(router_id)s was not found on the NVP "
|
||||
"backend.") % {'port_id': port_id,
|
||||
'router_id': router_id}))
|
||||
|
||||
# Create logical router port and patch attachment
|
||||
self._create_and_attach_router_port(
|
||||
@ -1840,7 +1844,7 @@ class NvpPluginV2(db_base_plugin_v2.QuantumDbPluginV2,
|
||||
else:
|
||||
LOG.warning(_("The port %(port_id)s, connected to the router "
|
||||
"%(router_id)s was not found on the NVP backend"),
|
||||
locals())
|
||||
{'port_id': port_id, 'router_id': router_id})
|
||||
# Finally remove the data from the Quantum DB
|
||||
# This will also destroy the port on the logical switch
|
||||
super(NvpPluginV2, self).remove_router_interface(context,
|
||||
|
@ -229,7 +229,8 @@ def find_port_and_cluster(clusters, port_id):
|
||||
for c in clusters:
|
||||
query = "/ws.v1/lswitch/*/lport?uuid=%s&fields=*" % port_id
|
||||
LOG.debug(_("Looking for lswitch with port id "
|
||||
"'%(port_id)s' on: %(c)s"), locals())
|
||||
"'%(port_id)s' on: %(c)s"),
|
||||
{'port_id': port_id, 'c': c})
|
||||
try:
|
||||
res = do_single_request(HTTP_GET, query, cluster=c)
|
||||
except Exception as e:
|
||||
@ -664,7 +665,8 @@ def get_port_by_display_name(clusters, lswitch, display_name):
|
||||
query = ("/ws.v1/lswitch/%s/lport?display_name=%s&fields=*" %
|
||||
(lswitch, display_name))
|
||||
LOG.debug(_("Looking for port with display_name "
|
||||
"'%(display_name)s' on: %(lswitch)s"), locals())
|
||||
"'%(display_name)s' on: %(lswitch)s"),
|
||||
{'display_name': display_name, 'lswitch': lswitch})
|
||||
for c in clusters:
|
||||
try:
|
||||
res_obj = do_single_request(HTTP_GET, query, cluster=c)
|
||||
@ -709,7 +711,8 @@ def get_port_by_quantum_tag(cluster, lswitch_uuid, quantum_port_id):
|
||||
|
||||
|
||||
def get_port(cluster, network, port, relations=None):
|
||||
LOG.info(_("get_port() %(network)s %(port)s"), locals())
|
||||
LOG.info(_("get_port() %(network)s %(port)s"),
|
||||
{'network': network, 'port': port})
|
||||
uri = "/ws.v1/lswitch/" + network + "/lport/" + port + "?"
|
||||
if relations:
|
||||
uri += "relations=%s" % relations
|
||||
@ -1354,8 +1357,9 @@ def update_lrouter_port_ips(cluster, lrouter_id, lport_id,
|
||||
port['ip_addresses'] = list(ip_address_set)
|
||||
do_single_request(HTTP_PUT, uri, json.dumps(port), cluster=cluster)
|
||||
except NvpApiClient.ResourceNotFound as e:
|
||||
data = {'lport_id': lport_id, 'lrouter_id': lrouter_id}
|
||||
msg = (_("Router Port %(lport_id)s not found on router "
|
||||
"%(lrouter_id)s") % locals())
|
||||
"%(lrouter_id)s") % data)
|
||||
LOG.exception(msg)
|
||||
raise nvp_exc.NvpPluginException(err_msg=msg)
|
||||
except NvpApiClient.NvpApiException as e:
|
||||
|
@ -345,7 +345,8 @@ class OVSQuantumAgent(sg_rpc.SecurityGroupAgentRpcCallbackMixin):
|
||||
LOG.error(_("Cannot provision flat network for "
|
||||
"net-id=%(net_uuid)s - no bridge for "
|
||||
"physical_network %(physical_network)s"),
|
||||
locals())
|
||||
{'net_uuid': net_uuid,
|
||||
'physical_network': physical_network})
|
||||
elif network_type == constants.TYPE_VLAN:
|
||||
if physical_network in self.phys_brs:
|
||||
# outbound
|
||||
@ -364,14 +365,16 @@ class OVSQuantumAgent(sg_rpc.SecurityGroupAgentRpcCallbackMixin):
|
||||
LOG.error(_("Cannot provision VLAN network for "
|
||||
"net-id=%(net_uuid)s - no bridge for "
|
||||
"physical_network %(physical_network)s"),
|
||||
locals())
|
||||
{'net_uuid': net_uuid,
|
||||
'physical_network': physical_network})
|
||||
elif network_type == constants.TYPE_LOCAL:
|
||||
# no flows needed for local networks
|
||||
pass
|
||||
else:
|
||||
LOG.error(_("Cannot provision unknown network type "
|
||||
"%(network_type)s for net-id=%(net_uuid)s"),
|
||||
locals())
|
||||
{'network_type': network_type,
|
||||
'net_uuid': net_uuid})
|
||||
|
||||
def reclaim_local_vlan(self, net_uuid, lvm):
|
||||
'''Reclaim a local VLAN.
|
||||
@ -546,13 +549,15 @@ class OVSQuantumAgent(sg_rpc.SecurityGroupAgentRpcCallbackMixin):
|
||||
for physical_network, bridge in bridge_mappings.iteritems():
|
||||
LOG.info(_("Mapping physical network %(physical_network)s to "
|
||||
"bridge %(bridge)s"),
|
||||
locals())
|
||||
{'physical_network': physical_network,
|
||||
'bridge': bridge})
|
||||
# setup physical bridge
|
||||
if not ip_lib.device_exists(bridge, self.root_helper):
|
||||
LOG.error(_("Bridge %(bridge)s for physical network "
|
||||
"%(physical_network)s does not exist. Agent "
|
||||
"terminated!"),
|
||||
locals())
|
||||
{'physical_network': physical_network,
|
||||
'bridge': bridge})
|
||||
sys.exit(1)
|
||||
br = ovs_lib.OVSBridge(bridge, self.root_helper)
|
||||
br.remove_all_flows()
|
||||
@ -615,13 +620,14 @@ class OVSQuantumAgent(sg_rpc.SecurityGroupAgentRpcCallbackMixin):
|
||||
self.agent_id)
|
||||
except Exception as e:
|
||||
LOG.debug(_("Unable to get port details for "
|
||||
"%(device)s: %(e)s"), locals())
|
||||
"%(device)s: %(e)s"),
|
||||
{'device': device, 'e': e})
|
||||
resync = True
|
||||
continue
|
||||
port = self.int_br.get_vif_port_by_id(details['device'])
|
||||
if 'port_id' in details:
|
||||
LOG.info(_("Port %(device)s updated. Details: %(details)s"),
|
||||
locals())
|
||||
{'device': device, 'details': details})
|
||||
self.treat_vif_port(port, details['port_id'],
|
||||
details['network_id'],
|
||||
details['network_type'],
|
||||
@ -645,7 +651,7 @@ class OVSQuantumAgent(sg_rpc.SecurityGroupAgentRpcCallbackMixin):
|
||||
self.agent_id)
|
||||
except Exception as e:
|
||||
LOG.debug(_("port_removed failed for %(device)s: %(e)s"),
|
||||
locals())
|
||||
{'device': device, 'e': e})
|
||||
resync = True
|
||||
continue
|
||||
if details['exists']:
|
||||
|
@ -156,12 +156,15 @@ def reserve_specific_vlan(session, physical_network, vlan_id):
|
||||
raise q_exc.VlanIdInUse(vlan_id=vlan_id,
|
||||
physical_network=physical_network)
|
||||
LOG.debug(_("Reserving specific vlan %(vlan_id)s on physical "
|
||||
"network %(physical_network)s from pool"), locals())
|
||||
"network %(physical_network)s from pool"),
|
||||
{'vlan_id': vlan_id,
|
||||
'physical_network': physical_network})
|
||||
alloc.allocated = True
|
||||
except exc.NoResultFound:
|
||||
LOG.debug(_("Reserving specific vlan %(vlan_id)s on physical "
|
||||
"network %(physical_network)s outside pool"),
|
||||
locals())
|
||||
{'vlan_id': vlan_id,
|
||||
'physical_network': physical_network})
|
||||
alloc = ovs_models_v2.VlanAllocation(physical_network, vlan_id)
|
||||
alloc.allocated = True
|
||||
session.add(alloc)
|
||||
@ -185,15 +188,18 @@ def release_vlan(session, physical_network, vlan_id, network_vlan_ranges):
|
||||
session.delete(alloc)
|
||||
LOG.debug(_("Releasing vlan %(vlan_id)s on physical network "
|
||||
"%(physical_network)s outside pool"),
|
||||
locals())
|
||||
{'vlan_id': vlan_id,
|
||||
'physical_network': physical_network})
|
||||
else:
|
||||
LOG.debug(_("Releasing vlan %(vlan_id)s on physical network "
|
||||
"%(physical_network)s to pool"),
|
||||
locals())
|
||||
{'vlan_id': vlan_id,
|
||||
'physical_network': physical_network})
|
||||
except exc.NoResultFound:
|
||||
LOG.warning(_("vlan_id %(vlan_id)s on physical network "
|
||||
"%(physical_network)s not found"),
|
||||
locals())
|
||||
{'vlan_id': vlan_id,
|
||||
'physical_network': physical_network})
|
||||
|
||||
|
||||
def sync_tunnel_allocations(tunnel_id_ranges):
|
||||
@ -206,7 +212,7 @@ def sync_tunnel_allocations(tunnel_id_ranges):
|
||||
if tun_max + 1 - tun_min > 1000000:
|
||||
LOG.error(_("Skipping unreasonable tunnel ID range "
|
||||
"%(tun_min)s:%(tun_max)s"),
|
||||
locals())
|
||||
{'tun_min': tun_min, 'tun_max': tun_max})
|
||||
else:
|
||||
tunnel_ids |= set(xrange(tun_min, tun_max + 1))
|
||||
|
||||
|
@ -89,7 +89,7 @@ class OVSRpcCallbacks(dhcp_rpc_base.DhcpRpcCallbackMixin,
|
||||
agent_id = kwargs.get('agent_id')
|
||||
device = kwargs.get('device')
|
||||
LOG.debug(_("Device %(device)s details requested from %(agent_id)s"),
|
||||
locals())
|
||||
{'device': device, 'agent_id': agent_id})
|
||||
port = ovs_db_v2.get_port(device)
|
||||
if port:
|
||||
binding = ovs_db_v2.get_network_binding(None, port['network_id'])
|
||||
@ -115,7 +115,7 @@ class OVSRpcCallbacks(dhcp_rpc_base.DhcpRpcCallbackMixin,
|
||||
agent_id = kwargs.get('agent_id')
|
||||
device = kwargs.get('device')
|
||||
LOG.debug(_("Device %(device)s no longer exists on %(agent_id)s"),
|
||||
locals())
|
||||
{'device': device, 'agent_id': agent_id})
|
||||
port = ovs_db_v2.get_port(device)
|
||||
if port:
|
||||
entry = {'device': device,
|
||||
@ -134,7 +134,7 @@ class OVSRpcCallbacks(dhcp_rpc_base.DhcpRpcCallbackMixin,
|
||||
agent_id = kwargs.get('agent_id')
|
||||
device = kwargs.get('device')
|
||||
LOG.debug(_("Device %(device)s up on %(agent_id)s"),
|
||||
locals())
|
||||
{'device': device, 'agent_id': agent_id})
|
||||
port = ovs_db_v2.get_port(device)
|
||||
if port:
|
||||
if port['status'] != q_const.PORT_STATUS_ACTIVE:
|
||||
|
@ -153,7 +153,7 @@ class TunnelKey(object):
|
||||
|
||||
new_key = new_key[0] # the result is tuple.
|
||||
LOG.debug(_("last_key %(last_key)s new_key %(new_key)s"),
|
||||
locals())
|
||||
{'last_key': last_key, 'new_key': new_key})
|
||||
if new_key > self.key_max:
|
||||
LOG.debug(_("No key found"))
|
||||
raise orm_exc.NoResultFound()
|
||||
|
Loading…
Reference in New Issue
Block a user