Merge "HPE 3par: Ignore duplicate IP in iSCSI/vlan ip"

This commit is contained in:
Zuul
2025-06-05 00:05:34 +00:00
committed by Gerrit Code Review
3 changed files with 33 additions and 13 deletions

View File

@@ -9314,7 +9314,14 @@ class TestHPE3PARISCSIDriver(HPE3PARBaseDriver):
self.assertDictEqual(self.multipath_properties, result)
def test_initialize_connection_multipath_vlan_ip(self):
# iscsi_ip is 1.1.1.2
# two cases:
# (i) vlan_ip is different from iscsi_ip
# (ii) vlan_ip is same as iscsi_ip
@ddt.data({'vlan_ip': '192.168.100.1'},
{'vlan_ip': '1.1.1.2'})
@ddt.unpack
def test_initialize_connection_multipath_vlan_ip(self, vlan_ip):
# setup_mock_client drive with default configuration
# and return the mock HTTP 3PAR client
mock_client = self.setup_driver()
@@ -9346,7 +9353,7 @@ class TestHPE3PARISCSIDriver(HPE3PARBaseDriver):
mock_client.getiSCSIPorts.return_value = [{
'IPAddr': '1.1.1.2',
'iSCSIName': self.TARGET_IQN,
'iSCSIVlans': [{'IPAddr': '192.168.100.1',
'iSCSIVlans': [{'IPAddr': vlan_ip,
'iSCSIName': self.TARGET_IQN}]
}]

View File

@@ -132,10 +132,11 @@ class HPE3PARISCSIDriver(hpebasedriver.HPE3PARDriverBase):
4.0.7 - Use vlan iscsi ips. Bug #2015034
4.0.8 - Add ipv6 support. Bug #2045411
4.0.9 - getWsApiVersion now requires login
4.0.10 - Ignore duplicate IP address in iSCSI/vlan ip
"""
VERSION = "4.0.9"
VERSION = "4.0.10"
# The name of the CI wiki page.
CI_WIKI_NAME = "HPE_Storage_CI"
@@ -330,6 +331,8 @@ class HPE3PARISCSIDriver(hpebasedriver.HPE3PARDriverBase):
for port in ready_ports:
iscsi_ip = port['IPAddr']
if iscsi_ip in target_portal_ips:
LOG.debug("for iscsi ip: %(ip)s, create vlun or use existing",
{'ip': iscsi_ip})
lun_id = (
self._vlun_create_or_use_existing(
volume, common, host, iscsi_ips,
@@ -338,27 +341,32 @@ class HPE3PARISCSIDriver(hpebasedriver.HPE3PARDriverBase):
target_portal_ips,
existing_vluns, iscsi_ip,
lun_id, port))
else:
LOG.debug("iscsi ip: %(ip)s was not found in "
"hpe3par_iscsi_ips list defined in "
"cinder.conf.", {'ip': iscsi_ip})
if 'iSCSIVlans' in port:
LOG.debug("for port IPAddr: %(ip)s, the iSCSIVlans are: "
"%(vlans)s",
{'ip': iscsi_ip, 'vlans': port['iSCSIVlans']})
for vip in port['iSCSIVlans']:
iscsi_ip = vip['IPAddr']
if iscsi_ip in target_portal_ips:
LOG.debug("vlan ip: %(ip)s", {'ip': iscsi_ip})
vlan_ip = vip['IPAddr']
# if vlan_ip is in cinder.conf and
# vlan_ip is not same as iscsi_ip
# only then proceed with lun creation
if vlan_ip in target_portal_ips and vlan_ip != iscsi_ip:
LOG.debug("for vlan ip: %(ip)s, create vlun or use "
"existing", {'ip': vlan_ip})
lun_id = (
self._vlun_create_or_use_existing(
volume, common, host, iscsi_ips,
target_portals, target_iqns,
target_luns, remote_client,
target_portal_ips,
existing_vluns, iscsi_ip,
existing_vluns, vlan_ip,
lun_id, port))
else:
LOG.warning("iSCSI IP: '%s' was not found in "
"hpe3par_iscsi_ips list defined in "
"cinder.conf.", iscsi_ip)
@volume_utils.trace
@coordination.synchronized('3par-{volume.id}')
def initialize_connection(self, volume, connector):