Remove six from Huawei drivers
Change-Id: I2f0c483b26d70435e1deea021a79e4a892426826
This commit is contained in:
parent
2a18843ab9
commit
833f128774
@ -22,7 +22,6 @@ from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
from oslo_utils import excutils
|
||||
from oslo_utils import units
|
||||
import six
|
||||
|
||||
from cinder import context
|
||||
from cinder import exception
|
||||
@ -291,7 +290,7 @@ class HuaweiBaseDriver(driver.VolumeDriver):
|
||||
smartcache.add(opts['cachename'], lun_id)
|
||||
except Exception as err:
|
||||
self._delete_lun_with_check(lun_id)
|
||||
msg = _('Create volume error. Because %s.') % six.text_type(err)
|
||||
msg = _('Create volume error. Because %s.') % str(err)
|
||||
raise exception.VolumeBackendAPIException(data=msg)
|
||||
|
||||
return lun_params, lun_info, model_update
|
||||
@ -567,7 +566,7 @@ class HuaweiBaseDriver(driver.VolumeDriver):
|
||||
pool_name = host['capabilities']['pool_name']
|
||||
pools = self.client.get_all_pools()
|
||||
pool_info = self.client.get_pool_info(pool_name, pools)
|
||||
dst_volume_name = six.text_type(uuid.uuid4())
|
||||
dst_volume_name = str(uuid.uuid4())
|
||||
|
||||
lun_info = huawei_utils.get_lun_info(self.client, volume)
|
||||
if not lun_info:
|
||||
@ -1617,7 +1616,7 @@ class HuaweiBaseDriver(driver.VolumeDriver):
|
||||
'id': src_vol.id,
|
||||
'provider_location': src_vol.provider_location,
|
||||
}
|
||||
snapshot_kwargs = {'id': six.text_type(uuid.uuid4()),
|
||||
snapshot_kwargs = {'id': str(uuid.uuid4()),
|
||||
'volume': objects.Volume(**vol_kwargs),
|
||||
'volume_size': src_vol.size}
|
||||
snapshot = objects.Snapshot(**snapshot_kwargs)
|
||||
|
@ -25,7 +25,6 @@ import re
|
||||
|
||||
from lxml import etree as ET
|
||||
from oslo_log import log as logging
|
||||
import six
|
||||
|
||||
from cinder import exception
|
||||
from cinder.i18n import _
|
||||
@ -85,17 +84,20 @@ class HuaweiConf(object):
|
||||
|
||||
need_encode = False
|
||||
if name_node is not None and not name_node.text.startswith('!$$$'):
|
||||
encoded = base64.b64encode(six.b(name_node.text)).decode()
|
||||
encoded = base64.b64encode(
|
||||
name_node.text.encode('latin-1')).decode()
|
||||
name_node.text = '!$$$' + encoded
|
||||
need_encode = True
|
||||
|
||||
if pwd_node is not None and not pwd_node.text.startswith('!$$$'):
|
||||
encoded = base64.b64encode(six.b(pwd_node.text)).decode()
|
||||
encoded = base64.b64encode(
|
||||
pwd_node.text.encode('latin-1')).decode()
|
||||
pwd_node.text = '!$$$' + encoded
|
||||
need_encode = True
|
||||
|
||||
if vstore_node is not None and not vstore_node.text.startswith('!$$$'):
|
||||
encoded = base64.b64encode(six.b(vstore_node.text)).decode()
|
||||
encoded = base64.b64encode(
|
||||
vstore_node.text.encode('latin-1')).decode()
|
||||
vstore_node.text = '!$$$' + encoded
|
||||
need_encode = True
|
||||
|
||||
@ -119,7 +121,7 @@ class HuaweiConf(object):
|
||||
LOG.error(msg)
|
||||
raise exception.InvalidInput(reason=msg)
|
||||
|
||||
user = base64.b64decode(six.b(text[4:])).decode()
|
||||
user = base64.b64decode(text[4:].encode('latin-1')).decode()
|
||||
setattr(self.conf, 'san_user', user)
|
||||
|
||||
def _san_password(self, xml_root):
|
||||
@ -129,14 +131,14 @@ class HuaweiConf(object):
|
||||
LOG.error(msg)
|
||||
raise exception.InvalidInput(reason=msg)
|
||||
|
||||
pwd = base64.b64decode(six.b(text[4:])).decode()
|
||||
pwd = base64.b64decode(text[4:].encode('latin-1')).decode()
|
||||
setattr(self.conf, 'san_password', pwd)
|
||||
|
||||
def _san_vstore(self, xml_root):
|
||||
vstore = None
|
||||
text = xml_root.findtext('Storage/vStoreName')
|
||||
if text:
|
||||
vstore = base64.b64decode(six.b(text[4:])).decode()
|
||||
vstore = base64.b64decode(text[4:].encode('latin-1')).decode()
|
||||
setattr(self.conf, 'vstore_name', vstore)
|
||||
|
||||
def _ssl_cert_path(self, xml_root):
|
||||
|
@ -19,7 +19,6 @@ import math
|
||||
from oslo_log import log as logging
|
||||
from oslo_utils.secretutils import md5
|
||||
from oslo_utils import strutils
|
||||
import six
|
||||
|
||||
from cinder import context
|
||||
from cinder import exception
|
||||
@ -45,7 +44,7 @@ def encode_name(name):
|
||||
|
||||
def old_encode_name(name):
|
||||
pre_name = name.split("-")[0]
|
||||
vol_encoded = six.text_type(hash(name))
|
||||
vol_encoded = str(hash(name))
|
||||
if vol_encoded.startswith('-'):
|
||||
newuuid = pre_name + vol_encoded
|
||||
else:
|
||||
@ -63,7 +62,7 @@ def encode_host_name(name):
|
||||
|
||||
def old_encode_host_name(name):
|
||||
if name and len(name) > constants.MAX_NAME_LENGTH:
|
||||
name = six.text_type(hash(name))
|
||||
name = str(hash(name))
|
||||
return name
|
||||
|
||||
|
||||
@ -201,7 +200,7 @@ def _get_opts_from_specs(specs):
|
||||
opt_key = _get_opt_key(spec_key)
|
||||
opts[opt_key] = opts_capability[spec_key][1]
|
||||
|
||||
for key, value in six.iteritems(specs):
|
||||
for key, value in specs.items():
|
||||
if key not in opts_capability:
|
||||
continue
|
||||
func = opts_capability[key][0]
|
||||
@ -337,7 +336,7 @@ def get_volume_private_data(volume):
|
||||
return info
|
||||
|
||||
# To keep compatible with old driver version
|
||||
return {'huawei_lun_id': six.text_type(info),
|
||||
return {'huawei_lun_id': str(info),
|
||||
'huawei_lun_wwn': volume.admin_metadata.get('huawei_lun_wwn'),
|
||||
'huawei_sn': volume.metadata.get('huawei_sn'),
|
||||
'hypermetro_id': volume.metadata.get('hypermetro_id'),
|
||||
@ -370,7 +369,7 @@ def get_snapshot_private_data(snapshot):
|
||||
return info
|
||||
|
||||
# To keep compatible with old driver version
|
||||
return {'huawei_snapshot_id': six.text_type(info),
|
||||
return {'huawei_snapshot_id': str(info),
|
||||
'huawei_snapshot_wwn': snapshot.metadata.get(
|
||||
'huawei_snapshot_wwn'),
|
||||
}
|
||||
|
@ -20,7 +20,6 @@ import time
|
||||
from oslo_log import log as logging
|
||||
from oslo_utils import excutils
|
||||
import requests
|
||||
import six
|
||||
|
||||
from cinder import exception
|
||||
from cinder.i18n import _
|
||||
@ -95,7 +94,7 @@ class RestClient(object):
|
||||
res.raise_for_status()
|
||||
except requests.HTTPError as exc:
|
||||
return {"error": {"code": exc.response.status_code,
|
||||
"description": six.text_type(exc)}}
|
||||
"description": str(exc)}}
|
||||
|
||||
res_json = res.json()
|
||||
if not log_filter_flag:
|
||||
@ -1988,9 +1987,9 @@ class RestClient(object):
|
||||
|
||||
def change_hostlun_id(self, map_info, hostlun_id):
|
||||
url = "/mappingview"
|
||||
view_id = six.text_type(map_info['view_id'])
|
||||
lun_id = six.text_type(map_info['lun_id'])
|
||||
hostlun_id = six.text_type(hostlun_id)
|
||||
view_id = str(map_info['view_id'])
|
||||
lun_id = str(map_info['lun_id'])
|
||||
hostlun_id = str(hostlun_id)
|
||||
data = {"TYPE": 245,
|
||||
"ID": view_id,
|
||||
"ASSOCIATEOBJTYPE": 11,
|
||||
|
Loading…
Reference in New Issue
Block a user