def sanitize_hostname(hostname):
"""Return a hostname which conforms to RFC-952 and RFC-1123 specs."""
- if isinstance(hostname, unicode):
+ if isinstance(hostname, six.text_type):
hostname = hostname.encode('latin-1', 'ignore')
hostname = re.sub('[ _]', '-', hostname)
localAuthHeader = None
tryLimit = 5
- if isinstance(data, unicode):
+ if isinstance(data, six.text_type):
data = data.encode('utf-8')
data = '<?xml version="1.0" encoding="utf-8" ?>\n' + data
h.putheader('PegasusAuthorization', 'Local "%s"' % locallogin)
for hdr in headers:
- if isinstance(hdr, unicode):
+ if isinstance(hdr, six.text_type):
hdr = hdr.encode('utf-8')
s = map(lambda x: string.strip(x), string.split(hdr, ":", 1))
h.putheader(urllib.quote(s[0]), urllib.quote(s[1]))
raise exception.VolumeDriverException(message=msg)
# Build a host name for the Storwize host - first clean up the name
- if isinstance(host_name, unicode):
+ if isinstance(host_name, six.text_type):
host_name = unicodedata.normalize('NFKD', host_name).encode(
'ascii', 'replace').decode('ascii')
hpexceptions = None
from oslo_log import log as logging
+import six
from cinder import exception
from cinder.i18n import _, _LE, _LW
used during live-migration. bug #1423958
2.0.15 - Added support for updated detach_volume attachment.
2.0.16 - Added encrypted property to initialize_connection #1439917
+ 2.0.17 - Python 3 fixes
"""
- VERSION = "2.0.16"
+ VERSION = "2.0.17"
def __init__(self, *args, **kwargs):
super(HP3PARISCSIDriver, self).__init__(*args, **kwargs)
if host_found is not None:
return host_found
else:
- if isinstance(iscsi_iqn, str) or isinstance(iscsi_iqn, unicode):
+ if isinstance(iscsi_iqn, six.string_types):
iqn = [iscsi_iqn]
else:
iqn = iscsi_iqn