From: Jay S. Bryant Date: Wed, 19 Nov 2014 21:01:10 +0000 (-0600) Subject: Fix messages in EMC VMAX driver with no translation X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=cc77eb2bda4959740a89ad5986cac7f57c94f78a;p=openstack-build%2Fcinder-build.git Fix messages in EMC VMAX driver with no translation There were a number of messages in the EMC VMAX driver for LOG.info, LOG.error and LOG.warning that had no translation marker on them. This patch adds the appropriate _LI, _LE or _LW marker so that the message will be translated. Since there is a separate effort to add in the log level markers going on I did not attempt, in this patch, to address that issue. Just thought we should get translation on the messages that were missing it. Change-Id: If6ac19369b303466afdec98589afa80ac46ad0f2 --- diff --git a/cinder/volume/drivers/emc/emc_vmax_common.py b/cinder/volume/drivers/emc/emc_vmax_common.py index ae7d9ce3d..2d88a4e2a 100644 --- a/cinder/volume/drivers/emc/emc_vmax_common.py +++ b/cinder/volume/drivers/emc/emc_vmax_common.py @@ -1136,7 +1136,7 @@ class EMCVMAXCommon(object): LOG.error(errorMessage) return falseRet - LOG.info("Volume status is: %s" % volumeStatus) + LOG.info(_LI("Volume status is: %s"), volumeStatus) if (host['capabilities']['storage_protocol'] != self.protocol and (volumeStatus != 'available' and volumeStatus != 'retyping')): errorMessage = (_( @@ -1164,7 +1164,7 @@ class EMCVMAXCommon(object): # If there are no extra specs then the default case is assumed if extraSpecs: configGroup = self.configuration.config_group - LOG.info("configGroup of current host: %s" % configGroup) + LOG.info(_LI("configGroup of current host: %s"), configGroup) configurationFile = self._register_config_file_from_config_group( configGroup) @@ -2154,9 +2154,9 @@ class EMCVMAXCommon(object): volumename = volume['name'] vol_instance = self._find_lun(volume) if vol_instance is None: - msg = ("Volume %(name)s not found on the array. " - "Cannot determine if there are volumes mapped." - % {'name': volumename}) + msg = (_("Volume %(name)s not found on the array. " + "Cannot determine if there are volumes mapped."), + {'name': volumename}) LOG.error(msg) raise exception.VolumeBackendAPIException(data=msg) @@ -2202,9 +2202,10 @@ class EMCVMAXCommon(object): targetWwns = [] mvInstanceName = self.get_masking_view_by_volume(volume) targetWwns = self.masking.get_target_wwns(self.conn, mvInstanceName) - LOG.info("Target wwns in masking view %(maskingView)s: %(targetWwns)s" - % {'maskingView': mvInstanceName, - 'targetWwns': str(targetWwns)}) + LOG.info(_LI("Target wwns in masking view %(maskingView)s: " + "%(targetWwns)s"), + {'maskingView': mvInstanceName, + 'targetWwns': str(targetWwns)}) return targetWwns def get_port_group_from_masking_view(self, maskingViewInstanceName): diff --git a/cinder/volume/drivers/emc/emc_vmax_fc.py b/cinder/volume/drivers/emc/emc_vmax_fc.py index abc6f445b..53dc26b45 100644 --- a/cinder/volume/drivers/emc/emc_vmax_fc.py +++ b/cinder/volume/drivers/emc/emc_vmax_fc.py @@ -15,6 +15,7 @@ import six from cinder import context +from cinder.i18n import _LI from cinder.openstack.common import log as logging from cinder.volume import driver from cinder.volume.drivers.emc import emc_vmax_common @@ -182,7 +183,7 @@ class EMCVMAXFCDriver(driver.FibreChannelDriver): loc = volume['provider_location'] name = eval(loc) storage_system = name['keybindings']['SystemName'] - LOG.info("Start FC detach process for volume: %(volume)s" + LOG.info(_LI("Start FC detach process for volume: %(volume)s") % {'volume': volume['name']}) target_wwns, init_targ_map = self._build_initiator_target_map( @@ -192,15 +193,15 @@ class EMCVMAXFCDriver(driver.FibreChannelDriver): portGroupInstanceName = self.common.get_port_group_from_masking_view( mvInstanceName) - LOG.info("Found port group: %(portGroup)s " - "in masking view %(maskingView)s" - % {'portGroup': portGroupInstanceName, - 'maskingView': mvInstanceName}) + LOG.info(_LI("Found port group: %(portGroup)s " + "in masking view %(maskingView)s"), + {'portGroup': portGroupInstanceName, + 'maskingView': mvInstanceName}) self.common.terminate_connection(volume, connector) - LOG.info("Looking for masking views still associated with" - "Port Group %s" % portGroupInstanceName) + LOG.info(_LI("Looking for masking views still associated with" + "Port Group %s"), portGroupInstanceName) mvInstances = self.common.get_masking_views_by_port_group( portGroupInstanceName) if len(mvInstances) > 0: diff --git a/cinder/volume/drivers/emc/emc_vmax_masking.py b/cinder/volume/drivers/emc/emc_vmax_masking.py index dd3324ad4..fefb7408d 100644 --- a/cinder/volume/drivers/emc/emc_vmax_masking.py +++ b/cinder/volume/drivers/emc/emc_vmax_masking.py @@ -813,7 +813,7 @@ class EMCVMAXMasking(object): " %(fastPolicyName)s. ") % {'volumeName': volumeName, 'fastPolicyName': fastPolicyName}) - LOG.warn("No storage group found. " + infoMessage) + LOG.warning(_LW("No storage group found. %s"), infoMessage) assocDefaultStorageGroupName = ( self.fast .add_volume_to_default_storage_group_for_fast_policy( @@ -1410,10 +1410,10 @@ class EMCVMAXMasking(object): ResultClass='Symm_FCSCSIProtocolEndpoint') numberOfPorts = len(targetPortInstanceNames) if numberOfPorts <= 0: - LOG.warn("No target ports found in " - "masking view %(maskingView)s" - % {'numPorts': len(targetPortInstanceNames), - 'maskingView': mvInstanceName}) + LOG.warning(_LW("No target ports found in " + "masking view %(maskingView)s"), + {'numPorts': len(targetPortInstanceNames), + 'maskingView': mvInstanceName}) for targetPortInstanceName in targetPortInstanceNames: targetWwns.append(targetPortInstanceName['Name']) return targetWwns @@ -1456,5 +1456,5 @@ class EMCVMAXMasking(object): 'mv': maskingViewInstanceName}) return portGroupInstanceNames[0] else: - LOG.warn("No port group found in masking view %(mv)s" - % {'mv': maskingViewInstanceName}) + LOG.warning(_LW("No port group found in masking view %(mv)s"), + {'mv': maskingViewInstanceName})