Merge "NEC driver: Fix exception in terminate_connection with no connector"

This commit is contained in:
Jenkins 2017-10-10 19:58:58 +00:00 committed by Gerrit Code Review
commit 274ce06f58
2 changed files with 13 additions and 5 deletions

View File

@ -992,6 +992,9 @@ class ExportTest(volume_helper.MStorageDSVDriver, unittest.TestCase):
self.assertEqual(
'2A00000991020012',
info['data']['initiator_target_map']['10000090FAA0786B'][3])
info = self._fc_terminate_connection(self.vol, None)
self.assertEqual('fibre_channel', info['driver_volume_type'])
self.assertEqual({}, info['data'])
class DeleteDSVVolume_test(volume_helper.MStorageDSVDriver,

View File

@ -1396,12 +1396,15 @@ class MStorageDriver(volume_common.MStorageVolumeCommon):
for port in hostport:
if port['protocol'].lower() == 'fc':
fc_ports.append(port)
target_wwns, init_targ_map = (
self._build_initiator_target_map(connector, fc_ports))
info = {'driver_volume_type': 'fibre_channel',
'data': {'target_wwn': target_wwns,
'initiator_target_map': init_targ_map}}
'data': {}}
if connector is not None:
target_wwns, init_targ_map = (
self._build_initiator_target_map(connector, fc_ports))
info['data'] = {'target_wwn': target_wwns,
'initiator_target_map': init_targ_map}
LOG.debug('_fc_terminate_connection'
'(Volume ID = %(id)s, connector = %(connector)s, '
'info = %(info)s) End.',
@ -1429,6 +1432,8 @@ class MStorageDriver(volume_common.MStorageVolumeCommon):
for port in fc_ports:
target_wwns.append(port['wwpn'])
initiator_wwns = []
if connector is not None:
initiator_wwns = connector['wwpns']
init_targ_map = {}