Log translation hint for Heat.engine (part1)
Currently, Log translation is motivated by oslo's move to prioritized translation of strings, as documented at https://wiki.openstack.org/wiki/LoggingStandards#Log_Translation - add log translation hints for warning, error and info levels - move from LOG.warning to LOG.warn - remove use of % as a string formatter, use the log functionality instead Partial implements blueprint log-translation-hints Change-Id: Ie2f5f7b1b3ce0e6868f0c9c513adf5e870481492
This commit is contained in:
parent
d971917560
commit
4331ec278b
|
@ -14,6 +14,7 @@
|
|||
from oslo.utils import timeutils
|
||||
|
||||
from heat.common.i18n import _
|
||||
from heat.common.i18n import _LE
|
||||
from heat.common import param_utils
|
||||
from heat.common import template_format
|
||||
from heat.engine import constraints as constr
|
||||
|
@ -263,7 +264,7 @@ def format_watch_data(wd):
|
|||
if len(metric) == 1:
|
||||
metric_name, metric_data = metric[0]
|
||||
else:
|
||||
LOG.error(_("Unexpected number of keys in watch_data.data!"))
|
||||
LOG.error(_LE("Unexpected number of keys in watch_data.data!"))
|
||||
return
|
||||
|
||||
result = {
|
||||
|
|
|
@ -16,7 +16,7 @@ from oslo.utils import importutils
|
|||
from stevedore import extension
|
||||
import warnings
|
||||
|
||||
from heat.common.i18n import _
|
||||
from heat.common.i18n import _LW
|
||||
from heat.openstack.common import log as logging
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
@ -65,7 +65,7 @@ class OpenStackClients(object):
|
|||
client = getattr(self, method_name)()
|
||||
self._clients[name] = client
|
||||
return client
|
||||
LOG.warn(_('Requested client "%s" not found') % name)
|
||||
LOG.warn(_LW('Requested client "%s" not found'), name)
|
||||
|
||||
@property
|
||||
def auth_token(self):
|
||||
|
|
|
@ -17,8 +17,9 @@ from cinderclient import client as cc
|
|||
from cinderclient import exceptions
|
||||
|
||||
from heat.common import exception
|
||||
from heat.common.i18n import _
|
||||
from heat.common.i18n import _LI
|
||||
from heat.engine import clients
|
||||
from heat.openstack.common.gettextutils import _
|
||||
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
@ -56,7 +57,7 @@ class CinderClientPlugin(clients.client_plugin.ClientPlugin):
|
|||
client_version = '2'
|
||||
else:
|
||||
raise exception.Error(_('No volume service available.'))
|
||||
LOG.info(_('Creating Cinder client with volume API version %d.'),
|
||||
LOG.info(_LI('Creating Cinder client with volume API version %d.'),
|
||||
volume_api_version)
|
||||
|
||||
endpoint_type = self._get_client_option('cinder', 'endpoint_type')
|
||||
|
|
|
@ -16,6 +16,7 @@ from glanceclient import exc
|
|||
|
||||
from heat.common import exception
|
||||
from heat.common.i18n import _
|
||||
from heat.common.i18n import _LI
|
||||
from heat.engine.clients import client_plugin
|
||||
from heat.engine import constraints
|
||||
from heat.openstack.common import log as logging
|
||||
|
@ -92,11 +93,11 @@ class GlanceClientPlugin(client_plugin.ClientPlugin):
|
|||
_("Error retrieving image list from glance: %s") % ex)
|
||||
num_matches = len(image_list)
|
||||
if num_matches == 0:
|
||||
LOG.info(_("Image %s was not found in glance") %
|
||||
LOG.info(_LI("Image %s was not found in glance"),
|
||||
image_identifier)
|
||||
raise exception.ImageNotFound(image_name=image_identifier)
|
||||
elif num_matches > 1:
|
||||
LOG.info(_("Multiple images %s were found in glance with name") %
|
||||
LOG.info(_LI("Multiple images %s were found in glance with name"),
|
||||
image_identifier)
|
||||
raise exception.PhysicalResourceNameAmbiguity(
|
||||
name=image_identifier)
|
||||
|
|
|
@ -29,6 +29,7 @@ from six.moves.urllib import parse as urlparse
|
|||
|
||||
from heat.common import exception
|
||||
from heat.common.i18n import _
|
||||
from heat.common.i18n import _LW
|
||||
from heat.engine.clients import client_plugin
|
||||
from heat.engine import scheduler
|
||||
|
||||
|
@ -104,19 +105,20 @@ class NovaClientPlugin(client_plugin.ClientPlugin):
|
|||
try:
|
||||
server.get()
|
||||
except exceptions.OverLimit as exc:
|
||||
msg = _("Server %(name)s (%(id)s) received an OverLimit "
|
||||
"response during server.get(): %(exception)s")
|
||||
LOG.warning(msg % {'name': server.name,
|
||||
'id': server.id,
|
||||
'exception': exc})
|
||||
LOG.warn(_LW("Server %(name)s (%(id)s) received an OverLimit "
|
||||
"response during server.get(): %(exception)s"),
|
||||
{'name': server.name,
|
||||
'id': server.id,
|
||||
'exception': exc})
|
||||
except exceptions.ClientException as exc:
|
||||
if ((getattr(exc, 'http_status', getattr(exc, 'code', None)) in
|
||||
(500, 503))):
|
||||
msg = _('Server "%(name)s" (%(id)s) received the following '
|
||||
'exception during server.get(): %(exception)s')
|
||||
LOG.warning(msg % {'name': server.name,
|
||||
'id': server.id,
|
||||
'exception': exc})
|
||||
LOG.warn(_LW('Server "%(name)s" (%(id)s) received the '
|
||||
'following exception during server.get(): '
|
||||
'%(exception)s'),
|
||||
{'name': server.name,
|
||||
'id': server.id,
|
||||
'exception': exc})
|
||||
else:
|
||||
raise
|
||||
|
||||
|
@ -396,8 +398,8 @@ echo -e '%s\tALL=(ALL)\tNOPASSWD: ALL' >> /etc/sudoers
|
|||
try:
|
||||
server = self.client().servers.get(server)
|
||||
except exceptions.NotFound as ex:
|
||||
LOG.warn(_('Instance (%(server)s) not found: %(ex)s')
|
||||
% {'server': server, 'ex': ex})
|
||||
LOG.warn(_LW('Instance (%(server)s) not found: %(ex)s'),
|
||||
{'server': server, 'ex': ex})
|
||||
else:
|
||||
for n in server.networks:
|
||||
if len(server.networks[n]) > 0:
|
||||
|
|
|
@ -23,6 +23,9 @@ import six
|
|||
from heat.common import environment_format as env_fmt
|
||||
from heat.common import exception
|
||||
from heat.common.i18n import _
|
||||
from heat.common.i18n import _LE
|
||||
from heat.common.i18n import _LI
|
||||
from heat.common.i18n import _LW
|
||||
from heat.engine import support
|
||||
from heat.openstack.common import log
|
||||
|
||||
|
@ -193,13 +196,13 @@ class ResourceRegistry(object):
|
|||
for res_name in registry.keys():
|
||||
if isinstance(registry[res_name], ResourceInfo) and \
|
||||
res_name.startswith(name[:-1]):
|
||||
LOG.warn(_('Removing %(item)s from %(path)s') % {
|
||||
LOG.warn(_LW('Removing %(item)s from %(path)s'), {
|
||||
'item': res_name,
|
||||
'path': descriptive_path})
|
||||
del registry[res_name]
|
||||
else:
|
||||
# delete this entry.
|
||||
LOG.warn(_('Removing %(item)s from %(path)s') % {
|
||||
LOG.warn(_LW('Removing %(item)s from %(path)s'), {
|
||||
'item': name,
|
||||
'path': descriptive_path})
|
||||
registry.pop(name, None)
|
||||
|
@ -212,9 +215,10 @@ class ResourceRegistry(object):
|
|||
'path': descriptive_path,
|
||||
'was': str(registry[name].value),
|
||||
'now': str(info.value)}
|
||||
LOG.warn(_('Changing %(path)s from %(was)s to %(now)s') % details)
|
||||
LOG.warn(_LW('Changing %(path)s from %(was)s to %(now)s'),
|
||||
details)
|
||||
else:
|
||||
LOG.info(_('Registering %(path)s -> %(value)s') % {
|
||||
LOG.info(_LI('Registering %(path)s -> %(value)s'), {
|
||||
'path': descriptive_path,
|
||||
'value': str(info.value)})
|
||||
|
||||
|
@ -429,22 +433,22 @@ def read_global_environment(env, env_dir=None):
|
|||
try:
|
||||
env_files = glob.glob(os.path.join(env_dir, '*'))
|
||||
except OSError as osex:
|
||||
LOG.error(_('Failed to read %s') % env_dir)
|
||||
LOG.error(_LE('Failed to read %s'), env_dir)
|
||||
LOG.exception(osex)
|
||||
return
|
||||
|
||||
for file_path in env_files:
|
||||
try:
|
||||
with open(file_path) as env_fd:
|
||||
LOG.info(_('Loading %s') % file_path)
|
||||
LOG.info(_LI('Loading %s'), file_path)
|
||||
env_body = env_fmt.parse(env_fd.read())
|
||||
env_fmt.default_for_missing(env_body)
|
||||
env.load(env_body)
|
||||
except ValueError as vex:
|
||||
LOG.error(_('Failed to parse %(file_path)s') % {
|
||||
LOG.error(_LE('Failed to parse %(file_path)s'), {
|
||||
'file_path': file_path})
|
||||
LOG.exception(vex)
|
||||
except IOError as ioex:
|
||||
LOG.error(_('Failed to read %(file_path)s') % {
|
||||
LOG.error(_LE('Failed to read %(file_path)s'), {
|
||||
'file_path': file_path})
|
||||
LOG.exception(ioex)
|
||||
|
|
|
@ -17,9 +17,6 @@ from heat.common import exception
|
|||
from heat.common.i18n import _
|
||||
from heat.common import identifier
|
||||
from heat.db import api as db_api
|
||||
from heat.openstack.common import log as logging
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class Event(object):
|
||||
|
|
|
@ -14,9 +14,7 @@
|
|||
from oslo.config import cfg
|
||||
|
||||
from heat.common import messaging
|
||||
from heat.openstack.common import log
|
||||
|
||||
LOG = log.getLogger(__name__)
|
||||
SERVICE = 'orchestration'
|
||||
INFO = 'INFO'
|
||||
ERROR = 'ERROR'
|
||||
|
|
|
@ -19,7 +19,7 @@ import sys
|
|||
from oslo.config import cfg
|
||||
import six
|
||||
|
||||
from heat.common.i18n import _
|
||||
from heat.common.i18n import _LE
|
||||
from heat.common import plugin_loader
|
||||
from heat.openstack.common import log
|
||||
|
||||
|
@ -95,15 +95,15 @@ class PluginMapping(object):
|
|||
try:
|
||||
mapping_dict = mapping_func(*self.args, **self.kwargs)
|
||||
except Exception:
|
||||
LOG.error(_('Failed to load %(mapping_name)s '
|
||||
'from %(module)s') % fmt_data)
|
||||
LOG.error(_LE('Failed to load %(mapping_name)s '
|
||||
'from %(module)s'), fmt_data)
|
||||
raise
|
||||
else:
|
||||
if isinstance(mapping_dict, collections.Mapping):
|
||||
return mapping_dict
|
||||
elif mapping_dict is not None:
|
||||
LOG.error(_('Invalid type for %(mapping_name)s '
|
||||
'from %(module)s') % fmt_data)
|
||||
LOG.error(_LE('Invalid type for %(mapping_name)s '
|
||||
'from %(module)s'), fmt_data)
|
||||
|
||||
return {}
|
||||
|
||||
|
|
|
@ -21,6 +21,9 @@ import warnings
|
|||
|
||||
from heat.common import exception
|
||||
from heat.common.i18n import _
|
||||
from heat.common.i18n import _LE
|
||||
from heat.common.i18n import _LI
|
||||
from heat.common.i18n import _LW
|
||||
from heat.common import identifier
|
||||
from heat.common import short_id
|
||||
from heat.common import timeutils
|
||||
|
@ -528,7 +531,7 @@ class Resource(object):
|
|||
% str(self.state))
|
||||
raise exception.ResourceFailure(exc, self, action)
|
||||
|
||||
LOG.info(_('creating %s') % str(self))
|
||||
LOG.info(_LI('creating %s'), str(self))
|
||||
|
||||
# Re-resolve the template, since if the resource Ref's
|
||||
# the StackId pseudo parameter, it will change after
|
||||
|
@ -677,7 +680,7 @@ class Resource(object):
|
|||
exc = Exception(_('Resource update already requested'))
|
||||
raise exception.ResourceFailure(exc, self, action)
|
||||
|
||||
LOG.info(_('updating %s') % str(self))
|
||||
LOG.info(_LI('updating %s'), six.text_type(self))
|
||||
|
||||
self.updated_time = datetime.utcnow()
|
||||
with self._action_recorder(action, UpdateReplace):
|
||||
|
@ -702,7 +705,7 @@ class Resource(object):
|
|||
original state with the added message that check was not performed.
|
||||
"""
|
||||
action = self.CHECK
|
||||
LOG.info(_('Checking %s') % six.text_type(self))
|
||||
LOG.info(_LI('Checking %s'), six.text_type(self))
|
||||
|
||||
if hasattr(self, 'handle_%s' % action.lower()):
|
||||
return self._do_action(action)
|
||||
|
@ -723,7 +726,7 @@ class Resource(object):
|
|||
% str(self.state))
|
||||
raise exception.ResourceFailure(exc, self, action)
|
||||
|
||||
LOG.info(_('suspending %s') % str(self))
|
||||
LOG.info(_LI('suspending %s'), six.text_type(self))
|
||||
return self._do_action(action)
|
||||
|
||||
def resume(self):
|
||||
|
@ -739,12 +742,12 @@ class Resource(object):
|
|||
% str(self.state))
|
||||
raise exception.ResourceFailure(exc, self, action)
|
||||
|
||||
LOG.info(_('resuming %s') % str(self))
|
||||
LOG.info(_LI('resuming %s'), six.text_type(self))
|
||||
return self._do_action(action)
|
||||
|
||||
def snapshot(self):
|
||||
'''Snapshot the resource and return the created data, if any.'''
|
||||
LOG.info(_('snapshotting %s') % str(self))
|
||||
LOG.info(_LI('snapshotting %s'), six.text_type(self))
|
||||
return self._do_action(self.SNAPSHOT)
|
||||
|
||||
@scheduler.wrappertask
|
||||
|
@ -790,7 +793,7 @@ class Resource(object):
|
|||
return name[0:2] + '-' + name[-postfix_length:]
|
||||
|
||||
def validate(self):
|
||||
LOG.info(_('Validating %s') % str(self))
|
||||
LOG.info(_LI('Validating %s'), six.text_type(self))
|
||||
|
||||
function.validate(self.t)
|
||||
self.validate_deletion_policy(self.t.deletion_policy())
|
||||
|
@ -823,7 +826,7 @@ class Resource(object):
|
|||
|
||||
initial_state = self.state
|
||||
|
||||
LOG.info(_('deleting %s') % str(self))
|
||||
LOG.info(_LI('deleting %s'), six.text_type(self))
|
||||
|
||||
with self._action_recorder(action):
|
||||
if self.abandon_in_progress:
|
||||
|
@ -864,7 +867,7 @@ class Resource(object):
|
|||
rs = db_api.resource_get(self.context, self.id)
|
||||
rs.update_and_save({'nova_instance': self.resource_id})
|
||||
except Exception as ex:
|
||||
LOG.warn(_('db error %s') % ex)
|
||||
LOG.warn(_LW('db error %s'), ex)
|
||||
|
||||
def _store(self):
|
||||
'''Create the resource in the database.'''
|
||||
|
@ -885,7 +888,7 @@ class Resource(object):
|
|||
self.created_time = new_rs.created_at
|
||||
self._rsrc_metadata = metadata
|
||||
except Exception as ex:
|
||||
LOG.error(_('DB error %s') % ex)
|
||||
LOG.error(_LE('DB error %s'), ex)
|
||||
|
||||
def _add_event(self, action, status, reason):
|
||||
'''Add a state change event to the database.'''
|
||||
|
@ -912,7 +915,7 @@ class Resource(object):
|
|||
'properties_data': self._stored_properties_data,
|
||||
'nova_instance': self.resource_id})
|
||||
except Exception as ex:
|
||||
LOG.error(_('DB error %s') % ex)
|
||||
LOG.error(_LE('DB error %s'), ex)
|
||||
|
||||
# store resource in DB on transition to CREATE_IN_PROGRESS
|
||||
# all other transitions (other than to DELETE_COMPLETE)
|
||||
|
@ -1050,8 +1053,8 @@ class Resource(object):
|
|||
No-op for resources which don't explicitly override this method
|
||||
'''
|
||||
if new_metadata:
|
||||
LOG.warning(_("Resource %s does not implement metadata update")
|
||||
% self.name)
|
||||
LOG.warn(_LW("Resource %s does not implement metadata update"),
|
||||
self.name)
|
||||
|
||||
@classmethod
|
||||
def resource_to_template(cls, resource_type):
|
||||
|
|
|
@ -20,6 +20,7 @@ import six
|
|||
from heat.common import environment_format
|
||||
from heat.common import exception
|
||||
from heat.common.i18n import _
|
||||
from heat.common.i18n import _LI
|
||||
from heat.common import timeutils as iso8601utils
|
||||
from heat.engine import attributes
|
||||
from heat.engine import constraints
|
||||
|
@ -617,10 +618,10 @@ class AutoScalingGroup(InstanceGroup, cooldown.CooldownMixin):
|
|||
Adjust the size of the scaling group if the cooldown permits.
|
||||
"""
|
||||
if self._cooldown_inprogress():
|
||||
LOG.info(_("%(name)s NOT performing scaling adjustment, "
|
||||
"cooldown %(cooldown)s")
|
||||
% {'name': self.name,
|
||||
'cooldown': self.properties[self.COOLDOWN]})
|
||||
LOG.info(_LI("%(name)s NOT performing scaling adjustment, "
|
||||
"cooldown %(cooldown)s"),
|
||||
{'name': self.name,
|
||||
'cooldown': self.properties[self.COOLDOWN]})
|
||||
return
|
||||
|
||||
capacity = len(self.get_instances())
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
|
||||
from heat.common import exception
|
||||
from heat.common.i18n import _
|
||||
from heat.common.i18n import _LI
|
||||
|
||||
from heat.engine import attributes
|
||||
from heat.engine import constraints
|
||||
|
@ -114,16 +115,16 @@ class AWSScalingPolicy(signal_responder.SignalResponder,
|
|||
alarm_state = details.get('current',
|
||||
details.get('state', 'alarm')).lower()
|
||||
|
||||
LOG.info(_('%(name)s Alarm, new state %(state)s')
|
||||
% {'name': self.name, 'state': alarm_state})
|
||||
LOG.info(_LI('%(name)s Alarm, new state %(state)s'),
|
||||
{'name': self.name, 'state': alarm_state})
|
||||
|
||||
if alarm_state != 'alarm':
|
||||
return
|
||||
if self._cooldown_inprogress():
|
||||
LOG.info(_("%(name)s NOT performing scaling action, "
|
||||
"cooldown %(cooldown)s")
|
||||
% {'name': self.name,
|
||||
'cooldown': self.properties[self.COOLDOWN]})
|
||||
LOG.info(_LI("%(name)s NOT performing scaling action, "
|
||||
"cooldown %(cooldown)s"),
|
||||
{'name': self.name,
|
||||
'cooldown': self.properties[self.COOLDOWN]})
|
||||
return
|
||||
|
||||
asgn_id = self.properties[self.AUTO_SCALING_GROUP_NAME]
|
||||
|
@ -134,10 +135,10 @@ class AWSScalingPolicy(signal_responder.SignalResponder,
|
|||
'alarm': self.name,
|
||||
'group': asgn_id})
|
||||
|
||||
LOG.info(_('%(name)s Alarm, adjusting Group %(group)s with id '
|
||||
'%(asgn_id)s by %(filter)s')
|
||||
% {'name': self.name, 'group': group.name, 'asgn_id': asgn_id,
|
||||
'filter': self.properties[self.SCALING_ADJUSTMENT]})
|
||||
LOG.info(_LI('%(name)s Alarm, adjusting Group %(group)s with id '
|
||||
'%(asgn_id)s by %(filter)s'),
|
||||
{'name': self.name, 'group': group.name, 'asgn_id': asgn_id,
|
||||
'filter': self.properties[self.SCALING_ADJUSTMENT]})
|
||||
adjustment_type = self._get_adjustement_type()
|
||||
group.adjust(self.properties[self.SCALING_ADJUSTMENT], adjustment_type)
|
||||
|
||||
|
|
|
@ -15,6 +15,9 @@ from oslo.utils import excutils
|
|||
|
||||
from heat.common import exception
|
||||
from heat.common.i18n import _
|
||||
from heat.common.i18n import _LE
|
||||
from heat.common.i18n import _LI
|
||||
from heat.common.i18n import _LW
|
||||
from heat.engine import attributes
|
||||
from heat.engine import constraints
|
||||
from heat.engine import properties
|
||||
|
@ -96,21 +99,21 @@ class ElasticIp(resource.Resource):
|
|||
'floatingip': props})['floatingip']
|
||||
self.ipaddress = ips['floating_ip_address']
|
||||
self.resource_id_set(ips['id'])
|
||||
LOG.info(_('ElasticIp create %s') % str(ips))
|
||||
LOG.info(_LI('ElasticIp create %s'), str(ips))
|
||||
else:
|
||||
try:
|
||||
ips = self.nova().floating_ips.create()
|
||||
except Exception as e:
|
||||
with excutils.save_and_reraise_exception():
|
||||
if self.client_plugin('nova').is_not_found(e):
|
||||
msg = _("No default floating IP pool configured. "
|
||||
"Set 'default_floating_pool' in nova.conf.")
|
||||
LOG.error(msg)
|
||||
LOG.error(_LE("No default floating IP pool configured."
|
||||
" Set 'default_floating_pool' in "
|
||||
"nova.conf."))
|
||||
|
||||
if ips:
|
||||
self.ipaddress = ips.ip
|
||||
self.resource_id_set(ips.id)
|
||||
LOG.info(_('ElasticIp create %s') % str(ips))
|
||||
LOG.info(_LI('ElasticIp create %s'), str(ips))
|
||||
|
||||
instance_id = self.properties[self.INSTANCE_ID]
|
||||
if instance_id:
|
||||
|
@ -316,7 +319,7 @@ class ElasticIpAssociation(resource.Resource):
|
|||
self._floatingIp_detach(nova_ignore_not_found=True)
|
||||
port_id, port_rsrc = self._get_port_info(ni_id, instance_id)
|
||||
if not port_id or not port_rsrc:
|
||||
LOG.error(_('Port not specified.'))
|
||||
LOG.error(_LE('Port not specified.'))
|
||||
raise exception.NotFound(_('Failed to update, can not found '
|
||||
'port info.'))
|
||||
|
||||
|
@ -339,7 +342,7 @@ class ElasticIpAssociation(resource.Resource):
|
|||
port_id, port_rsrc = self._get_port_info(ni_id_update,
|
||||
instance_id_update)
|
||||
if not port_id or not port_rsrc:
|
||||
LOG.error(_('Port not specified.'))
|
||||
LOG.error(_LE('Port not specified.'))
|
||||
raise exception.NotFound(_('Failed to update, can not found '
|
||||
'port info.'))
|
||||
|
||||
|
@ -383,7 +386,7 @@ class ElasticIpAssociation(resource.Resource):
|
|||
instance_id = self.properties[self.INSTANCE_ID]
|
||||
port_id, port_rsrc = self._get_port_info(ni_id, instance_id)
|
||||
if not port_id or not port_rsrc:
|
||||
LOG.warn(_('Skipping association, resource not specified'))
|
||||
LOG.warn(_LW('Skipping association, resource not specified'))
|
||||
return
|
||||
|
||||
float_id = self.properties[self.ALLOCATION_ID]
|
||||
|
|
|
@ -18,6 +18,7 @@ import six
|
|||
|
||||
from heat.common import exception
|
||||
from heat.common.i18n import _
|
||||
from heat.common.i18n import _LI
|
||||
from heat.engine import attributes
|
||||
from heat.engine import constraints
|
||||
from heat.engine import properties
|
||||
|
@ -83,21 +84,22 @@ class Restarter(signal_responder.SignalResponder):
|
|||
else:
|
||||
alarm_state = details.get('state', 'alarm').lower()
|
||||
|
||||
LOG.info(_('%(name)s Alarm, new state %(state)s')
|
||||
% {'name': self.name, 'state': alarm_state})
|
||||
LOG.info(_LI('%(name)s Alarm, new state %(state)s'),
|
||||
{'name': self.name, 'state': alarm_state})
|
||||
|
||||
if alarm_state != 'alarm':
|
||||
return
|
||||
|
||||
victim = self._find_resource(self.properties[self.INSTANCE_ID])
|
||||
if victim is None:
|
||||
LOG.info(_('%(name)s Alarm, can not find instance %(instance)s')
|
||||
% {'name': self.name,
|
||||
'instance': self.properties[self.INSTANCE_ID]})
|
||||
LOG.info(_LI('%(name)s Alarm, can not find instance '
|
||||
'%(instance)s'),
|
||||
{'name': self.name,
|
||||
'instance': self.properties[self.INSTANCE_ID]})
|
||||
return
|
||||
|
||||
LOG.info(_('%(name)s Alarm, restarting resource: %(victim)s')
|
||||
% {'name': self.name, 'victim': victim.name})
|
||||
LOG.info(_LI('%(name)s Alarm, restarting resource: %(victim)s'),
|
||||
{'name': self.name, 'victim': victim.name})
|
||||
self.stack.restart_resource(victim.name)
|
||||
|
||||
def _resolve_attribute(self, name):
|
||||
|
@ -457,7 +459,7 @@ class Instance(resource.Resource):
|
|||
elif name in self.ATTRIBUTES[1:]:
|
||||
res = self._ipaddress()
|
||||
|
||||
LOG.info(_('%(name)s._resolve_attribute(%(attname)s) == %(res)s'),
|
||||
LOG.info(_LI('%(name)s._resolve_attribute(%(attname)s) == %(res)s'),
|
||||
{'name': self.name, 'attname': name, 'res': res})
|
||||
return unicode(res) if res else None
|
||||
|
||||
|
|
Loading…
Reference in New Issue