Merge "Remove log translations from iLO drivers"

This commit is contained in:
Jenkins 2017-04-27 12:05:10 +00:00 committed by Gerrit Code Review
commit 4a4527725f
6 changed files with 72 additions and 73 deletions

View File

@ -28,7 +28,7 @@ import six.moves.urllib.parse as urlparse
from ironic.common import boot_devices from ironic.common import boot_devices
from ironic.common import exception from ironic.common import exception
from ironic.common.glance_service import service_utils from ironic.common.glance_service import service_utils
from ironic.common.i18n import _, _LE, _LW from ironic.common.i18n import _
from ironic.common import image_service from ironic.common import image_service
from ironic.common import images from ironic.common import images
from ironic.common import states from ironic.common import states
@ -130,11 +130,11 @@ def _get_boot_iso(task, root_uuid):
image_service.HttpImageService().validate_href(boot_iso) image_service.HttpImageService().validate_href(boot_iso)
except exception.ImageRefValidationFailed: except exception.ImageRefValidationFailed:
with excutils.save_and_reraise_exception(): with excutils.save_and_reraise_exception():
LOG.error(_LE("Virtual media deploy accepts only Glance " LOG.error("Virtual media deploy accepts only Glance "
"images or HTTP(S) URLs as " "images or HTTP(S) URLs as "
"instance_info['ilo_boot_iso']. Either %s " "instance_info['ilo_boot_iso']. Either %s "
"is not a valid HTTP(S) URL or is " "is not a valid HTTP(S) URL or is "
"not reachable."), boot_iso) "not reachable.", boot_iso)
return task.node.instance_info['ilo_boot_iso'] return task.node.instance_info['ilo_boot_iso']
@ -158,8 +158,8 @@ def _get_boot_iso(task, root_uuid):
return boot_iso_uuid return boot_iso_uuid
if not kernel_href or not ramdisk_href: if not kernel_href or not ramdisk_href:
LOG.error(_LE("Unable to find kernel or ramdisk for " LOG.error("Unable to find kernel or ramdisk for "
"image %(image)s to generate boot ISO for %(node)s"), "image %(image)s to generate boot ISO for %(node)s",
{'image': image_href, 'node': task.node.uuid}) {'image': image_href, 'node': task.node.uuid})
return return
@ -218,8 +218,8 @@ def _clean_up_boot_iso_for_instance(node):
try: try:
swift_api.delete_object(container, boot_iso_object_name) swift_api.delete_object(container, boot_iso_object_name)
except exception.SwiftOperationError as e: except exception.SwiftOperationError as e:
LOG.exception(_LE("Failed to clean up boot ISO for node " LOG.exception("Failed to clean up boot ISO for node "
"%(node)s. Error: %(error)s."), "%(node)s. Error: %(error)s.",
{'node': node.uuid, 'error': e}) {'node': node.uuid, 'error': e})
elif CONF.ilo.use_web_server_for_images: elif CONF.ilo.use_web_server_for_images:
result = urlparse.urlparse(ilo_boot_iso) result = urlparse.urlparse(ilo_boot_iso)
@ -490,8 +490,8 @@ class IloVirtualMediaBoot(base.BootInterface):
if root_uuid_or_disk_id: if root_uuid_or_disk_id:
self._configure_vmedia_boot(task, root_uuid_or_disk_id) self._configure_vmedia_boot(task, root_uuid_or_disk_id)
else: else:
LOG.warning(_LW("The UUID for the root partition could not " LOG.warning("The UUID for the root partition could not "
"be found for node %s"), node.uuid) "be found for node %s", node.uuid)
# Set boot mode # Set boot mode
ilo_common.update_boot_mode(task) ilo_common.update_boot_mode(task)
# Need to enable secure boot, if being requested # Need to enable secure boot, if being requested
@ -549,7 +549,7 @@ class IloVirtualMediaBoot(base.BootInterface):
node = task.node node = task.node
boot_iso = _get_boot_iso(task, root_uuid) boot_iso = _get_boot_iso(task, root_uuid)
if not boot_iso: if not boot_iso:
LOG.error(_LE("Cannot get boot ISO for node %s"), node.uuid) LOG.error("Cannot get boot ISO for node %s", node.uuid)
return return
# Upon deploy complete, some distros cloud images reboot the system as # Upon deploy complete, some distros cloud images reboot the system as

