Merge "Replace distutils with packaging in 3rd party drivers"
This commit is contained in:
commit
c559ed9f96
|
@ -11,11 +11,10 @@
|
|||
# under the License.
|
||||
"""RADOS Block Device iSCSI Driver"""
|
||||
|
||||
from distutils import version
|
||||
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
from oslo_utils import netutils
|
||||
from packaging import version
|
||||
|
||||
from cinder.common import constants
|
||||
from cinder import exception
|
||||
|
@ -94,8 +93,8 @@ class RBDISCSIDriver(rbd.RBDDriver):
|
|||
|
||||
def _create_client(self):
|
||||
client_version = rbd_iscsi_client.version
|
||||
if (version.StrictVersion(client_version) <
|
||||
version.StrictVersion(MIN_CLIENT_VERSION)):
|
||||
if (version.parse(client_version) <
|
||||
version.parse(MIN_CLIENT_VERSION)):
|
||||
ex_msg = (_('Invalid rbd_iscsi_client version found (%(found)s). '
|
||||
'Version %(min)s or greater required. Run "pip'
|
||||
' install --upgrade rbd-iscsi-client" to upgrade'
|
||||
|
|
|
@ -14,17 +14,17 @@
|
|||
# under the License.
|
||||
import base64
|
||||
import binascii
|
||||
from distutils import version
|
||||
import math
|
||||
|
||||
from oslo_log import log as logging
|
||||
from oslo_utils import units
|
||||
from packaging import version
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def version_gte(ver1, ver2):
|
||||
return version.LooseVersion(ver1) >= version.LooseVersion(ver2)
|
||||
return version.parse(ver1) >= version.parse(ver2)
|
||||
|
||||
|
||||
def convert_kb_to_gib(size):
|
||||
|
|
|
@ -14,13 +14,13 @@
|
|||
# under the License.
|
||||
|
||||
import contextlib
|
||||
from distutils import version
|
||||
import fnmatch
|
||||
import functools
|
||||
import json
|
||||
|
||||
from oslo_log import log as logging
|
||||
from oslo_utils import units
|
||||
from packaging import version
|
||||
import six
|
||||
|
||||
from cinder import coordination
|
||||
|
@ -359,7 +359,7 @@ def match_any(full, patterns):
|
|||
|
||||
|
||||
def is_before_4_1(ver):
|
||||
return version.LooseVersion(ver) < version.LooseVersion('4.1')
|
||||
return version.parse(ver) < version.parse('4.1')
|
||||
|
||||
|
||||
def lock_if(condition, lock_name):
|
||||
|
|
|
@ -15,13 +15,13 @@
|
|||
#
|
||||
import collections
|
||||
import copy
|
||||
import distutils.version as dist_version # pylint: disable=E0611
|
||||
import math
|
||||
import os
|
||||
import string
|
||||
|
||||
import eventlet
|
||||
from oslo_log import log as logging
|
||||
import packaging.version as dist_version # pylint: disable=E0611
|
||||
import six
|
||||
|
||||
from cinder import coordination
|
||||
|
@ -226,8 +226,8 @@ class DS8KCommonHelper(object):
|
|||
% self.INVALID_STORAGE_VERSION))
|
||||
rest_ver = self.backend['rest_version'][0:2]
|
||||
if ('87' == rest_ver and
|
||||
dist_version.LooseVersion(self.backend['rest_version']) <
|
||||
dist_version.LooseVersion(self.VALID_REST_VERSION_87_51_MIN)):
|
||||
dist_version.parse(self.backend['rest_version']) <
|
||||
dist_version.parse(self.VALID_REST_VERSION_87_51_MIN)):
|
||||
raise exception.VolumeDriverException(
|
||||
message=(_("REST version %(invalid)s is lower than "
|
||||
"%(valid)s, please upgrade it in DS8K.")
|
||||
|
@ -242,12 +242,12 @@ class DS8KCommonHelper(object):
|
|||
valid_rest_version = None
|
||||
rest_ver = self.backend['rest_version'][0:2]
|
||||
if ('87' == rest_ver and
|
||||
dist_version.LooseVersion(self.backend['rest_version']) <
|
||||
dist_version.LooseVersion(self.REST_VERSION_87_51_MIN_PPRC_CG)):
|
||||
dist_version.parse(self.backend['rest_version']) <
|
||||
dist_version.parse(self.REST_VERSION_87_51_MIN_PPRC_CG)):
|
||||
valid_rest_version = self.REST_VERSION_87_51_MIN_PPRC_CG
|
||||
elif ('88' == rest_ver and
|
||||
dist_version.LooseVersion(self.backend['rest_version']) <
|
||||
dist_version.LooseVersion(self.REST_VERSION_88_20_MIN_PPRC_CG)):
|
||||
dist_version.parse(self.backend['rest_version']) <
|
||||
dist_version.parse(self.REST_VERSION_88_20_MIN_PPRC_CG)):
|
||||
valid_rest_version = self.REST_VERSION_88_20_MIN_PPRC_CG
|
||||
|
||||
if valid_rest_version:
|
||||
|
@ -1092,17 +1092,17 @@ class DS8KECKDHelper(DS8KCommonHelper):
|
|||
"please upgrade the CCL.")
|
||||
% self.INVALID_STORAGE_VERSION))
|
||||
# DS8K supports ECKD ESE volume from 8.1
|
||||
if (dist_version.LooseVersion(self.backend['storage_version']) <
|
||||
dist_version.LooseVersion(self.MIN_VALID_STORAGE_VERSION)):
|
||||
if (dist_version.parse(self.backend['storage_version']) <
|
||||
dist_version.parse(self.MIN_VALID_STORAGE_VERSION)):
|
||||
self._disable_thin_provision = True
|
||||
|
||||
rest_ver = self.backend['rest_version'][0:2]
|
||||
if (('87' == rest_ver and
|
||||
dist_version.LooseVersion(self.backend['rest_version']) <
|
||||
dist_version.LooseVersion(self.VALID_REST_VERSION_87_51_MIN)) or
|
||||
dist_version.parse(self.backend['rest_version']) <
|
||||
dist_version.parse(self.VALID_REST_VERSION_87_51_MIN)) or
|
||||
('88' == rest_ver and
|
||||
dist_version.LooseVersion(self.backend['rest_version']) <
|
||||
dist_version.LooseVersion(self.VALID_REST_VERSION_88_20_MIN))):
|
||||
dist_version.parse(self.backend['rest_version']) <
|
||||
dist_version.parse(self.VALID_REST_VERSION_88_20_MIN))):
|
||||
raise exception.VolumeDriverException(
|
||||
message=(_("REST version %(invalid)s is lower than "
|
||||
"%(valid)s, please upgrade it in DS8K.")
|
||||
|
|
|
@ -17,7 +17,6 @@
|
|||
This driver requires Purity version 4.0.0 or later.
|
||||
"""
|
||||
|
||||
from distutils import version
|
||||
import functools
|
||||
import ipaddress
|
||||
import math
|
||||
|
@ -30,6 +29,7 @@ from oslo_log import log as logging
|
|||
from oslo_utils import excutils
|
||||
from oslo_utils import strutils
|
||||
from oslo_utils import units
|
||||
from packaging import version
|
||||
try:
|
||||
from purestorage import purestorage
|
||||
except ImportError:
|
||||
|
@ -356,7 +356,7 @@ class PureBaseVolumeDriver(san.SanDriver):
|
|||
)
|
||||
|
||||
array_info = self._array.get()
|
||||
if version.LooseVersion(array_info["version"]) < version.LooseVersion(
|
||||
if version.parse(array_info["version"]) < version.parse(
|
||||
'5.3.0'
|
||||
):
|
||||
msg = _("FlashArray Purity version less than 5.3.0 unsupported."
|
||||
|
|
|
@ -12,12 +12,12 @@
|
|||
|
||||
"""Driver for RackScale Design."""
|
||||
|
||||
from distutils import version
|
||||
import json
|
||||
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
from oslo_utils import units
|
||||
from packaging import version
|
||||
try:
|
||||
from rsd_lib import RSDLib
|
||||
from sushy import exceptions as sushy_exceptions
|
||||
|
@ -81,15 +81,15 @@ class RSDClient(object):
|
|||
raise exception.VolumeBackendAPIException(
|
||||
data=_("initialize: Cannot connect to RSD PODM."))
|
||||
|
||||
rsd_api_version = version.LooseVersion(rsdlib._rsd_api_version)
|
||||
if rsd_api_version < version.LooseVersion("2.4.0"):
|
||||
rsd_api_version = version.parse(rsdlib._rsd_api_version)
|
||||
if rsd_api_version < version.parse("2.4.0"):
|
||||
raise exception.VolumeBackendAPIException(
|
||||
data=(_("initialize: Unsupported rsd_api version: "
|
||||
"%(current)s < %(expected)s.")
|
||||
% {'current': rsdlib._rsd_api_version,
|
||||
'expected': "2.4.0"}))
|
||||
|
||||
if rsdlib._redfish_version < version.LooseVersion("1.1.0"):
|
||||
if version.parse(rsdlib._redfish_version) < version.parse("1.1.0"):
|
||||
raise exception.VolumeBackendAPIException(
|
||||
data=(_("initialize: Unsupported rsd_lib version: "
|
||||
"%(current)s < %(expected)s.")
|
||||
|
|
Loading…
Reference in New Issue