From 797256eb7c87df10883668d7f84332bdc598dfbc Mon Sep 17 00:00:00 2001 From: Shay Halsband Date: Thu, 19 Nov 2015 16:42:46 +0200 Subject: [PATCH] XtremIO: fix iscsi chap discovery bug * The set and get parameters for discovery auth have different names and caused a confusion that led to a bug, fixed in this commit. * Add unit test to make sure the right parameters are used Change-Id: I8e61394ba5109f2a6c7018855f8b85133bc76412 Closes-Bug: #1518945 --- cinder/tests/unit/test_emc_xtremio.py | 6 ++++++ cinder/volume/drivers/emc/xtremio.py | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/cinder/tests/unit/test_emc_xtremio.py b/cinder/tests/unit/test_emc_xtremio.py index 067652212..ab59018f2 100644 --- a/cinder/tests/unit/test_emc_xtremio.py +++ b/cinder/tests/unit/test_emc_xtremio.py @@ -411,6 +411,12 @@ class EMCXIODriverISCSITestCase(test.TestCase): i1['chap-discovery-initiator-password'] = None map_data = self.driver.initialize_connection(self.data.test_volume2, self.data.connector) + data = {} + self.driver._add_auth(data, True, True) + self.assertIn('initiator-discovery-user-name', data, + 'Missing discovery user in data') + self.assertIn('initiator-discovery-password', data, + 'Missing discovery password in data') def test_initialize_connection_bad_ig(self, req): req.side_effect = xms_bad_request diff --git a/cinder/volume/drivers/emc/xtremio.py b/cinder/volume/drivers/emc/xtremio.py index 6de8ca191..12a7adf8c 100644 --- a/cinder/volume/drivers/emc/xtremio.py +++ b/cinder/volume/drivers/emc/xtremio.py @@ -724,9 +724,9 @@ class XtremIOISCSIDriver(XtremIOVolumeDriver, driver.ISCSIDriver): login_passwd = self._get_password() data['initiator-authentication-password'] = login_passwd if discovery_chap: - data['chap-discovery-initiator-user-name'] = 'chap_user' + data['initiator-discovery-user-name'] = 'chap_user' discovery_passwd = self._get_password() - data['chap-discovery-initiator-password'] = discovery_passwd + data['initiator-discovery-password'] = discovery_passwd return login_passwd, discovery_passwd def _create_initiator(self, connector, login_chap, discovery_chap): -- 2.45.2