Merge "VMAX driver - Concurrency issues involving replicated volumes"

This commit is contained in:
Zuul 2018-03-07 02:37:55 +00:00 committed by Gerrit Code Review
commit 3e4cd3812e
2 changed files with 27 additions and 1 deletions

View File

@ -659,6 +659,7 @@ class VMAXCommonData(object):
{"symmetrixId": array_herc,
"model": "VMAXHERC",
"ucode": "5978.1091.1092"}]
version_details = {"version": "V9.0.0.1"}
headroom = {"headroom": [{"headroomCapacity": 20348.29}]}
@ -847,6 +848,8 @@ class FakeRequestsSession(object):
if job['jobId'] in url:
return_object = job
break
elif 'version' in url:
return_object = self.data.version_details
else:
for symm in self.data.symmetrix:
if symm['symmetrixId'] in url:
@ -1652,6 +1655,13 @@ class VMAXRestTest(test.TestCase):
array_details = self.rest.get_array_serial(self.data.failed_resource)
self.assertIsNone(array_details)
def test_get_uni_version(self):
version, major_version = self.rest.get_uni_version()
self.assertEqual('90', major_version)
with mock.patch.object(self.rest, '_get_request', return_value=None):
version, major_version = self.rest.get_uni_version()
self.assertIsNone(major_version)
def test_get_srp_by_name(self):
ref_details = self.data.srp_details
srp_details = self.rest.get_srp_by_name(

View File

@ -430,6 +430,20 @@ class VMAXRest(object):
is_next_gen = True
return is_next_gen
def get_uni_version(self):
"""Get the unisphere version from the server.
:return: version and major_version(e.g. ("V8.4.0.16", "84"))
"""
version, major_version = None, None
target_uri = "/%s/system/version" % U4V_VERSION
response = self._get_request(target_uri, 'version')
if response and response.get('version'):
version = response['version']
version_list = version.split('.')
major_version = version_list[0][1] + version_list[1]
return version, major_version
def get_srp_by_name(self, array, srp=None):
"""Returns the details of a storage pool.
@ -944,8 +958,10 @@ class VMAXRest(object):
:returns: volume dict
:raises: VolumeBackendAPIException
"""
version = self.get_uni_version()[1]
volume_dict = self.get_resource(
array, SLOPROVISIONING, 'volume', resource_name=device_id)
array, SLOPROVISIONING, 'volume', resource_name=device_id,
version=version)
if not volume_dict:
exception_message = (_("Volume %(deviceID)s not found.")
% {'deviceID': device_id})