Merge "3PAR: Allow iSCSI driver to be enabled for Primera 4.2 onwards." into stable/victoria

This commit is contained in:
Zuul 2022-01-04 19:24:02 +00:00 committed by Gerrit Code Review
commit 7d6ca2feb9
4 changed files with 65 additions and 11 deletions

View File

@ -763,14 +763,15 @@ class HPE3PARBaseDriver(test.TestCase):
spec=True, spec=True,
) )
def setup_mock_client(self, _m_client, driver, conf=None, m_conf=None, 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 _m_client = _m_client.return_value
# Configure the base constants, defaults etc... # Configure the base constants, defaults etc...
_m_client.configure_mock(**self.mock_client_conf) _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 _m_client.is_primera_array.return_value = is_primera
@ -8901,10 +8902,49 @@ class TestHPE3PARISCSIDriver(HPE3PARBaseDriver):
return mock_client 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, self.assertRaises(NotImplementedError, self.setup_mock_client,
driver=hpedriver.HPE3PARISCSIDriver, 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') @ddt.data('volume', 'volume_name_id')
def test_initialize_connection(self, volume_attr): def test_initialize_connection(self, volume_attr):

View File

@ -128,10 +128,11 @@ class HPE3PARISCSIDriver(hpebasedriver.HPE3PARDriverBase):
failover. bug #1773069 failover. bug #1773069
4.0.4 - Added Peer Persistence feature 4.0.4 - Added Peer Persistence feature
4.0.5 - Added Primera array check. bug #1849525 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. # The name of the CI wiki page.
CI_WIKI_NAME = "HPE_Storage_CI" CI_WIKI_NAME = "HPE_Storage_CI"
@ -144,9 +145,17 @@ class HPE3PARISCSIDriver(hpebasedriver.HPE3PARDriverBase):
client_obj = common.client client_obj = common.client
is_primera = client_obj.is_primera_array() is_primera = client_obj.is_primera_array()
if is_primera: if is_primera:
LOG.error("For Primera, only FC is supported. " api_version = client_obj.getWsApiVersion()
"iSCSI cannot be used") array_version = api_version['build']
raise NotImplementedError() 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 = {} self.iscsi_ips = {}
common.client_login() common.client_login()

View File

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