]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
XtremIO: fix iscsi chap discovery bug
authorShay Halsband <shay.halsband@emc.com>
Thu, 19 Nov 2015 14:42:46 +0000 (16:42 +0200)
committerShay Halsband <shay.halsband@emc.com>
Sun, 6 Dec 2015 12:57:12 +0000 (14:57 +0200)
* 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
cinder/volume/drivers/emc/xtremio.py

index 0676522129cfc65d0608748f53915623091e0b2f..ab59018f24a6a0a6fd94eea20521880bceb9ec76 100644 (file)
@@ -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
index 6de8ca191fb0003bdc32a5d2ad5e69c8d1658f28..12a7adf8cddc9377d772a4f5202b17e3a677e25a 100644 (file)
@@ -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):