From cc54cea0605527723a3c67e64867b17cad8e8ada Mon Sep 17 00:00:00 2001 From: Vladyslav Drok Date: Wed, 25 May 2016 21:01:20 +0300 Subject: [PATCH] Use correct iscsi portal port in continue_deploy We should set it to CONF.iscsi.portal_port by default. Closes-Bug: #1585731 Change-Id: I34e1f2ff842b323fb390f16cca32309fb64cfea3 --- ironic/drivers/modules/iscsi_deploy.py | 2 +- ironic/tests/unit/drivers/modules/test_iscsi_deploy.py | 5 +++++ releasenotes/notes/fix-get-deploy-info-port.yaml | 4 ++++ 3 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 releasenotes/notes/fix-get-deploy-info-port.yaml diff --git a/ironic/drivers/modules/iscsi_deploy.py b/ironic/drivers/modules/iscsi_deploy.py index 3bfd3b01a4..40cc9ef051 100644 --- a/ironic/drivers/modules/iscsi_deploy.py +++ b/ironic/drivers/modules/iscsi_deploy.py @@ -202,7 +202,7 @@ def get_deploy_info(node, **kwargs): params = { 'address': kwargs.get('address'), - 'port': kwargs.get('port', '3260'), + 'port': kwargs.get('port', CONF.iscsi.portal_port), 'iqn': kwargs.get('iqn'), 'lun': kwargs.get('lun', '1'), 'image_path': _get_image_file_path(node.uuid), diff --git a/ironic/tests/unit/drivers/modules/test_iscsi_deploy.py b/ironic/tests/unit/drivers/modules/test_iscsi_deploy.py index 1511d8ae93..98c1c8c271 100644 --- a/ironic/tests/unit/drivers/modules/test_iscsi_deploy.py +++ b/ironic/tests/unit/drivers/modules/test_iscsi_deploy.py @@ -499,6 +499,11 @@ class IscsiDeployMethodsTestCase(db_base.DbTestCase): ret_val = self._test_get_deploy_info() self.assertNotIn('disk_label', ret_val) + def test_get_deploy_info_portal_port(self): + self.config(portal_port=3266, group='iscsi') + ret_val = self._test_get_deploy_info() + self.assertEqual(3266, ret_val['port']) + @mock.patch.object(iscsi_deploy, 'continue_deploy', autospec=True) @mock.patch.object(iscsi_deploy, 'build_deploy_ramdisk_options', autospec=True) diff --git a/releasenotes/notes/fix-get-deploy-info-port.yaml b/releasenotes/notes/fix-get-deploy-info-port.yaml new file mode 100644 index 0000000000..b85b8985d1 --- /dev/null +++ b/releasenotes/notes/fix-get-deploy-info-port.yaml @@ -0,0 +1,4 @@ +--- +fixes: + - Fixed the default value of 'port' in iscsi_deploy.get_deploy_info to be set + to [iscsi]/portal_port option value, instead of hardcoding it to '3260'.