From: Adriano Rosso Date: Wed, 24 Feb 2016 13:13:38 +0000 (-0300) Subject: Fix HNAS iSCSI driver attachment X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=f376d32eab55fec740dbab5a3d1cb770af8d94d2;p=openstack-build%2Fcinder-build.git Fix HNAS iSCSI driver attachment Currently, the HNAS iSCSI driver returns the logical unit number related to the iSCSI target as a string while initializing the connection. This is breaking the attachment feature because os-brick expects a numeric type. This patch converts the LUN from string to int in order to solve this problem. Change-Id: I33958a93a6261b7d77e4becafa3efd5180e5d091 Closes-Bug: 1549375 --- diff --git a/cinder/tests/unit/test_hitachi_hnas_iscsi.py b/cinder/tests/unit/test_hitachi_hnas_iscsi.py index 8a22ac867..b980bd508 100644 --- a/cinder/tests/unit/test_hitachi_hnas_iscsi.py +++ b/cinder/tests/unit/test_hitachi_hnas_iscsi.py @@ -415,6 +415,7 @@ class HNASiSCSIDriverTest(test.TestCase): vol = self._create_volume() conn = self.driver.initialize_connection(vol, connector) self.assertTrue('3260' in conn['data']['target_portal']) + self.assertTrue(type(conn['data']['target_lun']) is int) self.backend.add_iscsi_conn = mock.MagicMock() self.backend.add_iscsi_conn.side_effect = putils.ProcessExecutionError diff --git a/cinder/volume/drivers/hitachi/hnas_iscsi.py b/cinder/volume/drivers/hitachi/hnas_iscsi.py index 43c10f322..418e9450d 100644 --- a/cinder/volume/drivers/hitachi/hnas_iscsi.py +++ b/cinder/volume/drivers/hitachi/hnas_iscsi.py @@ -36,7 +36,7 @@ from cinder.volume.drivers.hitachi import hnas_backend from cinder.volume import utils from cinder.volume import volume_types -HDS_HNAS_ISCSI_VERSION = '4.1.0' +HDS_HNAS_ISCSI_VERSION = '4.3.0' LOG = logging.getLogger(__name__) @@ -174,6 +174,8 @@ class HDSISCSIDriver(driver.ISCSIDriver): Version 3.3.0: Fixed iSCSI target limitation error Version 4.0.0: Added manage/unmanage features Version 4.1.0: Fixed XML parser checks on blank options + Version 4.2.0: Fixed SSH and cluster_admin_ip0 verification + Version 4.3.0: Fixed attachment with os-brick 1.0.0 """ def __init__(self, *args, **kwargs): @@ -701,7 +703,7 @@ class HDSISCSIDriver(driver.ISCSIDriver): properties['target_discovered'] = False properties['target_portal'] = hnas_portal properties['target_iqn'] = fulliqn - properties['target_lun'] = hlun + properties['target_lun'] = int(hlun) properties['volume_id'] = volume['id'] properties['auth_username'] = connector['initiator']