Merge "PowerMax Driver - Version comparison correction"

This commit is contained in:
Zuul 2020-04-16 00:35:34 +00:00 committed by Gerrit Code Review
commit edd5bcace2
6 changed files with 99 additions and 17 deletions

View File

@ -1263,7 +1263,7 @@ class PowerMaxData(object):
data_dict = {volume_id: volume_info_dict}
platform = 'Linux-4.4.0-104-generic-x86_64-with-Ubuntu-16.04-xenial'
unisphere_version = u'V9.1.0.5'
unisphere_version = u'V9.1.0.14'
unisphere_version_90 = "V9.0.0.1"
openstack_release = '12.0.0.0b3.dev401'
openstack_version = '12.0.0'

View File

@ -774,6 +774,18 @@ class PowerMaxRestTest(test.TestCase):
self.data.array, self.data.device_id, element_name)
self.assertIsNone(found_dev_id)
def test_check_volume_device_id_volume_identifier_none(self):
element_name = self.utils.get_volume_element_name(
self.data.test_volume.id)
vol_details_vol_identifier_none = deepcopy(
self.data.volume_details_legacy)
vol_details_vol_identifier_none['volume_identifier'] = None
with mock.patch.object(self.rest, 'get_volume',
return_value=vol_details_vol_identifier_none):
found_dev_id = self.rest.check_volume_device_id(
self.data.array, self.data.device_id, element_name)
self.assertIsNone(found_dev_id)
def test_find_mv_connections_for_vol(self):
device_id = self.data.device_id
ref_lun_id = int(
@ -2183,3 +2195,34 @@ class PowerMaxRestTest(test.TestCase):
self.assertRaises(exception.VolumeBackendAPIException,
self.rest.wait_for_rdf_pair_sync,
array_id, sg_name, rdf_group_no, rep_extra_specs)
def test_validate_unisphere_version_unofficial_success(self):
version = 'T9.1.0.1054'
returned_version = {'version': version}
with mock.patch.object(self.rest, "request",
return_value=(200,
returned_version)) as mock_req:
valid_version = self.rest.validate_unisphere_version()
self.assertTrue(valid_version)
request_count = mock_req.call_count
self.assertEqual(1, request_count)
def test_validate_unisphere_version_unofficial_failure(self):
version = 'T9.0.0.1054'
returned_version = {'version': version}
with mock.patch.object(self.rest, "request",
return_value=(200,
returned_version)):
valid_version = self.rest.validate_unisphere_version()
self.assertFalse(valid_version)
def test_validate_unisphere_version_unofficial_greater_than(self):
version = 'T9.2.0.1054'
returned_version = {'version': version}
with mock.patch.object(self.rest, "request",
return_value=(200,
returned_version)) as mock_req:
valid_version = self.rest.validate_unisphere_version()
self.assertTrue(valid_version)
request_count = mock_req.call_count
self.assertEqual(1, request_count)

View File

@ -1560,3 +1560,21 @@ class PowerMaxUtilsTest(test.TestCase):
updated_extra_specs = self.utils.get_migration_delete_extra_specs(
volume, extra_specs, None)
self.assertEqual(self.data.extra_specs, updated_extra_specs)
def test_version_meet_req_true(self):
version = '9.1.0.14'
minimum_version = '9.1.0.5'
self.assertTrue(
self.utils.version_meet_req(version, minimum_version))
def test_version_meet_req_false(self):
version = '9.1.0.3'
minimum_version = '9.1.0.5'
self.assertFalse(
self.utils.version_meet_req(version, minimum_version))
def test_version_meet_req_major_true(self):
version = '9.2.0.1'
minimum_version = '9.1.0.5'
self.assertTrue(
self.utils.version_meet_req(version, minimum_version))

View File

@ -815,8 +815,11 @@ class PowerMaxCommon(object):
{'volume': volume_name})
if (self.utils.is_metro_device(rep_config, extra_specs)
and not is_multipath and self.protocol.lower() == 'iscsi'):
LOG.warning("Multipathing is not correctly enabled "
"on your system.")
LOG.warning("Either multipathing is not correctly/currently "
"enabled on your system or the volume was created "
"prior to multipathing being enabled. Please refer "
"to the online PowerMax Cinder driver documentation "
"for this release for further details.")
return
if self.utils.is_volume_failed_over(volume):

View File

@ -36,7 +36,7 @@ SLOPROVISIONING = 'sloprovisioning'
REPLICATION = 'replication'
SYSTEM = 'system'
U4V_VERSION = '91'
MIN_U4P_VERSION = '9.1.0.5'
MIN_U4P_VERSION = '9.1.0.14'
UCODE_5978 = '5978'
retry_exc_tuple = (exception.VolumeBackendAPIException,)
# HTTP constants
@ -1040,17 +1040,18 @@ class PowerMaxRest(object):
'Device id = %(di)s',
{'en': element_name, 'vi': vol_identifier,
'di': device_id})
if vol_identifier in element_name:
found_device_id = device_id
if vol_identifier != element_name:
LOG.debug("Device %(di)s is a legacy volume created using "
"SMI-S.",
{'di': device_id})
elif name_id:
# This may be host-assisted migration case
element_name = self.utils.get_volume_element_name(name_id)
if vol_identifier == element_name:
if vol_identifier:
if vol_identifier in element_name:
found_device_id = device_id
if vol_identifier != element_name:
LOG.debug("Device %(di)s is a legacy volume created "
"using SMI-S.",
{'di': device_id})
elif name_id:
# This may be host-assisted migration case
element_name = self.utils.get_volume_element_name(name_id)
if vol_identifier == element_name:
found_device_id = device_id
return found_device_id
def add_vol_to_sg(self, array, storagegroup_name, device_id, extra_specs,
@ -3015,14 +3016,20 @@ class PowerMaxRest(object):
:returns: unisphere_meets_min_req -- boolean
"""
running_version, __ = self.get_uni_version()
running_version, major_version = self.get_uni_version()
minimum_version = MIN_U4P_VERSION
unisphere_meets_min_req = False
if running_version and (running_version[0].isalpha()):
# remove leading letter
version = running_version[1:]
unisphere_meets_min_req = version >= minimum_version
if running_version.lower()[0] == 'v':
version = running_version[1:]
unisphere_meets_min_req = (
self.utils.version_meet_req(version, minimum_version))
elif running_version.lower()[0] == 't':
LOG.warning("%(version)s This is not a official release of "
"Unisphere.", {'version': running_version})
return major_version >= U4V_VERSION
if unisphere_meets_min_req:
LOG.info("Unisphere version %(running_version)s meets minimum "

View File

@ -1886,3 +1886,14 @@ class PowerMaxUtils(object):
else:
extra_specs.pop(IS_RE, None)
return extra_specs
@staticmethod
def version_meet_req(version, minimum_version):
"""Check if current version meets the minimum version allowed
:param version: unisphere version
:param minimum_version: minimum version allowed
:returns: boolean
"""
from pkg_resources import parse_version
return parse_version(version) >= parse_version(minimum_version)