View File

@ -30,7 +30,7 @@ from six.moves.urllib.parse import urljoin
from ironic.common import boot_devices from ironic.common import boot_devices
from ironic.common import exception from ironic.common import exception
from ironic.common.glance_service import service_utils from ironic.common.glance_service import service_utils
from ironic.common.i18n import _, _LE, _LI, _LW from ironic.common.i18n import _
from ironic.common import images from ironic.common import images
from ironic.common import swift from ironic.common import swift
from ironic.common import utils from ironic.common import utils
@ -183,18 +183,19 @@ def remove_image_from_swift(object_name, associated_with=None):
swift_api = swift.SwiftAPI() swift_api = swift.SwiftAPI()
swift_api.delete_object(container, object_name) swift_api.delete_object(container, object_name)
except exception.SwiftObjectNotFoundError as e: except exception.SwiftObjectNotFoundError as e:
LOG.warning( LOG.warning("Temporary object %(associated_with_msg)s"
_LW("Temporary object %(associated_with_msg)s" "was already deleted from Swift. Error: %(err)s",
"was already deleted from Swift. Error: %(err)s"), {'associated_with_msg':
{'associated_with_msg': ("associated with %s " % associated_with ("associated with %s " % associated_with
if associated_with else ""), 'err': e}) if associated_with else ""), 'err': e})
except exception.SwiftOperationError as e: except exception.SwiftOperationError as e:
LOG.exception( LOG.exception("Error while deleting temporary swift object "
_LE("Error while deleting temporary swift object %(object_name)s " "%(object_name)s %(associated_with_msg)s from "
"%(associated_with_msg)s from %(container)s. Error: %(err)s"), "%(container)s. Error: %(err)s",
{'object_name': object_name, 'container': container, {'object_name': object_name, 'container': container,
'associated_with_msg': ("associated with %s" % associated_with 'associated_with_msg':
if associated_with else ""), 'err': e}) ("associated with %s" % associated_with
if associated_with else ""), 'err': e})
def parse_driver_info(node): def parse_driver_info(node):
@ -436,7 +437,7 @@ def attach_vmedia(node, device, url):
raise exception.IloOperationError( raise exception.IloOperationError(
operation=operation, error=ilo_exception) operation=operation, error=ilo_exception)
LOG.info(_LI("Attached virtual media %s successfully."), device) LOG.info("Attached virtual media %s successfully.", device)
def set_boot_mode(node, boot_mode): def set_boot_mode(node, boot_mode):
@ -454,7 +455,7 @@ def set_boot_mode(node, boot_mode):
p_boot_mode = DEFAULT_BOOT_MODE p_boot_mode = DEFAULT_BOOT_MODE
if BOOT_MODE_ILO_TO_GENERIC[p_boot_mode.lower()] == boot_mode: if BOOT_MODE_ILO_TO_GENERIC[p_boot_mode.lower()] == boot_mode:
LOG.info(_LI("Node %(uuid)s pending boot mode is %(boot_mode)s."), LOG.info("Node %(uuid)s pending boot mode is %(boot_mode)s.",
{'uuid': node.uuid, 'boot_mode': boot_mode}) {'uuid': node.uuid, 'boot_mode': boot_mode})
return return
@ -466,7 +467,7 @@ def set_boot_mode(node, boot_mode):
raise exception.IloOperationError( raise exception.IloOperationError(
operation=operation, error=ilo_exception) operation=operation, error=ilo_exception)
LOG.info(_LI("Node %(uuid)s boot mode is set to %(boot_mode)s."), LOG.info("Node %(uuid)s boot mode is set to %(boot_mode)s.",
{'uuid': node.uuid, 'boot_mode': boot_mode}) {'uuid': node.uuid, 'boot_mode': boot_mode})
@ -587,7 +588,7 @@ def setup_vmedia_for_boot(task, boot_iso, parameters=None):
:raises: SwiftOperationError, if any operation with Swift fails. :raises: SwiftOperationError, if any operation with Swift fails.
:raises: IloOperationError, if attaching virtual media failed. :raises: IloOperationError, if attaching 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) task.node.uuid)
if parameters: if parameters:
floppy_image_temp_url = _prepare_floppy_image(task, parameters) floppy_image_temp_url = _prepare_floppy_image(task, parameters)
@ -623,8 +624,8 @@ def eject_vmedia_devices(task):
try: try:
ilo_object.eject_virtual_media(device) ilo_object.eject_virtual_media(device)
except ilo_error.IloError as ilo_exception: except ilo_error.IloError as ilo_exception:
LOG.error(_LE("Error while ejecting virtual media %(device)s " LOG.error("Error while ejecting virtual media %(device)s "
"from node %(uuid)s. Error: %(error)s"), "from node %(uuid)s. Error: %(error)s",
{'device': device, 'uuid': task.node.uuid, {'device': device, 'uuid': task.node.uuid,
'error': ilo_exception}) 'error': ilo_exception})
operation = _("Eject virtual media %s") % device.lower() operation = _("Eject virtual media %s") % device.lower()
@ -732,7 +733,7 @@ def update_secure_boot_mode(task, mode):
""" """
if deploy_utils.is_secure_boot_requested(task.node): if deploy_utils.is_secure_boot_requested(task.node):
set_secure_boot_mode(task, mode) set_secure_boot_mode(task, mode)
LOG.info(_LI('Changed secure boot to %(mode)s for node %(node)s'), LOG.info('Changed secure boot to %(mode)s for node %(node)s',
{'mode': mode, 'node': task.node.uuid}) {'mode': mode, 'node': task.node.uuid})
@ -770,8 +771,7 @@ def verify_image_checksum(image_location, expected_checksum):
with open(image_location, 'rb') as fd: with open(image_location, 'rb') as fd:
actual_checksum = utils.hash_file(fd) actual_checksum = utils.hash_file(fd)
except IOError as e: except IOError as e:
LOG.error(_LE("Error opening file: %(file)s"), LOG.error("Error opening file: %(file)s", {'file': image_location})
{'file': image_location})
raise exception.ImageRefValidationFailed(image_href=image_location, raise exception.ImageRefValidationFailed(image_href=image_location,
reason=e) reason=e)

