Remove translation of log messages

The i18n team has decided not to translate the logs because it
seems like it not very useful; operators prefer to have them in
English so that they can search for those strings on the internet.

Change-Id: Ifcb4c4331440d94322a56a1e3bed04cff453cbad
Related-Bug: #1674374
This commit is contained in:
Ngo Quoc Cuong 2017-06-27 23:06:38 -04:00
parent bfa752be23
commit 722459abb3
11 changed files with 80 additions and 115 deletions

View File

@ -27,7 +27,6 @@ import six
from ironic_staging_drivers.common import exception from ironic_staging_drivers.common import exception
from ironic_staging_drivers.common.i18n import _ from ironic_staging_drivers.common.i18n import _
from ironic_staging_drivers.common.i18n import _LE
pywsman = importutils.try_import('pywsman') pywsman = importutils.try_import('pywsman')
@ -119,8 +118,8 @@ class Client(object):
item = 'Fault' item = 'Fault'
fault = xml_find(doc, _SOAP_ENVELOPE, item) fault = xml_find(doc, _SOAP_ENVELOPE, item)
if fault is not None: if fault is not None:
LOG.error(_LE('Call to AMT with URI %(uri)s failed: ' LOG.error('Call to AMT with URI %(uri)s failed: '
'got Fault %(fault)s'), 'got Fault %(fault)s',
{'uri': resource_uri, 'fault': fault.text}) {'uri': resource_uri, 'fault': fault.text})
raise exception.AMTFailure(cmd='wsman_get') raise exception.AMTFailure(cmd='wsman_get')
return doc return doc
@ -143,9 +142,9 @@ class Client(object):
item = "ReturnValue" item = "ReturnValue"
return_value = xml_find(doc, resource_uri, item).text return_value = xml_find(doc, resource_uri, item).text
if return_value != RET_SUCCESS: if return_value != RET_SUCCESS:
LOG.error(_LE("Call to AMT with URI %(uri)s and " LOG.error("Call to AMT with URI %(uri)s and "
"method %(method)s failed: return value " "method %(method)s failed: return value "
"was %(value)s"), "was %(value)s",
{'uri': resource_uri, 'method': method, {'uri': resource_uri, 'method': method,
'value': return_value}) 'value': return_value})
raise exception.AMTFailure(cmd='wsman_invoke') raise exception.AMTFailure(cmd='wsman_invoke')
@ -246,8 +245,8 @@ def awake_amt_interface(node):
try: try:
ironic_utils.execute(*cmd_args) ironic_utils.execute(*cmd_args)
except processutils.ProcessExecutionError as err: except processutils.ProcessExecutionError as err:
LOG.error(_LE('Unable to awake AMT interface on node ' LOG.error('Unable to awake AMT interface on node '
'%(node_id)s. Error: %(error)s'), '%(node_id)s. Error: %(error)s',
{'node_id': node.uuid, 'error': err}) {'node_id': node.uuid, 'error': err})
raise exception.AMTConnectFailure() raise exception.AMTConnectFailure()
else: else:

View File

