Merge "Remove six from Inspur driver"
This commit is contained in:
commit
4c4b51bb2f
|
@ -19,7 +19,6 @@ import re
|
||||||
|
|
||||||
from oslo_concurrency import processutils
|
from oslo_concurrency import processutils
|
||||||
from oslo_utils import units
|
from oslo_utils import units
|
||||||
import six
|
|
||||||
|
|
||||||
from cinder import exception
|
from cinder import exception
|
||||||
from cinder import utils
|
from cinder import utils
|
||||||
|
@ -277,8 +276,8 @@ class FakeInStorage(object):
|
||||||
ids.sort()
|
ids.sort()
|
||||||
for index, n in enumerate(ids):
|
for index, n in enumerate(ids):
|
||||||
if n > index:
|
if n > index:
|
||||||
return six.text_type(index)
|
return str(index)
|
||||||
return six.text_type(len(ids))
|
return str(len(ids))
|
||||||
|
|
||||||
# Check if name is valid
|
# Check if name is valid
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
@ -426,7 +425,7 @@ class FakeInStorage(object):
|
||||||
num = num * 1024
|
num = num * 1024
|
||||||
unit_index += 1
|
unit_index += 1
|
||||||
|
|
||||||
return six.text_type(num)
|
return str(num)
|
||||||
|
|
||||||
def _cmd_lslicense(self, **kwargs):
|
def _cmd_lslicense(self, **kwargs):
|
||||||
rows = [None] * 3
|
rows = [None] * 3
|
||||||
|
@ -476,7 +475,7 @@ class FakeInStorage(object):
|
||||||
for i in range(pool_num):
|
for i in range(pool_num):
|
||||||
row_data = [str(i + 1),
|
row_data = [str(i + 1),
|
||||||
self._flags['instorage_mcs_volpool_name'][i], 'online',
|
self._flags['instorage_mcs_volpool_name'][i], 'online',
|
||||||
'1', six.text_type(len(self._volumes_list)),
|
'1', str(len(self._volumes_list)),
|
||||||
'3573412790272', '256', '3529926246400',
|
'3573412790272', '256', '3529926246400',
|
||||||
'1693247906775',
|
'1693247906775',
|
||||||
'26843545600', '38203734097', '47', '80', 'auto',
|
'26843545600', '38203734097', '47', '80', 'auto',
|
||||||
|
@ -774,7 +773,7 @@ port_speed!N/A
|
||||||
cap = self._convert_bytes_units(vol['capacity'])
|
cap = self._convert_bytes_units(vol['capacity'])
|
||||||
else:
|
else:
|
||||||
cap = vol['capacity']
|
cap = vol['capacity']
|
||||||
rows.append([six.text_type(vol['id']), vol['name'],
|
rows.append([str(vol['id']), vol['name'],
|
||||||
vol['IO_group_id'],
|
vol['IO_group_id'],
|
||||||
vol['IO_group_name'], 'online', '0',
|
vol['IO_group_name'], 'online', '0',
|
||||||
get_test_pool(),
|
get_test_pool(),
|
||||||
|
@ -799,7 +798,7 @@ port_speed!N/A
|
||||||
item = self._convert_bytes_units(item)
|
item = self._convert_bytes_units(item)
|
||||||
rows = []
|
rows = []
|
||||||
|
|
||||||
rows.append(['id', six.text_type(vol['id'])])
|
rows.append(['id', str(vol['id'])])
|
||||||
rows.append(['name', vol['name']])
|
rows.append(['name', vol['name']])
|
||||||
rows.append(['IO_group_id', vol['IO_group_id']])
|
rows.append(['IO_group_id', vol['IO_group_id']])
|
||||||
rows.append(['IO_group_name', vol['IO_group_name']])
|
rows.append(['IO_group_name', vol['IO_group_name']])
|
||||||
|
@ -1018,7 +1017,7 @@ port_speed!N/A
|
||||||
filter_value = kwargs['filtervalue'].split('=')[1]
|
filter_value = kwargs['filtervalue'].split('=')[1]
|
||||||
to_delete = []
|
to_delete = []
|
||||||
for k, v in self._lcmappings_list.items():
|
for k, v in self._lcmappings_list.items():
|
||||||
if six.text_type(v[filter_key]) == filter_value:
|
if str(v[filter_key]) == filter_value:
|
||||||
source = self._volumes_list[v['source']]
|
source = self._volumes_list[v['source']]
|
||||||
target = self._volumes_list[v['target']]
|
target = self._volumes_list[v['target']]
|
||||||
self._state_transition('wait', v)
|
self._state_transition('wait', v)
|
||||||
|
@ -1065,16 +1064,16 @@ port_speed!N/A
|
||||||
if self._lcconsistgrp_list[cg_id]['name'] == kwargs['obj']:
|
if self._lcconsistgrp_list[cg_id]['name'] == kwargs['obj']:
|
||||||
lcconsistgrp = self._lcconsistgrp_list[cg_id]
|
lcconsistgrp = self._lcconsistgrp_list[cg_id]
|
||||||
rows = []
|
rows = []
|
||||||
rows.append(['id', six.text_type(cg_id)])
|
rows.append(['id', str(cg_id)])
|
||||||
rows.append(['name', lcconsistgrp['name']])
|
rows.append(['name', lcconsistgrp['name']])
|
||||||
rows.append(['status', lcconsistgrp['status']])
|
rows.append(['status', lcconsistgrp['status']])
|
||||||
rows.append(['autodelete',
|
rows.append(['autodelete',
|
||||||
six.text_type(lcconsistgrp['autodelete'])])
|
str(lcconsistgrp['autodelete'])])
|
||||||
rows.append(['start_time',
|
rows.append(['start_time',
|
||||||
six.text_type(lcconsistgrp['start_time'])])
|
str(lcconsistgrp['start_time'])])
|
||||||
|
|
||||||
for lcmap_id in lcconsistgrp['lcmaps'].keys():
|
for lcmap_id in lcconsistgrp['lcmaps'].keys():
|
||||||
rows.append(['FC_mapping_id', six.text_type(lcmap_id)])
|
rows.append(['FC_mapping_id', str(lcmap_id)])
|
||||||
rows.append(['FC_mapping_name',
|
rows.append(['FC_mapping_name',
|
||||||
lcconsistgrp['lcmaps'][lcmap_id]])
|
lcconsistgrp['lcmaps'][lcmap_id]])
|
||||||
|
|
||||||
|
@ -1170,7 +1169,7 @@ port_speed!N/A
|
||||||
filter_key = kwargs['filtervalue'].split('=')[0]
|
filter_key = kwargs['filtervalue'].split('=')[0]
|
||||||
filter_value = kwargs['filtervalue'].split('=')[1]
|
filter_value = kwargs['filtervalue'].split('=')[1]
|
||||||
for k, v in self._rcrelationship_list.items():
|
for k, v in self._rcrelationship_list.items():
|
||||||
if six.text_type(v[filter_key]) == filter_value:
|
if str(v[filter_key]) == filter_value:
|
||||||
self._rc_state_transition('wait', v)
|
self._rc_state_transition('wait', v)
|
||||||
|
|
||||||
if self._next_cmd_error['lsrcrelationship'] == 'speed_up':
|
if self._next_cmd_error['lsrcrelationship'] == 'speed_up':
|
||||||
|
@ -1232,7 +1231,7 @@ port_speed!N/A
|
||||||
filter_key = kwargs['filtervalue'].split('=')[0]
|
filter_key = kwargs['filtervalue'].split('=')[0]
|
||||||
filter_value = kwargs['filtervalue'].split('=')[1]
|
filter_value = kwargs['filtervalue'].split('=')[1]
|
||||||
for k, v in self._partnership_list.items():
|
for k, v in self._partnership_list.items():
|
||||||
if six.text_type(v[filter_key]) == filter_value:
|
if str(v[filter_key]) == filter_value:
|
||||||
rows.append([v['id'], v['name'], v['location'],
|
rows.append([v['id'], v['name'], v['location'],
|
||||||
v['partnership'], v['type'], v['cluster_ip'],
|
v['partnership'], v['type'], v['cluster_ip'],
|
||||||
v['event_log_sequence']])
|
v['event_log_sequence']])
|
||||||
|
@ -1377,7 +1376,7 @@ port_speed!N/A
|
||||||
curr_size = int(self._volumes_list[vol_name]['capacity'])
|
curr_size = int(self._volumes_list[vol_name]['capacity'])
|
||||||
addition = size * units.Gi
|
addition = size * units.Gi
|
||||||
self._volumes_list[vol_name]['capacity'] = (
|
self._volumes_list[vol_name]['capacity'] = (
|
||||||
six.text_type(curr_size + addition))
|
str(curr_size + addition))
|
||||||
return ('', '')
|
return ('', '')
|
||||||
|
|
||||||
def _add_port_to_host(self, host_info, **kwargs):
|
def _add_port_to_host(self, host_info, **kwargs):
|
||||||
|
@ -1408,7 +1407,7 @@ port_speed!N/A
|
||||||
if 'name' in kwargs:
|
if 'name' in kwargs:
|
||||||
host_name = kwargs['name'].strip('\'\"')
|
host_name = kwargs['name'].strip('\'\"')
|
||||||
else:
|
else:
|
||||||
host_name = 'host' + six.text_type(host_info['id'])
|
host_name = 'host' + str(host_info['id'])
|
||||||
|
|
||||||
if self._is_invalid_name(host_name):
|
if self._is_invalid_name(host_name):
|
||||||
return self._errors['CMMVC6527E']
|
return self._errors['CMMVC6527E']
|
||||||
|
|
|
@ -18,7 +18,6 @@
|
||||||
from unittest import mock
|
from unittest import mock
|
||||||
|
|
||||||
from eventlet import greenthread
|
from eventlet import greenthread
|
||||||
import six
|
|
||||||
|
|
||||||
from cinder import context
|
from cinder import context
|
||||||
import cinder.db
|
import cinder.db
|
||||||
|
@ -327,7 +326,7 @@ class InStorageMCSISCSIDriverTestCase(test.TestCase):
|
||||||
for k, v in exp_m_path['data'].items():
|
for k, v in exp_m_path['data'].items():
|
||||||
if k in ('target_iqns', 'target_portals'):
|
if k in ('target_iqns', 'target_portals'):
|
||||||
# These are randomly ordered lists
|
# These are randomly ordered lists
|
||||||
six.assertCountEqual(self, v, ret['data'][k])
|
self.assertCountEqual(v, ret['data'][k])
|
||||||
else:
|
else:
|
||||||
self.assertEqual(v, ret['data'][k])
|
self.assertEqual(v, ret['data'][k])
|
||||||
|
|
||||||
|
@ -403,8 +402,7 @@ class InStorageMCSISCSIDriverTestCase(test.TestCase):
|
||||||
for host_exists in ['yes-auth', 'yes-noauth', 'no']:
|
for host_exists in ['yes-auth', 'yes-noauth', 'no']:
|
||||||
self._set_flag('instorage_mcs_iscsi_chap_enabled',
|
self._set_flag('instorage_mcs_iscsi_chap_enabled',
|
||||||
auth_enabled)
|
auth_enabled)
|
||||||
case = 'en' + six.text_type(
|
case = 'en' + str(auth_enabled) + 'ex' + str(host_exists)
|
||||||
auth_enabled) + 'ex' + six.text_type(host_exists)
|
|
||||||
conn_na = {'initiator': 'test:init:%s' % 56789,
|
conn_na = {'initiator': 'test:init:%s' % 56789,
|
||||||
'ip': '11.11.11.11',
|
'ip': '11.11.11.11',
|
||||||
'host': 'host-%s' % case}
|
'host': 'host-%s' % case}
|
||||||
|
|
|
@ -30,7 +30,6 @@ from oslo_utils import excutils
|
||||||
from oslo_utils import strutils
|
from oslo_utils import strutils
|
||||||
from oslo_utils import units
|
from oslo_utils import units
|
||||||
import paramiko
|
import paramiko
|
||||||
import six
|
|
||||||
|
|
||||||
from cinder.common import constants
|
from cinder.common import constants
|
||||||
from cinder import context
|
from cinder import context
|
||||||
|
@ -420,7 +419,7 @@ class InStorageMCSCommonDriver(driver.VolumeDriver, san.SanDriver):
|
||||||
pool = volume_utils.extract_host(volume.host, 'pool')
|
pool = volume_utils.extract_host(volume.host, 'pool')
|
||||||
|
|
||||||
opts['iogrp'] = self._assistant.select_io_group(self._state, opts)
|
opts['iogrp'] = self._assistant.select_io_group(self._state, opts)
|
||||||
self._assistant.create_vdisk(volume.name, six.text_type(volume.size),
|
self._assistant.create_vdisk(volume.name, str(volume.size),
|
||||||
'gb', pool, opts)
|
'gb', pool, opts)
|
||||||
if opts['qos']:
|
if opts['qos']:
|
||||||
self._assistant.add_vdisk_qos(volume.name, opts['qos'])
|
self._assistant.add_vdisk_qos(volume.name, opts['qos'])
|
||||||
|
@ -563,7 +562,7 @@ class InStorageMCSCommonDriver(driver.VolumeDriver, san.SanDriver):
|
||||||
msg = (_('Failed to extend a volume with remote copy '
|
msg = (_('Failed to extend a volume with remote copy '
|
||||||
'%(volume)s. Exception: '
|
'%(volume)s. Exception: '
|
||||||
'%(err)s.') % {'volume': volume.id,
|
'%(err)s.') % {'volume': volume.id,
|
||||||
'err': six.text_type(e)})
|
'err': str(e)})
|
||||||
LOG.error(msg)
|
LOG.error(msg)
|
||||||
raise exception.VolumeDriverException(message=msg)
|
raise exception.VolumeDriverException(message=msg)
|
||||||
else:
|
else:
|
||||||
|
@ -2010,7 +2009,7 @@ class InStorageAssistant(object):
|
||||||
# Before we start, make sure host name is a string and that we have
|
# Before we start, make sure host name is a string and that we have
|
||||||
# one port at least .
|
# one port at least .
|
||||||
host_name = connector['host']
|
host_name = connector['host']
|
||||||
if not isinstance(host_name, six.string_types):
|
if not isinstance(host_name, str):
|
||||||
msg = _('create_host: Host name is not unicode or string.')
|
msg = _('create_host: Host name is not unicode or string.')
|
||||||
LOG.error(msg)
|
LOG.error(msg)
|
||||||
raise exception.VolumeDriverException(message=msg)
|
raise exception.VolumeDriverException(message=msg)
|
||||||
|
@ -2027,7 +2026,7 @@ class InStorageAssistant(object):
|
||||||
raise exception.VolumeDriverException(message=msg)
|
raise exception.VolumeDriverException(message=msg)
|
||||||
|
|
||||||
# Build a host name for the InStorage host - first clean up the name
|
# Build a host name for the InStorage host - first clean up the name
|
||||||
if isinstance(host_name, six.text_type):
|
if isinstance(host_name, str):
|
||||||
host_name = unicodedata.normalize('NFKD', host_name).encode(
|
host_name = unicodedata.normalize('NFKD', host_name).encode(
|
||||||
'ascii', 'replace').decode('ascii')
|
'ascii', 'replace').decode('ascii')
|
||||||
|
|
||||||
|
@ -2884,7 +2883,7 @@ class InStorageAssistant(object):
|
||||||
# CMMVC5959E is the code in InStorage, meaning that
|
# CMMVC5959E is the code in InStorage, meaning that
|
||||||
# there is a relationship that already has this name on the
|
# there is a relationship that already has this name on the
|
||||||
# master cluster.
|
# master cluster.
|
||||||
if 'CMMVC5959E' not in six.text_type(e):
|
if 'CMMVC5959E' not in str(e):
|
||||||
# If there is no relation between the primary and the
|
# If there is no relation between the primary and the
|
||||||
# secondary back-end storage, the exception is raised.
|
# secondary back-end storage, the exception is raised.
|
||||||
raise
|
raise
|
||||||
|
@ -3335,15 +3334,15 @@ class InStorageSSH(object):
|
||||||
def mkippartnership(self, ip_v4, bandwidth=1000, backgroundcopyrate=50):
|
def mkippartnership(self, ip_v4, bandwidth=1000, backgroundcopyrate=50):
|
||||||
ssh_cmd = ['mcsop', 'mkippartnership', '-type', 'ipv4',
|
ssh_cmd = ['mcsop', 'mkippartnership', '-type', 'ipv4',
|
||||||
'-clusterip', ip_v4, '-linkbandwidthmbits',
|
'-clusterip', ip_v4, '-linkbandwidthmbits',
|
||||||
six.text_type(bandwidth),
|
str(bandwidth),
|
||||||
'-backgroundcopyrate', six.text_type(backgroundcopyrate)]
|
'-backgroundcopyrate', str(backgroundcopyrate)]
|
||||||
return self.run_ssh_assert_no_output(ssh_cmd)
|
return self.run_ssh_assert_no_output(ssh_cmd)
|
||||||
|
|
||||||
def mkfcpartnership(self, system_name, bandwidth=1000,
|
def mkfcpartnership(self, system_name, bandwidth=1000,
|
||||||
backgroundcopyrate=50):
|
backgroundcopyrate=50):
|
||||||
ssh_cmd = ['mcsop', 'mkfcpartnership', '-linkbandwidthmbits',
|
ssh_cmd = ['mcsop', 'mkfcpartnership', '-linkbandwidthmbits',
|
||||||
six.text_type(bandwidth),
|
str(bandwidth),
|
||||||
'-backgroundcopyrate', six.text_type(backgroundcopyrate),
|
'-backgroundcopyrate', str(backgroundcopyrate),
|
||||||
system_name]
|
system_name]
|
||||||
return self.run_ssh_assert_no_output(ssh_cmd)
|
return self.run_ssh_assert_no_output(ssh_cmd)
|
||||||
|
|
||||||
|
@ -3371,7 +3370,7 @@ class InStorageSSH(object):
|
||||||
|
|
||||||
def mkvdisk(self, name, size, units, pool, opts, params):
|
def mkvdisk(self, name, size, units, pool, opts, params):
|
||||||
ssh_cmd = ['mcsop', 'mkvdisk', '-name', name, '-mdiskgrp',
|
ssh_cmd = ['mcsop', 'mkvdisk', '-name', name, '-mdiskgrp',
|
||||||
'"%s"' % pool, '-iogrp', six.text_type(opts['iogrp']),
|
'"%s"' % pool, '-iogrp', str(opts['iogrp']),
|
||||||
'-size', size, '-unit', units] + params
|
'-size', size, '-unit', units] + params
|
||||||
try:
|
try:
|
||||||
return self.run_ssh_check_created(ssh_cmd)
|
return self.run_ssh_check_created(ssh_cmd)
|
||||||
|
@ -3404,7 +3403,7 @@ class InStorageSSH(object):
|
||||||
|
|
||||||
def expandvdisksize(self, vdisk, amount):
|
def expandvdisksize(self, vdisk, amount):
|
||||||
ssh_cmd = (
|
ssh_cmd = (
|
||||||
['mcsop', 'expandvdisksize', '-size', six.text_type(amount),
|
['mcsop', 'expandvdisksize', '-size', str(amount),
|
||||||
'-unit', 'gb', '"%s"' % vdisk])
|
'-unit', 'gb', '"%s"' % vdisk])
|
||||||
self.run_ssh_assert_no_output(ssh_cmd)
|
self.run_ssh_assert_no_output(ssh_cmd)
|
||||||
|
|
||||||
|
@ -3414,7 +3413,7 @@ class InStorageSSH(object):
|
||||||
if not full_copy:
|
if not full_copy:
|
||||||
ssh_cmd.extend(['-copyrate', '0'])
|
ssh_cmd.extend(['-copyrate', '0'])
|
||||||
else:
|
else:
|
||||||
ssh_cmd.extend(['-copyrate', six.text_type(copy_rate)])
|
ssh_cmd.extend(['-copyrate', str(copy_rate)])
|
||||||
if consistgrp:
|
if consistgrp:
|
||||||
ssh_cmd.extend(['-consistgrp', consistgrp])
|
ssh_cmd.extend(['-consistgrp', consistgrp])
|
||||||
out, err = self._ssh(ssh_cmd, check_exit_code=False)
|
out, err = self._ssh(ssh_cmd, check_exit_code=False)
|
||||||
|
@ -3518,7 +3517,7 @@ class CLIParser(object):
|
||||||
vs = []
|
vs = []
|
||||||
for k in keys:
|
for k in keys:
|
||||||
v = a.get(k, None)
|
v = a.get(k, None)
|
||||||
if isinstance(v, six.string_types) or v is None:
|
if isinstance(v, str) or v is None:
|
||||||
v = [v]
|
v = [v]
|
||||||
if isinstance(v, list):
|
if isinstance(v, list):
|
||||||
vs.append(v)
|
vs.append(v)
|
||||||
|
@ -3553,7 +3552,7 @@ class CLIParser(object):
|
||||||
else:
|
else:
|
||||||
yield []
|
yield []
|
||||||
|
|
||||||
if isinstance(self.raw, six.string_types):
|
if isinstance(self.raw, str):
|
||||||
stdout, stderr = self.raw, ''
|
stdout, stderr = self.raw, ''
|
||||||
else:
|
else:
|
||||||
stdout, stderr = self.raw
|
stdout, stderr = self.raw
|
||||||
|
|
|
@ -20,7 +20,6 @@ from eventlet import greenthread
|
||||||
from oslo_concurrency import processutils
|
from oslo_concurrency import processutils
|
||||||
from oslo_log import log as logging
|
from oslo_log import log as logging
|
||||||
from oslo_utils import excutils
|
from oslo_utils import excutils
|
||||||
import six
|
|
||||||
|
|
||||||
from cinder import exception
|
from cinder import exception
|
||||||
from cinder.i18n import _
|
from cinder.i18n import _
|
||||||
|
@ -155,7 +154,7 @@ class InStorageMCSReplication(object):
|
||||||
vref.name)
|
vref.name)
|
||||||
opts['iogrp'] = src_attr['IO_group_id']
|
opts['iogrp'] = src_attr['IO_group_id']
|
||||||
self.target_assistant.create_vdisk(target_vol_name,
|
self.target_assistant.create_vdisk(target_vol_name,
|
||||||
six.text_type(vref['size']),
|
str(vref['size']),
|
||||||
'gb', pool, opts)
|
'gb', pool, opts)
|
||||||
|
|
||||||
system_info = self.target_assistant.get_system_info()
|
system_info = self.target_assistant.get_system_info()
|
||||||
|
@ -191,7 +190,7 @@ class InStorageMCSReplication(object):
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
msg = (_('Unable to fail-over the volume %(id)s to the '
|
msg = (_('Unable to fail-over the volume %(id)s to the '
|
||||||
'secondary back-end, error: %(error)s') %
|
'secondary back-end, error: %(error)s') %
|
||||||
{"id": vref.id, "error": six.text_type(e)})
|
{"id": vref.id, "error": str(e)})
|
||||||
LOG.error(msg)
|
LOG.error(msg)
|
||||||
raise exception.VolumeDriverException(message=msg)
|
raise exception.VolumeDriverException(message=msg)
|
||||||
|
|
||||||
|
@ -207,7 +206,7 @@ class InStorageMCSReplication(object):
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
msg = (_('Unable to fail-back the volume:%(vol)s to the '
|
msg = (_('Unable to fail-back the volume:%(vol)s to the '
|
||||||
'master back-end, error:%(error)s') %
|
'master back-end, error:%(error)s') %
|
||||||
{"vol": volume.name, "error": six.text_type(e)})
|
{"vol": volume.name, "error": str(e)})
|
||||||
LOG.error(msg)
|
LOG.error(msg)
|
||||||
raise exception.VolumeDriverException(message=msg)
|
raise exception.VolumeDriverException(message=msg)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue