From cd2408cdea80ccf5cce9fd92a6338c53c0778c33 Mon Sep 17 00:00:00 2001 From: Richard Hedlind Date: Tue, 23 Feb 2016 17:51:01 -0700 Subject: [PATCH] Force target_lun to be int type to make os-brick happy The X-IO driver was returning the target_lun field as a string from initialize_connection. It has to be an int to not cause breakage later on. Change-Id: I41c91b78753a2007c243ed30731f0a0cd92e68b5 Closes-Bug: #1549048 --- cinder/tests/unit/test_xio.py | 14 +++++++------- cinder/volume/drivers/xio.py | 5 +++-- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/cinder/tests/unit/test_xio.py b/cinder/tests/unit/test_xio.py index e7f5d2bb4..3ebb0825a 100644 --- a/cinder/tests/unit/test_xio.py +++ b/cinder/tests/unit/test_xio.py @@ -864,7 +864,7 @@ class XIOISEDriverTestCase(object): else: protocol = 'fibre_channel' exp_result = {'vendor_name': "X-IO", - 'driver_version': "1.1.3", + 'driver_version': "1.1.4", 'volume_backend_name': backend_name, 'reserved_percentage': 0, 'total_capacity_gb': 100, @@ -1038,14 +1038,14 @@ class XIOISEDriverTestCase(object): exp_result = {} if self.configuration.ise_protocol == 'iscsi': exp_result = {"driver_volume_type": "iscsi", - "data": {"target_lun": '1', + "data": {"target_lun": 1, "volume_id": '1', "target_discovered": False, "target_iqn": ISE_IQN, "target_portal": ISE_ISCSI_IP1 + ":3260"}} elif self.configuration.ise_protocol == 'fibre_channel': exp_result = {"driver_volume_type": "fibre_channel", - "data": {"target_lun": '1', + "data": {"target_lun": 1, "volume_id": '1', "target_discovered": True, "initiator_target_map": ISE_INIT_TARGET_MAP, @@ -1067,14 +1067,14 @@ class XIOISEDriverTestCase(object): exp_result = {} if self.configuration.ise_protocol == 'iscsi': exp_result = {"driver_volume_type": "iscsi", - "data": {"target_lun": '1', + "data": {"target_lun": 1, "volume_id": '1', "target_discovered": False, "target_iqn": ISE_IQN, "target_portal": ISE_ISCSI_IP1 + ":3260"}} elif self.configuration.ise_protocol == 'fibre_channel': exp_result = {"driver_volume_type": "fibre_channel", - "data": {"target_lun": '1', + "data": {"target_lun": 1, "volume_id": '1', "target_discovered": True, "initiator_target_map": ISE_INIT_TARGET_MAP, @@ -1096,7 +1096,7 @@ class XIOISEDriverTestCase(object): exp_result = {} if self.configuration.ise_protocol == 'iscsi': exp_result = {"driver_volume_type": "iscsi", - "data": {"target_lun": '1', + "data": {"target_lun": 1, "volume_id": '2', "target_discovered": False, "target_iqn": ISE_IQN, @@ -1106,7 +1106,7 @@ class XIOISEDriverTestCase(object): 'auth_password': 'abc'}} elif self.configuration.ise_protocol == 'fibre_channel': exp_result = {"driver_volume_type": "fibre_channel", - "data": {"target_lun": '1', + "data": {"target_lun": 1, "volume_id": '2', "target_discovered": True, "initiator_target_map": ISE_INIT_TARGET_MAP, diff --git a/cinder/volume/drivers/xio.py b/cinder/volume/drivers/xio.py index 6c6d9df2b..ecf36d4f1 100644 --- a/cinder/volume/drivers/xio.py +++ b/cinder/volume/drivers/xio.py @@ -63,7 +63,7 @@ def RaiseXIODriverException(): class XIOISEDriver(object): - VERSION = '1.1.3' + VERSION = '1.1.4' # Version Changes # 1.0.0 Base driver @@ -71,6 +71,7 @@ class XIOISEDriver(object): # 1.1.1 Fix retry loop (Bug 1429283) # 1.1.2 Fix host object deletion (Bug 1433450). # 1.1.3 Wait for volume/snapshot to be deleted. + # 1.1.4 Force target_lun to be int (Bug 1549048) def __init__(self, *args, **kwargs): super(XIOISEDriver, self).__init__() @@ -1343,7 +1344,7 @@ class XIOISEDriver(object): target_lun = self._present_volume(volume, host['name'], target_lun) # Fill in target information. data = {} - data['target_lun'] = target_lun + data['target_lun'] = int(target_lun) data['volume_id'] = volume['id'] return data -- 2.45.2