remove usage of six library
remove usage of six library from the following directory: 1:share 2:volume and some files. Change-Id: If5bb2976bc54887c74649a00deaeaa71e296aaaa
This commit is contained in:
parent
a214b3ea4a
commit
7f2b25332a
@ -111,7 +111,6 @@ retrying==1.2.3
|
||||
rfc3986==1.2.0
|
||||
Routes==2.4.1
|
||||
simplejson==3.13.2
|
||||
six==1.15.0
|
||||
snowballstemmer==1.2.1
|
||||
SQLAlchemy==1.3.17
|
||||
sqlalchemy-migrate==0.11.0
|
||||
|
@ -18,7 +18,6 @@ import decorator
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log
|
||||
from oslo_utils import uuidutils
|
||||
import six
|
||||
from tooz import coordination
|
||||
from tooz import locking
|
||||
|
||||
@ -117,14 +116,14 @@ class Lock(locking.Lock):
|
||||
Available field names are keys of lock_data.
|
||||
"""
|
||||
def __init__(self, lock_name, lock_data=None, coordinator=None):
|
||||
super(Lock, self).__init__(six.text_type(id(self)))
|
||||
super(Lock, self).__init__(str(id(self)))
|
||||
lock_data = lock_data or {}
|
||||
self.coordinator = coordinator or LOCK_COORDINATOR
|
||||
self.blocking = True
|
||||
self.lock = self._prepare_lock(lock_name, lock_data)
|
||||
|
||||
def _prepare_lock(self, lock_name, lock_data):
|
||||
if not isinstance(lock_name, six.string_types):
|
||||
if not isinstance(lock_name, str):
|
||||
raise ValueError(_('Not a valid string: %s') % lock_name)
|
||||
return self.coordinator.get_lock(lock_name.format(**lock_data))
|
||||
|
||||
|
@ -26,7 +26,6 @@ import re
|
||||
from oslo_concurrency import processutils
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log
|
||||
import six
|
||||
import webob.exc
|
||||
|
||||
from manila.i18n import _
|
||||
@ -82,7 +81,7 @@ class ManilaException(Exception):
|
||||
pass
|
||||
for k, v in self.kwargs.items():
|
||||
if isinstance(v, Exception):
|
||||
self.kwargs[k] = six.text_type(v)
|
||||
self.kwargs[k] = str(v)
|
||||
|
||||
if not message:
|
||||
try:
|
||||
@ -101,7 +100,7 @@ class ManilaException(Exception):
|
||||
# at least get the core message out if something happened
|
||||
message = self.message
|
||||
elif isinstance(message, Exception):
|
||||
message = six.text_type(message)
|
||||
message = str(message)
|
||||
|
||||
if re.match(r'.*[^\.]\.\.$', message):
|
||||
message = message[:-1]
|
||||
|
@ -22,7 +22,6 @@ from oslo_config import cfg
|
||||
from oslo_log import log
|
||||
from oslo_utils import importutils
|
||||
from oslo_utils import timeutils
|
||||
import six
|
||||
|
||||
from manila import db
|
||||
from manila import exception
|
||||
@ -499,7 +498,7 @@ class DbQuotaDriver(object):
|
||||
# Set up the reservation expiration
|
||||
if expire is None:
|
||||
expire = CONF.quota.reservation_expire
|
||||
if isinstance(expire, six.integer_types):
|
||||
if isinstance(expire, int):
|
||||
expire = datetime.timedelta(seconds=expire)
|
||||
if isinstance(expire, datetime.timedelta):
|
||||
expire = timeutils.utcnow() + expire
|
||||
@ -793,8 +792,8 @@ class QuotaEngine(object):
|
||||
if self.__driver:
|
||||
return self.__driver
|
||||
if not self._driver_cls:
|
||||
self._driver_cls = CONF.quota.driver
|
||||
if isinstance(self._driver_cls, six.string_types):
|
||||
self._driver_cls = CONF.quota_driver
|
||||
if isinstance(self._driver_cls, str):
|
||||
self._driver_cls = importutils.import_object(self._driver_cls)
|
||||
self.__driver = self._driver_cls
|
||||
return self.__driver
|
||||
|
@ -22,8 +22,6 @@ from manila.common import constants
|
||||
from manila.i18n import _
|
||||
from manila import utils
|
||||
|
||||
import six
|
||||
|
||||
LOG = log.getLogger(__name__)
|
||||
|
||||
|
||||
@ -494,7 +492,7 @@ class ShareInstanceAccess(ShareInstanceAccessDatabaseMixin):
|
||||
for rule in rules:
|
||||
if rule['access_type'] == 'ip':
|
||||
ip_version = ipaddress.ip_network(
|
||||
six.text_type(rule['access_to'])).version
|
||||
str(rule['access_to'])).version
|
||||
if 6 == ip_version:
|
||||
continue
|
||||
filtered.append(rule)
|
||||
|
@ -27,7 +27,6 @@ from oslo_utils import excutils
|
||||
from oslo_utils import strutils
|
||||
from oslo_utils import timeutils
|
||||
from oslo_utils import uuidutils
|
||||
import six
|
||||
|
||||
from manila.api import common as api_common
|
||||
from manila.common import constants
|
||||
@ -288,7 +287,7 @@ class API(base.Base):
|
||||
try:
|
||||
share_group = self.db.share_group_get(context, share_group_id)
|
||||
except exception.NotFound as e:
|
||||
raise exception.InvalidParameterValue(six.text_type(e))
|
||||
raise exception.InvalidParameterValue(e.message)
|
||||
|
||||
if (not share_group_snapshot_member and
|
||||
not (share_group['status'] == constants.STATUS_AVAILABLE)):
|
||||
@ -1863,7 +1862,7 @@ class API(base.Base):
|
||||
filters['metadata'] = search_opts.pop('metadata')
|
||||
if not isinstance(filters['metadata'], dict):
|
||||
msg = _("Wrong metadata filter provided: "
|
||||
"%s.") % six.text_type(filters['metadata'])
|
||||
"%s.") % filters['metadata']
|
||||
raise exception.InvalidInput(reason=msg)
|
||||
if 'extra_specs' in search_opts:
|
||||
# Verify policy for extra-specs access
|
||||
@ -1871,16 +1870,16 @@ class API(base.Base):
|
||||
filters['extra_specs'] = search_opts.pop('extra_specs')
|
||||
if not isinstance(filters['extra_specs'], dict):
|
||||
msg = _("Wrong extra specs filter provided: "
|
||||
"%s.") % six.text_type(filters['extra_specs'])
|
||||
"%s.") % filters['extra_specs']
|
||||
raise exception.InvalidInput(reason=msg)
|
||||
|
||||
if not (isinstance(sort_key, six.string_types) and sort_key):
|
||||
if not (isinstance(sort_key, str) and sort_key):
|
||||
msg = _("Wrong sort_key filter provided: "
|
||||
"'%s'.") % six.text_type(sort_key)
|
||||
"'%s'.") % sort_key
|
||||
raise exception.InvalidInput(reason=msg)
|
||||
if not (isinstance(sort_dir, six.string_types) and sort_dir):
|
||||
if not (isinstance(sort_dir, str) and sort_dir):
|
||||
msg = _("Wrong sort_dir filter provided: "
|
||||
"'%s'.") % six.text_type(sort_dir)
|
||||
"'%s'.") % sort_dir
|
||||
raise exception.InvalidInput(reason=msg)
|
||||
|
||||
is_public = search_opts.pop('is_public', False)
|
||||
@ -1941,7 +1940,7 @@ class API(base.Base):
|
||||
string_args = {'sort_key': sort_key, 'sort_dir': sort_dir}
|
||||
string_args.update(search_opts)
|
||||
for k, v in string_args.items():
|
||||
if not (isinstance(v, six.string_types) and v):
|
||||
if not (isinstance(v, str) and v):
|
||||
msg = _("Wrong '%(k)s' filter provided: "
|
||||
"'%(v)s'.") % {'k': k, 'v': string_args[k]}
|
||||
raise exception.InvalidInput(reason=msg)
|
||||
@ -2352,7 +2351,7 @@ class API(base.Base):
|
||||
def shrink(self, context, share, new_size):
|
||||
policy.check_policy(context, 'share', 'shrink')
|
||||
|
||||
status = six.text_type(share['status']).lower()
|
||||
status = str(share['status']).lower()
|
||||
valid_statuses = (constants.STATUS_AVAILABLE,
|
||||
constants.STATUS_SHRINKING_POSSIBLE_DATA_LOSS_ERROR)
|
||||
|
||||
|
@ -18,7 +18,6 @@ Drivers for shares.
|
||||
|
||||
"""
|
||||
|
||||
import six
|
||||
import time
|
||||
|
||||
from oslo_config import cfg
|
||||
@ -627,7 +626,7 @@ class ShareDriver(object):
|
||||
}
|
||||
|
||||
LOG.debug("Migration info obtained for share %(share_id)s: %(info)s.",
|
||||
{'share_id': share['id'], 'info': six.text_type(info)})
|
||||
{'share_id': share['id'], 'info': str(info)})
|
||||
|
||||
return info
|
||||
|
||||
|
@ -23,7 +23,6 @@ from oslo_config import cfg
|
||||
from oslo_log import log
|
||||
from oslo_utils import importutils
|
||||
from oslo_utils import units
|
||||
import six
|
||||
|
||||
from manila.common import constants as const
|
||||
from manila import compute
|
||||
@ -299,7 +298,7 @@ class GenericShareDriver(driver.ExecuteMixin, driver.ShareDriver):
|
||||
"permanently on server '%(instance_id)s'.",
|
||||
{"share_id": share_id,
|
||||
"instance_id": server_details['instance_id']})
|
||||
raise exception.ShareBackendException(msg=six.text_type(e))
|
||||
raise exception.ShareBackendException(msg=str(e))
|
||||
try:
|
||||
# Remount it to avoid postponed point of failure
|
||||
self._ssh_exec(server_details, ['sudo', 'mount', '-a'])
|
||||
@ -320,7 +319,7 @@ class GenericShareDriver(driver.ExecuteMixin, driver.ShareDriver):
|
||||
"permanently on server '%(instance_id)s'.",
|
||||
{"share_id": share_id,
|
||||
"instance_id": server_details['instance_id']})
|
||||
raise exception.ShareBackendException(msg=six.text_type(e))
|
||||
raise exception.ShareBackendException(msg=str(e))
|
||||
|
||||
def _mount_device(self, share, server_details, volume):
|
||||
"""Mounts block device to the directory on service vm.
|
||||
@ -368,7 +367,7 @@ class GenericShareDriver(driver.ExecuteMixin, driver.ShareDriver):
|
||||
LOG.warning("Mount point '%(path)s' already exists on "
|
||||
"server '%(server)s'.", log_data)
|
||||
except exception.ProcessExecutionError as e:
|
||||
raise exception.ShareBackendException(msg=six.text_type(e))
|
||||
raise exception.ShareBackendException(msg=str(e))
|
||||
return _mount_device_with_lock()
|
||||
|
||||
@utils.retry(retry_param=exception.ProcessExecutionError)
|
||||
@ -716,7 +715,7 @@ class GenericShareDriver(driver.ExecuteMixin, driver.ShareDriver):
|
||||
raise exception.ShareShrinkingPossibleDataLoss(
|
||||
share_id=share['id'])
|
||||
except Exception as e:
|
||||
msg = _("Cannot shrink share: %s") % six.text_type(e)
|
||||
msg = _("Cannot shrink share: %s") % str(e)
|
||||
raise exception.Invalid(msg)
|
||||
finally:
|
||||
self._mount_device(share, server_details, volume)
|
||||
@ -730,17 +729,17 @@ class GenericShareDriver(driver.ExecuteMixin, driver.ShareDriver):
|
||||
command = ['sudo', 'resize2fs', volume['mountpoint']]
|
||||
|
||||
if new_size:
|
||||
command.append("%sG" % six.text_type(new_size))
|
||||
command.append("%sG" % new_size)
|
||||
|
||||
try:
|
||||
self._ssh_exec(server_details, command)
|
||||
except processutils.ProcessExecutionError as e:
|
||||
if e.stderr.find('New size smaller than minimum') != -1:
|
||||
msg = (_("Invalid 'new_size' provided: %s")
|
||||
% six.text_type(new_size))
|
||||
% new_size)
|
||||
raise exception.Invalid(msg)
|
||||
else:
|
||||
msg = _("Cannot resize file-system: %s") % six.text_type(e)
|
||||
msg = _("Cannot resize file-system: %s") % e
|
||||
raise exception.ManilaException(msg)
|
||||
|
||||
def _is_share_server_active(self, context, share_server):
|
||||
@ -941,7 +940,7 @@ class GenericShareDriver(driver.ExecuteMixin, driver.ShareDriver):
|
||||
return self.volume_api.get(
|
||||
self.admin_context, driver_options['volume_id'])
|
||||
except exception.VolumeNotFound as e:
|
||||
raise exception.ManageInvalidShare(reason=six.text_type(e))
|
||||
raise exception.ManageInvalidShare(reason=e.message)
|
||||
|
||||
# NOTE(vponomaryov): Manila can only combine volume name by itself,
|
||||
# nowhere to get volume ID from. Return None since Cinder volume
|
||||
@ -956,8 +955,7 @@ class GenericShareDriver(driver.ExecuteMixin, driver.ShareDriver):
|
||||
self.admin_context, server_details['instance_id'])
|
||||
|
||||
attached_volumes = [vol.id for vol in instance_volumes]
|
||||
LOG.debug('Manage: attached volumes = %s',
|
||||
six.text_type(attached_volumes))
|
||||
LOG.debug('Manage: attached volumes = %s', attached_volumes)
|
||||
|
||||
if share_volume['id'] not in attached_volumes:
|
||||
msg = _("Provided volume %s is not attached "
|
||||
@ -999,7 +997,7 @@ class GenericShareDriver(driver.ExecuteMixin, driver.ShareDriver):
|
||||
provider_location)
|
||||
except exception.VolumeSnapshotNotFound as e:
|
||||
raise exception.ManageInvalidShareSnapshot(
|
||||
reason=six.text_type(e))
|
||||
reason=e.message)
|
||||
|
||||
if volume_snapshot:
|
||||
snapshot_size = volume_snapshot['size']
|
||||
@ -1046,7 +1044,7 @@ class GenericShareDriver(driver.ExecuteMixin, driver.ShareDriver):
|
||||
except Exception as e:
|
||||
msg = _("Cannot calculate size of share %(path)s : %(error)s") % {
|
||||
'path': mount_path,
|
||||
'error': six.text_type(e)
|
||||
'error': e
|
||||
}
|
||||
raise exception.ManageInvalidShare(reason=msg)
|
||||
|
||||
@ -1061,7 +1059,7 @@ class GenericShareDriver(driver.ExecuteMixin, driver.ShareDriver):
|
||||
msg = _("Cannot calculate consumed space on share "
|
||||
"%(path)s : %(error)s") % {
|
||||
'path': mount_path,
|
||||
'error': six.text_type(e)
|
||||
'error': e
|
||||
}
|
||||
raise exception.InvalidShare(reason=msg)
|
||||
|
||||
|
@ -17,7 +17,6 @@ import copy
|
||||
import ipaddress
|
||||
import os
|
||||
import re
|
||||
import six
|
||||
|
||||
from oslo_log import log
|
||||
|
||||
@ -182,11 +181,11 @@ def nfs_synchronized(f):
|
||||
|
||||
|
||||
def escaped_address(address):
|
||||
addr = ipaddress.ip_address(six.text_type(address))
|
||||
addr = ipaddress.ip_address(str(address))
|
||||
if addr.version == 4:
|
||||
return six.text_type(addr)
|
||||
return str(addr)
|
||||
else:
|
||||
return '[%s]' % six.text_type(addr)
|
||||
return '[%s]' % addr
|
||||
|
||||
|
||||
class NFSHelper(NASHelperBase):
|
||||
@ -317,9 +316,9 @@ class NFSHelper(NASHelperBase):
|
||||
|
||||
@staticmethod
|
||||
def _get_parsed_address_or_cidr(access_to):
|
||||
network = ipaddress.ip_network(six.text_type(access_to))
|
||||
network = ipaddress.ip_network(str(access_to))
|
||||
mask_length = network.prefixlen
|
||||
address = six.text_type(network.network_address)
|
||||
address = str(network.network_address)
|
||||
if mask_length == 0:
|
||||
# Special case because Linux exports don't support /0 netmasks
|
||||
return '*'
|
||||
|
@ -27,7 +27,6 @@ from oslo_config import cfg
|
||||
from oslo_log import log
|
||||
from oslo_utils import importutils
|
||||
from oslo_utils import timeutils
|
||||
import six
|
||||
|
||||
from manila import exception
|
||||
from manila.i18n import _
|
||||
@ -91,7 +90,7 @@ class LVMMixin(driver.ExecuteMixin):
|
||||
rsize = int(2 ** math.ceil(math.log(terras) / math.log(2)))
|
||||
# NOTE(vish): Next power of two for region size. See:
|
||||
# http://red.ht/U2BPOD
|
||||
cmd += ['-R', six.text_type(rsize)]
|
||||
cmd += ['-R', str(rsize)]
|
||||
|
||||
self._try_execute(*cmd, run_as_root=True)
|
||||
device_name = self._get_local_path(share)
|
||||
@ -460,7 +459,7 @@ class LVMShareDriver(LVMMixin, driver.ShareDriver):
|
||||
self.configured_ip_version = []
|
||||
for ip in self.configuration.lvm_share_export_ips:
|
||||
self.configured_ip_version.append(
|
||||
ipaddress.ip_address(six.text_type(ip)).version)
|
||||
ipaddress.ip_address(str(ip)).version)
|
||||
except Exception:
|
||||
message = (_("Invalid 'lvm_share_export_ips' option supplied "
|
||||
"%s.") % self.configuration.lvm_share_export_ips)
|
||||
|
@ -26,7 +26,6 @@ from oslo_config import cfg
|
||||
from oslo_log import log
|
||||
from oslo_utils import importutils
|
||||
from oslo_utils import netutils
|
||||
import six
|
||||
|
||||
from manila.common import constants as const
|
||||
from manila import compute
|
||||
@ -320,7 +319,7 @@ class ServiceInstanceManager(object):
|
||||
msg = _("Failed to get service instance IP address. "
|
||||
"Service network name is '%(net_name)s' "
|
||||
"and provided data are '%(data)s'.")
|
||||
msg = msg % {'net_name': net_name, 'data': six.text_type(server)}
|
||||
msg = msg % {'net_name': net_name, 'data': str(server)}
|
||||
raise exception.ServiceInstanceException(msg)
|
||||
return net_ips[0]
|
||||
|
||||
@ -725,8 +724,7 @@ class ServiceInstanceManager(object):
|
||||
soft_reboot)
|
||||
|
||||
|
||||
@six.add_metaclass(abc.ABCMeta)
|
||||
class BaseNetworkhelper(object):
|
||||
class BaseNetworkhelper(metaclass=abc.ABCMeta):
|
||||
|
||||
@abc.abstractproperty
|
||||
def NAME(self):
|
||||
@ -954,7 +952,7 @@ class NeutronNetworkHelper(BaseNetworkhelper):
|
||||
self.get_config_option("service_network_cidr"))
|
||||
division_mask = self.get_config_option("service_network_division_mask")
|
||||
for subnet in serv_cidr.subnet(division_mask):
|
||||
cidr = six.text_type(subnet.cidr)
|
||||
cidr = str(subnet.cidr)
|
||||
if cidr not in used_cidrs:
|
||||
return cidr
|
||||
else:
|
||||
|
@ -23,7 +23,6 @@ import abc
|
||||
from oslo_config import cfg
|
||||
from oslo_utils import importutils
|
||||
from oslo_utils import uuidutils
|
||||
import six
|
||||
|
||||
from manila.db import api as db_api
|
||||
from manila.i18n import _
|
||||
@ -38,8 +37,7 @@ private_data_opts = [
|
||||
CONF = cfg.CONF
|
||||
|
||||
|
||||
@six.add_metaclass(abc.ABCMeta)
|
||||
class StorageDriver(object):
|
||||
class StorageDriver(metaclass=abc.ABCMeta):
|
||||
|
||||
def __init__(self, context, backend_host):
|
||||
# Backend shouldn't access data stored by another backend
|
||||
@ -153,7 +151,7 @@ class DriverPrivateData(object):
|
||||
|
||||
if not isinstance(details, dict):
|
||||
msg = (_("Provided details %s is not valid dict.")
|
||||
% six.text_type(details))
|
||||
% details)
|
||||
raise ValueError(msg)
|
||||
|
||||
return self._storage.update(
|
||||
@ -172,5 +170,5 @@ class DriverPrivateData(object):
|
||||
def _validate_entity_id(entity_id):
|
||||
if not uuidutils.is_uuid_like(entity_id):
|
||||
msg = (_("Provided entity_id %s is not valid UUID.")
|
||||
% six.text_type(entity_id))
|
||||
% entity_id)
|
||||
raise ValueError(msg)
|
||||
|
@ -26,7 +26,6 @@ import abc
|
||||
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log
|
||||
import six
|
||||
|
||||
from manila import context as ctxt
|
||||
|
||||
@ -67,8 +66,7 @@ CONF.register_opts(hook_options)
|
||||
LOG = log.getLogger(__name__)
|
||||
|
||||
|
||||
@six.add_metaclass(abc.ABCMeta)
|
||||
class HookBase(object):
|
||||
class HookBase(metaclass=abc.ABCMeta):
|
||||
|
||||
def get_config_option(self, key):
|
||||
if self.configuration:
|
||||
|
@ -33,7 +33,6 @@ from oslo_service import periodic_task
|
||||
from oslo_utils import excutils
|
||||
from oslo_utils import importutils
|
||||
from oslo_utils import timeutils
|
||||
import six
|
||||
|
||||
from manila.common import constants
|
||||
from manila import context
|
||||
@ -397,7 +396,7 @@ class ShareManager(manager.SchedulerDependentManager):
|
||||
{'host': self.host})
|
||||
|
||||
if new_backend_info:
|
||||
new_backend_info_hash = hashlib.sha1(six.text_type(
|
||||
new_backend_info_hash = hashlib.sha1(str(
|
||||
sorted(new_backend_info.items())).encode('utf-8')).hexdigest()
|
||||
if (old_backend_info_hash == new_backend_info_hash and
|
||||
backend_info_implemented):
|
||||
@ -1927,7 +1926,7 @@ class ShareManager(manager.SchedulerDependentManager):
|
||||
dest_share_server)
|
||||
|
||||
def _get_share_instance(self, context, share):
|
||||
if isinstance(share, six.string_types):
|
||||
if isinstance(share, str):
|
||||
id = share
|
||||
else:
|
||||
id = share.instance['id']
|
||||
@ -3168,8 +3167,7 @@ class ShareManager(manager.SchedulerDependentManager):
|
||||
if len(remaining_allocations) > 0:
|
||||
msg = ("Failed to manage all allocations. "
|
||||
"Allocations %s were not "
|
||||
"managed." % six.text_type(
|
||||
remaining_allocations))
|
||||
"managed." % remaining_allocations)
|
||||
raise exception.ManageShareServerError(reason=msg)
|
||||
|
||||
else:
|
||||
@ -4125,14 +4123,14 @@ class ShareManager(manager.SchedulerDependentManager):
|
||||
context, share_server['id'], {key: value})
|
||||
except Exception:
|
||||
invalid_details.append("%(key)s: %(value)s" % {
|
||||
'key': six.text_type(key),
|
||||
'value': six.text_type(value)
|
||||
'key': key,
|
||||
'value': value
|
||||
})
|
||||
if invalid_details:
|
||||
LOG.debug(
|
||||
("Following server details "
|
||||
"cannot be written to db : %s"),
|
||||
six.text_type("\n".join(invalid_details)))
|
||||
"\n".join(invalid_details))
|
||||
else:
|
||||
LOG.debug(
|
||||
("Cannot save non-dict data (%(data)s) provided as "
|
||||
@ -4265,7 +4263,7 @@ class ShareManager(manager.SchedulerDependentManager):
|
||||
{'status': constants.STATUS_EXTENDING_ERROR}
|
||||
)
|
||||
raise exception.ShareExtendingError(
|
||||
reason=six.text_type(e), share_id=share_id)
|
||||
reason=str(e), share_id=share_id)
|
||||
finally:
|
||||
QUOTAS.rollback(
|
||||
context, reservations, project_id=project_id,
|
||||
@ -4326,7 +4324,7 @@ class ShareManager(manager.SchedulerDependentManager):
|
||||
self.db.share_update(context, share['id'], {'status': status})
|
||||
|
||||
raise exception.ShareShrinkingError(
|
||||
reason=six.text_type(exc), share_id=share_id)
|
||||
reason=str(exc), share_id=share_id)
|
||||
|
||||
reservations = None
|
||||
|
||||
|
@ -22,7 +22,6 @@ from oslo_db import exception as db_exception
|
||||
from oslo_log import log
|
||||
from oslo_utils import strutils
|
||||
from oslo_utils import uuidutils
|
||||
import six
|
||||
|
||||
from manila.api import common
|
||||
from manila.common import constants
|
||||
@ -48,7 +47,7 @@ def create(context, name, extra_specs=None, is_public=True,
|
||||
get_valid_required_extra_specs(extra_specs)
|
||||
get_valid_optional_extra_specs(extra_specs)
|
||||
except exception.InvalidExtraSpec as e:
|
||||
raise exception.InvalidShareType(reason=six.text_type(e))
|
||||
raise exception.InvalidShareType(reason=e.message)
|
||||
|
||||
extra_specs = sanitize_extra_specs(extra_specs)
|
||||
|
||||
@ -320,8 +319,8 @@ def get_valid_required_extra_specs(extra_specs):
|
||||
|
||||
|
||||
def is_valid_csv(extra_spec_value):
|
||||
if not isinstance(extra_spec_value, six.string_types):
|
||||
extra_spec_value = six.text_type(extra_spec_value)
|
||||
if not isinstance(extra_spec_value, str):
|
||||
extra_spec_value = str(extra_spec_value)
|
||||
values = extra_spec_value.split(',')
|
||||
return all([v.strip() for v in values])
|
||||
|
||||
@ -416,8 +415,8 @@ def parse_boolean_extra_spec(extra_spec_key, extra_spec_value):
|
||||
the value does not conform to the standard boolean pattern, it raises
|
||||
an InvalidExtraSpec exception.
|
||||
"""
|
||||
if not isinstance(extra_spec_value, six.string_types):
|
||||
extra_spec_value = six.text_type(extra_spec_value)
|
||||
if not isinstance(extra_spec_value, str):
|
||||
extra_spec_value = str(extra_spec_value)
|
||||
|
||||
match = re.match(r'^<is>\s*(?P<value>True|False)$',
|
||||
extra_spec_value.strip(),
|
||||
|
@ -21,7 +21,6 @@ from oslo_config import cfg
|
||||
from oslo_log import log
|
||||
from oslo_utils import excutils
|
||||
from oslo_utils import strutils
|
||||
import six
|
||||
|
||||
from manila.api import common as api_common
|
||||
from manila.common import constants
|
||||
@ -334,7 +333,7 @@ class API(base.Base):
|
||||
search_opts = {}
|
||||
|
||||
LOG.debug("Searching for share_groups by: %s",
|
||||
six.text_type(search_opts))
|
||||
search_opts)
|
||||
|
||||
# Get filtered list of share_groups
|
||||
if search_opts.pop('all_tenants', 0) and context.is_admin:
|
||||
@ -489,7 +488,7 @@ class API(base.Base):
|
||||
if search_opts is None:
|
||||
search_opts = {}
|
||||
LOG.debug("Searching for share group snapshots by: %s",
|
||||
six.text_type(search_opts))
|
||||
search_opts)
|
||||
|
||||
# Get filtered list of share group snapshots
|
||||
if search_opts.pop('all_tenants', 0) and context.is_admin:
|
||||
|
@ -23,7 +23,6 @@ from cinderclient import exceptions as cinder_exception
|
||||
from cinderclient.v3 import client as cinder_client
|
||||
from keystoneauth1 import loading as ks_loading
|
||||
from oslo_config import cfg
|
||||
import six
|
||||
|
||||
from manila.common import client_auth
|
||||
from manila.common.config import core_opts
|
||||
@ -137,7 +136,7 @@ def translate_volume_exception(method):
|
||||
if isinstance(e, cinder_exception.NotFound):
|
||||
raise exception.VolumeNotFound(volume_id=volume_id)
|
||||
elif isinstance(e, cinder_exception.BadRequest):
|
||||
raise exception.InvalidInput(reason=six.text_type(e))
|
||||
raise exception.InvalidInput(reason=str(e))
|
||||
return res
|
||||
return wrapper
|
||||
|
||||
@ -255,7 +254,7 @@ class API(base.Base):
|
||||
item = cinderclient(context).volumes.create(size, **kwargs)
|
||||
return _untranslate_volume_summary_view(context, item)
|
||||
except cinder_exception.BadRequest as e:
|
||||
raise exception.InvalidInput(reason=six.text_type(e))
|
||||
raise exception.InvalidInput(reason=str(e))
|
||||
except cinder_exception.NotFound:
|
||||
raise exception.NotFound(
|
||||
_("Error in creating cinder "
|
||||
|
@ -36,7 +36,6 @@ keystonemiddleware>=9.1.0 # Apache-2.0
|
||||
requests>=2.23.0 # Apache-2.0
|
||||
tenacity>=6.3.1 # Apache-2.0
|
||||
Routes>=2.4.1 # MIT
|
||||
six>=1.15.0 # MIT
|
||||
SQLAlchemy>=1.3.17 # MIT
|
||||
stevedore>=3.2.2 # Apache-2.0
|
||||
tooz>=2.7.1 # Apache-2.0
|
||||
|
Loading…
Reference in New Issue
Block a user