Merge "HPE3PAR: Create FC vlun as host sees" into stable/ocata

This commit is contained in:
Zuul
2018-04-27 05:38:44 +00:00
committed by Gerrit Code Review
2 changed files with 17 additions and 92 deletions

View File

@@ -4851,16 +4851,12 @@ class TestHPE3PARFCDriver(HPE3PARBaseDriver, test.TestCase):
'firmwareVersion': None,
'hostSpeed': 0,
'model': None,
'portPos': {'cardPort': 1, 'node': 7,
'slot': 1},
'vendor': None,
'wwn': self.wwn[0]},
{'driverVersion': None,
'firmwareVersion': None,
'hostSpeed': 0,
'model': None,
'portPos': {'cardPort': 1, 'node': 6,
'slot': 1},
'vendor': None,
'wwn': self.wwn[1]}]}]
mock_client.queryHost.return_value = {
@@ -4873,12 +4869,10 @@ class TestHPE3PARFCDriver(HPE3PARBaseDriver, test.TestCase):
hpeexceptions.HTTPNotFound('fake'),
[{'active': True,
'volumeName': self.VOLUME_3PAR_NAME,
'portPos': {'node': 7, 'slot': 1, 'cardPort': 1},
'remoteName': self.wwn[1],
'lun': 90, 'type': 0}],
[{'active': True,
'volumeName': self.VOLUME_3PAR_NAME,
'portPos': {'node': 6, 'slot': 1, 'cardPort': 1},
'remoteName': self.wwn[0],
'lun': 90, 'type': 0}]]
@@ -4896,8 +4890,8 @@ class TestHPE3PARFCDriver(HPE3PARBaseDriver, test.TestCase):
'target_wwn': ['0987654321234', '123456789000987'],
'target_discovered': True,
'initiator_target_map':
{'123456789012345': ['123456789000987'],
'123456789054321': ['0987654321234']}}}
{'123456789012345': ['0987654321234', '123456789000987'],
'123456789054321': ['0987654321234', '123456789000987']}}}
with mock.patch.object(hpecommon.HPE3PARCommon,
'_create_client') as mock_create_client:
@@ -4915,27 +4909,17 @@ class TestHPE3PARFCDriver(HPE3PARBaseDriver, test.TestCase):
mock.call.getHost(self.FAKE_HOST),
mock.call.getPorts(),
mock.call.getHostVLUNs(self.FAKE_HOST),
mock.call.getPorts(),
mock.call.createVLUN(
self.VOLUME_3PAR_NAME,
auto=True,
hostname=self.FAKE_HOST,
lun=None,
portPos={'node': 7, 'slot': 1, 'cardPort': 1}),
mock.call.getHostVLUNs(self.FAKE_HOST),
mock.call.createVLUN(
self.VOLUME_3PAR_NAME,
auto=False,
hostname=self.FAKE_HOST,
lun=90,
portPos={'node': 6, 'slot': 1, 'cardPort': 1}),
lun=None),
mock.call.getHostVLUNs(self.FAKE_HOST)]
mock_client.assert_has_calls(
self.standard_login +
expected +
self.standard_logout)
self.assertDictEqual(expected_properties, result)
@mock.patch('cinder.zonemanager.utils.create_lookup_service')
@@ -5045,16 +5029,12 @@ class TestHPE3PARFCDriver(HPE3PARBaseDriver, test.TestCase):
'firmwareVersion': None,
'hostSpeed': 0,
'model': None,
'portPos': {'cardPort': 1, 'node': 7,
'slot': 1},
'vendor': None,
'wwn': self.wwn[0]},
{'driverVersion': None,
'firmwareVersion': None,
'hostSpeed': 0,
'model': None,
'portPos': {'cardPort': 1, 'node': 6,
'slot': 1},
'vendor': None,
'wwn': self.wwn[1]}]}]
mock_client.queryHost.return_value = {
@@ -5068,11 +5048,9 @@ class TestHPE3PARFCDriver(HPE3PARBaseDriver, test.TestCase):
[{'active': True,
'volumeName': self.VOLUME_3PAR_NAME,
'lun': 90, 'type': 0,
'remoteName': self.wwn[1],
'portPos': {'cardPort': 1, 'node': 7, 'slot': 1}}],
'remoteName': self.wwn[1]}],
[{'active': True,
'volumeName': self.VOLUME_3PAR_NAME,
'portPos': {'node': 6, 'slot': 1, 'cardPort': 1},
'remoteName': self.wwn[0],
'lun': 90, 'type': 0}]]
@@ -5090,8 +5068,8 @@ class TestHPE3PARFCDriver(HPE3PARBaseDriver, test.TestCase):
'target_wwn': ['0987654321234', '123456789000987'],
'target_discovered': True,
'initiator_target_map':
{'123456789012345': ['123456789000987'],
'123456789054321': ['0987654321234']}}}
{'123456789012345': ['0987654321234', '123456789000987'],
'123456789054321': ['0987654321234', '123456789000987']}}}
with mock.patch.object(hpecommon.HPE3PARCommon,
'_create_client') as mock_create_client:
@@ -5109,20 +5087,11 @@ class TestHPE3PARFCDriver(HPE3PARBaseDriver, test.TestCase):
mock.call.getHost(self.FAKE_HOST),
mock.call.getPorts(),
mock.call.getHostVLUNs(self.FAKE_HOST),
mock.call.getPorts(),
mock.call.createVLUN(
self.VOLUME_3PAR_NAME,
auto=True,
hostname=self.FAKE_HOST,
lun=None,
portPos={'node': 7, 'slot': 1, 'cardPort': 1}),
mock.call.getHostVLUNs(self.FAKE_HOST),
mock.call.createVLUN(
self.VOLUME_3PAR_NAME,
auto=False,
hostname=self.FAKE_HOST,
lun=90,
portPos={'node': 6, 'slot': 1, 'cardPort': 1}),
lun=None),
mock.call.getHostVLUNs(self.FAKE_HOST)]
mock_client.assert_has_calls(

View File

@@ -109,10 +109,11 @@ class HPE3PARFCDriver(driver.ManageableVD,
3.0.9 - Handling HTTP conflict 409, host WWN/iSCSI name already used
by another host, while creating 3PAR FC Host. bug #1597454
3.0.10 - Added Entry point tracing
3.0.11 - Create FC vlun as host sees. bug #1734505
"""
VERSION = "3.0.10"
VERSION = "3.0.11"
# The name of the CI wiki page.
CI_WIKI_NAME = "HPE_Storage_CI"
@@ -291,61 +292,16 @@ class HPE3PARFCDriver(driver.ManageableVD,
vlun = None
if existing_vlun is None:
# now that we have a host, create the VLUN
nsp = None
lun_id = None
active_fc_port_list = common.get_active_fc_target_ports()
if self.lookup_service:
if not init_targ_map:
msg = _("Setup is incomplete. Device mapping "
"not found from FC network. "
"Cannot perform VLUN creation.")
LOG.error(msg)
raise exception.FCSanLookupServiceException(msg)
for target_wwn in target_wwns:
for port in active_fc_port_list:
if port['portWWN'].lower() == target_wwn.lower():
nsp = port['nsp']
vlun = common.create_vlun(volume,
host,
nsp,
lun_id=lun_id)
if lun_id is None:
lun_id = vlun['lun']
break
else:
init_targ_map.clear()
del target_wwns[:]
host_connected_nsp = []
for fcpath in host['FCPaths']:
if 'portPos' in fcpath:
host_connected_nsp.append(
common.build_nsp(fcpath['portPos']))
if self.lookup_service is not None and numPaths == 1:
nsp = None
active_fc_port_list = common.get_active_fc_target_ports()
for port in active_fc_port_list:
if (
port['type'] == common.client.PORT_TYPE_HOST and
port['nsp'] in host_connected_nsp
):
if port['portWWN'].lower() == target_wwns[0].lower():
nsp = port['nsp']
vlun = common.create_vlun(volume,
host,
nsp,
lun_id=lun_id)
target_wwns.append(port['portWWN'])
if vlun['remoteName'] in init_targ_map:
init_targ_map[vlun['remoteName']].append(
port['portWWN'])
else:
init_targ_map[vlun['remoteName']] = [
port['portWWN']]
if lun_id is None:
lun_id = vlun['lun']
if lun_id is None:
# New vlun creation failed
msg = _('No new vlun(s) were created')
LOG.error(msg)
raise exception.VolumeDriverException(msg)
break
vlun = common.create_vlun(volume, host, nsp)
else:
vlun = common.create_vlun(volume, host)
else:
vlun = existing_vlun