XtremIO: FC initialize connection failed
* Initialize connection fail when all initiators are connected to a non default named initiator group(IG). The failure happens since the default name was always added to the IG list even if one doesn't exists. Added a check before adding the default IG to the list to make sure it was created, thus preventing the failure. * Added unitest for existing IG. Change-Id: Ie761580fc5ff73683c32d2b79d94c6ba4db0b792 closes-bug: #1524766
This commit is contained in:
parent
e5936310fb
commit
2f3d05b5ba
|
@ -630,6 +630,33 @@ class EMCXIODriverFibreChannelTestCase(test.TestCase):
|
|||
self.data.connector)
|
||||
self.driver.delete_volume(self.data.test_volume)
|
||||
|
||||
def test_initialize_existing_ig_terminate_connection(self, req):
|
||||
req.side_effect = xms_request
|
||||
self.driver.client = xtremio.XtremIOClient4(
|
||||
self.config, self.config.xtremio_cluster_name)
|
||||
|
||||
self.driver.create_volume(self.data.test_volume)
|
||||
|
||||
pre_existing = 'pre_existing_host'
|
||||
self.driver._create_ig(pre_existing)
|
||||
wwpns = self.driver._get_initiator_name(self.data.connector)
|
||||
for wwpn in wwpns:
|
||||
data = {'initiator-name': wwpn, 'ig-id': pre_existing,
|
||||
'port-address': wwpn}
|
||||
self.driver.client.req('initiators', 'POST', data)
|
||||
|
||||
def get_fake_initiator(wwpn):
|
||||
return {'port-address': wwpn, 'ig-id': ['', pre_existing, 1]}
|
||||
with mock.patch.object(self.driver.client, 'get_initiator',
|
||||
side_effect=get_fake_initiator):
|
||||
map_data = self.driver.initialize_connection(self.data.test_volume,
|
||||
self.data.connector)
|
||||
self.assertEqual(1, map_data['data']['target_lun'])
|
||||
self.assertEqual(1, len(xms_data['initiator-groups']))
|
||||
self.driver.terminate_connection(self.data.test_volume,
|
||||
self.data.connector)
|
||||
self.driver.delete_volume(self.data.test_volume)
|
||||
|
||||
def test_race_on_terminate_connection(self, req):
|
||||
"""Test for race conditions on num_of_mapped_volumes.
|
||||
|
||||
|
|
|
@ -938,8 +938,9 @@ class XtremIOFibreChannelDriver(XtremIOVolumeDriver,
|
|||
data = {'initiator-name': wwpn, 'ig-id': ig_name,
|
||||
'port-address': wwpn}
|
||||
self.client.req('initiators', 'POST', data)
|
||||
igs = list(set([i['ig-id'][XTREMIO_OID_NAME]
|
||||
for i in found] + [ig_name]))
|
||||
igs = list(set([i['ig-id'][XTREMIO_OID_NAME] for i in found]))
|
||||
if new and ig['ig-id'][XTREMIO_OID_NAME] not in igs:
|
||||
igs.append(ig['ig-id'][XTREMIO_OID_NAME])
|
||||
|
||||
if len(igs) > 1:
|
||||
lun_num = self._get_free_lun(igs)
|
||||
|
|
Loading…
Reference in New Issue