Ensure that lun_id is an int

The map_vol_to_host function was treating the lun number
as a string rather than an int.  This was causing attempts
to mount storwize_svc volumes to Hyper-V nodes to fail as they
were checking an integer type against a unicode type which
would fail.

This change casts result_lun to an integer after the value has
gone through the ssh injection attack check.  This way Hyper-V
is able to verify if the found LUN is the target LUN, enabling
mount of storwize_svc volumes to Hyper-V.

Change-Id: I96d179f2a58e5948c8ba6c9ae618daad7b8d4c86
Closes-bug: 1269915
This commit is contained in:
Jay S. Bryant 2014-05-01 17:13:25 -05:00
parent 07f231c5ef
commit 861e93a671
2 changed files with 4 additions and 4 deletions

View File

@ -1931,7 +1931,7 @@ class StorwizeSVCDriverTestCase(test.TestCase):
types[protocol] = volume_types.create(ctxt, protocol, opts)
expected = {'FC': {'driver_volume_type': 'fibre_channel',
'data': {'target_lun': '0',
'data': {'target_lun': 0,
'target_wwn': 'AABBCCDDEEFF0011',
'target_discovered': False}},
'iSCSI': {'driver_volume_type': 'iscsi',
@ -1939,7 +1939,7 @@ class StorwizeSVCDriverTestCase(test.TestCase):
'target_iqn':
'iqn.1982-01.com.ibm:1234.sim.node1',
'target_portal': '1.234.56.78:3260',
'target_lun': '0',
'target_lun': 0,
'auth_method': 'CHAP'}}}
for protocol in ['FC', 'iSCSI']:
@ -2547,7 +2547,7 @@ class StorwizeSVCDriverTestCase(test.TestCase):
{'ff00000000000000': ['AABBCCDDEEFF0011'],
'ff00000000000001': ['AABBCCDDEEFF0011']},
'target_discovered': False,
'target_lun': '0',
'target_lun': 0,
'target_wwn': 'AABBCCDDEEFF0011',
'volume_id': volume['id']
}

View File

@ -308,7 +308,7 @@ class StorwizeHelpers(object):
{'result_lun': result_lun,
'volume_name': volume_name,
'host_name': host_name})
return result_lun
return int(result_lun)
def unmap_vol_from_host(self, volume_name, host_name):
"""Unmap the volume and delete the host if it has no more mappings."""