Remove locals() from various places.
fixes bug 1171936 Remove usage of locals() for string formatting Change-Id: Ib05538095086ddefdb486c84da506af662ec5c9b
This commit is contained in:
parent
536f37906d
commit
20eac6c1df
@ -121,7 +121,7 @@ class QuotaSetsController(object):
|
|||||||
value = int(value)
|
value = int(value)
|
||||||
except (ValueError, TypeError):
|
except (ValueError, TypeError):
|
||||||
msg = _("Quota '%(value)s' for %(key)s should be "
|
msg = _("Quota '%(value)s' for %(key)s should be "
|
||||||
"integer.") % locals()
|
"integer.") % {'value': value, 'key': key}
|
||||||
LOG.warn(msg)
|
LOG.warn(msg)
|
||||||
raise webob.exc.HTTPBadRequest(explanation=msg)
|
raise webob.exc.HTTPBadRequest(explanation=msg)
|
||||||
self._validate_quota_limit(value)
|
self._validate_quota_limit(value)
|
||||||
|
@ -111,7 +111,7 @@ class QuotaSetsController(object):
|
|||||||
value = int(value)
|
value = int(value)
|
||||||
except (ValueError, TypeError):
|
except (ValueError, TypeError):
|
||||||
msg = _("Quota '%(value)s' for %(key)s should be "
|
msg = _("Quota '%(value)s' for %(key)s should be "
|
||||||
"integer.") % locals()
|
"integer.") % {'value': value, 'key': key}
|
||||||
LOG.warn(msg)
|
LOG.warn(msg)
|
||||||
raise webob.exc.HTTPBadRequest(explanation=msg)
|
raise webob.exc.HTTPBadRequest(explanation=msg)
|
||||||
self._validate_quota_limit(value)
|
self._validate_quota_limit(value)
|
||||||
|
@ -63,7 +63,8 @@ class MuteChildWeigher(weights.BaseCellWeigher):
|
|||||||
if timeutils.is_older_than(last_seen, secs):
|
if timeutils.is_older_than(last_seen, secs):
|
||||||
# yep, that's a mute child; recommend highly that it be skipped!
|
# yep, that's a mute child; recommend highly that it be skipped!
|
||||||
LOG.warn(_("%(cell)s has not been seen since %(last_seen)s and is "
|
LOG.warn(_("%(cell)s has not been seen since %(last_seen)s and is "
|
||||||
"being treated as mute.") % locals())
|
"being treated as mute."),
|
||||||
|
{'cell': cell, 'last_seen': last_seen})
|
||||||
return CONF.cells.mute_weight_value
|
return CONF.cells.mute_weight_value
|
||||||
else:
|
else:
|
||||||
return 0
|
return 0
|
||||||
|
@ -242,7 +242,8 @@ class Worker(threading.Thread):
|
|||||||
else:
|
else:
|
||||||
# Requests comes here from BareMetalDeploy.post()
|
# Requests comes here from BareMetalDeploy.post()
|
||||||
LOG.info(_('start deployment for node %(node_id)s, '
|
LOG.info(_('start deployment for node %(node_id)s, '
|
||||||
'params %(params)s') % locals())
|
'params %(params)s'),
|
||||||
|
{'node_id': node_id, 'params': params})
|
||||||
context = nova_context.get_admin_context()
|
context = nova_context.get_admin_context()
|
||||||
try:
|
try:
|
||||||
db.bm_node_update(context, node_id,
|
db.bm_node_update(context, node_id,
|
||||||
|
@ -690,7 +690,8 @@ class ServiceCommands(object):
|
|||||||
except exception.NotFound as ex:
|
except exception.NotFound as ex:
|
||||||
print _("error: %s") % ex
|
print _("error: %s") % ex
|
||||||
return(2)
|
return(2)
|
||||||
print _("Service %(service)s on host %(host)s enabled.") % locals()
|
print (_("Service %(service)s on host %(host)s enabled.") %
|
||||||
|
{'service': service, 'host': host})
|
||||||
|
|
||||||
@args('--host', metavar='<host>', help='Host')
|
@args('--host', metavar='<host>', help='Host')
|
||||||
@args('--service', metavar='<service>', help='Nova service')
|
@args('--service', metavar='<service>', help='Nova service')
|
||||||
@ -703,7 +704,8 @@ class ServiceCommands(object):
|
|||||||
except exception.NotFound as ex:
|
except exception.NotFound as ex:
|
||||||
print _("error: %s") % ex
|
print _("error: %s") % ex
|
||||||
return(2)
|
return(2)
|
||||||
print _("Service %(service)s on host %(host)s disabled.") % locals()
|
print (_("Service %(service)s on host %(host)s disabled.") %
|
||||||
|
{'service': service, 'host': host})
|
||||||
|
|
||||||
def _show_host_resources(self, context, host):
|
def _show_host_resources(self, context, host):
|
||||||
"""Shows the physical/usage resource given by hosts.
|
"""Shows the physical/usage resource given by hosts.
|
||||||
@ -968,8 +970,9 @@ class InstanceTypeCommands(object):
|
|||||||
ctxt,
|
ctxt,
|
||||||
inst_type["flavorid"],
|
inst_type["flavorid"],
|
||||||
ext_spec)
|
ext_spec)
|
||||||
print _("Key %(key)s set to %(value)s on instance"
|
print (_("Key %(key)s set to %(value)s on instance "
|
||||||
" type %(name)s") % locals()
|
"type %(name)s") %
|
||||||
|
{'key': key, 'value': value, 'name': name})
|
||||||
except db_exc.DBError as e:
|
except db_exc.DBError as e:
|
||||||
_db_error(e)
|
_db_error(e)
|
||||||
|
|
||||||
@ -990,7 +993,8 @@ class InstanceTypeCommands(object):
|
|||||||
inst_type["flavorid"],
|
inst_type["flavorid"],
|
||||||
key)
|
key)
|
||||||
|
|
||||||
print _("Key %(key)s on instance type %(name)s unset") % locals()
|
print (_("Key %(key)s on instance type %(name)s unset") %
|
||||||
|
{'key': key, 'name': name})
|
||||||
except db_exc.DBError as e:
|
except db_exc.DBError as e:
|
||||||
_db_error(e)
|
_db_error(e)
|
||||||
|
|
||||||
@ -1099,7 +1103,8 @@ class GetLogCommands(object):
|
|||||||
print log_file + ":-"
|
print log_file + ":-"
|
||||||
print_name = 1
|
print_name = 1
|
||||||
linenum = len(lines) - index
|
linenum = len(lines) - index
|
||||||
print _('Line %(linenum)d : %(line)s') % locals()
|
print (_('Line %(linenum)d : %(line)s') %
|
||||||
|
{'linenum': linenum, 'line': line})
|
||||||
if error_found == 0:
|
if error_found == 0:
|
||||||
print _('No errors in logfiles!')
|
print _('No errors in logfiles!')
|
||||||
|
|
||||||
|
@ -120,7 +120,8 @@ class ConductorManager(manager.Manager):
|
|||||||
for key, value in updates.iteritems():
|
for key, value in updates.iteritems():
|
||||||
if key not in allowed_updates:
|
if key not in allowed_updates:
|
||||||
LOG.error(_("Instance update attempted for "
|
LOG.error(_("Instance update attempted for "
|
||||||
"'%(key)s' on %(instance_uuid)s") % locals())
|
"'%(key)s' on %(instance_uuid)s"),
|
||||||
|
{'key': key, 'instance_uuid': instance_uuid})
|
||||||
raise KeyError("unexpected update keyword '%s'" % key)
|
raise KeyError("unexpected update keyword '%s'" % key)
|
||||||
if key in datetime_fields and isinstance(value, basestring):
|
if key in datetime_fields and isinstance(value, basestring):
|
||||||
updates[key] = timeutils.parse_strtime(value)
|
updates[key] = timeutils.parse_strtime(value)
|
||||||
|
@ -84,7 +84,8 @@ class ConsoleAuthManager(manager.Manager):
|
|||||||
self.mc.set(instance_uuid.encode('UTF-8'),
|
self.mc.set(instance_uuid.encode('UTF-8'),
|
||||||
jsonutils.dumps(tokens))
|
jsonutils.dumps(tokens))
|
||||||
|
|
||||||
LOG.audit(_("Received Token: %(token)s, %(token_dict)s)"), locals())
|
LOG.audit(_("Received Token: %(token)s, %(token_dict)s"),
|
||||||
|
{'token': token, 'token_dict': token_dict})
|
||||||
|
|
||||||
def _validate_token(self, context, token):
|
def _validate_token(self, context, token):
|
||||||
instance_uuid = token['instance_uuid']
|
instance_uuid = token['instance_uuid']
|
||||||
@ -108,7 +109,8 @@ class ConsoleAuthManager(manager.Manager):
|
|||||||
def check_token(self, context, token):
|
def check_token(self, context, token):
|
||||||
token_str = self.mc.get(token.encode('UTF-8'))
|
token_str = self.mc.get(token.encode('UTF-8'))
|
||||||
token_valid = (token_str is not None)
|
token_valid = (token_str is not None)
|
||||||
LOG.audit(_("Checking Token: %(token)s, %(token_valid)s)"), locals())
|
LOG.audit(_("Checking Token: %(token)s, %(token_valid)s"),
|
||||||
|
{'token': token, 'token_valid': token_valid})
|
||||||
if token_valid:
|
if token_valid:
|
||||||
token = jsonutils.loads(token_str)
|
token = jsonutils.loads(token_str)
|
||||||
if self._validate_token(context, token):
|
if self._validate_token(context, token):
|
||||||
|
@ -2953,7 +2953,7 @@ def quota_reserve(context, resources, quotas, deltas, expire,
|
|||||||
|
|
||||||
if unders:
|
if unders:
|
||||||
LOG.warning(_("Change will make usage less than 0 for the following "
|
LOG.warning(_("Change will make usage less than 0 for the following "
|
||||||
"resources: %(unders)s") % locals())
|
"resources: %s"), unders)
|
||||||
if overs:
|
if overs:
|
||||||
usages = dict((k, dict(in_use=v['in_use'], reserved=v['reserved']))
|
usages = dict((k, dict(in_use=v['in_use'], reserved=v['reserved']))
|
||||||
for k, v in usages.items())
|
for k, v in usages.items())
|
||||||
|
@ -66,7 +66,8 @@ class HookManager(stevedore.hook.HookManager):
|
|||||||
obj = e.obj
|
obj = e.obj
|
||||||
pre = getattr(obj, 'pre', None)
|
pre = getattr(obj, 'pre', None)
|
||||||
if pre:
|
if pre:
|
||||||
LOG.debug(_("Running %(name)s pre-hook: %(obj)s") % locals())
|
LOG.debug(_("Running %(name)s pre-hook: %(obj)s"),
|
||||||
|
{'name': name, 'obj': obj})
|
||||||
if f:
|
if f:
|
||||||
pre(f, *args, **kwargs)
|
pre(f, *args, **kwargs)
|
||||||
else:
|
else:
|
||||||
@ -77,7 +78,8 @@ class HookManager(stevedore.hook.HookManager):
|
|||||||
obj = e.obj
|
obj = e.obj
|
||||||
post = getattr(obj, 'post', None)
|
post = getattr(obj, 'post', None)
|
||||||
if post:
|
if post:
|
||||||
LOG.debug(_("Running %(name)s post-hook: %(obj)s") % locals())
|
LOG.debug(_("Running %(name)s post-hook: %(obj)s"),
|
||||||
|
{'name': name, 'obj': obj})
|
||||||
if f:
|
if f:
|
||||||
post(f, rv, *args, **kwargs)
|
post(f, rv, *args, **kwargs)
|
||||||
else:
|
else:
|
||||||
|
@ -184,14 +184,17 @@ class GlanceClientWrapper(object):
|
|||||||
host = self.host
|
host = self.host
|
||||||
port = self.port
|
port = self.port
|
||||||
extra = "retrying"
|
extra = "retrying"
|
||||||
error_msg = _("Error contacting glance server "
|
error_msg = (_("Error contacting glance server "
|
||||||
"'%(host)s:%(port)s' for '%(method)s', %(extra)s.")
|
"'%(host)s:%(port)s' for '%(method)s', "
|
||||||
|
"%(extra)s.") %
|
||||||
|
{'host': host, 'port': port,
|
||||||
|
'method': method, 'extra': extra})
|
||||||
if attempt == num_attempts:
|
if attempt == num_attempts:
|
||||||
extra = 'done trying'
|
extra = 'done trying'
|
||||||
LOG.exception(error_msg, locals())
|
LOG.exception(error_msg)
|
||||||
raise exception.GlanceConnectionFailed(
|
raise exception.GlanceConnectionFailed(
|
||||||
host=host, port=port, reason=str(e))
|
host=host, port=port, reason=str(e))
|
||||||
LOG.exception(error_msg, locals())
|
LOG.exception(error_msg)
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
|
|
||||||
|
|
||||||
|
@ -85,7 +85,7 @@ class FloatingIP(object):
|
|||||||
fixed_ip_id,
|
fixed_ip_id,
|
||||||
get_network=True)
|
get_network=True)
|
||||||
except exception.FixedIpNotFound:
|
except exception.FixedIpNotFound:
|
||||||
msg = _('Fixed ip %(fixed_ip_id)s not found') % locals()
|
msg = _('Fixed ip %s not found') % fixed_ip_id
|
||||||
LOG.debug(msg)
|
LOG.debug(msg)
|
||||||
continue
|
continue
|
||||||
interface = CONF.public_interface or floating_ip['interface']
|
interface = CONF.public_interface or floating_ip['interface']
|
||||||
@ -95,7 +95,7 @@ class FloatingIP(object):
|
|||||||
interface,
|
interface,
|
||||||
fixed_ip['network'])
|
fixed_ip['network'])
|
||||||
except processutils.ProcessExecutionError:
|
except processutils.ProcessExecutionError:
|
||||||
LOG.debug(_('Interface %(interface)s not found'), locals())
|
LOG.debug(_('Interface %s not found'), interface)
|
||||||
raise exception.NoFloatingIpInterface(interface=interface)
|
raise exception.NoFloatingIpInterface(interface=interface)
|
||||||
|
|
||||||
def allocate_for_instance(self, context, **kwargs):
|
def allocate_for_instance(self, context, **kwargs):
|
||||||
@ -120,7 +120,7 @@ class FloatingIP(object):
|
|||||||
floating_address = self.allocate_floating_ip(context, project_id,
|
floating_address = self.allocate_floating_ip(context, project_id,
|
||||||
True)
|
True)
|
||||||
LOG.debug(_("floating IP allocation for instance "
|
LOG.debug(_("floating IP allocation for instance "
|
||||||
"|%(floating_address)s|") % locals(),
|
"|%s|"), floating_address,
|
||||||
instance_uuid=instance_uuid, context=context)
|
instance_uuid=instance_uuid, context=context)
|
||||||
# set auto_assigned column to true for the floating ip
|
# set auto_assigned column to true for the floating ip
|
||||||
self.db.floating_ip_set_auto_assigned(context, floating_address)
|
self.db.floating_ip_set_auto_assigned(context, floating_address)
|
||||||
@ -217,9 +217,8 @@ class FloatingIP(object):
|
|||||||
if use_quota:
|
if use_quota:
|
||||||
reservations = QUOTAS.reserve(context, floating_ips=1)
|
reservations = QUOTAS.reserve(context, floating_ips=1)
|
||||||
except exception.OverQuota:
|
except exception.OverQuota:
|
||||||
pid = context.project_id
|
LOG.warn(_("Quota exceeded for %s, tried to allocate "
|
||||||
LOG.warn(_("Quota exceeded for %(pid)s, tried to allocate "
|
"floating IP"), context.project_id)
|
||||||
"floating IP") % locals())
|
|
||||||
raise exception.FloatingIpLimitExceeded()
|
raise exception.FloatingIpLimitExceeded()
|
||||||
|
|
||||||
try:
|
try:
|
||||||
@ -371,7 +370,7 @@ class FloatingIP(object):
|
|||||||
except processutils.ProcessExecutionError as e:
|
except processutils.ProcessExecutionError as e:
|
||||||
self.db.floating_ip_disassociate(context, floating_address)
|
self.db.floating_ip_disassociate(context, floating_address)
|
||||||
if "Cannot find device" in str(e):
|
if "Cannot find device" in str(e):
|
||||||
LOG.error(_('Interface %(interface)s not found'), locals())
|
LOG.error(_('Interface %s not found'), interface)
|
||||||
raise exception.NoFloatingIpInterface(interface=interface)
|
raise exception.NoFloatingIpInterface(interface=interface)
|
||||||
raise
|
raise
|
||||||
|
|
||||||
@ -529,16 +528,17 @@ class FloatingIP(object):
|
|||||||
if not floating_addresses or (source and source == dest):
|
if not floating_addresses or (source and source == dest):
|
||||||
return
|
return
|
||||||
|
|
||||||
LOG.info(_("Starting migration network for instance"
|
LOG.info(_("Starting migration network for instance %s"),
|
||||||
" %(instance_uuid)s"), locals())
|
instance_uuid)
|
||||||
for address in floating_addresses:
|
for address in floating_addresses:
|
||||||
floating_ip = self.db.floating_ip_get_by_address(context,
|
floating_ip = self.db.floating_ip_get_by_address(context,
|
||||||
address)
|
address)
|
||||||
|
|
||||||
if self._is_stale_floating_ip_address(context, floating_ip):
|
if self._is_stale_floating_ip_address(context, floating_ip):
|
||||||
LOG.warn(_("Floating ip address |%(address)s| no longer "
|
LOG.warn(_("Floating ip address |%(address)s| no longer "
|
||||||
"belongs to instance %(instance_uuid)s. Will not"
|
"belongs to instance %(instance_uuid)s. Will not "
|
||||||
"migrate it "), locals())
|
"migrate it "),
|
||||||
|
{'address': address, 'instance_uuid': instance_uuid})
|
||||||
continue
|
continue
|
||||||
|
|
||||||
interface = CONF.public_interface or floating_ip['interface']
|
interface = CONF.public_interface or floating_ip['interface']
|
||||||
@ -571,8 +571,8 @@ class FloatingIP(object):
|
|||||||
if not floating_addresses or (source and source == dest):
|
if not floating_addresses or (source and source == dest):
|
||||||
return
|
return
|
||||||
|
|
||||||
LOG.info(_("Finishing migration network for instance"
|
LOG.info(_("Finishing migration network for instance %s"),
|
||||||
" %(instance_uuid)s"), locals())
|
instance_uuid)
|
||||||
|
|
||||||
for address in floating_addresses:
|
for address in floating_addresses:
|
||||||
floating_ip = self.db.floating_ip_get_by_address(context,
|
floating_ip = self.db.floating_ip_get_by_address(context,
|
||||||
@ -581,7 +581,8 @@ class FloatingIP(object):
|
|||||||
if self._is_stale_floating_ip_address(context, floating_ip):
|
if self._is_stale_floating_ip_address(context, floating_ip):
|
||||||
LOG.warn(_("Floating ip address |%(address)s| no longer "
|
LOG.warn(_("Floating ip address |%(address)s| no longer "
|
||||||
"belongs to instance %(instance_uuid)s. Will not"
|
"belongs to instance %(instance_uuid)s. Will not"
|
||||||
"setup it."), locals())
|
"setup it."),
|
||||||
|
{'address': address, 'instance_uuid': instance_uuid})
|
||||||
continue
|
continue
|
||||||
|
|
||||||
self.db.floating_ip_update(context,
|
self.db.floating_ip_update(context,
|
||||||
|
@ -1474,7 +1474,7 @@ class LinuxBridgeInterfaceDriver(LinuxNetInterfaceDriver):
|
|||||||
|
|
||||||
if interface:
|
if interface:
|
||||||
msg = _('Adding interface %(interface)s to bridge %(bridge)s')
|
msg = _('Adding interface %(interface)s to bridge %(bridge)s')
|
||||||
LOG.debug(msg % locals())
|
LOG.debug(msg, {'interface': interface, 'bridge': bridge})
|
||||||
out, err = _execute('brctl', 'addif', bridge, interface,
|
out, err = _execute('brctl', 'addif', bridge, interface,
|
||||||
check_exit_code=False, run_as_root=True)
|
check_exit_code=False, run_as_root=True)
|
||||||
|
|
||||||
|
@ -485,8 +485,8 @@ class NetworkManager(manager.Manager):
|
|||||||
requested_networks=requested_networks)
|
requested_networks=requested_networks)
|
||||||
networks_list = [self._get_network_dict(network)
|
networks_list = [self._get_network_dict(network)
|
||||||
for network in networks]
|
for network in networks]
|
||||||
LOG.debug(_('networks retrieved for instance: |%(networks_list)s|'),
|
LOG.debug(_('networks retrieved for instance: |%s|'),
|
||||||
locals(), context=context, instance_uuid=instance_uuid)
|
networks_list, context=context, instance_uuid=instance_uuid)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
self._allocate_mac_addresses(context, instance_uuid, networks,
|
self._allocate_mac_addresses(context, instance_uuid, networks,
|
||||||
@ -824,9 +824,8 @@ class NetworkManager(manager.Manager):
|
|||||||
try:
|
try:
|
||||||
reservations = QUOTAS.reserve(context, fixed_ips=1)
|
reservations = QUOTAS.reserve(context, fixed_ips=1)
|
||||||
except exception.OverQuota:
|
except exception.OverQuota:
|
||||||
pid = context.project_id
|
LOG.warn(_("Quota exceeded for %s, tried to allocate "
|
||||||
LOG.warn(_("Quota exceeded for %(pid)s, tried to allocate "
|
"fixed IP"), context.project_id)
|
||||||
"fixed IP") % locals())
|
|
||||||
raise exception.FixedIpLimitExceeded()
|
raise exception.FixedIpLimitExceeded()
|
||||||
|
|
||||||
try:
|
try:
|
||||||
@ -948,7 +947,7 @@ class NetworkManager(manager.Manager):
|
|||||||
|
|
||||||
def lease_fixed_ip(self, context, address):
|
def lease_fixed_ip(self, context, address):
|
||||||
"""Called by dhcp-bridge when ip is leased."""
|
"""Called by dhcp-bridge when ip is leased."""
|
||||||
LOG.debug(_('Leased IP |%(address)s|'), locals(), context=context)
|
LOG.debug(_('Leased IP |%s|'), address, context=context)
|
||||||
fixed_ip = self.db.fixed_ip_get_by_address(context, address)
|
fixed_ip = self.db.fixed_ip_get_by_address(context, address)
|
||||||
|
|
||||||
if fixed_ip['instance_uuid'] is None:
|
if fixed_ip['instance_uuid'] is None:
|
||||||
@ -966,7 +965,7 @@ class NetworkManager(manager.Manager):
|
|||||||
|
|
||||||
def release_fixed_ip(self, context, address):
|
def release_fixed_ip(self, context, address):
|
||||||
"""Called by dhcp-bridge when ip is released."""
|
"""Called by dhcp-bridge when ip is released."""
|
||||||
LOG.debug(_('Released IP |%(address)s|'), locals(), context=context)
|
LOG.debug(_('Released IP |%s|'), address, context=context)
|
||||||
fixed_ip = self.db.fixed_ip_get_by_address(context, address)
|
fixed_ip = self.db.fixed_ip_get_by_address(context, address)
|
||||||
|
|
||||||
if fixed_ip['instance_uuid'] is None:
|
if fixed_ip['instance_uuid'] is None:
|
||||||
|
@ -383,8 +383,8 @@ class API(base.Base):
|
|||||||
try:
|
try:
|
||||||
neutronv2.get_client(context).delete_port(port_id)
|
neutronv2.get_client(context).delete_port(port_id)
|
||||||
except Exception as ex:
|
except Exception as ex:
|
||||||
LOG.exception(_("Failed to delete neutron port %(port_id)s ") %
|
LOG.exception(_("Failed to delete neutron port %s") %
|
||||||
locals())
|
port_id)
|
||||||
|
|
||||||
return self._get_instance_nw_info(context, instance)
|
return self._get_instance_nw_info(context, instance)
|
||||||
|
|
||||||
|
@ -302,7 +302,7 @@ class NovaObject(object):
|
|||||||
be useful for future load operations.
|
be useful for future load operations.
|
||||||
"""
|
"""
|
||||||
raise NotImplementedError(
|
raise NotImplementedError(
|
||||||
_("Cannot load '%(attrname)s' in the base class") % locals())
|
_("Cannot load '%s' in the base class") % attrname)
|
||||||
|
|
||||||
def save(self, context):
|
def save(self, context):
|
||||||
"""Save the changed fields back to the store.
|
"""Save the changed fields back to the store.
|
||||||
|
@ -969,7 +969,7 @@ class QuotaEngine(object):
|
|||||||
expire=expire,
|
expire=expire,
|
||||||
project_id=project_id)
|
project_id=project_id)
|
||||||
|
|
||||||
LOG.debug(_("Created reservations %(reservations)s") % locals())
|
LOG.debug(_("Created reservations %s"), reservations)
|
||||||
|
|
||||||
return reservations
|
return reservations
|
||||||
|
|
||||||
@ -991,10 +991,9 @@ class QuotaEngine(object):
|
|||||||
# usage resynchronization and the reservation expiration
|
# usage resynchronization and the reservation expiration
|
||||||
# mechanisms will resolve the issue. The exception is
|
# mechanisms will resolve the issue. The exception is
|
||||||
# logged, however, because this is less than optimal.
|
# logged, however, because this is less than optimal.
|
||||||
LOG.exception(_("Failed to commit reservations "
|
LOG.exception(_("Failed to commit reservations %s"), reservations)
|
||||||
"%(reservations)s") % locals())
|
|
||||||
return
|
return
|
||||||
LOG.debug(_("Committed reservations %(reservations)s") % locals())
|
LOG.debug(_("Committed reservations %s"), reservations)
|
||||||
|
|
||||||
def rollback(self, context, reservations, project_id=None):
|
def rollback(self, context, reservations, project_id=None):
|
||||||
"""Roll back reservations.
|
"""Roll back reservations.
|
||||||
@ -1014,10 +1013,10 @@ class QuotaEngine(object):
|
|||||||
# usage resynchronization and the reservation expiration
|
# usage resynchronization and the reservation expiration
|
||||||
# mechanisms will resolve the issue. The exception is
|
# mechanisms will resolve the issue. The exception is
|
||||||
# logged, however, because this is less than optimal.
|
# logged, however, because this is less than optimal.
|
||||||
LOG.exception(_("Failed to roll back reservations "
|
LOG.exception(_("Failed to roll back reservations %s"),
|
||||||
"%(reservations)s") % locals())
|
reservations)
|
||||||
return
|
return
|
||||||
LOG.debug(_("Rolled back reservations %(reservations)s") % locals())
|
LOG.debug(_("Rolled back reservations %s"), reservations)
|
||||||
|
|
||||||
def usage_reset(self, context, resources):
|
def usage_reset(self, context, resources):
|
||||||
"""
|
"""
|
||||||
|
@ -97,8 +97,7 @@ class AggregateCoreFilter(BaseCoreFilter):
|
|||||||
try:
|
try:
|
||||||
ratio = float(min(aggregate_vals))
|
ratio = float(min(aggregate_vals))
|
||||||
except ValueError as e:
|
except ValueError as e:
|
||||||
LOG.warning(_("Could not decode cpu_allocation_ratio: "
|
LOG.warning(_("Could not decode cpu_allocation_ratio: '%s'"), e)
|
||||||
"'%(e)s'") % locals())
|
|
||||||
ratio = CONF.cpu_allocation_ratio
|
ratio = CONF.cpu_allocation_ratio
|
||||||
|
|
||||||
return ratio
|
return ratio
|
||||||
|
@ -98,8 +98,7 @@ class AggregateRamFilter(BaseRamFilter):
|
|||||||
try:
|
try:
|
||||||
ratio = float(min(aggregate_vals))
|
ratio = float(min(aggregate_vals))
|
||||||
except ValueError as e:
|
except ValueError as e:
|
||||||
LOG.warning(_("Could not decode ram_allocation_ratio: "
|
LOG.warning(_("Could not decode ram_allocation_ratio: '%s'"), e)
|
||||||
"'%(e)s'") % locals())
|
|
||||||
ratio = CONF.ram_allocation_ratio
|
ratio = CONF.ram_allocation_ratio
|
||||||
|
|
||||||
return ratio
|
return ratio
|
||||||
|
@ -82,7 +82,8 @@ class API(object):
|
|||||||
"""
|
"""
|
||||||
msg = _('Join new ServiceGroup member %(member_id)s to the '
|
msg = _('Join new ServiceGroup member %(member_id)s to the '
|
||||||
'%(group_id)s group, service = %(service)s')
|
'%(group_id)s group, service = %(service)s')
|
||||||
LOG.debug(msg, locals())
|
LOG.debug(msg, {'member_id': member_id, 'group_id': group_id,
|
||||||
|
'service': service})
|
||||||
return self._driver.join(member_id, group_id, service)
|
return self._driver.join(member_id, group_id, service)
|
||||||
|
|
||||||
def service_is_up(self, member):
|
def service_is_up(self, member):
|
||||||
@ -98,7 +99,7 @@ class API(object):
|
|||||||
"""
|
"""
|
||||||
msg = _('Explicitly remove the given member %(member_id)s from the'
|
msg = _('Explicitly remove the given member %(member_id)s from the'
|
||||||
'%(group_id)s group monitoring')
|
'%(group_id)s group monitoring')
|
||||||
LOG.debug(msg, locals())
|
LOG.debug(msg, {'member_id': member_id, 'group_id': group_id})
|
||||||
return self._driver.leave(member_id, group_id)
|
return self._driver.leave(member_id, group_id)
|
||||||
|
|
||||||
def get_all(self, group_id):
|
def get_all(self, group_id):
|
||||||
|
@ -40,7 +40,8 @@ class DbDriver(api.ServiceGroupDriver):
|
|||||||
|
|
||||||
msg = _('DB_Driver: join new ServiceGroup member %(member_id)s to '
|
msg = _('DB_Driver: join new ServiceGroup member %(member_id)s to '
|
||||||
'the %(group_id)s group, service = %(service)s')
|
'the %(group_id)s group, service = %(service)s')
|
||||||
LOG.debug(msg, locals())
|
LOG.debug(msg, {'member_id': member_id, 'group_id': group_id,
|
||||||
|
'service': service})
|
||||||
if service is None:
|
if service is None:
|
||||||
raise RuntimeError(_('service is a mandatory argument for DB based'
|
raise RuntimeError(_('service is a mandatory argument for DB based'
|
||||||
' ServiceGroup driver'))
|
' ServiceGroup driver'))
|
||||||
|
@ -51,7 +51,8 @@ class MemcachedDriver(api.ServiceGroupDriver):
|
|||||||
msg = _('Memcached_Driver: join new ServiceGroup member '
|
msg = _('Memcached_Driver: join new ServiceGroup member '
|
||||||
'%(member_id)s to the %(group_id)s group, '
|
'%(member_id)s to the %(group_id)s group, '
|
||||||
'service = %(service)s')
|
'service = %(service)s')
|
||||||
LOG.debug(msg, locals())
|
LOG.debug(msg, {'member_id': member_id, 'group_id': group_id,
|
||||||
|
'service': service})
|
||||||
if service is None:
|
if service is None:
|
||||||
raise RuntimeError(_('service is a mandatory argument for '
|
raise RuntimeError(_('service is a mandatory argument for '
|
||||||
'Memcached based ServiceGroup driver'))
|
'Memcached based ServiceGroup driver'))
|
||||||
|
@ -119,11 +119,10 @@ def find_multipath_device(device):
|
|||||||
mdev_id = mdev_id.replace(')', '')
|
mdev_id = mdev_id.replace(')', '')
|
||||||
|
|
||||||
if mdev is None:
|
if mdev is None:
|
||||||
LOG.warn(_("Couldn't find multipath device %(line)s")
|
LOG.warn(_("Couldn't find multipath device %s"), line)
|
||||||
% locals())
|
|
||||||
return None
|
return None
|
||||||
|
|
||||||
LOG.debug(_("Found multipath device = %(mdev)s") % locals())
|
LOG.debug(_("Found multipath device = %s"), mdev)
|
||||||
device_lines = lines[3:]
|
device_lines = lines[3:]
|
||||||
for dev_line in device_lines:
|
for dev_line in device_lines:
|
||||||
if dev_line.find("policy") != -1:
|
if dev_line.find("policy") != -1:
|
||||||
|
@ -398,7 +398,7 @@ def get_my_linklocal(interface):
|
|||||||
raise exception.NovaException(msg)
|
raise exception.NovaException(msg)
|
||||||
except Exception as ex:
|
except Exception as ex:
|
||||||
msg = _("Couldn't get Link Local IP of %(interface)s"
|
msg = _("Couldn't get Link Local IP of %(interface)s"
|
||||||
" :%(ex)s") % locals()
|
" :%(ex)s") % {'interface': interface, 'ex': ex}
|
||||||
raise exception.NovaException(msg)
|
raise exception.NovaException(msg)
|
||||||
|
|
||||||
|
|
||||||
@ -1105,12 +1105,12 @@ def check_string_length(value, name, min_length=0, max_length=None):
|
|||||||
|
|
||||||
if len(value) < min_length:
|
if len(value) < min_length:
|
||||||
msg = _("%(name)s has less than %(min_length)s "
|
msg = _("%(name)s has less than %(min_length)s "
|
||||||
"characters.") % locals()
|
"characters.") % {'name': name, 'min_length': min_length}
|
||||||
raise exception.InvalidInput(message=msg)
|
raise exception.InvalidInput(message=msg)
|
||||||
|
|
||||||
if max_length and len(value) > max_length:
|
if max_length and len(value) > max_length:
|
||||||
msg = _("%(name)s has more than %(max_length)s "
|
msg = _("%(name)s has more than %(max_length)s "
|
||||||
"characters.") % locals()
|
"characters.") % {'name': name, 'max_length': max_length}
|
||||||
raise exception.InvalidInput(message=msg)
|
raise exception.InvalidInput(message=msg)
|
||||||
|
|
||||||
|
|
||||||
|
@ -62,7 +62,8 @@ def _load_config():
|
|||||||
NOVA_PACKAGE = cfg.get("Nova", "package")
|
NOVA_PACKAGE = cfg.get("Nova", "package")
|
||||||
except Exception as ex:
|
except Exception as ex:
|
||||||
LOG = logging.getLogger(__name__)
|
LOG = logging.getLogger(__name__)
|
||||||
LOG.error("Failed to load %(cfgfile)s: %(ex)s" % locals())
|
LOG.error("Failed to load %(cfgfile)s: %(ex)s",
|
||||||
|
{'cfgfile': cfgfile, 'ex': ex})
|
||||||
|
|
||||||
|
|
||||||
def vendor_string():
|
def vendor_string():
|
||||||
|
Loading…
Reference in New Issue
Block a user