3PAR: Allow iSCSI driver to be enabled for Primera 4.2 onwards.

For HPE Primera 4.2 or higher versions, now iSCSI driver is
supported along with existing FC driver.
Accordingly updated code and documentation.

Change-Id: Ie2542fc4b21050c4f14aea67ea488d9f9eeaae79
(cherry picked from commit 6cabe11c92)
This commit is contained in:
Raghavendra Tilay 2020-09-21 12:48:43 +00:00 committed by David Hill
parent 27e053bdc8
commit c0e8eda0dc
4 changed files with 65 additions and 11 deletions

View File

@ -763,14 +763,15 @@ class HPE3PARBaseDriver(test.TestCase):
spec=True,
)
def setup_mock_client(self, _m_client, driver, conf=None, m_conf=None,
is_primera=False):
is_primera=False,
wsapi_version=wsapi_version_latest):
_m_client = _m_client.return_value
# Configure the base constants, defaults etc...
_m_client.configure_mock(**self.mock_client_conf)
_m_client.getWsApiVersion.return_value = self.wsapi_version_latest
_m_client.getWsApiVersion.return_value = wsapi_version
_m_client.is_primera_array.return_value = is_primera
@ -8909,10 +8910,49 @@ class TestHPE3PARISCSIDriver(HPE3PARBaseDriver):
return mock_client
def test_iscsi_primera(self):
def test_iscsi_primera_old(self):
# primera 4.0.xx.yyy
wsapi_version_primera_old = {'major': 1,
'build': 40000128,
'minor': 8,
'revision': 1}
self.assertRaises(NotImplementedError, self.setup_mock_client,
driver=hpedriver.HPE3PARISCSIDriver,
is_primera=True)
is_primera=True,
wsapi_version=wsapi_version_primera_old)
def test_iscsi_primera_new(self, config=None, mock_conf=None):
# primera 4.2.xx.yyy
wsapi_version_primera_new = {'major': 1,
'build': 40202010,
'minor': 8,
'revision': 1}
self.ctxt = context.get_admin_context()
mock_client = self.setup_mock_client(
conf=config,
m_conf=mock_conf,
driver=hpedriver.HPE3PARISCSIDriver,
is_primera=True,
wsapi_version=wsapi_version_primera_new)
expected_get_cpgs = [
mock.call.getCPG(HPE3PAR_CPG),
mock.call.getCPG(HPE3PAR_CPG2)]
expected_get_ports = [mock.call.getPorts()]
expected_primera = [
mock.call.is_primera_array(),
mock.call.getWsApiVersion()]
mock_client.assert_has_calls(
self.standard_login +
expected_get_cpgs +
self.standard_logout +
expected_primera +
self.standard_login +
expected_get_ports +
self.standard_logout)
@ddt.data('volume', 'volume_name_id')
def test_initialize_connection(self, volume_attr):

View File

@ -128,10 +128,11 @@ class HPE3PARISCSIDriver(hpebasedriver.HPE3PARDriverBase):
failover. bug #1773069
4.0.4 - Added Peer Persistence feature
4.0.5 - Added Primera array check. bug #1849525
4.0.6 - Allow iSCSI support for Primera 4.2 onwards
"""
VERSION = "4.0.5"
VERSION = "4.0.6"
# The name of the CI wiki page.
CI_WIKI_NAME = "HPE_Storage_CI"
@ -144,9 +145,17 @@ class HPE3PARISCSIDriver(hpebasedriver.HPE3PARDriverBase):
client_obj = common.client
is_primera = client_obj.is_primera_array()
if is_primera:
LOG.error("For Primera, only FC is supported. "
"iSCSI cannot be used")
raise NotImplementedError()
api_version = client_obj.getWsApiVersion()
array_version = api_version['build']
LOG.debug("array version: %(version)s",
{'version': array_version})
if array_version < 40200000:
err_msg = (_('The iSCSI driver is not supported for '
'Primera %(version)s. It is supported '
'for Primera 4.2 or higher versions.')
% {'version': array_version})
LOG.error(err_msg)
raise NotImplementedError()
self.iscsi_ips = {}
common.client_login()

View File

@ -378,15 +378,15 @@ OpenStack software.
san_password=3parpass
# FIBRE CHANNEL DRIVER
# Note: For Primera, only FC driver is supported as of now.
# (uncomment the next line to enable the FC driver)
#volume_driver=cinder.volume.drivers.hpe.hpe_3par_fc.HPE3PARFCDriver
# iSCSI DRIVER
# If you enable the iSCSI driver, you must also set values
# for hpe3par_iscsi_ips or iscsi_ip_address in this file.
# Note: Primera currently requires the FC driver. If you
# configure iSCSI with Primera, the driver will fail to start.
# Note: The iSCSI driver is supported with 3PAR (all versions)
# and Primera (version 4.2 or higher). If you configure iSCSI
# with Primera 4.0 or 4.1, the driver will fail to start.
# (uncomment the next line to enable the iSCSI driver)
#volume_driver=cinder.volume.drivers.hpe.hpe_3par_iscsi.HPE3PARISCSIDriver

View File

@ -0,0 +1,5 @@
---
features:
- |
HPE 3PAR Driver: Add support of iSCSI driver for Primera 4.2
or higher versions.