View File

@ -28,7 +28,7 @@ import six
import six.moves.urllib.parse as urlparse import six.moves.urllib.parse as urlparse
from ironic.common import exception from ironic.common import exception
from ironic.common.i18n import _, _LI from ironic.common.i18n import _
from ironic.common import image_service from ironic.common import image_service
from ironic.common import swift from ironic.common import swift
from ironic.drivers.modules.ilo import common as ilo_common from ironic.drivers.modules.ilo import common as ilo_common
@ -213,7 +213,7 @@ class FirmwareProcessor(object):
# delete the entire downloaded content along with temp dir. # delete the entire downloaded content along with temp dir.
shutil.rmtree(temp_dir, ignore_errors=True) shutil.rmtree(temp_dir, ignore_errors=True)
LOG.info(_LI("Final processed firmware location: %s"), LOG.info("Final processed firmware location: %s",
fw_image_location_obj.fw_image_location) fw_image_location_obj.fw_image_location)
return fw_image_location_obj return fw_image_location_obj

View File

@ -17,7 +17,7 @@ from oslo_log import log as logging
from oslo_utils import importutils from oslo_utils import importutils
from ironic.common import exception from ironic.common import exception
from ironic.common.i18n import _, _LI, _LW from ironic.common.i18n import _
from ironic.common import states from ironic.common import states
from ironic.common import utils from ironic.common import utils
from ironic.conductor import utils as conductor_utils from ironic.conductor import utils as conductor_utils
@ -54,11 +54,11 @@ def _create_ports_if_not_exist(task, macs):
try: try:
port.create() port.create()
LOG.info(_LI("Port created for MAC address %(address)s for node " LOG.info("Port created for MAC address %(address)s for node "
"%(node)s"), {'address': mac, 'node': node.uuid}) "%(node)s", {'address': mac, 'node': node.uuid})
except exception.MACAlreadyExists: except exception.MACAlreadyExists:
LOG.warning(_LW("Port already exists for MAC address %(address)s " LOG.warning("Port already exists for MAC address %(address)s "
"for node %(node)s"), "for node %(node)s",
{'address': mac, 'node': node.uuid}) {'address': mac, 'node': node.uuid})
@ -154,7 +154,7 @@ def _get_capabilities(node, ilo_object):
try: try:
capabilities = ilo_object.get_server_capabilities() capabilities = ilo_object.get_server_capabilities()
except ilo_error.IloError: except ilo_error.IloError:
LOG.debug(("Node %s did not return any additional capabilities."), LOG.debug("Node %s did not return any additional capabilities.",
node.uuid) node.uuid)
return capabilities return capabilities
@ -210,8 +210,8 @@ class IloInspect(base.InspectInterface):
raise exception.IloOperationError(operation=operation, raise exception.IloOperationError(operation=operation,
error=ilo_exception) error=ilo_exception)
if state != states.POWER_ON: if state != states.POWER_ON:
LOG.info(_LI("The node %s is not powered on. Powering on the " LOG.info("The node %s is not powered on. Powering on the "
"node for inspection."), task.node.uuid) "node for inspection.", task.node.uuid)
conductor_utils.node_power_action(task, states.POWER_ON) conductor_utils.node_power_action(task, states.POWER_ON)
power_turned_on = True power_turned_on = True
@ -232,9 +232,9 @@ class IloInspect(base.InspectInterface):
if current_local_gb: if current_local_gb:
if properties['local_gb'] == 0 and current_local_gb > 0: if properties['local_gb'] == 0 and current_local_gb > 0:
properties['local_gb'] = current_local_gb properties['local_gb'] = current_local_gb
LOG.warning(_LW('Could not discover size of disk on the node ' LOG.warning('Could not discover size of disk on the node '
'%s. Value of `properties/local_gb` of the ' '%s. Value of `properties/local_gb` of the '
'node is not overwritten.'), task.node.uuid) 'node is not overwritten.', task.node.uuid)
for known_property in self.ESSENTIAL_PROPERTIES: for known_property in self.ESSENTIAL_PROPERTIES:
inspected_properties[known_property] = properties[known_property] inspected_properties[known_property] = properties[known_property]
@ -260,15 +260,15 @@ class IloInspect(base.InspectInterface):
# Create ports for the nics detected. # Create ports for the nics detected.
_create_ports_if_not_exist(task, result['macs']) _create_ports_if_not_exist(task, result['macs'])
LOG.debug(("Node properties for %(node)s are updated as " LOG.debug("Node properties for %(node)s are updated as "
"%(properties)s"), "%(properties)s",
{'properties': inspected_properties, {'properties': inspected_properties,
'node': task.node.uuid}) 'node': task.node.uuid})
LOG.info(_LI("Node %s inspected."), task.node.uuid) LOG.info("Node %s inspected.", task.node.uuid)
if power_turned_on: if power_turned_on:
conductor_utils.node_power_action(task, states.POWER_OFF) conductor_utils.node_power_action(task, states.POWER_OFF)
LOG.info(_LI("The node %s was powered on for inspection. " LOG.info("The node %s was powered on for inspection. "
"Powered off the node as inspection completed."), "Powered off the node as inspection completed.",
task.node.uuid) task.node.uuid)
return states.MANAGEABLE return states.MANAGEABLE

