From a1340c7e95b4e7c7a61e146dc5354291aba7c667 Mon Sep 17 00:00:00 2001 From: paresh-sao Date: Tue, 6 Aug 2019 07:52:54 +0000 Subject: [PATCH] Fixed problem with UEFI iSCSI boot for nic adapters This commit fixes problem with multiple nic adapter by passing macs as an parameter while [un]set iSCSI target. Change-Id: Id533a476ac376dea68955b2a0de070212285b9e8 Depends-on: Iea420d7a047c8ac849fa2eeab5c6892be2d7a6e1 Story: #2006349 Task: #36114 --- driver-requirements.txt | 2 +- ironic/drivers/modules/ilo/management.py | 6 ++++-- .../drivers/modules/ilo/test_management.py | 19 ++++++++++++++++--- ...-fix-uefi-iscsi-boot-702ced18e28c5c61.yaml | 6 ++++++ 4 files changed, 27 insertions(+), 6 deletions(-) create mode 100644 releasenotes/notes/ilo-fix-uefi-iscsi-boot-702ced18e28c5c61.yaml diff --git a/driver-requirements.txt b/driver-requirements.txt index 8cc99d6b42..beb5421862 100644 --- a/driver-requirements.txt +++ b/driver-requirements.txt @@ -4,7 +4,7 @@ # python projects they should package as optional dependencies for Ironic. # These are available on pypi -proliantutils>=2.9.0 +proliantutils>=2.9.1 pysnmp>=4.3.0,<5.0.0 python-scciclient>=0.8.0 python-dracclient>=3.0.0,<4.0.0 diff --git a/ironic/drivers/modules/ilo/management.py b/ironic/drivers/modules/ilo/management.py index 2ce0140c3b..8027c57158 100644 --- a/ironic/drivers/modules/ilo/management.py +++ b/ironic/drivers/modules/ilo/management.py @@ -535,6 +535,7 @@ class IloManagement(base.ManagementInterface): """ # Getting target info node = task.node + macs = [port['address'] for port in task.ports] boot_volume = node.driver_internal_info.get('boot_from_volume') volume = volume_target.VolumeTarget.get_by_uuid(task.context, boot_volume) @@ -556,7 +557,7 @@ class IloManagement(base.ManagementInterface): auth_method = 'CHAP' if username else None ilo_object.set_iscsi_info( iqn, lun, host, port, auth_method=auth_method, - username=username, password=password) + username=username, password=password, macs=macs) except ilo_error.IloCommandNotSupportedInBiosError as ilo_exception: operation = (_("Setting of target IQN %(target_iqn)s for node " "%(node)s") @@ -580,7 +581,8 @@ class IloManagement(base.ManagementInterface): """ ilo_object = ilo_common.get_ilo_object(task.node) try: - ilo_object.unset_iscsi_info() + macs = [port['address'] for port in task.ports] + ilo_object.unset_iscsi_info(macs=macs) except ilo_error.IloCommandNotSupportedInBiosError as ilo_exception: operation = (_("Unsetting of iSCSI target for node %(node)s") % {'node': task.node.uuid}) diff --git a/ironic/tests/unit/drivers/modules/ilo/test_management.py b/ironic/tests/unit/drivers/modules/ilo/test_management.py index c79d773574..90793a6334 100644 --- a/ironic/tests/unit/drivers/modules/ilo/test_management.py +++ b/ironic/tests/unit/drivers/modules/ilo/test_management.py @@ -40,6 +40,16 @@ INFO_DICT = db_utils.get_test_ilo_info() class IloManagementTestCase(test_common.BaseIloTest): + def setUp(self): + super(IloManagementTestCase, self).setUp() + port_1 = obj_utils.create_test_port( + self.context, node_id=self.node.id, + address='11:22:33:44:55:66', uuid=uuidutils.generate_uuid()) + port_2 = obj_utils.create_test_port( + self.context, node_id=self.node.id, + address='11:22:33:44:55:67', uuid=uuidutils.generate_uuid()) + self.ports = [port_1, port_2] + def test_get_properties(self): with task_manager.acquire(self.context, self.node.uuid, shared=False) as task: @@ -743,7 +753,8 @@ class IloManagementTestCase(test_common.BaseIloTest): ilo_object_mock.set_iscsi_info.assert_called_once_with( 'fake_iqn', 0, 'fake_host', '3260', auth_method='CHAP', username='fake_username', - password='fake_password') + password='fake_password', + macs=['11:22:33:44:55:66', '11:22:33:44:55:67']) @mock.patch.object(ilo_common, 'get_ilo_object', spec_set=True, autospec=True) @@ -765,7 +776,8 @@ class IloManagementTestCase(test_common.BaseIloTest): task.driver.management.set_iscsi_boot_target(task) ilo_object_mock.set_iscsi_info.assert_called_once_with( 'fake_iqn', 0, 'fake_host', '3260', auth_method=None, - password=None, username=None) + password=None, username=None, + macs=['11:22:33:44:55:66', '11:22:33:44:55:67']) @mock.patch.object(ilo_common, 'get_ilo_object', spec_set=True, autospec=True) @@ -843,7 +855,8 @@ class IloManagementTestCase(test_common.BaseIloTest): ilo_object_mock = get_ilo_object_mock.return_value task.driver.management.clear_iscsi_boot_target(task) - ilo_object_mock.unset_iscsi_info.assert_called_once() + ilo_object_mock.unset_iscsi_info.assert_called_once_with( + macs=['11:22:33:44:55:66', '11:22:33:44:55:67']) @mock.patch.object(ilo_common, 'get_ilo_object', spec_set=True, autospec=True) diff --git a/releasenotes/notes/ilo-fix-uefi-iscsi-boot-702ced18e28c5c61.yaml b/releasenotes/notes/ilo-fix-uefi-iscsi-boot-702ced18e28c5c61.yaml new file mode 100644 index 0000000000..2a2e8f821b --- /dev/null +++ b/releasenotes/notes/ilo-fix-uefi-iscsi-boot-702ced18e28c5c61.yaml @@ -0,0 +1,6 @@ +--- +fixes: + - Fixes a bug in the iLO UEFI iSCSI Boot, where it fails if server has + multiple nic adapters, since Proliant Servers has a limitation of + creating only four iSCSI nic sources and existing implementation + would try to create for more and failed accordingly.