@ -27,8 +27,6 @@ from ironic_staging_drivers.amt import common as amt_common
from ironic_staging_drivers.amt import resource_uris from ironic_staging_drivers.amt import resource_uris
from ironic_staging_drivers.common import exception from ironic_staging_drivers.common import exception
from ironic_staging_drivers.common.i18n import _ from ironic_staging_drivers.common.i18n import _
from ironic_staging_drivers.common.i18n import _LE
from ironic_staging_drivers.common.i18n import _LI
pywsman = importutils.try_import('pywsman') pywsman = importutils.try_import('pywsman')
@ -88,13 +86,13 @@ def _set_boot_device_order(node, boot_device):
method, doc) method, doc)
except (exception.AMTFailure, exception.AMTConnectFailure) as e: except (exception.AMTFailure, exception.AMTConnectFailure) as e:
with excutils.save_and_reraise_exception(): with excutils.save_and_reraise_exception():
LOG.exception(_LE("Failed to set boot device %(boot_device)s for " LOG.exception("Failed to set boot device %(boot_device)s for "
"node %(node_id)s with error: %(error)s."), "node %(node_id)s with error: %(error)s.",
{'boot_device': boot_device, 'node_id': node.uuid, {'boot_device': boot_device, 'node_id': node.uuid,
'error': e}) 'error': e})
else: else:
LOG.info(_LI("Successfully set boot device %(boot_device)s for " LOG.info("Successfully set boot device %(boot_device)s for "
"node %(node_id)s"), "node %(node_id)s",
{'boot_device': boot_device, 'node_id': node.uuid}) {'boot_device': boot_device, 'node_id': node.uuid})
@ -142,11 +140,11 @@ def _enable_boot_config(node):
method, doc) method, doc)
except (exception.AMTFailure, exception.AMTConnectFailure) as e: except (exception.AMTFailure, exception.AMTConnectFailure) as e:
with excutils.save_and_reraise_exception(): with excutils.save_and_reraise_exception():
LOG.exception(_LE("Failed to enable boot config for node " LOG.exception("Failed to enable boot config for node "
"%(node_id)s with error: %(error)s."), "%(node_id)s with error: %(error)s.",
{'node_id': node.uuid, 'error': e}) {'node_id': node.uuid, 'error': e})
else: else:
LOG.info(_LI("Successfully enabled boot config for node %(node_id)s."), LOG.info("Successfully enabled boot config for node %(node_id)s.",
{'node_id': node.uuid}) {'node_id': node.uuid})

View File

@ -30,9 +30,6 @@ from ironic_staging_drivers.amt import common as amt_common
from ironic_staging_drivers.amt import resource_uris from ironic_staging_drivers.amt import resource_uris
from ironic_staging_drivers.common import exception from ironic_staging_drivers.common import exception
from ironic_staging_drivers.common.i18n import _ from ironic_staging_drivers.common.i18n import _
from ironic_staging_drivers.common.i18n import _LE
from ironic_staging_drivers.common.i18n import _LI
from ironic_staging_drivers.common.i18n import _LW
pywsman = importutils.try_import('pywsman') pywsman = importutils.try_import('pywsman')
@ -111,12 +108,12 @@ def _set_power_state(node, target_state):
method, doc) method, doc)
except (exception.AMTFailure, exception.AMTConnectFailure) as e: except (exception.AMTFailure, exception.AMTConnectFailure) as e:
with excutils.save_and_reraise_exception(): with excutils.save_and_reraise_exception():
LOG.exception(_LE("Failed to set power state %(state)s for " LOG.exception("Failed to set power state %(state)s for "
"node %(node_id)s with error: %(error)s."), "node %(node_id)s with error: %(error)s.",
{'state': target_state, 'node_id': node.uuid, {'state': target_state, 'node_id': node.uuid,
'error': e}) 'error': e})
else: else:
LOG.info(_LI("Power state set to %(state)s for node %(node_id)s"), LOG.info("Power state set to %(state)s for node %(node_id)s",
{'state': target_state, 'node_id': node.uuid}) {'state': target_state, 'node_id': node.uuid})
@ -135,8 +132,8 @@ def _power_status(node):
doc = client.wsman_get(namespace) doc = client.wsman_get(namespace)
except (exception.AMTFailure, exception.AMTConnectFailure) as e: except (exception.AMTFailure, exception.AMTConnectFailure) as e:
with excutils.save_and_reraise_exception(): with excutils.save_and_reraise_exception():
LOG.exception(_LE("Failed to get power state for node %(node_id)s " LOG.exception("Failed to get power state for node %(node_id)s "
"with error: %(error)s."), "with error: %(error)s.",
{'node_id': node.uuid, 'error': e}) {'node_id': node.uuid, 'error': e})
item = "PowerState" item = "PowerState"
@ -178,8 +175,8 @@ def _set_and_wait(task, target_state):
if status['iter'] >= CONF.amt_driver.max_attempts: if status['iter'] >= CONF.amt_driver.max_attempts:
status['power'] = states.ERROR status['power'] = states.ERROR
LOG.warning(_LW("AMT failed to set power state %(state)s after " LOG.warning("AMT failed to set power state %(state)s after "
"%(tries)s retries on node %(node_id)s."), "%(tries)s retries on node %(node_id)s.",
{'state': target_state, 'tries': status['iter'], {'state': target_state, 'tries': status['iter'],
'node_id': node.uuid}) 'node_id': node.uuid})
raise loopingcall.LoopingCallDone() raise loopingcall.LoopingCallDone()
@ -188,9 +185,9 @@ def _set_and_wait(task, target_state):
_set_power_state(node, target_state) _set_power_state(node, target_state)
except Exception: except Exception:
# Log failures but keep trying # Log failures but keep trying
LOG.warning(_LW("AMT set power state %(state)s for node %(node)s " LOG.warning("AMT set power state %(state)s for node %(node)s "
"- Attempt %(attempt)s times of %(max_attempt)s " "- Attempt %(attempt)s times of %(max_attempt)s "
"failed."), "failed.",
{'state': target_state, 'node': node.uuid, {'state': target_state, 'node': node.uuid,
'attempt': status['iter'] + 1, 'attempt': status['iter'] + 1,
'max_attempt': CONF.amt_driver.max_attempts}) 'max_attempt': CONF.amt_driver.max_attempts})

