Merge "Fixed problem with UEFI iSCSI boot for nic adapters"

This commit is contained in:
Zuul 2019-09-21 15:43:01 +00:00 committed by Gerrit Code Review
commit 19d9c1c4b3
4 changed files with 27 additions and 6 deletions

View File

@ -4,7 +4,7 @@
# python projects they should package as optional dependencies for Ironic. # python projects they should package as optional dependencies for Ironic.
# These are available on pypi # These are available on pypi
proliantutils>=2.9.0 proliantutils>=2.9.1
pysnmp>=4.3.0,<5.0.0 pysnmp>=4.3.0,<5.0.0
python-scciclient>=0.8.0 python-scciclient>=0.8.0
python-dracclient>=3.0.0,<4.0.0 python-dracclient>=3.0.0,<4.0.0

View File

@ -599,6 +599,7 @@ class IloManagement(base.ManagementInterface):
""" """
# Getting target info # Getting target info
node = task.node node = task.node
macs = [port['address'] for port in task.ports]
boot_volume = node.driver_internal_info.get('boot_from_volume') boot_volume = node.driver_internal_info.get('boot_from_volume')
volume = volume_target.VolumeTarget.get_by_uuid(task.context, volume = volume_target.VolumeTarget.get_by_uuid(task.context,
boot_volume) boot_volume)
@ -620,7 +621,7 @@ class IloManagement(base.ManagementInterface):
auth_method = 'CHAP' if username else None auth_method = 'CHAP' if username else None
ilo_object.set_iscsi_info( ilo_object.set_iscsi_info(
iqn, lun, host, port, auth_method=auth_method, 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: except ilo_error.IloCommandNotSupportedInBiosError as ilo_exception:
operation = (_("Setting of target IQN %(target_iqn)s for node " operation = (_("Setting of target IQN %(target_iqn)s for node "
"%(node)s") "%(node)s")
@ -644,7 +645,8 @@ class IloManagement(base.ManagementInterface):
""" """
ilo_object = ilo_common.get_ilo_object(task.node) ilo_object = ilo_common.get_ilo_object(task.node)
try: 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: except ilo_error.IloCommandNotSupportedInBiosError as ilo_exception:
operation = (_("Unsetting of iSCSI target for node %(node)s") operation = (_("Unsetting of iSCSI target for node %(node)s")
% {'node': task.node.uuid}) % {'node': task.node.uuid})

View File

@ -41,6 +41,16 @@ INFO_DICT = db_utils.get_test_ilo_info()
class IloManagementTestCase(test_common.BaseIloTest): 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): def test_get_properties(self):
with task_manager.acquire(self.context, self.node.uuid, with task_manager.acquire(self.context, self.node.uuid,
shared=False) as task: shared=False) as task:
@ -1009,7 +1019,8 @@ class IloManagementTestCase(test_common.BaseIloTest):
ilo_object_mock.set_iscsi_info.assert_called_once_with( ilo_object_mock.set_iscsi_info.assert_called_once_with(
'fake_iqn', 0, 'fake_host', '3260', 'fake_iqn', 0, 'fake_host', '3260',
auth_method='CHAP', username='fake_username', 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, @mock.patch.object(ilo_common, 'get_ilo_object', spec_set=True,
autospec=True) autospec=True)
@ -1031,7 +1042,8 @@ class IloManagementTestCase(test_common.BaseIloTest):
task.driver.management.set_iscsi_boot_target(task) task.driver.management.set_iscsi_boot_target(task)
ilo_object_mock.set_iscsi_info.assert_called_once_with( ilo_object_mock.set_iscsi_info.assert_called_once_with(
'fake_iqn', 0, 'fake_host', '3260', auth_method=None, '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, @mock.patch.object(ilo_common, 'get_ilo_object', spec_set=True,
autospec=True) autospec=True)
@ -1109,7 +1121,8 @@ class IloManagementTestCase(test_common.BaseIloTest):
ilo_object_mock = get_ilo_object_mock.return_value ilo_object_mock = get_ilo_object_mock.return_value
task.driver.management.clear_iscsi_boot_target(task) 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, @mock.patch.object(ilo_common, 'get_ilo_object', spec_set=True,
autospec=True) autospec=True)

View File

@ -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.