summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZuul <zuul@review.opendev.org>2022-07-14 17:27:09 +0000
committerGerrit Code Review <review@openstack.org>2022-07-14 17:27:09 +0000
commit2e597430cdbdab6308028f7084cbdc33a3a073b4 (patch)
tree5a42bd6382f8cbb05056defd69c2da8fac2713e1
parent827126ef20ded35104760a68c0eef2ea0ea18df3 (diff)
parentc0e8eda0dce9f63488db59f9d2c71f538c75cd51 (diff)
downloadcinder-2e597430cdbdab6308028f7084cbdc33a3a073b4.tar.gz
Merge "3PAR: Allow iSCSI driver to be enabled for Primera 4.2 onwards." into stable/ussuri
-rw-r--r--cinder/tests/unit/volume/drivers/hpe/test_hpe3par.py48
-rw-r--r--cinder/volume/drivers/hpe/hpe_3par_iscsi.py17
-rw-r--r--doc/source/configuration/block-storage/drivers/hpe-3par-driver.rst6
-rw-r--r--releasenotes/notes/hpe-3par-primera-add-iscsi-5af339643dfa0928.yaml5
4 files changed, 65 insertions, 11 deletions
diff --git a/cinder/tests/unit/volume/drivers/hpe/test_hpe3par.py b/cinder/tests/unit/volume/drivers/hpe/test_hpe3par.py
index 4972c7967..060e4537e 100644
--- a/cinder/tests/unit/volume/drivers/hpe/test_hpe3par.py
+++ b/cinder/tests/unit/volume/drivers/hpe/test_hpe3par.py
@@ -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):
diff --git a/cinder/volume/drivers/hpe/hpe_3par_iscsi.py b/cinder/volume/drivers/hpe/hpe_3par_iscsi.py
index 83febae89..0d809e048 100644
--- a/cinder/volume/drivers/hpe/hpe_3par_iscsi.py
+++ b/cinder/volume/drivers/hpe/hpe_3par_iscsi.py
@@ -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()
diff --git a/doc/source/configuration/block-storage/drivers/hpe-3par-driver.rst b/doc/source/configuration/block-storage/drivers/hpe-3par-driver.rst
index d013cdc03..bad3e3d4c 100644
--- a/doc/source/configuration/block-storage/drivers/hpe-3par-driver.rst
+++ b/doc/source/configuration/block-storage/drivers/hpe-3par-driver.rst
@@ -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
diff --git a/releasenotes/notes/hpe-3par-primera-add-iscsi-5af339643dfa0928.yaml b/releasenotes/notes/hpe-3par-primera-add-iscsi-5af339643dfa0928.yaml
new file mode 100644
index 000000000..03166024b
--- /dev/null
+++ b/releasenotes/notes/hpe-3par-primera-add-iscsi-5af339643dfa0928.yaml
@@ -0,0 +1,5 @@
+---
+features:
+ - |
+ HPE 3PAR Driver: Add support of iSCSI driver for Primera 4.2
+ or higher versions.