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