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

As seen in output of showport command below, there is possibility
of same ip address (172.28.50.151) being used for trunk iSCSI ip
and vlan ip.

s0452 cli% showport -iscsi
N:S:P State IPAddr         Netmask/PrefixLen Gateway TPGT . . .
0:4:2 ready 172.28.50.151  255.255.0.0       0.0.0.0   42 . . .
---------------------------------------------------------
1
s0452 cli%
s0452 cli% showport -iscsivlans
N:S:P     VLAN IPAddr        Netmask/PrefixLen Gateway . . .
0:4:2 untagged 172.28.50.151 255.255.0.0       0.0.0.0 . . .
-            5 172.28.50.240 255.255.0.0       0.0.0.0 . . .
------------------------------------------------------
2
s0452 cli%

This patch checks for duplicate IP and ignores them;
thus avoiding multiple calls (to create lun) for same IP.

Why this change is needed:
Below is the use case.

1. initialize connection function is invoked.
2. using trunk iSCSI ip 172.28.50.151, create lun invoked.
3. With vlan ip 172.28.50.151, it again tries to create lun.
4. And this fails because LUN is already created (with same ip)
in step 2.

Extract from cinder-volume log:
Driver initialize connection failed (error: Conflict (HTTP 409)
18 - LUN exists).

Solution:
While processing vlan ip, check if its same as iSCSI ip.
If so, skip the lun creation.

Closes-Bug: #2112433
Change-Id: I582c27d8d8a8e22d03b2d68152cb467a6db606bc
This commit is contained in:
raghavendrat
2025-05-20 09:05:55 +00:00
parent d23a17da67
commit 255ccd6c6c
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):

View File

@ -0,0 +1,5 @@
fixes:
- |
HPE 3par driver `bug #2112433
<https://bugs.launchpad.net/cinder/+bug/2112433>`_: Fixed failure
observed when vlan ip is same as iSCSI ip by ignoring the duplicate ip