def initialize_connection(self, volume, connector):
"""Map a volume to a host and return target iSCSI information."""
- LOG.debug(_('initialize_connection: volume name: %(vol)s '
- 'host: %(host)s initiator: %(ini)s')
+ LOG.debug(_('initialize_connection: volume name: %(vol)s, '
+ 'host: %(host)s, initiator: %(ini)s')
% {'vol': volume['name'],
'host': connector['host'],
'ini': connector['initiator']})
iqn = iqn_prefix + ':' + iqn_suffix + ':' + port_info[3]
- LOG.debug(_('_get_tgt_iqn: iSCSI target iqn is %s') % iqn)
+ LOG.debug(_('_get_tgt_iqn: iSCSI target iqn is %s.') % iqn)
return (iqn, port_info[0])
def terminate_connection(self, volume, connector, **kwargs):
"""Terminate the map."""
- LOG.debug(_('terminate_connection: volume: %(vol)s host: %(host)s '
+ LOG.debug(_('terminate_connection: volume: %(vol)s, host: %(host)s, '
'connector: %(initiator)s')
% {'vol': volume['name'],
'host': connector['host'],
break
else:
LOG.warn(_('_remove_iscsi_port: iSCSI port was not found '
- 'on host %(hostid)s') % {'hostid': hostid})
+ 'on host %(hostid)s.') % {'hostid': hostid})
# Delete host if no initiator added to it.
if port_num == 0:
def initialize_connection(self, volume, connector):
"""Create FC connection between a volume and a host."""
- LOG.debug(_('initialize_connection: volume name: %(vol)s '
- 'host: %(host)s initiator: %(wwn)s')
+ LOG.debug(_('initialize_connection: volume name: %(vol)s, '
+ 'host: %(host)s, initiator: %(wwn)s')
% {'vol': volume['name'],
'host': connector['host'],
'wwn': connector['wwpns']})
def terminate_connection(self, volume, connector, **kwargs):
"""Terminate the map."""
- LOG.debug(_('terminate_connection: volume: %(vol)s host: %(host)s '
+ LOG.debug(_('terminate_connection: volume: %(vol)s, host: %(host)s, '
'connector: %(initiator)s')
% {'vol': volume['name'],
'host': connector['host'],
result = result + channel.recv(8192)
except socket.timeout:
raise exception.CinderException(_('ssh_read: Read '
- 'SSH timeout'))
+ 'SSH timeout.'))
else:
- # Complete CLI response starts with CLI cmd and
- # ends with "username:/>".
- if result.startswith(cmd) and result.endswith(user + ':/>'):
- if not re.search('Welcome', result):
+ # CLI returns welcome information when first log in. So need to
+ # deal differently.
+ if not re.search('Welcome', result):
+ # Complete CLI response starts with CLI cmd and
+ # ends with "username:/>".
+ if result.startswith(cmd) and result.endswith(user + ':/>'):
break
- # CLI returns welcome information when first log in.
- elif re.search(user + ':/>' + cmd, result):
+ # Some commands need to send 'y'.
+ elif re.search('(y/n)', result):
break
- # Some commands need to send 'y'.
- elif re.search('(y/n)', result):
+ # Reach maximum limit of SSH connection.
+ elif re.search('No response message', result):
+ msg = _('No response message. Please check system status.')
+ raise exception.CinderException(msg)
+ elif (re.search(user + ':/>' + cmd, result) and
+ result.endswith(user + ':/>')):
break
- # Reach maximum limit of SSH connection.
- elif re.search('No response message', result):
- msg = _('No response message. Please check system status.')
- raise exception.CinderException(msg)
+
# Filter the last line: username:/> .
result = '\r\n'.join(result.split('\r\n')[:-1])
# Filter welcome information.
def do_setup(self, context):
"""Check config file."""
- LOG.debug(_('do_setup.'))
+ LOG.debug(_('do_setup'))
self._check_conf_file()
self.login_info = self._get_login_info()
"""Create a new volume."""
volume_name = self._name_translate(volume['name'])
- LOG.debug(_('create_volume: volume name: %s.') % volume_name)
+ LOG.debug(_('create_volume: volume name: %s') % volume_name)
self._update_login_info()
if int(volume['size']) == 0:
conf_params['PrefetchTimes'] = prefetch.attrib['Value'].strip()
else:
LOG.debug(_('_parse_conf_lun_params: Use default prefetch type. '
- 'Prefetch type: Intelligent.'))
+ 'Prefetch type: Intelligent'))
pools_conf = root.findall('LUN/StoragePool')
for pool in pools_conf:
def delete_volume(self, volume):
volume_name = self._name_translate(volume['name'])
- LOG.debug(_('delete_volume: volume name: %s.') % volume_name)
+ LOG.debug(_('delete_volume: volume name: %s') % volume_name)
self._update_login_info()
volume_id = volume.get('provider_location', None)
volume_name = self._name_translate(volume['name'])
LOG.debug(_('create_volume_from_snapshot: snapshot '
- 'name: %(snapshot)s, volume name: %(volume)s.')
+ 'name: %(snapshot)s, volume name: %(volume)s')
% {'snapshot': snapshot_name,
'volume': volume_name})
src_vol_name = self._name_translate(src_volume['name'])
tgt_vol_name = self._name_translate(tgt_volume['name'])
- LOG.debug(_('create_cloned_volume: src volume: %(src)s '
+ LOG.debug(_('create_cloned_volume: src volume: %(src)s, '
'tgt volume: %(tgt)s') % {'src': src_vol_name,
'tgt': tgt_vol_name})
snapshot_name = self._name_translate(snapshot['name'])
volume_name = self._name_translate(snapshot['volume_name'])
- LOG.debug(_('create_snapshot: snapshot name: %(snapshot)s '
+ LOG.debug(_('create_snapshot: snapshot name: %(snapshot)s, '
'volume name: %(volume)s')
% {'snapshot': snapshot_name,
'volume': volume_name})
snapshot_name = self._name_translate(snapshot['name'])
volume_name = self._name_translate(snapshot['volume_name'])
- LOG.debug(_('delete_snapshot: snapshot name: %(snapshot)s '
+ LOG.debug(_('delete_snapshot: snapshot name: %(snapshot)s, '
'volume name: %(volume)s') % {'snapshot': snapshot_name,
'volume': volume_name})
'hostlunid': new_hostlun_id})
out = self._execute_cli(cli_cmd)
- msg = ('Failed to map lun %s to host %s. host lun ID: %s'
+ msg = ('Failed to map LUN %s to host %s. host LUN ID: %s'
% (volume_id, host_id, new_hostlun_id))
self._assert_cli_operate_out('map_volume', msg, cli_cmd, out)
return lun_details
def change_lun_ctr(self, lun_id, ctr):
- LOG.debug(_('change_lun_ctr: Changing LUN %(lun)s ctr to %(ctr)s')
+ LOG.debug(_('change_lun_ctr: Changing LUN %(lun)s ctr to %(ctr)s.')
% {'lun': lun_id, 'ctr': ctr})
cli_cmd = 'chglun -lun %s -c %s' % (lun_id, ctr)
def _update_volume_stats(self):
"""Retrieve stats info from volume group."""
- LOG.debug(_("_update_volume_stats: Updating volume stats"))
+ LOG.debug(_("_update_volume_stats: Updating volume stats."))
data = {}
data['vendor_name'] = 'Huawei'
data['total_capacity_gb'] = 'infinite'
def do_setup(self, context):
"""Check config file."""
- LOG.debug(_('do_setup.'))
+ LOG.debug(_('do_setup'))
self._check_conf_file()
self.lun_distribution = self._get_lun_ctr_info()
elif re.search('Dorado5100$', line):
return 'Dorado5100'
else:
- LOG.error(_('_get_device_type: The drivers only support'
+ LOG.error(_('_get_device_type: The driver only supports '
'Dorado5100 and Dorado 2100 G2 now.'))
raise exception.InvalidResults()
ctr_info = [0, 0]
(c, n) = ((2, 4) if self.device_type == 'Dorado2100 G2' else (3, 5))
for lun in luns:
- if lun[n].startswith('OpenStack'):
+ if lun[n].startswith(VOL_AND_SNAP_NAME_PREFIX):
if lun[c] == 'A':
ctr_info[0] += 1
else: