HPE3PAR: Create FC vlun as host sees
Host sees VLUN template allows host connected to any port to see a vv. so, only one vlun template will be created per host irrespective of number of FC ports available. Change-Id: I623d6114db866a465955f8a5ae7f40b69c781622 Closes-Bug: #1734505
This commit is contained in:
parent
92d9f19f99
commit
cd18537fd6
@ -5547,12 +5547,10 @@ class TestHPE3PARFCDriver(HPE3PARBaseDriver):
|
|||||||
hpeexceptions.HTTPNotFound('fake'),
|
hpeexceptions.HTTPNotFound('fake'),
|
||||||
[{'active': True,
|
[{'active': True,
|
||||||
'volumeName': self.VOLUME_3PAR_NAME,
|
'volumeName': self.VOLUME_3PAR_NAME,
|
||||||
'portPos': {'node': 7, 'slot': 1, 'cardPort': 1},
|
|
||||||
'remoteName': self.wwn[1],
|
'remoteName': self.wwn[1],
|
||||||
'lun': 90, 'type': 0}],
|
'lun': 90, 'type': 0}],
|
||||||
[{'active': True,
|
[{'active': True,
|
||||||
'volumeName': self.VOLUME_3PAR_NAME,
|
'volumeName': self.VOLUME_3PAR_NAME,
|
||||||
'portPos': {'node': 6, 'slot': 1, 'cardPort': 1},
|
|
||||||
'remoteName': self.wwn[0],
|
'remoteName': self.wwn[0],
|
||||||
'lun': 90, 'type': 0}]]
|
'lun': 90, 'type': 0}]]
|
||||||
|
|
||||||
@ -5570,8 +5568,8 @@ class TestHPE3PARFCDriver(HPE3PARBaseDriver):
|
|||||||
'target_wwn': ['0987654321234', '123456789000987'],
|
'target_wwn': ['0987654321234', '123456789000987'],
|
||||||
'target_discovered': True,
|
'target_discovered': True,
|
||||||
'initiator_target_map':
|
'initiator_target_map':
|
||||||
{'123456789012345': ['123456789000987'],
|
{'123456789012345': ['0987654321234', '123456789000987'],
|
||||||
'123456789054321': ['0987654321234']}}}
|
'123456789054321': ['0987654321234', '123456789000987']}}}
|
||||||
|
|
||||||
with mock.patch.object(hpecommon.HPE3PARCommon,
|
with mock.patch.object(hpecommon.HPE3PARCommon,
|
||||||
'_create_client') as mock_create_client:
|
'_create_client') as mock_create_client:
|
||||||
@ -5589,27 +5587,17 @@ class TestHPE3PARFCDriver(HPE3PARBaseDriver):
|
|||||||
mock.call.getHost(self.FAKE_HOST),
|
mock.call.getHost(self.FAKE_HOST),
|
||||||
mock.call.getPorts(),
|
mock.call.getPorts(),
|
||||||
mock.call.getHostVLUNs(self.FAKE_HOST),
|
mock.call.getHostVLUNs(self.FAKE_HOST),
|
||||||
mock.call.getPorts(),
|
|
||||||
mock.call.createVLUN(
|
mock.call.createVLUN(
|
||||||
self.VOLUME_3PAR_NAME,
|
self.VOLUME_3PAR_NAME,
|
||||||
auto=True,
|
auto=True,
|
||||||
hostname=self.FAKE_HOST,
|
hostname=self.FAKE_HOST,
|
||||||
lun=None,
|
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}),
|
|
||||||
mock.call.getHostVLUNs(self.FAKE_HOST)]
|
mock.call.getHostVLUNs(self.FAKE_HOST)]
|
||||||
|
|
||||||
mock_client.assert_has_calls(
|
mock_client.assert_has_calls(
|
||||||
self.standard_login +
|
self.standard_login +
|
||||||
expected +
|
expected +
|
||||||
self.standard_logout)
|
self.standard_logout)
|
||||||
|
|
||||||
self.assertDictEqual(expected_properties, result)
|
self.assertDictEqual(expected_properties, result)
|
||||||
|
|
||||||
def test_initialize_connection_single_path(self):
|
def test_initialize_connection_single_path(self):
|
||||||
@ -5625,8 +5613,6 @@ class TestHPE3PARFCDriver(HPE3PARBaseDriver):
|
|||||||
'firmwareVersion': None,
|
'firmwareVersion': None,
|
||||||
'hostSpeed': 0,
|
'hostSpeed': 0,
|
||||||
'model': None,
|
'model': None,
|
||||||
'portPos': {'cardPort': 1, 'node': 7,
|
|
||||||
'slot': 1},
|
|
||||||
'vendor': None,
|
'vendor': None,
|
||||||
'wwn': self.wwn[0]}]}]
|
'wwn': self.wwn[0]}]}]
|
||||||
mock_client.queryHost.return_value = {
|
mock_client.queryHost.return_value = {
|
||||||
@ -5674,13 +5660,11 @@ class TestHPE3PARFCDriver(HPE3PARBaseDriver):
|
|||||||
mock.call.getHost(self.FAKE_HOST),
|
mock.call.getHost(self.FAKE_HOST),
|
||||||
mock.call.getPorts(),
|
mock.call.getPorts(),
|
||||||
mock.call.getHostVLUNs(self.FAKE_HOST),
|
mock.call.getHostVLUNs(self.FAKE_HOST),
|
||||||
mock.call.getPorts(),
|
|
||||||
mock.call.createVLUN(
|
mock.call.createVLUN(
|
||||||
self.VOLUME_3PAR_NAME,
|
self.VOLUME_3PAR_NAME,
|
||||||
auto=True,
|
auto=True,
|
||||||
hostname=self.FAKE_HOST,
|
hostname=self.FAKE_HOST,
|
||||||
lun=None,
|
lun=None),
|
||||||
portPos={'node': 7, 'slot': 1, 'cardPort': 1}),
|
|
||||||
mock.call.getHostVLUNs(self.FAKE_HOST)]
|
mock.call.getHostVLUNs(self.FAKE_HOST)]
|
||||||
|
|
||||||
mock_client.assert_has_calls(
|
mock_client.assert_has_calls(
|
||||||
@ -5797,16 +5781,12 @@ class TestHPE3PARFCDriver(HPE3PARBaseDriver):
|
|||||||
'firmwareVersion': None,
|
'firmwareVersion': None,
|
||||||
'hostSpeed': 0,
|
'hostSpeed': 0,
|
||||||
'model': None,
|
'model': None,
|
||||||
'portPos': {'cardPort': 1, 'node': 7,
|
|
||||||
'slot': 1},
|
|
||||||
'vendor': None,
|
'vendor': None,
|
||||||
'wwn': self.wwn[0]},
|
'wwn': self.wwn[0]},
|
||||||
{'driverVersion': None,
|
{'driverVersion': None,
|
||||||
'firmwareVersion': None,
|
'firmwareVersion': None,
|
||||||
'hostSpeed': 0,
|
'hostSpeed': 0,
|
||||||
'model': None,
|
'model': None,
|
||||||
'portPos': {'cardPort': 1, 'node': 6,
|
|
||||||
'slot': 1},
|
|
||||||
'vendor': None,
|
'vendor': None,
|
||||||
'wwn': self.wwn[1]}]}]
|
'wwn': self.wwn[1]}]}]
|
||||||
mock_client.queryHost.return_value = {
|
mock_client.queryHost.return_value = {
|
||||||
@ -5820,11 +5800,9 @@ class TestHPE3PARFCDriver(HPE3PARBaseDriver):
|
|||||||
[{'active': True,
|
[{'active': True,
|
||||||
'volumeName': self.VOLUME_3PAR_NAME,
|
'volumeName': self.VOLUME_3PAR_NAME,
|
||||||
'lun': 90, 'type': 0,
|
'lun': 90, 'type': 0,
|
||||||
'remoteName': self.wwn[1],
|
'remoteName': self.wwn[1]}],
|
||||||
'portPos': {'cardPort': 1, 'node': 7, 'slot': 1}}],
|
|
||||||
[{'active': True,
|
[{'active': True,
|
||||||
'volumeName': self.VOLUME_3PAR_NAME,
|
'volumeName': self.VOLUME_3PAR_NAME,
|
||||||
'portPos': {'node': 6, 'slot': 1, 'cardPort': 1},
|
|
||||||
'remoteName': self.wwn[0],
|
'remoteName': self.wwn[0],
|
||||||
'lun': 90, 'type': 0}]]
|
'lun': 90, 'type': 0}]]
|
||||||
|
|
||||||
@ -5842,8 +5820,8 @@ class TestHPE3PARFCDriver(HPE3PARBaseDriver):
|
|||||||
'target_wwn': ['0987654321234', '123456789000987'],
|
'target_wwn': ['0987654321234', '123456789000987'],
|
||||||
'target_discovered': True,
|
'target_discovered': True,
|
||||||
'initiator_target_map':
|
'initiator_target_map':
|
||||||
{'123456789012345': ['123456789000987'],
|
{'123456789012345': ['0987654321234', '123456789000987'],
|
||||||
'123456789054321': ['0987654321234']}}}
|
'123456789054321': ['0987654321234', '123456789000987']}}}
|
||||||
|
|
||||||
with mock.patch.object(hpecommon.HPE3PARCommon,
|
with mock.patch.object(hpecommon.HPE3PARCommon,
|
||||||
'_create_client') as mock_create_client:
|
'_create_client') as mock_create_client:
|
||||||
@ -5861,27 +5839,17 @@ class TestHPE3PARFCDriver(HPE3PARBaseDriver):
|
|||||||
mock.call.getHost(self.FAKE_HOST),
|
mock.call.getHost(self.FAKE_HOST),
|
||||||
mock.call.getPorts(),
|
mock.call.getPorts(),
|
||||||
mock.call.getHostVLUNs(self.FAKE_HOST),
|
mock.call.getHostVLUNs(self.FAKE_HOST),
|
||||||
mock.call.getPorts(),
|
|
||||||
mock.call.createVLUN(
|
mock.call.createVLUN(
|
||||||
self.VOLUME_3PAR_NAME,
|
self.VOLUME_3PAR_NAME,
|
||||||
auto=True,
|
auto=True,
|
||||||
hostname=self.FAKE_HOST,
|
hostname=self.FAKE_HOST,
|
||||||
lun=None,
|
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}),
|
|
||||||
mock.call.getHostVLUNs(self.FAKE_HOST)]
|
mock.call.getHostVLUNs(self.FAKE_HOST)]
|
||||||
|
|
||||||
mock_client.assert_has_calls(
|
mock_client.assert_has_calls(
|
||||||
self.standard_login +
|
self.standard_login +
|
||||||
expected +
|
expected +
|
||||||
self.standard_logout)
|
self.standard_logout)
|
||||||
|
|
||||||
self.assertDictEqual(expected_properties, result)
|
self.assertDictEqual(expected_properties, result)
|
||||||
|
|
||||||
def test_terminate_connection(self):
|
def test_terminate_connection(self):
|
||||||
|
@ -37,8 +37,6 @@ except ImportError:
|
|||||||
from oslo_log import log as logging
|
from oslo_log import log as logging
|
||||||
from oslo_utils.excutils import save_and_reraise_exception
|
from oslo_utils.excutils import save_and_reraise_exception
|
||||||
|
|
||||||
from cinder import exception
|
|
||||||
from cinder.i18n import _
|
|
||||||
from cinder import interface
|
from cinder import interface
|
||||||
from cinder import utils
|
from cinder import utils
|
||||||
from cinder.volume.drivers.hpe import hpe_3par_base as hpebasedriver
|
from cinder.volume.drivers.hpe import hpe_3par_base as hpebasedriver
|
||||||
@ -109,10 +107,11 @@ class HPE3PARFCDriver(hpebasedriver.HPE3PARDriverBase):
|
|||||||
4.0.0 - Adds base class.
|
4.0.0 - Adds base class.
|
||||||
4.0.1 - Added check to remove FC zones. bug #1730720
|
4.0.1 - Added check to remove FC zones. bug #1730720
|
||||||
4.0.2 - Create one vlun in single path configuration. bug #1727176
|
4.0.2 - Create one vlun in single path configuration. bug #1727176
|
||||||
|
4.0.3 - Create FC vlun as host sees. bug #1734505
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
VERSION = "4.0.2"
|
VERSION = "4.0.3"
|
||||||
|
|
||||||
# The name of the CI wiki page.
|
# The name of the CI wiki page.
|
||||||
CI_WIKI_NAME = "HPE_Storage_CI"
|
CI_WIKI_NAME = "HPE_Storage_CI"
|
||||||
@ -179,61 +178,16 @@ class HPE3PARFCDriver(hpebasedriver.HPE3PARDriverBase):
|
|||||||
vlun = None
|
vlun = None
|
||||||
if existing_vlun is None:
|
if existing_vlun is None:
|
||||||
# now that we have a host, create the VLUN
|
# now that we have a host, create the VLUN
|
||||||
nsp = None
|
if self.lookup_service is not None and numPaths == 1:
|
||||||
lun_id = None
|
nsp = None
|
||||||
active_fc_port_list = common.get_active_fc_target_ports()
|
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']))
|
|
||||||
for port in active_fc_port_list:
|
for port in active_fc_port_list:
|
||||||
if (
|
if port['portWWN'].lower() == target_wwns[0].lower():
|
||||||
port['type'] == common.client.PORT_TYPE_HOST and
|
|
||||||
port['nsp'] in host_connected_nsp
|
|
||||||
):
|
|
||||||
nsp = port['nsp']
|
nsp = port['nsp']
|
||||||
vlun = common.create_vlun(volume,
|
break
|
||||||
host,
|
vlun = common.create_vlun(volume, host, nsp)
|
||||||
nsp,
|
else:
|
||||||
lun_id=lun_id)
|
vlun = common.create_vlun(volume, host)
|
||||||
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)
|
|
||||||
else:
|
else:
|
||||||
vlun = existing_vlun
|
vlun = existing_vlun
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user