Merge "VMAX Driver - Initiator retrieval short hostname fix" into stable/pike
This commit is contained in:
commit
3cbe705825
|
@ -1995,19 +1995,6 @@ class VMAXRestTest(test.TestCase):
|
|||
init_list = self.rest.get_initiator_list(array)
|
||||
self.assertFalse(init_list)
|
||||
|
||||
def test_get_in_use_initiator_list_from_array(self):
|
||||
ref_list = self.data.initiator_list[2]['initiatorId']
|
||||
init_list = self.rest.get_in_use_initiator_list_from_array(
|
||||
self.data.array)
|
||||
self.assertEqual(ref_list, init_list)
|
||||
|
||||
def test_get_in_use_initiator_list_from_array_failed(self):
|
||||
array = self.data.array
|
||||
with mock.patch.object(self.rest, 'get_initiator_list',
|
||||
return_value=[]):
|
||||
init_list = self.rest.get_in_use_initiator_list_from_array(array)
|
||||
self.assertFalse(init_list)
|
||||
|
||||
def test_get_initiator_group_from_initiator(self):
|
||||
initiator = self.data.wwpn1
|
||||
ref_group = self.data.initiatorgroup_name_f
|
||||
|
@ -5183,18 +5170,26 @@ class VMAXMaskingTest(test.TestCase):
|
|||
exception.VolumeBackendAPIException,
|
||||
self.driver_fc.masking.find_initiator_names, connector)
|
||||
|
||||
def test_find_initiator_group(self):
|
||||
def test_find_initiator_group_found(self):
|
||||
with mock.patch.object(
|
||||
rest.VMAXRest, 'get_in_use_initiator_list_from_array',
|
||||
rest.VMAXRest, 'get_initiator_list',
|
||||
return_value=self.data.initiator_list[2]['initiatorId']):
|
||||
with mock.patch.object(
|
||||
rest.VMAXRest, 'get_initiator_group_from_initiator',
|
||||
rest.VMAXRest, 'get_initiator_group_from_initiator',
|
||||
return_value=self.data.initiator_list):
|
||||
found_init_group_nam = (
|
||||
self.driver.masking._find_initiator_group(
|
||||
self.data.array, ['FA-1D:4:123456789012345']))
|
||||
self.assertEqual(self.data.initiator_list,
|
||||
found_init_group_nam)
|
||||
|
||||
def test_find_initiator_group_not_found(self):
|
||||
with mock.patch.object(
|
||||
rest.VMAXRest, 'get_initiator_list',
|
||||
return_value=self.data.initiator_list[2]['initiatorId']):
|
||||
with mock.patch.object(
|
||||
rest.VMAXRest, 'get_initiator_group_from_initiator',
|
||||
return_value=None):
|
||||
found_init_group_nam = (
|
||||
self.driver.masking._find_initiator_group(
|
||||
self.data.array, ['Error']))
|
||||
|
|
|
@ -439,7 +439,7 @@ class VMAXCommon(object):
|
|||
LOG.info("Unmap volume: %(volume)s.",
|
||||
{'volume': volume_name})
|
||||
if connector is not None:
|
||||
host = connector['host']
|
||||
host = self.utils.get_host_short_name(connector['host'])
|
||||
else:
|
||||
LOG.warning("Cannot get host name from connector object - "
|
||||
"assuming force-detach.")
|
||||
|
|
|
@ -82,6 +82,9 @@ class VMAXFCDriver(driver.FibreChannelDriver):
|
|||
- Support for volume replication
|
||||
- Support for live migration
|
||||
- Support for Generic Volume Group
|
||||
backport from 3.3.0
|
||||
- Fix for initiator retrieval and short hostname unmapping
|
||||
(bugs #1783855 #1783867)
|
||||
"""
|
||||
|
||||
VERSION = "3.0.0"
|
||||
|
@ -285,7 +288,7 @@ class VMAXFCDriver(driver.FibreChannelDriver):
|
|||
"""
|
||||
loc = volume.provider_location
|
||||
name = ast.literal_eval(loc)
|
||||
host = connector['host']
|
||||
host = self.common.utils.get_host_short_name(connector['host'])
|
||||
try:
|
||||
array = name['array']
|
||||
device_id = name['device_id']
|
||||
|
|
|
@ -87,6 +87,9 @@ class VMAXISCSIDriver(driver.ISCSIDriver):
|
|||
- Support for volume replication
|
||||
- Support for live migration
|
||||
- Support for Generic Volume Group
|
||||
backport from 3.3.0
|
||||
- Fix for initiator retrieval and short hostname unmapping
|
||||
(bugs #1783855 #1783867)
|
||||
"""
|
||||
|
||||
VERSION = "3.0.0"
|
||||
|
|
|
@ -798,10 +798,9 @@ class VMAXMasking(object):
|
|||
:returns: initiator group name -- string or None
|
||||
"""
|
||||
ig_name = None
|
||||
init_list = self.rest.get_in_use_initiator_list_from_array(
|
||||
serial_number)
|
||||
for initiator in initiator_names:
|
||||
found_init = [init for init in init_list if initiator in init]
|
||||
params = {'initiator_hba': initiator.lower()}
|
||||
found_init = self.rest.get_initiator_list(serial_number, params)
|
||||
if found_init:
|
||||
ig_name = self.rest.get_initiator_group_from_initiator(
|
||||
serial_number, found_init[0])
|
||||
|
|
|
@ -1260,17 +1260,6 @@ class VMAXRest(object):
|
|||
init_list = []
|
||||
return init_list
|
||||
|
||||
def get_in_use_initiator_list_from_array(self, array):
|
||||
"""Get the list of initiators which are in-use from the array.
|
||||
|
||||
Gets the list of initiators from the array which are in
|
||||
hosts/ initiator groups.
|
||||
:param array: the array serial number
|
||||
:returns: init_list
|
||||
"""
|
||||
params = {'in_a_host': 'true'}
|
||||
return self.get_initiator_list(array, params)
|
||||
|
||||
def get_initiator_group_from_initiator(self, array, initiator):
|
||||
"""Given an initiator, get its corresponding initiator group, if any.
|
||||
|
||||
|
|
Loading…
Reference in New Issue