from cinder.common import sqlalchemyutils
from cinder.db.sqlalchemy import models
from cinder import exception
-from cinder.i18n import _
+from cinder.i18n import _, _LW
from cinder.openstack.common import log as logging
from cinder.openstack.common import uuidutils
usages[resource].reserved += delta
if unders:
- LOG.warning(_("Change will make usage less than 0 for the following "
- "resources: %s") % unders)
+ LOG.warning(_LW("Change will make usage less than 0 for the following "
+ "resources: %s") % unders)
if overs:
usages = dict((k, dict(in_use=v['in_use'], reserved=v['reserved']))
for k, v in usages.items())
import six.moves.urllib.parse as urlparse
from cinder import exception
-from cinder.i18n import _
+from cinder.i18n import _, _LW
from cinder.openstack.common import log as logging
self.version = version
if CONF.glance_num_retries < 0:
- LOG.warning(_(
+ LOG.warning(_LW(
"glance_num_retries shouldn't be a negative value. "
"The number of retries will be set to 0 until this is"
"corrected in the cinder.conf."))
from oslo.config import cfg
from cinder import exception
-from cinder.i18n import _
+from cinder.i18n import _, _LW
from cinder.openstack.common import log as logging
from cinder.scheduler import driver
from cinder.scheduler import scheduler_options
weighed_hosts = self._get_weighted_candidates(context, request_spec,
filter_properties)
if not weighed_hosts:
- LOG.warning(_('No weighed hosts found for volume '
- 'with properties: %s'),
+ LOG.warning(_LW('No weighed hosts found for volume '
+ 'with properties: %s'),
filter_properties['request_spec']['volume_type'])
return None
return self._choose_top_host(weighed_hosts, request_spec)
import math
-from cinder.i18n import _
+from cinder.i18n import _LE, _LW
from cinder.openstack.common import log as logging
from cinder.openstack.common.scheduler import filters
if host_state.free_capacity_gb is None:
# Fail Safe
- LOG.error(_("Free capacity not set: "
- "volume node info collection broken."))
+ LOG.error(_LE("Free capacity not set: "
+ "volume node info collection broken."))
return False
free_space = host_state.free_capacity_gb
"requested": volume_size,
"available": free}
if free < volume_size:
- LOG.warning(_("Insufficient free space for volume creation "
- "on host %(host)s (requested / avail): "
- "%(requested)s/%(available)s") % msg_args)
+ LOG.warning(_LW("Insufficient free space for volume creation "
+ "on host %(host)s (requested / avail): "
+ "%(requested)s/%(available)s") % msg_args)
else:
LOG.debug("Sufficient free space for volume creation "
"on host %(host)s (requested / avail): "
from cinder import exception
from cinder import flow_utils
-from cinder.i18n import _
+from cinder.i18n import _, _LE
from cinder.openstack.common import log as logging
from cinder import rpc
from cinder import utils
try:
self._notify_failure(context, request_spec, cause)
finally:
- LOG.error(_("Failed to run task %(name)s: %(cause)s") %
+ LOG.error(_LE("Failed to run task %(name)s: %(cause)s") %
{'cause': cause, 'name': self.name})
def _notify_failure(self, context, request_spec, cause):
rpc.get_notifier('scheduler').error(context, self.FAILURE_TOPIC,
payload)
except exception.CinderException:
- LOG.exception(_("Failed notifying on %(topic)s "
- "payload %(payload)s") %
+ LOG.exception(_LE("Failed notifying on %(topic)s "
+ "payload %(payload)s") %
{'topic': self.FAILURE_TOPIC, 'payload': payload})
def execute(self, context, request_spec, filter_properties):
from cinder import db
from cinder import exception
-from cinder.i18n import _
+from cinder.i18n import _, _LI
from cinder.openstack.common import log as logging
from cinder.openstack.common.scheduler import filters
from cinder.openstack.common.scheduler import weights
# remove non-active hosts from host_state_map
nonactive_hosts = set(self.host_state_map.keys()) - active_hosts
for host in nonactive_hosts:
- LOG.info(_("Removing non-active host: %(host)s from "
- "scheduler cache.") % {'host': host})
+ LOG.info(_LI("Removing non-active host: %(host)s from "
+ "scheduler cache.") % {'host': host})
del self.host_state_map[host]
# build a pool_state map and return that map instead of host_state_map
from cinder import db
from cinder import exception
from cinder import flow_utils
-from cinder.i18n import _
+from cinder.i18n import _, _LE
from cinder import manager
from cinder.openstack.common import log as logging
from cinder import quota
{'status': 'error'})
except Exception:
with excutils.save_and_reraise_exception():
- LOG.exception(_("Failed to create consistency group "
- "%(group_id)s."),
+ LOG.exception(_LE("Failed to create consistency group "
+ "%(group_id)s."),
{'group_id': group_id})
db.consistencygroup_update(context, group_id,
{'status': 'error'})
snapshot_id,
image_id)
except Exception:
- LOG.exception(_("Failed to create scheduler manager volume flow"))
+ LOG.exception(_LE("Failed to create scheduler "
+ "manager volume flow"))
raise exception.CinderException(
_("Failed to create scheduler manager volume flow"))
from oslo.config import cfg
from oslo.utils import timeutils
-from cinder.i18n import _
+from cinder.i18n import _LE
from cinder.openstack.common import log as logging
try:
return os.path.getmtime(filename)
except os.error as e:
- LOG.exception(_("Could not stat scheduler options file "
- "%(filename)s: '%(e)s'"),
+ LOG.exception(_LE("Could not stat scheduler options file "
+ "%(filename)s: '%(e)s'"),
{'filename': filename, 'e': e})
raise
try:
return json.load(handle)
except ValueError as e:
- LOG.exception(_("Could not decode scheduler options: '%s'") % e)
+ LOG.exception(_LE("Could not decode scheduler options: '%s'") % e)
return {}
def _get_time_now(self):
from cinder.db import base
from cinder import exception
-from cinder.i18n import _
+from cinder.i18n import _, _LE, _LI
from cinder.openstack.common import log as logging
from cinder import quota
from cinder.volume import api as volume_api
gigabytes=-vol_ref['size'])
except Exception:
donor_reservations = None
- LOG.exception(_("Failed to update quota donating volume"
- " transfer id %s") % transfer_id)
+ LOG.exception(_LE("Failed to update quota donating volume"
+ " transfer id %s") % transfer_id)
try:
# Transfer ownership of the volume now, must use an elevated
QUOTAS.commit(context, reservations)
if donor_reservations:
QUOTAS.commit(context, donor_reservations, project_id=donor_id)
- LOG.info(_("Volume %s has been transferred.") % volume_id)
+ LOG.info(_LI("Volume %s has been transferred.") % volume_id)
except Exception:
with excutils.save_and_reraise_exception():
QUOTAS.rollback(context, reservations)
import paramiko
from cinder import exception
-from cinder.i18n import _
+from cinder.i18n import _, _LE
from cinder.openstack.common import log as logging
from cinder import utils
from cinder.zonemanager.drivers.brocade import brcd_fabric_opts as fabric_opts
nsinfo = self.get_nameserver_info()
except exception.FCSanLookupServiceException:
with excutils.save_and_reraise_exception():
- LOG.error(_("Failed collecting name server info from "
- "fabric %s") % fabric_ip)
+ LOG.error(_LE("Failed collecting name server info from"
+ " fabric %s") % fabric_ip)
except Exception as e:
msg = _("SSH connection failed "
"for %(fabric)s with error: %(err)s"
cli_output = self._get_switch_data(ZoneConstant.NS_SHOW)
except exception.FCSanLookupServiceException:
with excutils.save_and_reraise_exception():
- LOG.error(_("Failed collecting nsshow info for fabric"))
+ LOG.error(_LE("Failed collecting nsshow info for fabric"))
if cli_output:
nsinfo_list = self._parse_ns_output(cli_output)
try:
cli_output = self._get_switch_data(ZoneConstant.NS_CAM_SHOW)
except exception.FCSanLookupServiceException:
with excutils.save_and_reraise_exception():
- LOG.error(_("Failed collecting nscamshow"))
+ LOG.error(_LE("Failed collecting nscamshow"))
if cli_output:
nsinfo_list.extend(self._parse_ns_output(cli_output))
LOG.debug("Connector returning nsinfo-%s", nsinfo_list)
from oslo.utils import excutils
from cinder import exception
-from cinder.i18n import _
+from cinder.i18n import _, _LE
from cinder.openstack.common import log as logging
from cinder import ssh_utils
from cinder import utils
[ZoneConstant.GET_ACTIVE_ZONE_CFG])
except exception.BrocadeZoningCliException:
with excutils.save_and_reraise_exception():
- LOG.error(_("Failed getting active zone set "
- "from fabric %s"), self.switch_ip)
+ LOG.error(_LE("Failed getting active zone set "
+ "from fabric %s"), self.switch_ip)
try:
for line in switch_data:
line_split = re.split('\\t', line)
self.delete_zones(zone, activate, active_zone_set)
except exception.BrocadeZoningCliException:
with excutils.save_and_reraise_exception():
- LOG.error(_("Deleting zone failed %s"), zone)
+ LOG.error(_LE("Deleting zone failed %s"), zone)
LOG.debug("Deleted Zone before insert : %s", zone)
zone_members_with_sep = ';'.join(str(member) for
member in zones[zone])
cli_output = self._get_switch_info([cmd])
except exception.BrocadeZoningCliException:
with excutils.save_and_reraise_exception():
- LOG.error(_("Failed collecting nsshow "
- "info for fabric %s"), self.switch_ip)
+ LOG.error(_LE("Failed collecting nsshow "
+ "info for fabric %s"), self.switch_ip)
if (cli_output):
return_list = self._parse_ns_output(cli_output)
cli_output = None
firmware = int(ver[0] + ver[1])
return firmware > 63
else:
- LOG.error(_("No CLI output for firmware version check"))
+ LOG.error(_LE("No CLI output for firmware version check"))
return False
except processutils.ProcessExecutionError as e:
msg = _("Error while getting data via ssh: (command=%(cmd)s "
cmd=command)
except Exception:
with excutils.save_and_reraise_exception():
- LOG.error(_("Error running SSH command: %s") % command)
+ LOG.error(_LE("Error running SSH command: %s") % command)
def _ssh_execute(self, cmd_list, check_exit_code=True, attempts=1):
"""Execute cli with status update.
cmd=command)
except Exception as e:
with excutils.save_and_reraise_exception():
- LOG.error(_("Error executing command via ssh: %s"), e)
+ LOG.error(_LE("Error executing command via ssh: %s"), e)
finally:
if stdin:
stdin.flush()
from oslo.utils import importutils
from cinder import exception
-from cinder.i18n import _
+from cinder.i18n import _, _LE, _LI
from cinder.openstack.common import log as logging
from cinder.zonemanager.drivers.brocade import brcd_fabric_opts as fabric_opts
from cinder.zonemanager.drivers.fc_zone_driver import FCZoneDriver
:param initiator_target_map: Mapping of initiator to list of targets
"""
LOG.debug("Add connection for Fabric:%s", fabric)
- LOG.info(_("BrcdFCZoneDriver - Add connection "
- "for I-T map: %s"), initiator_target_map)
+ LOG.info(_LI("BrcdFCZoneDriver - Add connection "
+ "for I-T map: %s"), initiator_target_map)
zoning_policy = self.configuration.zoning_policy
zoning_policy_fab = self.fabric_configs[fabric].safe_get(
'zoning_policy')
if zoning_policy_fab:
zoning_policy = zoning_policy_fab
- LOG.info(_("Zoning policy for Fabric %s"), zoning_policy)
+ LOG.info(_LI("Zoning policy for Fabric %s"), zoning_policy)
cli_client = self._get_cli_client(fabric)
cfgmap_from_fabric = self._get_active_zone_set(cli_client)
zone_map[zone_name] = zone_members
else:
# This is I-T zoning, skip if zone already exists.
- LOG.info(_("Zone exists in I-T mode. "
- "Skipping zone creation %s"), zone_name)
+ LOG.info(_LI("Zone exists in I-T mode. "
+ "Skipping zone creation %s"), zone_name)
elif zoning_policy == 'initiator':
zone_members = [self.get_formatted_wwn(initiator)]
for t in t_list:
LOG.error(msg)
raise exception.FCZoneDriverException(msg)
- LOG.info(_("Zone map to add: %s"), zone_map)
+ LOG.info(_LI("Zone map to add: %s"), zone_map)
if len(zone_map) > 0:
try:
:param initiator_target_map: Mapping of initiator to list of targets
"""
LOG.debug("Delete connection for fabric:%s", fabric)
- LOG.info(_("BrcdFCZoneDriver - Delete connection for I-T map: %s"),
+ LOG.info(_LI("BrcdFCZoneDriver - Delete connection for I-T map: %s"),
initiator_target_map)
zoning_policy = self.configuration.zoning_policy
zoning_policy_fab = self.fabric_configs[fabric].safe_get(
if zoning_policy_fab:
zoning_policy = zoning_policy_fab
- LOG.info(_("Zoning policy for fabric %s"), zoning_policy)
+ LOG.info(_LI("Zoning policy for fabric %s"), zoning_policy)
conn = self._get_cli_client(fabric)
cfgmap_from_fabric = self._get_active_zone_set(conn)
else:
zones_to_delete.append(zone_name)
else:
- LOG.info(_("Zoning Policy: %s, not "
- "recognized"), zoning_policy)
+ LOG.info(_LI("Zoning Policy: %s, not "
+ "recognized"), zoning_policy)
LOG.debug("Final Zone map to update: %s", zone_map)
LOG.debug("Final Zone list to delete: %s", zones_to_delete)
try:
LOG.error(msg)
raise exception.FCZoneDriverException(msg)
with excutils.save_and_reraise_exception():
- LOG.error(_("Error getting name server "
- "info: %s"), ex)
+ LOG.error(_LE("Error getting name server "
+ "info: %s"), ex)
except Exception as e:
msg = (_("Failed to get name server info:%s") % e)
LOG.error(msg)
nsinfo)
if visible_targets:
- LOG.info(_("Filtered targets for SAN is: %s"),
+ LOG.info(_LI("Filtered targets for SAN is: %s"),
{fabric_name: visible_targets})
# getting rid of the ':' before returning
for idx, elem in enumerate(visible_targets):
import six
from cinder import exception
-from cinder.i18n import _
+from cinder.i18n import _, _LE
from cinder.openstack.common import log as logging
from cinder import ssh_utils
from cinder import utils
cli_output = self._get_switch_info(cmd)
except exception.FCSanLookupServiceException:
with excutils.save_and_reraise_exception():
- LOG.error(_("Failed collecting show fcns database for"
- " fabric"))
+ LOG.error(_LE("Failed collecting show fcns database for"
+ " fabric"))
if cli_output:
nsinfo_list = self._parse_ns_output(cli_output)
cmd=command)
except Exception:
with excutils.save_and_reraise_exception():
- LOG.error(_("Error running SSH command: %s") % command)
+ LOG.error(_LE("Error running SSH command: %s") % command)
def _ssh_execute(self, cmd_list, check_exit_code=True, attempts=1):
"""Execute cli with status update.
import six
from cinder import exception
-from cinder.i18n import _
+from cinder.i18n import _, _LE, _LI
from cinder.openstack.common import log as logging
from cinder import ssh_utils
from cinder import utils
' | no-more'])
except exception.CiscoZoningCliException:
with excutils.save_and_reraise_exception():
- LOG.error(_("Failed getting active zone set "
- "from fabric %s"), self.switch_ip)
+ LOG.error(_LE("Failed getting active zone set "
+ "from fabric %s"), self.switch_ip)
try:
for line in switch_data:
# Split on non-word characters,
active_zone_set, zone_status)
except exception.CiscoZoningCliException:
with excutils.save_and_reraise_exception():
- LOG.error(_("Deleting zone failed %s"), zone)
+ LOG.error(_LE("Deleting zone failed %s"), zone)
LOG.debug("Deleted Zone before insert : %s", zone)
zone_cmds.append(['zone', 'name', zone])
[ZoneConstant.GET_ZONE_STATUS, self.fabric_vsan])
except exception.CiscoZoningCliException:
with excutils.save_and_reraise_exception():
- LOG.error(_("Failed getting zone status "
- "from fabric %s"), self.switch_ip)
+ LOG.error(_LE("Failed getting zone status "
+ "from fabric %s"), self.switch_ip)
try:
for line in switch_data:
# Split on non-word characters,
self.fabric_vsan])
except exception.CiscoZoningCliException:
with excutils.save_and_reraise_exception():
- LOG.error(_("Failed collecting fcns database "
- "info for fabric %s"), self.switch_ip)
+ LOG.error(_LE("Failed collecting fcns database "
+ "info for fabric %s"), self.switch_ip)
if (cli_output):
return_list = self._parse_ns_output(cli_output)
- LOG.info(_("Connector returning fcnsinfo-%s"), return_list)
+ LOG.info(_LI("Connector returning fcnsinfo-%s"), return_list)
return return_list
cmd=command)
except Exception:
with excutils.save_and_reraise_exception():
- LOG.error(_("Error running SSH command: %s") % command)
+ LOG.error(_LE("Error running SSH command: %s") % command)
def _ssh_execute(self, cmd_list, check_exit_code=True, attempts=1):
"""Execute cli with status update.
import six
from cinder import exception
-from cinder.i18n import _
+from cinder.i18n import _, _LE, _LI
from cinder.openstack.common import log as logging
from cinder.zonemanager.drivers.cisco import cisco_fabric_opts as fabric_opts
from cinder.zonemanager.drivers.fc_zone_driver import FCZoneDriver
"""
LOG.debug("Add connection for Fabric:%s", fabric)
- LOG.info(_("CiscoFCZoneDriver - Add connection "
- "for I-T map: %s"), initiator_target_map)
+ LOG.info(_LI("CiscoFCZoneDriver - Add connection "
+ "for I-T map: %s"), initiator_target_map)
fabric_ip = self.fabric_configs[fabric].safe_get(
'cisco_fc_fabric_address')
fabric_user = self.fabric_configs[fabric].safe_get(
zoning_vsan = self.fabric_configs[fabric].safe_get('cisco_zoning_vsan')
- LOG.info(_("Zoning policy for Fabric %s"), zoning_policy)
+ LOG.info(_LI("Zoning policy for Fabric %s"), zoning_policy)
statusmap_from_fabric = self.get_zoning_status(
fabric_ip, fabric_user, fabric_pwd, fabric_port, zoning_vsan)
zone_map[zone_name] = zone_members
else:
# This is I-T zoning, skip if zone exists.
- LOG.info(_("Zone exists in I-T mode. "
- "Skipping zone creation %s"),
+ LOG.info(_LI("Zone exists in I-T mode. "
+ "Skipping zone creation %s"),
zone_name)
elif zoning_policy == 'initiator':
zone_members = [get_formatted_wwn(initiator)]
LOG.error(msg)
raise exception.FCZoneDriverException(msg)
- LOG.info(_("Zone map to add: %s"), zone_map)
+ LOG.info(_LI("Zone map to add: %s"), zone_map)
if len(zone_map) > 0:
conn = None
:param initiator_target_map: Mapping of initiator to list of targets
"""
LOG.debug("Delete connection for fabric:%s", fabric)
- LOG.info(_("CiscoFCZoneDriver - Delete connection for I-T map: %s"),
+ LOG.info(_LI("CiscoFCZoneDriver - Delete connection for I-T map: %s"),
initiator_target_map)
fabric_ip = self.fabric_configs[fabric].safe_get(
'cisco_fc_fabric_address')
zoning_vsan = self.fabric_configs[fabric].safe_get('cisco_zoning_vsan')
- LOG.info(_("Zoning policy for fabric %s"), zoning_policy)
+ LOG.info(_LI("Zoning policy for fabric %s"), zoning_policy)
statusmap_from_fabric = self.get_zoning_status(
fabric_ip, fabric_user, fabric_pwd, fabric_port, zoning_vsan)
else:
zones_to_delete.append(zone_name)
else:
- LOG.info(_("Zoning Policy: %s, not recognized"),
+ LOG.info(_LI("Zoning Policy: %s, not recognized"),
zoning_policy)
LOG.debug("Final Zone map to update: %s", zone_map)
LOG.debug("Final Zone list to delete: %s", zones_to_delete)
conn.cleanup()
except exception.CiscoZoningCliException as ex:
with excutils.save_and_reraise_exception():
- LOG.error(_("Error getting show fcns database "
- "info: %s"), six.text_type(ex))
+ LOG.error(_LE("Error getting show fcns database "
+ "info: %s"), six.text_type(ex))
except Exception as e:
msg = (_("Failed to get show fcns database info:%s") %
six.text_type(e))
lambda x: x in formatted_target_list, nsinfo)
if visible_targets:
- LOG.info(_("Filtered targets for SAN is: %s"),
+ LOG.info(_LI("Filtered targets for SAN is: %s"),
{fabric_name: visible_targets})
# getting rid of the ':' before returning
for idx, elem in enumerate(visible_targets):
from oslo.utils import importutils
from cinder import exception
-from cinder.i18n import _
+from cinder.i18n import _, _LI
from cinder.openstack.common import log as logging
from cinder.volume import configuration as config
from cinder.zonemanager import fc_common
i_t_map = {initiator: t_list}
valid_i_t_map = self.get_valid_initiator_target_map(
i_t_map, True)
- LOG.info(_("Final filtered map for fabric: %s"),
+ LOG.info(_LI("Final filtered map for fabric: %s"),
{fabric: valid_i_t_map})
# Call driver to add connection control
self.driver.add_connection(fabric, valid_i_t_map)
- LOG.info(_("Add Connection: Finished iterating "
- "over all target list"))
+ LOG.info(_LI("Add Connection: Finished iterating "
+ "over all target list"))
except Exception as e:
msg = _("Failed adding connection for fabric=%(fabric)s: "
"Error:%(err)s") % {'fabric': connected_fabric,
try:
for initiator in initiator_target_map.keys():
target_list = initiator_target_map[initiator]
- LOG.info(_("Delete connection Target List:%s"),
+ LOG.info(_LI("Delete connection Target List:%s"),
{initiator: target_list})
# get SAN context for the target list
i_t_map = {initiator: t_list}
valid_i_t_map = self.get_valid_initiator_target_map(
i_t_map, False)
- LOG.info(_("Final filtered map for delete "
- "connection: %s"), valid_i_t_map)
+ LOG.info(_LI("Final filtered map for delete "
+ "connection: %s"), valid_i_t_map)
# Call driver to delete connection control
if len(valid_i_t_map) > 0:
if t_list:
filtered_i_t_map[initiator] = t_list
else:
- LOG.info(_("No targets to add or remove connection for "
- "I: %s"), initiator)
+ LOG.info(_LI("No targets to add or remove connection for "
+ "I: %s"), initiator)
return filtered_i_t_map
"""
import logging
-from cinder.i18n import _
+from cinder.i18n import _, _LI
from cinder.openstack.common import log
from cinder.volume.configuration import Configuration
from cinder.volume import manager
if config.safe_get('zoning_mode') == 'fabric':
LOG.debug("FC Zone Manager enabled.")
zm = fc_zone_manager.ZoneManager(configuration=config)
- LOG.info(_("Using FC Zone Manager %(zm_version)s,"
- " Driver %(drv_name)s %(drv_version)s.") %
+ LOG.info(_LI("Using FC Zone Manager %(zm_version)s,"
+ " Driver %(drv_name)s %(drv_version)s.") %
{'zm_version': zm.get_version(),
'drv_name': zm.driver.__class__.__name__,
'drv_version': zm.driver.get_version()})
if config.safe_get('zoning_mode') == 'fabric':
LOG.debug("FC Lookup Service enabled.")
lookup = fc_san_lookup_service.FCSanLookupService(configuration=config)
- LOG.info(_("Using FC lookup service %s") % lookup.lookup_service)
+ LOG.info(_LI("Using FC lookup service %s") % lookup.lookup_service)
return lookup
else:
LOG.debug("FC Lookup Service not enabled in cinder.conf.")