Remove manager param for iDRAC OEM calls
Methods don't need to pass manager to execute OEM manager method because it already has that context. This was added for backportability. Depends-On: https://review.opendev.org/c/x/sushy-oem-idrac/+/792087 Change-Id: I67e89f72b1d847df233d2ffec51ca5e8963f51e9
This commit is contained in:
parent
183325d464
commit
fbb0020ab7
@ -20,4 +20,4 @@ ansible>=2.7
|
|||||||
python-ibmcclient>=0.2.2,<0.3.0
|
python-ibmcclient>=0.2.2,<0.3.0
|
||||||
|
|
||||||
# Dell EMC iDRAC sushy OEM extension
|
# Dell EMC iDRAC sushy OEM extension
|
||||||
sushy-oem-idrac>=2.1.0,<3.0.0
|
sushy-oem-idrac>=3.0.0,<4.0.0
|
||||||
|
@ -106,6 +106,5 @@ class DracRedfishVirtualMediaBoot(redfish_boot.RedfishVirtualMediaBoot):
|
|||||||
|
|
||||||
drac_utils.execute_oem_manager_method(
|
drac_utils.execute_oem_manager_method(
|
||||||
task, 'set virtual boot device',
|
task, 'set virtual boot device',
|
||||||
lambda m, manager: m.set_virtual_boot_device(
|
lambda m: m.set_virtual_boot_device(
|
||||||
device, persistent=persistent, system=system,
|
device, persistent=persistent, system=system))
|
||||||
manager=manager), pass_manager=True)
|
|
||||||
|
@ -24,7 +24,7 @@ sushy = importutils.try_import('sushy')
|
|||||||
|
|
||||||
|
|
||||||
def execute_oem_manager_method(
|
def execute_oem_manager_method(
|
||||||
task, process_name, lambda_oem_func, pass_manager=False):
|
task, process_name, lambda_oem_func):
|
||||||
"""Loads OEM manager and executes passed method on it.
|
"""Loads OEM manager and executes passed method on it.
|
||||||
|
|
||||||
Known iDRAC Redfish systems has only one manager, but as Redfish
|
Known iDRAC Redfish systems has only one manager, but as Redfish
|
||||||
@ -38,12 +38,6 @@ def execute_oem_manager_method(
|
|||||||
:param lambda_oem_func: method to execute as lambda function with
|
:param lambda_oem_func: method to execute as lambda function with
|
||||||
input parameter OEM extension manager.
|
input parameter OEM extension manager.
|
||||||
Example: lambda m: m.reset_idrac()
|
Example: lambda m: m.reset_idrac()
|
||||||
For older versions also support second input parameter Redfish
|
|
||||||
manager itself when pass_manager set to True.
|
|
||||||
:param pass_manager: whether to pass manager itself to executed
|
|
||||||
OEM extension method. This is for backward compability, new
|
|
||||||
functions must not pass manager, but acquire it internally. Will
|
|
||||||
be removed in future.
|
|
||||||
:returns: Returned value of lambda_oem_func
|
:returns: Returned value of lambda_oem_func
|
||||||
:raises: RedfishError if can't execute OEM function either because
|
:raises: RedfishError if can't execute OEM function either because
|
||||||
there are no managers to the system, failed to load OEM
|
there are no managers to the system, failed to load OEM
|
||||||
@ -82,10 +76,7 @@ def execute_oem_manager_method(
|
|||||||
raise exception.RedfishError(error=error_msg)
|
raise exception.RedfishError(error=error_msg)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
if pass_manager:
|
result = lambda_oem_func(manager_oem)
|
||||||
result = lambda_oem_func(manager_oem, manager)
|
|
||||||
else:
|
|
||||||
result = lambda_oem_func(manager_oem)
|
|
||||||
LOG.info("Completed: %(process_name)s with system %(system)s "
|
LOG.info("Completed: %(process_name)s with system %(system)s "
|
||||||
"manager %(manager)s for node %(node)s",
|
"manager %(manager)s for node %(node)s",
|
||||||
{'process_name': process_name,
|
{'process_name': process_name,
|
||||||
|
@ -77,8 +77,7 @@ class DracBootTestCase(test_utils.BaseDracTest):
|
|||||||
task, boot_devices.CDROM, persistent=True)
|
task, boot_devices.CDROM, persistent=True)
|
||||||
|
|
||||||
mock_manager_oem.set_virtual_boot_device.assert_called_once_with(
|
mock_manager_oem.set_virtual_boot_device.assert_called_once_with(
|
||||||
'cd', persistent=True, manager=mock_manager,
|
'cd', persistent=True, system=mock_system)
|
||||||
system=mock_system)
|
|
||||||
|
|
||||||
def test__set_boot_device_cd(self, mock_get_system):
|
def test__set_boot_device_cd(self, mock_get_system):
|
||||||
mock_system = mock_get_system.return_value
|
mock_system = mock_get_system.return_value
|
||||||
@ -91,8 +90,7 @@ class DracBootTestCase(test_utils.BaseDracTest):
|
|||||||
task.driver.boot._set_boot_device(task, boot_devices.CDROM)
|
task.driver.boot._set_boot_device(task, boot_devices.CDROM)
|
||||||
|
|
||||||
mock_manager_oem.set_virtual_boot_device.assert_called_once_with(
|
mock_manager_oem.set_virtual_boot_device.assert_called_once_with(
|
||||||
'cd', persistent=False, manager=mock_manager,
|
'cd', persistent=False, system=mock_system)
|
||||||
system=mock_system)
|
|
||||||
|
|
||||||
def test__set_boot_device_floppy(self, mock_get_system):
|
def test__set_boot_device_floppy(self, mock_get_system):
|
||||||
mock_system = mock_get_system.return_value
|
mock_system = mock_get_system.return_value
|
||||||
@ -105,8 +103,7 @@ class DracBootTestCase(test_utils.BaseDracTest):
|
|||||||
task.driver.boot._set_boot_device(task, boot_devices.FLOPPY)
|
task.driver.boot._set_boot_device(task, boot_devices.FLOPPY)
|
||||||
|
|
||||||
mock_manager_oem.set_virtual_boot_device.assert_called_once_with(
|
mock_manager_oem.set_virtual_boot_device.assert_called_once_with(
|
||||||
'floppy', persistent=False, manager=mock_manager,
|
'floppy', persistent=False, system=mock_system)
|
||||||
system=mock_system)
|
|
||||||
|
|
||||||
def test__set_boot_device_disk(self, mock_get_system):
|
def test__set_boot_device_disk(self, mock_get_system):
|
||||||
mock_system = mock_get_system.return_value
|
mock_system = mock_get_system.return_value
|
||||||
|
Loading…
Reference in New Issue
Block a user