View File

@ -23,7 +23,7 @@ import six
from ironic.common import boot_devices from ironic.common import boot_devices
from ironic.common import exception from ironic.common import exception
from ironic.common.i18n import _, _LE, _LI, _LW from ironic.common.i18n import _
from ironic.conductor import task_manager from ironic.conductor import task_manager
from ironic.conf import CONF from ironic.conf import CONF
from ironic.drivers import base from ironic.drivers import base
@ -74,8 +74,8 @@ def _execute_ilo_clean_step(node, step, *args, **kwargs):
except ilo_error.IloCommandNotSupportedError: except ilo_error.IloCommandNotSupportedError:
# This clean step is not supported on Gen8 and below servers. # This clean step is not supported on Gen8 and below servers.
# Log the failure and continue with cleaning. # Log the failure and continue with cleaning.
LOG.warning(_LW("'%(step)s' clean step is not supported on node " LOG.warning("'%(step)s' clean step is not supported on node "
"%(uuid)s. Skipping the clean step."), "%(uuid)s. Skipping the clean step.",
{'step': step, 'uuid': node.uuid}) {'step': step, 'uuid': node.uuid})
except ilo_error.IloError as ilo_exception: except ilo_error.IloError as ilo_exception:
raise exception.NodeCleaningFailure(_( raise exception.NodeCleaningFailure(_(
@ -237,9 +237,9 @@ class IloManagement(base.ManagementInterface):
password = info.pop('ilo_change_password', None) password = info.pop('ilo_change_password', None)
if not password: if not password:
LOG.info(_LI("Missing 'ilo_change_password' parameter in " LOG.info("Missing 'ilo_change_password' parameter in "
"driver_info. Clean step 'reset_ilo_credential' is " "driver_info. Clean step 'reset_ilo_credential' is "
"not performed on node %s."), task.node.uuid) "not performed on node %s.", task.node.uuid)
return return
_execute_ilo_clean_step(task.node, 'reset_ilo_credential', password) _execute_ilo_clean_step(task.node, 'reset_ilo_credential', password)
@ -319,8 +319,7 @@ class IloManagement(base.ManagementInterface):
LOG.debug("Activating iLO license for node %(node)s ...", LOG.debug("Activating iLO license for node %(node)s ...",
{'node': node.uuid}) {'node': node.uuid})
_execute_ilo_clean_step(node, 'activate_license', ilo_license_key) _execute_ilo_clean_step(node, 'activate_license', ilo_license_key)
LOG.info(_LI("iLO license activated for node %(node)s."), LOG.info("iLO license activated for node %s.", node.uuid)
{'node': node.uuid})
@METRICS.timer('IloManagement.update_firmware') @METRICS.timer('IloManagement.update_firmware')
@base.clean_step(priority=0, abortable=False, argsinfo={ @base.clean_step(priority=0, abortable=False, argsinfo={
@ -390,8 +389,8 @@ class IloManagement(base.ManagementInterface):
# and re-raise the exception # and re-raise the exception
for fw_loc_obj_n_comp_tup in fw_location_objs_n_components: for fw_loc_obj_n_comp_tup in fw_location_objs_n_components:
fw_loc_obj_n_comp_tup[0].remove() fw_loc_obj_n_comp_tup[0].remove()
LOG.error(_LE("Processing of firmware image: %(firmware_image)s " LOG.error("Processing of firmware image: %(firmware_image)s "
"on node: %(node)s ... failed"), "on node: %(node)s ... failed",
{'firmware_image': firmware_image_info, {'firmware_image': firmware_image_info,
'node': node.uuid}) 'node': node.uuid})
raise exception.NodeCleaningFailure(node=node.uuid, reason=ilo_exc) raise exception.NodeCleaningFailure(node=node.uuid, reason=ilo_exc)
@ -412,12 +411,12 @@ class IloManagement(base.ManagementInterface):
{'firmware_file': fw_location, 'node': node.uuid}) {'firmware_file': fw_location, 'node': node.uuid})
except exception.NodeCleaningFailure: except exception.NodeCleaningFailure:
with excutils.save_and_reraise_exception(): with excutils.save_and_reraise_exception():
LOG.error(_LE("Firmware update for %(firmware_file)s on " LOG.error("Firmware update for %(firmware_file)s on "
"node: %(node)s failed."), "node: %(node)s failed.",
{'firmware_file': fw_location, 'node': node.uuid}) {'firmware_file': fw_location, 'node': node.uuid})
finally: finally:
for fw_loc_obj_n_comp_tup in fw_location_objs_n_components: for fw_loc_obj_n_comp_tup in fw_location_objs_n_components:
fw_loc_obj_n_comp_tup[0].remove() fw_loc_obj_n_comp_tup[0].remove()
LOG.info(_LI("All Firmware update operations completed successfully " LOG.info("All Firmware update operations completed successfully "
"for node: %s."), node.uuid) "for node: %s.", node.uuid)

View File

@ -23,7 +23,7 @@ from oslo_utils import importutils
from ironic.common import boot_devices from ironic.common import boot_devices
from ironic.common import exception from ironic.common import exception
from ironic.common.i18n import _, _LE from ironic.common.i18n import _
from ironic.common import states from ironic.common import states
from ironic.conductor import task_manager from ironic.conductor import task_manager
from ironic.conductor import utils as manager_utils from ironic.conductor import utils as manager_utils
@ -79,8 +79,8 @@ def _get_power_state(node):
power_status = ilo_object.get_host_power_status() power_status = ilo_object.get_host_power_status()
except ilo_error.IloError as ilo_exception: except ilo_error.IloError as ilo_exception:
LOG.error(_LE("iLO get_power_state failed for node %(node_id)s with " LOG.error("iLO get_power_state failed for node %(node_id)s with "
"error: %(error)s."), "error: %(error)s.",
{'node_id': node.uuid, 'error': ilo_exception}) {'node_id': node.uuid, 'error': ilo_exception})
operation = _('iLO get_power_status') operation = _('iLO get_power_status')
raise exception.IloOperationError(operation=operation, raise exception.IloOperationError(operation=operation,
@ -151,8 +151,8 @@ def _set_power_state(task, target_state):
raise exception.InvalidParameterValue(msg) raise exception.InvalidParameterValue(msg)
except ilo_error.IloError as ilo_exception: except ilo_error.IloError as ilo_exception:
LOG.error(_LE("iLO set_power_state failed to set state to %(tstate)s " LOG.error("iLO set_power_state failed to set state to %(tstate)s "
" for node %(node_id)s with error: %(error)s"), " for node %(node_id)s with error: %(error)s",
{'tstate': target_state, 'node_id': node.uuid, {'tstate': target_state, 'node_id': node.uuid,
'error': ilo_exception}) 'error': ilo_exception})
operation = _('iLO set_power_state') operation = _('iLO set_power_state')
@ -164,8 +164,8 @@ def _set_power_state(task, target_state):
if state != target_state: if state != target_state:
timeout = (CONF.ilo.power_wait) * (CONF.ilo.power_retry) timeout = (CONF.ilo.power_wait) * (CONF.ilo.power_retry)
LOG.error(_LE("iLO failed to change state to %(tstate)s " LOG.error("iLO failed to change state to %(tstate)s "
"within %(timeout)s sec"), "within %(timeout)s sec",
{'tstate': target_state, 'timeout': timeout}) {'tstate': target_state, 'timeout': timeout})
raise exception.PowerStateFailure(pstate=target_state) raise exception.PowerStateFailure(pstate=target_state)