diff --git a/cinder/tests/unit/volume/drivers/dell_emc/test_xtremio.py b/cinder/tests/unit/volume/drivers/dell_emc/test_xtremio.py index 937a210e024..7662da29509 100644 --- a/cinder/tests/unit/volume/drivers/dell_emc/test_xtremio.py +++ b/cinder/tests/unit/volume/drivers/dell_emc/test_xtremio.py @@ -18,6 +18,7 @@ import re import time from unittest import mock +from oslo_utils import netutils import six from cinder import context @@ -700,6 +701,24 @@ class XtremIODriverISCSITestCase(BaseXtremIODriverTestCase): self.driver.initialize_connection(self.data.test_volume2, self.data.connector) + def test_initialize_connection_escape_ipv6(self, req): + req.side_effect = xms_request + portals = xms_data['iscsi-portals'].copy() + xms_data['iscsi-portals'] = { + 'fd00:206:553::7/16': { + "port-address": "iqn.2008-05.com.xtremio:003e67939c34", + "ip-port": 3260, + "ip-addr": "fd00:206:553::7/16", + "name": "fd00:206:553::7/16", + "index": 1, + }, + } + lunmap = {'lun': 4} + connection_properties = self.driver._get_iscsi_properties(lunmap) + result_addr, _ = connection_properties['target_portal'].rsplit(':', 1) + self.assertEqual(netutils.escape_ipv6('fd00:206:553::7'), result_addr) + xms_data['iscsi-portals'] = portals + def test_terminate_connection(self, req): req.side_effect = xms_request self.driver.create_volume(self.data.test_volume) diff --git a/cinder/volume/drivers/dell_emc/xtremio.py b/cinder/volume/drivers/dell_emc/xtremio.py index c2a5f965e63..53847a7a6c9 100644 --- a/cinder/volume/drivers/dell_emc/xtremio.py +++ b/cinder/volume/drivers/dell_emc/xtremio.py @@ -32,6 +32,7 @@ Supports XtremIO version 2.4 and up. 1.0.10 - option to clean unused IGs 1.0.11 - add support for multiattach 1.0.12 - add support for ports filtering + 1.0.13 - add support for iSCSI IPv6 """ import json @@ -41,6 +42,7 @@ import string from oslo_config import cfg from oslo_log import log as logging +from oslo_utils import netutils from oslo_utils import strutils from oslo_utils import units import requests @@ -427,7 +429,7 @@ class XtremIOClient42(XtremIOClient4): class XtremIOVolumeDriver(san.SanDriver): """Executes commands relating to Volumes.""" - VERSION = '1.0.12' + VERSION = '1.0.13' # ThirdPartySystems wiki CI_WIKI_NAME = "DellEMC_XtremIO_CI" @@ -1207,11 +1209,12 @@ class XtremIOISCSIDriver(XtremIOVolumeDriver, driver.ISCSIDriver): raise exception.VolumeBackendAPIException(data=msg) portal = RANDOM.choice(allowed_portals) portal_addr = ('%(ip)s:%(port)d' % - {'ip': portal['ip-addr'], + {'ip': netutils.escape_ipv6(portal['ip-addr']), 'port': portal['ip-port']}) - tg_portals = ['%(ip)s:%(port)d' % {'ip': p['ip-addr'], - 'port': p['ip-port']} + tg_portals = ['%(ip)s:%(port)d' % + {'ip': netutils.escape_ipv6(p['ip-addr']), + 'port': p['ip-port']} for p in allowed_portals] properties = {'target_discovered': False, 'target_iqn': portal['port-address'], diff --git a/releasenotes/notes/bug-1918889-xtremio-iscsi-ipv6-05c59b897da5c01b.yaml b/releasenotes/notes/bug-1918889-xtremio-iscsi-ipv6-05c59b897da5c01b.yaml new file mode 100644 index 00000000000..4f6c933f0fa --- /dev/null +++ b/releasenotes/notes/bug-1918889-xtremio-iscsi-ipv6-05c59b897da5c01b.yaml @@ -0,0 +1,5 @@ +--- +fixes: + - | + `Bug #1918889 `_: + Add support for iSCSI IPv6 in XtremIO driver.