View File

@ -34,9 +34,6 @@ import yaml
from ironic.common import dhcp_factory from ironic.common import dhcp_factory
from ironic.common import exception from ironic.common import exception
from ironic.common.i18n import _ from ironic.common.i18n import _
from ironic.common.i18n import _LE
from ironic.common.i18n import _LI
from ironic.common.i18n import _LW
from ironic.common import images from ironic.common import images
from ironic.common import states from ironic.common import states
from ironic.common import utils from ironic.common import utils
@ -555,8 +552,8 @@ class AnsibleDeploy(agent_base.HeartbeatMixin, base.DeployInterface):
_get_configdrive_path(task.node.uuid)) _get_configdrive_path(task.node.uuid))
def take_over(self, task): def take_over(self, task):
LOG.error(_LE("Ansible deploy does not support take over. " LOG.error("Ansible deploy does not support take over. "
"You must redeploy the node %s explicitly."), "You must redeploy the node %s explicitly.",
task.node.uuid) task.node.uuid)
def get_clean_steps(self, task): def get_clean_steps(self, task):
@ -602,13 +599,13 @@ class AnsibleDeploy(agent_base.HeartbeatMixin, base.DeployInterface):
_run_playbook(playbook, extra_vars, key, _run_playbook(playbook, extra_vars, key,
tags=step_tags) tags=step_tags)
except exception.InstanceDeployFailure as e: except exception.InstanceDeployFailure as e:
LOG.error(_LE("Ansible failed cleaning step %(step)s " LOG.error("Ansible failed cleaning step %(step)s "
"on node %(node)s."), { "on node %(node)s.",
'node': node.uuid, 'step': stepname}) {'node': node.uuid, 'step': stepname})
manager_utils.cleaning_error_handler(task, six.text_type(e)) manager_utils.cleaning_error_handler(task, six.text_type(e))
else: else:
LOG.info(_LI('Ansible completed cleaning step %(step)s ' LOG.info('Ansible completed cleaning step %(step)s '
'on node %(node)s.'), 'on node %(node)s.',
{'node': node.uuid, 'step': stepname}) {'node': node.uuid, 'step': stepname})
@METRICS.timer('AnsibleDeploy.prepare_cleaning') @METRICS.timer('AnsibleDeploy.prepare_cleaning')
@ -648,7 +645,7 @@ class AnsibleDeploy(agent_base.HeartbeatMixin, base.DeployInterface):
LOG.debug('Waiting ramdisk on node %s for cleaning', node.uuid) LOG.debug('Waiting ramdisk on node %s for cleaning', node.uuid)
_run_playbook(playbook, extra_vars, key, tags=['wait']) _run_playbook(playbook, extra_vars, key, tags=['wait'])
LOG.info(_LI('Node %s is ready for cleaning'), node.uuid) LOG.info('Node %s is ready for cleaning', node.uuid)
@METRICS.timer('AnsibleDeploy.tear_down_cleaning') @METRICS.timer('AnsibleDeploy.tear_down_cleaning')
def tear_down_cleaning(self, task): def tear_down_cleaning(self, task):
@ -682,7 +679,7 @@ class AnsibleDeploy(agent_base.HeartbeatMixin, base.DeployInterface):
@METRICS.timer('AnsibleDeploy.reboot_to_instance') @METRICS.timer('AnsibleDeploy.reboot_to_instance')
def reboot_to_instance(self, task): def reboot_to_instance(self, task):
node = task.node node = task.node
LOG.info(_LI('Ansible complete deploy on node %s'), node.uuid) LOG.info('Ansible complete deploy on node %s', node.uuid)
LOG.debug('Rebooting node %s to instance', node.uuid) LOG.debug('Rebooting node %s to instance', node.uuid)
manager_utils.node_set_boot_device(task, 'disk', persistent=True) manager_utils.node_set_boot_device(task, 'disk', persistent=True)
@ -716,13 +713,12 @@ class AnsibleDeploy(agent_base.HeartbeatMixin, base.DeployInterface):
_run_playbook(playbook, extra_vars, key) _run_playbook(playbook, extra_vars, key)
_wait_until_powered_off(task) _wait_until_powered_off(task)
except Exception as e: except Exception as e:
LOG.warning( LOG.warning('Failed to soft power off node %(node_uuid)s '
_LW('Failed to soft power off node %(node_uuid)s ' 'in at least %(timeout)d seconds. '
'in at least %(timeout)d seconds. ' 'Error: %(error)s',
'Error: %(error)s'), {'node_uuid': node.uuid,
{'node_uuid': node.uuid, 'timeout': (wait * (attempts - 1)) / 1000,
'timeout': (wait * (attempts - 1)) / 1000, 'error': e})
'error': e})
# NOTE(pas-ha) flush is a part of deploy playbook # NOTE(pas-ha) flush is a part of deploy playbook
# so if it finished successfully we can safely # so if it finished successfully we can safely
# power off the node out-of-band # power off the node out-of-band
@ -739,4 +735,4 @@ class AnsibleDeploy(agent_base.HeartbeatMixin, base.DeployInterface):
agent_base.log_and_raise_deployment_error(task, msg) agent_base.log_and_raise_deployment_error(task, msg)
task.process_event('done') task.process_event('done')
LOG.info(_LI('Deployment to node %s done'), task.node.uuid) LOG.info('Deployment to node %s done', task.node.uuid)

