From 4ba2bb282812472fb07167235f2a62387db2352d Mon Sep 17 00:00:00 2001 From: Luong Anh Tuan Date: Wed, 26 Apr 2017 00:34:30 +0700 Subject: [PATCH] Remove translation of log messages from ironic/drivers/modules/irmc i18n team has decided not to translate the logs because it seems like it's not very useful. Removed translation of log messages from ironic/drivers/modules/irmc Change-Id: I0343fd4ee40c9166bab6376aac76d54066a8296a Partial-Bug: #1674374 --- ironic/drivers/modules/irmc/boot.py | 36 +++++++++++------------ ironic/drivers/modules/irmc/inspect.py | 14 ++++----- ironic/drivers/modules/irmc/management.py | 11 ++++--- ironic/drivers/modules/irmc/power.py | 18 +++++------- 4 files changed, 38 insertions(+), 41 deletions(-) diff --git a/ironic/drivers/modules/irmc/boot.py b/ironic/drivers/modules/irmc/boot.py index 976eb553e2..1a85809259 100644 --- a/ironic/drivers/modules/irmc/boot.py +++ b/ironic/drivers/modules/irmc/boot.py @@ -28,7 +28,7 @@ from oslo_utils import importutils from ironic.common import boot_devices from ironic.common import exception from ironic.common.glance_service import service_utils -from ironic.common.i18n import _, _LE, _LI +from ironic.common.i18n import _ from ironic.common import images from ironic.common import states from ironic.conductor import utils as manager_utils @@ -350,7 +350,7 @@ def _setup_vmedia_for_boot(task, bootable_iso_filename, parameters=None): :raises: ImageCreationFailed, if it failed while creating a floppy image. :raises: IRMCOperationError, if attaching a virtual media failed. """ - LOG.info(_LI("Setting up node %s to boot from virtual media"), + LOG.info("Setting up node %s to boot from virtual media", task.node.uuid) _detach_virtual_cd(task.node) @@ -417,15 +417,15 @@ def _attach_virtual_cd(node, bootable_iso_filename): irmc_client(scci.MOUNT_CD, async=False) except scci.SCCIClientError as irmc_exception: - LOG.exception(_LE("Error while inserting virtual cdrom " - "into node %(uuid)s. Error: %(error)s"), + LOG.exception("Error while inserting virtual cdrom " + "into node %(uuid)s. Error: %(error)s", {'uuid': node.uuid, 'error': irmc_exception}) operation = _("Inserting virtual cdrom") raise exception.IRMCOperationError(operation=operation, error=irmc_exception) - LOG.info(_LI("Attached virtual cdrom successfully" - " for node %s"), node.uuid) + LOG.info("Attached virtual cdrom successfully" + " for node %s", node.uuid) def _detach_virtual_cd(node): @@ -440,15 +440,15 @@ def _detach_virtual_cd(node): irmc_client(scci.UNMOUNT_CD) except scci.SCCIClientError as irmc_exception: - LOG.exception(_LE("Error while ejecting virtual cdrom " - "from node %(uuid)s. Error: %(error)s"), + LOG.exception("Error while ejecting virtual cdrom " + "from node %(uuid)s. Error: %(error)s", {'uuid': node.uuid, 'error': irmc_exception}) operation = _("Ejecting virtual cdrom") raise exception.IRMCOperationError(operation=operation, error=irmc_exception) - LOG.info(_LI("Detached virtual cdrom successfully" - " for node %s"), node.uuid) + LOG.info("Detached virtual cdrom successfully" + " for node %s", node.uuid) def _attach_virtual_fd(node, floppy_image_filename): @@ -473,15 +473,15 @@ def _attach_virtual_fd(node, floppy_image_filename): irmc_client(scci.MOUNT_FD, async=False) except scci.SCCIClientError as irmc_exception: - LOG.exception(_LE("Error while inserting virtual floppy " - "into node %(uuid)s. Error: %(error)s"), + LOG.exception("Error while inserting virtual floppy " + "into node %(uuid)s. Error: %(error)s", {'uuid': node.uuid, 'error': irmc_exception}) operation = _("Inserting virtual floppy") raise exception.IRMCOperationError(operation=operation, error=irmc_exception) - LOG.info(_LI("Attached virtual floppy successfully" - " for node %s"), node.uuid) + LOG.info("Attached virtual floppy successfully" + " for node %s", node.uuid) def _detach_virtual_fd(node): @@ -496,15 +496,15 @@ def _detach_virtual_fd(node): irmc_client(scci.UNMOUNT_FD) except scci.SCCIClientError as irmc_exception: - LOG.exception(_LE("Error while ejecting virtual floppy " - "from node %(uuid)s. Error: %(error)s"), + LOG.exception("Error while ejecting virtual floppy " + "from node %(uuid)s. Error: %(error)s", {'uuid': node.uuid, 'error': irmc_exception}) operation = _("Ejecting virtual floppy") raise exception.IRMCOperationError(operation=operation, error=irmc_exception) - LOG.info(_LI("Detached virtual floppy successfully" - " for node %s"), node.uuid) + LOG.info("Detached virtual floppy successfully" + " for node %s", node.uuid) def check_share_fs_mounted(): diff --git a/ironic/drivers/modules/irmc/inspect.py b/ironic/drivers/modules/irmc/inspect.py index 5f89271364..582eb0b850 100644 --- a/ironic/drivers/modules/irmc/inspect.py +++ b/ironic/drivers/modules/irmc/inspect.py @@ -19,7 +19,7 @@ from oslo_log import log as logging from oslo_utils import importutils from ironic.common import exception -from ironic.common.i18n import _, _LI, _LW +from ironic.common.i18n import _ from ironic.common import states from ironic.drivers import base from ironic.drivers.modules.irmc import common as irmc_common @@ -179,14 +179,14 @@ class IRMCInspect(base.InspectInterface): new_port = objects.Port(task.context, address=mac, node_id=node.id) new_port.create() - LOG.info(_LI("Port created for MAC address %(address)s " - "for node %(node_uuid)s during inspection"), + LOG.info("Port created for MAC address %(address)s " + "for node %(node_uuid)s during inspection", {'address': mac, 'node_uuid': node.uuid}) except exception.MACAlreadyExists: - LOG.warning(_LW("Port already existed for MAC address " - "%(address)s for node %(node_uuid)s " - "during inspection"), + LOG.warning("Port already existed for MAC address " + "%(address)s for node %(node_uuid)s " + "during inspection", {'address': mac, 'node_uuid': node.uuid}) - LOG.info(_LI("Node %s inspected"), node.uuid) + LOG.info("Node %s inspected", node.uuid) return states.MANAGEABLE diff --git a/ironic/drivers/modules/irmc/management.py b/ironic/drivers/modules/irmc/management.py index 7aac1683fb..6f774b849d 100644 --- a/ironic/drivers/modules/irmc/management.py +++ b/ironic/drivers/modules/irmc/management.py @@ -20,7 +20,7 @@ from oslo_utils import importutils from ironic.common import boot_devices from ironic.common import exception -from ironic.common.i18n import _, _LE +from ironic.common.i18n import _ from ironic.conductor import task_manager from ironic.drivers.modules import ipmitool from ironic.drivers.modules.irmc import common as irmc_common @@ -67,8 +67,8 @@ def _get_sensors_data(task): exception.MissingParameterValue, scci.SCCIInvalidInputError, scci.SCCIClientError) as e: - LOG.error(_LE("SCCI get sensor data failed for node %(node_id)s " - "with the following error: %(error)s"), + LOG.error("SCCI get sensor data failed for node %(node_id)s " + "with the following error: %(error)s", {'node_id': task.node.uuid, 'error': e}) raise exception.FailedToGetSensorData( node=task.node.uuid, error=e) @@ -251,8 +251,7 @@ class IRMCManagement(ipmitool.IPMIManagement): try: irmc_client(scci.POWER_RAISE_NMI) except scci.SCCIClientError as err: - LOG.error( - _LE('iRMC Inject NMI failed for node %(node)s: %(err)s.'), - {'node': node.uuid, 'err': err}) + LOG.error('iRMC Inject NMI failed for node %(node)s: %(err)s.', + {'node': node.uuid, 'err': err}) raise exception.IRMCOperationError( operation=scci.POWER_RAISE_NMI, error=err) diff --git a/ironic/drivers/modules/irmc/power.py b/ironic/drivers/modules/irmc/power.py index 43ed445b87..5a34e3721e 100644 --- a/ironic/drivers/modules/irmc/power.py +++ b/ironic/drivers/modules/irmc/power.py @@ -22,8 +22,6 @@ from oslo_utils import importutils from ironic.common import exception from ironic.common.i18n import _ -from ironic.common.i18n import _LE -from ironic.common.i18n import _LI from ironic.common import states from ironic.conductor import task_manager from ironic.conf import CONF @@ -135,8 +133,8 @@ def _wait_power_state(task, target_state, timeout=None): else states.POWER_ON) node.target_power_state = states.NOSTATE node.save() - LOG.info(_LI('iRMC successfully set node %(node_id)s ' - 'power state to %(bootstatus)s.'), + LOG.info('iRMC successfully set node %(node_id)s ' + 'power state to %(bootstatus)s.', {'node_id': node.uuid, 'bootstatus': BOOT_STATUS[store['boot_status_value']]}) else: @@ -147,8 +145,8 @@ def _wait_power_state(task, target_state, timeout=None): node.power_state = states.ERROR node.target_power_state = states.NOSTATE node.save() - LOG.error(_LE('iRMC failed to acknowledge the target state for node ' - '%(node_id)s. Error: %(last_error)s'), + LOG.error('iRMC failed to acknowledge the target state for node ' + '%(node_id)s. Error: %(last_error)s', {'node_id': node.uuid, 'last_error': last_error}) error = _('unexpected boot status value') raise exception.IRMCOperationError(operation=target_state, @@ -182,8 +180,8 @@ def _set_power_state(task, target_state, timeout=None): raise exception.InvalidParameterValue(msg) except scci.SCCIClientError as irmc_exception: - LOG.error(_LE("iRMC set_power_state failed to set state to %(tstate)s " - " for node %(node_id)s with error: %(error)s"), + LOG.error("iRMC set_power_state failed to set state to %(tstate)s " + " for node %(node_id)s with error: %(error)s", {'tstate': target_state, 'node_id': node.uuid, 'error': irmc_exception}) operation = _('iRMC set_power_state') @@ -200,8 +198,8 @@ def _set_power_state(task, target_state, timeout=None): _wait_power_state(task, states.SOFT_REBOOT, timeout=timeout) except exception.SNMPFailure as snmp_exception: - LOG.error(_LE("iRMC failed to acknowledge the target state " - "for node %(node_id)s. Error: %(error)s"), + LOG.error("iRMC failed to acknowledge the target state " + "for node %(node_id)s. Error: %(error)s", {'node_id': node.uuid, 'error': snmp_exception}) raise exception.IRMCOperationError(operation=target_state, error=snmp_exception)