Skip to content

Commit

Permalink
iSCSI driver initialization should fail for Primera backend
Browse files Browse the repository at this point in the history
For HPE Primera array, only FC driver is supported as of now.
If user configures iSCSI with Primera, then driver initialization
should fail.

Change-Id: Ifd8166b888b76d980ab93f97278669e0d58b3154
Closes-Bug: #1849525
  • Loading branch information
traghavendra committed Nov 11, 2019
1 parent 328fd37 commit 25a3216
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
12 changes: 11 additions & 1 deletion cinder/tests/unit/volume/drivers/hpe/test_hpe3par.py
Original file line number Diff line number Diff line change
Expand Up @@ -733,7 +733,8 @@ def setup_configuration(self):
'hpe3parclient.client.HPE3ParClient',
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):

_m_client = _m_client.return_value

Expand All @@ -742,6 +743,8 @@ def setup_mock_client(self, _m_client, driver, conf=None, m_conf=None):

_m_client.getWsApiVersion.return_value = self.wsapi_version_latest

_m_client.is_primera_array.return_value = is_primera

# If m_conf, drop those over the top of the base_conf.
if m_conf is not None:
_m_client.configure_mock(**m_conf)
Expand Down Expand Up @@ -8667,17 +8670,24 @@ def setup_driver(self, config=None, mock_conf=None, wsapi_version=None):
mock.call.getCPG(HPE3PAR_CPG),
mock.call.getCPG(HPE3PAR_CPG2)]
expected_get_ports = [mock.call.getPorts()]
expected_primera_check = [mock.call.is_primera_array()]
mock_client.assert_has_calls(
self.standard_login +
expected_get_cpgs +
self.standard_logout +
expected_primera_check +
self.standard_login +
expected_get_ports +
self.standard_logout)
mock_client.reset_mock()

return mock_client

def test_iscsi_primera(self):
self.assertRaises(NotImplementedError, self.setup_mock_client,
driver=hpedriver.HPE3PARISCSIDriver,
is_primera=True)

def test_initialize_connection(self):
# setup_mock_client drive with default configuration
# and return the mock HTTP 3PAR client
Expand Down
10 changes: 9 additions & 1 deletion cinder/volume/drivers/hpe/hpe_3par_iscsi.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,10 +127,11 @@ class HPE3PARISCSIDriver(hpebasedriver.HPE3PARDriverBase):
4.0.3 - Set proper backend on subsequent operation, after group
failover. bug #1773069
4.0.4 - Added Peer Persistence feature
4.0.5 - Added Primera array check. bug #1849525
"""

VERSION = "4.0.4"
VERSION = "4.0.5"

# The name of the CI wiki page.
CI_WIKI_NAME = "HPE_Storage_CI"
Expand All @@ -140,6 +141,13 @@ def __init__(self, *args, **kwargs):
self.protocol = 'iSCSI'

def _do_setup(self, common):
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()

self.iscsi_ips = {}
common.client_login()
try:
Expand Down

0 comments on commit 25a3216

Please sign in to comment.