From e96dcc4e9744833ccea2697c67198f55aba3ad22 Mon Sep 17 00:00:00 2001 From: raghavendrat Date: Tue, 20 May 2025 09:05:55 +0000 Subject: [PATCH] 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 Depends-On: I91cd5e262513b5427377ce1892e9acfe29e22b21 Change-Id: I582c27d8d8a8e22d03b2d68152cb467a6db606bc Signed-off-by: raghavendrat (cherry picked from commit 255ccd6c6cc6c64b154d9fea7fc9020e80bb4766) (cherry picked from commit df190f7f4c720a8fa920f0ef55536f1181d78951) --- .../unit/volume/drivers/hpe/test_hpe3par.py | 11 +++++-- cinder/volume/drivers/hpe/hpe_3par_iscsi.py | 30 ++++++++++++------- ...-ignore-duplicate-ip-7e67260ee1cab40e.yaml | 5 ++++ 3 files changed, 33 insertions(+), 13 deletions(-) create mode 100644 releasenotes/notes/hpe-3par-ignore-duplicate-ip-7e67260ee1cab40e.yaml diff --git a/cinder/tests/unit/volume/drivers/hpe/test_hpe3par.py b/cinder/tests/unit/volume/drivers/hpe/test_hpe3par.py index 2df0d73f5f5..17ce469301f 100644 --- a/cinder/tests/unit/volume/drivers/hpe/test_hpe3par.py +++ b/cinder/tests/unit/volume/drivers/hpe/test_hpe3par.py @@ -9297,7 +9297,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() @@ -9329,7 +9336,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}] }] diff --git a/cinder/volume/drivers/hpe/hpe_3par_iscsi.py b/cinder/volume/drivers/hpe/hpe_3par_iscsi.py index 24e48cb24e6..9c0438e77e7 100644 --- a/cinder/volume/drivers/hpe/hpe_3par_iscsi.py +++ b/cinder/volume/drivers/hpe/hpe_3par_iscsi.py @@ -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): diff --git a/releasenotes/notes/hpe-3par-ignore-duplicate-ip-7e67260ee1cab40e.yaml b/releasenotes/notes/hpe-3par-ignore-duplicate-ip-7e67260ee1cab40e.yaml new file mode 100644 index 00000000000..a4463aa65ff --- /dev/null +++ b/releasenotes/notes/hpe-3par-ignore-duplicate-ip-7e67260ee1cab40e.yaml @@ -0,0 +1,5 @@ +fixes: + - | + HPE 3par driver `bug #2112433 + `_: Fixed failure + observed when vlan ip is same as iSCSI ip by ignoring the duplicate ip