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
This commit is contained in:
Adriano Rosso 2016-02-24 10:13:38 -03:00
parent 44e307eb5e
commit f376d32eab
2 changed files with 5 additions and 2 deletions

View File

@ -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

View File

@ -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']