]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Ensure that lun_id is an int
authorJay S. Bryant <jsbryant@us.ibm.com>
Thu, 1 May 2014 22:13:25 +0000 (17:13 -0500)
committerJay S. Bryant <jsbryant@us.ibm.com>
Thu, 1 May 2014 23:22:08 +0000 (18:22 -0500)
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

cinder/tests/test_storwize_svc.py
cinder/volume/drivers/ibm/storwize_svc/helpers.py

index 39a06dfab1dcef62580c52a2c746ef9bfaad9fc2..ea602d455330b9eba057ea0bcf262d670ca7b000 100644 (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']
                               }
index 558117526a43ef9094d9d465ec910e4782b55cbb..d2f6ee97ffbaf47d22f046da906788170371f80b 100644 (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."""