View File

@ -18,7 +18,6 @@ from oslo_config import cfg
from oslo_log import log as logging from oslo_log import log as logging
import pbr.version import pbr.version
from ironic_staging_drivers.common import i18n
CONF = cfg.CONF CONF = cfg.CONF
DOMAIN = 'ironic' DOMAIN = 'ironic'
@ -83,26 +82,21 @@ class CallbackModule(object):
dict(name=name, node=node)) dict(name=name, node=node))
def v2_runner_on_failed(self, result, *args, **kwargs): def v2_runner_on_failed(self, result, *args, **kwargs):
LOG.error(i18n._LE( LOG.error("Ansible task %(name)s failed on node %(node)s: %(res)s",
"Ansible task %(name)s failed on node %(node)s: %(res)s"), self.runner_msg_dict(result))
self.runner_msg_dict(result))
def v2_runner_on_ok(self, result): def v2_runner_on_ok(self, result):
msg_dict = self.runner_msg_dict(result) msg_dict = self.runner_msg_dict(result)
if msg_dict['name'] == 'setup': if msg_dict['name'] == 'setup':
LOG.info(i18n._LI( LOG.info("Ansible task 'setup' complete on node %(node)s",
"Ansible task 'setup' complete on node %(node)s"), msg_dict)
msg_dict)
else: else:
LOG.info(i18n._LI( LOG.info("Ansible task %(name)s complete on node %(node)s: "
"Ansible task %(name)s complete on node %(node)s: %(res)s"), "%(res)s", msg_dict)
msg_dict)
def v2_runner_on_unreachable(self, result): def v2_runner_on_unreachable(self, result):
LOG.error(i18n._LE( LOG.error("Node %(node)s was unreachable for Ansible task %(name)s: "
"Node %(node)s was unreachable for Ansible task %(name)s: " "%(res)s", self.runner_msg_dict(result))
"%(res)s"),
self.runner_msg_dict(result))
def v2_runner_on_async_poll(self, result): def v2_runner_on_async_poll(self, result):
LOG.debug("Polled ansible task %(name)s for complete " LOG.debug("Polled ansible task %(name)s for complete "
@ -110,14 +104,12 @@ class CallbackModule(object):
self.runner_msg_dict(result)) self.runner_msg_dict(result))
def v2_runner_on_async_ok(self, result): def v2_runner_on_async_ok(self, result):
LOG.info(i18n._LI( LOG.info("Async Ansible task %(name)s complete on node %(node)s: "
"Async Ansible task %(name)s complete on node %(node)s: %(res)s"), "%(res)s", self.runner_msg_dict(result))
self.runner_msg_dict(result))
def v2_runner_on_async_failed(self, result): def v2_runner_on_async_failed(self, result):
LOG.error(i18n._LE( LOG.error("Async Ansible task %(name)s failed on node %(node)s: "
"Async Ansible task %(name)s failed on node %(node)s: %(res)s"), "%(res)s", self.runner_msg_dict(result))
self.runner_msg_dict(result))
def v2_runner_on_skipped(self, result): def v2_runner_on_skipped(self, result):
LOG.debug("Ansible task %(name)s skipped on node %(node)s: %(res)s", LOG.debug("Ansible task %(name)s skipped on node %(node)s: %(res)s",

View File

@ -19,8 +19,6 @@ try:
except ImportError: except ImportError:
HAS_PYUDEV = False HAS_PYUDEV = False
from ironic_staging_drivers.common.i18n import _LW
COLLECT_INFO = (('wwn', 'WWN'), ('serial', 'SERIAL_SHORT'), COLLECT_INFO = (('wwn', 'WWN'), ('serial', 'SERIAL_SHORT'),
('wwn_with_extension', 'WWN_WITH_EXTENSION'), ('wwn_with_extension', 'WWN_WITH_EXTENSION'),
@ -30,10 +28,10 @@ COLLECT_INFO = (('wwn', 'WWN'), ('serial', 'SERIAL_SHORT'),
def get_devices_wwn(devices): def get_devices_wwn(devices):
if not HAS_PYUDEV: if not HAS_PYUDEV:
LOG.warning(_LW('Can not collect "wwn", "wwn_with_extension", ' LOG.warning('Can not collect "wwn", "wwn_with_extension", '
'"wwn_vendor_extension" and "serial" when using ' '"wwn_vendor_extension" and "serial" when using '
'root device hints because there\'s no UDEV python ' 'root device hints because there\'s no UDEV python '
'binds installed')) 'binds installed')
return return
dev_dict = {} dev_dict = {}
@ -43,8 +41,8 @@ def get_devices_wwn(devices):
try: try:
udev = pyudev.Device.from_device_file(context, name) udev = pyudev.Device.from_device_file(context, name)
except (ValueError, EnvironmentError, pyudev.DeviceNotFoundError) as e: except (ValueError, EnvironmentError, pyudev.DeviceNotFoundError) as e:
LOG.warning(_LW('Device %(dev)s is inaccessible, skipping... ' LOG.warning('Device %(dev)s is inaccessible, skipping... '
'Error: %(error)s'), {'dev': name, 'error': e}) 'Error: %(error)s', {'dev': name, 'error': e})
continue continue
dev_dict[device] = {} dev_dict[device] = {}

View File

@ -19,13 +19,3 @@ _translators = i18n.TranslatorFactory(domain='ironic-staging-drivers')
# The primary translation function using the well-known name "_" # The primary translation function using the well-known name "_"
_ = _translators.primary _ = _translators.primary
# Translators for log levels.
#
# The abbreviated names are meant to reflect the usual use of a short
# name like '_'. The "L" is for "log" and the other letter comes from
# the level.
_LI = _translators.log_info
_LW = _translators.log_warning
_LE = _translators.log_error
_LC = _translators.log_critical

View File

@ -30,7 +30,6 @@ from oslo_utils import importutils
import six import six
from ironic_staging_drivers.common.i18n import _ from ironic_staging_drivers.common.i18n import _
from ironic_staging_drivers.common.i18n import _LW
from ironic_staging_drivers.common import utils from ironic_staging_drivers.common import utils
iboot = importutils.try_import('iboot') iboot = importutils.try_import('iboot')
@ -127,9 +126,9 @@ def _switch(driver_info, enabled):
def _wait_for_switch(mutable): def _wait_for_switch(mutable):
if mutable['retries'] > CONF.iboot.max_retry: if mutable['retries'] > CONF.iboot.max_retry:
LOG.warning(_LW( LOG.warning(
'Reached maximum number of attempts (%(attempts)d) to set ' 'Reached maximum number of attempts (%(attempts)d) to set '
'power state for node %(node)s to "%(op)s"'), 'power state for node %(node)s to "%(op)s"',
{'attempts': mutable['retries'], 'node': driver_info['uuid'], {'attempts': mutable['retries'], 'node': driver_info['uuid'],
'op': states.POWER_ON if enabled else states.POWER_OFF}) 'op': states.POWER_ON if enabled else states.POWER_OFF})
raise loopingcall.LoopingCallDone() raise loopingcall.LoopingCallDone()
@ -140,8 +139,8 @@ def _switch(driver_info, enabled):
if mutable['response']: if mutable['response']:
raise loopingcall.LoopingCallDone() raise loopingcall.LoopingCallDone()
except (TypeError, IndexError): except (TypeError, IndexError):
LOG.warning(_LW("Cannot call set power state for node '%(node)s' " LOG.warning("Cannot call set power state for node '%(node)s' "
"at relay '%(relay)s'. iBoot switch() failed."), "at relay '%(relay)s'. iBoot switch() failed.",
{'node': driver_info['uuid'], 'relay': relay_id}) {'node': driver_info['uuid'], 'relay': relay_id})
mutable = {'response': False, 'retries': 0} mutable = {'response': False, 'retries': 0}
@ -175,9 +174,9 @@ def _power_status(driver_info):
def _wait_for_power_status(mutable): def _wait_for_power_status(mutable):
if mutable['retries'] > CONF.iboot.max_retry: if mutable['retries'] > CONF.iboot.max_retry:
LOG.warning(_LW( LOG.warning(
'Reached maximum number of attempts (%(attempts)d) to get ' 'Reached maximum number of attempts (%(attempts)d) to get '
'power state for node %(node)s'), 'power state for node %(node)s',
{'attempts': mutable['retries'], 'node': driver_info['uuid']}) {'attempts': mutable['retries'], 'node': driver_info['uuid']})
raise loopingcall.LoopingCallDone() raise loopingcall.LoopingCallDone()
@ -191,8 +190,8 @@ def _power_status(driver_info):
mutable['state'] = states.POWER_OFF mutable['state'] = states.POWER_OFF
raise loopingcall.LoopingCallDone() raise loopingcall.LoopingCallDone()
except (TypeError, IndexError): except (TypeError, IndexError):
LOG.warning(_LW("Cannot get power state for node '%(node)s' at " LOG.warning("Cannot get power state for node '%(node)s' at "
"relay '%(relay)s'. iBoot get_relays() failed."), "relay '%(relay)s'. iBoot get_relays() failed.",
{'node': driver_info['uuid'], 'relay': relay_id}) {'node': driver_info['uuid'], 'relay': relay_id})
mutable = {'state': states.ERROR, 'retries': 0} mutable = {'state': states.ERROR, 'retries': 0}

View File

@ -21,7 +21,6 @@ import six
from ironic_staging_drivers.common import exception from ironic_staging_drivers.common import exception
from ironic_staging_drivers.common.i18n import _ from ironic_staging_drivers.common.i18n import _
from ironic_staging_drivers.common.i18n import _LW
LOG = log.getLogger(__name__) LOG = log.getLogger(__name__)
@ -500,8 +499,8 @@ def parse_statistics(raw_data):
except exception.InvalidIPMITimestamp as e: except exception.InvalidIPMITimestamp as e:
# there is not "bad time" in standard, reset to start the epoch # there is not "bad time" in standard, reset to start the epoch
statistics['timestamp'] = _INVALID_TIME statistics['timestamp'] = _INVALID_TIME
LOG.warning(_LW('Invalid timestamp in Node Nanager statistics ' LOG.warning('Invalid timestamp in Node Nanager statistics '
'data: %s'), six.text_type(e)) 'data: %s', six.text_type(e))
else: else:
statistics['timestamp'] = isotime statistics['timestamp'] = isotime

View File

@ -25,8 +25,6 @@ from oslo_utils import excutils
import six import six
from ironic_staging_drivers.common.i18n import _ from ironic_staging_drivers.common.i18n import _
from ironic_staging_drivers.common.i18n import _LE
from ironic_staging_drivers.common.i18n import _LI
from ironic_staging_drivers.intel_nm import nm_commands from ironic_staging_drivers.intel_nm import nm_commands
@ -67,7 +65,7 @@ def _get_nm_address(task):
if channel is False and address is False: if channel is False and address is False:
raise exception.IPMIFailure(_('Driver data indicates that Intel ' raise exception.IPMIFailure(_('Driver data indicates that Intel '
'Node Manager detection failed.')) 'Node Manager detection failed.'))
LOG.info(_LI('Start detection of Intel Node Manager on node %s'), LOG.info('Start detection of Intel Node Manager on node %s',
node.uuid) node.uuid)
sdr_filename = os.path.join(CONF.tempdir, node.uuid + '.sdr') sdr_filename = os.path.join(CONF.tempdir, node.uuid + '.sdr')
res = None res = None
@ -115,8 +113,8 @@ def _execute_nm_command(task, data, command_func, parse_func=None):
channel, address = _get_nm_address(task) channel, address = _get_nm_address(task)
except exception.IPMIFailure as e: except exception.IPMIFailure as e:
with excutils.save_and_reraise_exception(): with excutils.save_and_reraise_exception():
LOG.exception(_LE('Can not obtain Intel Node Manager address for ' LOG.exception('Can not obtain Intel Node Manager address for '
'node %(node)s: %(err)s'), 'node %(node)s: %(err)s',
{'node': task.node.uuid, 'err': six.text_type(e)}) {'node': task.node.uuid, 'err': six.text_type(e)})
driver_info = task.node.driver_info driver_info = task.node.driver_info
driver_info['ipmi_bridging'] = 'single' driver_info['ipmi_bridging'] = 'single'
@ -129,9 +127,9 @@ def _execute_nm_command(task, data, command_func, parse_func=None):
return parse_func(out.split()) return parse_func(out.split())
except exception.IPMIFailure as e: except exception.IPMIFailure as e:
with excutils.save_and_reraise_exception(): with excutils.save_and_reraise_exception():
LOG.exception(_LE('Error in returned data for node %(node)s: ' LOG.exception('Error in returned data for node %(node)s: '
'%(err)s'), {'node': task.node.uuid, '%(err)s', {'node': task.node.uuid,
'err': six.text_type(e)}) 'err': six.text_type(e)})
class IntelNMVendorPassthru(base.VendorInterface): class IntelNMVendorPassthru(base.VendorInterface):

View File

@ -29,7 +29,6 @@ from oslo_log import log
from ironic_staging_drivers.common import exception from ironic_staging_drivers.common import exception
from ironic_staging_drivers.common.i18n import _ from ironic_staging_drivers.common.i18n import _
from ironic_staging_drivers.common.i18n import _LI
from ironic_staging_drivers.common import utils from ironic_staging_drivers.common import utils
@ -154,9 +153,9 @@ class WakeOnLanPower(base.PowerInterface):
if pstate == states.POWER_ON: if pstate == states.POWER_ON:
_send_magic_packets(task, params['host'], params['port']) _send_magic_packets(task, params['host'], params['port'])
elif pstate == states.POWER_OFF: elif pstate == states.POWER_OFF:
LOG.info(_LI('Power off called for node %s. Wake-On-Lan does not ' LOG.info('Power off called for node %s. Wake-On-Lan does not '
'support this operation. Manual intervention ' 'support this operation. Manual intervention '
'required to perform this action.'), node.uuid) 'required to perform this action.', node.uuid)
else: else:
raise ironic_exception.InvalidParameterValue(_( raise ironic_exception.InvalidParameterValue(_(
"set_power_state called for Node %(node)s with invalid " "set_power_state called for Node %(node)s with invalid "
@ -177,9 +176,9 @@ class WakeOnLanPower(base.PowerInterface):
magic packets magic packets
""" """
LOG.info(_LI('Reboot called for node %s. Wake-On-Lan does ' LOG.info('Reboot called for node %s. Wake-On-Lan does '
'not fully support this operation. Trying to ' 'not fully support this operation. Trying to '
'power on the node.'), task.node.uuid) 'power on the node.', task.node.uuid)
self.set_power_state(task, states.POWER_ON) self.set_power_state(task, states.POWER_ON)
def get_supported_power_states(self, task): def get_supported_power_states(self, task):